From: support Date: Mon, 23 Jan 2023 14:11:36 +0000 (+0000) Subject: Built motion from commit 56b8093a.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/google.github.io/material-design-icons?a=commitdiff_plain;h=f62d491c2e8107f16496a8b641a4b2b79f0145b6;p=motion2.git Built motion from commit 56b8093a.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 461c2e4..b0ba6b8 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-23T13:32:23.496Z", + "time": "2023-01-23T14:03:05.113Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 818dada..ef30049 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-23T13:32:23.496Z", + "time": "2023-01-23T14:03:05.113Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 828fec0..bec345e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -7177,11 +7177,6 @@ "from": "ret@>=0.1.10 <0.2.0", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" }, - "retry": { - "version": "0.13.1", - "from": "retry@latest", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz" - }, "retry-as-promised": { "version": "2.3.2", "from": "retry-as-promised@>=2.0.0 <3.0.0", diff --git a/package.json b/package.json index dc3bbc0..c430d50 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,6 @@ "pm2": "2.10.4", "randomstring": "1.1.5", "request-promise": "4.2.6", - "retry": "^0.13.1", "retry-request": "^4.0.0", "rimraf": "2.7.1", "rr": "0.1.0", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 9a7ef3e..d441de2 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 _0x1e93=['motionbar','jscripty','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x1e93,0x14b));var _0x31e9=function(_0x5673f1,_0x3cc273){_0x5673f1=_0x5673f1-0x0;var _0x5bd0ee=_0x1e93[_0x5673f1];return _0x5bd0ee;};'use strict';var Sequelize=require(_0x31e9('0x0'));module[_0x31e9('0x1')]={'name':{'type':Sequelize[_0x31e9('0x2')],'get':function(_0x404393){return this['getDataValue'](_0x31e9('0x3'));}},'action':{'type':Sequelize[_0x31e9('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x31e9('0x5'),_0x31e9('0x6'),'urlForward','browser','bot',_0x31e9('0x7')]],'msg':_0x31e9('0x8')}},'comment':_0x31e9('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x31e9('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x31e9('0x4')](0x1000),'comment':_0x31e9('0x9')},'data4':{'type':Sequelize[_0x31e9('0x4')](0x1000),'comments':_0x31e9('0xa')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x31e9('0xb')},'data6':{'type':Sequelize[_0x31e9('0x4')],'comments':_0x31e9('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x31e9('0xd')}}; \ No newline at end of file +var _0x9e84=['urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e84,0x196));var _0x49e8=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x9e84[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0x49e8('0x0'));module[_0x49e8('0x1')]={'name':{'type':Sequelize[_0x49e8('0x2')],'get':function(_0x525f38){return this['getDataValue'](_0x49e8('0x3'));}},'action':{'type':Sequelize[_0x49e8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x49e8('0x5'),_0x49e8('0x6'),_0x49e8('0x7'),'jscripty',_0x49e8('0x8'),_0x49e8('0x9'),_0x49e8('0xa'),'script']],'msg':_0x49e8('0xb')}},'comment':_0x49e8('0xb')},'data1':{'type':Sequelize[_0x49e8('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x49e8('0x4')](0x1000),'comment':_0x49e8('0xc')},'data3':{'type':Sequelize[_0x49e8('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x49e8('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x49e8('0xd')},'data6':{'type':Sequelize[_0x49e8('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x49e8('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 484e5ac..44f30d8 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 _0xfe07=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','update','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3f32d9,_0x3807f3){var _0x44375b=function(_0x2776b2){while(--_0x2776b2){_0x3f32d9['push'](_0x3f32d9['shift']());}};_0x44375b(++_0x3807f3);}(_0xfe07,0x161));var _0x7fe0=function(_0x1bf4f9,_0x48a7b2){_0x1bf4f9=_0x1bf4f9-0x0;var _0x2f0a77=_0xfe07[_0x1bf4f9];return _0x2f0a77;};'use strict';var emlformat=require(_0x7fe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fe0('0x1'));var jsonpatch=require(_0x7fe0('0x2'));var rp=require(_0x7fe0('0x3'));var moment=require(_0x7fe0('0x4'));var BPromise=require(_0x7fe0('0x5'));var Mustache=require(_0x7fe0('0x6'));var util=require('util');var path=require(_0x7fe0('0x7'));var sox=require('sox');var csv=require(_0x7fe0('0x8'));var ejs=require(_0x7fe0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7fe0('0xa'));var crypto=require(_0x7fe0('0xb'));var jsforce=require(_0x7fe0('0xc'));var deskjs=require(_0x7fe0('0xd'));var toCsv=require(_0x7fe0('0x8'));var querystring=require(_0x7fe0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fe0('0xf'));var qs=require(_0x7fe0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fe0('0x11'));var logger=require(_0x7fe0('0x12'))('api');var utils=require(_0x7fe0('0x13'));var config=require(_0x7fe0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fe0('0x15'))['db'];function respondWithStatusCode(_0x2d8754,_0x26ba6f){_0x26ba6f=_0x26ba6f||0xcc;return function(_0x2dad86){if(_0x2dad86){return _0x2d8754[_0x7fe0('0x16')](_0x26ba6f);}return _0x2d8754[_0x7fe0('0x17')](_0x26ba6f)[_0x7fe0('0x18')]();};}function respondWithResult(_0x556edc,_0x3eee3f){_0x3eee3f=_0x3eee3f||0xc8;return function(_0x430059){if(_0x430059){return _0x556edc[_0x7fe0('0x17')](_0x3eee3f)[_0x7fe0('0x19')](_0x430059);}};}function respondWithFilteredResult(_0x2f03e7,_0x5616be){return function(_0x239088){if(_0x239088){var _0x485ad1=typeof _0x5616be['offset']===_0x7fe0('0x1a')&&typeof _0x5616be[_0x7fe0('0x1b')]===_0x7fe0('0x1a');var _0x7cc12=_0x239088[_0x7fe0('0x1c')];var _0x5d8f8f=_0x485ad1?0x0:_0x5616be[_0x7fe0('0x1d')];var _0x280fe6=_0x485ad1?_0x239088[_0x7fe0('0x1c')]:_0x5616be[_0x7fe0('0x1d')]+_0x5616be[_0x7fe0('0x1b')];var _0x94d2cb;if(_0x280fe6>=_0x7cc12){_0x280fe6=_0x7cc12;_0x94d2cb=0xc8;}else{_0x94d2cb=0xce;}_0x2f03e7[_0x7fe0('0x17')](_0x94d2cb);return _0x2f03e7[_0x7fe0('0x1e')](_0x7fe0('0x1f'),_0x5d8f8f+'-'+_0x280fe6+'/'+_0x7cc12)[_0x7fe0('0x19')](_0x239088);}return null;};}function patchUpdates(_0x29ade5){return function(_0x1bbe40){try{jsonpatch[_0x7fe0('0x20')](_0x1bbe40,_0x29ade5,!![]);}catch(_0x2787ce){return BPromise[_0x7fe0('0x21')](_0x2787ce);}return _0x1bbe40['save']();};}function saveUpdates(_0x2e1c73,_0x1788da){return function(_0x479cd1){if(_0x479cd1){return _0x479cd1['update'](_0x2e1c73)[_0x7fe0('0x22')](function(_0x3dd5d8){return _0x3dd5d8;});}return null;};}function removeEntity(_0x155286,_0x850f8a){return function(_0x1fdb6a){if(_0x1fdb6a){return _0x1fdb6a[_0x7fe0('0x23')]()[_0x7fe0('0x22')](function(){_0x155286[_0x7fe0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2194c8,_0x3c84cf){return function(_0x38cf1e){if(!_0x38cf1e){_0x2194c8[_0x7fe0('0x16')](0x194);}return _0x38cf1e;};}function handleError(_0x3a882d,_0x40f335){_0x40f335=_0x40f335||0x1f4;return function(_0x1075d9){logger[_0x7fe0('0x24')](_0x1075d9[_0x7fe0('0x25')]);if(_0x1075d9['name']){delete _0x1075d9[_0x7fe0('0x26')];}_0x3a882d['status'](_0x40f335)[_0x7fe0('0x27')](_0x1075d9);};}exports[_0x7fe0('0x28')]=function(_0x5ba08b,_0x4cd937){if(_0x5ba08b['body']['id']){delete _0x5ba08b[_0x7fe0('0x29')]['id'];}return db[_0x7fe0('0x2a')][_0x7fe0('0x2b')]({'where':{'id':_0x5ba08b[_0x7fe0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cd937,null))[_0x7fe0('0x22')](saveUpdates(_0x5ba08b['body'],null))[_0x7fe0('0x22')](respondWithResult(_0x4cd937,null))[_0x7fe0('0x2d')](handleError(_0x4cd937,null));};exports['destroy']=function(_0x4b2fb4,_0x3568ac){return db[_0x7fe0('0x2a')][_0x7fe0('0x2b')]({'where':{'id':_0x4b2fb4[_0x7fe0('0x2c')]['id']}})[_0x7fe0('0x22')](handleEntityNotFound(_0x3568ac,null))[_0x7fe0('0x22')](removeEntity(_0x3568ac,null))[_0x7fe0('0x2d')](handleError(_0x3568ac,null));}; \ No newline at end of file +var _0x75bc=['destroy','then','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x5470ff,_0x1d46c3){var _0x547d3a=function(_0x430686){while(--_0x430686){_0x5470ff['push'](_0x5470ff['shift']());}};_0x547d3a(++_0x1d46c3);}(_0x75bc,0x10f));var _0xc75b=function(_0x5754cd,_0x2c655b){_0x5754cd=_0x5754cd-0x0;var _0xec0f7b=_0x75bc[_0x5754cd];return _0xec0f7b;};'use strict';var emlformat=require(_0xc75b('0x0'));var rimraf=require(_0xc75b('0x1'));var zipdir=require(_0xc75b('0x2'));var jsonpatch=require(_0xc75b('0x3'));var rp=require(_0xc75b('0x4'));var moment=require(_0xc75b('0x5'));var BPromise=require(_0xc75b('0x6'));var Mustache=require(_0xc75b('0x7'));var util=require(_0xc75b('0x8'));var path=require(_0xc75b('0x9'));var sox=require(_0xc75b('0xa'));var csv=require(_0xc75b('0xb'));var ejs=require(_0xc75b('0xc'));var fs=require('fs');var fs_extra=require(_0xc75b('0xd'));var _=require(_0xc75b('0xe'));var squel=require(_0xc75b('0xf'));var crypto=require(_0xc75b('0x10'));var jsforce=require(_0xc75b('0x11'));var deskjs=require(_0xc75b('0x12'));var toCsv=require(_0xc75b('0xb'));var querystring=require(_0xc75b('0x13'));var Papa=require('papaparse');var Redis=require(_0xc75b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc75b('0x15'));var as=require(_0xc75b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc75b('0x17'));var utils=require('../../config/utils');var config=require(_0xc75b('0x18'));var licenseUtil=require(_0xc75b('0x19'));var db=require(_0xc75b('0x1a'))['db'];function respondWithStatusCode(_0x43e22e,_0x32921e){_0x32921e=_0x32921e||0xcc;return function(_0x8cf925){if(_0x8cf925){return _0x43e22e[_0xc75b('0x1b')](_0x32921e);}return _0x43e22e[_0xc75b('0x1c')](_0x32921e)[_0xc75b('0x1d')]();};}function respondWithResult(_0xcdc8fb,_0xdea2c){_0xdea2c=_0xdea2c||0xc8;return function(_0x453e0a){if(_0x453e0a){return _0xcdc8fb[_0xc75b('0x1c')](_0xdea2c)['json'](_0x453e0a);}};}function respondWithFilteredResult(_0x352684,_0x4a0eae){return function(_0x556f4c){if(_0x556f4c){var _0x21bfb6=typeof _0x4a0eae[_0xc75b('0x1e')]===_0xc75b('0x1f')&&typeof _0x4a0eae['limit']==='undefined';var _0x360d8b=_0x556f4c[_0xc75b('0x20')];var _0x3c6f1d=_0x21bfb6?0x0:_0x4a0eae[_0xc75b('0x1e')];var _0x43c547=_0x21bfb6?_0x556f4c['count']:_0x4a0eae[_0xc75b('0x1e')]+_0x4a0eae[_0xc75b('0x21')];var _0x2fe7a6;if(_0x43c547>=_0x360d8b){_0x43c547=_0x360d8b;_0x2fe7a6=0xc8;}else{_0x2fe7a6=0xce;}_0x352684['status'](_0x2fe7a6);return _0x352684[_0xc75b('0x22')](_0xc75b('0x23'),_0x3c6f1d+'-'+_0x43c547+'/'+_0x360d8b)[_0xc75b('0x24')](_0x556f4c);}return null;};}function patchUpdates(_0x141b19){return function(_0x494880){try{jsonpatch[_0xc75b('0x25')](_0x494880,_0x141b19,!![]);}catch(_0x1ba9cd){return BPromise[_0xc75b('0x26')](_0x1ba9cd);}return _0x494880[_0xc75b('0x27')]();};}function saveUpdates(_0x1960fa,_0x4bfc45){return function(_0x4777d8){if(_0x4777d8){return _0x4777d8[_0xc75b('0x28')](_0x1960fa)['then'](function(_0x50108e){return _0x50108e;});}return null;};}function removeEntity(_0x9dcc5c,_0x11d202){return function(_0x940da8){if(_0x940da8){return _0x940da8[_0xc75b('0x29')]()[_0xc75b('0x2a')](function(){_0x9dcc5c['status'](0xcc)[_0xc75b('0x1d')]();});}};}function handleEntityNotFound(_0x2b40d6,_0x2fa6a8){return function(_0x1dac54){if(!_0x1dac54){_0x2b40d6[_0xc75b('0x1b')](0x194);}return _0x1dac54;};}function handleError(_0x404b4e,_0x375aa5){_0x375aa5=_0x375aa5||0x1f4;return function(_0x5ea0ed){logger[_0xc75b('0x2b')](_0x5ea0ed[_0xc75b('0x2c')]);if(_0x5ea0ed[_0xc75b('0x2d')]){delete _0x5ea0ed[_0xc75b('0x2d')];}_0x404b4e[_0xc75b('0x1c')](_0x375aa5)[_0xc75b('0x2e')](_0x5ea0ed);};}exports[_0xc75b('0x28')]=function(_0x5ee7b4,_0x3da2fb){if(_0x5ee7b4[_0xc75b('0x2f')]['id']){delete _0x5ee7b4[_0xc75b('0x2f')]['id'];}return db[_0xc75b('0x30')][_0xc75b('0x31')]({'where':{'id':_0x5ee7b4[_0xc75b('0x32')]['id']}})[_0xc75b('0x2a')](handleEntityNotFound(_0x3da2fb,null))[_0xc75b('0x2a')](saveUpdates(_0x5ee7b4[_0xc75b('0x2f')],null))[_0xc75b('0x2a')](respondWithResult(_0x3da2fb,null))[_0xc75b('0x33')](handleError(_0x3da2fb,null));};exports[_0xc75b('0x29')]=function(_0x131e81,_0x352ff0){return db[_0xc75b('0x30')][_0xc75b('0x31')]({'where':{'id':_0x131e81[_0xc75b('0x32')]['id']}})['then'](handleEntityNotFound(_0x352ff0,null))[_0xc75b('0x2a')](removeEntity(_0x352ff0,null))[_0xc75b('0x33')](handleError(_0x352ff0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 302cd1b..d8181a1 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 _0x31a3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger'];(function(_0x23f659,_0x33bfcb){var _0x1edce0=function(_0x48ca3f){while(--_0x48ca3f){_0x23f659['push'](_0x23f659['shift']());}};_0x1edce0(++_0x33bfcb);}(_0x31a3,0x183));var _0x331a=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x31a3[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var logger=require(_0x331a('0x2'))(_0x331a('0x3'));var moment=require(_0x331a('0x4'));var BPromise=require(_0x331a('0x5'));var rp=require(_0x331a('0x6'));var fs=require('fs');var path=require(_0x331a('0x7'));var rimraf=require(_0x331a('0x8'));var config=require(_0x331a('0x9'));var attributes=require(_0x331a('0xa'));module[_0x331a('0xb')]=function(_0x7665a9,_0x221b58){return _0x7665a9[_0x331a('0xc')](_0x331a('0xd'),attributes,{'tableName':_0x331a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf42=['../../config/logger','api','moment','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xaf42,0x11f));var _0x2af4=function(_0x502630,_0x55d533){_0x502630=_0x502630-0x0;var _0x3b4819=_0xaf42[_0x502630];return _0x3b4819;};'use strict';var _=require('lodash');var util=require(_0x2af4('0x0'));var logger=require(_0x2af4('0x1'))(_0x2af4('0x2'));var moment=require(_0x2af4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2af4('0x4'));var rimraf=require(_0x2af4('0x5'));var config=require(_0x2af4('0x6'));var attributes=require(_0x2af4('0x7'));module[_0x2af4('0x8')]=function(_0x57c97d,_0x1f8cd3){return _0x57c97d[_0x2af4('0x9')](_0x2af4('0xa'),attributes,{'tableName':_0x2af4('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 d706ba0..2fd49ea 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e7088,_0x53f329){var _0x569c18=function(_0x3c09b9){while(--_0x3c09b9){_0x3e7088['push'](_0x3e7088['shift']());}};_0x569c18(++_0x53f329);}(_0x8ef6,0xf2));var _0x68ef=function(_0x333981,_0x344c4e){_0x333981=_0x333981-0x0;var _0xfcb54d=_0x8ef6[_0x333981];return _0xfcb54d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x229f1b,_0x1eca63){var _0x7e7505=function(_0x2964e5){while(--_0x2964e5){_0x229f1b['push'](_0x229f1b['shift']());}};_0x7e7505(++_0x1eca63);}(_0x1261,0x144));var _0x1126=function(_0x2b6b89,_0x172ec0){_0x2b6b89=_0x2b6b89-0x0;var _0x5aa6af=_0x1261[_0x2b6b89];return _0x5aa6af;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b354062..c7ee77e 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 _0xb9e1=['../../components/auth/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','connect-timeout','express','fs-extra'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xb9e1,0x126));var _0x1b9e=function(_0xab3157,_0x28ef0c){_0xab3157=_0xab3157-0x0;var _0x4045dc=_0xb9e1[_0xab3157];return _0x4045dc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1b9e('0x0'));var express=require(_0x1b9e('0x1'));var router=express['Router']();var fs_extra=require(_0x1b9e('0x2'));var auth=require(_0x1b9e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b9e('0x4'));router[_0x1b9e('0x5')](_0x1b9e('0x6'),auth[_0x1b9e('0x7')](),controller[_0x1b9e('0x8')]);router[_0x1b9e('0x9')]('/:id',auth[_0x1b9e('0x7')](),controller[_0x1b9e('0xa')]);module['exports']=router; \ No newline at end of file +var _0x3bcc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','update','destroy'];(function(_0x150a39,_0x17ea5b){var _0x349f73=function(_0x8ac23a){while(--_0x8ac23a){_0x150a39['push'](_0x150a39['shift']());}};_0x349f73(++_0x17ea5b);}(_0x3bcc,0x9b));var _0xc3bc=function(_0x11c9b5,_0x589e4f){_0x11c9b5=_0x11c9b5-0x0;var _0x24d1f5=_0x3bcc[_0x11c9b5];return _0x24d1f5;};'use strict';var multer=require(_0xc3bc('0x0'));var util=require(_0xc3bc('0x1'));var path=require(_0xc3bc('0x2'));var timeout=require(_0xc3bc('0x3'));var express=require(_0xc3bc('0x4'));var router=express[_0xc3bc('0x5')]();var fs_extra=require(_0xc3bc('0x6'));var auth=require(_0xc3bc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc3bc('0x8'));var controller=require('./action.controller');router['put'](_0xc3bc('0x9'),auth[_0xc3bc('0xa')](),controller[_0xc3bc('0xb')]);router['delete'](_0xc3bc('0x9'),auth[_0xc3bc('0xa')](),controller[_0xc3bc('0xc')]);module[_0xc3bc('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 20f2ac2..f92605c 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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x33548b,_0x2887b2){var _0x1530ec=function(_0x2bcc62){while(--_0x2bcc62){_0x33548b['push'](_0x33548b['shift']());}};_0x1530ec(++_0x2887b2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x5fc3[_0x219d87];return _0x22823d;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x5075,0x73));var _0x5507=function(_0x2a608d,_0x298459){_0x2a608d=_0x2a608d-0x0;var _0x1bee3e=_0x5075[_0x2a608d];return _0x1bee3e;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c1fd5a7..9ca24e4 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 _0x9f9d=['UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','include','findAll','rows','catch','intersection','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','value','getFields','keyBy','select','function','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','cross_join','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','Limited\x20Query:','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','offset','limit','undefined','count','set','json','apply','save','update','then','CustomReports'];(function(_0x50659e,_0x33de0d){var _0x55bd68=function(_0x413701){while(--_0x413701){_0x50659e['push'](_0x50659e['shift']());}};_0x55bd68(++_0x33de0d);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0x9f9d[_0x19f670];return _0x3ffd49;};'use strict';var emlformat=require(_0xd9f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9f9('0x3'));var util=require(_0xd9f9('0x4'));var path=require(_0xd9f9('0x5'));var sox=require(_0xd9f9('0x6'));var csv=require(_0xd9f9('0x7'));var ejs=require(_0xd9f9('0x8'));var fs=require('fs');var fs_extra=require(_0xd9f9('0x9'));var _=require(_0xd9f9('0xa'));var squel=require(_0xd9f9('0xb'));var crypto=require(_0xd9f9('0xc'));var jsforce=require(_0xd9f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd9f9('0x7'));var querystring=require(_0xd9f9('0xe'));var Papa=require('papaparse');var Redis=require(_0xd9f9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9f9('0x10'));var hardwareService=require(_0xd9f9('0x11'));var logger=require(_0xd9f9('0x12'))(_0xd9f9('0x13'));var utils=require(_0xd9f9('0x14'));var config=require(_0xd9f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9f9('0x16'))['db'];var dbH=require(_0xd9f9('0x16'))[_0xd9f9('0x17')];function respondWithStatusCode(_0x1e6031,_0x542f12){_0x542f12=_0x542f12||0xcc;return function(_0x3bfebb){if(_0x3bfebb){return _0x1e6031['sendStatus'](_0x542f12);}return _0x1e6031[_0xd9f9('0x18')](_0x542f12)['end']();};}function respondWithResult(_0x41c423,_0x3e9191){_0x3e9191=_0x3e9191||0xc8;return function(_0x3bc627){if(_0x3bc627){return _0x41c423[_0xd9f9('0x18')](_0x3e9191)['json'](_0x3bc627);}};}function respondWithFilteredResult(_0x298e37,_0x2f066e){return function(_0x5168c9){if(_0x5168c9){var _0x19b738=typeof _0x2f066e[_0xd9f9('0x19')]==='undefined'&&typeof _0x2f066e[_0xd9f9('0x1a')]===_0xd9f9('0x1b');var _0x2b5257=_0x5168c9[_0xd9f9('0x1c')];var _0x13471f=_0x19b738?0x0:_0x2f066e[_0xd9f9('0x19')];var _0x3f0c43=_0x19b738?_0x5168c9['count']:_0x2f066e[_0xd9f9('0x19')]+_0x2f066e['limit'];var _0x1b3877;if(_0x3f0c43>=_0x2b5257){_0x3f0c43=_0x2b5257;_0x1b3877=0xc8;}else{_0x1b3877=0xce;}_0x298e37[_0xd9f9('0x18')](_0x1b3877);return _0x298e37[_0xd9f9('0x1d')]('Content-Range',_0x13471f+'-'+_0x3f0c43+'/'+_0x2b5257)[_0xd9f9('0x1e')](_0x5168c9);}return null;};}function patchUpdates(_0x1fa4fb){return function(_0x527dfa){try{jsonpatch[_0xd9f9('0x1f')](_0x527dfa,_0x1fa4fb,!![]);}catch(_0xf3c75b){return BPromise['reject'](_0xf3c75b);}return _0x527dfa[_0xd9f9('0x20')]();};}function saveUpdates(_0x26799c,_0x50efc1){return function(_0x1e554e){if(_0x1e554e){return _0x1e554e[_0xd9f9('0x21')](_0x26799c)['then'](function(_0x29cda8){return _0x29cda8;});}return null;};}function removeEntity(_0x5eb98b,_0x31dd51){return function(_0x49e10a){if(_0x49e10a){return _0x49e10a['destroy']()[_0xd9f9('0x22')](function(){var _0x6d4999=_0x49e10a['get']({'plain':!![]});var _0x144fb3=_0xd9f9('0x23');return db[_0xd9f9('0x24')][_0xd9f9('0x25')]({'where':{'type':_0x144fb3,'resourceId':_0x6d4999['id']}})[_0xd9f9('0x22')](function(){return _0x49e10a;});})[_0xd9f9('0x22')](function(){_0x5eb98b[_0xd9f9('0x18')](0xcc)[_0xd9f9('0x26')]();});}};}function handleEntityNotFound(_0x497631,_0x360a33){return function(_0x391d13){if(!_0x391d13){_0x497631[_0xd9f9('0x27')](0x194);}return _0x391d13;};}function handleError(_0x43b1ff,_0x5b7f0f){_0x5b7f0f=_0x5b7f0f||0x1f4;return function(_0x34e4b5){logger[_0xd9f9('0x28')](_0x34e4b5[_0xd9f9('0x29')]);if(_0x34e4b5[_0xd9f9('0x2a')]){delete _0x34e4b5[_0xd9f9('0x2a')];}_0x43b1ff[_0xd9f9('0x18')](_0x5b7f0f)[_0xd9f9('0x2b')](_0x34e4b5);};}exports['index']=function(_0x204c64,_0x21ccac){var _0x4e9aee={},_0x457c66={},_0x42ce37={'count':0x0,'rows':[]};var _0x436663=_[_0xd9f9('0x2c')](db[_0xd9f9('0x2d')][_0xd9f9('0x2e')],function(_0x2d96d5){return{'name':_0x2d96d5['fieldName'],'type':_0x2d96d5[_0xd9f9('0x2f')][_0xd9f9('0x30')]};});_0x457c66[_0xd9f9('0x31')]=_['map'](_0x436663,'name');_0x457c66[_0xd9f9('0x32')]=_[_0xd9f9('0x33')](_0x204c64[_0xd9f9('0x32')]);_0x457c66[_0xd9f9('0x34')]=_['intersection'](_0x457c66[_0xd9f9('0x31')],_0x457c66[_0xd9f9('0x32')]);_0x4e9aee[_0xd9f9('0x35')]=_['intersection'](_0x457c66[_0xd9f9('0x31')],qs['fields'](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x36')]));_0x4e9aee[_0xd9f9('0x35')]=_0x4e9aee[_0xd9f9('0x35')][_0xd9f9('0x37')]?_0x4e9aee['attributes']:_0x457c66['model'];if(!_0x204c64[_0xd9f9('0x32')]['hasOwnProperty'](_0xd9f9('0x38'))){_0x4e9aee[_0xd9f9('0x1a')]=qs['limit'](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x1a')]);_0x4e9aee[_0xd9f9('0x19')]=qs[_0xd9f9('0x19')](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x19')]);}_0x4e9aee[_0xd9f9('0x39')]=qs[_0xd9f9('0x3a')](_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x3a')]);_0x4e9aee['where']=qs[_0xd9f9('0x34')](_[_0xd9f9('0x3b')](_0x204c64[_0xd9f9('0x32')],_0x457c66[_0xd9f9('0x34')]),_0x436663);if(_0x204c64['query'][_0xd9f9('0x3c')]){_0x4e9aee[_0xd9f9('0x3d')]=_['merge'](_0x4e9aee[_0xd9f9('0x3d')],{'$or':_[_0xd9f9('0x2c')](_0x436663,function(_0x1abb2c){if(_0x1abb2c['type']!=='VIRTUAL'){var _0x1a2975={};_0x1a2975[_0x1abb2c[_0xd9f9('0x2a')]]={'$like':'%'+_0x204c64[_0xd9f9('0x32')][_0xd9f9('0x3c')]+'%'};return _0x1a2975;}})});}_0x4e9aee=_['merge']({},_0x4e9aee,_0x204c64['options']);var _0x25b797={'where':_0x4e9aee[_0xd9f9('0x3d')]};return db['AnalyticCustomReport'][_0xd9f9('0x1c')](_0x25b797)[_0xd9f9('0x22')](function(_0x19826d){_0x42ce37[_0xd9f9('0x1c')]=_0x19826d;if(_0x204c64[_0xd9f9('0x32')]['includeAll']){_0x4e9aee[_0xd9f9('0x3e')]=[{'all':!![]}];}return db[_0xd9f9('0x2d')][_0xd9f9('0x3f')](_0x4e9aee);})[_0xd9f9('0x22')](function(_0x1e4314){_0x42ce37[_0xd9f9('0x40')]=_0x1e4314;return _0x42ce37;})[_0xd9f9('0x22')](respondWithFilteredResult(_0x21ccac,_0x4e9aee))[_0xd9f9('0x41')](handleError(_0x21ccac,null));};exports['show']=function(_0x4d7ad9,_0x54ef38){var _0x1301ec={'raw':![],'where':{'id':_0x4d7ad9['params']['id']}},_0x463bc1={};_0x463bc1[_0xd9f9('0x31')]=_['keys'](db[_0xd9f9('0x2d')]['rawAttributes']);_0x463bc1['query']=_[_0xd9f9('0x33')](_0x4d7ad9[_0xd9f9('0x32')]);_0x463bc1['filters']=_[_0xd9f9('0x42')](_0x463bc1['model'],_0x463bc1['query']);_0x1301ec[_0xd9f9('0x35')]=_[_0xd9f9('0x42')](_0x463bc1[_0xd9f9('0x31')],qs[_0xd9f9('0x36')](_0x4d7ad9[_0xd9f9('0x32')][_0xd9f9('0x36')]));_0x1301ec[_0xd9f9('0x35')]=_0x1301ec[_0xd9f9('0x35')][_0xd9f9('0x37')]?_0x1301ec[_0xd9f9('0x35')]:_0x463bc1['model'];if(_0x4d7ad9[_0xd9f9('0x32')][_0xd9f9('0x43')]){_0x1301ec[_0xd9f9('0x3e')]=[{'all':!![]}];}_0x1301ec=_[_0xd9f9('0x44')]({},_0x1301ec,_0x4d7ad9[_0xd9f9('0x45')]);return db['AnalyticCustomReport']['find'](_0x1301ec)['then'](handleEntityNotFound(_0x54ef38,null))[_0xd9f9('0x22')](respondWithResult(_0x54ef38,null))[_0xd9f9('0x41')](handleError(_0x54ef38,null));};exports[_0xd9f9('0x46')]=function(_0x57262c,_0x56cef4){return db[_0xd9f9('0x2d')][_0xd9f9('0x46')](_0x57262c[_0xd9f9('0x47')],{})[_0xd9f9('0x22')](function(_0x525a3d){var _0x320ee0=_0x57262c['user'][_0xd9f9('0x48')]({'plain':!![]});if(!_0x320ee0)throw new Error(_0xd9f9('0x49'));if(_0x320ee0['role']===_0xd9f9('0x4a')){var _0x490f10=_0x525a3d[_0xd9f9('0x48')]({'plain':!![]});var _0x1efd72=_0xd9f9('0x4b');return db[_0xd9f9('0x4c')][_0xd9f9('0x4d')]({'where':{'name':_0x1efd72,'userProfileId':_0x320ee0[_0xd9f9('0x4e')]},'raw':!![]})[_0xd9f9('0x22')](function(_0x26dc16){if(_0x26dc16&&_0x26dc16[_0xd9f9('0x4f')]===0x0){return db[_0xd9f9('0x24')][_0xd9f9('0x46')]({'name':_0x490f10['name'],'resourceId':_0x490f10['id'],'type':'CustomReports','sectionId':_0x26dc16['id']},{})[_0xd9f9('0x22')](function(){return _0x525a3d;});}else{return _0x525a3d;}})[_0xd9f9('0x41')](function(_0x467804){logger[_0xd9f9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x467804);throw _0x467804;});}return _0x525a3d;})['then'](respondWithResult(_0x56cef4,0xc9))[_0xd9f9('0x41')](handleError(_0x56cef4,null));};exports[_0xd9f9('0x21')]=function(_0x885132,_0x36e6a6){if(_0x885132['body']['id']){delete _0x885132['body']['id'];}return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')]({'where':{'id':_0x885132[_0xd9f9('0x50')]['id']}})[_0xd9f9('0x22')](handleEntityNotFound(_0x36e6a6,null))[_0xd9f9('0x22')](saveUpdates(_0x885132['body'],null))[_0xd9f9('0x22')](respondWithResult(_0x36e6a6,null))[_0xd9f9('0x41')](handleError(_0x36e6a6,null));};exports['destroy']=function(_0x18bba0,_0x68ec4){return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')]({'where':{'id':_0x18bba0[_0xd9f9('0x50')]['id']}})[_0xd9f9('0x22')](handleEntityNotFound(_0x68ec4,null))['then'](removeEntity(_0x68ec4,null))[_0xd9f9('0x41')](handleError(_0x68ec4,null));};exports[_0xd9f9('0x51')]=function(_0x367501,_0x329e03){var _0x3018bc=0xa;var _0x22ad0d=[_0xd9f9('0x52'),_0xd9f9('0x53'),_0xd9f9('0x54'),'cross_join'];var _0x2eacbe={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd9f9('0x57'),'MIN':_0xd9f9('0x58'),'AVG':_0xd9f9('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x309b3e={'SEC_TO_TIME':_0xd9f9('0x5c'),'DATE':_0xd9f9('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xd9f9('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x194f8e=function(_0x86b4db){return!_['includes']([_0xd9f9('0x5f'),_0xd9f9('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x86b4db);};var _0x479ad3=function(_0x2bfc9){if(!_0x2bfc9||!_0x2bfc9[_0xd9f9('0x61')][_0xd9f9('0x37')]){return'';}for(var _0x7acda0='(',_0x26639f=0x0;_0x26639f<_0x2bfc9['rules']['length'];_0x26639f+=0x1){_0x26639f>0x0&&(_0x7acda0+='\x20'+_0x2bfc9['operator']+'\x20');_0x7acda0+=_0x2bfc9['rules'][_0x26639f][_0xd9f9('0x62')]?_0x479ad3(_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x62')]):_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x63')]+'\x20'+_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x64')]+(_0x194f8e(_0x2bfc9[_0xd9f9('0x61')][_0x26639f][_0xd9f9('0x64')])?'\x20'+_0x2bfc9[_0xd9f9('0x61')][_0x26639f]['value']:'');}return _0x7acda0+')';};var _0x5d8eb2={'where':{'id':_0x367501[_0xd9f9('0x50')]['id']}},_0x23ea88,_0x56fab0,_0x1c4481,_0x5afd30,_0x27d21a;_0x5d8eb2=_[_0xd9f9('0x44')]({},_0x5d8eb2,_0x367501['options']);return db['AnalyticCustomReport'][_0xd9f9('0x4d')](_0x5d8eb2)[_0xd9f9('0x22')](function(_0x3b994b){if(_0x3b994b){_0x23ea88=_0x3b994b;return _0x3b994b['getFields']();}return null;})['then'](function(_0xf4c3cb){if(_0xf4c3cb){if(!_0xf4c3cb[_0xd9f9('0x37')]){throw new db[(_0xd9f9('0x65'))][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x56fab0=_0xf4c3cb;return db[_0xd9f9('0x68')][_0xd9f9('0x3f')]({'raw':!![]});}return null;})[_0xd9f9('0x22')](function(_0x49e131){if(_0x49e131){_0x1c4481=_['keyBy'](_0x49e131,'id');var _0x49f86e;var _0x56e93d=squel['select']();_0x56e93d[_0xd9f9('0x69')](_0x23ea88[_0xd9f9('0x6a')]);for(var _0x5c49e1=0x0;_0x5c49e1<_0x56fab0[_0xd9f9('0x37')];_0x5c49e1+=0x1){_0x49f86e=_0x56fab0[_0x5c49e1][_0xd9f9('0x6b')]?_0x1c4481[_0x56fab0[_0x5c49e1][_0xd9f9('0x6b')]][_0xd9f9('0x6c')]:_0x56fab0[_0x5c49e1][_0xd9f9('0x63')];_0x49f86e=_0x56fab0[_0x5c49e1]['function']?_[_0xd9f9('0x6d')](_0x2eacbe[_0x56fab0[_0x5c49e1]['function']],'%s',_0x49f86e):_0x49f86e;_0x49f86e=_0x56fab0[_0x5c49e1][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x309b3e[_0x56fab0[_0x5c49e1][_0xd9f9('0x6e')]],'%s',_0x49f86e):_0x49f86e;if(_0x56fab0[_0x5c49e1][_0xd9f9('0x6f')]){_0x56e93d[_0xd9f9('0x62')](_0x49f86e);}_0x56fab0[_0x5c49e1][_0xd9f9('0x70')]&&_0x56e93d[_0xd9f9('0x39')](_0x49f86e,_0x56fab0[_0x5c49e1][_0xd9f9('0x70')]===_0xd9f9('0x71')?![]:!![]);_0x56e93d[_0xd9f9('0x63')](_0x49f86e,_0x56fab0[_0x5c49e1][_0xd9f9('0x72')]||_0x49f86e);}if(_0x23ea88[_0xd9f9('0x73')]){_0x23ea88[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x23ea88[_0xd9f9('0x73')]);for(var _0x3fffc2=0x0;_0x3fffc2<_0x23ea88['joins']['length'];_0x3fffc2+=0x1){if(_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x22ad0d,_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x2f')])&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x76')]&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x77')]&&_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x78')]){_0x56e93d[_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x2f')]](_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x77')],null,util[_0xd9f9('0x6e')](_0xd9f9('0x79'),_0x23ea88[_0xd9f9('0x6a')],_0x23ea88['joins'][_0x3fffc2]['parentKey'],_0x23ea88['joins'][_0x3fffc2][_0xd9f9('0x77')],_0x23ea88[_0xd9f9('0x73')][_0x3fffc2][_0xd9f9('0x78')]));}}}if(_0x23ea88['conditions']){_0x23ea88['conditions']=JSON[_0xd9f9('0x74')](_0x23ea88[_0xd9f9('0x7a')]);_0x56e93d[_0xd9f9('0x3d')](_0x479ad3(_0x23ea88[_0xd9f9('0x7a')][_0xd9f9('0x62')]));}_0x27d21a=_0x56e93d[_0xd9f9('0x7b')]();_0x56e93d[_0xd9f9('0x1a')](_0x3018bc);_0x56e93d[_0xd9f9('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x56e93d[_0xd9f9('0x7c')]());return dbH[_0xd9f9('0x7d')][_0xd9f9('0x32')](_0x56e93d[_0xd9f9('0x7c')](),{'type':dbH['sequelize'][_0xd9f9('0x7e')][_0xd9f9('0x7f')]});}})['then'](respondWithResult(_0x329e03,null))[_0xd9f9('0x41')](handleError(_0x329e03,null));};function runReport(_0x1399cf,_0x52bc86,_0x10260f){var _0xe764df=_0x52bc86[_0xd9f9('0x2a')];var _0x539672=0xa;var _0x41bcdf=[_0xd9f9('0x52'),_0xd9f9('0x53'),_0xd9f9('0x54'),'cross_join'];var _0x57dc01={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':_0xd9f9('0x80'),'MAX':_0xd9f9('0x57'),'MIN':_0xd9f9('0x58'),'AVG':_0xd9f9('0x59'),'GROUP_CONCAT':_0xd9f9('0x81'),'GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x41990f={'SEC_TO_TIME':_0xd9f9('0x5c'),'DATE':'DATE(%s)','HOUR':_0xd9f9('0x82'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd9f9('0x83')};var _0xe78925=function(_0x4b679f){return!_['includes']([_0xd9f9('0x5f'),_0xd9f9('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4b679f);};var _0x347605=function(_0x309cb2){if(!_0x309cb2||!_0x309cb2[_0xd9f9('0x61')][_0xd9f9('0x37')]){return'';}for(var _0x251938='(',_0x753c69=0x0;_0x753c69<_0x309cb2[_0xd9f9('0x61')][_0xd9f9('0x37')];_0x753c69+=0x1){_0x753c69>0x0&&(_0x251938+='\x20'+_0x309cb2['operator']+'\x20');_0x251938+=_0x309cb2['rules'][_0x753c69][_0xd9f9('0x62')]?_0x347605(_0x309cb2[_0xd9f9('0x61')][_0x753c69][_0xd9f9('0x62')]):_0x309cb2[_0xd9f9('0x61')][_0x753c69]['field']+'\x20'+_0x309cb2[_0xd9f9('0x61')][_0x753c69][_0xd9f9('0x64')]+(_0xe78925(_0x309cb2['rules'][_0x753c69][_0xd9f9('0x64')])?'\x20'+_0x309cb2['rules'][_0x753c69][_0xd9f9('0x84')]:'');}return _0x251938+')';};var _0x4973a4={'where':{'id':_0x1399cf['id']}},_0x46d944,_0x388a8f,_0x128469,_0x49678c,_0x4bf675;_0x4973a4=_[_0xd9f9('0x44')]({},_0x4973a4,_0x10260f);return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')](_0x4973a4)[_0xd9f9('0x22')](function(_0x30dc06){if(_0x30dc06){_0x46d944=_0x30dc06;return _0x30dc06[_0xd9f9('0x85')]();}return null;})[_0xd9f9('0x22')](function(_0x35963f){if(_0x35963f){if(!_0x35963f[_0xd9f9('0x37')]){throw new db[(_0xd9f9('0x65'))][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x388a8f=_0x35963f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4d4229){if(_0x4d4229){_0x128469=_[_0xd9f9('0x86')](_0x4d4229,'id');var _0x5307a8;var _0x3d70bb=squel[_0xd9f9('0x87')]();_0x3d70bb[_0xd9f9('0x69')](_0x46d944[_0xd9f9('0x6a')]);for(var _0x22064b=0x0;_0x22064b<_0x388a8f[_0xd9f9('0x37')];_0x22064b+=0x1){_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x6b')]?_0x128469[_0x388a8f[_0x22064b][_0xd9f9('0x6b')]]['metric']:_0x388a8f[_0x22064b][_0xd9f9('0x63')];_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x88')]?_[_0xd9f9('0x6d')](_0x57dc01[_0x388a8f[_0x22064b]['function']],'%s',_0x5307a8):_0x5307a8;_0x5307a8=_0x388a8f[_0x22064b][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x41990f[_0x388a8f[_0x22064b][_0xd9f9('0x6e')]],'%s',_0x5307a8):_0x5307a8;if(_0x388a8f[_0x22064b]['groupBy']){_0x3d70bb[_0xd9f9('0x62')](_0x5307a8);}_0x388a8f[_0x22064b][_0xd9f9('0x70')]&&_0x3d70bb[_0xd9f9('0x39')](_0x5307a8,_0x388a8f[_0x22064b][_0xd9f9('0x70')]==='DESC'?![]:!![]);_0x3d70bb[_0xd9f9('0x63')](_0x5307a8,_0x388a8f[_0x22064b]['alias']||_0x5307a8);}if(_0x46d944[_0xd9f9('0x73')]){_0x46d944[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x46d944['joins']);for(var _0x354f2a=0x0;_0x354f2a<_0x46d944[_0xd9f9('0x73')]['length'];_0x354f2a+=0x1){if(_0x46d944['joins'][_0x354f2a][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x41bcdf,_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x2f')])&&_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x76')]&&_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x77')]&&_0x46d944[_0xd9f9('0x73')][_0x354f2a]['foreignKey']){_0x3d70bb[_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x2f')]](_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x77')],null,util[_0xd9f9('0x6e')](_0xd9f9('0x79'),_0x46d944[_0xd9f9('0x6a')],_0x46d944['joins'][_0x354f2a][_0xd9f9('0x76')],_0x46d944['joins'][_0x354f2a][_0xd9f9('0x77')],_0x46d944[_0xd9f9('0x73')][_0x354f2a][_0xd9f9('0x78')]));}}}if(_0x46d944[_0xd9f9('0x7a')]){_0x46d944[_0xd9f9('0x7a')]=JSON['parse'](_0x46d944[_0xd9f9('0x7a')]);_0x3d70bb[_0xd9f9('0x3d')](_0x347605(_0x46d944['conditions'][_0xd9f9('0x62')]));}_0x4bf675=_0x3d70bb[_0xd9f9('0x7b')]();_0x3d70bb[_0xd9f9('0x1a')](_0x539672);_0x3d70bb[_0xd9f9('0x19')](0x0);return;}})[_0xd9f9('0x22')](function(){if(_0x52bc86[_0xd9f9('0x89')]===_0xd9f9('0x8a')){return null;}var _0x7cbb1b=_[_0xd9f9('0x44')](_0x52bc86,{'name':_0x52bc86[_0xd9f9('0x8b')]||_0x52bc86[_0xd9f9('0x2a')]||_0x46d944[_0xd9f9('0x2a')],'basename':_0xe764df,'savename':util[_0xd9f9('0x6e')](_0xd9f9('0x8c'),_0x52bc86[_0xd9f9('0x2a')]||_0x46d944[_0xd9f9('0x2a')],require(_0xd9f9('0x8d'))[_0xd9f9('0x8e')](0x4),_0x52bc86[_0xd9f9('0x89')]||_0xd9f9('0x8f')),'reportId':_0x46d944['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xd9f9('0x46')](_0x7cbb1b,{'raw':!![]});})[_0xd9f9('0x22')](function(_0x2f08ef){if(_0x46d944[_0xd9f9('0x6a')]===_0xd9f9('0x90')){_0x4bf675[_0xd9f9('0x3d')](_0x46d944[_0xd9f9('0x6a')]+_0xd9f9('0x91'),_0x52bc86[_0xd9f9('0x92')],_0x52bc86[_0xd9f9('0x93')]);}else{_0x4bf675['where'](_0x46d944['table']+_0xd9f9('0x94'),_0x52bc86[_0xd9f9('0x92')],_0x52bc86['endDate']);}if(_0x2f08ef){logger[_0xd9f9('0x95')]('Run\x20Query:',_0x4bf675[_0xd9f9('0x7c')]());require(_0xd9f9('0x96'))['fork'](path[_0xd9f9('0x52')](__dirname,_0xd9f9('0x97'),_0x2f08ef[_0xd9f9('0x89')]),[_0x2f08ef['id'],_0x4bf675[_0xd9f9('0x7c')](),path[_0xd9f9('0x52')](__dirname,_0xd9f9('0x98'),_0x2f08ef[_0xd9f9('0x99')]),_0xe764df]);return _0x2f08ef;}else{var _0x4eace6=squel[_0xd9f9('0x87')]();_0x4eace6['from']('('+_0x4bf675[_0xd9f9('0x7c')]()+')',_0xd9f9('0x9a'));_0x4eace6[_0xd9f9('0x63')](_0xd9f9('0x9b'),_0xd9f9('0x1c'));_0x4bf675[_0xd9f9('0x1a')](_0x52bc86[_0xd9f9('0x1a')]||_0x539672);_0x4bf675[_0xd9f9('0x19')](_0x52bc86[_0xd9f9('0x19')]||0x0);return dbH['sequelize']['query'](_0x4eace6[_0xd9f9('0x7c')](),{'type':dbH[_0xd9f9('0x7d')]['QueryTypes']['SELECT']})[_0xd9f9('0x22')](function(_0x1b13ed){if(!_0x1b13ed[_0xd9f9('0x37')]){_0x49678c=0x0;}else{_0x49678c=_0x1b13ed[0x0][_0xd9f9('0x1c')]||0x0;}return dbH[_0xd9f9('0x7d')]['query'](_0x4bf675[_0xd9f9('0x7c')](),{'type':dbH[_0xd9f9('0x7d')][_0xd9f9('0x7e')]['SELECT']});})[_0xd9f9('0x22')](function(_0x144eca){return{'rows':_0x144eca||[],'count':_0x49678c};});}});}exports['run']=function(_0x369a,_0x306062){return runReport(_0x369a[_0xd9f9('0x50')],_0x369a['query'],_0x369a[_0xd9f9('0x45')])[_0xd9f9('0x22')](respondWithResult(_0x306062,null))[_0xd9f9('0x41')](handleError(_0x306062,null));};exports[_0xd9f9('0x9c')]=runReport;exports[_0xd9f9('0x32')]=function(_0x46df74,_0x4e73a3){var _0x2b5985=0xa;var _0x1df17e=['join',_0xd9f9('0x53'),_0xd9f9('0x54'),_0xd9f9('0x9d')];var _0x452aa2={'SUM':_0xd9f9('0x55'),'COUNT':_0xd9f9('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xd9f9('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd9f9('0x5a'),'GROUP_CONCAT DESC':_0xd9f9('0x5b')};var _0x525c40={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd9f9('0x82'),'ROUND':_0xd9f9('0x5e'),'UNIX_TIMESTAMP':_0xd9f9('0x83')};var _0x5f3c63=function(_0x34b547){return!_[_0xd9f9('0x75')](['IS\x20NULL',_0xd9f9('0x60'),_0xd9f9('0x9e'),_0xd9f9('0x9f')],_0x34b547);};var _0x60289a=function(_0x505e5e){if(!_0x505e5e||!_0x505e5e[_0xd9f9('0x61')]['length']){return'';}for(var _0x16a2d6='(',_0x129e19=0x0;_0x129e19<_0x505e5e['rules'][_0xd9f9('0x37')];_0x129e19+=0x1){_0x129e19>0x0&&(_0x16a2d6+='\x20'+_0x505e5e[_0xd9f9('0xa0')]+'\x20');_0x16a2d6+=_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x62')]?_0x60289a(_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x62')]):_0x505e5e['rules'][_0x129e19]['field']+'\x20'+_0x505e5e['rules'][_0x129e19][_0xd9f9('0x64')]+(_0x5f3c63(_0x505e5e[_0xd9f9('0x61')][_0x129e19][_0xd9f9('0x64')])?'\x20'+_0x505e5e['rules'][_0x129e19]['value']:'');}return _0x16a2d6+')';};var _0x1bd85c={'where':{'id':_0x46df74['params']['id']}},_0x1b2ce1,_0x42bb52,_0x538721,_0x3709be,_0x556a30;_0x1bd85c=_[_0xd9f9('0x44')]({},_0x1bd85c,_0x46df74['options']);return db[_0xd9f9('0x2d')][_0xd9f9('0x4d')](_0x1bd85c)[_0xd9f9('0x22')](function(_0x75860a){if(_0x75860a){_0x1b2ce1=_0x75860a;return _0x75860a[_0xd9f9('0x85')]();}return null;})['then'](function(_0x4f9d39){if(_0x4f9d39){if(!_0x4f9d39[_0xd9f9('0x37')]){throw new db['Sequelize'][(_0xd9f9('0x66'))](_0xd9f9('0x67'),0x193);}_0x42bb52=_0x4f9d39;return db['AnalyticMetric'][_0xd9f9('0x3f')]({'raw':!![]});}return null;})[_0xd9f9('0x22')](function(_0x442a2f){if(_0x442a2f){_0x538721=_[_0xd9f9('0x86')](_0x442a2f,'id');var _0x11dacb;var _0x2e546a=squel[_0xd9f9('0x87')]();_0x2e546a[_0xd9f9('0x69')](_0x1b2ce1[_0xd9f9('0x6a')]);for(var _0x266734=0x0;_0x266734<_0x42bb52[_0xd9f9('0x37')];_0x266734+=0x1){_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x6b')]?_0x538721[_0x42bb52[_0x266734][_0xd9f9('0x6b')]][_0xd9f9('0x6c')]:_0x42bb52[_0x266734][_0xd9f9('0x63')];_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x88')]?_[_0xd9f9('0x6d')](_0x452aa2[_0x42bb52[_0x266734][_0xd9f9('0x88')]],'%s',_0x11dacb):_0x11dacb;_0x11dacb=_0x42bb52[_0x266734][_0xd9f9('0x6e')]?_[_0xd9f9('0x6d')](_0x525c40[_0x42bb52[_0x266734][_0xd9f9('0x6e')]],'%s',_0x11dacb):_0x11dacb;if(_0x42bb52[_0x266734][_0xd9f9('0x6f')]){_0x2e546a['group'](_0x11dacb);}_0x42bb52[_0x266734]['orderBy']&&_0x2e546a[_0xd9f9('0x39')](_0x11dacb,_0x42bb52[_0x266734][_0xd9f9('0x70')]==='DESC'?![]:!![]);_0x2e546a[_0xd9f9('0x63')](_0x11dacb,_0x42bb52[_0x266734]['alias']||_0x11dacb);}if(_0x1b2ce1['joins']){_0x1b2ce1[_0xd9f9('0x73')]=JSON[_0xd9f9('0x74')](_0x1b2ce1[_0xd9f9('0x73')]);for(var _0x32ee52=0x0;_0x32ee52<_0x1b2ce1[_0xd9f9('0x73')][_0xd9f9('0x37')];_0x32ee52+=0x1){if(_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x2f')]&&_[_0xd9f9('0x75')](_0x1df17e,_0x1b2ce1['joins'][_0x32ee52][_0xd9f9('0x2f')])&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x76')]&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52]['foreignTable']&&_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x78')]){_0x2e546a[_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x2f')]](_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x77')],null,util['format'](_0xd9f9('0x79'),_0x1b2ce1['table'],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x76')],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x77')],_0x1b2ce1[_0xd9f9('0x73')][_0x32ee52][_0xd9f9('0x78')]));}}}if(_0x1b2ce1[_0xd9f9('0x7a')]){_0x1b2ce1[_0xd9f9('0x7a')]=JSON[_0xd9f9('0x74')](_0x1b2ce1['conditions']);_0x2e546a['where'](_0x60289a(_0x1b2ce1[_0xd9f9('0x7a')][_0xd9f9('0x62')]));}_0x556a30=_0x2e546a[_0xd9f9('0x7b')]();_0x2e546a[_0xd9f9('0x1a')](_0x2b5985);_0x2e546a[_0xd9f9('0x19')](0x0);logger['debug'](_0xd9f9('0xa1'),_0x2e546a[_0xd9f9('0x7c')]());return dbH[_0xd9f9('0x7d')][_0xd9f9('0x32')](_0x2e546a['toString'](),{'type':dbH[_0xd9f9('0x7d')][_0xd9f9('0x7e')]['SELECT']});}})['then'](function(){return{'sql':_0x556a30[_0xd9f9('0x7c')]()};})[_0xd9f9('0x22')](respondWithResult(_0x4e73a3,null))['catch'](handleError(_0x4e73a3,null));}; \ No newline at end of file +var _0x6a4b=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','CustomReports','UserProfileResource','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','findAll','keyBy','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','cross_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','from','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x1f37d5,_0x102bb8){var _0x3bbd99=function(_0x194067){while(--_0x194067){_0x1f37d5['push'](_0x1f37d5['shift']());}};_0x3bbd99(++_0x102bb8);}(_0x6a4b,0x9b));var _0xb6a4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6a4b[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6a4('0x1'));var rp=require(_0xb6a4('0x2'));var moment=require(_0xb6a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb6a4('0x4'));var util=require(_0xb6a4('0x5'));var path=require(_0xb6a4('0x6'));var sox=require('sox');var csv=require(_0xb6a4('0x7'));var ejs=require(_0xb6a4('0x8'));var fs=require('fs');var fs_extra=require(_0xb6a4('0x9'));var _=require(_0xb6a4('0xa'));var squel=require(_0xb6a4('0xb'));var crypto=require(_0xb6a4('0xc'));var jsforce=require(_0xb6a4('0xd'));var deskjs=require(_0xb6a4('0xe'));var toCsv=require(_0xb6a4('0x7'));var querystring=require(_0xb6a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb6a4('0x10'));var qs=require(_0xb6a4('0x11'));var as=require(_0xb6a4('0x12'));var hardwareService=require(_0xb6a4('0x13'));var logger=require('../../config/logger')(_0xb6a4('0x14'));var utils=require(_0xb6a4('0x15'));var config=require(_0xb6a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xb6a4('0x17'))[_0xb6a4('0x18')];function respondWithStatusCode(_0x349e78,_0x4350bd){_0x4350bd=_0x4350bd||0xcc;return function(_0x2fdcce){if(_0x2fdcce){return _0x349e78[_0xb6a4('0x19')](_0x4350bd);}return _0x349e78[_0xb6a4('0x1a')](_0x4350bd)['end']();};}function respondWithResult(_0x14f298,_0xfa3375){_0xfa3375=_0xfa3375||0xc8;return function(_0x8e1b98){if(_0x8e1b98){return _0x14f298[_0xb6a4('0x1a')](_0xfa3375)[_0xb6a4('0x1b')](_0x8e1b98);}};}function respondWithFilteredResult(_0xa3cbd7,_0x497eaf){return function(_0x39dd62){if(_0x39dd62){var _0x4794ef=typeof _0x497eaf[_0xb6a4('0x1c')]===_0xb6a4('0x1d')&&typeof _0x497eaf[_0xb6a4('0x1e')]===_0xb6a4('0x1d');var _0x37fda0=_0x39dd62['count'];var _0x545812=_0x4794ef?0x0:_0x497eaf['offset'];var _0x55e01e=_0x4794ef?_0x39dd62['count']:_0x497eaf[_0xb6a4('0x1c')]+_0x497eaf[_0xb6a4('0x1e')];var _0x6307ea;if(_0x55e01e>=_0x37fda0){_0x55e01e=_0x37fda0;_0x6307ea=0xc8;}else{_0x6307ea=0xce;}_0xa3cbd7['status'](_0x6307ea);return _0xa3cbd7[_0xb6a4('0x1f')](_0xb6a4('0x20'),_0x545812+'-'+_0x55e01e+'/'+_0x37fda0)['json'](_0x39dd62);}return null;};}function patchUpdates(_0x294d32){return function(_0x997c4c){try{jsonpatch['apply'](_0x997c4c,_0x294d32,!![]);}catch(_0xb30014){return BPromise['reject'](_0xb30014);}return _0x997c4c['save']();};}function saveUpdates(_0x2acd60,_0x351c8c){return function(_0x65dcbf){if(_0x65dcbf){return _0x65dcbf[_0xb6a4('0x21')](_0x2acd60)[_0xb6a4('0x22')](function(_0x3d8eb8){return _0x3d8eb8;});}return null;};}function removeEntity(_0x342817,_0xfd60c){return function(_0x381d74){if(_0x381d74){return _0x381d74[_0xb6a4('0x23')]()[_0xb6a4('0x22')](function(){var _0x1396f3=_0x381d74['get']({'plain':!![]});var _0x5870ee=_0xb6a4('0x24');return db[_0xb6a4('0x25')][_0xb6a4('0x23')]({'where':{'type':_0x5870ee,'resourceId':_0x1396f3['id']}})[_0xb6a4('0x22')](function(){return _0x381d74;});})['then'](function(){_0x342817['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfbedf3,_0xdbcbd5){return function(_0x216877){if(!_0x216877){_0xfbedf3['sendStatus'](0x194);}return _0x216877;};}function handleError(_0x8b0c95,_0x5836d6){_0x5836d6=_0x5836d6||0x1f4;return function(_0x5cda10){logger['error'](_0x5cda10['stack']);if(_0x5cda10[_0xb6a4('0x26')]){delete _0x5cda10[_0xb6a4('0x26')];}_0x8b0c95['status'](_0x5836d6)['send'](_0x5cda10);};}exports[_0xb6a4('0x27')]=function(_0x268abe,_0x1c9b16){var _0x4d1a1f={},_0x4089ca={},_0x188d2f={'count':0x0,'rows':[]};var _0xa7b558=_[_0xb6a4('0x28')](db[_0xb6a4('0x29')][_0xb6a4('0x2a')],function(_0x3e4b7e){return{'name':_0x3e4b7e[_0xb6a4('0x2b')],'type':_0x3e4b7e[_0xb6a4('0x2c')][_0xb6a4('0x2d')]};});_0x4089ca['model']=_[_0xb6a4('0x28')](_0xa7b558,_0xb6a4('0x26'));_0x4089ca['query']=_[_0xb6a4('0x2e')](_0x268abe[_0xb6a4('0x2f')]);_0x4089ca['filters']=_['intersection'](_0x4089ca['model'],_0x4089ca[_0xb6a4('0x2f')]);_0x4d1a1f[_0xb6a4('0x30')]=_[_0xb6a4('0x31')](_0x4089ca[_0xb6a4('0x32')],qs[_0xb6a4('0x33')](_0x268abe['query']['fields']));_0x4d1a1f[_0xb6a4('0x30')]=_0x4d1a1f[_0xb6a4('0x30')][_0xb6a4('0x34')]?_0x4d1a1f['attributes']:_0x4089ca[_0xb6a4('0x32')];if(!_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x35')]('nolimit')){_0x4d1a1f[_0xb6a4('0x1e')]=qs['limit'](_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x1e')]);_0x4d1a1f[_0xb6a4('0x1c')]=qs['offset'](_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x1c')]);}_0x4d1a1f['order']=qs[_0xb6a4('0x36')](_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x36')]);_0x4d1a1f[_0xb6a4('0x37')]=qs[_0xb6a4('0x38')](_[_0xb6a4('0x39')](_0x268abe['query'],_0x4089ca[_0xb6a4('0x38')]),_0xa7b558);if(_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x3a')]){_0x4d1a1f[_0xb6a4('0x37')]=_[_0xb6a4('0x3b')](_0x4d1a1f[_0xb6a4('0x37')],{'$or':_[_0xb6a4('0x28')](_0xa7b558,function(_0x28189d){if(_0x28189d['type']!==_0xb6a4('0x3c')){var _0x1fba7d={};_0x1fba7d[_0x28189d[_0xb6a4('0x26')]]={'$like':'%'+_0x268abe['query'][_0xb6a4('0x3a')]+'%'};return _0x1fba7d;}})});}_0x4d1a1f=_['merge']({},_0x4d1a1f,_0x268abe['options']);var _0x7003b5={'where':_0x4d1a1f['where']};return db[_0xb6a4('0x29')][_0xb6a4('0x3d')](_0x7003b5)[_0xb6a4('0x22')](function(_0x2ccfb8){_0x188d2f[_0xb6a4('0x3d')]=_0x2ccfb8;if(_0x268abe[_0xb6a4('0x2f')][_0xb6a4('0x3e')]){_0x4d1a1f[_0xb6a4('0x3f')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x4d1a1f);})['then'](function(_0x137f9a){_0x188d2f[_0xb6a4('0x40')]=_0x137f9a;return _0x188d2f;})['then'](respondWithFilteredResult(_0x1c9b16,_0x4d1a1f))[_0xb6a4('0x41')](handleError(_0x1c9b16,null));};exports[_0xb6a4('0x42')]=function(_0x41b363,_0x4b9a3d){var _0x2486cc={'raw':![],'where':{'id':_0x41b363[_0xb6a4('0x43')]['id']}},_0x143986={};_0x143986[_0xb6a4('0x32')]=_['keys'](db['AnalyticCustomReport'][_0xb6a4('0x2a')]);_0x143986[_0xb6a4('0x2f')]=_[_0xb6a4('0x2e')](_0x41b363[_0xb6a4('0x2f')]);_0x143986[_0xb6a4('0x38')]=_[_0xb6a4('0x31')](_0x143986['model'],_0x143986[_0xb6a4('0x2f')]);_0x2486cc[_0xb6a4('0x30')]=_[_0xb6a4('0x31')](_0x143986['model'],qs[_0xb6a4('0x33')](_0x41b363['query'][_0xb6a4('0x33')]));_0x2486cc[_0xb6a4('0x30')]=_0x2486cc[_0xb6a4('0x30')]['length']?_0x2486cc['attributes']:_0x143986['model'];if(_0x41b363[_0xb6a4('0x2f')][_0xb6a4('0x3e')]){_0x2486cc['include']=[{'all':!![]}];}_0x2486cc=_[_0xb6a4('0x3b')]({},_0x2486cc,_0x41b363[_0xb6a4('0x44')]);return db[_0xb6a4('0x29')][_0xb6a4('0x45')](_0x2486cc)['then'](handleEntityNotFound(_0x4b9a3d,null))['then'](respondWithResult(_0x4b9a3d,null))[_0xb6a4('0x41')](handleError(_0x4b9a3d,null));};exports[_0xb6a4('0x46')]=function(_0x3e7557,_0x316de7){return db[_0xb6a4('0x29')][_0xb6a4('0x46')](_0x3e7557[_0xb6a4('0x47')],{})[_0xb6a4('0x22')](function(_0x2bfd4b){var _0x741a07=_0x3e7557[_0xb6a4('0x48')][_0xb6a4('0x49')]({'plain':!![]});if(!_0x741a07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x741a07[_0xb6a4('0x4a')]===_0xb6a4('0x48')){var _0x201539=_0x2bfd4b[_0xb6a4('0x49')]({'plain':!![]});var _0x32b2fa='Reports';return db['UserProfileSection'][_0xb6a4('0x45')]({'where':{'name':_0x32b2fa,'userProfileId':_0x741a07['userProfileId']},'raw':!![]})[_0xb6a4('0x22')](function(_0x5d6c43){if(_0x5d6c43&&_0x5d6c43[_0xb6a4('0x4b')]===0x0){return db[_0xb6a4('0x25')][_0xb6a4('0x46')]({'name':_0x201539[_0xb6a4('0x26')],'resourceId':_0x201539['id'],'type':_0xb6a4('0x24'),'sectionId':_0x5d6c43['id']},{})[_0xb6a4('0x22')](function(){return _0x2bfd4b;});}else{return _0x2bfd4b;}})[_0xb6a4('0x41')](function(_0x2ce0ea){logger[_0xb6a4('0x4c')](_0xb6a4('0x4d'),_0x2ce0ea);throw _0x2ce0ea;});}return _0x2bfd4b;})[_0xb6a4('0x22')](respondWithResult(_0x316de7,0xc9))[_0xb6a4('0x41')](handleError(_0x316de7,null));};exports[_0xb6a4('0x21')]=function(_0x579b40,_0x4ed525){if(_0x579b40[_0xb6a4('0x47')]['id']){delete _0x579b40[_0xb6a4('0x47')]['id'];}return db['AnalyticCustomReport'][_0xb6a4('0x45')]({'where':{'id':_0x579b40[_0xb6a4('0x43')]['id']}})[_0xb6a4('0x22')](handleEntityNotFound(_0x4ed525,null))[_0xb6a4('0x22')](saveUpdates(_0x579b40[_0xb6a4('0x47')],null))[_0xb6a4('0x22')](respondWithResult(_0x4ed525,null))['catch'](handleError(_0x4ed525,null));};exports[_0xb6a4('0x23')]=function(_0x35a483,_0xbc3405){return db['AnalyticCustomReport'][_0xb6a4('0x45')]({'where':{'id':_0x35a483['params']['id']}})[_0xb6a4('0x22')](handleEntityNotFound(_0xbc3405,null))[_0xb6a4('0x22')](removeEntity(_0xbc3405,null))['catch'](handleError(_0xbc3405,null));};exports['preview']=function(_0x39a4d2,_0x22fce8){var _0x3c695f=0xa;var _0x42c34e=[_0xb6a4('0x4e'),_0xb6a4('0x4f'),'right_join','cross_join'];var _0x364021={'SUM':'SUM(%s)','COUNT':_0xb6a4('0x50'),'COUNT DISTINCT':_0xb6a4('0x51'),'MAX':_0xb6a4('0x52'),'MIN':_0xb6a4('0x53'),'AVG':_0xb6a4('0x54'),'GROUP_CONCAT':_0xb6a4('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb6a4('0x56')};var _0x12f27d={'SEC_TO_TIME':_0xb6a4('0x57'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb6a4('0x58')};var _0x5757c6=function(_0x21f6b3){return!_['includes']([_0xb6a4('0x59'),'IS\x20NOT\x20NULL',_0xb6a4('0x5a'),_0xb6a4('0x5b')],_0x21f6b3);};var _0x14a8c2=function(_0x276f3c){if(!_0x276f3c||!_0x276f3c['rules'][_0xb6a4('0x34')]){return'';}for(var _0x1ca2a2='(',_0x4fec2f=0x0;_0x4fec2f<_0x276f3c[_0xb6a4('0x5c')][_0xb6a4('0x34')];_0x4fec2f+=0x1){_0x4fec2f>0x0&&(_0x1ca2a2+='\x20'+_0x276f3c[_0xb6a4('0x5d')]+'\x20');_0x1ca2a2+=_0x276f3c[_0xb6a4('0x5c')][_0x4fec2f][_0xb6a4('0x5e')]?_0x14a8c2(_0x276f3c['rules'][_0x4fec2f]['group']):_0x276f3c['rules'][_0x4fec2f][_0xb6a4('0x5f')]+'\x20'+_0x276f3c['rules'][_0x4fec2f][_0xb6a4('0x60')]+(_0x5757c6(_0x276f3c['rules'][_0x4fec2f][_0xb6a4('0x60')])?'\x20'+_0x276f3c[_0xb6a4('0x5c')][_0x4fec2f][_0xb6a4('0x61')]:'');}return _0x1ca2a2+')';};var _0x1b07ac={'where':{'id':_0x39a4d2['params']['id']}},_0x5707a6,_0x482ef3,_0x47f2f9,_0x4095d5,_0x1b78bf;_0x1b07ac=_[_0xb6a4('0x3b')]({},_0x1b07ac,_0x39a4d2[_0xb6a4('0x44')]);return db[_0xb6a4('0x29')][_0xb6a4('0x45')](_0x1b07ac)['then'](function(_0x35a305){if(_0x35a305){_0x5707a6=_0x35a305;return _0x35a305['getFields']();}return null;})[_0xb6a4('0x22')](function(_0x21219b){if(_0x21219b){if(!_0x21219b[_0xb6a4('0x34')]){throw new db['Sequelize'][(_0xb6a4('0x62'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x482ef3=_0x21219b;return db[_0xb6a4('0x63')][_0xb6a4('0x64')]({'raw':!![]});}return null;})['then'](function(_0x444c92){if(_0x444c92){_0x47f2f9=_[_0xb6a4('0x65')](_0x444c92,'id');var _0x4134ff;var _0x4e93bb=squel['select']();_0x4e93bb['from'](_0x5707a6['table']);for(var _0x203961=0x0;_0x203961<_0x482ef3['length'];_0x203961+=0x1){_0x4134ff=_0x482ef3[_0x203961][_0xb6a4('0x66')]?_0x47f2f9[_0x482ef3[_0x203961]['MetricId']][_0xb6a4('0x67')]:_0x482ef3[_0x203961][_0xb6a4('0x5f')];_0x4134ff=_0x482ef3[_0x203961][_0xb6a4('0x68')]?_[_0xb6a4('0x69')](_0x364021[_0x482ef3[_0x203961][_0xb6a4('0x68')]],'%s',_0x4134ff):_0x4134ff;_0x4134ff=_0x482ef3[_0x203961][_0xb6a4('0x6a')]?_['replace'](_0x12f27d[_0x482ef3[_0x203961]['format']],'%s',_0x4134ff):_0x4134ff;if(_0x482ef3[_0x203961]['groupBy']){_0x4e93bb[_0xb6a4('0x5e')](_0x4134ff);}_0x482ef3[_0x203961][_0xb6a4('0x6b')]&&_0x4e93bb[_0xb6a4('0x6c')](_0x4134ff,_0x482ef3[_0x203961][_0xb6a4('0x6b')]===_0xb6a4('0x6d')?![]:!![]);_0x4e93bb[_0xb6a4('0x5f')](_0x4134ff,_0x482ef3[_0x203961][_0xb6a4('0x6e')]||_0x4134ff);}if(_0x5707a6[_0xb6a4('0x6f')]){_0x5707a6['joins']=JSON[_0xb6a4('0x70')](_0x5707a6[_0xb6a4('0x6f')]);for(var _0x5e5992=0x0;_0x5e5992<_0x5707a6['joins']['length'];_0x5e5992+=0x1){if(_0x5707a6[_0xb6a4('0x6f')][_0x5e5992]['type']&&_[_0xb6a4('0x71')](_0x42c34e,_0x5707a6[_0xb6a4('0x6f')][_0x5e5992][_0xb6a4('0x2c')])&&_0x5707a6['joins'][_0x5e5992][_0xb6a4('0x72')]&&_0x5707a6['joins'][_0x5e5992][_0xb6a4('0x73')]&&_0x5707a6[_0xb6a4('0x6f')][_0x5e5992][_0xb6a4('0x74')]){_0x4e93bb[_0x5707a6[_0xb6a4('0x6f')][_0x5e5992][_0xb6a4('0x2c')]](_0x5707a6['joins'][_0x5e5992][_0xb6a4('0x73')],null,util[_0xb6a4('0x6a')](_0xb6a4('0x75'),_0x5707a6[_0xb6a4('0x76')],_0x5707a6[_0xb6a4('0x6f')][_0x5e5992][_0xb6a4('0x72')],_0x5707a6['joins'][_0x5e5992]['foreignTable'],_0x5707a6['joins'][_0x5e5992][_0xb6a4('0x74')]));}}}if(_0x5707a6[_0xb6a4('0x77')]){_0x5707a6[_0xb6a4('0x77')]=JSON['parse'](_0x5707a6['conditions']);_0x4e93bb['where'](_0x14a8c2(_0x5707a6[_0xb6a4('0x77')][_0xb6a4('0x5e')]));}_0x1b78bf=_0x4e93bb[_0xb6a4('0x78')]();_0x4e93bb[_0xb6a4('0x1e')](_0x3c695f);_0x4e93bb[_0xb6a4('0x1c')](0x0);logger[_0xb6a4('0x79')](_0xb6a4('0x7a'),_0x4e93bb[_0xb6a4('0x7b')]());return dbH['sequelize'][_0xb6a4('0x2f')](_0x4e93bb[_0xb6a4('0x7b')](),{'type':dbH[_0xb6a4('0x7c')]['QueryTypes'][_0xb6a4('0x7d')]});}})[_0xb6a4('0x22')](respondWithResult(_0x22fce8,null))['catch'](handleError(_0x22fce8,null));};function runReport(_0x176806,_0x55bded,_0x36df7e){var _0x7dbaad=_0x55bded[_0xb6a4('0x26')];var _0x2ebd7e=0xa;var _0x5df5b4=['join',_0xb6a4('0x4f'),_0xb6a4('0x7e'),_0xb6a4('0x7f')];var _0x5034b6={'SUM':_0xb6a4('0x80'),'COUNT':_0xb6a4('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb6a4('0x52'),'MIN':_0xb6a4('0x53'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb6a4('0x81'),'GROUP_CONCAT DESC':_0xb6a4('0x56')};var _0x25b441={'SEC_TO_TIME':_0xb6a4('0x57'),'DATE':_0xb6a4('0x82'),'HOUR':'HOUR(%s)','ROUND':_0xb6a4('0x83'),'UNIX_TIMESTAMP':_0xb6a4('0x58')};var _0x94fd26=function(_0x5d6494){return!_['includes']([_0xb6a4('0x59'),_0xb6a4('0x84'),_0xb6a4('0x5a'),_0xb6a4('0x5b')],_0x5d6494);};var _0x5046db=function(_0x43c1cc){if(!_0x43c1cc||!_0x43c1cc[_0xb6a4('0x5c')][_0xb6a4('0x34')]){return'';}for(var _0x5dc549='(',_0x8b55d8=0x0;_0x8b55d8<_0x43c1cc[_0xb6a4('0x5c')][_0xb6a4('0x34')];_0x8b55d8+=0x1){_0x8b55d8>0x0&&(_0x5dc549+='\x20'+_0x43c1cc[_0xb6a4('0x5d')]+'\x20');_0x5dc549+=_0x43c1cc[_0xb6a4('0x5c')][_0x8b55d8][_0xb6a4('0x5e')]?_0x5046db(_0x43c1cc[_0xb6a4('0x5c')][_0x8b55d8][_0xb6a4('0x5e')]):_0x43c1cc['rules'][_0x8b55d8]['field']+'\x20'+_0x43c1cc['rules'][_0x8b55d8][_0xb6a4('0x60')]+(_0x94fd26(_0x43c1cc['rules'][_0x8b55d8][_0xb6a4('0x60')])?'\x20'+_0x43c1cc['rules'][_0x8b55d8][_0xb6a4('0x61')]:'');}return _0x5dc549+')';};var _0x2ca4ac={'where':{'id':_0x176806['id']}},_0x2810cc,_0x3558ee,_0xf88ba,_0x569397,_0x12afc7;_0x2ca4ac=_[_0xb6a4('0x3b')]({},_0x2ca4ac,_0x36df7e);return db[_0xb6a4('0x29')]['find'](_0x2ca4ac)[_0xb6a4('0x22')](function(_0x4ff02c){if(_0x4ff02c){_0x2810cc=_0x4ff02c;return _0x4ff02c[_0xb6a4('0x85')]();}return null;})[_0xb6a4('0x22')](function(_0x5e06fc){if(_0x5e06fc){if(!_0x5e06fc[_0xb6a4('0x34')]){throw new db[(_0xb6a4('0x86'))][(_0xb6a4('0x62'))](_0xb6a4('0x87'),0x193);}_0x3558ee=_0x5e06fc;return db[_0xb6a4('0x63')][_0xb6a4('0x64')]({'raw':!![]});}return null;})[_0xb6a4('0x22')](function(_0x8c7a6){if(_0x8c7a6){_0xf88ba=_['keyBy'](_0x8c7a6,'id');var _0x39c054;var _0x41ef94=squel[_0xb6a4('0x88')]();_0x41ef94[_0xb6a4('0x89')](_0x2810cc['table']);for(var _0x128be2=0x0;_0x128be2<_0x3558ee['length'];_0x128be2+=0x1){_0x39c054=_0x3558ee[_0x128be2]['MetricId']?_0xf88ba[_0x3558ee[_0x128be2][_0xb6a4('0x66')]][_0xb6a4('0x67')]:_0x3558ee[_0x128be2][_0xb6a4('0x5f')];_0x39c054=_0x3558ee[_0x128be2][_0xb6a4('0x68')]?_[_0xb6a4('0x69')](_0x5034b6[_0x3558ee[_0x128be2][_0xb6a4('0x68')]],'%s',_0x39c054):_0x39c054;_0x39c054=_0x3558ee[_0x128be2][_0xb6a4('0x6a')]?_['replace'](_0x25b441[_0x3558ee[_0x128be2]['format']],'%s',_0x39c054):_0x39c054;if(_0x3558ee[_0x128be2]['groupBy']){_0x41ef94['group'](_0x39c054);}_0x3558ee[_0x128be2]['orderBy']&&_0x41ef94[_0xb6a4('0x6c')](_0x39c054,_0x3558ee[_0x128be2][_0xb6a4('0x6b')]===_0xb6a4('0x6d')?![]:!![]);_0x41ef94[_0xb6a4('0x5f')](_0x39c054,_0x3558ee[_0x128be2]['alias']||_0x39c054);}if(_0x2810cc[_0xb6a4('0x6f')]){_0x2810cc[_0xb6a4('0x6f')]=JSON[_0xb6a4('0x70')](_0x2810cc[_0xb6a4('0x6f')]);for(var _0x3481e9=0x0;_0x3481e9<_0x2810cc['joins'][_0xb6a4('0x34')];_0x3481e9+=0x1){if(_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x2c')]&&_[_0xb6a4('0x71')](_0x5df5b4,_0x2810cc['joins'][_0x3481e9][_0xb6a4('0x2c')])&&_0x2810cc[_0xb6a4('0x6f')][_0x3481e9]['parentKey']&&_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x73')]&&_0x2810cc[_0xb6a4('0x6f')][_0x3481e9]['foreignKey']){_0x41ef94[_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x2c')]](_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x73')],null,util[_0xb6a4('0x6a')](_0xb6a4('0x75'),_0x2810cc[_0xb6a4('0x76')],_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x72')],_0x2810cc[_0xb6a4('0x6f')][_0x3481e9][_0xb6a4('0x73')],_0x2810cc[_0xb6a4('0x6f')][_0x3481e9]['foreignKey']));}}}if(_0x2810cc[_0xb6a4('0x77')]){_0x2810cc[_0xb6a4('0x77')]=JSON[_0xb6a4('0x70')](_0x2810cc[_0xb6a4('0x77')]);_0x41ef94[_0xb6a4('0x37')](_0x5046db(_0x2810cc['conditions'][_0xb6a4('0x5e')]));}_0x12afc7=_0x41ef94[_0xb6a4('0x78')]();_0x41ef94[_0xb6a4('0x1e')](_0x2ebd7e);_0x41ef94[_0xb6a4('0x1c')](0x0);return;}})[_0xb6a4('0x22')](function(){if(_0x55bded[_0xb6a4('0x8a')]===_0xb6a4('0x8b')){return null;}var _0x583e26=_[_0xb6a4('0x3b')](_0x55bded,{'name':_0x55bded[_0xb6a4('0x8c')]||_0x55bded[_0xb6a4('0x26')]||_0x2810cc[_0xb6a4('0x26')],'basename':_0x7dbaad,'savename':util[_0xb6a4('0x6a')](_0xb6a4('0x8d'),_0x55bded[_0xb6a4('0x26')]||_0x2810cc['name'],require(_0xb6a4('0x8e'))[_0xb6a4('0x8f')](0x4),_0x55bded[_0xb6a4('0x8a')]||_0xb6a4('0x90')),'reportId':_0x2810cc['id'],'reportType':_0xb6a4('0x91')});return db[_0xb6a4('0x92')][_0xb6a4('0x46')](_0x583e26,{'raw':!![]});})['then'](function(_0x6fb011){if(_0x2810cc[_0xb6a4('0x76')]===_0xb6a4('0x93')){_0x12afc7[_0xb6a4('0x37')](_0x2810cc[_0xb6a4('0x76')]+_0xb6a4('0x94'),_0x55bded[_0xb6a4('0x95')],_0x55bded[_0xb6a4('0x96')]);}else{_0x12afc7[_0xb6a4('0x37')](_0x2810cc[_0xb6a4('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x55bded[_0xb6a4('0x95')],_0x55bded[_0xb6a4('0x96')]);}if(_0x6fb011){logger[_0xb6a4('0x97')]('Run\x20Query:',_0x12afc7['toString']());require(_0xb6a4('0x98'))[_0xb6a4('0x99')](path['join'](__dirname,_0xb6a4('0x9a'),_0x6fb011[_0xb6a4('0x8a')]),[_0x6fb011['id'],_0x12afc7['toString'](),path[_0xb6a4('0x4e')](__dirname,_0xb6a4('0x9b'),_0x6fb011[_0xb6a4('0x9c')]),_0x7dbaad]);return _0x6fb011;}else{var _0x466859=squel[_0xb6a4('0x88')]();_0x466859[_0xb6a4('0x89')]('('+_0x12afc7['toString']()+')',_0xb6a4('0x9d'));_0x466859[_0xb6a4('0x5f')](_0xb6a4('0x9e'),_0xb6a4('0x3d'));_0x12afc7[_0xb6a4('0x1e')](_0x55bded[_0xb6a4('0x1e')]||_0x2ebd7e);_0x12afc7[_0xb6a4('0x1c')](_0x55bded['offset']||0x0);return dbH['sequelize']['query'](_0x466859[_0xb6a4('0x7b')](),{'type':dbH[_0xb6a4('0x7c')][_0xb6a4('0x9f')][_0xb6a4('0x7d')]})[_0xb6a4('0x22')](function(_0x10dac9){if(!_0x10dac9['length']){_0x569397=0x0;}else{_0x569397=_0x10dac9[0x0][_0xb6a4('0x3d')]||0x0;}return dbH[_0xb6a4('0x7c')][_0xb6a4('0x2f')](_0x12afc7[_0xb6a4('0x7b')](),{'type':dbH[_0xb6a4('0x7c')]['QueryTypes'][_0xb6a4('0x7d')]});})[_0xb6a4('0x22')](function(_0x6b4e63){return{'rows':_0x6b4e63||[],'count':_0x569397};});}});}exports[_0xb6a4('0xa0')]=function(_0xd659c3,_0x50a194){return runReport(_0xd659c3[_0xb6a4('0x43')],_0xd659c3[_0xb6a4('0x2f')],_0xd659c3[_0xb6a4('0x44')])[_0xb6a4('0x22')](respondWithResult(_0x50a194,null))[_0xb6a4('0x41')](handleError(_0x50a194,null));};exports[_0xb6a4('0xa1')]=runReport;exports[_0xb6a4('0x2f')]=function(_0x30f2ba,_0x5a16aa){var _0x54ac15=0xa;var _0x146aca=[_0xb6a4('0x4e'),_0xb6a4('0x4f'),_0xb6a4('0x7e'),'cross_join'];var _0x5d7396={'SUM':_0xb6a4('0x80'),'COUNT':_0xb6a4('0x50'),'COUNT DISTINCT':_0xb6a4('0x51'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xb6a4('0x54'),'GROUP_CONCAT':_0xb6a4('0x55'),'GROUP_CONCAT ASC':_0xb6a4('0x81'),'GROUP_CONCAT DESC':_0xb6a4('0x56')};var _0x1f8615={'SEC_TO_TIME':_0xb6a4('0x57'),'DATE':_0xb6a4('0x82'),'HOUR':'HOUR(%s)','ROUND':_0xb6a4('0x83'),'UNIX_TIMESTAMP':_0xb6a4('0x58')};var _0x35b6e4=function(_0x1be94a){return!_[_0xb6a4('0x71')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb6a4('0x5a'),_0xb6a4('0x5b')],_0x1be94a);};var _0x33e5b7=function(_0x251cb3){if(!_0x251cb3||!_0x251cb3[_0xb6a4('0x5c')][_0xb6a4('0x34')]){return'';}for(var _0x51089b='(',_0x3d7e5b=0x0;_0x3d7e5b<_0x251cb3[_0xb6a4('0x5c')][_0xb6a4('0x34')];_0x3d7e5b+=0x1){_0x3d7e5b>0x0&&(_0x51089b+='\x20'+_0x251cb3[_0xb6a4('0x5d')]+'\x20');_0x51089b+=_0x251cb3[_0xb6a4('0x5c')][_0x3d7e5b]['group']?_0x33e5b7(_0x251cb3[_0xb6a4('0x5c')][_0x3d7e5b][_0xb6a4('0x5e')]):_0x251cb3[_0xb6a4('0x5c')][_0x3d7e5b][_0xb6a4('0x5f')]+'\x20'+_0x251cb3['rules'][_0x3d7e5b][_0xb6a4('0x60')]+(_0x35b6e4(_0x251cb3[_0xb6a4('0x5c')][_0x3d7e5b]['condition'])?'\x20'+_0x251cb3['rules'][_0x3d7e5b][_0xb6a4('0x61')]:'');}return _0x51089b+')';};var _0x38c8e4={'where':{'id':_0x30f2ba[_0xb6a4('0x43')]['id']}},_0x5db1e0,_0x5edf60,_0x3eaf8f,_0x187453,_0x73cca;_0x38c8e4=_[_0xb6a4('0x3b')]({},_0x38c8e4,_0x30f2ba[_0xb6a4('0x44')]);return db['AnalyticCustomReport'][_0xb6a4('0x45')](_0x38c8e4)[_0xb6a4('0x22')](function(_0x5d712e){if(_0x5d712e){_0x5db1e0=_0x5d712e;return _0x5d712e['getFields']();}return null;})[_0xb6a4('0x22')](function(_0x538c07){if(_0x538c07){if(!_0x538c07[_0xb6a4('0x34')]){throw new db[(_0xb6a4('0x86'))][(_0xb6a4('0x62'))](_0xb6a4('0x87'),0x193);}_0x5edf60=_0x538c07;return db[_0xb6a4('0x63')][_0xb6a4('0x64')]({'raw':!![]});}return null;})[_0xb6a4('0x22')](function(_0x493c0b){if(_0x493c0b){_0x3eaf8f=_[_0xb6a4('0x65')](_0x493c0b,'id');var _0x1453c1;var _0xb01795=squel['select']();_0xb01795[_0xb6a4('0x89')](_0x5db1e0[_0xb6a4('0x76')]);for(var _0x436e7b=0x0;_0x436e7b<_0x5edf60[_0xb6a4('0x34')];_0x436e7b+=0x1){_0x1453c1=_0x5edf60[_0x436e7b][_0xb6a4('0x66')]?_0x3eaf8f[_0x5edf60[_0x436e7b][_0xb6a4('0x66')]][_0xb6a4('0x67')]:_0x5edf60[_0x436e7b]['field'];_0x1453c1=_0x5edf60[_0x436e7b][_0xb6a4('0x68')]?_['replace'](_0x5d7396[_0x5edf60[_0x436e7b][_0xb6a4('0x68')]],'%s',_0x1453c1):_0x1453c1;_0x1453c1=_0x5edf60[_0x436e7b]['format']?_[_0xb6a4('0x69')](_0x1f8615[_0x5edf60[_0x436e7b][_0xb6a4('0x6a')]],'%s',_0x1453c1):_0x1453c1;if(_0x5edf60[_0x436e7b]['groupBy']){_0xb01795[_0xb6a4('0x5e')](_0x1453c1);}_0x5edf60[_0x436e7b][_0xb6a4('0x6b')]&&_0xb01795[_0xb6a4('0x6c')](_0x1453c1,_0x5edf60[_0x436e7b][_0xb6a4('0x6b')]==='DESC'?![]:!![]);_0xb01795['field'](_0x1453c1,_0x5edf60[_0x436e7b][_0xb6a4('0x6e')]||_0x1453c1);}if(_0x5db1e0[_0xb6a4('0x6f')]){_0x5db1e0[_0xb6a4('0x6f')]=JSON['parse'](_0x5db1e0[_0xb6a4('0x6f')]);for(var _0x38dc0d=0x0;_0x38dc0d<_0x5db1e0[_0xb6a4('0x6f')][_0xb6a4('0x34')];_0x38dc0d+=0x1){if(_0x5db1e0['joins'][_0x38dc0d][_0xb6a4('0x2c')]&&_[_0xb6a4('0x71')](_0x146aca,_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d]['type'])&&_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d]['parentKey']&&_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d]['foreignTable']&&_0x5db1e0['joins'][_0x38dc0d]['foreignKey']){_0xb01795[_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d][_0xb6a4('0x2c')]](_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d][_0xb6a4('0x73')],null,util[_0xb6a4('0x6a')]('%s.%s\x20=\x20%s.%s',_0x5db1e0[_0xb6a4('0x76')],_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d][_0xb6a4('0x72')],_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d][_0xb6a4('0x73')],_0x5db1e0[_0xb6a4('0x6f')][_0x38dc0d][_0xb6a4('0x74')]));}}}if(_0x5db1e0[_0xb6a4('0x77')]){_0x5db1e0[_0xb6a4('0x77')]=JSON['parse'](_0x5db1e0[_0xb6a4('0x77')]);_0xb01795[_0xb6a4('0x37')](_0x33e5b7(_0x5db1e0[_0xb6a4('0x77')][_0xb6a4('0x5e')]));}_0x73cca=_0xb01795[_0xb6a4('0x78')]();_0xb01795[_0xb6a4('0x1e')](_0x54ac15);_0xb01795['offset'](0x0);logger['debug']('Limited\x20Query:',_0xb01795['toString']());return dbH[_0xb6a4('0x7c')][_0xb6a4('0x2f')](_0xb01795[_0xb6a4('0x7b')](),{'type':dbH['sequelize'][_0xb6a4('0x9f')][_0xb6a4('0x7d')]});}})[_0xb6a4('0x22')](function(){return{'sql':_0x73cca[_0xb6a4('0x7b')]()};})[_0xb6a4('0x22')](respondWithResult(_0x5a16aa,null))[_0xb6a4('0x41')](handleError(_0x5a16aa,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 52d3271..11ffc28 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 _0x4222=['bluebird','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment'];(function(_0x272f3c,_0x29817c){var _0x472053=function(_0xf7fbe9){while(--_0xf7fbe9){_0x272f3c['push'](_0x272f3c['shift']());}};_0x472053(++_0x29817c);}(_0x4222,0xd9));var _0x2422=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4222[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x2422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2422('0x1'));var moment=require(_0x2422('0x2'));var BPromise=require(_0x2422('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2422('0x4'));var rimraf=require(_0x2422('0x5'));var config=require('../../config/environment');var attributes=require(_0x2422('0x6'));module[_0x2422('0x7')]=function(_0x2a014c,_0x199a5d){return _0x2a014c[_0x2422('0x8')](_0x2422('0x9'),attributes,{'tableName':_0x2422('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc2b=['AnalyticCustomReport','analytics_custom_reports','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x185e2b,_0x569afd){var _0x1ec9fc=function(_0x182be1){while(--_0x182be1){_0x185e2b['push'](_0x185e2b['shift']());}};_0x1ec9fc(++_0x569afd);}(_0xcc2b,0x16d));var _0xbcc2=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xcc2b[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbcc2('0x0'))('api');var moment=require(_0xbcc2('0x1'));var BPromise=require(_0xbcc2('0x2'));var rp=require(_0xbcc2('0x3'));var fs=require('fs');var path=require(_0xbcc2('0x4'));var rimraf=require(_0xbcc2('0x5'));var config=require(_0xbcc2('0x6'));var attributes=require(_0xbcc2('0x7'));module[_0xbcc2('0x8')]=function(_0x448f74,_0x4d4ee9){return _0x448f74['define'](_0xbcc2('0x9'),attributes,{'tableName':_0xbcc2('0xa'),'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 1174544..1815567 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 _0xf955=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xf955,0x106));var _0x5f95=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf955[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x5f95('0x0'));var util=require('util');var moment=require(_0x5f95('0x1'));var BPromise=require(_0x5f95('0x2'));var rs=require(_0x5f95('0x3'));var fs=require('fs');var Redis=require(_0x5f95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f95('0x5'));var logger=require(_0x5f95('0x6'))(_0x5f95('0x7'));var config=require(_0x5f95('0x8'));var jayson=require(_0x5f95('0x9'));var client=jayson[_0x5f95('0xa')][_0x5f95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1980c0,_0x6c66b7,_0x15d043){return new BPromise(function(_0x463981,_0x2ae040){return client[_0x5f95('0xc')](_0x1980c0,_0x15d043)['then'](function(_0x37755d){logger[_0x5f95('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6c66b7,_0x5f95('0xe'));logger[_0x5f95('0xf')](_0x5f95('0x10'),_0x6c66b7,'request\x20sent',JSON['stringify'](_0x37755d));if(_0x37755d[_0x5f95('0x11')]){if(_0x37755d[_0x5f95('0x11')][_0x5f95('0x12')]===0x1f4){logger[_0x5f95('0x11')](_0x5f95('0x13'),_0x6c66b7,_0x37755d['error']['message']);return _0x2ae040(_0x37755d['error'][_0x5f95('0x14')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x6c66b7,_0x37755d[_0x5f95('0x11')][_0x5f95('0x14')]);return _0x463981(_0x37755d[_0x5f95('0x11')][_0x5f95('0x14')]);}else{logger[_0x5f95('0xd')](_0x5f95('0x13'),_0x6c66b7,'request\x20sent');_0x463981(_0x37755d[_0x5f95('0x15')]['message']);}})['catch'](function(_0x4255d7){logger[_0x5f95('0x11')](_0x5f95('0x13'),_0x6c66b7,_0x4255d7);_0x2ae040(_0x4255d7);});});} \ No newline at end of file +var _0x1969=['info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x5b48d5,_0x140014){var _0x485ff1=function(_0x5c641b){while(--_0x5c641b){_0x5b48d5['push'](_0x5b48d5['shift']());}};_0x485ff1(++_0x140014);}(_0x1969,0xb5));var _0x9196=function(_0x465d94,_0x404ea6){_0x465d94=_0x465d94-0x0;var _0x4e20c0=_0x1969[_0x465d94];return _0x4e20c0;};'use strict';var _=require(_0x9196('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9196('0x1'));var rs=require(_0x9196('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9196('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9196('0x4'));var config=require(_0x9196('0x5'));var jayson=require(_0x9196('0x6'));var client=jayson['client'][_0x9196('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3604ca,_0x4c2f5c,_0x5860d9){return new BPromise(function(_0x29baa8,_0x210522){return client['request'](_0x3604ca,_0x5860d9)[_0x9196('0x8')](function(_0x4813e8){logger[_0x9196('0x9')](_0x9196('0xa'),_0x4c2f5c,'request\x20sent');logger[_0x9196('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4c2f5c,_0x9196('0xc'),JSON[_0x9196('0xd')](_0x4813e8));if(_0x4813e8[_0x9196('0xe')]){if(_0x4813e8[_0x9196('0xe')][_0x9196('0xf')]===0x1f4){logger[_0x9196('0xe')](_0x9196('0xa'),_0x4c2f5c,_0x4813e8[_0x9196('0xe')][_0x9196('0x10')]);return _0x210522(_0x4813e8[_0x9196('0xe')]['message']);}logger['error'](_0x9196('0xa'),_0x4c2f5c,_0x4813e8[_0x9196('0xe')][_0x9196('0x10')]);return _0x29baa8(_0x4813e8['error']['message']);}else{logger[_0x9196('0x9')](_0x9196('0xa'),_0x4c2f5c,'request\x20sent');_0x29baa8(_0x4813e8[_0x9196('0x11')]['message']);}})[_0x9196('0x12')](function(_0x16f539){logger[_0x9196('0xe')](_0x9196('0xa'),_0x4c2f5c,_0x16f539);_0x210522(_0x16f539);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a36a570..e12cd21 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 _0x3b01=['preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview'];(function(_0x4e2148,_0x382a2c){var _0x323345=function(_0x426339){while(--_0x426339){_0x4e2148['push'](_0x4e2148['shift']());}};_0x323345(++_0x382a2c);}(_0x3b01,0x8e));var _0x13b0=function(_0x51a5fc,_0x4a1f5a){_0x51a5fc=_0x51a5fc-0x0;var _0x1afbfd=_0x3b01[_0x51a5fc];return _0x1afbfd;};'use strict';var multer=require('multer');var util=require(_0x13b0('0x0'));var path=require(_0x13b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x13b0('0x2'));var router=express[_0x13b0('0x3')]();var fs_extra=require(_0x13b0('0x4'));var auth=require(_0x13b0('0x5'));var interaction=require(_0x13b0('0x6'));var config=require('../../config/environment');var controller=require(_0x13b0('0x7'));router[_0x13b0('0x8')]('/',auth['isAuthenticated'](),controller[_0x13b0('0x9')]);router[_0x13b0('0x8')](_0x13b0('0xa'),auth[_0x13b0('0xb')](),controller[_0x13b0('0xc')]);router[_0x13b0('0x8')](_0x13b0('0xd'),auth[_0x13b0('0xb')](),controller[_0x13b0('0xe')]);router[_0x13b0('0x8')](_0x13b0('0xf'),auth[_0x13b0('0xb')](),controller[_0x13b0('0x10')]);router[_0x13b0('0x8')](_0x13b0('0x11'),auth['isAuthenticated'](),controller[_0x13b0('0x12')]);router[_0x13b0('0x13')]('/',auth[_0x13b0('0xb')](),controller[_0x13b0('0x14')]);router[_0x13b0('0x15')](_0x13b0('0xa'),auth[_0x13b0('0xb')](),controller[_0x13b0('0x16')]);router[_0x13b0('0x17')](_0x13b0('0xa'),auth['isAuthenticated'](),controller[_0x13b0('0x18')]);module[_0x13b0('0x19')]=router; \ No newline at end of file +var _0xc110=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0xc110,0x138));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c11('0x0'));var util=require(_0x0c11('0x1'));var path=require(_0x0c11('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c11('0x3'));var router=express['Router']();var fs_extra=require(_0x0c11('0x4'));var auth=require(_0x0c11('0x5'));var interaction=require(_0x0c11('0x6'));var config=require(_0x0c11('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x0c11('0x8')]('/',auth[_0x0c11('0x9')](),controller[_0x0c11('0xa')]);router[_0x0c11('0x8')](_0x0c11('0xb'),auth[_0x0c11('0x9')](),controller[_0x0c11('0xc')]);router['get'](_0x0c11('0xd'),auth[_0x0c11('0x9')](),controller[_0x0c11('0xe')]);router[_0x0c11('0x8')](_0x0c11('0xf'),auth[_0x0c11('0x9')](),controller[_0x0c11('0x10')]);router[_0x0c11('0x8')](_0x0c11('0x11'),auth['isAuthenticated'](),controller[_0x0c11('0x12')]);router[_0x0c11('0x13')]('/',auth[_0x0c11('0x9')](),controller['create']);router[_0x0c11('0x14')](_0x0c11('0xb'),auth[_0x0c11('0x9')](),controller['update']);router[_0x0c11('0x15')](_0x0c11('0xb'),auth['isAuthenticated'](),controller[_0x0c11('0x16')]);module[_0x0c11('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 22c3c04..f702197 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 _0x7fbe=['STRING','TEXT'];(function(_0x4589fd,_0x4c6f26){var _0x44084b=function(_0x1eeabd){while(--_0x1eeabd){_0x4589fd['push'](_0x4589fd['shift']());}};_0x44084b(++_0x4c6f26);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x52bbc9,_0xb342e0){_0x52bbc9=_0x52bbc9-0x0;var _0x5909d0=_0x7fbe[_0x52bbc9];return _0x5909d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x56cfa2,_0x4d9800){var _0x302037=function(_0x56a1ed){while(--_0x56a1ed){_0x56cfa2['push'](_0x56cfa2['shift']());}};_0x302037(++_0x4d9800);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4ea664,_0x23e3cc){_0x4ea664=_0x4ea664-0x0;var _0x4e5f37=_0xd8fb[_0x4ea664];return _0x4e5f37;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 370e13e..0131c21 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 _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x10d4ad,_0x53993e){_0x10d4ad=_0x10d4ad-0x0;var _0x5dfa22=_0xdbf5[_0x10d4ad];return _0x5dfa22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x1c6b61,_0x5d0fe0){var _0xb6c7e2=function(_0xda019f){while(--_0xda019f){_0x1c6b61['push'](_0x1c6b61['shift']());}};_0xb6c7e2(++_0x5d0fe0);}(_0x7a54,0x106));var _0x47a5=function(_0x31464b,_0x1ac4dd){_0x31464b=_0x31464b-0x0;var _0x91a0f9=_0x7a54[_0x31464b];return _0x91a0f9;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ef4d693..60d422f 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 _0xb243=['../../config/logger','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util'];(function(_0x201304,_0x13e171){var _0x2396d1=function(_0x28f3a5){while(--_0x28f3a5){_0x201304['push'](_0x201304['shift']());}};_0x2396d1(++_0x13e171);}(_0xb243,0x8a));var _0x3b24=function(_0x5bf6c0,_0x5704d7){_0x5bf6c0=_0x5bf6c0-0x0;var _0x112107=_0xb243[_0x5bf6c0];return _0x112107;};'use strict';var _=require(_0x3b24('0x0'));var util=require(_0x3b24('0x1'));var logger=require(_0x3b24('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3b24('0x3'));var rp=require(_0x3b24('0x4'));var fs=require('fs');var path=require(_0x3b24('0x5'));var rimraf=require('rimraf');var config=require(_0x3b24('0x6'));var attributes=require(_0x3b24('0x7'));module[_0x3b24('0x8')]=function(_0x4d3ed0,_0x5ecffe){return _0x4d3ed0['define']('AnalyticDefaultReport',attributes,{'tableName':_0x3b24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e78=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3a3005,_0x2c4d53){var _0x8dc531=function(_0x3dd274){while(--_0x3dd274){_0x3a3005['push'](_0x3a3005['shift']());}};_0x8dc531(++_0x2c4d53);}(_0x4e78,0x1cd));var _0x84e7=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x4e78[_0xe2c95e];return _0x42ce6f;};'use strict';var _=require(_0x84e7('0x0'));var util=require(_0x84e7('0x1'));var logger=require(_0x84e7('0x2'))(_0x84e7('0x3'));var moment=require(_0x84e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x84e7('0x5'));var fs=require('fs');var path=require(_0x84e7('0x6'));var rimraf=require('rimraf');var config=require(_0x84e7('0x7'));var attributes=require(_0x84e7('0x8'));module['exports']=function(_0x487c5a,_0x393f50){return _0x487c5a[_0x84e7('0x9')](_0x84e7('0xa'),attributes,{'tableName':_0x84e7('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 6e4c860..074c0d7 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 _0xb87d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3284b8,_0x7058d7){var _0x3221de=function(_0x8e9bd9){while(--_0x8e9bd9){_0x3284b8['push'](_0x3284b8['shift']());}};_0x3221de(++_0x7058d7);}(_0xb87d,0x198));var _0xdb87=function(_0x2cb1d3,_0x4c2e55){_0x2cb1d3=_0x2cb1d3-0x0;var _0x223a9d=_0xb87d[_0x2cb1d3];return _0x223a9d;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require(_0xdb87('0x2'));var BPromise=require(_0xdb87('0x3'));var rs=require(_0xdb87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb87('0x5'))['db'];var utils=require(_0xdb87('0x6'));var logger=require('../../config/logger')(_0xdb87('0x7'));var config=require(_0xdb87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb87('0x9')][_0xdb87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7f5469,_0x300790,_0x3c2d23){return new BPromise(function(_0x1e81a3,_0x1214e2){return client[_0xdb87('0xb')](_0x7f5469,_0x3c2d23)[_0xdb87('0xc')](function(_0x19a1ee){logger[_0xdb87('0xd')](_0xdb87('0xe'),_0x300790,_0xdb87('0xf'));logger[_0xdb87('0x10')](_0xdb87('0x11'),_0x300790,_0xdb87('0xf'),JSON[_0xdb87('0x12')](_0x19a1ee));if(_0x19a1ee['error']){if(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x14')]===0x1f4){logger[_0xdb87('0x13')](_0xdb87('0xe'),_0x300790,_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);return _0x1214e2(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);}logger['error'](_0xdb87('0xe'),_0x300790,_0x19a1ee['error'][_0xdb87('0x15')]);return _0x1e81a3(_0x19a1ee[_0xdb87('0x13')][_0xdb87('0x15')]);}else{logger[_0xdb87('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x300790,'request\x20sent');_0x1e81a3(_0x19a1ee[_0xdb87('0x16')][_0xdb87('0x15')]);}})[_0xdb87('0x17')](function(_0x1be16c){logger[_0xdb87('0x13')](_0xdb87('0xe'),_0x300790,_0x1be16c);_0x1214e2(_0x1be16c);});});} \ No newline at end of file +var _0x4925=['message','AnalyticDefaultReport,\x20%s,\x20%s','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1db72a,_0x22f6bc){var _0x1c7ee7=function(_0x1b4fe8){while(--_0x1b4fe8){_0x1db72a['push'](_0x1db72a['shift']());}};_0x1c7ee7(++_0x22f6bc);}(_0x4925,0xf4));var _0x5492=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x4925[_0x72a33d];return _0x2621d5;};'use strict';var _=require('lodash');var util=require(_0x5492('0x0'));var moment=require(_0x5492('0x1'));var BPromise=require(_0x5492('0x2'));var rs=require(_0x5492('0x3'));var fs=require('fs');var Redis=require(_0x5492('0x4'));var db=require(_0x5492('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5492('0x6'))('rpc');var config=require(_0x5492('0x7'));var jayson=require(_0x5492('0x8'));var client=jayson[_0x5492('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e04c7,_0x5e48f5,_0x77409c){return new BPromise(function(_0xf830d6,_0x3bae30){return client['request'](_0x2e04c7,_0x77409c)[_0x5492('0xa')](function(_0x1b6ff6){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e48f5,_0x5492('0xb'));logger[_0x5492('0xc')](_0x5492('0xd'),_0x5e48f5,'request\x20sent',JSON[_0x5492('0xe')](_0x1b6ff6));if(_0x1b6ff6[_0x5492('0xf')]){if(_0x1b6ff6[_0x5492('0xf')]['code']===0x1f4){logger[_0x5492('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e48f5,_0x1b6ff6[_0x5492('0xf')][_0x5492('0x10')]);return _0x3bae30(_0x1b6ff6[_0x5492('0xf')][_0x5492('0x10')]);}logger[_0x5492('0xf')](_0x5492('0x11'),_0x5e48f5,_0x1b6ff6[_0x5492('0xf')][_0x5492('0x10')]);return _0xf830d6(_0x1b6ff6[_0x5492('0xf')][_0x5492('0x10')]);}else{logger[_0x5492('0x12')](_0x5492('0x11'),_0x5e48f5,_0x5492('0xb'));_0xf830d6(_0x1b6ff6['result'][_0x5492('0x10')]);}})[_0x5492('0x13')](function(_0x42ee36){logger[_0x5492('0xf')](_0x5492('0x11'),_0x5e48f5,_0x42ee36);_0x3bae30(_0x42ee36);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6d364d7..c31320e 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 _0x6f7f=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','multer','util'];(function(_0x4da21e,_0x302796){var _0x35d4cd=function(_0x14227e){while(--_0x14227e){_0x4da21e['push'](_0x4da21e['shift']());}};_0x35d4cd(++_0x302796);}(_0x6f7f,0x106));var _0xf6f7=function(_0x1be9d1,_0x1a1603){_0x1be9d1=_0x1be9d1-0x0;var _0x48629d=_0x6f7f[_0x1be9d1];return _0x48629d;};'use strict';var multer=require(_0xf6f7('0x0'));var util=require(_0xf6f7('0x1'));var path=require(_0xf6f7('0x2'));var timeout=require(_0xf6f7('0x3'));var express=require('express');var router=express[_0xf6f7('0x4')]();var fs_extra=require(_0xf6f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf6f7('0x6'));var config=require('../../config/environment');var controller=require(_0xf6f7('0x7'));router[_0xf6f7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf6f7('0x8')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0xb')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xf6f7('0xc')]);router[_0xf6f7('0x8')](_0xf6f7('0xd'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0xe')]);router[_0xf6f7('0x8')](_0xf6f7('0xf'),auth[_0xf6f7('0xa')](),controller['query']);router[_0xf6f7('0x10')]('/',auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x11')]);router[_0xf6f7('0x12')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x13')]);router[_0xf6f7('0x14')](_0xf6f7('0x9'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0x15')]);module['exports']=router; \ No newline at end of file +var _0x788c=['index','get','/:id','isAuthenticated','show','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x788c,0xf6));var _0xc788=function(_0x20621d,_0x2bbc22){_0x20621d=_0x20621d-0x0;var _0x5b6dbd=_0x788c[_0x20621d];return _0x5b6dbd;};'use strict';var multer=require('multer');var util=require(_0xc788('0x0'));var path=require('path');var timeout=require(_0xc788('0x1'));var express=require('express');var router=express[_0xc788('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc788('0x3'));var config=require(_0xc788('0x4'));var controller=require(_0xc788('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc788('0x6')]);router[_0xc788('0x7')](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xa')]);router[_0xc788('0x7')]('/:id/preview',auth[_0xc788('0x9')](),controller['preview']);router[_0xc788('0x7')](_0xc788('0xb'),auth[_0xc788('0x9')](),controller[_0xc788('0xc')]);router[_0xc788('0x7')](_0xc788('0xd'),auth[_0xc788('0x9')](),controller['query']);router[_0xc788('0xe')]('/',auth[_0xc788('0x9')](),controller[_0xc788('0xf')]);router[_0xc788('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc788('0x11')]);router[_0xc788('0x12')]('/:id',auth[_0xc788('0x9')](),controller[_0xc788('0x13')]);module[_0xc788('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c0cb115..1b80794 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 _0x1639=['DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv','pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1639,0xaa));var _0x9163=function(_0x598b67,_0x478935){_0x598b67=_0x598b67-0x0;var _0x5ebe2e=_0x1639[_0x598b67];return _0x5ebe2e;};'use strict';var Sequelize=require(_0x9163('0x0'));var moment=require('moment');module[_0x9163('0x1')]={'name':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9163('0x3')](_0x9163('0x4'),_0x9163('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x9163('0x4')},'savename':{'type':Sequelize[_0x9163('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9163('0x6')]},'endDate':{'type':Sequelize[_0x9163('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9163('0x7')},'type':{'type':Sequelize['ENUM'](_0x9163('0x8'),_0x9163('0x9')),'allowNull':![],'defaultValue':_0x9163('0x8')},'reportId':{'type':Sequelize[_0x9163('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x9163('0x2')]}}; \ No newline at end of file +var _0xce1e=['xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf'];(function(_0x27fa03,_0x38a271){var _0x5c9f39=function(_0x4fb9ae){while(--_0x4fb9ae){_0x27fa03['push'](_0x27fa03['shift']());}};_0x5c9f39(++_0x38a271);}(_0xce1e,0x1aa));var _0xece1=function(_0x267c09,_0x33be6d){_0x267c09=_0x267c09-0x0;var _0x502b9e=_0xce1e[_0x267c09];return _0x502b9e;};'use strict';var Sequelize=require(_0xece1('0x0'));var moment=require(_0xece1('0x1'));module['exports']={'name':{'type':Sequelize[_0xece1('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xece1('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xece1('0x3')](_0xece1('0x4'),_0xece1('0x5'),_0xece1('0x6')),'allowNull':![],'defaultValue':_0xece1('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xece1('0x7')]},'endDate':{'type':Sequelize[_0xece1('0x7')]},'status':{'type':Sequelize[_0xece1('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xece1('0x3')](_0xece1('0x8'),_0xece1('0x9')),'allowNull':![],'defaultValue':_0xece1('0x8')},'reportId':{'type':Sequelize[_0xece1('0xa')](0xb)[_0xece1('0xb')]},'reportType':{'type':Sequelize[_0xece1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7a67012..718650d 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 _0xd6c2=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','rows','show','params','keys','find','catch','create','body','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4c4920,_0x276b99){var _0x53d293=function(_0x29b8ec){while(--_0x29b8ec){_0x4c4920['push'](_0x4c4920['shift']());}};_0x53d293(++_0x276b99);}(_0xd6c2,0xc2));var _0x2d6c=function(_0x545af4,_0x1e9a7e){_0x545af4=_0x545af4-0x0;var _0x1768d4=_0xd6c2[_0x545af4];return _0x1768d4;};'use strict';var emlformat=require(_0x2d6c('0x0'));var rimraf=require(_0x2d6c('0x1'));var zipdir=require(_0x2d6c('0x2'));var jsonpatch=require(_0x2d6c('0x3'));var rp=require(_0x2d6c('0x4'));var moment=require(_0x2d6c('0x5'));var BPromise=require(_0x2d6c('0x6'));var Mustache=require(_0x2d6c('0x7'));var util=require(_0x2d6c('0x8'));var path=require(_0x2d6c('0x9'));var sox=require(_0x2d6c('0xa'));var csv=require(_0x2d6c('0xb'));var ejs=require(_0x2d6c('0xc'));var fs=require('fs');var fs_extra=require(_0x2d6c('0xd'));var _=require(_0x2d6c('0xe'));var squel=require(_0x2d6c('0xf'));var crypto=require(_0x2d6c('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x2d6c('0x11'));var toCsv=require(_0x2d6c('0xb'));var querystring=require(_0x2d6c('0x12'));var Papa=require(_0x2d6c('0x13'));var Redis=require(_0x2d6c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2d6c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d6c('0x16'))(_0x2d6c('0x17'));var utils=require(_0x2d6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2d6c('0x19'));var db=require(_0x2d6c('0x1a'))['db'];function respondWithStatusCode(_0xea4b70,_0x475523){_0x475523=_0x475523||0xcc;return function(_0x4740c0){if(_0x4740c0){return _0xea4b70[_0x2d6c('0x1b')](_0x475523);}return _0xea4b70[_0x2d6c('0x1c')](_0x475523)[_0x2d6c('0x1d')]();};}function respondWithResult(_0x1feb9f,_0x559f44){_0x559f44=_0x559f44||0xc8;return function(_0x4208fe){if(_0x4208fe){return _0x1feb9f[_0x2d6c('0x1c')](_0x559f44)['json'](_0x4208fe);}};}function respondWithFilteredResult(_0x3b869f,_0x42faae){return function(_0x4456f2){if(_0x4456f2){var _0x86d15=typeof _0x42faae[_0x2d6c('0x1e')]===_0x2d6c('0x1f')&&typeof _0x42faae[_0x2d6c('0x20')]===_0x2d6c('0x1f');var _0x2dc303=_0x4456f2[_0x2d6c('0x21')];var _0x2c06ef=_0x86d15?0x0:_0x42faae[_0x2d6c('0x1e')];var _0x4f897f=_0x86d15?_0x4456f2[_0x2d6c('0x21')]:_0x42faae[_0x2d6c('0x1e')]+_0x42faae[_0x2d6c('0x20')];var _0x5cbd47;if(_0x4f897f>=_0x2dc303){_0x4f897f=_0x2dc303;_0x5cbd47=0xc8;}else{_0x5cbd47=0xce;}_0x3b869f['status'](_0x5cbd47);return _0x3b869f[_0x2d6c('0x22')](_0x2d6c('0x23'),_0x2c06ef+'-'+_0x4f897f+'/'+_0x2dc303)['json'](_0x4456f2);}return null;};}function patchUpdates(_0x1c1d07){return function(_0x4e2ee0){try{jsonpatch[_0x2d6c('0x24')](_0x4e2ee0,_0x1c1d07,!![]);}catch(_0x1ca2bd){return BPromise[_0x2d6c('0x25')](_0x1ca2bd);}return _0x4e2ee0['save']();};}function saveUpdates(_0x18f60,_0x89e215){return function(_0x42f4af){if(_0x42f4af){return _0x42f4af[_0x2d6c('0x26')](_0x18f60)[_0x2d6c('0x27')](function(_0x45b774){return _0x45b774;});}return null;};}function removeEntity(_0x1b6098,_0x52ec34){return function(_0x30fbd1){if(_0x30fbd1){return _0x30fbd1[_0x2d6c('0x28')]()[_0x2d6c('0x27')](function(){var _0x427a8d=_0x30fbd1[_0x2d6c('0x29')]({'plain':!![]});var _0x371e98=_0x2d6c('0x2a');return db['UserProfileResource'][_0x2d6c('0x28')]({'where':{'type':_0x371e98,'resourceId':_0x427a8d['id']}})['then'](function(){return _0x30fbd1;});})['then'](function(){_0x1b6098[_0x2d6c('0x1c')](0xcc)[_0x2d6c('0x1d')]();});}};}function handleEntityNotFound(_0x10cd08,_0x292122){return function(_0x291813){if(!_0x291813){_0x10cd08[_0x2d6c('0x1b')](0x194);}return _0x291813;};}function handleError(_0x4a0f0e,_0x210175){_0x210175=_0x210175||0x1f4;return function(_0x119a3a){logger[_0x2d6c('0x2b')](_0x119a3a[_0x2d6c('0x2c')]);if(_0x119a3a['name']){delete _0x119a3a[_0x2d6c('0x2d')];}_0x4a0f0e['status'](_0x210175)[_0x2d6c('0x2e')](_0x119a3a);};}exports[_0x2d6c('0x2f')]=function(_0x167026,_0x5c6612){var _0x407ed1={},_0x57d102={},_0x2b4dad={'count':0x0,'rows':[]};var _0x17addd=_[_0x2d6c('0x30')](db['AnalyticExtractedReport'][_0x2d6c('0x31')],function(_0x8f49f8){return{'name':_0x8f49f8[_0x2d6c('0x32')],'type':_0x8f49f8['type'][_0x2d6c('0x33')]};});_0x57d102[_0x2d6c('0x34')]=_[_0x2d6c('0x30')](_0x17addd,_0x2d6c('0x2d'));_0x57d102[_0x2d6c('0x35')]=_['keys'](_0x167026[_0x2d6c('0x35')]);_0x57d102[_0x2d6c('0x36')]=_[_0x2d6c('0x37')](_0x57d102[_0x2d6c('0x34')],_0x57d102['query']);_0x407ed1[_0x2d6c('0x38')]=_['intersection'](_0x57d102['model'],qs['fields'](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x39')]));_0x407ed1['attributes']=_0x407ed1[_0x2d6c('0x38')][_0x2d6c('0x3a')]?_0x407ed1[_0x2d6c('0x38')]:_0x57d102[_0x2d6c('0x34')];if(!_0x167026[_0x2d6c('0x35')][_0x2d6c('0x3b')](_0x2d6c('0x3c'))){_0x407ed1[_0x2d6c('0x20')]=qs['limit'](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x20')]);_0x407ed1[_0x2d6c('0x1e')]=qs[_0x2d6c('0x1e')](_0x167026['query'][_0x2d6c('0x1e')]);}_0x407ed1['order']=qs[_0x2d6c('0x3d')](_0x167026[_0x2d6c('0x35')][_0x2d6c('0x3d')]);_0x407ed1[_0x2d6c('0x3e')]=qs[_0x2d6c('0x36')](_[_0x2d6c('0x3f')](_0x167026[_0x2d6c('0x35')],_0x57d102['filters']),_0x17addd);if(_0x167026[_0x2d6c('0x35')]['filter']){_0x407ed1[_0x2d6c('0x3e')]=_[_0x2d6c('0x40')](_0x407ed1[_0x2d6c('0x3e')],{'$or':_[_0x2d6c('0x30')](_0x17addd,function(_0xe1e3c9){if(_0xe1e3c9[_0x2d6c('0x41')]!==_0x2d6c('0x42')){var _0x326936={};_0x326936[_0xe1e3c9['name']]={'$like':'%'+_0x167026[_0x2d6c('0x35')][_0x2d6c('0x43')]+'%'};return _0x326936;}})});}_0x407ed1=_[_0x2d6c('0x40')]({},_0x407ed1,_0x167026[_0x2d6c('0x44')]);var _0x2a169a={'where':_0x407ed1['where']};return db[_0x2d6c('0x45')][_0x2d6c('0x21')](_0x2a169a)[_0x2d6c('0x27')](function(_0xa1126d){_0x2b4dad[_0x2d6c('0x21')]=_0xa1126d;if(_0x167026['query'][_0x2d6c('0x46')]){_0x407ed1[_0x2d6c('0x47')]=[{'all':!![]}];}return db[_0x2d6c('0x45')]['findAll'](_0x407ed1);})['then'](function(_0x29f059){_0x2b4dad[_0x2d6c('0x48')]=_0x29f059;return _0x2b4dad;})[_0x2d6c('0x27')](respondWithFilteredResult(_0x5c6612,_0x407ed1))['catch'](handleError(_0x5c6612,null));};exports[_0x2d6c('0x49')]=function(_0x381583,_0x192ed2){var _0x5f3597={'raw':!![],'where':{'id':_0x381583[_0x2d6c('0x4a')]['id']}},_0x79ce11={};_0x79ce11[_0x2d6c('0x34')]=_[_0x2d6c('0x4b')](db['AnalyticExtractedReport'][_0x2d6c('0x31')]);_0x79ce11[_0x2d6c('0x35')]=_[_0x2d6c('0x4b')](_0x381583[_0x2d6c('0x35')]);_0x79ce11[_0x2d6c('0x36')]=_['intersection'](_0x79ce11[_0x2d6c('0x34')],_0x79ce11['query']);_0x5f3597['attributes']=_[_0x2d6c('0x37')](_0x79ce11['model'],qs['fields'](_0x381583[_0x2d6c('0x35')][_0x2d6c('0x39')]));_0x5f3597['attributes']=_0x5f3597['attributes'][_0x2d6c('0x3a')]?_0x5f3597[_0x2d6c('0x38')]:_0x79ce11['model'];if(_0x381583[_0x2d6c('0x35')][_0x2d6c('0x46')]){_0x5f3597[_0x2d6c('0x47')]=[{'all':!![]}];}_0x5f3597=_['merge']({},_0x5f3597,_0x381583[_0x2d6c('0x44')]);return db['AnalyticExtractedReport'][_0x2d6c('0x4c')](_0x5f3597)[_0x2d6c('0x27')](handleEntityNotFound(_0x192ed2,null))['then'](respondWithResult(_0x192ed2,null))[_0x2d6c('0x4d')](handleError(_0x192ed2,null));};exports[_0x2d6c('0x4e')]=function(_0x42e8bc,_0x172f3f){return db['AnalyticExtractedReport'][_0x2d6c('0x4e')](_0x42e8bc[_0x2d6c('0x4f')],{})[_0x2d6c('0x27')](function(_0x574e8f){var _0x51c543=_0x42e8bc['user'][_0x2d6c('0x29')]({'plain':!![]});if(!_0x51c543)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51c543['role']==='user'){var _0x32fd2a=_0x574e8f[_0x2d6c('0x29')]({'plain':!![]});var _0x33edbe=_0x2d6c('0x2a');return db[_0x2d6c('0x50')][_0x2d6c('0x4c')]({'where':{'name':_0x33edbe,'userProfileId':_0x51c543[_0x2d6c('0x51')]},'raw':!![]})[_0x2d6c('0x27')](function(_0x1a4716){if(_0x1a4716&&_0x1a4716[_0x2d6c('0x52')]===0x0){return db[_0x2d6c('0x53')][_0x2d6c('0x4e')]({'name':_0x32fd2a[_0x2d6c('0x2d')],'resourceId':_0x32fd2a['id'],'type':_0x1a4716[_0x2d6c('0x2d')],'sectionId':_0x1a4716['id']},{})[_0x2d6c('0x27')](function(){return _0x574e8f;});}else{return _0x574e8f;}})[_0x2d6c('0x4d')](function(_0x40caf0){logger[_0x2d6c('0x2b')](_0x2d6c('0x54'),_0x40caf0);throw _0x40caf0;});}return _0x574e8f;})['then'](respondWithResult(_0x172f3f,0xc9))[_0x2d6c('0x4d')](handleError(_0x172f3f,null));};exports['update']=function(_0x4631c1,_0x4cc862){if(_0x4631c1['body']['id']){delete _0x4631c1['body']['id'];}return db[_0x2d6c('0x45')][_0x2d6c('0x4c')]({'where':{'id':_0x4631c1['params']['id']}})['then'](handleEntityNotFound(_0x4cc862,null))[_0x2d6c('0x27')](saveUpdates(_0x4631c1[_0x2d6c('0x4f')],null))[_0x2d6c('0x27')](respondWithResult(_0x4cc862,null))[_0x2d6c('0x4d')](handleError(_0x4cc862,null));};exports[_0x2d6c('0x28')]=function(_0x1c11e2,_0x518621){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1c11e2[_0x2d6c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x518621,null))['then'](removeEntity(_0x518621,null))[_0x2d6c('0x4d')](handleError(_0x518621,null));};exports[_0x2d6c('0x55')]=function(_0x5ca7b0,_0x41d3a4,_0x59be14){return db[_0x2d6c('0x45')][_0x2d6c('0x4c')]({'where':{'id':_0x5ca7b0[_0x2d6c('0x4a')]['id']},'attributes':['name',_0x2d6c('0x56'),_0x2d6c('0x57'),_0x2d6c('0x58')],'raw':!![]})[_0x2d6c('0x27')](handleEntityNotFound(_0x41d3a4,null))[_0x2d6c('0x27')](function(_0x3f6a0b){if(_0x3f6a0b){if(!fs[_0x2d6c('0x59')](path[_0x2d6c('0x5a')](config['root'],_0x2d6c('0x5b'),_0x3f6a0b['savename']))){throw new db[(_0x2d6c('0x5c'))][(_0x2d6c('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5ca7b0[_0x2d6c('0x35')][_0x2d6c('0x5e')]){return _0x41d3a4[_0x2d6c('0x1b')](0xc8);}return _0x41d3a4[_0x2d6c('0x55')](path['join'](config[_0x2d6c('0x5f')],_0x2d6c('0x5b'),_0x3f6a0b['savename']),util[_0x2d6c('0x60')](_0x2d6c('0x61'),_0x3f6a0b[_0x2d6c('0x56')]||_0x3f6a0b[_0x2d6c('0x2d')],_0x3f6a0b['output'][_0x2d6c('0x62')]()));}})[_0x2d6c('0x4d')](handleError(_0x41d3a4,null));}; \ No newline at end of file +var _0x2f3b=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','ExtractedReports','UserProfileResource','end','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','savename','output','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','basename','toLowerCase','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs'];(function(_0x7c0646,_0x45d16b){var _0x32416d=function(_0x22abdd){while(--_0x22abdd){_0x7c0646['push'](_0x7c0646['shift']());}};_0x32416d(++_0x45d16b);}(_0x2f3b,0x14d));var _0xb2f3=function(_0x4293e5,_0x2e380a){_0x4293e5=_0x4293e5-0x0;var _0x46cdad=_0x2f3b[_0x4293e5];return _0x46cdad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2f3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2f3('0x1'));var rp=require(_0xb2f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb2f3('0x3'));var util=require(_0xb2f3('0x4'));var path=require(_0xb2f3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2f3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2f3('0x7'));var squel=require(_0xb2f3('0x8'));var crypto=require(_0xb2f3('0x9'));var jsforce=require(_0xb2f3('0xa'));var deskjs=require(_0xb2f3('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb2f3('0xc'));var Papa=require('papaparse');var Redis=require(_0xb2f3('0xd'));var authService=require(_0xb2f3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f3('0xf'));var hardwareService=require(_0xb2f3('0x10'));var logger=require(_0xb2f3('0x11'))(_0xb2f3('0x12'));var utils=require(_0xb2f3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb2f3('0x14'))['db'];function respondWithStatusCode(_0x4694b9,_0x571a7a){_0x571a7a=_0x571a7a||0xcc;return function(_0x509055){if(_0x509055){return _0x4694b9[_0xb2f3('0x15')](_0x571a7a);}return _0x4694b9[_0xb2f3('0x16')](_0x571a7a)['end']();};}function respondWithResult(_0x3336c5,_0x4f5f27){_0x4f5f27=_0x4f5f27||0xc8;return function(_0x6fc8c){if(_0x6fc8c){return _0x3336c5[_0xb2f3('0x16')](_0x4f5f27)['json'](_0x6fc8c);}};}function respondWithFilteredResult(_0x26d444,_0x2bab57){return function(_0x42ed88){if(_0x42ed88){var _0x191bdc=typeof _0x2bab57[_0xb2f3('0x17')]===_0xb2f3('0x18')&&typeof _0x2bab57[_0xb2f3('0x19')]===_0xb2f3('0x18');var _0x3cc169=_0x42ed88[_0xb2f3('0x1a')];var _0x3e6263=_0x191bdc?0x0:_0x2bab57[_0xb2f3('0x17')];var _0x5a0b4e=_0x191bdc?_0x42ed88[_0xb2f3('0x1a')]:_0x2bab57[_0xb2f3('0x17')]+_0x2bab57[_0xb2f3('0x19')];var _0x2b0927;if(_0x5a0b4e>=_0x3cc169){_0x5a0b4e=_0x3cc169;_0x2b0927=0xc8;}else{_0x2b0927=0xce;}_0x26d444[_0xb2f3('0x16')](_0x2b0927);return _0x26d444[_0xb2f3('0x1b')](_0xb2f3('0x1c'),_0x3e6263+'-'+_0x5a0b4e+'/'+_0x3cc169)['json'](_0x42ed88);}return null;};}function patchUpdates(_0x553e20){return function(_0x16ac1b){try{jsonpatch['apply'](_0x16ac1b,_0x553e20,!![]);}catch(_0x155be3){return BPromise['reject'](_0x155be3);}return _0x16ac1b[_0xb2f3('0x1d')]();};}function saveUpdates(_0x3c3e02,_0x4c7657){return function(_0x200a04){if(_0x200a04){return _0x200a04[_0xb2f3('0x1e')](_0x3c3e02)['then'](function(_0x116ce6){return _0x116ce6;});}return null;};}function removeEntity(_0x2e30ce,_0x3096ee){return function(_0x145634){if(_0x145634){return _0x145634[_0xb2f3('0x1f')]()[_0xb2f3('0x20')](function(){var _0x56abc9=_0x145634[_0xb2f3('0x21')]({'plain':!![]});var _0x38ec4e=_0xb2f3('0x22');return db[_0xb2f3('0x23')][_0xb2f3('0x1f')]({'where':{'type':_0x38ec4e,'resourceId':_0x56abc9['id']}})['then'](function(){return _0x145634;});})['then'](function(){_0x2e30ce[_0xb2f3('0x16')](0xcc)[_0xb2f3('0x24')]();});}};}function handleEntityNotFound(_0x23a5f8,_0xe7414d){return function(_0x586d3b){if(!_0x586d3b){_0x23a5f8[_0xb2f3('0x15')](0x194);}return _0x586d3b;};}function handleError(_0x34611d,_0xd9b1ab){_0xd9b1ab=_0xd9b1ab||0x1f4;return function(_0x3a45c2){logger[_0xb2f3('0x25')](_0x3a45c2[_0xb2f3('0x26')]);if(_0x3a45c2[_0xb2f3('0x27')]){delete _0x3a45c2[_0xb2f3('0x27')];}_0x34611d[_0xb2f3('0x16')](_0xd9b1ab)['send'](_0x3a45c2);};}exports[_0xb2f3('0x28')]=function(_0x3aeff0,_0x4cfb66){var _0x34a517={},_0x1283bc={},_0x4e863d={'count':0x0,'rows':[]};var _0x48e9fc=_[_0xb2f3('0x29')](db[_0xb2f3('0x2a')][_0xb2f3('0x2b')],function(_0x5e6fa7){return{'name':_0x5e6fa7[_0xb2f3('0x2c')],'type':_0x5e6fa7['type'][_0xb2f3('0x2d')]};});_0x1283bc[_0xb2f3('0x2e')]=_[_0xb2f3('0x29')](_0x48e9fc,'name');_0x1283bc[_0xb2f3('0x2f')]=_[_0xb2f3('0x30')](_0x3aeff0[_0xb2f3('0x2f')]);_0x1283bc[_0xb2f3('0x31')]=_[_0xb2f3('0x32')](_0x1283bc['model'],_0x1283bc[_0xb2f3('0x2f')]);_0x34a517[_0xb2f3('0x33')]=_[_0xb2f3('0x32')](_0x1283bc[_0xb2f3('0x2e')],qs[_0xb2f3('0x34')](_0x3aeff0['query'][_0xb2f3('0x34')]));_0x34a517[_0xb2f3('0x33')]=_0x34a517[_0xb2f3('0x33')][_0xb2f3('0x35')]?_0x34a517[_0xb2f3('0x33')]:_0x1283bc[_0xb2f3('0x2e')];if(!_0x3aeff0['query'][_0xb2f3('0x36')]('nolimit')){_0x34a517['limit']=qs[_0xb2f3('0x19')](_0x3aeff0['query'][_0xb2f3('0x19')]);_0x34a517[_0xb2f3('0x17')]=qs[_0xb2f3('0x17')](_0x3aeff0[_0xb2f3('0x2f')][_0xb2f3('0x17')]);}_0x34a517['order']=qs[_0xb2f3('0x37')](_0x3aeff0['query']['sort']);_0x34a517[_0xb2f3('0x38')]=qs[_0xb2f3('0x31')](_['pick'](_0x3aeff0[_0xb2f3('0x2f')],_0x1283bc[_0xb2f3('0x31')]),_0x48e9fc);if(_0x3aeff0[_0xb2f3('0x2f')][_0xb2f3('0x39')]){_0x34a517[_0xb2f3('0x38')]=_[_0xb2f3('0x3a')](_0x34a517['where'],{'$or':_[_0xb2f3('0x29')](_0x48e9fc,function(_0x85ff37){if(_0x85ff37['type']!==_0xb2f3('0x3b')){var _0x28415c={};_0x28415c[_0x85ff37[_0xb2f3('0x27')]]={'$like':'%'+_0x3aeff0[_0xb2f3('0x2f')][_0xb2f3('0x39')]+'%'};return _0x28415c;}})});}_0x34a517=_[_0xb2f3('0x3a')]({},_0x34a517,_0x3aeff0[_0xb2f3('0x3c')]);var _0x573452={'where':_0x34a517[_0xb2f3('0x38')]};return db['AnalyticExtractedReport'][_0xb2f3('0x1a')](_0x573452)['then'](function(_0x35c284){_0x4e863d[_0xb2f3('0x1a')]=_0x35c284;if(_0x3aeff0[_0xb2f3('0x2f')][_0xb2f3('0x3d')]){_0x34a517[_0xb2f3('0x3e')]=[{'all':!![]}];}return db[_0xb2f3('0x2a')]['findAll'](_0x34a517);})['then'](function(_0x2d8c69){_0x4e863d['rows']=_0x2d8c69;return _0x4e863d;})[_0xb2f3('0x20')](respondWithFilteredResult(_0x4cfb66,_0x34a517))[_0xb2f3('0x3f')](handleError(_0x4cfb66,null));};exports[_0xb2f3('0x40')]=function(_0x19dfbc,_0x3444b9){var _0x4f5256={'raw':!![],'where':{'id':_0x19dfbc[_0xb2f3('0x41')]['id']}},_0x3040ea={};_0x3040ea[_0xb2f3('0x2e')]=_[_0xb2f3('0x30')](db[_0xb2f3('0x2a')][_0xb2f3('0x2b')]);_0x3040ea[_0xb2f3('0x2f')]=_[_0xb2f3('0x30')](_0x19dfbc[_0xb2f3('0x2f')]);_0x3040ea['filters']=_[_0xb2f3('0x32')](_0x3040ea[_0xb2f3('0x2e')],_0x3040ea[_0xb2f3('0x2f')]);_0x4f5256[_0xb2f3('0x33')]=_[_0xb2f3('0x32')](_0x3040ea[_0xb2f3('0x2e')],qs[_0xb2f3('0x34')](_0x19dfbc['query'][_0xb2f3('0x34')]));_0x4f5256[_0xb2f3('0x33')]=_0x4f5256[_0xb2f3('0x33')][_0xb2f3('0x35')]?_0x4f5256[_0xb2f3('0x33')]:_0x3040ea['model'];if(_0x19dfbc[_0xb2f3('0x2f')][_0xb2f3('0x3d')]){_0x4f5256['include']=[{'all':!![]}];}_0x4f5256=_['merge']({},_0x4f5256,_0x19dfbc[_0xb2f3('0x3c')]);return db[_0xb2f3('0x2a')][_0xb2f3('0x42')](_0x4f5256)[_0xb2f3('0x20')](handleEntityNotFound(_0x3444b9,null))[_0xb2f3('0x20')](respondWithResult(_0x3444b9,null))[_0xb2f3('0x3f')](handleError(_0x3444b9,null));};exports[_0xb2f3('0x43')]=function(_0x3d8010,_0x5e5e7b){return db['AnalyticExtractedReport'][_0xb2f3('0x43')](_0x3d8010[_0xb2f3('0x44')],{})[_0xb2f3('0x20')](function(_0x5d5039){var _0x14df3e=_0x3d8010[_0xb2f3('0x45')]['get']({'plain':!![]});if(!_0x14df3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14df3e[_0xb2f3('0x46')]===_0xb2f3('0x45')){var _0x3989bd=_0x5d5039['get']({'plain':!![]});var _0x138c23=_0xb2f3('0x22');return db[_0xb2f3('0x47')][_0xb2f3('0x42')]({'where':{'name':_0x138c23,'userProfileId':_0x14df3e['userProfileId']},'raw':!![]})['then'](function(_0x298052){if(_0x298052&&_0x298052[_0xb2f3('0x48')]===0x0){return db[_0xb2f3('0x23')]['create']({'name':_0x3989bd[_0xb2f3('0x27')],'resourceId':_0x3989bd['id'],'type':_0x298052['name'],'sectionId':_0x298052['id']},{})['then'](function(){return _0x5d5039;});}else{return _0x5d5039;}})[_0xb2f3('0x3f')](function(_0xd601a2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd601a2);throw _0xd601a2;});}return _0x5d5039;})[_0xb2f3('0x20')](respondWithResult(_0x5e5e7b,0xc9))['catch'](handleError(_0x5e5e7b,null));};exports[_0xb2f3('0x1e')]=function(_0x3ef26a,_0x168bc0){if(_0x3ef26a['body']['id']){delete _0x3ef26a[_0xb2f3('0x44')]['id'];}return db[_0xb2f3('0x2a')]['find']({'where':{'id':_0x3ef26a[_0xb2f3('0x41')]['id']}})[_0xb2f3('0x20')](handleEntityNotFound(_0x168bc0,null))[_0xb2f3('0x20')](saveUpdates(_0x3ef26a['body'],null))[_0xb2f3('0x20')](respondWithResult(_0x168bc0,null))[_0xb2f3('0x3f')](handleError(_0x168bc0,null));};exports['destroy']=function(_0x396f2b,_0x31c1f3){return db[_0xb2f3('0x2a')][_0xb2f3('0x42')]({'where':{'id':_0x396f2b[_0xb2f3('0x41')]['id']}})['then'](handleEntityNotFound(_0x31c1f3,null))[_0xb2f3('0x20')](removeEntity(_0x31c1f3,null))[_0xb2f3('0x3f')](handleError(_0x31c1f3,null));};exports['download']=function(_0x20d561,_0x37edb8,_0x5f468e){return db[_0xb2f3('0x2a')][_0xb2f3('0x42')]({'where':{'id':_0x20d561[_0xb2f3('0x41')]['id']},'attributes':[_0xb2f3('0x27'),'basename',_0xb2f3('0x49'),_0xb2f3('0x4a')],'raw':!![]})[_0xb2f3('0x20')](handleEntityNotFound(_0x37edb8,null))[_0xb2f3('0x20')](function(_0x508d3c){if(_0x508d3c){if(!fs['existsSync'](path[_0xb2f3('0x4b')](config[_0xb2f3('0x4c')],_0xb2f3('0x4d'),_0x508d3c['savename']))){throw new db['Sequelize'][(_0xb2f3('0x4e'))](_0xb2f3('0x4f'));}if(_0x20d561[_0xb2f3('0x2f')][_0xb2f3('0x50')]){return _0x37edb8[_0xb2f3('0x15')](0xc8);}return _0x37edb8[_0xb2f3('0x51')](path['join'](config['root'],'server/files/reports',_0x508d3c['savename']),util[_0xb2f3('0x52')]('%s.%s',_0x508d3c[_0xb2f3('0x53')]||_0x508d3c[_0xb2f3('0x27')],_0x508d3c['output'][_0xb2f3('0x54')]()));}})[_0xb2f3('0x3f')](handleError(_0x37edb8,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 30deecd..6ed0040 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 _0x7197=['define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x2bca5d,_0xc1727f){var _0x4dbca0=function(_0x2b1913){while(--_0x2b1913){_0x2bca5d['push'](_0x2bca5d['shift']());}};_0x4dbca0(++_0xc1727f);}(_0x7197,0x6b));var _0x7719=function(_0x43e414,_0x5deb2a){_0x43e414=_0x43e414-0x0;var _0x38805b=_0x7197[_0x43e414];return _0x38805b;};'use strict';var _=require('lodash');var util=require(_0x7719('0x0'));var logger=require(_0x7719('0x1'))(_0x7719('0x2'));var moment=require('moment');var BPromise=require(_0x7719('0x3'));var rp=require(_0x7719('0x4'));var fs=require('fs');var path=require(_0x7719('0x5'));var rimraf=require(_0x7719('0x6'));var config=require(_0x7719('0x7'));var attributes=require(_0x7719('0x8'));module[_0x7719('0x9')]=function(_0x5baf73,_0x4611af){return _0x5baf73[_0x7719('0xa')](_0x7719('0xb'),attributes,{'tableName':_0x7719('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x424b=['analytics_extracted_reports','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x552284,_0x4ddb09){var _0x4ac092=function(_0x5c2703){while(--_0x5c2703){_0x552284['push'](_0x552284['shift']());}};_0x4ac092(++_0x4ddb09);}(_0x424b,0x1a8));var _0xb424=function(_0x510ab3,_0x51e30f){_0x510ab3=_0x510ab3-0x0;var _0x552438=_0x424b[_0x510ab3];return _0x552438;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb424('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb424('0x1'));var rp=require(_0xb424('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb424('0x3'));var config=require(_0xb424('0x4'));var attributes=require(_0xb424('0x5'));module[_0xb424('0x6')]=function(_0x14b4de,_0x56f698){return _0x14b4de[_0xb424('0x7')]('AnalyticExtractedReport',attributes,{'tableName':_0xb424('0x8'),'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 3b661fe..24d8b3b 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 _0xbdff=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x1e997e,_0x319443){var _0x4f9955=function(_0x328735){while(--_0x328735){_0x1e997e['push'](_0x1e997e['shift']());}};_0x4f9955(++_0x319443);}(_0xbdff,0x19b));var _0xfbdf=function(_0x3098b6,_0x4cf9ed){_0x3098b6=_0x3098b6-0x0;var _0x5ce8f9=_0xbdff[_0x3098b6];return _0x5ce8f9;};'use strict';var _=require('lodash');var util=require(_0xfbdf('0x0'));var moment=require(_0xfbdf('0x1'));var BPromise=require(_0xfbdf('0x2'));var rs=require(_0xfbdf('0x3'));var fs=require('fs');var Redis=require(_0xfbdf('0x4'));var db=require(_0xfbdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbdf('0x6'))(_0xfbdf('0x7'));var config=require(_0xfbdf('0x8'));var jayson=require(_0xfbdf('0x9'));var client=jayson['client'][_0xfbdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf742,_0x207459,_0x1b3bc3){return new BPromise(function(_0xb2ce4,_0x5bf2f1){return client[_0xfbdf('0xb')](_0x4bf742,_0x1b3bc3)[_0xfbdf('0xc')](function(_0x5707ad){logger[_0xfbdf('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x207459,_0xfbdf('0xe'));logger[_0xfbdf('0xf')](_0xfbdf('0x10'),_0x207459,'request\x20sent',JSON[_0xfbdf('0x11')](_0x5707ad));if(_0x5707ad['error']){if(_0x5707ad['error'][_0xfbdf('0x12')]===0x1f4){logger[_0xfbdf('0x13')](_0xfbdf('0x14'),_0x207459,_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);return _0x5bf2f1(_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);}logger[_0xfbdf('0x13')](_0xfbdf('0x14'),_0x207459,_0x5707ad[_0xfbdf('0x13')][_0xfbdf('0x15')]);return _0xb2ce4(_0x5707ad['error'][_0xfbdf('0x15')]);}else{logger[_0xfbdf('0xd')](_0xfbdf('0x14'),_0x207459,_0xfbdf('0xe'));_0xb2ce4(_0x5707ad[_0xfbdf('0x16')][_0xfbdf('0x15')]);}})[_0xfbdf('0x17')](function(_0x4a8133){logger[_0xfbdf('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x207459,_0x4a8133);_0x5bf2f1(_0x4a8133);});});} \ No newline at end of file +var _0xaebd=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x211419,_0x30cd6c){var _0x19dfdd=function(_0x857a03){while(--_0x857a03){_0x211419['push'](_0x211419['shift']());}};_0x19dfdd(++_0x30cd6c);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x2acf04,_0x4ec7a1){_0x2acf04=_0x2acf04-0x0;var _0x4076bd=_0xaebd[_0x2acf04];return _0x4076bd;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9e1aed3..41e9a5f 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 _0x3f80=['isAuthenticated','/:id','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x595b06,_0x103c7c){var _0x9688da=function(_0xe8250b){while(--_0xe8250b){_0x595b06['push'](_0x595b06['shift']());}};_0x9688da(++_0x103c7c);}(_0x3f80,0x1ea));var _0x03f8=function(_0x5f096e,_0x5cd76e){_0x5f096e=_0x5f096e-0x0;var _0x3c2cda=_0x3f80[_0x5f096e];return _0x3c2cda;};'use strict';var multer=require(_0x03f8('0x0'));var util=require(_0x03f8('0x1'));var path=require(_0x03f8('0x2'));var timeout=require(_0x03f8('0x3'));var express=require('express');var router=express[_0x03f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x03f8('0x5'));var interaction=require(_0x03f8('0x6'));var config=require(_0x03f8('0x7'));var controller=require(_0x03f8('0x8'));router[_0x03f8('0x9')]('/',auth[_0x03f8('0xa')](),controller['index']);router['get'](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller['show']);router['get'](_0x03f8('0xc'),auth[_0x03f8('0xa')](),controller[_0x03f8('0xd')]);router[_0x03f8('0xe')]('/',auth['isAuthenticated'](),controller[_0x03f8('0xf')]);router['put'](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller[_0x03f8('0x10')]);router[_0x03f8('0x11')](_0x03f8('0xb'),auth[_0x03f8('0xa')](),controller[_0x03f8('0x12')]);module[_0x03f8('0x13')]=router; \ No newline at end of file +var _0x5fb1=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','/:id/download','download','post','create','put','update','delete','exports'];(function(_0x3a67f8,_0x38a2b9){var _0x52939c=function(_0x1b7270){while(--_0x1b7270){_0x3a67f8['push'](_0x3a67f8['shift']());}};_0x52939c(++_0x38a2b9);}(_0x5fb1,0xdd));var _0x15fb=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x5fb1[_0x4aac5a];return _0x42e7bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15fb('0x0'));var timeout=require(_0x15fb('0x1'));var express=require(_0x15fb('0x2'));var router=express[_0x15fb('0x3')]();var fs_extra=require(_0x15fb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x15fb('0x5'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x15fb('0x6')]('/',auth[_0x15fb('0x7')](),controller['index']);router[_0x15fb('0x6')](_0x15fb('0x8'),auth[_0x15fb('0x7')](),controller['show']);router[_0x15fb('0x6')](_0x15fb('0x9'),auth['isAuthenticated'](),controller[_0x15fb('0xa')]);router[_0x15fb('0xb')]('/',auth[_0x15fb('0x7')](),controller[_0x15fb('0xc')]);router[_0x15fb('0xd')](_0x15fb('0x8'),auth[_0x15fb('0x7')](),controller[_0x15fb('0xe')]);router[_0x15fb('0xf')](_0x15fb('0x8'),auth[_0x15fb('0x7')](),controller['destroy']);module[_0x15fb('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index bd1c192..1d31ff6 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 _0x8fe5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8fe5,0x12c));var _0x58fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8fe5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x58fe('0x0'));module[_0x58fe('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x58fe('0x2')]},'function':{'type':Sequelize[_0x58fe('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x58fe('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x58fe('0x2')]},'custom':{'type':Sequelize[_0x58fe('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbcfe=['TEXT','STRING','BOOLEAN','exports'];(function(_0xd1bd26,_0x52f570){var _0xd52e66=function(_0xca284){while(--_0xca284){_0xd1bd26['push'](_0xd1bd26['shift']());}};_0xd52e66(++_0x52f570);}(_0xbcfe,0x143));var _0xebcf=function(_0x406556,_0x40a28a){_0x406556=_0x406556-0x0;var _0x450e44=_0xbcfe[_0x406556];return _0x450e44;};'use strict';var Sequelize=require('sequelize');module[_0xebcf('0x0')]={'field':{'type':Sequelize[_0xebcf('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xebcf('0x2')]},'format':{'type':Sequelize[_0xebcf('0x2')]},'groupBy':{'type':Sequelize[_0xebcf('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4a13efb..02e41f5 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 _0x8118=['key','model','keys','filters','intersection','query','fields','attributes','length','sort','where','pick','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','find','catch','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x4ddbc5,_0x7f4e8b){var _0x18b5de=function(_0x342296){while(--_0x342296){_0x4ddbc5['push'](_0x4ddbc5['shift']());}};_0x18b5de(++_0x7f4e8b);}(_0x8118,0x148));var _0x8811=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0x8118[_0x1b81ae];return _0x33ba48;};'use strict';var emlformat=require(_0x8811('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8811('0x1'));var moment=require(_0x8811('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8811('0x3'));var util=require(_0x8811('0x4'));var path=require(_0x8811('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8811('0x6'));var fs=require('fs');var fs_extra=require(_0x8811('0x7'));var _=require(_0x8811('0x8'));var squel=require('squel');var crypto=require(_0x8811('0x9'));var jsforce=require(_0x8811('0xa'));var deskjs=require(_0x8811('0xb'));var toCsv=require(_0x8811('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8811('0xd'));var authService=require(_0x8811('0xe'));var qs=require(_0x8811('0xf'));var as=require(_0x8811('0x10'));var hardwareService=require(_0x8811('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8811('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8811('0x13'));var db=require(_0x8811('0x14'))['db'];function respondWithStatusCode(_0x43279c,_0x445cd2){_0x445cd2=_0x445cd2||0xcc;return function(_0x44260f){if(_0x44260f){return _0x43279c['sendStatus'](_0x445cd2);}return _0x43279c[_0x8811('0x15')](_0x445cd2)[_0x8811('0x16')]();};}function respondWithResult(_0x767ce0,_0x52ebba){_0x52ebba=_0x52ebba||0xc8;return function(_0x44128d){if(_0x44128d){return _0x767ce0[_0x8811('0x15')](_0x52ebba)[_0x8811('0x17')](_0x44128d);}};}function respondWithFilteredResult(_0x2413e7,_0x206d3d){return function(_0x4ee4bc){if(_0x4ee4bc){var _0x194ae8=typeof _0x206d3d[_0x8811('0x18')]===_0x8811('0x19')&&typeof _0x206d3d[_0x8811('0x1a')]===_0x8811('0x19');var _0x1db676=_0x4ee4bc[_0x8811('0x1b')];var _0x546320=_0x194ae8?0x0:_0x206d3d['offset'];var _0x56f560=_0x194ae8?_0x4ee4bc[_0x8811('0x1b')]:_0x206d3d[_0x8811('0x18')]+_0x206d3d['limit'];var _0x39300c;if(_0x56f560>=_0x1db676){_0x56f560=_0x1db676;_0x39300c=0xc8;}else{_0x39300c=0xce;}_0x2413e7[_0x8811('0x15')](_0x39300c);return _0x2413e7['set']('Content-Range',_0x546320+'-'+_0x56f560+'/'+_0x1db676)[_0x8811('0x17')](_0x4ee4bc);}return null;};}function patchUpdates(_0x353a5c){return function(_0x318d71){try{jsonpatch[_0x8811('0x1c')](_0x318d71,_0x353a5c,!![]);}catch(_0x56b7e6){return BPromise[_0x8811('0x1d')](_0x56b7e6);}return _0x318d71[_0x8811('0x1e')]();};}function saveUpdates(_0x576dfe,_0xaaad36){return function(_0x882ea5){if(_0x882ea5){return _0x882ea5[_0x8811('0x1f')](_0x576dfe)[_0x8811('0x20')](function(_0x23f04e){return _0x23f04e;});}return null;};}function removeEntity(_0x1e7d89,_0x4dc7a0){return function(_0x44cd79){if(_0x44cd79){return _0x44cd79[_0x8811('0x21')]()[_0x8811('0x20')](function(){_0x1e7d89[_0x8811('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3c10,_0x3cc5dd){return function(_0x5c80c0){if(!_0x5c80c0){_0x4a3c10['sendStatus'](0x194);}return _0x5c80c0;};}function handleError(_0x28fcae,_0x280c7){_0x280c7=_0x280c7||0x1f4;return function(_0x2e2254){logger['error'](_0x2e2254[_0x8811('0x22')]);if(_0x2e2254[_0x8811('0x23')]){delete _0x2e2254[_0x8811('0x23')];}_0x28fcae[_0x8811('0x15')](_0x280c7)['send'](_0x2e2254);};}exports[_0x8811('0x24')]=function(_0x142523,_0x34f841){var _0x2d2b88={},_0x317ba3={},_0xaba7ae={'count':0x0,'rows':[]};var _0x39bbc2=_[_0x8811('0x25')](db[_0x8811('0x26')][_0x8811('0x27')],function(_0x3c8e9b){return{'name':_0x3c8e9b[_0x8811('0x28')],'type':_0x3c8e9b[_0x8811('0x29')][_0x8811('0x2a')]};});_0x317ba3[_0x8811('0x2b')]=_[_0x8811('0x25')](_0x39bbc2,_0x8811('0x23'));_0x317ba3['query']=_[_0x8811('0x2c')](_0x142523['query']);_0x317ba3[_0x8811('0x2d')]=_[_0x8811('0x2e')](_0x317ba3['model'],_0x317ba3[_0x8811('0x2f')]);_0x2d2b88['attributes']=_[_0x8811('0x2e')](_0x317ba3[_0x8811('0x2b')],qs[_0x8811('0x30')](_0x142523[_0x8811('0x2f')][_0x8811('0x30')]));_0x2d2b88[_0x8811('0x31')]=_0x2d2b88[_0x8811('0x31')][_0x8811('0x32')]?_0x2d2b88['attributes']:_0x317ba3['model'];if(!_0x142523[_0x8811('0x2f')]['hasOwnProperty']('nolimit')){_0x2d2b88[_0x8811('0x1a')]=qs[_0x8811('0x1a')](_0x142523[_0x8811('0x2f')][_0x8811('0x1a')]);_0x2d2b88['offset']=qs['offset'](_0x142523[_0x8811('0x2f')]['offset']);}_0x2d2b88['order']=qs[_0x8811('0x33')](_0x142523['query']['sort']);_0x2d2b88[_0x8811('0x34')]=qs[_0x8811('0x2d')](_[_0x8811('0x35')](_0x142523[_0x8811('0x2f')],_0x317ba3[_0x8811('0x2d')]),_0x39bbc2);if(_0x142523[_0x8811('0x2f')]['filter']){_0x2d2b88[_0x8811('0x34')]=_['merge'](_0x2d2b88['where'],{'$or':_[_0x8811('0x25')](_0x39bbc2,function(_0x5d3cb0){if(_0x5d3cb0['type']!==_0x8811('0x36')){var _0x5339df={};_0x5339df[_0x5d3cb0['name']]={'$like':'%'+_0x142523['query']['filter']+'%'};return _0x5339df;}})});}_0x2d2b88=_['merge']({},_0x2d2b88,_0x142523['options']);var _0x2471c8={'where':_0x2d2b88['where']};return db[_0x8811('0x26')][_0x8811('0x1b')](_0x2471c8)['then'](function(_0x1ec322){_0xaba7ae['count']=_0x1ec322;if(_0x142523[_0x8811('0x2f')][_0x8811('0x37')]){_0x2d2b88[_0x8811('0x38')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8811('0x39')](_0x2d2b88);})[_0x8811('0x20')](function(_0x5b155f){_0xaba7ae[_0x8811('0x3a')]=_0x5b155f;return _0xaba7ae;})[_0x8811('0x20')](respondWithFilteredResult(_0x34f841,_0x2d2b88))['catch'](handleError(_0x34f841,null));};exports[_0x8811('0x3b')]=function(_0x5bbfa3,_0x39c18c){var _0x27d3d4={'raw':![],'where':{'id':_0x5bbfa3[_0x8811('0x3c')]['id']}},_0x362dbd={};_0x362dbd[_0x8811('0x2b')]=_[_0x8811('0x2c')](db[_0x8811('0x26')][_0x8811('0x27')]);_0x362dbd[_0x8811('0x2f')]=_[_0x8811('0x2c')](_0x5bbfa3[_0x8811('0x2f')]);_0x362dbd[_0x8811('0x2d')]=_[_0x8811('0x2e')](_0x362dbd[_0x8811('0x2b')],_0x362dbd[_0x8811('0x2f')]);_0x27d3d4[_0x8811('0x31')]=_[_0x8811('0x2e')](_0x362dbd[_0x8811('0x2b')],qs[_0x8811('0x30')](_0x5bbfa3['query'][_0x8811('0x30')]));_0x27d3d4[_0x8811('0x31')]=_0x27d3d4['attributes'][_0x8811('0x32')]?_0x27d3d4[_0x8811('0x31')]:_0x362dbd[_0x8811('0x2b')];if(_0x5bbfa3[_0x8811('0x2f')][_0x8811('0x37')]){_0x27d3d4[_0x8811('0x38')]=[{'all':!![]}];}_0x27d3d4=_[_0x8811('0x3d')]({},_0x27d3d4,_0x5bbfa3[_0x8811('0x3e')]);return db[_0x8811('0x26')][_0x8811('0x3f')](_0x27d3d4)[_0x8811('0x20')](handleEntityNotFound(_0x39c18c,null))[_0x8811('0x20')](respondWithResult(_0x39c18c,null))[_0x8811('0x40')](handleError(_0x39c18c,null));};exports[_0x8811('0x41')]=function(_0x22a186,_0x26ce44){return db['AnalyticFieldReport']['create'](_0x22a186[_0x8811('0x42')],{})[_0x8811('0x20')](respondWithResult(_0x26ce44,0xc9))[_0x8811('0x40')](handleError(_0x26ce44,null));};exports[_0x8811('0x43')]=function(_0x1891e3,_0x160ca4){return db[_0x8811('0x26')][_0x8811('0x43')](_0x1891e3['body'],{'raw':![],'individualHooks':!![]})[_0x8811('0x20')](respondWithResult(_0x160ca4,0xc9))['catch'](handleError(_0x160ca4,null));};exports[_0x8811('0x1f')]=function(_0x461a07,_0x55798e){if(_0x461a07[_0x8811('0x42')]['id']){delete _0x461a07[_0x8811('0x42')]['id'];}return db[_0x8811('0x26')][_0x8811('0x3f')]({'where':{'id':_0x461a07['params']['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x55798e,null))[_0x8811('0x20')](saveUpdates(_0x461a07[_0x8811('0x42')],null))[_0x8811('0x20')](respondWithResult(_0x55798e,null))[_0x8811('0x40')](handleError(_0x55798e,null));};exports[_0x8811('0x21')]=function(_0xdf0f37,_0x42d6bb){return db[_0x8811('0x26')][_0x8811('0x3f')]({'where':{'id':_0xdf0f37[_0x8811('0x3c')]['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x42d6bb,null))[_0x8811('0x20')](removeEntity(_0x42d6bb,null))[_0x8811('0x40')](handleError(_0x42d6bb,null));};exports[_0x8811('0x44')]=function(_0x33cc36,_0x327024){return db[_0x8811('0x26')]['destroy']({'where':{'id':_0x33cc36['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x327024,0xcc))[_0x8811('0x40')](handleError(_0x327024,null));};exports[_0x8811('0x45')]=function(_0x478f77,_0x5db529,_0x102431){return db[_0x8811('0x46')]['findOne']({'where':{'id':_0x478f77[_0x8811('0x3c')]['id']}})[_0x8811('0x20')](handleEntityNotFound(_0x5db529,null))['then'](function(_0x33f767){if(_0x33f767){return db[_0x8811('0x47')][_0x8811('0x48')](function(_0x5e45d9){return db[_0x8811('0x26')][_0x8811('0x21')]({'where':{'CustomReportId':_0x478f77[_0x8811('0x3c')]['id']},'transaction':_0x5e45d9})[_0x8811('0x20')](function(_0x32b1b1){var _0x305359=_[_0x8811('0x25')](_0x478f77['body'],function(_0x4546e5){delete _0x4546e5['id'];_0x4546e5[_0x8811('0x49')]=_0x478f77[_0x8811('0x3c')]['id'];return _0x4546e5;});return db[_0x8811('0x26')][_0x8811('0x43')](_0x305359,{'transaction':_0x5e45d9});});})[_0x8811('0x20')](function(){return db['AnalyticFieldReport'][_0x8811('0x39')]({'where':{'CustomReportId':_0x478f77[_0x8811('0x3c')]['id']}});});}})['then'](respondWithResult(_0x5db529,null))[_0x8811('0x40')](handleError(_0x5db529,null));}; \ No newline at end of file +var _0xf760=['filter','where','merge','includeAll','include','AnalyticFieldReport','findAll','rows','catch','show','params','options','find','create','bulkCreate','body','destroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xf760,0x1ab));var _0x0f76=function(_0x7cc95d,_0x958a71){_0x7cc95d=_0x7cc95d-0x0;var _0x2d3569=_0xf760[_0x7cc95d];return _0x2d3569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f76('0x0'));var zipdir=require(_0x0f76('0x1'));var jsonpatch=require(_0x0f76('0x2'));var rp=require('request-promise');var moment=require(_0x0f76('0x3'));var BPromise=require(_0x0f76('0x4'));var Mustache=require(_0x0f76('0x5'));var util=require('util');var path=require(_0x0f76('0x6'));var sox=require('sox');var csv=require(_0x0f76('0x7'));var ejs=require(_0x0f76('0x8'));var fs=require('fs');var fs_extra=require(_0x0f76('0x9'));var _=require(_0x0f76('0xa'));var squel=require('squel');var crypto=require(_0x0f76('0xb'));var jsforce=require(_0x0f76('0xc'));var deskjs=require(_0x0f76('0xd'));var toCsv=require(_0x0f76('0x7'));var querystring=require(_0x0f76('0xe'));var Papa=require(_0x0f76('0xf'));var Redis=require(_0x0f76('0x10'));var authService=require(_0x0f76('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0f76('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f76('0x13'))(_0x0f76('0x14'));var utils=require(_0x0f76('0x15'));var config=require(_0x0f76('0x16'));var licenseUtil=require(_0x0f76('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4685f7,_0x485bbe){_0x485bbe=_0x485bbe||0xcc;return function(_0xfa95d0){if(_0xfa95d0){return _0x4685f7[_0x0f76('0x18')](_0x485bbe);}return _0x4685f7[_0x0f76('0x19')](_0x485bbe)['end']();};}function respondWithResult(_0x57e437,_0x4faf56){_0x4faf56=_0x4faf56||0xc8;return function(_0x1c72a0){if(_0x1c72a0){return _0x57e437[_0x0f76('0x19')](_0x4faf56)[_0x0f76('0x1a')](_0x1c72a0);}};}function respondWithFilteredResult(_0x366f75,_0x16c85b){return function(_0x45ece4){if(_0x45ece4){var _0x204ad2=typeof _0x16c85b['offset']===_0x0f76('0x1b')&&typeof _0x16c85b[_0x0f76('0x1c')]===_0x0f76('0x1b');var _0x3ec897=_0x45ece4[_0x0f76('0x1d')];var _0x16b6c1=_0x204ad2?0x0:_0x16c85b[_0x0f76('0x1e')];var _0x464803=_0x204ad2?_0x45ece4[_0x0f76('0x1d')]:_0x16c85b[_0x0f76('0x1e')]+_0x16c85b[_0x0f76('0x1c')];var _0x13f29a;if(_0x464803>=_0x3ec897){_0x464803=_0x3ec897;_0x13f29a=0xc8;}else{_0x13f29a=0xce;}_0x366f75[_0x0f76('0x19')](_0x13f29a);return _0x366f75['set'](_0x0f76('0x1f'),_0x16b6c1+'-'+_0x464803+'/'+_0x3ec897)[_0x0f76('0x1a')](_0x45ece4);}return null;};}function patchUpdates(_0x487162){return function(_0xb361e8){try{jsonpatch[_0x0f76('0x20')](_0xb361e8,_0x487162,!![]);}catch(_0x198123){return BPromise[_0x0f76('0x21')](_0x198123);}return _0xb361e8[_0x0f76('0x22')]();};}function saveUpdates(_0x284c5b,_0x34e73e){return function(_0x1d533e){if(_0x1d533e){return _0x1d533e[_0x0f76('0x23')](_0x284c5b)[_0x0f76('0x24')](function(_0xd9eb98){return _0xd9eb98;});}return null;};}function removeEntity(_0x10db05,_0x45a67e){return function(_0x5124b2){if(_0x5124b2){return _0x5124b2['destroy']()['then'](function(){_0x10db05[_0x0f76('0x19')](0xcc)[_0x0f76('0x25')]();});}};}function handleEntityNotFound(_0x10ebd0,_0x56b61c){return function(_0x3aef81){if(!_0x3aef81){_0x10ebd0[_0x0f76('0x18')](0x194);}return _0x3aef81;};}function handleError(_0xebe2ac,_0x117600){_0x117600=_0x117600||0x1f4;return function(_0x5d2f5c){logger[_0x0f76('0x26')](_0x5d2f5c[_0x0f76('0x27')]);if(_0x5d2f5c[_0x0f76('0x28')]){delete _0x5d2f5c[_0x0f76('0x28')];}_0xebe2ac[_0x0f76('0x19')](_0x117600)[_0x0f76('0x29')](_0x5d2f5c);};}exports['index']=function(_0x2a5f90,_0x1a4ac3){var _0x40f30d={},_0x373834={},_0x4df851={'count':0x0,'rows':[]};var _0x4ab9f6=_['map'](db['AnalyticFieldReport'][_0x0f76('0x2a')],function(_0x4f6ce4){return{'name':_0x4f6ce4['fieldName'],'type':_0x4f6ce4[_0x0f76('0x2b')][_0x0f76('0x2c')]};});_0x373834[_0x0f76('0x2d')]=_[_0x0f76('0x2e')](_0x4ab9f6,'name');_0x373834[_0x0f76('0x2f')]=_[_0x0f76('0x30')](_0x2a5f90[_0x0f76('0x2f')]);_0x373834[_0x0f76('0x31')]=_[_0x0f76('0x32')](_0x373834[_0x0f76('0x2d')],_0x373834['query']);_0x40f30d[_0x0f76('0x33')]=_[_0x0f76('0x32')](_0x373834[_0x0f76('0x2d')],qs[_0x0f76('0x34')](_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x34')]));_0x40f30d[_0x0f76('0x33')]=_0x40f30d['attributes'][_0x0f76('0x35')]?_0x40f30d['attributes']:_0x373834['model'];if(!_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x36')](_0x0f76('0x37'))){_0x40f30d[_0x0f76('0x1c')]=qs[_0x0f76('0x1c')](_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x1c')]);_0x40f30d[_0x0f76('0x1e')]=qs[_0x0f76('0x1e')](_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x1e')]);}_0x40f30d[_0x0f76('0x38')]=qs['sort'](_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x39')]);_0x40f30d['where']=qs[_0x0f76('0x31')](_[_0x0f76('0x3a')](_0x2a5f90[_0x0f76('0x2f')],_0x373834[_0x0f76('0x31')]),_0x4ab9f6);if(_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x3b')]){_0x40f30d[_0x0f76('0x3c')]=_[_0x0f76('0x3d')](_0x40f30d['where'],{'$or':_['map'](_0x4ab9f6,function(_0x1e0175){if(_0x1e0175['type']!=='VIRTUAL'){var _0x26630d={};_0x26630d[_0x1e0175[_0x0f76('0x28')]]={'$like':'%'+_0x2a5f90[_0x0f76('0x2f')]['filter']+'%'};return _0x26630d;}})});}_0x40f30d=_['merge']({},_0x40f30d,_0x2a5f90['options']);var _0x2cf3df={'where':_0x40f30d[_0x0f76('0x3c')]};return db['AnalyticFieldReport'][_0x0f76('0x1d')](_0x2cf3df)[_0x0f76('0x24')](function(_0x4fc533){_0x4df851[_0x0f76('0x1d')]=_0x4fc533;if(_0x2a5f90[_0x0f76('0x2f')][_0x0f76('0x3e')]){_0x40f30d[_0x0f76('0x3f')]=[{'all':!![]}];}return db[_0x0f76('0x40')][_0x0f76('0x41')](_0x40f30d);})[_0x0f76('0x24')](function(_0xe84af2){_0x4df851[_0x0f76('0x42')]=_0xe84af2;return _0x4df851;})[_0x0f76('0x24')](respondWithFilteredResult(_0x1a4ac3,_0x40f30d))[_0x0f76('0x43')](handleError(_0x1a4ac3,null));};exports[_0x0f76('0x44')]=function(_0xd54ce6,_0x27bbab){var _0x440550={'raw':![],'where':{'id':_0xd54ce6[_0x0f76('0x45')]['id']}},_0x4053d6={};_0x4053d6['model']=_[_0x0f76('0x30')](db[_0x0f76('0x40')][_0x0f76('0x2a')]);_0x4053d6[_0x0f76('0x2f')]=_['keys'](_0xd54ce6[_0x0f76('0x2f')]);_0x4053d6[_0x0f76('0x31')]=_[_0x0f76('0x32')](_0x4053d6[_0x0f76('0x2d')],_0x4053d6[_0x0f76('0x2f')]);_0x440550[_0x0f76('0x33')]=_[_0x0f76('0x32')](_0x4053d6[_0x0f76('0x2d')],qs['fields'](_0xd54ce6[_0x0f76('0x2f')][_0x0f76('0x34')]));_0x440550[_0x0f76('0x33')]=_0x440550[_0x0f76('0x33')][_0x0f76('0x35')]?_0x440550[_0x0f76('0x33')]:_0x4053d6[_0x0f76('0x2d')];if(_0xd54ce6[_0x0f76('0x2f')][_0x0f76('0x3e')]){_0x440550['include']=[{'all':!![]}];}_0x440550=_[_0x0f76('0x3d')]({},_0x440550,_0xd54ce6[_0x0f76('0x46')]);return db['AnalyticFieldReport'][_0x0f76('0x47')](_0x440550)[_0x0f76('0x24')](handleEntityNotFound(_0x27bbab,null))[_0x0f76('0x24')](respondWithResult(_0x27bbab,null))['catch'](handleError(_0x27bbab,null));};exports['create']=function(_0x29a69b,_0x33ac85){return db[_0x0f76('0x40')][_0x0f76('0x48')](_0x29a69b['body'],{})[_0x0f76('0x24')](respondWithResult(_0x33ac85,0xc9))[_0x0f76('0x43')](handleError(_0x33ac85,null));};exports[_0x0f76('0x49')]=function(_0x3fdb15,_0x2d54a3){return db[_0x0f76('0x40')][_0x0f76('0x49')](_0x3fdb15['body'],{'raw':![],'individualHooks':!![]})[_0x0f76('0x24')](respondWithResult(_0x2d54a3,0xc9))['catch'](handleError(_0x2d54a3,null));};exports['update']=function(_0x297eff,_0x501e94){if(_0x297eff[_0x0f76('0x4a')]['id']){delete _0x297eff[_0x0f76('0x4a')]['id'];}return db[_0x0f76('0x40')]['find']({'where':{'id':_0x297eff[_0x0f76('0x45')]['id']}})[_0x0f76('0x24')](handleEntityNotFound(_0x501e94,null))[_0x0f76('0x24')](saveUpdates(_0x297eff[_0x0f76('0x4a')],null))['then'](respondWithResult(_0x501e94,null))[_0x0f76('0x43')](handleError(_0x501e94,null));};exports[_0x0f76('0x4b')]=function(_0x4b8db0,_0x4a3737){return db[_0x0f76('0x40')][_0x0f76('0x47')]({'where':{'id':_0x4b8db0['params']['id']}})[_0x0f76('0x24')](handleEntityNotFound(_0x4a3737,null))[_0x0f76('0x24')](removeEntity(_0x4a3737,null))[_0x0f76('0x43')](handleError(_0x4a3737,null));};exports['bulkDestroy']=function(_0x5d8b20,_0x451d88){return db[_0x0f76('0x40')]['destroy']({'where':{'id':_0x5d8b20[_0x0f76('0x2f')][_0x0f76('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x0f76('0x24')](respondWithResult(_0x451d88,0xcc))[_0x0f76('0x43')](handleError(_0x451d88,null));};exports[_0x0f76('0x4d')]=function(_0x31e010,_0x483fda,_0x4e7972){return db[_0x0f76('0x4e')]['findOne']({'where':{'id':_0x31e010['params']['id']}})[_0x0f76('0x24')](handleEntityNotFound(_0x483fda,null))[_0x0f76('0x24')](function(_0xf60380){if(_0xf60380){return db[_0x0f76('0x4f')][_0x0f76('0x50')](function(_0x10d8e0){return db[_0x0f76('0x40')][_0x0f76('0x4b')]({'where':{'CustomReportId':_0x31e010[_0x0f76('0x45')]['id']},'transaction':_0x10d8e0})['then'](function(_0x3390c6){var _0xb223e2=_['map'](_0x31e010[_0x0f76('0x4a')],function(_0xf35268){delete _0xf35268['id'];_0xf35268['CustomReportId']=_0x31e010[_0x0f76('0x45')]['id'];return _0xf35268;});return db[_0x0f76('0x40')][_0x0f76('0x49')](_0xb223e2,{'transaction':_0x10d8e0});});})[_0x0f76('0x24')](function(){return db[_0x0f76('0x40')][_0x0f76('0x41')]({'where':{'CustomReportId':_0x31e010[_0x0f76('0x45')]['id']}});});}})['then'](respondWithResult(_0x483fda,null))['catch'](handleError(_0x483fda,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 595aa20..60b550b 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 _0x6e95=['bluebird','exports','define','analytics_report_fields','moment'];(function(_0x23ba5f,_0x48e0d4){var _0x280358=function(_0x4cac5a){while(--_0x4cac5a){_0x23ba5f['push'](_0x23ba5f['shift']());}};_0x280358(++_0x48e0d4);}(_0x6e95,0x158));var _0x56e9=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x6e95[_0x967959];return _0x5c4489;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56e9('0x0'));var BPromise=require(_0x56e9('0x1'));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('./analyticFieldReport.attributes');module[_0x56e9('0x2')]=function(_0x3099c3,_0x1a3d55){return _0x3099c3[_0x56e9('0x3')]('AnalyticFieldReport',attributes,{'tableName':_0x56e9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x620b=['request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','bluebird'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x620b,0xfb));var _0xb620=function(_0xbed95,_0x1deefd){_0xbed95=_0xbed95-0x0;var _0x20b697=_0x620b[_0xbed95];return _0x20b697;};'use strict';var _=require('lodash');var util=require(_0xb620('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb620('0x1'));var rp=require(_0xb620('0x2'));var fs=require('fs');var path=require(_0xb620('0x3'));var rimraf=require(_0xb620('0x4'));var config=require(_0xb620('0x5'));var attributes=require(_0xb620('0x6'));module[_0xb620('0x7')]=function(_0x51f6da,_0x4c47a9){return _0x51f6da[_0xb620('0x8')](_0xb620('0x9'),attributes,{'tableName':_0xb620('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c1d11c0..7d266eb 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 _0xcfa0=['ioredis','../../config/logger','rpc','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4cb7b1,_0x42bc9f){var _0x3b5fce=function(_0x3cab27){while(--_0x3cab27){_0x4cb7b1['push'](_0x4cb7b1['shift']());}};_0x3b5fce(++_0x42bc9f);}(_0xcfa0,0x150));var _0x0cfa=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xcfa0[_0x53f1ee];return _0x3638da;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cfa('0x0'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cfa('0x1'))(_0x0cfa('0x2'));var config=require('../../config/environment');var jayson=require(_0x0cfa('0x3'));var client=jayson[_0x0cfa('0x4')][_0x0cfa('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x36cf54,_0xd60f26,_0x4ff849){return new BPromise(function(_0x46673c,_0x2ce43a){return client['request'](_0x36cf54,_0x4ff849)['then'](function(_0x6ad738){logger[_0x0cfa('0x6')](_0x0cfa('0x7'),_0xd60f26,'request\x20sent');logger[_0x0cfa('0x8')](_0x0cfa('0x9'),_0xd60f26,_0x0cfa('0xa'),JSON[_0x0cfa('0xb')](_0x6ad738));if(_0x6ad738[_0x0cfa('0xc')]){if(_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xd')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xd60f26,_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xe')]);return _0x2ce43a(_0x6ad738[_0x0cfa('0xc')][_0x0cfa('0xe')]);}logger[_0x0cfa('0xc')](_0x0cfa('0x7'),_0xd60f26,_0x6ad738[_0x0cfa('0xc')]['message']);return _0x46673c(_0x6ad738['error'][_0x0cfa('0xe')]);}else{logger[_0x0cfa('0x6')](_0x0cfa('0x7'),_0xd60f26,_0x0cfa('0xa'));_0x46673c(_0x6ad738[_0x0cfa('0xf')][_0x0cfa('0xe')]);}})['catch'](function(_0x3f3b9b){logger[_0x0cfa('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd60f26,_0x3f3b9b);_0x2ce43a(_0x3f3b9b);});});} \ No newline at end of file +var _0x0a9b=['stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x2b93c3,_0x4077ad){var _0x426b49=function(_0x581c8b){while(--_0x581c8b){_0x2b93c3['push'](_0x2b93c3['shift']());}};_0x426b49(++_0x4077ad);}(_0x0a9b,0x1d3));var _0xb0a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a9b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb0a9('0x0'));var util=require(_0xb0a9('0x1'));var moment=require(_0xb0a9('0x2'));var BPromise=require(_0xb0a9('0x3'));var rs=require(_0xb0a9('0x4'));var fs=require('fs');var Redis=require(_0xb0a9('0x5'));var db=require(_0xb0a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0a9('0x7'))(_0xb0a9('0x8'));var config=require(_0xb0a9('0x9'));var jayson=require(_0xb0a9('0xa'));var client=jayson['client'][_0xb0a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4af147,_0x510017,_0x229694){return new BPromise(function(_0x496233,_0x25ee08){return client[_0xb0a9('0xc')](_0x4af147,_0x229694)['then'](function(_0x43b2d1){logger[_0xb0a9('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x510017,_0xb0a9('0xe'));logger[_0xb0a9('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x510017,_0xb0a9('0xe'),JSON[_0xb0a9('0x10')](_0x43b2d1));if(_0x43b2d1['error']){if(_0x43b2d1[_0xb0a9('0x11')][_0xb0a9('0x12')]===0x1f4){logger[_0xb0a9('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x510017,_0x43b2d1[_0xb0a9('0x11')][_0xb0a9('0x13')]);return _0x25ee08(_0x43b2d1['error'][_0xb0a9('0x13')]);}logger[_0xb0a9('0x11')](_0xb0a9('0x14'),_0x510017,_0x43b2d1[_0xb0a9('0x11')][_0xb0a9('0x13')]);return _0x496233(_0x43b2d1[_0xb0a9('0x11')][_0xb0a9('0x13')]);}else{logger['info'](_0xb0a9('0x14'),_0x510017,_0xb0a9('0xe'));_0x496233(_0x43b2d1[_0xb0a9('0x15')][_0xb0a9('0x13')]);}})[_0xb0a9('0x16')](function(_0x21ec88){logger['error'](_0xb0a9('0x14'),_0x510017,_0x21ec88);_0x25ee08(_0x21ec88);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8ea43ad..bcd3913 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x3d57dd,_0x263837){var _0x1719e7=function(_0x3271f2){while(--_0x3271f2){_0x3d57dd['push'](_0x3d57dd['shift']());}};_0x1719e7(++_0x263837);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x33157f,_0x11827e){var _0x19264e=function(_0x90385f){while(--_0x90385f){_0x33157f['push'](_0x33157f['shift']());}};_0x19264e(++_0x11827e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 841269f..f29bef1 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 _0x122a=['STRING','name','sequelize','exports'];(function(_0x5b0df2,_0x30877c){var _0x3ec6ae=function(_0x106234){while(--_0x106234){_0x5b0df2['push'](_0x5b0df2['shift']());}};_0x3ec6ae(++_0x30877c);}(_0x122a,0xba));var _0xa122=function(_0xce1a3,_0x3bc785){_0xce1a3=_0xce1a3-0x0;var _0x487cca=_0x122a[_0xce1a3];return _0x487cca;};'use strict';var Sequelize=require(_0xa122('0x0'));module[_0xa122('0x1')]={'name':{'type':Sequelize[_0xa122('0x2')],'allowNull':![],'unique':_0xa122('0x3')},'table':{'type':Sequelize[_0xa122('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85d3=['sequelize','exports','STRING','TEXT'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x85d3,0xc8));var _0x385d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x85d3[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x385d('0x0'));module[_0x385d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x385d('0x2')]},'metric':{'type':Sequelize[_0x385d('0x3')]},'description':{'type':Sequelize[_0x385d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9622883..ef468cd 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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'];(function(_0x54aa8f,_0xa74c2a){var _0x14d0c8=function(_0x184152){while(--_0x184152){_0x54aa8f['push'](_0x54aa8f['shift']());}};_0x14d0c8(++_0xa74c2a);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4bbe43,_0x1d6970){var _0x23d12d=function(_0x209c89){while(--_0x209c89){_0x4bbe43['push'](_0x4bbe43['shift']());}};_0x23d12d(++_0x1d6970);}(_0xdc97,0x13b));var _0x7dc9=function(_0x11ce14,_0x63b980){_0x11ce14=_0x11ce14-0x0;var _0x1a9497=_0xdc97[_0x11ce14];return _0x1a9497;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 593286e..4c180f4 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 _0xa13d=['lodash','../../config/logger','api','bluebird','path','rimraf','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x1b01f6,_0x57d583){var _0x1f67af=function(_0x1838e2){while(--_0x1838e2){_0x1b01f6['push'](_0x1b01f6['shift']());}};_0x1f67af(++_0x57d583);}(_0xa13d,0x154));var _0xda13=function(_0x27a03c,_0x193b87){_0x27a03c=_0x27a03c-0x0;var _0x180b3d=_0xa13d[_0x27a03c];return _0x180b3d;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var logger=require(_0xda13('0x1'))(_0xda13('0x2'));var moment=require('moment');var BPromise=require(_0xda13('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda13('0x4'));var rimraf=require(_0xda13('0x5'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xda13('0x6')]=function(_0x3d5a0e,_0x4df317){return _0x3d5a0e[_0xda13('0x7')](_0xda13('0x8'),attributes,{'tableName':_0xda13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018c=['../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x590aa0,_0x3a72f9){var _0x3022ae=function(_0x3e248e){while(--_0x3e248e){_0x590aa0['push'](_0x590aa0['shift']());}};_0x3022ae(++_0x3a72f9);}(_0x018c,0xda));var _0xc018=function(_0xd3bf4d,_0x1bf0ab){_0xd3bf4d=_0xd3bf4d-0x0;var _0x348d09=_0x018c[_0xd3bf4d];return _0x348d09;};'use strict';var _=require(_0xc018('0x0'));var util=require(_0xc018('0x1'));var logger=require(_0xc018('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc018('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc018('0x4'));var rimraf=require(_0xc018('0x5'));var config=require(_0xc018('0x6'));var attributes=require(_0xc018('0x7'));module['exports']=function(_0x3785b0,_0x26e41a){return _0x3785b0[_0xc018('0x8')](_0xc018('0x9'),attributes,{'tableName':_0xc018('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2e69f7b..471057d 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 _0x994c=['../../config/logger','jayson/promise','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','../../mysqldb','../../config/utils'];(function(_0x21a173,_0x1f6b9a){var _0x244d96=function(_0x2aea9f){while(--_0x2aea9f){_0x21a173['push'](_0x21a173['shift']());}};_0x244d96(++_0x1f6b9a);}(_0x994c,0x1a6));var _0xc994=function(_0x46867e,_0x90e3a2){_0x46867e=_0x46867e-0x0;var _0x19ff44=_0x994c[_0x46867e];return _0x19ff44;};'use strict';var _=require(_0xc994('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc994('0x1'))['db'];var utils=require(_0xc994('0x2'));var logger=require(_0xc994('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc994('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43ee1c,_0x187ff1,_0xc826a6){return new BPromise(function(_0x33fdae,_0xfa7652){return client['request'](_0x43ee1c,_0xc826a6)[_0xc994('0x5')](function(_0x546f25){logger[_0xc994('0x6')]('AnalyticMetric,\x20%s,\x20%s',_0x187ff1,_0xc994('0x7'));logger[_0xc994('0x8')](_0xc994('0x9'),_0x187ff1,_0xc994('0x7'),JSON[_0xc994('0xa')](_0x546f25));if(_0x546f25['error']){if(_0x546f25[_0xc994('0xb')][_0xc994('0xc')]===0x1f4){logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x546f25[_0xc994('0xb')]['message']);return _0xfa7652(_0x546f25[_0xc994('0xb')][_0xc994('0xe')]);}logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x546f25[_0xc994('0xb')][_0xc994('0xe')]);return _0x33fdae(_0x546f25['error'][_0xc994('0xe')]);}else{logger[_0xc994('0x6')]('AnalyticMetric,\x20%s,\x20%s',_0x187ff1,_0xc994('0x7'));_0x33fdae(_0x546f25[_0xc994('0xf')]['message']);}})[_0xc994('0x10')](function(_0x4aca44){logger[_0xc994('0xb')](_0xc994('0xd'),_0x187ff1,_0x4aca44);_0xfa7652(_0x4aca44);});});} \ No newline at end of file +var _0xd56b=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x631749,_0xd9cf96){var _0x27fca1=function(_0x323bf5){while(--_0x323bf5){_0x631749['push'](_0x631749['shift']());}};_0x27fca1(++_0xd9cf96);}(_0xd56b,0xf6));var _0xbd56=function(_0x47e111,_0x43d53f){_0x47e111=_0x47e111-0x0;var _0x215e2a=_0xd56b[_0x47e111];return _0x215e2a;};'use strict';var _=require(_0xbd56('0x0'));var util=require(_0xbd56('0x1'));var moment=require('moment');var BPromise=require(_0xbd56('0x2'));var rs=require(_0xbd56('0x3'));var fs=require('fs');var Redis=require(_0xbd56('0x4'));var db=require(_0xbd56('0x5'))['db'];var utils=require(_0xbd56('0x6'));var logger=require(_0xbd56('0x7'))('rpc');var config=require(_0xbd56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd56('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157247,_0x4344e7,_0x320697){return new BPromise(function(_0x6d970e,_0x2cbdce){return client[_0xbd56('0xa')](_0x157247,_0x320697)[_0xbd56('0xb')](function(_0x37bf96){logger[_0xbd56('0xc')](_0xbd56('0xd'),_0x4344e7,'request\x20sent');logger['debug'](_0xbd56('0xe'),_0x4344e7,_0xbd56('0xf'),JSON['stringify'](_0x37bf96));if(_0x37bf96[_0xbd56('0x10')]){if(_0x37bf96[_0xbd56('0x10')][_0xbd56('0x11')]===0x1f4){logger[_0xbd56('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4344e7,_0x37bf96['error'][_0xbd56('0x12')]);return _0x2cbdce(_0x37bf96['error']['message']);}logger['error'](_0xbd56('0xd'),_0x4344e7,_0x37bf96['error'][_0xbd56('0x12')]);return _0x6d970e(_0x37bf96[_0xbd56('0x10')][_0xbd56('0x12')]);}else{logger[_0xbd56('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x4344e7,_0xbd56('0xf'));_0x6d970e(_0x37bf96[_0xbd56('0x13')][_0xbd56('0x12')]);}})['catch'](function(_0x55c19f){logger[_0xbd56('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4344e7,_0x55c19f);_0x2cbdce(_0x55c19f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b916082..b29e2ac 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 _0xcd59=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x381332,_0x5a8b6c){var _0x4846e1=function(_0x4c31f8){while(--_0x4c31f8){_0x381332['push'](_0x381332['shift']());}};_0x4846e1(++_0x5a8b6c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xcd59[_0x214266];return _0x568f75;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['show']);router[_0x9cd5('0xe')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0x10')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router[_0x9cd5('0x12')]('/:id',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);module[_0x9cd5('0x14')]=router; \ No newline at end of file +var _0xe314=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x2895c4,_0x51c4fb){var _0x5864aa=function(_0x38b8d2){while(--_0x38b8d2){_0x2895c4['push'](_0x2895c4['shift']());}};_0x5864aa(++_0x51c4fb);}(_0xe314,0x7c));var _0x4e31=function(_0x3bcf4f,_0x507a7b){_0x3bcf4f=_0x3bcf4f-0x0;var _0x26d549=_0xe314[_0x3bcf4f];return _0x26d549;};'use strict';var multer=require('multer');var util=require(_0x4e31('0x0'));var path=require(_0x4e31('0x1'));var timeout=require(_0x4e31('0x2'));var express=require(_0x4e31('0x3'));var router=express[_0x4e31('0x4')]();var fs_extra=require(_0x4e31('0x5'));var auth=require(_0x4e31('0x6'));var interaction=require(_0x4e31('0x7'));var config=require(_0x4e31('0x8'));var controller=require(_0x4e31('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e31('0xa')]);router[_0x4e31('0xb')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0xe')]);router[_0x4e31('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e31('0x10')]);router[_0x4e31('0x11')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller['update']);router[_0x4e31('0x12')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0x13')]);module[_0x4e31('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 170a90f..dd16ef1 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f93=['sequelize','exports','TEXT'];(function(_0x32bf8b,_0x2ac32b){var _0x1e5ef5=function(_0x36acec){while(--_0x36acec){_0x32bf8b['push'](_0x32bf8b['shift']());}};_0x1e5ef5(++_0x2ac32b);}(_0x6f93,0x1ef));var _0x36f9=function(_0x52be16,_0x4be7bf){_0x52be16=_0x52be16-0x0;var _0x56e3ac=_0x6f93[_0x52be16];return _0x56e3ac;};'use strict';var Sequelize=require(_0x36f9('0x0'));module[_0x36f9('0x1')]={'tree':{'type':Sequelize[_0x36f9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb093=['sequelize','exports'];(function(_0x5ec55f,_0x589f0b){var _0x580939=function(_0x135003){while(--_0x135003){_0x5ec55f['push'](_0x5ec55f['shift']());}};_0x580939(++_0x589f0b);}(_0xb093,0xa2));var _0x3b09=function(_0x4ac5c4,_0x31fe47){_0x4ac5c4=_0x4ac5c4-0x0;var _0x3e2698=_0xb093[_0x4ac5c4];return _0x3e2698;};'use strict';var Sequelize=require(_0x3b09('0x0'));module[_0x3b09('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ab3e1d6..02c2b14 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 _0x193d=['findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x481e02,_0x3c99bb){var _0x10445d=function(_0x218071){while(--_0x218071){_0x481e02['push'](_0x481e02['shift']());}};_0x10445d(++_0x3c99bb);}(_0x193d,0xed));var _0xd193=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x193d[_0x55821d];return _0x58ea8a;};'use strict';var emlformat=require(_0xd193('0x0'));var rimraf=require(_0xd193('0x1'));var zipdir=require(_0xd193('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd193('0x3'));var moment=require(_0xd193('0x4'));var BPromise=require(_0xd193('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd193('0x6'));var sox=require(_0xd193('0x7'));var csv=require(_0xd193('0x8'));var ejs=require(_0xd193('0x9'));var fs=require('fs');var fs_extra=require(_0xd193('0xa'));var _=require(_0xd193('0xb'));var squel=require('squel');var crypto=require(_0xd193('0xc'));var jsforce=require(_0xd193('0xd'));var deskjs=require(_0xd193('0xe'));var toCsv=require(_0xd193('0x8'));var querystring=require('querystring');var Papa=require(_0xd193('0xf'));var Redis=require(_0xd193('0x10'));var authService=require(_0xd193('0x11'));var qs=require(_0xd193('0x12'));var as=require(_0xd193('0x13'));var hardwareService=require(_0xd193('0x14'));var logger=require(_0xd193('0x15'))(_0xd193('0x16'));var utils=require('../../config/utils');var config=require(_0xd193('0x17'));var licenseUtil=require(_0xd193('0x18'));var db=require(_0xd193('0x19'))['db'];function respondWithStatusCode(_0x39cee1,_0x297a7a){_0x297a7a=_0x297a7a||0xcc;return function(_0x1708a7){if(_0x1708a7){return _0x39cee1['sendStatus'](_0x297a7a);}return _0x39cee1[_0xd193('0x1a')](_0x297a7a)[_0xd193('0x1b')]();};}function respondWithResult(_0x33b518,_0x5c9135){_0x5c9135=_0x5c9135||0xc8;return function(_0x5970e6){if(_0x5970e6){return _0x33b518[_0xd193('0x1a')](_0x5c9135)[_0xd193('0x1c')](_0x5970e6);}};}function respondWithFilteredResult(_0x58d385,_0x2efe22){return function(_0x2cf664){if(_0x2cf664){var _0x3eecdd=typeof _0x2efe22[_0xd193('0x1d')]===_0xd193('0x1e')&&typeof _0x2efe22[_0xd193('0x1f')]===_0xd193('0x1e');var _0xb2311d=_0x2cf664[_0xd193('0x20')];var _0x5a4ce4=_0x3eecdd?0x0:_0x2efe22[_0xd193('0x1d')];var _0x4cfc0a=_0x3eecdd?_0x2cf664[_0xd193('0x20')]:_0x2efe22[_0xd193('0x1d')]+_0x2efe22['limit'];var _0x276155;if(_0x4cfc0a>=_0xb2311d){_0x4cfc0a=_0xb2311d;_0x276155=0xc8;}else{_0x276155=0xce;}_0x58d385[_0xd193('0x1a')](_0x276155);return _0x58d385[_0xd193('0x21')]('Content-Range',_0x5a4ce4+'-'+_0x4cfc0a+'/'+_0xb2311d)['json'](_0x2cf664);}return null;};}function patchUpdates(_0x3856e7){return function(_0x724308){try{jsonpatch[_0xd193('0x22')](_0x724308,_0x3856e7,!![]);}catch(_0x16071a){return BPromise[_0xd193('0x23')](_0x16071a);}return _0x724308[_0xd193('0x24')]();};}function saveUpdates(_0x528a13,_0x16070c){return function(_0x65a887){if(_0x65a887){return _0x65a887[_0xd193('0x25')](_0x528a13)[_0xd193('0x26')](function(_0x560376){return _0x560376;});}return null;};}function removeEntity(_0x17b746,_0x3b90a4){return function(_0x4ff4de){if(_0x4ff4de){return _0x4ff4de[_0xd193('0x27')]()[_0xd193('0x26')](function(){_0x17b746[_0xd193('0x1a')](0xcc)[_0xd193('0x1b')]();});}};}function handleEntityNotFound(_0x5ac428,_0x121985){return function(_0x530f12){if(!_0x530f12){_0x5ac428['sendStatus'](0x194);}return _0x530f12;};}function handleError(_0x4c7166,_0x42c096){_0x42c096=_0x42c096||0x1f4;return function(_0x5ed7c3){logger[_0xd193('0x28')](_0x5ed7c3['stack']);if(_0x5ed7c3[_0xd193('0x29')]){delete _0x5ed7c3[_0xd193('0x29')];}_0x4c7166[_0xd193('0x1a')](_0x42c096)[_0xd193('0x2a')](_0x5ed7c3);};}exports['index']=function(_0x4d344a,_0x308e84){var _0x4cc4af={},_0x55f16a={},_0x1e0769={'count':0x0,'rows':[]};var _0x46eead=_[_0xd193('0x2b')](db[_0xd193('0x2c')][_0xd193('0x2d')],function(_0xd81afe){return{'name':_0xd81afe[_0xd193('0x2e')],'type':_0xd81afe[_0xd193('0x2f')][_0xd193('0x30')]};});_0x55f16a[_0xd193('0x31')]=_[_0xd193('0x2b')](_0x46eead,_0xd193('0x29'));_0x55f16a[_0xd193('0x32')]=_[_0xd193('0x33')](_0x4d344a[_0xd193('0x32')]);_0x55f16a[_0xd193('0x34')]=_[_0xd193('0x35')](_0x55f16a[_0xd193('0x31')],_0x55f16a[_0xd193('0x32')]);_0x4cc4af[_0xd193('0x36')]=_[_0xd193('0x35')](_0x55f16a[_0xd193('0x31')],qs['fields'](_0x4d344a[_0xd193('0x32')][_0xd193('0x37')]));_0x4cc4af['attributes']=_0x4cc4af[_0xd193('0x36')][_0xd193('0x38')]?_0x4cc4af[_0xd193('0x36')]:_0x55f16a[_0xd193('0x31')];if(!_0x4d344a[_0xd193('0x32')][_0xd193('0x39')](_0xd193('0x3a'))){_0x4cc4af[_0xd193('0x1f')]=qs['limit'](_0x4d344a['query'][_0xd193('0x1f')]);_0x4cc4af['offset']=qs['offset'](_0x4d344a['query'][_0xd193('0x1d')]);}_0x4cc4af[_0xd193('0x3b')]=qs[_0xd193('0x3c')](_0x4d344a[_0xd193('0x32')]['sort']);_0x4cc4af[_0xd193('0x3d')]=qs['filters'](_['pick'](_0x4d344a[_0xd193('0x32')],_0x55f16a[_0xd193('0x34')]),_0x46eead);if(_0x4d344a[_0xd193('0x32')]['filter']){_0x4cc4af[_0xd193('0x3d')]=_[_0xd193('0x3e')](_0x4cc4af['where'],{'$or':_['map'](_0x46eead,function(_0x37fcf0){if(_0x37fcf0['type']!==_0xd193('0x3f')){var _0x1c8f54={};_0x1c8f54[_0x37fcf0[_0xd193('0x29')]]={'$like':'%'+_0x4d344a[_0xd193('0x32')][_0xd193('0x40')]+'%'};return _0x1c8f54;}})});}_0x4cc4af=_[_0xd193('0x3e')]({},_0x4cc4af,_0x4d344a[_0xd193('0x41')]);var _0x2fca26={'where':_0x4cc4af[_0xd193('0x3d')]};return db['AnalyticTreeReport'][_0xd193('0x20')](_0x2fca26)['then'](function(_0x23c6b9){_0x1e0769[_0xd193('0x20')]=_0x23c6b9;if(_0x4d344a['query'][_0xd193('0x42')]){_0x4cc4af['include']=[{'all':!![]}];}return db[_0xd193('0x2c')][_0xd193('0x43')](_0x4cc4af);})[_0xd193('0x26')](function(_0x1773d9){_0x1e0769[_0xd193('0x44')]=_0x1773d9;return _0x1e0769;})[_0xd193('0x26')](respondWithFilteredResult(_0x308e84,_0x4cc4af))[_0xd193('0x45')](handleError(_0x308e84,null));};exports[_0xd193('0x46')]=function(_0x4914df,_0x3b13ab){var _0x110c48={'raw':!![],'where':{'id':_0x4914df[_0xd193('0x47')]['id']}},_0x5cda81={};_0x5cda81[_0xd193('0x31')]=_[_0xd193('0x33')](db['AnalyticTreeReport'][_0xd193('0x2d')]);_0x5cda81['query']=_['keys'](_0x4914df[_0xd193('0x32')]);_0x5cda81[_0xd193('0x34')]=_[_0xd193('0x35')](_0x5cda81['model'],_0x5cda81[_0xd193('0x32')]);_0x110c48[_0xd193('0x36')]=_[_0xd193('0x35')](_0x5cda81[_0xd193('0x31')],qs[_0xd193('0x37')](_0x4914df[_0xd193('0x32')][_0xd193('0x37')]));_0x110c48[_0xd193('0x36')]=_0x110c48['attributes'][_0xd193('0x38')]?_0x110c48['attributes']:_0x5cda81[_0xd193('0x31')];if(_0x4914df[_0xd193('0x32')]['includeAll']){_0x110c48[_0xd193('0x48')]=[{'all':!![]}];}_0x110c48=_['merge']({},_0x110c48,_0x4914df[_0xd193('0x41')]);return db['AnalyticTreeReport'][_0xd193('0x49')](_0x110c48)[_0xd193('0x26')](handleEntityNotFound(_0x3b13ab,null))['then'](respondWithResult(_0x3b13ab,null))[_0xd193('0x45')](handleError(_0x3b13ab,null));};exports[_0xd193('0x4a')]=function(_0x1a46b1,_0xdc9c2f){return db['AnalyticTreeReport'][_0xd193('0x4a')](_0x1a46b1[_0xd193('0x4b')],{})[_0xd193('0x26')](respondWithResult(_0xdc9c2f,0xc9))[_0xd193('0x45')](handleError(_0xdc9c2f,null));};exports[_0xd193('0x25')]=function(_0x20bd64,_0x4c7766){if(_0x20bd64['body']['id']){delete _0x20bd64[_0xd193('0x4b')]['id'];}return db[_0xd193('0x2c')][_0xd193('0x49')]({'where':{'id':_0x20bd64[_0xd193('0x47')]['id']}})[_0xd193('0x26')](handleEntityNotFound(_0x4c7766,null))[_0xd193('0x26')](saveUpdates(_0x20bd64[_0xd193('0x4b')],null))[_0xd193('0x26')](respondWithResult(_0x4c7766,null))['catch'](handleError(_0x4c7766,null));};exports[_0xd193('0x27')]=function(_0x2b4a62,_0x5ade38){return db[_0xd193('0x2c')]['find']({'where':{'id':_0x2b4a62[_0xd193('0x47')]['id']}})[_0xd193('0x26')](handleEntityNotFound(_0x5ade38,null))['then'](removeEntity(_0x5ade38,null))[_0xd193('0x45')](handleError(_0x5ade38,null));}; \ No newline at end of file +var _0xaf16=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x5b1097,_0x3ed62f){var _0x57979c=function(_0x512f68){while(--_0x512f68){_0x5b1097['push'](_0x5b1097['shift']());}};_0x57979c(++_0x3ed62f);}(_0xaf16,0x1b1));var _0x6af1=function(_0x30fdf9,_0x89096d){_0x30fdf9=_0x30fdf9-0x0;var _0x3c43bb=_0xaf16[_0x30fdf9];return _0x3c43bb;};'use strict';var emlformat=require(_0x6af1('0x0'));var rimraf=require(_0x6af1('0x1'));var zipdir=require(_0x6af1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6af1('0x3'));var moment=require(_0x6af1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6af1('0x5'));var util=require(_0x6af1('0x6'));var path=require(_0x6af1('0x7'));var sox=require(_0x6af1('0x8'));var csv=require(_0x6af1('0x9'));var ejs=require(_0x6af1('0xa'));var fs=require('fs');var fs_extra=require(_0x6af1('0xb'));var _=require(_0x6af1('0xc'));var squel=require(_0x6af1('0xd'));var crypto=require(_0x6af1('0xe'));var jsforce=require(_0x6af1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6af1('0x9'));var querystring=require(_0x6af1('0x10'));var Papa=require(_0x6af1('0x11'));var Redis=require(_0x6af1('0x12'));var authService=require(_0x6af1('0x13'));var qs=require(_0x6af1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6af1('0x15'));var logger=require(_0x6af1('0x16'))(_0x6af1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6af1('0x18'))['db'];function respondWithStatusCode(_0x1e4ce3,_0x992e92){_0x992e92=_0x992e92||0xcc;return function(_0x3dc11f){if(_0x3dc11f){return _0x1e4ce3[_0x6af1('0x19')](_0x992e92);}return _0x1e4ce3[_0x6af1('0x1a')](_0x992e92)[_0x6af1('0x1b')]();};}function respondWithResult(_0x5ca7e1,_0x174690){_0x174690=_0x174690||0xc8;return function(_0x28e48e){if(_0x28e48e){return _0x5ca7e1[_0x6af1('0x1a')](_0x174690)['json'](_0x28e48e);}};}function respondWithFilteredResult(_0x42ea8f,_0x4f6e23){return function(_0x24da0f){if(_0x24da0f){var _0x2b0078=typeof _0x4f6e23[_0x6af1('0x1c')]===_0x6af1('0x1d')&&typeof _0x4f6e23[_0x6af1('0x1e')]===_0x6af1('0x1d');var _0x1bd6bc=_0x24da0f[_0x6af1('0x1f')];var _0x525ab8=_0x2b0078?0x0:_0x4f6e23[_0x6af1('0x1c')];var _0x2af040=_0x2b0078?_0x24da0f[_0x6af1('0x1f')]:_0x4f6e23[_0x6af1('0x1c')]+_0x4f6e23['limit'];var _0x1ca0ab;if(_0x2af040>=_0x1bd6bc){_0x2af040=_0x1bd6bc;_0x1ca0ab=0xc8;}else{_0x1ca0ab=0xce;}_0x42ea8f[_0x6af1('0x1a')](_0x1ca0ab);return _0x42ea8f[_0x6af1('0x20')](_0x6af1('0x21'),_0x525ab8+'-'+_0x2af040+'/'+_0x1bd6bc)['json'](_0x24da0f);}return null;};}function patchUpdates(_0x1d814e){return function(_0x4beb3a){try{jsonpatch[_0x6af1('0x22')](_0x4beb3a,_0x1d814e,!![]);}catch(_0x1abfce){return BPromise[_0x6af1('0x23')](_0x1abfce);}return _0x4beb3a['save']();};}function saveUpdates(_0x4011c4,_0x1edec5){return function(_0x1c3611){if(_0x1c3611){return _0x1c3611[_0x6af1('0x24')](_0x4011c4)[_0x6af1('0x25')](function(_0x165362){return _0x165362;});}return null;};}function removeEntity(_0xa4f7a8,_0x5b81f4){return function(_0xc46a2d){if(_0xc46a2d){return _0xc46a2d[_0x6af1('0x26')]()[_0x6af1('0x25')](function(){_0xa4f7a8[_0x6af1('0x1a')](0xcc)[_0x6af1('0x1b')]();});}};}function handleEntityNotFound(_0x7b5f5b,_0x13306f){return function(_0x3437ee){if(!_0x3437ee){_0x7b5f5b['sendStatus'](0x194);}return _0x3437ee;};}function handleError(_0x4df345,_0x267443){_0x267443=_0x267443||0x1f4;return function(_0x2ddc85){logger[_0x6af1('0x27')](_0x2ddc85[_0x6af1('0x28')]);if(_0x2ddc85[_0x6af1('0x29')]){delete _0x2ddc85[_0x6af1('0x29')];}_0x4df345[_0x6af1('0x1a')](_0x267443)[_0x6af1('0x2a')](_0x2ddc85);};}exports['index']=function(_0x4bd8a4,_0x3b8bc8){var _0x1f6ec1={},_0xce59eb={},_0x16b3ec={'count':0x0,'rows':[]};var _0x119ed2=_[_0x6af1('0x2b')](db[_0x6af1('0x2c')][_0x6af1('0x2d')],function(_0x53194a){return{'name':_0x53194a[_0x6af1('0x2e')],'type':_0x53194a[_0x6af1('0x2f')][_0x6af1('0x30')]};});_0xce59eb[_0x6af1('0x31')]=_[_0x6af1('0x2b')](_0x119ed2,_0x6af1('0x29'));_0xce59eb['query']=_[_0x6af1('0x32')](_0x4bd8a4['query']);_0xce59eb[_0x6af1('0x33')]=_[_0x6af1('0x34')](_0xce59eb[_0x6af1('0x31')],_0xce59eb[_0x6af1('0x35')]);_0x1f6ec1['attributes']=_['intersection'](_0xce59eb['model'],qs['fields'](_0x4bd8a4[_0x6af1('0x35')][_0x6af1('0x36')]));_0x1f6ec1[_0x6af1('0x37')]=_0x1f6ec1[_0x6af1('0x37')][_0x6af1('0x38')]?_0x1f6ec1['attributes']:_0xce59eb[_0x6af1('0x31')];if(!_0x4bd8a4[_0x6af1('0x35')]['hasOwnProperty'](_0x6af1('0x39'))){_0x1f6ec1[_0x6af1('0x1e')]=qs[_0x6af1('0x1e')](_0x4bd8a4[_0x6af1('0x35')][_0x6af1('0x1e')]);_0x1f6ec1[_0x6af1('0x1c')]=qs[_0x6af1('0x1c')](_0x4bd8a4['query'][_0x6af1('0x1c')]);}_0x1f6ec1[_0x6af1('0x3a')]=qs[_0x6af1('0x3b')](_0x4bd8a4[_0x6af1('0x35')]['sort']);_0x1f6ec1[_0x6af1('0x3c')]=qs[_0x6af1('0x33')](_[_0x6af1('0x3d')](_0x4bd8a4[_0x6af1('0x35')],_0xce59eb[_0x6af1('0x33')]),_0x119ed2);if(_0x4bd8a4[_0x6af1('0x35')][_0x6af1('0x3e')]){_0x1f6ec1['where']=_[_0x6af1('0x3f')](_0x1f6ec1[_0x6af1('0x3c')],{'$or':_[_0x6af1('0x2b')](_0x119ed2,function(_0x26df21){if(_0x26df21['type']!==_0x6af1('0x40')){var _0xd9e92a={};_0xd9e92a[_0x26df21[_0x6af1('0x29')]]={'$like':'%'+_0x4bd8a4[_0x6af1('0x35')][_0x6af1('0x3e')]+'%'};return _0xd9e92a;}})});}_0x1f6ec1=_[_0x6af1('0x3f')]({},_0x1f6ec1,_0x4bd8a4['options']);var _0xb0aef1={'where':_0x1f6ec1[_0x6af1('0x3c')]};return db[_0x6af1('0x2c')]['count'](_0xb0aef1)['then'](function(_0x37809b){_0x16b3ec[_0x6af1('0x1f')]=_0x37809b;if(_0x4bd8a4[_0x6af1('0x35')][_0x6af1('0x41')]){_0x1f6ec1[_0x6af1('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x1f6ec1);})[_0x6af1('0x25')](function(_0xc80213){_0x16b3ec['rows']=_0xc80213;return _0x16b3ec;})[_0x6af1('0x25')](respondWithFilteredResult(_0x3b8bc8,_0x1f6ec1))[_0x6af1('0x43')](handleError(_0x3b8bc8,null));};exports[_0x6af1('0x44')]=function(_0x59b7f8,_0x72b25){var _0x5c93c4={'raw':!![],'where':{'id':_0x59b7f8[_0x6af1('0x45')]['id']}},_0xf515c2={};_0xf515c2['model']=_[_0x6af1('0x32')](db[_0x6af1('0x2c')][_0x6af1('0x2d')]);_0xf515c2[_0x6af1('0x35')]=_[_0x6af1('0x32')](_0x59b7f8[_0x6af1('0x35')]);_0xf515c2[_0x6af1('0x33')]=_[_0x6af1('0x34')](_0xf515c2[_0x6af1('0x31')],_0xf515c2[_0x6af1('0x35')]);_0x5c93c4[_0x6af1('0x37')]=_[_0x6af1('0x34')](_0xf515c2[_0x6af1('0x31')],qs[_0x6af1('0x36')](_0x59b7f8[_0x6af1('0x35')][_0x6af1('0x36')]));_0x5c93c4[_0x6af1('0x37')]=_0x5c93c4[_0x6af1('0x37')]['length']?_0x5c93c4[_0x6af1('0x37')]:_0xf515c2[_0x6af1('0x31')];if(_0x59b7f8[_0x6af1('0x35')]['includeAll']){_0x5c93c4[_0x6af1('0x42')]=[{'all':!![]}];}_0x5c93c4=_[_0x6af1('0x3f')]({},_0x5c93c4,_0x59b7f8[_0x6af1('0x46')]);return db[_0x6af1('0x2c')][_0x6af1('0x47')](_0x5c93c4)[_0x6af1('0x25')](handleEntityNotFound(_0x72b25,null))['then'](respondWithResult(_0x72b25,null))['catch'](handleError(_0x72b25,null));};exports[_0x6af1('0x48')]=function(_0x5f1beb,_0x163ce2){return db['AnalyticTreeReport']['create'](_0x5f1beb['body'],{})[_0x6af1('0x25')](respondWithResult(_0x163ce2,0xc9))[_0x6af1('0x43')](handleError(_0x163ce2,null));};exports[_0x6af1('0x24')]=function(_0x3170de,_0x2fc29b){if(_0x3170de[_0x6af1('0x49')]['id']){delete _0x3170de[_0x6af1('0x49')]['id'];}return db[_0x6af1('0x2c')][_0x6af1('0x47')]({'where':{'id':_0x3170de['params']['id']}})['then'](handleEntityNotFound(_0x2fc29b,null))['then'](saveUpdates(_0x3170de[_0x6af1('0x49')],null))[_0x6af1('0x25')](respondWithResult(_0x2fc29b,null))[_0x6af1('0x43')](handleError(_0x2fc29b,null));};exports[_0x6af1('0x26')]=function(_0x2aee3d,_0x302a5e){return db[_0x6af1('0x2c')][_0x6af1('0x47')]({'where':{'id':_0x2aee3d[_0x6af1('0x45')]['id']}})[_0x6af1('0x25')](handleEntityNotFound(_0x302a5e,null))[_0x6af1('0x25')](removeEntity(_0x302a5e,null))[_0x6af1('0x43')](handleError(_0x302a5e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8a7bff4..3ea13a5 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 _0x0933=['exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./analyticTreeReport.attributes'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0933,0x1b0));var _0x3093=function(_0x5f4c21,_0x38ac14){_0x5f4c21=_0x5f4c21-0x0;var _0x4fc10a=_0x0933[_0x5f4c21];return _0x4fc10a;};'use strict';var _=require(_0x3093('0x0'));var util=require('util');var logger=require(_0x3093('0x1'))(_0x3093('0x2'));var moment=require(_0x3093('0x3'));var BPromise=require(_0x3093('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3093('0x5'));var rimraf=require(_0x3093('0x6'));var config=require('../../config/environment');var attributes=require(_0x3093('0x7'));module[_0x3093('0x8')]=function(_0x406415,_0x2051ab){return _0x406415['define'](_0x3093('0x9'),attributes,{'tableName':_0x3093('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f1=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf4f1,0xb6));var _0x1f4f=function(_0x58abb7,_0x3bbc46){_0x58abb7=_0x58abb7-0x0;var _0x258ba5=_0xf4f1[_0x58abb7];return _0x258ba5;};'use strict';var _=require(_0x1f4f('0x0'));var util=require(_0x1f4f('0x1'));var logger=require(_0x1f4f('0x2'))(_0x1f4f('0x3'));var moment=require('moment');var BPromise=require(_0x1f4f('0x4'));var rp=require(_0x1f4f('0x5'));var fs=require('fs');var path=require(_0x1f4f('0x6'));var rimraf=require(_0x1f4f('0x7'));var config=require(_0x1f4f('0x8'));var attributes=require(_0x1f4f('0x9'));module['exports']=function(_0x5a196f,_0x196c93){return _0x5a196f[_0x1f4f('0xa')](_0x1f4f('0xb'),attributes,{'tableName':_0x1f4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 962f64a..840205b 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1ea520,_0x1a98e9){var _0x58455c=function(_0x48d933){while(--_0x48d933){_0x1ea520['push'](_0x1ea520['shift']());}};_0x58455c(++_0x1a98e9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2b28bb,_0x2b1ca7){var _0x1b4b59=function(_0x51b5de){while(--_0x51b5de){_0x2b28bb['push'](_0x2b28bb['shift']());}};_0x1b4b59(++_0x2b1ca7);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c7268,_0x8eea27){_0x1c7268=_0x1c7268-0x0;var _0x368775=_0x2ef3[_0x1c7268];return _0x368775;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6921870..39f4a88 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 _0x885d=['isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x885d,0xd9));var _0xd885=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x885d[_0x2ca616];return _0x53155f;};'use strict';var multer=require(_0xd885('0x0'));var util=require(_0xd885('0x1'));var path=require(_0xd885('0x2'));var timeout=require(_0xd885('0x3'));var express=require(_0xd885('0x4'));var router=express[_0xd885('0x5')]();var fs_extra=require(_0xd885('0x6'));var auth=require(_0xd885('0x7'));var interaction=require(_0xd885('0x8'));var config=require(_0xd885('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xd885('0xa')]('/',auth[_0xd885('0xb')](),controller[_0xd885('0xc')]);router[_0xd885('0xa')](_0xd885('0xd'),auth['isAuthenticated'](),controller[_0xd885('0xe')]);router['post']('/',auth[_0xd885('0xb')](),controller['create']);router['put'](_0xd885('0xd'),auth[_0xd885('0xb')](),controller[_0xd885('0xf')]);router[_0xd885('0x10')](_0xd885('0xd'),auth[_0xd885('0xb')](),controller[_0xd885('0x11')]);module[_0xd885('0x12')]=router; \ No newline at end of file +var _0xe9a6=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x18b14e,_0x534b38){var _0x237952=function(_0x8878e6){while(--_0x8878e6){_0x18b14e['push'](_0x18b14e['shift']());}};_0x237952(++_0x534b38);}(_0xe9a6,0x102));var _0x6e9a=function(_0x4bec28,_0x86928e){_0x4bec28=_0x4bec28-0x0;var _0x242aec=_0xe9a6[_0x4bec28];return _0x242aec;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require(_0x6e9a('0x1'));var path=require(_0x6e9a('0x2'));var timeout=require(_0x6e9a('0x3'));var express=require('express');var router=express[_0x6e9a('0x4')]();var fs_extra=require(_0x6e9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e9a('0x6'));var config=require(_0x6e9a('0x7'));var controller=require(_0x6e9a('0x8'));router[_0x6e9a('0x9')]('/',auth[_0x6e9a('0xa')](),controller[_0x6e9a('0xb')]);router['get'](_0x6e9a('0xc'),auth[_0x6e9a('0xa')](),controller[_0x6e9a('0xd')]);router[_0x6e9a('0xe')]('/',auth[_0x6e9a('0xa')](),controller[_0x6e9a('0xf')]);router[_0x6e9a('0x10')](_0x6e9a('0xc'),auth[_0x6e9a('0xa')](),controller[_0x6e9a('0x11')]);router[_0x6e9a('0x12')](_0x6e9a('0xc'),auth['isAuthenticated'](),controller[_0x6e9a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f648c62..f4b8f1b 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 _0x03bc=['sequelize','STRING'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x03bc,0xb8));var _0xc03b=function(_0x29cdb8,_0x33a9d6){_0x29cdb8=_0x29cdb8-0x0;var _0x42f164=_0x03bc[_0x29cdb8];return _0x42f164;};'use strict';var Sequelize=require(_0xc03b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc03b('0x1')]},'basename':{'type':Sequelize[_0xc03b('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaced=['sequelize','exports','STRING'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xaced,0x18c));var _0xdace=function(_0x4cb17e,_0x3db434){_0x4cb17e=_0x4cb17e-0x0;var _0x4e97d5=_0xaced[_0x4cb17e];return _0x4e97d5;};'use strict';var Sequelize=require(_0xdace('0x0'));module[_0xdace('0x1')]={'name':{'type':Sequelize[_0xdace('0x2')]},'basename':{'type':Sequelize[_0xdace('0x2')]},'type':{'type':Sequelize[_0xdace('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 544a618..536a139 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 _0x47c5=['findAll','rows','catch','show','params','rawAttributes','find','clone','get','omit','createdAt','updatedAt','body','create','originalname','basename','filename','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','Attachment','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include'];(function(_0x5a0a76,_0x22e7c0){var _0x24affc=function(_0x10335e){while(--_0x10335e){_0x5a0a76['push'](_0x5a0a76['shift']());}};_0x24affc(++_0x22e7c0);}(_0x47c5,0x71));var _0x547c=function(_0x5d6105,_0x1f5ca9){_0x5d6105=_0x5d6105-0x0;var _0x15f36e=_0x47c5[_0x5d6105];return _0x15f36e;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require(_0x547c('0x8'));var sox=require(_0x547c('0x9'));var csv=require(_0x547c('0xa'));var ejs=require(_0x547c('0xb'));var fs=require('fs');var fs_extra=require(_0x547c('0xc'));var _=require(_0x547c('0xd'));var squel=require(_0x547c('0xe'));var crypto=require(_0x547c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x547c('0x10'));var toCsv=require(_0x547c('0xa'));var querystring=require(_0x547c('0x11'));var Papa=require(_0x547c('0x12'));var Redis=require(_0x547c('0x13'));var authService=require(_0x547c('0x14'));var qs=require(_0x547c('0x15'));var as=require(_0x547c('0x16'));var hardwareService=require(_0x547c('0x17'));var logger=require(_0x547c('0x18'))(_0x547c('0x19'));var utils=require('../../config/utils');var config=require(_0x547c('0x1a'));var licenseUtil=require(_0x547c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27160c,_0x3b38fb){_0x3b38fb=_0x3b38fb||0xcc;return function(_0xa97d74){if(_0xa97d74){return _0x27160c[_0x547c('0x1c')](_0x3b38fb);}return _0x27160c[_0x547c('0x1d')](_0x3b38fb)[_0x547c('0x1e')]();};}function respondWithResult(_0x39c9cf,_0x50a4d8){_0x50a4d8=_0x50a4d8||0xc8;return function(_0x1c7480){if(_0x1c7480){return _0x39c9cf[_0x547c('0x1d')](_0x50a4d8)[_0x547c('0x1f')](_0x1c7480);}};}function respondWithFilteredResult(_0x5f4249,_0x49ef03){return function(_0x40f7da){if(_0x40f7da){var _0x5ef3db=typeof _0x49ef03[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x49ef03[_0x547c('0x22')]==='undefined';var _0x27301e=_0x40f7da[_0x547c('0x23')];var _0x3a47d4=_0x5ef3db?0x0:_0x49ef03[_0x547c('0x20')];var _0x3bd5f8=_0x5ef3db?_0x40f7da[_0x547c('0x23')]:_0x49ef03[_0x547c('0x20')]+_0x49ef03[_0x547c('0x22')];var _0x5c744c;if(_0x3bd5f8>=_0x27301e){_0x3bd5f8=_0x27301e;_0x5c744c=0xc8;}else{_0x5c744c=0xce;}_0x5f4249['status'](_0x5c744c);return _0x5f4249['set'](_0x547c('0x24'),_0x3a47d4+'-'+_0x3bd5f8+'/'+_0x27301e)[_0x547c('0x1f')](_0x40f7da);}return null;};}function patchUpdates(_0x745903){return function(_0x1d951b){try{jsonpatch[_0x547c('0x25')](_0x1d951b,_0x745903,!![]);}catch(_0x423370){return BPromise[_0x547c('0x26')](_0x423370);}return _0x1d951b[_0x547c('0x27')]();};}function saveUpdates(_0x42c422,_0x168897){return function(_0xfe3d31){if(_0xfe3d31){return _0xfe3d31[_0x547c('0x28')](_0x42c422)['then'](function(_0x46ae17){return _0x46ae17;});}return null;};}function removeEntity(_0x34c3da,_0x25ee1f){return function(_0xd7f740){if(_0xd7f740){return _0xd7f740[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x34c3da['status'](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x3a1f53,_0x536c9a){return function(_0x2f9331){if(!_0x2f9331){_0x3a1f53[_0x547c('0x1c')](0x194);}return _0x2f9331;};}function handleError(_0x15c1e6,_0x5edc6f){_0x5edc6f=_0x5edc6f||0x1f4;return function(_0x42ce16){logger[_0x547c('0x2b')](_0x42ce16[_0x547c('0x2c')]);if(_0x42ce16[_0x547c('0x2d')]){delete _0x42ce16[_0x547c('0x2d')];}_0x15c1e6['status'](_0x5edc6f)[_0x547c('0x2e')](_0x42ce16);};}exports[_0x547c('0x2f')]=function(_0x325b6a,_0xdcd61){var _0x19e589={},_0x19c883={},_0x10a188={'count':0x0,'rows':[]};var _0x117947=_['map'](db[_0x547c('0x30')]['rawAttributes'],function(_0x1d086a){return{'name':_0x1d086a['fieldName'],'type':_0x1d086a['type']['key']};});_0x19c883[_0x547c('0x31')]=_['map'](_0x117947,_0x547c('0x2d'));_0x19c883['query']=_[_0x547c('0x32')](_0x325b6a[_0x547c('0x33')]);_0x19c883['filters']=_[_0x547c('0x34')](_0x19c883[_0x547c('0x31')],_0x19c883[_0x547c('0x33')]);_0x19e589[_0x547c('0x35')]=_[_0x547c('0x34')](_0x19c883[_0x547c('0x31')],qs[_0x547c('0x36')](_0x325b6a[_0x547c('0x33')][_0x547c('0x36')]));_0x19e589[_0x547c('0x35')]=_0x19e589[_0x547c('0x35')][_0x547c('0x37')]?_0x19e589[_0x547c('0x35')]:_0x19c883[_0x547c('0x31')];if(!_0x325b6a[_0x547c('0x33')]['hasOwnProperty'](_0x547c('0x38'))){_0x19e589[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x325b6a[_0x547c('0x33')][_0x547c('0x22')]);_0x19e589['offset']=qs[_0x547c('0x20')](_0x325b6a[_0x547c('0x33')][_0x547c('0x20')]);}_0x19e589[_0x547c('0x39')]=qs[_0x547c('0x3a')](_0x325b6a[_0x547c('0x33')]['sort']);_0x19e589['where']=qs['filters'](_[_0x547c('0x3b')](_0x325b6a['query'],_0x19c883['filters']),_0x117947);if(_0x325b6a[_0x547c('0x33')][_0x547c('0x3c')]){_0x19e589[_0x547c('0x3d')]=_[_0x547c('0x3e')](_0x19e589[_0x547c('0x3d')],{'$or':_[_0x547c('0x3f')](_0x117947,function(_0x4f323){if(_0x4f323[_0x547c('0x40')]!==_0x547c('0x41')){var _0x37e3cb={};_0x37e3cb[_0x4f323[_0x547c('0x2d')]]={'$like':'%'+_0x325b6a[_0x547c('0x33')][_0x547c('0x3c')]+'%'};return _0x37e3cb;}})});}_0x19e589=_[_0x547c('0x3e')]({},_0x19e589,_0x325b6a[_0x547c('0x42')]);var _0xde4749={'where':_0x19e589[_0x547c('0x3d')]};return db[_0x547c('0x30')][_0x547c('0x23')](_0xde4749)['then'](function(_0x3059b1){_0x10a188[_0x547c('0x23')]=_0x3059b1;if(_0x325b6a[_0x547c('0x33')][_0x547c('0x43')]){_0x19e589[_0x547c('0x44')]=[{'all':!![]}];}return db[_0x547c('0x30')][_0x547c('0x45')](_0x19e589);})[_0x547c('0x2a')](function(_0x85e4e0){_0x10a188[_0x547c('0x46')]=_0x85e4e0;return _0x10a188;})[_0x547c('0x2a')](respondWithFilteredResult(_0xdcd61,_0x19e589))[_0x547c('0x47')](handleError(_0xdcd61,null));};exports[_0x547c('0x48')]=function(_0x515f6c,_0xdd15e4){var _0x42268f={'raw':!![],'where':{'id':_0x515f6c[_0x547c('0x49')]['id']}},_0x327572={};_0x327572[_0x547c('0x31')]=_[_0x547c('0x32')](db[_0x547c('0x30')][_0x547c('0x4a')]);_0x327572[_0x547c('0x33')]=_['keys'](_0x515f6c[_0x547c('0x33')]);_0x327572['filters']=_['intersection'](_0x327572[_0x547c('0x31')],_0x327572['query']);_0x42268f[_0x547c('0x35')]=_['intersection'](_0x327572[_0x547c('0x31')],qs[_0x547c('0x36')](_0x515f6c[_0x547c('0x33')][_0x547c('0x36')]));_0x42268f[_0x547c('0x35')]=_0x42268f['attributes'][_0x547c('0x37')]?_0x42268f[_0x547c('0x35')]:_0x327572[_0x547c('0x31')];if(_0x515f6c[_0x547c('0x33')][_0x547c('0x43')]){_0x42268f[_0x547c('0x44')]=[{'all':!![]}];}_0x42268f=_[_0x547c('0x3e')]({},_0x42268f,_0x515f6c[_0x547c('0x42')]);return db[_0x547c('0x30')][_0x547c('0x4b')](_0x42268f)[_0x547c('0x2a')](handleEntityNotFound(_0xdd15e4,null))[_0x547c('0x2a')](respondWithResult(_0xdd15e4,null))[_0x547c('0x47')](handleError(_0xdd15e4,null));};exports[_0x547c('0x4c')]=function(_0x371cc7,_0x16871c){var _0x77476e={'where':{'id':_0x371cc7[_0x547c('0x49')]['id']}},_0x582342={};_0x582342[_0x547c('0x31')]=_['keys'](db[_0x547c('0x30')]['rawAttributes']);_0x77476e[_0x547c('0x35')]=_[_0x547c('0x34')](_0x582342[_0x547c('0x31')],qs[_0x547c('0x36')](_0x371cc7['query']['fields']));_0x77476e[_0x547c('0x35')]=_0x77476e[_0x547c('0x35')][_0x547c('0x37')]?_0x77476e[_0x547c('0x35')]:_0x582342[_0x547c('0x31')];if(_0x371cc7[_0x547c('0x33')]['includeAll']){_0x77476e[_0x547c('0x44')]=[{'all':!![]}];}_0x77476e=_['merge']({},_0x77476e,_0x371cc7[_0x547c('0x42')]);return db[_0x547c('0x30')][_0x547c('0x4b')](_0x77476e)[_0x547c('0x2a')](handleEntityNotFound(_0x16871c,null))[_0x547c('0x2a')](function(_0x89bda1){if(_0x89bda1){var _0x530adc=_0x89bda1[_0x547c('0x4d')]({'plain':!![]});_0x530adc=qs[_0x547c('0x4e')](_0x530adc,['id',_0x547c('0x4f'),_0x547c('0x50')]);_0x371cc7[_0x547c('0x51')]=_[_0x547c('0x4e')](_0x371cc7[_0x547c('0x51')],['id',_0x547c('0x4f'),_0x547c('0x50')]);return db[_0x547c('0x30')][_0x547c('0x52')](_[_0x547c('0x3e')](_0x530adc,_0x371cc7[_0x547c('0x51')]),{'include':_0x371cc7[_0x547c('0x33')][_0x547c('0x43')]?[{'all':!![]}]:undefined});}})[_0x547c('0x2a')](respondWithResult(_0x16871c,0xc9))[_0x547c('0x47')](handleError(_0x16871c,null));};exports[_0x547c('0x28')]=function(_0x58d68d,_0x490cc9){if(_0x58d68d[_0x547c('0x51')]['id']){delete _0x58d68d[_0x547c('0x51')]['id'];}return db['Attachment'][_0x547c('0x4b')]({'where':{'id':_0x58d68d[_0x547c('0x49')]['id']}})['then'](handleEntityNotFound(_0x490cc9,null))['then'](saveUpdates(_0x58d68d[_0x547c('0x51')],null))[_0x547c('0x2a')](respondWithResult(_0x490cc9,null))[_0x547c('0x47')](handleError(_0x490cc9,null));};exports['destroy']=function(_0x20bf1a,_0x20e0b3){return db[_0x547c('0x30')][_0x547c('0x4b')]({'where':{'id':_0x20bf1a['params']['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x20e0b3,null))['then'](removeEntity(_0x20e0b3,null))[_0x547c('0x47')](handleError(_0x20e0b3,null));};exports[_0x547c('0x52')]=function(_0x45c5d7,_0x3ee9a3,_0xe0453b){_0x45c5d7[_0x547c('0x51')][_0x547c('0x2d')]=_0x45c5d7['file'][_0x547c('0x53')];_0x45c5d7[_0x547c('0x51')][_0x547c('0x54')]=_0x45c5d7['file'][_0x547c('0x55')];_0x45c5d7[_0x547c('0x51')][_0x547c('0x40')]=_0x45c5d7['file']['mimetype'];return db['Attachment'][_0x547c('0x52')](_0x45c5d7[_0x547c('0x51')])[_0x547c('0x2a')](respondWithResult(_0x3ee9a3,0xc9))['catch'](handleError(_0x3ee9a3,null));};exports[_0x547c('0x56')]=function(_0xb671a1,_0x5aa0e5,_0xc768f){return db[_0x547c('0x30')][_0x547c('0x57')]({'where':{'id':_0xb671a1['params']['id']},'raw':!![]})[_0x547c('0x2a')](handleEntityNotFound(_0x5aa0e5,null))[_0x547c('0x2a')](function(_0x48d0c2){if(_0x48d0c2){var _0x45583d=_0x48d0c2['ChatOfflineMessageId']!==null;var _0x4a9aff=path[_0x547c('0x58')](config[_0x547c('0x59')],_0x547c('0x5a'));if(_0x45583d){_0x4a9aff=path[_0x547c('0x58')](_0x4a9aff,'offline-chat/');}var _0x7681ef=path['join'](_0x4a9aff,_0x48d0c2['basename']);return _0x5aa0e5[_0x547c('0x56')](_0x7681ef);}})[_0x547c('0x47')](handleError(_0x5aa0e5,null));}; \ No newline at end of file +var _0xa841=['include','findAll','rows','catch','show','params','find','clone','get','createdAt','updatedAt','body','omit','create','update','destroy','file','mimetype','findOne','root','server/files/attachments/','join','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','stack','send','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll'];(function(_0x3d8ea6,_0x206d58){var _0x395c96=function(_0x18601d){while(--_0x18601d){_0x3d8ea6['push'](_0x3d8ea6['shift']());}};_0x395c96(++_0x206d58);}(_0xa841,0x11d));var _0x1a84=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa841[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x1a84('0x0'));var rimraf=require(_0x1a84('0x1'));var zipdir=require(_0x1a84('0x2'));var jsonpatch=require(_0x1a84('0x3'));var rp=require(_0x1a84('0x4'));var moment=require(_0x1a84('0x5'));var BPromise=require(_0x1a84('0x6'));var Mustache=require(_0x1a84('0x7'));var util=require(_0x1a84('0x8'));var path=require('path');var sox=require(_0x1a84('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a84('0xa'));var _=require('lodash');var squel=require(_0x1a84('0xb'));var crypto=require(_0x1a84('0xc'));var jsforce=require(_0x1a84('0xd'));var deskjs=require(_0x1a84('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1a84('0xf'));var Papa=require(_0x1a84('0x10'));var Redis=require(_0x1a84('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a84('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a84('0x13'))(_0x1a84('0x14'));var utils=require(_0x1a84('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a84('0x16'));var db=require(_0x1a84('0x17'))['db'];function respondWithStatusCode(_0x4b4aef,_0x1b6fb1){_0x1b6fb1=_0x1b6fb1||0xcc;return function(_0x355cba){if(_0x355cba){return _0x4b4aef[_0x1a84('0x18')](_0x1b6fb1);}return _0x4b4aef['status'](_0x1b6fb1)[_0x1a84('0x19')]();};}function respondWithResult(_0x265fbf,_0x329851){_0x329851=_0x329851||0xc8;return function(_0x224cf5){if(_0x224cf5){return _0x265fbf[_0x1a84('0x1a')](_0x329851)[_0x1a84('0x1b')](_0x224cf5);}};}function respondWithFilteredResult(_0x4d4012,_0x2ef1ca){return function(_0x4ab2ca){if(_0x4ab2ca){var _0x1b703f=typeof _0x2ef1ca['offset']==='undefined'&&typeof _0x2ef1ca[_0x1a84('0x1c')]===_0x1a84('0x1d');var _0x1c25ee=_0x4ab2ca[_0x1a84('0x1e')];var _0x149384=_0x1b703f?0x0:_0x2ef1ca[_0x1a84('0x1f')];var _0xde855b=_0x1b703f?_0x4ab2ca[_0x1a84('0x1e')]:_0x2ef1ca[_0x1a84('0x1f')]+_0x2ef1ca[_0x1a84('0x1c')];var _0x4ca65b;if(_0xde855b>=_0x1c25ee){_0xde855b=_0x1c25ee;_0x4ca65b=0xc8;}else{_0x4ca65b=0xce;}_0x4d4012[_0x1a84('0x1a')](_0x4ca65b);return _0x4d4012[_0x1a84('0x20')](_0x1a84('0x21'),_0x149384+'-'+_0xde855b+'/'+_0x1c25ee)[_0x1a84('0x1b')](_0x4ab2ca);}return null;};}function patchUpdates(_0xb9f205){return function(_0x1b801e){try{jsonpatch[_0x1a84('0x22')](_0x1b801e,_0xb9f205,!![]);}catch(_0x2e291b){return BPromise['reject'](_0x2e291b);}return _0x1b801e[_0x1a84('0x23')]();};}function saveUpdates(_0x3476cb,_0x2ebe2e){return function(_0x2b2aaf){if(_0x2b2aaf){return _0x2b2aaf['update'](_0x3476cb)[_0x1a84('0x24')](function(_0x3d4f20){return _0x3d4f20;});}return null;};}function removeEntity(_0x10a960,_0x4831c0){return function(_0x42a919){if(_0x42a919){return _0x42a919['destroy']()['then'](function(){_0x10a960[_0x1a84('0x1a')](0xcc)[_0x1a84('0x19')]();});}};}function handleEntityNotFound(_0x37b4f0,_0xa1416){return function(_0x44ea9a){if(!_0x44ea9a){_0x37b4f0[_0x1a84('0x18')](0x194);}return _0x44ea9a;};}function handleError(_0x5d31c8,_0x482a6c){_0x482a6c=_0x482a6c||0x1f4;return function(_0x51b156){logger['error'](_0x51b156[_0x1a84('0x25')]);if(_0x51b156['name']){delete _0x51b156['name'];}_0x5d31c8[_0x1a84('0x1a')](_0x482a6c)[_0x1a84('0x26')](_0x51b156);};}exports['index']=function(_0x5ec742,_0x5b280e){var _0x4d96c9={},_0xcc2da2={},_0x4805e3={'count':0x0,'rows':[]};var _0x233395=_['map'](db['Attachment'][_0x1a84('0x27')],function(_0x2c1f76){return{'name':_0x2c1f76[_0x1a84('0x28')],'type':_0x2c1f76[_0x1a84('0x29')]['key']};});_0xcc2da2[_0x1a84('0x2a')]=_[_0x1a84('0x2b')](_0x233395,_0x1a84('0x2c'));_0xcc2da2[_0x1a84('0x2d')]=_[_0x1a84('0x2e')](_0x5ec742['query']);_0xcc2da2[_0x1a84('0x2f')]=_[_0x1a84('0x30')](_0xcc2da2['model'],_0xcc2da2[_0x1a84('0x2d')]);_0x4d96c9[_0x1a84('0x31')]=_[_0x1a84('0x30')](_0xcc2da2[_0x1a84('0x2a')],qs[_0x1a84('0x32')](_0x5ec742[_0x1a84('0x2d')]['fields']));_0x4d96c9[_0x1a84('0x31')]=_0x4d96c9[_0x1a84('0x31')][_0x1a84('0x33')]?_0x4d96c9[_0x1a84('0x31')]:_0xcc2da2[_0x1a84('0x2a')];if(!_0x5ec742[_0x1a84('0x2d')][_0x1a84('0x34')]('nolimit')){_0x4d96c9[_0x1a84('0x1c')]=qs[_0x1a84('0x1c')](_0x5ec742[_0x1a84('0x2d')][_0x1a84('0x1c')]);_0x4d96c9[_0x1a84('0x1f')]=qs[_0x1a84('0x1f')](_0x5ec742[_0x1a84('0x2d')][_0x1a84('0x1f')]);}_0x4d96c9[_0x1a84('0x35')]=qs[_0x1a84('0x36')](_0x5ec742[_0x1a84('0x2d')][_0x1a84('0x36')]);_0x4d96c9[_0x1a84('0x37')]=qs[_0x1a84('0x2f')](_[_0x1a84('0x38')](_0x5ec742[_0x1a84('0x2d')],_0xcc2da2[_0x1a84('0x2f')]),_0x233395);if(_0x5ec742[_0x1a84('0x2d')][_0x1a84('0x39')]){_0x4d96c9[_0x1a84('0x37')]=_[_0x1a84('0x3a')](_0x4d96c9['where'],{'$or':_[_0x1a84('0x2b')](_0x233395,function(_0x55838e){if(_0x55838e[_0x1a84('0x29')]!==_0x1a84('0x3b')){var _0x2efc0a={};_0x2efc0a[_0x55838e['name']]={'$like':'%'+_0x5ec742['query'][_0x1a84('0x39')]+'%'};return _0x2efc0a;}})});}_0x4d96c9=_[_0x1a84('0x3a')]({},_0x4d96c9,_0x5ec742[_0x1a84('0x3c')]);var _0x259621={'where':_0x4d96c9[_0x1a84('0x37')]};return db[_0x1a84('0x3d')]['count'](_0x259621)[_0x1a84('0x24')](function(_0x38c079){_0x4805e3[_0x1a84('0x1e')]=_0x38c079;if(_0x5ec742['query'][_0x1a84('0x3e')]){_0x4d96c9[_0x1a84('0x3f')]=[{'all':!![]}];}return db[_0x1a84('0x3d')][_0x1a84('0x40')](_0x4d96c9);})['then'](function(_0x5ac8f1){_0x4805e3[_0x1a84('0x41')]=_0x5ac8f1;return _0x4805e3;})[_0x1a84('0x24')](respondWithFilteredResult(_0x5b280e,_0x4d96c9))[_0x1a84('0x42')](handleError(_0x5b280e,null));};exports[_0x1a84('0x43')]=function(_0x3f1d85,_0x29b519){var _0x4ae1a3={'raw':!![],'where':{'id':_0x3f1d85[_0x1a84('0x44')]['id']}},_0x4be049={};_0x4be049[_0x1a84('0x2a')]=_[_0x1a84('0x2e')](db[_0x1a84('0x3d')]['rawAttributes']);_0x4be049[_0x1a84('0x2d')]=_[_0x1a84('0x2e')](_0x3f1d85[_0x1a84('0x2d')]);_0x4be049[_0x1a84('0x2f')]=_['intersection'](_0x4be049[_0x1a84('0x2a')],_0x4be049[_0x1a84('0x2d')]);_0x4ae1a3[_0x1a84('0x31')]=_[_0x1a84('0x30')](_0x4be049['model'],qs[_0x1a84('0x32')](_0x3f1d85[_0x1a84('0x2d')][_0x1a84('0x32')]));_0x4ae1a3[_0x1a84('0x31')]=_0x4ae1a3['attributes'][_0x1a84('0x33')]?_0x4ae1a3[_0x1a84('0x31')]:_0x4be049[_0x1a84('0x2a')];if(_0x3f1d85[_0x1a84('0x2d')]['includeAll']){_0x4ae1a3[_0x1a84('0x3f')]=[{'all':!![]}];}_0x4ae1a3=_[_0x1a84('0x3a')]({},_0x4ae1a3,_0x3f1d85['options']);return db[_0x1a84('0x3d')][_0x1a84('0x45')](_0x4ae1a3)[_0x1a84('0x24')](handleEntityNotFound(_0x29b519,null))[_0x1a84('0x24')](respondWithResult(_0x29b519,null))[_0x1a84('0x42')](handleError(_0x29b519,null));};exports[_0x1a84('0x46')]=function(_0x5f4900,_0x1b12c3){var _0x4c8552={'where':{'id':_0x5f4900[_0x1a84('0x44')]['id']}},_0x103879={};_0x103879[_0x1a84('0x2a')]=_[_0x1a84('0x2e')](db['Attachment'][_0x1a84('0x27')]);_0x4c8552[_0x1a84('0x31')]=_[_0x1a84('0x30')](_0x103879[_0x1a84('0x2a')],qs[_0x1a84('0x32')](_0x5f4900[_0x1a84('0x2d')][_0x1a84('0x32')]));_0x4c8552['attributes']=_0x4c8552['attributes'][_0x1a84('0x33')]?_0x4c8552['attributes']:_0x103879[_0x1a84('0x2a')];if(_0x5f4900[_0x1a84('0x2d')][_0x1a84('0x3e')]){_0x4c8552[_0x1a84('0x3f')]=[{'all':!![]}];}_0x4c8552=_['merge']({},_0x4c8552,_0x5f4900[_0x1a84('0x3c')]);return db['Attachment'][_0x1a84('0x45')](_0x4c8552)['then'](handleEntityNotFound(_0x1b12c3,null))[_0x1a84('0x24')](function(_0x205709){if(_0x205709){var _0xb7caf3=_0x205709[_0x1a84('0x47')]({'plain':!![]});_0xb7caf3=qs['omit'](_0xb7caf3,['id',_0x1a84('0x48'),_0x1a84('0x49')]);_0x5f4900[_0x1a84('0x4a')]=_[_0x1a84('0x4b')](_0x5f4900['body'],['id',_0x1a84('0x48'),_0x1a84('0x49')]);return db[_0x1a84('0x3d')][_0x1a84('0x4c')](_['merge'](_0xb7caf3,_0x5f4900[_0x1a84('0x4a')]),{'include':_0x5f4900[_0x1a84('0x2d')][_0x1a84('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1b12c3,0xc9))['catch'](handleError(_0x1b12c3,null));};exports[_0x1a84('0x4d')]=function(_0x4c3343,_0x396726){if(_0x4c3343['body']['id']){delete _0x4c3343[_0x1a84('0x4a')]['id'];}return db[_0x1a84('0x3d')][_0x1a84('0x45')]({'where':{'id':_0x4c3343[_0x1a84('0x44')]['id']}})[_0x1a84('0x24')](handleEntityNotFound(_0x396726,null))['then'](saveUpdates(_0x4c3343[_0x1a84('0x4a')],null))[_0x1a84('0x24')](respondWithResult(_0x396726,null))[_0x1a84('0x42')](handleError(_0x396726,null));};exports[_0x1a84('0x4e')]=function(_0x3ffceb,_0x10ee9e){return db[_0x1a84('0x3d')][_0x1a84('0x45')]({'where':{'id':_0x3ffceb[_0x1a84('0x44')]['id']}})['then'](handleEntityNotFound(_0x10ee9e,null))[_0x1a84('0x24')](removeEntity(_0x10ee9e,null))[_0x1a84('0x42')](handleError(_0x10ee9e,null));};exports[_0x1a84('0x4c')]=function(_0x2f9759,_0x2a89b1,_0x47e850){_0x2f9759[_0x1a84('0x4a')][_0x1a84('0x2c')]=_0x2f9759['file']['originalname'];_0x2f9759[_0x1a84('0x4a')]['basename']=_0x2f9759[_0x1a84('0x4f')]['filename'];_0x2f9759[_0x1a84('0x4a')]['type']=_0x2f9759['file'][_0x1a84('0x50')];return db[_0x1a84('0x3d')][_0x1a84('0x4c')](_0x2f9759[_0x1a84('0x4a')])[_0x1a84('0x24')](respondWithResult(_0x2a89b1,0xc9))[_0x1a84('0x42')](handleError(_0x2a89b1,null));};exports['download']=function(_0x4b9e1b,_0x5c4ff7,_0x4ea432){return db[_0x1a84('0x3d')][_0x1a84('0x51')]({'where':{'id':_0x4b9e1b['params']['id']},'raw':!![]})[_0x1a84('0x24')](handleEntityNotFound(_0x5c4ff7,null))['then'](function(_0x44655f){if(_0x44655f){var _0x74981c=_0x44655f['ChatOfflineMessageId']!==null;var _0x4016a8=path['join'](config[_0x1a84('0x52')],_0x1a84('0x53'));if(_0x74981c){_0x4016a8=path[_0x1a84('0x54')](_0x4016a8,'offline-chat/');}var _0x1163d5=path['join'](_0x4016a8,_0x44655f[_0x1a84('0x55')]);return _0x5c4ff7[_0x1a84('0x56')](_0x1163d5);}})[_0x1a84('0x42')](handleError(_0x5c4ff7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 441a4c3..8843638 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 _0x7f37=['attachments','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','Attachment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f37,0x85));var _0x77f3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7f37[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x77f3('0x0'));var util=require('util');var logger=require(_0x77f3('0x1'))('api');var moment=require(_0x77f3('0x2'));var BPromise=require(_0x77f3('0x3'));var rp=require(_0x77f3('0x4'));var fs=require('fs');var path=require(_0x77f3('0x5'));var rimraf=require(_0x77f3('0x6'));var config=require(_0x77f3('0x7'));var attributes=require(_0x77f3('0x8'));module['exports']=function(_0x5909b0,_0x3dd55a){return _0x5909b0['define'](_0x77f3('0x9'),attributes,{'tableName':_0x77f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6480=['bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x1530bb,_0x515427){var _0x334403=function(_0x4f3545){while(--_0x4f3545){_0x1530bb['push'](_0x1530bb['shift']());}};_0x334403(++_0x515427);}(_0x6480,0x1a0));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0648('0x0'));var util=require(_0x0648('0x1'));var logger=require(_0x0648('0x2'))(_0x0648('0x3'));var moment=require('moment');var BPromise=require(_0x0648('0x4'));var rp=require(_0x0648('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0648('0x6'));var config=require(_0x0648('0x7'));var attributes=require(_0x0648('0x8'));module[_0x0648('0x9')]=function(_0x5b0b09,_0x274f33){return _0x5b0b09['define'](_0x0648('0xa'),attributes,{'tableName':_0x0648('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 78e86b0..d03a548 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 _0xa9e0=['message','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x17c419,_0xf103b6){var _0x3cc17d=function(_0x21b5d3){while(--_0x21b5d3){_0x17c419['push'](_0x17c419['shift']());}};_0x3cc17d(++_0xf103b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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['CreateAttachment']=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')]('CreateAttachment',_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 _0x80df=['catch','CreateAttachment','Attachment','create','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});}exports[_0xf80d('0x19')]=function(_0x1d104a){var _0x34b49d=this;return new Promise(function(_0x2ea2c1,_0x7ba89c){return db[_0xf80d('0x1a')][_0xf80d('0x1b')](_0x1d104a['body'],{'raw':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf80d('0xe')](function(_0x539c80){logger[_0xf80d('0xf')](_0xf80d('0x19'),_0x1d104a);logger[_0xf80d('0x12')](_0xf80d('0x19'),_0x1d104a,JSON[_0xf80d('0x14')](_0x539c80));_0x2ea2c1(_0x539c80);})[_0xf80d('0x18')](function(_0x446153){logger[_0xf80d('0x15')](_0xf80d('0x19'),_0x446153[_0xf80d('0x16')],_0x1d104a);_0x7ba89c(_0x34b49d[_0xf80d('0x15')](0x1f4,_0x446153[_0xf80d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6639a49..7686808 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x1e29d6,_0x45fb62){var _0x54beeb=function(_0x35c068){while(--_0x35c068){_0x1e29d6['push'](_0x1e29d6['shift']());}};_0x54beeb(++_0x45fb62);}(_0xb10b,0x12a));var _0xbb10=function(_0x23d0a1,_0x5011a){_0x23d0a1=_0x23d0a1-0x0;var _0x1ef866=_0xb10b[_0x23d0a1];return _0x1ef866;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0xb8c02d,_0x36967e){_0xb8c02d=_0xb8c02d-0x0;var _0x5e4eba=_0xdb28[_0xb8c02d];return _0x5e4eba;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 7655bb6..640de5d 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9ba=['blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','user','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xb9ba,0x136));var _0xab9b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb9ba[_0x122ef9];return _0x42fba0;};'use strict';var passport=require(_0xab9b('0x0'));var LocalStrategy=require(_0xab9b('0x1'))[_0xab9b('0x2')];var moment=require(_0xab9b('0x3'));var ActiveDirectory=require(_0xab9b('0x4'));var BPromise=require(_0xab9b('0x5'));var util=require(_0xab9b('0x6'));var db=require(_0xab9b('0x7'))['db'];var authService=require(_0xab9b('0x8'));var utils=require('../../config/utils');var config=require(_0xab9b('0x9'));var logger=require(_0xab9b('0xa'))(_0xab9b('0xb'));function isActiveDirectoryConfigured(_0x1c6fdc){var _0x4f219b=![];if(typeof _0x1c6fdc[_0xab9b('0xc')]!==_0xab9b('0xd')){_0x4f219b=_0x1c6fdc['activedirectory'][_0xab9b('0xe')]&&_0x1c6fdc[_0xab9b('0xc')][_0xab9b('0xf')]&&_0x1c6fdc[_0xab9b('0xc')][_0xab9b('0x10')];}return _0x4f219b;}function adAuthenticate(_0x581556,_0x18ae69,_0x43c443){return new BPromise(function(_0x193a08,_0x547a8b){try{var _0x230bd3=new ActiveDirectory(_0x581556);_0x230bd3[_0xab9b('0x11')](_0x18ae69,_0x43c443,function(_0x18b4d1,_0x503a48){if(_0x18b4d1){logger[_0xab9b('0x12')](_0xab9b('0x13'),_0x18ae69,util[_0xab9b('0x14')](_0x18b4d1,{'showHidden':![],'depth':null}));_0x547a8b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x503a48){logger['error'](_0xab9b('0x15'),_0x18ae69);_0x547a8b(_0xab9b('0x16'));}else{_0x193a08(_0x503a48);}});}catch(_0x509ffe){_0x547a8b(_0x509ffe);}});}function ActiveDirectoryAuthenticate(_0x4e5792,_0x5129f3,_0x50d95c,_0x13157a){var _0x5b53d9,_0x5d5dad;if(!isActiveDirectoryConfigured(config)){logger[_0xab9b('0x12')](_0xab9b('0x17'),_0x5129f3);return _0x13157a(null,![],{'message':_0xab9b('0x16')});}return db[_0xab9b('0x18')]['findOne']({'where':{'id':0x1},'attributes':[_0xab9b('0x19'),_0xab9b('0x1a')],'raw':!![]})[_0xab9b('0x1b')](function(_0x3aa2ed){_0x5b53d9=_0x3aa2ed;if(!_0x5b53d9['adSsoEnabled']){logger[_0xab9b('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5129f3);throw new Error(_0xab9b('0x16'));}return _0x4e5792['findOne']({'attributes':['id',_0xab9b('0x1c'),_0xab9b('0x1d'),_0xab9b('0x1e'),_0xab9b('0x1f'),_0xab9b('0x20'),_0xab9b('0x21'),_0xab9b('0x22'),_0xab9b('0x23')],'where':{'name':_0x5129f3,'role':{'$or':['admin',_0xab9b('0x24'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x166630){if(!_0x166630||_0x166630&&_0x166630[_0xab9b('0x1c')]!==_0x5129f3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5d5dad=_0x166630;var _0x24b0d7=_0x5d5dad['name']+'@'+config[_0xab9b('0xc')][_0xab9b('0x10')];return adAuthenticate(config[_0xab9b('0xc')],_0x24b0d7,_0x50d95c);})[_0xab9b('0x1b')](function(_0x35b27a){if(_0x5d5dad[_0xab9b('0x20')]){throw new Error(_0xab9b('0x16'));}if(_0x5b53d9[_0xab9b('0x1a')]>0x0){if(_0x5d5dad['blocked']){if(moment(_0x5d5dad[_0xab9b('0x22')])[_0xab9b('0x25')](_0x5b53d9['blockDuration'],_0xab9b('0x26'))>moment()){throw new Error(_0xab9b('0x16'));}return utils[_0xab9b('0x27')](_0x5d5dad,0x0,![],null)['then'](function(){return utils[_0xab9b('0x28')](_0x5d5dad);})[_0xab9b('0x1b')](function(){return _0x13157a(null,_0x5d5dad);});}else{return utils['getLicense'](_0x5d5dad)['then'](function(){return _0x13157a(null,_0x5d5dad);});}}else{return utils['getLicense'](_0x5d5dad)[_0xab9b('0x1b')](function(){return _0x13157a(null,_0x5d5dad);});}})['catch'](function(_0x23e614){return _0x13157a(null,![],_0x23e614);});}function handleError(_0x19e158,_0x2a0f7e,_0x1ea9af){return _0x19e158[_0xab9b('0x29')](_0x2a0f7e||0x1f4)[_0xab9b('0x2a')]({'message':_0x1ea9af?_0x1ea9af[_0xab9b('0x2b')]||_0x1ea9af:''});}exports[_0xab9b('0x2c')]=function(_0x5dd440,_0x2a72ef,_0x4d5db0){passport['authenticate'](_0xab9b('0x2d'),function(_0x497c7b,_0x37d560,_0x45147e){var _0x43c87e=_0x497c7b||_0x45147e;if(_0x43c87e){return handleError(_0x2a72ef,0x191,_0x43c87e);}if(!_0x37d560){return handleError(_0x2a72ef,0x194,{'message':_0xab9b('0x2e')});}else{var _0x416bf4={'payload':{'id':_0x37d560['id'],'role':_0x37d560[_0xab9b('0x1f')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x416bf4)['then'](function(_0x4de8ea){_0x2a72ef['json']({'id':_0x37d560['id'],'token':_0x4de8ea,'statusCall':'','isAlreadyLogged':_0x37d560['online']});});}})(_0x5dd440,_0x2a72ef,_0x4d5db0);};passport['use'](_0xab9b('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0xab9b('0x1d')},function(_0x588c32,_0x5b01c4,_0x3afd4b){return ActiveDirectoryAuthenticate(db[_0xab9b('0x2f')],_0x588c32,_0x5b01c4,_0x3afd4b);})); \ No newline at end of file +var _0x12c7=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blockedAt','admin','user','agent','then','domain','blocked','minutes','clearBlockUser','getLicense','catch','send','message','authenticate','signToken','json','ad-login','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','findOne','adSsoEnabled','blockDuration'];(function(_0x2b4399,_0x297e38){var _0x2adc0a=function(_0x459c1b){while(--_0x459c1b){_0x2b4399['push'](_0x2b4399['shift']());}};_0x2adc0a(++_0x297e38);}(_0x12c7,0x1ee));var _0x712c=function(_0x3c168d,_0x355c44){_0x3c168d=_0x3c168d-0x0;var _0x5c5028=_0x12c7[_0x3c168d];return _0x5c5028;};'use strict';var passport=require(_0x712c('0x0'));var LocalStrategy=require(_0x712c('0x1'))[_0x712c('0x2')];var moment=require(_0x712c('0x3'));var ActiveDirectory=require(_0x712c('0x4'));var BPromise=require(_0x712c('0x5'));var util=require(_0x712c('0x6'));var db=require(_0x712c('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x712c('0x8'));var config=require('../../config/environment');var logger=require(_0x712c('0x9'))(_0x712c('0xa'));function isActiveDirectoryConfigured(_0x40c49b){var _0x1b37fa=![];if(typeof _0x40c49b[_0x712c('0xb')]!==_0x712c('0xc')){_0x1b37fa=_0x40c49b['activedirectory'][_0x712c('0xd')]&&_0x40c49b['activedirectory'][_0x712c('0xe')]&&_0x40c49b[_0x712c('0xb')]['domain'];}return _0x1b37fa;}function adAuthenticate(_0x244064,_0x38addb,_0x3f63e9){return new BPromise(function(_0x572033,_0x33beb5){try{var _0x4e0d5c=new ActiveDirectory(_0x244064);_0x4e0d5c['authenticate'](_0x38addb,_0x3f63e9,function(_0x4b8152,_0x26d9fd){if(_0x4b8152){logger[_0x712c('0xf')](_0x712c('0x10'),_0x38addb,util[_0x712c('0x11')](_0x4b8152,{'showHidden':![],'depth':null}));_0x33beb5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x26d9fd){logger[_0x712c('0xf')](_0x712c('0x12'),_0x38addb);_0x33beb5(_0x712c('0x13'));}else{_0x572033(_0x26d9fd);}});}catch(_0x2b5368){_0x33beb5(_0x2b5368);}});}function ActiveDirectoryAuthenticate(_0x3c4fc4,_0x30b160,_0x37de15,_0x1813c7){var _0x1fd699,_0x2a81e8;if(!isActiveDirectoryConfigured(config)){logger[_0x712c('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x30b160);return _0x1813c7(null,![],{'message':_0x712c('0x13')});}return db['Setting'][_0x712c('0x14')]({'where':{'id':0x1},'attributes':[_0x712c('0x15'),_0x712c('0x16')],'raw':!![]})['then'](function(_0x4ccb2e){_0x1fd699=_0x4ccb2e;if(!_0x1fd699[_0x712c('0x15')]){logger[_0x712c('0xf')](_0x712c('0x17'),_0x30b160);throw new Error(_0x712c('0x13'));}return _0x3c4fc4['findOne']({'attributes':['id',_0x712c('0x18'),'password',_0x712c('0x19'),_0x712c('0x1a'),_0x712c('0x1b'),'blocked',_0x712c('0x1c'),'online'],'where':{'name':_0x30b160,'role':{'$or':[_0x712c('0x1d'),_0x712c('0x1e'),_0x712c('0x1f')]},'adSsoEnabled':!![]}});})[_0x712c('0x20')](function(_0x3a78c8){if(!_0x3a78c8||_0x3a78c8&&_0x3a78c8[_0x712c('0x18')]!==_0x30b160){throw new Error(_0x712c('0x13'));}_0x2a81e8=_0x3a78c8;var _0xfb89a1=_0x2a81e8[_0x712c('0x18')]+'@'+config[_0x712c('0xb')][_0x712c('0x21')];return adAuthenticate(config[_0x712c('0xb')],_0xfb89a1,_0x37de15);})[_0x712c('0x20')](function(_0x273ec0){if(_0x2a81e8[_0x712c('0x1b')]){throw new Error(_0x712c('0x13'));}if(_0x1fd699[_0x712c('0x16')]>0x0){if(_0x2a81e8[_0x712c('0x22')]){if(moment(_0x2a81e8[_0x712c('0x1c')])['add'](_0x1fd699[_0x712c('0x16')],_0x712c('0x23'))>moment()){throw new Error(_0x712c('0x13'));}return utils[_0x712c('0x24')](_0x2a81e8,0x0,![],null)['then'](function(){return utils[_0x712c('0x25')](_0x2a81e8);})['then'](function(){return _0x1813c7(null,_0x2a81e8);});}else{return utils[_0x712c('0x25')](_0x2a81e8)[_0x712c('0x20')](function(){return _0x1813c7(null,_0x2a81e8);});}}else{return utils['getLicense'](_0x2a81e8)[_0x712c('0x20')](function(){return _0x1813c7(null,_0x2a81e8);});}})[_0x712c('0x26')](function(_0x13364a){return _0x1813c7(null,![],_0x13364a);});}function handleError(_0x3bf485,_0x1db933,_0xba4c46){return _0x3bf485['status'](_0x1db933||0x1f4)[_0x712c('0x27')]({'message':_0xba4c46?_0xba4c46[_0x712c('0x28')]||_0xba4c46:''});}exports['login']=function(_0x1e8ac3,_0x536310,_0x230f54){passport[_0x712c('0x29')]('ad-login',function(_0x45ff02,_0x52d5b0,_0x358fad){var _0x442577=_0x45ff02||_0x358fad;if(_0x442577){return handleError(_0x536310,0x191,_0x442577);}if(!_0x52d5b0){return handleError(_0x536310,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3699ca={'payload':{'id':_0x52d5b0['id'],'role':_0x52d5b0[_0x712c('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x712c('0x2a')](_0x3699ca)['then'](function(_0x243f2c){_0x536310[_0x712c('0x2b')]({'id':_0x52d5b0['id'],'token':_0x243f2c,'statusCall':'','isAlreadyLogged':_0x52d5b0['online']});});}})(_0x1e8ac3,_0x536310,_0x230f54);};passport['use'](_0x712c('0x2c'),new LocalStrategy({'usernameField':_0x712c('0x18'),'passwordField':_0x712c('0x2d')},function(_0x5e5a31,_0x3e63dd,_0x55c018){return ActiveDirectoryAuthenticate(db[_0x712c('0x2e')],_0x5e5a31,_0x3e63dd,_0x55c018);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index b8c6626..9687aa9 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a2f=['exports','express','Router','./authActiveDirectory.controller'];(function(_0x46503b,_0x46b001){var _0x1c0789=function(_0x3ed085){while(--_0x3ed085){_0x46503b['push'](_0x46503b['shift']());}};_0x1c0789(++_0x46b001);}(_0x8a2f,0x195));var _0xf8a2=function(_0x3c389f,_0x217b16){_0x3c389f=_0x3c389f-0x0;var _0xff815=_0x8a2f[_0x3c389f];return _0xff815;};'use strict';var express=require(_0xf8a2('0x0'));var router=express[_0xf8a2('0x1')]();var controller=require(_0xf8a2('0x2'));router['post']('/',controller['login']);module[_0xf8a2('0x3')]=router; \ No newline at end of file +var _0x34f7=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x3f49a9,_0x108d68){var _0x56e82f=function(_0x20044a){while(--_0x20044a){_0x3f49a9['push'](_0x3f49a9['shift']());}};_0x56e82f(++_0x108d68);}(_0x34f7,0x1c6));var _0x734f=function(_0x30c00c,_0x1b2469){_0x30c00c=_0x30c00c-0x0;var _0x674a6a=_0x34f7[_0x30c00c];return _0x674a6a;};'use strict';var express=require(_0x734f('0x0'));var router=express[_0x734f('0x1')]();var controller=require(_0x734f('0x2'));router[_0x734f('0x3')]('/',controller[_0x734f('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 51090ce..2c74b3b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7a54,0x106));var _0x47a5=function(_0xe773d3,_0x27bfc7){_0xe773d3=_0xe773d3-0x0;var _0x52a74f=_0x7a54[_0xe773d3];return _0x52a74f;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x241633,_0x38b2a0){var _0x384081=function(_0x59dba1){while(--_0x59dba1){_0x241633['push'](_0x241633['shift']());}};_0x384081(++_0x38b2a0);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5e05e4a..05789d9 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 _0x09eb=['callback','isMiddleware','login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x5996c8,_0x32e9a3){var _0x420c87=function(_0x463b92){while(--_0x463b92){_0x5996c8['push'](_0x5996c8['shift']());}};_0x420c87(++_0x32e9a3);}(_0x09eb,0x1d9));var _0xb09e=function(_0x4e9f29,_0x1bbcbf){_0x4e9f29=_0x4e9f29-0x0;var _0x8e1ab3=_0x09eb[_0x4e9f29];return _0x8e1ab3;};'use strict';var express=require(_0xb09e('0x0'));var passport=require(_0xb09e('0x1'));var router=express['Router']();var controller=require(_0xb09e('0x2'));var userController=require(_0xb09e('0x3'));var authService=require(_0xb09e('0x4'));router[_0xb09e('0x5')]('/',controller['login']);router[_0xb09e('0x5')](_0xb09e('0x6'),controller[_0xb09e('0x7')],authService[_0xb09e('0x8')],userController[_0xb09e('0x9')],authService[_0xb09e('0xa')]);module[_0xb09e('0xb')]=router; \ No newline at end of file +var _0x1541=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie','exports','passport'];(function(_0x4bc204,_0x98dea9){var _0x476062=function(_0x1e13ff){while(--_0x1e13ff){_0x4bc204['push'](_0x4bc204['shift']());}};_0x476062(++_0x98dea9);}(_0x1541,0x1a3));var _0x1154=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x1541[_0x42245d];return _0x4b211a;};'use strict';var express=require('express');var passport=require(_0x1154('0x0'));var router=express['Router']();var controller=require(_0x1154('0x1'));var userController=require(_0x1154('0x2'));var authService=require(_0x1154('0x3'));router['get']('/',controller[_0x1154('0x4')]);router[_0x1154('0x5')](_0x1154('0x6'),controller['callback'],authService[_0x1154('0x7')],userController[_0x1154('0x4')],authService[_0x1154('0x8')]);module[_0x1154('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 08cb945..7306803 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 _0xa137=['Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online'];(function(_0xbaae28,_0x5657f5){var _0x542e54=function(_0x24e247){while(--_0x24e247){_0xbaae28['push'](_0xbaae28['shift']());}};_0x542e54(++_0x5657f5);}(_0xa137,0x111));var _0x7a13=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xa137[_0x34843e];return _0x598f7f;};'use strict';var util=require(_0x7a13('0x0'));var passport=require(_0x7a13('0x1'));var LocalStrategy=require(_0x7a13('0x2'))[_0x7a13('0x3')];var jayson=require(_0x7a13('0x4'));var _=require(_0x7a13('0x5'));var rs=require(_0x7a13('0x6'));var moment=require(_0x7a13('0x7'));var db=require(_0x7a13('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7a13('0x9'));var client=jayson[_0x7a13('0xa')][_0x7a13('0xb')]({'port':0x232b});function localAuthenticate(_0x273027,_0x4ea075,_0x2031ca,_0x50ce51){var _0x5c2453,_0x2aaa00;return db[_0x7a13('0xc')][_0x7a13('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7a13('0xe')],'raw':!![]})[_0x7a13('0xf')](function(_0x221ca7){_0x5c2453=_0x221ca7;return _0x273027[_0x7a13('0xd')]({'attributes':['id',_0x7a13('0x10'),_0x7a13('0x11'),_0x7a13('0x12'),_0x7a13('0x13'),'disabled',_0x7a13('0x14'),_0x7a13('0x15'),'loginAttempts'],'where':{'name':_0x4ea075,'role':{'$or':[_0x7a13('0x16'),_0x7a13('0x17'),'agent']}}});})[_0x7a13('0xf')](function(_0x1e86cb){if(!_0x1e86cb||_0x1e86cb&&_0x1e86cb[_0x7a13('0x10')]!==_0x4ea075){throw new Error(_0x7a13('0x18'));}else{_0x2aaa00=_0x1e86cb;return _0x2aaa00;}})['then'](function(){_0x2aaa00[_0x7a13('0x19')](_0x2031ca,function(_0x499bfb,_0x98974d){var _0x295be2=_0x2aaa00[_0x7a13('0x1a')]+0x1;if(_0x499bfb){return _0x50ce51(_0x499bfb);}else if(!_0x98974d){if(_0x2aaa00[_0x7a13('0x1b')]){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5c2453[_0x7a13('0x1c')]>0x0){if(_0x2aaa00[_0x7a13('0x14')]){if(_0x5c2453[_0x7a13('0xe')]>0x0){if(moment(_0x2aaa00[_0x7a13('0x15')])[_0x7a13('0x1d')](_0x5c2453['blockDuration'],_0x7a13('0x1e'))>moment()){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils['clearBlockUser'](_0x2aaa00,_0x295be2,![],null)[_0x7a13('0xf')](function(){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x295be2>=_0x5c2453[_0x7a13('0x1c')]){return utils[_0x7a13('0x1f')](_0x2aaa00,0x0,!![],moment())['then'](function(){return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x2aaa00,_0x295be2,![],null)[_0x7a13('0xf')](function(){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});});}}}else{return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}}else{if(_0x2aaa00[_0x7a13('0x1b')]){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else if(_0x5c2453[_0x7a13('0x1c')]>0x0){if(_0x2aaa00[_0x7a13('0x14')]){if(_0x5c2453['blockDuration']>0x0){if(moment(_0x2aaa00[_0x7a13('0x15')])[_0x7a13('0x1d')](_0x5c2453[_0x7a13('0xe')],'minutes')>moment()){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils[_0x7a13('0x1f')](_0x2aaa00,0x0,![],null)[_0x7a13('0xf')](function(){return utils['getLicense'](_0x2aaa00);})[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);});}}else{return _0x50ce51(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x2aaa00,0x0,![],null)[_0x7a13('0xf')](function(){return utils[_0x7a13('0x20')](_0x2aaa00);})[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);})[_0x7a13('0x21')](function(_0x58d730){return _0x50ce51(null,![],_0x58d730);});}}else{if(_0x2aaa00[_0x7a13('0x14')]){return _0x50ce51(null,![],{'message':_0x7a13('0x18')});}else{return utils['getLicense'](_0x2aaa00)[_0x7a13('0xf')](function(){return _0x50ce51(null,_0x2aaa00);});}}}});})[_0x7a13('0x21')](function(_0x241704){return _0x50ce51(null,![],_0x241704);});}function sendServiceMail(_0x145662){return db['MailAccount'][_0x7a13('0x22')]({'where':{'service':!![]},'attributes':['id','name',_0x7a13('0x23')],'include':[{'model':db[_0x7a13('0x24')],'as':'Smtp','include':[{'model':db[_0x7a13('0x25')],'as':_0x7a13('0x25')}]}]})[_0x7a13('0xf')](function(_0x2e94fe){if(!_0x2e94fe){throw new Error(_0x7a13('0x26'));}var _0x166e6f=_0x2e94fe[_0x7a13('0x27')]();var _0x8bebf8={'account':_0x166e6f,'message':_[_0x7a13('0x28')]({'from':util[_0x7a13('0x29')](_0x7a13('0x2a'),_0x2e94fe[_0x7a13('0x10')],_0x2e94fe['email']||_0x2e94fe[_0x7a13('0x2b')]['user'])},_0x145662)};return client[_0x7a13('0x2c')](_0x7a13('0x2d'),_0x8bebf8);})[_0x7a13('0xf')](function(_0x214386){if(_0x214386[_0x7a13('0x2e')]){throw new Error(util[_0x7a13('0x29')](_0x7a13('0x2f'),_0x214386[_0x7a13('0x2e')]['message']||JSON['stringify'](_0x214386['error'])));}return!![];});}function handleError(_0x5046c6,_0x27a7d5,_0x426ea6){return _0x5046c6[_0x7a13('0x30')](_0x27a7d5||0x1f4)[_0x7a13('0x31')]({'message':_0x426ea6?_0x426ea6[_0x7a13('0x32')]||_0x426ea6:''});}exports['login']=function(_0x2bd3fd,_0xb6db5d,_0x4c777d){passport[_0x7a13('0x19')](_0x7a13('0x33'),function(_0x4ca40d,_0x350915,_0x566d93){var _0xdb289d=_0x4ca40d||_0x566d93;if(_0xdb289d){return handleError(_0xb6db5d,0x191,_0xdb289d);}if(!_0x350915){return handleError(_0xb6db5d,0x194,{'message':_0x7a13('0x34')});}else{var _0x1ca61f={'payload':{'id':_0x350915['id'],'role':_0x350915[_0x7a13('0x13')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1ca61f)[_0x7a13('0xf')](function(_0x2e7998){_0xb6db5d[_0x7a13('0x35')]({'id':_0x350915['id'],'token':_0x2e7998,'statusCall':'','isAlreadyLogged':_0x350915[_0x7a13('0x36')]});});}})(_0x2bd3fd,_0xb6db5d,_0x4c777d);};exports['forgot']=function(_0xe4e16f,_0x5b6a78){if(!_0xe4e16f['body'][_0x7a13('0x23')]){return handleError(_0x5b6a78,0x1f4,{'message':_0x7a13('0x37')});}var _0x567f78=rs[_0x7a13('0x38')]();_0xe4e16f['body']['email']=_0xe4e16f[_0x7a13('0x39')]['email']['trim']()[_0x7a13('0x3a')]();var _0x12a3d6;return db[_0x7a13('0xc')][_0x7a13('0xd')]({'where':{'id':0x1},'attributes':[_0x7a13('0x1c'),'blockDuration'],'raw':!![]})[_0x7a13('0xf')](function(_0x3f2db3){_0x12a3d6=_0x3f2db3;return db['User'][_0x7a13('0x22')]({'where':{'email':_0xe4e16f[_0x7a13('0x39')][_0x7a13('0x23')]}});})[_0x7a13('0xf')](function(_0x568e70){if(!_0x568e70){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x568e70[_0x7a13('0x1b')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x568e70[_0x7a13('0x14')]){if(moment(_0x568e70[_0x7a13('0x15')])['add'](_0x12a3d6[_0x7a13('0xe')],_0x7a13('0x1e'))>moment()){throw new Error(_0x7a13('0x3b'));}else{_0x568e70[_0x7a13('0x14')]=![];_0x568e70['blockedAt']=null;}}_0x568e70[_0x7a13('0x3c')]=_0x567f78;_0x568e70[_0x7a13('0x3d')]=Date[_0x7a13('0x3e')]()+0x36ee80;return _0x568e70[_0x7a13('0x3f')]();})[_0x7a13('0xf')](function(){return sendServiceMail({'to':_0xe4e16f['body']['email'],'subject':_0x7a13('0x40'),'text':_0x7a13('0x41')+_0x7a13('0x42')+'https://'+_0xe4e16f[_0x7a13('0x43')][_0x7a13('0x44')]+_0x7a13('0x45')+_0x567f78+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x7a13('0xf')](function(){_0x5b6a78[_0x7a13('0x30')](0xc8)['send']({'message':_0x7a13('0x46')});})[_0x7a13('0x21')](function(_0x11c88e){return handleError(_0x5b6a78,0x1f4,_0x11c88e);});};exports[_0x7a13('0x47')]=function(_0x44e62b,_0x33e00e){return db[_0x7a13('0x48')]['find']({'where':{'resetPasswordToken':_0x44e62b[_0x7a13('0x49')][_0x7a13('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7a13('0xf')](function(_0x5184df){if(!_0x5184df){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x7a13('0xc')][_0x7a13('0xd')]({'attributes':['id',_0x7a13('0x4b'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x7a13('0xf')](function(_0x57ea33){if(_0x57ea33[_0x7a13('0x4b')])authService['validatePasswordPattern'](_0x44e62b['body']['password']);if(!_0x57ea33[_0x7a13('0x4c')]||!_0x5184df[_0x7a13('0x4d')])return _0x5184df;authService[_0x7a13('0x4e')](_0x44e62b[_0x7a13('0x39')]['password'],_0x5184df[_0x7a13('0x4d')],_0x57ea33[_0x7a13('0x4f')]);return _0x5184df;})[_0x7a13('0xf')](function(){_0x5184df[_0x7a13('0x11')]=_0x44e62b[_0x7a13('0x39')][_0x7a13('0x11')];_0x5184df[_0x7a13('0x3c')]=null;_0x5184df['resetPasswordExpires']=null;return _0x5184df[_0x7a13('0x3f')]();});})[_0x7a13('0xf')](function(){_0x33e00e['status'](0xc8)[_0x7a13('0x31')]({'message':_0x7a13('0x50')});})[_0x7a13('0x21')](function(_0x5ed891){return handleError(_0x33e00e,0x1f4,_0x5ed891);});};passport[_0x7a13('0x51')]('local-login',new LocalStrategy({'usernameField':_0x7a13('0x10'),'passwordField':'password'},function(_0x52845c,_0x57fed5,_0x36d1d1){return localAuthenticate(db[_0x7a13('0x48')],_0x52845c,_0x57fed5,_0x36d1d1);})); \ No newline at end of file +var _0x2136=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','blockedAt','add','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','blocked','loginAttempts','admin','user','agent','authenticate','disabled'];(function(_0x3255ae,_0x279cff){var _0x122d95=function(_0x65cac5){while(--_0x65cac5){_0x3255ae['push'](_0x3255ae['shift']());}};_0x122d95(++_0x279cff);}(_0x2136,0x96));var _0x6213=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0x2136[_0x101d5b];return _0x382a50;};'use strict';var util=require(_0x6213('0x0'));var passport=require(_0x6213('0x1'));var LocalStrategy=require(_0x6213('0x2'))[_0x6213('0x3')];var jayson=require('jayson/promise');var _=require(_0x6213('0x4'));var rs=require(_0x6213('0x5'));var moment=require(_0x6213('0x6'));var db=require(_0x6213('0x7'))['db'];var authService=require(_0x6213('0x8'));var utils=require(_0x6213('0x9'));var client=jayson[_0x6213('0xa')][_0x6213('0xb')]({'port':0x232b});function localAuthenticate(_0x27ed91,_0x53c82f,_0x7bc4b4,_0x2c8df1){var _0x505102,_0x1d84f5;return db[_0x6213('0xc')][_0x6213('0xd')]({'where':{'id':0x1},'attributes':[_0x6213('0xe'),_0x6213('0xf')],'raw':!![]})[_0x6213('0x10')](function(_0x1af751){_0x505102=_0x1af751;return _0x27ed91[_0x6213('0xd')]({'attributes':['id',_0x6213('0x11'),'password',_0x6213('0x12'),'role','disabled',_0x6213('0x13'),'blockedAt',_0x6213('0x14')],'where':{'name':_0x53c82f,'role':{'$or':[_0x6213('0x15'),_0x6213('0x16'),_0x6213('0x17')]}}});})['then'](function(_0x307c7b){if(!_0x307c7b||_0x307c7b&&_0x307c7b[_0x6213('0x11')]!==_0x53c82f){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1d84f5=_0x307c7b;return _0x1d84f5;}})['then'](function(){_0x1d84f5[_0x6213('0x18')](_0x7bc4b4,function(_0x518fa0,_0xf0dd9){var _0x19e4fe=_0x1d84f5[_0x6213('0x14')]+0x1;if(_0x518fa0){return _0x2c8df1(_0x518fa0);}else if(!_0xf0dd9){if(_0x1d84f5[_0x6213('0x19')]){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}else if(_0x505102[_0x6213('0xe')]>0x0){if(_0x1d84f5[_0x6213('0x13')]){if(_0x505102[_0x6213('0xf')]>0x0){if(moment(_0x1d84f5['blockedAt'])['add'](_0x505102[_0x6213('0xf')],_0x6213('0x1b'))>moment()){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}else{return utils[_0x6213('0x1c')](_0x1d84f5,_0x19e4fe,![],null)['then'](function(){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});});}}else{return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}}else{if(_0x19e4fe>=_0x505102[_0x6213('0xe')]){return utils[_0x6213('0x1c')](_0x1d84f5,0x0,!![],moment())[_0x6213('0x10')](function(){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});});}else{return utils[_0x6213('0x1c')](_0x1d84f5,_0x19e4fe,![],null)['then'](function(){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});});}}}else{return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}}else{if(_0x1d84f5[_0x6213('0x19')]){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}else if(_0x505102[_0x6213('0xe')]>0x0){if(_0x1d84f5[_0x6213('0x13')]){if(_0x505102[_0x6213('0xf')]>0x0){if(moment(_0x1d84f5[_0x6213('0x1d')])[_0x6213('0x1e')](_0x505102[_0x6213('0xf')],_0x6213('0x1b'))>moment()){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}else{return utils[_0x6213('0x1c')](_0x1d84f5,0x0,![],null)[_0x6213('0x10')](function(){return utils[_0x6213('0x1f')](_0x1d84f5);})[_0x6213('0x10')](function(){return _0x2c8df1(null,_0x1d84f5);});}}else{return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}}else{return utils['clearBlockUser'](_0x1d84f5,0x0,![],null)[_0x6213('0x10')](function(){return utils[_0x6213('0x1f')](_0x1d84f5);})['then'](function(){return _0x2c8df1(null,_0x1d84f5);})['catch'](function(_0x50142b){return _0x2c8df1(null,![],_0x50142b);});}}else{if(_0x1d84f5[_0x6213('0x13')]){return _0x2c8df1(null,![],{'message':_0x6213('0x1a')});}else{return utils[_0x6213('0x1f')](_0x1d84f5)[_0x6213('0x10')](function(){return _0x2c8df1(null,_0x1d84f5);});}}}});})[_0x6213('0x20')](function(_0x2c3ebf){return _0x2c8df1(null,![],_0x2c3ebf);});}function sendServiceMail(_0x1068f3){return db[_0x6213('0x21')][_0x6213('0x22')]({'where':{'service':!![]},'attributes':['id',_0x6213('0x11'),_0x6213('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x6213('0x24'),'include':[{'model':db[_0x6213('0x25')],'as':_0x6213('0x25')}]}]})[_0x6213('0x10')](function(_0x3dd062){if(!_0x3dd062){throw new Error(_0x6213('0x26'));}var _0xf35162=_0x3dd062[_0x6213('0x27')]();var _0x3dcb89={'account':_0xf35162,'message':_[_0x6213('0x28')]({'from':util[_0x6213('0x29')](_0x6213('0x2a'),_0x3dd062[_0x6213('0x11')],_0x3dd062[_0x6213('0x23')]||_0x3dd062[_0x6213('0x24')][_0x6213('0x16')])},_0x1068f3)};return client[_0x6213('0x2b')]('SendMail',_0x3dcb89);})['then'](function(_0x36317f){if(_0x36317f[_0x6213('0x2c')]){throw new Error(util[_0x6213('0x29')](_0x6213('0x2d'),_0x36317f['error']['message']||JSON[_0x6213('0x2e')](_0x36317f[_0x6213('0x2c')])));}return!![];});}function handleError(_0x1d9d1b,_0x4d9e85,_0x47cde3){return _0x1d9d1b[_0x6213('0x2f')](_0x4d9e85||0x1f4)[_0x6213('0x30')]({'message':_0x47cde3?_0x47cde3[_0x6213('0x31')]||_0x47cde3:''});}exports['login']=function(_0x2abfca,_0x27a262,_0x1f679c){passport[_0x6213('0x18')](_0x6213('0x32'),function(_0x3162d0,_0x43d17e,_0x100921){var _0x53ad34=_0x3162d0||_0x100921;if(_0x53ad34){return handleError(_0x27a262,0x191,_0x53ad34);}if(!_0x43d17e){return handleError(_0x27a262,0x194,{'message':_0x6213('0x33')});}else{var _0x1951e1={'payload':{'id':_0x43d17e['id'],'role':_0x43d17e[_0x6213('0x34')]},'options':{'expiresIn':0x15180}};return authService[_0x6213('0x35')](_0x1951e1)[_0x6213('0x10')](function(_0x48719a){_0x27a262[_0x6213('0x36')]({'id':_0x43d17e['id'],'token':_0x48719a,'statusCall':'','isAlreadyLogged':_0x43d17e['online']});});}})(_0x2abfca,_0x27a262,_0x1f679c);};exports['forgot']=function(_0x128d46,_0x999504){if(!_0x128d46[_0x6213('0x37')][_0x6213('0x23')]){return handleError(_0x999504,0x1f4,{'message':_0x6213('0x38')});}var _0x1435f9=rs[_0x6213('0x39')]();_0x128d46[_0x6213('0x37')][_0x6213('0x23')]=_0x128d46[_0x6213('0x37')][_0x6213('0x23')][_0x6213('0x3a')]()[_0x6213('0x3b')]();var _0x127f20;return db[_0x6213('0xc')][_0x6213('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6213('0xf')],'raw':!![]})['then'](function(_0x34aaa9){_0x127f20=_0x34aaa9;return db['User'][_0x6213('0x22')]({'where':{'email':_0x128d46[_0x6213('0x37')][_0x6213('0x23')]}});})['then'](function(_0x1e4312){if(!_0x1e4312){throw new Error(_0x6213('0x3c'));}if(_0x1e4312[_0x6213('0x19')]){throw new Error(_0x6213('0x3d'));}if(_0x1e4312[_0x6213('0x13')]){if(moment(_0x1e4312['blockedAt'])[_0x6213('0x1e')](_0x127f20[_0x6213('0xf')],'minutes')>moment()){throw new Error(_0x6213('0x3e'));}else{_0x1e4312[_0x6213('0x13')]=![];_0x1e4312[_0x6213('0x1d')]=null;}}_0x1e4312[_0x6213('0x3f')]=_0x1435f9;_0x1e4312[_0x6213('0x40')]=Date[_0x6213('0x41')]()+0x36ee80;return _0x1e4312[_0x6213('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x128d46[_0x6213('0x37')][_0x6213('0x23')],'subject':_0x6213('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x6213('0x44')+_0x6213('0x45')+_0x128d46[_0x6213('0x46')][_0x6213('0x47')]+_0x6213('0x48')+_0x1435f9+'\x0a\x0a'+_0x6213('0x49')});})[_0x6213('0x10')](function(){_0x999504[_0x6213('0x2f')](0xc8)['send']({'message':_0x6213('0x4a')});})[_0x6213('0x20')](function(_0x2dbdda){return handleError(_0x999504,0x1f4,_0x2dbdda);});};exports['reset']=function(_0x28dd66,_0x3f3b4b){return db[_0x6213('0x4b')][_0x6213('0x22')]({'where':{'resetPasswordToken':_0x28dd66[_0x6213('0x4c')][_0x6213('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x6213('0x41')]()}}})[_0x6213('0x10')](function(_0x2892d8){if(!_0x2892d8){throw new Error(_0x6213('0x4e'));}return db[_0x6213('0xc')][_0x6213('0xd')]({'attributes':['id',_0x6213('0x4f'),_0x6213('0x50'),_0x6213('0x51')]})['then'](function(_0x1a6b35){if(_0x1a6b35[_0x6213('0x4f')])authService[_0x6213('0x52')](_0x28dd66[_0x6213('0x37')][_0x6213('0x53')]);if(!_0x1a6b35[_0x6213('0x50')]||!_0x2892d8[_0x6213('0x54')])return _0x2892d8;authService[_0x6213('0x55')](_0x28dd66[_0x6213('0x37')][_0x6213('0x53')],_0x2892d8[_0x6213('0x54')],_0x1a6b35[_0x6213('0x51')]);return _0x2892d8;})[_0x6213('0x10')](function(){_0x2892d8[_0x6213('0x53')]=_0x28dd66[_0x6213('0x37')][_0x6213('0x53')];_0x2892d8[_0x6213('0x3f')]=null;_0x2892d8[_0x6213('0x40')]=null;return _0x2892d8[_0x6213('0x42')]();});})[_0x6213('0x10')](function(){_0x3f3b4b[_0x6213('0x2f')](0xc8)[_0x6213('0x30')]({'message':_0x6213('0x56')});})[_0x6213('0x20')](function(_0x274ad3){return handleError(_0x3f3b4b,0x1f4,_0x274ad3);});};passport[_0x6213('0x57')](_0x6213('0x32'),new LocalStrategy({'usernameField':_0x6213('0x11'),'passwordField':_0x6213('0x53')},function(_0xe3bb4a,_0x768ece,_0x3d7880){return localAuthenticate(db[_0x6213('0x4b')],_0xe3bb4a,_0x768ece,_0x3d7880);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1dc05a4..6891b22 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 _0x49ad=['express','Router','post','login','/reset/:token','reset','exports'];(function(_0x4dce4f,_0x2e433f){var _0x7d8bcf=function(_0x1c03d9){while(--_0x1c03d9){_0x4dce4f['push'](_0x4dce4f['shift']());}};_0x7d8bcf(++_0x2e433f);}(_0x49ad,0xe0));var _0xd49a=function(_0x2f5297,_0x2b93fc){_0x2f5297=_0x2f5297-0x0;var _0x446f62=_0x49ad[_0x2f5297];return _0x446f62;};'use strict';var express=require(_0xd49a('0x0'));var router=express[_0xd49a('0x1')]();var controller=require('./authLocal.controller');router[_0xd49a('0x2')]('/',controller[_0xd49a('0x3')]);router[_0xd49a('0x2')]('/forgot',controller['forgot']);router[_0xd49a('0x2')](_0xd49a('0x4'),controller[_0xd49a('0x5')]);module[_0xd49a('0x6')]=router; \ No newline at end of file +var _0xc14d=['./authLocal.controller','login','/forgot','forgot','post','/reset/:token','exports','express','Router'];(function(_0xf221e3,_0x1548c1){var _0x294cc1=function(_0x883e0c){while(--_0x883e0c){_0xf221e3['push'](_0xf221e3['shift']());}};_0x294cc1(++_0x1548c1);}(_0xc14d,0x127));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var express=require(_0xdc14('0x0'));var router=express[_0xdc14('0x1')]();var controller=require(_0xdc14('0x2'));router['post']('/',controller[_0xdc14('0x3')]);router['post'](_0xdc14('0x4'),controller[_0xdc14('0x5')]);router[_0xdc14('0x6')](_0xdc14('0x7'),controller['reset']);module[_0xdc14('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index bf19fef..6e541f5 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 _0xd2f7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1343e0,_0x293029){var _0x59789a=function(_0x5dc8a3){while(--_0x5dc8a3){_0x1343e0['push'](_0x1343e0['shift']());}};_0x59789a(++_0x293029);}(_0xd2f7,0x172));var _0x7d2f=function(_0x26f230,_0x205a58){_0x26f230=_0x26f230-0x0;var _0x2c49a5=_0xd2f7[_0x26f230];return _0x2c49a5;};'use strict';var Sequelize=require(_0x7d2f('0x0'));module[_0x7d2f('0x1')]={'name':{'type':Sequelize[_0x7d2f('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7d2f('0x2')]},'status':{'type':Sequelize[_0x7d2f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x6470=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x6470,0xef));var _0x0647=function(_0x85af8b,_0x343560){_0x85af8b=_0x85af8b-0x0;var _0x434ba6=_0x6470[_0x85af8b];return _0x434ba6;};'use strict';var Sequelize=require(_0x0647('0x0'));module['exports']={'name':{'type':Sequelize[_0x0647('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x0647('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0647('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0647('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 0821c2b..063470f 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 _0xf1a8=['squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','error','name','index','map','Automation','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','Condition','find','addConditions','omit','ids','findOne','filters','pick','getConditions','addActions','getActions','Action','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1a11e2,_0x15e913){var _0x100e0c=function(_0x3fabcc){while(--_0x3fabcc){_0x1a11e2['push'](_0x1a11e2['shift']());}};_0x100e0c(++_0x15e913);}(_0xf1a8,0x99));var _0x8f1a=function(_0x17742e,_0x384a1f){_0x17742e=_0x17742e-0x0;var _0x35e5ce=_0xf1a8[_0x17742e];return _0x35e5ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f1a('0x0'));var zipdir=require(_0x8f1a('0x1'));var jsonpatch=require(_0x8f1a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f1a('0x3'));var Mustache=require(_0x8f1a('0x4'));var util=require(_0x8f1a('0x5'));var path=require('path');var sox=require(_0x8f1a('0x6'));var csv=require(_0x8f1a('0x7'));var ejs=require(_0x8f1a('0x8'));var fs=require('fs');var fs_extra=require(_0x8f1a('0x9'));var _=require(_0x8f1a('0xa'));var squel=require(_0x8f1a('0xb'));var crypto=require(_0x8f1a('0xc'));var jsforce=require(_0x8f1a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f1a('0x7'));var querystring=require('querystring');var Papa=require(_0x8f1a('0xe'));var Redis=require('ioredis');var authService=require(_0x8f1a('0xf'));var qs=require(_0x8f1a('0x10'));var as=require(_0x8f1a('0x11'));var hardwareService=require(_0x8f1a('0x12'));var logger=require(_0x8f1a('0x13'))('api');var utils=require(_0x8f1a('0x14'));var config=require(_0x8f1a('0x15'));var licenseUtil=require(_0x8f1a('0x16'));var db=require(_0x8f1a('0x17'))['db'];function respondWithStatusCode(_0x5292d7,_0x11dfdc){_0x11dfdc=_0x11dfdc||0xcc;return function(_0x46abcc){if(_0x46abcc){return _0x5292d7[_0x8f1a('0x18')](_0x11dfdc);}return _0x5292d7[_0x8f1a('0x19')](_0x11dfdc)[_0x8f1a('0x1a')]();};}function respondWithResult(_0x379b99,_0x368f29){_0x368f29=_0x368f29||0xc8;return function(_0x1785b4){if(_0x1785b4){return _0x379b99[_0x8f1a('0x19')](_0x368f29)['json'](_0x1785b4);}};}function respondWithFilteredResult(_0x57eb29,_0x5ea785){return function(_0x8f20a2){if(_0x8f20a2){var _0xa20341=typeof _0x5ea785[_0x8f1a('0x1b')]===_0x8f1a('0x1c')&&typeof _0x5ea785[_0x8f1a('0x1d')]===_0x8f1a('0x1c');var _0x2ab10b=_0x8f20a2[_0x8f1a('0x1e')];var _0x3ac5ae=_0xa20341?0x0:_0x5ea785['offset'];var _0xf74199=_0xa20341?_0x8f20a2['count']:_0x5ea785[_0x8f1a('0x1b')]+_0x5ea785['limit'];var _0x545d53;if(_0xf74199>=_0x2ab10b){_0xf74199=_0x2ab10b;_0x545d53=0xc8;}else{_0x545d53=0xce;}_0x57eb29[_0x8f1a('0x19')](_0x545d53);return _0x57eb29[_0x8f1a('0x1f')]('Content-Range',_0x3ac5ae+'-'+_0xf74199+'/'+_0x2ab10b)[_0x8f1a('0x20')](_0x8f20a2);}return null;};}function patchUpdates(_0x2048e9){return function(_0x23557b){try{jsonpatch[_0x8f1a('0x21')](_0x23557b,_0x2048e9,!![]);}catch(_0x31c871){return BPromise[_0x8f1a('0x22')](_0x31c871);}return _0x23557b[_0x8f1a('0x23')]();};}function saveUpdates(_0x578459,_0x2c5ef0){return function(_0x3e3540){if(_0x3e3540){return _0x3e3540[_0x8f1a('0x24')](_0x578459)['then'](function(_0x4d2ac2){return _0x4d2ac2;});}return null;};}function removeEntity(_0x4088ec,_0x5191a3){return function(_0x1aa105){if(_0x1aa105){return _0x1aa105[_0x8f1a('0x25')]()[_0x8f1a('0x26')](function(){_0x4088ec[_0x8f1a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e44aa,_0x48328a){return function(_0x7870cc){if(!_0x7870cc){_0x1e44aa[_0x8f1a('0x18')](0x194);}return _0x7870cc;};}function handleError(_0x1e33bb,_0x3e0f79){_0x3e0f79=_0x3e0f79||0x1f4;return function(_0x5dcfe0){logger[_0x8f1a('0x27')](_0x5dcfe0['stack']);if(_0x5dcfe0[_0x8f1a('0x28')]){delete _0x5dcfe0[_0x8f1a('0x28')];}_0x1e33bb[_0x8f1a('0x19')](_0x3e0f79)['send'](_0x5dcfe0);};}exports[_0x8f1a('0x29')]=function(_0xf3aed2,_0x425aac){var _0x117c5c={},_0x31d93a={},_0x473fed={'count':0x0,'rows':[]};var _0x11ea8e=_[_0x8f1a('0x2a')](db[_0x8f1a('0x2b')]['rawAttributes'],function(_0x54e71d){return{'name':_0x54e71d[_0x8f1a('0x2c')],'type':_0x54e71d[_0x8f1a('0x2d')]['key']};});_0x31d93a[_0x8f1a('0x2e')]=_[_0x8f1a('0x2a')](_0x11ea8e,_0x8f1a('0x28'));_0x31d93a['query']=_[_0x8f1a('0x2f')](_0xf3aed2[_0x8f1a('0x30')]);_0x31d93a['filters']=_[_0x8f1a('0x31')](_0x31d93a['model'],_0x31d93a[_0x8f1a('0x30')]);_0x117c5c[_0x8f1a('0x32')]=_[_0x8f1a('0x31')](_0x31d93a['model'],qs[_0x8f1a('0x33')](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x117c5c[_0x8f1a('0x32')]=_0x117c5c['attributes'][_0x8f1a('0x34')]?_0x117c5c[_0x8f1a('0x32')]:_0x31d93a['model'];if(!_0xf3aed2['query']['hasOwnProperty'](_0x8f1a('0x35'))){_0x117c5c[_0x8f1a('0x1d')]=qs[_0x8f1a('0x1d')](_0xf3aed2['query']['limit']);_0x117c5c[_0x8f1a('0x1b')]=qs['offset'](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x1b')]);}_0x117c5c[_0x8f1a('0x36')]=qs[_0x8f1a('0x37')](_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x37')]);_0x117c5c['where']=qs['filters'](_['pick'](_0xf3aed2[_0x8f1a('0x30')],_0x31d93a['filters']),_0x11ea8e);if(_0xf3aed2[_0x8f1a('0x30')][_0x8f1a('0x38')]){_0x117c5c[_0x8f1a('0x39')]=_[_0x8f1a('0x3a')](_0x117c5c[_0x8f1a('0x39')],{'$or':_[_0x8f1a('0x2a')](_0x11ea8e,function(_0x571b6b){if(_0x571b6b['type']!==_0x8f1a('0x3b')){var _0x370691={};_0x370691[_0x571b6b['name']]={'$like':'%'+_0xf3aed2['query'][_0x8f1a('0x38')]+'%'};return _0x370691;}})});}_0x117c5c=_[_0x8f1a('0x3a')]({},_0x117c5c,_0xf3aed2[_0x8f1a('0x3c')]);var _0x7a4aed={'where':_0x117c5c['where']};return db[_0x8f1a('0x2b')][_0x8f1a('0x1e')](_0x7a4aed)['then'](function(_0x53d1a3){_0x473fed[_0x8f1a('0x1e')]=_0x53d1a3;if(_0xf3aed2['query'][_0x8f1a('0x3d')]){_0x117c5c['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x117c5c);})['then'](function(_0x912fde){_0x473fed[_0x8f1a('0x3e')]=_0x912fde;return _0x473fed;})[_0x8f1a('0x26')](respondWithFilteredResult(_0x425aac,_0x117c5c))[_0x8f1a('0x3f')](handleError(_0x425aac,null));};exports[_0x8f1a('0x40')]=function(_0x9dc320,_0x56bd1f){var _0x938901={'raw':![],'where':{'id':_0x9dc320[_0x8f1a('0x41')]['id']}},_0x2db1a2={};_0x2db1a2['model']=_[_0x8f1a('0x2f')](db[_0x8f1a('0x2b')][_0x8f1a('0x42')]);_0x2db1a2['query']=_[_0x8f1a('0x2f')](_0x9dc320[_0x8f1a('0x30')]);_0x2db1a2['filters']=_[_0x8f1a('0x31')](_0x2db1a2[_0x8f1a('0x2e')],_0x2db1a2['query']);_0x938901['attributes']=_[_0x8f1a('0x31')](_0x2db1a2[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x9dc320[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x938901[_0x8f1a('0x32')]=_0x938901[_0x8f1a('0x32')][_0x8f1a('0x34')]?_0x938901[_0x8f1a('0x32')]:_0x2db1a2[_0x8f1a('0x2e')];if(_0x9dc320[_0x8f1a('0x30')][_0x8f1a('0x3d')]){_0x938901[_0x8f1a('0x43')]=[{'all':!![]}];}_0x938901=_['merge']({},_0x938901,_0x9dc320[_0x8f1a('0x3c')]);return db['Automation']['find'](_0x938901)['then'](handleEntityNotFound(_0x56bd1f,null))[_0x8f1a('0x26')](respondWithResult(_0x56bd1f,null))['catch'](handleError(_0x56bd1f,null));};exports['create']=function(_0x447b1f,_0x3008c2){return db[_0x8f1a('0x2b')][_0x8f1a('0x44')](_0x447b1f['body'],{})['then'](respondWithResult(_0x3008c2,0xc9))[_0x8f1a('0x3f')](handleError(_0x3008c2,null));};exports[_0x8f1a('0x24')]=function(_0x1c2cc7,_0x50df9f){if(_0x1c2cc7[_0x8f1a('0x45')]['id']){delete _0x1c2cc7[_0x8f1a('0x45')]['id'];}return db[_0x8f1a('0x2b')]['find']({'where':{'id':_0x1c2cc7['params']['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x50df9f,null))['then'](saveUpdates(_0x1c2cc7['body'],null))[_0x8f1a('0x26')](respondWithResult(_0x50df9f,null))['catch'](handleError(_0x50df9f,null));};exports[_0x8f1a('0x25')]=function(_0x50dd7a,_0x2e9800){return db[_0x8f1a('0x2b')]['find']({'where':{'id':_0x50dd7a[_0x8f1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e9800,null))[_0x8f1a('0x26')](removeEntity(_0x2e9800,null))['catch'](handleError(_0x2e9800,null));};exports['addConditions']=function(_0x55bc69,_0x161730,_0x586d2b){return db[_0x8f1a('0x46')][_0x8f1a('0x47')]({'where':{'id':_0x55bc69[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x161730,null))[_0x8f1a('0x26')](function(_0x3fced0){if(_0x3fced0){return _0x3fced0[_0x8f1a('0x48')](_0x55bc69[_0x8f1a('0x45')]['ids'],_[_0x8f1a('0x49')](_0x55bc69[_0x8f1a('0x45')],[_0x8f1a('0x4a'),'id'])||{});}})[_0x8f1a('0x26')](respondWithResult(_0x161730,null))[_0x8f1a('0x3f')](handleError(_0x161730,null));};exports['getConditions']=function(_0x525690,_0x32856f,_0x7cf24d){var _0x28f8ab={};var _0x33813f={};var _0x392b64;var _0x55ef50;return db[_0x8f1a('0x2b')][_0x8f1a('0x4b')]({'where':{'id':_0x525690[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x32856f,null))['then'](function(_0x55b7af){if(_0x55b7af){_0x392b64=_0x55b7af;_0x33813f[_0x8f1a('0x2e')]=_['keys'](db[_0x8f1a('0x46')]['rawAttributes']);_0x33813f[_0x8f1a('0x30')]=_[_0x8f1a('0x2f')](_0x525690[_0x8f1a('0x30')]);_0x33813f[_0x8f1a('0x4c')]=_[_0x8f1a('0x31')](_0x33813f[_0x8f1a('0x2e')],_0x33813f[_0x8f1a('0x30')]);_0x28f8ab[_0x8f1a('0x32')]=_['intersection'](_0x33813f[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x525690[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x28f8ab[_0x8f1a('0x32')]=_0x28f8ab['attributes'][_0x8f1a('0x34')]?_0x28f8ab[_0x8f1a('0x32')]:_0x33813f[_0x8f1a('0x2e')];_0x28f8ab['order']=qs[_0x8f1a('0x37')](_0x525690['query'][_0x8f1a('0x37')]);_0x28f8ab[_0x8f1a('0x39')]=qs[_0x8f1a('0x4c')](_[_0x8f1a('0x4d')](_0x525690[_0x8f1a('0x30')],_0x33813f[_0x8f1a('0x4c')]));if(_0x525690[_0x8f1a('0x30')][_0x8f1a('0x38')]){_0x28f8ab[_0x8f1a('0x39')]=_['merge'](_0x28f8ab['where'],{'$or':_[_0x8f1a('0x2a')](_0x28f8ab[_0x8f1a('0x32')],function(_0x36c8b4){var _0x126a27={};_0x126a27[_0x36c8b4]={'$like':'%'+_0x525690[_0x8f1a('0x30')][_0x8f1a('0x38')]+'%'};return _0x126a27;})});}_0x28f8ab=_[_0x8f1a('0x3a')]({},_0x28f8ab,_0x525690['options']);return _0x392b64[_0x8f1a('0x4e')](_0x28f8ab);}})[_0x8f1a('0x26')](function(_0x9ea851){if(_0x9ea851){_0x55ef50=_0x9ea851[_0x8f1a('0x34')];if(!_0x525690[_0x8f1a('0x30')]['hasOwnProperty']('nolimit')){_0x28f8ab['limit']=qs['limit'](_0x525690[_0x8f1a('0x30')][_0x8f1a('0x1d')]);_0x28f8ab[_0x8f1a('0x1b')]=qs['offset'](_0x525690['query'][_0x8f1a('0x1b')]);}return _0x392b64[_0x8f1a('0x4e')](_0x28f8ab);}})['then'](function(_0x549bf4){if(_0x549bf4){return _0x549bf4?{'count':_0x55ef50,'rows':_0x549bf4}:null;}})[_0x8f1a('0x26')](respondWithResult(_0x32856f,null))[_0x8f1a('0x3f')](handleError(_0x32856f,null));};exports[_0x8f1a('0x4f')]=function(_0xaf4127,_0x7a675c,_0x16a7d7){return db['Action'][_0x8f1a('0x47')]({'where':{'id':_0xaf4127['params']['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x7a675c,null))[_0x8f1a('0x26')](function(_0x14d74c){if(_0x14d74c){return _0x14d74c[_0x8f1a('0x4f')](_0xaf4127[_0x8f1a('0x45')][_0x8f1a('0x4a')],_[_0x8f1a('0x49')](_0xaf4127[_0x8f1a('0x45')],['ids','id'])||{});}})[_0x8f1a('0x26')](respondWithResult(_0x7a675c,null))[_0x8f1a('0x3f')](handleError(_0x7a675c,null));};exports[_0x8f1a('0x50')]=function(_0x2e5c3a,_0x9a7a35,_0x35f4f6){var _0x50c4c9={};var _0x5d1ce2={};var _0x4b388f;var _0x128085;return db['Automation'][_0x8f1a('0x4b')]({'where':{'id':_0x2e5c3a[_0x8f1a('0x41')]['id']}})[_0x8f1a('0x26')](handleEntityNotFound(_0x9a7a35,null))['then'](function(_0x12a124){if(_0x12a124){_0x4b388f=_0x12a124;_0x5d1ce2[_0x8f1a('0x2e')]=_[_0x8f1a('0x2f')](db[_0x8f1a('0x51')][_0x8f1a('0x42')]);_0x5d1ce2[_0x8f1a('0x30')]=_[_0x8f1a('0x2f')](_0x2e5c3a[_0x8f1a('0x30')]);_0x5d1ce2['filters']=_[_0x8f1a('0x31')](_0x5d1ce2[_0x8f1a('0x2e')],_0x5d1ce2[_0x8f1a('0x30')]);_0x50c4c9[_0x8f1a('0x32')]=_[_0x8f1a('0x31')](_0x5d1ce2[_0x8f1a('0x2e')],qs[_0x8f1a('0x33')](_0x2e5c3a[_0x8f1a('0x30')][_0x8f1a('0x33')]));_0x50c4c9[_0x8f1a('0x32')]=_0x50c4c9[_0x8f1a('0x32')][_0x8f1a('0x34')]?_0x50c4c9['attributes']:_0x5d1ce2[_0x8f1a('0x2e')];_0x50c4c9[_0x8f1a('0x36')]=qs[_0x8f1a('0x37')](_0x2e5c3a['query']['sort']);_0x50c4c9[_0x8f1a('0x39')]=qs[_0x8f1a('0x4c')](_['pick'](_0x2e5c3a[_0x8f1a('0x30')],_0x5d1ce2[_0x8f1a('0x4c')]));if(_0x2e5c3a['query'][_0x8f1a('0x38')]){_0x50c4c9[_0x8f1a('0x39')]=_['merge'](_0x50c4c9[_0x8f1a('0x39')],{'$or':_['map'](_0x50c4c9[_0x8f1a('0x32')],function(_0x177194){var _0x3374ec={};_0x3374ec[_0x177194]={'$like':'%'+_0x2e5c3a[_0x8f1a('0x30')][_0x8f1a('0x38')]+'%'};return _0x3374ec;})});}_0x50c4c9=_[_0x8f1a('0x3a')]({},_0x50c4c9,_0x2e5c3a[_0x8f1a('0x3c')]);return _0x4b388f[_0x8f1a('0x50')](_0x50c4c9);}})[_0x8f1a('0x26')](function(_0x23bc96){if(_0x23bc96){_0x128085=_0x23bc96[_0x8f1a('0x34')];if(!_0x2e5c3a[_0x8f1a('0x30')]['hasOwnProperty'](_0x8f1a('0x35'))){_0x50c4c9['limit']=qs[_0x8f1a('0x1d')](_0x2e5c3a['query'][_0x8f1a('0x1d')]);_0x50c4c9[_0x8f1a('0x1b')]=qs['offset'](_0x2e5c3a['query'][_0x8f1a('0x1b')]);}return _0x4b388f[_0x8f1a('0x50')](_0x50c4c9);}})['then'](function(_0x54de99){if(_0x54de99){return _0x54de99?{'count':_0x128085,'rows':_0x54de99}:null;}})[_0x8f1a('0x26')](respondWithResult(_0x9a7a35,null))[_0x8f1a('0x3f')](handleError(_0x9a7a35,null));}; \ No newline at end of file +var _0x5a80=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','body','params','addConditions','Condition','ids','getConditions','findOne','addActions','Action','getActions','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','map','Automation','rawAttributes','fieldName'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5a80,0x164));var _0x05a8=function(_0xe2f1b8,_0xb9d3c7){_0xe2f1b8=_0xe2f1b8-0x0;var _0x430299=_0x5a80[_0xe2f1b8];return _0x430299;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05a8('0x1'));var moment=require(_0x05a8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x05a8('0x3'));var util=require(_0x05a8('0x4'));var path=require(_0x05a8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05a8('0x6'));var fs=require('fs');var fs_extra=require(_0x05a8('0x7'));var _=require(_0x05a8('0x8'));var squel=require('squel');var crypto=require(_0x05a8('0x9'));var jsforce=require(_0x05a8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x05a8('0xb'));var querystring=require('querystring');var Papa=require(_0x05a8('0xc'));var Redis=require(_0x05a8('0xd'));var authService=require(_0x05a8('0xe'));var qs=require(_0x05a8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05a8('0x10'));var logger=require(_0x05a8('0x11'))(_0x05a8('0x12'));var utils=require('../../config/utils');var config=require(_0x05a8('0x13'));var licenseUtil=require(_0x05a8('0x14'));var db=require(_0x05a8('0x15'))['db'];function respondWithStatusCode(_0x4f13f5,_0x1fc4d0){_0x1fc4d0=_0x1fc4d0||0xcc;return function(_0x2cc532){if(_0x2cc532){return _0x4f13f5[_0x05a8('0x16')](_0x1fc4d0);}return _0x4f13f5[_0x05a8('0x17')](_0x1fc4d0)[_0x05a8('0x18')]();};}function respondWithResult(_0x28e0e2,_0x3f1bc3){_0x3f1bc3=_0x3f1bc3||0xc8;return function(_0x5bcb98){if(_0x5bcb98){return _0x28e0e2[_0x05a8('0x17')](_0x3f1bc3)[_0x05a8('0x19')](_0x5bcb98);}};}function respondWithFilteredResult(_0x1da76b,_0x539678){return function(_0x460c32){if(_0x460c32){var _0xcc185b=typeof _0x539678[_0x05a8('0x1a')]===_0x05a8('0x1b')&&typeof _0x539678[_0x05a8('0x1c')]==='undefined';var _0x5e5fca=_0x460c32[_0x05a8('0x1d')];var _0xb77e28=_0xcc185b?0x0:_0x539678[_0x05a8('0x1a')];var _0x2fe076=_0xcc185b?_0x460c32[_0x05a8('0x1d')]:_0x539678[_0x05a8('0x1a')]+_0x539678[_0x05a8('0x1c')];var _0x3f36ae;if(_0x2fe076>=_0x5e5fca){_0x2fe076=_0x5e5fca;_0x3f36ae=0xc8;}else{_0x3f36ae=0xce;}_0x1da76b['status'](_0x3f36ae);return _0x1da76b[_0x05a8('0x1e')](_0x05a8('0x1f'),_0xb77e28+'-'+_0x2fe076+'/'+_0x5e5fca)['json'](_0x460c32);}return null;};}function patchUpdates(_0x40ccff){return function(_0x568b8d){try{jsonpatch[_0x05a8('0x20')](_0x568b8d,_0x40ccff,!![]);}catch(_0x5bffcf){return BPromise[_0x05a8('0x21')](_0x5bffcf);}return _0x568b8d[_0x05a8('0x22')]();};}function saveUpdates(_0x28ed4c,_0x21cd98){return function(_0x30f90f){if(_0x30f90f){return _0x30f90f[_0x05a8('0x23')](_0x28ed4c)['then'](function(_0x5d6bc8){return _0x5d6bc8;});}return null;};}function removeEntity(_0x21c5a2,_0x400cfc){return function(_0x41eb2c){if(_0x41eb2c){return _0x41eb2c[_0x05a8('0x24')]()[_0x05a8('0x25')](function(){_0x21c5a2['status'](0xcc)[_0x05a8('0x18')]();});}};}function handleEntityNotFound(_0x125aef,_0x101fb6){return function(_0x1123d9){if(!_0x1123d9){_0x125aef[_0x05a8('0x16')](0x194);}return _0x1123d9;};}function handleError(_0x760439,_0x465ceb){_0x465ceb=_0x465ceb||0x1f4;return function(_0x443fe5){logger[_0x05a8('0x26')](_0x443fe5['stack']);if(_0x443fe5[_0x05a8('0x27')]){delete _0x443fe5[_0x05a8('0x27')];}_0x760439[_0x05a8('0x17')](_0x465ceb)['send'](_0x443fe5);};}exports['index']=function(_0x806f87,_0x3d8069){var _0x5b3f19={},_0x476d72={},_0x7300a9={'count':0x0,'rows':[]};var _0x332607=_[_0x05a8('0x28')](db[_0x05a8('0x29')][_0x05a8('0x2a')],function(_0x3b218b){return{'name':_0x3b218b[_0x05a8('0x2b')],'type':_0x3b218b[_0x05a8('0x2c')][_0x05a8('0x2d')]};});_0x476d72[_0x05a8('0x2e')]=_[_0x05a8('0x28')](_0x332607,_0x05a8('0x27'));_0x476d72[_0x05a8('0x2f')]=_[_0x05a8('0x30')](_0x806f87['query']);_0x476d72[_0x05a8('0x31')]=_[_0x05a8('0x32')](_0x476d72[_0x05a8('0x2e')],_0x476d72[_0x05a8('0x2f')]);_0x5b3f19['attributes']=_[_0x05a8('0x32')](_0x476d72[_0x05a8('0x2e')],qs[_0x05a8('0x33')](_0x806f87[_0x05a8('0x2f')]['fields']));_0x5b3f19['attributes']=_0x5b3f19[_0x05a8('0x34')][_0x05a8('0x35')]?_0x5b3f19[_0x05a8('0x34')]:_0x476d72['model'];if(!_0x806f87['query'][_0x05a8('0x36')](_0x05a8('0x37'))){_0x5b3f19[_0x05a8('0x1c')]=qs['limit'](_0x806f87['query'][_0x05a8('0x1c')]);_0x5b3f19[_0x05a8('0x1a')]=qs[_0x05a8('0x1a')](_0x806f87[_0x05a8('0x2f')][_0x05a8('0x1a')]);}_0x5b3f19[_0x05a8('0x38')]=qs['sort'](_0x806f87[_0x05a8('0x2f')][_0x05a8('0x39')]);_0x5b3f19[_0x05a8('0x3a')]=qs[_0x05a8('0x31')](_[_0x05a8('0x3b')](_0x806f87[_0x05a8('0x2f')],_0x476d72[_0x05a8('0x31')]),_0x332607);if(_0x806f87[_0x05a8('0x2f')][_0x05a8('0x3c')]){_0x5b3f19['where']=_['merge'](_0x5b3f19[_0x05a8('0x3a')],{'$or':_[_0x05a8('0x28')](_0x332607,function(_0x3a87c9){if(_0x3a87c9[_0x05a8('0x2c')]!==_0x05a8('0x3d')){var _0x14fee3={};_0x14fee3[_0x3a87c9[_0x05a8('0x27')]]={'$like':'%'+_0x806f87['query'][_0x05a8('0x3c')]+'%'};return _0x14fee3;}})});}_0x5b3f19=_[_0x05a8('0x3e')]({},_0x5b3f19,_0x806f87[_0x05a8('0x3f')]);var _0x3f9873={'where':_0x5b3f19['where']};return db['Automation']['count'](_0x3f9873)['then'](function(_0x4f8c5a){_0x7300a9[_0x05a8('0x1d')]=_0x4f8c5a;if(_0x806f87[_0x05a8('0x2f')][_0x05a8('0x40')]){_0x5b3f19[_0x05a8('0x41')]=[{'all':!![]}];}return db[_0x05a8('0x29')][_0x05a8('0x42')](_0x5b3f19);})[_0x05a8('0x25')](function(_0x141bb0){_0x7300a9[_0x05a8('0x43')]=_0x141bb0;return _0x7300a9;})[_0x05a8('0x25')](respondWithFilteredResult(_0x3d8069,_0x5b3f19))[_0x05a8('0x44')](handleError(_0x3d8069,null));};exports['show']=function(_0x49ec7e,_0x19dcad){var _0xacb49a={'raw':![],'where':{'id':_0x49ec7e['params']['id']}},_0x4d306b={};_0x4d306b[_0x05a8('0x2e')]=_[_0x05a8('0x30')](db[_0x05a8('0x29')][_0x05a8('0x2a')]);_0x4d306b[_0x05a8('0x2f')]=_[_0x05a8('0x30')](_0x49ec7e['query']);_0x4d306b[_0x05a8('0x31')]=_['intersection'](_0x4d306b[_0x05a8('0x2e')],_0x4d306b['query']);_0xacb49a[_0x05a8('0x34')]=_['intersection'](_0x4d306b[_0x05a8('0x2e')],qs[_0x05a8('0x33')](_0x49ec7e[_0x05a8('0x2f')][_0x05a8('0x33')]));_0xacb49a[_0x05a8('0x34')]=_0xacb49a[_0x05a8('0x34')][_0x05a8('0x35')]?_0xacb49a['attributes']:_0x4d306b[_0x05a8('0x2e')];if(_0x49ec7e[_0x05a8('0x2f')][_0x05a8('0x40')]){_0xacb49a[_0x05a8('0x41')]=[{'all':!![]}];}_0xacb49a=_[_0x05a8('0x3e')]({},_0xacb49a,_0x49ec7e['options']);return db[_0x05a8('0x29')][_0x05a8('0x45')](_0xacb49a)[_0x05a8('0x25')](handleEntityNotFound(_0x19dcad,null))['then'](respondWithResult(_0x19dcad,null))['catch'](handleError(_0x19dcad,null));};exports['create']=function(_0x23ceb3,_0x234c0b){return db[_0x05a8('0x29')]['create'](_0x23ceb3[_0x05a8('0x46')],{})[_0x05a8('0x25')](respondWithResult(_0x234c0b,0xc9))['catch'](handleError(_0x234c0b,null));};exports[_0x05a8('0x23')]=function(_0x1903d7,_0x5393d5){if(_0x1903d7[_0x05a8('0x46')]['id']){delete _0x1903d7['body']['id'];}return db[_0x05a8('0x29')][_0x05a8('0x45')]({'where':{'id':_0x1903d7[_0x05a8('0x47')]['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0x5393d5,null))['then'](saveUpdates(_0x1903d7[_0x05a8('0x46')],null))[_0x05a8('0x25')](respondWithResult(_0x5393d5,null))[_0x05a8('0x44')](handleError(_0x5393d5,null));};exports[_0x05a8('0x24')]=function(_0x389a59,_0xe67edc){return db[_0x05a8('0x29')]['find']({'where':{'id':_0x389a59['params']['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0xe67edc,null))[_0x05a8('0x25')](removeEntity(_0xe67edc,null))[_0x05a8('0x44')](handleError(_0xe67edc,null));};exports[_0x05a8('0x48')]=function(_0x302b16,_0x3452b7,_0x1feba8){return db[_0x05a8('0x49')][_0x05a8('0x45')]({'where':{'id':_0x302b16[_0x05a8('0x47')]['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0x3452b7,null))['then'](function(_0x492a90){if(_0x492a90){return _0x492a90['addConditions'](_0x302b16[_0x05a8('0x46')][_0x05a8('0x4a')],_['omit'](_0x302b16['body'],[_0x05a8('0x4a'),'id'])||{});}})[_0x05a8('0x25')](respondWithResult(_0x3452b7,null))[_0x05a8('0x44')](handleError(_0x3452b7,null));};exports[_0x05a8('0x4b')]=function(_0x25a569,_0x4b29c7,_0xe0e5f8){var _0x3ec0d3={};var _0x4f7cfb={};var _0x3e38e2;var _0xef61e3;return db[_0x05a8('0x29')][_0x05a8('0x4c')]({'where':{'id':_0x25a569['params']['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0x4b29c7,null))[_0x05a8('0x25')](function(_0x15c640){if(_0x15c640){_0x3e38e2=_0x15c640;_0x4f7cfb[_0x05a8('0x2e')]=_[_0x05a8('0x30')](db['Condition'][_0x05a8('0x2a')]);_0x4f7cfb[_0x05a8('0x2f')]=_['keys'](_0x25a569[_0x05a8('0x2f')]);_0x4f7cfb['filters']=_[_0x05a8('0x32')](_0x4f7cfb['model'],_0x4f7cfb['query']);_0x3ec0d3[_0x05a8('0x34')]=_[_0x05a8('0x32')](_0x4f7cfb[_0x05a8('0x2e')],qs['fields'](_0x25a569[_0x05a8('0x2f')]['fields']));_0x3ec0d3[_0x05a8('0x34')]=_0x3ec0d3[_0x05a8('0x34')][_0x05a8('0x35')]?_0x3ec0d3['attributes']:_0x4f7cfb['model'];_0x3ec0d3[_0x05a8('0x38')]=qs[_0x05a8('0x39')](_0x25a569[_0x05a8('0x2f')][_0x05a8('0x39')]);_0x3ec0d3[_0x05a8('0x3a')]=qs[_0x05a8('0x31')](_['pick'](_0x25a569[_0x05a8('0x2f')],_0x4f7cfb[_0x05a8('0x31')]));if(_0x25a569[_0x05a8('0x2f')][_0x05a8('0x3c')]){_0x3ec0d3[_0x05a8('0x3a')]=_[_0x05a8('0x3e')](_0x3ec0d3[_0x05a8('0x3a')],{'$or':_[_0x05a8('0x28')](_0x3ec0d3[_0x05a8('0x34')],function(_0x2ce3d4){var _0x1e1c60={};_0x1e1c60[_0x2ce3d4]={'$like':'%'+_0x25a569[_0x05a8('0x2f')][_0x05a8('0x3c')]+'%'};return _0x1e1c60;})});}_0x3ec0d3=_[_0x05a8('0x3e')]({},_0x3ec0d3,_0x25a569[_0x05a8('0x3f')]);return _0x3e38e2[_0x05a8('0x4b')](_0x3ec0d3);}})[_0x05a8('0x25')](function(_0x337b44){if(_0x337b44){_0xef61e3=_0x337b44[_0x05a8('0x35')];if(!_0x25a569[_0x05a8('0x2f')]['hasOwnProperty'](_0x05a8('0x37'))){_0x3ec0d3[_0x05a8('0x1c')]=qs[_0x05a8('0x1c')](_0x25a569[_0x05a8('0x2f')]['limit']);_0x3ec0d3[_0x05a8('0x1a')]=qs['offset'](_0x25a569[_0x05a8('0x2f')][_0x05a8('0x1a')]);}return _0x3e38e2[_0x05a8('0x4b')](_0x3ec0d3);}})['then'](function(_0x15b959){if(_0x15b959){return _0x15b959?{'count':_0xef61e3,'rows':_0x15b959}:null;}})[_0x05a8('0x25')](respondWithResult(_0x4b29c7,null))[_0x05a8('0x44')](handleError(_0x4b29c7,null));};exports[_0x05a8('0x4d')]=function(_0x35d662,_0x56901a,_0xc0d7ca){return db[_0x05a8('0x4e')][_0x05a8('0x45')]({'where':{'id':_0x35d662['params']['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0x56901a,null))['then'](function(_0x2be83a){if(_0x2be83a){return _0x2be83a[_0x05a8('0x4d')](_0x35d662['body'][_0x05a8('0x4a')],_['omit'](_0x35d662[_0x05a8('0x46')],['ids','id'])||{});}})[_0x05a8('0x25')](respondWithResult(_0x56901a,null))[_0x05a8('0x44')](handleError(_0x56901a,null));};exports['getActions']=function(_0x5dafc8,_0x15091a,_0x18c3d2){var _0x4c6f37={};var _0x1acc16={};var _0x5d815b;var _0x12a20d;return db[_0x05a8('0x29')]['findOne']({'where':{'id':_0x5dafc8[_0x05a8('0x47')]['id']}})[_0x05a8('0x25')](handleEntityNotFound(_0x15091a,null))[_0x05a8('0x25')](function(_0x1fd41a){if(_0x1fd41a){_0x5d815b=_0x1fd41a;_0x1acc16['model']=_[_0x05a8('0x30')](db[_0x05a8('0x4e')]['rawAttributes']);_0x1acc16[_0x05a8('0x2f')]=_['keys'](_0x5dafc8[_0x05a8('0x2f')]);_0x1acc16['filters']=_['intersection'](_0x1acc16[_0x05a8('0x2e')],_0x1acc16[_0x05a8('0x2f')]);_0x4c6f37[_0x05a8('0x34')]=_[_0x05a8('0x32')](_0x1acc16[_0x05a8('0x2e')],qs[_0x05a8('0x33')](_0x5dafc8[_0x05a8('0x2f')][_0x05a8('0x33')]));_0x4c6f37[_0x05a8('0x34')]=_0x4c6f37[_0x05a8('0x34')][_0x05a8('0x35')]?_0x4c6f37[_0x05a8('0x34')]:_0x1acc16[_0x05a8('0x2e')];_0x4c6f37['order']=qs[_0x05a8('0x39')](_0x5dafc8[_0x05a8('0x2f')][_0x05a8('0x39')]);_0x4c6f37[_0x05a8('0x3a')]=qs[_0x05a8('0x31')](_[_0x05a8('0x3b')](_0x5dafc8[_0x05a8('0x2f')],_0x1acc16['filters']));if(_0x5dafc8['query'][_0x05a8('0x3c')]){_0x4c6f37[_0x05a8('0x3a')]=_['merge'](_0x4c6f37[_0x05a8('0x3a')],{'$or':_['map'](_0x4c6f37[_0x05a8('0x34')],function(_0x4aee51){var _0x3f8b70={};_0x3f8b70[_0x4aee51]={'$like':'%'+_0x5dafc8[_0x05a8('0x2f')][_0x05a8('0x3c')]+'%'};return _0x3f8b70;})});}_0x4c6f37=_[_0x05a8('0x3e')]({},_0x4c6f37,_0x5dafc8[_0x05a8('0x3f')]);return _0x5d815b[_0x05a8('0x4f')](_0x4c6f37);}})[_0x05a8('0x25')](function(_0x55d4b8){if(_0x55d4b8){_0x12a20d=_0x55d4b8[_0x05a8('0x35')];if(!_0x5dafc8['query'][_0x05a8('0x36')](_0x05a8('0x37'))){_0x4c6f37['limit']=qs['limit'](_0x5dafc8[_0x05a8('0x2f')]['limit']);_0x4c6f37[_0x05a8('0x1a')]=qs['offset'](_0x5dafc8['query'][_0x05a8('0x1a')]);}return _0x5d815b['getActions'](_0x4c6f37);}})[_0x05a8('0x25')](function(_0x4d06d4){if(_0x4d06d4){return _0x4d06d4?{'count':_0x12a20d,'rows':_0x4d06d4}:null;}})['then'](respondWithResult(_0x15091a,null))[_0x05a8('0x44')](handleError(_0x15091a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 24e6204..8946d48 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 _0xdb8d=['define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports'];(function(_0x5f39ba,_0x319415){var _0x22b87b=function(_0x33afcd){while(--_0x33afcd){_0x5f39ba['push'](_0x5f39ba['shift']());}};_0x22b87b(++_0x319415);}(_0xdb8d,0x1af));var _0xddb8=function(_0x3d61b1,_0x2c749d){_0x3d61b1=_0x3d61b1-0x0;var _0x1309cb=_0xdb8d[_0x3d61b1];return _0x1309cb;};'use strict';var _=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var logger=require(_0xddb8('0x2'))(_0xddb8('0x3'));var moment=require(_0xddb8('0x4'));var BPromise=require(_0xddb8('0x5'));var rp=require(_0xddb8('0x6'));var fs=require('fs');var path=require(_0xddb8('0x7'));var rimraf=require('rimraf');var config=require(_0xddb8('0x8'));var attributes=require(_0xddb8('0x9'));module[_0xddb8('0xa')]=function(_0x81c7fe,_0xd95b90){return _0x81c7fe[_0xddb8('0xb')](_0xddb8('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f8=['../../config/logger','moment','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf3f8,0x1ae));var _0x8f3f=function(_0x1c44b4,_0x107d48){_0x1c44b4=_0x1c44b4-0x0;var _0x14b3f0=_0xf3f8[_0x1c44b4];return _0x14b3f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f3f('0x0'))('api');var moment=require(_0x8f3f('0x1'));var BPromise=require('bluebird');var rp=require(_0x8f3f('0x2'));var fs=require('fs');var path=require(_0x8f3f('0x3'));var rimraf=require('rimraf');var config=require(_0x8f3f('0x4'));var attributes=require(_0x8f3f('0x5'));module[_0x8f3f('0x6')]=function(_0x484a26,_0x365289){return _0x484a26[_0x8f3f('0x7')](_0x8f3f('0x8'),attributes,{'tableName':_0x8f3f('0x9'),'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 6e6a391..31e66c5 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 _0x0ac0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ac0,0x130));var _0x00ac=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x0ac0[_0x1bb812];return _0x372adb;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var moment=require(_0x00ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x00ac('0x3'));var fs=require('fs');var Redis=require(_0x00ac('0x4'));var db=require(_0x00ac('0x5'))['db'];var utils=require(_0x00ac('0x6'));var logger=require(_0x00ac('0x7'))(_0x00ac('0x8'));var config=require(_0x00ac('0x9'));var jayson=require(_0x00ac('0xa'));var client=jayson['client'][_0x00ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a17e,_0x3546f0,_0x282faa){return new BPromise(function(_0x4427de,_0x121a9e){return client[_0x00ac('0xc')](_0xa2a17e,_0x282faa)['then'](function(_0x48c47e){logger[_0x00ac('0xd')](_0x00ac('0xe'),_0x3546f0,_0x00ac('0xf'));logger[_0x00ac('0x10')](_0x00ac('0x11'),_0x3546f0,'request\x20sent',JSON[_0x00ac('0x12')](_0x48c47e));if(_0x48c47e['error']){if(_0x48c47e[_0x00ac('0x13')]['code']===0x1f4){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x48c47e[_0x00ac('0x13')][_0x00ac('0x14')]);return _0x121a9e(_0x48c47e['error']['message']);}logger[_0x00ac('0x13')]('Automation,\x20%s,\x20%s',_0x3546f0,_0x48c47e['error'][_0x00ac('0x14')]);return _0x4427de(_0x48c47e[_0x00ac('0x13')]['message']);}else{logger[_0x00ac('0xd')]('Automation,\x20%s,\x20%s',_0x3546f0,'request\x20sent');_0x4427de(_0x48c47e[_0x00ac('0x15')][_0x00ac('0x14')]);}})['catch'](function(_0x66e4ba){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x66e4ba);_0x121a9e(_0x66e4ba);});});} \ No newline at end of file +var _0x0664=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0x4fd732,_0x38dbc8){var _0x1ca377=function(_0x115ad9){while(--_0x115ad9){_0x4fd732['push'](_0x4fd732['shift']());}};_0x1ca377(++_0x38dbc8);}(_0x0664,0x93));var _0x4066=function(_0x307aff,_0x3eda2b){_0x307aff=_0x307aff-0x0;var _0x5958e9=_0x0664[_0x307aff];return _0x5958e9;};'use strict';var _=require('lodash');var util=require(_0x4066('0x0'));var moment=require('moment');var BPromise=require(_0x4066('0x1'));var rs=require(_0x4066('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4066('0x3'))['db'];var utils=require(_0x4066('0x4'));var logger=require(_0x4066('0x5'))(_0x4066('0x6'));var config=require(_0x4066('0x7'));var jayson=require(_0x4066('0x8'));var client=jayson[_0x4066('0x9')][_0x4066('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143de5,_0x458fa7,_0x4ff15a){return new BPromise(function(_0x383df4,_0x5d360d){return client[_0x4066('0xb')](_0x143de5,_0x4ff15a)[_0x4066('0xc')](function(_0x48333f){logger['info'](_0x4066('0xd'),_0x458fa7,_0x4066('0xe'));logger[_0x4066('0xf')](_0x4066('0x10'),_0x458fa7,'request\x20sent',JSON['stringify'](_0x48333f));if(_0x48333f['error']){if(_0x48333f['error'][_0x4066('0x11')]===0x1f4){logger[_0x4066('0x12')](_0x4066('0xd'),_0x458fa7,_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);return _0x5d360d(_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);}logger[_0x4066('0x12')]('Automation,\x20%s,\x20%s',_0x458fa7,_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);return _0x383df4(_0x48333f['error'][_0x4066('0x13')]);}else{logger['info'](_0x4066('0xd'),_0x458fa7,'request\x20sent');_0x383df4(_0x48333f['result'][_0x4066('0x13')]);}})[_0x4066('0x14')](function(_0x309ffc){logger[_0x4066('0x12')](_0x4066('0xd'),_0x458fa7,_0x309ffc);_0x5d360d(_0x309ffc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index fcd5a4f..5af1309 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 _0xcc19=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','multer','util','connect-timeout'];(function(_0x1fe63a,_0x2dc8dd){var _0x3fb1ac=function(_0x234755){while(--_0x234755){_0x1fe63a['push'](_0x1fe63a['shift']());}};_0x3fb1ac(++_0x2dc8dd);}(_0xcc19,0xbd));var _0x9cc1=function(_0x585723,_0x25250e){_0x585723=_0x585723-0x0;var _0x54edcf=_0xcc19[_0x585723];return _0x54edcf;};'use strict';var multer=require(_0x9cc1('0x0'));var util=require(_0x9cc1('0x1'));var path=require('path');var timeout=require(_0x9cc1('0x2'));var express=require(_0x9cc1('0x3'));var router=express[_0x9cc1('0x4')]();var fs_extra=require(_0x9cc1('0x5'));var auth=require(_0x9cc1('0x6'));var interaction=require(_0x9cc1('0x7'));var config=require(_0x9cc1('0x8'));var controller=require(_0x9cc1('0x9'));router[_0x9cc1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cc1('0xa')](_0x9cc1('0xb'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0xd')]);router[_0x9cc1('0xa')](_0x9cc1('0xe'),auth['isAuthenticated'](),controller[_0x9cc1('0xf')]);router[_0x9cc1('0xa')](_0x9cc1('0x10'),auth[_0x9cc1('0xc')](),controller['getActions']);router[_0x9cc1('0x11')]('/',auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x12')]);router[_0x9cc1('0x11')](_0x9cc1('0xe'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x13')]);router['post'](_0x9cc1('0x10'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x14')]);router[_0x9cc1('0x15')](_0x9cc1('0xb'),auth[_0x9cc1('0xc')](),controller[_0x9cc1('0x16')]);router[_0x9cc1('0x17')](_0x9cc1('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcf1c=['destroy','multer','util','connect-timeout','express','Router','fs-extra','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','update','delete'];(function(_0x35e9ce,_0x4ebb8d){var _0x32e808=function(_0x468fad){while(--_0x468fad){_0x35e9ce['push'](_0x35e9ce['shift']());}};_0x32e808(++_0x4ebb8d);}(_0xcf1c,0x18d));var _0xccf1=function(_0x503bc0,_0x12aeee){_0x503bc0=_0x503bc0-0x0;var _0x383246=_0xcf1c[_0x503bc0];return _0x383246;};'use strict';var multer=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var path=require('path');var timeout=require(_0xccf1('0x2'));var express=require(_0xccf1('0x3'));var router=express[_0xccf1('0x4')]();var fs_extra=require(_0xccf1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xccf1('0x6'));router['get']('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0x8')]);router[_0xccf1('0x9')](_0xccf1('0xa'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xb')]);router[_0xccf1('0x9')](_0xccf1('0xc'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xd')]);router[_0xccf1('0x9')](_0xccf1('0xe'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xf')]);router[_0xccf1('0x10')]('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0x11')]);router['post']('/:id/conditions',auth[_0xccf1('0x7')](),controller[_0xccf1('0x12')]);router[_0xccf1('0x10')](_0xccf1('0xe'),auth[_0xccf1('0x7')](),controller['addActions']);router['put'](_0xccf1('0xa'),auth[_0xccf1('0x7')](),controller[_0xccf1('0x13')]);router[_0xccf1('0x14')](_0xccf1('0xa'),auth['isAuthenticated'](),controller[_0xccf1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3a33eef..2535892 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 _0x0320=['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,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x9745b5,_0x44c501){var _0x129f18=function(_0x3db002){while(--_0x3db002){_0x9745b5['push'](_0x9745b5['shift']());}};_0x129f18(++_0x44c501);}(_0x0320,0x104));var _0x0032=function(_0x745e7b,_0x2d6861){_0x745e7b=_0x745e7b-0x0;var _0x28ae75=_0x0320[_0x745e7b];return _0x28ae75;};'use strict';var Sequelize=require('sequelize');module[_0x0032('0x0')]={'name':{'type':Sequelize[_0x0032('0x1')],'unique':_0x0032('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0032('0x3')](_0x0032('0x4')),'allowNull':![],'defaultValue':_0x0032('0x4')},'description':{'type':Sequelize[_0x0032('0x1')]},'active':{'type':Sequelize[_0x0032('0x5')],'defaultValue':0x0,'comment':_0x0032('0x6')},'limitCalls':{'type':Sequelize[_0x0032('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0032('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0032('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0032('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0032('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0032('0x1')],'defaultValue':_0x0032('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x0032('0x3')]('always',_0x0032('0x12'),_0x0032('0x13')),'defaultValue':_0x0032('0x14')},'dialAMDActive':{'type':Sequelize[_0x0032('0x5')],'defaultValue':0x0,'comment':_0x0032('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0032('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0032('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0032('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0032('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0032('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0032('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0032('0x7')](0x9)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0032('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0032('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0032('0x3')](_0x0032('0x1c'),'ASC'),'defaultValue':_0x0032('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0032('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0032('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0032('0x7')](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0032('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0032('0x7')](0x3)[_0x0032('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0032('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0032('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xc080=['UNSIGNED','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER'];(function(_0x15457f,_0x398a80){var _0x3e8bab=function(_0x5c96ee){while(--_0x5c96ee){_0x15457f['push'](_0x15457f['shift']());}};_0x3e8bab(++_0x398a80);}(_0xc080,0x16b));var _0x0c08=function(_0x131211,_0x52429d){_0x131211=_0x131211-0x0;var _0x151d10=_0xc080[_0x131211];return _0x151d10;};'use strict';var Sequelize=require(_0x0c08('0x0'));module[_0x0c08('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0c08('0x2')](_0x0c08('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0c08('0x4')],'defaultValue':0x0,'comment':_0x0c08('0x5')},'limitCalls':{'type':Sequelize[_0x0c08('0x6')](0x4)[_0x0c08('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0c08('0x8')]},'dialOriginateTimeout':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'defaultValue':0x3,'comment':_0x0c08('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0c08('0xe')},'dialTimezone':{'type':Sequelize[_0x0c08('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x0c08('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x0c08('0x2')](_0x0c08('0x10'),_0x0c08('0x11'),_0x0c08('0x12')),'defaultValue':_0x0c08('0x10')},'dialAMDActive':{'type':Sequelize[_0x0c08('0x4')],'defaultValue':0x0,'comment':_0x0c08('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x0c08('0x6')](0x9)[_0x0c08('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0c08('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0c08('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0c08('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0c08('0x6')](0x9)[_0x0c08('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0c08('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0c08('0x6')](0x9)[_0x0c08('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0c08('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0c08('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0c08('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0c08('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0c08('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0c08('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0c08('0x6')](0x9)[_0x0c08('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0c08('0x2')](_0x0c08('0x1a'),'ASC'),'defaultValue':_0x0c08('0x1a')},'dialPrefix':{'type':Sequelize[_0x0c08('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0c08('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0c08('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)[_0x0c08('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0c08('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0c08('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0c08('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0c08('0x6')](0x5)[_0x0c08('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0c08('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9ecad9c..29d51f3 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 _0x28f2=['stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','Campaign','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filter','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','findOne','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','CmListId','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x28f2,0x193));var _0x228f=function(_0x40b3ee,_0x334d5a){_0x40b3ee=_0x40b3ee-0x0;var _0x2012fa=_0x28f2[_0x40b3ee];return _0x2012fa;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['Campaign'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x53')]=function(_0x561144,_0x3e9f76){var _0x3da11f={'where':{'id':_0x561144[_0x228f('0x54')]['id']}},_0x671142={};_0x671142['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x3da11f[_0x228f('0x38')]=_['intersection'](_0x671142[_0x228f('0x34')],qs[_0x228f('0x39')](_0x561144['query'][_0x228f('0x39')]));_0x3da11f[_0x228f('0x38')]=_0x3da11f[_0x228f('0x38')][_0x228f('0x3a')]?_0x3da11f[_0x228f('0x38')]:_0x671142[_0x228f('0x34')];if(_0x561144[_0x228f('0x35')][_0x228f('0x4a')]){_0x3da11f[_0x228f('0x44')]=[{'all':!![]}];}_0x3da11f=_[_0x228f('0x41')]({},_0x3da11f,_0x561144['options']);return db[_0x228f('0x42')]['find'](_0x3da11f)[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](function(_0x159713){if(_0x159713){var _0x18e97b=_0x159713[_0x228f('0x28')]({'plain':!![]});_0x18e97b=qs[_0x228f('0x55')](_0x18e97b,['id',_0x228f('0x56'),_0x228f('0x57')]);_0x561144['body']=_[_0x228f('0x55')](_0x561144[_0x228f('0x4e')],['id',_0x228f('0x56'),'updatedAt']);return db[_0x228f('0x42')]['create'](_[_0x228f('0x41')](_0x18e97b,_0x561144[_0x228f('0x4e')]),{'include':_0x561144['query'][_0x228f('0x4a')]?[{'all':!![]}]:undefined})[_0x228f('0x26')](function(_0x16318d){var _0xb8200d=_0x561144[_0x228f('0x58')][_0x228f('0x28')]({'plain':!![]});if(!_0xb8200d)throw new Error(_0x228f('0x4f'));if(_0xb8200d[_0x228f('0x50')]===_0x228f('0x58')){var _0x45c9ed=_0x16318d[_0x228f('0x28')]({'plain':!![]});var _0x551133=_0x228f('0x29');return db[_0x228f('0x59')][_0x228f('0x4c')]({'where':{'name':_0x551133,'userProfileId':_0xb8200d[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x506191){if(_0x506191&&_0x506191['autoAssociation']===0x0){return db[_0x228f('0x2a')]['create']({'name':_0x45c9ed[_0x228f('0x2d')],'resourceId':_0x45c9ed['id'],'type':_0x506191['name'],'sectionId':_0x506191['id']},{})[_0x228f('0x26')](function(){return _0x16318d;});}else{return _0x16318d;}})[_0x228f('0x47')](function(_0x53a6a5){logger[_0x228f('0x2b')](_0x228f('0x5a'),_0x53a6a5);throw _0x53a6a5;});}return _0x16318d;});}})[_0x228f('0x26')](respondWithResult(_0x3e9f76,0xc9))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports['update']=function(_0x42dd54,_0x21f860){if(_0x42dd54[_0x228f('0x4e')]['id']){delete _0x42dd54[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x42dd54[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x21f860,null))['then'](saveUpdates(_0x42dd54[_0x228f('0x4e')],null))[_0x228f('0x26')](respondWithResult(_0x21f860,null))[_0x228f('0x47')](handleError(_0x21f860,null));};exports[_0x228f('0x27')]=function(_0x2844d2,_0x4ebf7a){return db[_0x228f('0x42')]['find']({'where':{'id':_0x2844d2[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x4ebf7a,null))['then'](removeEntity(_0x4ebf7a,null))[_0x228f('0x47')](handleError(_0x4ebf7a,null));};exports[_0x228f('0x5b')]=function(_0x260e70,_0x5eb9ed,_0x3e7b01){var _0x2d5d67={'raw':!![],'where':{}};var _0x3d5769={};var _0x58a73f={'count':0x0,'rows':[]};return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x260e70[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x5eb9ed,null))['then'](function(_0x57e896){if(_0x57e896){_0x3d5769[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x5c')][_0x228f('0x31')]);_0x3d5769[_0x228f('0x35')]=_[_0x228f('0x49')](_0x260e70[_0x228f('0x35')]);_0x3d5769[_0x228f('0x36')]=_['intersection'](_0x3d5769[_0x228f('0x34')],_0x3d5769['query']);_0x2d5d67[_0x228f('0x38')]=_[_0x228f('0x37')](_0x3d5769[_0x228f('0x34')],qs[_0x228f('0x39')](_0x260e70[_0x228f('0x35')][_0x228f('0x39')]));_0x2d5d67[_0x228f('0x38')]=_0x2d5d67['attributes']['length']?_0x2d5d67[_0x228f('0x38')]:_0x3d5769[_0x228f('0x34')];if(!_0x260e70[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2d5d67[_0x228f('0x1f')]=qs['limit'](_0x260e70[_0x228f('0x35')][_0x228f('0x1f')]);_0x2d5d67[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x260e70[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2d5d67[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x260e70[_0x228f('0x35')]['sort']);_0x2d5d67[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x260e70[_0x228f('0x35')],_0x3d5769[_0x228f('0x36')]));_0x2d5d67['where']['CampaignId']=_0x57e896['id'];if(_0x260e70['query'][_0x228f('0x5d')]){_0x2d5d67['where']=_[_0x228f('0x41')](_0x2d5d67['where'],{'$or':_[_0x228f('0x30')](_0x2d5d67[_0x228f('0x38')],function(_0x5c1a7e){var _0x27ffdd={};_0x27ffdd[_0x5c1a7e]={'$like':'%'+_0x260e70[_0x228f('0x35')][_0x228f('0x5d')]+'%'};return _0x27ffdd;})});}_0x2d5d67=_[_0x228f('0x41')]({},_0x2d5d67,_0x260e70[_0x228f('0x4b')]);return db['CmHopper'][_0x228f('0x43')]({'where':_0x2d5d67[_0x228f('0x40')]})[_0x228f('0x26')](function(_0x265b11){_0x58a73f[_0x228f('0x43')]=_0x265b11;if(_0x260e70[_0x228f('0x35')][_0x228f('0x4a')]){_0x2d5d67[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x5c')]['findAll'](_0x2d5d67);})[_0x228f('0x26')](function(_0x6be7c4){_0x58a73f[_0x228f('0x46')]=_0x6be7c4;return _0x58a73f;});}})['then'](respondWithFilteredResult(_0x5eb9ed,_0x2d5d67))['catch'](handleError(_0x5eb9ed,null));};exports['getHopperHistories']=function(_0x2b9d40,_0x5e3a6e,_0x2d8e23){var _0x304001={'raw':!![],'where':{}};var _0x4b07c4={};var _0x1e24fd={'count':0x0,'rows':[]};return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x2b9d40[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x5e3a6e,null))[_0x228f('0x26')](function(_0x32ea8d){if(_0x32ea8d){_0x4b07c4['model']=_[_0x228f('0x49')](db[_0x228f('0x5e')][_0x228f('0x31')]);_0x4b07c4[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2b9d40[_0x228f('0x35')]);_0x4b07c4[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4b07c4[_0x228f('0x34')],_0x4b07c4['query']);_0x304001[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4b07c4[_0x228f('0x34')],qs[_0x228f('0x39')](_0x2b9d40[_0x228f('0x35')]['fields']));_0x304001['attributes']=_0x304001[_0x228f('0x38')]['length']?_0x304001[_0x228f('0x38')]:_0x4b07c4['model'];if(!_0x2b9d40[_0x228f('0x35')]['hasOwnProperty'](_0x228f('0x3c'))){_0x304001[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x1f')]);_0x304001[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x1e')]);}_0x304001[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x2b9d40[_0x228f('0x35')][_0x228f('0x3e')]);_0x304001[_0x228f('0x40')]=qs[_0x228f('0x36')](_[_0x228f('0x3f')](_0x2b9d40['query'],_0x4b07c4[_0x228f('0x36')]));_0x304001[_0x228f('0x40')][_0x228f('0x5f')]=_0x32ea8d['id'];if(_0x2b9d40['query'][_0x228f('0x5d')]){_0x304001['where']=_['merge'](_0x304001['where'],{'$or':_[_0x228f('0x30')](_0x304001['attributes'],function(_0x22448b){var _0x11dd76={};_0x11dd76[_0x22448b]={'$like':'%'+_0x2b9d40['query'][_0x228f('0x5d')]+'%'};return _0x11dd76;})});}_0x304001=_[_0x228f('0x41')]({},_0x304001,_0x2b9d40['options']);return db[_0x228f('0x5e')][_0x228f('0x43')]({'where':_0x304001['where']})['then'](function(_0x2dfcee){_0x1e24fd[_0x228f('0x43')]=_0x2dfcee;if(_0x2b9d40[_0x228f('0x35')][_0x228f('0x4a')]){_0x304001['include']=[{'all':!![]}];}return db[_0x228f('0x5e')][_0x228f('0x45')](_0x304001);})['then'](function(_0x191bd5){_0x1e24fd[_0x228f('0x46')]=_0x191bd5;return _0x1e24fd;});}})[_0x228f('0x26')](respondWithFilteredResult(_0x5e3a6e,_0x304001))[_0x228f('0x47')](handleError(_0x5e3a6e,null));};exports[_0x228f('0x60')]=function(_0x30157c,_0x2dfaec,_0x25809c){var _0x5a1a8c={'raw':!![],'where':{}};var _0x5a7f73={};var _0x597271={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x30157c['params']['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x2dfaec,null))[_0x228f('0x26')](function(_0x30e525){if(_0x30e525){_0x5a7f73[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x61')][_0x228f('0x31')]);_0x5a7f73['query']=_[_0x228f('0x49')](_0x30157c['query']);_0x5a7f73['filters']=_['intersection'](_0x5a7f73['model'],_0x5a7f73[_0x228f('0x35')]);_0x5a1a8c['attributes']=_[_0x228f('0x37')](_0x5a7f73[_0x228f('0x34')],qs[_0x228f('0x39')](_0x30157c[_0x228f('0x35')]['fields']));_0x5a1a8c[_0x228f('0x38')]=_0x5a1a8c[_0x228f('0x38')][_0x228f('0x3a')]?_0x5a1a8c[_0x228f('0x38')]:_0x5a7f73[_0x228f('0x34')];if(!_0x30157c[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x5a1a8c[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x30157c[_0x228f('0x35')]['limit']);_0x5a1a8c['offset']=qs['offset'](_0x30157c[_0x228f('0x35')][_0x228f('0x1e')]);}_0x5a1a8c[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0x30157c[_0x228f('0x35')][_0x228f('0x3e')]);_0x5a1a8c[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x30157c[_0x228f('0x35')],_0x5a7f73[_0x228f('0x36')]));_0x5a1a8c[_0x228f('0x40')][_0x228f('0x5f')]=_0x30e525['id'];if(_0x30157c[_0x228f('0x35')][_0x228f('0x5d')]){_0x5a1a8c[_0x228f('0x40')]=_[_0x228f('0x41')](_0x5a1a8c[_0x228f('0x40')],{'$or':_['map'](_0x5a1a8c[_0x228f('0x38')],function(_0xd9a90f){var _0xecea94={};_0xecea94[_0xd9a90f]={'$like':'%'+_0x30157c['query']['filter']+'%'};return _0xecea94;})});}_0x5a1a8c=_[_0x228f('0x41')]({},_0x5a1a8c,_0x30157c['options']);return db[_0x228f('0x61')][_0x228f('0x43')]({'where':_0x5a1a8c[_0x228f('0x40')]})[_0x228f('0x26')](function(_0x590b79){_0x597271[_0x228f('0x43')]=_0x590b79;if(_0x30157c[_0x228f('0x35')][_0x228f('0x4a')]){_0x5a1a8c[_0x228f('0x44')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5a1a8c);})[_0x228f('0x26')](function(_0x578762){_0x597271[_0x228f('0x46')]=_0x578762;return _0x597271;});}})['then'](respondWithFilteredResult(_0x2dfaec,_0x5a1a8c))['catch'](handleError(_0x2dfaec,null));};exports['getHopperBlacks']=function(_0x2b1172,_0x4865e5,_0x3d20c9){var _0x3067d3={'raw':!![],'where':{}};var _0x21b11f={};var _0x45e5a0={'count':0x0,'rows':[]};return db[_0x228f('0x42')][_0x228f('0x62')]({'where':{'id':_0x2b1172[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x4865e5,null))[_0x228f('0x26')](function(_0x1e8511){if(_0x1e8511){_0x21b11f[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x63')][_0x228f('0x31')]);_0x21b11f[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2b1172[_0x228f('0x35')]);_0x21b11f['filters']=_[_0x228f('0x37')](_0x21b11f[_0x228f('0x34')],_0x21b11f['query']);_0x3067d3[_0x228f('0x38')]=_[_0x228f('0x37')](_0x21b11f[_0x228f('0x34')],qs[_0x228f('0x39')](_0x2b1172['query'][_0x228f('0x39')]));_0x3067d3[_0x228f('0x38')]=_0x3067d3[_0x228f('0x38')][_0x228f('0x3a')]?_0x3067d3[_0x228f('0x38')]:_0x21b11f['model'];if(!_0x2b1172['query'][_0x228f('0x3b')](_0x228f('0x3c'))){_0x3067d3['limit']=qs[_0x228f('0x1f')](_0x2b1172[_0x228f('0x35')][_0x228f('0x1f')]);_0x3067d3['offset']=qs[_0x228f('0x1e')](_0x2b1172[_0x228f('0x35')]['offset']);}_0x3067d3[_0x228f('0x3d')]=qs['sort'](_0x2b1172[_0x228f('0x35')][_0x228f('0x3e')]);_0x3067d3[_0x228f('0x40')]=qs[_0x228f('0x36')](_['pick'](_0x2b1172['query'],_0x21b11f[_0x228f('0x36')]));_0x3067d3['where'][_0x228f('0x5f')]=_0x1e8511['id'];if(_0x2b1172[_0x228f('0x35')][_0x228f('0x5d')]){_0x3067d3[_0x228f('0x40')]=_[_0x228f('0x41')](_0x3067d3['where'],{'$or':_[_0x228f('0x30')](_0x3067d3[_0x228f('0x38')],function(_0x69a9a5){var _0x5e4782={};_0x5e4782[_0x69a9a5]={'$like':'%'+_0x2b1172[_0x228f('0x35')]['filter']+'%'};return _0x5e4782;})});}_0x3067d3=_[_0x228f('0x41')]({},_0x3067d3,_0x2b1172[_0x228f('0x4b')]);return db['CmHopperBlack'][_0x228f('0x43')]({'where':_0x3067d3[_0x228f('0x40')]})[_0x228f('0x26')](function(_0xfbf021){_0x45e5a0['count']=_0xfbf021;if(_0x2b1172[_0x228f('0x35')][_0x228f('0x4a')]){_0x3067d3[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x63')][_0x228f('0x45')](_0x3067d3);})[_0x228f('0x26')](function(_0x57b1d6){_0x45e5a0[_0x228f('0x46')]=_0x57b1d6;return _0x45e5a0;});}})[_0x228f('0x26')](respondWithFilteredResult(_0x4865e5,_0x3067d3))[_0x228f('0x47')](handleError(_0x4865e5,null));};exports[_0x228f('0x64')]=function(_0x43e23d,_0x12c7c1,_0x36c9f7){var _0x543a66={};var _0x4b2196={};var _0x17b3ee;var _0x3a7546;return db[_0x228f('0x42')]['findOne']({'where':{'id':_0x43e23d[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x12c7c1,null))[_0x228f('0x26')](function(_0x46eac4){if(_0x46eac4){_0x17b3ee=_0x46eac4;_0x4b2196[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x65')][_0x228f('0x31')]);_0x4b2196['query']=_[_0x228f('0x49')](_0x43e23d['query']);_0x4b2196[_0x228f('0x36')]=_['intersection'](_0x4b2196['model'],_0x4b2196['query']);_0x543a66['attributes']=_['intersection'](_0x4b2196[_0x228f('0x34')],qs[_0x228f('0x39')](_0x43e23d[_0x228f('0x35')][_0x228f('0x39')]));_0x543a66[_0x228f('0x38')]=_0x543a66[_0x228f('0x38')][_0x228f('0x3a')]?_0x543a66[_0x228f('0x38')]:_0x4b2196[_0x228f('0x34')];_0x543a66['order']=qs[_0x228f('0x3e')](_0x43e23d['query'][_0x228f('0x3e')]);_0x543a66['where']=qs['filters'](_[_0x228f('0x3f')](_0x43e23d[_0x228f('0x35')],_0x4b2196[_0x228f('0x36')]));if(_0x43e23d['query'][_0x228f('0x5d')]){_0x543a66['where']=_[_0x228f('0x41')](_0x543a66[_0x228f('0x40')],{'$or':_[_0x228f('0x30')](_0x543a66[_0x228f('0x38')],function(_0x29e0d7){var _0x13731f={};_0x13731f[_0x29e0d7]={'$like':'%'+_0x43e23d[_0x228f('0x35')]['filter']+'%'};return _0x13731f;})});}_0x543a66=_[_0x228f('0x41')]({},_0x543a66,_0x43e23d[_0x228f('0x4b')]);return _0x17b3ee['getLists'](_0x543a66);}})[_0x228f('0x26')](function(_0x7908b){if(_0x7908b){_0x3a7546=_0x7908b[_0x228f('0x3a')];if(!_0x43e23d[_0x228f('0x35')][_0x228f('0x3b')]('nolimit')){_0x543a66['limit']=qs[_0x228f('0x1f')](_0x43e23d[_0x228f('0x35')]['limit']);_0x543a66[_0x228f('0x1e')]=qs['offset'](_0x43e23d[_0x228f('0x35')][_0x228f('0x1e')]);}return _0x17b3ee['getLists'](_0x543a66);}})[_0x228f('0x26')](function(_0x234a90){if(_0x234a90){return _0x234a90?{'count':_0x3a7546,'rows':_0x234a90}:null;}})['then'](respondWithResult(_0x12c7c1,null))[_0x228f('0x47')](handleError(_0x12c7c1,null));};exports[_0x228f('0x66')]=function(_0x5d4958,_0x1d821a,_0x1a144e){var _0x39c19d,_0x140e7e;var _0x1cda20=[];var _0x21b396=moment()[_0x228f('0x67')](_0x228f('0x68'));return db['Campaign'][_0x228f('0x4c')]({'where':{'id':_0x5d4958[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x1d821a,null))['then'](function(_0x4ee418){if(_0x4ee418){_0x140e7e=_0x4ee418;return _0x4ee418[_0x228f('0x66')](_0x5d4958[_0x228f('0x4e')]['ids'],_['omit'](_0x5d4958['body'],['ids','id'])||{});}return null;})[_0x228f('0x69')](function(_0x3d2266){var _0x4fde48;var _0xb37c02;_0x39c19d=_0x3d2266||[];var _0x3733e5=[];if(_0x3d2266){for(var _0x3eff08=0x0;_0x3eff08<_0x3d2266[_0x228f('0x3a')];_0x3eff08+=0x1){var _0x58ac49=_0x3d2266[_0x3eff08][_0x228f('0x28')]({'plain':!![]});_0x140e7e['dialCheckDuplicateType']=_0x5d4958[_0x228f('0x4e')][_0x228f('0x6a')]?_0x5d4958['body'][_0x228f('0x6a')]:_0x140e7e[_0x228f('0x6a')];switch(_0x140e7e[_0x228f('0x6a')]){case _0x228f('0x6b'):_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x6e'))['fromQuery'](['phone',_0x228f('0x6f'),_0x228f('0x70'),_0x228f('0x71'),_0x228f('0x5f'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),'scheduledAt')[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x58ac49['CmListId'][_0x228f('0x76')](),_0x228f('0x71'))[_0x228f('0x73')](_0x5d4958[_0x228f('0x54')]['id']['toString'](),_0x228f('0x5f'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x57'))['from'](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))[_0x228f('0x40')]('ListId\x20=\x20?',_0x58ac49['CmListId']['toString']())[_0x228f('0x40')](_0x228f('0x79'))[_0x228f('0x40')](_0x228f('0x7a'),squel[_0x228f('0x72')]()['field'](_0x228f('0x7b'))[_0x228f('0x7c')](_0x228f('0x7d'))['where'](_0x228f('0x7e'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]()))['where'](_0x228f('0x7a'),squel[_0x228f('0x72')]()[_0x228f('0x73')]('COALESCE(phone,\x27\x27)')[_0x228f('0x7c')](_0x228f('0x6e'))['where'](_0x228f('0x7e'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]())))[_0x228f('0x76')]();break;case _0x228f('0x7f'):_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')]('cm_hopper')[_0x228f('0x80')]([_0x228f('0x74'),'scheduledAt','ContactId',_0x228f('0x71'),'CampaignId',_0x228f('0x56'),_0x228f('0x57')],squel['select']()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),_0x228f('0x6f'))[_0x228f('0x73')]('id','ContactId')[_0x228f('0x73')](_0x58ac49[_0x228f('0x81')][_0x228f('0x76')](),_0x228f('0x71'))[_0x228f('0x73')](_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')](),'CampaignId')[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))['field']('\x27'+_0x21b396+'\x27','updatedAt')[_0x228f('0x7c')](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))[_0x228f('0x40')](_0x228f('0x82'),_0x58ac49['CmListId'][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x79'))[_0x228f('0x40')](_0x228f('0x7a'),squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x83'))[_0x228f('0x7c')](_0x228f('0x6e'))[_0x228f('0x40')](_0x228f('0x7e'),_0x5d4958['params']['id'][_0x228f('0x76')]())))[_0x228f('0x76')]();break;default:_0x4fde48=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x6e'))['fromQuery']([_0x228f('0x74'),'scheduledAt',_0x228f('0x70'),'ListId',_0x228f('0x5f'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')](_0x228f('0x75'),_0x228f('0x6f'))[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x58ac49[_0x228f('0x81')][_0x228f('0x76')](),'ListId')[_0x228f('0x73')](_0x5d4958['params']['id'][_0x228f('0x76')](),_0x228f('0x5f'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27','updatedAt')[_0x228f('0x7c')](_0x228f('0x77'))['where'](_0x228f('0x78'))[_0x228f('0x40')](_0x228f('0x82'),_0x58ac49[_0x228f('0x81')][_0x228f('0x76')]())['where'](_0x228f('0x79')))[_0x228f('0x76')]();}_0xb37c02=squel['insert']()[_0x228f('0x6d')]('cm_hopper_additional_phones')[_0x228f('0x80')](['cmHopperId',_0x228f('0x6f'),_0x228f('0x74'),_0x228f('0x84'),_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()['field'](_0x228f('0x85'),'id')[_0x228f('0x73')]('NOW()',_0x228f('0x6f'))[_0x228f('0x73')](_0x228f('0x86'),_0x228f('0x74'))['field']('ci.OrderBY','OrderBy')['field']('\x27'+_0x21b396+'\x27',_0x228f('0x56'))[_0x228f('0x73')]('\x27'+_0x21b396+'\x27',_0x228f('0x57'))[_0x228f('0x7c')](_0x228f('0x87'),'ci')['join'](_0x228f('0x6e'),'h',_0x228f('0x88'))[_0x228f('0x40')](_0x228f('0x89'),_0x58ac49[_0x228f('0x81')][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x8a'),_0x5d4958[_0x228f('0x54')]['id'][_0x228f('0x76')]())[_0x228f('0x40')](_0x228f('0x8b'),_0x21b396))[_0x228f('0x76')]();_0x3733e5['push'](db[_0x228f('0x8c')][_0x228f('0x35')](_0x4fde48));_0x1cda20[_0x228f('0x8d')](db[_0x228f('0x8c')]['query'](_0xb37c02));}return BPromise['all'](_0x3733e5);}})[_0x228f('0x26')](function(){return BPromise[_0x228f('0x8e')](_0x1cda20);})[_0x228f('0x26')](function(){return _0x39c19d;})[_0x228f('0x26')](respondWithResult(_0x1d821a,null))[_0x228f('0x47')](handleError(_0x1d821a,null));};exports[_0x228f('0x8f')]=function(_0x3c73ee,_0x57582d,_0x47e033){return db[_0x228f('0x42')]['find']({'where':{'id':_0x3c73ee[_0x228f('0x54')]['id']}})['then'](handleEntityNotFound(_0x57582d,null))['then'](function(_0x28abec){if(_0x28abec){return _0x28abec[_0x228f('0x8f')](_0x3c73ee[_0x228f('0x35')]['ids']);}})[_0x228f('0x26')](function(_0x48d339){if(_0x48d339){return db[_0x228f('0x5c')][_0x228f('0x27')]({'where':{'ListId':_0x3c73ee[_0x228f('0x35')][_0x228f('0x90')],'CampaignId':_0x3c73ee[_0x228f('0x54')]['id']}})['then'](function(){return _0x48d339;});}})[_0x228f('0x26')](respondWithStatusCode(_0x57582d,null))[_0x228f('0x47')](handleError(_0x57582d,null));};exports[_0x228f('0x91')]=function(_0x3267f4,_0x19ff0a,_0x5ea3a4){var _0x293723={};var _0x568259={};var _0x471f8e;var _0x57d2b5;return db[_0x228f('0x42')][_0x228f('0x62')]({'where':{'id':_0x3267f4[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x19ff0a,null))[_0x228f('0x26')](function(_0x51a0e0){if(_0x51a0e0){_0x471f8e=_0x51a0e0;_0x568259[_0x228f('0x34')]=_[_0x228f('0x49')](db[_0x228f('0x65')][_0x228f('0x31')]);_0x568259[_0x228f('0x35')]=_[_0x228f('0x49')](_0x3267f4[_0x228f('0x35')]);_0x568259['filters']=_['intersection'](_0x568259['model'],_0x568259[_0x228f('0x35')]);_0x293723[_0x228f('0x38')]=_[_0x228f('0x37')](_0x568259[_0x228f('0x34')],qs[_0x228f('0x39')](_0x3267f4[_0x228f('0x35')][_0x228f('0x39')]));_0x293723[_0x228f('0x38')]=_0x293723['attributes'][_0x228f('0x3a')]?_0x293723[_0x228f('0x38')]:_0x568259['model'];_0x293723['order']=qs['sort'](_0x3267f4[_0x228f('0x35')][_0x228f('0x3e')]);_0x293723[_0x228f('0x40')]=qs[_0x228f('0x36')](_[_0x228f('0x3f')](_0x3267f4[_0x228f('0x35')],_0x568259['filters']));if(_0x3267f4['query'][_0x228f('0x5d')]){_0x293723[_0x228f('0x40')]=_['merge'](_0x293723[_0x228f('0x40')],{'$or':_[_0x228f('0x30')](_0x293723['attributes'],function(_0x205438){var _0x2eaeec={};_0x2eaeec[_0x205438]={'$like':'%'+_0x3267f4[_0x228f('0x35')][_0x228f('0x5d')]+'%'};return _0x2eaeec;})});}_0x293723=_[_0x228f('0x41')]({},_0x293723,_0x3267f4[_0x228f('0x4b')]);return _0x471f8e[_0x228f('0x91')](_0x293723);}})[_0x228f('0x26')](function(_0xe9476a){if(_0xe9476a){_0x57d2b5=_0xe9476a['length'];if(!_0x3267f4[_0x228f('0x35')][_0x228f('0x3b')]('nolimit')){_0x293723[_0x228f('0x1f')]=qs['limit'](_0x3267f4['query']['limit']);_0x293723[_0x228f('0x1e')]=qs['offset'](_0x3267f4[_0x228f('0x35')][_0x228f('0x1e')]);}return _0x471f8e[_0x228f('0x91')](_0x293723);}})[_0x228f('0x26')](function(_0x2bdcee){if(_0x2bdcee){return _0x2bdcee?{'count':_0x57d2b5,'rows':_0x2bdcee}:null;}})[_0x228f('0x26')](respondWithResult(_0x19ff0a,null))['catch'](handleError(_0x19ff0a,null));};exports[_0x228f('0x92')]=function(_0x5aaa0f,_0x305f7d,_0x43e0b0){var _0x5907b6,_0x1a7398;var _0x3bc62b=[];var _0x6278ff=moment()[_0x228f('0x67')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x228f('0x42')]['find']({'where':{'id':_0x5aaa0f[_0x228f('0x54')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x305f7d,null))[_0x228f('0x26')](function(_0x272bc7){if(_0x272bc7){_0x1a7398=_0x272bc7;return _0x272bc7[_0x228f('0x92')](_0x5aaa0f[_0x228f('0x4e')][_0x228f('0x90')],_[_0x228f('0x55')](_0x5aaa0f['body'],[_0x228f('0x90'),'id'])||{});}return null;})[_0x228f('0x69')](function(_0x5cdd98){var _0x5ec163;var _0x435dd6;_0x5907b6=_0x5cdd98||[];var _0x2f6e93=[];if(_0x5cdd98){for(var _0x26dcbe=0x0;_0x26dcbe<_0x5cdd98['length'];_0x26dcbe+=0x1){var _0x318dcf=_0x5cdd98[_0x26dcbe][_0x228f('0x28')]({'plain':!![]});_0x5ec163=squel[_0x228f('0x6c')]()[_0x228f('0x6d')](_0x228f('0x93'))[_0x228f('0x80')]([_0x228f('0x74'),'ContactId',_0x228f('0x71'),'CampaignId',_0x228f('0x56'),_0x228f('0x57')],squel[_0x228f('0x72')]()[_0x228f('0x73')](_0x228f('0x74'),_0x228f('0x74'))[_0x228f('0x73')]('id',_0x228f('0x70'))[_0x228f('0x73')](_0x318dcf[_0x228f('0x81')][_0x228f('0x76')](),_0x228f('0x71'))['field'](_0x5aaa0f[_0x228f('0x54')]['id'][_0x228f('0x76')](),_0x228f('0x5f'))[_0x228f('0x73')]('NOW()',_0x228f('0x56'))[_0x228f('0x73')]('NOW()',_0x228f('0x57'))[_0x228f('0x7c')](_0x228f('0x77'))[_0x228f('0x40')](_0x228f('0x78'))['where'](_0x228f('0x82'),_0x318dcf[_0x228f('0x81')]['toString']())[_0x228f('0x40')](_0x228f('0x79')))[_0x228f('0x76')]();_0x2f6e93[_0x228f('0x8d')](db[_0x228f('0x8c')][_0x228f('0x35')](_0x5ec163));}return BPromise[_0x228f('0x8e')](_0x2f6e93);}})['then'](function(){return _0x5907b6;})['then'](respondWithResult(_0x305f7d,null))[_0x228f('0x47')](handleError(_0x305f7d,null));};exports[_0x228f('0x94')]=function(_0x1cd805,_0x3510ad,_0x44f9ec){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x1cd805['params']['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3510ad,null))[_0x228f('0x26')](function(_0x3e1261){if(_0x3e1261){return _0x3e1261['removeBlackLists'](_0x1cd805['query'][_0x228f('0x90')]);}})[_0x228f('0x26')](function(_0x3a1136){if(_0x3a1136){return db[_0x228f('0x63')][_0x228f('0x27')]({'where':{'ListId':_0x1cd805[_0x228f('0x35')]['ids'],'CampaignId':_0x1cd805[_0x228f('0x54')]['id']}})['then'](function(){return _0x3a1136;});}})['then'](respondWithStatusCode(_0x3510ad,null))[_0x228f('0x47')](handleError(_0x3510ad,null));}; \ No newline at end of file +var _0x36ee=['merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','insert','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','stack','index','map','Campaign','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['Campaign'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='IvrCampaigns';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x54')]=function(_0x3e1040,_0x206f75){var _0x3770bd={'where':{'id':_0x3e1040['params']['id']}},_0x53758e={};_0x53758e['model']=_['keys'](db[_0xe36e('0x2d')][_0xe36e('0x2e')]);_0x3770bd[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x53758e[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3e1040[_0xe36e('0x33')][_0xe36e('0x38')]));_0x3770bd[_0xe36e('0x37')]=_0x3770bd['attributes'][_0xe36e('0x39')]?_0x3770bd[_0xe36e('0x37')]:_0x53758e['model'];if(_0x3e1040[_0xe36e('0x33')][_0xe36e('0x47')]){_0x3770bd[_0xe36e('0x42')]=[{'all':!![]}];}_0x3770bd=_[_0xe36e('0x40')]({},_0x3770bd,_0x3e1040[_0xe36e('0x48')]);return db[_0xe36e('0x2d')][_0xe36e('0x49')](_0x3770bd)[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](function(_0x374032){if(_0x374032){var _0x56718a=_0x374032[_0xe36e('0x28')]({'plain':!![]});_0x56718a=qs[_0xe36e('0x55')](_0x56718a,['id',_0xe36e('0x56'),_0xe36e('0x57')]);_0x3e1040[_0xe36e('0x4b')]=_[_0xe36e('0x55')](_0x3e1040[_0xe36e('0x4b')],['id',_0xe36e('0x56'),_0xe36e('0x57')]);return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_[_0xe36e('0x40')](_0x56718a,_0x3e1040[_0xe36e('0x4b')]),{'include':_0x3e1040[_0xe36e('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xe36e('0x26')](function(_0xedaa96){var _0x49336b=_0x3e1040[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x49336b)throw new Error(_0xe36e('0x4d'));if(_0x49336b[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x34a2c3=_0xedaa96['get']({'plain':!![]});var _0x3db651='IvrCampaigns';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x3db651,'userProfileId':_0x49336b[_0xe36e('0x58')]},'raw':!![]})[_0xe36e('0x26')](function(_0x2a767d){if(_0x2a767d&&_0x2a767d[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x34a2c3['name'],'resourceId':_0x34a2c3['id'],'type':_0x2a767d[_0xe36e('0x32')],'sectionId':_0x2a767d['id']},{})[_0xe36e('0x26')](function(){return _0xedaa96;});}else{return _0xedaa96;}})['catch'](function(_0x3068e1){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x3068e1);throw _0x3068e1;});}return _0xedaa96;});}})[_0xe36e('0x26')](respondWithResult(_0x206f75,0xc9))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x25')]=function(_0x3d4874,_0x48ff05){if(_0x3d4874[_0xe36e('0x4b')]['id']){delete _0x3d4874[_0xe36e('0x4b')]['id'];}return db[_0xe36e('0x2d')][_0xe36e('0x49')]({'where':{'id':_0x3d4874[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x48ff05,null))[_0xe36e('0x26')](saveUpdates(_0x3d4874[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x48ff05,null))[_0xe36e('0x44')](handleError(_0x48ff05,null));};exports[_0xe36e('0x27')]=function(_0x509733,_0x371af5){return db[_0xe36e('0x2d')][_0xe36e('0x49')]({'where':{'id':_0x509733[_0xe36e('0x46')]['id']}})['then'](handleEntityNotFound(_0x371af5,null))['then'](removeEntity(_0x371af5,null))[_0xe36e('0x44')](handleError(_0x371af5,null));};exports['getHoppers']=function(_0x585bd5,_0x59c454,_0xe0a282){var _0x51041b={'raw':!![],'where':{}};var _0x2cbd78={};var _0x2f7093={'count':0x0,'rows':[]};return db[_0xe36e('0x2d')][_0xe36e('0x59')]({'where':{'id':_0x585bd5[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x59c454,null))[_0xe36e('0x26')](function(_0x14a9b4){if(_0x14a9b4){_0x2cbd78[_0xe36e('0x31')]=_['keys'](db[_0xe36e('0x5a')]['rawAttributes']);_0x2cbd78[_0xe36e('0x33')]=_['keys'](_0x585bd5[_0xe36e('0x33')]);_0x2cbd78[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2cbd78[_0xe36e('0x31')],_0x2cbd78['query']);_0x51041b['attributes']=_[_0xe36e('0x36')](_0x2cbd78[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x585bd5[_0xe36e('0x33')][_0xe36e('0x38')]));_0x51041b[_0xe36e('0x37')]=_0x51041b['attributes'][_0xe36e('0x39')]?_0x51041b[_0xe36e('0x37')]:_0x2cbd78['model'];if(!_0x585bd5[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x51041b[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x585bd5[_0xe36e('0x33')]['limit']);_0x51041b[_0xe36e('0x1c')]=qs['offset'](_0x585bd5['query'][_0xe36e('0x1c')]);}_0x51041b[_0xe36e('0x3b')]=qs['sort'](_0x585bd5['query'][_0xe36e('0x3c')]);_0x51041b['where']=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x585bd5[_0xe36e('0x33')],_0x2cbd78[_0xe36e('0x35')]));_0x51041b[_0xe36e('0x3d')][_0xe36e('0x5b')]=_0x14a9b4['id'];if(_0x585bd5['query'][_0xe36e('0x3f')]){_0x51041b[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x51041b[_0xe36e('0x3d')],{'$or':_['map'](_0x51041b[_0xe36e('0x37')],function(_0x37409f){var _0x2eef73={};_0x2eef73[_0x37409f]={'$like':'%'+_0x585bd5[_0xe36e('0x33')]['filter']+'%'};return _0x2eef73;})});}_0x51041b=_[_0xe36e('0x40')]({},_0x51041b,_0x585bd5['options']);return db[_0xe36e('0x5a')]['count']({'where':_0x51041b[_0xe36e('0x3d')]})['then'](function(_0x5e67bd){_0x2f7093[_0xe36e('0x1f')]=_0x5e67bd;if(_0x585bd5[_0xe36e('0x33')][_0xe36e('0x47')]){_0x51041b['include']=[{'all':!![]}];}return db[_0xe36e('0x5a')][_0xe36e('0x5c')](_0x51041b);})['then'](function(_0x3beba7){_0x2f7093[_0xe36e('0x43')]=_0x3beba7;return _0x2f7093;});}})[_0xe36e('0x26')](respondWithFilteredResult(_0x59c454,_0x51041b))['catch'](handleError(_0x59c454,null));};exports['getHopperHistories']=function(_0x72fcc,_0x2ba37a,_0x3bd3c2){var _0x327506={'raw':!![],'where':{}};var _0x411305={};var _0x51bc99={'count':0x0,'rows':[]};return db[_0xe36e('0x2d')][_0xe36e('0x59')]({'where':{'id':_0x72fcc[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x2ba37a,null))[_0xe36e('0x26')](function(_0x5bdeea){if(_0x5bdeea){_0x411305[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x5d')]['rawAttributes']);_0x411305[_0xe36e('0x33')]=_['keys'](_0x72fcc[_0xe36e('0x33')]);_0x411305['filters']=_[_0xe36e('0x36')](_0x411305[_0xe36e('0x31')],_0x411305['query']);_0x327506[_0xe36e('0x37')]=_['intersection'](_0x411305[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x72fcc[_0xe36e('0x33')][_0xe36e('0x38')]));_0x327506[_0xe36e('0x37')]=_0x327506['attributes'][_0xe36e('0x39')]?_0x327506['attributes']:_0x411305[_0xe36e('0x31')];if(!_0x72fcc[_0xe36e('0x33')][_0xe36e('0x5e')](_0xe36e('0x3a'))){_0x327506[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x72fcc['query'][_0xe36e('0x1e')]);_0x327506[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x72fcc['query'][_0xe36e('0x1c')]);}_0x327506[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x72fcc[_0xe36e('0x33')]['sort']);_0x327506[_0xe36e('0x3d')]=qs['filters'](_[_0xe36e('0x3e')](_0x72fcc['query'],_0x411305[_0xe36e('0x35')]));_0x327506[_0xe36e('0x3d')][_0xe36e('0x5b')]=_0x5bdeea['id'];if(_0x72fcc['query'][_0xe36e('0x3f')]){_0x327506[_0xe36e('0x3d')]=_['merge'](_0x327506[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x327506[_0xe36e('0x37')],function(_0x531eac){var _0x4acaa4={};_0x4acaa4[_0x531eac]={'$like':'%'+_0x72fcc[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x4acaa4;})});}_0x327506=_[_0xe36e('0x40')]({},_0x327506,_0x72fcc[_0xe36e('0x48')]);return db[_0xe36e('0x5d')]['count']({'where':_0x327506[_0xe36e('0x3d')]})[_0xe36e('0x26')](function(_0x2c923b){_0x51bc99[_0xe36e('0x1f')]=_0x2c923b;if(_0x72fcc['query'][_0xe36e('0x47')]){_0x327506[_0xe36e('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x327506);})['then'](function(_0x1acffb){_0x51bc99['rows']=_0x1acffb;return _0x51bc99;});}})['then'](respondWithFilteredResult(_0x2ba37a,_0x327506))[_0xe36e('0x44')](handleError(_0x2ba37a,null));};exports[_0xe36e('0x5f')]=function(_0x116f20,_0x266a5f,_0x295495){var _0x378126={'raw':!![],'where':{}};var _0x48fbed={};var _0x2ebe8e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x116f20[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x266a5f,null))[_0xe36e('0x26')](function(_0x14d3a3){if(_0x14d3a3){_0x48fbed['model']=_[_0xe36e('0x34')](db[_0xe36e('0x60')][_0xe36e('0x2e')]);_0x48fbed[_0xe36e('0x33')]=_['keys'](_0x116f20[_0xe36e('0x33')]);_0x48fbed['filters']=_[_0xe36e('0x36')](_0x48fbed[_0xe36e('0x31')],_0x48fbed[_0xe36e('0x33')]);_0x378126[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x48fbed['model'],qs[_0xe36e('0x38')](_0x116f20[_0xe36e('0x33')][_0xe36e('0x38')]));_0x378126[_0xe36e('0x37')]=_0x378126[_0xe36e('0x37')][_0xe36e('0x39')]?_0x378126[_0xe36e('0x37')]:_0x48fbed[_0xe36e('0x31')];if(!_0x116f20[_0xe36e('0x33')][_0xe36e('0x5e')](_0xe36e('0x3a'))){_0x378126[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x116f20['query']['limit']);_0x378126['offset']=qs[_0xe36e('0x1c')](_0x116f20[_0xe36e('0x33')][_0xe36e('0x1c')]);}_0x378126[_0xe36e('0x3b')]=qs['sort'](_0x116f20[_0xe36e('0x33')][_0xe36e('0x3c')]);_0x378126[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_['pick'](_0x116f20[_0xe36e('0x33')],_0x48fbed[_0xe36e('0x35')]));_0x378126[_0xe36e('0x3d')][_0xe36e('0x5b')]=_0x14d3a3['id'];if(_0x116f20['query']['filter']){_0x378126[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x378126['where'],{'$or':_['map'](_0x378126['attributes'],function(_0x3f54d3){var _0x3350ca={};_0x3350ca[_0x3f54d3]={'$like':'%'+_0x116f20[_0xe36e('0x33')]['filter']+'%'};return _0x3350ca;})});}_0x378126=_[_0xe36e('0x40')]({},_0x378126,_0x116f20[_0xe36e('0x48')]);return db[_0xe36e('0x60')][_0xe36e('0x1f')]({'where':_0x378126['where']})[_0xe36e('0x26')](function(_0xd25f52){_0x2ebe8e[_0xe36e('0x1f')]=_0xd25f52;if(_0x116f20[_0xe36e('0x33')]['includeAll']){_0x378126[_0xe36e('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe36e('0x5c')](_0x378126);})['then'](function(_0x1c95cd){_0x2ebe8e[_0xe36e('0x43')]=_0x1c95cd;return _0x2ebe8e;});}})['then'](respondWithFilteredResult(_0x266a5f,_0x378126))[_0xe36e('0x44')](handleError(_0x266a5f,null));};exports[_0xe36e('0x61')]=function(_0x553509,_0x179b3f,_0x8f94f1){var _0x3bfb4c={'raw':!![],'where':{}};var _0x42944b={};var _0x1db9b3={'count':0x0,'rows':[]};return db[_0xe36e('0x2d')]['findOne']({'where':{'id':_0x553509[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x179b3f,null))['then'](function(_0xda5f86){if(_0xda5f86){_0x42944b['model']=_[_0xe36e('0x34')](db[_0xe36e('0x62')][_0xe36e('0x2e')]);_0x42944b[_0xe36e('0x33')]=_['keys'](_0x553509[_0xe36e('0x33')]);_0x42944b[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x42944b[_0xe36e('0x31')],_0x42944b[_0xe36e('0x33')]);_0x3bfb4c['attributes']=_[_0xe36e('0x36')](_0x42944b[_0xe36e('0x31')],qs['fields'](_0x553509['query'][_0xe36e('0x38')]));_0x3bfb4c['attributes']=_0x3bfb4c[_0xe36e('0x37')][_0xe36e('0x39')]?_0x3bfb4c[_0xe36e('0x37')]:_0x42944b[_0xe36e('0x31')];if(!_0x553509[_0xe36e('0x33')][_0xe36e('0x5e')](_0xe36e('0x3a'))){_0x3bfb4c[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x553509[_0xe36e('0x33')]['limit']);_0x3bfb4c[_0xe36e('0x1c')]=qs['offset'](_0x553509[_0xe36e('0x33')][_0xe36e('0x1c')]);}_0x3bfb4c[_0xe36e('0x3b')]=qs['sort'](_0x553509[_0xe36e('0x33')][_0xe36e('0x3c')]);_0x3bfb4c['where']=qs[_0xe36e('0x35')](_['pick'](_0x553509[_0xe36e('0x33')],_0x42944b[_0xe36e('0x35')]));_0x3bfb4c[_0xe36e('0x3d')][_0xe36e('0x5b')]=_0xda5f86['id'];if(_0x553509[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x3bfb4c[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x3bfb4c[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x3bfb4c[_0xe36e('0x37')],function(_0x47b082){var _0x5678e6={};_0x5678e6[_0x47b082]={'$like':'%'+_0x553509[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x5678e6;})});}_0x3bfb4c=_[_0xe36e('0x40')]({},_0x3bfb4c,_0x553509[_0xe36e('0x48')]);return db['CmHopperBlack'][_0xe36e('0x1f')]({'where':_0x3bfb4c[_0xe36e('0x3d')]})['then'](function(_0x281519){_0x1db9b3['count']=_0x281519;if(_0x553509[_0xe36e('0x33')][_0xe36e('0x47')]){_0x3bfb4c[_0xe36e('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe36e('0x5c')](_0x3bfb4c);})[_0xe36e('0x26')](function(_0x2e0e12){_0x1db9b3[_0xe36e('0x43')]=_0x2e0e12;return _0x1db9b3;});}})[_0xe36e('0x26')](respondWithFilteredResult(_0x179b3f,_0x3bfb4c))[_0xe36e('0x44')](handleError(_0x179b3f,null));};exports[_0xe36e('0x63')]=function(_0x4f0396,_0x40595f,_0x2e796e){var _0x2d890a={};var _0x433d03={};var _0x2740cc;var _0x165372;return db[_0xe36e('0x2d')][_0xe36e('0x59')]({'where':{'id':_0x4f0396[_0xe36e('0x46')]['id']}})['then'](handleEntityNotFound(_0x40595f,null))[_0xe36e('0x26')](function(_0x14c6ca){if(_0x14c6ca){_0x2740cc=_0x14c6ca;_0x433d03['model']=_['keys'](db['CmList'][_0xe36e('0x2e')]);_0x433d03[_0xe36e('0x33')]=_['keys'](_0x4f0396[_0xe36e('0x33')]);_0x433d03['filters']=_['intersection'](_0x433d03['model'],_0x433d03[_0xe36e('0x33')]);_0x2d890a[_0xe36e('0x37')]=_['intersection'](_0x433d03[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x4f0396['query'][_0xe36e('0x38')]));_0x2d890a[_0xe36e('0x37')]=_0x2d890a['attributes'][_0xe36e('0x39')]?_0x2d890a[_0xe36e('0x37')]:_0x433d03['model'];_0x2d890a['order']=qs[_0xe36e('0x3c')](_0x4f0396[_0xe36e('0x33')][_0xe36e('0x3c')]);_0x2d890a[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x4f0396[_0xe36e('0x33')],_0x433d03[_0xe36e('0x35')]));if(_0x4f0396['query'][_0xe36e('0x3f')]){_0x2d890a[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x2d890a['where'],{'$or':_[_0xe36e('0x2c')](_0x2d890a[_0xe36e('0x37')],function(_0x45724e){var _0x10f9f1={};_0x10f9f1[_0x45724e]={'$like':'%'+_0x4f0396[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x10f9f1;})});}_0x2d890a=_['merge']({},_0x2d890a,_0x4f0396[_0xe36e('0x48')]);return _0x2740cc[_0xe36e('0x63')](_0x2d890a);}})['then'](function(_0x57eedc){if(_0x57eedc){_0x165372=_0x57eedc[_0xe36e('0x39')];if(!_0x4f0396['query'][_0xe36e('0x5e')](_0xe36e('0x3a'))){_0x2d890a['limit']=qs[_0xe36e('0x1e')](_0x4f0396[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x2d890a[_0xe36e('0x1c')]=qs['offset'](_0x4f0396['query'][_0xe36e('0x1c')]);}return _0x2740cc[_0xe36e('0x63')](_0x2d890a);}})[_0xe36e('0x26')](function(_0x630101){if(_0x630101){return _0x630101?{'count':_0x165372,'rows':_0x630101}:null;}})[_0xe36e('0x26')](respondWithResult(_0x40595f,null))[_0xe36e('0x44')](handleError(_0x40595f,null));};exports[_0xe36e('0x64')]=function(_0x50ea2f,_0x4539d9,_0x45fce3){var _0x118335,_0xed2e0a;var _0x92ce16=[];var _0x322fc4=moment()[_0xe36e('0x65')](_0xe36e('0x66'));return db[_0xe36e('0x2d')][_0xe36e('0x49')]({'where':{'id':_0x50ea2f[_0xe36e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4539d9,null))[_0xe36e('0x26')](function(_0x27102b){if(_0x27102b){_0xed2e0a=_0x27102b;return _0x27102b[_0xe36e('0x64')](_0x50ea2f[_0xe36e('0x4b')]['ids'],_['omit'](_0x50ea2f[_0xe36e('0x4b')],['ids','id'])||{});}return null;})[_0xe36e('0x67')](function(_0x57c1d5){var _0xc7ba07;var _0x52de0f;_0x118335=_0x57c1d5||[];var _0xa1f235=[];if(_0x57c1d5){for(var _0x30928a=0x0;_0x30928a<_0x57c1d5[_0xe36e('0x39')];_0x30928a+=0x1){var _0x16abdf=_0x57c1d5[_0x30928a][_0xe36e('0x28')]({'plain':!![]});_0xed2e0a['dialCheckDuplicateType']=_0x50ea2f[_0xe36e('0x4b')][_0xe36e('0x68')]?_0x50ea2f[_0xe36e('0x4b')]['dialCheckDuplicateType']:_0xed2e0a['dialCheckDuplicateType'];switch(_0xed2e0a[_0xe36e('0x68')]){case _0xe36e('0x69'):_0xc7ba07=squel['insert']()[_0xe36e('0x6a')]('cm_hopper')[_0xe36e('0x6b')]([_0xe36e('0x6c'),_0xe36e('0x6d'),_0xe36e('0x6e'),_0xe36e('0x6f'),_0xe36e('0x5b'),_0xe36e('0x56'),_0xe36e('0x57')],squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x6c'),_0xe36e('0x6c'))[_0xe36e('0x71')]('NOW()',_0xe36e('0x6d'))['field']('id',_0xe36e('0x6e'))[_0xe36e('0x71')](_0x16abdf[_0xe36e('0x72')][_0xe36e('0x73')](),_0xe36e('0x6f'))['field'](_0x50ea2f[_0xe36e('0x46')]['id'][_0xe36e('0x73')](),_0xe36e('0x5b'))[_0xe36e('0x71')]('\x27'+_0x322fc4+'\x27',_0xe36e('0x56'))[_0xe36e('0x71')]('\x27'+_0x322fc4+'\x27',_0xe36e('0x57'))[_0xe36e('0x74')](_0xe36e('0x75'))[_0xe36e('0x3d')](_0xe36e('0x76'))[_0xe36e('0x3d')](_0xe36e('0x77'),_0x16abdf[_0xe36e('0x72')]['toString']())[_0xe36e('0x3d')](_0xe36e('0x78'))['where'](_0xe36e('0x79'),squel['select']()[_0xe36e('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0xe36e('0x74')](_0xe36e('0x7a'))[_0xe36e('0x3d')](_0xe36e('0x7b'),_0x50ea2f['params']['id'][_0xe36e('0x73')]()))[_0xe36e('0x3d')](_0xe36e('0x79'),squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x7c'))['from'](_0xe36e('0x7d'))[_0xe36e('0x3d')](_0xe36e('0x7b'),_0x50ea2f['params']['id']['toString']())))[_0xe36e('0x73')]();break;case'onlyIfOpen':_0xc7ba07=squel[_0xe36e('0x7e')]()['into'](_0xe36e('0x7d'))['fromQuery']([_0xe36e('0x6c'),_0xe36e('0x6d'),_0xe36e('0x6e'),_0xe36e('0x6f'),_0xe36e('0x5b'),_0xe36e('0x56'),'updatedAt'],squel['select']()[_0xe36e('0x71')](_0xe36e('0x6c'),_0xe36e('0x6c'))['field'](_0xe36e('0x7f'),_0xe36e('0x6d'))[_0xe36e('0x71')]('id',_0xe36e('0x6e'))[_0xe36e('0x71')](_0x16abdf[_0xe36e('0x72')][_0xe36e('0x73')](),'ListId')[_0xe36e('0x71')](_0x50ea2f[_0xe36e('0x46')]['id'][_0xe36e('0x73')](),'CampaignId')[_0xe36e('0x71')]('\x27'+_0x322fc4+'\x27',_0xe36e('0x56'))['field']('\x27'+_0x322fc4+'\x27',_0xe36e('0x57'))['from']('cm_contacts')[_0xe36e('0x3d')]('deletedAt\x20IS\x20NULL')[_0xe36e('0x3d')](_0xe36e('0x77'),_0x16abdf[_0xe36e('0x72')]['toString']())[_0xe36e('0x3d')](_0xe36e('0x78'))[_0xe36e('0x3d')](_0xe36e('0x79'),squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x7c'))[_0xe36e('0x74')](_0xe36e('0x7d'))[_0xe36e('0x3d')](_0xe36e('0x7b'),_0x50ea2f[_0xe36e('0x46')]['id']['toString']())))[_0xe36e('0x73')]();break;default:_0xc7ba07=squel[_0xe36e('0x7e')]()['into'](_0xe36e('0x7d'))[_0xe36e('0x6b')](['phone',_0xe36e('0x6d'),_0xe36e('0x6e'),'ListId',_0xe36e('0x5b'),_0xe36e('0x56'),_0xe36e('0x57')],squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x6c'),_0xe36e('0x6c'))[_0xe36e('0x71')](_0xe36e('0x7f'),_0xe36e('0x6d'))['field']('id',_0xe36e('0x6e'))[_0xe36e('0x71')](_0x16abdf['CmListId'][_0xe36e('0x73')](),'ListId')['field'](_0x50ea2f['params']['id'][_0xe36e('0x73')](),_0xe36e('0x5b'))[_0xe36e('0x71')]('\x27'+_0x322fc4+'\x27',_0xe36e('0x56'))[_0xe36e('0x71')]('\x27'+_0x322fc4+'\x27','updatedAt')[_0xe36e('0x74')](_0xe36e('0x75'))['where']('deletedAt\x20IS\x20NULL')[_0xe36e('0x3d')](_0xe36e('0x77'),_0x16abdf[_0xe36e('0x72')][_0xe36e('0x73')]())['where'](_0xe36e('0x78')))['toString']();}_0x52de0f=squel[_0xe36e('0x7e')]()[_0xe36e('0x6a')](_0xe36e('0x80'))['fromQuery']([_0xe36e('0x81'),'scheduledAt',_0xe36e('0x6c'),_0xe36e('0x82'),_0xe36e('0x56'),_0xe36e('0x57')],squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x83'),'id')['field'](_0xe36e('0x7f'),_0xe36e('0x6d'))['field'](_0xe36e('0x84'),'phone')[_0xe36e('0x71')]('ci.OrderBY',_0xe36e('0x82'))['field']('\x27'+_0x322fc4+'\x27','createdAt')['field']('\x27'+_0x322fc4+'\x27',_0xe36e('0x57'))[_0xe36e('0x74')](_0xe36e('0x85'),'ci')[_0xe36e('0x86')](_0xe36e('0x7d'),'h',_0xe36e('0x87'))[_0xe36e('0x3d')](_0xe36e('0x88'),_0x16abdf[_0xe36e('0x72')]['toString']())[_0xe36e('0x3d')](_0xe36e('0x89'),_0x50ea2f[_0xe36e('0x46')]['id'][_0xe36e('0x73')]())[_0xe36e('0x3d')](_0xe36e('0x8a'),_0x322fc4))[_0xe36e('0x73')]();_0xa1f235[_0xe36e('0x8b')](db[_0xe36e('0x8c')][_0xe36e('0x33')](_0xc7ba07));_0x92ce16['push'](db[_0xe36e('0x8c')]['query'](_0x52de0f));}return BPromise[_0xe36e('0x8d')](_0xa1f235);}})[_0xe36e('0x26')](function(){return BPromise[_0xe36e('0x8d')](_0x92ce16);})[_0xe36e('0x26')](function(){return _0x118335;})[_0xe36e('0x26')](respondWithResult(_0x4539d9,null))['catch'](handleError(_0x4539d9,null));};exports[_0xe36e('0x8e')]=function(_0x5583d8,_0x542ae6,_0x2291e7){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x5583d8[_0xe36e('0x46')]['id']}})['then'](handleEntityNotFound(_0x542ae6,null))['then'](function(_0x12e580){if(_0x12e580){return _0x12e580['removeLists'](_0x5583d8[_0xe36e('0x33')][_0xe36e('0x8f')]);}})['then'](function(_0x9ca5f7){if(_0x9ca5f7){return db[_0xe36e('0x5a')]['destroy']({'where':{'ListId':_0x5583d8[_0xe36e('0x33')][_0xe36e('0x8f')],'CampaignId':_0x5583d8[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](function(){return _0x9ca5f7;});}})[_0xe36e('0x26')](respondWithStatusCode(_0x542ae6,null))[_0xe36e('0x44')](handleError(_0x542ae6,null));};exports[_0xe36e('0x90')]=function(_0x509b50,_0x2f4a06,_0x1eaedd){var _0x597767={};var _0x4fee40={};var _0x2ae8d7;var _0x28ebc5;return db['Campaign'][_0xe36e('0x59')]({'where':{'id':_0x509b50[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x2f4a06,null))[_0xe36e('0x26')](function(_0x90e7a1){if(_0x90e7a1){_0x2ae8d7=_0x90e7a1;_0x4fee40[_0xe36e('0x31')]=_['keys'](db['CmList']['rawAttributes']);_0x4fee40[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x509b50['query']);_0x4fee40[_0xe36e('0x35')]=_['intersection'](_0x4fee40[_0xe36e('0x31')],_0x4fee40[_0xe36e('0x33')]);_0x597767['attributes']=_[_0xe36e('0x36')](_0x4fee40[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x509b50[_0xe36e('0x33')]['fields']));_0x597767[_0xe36e('0x37')]=_0x597767[_0xe36e('0x37')][_0xe36e('0x39')]?_0x597767[_0xe36e('0x37')]:_0x4fee40[_0xe36e('0x31')];_0x597767['order']=qs['sort'](_0x509b50[_0xe36e('0x33')]['sort']);_0x597767['where']=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x509b50[_0xe36e('0x33')],_0x4fee40[_0xe36e('0x35')]));if(_0x509b50[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x597767[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x597767[_0xe36e('0x3d')],{'$or':_['map'](_0x597767[_0xe36e('0x37')],function(_0xf5ec44){var _0xef8bcb={};_0xef8bcb[_0xf5ec44]={'$like':'%'+_0x509b50[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xef8bcb;})});}_0x597767=_[_0xe36e('0x40')]({},_0x597767,_0x509b50[_0xe36e('0x48')]);return _0x2ae8d7['getBlackLists'](_0x597767);}})[_0xe36e('0x26')](function(_0x3f0fd2){if(_0x3f0fd2){_0x28ebc5=_0x3f0fd2[_0xe36e('0x39')];if(!_0x509b50[_0xe36e('0x33')][_0xe36e('0x5e')](_0xe36e('0x3a'))){_0x597767[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x509b50[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x597767[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x509b50[_0xe36e('0x33')][_0xe36e('0x1c')]);}return _0x2ae8d7['getBlackLists'](_0x597767);}})[_0xe36e('0x26')](function(_0x3ccaa5){if(_0x3ccaa5){return _0x3ccaa5?{'count':_0x28ebc5,'rows':_0x3ccaa5}:null;}})[_0xe36e('0x26')](respondWithResult(_0x2f4a06,null))[_0xe36e('0x44')](handleError(_0x2f4a06,null));};exports['addBlackLists']=function(_0x5b2527,_0x3d2c55,_0x4e9fe0){var _0x2607b1,_0x4ceb64;var _0x21ffc7=[];var _0x40f6fc=moment()['format'](_0xe36e('0x66'));return db[_0xe36e('0x2d')][_0xe36e('0x49')]({'where':{'id':_0x5b2527['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x3d2c55,null))[_0xe36e('0x26')](function(_0x475ffa){if(_0x475ffa){_0x4ceb64=_0x475ffa;return _0x475ffa[_0xe36e('0x91')](_0x5b2527[_0xe36e('0x4b')]['ids'],_[_0xe36e('0x55')](_0x5b2527[_0xe36e('0x4b')],[_0xe36e('0x8f'),'id'])||{});}return null;})[_0xe36e('0x67')](function(_0x2ba462){var _0x4989b9;var _0x3ccdf7;_0x2607b1=_0x2ba462||[];var _0x1d3442=[];if(_0x2ba462){for(var _0x194b71=0x0;_0x194b71<_0x2ba462[_0xe36e('0x39')];_0x194b71+=0x1){var _0x36ce00=_0x2ba462[_0x194b71]['get']({'plain':!![]});_0x4989b9=squel[_0xe36e('0x7e')]()['into'](_0xe36e('0x92'))['fromQuery']([_0xe36e('0x6c'),_0xe36e('0x6e'),_0xe36e('0x6f'),_0xe36e('0x5b'),_0xe36e('0x56'),_0xe36e('0x57')],squel[_0xe36e('0x70')]()[_0xe36e('0x71')](_0xe36e('0x6c'),_0xe36e('0x6c'))[_0xe36e('0x71')]('id',_0xe36e('0x6e'))[_0xe36e('0x71')](_0x36ce00['CmListId']['toString'](),_0xe36e('0x6f'))[_0xe36e('0x71')](_0x5b2527[_0xe36e('0x46')]['id'][_0xe36e('0x73')](),_0xe36e('0x5b'))[_0xe36e('0x71')](_0xe36e('0x7f'),_0xe36e('0x56'))[_0xe36e('0x71')]('NOW()',_0xe36e('0x57'))[_0xe36e('0x74')]('cm_contacts')['where'](_0xe36e('0x76'))[_0xe36e('0x3d')](_0xe36e('0x77'),_0x36ce00[_0xe36e('0x72')]['toString']())[_0xe36e('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xe36e('0x73')]();_0x1d3442[_0xe36e('0x8b')](db[_0xe36e('0x8c')][_0xe36e('0x33')](_0x4989b9));}return BPromise[_0xe36e('0x8d')](_0x1d3442);}})[_0xe36e('0x26')](function(){return _0x2607b1;})[_0xe36e('0x26')](respondWithResult(_0x3d2c55,null))['catch'](handleError(_0x3d2c55,null));};exports[_0xe36e('0x93')]=function(_0x463b04,_0x5aaee2,_0x3c4583){return db[_0xe36e('0x2d')][_0xe36e('0x49')]({'where':{'id':_0x463b04['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x5aaee2,null))[_0xe36e('0x26')](function(_0x289c6f){if(_0x289c6f){return _0x289c6f['removeBlackLists'](_0x463b04[_0xe36e('0x33')][_0xe36e('0x8f')]);}})['then'](function(_0x212cec){if(_0x212cec){return db['CmHopperBlack'][_0xe36e('0x27')]({'where':{'ListId':_0x463b04[_0xe36e('0x33')]['ids'],'CampaignId':_0x463b04[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](function(){return _0x212cec;});}})['then'](respondWithStatusCode(_0x5aaee2,null))['catch'](handleError(_0x5aaee2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7384866..ee2502e 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0x7a54,0x106));var _0x47a5=function(_0x3cf7c0,_0x4ad985){_0x3cf7c0=_0x3cf7c0-0x0;var _0x15c2df=_0x7a54[_0x3cf7c0];return _0x15c2df;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x514038,_0x450ef3){var _0x589720=function(_0x1a356f){while(--_0x1a356f){_0x514038['push'](_0x514038['shift']());}};_0x589720(++_0x450ef3);}(_0x7a54,0x106));var _0x47a5=function(_0x215f4c,_0x52e5e9){_0x215f4c=_0x215f4c-0x0;var _0x876adf=_0x7a54[_0x215f4c];return _0x876adf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index cfd89ec..1922fdc 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 _0xb2b3=['error','code','message','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb2b3,0x71));var _0x3b2b=function(_0x1d91a5,_0x41741c){_0x1d91a5=_0x1d91a5-0x0;var _0x1604e1=_0xb2b3[_0x1d91a5];return _0x1604e1;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var moment=require(_0x3b2b('0x2'));var BPromise=require(_0x3b2b('0x3'));var rs=require(_0x3b2b('0x4'));var fs=require('fs');var Redis=require(_0x3b2b('0x5'));var db=require(_0x3b2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2b('0x7'))(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var jayson=require(_0x3b2b('0xa'));var client=jayson[_0x3b2b('0xb')][_0x3b2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83e7ef,_0x24b585,_0x1a9054){return new BPromise(function(_0x3ec416,_0x33b807){return client[_0x3b2b('0xd')](_0x83e7ef,_0x1a9054)['then'](function(_0x430be0){logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));logger[_0x3b2b('0x11')](_0x3b2b('0x12'),_0x24b585,'request\x20sent',JSON['stringify'](_0x430be0));if(_0x430be0[_0x3b2b('0x13')]){if(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x14')]===0x1f4){logger[_0x3b2b('0x13')]('Campaign,\x20%s,\x20%s',_0x24b585,_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);return _0x33b807(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);}logger[_0x3b2b('0x13')](_0x3b2b('0xf'),_0x24b585,_0x430be0['error'][_0x3b2b('0x15')]);return _0x3ec416(_0x430be0[_0x3b2b('0x13')]['message']);}else{logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));_0x3ec416(_0x430be0['result'][_0x3b2b('0x15')]);}})['catch'](function(_0x21743d){logger[_0x3b2b('0x13')]('Campaign,\x20%s,\x20%s',_0x24b585,_0x21743d);_0x33b807(_0x21743d);});});}exports['GetCampaign']=function(_0x1a3bfb){var _0x52bba5=this;return new Promise(function(_0x157155,_0x30e4c2){return db['Campaign'][_0x3b2b('0x16')]({'raw':_0x1a3bfb['options']?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3bfb['options']?_0x1a3bfb['options'][_0x3b2b('0x19')]||null:null,'attributes':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1a')]||null:null,'limit':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1b')]||null:null,'include':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')][_0x3b2b('0x1c')]?_[_0x3b2b('0x1d')](_0x1a3bfb['options'][_0x3b2b('0x1c')],function(_0x35387c){return{'model':db[_0x35387c[_0x3b2b('0x1e')]],'as':_0x35387c['as'],'attributes':_0x35387c['attributes'],'include':_0x35387c[_0x3b2b('0x1c')]?_['map'](_0x35387c[_0x3b2b('0x1c')],function(_0x50d2e5){return{'model':db[_0x50d2e5[_0x3b2b('0x1e')]],'as':_0x50d2e5['as'],'attributes':_0x50d2e5['attributes'],'include':_0x50d2e5['include']?_[_0x3b2b('0x1d')](_0x50d2e5[_0x3b2b('0x1c')],function(_0x11313d){return{'model':db[_0x11313d[_0x3b2b('0x1e')]],'as':_0x11313d['as'],'attributes':_0x11313d[_0x3b2b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b2b('0x1f')](function(_0x30574a){logger[_0x3b2b('0xe')](_0x3b2b('0x20'),_0x1a3bfb);logger['debug']('GetCampaign',_0x1a3bfb,JSON['stringify'](_0x30574a));_0x157155(_0x30574a);})['catch'](function(_0x3e2177){logger[_0x3b2b('0x13')](_0x3b2b('0x20'),_0x3e2177[_0x3b2b('0x15')],_0x1a3bfb);_0x30e4c2(_0x52bba5[_0x3b2b('0x13')](0x1f4,_0x3e2177[_0x3b2b('0x15')]));});});}; \ No newline at end of file +var _0x6170=['request\x20sent','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x1aa199,_0x118e10){var _0x11eec1=function(_0x4de2fa){while(--_0x4de2fa){_0x1aa199['push'](_0x1aa199['shift']());}};_0x11eec1(++_0x118e10);}(_0x6170,0x17d));var _0x0617=function(_0x2997a2,_0x4332bc){_0x2997a2=_0x2997a2-0x0;var _0x166485=_0x6170[_0x2997a2];return _0x166485;};'use strict';var _=require(_0x0617('0x0'));var util=require(_0x0617('0x1'));var moment=require(_0x0617('0x2'));var BPromise=require(_0x0617('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0617('0x4'));var db=require(_0x0617('0x5'))['db'];var utils=require(_0x0617('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0617('0x7'));var client=jayson['client'][_0x0617('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xff6363,_0x1f0aaa,_0x3562ee){return new BPromise(function(_0x7b2c3e,_0x11bfe5){return client[_0x0617('0x9')](_0xff6363,_0x3562ee)[_0x0617('0xa')](function(_0x3a98a6){logger[_0x0617('0xb')](_0x0617('0xc'),_0x1f0aaa,'request\x20sent');logger[_0x0617('0xd')](_0x0617('0xe'),_0x1f0aaa,_0x0617('0xf'),JSON['stringify'](_0x3a98a6));if(_0x3a98a6[_0x0617('0x10')]){if(_0x3a98a6[_0x0617('0x10')][_0x0617('0x11')]===0x1f4){logger['error'](_0x0617('0xc'),_0x1f0aaa,_0x3a98a6[_0x0617('0x10')][_0x0617('0x12')]);return _0x11bfe5(_0x3a98a6[_0x0617('0x10')][_0x0617('0x12')]);}logger[_0x0617('0x10')](_0x0617('0xc'),_0x1f0aaa,_0x3a98a6['error'][_0x0617('0x12')]);return _0x7b2c3e(_0x3a98a6['error']['message']);}else{logger[_0x0617('0xb')](_0x0617('0xc'),_0x1f0aaa,_0x0617('0xf'));_0x7b2c3e(_0x3a98a6[_0x0617('0x13')][_0x0617('0x12')]);}})['catch'](function(_0x4b0a56){logger[_0x0617('0x10')](_0x0617('0xc'),_0x1f0aaa,_0x4b0a56);_0x11bfe5(_0x4b0a56);});});}exports[_0x0617('0x14')]=function(_0x3177d3){var _0x20d9b0=this;return new Promise(function(_0x186655,_0x200428){return db[_0x0617('0x15')][_0x0617('0x16')]({'raw':_0x3177d3['options']?_0x3177d3[_0x0617('0x17')][_0x0617('0x18')]===undefined?!![]:![]:!![],'where':_0x3177d3[_0x0617('0x17')]?_0x3177d3['options'][_0x0617('0x19')]||null:null,'attributes':_0x3177d3[_0x0617('0x17')]?_0x3177d3['options'][_0x0617('0x1a')]||null:null,'limit':_0x3177d3[_0x0617('0x17')]?_0x3177d3['options'][_0x0617('0x1b')]||null:null,'include':_0x3177d3[_0x0617('0x17')]?_0x3177d3['options'][_0x0617('0x1c')]?_[_0x0617('0x1d')](_0x3177d3[_0x0617('0x17')][_0x0617('0x1c')],function(_0x5a3ad8){return{'model':db[_0x5a3ad8['model']],'as':_0x5a3ad8['as'],'attributes':_0x5a3ad8[_0x0617('0x1a')],'include':_0x5a3ad8[_0x0617('0x1c')]?_['map'](_0x5a3ad8[_0x0617('0x1c')],function(_0x40df17){return{'model':db[_0x40df17['model']],'as':_0x40df17['as'],'attributes':_0x40df17[_0x0617('0x1a')],'include':_0x40df17['include']?_[_0x0617('0x1d')](_0x40df17[_0x0617('0x1c')],function(_0xaba0f8){return{'model':db[_0xaba0f8[_0x0617('0x1e')]],'as':_0xaba0f8['as'],'attributes':_0xaba0f8[_0x0617('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0617('0xa')](function(_0x32ef28){logger[_0x0617('0xb')](_0x0617('0x14'),_0x3177d3);logger[_0x0617('0xd')]('GetCampaign',_0x3177d3,JSON[_0x0617('0x1f')](_0x32ef28));_0x186655(_0x32ef28);})[_0x0617('0x20')](function(_0x1ff68e){logger[_0x0617('0x10')](_0x0617('0x14'),_0x1ff68e[_0x0617('0x12')],_0x3177d3);_0x200428(_0x20d9b0['error'](0x1f4,_0x1ff68e[_0x0617('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1bad427..619b467 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 _0x0d8d=['update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','/:id/clone','addLists','addBlackLists','put'];(function(_0xd7acd8,_0xcdd9e6){var _0x4738de=function(_0x102739){while(--_0x102739){_0xd7acd8['push'](_0xd7acd8['shift']());}};_0x4738de(++_0xcdd9e6);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x51c529,_0x29e1b9){_0x51c529=_0x51c529-0x0;var _0x568d73=_0x0d8d[_0x51c529];return _0x568d73;};'use strict';var multer=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var path=require(_0xd0d8('0x2'));var timeout=require(_0xd0d8('0x3'));var express=require(_0xd0d8('0x4'));var router=express[_0xd0d8('0x5')]();var fs_extra=require(_0xd0d8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd0d8('0x7'));var config=require(_0xd0d8('0x8'));var controller=require('./campaign.controller');router[_0xd0d8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd0d8('0xa'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xc')]);router[_0xd0d8('0x9')]('/:id/hoppers',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xd')]);router[_0xd0d8('0x9')](_0xd0d8('0xe'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0xf')]);router[_0xd0d8('0x9')]('/:id/hopper_finals',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x10')]);router[_0xd0d8('0x9')](_0xd0d8('0x11'),auth['isAuthenticated'](),controller[_0xd0d8('0x12')]);router[_0xd0d8('0x9')](_0xd0d8('0x13'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x14')]);router['get'](_0xd0d8('0x15'),auth[_0xd0d8('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x16')]);router[_0xd0d8('0x17')](_0xd0d8('0x18'),auth[_0xd0d8('0xb')](),controller['clone']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0xd0d8('0x19')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd0d8('0x1a')]);router[_0xd0d8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xd0d8('0x1c')]);router[_0xd0d8('0x1d')](_0xd0d8('0xa'),auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x1e')]);router[_0xd0d8('0x1d')]('/:id/lists',auth[_0xd0d8('0xb')](),controller[_0xd0d8('0x1f')]);router[_0xd0d8('0x1d')]('/:id/blacklists',auth[_0xd0d8('0xb')](),controller['removeBlackLists']);module[_0xd0d8('0x20')]=router; \ No newline at end of file +var _0x3881=['addLists','addBlackLists','put','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone'];(function(_0x1ce3aa,_0x473545){var _0x66df23=function(_0x16e44c){while(--_0x16e44c){_0x1ce3aa['push'](_0x1ce3aa['shift']());}};_0x66df23(++_0x473545);}(_0x3881,0xe6));var _0x1388=function(_0x306710,_0x12bb27){_0x306710=_0x306710-0x0;var _0x244170=_0x3881[_0x306710];return _0x244170;};'use strict';var multer=require(_0x1388('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1388('0x1'));var router=express[_0x1388('0x2')]();var fs_extra=require(_0x1388('0x3'));var auth=require(_0x1388('0x4'));var interaction=require(_0x1388('0x5'));var config=require(_0x1388('0x6'));var controller=require('./campaign.controller');router[_0x1388('0x7')]('/',auth[_0x1388('0x8')](),controller[_0x1388('0x9')]);router['get'](_0x1388('0xa'),auth[_0x1388('0x8')](),controller[_0x1388('0xb')]);router[_0x1388('0x7')](_0x1388('0xc'),auth[_0x1388('0x8')](),controller[_0x1388('0xd')]);router[_0x1388('0x7')](_0x1388('0xe'),auth[_0x1388('0x8')](),controller[_0x1388('0xf')]);router[_0x1388('0x7')](_0x1388('0x10'),auth[_0x1388('0x8')](),controller['getHopperFinals']);router[_0x1388('0x7')](_0x1388('0x11'),auth['isAuthenticated'](),controller[_0x1388('0x12')]);router[_0x1388('0x7')](_0x1388('0x13'),auth[_0x1388('0x8')](),controller[_0x1388('0x14')]);router[_0x1388('0x7')](_0x1388('0x15'),auth[_0x1388('0x8')](),controller['getBlackLists']);router[_0x1388('0x16')]('/',auth[_0x1388('0x8')](),controller[_0x1388('0x17')]);router[_0x1388('0x16')](_0x1388('0x18'),auth['isAuthenticated'](),controller[_0x1388('0x19')]);router[_0x1388('0x16')]('/:id/lists',auth[_0x1388('0x8')](),controller[_0x1388('0x1a')]);router[_0x1388('0x16')](_0x1388('0x15'),auth[_0x1388('0x8')](),controller[_0x1388('0x1b')]);router[_0x1388('0x1c')]('/:id',auth[_0x1388('0x8')](),controller[_0x1388('0x1d')]);router[_0x1388('0x1e')](_0x1388('0xa'),auth[_0x1388('0x8')](),controller[_0x1388('0x1f')]);router['delete'](_0x1388('0x13'),auth[_0x1388('0x8')](),controller['removeLists']);router[_0x1388('0x1e')](_0x1388('0x15'),auth[_0x1388('0x8')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f303716..c60a870 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 _0x08fd=['key','sequelize','exports','STRING','medium','getDataValue'];(function(_0x35351e,_0x47acc1){var _0x3eb15b=function(_0xd674b7){while(--_0xd674b7){_0x35351e['push'](_0x35351e['shift']());}};_0x3eb15b(++_0x47acc1);}(_0x08fd,0x19f));var _0xd08f=function(_0x79b328,_0x269454){_0x79b328=_0x79b328-0x0;var _0x1ac1de=_0x08fd[_0x79b328];return _0x1ac1de;};'use strict';var Sequelize=require(_0xd08f('0x0'));module[_0xd08f('0x1')]={'key':{'type':Sequelize[_0xd08f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xd08f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd08f('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd08f('0x4')](_0xd08f('0x5'));}}}; \ No newline at end of file +var _0x0415=['key','sequelize','STRING','TEXT','VIRTUAL'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x0415,0x123));var _0x5041=function(_0x137154,_0xa22631){_0x137154=_0x137154-0x0;var _0x36bfbb=_0x0415[_0x137154];return _0x36bfbb;};'use strict';var Sequelize=require(_0x5041('0x0'));module['exports']={'key':{'type':Sequelize[_0x5041('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x5041('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x5041('0x1')]},'name':{'type':Sequelize[_0x5041('0x3')],'get':function(){return this['getDataValue'](_0x5041('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c18f2f8..fc72f1e 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 _0x3a99=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','rawAttributes','fieldName','type','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','CannedAnswer','includeAll','include','findAll','rows','catch','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash'];(function(_0x2ca60d,_0x211489){var _0x5e3384=function(_0x532735){while(--_0x532735){_0x2ca60d['push'](_0x2ca60d['shift']());}};_0x5e3384(++_0x211489);}(_0x3a99,0x1a3));var _0x93a9=function(_0x550f2d,_0x42e613){_0x550f2d=_0x550f2d-0x0;var _0x38e658=_0x3a99[_0x550f2d];return _0x38e658;};'use strict';var emlformat=require(_0x93a9('0x0'));var rimraf=require(_0x93a9('0x1'));var zipdir=require(_0x93a9('0x2'));var jsonpatch=require(_0x93a9('0x3'));var rp=require(_0x93a9('0x4'));var moment=require(_0x93a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x93a9('0x6'));var sox=require(_0x93a9('0x7'));var csv=require(_0x93a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93a9('0x9'));var _=require(_0x93a9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x93a9('0x8'));var querystring=require('querystring');var Papa=require(_0x93a9('0xb'));var Redis=require(_0x93a9('0xc'));var authService=require(_0x93a9('0xd'));var qs=require(_0x93a9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93a9('0xf'));var logger=require(_0x93a9('0x10'))(_0x93a9('0x11'));var utils=require('../../config/utils');var config=require(_0x93a9('0x12'));var licenseUtil=require(_0x93a9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x81a2d8,_0x9b6fb4){_0x9b6fb4=_0x9b6fb4||0xcc;return function(_0x263d4d){if(_0x263d4d){return _0x81a2d8[_0x93a9('0x14')](_0x9b6fb4);}return _0x81a2d8[_0x93a9('0x15')](_0x9b6fb4)['end']();};}function respondWithResult(_0x42acc6,_0x33db1d){_0x33db1d=_0x33db1d||0xc8;return function(_0xff6b93){if(_0xff6b93){return _0x42acc6[_0x93a9('0x15')](_0x33db1d)[_0x93a9('0x16')](_0xff6b93);}};}function respondWithFilteredResult(_0x1a29e0,_0x3ea2ae){return function(_0x3bbfda){if(_0x3bbfda){var _0x38ad14=typeof _0x3ea2ae[_0x93a9('0x17')]===_0x93a9('0x18')&&typeof _0x3ea2ae[_0x93a9('0x19')]==='undefined';var _0xa0efbc=_0x3bbfda[_0x93a9('0x1a')];var _0x6fa007=_0x38ad14?0x0:_0x3ea2ae[_0x93a9('0x17')];var _0x21e614=_0x38ad14?_0x3bbfda[_0x93a9('0x1a')]:_0x3ea2ae[_0x93a9('0x17')]+_0x3ea2ae[_0x93a9('0x19')];var _0xc5673;if(_0x21e614>=_0xa0efbc){_0x21e614=_0xa0efbc;_0xc5673=0xc8;}else{_0xc5673=0xce;}_0x1a29e0['status'](_0xc5673);return _0x1a29e0[_0x93a9('0x1b')](_0x93a9('0x1c'),_0x6fa007+'-'+_0x21e614+'/'+_0xa0efbc)[_0x93a9('0x16')](_0x3bbfda);}return null;};}function patchUpdates(_0x2919ab){return function(_0x3c2556){try{jsonpatch['apply'](_0x3c2556,_0x2919ab,!![]);}catch(_0x304567){return BPromise[_0x93a9('0x1d')](_0x304567);}return _0x3c2556[_0x93a9('0x1e')]();};}function saveUpdates(_0x18ab87,_0x48e345){return function(_0x582231){if(_0x582231){return _0x582231[_0x93a9('0x1f')](_0x18ab87)[_0x93a9('0x20')](function(_0x1637b2){return _0x1637b2;});}return null;};}function removeEntity(_0x16bbbf,_0x55abc9){return function(_0x3d2b6a){if(_0x3d2b6a){return _0x3d2b6a[_0x93a9('0x21')]()[_0x93a9('0x20')](function(){var _0x27a0ba=_0x3d2b6a[_0x93a9('0x22')]({'plain':!![]});var _0xbdc2c5='CannedAnswers';return db[_0x93a9('0x23')][_0x93a9('0x21')]({'where':{'type':_0xbdc2c5,'resourceId':_0x27a0ba['id']}})[_0x93a9('0x20')](function(){return _0x3d2b6a;});})[_0x93a9('0x20')](function(){_0x16bbbf[_0x93a9('0x15')](0xcc)[_0x93a9('0x24')]();});}};}function handleEntityNotFound(_0x59f513,_0x345d56){return function(_0x99dbf9){if(!_0x99dbf9){_0x59f513['sendStatus'](0x194);}return _0x99dbf9;};}function handleError(_0x53f216,_0x39715f){_0x39715f=_0x39715f||0x1f4;return function(_0x2f1899){logger[_0x93a9('0x25')](_0x2f1899[_0x93a9('0x26')]);if(_0x2f1899['name']){delete _0x2f1899['name'];}_0x53f216[_0x93a9('0x15')](_0x39715f)[_0x93a9('0x27')](_0x2f1899);};}exports[_0x93a9('0x28')]=function(_0x35dd0f,_0x35d2b8){var _0x264ae5={},_0x141dfd={},_0x4b9e70={'count':0x0,'rows':[]};var _0x2e57f3=_[_0x93a9('0x29')](db['CannedAnswer'][_0x93a9('0x2a')],function(_0x131a87){return{'name':_0x131a87[_0x93a9('0x2b')],'type':_0x131a87[_0x93a9('0x2c')]['key']};});_0x141dfd['model']=_['map'](_0x2e57f3,_0x93a9('0x2d'));_0x141dfd[_0x93a9('0x2e')]=_[_0x93a9('0x2f')](_0x35dd0f['query']);_0x141dfd[_0x93a9('0x30')]=_['intersection'](_0x141dfd[_0x93a9('0x31')],_0x141dfd[_0x93a9('0x2e')]);_0x264ae5[_0x93a9('0x32')]=_[_0x93a9('0x33')](_0x141dfd['model'],qs[_0x93a9('0x34')](_0x35dd0f['query'][_0x93a9('0x34')]));_0x264ae5[_0x93a9('0x32')]=_0x264ae5['attributes'][_0x93a9('0x35')]?_0x264ae5[_0x93a9('0x32')]:_0x141dfd[_0x93a9('0x31')];if(!_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x36')]('nolimit')){_0x264ae5[_0x93a9('0x19')]=qs[_0x93a9('0x19')](_0x35dd0f['query']['limit']);_0x264ae5[_0x93a9('0x17')]=qs[_0x93a9('0x17')](_0x35dd0f['query']['offset']);}_0x264ae5[_0x93a9('0x37')]=qs[_0x93a9('0x38')](_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x38')]);_0x264ae5['where']=qs['filters'](_[_0x93a9('0x39')](_0x35dd0f[_0x93a9('0x2e')],_0x141dfd[_0x93a9('0x30')]),_0x2e57f3);if(_0x35dd0f[_0x93a9('0x2e')]['filter']){_0x264ae5[_0x93a9('0x3a')]=_[_0x93a9('0x3b')](_0x264ae5['where'],{'$or':[{'key':{'$like':'%'+_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3c')]+'%'}},{'value':{'$like':'%'+_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3c')]+'%'}}]});}_0x264ae5=_['merge']({},_0x264ae5,_0x35dd0f[_0x93a9('0x3d')]);var _0x46ef20={'where':_0x264ae5[_0x93a9('0x3a')]};return db[_0x93a9('0x3e')][_0x93a9('0x1a')](_0x46ef20)[_0x93a9('0x20')](function(_0x517050){_0x4b9e70[_0x93a9('0x1a')]=_0x517050;if(_0x35dd0f[_0x93a9('0x2e')][_0x93a9('0x3f')]){_0x264ae5[_0x93a9('0x40')]=[{'all':!![]}];}return db[_0x93a9('0x3e')][_0x93a9('0x41')](_0x264ae5);})[_0x93a9('0x20')](function(_0x30892b){_0x4b9e70[_0x93a9('0x42')]=_0x30892b;return _0x4b9e70;})[_0x93a9('0x20')](respondWithFilteredResult(_0x35d2b8,_0x264ae5))[_0x93a9('0x43')](handleError(_0x35d2b8,null));};exports['show']=function(_0x30b7da,_0x502049){var _0x21dba8={'raw':!![],'where':{'id':_0x30b7da['params']['id']}},_0x2b6b42={};_0x2b6b42[_0x93a9('0x31')]=_['keys'](db[_0x93a9('0x3e')]['rawAttributes']);_0x2b6b42[_0x93a9('0x2e')]=_[_0x93a9('0x2f')](_0x30b7da['query']);_0x2b6b42[_0x93a9('0x30')]=_[_0x93a9('0x33')](_0x2b6b42['model'],_0x2b6b42['query']);_0x21dba8[_0x93a9('0x32')]=_[_0x93a9('0x33')](_0x2b6b42[_0x93a9('0x31')],qs[_0x93a9('0x34')](_0x30b7da['query'][_0x93a9('0x34')]));_0x21dba8['attributes']=_0x21dba8['attributes']['length']?_0x21dba8[_0x93a9('0x32')]:_0x2b6b42[_0x93a9('0x31')];if(_0x30b7da[_0x93a9('0x2e')][_0x93a9('0x3f')]){_0x21dba8[_0x93a9('0x40')]=[{'all':!![]}];}_0x21dba8=_[_0x93a9('0x3b')]({},_0x21dba8,_0x30b7da['options']);return db['CannedAnswer'][_0x93a9('0x44')](_0x21dba8)[_0x93a9('0x20')](handleEntityNotFound(_0x502049,null))[_0x93a9('0x20')](respondWithResult(_0x502049,null))[_0x93a9('0x43')](handleError(_0x502049,null));};exports[_0x93a9('0x1f')]=function(_0x5a5b4b,_0x38e989){if(_0x5a5b4b[_0x93a9('0x45')]['id']){delete _0x5a5b4b[_0x93a9('0x45')]['id'];}return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':{'id':_0x5a5b4b[_0x93a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e989,null))['then'](saveUpdates(_0x5a5b4b['body'],null))[_0x93a9('0x20')](respondWithResult(_0x38e989,null))[_0x93a9('0x43')](handleError(_0x38e989,null));};exports[_0x93a9('0x21')]=function(_0x17ef7c,_0x2a248f){return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':{'id':_0x17ef7c[_0x93a9('0x46')]['id']}})[_0x93a9('0x20')](handleEntityNotFound(_0x2a248f,null))[_0x93a9('0x20')](removeEntity(_0x2a248f,null))['catch'](handleError(_0x2a248f,null));};exports[_0x93a9('0x47')]=function(_0xea3460,_0x20cedd){var _0x2abde3={'key':_0xea3460[_0x93a9('0x45')][_0x93a9('0x48')]};if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x49')]){_0x2abde3[_0x93a9('0x49')]=_0xea3460[_0x93a9('0x45')]['MailAccountId'];}else if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x4a')]){_0x2abde3['SmsAccountId']=_0xea3460[_0x93a9('0x45')][_0x93a9('0x4a')];}else if(_0xea3460[_0x93a9('0x45')][_0x93a9('0x4b')]){_0x2abde3[_0x93a9('0x4b')]=_0xea3460[_0x93a9('0x45')][_0x93a9('0x4b')];}else if(_0xea3460['body']['ChatWebsiteId']){_0x2abde3[_0x93a9('0x4c')]=_0xea3460[_0x93a9('0x45')]['ChatWebsiteId'];}return db[_0x93a9('0x3e')][_0x93a9('0x44')]({'where':_0x2abde3})['then'](function(_0x4c1be0){if(_0x4c1be0){throw new db['Sequelize'][(_0x93a9('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x93a9('0x3e')][_0x93a9('0x47')](_0xea3460['body']);})['then'](function(_0x52c57d){var _0x2d90d1=_0xea3460[_0x93a9('0x4e')][_0x93a9('0x22')]({'plain':!![]});if(!_0x2d90d1)throw new Error(_0x93a9('0x4f'));if(_0x2d90d1[_0x93a9('0x50')]===_0x93a9('0x4e')){var _0x5d0c64=_0x52c57d[_0x93a9('0x22')]({'plain':!![]});return db[_0x93a9('0x51')][_0x93a9('0x44')]({'where':{'name':_0x93a9('0x52'),'userProfileId':_0x2d90d1[_0x93a9('0x53')]},'raw':!![]})['then'](function(_0x127d38){if(_0x127d38&&_0x127d38[_0x93a9('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d0c64[_0x93a9('0x2d')],'resourceId':_0x5d0c64['id'],'type':_0x127d38[_0x93a9('0x2d')],'sectionId':_0x127d38['id']},{})[_0x93a9('0x20')](function(){return _0x52c57d;});}else{return _0x52c57d;}})['catch'](function(_0x3b343b){logger[_0x93a9('0x25')](_0x93a9('0x55'),_0x3b343b);throw _0x3b343b;});}return _0x52c57d;})['then'](respondWithResult(_0x20cedd,0xc9))[_0x93a9('0x43')](handleError(_0x20cedd,null));}; \ No newline at end of file +var _0xa50a=['attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','rows','catch','params','options','find','update','body','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','destroy','get','CannedAnswers','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xa50a,0x17e));var _0xaa50=function(_0x5958d2,_0x550300){_0x5958d2=_0x5958d2-0x0;var _0x2a4809=_0xa50a[_0x5958d2];return _0x2a4809;};'use strict';var emlformat=require(_0xaa50('0x0'));var rimraf=require(_0xaa50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa50('0x2'));var moment=require(_0xaa50('0x3'));var BPromise=require(_0xaa50('0x4'));var Mustache=require(_0xaa50('0x5'));var util=require(_0xaa50('0x6'));var path=require(_0xaa50('0x7'));var sox=require(_0xaa50('0x8'));var csv=require(_0xaa50('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa50('0xa'));var _=require(_0xaa50('0xb'));var squel=require(_0xaa50('0xc'));var crypto=require(_0xaa50('0xd'));var jsforce=require(_0xaa50('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa50('0xf'));var Papa=require(_0xaa50('0x10'));var Redis=require(_0xaa50('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaa50('0x12'));var as=require(_0xaa50('0x13'));var hardwareService=require(_0xaa50('0x14'));var logger=require(_0xaa50('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xaa50('0x16'));var licenseUtil=require(_0xaa50('0x17'));var db=require(_0xaa50('0x18'))['db'];function respondWithStatusCode(_0x2c3188,_0x5c2998){_0x5c2998=_0x5c2998||0xcc;return function(_0x45b50b){if(_0x45b50b){return _0x2c3188[_0xaa50('0x19')](_0x5c2998);}return _0x2c3188[_0xaa50('0x1a')](_0x5c2998)[_0xaa50('0x1b')]();};}function respondWithResult(_0x5df03b,_0x3477f7){_0x3477f7=_0x3477f7||0xc8;return function(_0x488456){if(_0x488456){return _0x5df03b[_0xaa50('0x1a')](_0x3477f7)[_0xaa50('0x1c')](_0x488456);}};}function respondWithFilteredResult(_0x21cd0c,_0x55ba86){return function(_0x427833){if(_0x427833){var _0x53cece=typeof _0x55ba86[_0xaa50('0x1d')]==='undefined'&&typeof _0x55ba86['limit']===_0xaa50('0x1e');var _0x1a1c83=_0x427833[_0xaa50('0x1f')];var _0x208351=_0x53cece?0x0:_0x55ba86[_0xaa50('0x1d')];var _0x3433be=_0x53cece?_0x427833[_0xaa50('0x1f')]:_0x55ba86[_0xaa50('0x1d')]+_0x55ba86[_0xaa50('0x20')];var _0x1ab452;if(_0x3433be>=_0x1a1c83){_0x3433be=_0x1a1c83;_0x1ab452=0xc8;}else{_0x1ab452=0xce;}_0x21cd0c[_0xaa50('0x1a')](_0x1ab452);return _0x21cd0c[_0xaa50('0x21')]('Content-Range',_0x208351+'-'+_0x3433be+'/'+_0x1a1c83)[_0xaa50('0x1c')](_0x427833);}return null;};}function patchUpdates(_0x46b711){return function(_0x57fe6f){try{jsonpatch['apply'](_0x57fe6f,_0x46b711,!![]);}catch(_0x2c1bc4){return BPromise[_0xaa50('0x22')](_0x2c1bc4);}return _0x57fe6f[_0xaa50('0x23')]();};}function saveUpdates(_0x4b1842,_0xed2775){return function(_0x9d0a1a){if(_0x9d0a1a){return _0x9d0a1a['update'](_0x4b1842)[_0xaa50('0x24')](function(_0xb1f14f){return _0xb1f14f;});}return null;};}function removeEntity(_0x3e76b8,_0x5089f2){return function(_0x16f7f6){if(_0x16f7f6){return _0x16f7f6[_0xaa50('0x25')]()['then'](function(){var _0x5b5cdf=_0x16f7f6[_0xaa50('0x26')]({'plain':!![]});var _0x112973=_0xaa50('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x112973,'resourceId':_0x5b5cdf['id']}})[_0xaa50('0x24')](function(){return _0x16f7f6;});})[_0xaa50('0x24')](function(){_0x3e76b8[_0xaa50('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163fa9,_0x64480c){return function(_0x24fa04){if(!_0x24fa04){_0x163fa9[_0xaa50('0x19')](0x194);}return _0x24fa04;};}function handleError(_0x2c7061,_0x2b844a){_0x2b844a=_0x2b844a||0x1f4;return function(_0x5c32a0){logger['error'](_0x5c32a0['stack']);if(_0x5c32a0[_0xaa50('0x28')]){delete _0x5c32a0[_0xaa50('0x28')];}_0x2c7061[_0xaa50('0x1a')](_0x2b844a)[_0xaa50('0x29')](_0x5c32a0);};}exports['index']=function(_0xb4c2e4,_0x158402){var _0x5197b5={},_0x2d7e32={},_0x5de386={'count':0x0,'rows':[]};var _0x2b9ebb=_[_0xaa50('0x2a')](db[_0xaa50('0x2b')][_0xaa50('0x2c')],function(_0x292f91){return{'name':_0x292f91[_0xaa50('0x2d')],'type':_0x292f91[_0xaa50('0x2e')][_0xaa50('0x2f')]};});_0x2d7e32[_0xaa50('0x30')]=_[_0xaa50('0x2a')](_0x2b9ebb,_0xaa50('0x28'));_0x2d7e32['query']=_[_0xaa50('0x31')](_0xb4c2e4[_0xaa50('0x32')]);_0x2d7e32['filters']=_[_0xaa50('0x33')](_0x2d7e32[_0xaa50('0x30')],_0x2d7e32[_0xaa50('0x32')]);_0x5197b5['attributes']=_['intersection'](_0x2d7e32[_0xaa50('0x30')],qs[_0xaa50('0x34')](_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x34')]));_0x5197b5[_0xaa50('0x35')]=_0x5197b5[_0xaa50('0x35')][_0xaa50('0x36')]?_0x5197b5['attributes']:_0x2d7e32[_0xaa50('0x30')];if(!_0xb4c2e4[_0xaa50('0x32')]['hasOwnProperty'](_0xaa50('0x37'))){_0x5197b5['limit']=qs[_0xaa50('0x20')](_0xb4c2e4['query'][_0xaa50('0x20')]);_0x5197b5[_0xaa50('0x1d')]=qs[_0xaa50('0x1d')](_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x1d')]);}_0x5197b5[_0xaa50('0x38')]=qs['sort'](_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x39')]);_0x5197b5[_0xaa50('0x3a')]=qs[_0xaa50('0x3b')](_[_0xaa50('0x3c')](_0xb4c2e4[_0xaa50('0x32')],_0x2d7e32[_0xaa50('0x3b')]),_0x2b9ebb);if(_0xb4c2e4[_0xaa50('0x32')]['filter']){_0x5197b5[_0xaa50('0x3a')]=_[_0xaa50('0x3d')](_0x5197b5[_0xaa50('0x3a')],{'$or':[{'key':{'$like':'%'+_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x3e')]+'%'}},{'value':{'$like':'%'+_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x3e')]+'%'}}]});}_0x5197b5=_[_0xaa50('0x3d')]({},_0x5197b5,_0xb4c2e4['options']);var _0x315cd6={'where':_0x5197b5[_0xaa50('0x3a')]};return db[_0xaa50('0x2b')][_0xaa50('0x1f')](_0x315cd6)[_0xaa50('0x24')](function(_0x337013){_0x5de386[_0xaa50('0x1f')]=_0x337013;if(_0xb4c2e4[_0xaa50('0x32')][_0xaa50('0x3f')]){_0x5197b5[_0xaa50('0x40')]=[{'all':!![]}];}return db[_0xaa50('0x2b')]['findAll'](_0x5197b5);})['then'](function(_0x3666eb){_0x5de386[_0xaa50('0x41')]=_0x3666eb;return _0x5de386;})['then'](respondWithFilteredResult(_0x158402,_0x5197b5))[_0xaa50('0x42')](handleError(_0x158402,null));};exports['show']=function(_0x219b52,_0x255c6e){var _0x35f77f={'raw':!![],'where':{'id':_0x219b52[_0xaa50('0x43')]['id']}},_0xb211a1={};_0xb211a1[_0xaa50('0x30')]=_[_0xaa50('0x31')](db['CannedAnswer'][_0xaa50('0x2c')]);_0xb211a1['query']=_[_0xaa50('0x31')](_0x219b52['query']);_0xb211a1['filters']=_[_0xaa50('0x33')](_0xb211a1[_0xaa50('0x30')],_0xb211a1['query']);_0x35f77f['attributes']=_[_0xaa50('0x33')](_0xb211a1['model'],qs[_0xaa50('0x34')](_0x219b52[_0xaa50('0x32')]['fields']));_0x35f77f[_0xaa50('0x35')]=_0x35f77f[_0xaa50('0x35')][_0xaa50('0x36')]?_0x35f77f[_0xaa50('0x35')]:_0xb211a1['model'];if(_0x219b52[_0xaa50('0x32')][_0xaa50('0x3f')]){_0x35f77f[_0xaa50('0x40')]=[{'all':!![]}];}_0x35f77f=_[_0xaa50('0x3d')]({},_0x35f77f,_0x219b52[_0xaa50('0x44')]);return db[_0xaa50('0x2b')][_0xaa50('0x45')](_0x35f77f)[_0xaa50('0x24')](handleEntityNotFound(_0x255c6e,null))[_0xaa50('0x24')](respondWithResult(_0x255c6e,null))[_0xaa50('0x42')](handleError(_0x255c6e,null));};exports[_0xaa50('0x46')]=function(_0x43ced0,_0x424ca5){if(_0x43ced0[_0xaa50('0x47')]['id']){delete _0x43ced0[_0xaa50('0x47')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x43ced0[_0xaa50('0x43')]['id']}})[_0xaa50('0x24')](handleEntityNotFound(_0x424ca5,null))[_0xaa50('0x24')](saveUpdates(_0x43ced0[_0xaa50('0x47')],null))[_0xaa50('0x24')](respondWithResult(_0x424ca5,null))[_0xaa50('0x42')](handleError(_0x424ca5,null));};exports[_0xaa50('0x25')]=function(_0x3197fd,_0x1c6941){return db[_0xaa50('0x2b')][_0xaa50('0x45')]({'where':{'id':_0x3197fd[_0xaa50('0x43')]['id']}})[_0xaa50('0x24')](handleEntityNotFound(_0x1c6941,null))[_0xaa50('0x24')](removeEntity(_0x1c6941,null))[_0xaa50('0x42')](handleError(_0x1c6941,null));};exports['create']=function(_0x1d364d,_0x22654d){var _0x4baadc={'key':_0x1d364d[_0xaa50('0x47')][_0xaa50('0x2f')]};if(_0x1d364d[_0xaa50('0x47')][_0xaa50('0x48')]){_0x4baadc[_0xaa50('0x48')]=_0x1d364d[_0xaa50('0x47')][_0xaa50('0x48')];}else if(_0x1d364d[_0xaa50('0x47')][_0xaa50('0x49')]){_0x4baadc[_0xaa50('0x49')]=_0x1d364d[_0xaa50('0x47')][_0xaa50('0x49')];}else if(_0x1d364d[_0xaa50('0x47')]['OpenchannelAccountId']){_0x4baadc['OpenchannelAccountId']=_0x1d364d[_0xaa50('0x47')]['OpenchannelAccountId'];}else if(_0x1d364d[_0xaa50('0x47')][_0xaa50('0x4a')]){_0x4baadc[_0xaa50('0x4a')]=_0x1d364d[_0xaa50('0x47')]['ChatWebsiteId'];}return db[_0xaa50('0x2b')][_0xaa50('0x45')]({'where':_0x4baadc})[_0xaa50('0x24')](function(_0x5884a4){if(_0x5884a4){throw new db[(_0xaa50('0x4b'))][(_0xaa50('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xaa50('0x2b')][_0xaa50('0x4d')](_0x1d364d[_0xaa50('0x47')]);})[_0xaa50('0x24')](function(_0x52adc7){var _0xf42584=_0x1d364d[_0xaa50('0x4e')][_0xaa50('0x26')]({'plain':!![]});if(!_0xf42584)throw new Error(_0xaa50('0x4f'));if(_0xf42584[_0xaa50('0x50')]===_0xaa50('0x4e')){var _0xfc945d=_0x52adc7[_0xaa50('0x26')]({'plain':!![]});return db[_0xaa50('0x51')]['find']({'where':{'name':_0xaa50('0x27'),'userProfileId':_0xf42584[_0xaa50('0x52')]},'raw':!![]})[_0xaa50('0x24')](function(_0x343de7){if(_0x343de7&&_0x343de7[_0xaa50('0x53')]===0x0){return db[_0xaa50('0x54')][_0xaa50('0x4d')]({'name':_0xfc945d[_0xaa50('0x28')],'resourceId':_0xfc945d['id'],'type':_0x343de7['name'],'sectionId':_0x343de7['id']},{})['then'](function(){return _0x52adc7;});}else{return _0x52adc7;}})[_0xaa50('0x42')](function(_0x11f322){logger[_0xaa50('0x55')](_0xaa50('0x56'),_0x11f322);throw _0x11f322;});}return _0x52adc7;})['then'](respondWithResult(_0x22654d,0xc9))[_0xaa50('0x42')](handleError(_0x22654d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4f7fa4f..093ccfa 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 _0x38c3=['request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1977c4,_0x4bdcff){var _0x3a2a22=function(_0x3a6342){while(--_0x3a6342){_0x1977c4['push'](_0x1977c4['shift']());}};_0x3a2a22(++_0x4bdcff);}(_0x38c3,0x1cc));var _0x338c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x38c3[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var logger=require(_0x338c('0x2'))(_0x338c('0x3'));var moment=require('moment');var BPromise=require(_0x338c('0x4'));var rp=require(_0x338c('0x5'));var fs=require('fs');var path=require(_0x338c('0x6'));var rimraf=require(_0x338c('0x7'));var config=require(_0x338c('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x338c('0x9')]=function(_0x14d313,_0xed4adc){return _0x14d313[_0x338c('0xa')](_0x338c('0xb'),attributes,{'tableName':_0x338c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x338c('0xd'),'collate':_0x338c('0xe')});}; \ No newline at end of file +var _0x0c83=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0c83,0xc1));var _0x30c8=function(_0x5743d7,_0x58e4a4){_0x5743d7=_0x5743d7-0x0;var _0x5e748b=_0x0c83[_0x5743d7];return _0x5e748b;};'use strict';var _=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x30c8('0x2'));var rp=require(_0x30c8('0x3'));var fs=require('fs');var path=require(_0x30c8('0x4'));var rimraf=require(_0x30c8('0x5'));var config=require('../../config/environment');var attributes=require(_0x30c8('0x6'));module['exports']=function(_0x4d3530,_0x590352){return _0x4d3530[_0x30c8('0x7')](_0x30c8('0x8'),attributes,{'tableName':_0x30c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x30c8('0xa'),'collate':_0x30c8('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a48c97a..033b669 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5293a8,_0x1ddfb2){var _0x42b121=function(_0x4502a9){while(--_0x4502a9){_0x5293a8['push'](_0x5293a8['shift']());}};_0x42b121(++_0x1ddfb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ae4cb,_0x5767c3){var _0x278459=function(_0xbf21f7){while(--_0xbf21f7){_0x1ae4cb['push'](_0x1ae4cb['shift']());}};_0x278459(++_0x5767c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 1c83a9e..32a54d0 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 _0x8d90=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','get','/:id','show','post','create','put','exports'];(function(_0xf94f9d,_0x55f715){var _0x1dc51c=function(_0x4ca302){while(--_0x4ca302){_0xf94f9d['push'](_0xf94f9d['shift']());}};_0x1dc51c(++_0x55f715);}(_0x8d90,0x66));var _0x08d9=function(_0x5f4963,_0x246a3d){_0x5f4963=_0x5f4963-0x0;var _0x20ac87=_0x8d90[_0x5f4963];return _0x20ac87;};'use strict';var multer=require(_0x08d9('0x0'));var util=require(_0x08d9('0x1'));var path=require(_0x08d9('0x2'));var timeout=require(_0x08d9('0x3'));var express=require('express');var router=express[_0x08d9('0x4')]();var fs_extra=require(_0x08d9('0x5'));var auth=require(_0x08d9('0x6'));var interaction=require(_0x08d9('0x7'));var config=require('../../config/environment');var controller=require(_0x08d9('0x8'));router['get']('/',auth[_0x08d9('0x9')](),controller['index']);router[_0x08d9('0xa')](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller[_0x08d9('0xc')]);router[_0x08d9('0xd')]('/',auth[_0x08d9('0x9')](),controller[_0x08d9('0xe')]);router[_0x08d9('0xf')](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller['update']);router['delete'](_0x08d9('0xb'),auth[_0x08d9('0x9')](),controller['destroy']);module[_0x08d9('0x10')]=router; \ No newline at end of file +var _0x0833=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','show','isAuthenticated','create','/:id','update','multer','util'];(function(_0x581c1d,_0xe71ced){var _0x5d252f=function(_0x46353f){while(--_0x46353f){_0x581c1d['push'](_0x581c1d['shift']());}};_0x5d252f(++_0xe71ced);}(_0x0833,0x11f));var _0x3083=function(_0x149c3d,_0x3dc1f8){_0x149c3d=_0x149c3d-0x0;var _0x4edda4=_0x0833[_0x149c3d];return _0x4edda4;};'use strict';var multer=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var path=require('path');var timeout=require(_0x3083('0x2'));var express=require(_0x3083('0x3'));var router=express[_0x3083('0x4')]();var fs_extra=require(_0x3083('0x5'));var auth=require(_0x3083('0x6'));var interaction=require(_0x3083('0x7'));var config=require(_0x3083('0x8'));var controller=require(_0x3083('0x9'));router[_0x3083('0xa')]('/',auth['isAuthenticated'](),controller[_0x3083('0xb')]);router[_0x3083('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3083('0xc')]);router['post']('/',auth[_0x3083('0xd')](),controller[_0x3083('0xe')]);router['put'](_0x3083('0xf'),auth[_0x3083('0xd')](),controller[_0x3083('0x10')]);router['delete'](_0x3083('0xf'),auth[_0x3083('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 0dad7cd..1d0461a 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 _0x5374=['STRING','INTEGER','exports','DATE'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x5374,0xd6));var _0x4537=function(_0x212a59,_0x113a9b){_0x212a59=_0x212a59-0x0;var _0x4f871d=_0x5374[_0x212a59];return _0x4f871d;};'use strict';var Sequelize=require('sequelize');module[_0x4537('0x0')]={'calldate':{'type':Sequelize[_0x4537('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x4537('0x2')]},'src':{'type':Sequelize[_0x4537('0x2')]},'dst':{'type':Sequelize[_0x4537('0x2')]},'dcontext':{'type':Sequelize[_0x4537('0x2')]},'channel':{'type':Sequelize[_0x4537('0x2')]},'dstchannel':{'type':Sequelize[_0x4537('0x2')]},'lastapp':{'type':Sequelize[_0x4537('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4537('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4537('0x2')]},'amaflags':{'type':Sequelize[_0x4537('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4537('0x2')]},'userfield':{'type':Sequelize[_0x4537('0x2')]},'uniqueid':{'type':Sequelize[_0x4537('0x2')]},'linkedid':{'type':Sequelize[_0x4537('0x2')]},'sequence':{'type':Sequelize[_0x4537('0x2')]},'peeraccount':{'type':Sequelize[_0x4537('0x2')]},'type':{'type':Sequelize[_0x4537('0x2')]},'tag':{'type':Sequelize[_0x4537('0x2')]}}; \ No newline at end of file +var _0x938c=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x382993,_0x16327e){var _0x928ca4=function(_0x2bdfc9){while(--_0x2bdfc9){_0x382993['push'](_0x382993['shift']());}};_0x928ca4(++_0x16327e);}(_0x938c,0x11f));var _0xc938=function(_0x217383,_0x442609){_0x217383=_0x217383-0x0;var _0x286d60=_0x938c[_0x217383];return _0x286d60;};'use strict';var Sequelize=require(_0xc938('0x0'));module[_0xc938('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xc938('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xc938('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc938('0x3')]},'dstchannel':{'type':Sequelize[_0xc938('0x3')]},'lastapp':{'type':Sequelize[_0xc938('0x3')]},'lastdata':{'type':Sequelize[_0xc938('0x3')]},'duration':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc938('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc938('0x3')]},'linkedid':{'type':Sequelize[_0xc938('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xc938('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 43aed66..eb1074c 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 _0x826a=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Cdr','fieldName','type'];(function(_0xfdf7a4,_0x37da46){var _0x59ec89=function(_0x5a4094){while(--_0x5a4094){_0xfdf7a4['push'](_0xfdf7a4['shift']());}};_0x59ec89(++_0x37da46);}(_0x826a,0x1aa));var _0xa826=function(_0x577c48,_0xda52e1){_0x577c48=_0x577c48-0x0;var _0xe5ccb6=_0x826a[_0x577c48];return _0xe5ccb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa826('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa826('0x1'));var rp=require('request-promise');var moment=require(_0xa826('0x2'));var BPromise=require(_0xa826('0x3'));var Mustache=require(_0xa826('0x4'));var util=require(_0xa826('0x5'));var path=require('path');var sox=require(_0xa826('0x6'));var csv=require(_0xa826('0x7'));var ejs=require(_0xa826('0x8'));var fs=require('fs');var fs_extra=require(_0xa826('0x9'));var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x7'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var licenseUtil=require(_0xa826('0x18'));var db=require(_0xa826('0x19'))['db'];function respondWithStatusCode(_0x212fac,_0x40838f){_0x40838f=_0x40838f||0xcc;return function(_0x2f1d39){if(_0x2f1d39){return _0x212fac['sendStatus'](_0x40838f);}return _0x212fac[_0xa826('0x1a')](_0x40838f)['end']();};}function respondWithResult(_0x3e99b0,_0x41c0c2){_0x41c0c2=_0x41c0c2||0xc8;return function(_0x5dc0c7){if(_0x5dc0c7){return _0x3e99b0['status'](_0x41c0c2)['json'](_0x5dc0c7);}};}function respondWithFilteredResult(_0x1b6d16,_0x4f25bd){return function(_0x4c546b){if(_0x4c546b){var _0x9a3788=typeof _0x4f25bd[_0xa826('0x1b')]===_0xa826('0x1c')&&typeof _0x4f25bd['limit']===_0xa826('0x1c');var _0x312e14=_0x4c546b[_0xa826('0x1d')];var _0x453c5d=_0x9a3788?0x0:_0x4f25bd[_0xa826('0x1b')];var _0x48930f=_0x9a3788?_0x4c546b[_0xa826('0x1d')]:_0x4f25bd[_0xa826('0x1b')]+_0x4f25bd[_0xa826('0x1e')];var _0x57e96e;if(_0x48930f>=_0x312e14){_0x48930f=_0x312e14;_0x57e96e=0xc8;}else{_0x57e96e=0xce;}_0x1b6d16['status'](_0x57e96e);return _0x1b6d16[_0xa826('0x1f')](_0xa826('0x20'),_0x453c5d+'-'+_0x48930f+'/'+_0x312e14)[_0xa826('0x21')](_0x4c546b);}return null;};}function patchUpdates(_0x8d1650){return function(_0x124564){try{jsonpatch['apply'](_0x124564,_0x8d1650,!![]);}catch(_0x3171ff){return BPromise[_0xa826('0x22')](_0x3171ff);}return _0x124564[_0xa826('0x23')]();};}function saveUpdates(_0x5d410f,_0x5ddeef){return function(_0x361ca5){if(_0x361ca5){return _0x361ca5[_0xa826('0x24')](_0x5d410f)[_0xa826('0x25')](function(_0x4eb4f3){return _0x4eb4f3;});}return null;};}function removeEntity(_0x1d7adf,_0x26ef25){return function(_0x1d4ade){if(_0x1d4ade){return _0x1d4ade[_0xa826('0x26')]()[_0xa826('0x25')](function(){_0x1d7adf['status'](0xcc)[_0xa826('0x27')]();});}};}function handleEntityNotFound(_0x4fa5db,_0x17ef2d){return function(_0x174f16){if(!_0x174f16){_0x4fa5db['sendStatus'](0x194);}return _0x174f16;};}function handleError(_0xfc0448,_0xfa4d94){_0xfa4d94=_0xfa4d94||0x1f4;return function(_0x38c919){logger[_0xa826('0x28')](_0x38c919[_0xa826('0x29')]);if(_0x38c919[_0xa826('0x2a')]){delete _0x38c919[_0xa826('0x2a')];}_0xfc0448[_0xa826('0x1a')](_0xfa4d94)[_0xa826('0x2b')](_0x38c919);};}exports[_0xa826('0x2c')]=function(_0x1e35de,_0x473d8d){var _0x1f2749={},_0x2cb586={},_0x2253c7={'count':0x0,'rows':[]};var _0x27f8f9=_['map'](db[_0xa826('0x2d')]['rawAttributes'],function(_0x2dd810){return{'name':_0x2dd810[_0xa826('0x2e')],'type':_0x2dd810[_0xa826('0x2f')][_0xa826('0x30')]};});_0x2cb586[_0xa826('0x31')]=_['map'](_0x27f8f9,'name');_0x2cb586[_0xa826('0x32')]=_[_0xa826('0x33')](_0x1e35de[_0xa826('0x32')]);_0x2cb586[_0xa826('0x34')]=_['intersection'](_0x2cb586[_0xa826('0x31')],_0x2cb586[_0xa826('0x32')]);_0x1f2749['attributes']=_[_0xa826('0x35')](_0x2cb586['model'],qs[_0xa826('0x36')](_0x1e35de[_0xa826('0x32')][_0xa826('0x36')]));_0x1f2749[_0xa826('0x37')]=_0x1f2749[_0xa826('0x37')]['length']?_0x1f2749[_0xa826('0x37')]:_0x2cb586[_0xa826('0x31')];if(!_0x1e35de[_0xa826('0x32')][_0xa826('0x38')](_0xa826('0x39'))){_0x1f2749[_0xa826('0x1e')]=qs[_0xa826('0x1e')](_0x1e35de[_0xa826('0x32')][_0xa826('0x1e')]);_0x1f2749[_0xa826('0x1b')]=qs[_0xa826('0x1b')](_0x1e35de['query'][_0xa826('0x1b')]);}_0x1f2749['order']=qs[_0xa826('0x3a')](_0x1e35de['query'][_0xa826('0x3a')]);_0x1f2749[_0xa826('0x3b')]=qs[_0xa826('0x34')](_[_0xa826('0x3c')](_0x1e35de[_0xa826('0x32')],_0x2cb586[_0xa826('0x34')]),_0x27f8f9);if(_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]){_0x1f2749[_0xa826('0x3b')]=_[_0xa826('0x3e')](_0x1f2749[_0xa826('0x3b')],{'$or':_[_0xa826('0x3f')](_0x27f8f9,function(_0x5911d3){if(_0x5911d3[_0xa826('0x2f')]!==_0xa826('0x40')){var _0x251208={};_0x251208[_0x5911d3['name']]={'$like':'%'+_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]+'%'};return _0x251208;}})});}_0x1f2749=_['merge']({},_0x1f2749,_0x1e35de[_0xa826('0x41')]);var _0x47d9f1={'where':_0x1f2749['where']};return db[_0xa826('0x2d')][_0xa826('0x1d')](_0x47d9f1)[_0xa826('0x25')](function(_0x308d4){_0x2253c7[_0xa826('0x1d')]=_0x308d4;if(_0x1e35de[_0xa826('0x32')]['includeAll']){_0x1f2749[_0xa826('0x42')]=[{'all':!![]}];}return db[_0xa826('0x2d')][_0xa826('0x43')](_0x1f2749);})[_0xa826('0x25')](function(_0x244fd3){_0x2253c7[_0xa826('0x44')]=_0x244fd3;return _0x2253c7;})['then'](respondWithFilteredResult(_0x473d8d,_0x1f2749))[_0xa826('0x45')](handleError(_0x473d8d,null));};exports[_0xa826('0x46')]=function(_0x405ee1,_0x162be1){var _0x258e57={'raw':!![],'where':{'id':_0x405ee1[_0xa826('0x47')]['id']}},_0x53b70e={};_0x53b70e[_0xa826('0x31')]=_[_0xa826('0x33')](db[_0xa826('0x2d')][_0xa826('0x48')]);_0x53b70e[_0xa826('0x32')]=_[_0xa826('0x33')](_0x405ee1[_0xa826('0x32')]);_0x53b70e[_0xa826('0x34')]=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],_0x53b70e[_0xa826('0x32')]);_0x258e57['attributes']=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],qs[_0xa826('0x36')](_0x405ee1['query'][_0xa826('0x36')]));_0x258e57[_0xa826('0x37')]=_0x258e57[_0xa826('0x37')][_0xa826('0x49')]?_0x258e57[_0xa826('0x37')]:_0x53b70e['model'];if(_0x405ee1[_0xa826('0x32')][_0xa826('0x4a')]){_0x258e57[_0xa826('0x42')]=[{'all':!![]}];}_0x258e57=_[_0xa826('0x3e')]({},_0x258e57,_0x405ee1[_0xa826('0x41')]);return db[_0xa826('0x2d')][_0xa826('0x4b')](_0x258e57)['then'](handleEntityNotFound(_0x162be1,null))[_0xa826('0x25')](respondWithResult(_0x162be1,null))['catch'](handleError(_0x162be1,null));};exports['create']=function(_0x4b4352,_0x26a858){return db[_0xa826('0x2d')][_0xa826('0x4c')](_0x4b4352[_0xa826('0x4d')],{})['then'](respondWithResult(_0x26a858,0xc9))[_0xa826('0x45')](handleError(_0x26a858,null));};exports['update']=function(_0x5e0947,_0xedcbc2){if(_0x5e0947[_0xa826('0x4d')]['id']){delete _0x5e0947['body']['id'];}return db[_0xa826('0x2d')][_0xa826('0x4b')]({'where':{'id':_0x5e0947['params']['id']}})['then'](handleEntityNotFound(_0xedcbc2,null))['then'](saveUpdates(_0x5e0947['body'],null))['then'](respondWithResult(_0xedcbc2,null))['catch'](handleError(_0xedcbc2,null));};exports['destroy']=function(_0xb3fae0,_0x5d5269){return db[_0xa826('0x2d')]['find']({'where':{'id':_0xb3fae0[_0xa826('0x47')]['id']}})[_0xa826('0x25')](handleEntityNotFound(_0x5d5269,null))[_0xa826('0x25')](removeEntity(_0x5d5269,null))[_0xa826('0x45')](handleError(_0x5d5269,null));};exports[_0xa826('0x4e')]=function(_0x52cf5e,_0x209704){return db['Cdr']['describe']()[_0xa826('0x25')](respondWithResult(_0x209704,null))[_0xa826('0x45')](handleError(_0x209704,null));}; \ No newline at end of file +var _0x3937=['reject','save','update','destroy','then','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x5bac13,_0x1c1a2d){var _0x373770=function(_0x43053a){while(--_0x43053a){_0x5bac13['push'](_0x5bac13['shift']());}};_0x373770(++_0x1c1a2d);}(_0x3937,0xbf));var _0x7393=function(_0x16a347,_0x33a0b0){_0x16a347=_0x16a347-0x0;var _0x3ee9bb=_0x3937[_0x16a347];return _0x3ee9bb;};'use strict';var emlformat=require(_0x7393('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7393('0x1'));var jsonpatch=require(_0x7393('0x2'));var rp=require('request-promise');var moment=require(_0x7393('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7393('0x4'));var util=require('util');var path=require(_0x7393('0x5'));var sox=require(_0x7393('0x6'));var csv=require(_0x7393('0x7'));var ejs=require(_0x7393('0x8'));var fs=require('fs');var fs_extra=require(_0x7393('0x9'));var _=require(_0x7393('0xa'));var squel=require(_0x7393('0xb'));var crypto=require(_0x7393('0xc'));var jsforce=require(_0x7393('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7393('0xe'));var Papa=require(_0x7393('0xf'));var Redis=require(_0x7393('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7393('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7393('0x12'));var config=require(_0x7393('0x13'));var licenseUtil=require(_0x7393('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79fc4e,_0x470f09){_0x470f09=_0x470f09||0xcc;return function(_0x20fb41){if(_0x20fb41){return _0x79fc4e[_0x7393('0x15')](_0x470f09);}return _0x79fc4e[_0x7393('0x16')](_0x470f09)[_0x7393('0x17')]();};}function respondWithResult(_0x38eaad,_0x212f44){_0x212f44=_0x212f44||0xc8;return function(_0x11030d){if(_0x11030d){return _0x38eaad['status'](_0x212f44)['json'](_0x11030d);}};}function respondWithFilteredResult(_0x414c37,_0x5d0d2b){return function(_0x5b91a9){if(_0x5b91a9){var _0x4e7ec6=typeof _0x5d0d2b[_0x7393('0x18')]==='undefined'&&typeof _0x5d0d2b[_0x7393('0x19')]===_0x7393('0x1a');var _0x5b8b03=_0x5b91a9[_0x7393('0x1b')];var _0x5745cb=_0x4e7ec6?0x0:_0x5d0d2b['offset'];var _0x31c8c2=_0x4e7ec6?_0x5b91a9[_0x7393('0x1b')]:_0x5d0d2b[_0x7393('0x18')]+_0x5d0d2b[_0x7393('0x19')];var _0x31902f;if(_0x31c8c2>=_0x5b8b03){_0x31c8c2=_0x5b8b03;_0x31902f=0xc8;}else{_0x31902f=0xce;}_0x414c37[_0x7393('0x16')](_0x31902f);return _0x414c37[_0x7393('0x1c')](_0x7393('0x1d'),_0x5745cb+'-'+_0x31c8c2+'/'+_0x5b8b03)['json'](_0x5b91a9);}return null;};}function patchUpdates(_0x52cd6a){return function(_0x30eae3){try{jsonpatch[_0x7393('0x1e')](_0x30eae3,_0x52cd6a,!![]);}catch(_0x3979b7){return BPromise[_0x7393('0x1f')](_0x3979b7);}return _0x30eae3[_0x7393('0x20')]();};}function saveUpdates(_0x52f716,_0x4d7870){return function(_0x544487){if(_0x544487){return _0x544487[_0x7393('0x21')](_0x52f716)['then'](function(_0x4cfdf6){return _0x4cfdf6;});}return null;};}function removeEntity(_0x2bf7a9,_0xa8f852){return function(_0x5b4498){if(_0x5b4498){return _0x5b4498[_0x7393('0x22')]()[_0x7393('0x23')](function(){_0x2bf7a9[_0x7393('0x16')](0xcc)[_0x7393('0x17')]();});}};}function handleEntityNotFound(_0x3fe456,_0x2c025f){return function(_0x1b31b8){if(!_0x1b31b8){_0x3fe456[_0x7393('0x15')](0x194);}return _0x1b31b8;};}function handleError(_0x328c47,_0x3d8773){_0x3d8773=_0x3d8773||0x1f4;return function(_0x1d7188){logger[_0x7393('0x24')](_0x1d7188[_0x7393('0x25')]);if(_0x1d7188['name']){delete _0x1d7188[_0x7393('0x26')];}_0x328c47[_0x7393('0x16')](_0x3d8773)[_0x7393('0x27')](_0x1d7188);};}exports[_0x7393('0x28')]=function(_0x1013aa,_0xd8dfae){var _0x4a865e={},_0x850b37={},_0x4befa4={'count':0x0,'rows':[]};var _0xc3c5c0=_['map'](db[_0x7393('0x29')][_0x7393('0x2a')],function(_0x45ebe1){return{'name':_0x45ebe1[_0x7393('0x2b')],'type':_0x45ebe1[_0x7393('0x2c')][_0x7393('0x2d')]};});_0x850b37[_0x7393('0x2e')]=_[_0x7393('0x2f')](_0xc3c5c0,_0x7393('0x26'));_0x850b37[_0x7393('0x30')]=_[_0x7393('0x31')](_0x1013aa[_0x7393('0x30')]);_0x850b37['filters']=_['intersection'](_0x850b37[_0x7393('0x2e')],_0x850b37['query']);_0x4a865e[_0x7393('0x32')]=_['intersection'](_0x850b37[_0x7393('0x2e')],qs['fields'](_0x1013aa[_0x7393('0x30')][_0x7393('0x33')]));_0x4a865e[_0x7393('0x32')]=_0x4a865e[_0x7393('0x32')][_0x7393('0x34')]?_0x4a865e[_0x7393('0x32')]:_0x850b37[_0x7393('0x2e')];if(!_0x1013aa[_0x7393('0x30')][_0x7393('0x35')](_0x7393('0x36'))){_0x4a865e['limit']=qs[_0x7393('0x19')](_0x1013aa['query'][_0x7393('0x19')]);_0x4a865e['offset']=qs[_0x7393('0x18')](_0x1013aa[_0x7393('0x30')][_0x7393('0x18')]);}_0x4a865e[_0x7393('0x37')]=qs[_0x7393('0x38')](_0x1013aa['query'][_0x7393('0x38')]);_0x4a865e['where']=qs[_0x7393('0x39')](_[_0x7393('0x3a')](_0x1013aa[_0x7393('0x30')],_0x850b37[_0x7393('0x39')]),_0xc3c5c0);if(_0x1013aa[_0x7393('0x30')]['filter']){_0x4a865e['where']=_[_0x7393('0x3b')](_0x4a865e[_0x7393('0x3c')],{'$or':_[_0x7393('0x2f')](_0xc3c5c0,function(_0x327d2e){if(_0x327d2e['type']!=='VIRTUAL'){var _0x594926={};_0x594926[_0x327d2e[_0x7393('0x26')]]={'$like':'%'+_0x1013aa[_0x7393('0x30')][_0x7393('0x3d')]+'%'};return _0x594926;}})});}_0x4a865e=_[_0x7393('0x3b')]({},_0x4a865e,_0x1013aa[_0x7393('0x3e')]);var _0x406b35={'where':_0x4a865e[_0x7393('0x3c')]};return db[_0x7393('0x29')][_0x7393('0x1b')](_0x406b35)[_0x7393('0x23')](function(_0xc39c05){_0x4befa4[_0x7393('0x1b')]=_0xc39c05;if(_0x1013aa[_0x7393('0x30')][_0x7393('0x3f')]){_0x4a865e[_0x7393('0x40')]=[{'all':!![]}];}return db[_0x7393('0x29')][_0x7393('0x41')](_0x4a865e);})[_0x7393('0x23')](function(_0x445b39){_0x4befa4[_0x7393('0x42')]=_0x445b39;return _0x4befa4;})[_0x7393('0x23')](respondWithFilteredResult(_0xd8dfae,_0x4a865e))[_0x7393('0x43')](handleError(_0xd8dfae,null));};exports['show']=function(_0x28dd3e,_0x16bcbf){var _0x25a2a6={'raw':!![],'where':{'id':_0x28dd3e[_0x7393('0x44')]['id']}},_0x40ab6d={};_0x40ab6d[_0x7393('0x2e')]=_[_0x7393('0x31')](db[_0x7393('0x29')]['rawAttributes']);_0x40ab6d['query']=_[_0x7393('0x31')](_0x28dd3e['query']);_0x40ab6d[_0x7393('0x39')]=_[_0x7393('0x45')](_0x40ab6d[_0x7393('0x2e')],_0x40ab6d[_0x7393('0x30')]);_0x25a2a6[_0x7393('0x32')]=_[_0x7393('0x45')](_0x40ab6d['model'],qs[_0x7393('0x33')](_0x28dd3e[_0x7393('0x30')][_0x7393('0x33')]));_0x25a2a6[_0x7393('0x32')]=_0x25a2a6[_0x7393('0x32')]['length']?_0x25a2a6['attributes']:_0x40ab6d[_0x7393('0x2e')];if(_0x28dd3e['query'][_0x7393('0x3f')]){_0x25a2a6[_0x7393('0x40')]=[{'all':!![]}];}_0x25a2a6=_[_0x7393('0x3b')]({},_0x25a2a6,_0x28dd3e[_0x7393('0x3e')]);return db[_0x7393('0x29')][_0x7393('0x46')](_0x25a2a6)[_0x7393('0x23')](handleEntityNotFound(_0x16bcbf,null))[_0x7393('0x23')](respondWithResult(_0x16bcbf,null))[_0x7393('0x43')](handleError(_0x16bcbf,null));};exports[_0x7393('0x47')]=function(_0x2f19b6,_0x26c327){return db[_0x7393('0x29')][_0x7393('0x47')](_0x2f19b6[_0x7393('0x48')],{})['then'](respondWithResult(_0x26c327,0xc9))[_0x7393('0x43')](handleError(_0x26c327,null));};exports[_0x7393('0x21')]=function(_0x27b796,_0x351ba9){if(_0x27b796['body']['id']){delete _0x27b796[_0x7393('0x48')]['id'];}return db[_0x7393('0x29')][_0x7393('0x46')]({'where':{'id':_0x27b796[_0x7393('0x44')]['id']}})[_0x7393('0x23')](handleEntityNotFound(_0x351ba9,null))[_0x7393('0x23')](saveUpdates(_0x27b796[_0x7393('0x48')],null))[_0x7393('0x23')](respondWithResult(_0x351ba9,null))[_0x7393('0x43')](handleError(_0x351ba9,null));};exports['destroy']=function(_0xd3d01d,_0x1f66cb){return db[_0x7393('0x29')]['find']({'where':{'id':_0xd3d01d[_0x7393('0x44')]['id']}})[_0x7393('0x23')](handleEntityNotFound(_0x1f66cb,null))['then'](removeEntity(_0x1f66cb,null))[_0x7393('0x43')](handleError(_0x1f66cb,null));};exports['describe']=function(_0x396992,_0x575df2){return db[_0x7393('0x29')][_0x7393('0x49')]()['then'](respondWithResult(_0x575df2,null))[_0x7393('0x43')](handleError(_0x575df2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4085fe4..cb2c770 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xa4c049,_0xc51262){var _0x1fd90a=function(_0xeebae){while(--_0xeebae){_0xa4c049['push'](_0xa4c049['shift']());}};_0x1fd90a(++_0xc51262);}(_0x7a54,0x106));var _0x47a5=function(_0x4be0b5,_0x4f225e){_0x4be0b5=_0x4be0b5-0x0;var _0x2cf5bd=_0x7a54[_0x4be0b5];return _0x2cf5bd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x34c772,_0x3662b7){var _0x45b9b2=function(_0x5f3df3){while(--_0x5f3df3){_0x34c772['push'](_0x34c772['shift']());}};_0x45b9b2(++_0x3662b7);}(_0x7a54,0x106));var _0x47a5=function(_0x4ac4e9,_0x506a88){_0x4ac4e9=_0x4ac4e9-0x0;var _0x1677ee=_0x7a54[_0x4ac4e9];return _0x1677ee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8a6e8a6..ee4d821 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 _0xf11a=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xd60c25,_0x45de3c){var _0x13e0cf=function(_0x27cda9){while(--_0x27cda9){_0xd60c25['push'](_0xd60c25['shift']());}};_0x13e0cf(++_0x45de3c);}(_0xf11a,0xf3));var _0xaf11=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xf11a[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require(_0xaf11('0x0'));var util=require(_0xaf11('0x1'));var moment=require('moment');var BPromise=require(_0xaf11('0x2'));var rs=require(_0xaf11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf11('0x4'))['db'];var utils=require(_0xaf11('0x5'));var logger=require(_0xaf11('0x6'))('rpc');var config=require(_0xaf11('0x7'));var jayson=require(_0xaf11('0x8'));var client=jayson[_0xaf11('0x9')][_0xaf11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3815c1,_0x4e3bbb,_0x4736bb){return new BPromise(function(_0x33994f,_0x28149d){return client[_0xaf11('0xb')](_0x3815c1,_0x4736bb)[_0xaf11('0xc')](function(_0x37b97d){logger[_0xaf11('0xd')](_0xaf11('0xe'),_0x4e3bbb,_0xaf11('0xf'));logger[_0xaf11('0x10')](_0xaf11('0x11'),_0x4e3bbb,_0xaf11('0xf'),JSON[_0xaf11('0x12')](_0x37b97d));if(_0x37b97d[_0xaf11('0x13')]){if(_0x37b97d[_0xaf11('0x13')]['code']===0x1f4){logger[_0xaf11('0x13')](_0xaf11('0xe'),_0x4e3bbb,_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);return _0x28149d(_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);}logger[_0xaf11('0x13')](_0xaf11('0xe'),_0x4e3bbb,_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);return _0x33994f(_0x37b97d[_0xaf11('0x13')][_0xaf11('0x14')]);}else{logger[_0xaf11('0xd')]('Cdr,\x20%s,\x20%s',_0x4e3bbb,'request\x20sent');_0x33994f(_0x37b97d['result'][_0xaf11('0x14')]);}})[_0xaf11('0x15')](function(_0x387998){logger['error']('Cdr,\x20%s,\x20%s',_0x4e3bbb,_0x387998);_0x28149d(_0x387998);});});} \ No newline at end of file +var _0x675f=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0x2d85de,_0xea22c2){var _0x2cd00a=function(_0x41d607){while(--_0x41d607){_0x2d85de['push'](_0x2d85de['shift']());}};_0x2cd00a(++_0xea22c2);}(_0x675f,0xc9));var _0xf675=function(_0x439182,_0x5361b8){_0x439182=_0x439182-0x0;var _0x2f2698=_0x675f[_0x439182];return _0x2f2698;};'use strict';var _=require(_0xf675('0x0'));var util=require(_0xf675('0x1'));var moment=require(_0xf675('0x2'));var BPromise=require(_0xf675('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf675('0x4'))['db'];var utils=require(_0xf675('0x5'));var logger=require(_0xf675('0x6'))(_0xf675('0x7'));var config=require(_0xf675('0x8'));var jayson=require(_0xf675('0x9'));var client=jayson[_0xf675('0xa')][_0xf675('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc259,_0xc91685,_0x34997f){return new BPromise(function(_0x4e2da5,_0x2aedaa){return client[_0xf675('0xc')](_0x3bc259,_0x34997f)['then'](function(_0x677bf7){logger['info']('Cdr,\x20%s,\x20%s',_0xc91685,_0xf675('0xd'));logger['debug'](_0xf675('0xe'),_0xc91685,_0xf675('0xd'),JSON[_0xf675('0xf')](_0x677bf7));if(_0x677bf7[_0xf675('0x10')]){if(_0x677bf7[_0xf675('0x10')][_0xf675('0x11')]===0x1f4){logger[_0xf675('0x10')](_0xf675('0x12'),_0xc91685,_0x677bf7['error']['message']);return _0x2aedaa(_0x677bf7['error']['message']);}logger[_0xf675('0x10')]('Cdr,\x20%s,\x20%s',_0xc91685,_0x677bf7[_0xf675('0x10')][_0xf675('0x13')]);return _0x4e2da5(_0x677bf7['error']['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0xc91685,_0xf675('0xd'));_0x4e2da5(_0x677bf7['result'][_0xf675('0x13')]);}})['catch'](function(_0x31b6d5){logger[_0xf675('0x10')]('Cdr,\x20%s,\x20%s',_0xc91685,_0x31b6d5);_0x2aedaa(_0x31b6d5);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 1594bfa..6a5abc8 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x59bd6a,_0x540db8){var _0x54ffd0=function(_0x2549d0){while(--_0x2549d0){_0x59bd6a['push'](_0x59bd6a['shift']());}};_0x54ffd0(++_0x540db8);}(_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('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4af5504..d6f0a4f 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 _0x58b6=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x4a0ca6,_0xff283e){var _0x2dcf8a=function(_0x47ca9c){while(--_0x47ca9c){_0x4a0ca6['push'](_0x4a0ca6['shift']());}};_0x2dcf8a(++_0xff283e);}(_0x58b6,0x128));var _0x658b=function(_0x5c8be4,_0x5c2266){_0x5c8be4=_0x5c8be4-0x0;var _0x3b6e26=_0x58b6[_0x5c8be4];return _0x3b6e26;};'use strict';var Sequelize=require(_0x658b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x658b('0x1')],'allowNull':![],'defaultValue':_0x658b('0x2')},'appdata':{'type':Sequelize[_0x658b('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x658b('0x1')],'defaultValue':_0x658b('0x4')}}; \ No newline at end of file +var _0xbac7=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x2a1275,_0x20c2d2){var _0x2e4ed9=function(_0x2a2d1e){while(--_0x2a2d1e){_0x2a1275['push'](_0x2a1275['shift']());}};_0x2e4ed9(++_0x20c2d2);}(_0xbac7,0x1ae));var _0x7bac=function(_0x3165a7,_0x59a398){_0x3165a7=_0x3165a7-0x0;var _0x2d6dc9=_0xbac7[_0x3165a7];return _0x2d6dc9;};'use strict';var Sequelize=require(_0x7bac('0x0'));module[_0x7bac('0x1')]={'priority':{'type':Sequelize[_0x7bac('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7bac('0x3')],'allowNull':![],'defaultValue':_0x7bac('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7bac('0x3')]},'interval':{'type':Sequelize[_0x7bac('0x3')],'defaultValue':_0x7bac('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 91c8284..c06b225 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 _0x0cee=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','body','find','catch','destroy','eml-format','rimraf'];(function(_0xbc0d7,_0x59a5b3){var _0x47578d=function(_0x5dff57){while(--_0x5dff57){_0xbc0d7['push'](_0xbc0d7['shift']());}};_0x47578d(++_0x59a5b3);}(_0x0cee,0x12f));var _0xe0ce=function(_0x56e51a,_0x3db67a){_0x56e51a=_0x56e51a-0x0;var _0x11d5e2=_0x0cee[_0x56e51a];return _0x11d5e2;};'use strict';var emlformat=require(_0xe0ce('0x0'));var rimraf=require(_0xe0ce('0x1'));var zipdir=require(_0xe0ce('0x2'));var jsonpatch=require(_0xe0ce('0x3'));var rp=require(_0xe0ce('0x4'));var moment=require(_0xe0ce('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe0ce('0x6'));var path=require(_0xe0ce('0x7'));var sox=require(_0xe0ce('0x8'));var csv=require(_0xe0ce('0x9'));var ejs=require(_0xe0ce('0xa'));var fs=require('fs');var fs_extra=require(_0xe0ce('0xb'));var _=require(_0xe0ce('0xc'));var squel=require(_0xe0ce('0xd'));var crypto=require('crypto');var jsforce=require(_0xe0ce('0xe'));var deskjs=require(_0xe0ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe0ce('0x10'));var Papa=require(_0xe0ce('0x11'));var Redis=require(_0xe0ce('0x12'));var authService=require(_0xe0ce('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0ce('0x14'))(_0xe0ce('0x15'));var utils=require(_0xe0ce('0x16'));var config=require(_0xe0ce('0x17'));var licenseUtil=require(_0xe0ce('0x18'));var db=require(_0xe0ce('0x19'))['db'];function respondWithStatusCode(_0x17164a,_0x4598e1){_0x4598e1=_0x4598e1||0xcc;return function(_0x46152e){if(_0x46152e){return _0x17164a[_0xe0ce('0x1a')](_0x4598e1);}return _0x17164a[_0xe0ce('0x1b')](_0x4598e1)[_0xe0ce('0x1c')]();};}function respondWithResult(_0x4b4c80,_0x4c8662){_0x4c8662=_0x4c8662||0xc8;return function(_0x166f42){if(_0x166f42){return _0x4b4c80[_0xe0ce('0x1b')](_0x4c8662)['json'](_0x166f42);}};}function respondWithFilteredResult(_0x556cff,_0x81269b){return function(_0x220456){if(_0x220456){var _0x49e9d1=typeof _0x81269b[_0xe0ce('0x1d')]===_0xe0ce('0x1e')&&typeof _0x81269b['limit']===_0xe0ce('0x1e');var _0x4e4e19=_0x220456[_0xe0ce('0x1f')];var _0x2b5ec6=_0x49e9d1?0x0:_0x81269b[_0xe0ce('0x1d')];var _0x412b52=_0x49e9d1?_0x220456[_0xe0ce('0x1f')]:_0x81269b['offset']+_0x81269b['limit'];var _0xadcb66;if(_0x412b52>=_0x4e4e19){_0x412b52=_0x4e4e19;_0xadcb66=0xc8;}else{_0xadcb66=0xce;}_0x556cff['status'](_0xadcb66);return _0x556cff['set'](_0xe0ce('0x20'),_0x2b5ec6+'-'+_0x412b52+'/'+_0x4e4e19)[_0xe0ce('0x21')](_0x220456);}return null;};}function patchUpdates(_0x494c2a){return function(_0x408369){try{jsonpatch[_0xe0ce('0x22')](_0x408369,_0x494c2a,!![]);}catch(_0x196cee){return BPromise[_0xe0ce('0x23')](_0x196cee);}return _0x408369[_0xe0ce('0x24')]();};}function saveUpdates(_0x4ce716,_0xfcb09){return function(_0x5d31b2){if(_0x5d31b2){return _0x5d31b2[_0xe0ce('0x25')](_0x4ce716)['then'](function(_0x5916c9){return _0x5916c9;});}return null;};}function removeEntity(_0x51fe9f,_0x5b8c86){return function(_0xf04ba3){if(_0xf04ba3){return _0xf04ba3['destroy']()[_0xe0ce('0x26')](function(){_0x51fe9f[_0xe0ce('0x1b')](0xcc)[_0xe0ce('0x1c')]();});}};}function handleEntityNotFound(_0x19ad73,_0x3a8c3e){return function(_0x1a4bc0){if(!_0x1a4bc0){_0x19ad73[_0xe0ce('0x1a')](0x194);}return _0x1a4bc0;};}function handleError(_0x2b2dfc,_0x417fe3){_0x417fe3=_0x417fe3||0x1f4;return function(_0x188c56){logger[_0xe0ce('0x27')](_0x188c56[_0xe0ce('0x28')]);if(_0x188c56['name']){delete _0x188c56[_0xe0ce('0x29')];}_0x2b2dfc[_0xe0ce('0x1b')](_0x417fe3)[_0xe0ce('0x2a')](_0x188c56);};}exports[_0xe0ce('0x2b')]=function(_0x4cb733,_0x45e293){var _0x2ae22d={'raw':!![],'where':{'id':_0x4cb733[_0xe0ce('0x2c')]['id']}},_0x5ea327={};_0x5ea327[_0xe0ce('0x2d')]=_[_0xe0ce('0x2e')](db[_0xe0ce('0x2f')][_0xe0ce('0x30')]);_0x5ea327[_0xe0ce('0x31')]=_[_0xe0ce('0x2e')](_0x4cb733['query']);_0x5ea327[_0xe0ce('0x32')]=_[_0xe0ce('0x33')](_0x5ea327[_0xe0ce('0x2d')],_0x5ea327[_0xe0ce('0x31')]);_0x2ae22d[_0xe0ce('0x34')]=_[_0xe0ce('0x33')](_0x5ea327[_0xe0ce('0x2d')],qs['fields'](_0x4cb733['query'][_0xe0ce('0x35')]));_0x2ae22d['attributes']=_0x2ae22d[_0xe0ce('0x34')][_0xe0ce('0x36')]?_0x2ae22d[_0xe0ce('0x34')]:_0x5ea327[_0xe0ce('0x2d')];if(_0x4cb733[_0xe0ce('0x31')]['includeAll']){_0x2ae22d[_0xe0ce('0x37')]=[{'all':!![]}];}_0x2ae22d=_[_0xe0ce('0x38')]({},_0x2ae22d,_0x4cb733['options']);return db['ChatApplication']['find'](_0x2ae22d)[_0xe0ce('0x26')](handleEntityNotFound(_0x45e293,null))[_0xe0ce('0x26')](respondWithResult(_0x45e293,null))['catch'](handleError(_0x45e293,null));};exports[_0xe0ce('0x25')]=function(_0x269079,_0x1bf5f0){if(_0x269079[_0xe0ce('0x39')]['id']){delete _0x269079['body']['id'];}return db[_0xe0ce('0x2f')][_0xe0ce('0x3a')]({'where':{'id':_0x269079[_0xe0ce('0x2c')]['id']}})[_0xe0ce('0x26')](handleEntityNotFound(_0x1bf5f0,null))[_0xe0ce('0x26')](saveUpdates(_0x269079['body'],null))['then'](respondWithResult(_0x1bf5f0,null))[_0xe0ce('0x3b')](handleError(_0x1bf5f0,null));};exports[_0xe0ce('0x3c')]=function(_0x470a3f,_0x26df1b){return db['ChatApplication'][_0xe0ce('0x3a')]({'where':{'id':_0x470a3f[_0xe0ce('0x2c')]['id']}})['then'](handleEntityNotFound(_0x26df1b,null))[_0xe0ce('0x26')](removeEntity(_0x26df1b,null))[_0xe0ce('0x3b')](handleError(_0x26df1b,null));}; \ No newline at end of file +var _0x8164=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5e2188,_0x71f651){var _0x462d62=function(_0x4c088b){while(--_0x4c088b){_0x5e2188['push'](_0x5e2188['shift']());}};_0x462d62(++_0x71f651);}(_0x8164,0x170));var _0x4816=function(_0x4688f3,_0x1d5a1a){_0x4688f3=_0x4688f3-0x0;var _0x470c84=_0x8164[_0x4688f3];return _0x470c84;};'use strict';var emlformat=require(_0x4816('0x0'));var rimraf=require(_0x4816('0x1'));var zipdir=require(_0x4816('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4816('0x3'));var moment=require(_0x4816('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4816('0x5'));var util=require('util');var path=require(_0x4816('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4816('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4816('0x8'));var crypto=require(_0x4816('0x9'));var jsforce=require(_0x4816('0xa'));var deskjs=require(_0x4816('0xb'));var toCsv=require(_0x4816('0xc'));var querystring=require(_0x4816('0xd'));var Papa=require(_0x4816('0xe'));var Redis=require(_0x4816('0xf'));var authService=require(_0x4816('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4816('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4816('0x12'))(_0x4816('0x13'));var utils=require('../../config/utils');var config=require(_0x4816('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c173b,_0x51a5f8){_0x51a5f8=_0x51a5f8||0xcc;return function(_0x5c4d42){if(_0x5c4d42){return _0x3c173b[_0x4816('0x15')](_0x51a5f8);}return _0x3c173b['status'](_0x51a5f8)[_0x4816('0x16')]();};}function respondWithResult(_0x2554b4,_0x13a685){_0x13a685=_0x13a685||0xc8;return function(_0x316f36){if(_0x316f36){return _0x2554b4[_0x4816('0x17')](_0x13a685)[_0x4816('0x18')](_0x316f36);}};}function respondWithFilteredResult(_0x1eb683,_0x2a58b7){return function(_0x45c006){if(_0x45c006){var _0x21354c=typeof _0x2a58b7[_0x4816('0x19')]===_0x4816('0x1a')&&typeof _0x2a58b7[_0x4816('0x1b')]===_0x4816('0x1a');var _0x1961a5=_0x45c006[_0x4816('0x1c')];var _0x4803d0=_0x21354c?0x0:_0x2a58b7['offset'];var _0x8d4393=_0x21354c?_0x45c006[_0x4816('0x1c')]:_0x2a58b7[_0x4816('0x19')]+_0x2a58b7[_0x4816('0x1b')];var _0xc8ffd5;if(_0x8d4393>=_0x1961a5){_0x8d4393=_0x1961a5;_0xc8ffd5=0xc8;}else{_0xc8ffd5=0xce;}_0x1eb683[_0x4816('0x17')](_0xc8ffd5);return _0x1eb683[_0x4816('0x1d')](_0x4816('0x1e'),_0x4803d0+'-'+_0x8d4393+'/'+_0x1961a5)[_0x4816('0x18')](_0x45c006);}return null;};}function patchUpdates(_0x53189e){return function(_0x1ab50d){try{jsonpatch['apply'](_0x1ab50d,_0x53189e,!![]);}catch(_0x521472){return BPromise[_0x4816('0x1f')](_0x521472);}return _0x1ab50d[_0x4816('0x20')]();};}function saveUpdates(_0x5de184,_0x2bbaf4){return function(_0x576221){if(_0x576221){return _0x576221[_0x4816('0x21')](_0x5de184)[_0x4816('0x22')](function(_0x571c81){return _0x571c81;});}return null;};}function removeEntity(_0x504851,_0xe484b2){return function(_0x2c8dc4){if(_0x2c8dc4){return _0x2c8dc4[_0x4816('0x23')]()['then'](function(){_0x504851[_0x4816('0x17')](0xcc)[_0x4816('0x16')]();});}};}function handleEntityNotFound(_0x126c60,_0x3f07f1){return function(_0x571a05){if(!_0x571a05){_0x126c60['sendStatus'](0x194);}return _0x571a05;};}function handleError(_0x901967,_0x47701a){_0x47701a=_0x47701a||0x1f4;return function(_0x590349){logger[_0x4816('0x24')](_0x590349['stack']);if(_0x590349['name']){delete _0x590349[_0x4816('0x25')];}_0x901967[_0x4816('0x17')](_0x47701a)[_0x4816('0x26')](_0x590349);};}exports['show']=function(_0xbeb8fb,_0x521259){var _0x39ddbd={'raw':!![],'where':{'id':_0xbeb8fb['params']['id']}},_0x229086={};_0x229086[_0x4816('0x27')]=_[_0x4816('0x28')](db[_0x4816('0x29')][_0x4816('0x2a')]);_0x229086[_0x4816('0x2b')]=_[_0x4816('0x28')](_0xbeb8fb[_0x4816('0x2b')]);_0x229086[_0x4816('0x2c')]=_[_0x4816('0x2d')](_0x229086['model'],_0x229086[_0x4816('0x2b')]);_0x39ddbd[_0x4816('0x2e')]=_['intersection'](_0x229086['model'],qs[_0x4816('0x2f')](_0xbeb8fb[_0x4816('0x2b')][_0x4816('0x2f')]));_0x39ddbd[_0x4816('0x2e')]=_0x39ddbd[_0x4816('0x2e')]['length']?_0x39ddbd['attributes']:_0x229086['model'];if(_0xbeb8fb[_0x4816('0x2b')][_0x4816('0x30')]){_0x39ddbd[_0x4816('0x31')]=[{'all':!![]}];}_0x39ddbd=_[_0x4816('0x32')]({},_0x39ddbd,_0xbeb8fb[_0x4816('0x33')]);return db[_0x4816('0x29')]['find'](_0x39ddbd)[_0x4816('0x22')](handleEntityNotFound(_0x521259,null))['then'](respondWithResult(_0x521259,null))[_0x4816('0x34')](handleError(_0x521259,null));};exports[_0x4816('0x21')]=function(_0x37a212,_0x30d55f){if(_0x37a212[_0x4816('0x35')]['id']){delete _0x37a212['body']['id'];}return db[_0x4816('0x29')]['find']({'where':{'id':_0x37a212['params']['id']}})[_0x4816('0x22')](handleEntityNotFound(_0x30d55f,null))['then'](saveUpdates(_0x37a212['body'],null))['then'](respondWithResult(_0x30d55f,null))['catch'](handleError(_0x30d55f,null));};exports[_0x4816('0x23')]=function(_0x3e6a11,_0x589f7d){return db[_0x4816('0x29')][_0x4816('0x36')]({'where':{'id':_0x3e6a11['params']['id']}})[_0x4816('0x22')](handleEntityNotFound(_0x589f7d,null))[_0x4816('0x22')](removeEntity(_0x589f7d,null))[_0x4816('0x34')](handleError(_0x589f7d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d95644a..f308bf1 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 _0x7cca=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2a04bc,_0x19e6d7){var _0x2c8821=function(_0x378607){while(--_0x378607){_0x2a04bc['push'](_0x2a04bc['shift']());}};_0x2c8821(++_0x19e6d7);}(_0x7cca,0xff));var _0xa7cc=function(_0x312f92,_0x82db49){_0x312f92=_0x312f92-0x0;var _0x301bf2=_0x7cca[_0x312f92];return _0x301bf2;};'use strict';var _=require(_0xa7cc('0x0'));var util=require(_0xa7cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa7cc('0x2'));var BPromise=require(_0xa7cc('0x3'));var rp=require(_0xa7cc('0x4'));var fs=require('fs');var path=require(_0xa7cc('0x5'));var rimraf=require(_0xa7cc('0x6'));var config=require(_0xa7cc('0x7'));var attributes=require(_0xa7cc('0x8'));module[_0xa7cc('0x9')]=function(_0x16d9a6,_0xb0f7a7){return _0x16d9a6[_0xa7cc('0xa')](_0xa7cc('0xb'),attributes,{'tableName':_0xa7cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7cc('0xd'),'collate':_0xa7cc('0xe')});}; \ No newline at end of file +var _0x5c71=['moment','bluebird','path','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4c3406,_0x1d5d48){var _0x5df0a7=function(_0x18fba6){while(--_0x18fba6){_0x4c3406['push'](_0x4c3406['shift']());}};_0x5df0a7(++_0x1d5d48);}(_0x5c71,0x188));var _0x15c7=function(_0x35af98,_0x103f33){_0x35af98=_0x35af98-0x0;var _0x5f5a62=_0x5c71[_0x35af98];return _0x5f5a62;};'use strict';var _=require(_0x15c7('0x0'));var util=require(_0x15c7('0x1'));var logger=require(_0x15c7('0x2'))(_0x15c7('0x3'));var moment=require(_0x15c7('0x4'));var BPromise=require(_0x15c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x15c7('0x7')]=function(_0x48fba1,_0xd64778){return _0x48fba1[_0x15c7('0x8')](_0x15c7('0x9'),attributes,{'tableName':_0x15c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x15c7('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index cb69826..d7e5aae 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 _0xf8bf=['request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x563d41,_0xab55e9){var _0x5bb15f=function(_0x290ba8){while(--_0x290ba8){_0x563d41['push'](_0x563d41['shift']());}};_0x5bb15f(++_0xab55e9);}(_0xf8bf,0x1aa));var _0xff8b=function(_0x4e3253,_0x49f2cf){_0x4e3253=_0x4e3253-0x0;var _0x3702a8=_0xf8bf[_0x4e3253];return _0x3702a8;};'use strict';var _=require('lodash');var util=require(_0xff8b('0x0'));var moment=require(_0xff8b('0x1'));var BPromise=require('bluebird');var rs=require(_0xff8b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff8b('0x3'))['db'];var utils=require(_0xff8b('0x4'));var logger=require(_0xff8b('0x5'))(_0xff8b('0x6'));var config=require('../../config/environment');var jayson=require(_0xff8b('0x7'));var client=jayson[_0xff8b('0x8')][_0xff8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be14a,_0x2ec4ce,_0x41261a){return new BPromise(function(_0x26e64d,_0x240c9f){return client[_0xff8b('0xa')](_0x1be14a,_0x41261a)[_0xff8b('0xb')](function(_0x26eedd){logger[_0xff8b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x2ec4ce,'request\x20sent');logger['debug'](_0xff8b('0xd'),_0x2ec4ce,_0xff8b('0xe'),JSON[_0xff8b('0xf')](_0x26eedd));if(_0x26eedd[_0xff8b('0x10')]){if(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x11')]===0x1f4){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);return _0x240c9f(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);}logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')]['message']);return _0x26e64d(_0x26eedd[_0xff8b('0x10')]['message']);}else{logger['info'](_0xff8b('0x12'),_0x2ec4ce,'request\x20sent');_0x26e64d(_0x26eedd[_0xff8b('0x14')][_0xff8b('0x13')]);}})[_0xff8b('0x15')](function(_0x28ceba){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x28ceba);_0x240c9f(_0x28ceba);});});} \ No newline at end of file +var _0xae46=['error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5500c2,_0x3db97e){var _0x2e4d11=function(_0x1f9917){while(--_0x1f9917){_0x5500c2['push'](_0x5500c2['shift']());}};_0x2e4d11(++_0x3db97e);}(_0xae46,0x10d));var _0x6ae4=function(_0x46fdf6,_0x3e1d7b){_0x46fdf6=_0x46fdf6-0x0;var _0x1eb206=_0xae46[_0x46fdf6];return _0x1eb206;};'use strict';var _=require(_0x6ae4('0x0'));var util=require(_0x6ae4('0x1'));var moment=require(_0x6ae4('0x2'));var BPromise=require(_0x6ae4('0x3'));var rs=require(_0x6ae4('0x4'));var fs=require('fs');var Redis=require(_0x6ae4('0x5'));var db=require(_0x6ae4('0x6'))['db'];var utils=require(_0x6ae4('0x7'));var logger=require('../../config/logger')(_0x6ae4('0x8'));var config=require(_0x6ae4('0x9'));var jayson=require(_0x6ae4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38478b,_0x1754ac,_0x2a4270){return new BPromise(function(_0x5d958b,_0x1cc575){return client[_0x6ae4('0xb')](_0x38478b,_0x2a4270)[_0x6ae4('0xc')](function(_0x508a26){logger['info']('ChatApplication,\x20%s,\x20%s',_0x1754ac,_0x6ae4('0xd'));logger[_0x6ae4('0xe')](_0x6ae4('0xf'),_0x1754ac,_0x6ae4('0xd'),JSON[_0x6ae4('0x10')](_0x508a26));if(_0x508a26[_0x6ae4('0x11')]){if(_0x508a26[_0x6ae4('0x11')][_0x6ae4('0x12')]===0x1f4){logger[_0x6ae4('0x11')](_0x6ae4('0x13'),_0x1754ac,_0x508a26[_0x6ae4('0x11')][_0x6ae4('0x14')]);return _0x1cc575(_0x508a26[_0x6ae4('0x11')][_0x6ae4('0x14')]);}logger[_0x6ae4('0x11')](_0x6ae4('0x13'),_0x1754ac,_0x508a26[_0x6ae4('0x11')][_0x6ae4('0x14')]);return _0x5d958b(_0x508a26['error'][_0x6ae4('0x14')]);}else{logger['info'](_0x6ae4('0x13'),_0x1754ac,_0x6ae4('0xd'));_0x5d958b(_0x508a26[_0x6ae4('0x15')][_0x6ae4('0x14')]);}})['catch'](function(_0x12e0fe){logger[_0x6ae4('0x11')](_0x6ae4('0x13'),_0x1754ac,_0x12e0fe);_0x1cc575(_0x12e0fe);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 90b02f6..b9ab58f 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 _0x455e=['./chatApplication.controller','get','/:id','isAuthenticated','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57356a,_0x58a92b){var _0x3e5d73=function(_0x149928){while(--_0x149928){_0x57356a['push'](_0x57356a['shift']());}};_0x3e5d73(++_0x58a92b);}(_0x455e,0x133));var _0xe455=function(_0x5c0624,_0x4f4e34){_0x5c0624=_0x5c0624-0x0;var _0x1e5533=_0x455e[_0x5c0624];return _0x1e5533;};'use strict';var multer=require(_0xe455('0x0'));var util=require(_0xe455('0x1'));var path=require(_0xe455('0x2'));var timeout=require(_0xe455('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe455('0x4'));var auth=require(_0xe455('0x5'));var interaction=require(_0xe455('0x6'));var config=require(_0xe455('0x7'));var controller=require(_0xe455('0x8'));router[_0xe455('0x9')](_0xe455('0xa'),auth[_0xe455('0xb')](),controller['show']);router[_0xe455('0xc')](_0xe455('0xa'),auth[_0xe455('0xb')](),controller['update']);router['delete']('/:id',auth[_0xe455('0xb')](),controller[_0xe455('0xd')]);module[_0xe455('0xe')]=router; \ No newline at end of file +var _0x7aef=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x17284b,_0x27aa78){var _0x54eafd=function(_0x377b71){while(--_0x377b71){_0x17284b['push'](_0x17284b['shift']());}};_0x54eafd(++_0x27aa78);}(_0x7aef,0x1ee));var _0xf7ae=function(_0x40b0ae,_0x6474c7){_0x40b0ae=_0x40b0ae-0x0;var _0xe05dcb=_0x7aef[_0x40b0ae];return _0xe05dcb;};'use strict';var multer=require(_0xf7ae('0x0'));var util=require(_0xf7ae('0x1'));var path=require(_0xf7ae('0x2'));var timeout=require(_0xf7ae('0x3'));var express=require(_0xf7ae('0x4'));var router=express[_0xf7ae('0x5')]();var fs_extra=require(_0xf7ae('0x6'));var auth=require(_0xf7ae('0x7'));var interaction=require(_0xf7ae('0x8'));var config=require(_0xf7ae('0x9'));var controller=require(_0xf7ae('0xa'));router['get'](_0xf7ae('0xb'),auth[_0xf7ae('0xc')](),controller['show']);router['put'](_0xf7ae('0xb'),auth[_0xf7ae('0xc')](),controller[_0xf7ae('0xd')]);router[_0xf7ae('0xe')](_0xf7ae('0xb'),auth[_0xf7ae('0xc')](),controller[_0xf7ae('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2920d9e..b902bb7 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 _0x3c0c=['BOOLEAN','sequelize','STRING'];(function(_0x13f1c8,_0x49a872){var _0x1e716a=function(_0x1166ae){while(--_0x1166ae){_0x13f1c8['push'](_0x13f1c8['shift']());}};_0x1e716a(++_0x49a872);}(_0x3c0c,0x94));var _0xc3c0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3c0c[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xc3c0('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc3c0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e0a=['STRING','sequelize'];(function(_0x53fb12,_0x327dd0){var _0x1ee597=function(_0x4e90c3){while(--_0x4e90c3){_0x53fb12['push'](_0x53fb12['shift']());}};_0x1ee597(++_0x327dd0);}(_0x4e0a,0x1d5));var _0xa4e0=function(_0x5067db,_0xf8d2f2){_0x5067db=_0x5067db-0x0;var _0x2771e4=_0x4e0a[_0x5067db];return _0x2771e4;};'use strict';var Sequelize=require(_0xa4e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa4e0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa4e0('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c380430..6788d75 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 _0xb798=['findOne','keys','User','removeMembers','addMessage','getMessages','$gte','format','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb798,0xcc));var _0x8b79=function(_0x23648d,_0x593c56){_0x23648d=_0x23648d-0x0;var _0x1f7500=_0xb798[_0x23648d];return _0x1f7500;};'use strict';var emlformat=require(_0x8b79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b79('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b79('0x2'));var moment=require('moment');var BPromise=require(_0x8b79('0x3'));var Mustache=require(_0x8b79('0x4'));var util=require(_0x8b79('0x5'));var path=require(_0x8b79('0x6'));var sox=require(_0x8b79('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b79('0x8'));var _=require(_0x8b79('0x9'));var squel=require(_0x8b79('0xa'));var crypto=require(_0x8b79('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b79('0xc'));var toCsv=require(_0x8b79('0xd'));var querystring=require(_0x8b79('0xe'));var Papa=require(_0x8b79('0xf'));var Redis=require(_0x8b79('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b79('0x11'));var hardwareService=require(_0x8b79('0x12'));var logger=require(_0x8b79('0x13'))(_0x8b79('0x14'));var utils=require(_0x8b79('0x15'));var config=require(_0x8b79('0x16'));var licenseUtil=require(_0x8b79('0x17'));var db=require(_0x8b79('0x18'))['db'];config[_0x8b79('0x19')]=_['defaults'](config[_0x8b79('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b79('0x1a'))(new Redis(config['redis']));require(_0x8b79('0x1b'))[_0x8b79('0x1c')](socket);function respondWithStatusCode(_0x4218b1,_0x377369){_0x377369=_0x377369||0xcc;return function(_0x20bcef){if(_0x20bcef){return _0x4218b1[_0x8b79('0x1d')](_0x377369);}return _0x4218b1[_0x8b79('0x1e')](_0x377369)['end']();};}function respondWithResult(_0x49fe46,_0x194559){_0x194559=_0x194559||0xc8;return function(_0xefc887){if(_0xefc887){return _0x49fe46[_0x8b79('0x1e')](_0x194559)[_0x8b79('0x1f')](_0xefc887);}};}function respondWithFilteredResult(_0x55331f,_0x346acf){return function(_0x450dab){if(_0x450dab){var _0x49e097=typeof _0x346acf[_0x8b79('0x20')]===_0x8b79('0x21')&&typeof _0x346acf['limit']===_0x8b79('0x21');var _0x19387f=_0x450dab[_0x8b79('0x22')];var _0x3bcd78=_0x49e097?0x0:_0x346acf['offset'];var _0x1ae3ab=_0x49e097?_0x450dab[_0x8b79('0x22')]:_0x346acf['offset']+_0x346acf[_0x8b79('0x23')];var _0x5b6b03;if(_0x1ae3ab>=_0x19387f){_0x1ae3ab=_0x19387f;_0x5b6b03=0xc8;}else{_0x5b6b03=0xce;}_0x55331f[_0x8b79('0x1e')](_0x5b6b03);return _0x55331f[_0x8b79('0x24')](_0x8b79('0x25'),_0x3bcd78+'-'+_0x1ae3ab+'/'+_0x19387f)[_0x8b79('0x1f')](_0x450dab);}return null;};}function patchUpdates(_0xe983eb){return function(_0x30a39f){try{jsonpatch[_0x8b79('0x26')](_0x30a39f,_0xe983eb,!![]);}catch(_0x5c8ada){return BPromise[_0x8b79('0x27')](_0x5c8ada);}return _0x30a39f['save']();};}function saveUpdates(_0x5e9a68,_0x178715){return function(_0x59eb9b){if(_0x59eb9b){return _0x59eb9b[_0x8b79('0x28')](_0x5e9a68)['then'](function(_0x116bf5){return _0x116bf5;});}return null;};}function removeEntity(_0x172534,_0x30b3cc){return function(_0x13575d){if(_0x13575d){return _0x13575d[_0x8b79('0x29')]()['then'](function(){_0x172534[_0x8b79('0x1e')](0xcc)[_0x8b79('0x2a')]();});}};}function handleEntityNotFound(_0x57955b,_0x1000f6){return function(_0x32322c){if(!_0x32322c){_0x57955b['sendStatus'](0x194);}return _0x32322c;};}function handleError(_0x177b45,_0x49bd97){_0x49bd97=_0x49bd97||0x1f4;return function(_0x2688b4){logger[_0x8b79('0x2b')](_0x2688b4[_0x8b79('0x2c')]);if(_0x2688b4[_0x8b79('0x2d')]){delete _0x2688b4[_0x8b79('0x2d')];}_0x177b45['status'](_0x49bd97)[_0x8b79('0x2e')](_0x2688b4);};}exports[_0x8b79('0x2f')]=function(_0x414abd,_0x58eb6e){var _0x58ce15={},_0x459500={},_0x541665={'count':0x0,'rows':[]};var _0x5bec69=_[_0x8b79('0x30')](db[_0x8b79('0x31')][_0x8b79('0x32')],function(_0x110361){return{'name':_0x110361[_0x8b79('0x33')],'type':_0x110361['type'][_0x8b79('0x34')]};});_0x459500[_0x8b79('0x35')]=_[_0x8b79('0x30')](_0x5bec69,_0x8b79('0x2d'));_0x459500[_0x8b79('0x36')]=_['keys'](_0x414abd['query']);_0x459500['filters']=_[_0x8b79('0x37')](_0x459500[_0x8b79('0x35')],_0x459500[_0x8b79('0x36')]);_0x58ce15[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x459500['model'],qs[_0x8b79('0x39')](_0x414abd[_0x8b79('0x36')]['fields']));_0x58ce15[_0x8b79('0x38')]=_0x58ce15[_0x8b79('0x38')]['length']?_0x58ce15[_0x8b79('0x38')]:_0x459500['model'];if(!_0x414abd[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x58ce15[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x414abd[_0x8b79('0x36')][_0x8b79('0x23')]);_0x58ce15[_0x8b79('0x20')]=qs['offset'](_0x414abd[_0x8b79('0x36')][_0x8b79('0x20')]);}_0x58ce15[_0x8b79('0x3c')]=qs[_0x8b79('0x3d')](_0x414abd[_0x8b79('0x36')][_0x8b79('0x3d')]);_0x58ce15[_0x8b79('0x3e')]=qs[_0x8b79('0x3f')](_[_0x8b79('0x40')](_0x414abd[_0x8b79('0x36')],_0x459500[_0x8b79('0x3f')]),_0x5bec69);if(_0x414abd[_0x8b79('0x36')][_0x8b79('0x41')]){_0x58ce15[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x58ce15[_0x8b79('0x3e')],{'$or':_['map'](_0x5bec69,function(_0x40bcd5){if(_0x40bcd5[_0x8b79('0x43')]!==_0x8b79('0x44')){var _0x1bd943={};_0x1bd943[_0x40bcd5[_0x8b79('0x2d')]]={'$like':'%'+_0x414abd[_0x8b79('0x36')][_0x8b79('0x41')]+'%'};return _0x1bd943;}})});}_0x58ce15=_[_0x8b79('0x42')]({},_0x58ce15,_0x414abd[_0x8b79('0x45')]);var _0x481c7c={'where':_0x58ce15['where']};return db[_0x8b79('0x31')][_0x8b79('0x22')](_0x481c7c)[_0x8b79('0x46')](function(_0x5419f3){_0x541665[_0x8b79('0x22')]=_0x5419f3;if(_0x414abd[_0x8b79('0x36')][_0x8b79('0x47')]){_0x58ce15[_0x8b79('0x48')]=[{'all':!![]}];}return db[_0x8b79('0x31')][_0x8b79('0x49')](_0x58ce15);})[_0x8b79('0x46')](function(_0x5deee3){_0x541665[_0x8b79('0x4a')]=_0x5deee3;return _0x541665;})[_0x8b79('0x46')](respondWithFilteredResult(_0x58eb6e,_0x58ce15))[_0x8b79('0x4b')](handleError(_0x58eb6e,null));};exports[_0x8b79('0x4c')]=function(_0x5d4bad,_0x161f8c){var _0x23c609={'raw':!![],'where':{'id':_0x5d4bad[_0x8b79('0x4d')]['id']}},_0x21ebd4={};_0x21ebd4[_0x8b79('0x35')]=_['keys'](db[_0x8b79('0x31')][_0x8b79('0x32')]);_0x21ebd4[_0x8b79('0x36')]=_['keys'](_0x5d4bad[_0x8b79('0x36')]);_0x21ebd4[_0x8b79('0x3f')]=_[_0x8b79('0x37')](_0x21ebd4['model'],_0x21ebd4[_0x8b79('0x36')]);_0x23c609[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x21ebd4[_0x8b79('0x35')],qs[_0x8b79('0x39')](_0x5d4bad[_0x8b79('0x36')][_0x8b79('0x39')]));_0x23c609['attributes']=_0x23c609[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x23c609[_0x8b79('0x38')]:_0x21ebd4[_0x8b79('0x35')];if(_0x5d4bad[_0x8b79('0x36')]['includeAll']){_0x23c609[_0x8b79('0x48')]=[{'all':!![]}];}_0x23c609=_[_0x8b79('0x42')]({},_0x23c609,_0x5d4bad[_0x8b79('0x45')]);return db[_0x8b79('0x31')][_0x8b79('0x4f')](_0x23c609)['then'](handleEntityNotFound(_0x161f8c,null))[_0x8b79('0x46')](respondWithResult(_0x161f8c,null))[_0x8b79('0x4b')](handleError(_0x161f8c,null));};exports[_0x8b79('0x50')]=function(_0x55472f,_0x3ce74e){return db[_0x8b79('0x31')][_0x8b79('0x50')](_0x55472f[_0x8b79('0x51')],{})['then'](respondWithResult(_0x3ce74e,0xc9))['catch'](handleError(_0x3ce74e,null));};exports[_0x8b79('0x28')]=function(_0x1b2ec0,_0x21def){if(_0x1b2ec0[_0x8b79('0x51')]['id']){delete _0x1b2ec0['body']['id'];}return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x1b2ec0[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x21def,null))['then'](saveUpdates(_0x1b2ec0[_0x8b79('0x51')],null))[_0x8b79('0x46')](respondWithResult(_0x21def,null))[_0x8b79('0x4b')](handleError(_0x21def,null));};exports['destroy']=function(_0x2cdc05,_0x3ce29e){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x2cdc05[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x3ce29e,null))['then'](removeEntity(_0x3ce29e,null))[_0x8b79('0x4b')](handleError(_0x3ce29e,null));};exports['describe']=function(_0x46bfef,_0x278939){return db[_0x8b79('0x31')][_0x8b79('0x52')]()['then'](respondWithResult(_0x278939,null))[_0x8b79('0x4b')](handleError(_0x278939,null));};exports[_0x8b79('0x53')]=function(_0x21df45,_0x3e35e6,_0x1dc777){return db[_0x8b79('0x54')][_0x8b79('0x22')]({'where':{'ChatGroupId':_0x21df45['params']['id'],'ToId':_0x21df45[_0x8b79('0x55')]['id'],'read':![]}})['then'](function(_0x6031ec){return{'id':_[_0x8b79('0x56')](_0x21df45[_0x8b79('0x4d')]['id']),'count':_0x6031ec};})[_0x8b79('0x46')](respondWithResult(_0x3e35e6,null))[_0x8b79('0x4b')](handleError(_0x3e35e6,null));};exports['addMembers']=function(_0x21a9ef,_0x493b35,_0x13b774){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x21a9ef[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x493b35,null))[_0x8b79('0x46')](function(_0x204710){if(_0x204710){return _0x204710['addMembers'](_0x21a9ef[_0x8b79('0x51')][_0x8b79('0x57')],_[_0x8b79('0x58')](_0x21a9ef['body'],['ids','id'])||{});}})[_0x8b79('0x46')](respondWithResult(_0x493b35,null))['catch'](handleError(_0x493b35,null));};exports[_0x8b79('0x59')]=function(_0x5d493e,_0x515319,_0x3d2c8a){var _0x4cc60b={};var _0x503d3f={};var _0xb07e5a;var _0x33a469;return db[_0x8b79('0x31')][_0x8b79('0x5a')]({'where':{'id':_0x5d493e[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x515319,null))[_0x8b79('0x46')](function(_0x390bda){if(_0x390bda){_0xb07e5a=_0x390bda;_0x503d3f['model']=_[_0x8b79('0x5b')](db[_0x8b79('0x5c')][_0x8b79('0x32')]);_0x503d3f[_0x8b79('0x36')]=_[_0x8b79('0x5b')](_0x5d493e['query']);_0x503d3f['filters']=_[_0x8b79('0x37')](_0x503d3f[_0x8b79('0x35')],_0x503d3f[_0x8b79('0x36')]);_0x4cc60b[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x503d3f['model'],qs['fields'](_0x5d493e[_0x8b79('0x36')][_0x8b79('0x39')]));_0x4cc60b[_0x8b79('0x38')]=_0x4cc60b[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x4cc60b[_0x8b79('0x38')]:_0x503d3f[_0x8b79('0x35')];_0x4cc60b['order']=qs[_0x8b79('0x3d')](_0x5d493e[_0x8b79('0x36')]['sort']);_0x4cc60b[_0x8b79('0x3e')]=qs[_0x8b79('0x3f')](_[_0x8b79('0x40')](_0x5d493e['query'],_0x503d3f[_0x8b79('0x3f')]));if(_0x5d493e[_0x8b79('0x36')][_0x8b79('0x41')]){_0x4cc60b[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x4cc60b[_0x8b79('0x3e')],{'$or':_[_0x8b79('0x30')](_0x4cc60b[_0x8b79('0x38')],function(_0x12f65b){var _0x377ae1={};_0x377ae1[_0x12f65b]={'$like':'%'+_0x5d493e['query']['filter']+'%'};return _0x377ae1;})});}_0x4cc60b=_[_0x8b79('0x42')]({},_0x4cc60b,_0x5d493e[_0x8b79('0x45')]);return _0xb07e5a[_0x8b79('0x59')](_0x4cc60b);}})[_0x8b79('0x46')](function(_0x1c7a85){if(_0x1c7a85){_0x33a469=_0x1c7a85['length'];if(!_0x5d493e[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x4cc60b[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x5d493e[_0x8b79('0x36')]['limit']);_0x4cc60b[_0x8b79('0x20')]=qs[_0x8b79('0x20')](_0x5d493e['query']['offset']);}return _0xb07e5a[_0x8b79('0x59')](_0x4cc60b);}})[_0x8b79('0x46')](function(_0x5775f1){if(_0x5775f1){return _0x5775f1?{'count':_0x33a469,'rows':_0x5775f1}:null;}})[_0x8b79('0x46')](respondWithResult(_0x515319,null))[_0x8b79('0x4b')](handleError(_0x515319,null));};exports[_0x8b79('0x5d')]=function(_0x4be273,_0xde1e74,_0x542c01){return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x4be273[_0x8b79('0x4d')]['id']}})['then'](handleEntityNotFound(_0xde1e74,null))[_0x8b79('0x46')](function(_0xbcb892){if(_0xbcb892){return _0xbcb892[_0x8b79('0x5d')](_0x4be273[_0x8b79('0x36')][_0x8b79('0x57')]);}})['then'](respondWithStatusCode(_0xde1e74,null))[_0x8b79('0x4b')](handleError(_0xde1e74,null));};exports[_0x8b79('0x5e')]=function(_0x3d730b,_0x2d51ce,_0x1742af){if(_0x3d730b[_0x8b79('0x51')]['id']){delete _0x3d730b['body']['id'];}return db[_0x8b79('0x31')][_0x8b79('0x4f')]({'where':{'id':_0x3d730b[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x2d51ce,null))[_0x8b79('0x46')](function(_0x4ee762){if(_0x4ee762){_0x3d730b[_0x8b79('0x51')]['ChatGroupId']=_0x4ee762['id'];return db[_0x8b79('0x54')][_0x8b79('0x50')](_0x3d730b[_0x8b79('0x51')]);}})[_0x8b79('0x46')](respondWithResult(_0x2d51ce,null))[_0x8b79('0x4b')](handleError(_0x2d51ce,null));};exports[_0x8b79('0x5f')]=function(_0x1035d1,_0x26e4e1,_0x46930c){var _0x56507c={};var _0x8ee065={};var _0x5b53b5;var _0x4158ce;return db['ChatGroup'][_0x8b79('0x5a')]({'where':{'id':_0x1035d1[_0x8b79('0x4d')]['id']}})[_0x8b79('0x46')](handleEntityNotFound(_0x26e4e1,null))[_0x8b79('0x46')](function(_0x261779){if(_0x261779){_0x5b53b5=_0x261779;_0x8ee065[_0x8b79('0x35')]=_[_0x8b79('0x5b')](db['ChatInternalMessage'][_0x8b79('0x32')]);_0x8ee065[_0x8b79('0x36')]=_['keys'](_0x1035d1['query']);_0x8ee065['filters']=_[_0x8b79('0x37')](_0x8ee065['model'],_0x8ee065[_0x8b79('0x36')]);_0x56507c[_0x8b79('0x38')]=_[_0x8b79('0x37')](_0x8ee065[_0x8b79('0x35')],qs[_0x8b79('0x39')](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x39')]));_0x56507c['attributes']=_0x56507c[_0x8b79('0x38')][_0x8b79('0x4e')]?_0x56507c[_0x8b79('0x38')]:_0x8ee065[_0x8b79('0x35')];_0x56507c[_0x8b79('0x3c')]=qs['sort'](_0x1035d1['query'][_0x8b79('0x3d')]);_0x56507c['where']=qs[_0x8b79('0x3f')](_['pick'](_0x1035d1['query'],_0x8ee065['filters']));if(_0x1035d1[_0x8b79('0x36')]['filter']){_0x56507c[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x56507c[_0x8b79('0x3e')],{'$or':_['map'](_0x56507c[_0x8b79('0x38')],function(_0x4adbd7){var _0x5e4fc5={};_0x5e4fc5[_0x4adbd7]={'$like':'%'+_0x1035d1[_0x8b79('0x36')][_0x8b79('0x41')]+'%'};return _0x5e4fc5;})});}if(_0x1035d1[_0x8b79('0x36')][_0x8b79('0x60')]){var _0x520603=_0x1035d1[_0x8b79('0x36')][_0x8b79('0x60')]['split'](',');var _0x2e6764={};_0x2e6764[_0x520603[0x0]]={'$gte':moment(_0x520603[0x1])[_0x8b79('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56507c[_0x8b79('0x3e')]=_[_0x8b79('0x42')](_0x56507c[_0x8b79('0x3e')],_0x2e6764);}_0x56507c=_[_0x8b79('0x42')]({},_0x56507c,_0x1035d1[_0x8b79('0x45')]);return _0x5b53b5[_0x8b79('0x5f')](_0x56507c);}})['then'](function(_0x257c9d){if(_0x257c9d){_0x4158ce=_0x257c9d[_0x8b79('0x4e')];if(!_0x1035d1[_0x8b79('0x36')][_0x8b79('0x3a')](_0x8b79('0x3b'))){_0x56507c[_0x8b79('0x23')]=qs[_0x8b79('0x23')](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x23')]);_0x56507c[_0x8b79('0x20')]=qs['offset'](_0x1035d1[_0x8b79('0x36')][_0x8b79('0x20')]);}return _0x5b53b5['getMessages'](_0x56507c);}})[_0x8b79('0x46')](function(_0x3f3b09){if(_0x3f3b09){return _0x3f3b09?{'count':_0x4158ce,'rows':_0x3f3b09}:null;}})[_0x8b79('0x46')](respondWithResult(_0x26e4e1,null))[_0x8b79('0x4b')](handleError(_0x26e4e1,null));}; \ No newline at end of file +var _0xd9a2=['rawAttributes','intersection','include','find','create','body','params','destroy','describe','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','order','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','ChatGroup','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','then','includeAll','findAll','rows','catch','show'];(function(_0x928b87,_0x53480a){var _0x1e7638=function(_0x1e2184){while(--_0x1e2184){_0x928b87['push'](_0x928b87['shift']());}};_0x1e7638(++_0x53480a);}(_0xd9a2,0xe3));var _0x2d9a=function(_0x4eafc4,_0x17672d){_0x4eafc4=_0x4eafc4-0x0;var _0x52ee00=_0xd9a2[_0x4eafc4];return _0x52ee00;};'use strict';var emlformat=require(_0x2d9a('0x0'));var rimraf=require(_0x2d9a('0x1'));var zipdir=require(_0x2d9a('0x2'));var jsonpatch=require(_0x2d9a('0x3'));var rp=require(_0x2d9a('0x4'));var moment=require(_0x2d9a('0x5'));var BPromise=require(_0x2d9a('0x6'));var Mustache=require(_0x2d9a('0x7'));var util=require('util');var path=require(_0x2d9a('0x8'));var sox=require(_0x2d9a('0x9'));var csv=require('to-csv');var ejs=require(_0x2d9a('0xa'));var fs=require('fs');var fs_extra=require(_0x2d9a('0xb'));var _=require(_0x2d9a('0xc'));var squel=require(_0x2d9a('0xd'));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(_0x2d9a('0xe'));var Redis=require(_0x2d9a('0xf'));var authService=require(_0x2d9a('0x10'));var qs=require(_0x2d9a('0x11'));var as=require(_0x2d9a('0x12'));var hardwareService=require(_0x2d9a('0x13'));var logger=require(_0x2d9a('0x14'))(_0x2d9a('0x15'));var utils=require(_0x2d9a('0x16'));var config=require(_0x2d9a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2d9a('0x18')](config[_0x2d9a('0x19')],{'host':_0x2d9a('0x1a'),'port':0x18eb});var socket=require(_0x2d9a('0x1b'))(new Redis(config[_0x2d9a('0x19')]));require(_0x2d9a('0x1c'))[_0x2d9a('0x1d')](socket);function respondWithStatusCode(_0x1ee042,_0x36efc2){_0x36efc2=_0x36efc2||0xcc;return function(_0x52a806){if(_0x52a806){return _0x1ee042[_0x2d9a('0x1e')](_0x36efc2);}return _0x1ee042['status'](_0x36efc2)[_0x2d9a('0x1f')]();};}function respondWithResult(_0x24e83c,_0x457bd3){_0x457bd3=_0x457bd3||0xc8;return function(_0x2605b9){if(_0x2605b9){return _0x24e83c[_0x2d9a('0x20')](_0x457bd3)[_0x2d9a('0x21')](_0x2605b9);}};}function respondWithFilteredResult(_0x5f41aa,_0x4ed5fe){return function(_0x434479){if(_0x434479){var _0x907cf5=typeof _0x4ed5fe[_0x2d9a('0x22')]===_0x2d9a('0x23')&&typeof _0x4ed5fe[_0x2d9a('0x24')]==='undefined';var _0x3ff554=_0x434479[_0x2d9a('0x25')];var _0x9937ee=_0x907cf5?0x0:_0x4ed5fe[_0x2d9a('0x22')];var _0xe452c9=_0x907cf5?_0x434479[_0x2d9a('0x25')]:_0x4ed5fe[_0x2d9a('0x22')]+_0x4ed5fe[_0x2d9a('0x24')];var _0x5886ff;if(_0xe452c9>=_0x3ff554){_0xe452c9=_0x3ff554;_0x5886ff=0xc8;}else{_0x5886ff=0xce;}_0x5f41aa[_0x2d9a('0x20')](_0x5886ff);return _0x5f41aa[_0x2d9a('0x26')](_0x2d9a('0x27'),_0x9937ee+'-'+_0xe452c9+'/'+_0x3ff554)[_0x2d9a('0x21')](_0x434479);}return null;};}function patchUpdates(_0x1e28fc){return function(_0x422598){try{jsonpatch[_0x2d9a('0x28')](_0x422598,_0x1e28fc,!![]);}catch(_0x4befd2){return BPromise[_0x2d9a('0x29')](_0x4befd2);}return _0x422598[_0x2d9a('0x2a')]();};}function saveUpdates(_0x2c68a6,_0x196d60){return function(_0x1aed37){if(_0x1aed37){return _0x1aed37[_0x2d9a('0x2b')](_0x2c68a6)['then'](function(_0x10b221){return _0x10b221;});}return null;};}function removeEntity(_0x3b46cd,_0x302cbd){return function(_0x55346b){if(_0x55346b){return _0x55346b['destroy']()['then'](function(){_0x3b46cd[_0x2d9a('0x20')](0xcc)[_0x2d9a('0x1f')]();});}};}function handleEntityNotFound(_0x3eae1d,_0x1b6dcd){return function(_0x5288c6){if(!_0x5288c6){_0x3eae1d[_0x2d9a('0x1e')](0x194);}return _0x5288c6;};}function handleError(_0x1464d0,_0x5214a4){_0x5214a4=_0x5214a4||0x1f4;return function(_0x12b5f9){logger[_0x2d9a('0x2c')](_0x12b5f9[_0x2d9a('0x2d')]);if(_0x12b5f9[_0x2d9a('0x2e')]){delete _0x12b5f9['name'];}_0x1464d0[_0x2d9a('0x20')](_0x5214a4)[_0x2d9a('0x2f')](_0x12b5f9);};}exports['index']=function(_0x35a088,_0x1ca864){var _0x4dfca6={},_0x3bd35c={},_0x31d6ae={'count':0x0,'rows':[]};var _0x2ae865=_[_0x2d9a('0x30')](db[_0x2d9a('0x31')]['rawAttributes'],function(_0x4c0bd2){return{'name':_0x4c0bd2[_0x2d9a('0x32')],'type':_0x4c0bd2[_0x2d9a('0x33')]['key']};});_0x3bd35c[_0x2d9a('0x34')]=_[_0x2d9a('0x30')](_0x2ae865,_0x2d9a('0x2e'));_0x3bd35c[_0x2d9a('0x35')]=_[_0x2d9a('0x36')](_0x35a088[_0x2d9a('0x35')]);_0x3bd35c[_0x2d9a('0x37')]=_['intersection'](_0x3bd35c[_0x2d9a('0x34')],_0x3bd35c[_0x2d9a('0x35')]);_0x4dfca6['attributes']=_['intersection'](_0x3bd35c[_0x2d9a('0x34')],qs[_0x2d9a('0x38')](_0x35a088['query'][_0x2d9a('0x38')]));_0x4dfca6[_0x2d9a('0x39')]=_0x4dfca6[_0x2d9a('0x39')][_0x2d9a('0x3a')]?_0x4dfca6[_0x2d9a('0x39')]:_0x3bd35c[_0x2d9a('0x34')];if(!_0x35a088[_0x2d9a('0x35')][_0x2d9a('0x3b')](_0x2d9a('0x3c'))){_0x4dfca6[_0x2d9a('0x24')]=qs['limit'](_0x35a088[_0x2d9a('0x35')]['limit']);_0x4dfca6[_0x2d9a('0x22')]=qs[_0x2d9a('0x22')](_0x35a088[_0x2d9a('0x35')]['offset']);}_0x4dfca6['order']=qs[_0x2d9a('0x3d')](_0x35a088[_0x2d9a('0x35')]['sort']);_0x4dfca6['where']=qs[_0x2d9a('0x37')](_['pick'](_0x35a088[_0x2d9a('0x35')],_0x3bd35c['filters']),_0x2ae865);if(_0x35a088['query'][_0x2d9a('0x3e')]){_0x4dfca6['where']=_[_0x2d9a('0x3f')](_0x4dfca6[_0x2d9a('0x40')],{'$or':_[_0x2d9a('0x30')](_0x2ae865,function(_0x5259de){if(_0x5259de[_0x2d9a('0x33')]!==_0x2d9a('0x41')){var _0x5108c6={};_0x5108c6[_0x5259de[_0x2d9a('0x2e')]]={'$like':'%'+_0x35a088['query'][_0x2d9a('0x3e')]+'%'};return _0x5108c6;}})});}_0x4dfca6=_['merge']({},_0x4dfca6,_0x35a088[_0x2d9a('0x42')]);var _0x18993e={'where':_0x4dfca6[_0x2d9a('0x40')]};return db[_0x2d9a('0x31')][_0x2d9a('0x25')](_0x18993e)[_0x2d9a('0x43')](function(_0x2ed5b2){_0x31d6ae[_0x2d9a('0x25')]=_0x2ed5b2;if(_0x35a088['query'][_0x2d9a('0x44')]){_0x4dfca6['include']=[{'all':!![]}];}return db[_0x2d9a('0x31')][_0x2d9a('0x45')](_0x4dfca6);})[_0x2d9a('0x43')](function(_0x24db61){_0x31d6ae[_0x2d9a('0x46')]=_0x24db61;return _0x31d6ae;})[_0x2d9a('0x43')](respondWithFilteredResult(_0x1ca864,_0x4dfca6))[_0x2d9a('0x47')](handleError(_0x1ca864,null));};exports[_0x2d9a('0x48')]=function(_0x1d3cb9,_0x565b22){var _0x328a63={'raw':!![],'where':{'id':_0x1d3cb9['params']['id']}},_0x476697={};_0x476697[_0x2d9a('0x34')]=_['keys'](db[_0x2d9a('0x31')][_0x2d9a('0x49')]);_0x476697[_0x2d9a('0x35')]=_[_0x2d9a('0x36')](_0x1d3cb9[_0x2d9a('0x35')]);_0x476697[_0x2d9a('0x37')]=_[_0x2d9a('0x4a')](_0x476697['model'],_0x476697['query']);_0x328a63[_0x2d9a('0x39')]=_['intersection'](_0x476697[_0x2d9a('0x34')],qs[_0x2d9a('0x38')](_0x1d3cb9[_0x2d9a('0x35')][_0x2d9a('0x38')]));_0x328a63['attributes']=_0x328a63['attributes'][_0x2d9a('0x3a')]?_0x328a63[_0x2d9a('0x39')]:_0x476697[_0x2d9a('0x34')];if(_0x1d3cb9[_0x2d9a('0x35')][_0x2d9a('0x44')]){_0x328a63[_0x2d9a('0x4b')]=[{'all':!![]}];}_0x328a63=_[_0x2d9a('0x3f')]({},_0x328a63,_0x1d3cb9['options']);return db[_0x2d9a('0x31')][_0x2d9a('0x4c')](_0x328a63)[_0x2d9a('0x43')](handleEntityNotFound(_0x565b22,null))[_0x2d9a('0x43')](respondWithResult(_0x565b22,null))[_0x2d9a('0x47')](handleError(_0x565b22,null));};exports[_0x2d9a('0x4d')]=function(_0xf1656e,_0x5a3b9d){return db[_0x2d9a('0x31')][_0x2d9a('0x4d')](_0xf1656e[_0x2d9a('0x4e')],{})[_0x2d9a('0x43')](respondWithResult(_0x5a3b9d,0xc9))[_0x2d9a('0x47')](handleError(_0x5a3b9d,null));};exports[_0x2d9a('0x2b')]=function(_0x4cbfa0,_0x3fe239){if(_0x4cbfa0[_0x2d9a('0x4e')]['id']){delete _0x4cbfa0[_0x2d9a('0x4e')]['id'];}return db[_0x2d9a('0x31')][_0x2d9a('0x4c')]({'where':{'id':_0x4cbfa0[_0x2d9a('0x4f')]['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0x3fe239,null))[_0x2d9a('0x43')](saveUpdates(_0x4cbfa0[_0x2d9a('0x4e')],null))[_0x2d9a('0x43')](respondWithResult(_0x3fe239,null))[_0x2d9a('0x47')](handleError(_0x3fe239,null));};exports[_0x2d9a('0x50')]=function(_0x2e77a7,_0x11024a){return db[_0x2d9a('0x31')][_0x2d9a('0x4c')]({'where':{'id':_0x2e77a7[_0x2d9a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x11024a,null))[_0x2d9a('0x43')](removeEntity(_0x11024a,null))[_0x2d9a('0x47')](handleError(_0x11024a,null));};exports[_0x2d9a('0x51')]=function(_0x47e189,_0x5d9eea){return db[_0x2d9a('0x31')][_0x2d9a('0x51')]()[_0x2d9a('0x43')](respondWithResult(_0x5d9eea,null))['catch'](handleError(_0x5d9eea,null));};exports['getUnread']=function(_0x3c90b4,_0x133916,_0x11c3f8){return db['ChatInternalMessage'][_0x2d9a('0x25')]({'where':{'ChatGroupId':_0x3c90b4[_0x2d9a('0x4f')]['id'],'ToId':_0x3c90b4[_0x2d9a('0x52')]['id'],'read':![]}})[_0x2d9a('0x43')](function(_0x2a42e5){return{'id':_[_0x2d9a('0x53')](_0x3c90b4[_0x2d9a('0x4f')]['id']),'count':_0x2a42e5};})['then'](respondWithResult(_0x133916,null))[_0x2d9a('0x47')](handleError(_0x133916,null));};exports['addMembers']=function(_0x457191,_0x14b2c4,_0x39a19d){return db[_0x2d9a('0x31')][_0x2d9a('0x4c')]({'where':{'id':_0x457191[_0x2d9a('0x4f')]['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0x14b2c4,null))[_0x2d9a('0x43')](function(_0x5db16f){if(_0x5db16f){return _0x5db16f[_0x2d9a('0x54')](_0x457191[_0x2d9a('0x4e')][_0x2d9a('0x55')],_[_0x2d9a('0x56')](_0x457191[_0x2d9a('0x4e')],[_0x2d9a('0x55'),'id'])||{});}})[_0x2d9a('0x43')](respondWithResult(_0x14b2c4,null))[_0x2d9a('0x47')](handleError(_0x14b2c4,null));};exports[_0x2d9a('0x57')]=function(_0x450cc9,_0x4a6c08,_0x23206e){var _0xc69104={};var _0x7f48f={};var _0x3fc9da;var _0x2b8a4a;return db[_0x2d9a('0x31')][_0x2d9a('0x58')]({'where':{'id':_0x450cc9[_0x2d9a('0x4f')]['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0x4a6c08,null))['then'](function(_0x26ab9e){if(_0x26ab9e){_0x3fc9da=_0x26ab9e;_0x7f48f[_0x2d9a('0x34')]=_['keys'](db[_0x2d9a('0x59')][_0x2d9a('0x49')]);_0x7f48f[_0x2d9a('0x35')]=_[_0x2d9a('0x36')](_0x450cc9[_0x2d9a('0x35')]);_0x7f48f[_0x2d9a('0x37')]=_[_0x2d9a('0x4a')](_0x7f48f[_0x2d9a('0x34')],_0x7f48f[_0x2d9a('0x35')]);_0xc69104['attributes']=_['intersection'](_0x7f48f[_0x2d9a('0x34')],qs['fields'](_0x450cc9[_0x2d9a('0x35')]['fields']));_0xc69104[_0x2d9a('0x39')]=_0xc69104[_0x2d9a('0x39')][_0x2d9a('0x3a')]?_0xc69104['attributes']:_0x7f48f['model'];_0xc69104['order']=qs[_0x2d9a('0x3d')](_0x450cc9['query']['sort']);_0xc69104[_0x2d9a('0x40')]=qs[_0x2d9a('0x37')](_[_0x2d9a('0x5a')](_0x450cc9[_0x2d9a('0x35')],_0x7f48f['filters']));if(_0x450cc9[_0x2d9a('0x35')][_0x2d9a('0x3e')]){_0xc69104[_0x2d9a('0x40')]=_[_0x2d9a('0x3f')](_0xc69104[_0x2d9a('0x40')],{'$or':_[_0x2d9a('0x30')](_0xc69104['attributes'],function(_0x2dff97){var _0x35cb6e={};_0x35cb6e[_0x2dff97]={'$like':'%'+_0x450cc9['query'][_0x2d9a('0x3e')]+'%'};return _0x35cb6e;})});}_0xc69104=_[_0x2d9a('0x3f')]({},_0xc69104,_0x450cc9[_0x2d9a('0x42')]);return _0x3fc9da['getMembers'](_0xc69104);}})['then'](function(_0x51389c){if(_0x51389c){_0x2b8a4a=_0x51389c[_0x2d9a('0x3a')];if(!_0x450cc9[_0x2d9a('0x35')]['hasOwnProperty'](_0x2d9a('0x3c'))){_0xc69104[_0x2d9a('0x24')]=qs[_0x2d9a('0x24')](_0x450cc9[_0x2d9a('0x35')][_0x2d9a('0x24')]);_0xc69104[_0x2d9a('0x22')]=qs[_0x2d9a('0x22')](_0x450cc9[_0x2d9a('0x35')][_0x2d9a('0x22')]);}return _0x3fc9da[_0x2d9a('0x57')](_0xc69104);}})[_0x2d9a('0x43')](function(_0x31946e){if(_0x31946e){return _0x31946e?{'count':_0x2b8a4a,'rows':_0x31946e}:null;}})[_0x2d9a('0x43')](respondWithResult(_0x4a6c08,null))[_0x2d9a('0x47')](handleError(_0x4a6c08,null));};exports['removeMembers']=function(_0x4d1b3f,_0x40b3b8,_0x2fb4a5){return db[_0x2d9a('0x31')]['find']({'where':{'id':_0x4d1b3f[_0x2d9a('0x4f')]['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0x40b3b8,null))[_0x2d9a('0x43')](function(_0x2d3184){if(_0x2d3184){return _0x2d3184[_0x2d9a('0x5b')](_0x4d1b3f['query'][_0x2d9a('0x55')]);}})[_0x2d9a('0x43')](respondWithStatusCode(_0x40b3b8,null))[_0x2d9a('0x47')](handleError(_0x40b3b8,null));};exports[_0x2d9a('0x5c')]=function(_0x5b221b,_0xfc6a6f,_0x442e1c){if(_0x5b221b['body']['id']){delete _0x5b221b[_0x2d9a('0x4e')]['id'];}return db[_0x2d9a('0x31')]['find']({'where':{'id':_0x5b221b[_0x2d9a('0x4f')]['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0xfc6a6f,null))[_0x2d9a('0x43')](function(_0x3c5293){if(_0x3c5293){_0x5b221b[_0x2d9a('0x4e')][_0x2d9a('0x5d')]=_0x3c5293['id'];return db[_0x2d9a('0x5e')][_0x2d9a('0x4d')](_0x5b221b[_0x2d9a('0x4e')]);}})['then'](respondWithResult(_0xfc6a6f,null))[_0x2d9a('0x47')](handleError(_0xfc6a6f,null));};exports[_0x2d9a('0x5f')]=function(_0x5261b1,_0x380349,_0x491033){var _0x1018c9={};var _0x54f8d0={};var _0x183250;var _0x4f52d5;return db[_0x2d9a('0x31')][_0x2d9a('0x58')]({'where':{'id':_0x5261b1['params']['id']}})[_0x2d9a('0x43')](handleEntityNotFound(_0x380349,null))[_0x2d9a('0x43')](function(_0x2ed4b2){if(_0x2ed4b2){_0x183250=_0x2ed4b2;_0x54f8d0['model']=_[_0x2d9a('0x36')](db['ChatInternalMessage'][_0x2d9a('0x49')]);_0x54f8d0[_0x2d9a('0x35')]=_[_0x2d9a('0x36')](_0x5261b1['query']);_0x54f8d0[_0x2d9a('0x37')]=_[_0x2d9a('0x4a')](_0x54f8d0[_0x2d9a('0x34')],_0x54f8d0[_0x2d9a('0x35')]);_0x1018c9[_0x2d9a('0x39')]=_[_0x2d9a('0x4a')](_0x54f8d0[_0x2d9a('0x34')],qs['fields'](_0x5261b1[_0x2d9a('0x35')]['fields']));_0x1018c9[_0x2d9a('0x39')]=_0x1018c9[_0x2d9a('0x39')][_0x2d9a('0x3a')]?_0x1018c9[_0x2d9a('0x39')]:_0x54f8d0['model'];_0x1018c9[_0x2d9a('0x60')]=qs[_0x2d9a('0x3d')](_0x5261b1[_0x2d9a('0x35')][_0x2d9a('0x3d')]);_0x1018c9[_0x2d9a('0x40')]=qs[_0x2d9a('0x37')](_[_0x2d9a('0x5a')](_0x5261b1[_0x2d9a('0x35')],_0x54f8d0[_0x2d9a('0x37')]));if(_0x5261b1[_0x2d9a('0x35')]['filter']){_0x1018c9[_0x2d9a('0x40')]=_[_0x2d9a('0x3f')](_0x1018c9['where'],{'$or':_[_0x2d9a('0x30')](_0x1018c9[_0x2d9a('0x39')],function(_0x2d2915){var _0x3b4f6b={};_0x3b4f6b[_0x2d2915]={'$like':'%'+_0x5261b1['query'][_0x2d9a('0x3e')]+'%'};return _0x3b4f6b;})});}if(_0x5261b1[_0x2d9a('0x35')]['$gte']){var _0x3ddf4e=_0x5261b1[_0x2d9a('0x35')]['$gte'][_0x2d9a('0x61')](',');var _0x2ee9e5={};_0x2ee9e5[_0x3ddf4e[0x0]]={'$gte':moment(_0x3ddf4e[0x1])[_0x2d9a('0x62')](_0x2d9a('0x63'))};_0x1018c9[_0x2d9a('0x40')]=_[_0x2d9a('0x3f')](_0x1018c9[_0x2d9a('0x40')],_0x2ee9e5);}_0x1018c9=_['merge']({},_0x1018c9,_0x5261b1[_0x2d9a('0x42')]);return _0x183250['getMessages'](_0x1018c9);}})[_0x2d9a('0x43')](function(_0x4252c8){if(_0x4252c8){_0x4f52d5=_0x4252c8[_0x2d9a('0x3a')];if(!_0x5261b1[_0x2d9a('0x35')][_0x2d9a('0x3b')]('nolimit')){_0x1018c9[_0x2d9a('0x24')]=qs['limit'](_0x5261b1[_0x2d9a('0x35')][_0x2d9a('0x24')]);_0x1018c9['offset']=qs[_0x2d9a('0x22')](_0x5261b1[_0x2d9a('0x35')][_0x2d9a('0x22')]);}return _0x183250[_0x2d9a('0x5f')](_0x1018c9);}})[_0x2d9a('0x43')](function(_0x270e02){if(_0x270e02){return _0x270e02?{'count':_0x4f52d5,'rows':_0x270e02}:null;}})['then'](respondWithResult(_0x380349,null))[_0x2d9a('0x47')](handleError(_0x380349,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b4d2699..b1c3d97 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 _0xf23c=['emit','hasOwnProperty','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xf23c,0x77));var _0xcf23=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xf23c[_0x529296];return _0x1796bf;};'use strict';var EventEmitter=require(_0xcf23('0x0'));var ChatGroup=require(_0xcf23('0x1'))['db'][_0xcf23('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xcf23('0x3')](0x0);var events={'afterCreate':_0xcf23('0x4'),'afterUpdate':_0xcf23('0x5'),'afterDestroy':_0xcf23('0x6')};function emitEvent(_0x1b327e){return function(_0xa91945,_0x33f3de,_0x224af1){ChatGroupEvents[_0xcf23('0x7')](_0x1b327e+':'+_0xa91945['id'],_0xa91945);ChatGroupEvents[_0xcf23('0x7')](_0x1b327e,_0xa91945);_0x224af1(null);};}for(var e in events){if(events[_0xcf23('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5370=['ChatGroup','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0xe7d30b,_0x525bf2){var _0x2bf356=function(_0x262321){while(--_0x262321){_0xe7d30b['push'](_0xe7d30b['shift']());}};_0x2bf356(++_0x525bf2);}(_0x5370,0x11f));var _0x0537=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5370[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x0537('0x0'))['db'][_0x0537('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0537('0x2')](0x0);var events={'afterCreate':_0x0537('0x3'),'afterUpdate':_0x0537('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5b4b37){return function(_0x11a816,_0x49fdcc,_0x1d1758){ChatGroupEvents[_0x0537('0x5')](_0x5b4b37+':'+_0x11a816['id'],_0x11a816);ChatGroupEvents[_0x0537('0x5')](_0x5b4b37,_0x11a816);_0x1d1758(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x0537('0x6')](e,emitEvent(event));}}module[_0x0537('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 2bafd2e..7d05668 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 _0xad60=['request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api','moment','bluebird'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0xad60,0x1a0));var _0x0ad6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xad60[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x0ad6('0x0'));var logger=require('../../config/logger')(_0x0ad6('0x1'));var moment=require(_0x0ad6('0x2'));var BPromise=require(_0x0ad6('0x3'));var rp=require(_0x0ad6('0x4'));var fs=require('fs');var path=require(_0x0ad6('0x5'));var rimraf=require(_0x0ad6('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ad6('0x7'));module[_0x0ad6('0x8')]=function(_0x4b0e32,_0x214e01){return _0x4b0e32[_0x0ad6('0x9')](_0x0ad6('0xa'),attributes,{'tableName':_0x0ad6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a0=['../../config/logger','api','moment','request-promise','path','./chatGroup.attributes','exports','define','chat_groups','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x97a0,0x1df));var _0x097a=function(_0x6cca03,_0x56d2c5){_0x6cca03=_0x6cca03-0x0;var _0xd48afc=_0x97a0[_0x6cca03];return _0xd48afc;};'use strict';var _=require('lodash');var util=require(_0x097a('0x0'));var logger=require(_0x097a('0x1'))(_0x097a('0x2'));var moment=require(_0x097a('0x3'));var BPromise=require('bluebird');var rp=require(_0x097a('0x4'));var fs=require('fs');var path=require(_0x097a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x097a('0x6'));module[_0x097a('0x7')]=function(_0xce0c3d,_0x2b8608){return _0xce0c3d[_0x097a('0x8')]('ChatGroup',attributes,{'tableName':_0x097a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b159606..0b9cd29 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 _0xc923=['redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1a5f94,_0x19b888){var _0x352348=function(_0x16c899){while(--_0x16c899){_0x1a5f94['push'](_0x1a5f94['shift']());}};_0x352348(++_0x19b888);}(_0xc923,0x1ef));var _0x3c92=function(_0x513e90,_0x186a7c){_0x513e90=_0x513e90-0x0;var _0x5401be=_0xc923[_0x513e90];return _0x5401be;};'use strict';var _=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var moment=require(_0x3c92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c92('0x3'))(_0x3c92('0x4'));var config=require(_0x3c92('0x5'));var jayson=require(_0x3c92('0x6'));var client=jayson[_0x3c92('0x7')][_0x3c92('0x8')]({'port':0x232a});config[_0x3c92('0x9')]=_[_0x3c92('0xa')](config[_0x3c92('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c92('0xb'))(new Redis(config[_0x3c92('0x9')]));require(_0x3c92('0xc'))[_0x3c92('0xd')](socket);function respondWithRpcPromise(_0x5dcd73,_0x2e1eeb,_0x59300c){return new BPromise(function(_0x31addc,_0x4c3628){return client[_0x3c92('0xe')](_0x5dcd73,_0x59300c)[_0x3c92('0xf')](function(_0x1be3a3){logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));logger['debug'](_0x3c92('0x13'),_0x2e1eeb,_0x3c92('0x12'),JSON['stringify'](_0x1be3a3));if(_0x1be3a3[_0x3c92('0x14')]){if(_0x1be3a3[_0x3c92('0x14')]['code']===0x1f4){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);return _0x4c3628(_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);}logger[_0x3c92('0x14')](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3['error'][_0x3c92('0x15')]);return _0x31addc(_0x1be3a3[_0x3c92('0x14')]['message']);}else{logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));_0x31addc(_0x1be3a3[_0x3c92('0x16')]['message']);}})[_0x3c92('0x17')](function(_0x6a6264){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x6a6264);_0x4c3628(_0x6a6264);});});} \ No newline at end of file +var _0x42b0=['error','code','message','result','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0x42b0,0xbc));var _0x042b=function(_0x42afab,_0x1e14b4){_0x42afab=_0x42afab-0x0;var _0x40f14=_0x42b0[_0x42afab];return _0x40f14;};'use strict';var _=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var moment=require('moment');var BPromise=require(_0x042b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x042b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x042b('0x4'))(_0x042b('0x5'));var config=require(_0x042b('0x6'));var jayson=require(_0x042b('0x7'));var client=jayson[_0x042b('0x8')]['http']({'port':0x232a});config['redis']=_[_0x042b('0x9')](config[_0x042b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x042b('0xa')]));require('./chatGroup.socket')[_0x042b('0xb')](socket);function respondWithRpcPromise(_0x5686b7,_0x3f01e1,_0x2ba4c2){return new BPromise(function(_0x1d2796,_0x25dec5){return client[_0x042b('0xc')](_0x5686b7,_0x2ba4c2)[_0x042b('0xd')](function(_0x1bb764){logger[_0x042b('0xe')](_0x042b('0xf'),_0x3f01e1,_0x042b('0x10'));logger[_0x042b('0x11')](_0x042b('0x12'),_0x3f01e1,_0x042b('0x10'),JSON['stringify'](_0x1bb764));if(_0x1bb764[_0x042b('0x13')]){if(_0x1bb764['error'][_0x042b('0x14')]===0x1f4){logger['error'](_0x042b('0xf'),_0x3f01e1,_0x1bb764[_0x042b('0x13')][_0x042b('0x15')]);return _0x25dec5(_0x1bb764[_0x042b('0x13')][_0x042b('0x15')]);}logger[_0x042b('0x13')]('ChatGroup,\x20%s,\x20%s',_0x3f01e1,_0x1bb764[_0x042b('0x13')][_0x042b('0x15')]);return _0x1d2796(_0x1bb764[_0x042b('0x13')][_0x042b('0x15')]);}else{logger[_0x042b('0xe')]('ChatGroup,\x20%s,\x20%s',_0x3f01e1,_0x042b('0x10'));_0x1d2796(_0x1bb764[_0x042b('0x16')]['message']);}})['catch'](function(_0x25063e){logger[_0x042b('0x13')]('ChatGroup,\x20%s,\x20%s',_0x3f01e1,_0x25063e);_0x25dec5(_0x25063e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 098b865..9a00f9b 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 _0xb3f8=['./chatGroup.events','save','remove','update','removeListener','register','length','chatGroup:'];(function(_0x540479,_0x340e8e){var _0x532937=function(_0x5e6a3e){while(--_0x5e6a3e){_0x540479['push'](_0x540479['shift']());}};_0x532937(++_0x340e8e);}(_0xb3f8,0xd8));var _0x8b3f=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xb3f8[_0x1305e3];return _0x1068e9;};'use strict';var ChatGroupEvents=require(_0x8b3f('0x0'));var events=[_0x8b3f('0x1'),_0x8b3f('0x2'),_0x8b3f('0x3')];function createListener(_0xfa619e,_0x219282){return function(_0x4f19df){_0x219282['emit'](_0xfa619e,_0x4f19df);};}function removeListener(_0x28a818,_0x10855d){return function(){ChatGroupEvents[_0x8b3f('0x4')](_0x28a818,_0x10855d);};}exports[_0x8b3f('0x5')]=function(_0x3f0a75){for(var _0x306214=0x0,_0x218b7a=events[_0x8b3f('0x6')];_0x306214<_0x218b7a;_0x306214++){var _0x7c3f89=events[_0x306214];var _0x3c47d8=createListener(_0x8b3f('0x7')+_0x7c3f89,_0x3f0a75);ChatGroupEvents['on'](_0x7c3f89,_0x3c47d8);}}; \ No newline at end of file +var _0x069d=['./chatGroup.events','remove','emit','removeListener','register','chatGroup:'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x069d,0x11a));var _0xd069=function(_0x3116fa,_0x63ef5b){_0x3116fa=_0x3116fa-0x0;var _0x568b53=_0x069d[_0x3116fa];return _0x568b53;};'use strict';var ChatGroupEvents=require(_0xd069('0x0'));var events=['save',_0xd069('0x1'),'update'];function createListener(_0x17cee0,_0x17a266){return function(_0x5b2eb9){_0x17a266[_0xd069('0x2')](_0x17cee0,_0x5b2eb9);};}function removeListener(_0x441e2a,_0x4b64b3){return function(){ChatGroupEvents[_0xd069('0x3')](_0x441e2a,_0x4b64b3);};}exports[_0xd069('0x4')]=function(_0x50ee01){for(var _0x2935b6=0x0,_0x349aaf=events['length'];_0x2935b6<_0x349aaf;_0x2935b6++){var _0x12428d=events[_0x2935b6];var _0x1c04de=createListener(_0xd069('0x5')+_0x12428d,_0x50ee01);ChatGroupEvents['on'](_0x12428d,_0x1c04de);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e278a11..6948b29 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 _0x8322=['getUnread','/:id/members','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread'];(function(_0x39dd6f,_0x28cfe1){var _0x1d0a8a=function(_0x40b4cd){while(--_0x40b4cd){_0x39dd6f['push'](_0x39dd6f['shift']());}};_0x1d0a8a(++_0x28cfe1);}(_0x8322,0x109));var _0x2832=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x8322[_0x55ff3e];return _0x2709eb;};'use strict';var multer=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var path=require(_0x2832('0x2'));var timeout=require(_0x2832('0x3'));var express=require(_0x2832('0x4'));var router=express[_0x2832('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2832('0x6'));var interaction=require(_0x2832('0x7'));var config=require('../../config/environment');var controller=require(_0x2832('0x8'));router[_0x2832('0x9')]('/',auth[_0x2832('0xa')](),controller[_0x2832('0xb')]);router['get']('/describe',auth[_0x2832('0xa')](),controller[_0x2832('0xc')]);router[_0x2832('0x9')](_0x2832('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2832('0x9')](_0x2832('0xe'),auth[_0x2832('0xa')](),controller[_0x2832('0xf')]);router['get'](_0x2832('0x10'),auth[_0x2832('0xa')](),controller['getMembers']);router[_0x2832('0x9')](_0x2832('0x11'),auth['isAuthenticated'](),controller[_0x2832('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2832('0x13')]);router[_0x2832('0x14')](_0x2832('0x10'),auth[_0x2832('0xa')](),controller[_0x2832('0x15')]);router[_0x2832('0x14')](_0x2832('0x11'),auth['isAuthenticated'](),controller[_0x2832('0x16')]);router[_0x2832('0x17')](_0x2832('0xd'),auth[_0x2832('0xa')](),controller[_0x2832('0x18')]);router[_0x2832('0x19')](_0x2832('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x2832('0x19')](_0x2832('0x10'),auth[_0x2832('0xa')](),controller[_0x2832('0x1a')]);module[_0x2832('0x1b')]=router; \ No newline at end of file +var _0x05c9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','util','path'];(function(_0x391b19,_0x214efa){var _0x4789ff=function(_0x7fffe5){while(--_0x7fffe5){_0x391b19['push'](_0x391b19['shift']());}};_0x4789ff(++_0x214efa);}(_0x05c9,0x153));var _0x905c=function(_0x3a6da7,_0x1943ff){_0x3a6da7=_0x3a6da7-0x0;var _0x3aa944=_0x05c9[_0x3a6da7];return _0x3aa944;};'use strict';var multer=require('multer');var util=require(_0x905c('0x0'));var path=require(_0x905c('0x1'));var timeout=require(_0x905c('0x2'));var express=require(_0x905c('0x3'));var router=express[_0x905c('0x4')]();var fs_extra=require(_0x905c('0x5'));var auth=require(_0x905c('0x6'));var interaction=require(_0x905c('0x7'));var config=require('../../config/environment');var controller=require(_0x905c('0x8'));router[_0x905c('0x9')]('/',auth[_0x905c('0xa')](),controller[_0x905c('0xb')]);router['get'](_0x905c('0xc'),auth[_0x905c('0xa')](),controller[_0x905c('0xd')]);router[_0x905c('0x9')](_0x905c('0xe'),auth['isAuthenticated'](),controller[_0x905c('0xf')]);router[_0x905c('0x9')](_0x905c('0x10'),auth[_0x905c('0xa')](),controller[_0x905c('0x11')]);router[_0x905c('0x9')](_0x905c('0x12'),auth[_0x905c('0xa')](),controller[_0x905c('0x13')]);router[_0x905c('0x9')](_0x905c('0x14'),auth[_0x905c('0xa')](),controller[_0x905c('0x15')]);router[_0x905c('0x16')]('/',auth[_0x905c('0xa')](),controller[_0x905c('0x17')]);router['post'](_0x905c('0x12'),auth[_0x905c('0xa')](),controller[_0x905c('0x18')]);router[_0x905c('0x16')](_0x905c('0x14'),auth[_0x905c('0xa')](),controller['addMessage']);router[_0x905c('0x19')]('/:id',auth[_0x905c('0xa')](),controller[_0x905c('0x1a')]);router[_0x905c('0x1b')](_0x905c('0xe'),auth[_0x905c('0xa')](),controller[_0x905c('0x1c')]);router[_0x905c('0x1b')]('/:id/members',auth[_0x905c('0xa')](),controller[_0x905c('0x1d')]);module[_0x905c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b41d884..ce725e3 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 _0x5eb6=['INTEGER','ENUM','star','TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5eb6,0x81));var _0x65eb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5eb6[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x65eb('0x0'));module[_0x65eb('0x1')]={'closed':{'type':Sequelize[_0x65eb('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x65eb('0x3')]},'ratingType':{'type':Sequelize[_0x65eb('0x4')](_0x65eb('0x5'),'thumb'),'defaultValue':_0x65eb('0x5')},'ratingMessage':{'type':Sequelize[_0x65eb('0x6')]},'pathTranscript':{'type':Sequelize[_0x65eb('0x6')]},'mailTranscript':{'type':Sequelize[_0x65eb('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x65eb('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x65eb('0x7')]},'note':{'type':Sequelize[_0x65eb('0x7')]},'browserName':{'type':Sequelize[_0x65eb('0x7')]},'browserVersion':{'type':Sequelize[_0x65eb('0x7')]},'osName':{'type':Sequelize[_0x65eb('0x7')]},'osVersion':{'type':Sequelize[_0x65eb('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x65eb('0x7')]},'deviceType':{'type':Sequelize[_0x65eb('0x7')]},'referer':{'type':Sequelize[_0x65eb('0x6')]},'customerIp':{'type':Sequelize[_0x65eb('0x7')]},'formData':{'type':Sequelize[_0x65eb('0x6')](_0x65eb('0x8'))},'read1stAt':{'type':Sequelize[_0x65eb('0x9')]},'lastMsgAt':{'type':Sequelize[_0x65eb('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x65eb('0x4')]('in',_0x65eb('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x65eb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x65eb('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x65eb('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x65eb('0x3')]}}; \ No newline at end of file +var _0xa239=['thumb','star','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM'];(function(_0x317204,_0x3a8d53){var _0x29bed7=function(_0x29c8a5){while(--_0x29c8a5){_0x317204['push'](_0x317204['shift']());}};_0x29bed7(++_0x3a8d53);}(_0xa239,0x96));var _0x9a23=function(_0x25c476,_0x47ad6d){_0x25c476=_0x25c476-0x0;var _0x4640b4=_0xa239[_0x25c476];return _0x4640b4;};'use strict';var Sequelize=require(_0x9a23('0x0'));module['exports']={'closed':{'type':Sequelize[_0x9a23('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9a23('0x2')]},'ratingType':{'type':Sequelize[_0x9a23('0x3')]('star',_0x9a23('0x4')),'defaultValue':_0x9a23('0x5')},'ratingMessage':{'type':Sequelize[_0x9a23('0x6')]},'pathTranscript':{'type':Sequelize[_0x9a23('0x6')]},'mailTranscript':{'type':Sequelize[_0x9a23('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9a23('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9a23('0x7')]},'thirdDisposition':{'type':Sequelize[_0x9a23('0x7')]},'note':{'type':Sequelize[_0x9a23('0x7')]},'browserName':{'type':Sequelize[_0x9a23('0x7')]},'browserVersion':{'type':Sequelize[_0x9a23('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x9a23('0x7')]},'deviceModel':{'type':Sequelize[_0x9a23('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x9a23('0x6')]},'customerIp':{'type':Sequelize[_0x9a23('0x7')]},'formData':{'type':Sequelize[_0x9a23('0x6')](_0x9a23('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x9a23('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9a23('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9a23('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x9a23('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x9a23('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9a23('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 52640e2..b446c05 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 _0xfd1c=['result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','index','map','rawAttributes','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','UserId','%s%d','System','customer','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','sort','includeAgent','push','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x28e32c,_0x33fe75){var _0x17d631=function(_0xc41bb4){while(--_0xc41bb4){_0x28e32c['push'](_0x28e32c['shift']());}};_0x17d631(++_0x33fe75);}(_0xfd1c,0xb4));var _0xcfd1=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xfd1c[_0x39a04c];return _0x580cb0;};'use strict';var rimraf=require(_0xcfd1('0x0'));var zipdir=require(_0xcfd1('0x1'));var rp=require(_0xcfd1('0x2'));var moment=require(_0xcfd1('0x3'));var BPromise=require(_0xcfd1('0x4'));var Mustache=require('mustache');var util=require(_0xcfd1('0x5'));var path=require('path');var ejs=require(_0xcfd1('0x6'));var fs=require('fs');var _=require(_0xcfd1('0x7'));var Redis=require(_0xcfd1('0x8'));var interaction=require(_0xcfd1('0x9'));var qs=require(_0xcfd1('0xa'));var pdf=require(_0xcfd1('0xb'));var logger=require(_0xcfd1('0xc'))('api');var config=require(_0xcfd1('0xd'));var db=require(_0xcfd1('0xe'))['db'];config[_0xcfd1('0xf')]=_[_0xcfd1('0x10')](config[_0xcfd1('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfd1('0xf')]));require(_0xcfd1('0x11'))[_0xcfd1('0x12')](socket);var jayson=require(_0xcfd1('0x13'));var client=jayson[_0xcfd1('0x14')][_0xcfd1('0x15')]({'port':0x232b});var client9004=jayson[_0xcfd1('0x14')][_0xcfd1('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x18b57f,_0x2374ff,_0x49bf54,_0x45ca98){return new BPromise(function(_0x26e097,_0x581c5a){var _0x44ab9e=_0x45ca98||client;return _0x44ab9e[_0xcfd1('0x16')](_0x18b57f,_0x49bf54)[_0xcfd1('0x17')](function(_0x265b91){logger[_0xcfd1('0x18')](_0xcfd1('0x19'),_0x2374ff,_0xcfd1('0x1a'));logger[_0xcfd1('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2374ff,_0xcfd1('0x1a'),JSON['stringify'](_0x265b91));if(_0x265b91[_0xcfd1('0x1c')]){if(_0x265b91['error'][_0xcfd1('0x1d')]===0x1f4){logger[_0xcfd1('0x1c')](_0xcfd1('0x19'),_0x2374ff,_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);return _0x581c5a(_0x265b91['error'][_0xcfd1('0x1e')]);}logger[_0xcfd1('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2374ff,_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);return _0x26e097(_0x265b91[_0xcfd1('0x1c')][_0xcfd1('0x1e')]);}else{logger['info'](_0xcfd1('0x19'),_0x2374ff,_0xcfd1('0x1a'));_0x26e097(_0x265b91[_0xcfd1('0x1f')]['message']);}})[_0xcfd1('0x20')](function(_0x5df472){logger[_0xcfd1('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2374ff,_0x5df472);_0x581c5a(_0x5df472);});});}function respondWithStatusCode(_0x43f734,_0x14738e){_0x14738e=_0x14738e||0xcc;return function(_0xc57912){if(_0xc57912){return _0x43f734[_0xcfd1('0x21')](_0x14738e);}return _0x43f734['status'](_0x14738e)[_0xcfd1('0x22')]();};}function respondWithResult(_0xec2e61,_0x2a8852){_0x2a8852=_0x2a8852||0xc8;return function(_0x4463dc){if(_0x4463dc){return _0xec2e61[_0xcfd1('0x23')](_0x2a8852)[_0xcfd1('0x24')](_0x4463dc);}};}function respondWithFilteredResult(_0x189860,_0xb049d2){return function(_0x1fea49){if(_0x1fea49){var _0x3a43eb=typeof _0xb049d2[_0xcfd1('0x25')]===_0xcfd1('0x26')&&typeof _0xb049d2[_0xcfd1('0x27')]===_0xcfd1('0x26');var _0x2de5c0=_0x1fea49[_0xcfd1('0x28')];var _0x1c0b21=_0x3a43eb?0x0:_0xb049d2[_0xcfd1('0x25')];var _0x159c7d=_0x3a43eb?_0x1fea49[_0xcfd1('0x28')]:_0xb049d2[_0xcfd1('0x25')]+_0xb049d2[_0xcfd1('0x27')];var _0x4964ff;if(_0x159c7d>=_0x2de5c0){_0x159c7d=_0x2de5c0;_0x4964ff=0xc8;}else{_0x4964ff=0xce;}_0x189860[_0xcfd1('0x23')](_0x4964ff);return _0x189860[_0xcfd1('0x29')](_0xcfd1('0x2a'),_0x1c0b21+'-'+_0x159c7d+'/'+_0x2de5c0)[_0xcfd1('0x24')](_0x1fea49);}return null;};}function saveUpdates(_0x154534){return function(_0x45107d){if(_0x45107d){return _0x45107d[_0xcfd1('0x2b')](_0x154534)[_0xcfd1('0x17')](function(_0x355b77){return _0x355b77;});}return null;};}function removeEntity(_0x21dd45){return function(_0x13740){if(_0x13740){return _0x13740[_0xcfd1('0x2c')]()[_0xcfd1('0x17')](function(){_0x21dd45['status'](0xcc)[_0xcfd1('0x22')]();});}};}function handleEntityNotFound(_0x1c6e37){return function(_0x34d7c1){if(!_0x34d7c1){_0x1c6e37['sendStatus'](0x194);}return _0x34d7c1;};}function handleError(_0x3fc990,_0x24a8b8){_0x24a8b8=_0x24a8b8||0x1f4;return function(_0x859981){logger[_0xcfd1('0x1c')](_0x859981[_0xcfd1('0x2d')]);if(_0x859981[_0xcfd1('0x2e')]){delete _0x859981[_0xcfd1('0x2e')];}_0x3fc990[_0xcfd1('0x23')](_0x24a8b8)['send'](_0x859981);};}function getMustacheRender(_0x511344,_0x432122){return Mustache[_0xcfd1('0x2f')](_0x511344,_[_0xcfd1('0x30')](_0x432122[_0xcfd1('0x31')],{'contact':_0x432122[_0xcfd1('0x32')],'message':_0x432122[_0xcfd1('0x1e')],'agent':_0x432122[_0xcfd1('0x33')],'interaction':_0x432122['interaction'],'account':_0x432122['account']}))||'';}exports[_0xcfd1('0x34')]=function(_0x2f4ba1,_0x490898){var _0x28efd4={};var _0x365e74=_[_0xcfd1('0x35')](db['ChatInteraction'][_0xcfd1('0x36')],function(_0x15e7ce){return{'name':_0x15e7ce['fieldName'],'type':_0x15e7ce[_0xcfd1('0x37')][_0xcfd1('0x38')]};});_0x28efd4=qs[_0xcfd1('0x39')](_0x365e74,_0x2f4ba1);return interaction[_0xcfd1('0x3a')](_0xcfd1('0x3b'),_0x2f4ba1[_0xcfd1('0x3c')],_0x2f4ba1[_0xcfd1('0x3d')],_0x28efd4,_0x365e74)[_0xcfd1('0x17')](respondWithFilteredResult(_0x490898,_0x28efd4))['catch'](handleError(_0x490898,null));};exports[_0xcfd1('0x3e')]=function(_0x2c35ae,_0x4508e4){var _0x3c2d00={'raw':![],'where':{'id':_0x2c35ae[_0xcfd1('0x3f')]['id']}},_0x665a3e={};_0x665a3e[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db[_0xcfd1('0x42')][_0xcfd1('0x36')]);_0x665a3e[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x2c35ae[_0xcfd1('0x3c')]);_0x665a3e[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x665a3e['model'],_0x665a3e[_0xcfd1('0x3c')]);_0x3c2d00[_0xcfd1('0x45')]=_['intersection'](_0x665a3e['model'],qs[_0xcfd1('0x46')](_0x2c35ae[_0xcfd1('0x3c')]['fields']));_0x3c2d00['attributes']=_0x3c2d00['attributes'][_0xcfd1('0x47')]?_0x3c2d00[_0xcfd1('0x45')]:_0x665a3e[_0xcfd1('0x40')];if(_0x2c35ae[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x3c2d00[_0xcfd1('0x49')]=[{'all':!![]}];}_0x3c2d00=_[_0xcfd1('0x30')]({},_0x3c2d00,_0x2c35ae[_0xcfd1('0x4a')]);return db[_0xcfd1('0x42')]['find'](_0x3c2d00)['then'](handleEntityNotFound(_0x4508e4,null))[_0xcfd1('0x17')](respondWithResult(_0x4508e4,null))[_0xcfd1('0x20')](handleError(_0x4508e4,null));};exports[_0xcfd1('0x4b')]=function(_0x11b4f6,_0x30274c){return db[_0xcfd1('0x42')][_0xcfd1('0x4b')](_0x11b4f6[_0xcfd1('0x31')],{})[_0xcfd1('0x17')](respondWithResult(_0x30274c,0xc9))[_0xcfd1('0x20')](handleError(_0x30274c,null));};exports[_0xcfd1('0x2b')]=function(_0x33b961,_0x3a59a7){if(_0x33b961[_0xcfd1('0x31')]['id']){delete _0x33b961[_0xcfd1('0x31')]['id'];}return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x33b961[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x3a59a7,null))[_0xcfd1('0x17')](saveUpdates(_0x33b961['body'],null))[_0xcfd1('0x17')](respondWithResult(_0x3a59a7,null))[_0xcfd1('0x20')](handleError(_0x3a59a7,null));};exports['destroy']=function(_0x4c7af9,_0x54aebb){return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x4c7af9[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x54aebb,null))[_0xcfd1('0x17')](removeEntity(_0x54aebb,null))['catch'](handleError(_0x54aebb,null));};exports[_0xcfd1('0x4d')]=function(_0x58d248,_0x377646){return db[_0xcfd1('0x42')][_0xcfd1('0x4d')]()['then'](respondWithResult(_0x377646,null))[_0xcfd1('0x20')](handleError(_0x377646,null));};exports[_0xcfd1('0x4e')]=function(_0x3a2110,_0x39869d){var _0x2d571e=_0x3a2110[_0xcfd1('0x3f')]['id'];var _0x1d2afc;var _0x57123c;var _0x532c3d;return db[_0xcfd1('0x42')][_0xcfd1('0x4f')]({'where':{'id':_0x2d571e}})[_0xcfd1('0x17')](function(_0x40e929){_0x1d2afc=_0x40e929;return db[_0xcfd1('0x50')][_0xcfd1('0x4f')]({'where':{'id':_0x40e929[_0xcfd1('0x51')]},'attributes':['id','vidaooApiKey',_0xcfd1('0x52'),_0xcfd1('0x53'),_0xcfd1('0x54'),_0xcfd1('0x55')],'raw':!![]});})[_0xcfd1('0x17')](function(_0x2dbe9d){if(_0x2dbe9d&&_0x2dbe9d[_0xcfd1('0x56')]&&_0x2dbe9d['vidaooEscalation']){_0x57123c=_0x2dbe9d;var _0x2098b7={'interaction':{'id':_0x2d571e},'agent':{'id':_0x3a2110[_0xcfd1('0x3d')]['id'],'name':_0x3a2110[_0xcfd1('0x3d')][_0xcfd1('0x2e')],'fullname':_0x3a2110[_0xcfd1('0x3d')][_0xcfd1('0x57')],'email':_0x3a2110[_0xcfd1('0x3d')]['email']},'contact':_0x3a2110[_0xcfd1('0x31')][_0xcfd1('0x32')],'account':_0x3a2110[_0xcfd1('0x31')]['account']};var _0x3e41d7={'rejectUnauthorized':![],'method':_0xcfd1('0x58'),'url':_0xcfd1('0x59'),'headers':{'X-APIKEY':_0x2dbe9d[_0xcfd1('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3a2110[_0xcfd1('0x3d')]['email']],'buttons':null,'topic':_0x57123c[_0xcfd1('0x53')],'note':_['isNull'](_0x57123c[_0xcfd1('0x54')])?null:getMustacheRender(_0x57123c[_0xcfd1('0x54')],_0x2098b7),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xcfd1('0x5a')](_0x57123c[_0xcfd1('0x55')])){var _0x54d513=getMustacheRender(_0x57123c[_0xcfd1('0x55')],_0x2098b7);var _0x2cd245=JSON[_0xcfd1('0x5b')](_0x54d513);_0x3e41d7['body'][_0xcfd1('0x5c')]=_0x2cd245;}}catch(_0x21f3d2){throw new db[(_0xcfd1('0x5d'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3e41d7);}else{throw new db[(_0xcfd1('0x5d'))]['ValidationError'](_0xcfd1('0x5e'));}})[_0xcfd1('0x17')](function(_0x3c9f23){_0x532c3d=_0x3c9f23;if(_0x532c3d['id']){var _0x33b0d0={'body':_0x532c3d[_0xcfd1('0x5f')],'ChatWebsiteId':_0x57123c['id'],'ChatInteractionId':_0x1d2afc['id'],'direction':_0xcfd1('0x60'),'UserId':_0x3a2110[_0xcfd1('0x3d')]['id']};return db[_0xcfd1('0x61')][_0xcfd1('0x4b')](_0x33b0d0,{});}else{throw new db[(_0xcfd1('0x5d'))][(_0xcfd1('0x62'))](_0xcfd1('0x63'));}})['then'](function(){return _0x1d2afc[_0xcfd1('0x64')]({'vidaooSessionId':_0x532c3d['id']});})['then'](respondWithResult(_0x39869d,null))[_0xcfd1('0x20')](handleError(_0x39869d,null));};exports['customUpdate']=function(_0x430d5d,_0x39f857){if(_0x430d5d[_0xcfd1('0x31')]['id']){delete _0x430d5d['body']['id'];}return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x430d5d[_0xcfd1('0x3f')]['id']},'include':[{'model':db[_0xcfd1('0x65')],'as':_0xcfd1('0x66')}]})[_0xcfd1('0x17')](handleEntityNotFound(_0x39f857,null))[_0xcfd1('0x17')](saveUpdates(_0x430d5d[_0xcfd1('0x31')],null))[_0xcfd1('0x17')](respondWithResult(_0x39f857,null))['catch'](handleError(_0x39f857,null));};exports[_0xcfd1('0x67')]=function(_0x5ac6d3,_0x46eb82){if(_0x5ac6d3[_0xcfd1('0x31')]['id']){delete _0x5ac6d3['body']['id'];}return db['ChatInteraction'][_0xcfd1('0x4c')]({'where':{'id':_0x5ac6d3[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](function(_0x3c392c){if(!_0x3c392c){logger['error'](_0xcfd1('0x68'),'abandon',0x194,_0xcfd1('0x69'));_0x46eb82[_0xcfd1('0x21')](0x194);}else{if(_0x3c392c['UserId']){throw new db[(_0xcfd1('0x5d'))][(_0xcfd1('0x62'))](_0xcfd1('0x6a'));}}return _0x3c392c;})[_0xcfd1('0x17')](function(_0x32738f){if(_0x32738f){return _0x32738f[_0xcfd1('0x2b')]({'closed':_0x5ac6d3[_0xcfd1('0x31')]['closed'],'disposition':_0x5ac6d3[_0xcfd1('0x31')][_0xcfd1('0x6b')]})[_0xcfd1('0x17')](function(_0x1f467c){return _0x1f467c;});}})[_0xcfd1('0x17')](function(){return respondWithRpcPromise(_0xcfd1('0x6c'),_0xcfd1('0x67'),_0x5ac6d3['body'],client9004);})[_0xcfd1('0x17')](respondWithResult(_0x46eb82,null))[_0xcfd1('0x20')](handleError(_0x46eb82,null));};exports[_0xcfd1('0x6d')]=function(_0xa6960b,_0x21da91){_0xa6960b[_0xcfd1('0x31')]['name']=_0xa6960b[_0xcfd1('0x6e')][_0xcfd1('0x6f')];_0xa6960b[_0xcfd1('0x31')][_0xcfd1('0x70')]=_0xa6960b['file'][_0xcfd1('0x71')];_0xa6960b[_0xcfd1('0x31')][_0xcfd1('0x37')]=_0xa6960b[_0xcfd1('0x6e')][_0xcfd1('0x72')];return db[_0xcfd1('0x73')][_0xcfd1('0x4b')](_0xa6960b[_0xcfd1('0x31')])[_0xcfd1('0x17')](respondWithResult(_0x21da91,0xc9))['catch'](handleError(_0x21da91,null));};exports[_0xcfd1('0x74')]=function(_0x511568,_0x157382){return db[_0xcfd1('0x42')]['findOne']({'where':{'id':_0x511568[_0xcfd1('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x157382,null))['then'](function(_0x22be54){if(_0x22be54){if(_0x22be54[_0xcfd1('0x75')]){return _0x157382[_0xcfd1('0x23')](0x193)[_0xcfd1('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xcfd1('0x73')]['findOne']({'where':{'id':_0x511568['query'][_0xcfd1('0x76')]},'raw':!![]})['then'](handleEntityNotFound(_0x157382,null));}})['then'](function(_0x3dde84){if(_0x3dde84){var _0x40b7b5=_0x3dde84['ChatOfflineMessageId']!==null;var _0x45f045=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0x79'));if(_0x40b7b5){_0x45f045=path['join'](_0x45f045,_0xcfd1('0x7a'));}var _0x134eca=path[_0xcfd1('0x77')](_0x45f045,_0x3dde84[_0xcfd1('0x70')]);return _0x157382[_0xcfd1('0x7b')](_0x134eca);}})[_0xcfd1('0x20')](handleError(_0x157382,null));};exports[_0xcfd1('0x7c')]=function(_0x9ac1e1,_0x2a5fec){var _0x45badc=null;var _0x45f656=null;var _0x348145=null;if(_0x9ac1e1['body']['id']){delete _0x9ac1e1['body']['id'];}if(_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x7d')]){_0x348145=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0x7e'),util[_0xcfd1('0x7f')](_0xcfd1('0x80'),Date[_0xcfd1('0x81')]()));_0x9ac1e1['body'][_0xcfd1('0x82')]=_0x348145;}return db['ChatInteraction'][_0xcfd1('0x4c')]({'where':{'id':_0x9ac1e1[_0xcfd1('0x3f')]['id']},'include':[{'model':db[_0xcfd1('0x61')],'as':'Messages','include':[{'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83')}]}]})[_0xcfd1('0x17')](handleEntityNotFound(_0x2a5fec,null))[_0xcfd1('0x17')](saveUpdates(_0x9ac1e1[_0xcfd1('0x31')],null))['then'](function(_0x45cb24){if(_0x45cb24){_0x45badc=_0x45cb24;return db['ChatWebsite']['find']({'where':{'id':_0x45badc[_0xcfd1('0x51')]}});}})[_0xcfd1('0x17')](function(_0xc6b764){if(_0xc6b764){_0x45f656=_0xc6b764;return db['CmContact'][_0xcfd1('0x4c')]({'where':{'id':_0x45badc[_0xcfd1('0x84')]}});}})[_0xcfd1('0x17')](function(_0x43351f){if(_0x43351f){if(_0x348145){var _0x3e44cd=null;for(var _0x1f07c3=0x1;_0x1f07c3<_0x45badc['Messages']['length'];++_0x1f07c3){_0x3e44cd=_0x45badc[_0xcfd1('0x85')][_0x1f07c3];var _0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util[_0xcfd1('0x7f')](_0xcfd1('0x87'),_0x45f656['agentAlias'],_0x3e44cd['UserId']):_0xcfd1('0x88');var _0x543d14=_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x89')]||util['format']('%s%d','Visitor',_0x3e44cd['ContactId']);switch(_0x45f656['agentIdentifier']){case _0xcfd1('0x8a'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util[_0xcfd1('0x7f')](_0xcfd1('0x87'),_0x45f656[_0xcfd1('0x8b')],_0x3e44cd[_0xcfd1('0x86')]):_0xcfd1('0x88');break;case _0xcfd1('0x8c'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?_0x3e44cd[_0xcfd1('0x83')][_0xcfd1('0x8d')]||_0x3e44cd[_0xcfd1('0x83')]['fullname']:_0xcfd1('0x88');break;case _0xcfd1('0x8e'):_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?_0x3e44cd[_0xcfd1('0x83')][_0xcfd1('0x57')]:_0xcfd1('0x88');break;default:_0x12c2c0=_0x3e44cd[_0xcfd1('0x86')]?util['format']('%s%d',_0x45f656[_0xcfd1('0x8b')],_0x3e44cd[_0xcfd1('0x86')]):_0xcfd1('0x88');}var _0x59bebd=util[_0xcfd1('0x7f')](_0xcfd1('0x8f'),moment(_0x3e44cd[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0x91')),_0x3e44cd[_0xcfd1('0x92')]==='in'?_0x543d14:_0x12c2c0,_0x3e44cd['body']);if(!_0x3e44cd[_0xcfd1('0x93')]){fs[_0xcfd1('0x94')](_0x348145,_0x59bebd);}}return db[_0xcfd1('0x95')][_0xcfd1('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0xcfd1('0x96')],'as':_0xcfd1('0x97'),'raw':!![],'include':[{'model':db[_0xcfd1('0x98')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x41240b){if(!_0x41240b||!_0x41240b[_0xcfd1('0x97')]||!_0x9ac1e1['body'])return _0x45badc;var _0x457d03=_0x41240b[_0xcfd1('0x99')]();return respondWithRpcPromise(_0xcfd1('0x9a'),_0xcfd1('0x9b'),{'account':_0x457d03,'message':{'from':util[_0xcfd1('0x7f')](_0xcfd1('0x9c'),_0x41240b[_0xcfd1('0x2e')],_0x41240b[_0xcfd1('0x9d')]||_0x41240b[_0xcfd1('0x97')][_0xcfd1('0x3d')]),'to':_0x9ac1e1[_0xcfd1('0x31')][_0xcfd1('0x7d')],'subject':_0xcfd1('0x9e'),'text':util['format'](_0xcfd1('0x9f'),_0x9ac1e1[_0xcfd1('0x31')]['mailTranscript']),'attachments':[{'path':_0x348145}]}})['then'](function(){return _0x45badc;})[_0xcfd1('0x20')](function(_0x2214f9){logger['error'](_0x2214f9);});})[_0xcfd1('0x17')](respondWithStatusCode(_0x2a5fec,0xc8))[_0xcfd1('0x20')](handleError(_0x2a5fec,null));};exports[_0xcfd1('0xa0')]=function(_0x36bea8,_0x44cb76){return db[_0xcfd1('0x61')]['find']({'where':{'id':_0x36bea8[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x44cb76,null))['then'](function(_0x18318f){if(_0x18318f){return _0x18318f['addMessage'](_0x36bea8[_0xcfd1('0x31')][_0xcfd1('0xa1')],_[_0xcfd1('0xa2')](_0x36bea8[_0xcfd1('0x31')],[_0xcfd1('0xa1'),'id'])||{});}})[_0xcfd1('0x17')](respondWithResult(_0x44cb76,null))[_0xcfd1('0x20')](handleError(_0x44cb76,null));};exports[_0xcfd1('0xa3')]=function(_0x58a2b0,_0x3df92e){var _0x310a90={'raw':![],'where':{}};var _0x14a192={};var _0x761217={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xcfd1('0x4f')]({'where':{'id':_0x58a2b0[_0xcfd1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3df92e,null))[_0xcfd1('0x17')](function(_0x14c1a6){if(_0x14c1a6){_0x14a192[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db['ChatMessage'][_0xcfd1('0x36')]);_0x14a192[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x58a2b0[_0xcfd1('0x3c')]);_0x14a192[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x14a192[_0xcfd1('0x40')],_0x14a192[_0xcfd1('0x3c')]);_0x310a90[_0xcfd1('0x45')]=_['intersection'](_0x14a192[_0xcfd1('0x40')],qs[_0xcfd1('0x46')](_0x58a2b0['query'][_0xcfd1('0x46')]));_0x310a90['attributes']=_0x310a90[_0xcfd1('0x45')]['length']?_0x310a90[_0xcfd1('0x45')]:_0x14a192[_0xcfd1('0x40')];if(!_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xa4')](_0xcfd1('0xa5'))){_0x310a90[_0xcfd1('0x27')]=qs[_0xcfd1('0x27')](_0x58a2b0['query'][_0xcfd1('0x27')]);_0x310a90['offset']=qs[_0xcfd1('0x25')](_0x58a2b0[_0xcfd1('0x3c')]['offset']);}_0x310a90[_0xcfd1('0xa6')]=qs['sort'](_0x58a2b0['query']['sort']);_0x310a90[_0xcfd1('0xa7')]=qs[_0xcfd1('0x43')](_[_0xcfd1('0xa8')](_0x58a2b0[_0xcfd1('0x3c')],_0x14a192['filters']));_0x310a90[_0xcfd1('0xa7')][_0xcfd1('0xa9')]=_0x14c1a6['id'];if(_0x58a2b0['query'][_0xcfd1('0xaa')]){_0x310a90[_0xcfd1('0xa7')]=_['merge'](_0x310a90[_0xcfd1('0xa7')],{'$or':_[_0xcfd1('0x35')](_0x310a90[_0xcfd1('0x45')],function(_0x14fefe){var _0x3df1ff={};_0x3df1ff[_0x14fefe]={'$like':'%'+_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xaa')]+'%'};return _0x3df1ff;})});}if(_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0xab')]){var _0x55ba18=_0x58a2b0['query'][_0xcfd1('0xab')]['split'](',');var _0x1b5b90={};_0x1b5b90[_0x55ba18[0x0]]={'$gte':moment(_0x55ba18[0x1])['format'](_0xcfd1('0xac'))};_0x310a90[_0xcfd1('0xa7')]=_[_0xcfd1('0x30')](_0x310a90['where'],_0x1b5b90);}_0x310a90=_[_0xcfd1('0x30')]({},_0x310a90,_0x58a2b0['options']);return db[_0xcfd1('0x61')][_0xcfd1('0x28')]({'where':_0x310a90[_0xcfd1('0xa7')]})['then'](function(_0x574aa8){_0x761217[_0xcfd1('0x28')]=_0x574aa8;if(_0x58a2b0[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x310a90[_0xcfd1('0x49')]=[{'all':!![]}];}return db[_0xcfd1('0x61')][_0xcfd1('0x3a')](_0x310a90);})[_0xcfd1('0x17')](function(_0x265115){_0x761217[_0xcfd1('0xad')]=_0x265115;return _0x761217;});}})['then'](respondWithFilteredResult(_0x3df92e,_0x310a90))[_0xcfd1('0x20')](handleError(_0x3df92e,null));};exports['getMyMessages']=function(_0x3beedb,_0x5258d7){var _0x141c67={'where':{}},_0x188d3f={},_0x4abd00={'count':0x0,'rows':[]};return db[_0xcfd1('0x42')][_0xcfd1('0x4f')]({'where':{'id':_0x3beedb['params']['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x5258d7,null))[_0xcfd1('0x17')](function(_0x355ddb){if(_0x355ddb){_0x188d3f[_0xcfd1('0x40')]=_[_0xcfd1('0x41')](db['ChatMessage'][_0xcfd1('0x36')]);_0x188d3f[_0xcfd1('0x3c')]=_[_0xcfd1('0x41')](_0x3beedb[_0xcfd1('0x3c')]);_0x188d3f[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x188d3f[_0xcfd1('0x40')],_0x188d3f[_0xcfd1('0x3c')]);_0x141c67[_0xcfd1('0x45')]=_[_0xcfd1('0x44')](_0x188d3f[_0xcfd1('0x40')],qs[_0xcfd1('0x46')](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x46')]));_0x141c67['attributes']=_0x141c67[_0xcfd1('0x45')][_0xcfd1('0x47')]?_0x141c67['attributes']:_0x188d3f[_0xcfd1('0x40')];if(!_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0xa4')]('nolimit')){_0x141c67[_0xcfd1('0x27')]=qs['limit'](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x27')]);_0x141c67[_0xcfd1('0x25')]=qs[_0xcfd1('0x25')](_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x25')]);}_0x141c67['order']=qs[_0xcfd1('0xae')](_0x3beedb[_0xcfd1('0x3c')]['sort']);_0x141c67[_0xcfd1('0xa7')]=qs[_0xcfd1('0x43')](_[_0xcfd1('0xa8')](_0x3beedb['query'],_0x188d3f[_0xcfd1('0x43')]));_0x141c67[_0xcfd1('0xa7')][_0xcfd1('0xa9')]=_0x355ddb['id'];if(_0x3beedb[_0xcfd1('0x3c')]['filter']){_0x141c67[_0xcfd1('0xa7')]=_[_0xcfd1('0x30')](_0x141c67[_0xcfd1('0xa7')],{'$or':_[_0xcfd1('0x35')](_0x141c67[_0xcfd1('0x45')],function(_0x408118){var _0x31f07d={};_0x31f07d[_0x408118]={'$like':'%'+_0x3beedb['query'][_0xcfd1('0xaa')]+'%'};return _0x31f07d;})});}_0x141c67[_0xcfd1('0xa7')][_0xcfd1('0x93')]=![];if(_0x3beedb[_0xcfd1('0x3c')]['id']){_0x141c67[_0xcfd1('0xa7')]['id']={'$gt':_0x3beedb['query']['id']};}_0x141c67=_[_0xcfd1('0x30')]({},_0x141c67,_0x3beedb['options']);return db[_0xcfd1('0x61')][_0xcfd1('0x28')]({'where':_0x141c67[_0xcfd1('0xa7')]})[_0xcfd1('0x17')](function(_0xfd70fa){_0x4abd00[_0xcfd1('0x28')]=_0xfd70fa;_0x141c67['include']=[];if(_0x3beedb['query'][_0xcfd1('0xaf')]){_0x141c67[_0xcfd1('0x49')][_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83'),'attributes':['id',_0xcfd1('0x57'),_0xcfd1('0x8d')]});}if(_0x3beedb[_0xcfd1('0x3c')][_0xcfd1('0x48')]){_0x141c67[_0xcfd1('0x49')]=[{'all':!![]}];}return db[_0xcfd1('0x61')][_0xcfd1('0x3a')](_0x141c67);})[_0xcfd1('0x17')](function(_0x44a7b0){_0x4abd00[_0xcfd1('0xad')]=_0x44a7b0;return _0x4abd00;});}})[_0xcfd1('0x17')](respondWithFilteredResult(_0x5258d7,_0x141c67))[_0xcfd1('0x20')](handleError(_0x5258d7,null));};exports['addTags']=function(_0xc653fd,_0x89d1c1){return db[_0xcfd1('0x42')]['find']({'where':{'id':_0xc653fd[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x89d1c1,null))[_0xcfd1('0x17')](function(_0x52aa1f){if(_0x52aa1f){return _0x52aa1f[_0xcfd1('0xb1')](_0xc653fd[_0xcfd1('0x31')][_0xcfd1('0xa1')],_[_0xcfd1('0xa2')](_0xc653fd[_0xcfd1('0x31')],[_0xcfd1('0xa1'),'id'])||{})[_0xcfd1('0xb2')](function(){return db[_0xcfd1('0xb3')][_0xcfd1('0x3a')]({'attributes':['id','name','color'],'where':{'id':_0xc653fd['body'][_0xcfd1('0xa1')]}});})['then'](function(_0x3aa651){socket['emit'](_0xcfd1('0xb4'),{'id':Number(_0xc653fd[_0xcfd1('0x3f')]['id']),'tags':_0x3aa651||[]});return{'id':Number(_0xc653fd[_0xcfd1('0x3f')]['id']),'tags':_0x3aa651||[]};});}})['then'](respondWithResult(_0x89d1c1,null))['catch'](handleError(_0x89d1c1,null));};exports[_0xcfd1('0xb5')]=function(_0x82e6a3,_0x4d105){return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x82e6a3[_0xcfd1('0x3f')]['id']}})[_0xcfd1('0x17')](handleEntityNotFound(_0x4d105,null))[_0xcfd1('0x17')](function(_0x52751b){if(_0x52751b){return _0x52751b[_0xcfd1('0xb5')](_0x82e6a3['query'][_0xcfd1('0xa1')]);}})['then'](respondWithStatusCode(_0x4d105,null))[_0xcfd1('0x20')](handleError(_0x4d105,null));};exports[_0xcfd1('0x7b')]=function(_0x3e6f82,_0x25a460){var _0x3fef40=moment()[_0xcfd1('0xb6')]()[_0xcfd1('0xb7')]();var _0x376f0f=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),_0xcfd1('0xb9'),_0xcfd1('0xba'));var _0xdd4612=path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),'files',_0xcfd1('0xbb'));var _0x5d7518=path[_0xcfd1('0x77')](_0x376f0f,_0x3fef40);var _0x524729=util[_0xcfd1('0x7f')](_0xcfd1('0xbc'),_0x3e6f82[_0xcfd1('0x3f')]['id'],_0x3fef40);var _0x5ae5b9=path[_0xcfd1('0x77')](_0x376f0f,_0x524729);var _0x464184=[];_0x464184['push']({'model':db[_0xcfd1('0x83')],'as':_0xcfd1('0x83'),'attributes':['id',_0xcfd1('0x57')],'raw':!![]});_0x464184[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x65')],'as':_0xcfd1('0x66'),'attributes':['id',_0xcfd1('0xbd'),_0xcfd1('0xbe')],'raw':!![]});if(_0x3e6f82['query'][_0xcfd1('0xbb')]){_0x464184[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x73')],'as':_0xcfd1('0x73'),'raw':!![]});}var _0x5542f4=[{'model':db[_0xcfd1('0x61')],'as':'Messages','attributes':['id',_0xcfd1('0x31'),_0xcfd1('0x90'),_0xcfd1('0x92'),'secret',_0xcfd1('0xbf')],'include':_0x464184}];_0x5542f4[_0xcfd1('0xb0')]({'model':db[_0xcfd1('0x50')],'as':_0xcfd1('0xc0'),'attributes':['id',_0xcfd1('0x2e')]});_0x5542f4[_0xcfd1('0xb0')]({'model':db['User'],'as':_0xcfd1('0xc1'),'attributes':['id',_0xcfd1('0x57')]});return db[_0xcfd1('0x42')][_0xcfd1('0x4c')]({'where':{'id':_0x3e6f82['params']['id']},'include':_0x5542f4})[_0xcfd1('0x17')](handleEntityNotFound(_0x25a460,null))[_0xcfd1('0x17')](function(_0x15d30f){if(_0x15d30f){var _0x4fa0b0=_0x15d30f[_0xcfd1('0xc2')]({'plain':!![]});fs['mkdirSync'](_0x5d7518);var _0x4e8b24={'channel':_0xcfd1('0xc3'),'account':_0x4fa0b0[_0xcfd1('0xc0')]['name'],'agent':_0x4fa0b0['Owner']?_0x4fa0b0[_0xcfd1('0xc1')][_0xcfd1('0x57')]:_0xcfd1('0xc4'),'createdAt':moment(_0x4fa0b0[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')](),'closedAt':_0x4fa0b0[_0xcfd1('0x75')]?moment(_0x4fa0b0[_0xcfd1('0xc5')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')]():'','disposition':_0x4fa0b0[_0xcfd1('0x6b')],'chatInfo':{'browser':_0x4fa0b0[_0xcfd1('0xc6')],'os':_0x4fa0b0[_0xcfd1('0xc7')],'referer':_0x4fa0b0[_0xcfd1('0xc8')],'customerIp':_0x4fa0b0[_0xcfd1('0xc9')],'customerPort':_0x4fa0b0['customerPort']?_0x4fa0b0['customerPort']:_0xcfd1('0xc4')},'messages':_(_0x4fa0b0[_0xcfd1('0x85')])[_0xcfd1('0xca')]()[_0xcfd1('0xaa')]({'secret':![]})[_0xcfd1('0x35')](function(_0x4585a){if(_0x4585a['Attachment']){var _0x75edb0=path['join'](_0xdd4612,_0x4585a[_0xcfd1('0x73')][_0xcfd1('0x70')]);if(fs[_0xcfd1('0xcb')](_0x75edb0)){fs[_0xcfd1('0xcc')](_0x75edb0)[_0xcfd1('0xcd')](fs[_0xcfd1('0xce')](path[_0xcfd1('0x77')](_0x5d7518,_0x4585a[_0xcfd1('0x73')][_0xcfd1('0x70')])));}}return{'date':moment(_0x4585a[_0xcfd1('0x90')])[_0xcfd1('0x7f')](_0xcfd1('0xac'))[_0xcfd1('0xb7')](),'sender':_0x4585a[_0xcfd1('0x92')]===_0xcfd1('0x60')?_0x4585a['User']?_0x4585a['User'][_0xcfd1('0x57')]:_0xcfd1('0x88'):_0x4585a[_0xcfd1('0x66')]['firstName']+(_0x4585a[_0xcfd1('0x66')][_0xcfd1('0xbe')]?'\x20'+_0x4585a['Contact'][_0xcfd1('0xbe')]:''),'body':_0x4585a[_0xcfd1('0x73')]?_0x4585a['Attachment'][_0xcfd1('0x70')]:_0x4585a[_0xcfd1('0x31')],'direction':_0x4585a['direction']===_0xcfd1('0x60')?'A':'C','secret':_0x4585a[_0xcfd1('0x93')],'read':_0x4585a['read'],'attachment':_0x4585a['Attachment']};})[_0xcfd1('0xcf')]()};return ejs[_0xcfd1('0xd0')](path[_0xcfd1('0x77')](config[_0xcfd1('0x78')],_0xcfd1('0xb8'),'views','downloadInteraction.ejs'),{'interaction':_0x4e8b24})[_0xcfd1('0x17')](function(_0x3e3ba6){var _0x3500a8=path[_0xcfd1('0x77')](_0x5d7518,'transcript-'+_0x4fa0b0['id']+'-'+_0x3fef40+'.pdf');var _0x2e7c72={'path':_0x3500a8,'channel':_0xcfd1('0xc3'),'interactionId':_0x4fa0b0['id']};return pdf[_0xcfd1('0xd1')](_0x3e3ba6,_0x2e7c72);})[_0xcfd1('0x17')](function(){return new Promise(function(_0x112608,_0x2c4446){zipdir(_0x5d7518,{'saveTo':_0x5ae5b9},function(_0x254981,_0x18ed24){if(_0x254981)return _0x2c4446(_0x254981);return _0x112608(_0x18ed24);});})[_0xcfd1('0x17')](function(){return new BPromise(function(_0x4d46f2,_0x4745ad){rimraf(_0x5d7518,function(_0x16cc3a){if(_0x16cc3a)_0x4745ad(_0x16cc3a);return _0x4d46f2();});});})[_0xcfd1('0x17')](function(){return _0x25a460[_0xcfd1('0x7b')](_0x5ae5b9,_0x524729,function(_0x57c799){if(_0x57c799){logger[_0xcfd1('0x1c')](_0xcfd1('0xd2'),_0x57c799);}else{fs['unlinkSync'](_0x5ae5b9);}});});});}else{return _0x25a460[_0xcfd1('0x21')](0xc8);}})['catch'](handleError(_0x25a460,null));}; \ No newline at end of file +var _0xa455=['undefined','limit','count','status','set','Content-Range','update','stack','name','send','render','merge','body','contact','agent','interaction','account','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','catch','show','params','model','keys','ChatInteraction','intersection','attributes','fields','length','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','fullname','email','POST','isNull','vidaooNote','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','customer','%s%d','Visitor','ContactId','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','filter','map','$gte','options','includeAll','include','getMyMessages','pick','ChatInteractionId','push','rows','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','toString','server','files','tmp','transcript-%d-%s.zip','firstName','attachments','read','Account','mkdirSync','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','lastName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','json','offset'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa455,0xb1));var _0x5a45=function(_0x56c697,_0xe08bde){_0x56c697=_0x56c697-0x0;var _0x47ff9a=_0xa455[_0x56c697];return _0x47ff9a;};'use strict';var rimraf=require(_0x5a45('0x0'));var zipdir=require('zip-dir');var rp=require(_0x5a45('0x1'));var moment=require(_0x5a45('0x2'));var BPromise=require(_0x5a45('0x3'));var Mustache=require(_0x5a45('0x4'));var util=require(_0x5a45('0x5'));var path=require(_0x5a45('0x6'));var ejs=require(_0x5a45('0x7'));var fs=require('fs');var _=require(_0x5a45('0x8'));var Redis=require('ioredis');var interaction=require(_0x5a45('0x9'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x5a45('0xa'))('api');var config=require(_0x5a45('0xb'));var db=require(_0x5a45('0xc'))['db'];config[_0x5a45('0xd')]=_[_0x5a45('0xe')](config[_0x5a45('0xd')],{'host':_0x5a45('0xf'),'port':0x18eb});var socket=require(_0x5a45('0x10'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x5a45('0x11')](socket);var jayson=require(_0x5a45('0x12'));var client=jayson[_0x5a45('0x13')][_0x5a45('0x14')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1abde1,_0x18e631,_0x39b930,_0x34e674){return new BPromise(function(_0xe10641,_0x32e3b8){var _0x4e4ff7=_0x34e674||client;return _0x4e4ff7[_0x5a45('0x15')](_0x1abde1,_0x39b930)[_0x5a45('0x16')](function(_0x10a6cc){logger[_0x5a45('0x17')](_0x5a45('0x18'),_0x18e631,_0x5a45('0x19'));logger[_0x5a45('0x1a')](_0x5a45('0x1b'),_0x18e631,_0x5a45('0x19'),JSON[_0x5a45('0x1c')](_0x10a6cc));if(_0x10a6cc[_0x5a45('0x1d')]){if(_0x10a6cc[_0x5a45('0x1d')]['code']===0x1f4){logger[_0x5a45('0x1d')](_0x5a45('0x18'),_0x18e631,_0x10a6cc['error'][_0x5a45('0x1e')]);return _0x32e3b8(_0x10a6cc['error'][_0x5a45('0x1e')]);}logger['error'](_0x5a45('0x18'),_0x18e631,_0x10a6cc['error'][_0x5a45('0x1e')]);return _0xe10641(_0x10a6cc[_0x5a45('0x1d')][_0x5a45('0x1e')]);}else{logger[_0x5a45('0x17')](_0x5a45('0x18'),_0x18e631,_0x5a45('0x19'));_0xe10641(_0x10a6cc[_0x5a45('0x1f')][_0x5a45('0x1e')]);}})['catch'](function(_0x15375a){logger[_0x5a45('0x1d')](_0x5a45('0x18'),_0x18e631,_0x15375a);_0x32e3b8(_0x15375a);});});}function respondWithStatusCode(_0x4e6ada,_0x1ce739){_0x1ce739=_0x1ce739||0xcc;return function(_0x5dab6f){if(_0x5dab6f){return _0x4e6ada[_0x5a45('0x20')](_0x1ce739);}return _0x4e6ada['status'](_0x1ce739)[_0x5a45('0x21')]();};}function respondWithResult(_0x4fbf85,_0x28f8a0){_0x28f8a0=_0x28f8a0||0xc8;return function(_0x4942ae){if(_0x4942ae){return _0x4fbf85['status'](_0x28f8a0)[_0x5a45('0x22')](_0x4942ae);}};}function respondWithFilteredResult(_0x4b2ef3,_0x4052dd){return function(_0x4fb176){if(_0x4fb176){var _0x36e045=typeof _0x4052dd[_0x5a45('0x23')]===_0x5a45('0x24')&&typeof _0x4052dd[_0x5a45('0x25')]===_0x5a45('0x24');var _0x2f1164=_0x4fb176[_0x5a45('0x26')];var _0x5022fb=_0x36e045?0x0:_0x4052dd['offset'];var _0x2a71e2=_0x36e045?_0x4fb176[_0x5a45('0x26')]:_0x4052dd[_0x5a45('0x23')]+_0x4052dd[_0x5a45('0x25')];var _0x171b35;if(_0x2a71e2>=_0x2f1164){_0x2a71e2=_0x2f1164;_0x171b35=0xc8;}else{_0x171b35=0xce;}_0x4b2ef3[_0x5a45('0x27')](_0x171b35);return _0x4b2ef3[_0x5a45('0x28')](_0x5a45('0x29'),_0x5022fb+'-'+_0x2a71e2+'/'+_0x2f1164)['json'](_0x4fb176);}return null;};}function saveUpdates(_0x5de451){return function(_0x98755c){if(_0x98755c){return _0x98755c[_0x5a45('0x2a')](_0x5de451)['then'](function(_0x528a62){return _0x528a62;});}return null;};}function removeEntity(_0x15a00c){return function(_0x16b3f2){if(_0x16b3f2){return _0x16b3f2['destroy']()[_0x5a45('0x16')](function(){_0x15a00c[_0x5a45('0x27')](0xcc)[_0x5a45('0x21')]();});}};}function handleEntityNotFound(_0x39c80c){return function(_0x25dfd4){if(!_0x25dfd4){_0x39c80c[_0x5a45('0x20')](0x194);}return _0x25dfd4;};}function handleError(_0x28bf37,_0x2ab5cc){_0x2ab5cc=_0x2ab5cc||0x1f4;return function(_0x2abf1e){logger['error'](_0x2abf1e[_0x5a45('0x2b')]);if(_0x2abf1e[_0x5a45('0x2c')]){delete _0x2abf1e[_0x5a45('0x2c')];}_0x28bf37[_0x5a45('0x27')](_0x2ab5cc)[_0x5a45('0x2d')](_0x2abf1e);};}function getMustacheRender(_0x55db1b,_0x462cb2){return Mustache[_0x5a45('0x2e')](_0x55db1b,_[_0x5a45('0x2f')](_0x462cb2[_0x5a45('0x30')],{'contact':_0x462cb2[_0x5a45('0x31')],'message':_0x462cb2[_0x5a45('0x1e')],'agent':_0x462cb2[_0x5a45('0x32')],'interaction':_0x462cb2[_0x5a45('0x33')],'account':_0x462cb2[_0x5a45('0x34')]}))||'';}exports['index']=function(_0x2b377b,_0x4a630b){var _0x981523={};var _0x3a65cb=_['map'](db['ChatInteraction'][_0x5a45('0x35')],function(_0x2f11db){return{'name':_0x2f11db[_0x5a45('0x36')],'type':_0x2f11db[_0x5a45('0x37')][_0x5a45('0x38')]};});_0x981523=qs[_0x5a45('0x39')](_0x3a65cb,_0x2b377b);return interaction[_0x5a45('0x3a')](_0x5a45('0x3b'),_0x2b377b[_0x5a45('0x3c')],_0x2b377b[_0x5a45('0x3d')],_0x981523,_0x3a65cb)['then'](respondWithFilteredResult(_0x4a630b,_0x981523))[_0x5a45('0x3e')](handleError(_0x4a630b,null));};exports[_0x5a45('0x3f')]=function(_0x3a14b9,_0x2a7966){var _0x36ff95={'raw':![],'where':{'id':_0x3a14b9[_0x5a45('0x40')]['id']}},_0x1ea5d5={};_0x1ea5d5[_0x5a45('0x41')]=_[_0x5a45('0x42')](db[_0x5a45('0x43')][_0x5a45('0x35')]);_0x1ea5d5[_0x5a45('0x3c')]=_[_0x5a45('0x42')](_0x3a14b9[_0x5a45('0x3c')]);_0x1ea5d5['filters']=_[_0x5a45('0x44')](_0x1ea5d5['model'],_0x1ea5d5[_0x5a45('0x3c')]);_0x36ff95[_0x5a45('0x45')]=_[_0x5a45('0x44')](_0x1ea5d5[_0x5a45('0x41')],qs[_0x5a45('0x46')](_0x3a14b9['query'][_0x5a45('0x46')]));_0x36ff95[_0x5a45('0x45')]=_0x36ff95[_0x5a45('0x45')][_0x5a45('0x47')]?_0x36ff95[_0x5a45('0x45')]:_0x1ea5d5[_0x5a45('0x41')];if(_0x3a14b9[_0x5a45('0x3c')]['includeAll']){_0x36ff95['include']=[{'all':!![]}];}_0x36ff95=_[_0x5a45('0x2f')]({},_0x36ff95,_0x3a14b9['options']);return db[_0x5a45('0x43')][_0x5a45('0x48')](_0x36ff95)[_0x5a45('0x16')](handleEntityNotFound(_0x2a7966,null))[_0x5a45('0x16')](respondWithResult(_0x2a7966,null))[_0x5a45('0x3e')](handleError(_0x2a7966,null));};exports[_0x5a45('0x49')]=function(_0x404620,_0x279955){return db[_0x5a45('0x43')][_0x5a45('0x49')](_0x404620[_0x5a45('0x30')],{})[_0x5a45('0x16')](respondWithResult(_0x279955,0xc9))['catch'](handleError(_0x279955,null));};exports[_0x5a45('0x2a')]=function(_0x1b3b05,_0x1a4099){if(_0x1b3b05[_0x5a45('0x30')]['id']){delete _0x1b3b05[_0x5a45('0x30')]['id'];}return db['ChatInteraction'][_0x5a45('0x48')]({'where':{'id':_0x1b3b05['params']['id']}})['then'](handleEntityNotFound(_0x1a4099,null))[_0x5a45('0x16')](saveUpdates(_0x1b3b05['body'],null))[_0x5a45('0x16')](respondWithResult(_0x1a4099,null))['catch'](handleError(_0x1a4099,null));};exports['destroy']=function(_0x451993,_0x505616){return db[_0x5a45('0x43')]['find']({'where':{'id':_0x451993[_0x5a45('0x40')]['id']}})[_0x5a45('0x16')](handleEntityNotFound(_0x505616,null))['then'](removeEntity(_0x505616,null))['catch'](handleError(_0x505616,null));};exports[_0x5a45('0x4a')]=function(_0x1c9acf,_0x2a3075){return db[_0x5a45('0x43')][_0x5a45('0x4a')]()[_0x5a45('0x16')](respondWithResult(_0x2a3075,null))['catch'](handleError(_0x2a3075,null));};exports[_0x5a45('0x4b')]=function(_0x511d23,_0x28336){var _0x434a73=_0x511d23['params']['id'];var _0x577c20;var _0x2a78e0;var _0xa66262;return db[_0x5a45('0x43')][_0x5a45('0x4c')]({'where':{'id':_0x434a73}})[_0x5a45('0x16')](function(_0x4acb4f){_0x577c20=_0x4acb4f;return db[_0x5a45('0x4d')][_0x5a45('0x4c')]({'where':{'id':_0x4acb4f[_0x5a45('0x4e')]},'attributes':['id',_0x5a45('0x4f'),_0x5a45('0x50'),_0x5a45('0x51'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x5a45('0x16')](function(_0x352b32){if(_0x352b32&&_0x352b32[_0x5a45('0x4f')]&&_0x352b32[_0x5a45('0x50')]){_0x2a78e0=_0x352b32;var _0x4feeca={'interaction':{'id':_0x434a73},'agent':{'id':_0x511d23[_0x5a45('0x3d')]['id'],'name':_0x511d23['user'][_0x5a45('0x2c')],'fullname':_0x511d23[_0x5a45('0x3d')][_0x5a45('0x52')],'email':_0x511d23[_0x5a45('0x3d')][_0x5a45('0x53')]},'contact':_0x511d23['body']['contact'],'account':_0x511d23[_0x5a45('0x30')][_0x5a45('0x34')]};var _0x40f1f9={'rejectUnauthorized':![],'method':_0x5a45('0x54'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x352b32['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x511d23[_0x5a45('0x3d')]['email']],'buttons':null,'topic':_0x2a78e0[_0x5a45('0x51')],'note':_[_0x5a45('0x55')](_0x2a78e0['vidaooNote'])?null:getMustacheRender(_0x2a78e0[_0x5a45('0x56')],_0x4feeca),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x5a45('0x55')](_0x2a78e0['vidaooMetadata'])){var _0x4f6cb0=getMustacheRender(_0x2a78e0['vidaooMetadata'],_0x4feeca);var _0x1a7d9d=JSON['parse'](_0x4f6cb0);_0x40f1f9[_0x5a45('0x30')][_0x5a45('0x57')]=_0x1a7d9d;}}catch(_0x29c23c){throw new db[(_0x5a45('0x58'))][(_0x5a45('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x40f1f9);}else{throw new db['Sequelize'][(_0x5a45('0x59'))](_0x5a45('0x5a'));}})[_0x5a45('0x16')](function(_0x1648b9){_0xa66262=_0x1648b9;if(_0xa66262['id']){var _0x10a024={'body':_0xa66262['join_url'],'ChatWebsiteId':_0x2a78e0['id'],'ChatInteractionId':_0x577c20['id'],'direction':_0x5a45('0x5b'),'UserId':_0x511d23[_0x5a45('0x3d')]['id']};return db[_0x5a45('0x5c')]['create'](_0x10a024,{});}else{throw new db[(_0x5a45('0x58'))][(_0x5a45('0x59'))](_0x5a45('0x5d'));}})[_0x5a45('0x16')](function(){return _0x577c20[_0x5a45('0x5e')]({'vidaooSessionId':_0xa66262['id']});})[_0x5a45('0x16')](respondWithResult(_0x28336,null))[_0x5a45('0x3e')](handleError(_0x28336,null));};exports[_0x5a45('0x5f')]=function(_0x18801f,_0x2759f6){if(_0x18801f[_0x5a45('0x30')]['id']){delete _0x18801f[_0x5a45('0x30')]['id'];}return db[_0x5a45('0x43')]['find']({'where':{'id':_0x18801f[_0x5a45('0x40')]['id']},'include':[{'model':db[_0x5a45('0x60')],'as':_0x5a45('0x61')}]})[_0x5a45('0x16')](handleEntityNotFound(_0x2759f6,null))['then'](saveUpdates(_0x18801f[_0x5a45('0x30')],null))['then'](respondWithResult(_0x2759f6,null))['catch'](handleError(_0x2759f6,null));};exports[_0x5a45('0x62')]=function(_0x2a4b7a,_0x140e8c){if(_0x2a4b7a[_0x5a45('0x30')]['id']){delete _0x2a4b7a[_0x5a45('0x30')]['id'];}return db[_0x5a45('0x43')][_0x5a45('0x48')]({'where':{'id':_0x2a4b7a[_0x5a45('0x40')]['id']}})[_0x5a45('0x16')](function(_0x40c6c5){if(!_0x40c6c5){logger[_0x5a45('0x1d')](_0x5a45('0x63'),_0x5a45('0x62'),0x194,_0x5a45('0x64'));_0x140e8c['sendStatus'](0x194);}else{if(_0x40c6c5[_0x5a45('0x65')]){throw new db[(_0x5a45('0x58'))][(_0x5a45('0x59'))](_0x5a45('0x66'));}}return _0x40c6c5;})[_0x5a45('0x16')](function(_0x4ea1f8){if(_0x4ea1f8){return _0x4ea1f8['update']({'closed':_0x2a4b7a[_0x5a45('0x30')][_0x5a45('0x67')],'disposition':_0x2a4b7a[_0x5a45('0x30')][_0x5a45('0x68')]})[_0x5a45('0x16')](function(_0x3c8343){return _0x3c8343;});}})['then'](function(){return respondWithRpcPromise(_0x5a45('0x69'),_0x5a45('0x62'),_0x2a4b7a[_0x5a45('0x30')],client9004);})[_0x5a45('0x16')](respondWithResult(_0x140e8c,null))[_0x5a45('0x3e')](handleError(_0x140e8c,null));};exports['attachmentUpload']=function(_0x4714e1,_0x569bd2){_0x4714e1[_0x5a45('0x30')][_0x5a45('0x2c')]=_0x4714e1[_0x5a45('0x6a')]['originalname'];_0x4714e1[_0x5a45('0x30')][_0x5a45('0x6b')]=_0x4714e1['file'][_0x5a45('0x6c')];_0x4714e1['body'][_0x5a45('0x37')]=_0x4714e1[_0x5a45('0x6a')][_0x5a45('0x6d')];return db['Attachment'][_0x5a45('0x49')](_0x4714e1[_0x5a45('0x30')])[_0x5a45('0x16')](respondWithResult(_0x569bd2,0xc9))['catch'](handleError(_0x569bd2,null));};exports[_0x5a45('0x6e')]=function(_0x6b8c70,_0x4c1caf){return db[_0x5a45('0x43')][_0x5a45('0x4c')]({'where':{'id':_0x6b8c70['params']['id']},'raw':!![]})[_0x5a45('0x16')](handleEntityNotFound(_0x4c1caf,null))[_0x5a45('0x16')](function(_0x594107){if(_0x594107){if(_0x594107[_0x5a45('0x67')]){return _0x4c1caf[_0x5a45('0x27')](0x193)[_0x5a45('0x22')]({'status':0x193,'message':_0x5a45('0x6f')});}return db[_0x5a45('0x70')]['findOne']({'where':{'id':_0x6b8c70[_0x5a45('0x3c')][_0x5a45('0x71')]},'raw':!![]})[_0x5a45('0x16')](handleEntityNotFound(_0x4c1caf,null));}})[_0x5a45('0x16')](function(_0x16a4b5){if(_0x16a4b5){var _0x316f8d=_0x16a4b5['ChatOfflineMessageId']!==null;var _0x29aa12=path[_0x5a45('0x72')](config[_0x5a45('0x73')],_0x5a45('0x74'));if(_0x316f8d){_0x29aa12=path[_0x5a45('0x72')](_0x29aa12,_0x5a45('0x75'));}var _0x255280=path['join'](_0x29aa12,_0x16a4b5['basename']);return _0x4c1caf[_0x5a45('0x76')](_0x255280);}})[_0x5a45('0x3e')](handleError(_0x4c1caf,null));};exports[_0x5a45('0x77')]=function(_0x4ac7a3,_0x16d6b2){var _0x319ad0=null;var _0x2f9564=null;var _0x49f63b=null;if(_0x4ac7a3['body']['id']){delete _0x4ac7a3[_0x5a45('0x30')]['id'];}if(_0x4ac7a3[_0x5a45('0x30')][_0x5a45('0x78')]){_0x49f63b=path[_0x5a45('0x72')](config['root'],_0x5a45('0x79'),util[_0x5a45('0x7a')]('transcript-%s.txt',Date[_0x5a45('0x7b')]()));_0x4ac7a3[_0x5a45('0x30')][_0x5a45('0x7c')]=_0x49f63b;}return db[_0x5a45('0x43')][_0x5a45('0x48')]({'where':{'id':_0x4ac7a3[_0x5a45('0x40')]['id']},'include':[{'model':db[_0x5a45('0x5c')],'as':_0x5a45('0x7d'),'include':[{'model':db[_0x5a45('0x7e')],'as':_0x5a45('0x7e')}]}]})[_0x5a45('0x16')](handleEntityNotFound(_0x16d6b2,null))[_0x5a45('0x16')](saveUpdates(_0x4ac7a3[_0x5a45('0x30')],null))[_0x5a45('0x16')](function(_0x3f2378){if(_0x3f2378){_0x319ad0=_0x3f2378;return db['ChatWebsite'][_0x5a45('0x48')]({'where':{'id':_0x319ad0['ChatWebsiteId']}});}})['then'](function(_0x3bc53f){if(_0x3bc53f){_0x2f9564=_0x3bc53f;return db[_0x5a45('0x60')][_0x5a45('0x48')]({'where':{'id':_0x319ad0['ContactId']}});}})['then'](function(_0x1cb195){if(_0x1cb195){if(_0x49f63b){var _0x2faf37=null;for(var _0x48801c=0x1;_0x48801c<_0x319ad0['Messages']['length'];++_0x48801c){_0x2faf37=_0x319ad0[_0x5a45('0x7d')][_0x48801c];var _0x31cb43=_0x2faf37['UserId']?util[_0x5a45('0x7a')]('%s%d',_0x2f9564['agentAlias'],_0x2faf37[_0x5a45('0x65')]):'System';var _0x414da4=_0x4ac7a3['body'][_0x5a45('0x7f')]||util[_0x5a45('0x7a')](_0x5a45('0x80'),_0x5a45('0x81'),_0x2faf37[_0x5a45('0x82')]);switch(_0x2f9564[_0x5a45('0x83')]){case _0x5a45('0x84'):_0x31cb43=_0x2faf37['UserId']?util[_0x5a45('0x7a')](_0x5a45('0x80'),_0x2f9564[_0x5a45('0x85')],_0x2faf37[_0x5a45('0x65')]):_0x5a45('0x86');break;case _0x5a45('0x87'):_0x31cb43=_0x2faf37[_0x5a45('0x65')]?_0x2faf37[_0x5a45('0x7e')][_0x5a45('0x88')]||_0x2faf37[_0x5a45('0x7e')]['fullname']:'System';break;case _0x5a45('0x89'):_0x31cb43=_0x2faf37['UserId']?_0x2faf37[_0x5a45('0x7e')][_0x5a45('0x52')]:_0x5a45('0x86');break;default:_0x31cb43=_0x2faf37[_0x5a45('0x65')]?util[_0x5a45('0x7a')](_0x5a45('0x80'),_0x2f9564[_0x5a45('0x85')],_0x2faf37[_0x5a45('0x65')]):_0x5a45('0x86');}var _0x1038c9=util[_0x5a45('0x7a')](_0x5a45('0x8a'),moment(_0x2faf37[_0x5a45('0x8b')])[_0x5a45('0x7a')](_0x5a45('0x8c')),_0x2faf37[_0x5a45('0x8d')]==='in'?_0x414da4:_0x31cb43,_0x2faf37['body']);if(!_0x2faf37[_0x5a45('0x8e')]){fs[_0x5a45('0x8f')](_0x49f63b,_0x1038c9);}}return db[_0x5a45('0x90')][_0x5a45('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0x5a45('0x91')],'as':_0x5a45('0x92'),'raw':!![],'include':[{'model':db[_0x5a45('0x93')],'as':_0x5a45('0x93'),'raw':!![]}]}]});}}})[_0x5a45('0x16')](function(_0x50c3a0){if(!_0x50c3a0||!_0x50c3a0[_0x5a45('0x92')]||!_0x4ac7a3[_0x5a45('0x30')])return _0x319ad0;var _0x2f859e=_0x50c3a0[_0x5a45('0x94')]();return respondWithRpcPromise(_0x5a45('0x95'),_0x5a45('0x96'),{'account':_0x2f859e,'message':{'from':util[_0x5a45('0x7a')](_0x5a45('0x97'),_0x50c3a0['name'],_0x50c3a0[_0x5a45('0x53')]||_0x50c3a0[_0x5a45('0x92')][_0x5a45('0x3d')]),'to':_0x4ac7a3[_0x5a45('0x30')][_0x5a45('0x78')],'subject':_0x5a45('0x98'),'text':util['format'](_0x5a45('0x99'),_0x4ac7a3['body'][_0x5a45('0x78')]),'attachments':[{'path':_0x49f63b}]}})['then'](function(){return _0x319ad0;})[_0x5a45('0x3e')](function(_0x3b6afe){logger[_0x5a45('0x1d')](_0x3b6afe);});})['then'](respondWithStatusCode(_0x16d6b2,0xc8))[_0x5a45('0x3e')](handleError(_0x16d6b2,null));};exports[_0x5a45('0x9a')]=function(_0x345c7b,_0x584da6){return db[_0x5a45('0x5c')][_0x5a45('0x48')]({'where':{'id':_0x345c7b['params']['id']}})[_0x5a45('0x16')](handleEntityNotFound(_0x584da6,null))['then'](function(_0x2b7c4a){if(_0x2b7c4a){return _0x2b7c4a[_0x5a45('0x9a')](_0x345c7b[_0x5a45('0x30')]['ids'],_[_0x5a45('0x9b')](_0x345c7b[_0x5a45('0x30')],[_0x5a45('0x9c'),'id'])||{});}})[_0x5a45('0x16')](respondWithResult(_0x584da6,null))[_0x5a45('0x3e')](handleError(_0x584da6,null));};exports[_0x5a45('0x9d')]=function(_0x3a35e4,_0x16de05){var _0x7d6213={'raw':![],'where':{}};var _0x170b52={};var _0x20498c={'count':0x0,'rows':[]};return db[_0x5a45('0x43')][_0x5a45('0x4c')]({'where':{'id':_0x3a35e4[_0x5a45('0x40')]['id']}})[_0x5a45('0x16')](handleEntityNotFound(_0x16de05,null))[_0x5a45('0x16')](function(_0x19c746){if(_0x19c746){_0x170b52[_0x5a45('0x41')]=_[_0x5a45('0x42')](db[_0x5a45('0x5c')][_0x5a45('0x35')]);_0x170b52['query']=_[_0x5a45('0x42')](_0x3a35e4['query']);_0x170b52[_0x5a45('0x9e')]=_[_0x5a45('0x44')](_0x170b52[_0x5a45('0x41')],_0x170b52[_0x5a45('0x3c')]);_0x7d6213[_0x5a45('0x45')]=_[_0x5a45('0x44')](_0x170b52[_0x5a45('0x41')],qs[_0x5a45('0x46')](_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0x46')]));_0x7d6213['attributes']=_0x7d6213[_0x5a45('0x45')][_0x5a45('0x47')]?_0x7d6213[_0x5a45('0x45')]:_0x170b52['model'];if(!_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0x9f')](_0x5a45('0xa0'))){_0x7d6213[_0x5a45('0x25')]=qs[_0x5a45('0x25')](_0x3a35e4[_0x5a45('0x3c')]['limit']);_0x7d6213[_0x5a45('0x23')]=qs[_0x5a45('0x23')](_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0x23')]);}_0x7d6213[_0x5a45('0xa1')]=qs[_0x5a45('0xa2')](_0x3a35e4[_0x5a45('0x3c')]['sort']);_0x7d6213['where']=qs[_0x5a45('0x9e')](_['pick'](_0x3a35e4[_0x5a45('0x3c')],_0x170b52['filters']));_0x7d6213[_0x5a45('0xa3')]['ChatInteractionId']=_0x19c746['id'];if(_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0xa4')]){_0x7d6213[_0x5a45('0xa3')]=_[_0x5a45('0x2f')](_0x7d6213[_0x5a45('0xa3')],{'$or':_[_0x5a45('0xa5')](_0x7d6213[_0x5a45('0x45')],function(_0x34ef9e){var _0x1b2e57={};_0x1b2e57[_0x34ef9e]={'$like':'%'+_0x3a35e4['query'][_0x5a45('0xa4')]+'%'};return _0x1b2e57;})});}if(_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0xa6')]){var _0x1a63d1=_0x3a35e4['query']['$gte']['split'](',');var _0x5c99bf={};_0x5c99bf[_0x1a63d1[0x0]]={'$gte':moment(_0x1a63d1[0x1])[_0x5a45('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7d6213[_0x5a45('0xa3')]=_[_0x5a45('0x2f')](_0x7d6213[_0x5a45('0xa3')],_0x5c99bf);}_0x7d6213=_[_0x5a45('0x2f')]({},_0x7d6213,_0x3a35e4[_0x5a45('0xa7')]);return db[_0x5a45('0x5c')][_0x5a45('0x26')]({'where':_0x7d6213['where']})[_0x5a45('0x16')](function(_0x5496a1){_0x20498c['count']=_0x5496a1;if(_0x3a35e4[_0x5a45('0x3c')][_0x5a45('0xa8')]){_0x7d6213[_0x5a45('0xa9')]=[{'all':!![]}];}return db[_0x5a45('0x5c')]['findAll'](_0x7d6213);})['then'](function(_0x4866a8){_0x20498c['rows']=_0x4866a8;return _0x20498c;});}})['then'](respondWithFilteredResult(_0x16de05,_0x7d6213))[_0x5a45('0x3e')](handleError(_0x16de05,null));};exports[_0x5a45('0xaa')]=function(_0x3c6dc4,_0x494cad){var _0x3c11bd={'where':{}},_0x4ea70f={},_0x50bf70={'count':0x0,'rows':[]};return db[_0x5a45('0x43')][_0x5a45('0x4c')]({'where':{'id':_0x3c6dc4[_0x5a45('0x40')]['id']}})[_0x5a45('0x16')](handleEntityNotFound(_0x494cad,null))[_0x5a45('0x16')](function(_0x801467){if(_0x801467){_0x4ea70f[_0x5a45('0x41')]=_[_0x5a45('0x42')](db[_0x5a45('0x5c')][_0x5a45('0x35')]);_0x4ea70f[_0x5a45('0x3c')]=_[_0x5a45('0x42')](_0x3c6dc4['query']);_0x4ea70f[_0x5a45('0x9e')]=_[_0x5a45('0x44')](_0x4ea70f[_0x5a45('0x41')],_0x4ea70f[_0x5a45('0x3c')]);_0x3c11bd['attributes']=_[_0x5a45('0x44')](_0x4ea70f[_0x5a45('0x41')],qs[_0x5a45('0x46')](_0x3c6dc4['query'][_0x5a45('0x46')]));_0x3c11bd['attributes']=_0x3c11bd['attributes']['length']?_0x3c11bd[_0x5a45('0x45')]:_0x4ea70f[_0x5a45('0x41')];if(!_0x3c6dc4[_0x5a45('0x3c')][_0x5a45('0x9f')]('nolimit')){_0x3c11bd[_0x5a45('0x25')]=qs[_0x5a45('0x25')](_0x3c6dc4[_0x5a45('0x3c')][_0x5a45('0x25')]);_0x3c11bd[_0x5a45('0x23')]=qs[_0x5a45('0x23')](_0x3c6dc4['query']['offset']);}_0x3c11bd[_0x5a45('0xa1')]=qs[_0x5a45('0xa2')](_0x3c6dc4[_0x5a45('0x3c')][_0x5a45('0xa2')]);_0x3c11bd[_0x5a45('0xa3')]=qs[_0x5a45('0x9e')](_[_0x5a45('0xab')](_0x3c6dc4[_0x5a45('0x3c')],_0x4ea70f['filters']));_0x3c11bd[_0x5a45('0xa3')][_0x5a45('0xac')]=_0x801467['id'];if(_0x3c6dc4[_0x5a45('0x3c')]['filter']){_0x3c11bd[_0x5a45('0xa3')]=_['merge'](_0x3c11bd[_0x5a45('0xa3')],{'$or':_['map'](_0x3c11bd[_0x5a45('0x45')],function(_0x282483){var _0x2cfeb0={};_0x2cfeb0[_0x282483]={'$like':'%'+_0x3c6dc4['query']['filter']+'%'};return _0x2cfeb0;})});}_0x3c11bd['where'][_0x5a45('0x8e')]=![];if(_0x3c6dc4['query']['id']){_0x3c11bd['where']['id']={'$gt':_0x3c6dc4['query']['id']};}_0x3c11bd=_[_0x5a45('0x2f')]({},_0x3c11bd,_0x3c6dc4['options']);return db[_0x5a45('0x5c')]['count']({'where':_0x3c11bd[_0x5a45('0xa3')]})[_0x5a45('0x16')](function(_0x2ae8c8){_0x50bf70[_0x5a45('0x26')]=_0x2ae8c8;_0x3c11bd[_0x5a45('0xa9')]=[];if(_0x3c6dc4[_0x5a45('0x3c')]['includeAgent']){_0x3c11bd[_0x5a45('0xa9')][_0x5a45('0xad')]({'model':db[_0x5a45('0x7e')],'as':_0x5a45('0x7e'),'attributes':['id',_0x5a45('0x52'),_0x5a45('0x88')]});}if(_0x3c6dc4[_0x5a45('0x3c')][_0x5a45('0xa8')]){_0x3c11bd[_0x5a45('0xa9')]=[{'all':!![]}];}return db[_0x5a45('0x5c')]['findAll'](_0x3c11bd);})[_0x5a45('0x16')](function(_0x25e098){_0x50bf70[_0x5a45('0xae')]=_0x25e098;return _0x50bf70;});}})[_0x5a45('0x16')](respondWithFilteredResult(_0x494cad,_0x3c11bd))[_0x5a45('0x3e')](handleError(_0x494cad,null));};exports[_0x5a45('0xaf')]=function(_0x24b047,_0x5cf499){return db[_0x5a45('0x43')][_0x5a45('0x48')]({'where':{'id':_0x24b047[_0x5a45('0x40')]['id']}})[_0x5a45('0x16')](handleEntityNotFound(_0x5cf499,null))[_0x5a45('0x16')](function(_0x4bcf61){if(_0x4bcf61){return _0x4bcf61[_0x5a45('0xb0')](_0x24b047[_0x5a45('0x30')][_0x5a45('0x9c')],_[_0x5a45('0x9b')](_0x24b047[_0x5a45('0x30')],[_0x5a45('0x9c'),'id'])||{})[_0x5a45('0xb1')](function(){return db[_0x5a45('0xb2')][_0x5a45('0x3a')]({'attributes':['id','name','color'],'where':{'id':_0x24b047[_0x5a45('0x30')][_0x5a45('0x9c')]}});})['then'](function(_0x249ebe){socket['emit'](_0x5a45('0xb3'),{'id':Number(_0x24b047[_0x5a45('0x40')]['id']),'tags':_0x249ebe||[]});return{'id':Number(_0x24b047[_0x5a45('0x40')]['id']),'tags':_0x249ebe||[]};});}})[_0x5a45('0x16')](respondWithResult(_0x5cf499,null))[_0x5a45('0x3e')](handleError(_0x5cf499,null));};exports['removeTags']=function(_0x6a1ffb,_0x32fca2){return db[_0x5a45('0x43')][_0x5a45('0x48')]({'where':{'id':_0x6a1ffb[_0x5a45('0x40')]['id']}})['then'](handleEntityNotFound(_0x32fca2,null))[_0x5a45('0x16')](function(_0x27b564){if(_0x27b564){return _0x27b564[_0x5a45('0xb4')](_0x6a1ffb[_0x5a45('0x3c')][_0x5a45('0x9c')]);}})[_0x5a45('0x16')](respondWithStatusCode(_0x32fca2,null))[_0x5a45('0x3e')](handleError(_0x32fca2,null));};exports['download']=function(_0x2c295c,_0x6bb5){var _0x418bde=moment()['unix']()[_0x5a45('0xb5')]();var _0x4e92bc=path['join'](config[_0x5a45('0x73')],_0x5a45('0xb6'),_0x5a45('0xb7'),_0x5a45('0xb8'));var _0x19a471=path['join'](config[_0x5a45('0x73')],_0x5a45('0xb6'),_0x5a45('0xb7'),'attachments');var _0x27e602=path['join'](_0x4e92bc,_0x418bde);var _0xc5198f=util['format'](_0x5a45('0xb9'),_0x2c295c[_0x5a45('0x40')]['id'],_0x418bde);var _0x549e98=path['join'](_0x4e92bc,_0xc5198f);var _0x4b5de9=[];_0x4b5de9[_0x5a45('0xad')]({'model':db[_0x5a45('0x7e')],'as':'User','attributes':['id',_0x5a45('0x52')],'raw':!![]});_0x4b5de9['push']({'model':db[_0x5a45('0x60')],'as':_0x5a45('0x61'),'attributes':['id',_0x5a45('0xba'),'lastName'],'raw':!![]});if(_0x2c295c[_0x5a45('0x3c')][_0x5a45('0xbb')]){_0x4b5de9['push']({'model':db[_0x5a45('0x70')],'as':_0x5a45('0x70'),'raw':!![]});}var _0x26172e=[{'model':db['ChatMessage'],'as':_0x5a45('0x7d'),'attributes':['id',_0x5a45('0x30'),_0x5a45('0x8b'),_0x5a45('0x8d'),_0x5a45('0x8e'),_0x5a45('0xbc')],'include':_0x4b5de9}];_0x26172e[_0x5a45('0xad')]({'model':db[_0x5a45('0x4d')],'as':_0x5a45('0xbd'),'attributes':['id',_0x5a45('0x2c')]});_0x26172e['push']({'model':db[_0x5a45('0x7e')],'as':'Owner','attributes':['id','fullname']});return db[_0x5a45('0x43')][_0x5a45('0x48')]({'where':{'id':_0x2c295c['params']['id']},'include':_0x26172e})[_0x5a45('0x16')](handleEntityNotFound(_0x6bb5,null))[_0x5a45('0x16')](function(_0x402650){if(_0x402650){var _0x4df848=_0x402650['get']({'plain':!![]});fs[_0x5a45('0xbe')](_0x27e602);var _0x4463b4={'channel':_0x5a45('0xbf'),'account':_0x4df848['Account'][_0x5a45('0x2c')],'agent':_0x4df848[_0x5a45('0xc0')]?_0x4df848['Owner'][_0x5a45('0x52')]:_0x5a45('0xc1'),'createdAt':moment(_0x4df848[_0x5a45('0x8b')])[_0x5a45('0x7a')](_0x5a45('0xc2'))[_0x5a45('0xb5')](),'closedAt':_0x4df848[_0x5a45('0x67')]?moment(_0x4df848[_0x5a45('0xc3')])[_0x5a45('0x7a')](_0x5a45('0xc2'))['toString']():'','disposition':_0x4df848['disposition'],'chatInfo':{'browser':_0x4df848[_0x5a45('0xc4')],'os':_0x4df848[_0x5a45('0xc5')],'referer':_0x4df848[_0x5a45('0xc6')],'customerIp':_0x4df848['customerIp'],'customerPort':_0x4df848[_0x5a45('0xc7')]?_0x4df848[_0x5a45('0xc7')]:'N.A.'},'messages':_(_0x4df848[_0x5a45('0x7d')])[_0x5a45('0xc8')]()['filter']({'secret':![]})[_0x5a45('0xa5')](function(_0x4a67f3){if(_0x4a67f3['Attachment']){var _0xaf4d38=path[_0x5a45('0x72')](_0x19a471,_0x4a67f3[_0x5a45('0x70')][_0x5a45('0x6b')]);if(fs[_0x5a45('0xc9')](_0xaf4d38)){fs['createReadStream'](_0xaf4d38)[_0x5a45('0xca')](fs[_0x5a45('0xcb')](path['join'](_0x27e602,_0x4a67f3[_0x5a45('0x70')]['basename'])));}}return{'date':moment(_0x4a67f3[_0x5a45('0x8b')])[_0x5a45('0x7a')](_0x5a45('0xc2'))[_0x5a45('0xb5')](),'sender':_0x4a67f3['direction']===_0x5a45('0x5b')?_0x4a67f3[_0x5a45('0x7e')]?_0x4a67f3[_0x5a45('0x7e')][_0x5a45('0x52')]:_0x5a45('0x86'):_0x4a67f3[_0x5a45('0x61')][_0x5a45('0xba')]+(_0x4a67f3['Contact'][_0x5a45('0xcc')]?'\x20'+_0x4a67f3['Contact'][_0x5a45('0xcc')]:''),'body':_0x4a67f3[_0x5a45('0x70')]?_0x4a67f3['Attachment']['basename']:_0x4a67f3[_0x5a45('0x30')],'direction':_0x4a67f3[_0x5a45('0x8d')]===_0x5a45('0x5b')?'A':'C','secret':_0x4a67f3[_0x5a45('0x8e')],'read':_0x4a67f3[_0x5a45('0xbc')],'attachment':_0x4a67f3[_0x5a45('0x70')]};})[_0x5a45('0xcd')]()};return ejs[_0x5a45('0xce')](path[_0x5a45('0x72')](config[_0x5a45('0x73')],'server','views',_0x5a45('0xcf')),{'interaction':_0x4463b4})[_0x5a45('0x16')](function(_0xc5179c){var _0x1b82f0=path[_0x5a45('0x72')](_0x27e602,_0x5a45('0xd0')+_0x4df848['id']+'-'+_0x418bde+_0x5a45('0xd1'));var _0x1921b7={'path':_0x1b82f0,'channel':'Chat','interactionId':_0x4df848['id']};return pdf[_0x5a45('0xd2')](_0xc5179c,_0x1921b7);})[_0x5a45('0x16')](function(){return new Promise(function(_0x4642a1,_0x224fd6){zipdir(_0x27e602,{'saveTo':_0x549e98},function(_0x56add9,_0x3d5c42){if(_0x56add9)return _0x224fd6(_0x56add9);return _0x4642a1(_0x3d5c42);});})['then'](function(){return new BPromise(function(_0xcc20ab,_0x25972e){rimraf(_0x27e602,function(_0x582f5a){if(_0x582f5a)_0x25972e(_0x582f5a);return _0xcc20ab();});});})[_0x5a45('0x16')](function(){return _0x6bb5['download'](_0x549e98,_0xc5198f,function(_0x31b15d){if(_0x31b15d){logger[_0x5a45('0x1d')](_0x5a45('0xd3'),_0x31b15d);}else{fs[_0x5a45('0xd4')](_0x549e98);}});});});}else{return _0x6bb5[_0x5a45('0x20')](0xc8);}})[_0x5a45('0x3e')](handleError(_0x6bb5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d4e7c3e..3997959 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 _0x8be0=['exports','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x8be0,0x1bb));var _0x08be=function(_0x28c90d,_0x8b6881){_0x28c90d=_0x28c90d-0x0;var _0x11192c=_0x8be0[_0x28c90d];return _0x11192c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x08be('0x0'))['db'][_0x08be('0x1')];var ChatMessage=require(_0x08be('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x08be('0x2')](0x0);var events={'afterCreate':_0x08be('0x3'),'afterUpdate':_0x08be('0x4'),'afterDestroy':'remove'};function emitEvent(_0x531916){return function(_0x551966,_0x4e79e1,_0xfcd226){_0x551966[_0x08be('0x5')]({'attributes':['id'],'raw':!![]})[_0x08be('0x6')](function(_0x581453){_0x551966[_0x08be('0x7')](_0x08be('0x8'),_0x581453[_0x08be('0x9')](function(_0x29c9f0){return{'id':_0x29c9f0['id']};}));return ChatMessage[_0x08be('0xa')]({'where':{'ChatInteractionId':_0x551966['id'],'direction':'in','read':![]},'raw':!![]});})[_0x08be('0x6')](function(_0x5e940a){_0x551966[_0x08be('0x7')]('unreadMessages',_0x5e940a[_0x08be('0xb')]);ChatInteractionEvents['emit'](_0x531916+':'+_0x551966['id'],_0x551966);ChatInteractionEvents[_0x08be('0xc')](_0x531916,_0x551966);_0xfcd226(null);})[_0x08be('0xd')](_0xfcd226(null));};}for(var e in events){if(events[_0x08be('0xe')](e)){var event=events[e];ChatInteraction[_0x08be('0xf')](e,emitEvent(event));}}module[_0x08be('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x71c3=['Users','length','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x58788d,_0x88b74f){var _0x58ceba=function(_0x16a416){while(--_0x16a416){_0x58788d['push'](_0x58788d['shift']());}};_0x58ceba(++_0x88b74f);}(_0x71c3,0x94));var _0x371c=function(_0x8260fc,_0x3a6497){_0x8260fc=_0x8260fc-0x0;var _0x37bc17=_0x71c3[_0x8260fc];return _0x37bc17;};'use strict';var EventEmitter=require(_0x371c('0x0'));var ChatInteraction=require(_0x371c('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x371c('0x2')](0x0);var events={'afterCreate':_0x371c('0x3'),'afterUpdate':_0x371c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50a708){return function(_0x4aaf00,_0x25da25,_0x1c7ffb){_0x4aaf00[_0x371c('0x5')]({'attributes':['id'],'raw':!![]})[_0x371c('0x6')](function(_0x113f10){_0x4aaf00[_0x371c('0x7')](_0x371c('0x8'),_0x113f10['map'](function(_0x2fc240){return{'id':_0x2fc240['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4aaf00['id'],'direction':'in','read':![]},'raw':!![]});})[_0x371c('0x6')](function(_0xa55d26){_0x4aaf00[_0x371c('0x7')]('unreadMessages',_0xa55d26[_0x371c('0x9')]);ChatInteractionEvents[_0x371c('0xa')](_0x50a708+':'+_0x4aaf00['id'],_0x4aaf00);ChatInteractionEvents[_0x371c('0xa')](_0x50a708,_0x4aaf00);_0x1c7ffb(null);})['catch'](_0x1c7ffb(null));};}for(var e in events){if(events[_0x371c('0xb')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x371c('0xc')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1a3ab7e..1d14121 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 _0x44b0=['path','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x261739,_0x105b65){var _0xac23e2=function(_0x28167c){while(--_0x28167c){_0x261739['push'](_0x261739['shift']());}};_0xac23e2(++_0x105b65);}(_0x44b0,0xe4));var _0x044b=function(_0x3b7606,_0x1ec1fd){_0x3b7606=_0x3b7606-0x0;var _0x1c6a0c=_0x44b0[_0x3b7606];return _0x1c6a0c;};'use strict';var _=require(_0x044b('0x0'));var util=require(_0x044b('0x1'));var logger=require('../../config/logger')(_0x044b('0x2'));var moment=require(_0x044b('0x3'));var BPromise=require(_0x044b('0x4'));var rp=require(_0x044b('0x5'));var fs=require('fs');var path=require(_0x044b('0x6'));var rimraf=require(_0x044b('0x7'));var config=require(_0x044b('0x8'));var attributes=require(_0x044b('0x9'));module['exports']=function(_0x580771,_0x1871a8){return _0x580771['define'](_0x044b('0xa'),attributes,{'tableName':_0x044b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51d9a5,_0x24ce5b,_0x1be1e5){if(_0x51d9a5[_0x044b('0xc')]('closed')){_0x51d9a5[_0x044b('0xd')]=moment()[_0x044b('0xe')](_0x044b('0xf'));}_0x1be1e5(null,_0x51d9a5);}},'charset':_0x044b('0x10'),'collate':_0x044b('0x11')});}; \ No newline at end of file +var _0xbe4d=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xbe4d,0xc2));var _0xdbe4=function(_0x3617f1,_0x39b6a2){_0x3617f1=_0x3617f1-0x0;var _0x5b09a6=_0xbe4d[_0x3617f1];return _0x5b09a6;};'use strict';var _=require(_0xdbe4('0x0'));var util=require(_0xdbe4('0x1'));var logger=require(_0xdbe4('0x2'))(_0xdbe4('0x3'));var moment=require(_0xdbe4('0x4'));var BPromise=require(_0xdbe4('0x5'));var rp=require(_0xdbe4('0x6'));var fs=require('fs');var path=require(_0xdbe4('0x7'));var rimraf=require(_0xdbe4('0x8'));var config=require(_0xdbe4('0x9'));var attributes=require(_0xdbe4('0xa'));module[_0xdbe4('0xb')]=function(_0x4fa111,_0x2f6d84){return _0x4fa111[_0xdbe4('0xc')]('ChatInteraction',attributes,{'tableName':_0xdbe4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19f46e,_0x4f1282,_0xce7aa1){if(_0x19f46e[_0xdbe4('0xe')](_0xdbe4('0xf'))){_0x19f46e[_0xdbe4('0x10')]=moment()['format'](_0xdbe4('0x11'));}_0xce7aa1(null,_0x19f46e);}},'charset':_0xdbe4('0x12'),'collate':_0xdbe4('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b854d0b..1a5ae5e 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 _0x4590=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','AddTags','lodash','util'];(function(_0x3c929e,_0x55dea5){var _0x42adbb=function(_0x4d97ca){while(--_0x4d97ca){_0x3c929e['push'](_0x3c929e['shift']());}};_0x42adbb(++_0x55dea5);}(_0x4590,0x198));var _0x0459=function(_0x4d36a4,_0x303dd0){_0x4d36a4=_0x4d36a4-0x0;var _0x8d4548=_0x4590[_0x4d36a4];return _0x8d4548;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require(_0x0459('0x2'));var BPromise=require(_0x0459('0x3'));var rs=require(_0x0459('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0459('0x5'))['db'];var utils=require(_0x0459('0x6'));var logger=require(_0x0459('0x7'))('rpc');var config=require(_0x0459('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0459('0x9')]['http']({'port':0x232a});config[_0x0459('0xa')]=_[_0x0459('0xb')](config[_0x0459('0xa')],{'host':_0x0459('0xc'),'port':0x18eb});var socket=require(_0x0459('0xd'))(new Redis(config[_0x0459('0xa')]));require('./chatInteraction.socket')[_0x0459('0xe')](socket);function respondWithRpcPromise(_0x39f3fa,_0x28dc30,_0x1eb4bb){return new BPromise(function(_0x44f20e,_0x197faf){return client[_0x0459('0xf')](_0x39f3fa,_0x1eb4bb)[_0x0459('0x10')](function(_0x3dc0cd){logger['info'](_0x0459('0x11'),_0x28dc30,'request\x20sent');logger[_0x0459('0x12')](_0x0459('0x13'),_0x28dc30,_0x0459('0x14'),JSON['stringify'](_0x3dc0cd));if(_0x3dc0cd['error']){if(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x16')]===0x1f4){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x197faf(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x44f20e(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}else{logger[_0x0459('0x18')](_0x0459('0x11'),_0x28dc30,_0x0459('0x14'));_0x44f20e(_0x3dc0cd[_0x0459('0x19')]['message']);}})['catch'](function(_0x4a20f2){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x4a20f2);_0x197faf(_0x4a20f2);});});}exports['UpdateChatInteraction']=function(_0x24a7d2){var _0x18db53=this;return new Promise(function(_0x1cc1da,_0x217392){return db['ChatInteraction']['update'](_0x24a7d2[_0x0459('0x1a')],{'raw':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a7d2['options']?_0x24a7d2['options'][_0x0459('0x1d')]||null:null,'attributes':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2['options'][_0x0459('0x1e')]||null:null,'limit':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1f')]||null:null})['then'](function(_0x6d59f8){logger['info'](_0x0459('0x20'),_0x24a7d2);logger[_0x0459('0x12')](_0x0459('0x20'),_0x24a7d2,JSON[_0x0459('0x21')](_0x6d59f8));_0x1cc1da(_0x6d59f8);})[_0x0459('0x22')](function(_0x4aba61){logger['error'](_0x0459('0x20'),_0x4aba61['message'],_0x24a7d2);_0x217392(_0x18db53[_0x0459('0x15')](0x1f4,_0x4aba61[_0x0459('0x17')]));});});};exports[_0x0459('0x23')]=function(_0xc21bd5){return new Promise(function(_0x1ebf5c,_0x49e6e4){return db[_0x0459('0x24')]['find']({'where':_0xc21bd5[_0x0459('0x1b')]?_0xc21bd5[_0x0459('0x1b')][_0x0459('0x1d')]||null:null})[_0x0459('0x10')](function(_0x4843b4){if(_0x4843b4){return _0x4843b4[_0x0459('0x25')](_0xc21bd5['body'][_0x0459('0x26')],_[_0x0459('0x27')](_0xc21bd5[_0x0459('0x1a')],['ids','id'])||{});}})['spread'](function(_0x58690d){logger[_0x0459('0x18')](_0x0459('0x28'),_0xc21bd5);logger[_0x0459('0x12')](_0x0459('0x28'),_0xc21bd5,JSON[_0x0459('0x21')](_0x58690d));_0x1ebf5c(_0x58690d);})[_0x0459('0x22')](function(_0x52de7d){logger[_0x0459('0x15')](_0x0459('0x28'),_0x52de7d['message'],_0xc21bd5);_0x49e6e4(_this[_0x0459('0x15')](0x1f4,_0x52de7d['message']));});});}; \ No newline at end of file +var _0x3f9f=['message','result','UpdateChatInteraction','update','body','options','raw','where','then','AddTagsToChatInteraction','ChatInteraction','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5ec2b1,_0x45b985){var _0x5966a1=function(_0x4251a7){while(--_0x4251a7){_0x5ec2b1['push'](_0x5ec2b1['shift']());}};_0x5966a1(++_0x45b985);}(_0x3f9f,0xd3));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var util=require(_0xf3f9('0x1'));var moment=require(_0xf3f9('0x2'));var BPromise=require(_0xf3f9('0x3'));var rs=require(_0xf3f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3f9('0x5'));var logger=require('../../config/logger')(_0xf3f9('0x6'));var config=require(_0xf3f9('0x7'));var jayson=require(_0xf3f9('0x8'));var client=jayson[_0xf3f9('0x9')][_0xf3f9('0xa')]({'port':0x232a});config[_0xf3f9('0xb')]=_[_0xf3f9('0xc')](config['redis'],{'host':_0xf3f9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3f9('0xb')]));require(_0xf3f9('0xe'))[_0xf3f9('0xf')](socket);function respondWithRpcPromise(_0x22542a,_0x20a8e0,_0x3db040){return new BPromise(function(_0x505a78,_0xc72294){return client['request'](_0x22542a,_0x3db040)['then'](function(_0x373f81){logger[_0xf3f9('0x10')](_0xf3f9('0x11'),_0x20a8e0,_0xf3f9('0x12'));logger[_0xf3f9('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x20a8e0,_0xf3f9('0x12'),JSON[_0xf3f9('0x14')](_0x373f81));if(_0x373f81['error']){if(_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x16')]===0x1f4){logger[_0xf3f9('0x15')](_0xf3f9('0x11'),_0x20a8e0,_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);return _0xc72294(_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);}logger['error'](_0xf3f9('0x11'),_0x20a8e0,_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);return _0x505a78(_0x373f81[_0xf3f9('0x15')]['message']);}else{logger[_0xf3f9('0x10')](_0xf3f9('0x11'),_0x20a8e0,_0xf3f9('0x12'));_0x505a78(_0x373f81[_0xf3f9('0x18')][_0xf3f9('0x17')]);}})['catch'](function(_0x10273c){logger['error'](_0xf3f9('0x11'),_0x20a8e0,_0x10273c);_0xc72294(_0x10273c);});});}exports[_0xf3f9('0x19')]=function(_0x4a44ec){var _0x3ff0d9=this;return new Promise(function(_0x58aa55,_0x3157e3){return db['ChatInteraction'][_0xf3f9('0x1a')](_0x4a44ec[_0xf3f9('0x1b')],{'raw':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options'][_0xf3f9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec[_0xf3f9('0x1c')][_0xf3f9('0x1e')]||null:null,'attributes':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options']['attributes']||null:null,'limit':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options']['limit']||null:null})[_0xf3f9('0x1f')](function(_0x28da3a){logger['info'](_0xf3f9('0x19'),_0x4a44ec);logger[_0xf3f9('0x13')](_0xf3f9('0x19'),_0x4a44ec,JSON['stringify'](_0x28da3a));_0x58aa55(_0x28da3a);})['catch'](function(_0x56e6b8){logger['error'](_0xf3f9('0x19'),_0x56e6b8[_0xf3f9('0x17')],_0x4a44ec);_0x3157e3(_0x3ff0d9[_0xf3f9('0x15')](0x1f4,_0x56e6b8[_0xf3f9('0x17')]));});});};exports[_0xf3f9('0x20')]=function(_0x5f3bb5){return new Promise(function(_0x5f0638,_0x383e80){return db[_0xf3f9('0x21')]['find']({'where':_0x5f3bb5[_0xf3f9('0x1c')]?_0x5f3bb5['options'][_0xf3f9('0x1e')]||null:null})[_0xf3f9('0x1f')](function(_0x35557e){if(_0x35557e){return _0x35557e['addTags'](_0x5f3bb5[_0xf3f9('0x1b')]['ids'],_[_0xf3f9('0x22')](_0x5f3bb5[_0xf3f9('0x1b')],[_0xf3f9('0x23'),'id'])||{});}})[_0xf3f9('0x24')](function(_0x58c3e2){logger['info']('AddTags',_0x5f3bb5);logger[_0xf3f9('0x13')](_0xf3f9('0x25'),_0x5f3bb5,JSON['stringify'](_0x58c3e2));_0x5f0638(_0x58c3e2);})[_0xf3f9('0x26')](function(_0x17d548){logger[_0xf3f9('0x15')](_0xf3f9('0x25'),_0x17d548['message'],_0x5f3bb5);_0x383e80(_this[_0xf3f9('0x15')](0x1f4,_0x17d548['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 076b964..1ce37ac 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 _0xe168=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x27fc19,_0x4d0f5a){var _0x475511=function(_0x4e91b3){while(--_0x4e91b3){_0x27fc19['push'](_0x27fc19['shift']());}};_0x475511(++_0x4d0f5a);}(_0xe168,0x159));var _0x8e16=function(_0x4890cb,_0x58b6ec){_0x4890cb=_0x4890cb-0x0;var _0x40b461=_0xe168[_0x4890cb];return _0x40b461;};'use strict';var ChatInteractionEvents=require(_0x8e16('0x0'));var events=[_0x8e16('0x1'),_0x8e16('0x2'),_0x8e16('0x3')];function createListener(_0x2b4f30,_0x3bcd25){return function(_0x3120ab){_0x3bcd25[_0x8e16('0x4')](_0x2b4f30,_0x3120ab);};}function removeListener(_0x2f2e59,_0x5fddf9){return function(){ChatInteractionEvents[_0x8e16('0x5')](_0x2f2e59,_0x5fddf9);};}exports[_0x8e16('0x6')]=function(_0x1da151){for(var _0x5e01ef=0x0,_0x122315=events[_0x8e16('0x7')];_0x5e01ef<_0x122315;_0x5e01ef++){var _0xbab5e4=events[_0x5e01ef];var _0xb901dc=createListener('chatInteraction:'+_0xbab5e4,_0x1da151);ChatInteractionEvents['on'](_0xbab5e4,_0xb901dc);}}; \ No newline at end of file +var _0x8b7c=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8b7c,0x119));var _0xc8b7=function(_0x20ff64,_0x5c3677){_0x20ff64=_0x20ff64-0x0;var _0x5580db=_0x8b7c[_0x20ff64];return _0x5580db;};'use strict';var ChatInteractionEvents=require(_0xc8b7('0x0'));var events=[_0xc8b7('0x1'),_0xc8b7('0x2'),_0xc8b7('0x3')];function createListener(_0x2473cc,_0x47766d){return function(_0x47089d){_0x47766d[_0xc8b7('0x4')](_0x2473cc,_0x47089d);};}function removeListener(_0x4f66ab,_0x85fa34){return function(){ChatInteractionEvents[_0xc8b7('0x5')](_0x4f66ab,_0x85fa34);};}exports[_0xc8b7('0x6')]=function(_0x4a8b93){for(var _0x256c78=0x0,_0x90cb38=events[_0xc8b7('0x7')];_0x256c78<_0x90cb38;_0x256c78++){var _0x2c7807=events[_0x256c78];var _0x9e4763=createListener(_0xc8b7('0x8')+_0x2c7807,_0x4a8b93);ChatInteractionEvents['on'](_0x2c7807,_0x9e4763);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f96b8e9..32a218c 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 _0xaa6c=['join','format','%s-%s','originalname','replace','post','/:id/attachment_upload','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','download','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xaa6c,0x1c9));var _0xcaa6=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xaa6c[_0x504df1];return _0x1063b5;};'use strict';var multer=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var path=require('path');var timeout=require(_0xcaa6('0x2'));var express=require(_0xcaa6('0x3'));var router=express['Router']();var fs_extra=require(_0xcaa6('0x4'));var auth=require(_0xcaa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcaa6('0x6'));var controller=require(_0xcaa6('0x7'));router[_0xcaa6('0x8')]('/',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0xa')]);router[_0xcaa6('0x8')](_0xcaa6('0xb'),auth[_0xcaa6('0x9')](),controller[_0xcaa6('0xc')]);router[_0xcaa6('0x8')](_0xcaa6('0xd'),auth[_0xcaa6('0xe')](),controller['show']);router[_0xcaa6('0x8')](_0xcaa6('0xf'),auth[_0xcaa6('0xe')](),controller[_0xcaa6('0x10')]);router[_0xcaa6('0x8')](_0xcaa6('0x11'),auth[_0xcaa6('0x9')](),controller['getMessages']);router[_0xcaa6('0x8')](_0xcaa6('0x12'),auth[_0xcaa6('0xe')](),controller['getMyMessages']);router[_0xcaa6('0x8')]('/:id/download',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x13')]);router['post']('/',auth[_0xcaa6('0x9')](),controller['create']);router['post'](_0xcaa6('0x14'),auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x15')]);var upload=multer({'storage':multer[_0xcaa6('0x16')]({'destination':function(_0x1a7f96,_0x202d45,_0x562b75){_0x562b75(null,path[_0xcaa6('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x5c746b,_0x4766b3,_0x4e2bf9){_0x4e2bf9(null,util[_0xcaa6('0x18')](_0xcaa6('0x19'),Date['now'](),_0x4766b3[_0xcaa6('0x1a')][_0xcaa6('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xcaa6('0x1c')](_0xcaa6('0x1d'),upload['single'](_0xcaa6('0x1e')),controller[_0xcaa6('0x1f')]);router[_0xcaa6('0x1c')]('/:id/messages',auth[_0xcaa6('0xe')](),controller['addMessage']);router[_0xcaa6('0x1c')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xcaa6('0x20')]('chat',_0xcaa6('0x21')),controller[_0xcaa6('0x22')]);router[_0xcaa6('0x23')]('/:id',auth[_0xcaa6('0x9')](),interaction[_0xcaa6('0x20')](_0xcaa6('0x24'),_0xcaa6('0x25')),controller[_0xcaa6('0x26')]);router[_0xcaa6('0x23')](_0xcaa6('0x27'),controller[_0xcaa6('0x28')]);router[_0xcaa6('0x23')]('/:id/abandon',auth[_0xcaa6('0xe')](),controller[_0xcaa6('0x29')]);router[_0xcaa6('0x23')](_0xcaa6('0x2a'),controller['close']);router[_0xcaa6('0x2b')]('/:id',auth[_0xcaa6('0x9')](),interaction['tracked'](_0xcaa6('0x24'),_0xcaa6('0x2c')),controller[_0xcaa6('0x2d')]);router[_0xcaa6('0x2b')]('/:id/tags',auth[_0xcaa6('0x9')](),controller[_0xcaa6('0x2e')]);module[_0xcaa6('0x2f')]=router; \ No newline at end of file +var _0xe0de=['single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','./chatInteraction.controller','get','index','isAuthenticated','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','diskStorage','join','format','%s-%s','now','replace','/:id/attachment_upload'];(function(_0x4f3367,_0x5b29b2){var _0x354b00=function(_0x35c813){while(--_0x35c813){_0x4f3367['push'](_0x4f3367['shift']());}};_0x354b00(++_0x5b29b2);}(_0xe0de,0x116));var _0xee0d=function(_0x199586,_0x51bd4e){_0x199586=_0x199586-0x0;var _0x1e822b=_0xe0de[_0x199586];return _0x1e822b;};'use strict';var multer=require(_0xee0d('0x0'));var util=require(_0xee0d('0x1'));var path=require('path');var timeout=require(_0xee0d('0x2'));var express=require(_0xee0d('0x3'));var router=express[_0xee0d('0x4')]();var fs_extra=require(_0xee0d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee0d('0x6'));router[_0xee0d('0x7')]('/',auth['isAuthenticated'](),controller[_0xee0d('0x8')]);router[_0xee0d('0x7')]('/describe',auth[_0xee0d('0x9')](),controller['describe']);router['get'](_0xee0d('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xee0d('0xb')]);router[_0xee0d('0x7')](_0xee0d('0xc'),auth[_0xee0d('0xd')](),controller[_0xee0d('0xe')]);router[_0xee0d('0x7')](_0xee0d('0xf'),auth[_0xee0d('0x9')](),controller['getMessages']);router[_0xee0d('0x7')](_0xee0d('0x10'),auth[_0xee0d('0xd')](),controller['getMyMessages']);router[_0xee0d('0x7')](_0xee0d('0x11'),auth['isAuthenticated'](),controller[_0xee0d('0x12')]);router[_0xee0d('0x13')]('/',auth[_0xee0d('0x9')](),controller['create']);router['post'](_0xee0d('0x14'),auth[_0xee0d('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xee0d('0x15')]({'destination':function(_0x3ca726,_0x53c53f,_0x29e024){_0x29e024(null,path[_0xee0d('0x16')](config['root'],'server/files/attachments/'));},'filename':function(_0x4e4db1,_0xe83562,_0x44c186){_0x44c186(null,util[_0xee0d('0x17')](_0xee0d('0x18'),Date[_0xee0d('0x19')](),_0xe83562['originalname'][_0xee0d('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xee0d('0x13')](_0xee0d('0x1b'),upload[_0xee0d('0x1c')](_0xee0d('0x1d')),controller[_0xee0d('0x1e')]);router[_0xee0d('0x13')](_0xee0d('0xf'),auth[_0xee0d('0xd')](),controller[_0xee0d('0x1f')]);router[_0xee0d('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xee0d('0x20')](_0xee0d('0x21'),_0xee0d('0x22')),controller[_0xee0d('0x23')]);router[_0xee0d('0x24')](_0xee0d('0xa'),auth[_0xee0d('0x9')](),interaction[_0xee0d('0x20')]('chat',_0xee0d('0x25')),controller[_0xee0d('0x26')]);router['put'](_0xee0d('0x27'),controller[_0xee0d('0x28')]);router[_0xee0d('0x24')](_0xee0d('0x29'),auth[_0xee0d('0xd')](),controller[_0xee0d('0x2a')]);router[_0xee0d('0x24')](_0xee0d('0x2b'),controller[_0xee0d('0x2c')]);router[_0xee0d('0x2d')](_0xee0d('0xa'),auth['isAuthenticated'](),interaction[_0xee0d('0x20')](_0xee0d('0x21'),_0xee0d('0x2e')),controller[_0xee0d('0x2f')]);router[_0xee0d('0x2d')](_0xee0d('0x30'),auth[_0xee0d('0x9')](),controller[_0xee0d('0x31')]);module[_0xee0d('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 24d934e..0b42713 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 _0x1fa4=['sequelize','exports','medium','INTEGER'];(function(_0x33016a,_0xf0fba8){var _0x7c659b=function(_0x3f82cf){while(--_0x3f82cf){_0x33016a['push'](_0x33016a['shift']());}};_0x7c659b(++_0xf0fba8);}(_0x1fa4,0xf0));var _0x41fa=function(_0x109407,_0x2d87fb){_0x109407=_0x109407-0x0;var _0x3ec159=_0x1fa4[_0x109407];return _0x3ec159;};'use strict';var Sequelize=require(_0x41fa('0x0'));module[_0x41fa('0x1')]={'body':{'type':Sequelize['TEXT'](_0x41fa('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x41fa('0x3')]}}; \ No newline at end of file +var _0xf31e=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x58fe5a,_0x53d1d9){var _0x1f788b=function(_0x31d773){while(--_0x31d773){_0x58fe5a['push'](_0x58fe5a['shift']());}};_0x1f788b(++_0x53d1d9);}(_0xf31e,0xdf));var _0xef31=function(_0x3a0c29,_0x325570){_0x3a0c29=_0x3a0c29-0x0;var _0x5b0b9c=_0xf31e[_0x3a0c29];return _0x5b0b9c;};'use strict';var Sequelize=require(_0xef31('0x0'));module[_0xef31('0x1')]={'body':{'type':Sequelize[_0xef31('0x2')](_0xef31('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xef31('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xef31('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1557927..ad8d14f 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 _0x5192=['zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ChatInternalMessage','includeAll','include','catch','show','params','keys','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','user','userpic','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','findAll','isEmpty','agent','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf'];(function(_0x1886c8,_0x1179d3){var _0x3e26e5=function(_0x557191){while(--_0x557191){_0x1886c8['push'](_0x1886c8['shift']());}};_0x3e26e5(++_0x1179d3);}(_0x5192,0xce));var _0x2519=function(_0x572dc4,_0x48dec4){_0x572dc4=_0x572dc4-0x0;var _0x18a792=_0x5192[_0x572dc4];return _0x18a792;};'use strict';var emlformat=require(_0x2519('0x0'));var rimraf=require(_0x2519('0x1'));var zipdir=require(_0x2519('0x2'));var jsonpatch=require(_0x2519('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2519('0x4'));var Mustache=require('mustache');var util=require(_0x2519('0x5'));var path=require(_0x2519('0x6'));var sox=require(_0x2519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2519('0x8'));var _=require(_0x2519('0x9'));var squel=require('squel');var crypto=require(_0x2519('0xa'));var jsforce=require(_0x2519('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2519('0xc'));var Papa=require(_0x2519('0xd'));var Redis=require(_0x2519('0xe'));var authService=require(_0x2519('0xf'));var qs=require(_0x2519('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2519('0x11'))('api');var utils=require(_0x2519('0x12'));var config=require(_0x2519('0x13'));var licenseUtil=require(_0x2519('0x14'));var db=require(_0x2519('0x15'))['db'];config['redis']=_['defaults'](config[_0x2519('0x16')],{'host':_0x2519('0x17'),'port':0x18eb});var socket=require(_0x2519('0x18'))(new Redis(config[_0x2519('0x16')]));require(_0x2519('0x19'))[_0x2519('0x1a')](socket);function respondWithStatusCode(_0x3c4dbc,_0x364930){_0x364930=_0x364930||0xcc;return function(_0x21d97d){if(_0x21d97d){return _0x3c4dbc['sendStatus'](_0x364930);}return _0x3c4dbc[_0x2519('0x1b')](_0x364930)['end']();};}function respondWithResult(_0x451e63,_0x58f555){_0x58f555=_0x58f555||0xc8;return function(_0x56ce38){if(_0x56ce38){return _0x451e63['status'](_0x58f555)[_0x2519('0x1c')](_0x56ce38);}};}function respondWithFilteredResult(_0x1949bd,_0x59f649){return function(_0x37df53){if(_0x37df53){var _0x424c26=typeof _0x59f649[_0x2519('0x1d')]===_0x2519('0x1e')&&typeof _0x59f649[_0x2519('0x1f')]===_0x2519('0x1e');var _0x2a8691=_0x37df53['count'];var _0x3a5223=_0x424c26?0x0:_0x59f649[_0x2519('0x1d')];var _0x42f68a=_0x424c26?_0x37df53[_0x2519('0x20')]:_0x59f649[_0x2519('0x1d')]+_0x59f649['limit'];var _0x43c474;if(_0x42f68a>=_0x2a8691){_0x42f68a=_0x2a8691;_0x43c474=0xc8;}else{_0x43c474=0xce;}_0x1949bd[_0x2519('0x1b')](_0x43c474);return _0x1949bd[_0x2519('0x21')]('Content-Range',_0x3a5223+'-'+_0x42f68a+'/'+_0x2a8691)[_0x2519('0x1c')](_0x37df53);}return null;};}function patchUpdates(_0x1779db){return function(_0x16a3c6){try{jsonpatch[_0x2519('0x22')](_0x16a3c6,_0x1779db,!![]);}catch(_0x563de7){return BPromise[_0x2519('0x23')](_0x563de7);}return _0x16a3c6[_0x2519('0x24')]();};}function saveUpdates(_0x382a19,_0x1b03a1){return function(_0x22061d){if(_0x22061d){return _0x22061d[_0x2519('0x25')](_0x382a19)[_0x2519('0x26')](function(_0x4b507c){return _0x4b507c;});}return null;};}function removeEntity(_0x52a908,_0x8512d5){return function(_0xbc1147){if(_0xbc1147){return _0xbc1147[_0x2519('0x27')]()[_0x2519('0x26')](function(){_0x52a908['status'](0xcc)[_0x2519('0x28')]();});}};}function handleEntityNotFound(_0x340a58,_0x3f05fa){return function(_0xf62d14){if(!_0xf62d14){_0x340a58['sendStatus'](0x194);}return _0xf62d14;};}function handleError(_0x536c48,_0x292b65){_0x292b65=_0x292b65||0x1f4;return function(_0x38dbdf){logger['error'](_0x38dbdf[_0x2519('0x29')]);if(_0x38dbdf[_0x2519('0x2a')]){delete _0x38dbdf[_0x2519('0x2a')];}_0x536c48[_0x2519('0x1b')](_0x292b65)['send'](_0x38dbdf);};}exports[_0x2519('0x2b')]=function(_0x429ca5,_0x5f0a4c){var _0x556c64={},_0x393bad={},_0x33ddff={'count':0x0,'rows':[]};var _0x3a37e8=_[_0x2519('0x2c')](db['ChatInternalMessage'][_0x2519('0x2d')],function(_0x20ba66){return{'name':_0x20ba66[_0x2519('0x2e')],'type':_0x20ba66[_0x2519('0x2f')][_0x2519('0x30')]};});_0x393bad['model']=_[_0x2519('0x2c')](_0x3a37e8,_0x2519('0x2a'));_0x393bad[_0x2519('0x31')]=_['keys'](_0x429ca5[_0x2519('0x31')]);_0x393bad[_0x2519('0x32')]=_[_0x2519('0x33')](_0x393bad[_0x2519('0x34')],_0x393bad[_0x2519('0x31')]);_0x556c64[_0x2519('0x35')]=_[_0x2519('0x33')](_0x393bad[_0x2519('0x34')],qs[_0x2519('0x36')](_0x429ca5[_0x2519('0x31')][_0x2519('0x36')]));_0x556c64[_0x2519('0x35')]=_0x556c64[_0x2519('0x35')][_0x2519('0x37')]?_0x556c64[_0x2519('0x35')]:_0x393bad['model'];if(!_0x429ca5['query']['hasOwnProperty'](_0x2519('0x38'))){_0x556c64[_0x2519('0x1f')]=qs[_0x2519('0x1f')](_0x429ca5['query'][_0x2519('0x1f')]);_0x556c64[_0x2519('0x1d')]=qs[_0x2519('0x1d')](_0x429ca5['query'][_0x2519('0x1d')]);}_0x556c64[_0x2519('0x39')]=qs[_0x2519('0x3a')](_0x429ca5[_0x2519('0x31')][_0x2519('0x3a')]);_0x556c64[_0x2519('0x3b')]=qs['filters'](_[_0x2519('0x3c')](_0x429ca5[_0x2519('0x31')],_0x393bad[_0x2519('0x32')]),_0x3a37e8);if(_0x429ca5[_0x2519('0x31')]['filter']){_0x556c64[_0x2519('0x3b')]=_[_0x2519('0x3d')](_0x556c64['where'],{'$or':_[_0x2519('0x2c')](_0x3a37e8,function(_0x1bc9a6){if(_0x1bc9a6['type']!==_0x2519('0x3e')){var _0x520bde={};_0x520bde[_0x1bc9a6['name']]={'$like':'%'+_0x429ca5['query'][_0x2519('0x3f')]+'%'};return _0x520bde;}})});}_0x556c64=_['merge']({},_0x556c64,_0x429ca5['options']);var _0x5c0d9b={'where':_0x556c64['where']};return db[_0x2519('0x40')][_0x2519('0x20')](_0x5c0d9b)[_0x2519('0x26')](function(_0x552933){_0x33ddff['count']=_0x552933;if(_0x429ca5[_0x2519('0x31')][_0x2519('0x41')]){_0x556c64[_0x2519('0x42')]=[{'all':!![]}];}return db[_0x2519('0x40')]['findAll'](_0x556c64);})[_0x2519('0x26')](function(_0x2376d6){_0x33ddff['rows']=_0x2376d6;return _0x33ddff;})[_0x2519('0x26')](respondWithFilteredResult(_0x5f0a4c,_0x556c64))[_0x2519('0x43')](handleError(_0x5f0a4c,null));};exports[_0x2519('0x44')]=function(_0x1599b1,_0x189064){var _0x55fa3d={'raw':!![],'where':{'id':_0x1599b1[_0x2519('0x45')]['id']}},_0x3e7bc9={};_0x3e7bc9[_0x2519('0x34')]=_['keys'](db[_0x2519('0x40')][_0x2519('0x2d')]);_0x3e7bc9[_0x2519('0x31')]=_[_0x2519('0x46')](_0x1599b1[_0x2519('0x31')]);_0x3e7bc9[_0x2519('0x32')]=_[_0x2519('0x33')](_0x3e7bc9[_0x2519('0x34')],_0x3e7bc9['query']);_0x55fa3d['attributes']=_['intersection'](_0x3e7bc9['model'],qs[_0x2519('0x36')](_0x1599b1['query'][_0x2519('0x36')]));_0x55fa3d[_0x2519('0x35')]=_0x55fa3d[_0x2519('0x35')]['length']?_0x55fa3d[_0x2519('0x35')]:_0x3e7bc9['model'];if(_0x1599b1['query'][_0x2519('0x41')]){_0x55fa3d['include']=[{'all':!![]}];}_0x55fa3d=_[_0x2519('0x3d')]({},_0x55fa3d,_0x1599b1[_0x2519('0x47')]);return db['ChatInternalMessage'][_0x2519('0x48')](_0x55fa3d)[_0x2519('0x26')](handleEntityNotFound(_0x189064,null))['then'](respondWithResult(_0x189064,null))[_0x2519('0x43')](handleError(_0x189064,null));};exports[_0x2519('0x49')]=function(_0x11fc7d,_0x3dccec){return db['ChatInternalMessage']['create'](_0x11fc7d[_0x2519('0x4a')],{})[_0x2519('0x26')](respondWithResult(_0x3dccec,0xc9))['catch'](handleError(_0x3dccec,null));};exports[_0x2519('0x25')]=function(_0x5255f9,_0x44dcf7){if(_0x5255f9[_0x2519('0x4a')]['id']){delete _0x5255f9[_0x2519('0x4a')]['id'];}return db[_0x2519('0x40')]['find']({'where':{'id':_0x5255f9[_0x2519('0x45')]['id']}})[_0x2519('0x26')](handleEntityNotFound(_0x44dcf7,null))[_0x2519('0x26')](saveUpdates(_0x5255f9[_0x2519('0x4a')],null))[_0x2519('0x26')](respondWithResult(_0x44dcf7,null))[_0x2519('0x43')](handleError(_0x44dcf7,null));};exports[_0x2519('0x27')]=function(_0x556b88,_0xbcb7aa){return db[_0x2519('0x40')][_0x2519('0x48')]({'where':{'id':_0x556b88[_0x2519('0x45')]['id']}})[_0x2519('0x26')](handleEntityNotFound(_0xbcb7aa,null))[_0x2519('0x26')](removeEntity(_0xbcb7aa,null))[_0x2519('0x43')](handleError(_0xbcb7aa,null));};exports[_0x2519('0x4b')]=function(_0x1bfd04,_0x23ab4a){return db['ChatInternalMessage'][_0x2519('0x4b')]()[_0x2519('0x26')](respondWithResult(_0x23ab4a,null))[_0x2519('0x43')](handleError(_0x23ab4a,null));};function wrapUser(_0x27718f){return function(_0x2fe6b3){var _0x1745cf=_0x27718f[_0x2519('0x4c')]({'plain':!![]});_0x1745cf[_0x2519('0x4d')]=[];if(_0x2fe6b3){_0x1745cf[_0x2519('0x4e')]=_0x2fe6b3[_0x2519('0x4f')];_0x1745cf[_0x2519('0x50')]=_0x2fe6b3;}else{_0x1745cf[_0x2519('0x4e')]=moment(0x0)['format'](_0x2519('0x51'));_0x1745cf['lastMessage']={};}return _0x1745cf;};}exports['getUsers']=function(_0x43e5f4,_0x3fb717,_0x172b89){var _0x18cb49=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0x2519('0x52')]},'attributes':['id','fullname',_0x2519('0x2a'),'role',_0x2519('0x53'),'internal','online',_0x2519('0x54'),_0x2519('0x55'),_0x2519('0x56')],'order':qs[_0x2519('0x3a')]('-online'),'include':[{'model':db[_0x2519('0x57')],'as':_0x2519('0x58'),'attributes':['id',_0x2519('0x2a'),_0x2519('0x2f')],'through':{'attributes':[]}}]})[_0x2519('0x26')](function(_0x474788){if(_0x474788){var _0x3bdfbf=_0x43e5f4['user'][_0x2519('0x4c')]({'plain':!![]});if(!_0x3bdfbf)throw new Error(_0x2519('0x59'));if(_0x3bdfbf[_0x2519('0x5a')]===_0x2519('0x52')){return db[_0x2519('0x5b')]['find']({'where':{'name':_0x2519('0x5c'),'userProfileId':_0x3bdfbf['userProfileId']},'raw':!![]})[_0x2519('0x26')](function(_0x8e8259){if(_0x8e8259){if(_0x8e8259[_0x2519('0x5d')]===0x0){return db[_0x2519('0x5e')][_0x2519('0x5f')]({'where':{'sectionId':_0x8e8259['id']},'raw':!![]})['then'](function(_0x384ac6){var _0x46a9bd=[];if(_[_0x2519('0x60')](_0x384ac6)){_0x46a9bd=_[_0x2519('0x3f')](_0x474788,function(_0x6c04a9){if(_0x6c04a9['role']!=='agent'){return _0x6c04a9;}});return _0x46a9bd;}else{for(var _0x388461=0x0;_0x388461<_0x474788[_0x2519('0x37')];_0x388461++){var _0x347f49=_0x474788[_0x388461];if(_0x347f49[_0x2519('0x5a')]===_0x2519('0x61')){var _0x4de8d5=_['find'](_0x384ac6,function(_0x2adcfe){return _0x2adcfe['resourceId']===_0x347f49['id'];});if(_0x4de8d5)_0x46a9bd[_0x2519('0x62')](_0x347f49);}else{_0x46a9bd[_0x2519('0x62')](_0x347f49);}}return _0x46a9bd;}});}else{return _0x474788;}}else{var _0x293ec9=_[_0x2519('0x3f')](_0x474788,function(_0x3dfbc8){if(_0x3dfbc8['role']!==_0x2519('0x61')){return _0x3dfbc8;}});return _0x293ec9;}});}else{return _0x474788;}}})[_0x2519('0x26')](function(_0x283d28){var _0xff57a9=[];if(_0x283d28){_0x18cb49=_0x283d28;for(var _0x356b0a=0x0;_0x356b0a<_0x283d28[_0x2519('0x37')];_0x356b0a+=0x1){_0x18cb49[_0x356b0a][_0x2519('0x4d')]=[];_0xff57a9['push'](db[_0x2519('0x40')][_0x2519('0x48')]({'where':{'FromId':[_0x43e5f4[_0x2519('0x52')]['id'],_0x283d28[_0x356b0a]['id']],'ToId':[_0x43e5f4[_0x2519('0x52')]['id'],_0x283d28[_0x356b0a]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2519('0x63'),_0x2519('0x64'),_0x2519('0x65'),_0x2519('0x4a')],'order':qs[_0x2519('0x3a')](_0x2519('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2519('0x26')](wrapUser(_0x283d28[_0x356b0a])));}return BPromise[_0x2519('0x67')](_0xff57a9);}return[];})[_0x2519('0x26')](function(_0x286889){return{'rows':_0x286889,'count':_0x286889['length']};})['then'](respondWithResult(_0x3fb717,null))[_0x2519('0x43')](handleError(_0x3fb717,null));}; \ No newline at end of file +var _0x4ca5=['includeAll','include','findAll','catch','show','params','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','FromId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','defaults','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4ca5,0x1ec));var _0x54ca=function(_0x43dab4,_0x112f40){_0x43dab4=_0x43dab4-0x0;var _0x289fad=_0x4ca5[_0x43dab4];return _0x289fad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x54ca('0x0'));var jsonpatch=require(_0x54ca('0x1'));var rp=require(_0x54ca('0x2'));var moment=require(_0x54ca('0x3'));var BPromise=require(_0x54ca('0x4'));var Mustache=require(_0x54ca('0x5'));var util=require(_0x54ca('0x6'));var path=require('path');var sox=require(_0x54ca('0x7'));var csv=require(_0x54ca('0x8'));var ejs=require(_0x54ca('0x9'));var fs=require('fs');var fs_extra=require(_0x54ca('0xa'));var _=require(_0x54ca('0xb'));var squel=require(_0x54ca('0xc'));var crypto=require('crypto');var jsforce=require(_0x54ca('0xd'));var deskjs=require(_0x54ca('0xe'));var toCsv=require(_0x54ca('0x8'));var querystring=require(_0x54ca('0xf'));var Papa=require(_0x54ca('0x10'));var Redis=require(_0x54ca('0x11'));var authService=require(_0x54ca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x54ca('0x13'));var hardwareService=require(_0x54ca('0x14'));var logger=require(_0x54ca('0x15'))(_0x54ca('0x16'));var utils=require(_0x54ca('0x17'));var config=require(_0x54ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x54ca('0x19'))['db'];config['redis']=_[_0x54ca('0x1a')](config[_0x54ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x54ca('0x1c'))(new Redis(config[_0x54ca('0x1b')]));require('./chatInternalMessage.socket')[_0x54ca('0x1d')](socket);function respondWithStatusCode(_0x85b1e2,_0x3df142){_0x3df142=_0x3df142||0xcc;return function(_0x5a542a){if(_0x5a542a){return _0x85b1e2[_0x54ca('0x1e')](_0x3df142);}return _0x85b1e2[_0x54ca('0x1f')](_0x3df142)[_0x54ca('0x20')]();};}function respondWithResult(_0xa90419,_0x36f6c9){_0x36f6c9=_0x36f6c9||0xc8;return function(_0x599d83){if(_0x599d83){return _0xa90419[_0x54ca('0x1f')](_0x36f6c9)['json'](_0x599d83);}};}function respondWithFilteredResult(_0x46c0e9,_0xc2cc2c){return function(_0x29cca0){if(_0x29cca0){var _0x381be4=typeof _0xc2cc2c[_0x54ca('0x21')]===_0x54ca('0x22')&&typeof _0xc2cc2c[_0x54ca('0x23')]===_0x54ca('0x22');var _0x3e8917=_0x29cca0[_0x54ca('0x24')];var _0x1867f4=_0x381be4?0x0:_0xc2cc2c[_0x54ca('0x21')];var _0x11a297=_0x381be4?_0x29cca0[_0x54ca('0x24')]:_0xc2cc2c[_0x54ca('0x21')]+_0xc2cc2c[_0x54ca('0x23')];var _0x1ba494;if(_0x11a297>=_0x3e8917){_0x11a297=_0x3e8917;_0x1ba494=0xc8;}else{_0x1ba494=0xce;}_0x46c0e9[_0x54ca('0x1f')](_0x1ba494);return _0x46c0e9[_0x54ca('0x25')](_0x54ca('0x26'),_0x1867f4+'-'+_0x11a297+'/'+_0x3e8917)[_0x54ca('0x27')](_0x29cca0);}return null;};}function patchUpdates(_0x221f8d){return function(_0x52615d){try{jsonpatch[_0x54ca('0x28')](_0x52615d,_0x221f8d,!![]);}catch(_0x5ab031){return BPromise[_0x54ca('0x29')](_0x5ab031);}return _0x52615d[_0x54ca('0x2a')]();};}function saveUpdates(_0xa51a79,_0x1ef138){return function(_0x23fe5a){if(_0x23fe5a){return _0x23fe5a[_0x54ca('0x2b')](_0xa51a79)[_0x54ca('0x2c')](function(_0x2c6a39){return _0x2c6a39;});}return null;};}function removeEntity(_0x49475e,_0x1b7262){return function(_0x1e2283){if(_0x1e2283){return _0x1e2283[_0x54ca('0x2d')]()['then'](function(){_0x49475e[_0x54ca('0x1f')](0xcc)[_0x54ca('0x20')]();});}};}function handleEntityNotFound(_0x3e113f,_0x27acda){return function(_0xbe121){if(!_0xbe121){_0x3e113f[_0x54ca('0x1e')](0x194);}return _0xbe121;};}function handleError(_0x5f42e8,_0x388c52){_0x388c52=_0x388c52||0x1f4;return function(_0x4d760a){logger[_0x54ca('0x2e')](_0x4d760a[_0x54ca('0x2f')]);if(_0x4d760a['name']){delete _0x4d760a['name'];}_0x5f42e8[_0x54ca('0x1f')](_0x388c52)[_0x54ca('0x30')](_0x4d760a);};}exports[_0x54ca('0x31')]=function(_0x43359b,_0x363dbc){var _0x13a49a={},_0x19ef99={},_0x31f585={'count':0x0,'rows':[]};var _0xce9745=_[_0x54ca('0x32')](db[_0x54ca('0x33')][_0x54ca('0x34')],function(_0x45acbe){return{'name':_0x45acbe[_0x54ca('0x35')],'type':_0x45acbe[_0x54ca('0x36')]['key']};});_0x19ef99[_0x54ca('0x37')]=_[_0x54ca('0x32')](_0xce9745,_0x54ca('0x38'));_0x19ef99[_0x54ca('0x39')]=_[_0x54ca('0x3a')](_0x43359b[_0x54ca('0x39')]);_0x19ef99['filters']=_[_0x54ca('0x3b')](_0x19ef99[_0x54ca('0x37')],_0x19ef99[_0x54ca('0x39')]);_0x13a49a[_0x54ca('0x3c')]=_[_0x54ca('0x3b')](_0x19ef99[_0x54ca('0x37')],qs[_0x54ca('0x3d')](_0x43359b[_0x54ca('0x39')][_0x54ca('0x3d')]));_0x13a49a[_0x54ca('0x3c')]=_0x13a49a[_0x54ca('0x3c')][_0x54ca('0x3e')]?_0x13a49a[_0x54ca('0x3c')]:_0x19ef99[_0x54ca('0x37')];if(!_0x43359b[_0x54ca('0x39')][_0x54ca('0x3f')](_0x54ca('0x40'))){_0x13a49a[_0x54ca('0x23')]=qs['limit'](_0x43359b[_0x54ca('0x39')][_0x54ca('0x23')]);_0x13a49a[_0x54ca('0x21')]=qs[_0x54ca('0x21')](_0x43359b['query']['offset']);}_0x13a49a[_0x54ca('0x41')]=qs[_0x54ca('0x42')](_0x43359b['query']['sort']);_0x13a49a[_0x54ca('0x43')]=qs[_0x54ca('0x44')](_[_0x54ca('0x45')](_0x43359b['query'],_0x19ef99[_0x54ca('0x44')]),_0xce9745);if(_0x43359b[_0x54ca('0x39')]['filter']){_0x13a49a[_0x54ca('0x43')]=_[_0x54ca('0x46')](_0x13a49a[_0x54ca('0x43')],{'$or':_['map'](_0xce9745,function(_0x508f80){if(_0x508f80[_0x54ca('0x36')]!==_0x54ca('0x47')){var _0x3008a4={};_0x3008a4[_0x508f80[_0x54ca('0x38')]]={'$like':'%'+_0x43359b['query'][_0x54ca('0x48')]+'%'};return _0x3008a4;}})});}_0x13a49a=_[_0x54ca('0x46')]({},_0x13a49a,_0x43359b['options']);var _0x3f369e={'where':_0x13a49a[_0x54ca('0x43')]};return db[_0x54ca('0x33')]['count'](_0x3f369e)[_0x54ca('0x2c')](function(_0x10298f){_0x31f585[_0x54ca('0x24')]=_0x10298f;if(_0x43359b[_0x54ca('0x39')][_0x54ca('0x49')]){_0x13a49a[_0x54ca('0x4a')]=[{'all':!![]}];}return db[_0x54ca('0x33')][_0x54ca('0x4b')](_0x13a49a);})['then'](function(_0x31a219){_0x31f585['rows']=_0x31a219;return _0x31f585;})['then'](respondWithFilteredResult(_0x363dbc,_0x13a49a))[_0x54ca('0x4c')](handleError(_0x363dbc,null));};exports[_0x54ca('0x4d')]=function(_0x14e602,_0x3c3a6a){var _0x137bb8={'raw':!![],'where':{'id':_0x14e602[_0x54ca('0x4e')]['id']}},_0x518c5d={};_0x518c5d[_0x54ca('0x37')]=_[_0x54ca('0x3a')](db[_0x54ca('0x33')][_0x54ca('0x34')]);_0x518c5d[_0x54ca('0x39')]=_[_0x54ca('0x3a')](_0x14e602[_0x54ca('0x39')]);_0x518c5d['filters']=_[_0x54ca('0x3b')](_0x518c5d[_0x54ca('0x37')],_0x518c5d[_0x54ca('0x39')]);_0x137bb8[_0x54ca('0x3c')]=_[_0x54ca('0x3b')](_0x518c5d[_0x54ca('0x37')],qs[_0x54ca('0x3d')](_0x14e602[_0x54ca('0x39')]['fields']));_0x137bb8[_0x54ca('0x3c')]=_0x137bb8[_0x54ca('0x3c')][_0x54ca('0x3e')]?_0x137bb8[_0x54ca('0x3c')]:_0x518c5d['model'];if(_0x14e602[_0x54ca('0x39')]['includeAll']){_0x137bb8['include']=[{'all':!![]}];}_0x137bb8=_[_0x54ca('0x46')]({},_0x137bb8,_0x14e602[_0x54ca('0x4f')]);return db['ChatInternalMessage'][_0x54ca('0x50')](_0x137bb8)['then'](handleEntityNotFound(_0x3c3a6a,null))[_0x54ca('0x2c')](respondWithResult(_0x3c3a6a,null))['catch'](handleError(_0x3c3a6a,null));};exports[_0x54ca('0x51')]=function(_0x4c94c2,_0x404911){return db[_0x54ca('0x33')][_0x54ca('0x51')](_0x4c94c2[_0x54ca('0x52')],{})['then'](respondWithResult(_0x404911,0xc9))[_0x54ca('0x4c')](handleError(_0x404911,null));};exports[_0x54ca('0x2b')]=function(_0x50eea7,_0x318868){if(_0x50eea7[_0x54ca('0x52')]['id']){delete _0x50eea7[_0x54ca('0x52')]['id'];}return db[_0x54ca('0x33')][_0x54ca('0x50')]({'where':{'id':_0x50eea7[_0x54ca('0x4e')]['id']}})[_0x54ca('0x2c')](handleEntityNotFound(_0x318868,null))[_0x54ca('0x2c')](saveUpdates(_0x50eea7[_0x54ca('0x52')],null))[_0x54ca('0x2c')](respondWithResult(_0x318868,null))[_0x54ca('0x4c')](handleError(_0x318868,null));};exports[_0x54ca('0x2d')]=function(_0x5d8f2d,_0x3ebb9e){return db['ChatInternalMessage'][_0x54ca('0x50')]({'where':{'id':_0x5d8f2d[_0x54ca('0x4e')]['id']}})[_0x54ca('0x2c')](handleEntityNotFound(_0x3ebb9e,null))[_0x54ca('0x2c')](removeEntity(_0x3ebb9e,null))[_0x54ca('0x4c')](handleError(_0x3ebb9e,null));};exports[_0x54ca('0x53')]=function(_0x231f59,_0x291953){return db[_0x54ca('0x33')][_0x54ca('0x53')]()[_0x54ca('0x2c')](respondWithResult(_0x291953,null))['catch'](handleError(_0x291953,null));};function wrapUser(_0x4b38d0){return function(_0x3c55cb){var _0x31e707=_0x4b38d0[_0x54ca('0x54')]({'plain':!![]});_0x31e707[_0x54ca('0x55')]=[];if(_0x3c55cb){_0x31e707[_0x54ca('0x56')]=_0x3c55cb[_0x54ca('0x57')];_0x31e707[_0x54ca('0x58')]=_0x3c55cb;}else{_0x31e707[_0x54ca('0x56')]=moment(0x0)[_0x54ca('0x59')](_0x54ca('0x5a'));_0x31e707[_0x54ca('0x58')]={};}return _0x31e707;};}exports['getUsers']=function(_0x583a31,_0x22cdf1,_0x40c472){var _0x2c269e=[];return db['User'][_0x54ca('0x4b')]({'where':{'role':['agent','admin',_0x54ca('0x5b')]},'attributes':['id',_0x54ca('0x5c'),_0x54ca('0x38'),_0x54ca('0x5d'),_0x54ca('0x5e'),_0x54ca('0x5f'),_0x54ca('0x60'),_0x54ca('0x61'),_0x54ca('0x62'),'showWebBar'],'order':qs[_0x54ca('0x42')](_0x54ca('0x63')),'include':[{'model':db['VoiceQueue'],'as':_0x54ca('0x64'),'attributes':['id',_0x54ca('0x38'),'type'],'through':{'attributes':[]}}]})[_0x54ca('0x2c')](function(_0x4edc94){if(_0x4edc94){var _0x49898e=_0x583a31[_0x54ca('0x5b')][_0x54ca('0x54')]({'plain':!![]});if(!_0x49898e)throw new Error(_0x54ca('0x65'));if(_0x49898e[_0x54ca('0x5d')]===_0x54ca('0x5b')){return db[_0x54ca('0x66')]['find']({'where':{'name':'Agents','userProfileId':_0x49898e[_0x54ca('0x67')]},'raw':!![]})[_0x54ca('0x2c')](function(_0x1a5b32){if(_0x1a5b32){if(_0x1a5b32[_0x54ca('0x68')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1a5b32['id']},'raw':!![]})['then'](function(_0x2861c3){var _0x52ce92=[];if(_[_0x54ca('0x69')](_0x2861c3)){_0x52ce92=_[_0x54ca('0x48')](_0x4edc94,function(_0x5b43d4){if(_0x5b43d4[_0x54ca('0x5d')]!=='agent'){return _0x5b43d4;}});return _0x52ce92;}else{for(var _0x7d1fc8=0x0;_0x7d1fc8<_0x4edc94[_0x54ca('0x3e')];_0x7d1fc8++){var _0x332e0d=_0x4edc94[_0x7d1fc8];if(_0x332e0d[_0x54ca('0x5d')]===_0x54ca('0x6a')){var _0x46d6db=_[_0x54ca('0x50')](_0x2861c3,function(_0x88c483){return _0x88c483[_0x54ca('0x6b')]===_0x332e0d['id'];});if(_0x46d6db)_0x52ce92[_0x54ca('0x6c')](_0x332e0d);}else{_0x52ce92[_0x54ca('0x6c')](_0x332e0d);}}return _0x52ce92;}});}else{return _0x4edc94;}}else{var _0x5d5816=_[_0x54ca('0x48')](_0x4edc94,function(_0x26e42e){if(_0x26e42e['role']!==_0x54ca('0x6a')){return _0x26e42e;}});return _0x5d5816;}});}else{return _0x4edc94;}}})[_0x54ca('0x2c')](function(_0x52dad6){var _0x490dde=[];if(_0x52dad6){_0x2c269e=_0x52dad6;for(var _0x438683=0x0;_0x438683<_0x52dad6['length'];_0x438683+=0x1){_0x2c269e[_0x438683]['messages']=[];_0x490dde[_0x54ca('0x6c')](db[_0x54ca('0x33')][_0x54ca('0x50')]({'where':{'FromId':[_0x583a31['user']['id'],_0x52dad6[_0x438683]['id']],'ToId':[_0x583a31[_0x54ca('0x5b')]['id'],_0x52dad6[_0x438683]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x54ca('0x6d'),'ToId',_0x54ca('0x6e'),_0x54ca('0x52')],'order':qs[_0x54ca('0x42')](_0x54ca('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x54ca('0x2c')](wrapUser(_0x52dad6[_0x438683])));}return BPromise[_0x54ca('0x70')](_0x490dde);}return[];})[_0x54ca('0x2c')](function(_0x4df760){return{'rows':_0x4df760,'count':_0x4df760[_0x54ca('0x3e')]};})[_0x54ca('0x2c')](respondWithResult(_0x22cdf1,null))[_0x54ca('0x4c')](handleError(_0x22cdf1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 44a8393..38cf7bf 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 _0xfaec=['ChatInternalMessage','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x599901,_0x414dff){var _0x212569=function(_0x13b83d){while(--_0x13b83d){_0x599901['push'](_0x599901['shift']());}};_0x212569(++_0x414dff);}(_0xfaec,0x139));var _0xcfae=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfaec[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xcfae('0x0'));var ChatInternalMessage=require(_0xcfae('0x1'))['db'][_0xcfae('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcfae('0x3'),'afterUpdate':_0xcfae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52b878){return function(_0x142688,_0x44cad5,_0xeaeb70){ChatInternalMessageEvents[_0xcfae('0x5')](_0x52b878+':'+_0x142688['id'],_0x142688);ChatInternalMessageEvents[_0xcfae('0x5')](_0x52b878,_0x142688);_0xeaeb70(null);};}for(var e in events){if(events[_0xcfae('0x6')](e)){var event=events[e];ChatInternalMessage[_0xcfae('0x7')](e,emitEvent(event));}}module[_0xcfae('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe83b=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x549e70,_0x8a5460){var _0x9a9d8c=function(_0x3408c5){while(--_0x3408c5){_0x549e70['push'](_0x549e70['shift']());}};_0x9a9d8c(++_0x8a5460);}(_0xe83b,0x114));var _0xbe83=function(_0x2dae0c,_0x3b578c){_0x2dae0c=_0x2dae0c-0x0;var _0x36c35b=_0xe83b[_0x2dae0c];return _0x36c35b;};'use strict';var EventEmitter=require(_0xbe83('0x0'));var ChatInternalMessage=require(_0xbe83('0x1'))['db'][_0xbe83('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbe83('0x3')](0x0);var events={'afterCreate':_0xbe83('0x4'),'afterUpdate':_0xbe83('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31ed17){return function(_0x3b8c11,_0x27c177,_0x880bd7){ChatInternalMessageEvents['emit'](_0x31ed17+':'+_0x3b8c11['id'],_0x3b8c11);ChatInternalMessageEvents[_0xbe83('0x6')](_0x31ed17,_0x3b8c11);_0x880bd7(null);};}for(var e in events){if(events[_0xbe83('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xbe83('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6e4000f..667910d 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 _0x79ec=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','define'];(function(_0x2aff86,_0x213964){var _0xb63464=function(_0x3e024b){while(--_0x3e024b){_0x2aff86['push'](_0x2aff86['shift']());}};_0xb63464(++_0x213964);}(_0x79ec,0x1bf));var _0xc79e=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0x79ec[_0x458edc];return _0x44af29;};'use strict';var _=require('lodash');var util=require(_0xc79e('0x0'));var logger=require('../../config/logger')(_0xc79e('0x1'));var moment=require(_0xc79e('0x2'));var BPromise=require(_0xc79e('0x3'));var rp=require(_0xc79e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc79e('0x5'));var config=require('../../config/environment');var attributes=require(_0xc79e('0x6'));module[_0xc79e('0x7')]=function(_0x27da3c,_0x5a5610){return _0x27da3c[_0xc79e('0x8')](_0xc79e('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc79e('0xa'),'collate':_0xc79e('0xb')});}; \ No newline at end of file +var _0x44b7=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage'];(function(_0x2371d4,_0x218bfb){var _0x101f05=function(_0x334911){while(--_0x334911){_0x2371d4['push'](_0x2371d4['shift']());}};_0x101f05(++_0x218bfb);}(_0x44b7,0x1c3));var _0x744b=function(_0x3c6e06,_0x59be65){_0x3c6e06=_0x3c6e06-0x0;var _0x4f6ffc=_0x44b7[_0x3c6e06];return _0x4f6ffc;};'use strict';var _=require(_0x744b('0x0'));var util=require('util');var logger=require(_0x744b('0x1'))(_0x744b('0x2'));var moment=require(_0x744b('0x3'));var BPromise=require('bluebird');var rp=require(_0x744b('0x4'));var fs=require('fs');var path=require(_0x744b('0x5'));var rimraf=require(_0x744b('0x6'));var config=require(_0x744b('0x7'));var attributes=require(_0x744b('0x8'));module[_0x744b('0x9')]=function(_0x23056a,_0x3cd4bd){return _0x23056a['define'](_0x744b('0xa'),attributes,{'tableName':_0x744b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x744b('0xc'),'collate':_0x744b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 770b2b0..f6c9d5e 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 _0xf4e5=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x314565,_0x233ee6){_0x314565=_0x314565-0x0;var _0x54acc1=_0xf4e5[_0x314565];return _0x54acc1;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var moment=require(_0x5f4e('0x2'));var BPromise=require(_0x5f4e('0x3'));var rs=require(_0x5f4e('0x4'));var fs=require('fs');var Redis=require(_0x5f4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4e('0x6'))(_0x5f4e('0x7'));var config=require(_0x5f4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f4e('0x9')][_0x5f4e('0xa')]({'port':0x232a});config[_0x5f4e('0xb')]=_[_0x5f4e('0xc')](config[_0x5f4e('0xb')],{'host':_0x5f4e('0xd'),'port':0x18eb});var socket=require(_0x5f4e('0xe'))(new Redis(config[_0x5f4e('0xb')]));require(_0x5f4e('0xf'))['register'](socket);function respondWithRpcPromise(_0x553d3e,_0x1f27b7,_0xa89bfe){return new BPromise(function(_0x434957,_0x4e227a){return client[_0x5f4e('0x10')](_0x553d3e,_0xa89bfe)[_0x5f4e('0x11')](function(_0x1d0060){logger[_0x5f4e('0x12')](_0x5f4e('0x13'),_0x1f27b7,_0x5f4e('0x14'));logger[_0x5f4e('0x15')](_0x5f4e('0x16'),_0x1f27b7,_0x5f4e('0x14'),JSON[_0x5f4e('0x17')](_0x1d0060));if(_0x1d0060[_0x5f4e('0x18')]){if(_0x1d0060['error'][_0x5f4e('0x19')]===0x1f4){logger[_0x5f4e('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f27b7,_0x1d0060[_0x5f4e('0x18')][_0x5f4e('0x1a')]);return _0x4e227a(_0x1d0060[_0x5f4e('0x18')]['message']);}logger[_0x5f4e('0x18')](_0x5f4e('0x13'),_0x1f27b7,_0x1d0060[_0x5f4e('0x18')]['message']);return _0x434957(_0x1d0060[_0x5f4e('0x18')][_0x5f4e('0x1a')]);}else{logger['info'](_0x5f4e('0x13'),_0x1f27b7,_0x5f4e('0x14'));_0x434957(_0x1d0060[_0x5f4e('0x1b')][_0x5f4e('0x1a')]);}})[_0x5f4e('0x1c')](function(_0x540920){logger[_0x5f4e('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f27b7,_0x540920);_0x4e227a(_0x540920);});});} \ No newline at end of file +var _0x8f97=['stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x8f97,0x13e));var _0x78f9=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0x8f97[_0x1fd4d7];return _0x7efe8a;};'use strict';var _=require('lodash');var util=require(_0x78f9('0x0'));var moment=require(_0x78f9('0x1'));var BPromise=require(_0x78f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78f9('0x3'))['db'];var utils=require(_0x78f9('0x4'));var logger=require(_0x78f9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78f9('0x6'));var client=jayson['client'][_0x78f9('0x7')]({'port':0x232a});config[_0x78f9('0x8')]=_[_0x78f9('0x9')](config['redis'],{'host':_0x78f9('0xa'),'port':0x18eb});var socket=require(_0x78f9('0xb'))(new Redis(config[_0x78f9('0x8')]));require(_0x78f9('0xc'))[_0x78f9('0xd')](socket);function respondWithRpcPromise(_0x23691a,_0xde5456,_0x5e4a4b){return new BPromise(function(_0x250f6b,_0x14dcea){return client[_0x78f9('0xe')](_0x23691a,_0x5e4a4b)[_0x78f9('0xf')](function(_0x5d4d1f){logger[_0x78f9('0x10')](_0x78f9('0x11'),_0xde5456,_0x78f9('0x12'));logger[_0x78f9('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xde5456,_0x78f9('0x12'),JSON[_0x78f9('0x14')](_0x5d4d1f));if(_0x5d4d1f[_0x78f9('0x15')]){if(_0x5d4d1f['error'][_0x78f9('0x16')]===0x1f4){logger[_0x78f9('0x15')](_0x78f9('0x11'),_0xde5456,_0x5d4d1f['error'][_0x78f9('0x17')]);return _0x14dcea(_0x5d4d1f['error'][_0x78f9('0x17')]);}logger[_0x78f9('0x15')](_0x78f9('0x11'),_0xde5456,_0x5d4d1f[_0x78f9('0x15')][_0x78f9('0x17')]);return _0x250f6b(_0x5d4d1f['error'][_0x78f9('0x17')]);}else{logger[_0x78f9('0x10')](_0x78f9('0x11'),_0xde5456,_0x78f9('0x12'));_0x250f6b(_0x5d4d1f[_0x78f9('0x18')]['message']);}})[_0x78f9('0x19')](function(_0x5e7878){logger[_0x78f9('0x15')](_0x78f9('0x11'),_0xde5456,_0x5e7878);_0x14dcea(_0x5e7878);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ff60cbc..7915a4e 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 _0x10ec=['./chatInternalMessage.events','save','remove','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x10ec,0x110));var _0xc10e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x10ec[_0x5d6456];return _0x4d66c1;};'use strict';var ChatInternalMessageEvents=require(_0xc10e('0x0'));var events=[_0xc10e('0x1'),_0xc10e('0x2'),'update'];function createListener(_0xac748b,_0x21e1d8){return function(_0xcae70b){_0x21e1d8[_0xc10e('0x3')](_0xac748b,_0xcae70b);};}function removeListener(_0xc778c9,_0x570598){return function(){ChatInternalMessageEvents[_0xc10e('0x4')](_0xc778c9,_0x570598);};}exports[_0xc10e('0x5')]=function(_0x58917a){for(var _0x3f82a8=0x0,_0x2894b0=events[_0xc10e('0x6')];_0x3f82a8<_0x2894b0;_0x3f82a8++){var _0x373be8=events[_0x3f82a8];var _0x522c04=createListener(_0xc10e('0x7')+_0x373be8,_0x58917a);ChatInternalMessageEvents['on'](_0x373be8,_0x522c04);}}; \ No newline at end of file +var _0x43f2=['chatInternalMessage:','register'];(function(_0x3833b1,_0x12fd9a){var _0x3fa099=function(_0x958aec){while(--_0x958aec){_0x3833b1['push'](_0x3833b1['shift']());}};_0x3fa099(++_0x12fd9a);}(_0x43f2,0x18f));var _0x243f=function(_0x96c154,_0x2db1aa){_0x96c154=_0x96c154-0x0;var _0x43fb6d=_0x43f2[_0x96c154];return _0x43fb6d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove','update'];function createListener(_0xe2090d,_0x4ef9de){return function(_0x142ac4){_0x4ef9de['emit'](_0xe2090d,_0x142ac4);};}function removeListener(_0x359260,_0xdaeab){return function(){ChatInternalMessageEvents['removeListener'](_0x359260,_0xdaeab);};}exports[_0x243f('0x0')]=function(_0x3195b7){for(var _0x33d5da=0x0,_0x513b7a=events['length'];_0x33d5da<_0x513b7a;_0x33d5da++){var _0x3fcf78=events[_0x33d5da];var _0x3cfb80=createListener(_0x243f('0x1')+_0x3fcf78,_0x3195b7);ChatInternalMessageEvents['on'](_0x3fcf78,_0x3cfb80);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0f8416e..9197972 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 _0xbe3e=['./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x48f801,_0x1cc751){var _0x1e5ecb=function(_0x55587d){while(--_0x55587d){_0x48f801['push'](_0x48f801['shift']());}};_0x1e5ecb(++_0x1cc751);}(_0xbe3e,0x1b0));var _0xebe3=function(_0x4f6eb2,_0x4f3253){_0x4f6eb2=_0x4f6eb2-0x0;var _0x128bab=_0xbe3e[_0x4f6eb2];return _0x128bab;};'use strict';var multer=require(_0xebe3('0x0'));var util=require(_0xebe3('0x1'));var path=require(_0xebe3('0x2'));var timeout=require(_0xebe3('0x3'));var express=require(_0xebe3('0x4'));var router=express[_0xebe3('0x5')]();var fs_extra=require(_0xebe3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xebe3('0x7'));var config=require('../../config/environment');var controller=require(_0xebe3('0x8'));router[_0xebe3('0x9')]('/',auth[_0xebe3('0xa')](),controller['index']);router[_0xebe3('0x9')](_0xebe3('0xb'),auth[_0xebe3('0xa')](),controller[_0xebe3('0xc')]);router[_0xebe3('0x9')](_0xebe3('0xd'),auth[_0xebe3('0xa')](),controller[_0xebe3('0xe')]);router[_0xebe3('0x9')](_0xebe3('0xf'),auth[_0xebe3('0xa')](),controller['show']);router['post']('/',auth[_0xebe3('0xa')](),controller['create']);router[_0xebe3('0x10')](_0xebe3('0xf'),controller[_0xebe3('0x11')]);router[_0xebe3('0x12')](_0xebe3('0xf'),auth[_0xebe3('0xa')](),controller['destroy']);module[_0xebe3('0x13')]=router; \ No newline at end of file +var _0x14b9=['../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x14b9,0x191));var _0x914b=function(_0x531c55,_0x1d57f7){_0x531c55=_0x531c55-0x0;var _0x4ba729=_0x14b9[_0x531c55];return _0x4ba729;};'use strict';var multer=require(_0x914b('0x0'));var util=require('util');var path=require(_0x914b('0x1'));var timeout=require(_0x914b('0x2'));var express=require(_0x914b('0x3'));var router=express[_0x914b('0x4')]();var fs_extra=require(_0x914b('0x5'));var auth=require(_0x914b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x914b('0x7'));var controller=require(_0x914b('0x8'));router[_0x914b('0x9')]('/',auth[_0x914b('0xa')](),controller[_0x914b('0xb')]);router['get'](_0x914b('0xc'),auth[_0x914b('0xa')](),controller[_0x914b('0xd')]);router[_0x914b('0x9')]('/users',auth[_0x914b('0xa')](),controller[_0x914b('0xe')]);router['get'](_0x914b('0xf'),auth[_0x914b('0xa')](),controller[_0x914b('0x10')]);router[_0x914b('0x11')]('/',auth[_0x914b('0xa')](),controller[_0x914b('0x12')]);router[_0x914b('0x13')](_0x914b('0xf'),controller[_0x914b('0x14')]);router[_0x914b('0x15')](_0x914b('0xf'),auth[_0x914b('0xa')](),controller[_0x914b('0x16')]);module[_0x914b('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8935263..0741ce6 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 _0xf45e=['ENUM','out','DATE','STRING','sequelize','TEXT','BOOLEAN'];(function(_0xd2eaac,_0x331cff){var _0x30495a=function(_0x5c582f){while(--_0x5c582f){_0xd2eaac['push'](_0xd2eaac['shift']());}};_0x30495a(++_0x331cff);}(_0xf45e,0x115));var _0xef45=function(_0x325aa2,_0x29bd7f){_0x325aa2=_0x325aa2-0x0;var _0x451a67=_0xf45e[_0x325aa2];return _0x451a67;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'body':{'type':Sequelize[_0xef45('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xef45('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xef45('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xef45('0x3')]('in',_0xef45('0x4')),'defaultValue':_0xef45('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xef45('0x5')]},'providerName':{'type':Sequelize[_0xef45('0x6')]},'providerResponse':{'type':Sequelize[_0xef45('0x1')]}}; \ No newline at end of file +var _0x4024=['BOOLEAN','ENUM','out','DATE','sequelize','exports','medium'];(function(_0x160cbc,_0x3025a6){var _0x4ac8c6=function(_0x27e1d3){while(--_0x27e1d3){_0x160cbc['push'](_0x160cbc['shift']());}};_0x4ac8c6(++_0x3025a6);}(_0x4024,0x89));var _0x4402=function(_0x47c80e,_0x1bce79){_0x47c80e=_0x47c80e-0x0;var _0x17db83=_0x4024[_0x47c80e];return _0x17db83;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4402('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4402('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4402('0x4')]('in','out'),'defaultValue':_0x4402('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4402('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4111777..40ce0db 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 _0x3e90=['../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','findAll','rows','params','includeAll','find','create','body','describe','chat-interactions','accept','read','readAt','format','UserId','user','agent','ChatInteractionId','isNil','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','event','EventManager','acceptmessage','parse','formData','chat','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','sequelize','interface','SIP/%s','motionChannel','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2d7345,_0x131853){var _0x4c6ec9=function(_0x3df5c3){while(--_0x3df5c3){_0x2d7345['push'](_0x2d7345['shift']());}};_0x4c6ec9(++_0x131853);}(_0x3e90,0xf0));var _0x03e9=function(_0x499caf,_0x34744f){_0x499caf=_0x499caf-0x0;var _0x47b9bb=_0x3e90[_0x499caf];return _0x47b9bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03e9('0x1'));var rp=require(_0x03e9('0x2'));var moment=require(_0x03e9('0x3'));var BPromise=require(_0x03e9('0x4'));var Mustache=require(_0x03e9('0x5'));var util=require(_0x03e9('0x6'));var path=require(_0x03e9('0x7'));var sox=require(_0x03e9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03e9('0x9'));var squel=require(_0x03e9('0xa'));var crypto=require('crypto');var jsforce=require(_0x03e9('0xb'));var deskjs=require(_0x03e9('0xc'));var toCsv=require(_0x03e9('0xd'));var querystring=require('querystring');var Papa=require(_0x03e9('0xe'));var Redis=require(_0x03e9('0xf'));var authService=require(_0x03e9('0x10'));var qs=require(_0x03e9('0x11'));var as=require(_0x03e9('0x12'));var hardwareService=require(_0x03e9('0x13'));var logger=require(_0x03e9('0x14'))(_0x03e9('0x15'));var utils=require(_0x03e9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x03e9('0x17'));var db=require(_0x03e9('0x18'))['db'];config['redis']=_[_0x03e9('0x19')](config[_0x03e9('0x1a')],{'host':_0x03e9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03e9('0x1a')]));require(_0x03e9('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x03e9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x03e9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7fb436,_0x1602bf,_0x315fa5,_0x588185){return new BPromise(function(_0xda4569,_0x5ed953){var _0x3c5737=_0x588185||client;return _0x3c5737[_0x03e9('0x1e')](_0x7fb436,_0x315fa5)[_0x03e9('0x1f')](function(_0x15053a){logger[_0x03e9('0x20')](_0x03e9('0x21'),_0x1602bf,_0x03e9('0x22'));logger[_0x03e9('0x23')](_0x03e9('0x24'),_0x1602bf,_0x03e9('0x22'),JSON['stringify'](_0x15053a));if(_0x15053a[_0x03e9('0x25')]){if(_0x15053a[_0x03e9('0x25')]['code']===0x1f4){logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);return _0x5ed953(_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);}logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);return _0xda4569(_0x15053a[_0x03e9('0x25')][_0x03e9('0x26')]);}else{logger[_0x03e9('0x20')](_0x03e9('0x21'),_0x1602bf,_0x03e9('0x22'));_0xda4569(_0x15053a['result'][_0x03e9('0x26')]);}})[_0x03e9('0x27')](function(_0x16996e){logger[_0x03e9('0x25')](_0x03e9('0x21'),_0x1602bf,_0x16996e);_0x5ed953(_0x16996e);});});}function respondWithStatusCode(_0x16558a,_0x1ed055){_0x1ed055=_0x1ed055||0xcc;return function(_0xfc6f66){if(_0xfc6f66){return _0x16558a[_0x03e9('0x28')](_0x1ed055);}return _0x16558a[_0x03e9('0x29')](_0x1ed055)[_0x03e9('0x2a')]();};}function respondWithResult(_0x555b02,_0x4e8ed8){_0x4e8ed8=_0x4e8ed8||0xc8;return function(_0x299ed9){if(_0x299ed9){return _0x555b02['status'](_0x4e8ed8)[_0x03e9('0x2b')](_0x299ed9);}};}function respondWithFilteredResult(_0x24e6bb,_0x3ea37a){return function(_0x13150d){if(_0x13150d){var _0x1d172a=typeof _0x3ea37a[_0x03e9('0x2c')]===_0x03e9('0x2d')&&typeof _0x3ea37a[_0x03e9('0x2e')]===_0x03e9('0x2d');var _0x1fadbe=_0x13150d[_0x03e9('0x2f')];var _0x1a441d=_0x1d172a?0x0:_0x3ea37a[_0x03e9('0x2c')];var _0x50a2bf=_0x1d172a?_0x13150d[_0x03e9('0x2f')]:_0x3ea37a[_0x03e9('0x2c')]+_0x3ea37a['limit'];var _0xd62754;if(_0x50a2bf>=_0x1fadbe){_0x50a2bf=_0x1fadbe;_0xd62754=0xc8;}else{_0xd62754=0xce;}_0x24e6bb[_0x03e9('0x29')](_0xd62754);return _0x24e6bb['set'](_0x03e9('0x30'),_0x1a441d+'-'+_0x50a2bf+'/'+_0x1fadbe)[_0x03e9('0x2b')](_0x13150d);}return null;};}function patchUpdates(_0x139ad0){return function(_0xc11e66){try{jsonpatch[_0x03e9('0x31')](_0xc11e66,_0x139ad0,!![]);}catch(_0x20fa63){return BPromise[_0x03e9('0x32')](_0x20fa63);}return _0xc11e66[_0x03e9('0x33')]();};}function saveUpdates(_0x5e3ce6,_0x47b0c3){return function(_0x2f36ec){if(_0x2f36ec){return _0x2f36ec[_0x03e9('0x34')](_0x5e3ce6)[_0x03e9('0x1f')](function(_0x2bb373){return _0x2bb373;});}return null;};}function removeEntity(_0x5cde5c,_0x62c9fb){return function(_0x4f0aca){if(_0x4f0aca){return _0x4f0aca[_0x03e9('0x35')]()[_0x03e9('0x1f')](function(){_0x5cde5c['status'](0xcc)[_0x03e9('0x2a')]();});}};}function handleEntityNotFound(_0x3273d5,_0x120af8){return function(_0x115ba1){if(!_0x115ba1){_0x3273d5[_0x03e9('0x28')](0x194);}return _0x115ba1;};}function handleError(_0x597165,_0x4afc46){_0x4afc46=_0x4afc46||0x1f4;return function(_0x3a02fb){logger[_0x03e9('0x25')](_0x3a02fb[_0x03e9('0x36')]);if(_0x3a02fb['name']){delete _0x3a02fb[_0x03e9('0x37')];}_0x597165[_0x03e9('0x29')](_0x4afc46)[_0x03e9('0x38')](_0x3a02fb);};}exports[_0x03e9('0x39')]=function(_0x3520cc,_0x2cdf6b){var _0x2137e1={},_0x25bdba={},_0x12f094={'count':0x0,'rows':[]};var _0x162ac3=_[_0x03e9('0x3a')](db['ChatMessage'][_0x03e9('0x3b')],function(_0xce94fb){return{'name':_0xce94fb[_0x03e9('0x3c')],'type':_0xce94fb[_0x03e9('0x3d')][_0x03e9('0x3e')]};});_0x25bdba[_0x03e9('0x3f')]=_[_0x03e9('0x3a')](_0x162ac3,_0x03e9('0x37'));_0x25bdba['query']=_[_0x03e9('0x40')](_0x3520cc['query']);_0x25bdba[_0x03e9('0x41')]=_[_0x03e9('0x42')](_0x25bdba[_0x03e9('0x3f')],_0x25bdba[_0x03e9('0x43')]);_0x2137e1[_0x03e9('0x44')]=_['intersection'](_0x25bdba[_0x03e9('0x3f')],qs[_0x03e9('0x45')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x45')]));_0x2137e1[_0x03e9('0x44')]=_0x2137e1['attributes'][_0x03e9('0x46')]?_0x2137e1[_0x03e9('0x44')]:_0x25bdba[_0x03e9('0x3f')];if(!_0x3520cc[_0x03e9('0x43')][_0x03e9('0x47')](_0x03e9('0x48'))){_0x2137e1['limit']=qs[_0x03e9('0x2e')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x2e')]);_0x2137e1[_0x03e9('0x2c')]=qs[_0x03e9('0x2c')](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x2c')]);}_0x2137e1['order']=qs['sort'](_0x3520cc[_0x03e9('0x43')][_0x03e9('0x49')]);_0x2137e1[_0x03e9('0x4a')]=qs[_0x03e9('0x41')](_[_0x03e9('0x4b')](_0x3520cc[_0x03e9('0x43')],_0x25bdba[_0x03e9('0x41')]),_0x162ac3);if(_0x3520cc[_0x03e9('0x43')][_0x03e9('0x4c')]){_0x2137e1[_0x03e9('0x4a')]=_[_0x03e9('0x4d')](_0x2137e1[_0x03e9('0x4a')],{'$or':_[_0x03e9('0x3a')](_0x162ac3,function(_0x38d3b7){if(_0x38d3b7[_0x03e9('0x3d')]!==_0x03e9('0x4e')){var _0x4f5a0f={};_0x4f5a0f[_0x38d3b7['name']]={'$like':'%'+_0x3520cc[_0x03e9('0x43')][_0x03e9('0x4c')]+'%'};return _0x4f5a0f;}})});}_0x2137e1=_['merge']({},_0x2137e1,_0x3520cc[_0x03e9('0x4f')]);var _0x118af2={'where':_0x2137e1['where']};return db[_0x03e9('0x50')]['count'](_0x118af2)[_0x03e9('0x1f')](function(_0x18071a){_0x12f094['count']=_0x18071a;if(_0x3520cc[_0x03e9('0x43')]['includeAll']){_0x2137e1['include']=[{'all':!![]}];}return db[_0x03e9('0x50')][_0x03e9('0x51')](_0x2137e1);})[_0x03e9('0x1f')](function(_0x352755){_0x12f094[_0x03e9('0x52')]=_0x352755;return _0x12f094;})[_0x03e9('0x1f')](respondWithFilteredResult(_0x2cdf6b,_0x2137e1))[_0x03e9('0x27')](handleError(_0x2cdf6b,null));};exports['show']=function(_0x497372,_0x157295){var _0x49c815={'raw':!![],'where':{'id':_0x497372[_0x03e9('0x53')]['id']}},_0x219b7a={};_0x219b7a[_0x03e9('0x3f')]=_[_0x03e9('0x40')](db[_0x03e9('0x50')][_0x03e9('0x3b')]);_0x219b7a[_0x03e9('0x43')]=_[_0x03e9('0x40')](_0x497372[_0x03e9('0x43')]);_0x219b7a['filters']=_['intersection'](_0x219b7a['model'],_0x219b7a[_0x03e9('0x43')]);_0x49c815['attributes']=_[_0x03e9('0x42')](_0x219b7a[_0x03e9('0x3f')],qs[_0x03e9('0x45')](_0x497372[_0x03e9('0x43')]['fields']));_0x49c815[_0x03e9('0x44')]=_0x49c815['attributes'][_0x03e9('0x46')]?_0x49c815[_0x03e9('0x44')]:_0x219b7a['model'];if(_0x497372[_0x03e9('0x43')][_0x03e9('0x54')]){_0x49c815['include']=[{'all':!![]}];}_0x49c815=_['merge']({},_0x49c815,_0x497372[_0x03e9('0x4f')]);return db['ChatMessage'][_0x03e9('0x55')](_0x49c815)[_0x03e9('0x1f')](handleEntityNotFound(_0x157295,null))[_0x03e9('0x1f')](respondWithResult(_0x157295,null))[_0x03e9('0x27')](handleError(_0x157295,null));};exports[_0x03e9('0x56')]=function(_0x5eb138,_0x4f9506){return db['ChatMessage'][_0x03e9('0x56')](_0x5eb138[_0x03e9('0x57')],{})[_0x03e9('0x1f')](respondWithResult(_0x4f9506,0xc9))[_0x03e9('0x27')](handleError(_0x4f9506,null));};exports[_0x03e9('0x34')]=function(_0x318d33,_0x458ae8){if(_0x318d33[_0x03e9('0x57')]['id']){delete _0x318d33[_0x03e9('0x57')]['id'];}return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0x318d33['params']['id']}})[_0x03e9('0x1f')](handleEntityNotFound(_0x458ae8,null))[_0x03e9('0x1f')](saveUpdates(_0x318d33[_0x03e9('0x57')],null))[_0x03e9('0x1f')](respondWithResult(_0x458ae8,null))[_0x03e9('0x27')](handleError(_0x458ae8,null));};exports[_0x03e9('0x35')]=function(_0xad2d81,_0x3eac88){return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0xad2d81['params']['id']}})[_0x03e9('0x1f')](handleEntityNotFound(_0x3eac88,null))[_0x03e9('0x1f')](removeEntity(_0x3eac88,null))[_0x03e9('0x27')](handleError(_0x3eac88,null));};exports[_0x03e9('0x58')]=function(_0x124c8e,_0x31cd95){return db[_0x03e9('0x50')][_0x03e9('0x58')]()['then'](respondWithResult(_0x31cd95,null))[_0x03e9('0x27')](handleError(_0x31cd95,null));};var interaction_log=require(_0x03e9('0x14'))(_0x03e9('0x59'));exports[_0x03e9('0x5a')]=function(_0x476316,_0x27709c,_0x40c3e8){var _0x2403f0={'agent':{},'channel':'chat'};if(_0x476316[_0x03e9('0x57')]['id']){delete _0x476316[_0x03e9('0x57')]['id'];}_0x476316[_0x03e9('0x57')][_0x03e9('0x5b')]=!![];_0x476316[_0x03e9('0x57')][_0x03e9('0x5c')]=moment()[_0x03e9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')]=_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')]||_0x476316[_0x03e9('0x5f')]['id'];_0x2403f0[_0x03e9('0x60')]['id']=_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')];return db[_0x03e9('0x50')][_0x03e9('0x55')]({'where':{'id':_0x476316[_0x03e9('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27709c,null))['then'](saveUpdates(_0x476316['body'],null))[_0x03e9('0x1f')](function(_0x361ed1){if(_0x361ed1){_0x2403f0[_0x03e9('0x26')]=_0x361ed1['get']({'plain':!![]});return db['ChatInteraction'][_0x03e9('0x55')]({'where':{'id':_0x361ed1[_0x03e9('0x61')]}});}return null;})[_0x03e9('0x1f')](handleEntityNotFound(_0x27709c,null))[_0x03e9('0x1f')](function(_0x425027){if(_0x425027){return _0x425027['update']({'UserId':_0x476316['body'][_0x03e9('0x5e')],'read1stAt':_[_0x03e9('0x62')](_0x425027[_0x03e9('0x63')])?moment()[_0x03e9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x03e9('0x1f')](function(_0x3d36d3){if(_0x3d36d3){_0x2403f0[_0x03e9('0x64')]=_0x3d36d3['get']({'plain':!![]});interaction_log[_0x03e9('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x476316[_0x03e9('0x5f')]['id'],_0x476316[_0x03e9('0x5f')]['name'],_0x476316[_0x03e9('0x5f')]['role'],_0x2403f0[_0x03e9('0x64')]['id'],_0x476316['body']?JSON[_0x03e9('0x65')](_0x476316[_0x03e9('0x57')]):_0x03e9('0x66'));return respondWithRpcPromise(_0x03e9('0x67'),_0x03e9('0x68'),_0x2403f0);}return null;})[_0x03e9('0x1f')](function(_0x42d07f){var _0x447d54=_0x03e9('0x69')+_0x42d07f[_0x03e9('0x26')][_0x03e9('0x6a')];return db['sequelize'][_0x03e9('0x43')](_0x447d54,{'type':db[_0x03e9('0x6b')][_0x03e9('0x6c')][_0x03e9('0x6d')],'raw':!![]})[_0x03e9('0x1f')](function(_0x58d27a){return _0x58d27a;});})['then'](function(_0x603f02){if(_0x603f02){_0x2403f0[_0x03e9('0x26')][_0x03e9('0x6e')]=_0x603f02[0x0];if(!_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')])return;return db['User'][_0x03e9('0x55')]({'where':{'id':_0x476316[_0x03e9('0x57')][_0x03e9('0x5e')],'role':_0x03e9('0x60')},'attributes':['id',_0x03e9('0x37'),_0x03e9('0x6f'),_0x03e9('0x70'),_0x03e9('0x71')],'raw':!![]});}return null;})[_0x03e9('0x1f')](function(_0x5add66){if(!_0x5add66)return null;_0x2403f0[_0x03e9('0x26')][_0x03e9('0x60')]=_0x5add66;return _0x2403f0;})[_0x03e9('0x1f')](function(_0x1ca915){if(_0x1ca915){if(_0x476316[_0x03e9('0x57')][_0x03e9('0x72')]){_0x2403f0[_0x03e9('0x26')]['interface']=util[_0x03e9('0x5d')]('SIP/%s',_0x476316['user'][_0x03e9('0x37')]);_0x2403f0[_0x03e9('0x26')][_0x03e9('0x73')]=_0x2403f0[_0x03e9('0x73')];_0x2403f0[_0x03e9('0x26')]['motionChannel']=_0x2403f0[_0x03e9('0x73')];_0x2403f0[_0x03e9('0x26')][_0x03e9('0x74')]=_0x03e9('0x5a');return respondWithRpcPromise('EventManager',_0x03e9('0x75'),{'event':_0x03e9('0x76'),'message':_['merge'](_0x2403f0['message'],JSON[_0x03e9('0x77')](_0x2403f0[_0x03e9('0x64')][_0x03e9('0x78')]))},client9002)[_0x03e9('0x1f')](function(){return _0x2403f0;});}return _0x2403f0;}return null;})[_0x03e9('0x1f')](respondWithResult(_0x27709c,null))[_0x03e9('0x27')](handleError(_0x27709c,null));};var interaction_log=require(_0x03e9('0x14'))(_0x03e9('0x59'));exports[_0x03e9('0x32')]=function(_0x22502a,_0x28f453,_0xe8e12b){var _0x4bac9a={'agent':{},'channel':_0x03e9('0x79')};if(_0x22502a[_0x03e9('0x57')]['id']){delete _0x22502a[_0x03e9('0x57')]['id'];}_0x22502a['body'][_0x03e9('0x5e')]=_0x22502a['body'][_0x03e9('0x5e')]||_0x22502a[_0x03e9('0x5f')]['id'];_0x4bac9a['agent']['id']=_0x22502a[_0x03e9('0x57')]['UserId'];return db['ChatMessage'][_0x03e9('0x55')]({'where':{'id':_0x22502a['params']['id'],'UserId':null}})[_0x03e9('0x1f')](handleEntityNotFound(_0x28f453,null))['then'](function(_0xcea1e3){if(_0xcea1e3){_0x4bac9a['message']=_0xcea1e3['get']({'plain':!![]});return db['ChatInteraction'][_0x03e9('0x55')]({'where':{'id':_0xcea1e3[_0x03e9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x28f453,null))[_0x03e9('0x1f')](function(_0x1c5e2f){if(_0x1c5e2f){_0x4bac9a['interaction']=_0x1c5e2f[_0x03e9('0x7a')]({'plain':!![]});interaction_log[_0x03e9('0x20')](_0x03e9('0x7b'),_0x22502a[_0x03e9('0x5f')]['id'],_0x22502a[_0x03e9('0x5f')]['name'],_0x22502a[_0x03e9('0x5f')][_0x03e9('0x7c')],_0x4bac9a['interaction']['id'],_0x22502a[_0x03e9('0x57')]?JSON[_0x03e9('0x65')](_0x22502a[_0x03e9('0x57')]):_0x03e9('0x66'));return respondWithRpcPromise('RejectMessage',_0x03e9('0x7d'),_0x4bac9a);}return null;})[_0x03e9('0x1f')](function(_0x565552){var _0x47c5ec='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x565552[_0x03e9('0x26')]['ContactId'];return db[_0x03e9('0x7e')][_0x03e9('0x43')](_0x47c5ec,{'type':db[_0x03e9('0x6b')]['QueryTypes'][_0x03e9('0x6d')],'raw':!![]})[_0x03e9('0x1f')](function(_0x1835ef){return _0x1835ef;});})['then'](function(_0x44042f){if(_0x44042f){_0x4bac9a[_0x03e9('0x26')][_0x03e9('0x6e')]=_0x44042f[0x0];if(!_0x22502a[_0x03e9('0x57')][_0x03e9('0x5e')])return;return db['User'][_0x03e9('0x55')]({'where':{'id':_0x22502a[_0x03e9('0x57')]['UserId'],'role':_0x03e9('0x60')},'attributes':['id','name',_0x03e9('0x6f'),_0x03e9('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x6f1b0b){if(!_0x6f1b0b)return null;_0x4bac9a[_0x03e9('0x26')]['agent']=_0x6f1b0b;return _0x4bac9a;})[_0x03e9('0x1f')](function(_0x563066){if(_0x563066){_0x563066[_0x03e9('0x26')][_0x03e9('0x7f')]=util[_0x03e9('0x5d')](_0x03e9('0x80'),_0x22502a[_0x03e9('0x5f')][_0x03e9('0x37')]);_0x563066[_0x03e9('0x26')][_0x03e9('0x73')]=_0x4bac9a[_0x03e9('0x73')];_0x563066[_0x03e9('0x26')][_0x03e9('0x81')]=_0x4bac9a[_0x03e9('0x73')];_0x563066[_0x03e9('0x26')][_0x03e9('0x74')]=_0x03e9('0x32');respondWithRpcPromise(_0x03e9('0x75'),_0x03e9('0x75'),{'event':_0x03e9('0x82'),'message':_[_0x03e9('0x4d')](_0x4bac9a['message'],JSON[_0x03e9('0x77')](_0x4bac9a[_0x03e9('0x64')][_0x03e9('0x78')]))},client9002);return _0x4bac9a;}return null;})[_0x03e9('0x1f')](respondWithResult(_0x28f453,null))['catch'](handleError(_0x28f453,null));}; \ No newline at end of file +var _0xa2d4=['count','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','index','map','ChatMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','chat','get','rejectMessage','QueryTypes','contact','interface','rejectmessage','parse','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','ChatMessage,\x20%s,\x20%s','message','result','status','offset','undefined','limit'];(function(_0x5890ed,_0x5eec7c){var _0x49ef9b=function(_0x3d68eb){while(--_0x3d68eb){_0x5890ed['push'](_0x5890ed['shift']());}};_0x49ef9b(++_0x5eec7c);}(_0xa2d4,0x159));var _0x4a2d=function(_0x3f1c5a,_0x388a1b){_0x3f1c5a=_0x3f1c5a-0x0;var _0x395b16=_0xa2d4[_0x3f1c5a];return _0x395b16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a2d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a2d('0x1'));var rp=require(_0x4a2d('0x2'));var moment=require(_0x4a2d('0x3'));var BPromise=require(_0x4a2d('0x4'));var Mustache=require(_0x4a2d('0x5'));var util=require(_0x4a2d('0x6'));var path=require(_0x4a2d('0x7'));var sox=require(_0x4a2d('0x8'));var csv=require(_0x4a2d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a2d('0xa'));var _=require(_0x4a2d('0xb'));var squel=require(_0x4a2d('0xc'));var crypto=require(_0x4a2d('0xd'));var jsforce=require(_0x4a2d('0xe'));var deskjs=require(_0x4a2d('0xf'));var toCsv=require(_0x4a2d('0x9'));var querystring=require('querystring');var Papa=require(_0x4a2d('0x10'));var Redis=require(_0x4a2d('0x11'));var authService=require(_0x4a2d('0x12'));var qs=require(_0x4a2d('0x13'));var as=require(_0x4a2d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a2d('0x15'))('api');var utils=require(_0x4a2d('0x16'));var config=require(_0x4a2d('0x17'));var licenseUtil=require(_0x4a2d('0x18'));var db=require(_0x4a2d('0x19'))['db'];config[_0x4a2d('0x1a')]=_['defaults'](config[_0x4a2d('0x1a')],{'host':_0x4a2d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a2d('0x1a')]));require(_0x4a2d('0x1c'))['register'](socket);var jayson=require(_0x4a2d('0x1d'));var client=jayson[_0x4a2d('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5546a9,_0x5a0ebe,_0x3de0a7,_0x3c8174){return new BPromise(function(_0x5abdd2,_0x36e75e){var _0x1d0248=_0x3c8174||client;return _0x1d0248[_0x4a2d('0x1f')](_0x5546a9,_0x3de0a7)[_0x4a2d('0x20')](function(_0x3bacab){logger[_0x4a2d('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5a0ebe,_0x4a2d('0x22'));logger[_0x4a2d('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5a0ebe,_0x4a2d('0x22'),JSON['stringify'](_0x3bacab));if(_0x3bacab['error']){if(_0x3bacab[_0x4a2d('0x24')][_0x4a2d('0x25')]===0x1f4){logger['error'](_0x4a2d('0x26'),_0x5a0ebe,_0x3bacab['error'][_0x4a2d('0x27')]);return _0x36e75e(_0x3bacab[_0x4a2d('0x24')][_0x4a2d('0x27')]);}logger[_0x4a2d('0x24')](_0x4a2d('0x26'),_0x5a0ebe,_0x3bacab[_0x4a2d('0x24')][_0x4a2d('0x27')]);return _0x5abdd2(_0x3bacab[_0x4a2d('0x24')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5a0ebe,'request\x20sent');_0x5abdd2(_0x3bacab[_0x4a2d('0x28')][_0x4a2d('0x27')]);}})['catch'](function(_0x35510a){logger[_0x4a2d('0x24')](_0x4a2d('0x26'),_0x5a0ebe,_0x35510a);_0x36e75e(_0x35510a);});});}function respondWithStatusCode(_0x73e2d4,_0x14496b){_0x14496b=_0x14496b||0xcc;return function(_0x3114ed){if(_0x3114ed){return _0x73e2d4['sendStatus'](_0x14496b);}return _0x73e2d4[_0x4a2d('0x29')](_0x14496b)['end']();};}function respondWithResult(_0x5cc051,_0x59ed27){_0x59ed27=_0x59ed27||0xc8;return function(_0x56d63d){if(_0x56d63d){return _0x5cc051[_0x4a2d('0x29')](_0x59ed27)['json'](_0x56d63d);}};}function respondWithFilteredResult(_0x1981c3,_0x2786fc){return function(_0x370d61){if(_0x370d61){var _0x79dabd=typeof _0x2786fc[_0x4a2d('0x2a')]===_0x4a2d('0x2b')&&typeof _0x2786fc[_0x4a2d('0x2c')]===_0x4a2d('0x2b');var _0x4f7587=_0x370d61[_0x4a2d('0x2d')];var _0x3f7b68=_0x79dabd?0x0:_0x2786fc['offset'];var _0x2937b9=_0x79dabd?_0x370d61[_0x4a2d('0x2d')]:_0x2786fc[_0x4a2d('0x2a')]+_0x2786fc['limit'];var _0x1c2e19;if(_0x2937b9>=_0x4f7587){_0x2937b9=_0x4f7587;_0x1c2e19=0xc8;}else{_0x1c2e19=0xce;}_0x1981c3[_0x4a2d('0x29')](_0x1c2e19);return _0x1981c3[_0x4a2d('0x2e')](_0x4a2d('0x2f'),_0x3f7b68+'-'+_0x2937b9+'/'+_0x4f7587)['json'](_0x370d61);}return null;};}function patchUpdates(_0xe26245){return function(_0x4c0cd7){try{jsonpatch['apply'](_0x4c0cd7,_0xe26245,!![]);}catch(_0x4e34e7){return BPromise[_0x4a2d('0x30')](_0x4e34e7);}return _0x4c0cd7[_0x4a2d('0x31')]();};}function saveUpdates(_0x578f75,_0x524125){return function(_0x477e0a){if(_0x477e0a){return _0x477e0a[_0x4a2d('0x32')](_0x578f75)['then'](function(_0x13319f){return _0x13319f;});}return null;};}function removeEntity(_0x239938,_0x61b054){return function(_0x44b20e){if(_0x44b20e){return _0x44b20e[_0x4a2d('0x33')]()['then'](function(){_0x239938[_0x4a2d('0x29')](0xcc)[_0x4a2d('0x34')]();});}};}function handleEntityNotFound(_0x4a33bf,_0x25750d){return function(_0x3fc615){if(!_0x3fc615){_0x4a33bf[_0x4a2d('0x35')](0x194);}return _0x3fc615;};}function handleError(_0x3bdc45,_0x2b62f2){_0x2b62f2=_0x2b62f2||0x1f4;return function(_0xac5860){logger[_0x4a2d('0x24')](_0xac5860[_0x4a2d('0x36')]);if(_0xac5860['name']){delete _0xac5860[_0x4a2d('0x37')];}_0x3bdc45['status'](_0x2b62f2)['send'](_0xac5860);};}exports[_0x4a2d('0x38')]=function(_0x2d9449,_0x429615){var _0x2e749c={},_0x289552={},_0x1e760c={'count':0x0,'rows':[]};var _0x216f5e=_[_0x4a2d('0x39')](db[_0x4a2d('0x3a')][_0x4a2d('0x3b')],function(_0x1380ff){return{'name':_0x1380ff['fieldName'],'type':_0x1380ff[_0x4a2d('0x3c')][_0x4a2d('0x3d')]};});_0x289552[_0x4a2d('0x3e')]=_[_0x4a2d('0x39')](_0x216f5e,'name');_0x289552[_0x4a2d('0x3f')]=_['keys'](_0x2d9449[_0x4a2d('0x3f')]);_0x289552[_0x4a2d('0x40')]=_[_0x4a2d('0x41')](_0x289552[_0x4a2d('0x3e')],_0x289552[_0x4a2d('0x3f')]);_0x2e749c[_0x4a2d('0x42')]=_[_0x4a2d('0x41')](_0x289552[_0x4a2d('0x3e')],qs[_0x4a2d('0x43')](_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x43')]));_0x2e749c[_0x4a2d('0x42')]=_0x2e749c[_0x4a2d('0x42')][_0x4a2d('0x44')]?_0x2e749c['attributes']:_0x289552[_0x4a2d('0x3e')];if(!_0x2d9449[_0x4a2d('0x3f')]['hasOwnProperty'](_0x4a2d('0x45'))){_0x2e749c[_0x4a2d('0x2c')]=qs[_0x4a2d('0x2c')](_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x2c')]);_0x2e749c[_0x4a2d('0x2a')]=qs[_0x4a2d('0x2a')](_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x2a')]);}_0x2e749c[_0x4a2d('0x46')]=qs['sort'](_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x47')]);_0x2e749c[_0x4a2d('0x48')]=qs[_0x4a2d('0x40')](_[_0x4a2d('0x49')](_0x2d9449[_0x4a2d('0x3f')],_0x289552[_0x4a2d('0x40')]),_0x216f5e);if(_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x4a')]){_0x2e749c[_0x4a2d('0x48')]=_[_0x4a2d('0x4b')](_0x2e749c[_0x4a2d('0x48')],{'$or':_[_0x4a2d('0x39')](_0x216f5e,function(_0x5f2850){if(_0x5f2850[_0x4a2d('0x3c')]!==_0x4a2d('0x4c')){var _0x39a45f={};_0x39a45f[_0x5f2850['name']]={'$like':'%'+_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x4a')]+'%'};return _0x39a45f;}})});}_0x2e749c=_[_0x4a2d('0x4b')]({},_0x2e749c,_0x2d9449[_0x4a2d('0x4d')]);var _0x27cdfe={'where':_0x2e749c[_0x4a2d('0x48')]};return db[_0x4a2d('0x3a')][_0x4a2d('0x2d')](_0x27cdfe)[_0x4a2d('0x20')](function(_0x3515e5){_0x1e760c['count']=_0x3515e5;if(_0x2d9449[_0x4a2d('0x3f')][_0x4a2d('0x4e')]){_0x2e749c[_0x4a2d('0x4f')]=[{'all':!![]}];}return db[_0x4a2d('0x3a')][_0x4a2d('0x50')](_0x2e749c);})[_0x4a2d('0x20')](function(_0x35b944){_0x1e760c[_0x4a2d('0x51')]=_0x35b944;return _0x1e760c;})['then'](respondWithFilteredResult(_0x429615,_0x2e749c))[_0x4a2d('0x52')](handleError(_0x429615,null));};exports[_0x4a2d('0x53')]=function(_0x1fd144,_0x45c710){var _0x1030a6={'raw':!![],'where':{'id':_0x1fd144[_0x4a2d('0x54')]['id']}},_0x3f48f1={};_0x3f48f1['model']=_[_0x4a2d('0x55')](db[_0x4a2d('0x3a')]['rawAttributes']);_0x3f48f1[_0x4a2d('0x3f')]=_['keys'](_0x1fd144[_0x4a2d('0x3f')]);_0x3f48f1[_0x4a2d('0x40')]=_['intersection'](_0x3f48f1[_0x4a2d('0x3e')],_0x3f48f1[_0x4a2d('0x3f')]);_0x1030a6[_0x4a2d('0x42')]=_[_0x4a2d('0x41')](_0x3f48f1['model'],qs[_0x4a2d('0x43')](_0x1fd144[_0x4a2d('0x3f')]['fields']));_0x1030a6[_0x4a2d('0x42')]=_0x1030a6['attributes'][_0x4a2d('0x44')]?_0x1030a6[_0x4a2d('0x42')]:_0x3f48f1[_0x4a2d('0x3e')];if(_0x1fd144['query'][_0x4a2d('0x4e')]){_0x1030a6['include']=[{'all':!![]}];}_0x1030a6=_[_0x4a2d('0x4b')]({},_0x1030a6,_0x1fd144['options']);return db[_0x4a2d('0x3a')][_0x4a2d('0x56')](_0x1030a6)['then'](handleEntityNotFound(_0x45c710,null))[_0x4a2d('0x20')](respondWithResult(_0x45c710,null))[_0x4a2d('0x52')](handleError(_0x45c710,null));};exports[_0x4a2d('0x57')]=function(_0x2b6306,_0x1e7efb){return db[_0x4a2d('0x3a')][_0x4a2d('0x57')](_0x2b6306[_0x4a2d('0x58')],{})[_0x4a2d('0x20')](respondWithResult(_0x1e7efb,0xc9))[_0x4a2d('0x52')](handleError(_0x1e7efb,null));};exports['update']=function(_0x4d5b47,_0x42f533){if(_0x4d5b47[_0x4a2d('0x58')]['id']){delete _0x4d5b47['body']['id'];}return db[_0x4a2d('0x3a')][_0x4a2d('0x56')]({'where':{'id':_0x4d5b47[_0x4a2d('0x54')]['id']}})[_0x4a2d('0x20')](handleEntityNotFound(_0x42f533,null))[_0x4a2d('0x20')](saveUpdates(_0x4d5b47[_0x4a2d('0x58')],null))[_0x4a2d('0x20')](respondWithResult(_0x42f533,null))[_0x4a2d('0x52')](handleError(_0x42f533,null));};exports[_0x4a2d('0x33')]=function(_0x347079,_0x5e7b9c){return db[_0x4a2d('0x3a')][_0x4a2d('0x56')]({'where':{'id':_0x347079[_0x4a2d('0x54')]['id']}})[_0x4a2d('0x20')](handleEntityNotFound(_0x5e7b9c,null))[_0x4a2d('0x20')](removeEntity(_0x5e7b9c,null))[_0x4a2d('0x52')](handleError(_0x5e7b9c,null));};exports[_0x4a2d('0x59')]=function(_0x335785,_0x4efd90){return db[_0x4a2d('0x3a')][_0x4a2d('0x59')]()[_0x4a2d('0x20')](respondWithResult(_0x4efd90,null))[_0x4a2d('0x52')](handleError(_0x4efd90,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x4a2d('0x5a')]=function(_0x4dedc4,_0x48839b,_0x5edbf4){var _0x38ac7b={'agent':{},'channel':'chat'};if(_0x4dedc4[_0x4a2d('0x58')]['id']){delete _0x4dedc4[_0x4a2d('0x58')]['id'];}_0x4dedc4['body']['read']=!![];_0x4dedc4['body']['readAt']=moment()['format'](_0x4a2d('0x5b'));_0x4dedc4[_0x4a2d('0x58')][_0x4a2d('0x5c')]=_0x4dedc4[_0x4a2d('0x58')][_0x4a2d('0x5c')]||_0x4dedc4[_0x4a2d('0x5d')]['id'];_0x38ac7b['agent']['id']=_0x4dedc4[_0x4a2d('0x58')]['UserId'];return db[_0x4a2d('0x3a')]['find']({'where':{'id':_0x4dedc4['params']['id'],'UserId':null}})[_0x4a2d('0x20')](handleEntityNotFound(_0x48839b,null))['then'](saveUpdates(_0x4dedc4[_0x4a2d('0x58')],null))[_0x4a2d('0x20')](function(_0x1c0d07){if(_0x1c0d07){_0x38ac7b[_0x4a2d('0x27')]=_0x1c0d07['get']({'plain':!![]});return db[_0x4a2d('0x5e')][_0x4a2d('0x56')]({'where':{'id':_0x1c0d07[_0x4a2d('0x5f')]}});}return null;})[_0x4a2d('0x20')](handleEntityNotFound(_0x48839b,null))[_0x4a2d('0x20')](function(_0x2f4e1e){if(_0x2f4e1e){return _0x2f4e1e[_0x4a2d('0x32')]({'UserId':_0x4dedc4[_0x4a2d('0x58')]['UserId'],'read1stAt':_['isNil'](_0x2f4e1e['read1stAt'])?moment()[_0x4a2d('0x60')](_0x4a2d('0x5b')):undefined});}return null;})[_0x4a2d('0x20')](function(_0x5caec3){if(_0x5caec3){_0x38ac7b[_0x4a2d('0x61')]=_0x5caec3['get']({'plain':!![]});interaction_log[_0x4a2d('0x21')](_0x4a2d('0x62'),_0x4dedc4['user']['id'],_0x4dedc4[_0x4a2d('0x5d')]['name'],_0x4dedc4[_0x4a2d('0x5d')][_0x4a2d('0x63')],_0x38ac7b[_0x4a2d('0x61')]['id'],_0x4dedc4[_0x4a2d('0x58')]?JSON[_0x4a2d('0x64')](_0x4dedc4[_0x4a2d('0x58')]):_0x4a2d('0x65'));return respondWithRpcPromise(_0x4a2d('0x66'),_0x4a2d('0x67'),_0x38ac7b);}return null;})[_0x4a2d('0x20')](function(_0x308600){var _0x23ea47=_0x4a2d('0x68')+_0x308600['message'][_0x4a2d('0x69')];return db[_0x4a2d('0x6a')][_0x4a2d('0x3f')](_0x23ea47,{'type':db[_0x4a2d('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x50bb35){return _0x50bb35;});})[_0x4a2d('0x20')](function(_0x5efa06){if(_0x5efa06){_0x38ac7b[_0x4a2d('0x27')]['contact']=_0x5efa06[0x0];if(!_0x4dedc4[_0x4a2d('0x58')]['UserId'])return;return db[_0x4a2d('0x6c')][_0x4a2d('0x56')]({'where':{'id':_0x4dedc4[_0x4a2d('0x58')][_0x4a2d('0x5c')],'role':_0x4a2d('0x6d')},'attributes':['id',_0x4a2d('0x37'),_0x4a2d('0x6e'),_0x4a2d('0x6f'),_0x4a2d('0x70')],'raw':!![]});}return null;})[_0x4a2d('0x20')](function(_0x42490a){if(!_0x42490a)return null;_0x38ac7b[_0x4a2d('0x27')]['agent']=_0x42490a;return _0x38ac7b;})[_0x4a2d('0x20')](function(_0x27ca96){if(_0x27ca96){if(_0x4dedc4[_0x4a2d('0x58')][_0x4a2d('0x71')]){_0x38ac7b[_0x4a2d('0x27')]['interface']=util[_0x4a2d('0x60')](_0x4a2d('0x72'),_0x4dedc4[_0x4a2d('0x5d')][_0x4a2d('0x37')]);_0x38ac7b['message'][_0x4a2d('0x73')]=_0x38ac7b[_0x4a2d('0x73')];_0x38ac7b[_0x4a2d('0x27')][_0x4a2d('0x74')]=_0x38ac7b['channel'];_0x38ac7b['message'][_0x4a2d('0x75')]=_0x4a2d('0x5a');return respondWithRpcPromise(_0x4a2d('0x76'),_0x4a2d('0x76'),{'event':_0x4a2d('0x77'),'message':_[_0x4a2d('0x4b')](_0x38ac7b[_0x4a2d('0x27')],JSON['parse'](_0x38ac7b['interaction'][_0x4a2d('0x78')]))},client9002)['then'](function(){return _0x38ac7b;});}return _0x38ac7b;}return null;})[_0x4a2d('0x20')](respondWithResult(_0x48839b,null))[_0x4a2d('0x52')](handleError(_0x48839b,null));};var interaction_log=require(_0x4a2d('0x15'))(_0x4a2d('0x79'));exports[_0x4a2d('0x30')]=function(_0x3241ce,_0x2b77e3,_0x59f989){var _0xf34cce={'agent':{},'channel':_0x4a2d('0x7a')};if(_0x3241ce[_0x4a2d('0x58')]['id']){delete _0x3241ce[_0x4a2d('0x58')]['id'];}_0x3241ce[_0x4a2d('0x58')][_0x4a2d('0x5c')]=_0x3241ce[_0x4a2d('0x58')][_0x4a2d('0x5c')]||_0x3241ce[_0x4a2d('0x5d')]['id'];_0xf34cce['agent']['id']=_0x3241ce['body'][_0x4a2d('0x5c')];return db[_0x4a2d('0x3a')][_0x4a2d('0x56')]({'where':{'id':_0x3241ce[_0x4a2d('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b77e3,null))[_0x4a2d('0x20')](function(_0x327ca2){if(_0x327ca2){_0xf34cce['message']=_0x327ca2[_0x4a2d('0x7b')]({'plain':!![]});return db[_0x4a2d('0x5e')]['find']({'where':{'id':_0x327ca2['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2b77e3,null))['then'](function(_0x2cb244){if(_0x2cb244){_0xf34cce[_0x4a2d('0x61')]=_0x2cb244[_0x4a2d('0x7b')]({'plain':!![]});interaction_log[_0x4a2d('0x21')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3241ce['user']['id'],_0x3241ce[_0x4a2d('0x5d')][_0x4a2d('0x37')],_0x3241ce[_0x4a2d('0x5d')][_0x4a2d('0x63')],_0xf34cce[_0x4a2d('0x61')]['id'],_0x3241ce[_0x4a2d('0x58')]?JSON[_0x4a2d('0x64')](_0x3241ce[_0x4a2d('0x58')]):_0x4a2d('0x65'));return respondWithRpcPromise('RejectMessage',_0x4a2d('0x7c'),_0xf34cce);}return null;})[_0x4a2d('0x20')](function(_0x2e6184){var _0x3cccfa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e6184[_0x4a2d('0x27')][_0x4a2d('0x69')];return db[_0x4a2d('0x6a')][_0x4a2d('0x3f')](_0x3cccfa,{'type':db['Sequelize'][_0x4a2d('0x7d')]['SELECT'],'raw':!![]})['then'](function(_0x1e3da4){return _0x1e3da4;});})[_0x4a2d('0x20')](function(_0x788d70){if(_0x788d70){_0xf34cce[_0x4a2d('0x27')][_0x4a2d('0x7e')]=_0x788d70[0x0];if(!_0x3241ce[_0x4a2d('0x58')][_0x4a2d('0x5c')])return;return db['User'][_0x4a2d('0x56')]({'where':{'id':_0x3241ce[_0x4a2d('0x58')][_0x4a2d('0x5c')],'role':_0x4a2d('0x6d')},'attributes':['id',_0x4a2d('0x37'),_0x4a2d('0x6e'),_0x4a2d('0x6f'),'internal'],'raw':!![]});}return null;})[_0x4a2d('0x20')](function(_0x39f650){if(!_0x39f650)return null;_0xf34cce[_0x4a2d('0x27')][_0x4a2d('0x6d')]=_0x39f650;return _0xf34cce;})['then'](function(_0x2cffda){if(_0x2cffda){_0x2cffda[_0x4a2d('0x27')][_0x4a2d('0x7f')]=util[_0x4a2d('0x60')]('SIP/%s',_0x3241ce[_0x4a2d('0x5d')][_0x4a2d('0x37')]);_0x2cffda['message'][_0x4a2d('0x73')]=_0xf34cce[_0x4a2d('0x73')];_0x2cffda['message'][_0x4a2d('0x74')]=_0xf34cce[_0x4a2d('0x73')];_0x2cffda[_0x4a2d('0x27')][_0x4a2d('0x75')]=_0x4a2d('0x30');respondWithRpcPromise(_0x4a2d('0x76'),_0x4a2d('0x76'),{'event':_0x4a2d('0x80'),'message':_[_0x4a2d('0x4b')](_0xf34cce['message'],JSON[_0x4a2d('0x81')](_0xf34cce[_0x4a2d('0x61')][_0x4a2d('0x78')]))},client9002);return _0xf34cce;}return null;})['then'](respondWithResult(_0x2b77e3,null))[_0x4a2d('0x52')](handleError(_0x2b77e3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 67d27bd..e21d8de 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe8d=['save','update','remove','emit','hook','exports','events','ChatMessage','setMaxListeners'];(function(_0x45b28e,_0x2f0198){var _0x4e5c9f=function(_0x54de6f){while(--_0x54de6f){_0x45b28e['push'](_0x45b28e['shift']());}};_0x4e5c9f(++_0x2f0198);}(_0xfe8d,0x9f));var _0xdfe8=function(_0x283ec6,_0x219a59){_0x283ec6=_0x283ec6-0x0;var _0x312d15=_0xfe8d[_0x283ec6];return _0x312d15;};'use strict';var EventEmitter=require(_0xdfe8('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xdfe8('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xdfe8('0x2')](0x0);var events={'afterCreate':_0xdfe8('0x3'),'afterUpdate':_0xdfe8('0x4'),'afterDestroy':_0xdfe8('0x5')};function emitEvent(_0x1d4c42){return function(_0x968f1f,_0x18010b,_0x2ff5b1){ChatMessageEvents[_0xdfe8('0x6')](_0x1d4c42+':'+_0x968f1f['id'],_0x968f1f);ChatMessageEvents[_0xdfe8('0x6')](_0x1d4c42,_0x968f1f);_0x2ff5b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xdfe8('0x7')](e,emitEvent(event));}}module[_0xdfe8('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xfc35=['ChatMessage','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x301ea6,_0x202cf3){var _0x3bd1ae=function(_0xc27c01){while(--_0xc27c01){_0x301ea6['push'](_0x301ea6['shift']());}};_0x3bd1ae(++_0x202cf3);}(_0xfc35,0x146));var _0x5fc3=function(_0x3958fc,_0x2b42cd){_0x3958fc=_0x3958fc-0x0;var _0x28fd60=_0xfc35[_0x3958fc];return _0x28fd60;};'use strict';var EventEmitter=require(_0x5fc3('0x0'));var ChatMessage=require(_0x5fc3('0x1'))['db'][_0x5fc3('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5fc3('0x3')](0x0);var events={'afterCreate':_0x5fc3('0x4'),'afterUpdate':'update','afterDestroy':_0x5fc3('0x5')};function emitEvent(_0x3d0b03){return function(_0x16ca3d,_0x5343cc,_0x12a790){ChatMessageEvents[_0x5fc3('0x6')](_0x3d0b03+':'+_0x16ca3d['id'],_0x16ca3d);ChatMessageEvents['emit'](_0x3d0b03,_0x16ca3d);_0x12a790(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x5fc3('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 81adfc8..5dc2fa4 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe141=['then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x350119,_0x3db5eb){var _0x297b6e=function(_0x515def){while(--_0x515def){_0x350119['push'](_0x350119['shift']());}};_0x297b6e(++_0x3db5eb);}(_0xe141,0x17f));var _0x1e14=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xe141[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x1e14('0x0'));var util=require(_0x1e14('0x1'));var logger=require(_0x1e14('0x2'))(_0x1e14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e14('0x4'));var fs=require('fs');var path=require(_0x1e14('0x5'));var rimraf=require(_0x1e14('0x6'));var config=require(_0x1e14('0x7'));var attributes=require(_0x1e14('0x8'));module['exports']=function(_0x3ae6d4,_0x3d6b87){return _0x3ae6d4[_0x1e14('0x9')](_0x1e14('0xa'),attributes,{'tableName':_0x1e14('0xb'),'paranoid':![],'indexes':[{'name':_0x1e14('0xc'),'fields':[_0x1e14('0xd')],'type':_0x1e14('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x593cd8,_0x1e9346,_0x199eee){var _0x161be1=_0x3ae6d4[_0x1e14('0xf')];var _0x5d3fb9=_0x593cd8['get']({'plain':!![]});if(_0x5d3fb9[_0x1e14('0x10')][_0x1e14('0x11')]()==='in'||_0x5d3fb9[_0x1e14('0x10')][_0x1e14('0x11')]()==='out'&&!_0x5d3fb9['secret']&&!_[_0x1e14('0x12')](_0x5d3fb9[_0x1e14('0x13')])){_0x161be1[_0x1e14('0x14')][_0x1e14('0x15')]({'where':{'id':_0x5d3fb9[_0x1e14('0x16')]}})[_0x1e14('0x17')](function(_0x5840df){if(_0x5840df){_0x5840df[_0x1e14('0x18')]({'lastMsgAt':_0x5d3fb9[_0x1e14('0x19')],'lastMsgDirection':_0x5d3fb9['direction'][_0x1e14('0x11')]()});}})['catch'](function(_0x323a4b){console[_0x1e14('0x1a')](_0x323a4b);});}_0x199eee();}},'charset':_0x1e14('0x1b'),'collate':_0x1e14('0x1c')});}; \ No newline at end of file +var _0xa61b=['ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x2338ba,_0x3a197e){var _0x1aaac0=function(_0x4fc2d1){while(--_0x4fc2d1){_0x2338ba['push'](_0x2338ba['shift']());}};_0x1aaac0(++_0x3a197e);}(_0xa61b,0x115));var _0xba61=function(_0x2559d1,_0x35bdea){_0x2559d1=_0x2559d1-0x0;var _0x4b8ab9=_0xa61b[_0x2559d1];return _0x4b8ab9;};'use strict';var _=require(_0xba61('0x0'));var util=require(_0xba61('0x1'));var logger=require(_0xba61('0x2'))(_0xba61('0x3'));var moment=require(_0xba61('0x4'));var BPromise=require(_0xba61('0x5'));var rp=require(_0xba61('0x6'));var fs=require('fs');var path=require(_0xba61('0x7'));var rimraf=require(_0xba61('0x8'));var config=require(_0xba61('0x9'));var attributes=require('./chatMessage.attributes');module[_0xba61('0xa')]=function(_0x167f37,_0x6d12f0){return _0x167f37[_0xba61('0xb')](_0xba61('0xc'),attributes,{'tableName':_0xba61('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xba61('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a488d,_0x1f89da,_0x4e16fc){var _0x4d3f60=_0x167f37['models'];var _0x2c5a6b=_0x2a488d[_0xba61('0xf')]({'plain':!![]});if(_0x2c5a6b[_0xba61('0x10')][_0xba61('0x11')]()==='in'||_0x2c5a6b[_0xba61('0x10')][_0xba61('0x11')]()===_0xba61('0x12')&&!_0x2c5a6b[_0xba61('0x13')]&&!_[_0xba61('0x14')](_0x2c5a6b[_0xba61('0x15')])){_0x4d3f60['ChatInteraction'][_0xba61('0x16')]({'where':{'id':_0x2c5a6b[_0xba61('0x17')]}})['then'](function(_0x1f7cea){if(_0x1f7cea){_0x1f7cea[_0xba61('0x18')]({'lastMsgAt':_0x2c5a6b[_0xba61('0x19')],'lastMsgDirection':_0x2c5a6b['direction'][_0xba61('0x11')]()});}})[_0xba61('0x1a')](function(_0xe81657){console[_0xba61('0x1b')](_0xe81657);});}_0x4e16fc();}},'charset':_0xba61('0x1c'),'collate':_0xba61('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e5e50f5..2c49dbd 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc51=['info','result','catch','CreateChatMessage','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./chatMessage.socket','register','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message'];(function(_0x3f4750,_0x5ee1c7){var _0xea4b0c=function(_0xb64051){while(--_0xb64051){_0x3f4750['push'](_0x3f4750['shift']());}};_0xea4b0c(++_0x5ee1c7);}(_0xfc51,0xbb));var _0x1fc5=function(_0x1a6655,_0x2e7d78){_0x1a6655=_0x1a6655-0x0;var _0x4af9ca=_0xfc51[_0x1a6655];return _0x4af9ca;};'use strict';var _=require('lodash');var util=require(_0x1fc5('0x0'));var moment=require(_0x1fc5('0x1'));var BPromise=require(_0x1fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fc5('0x3'));var db=require(_0x1fc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fc5('0x5'))(_0x1fc5('0x6'));var config=require(_0x1fc5('0x7'));var jayson=require(_0x1fc5('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1fc5('0x9')](config[_0x1fc5('0xa')],{'host':_0x1fc5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fc5('0xa')]));require(_0x1fc5('0xc'))[_0x1fc5('0xd')](socket);function respondWithRpcPromise(_0x146708,_0x2db19c,_0xb75fa){return new BPromise(function(_0x34a96b,_0x5a0578){return client[_0x1fc5('0xe')](_0x146708,_0xb75fa)[_0x1fc5('0xf')](function(_0x3c3cf9){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2db19c,_0x1fc5('0x10'));logger[_0x1fc5('0x11')](_0x1fc5('0x12'),_0x2db19c,'request\x20sent',JSON[_0x1fc5('0x13')](_0x3c3cf9));if(_0x3c3cf9[_0x1fc5('0x14')]){if(_0x3c3cf9[_0x1fc5('0x14')]['code']===0x1f4){logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x3c3cf9[_0x1fc5('0x14')][_0x1fc5('0x16')]);return _0x5a0578(_0x3c3cf9[_0x1fc5('0x14')]['message']);}logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x3c3cf9[_0x1fc5('0x14')]['message']);return _0x34a96b(_0x3c3cf9['error'][_0x1fc5('0x16')]);}else{logger[_0x1fc5('0x17')](_0x1fc5('0x15'),_0x2db19c,_0x1fc5('0x10'));_0x34a96b(_0x3c3cf9[_0x1fc5('0x18')]['message']);}})[_0x1fc5('0x19')](function(_0x2f80d6){logger[_0x1fc5('0x14')](_0x1fc5('0x15'),_0x2db19c,_0x2f80d6);_0x5a0578(_0x2f80d6);});});}exports[_0x1fc5('0x1a')]=function(_0xedf040){var _0x44ca83=this;return new Promise(function(_0x2d9fff,_0x517e0f){return db['ChatMessage'][_0x1fc5('0x1b')](_0xedf040['body'],{'raw':_0xedf040[_0x1fc5('0x1c')]?_0xedf040[_0x1fc5('0x1c')][_0x1fc5('0x1d')]===undefined?!![]:![]:!![]})[_0x1fc5('0xf')](function(_0x554f38){logger[_0x1fc5('0x17')](_0x1fc5('0x1a'),_0xedf040);logger[_0x1fc5('0x11')](_0x1fc5('0x1a'),_0xedf040,JSON['stringify'](_0x554f38));_0x2d9fff(_0x554f38);})[_0x1fc5('0x19')](function(_0x5915e7){logger[_0x1fc5('0x14')](_0x1fc5('0x1a'),_0x5915e7[_0x1fc5('0x16')],_0xedf040);_0x517e0f(_0x44ca83['error'](0x1f4,_0x5915e7[_0x1fc5('0x16')]));});});}; \ No newline at end of file +var _0x881e=['then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatMessage','ChatMessage','create','options','raw','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./chatMessage.socket','register','request'];(function(_0x8401bf,_0x295987){var _0x3a2808=function(_0x3735b5){while(--_0x3735b5){_0x8401bf['push'](_0x8401bf['shift']());}};_0x3a2808(++_0x295987);}(_0x881e,0x1c2));var _0xe881=function(_0x398d85,_0x284b81){_0x398d85=_0x398d85-0x0;var _0x4b5faa=_0x881e[_0x398d85];return _0x4b5faa;};'use strict';var _=require(_0xe881('0x0'));var util=require('util');var moment=require(_0xe881('0x1'));var BPromise=require(_0xe881('0x2'));var rs=require(_0xe881('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe881('0x4'))['db'];var utils=require(_0xe881('0x5'));var logger=require(_0xe881('0x6'))(_0xe881('0x7'));var config=require(_0xe881('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe881('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe881('0xa')],{'host':_0xe881('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe881('0xc'))[_0xe881('0xd')](socket);function respondWithRpcPromise(_0x3a6a4f,_0x499bd3,_0x25f281){return new BPromise(function(_0x530aec,_0x30fed4){return client[_0xe881('0xe')](_0x3a6a4f,_0x25f281)[_0xe881('0xf')](function(_0x29d1d2){logger[_0xe881('0x10')](_0xe881('0x11'),_0x499bd3,_0xe881('0x12'));logger[_0xe881('0x13')](_0xe881('0x14'),_0x499bd3,_0xe881('0x12'),JSON[_0xe881('0x15')](_0x29d1d2));if(_0x29d1d2['error']){if(_0x29d1d2['error']['code']===0x1f4){logger['error'](_0xe881('0x11'),_0x499bd3,_0x29d1d2[_0xe881('0x16')][_0xe881('0x17')]);return _0x30fed4(_0x29d1d2[_0xe881('0x16')][_0xe881('0x17')]);}logger[_0xe881('0x16')](_0xe881('0x11'),_0x499bd3,_0x29d1d2[_0xe881('0x16')][_0xe881('0x17')]);return _0x530aec(_0x29d1d2[_0xe881('0x16')][_0xe881('0x17')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x499bd3,_0xe881('0x12'));_0x530aec(_0x29d1d2[_0xe881('0x18')]['message']);}})['catch'](function(_0x58d478){logger[_0xe881('0x16')](_0xe881('0x11'),_0x499bd3,_0x58d478);_0x30fed4(_0x58d478);});});}exports[_0xe881('0x19')]=function(_0x780286){var _0xbd3116=this;return new Promise(function(_0x1b8dc0,_0x2b823d){return db[_0xe881('0x1a')][_0xe881('0x1b')](_0x780286['body'],{'raw':_0x780286['options']?_0x780286[_0xe881('0x1c')][_0xe881('0x1d')]===undefined?!![]:![]:!![]})[_0xe881('0xf')](function(_0x46a277){logger[_0xe881('0x10')](_0xe881('0x19'),_0x780286);logger[_0xe881('0x13')](_0xe881('0x19'),_0x780286,JSON['stringify'](_0x46a277));_0x1b8dc0(_0x46a277);})[_0xe881('0x1e')](function(_0x19043b){logger['error']('CreateChatMessage',_0x19043b[_0xe881('0x17')],_0x780286);_0x2b823d(_0xbd3116[_0xe881('0x16')](0x1f4,_0x19043b[_0xe881('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f40bc29..302cd9c 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa23f=['save','emit','register','chatMessage:','./chatMessage.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa23f,0x7c));var _0xfa23=function(_0x583cab,_0x57c9ee){_0x583cab=_0x583cab-0x0;var _0x5178ed=_0xa23f[_0x583cab];return _0x5178ed;};'use strict';var ChatMessageEvents=require(_0xfa23('0x0'));var events=[_0xfa23('0x1'),'remove','update'];function createListener(_0xb81edf,_0x3f714c){return function(_0x1c85a9){_0x3f714c[_0xfa23('0x2')](_0xb81edf,_0x1c85a9);};}function removeListener(_0x5643b1,_0x86778e){return function(){ChatMessageEvents['removeListener'](_0x5643b1,_0x86778e);};}exports[_0xfa23('0x3')]=function(_0x2df2f5){for(var _0x4c3f4=0x0,_0x3696ef=events['length'];_0x4c3f4<_0x3696ef;_0x4c3f4++){var _0x5a7882=events[_0x4c3f4];var _0x59d53e=createListener(_0xfa23('0x4')+_0x5a7882,_0x2df2f5);ChatMessageEvents['on'](_0x5a7882,_0x59d53e);}}; \ No newline at end of file +var _0xa93e=['update','emit','removeListener','register','length','remove'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xa93e,0x1df));var _0xea93=function(_0x4eed29,_0x2abab3){_0x4eed29=_0x4eed29-0x0;var _0x163d68=_0xa93e[_0x4eed29];return _0x163d68;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xea93('0x0'),_0xea93('0x1')];function createListener(_0x47d9db,_0xd64380){return function(_0x50af65){_0xd64380[_0xea93('0x2')](_0x47d9db,_0x50af65);};}function removeListener(_0x5b5341,_0x5398ba){return function(){ChatMessageEvents[_0xea93('0x3')](_0x5b5341,_0x5398ba);};}exports[_0xea93('0x4')]=function(_0x6c6985){for(var _0x26def3=0x0,_0x477a7d=events[_0xea93('0x5')];_0x26def3<_0x477a7d;_0x26def3++){var _0x54ebdf=events[_0x26def3];var _0x12876e=createListener('chatMessage:'+_0x54ebdf,_0x6c6985);ChatMessageEvents['on'](_0x54ebdf,_0x12876e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0130d30..88b5a32 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7409=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x18c907,_0x5ec1d5){var _0xef1d9c=function(_0x5e989b){while(--_0x5e989b){_0x18c907['push'](_0x18c907['shift']());}};_0xef1d9c(++_0x5ec1d5);}(_0x7409,0x1a7));var _0x9740=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x7409[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require(_0x9740('0x2'));var timeout=require(_0x9740('0x3'));var express=require(_0x9740('0x4'));var router=express[_0x9740('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9740('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9740('0x7'));var controller=require('./chatMessage.controller');router[_0x9740('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9740('0x8')](_0x9740('0x9'),auth[_0x9740('0xa')](),controller[_0x9740('0xb')]);router[_0x9740('0x8')](_0x9740('0xc'),auth[_0x9740('0xa')](),controller[_0x9740('0xd')]);router['post']('/',auth[_0x9740('0xa')](),interaction[_0x9740('0xe')](_0x9740('0xf'),_0x9740('0x10')),controller[_0x9740('0x11')]);router[_0x9740('0x12')]('/:id',controller[_0x9740('0x13')]);router[_0x9740('0x12')](_0x9740('0x14'),auth[_0x9740('0xa')](),controller['accept']);router[_0x9740('0x12')](_0x9740('0x15'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x9740('0xc'),auth[_0x9740('0xa')](),controller['destroy']);module[_0x9740('0x16')]=router; \ No newline at end of file +var _0x0415=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','post','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x224a12,_0x386edf){var _0x506817=function(_0x1623e6){while(--_0x1623e6){_0x224a12['push'](_0x224a12['shift']());}};_0x506817(++_0x386edf);}(_0x0415,0xc5));var _0x5041=function(_0x3093a4,_0x13d353){_0x3093a4=_0x3093a4-0x0;var _0x204931=_0x0415[_0x3093a4];return _0x204931;};'use strict';var multer=require(_0x5041('0x0'));var util=require('util');var path=require(_0x5041('0x1'));var timeout=require(_0x5041('0x2'));var express=require(_0x5041('0x3'));var router=express[_0x5041('0x4')]();var fs_extra=require(_0x5041('0x5'));var auth=require(_0x5041('0x6'));var interaction=require(_0x5041('0x7'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x5041('0x8')](),controller['index']);router[_0x5041('0x9')](_0x5041('0xa'),auth[_0x5041('0x8')](),controller[_0x5041('0xb')]);router[_0x5041('0x9')](_0x5041('0xc'),auth[_0x5041('0x8')](),controller['show']);router[_0x5041('0xd')]('/',auth[_0x5041('0x8')](),interaction['tracked'](_0x5041('0xe'),_0x5041('0xf')),controller[_0x5041('0x10')]);router['put'](_0x5041('0xc'),controller['update']);router[_0x5041('0x11')](_0x5041('0x12'),auth['isAuthenticated'](),controller[_0x5041('0x13')]);router[_0x5041('0x11')](_0x5041('0x14'),auth[_0x5041('0x8')](),controller[_0x5041('0x15')]);router[_0x5041('0x16')](_0x5041('0xc'),auth[_0x5041('0x8')](),controller[_0x5041('0x17')]);module[_0x5041('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index afad223..8a6201c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x3f4157,_0x1d0ac5){var _0x4d5d1d=function(_0x4d857c){while(--_0x4d857c){_0x3f4157['push'](_0x3f4157['shift']());}};_0x4d5d1d(++_0x1d0ac5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x515df6,_0x4286cf){_0x515df6=_0x515df6-0x0;var _0x442370=_0x5f2f[_0x515df6];return _0x442370;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x141b6d,_0x5384f4){var _0x40f2b7=function(_0x51336f){while(--_0x51336f){_0x141b6d['push'](_0x141b6d['shift']());}};_0x40f2b7(++_0x5384f4);}(_0xdb28,0x106));var _0x8db2=function(_0x57ff4b,_0x17c342){_0x57ff4b=_0x57ff4b-0x0;var _0x5e86bf=_0xdb28[_0x57ff4b];return _0x5e86bf;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 90824f9..9475017 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x7a54,0x106));var _0x47a5=function(_0x316041,_0x5daa29){_0x316041=_0x316041-0x0;var _0x38640f=_0x7a54[_0x316041];return _0x38640f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5eca55,_0x37a307){var _0x4b8ae7=function(_0x383c17){while(--_0x383c17){_0x5eca55['push'](_0x5eca55['shift']());}};_0x4b8ae7(++_0x37a307);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a200767..47402be 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8ca=['emit','hasOwnProperty','hook','events','../../mysqldb','remove'];(function(_0x2a8907,_0x5df696){var _0x435f90=function(_0xe2c907){while(--_0xe2c907){_0x2a8907['push'](_0x2a8907['shift']());}};_0x435f90(++_0x5df696);}(_0xc8ca,0x1b3));var _0xac8c=function(_0x348db0,_0x103906){_0x348db0=_0x348db0-0x0;var _0x405e55=_0xc8ca[_0x348db0];return _0x405e55;};'use strict';var EventEmitter=require(_0xac8c('0x0'));var ChatOfflineMessage=require(_0xac8c('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xac8c('0x2')};function emitEvent(_0x30b008){return function(_0x5d2752,_0x393ea5,_0x22417b){ChatOfflineMessageEvents[_0xac8c('0x3')](_0x30b008+':'+_0x5d2752['id'],_0x5d2752);ChatOfflineMessageEvents['emit'](_0x30b008,_0x5d2752);_0x22417b(null);};}for(var e in events){if(events[_0xac8c('0x4')](e)){var event=events[e];ChatOfflineMessage[_0xac8c('0x5')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x79c0=['remove','emit','hasOwnProperty','exports','events','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x79c0,0x82));var _0x079c=function(_0xd73c87,_0x3ea3bb){_0xd73c87=_0xd73c87-0x0;var _0x5d0898=_0x79c0[_0xd73c87];return _0x5d0898;};'use strict';var EventEmitter=require(_0x079c('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x079c('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x079c('0x2')](0x0);var events={'afterCreate':_0x079c('0x3'),'afterUpdate':_0x079c('0x4'),'afterDestroy':_0x079c('0x5')};function emitEvent(_0x53f551){return function(_0x8c5b44,_0x5884db,_0x215798){ChatOfflineMessageEvents[_0x079c('0x6')](_0x53f551+':'+_0x8c5b44['id'],_0x8c5b44);ChatOfflineMessageEvents[_0x079c('0x6')](_0x53f551,_0x8c5b44);_0x215798(null);};}for(var e in events){if(events[_0x079c('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x079c('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f47b4f0..63cb18b 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 _0xf68d=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0xf68d,0x133));var _0xdf68=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf68d[_0x53ccf2];return _0x5a2964;};'use strict';var attributes=require(_0xdf68('0x0'));module[_0xdf68('0x1')]=function(_0x3dec34){return _0x3dec34['define'](_0xdf68('0x2'),attributes,{'tableName':_0xdf68('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf68('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8810=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x8810,0x82));var _0x0881=function(_0x5957ce,_0x1ebd2d){_0x5957ce=_0x5957ce-0x0;var _0xc94f7b=_0x8810[_0x5957ce];return _0xc94f7b;};'use strict';var attributes=require(_0x0881('0x0'));module[_0x0881('0x1')]=function(_0x2cadf3){return _0x2cadf3['define'](_0x0881('0x2'),attributes,{'tableName':_0x0881('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0881('0x4'),'collate':_0x0881('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7082479..434c8d3 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 _0xec25=['catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2e6dd3,_0x8426ec){var _0x86721e=function(_0xae1509){while(--_0xae1509){_0x2e6dd3['push'](_0x2e6dd3['shift']());}};_0x86721e(++_0x8426ec);}(_0xec25,0x1b9));var _0x5ec2=function(_0x3eb3b9,_0x5b04ba){_0x3eb3b9=_0x3eb3b9-0x0;var _0x1b56f7=_0xec25[_0x3eb3b9];return _0x1b56f7;};'use strict';var _=require('lodash');var util=require(_0x5ec2('0x0'));var moment=require('moment');var BPromise=require(_0x5ec2('0x1'));var rs=require(_0x5ec2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ec2('0x3'))['db'];var utils=require(_0x5ec2('0x4'));var logger=require(_0x5ec2('0x5'))(_0x5ec2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ec2('0x7'));var client=jayson[_0x5ec2('0x8')][_0x5ec2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10cc1d,_0x2e4bae,_0x48d0a1){return new BPromise(function(_0x5c7158,_0x1a8e63){return client[_0x5ec2('0xa')](_0x10cc1d,_0x48d0a1)['then'](function(_0x53193e){logger['info'](_0x5ec2('0xb'),_0x2e4bae,_0x5ec2('0xc'));logger[_0x5ec2('0xd')](_0x5ec2('0xe'),_0x2e4bae,'request\x20sent',JSON[_0x5ec2('0xf')](_0x53193e));if(_0x53193e[_0x5ec2('0x10')]){if(_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x11')]===0x1f4){logger[_0x5ec2('0x10')](_0x5ec2('0xb'),_0x2e4bae,_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x12')]);return _0x1a8e63(_0x53193e['error']['message']);}logger[_0x5ec2('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2e4bae,_0x53193e[_0x5ec2('0x10')][_0x5ec2('0x12')]);return _0x5c7158(_0x53193e[_0x5ec2('0x10')]['message']);}else{logger[_0x5ec2('0x13')](_0x5ec2('0xb'),_0x2e4bae,'request\x20sent');_0x5c7158(_0x53193e[_0x5ec2('0x14')][_0x5ec2('0x12')]);}})[_0x5ec2('0x15')](function(_0x24c496){logger['error'](_0x5ec2('0xb'),_0x2e4bae,_0x24c496);_0x1a8e63(_0x24c496);});});} \ No newline at end of file +var _0xd5bf=['ChatOfflineMessage,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e83e8,_0x35bbb4){var _0x57fcca=function(_0x1ee0bf){while(--_0x1ee0bf){_0x3e83e8['push'](_0x3e83e8['shift']());}};_0x57fcca(++_0x35bbb4);}(_0xd5bf,0x66));var _0xfd5b=function(_0x14dc4c,_0x2516a7){_0x14dc4c=_0x14dc4c-0x0;var _0x486b53=_0xd5bf[_0x14dc4c];return _0x486b53;};'use strict';var _=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var moment=require(_0xfd5b('0x2'));var BPromise=require(_0xfd5b('0x3'));var rs=require(_0xfd5b('0x4'));var fs=require('fs');var Redis=require(_0xfd5b('0x5'));var db=require(_0xfd5b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd5b('0x7'));var config=require(_0xfd5b('0x8'));var jayson=require(_0xfd5b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c61da,_0x3cc261,_0x42b565){return new BPromise(function(_0x485158,_0x15022d){return client[_0xfd5b('0xa')](_0x2c61da,_0x42b565)['then'](function(_0x1ec371){logger[_0xfd5b('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3cc261,_0xfd5b('0xc'));logger['debug'](_0xfd5b('0xd'),_0x3cc261,'request\x20sent',JSON[_0xfd5b('0xe')](_0x1ec371));if(_0x1ec371['error']){if(_0x1ec371[_0xfd5b('0xf')][_0xfd5b('0x10')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3cc261,_0x1ec371[_0xfd5b('0xf')][_0xfd5b('0x11')]);return _0x15022d(_0x1ec371['error'][_0xfd5b('0x11')]);}logger[_0xfd5b('0xf')](_0xfd5b('0x12'),_0x3cc261,_0x1ec371[_0xfd5b('0xf')][_0xfd5b('0x11')]);return _0x485158(_0x1ec371[_0xfd5b('0xf')][_0xfd5b('0x11')]);}else{logger[_0xfd5b('0xb')](_0xfd5b('0x12'),_0x3cc261,_0xfd5b('0xc'));_0x485158(_0x1ec371['result'][_0xfd5b('0x11')]);}})[_0xfd5b('0x13')](function(_0x4289ab){logger[_0xfd5b('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3cc261,_0x4289ab);_0x15022d(_0x4289ab);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3387c10..67ddfb0 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 _0xf27a=['../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf27a,0x187));var _0xaf27=function(_0x5a40f2,_0x3616a0){_0x5a40f2=_0x5a40f2-0x0;var _0x2de00c=_0xf27a[_0x5a40f2];return _0x2de00c;};'use strict';var multer=require(_0xaf27('0x0'));var util=require(_0xaf27('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf27('0x2')]();var fs_extra=require(_0xaf27('0x3'));var auth=require(_0xaf27('0x4'));var interaction=require(_0xaf27('0x5'));var config=require('../../config/environment');var controller=require(_0xaf27('0x6'));router['get']('/',auth[_0xaf27('0x7')](),controller['index']);router[_0xaf27('0x8')](_0xaf27('0x9'),auth[_0xaf27('0x7')](),controller[_0xaf27('0xa')]);router[_0xaf27('0x8')]('/:id',auth[_0xaf27('0x7')](),controller[_0xaf27('0xb')]);router[_0xaf27('0xc')]('/',auth[_0xaf27('0x7')](),controller['create']);router['put']('/:id',auth[_0xaf27('0x7')](),controller[_0xaf27('0xd')]);router[_0xaf27('0xe')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller[_0xaf27('0x10')]);module[_0xaf27('0x11')]=router; \ No newline at end of file +var _0xf0e0=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','/:id'];(function(_0x2d2005,_0x4949db){var _0x45df97=function(_0x119e20){while(--_0x119e20){_0x2d2005['push'](_0x2d2005['shift']());}};_0x45df97(++_0x4949db);}(_0xf0e0,0xee));var _0x0f0e=function(_0x586d62,_0x5ab1c4){_0x586d62=_0x586d62-0x0;var _0x1edea7=_0xf0e0[_0x586d62];return _0x1edea7;};'use strict';var multer=require(_0x0f0e('0x0'));var util=require(_0x0f0e('0x1'));var path=require(_0x0f0e('0x2'));var timeout=require(_0x0f0e('0x3'));var express=require(_0x0f0e('0x4'));var router=express[_0x0f0e('0x5')]();var fs_extra=require(_0x0f0e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0f0e('0x7'));var config=require(_0x0f0e('0x8'));var controller=require(_0x0f0e('0x9'));router['get']('/',auth[_0x0f0e('0xa')](),controller['index']);router[_0x0f0e('0xb')](_0x0f0e('0xc'),auth[_0x0f0e('0xa')](),controller['describe']);router[_0x0f0e('0xb')](_0x0f0e('0xd'),auth[_0x0f0e('0xa')](),controller['show']);router[_0x0f0e('0xe')]('/',auth[_0x0f0e('0xa')](),controller[_0x0f0e('0xf')]);router[_0x0f0e('0x10')](_0x0f0e('0xd'),auth['isAuthenticated'](),controller[_0x0f0e('0x11')]);router[_0x0f0e('0x12')](_0x0f0e('0xd'),auth[_0x0f0e('0xa')](),controller[_0x0f0e('0x13')]);module[_0x0f0e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 950eea1..523f44d 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 _0xa41a=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0xa41a,0x1a3));var _0xaa41=function(_0x2b47fc,_0x213ead){_0x2b47fc=_0x2b47fc-0x0;var _0x220b85=_0xa41a[_0x2b47fc];return _0x220b85;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'name':{'type':Sequelize[_0xaa41('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaa41('0x3')](_0xaa41('0x4'),_0xaa41('0x5')),'defaultValue':_0xaa41('0x4')},'selector':{'type':Sequelize[_0xaa41('0x2')]},'timeout':{'type':Sequelize[_0xaa41('0x6')]}}; \ No newline at end of file +var _0x58e8=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x2a8f27,_0xd1c855){var _0x52a38d=function(_0x28d4a9){while(--_0x28d4a9){_0x2a8f27['push'](_0x2a8f27['shift']());}};_0x52a38d(++_0xd1c855);}(_0x58e8,0x121));var _0x858e=function(_0x579af2,_0x12f52a){_0x579af2=_0x579af2-0x0;var _0x4da03d=_0x58e8[_0x579af2];return _0x4da03d;};'use strict';var Sequelize=require(_0x858e('0x0'));module[_0x858e('0x1')]={'name':{'type':Sequelize[_0x858e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x858e('0x3')](_0x858e('0x4'),_0x858e('0x5')),'defaultValue':_0x858e('0x4')},'selector':{'type':Sequelize[_0x858e('0x2')]},'timeout':{'type':Sequelize[_0x858e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index de1cea5..c41608b 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 _0x3a32=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x16e8fa,_0x2fad34){var _0x7f1bcc=function(_0x352efb){while(--_0x352efb){_0x16e8fa['push'](_0x16e8fa['shift']());}};_0x7f1bcc(++_0x2fad34);}(_0x3a32,0x9b));var _0x23a3=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3a32[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0x23a3('0x0'));var rimraf=require(_0x23a3('0x1'));var zipdir=require(_0x23a3('0x2'));var jsonpatch=require(_0x23a3('0x3'));var rp=require(_0x23a3('0x4'));var moment=require(_0x23a3('0x5'));var BPromise=require(_0x23a3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23a3('0x7'));var sox=require(_0x23a3('0x8'));var csv=require('to-csv');var ejs=require(_0x23a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23a3('0xa'));var squel=require(_0x23a3('0xb'));var crypto=require(_0x23a3('0xc'));var jsforce=require(_0x23a3('0xd'));var deskjs=require(_0x23a3('0xe'));var toCsv=require(_0x23a3('0xf'));var querystring=require('querystring');var Papa=require(_0x23a3('0x10'));var Redis=require(_0x23a3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23a3('0x12'));var hardwareService=require(_0x23a3('0x13'));var logger=require(_0x23a3('0x14'))('api');var utils=require(_0x23a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x23a3('0x16'));var db=require(_0x23a3('0x17'))['db'];function respondWithStatusCode(_0x1ebeae,_0x4b65d9){_0x4b65d9=_0x4b65d9||0xcc;return function(_0x5f31f2){if(_0x5f31f2){return _0x1ebeae[_0x23a3('0x18')](_0x4b65d9);}return _0x1ebeae[_0x23a3('0x19')](_0x4b65d9)[_0x23a3('0x1a')]();};}function respondWithResult(_0x2af741,_0x52243b){_0x52243b=_0x52243b||0xc8;return function(_0x3c0e0e){if(_0x3c0e0e){return _0x2af741[_0x23a3('0x19')](_0x52243b)['json'](_0x3c0e0e);}};}function respondWithFilteredResult(_0x73759f,_0xcd0167){return function(_0x480bcd){if(_0x480bcd){var _0x2e9730=typeof _0xcd0167[_0x23a3('0x1b')]===_0x23a3('0x1c')&&typeof _0xcd0167[_0x23a3('0x1d')]===_0x23a3('0x1c');var _0x16fb78=_0x480bcd[_0x23a3('0x1e')];var _0xc33cbd=_0x2e9730?0x0:_0xcd0167['offset'];var _0x3961e9=_0x2e9730?_0x480bcd[_0x23a3('0x1e')]:_0xcd0167['offset']+_0xcd0167['limit'];var _0x289eb7;if(_0x3961e9>=_0x16fb78){_0x3961e9=_0x16fb78;_0x289eb7=0xc8;}else{_0x289eb7=0xce;}_0x73759f[_0x23a3('0x19')](_0x289eb7);return _0x73759f[_0x23a3('0x1f')](_0x23a3('0x20'),_0xc33cbd+'-'+_0x3961e9+'/'+_0x16fb78)[_0x23a3('0x21')](_0x480bcd);}return null;};}function patchUpdates(_0x1dd837){return function(_0x1a4cfc){try{jsonpatch[_0x23a3('0x22')](_0x1a4cfc,_0x1dd837,!![]);}catch(_0x1a9d86){return BPromise[_0x23a3('0x23')](_0x1a9d86);}return _0x1a4cfc[_0x23a3('0x24')]();};}function saveUpdates(_0x53ccdf,_0x51885){return function(_0x2bfe31){if(_0x2bfe31){return _0x2bfe31[_0x23a3('0x25')](_0x53ccdf)[_0x23a3('0x26')](function(_0x239e4b){return _0x239e4b;});}return null;};}function removeEntity(_0x264d1a,_0x509aa3){return function(_0x48a73c){if(_0x48a73c){return _0x48a73c['destroy']()[_0x23a3('0x26')](function(){_0x264d1a['status'](0xcc)[_0x23a3('0x1a')]();});}};}function handleEntityNotFound(_0x525b5f,_0x47539d){return function(_0x4f5583){if(!_0x4f5583){_0x525b5f[_0x23a3('0x18')](0x194);}return _0x4f5583;};}function handleError(_0x307493,_0x5d7cbc){_0x5d7cbc=_0x5d7cbc||0x1f4;return function(_0x333998){logger[_0x23a3('0x27')](_0x333998[_0x23a3('0x28')]);if(_0x333998[_0x23a3('0x29')]){delete _0x333998[_0x23a3('0x29')];}_0x307493['status'](_0x5d7cbc)[_0x23a3('0x2a')](_0x333998);};}exports[_0x23a3('0x2b')]=function(_0x3be09c,_0x6ab5f1){var _0x6bdfa8={'raw':!![],'where':{'id':_0x3be09c[_0x23a3('0x2c')]['id']}},_0x35519f={};_0x35519f[_0x23a3('0x2d')]=_['keys'](db[_0x23a3('0x2e')][_0x23a3('0x2f')]);_0x35519f[_0x23a3('0x30')]=_[_0x23a3('0x31')](_0x3be09c[_0x23a3('0x30')]);_0x35519f['filters']=_[_0x23a3('0x32')](_0x35519f[_0x23a3('0x2d')],_0x35519f[_0x23a3('0x30')]);_0x6bdfa8[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x35519f[_0x23a3('0x2d')],qs[_0x23a3('0x34')](_0x3be09c[_0x23a3('0x30')][_0x23a3('0x34')]));_0x6bdfa8[_0x23a3('0x33')]=_0x6bdfa8[_0x23a3('0x33')][_0x23a3('0x35')]?_0x6bdfa8['attributes']:_0x35519f[_0x23a3('0x2d')];if(_0x3be09c[_0x23a3('0x30')][_0x23a3('0x36')]){_0x6bdfa8[_0x23a3('0x37')]=[{'all':!![]}];}_0x6bdfa8=_['merge']({},_0x6bdfa8,_0x3be09c[_0x23a3('0x38')]);return db[_0x23a3('0x2e')]['find'](_0x6bdfa8)['then'](handleEntityNotFound(_0x6ab5f1,null))[_0x23a3('0x26')](respondWithResult(_0x6ab5f1,null))[_0x23a3('0x39')](handleError(_0x6ab5f1,null));};exports[_0x23a3('0x3a')]=function(_0x1596a2,_0x45bfca){return db['ChatProactiveAction'][_0x23a3('0x3a')](_0x1596a2[_0x23a3('0x3b')],{})[_0x23a3('0x26')](respondWithResult(_0x45bfca,0xc9))['catch'](handleError(_0x45bfca,null));};exports[_0x23a3('0x25')]=function(_0x542274,_0xd57d5d){if(_0x542274['body']['id']){delete _0x542274[_0x23a3('0x3b')]['id'];}return db[_0x23a3('0x2e')][_0x23a3('0x3c')]({'where':{'id':_0x542274[_0x23a3('0x2c')]['id']}})[_0x23a3('0x26')](handleEntityNotFound(_0xd57d5d,null))[_0x23a3('0x26')](saveUpdates(_0x542274[_0x23a3('0x3b')],null))[_0x23a3('0x26')](respondWithResult(_0xd57d5d,null))[_0x23a3('0x39')](handleError(_0xd57d5d,null));};exports['destroy']=function(_0x43a02a,_0x39b1c1){return db[_0x23a3('0x2e')][_0x23a3('0x3c')]({'where':{'id':_0x43a02a[_0x23a3('0x2c')]['id']}})[_0x23a3('0x26')](handleEntityNotFound(_0x39b1c1,null))[_0x23a3('0x26')](removeEntity(_0x39b1c1,null))[_0x23a3('0x39')](handleError(_0x39b1c1,null));}; \ No newline at end of file +var _0xd6d2=['intersection','query','fields','attributes','length','include','merge','options','find','create','body','catch','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','model','ChatProactiveAction','keys','filters'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x16235d,_0x46234b){_0x16235d=_0x16235d-0x0;var _0x4f2629=_0xd6d2[_0x16235d];return _0x4f2629;};'use strict';var emlformat=require(_0x2d6d('0x0'));var rimraf=require(_0x2d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6d('0x2'));var rp=require(_0x2d6d('0x3'));var moment=require('moment');var BPromise=require(_0x2d6d('0x4'));var Mustache=require('mustache');var util=require(_0x2d6d('0x5'));var path=require(_0x2d6d('0x6'));var sox=require(_0x2d6d('0x7'));var csv=require('to-csv');var ejs=require(_0x2d6d('0x8'));var fs=require('fs');var fs_extra=require(_0x2d6d('0x9'));var _=require(_0x2d6d('0xa'));var squel=require(_0x2d6d('0xb'));var crypto=require(_0x2d6d('0xc'));var jsforce=require(_0x2d6d('0xd'));var deskjs=require(_0x2d6d('0xe'));var toCsv=require(_0x2d6d('0xf'));var querystring=require(_0x2d6d('0x10'));var Papa=require(_0x2d6d('0x11'));var Redis=require(_0x2d6d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2d6d('0x13'));var as=require(_0x2d6d('0x14'));var hardwareService=require(_0x2d6d('0x15'));var logger=require(_0x2d6d('0x16'))(_0x2d6d('0x17'));var utils=require('../../config/utils');var config=require(_0x2d6d('0x18'));var licenseUtil=require(_0x2d6d('0x19'));var db=require(_0x2d6d('0x1a'))['db'];function respondWithStatusCode(_0x2ad9fc,_0x5c4bf6){_0x5c4bf6=_0x5c4bf6||0xcc;return function(_0x5ef174){if(_0x5ef174){return _0x2ad9fc[_0x2d6d('0x1b')](_0x5c4bf6);}return _0x2ad9fc[_0x2d6d('0x1c')](_0x5c4bf6)[_0x2d6d('0x1d')]();};}function respondWithResult(_0x3528de,_0x58bd29){_0x58bd29=_0x58bd29||0xc8;return function(_0x1ec6aa){if(_0x1ec6aa){return _0x3528de[_0x2d6d('0x1c')](_0x58bd29)['json'](_0x1ec6aa);}};}function respondWithFilteredResult(_0x586085,_0x370096){return function(_0x17340f){if(_0x17340f){var _0x109b49=typeof _0x370096['offset']===_0x2d6d('0x1e')&&typeof _0x370096['limit']==='undefined';var _0x4c3092=_0x17340f[_0x2d6d('0x1f')];var _0x4179f2=_0x109b49?0x0:_0x370096[_0x2d6d('0x20')];var _0x3c527e=_0x109b49?_0x17340f[_0x2d6d('0x1f')]:_0x370096[_0x2d6d('0x20')]+_0x370096[_0x2d6d('0x21')];var _0xa2c4a7;if(_0x3c527e>=_0x4c3092){_0x3c527e=_0x4c3092;_0xa2c4a7=0xc8;}else{_0xa2c4a7=0xce;}_0x586085[_0x2d6d('0x1c')](_0xa2c4a7);return _0x586085['set'](_0x2d6d('0x22'),_0x4179f2+'-'+_0x3c527e+'/'+_0x4c3092)[_0x2d6d('0x23')](_0x17340f);}return null;};}function patchUpdates(_0x5b0c61){return function(_0x227e44){try{jsonpatch[_0x2d6d('0x24')](_0x227e44,_0x5b0c61,!![]);}catch(_0x15cb80){return BPromise[_0x2d6d('0x25')](_0x15cb80);}return _0x227e44[_0x2d6d('0x26')]();};}function saveUpdates(_0x59234a,_0x4aaa62){return function(_0x42c2f2){if(_0x42c2f2){return _0x42c2f2[_0x2d6d('0x27')](_0x59234a)[_0x2d6d('0x28')](function(_0x585b54){return _0x585b54;});}return null;};}function removeEntity(_0x47eb0e,_0x3ae8ad){return function(_0x4e7ec8){if(_0x4e7ec8){return _0x4e7ec8['destroy']()['then'](function(){_0x47eb0e[_0x2d6d('0x1c')](0xcc)[_0x2d6d('0x1d')]();});}};}function handleEntityNotFound(_0x3da83d,_0x3f89dd){return function(_0x3e5a92){if(!_0x3e5a92){_0x3da83d['sendStatus'](0x194);}return _0x3e5a92;};}function handleError(_0x16634d,_0x1b4964){_0x1b4964=_0x1b4964||0x1f4;return function(_0x455e71){logger[_0x2d6d('0x29')](_0x455e71[_0x2d6d('0x2a')]);if(_0x455e71[_0x2d6d('0x2b')]){delete _0x455e71[_0x2d6d('0x2b')];}_0x16634d[_0x2d6d('0x1c')](_0x1b4964)[_0x2d6d('0x2c')](_0x455e71);};}exports['show']=function(_0x1016e1,_0x26d299){var _0x2e7b32={'raw':!![],'where':{'id':_0x1016e1['params']['id']}},_0x34d485={};_0x34d485[_0x2d6d('0x2d')]=_['keys'](db[_0x2d6d('0x2e')]['rawAttributes']);_0x34d485['query']=_[_0x2d6d('0x2f')](_0x1016e1['query']);_0x34d485[_0x2d6d('0x30')]=_[_0x2d6d('0x31')](_0x34d485['model'],_0x34d485[_0x2d6d('0x32')]);_0x2e7b32['attributes']=_[_0x2d6d('0x31')](_0x34d485[_0x2d6d('0x2d')],qs[_0x2d6d('0x33')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x33')]));_0x2e7b32[_0x2d6d('0x34')]=_0x2e7b32[_0x2d6d('0x34')][_0x2d6d('0x35')]?_0x2e7b32['attributes']:_0x34d485[_0x2d6d('0x2d')];if(_0x1016e1[_0x2d6d('0x32')]['includeAll']){_0x2e7b32[_0x2d6d('0x36')]=[{'all':!![]}];}_0x2e7b32=_[_0x2d6d('0x37')]({},_0x2e7b32,_0x1016e1[_0x2d6d('0x38')]);return db[_0x2d6d('0x2e')][_0x2d6d('0x39')](_0x2e7b32)['then'](handleEntityNotFound(_0x26d299,null))['then'](respondWithResult(_0x26d299,null))['catch'](handleError(_0x26d299,null));};exports[_0x2d6d('0x3a')]=function(_0x9edb2a,_0x1043e2){return db['ChatProactiveAction'][_0x2d6d('0x3a')](_0x9edb2a[_0x2d6d('0x3b')],{})[_0x2d6d('0x28')](respondWithResult(_0x1043e2,0xc9))[_0x2d6d('0x3c')](handleError(_0x1043e2,null));};exports['update']=function(_0x78354,_0x2bdc1b){if(_0x78354[_0x2d6d('0x3b')]['id']){delete _0x78354[_0x2d6d('0x3b')]['id'];}return db[_0x2d6d('0x2e')][_0x2d6d('0x39')]({'where':{'id':_0x78354[_0x2d6d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2bdc1b,null))[_0x2d6d('0x28')](saveUpdates(_0x78354[_0x2d6d('0x3b')],null))[_0x2d6d('0x28')](respondWithResult(_0x2bdc1b,null))[_0x2d6d('0x3c')](handleError(_0x2bdc1b,null));};exports[_0x2d6d('0x3e')]=function(_0x5e5446,_0x1cad57){return db[_0x2d6d('0x2e')][_0x2d6d('0x39')]({'where':{'id':_0x5e5446[_0x2d6d('0x3d')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x1cad57,null))[_0x2d6d('0x28')](removeEntity(_0x1cad57,null))[_0x2d6d('0x3c')](handleError(_0x1cad57,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0085cf9..6d2fbdc 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 _0x313a=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment'];(function(_0x11d291,_0x36072a){var _0x3253dc=function(_0x34c889){while(--_0x34c889){_0x11d291['push'](_0x11d291['shift']());}};_0x3253dc(++_0x36072a);}(_0x313a,0xb0));var _0xa313=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x313a[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xa313('0x0'));var util=require(_0xa313('0x1'));var logger=require('../../config/logger')(_0xa313('0x2'));var moment=require(_0xa313('0x3'));var BPromise=require('bluebird');var rp=require(_0xa313('0x4'));var fs=require('fs');var path=require(_0xa313('0x5'));var rimraf=require(_0xa313('0x6'));var config=require('../../config/environment');var attributes=require(_0xa313('0x7'));module[_0xa313('0x8')]=function(_0x138a50,_0x36c3ad){return _0x138a50[_0xa313('0x9')](_0xa313('0xa'),attributes,{'tableName':_0xa313('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x270f=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','../../config/logger','api','moment','request-promise'];(function(_0x5c0313,_0xfa3255){var _0x13e129=function(_0x279248){while(--_0x279248){_0x5c0313['push'](_0x5c0313['shift']());}};_0x13e129(++_0xfa3255);}(_0x270f,0x132));var _0xf270=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x270f[_0x297c55];return _0x120389;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf270('0x0'))(_0xf270('0x1'));var moment=require(_0xf270('0x2'));var BPromise=require('bluebird');var rp=require(_0xf270('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf270('0x4'));var config=require(_0xf270('0x5'));var attributes=require(_0xf270('0x6'));module[_0xf270('0x7')]=function(_0x4636f4,_0xf9cd5f){return _0x4636f4[_0xf270('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xf270('0x9'),'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 1a91829..22dfc9c 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 _0x91bd=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch'];(function(_0x9fd078,_0x742637){var _0x64e139=function(_0x28b39b){while(--_0x28b39b){_0x9fd078['push'](_0x9fd078['shift']());}};_0x64e139(++_0x742637);}(_0x91bd,0x150));var _0xd91b=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x91bd[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0xd91b('0x0'));var util=require(_0xd91b('0x1'));var moment=require(_0xd91b('0x2'));var BPromise=require(_0xd91b('0x3'));var rs=require(_0xd91b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd91b('0x5'))['db'];var utils=require(_0xd91b('0x6'));var logger=require(_0xd91b('0x7'))(_0xd91b('0x8'));var config=require(_0xd91b('0x9'));var jayson=require(_0xd91b('0xa'));var client=jayson[_0xd91b('0xb')][_0xd91b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9422f,_0x2c208c,_0xe4d1cc){return new BPromise(function(_0x29791b,_0x529308){return client[_0xd91b('0xd')](_0xa9422f,_0xe4d1cc)[_0xd91b('0xe')](function(_0x18d90c){logger[_0xd91b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c208c,_0xd91b('0x10'));logger[_0xd91b('0x11')](_0xd91b('0x12'),_0x2c208c,'request\x20sent',JSON['stringify'](_0x18d90c));if(_0x18d90c[_0xd91b('0x13')]){if(_0x18d90c[_0xd91b('0x13')][_0xd91b('0x14')]===0x1f4){logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x18d90c[_0xd91b('0x13')][_0xd91b('0x16')]);return _0x529308(_0x18d90c[_0xd91b('0x13')][_0xd91b('0x16')]);}logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x18d90c['error'][_0xd91b('0x16')]);return _0x29791b(_0x18d90c[_0xd91b('0x13')]['message']);}else{logger[_0xd91b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c208c,_0xd91b('0x10'));_0x29791b(_0x18d90c['result']['message']);}})[_0xd91b('0x17')](function(_0x1d0f9d){logger[_0xd91b('0x13')](_0xd91b('0x15'),_0x2c208c,_0x1d0f9d);_0x529308(_0x1d0f9d);});});} \ No newline at end of file +var _0x7b66=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','ChatProactiveAction,\x20%s,\x20%s','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x7b66,0x98));var _0x67b6=function(_0x1ab32d,_0x4240d1){_0x1ab32d=_0x1ab32d-0x0;var _0x30849c=_0x7b66[_0x1ab32d];return _0x30849c;};'use strict';var _=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var moment=require(_0x67b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x67b6('0x4'));var logger=require(_0x67b6('0x5'))(_0x67b6('0x6'));var config=require(_0x67b6('0x7'));var jayson=require(_0x67b6('0x8'));var client=jayson[_0x67b6('0x9')][_0x67b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8ccf,_0x4879e8,_0x1639c8){return new BPromise(function(_0x396b61,_0x4ad6de){return client[_0x67b6('0xb')](_0x2d8ccf,_0x1639c8)[_0x67b6('0xc')](function(_0x13dcd0){logger[_0x67b6('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x4879e8,_0x67b6('0xe'));logger[_0x67b6('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4879e8,_0x67b6('0xe'),JSON['stringify'](_0x13dcd0));if(_0x13dcd0['error']){if(_0x13dcd0[_0x67b6('0x10')][_0x67b6('0x11')]===0x1f4){logger[_0x67b6('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x4879e8,_0x13dcd0['error'][_0x67b6('0x12')]);return _0x4ad6de(_0x13dcd0[_0x67b6('0x10')][_0x67b6('0x12')]);}logger['error'](_0x67b6('0x13'),_0x4879e8,_0x13dcd0['error'][_0x67b6('0x12')]);return _0x396b61(_0x13dcd0[_0x67b6('0x10')][_0x67b6('0x12')]);}else{logger['info'](_0x67b6('0x13'),_0x4879e8,'request\x20sent');_0x396b61(_0x13dcd0['result']['message']);}})['catch'](function(_0x49520f){logger[_0x67b6('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x4879e8,_0x49520f);_0x4ad6de(_0x49520f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f7af320..ef7f0a3 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 _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x4256aa,_0x16af5c){var _0x15ca3b=function(_0x5b161b){while(--_0x5b161b){_0x4256aa['push'](_0x4256aa['shift']());}};_0x15ca3b(++_0x16af5c);}(_0x032e,0x124));var _0xe032=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x032e[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file +var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x218c70,_0x4ce15e){var _0xc5022c=function(_0x23d15c){while(--_0x23d15c){_0x218c70['push'](_0x218c70['shift']());}};_0xc5022c(++_0x4ce15e);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0c6370c..eb8fed7 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 _0xc2cc=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x24d982,_0x1d638b){var _0x2441c4=function(_0x290e43){while(--_0x290e43){_0x24d982['push'](_0x24d982['shift']());}};_0x2441c4(++_0x1d638b);}(_0xc2cc,0x92));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xcc2c('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc2c('0x1')],'unique':_0xcc2c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc2c('0x1')]},'timeout':{'type':Sequelize[_0xcc2c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc2c('0x4')](_0xcc2c('0x5'),_0xcc2c('0x6'),_0xcc2c('0x7'))}}; \ No newline at end of file +var _0x8375=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x115a07,_0xc16ec1){var _0x5a8ead=function(_0x439166){while(--_0x439166){_0x115a07['push'](_0x115a07['shift']());}};_0x5a8ead(++_0xc16ec1);}(_0x8375,0xb5));var _0x5837=function(_0x15b68d,_0x4de6a8){_0x15b68d=_0x15b68d-0x0;var _0x1ee804=_0x8375[_0x15b68d];return _0x1ee804;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'name':{'type':Sequelize[_0x5837('0x2')],'unique':_0x5837('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5837('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5837('0x5')](_0x5837('0x6'),_0x5837('0x7'),_0x5837('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 60482f8..0230294 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 _0xa2c2=['Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','all','compact','forEach','emit','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatQueues','error','stack','name','send','index','map','fieldName','type','where','ChatQueue','include','query','findAll','catch','model','rawAttributes','keys','filters','intersection','attributes','length','merge','options','find','create','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','fields','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','UserChatQueue','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','updatedAt','getTeams'];(function(_0x495f22,_0x392ea1){var _0x593b86=function(_0x18c8a9){while(--_0x18c8a9){_0x495f22['push'](_0x495f22['shift']());}};_0x593b86(++_0x392ea1);}(_0xa2c2,0x10c));var _0x2a2c=function(_0x3051e2,_0x33ca33){_0x3051e2=_0x3051e2-0x0;var _0x593aa1=_0xa2c2[_0x3051e2];return _0x593aa1;};'use strict';var BPromise=require(_0x2a2c('0x0'));var util=require(_0x2a2c('0x1'));var _=require(_0x2a2c('0x2'));var squel=require(_0x2a2c('0x3'));var Redis=require(_0x2a2c('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x2a2c('0x5'));var db=require(_0x2a2c('0x6'))['db'];config[_0x2a2c('0x7')]=_['defaults'](config[_0x2a2c('0x7')],{'host':_0x2a2c('0x8'),'port':0x18eb});var socket=require(_0x2a2c('0x9'))(new Redis(config[_0x2a2c('0x7')]));require(_0x2a2c('0xa'))[_0x2a2c('0xb')](socket);function respondWithStatusCode(_0xa6ae15,_0x544934){_0x544934=_0x544934||0xcc;return function(_0x1052d8){if(_0x1052d8){return _0xa6ae15[_0x2a2c('0xc')](_0x544934);}return _0xa6ae15[_0x2a2c('0xd')](_0x544934)[_0x2a2c('0xe')]();};}function respondWithResult(_0x53aab0,_0x5bca2a){_0x5bca2a=_0x5bca2a||0xc8;return function(_0x30b47a){if(_0x30b47a){return _0x53aab0[_0x2a2c('0xd')](_0x5bca2a)[_0x2a2c('0xf')](_0x30b47a);}};}function respondWithFilteredResult(_0x57b3b6,_0x4d1ca1){return function(_0x152120){if(_0x152120){var _0x2f887c=typeof _0x4d1ca1[_0x2a2c('0x10')]===_0x2a2c('0x11')&&typeof _0x4d1ca1[_0x2a2c('0x12')]===_0x2a2c('0x11');var _0x2e0a47=_0x152120['count'];var _0x9947e9=_0x2f887c?0x0:_0x4d1ca1[_0x2a2c('0x10')];var _0x1e8fcf=_0x2f887c?_0x152120[_0x2a2c('0x13')]:_0x4d1ca1[_0x2a2c('0x10')]+_0x4d1ca1[_0x2a2c('0x12')];var _0x2b2f36;if(_0x1e8fcf>=_0x2e0a47){_0x1e8fcf=_0x2e0a47;_0x2b2f36=0xc8;}else{_0x2b2f36=0xce;}_0x57b3b6[_0x2a2c('0xd')](_0x2b2f36);return _0x57b3b6['set'](_0x2a2c('0x14'),_0x9947e9+'-'+_0x1e8fcf+'/'+_0x2e0a47)[_0x2a2c('0xf')](_0x152120);}return null;};}function saveUpdates(_0x2274ff){return function(_0x54694d){if(_0x54694d){return _0x54694d[_0x2a2c('0x15')](_0x2274ff)[_0x2a2c('0x16')](function(_0xb453d8){return _0xb453d8;});}return null;};}function removeEntity(_0xc3121a){return function(_0x2e980e){if(_0x2e980e){return _0x2e980e[_0x2a2c('0x17')]()[_0x2a2c('0x16')](function(){var _0x27c9ae=_0x2e980e[_0x2a2c('0x18')]({'plain':!![]});var _0x104dda=_0x2a2c('0x19');return db['UserProfileResource'][_0x2a2c('0x17')]({'where':{'type':_0x104dda,'resourceId':_0x27c9ae['id']}})[_0x2a2c('0x16')](function(){return _0x2e980e;});})[_0x2a2c('0x16')](function(){_0xc3121a[_0x2a2c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6287){return function(_0x27d2f5){if(!_0x27d2f5){_0x1a6287[_0x2a2c('0xc')](0x194);}return _0x27d2f5;};}function handleError(_0x43e9e5,_0x117f3e){_0x117f3e=_0x117f3e||0x1f4;return function(_0x2aa877){logger[_0x2a2c('0x1a')](_0x2aa877[_0x2a2c('0x1b')]);if(_0x2aa877[_0x2a2c('0x1c')]){delete _0x2aa877[_0x2a2c('0x1c')];}_0x43e9e5[_0x2a2c('0xd')](_0x117f3e)[_0x2a2c('0x1d')](_0x2aa877);};}exports[_0x2a2c('0x1e')]=function(_0x5181d9,_0x339986){var _0x520b24={};var _0x2574c8={'count':0x0,'rows':[]};var _0x1e09e9=_[_0x2a2c('0x1f')](db['ChatQueue']['rawAttributes'],function(_0x3fceb5){return{'name':_0x3fceb5[_0x2a2c('0x20')],'type':_0x3fceb5[_0x2a2c('0x21')]['key']};});_0x520b24=qs['getOptions'](_0x1e09e9,_0x5181d9);var _0x373892={'where':_0x520b24[_0x2a2c('0x22')]};return db[_0x2a2c('0x23')]['count'](_0x373892)[_0x2a2c('0x16')](function(_0x162596){_0x2574c8[_0x2a2c('0x13')]=_0x162596;_0x520b24[_0x2a2c('0x24')]=qs[_0x2a2c('0x24')](_0x5181d9[_0x2a2c('0x25')]);return db['ChatQueue'][_0x2a2c('0x26')](_0x520b24);})['then'](function(_0x3c793a){_0x2574c8['rows']=_0x3c793a;return _0x2574c8;})[_0x2a2c('0x16')](respondWithFilteredResult(_0x339986,_0x520b24))[_0x2a2c('0x27')](handleError(_0x339986,null));};exports['show']=function(_0x51871f,_0x45e943){var _0x5e47b1={'raw':!![],'where':{'id':_0x51871f['params']['id']}},_0x235aed={};_0x235aed[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x23')][_0x2a2c('0x29')]);_0x235aed['query']=_[_0x2a2c('0x2a')](_0x51871f['query']);_0x235aed[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x235aed[_0x2a2c('0x28')],_0x235aed[_0x2a2c('0x25')]);_0x5e47b1['attributes']=_[_0x2a2c('0x2c')](_0x235aed[_0x2a2c('0x28')],qs['fields'](_0x51871f[_0x2a2c('0x25')]['fields']));_0x5e47b1[_0x2a2c('0x2d')]=_0x5e47b1[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x5e47b1[_0x2a2c('0x2d')]:_0x235aed[_0x2a2c('0x28')];if(_0x51871f[_0x2a2c('0x25')]['includeAll']){_0x5e47b1['include']=[{'all':!![]}];}_0x5e47b1=_[_0x2a2c('0x2f')]({},_0x5e47b1,_0x51871f[_0x2a2c('0x30')]);return db[_0x2a2c('0x23')][_0x2a2c('0x31')](_0x5e47b1)[_0x2a2c('0x16')](handleEntityNotFound(_0x45e943,null))[_0x2a2c('0x16')](respondWithResult(_0x45e943,null))['catch'](handleError(_0x45e943,null));};exports[_0x2a2c('0x32')]=function(_0x54273d,_0x14c9d8){return db[_0x2a2c('0x23')][_0x2a2c('0x32')](_0x54273d['body'],{})[_0x2a2c('0x16')](function(_0x2534d9){var _0x431fe6=_0x54273d['user'][_0x2a2c('0x18')]({'plain':!![]});if(!_0x431fe6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x431fe6['role']===_0x2a2c('0x33')){var _0x23c3a4=_0x2534d9[_0x2a2c('0x18')]({'plain':!![]});var _0x33f96e='ChatQueues';return db[_0x2a2c('0x34')][_0x2a2c('0x31')]({'where':{'name':_0x33f96e,'userProfileId':_0x431fe6['userProfileId']},'raw':!![]})['then'](function(_0x2529f0){if(_0x2529f0&&_0x2529f0['autoAssociation']===0x0){return db[_0x2a2c('0x35')][_0x2a2c('0x32')]({'name':_0x23c3a4[_0x2a2c('0x1c')],'resourceId':_0x23c3a4['id'],'type':_0x2529f0[_0x2a2c('0x1c')],'sectionId':_0x2529f0['id']},{})['then'](function(){return _0x2534d9;});}else{return _0x2534d9;}})[_0x2a2c('0x27')](function(_0x54e9ed){logger[_0x2a2c('0x1a')](_0x2a2c('0x36'),_0x54e9ed);throw _0x54e9ed;});}return _0x2534d9;})[_0x2a2c('0x16')](respondWithResult(_0x14c9d8,0xc9))[_0x2a2c('0x27')](handleError(_0x14c9d8,null));};exports['update']=function(_0x3229e8,_0x1ee563){if(_0x3229e8[_0x2a2c('0x37')]['id']){delete _0x3229e8[_0x2a2c('0x37')]['id'];}return db['ChatQueue'][_0x2a2c('0x31')]({'where':{'id':_0x3229e8['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x1ee563,null))[_0x2a2c('0x16')](saveUpdates(_0x3229e8['body'],null))[_0x2a2c('0x16')](respondWithResult(_0x1ee563,null))[_0x2a2c('0x27')](handleError(_0x1ee563,null));};exports['destroy']=function(_0x3cd050,_0x391fcb){return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x3cd050[_0x2a2c('0x38')]['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x391fcb,null))[_0x2a2c('0x16')](removeEntity(_0x391fcb,null))[_0x2a2c('0x27')](handleError(_0x391fcb,null));};exports[_0x2a2c('0x39')]=function(_0x3512be,_0x5405aa){return db[_0x2a2c('0x23')][_0x2a2c('0x39')]()['then'](respondWithResult(_0x5405aa,null))['catch'](handleError(_0x5405aa,null));};exports[_0x2a2c('0x3a')]=function(_0x2fd083,_0x36e534){var _0x34d52b={'raw':!![],'where':{}},_0x4e4bd9={},_0x84d351;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x2fd083['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x36e534,null))[_0x2a2c('0x16')](function(_0xaa32bf){if(_0xaa32bf){_0x84d351=_0xaa32bf['get']({'plain':!![]});_0x4e4bd9[_0x2a2c('0x28')]=_[_0x2a2c('0x2a')](db['UserChatQueue'][_0x2a2c('0x29')]);_0x4e4bd9[_0x2a2c('0x25')]=_[_0x2a2c('0x2a')](_0x2fd083[_0x2a2c('0x25')]);_0x4e4bd9[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x4e4bd9[_0x2a2c('0x28')],_0x4e4bd9[_0x2a2c('0x25')]);_0x34d52b[_0x2a2c('0x2d')]=_['intersection'](_0x4e4bd9[_0x2a2c('0x28')],qs[_0x2a2c('0x3c')](_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x34d52b['attributes']=_0x34d52b[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x34d52b[_0x2a2c('0x2d')]:_0x4e4bd9[_0x2a2c('0x28')];if(!_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x3d')](_0x2a2c('0x3e'))){_0x34d52b[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x2fd083[_0x2a2c('0x25')]['limit']);_0x34d52b[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x2fd083[_0x2a2c('0x25')]['offset']);}_0x34d52b[_0x2a2c('0x3f')]=qs[_0x2a2c('0x40')](_0x2fd083[_0x2a2c('0x25')][_0x2a2c('0x40')]);_0x34d52b[_0x2a2c('0x22')]=qs[_0x2a2c('0x2b')](_[_0x2a2c('0x41')](_0x2fd083['query'],_0x4e4bd9[_0x2a2c('0x2b')]));_0x34d52b[_0x2a2c('0x22')][_0x2a2c('0x42')]=_0xaa32bf['id'];if(_0x2fd083['query'][_0x2a2c('0x43')]){_0x34d52b[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x34d52b[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x34d52b[_0x2a2c('0x2d')],function(_0x53ffee){var _0x1f9afc={};_0x1f9afc[_0x53ffee]={'$like':'%'+_0x2fd083[_0x2a2c('0x25')]['filter']+'%'};return _0x1f9afc;})});}_0x34d52b=_[_0x2a2c('0x2f')]({},_0x34d52b,_0x2fd083[_0x2a2c('0x30')]);return db[_0x2a2c('0x44')][_0x2a2c('0x26')](_0x34d52b);}})[_0x2a2c('0x16')](function(_0x3c1b1c){if(_0x3c1b1c){return db[_0x2a2c('0x45')][_0x2a2c('0x46')]({'where':{'id':_['map'](_0x3c1b1c,_0x2a2c('0x47')),'role':_0x2a2c('0x48')},'attributes':['id',_0x2a2c('0x1c'),'chatPause','updatedAt',_0x2a2c('0x49')]});}})[_0x2a2c('0x16')](function(_0x15d5ae){if(_0x15d5ae){return{'count':_0x15d5ae[_0x2a2c('0x13')],'rows':_[_0x2a2c('0x1f')](_0x15d5ae['rows'],function(_0x5de732){return{'membername':_0x5de732[_0x2a2c('0x1c')],'UserId':_0x5de732['id'],'queue_name':_0x84d351[_0x2a2c('0x1c')],'ChatQueueId':_0x84d351['id'],'interface':util[_0x2a2c('0x4a')](_0x2a2c('0x4b'),_0x2a2c('0x4c'),_0x5de732[_0x2a2c('0x1c')]),'penalty':0x0,'paused':_0x5de732[_0x2a2c('0x4d')],'createdAt':_0x5de732['createdAt'],'updatedAt':_0x5de732[_0x2a2c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36e534,_0x34d52b))[_0x2a2c('0x27')](handleError(_0x36e534,null));};exports[_0x2a2c('0x4f')]=function(_0x248a54,_0x53e483){var _0x406108={};var _0x403878={};var _0x118df9;var _0x1cdaf9;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x248a54[_0x2a2c('0x38')]['id']}})['then'](handleEntityNotFound(_0x53e483,null))[_0x2a2c('0x16')](function(_0x38675c){if(_0x38675c){_0x118df9=_0x38675c;_0x403878[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x50')][_0x2a2c('0x29')]);_0x403878[_0x2a2c('0x25')]=_[_0x2a2c('0x2a')](_0x248a54[_0x2a2c('0x25')]);_0x403878[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x403878['model'],_0x403878['query']);_0x406108['attributes']=_[_0x2a2c('0x2c')](_0x403878['model'],qs[_0x2a2c('0x3c')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x406108[_0x2a2c('0x2d')]=_0x406108[_0x2a2c('0x2d')]['length']?_0x406108[_0x2a2c('0x2d')]:_0x403878[_0x2a2c('0x28')];_0x406108[_0x2a2c('0x3f')]=qs[_0x2a2c('0x40')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x40')]);_0x406108[_0x2a2c('0x22')]=qs['filters'](_[_0x2a2c('0x41')](_0x248a54['query'],_0x403878[_0x2a2c('0x2b')]));if(_0x248a54['query'][_0x2a2c('0x43')]){_0x406108[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x406108[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x406108[_0x2a2c('0x2d')],function(_0x417d00){var _0xedd2eb={};_0xedd2eb[_0x417d00]={'$like':'%'+_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x43')]+'%'};return _0xedd2eb;})});}_0x406108=_[_0x2a2c('0x2f')]({},_0x406108,_0x248a54[_0x2a2c('0x30')]);return _0x118df9[_0x2a2c('0x4f')](_0x406108);}})[_0x2a2c('0x16')](function(_0x69a71b){if(_0x69a71b){_0x1cdaf9=_0x69a71b['length'];if(!_0x248a54[_0x2a2c('0x25')]['hasOwnProperty'](_0x2a2c('0x3e'))){_0x406108[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x12')]);_0x406108[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x248a54[_0x2a2c('0x25')][_0x2a2c('0x10')]);}return _0x118df9[_0x2a2c('0x4f')](_0x406108);}})[_0x2a2c('0x16')](function(_0x2d8f67){if(_0x2d8f67){return _0x2d8f67?{'count':_0x1cdaf9,'rows':_0x2d8f67}:null;}})[_0x2a2c('0x16')](respondWithResult(_0x53e483,null))[_0x2a2c('0x27')](handleError(_0x53e483,null));};exports[_0x2a2c('0x51')]=function(_0x51bc88,_0x349caf){var _0x422cf0=_0x51bc88[_0x2a2c('0x37')][_0x2a2c('0x52')];return db['Team'][_0x2a2c('0x26')]({'where':{'id':_0x422cf0},'attributes':['id'],'include':[{'model':db[_0x2a2c('0x45')],'as':_0x2a2c('0x53'),'attributes':['id','name',_0x2a2c('0x54'),_0x2a2c('0x55'),_0x2a2c('0x56')],'raw':!![]}]})['then'](function(_0xd76206){if(_0xd76206){var _0x58511f=_[_0x2a2c('0x57')](_0xd76206,function(_0x4dda22){var _0xf26432=_0x4dda22['get']({'plain':!![]});return _0xf26432['Agents'];});return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x51bc88['params']['id']}})[_0x2a2c('0x16')](function(_0x405745){return db[_0x2a2c('0x58')][_0x2a2c('0x59')](function(_0x3a81fd){return _0x405745[_0x2a2c('0x51')](_0x422cf0,{'transaction':_0x3a81fd})[_0x2a2c('0x16')](function(){return BPromise[_0x2a2c('0x5a')](_0x58511f,function(_0xafcbac){return db[_0x2a2c('0x44')][_0x2a2c('0x5b')]({'where':{'UserId':_0xafcbac['id'],'ChatQueueId':_0x51bc88[_0x2a2c('0x38')]['id']},'transaction':_0x3a81fd});});})[_0x2a2c('0x16')](function(){_0x58511f['forEach'](function(_0x13c657){socket['emit'](_0x2a2c('0x5c'),{'UserId':_0x13c657['id'],'ChatQueueId':_0x405745['id']});});});});});}})[_0x2a2c('0x16')](respondWithStatusCode(_0x349caf,null))[_0x2a2c('0x27')](handleError(_0x349caf,null));};exports[_0x2a2c('0x5d')]=function(_0x224594,_0x31c368){return db['Team']['findAll']({'where':{'id':_0x224594['query'][_0x2a2c('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a2c('0x53'),'attributes':['id'],'raw':!![]}]})[_0x2a2c('0x16')](handleEntityNotFound(_0x31c368,null))[_0x2a2c('0x16')](function(_0x5e961f){var _0x55e1b=_[_0x2a2c('0x1f')](_0x5e961f,'id');var _0x27e858=[];var _0x481f63=[];var _0x21fab6=squel['select']();_0x21fab6[_0x2a2c('0x5e')](_0x2a2c('0x5f'))[_0x2a2c('0x60')]('team_has_chat_queues','tq')[_0x2a2c('0x61')]('user_has_teams','ut',_0x2a2c('0x62'))[_0x2a2c('0x22')](_0x2a2c('0x63'),_0x224594[_0x2a2c('0x38')]['id']);for(var _0x282efe=0x0;_0x282efe<_0x5e961f[_0x2a2c('0x2e')];_0x282efe+=0x1){let _0x2790b1=_0x5e961f[_0x282efe];for(var _0x34d8ff=0x0;_0x34d8ff<_0x2790b1[_0x2a2c('0x53')][_0x2a2c('0x2e')];_0x34d8ff+=0x1){let _0x4211e5=_0x2790b1[_0x2a2c('0x53')][_0x34d8ff];var _0x3b96e2=_0x21fab6[_0x2a2c('0x64')]();_0x3b96e2[_0x2a2c('0x22')]('ut.UserId\x20=\x20?',_0x4211e5['id']);_0x481f63['push'](db['sequelize']['query'](_0x3b96e2['toString'](),{'type':db[_0x2a2c('0x58')][_0x2a2c('0x65')][_0x2a2c('0x66')]})[_0x2a2c('0x16')](function(_0x5622b0){if(_0x5622b0[_0x2a2c('0x2e')]===0x1){return _0x4211e5['id'];}else{var _0x1c5c44=_[_0x2a2c('0x67')](_[_0x2a2c('0x1f')](_0x5622b0,_0x2a2c('0x68')),function(_0x36a46f){return _['includes'](_0x55e1b,_0x36a46f);});if(_0x1c5c44){return _0x4211e5['id'];}}}));}}return BPromise[_0x2a2c('0x69')](_0x481f63)[_0x2a2c('0x16')](function(_0x2896ee){_0x27e858=_(_0x27e858)['union'](_0x2896ee)[_0x2a2c('0x6a')]()['value']();return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x224594[_0x2a2c('0x38')]['id']}})['then'](function(_0x16797d){return db[_0x2a2c('0x58')]['transaction'](function(_0x3ee0b4){return _0x16797d['removeTeams'](_0x224594['query']['ids'],{'transaction':_0x3ee0b4})['then'](function(){if(!_['isEmpty'](_0x27e858)){return _0x16797d['removeAgents'](_0x27e858,{'transaction':_0x3ee0b4});}})['then'](function(){_0x27e858[_0x2a2c('0x6b')](function(_0x111424){socket[_0x2a2c('0x6c')]('userChatQueue:remove',{'UserId':_0x111424,'ChatQueueId':_0x16797d['id']});});});});});});})[_0x2a2c('0x16')](respondWithStatusCode(_0x31c368,null))[_0x2a2c('0x27')](handleError(_0x31c368,null));};exports[_0x2a2c('0x6d')]=function(_0x4f7269,_0x23de46){return db[_0x2a2c('0x23')]['find']({'where':{'id':_0x4f7269['params']['id']}})[_0x2a2c('0x16')](handleEntityNotFound(_0x23de46,null))[_0x2a2c('0x16')](function(_0x522843){if(_0x522843){return _0x522843['addAgents'](_0x4f7269[_0x2a2c('0x37')][_0x2a2c('0x52')],_[_0x2a2c('0x6e')](_0x4f7269[_0x2a2c('0x37')],[_0x2a2c('0x52'),'id'])||{})[_0x2a2c('0x6f')](function(_0x173ec1){for(var _0x149e57=0x0;_0x149e57<_0x4f7269[_0x2a2c('0x37')][_0x2a2c('0x52')][_0x2a2c('0x2e')];_0x149e57+=0x1){socket[_0x2a2c('0x6c')]('userChatQueue:save',{'UserId':Number(_0x4f7269[_0x2a2c('0x37')]['ids'][_0x149e57]),'ChatQueueId':Number(_0x4f7269[_0x2a2c('0x38')]['id'])});}return _0x173ec1;});}})['then'](respondWithResult(_0x23de46,null))[_0x2a2c('0x27')](handleError(_0x23de46,null));};exports[_0x2a2c('0x70')]=function(_0x362945,_0x105a42){return db[_0x2a2c('0x23')][_0x2a2c('0x31')]({'where':{'id':_0x362945[_0x2a2c('0x38')]['id']}})['then'](handleEntityNotFound(_0x105a42,null))[_0x2a2c('0x16')](function(_0x1fa4c4){if(_0x1fa4c4){return _0x1fa4c4[_0x2a2c('0x70')](_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')])[_0x2a2c('0x16')](function(){if(_[_0x2a2c('0x71')](_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')])){for(var _0x4c3f9a=0x0;_0x4c3f9a<_0x362945['query']['ids'][_0x2a2c('0x2e')];_0x4c3f9a+=0x1){socket[_0x2a2c('0x6c')](_0x2a2c('0x72'),{'UserId':Number(_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')][_0x4c3f9a]),'ChatQueueId':Number(_0x362945[_0x2a2c('0x38')]['id'])});}}else{socket[_0x2a2c('0x6c')](_0x2a2c('0x72'),{'UserId':Number(_0x362945[_0x2a2c('0x25')][_0x2a2c('0x52')]),'ChatQueueId':Number(_0x362945['params']['id'])});}});}})[_0x2a2c('0x16')](respondWithStatusCode(_0x105a42,null))['catch'](handleError(_0x105a42,null));};exports[_0x2a2c('0x73')]=function(_0x55237a,_0x56ed26){var _0x1476fd={};var _0x32cc41={};var _0x1cb1fa;var _0x2f7605;return db[_0x2a2c('0x23')][_0x2a2c('0x3b')]({'where':{'id':_0x55237a['params']['id']}})['then'](handleEntityNotFound(_0x56ed26,null))[_0x2a2c('0x16')](function(_0x452047){if(_0x452047){_0x1cb1fa=_0x452047;_0x32cc41[_0x2a2c('0x28')]=_['keys'](db[_0x2a2c('0x45')][_0x2a2c('0x29')]);_0x32cc41[_0x2a2c('0x25')]=_['keys'](_0x55237a[_0x2a2c('0x25')]);_0x32cc41[_0x2a2c('0x2b')]=_[_0x2a2c('0x2c')](_0x32cc41[_0x2a2c('0x28')],_0x32cc41[_0x2a2c('0x25')]);_0x1476fd[_0x2a2c('0x2d')]=_[_0x2a2c('0x2c')](_0x32cc41[_0x2a2c('0x28')],qs['fields'](_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x3c')]));_0x1476fd['attributes']=_0x1476fd[_0x2a2c('0x2d')][_0x2a2c('0x2e')]?_0x1476fd[_0x2a2c('0x2d')]:_0x32cc41[_0x2a2c('0x28')];_0x1476fd['order']=qs[_0x2a2c('0x40')](_0x55237a[_0x2a2c('0x25')]['sort']);_0x1476fd[_0x2a2c('0x22')]=qs[_0x2a2c('0x2b')](_[_0x2a2c('0x41')](_0x55237a[_0x2a2c('0x25')],_0x32cc41['filters']));if(_0x55237a[_0x2a2c('0x25')]['filter']){_0x1476fd[_0x2a2c('0x22')]=_[_0x2a2c('0x2f')](_0x1476fd[_0x2a2c('0x22')],{'$or':_[_0x2a2c('0x1f')](_0x1476fd[_0x2a2c('0x2d')],function(_0x2a4a67){var _0x20c19e={};_0x20c19e[_0x2a4a67]={'$like':'%'+_0x55237a['query'][_0x2a2c('0x43')]+'%'};return _0x20c19e;})});}_0x1476fd=_['merge']({},_0x1476fd,_0x55237a[_0x2a2c('0x30')]);return _0x1cb1fa[_0x2a2c('0x73')](_0x1476fd);}})[_0x2a2c('0x16')](function(_0x4d633a){if(_0x4d633a){_0x2f7605=_0x4d633a[_0x2a2c('0x2e')];if(!_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x3d')](_0x2a2c('0x3e'))){_0x1476fd[_0x2a2c('0x12')]=qs[_0x2a2c('0x12')](_0x55237a[_0x2a2c('0x25')][_0x2a2c('0x12')]);_0x1476fd[_0x2a2c('0x10')]=qs[_0x2a2c('0x10')](_0x55237a[_0x2a2c('0x25')]['offset']);}return _0x1cb1fa['getAgents'](_0x1476fd);}})[_0x2a2c('0x16')](function(_0x142dc9){if(_0x142dc9){return _0x142dc9?{'count':_0x2f7605,'rows':_0x142dc9}:null;}})[_0x2a2c('0x16')](respondWithResult(_0x56ed26,null))[_0x2a2c('0x27')](handleError(_0x56ed26,null));}; \ No newline at end of file +var _0xa81e=['Content-Range','update','then','get','ChatQueues','UserProfileResource','destroy','stack','name','send','map','ChatQueue','fieldName','type','key','where','rows','catch','params','rawAttributes','query','keys','filters','model','attributes','intersection','fields','length','include','merge','options','find','create','body','user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','TeamId','all','union','compact','value','userChatQueue:remove','addAgents','omit','emit','userChatQueue:save','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa81e,0xd9));var _0xea81=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa81e[_0x36c5b0];return _0xf19333;};'use strict';var BPromise=require(_0xea81('0x0'));var util=require('util');var _=require(_0xea81('0x1'));var squel=require(_0xea81('0x2'));var Redis=require(_0xea81('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xea81('0x4'))(_0xea81('0x5'));var config=require('../../config/environment');var db=require(_0xea81('0x6'))['db'];config[_0xea81('0x7')]=_[_0xea81('0x8')](config[_0xea81('0x7')],{'host':_0xea81('0x9'),'port':0x18eb});var socket=require(_0xea81('0xa'))(new Redis(config[_0xea81('0x7')]));require(_0xea81('0xb'))['register'](socket);function respondWithStatusCode(_0x35c403,_0x8611bc){_0x8611bc=_0x8611bc||0xcc;return function(_0x6e6ba5){if(_0x6e6ba5){return _0x35c403[_0xea81('0xc')](_0x8611bc);}return _0x35c403['status'](_0x8611bc)[_0xea81('0xd')]();};}function respondWithResult(_0x24e608,_0x3f7272){_0x3f7272=_0x3f7272||0xc8;return function(_0x4ce4b6){if(_0x4ce4b6){return _0x24e608[_0xea81('0xe')](_0x3f7272)[_0xea81('0xf')](_0x4ce4b6);}};}function respondWithFilteredResult(_0xe52be8,_0x471a17){return function(_0x188b6b){if(_0x188b6b){var _0x32466c=typeof _0x471a17[_0xea81('0x10')]===_0xea81('0x11')&&typeof _0x471a17[_0xea81('0x12')]===_0xea81('0x11');var _0x3c948f=_0x188b6b[_0xea81('0x13')];var _0x1e21e0=_0x32466c?0x0:_0x471a17[_0xea81('0x10')];var _0x310935=_0x32466c?_0x188b6b[_0xea81('0x13')]:_0x471a17[_0xea81('0x10')]+_0x471a17[_0xea81('0x12')];var _0x2f81a8;if(_0x310935>=_0x3c948f){_0x310935=_0x3c948f;_0x2f81a8=0xc8;}else{_0x2f81a8=0xce;}_0xe52be8[_0xea81('0xe')](_0x2f81a8);return _0xe52be8[_0xea81('0x14')](_0xea81('0x15'),_0x1e21e0+'-'+_0x310935+'/'+_0x3c948f)['json'](_0x188b6b);}return null;};}function saveUpdates(_0x921d59){return function(_0x1b83dd){if(_0x1b83dd){return _0x1b83dd[_0xea81('0x16')](_0x921d59)[_0xea81('0x17')](function(_0x382ad6){return _0x382ad6;});}return null;};}function removeEntity(_0x20d38){return function(_0x2cddbb){if(_0x2cddbb){return _0x2cddbb['destroy']()[_0xea81('0x17')](function(){var _0x26abfb=_0x2cddbb[_0xea81('0x18')]({'plain':!![]});var _0x1cd072=_0xea81('0x19');return db[_0xea81('0x1a')][_0xea81('0x1b')]({'where':{'type':_0x1cd072,'resourceId':_0x26abfb['id']}})[_0xea81('0x17')](function(){return _0x2cddbb;});})[_0xea81('0x17')](function(){_0x20d38[_0xea81('0xe')](0xcc)[_0xea81('0xd')]();});}};}function handleEntityNotFound(_0x3cf60d){return function(_0x3a2631){if(!_0x3a2631){_0x3cf60d[_0xea81('0xc')](0x194);}return _0x3a2631;};}function handleError(_0x18522f,_0x499a47){_0x499a47=_0x499a47||0x1f4;return function(_0x18a866){logger['error'](_0x18a866[_0xea81('0x1c')]);if(_0x18a866[_0xea81('0x1d')]){delete _0x18a866['name'];}_0x18522f[_0xea81('0xe')](_0x499a47)[_0xea81('0x1e')](_0x18a866);};}exports['index']=function(_0x15800a,_0x28b69e){var _0x3e3ed1={};var _0x19e02f={'count':0x0,'rows':[]};var _0x51601d=_[_0xea81('0x1f')](db[_0xea81('0x20')]['rawAttributes'],function(_0x582738){return{'name':_0x582738[_0xea81('0x21')],'type':_0x582738[_0xea81('0x22')][_0xea81('0x23')]};});_0x3e3ed1=qs['getOptions'](_0x51601d,_0x15800a);var _0x59d540={'where':_0x3e3ed1[_0xea81('0x24')]};return db[_0xea81('0x20')]['count'](_0x59d540)[_0xea81('0x17')](function(_0x272b93){_0x19e02f[_0xea81('0x13')]=_0x272b93;_0x3e3ed1['include']=qs['include'](_0x15800a['query']);return db[_0xea81('0x20')]['findAll'](_0x3e3ed1);})['then'](function(_0x1950e2){_0x19e02f[_0xea81('0x25')]=_0x1950e2;return _0x19e02f;})[_0xea81('0x17')](respondWithFilteredResult(_0x28b69e,_0x3e3ed1))[_0xea81('0x26')](handleError(_0x28b69e,null));};exports['show']=function(_0x232f2e,_0x27c162){var _0x395e28={'raw':!![],'where':{'id':_0x232f2e[_0xea81('0x27')]['id']}},_0x5ab885={};_0x5ab885['model']=_['keys'](db[_0xea81('0x20')][_0xea81('0x28')]);_0x5ab885[_0xea81('0x29')]=_[_0xea81('0x2a')](_0x232f2e[_0xea81('0x29')]);_0x5ab885[_0xea81('0x2b')]=_['intersection'](_0x5ab885[_0xea81('0x2c')],_0x5ab885[_0xea81('0x29')]);_0x395e28[_0xea81('0x2d')]=_[_0xea81('0x2e')](_0x5ab885[_0xea81('0x2c')],qs[_0xea81('0x2f')](_0x232f2e[_0xea81('0x29')][_0xea81('0x2f')]));_0x395e28['attributes']=_0x395e28[_0xea81('0x2d')][_0xea81('0x30')]?_0x395e28['attributes']:_0x5ab885[_0xea81('0x2c')];if(_0x232f2e[_0xea81('0x29')]['includeAll']){_0x395e28[_0xea81('0x31')]=[{'all':!![]}];}_0x395e28=_[_0xea81('0x32')]({},_0x395e28,_0x232f2e[_0xea81('0x33')]);return db['ChatQueue'][_0xea81('0x34')](_0x395e28)[_0xea81('0x17')](handleEntityNotFound(_0x27c162,null))[_0xea81('0x17')](respondWithResult(_0x27c162,null))[_0xea81('0x26')](handleError(_0x27c162,null));};exports[_0xea81('0x35')]=function(_0x4f8956,_0x110c4c){return db[_0xea81('0x20')][_0xea81('0x35')](_0x4f8956[_0xea81('0x36')],{})['then'](function(_0x5519b9){var _0x535048=_0x4f8956[_0xea81('0x37')][_0xea81('0x18')]({'plain':!![]});if(!_0x535048)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x535048[_0xea81('0x38')]==='user'){var _0x17012c=_0x5519b9[_0xea81('0x18')]({'plain':!![]});var _0x318c7f=_0xea81('0x19');return db[_0xea81('0x39')]['find']({'where':{'name':_0x318c7f,'userProfileId':_0x535048['userProfileId']},'raw':!![]})['then'](function(_0x38fea1){if(_0x38fea1&&_0x38fea1['autoAssociation']===0x0){return db[_0xea81('0x1a')][_0xea81('0x35')]({'name':_0x17012c['name'],'resourceId':_0x17012c['id'],'type':_0x38fea1[_0xea81('0x1d')],'sectionId':_0x38fea1['id']},{})[_0xea81('0x17')](function(){return _0x5519b9;});}else{return _0x5519b9;}})[_0xea81('0x26')](function(_0x3be0f4){logger[_0xea81('0x3a')](_0xea81('0x3b'),_0x3be0f4);throw _0x3be0f4;});}return _0x5519b9;})[_0xea81('0x17')](respondWithResult(_0x110c4c,0xc9))[_0xea81('0x26')](handleError(_0x110c4c,null));};exports['update']=function(_0x56c528,_0x1b5a4e){if(_0x56c528[_0xea81('0x36')]['id']){delete _0x56c528[_0xea81('0x36')]['id'];}return db['ChatQueue'][_0xea81('0x34')]({'where':{'id':_0x56c528[_0xea81('0x27')]['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x1b5a4e,null))['then'](saveUpdates(_0x56c528[_0xea81('0x36')],null))[_0xea81('0x17')](respondWithResult(_0x1b5a4e,null))[_0xea81('0x26')](handleError(_0x1b5a4e,null));};exports[_0xea81('0x1b')]=function(_0x3ad254,_0x563e5b){return db[_0xea81('0x20')][_0xea81('0x34')]({'where':{'id':_0x3ad254[_0xea81('0x27')]['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x563e5b,null))[_0xea81('0x17')](removeEntity(_0x563e5b,null))[_0xea81('0x26')](handleError(_0x563e5b,null));};exports['describe']=function(_0x607467,_0x2282a8){return db[_0xea81('0x20')][_0xea81('0x3c')]()[_0xea81('0x17')](respondWithResult(_0x2282a8,null))[_0xea81('0x26')](handleError(_0x2282a8,null));};exports[_0xea81('0x3d')]=function(_0x2afd28,_0x4e24cc){var _0x2df835={'raw':!![],'where':{}},_0x4190fa={},_0x1be9a0;return db['ChatQueue'][_0xea81('0x3e')]({'where':{'id':_0x2afd28['params']['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x4e24cc,null))['then'](function(_0x2dcc4a){if(_0x2dcc4a){_0x1be9a0=_0x2dcc4a[_0xea81('0x18')]({'plain':!![]});_0x4190fa[_0xea81('0x2c')]=_[_0xea81('0x2a')](db[_0xea81('0x3f')]['rawAttributes']);_0x4190fa[_0xea81('0x29')]=_[_0xea81('0x2a')](_0x2afd28[_0xea81('0x29')]);_0x4190fa[_0xea81('0x2b')]=_[_0xea81('0x2e')](_0x4190fa[_0xea81('0x2c')],_0x4190fa['query']);_0x2df835[_0xea81('0x2d')]=_[_0xea81('0x2e')](_0x4190fa[_0xea81('0x2c')],qs[_0xea81('0x2f')](_0x2afd28['query'][_0xea81('0x2f')]));_0x2df835[_0xea81('0x2d')]=_0x2df835[_0xea81('0x2d')][_0xea81('0x30')]?_0x2df835[_0xea81('0x2d')]:_0x4190fa[_0xea81('0x2c')];if(!_0x2afd28[_0xea81('0x29')][_0xea81('0x40')](_0xea81('0x41'))){_0x2df835[_0xea81('0x12')]=qs[_0xea81('0x12')](_0x2afd28['query'][_0xea81('0x12')]);_0x2df835[_0xea81('0x10')]=qs[_0xea81('0x10')](_0x2afd28['query'][_0xea81('0x10')]);}_0x2df835[_0xea81('0x42')]=qs[_0xea81('0x43')](_0x2afd28[_0xea81('0x29')][_0xea81('0x43')]);_0x2df835[_0xea81('0x24')]=qs['filters'](_[_0xea81('0x44')](_0x2afd28[_0xea81('0x29')],_0x4190fa[_0xea81('0x2b')]));_0x2df835[_0xea81('0x24')][_0xea81('0x45')]=_0x2dcc4a['id'];if(_0x2afd28[_0xea81('0x29')][_0xea81('0x46')]){_0x2df835[_0xea81('0x24')]=_[_0xea81('0x32')](_0x2df835[_0xea81('0x24')],{'$or':_[_0xea81('0x1f')](_0x2df835[_0xea81('0x2d')],function(_0x22bcbf){var _0x53ec52={};_0x53ec52[_0x22bcbf]={'$like':'%'+_0x2afd28['query'][_0xea81('0x46')]+'%'};return _0x53ec52;})});}_0x2df835=_['merge']({},_0x2df835,_0x2afd28[_0xea81('0x33')]);return db['UserChatQueue'][_0xea81('0x47')](_0x2df835);}})[_0xea81('0x17')](function(_0x5898c7){if(_0x5898c7){return db[_0xea81('0x48')]['findAndCountAll']({'where':{'id':_[_0xea81('0x1f')](_0x5898c7,_0xea81('0x49')),'role':_0xea81('0x4a')},'attributes':['id','name',_0xea81('0x4b'),_0xea81('0x4c'),_0xea81('0x4d')]});}})[_0xea81('0x17')](function(_0x57bf4b){if(_0x57bf4b){return{'count':_0x57bf4b['count'],'rows':_[_0xea81('0x1f')](_0x57bf4b[_0xea81('0x25')],function(_0x285c57){return{'membername':_0x285c57[_0xea81('0x1d')],'UserId':_0x285c57['id'],'queue_name':_0x1be9a0[_0xea81('0x1d')],'ChatQueueId':_0x1be9a0['id'],'interface':util[_0xea81('0x4e')](_0xea81('0x4f'),_0xea81('0x50'),_0x285c57[_0xea81('0x1d')]),'penalty':0x0,'paused':_0x285c57['chatPause'],'createdAt':_0x285c57[_0xea81('0x4d')],'updatedAt':_0x285c57['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xea81('0x17')](respondWithFilteredResult(_0x4e24cc,_0x2df835))[_0xea81('0x26')](handleError(_0x4e24cc,null));};exports[_0xea81('0x51')]=function(_0x5f20b0,_0x19aafc){var _0x4f9e15={};var _0x406385={};var _0x49f0cc;var _0x35a932;return db[_0xea81('0x20')][_0xea81('0x3e')]({'where':{'id':_0x5f20b0[_0xea81('0x27')]['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x19aafc,null))[_0xea81('0x17')](function(_0x52faa7){if(_0x52faa7){_0x49f0cc=_0x52faa7;_0x406385[_0xea81('0x2c')]=_[_0xea81('0x2a')](db[_0xea81('0x52')][_0xea81('0x28')]);_0x406385[_0xea81('0x29')]=_[_0xea81('0x2a')](_0x5f20b0[_0xea81('0x29')]);_0x406385['filters']=_[_0xea81('0x2e')](_0x406385[_0xea81('0x2c')],_0x406385[_0xea81('0x29')]);_0x4f9e15[_0xea81('0x2d')]=_['intersection'](_0x406385[_0xea81('0x2c')],qs[_0xea81('0x2f')](_0x5f20b0[_0xea81('0x29')][_0xea81('0x2f')]));_0x4f9e15[_0xea81('0x2d')]=_0x4f9e15[_0xea81('0x2d')]['length']?_0x4f9e15['attributes']:_0x406385[_0xea81('0x2c')];_0x4f9e15[_0xea81('0x42')]=qs[_0xea81('0x43')](_0x5f20b0[_0xea81('0x29')][_0xea81('0x43')]);_0x4f9e15[_0xea81('0x24')]=qs[_0xea81('0x2b')](_[_0xea81('0x44')](_0x5f20b0['query'],_0x406385[_0xea81('0x2b')]));if(_0x5f20b0[_0xea81('0x29')][_0xea81('0x46')]){_0x4f9e15[_0xea81('0x24')]=_[_0xea81('0x32')](_0x4f9e15['where'],{'$or':_[_0xea81('0x1f')](_0x4f9e15[_0xea81('0x2d')],function(_0x447507){var _0x337183={};_0x337183[_0x447507]={'$like':'%'+_0x5f20b0[_0xea81('0x29')]['filter']+'%'};return _0x337183;})});}_0x4f9e15=_['merge']({},_0x4f9e15,_0x5f20b0[_0xea81('0x33')]);return _0x49f0cc[_0xea81('0x51')](_0x4f9e15);}})[_0xea81('0x17')](function(_0x26269e){if(_0x26269e){_0x35a932=_0x26269e[_0xea81('0x30')];if(!_0x5f20b0[_0xea81('0x29')]['hasOwnProperty'](_0xea81('0x41'))){_0x4f9e15[_0xea81('0x12')]=qs['limit'](_0x5f20b0['query']['limit']);_0x4f9e15[_0xea81('0x10')]=qs[_0xea81('0x10')](_0x5f20b0['query']['offset']);}return _0x49f0cc[_0xea81('0x51')](_0x4f9e15);}})[_0xea81('0x17')](function(_0x1db5ad){if(_0x1db5ad){return _0x1db5ad?{'count':_0x35a932,'rows':_0x1db5ad}:null;}})['then'](respondWithResult(_0x19aafc,null))[_0xea81('0x26')](handleError(_0x19aafc,null));};exports[_0xea81('0x53')]=function(_0xf0bfc6,_0xf3bfb7){var _0x4b73f8=_0xf0bfc6[_0xea81('0x36')][_0xea81('0x54')];return db[_0xea81('0x52')][_0xea81('0x47')]({'where':{'id':_0x4b73f8},'attributes':['id'],'include':[{'model':db[_0xea81('0x48')],'as':_0xea81('0x55'),'attributes':['id',_0xea81('0x1d'),_0xea81('0x56'),_0xea81('0x57'),_0xea81('0x58')],'raw':!![]}]})[_0xea81('0x17')](function(_0x1fffc8){if(_0x1fffc8){var _0xe998=_[_0xea81('0x59')](_0x1fffc8,function(_0x1259fe){var _0x149ef7=_0x1259fe[_0xea81('0x18')]({'plain':!![]});return _0x149ef7[_0xea81('0x55')];});return db[_0xea81('0x20')][_0xea81('0x34')]({'where':{'id':_0xf0bfc6[_0xea81('0x27')]['id']}})['then'](function(_0x25c6d6){return db[_0xea81('0x5a')][_0xea81('0x5b')](function(_0x440f58){return _0x25c6d6[_0xea81('0x53')](_0x4b73f8,{'transaction':_0x440f58})[_0xea81('0x17')](function(){return BPromise[_0xea81('0x5c')](_0xe998,function(_0x46c397){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x46c397['id'],'ChatQueueId':_0xf0bfc6['params']['id']},'transaction':_0x440f58});});})[_0xea81('0x17')](function(){_0xe998[_0xea81('0x5d')](function(_0x5be78a){socket['emit']('userChatQueue:save',{'UserId':_0x5be78a['id'],'ChatQueueId':_0x25c6d6['id']});});});});});}})[_0xea81('0x17')](respondWithStatusCode(_0xf3bfb7,null))['catch'](handleError(_0xf3bfb7,null));};exports[_0xea81('0x5e')]=function(_0x5bce8b,_0x164283){return db[_0xea81('0x52')][_0xea81('0x47')]({'where':{'id':_0x5bce8b[_0xea81('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0xea81('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea81('0x17')](handleEntityNotFound(_0x164283,null))[_0xea81('0x17')](function(_0xb4982c){var _0x5a89a9=_['map'](_0xb4982c,'id');var _0x3b3eb8=[];var _0x105f49=[];var _0x49294e=squel[_0xea81('0x5f')]();_0x49294e['field'](_0xea81('0x60'))[_0xea81('0x61')]('team_has_chat_queues','tq')[_0xea81('0x62')](_0xea81('0x63'),'ut',_0xea81('0x64'))[_0xea81('0x24')]('ChatQueueId\x20=\x20?',_0x5bce8b['params']['id']);for(var _0x480825=0x0;_0x480825<_0xb4982c[_0xea81('0x30')];_0x480825+=0x1){let _0x5eb610=_0xb4982c[_0x480825];for(var _0x5ae51f=0x0;_0x5ae51f<_0x5eb610[_0xea81('0x55')]['length'];_0x5ae51f+=0x1){let _0x25d5ee=_0x5eb610[_0xea81('0x55')][_0x5ae51f];var _0x3070dc=_0x49294e[_0xea81('0x65')]();_0x3070dc[_0xea81('0x24')]('ut.UserId\x20=\x20?',_0x25d5ee['id']);_0x105f49[_0xea81('0x66')](db['sequelize'][_0xea81('0x29')](_0x3070dc[_0xea81('0x67')](),{'type':db['sequelize']['QueryTypes'][_0xea81('0x68')]})[_0xea81('0x17')](function(_0x18b9b3){if(_0x18b9b3[_0xea81('0x30')]===0x1){return _0x25d5ee['id'];}else{var _0x58d4cc=_[_0xea81('0x69')](_[_0xea81('0x1f')](_0x18b9b3,_0xea81('0x6a')),function(_0x365748){return _['includes'](_0x5a89a9,_0x365748);});if(_0x58d4cc){return _0x25d5ee['id'];}}}));}}return BPromise[_0xea81('0x6b')](_0x105f49)[_0xea81('0x17')](function(_0x1f50f7){_0x3b3eb8=_(_0x3b3eb8)[_0xea81('0x6c')](_0x1f50f7)[_0xea81('0x6d')]()[_0xea81('0x6e')]();return db[_0xea81('0x20')][_0xea81('0x34')]({'where':{'id':_0x5bce8b[_0xea81('0x27')]['id']}})[_0xea81('0x17')](function(_0x125721){return db[_0xea81('0x5a')]['transaction'](function(_0x4c13ea){return _0x125721['removeTeams'](_0x5bce8b[_0xea81('0x29')][_0xea81('0x54')],{'transaction':_0x4c13ea})['then'](function(){if(!_['isEmpty'](_0x3b3eb8)){return _0x125721['removeAgents'](_0x3b3eb8,{'transaction':_0x4c13ea});}})[_0xea81('0x17')](function(){_0x3b3eb8[_0xea81('0x5d')](function(_0x36ddd8){socket['emit'](_0xea81('0x6f'),{'UserId':_0x36ddd8,'ChatQueueId':_0x125721['id']});});});});});});})[_0xea81('0x17')](respondWithStatusCode(_0x164283,null))[_0xea81('0x26')](handleError(_0x164283,null));};exports[_0xea81('0x70')]=function(_0x30a205,_0x1111d2){return db['ChatQueue']['find']({'where':{'id':_0x30a205[_0xea81('0x27')]['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x1111d2,null))[_0xea81('0x17')](function(_0x48f1ba){if(_0x48f1ba){return _0x48f1ba[_0xea81('0x70')](_0x30a205[_0xea81('0x36')][_0xea81('0x54')],_[_0xea81('0x71')](_0x30a205[_0xea81('0x36')],[_0xea81('0x54'),'id'])||{})['spread'](function(_0x31ddf3){for(var _0x3af40c=0x0;_0x3af40c<_0x30a205[_0xea81('0x36')]['ids'][_0xea81('0x30')];_0x3af40c+=0x1){socket[_0xea81('0x72')](_0xea81('0x73'),{'UserId':Number(_0x30a205[_0xea81('0x36')]['ids'][_0x3af40c]),'ChatQueueId':Number(_0x30a205[_0xea81('0x27')]['id'])});}return _0x31ddf3;});}})[_0xea81('0x17')](respondWithResult(_0x1111d2,null))[_0xea81('0x26')](handleError(_0x1111d2,null));};exports[_0xea81('0x74')]=function(_0x2a5658,_0x29f591){return db[_0xea81('0x20')][_0xea81('0x34')]({'where':{'id':_0x2a5658[_0xea81('0x27')]['id']}})['then'](handleEntityNotFound(_0x29f591,null))[_0xea81('0x17')](function(_0x1cc1f9){if(_0x1cc1f9){return _0x1cc1f9[_0xea81('0x74')](_0x2a5658[_0xea81('0x29')][_0xea81('0x54')])[_0xea81('0x17')](function(){if(_[_0xea81('0x75')](_0x2a5658['query'][_0xea81('0x54')])){for(var _0x5b8b8f=0x0;_0x5b8b8f<_0x2a5658[_0xea81('0x29')][_0xea81('0x54')][_0xea81('0x30')];_0x5b8b8f+=0x1){socket[_0xea81('0x72')](_0xea81('0x6f'),{'UserId':Number(_0x2a5658[_0xea81('0x29')][_0xea81('0x54')][_0x5b8b8f]),'ChatQueueId':Number(_0x2a5658[_0xea81('0x27')]['id'])});}}else{socket['emit'](_0xea81('0x6f'),{'UserId':Number(_0x2a5658['query'][_0xea81('0x54')]),'ChatQueueId':Number(_0x2a5658[_0xea81('0x27')]['id'])});}});}})[_0xea81('0x17')](respondWithStatusCode(_0x29f591,null))[_0xea81('0x26')](handleError(_0x29f591,null));};exports[_0xea81('0x76')]=function(_0x5742a1,_0x980b0a){var _0x1b5ee0={};var _0x27e2d6={};var _0x338793;var _0xeba39b;return db[_0xea81('0x20')][_0xea81('0x3e')]({'where':{'id':_0x5742a1['params']['id']}})[_0xea81('0x17')](handleEntityNotFound(_0x980b0a,null))[_0xea81('0x17')](function(_0x369149){if(_0x369149){_0x338793=_0x369149;_0x27e2d6[_0xea81('0x2c')]=_[_0xea81('0x2a')](db['User'][_0xea81('0x28')]);_0x27e2d6[_0xea81('0x29')]=_[_0xea81('0x2a')](_0x5742a1[_0xea81('0x29')]);_0x27e2d6['filters']=_['intersection'](_0x27e2d6[_0xea81('0x2c')],_0x27e2d6[_0xea81('0x29')]);_0x1b5ee0[_0xea81('0x2d')]=_[_0xea81('0x2e')](_0x27e2d6[_0xea81('0x2c')],qs[_0xea81('0x2f')](_0x5742a1['query'][_0xea81('0x2f')]));_0x1b5ee0[_0xea81('0x2d')]=_0x1b5ee0[_0xea81('0x2d')][_0xea81('0x30')]?_0x1b5ee0[_0xea81('0x2d')]:_0x27e2d6[_0xea81('0x2c')];_0x1b5ee0[_0xea81('0x42')]=qs[_0xea81('0x43')](_0x5742a1[_0xea81('0x29')]['sort']);_0x1b5ee0[_0xea81('0x24')]=qs[_0xea81('0x2b')](_[_0xea81('0x44')](_0x5742a1[_0xea81('0x29')],_0x27e2d6[_0xea81('0x2b')]));if(_0x5742a1[_0xea81('0x29')][_0xea81('0x46')]){_0x1b5ee0[_0xea81('0x24')]=_[_0xea81('0x32')](_0x1b5ee0[_0xea81('0x24')],{'$or':_['map'](_0x1b5ee0['attributes'],function(_0x831de3){var _0x3260d1={};_0x3260d1[_0x831de3]={'$like':'%'+_0x5742a1[_0xea81('0x29')][_0xea81('0x46')]+'%'};return _0x3260d1;})});}_0x1b5ee0=_[_0xea81('0x32')]({},_0x1b5ee0,_0x5742a1[_0xea81('0x33')]);return _0x338793[_0xea81('0x76')](_0x1b5ee0);}})[_0xea81('0x17')](function(_0x13af19){if(_0x13af19){_0xeba39b=_0x13af19[_0xea81('0x30')];if(!_0x5742a1[_0xea81('0x29')][_0xea81('0x40')]('nolimit')){_0x1b5ee0[_0xea81('0x12')]=qs['limit'](_0x5742a1[_0xea81('0x29')][_0xea81('0x12')]);_0x1b5ee0[_0xea81('0x10')]=qs[_0xea81('0x10')](_0x5742a1[_0xea81('0x29')]['offset']);}return _0x338793[_0xea81('0x76')](_0x1b5ee0);}})[_0xea81('0x17')](function(_0x52a096){if(_0x52a096){return _0x52a096?{'count':_0xeba39b,'rows':_0x52a096}:null;}})['then'](respondWithResult(_0x980b0a,null))[_0xea81('0x26')](handleError(_0x980b0a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5245041..f58e26b 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 _0x3c17=['exports','events','ChatQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3c17,0xe1));var _0x73c1=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3c17[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x73c1('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x73c1('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x73c1('0x2')](0x0);var events={'afterCreate':_0x73c1('0x3'),'afterUpdate':'update','afterDestroy':_0x73c1('0x4')};function emitEvent(_0x534a6d){return function(_0x4802c2,_0x283ff3,_0x3d477b){ChatQueueEvents[_0x73c1('0x5')](_0x534a6d+':'+_0x4802c2['id'],_0x4802c2);ChatQueueEvents['emit'](_0x534a6d,_0x4802c2);_0x3d477b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x73c1('0x6')](e,emitEvent(event));}}module[_0x73c1('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x1fc9=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3f9b27,_0x4e2807){var _0x4e08e6=function(_0x32a9da){while(--_0x32a9da){_0x3f9b27['push'](_0x3f9b27['shift']());}};_0x4e08e6(++_0x4e2807);}(_0x1fc9,0x136));var _0x91fc=function(_0x13a42e,_0x1078ba){_0x13a42e=_0x13a42e-0x0;var _0x293c67=_0x1fc9[_0x13a42e];return _0x293c67;};'use strict';var EventEmitter=require(_0x91fc('0x0'));var ChatQueue=require(_0x91fc('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x91fc('0x2')](0x0);var events={'afterCreate':_0x91fc('0x3'),'afterUpdate':'update','afterDestroy':_0x91fc('0x4')};function emitEvent(_0xb05d6f){return function(_0x1452d6,_0x33aeb2,_0x1dca20){ChatQueueEvents[_0x91fc('0x5')](_0xb05d6f+':'+_0x1452d6['id'],_0x1452d6);ChatQueueEvents[_0x91fc('0x5')](_0xb05d6f,_0x1452d6);_0x1dca20(null);};}for(var e in events){if(events[_0x91fc('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x91fc('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7938f6e..48ee680 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 _0x9f6c=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x37c767,_0x4f2a84){var _0x3f711f=function(_0x566246){while(--_0x566246){_0x37c767['push'](_0x37c767['shift']());}};_0x3f711f(++_0x4f2a84);}(_0x9f6c,0x74));var _0xc9f6=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0x9f6c[_0x26299e];return _0x6c4f4a;};'use strict';var _=require(_0xc9f6('0x0'));var util=require(_0xc9f6('0x1'));var logger=require(_0xc9f6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc9f6('0x3'));var rp=require(_0xc9f6('0x4'));var fs=require('fs');var path=require(_0xc9f6('0x5'));var rimraf=require(_0xc9f6('0x6'));var config=require(_0xc9f6('0x7'));var attributes=require(_0xc9f6('0x8'));module[_0xc9f6('0x9')]=function(_0x5828bc,_0x7b3049){return _0x5828bc['define'](_0xc9f6('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee0=['../../config/environment','./chatQueue.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b1c55,_0x23903f){var _0x508da1=function(_0x52747d){while(--_0x52747d){_0x1b1c55['push'](_0x1b1c55['shift']());}};_0x508da1(++_0x23903f);}(_0x4ee0,0x1f2));var _0x04ee=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x4ee0[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x04ee('0x0'));var util=require(_0x04ee('0x1'));var logger=require(_0x04ee('0x2'))('api');var moment=require(_0x04ee('0x3'));var BPromise=require(_0x04ee('0x4'));var rp=require(_0x04ee('0x5'));var fs=require('fs');var path=require(_0x04ee('0x6'));var rimraf=require(_0x04ee('0x7'));var config=require(_0x04ee('0x8'));var attributes=require(_0x04ee('0x9'));module[_0x04ee('0xa')]=function(_0x45021d,_0x565051){return _0x45021d['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e77570f..595c247 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 _0x3eae=['http','redis','defaults','localhost','./chatQueue.socket','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x100257,_0x4ab625){var _0x39abbc=function(_0x30c635){while(--_0x30c635){_0x100257['push'](_0x100257['shift']());}};_0x39abbc(++_0x4ab625);}(_0x3eae,0x126));var _0xe3ea=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x3eae[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3ea('0x4'));var db=require(_0xe3ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ea('0x6'))(_0xe3ea('0x7'));var config=require(_0xe3ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3ea('0x9')][_0xe3ea('0xa')]({'port':0x232a});config[_0xe3ea('0xb')]=_[_0xe3ea('0xc')](config[_0xe3ea('0xb')],{'host':_0xe3ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3ea('0xb')]));require(_0xe3ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x32a059,_0x23ca3e,_0x23134e){return new BPromise(function(_0x2afd60,_0x1db54c){return client['request'](_0x32a059,_0x23134e)[_0xe3ea('0xf')](function(_0x3236c0){logger[_0xe3ea('0x10')]('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));logger[_0xe3ea('0x12')](_0xe3ea('0x13'),_0x23ca3e,_0xe3ea('0x11'),JSON[_0xe3ea('0x14')](_0x3236c0));if(_0x3236c0[_0xe3ea('0x15')]){if(_0x3236c0['error']['code']===0x1f4){logger[_0xe3ea('0x15')](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);return _0x1db54c(_0x3236c0[_0xe3ea('0x15')]['message']);}logger['error'](_0xe3ea('0x16'),_0x23ca3e,_0x3236c0[_0xe3ea('0x15')]['message']);return _0x2afd60(_0x3236c0[_0xe3ea('0x15')][_0xe3ea('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0xe3ea('0x11'));_0x2afd60(_0x3236c0[_0xe3ea('0x18')][_0xe3ea('0x17')]);}})[_0xe3ea('0x19')](function(_0x12de73){logger[_0xe3ea('0x15')]('ChatQueue,\x20%s,\x20%s',_0x23ca3e,_0x12de73);_0x1db54c(_0x12de73);});});}exports['GetChatQueue']=function(_0x165f53){var _0x5d0ca4=this;return new Promise(function(_0x52df79,_0xcbb4db){return db[_0xe3ea('0x1a')][_0xe3ea('0x1b')]({'raw':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1e')]||null:null,'attributes':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x1f')]||null:null,'limit':_0x165f53[_0xe3ea('0x1c')]?_0x165f53['options'][_0xe3ea('0x20')]||null:null,'include':_0x165f53[_0xe3ea('0x1c')]?_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x165f53[_0xe3ea('0x1c')][_0xe3ea('0x21')],function(_0x5305e1){return{'model':db[_0x5305e1[_0xe3ea('0x23')]],'as':_0x5305e1['as'],'attributes':_0x5305e1[_0xe3ea('0x1f')],'include':_0x5305e1['include']?_[_0xe3ea('0x22')](_0x5305e1[_0xe3ea('0x21')],function(_0x218dcb){return{'model':db[_0x218dcb[_0xe3ea('0x23')]],'as':_0x218dcb['as'],'attributes':_0x218dcb['attributes'],'include':_0x218dcb['include']?_[_0xe3ea('0x22')](_0x218dcb['include'],function(_0x3032b1){return{'model':db[_0x3032b1[_0xe3ea('0x23')]],'as':_0x3032b1['as'],'attributes':_0x3032b1[_0xe3ea('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x115a78){logger['info'](_0xe3ea('0x24'),_0x165f53);logger[_0xe3ea('0x12')](_0xe3ea('0x24'),_0x165f53,JSON[_0xe3ea('0x14')](_0x115a78));_0x52df79(_0x115a78);})[_0xe3ea('0x19')](function(_0x56be4a){logger[_0xe3ea('0x15')](_0xe3ea('0x24'),_0x56be4a[_0xe3ea('0x17')],_0x165f53);_0xcbb4db(_0x5d0ca4[_0xe3ea('0x15')](0x1f4,_0x56be4a['message']));});});};exports['ShowChatQueue']=function(_0x2ab595){var _0x42be18=this;return new Promise(function(_0x723a3a,_0xcbfea2){return db[_0xe3ea('0x1a')]['find']({'raw':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595[_0xe3ea('0x1c')]['where']||null:null,'attributes':_0x2ab595['options']?_0x2ab595[_0xe3ea('0x1c')][_0xe3ea('0x1f')]||null:null,'include':_0x2ab595[_0xe3ea('0x1c')]?_0x2ab595[_0xe3ea('0x1c')][_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x2ab595['options'][_0xe3ea('0x21')],function(_0x419b5f){return{'model':db[_0x419b5f[_0xe3ea('0x23')]],'as':_0x419b5f['as'],'attributes':_0x419b5f[_0xe3ea('0x1f')],'include':_0x419b5f[_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0x419b5f[_0xe3ea('0x21')],function(_0xbfc054){return{'model':db[_0xbfc054[_0xe3ea('0x23')]],'as':_0xbfc054['as'],'attributes':_0xbfc054[_0xe3ea('0x1f')],'include':_0xbfc054[_0xe3ea('0x21')]?_[_0xe3ea('0x22')](_0xbfc054[_0xe3ea('0x21')],function(_0x3f6f3a){return{'model':db[_0x3f6f3a['model']],'as':_0x3f6f3a['as'],'attributes':_0x3f6f3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3ea('0xf')](function(_0x28d670){logger[_0xe3ea('0x10')]('ShowChatQueue',_0x2ab595);logger[_0xe3ea('0x12')](_0xe3ea('0x25'),_0x2ab595,JSON[_0xe3ea('0x14')](_0x28d670));_0x723a3a(_0x28d670);})[_0xe3ea('0x19')](function(_0x369818){logger['error'](_0xe3ea('0x25'),_0x369818['message'],_0x2ab595);_0xcbfea2(_0x42be18['error'](0x1f4,_0x369818[_0xe3ea('0x17')]));});});}; \ No newline at end of file +var _0x8dd6=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','findAll','options','raw','limit','include','map','attributes','model','then','ShowChatQueue','ChatQueue','find','where','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x8dd6,0xcd));var _0x68dd=function(_0x2caf55,_0xb80b11){_0x2caf55=_0x2caf55-0x0;var _0xfbaf=_0x8dd6[_0x2caf55];return _0xfbaf;};'use strict';var _=require(_0x68dd('0x0'));var util=require('util');var moment=require(_0x68dd('0x1'));var BPromise=require(_0x68dd('0x2'));var rs=require(_0x68dd('0x3'));var fs=require('fs');var Redis=require(_0x68dd('0x4'));var db=require(_0x68dd('0x5'))['db'];var utils=require(_0x68dd('0x6'));var logger=require(_0x68dd('0x7'))(_0x68dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x68dd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x68dd('0xa')]=_[_0x68dd('0xb')](config[_0x68dd('0xa')],{'host':_0x68dd('0xc'),'port':0x18eb});var socket=require(_0x68dd('0xd'))(new Redis(config[_0x68dd('0xa')]));require(_0x68dd('0xe'))[_0x68dd('0xf')](socket);function respondWithRpcPromise(_0x986a9a,_0x5173df,_0x5bfd09){return new BPromise(function(_0x2b0b2b,_0x3e9fc1){return client[_0x68dd('0x10')](_0x986a9a,_0x5bfd09)['then'](function(_0x2672a2){logger['info']('ChatQueue,\x20%s,\x20%s',_0x5173df,'request\x20sent');logger[_0x68dd('0x11')](_0x68dd('0x12'),_0x5173df,_0x68dd('0x13'),JSON[_0x68dd('0x14')](_0x2672a2));if(_0x2672a2[_0x68dd('0x15')]){if(_0x2672a2['error'][_0x68dd('0x16')]===0x1f4){logger[_0x68dd('0x15')](_0x68dd('0x17'),_0x5173df,_0x2672a2[_0x68dd('0x15')][_0x68dd('0x18')]);return _0x3e9fc1(_0x2672a2[_0x68dd('0x15')][_0x68dd('0x18')]);}logger[_0x68dd('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5173df,_0x2672a2['error'][_0x68dd('0x18')]);return _0x2b0b2b(_0x2672a2[_0x68dd('0x15')]['message']);}else{logger[_0x68dd('0x19')](_0x68dd('0x17'),_0x5173df,_0x68dd('0x13'));_0x2b0b2b(_0x2672a2[_0x68dd('0x1a')][_0x68dd('0x18')]);}})[_0x68dd('0x1b')](function(_0x439aa5){logger[_0x68dd('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5173df,_0x439aa5);_0x3e9fc1(_0x439aa5);});});}exports[_0x68dd('0x1c')]=function(_0x30bfd8){var _0x3aec26=this;return new Promise(function(_0x19594f,_0x20aad5){return db['ChatQueue'][_0x68dd('0x1d')]({'raw':_0x30bfd8[_0x68dd('0x1e')]?_0x30bfd8[_0x68dd('0x1e')][_0x68dd('0x1f')]===undefined?!![]:![]:!![],'where':_0x30bfd8[_0x68dd('0x1e')]?_0x30bfd8[_0x68dd('0x1e')]['where']||null:null,'attributes':_0x30bfd8[_0x68dd('0x1e')]?_0x30bfd8['options']['attributes']||null:null,'limit':_0x30bfd8[_0x68dd('0x1e')]?_0x30bfd8[_0x68dd('0x1e')][_0x68dd('0x20')]||null:null,'include':_0x30bfd8[_0x68dd('0x1e')]?_0x30bfd8['options'][_0x68dd('0x21')]?_[_0x68dd('0x22')](_0x30bfd8[_0x68dd('0x1e')]['include'],function(_0x1505d6){return{'model':db[_0x1505d6['model']],'as':_0x1505d6['as'],'attributes':_0x1505d6[_0x68dd('0x23')],'include':_0x1505d6[_0x68dd('0x21')]?_[_0x68dd('0x22')](_0x1505d6[_0x68dd('0x21')],function(_0x3f9e01){return{'model':db[_0x3f9e01['model']],'as':_0x3f9e01['as'],'attributes':_0x3f9e01[_0x68dd('0x23')],'include':_0x3f9e01['include']?_['map'](_0x3f9e01['include'],function(_0x1b75ab){return{'model':db[_0x1b75ab[_0x68dd('0x24')]],'as':_0x1b75ab['as'],'attributes':_0x1b75ab[_0x68dd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68dd('0x25')](function(_0x1b1299){logger['info'](_0x68dd('0x1c'),_0x30bfd8);logger[_0x68dd('0x11')]('GetChatQueue',_0x30bfd8,JSON[_0x68dd('0x14')](_0x1b1299));_0x19594f(_0x1b1299);})[_0x68dd('0x1b')](function(_0xd64e08){logger[_0x68dd('0x15')](_0x68dd('0x1c'),_0xd64e08[_0x68dd('0x18')],_0x30bfd8);_0x20aad5(_0x3aec26['error'](0x1f4,_0xd64e08[_0x68dd('0x18')]));});});};exports[_0x68dd('0x26')]=function(_0x376e84){var _0x1ea727=this;return new Promise(function(_0x563d33,_0x297563){return db[_0x68dd('0x27')][_0x68dd('0x28')]({'raw':_0x376e84[_0x68dd('0x1e')]?_0x376e84[_0x68dd('0x1e')][_0x68dd('0x1f')]===undefined?!![]:![]:!![],'where':_0x376e84['options']?_0x376e84['options'][_0x68dd('0x29')]||null:null,'attributes':_0x376e84['options']?_0x376e84[_0x68dd('0x1e')][_0x68dd('0x23')]||null:null,'include':_0x376e84[_0x68dd('0x1e')]?_0x376e84[_0x68dd('0x1e')][_0x68dd('0x21')]?_['map'](_0x376e84['options'][_0x68dd('0x21')],function(_0x1e2245){return{'model':db[_0x1e2245[_0x68dd('0x24')]],'as':_0x1e2245['as'],'attributes':_0x1e2245['attributes'],'include':_0x1e2245['include']?_[_0x68dd('0x22')](_0x1e2245[_0x68dd('0x21')],function(_0x2f9854){return{'model':db[_0x2f9854[_0x68dd('0x24')]],'as':_0x2f9854['as'],'attributes':_0x2f9854[_0x68dd('0x23')],'include':_0x2f9854[_0x68dd('0x21')]?_['map'](_0x2f9854[_0x68dd('0x21')],function(_0x264dae){return{'model':db[_0x264dae['model']],'as':_0x264dae['as'],'attributes':_0x264dae[_0x68dd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68dd('0x25')](function(_0x1a9f77){logger[_0x68dd('0x19')](_0x68dd('0x26'),_0x376e84);logger[_0x68dd('0x11')](_0x68dd('0x26'),_0x376e84,JSON[_0x68dd('0x14')](_0x1a9f77));_0x563d33(_0x1a9f77);})[_0x68dd('0x1b')](function(_0x369af0){logger[_0x68dd('0x15')](_0x68dd('0x26'),_0x369af0['message'],_0x376e84);_0x297563(_0x1ea727['error'](0x1f4,_0x369af0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6ce3932..70f07aa 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 _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x72b1,0x16e));var _0x172b=function(_0x4fe957,_0x490d45){_0x4fe957=_0x4fe957-0x0;var _0x3419a0=_0x72b1[_0x4fe957];return _0x3419a0;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0x4bc3=['register','chatQueue:','./chatQueue.events','save','update','emit','removeListener'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x4bc3,0x16e));var _0x34bc=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x4bc3[_0x3070dc];return _0x431489;};'use strict';var ChatQueueEvents=require(_0x34bc('0x0'));var events=[_0x34bc('0x1'),'remove',_0x34bc('0x2')];function createListener(_0x2c0897,_0x5b45c7){return function(_0x178fc0){_0x5b45c7[_0x34bc('0x3')](_0x2c0897,_0x178fc0);};}function removeListener(_0x3ce1c3,_0x2e043e){return function(){ChatQueueEvents[_0x34bc('0x4')](_0x3ce1c3,_0x2e043e);};}exports[_0x34bc('0x5')]=function(_0x2cc9c2){for(var _0x4c63a1=0x0,_0x21451b=events['length'];_0x4c63a1<_0x21451b;_0x4c63a1++){var _0x502087=events[_0x4c63a1];var _0x18a01c=createListener(_0x34bc('0x6')+_0x502087,_0x2cc9c2);ChatQueueEvents['on'](_0x502087,_0x18a01c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 910bb41..55b2a9c 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23b83e,_0x372f4b){var _0x19e3bd=function(_0x6b7c5b){while(--_0x6b7c5b){_0x23b83e['push'](_0x23b83e['shift']());}};_0x19e3bd(++_0x372f4b);}(_0x008c,0x188));var _0xc008=function(_0x2b6854,_0xf09496){_0x2b6854=_0x2b6854-0x0;var _0x3a17df=_0x008c[_0x2b6854];return _0x3a17df;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x2fe130,_0x1bf216){_0x2fe130=_0x2fe130-0x0;var _0x46580c=_0x3e74[_0x2fe130];return _0x46580c;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cc9551f..7506bba 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 _0xd1c5=['sequelize','STRING','DATE','moment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xd1c5,0x18f));var _0x5d1c=function(_0x37ab60,_0x172f30){_0x37ab60=_0x37ab60-0x0;var _0x332e35=_0xd1c5[_0x37ab60];return _0x332e35;};'use strict';var moment=require(_0x5d1c('0x0'));var Sequelize=require(_0x5d1c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5d1c('0x2')]},'joinAt':{'type':Sequelize[_0x5d1c('0x3')]},'leaveAt':{'type':Sequelize[_0x5d1c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5d1c('0x3')]},'reason':{'type':Sequelize[_0x5d1c('0x2')]}}; \ No newline at end of file +var _0xe8f7=['exports','STRING','DATE','moment'];(function(_0x1bb0be,_0x1de4da){var _0x4f9d06=function(_0x130e2c){while(--_0x130e2c){_0x1bb0be['push'](_0x1bb0be['shift']());}};_0x4f9d06(++_0x1de4da);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7e8f('0x0'));var Sequelize=require('sequelize');module[_0x7e8f('0x1')]={'uniqueid':{'type':Sequelize[_0x7e8f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7e8f('0x2')]},'joinAt':{'type':Sequelize[_0x7e8f('0x3')]},'leaveAt':{'type':Sequelize[_0x7e8f('0x3')]},'acceptAt':{'type':Sequelize[_0x7e8f('0x3')]},'exitAt':{'type':Sequelize[_0x7e8f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 292b8cb..a87b37d 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 _0x7a12=['create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','save','update','destroy','then','end','error','name','send','ChatQueueReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','keys','find'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a12,0xe8));var _0x27a1=function(_0x1e8bd0,_0x30bfde){_0x1e8bd0=_0x1e8bd0-0x0;var _0x315809=_0x7a12[_0x1e8bd0];return _0x315809;};'use strict';var emlformat=require(_0x27a1('0x0'));var rimraf=require(_0x27a1('0x1'));var zipdir=require(_0x27a1('0x2'));var jsonpatch=require(_0x27a1('0x3'));var rp=require(_0x27a1('0x4'));var moment=require(_0x27a1('0x5'));var BPromise=require(_0x27a1('0x6'));var Mustache=require(_0x27a1('0x7'));var util=require('util');var path=require(_0x27a1('0x8'));var sox=require(_0x27a1('0x9'));var csv=require(_0x27a1('0xa'));var ejs=require(_0x27a1('0xb'));var fs=require('fs');var fs_extra=require(_0x27a1('0xc'));var _=require(_0x27a1('0xd'));var squel=require('squel');var crypto=require(_0x27a1('0xe'));var jsforce=require(_0x27a1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x27a1('0xa'));var querystring=require(_0x27a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x27a1('0x11'));var authService=require(_0x27a1('0x12'));var qs=require(_0x27a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a1('0x14'));var logger=require(_0x27a1('0x15'))(_0x27a1('0x16'));var utils=require(_0x27a1('0x17'));var config=require(_0x27a1('0x18'));var licenseUtil=require(_0x27a1('0x19'));var db=require(_0x27a1('0x1a'))['db'];function respondWithStatusCode(_0x52cf92,_0x11d503){_0x11d503=_0x11d503||0xcc;return function(_0x37aec2){if(_0x37aec2){return _0x52cf92[_0x27a1('0x1b')](_0x11d503);}return _0x52cf92[_0x27a1('0x1c')](_0x11d503)['end']();};}function respondWithResult(_0x303b65,_0x11d840){_0x11d840=_0x11d840||0xc8;return function(_0x4e5cdd){if(_0x4e5cdd){return _0x303b65['status'](_0x11d840)[_0x27a1('0x1d')](_0x4e5cdd);}};}function respondWithFilteredResult(_0x3fc406,_0x4f6871){return function(_0x443cff){if(_0x443cff){var _0x17ebb1=typeof _0x4f6871['offset']===_0x27a1('0x1e')&&typeof _0x4f6871[_0x27a1('0x1f')]===_0x27a1('0x1e');var _0xbd87d1=_0x443cff['count'];var _0x18512a=_0x17ebb1?0x0:_0x4f6871['offset'];var _0x8c969=_0x17ebb1?_0x443cff[_0x27a1('0x20')]:_0x4f6871['offset']+_0x4f6871[_0x27a1('0x1f')];var _0x28a621;if(_0x8c969>=_0xbd87d1){_0x8c969=_0xbd87d1;_0x28a621=0xc8;}else{_0x28a621=0xce;}_0x3fc406[_0x27a1('0x1c')](_0x28a621);return _0x3fc406[_0x27a1('0x21')]('Content-Range',_0x18512a+'-'+_0x8c969+'/'+_0xbd87d1)[_0x27a1('0x1d')](_0x443cff);}return null;};}function patchUpdates(_0x4271e7){return function(_0x38c9ca){try{jsonpatch[_0x27a1('0x22')](_0x38c9ca,_0x4271e7,!![]);}catch(_0x1b6531){return BPromise['reject'](_0x1b6531);}return _0x38c9ca[_0x27a1('0x23')]();};}function saveUpdates(_0xd6cc72,_0x4f11d3){return function(_0x4c02f8){if(_0x4c02f8){return _0x4c02f8[_0x27a1('0x24')](_0xd6cc72)['then'](function(_0x17e881){return _0x17e881;});}return null;};}function removeEntity(_0x2a3b02,_0x21c37e){return function(_0x2a1f12){if(_0x2a1f12){return _0x2a1f12[_0x27a1('0x25')]()[_0x27a1('0x26')](function(){_0x2a3b02['status'](0xcc)[_0x27a1('0x27')]();});}};}function handleEntityNotFound(_0x25307a,_0x5b58a2){return function(_0x348605){if(!_0x348605){_0x25307a['sendStatus'](0x194);}return _0x348605;};}function handleError(_0x1ef90c,_0x5d4b36){_0x5d4b36=_0x5d4b36||0x1f4;return function(_0x19d9b5){logger[_0x27a1('0x28')](_0x19d9b5['stack']);if(_0x19d9b5[_0x27a1('0x29')]){delete _0x19d9b5[_0x27a1('0x29')];}_0x1ef90c[_0x27a1('0x1c')](_0x5d4b36)[_0x27a1('0x2a')](_0x19d9b5);};}exports['index']=function(_0x353b18,_0x4ecc83){var _0x2089aa={},_0x23e8b2={},_0x3f0194={'count':0x0,'rows':[]};var _0x376f32=_['map'](db[_0x27a1('0x2b')][_0x27a1('0x2c')],function(_0x36c597){return{'name':_0x36c597[_0x27a1('0x2d')],'type':_0x36c597[_0x27a1('0x2e')]['key']};});_0x23e8b2[_0x27a1('0x2f')]=_['map'](_0x376f32,_0x27a1('0x29'));_0x23e8b2[_0x27a1('0x30')]=_['keys'](_0x353b18[_0x27a1('0x30')]);_0x23e8b2['filters']=_[_0x27a1('0x31')](_0x23e8b2[_0x27a1('0x2f')],_0x23e8b2[_0x27a1('0x30')]);_0x2089aa['attributes']=_['intersection'](_0x23e8b2[_0x27a1('0x2f')],qs['fields'](_0x353b18['query'][_0x27a1('0x32')]));_0x2089aa[_0x27a1('0x33')]=_0x2089aa[_0x27a1('0x33')][_0x27a1('0x34')]?_0x2089aa[_0x27a1('0x33')]:_0x23e8b2[_0x27a1('0x2f')];if(!_0x353b18[_0x27a1('0x30')][_0x27a1('0x35')]('nolimit')){_0x2089aa['limit']=qs['limit'](_0x353b18[_0x27a1('0x30')][_0x27a1('0x1f')]);_0x2089aa[_0x27a1('0x36')]=qs[_0x27a1('0x36')](_0x353b18['query']['offset']);}_0x2089aa[_0x27a1('0x37')]=qs[_0x27a1('0x38')](_0x353b18[_0x27a1('0x30')][_0x27a1('0x38')]);_0x2089aa[_0x27a1('0x39')]=qs[_0x27a1('0x3a')](_[_0x27a1('0x3b')](_0x353b18['query'],_0x23e8b2['filters']),_0x376f32);if(_0x353b18[_0x27a1('0x30')][_0x27a1('0x3c')]){_0x2089aa[_0x27a1('0x39')]=_['merge'](_0x2089aa[_0x27a1('0x39')],{'$or':_[_0x27a1('0x3d')](_0x376f32,function(_0x1193a6){if(_0x1193a6[_0x27a1('0x2e')]!=='VIRTUAL'){var _0x146352={};_0x146352[_0x1193a6[_0x27a1('0x29')]]={'$like':'%'+_0x353b18[_0x27a1('0x30')][_0x27a1('0x3c')]+'%'};return _0x146352;}})});}_0x2089aa=_[_0x27a1('0x3e')]({},_0x2089aa,_0x353b18[_0x27a1('0x3f')]);var _0x2a5bd1={'where':_0x2089aa[_0x27a1('0x39')]};return db[_0x27a1('0x2b')][_0x27a1('0x20')](_0x2a5bd1)[_0x27a1('0x26')](function(_0x1b9e37){_0x3f0194['count']=_0x1b9e37;if(_0x353b18[_0x27a1('0x30')][_0x27a1('0x40')]){_0x2089aa[_0x27a1('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x27a1('0x42')](_0x2089aa);})['then'](function(_0x1e3922){_0x3f0194[_0x27a1('0x43')]=_0x1e3922;return _0x3f0194;})['then'](respondWithFilteredResult(_0x4ecc83,_0x2089aa))[_0x27a1('0x44')](handleError(_0x4ecc83,null));};exports[_0x27a1('0x45')]=function(_0x496edf,_0x4ccc9c){var _0xe4e38d={'raw':!![],'where':{'id':_0x496edf['params']['id']}},_0x56553b={};_0x56553b[_0x27a1('0x2f')]=_[_0x27a1('0x46')](db[_0x27a1('0x2b')][_0x27a1('0x2c')]);_0x56553b[_0x27a1('0x30')]=_['keys'](_0x496edf['query']);_0x56553b[_0x27a1('0x3a')]=_[_0x27a1('0x31')](_0x56553b[_0x27a1('0x2f')],_0x56553b[_0x27a1('0x30')]);_0xe4e38d[_0x27a1('0x33')]=_[_0x27a1('0x31')](_0x56553b[_0x27a1('0x2f')],qs[_0x27a1('0x32')](_0x496edf[_0x27a1('0x30')][_0x27a1('0x32')]));_0xe4e38d[_0x27a1('0x33')]=_0xe4e38d[_0x27a1('0x33')]['length']?_0xe4e38d['attributes']:_0x56553b[_0x27a1('0x2f')];if(_0x496edf[_0x27a1('0x30')]['includeAll']){_0xe4e38d[_0x27a1('0x41')]=[{'all':!![]}];}_0xe4e38d=_[_0x27a1('0x3e')]({},_0xe4e38d,_0x496edf['options']);return db[_0x27a1('0x2b')][_0x27a1('0x47')](_0xe4e38d)[_0x27a1('0x26')](handleEntityNotFound(_0x4ccc9c,null))['then'](respondWithResult(_0x4ccc9c,null))[_0x27a1('0x44')](handleError(_0x4ccc9c,null));};exports[_0x27a1('0x48')]=function(_0x2fac06,_0x269c33){return db[_0x27a1('0x2b')]['create'](_0x2fac06[_0x27a1('0x49')],{})[_0x27a1('0x26')](respondWithResult(_0x269c33,0xc9))['catch'](handleError(_0x269c33,null));};exports[_0x27a1('0x24')]=function(_0x287250,_0x52c916){if(_0x287250[_0x27a1('0x49')]['id']){delete _0x287250[_0x27a1('0x49')]['id'];}return db[_0x27a1('0x2b')][_0x27a1('0x47')]({'where':{'id':_0x287250[_0x27a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52c916,null))[_0x27a1('0x26')](saveUpdates(_0x287250['body'],null))[_0x27a1('0x26')](respondWithResult(_0x52c916,null))[_0x27a1('0x44')](handleError(_0x52c916,null));};exports['destroy']=function(_0x22eab2,_0x288bd0){return db[_0x27a1('0x2b')]['find']({'where':{'id':_0x22eab2[_0x27a1('0x4a')]['id']}})[_0x27a1('0x26')](handleEntityNotFound(_0x288bd0,null))[_0x27a1('0x26')](removeEntity(_0x288bd0,null))[_0x27a1('0x44')](handleError(_0x288bd0,null));};exports[_0x27a1('0x4b')]=function(_0x46a12d,_0x5a832a){return db[_0x27a1('0x2b')][_0x27a1('0x4b')]()['then'](respondWithResult(_0x5a832a,null))[_0x27a1('0x44')](handleError(_0x5a832a,null));}; \ No newline at end of file +var _0x0755=['util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','findAll','show','params','includeAll','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x0755,0x7c));var _0x5075=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x0755[_0x35027c];return _0x4bba7d;};'use strict';var emlformat=require(_0x5075('0x0'));var rimraf=require(_0x5075('0x1'));var zipdir=require(_0x5075('0x2'));var jsonpatch=require(_0x5075('0x3'));var rp=require(_0x5075('0x4'));var moment=require(_0x5075('0x5'));var BPromise=require(_0x5075('0x6'));var Mustache=require(_0x5075('0x7'));var util=require(_0x5075('0x8'));var path=require(_0x5075('0x9'));var sox=require('sox');var csv=require(_0x5075('0xa'));var ejs=require(_0x5075('0xb'));var fs=require('fs');var fs_extra=require(_0x5075('0xc'));var _=require(_0x5075('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5075('0xe'));var toCsv=require(_0x5075('0xa'));var querystring=require('querystring');var Papa=require(_0x5075('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5075('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5075('0x11'))(_0x5075('0x12'));var utils=require(_0x5075('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5075('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c5e3,_0x1a131e){_0x1a131e=_0x1a131e||0xcc;return function(_0x413cec){if(_0x413cec){return _0x11c5e3[_0x5075('0x15')](_0x1a131e);}return _0x11c5e3[_0x5075('0x16')](_0x1a131e)[_0x5075('0x17')]();};}function respondWithResult(_0x92710a,_0x32b1a1){_0x32b1a1=_0x32b1a1||0xc8;return function(_0x339420){if(_0x339420){return _0x92710a[_0x5075('0x16')](_0x32b1a1)[_0x5075('0x18')](_0x339420);}};}function respondWithFilteredResult(_0x13e267,_0x4235cd){return function(_0x49ff22){if(_0x49ff22){var _0x128a1b=typeof _0x4235cd[_0x5075('0x19')]===_0x5075('0x1a')&&typeof _0x4235cd[_0x5075('0x1b')]===_0x5075('0x1a');var _0x57fedb=_0x49ff22[_0x5075('0x1c')];var _0xc8b69a=_0x128a1b?0x0:_0x4235cd['offset'];var _0x2159a8=_0x128a1b?_0x49ff22[_0x5075('0x1c')]:_0x4235cd[_0x5075('0x19')]+_0x4235cd[_0x5075('0x1b')];var _0x53232c;if(_0x2159a8>=_0x57fedb){_0x2159a8=_0x57fedb;_0x53232c=0xc8;}else{_0x53232c=0xce;}_0x13e267[_0x5075('0x16')](_0x53232c);return _0x13e267['set'](_0x5075('0x1d'),_0xc8b69a+'-'+_0x2159a8+'/'+_0x57fedb)['json'](_0x49ff22);}return null;};}function patchUpdates(_0x17382e){return function(_0x545364){try{jsonpatch[_0x5075('0x1e')](_0x545364,_0x17382e,!![]);}catch(_0x4c65c7){return BPromise[_0x5075('0x1f')](_0x4c65c7);}return _0x545364[_0x5075('0x20')]();};}function saveUpdates(_0x5ea539,_0x530244){return function(_0x510d4e){if(_0x510d4e){return _0x510d4e[_0x5075('0x21')](_0x5ea539)[_0x5075('0x22')](function(_0xd48fad){return _0xd48fad;});}return null;};}function removeEntity(_0x396c08,_0x1d7758){return function(_0x4e2c16){if(_0x4e2c16){return _0x4e2c16[_0x5075('0x23')]()[_0x5075('0x22')](function(){_0x396c08[_0x5075('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f16cc,_0x212438){return function(_0x57fcb5){if(!_0x57fcb5){_0x1f16cc[_0x5075('0x15')](0x194);}return _0x57fcb5;};}function handleError(_0x3b178d,_0x1340ea){_0x1340ea=_0x1340ea||0x1f4;return function(_0x38a4ea){logger['error'](_0x38a4ea['stack']);if(_0x38a4ea['name']){delete _0x38a4ea[_0x5075('0x24')];}_0x3b178d[_0x5075('0x16')](_0x1340ea)['send'](_0x38a4ea);};}exports[_0x5075('0x25')]=function(_0x36dbf7,_0x444c06){var _0x4efb14={},_0x264777={},_0x514349={'count':0x0,'rows':[]};var _0x5d3a5c=_[_0x5075('0x26')](db[_0x5075('0x27')][_0x5075('0x28')],function(_0x1102cc){return{'name':_0x1102cc['fieldName'],'type':_0x1102cc[_0x5075('0x29')][_0x5075('0x2a')]};});_0x264777[_0x5075('0x2b')]=_['map'](_0x5d3a5c,_0x5075('0x24'));_0x264777[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x36dbf7[_0x5075('0x2c')]);_0x264777['filters']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],_0x264777[_0x5075('0x2c')]);_0x4efb14['attributes']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x36dbf7[_0x5075('0x2c')][_0x5075('0x2f')]));_0x4efb14['attributes']=_0x4efb14[_0x5075('0x30')][_0x5075('0x31')]?_0x4efb14['attributes']:_0x264777[_0x5075('0x2b')];if(!_0x36dbf7['query']['hasOwnProperty']('nolimit')){_0x4efb14[_0x5075('0x1b')]=qs[_0x5075('0x1b')](_0x36dbf7[_0x5075('0x2c')]['limit']);_0x4efb14[_0x5075('0x19')]=qs['offset'](_0x36dbf7['query'][_0x5075('0x19')]);}_0x4efb14['order']=qs[_0x5075('0x32')](_0x36dbf7[_0x5075('0x2c')]['sort']);_0x4efb14[_0x5075('0x33')]=qs[_0x5075('0x34')](_[_0x5075('0x35')](_0x36dbf7['query'],_0x264777[_0x5075('0x34')]),_0x5d3a5c);if(_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]){_0x4efb14[_0x5075('0x33')]=_[_0x5075('0x37')](_0x4efb14[_0x5075('0x33')],{'$or':_[_0x5075('0x26')](_0x5d3a5c,function(_0x1f230a){if(_0x1f230a[_0x5075('0x29')]!=='VIRTUAL'){var _0x4c9568={};_0x4c9568[_0x1f230a[_0x5075('0x24')]]={'$like':'%'+_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]+'%'};return _0x4c9568;}})});}_0x4efb14=_[_0x5075('0x37')]({},_0x4efb14,_0x36dbf7['options']);var _0x63b935={'where':_0x4efb14[_0x5075('0x33')]};return db[_0x5075('0x27')][_0x5075('0x1c')](_0x63b935)[_0x5075('0x22')](function(_0xbb29e8){_0x514349[_0x5075('0x1c')]=_0xbb29e8;if(_0x36dbf7['query']['includeAll']){_0x4efb14['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x5075('0x38')](_0x4efb14);})[_0x5075('0x22')](function(_0x12f169){_0x514349['rows']=_0x12f169;return _0x514349;})[_0x5075('0x22')](respondWithFilteredResult(_0x444c06,_0x4efb14))['catch'](handleError(_0x444c06,null));};exports[_0x5075('0x39')]=function(_0x1e5a34,_0x1f9165){var _0x2afa26={'raw':!![],'where':{'id':_0x1e5a34[_0x5075('0x3a')]['id']}},_0x42d4b4={};_0x42d4b4['model']=_[_0x5075('0x2d')](db[_0x5075('0x27')][_0x5075('0x28')]);_0x42d4b4[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x1e5a34['query']);_0x42d4b4[_0x5075('0x34')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],_0x42d4b4['query']);_0x2afa26[_0x5075('0x30')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x1e5a34[_0x5075('0x2c')][_0x5075('0x2f')]));_0x2afa26[_0x5075('0x30')]=_0x2afa26[_0x5075('0x30')][_0x5075('0x31')]?_0x2afa26[_0x5075('0x30')]:_0x42d4b4[_0x5075('0x2b')];if(_0x1e5a34[_0x5075('0x2c')][_0x5075('0x3b')]){_0x2afa26['include']=[{'all':!![]}];}_0x2afa26=_['merge']({},_0x2afa26,_0x1e5a34[_0x5075('0x3c')]);return db['ChatQueueReport']['find'](_0x2afa26)[_0x5075('0x22')](handleEntityNotFound(_0x1f9165,null))[_0x5075('0x22')](respondWithResult(_0x1f9165,null))[_0x5075('0x3d')](handleError(_0x1f9165,null));};exports['create']=function(_0x49b9a0,_0x35f55d){return db['ChatQueueReport'][_0x5075('0x3e')](_0x49b9a0['body'],{})['then'](respondWithResult(_0x35f55d,0xc9))[_0x5075('0x3d')](handleError(_0x35f55d,null));};exports[_0x5075('0x21')]=function(_0x137e67,_0x3cbcf5){if(_0x137e67['body']['id']){delete _0x137e67[_0x5075('0x3f')]['id'];}return db[_0x5075('0x27')][_0x5075('0x40')]({'where':{'id':_0x137e67[_0x5075('0x3a')]['id']}})[_0x5075('0x22')](handleEntityNotFound(_0x3cbcf5,null))[_0x5075('0x22')](saveUpdates(_0x137e67[_0x5075('0x3f')],null))['then'](respondWithResult(_0x3cbcf5,null))[_0x5075('0x3d')](handleError(_0x3cbcf5,null));};exports['destroy']=function(_0x4d386c,_0x4113e7){return db['ChatQueueReport']['find']({'where':{'id':_0x4d386c['params']['id']}})['then'](handleEntityNotFound(_0x4113e7,null))[_0x5075('0x22')](removeEntity(_0x4113e7,null))[_0x5075('0x3d')](handleError(_0x4113e7,null));};exports[_0x5075('0x41')]=function(_0x207329,_0x12c3a5){return db[_0x5075('0x27')]['describe']()[_0x5075('0x22')](respondWithResult(_0x12c3a5,null))[_0x5075('0x3d')](handleError(_0x12c3a5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c2ecf23..a138977 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0xe706,0xa3));var _0x6e70=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0xe706[_0x5dc927];return _0x416440;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe3e397,_0x2b8583){var _0x35646b=function(_0x4491e9){while(--_0x4491e9){_0xe3e397['push'](_0xe3e397['shift']());}};_0x35646b(++_0x2b8583);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('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 c32f6bd..a8aca8b 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 _0x6b20=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','stringify','catch','UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash'];(function(_0x1b49e3,_0x4a46a4){var _0x13d36f=function(_0x3b0ae7){while(--_0x3b0ae7){_0x1b49e3['push'](_0x1b49e3['shift']());}};_0x13d36f(++_0x4a46a4);}(_0x6b20,0xd1));var _0x06b2=function(_0x156550,_0xade448){_0x156550=_0x156550-0x0;var _0x185c40=_0x6b20[_0x156550];return _0x185c40;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')](_0x594b48['body'],{'raw':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![]})[_0x06b2('0x19')](function(_0xe28985){logger[_0x06b2('0x12')](_0x06b2('0x14'),_0x594b48);logger['debug'](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x1a')](_0xe28985));_0x192270(_0xe28985);})[_0x06b2('0x1b')](function(_0x208384){logger['error']('CreateChatQueueReport',_0x208384[_0x06b2('0x11')],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x208384['message']));});});};exports[_0x06b2('0x1c')]=function(_0x5e40f2){var _0x3d58c6=this;return new Promise(function(_0x38987b,_0x2a0645){return db['ChatQueueReport'][_0x06b2('0x1d')](_0x5e40f2[_0x06b2('0x1e')],{'raw':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e40f2['options']?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x1f')]||null:null,'attributes':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2[_0x06b2('0x17')][_0x06b2('0x20')]||null:null,'limit':_0x5e40f2[_0x06b2('0x17')]?_0x5e40f2['options'][_0x06b2('0x21')]||null:null})[_0x06b2('0x19')](function(_0x2720fa){logger[_0x06b2('0x12')](_0x06b2('0x1c'),_0x5e40f2);logger[_0x06b2('0x22')](_0x06b2('0x1c'),_0x5e40f2,JSON['stringify'](_0x2720fa));_0x38987b(_0x2720fa);})[_0x06b2('0x1b')](function(_0x32eeea){logger[_0x06b2('0xf')](_0x06b2('0x1c'),_0x32eeea[_0x06b2('0x11')],_0x5e40f2);_0x2a0645(_0x3d58c6[_0x06b2('0xf')](0x1f4,_0x32eeea[_0x06b2('0x11')]));});});}; \ No newline at end of file +var _0xd64e=['attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','stringify','UpdateChatQueueReport','where'];(function(_0x220de4,_0x43fd18){var _0x4a837d=function(_0x1465f6){while(--_0x1465f6){_0x220de4['push'](_0x220de4['shift']());}};_0x4a837d(++_0x43fd18);}(_0xd64e,0x102));var _0xed64=function(_0x40e3d5,_0x4d1779){_0x40e3d5=_0x40e3d5-0x0;var _0x3f2e92=_0xd64e[_0x40e3d5];return _0x3f2e92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed64('0x0'));var BPromise=require(_0xed64('0x1'));var rs=require(_0xed64('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed64('0x3'))['db'];var utils=require(_0xed64('0x4'));var logger=require(_0xed64('0x5'))(_0xed64('0x6'));var config=require(_0xed64('0x7'));var jayson=require(_0xed64('0x8'));var client=jayson['client'][_0xed64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x296daf,_0x192750,_0x14d3e8){return new BPromise(function(_0x5783e5,_0x2d99d7){return client['request'](_0x296daf,_0x14d3e8)[_0xed64('0xa')](function(_0xf20332){logger[_0xed64('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x192750,_0xed64('0xc'));logger['debug'](_0xed64('0xd'),_0x192750,_0xed64('0xc'),JSON['stringify'](_0xf20332));if(_0xf20332[_0xed64('0xe')]){if(_0xf20332[_0xed64('0xe')][_0xed64('0xf')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x192750,_0xf20332[_0xed64('0xe')][_0xed64('0x10')]);return _0x2d99d7(_0xf20332[_0xed64('0xe')][_0xed64('0x10')]);}logger[_0xed64('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x192750,_0xf20332[_0xed64('0xe')]['message']);return _0x5783e5(_0xf20332['error'][_0xed64('0x10')]);}else{logger[_0xed64('0xb')](_0xed64('0x11'),_0x192750,_0xed64('0xc'));_0x5783e5(_0xf20332[_0xed64('0x12')]['message']);}})[_0xed64('0x13')](function(_0x22ef05){logger[_0xed64('0xe')](_0xed64('0x11'),_0x192750,_0x22ef05);_0x2d99d7(_0x22ef05);});});}exports[_0xed64('0x14')]=function(_0x4a340e){var _0x2c7ef7=this;return new Promise(function(_0x2b9b6c,_0x41a871){return db[_0xed64('0x15')][_0xed64('0x16')](_0x4a340e[_0xed64('0x17')],{'raw':_0x4a340e[_0xed64('0x18')]?_0x4a340e[_0xed64('0x18')][_0xed64('0x19')]===undefined?!![]:![]:!![]})[_0xed64('0xa')](function(_0x228c25){logger[_0xed64('0xb')](_0xed64('0x14'),_0x4a340e);logger[_0xed64('0x1a')](_0xed64('0x14'),_0x4a340e,JSON[_0xed64('0x1b')](_0x228c25));_0x2b9b6c(_0x228c25);})[_0xed64('0x13')](function(_0x435e44){logger[_0xed64('0xe')]('CreateChatQueueReport',_0x435e44[_0xed64('0x10')],_0x4a340e);_0x41a871(_0x2c7ef7[_0xed64('0xe')](0x1f4,_0x435e44[_0xed64('0x10')]));});});};exports[_0xed64('0x1c')]=function(_0x5be016){var _0x191309=this;return new Promise(function(_0x3298a2,_0x413dfc){return db['ChatQueueReport']['update'](_0x5be016['body'],{'raw':_0x5be016[_0xed64('0x18')]?_0x5be016[_0xed64('0x18')][_0xed64('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be016['options']?_0x5be016[_0xed64('0x18')][_0xed64('0x1d')]||null:null,'attributes':_0x5be016[_0xed64('0x18')]?_0x5be016['options'][_0xed64('0x1e')]||null:null,'limit':_0x5be016[_0xed64('0x18')]?_0x5be016[_0xed64('0x18')][_0xed64('0x1f')]||null:null})[_0xed64('0xa')](function(_0x50df6b){logger[_0xed64('0xb')](_0xed64('0x1c'),_0x5be016);logger[_0xed64('0x1a')](_0xed64('0x1c'),_0x5be016,JSON[_0xed64('0x1b')](_0x50df6b));_0x3298a2(_0x50df6b);})[_0xed64('0x13')](function(_0x4e5472){logger[_0xed64('0xe')](_0xed64('0x1c'),_0x4e5472[_0xed64('0x10')],_0x5be016);_0x413dfc(_0x191309[_0xed64('0xe')](0x1f4,_0x4e5472[_0xed64('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 700fe3d..fb1cc8a 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 _0x5b29=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5b29,0x74));var _0x95b2=function(_0x398ade,_0x16dab1){_0x398ade=_0x398ade-0x0;var _0x3cba29=_0x5b29[_0x398ade];return _0x3cba29;};'use strict';var multer=require(_0x95b2('0x0'));var util=require(_0x95b2('0x1'));var path=require(_0x95b2('0x2'));var timeout=require(_0x95b2('0x3'));var express=require('express');var router=express[_0x95b2('0x4')]();var fs_extra=require(_0x95b2('0x5'));var auth=require(_0x95b2('0x6'));var interaction=require(_0x95b2('0x7'));var config=require(_0x95b2('0x8'));var controller=require(_0x95b2('0x9'));router[_0x95b2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x95b2('0xa')](_0x95b2('0xb'),auth[_0x95b2('0xc')](),controller[_0x95b2('0xd')]);router[_0x95b2('0xa')](_0x95b2('0xe'),auth['isAuthenticated'](),controller[_0x95b2('0xf')]);router[_0x95b2('0x10')]('/',auth[_0x95b2('0xc')](),controller[_0x95b2('0x11')]);router[_0x95b2('0x12')]('/:id',auth[_0x95b2('0xc')](),controller['update']);router[_0x95b2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x95b2('0x14')]);module[_0x95b2('0x15')]=router; \ No newline at end of file +var _0xc4d9=['show','post','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id'];(function(_0xa1b262,_0x1688f1){var _0x4230f4=function(_0x181c8c){while(--_0x181c8c){_0xa1b262['push'](_0xa1b262['shift']());}};_0x4230f4(++_0x1688f1);}(_0xc4d9,0x105));var _0x9c4d=function(_0x26b433,_0x23abbd){_0x26b433=_0x26b433-0x0;var _0x25a8cc=_0xc4d9[_0x26b433];return _0x25a8cc;};'use strict';var multer=require('multer');var util=require(_0x9c4d('0x0'));var path=require('path');var timeout=require(_0x9c4d('0x1'));var express=require(_0x9c4d('0x2'));var router=express[_0x9c4d('0x3')]();var fs_extra=require(_0x9c4d('0x4'));var auth=require(_0x9c4d('0x5'));var interaction=require(_0x9c4d('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x9c4d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9c4d('0x7')]('/describe',auth[_0x9c4d('0x8')](),controller[_0x9c4d('0x9')]);router[_0x9c4d('0x7')](_0x9c4d('0xa'),auth['isAuthenticated'](),controller[_0x9c4d('0xb')]);router[_0x9c4d('0xc')]('/',auth[_0x9c4d('0x8')](),controller['create']);router[_0x9c4d('0xd')](_0x9c4d('0xa'),auth[_0x9c4d('0x8')](),controller[_0x9c4d('0xe')]);router[_0x9c4d('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9c4d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 94d5140..46e960c 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1cd7d1,_0x528bf8){_0x1cd7d1=_0x1cd7d1-0x0;var _0x522682=_0xb43b[_0x1cd7d1];return _0x522682;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8f062d1..88e184f 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 _0x33a2=['name','send','ChatTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x33a2,0xff));var _0x233a=function(_0x2d3d91,_0x58b9bc){_0x2d3d91=_0x2d3d91-0x0;var _0x3624d8=_0x33a2[_0x2d3d91];return _0x3624d8;};'use strict';var emlformat=require(_0x233a('0x0'));var rimraf=require(_0x233a('0x1'));var zipdir=require(_0x233a('0x2'));var jsonpatch=require(_0x233a('0x3'));var rp=require(_0x233a('0x4'));var moment=require(_0x233a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x233a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x233a('0x7'));var csv=require(_0x233a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x233a('0x9'));var _=require(_0x233a('0xa'));var squel=require('squel');var crypto=require(_0x233a('0xb'));var jsforce=require(_0x233a('0xc'));var deskjs=require(_0x233a('0xd'));var toCsv=require(_0x233a('0x8'));var querystring=require('querystring');var Papa=require(_0x233a('0xe'));var Redis=require('ioredis');var authService=require(_0x233a('0xf'));var qs=require(_0x233a('0x10'));var as=require(_0x233a('0x11'));var hardwareService=require(_0x233a('0x12'));var logger=require(_0x233a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x233a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x233a('0x15'))['db'];function respondWithStatusCode(_0x3c562f,_0x26084c){_0x26084c=_0x26084c||0xcc;return function(_0x1bfa7b){if(_0x1bfa7b){return _0x3c562f[_0x233a('0x16')](_0x26084c);}return _0x3c562f['status'](_0x26084c)[_0x233a('0x17')]();};}function respondWithResult(_0x11f433,_0x151252){_0x151252=_0x151252||0xc8;return function(_0x4e4b1c){if(_0x4e4b1c){return _0x11f433['status'](_0x151252)[_0x233a('0x18')](_0x4e4b1c);}};}function respondWithFilteredResult(_0x324657,_0x1fa280){return function(_0x1baea8){if(_0x1baea8){var _0x277118=typeof _0x1fa280[_0x233a('0x19')]==='undefined'&&typeof _0x1fa280[_0x233a('0x1a')]===_0x233a('0x1b');var _0xaf8cbd=_0x1baea8[_0x233a('0x1c')];var _0x53492d=_0x277118?0x0:_0x1fa280['offset'];var _0x29e54e=_0x277118?_0x1baea8['count']:_0x1fa280[_0x233a('0x19')]+_0x1fa280[_0x233a('0x1a')];var _0x51ccac;if(_0x29e54e>=_0xaf8cbd){_0x29e54e=_0xaf8cbd;_0x51ccac=0xc8;}else{_0x51ccac=0xce;}_0x324657[_0x233a('0x1d')](_0x51ccac);return _0x324657[_0x233a('0x1e')](_0x233a('0x1f'),_0x53492d+'-'+_0x29e54e+'/'+_0xaf8cbd)[_0x233a('0x18')](_0x1baea8);}return null;};}function patchUpdates(_0x200954){return function(_0x2d1e06){try{jsonpatch['apply'](_0x2d1e06,_0x200954,!![]);}catch(_0x19c43c){return BPromise[_0x233a('0x20')](_0x19c43c);}return _0x2d1e06['save']();};}function saveUpdates(_0x149b3b,_0x1303f2){return function(_0x197844){if(_0x197844){return _0x197844[_0x233a('0x21')](_0x149b3b)[_0x233a('0x22')](function(_0x27e3d6){return _0x27e3d6;});}return null;};}function removeEntity(_0x2b9403,_0x5f59bd){return function(_0x29448f){if(_0x29448f){return _0x29448f['destroy']()['then'](function(){_0x2b9403[_0x233a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e76bf,_0x16ffd5){return function(_0x57541d){if(!_0x57541d){_0x4e76bf[_0x233a('0x16')](0x194);}return _0x57541d;};}function handleError(_0x37aeb3,_0xc571b6){_0xc571b6=_0xc571b6||0x1f4;return function(_0x5eb6a6){logger[_0x233a('0x23')](_0x5eb6a6[_0x233a('0x24')]);if(_0x5eb6a6['name']){delete _0x5eb6a6[_0x233a('0x25')];}_0x37aeb3['status'](_0xc571b6)[_0x233a('0x26')](_0x5eb6a6);};}exports['index']=function(_0x3856fd,_0x291769){var _0x5ebb10={},_0x33130a={},_0x311047={'count':0x0,'rows':[]};var _0x330829=_['map'](db[_0x233a('0x27')][_0x233a('0x28')],function(_0x201fc1){return{'name':_0x201fc1['fieldName'],'type':_0x201fc1[_0x233a('0x29')][_0x233a('0x2a')]};});_0x33130a[_0x233a('0x2b')]=_['map'](_0x330829,_0x233a('0x25'));_0x33130a['query']=_['keys'](_0x3856fd[_0x233a('0x2c')]);_0x33130a['filters']=_[_0x233a('0x2d')](_0x33130a[_0x233a('0x2b')],_0x33130a[_0x233a('0x2c')]);_0x5ebb10[_0x233a('0x2e')]=_[_0x233a('0x2d')](_0x33130a[_0x233a('0x2b')],qs[_0x233a('0x2f')](_0x3856fd[_0x233a('0x2c')][_0x233a('0x2f')]));_0x5ebb10[_0x233a('0x2e')]=_0x5ebb10[_0x233a('0x2e')][_0x233a('0x30')]?_0x5ebb10[_0x233a('0x2e')]:_0x33130a[_0x233a('0x2b')];if(!_0x3856fd[_0x233a('0x2c')]['hasOwnProperty'](_0x233a('0x31'))){_0x5ebb10[_0x233a('0x1a')]=qs[_0x233a('0x1a')](_0x3856fd[_0x233a('0x2c')][_0x233a('0x1a')]);_0x5ebb10[_0x233a('0x19')]=qs['offset'](_0x3856fd[_0x233a('0x2c')][_0x233a('0x19')]);}_0x5ebb10[_0x233a('0x32')]=qs['sort'](_0x3856fd[_0x233a('0x2c')][_0x233a('0x33')]);_0x5ebb10[_0x233a('0x34')]=qs['filters'](_[_0x233a('0x35')](_0x3856fd[_0x233a('0x2c')],_0x33130a['filters']),_0x330829);if(_0x3856fd[_0x233a('0x2c')][_0x233a('0x36')]){_0x5ebb10['where']=_[_0x233a('0x37')](_0x5ebb10[_0x233a('0x34')],{'$or':_[_0x233a('0x38')](_0x330829,function(_0x2aa550){if(_0x2aa550[_0x233a('0x29')]!==_0x233a('0x39')){var _0x197be2={};_0x197be2[_0x2aa550['name']]={'$like':'%'+_0x3856fd[_0x233a('0x2c')][_0x233a('0x36')]+'%'};return _0x197be2;}})});}_0x5ebb10=_[_0x233a('0x37')]({},_0x5ebb10,_0x3856fd[_0x233a('0x3a')]);var _0x4cd2af={'where':_0x5ebb10[_0x233a('0x34')]};return db['ChatTransferReport'][_0x233a('0x1c')](_0x4cd2af)[_0x233a('0x22')](function(_0x826ca5){_0x311047[_0x233a('0x1c')]=_0x826ca5;if(_0x3856fd['query'][_0x233a('0x3b')]){_0x5ebb10[_0x233a('0x3c')]=[{'all':!![]}];}return db[_0x233a('0x27')][_0x233a('0x3d')](_0x5ebb10);})[_0x233a('0x22')](function(_0x5801d1){_0x311047[_0x233a('0x3e')]=_0x5801d1;return _0x311047;})[_0x233a('0x22')](respondWithFilteredResult(_0x291769,_0x5ebb10))[_0x233a('0x3f')](handleError(_0x291769,null));};exports[_0x233a('0x40')]=function(_0x2810e2,_0x58412d){var _0x1c22a9={'raw':!![],'where':{'id':_0x2810e2[_0x233a('0x41')]['id']}},_0x50a5cd={};_0x50a5cd['model']=_[_0x233a('0x42')](db[_0x233a('0x27')][_0x233a('0x28')]);_0x50a5cd[_0x233a('0x2c')]=_[_0x233a('0x42')](_0x2810e2['query']);_0x50a5cd[_0x233a('0x43')]=_[_0x233a('0x2d')](_0x50a5cd[_0x233a('0x2b')],_0x50a5cd['query']);_0x1c22a9[_0x233a('0x2e')]=_[_0x233a('0x2d')](_0x50a5cd[_0x233a('0x2b')],qs['fields'](_0x2810e2[_0x233a('0x2c')]['fields']));_0x1c22a9['attributes']=_0x1c22a9['attributes'][_0x233a('0x30')]?_0x1c22a9[_0x233a('0x2e')]:_0x50a5cd['model'];if(_0x2810e2[_0x233a('0x2c')][_0x233a('0x3b')]){_0x1c22a9[_0x233a('0x3c')]=[{'all':!![]}];}_0x1c22a9=_[_0x233a('0x37')]({},_0x1c22a9,_0x2810e2[_0x233a('0x3a')]);return db[_0x233a('0x27')]['find'](_0x1c22a9)[_0x233a('0x22')](handleEntityNotFound(_0x58412d,null))['then'](respondWithResult(_0x58412d,null))[_0x233a('0x3f')](handleError(_0x58412d,null));};exports['create']=function(_0x547fbb,_0x2b9ef6){return db[_0x233a('0x27')][_0x233a('0x44')](_0x547fbb[_0x233a('0x45')],{})[_0x233a('0x22')](respondWithResult(_0x2b9ef6,0xc9))[_0x233a('0x3f')](handleError(_0x2b9ef6,null));};exports['update']=function(_0x3d4f32,_0x461c90){if(_0x3d4f32[_0x233a('0x45')]['id']){delete _0x3d4f32[_0x233a('0x45')]['id'];}return db[_0x233a('0x27')][_0x233a('0x46')]({'where':{'id':_0x3d4f32[_0x233a('0x41')]['id']}})['then'](handleEntityNotFound(_0x461c90,null))['then'](saveUpdates(_0x3d4f32['body'],null))[_0x233a('0x22')](respondWithResult(_0x461c90,null))[_0x233a('0x3f')](handleError(_0x461c90,null));};exports[_0x233a('0x47')]=function(_0x1f1a68,_0x249d95){return db[_0x233a('0x27')]['find']({'where':{'id':_0x1f1a68['params']['id']}})[_0x233a('0x22')](handleEntityNotFound(_0x249d95,null))[_0x233a('0x22')](removeEntity(_0x249d95,null))['catch'](handleError(_0x249d95,null));};exports[_0x233a('0x48')]=function(_0x4181f5,_0x160652){return db[_0x233a('0x27')][_0x233a('0x48')]()[_0x233a('0x22')](respondWithResult(_0x160652,null))[_0x233a('0x3f')](handleError(_0x160652,null));}; \ No newline at end of file +var _0x84bb=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','ChatTransferReport','key','model','map'];(function(_0x133cb3,_0x37c6d0){var _0x5f58e6=function(_0x5d868a){while(--_0x5d868a){_0x133cb3['push'](_0x133cb3['shift']());}};_0x5f58e6(++_0x37c6d0);}(_0x84bb,0x1d7));var _0xb84b=function(_0x992fd0,_0x53feeb){_0x992fd0=_0x992fd0-0x0;var _0x5a4785=_0x84bb[_0x992fd0];return _0x5a4785;};'use strict';var emlformat=require(_0xb84b('0x0'));var rimraf=require(_0xb84b('0x1'));var zipdir=require(_0xb84b('0x2'));var jsonpatch=require(_0xb84b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb84b('0x4'));var Mustache=require(_0xb84b('0x5'));var util=require(_0xb84b('0x6'));var path=require(_0xb84b('0x7'));var sox=require(_0xb84b('0x8'));var csv=require(_0xb84b('0x9'));var ejs=require(_0xb84b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb84b('0xb'));var squel=require(_0xb84b('0xc'));var crypto=require(_0xb84b('0xd'));var jsforce=require(_0xb84b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb84b('0x9'));var querystring=require(_0xb84b('0xf'));var Papa=require(_0xb84b('0x10'));var Redis=require(_0xb84b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb84b('0x12'));var hardwareService=require(_0xb84b('0x13'));var logger=require(_0xb84b('0x14'))(_0xb84b('0x15'));var utils=require('../../config/utils');var config=require(_0xb84b('0x16'));var licenseUtil=require(_0xb84b('0x17'));var db=require(_0xb84b('0x18'))['db'];function respondWithStatusCode(_0x5f5ddb,_0x52ea08){_0x52ea08=_0x52ea08||0xcc;return function(_0x169a68){if(_0x169a68){return _0x5f5ddb[_0xb84b('0x19')](_0x52ea08);}return _0x5f5ddb[_0xb84b('0x1a')](_0x52ea08)[_0xb84b('0x1b')]();};}function respondWithResult(_0x3b21d7,_0x56e72b){_0x56e72b=_0x56e72b||0xc8;return function(_0x310c05){if(_0x310c05){return _0x3b21d7[_0xb84b('0x1a')](_0x56e72b)['json'](_0x310c05);}};}function respondWithFilteredResult(_0x1baf8d,_0x414790){return function(_0x226dc){if(_0x226dc){var _0x1781aa=typeof _0x414790[_0xb84b('0x1c')]==='undefined'&&typeof _0x414790[_0xb84b('0x1d')]===_0xb84b('0x1e');var _0x4d2f59=_0x226dc[_0xb84b('0x1f')];var _0x4c4dc2=_0x1781aa?0x0:_0x414790[_0xb84b('0x1c')];var _0x8d9d84=_0x1781aa?_0x226dc['count']:_0x414790[_0xb84b('0x1c')]+_0x414790[_0xb84b('0x1d')];var _0xdbaf2c;if(_0x8d9d84>=_0x4d2f59){_0x8d9d84=_0x4d2f59;_0xdbaf2c=0xc8;}else{_0xdbaf2c=0xce;}_0x1baf8d[_0xb84b('0x1a')](_0xdbaf2c);return _0x1baf8d['set'](_0xb84b('0x20'),_0x4c4dc2+'-'+_0x8d9d84+'/'+_0x4d2f59)[_0xb84b('0x21')](_0x226dc);}return null;};}function patchUpdates(_0x220a3f){return function(_0x1bd13f){try{jsonpatch[_0xb84b('0x22')](_0x1bd13f,_0x220a3f,!![]);}catch(_0x28f00f){return BPromise[_0xb84b('0x23')](_0x28f00f);}return _0x1bd13f[_0xb84b('0x24')]();};}function saveUpdates(_0x1b6b91,_0x4072cc){return function(_0x15d20b){if(_0x15d20b){return _0x15d20b['update'](_0x1b6b91)[_0xb84b('0x25')](function(_0x2c1f87){return _0x2c1f87;});}return null;};}function removeEntity(_0x30ed04,_0x58bd87){return function(_0x20fbec){if(_0x20fbec){return _0x20fbec['destroy']()[_0xb84b('0x25')](function(){_0x30ed04[_0xb84b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc67236,_0x212e00){return function(_0x43e00a){if(!_0x43e00a){_0xc67236['sendStatus'](0x194);}return _0x43e00a;};}function handleError(_0x2ca18d,_0x3674dc){_0x3674dc=_0x3674dc||0x1f4;return function(_0x3b97fa){logger[_0xb84b('0x26')](_0x3b97fa[_0xb84b('0x27')]);if(_0x3b97fa['name']){delete _0x3b97fa[_0xb84b('0x28')];}_0x2ca18d[_0xb84b('0x1a')](_0x3674dc)[_0xb84b('0x29')](_0x3b97fa);};}exports[_0xb84b('0x2a')]=function(_0x3271ee,_0x211248){var _0x4d1ca3={},_0x57b8f9={},_0x45293d={'count':0x0,'rows':[]};var _0x6a7e8f=_['map'](db[_0xb84b('0x2b')]['rawAttributes'],function(_0x170cd7){return{'name':_0x170cd7['fieldName'],'type':_0x170cd7['type'][_0xb84b('0x2c')]};});_0x57b8f9[_0xb84b('0x2d')]=_[_0xb84b('0x2e')](_0x6a7e8f,'name');_0x57b8f9[_0xb84b('0x2f')]=_[_0xb84b('0x30')](_0x3271ee[_0xb84b('0x2f')]);_0x57b8f9[_0xb84b('0x31')]=_[_0xb84b('0x32')](_0x57b8f9[_0xb84b('0x2d')],_0x57b8f9[_0xb84b('0x2f')]);_0x4d1ca3[_0xb84b('0x33')]=_[_0xb84b('0x32')](_0x57b8f9['model'],qs[_0xb84b('0x34')](_0x3271ee['query'][_0xb84b('0x34')]));_0x4d1ca3[_0xb84b('0x33')]=_0x4d1ca3['attributes'][_0xb84b('0x35')]?_0x4d1ca3[_0xb84b('0x33')]:_0x57b8f9[_0xb84b('0x2d')];if(!_0x3271ee[_0xb84b('0x2f')]['hasOwnProperty'](_0xb84b('0x36'))){_0x4d1ca3['limit']=qs[_0xb84b('0x1d')](_0x3271ee['query'][_0xb84b('0x1d')]);_0x4d1ca3[_0xb84b('0x1c')]=qs[_0xb84b('0x1c')](_0x3271ee[_0xb84b('0x2f')][_0xb84b('0x1c')]);}_0x4d1ca3[_0xb84b('0x37')]=qs[_0xb84b('0x38')](_0x3271ee[_0xb84b('0x2f')][_0xb84b('0x38')]);_0x4d1ca3[_0xb84b('0x39')]=qs['filters'](_[_0xb84b('0x3a')](_0x3271ee[_0xb84b('0x2f')],_0x57b8f9[_0xb84b('0x31')]),_0x6a7e8f);if(_0x3271ee['query'][_0xb84b('0x3b')]){_0x4d1ca3[_0xb84b('0x39')]=_[_0xb84b('0x3c')](_0x4d1ca3[_0xb84b('0x39')],{'$or':_[_0xb84b('0x2e')](_0x6a7e8f,function(_0x163dd0){if(_0x163dd0[_0xb84b('0x3d')]!=='VIRTUAL'){var _0x343020={};_0x343020[_0x163dd0[_0xb84b('0x28')]]={'$like':'%'+_0x3271ee[_0xb84b('0x2f')]['filter']+'%'};return _0x343020;}})});}_0x4d1ca3=_['merge']({},_0x4d1ca3,_0x3271ee[_0xb84b('0x3e')]);var _0x5e75e4={'where':_0x4d1ca3[_0xb84b('0x39')]};return db[_0xb84b('0x2b')][_0xb84b('0x1f')](_0x5e75e4)['then'](function(_0x45e6e6){_0x45293d[_0xb84b('0x1f')]=_0x45e6e6;if(_0x3271ee[_0xb84b('0x2f')][_0xb84b('0x3f')]){_0x4d1ca3[_0xb84b('0x40')]=[{'all':!![]}];}return db[_0xb84b('0x2b')]['findAll'](_0x4d1ca3);})[_0xb84b('0x25')](function(_0x24d3da){_0x45293d[_0xb84b('0x41')]=_0x24d3da;return _0x45293d;})[_0xb84b('0x25')](respondWithFilteredResult(_0x211248,_0x4d1ca3))[_0xb84b('0x42')](handleError(_0x211248,null));};exports[_0xb84b('0x43')]=function(_0xee0856,_0x40cbcb){var _0x33650c={'raw':!![],'where':{'id':_0xee0856[_0xb84b('0x44')]['id']}},_0x1da96f={};_0x1da96f['model']=_['keys'](db[_0xb84b('0x2b')]['rawAttributes']);_0x1da96f['query']=_[_0xb84b('0x30')](_0xee0856['query']);_0x1da96f['filters']=_[_0xb84b('0x32')](_0x1da96f[_0xb84b('0x2d')],_0x1da96f[_0xb84b('0x2f')]);_0x33650c[_0xb84b('0x33')]=_[_0xb84b('0x32')](_0x1da96f['model'],qs['fields'](_0xee0856['query'][_0xb84b('0x34')]));_0x33650c[_0xb84b('0x33')]=_0x33650c[_0xb84b('0x33')][_0xb84b('0x35')]?_0x33650c[_0xb84b('0x33')]:_0x1da96f[_0xb84b('0x2d')];if(_0xee0856[_0xb84b('0x2f')][_0xb84b('0x3f')]){_0x33650c[_0xb84b('0x40')]=[{'all':!![]}];}_0x33650c=_['merge']({},_0x33650c,_0xee0856[_0xb84b('0x3e')]);return db[_0xb84b('0x2b')][_0xb84b('0x45')](_0x33650c)[_0xb84b('0x25')](handleEntityNotFound(_0x40cbcb,null))[_0xb84b('0x25')](respondWithResult(_0x40cbcb,null))['catch'](handleError(_0x40cbcb,null));};exports['create']=function(_0x709615,_0x263ca3){return db[_0xb84b('0x2b')][_0xb84b('0x46')](_0x709615[_0xb84b('0x47')],{})[_0xb84b('0x25')](respondWithResult(_0x263ca3,0xc9))[_0xb84b('0x42')](handleError(_0x263ca3,null));};exports[_0xb84b('0x48')]=function(_0x44ead1,_0x370f0f){if(_0x44ead1[_0xb84b('0x47')]['id']){delete _0x44ead1[_0xb84b('0x47')]['id'];}return db[_0xb84b('0x2b')][_0xb84b('0x45')]({'where':{'id':_0x44ead1[_0xb84b('0x44')]['id']}})[_0xb84b('0x25')](handleEntityNotFound(_0x370f0f,null))[_0xb84b('0x25')](saveUpdates(_0x44ead1[_0xb84b('0x47')],null))[_0xb84b('0x25')](respondWithResult(_0x370f0f,null))[_0xb84b('0x42')](handleError(_0x370f0f,null));};exports['destroy']=function(_0x4d6a08,_0x44ff71){return db[_0xb84b('0x2b')]['find']({'where':{'id':_0x4d6a08[_0xb84b('0x44')]['id']}})[_0xb84b('0x25')](handleEntityNotFound(_0x44ff71,null))[_0xb84b('0x25')](removeEntity(_0x44ff71,null))['catch'](handleError(_0x44ff71,null));};exports[_0xb84b('0x49')]=function(_0x17aa02,_0x3c084f){return db[_0xb84b('0x2b')]['describe']()[_0xb84b('0x25')](respondWithResult(_0x3c084f,null))[_0xb84b('0x42')](handleError(_0x3c084f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a873a4e..09c11b5 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 _0x9901=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','../../config/logger'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x9901,0xe3));var _0x1990=function(_0x41ee64,_0x206c94){_0x41ee64=_0x41ee64-0x0;var _0x468e47=_0x9901[_0x41ee64];return _0x468e47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1990('0x0'))(_0x1990('0x1'));var moment=require(_0x1990('0x2'));var BPromise=require(_0x1990('0x3'));var rp=require(_0x1990('0x4'));var fs=require('fs');var path=require(_0x1990('0x5'));var rimraf=require(_0x1990('0x6'));var config=require(_0x1990('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x1990('0x8')]=function(_0x2d09f3,_0x25cb10){return _0x2d09f3[_0x1990('0x9')](_0x1990('0xa'),attributes,{'tableName':_0x1990('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd63b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3eed92,_0x47610a){var _0x35e816=function(_0x30a5ee){while(--_0x30a5ee){_0x3eed92['push'](_0x3eed92['shift']());}};_0x35e816(++_0x47610a);}(_0xd63b,0x16d));var _0xbd63=function(_0x48bc88,_0xeda379){_0x48bc88=_0x48bc88-0x0;var _0x3ca4fd=_0xd63b[_0x48bc88];return _0x3ca4fd;};'use strict';var _=require(_0xbd63('0x0'));var util=require(_0xbd63('0x1'));var logger=require(_0xbd63('0x2'))(_0xbd63('0x3'));var moment=require(_0xbd63('0x4'));var BPromise=require(_0xbd63('0x5'));var rp=require(_0xbd63('0x6'));var fs=require('fs');var path=require(_0xbd63('0x7'));var rimraf=require(_0xbd63('0x8'));var config=require(_0xbd63('0x9'));var attributes=require(_0xbd63('0xa'));module[_0xbd63('0xb')]=function(_0x3cc0f3,_0x57ed35){return _0x3cc0f3[_0xbd63('0xc')](_0xbd63('0xd'),attributes,{'tableName':_0xbd63('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbd63('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6271417..b3db941 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 _0x86f4=['then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x13f3af,_0x2ac326){var _0xda3c9f=function(_0x5d96e9){while(--_0x5d96e9){_0x13f3af['push'](_0x13f3af['shift']());}};_0xda3c9f(++_0x2ac326);}(_0x86f4,0x16a));var _0x486f=function(_0x3bebac,_0x371dab){_0x3bebac=_0x3bebac-0x0;var _0x33f955=_0x86f4[_0x3bebac];return _0x33f955;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var moment=require(_0x486f('0x2'));var BPromise=require(_0x486f('0x3'));var rs=require(_0x486f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x486f('0x5'))['db'];var utils=require(_0x486f('0x6'));var logger=require(_0x486f('0x7'))(_0x486f('0x8'));var config=require(_0x486f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x486f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f394d,_0x1a8152,_0x1248f4){return new BPromise(function(_0x2565eb,_0x39ca7b){return client[_0x486f('0xb')](_0x1f394d,_0x1248f4)[_0x486f('0xc')](function(_0xacae2b){logger['info'](_0x486f('0xd'),_0x1a8152,_0x486f('0xe'));logger['debug'](_0x486f('0xf'),_0x1a8152,_0x486f('0xe'),JSON[_0x486f('0x10')](_0xacae2b));if(_0xacae2b[_0x486f('0x11')]){if(_0xacae2b['error'][_0x486f('0x12')]===0x1f4){logger[_0x486f('0x11')](_0x486f('0xd'),_0x1a8152,_0xacae2b['error'][_0x486f('0x13')]);return _0x39ca7b(_0xacae2b[_0x486f('0x11')]['message']);}logger[_0x486f('0x11')](_0x486f('0xd'),_0x1a8152,_0xacae2b['error'][_0x486f('0x13')]);return _0x2565eb(_0xacae2b[_0x486f('0x11')][_0x486f('0x13')]);}else{logger[_0x486f('0x14')](_0x486f('0xd'),_0x1a8152,'request\x20sent');_0x2565eb(_0xacae2b['result'][_0x486f('0x13')]);}})[_0x486f('0x15')](function(_0x5e8e0e){logger[_0x486f('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x1a8152,_0x5e8e0e);_0x39ca7b(_0x5e8e0e);});});} \ No newline at end of file +var _0x7537=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7537,0xf5));var _0x7753=function(_0x1ed311,_0xb346e7){_0x1ed311=_0x1ed311-0x0;var _0x34f63b=_0x7537[_0x1ed311];return _0x34f63b;};'use strict';var _=require(_0x7753('0x0'));var util=require(_0x7753('0x1'));var moment=require(_0x7753('0x2'));var BPromise=require(_0x7753('0x3'));var rs=require(_0x7753('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7753('0x5'))['db'];var utils=require(_0x7753('0x6'));var logger=require(_0x7753('0x7'))('rpc');var config=require(_0x7753('0x8'));var jayson=require(_0x7753('0x9'));var client=jayson['client'][_0x7753('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x371905,_0x5be031,_0x509dce){return new BPromise(function(_0x6e7807,_0x212336){return client['request'](_0x371905,_0x509dce)['then'](function(_0x326298){logger[_0x7753('0xb')](_0x7753('0xc'),_0x5be031,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5be031,_0x7753('0xd'),JSON[_0x7753('0xe')](_0x326298));if(_0x326298['error']){if(_0x326298[_0x7753('0xf')]['code']===0x1f4){logger[_0x7753('0xf')](_0x7753('0xc'),_0x5be031,_0x326298[_0x7753('0xf')][_0x7753('0x10')]);return _0x212336(_0x326298['error']['message']);}logger['error'](_0x7753('0xc'),_0x5be031,_0x326298[_0x7753('0xf')][_0x7753('0x10')]);return _0x6e7807(_0x326298[_0x7753('0xf')]['message']);}else{logger[_0x7753('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x5be031,_0x7753('0xd'));_0x6e7807(_0x326298[_0x7753('0x11')][_0x7753('0x10')]);}})[_0x7753('0x12')](function(_0x5466bf){logger[_0x7753('0xf')](_0x7753('0xc'),_0x5be031,_0x5466bf);_0x212336(_0x5466bf);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 98de0ee..40b9874 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 _0x24c7=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy'];(function(_0x3d0012,_0x84ac9f){var _0x21339f=function(_0x3448a4){while(--_0x3448a4){_0x3d0012['push'](_0x3d0012['shift']());}};_0x21339f(++_0x84ac9f);}(_0x24c7,0x17b));var _0x724c=function(_0x4e672c,_0x250417){_0x4e672c=_0x4e672c-0x0;var _0x4fc013=_0x24c7[_0x4e672c];return _0x4fc013;};'use strict';var multer=require(_0x724c('0x0'));var util=require('util');var path=require(_0x724c('0x1'));var timeout=require('connect-timeout');var express=require(_0x724c('0x2'));var router=express['Router']();var fs_extra=require(_0x724c('0x3'));var auth=require(_0x724c('0x4'));var interaction=require(_0x724c('0x5'));var config=require('../../config/environment');var controller=require(_0x724c('0x6'));router[_0x724c('0x7')]('/',auth[_0x724c('0x8')](),controller[_0x724c('0x9')]);router[_0x724c('0x7')](_0x724c('0xa'),auth[_0x724c('0x8')](),controller[_0x724c('0xb')]);router[_0x724c('0x7')](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0xd')]);router['post']('/',auth[_0x724c('0x8')](),controller['create']);router[_0x724c('0xe')](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0xf')]);router['delete'](_0x724c('0xc'),auth[_0x724c('0x8')](),controller[_0x724c('0x10')]);module[_0x724c('0x11')]=router; \ No newline at end of file +var _0x8802=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x410b37,_0x133090){var _0x221d1d=function(_0x2ac019){while(--_0x2ac019){_0x410b37['push'](_0x410b37['shift']());}};_0x221d1d(++_0x133090);}(_0x8802,0x1b7));var _0x2880=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0x8802[_0x3c1b2d];return _0x412475;};'use strict';var multer=require(_0x2880('0x0'));var util=require(_0x2880('0x1'));var path=require(_0x2880('0x2'));var timeout=require('connect-timeout');var express=require(_0x2880('0x3'));var router=express[_0x2880('0x4')]();var fs_extra=require(_0x2880('0x5'));var auth=require(_0x2880('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2880('0x7'));var controller=require(_0x2880('0x8'));router[_0x2880('0x9')]('/',auth[_0x2880('0xa')](),controller[_0x2880('0xb')]);router['get'](_0x2880('0xc'),auth[_0x2880('0xa')](),controller[_0x2880('0xd')]);router[_0x2880('0x9')](_0x2880('0xe'),auth['isAuthenticated'](),controller[_0x2880('0xf')]);router[_0x2880('0x10')]('/',auth[_0x2880('0xa')](),controller['create']);router[_0x2880('0x11')](_0x2880('0xe'),auth['isAuthenticated'](),controller[_0x2880('0x12')]);router[_0x2880('0x13')](_0x2880('0xe'),auth[_0x2880('0xa')](),controller[_0x2880('0x14')]);module[_0x2880('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5f705ed..fb8f8e3 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 _0x3c33=['Note','Type\x20a\x20message','Skip','star','thumb','TEXT','input','name','text','email','getDataValue','onlineForm','setDataValue','stringify','Comments','offlineForm','parse','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','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','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','We\x20are\x20here!','Chat','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error'];(function(_0x4c4b99,_0x3a290f){var _0x150415=function(_0x4b9e37){while(--_0x4b9e37){_0x4c4b99['push'](_0x4c4b99['shift']());}};_0x150415(++_0x3a290f);}(_0x3c33,0xb7));var _0x33c3=function(_0x35228c,_0x1e6824){_0x35228c=_0x35228c-0x0;var _0x56b5c0=_0x3c33[_0x35228c];return _0x56b5c0;};'use strict';var Sequelize=require(_0x33c3('0x0'));var rs=require(_0x33c3('0x1'));module[_0x33c3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'unique':_0x33c3('0x4')},'description':{'type':Sequelize[_0x33c3('0x3')]},'mapKey':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x5')},'customerAlias':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'defaultValue':_0x33c3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x33c3('0x3')],'allowNull':![],'defaultValue':_0x33c3('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x33c3('0x3')]},'animation':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x33c3('0xa')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xb')},'start_chat_button':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xc')},'offline_chat_button':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x10')},'noteTitle':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x11')},'placeholderMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x12')},'closingMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x13')},'conditionAgreement':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x33c3('0xa')](_0x33c3('0x14'),_0x33c3('0x15')),'defaultValue':_0x33c3('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x33c3('0x17'),'variable':null,'config':{'placeholder':_0x33c3('0x18'),'type':_0x33c3('0x19'),'required':!![]},'props':{'title':_0x33c3('0x18'),'helpText':''}},{'type':_0x33c3('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x33c3('0x1a'),'type':_0x33c3('0x1a')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x33c3('0x1b')](_0x33c3('0x1c'))?JSON['parse'](this[_0x33c3('0x1b')](_0x33c3('0x1c'))):{};},'set':function(_0x22a37a){return this[_0x33c3('0x1d')]('onlineForm',JSON[_0x33c3('0x1e')](_0x22a37a));}},'offlineForm':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return JSON[_0x33c3('0x1e')]({'items':[{'type':_0x33c3('0x17'),'props':{'title':_0x33c3('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x33c3('0x1a')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x33c3('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x33c3('0x1b')](_0x33c3('0x20'))?JSON[_0x33c3('0x21')](this[_0x33c3('0x1b')]('offlineForm')):{};},'set':function(_0x1cb183){return this[_0x33c3('0x1d')](_0x33c3('0x20'),JSON[_0x33c3('0x1e')](_0x1cb183));}},'token':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':function(){return rs[_0x33c3('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x33c3('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x33c3('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x26')},'skipUnmanaged':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x13')},'sendUnmanaged':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x33c3('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x33c3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':function(){return _0x33c3('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x33c3('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x29')},'verticalAlignment':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x2a')},'messagesAlignment':{'type':Sequelize[_0x33c3('0x3')],'defaultValue':_0x33c3('0x2b')},'defaultTitle':{'type':Sequelize[_0x33c3('0x3')]},'customerAvatar':{'type':Sequelize[_0x33c3('0x16')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x33c3('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x33c3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x33c3('0x8')],'comment':_0x33c3('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![],'comment':_0x33c3('0x2e'),'set':function(_0x2f2009){if(!_0x2f2009)this[_0x33c3('0x1d')](_0x33c3('0x2f'),null);this['setDataValue']('mandatoryDisposition',_0x2f2009);}},'vidaooEscalation':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x33c3('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c3('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x33c3('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x33c3('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x33c3('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7b53=['thumb','star','stringify','name','input','email','getDataValue','onlineForm','parse','setDataValue','TEXT','Comments','Leave\x20your\x20comments','offlineForm','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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x2ea238,_0x3ff941){var _0x5e1c8c=function(_0x285495){while(--_0x285495){_0x2ea238['push'](_0x2ea238['shift']());}};_0x5e1c8c(++_0x3ff941);}(_0x7b53,0x11a));var _0x37b5=function(_0x3c28a0,_0xb835c0){_0x3c28a0=_0x3c28a0-0x0;var _0x2ad751=_0x7b53[_0x3c28a0];return _0x2ad751;};'use strict';var Sequelize=require(_0x37b5('0x0'));var rs=require(_0x37b5('0x1'));module[_0x37b5('0x2')]={'name':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x4')},'customerAlias':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![],'defaultValue':_0x37b5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x37b5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![],'defaultValue':_0x37b5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![],'defaultValue':_0x37b5('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x37b5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x37b5('0x9')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0xa')},'start_chat_button':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xb')},'offline_chat_button':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x37b5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xf')},'placeholderMessage':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x10')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x11')},'closingMessageButton':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x37b5('0x9')]('star',_0x37b5('0x12')),'defaultValue':_0x37b5('0x13')},'ratingStarsNumber':{'type':Sequelize[_0x37b5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x37b5('0x14')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x37b5('0x15'),'type':'text','required':!![]},'props':{'title':_0x37b5('0x15'),'helpText':''}},{'type':_0x37b5('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x37b5('0x17'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x37b5('0x18')](_0x37b5('0x19'))?JSON[_0x37b5('0x1a')](this['getDataValue']('onlineForm')):{};},'set':function(_0x57cc89){return this[_0x37b5('0x1b')]('onlineForm',JSON[_0x37b5('0x14')](_0x57cc89));}},'offlineForm':{'type':Sequelize[_0x37b5('0x1c')],'defaultValue':function(){return JSON[_0x37b5('0x14')]({'items':[{'type':_0x37b5('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x37b5('0x17')},'variable':null},{'type':'textarea','config':{'placeholder':_0x37b5('0x1d')},'props':{'title':_0x37b5('0x1d'),'helpText':_0x37b5('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x37b5('0x18')]('offlineForm')?JSON['parse'](this[_0x37b5('0x18')](_0x37b5('0x1f'))):{};},'set':function(_0x262018){return this[_0x37b5('0x1b')]('offlineForm',JSON[_0x37b5('0x14')](_0x262018));}},'token':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x37b5('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x20')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x21')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x24')},'skipUnmanaged':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x37b5('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x37b5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x37b5('0x1c')],'defaultValue':function(){return _0x37b5('0x26');}},'notificationSound':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x37b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x37b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x27')},'verticalAlignment':{'type':Sequelize[_0x37b5('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x28')},'messagesAlignment':{'type':Sequelize[_0x37b5('0x3')],'defaultValue':_0x37b5('0x29')},'defaultTitle':{'type':Sequelize[_0x37b5('0x3')]},'customerAvatar':{'type':Sequelize[_0x37b5('0x1c')]},'showCustomerAvatar':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x37b5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![],'defaultValue':_0x37b5('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x37b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x37b5('0x2b')},'systemAvatar':{'type':Sequelize[_0x37b5('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x37b5('0x7')],'comment':_0x37b5('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![],'comment':_0x37b5('0x2d'),'set':function(_0x36b5eb){if(!_0x36b5eb)this[_0x37b5('0x1b')](_0x37b5('0x2e'),null);this[_0x37b5('0x1b')](_0x37b5('0x2f'),_0x36b5eb);}},'vidaooEscalation':{'type':Sequelize[_0x37b5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x37b5('0x3')]},'vidaooTopic':{'type':Sequelize[_0x37b5('0x3')],'allowNull':![],'defaultValue':_0x37b5('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x37b5('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x37b5('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1888971..0180207 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 _0x5b8f=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','model','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','length','includeAll','body','address','forEach','trim','testWildcardValidity','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','createdAt','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','priority','asc','List','list','Contacts','defaults','CmContact','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','waitForTheAssignedQueue','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Owner','fullname','Tag','color','tag','getSnippet','getProactiveActions','virtual','License','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','utf8','3.9.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','APIBadRequestError','../../errors/api','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x5b8f,0x115));var _0xf5b8=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x5b8f[_0x190681];return _0x4f2ada;};'use strict';var Mustache=require(_0xf5b8('0x0'));var util=require(_0xf5b8('0x1'));var path=require(_0xf5b8('0x2'));var ejs=require(_0xf5b8('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xf5b8('0x4'));var htmlToText=require(_0xf5b8('0x5'));var Redis=require(_0xf5b8('0x6'));var jayson=require(_0xf5b8('0x7'));var qs=require(_0xf5b8('0x8'));var logger=require(_0xf5b8('0x9'))('api');var config=require('../../config/environment');var APIBadRequestError=require('../../errors/api')[_0xf5b8('0xa')];var APINotFoundError=require(_0xf5b8('0xb'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xf5b8('0xb'))['APIOutOfIntervalError'];var APIHandleError=require(_0xf5b8('0xb'))[_0xf5b8('0xc')];var APIConflictError=require(_0xf5b8('0xb'))[_0xf5b8('0xd')];var wildcardUtils=require(_0xf5b8('0xe'));var URL=require('url')[_0xf5b8('0xf')];var db=require(_0xf5b8('0x10'))['db'];config[_0xf5b8('0x11')]=_['defaults'](config['redis'],{'host':_0xf5b8('0x12'),'port':0x18eb});var socket=require(_0xf5b8('0x13'))(new Redis(config[_0xf5b8('0x11')]));require(_0xf5b8('0x14'))[_0xf5b8('0x15')](socket);var client=jayson['client'][_0xf5b8('0x16')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xf5b8('0x17')]['http']({'port':0x232b});var client9001=jayson[_0xf5b8('0x17')][_0xf5b8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x181827,_0x6d2f2d,_0x40b924,_0x613cb1){return new Promise(function(_0x16abd6,_0x3f6574){var _0x1618c6=_0x613cb1||client;return _0x1618c6['request'](_0x181827,_0x40b924)[_0xf5b8('0x18')](function(_0x9ca0f){logger[_0xf5b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x6d2f2d,_0xf5b8('0x1a'));logger[_0xf5b8('0x1b')](_0xf5b8('0x1c'),_0x6d2f2d,'request\x20sent',JSON[_0xf5b8('0x1d')](_0x9ca0f));if(_0x9ca0f[_0xf5b8('0x1e')]){if(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x1f')]===0x1f4){logger['error'](_0xf5b8('0x20'),_0x6d2f2d,_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);return _0x3f6574(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);}logger['error'](_0xf5b8('0x20'),_0x6d2f2d,_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);return _0x16abd6(_0x9ca0f[_0xf5b8('0x1e')][_0xf5b8('0x21')]);}else{logger[_0xf5b8('0x19')](_0xf5b8('0x20'),_0x6d2f2d,_0xf5b8('0x1a'));_0x16abd6(_0x9ca0f[_0xf5b8('0x22')][_0xf5b8('0x21')]);}})[_0xf5b8('0x23')](function(_0x50510e){logger[_0xf5b8('0x1e')](_0xf5b8('0x20'),_0x6d2f2d,_0x50510e);_0x3f6574(_0x50510e);});});}function respondWithStatusCode(_0x18ca29,_0x3a3ca4){_0x3a3ca4=_0x3a3ca4||0xcc;return function(_0xce19a6){if(_0xce19a6){return _0x18ca29[_0xf5b8('0x24')](_0x3a3ca4);}return _0x18ca29[_0xf5b8('0x25')](_0x3a3ca4)['end']();};}function respondWithResult(_0x28dda7,_0x598b44){_0x598b44=_0x598b44||0xc8;return function(_0x379334){if(_0x379334){return _0x28dda7[_0xf5b8('0x25')](_0x598b44)[_0xf5b8('0x26')](_0x379334);}};}function respondWithFilteredResult(_0x1fa029,_0x5a04af){return function(_0x351d37){if(_0x351d37){var _0x41010e=typeof _0x5a04af[_0xf5b8('0x27')]===_0xf5b8('0x28')&&typeof _0x5a04af['limit']==='undefined';var _0x196102=_0x351d37[_0xf5b8('0x29')];var _0x100fdf=_0x41010e?0x0:_0x5a04af[_0xf5b8('0x27')];var _0x2db2ea=_0x41010e?_0x351d37['count']:_0x5a04af[_0xf5b8('0x27')]+_0x5a04af[_0xf5b8('0x2a')];var _0x4e7d6b;if(_0x2db2ea>=_0x196102){_0x2db2ea=_0x196102;_0x4e7d6b=0xc8;}else{_0x4e7d6b=0xce;}_0x1fa029['status'](_0x4e7d6b);return _0x1fa029[_0xf5b8('0x2b')](_0xf5b8('0x2c'),_0x100fdf+'-'+_0x2db2ea+'/'+_0x196102)[_0xf5b8('0x26')](_0x351d37);}return null;};}function saveUpdates(_0x2958e1){return function(_0x163f2d){if(_0x163f2d){return _0x163f2d['update'](_0x2958e1)[_0xf5b8('0x18')](function(_0x25ffaf){return _0x25ffaf;});}return null;};}function removeEntity(_0x2f8b1a){return function(_0x593543){if(_0x593543){return _0x593543[_0xf5b8('0x2d')]()[_0xf5b8('0x18')](function(){var _0x2f9f20=_0x593543[_0xf5b8('0x2e')]({'plain':!![]});var _0x12754f=_0xf5b8('0x2f');return db[_0xf5b8('0x30')]['destroy']({'where':{'type':_0x12754f,'resourceId':_0x2f9f20['id']}})[_0xf5b8('0x18')](function(){return _0x593543;});})['then'](function(){_0x2f8b1a[_0xf5b8('0x25')](0xcc)[_0xf5b8('0x31')]();});}};}function handleEntityNotFound(_0x256317){return function(_0x53ba09){if(!_0x53ba09){_0x256317[_0xf5b8('0x24')](0x194);}return _0x53ba09;};}function handleError(_0x277af4,_0x43fdb8){_0x43fdb8=_0x43fdb8||0x1f4;return function(_0x9f7f98){logger['error'](_0x9f7f98[_0xf5b8('0x32')]);if(_0x9f7f98['name']){delete _0x9f7f98[_0xf5b8('0x33')];}_0x277af4[_0xf5b8('0x25')](_0x43fdb8)[_0xf5b8('0x34')](_0x9f7f98);};}function createInteractionObject(_0x75c4f,_0x169c1a,_0x2f6205,_0x266b01){var _0x13ae2a=require(_0xf5b8('0x35'));var _0x51c5dd=new _0x13ae2a();var _0x1461bf=_0x51c5dd[_0xf5b8('0x36')](_0x2f6205[_0xf5b8('0x37')])['getResult']();var _0x350bf8=_0x169c1a[_0xf5b8('0x38')];if(_0x2f6205['cf-connecting-ip']){_0x350bf8=_0x2f6205[_0xf5b8('0x39')];}else if(_0x2f6205['x-forwarded-for']){_0x350bf8=_[_0xf5b8('0x3a')](_0x2f6205[_0xf5b8('0x3b')][_0xf5b8('0x3c')](','));}return{'ContactId':_0x266b01['id'],'ChatWebsiteId':_0x75c4f,'from':(_0x266b01[_0xf5b8('0x3d')]||'')+'\x20'+(_0x266b01[_0xf5b8('0x3e')]||''),'customerIp':_0x350bf8,'customerPort':_0x2f6205[_0xf5b8('0x3f')]?_0x2f6205[_0xf5b8('0x3f')]:null,'referer':_0x169c1a[_0xf5b8('0x40')],'browserName':_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x33')]&&_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x42')]?util['format'](_0xf5b8('0x43'),_0x1461bf['browser']['name'],_0x1461bf['browser'][_0xf5b8('0x42')]):'unknown','browserVersion':_0x1461bf[_0xf5b8('0x41')][_0xf5b8('0x42')]||_0xf5b8('0x44'),'osName':util[_0xf5b8('0x45')](_0xf5b8('0x43'),_0x1461bf['os'][_0xf5b8('0x33')],_0x1461bf['os'][_0xf5b8('0x42')]),'osVersion':_0x1461bf['os'][_0xf5b8('0x42')],'deviceModel':_0x1461bf[_0xf5b8('0x46')]['model']&&_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x47')]?util['format']('%s\x20%s\x20%s',_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x48')],_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x47')],_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x49')]):null,'deviceVendor':_0x1461bf['device'][_0xf5b8('0x47')],'deviceType':_0x1461bf[_0xf5b8('0x46')][_0xf5b8('0x49')],'formData':JSON['stringify'](_0x169c1a)};}exports[_0xf5b8('0x4a')]=function(_0x14a30d,_0x40ae5c){var _0x421cb3={'include':[{'model':db[_0xf5b8('0x4b')],'as':_0xf5b8('0x4c')}]},_0x28f310={},_0x14628c={'count':0x0,'rows':[]};var _0x2f7165=_[_0xf5b8('0x4d')](db[_0xf5b8('0x4e')]['rawAttributes'],function(_0x48a7fb){return{'name':_0x48a7fb['fieldName'],'type':_0x48a7fb['type']['key']};});_0x28f310[_0xf5b8('0x48')]=_[_0xf5b8('0x4d')](_0x2f7165,_0xf5b8('0x33'));_0x28f310[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x14a30d[_0xf5b8('0x4f')]);_0x28f310[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x28f310[_0xf5b8('0x48')],_0x28f310[_0xf5b8('0x4f')]);_0x421cb3[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x28f310[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x14a30d['query'][_0xf5b8('0x54')]));_0x421cb3[_0xf5b8('0x53')]=_0x421cb3[_0xf5b8('0x53')]['length']?_0x421cb3[_0xf5b8('0x53')]:_0x28f310[_0xf5b8('0x48')];if(!_0x14a30d['query'][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x421cb3[_0xf5b8('0x2a')]=qs['limit'](_0x14a30d[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x421cb3['offset']=qs['offset'](_0x14a30d[_0xf5b8('0x4f')]['offset']);}_0x421cb3[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x14a30d['query']['sort']);_0x421cb3[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x14a30d[_0xf5b8('0x4f')],_0x28f310[_0xf5b8('0x51')]),_0x2f7165);if(_0x14a30d[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x421cb3[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x421cb3[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x2f7165,function(_0x33eeb7){if(_0x33eeb7[_0xf5b8('0x49')]!==_0xf5b8('0x5d')){var _0x2f5c55={};_0x2f5c55[_0x33eeb7[_0xf5b8('0x33')]]={'$like':'%'+_0x14a30d[_0xf5b8('0x4f')]['filter']+'%'};return _0x2f5c55;}})});}_0x421cb3=_[_0xf5b8('0x5c')]({},_0x421cb3,_0x14a30d[_0xf5b8('0x5e')]);var _0x5cfcd4={'where':_0x421cb3[_0xf5b8('0x59')]};return db['ChatWebsite'][_0xf5b8('0x29')](_0x5cfcd4)['then'](function(_0x456140){_0x14628c[_0xf5b8('0x29')]=_0x456140;if(_0x14a30d[_0xf5b8('0x4f')]['includeAll']){_0x421cb3[_0xf5b8('0x5f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x421cb3);})['then'](function(_0x344c2c){_0x14628c[_0xf5b8('0x60')]=_0x344c2c;return _0x14628c;})[_0xf5b8('0x18')](respondWithFilteredResult(_0x40ae5c,_0x421cb3))[_0xf5b8('0x23')](handleError(_0x40ae5c,null));};exports[_0xf5b8('0x61')]=function(_0x521585,_0x21445b){var _0x1678ca={'raw':![],'where':{'id':_0x521585['params']['id']},'include':[{'model':db['Pause'],'as':_0xf5b8('0x4c')}]},_0x576923={};_0x576923[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x4e')][_0xf5b8('0x62')]);_0x576923[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x521585['query']);_0x576923['filters']=_['intersection'](_0x576923[_0xf5b8('0x48')],_0x576923['query']);_0x1678ca[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x576923['model'],qs['fields'](_0x521585[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x1678ca[_0xf5b8('0x53')]=_0x1678ca['attributes'][_0xf5b8('0x63')]?_0x1678ca[_0xf5b8('0x53')]:_0x576923[_0xf5b8('0x48')];if(_0x521585['query'][_0xf5b8('0x64')]){_0x1678ca[_0xf5b8('0x5f')]=[{'all':!![]}];}_0x1678ca=_['merge']({},_0x1678ca,_0x521585['options']);return db[_0xf5b8('0x4e')]['find'](_0x1678ca)['then'](handleEntityNotFound(_0x21445b,null))[_0xf5b8('0x18')](respondWithResult(_0x21445b,null))['catch'](handleError(_0x21445b,null));};exports['create']=function(_0x4c08df,_0x3e8e70){var _0x419dc8=null;_0x4c08df[_0xf5b8('0x65')][_0xf5b8('0x66')]['split'](',')[_0xf5b8('0x67')](_0x5c8901=>{if(_0x5c8901[_0xf5b8('0x68')]()!==''&&!wildcardUtils[_0xf5b8('0x69')](_0x5c8901[_0xf5b8('0x68')]())){_0x419dc8=new APIBadRequestError('\x22'+_0x5c8901+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x419dc8){return handleError(_0x3e8e70,null)(_0x419dc8);}return db[_0xf5b8('0x4e')][_0xf5b8('0x6a')](_0x4c08df['body'],{})['then'](function(_0x249f1e){var _0x2903dc=_0x4c08df['user'][_0xf5b8('0x2e')]({'plain':!![]});if(!_0x2903dc)throw new Error(_0xf5b8('0x6b'));if(_0x2903dc[_0xf5b8('0x6c')]===_0xf5b8('0x6d')){var _0x3a9ecd=_0x249f1e[_0xf5b8('0x2e')]({'plain':!![]});var _0x45870c=_0xf5b8('0x2f');return db[_0xf5b8('0x6e')][_0xf5b8('0x6f')]({'where':{'name':_0x45870c,'userProfileId':_0x2903dc['userProfileId']},'raw':!![]})[_0xf5b8('0x18')](function(_0xd27aa9){if(_0xd27aa9&&_0xd27aa9[_0xf5b8('0x70')]===0x0){return db[_0xf5b8('0x30')][_0xf5b8('0x6a')]({'name':_0x3a9ecd[_0xf5b8('0x33')],'resourceId':_0x3a9ecd['id'],'type':_0xd27aa9['name'],'sectionId':_0xd27aa9['id']},{})[_0xf5b8('0x18')](function(){return _0x249f1e;});}else{return _0x249f1e;}})[_0xf5b8('0x23')](function(_0x7d106c){logger[_0xf5b8('0x1e')](_0xf5b8('0x71'),_0x7d106c);throw _0x7d106c;});}return _0x249f1e;})[_0xf5b8('0x18')](respondWithResult(_0x3e8e70,0xc9))[_0xf5b8('0x23')](handleError(_0x3e8e70,null));};exports['update']=function(_0x317d59,_0x3c65b4){var _0xa4458d=null;_0x317d59[_0xf5b8('0x65')][_0xf5b8('0x66')][_0xf5b8('0x3c')](',')[_0xf5b8('0x67')](_0x2f3912=>{if(_0x2f3912[_0xf5b8('0x68')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x2f3912[_0xf5b8('0x68')]())){_0xa4458d=new APIBadRequestError('\x22'+_0x2f3912+_0xf5b8('0x72'));}});if(_0xa4458d){return handleError(_0x3c65b4,null)(_0xa4458d);}if(_0x317d59[_0xf5b8('0x65')]['id']){delete _0x317d59['body']['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x317d59[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0x4b')],'as':_0xf5b8('0x4c')}]})['then'](handleEntityNotFound(_0x3c65b4,null))[_0xf5b8('0x18')](saveUpdates(_0x317d59[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x3c65b4,null))[_0xf5b8('0x23')](handleError(_0x3c65b4,null));};exports[_0xf5b8('0x2d')]=function(_0x138280,_0x515aaa){return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x138280[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x515aaa,null))['then'](removeEntity(_0x515aaa,null))[_0xf5b8('0x23')](handleError(_0x515aaa,null));};exports['describe']=function(_0x40be06,_0x4eb070){return db[_0xf5b8('0x4e')][_0xf5b8('0x74')]()[_0xf5b8('0x18')](respondWithResult(_0x4eb070,null))[_0xf5b8('0x23')](handleError(_0x4eb070,null));};exports['addDisposition']=function(_0xa73b6f,_0x4f4004){if(_0xa73b6f[_0xf5b8('0x65')]['id']){delete _0xa73b6f[_0xf5b8('0x65')]['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0xa73b6f['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4f4004,null))[_0xf5b8('0x18')](function(_0x18f7c4){if(_0x18f7c4){_0xa73b6f['body'][_0xf5b8('0x75')]=_0x18f7c4['id'];return db[_0xf5b8('0x76')][_0xf5b8('0x6a')](_0xa73b6f[_0xf5b8('0x65')]);}})[_0xf5b8('0x18')](respondWithResult(_0x4f4004,null))[_0xf5b8('0x23')](handleError(_0x4f4004,null));};exports[_0xf5b8('0x77')]=function(_0x95206,_0x2ce202){var _0x36456c={'raw':![],'where':{}};var _0x42b2a1={};var _0x382790={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x95206['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x2ce202,null))['then'](function(_0x547749){if(_0x547749){_0x42b2a1[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x76')]['rawAttributes']);_0x42b2a1['query']=_[_0xf5b8('0x50')](_0x95206[_0xf5b8('0x4f')]);_0x42b2a1[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x42b2a1['model'],_0x42b2a1[_0xf5b8('0x4f')]);_0x36456c[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x42b2a1[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x95206['query'][_0xf5b8('0x54')]));_0x36456c['attributes']=_0x36456c['attributes'][_0xf5b8('0x63')]?_0x36456c[_0xf5b8('0x53')]:_0x42b2a1[_0xf5b8('0x48')];if(!_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x36456c[_0xf5b8('0x2a')]=qs['limit'](_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x36456c[_0xf5b8('0x27')]=qs[_0xf5b8('0x27')](_0x95206['query'][_0xf5b8('0x27')]);}_0x36456c['order']=qs[_0xf5b8('0x58')](_0x95206[_0xf5b8('0x4f')]['sort']);_0x36456c[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_['pick'](_0x95206['query'],_0x42b2a1['filters']));_0x36456c['where'][_0xf5b8('0x75')]=_0x547749['id'];if(_0x95206['query'][_0xf5b8('0x5b')]){_0x36456c[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x36456c[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x36456c[_0xf5b8('0x53')],function(_0x3a5f0a){var _0x4c0131={};_0x4c0131[_0x3a5f0a]={'$like':'%'+_0x95206[_0xf5b8('0x4f')]['filter']+'%'};return _0x4c0131;})});}_0x36456c=_[_0xf5b8('0x5c')]({},_0x36456c,_0x95206['options']);return db['Disposition'][_0xf5b8('0x29')]({'where':_0x36456c[_0xf5b8('0x59')]})[_0xf5b8('0x18')](function(_0x48794e){_0x382790[_0xf5b8('0x29')]=_0x48794e;if(_0x95206[_0xf5b8('0x4f')][_0xf5b8('0x64')]){_0x36456c[_0xf5b8('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0xf5b8('0x78')](_0x36456c);})[_0xf5b8('0x18')](function(_0x2d7951){_0x382790[_0xf5b8('0x60')]=_0x2d7951;return _0x382790;});}})['then'](respondWithFilteredResult(_0x2ce202,_0x36456c))[_0xf5b8('0x23')](handleError(_0x2ce202,null));};exports[_0xf5b8('0x79')]=function(_0x2aaf11,_0x34966f){return db['ChatWebsite']['find']({'where':{'id':_0x2aaf11[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x34966f,null))[_0xf5b8('0x18')](function(_0x284c80){if(_0x284c80){return _0x284c80[_0xf5b8('0x79')](_0x2aaf11[_0xf5b8('0x4f')]['ids']);}})['then'](respondWithStatusCode(_0x34966f,null))['catch'](handleError(_0x34966f,null));};exports[_0xf5b8('0x7a')]=function(_0x576bda,_0xd86aa1){if(_0x576bda[_0xf5b8('0x65')]['id']){delete _0x576bda[_0xf5b8('0x65')]['id'];}return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x576bda[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0xd86aa1,null))[_0xf5b8('0x18')](function(_0x2a12b9){if(_0x2a12b9){_0x576bda[_0xf5b8('0x65')][_0xf5b8('0x75')]=_0x2a12b9['id'];return db['CannedAnswer'][_0xf5b8('0x6a')](_0x576bda[_0xf5b8('0x65')]);}})[_0xf5b8('0x18')](respondWithResult(_0xd86aa1,null))[_0xf5b8('0x23')](handleError(_0xd86aa1,null));};exports[_0xf5b8('0x7b')]=function(_0x34a19a,_0x497851){var _0x4d589b={'raw':![],'where':{}};var _0x3c7afe={};var _0x5175fd={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x34a19a[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x497851,null))[_0xf5b8('0x18')](function(_0x404a90){if(_0x404a90){_0x3c7afe[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0x7d')][_0xf5b8('0x62')]);_0x3c7afe['query']=_[_0xf5b8('0x50')](_0x34a19a[_0xf5b8('0x4f')]);_0x3c7afe[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x3c7afe[_0xf5b8('0x48')],_0x3c7afe['query']);_0x4d589b[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x3c7afe[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x34a19a['query'][_0xf5b8('0x54')]));_0x4d589b[_0xf5b8('0x53')]=_0x4d589b[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4d589b[_0xf5b8('0x53')]:_0x3c7afe['model'];if(!_0x34a19a['query'][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4d589b['limit']=qs['limit'](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x4d589b[_0xf5b8('0x27')]=qs['offset'](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}_0x4d589b[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x4d589b['where']=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x34a19a[_0xf5b8('0x4f')],_0x3c7afe[_0xf5b8('0x51')]));_0x4d589b[_0xf5b8('0x59')][_0xf5b8('0x75')]=_0x404a90['id'];if(_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x4d589b[_0xf5b8('0x59')]=_['merge'](_0x4d589b[_0xf5b8('0x59')],{'$or':_['map'](_0x4d589b['attributes'],function(_0x9957f6){var _0x4d160={};_0x4d160[_0x9957f6]={'$like':'%'+_0x34a19a[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x4d160;})});}_0x4d589b=_[_0xf5b8('0x5c')]({},_0x4d589b,_0x34a19a[_0xf5b8('0x5e')]);return db[_0xf5b8('0x7d')]['count']({'where':_0x4d589b['where']})[_0xf5b8('0x18')](function(_0x30e65b){_0x5175fd[_0xf5b8('0x29')]=_0x30e65b;if(_0x34a19a[_0xf5b8('0x4f')]['includeAll']){_0x4d589b[_0xf5b8('0x5f')]=[{'all':!![]}];}return db[_0xf5b8('0x7d')][_0xf5b8('0x78')](_0x4d589b);})[_0xf5b8('0x18')](function(_0xffbece){_0x5175fd['rows']=_0xffbece;return _0x5175fd;});}})['then'](respondWithFilteredResult(_0x497851,_0x4d589b))['catch'](handleError(_0x497851,null));};exports[_0xf5b8('0x7e')]=function(_0x35133d,_0x17a949){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x35133d[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x17a949,null))[_0xf5b8('0x18')](function(_0x3369b4){if(_0x3369b4){return _0x3369b4[_0xf5b8('0x7e')](_0x35133d[_0xf5b8('0x4f')][_0xf5b8('0x7f')]);}})[_0xf5b8('0x18')](respondWithStatusCode(_0x17a949,null))['catch'](handleError(_0x17a949,null));};exports['addLogo']=function(_0x1bccf0,_0x288cf3){_0x1bccf0['body'][_0xf5b8('0x80')]=_0x1bccf0[_0xf5b8('0x81')][_0xf5b8('0x82')];return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x1bccf0[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x288cf3,null))[_0xf5b8('0x18')](saveUpdates(_0x1bccf0[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x288cf3,null))[_0xf5b8('0x23')](handleError(_0x288cf3,null));};exports[_0xf5b8('0x83')]=function(_0x119ed1,_0x183c64){_0x119ed1[_0xf5b8('0x65')][_0xf5b8('0x84')]=_0x119ed1[_0xf5b8('0x81')][_0xf5b8('0x82')];return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x119ed1[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x183c64,null))['then'](saveUpdates(_0x119ed1[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x183c64,null))['catch'](handleError(_0x183c64,null));};exports[_0xf5b8('0x85')]=function(_0x1bfdde,_0x5d4d9c){_0x1bfdde[_0xf5b8('0x65')][_0xf5b8('0x86')]=_0x1bfdde[_0xf5b8('0x81')][_0xf5b8('0x82')];return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x1bfdde[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x5d4d9c,null))[_0xf5b8('0x18')](saveUpdates(_0x1bfdde[_0xf5b8('0x65')],null))[_0xf5b8('0x18')](respondWithResult(_0x5d4d9c,null))['catch'](handleError(_0x5d4d9c,null));};exports[_0xf5b8('0x87')]=function(_0x375e3e,_0xc16a21){_0x375e3e[_0xf5b8('0x65')][_0xf5b8('0x88')]=_0x375e3e['file'][_0xf5b8('0x82')];return db['ChatWebsite'][_0xf5b8('0x6f')]({'where':{'id':_0x375e3e[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0xc16a21,null))['then'](saveUpdates(_0x375e3e[_0xf5b8('0x65')],null))['then'](respondWithResult(_0xc16a21,null))[_0xf5b8('0x23')](handleError(_0xc16a21,null));};exports[_0xf5b8('0x89')]=function(_0x29560d,_0x267f70){var _0x565aa7=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],'server/files/images/logos/default_logo.svg');var _0x978db3={'where':{'id':_0x29560d['params']['id']},'attributes':['id',_0xf5b8('0x80')],'raw':!![]};var _0x3c70ca=![];return require(_0xf5b8('0x8c'))[_0xf5b8('0x8d')]()[_0xf5b8('0x18')](function(_0x2dda92){if(_0x2dda92){_0x3c70ca=_0x2dda92[_0xf5b8('0x8e')];}})['then'](function(){return db[_0xf5b8('0x4e')]['find'](_0x978db3);})[_0xf5b8('0x18')](handleEntityNotFound(_0x267f70,null))[_0xf5b8('0x18')](function(_0x303e54){if(_0x303e54){if(!_[_0xf5b8('0x8f')](_0x303e54[_0xf5b8('0x80')])){if(fs[_0xf5b8('0x90')](path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x91'),_0x303e54[_0xf5b8('0x80')]))&&_0x3c70ca){_0x565aa7=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],'server/files/images/logos/',_0x303e54['sitepic']);}}return _0x267f70['download'](_0x565aa7);}})[_0xf5b8('0x23')](handleError(_0x267f70,null));};exports[_0xf5b8('0x92')]=function(_0x2e81e6,_0x2e3788){var _0x2cc48a=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x93'));var _0x1f3d7c={'where':{'id':_0x2e81e6[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x84')],'raw':!![]};return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')](_0x1f3d7c)['then'](handleEntityNotFound(_0x2e3788,null))[_0xf5b8('0x18')](function(_0x30617e){if(_0x30617e){if(!_[_0xf5b8('0x8f')](_0x30617e[_0xf5b8('0x84')])){if(fs['existsSync'](path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x94'),_0x30617e[_0xf5b8('0x84')]))){_0x2cc48a=path['join'](config['root'],_0xf5b8('0x94'),_0x30617e[_0xf5b8('0x84')]);}}return _0x2e3788[_0xf5b8('0x95')](_0x2cc48a);}})['catch'](handleError(_0x2e3788,null));};exports[_0xf5b8('0x96')]=function(_0x1bc8e4,_0x2131dc){var _0x36c777=path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x97'));var _0x4fa447={'where':{'id':_0x1bc8e4[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x86'),_0xf5b8('0x98')],'raw':!![]};return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')](_0x4fa447)[_0xf5b8('0x18')](handleEntityNotFound(_0x2131dc,null))[_0xf5b8('0x18')](function(_0x1c7be7){if(_0x1c7be7){if(!_['isNil'](_0x1c7be7[_0xf5b8('0x86')])){if(fs[_0xf5b8('0x90')](path['join'](config[_0xf5b8('0x8b')],'server/files/images/avatars/',_0x1c7be7[_0xf5b8('0x86')]))&&_0x1c7be7[_0xf5b8('0x98')]){_0x36c777=path['join'](config[_0xf5b8('0x8b')],_0xf5b8('0x94'),_0x1c7be7['customerAvatar']);}}return _0x2131dc[_0xf5b8('0x95')](_0x36c777);}})[_0xf5b8('0x23')](handleError(_0x2131dc,null));};exports[_0xf5b8('0x99')]=function(_0xd38b80,_0x5129bd){var _0x5387ea=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x9a'));var _0x5cfdab={'where':{'id':_0xd38b80[_0xf5b8('0x73')]['id']},'attributes':['id',_0xf5b8('0x88')],'raw':!![]};return db['ChatWebsite']['find'](_0x5cfdab)[_0xf5b8('0x18')](handleEntityNotFound(_0x5129bd,null))['then'](function(_0x4d072d){if(_0x4d072d){if(!_[_0xf5b8('0x8f')](_0x4d072d[_0xf5b8('0x88')])){if(fs['existsSync'](path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0x94'),_0x4d072d[_0xf5b8('0x88')]))){_0x5387ea=path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x94'),_0x4d072d[_0xf5b8('0x88')]);}}return _0x5129bd[_0xf5b8('0x95')](_0x5387ea);}})[_0xf5b8('0x23')](handleError(_0x5129bd,null));};function checkWebsiteInterval(_0x4fed03){var _0x44480b=_0x4fed03[_0xf5b8('0x9b')];if(!_0x44480b){return Promise['resolve'](_0x4fed03);}var _0x2aedd1=_0x4fed03['timezone']||undefined;return _0x44480b[_0xf5b8('0x9c')](_0x2aedd1)[_0xf5b8('0x18')](function(_0x569fb6){if(!_0x569fb6){throw new APIOutOfIntervalError();}return _0x4fed03;});}exports[_0xf5b8('0x9d')]=function(_0x39e1c5,_0x1a728f){var _0x1081a5={'body':_0x39e1c5[_0xf5b8('0x65')],'channel':_0xf5b8('0x9e')};var _0x45112b=[];var _0x561421=[];var _0x4d5687={};var _0x2f7370=![];if(_0x39e1c5['body']['id']){delete _0x39e1c5[_0xf5b8('0x65')]['id'];}if(_[_0xf5b8('0x8f')](_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')])){throw new APIBadRequestError(_0xf5b8('0xa0'));}if(_['isNil'](_0x39e1c5['body'][_0xf5b8('0xa1')])){throw new APIBadRequestError(_0xf5b8('0xa2'));}if(_['isEmpty'](_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x65')])){throw new APIBadRequestError(_0xf5b8('0xa3'));}var _0x271355=_0x39e1c5[_0xf5b8('0x65')]['customerIp']&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];return db['CmContact'][_0xf5b8('0x74')]()['then'](function(_0x2ca6fc){if(!_0x2ca6fc){throw new Error('No\x20available\x20attributes');}_0x45112b=Object['keys'](_0x2ca6fc)[_0xf5b8('0x5b')](function(_0xed9c7e){return![_0xf5b8('0xa4'),_0xf5b8('0xa5')]['includes'](_0xed9c7e);});_0x561421=Object['keys'](_0x2ca6fc)[_0xf5b8('0x5b')](function(_0x41bcf2){return![_0xf5b8('0xa4'),'updatedAt',_0xf5b8('0xa6'),_0xf5b8('0xa7')]['includes'](_0x41bcf2);});if(!_['includes'](_0x561421,_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xa1')])){throw new APIBadRequestError(_0xf5b8('0xa8')+_0x561421[_0xf5b8('0x8a')](',\x20'));}_0x4d5687[_0x39e1c5[_0xf5b8('0x65')]['mapKey']]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')];})['then'](function(){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x39e1c5['params']['id']},'include':[{'model':db[_0xf5b8('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4d5687,'limit':0x1,'order':[[_0xf5b8('0xa5'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xf5b8('0xaa')},{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0x9b'),'include':[{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0xab'),'attributes':['id',_0xf5b8('0xac')],'raw':!![]}]}]});})[_0xf5b8('0x18')](function(_0x9da925){if(!_0x9da925){throw new APINotFoundError(util[_0xf5b8('0x45')](_0xf5b8('0xad'),_0x39e1c5[_0xf5b8('0x73')]['id']));}if(_0x271355){return checkWebsiteInterval(_0x9da925);}return _0x9da925;})[_0xf5b8('0x18')](function(_0x186f21){_0x1081a5['account']=_0x186f21;_0x1081a5[_0xf5b8('0xae')]=_['orderBy'](_0x186f21[_0xf5b8('0xaa')],[_0xf5b8('0xaf')],[_0xf5b8('0xb0')]);if(_0x1081a5['account'][_0xf5b8('0xaa')]){delete _0x1081a5['account']['Applications'];}_0x1081a5['list']=_0x186f21[_0xf5b8('0xb1')]||{'id':_0x186f21[_0xf5b8('0xa7')]};if(_0x1081a5[_0xf5b8('0xb2')]&&_0x1081a5[_0xf5b8('0xb2')][_0xf5b8('0xb3')]['length']){return _0x1081a5[_0xf5b8('0xb2')][_0xf5b8('0xb3')][0x0];}var _0x5df38c=_[_0xf5b8('0xb4')](_0x39e1c5[_0xf5b8('0x65')],{'firstName':_0x39e1c5[_0xf5b8('0x65')]['from'],'ListId':_0x186f21[_0xf5b8('0xa7')]});_0x5df38c[_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xa1')]]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x9f')];return db[_0xf5b8('0xb5')][_0xf5b8('0x6a')](_0x5df38c,{'fields':_0x45112b,'raw':!![]});})['then'](function(_0x131052){_0x1081a5[_0xf5b8('0xb6')]=_0x131052;var _0x55a7a1=createInteractionObject(_0x39e1c5['params']['id'],_0x39e1c5[_0xf5b8('0x65')],_0x39e1c5[_0xf5b8('0xb7')],_0x131052);var _0x213550={'ChatWebsiteId':_0x39e1c5[_0xf5b8('0x73')]['id']};if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]){_0x213550[_0xf5b8('0xb8')]=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')];_0x213550[_0xf5b8('0xb9')]=![];return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':_0x213550})[_0xf5b8('0x18')](function(_0x2e4e92){var _0x39370f=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x38')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];if(_0x2e4e92){_0x2f7370=!![];return _0x2e4e92;}else if(!_0x39370f&&_0x2e4e92&&_0x2e4e92['closed']){throw new APIConflictError(_0xf5b8('0xbb'));}_0x55a7a1[_0xf5b8('0xb8')]=_0x39e1c5[_0xf5b8('0x65')]['threadId'];_0x55a7a1['externalUrl']=_0x39e1c5['body'][_0xf5b8('0xbc')];return db['ChatInteraction'][_0xf5b8('0x6a')](_0x55a7a1);});}_0x213550[_0xf5b8('0xbd')]=_0x131052['id'];if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]['id']){_0x213550['id']=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbe')]['id'];return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':_0x213550})[_0xf5b8('0x18')](function(_0x38ad78){var _0x1f6e87=_0x39e1c5['body'][_0xf5b8('0x38')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x40')];if(!_0x1f6e87&&_0x38ad78&&_0x38ad78[_0xf5b8('0xb9')]){throw new APIConflictError(_0xf5b8('0xbb'));}else if(_0x38ad78){_0x2f7370=!![];return _0x38ad78;}else{return db[_0xf5b8('0xba')][_0xf5b8('0x6a')](_0x55a7a1);}});}return db[_0xf5b8('0xba')]['create'](_0x55a7a1);})['then'](function(_0x460139){if(!_0x2f7370){return _0x460139;}var _0x278d07={'from':(_0x1081a5[_0xf5b8('0xb6')]['firstName']||'')+'\x20'+(_0x1081a5[_0xf5b8('0xb6')][_0xf5b8('0x3e')]||'')};if(_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbf')]&&_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xb8')]!=_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xbf')]){_0x278d07['threadId']=_0x39e1c5[_0xf5b8('0x65')]['messageId'];}return _0x460139['update'](_0x278d07);})[_0xf5b8('0x18')](function(_0xfeb07c){_0x1081a5[_0xf5b8('0xbe')]=_0xfeb07c[_0xf5b8('0x2e')]({'plain':!![]});_0x1081a5['interaction'][_0xf5b8('0xc0')]=!_0x2f7370;if(_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc0')]){if(_0x1081a5['account'][_0xf5b8('0xc1')]){_0x1081a5[_0xf5b8('0xae')][_0xf5b8('0xc2')]({'id':0x0,'priority':_0x1081a5['applications'][_0xf5b8('0x63')]+0x1,'app':_0xf5b8('0xc3'),'appdata':'unmanaged','interval':_0xf5b8('0xc4')});}}return db[_0xf5b8('0xc5')][_0xf5b8('0x6a')]({'body':_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0x65')],'ChatWebsiteId':_0x39e1c5[_0xf5b8('0x73')]['id'],'ChatInteractionId':_0xfeb07c['id'],'direction':'in','ContactId':_0x1081a5[_0xf5b8('0xb6')]['id'],'AttachmentId':_0x39e1c5[_0xf5b8('0x65')][_0xf5b8('0xc6')]});})[_0xf5b8('0x18')](function(_0x282dfe){_0x1081a5[_0xf5b8('0x21')]=_0x282dfe;if(!_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc7')]){return;}return db[_0xf5b8('0xc8')]['find']({'attributes':['id',_0xf5b8('0x33')],'where':{'id':_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xc7')]}});})[_0xf5b8('0x18')](function(_0x238ff4){if(_0x238ff4){_0x1081a5[_0xf5b8('0xae')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf5b8('0xc9'),'appdata':_0x238ff4[_0xf5b8('0x33')]+','+(_0x1081a5['account'][_0xf5b8('0xca')]||0xa),'interval':_0xf5b8('0xc4')});_0x1081a5[_0xf5b8('0xcb')]=!![];}if(!_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xcc')]){return;}return db[_0xf5b8('0xcd')][_0xf5b8('0x6f')]({'attributes':['id',_0xf5b8('0x33')],'where':{'id':_0x1081a5[_0xf5b8('0xbe')][_0xf5b8('0xcc')]}});})['then'](function(_0x4b78ef){if(_0x4b78ef){_0x1081a5['applications'][_0xf5b8('0xce')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4b78ef[_0xf5b8('0x33')]+','+(_0x1081a5['account'][_0xf5b8('0xcf')]||0x12c),'interval':_0xf5b8('0xc4')});}return respondWithRpcPromise('Start','startRouting',_0x1081a5);})[_0xf5b8('0x18')](function(_0x36b4c5){respondWithRpcPromise(_0xf5b8('0xd0'),_0xf5b8('0xd0'),{'event':_0xf5b8('0x9d'),'message':_0x36b4c5},client9002);return _0x36b4c5;})[_0xf5b8('0x18')](respondWithResult(_0x1a728f,null))[_0xf5b8('0x23')](APIHandleError(_0x1a728f));};exports[_0xf5b8('0xd1')]=function(_0x26aaa3,_0x3a0bfe){var _0x47772a,_0x43f722,_0x1f786d;var _0x152d92=[];var _0x3183c8={};var _0x186787=_0x26aaa3[_0xf5b8('0xd2')]||[];var _0x24e741=[];var _0xb7a643;return db['CmContact'][_0xf5b8('0x74')]()[_0xf5b8('0x18')](function(_0x1b4cc9){if(!_0x1b4cc9){throw new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd5'));}_0x152d92=_[_0xf5b8('0xd6')](_[_0xf5b8('0x50')](_0x1b4cc9),[_0xf5b8('0xa4'),_0xf5b8('0xa5'),_0xf5b8('0xa6'),_0xf5b8('0xa7')]);if(_0x26aaa3['body']['id']){delete _0x26aaa3['body']['id'];}if(_[_0xf5b8('0x8f')](_0x26aaa3['body'][_0xf5b8('0x9f')])){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)['send'](new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd7')));}if(_[_0xf5b8('0x8f')](_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x65')])||_0x26aaa3['body']['body']===''){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)[_0xf5b8('0x34')](new db['Sequelize']['ValidationError'](_0xf5b8('0xd8')));}if(_[_0xf5b8('0x8f')](_0x26aaa3['body']['mapKeyOffline'])){throw _0x3a0bfe['status'](0x1f4)[_0xf5b8('0x34')](new db[(_0xf5b8('0xd3'))][(_0xf5b8('0xd4'))](_0xf5b8('0xd9')+_0x152d92));}if(!_[_0xf5b8('0xda')](_0x152d92,_0x26aaa3[_0xf5b8('0x65')]['mapKeyOffline'])){throw _0x3a0bfe[_0xf5b8('0x25')](0x1f4)[_0xf5b8('0x34')](new db[(_0xf5b8('0xd3'))]['ValidationError'](_0xf5b8('0xdb')+_0x152d92));}_0x3183c8[_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0xdc')]]=_0x26aaa3[_0xf5b8('0x65')]['from'];})[_0xf5b8('0x18')](function(){return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x26aaa3[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0xa9')],'as':_0xf5b8('0xb1')},{'model':db[_0xf5b8('0xdd')],'as':_0xf5b8('0xdd')}]});})[_0xf5b8('0x18')](handleEntityNotFound(_0x3a0bfe,null))[_0xf5b8('0x18')](function(_0x5cfa21){if(_0x5cfa21&&_0x5cfa21[_0xf5b8('0xb1')]){_0x43f722=_0x5cfa21;var _0x241e93=_[_0xf5b8('0xb4')](_0x26aaa3['body'],{'firstName':_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')],'phone':_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')],'ListId':_0x5cfa21[_0xf5b8('0xa7')]});_0x241e93[_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0xdc')]]=_0x26aaa3[_0xf5b8('0x65')][_0xf5b8('0x9f')];return db[_0xf5b8('0xb5')]['findOrCreate']({'where':_0x3183c8,'defaults':_0x241e93});}})[_0xf5b8('0xde')](function(_0x53b8d7){if(_0x53b8d7){_0x1f786d=_0x53b8d7;var _0x3277ef=fs[_0xf5b8('0xdf')](path[_0xf5b8('0x8a')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x597be9=ejs[_0xf5b8('0xe0')](_0x3277ef,{'body':_['toPairs'](_0x26aaa3[_0xf5b8('0x65')]['body']),'bodyTitle':_0x43f722[_0xf5b8('0xe1')]});return db[_0xf5b8('0xe2')][_0xf5b8('0x6a')]({'body':_0x597be9,'plainBody':htmlToText[_0xf5b8('0xe3')](_0x597be9),'ContactId':_0x53b8d7['id'],'ChatWebsiteId':_0x43f722['id']});}})[_0xf5b8('0x18')](function(_0x1bd931){_0xb7a643=_0x1bd931;if(_0x186787[_0xf5b8('0x63')]){var _0x57ff00=_0x186787[_0xf5b8('0x4d')](function(_0x24ce4d){return{'name':_0x24ce4d[_0xf5b8('0xe4')],'basename':_0x24ce4d[_0xf5b8('0x82')],'type':_0x24ce4d[_0xf5b8('0xe5')],'ChatOfflineMessageId':_0x1bd931['id']};});_0x24e741=_0x57ff00['map'](_0x41044c=>{var _0x4d3b24={'filename':_0x41044c[_0xf5b8('0x33')],'path':path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0xe6'),'files','attachments',_0xf5b8('0xe7'),_0x41044c[_0xf5b8('0xe8')])};return _0x4d3b24;});if(!_0x43f722[_0xf5b8('0xe9')]){return db[_0xf5b8('0xea')]['transaction'](function(_0x4dbc1b){return db[_0xf5b8('0xeb')][_0xf5b8('0xec')](_0x57ff00,{'transaction':_0x4dbc1b});});}}})['then'](function(){if(_0xb7a643){_0x47772a=_0xb7a643;return db[_0xf5b8('0xdd')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf5b8('0xed')],'as':_0xf5b8('0xee'),'raw':!![],'include':[{'model':db[_0xf5b8('0xef')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xf5b8('0x18')](function(_0x2352e7){if(_0x2352e7&&_0x2352e7[_0xf5b8('0xee')]&&_0x43f722[_0xf5b8('0xf0')]&&_0x43f722[_0xf5b8('0xf1')]){var _0x40557f=_0x2352e7['getSmtpOptions']();return respondWithRpcPromise(_0xf5b8('0xf2'),'sendMail',{'account':_0x40557f,'message':{'from':util[_0xf5b8('0x45')]('\x22%s\x22\x20<%s>',_0x2352e7[_0xf5b8('0x33')],_0x2352e7[_0xf5b8('0xf3')]||_0x2352e7[_0xf5b8('0xee')][_0xf5b8('0x6d')]),'to':_0x43f722[_0xf5b8('0xf1')],'subject':_0x43f722['offlineMessageSubject'],'html':_0x47772a[_0xf5b8('0x65')],'attachments':_0x24e741}},client9003)[_0xf5b8('0x18')](function(){return _0x47772a;})['catch'](function(_0x19bf82){logger[_0xf5b8('0x1e')](_0x19bf82);});}})[_0xf5b8('0x18')](function(){if(_0x43f722&&_0x43f722[_0xf5b8('0xe9')]&&_0x43f722[_0xf5b8('0xf4')]){var _0x2de543=[];if(_0x186787[_0xf5b8('0x63')]){_0x2de543=_0x186787[_0xf5b8('0x4d')](function(_0x1b5bbc){return{'name':_0x1b5bbc[_0xf5b8('0xe4')],'basename':_0x1b5bbc['filename'],'type':_0x1b5bbc[_0xf5b8('0xe5')],'ChatOfflineMessageId':_0xb7a643['id']};});}var _0x5d7b6f;if(!_[_0xf5b8('0x8f')](_0x43f722[_0xf5b8('0xf5')])){var _0x3a133c=_['map'](_0x26aaa3[_0xf5b8('0x65')],function(_0x489f34){return _0x489f34;});var _0x23de58=_[_0xf5b8('0xf6')](_0x3a133c)[0x0];var _0x17c449=_[_0xf5b8('0xf7')](_0x23de58,function(_0x2cbcb2){return _0x2cbcb2;});_0x5d7b6f=_0x17c449[0x1][_0x43f722[_0xf5b8('0xf5')]];}var _0x123206={'from':_0x1f786d[_0xf5b8('0xf3')],'firstName':_0x1f786d[_0xf5b8('0x3d')],'lastName':_0x1f786d[_0xf5b8('0x3e')],'mapKey':_0xf5b8('0xf3'),'message':{'from':_0x1f786d[_0xf5b8('0xf3')],'to':_0x43f722['MailAccount']['email'],'cc':'','subject':_[_0xf5b8('0x8f')](_0x5d7b6f)?_0x43f722['offlineMessageSubject']:_0x5d7b6f,'messageId':'','sentAt':new Date(),'attach':_0x2de543['length'],'attachments':_0x2de543,'originChannel':_0xf5b8('0xf8'),'ChatWebsiteId':_0x43f722['id'],'ChatOfflineMessageId':_0x47772a['id'],'originTo':_0x43f722[_0xf5b8('0xdd')][_0xf5b8('0xf3')]},'body':_0x47772a[_0xf5b8('0x65')]};var _0x41a88b={'account':{'id':_0x43f722[_0xf5b8('0xf4')]},'body':_0x123206,'log':_0xf5b8('0xf9')};return respondWithRpcPromise('NotifyMailAccount',_0xf5b8('0xfa'),_0x41a88b,client9001)[_0xf5b8('0x18')](function(){return _0x47772a;})['catch'](function(_0xf12104){logger['error'](_0xf12104);});}return;})[_0xf5b8('0x18')](function(){if(_0x47772a){return _0x47772a;}})[_0xf5b8('0x18')](respondWithResult(_0x3a0bfe,null))[_0xf5b8('0x23')](function(){for(var _0x71c0a8 of _0x186787){var _0x4cfdfd=path[_0xf5b8('0x8a')](config[_0xf5b8('0x8b')],_0xf5b8('0xe6'),'files','attachments',_0xf5b8('0xe7'),_0x71c0a8['filename']);fs_extra[_0xf5b8('0xfb')](_0x4cfdfd)[_0xf5b8('0x23')](function(_0xa5ce09){logger[_0xf5b8('0x1e')](_0xf5b8('0xfc'),_0x4cfdfd,_0xa5ce09);});}});};exports[_0xf5b8('0xfd')]=function(_0x4938d2,_0x3a60a3){return db[_0xf5b8('0xba')][_0xf5b8('0x6f')]({'where':{'id':_0x4938d2[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x3a60a3,null))[_0xf5b8('0x18')](function(_0x573ef9){if(_0x573ef9){return _0x573ef9[_0xf5b8('0xfd')](_0x4938d2[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x4938d2['body'],[_0xf5b8('0x7f'),'id'])||{});}})[_0xf5b8('0x18')](respondWithResult(_0x3a60a3,null))[_0xf5b8('0x23')](handleError(_0x3a60a3,null));};exports['getInteractions']=function(_0xed9e3f,_0x1b6188){var _0x1c04af={'raw':![],'where':{}};var _0x2f91c9={};var _0x142055={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0xed9e3f['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x1b6188,null))[_0xf5b8('0x18')](function(_0x3fa075){if(_0x3fa075){_0x2f91c9[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0xba')][_0xf5b8('0x62')]);_0x2f91c9[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0xed9e3f['query']);_0x2f91c9[_0xf5b8('0x51')]=_['intersection'](_0x2f91c9[_0xf5b8('0x48')],_0x2f91c9[_0xf5b8('0x4f')]);_0x1c04af[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x2f91c9[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x1c04af['attributes']=_0x1c04af[_0xf5b8('0x53')]['length']?_0x1c04af['attributes']:_0x2f91c9[_0xf5b8('0x48')];if(!_0xed9e3f[_0xf5b8('0x4f')]['hasOwnProperty'](_0xf5b8('0x56'))){_0x1c04af[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x1c04af['offset']=qs[_0xf5b8('0x27')](_0xed9e3f['query'][_0xf5b8('0x27')]);}_0x1c04af[_0xf5b8('0x57')]=qs['sort'](_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x1c04af['where']=qs['filters'](_[_0xf5b8('0x5a')](_0xed9e3f[_0xf5b8('0x4f')],_0x2f91c9[_0xf5b8('0x51')]));_0x1c04af[_0xf5b8('0x59')][_0xf5b8('0x75')]=_0x3fa075['id'];if(_0xed9e3f['query'][_0xf5b8('0x5b')]){_0x1c04af[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x1c04af[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x1c04af[_0xf5b8('0x53')],function(_0x5840a6){var _0x52fb3d={};_0x52fb3d[_0x5840a6]={'$like':'%'+_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x52fb3d;})});}_0x1c04af=_['merge']({},_0x1c04af,_0xed9e3f[_0xf5b8('0x5e')]);return db[_0xf5b8('0xba')][_0xf5b8('0x29')]({'where':_0x1c04af['where']})['then'](function(_0x57903c){_0x142055[_0xf5b8('0x29')]=_0x57903c;if(_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x64')]){_0x1c04af[_0xf5b8('0x5f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf5b8('0xc8')],'as':_0xf5b8('0xff'),'attributes':[_0xf5b8('0x33'),_0xf5b8('0x100'),'internal'],'required':![]},{'model':db[_0xf5b8('0x101')],'as':'Tags','attributes':['id','name',_0xf5b8('0x102')],'where':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]?{'id':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]}:undefined,'required':_0xed9e3f[_0xf5b8('0x4f')][_0xf5b8('0x103')]?!![]:![]}];}return db[_0xf5b8('0xba')][_0xf5b8('0x78')](_0x1c04af);})[_0xf5b8('0x18')](function(_0x36d403){_0x142055[_0xf5b8('0x60')]=_0x36d403;return _0x142055;});}})[_0xf5b8('0x18')](respondWithFilteredResult(_0x1b6188,_0x1c04af))[_0xf5b8('0x23')](handleError(_0x1b6188,null));};exports[_0xf5b8('0x104')]=function(_0xc3ce98,_0x16a3d4){var _0x28f996=0x0;var _0x30e09b=0x0;var _0x2f815b=![];var _0x2ad683;var _0x478fe2;return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0xc3ce98[_0xf5b8('0x73')]['id']},'include':[{'model':db[_0xf5b8('0x9b')],'as':_0xf5b8('0x9b'),'include':[{'model':db[_0xf5b8('0x9b')],'as':'Intervals','attributes':['id',_0xf5b8('0xac')]}]}]})[_0xf5b8('0x18')](handleEntityNotFound(_0x16a3d4,null))[_0xf5b8('0x18')](function(_0x3b73e4){if(_0x3b73e4){_0x2ad683=_0x3b73e4;return _0x3b73e4[_0xf5b8('0x105')]({'raw':!![]});}})[_0xf5b8('0x18')](function(_0x13b138){if(_0x2ad683){if(_0x13b138){_0x478fe2=_0x13b138;}}return require(_0xf5b8('0x8c'))[_0xf5b8('0x8d')]();})[_0xf5b8('0x18')](function(_0x511b5e){if(_0x511b5e){_0x30e09b=_0x511b5e[_0xf5b8('0x106')];_0x2f815b=_0x511b5e[_0xf5b8('0x8e')];}})[_0xf5b8('0x18')](function(){return db[_0xf5b8('0xba')][_0xf5b8('0x29')]({'where':{'closed':![]}});})[_0xf5b8('0x18')](function(_0x4bce1e){_0x28f996=_0x4bce1e;if(_0x30e09b&&_0x4bce1e>_0x30e09b){return db[_0xf5b8('0x107')]['findOne']({'where':{'id':0x1}})[_0xf5b8('0x18')](function(_0x1b587a){if(_0x1b587a){_0x1b587a['increment'](_0xf5b8('0x108'));}});}})['then'](function(){var _0x39ccf1=_0x2ad683['Interval'];var _0x54e76=_0x2ad683[_0xf5b8('0x109')]||undefined;return _0x39ccf1?_0x39ccf1[_0xf5b8('0x9c')](_0x54e76):!![];})[_0xf5b8('0x18')](function(_0x1ca2d6){var _0x2da0ba=fs[_0xf5b8('0xdf')](path[_0xf5b8('0x8a')](config['root'],_0xf5b8('0x10a')),_0xf5b8('0x10b'));var _0x5654a4=_0xf5b8('0x10c');var _0xb3acd4=![];var _0x1a4861,_0x1fcd89;if(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')]){_0x1a4861=new URL(_0xc3ce98['headers'][_0xf5b8('0x40')])['origin'];}else if(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x10d')]){_0x1a4861=new URL(_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x10d')])[_0xf5b8('0x10d')];}else{_0x1a4861=_0xf5b8('0x10e');}_0x1fcd89=typeof _0x2ad683[_0xf5b8('0x66')][_0xf5b8('0x3c')](',')[_0xf5b8('0x6f')](function(_0x101faa){return wildcardUtils[_0xf5b8('0x10f')](_0x101faa,_0x1a4861);})!==_0xf5b8('0x28');var _0x206e47={'chatVersion':_0x5654a4,'chatWebsiteAddressOrigin':_0x1fcd89?_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')]:_0x2ad683[_0xf5b8('0x66')],'remote':_0x2ad683[_0xf5b8('0x110')],'query':querystring['stringify'](_[_0xf5b8('0x5c')](_0x2ad683[_0xf5b8('0x2e')]({'plain':!![]}),{'customerIp':_0xc3ce98[_0xf5b8('0xb7')]['x-forwarded-for']||_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x111')]||_0xc3ce98[_0xf5b8('0x112')][_0xf5b8('0x113')]||_0xc3ce98['ip'],'referer':_0xc3ce98[_0xf5b8('0xb7')][_0xf5b8('0x40')],'openedInteractions':_0x28f996,'maxInteractions':_0x30e09b,'virtual':_0x2f815b[_0xf5b8('0x106')],'online':_0x1ca2d6,'custom':_0x2f815b,'address':_0x1fcd89?_0xc3ce98[_0xf5b8('0xb7')]['referer']:null}))['replace'](/'/g,'\x5c\x27')};_0x16a3d4[_0xf5b8('0x34')](ejs[_0xf5b8('0xe0')](Mustache[_0xf5b8('0xe0')](_0x2da0ba,_0x206e47),{'proactiveActions':_0x478fe2,'alignment':_0x2ad683[_0xf5b8('0x114')],'verticalAlignment':_0x2ad683[_0xf5b8('0x115')],'div_color':_0x2ad683[_0xf5b8('0x102')],'labelText':_0x2ad683[_0xf5b8('0x116')],'text_color':_0x2ad683[_0xf5b8('0x117')],'text_button_color':_0x2ad683['textButtonColor'],'button_color':_0x2ad683['color_button'],'background_color':_0x2ad683[_0xf5b8('0x118')],'hideWhenOffline':_0x2ad683[_0xf5b8('0x119')],'intervalId':_0x2ad683[_0xf5b8('0x11a')],'isDevelopment':_0xb3acd4,'chatVersion':_0x5654a4}));})[_0xf5b8('0x23')](handleError(_0x16a3d4,null));};exports['addApplications']=function(_0x1c984d,_0x446ed5){var _0xeed1f1=_0x1c984d['params']['id'];var _0x5ea232=_0x1c984d['body'];var _0x2706a0=0xc8;var _0x301622=null;return db[_0xf5b8('0xea')]['transaction']({'isolationLevel':db[_0xf5b8('0xea')]['Transaction'][_0xf5b8('0x11b')][_0xf5b8('0x11c')]},function(_0xaaf983){return db['ChatWebsite'][_0xf5b8('0x7c')]({'where':{'id':_0xeed1f1},'transaction':_0xaaf983})[_0xf5b8('0x18')](function(_0x5e5b3a){if(_0x5e5b3a){return db[_0xf5b8('0x11d')][_0xf5b8('0x2d')]({'where':{'ChatWebsiteId':_0xeed1f1},'transaction':_0xaaf983})[_0xf5b8('0x18')](function(){var _0x54234c=_['map'](_0x5ea232,function(_0x53794c){_0x53794c[_0xf5b8('0x75')]=_0xeed1f1;return _0x53794c;});return db[_0xf5b8('0x11d')][_0xf5b8('0xec')](_0x54234c,{'transaction':_0xaaf983});});}else{_0x2706a0=0x194;_0x301622=[];}});})[_0xf5b8('0x18')](function(){if(_0x2706a0!==0x194){return db['ChatApplication'][_0xf5b8('0x11e')]({'where':{'ChatWebsiteId':_0xeed1f1},'order':_0xf5b8('0xaf')})[_0xf5b8('0x18')](function(_0x1c1c55){_0x301622=_0x1c1c55;});}})[_0xf5b8('0x23')](function(_0x535a9c){_0x2706a0=0x1f4;logger[_0xf5b8('0x1e')](_0x535a9c[_0xf5b8('0x32')]);if(_0x535a9c['name']){delete _0x535a9c[_0xf5b8('0x33')];}_0x301622=_0x535a9c;})['finally'](function(){if(_0x301622===null){_0x446ed5['sendStatus'](_0x2706a0);}else{if(_0x2706a0===0x1f4){_0x446ed5['status'](_0x2706a0)[_0xf5b8('0x34')](_0x301622);}else{_0x446ed5[_0xf5b8('0x25')](_0x2706a0)[_0xf5b8('0x26')](_0x301622);}}});};exports[_0xf5b8('0x11f')]=function(_0x5a1575,_0x13e040){var _0x59c45f={};var _0x36caec={};var _0x4934cb;var _0x31bebc;return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x5a1575[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x13e040,null))[_0xf5b8('0x18')](function(_0xddf334){if(_0xddf334){_0x4934cb=_0xddf334;_0x36caec['model']=_[_0xf5b8('0x50')](db[_0xf5b8('0x11d')][_0xf5b8('0x62')]);_0x36caec['query']=_[_0xf5b8('0x50')](_0x5a1575[_0xf5b8('0x4f')]);_0x36caec[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x36caec['model'],_0x36caec['query']);_0x59c45f[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x36caec[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x5a1575['query'][_0xf5b8('0x54')]));_0x59c45f['attributes']=_0x59c45f['attributes'][_0xf5b8('0x63')]?_0x59c45f[_0xf5b8('0x53')]:_0x36caec[_0xf5b8('0x48')];_0x59c45f['order']=qs['sort'](_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x59c45f[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x5a1575[_0xf5b8('0x4f')],_0x36caec[_0xf5b8('0x51')]));if(_0x5a1575['query']['filter']){_0x59c45f[_0xf5b8('0x59')]=_['merge'](_0x59c45f[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x59c45f[_0xf5b8('0x53')],function(_0x45e3ec){var _0x305cab={};_0x305cab[_0x45e3ec]={'$like':'%'+_0x5a1575['query'][_0xf5b8('0x5b')]+'%'};return _0x305cab;})});}_0x59c45f=_[_0xf5b8('0x5c')]({},_0x59c45f,_0x5a1575[_0xf5b8('0x5e')]);return _0x4934cb['getApplications'](_0x59c45f);}})[_0xf5b8('0x18')](function(_0x388bd2){if(_0x388bd2){_0x31bebc=_0x388bd2[_0xf5b8('0x63')];if(!_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x55')]('nolimit')){_0x59c45f[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x5a1575[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x59c45f[_0xf5b8('0x27')]=qs['offset'](_0x5a1575[_0xf5b8('0x4f')]['offset']);}return _0x4934cb['getApplications'](_0x59c45f);}})[_0xf5b8('0x18')](function(_0x5d485a){if(_0x5d485a){return _0x5d485a?{'count':_0x31bebc,'rows':_0x5d485a}:null;}})[_0xf5b8('0x18')](respondWithResult(_0x13e040,null))['catch'](handleError(_0x13e040,null));};exports[_0xf5b8('0x120')]=function(_0x5a1422,_0x415397){return db[_0xf5b8('0x121')]['find']({'where':{'id':_0x5a1422[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x415397,null))[_0xf5b8('0x18')](function(_0x420ab1){if(_0x420ab1){return _0x420ab1['addProactiveActions'](_0x5a1422[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x5a1422[_0xf5b8('0x65')],[_0xf5b8('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x415397,null))[_0xf5b8('0x23')](handleError(_0x415397,null));};exports[_0xf5b8('0x105')]=function(_0x48083c,_0x4b5353){var _0x4b6dd1={};var _0x532f9d={};var _0x564ff1;var _0x164da9;return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x48083c[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4b5353,null))[_0xf5b8('0x18')](function(_0x1aa8b0){if(_0x1aa8b0){_0x564ff1=_0x1aa8b0;_0x532f9d['model']=_[_0xf5b8('0x50')](db[_0xf5b8('0x122')][_0xf5b8('0x62')]);_0x532f9d[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x48083c[_0xf5b8('0x4f')]);_0x532f9d[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x532f9d[_0xf5b8('0x48')],_0x532f9d[_0xf5b8('0x4f')]);_0x4b6dd1[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x532f9d[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x48083c[_0xf5b8('0x4f')]['fields']));_0x4b6dd1[_0xf5b8('0x53')]=_0x4b6dd1[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4b6dd1[_0xf5b8('0x53')]:_0x532f9d['model'];_0x4b6dd1[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x48083c['query']['sort']);_0x4b6dd1['where']=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x48083c[_0xf5b8('0x4f')],_0x532f9d[_0xf5b8('0x51')]));if(_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x5b')]){_0x4b6dd1[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x4b6dd1['where'],{'$or':_[_0xf5b8('0x4d')](_0x4b6dd1['attributes'],function(_0x472e58){var _0x3e9fd3={};_0x3e9fd3[_0x472e58]={'$like':'%'+_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x3e9fd3;})});}_0x4b6dd1=_[_0xf5b8('0x5c')]({},_0x4b6dd1,_0x48083c[_0xf5b8('0x5e')]);return _0x564ff1[_0xf5b8('0x105')](_0x4b6dd1);}})['then'](function(_0x30ba73){if(_0x30ba73){_0x164da9=_0x30ba73[_0xf5b8('0x63')];if(!_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4b6dd1[_0xf5b8('0x2a')]=qs['limit'](_0x48083c['query'][_0xf5b8('0x2a')]);_0x4b6dd1[_0xf5b8('0x27')]=qs['offset'](_0x48083c[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}return _0x564ff1[_0xf5b8('0x105')](_0x4b6dd1);}})[_0xf5b8('0x18')](function(_0x276df8){if(_0x276df8){return _0x276df8?{'count':_0x164da9,'rows':_0x276df8}:null;}})[_0xf5b8('0x18')](respondWithResult(_0x4b5353,null))[_0xf5b8('0x23')](handleError(_0x4b5353,null));};exports[_0xf5b8('0x123')]=function(_0x230794,_0x73d8b4){var _0x59eaf5=_0x230794['query'][_0xf5b8('0x124')]===_0xf5b8('0x125')?'offlineForm':_0xf5b8('0x126');return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'attributes':['id',_0x59eaf5],'where':{'id':_0x230794[_0xf5b8('0x73')]['id']}})['then'](handleEntityNotFound(_0x73d8b4,null))[_0xf5b8('0x18')](function(_0x1648d8){if(_0x1648d8){var _0x7cb0c5=_0x1648d8[_0x59eaf5];var _0x3689f1=_0x7cb0c5&&_0x7cb0c5['items']?_0x7cb0c5[_0xf5b8('0x127')]:[];_0x73d8b4[_0xf5b8('0x34')]({'fromKey':_[_0xf5b8('0x8f')](_0x7cb0c5[_0xf5b8('0x128')])?undefined:_0x7cb0c5[_0xf5b8('0x128')],'count':_0x3689f1[_0xf5b8('0x63')],'rows':_0x3689f1});}})[_0xf5b8('0x23')](handleError(_0x73d8b4,null));};exports[_0xf5b8('0x129')]=function(_0x48b1f6,_0x4a2d32){var _0x51ff7d={'raw':![],'where':{}};var _0x58d110={};var _0x10d940={'count':0x0,'rows':[]};return db[_0xf5b8('0x4e')][_0xf5b8('0x7c')]({'where':{'id':_0x48b1f6['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4a2d32,null))[_0xf5b8('0x18')](function(_0x236ed6){if(_0x236ed6){_0x58d110[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db[_0xf5b8('0xe2')]['rawAttributes']);_0x58d110[_0xf5b8('0x4f')]=_[_0xf5b8('0x50')](_0x48b1f6[_0xf5b8('0x4f')]);_0x58d110[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x58d110[_0xf5b8('0x48')],_0x58d110[_0xf5b8('0x4f')]);_0x51ff7d[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x58d110[_0xf5b8('0x48')],qs['fields'](_0x48b1f6[_0xf5b8('0x4f')]['fields']));_0x51ff7d[_0xf5b8('0x53')]=_0x51ff7d[_0xf5b8('0x53')]['length']?_0x51ff7d[_0xf5b8('0x53')]:_0x58d110[_0xf5b8('0x48')];if(!_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x51ff7d[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x48b1f6[_0xf5b8('0x4f')]['limit']);_0x51ff7d[_0xf5b8('0x27')]=qs['offset'](_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x27')]);}_0x51ff7d[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x48b1f6[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x51ff7d[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_[_0xf5b8('0x5a')](_0x48b1f6['query'],_0x58d110[_0xf5b8('0x51')]));_0x51ff7d['where'][_0xf5b8('0x75')]=_0x236ed6['id'];if(_0x48b1f6[_0xf5b8('0x4f')]['filter']){_0x51ff7d[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x51ff7d[_0xf5b8('0x59')],{'$or':_[_0xf5b8('0x4d')](_0x51ff7d[_0xf5b8('0x53')],function(_0x3e6925){var _0x13c9e8={};_0x13c9e8[_0x3e6925]={'$like':'%'+_0x48b1f6[_0xf5b8('0x4f')]['filter']+'%'};return _0x13c9e8;})});}_0x51ff7d=_[_0xf5b8('0x5c')]({},_0x51ff7d,_0x48b1f6['options']);return db['ChatOfflineMessage'][_0xf5b8('0x29')]({'where':_0x51ff7d[_0xf5b8('0x59')]})[_0xf5b8('0x18')](function(_0x45c3e8){_0x10d940[_0xf5b8('0x29')]=_0x45c3e8;if(_0x48b1f6['query'][_0xf5b8('0x64')]){_0x51ff7d['include']=[{'all':!![]}];}else{_0x51ff7d[_0xf5b8('0x5f')]=[{'model':db[_0xf5b8('0xb5')],'as':_0xf5b8('0x12a'),'required':![]},{'model':db[_0xf5b8('0xeb')],'as':_0xf5b8('0x12b'),'required':![]}];}return db[_0xf5b8('0xe2')][_0xf5b8('0x78')](_0x51ff7d);})[_0xf5b8('0x18')](function(_0xf70ada){_0x10d940[_0xf5b8('0x60')]=_0xf70ada;return _0x10d940;});}})[_0xf5b8('0x18')](respondWithFilteredResult(_0x4a2d32,_0x51ff7d))[_0xf5b8('0x23')](handleError(_0x4a2d32,null));};exports[_0xf5b8('0x12c')]=function(_0x4361b3,_0x4ccefc){return db[_0xf5b8('0x4e')][_0xf5b8('0x6f')]({'where':{'id':_0x4361b3[_0xf5b8('0x73')]['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x4ccefc,null))[_0xf5b8('0x18')](function(_0x5b7b93){if(_0x5b7b93){return _0x5b7b93[_0xf5b8('0x12c')](_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')],_[_0xf5b8('0xfe')](_0x4361b3[_0xf5b8('0x65')],[_0xf5b8('0x7f'),'id'])||{})[_0xf5b8('0xde')](function(_0x53b36e){for(var _0xf1b184=0x0;_0xf1b184<_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')][_0xf5b8('0x63')];_0xf1b184+=0x1){socket[_0xf5b8('0x12d')](_0xf5b8('0x12e'),{'UserId':Number(_0x4361b3[_0xf5b8('0x65')][_0xf5b8('0x7f')][_0xf1b184]),'ChatWebsiteId':Number(_0x4361b3[_0xf5b8('0x73')]['id'])});}return _0x53b36e;});}})['then'](respondWithResult(_0x4ccefc,null))[_0xf5b8('0x23')](handleError(_0x4ccefc,null));};exports[_0xf5b8('0x12f')]=function(_0x254bf7,_0x274a96){return db[_0xf5b8('0x4e')]['find']({'where':{'id':_0x254bf7['params']['id']}})[_0xf5b8('0x18')](handleEntityNotFound(_0x274a96,null))['then'](function(_0x4d134c){if(_0x4d134c){return _0x4d134c[_0xf5b8('0x12f')](_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')])[_0xf5b8('0x18')](function(){if(_['isArray'](_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')])){for(var _0x1f6fac=0x0;_0x1f6fac<_0x254bf7[_0xf5b8('0x4f')]['ids'][_0xf5b8('0x63')];_0x1f6fac+=0x1){socket[_0xf5b8('0x12d')](_0xf5b8('0x130'),{'UserId':Number(_0x254bf7['query'][_0xf5b8('0x7f')][_0x1f6fac]),'ChatWebsiteId':Number(_0x254bf7[_0xf5b8('0x73')]['id'])});}}else{socket[_0xf5b8('0x12d')](_0xf5b8('0x130'),{'UserId':Number(_0x254bf7[_0xf5b8('0x4f')][_0xf5b8('0x7f')]),'ChatWebsiteId':Number(_0x254bf7[_0xf5b8('0x73')]['id'])});}});}})[_0xf5b8('0x18')](respondWithStatusCode(_0x274a96,null))['catch'](handleError(_0x274a96,null));};exports[_0xf5b8('0x131')]=function(_0x3cd565,_0x441036){var _0x4790bc={};var _0x24415d={};var _0xf9110c;var _0x3eab19;return db[_0xf5b8('0x4e')]['findOne']({'where':{'id':_0x3cd565['params']['id']}})['then'](handleEntityNotFound(_0x441036,null))[_0xf5b8('0x18')](function(_0x574040){if(_0x574040){_0xf9110c=_0x574040;_0x24415d[_0xf5b8('0x48')]=_[_0xf5b8('0x50')](db['User']['rawAttributes']);_0x24415d['query']=_[_0xf5b8('0x50')](_0x3cd565['query']);_0x24415d[_0xf5b8('0x51')]=_[_0xf5b8('0x52')](_0x24415d['model'],_0x24415d[_0xf5b8('0x4f')]);_0x4790bc[_0xf5b8('0x53')]=_[_0xf5b8('0x52')](_0x24415d[_0xf5b8('0x48')],qs[_0xf5b8('0x54')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x54')]));_0x4790bc[_0xf5b8('0x53')]=_0x4790bc[_0xf5b8('0x53')][_0xf5b8('0x63')]?_0x4790bc['attributes']:_0x24415d[_0xf5b8('0x48')];_0x4790bc[_0xf5b8('0x57')]=qs[_0xf5b8('0x58')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x58')]);_0x4790bc[_0xf5b8('0x59')]=qs[_0xf5b8('0x51')](_['pick'](_0x3cd565['query'],_0x24415d[_0xf5b8('0x51')]));if(_0x3cd565['query'][_0xf5b8('0x5b')]){_0x4790bc[_0xf5b8('0x59')]=_[_0xf5b8('0x5c')](_0x4790bc[_0xf5b8('0x59')],{'$or':_['map'](_0x4790bc[_0xf5b8('0x53')],function(_0x17081b){var _0x1b978d={};_0x1b978d[_0x17081b]={'$like':'%'+_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x5b')]+'%'};return _0x1b978d;})});}_0x4790bc=_['merge']({},_0x4790bc,_0x3cd565[_0xf5b8('0x5e')]);return _0xf9110c['getAgents'](_0x4790bc);}})[_0xf5b8('0x18')](function(_0x1a6480){if(_0x1a6480){_0x3eab19=_0x1a6480[_0xf5b8('0x63')];if(!_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x55')](_0xf5b8('0x56'))){_0x4790bc[_0xf5b8('0x2a')]=qs[_0xf5b8('0x2a')](_0x3cd565[_0xf5b8('0x4f')][_0xf5b8('0x2a')]);_0x4790bc[_0xf5b8('0x27')]=qs[_0xf5b8('0x27')](_0x3cd565[_0xf5b8('0x4f')]['offset']);}return _0xf9110c['getAgents'](_0x4790bc);}})[_0xf5b8('0x18')](function(_0x55e783){if(_0x55e783){return _0x55e783?{'count':_0x3eab19,'rows':_0x55e783}:null;}})['then'](respondWithResult(_0x441036,null))[_0xf5b8('0x23')](handleError(_0x441036,null));}; \ No newline at end of file +var _0x1d3d=['*,*,*,*','Start','startRouting','EventManager','notify','offline','files','ValidationError','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','Sequelize','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','openNewInteraction','MailAccountId','originalname','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Owner','fullname','internal','Tag','Tags','tag','getSnippet','Intervals','interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','ifTime','3.9.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','bulkCreate','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','url','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','Pause','map','ChatWebsite','fieldName','key','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','mandatoryDispositionPause','keys','fields','include','options','find','create','body','address','split','forEach','trim','testWildcardValidity','user','role','UserProfileSection','autoAssociation','params','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','ChatWebsiteId','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','showCustomerAvatar','isNil','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','chat','from','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','mapKey','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','contact','threadId','closed','referer','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','queue'];(function(_0x1f7a00,_0x341591){var _0x4b151c=function(_0x51fceb){while(--_0x51fceb){_0x1f7a00['push'](_0x1f7a00['shift']());}};_0x4b151c(++_0x341591);}(_0x1d3d,0x69));var _0xd1d3=function(_0x4fa2bc,_0x58ec5f){_0x4fa2bc=_0x4fa2bc-0x0;var _0x45946b=_0x1d3d[_0x4fa2bc];return _0x45946b;};'use strict';var Mustache=require(_0xd1d3('0x0'));var util=require(_0xd1d3('0x1'));var path=require(_0xd1d3('0x2'));var ejs=require(_0xd1d3('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1d3('0x4'));var querystring=require('querystring');var htmlToText=require(_0xd1d3('0x5'));var Redis=require(_0xd1d3('0x6'));var jayson=require(_0xd1d3('0x7'));var qs=require(_0xd1d3('0x8'));var logger=require(_0xd1d3('0x9'))(_0xd1d3('0xa'));var config=require(_0xd1d3('0xb'));var APIBadRequestError=require('../../errors/api')[_0xd1d3('0xc')];var APINotFoundError=require(_0xd1d3('0xd'))[_0xd1d3('0xe')];var APIOutOfIntervalError=require(_0xd1d3('0xd'))[_0xd1d3('0xf')];var APIHandleError=require(_0xd1d3('0xd'))[_0xd1d3('0x10')];var APIConflictError=require('../../errors/api')['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xd1d3('0x11'))['URL'];var db=require('../../mysqldb')['db'];config['redis']=_[_0xd1d3('0x12')](config[_0xd1d3('0x13')],{'host':_0xd1d3('0x14'),'port':0x18eb});var socket=require(_0xd1d3('0x15'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xd1d3('0x16')](socket);var client=jayson[_0xd1d3('0x17')][_0xd1d3('0x18')]({'port':0x232c});var client9002=jayson[_0xd1d3('0x17')]['http']({'port':0x232a});var client9003=jayson[_0xd1d3('0x17')][_0xd1d3('0x18')]({'port':0x232b});var client9001=jayson[_0xd1d3('0x17')][_0xd1d3('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x24d8e9,_0x1c03a0,_0x41ee0f,_0x508274){return new Promise(function(_0x1dfd68,_0x13b2ed){var _0x43b57d=_0x508274||client;return _0x43b57d[_0xd1d3('0x19')](_0x24d8e9,_0x41ee0f)[_0xd1d3('0x1a')](function(_0x584753){logger[_0xd1d3('0x1b')](_0xd1d3('0x1c'),_0x1c03a0,_0xd1d3('0x1d'));logger[_0xd1d3('0x1e')](_0xd1d3('0x1f'),_0x1c03a0,_0xd1d3('0x1d'),JSON[_0xd1d3('0x20')](_0x584753));if(_0x584753[_0xd1d3('0x21')]){if(_0x584753[_0xd1d3('0x21')]['code']===0x1f4){logger[_0xd1d3('0x21')](_0xd1d3('0x1c'),_0x1c03a0,_0x584753[_0xd1d3('0x21')][_0xd1d3('0x22')]);return _0x13b2ed(_0x584753[_0xd1d3('0x21')]['message']);}logger[_0xd1d3('0x21')](_0xd1d3('0x1c'),_0x1c03a0,_0x584753[_0xd1d3('0x21')][_0xd1d3('0x22')]);return _0x1dfd68(_0x584753['error'][_0xd1d3('0x22')]);}else{logger[_0xd1d3('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x1c03a0,_0xd1d3('0x1d'));_0x1dfd68(_0x584753[_0xd1d3('0x23')]['message']);}})[_0xd1d3('0x24')](function(_0x303162){logger[_0xd1d3('0x21')](_0xd1d3('0x1c'),_0x1c03a0,_0x303162);_0x13b2ed(_0x303162);});});}function respondWithStatusCode(_0x119881,_0x22c7d){_0x22c7d=_0x22c7d||0xcc;return function(_0x425fe2){if(_0x425fe2){return _0x119881[_0xd1d3('0x25')](_0x22c7d);}return _0x119881[_0xd1d3('0x26')](_0x22c7d)[_0xd1d3('0x27')]();};}function respondWithResult(_0x3c5d90,_0x3a9801){_0x3a9801=_0x3a9801||0xc8;return function(_0xdfc671){if(_0xdfc671){return _0x3c5d90['status'](_0x3a9801)[_0xd1d3('0x28')](_0xdfc671);}};}function respondWithFilteredResult(_0x323fc5,_0x2f61fb){return function(_0x3b1dcc){if(_0x3b1dcc){var _0x5975c1=typeof _0x2f61fb[_0xd1d3('0x29')]===_0xd1d3('0x2a')&&typeof _0x2f61fb[_0xd1d3('0x2b')]===_0xd1d3('0x2a');var _0x1ab985=_0x3b1dcc[_0xd1d3('0x2c')];var _0x59c8a3=_0x5975c1?0x0:_0x2f61fb['offset'];var _0x2ac2ef=_0x5975c1?_0x3b1dcc['count']:_0x2f61fb['offset']+_0x2f61fb[_0xd1d3('0x2b')];var _0x1b5ebf;if(_0x2ac2ef>=_0x1ab985){_0x2ac2ef=_0x1ab985;_0x1b5ebf=0xc8;}else{_0x1b5ebf=0xce;}_0x323fc5['status'](_0x1b5ebf);return _0x323fc5[_0xd1d3('0x2d')](_0xd1d3('0x2e'),_0x59c8a3+'-'+_0x2ac2ef+'/'+_0x1ab985)[_0xd1d3('0x28')](_0x3b1dcc);}return null;};}function saveUpdates(_0x56e66a){return function(_0x56d626){if(_0x56d626){return _0x56d626[_0xd1d3('0x2f')](_0x56e66a)[_0xd1d3('0x1a')](function(_0x11ab4d){return _0x11ab4d;});}return null;};}function removeEntity(_0x440cce){return function(_0x42e8a3){if(_0x42e8a3){return _0x42e8a3[_0xd1d3('0x30')]()['then'](function(){var _0x3a0cda=_0x42e8a3[_0xd1d3('0x31')]({'plain':!![]});var _0x4513d0=_0xd1d3('0x32');return db[_0xd1d3('0x33')]['destroy']({'where':{'type':_0x4513d0,'resourceId':_0x3a0cda['id']}})['then'](function(){return _0x42e8a3;});})['then'](function(){_0x440cce['status'](0xcc)[_0xd1d3('0x27')]();});}};}function handleEntityNotFound(_0x40a414){return function(_0x54289c){if(!_0x54289c){_0x40a414[_0xd1d3('0x25')](0x194);}return _0x54289c;};}function handleError(_0x4e2f9f,_0x20575a){_0x20575a=_0x20575a||0x1f4;return function(_0x2007c2){logger[_0xd1d3('0x21')](_0x2007c2['stack']);if(_0x2007c2['name']){delete _0x2007c2[_0xd1d3('0x34')];}_0x4e2f9f[_0xd1d3('0x26')](_0x20575a)[_0xd1d3('0x35')](_0x2007c2);};}function createInteractionObject(_0x1f7af1,_0x55d6d7,_0x4177f8,_0x51ba60){var _0x443e6c=require(_0xd1d3('0x36'));var _0x118174=new _0x443e6c();var _0x325c06=_0x118174[_0xd1d3('0x37')](_0x4177f8['user-agent'])[_0xd1d3('0x38')]();var _0x52de92=_0x55d6d7[_0xd1d3('0x39')];if(_0x4177f8[_0xd1d3('0x3a')]){_0x52de92=_0x4177f8[_0xd1d3('0x3a')];}else if(_0x4177f8[_0xd1d3('0x3b')]){_0x52de92=_[_0xd1d3('0x3c')](_0x4177f8[_0xd1d3('0x3b')]['split'](','));}return{'ContactId':_0x51ba60['id'],'ChatWebsiteId':_0x1f7af1,'from':(_0x51ba60[_0xd1d3('0x3d')]||'')+'\x20'+(_0x51ba60[_0xd1d3('0x3e')]||''),'customerIp':_0x52de92,'customerPort':_0x4177f8[_0xd1d3('0x3f')]?_0x4177f8[_0xd1d3('0x3f')]:null,'referer':_0x55d6d7['referer'],'browserName':_0x325c06[_0xd1d3('0x40')][_0xd1d3('0x34')]&&_0x325c06[_0xd1d3('0x40')][_0xd1d3('0x41')]?util[_0xd1d3('0x42')](_0xd1d3('0x43'),_0x325c06[_0xd1d3('0x40')][_0xd1d3('0x34')],_0x325c06[_0xd1d3('0x40')][_0xd1d3('0x41')]):_0xd1d3('0x44'),'browserVersion':_0x325c06[_0xd1d3('0x40')][_0xd1d3('0x41')]||'unknown','osName':util[_0xd1d3('0x42')](_0xd1d3('0x43'),_0x325c06['os']['name'],_0x325c06['os'][_0xd1d3('0x41')]),'osVersion':_0x325c06['os']['version'],'deviceModel':_0x325c06[_0xd1d3('0x45')][_0xd1d3('0x46')]&&_0x325c06['device'][_0xd1d3('0x47')]?util[_0xd1d3('0x42')](_0xd1d3('0x48'),_0x325c06['device'][_0xd1d3('0x46')],_0x325c06[_0xd1d3('0x45')][_0xd1d3('0x47')],_0x325c06[_0xd1d3('0x45')][_0xd1d3('0x49')]):null,'deviceVendor':_0x325c06[_0xd1d3('0x45')]['vendor'],'deviceType':_0x325c06[_0xd1d3('0x45')][_0xd1d3('0x49')],'formData':JSON['stringify'](_0x55d6d7)};}exports['index']=function(_0x1b96f5,_0xed4d41){var _0x9f37bc={'include':[{'model':db[_0xd1d3('0x4a')],'as':'mandatoryDispositionPause'}]},_0x2dfa16={},_0x4d06ea={'count':0x0,'rows':[]};var _0x4630dc=_[_0xd1d3('0x4b')](db[_0xd1d3('0x4c')]['rawAttributes'],function(_0x34f4ef){return{'name':_0x34f4ef[_0xd1d3('0x4d')],'type':_0x34f4ef[_0xd1d3('0x49')][_0xd1d3('0x4e')]};});_0x2dfa16[_0xd1d3('0x46')]=_[_0xd1d3('0x4b')](_0x4630dc,_0xd1d3('0x34'));_0x2dfa16['query']=_['keys'](_0x1b96f5['query']);_0x2dfa16['filters']=_[_0xd1d3('0x4f')](_0x2dfa16[_0xd1d3('0x46')],_0x2dfa16[_0xd1d3('0x50')]);_0x9f37bc[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x2dfa16[_0xd1d3('0x46')],qs['fields'](_0x1b96f5[_0xd1d3('0x50')]['fields']));_0x9f37bc[_0xd1d3('0x51')]=_0x9f37bc[_0xd1d3('0x51')][_0xd1d3('0x52')]?_0x9f37bc['attributes']:_0x2dfa16[_0xd1d3('0x46')];if(!_0x1b96f5[_0xd1d3('0x50')][_0xd1d3('0x53')](_0xd1d3('0x54'))){_0x9f37bc['limit']=qs[_0xd1d3('0x2b')](_0x1b96f5[_0xd1d3('0x50')][_0xd1d3('0x2b')]);_0x9f37bc[_0xd1d3('0x29')]=qs[_0xd1d3('0x29')](_0x1b96f5[_0xd1d3('0x50')][_0xd1d3('0x29')]);}_0x9f37bc[_0xd1d3('0x55')]=qs[_0xd1d3('0x56')](_0x1b96f5[_0xd1d3('0x50')]['sort']);_0x9f37bc[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_[_0xd1d3('0x59')](_0x1b96f5['query'],_0x2dfa16[_0xd1d3('0x58')]),_0x4630dc);if(_0x1b96f5[_0xd1d3('0x50')][_0xd1d3('0x5a')]){_0x9f37bc[_0xd1d3('0x57')]=_[_0xd1d3('0x5b')](_0x9f37bc[_0xd1d3('0x57')],{'$or':_[_0xd1d3('0x4b')](_0x4630dc,function(_0x58135d){if(_0x58135d[_0xd1d3('0x49')]!==_0xd1d3('0x5c')){var _0x34f16f={};_0x34f16f[_0x58135d[_0xd1d3('0x34')]]={'$like':'%'+_0x1b96f5['query']['filter']+'%'};return _0x34f16f;}})});}_0x9f37bc=_[_0xd1d3('0x5b')]({},_0x9f37bc,_0x1b96f5['options']);var _0x45dadf={'where':_0x9f37bc['where']};return db[_0xd1d3('0x4c')]['count'](_0x45dadf)['then'](function(_0x136faf){_0x4d06ea['count']=_0x136faf;if(_0x1b96f5['query'][_0xd1d3('0x5d')]){_0x9f37bc['include']=[{'all':!![]}];}return db[_0xd1d3('0x4c')][_0xd1d3('0x5e')](_0x9f37bc);})[_0xd1d3('0x1a')](function(_0x211d14){_0x4d06ea[_0xd1d3('0x5f')]=_0x211d14;return _0x4d06ea;})['then'](respondWithFilteredResult(_0xed4d41,_0x9f37bc))[_0xd1d3('0x24')](handleError(_0xed4d41,null));};exports[_0xd1d3('0x60')]=function(_0x4879fc,_0x727481){var _0x5baef7={'raw':![],'where':{'id':_0x4879fc['params']['id']},'include':[{'model':db['Pause'],'as':_0xd1d3('0x61')}]},_0xe8939e={};_0xe8939e[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db[_0xd1d3('0x4c')]['rawAttributes']);_0xe8939e[_0xd1d3('0x50')]=_['keys'](_0x4879fc[_0xd1d3('0x50')]);_0xe8939e[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0xe8939e[_0xd1d3('0x46')],_0xe8939e[_0xd1d3('0x50')]);_0x5baef7[_0xd1d3('0x51')]=_['intersection'](_0xe8939e[_0xd1d3('0x46')],qs[_0xd1d3('0x63')](_0x4879fc[_0xd1d3('0x50')]['fields']));_0x5baef7['attributes']=_0x5baef7['attributes']['length']?_0x5baef7[_0xd1d3('0x51')]:_0xe8939e[_0xd1d3('0x46')];if(_0x4879fc[_0xd1d3('0x50')][_0xd1d3('0x5d')]){_0x5baef7[_0xd1d3('0x64')]=[{'all':!![]}];}_0x5baef7=_[_0xd1d3('0x5b')]({},_0x5baef7,_0x4879fc[_0xd1d3('0x65')]);return db[_0xd1d3('0x4c')][_0xd1d3('0x66')](_0x5baef7)[_0xd1d3('0x1a')](handleEntityNotFound(_0x727481,null))['then'](respondWithResult(_0x727481,null))[_0xd1d3('0x24')](handleError(_0x727481,null));};exports[_0xd1d3('0x67')]=function(_0x51d534,_0x1d2681){var _0x5e7bce=null;_0x51d534[_0xd1d3('0x68')][_0xd1d3('0x69')][_0xd1d3('0x6a')](',')[_0xd1d3('0x6b')](_0x572ff4=>{if(_0x572ff4[_0xd1d3('0x6c')]()!==''&&!wildcardUtils[_0xd1d3('0x6d')](_0x572ff4[_0xd1d3('0x6c')]())){_0x5e7bce=new APIBadRequestError('\x22'+_0x572ff4+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x5e7bce){return handleError(_0x1d2681,null)(_0x5e7bce);}return db[_0xd1d3('0x4c')][_0xd1d3('0x67')](_0x51d534[_0xd1d3('0x68')],{})['then'](function(_0x50dfa8){var _0x115857=_0x51d534[_0xd1d3('0x6e')]['get']({'plain':!![]});if(!_0x115857)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115857[_0xd1d3('0x6f')]===_0xd1d3('0x6e')){var _0x21e9fc=_0x50dfa8['get']({'plain':!![]});var _0x22e753=_0xd1d3('0x32');return db[_0xd1d3('0x70')][_0xd1d3('0x66')]({'where':{'name':_0x22e753,'userProfileId':_0x115857['userProfileId']},'raw':!![]})['then'](function(_0x2be71f){if(_0x2be71f&&_0x2be71f[_0xd1d3('0x71')]===0x0){return db[_0xd1d3('0x33')][_0xd1d3('0x67')]({'name':_0x21e9fc[_0xd1d3('0x34')],'resourceId':_0x21e9fc['id'],'type':_0x2be71f[_0xd1d3('0x34')],'sectionId':_0x2be71f['id']},{})[_0xd1d3('0x1a')](function(){return _0x50dfa8;});}else{return _0x50dfa8;}})[_0xd1d3('0x24')](function(_0x245799){logger[_0xd1d3('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x245799);throw _0x245799;});}return _0x50dfa8;})[_0xd1d3('0x1a')](respondWithResult(_0x1d2681,0xc9))[_0xd1d3('0x24')](handleError(_0x1d2681,null));};exports[_0xd1d3('0x2f')]=function(_0x501f45,_0x404782){var _0x3f1eed=null;_0x501f45[_0xd1d3('0x68')][_0xd1d3('0x69')][_0xd1d3('0x6a')](',')[_0xd1d3('0x6b')](_0x4c347f=>{if(_0x4c347f[_0xd1d3('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x4c347f[_0xd1d3('0x6c')]())){_0x3f1eed=new APIBadRequestError('\x22'+_0x4c347f+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x3f1eed){return handleError(_0x404782,null)(_0x3f1eed);}if(_0x501f45[_0xd1d3('0x68')]['id']){delete _0x501f45[_0xd1d3('0x68')]['id'];}return db[_0xd1d3('0x4c')]['find']({'where':{'id':_0x501f45['params']['id']},'include':[{'model':db['Pause'],'as':_0xd1d3('0x61')}]})[_0xd1d3('0x1a')](handleEntityNotFound(_0x404782,null))[_0xd1d3('0x1a')](saveUpdates(_0x501f45[_0xd1d3('0x68')],null))[_0xd1d3('0x1a')](respondWithResult(_0x404782,null))[_0xd1d3('0x24')](handleError(_0x404782,null));};exports['destroy']=function(_0x4557c1,_0x7776ef){return db['ChatWebsite'][_0xd1d3('0x66')]({'where':{'id':_0x4557c1[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x7776ef,null))[_0xd1d3('0x1a')](removeEntity(_0x7776ef,null))['catch'](handleError(_0x7776ef,null));};exports[_0xd1d3('0x73')]=function(_0x13cee7,_0x137d76){return db['ChatWebsite'][_0xd1d3('0x73')]()[_0xd1d3('0x1a')](respondWithResult(_0x137d76,null))[_0xd1d3('0x24')](handleError(_0x137d76,null));};exports[_0xd1d3('0x74')]=function(_0x18d6dd,_0x25d229){if(_0x18d6dd['body']['id']){delete _0x18d6dd[_0xd1d3('0x68')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x18d6dd['params']['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x25d229,null))['then'](function(_0x41152a){if(_0x41152a){_0x18d6dd[_0xd1d3('0x68')]['ChatWebsiteId']=_0x41152a['id'];return db['Disposition']['create'](_0x18d6dd['body']);}})['then'](respondWithResult(_0x25d229,null))[_0xd1d3('0x24')](handleError(_0x25d229,null));};exports[_0xd1d3('0x75')]=function(_0x3caa0f,_0x1edf79){var _0xe6aaca={'raw':![],'where':{}};var _0x367306={};var _0x551bea={'count':0x0,'rows':[]};return db[_0xd1d3('0x4c')][_0xd1d3('0x76')]({'where':{'id':_0x3caa0f[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x1edf79,null))['then'](function(_0x2c3a63){if(_0x2c3a63){_0x367306['model']=_[_0xd1d3('0x62')](db[_0xd1d3('0x77')][_0xd1d3('0x78')]);_0x367306[_0xd1d3('0x50')]=_[_0xd1d3('0x62')](_0x3caa0f['query']);_0x367306[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0x367306[_0xd1d3('0x46')],_0x367306[_0xd1d3('0x50')]);_0xe6aaca[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x367306['model'],qs[_0xd1d3('0x63')](_0x3caa0f[_0xd1d3('0x50')][_0xd1d3('0x63')]));_0xe6aaca['attributes']=_0xe6aaca[_0xd1d3('0x51')]['length']?_0xe6aaca[_0xd1d3('0x51')]:_0x367306[_0xd1d3('0x46')];if(!_0x3caa0f[_0xd1d3('0x50')]['hasOwnProperty'](_0xd1d3('0x54'))){_0xe6aaca[_0xd1d3('0x2b')]=qs[_0xd1d3('0x2b')](_0x3caa0f[_0xd1d3('0x50')]['limit']);_0xe6aaca[_0xd1d3('0x29')]=qs[_0xd1d3('0x29')](_0x3caa0f[_0xd1d3('0x50')][_0xd1d3('0x29')]);}_0xe6aaca['order']=qs['sort'](_0x3caa0f['query'][_0xd1d3('0x56')]);_0xe6aaca[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_[_0xd1d3('0x59')](_0x3caa0f['query'],_0x367306[_0xd1d3('0x58')]));_0xe6aaca[_0xd1d3('0x57')][_0xd1d3('0x79')]=_0x2c3a63['id'];if(_0x3caa0f[_0xd1d3('0x50')]['filter']){_0xe6aaca['where']=_[_0xd1d3('0x5b')](_0xe6aaca[_0xd1d3('0x57')],{'$or':_['map'](_0xe6aaca[_0xd1d3('0x51')],function(_0x2190e5){var _0x43ae54={};_0x43ae54[_0x2190e5]={'$like':'%'+_0x3caa0f[_0xd1d3('0x50')][_0xd1d3('0x5a')]+'%'};return _0x43ae54;})});}_0xe6aaca=_[_0xd1d3('0x5b')]({},_0xe6aaca,_0x3caa0f[_0xd1d3('0x65')]);return db['Disposition']['count']({'where':_0xe6aaca[_0xd1d3('0x57')]})[_0xd1d3('0x1a')](function(_0x1d284b){_0x551bea[_0xd1d3('0x2c')]=_0x1d284b;if(_0x3caa0f['query'][_0xd1d3('0x5d')]){_0xe6aaca[_0xd1d3('0x64')]=[{'all':!![]}];}return db['Disposition'][_0xd1d3('0x5e')](_0xe6aaca);})[_0xd1d3('0x1a')](function(_0x164d6e){_0x551bea[_0xd1d3('0x5f')]=_0x164d6e;return _0x551bea;});}})['then'](respondWithFilteredResult(_0x1edf79,_0xe6aaca))[_0xd1d3('0x24')](handleError(_0x1edf79,null));};exports[_0xd1d3('0x7a')]=function(_0x431faa,_0x27edfb){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x431faa[_0xd1d3('0x72')]['id']}})['then'](handleEntityNotFound(_0x27edfb,null))[_0xd1d3('0x1a')](function(_0x23d85e){if(_0x23d85e){return _0x23d85e[_0xd1d3('0x7a')](_0x431faa[_0xd1d3('0x50')]['ids']);}})[_0xd1d3('0x1a')](respondWithStatusCode(_0x27edfb,null))[_0xd1d3('0x24')](handleError(_0x27edfb,null));};exports['addAnswer']=function(_0x49597f,_0x1b8d3f){if(_0x49597f['body']['id']){delete _0x49597f[_0xd1d3('0x68')]['id'];}return db[_0xd1d3('0x4c')]['find']({'where':{'id':_0x49597f['params']['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x1b8d3f,null))['then'](function(_0x304943){if(_0x304943){_0x49597f['body'][_0xd1d3('0x79')]=_0x304943['id'];return db['CannedAnswer'][_0xd1d3('0x67')](_0x49597f[_0xd1d3('0x68')]);}})[_0xd1d3('0x1a')](respondWithResult(_0x1b8d3f,null))[_0xd1d3('0x24')](handleError(_0x1b8d3f,null));};exports[_0xd1d3('0x7b')]=function(_0x574adc,_0x4e20ec){var _0x27da62={'raw':![],'where':{}};var _0x33c8b0={};var _0x27308e={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x574adc[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x4e20ec,null))[_0xd1d3('0x1a')](function(_0x7453f8){if(_0x7453f8){_0x33c8b0[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db[_0xd1d3('0x7c')]['rawAttributes']);_0x33c8b0[_0xd1d3('0x50')]=_[_0xd1d3('0x62')](_0x574adc[_0xd1d3('0x50')]);_0x33c8b0[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0x33c8b0['model'],_0x33c8b0[_0xd1d3('0x50')]);_0x27da62[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x33c8b0[_0xd1d3('0x46')],qs[_0xd1d3('0x63')](_0x574adc['query'][_0xd1d3('0x63')]));_0x27da62[_0xd1d3('0x51')]=_0x27da62[_0xd1d3('0x51')]['length']?_0x27da62['attributes']:_0x33c8b0['model'];if(!_0x574adc[_0xd1d3('0x50')][_0xd1d3('0x53')](_0xd1d3('0x54'))){_0x27da62[_0xd1d3('0x2b')]=qs[_0xd1d3('0x2b')](_0x574adc[_0xd1d3('0x50')]['limit']);_0x27da62[_0xd1d3('0x29')]=qs[_0xd1d3('0x29')](_0x574adc[_0xd1d3('0x50')]['offset']);}_0x27da62[_0xd1d3('0x55')]=qs[_0xd1d3('0x56')](_0x574adc['query']['sort']);_0x27da62['where']=qs['filters'](_[_0xd1d3('0x59')](_0x574adc[_0xd1d3('0x50')],_0x33c8b0[_0xd1d3('0x58')]));_0x27da62[_0xd1d3('0x57')][_0xd1d3('0x79')]=_0x7453f8['id'];if(_0x574adc[_0xd1d3('0x50')]['filter']){_0x27da62[_0xd1d3('0x57')]=_[_0xd1d3('0x5b')](_0x27da62[_0xd1d3('0x57')],{'$or':_[_0xd1d3('0x4b')](_0x27da62[_0xd1d3('0x51')],function(_0xc8ae3d){var _0x484f45={};_0x484f45[_0xc8ae3d]={'$like':'%'+_0x574adc[_0xd1d3('0x50')]['filter']+'%'};return _0x484f45;})});}_0x27da62=_[_0xd1d3('0x5b')]({},_0x27da62,_0x574adc['options']);return db[_0xd1d3('0x7c')][_0xd1d3('0x2c')]({'where':_0x27da62[_0xd1d3('0x57')]})[_0xd1d3('0x1a')](function(_0x16a50f){_0x27308e[_0xd1d3('0x2c')]=_0x16a50f;if(_0x574adc['query']['includeAll']){_0x27da62[_0xd1d3('0x64')]=[{'all':!![]}];}return db[_0xd1d3('0x7c')][_0xd1d3('0x5e')](_0x27da62);})[_0xd1d3('0x1a')](function(_0x19170d){_0x27308e[_0xd1d3('0x5f')]=_0x19170d;return _0x27308e;});}})[_0xd1d3('0x1a')](respondWithFilteredResult(_0x4e20ec,_0x27da62))[_0xd1d3('0x24')](handleError(_0x4e20ec,null));};exports[_0xd1d3('0x7d')]=function(_0x3d408e,_0x45cab3){return db[_0xd1d3('0x4c')]['find']({'where':{'id':_0x3d408e[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x45cab3,null))[_0xd1d3('0x1a')](function(_0x1021a7){if(_0x1021a7){return _0x1021a7[_0xd1d3('0x7d')](_0x3d408e[_0xd1d3('0x50')][_0xd1d3('0x7e')]);}})['then'](respondWithStatusCode(_0x45cab3,null))[_0xd1d3('0x24')](handleError(_0x45cab3,null));};exports[_0xd1d3('0x7f')]=function(_0x502782,_0x33f4d6){_0x502782[_0xd1d3('0x68')][_0xd1d3('0x80')]=_0x502782[_0xd1d3('0x81')][_0xd1d3('0x82')];return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x502782[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x33f4d6,null))['then'](saveUpdates(_0x502782['body'],null))[_0xd1d3('0x1a')](respondWithResult(_0x33f4d6,null))[_0xd1d3('0x24')](handleError(_0x33f4d6,null));};exports['addAvatar']=function(_0x198be5,_0x3eeb2a){_0x198be5['body']['agentAvatar']=_0x198be5[_0xd1d3('0x81')][_0xd1d3('0x82')];return db[_0xd1d3('0x4c')]['find']({'where':{'id':_0x198be5[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x3eeb2a,null))[_0xd1d3('0x1a')](saveUpdates(_0x198be5[_0xd1d3('0x68')],null))['then'](respondWithResult(_0x3eeb2a,null))['catch'](handleError(_0x3eeb2a,null));};exports[_0xd1d3('0x83')]=function(_0x54eb92,_0x21f8a6){_0x54eb92[_0xd1d3('0x68')][_0xd1d3('0x84')]=_0x54eb92['file']['filename'];return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x54eb92[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x21f8a6,null))[_0xd1d3('0x1a')](saveUpdates(_0x54eb92[_0xd1d3('0x68')],null))['then'](respondWithResult(_0x21f8a6,null))['catch'](handleError(_0x21f8a6,null));};exports[_0xd1d3('0x85')]=function(_0xa4aba0,_0x383583){_0xa4aba0[_0xd1d3('0x68')][_0xd1d3('0x86')]=_0xa4aba0[_0xd1d3('0x81')][_0xd1d3('0x82')];return db['ChatWebsite'][_0xd1d3('0x66')]({'where':{'id':_0xa4aba0[_0xd1d3('0x72')]['id']}})['then'](handleEntityNotFound(_0x383583,null))['then'](saveUpdates(_0xa4aba0[_0xd1d3('0x68')],null))[_0xd1d3('0x1a')](respondWithResult(_0x383583,null))['catch'](handleError(_0x383583,null));};exports['getLogo']=function(_0xf4bc24,_0x2718b7){var _0x180011=path[_0xd1d3('0x87')](config[_0xd1d3('0x88')],'server/files/images/logos/default_logo.svg');var _0x4990bb={'where':{'id':_0xf4bc24[_0xd1d3('0x72')]['id']},'attributes':['id',_0xd1d3('0x80')],'raw':!![]};var _0x449262=![];return require(_0xd1d3('0x89'))[_0xd1d3('0x8a')]()[_0xd1d3('0x1a')](function(_0x14496f){if(_0x14496f){_0x449262=_0x14496f[_0xd1d3('0x8b')];}})[_0xd1d3('0x1a')](function(){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')](_0x4990bb);})[_0xd1d3('0x1a')](handleEntityNotFound(_0x2718b7,null))[_0xd1d3('0x1a')](function(_0x584441){if(_0x584441){if(!_['isNil'](_0x584441[_0xd1d3('0x80')])){if(fs[_0xd1d3('0x8c')](path[_0xd1d3('0x87')](config['root'],_0xd1d3('0x8d'),_0x584441[_0xd1d3('0x80')]))&&_0x449262){_0x180011=path['join'](config[_0xd1d3('0x88')],_0xd1d3('0x8d'),_0x584441[_0xd1d3('0x80')]);}}return _0x2718b7['download'](_0x180011);}})['catch'](handleError(_0x2718b7,null));};exports['getAvatar']=function(_0x5c38c7,_0xad7631){var _0x30cf91=path['join'](config['root'],_0xd1d3('0x8e'));var _0x294d52={'where':{'id':_0x5c38c7['params']['id']},'attributes':['id',_0xd1d3('0x8f')],'raw':!![]};return db['ChatWebsite']['find'](_0x294d52)[_0xd1d3('0x1a')](handleEntityNotFound(_0xad7631,null))[_0xd1d3('0x1a')](function(_0x44b137){if(_0x44b137){if(!_['isNil'](_0x44b137[_0xd1d3('0x8f')])){if(fs[_0xd1d3('0x8c')](path['join'](config['root'],_0xd1d3('0x90'),_0x44b137[_0xd1d3('0x8f')]))){_0x30cf91=path['join'](config[_0xd1d3('0x88')],_0xd1d3('0x90'),_0x44b137['agentAvatar']);}}return _0xad7631['download'](_0x30cf91);}})[_0xd1d3('0x24')](handleError(_0xad7631,null));};exports['getCustomerAvatar']=function(_0x577dcd,_0x1aabad){var _0x10ab86=path[_0xd1d3('0x87')](config[_0xd1d3('0x88')],'server/files/images/avatars/customer_avatar.png');var _0x38d09a={'where':{'id':_0x577dcd['params']['id']},'attributes':['id','customerAvatar',_0xd1d3('0x91')],'raw':!![]};return db[_0xd1d3('0x4c')]['find'](_0x38d09a)[_0xd1d3('0x1a')](handleEntityNotFound(_0x1aabad,null))[_0xd1d3('0x1a')](function(_0x230b4b){if(_0x230b4b){if(!_[_0xd1d3('0x92')](_0x230b4b[_0xd1d3('0x84')])){if(fs[_0xd1d3('0x8c')](path['join'](config['root'],'server/files/images/avatars/',_0x230b4b[_0xd1d3('0x84')]))&&_0x230b4b[_0xd1d3('0x91')]){_0x10ab86=path['join'](config[_0xd1d3('0x88')],_0xd1d3('0x90'),_0x230b4b[_0xd1d3('0x84')]);}}return _0x1aabad[_0xd1d3('0x93')](_0x10ab86);}})[_0xd1d3('0x24')](handleError(_0x1aabad,null));};exports[_0xd1d3('0x94')]=function(_0x2949b5,_0x4d82e5){var _0xe0e3a=path[_0xd1d3('0x87')](config[_0xd1d3('0x88')],_0xd1d3('0x95'));var _0x236dda={'where':{'id':_0x2949b5[_0xd1d3('0x72')]['id']},'attributes':['id',_0xd1d3('0x86')],'raw':!![]};return db[_0xd1d3('0x4c')][_0xd1d3('0x66')](_0x236dda)[_0xd1d3('0x1a')](handleEntityNotFound(_0x4d82e5,null))[_0xd1d3('0x1a')](function(_0x1109dc){if(_0x1109dc){if(!_[_0xd1d3('0x92')](_0x1109dc[_0xd1d3('0x86')])){if(fs[_0xd1d3('0x8c')](path[_0xd1d3('0x87')](config[_0xd1d3('0x88')],_0xd1d3('0x90'),_0x1109dc[_0xd1d3('0x86')]))){_0xe0e3a=path['join'](config[_0xd1d3('0x88')],_0xd1d3('0x90'),_0x1109dc[_0xd1d3('0x86')]);}}return _0x4d82e5[_0xd1d3('0x93')](_0xe0e3a);}})[_0xd1d3('0x24')](handleError(_0x4d82e5,null));};function checkWebsiteInterval(_0x368e95){var _0x12b983=_0x368e95['Interval'];if(!_0x12b983){return Promise[_0xd1d3('0x96')](_0x368e95);}var _0x10145e=_0x368e95[_0xd1d3('0x97')]||undefined;return _0x12b983['ifTime'](_0x10145e)[_0xd1d3('0x1a')](function(_0x43aac7){if(!_0x43aac7){throw new APIOutOfIntervalError();}return _0x368e95;});}exports['notify']=function(_0x4017bd,_0x52f926){var _0x200429={'body':_0x4017bd[_0xd1d3('0x68')],'channel':_0xd1d3('0x98')};var _0x54d003=[];var _0x520b90=[];var _0x761929={};var _0x3e2e67=![];if(_0x4017bd[_0xd1d3('0x68')]['id']){delete _0x4017bd[_0xd1d3('0x68')]['id'];}if(_[_0xd1d3('0x92')](_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x99')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xd1d3('0x92')](_0x4017bd['body']['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xd1d3('0x9a')](_0x4017bd['body']['body'])){throw new APIBadRequestError(_0xd1d3('0x9b'));}var _0xc20d2e=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x39')]&&_0x4017bd[_0xd1d3('0x68')]['referer'];return db['CmContact'][_0xd1d3('0x73')]()[_0xd1d3('0x1a')](function(_0x3ff871){if(!_0x3ff871){throw new Error(_0xd1d3('0x9c'));}_0x54d003=Object[_0xd1d3('0x62')](_0x3ff871)[_0xd1d3('0x5a')](function(_0x47d46e){return![_0xd1d3('0x9d'),'updatedAt'][_0xd1d3('0x9e')](_0x47d46e);});_0x520b90=Object[_0xd1d3('0x62')](_0x3ff871)['filter'](function(_0x3ba105){return![_0xd1d3('0x9d'),_0xd1d3('0x9f'),_0xd1d3('0xa0'),_0xd1d3('0xa1')][_0xd1d3('0x9e')](_0x3ba105);});if(!_[_0xd1d3('0x9e')](_0x520b90,_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xa2')])){throw new APIBadRequestError(_0xd1d3('0xa3')+_0x520b90[_0xd1d3('0x87')](',\x20'));}_0x761929[_0x4017bd['body'][_0xd1d3('0xa2')]]=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x99')];})[_0xd1d3('0x1a')](function(){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x4017bd['params']['id']},'include':[{'model':db[_0xd1d3('0xa4')],'as':_0xd1d3('0xa5'),'include':[{'model':db[_0xd1d3('0xa6')],'as':_0xd1d3('0xa7'),'where':_0x761929,'limit':0x1,'order':[['updatedAt',_0xd1d3('0xa8')]]}]},{'model':db[_0xd1d3('0xa9')],'as':_0xd1d3('0xaa')},{'model':db['Interval'],'as':_0xd1d3('0xab'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})[_0xd1d3('0x1a')](function(_0x455f51){if(!_0x455f51){throw new APINotFoundError(util[_0xd1d3('0x42')](_0xd1d3('0xac'),_0x4017bd[_0xd1d3('0x72')]['id']));}if(_0xc20d2e){return checkWebsiteInterval(_0x455f51);}return _0x455f51;})[_0xd1d3('0x1a')](function(_0x3f1c6a){_0x200429[_0xd1d3('0xad')]=_0x3f1c6a;_0x200429[_0xd1d3('0xae')]=_[_0xd1d3('0xaf')](_0x3f1c6a[_0xd1d3('0xaa')],[_0xd1d3('0xb0')],[_0xd1d3('0xb1')]);if(_0x200429[_0xd1d3('0xad')][_0xd1d3('0xaa')]){delete _0x200429['account'][_0xd1d3('0xaa')];}_0x200429[_0xd1d3('0xb2')]=_0x3f1c6a['List']||{'id':_0x3f1c6a[_0xd1d3('0xa1')]};if(_0x200429[_0xd1d3('0xb2')]&&_0x200429[_0xd1d3('0xb2')][_0xd1d3('0xa7')][_0xd1d3('0x52')]){return _0x200429[_0xd1d3('0xb2')]['Contacts'][0x0];}var _0x375e91=_[_0xd1d3('0x12')](_0x4017bd['body'],{'firstName':_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x99')],'ListId':_0x3f1c6a['ListId']});_0x375e91[_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xa2')]]=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x99')];return db['CmContact'][_0xd1d3('0x67')](_0x375e91,{'fields':_0x54d003,'raw':!![]});})[_0xd1d3('0x1a')](function(_0x1c428a){_0x200429[_0xd1d3('0xb3')]=_0x1c428a;var _0x24c557=createInteractionObject(_0x4017bd['params']['id'],_0x4017bd[_0xd1d3('0x68')],_0x4017bd['headers'],_0x1c428a);var _0x24489a={'ChatWebsiteId':_0x4017bd['params']['id']};if(_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb4')]){_0x24489a[_0xd1d3('0xb4')]=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb4')];_0x24489a[_0xd1d3('0xb5')]=![];return db['ChatInteraction'][_0xd1d3('0x66')]({'where':_0x24489a})[_0xd1d3('0x1a')](function(_0x2528ab){var _0x170da8=_0x4017bd['body'][_0xd1d3('0x39')]&&_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb6')];if(_0x2528ab){_0x3e2e67=!![];return _0x2528ab;}else if(!_0x170da8&&_0x2528ab&&_0x2528ab[_0xd1d3('0xb5')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x24c557[_0xd1d3('0xb4')]=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb4')];_0x24c557['externalUrl']=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb7')];return db[_0xd1d3('0xb8')][_0xd1d3('0x67')](_0x24c557);});}_0x24489a[_0xd1d3('0xb9')]=_0x1c428a['id'];if(_0x4017bd['body'][_0xd1d3('0xba')]&&_0x4017bd['body'][_0xd1d3('0xba')]['id']){_0x24489a['id']=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xba')]['id'];return db[_0xd1d3('0xb8')][_0xd1d3('0x66')]({'where':_0x24489a})[_0xd1d3('0x1a')](function(_0x1f89f0){var _0x442ac1=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0x39')]&&_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb6')];if(!_0x442ac1&&_0x1f89f0&&_0x1f89f0['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x1f89f0){_0x3e2e67=!![];return _0x1f89f0;}else{return db[_0xd1d3('0xb8')][_0xd1d3('0x67')](_0x24c557);}});}return db[_0xd1d3('0xb8')]['create'](_0x24c557);})[_0xd1d3('0x1a')](function(_0x8c5810){if(!_0x3e2e67){return _0x8c5810;}var _0xc2e30e={'from':(_0x200429['contact'][_0xd1d3('0x3d')]||'')+'\x20'+(_0x200429[_0xd1d3('0xb3')][_0xd1d3('0x3e')]||'')};if(_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb4')]&&_0x4017bd['body'][_0xd1d3('0xbb')]&&_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xb4')]!=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xbb')]){_0xc2e30e[_0xd1d3('0xb4')]=_0x4017bd[_0xd1d3('0x68')][_0xd1d3('0xbb')];}return _0x8c5810[_0xd1d3('0x2f')](_0xc2e30e);})[_0xd1d3('0x1a')](function(_0x1b0bc6){_0x200429[_0xd1d3('0xba')]=_0x1b0bc6['get']({'plain':!![]});_0x200429[_0xd1d3('0xba')][_0xd1d3('0xbc')]=!_0x3e2e67;if(_0x200429[_0xd1d3('0xba')][_0xd1d3('0xbc')]){if(_0x200429['account'][_0xd1d3('0xbd')]){_0x200429['applications'][_0xd1d3('0xbe')]({'id':0x0,'priority':_0x200429['applications'][_0xd1d3('0x52')]+0x1,'app':_0xd1d3('0xbf'),'appdata':_0xd1d3('0xc0'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x4017bd[_0xd1d3('0x68')]['body'],'ChatWebsiteId':_0x4017bd[_0xd1d3('0x72')]['id'],'ChatInteractionId':_0x1b0bc6['id'],'direction':'in','ContactId':_0x200429[_0xd1d3('0xb3')]['id'],'AttachmentId':_0x4017bd['body'][_0xd1d3('0xc1')]});})['then'](function(_0x4ca6d9){_0x200429[_0xd1d3('0x22')]=_0x4ca6d9;if(!_0x200429['interaction'][_0xd1d3('0xc2')]){return;}return db[_0xd1d3('0xc3')]['find']({'attributes':['id',_0xd1d3('0x34')],'where':{'id':_0x200429[_0xd1d3('0xba')][_0xd1d3('0xc2')]}});})[_0xd1d3('0x1a')](function(_0x253e76){if(_0x253e76){_0x200429[_0xd1d3('0xae')][_0xd1d3('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x253e76[_0xd1d3('0x34')]+','+(_0x200429[_0xd1d3('0xad')][_0xd1d3('0xc5')]||0xa),'interval':'*,*,*,*'});_0x200429[_0xd1d3('0xc6')]=!![];}if(!_0x200429['interaction'][_0xd1d3('0xc7')]){return;}return db['ChatQueue']['find']({'attributes':['id',_0xd1d3('0x34')],'where':{'id':_0x200429['interaction']['queueId']}});})['then'](function(_0x1b350b){if(_0x1b350b){_0x200429[_0xd1d3('0xae')][_0xd1d3('0xc4')]({'id':0x0,'priority':0x1,'app':_0xd1d3('0xc8'),'appdata':_0x1b350b[_0xd1d3('0x34')]+','+(_0x200429[_0xd1d3('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd1d3('0xc9')});}return respondWithRpcPromise(_0xd1d3('0xca'),_0xd1d3('0xcb'),_0x200429);})[_0xd1d3('0x1a')](function(_0x1cb9a0){respondWithRpcPromise(_0xd1d3('0xcc'),'EventManager',{'event':_0xd1d3('0xcd'),'message':_0x1cb9a0},client9002);return _0x1cb9a0;})[_0xd1d3('0x1a')](respondWithResult(_0x52f926,null))[_0xd1d3('0x24')](APIHandleError(_0x52f926));};exports[_0xd1d3('0xce')]=function(_0xcd1e7e,_0x419a51){var _0x53945a,_0x4f779b,_0x47ffe0;var _0x3da2d1=[];var _0x3ea91f={};var _0x4e8caf=_0xcd1e7e[_0xd1d3('0xcf')]||[];var _0x188d31=[];var _0x311614;return db[_0xd1d3('0xa6')]['describe']()[_0xd1d3('0x1a')](function(_0x13edb9){if(!_0x13edb9){throw new db['Sequelize'][(_0xd1d3('0xd0'))]('no\x20available\x20attributes');}_0x3da2d1=_[_0xd1d3('0xd1')](_[_0xd1d3('0x62')](_0x13edb9),['createdAt',_0xd1d3('0x9f'),'CompanyId','ListId']);if(_0xcd1e7e[_0xd1d3('0x68')]['id']){delete _0xcd1e7e['body']['id'];}if(_[_0xd1d3('0x92')](_0xcd1e7e['body'][_0xd1d3('0x99')])){throw _0x419a51[_0xd1d3('0x26')](0x1f4)[_0xd1d3('0x35')](new db['Sequelize'][(_0xd1d3('0xd0'))](_0xd1d3('0xd2')));}if(_[_0xd1d3('0x92')](_0xcd1e7e['body'][_0xd1d3('0x68')])||_0xcd1e7e[_0xd1d3('0x68')][_0xd1d3('0x68')]===''){throw _0x419a51['status'](0x1f4)[_0xd1d3('0x35')](new db['Sequelize'][(_0xd1d3('0xd0'))](_0xd1d3('0xd3')));}if(_[_0xd1d3('0x92')](_0xcd1e7e[_0xd1d3('0x68')][_0xd1d3('0xd4')])){throw _0x419a51[_0xd1d3('0x26')](0x1f4)['send'](new db[(_0xd1d3('0xd5'))][(_0xd1d3('0xd0'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da2d1));}if(!_[_0xd1d3('0x9e')](_0x3da2d1,_0xcd1e7e[_0xd1d3('0x68')][_0xd1d3('0xd4')])){throw _0x419a51[_0xd1d3('0x26')](0x1f4)[_0xd1d3('0x35')](new db[(_0xd1d3('0xd5'))][(_0xd1d3('0xd0'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da2d1));}_0x3ea91f[_0xcd1e7e['body'][_0xd1d3('0xd4')]]=_0xcd1e7e['body'][_0xd1d3('0x99')];})[_0xd1d3('0x1a')](function(){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0xcd1e7e[_0xd1d3('0x72')]['id']},'include':[{'model':db[_0xd1d3('0xa4')],'as':_0xd1d3('0xa5')},{'model':db[_0xd1d3('0xd6')],'as':_0xd1d3('0xd6')}]});})[_0xd1d3('0x1a')](handleEntityNotFound(_0x419a51,null))['then'](function(_0x342bd8){if(_0x342bd8&&_0x342bd8[_0xd1d3('0xa5')]){_0x4f779b=_0x342bd8;var _0x48467a=_[_0xd1d3('0x12')](_0xcd1e7e['body'],{'firstName':_0xcd1e7e['body'][_0xd1d3('0x99')],'phone':_0xcd1e7e[_0xd1d3('0x68')]['from'],'ListId':_0x342bd8[_0xd1d3('0xa1')]});_0x48467a[_0xcd1e7e[_0xd1d3('0x68')]['mapKeyOffline']]=_0xcd1e7e['body'][_0xd1d3('0x99')];return db['CmContact'][_0xd1d3('0xd7')]({'where':_0x3ea91f,'defaults':_0x48467a});}})[_0xd1d3('0xd8')](function(_0x358d28){if(_0x358d28){_0x47ffe0=_0x358d28;var _0x4f6a01=fs[_0xd1d3('0xd9')](path[_0xd1d3('0x87')](config['root'],_0xd1d3('0xda')),_0xd1d3('0xdb'));var _0x1e7c6c=ejs[_0xd1d3('0xdc')](_0x4f6a01,{'body':_['toPairs'](_0xcd1e7e[_0xd1d3('0x68')][_0xd1d3('0x68')]),'bodyTitle':_0x4f779b[_0xd1d3('0xdd')]});return db['ChatOfflineMessage']['create']({'body':_0x1e7c6c,'plainBody':htmlToText[_0xd1d3('0xde')](_0x1e7c6c),'ContactId':_0x358d28['id'],'ChatWebsiteId':_0x4f779b['id']});}})[_0xd1d3('0x1a')](function(_0x16127f){_0x311614=_0x16127f;if(_0x4e8caf[_0xd1d3('0x52')]){var _0x265bbb=_0x4e8caf['map'](function(_0x306bd8){return{'name':_0x306bd8['originalname'],'basename':_0x306bd8[_0xd1d3('0x82')],'type':_0x306bd8['mimetype'],'ChatOfflineMessageId':_0x16127f['id']};});_0x188d31=_0x265bbb[_0xd1d3('0x4b')](_0x2f2333=>{var _0x5b23f7={'filename':_0x2f2333['name'],'path':path['join'](config[_0xd1d3('0x88')],_0xd1d3('0xdf'),'files',_0xd1d3('0xe0'),_0xd1d3('0xe1'),_0x2f2333[_0xd1d3('0xe2')])};return _0x5b23f7;});if(!_0x4f779b['openNewInteraction']){return db[_0xd1d3('0xe3')][_0xd1d3('0xe4')](function(_0x1ece1b){return db[_0xd1d3('0xe5')]['bulkCreate'](_0x265bbb,{'transaction':_0x1ece1b});});}}})[_0xd1d3('0x1a')](function(){if(_0x311614){_0x53945a=_0x311614;return db['MailAccount'][_0xd1d3('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0xd1d3('0xe6')],'as':_0xd1d3('0xe7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd1d3('0xe8'),'raw':!![]}]}]});}})[_0xd1d3('0x1a')](function(_0x2ec270){if(_0x2ec270&&_0x2ec270['Smtp']&&_0x4f779b[_0xd1d3('0xe9')]&&_0x4f779b[_0xd1d3('0xea')]){var _0x28ba8a=_0x2ec270[_0xd1d3('0xeb')]();return respondWithRpcPromise(_0xd1d3('0xec'),_0xd1d3('0xed'),{'account':_0x28ba8a,'message':{'from':util[_0xd1d3('0x42')]('\x22%s\x22\x20<%s>',_0x2ec270[_0xd1d3('0x34')],_0x2ec270[_0xd1d3('0xee')]||_0x2ec270[_0xd1d3('0xe7')][_0xd1d3('0x6e')]),'to':_0x4f779b[_0xd1d3('0xea')],'subject':_0x4f779b[_0xd1d3('0xef')],'html':_0x53945a[_0xd1d3('0x68')],'attachments':_0x188d31}},client9003)[_0xd1d3('0x1a')](function(){return _0x53945a;})[_0xd1d3('0x24')](function(_0x45e04d){logger[_0xd1d3('0x21')](_0x45e04d);});}})[_0xd1d3('0x1a')](function(){if(_0x4f779b&&_0x4f779b[_0xd1d3('0xf0')]&&_0x4f779b[_0xd1d3('0xf1')]){var _0x1fca97=[];if(_0x4e8caf[_0xd1d3('0x52')]){_0x1fca97=_0x4e8caf[_0xd1d3('0x4b')](function(_0x235afc){return{'name':_0x235afc[_0xd1d3('0xf2')],'basename':_0x235afc[_0xd1d3('0x82')],'type':_0x235afc['mimetype'],'ChatOfflineMessageId':_0x311614['id']};});}var _0xc4b16a;if(!_['isNil'](_0x4f779b[_0xd1d3('0xf3')])){var _0x85520a=_['map'](_0xcd1e7e[_0xd1d3('0x68')],function(_0x551587){return _0x551587;});var _0x1485e9=_[_0xd1d3('0xf4')](_0x85520a)[0x0];var _0x580cf1=_['mapValues'](_0x1485e9,function(_0x1ea71b){return _0x1ea71b;});_0xc4b16a=_0x580cf1[0x1][_0x4f779b['subjectOffline']];}var _0x311625={'from':_0x47ffe0[_0xd1d3('0xee')],'firstName':_0x47ffe0[_0xd1d3('0x3d')],'lastName':_0x47ffe0[_0xd1d3('0x3e')],'mapKey':_0xd1d3('0xee'),'message':{'from':_0x47ffe0[_0xd1d3('0xee')],'to':_0x4f779b[_0xd1d3('0xd6')][_0xd1d3('0xee')],'cc':'','subject':_[_0xd1d3('0x92')](_0xc4b16a)?_0x4f779b['offlineMessageSubject']:_0xc4b16a,'messageId':'','sentAt':new Date(),'attach':_0x1fca97['length'],'attachments':_0x1fca97,'originChannel':_0xd1d3('0xf5'),'ChatWebsiteId':_0x4f779b['id'],'ChatOfflineMessageId':_0x53945a['id'],'originTo':_0x4f779b[_0xd1d3('0xd6')]['email']},'body':_0x53945a[_0xd1d3('0x68')]};var _0x2923e3={'account':{'id':_0x4f779b[_0xd1d3('0xf1')]},'body':_0x311625,'log':_0xd1d3('0xf6')};return respondWithRpcPromise(_0xd1d3('0xf6'),_0xd1d3('0xf7'),_0x2923e3,client9001)[_0xd1d3('0x1a')](function(){return _0x53945a;})[_0xd1d3('0x24')](function(_0x2eeaef){logger[_0xd1d3('0x21')](_0x2eeaef);});}return;})[_0xd1d3('0x1a')](function(){if(_0x53945a){return _0x53945a;}})[_0xd1d3('0x1a')](respondWithResult(_0x419a51,null))[_0xd1d3('0x24')](function(){for(var _0x51e9d3 of _0x4e8caf){var _0x166dec=path['join'](config[_0xd1d3('0x88')],_0xd1d3('0xdf'),_0xd1d3('0xcf'),_0xd1d3('0xe0'),_0xd1d3('0xe1'),_0x51e9d3['filename']);fs_extra[_0xd1d3('0xf8')](_0x166dec)['catch'](function(_0x51cf10){logger[_0xd1d3('0x21')]('Could\x20not\x20remove\x20attachment\x20file',_0x166dec,_0x51cf10);});}});};exports[_0xd1d3('0xf9')]=function(_0x1bf7f6,_0x5ea151){return db[_0xd1d3('0xb8')][_0xd1d3('0x66')]({'where':{'id':_0x1bf7f6[_0xd1d3('0x72')]['id']}})['then'](handleEntityNotFound(_0x5ea151,null))[_0xd1d3('0x1a')](function(_0x3950da){if(_0x3950da){return _0x3950da[_0xd1d3('0xf9')](_0x1bf7f6[_0xd1d3('0x68')][_0xd1d3('0x7e')],_[_0xd1d3('0xfa')](_0x1bf7f6[_0xd1d3('0x68')],['ids','id'])||{});}})[_0xd1d3('0x1a')](respondWithResult(_0x5ea151,null))[_0xd1d3('0x24')](handleError(_0x5ea151,null));};exports['getInteractions']=function(_0x40c0ce,_0x2cb09b){var _0x515097={'raw':![],'where':{}};var _0x371b41={};var _0x5aab4a={'count':0x0,'rows':[]};return db[_0xd1d3('0x4c')][_0xd1d3('0x76')]({'where':{'id':_0x40c0ce['params']['id']}})['then'](handleEntityNotFound(_0x2cb09b,null))['then'](function(_0x3c9d64){if(_0x3c9d64){_0x371b41[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db[_0xd1d3('0xb8')]['rawAttributes']);_0x371b41['query']=_[_0xd1d3('0x62')](_0x40c0ce[_0xd1d3('0x50')]);_0x371b41[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0x371b41[_0xd1d3('0x46')],_0x371b41[_0xd1d3('0x50')]);_0x515097[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x371b41['model'],qs[_0xd1d3('0x63')](_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x63')]));_0x515097[_0xd1d3('0x51')]=_0x515097[_0xd1d3('0x51')][_0xd1d3('0x52')]?_0x515097[_0xd1d3('0x51')]:_0x371b41[_0xd1d3('0x46')];if(!_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x53')]('nolimit')){_0x515097['limit']=qs[_0xd1d3('0x2b')](_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x2b')]);_0x515097[_0xd1d3('0x29')]=qs[_0xd1d3('0x29')](_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x29')]);}_0x515097[_0xd1d3('0x55')]=qs[_0xd1d3('0x56')](_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x56')]);_0x515097[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_[_0xd1d3('0x59')](_0x40c0ce['query'],_0x371b41[_0xd1d3('0x58')]));_0x515097[_0xd1d3('0x57')][_0xd1d3('0x79')]=_0x3c9d64['id'];if(_0x40c0ce[_0xd1d3('0x50')]['filter']){_0x515097['where']=_[_0xd1d3('0x5b')](_0x515097[_0xd1d3('0x57')],{'$or':_['map'](_0x515097[_0xd1d3('0x51')],function(_0x564aa8){var _0x29eb84={};_0x29eb84[_0x564aa8]={'$like':'%'+_0x40c0ce[_0xd1d3('0x50')]['filter']+'%'};return _0x29eb84;})});}_0x515097=_[_0xd1d3('0x5b')]({},_0x515097,_0x40c0ce[_0xd1d3('0x65')]);return db[_0xd1d3('0xb8')][_0xd1d3('0x2c')]({'where':_0x515097['where']})['then'](function(_0x5bb647){_0x5aab4a[_0xd1d3('0x2c')]=_0x5bb647;if(_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x5d')]){_0x515097['include']=[{'model':db[_0xd1d3('0xa6')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xd1d3('0xfb'),'attributes':[_0xd1d3('0x34'),_0xd1d3('0xfc'),_0xd1d3('0xfd')],'required':![]},{'model':db[_0xd1d3('0xfe')],'as':_0xd1d3('0xff'),'attributes':['id',_0xd1d3('0x34'),'color'],'where':_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x100')]?{'id':_0x40c0ce[_0xd1d3('0x50')][_0xd1d3('0x100')]}:undefined,'required':_0x40c0ce[_0xd1d3('0x50')]['tag']?!![]:![]}];}return db[_0xd1d3('0xb8')][_0xd1d3('0x5e')](_0x515097);})['then'](function(_0x4f5ca7){_0x5aab4a[_0xd1d3('0x5f')]=_0x4f5ca7;return _0x5aab4a;});}})[_0xd1d3('0x1a')](respondWithFilteredResult(_0x2cb09b,_0x515097))['catch'](handleError(_0x2cb09b,null));};exports[_0xd1d3('0x101')]=function(_0x27ac99,_0x474904){var _0x545e70=0x0;var _0x30a03e=0x0;var _0xce0ab4=![];var _0x4e2861;var _0x2df672;return db['ChatWebsite'][_0xd1d3('0x66')]({'where':{'id':_0x27ac99[_0xd1d3('0x72')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xd1d3('0xab')],'as':_0xd1d3('0x102'),'attributes':['id',_0xd1d3('0x103')]}]}]})[_0xd1d3('0x1a')](handleEntityNotFound(_0x474904,null))[_0xd1d3('0x1a')](function(_0x3e6bf6){if(_0x3e6bf6){_0x4e2861=_0x3e6bf6;return _0x3e6bf6[_0xd1d3('0x104')]({'raw':!![]});}})[_0xd1d3('0x1a')](function(_0x719893){if(_0x4e2861){if(_0x719893){_0x2df672=_0x719893;}}return require(_0xd1d3('0x89'))[_0xd1d3('0x8a')]();})[_0xd1d3('0x1a')](function(_0x370e5d){if(_0x370e5d){_0x30a03e=_0x370e5d[_0xd1d3('0x105')];_0xce0ab4=_0x370e5d['custom'];}})['then'](function(){return db[_0xd1d3('0xb8')][_0xd1d3('0x2c')]({'where':{'closed':![]}});})[_0xd1d3('0x1a')](function(_0x24e2fb){_0x545e70=_0x24e2fb;if(_0x30a03e&&_0x24e2fb>_0x30a03e){return db[_0xd1d3('0x106')][_0xd1d3('0x76')]({'where':{'id':0x1}})[_0xd1d3('0x1a')](function(_0x5e0cb6){if(_0x5e0cb6){_0x5e0cb6[_0xd1d3('0x107')](_0xd1d3('0x108'));}});}})[_0xd1d3('0x1a')](function(){var _0x171e2d=_0x4e2861[_0xd1d3('0xab')];var _0x56032f=_0x4e2861[_0xd1d3('0x97')]||undefined;return _0x171e2d?_0x171e2d[_0xd1d3('0x109')](_0x56032f):!![];})[_0xd1d3('0x1a')](function(_0x59cc22){var _0x2295e8=fs['readFileSync'](path[_0xd1d3('0x87')](config[_0xd1d3('0x88')],'server/files/chat/iframe.ejs'),_0xd1d3('0xdb'));var _0x43b9cc=_0xd1d3('0x10a');var _0x552f3e=![];var _0x124c2e,_0x2ac560;if(_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0xb6')]){_0x124c2e=new URL(_0x27ac99[_0xd1d3('0x10b')]['referer'])[_0xd1d3('0x10c')];}else if(_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0x10c')]){_0x124c2e=new URL(_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0x10c')])[_0xd1d3('0x10c')];}else{_0x124c2e=_0xd1d3('0x10d');}_0x2ac560=typeof _0x4e2861['address'][_0xd1d3('0x6a')](',')['find'](function(_0x4ee754){return wildcardUtils[_0xd1d3('0x10e')](_0x4ee754,_0x124c2e);})!=='undefined';var _0x22c3d2={'chatVersion':_0x43b9cc,'chatWebsiteAddressOrigin':_0x2ac560?_0x27ac99['headers'][_0xd1d3('0xb6')]:_0x4e2861[_0xd1d3('0x69')],'remote':_0x4e2861[_0xd1d3('0x10f')],'query':querystring['stringify'](_['merge'](_0x4e2861['get']({'plain':!![]}),{'customerIp':_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0x3b')]||_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0x110')]||_0x27ac99[_0xd1d3('0x111')]['remoteAddress']||_0x27ac99['ip'],'referer':_0x27ac99[_0xd1d3('0x10b')]['referer'],'openedInteractions':_0x545e70,'maxInteractions':_0x30a03e,'virtual':_0xce0ab4[_0xd1d3('0x105')],'online':_0x59cc22,'custom':_0xce0ab4,'address':_0x2ac560?_0x27ac99[_0xd1d3('0x10b')][_0xd1d3('0xb6')]:null}))[_0xd1d3('0x112')](/'/g,'\x5c\x27')};_0x474904[_0xd1d3('0x35')](ejs[_0xd1d3('0xdc')](Mustache[_0xd1d3('0xdc')](_0x2295e8,_0x22c3d2),{'proactiveActions':_0x2df672,'alignment':_0x4e2861['alignment'],'verticalAlignment':_0x4e2861[_0xd1d3('0x113')],'div_color':_0x4e2861['color'],'labelText':_0x4e2861[_0xd1d3('0x114')],'text_color':_0x4e2861[_0xd1d3('0x115')],'text_button_color':_0x4e2861[_0xd1d3('0x116')],'button_color':_0x4e2861[_0xd1d3('0x117')],'background_color':_0x4e2861['backgroundColor'],'hideWhenOffline':_0x4e2861[_0xd1d3('0x118')],'intervalId':_0x4e2861[_0xd1d3('0x119')],'isDevelopment':_0x552f3e,'chatVersion':_0x43b9cc}));})[_0xd1d3('0x24')](handleError(_0x474904,null));};exports[_0xd1d3('0x11a')]=function(_0x218b5a,_0x22ab3e){var _0x49085d=_0x218b5a[_0xd1d3('0x72')]['id'];var _0x4e30e3=_0x218b5a['body'];var _0x256a82=0xc8;var _0x2c9f0c=null;return db['sequelize'][_0xd1d3('0xe4')]({'isolationLevel':db[_0xd1d3('0xe3')]['Transaction']['ISOLATION_LEVELS'][_0xd1d3('0x11b')]},function(_0x3e25ac){return db[_0xd1d3('0x4c')][_0xd1d3('0x76')]({'where':{'id':_0x49085d},'transaction':_0x3e25ac})['then'](function(_0x40983a){if(_0x40983a){return db[_0xd1d3('0xa9')][_0xd1d3('0x30')]({'where':{'ChatWebsiteId':_0x49085d},'transaction':_0x3e25ac})[_0xd1d3('0x1a')](function(){var _0x3fbd9b=_['map'](_0x4e30e3,function(_0x3c5dd5){_0x3c5dd5[_0xd1d3('0x79')]=_0x49085d;return _0x3c5dd5;});return db[_0xd1d3('0xa9')][_0xd1d3('0x11c')](_0x3fbd9b,{'transaction':_0x3e25ac});});}else{_0x256a82=0x194;_0x2c9f0c=[];}});})[_0xd1d3('0x1a')](function(){if(_0x256a82!==0x194){return db[_0xd1d3('0xa9')][_0xd1d3('0x11d')]({'where':{'ChatWebsiteId':_0x49085d},'order':_0xd1d3('0xb0')})[_0xd1d3('0x1a')](function(_0x1cae8a){_0x2c9f0c=_0x1cae8a;});}})['catch'](function(_0x554054){_0x256a82=0x1f4;logger[_0xd1d3('0x21')](_0x554054[_0xd1d3('0x11e')]);if(_0x554054[_0xd1d3('0x34')]){delete _0x554054['name'];}_0x2c9f0c=_0x554054;})['finally'](function(){if(_0x2c9f0c===null){_0x22ab3e[_0xd1d3('0x25')](_0x256a82);}else{if(_0x256a82===0x1f4){_0x22ab3e['status'](_0x256a82)['send'](_0x2c9f0c);}else{_0x22ab3e[_0xd1d3('0x26')](_0x256a82)['json'](_0x2c9f0c);}}});};exports[_0xd1d3('0x11f')]=function(_0x1ec35c,_0x4b7145){var _0x1a6dec={};var _0x168f36={};var _0x40b7b4;var _0x56a8ce;return db[_0xd1d3('0x4c')][_0xd1d3('0x76')]({'where':{'id':_0x1ec35c[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x4b7145,null))[_0xd1d3('0x1a')](function(_0x13d184){if(_0x13d184){_0x40b7b4=_0x13d184;_0x168f36[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db['ChatApplication']['rawAttributes']);_0x168f36['query']=_['keys'](_0x1ec35c['query']);_0x168f36[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0x168f36[_0xd1d3('0x46')],_0x168f36[_0xd1d3('0x50')]);_0x1a6dec[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x168f36['model'],qs[_0xd1d3('0x63')](_0x1ec35c[_0xd1d3('0x50')][_0xd1d3('0x63')]));_0x1a6dec['attributes']=_0x1a6dec[_0xd1d3('0x51')][_0xd1d3('0x52')]?_0x1a6dec[_0xd1d3('0x51')]:_0x168f36[_0xd1d3('0x46')];_0x1a6dec[_0xd1d3('0x55')]=qs['sort'](_0x1ec35c['query'][_0xd1d3('0x56')]);_0x1a6dec[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_[_0xd1d3('0x59')](_0x1ec35c[_0xd1d3('0x50')],_0x168f36[_0xd1d3('0x58')]));if(_0x1ec35c[_0xd1d3('0x50')][_0xd1d3('0x5a')]){_0x1a6dec[_0xd1d3('0x57')]=_[_0xd1d3('0x5b')](_0x1a6dec[_0xd1d3('0x57')],{'$or':_[_0xd1d3('0x4b')](_0x1a6dec[_0xd1d3('0x51')],function(_0x20a3e5){var _0x1973bd={};_0x1973bd[_0x20a3e5]={'$like':'%'+_0x1ec35c[_0xd1d3('0x50')]['filter']+'%'};return _0x1973bd;})});}_0x1a6dec=_[_0xd1d3('0x5b')]({},_0x1a6dec,_0x1ec35c['options']);return _0x40b7b4['getApplications'](_0x1a6dec);}})[_0xd1d3('0x1a')](function(_0x59d0a4){if(_0x59d0a4){_0x56a8ce=_0x59d0a4[_0xd1d3('0x52')];if(!_0x1ec35c[_0xd1d3('0x50')]['hasOwnProperty'](_0xd1d3('0x54'))){_0x1a6dec['limit']=qs[_0xd1d3('0x2b')](_0x1ec35c[_0xd1d3('0x50')]['limit']);_0x1a6dec[_0xd1d3('0x29')]=qs['offset'](_0x1ec35c[_0xd1d3('0x50')][_0xd1d3('0x29')]);}return _0x40b7b4[_0xd1d3('0x11f')](_0x1a6dec);}})[_0xd1d3('0x1a')](function(_0x301115){if(_0x301115){return _0x301115?{'count':_0x56a8ce,'rows':_0x301115}:null;}})[_0xd1d3('0x1a')](respondWithResult(_0x4b7145,null))[_0xd1d3('0x24')](handleError(_0x4b7145,null));};exports[_0xd1d3('0x120')]=function(_0x28107a,_0x59d53f){return db[_0xd1d3('0x121')]['find']({'where':{'id':_0x28107a[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x59d53f,null))[_0xd1d3('0x1a')](function(_0x246eb5){if(_0x246eb5){return _0x246eb5[_0xd1d3('0x120')](_0x28107a['body'][_0xd1d3('0x7e')],_[_0xd1d3('0xfa')](_0x28107a[_0xd1d3('0x68')],[_0xd1d3('0x7e'),'id'])||{});}})['then'](respondWithResult(_0x59d53f,null))[_0xd1d3('0x24')](handleError(_0x59d53f,null));};exports[_0xd1d3('0x104')]=function(_0x5ad3d5,_0x1ae557){var _0x38a33b={};var _0x4c0497={};var _0x30fbd1;var _0x5138dd;return db['ChatWebsite'][_0xd1d3('0x76')]({'where':{'id':_0x5ad3d5[_0xd1d3('0x72')]['id']}})['then'](handleEntityNotFound(_0x1ae557,null))[_0xd1d3('0x1a')](function(_0x206793){if(_0x206793){_0x30fbd1=_0x206793;_0x4c0497[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db[_0xd1d3('0x122')][_0xd1d3('0x78')]);_0x4c0497[_0xd1d3('0x50')]=_[_0xd1d3('0x62')](_0x5ad3d5[_0xd1d3('0x50')]);_0x4c0497[_0xd1d3('0x58')]=_[_0xd1d3('0x4f')](_0x4c0497[_0xd1d3('0x46')],_0x4c0497[_0xd1d3('0x50')]);_0x38a33b[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x4c0497[_0xd1d3('0x46')],qs[_0xd1d3('0x63')](_0x5ad3d5['query'][_0xd1d3('0x63')]));_0x38a33b[_0xd1d3('0x51')]=_0x38a33b[_0xd1d3('0x51')][_0xd1d3('0x52')]?_0x38a33b['attributes']:_0x4c0497['model'];_0x38a33b[_0xd1d3('0x55')]=qs['sort'](_0x5ad3d5[_0xd1d3('0x50')]['sort']);_0x38a33b[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_['pick'](_0x5ad3d5[_0xd1d3('0x50')],_0x4c0497[_0xd1d3('0x58')]));if(_0x5ad3d5[_0xd1d3('0x50')][_0xd1d3('0x5a')]){_0x38a33b[_0xd1d3('0x57')]=_[_0xd1d3('0x5b')](_0x38a33b[_0xd1d3('0x57')],{'$or':_[_0xd1d3('0x4b')](_0x38a33b[_0xd1d3('0x51')],function(_0x3a0fcc){var _0x123f7e={};_0x123f7e[_0x3a0fcc]={'$like':'%'+_0x5ad3d5['query'][_0xd1d3('0x5a')]+'%'};return _0x123f7e;})});}_0x38a33b=_['merge']({},_0x38a33b,_0x5ad3d5[_0xd1d3('0x65')]);return _0x30fbd1[_0xd1d3('0x104')](_0x38a33b);}})[_0xd1d3('0x1a')](function(_0x29f0e6){if(_0x29f0e6){_0x5138dd=_0x29f0e6[_0xd1d3('0x52')];if(!_0x5ad3d5[_0xd1d3('0x50')][_0xd1d3('0x53')](_0xd1d3('0x54'))){_0x38a33b[_0xd1d3('0x2b')]=qs[_0xd1d3('0x2b')](_0x5ad3d5[_0xd1d3('0x50')][_0xd1d3('0x2b')]);_0x38a33b['offset']=qs['offset'](_0x5ad3d5[_0xd1d3('0x50')][_0xd1d3('0x29')]);}return _0x30fbd1[_0xd1d3('0x104')](_0x38a33b);}})[_0xd1d3('0x1a')](function(_0x151eb7){if(_0x151eb7){return _0x151eb7?{'count':_0x5138dd,'rows':_0x151eb7}:null;}})['then'](respondWithResult(_0x1ae557,null))[_0xd1d3('0x24')](handleError(_0x1ae557,null));};exports[_0xd1d3('0x123')]=function(_0x15d323,_0x4fe8c8){var _0x3e8a1e=_0x15d323['query'][_0xd1d3('0x124')]==='false'?_0xd1d3('0x125'):_0xd1d3('0x126');return db[_0xd1d3('0x4c')]['find']({'attributes':['id',_0x3e8a1e],'where':{'id':_0x15d323[_0xd1d3('0x72')]['id']}})['then'](handleEntityNotFound(_0x4fe8c8,null))[_0xd1d3('0x1a')](function(_0x35484a){if(_0x35484a){var _0x3309b0=_0x35484a[_0x3e8a1e];var _0x2ea32c=_0x3309b0&&_0x3309b0[_0xd1d3('0x127')]?_0x3309b0['items']:[];_0x4fe8c8[_0xd1d3('0x35')]({'fromKey':_[_0xd1d3('0x92')](_0x3309b0[_0xd1d3('0x128')])?undefined:_0x3309b0[_0xd1d3('0x128')],'count':_0x2ea32c[_0xd1d3('0x52')],'rows':_0x2ea32c});}})[_0xd1d3('0x24')](handleError(_0x4fe8c8,null));};exports['getOfflineMessages']=function(_0x1ee90e,_0xb41b3a){var _0x2eb45c={'raw':![],'where':{}};var _0x20c25e={};var _0x28e5c3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd1d3('0x76')]({'where':{'id':_0x1ee90e[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0xb41b3a,null))[_0xd1d3('0x1a')](function(_0x101981){if(_0x101981){_0x20c25e[_0xd1d3('0x46')]=_[_0xd1d3('0x62')](db[_0xd1d3('0x129')][_0xd1d3('0x78')]);_0x20c25e[_0xd1d3('0x50')]=_[_0xd1d3('0x62')](_0x1ee90e[_0xd1d3('0x50')]);_0x20c25e[_0xd1d3('0x58')]=_['intersection'](_0x20c25e[_0xd1d3('0x46')],_0x20c25e[_0xd1d3('0x50')]);_0x2eb45c[_0xd1d3('0x51')]=_['intersection'](_0x20c25e[_0xd1d3('0x46')],qs[_0xd1d3('0x63')](_0x1ee90e[_0xd1d3('0x50')][_0xd1d3('0x63')]));_0x2eb45c[_0xd1d3('0x51')]=_0x2eb45c['attributes'][_0xd1d3('0x52')]?_0x2eb45c[_0xd1d3('0x51')]:_0x20c25e[_0xd1d3('0x46')];if(!_0x1ee90e['query'][_0xd1d3('0x53')]('nolimit')){_0x2eb45c[_0xd1d3('0x2b')]=qs['limit'](_0x1ee90e[_0xd1d3('0x50')]['limit']);_0x2eb45c[_0xd1d3('0x29')]=qs[_0xd1d3('0x29')](_0x1ee90e[_0xd1d3('0x50')]['offset']);}_0x2eb45c[_0xd1d3('0x55')]=qs[_0xd1d3('0x56')](_0x1ee90e[_0xd1d3('0x50')][_0xd1d3('0x56')]);_0x2eb45c[_0xd1d3('0x57')]=qs[_0xd1d3('0x58')](_['pick'](_0x1ee90e[_0xd1d3('0x50')],_0x20c25e['filters']));_0x2eb45c[_0xd1d3('0x57')][_0xd1d3('0x79')]=_0x101981['id'];if(_0x1ee90e[_0xd1d3('0x50')][_0xd1d3('0x5a')]){_0x2eb45c[_0xd1d3('0x57')]=_[_0xd1d3('0x5b')](_0x2eb45c['where'],{'$or':_[_0xd1d3('0x4b')](_0x2eb45c[_0xd1d3('0x51')],function(_0x424aad){var _0x24ff8f={};_0x24ff8f[_0x424aad]={'$like':'%'+_0x1ee90e[_0xd1d3('0x50')]['filter']+'%'};return _0x24ff8f;})});}_0x2eb45c=_[_0xd1d3('0x5b')]({},_0x2eb45c,_0x1ee90e[_0xd1d3('0x65')]);return db['ChatOfflineMessage'][_0xd1d3('0x2c')]({'where':_0x2eb45c['where']})[_0xd1d3('0x1a')](function(_0x4a792b){_0x28e5c3[_0xd1d3('0x2c')]=_0x4a792b;if(_0x1ee90e[_0xd1d3('0x50')][_0xd1d3('0x5d')]){_0x2eb45c[_0xd1d3('0x64')]=[{'all':!![]}];}else{_0x2eb45c[_0xd1d3('0x64')]=[{'model':db[_0xd1d3('0xa6')],'as':_0xd1d3('0x12a'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xd1d3('0x129')][_0xd1d3('0x5e')](_0x2eb45c);})[_0xd1d3('0x1a')](function(_0x341c3a){_0x28e5c3[_0xd1d3('0x5f')]=_0x341c3a;return _0x28e5c3;});}})['then'](respondWithFilteredResult(_0xb41b3a,_0x2eb45c))['catch'](handleError(_0xb41b3a,null));};exports[_0xd1d3('0x12b')]=function(_0x391524,_0x7b7d69){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x391524['params']['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0x7b7d69,null))[_0xd1d3('0x1a')](function(_0x486a75){if(_0x486a75){return _0x486a75['addAgents'](_0x391524['body'][_0xd1d3('0x7e')],_['omit'](_0x391524['body'],[_0xd1d3('0x7e'),'id'])||{})['spread'](function(_0x1422a2){for(var _0x48630f=0x0;_0x48630f<_0x391524[_0xd1d3('0x68')]['ids'][_0xd1d3('0x52')];_0x48630f+=0x1){socket['emit'](_0xd1d3('0x12c'),{'UserId':Number(_0x391524[_0xd1d3('0x68')][_0xd1d3('0x7e')][_0x48630f]),'ChatWebsiteId':Number(_0x391524['params']['id'])});}return _0x1422a2;});}})['then'](respondWithResult(_0x7b7d69,null))[_0xd1d3('0x24')](handleError(_0x7b7d69,null));};exports[_0xd1d3('0x12d')]=function(_0x11629e,_0xa99139){return db[_0xd1d3('0x4c')][_0xd1d3('0x66')]({'where':{'id':_0x11629e[_0xd1d3('0x72')]['id']}})[_0xd1d3('0x1a')](handleEntityNotFound(_0xa99139,null))['then'](function(_0x1f7457){if(_0x1f7457){return _0x1f7457[_0xd1d3('0x12d')](_0x11629e[_0xd1d3('0x50')][_0xd1d3('0x7e')])['then'](function(){if(_[_0xd1d3('0x12e')](_0x11629e[_0xd1d3('0x50')]['ids'])){for(var _0x18785c=0x0;_0x18785c<_0x11629e[_0xd1d3('0x50')]['ids'][_0xd1d3('0x52')];_0x18785c+=0x1){socket[_0xd1d3('0x12f')](_0xd1d3('0x130'),{'UserId':Number(_0x11629e[_0xd1d3('0x50')][_0xd1d3('0x7e')][_0x18785c]),'ChatWebsiteId':Number(_0x11629e[_0xd1d3('0x72')]['id'])});}}else{socket['emit'](_0xd1d3('0x130'),{'UserId':Number(_0x11629e['query'][_0xd1d3('0x7e')]),'ChatWebsiteId':Number(_0x11629e[_0xd1d3('0x72')]['id'])});}});}})[_0xd1d3('0x1a')](respondWithStatusCode(_0xa99139,null))['catch'](handleError(_0xa99139,null));};exports[_0xd1d3('0x131')]=function(_0x45078e,_0x14e0b0){var _0x176b4d={};var _0x16eb67={};var _0x4947d2;var _0x50dc43;return db[_0xd1d3('0x4c')][_0xd1d3('0x76')]({'where':{'id':_0x45078e['params']['id']}})['then'](handleEntityNotFound(_0x14e0b0,null))['then'](function(_0x2df6da){if(_0x2df6da){_0x4947d2=_0x2df6da;_0x16eb67[_0xd1d3('0x46')]=_['keys'](db[_0xd1d3('0xc3')][_0xd1d3('0x78')]);_0x16eb67['query']=_[_0xd1d3('0x62')](_0x45078e[_0xd1d3('0x50')]);_0x16eb67['filters']=_[_0xd1d3('0x4f')](_0x16eb67[_0xd1d3('0x46')],_0x16eb67[_0xd1d3('0x50')]);_0x176b4d[_0xd1d3('0x51')]=_[_0xd1d3('0x4f')](_0x16eb67['model'],qs['fields'](_0x45078e[_0xd1d3('0x50')][_0xd1d3('0x63')]));_0x176b4d['attributes']=_0x176b4d[_0xd1d3('0x51')][_0xd1d3('0x52')]?_0x176b4d[_0xd1d3('0x51')]:_0x16eb67[_0xd1d3('0x46')];_0x176b4d[_0xd1d3('0x55')]=qs[_0xd1d3('0x56')](_0x45078e['query'][_0xd1d3('0x56')]);_0x176b4d[_0xd1d3('0x57')]=qs['filters'](_['pick'](_0x45078e['query'],_0x16eb67[_0xd1d3('0x58')]));if(_0x45078e['query']['filter']){_0x176b4d[_0xd1d3('0x57')]=_['merge'](_0x176b4d['where'],{'$or':_[_0xd1d3('0x4b')](_0x176b4d[_0xd1d3('0x51')],function(_0x35ada2){var _0xd26d80={};_0xd26d80[_0x35ada2]={'$like':'%'+_0x45078e[_0xd1d3('0x50')][_0xd1d3('0x5a')]+'%'};return _0xd26d80;})});}_0x176b4d=_['merge']({},_0x176b4d,_0x45078e[_0xd1d3('0x65')]);return _0x4947d2[_0xd1d3('0x131')](_0x176b4d);}})['then'](function(_0x56ee24){if(_0x56ee24){_0x50dc43=_0x56ee24[_0xd1d3('0x52')];if(!_0x45078e[_0xd1d3('0x50')][_0xd1d3('0x53')](_0xd1d3('0x54'))){_0x176b4d[_0xd1d3('0x2b')]=qs[_0xd1d3('0x2b')](_0x45078e['query'][_0xd1d3('0x2b')]);_0x176b4d['offset']=qs['offset'](_0x45078e[_0xd1d3('0x50')][_0xd1d3('0x29')]);}return _0x4947d2[_0xd1d3('0x131')](_0x176b4d);}})[_0xd1d3('0x1a')](function(_0x2c00af){if(_0x2c00af){return _0x2c00af?{'count':_0x50dc43,'rows':_0x2c00af}:null;}})[_0xd1d3('0x1a')](respondWithResult(_0x14e0b0,null))[_0xd1d3('0x24')](handleError(_0x14e0b0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 56c327d..327b3db 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 _0x291c=['save','update','remove','emit','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x3d0dc3,_0x1e5e5a){var _0x3435c7=function(_0x30b7a9){while(--_0x30b7a9){_0x3d0dc3['push'](_0x3d0dc3['shift']());}};_0x3435c7(++_0x1e5e5a);}(_0x291c,0x137));var _0xc291=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x291c[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc291('0x0'));var ChatWebsite=require(_0xc291('0x1'))['db'][_0xc291('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc291('0x3')](0x0);var events={'afterCreate':_0xc291('0x4'),'afterUpdate':_0xc291('0x5'),'afterDestroy':_0xc291('0x6')};function emitEvent(_0x7b34d6){return function(_0xafdfee,_0x118ddf,_0x187a34){ChatWebsiteEvents['emit'](_0x7b34d6+':'+_0xafdfee['id'],_0xafdfee);ChatWebsiteEvents[_0xc291('0x7')](_0x7b34d6,_0xafdfee);_0x187a34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc291('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6597=['ChatWebsite','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4f3e95,_0x3a4cd5){var _0x2bd7db=function(_0x1a4b91){while(--_0x1a4b91){_0x4f3e95['push'](_0x4f3e95['shift']());}};_0x2bd7db(++_0x3a4cd5);}(_0x6597,0x16e));var _0x7659=function(_0x4b41e0,_0x4292d2){_0x4b41e0=_0x4b41e0-0x0;var _0x1647c3=_0x6597[_0x4b41e0];return _0x1647c3;};'use strict';var EventEmitter=require(_0x7659('0x0'));var ChatWebsite=require(_0x7659('0x1'))['db'][_0x7659('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7659('0x3'),'afterUpdate':'update','afterDestroy':_0x7659('0x4')};function emitEvent(_0x4f5b89){return function(_0x5e96ed,_0x576e8b,_0xbcb138){ChatWebsiteEvents[_0x7659('0x5')](_0x4f5b89+':'+_0x5e96ed['id'],_0x5e96ed);ChatWebsiteEvents[_0x7659('0x5')](_0x4f5b89,_0x5e96ed);_0xbcb138(null);};}for(var e in events){if(events[_0x7659('0x6')](e)){var event=events[e];ChatWebsite[_0x7659('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c9120a2..619fc8e 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 _0xe9d9=['path','rimraf','../../config/environment','define','ChatWebsite','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x17dbdd,_0x8a27d5){var _0x15ed0c=function(_0x41c2ca){while(--_0x41c2ca){_0x17dbdd['push'](_0x17dbdd['shift']());}};_0x15ed0c(++_0x8a27d5);}(_0xe9d9,0x87));var _0x9e9d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9e9d('0x0'));var util=require('util');var logger=require(_0x9e9d('0x1'))(_0x9e9d('0x2'));var moment=require('moment');var BPromise=require(_0x9e9d('0x3'));var rp=require(_0x9e9d('0x4'));var fs=require('fs');var path=require(_0x9e9d('0x5'));var rimraf=require(_0x9e9d('0x6'));var config=require(_0x9e9d('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x3a08be,_0x55bcdf){return _0x3a08be[_0x9e9d('0x8')](_0x9e9d('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa23d=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x58893d,_0x8c2367){var _0x2d123b=function(_0x2ab330){while(--_0x2ab330){_0x58893d['push'](_0x58893d['shift']());}};_0x2d123b(++_0x8c2367);}(_0xa23d,0x1ee));var _0xda23=function(_0x220ea8,_0x593a07){_0x220ea8=_0x220ea8-0x0;var _0x301497=_0xa23d[_0x220ea8];return _0x301497;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xda23('0x0'));var moment=require(_0xda23('0x1'));var BPromise=require(_0xda23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda23('0x3'));var rimraf=require(_0xda23('0x4'));var config=require(_0xda23('0x5'));var attributes=require(_0xda23('0x6'));module[_0xda23('0x7')]=function(_0x2a0a5a,_0x3ebd3e){return _0x2a0a5a['define'](_0xda23('0x8'),attributes,{'tableName':_0xda23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 4f359c6..a048868 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 _0xae70=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x58d4ce,_0x154425){var _0x3c5170=function(_0x235a0a){while(--_0x235a0a){_0x58d4ce['push'](_0x58d4ce['shift']());}};_0x3c5170(++_0x154425);}(_0xae70,0x17c));var _0x0ae7=function(_0x1ee80c,_0x1e99ad){_0x1ee80c=_0x1ee80c-0x0;var _0x1185b3=_0xae70[_0x1ee80c];return _0x1185b3;};'use strict';var _=require(_0x0ae7('0x0'));var util=require(_0x0ae7('0x1'));var moment=require('moment');var BPromise=require(_0x0ae7('0x2'));var rs=require(_0x0ae7('0x3'));var fs=require('fs');var Redis=require(_0x0ae7('0x4'));var db=require(_0x0ae7('0x5'))['db'];var utils=require(_0x0ae7('0x6'));var logger=require(_0x0ae7('0x7'))('rpc');var config=require(_0x0ae7('0x8'));var jayson=require(_0x0ae7('0x9'));var client=jayson[_0x0ae7('0xa')][_0x0ae7('0xb')]({'port':0x232a});config[_0x0ae7('0xc')]=_['defaults'](config[_0x0ae7('0xc')],{'host':_0x0ae7('0xd'),'port':0x18eb});var socket=require(_0x0ae7('0xe'))(new Redis(config[_0x0ae7('0xc')]));require(_0x0ae7('0xf'))['register'](socket);function respondWithRpcPromise(_0x490178,_0xa92f6b,_0x3b4b52){return new BPromise(function(_0x23d9ef,_0x55367a){return client[_0x0ae7('0x10')](_0x490178,_0x3b4b52)[_0x0ae7('0x11')](function(_0x126851){logger['info'](_0x0ae7('0x12'),_0xa92f6b,_0x0ae7('0x13'));logger[_0x0ae7('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xa92f6b,_0x0ae7('0x13'),JSON[_0x0ae7('0x15')](_0x126851));if(_0x126851[_0x0ae7('0x16')]){if(_0x126851[_0x0ae7('0x16')]['code']===0x1f4){logger[_0x0ae7('0x16')](_0x0ae7('0x12'),_0xa92f6b,_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);return _0x55367a(_0x126851['error'][_0x0ae7('0x17')]);}logger[_0x0ae7('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xa92f6b,_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);return _0x23d9ef(_0x126851[_0x0ae7('0x16')][_0x0ae7('0x17')]);}else{logger[_0x0ae7('0x18')](_0x0ae7('0x12'),_0xa92f6b,_0x0ae7('0x13'));_0x23d9ef(_0x126851[_0x0ae7('0x19')][_0x0ae7('0x17')]);}})[_0x0ae7('0x1a')](function(_0xa3615c){logger['error'](_0x0ae7('0x12'),_0xa92f6b,_0xa3615c);_0x55367a(_0xa3615c);});});} \ No newline at end of file +var _0x95c7=['../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2805d3,_0x57fb0b){var _0x4329c8=function(_0x562384){while(--_0x562384){_0x2805d3['push'](_0x2805d3['shift']());}};_0x4329c8(++_0x57fb0b);}(_0x95c7,0xe5));var _0x795c=function(_0x487ab0,_0x531a77){_0x487ab0=_0x487ab0-0x0;var _0x283d8d=_0x95c7[_0x487ab0];return _0x283d8d;};'use strict';var _=require(_0x795c('0x0'));var util=require('util');var moment=require(_0x795c('0x1'));var BPromise=require('bluebird');var rs=require(_0x795c('0x2'));var fs=require('fs');var Redis=require(_0x795c('0x3'));var db=require(_0x795c('0x4'))['db'];var utils=require(_0x795c('0x5'));var logger=require(_0x795c('0x6'))(_0x795c('0x7'));var config=require('../../config/environment');var jayson=require(_0x795c('0x8'));var client=jayson['client'][_0x795c('0x9')]({'port':0x232a});config[_0x795c('0xa')]=_[_0x795c('0xb')](config[_0x795c('0xa')],{'host':_0x795c('0xc'),'port':0x18eb});var socket=require(_0x795c('0xd'))(new Redis(config[_0x795c('0xa')]));require(_0x795c('0xe'))[_0x795c('0xf')](socket);function respondWithRpcPromise(_0x3875e2,_0xe097b4,_0x1af1a9){return new BPromise(function(_0x3b2b4e,_0x31845b){return client[_0x795c('0x10')](_0x3875e2,_0x1af1a9)[_0x795c('0x11')](function(_0x4f613d){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xe097b4,_0x795c('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xe097b4,_0x795c('0x12'),JSON[_0x795c('0x13')](_0x4f613d));if(_0x4f613d['error']){if(_0x4f613d[_0x795c('0x14')][_0x795c('0x15')]===0x1f4){logger['error'](_0x795c('0x16'),_0xe097b4,_0x4f613d['error'][_0x795c('0x17')]);return _0x31845b(_0x4f613d[_0x795c('0x14')][_0x795c('0x17')]);}logger[_0x795c('0x14')](_0x795c('0x16'),_0xe097b4,_0x4f613d['error'][_0x795c('0x17')]);return _0x3b2b4e(_0x4f613d[_0x795c('0x14')][_0x795c('0x17')]);}else{logger[_0x795c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xe097b4,'request\x20sent');_0x3b2b4e(_0x4f613d[_0x795c('0x19')][_0x795c('0x17')]);}})['catch'](function(_0x3c464d){logger[_0x795c('0x14')](_0x795c('0x16'),_0xe097b4,_0x3c464d);_0x31845b(_0x3c464d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 65c4298..ade0360 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 _0xdc92=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc92,0xc8));var _0x2dc9=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xdc92[_0x4ea413];return _0x51cf25;};'use strict';var ChatWebsiteEvents=require(_0x2dc9('0x0'));var events=[_0x2dc9('0x1'),'remove',_0x2dc9('0x2')];function createListener(_0x109d6a,_0x2c0a07){return function(_0x2d4b40){_0x2c0a07['emit'](_0x109d6a,_0x2d4b40);};}function removeListener(_0x2157b0,_0x395c98){return function(){ChatWebsiteEvents[_0x2dc9('0x3')](_0x2157b0,_0x395c98);};}exports[_0x2dc9('0x4')]=function(_0x524a32){for(var _0x43377a=0x0,_0x161494=events[_0x2dc9('0x5')];_0x43377a<_0x161494;_0x43377a++){var _0xbd7aa5=events[_0x43377a];var _0x53851d=createListener(_0x2dc9('0x6')+_0xbd7aa5,_0x524a32);ChatWebsiteEvents['on'](_0xbd7aa5,_0x53851d);}}; \ No newline at end of file +var _0x7429=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x15ea80,_0x19b281){var _0x345373=function(_0x3b000d){while(--_0x3b000d){_0x15ea80['push'](_0x15ea80['shift']());}};_0x345373(++_0x19b281);}(_0x7429,0xa0));var _0x9742=function(_0x492165,_0x59e63c){_0x492165=_0x492165-0x0;var _0x425a13=_0x7429[_0x492165];return _0x425a13;};'use strict';var ChatWebsiteEvents=require(_0x9742('0x0'));var events=[_0x9742('0x1'),_0x9742('0x2'),_0x9742('0x3')];function createListener(_0x3fe68f,_0x466a4b){return function(_0x2a250e){_0x466a4b[_0x9742('0x4')](_0x3fe68f,_0x2a250e);};}function removeListener(_0x19f2f0,_0x22a8e7){return function(){ChatWebsiteEvents[_0x9742('0x5')](_0x19f2f0,_0x22a8e7);};}exports[_0x9742('0x6')]=function(_0x6e40c8){for(var _0x7a22d3=0x0,_0x535ee2=events[_0x9742('0x7')];_0x7a22d3<_0x535ee2;_0x7a22d3++){var _0x12db59=events[_0x7a22d3];var _0x31ec85=createListener(_0x9742('0x8')+_0x12db59,_0x6e40c8);ChatWebsiteEvents['on'](_0x12db59,_0x31ec85);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index b7d3fe2..500747a 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe77c=['url','replace','localhost','test','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xe77c,0x176));var _0xce77=function(_0x1c72ac,_0x380a0e){_0x1c72ac=_0x1c72ac-0x0;var _0x274e46=_0xe77c[_0x1c72ac];return _0x274e46;};var escapeRegExp=require(_0xce77('0x0'))[_0xce77('0x1')];var URL=require(_0xce77('0x2'))['URL'];function testWildcardValidity(_0x2b8db3){var _0x1e3ae4=!![];try{new URL(_0x2b8db3[_0xce77('0x3')]('*',_0xce77('0x4')));}catch(_0x3da792){_0x1e3ae4=![];}return _0x1e3ae4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xce77('0x5')](_0x2b8db3);}function testWebsiteWithWildcard(_0x9fc8f0,_0x5adf97){var _0x5aea39;var _0xed47c5=escapeRegExp(_0x9fc8f0['trim']()[_0xce77('0x3')](/\/$/,''))[_0xce77('0x3')]('\x5c*',_0xce77('0x6'));try{new URL(_0x9fc8f0['replace']('\x5c*',_0xce77('0x4')));_0x5aea39=new RegExp(_0xed47c5)[_0xce77('0x5')](_0x5adf97);}catch(_0x82cc7e){_0x5aea39=![];}return _0x5aea39;}module[_0xce77('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x292c=['localhost','test','exports','../../../utils/misc','url','URL','replace','trim','([\x5cw]+)'];(function(_0x33a78a,_0x174c0d){var _0x26742f=function(_0x5f1481){while(--_0x5f1481){_0x33a78a['push'](_0x33a78a['shift']());}};_0x26742f(++_0x174c0d);}(_0x292c,0x66));var _0xc292=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x292c[_0x501510];return _0x1e6ee5;};var escapeRegExp=require(_0xc292('0x0'))['escapeRegExp'];var URL=require(_0xc292('0x1'))[_0xc292('0x2')];function testWildcardValidity(_0x61f2da){var _0x1931ea=!![];try{new URL(_0x61f2da[_0xc292('0x3')]('*','localhost'));}catch(_0x1f14f9){_0x1931ea=![];}return _0x1931ea&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x61f2da);}function testWebsiteWithWildcard(_0x516f54,_0x23c98f){var _0x1c45ed;var _0x2c01eb=escapeRegExp(_0x516f54[_0xc292('0x4')]()[_0xc292('0x3')](/\/$/,''))[_0xc292('0x3')]('\x5c*',_0xc292('0x5'));try{new URL(_0x516f54[_0xc292('0x3')]('\x5c*',_0xc292('0x6')));_0x1c45ed=new RegExp(_0x2c01eb)[_0xc292('0x7')](_0x23c98f);}catch(_0x5a548a){_0x1c45ed=![];}return _0x1c45ed;}module[_0xc292('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c532b82..0e20806 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 _0x9d3a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','originalname','/:id/logo','single','file','server/files/images/avatars/','now','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','delete','/:id','destroy','removeDispositions','removeAgents','exports'];(function(_0x5746a1,_0x45b96f){var _0x105a24=function(_0x53cf64){while(--_0x53cf64){_0x5746a1['push'](_0x5746a1['shift']());}};_0x105a24(++_0x45b96f);}(_0x9d3a,0x114));var _0xa9d3=function(_0x215f9e,_0x438b14){_0x215f9e=_0x215f9e-0x0;var _0x217ce4=_0x9d3a[_0x215f9e];return _0x217ce4;};'use strict';var multer=require('multer');var util=require(_0xa9d3('0x0'));var path=require('path');var timeout=require(_0xa9d3('0x1'));var express=require(_0xa9d3('0x2'));var router=express[_0xa9d3('0x3')]();var fs_extra=require(_0xa9d3('0x4'));var auth=require(_0xa9d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9d3('0x6'));var controller=require('./chatWebsite.controller');router[_0xa9d3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa9d3('0x8')]);router[_0xa9d3('0x7')](_0xa9d3('0x9'),auth[_0xa9d3('0xa')](),controller['describe']);router[_0xa9d3('0x7')]('/:id',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0xb')]);router['get'](_0xa9d3('0xc'),auth['isAuthenticated'](),controller[_0xa9d3('0xd')]);router[_0xa9d3('0x7')](_0xa9d3('0xe'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0xf')]);router[_0xa9d3('0x7')]('/:id/logo',controller[_0xa9d3('0x10')]);router['get'](_0xa9d3('0x11'),controller[_0xa9d3('0x12')]);router[_0xa9d3('0x7')]('/:id/customer_avatar',controller[_0xa9d3('0x13')]);router[_0xa9d3('0x7')](_0xa9d3('0x14'),controller[_0xa9d3('0x15')]);router[_0xa9d3('0x7')](_0xa9d3('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa9d3('0x7')](_0xa9d3('0x17'),controller[_0xa9d3('0x18')]);router[_0xa9d3('0x7')](_0xa9d3('0x19'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x1a')]);router[_0xa9d3('0x7')](_0xa9d3('0x1b'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x1c')]);router[_0xa9d3('0x7')](_0xa9d3('0x1d'),controller[_0xa9d3('0x1e')]);router[_0xa9d3('0x7')](_0xa9d3('0x1f'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x20')]);router[_0xa9d3('0x7')]('/:id/users',auth[_0xa9d3('0xa')](),controller['getAgents']);router[_0xa9d3('0x21')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9d3('0x21')](_0xa9d3('0xc'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x22')]);router[_0xa9d3('0x21')]('/:id/canned_answers',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x23')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x85d4dc,_0x1ca97e,_0x1c64d0){_0x1c64d0(null,path[_0xa9d3('0x25')](config[_0xa9d3('0x26')],'server/files/images/logos/'));},'filename':function(_0x4e5aa1,_0x3f5648,_0x401924){_0x401924(null,util[_0xa9d3('0x27')](_0xa9d3('0x28'),Date['now'](),_0x3f5648[_0xa9d3('0x29')]));}})});router[_0xa9d3('0x21')](_0xa9d3('0x2a'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x5e5bca,_0x4e7c17,_0x27ba82){_0x27ba82(null,path[_0xa9d3('0x25')](config['root'],_0xa9d3('0x2d')));},'filename':function(_0x41f019,_0xa9a149,_0x35ec88){_0x35ec88(null,util['format']('%s-%s',Date[_0xa9d3('0x2e')](),_0xa9a149['originalname']));}})});router['post'](_0xa9d3('0x11'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller[_0xa9d3('0x2f')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x187d2e,_0x12f415,_0x50479c){_0x50479c(null,path['join'](config[_0xa9d3('0x26')],_0xa9d3('0x2d')));},'filename':function(_0x37238d,_0xca13fd,_0x297a3c){_0x297a3c(null,util[_0xa9d3('0x27')](_0xa9d3('0x28'),Date['now'](),_0xca13fd['originalname']));}})});router[_0xa9d3('0x21')](_0xa9d3('0x30'),upload[_0xa9d3('0x2b')]('file'),controller[_0xa9d3('0x31')]);var upload=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x29253a,_0x12d88a,_0x2ce1e5){_0x2ce1e5(null,path['join'](config['root'],_0xa9d3('0x2d')));},'filename':function(_0x3cdefb,_0x230440,_0x5a8c68){_0x5a8c68(null,util[_0xa9d3('0x27')]('%s-%s',Date[_0xa9d3('0x2e')](),_0x230440[_0xa9d3('0x29')]));}})});router[_0xa9d3('0x21')](_0xa9d3('0x14'),upload[_0xa9d3('0x2b')](_0xa9d3('0x2c')),controller[_0xa9d3('0x32')]);router['post'](_0xa9d3('0x33'),controller[_0xa9d3('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xa9d3('0x24')]({'destination':function(_0x1b4e72,_0x5b743e,_0x4fb459){const _0x79244e=path[_0xa9d3('0x25')](config[_0xa9d3('0x26')],'server/files','attachments','offline-chat');fs_extra['ensureDir'](_0x79244e,function(){_0x4fb459(null,_0x79244e);});},'filename':function(_0x3e61fd,_0x24d420,_0xfbdead){const _0xdb33c0=_0x24d420[_0xa9d3('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x208169=path[_0xa9d3('0x35')](_0xdb33c0);const _0x19c3bd=Date[_0xa9d3('0x2e')]()+'-'+_0xdb33c0[_0xa9d3('0x36')](_0x208169,'')+_0x208169;_0xfbdead(null,_0x19c3bd);}})});router[_0xa9d3('0x21')]('/:id/offline',offlineUploadMulter[_0xa9d3('0x37')](),controller[_0xa9d3('0x38')]);router[_0xa9d3('0x21')](_0xa9d3('0x16'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x39')]);router[_0xa9d3('0x21')](_0xa9d3('0x19'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x3a')]);router[_0xa9d3('0x21')]('/:id/proactive_actions',auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x3b')]);router[_0xa9d3('0x21')](_0xa9d3('0x3c'),auth['isAuthenticated'](),controller[_0xa9d3('0x3d')]);router[_0xa9d3('0x3e')]('/:id',auth[_0xa9d3('0xa')](),controller['update']);router[_0xa9d3('0x3f')](_0xa9d3('0x40'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x41')]);router[_0xa9d3('0x3f')](_0xa9d3('0xc'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x42')]);router[_0xa9d3('0x3f')](_0xa9d3('0xe'),auth[_0xa9d3('0xa')](),controller['removeAnswers']);router[_0xa9d3('0x3f')](_0xa9d3('0x3c'),auth[_0xa9d3('0xa')](),controller[_0xa9d3('0x43')]);module[_0xa9d3('0x44')]=router; \ No newline at end of file +var _0x0f54=['/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','format','now','originalname','/:id/logo','single','file','addLogo','%s-%s','/:id/avatar','addAvatar','server/files/images/avatars/','addCustomerAvatar','notify','server/files','attachments','ensureDir','replace','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/canned_answers','getAnswers','getLogo','getAvatar'];(function(_0x108a76,_0x160eee){var _0x495260=function(_0x1e9008){while(--_0x1e9008){_0x108a76['push'](_0x108a76['shift']());}};_0x495260(++_0x160eee);}(_0x0f54,0x100));var _0x40f5=function(_0x10f3f8,_0x114a4f){_0x10f3f8=_0x10f3f8-0x0;var _0x59dec6=_0x0f54[_0x10f3f8];return _0x59dec6;};'use strict';var multer=require(_0x40f5('0x0'));var util=require('util');var path=require(_0x40f5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x40f5('0x2'));var interaction=require(_0x40f5('0x3'));var config=require(_0x40f5('0x4'));var controller=require(_0x40f5('0x5'));router[_0x40f5('0x6')]('/',auth[_0x40f5('0x7')](),controller[_0x40f5('0x8')]);router[_0x40f5('0x6')](_0x40f5('0x9'),auth['isAuthenticated'](),controller[_0x40f5('0xa')]);router[_0x40f5('0x6')](_0x40f5('0xb'),auth[_0x40f5('0x7')](),controller['show']);router[_0x40f5('0x6')]('/:id/dispositions',auth[_0x40f5('0x7')](),controller['getDispositions']);router['get'](_0x40f5('0xc'),auth['isAuthenticated'](),controller[_0x40f5('0xd')]);router[_0x40f5('0x6')]('/:id/logo',controller[_0x40f5('0xe')]);router[_0x40f5('0x6')]('/:id/avatar',controller[_0x40f5('0xf')]);router[_0x40f5('0x6')](_0x40f5('0x10'),controller[_0x40f5('0x11')]);router[_0x40f5('0x6')](_0x40f5('0x12'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x40f5('0x7')](),controller[_0x40f5('0x13')]);router[_0x40f5('0x6')](_0x40f5('0x14'),controller[_0x40f5('0x15')]);router[_0x40f5('0x6')](_0x40f5('0x16'),auth[_0x40f5('0x7')](),controller[_0x40f5('0x17')]);router[_0x40f5('0x6')](_0x40f5('0x18'),auth['isAuthenticated'](),controller[_0x40f5('0x19')]);router[_0x40f5('0x6')](_0x40f5('0x1a'),controller[_0x40f5('0x1b')]);router['get']('/:id/offline_messages',auth[_0x40f5('0x7')](),controller[_0x40f5('0x1c')]);router[_0x40f5('0x6')](_0x40f5('0x1d'),auth[_0x40f5('0x7')](),controller['getAgents']);router[_0x40f5('0x1e')]('/',auth['isAuthenticated'](),controller[_0x40f5('0x1f')]);router['post'](_0x40f5('0x20'),auth[_0x40f5('0x7')](),controller['addDisposition']);router[_0x40f5('0x1e')](_0x40f5('0xc'),auth['isAuthenticated'](),controller[_0x40f5('0x21')]);var upload=multer({'storage':multer[_0x40f5('0x22')]({'destination':function(_0x12a6c7,_0x3fee45,_0x594f05){_0x594f05(null,path[_0x40f5('0x23')](config[_0x40f5('0x24')],'server/files/images/logos/'));},'filename':function(_0x7c5269,_0x40920f,_0x31b74e){_0x31b74e(null,util[_0x40f5('0x25')]('%s-%s',Date[_0x40f5('0x26')](),_0x40920f[_0x40f5('0x27')]));}})});router[_0x40f5('0x1e')](_0x40f5('0x28'),upload[_0x40f5('0x29')](_0x40f5('0x2a')),controller[_0x40f5('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbd172f,_0x35e78f,_0x27278f){_0x27278f(null,path[_0x40f5('0x23')](config[_0x40f5('0x24')],'server/files/images/avatars/'));},'filename':function(_0x48227d,_0x430764,_0x1d8a3f){_0x1d8a3f(null,util[_0x40f5('0x25')](_0x40f5('0x2c'),Date[_0x40f5('0x26')](),_0x430764[_0x40f5('0x27')]));}})});router[_0x40f5('0x1e')](_0x40f5('0x2d'),upload[_0x40f5('0x29')](_0x40f5('0x2a')),controller[_0x40f5('0x2e')]);var upload=multer({'storage':multer[_0x40f5('0x22')]({'destination':function(_0x522a19,_0x290fac,_0x2cfe46){_0x2cfe46(null,path[_0x40f5('0x23')](config[_0x40f5('0x24')],_0x40f5('0x2f')));},'filename':function(_0xa30319,_0x4aa451,_0x2a16e4){_0x2a16e4(null,util['format'](_0x40f5('0x2c'),Date['now'](),_0x4aa451[_0x40f5('0x27')]));}})});router[_0x40f5('0x1e')](_0x40f5('0x10'),upload['single'](_0x40f5('0x2a')),controller[_0x40f5('0x30')]);var upload=multer({'storage':multer[_0x40f5('0x22')]({'destination':function(_0x1a9a91,_0xad35f8,_0x2e664f){_0x2e664f(null,path[_0x40f5('0x23')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x30feca,_0x53fda4,_0x3d4280){_0x3d4280(null,util[_0x40f5('0x25')](_0x40f5('0x2c'),Date[_0x40f5('0x26')](),_0x53fda4[_0x40f5('0x27')]));}})});router[_0x40f5('0x1e')](_0x40f5('0x12'),upload[_0x40f5('0x29')](_0x40f5('0x2a')),controller['addSystemAvatar']);router[_0x40f5('0x1e')]('/:id/notify',controller[_0x40f5('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x40f5('0x22')]({'destination':function(_0x2a83ef,_0x329e60,_0x46148f){const _0x5a2913=path['join'](config[_0x40f5('0x24')],_0x40f5('0x32'),_0x40f5('0x33'),'offline-chat');fs_extra[_0x40f5('0x34')](_0x5a2913,function(){_0x46148f(null,_0x5a2913);});},'filename':function(_0x19934d,_0x4239df,_0x192d47){const _0x1abb2b=_0x4239df[_0x40f5('0x27')][_0x40f5('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2c763a=path['extname'](_0x1abb2b);const _0x5433eb=Date[_0x40f5('0x26')]()+'-'+_0x1abb2b[_0x40f5('0x35')](_0x2c763a,'')+_0x2c763a;_0x192d47(null,_0x5433eb);}})});router[_0x40f5('0x1e')](_0x40f5('0x36'),offlineUploadMulter['any'](),controller[_0x40f5('0x37')]);router[_0x40f5('0x1e')](_0x40f5('0x38'),auth['isAuthenticated'](),controller[_0x40f5('0x39')]);router[_0x40f5('0x1e')]('/:id/applications',auth[_0x40f5('0x7')](),controller[_0x40f5('0x3a')]);router[_0x40f5('0x1e')]('/:id/proactive_actions',auth[_0x40f5('0x7')](),controller[_0x40f5('0x3b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x40f5('0x3c')]);router[_0x40f5('0x3d')](_0x40f5('0xb'),auth[_0x40f5('0x7')](),controller[_0x40f5('0x3e')]);router[_0x40f5('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0x40f5('0x40')]);router['delete'](_0x40f5('0x20'),auth[_0x40f5('0x7')](),controller['removeDispositions']);router[_0x40f5('0x3f')]('/:id/canned_answers',auth[_0x40f5('0x7')](),controller[_0x40f5('0x41')]);router['delete']('/:id/users',auth[_0x40f5('0x7')](),controller[_0x40f5('0x42')]);module[_0x40f5('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d1e057c..aa2b382 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0de=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd0de,0xfb));var _0xed0d=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xd0de[_0x5e9876];return _0x576c48;};var beaverLogger=require(_0xed0d('0x0'));var express=require('express');var auth=require(_0xed0d('0x1'));var config=require(_0xed0d('0x2'));var router=express[_0xed0d('0x3')]();var isProduction=config[_0xed0d('0x4')]===_0xed0d('0x5')||![];function clientSideLogs(_0x403782,_0x5baca6,_0x5605e8){var _0x111490=_0x403782[_0xed0d('0x6')]['get']('client-side-logger');if(!_0x111490){throw new Error(_0xed0d('0x7'));}return beaverLogger[_0xed0d('0x8')]({'uri':_0xed0d('0x9'),'logger':_0x111490,'enableCors':!isProduction})(_0x403782,_0x5baca6,_0x5605e8);}router[_0xed0d('0xa')](auth[_0xed0d('0xb')](),clientSideLogs);module[_0xed0d('0xc')]=router; \ No newline at end of file +var _0xde42=['expressEndpoint','/client-logs','use','exports','beaver-logger/server','../config/environment','production','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x5d804a,_0x80be7b){var _0x170749=function(_0x5e2a02){while(--_0x5e2a02){_0x5d804a['push'](_0x5d804a['shift']());}};_0x170749(++_0x80be7b);}(_0xde42,0x1e1));var _0x2de4=function(_0x24bd83,_0x1830c4){_0x24bd83=_0x24bd83-0x0;var _0x3a047e=_0xde42[_0x24bd83];return _0x3a047e;};var beaverLogger=require(_0x2de4('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x2de4('0x1'));var router=express['Router']();var isProduction=config['env']===_0x2de4('0x2')||![];function clientSideLogs(_0x493831,_0x39fbab,_0x2c68de){var _0x2d9cd2=_0x493831['app']['get'](_0x2de4('0x3'));if(!_0x2d9cd2){throw new Error(_0x2de4('0x4'));}return beaverLogger[_0x2de4('0x5')]({'uri':_0x2de4('0x6'),'logger':_0x2d9cd2,'enableCors':!isProduction})(_0x493831,_0x39fbab,_0x2c68de);}router[_0x2de4('0x7')](auth['isAuthenticated'](),clientSideLogs);module[_0x2de4('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9b84d39..ec2150f 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 _0x97a5=['MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0xf87945,_0x4e43b0){var _0x3c9881=function(_0x5eb0a7){while(--_0x5eb0a7){_0xf87945['push'](_0xf87945['shift']());}};_0x3c9881(++_0x4e43b0);}(_0x97a5,0x18b));var _0x597a=function(_0x450075,_0x1003c3){_0x450075=_0x450075-0x0;var _0x31598d=_0x97a5[_0x450075];return _0x31598d;};'use strict';var Sequelize=require(_0x597a('0x0'));module[_0x597a('0x1')]={'name':{'type':Sequelize[_0x597a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x597a('0x3'),_0x597a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x597a('0x5'),_0x597a('0x6'))},'data1':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0x7')},'data2':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x597a('0x9')},'data4':{'type':Sequelize[_0x597a('0x2')],'comment':_0x597a('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x597a('0xb')},'data6':{'type':Sequelize[_0x597a('0xc')],'comment':_0x597a('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0x597a('0xe')}}; \ No newline at end of file +var _0x3162=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365'];(function(_0x355878,_0x51d04b){var _0xbd952e=function(_0x3351e2){while(--_0x3351e2){_0x355878['push'](_0x355878['shift']());}};_0xbd952e(++_0x51d04b);}(_0x3162,0x18e));var _0x2316=function(_0x5a7fbc,_0xa081de){_0x5a7fbc=_0x5a7fbc-0x0;var _0xcba0fc=_0x3162[_0x5a7fbc];return _0xcba0fc;};'use strict';var Sequelize=require(_0x2316('0x0'));module[_0x2316('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x2316('0x2'),_0x2316('0x3'),_0x2316('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2316('0x5')](_0x2316('0x6'),_0x2316('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0x2316('0x8')},'data2':{'type':Sequelize[_0x2316('0x9')],'comment':_0x2316('0xa')},'data3':{'type':Sequelize[_0x2316('0x9')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x2316('0x9')],'comment':_0x2316('0xb')},'data5':{'type':Sequelize[_0x2316('0xc')],'comment':_0x2316('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x2316('0xc')],'comment':_0x2316('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ffa8129..ca92144 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 _0x4aa7=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','name','padEnd','index','map','CloudProvider','fieldName','type','key','model','query','keys','attributes','nolimit','order','sort','where','filters','merge','options','includeAll','findAll','service','data3','catch','show','params','intersection','fields','length','include','find','MicrosoftAzure','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb'];(function(_0x46e371,_0x54a672){var _0x5ca433=function(_0x34c74f){while(--_0x34c74f){_0x46e371['push'](_0x46e371['shift']());}};_0x5ca433(++_0x54a672);}(_0x4aa7,0x111));var _0x74aa=function(_0x18a276,_0x48c9d5){_0x18a276=_0x18a276-0x0;var _0x3c3cb8=_0x4aa7[_0x18a276];return _0x3c3cb8;};'use strict';var _=require(_0x74aa('0x0'));var Redis=require(_0x74aa('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x74aa('0x2'));var config=require(_0x74aa('0x3'));var logger=require(_0x74aa('0x4'))('api');var db=require(_0x74aa('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x74aa('0x6')]=_[_0x74aa('0x7')](config[_0x74aa('0x6')],{'host':_0x74aa('0x8'),'port':0x18eb});var socket=require(_0x74aa('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x74aa('0x6')]);function respondWithStatusCode(_0x2374ba,_0x4803b1){_0x4803b1=_0x4803b1||0xcc;return function(_0x425fc5){if(_0x425fc5){return _0x2374ba[_0x74aa('0xa')](_0x4803b1);}return _0x2374ba[_0x74aa('0xb')](_0x4803b1)['end']();};}function respondWithResult(_0x5e1c4b,_0x6e14ff){_0x6e14ff=_0x6e14ff||0xc8;return function(_0x2c03dc){if(_0x2c03dc){return _0x5e1c4b[_0x74aa('0xb')](_0x6e14ff)[_0x74aa('0xc')](_0x2c03dc);}};}function respondWithFilteredResult(_0x4cf7ed,_0x6a601){return function(_0x2bab01){if(_0x2bab01){var _0x44f9dd=typeof _0x6a601[_0x74aa('0xd')]===_0x74aa('0xe')&&typeof _0x6a601[_0x74aa('0xf')]===_0x74aa('0xe');var _0x8383c=_0x2bab01[_0x74aa('0x10')];var _0x250f2a=_0x44f9dd?0x0:_0x6a601['offset'];var _0x3b494c=_0x44f9dd?_0x2bab01['count']:_0x6a601[_0x74aa('0xd')]+_0x6a601[_0x74aa('0xf')];var _0x529caf;if(_0x3b494c>=_0x8383c){_0x3b494c=_0x8383c;_0x529caf=0xc8;}else{_0x529caf=0xce;}_0x4cf7ed['status'](_0x529caf);return _0x4cf7ed[_0x74aa('0x11')](_0x74aa('0x12'),_0x250f2a+'-'+_0x3b494c+'/'+_0x8383c)[_0x74aa('0xc')](_0x2bab01);}return null;};}function saveUpdates(_0x289e2d){return function(_0x18cb75){if(_0x18cb75){return _0x18cb75[_0x74aa('0x13')](_0x289e2d)['then'](function(_0x5824a7){return _0x5824a7;});}return null;};}function removeEntity(_0x372bb5){return function(_0x33f093){if(_0x33f093){return _0x33f093[_0x74aa('0x14')]()[_0x74aa('0x15')](function(){_0x372bb5[_0x74aa('0xb')](0xcc)[_0x74aa('0x16')]();});}};}function handleEntityNotFound(_0x2397be){return function(_0x5a843b){if(!_0x5a843b){_0x2397be['sendStatus'](0x194);}return _0x5a843b;};}function handleError(_0x53f4f9,_0x2d482b){_0x2d482b=_0x2d482b||0x1f4;return function(_0x279de4){logger[_0x74aa('0x17')](_0x279de4['stack']);if(_0x279de4[_0x74aa('0x18')]){delete _0x279de4[_0x74aa('0x18')];}_0x53f4f9[_0x74aa('0xb')](_0x2d482b)['send'](_0x279de4);};}function maskClientSecret(_0x48531d){return _[_0x74aa('0x19')](_0x48531d['slice'](0x0,0x3),0x14,'*');}exports[_0x74aa('0x1a')]=function(_0x2fd866,_0x4fdcdc){var _0x3b85d4={},_0x474b5f={},_0xadc2c6={'count':0x0,'rows':[]};var _0x156036=_[_0x74aa('0x1b')](db[_0x74aa('0x1c')]['rawAttributes'],function(_0x451b97){return{'name':_0x451b97[_0x74aa('0x1d')],'type':_0x451b97[_0x74aa('0x1e')][_0x74aa('0x1f')]};});_0x474b5f[_0x74aa('0x20')]=_[_0x74aa('0x1b')](_0x156036,'name');_0x474b5f[_0x74aa('0x21')]=_[_0x74aa('0x22')](_0x2fd866['query']);_0x474b5f['filters']=_['intersection'](_0x474b5f[_0x74aa('0x20')],_0x474b5f[_0x74aa('0x21')]);_0x3b85d4['attributes']=_['intersection'](_0x474b5f[_0x74aa('0x20')],qs['fields'](_0x2fd866[_0x74aa('0x21')]['fields']));_0x3b85d4[_0x74aa('0x23')]=_0x3b85d4['attributes']['length']?_0x3b85d4[_0x74aa('0x23')]:_0x474b5f['model'];if(!_0x2fd866['query']['hasOwnProperty'](_0x74aa('0x24'))){_0x3b85d4[_0x74aa('0xf')]=qs[_0x74aa('0xf')](_0x2fd866[_0x74aa('0x21')][_0x74aa('0xf')]);_0x3b85d4[_0x74aa('0xd')]=qs[_0x74aa('0xd')](_0x2fd866[_0x74aa('0x21')]['offset']);}_0x3b85d4[_0x74aa('0x25')]=qs[_0x74aa('0x26')](_0x2fd866[_0x74aa('0x21')]['sort']);_0x3b85d4[_0x74aa('0x27')]=qs['filters'](_['pick'](_0x2fd866[_0x74aa('0x21')],_0x474b5f[_0x74aa('0x28')]),_0x156036);if(_0x2fd866[_0x74aa('0x21')]['filter']){_0x3b85d4[_0x74aa('0x27')]=_[_0x74aa('0x29')](_0x3b85d4[_0x74aa('0x27')],{'$or':_[_0x74aa('0x1b')](_0x156036,function(_0x40917b){if(_0x40917b[_0x74aa('0x1e')]!=='VIRTUAL'){var _0x44d1ab={};_0x44d1ab[_0x40917b['name']]={'$like':'%'+_0x2fd866[_0x74aa('0x21')]['filter']+'%'};return _0x44d1ab;}})});}_0x3b85d4=_[_0x74aa('0x29')]({},_0x3b85d4,_0x2fd866[_0x74aa('0x2a')]);var _0x10827f={'where':_0x3b85d4[_0x74aa('0x27')]};return db['CloudProvider']['count'](_0x10827f)[_0x74aa('0x15')](function(_0x24bd3f){_0xadc2c6[_0x74aa('0x10')]=_0x24bd3f;if(_0x2fd866[_0x74aa('0x21')][_0x74aa('0x2b')]){_0x3b85d4['include']=[{'all':!![]}];}return db['CloudProvider'][_0x74aa('0x2c')](_0x3b85d4);})[_0x74aa('0x15')](function(_0x44380d){_0xadc2c6['rows']=_['map'](_0x44380d,function(_0xf4d756){if(_0xf4d756[_0x74aa('0x2d')]==='MicrosoftAzure'){var _0x554fcc=encryptor['decryptString'](_0xf4d756['data3']);_0xf4d756[_0x74aa('0x2e')]=maskClientSecret(_0x554fcc);}return _0xf4d756;});return _0xadc2c6;})[_0x74aa('0x15')](respondWithFilteredResult(_0x4fdcdc,_0x3b85d4))[_0x74aa('0x2f')](handleError(_0x4fdcdc,null));};exports[_0x74aa('0x30')]=function(_0x54a63b,_0x2e5aa8){var _0x3acada={'raw':!![],'where':{'id':_0x54a63b[_0x74aa('0x31')]['id']}},_0x53f249={};_0x53f249[_0x74aa('0x20')]=_[_0x74aa('0x22')](db[_0x74aa('0x1c')]['rawAttributes']);_0x53f249[_0x74aa('0x21')]=_[_0x74aa('0x22')](_0x54a63b[_0x74aa('0x21')]);_0x53f249['filters']=_[_0x74aa('0x32')](_0x53f249[_0x74aa('0x20')],_0x53f249[_0x74aa('0x21')]);_0x3acada[_0x74aa('0x23')]=_[_0x74aa('0x32')](_0x53f249['model'],qs[_0x74aa('0x33')](_0x54a63b['query'][_0x74aa('0x33')]));_0x3acada['attributes']=_0x3acada[_0x74aa('0x23')][_0x74aa('0x34')]?_0x3acada[_0x74aa('0x23')]:_0x53f249['model'];if(_0x54a63b[_0x74aa('0x21')][_0x74aa('0x2b')]){_0x3acada[_0x74aa('0x35')]=[{'all':!![]}];}_0x3acada=_[_0x74aa('0x29')]({},_0x3acada,_0x54a63b[_0x74aa('0x2a')]);return db[_0x74aa('0x1c')][_0x74aa('0x36')](_0x3acada)[_0x74aa('0x15')](handleEntityNotFound(_0x2e5aa8,null))['then'](function(_0xe3d5b3){if(_0xe3d5b3[_0x74aa('0x2d')]===_0x74aa('0x37')){var _0x1cbcc8=encryptor['decryptString'](_0xe3d5b3['data3']);_0xe3d5b3[_0x74aa('0x2e')]=maskClientSecret(_0x1cbcc8);}return _0xe3d5b3;})[_0x74aa('0x15')](respondWithResult(_0x2e5aa8,null))[_0x74aa('0x2f')](handleError(_0x2e5aa8,null));};exports[_0x74aa('0x38')]=function(_0x5b6223,_0x3a48a0){if(!_0x5b6223['body'][_0x74aa('0x18')])throw new Error(_0x74aa('0x39'));if(!_0x5b6223['body'][_0x74aa('0x2d')])throw new Error(_0x74aa('0x3a'));var _0x5c9661=db[_0x74aa('0x1c')][_0x74aa('0x3b')][_0x74aa('0x2d')][_0x74aa('0x3c')];if(!_0x5c9661[_0x74aa('0x3d')](_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2d')]))throw new Error(_0x74aa('0x3f')+_0x5c9661[_0x74aa('0x40')](',\x20'));if(_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2d')]==='MicrosoftAzure'&&_0x5b6223[_0x74aa('0x3e')][_0x74aa('0x2e')]){_0x5b6223[_0x74aa('0x3e')]['data3']=encryptor[_0x74aa('0x41')](_0x5b6223[_0x74aa('0x3e')]['data3']);}return db['CloudProvider'][_0x74aa('0x38')](_0x5b6223['body'],{})[_0x74aa('0x15')](respondWithResult(_0x3a48a0,0xc9))[_0x74aa('0x2f')](handleError(_0x3a48a0,null));};exports[_0x74aa('0x13')]=function(_0x19ba21,_0x1323c9){if(_0x19ba21[_0x74aa('0x3e')]['id']){delete _0x19ba21['body']['id'];}return db['CloudProvider'][_0x74aa('0x36')]({'where':{'id':_0x19ba21[_0x74aa('0x31')]['id']}})[_0x74aa('0x15')](handleEntityNotFound(_0x1323c9,null))[_0x74aa('0x15')](function(_0x1142fd){if(_0x1142fd[_0x74aa('0x2d')]===_0x74aa('0x37')&&_0x19ba21[_0x74aa('0x3e')]['data3']){_0x19ba21[_0x74aa('0x3e')][_0x74aa('0x2e')]=encryptor['encryptString'](_0x19ba21[_0x74aa('0x3e')][_0x74aa('0x2e')]);}return _0x1142fd;})[_0x74aa('0x15')](saveUpdates(_0x19ba21[_0x74aa('0x3e')],null))[_0x74aa('0x15')](respondWithResult(_0x1323c9,null))[_0x74aa('0x2f')](handleError(_0x1323c9,null));};exports['destroy']=function(_0x26a9d2,_0x566c0e){return db['CloudProvider'][_0x74aa('0x36')]({'where':{'id':_0x26a9d2[_0x74aa('0x31')]['id']}})[_0x74aa('0x15')](handleEntityNotFound(_0x566c0e,null))[_0x74aa('0x15')](removeEntity(_0x566c0e,null))[_0x74aa('0x2f')](handleError(_0x566c0e,null));};exports[_0x74aa('0x42')]=function(_0x17338b,_0x1f665c){return db[_0x74aa('0x1c')]['findOne']({'where':{'id':_0x17338b[_0x74aa('0x31')]['id']},'raw':!![]})[_0x74aa('0x15')](function(_0x1cdaf7){if(!_0x1cdaf7)return _0x1f665c[_0x74aa('0xa')](0x194);return{'url':oauth[_0x74aa('0x43')](_0x1cdaf7,_0x17338b[_0x74aa('0x44')]['id'])};})['then'](respondWithResult(_0x1f665c,null))[_0x74aa('0x2f')](handleError(_0x1f665c,null));};exports[_0x74aa('0x45')]=function(_0x26599d,_0x206c09){var _0x3c453d=_0x26599d['body'];var _0x4cc8ef;var _0x2c08be;if(_0x3c453d[_0x74aa('0x17')])throw _0x3c453d;redis[_0x74aa('0x46')](_0x3c453d[_0x74aa('0x47')])[_0x74aa('0x15')](function(_0x22b26b){if(!_0x22b26b)throw new Error('Invalid\x20state\x20parameter');_0x4cc8ef=JSON[_0x74aa('0x48')](_0x22b26b);var _0x338ff3=Buffer['from'](_0x3c453d[_0x74aa('0x47')],_0x74aa('0x49'))[_0x74aa('0x4a')](_0x74aa('0x4b'));_0x2c08be=JSON[_0x74aa('0x48')](_0x338ff3);if(!oauth[_0x74aa('0x4c')](_0x3c453d[_0x74aa('0x4d')],_0x4cc8ef[_0x74aa('0x4e')]))throw new Error(_0x74aa('0x4f'));redis[_0x74aa('0x50')](_0x3c453d[_0x74aa('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3c453d[_0x74aa('0x51')],_0x4cc8ef);})[_0x74aa('0x15')](function(_0x13a630){_0x4cc8ef[_0x74aa('0x52')]=_0x13a630[_0x74aa('0x53')];_0x4cc8ef[_0x74aa('0x54')]=_0x13a630[_0x74aa('0x55')];return db[_0x74aa('0x1c')]['update']({'data5':_0x4cc8ef['data5'],'data6':_0x4cc8ef[_0x74aa('0x54')]},{'where':{'id':_0x4cc8ef['id']}});})[_0x74aa('0x15')](function(){oauth[_0x74aa('0x56')](_0x4cc8ef);socket['emit']('microsoftAuthorization:success',{'id':_0x2c08be['id']});return;})['then'](respondWithStatusCode(_0x206c09,null))['catch'](function(_0x30d628){if(_0x2c08be){socket[_0x74aa('0x57')](_0x74aa('0x58'),{'id':_0x2c08be['id']});}if(!_0x4cc8ef){logger[_0x74aa('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x30d628);return _0x206c09[_0x74aa('0xb')](0x1f4)[_0x74aa('0x59')](_0x30d628[_0x74aa('0x5a')]);}logger['error'](_0x74aa('0x5b'),_0x4cc8ef['id'],JSON[_0x74aa('0x5c')](_0x30d628));});}; \ No newline at end of file +var _0x06a6=['access_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','undefined','offset','count','set','update','then','destroy','error','stack','name','send','padEnd','slice','map','CloudProvider','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','where','merge','VIRTUAL','filter','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','length','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','from','base64','toString','ascii','parse','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5'];(function(_0x3302fe,_0x158512){var _0x1e2248=function(_0xfa3b78){while(--_0xfa3b78){_0x3302fe['push'](_0x3302fe['shift']());}};_0x1e2248(++_0x158512);}(_0x06a6,0x1ca));var _0x606a=function(_0x5add8e,_0x4372f6){_0x5add8e=_0x5add8e-0x0;var _0x285479=_0x06a6[_0x5add8e];return _0x285479;};'use strict';var _=require(_0x606a('0x0'));var Redis=require(_0x606a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x606a('0x2'));var config=require(_0x606a('0x3'));var logger=require(_0x606a('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x606a('0x5'));config[_0x606a('0x6')]=_[_0x606a('0x7')](config[_0x606a('0x6')],{'host':_0x606a('0x8'),'port':0x18eb});var socket=require(_0x606a('0x9'))(new Redis(config[_0x606a('0x6')]));var redis=new Redis(config[_0x606a('0x6')]);function respondWithStatusCode(_0x533d5f,_0x9a1631){_0x9a1631=_0x9a1631||0xcc;return function(_0x32ab82){if(_0x32ab82){return _0x533d5f[_0x606a('0xa')](_0x9a1631);}return _0x533d5f['status'](_0x9a1631)[_0x606a('0xb')]();};}function respondWithResult(_0x17484,_0x455904){_0x455904=_0x455904||0xc8;return function(_0x4239a4){if(_0x4239a4){return _0x17484[_0x606a('0xc')](_0x455904)[_0x606a('0xd')](_0x4239a4);}};}function respondWithFilteredResult(_0x57b2ce,_0x58892d){return function(_0xf63f6b){if(_0xf63f6b){var _0xec7707=typeof _0x58892d['offset']===_0x606a('0xe')&&typeof _0x58892d['limit']===_0x606a('0xe');var _0x483d4f=_0xf63f6b['count'];var _0x144454=_0xec7707?0x0:_0x58892d[_0x606a('0xf')];var _0x102187=_0xec7707?_0xf63f6b[_0x606a('0x10')]:_0x58892d[_0x606a('0xf')]+_0x58892d['limit'];var _0x56fe76;if(_0x102187>=_0x483d4f){_0x102187=_0x483d4f;_0x56fe76=0xc8;}else{_0x56fe76=0xce;}_0x57b2ce[_0x606a('0xc')](_0x56fe76);return _0x57b2ce[_0x606a('0x11')]('Content-Range',_0x144454+'-'+_0x102187+'/'+_0x483d4f)[_0x606a('0xd')](_0xf63f6b);}return null;};}function saveUpdates(_0x3a851f){return function(_0x244e23){if(_0x244e23){return _0x244e23[_0x606a('0x12')](_0x3a851f)[_0x606a('0x13')](function(_0x2205e3){return _0x2205e3;});}return null;};}function removeEntity(_0x4f1fa6){return function(_0x80a5e8){if(_0x80a5e8){return _0x80a5e8[_0x606a('0x14')]()[_0x606a('0x13')](function(){_0x4f1fa6[_0x606a('0xc')](0xcc)[_0x606a('0xb')]();});}};}function handleEntityNotFound(_0x46d808){return function(_0x55ff42){if(!_0x55ff42){_0x46d808[_0x606a('0xa')](0x194);}return _0x55ff42;};}function handleError(_0x544abf,_0x5c4089){_0x5c4089=_0x5c4089||0x1f4;return function(_0x322919){logger[_0x606a('0x15')](_0x322919[_0x606a('0x16')]);if(_0x322919[_0x606a('0x17')]){delete _0x322919['name'];}_0x544abf[_0x606a('0xc')](_0x5c4089)[_0x606a('0x18')](_0x322919);};}function maskClientSecret(_0x2aed2d){return _[_0x606a('0x19')](_0x2aed2d[_0x606a('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0xafd4bb,_0x582d4d){var _0x5e36fd={},_0xace308={},_0x16b528={'count':0x0,'rows':[]};var _0x53c34e=_[_0x606a('0x1b')](db[_0x606a('0x1c')][_0x606a('0x1d')],function(_0x5bc441){return{'name':_0x5bc441['fieldName'],'type':_0x5bc441[_0x606a('0x1e')]['key']};});_0xace308['model']=_[_0x606a('0x1b')](_0x53c34e,_0x606a('0x17'));_0xace308[_0x606a('0x1f')]=_[_0x606a('0x20')](_0xafd4bb[_0x606a('0x1f')]);_0xace308[_0x606a('0x21')]=_['intersection'](_0xace308[_0x606a('0x22')],_0xace308[_0x606a('0x1f')]);_0x5e36fd[_0x606a('0x23')]=_[_0x606a('0x24')](_0xace308[_0x606a('0x22')],qs[_0x606a('0x25')](_0xafd4bb[_0x606a('0x1f')]['fields']));_0x5e36fd[_0x606a('0x23')]=_0x5e36fd['attributes']['length']?_0x5e36fd[_0x606a('0x23')]:_0xace308['model'];if(!_0xafd4bb[_0x606a('0x1f')][_0x606a('0x26')](_0x606a('0x27'))){_0x5e36fd['limit']=qs[_0x606a('0x28')](_0xafd4bb[_0x606a('0x1f')][_0x606a('0x28')]);_0x5e36fd['offset']=qs[_0x606a('0xf')](_0xafd4bb[_0x606a('0x1f')][_0x606a('0xf')]);}_0x5e36fd['order']=qs['sort'](_0xafd4bb[_0x606a('0x1f')]['sort']);_0x5e36fd['where']=qs[_0x606a('0x21')](_['pick'](_0xafd4bb[_0x606a('0x1f')],_0xace308[_0x606a('0x21')]),_0x53c34e);if(_0xafd4bb[_0x606a('0x1f')]['filter']){_0x5e36fd[_0x606a('0x29')]=_[_0x606a('0x2a')](_0x5e36fd[_0x606a('0x29')],{'$or':_[_0x606a('0x1b')](_0x53c34e,function(_0x12355e){if(_0x12355e[_0x606a('0x1e')]!==_0x606a('0x2b')){var _0x408248={};_0x408248[_0x12355e[_0x606a('0x17')]]={'$like':'%'+_0xafd4bb[_0x606a('0x1f')][_0x606a('0x2c')]+'%'};return _0x408248;}})});}_0x5e36fd=_['merge']({},_0x5e36fd,_0xafd4bb[_0x606a('0x2d')]);var _0x546cfb={'where':_0x5e36fd[_0x606a('0x29')]};return db[_0x606a('0x1c')][_0x606a('0x10')](_0x546cfb)['then'](function(_0x2ebc6f){_0x16b528['count']=_0x2ebc6f;if(_0xafd4bb['query'][_0x606a('0x2e')]){_0x5e36fd[_0x606a('0x2f')]=[{'all':!![]}];}return db[_0x606a('0x1c')]['findAll'](_0x5e36fd);})[_0x606a('0x13')](function(_0x5410bb){_0x16b528[_0x606a('0x30')]=_[_0x606a('0x1b')](_0x5410bb,function(_0x6ed2b8){if(_0x6ed2b8[_0x606a('0x31')]===_0x606a('0x32')){var _0x1079b6=encryptor[_0x606a('0x33')](_0x6ed2b8[_0x606a('0x34')]);_0x6ed2b8[_0x606a('0x34')]=maskClientSecret(_0x1079b6);}return _0x6ed2b8;});return _0x16b528;})[_0x606a('0x13')](respondWithFilteredResult(_0x582d4d,_0x5e36fd))[_0x606a('0x35')](handleError(_0x582d4d,null));};exports[_0x606a('0x36')]=function(_0x141f77,_0x54da13){var _0x209d4e={'raw':!![],'where':{'id':_0x141f77[_0x606a('0x37')]['id']}},_0x2eed61={};_0x2eed61['model']=_[_0x606a('0x20')](db[_0x606a('0x1c')][_0x606a('0x1d')]);_0x2eed61['query']=_[_0x606a('0x20')](_0x141f77[_0x606a('0x1f')]);_0x2eed61[_0x606a('0x21')]=_['intersection'](_0x2eed61['model'],_0x2eed61[_0x606a('0x1f')]);_0x209d4e['attributes']=_['intersection'](_0x2eed61['model'],qs[_0x606a('0x25')](_0x141f77[_0x606a('0x1f')]['fields']));_0x209d4e['attributes']=_0x209d4e[_0x606a('0x23')][_0x606a('0x38')]?_0x209d4e[_0x606a('0x23')]:_0x2eed61[_0x606a('0x22')];if(_0x141f77[_0x606a('0x1f')]['includeAll']){_0x209d4e[_0x606a('0x2f')]=[{'all':!![]}];}_0x209d4e=_[_0x606a('0x2a')]({},_0x209d4e,_0x141f77['options']);return db[_0x606a('0x1c')]['find'](_0x209d4e)['then'](handleEntityNotFound(_0x54da13,null))[_0x606a('0x13')](function(_0x1b8068){if(_0x1b8068[_0x606a('0x31')]===_0x606a('0x32')){var _0x1ecbf0=encryptor[_0x606a('0x33')](_0x1b8068['data3']);_0x1b8068[_0x606a('0x34')]=maskClientSecret(_0x1ecbf0);}return _0x1b8068;})[_0x606a('0x13')](respondWithResult(_0x54da13,null))['catch'](handleError(_0x54da13,null));};exports[_0x606a('0x39')]=function(_0x266ce9,_0x50cb3c){if(!_0x266ce9['body'][_0x606a('0x17')])throw new Error(_0x606a('0x3a'));if(!_0x266ce9[_0x606a('0x3b')][_0x606a('0x31')])throw new Error(_0x606a('0x3c'));var _0x486d76=db[_0x606a('0x1c')]['rawAttributes'][_0x606a('0x31')][_0x606a('0x3d')];if(!_0x486d76[_0x606a('0x3e')](_0x266ce9[_0x606a('0x3b')][_0x606a('0x31')]))throw new Error(_0x606a('0x3f')+_0x486d76['join'](',\x20'));if(_0x266ce9[_0x606a('0x3b')][_0x606a('0x31')]==='MicrosoftAzure'&&_0x266ce9['body'][_0x606a('0x34')]){_0x266ce9[_0x606a('0x3b')][_0x606a('0x34')]=encryptor[_0x606a('0x40')](_0x266ce9[_0x606a('0x3b')]['data3']);}return db[_0x606a('0x1c')]['create'](_0x266ce9['body'],{})[_0x606a('0x13')](respondWithResult(_0x50cb3c,0xc9))[_0x606a('0x35')](handleError(_0x50cb3c,null));};exports['update']=function(_0x310015,_0x50770b){if(_0x310015[_0x606a('0x3b')]['id']){delete _0x310015[_0x606a('0x3b')]['id'];}return db[_0x606a('0x1c')][_0x606a('0x41')]({'where':{'id':_0x310015['params']['id']}})[_0x606a('0x13')](handleEntityNotFound(_0x50770b,null))[_0x606a('0x13')](function(_0x10c647){if(_0x10c647[_0x606a('0x31')]===_0x606a('0x32')&&_0x310015['body'][_0x606a('0x34')]){_0x310015['body'][_0x606a('0x34')]=encryptor[_0x606a('0x40')](_0x310015[_0x606a('0x3b')][_0x606a('0x34')]);}return _0x10c647;})[_0x606a('0x13')](saveUpdates(_0x310015[_0x606a('0x3b')],null))['then'](respondWithResult(_0x50770b,null))['catch'](handleError(_0x50770b,null));};exports[_0x606a('0x14')]=function(_0x2bd0bd,_0x195e52){return db[_0x606a('0x1c')]['find']({'where':{'id':_0x2bd0bd[_0x606a('0x37')]['id']}})[_0x606a('0x13')](handleEntityNotFound(_0x195e52,null))[_0x606a('0x13')](removeEntity(_0x195e52,null))[_0x606a('0x35')](handleError(_0x195e52,null));};exports[_0x606a('0x42')]=function(_0x2c7bb9,_0x20b44c){return db['CloudProvider'][_0x606a('0x43')]({'where':{'id':_0x2c7bb9[_0x606a('0x37')]['id']},'raw':!![]})[_0x606a('0x13')](function(_0x18bff5){if(!_0x18bff5)return _0x20b44c[_0x606a('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x18bff5,_0x2c7bb9['user']['id'])};})[_0x606a('0x13')](respondWithResult(_0x20b44c,null))['catch'](handleError(_0x20b44c,null));};exports[_0x606a('0x44')]=function(_0x476d2b,_0x489b22){var _0x1b62e3=_0x476d2b[_0x606a('0x3b')];var _0x3bac45;var _0x537f2f;if(_0x1b62e3[_0x606a('0x15')])throw _0x1b62e3;redis[_0x606a('0x45')](_0x1b62e3[_0x606a('0x46')])['then'](function(_0x400129){if(!_0x400129)throw new Error('Invalid\x20state\x20parameter');_0x3bac45=JSON['parse'](_0x400129);var _0x1b3707=Buffer[_0x606a('0x47')](_0x1b62e3[_0x606a('0x46')],_0x606a('0x48'))[_0x606a('0x49')](_0x606a('0x4a'));_0x537f2f=JSON[_0x606a('0x4b')](_0x1b3707);if(!oauth[_0x606a('0x4c')](_0x1b62e3['id_token'],_0x3bac45[_0x606a('0x4d')]))throw new Error(_0x606a('0x4e'));redis[_0x606a('0x4f')](_0x1b62e3[_0x606a('0x46')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1b62e3[_0x606a('0x50')],_0x3bac45);})[_0x606a('0x13')](function(_0x1752db){_0x3bac45[_0x606a('0x51')]=_0x1752db[_0x606a('0x52')];_0x3bac45[_0x606a('0x53')]=_0x1752db['refresh_token'];return db[_0x606a('0x1c')][_0x606a('0x12')]({'data5':_0x3bac45[_0x606a('0x51')],'data6':_0x3bac45[_0x606a('0x53')]},{'where':{'id':_0x3bac45['id']}});})[_0x606a('0x13')](function(){oauth[_0x606a('0x54')](_0x3bac45);socket['emit']('microsoftAuthorization:success',{'id':_0x537f2f['id']});return;})[_0x606a('0x13')](respondWithStatusCode(_0x489b22,null))[_0x606a('0x35')](function(_0x551dbd){if(_0x537f2f){socket[_0x606a('0x55')](_0x606a('0x56'),{'id':_0x537f2f['id']});}if(!_0x3bac45){logger[_0x606a('0x15')](_0x606a('0x57'),_0x551dbd);return _0x489b22[_0x606a('0xc')](0x1f4)['send'](_0x551dbd['message']);}logger[_0x606a('0x15')](_0x606a('0x58'),_0x3bac45['id'],JSON[_0x606a('0x59')](_0x551dbd));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e9f9299..d52f22c 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 _0x72c5=['cloud_providers','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x3890b5,_0x2092ef){var _0x5836cd=function(_0xcef6c1){while(--_0xcef6c1){_0x3890b5['push'](_0x3890b5['shift']());}};_0x5836cd(++_0x2092ef);}(_0x72c5,0xde));var _0x572c=function(_0x2d69a4,_0x32935e){_0x2d69a4=_0x2d69a4-0x0;var _0xe0705b=_0x72c5[_0x2d69a4];return _0xe0705b;};'use strict';var _=require(_0x572c('0x0'));var util=require('util');var logger=require(_0x572c('0x1'))(_0x572c('0x2'));var moment=require(_0x572c('0x3'));var BPromise=require('bluebird');var rp=require(_0x572c('0x4'));var fs=require('fs');var path=require(_0x572c('0x5'));var rimraf=require(_0x572c('0x6'));var config=require(_0x572c('0x7'));var attributes=require(_0x572c('0x8'));module[_0x572c('0x9')]=function(_0x1b0b7f,_0x4287cd){return _0x1b0b7f[_0x572c('0xa')](_0x572c('0xb'),attributes,{'tableName':_0x572c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa7f=['moment','request-promise','rimraf','define','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xfa7f,0x136));var _0xffa7=function(_0x4bd13b,_0x157a13){_0x4bd13b=_0x4bd13b-0x0;var _0x5d1e33=_0xfa7f[_0x4bd13b];return _0x5d1e33;};'use strict';var _=require('lodash');var util=require(_0xffa7('0x0'));var logger=require(_0xffa7('0x1'))('api');var moment=require(_0xffa7('0x2'));var BPromise=require('bluebird');var rp=require(_0xffa7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa7('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x7648f6,_0x54f951){return _0x7648f6[_0xffa7('0x5')](_0xffa7('0x6'),attributes,{'tableName':_0xffa7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index cab8a85..61120da 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1071=['payload','iss','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','Dynamics365','push','data7','join','type','Outlook365','/.default','replace','{TENANT_ID}','data2','code','id_token','from','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','login','map','key','value','oauth2Claims','oauth2/','set','stringify','decode'];(function(_0x4066d1,_0xddaabe){var _0x4d38cd=function(_0x41f589){while(--_0x41f589){_0x4066d1['push'](_0x4066d1['shift']());}};_0x4d38cd(++_0xddaabe);}(_0x1071,0x1bf));var _0x1107=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1071[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1107('0x0'));var crypto=require(_0x1107('0x1'));var jwt=require(_0x1107('0x2'));var moment=require(_0x1107('0x3'));var Redis=require(_0x1107('0x4'));var rp=require(_0x1107('0x5'));var util=require('util');var encryptor=require(_0x1107('0x6'));var config=require(_0x1107('0x7'));var logger=require(_0x1107('0x8'))('api');var schedule=require(_0x1107('0x9'));var db=require(_0x1107('0xa'))['db'];config[_0x1107('0xb')]=_[_0x1107('0xc')](config[_0x1107('0xb')],{'host':_0x1107('0xd'),'port':0x18eb});var redis=new Redis(config[_0x1107('0xb')]);var MICROSOFT_AUTH_URL=_0x1107('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0x1107('0xf'),_0x1107('0x10'),_0x1107('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x1107('0x12')],'Dynamics365':[_0x1107('0x13'),_0x1107('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x1107('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x1107('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x270111){var _0xe79d24=_['map'](AZURE_AUTH_SCOPES[_0x270111['type']]);if(_0x270111['type']===_0x1107('0x16'))_0xe79d24[_0x1107('0x17')](_0x270111[_0x1107('0x18')]+'/.default');return _0xe79d24[_0x1107('0x19')]('\x20');}function getAccessTokenScope(_0x505aab){if(_0x505aab[_0x1107('0x1a')]===_0x1107('0x1b'))return _0x1107('0x11');if(_0x505aab[_0x1107('0x1a')]===_0x1107('0x16'))return _0x505aab[_0x1107('0x18')]+_0x1107('0x1c');}function generateMicrosoftAuthorizationUrl(_0xb681a,_0x39556a){var _0x2003cd=MICROSOFT_AUTH_URL[_0x1107('0x1d')](_0x1107('0x1e'),_0xb681a[_0x1107('0x1f')]);var _0x5db5ed=[_0x1107('0x20'),_0x1107('0x21')];var _0x1cc553=Buffer[_0x1107('0x22')](JSON['stringify']({'id':_0x39556a}))['toString'](_0x1107('0x23'));var _0x3d2e20=crypto[_0x1107('0x24')](0x10)[_0x1107('0x25')](_0x1107('0x26'));var _0x387a54=getAuthorizationScopes(_0xb681a);var _0x4aa4bf=[{'key':_0x1107('0x27'),'value':_0xb681a[_0x1107('0x28')]},{'key':_0x1107('0x29'),'value':encodeURIComponent(_0x5db5ed[_0x1107('0x19')]('\x20'))},{'key':_0x1107('0x2a'),'value':_0xb681a['data4']},{'key':_0x1107('0x2b'),'value':_0x1107('0x2c')},{'key':_0x1107('0x2d'),'value':encodeURIComponent(_0x387a54)},{'key':_0x1107('0x2e'),'value':_0x1cc553},{'key':_0x1107('0x2f'),'value':_0x3d2e20},{'key':'prompt','value':_0x1107('0x30')}];var _0x175eab=_0x2003cd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1107('0x31')](_0x4aa4bf,function(_0x2166e5){return _0x2166e5[_0x1107('0x32')]+'='+_0x2166e5[_0x1107('0x33')];})[_0x1107('0x19')]('&');_0xb681a[_0x1107('0x34')]={'issuer':_0x2003cd[_0x1107('0x1d')](_0x1107('0x35'),''),'audience':_0xb681a['data1'],'state':_0x1cc553,'nonce':_0x3d2e20};redis[_0x1107('0x36')](_0x1cc553,JSON[_0x1107('0x37')](_0xb681a));return _0x175eab;}function isValidIdToken(_0x4d0db0,_0x226d7d){try{var _0x365bd1=jwt[_0x1107('0x38')](_0x4d0db0,{'complete':!![]});var _0x1efe62=_0x365bd1[_0x1107('0x39')];if(_0x1efe62[_0x1107('0x3a')]!==_0x226d7d['issuer'])return![];if(_0x1efe62['aud']!==_0x226d7d[_0x1107('0x3b')])return![];if(_0x1efe62[_0x1107('0x2f')]!==_0x226d7d[_0x1107('0x2f')])return![];if(moment()[_0x1107('0x3c')](moment[_0x1107('0x3d')](_0x1efe62['exp'])))return![];return!![];}catch(_0x29f355){throw _0x29f355;}}function refreshOauth2MicrosoftAccessToken(_0x200f7c){return Promise[_0x1107('0x3e')]()[_0x1107('0x3f')](function(){if(_0x200f7c[_0x1107('0x40')])return _0x200f7c;return db[_0x1107('0x41')][_0x1107('0x42')]({'where':{'id':_0x200f7c['id']},'raw':!![]});})[_0x1107('0x3f')](function(_0xdbb40e){var _0x3955af={'grant_type':_0x1107('0x43'),'refresh_token':_0xdbb40e[_0x1107('0x44')],'scope':getAccessTokenScope(_0xdbb40e),'redirect_uri':_0xdbb40e['data4'],'client_id':_0xdbb40e[_0x1107('0x28')],'client_secret':encryptor[_0x1107('0x45')](_0xdbb40e[_0x1107('0x40')])};var _0x511fe4={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x1107('0x1e'),_0xdbb40e[_0x1107('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3955af,'json':!![]};return rp(_0x511fe4);})[_0x1107('0x3f')](function(_0x32f163){_0x200f7c['data5']=_0x32f163[_0x1107('0x46')];_0x200f7c[_0x1107('0x44')]=_0x32f163[_0x1107('0x43')];return db['CloudProvider'][_0x1107('0x47')]({'data5':_0x200f7c['data5'],'data6':_0x200f7c[_0x1107('0x44')]},{'where':{'id':_0x200f7c['id']}});})[_0x1107('0x3f')](function(){return _0x200f7c;})[_0x1107('0x48')](function(_0x14c12e){logger[_0x1107('0x49')](_0x1107('0x4a'),_0x200f7c['id'],_0x14c12e);});}function getOauth2MicrosoftAccessToken(_0x4f42be,_0x32fd90){var _0xf74519={'grant_type':_0x1107('0x4b'),'code':_0x4f42be,'scope':getAccessTokenScope(_0x32fd90),'redirect_uri':_0x32fd90['data4'],'client_id':_0x32fd90[_0x1107('0x28')],'client_secret':encryptor[_0x1107('0x45')](_0x32fd90[_0x1107('0x40')])};var _0x2dfe10={'method':_0x1107('0x4c'),'uri':MICROSOFT_AUTH_URL[_0x1107('0x1d')](_0x1107('0x1e'),_0x32fd90[_0x1107('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf74519,'json':!![]};return rp(_0x2dfe10);}function startRefreshInterval(_0xb9c36d){var _0x485e25=schedule[_0x1107('0x4d')];if(_0x485e25[_0xb9c36d['id']])clearInterval(_0x485e25[_0xb9c36d['id']]);_0x485e25[_0xb9c36d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1107('0x4e')](this,{'id':_0xb9c36d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x485e25;}function startAllRefreshIntervals(){return db[_0x1107('0x41')][_0x1107('0x4f')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1107('0x3f')](function(_0x67ec11){var _0x5d1834=_0x67ec11[_0x1107('0x31')](function(_0xdc5a60){return refreshOauth2MicrosoftAccessToken(_0xdc5a60)['then'](function(_0x28a157){startRefreshInterval(_0x28a157);});});return Promise[_0x1107('0x50')](_0x5d1834);})[_0x1107('0x48')](function(_0x22d80a){var _0x3e6a64=_0x22d80a?util[_0x1107('0x51')](_0x22d80a,{'showHidden':![],'depth':null}):'';logger[_0x1107('0x49')](_0x1107('0x52'),_0x3e6a64);});}module[_0x1107('0x53')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf1de=['request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','replace','{TENANT_ID}','data2','code','id_token','from','randomBytes','toString','hex','client_id','data1','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','join','oauth2Claims','oauth2/','set','decode','payload','issuer','aud','unix','exp','resolve','then','findOne','data6','decryptString','POST','data5','access_token','refresh_token','CloudProvider','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','bind','intervals','inspect','error','lodash','jsonwebtoken','moment','ioredis'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xf1de,0x1ca));var _0xef1d=function(_0x150715,_0x1f1d09){_0x150715=_0x150715-0x0;var _0x152535=_0xf1de[_0x150715];return _0x152535;};'use strict';var _=require(_0xef1d('0x0'));var crypto=require('crypto');var jwt=require(_0xef1d('0x1'));var moment=require(_0xef1d('0x2'));var Redis=require(_0xef1d('0x3'));var rp=require(_0xef1d('0x4'));var util=require(_0xef1d('0x5'));var encryptor=require(_0xef1d('0x6'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xef1d('0x7'));var schedule=require(_0xef1d('0x8'));var db=require('../../mysqldb')['db'];config[_0xef1d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xef1d('0x9')]);var MICROSOFT_AUTH_URL=_0xef1d('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0xef1d('0xb'),'profile',_0xef1d('0xc'),_0xef1d('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xef1d('0xe'),_0xef1d('0xf')],'Dynamics365':[_0xef1d('0xb'),_0xef1d('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0xef1d('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0xef1d('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x8fa5d8){var _0x39ae1a=_[_0xef1d('0x12')](AZURE_AUTH_SCOPES[_0x8fa5d8[_0xef1d('0x13')]]);if(_0x8fa5d8['type']===_0xef1d('0x14'))_0x39ae1a[_0xef1d('0x15')](_0x8fa5d8[_0xef1d('0x16')]+'/.default');return _0x39ae1a['join']('\x20');}function getAccessTokenScope(_0x4bcebf){if(_0x4bcebf[_0xef1d('0x13')]===_0xef1d('0x17'))return _0xef1d('0x18');if(_0x4bcebf[_0xef1d('0x13')]===_0xef1d('0x14'))return _0x4bcebf[_0xef1d('0x16')]+_0xef1d('0x19');}function generateMicrosoftAuthorizationUrl(_0x5642d9,_0x351a7){var _0x4c0f5d=MICROSOFT_AUTH_URL[_0xef1d('0x1a')](_0xef1d('0x1b'),_0x5642d9[_0xef1d('0x1c')]);var _0x15c90c=[_0xef1d('0x1d'),_0xef1d('0x1e')];var _0x5062bd=Buffer[_0xef1d('0x1f')](JSON['stringify']({'id':_0x351a7}))['toString']('base64');var _0x3ef881=crypto[_0xef1d('0x20')](0x10)[_0xef1d('0x21')](_0xef1d('0x22'));var _0x2bd3b8=getAuthorizationScopes(_0x5642d9);var _0x2003f6=[{'key':_0xef1d('0x23'),'value':_0x5642d9[_0xef1d('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x15c90c['join']('\x20'))},{'key':_0xef1d('0x25'),'value':_0x5642d9[_0xef1d('0x26')]},{'key':_0xef1d('0x27'),'value':_0xef1d('0x28')},{'key':_0xef1d('0x29'),'value':encodeURIComponent(_0x2bd3b8)},{'key':_0xef1d('0x2a'),'value':_0x5062bd},{'key':_0xef1d('0x2b'),'value':_0x3ef881},{'key':_0xef1d('0x2c'),'value':_0xef1d('0x2d')}];var _0x587a06=_0x4c0f5d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2003f6,function(_0x1335d0){return _0x1335d0[_0xef1d('0x2e')]+'='+_0x1335d0[_0xef1d('0x2f')];})[_0xef1d('0x30')]('&');_0x5642d9[_0xef1d('0x31')]={'issuer':_0x4c0f5d['replace'](_0xef1d('0x32'),''),'audience':_0x5642d9['data1'],'state':_0x5062bd,'nonce':_0x3ef881};redis[_0xef1d('0x33')](_0x5062bd,JSON['stringify'](_0x5642d9));return _0x587a06;}function isValidIdToken(_0x201d9,_0x417a27){try{var _0xd54af=jwt[_0xef1d('0x34')](_0x201d9,{'complete':!![]});var _0x2096a0=_0xd54af[_0xef1d('0x35')];if(_0x2096a0['iss']!==_0x417a27[_0xef1d('0x36')])return![];if(_0x2096a0[_0xef1d('0x37')]!==_0x417a27['audience'])return![];if(_0x2096a0[_0xef1d('0x2b')]!==_0x417a27[_0xef1d('0x2b')])return![];if(moment()['isAfter'](moment[_0xef1d('0x38')](_0x2096a0[_0xef1d('0x39')])))return![];return!![];}catch(_0x5d389f){throw _0x5d389f;}}function refreshOauth2MicrosoftAccessToken(_0x18e5be){return Promise[_0xef1d('0x3a')]()[_0xef1d('0x3b')](function(){if(_0x18e5be['data3'])return _0x18e5be;return db['CloudProvider'][_0xef1d('0x3c')]({'where':{'id':_0x18e5be['id']},'raw':!![]});})[_0xef1d('0x3b')](function(_0x5e4d87){var _0x31b378={'grant_type':'refresh_token','refresh_token':_0x5e4d87[_0xef1d('0x3d')],'scope':getAccessTokenScope(_0x5e4d87),'redirect_uri':_0x5e4d87[_0xef1d('0x26')],'client_id':_0x5e4d87[_0xef1d('0x24')],'client_secret':encryptor[_0xef1d('0x3e')](_0x5e4d87['data3'])};var _0x4c005f={'method':_0xef1d('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xef1d('0x1a')](_0xef1d('0x1b'),_0x5e4d87[_0xef1d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31b378,'json':!![]};return rp(_0x4c005f);})[_0xef1d('0x3b')](function(_0x4b927c){_0x18e5be[_0xef1d('0x40')]=_0x4b927c[_0xef1d('0x41')];_0x18e5be[_0xef1d('0x3d')]=_0x4b927c[_0xef1d('0x42')];return db[_0xef1d('0x43')][_0xef1d('0x44')]({'data5':_0x18e5be[_0xef1d('0x40')],'data6':_0x18e5be[_0xef1d('0x3d')]},{'where':{'id':_0x18e5be['id']}});})[_0xef1d('0x3b')](function(){return _0x18e5be;})[_0xef1d('0x45')](function(_0x5d2d82){logger['error'](_0xef1d('0x46'),_0x18e5be['id'],_0x5d2d82);});}function getOauth2MicrosoftAccessToken(_0x4fdf42,_0x58a07e){var _0x4df9a8={'grant_type':_0xef1d('0x47'),'code':_0x4fdf42,'scope':getAccessTokenScope(_0x58a07e),'redirect_uri':_0x58a07e[_0xef1d('0x26')],'client_id':_0x58a07e[_0xef1d('0x24')],'client_secret':encryptor[_0xef1d('0x3e')](_0x58a07e[_0xef1d('0x48')])};var _0x5f3303={'method':_0xef1d('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xef1d('0x1b'),_0x58a07e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4df9a8,'json':!![]};return rp(_0x5f3303);}function startRefreshInterval(_0x4a5e2f){var _0x1fdaac=schedule['intervals'];if(_0x1fdaac[_0x4a5e2f['id']])clearInterval(_0x1fdaac[_0x4a5e2f['id']]);_0x1fdaac[_0x4a5e2f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xef1d('0x49')](this,{'id':_0x4a5e2f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xef1d('0x4a')]=_0x1fdaac;}function startAllRefreshIntervals(){return db[_0xef1d('0x43')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xef1d('0x3b')](function(_0x8b9c80){var _0x187744=_0x8b9c80['map'](function(_0x2104c8){return refreshOauth2MicrosoftAccessToken(_0x2104c8)[_0xef1d('0x3b')](function(_0x46ee16){startRefreshInterval(_0x46ee16);});});return Promise['all'](_0x187744);})[_0xef1d('0x45')](function(_0x3548fa){var _0x3e5eb7=_0x3548fa?util[_0xef1d('0x4b')](_0x3548fa,{'showHidden':![],'depth':null}):'';logger[_0xef1d('0x4c')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3e5eb7);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 792e5c0..1657abb 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 _0x28f2=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x2c2954,_0x3cadf4){var _0x1e834e=function(_0x9f157e){while(--_0x9f157e){_0x2c2954['push'](_0x2c2954['shift']());}};_0x1e834e(++_0x3cadf4);}(_0x28f2,0x193));var _0x228f=function(_0x4672d4,_0x6c9725){_0x4672d4=_0x4672d4-0x0;var _0x1a2f2d=_0x28f2[_0x4672d4];return _0x1a2f2d;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('CloudProvider,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});} \ No newline at end of file +var _0x2d0b=['code','message','CloudProvider,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x48ff3d,_0x316a7d){var _0x466514=function(_0x5b6555){while(--_0x5b6555){_0x48ff3d['push'](_0x48ff3d['shift']());}};_0x466514(++_0x316a7d);}(_0x2d0b,0x102));var _0xb2d0=function(_0x3584e3,_0x5802d0){_0x3584e3=_0x3584e3-0x0;var _0x30a6c1=_0x2d0b[_0x3584e3];return _0x30a6c1;};'use strict';var _=require('lodash');var util=require(_0xb2d0('0x0'));var moment=require(_0xb2d0('0x1'));var BPromise=require(_0xb2d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2d0('0x3'));var db=require(_0xb2d0('0x4'))['db'];var utils=require(_0xb2d0('0x5'));var logger=require(_0xb2d0('0x6'))('rpc');var config=require(_0xb2d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb2d0('0x8')][_0xb2d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3bff,_0x28fee3,_0xb1c30c){return new BPromise(function(_0x17f561,_0x31340b){return client[_0xb2d0('0xa')](_0x1d3bff,_0xb1c30c)[_0xb2d0('0xb')](function(_0x1a6fac){logger[_0xb2d0('0xc')]('CloudProvider,\x20%s,\x20%s',_0x28fee3,'request\x20sent');logger['debug'](_0xb2d0('0xd'),_0x28fee3,'request\x20sent',JSON['stringify'](_0x1a6fac));if(_0x1a6fac['error']){if(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0xf')]===0x1f4){logger[_0xb2d0('0xe')]('CloudProvider,\x20%s,\x20%s',_0x28fee3,_0x1a6fac[_0xb2d0('0xe')]['message']);return _0x31340b(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);}logger[_0xb2d0('0xe')](_0xb2d0('0x11'),_0x28fee3,_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);return _0x17f561(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);}else{logger[_0xb2d0('0xc')](_0xb2d0('0x11'),_0x28fee3,_0xb2d0('0x12'));_0x17f561(_0x1a6fac[_0xb2d0('0x13')][_0xb2d0('0x10')]);}})[_0xb2d0('0x14')](function(_0x223ae8){logger['error'](_0xb2d0('0x11'),_0x28fee3,_0x223ae8);_0x31340b(_0x223ae8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index dd08dfb..d915dd5 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x1261,0x144));var _0x1126=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x1261[_0x35a779];return _0xca723b;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4cb2fa,_0x277e7f){_0x4cb2fa=_0x4cb2fa-0x0;var _0x41b318=_0x5f2f[_0x4cb2fa];return _0x41b318;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ea3263c..ba788c0 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 _0x4703=['name','STRING','sequelize','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4703,0xd2));var _0x3470=function(_0x1da655,_0x2285e9){_0x1da655=_0x1da655-0x0;var _0x27b05e=_0x4703[_0x1da655];return _0x27b05e;};'use strict';var Sequelize=require(_0x3470('0x0'));module[_0x3470('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3470('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3470('0x3')]},'companyId':{'type':Sequelize[_0x3470('0x3')]},'website':{'type':Sequelize[_0x3470('0x3')]},'phone':{'type':Sequelize[_0x3470('0x3')]},'fax':{'type':Sequelize[_0x3470('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3470('0x3')]},'postalCode':{'type':Sequelize[_0x3470('0x3')]},'city':{'type':Sequelize[_0x3470('0x3')]},'country':{'type':Sequelize[_0x3470('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3470('0x3')]},'sStreet':{'type':Sequelize[_0x3470('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x3470('0x3')]},'sCountry':{'type':Sequelize[_0x3470('0x3')]},'description':{'type':Sequelize[_0x3470('0x3')]}}; \ No newline at end of file +var _0x024c=['STRING','sequelize','exports'];(function(_0x3d867d,_0x2b706e){var _0x340b24=function(_0x5c155d){while(--_0x5c155d){_0x3d867d['push'](_0x3d867d['shift']());}};_0x340b24(++_0x2b706e);}(_0x024c,0x1c0));var _0xc024=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x024c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc024('0x0'));module[_0xc024('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc024('0x2')]},'companyId':{'type':Sequelize[_0xc024('0x2')]},'website':{'type':Sequelize[_0xc024('0x2')]},'phone':{'type':Sequelize[_0xc024('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc024('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xc024('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc024('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc024('0x2')]},'sStreet':{'type':Sequelize[_0xc024('0x2')]},'sPostalCode':{'type':Sequelize[_0xc024('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xc024('0x2')]},'description':{'type':Sequelize[_0xc024('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b57b40c..d626135 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 _0xb59b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContact','addContacts','omit','ids','getContacts','findOne','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','include','rows','catch','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error'];(function(_0x2dc1a0,_0x29cf94){var _0x3d7e3d=function(_0x25b5d9){while(--_0x25b5d9){_0x2dc1a0['push'](_0x2dc1a0['shift']());}};_0x3d7e3d(++_0x29cf94);}(_0xb59b,0xb9));var _0xbb59=function(_0x54fab4,_0x1fb905){_0x54fab4=_0x54fab4-0x0;var _0x221350=_0xb59b[_0x54fab4];return _0x221350;};'use strict';var emlformat=require(_0xbb59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb59('0x1'));var moment=require(_0xbb59('0x2'));var BPromise=require(_0xbb59('0x3'));var Mustache=require(_0xbb59('0x4'));var util=require('util');var path=require(_0xbb59('0x5'));var sox=require(_0xbb59('0x6'));var csv=require(_0xbb59('0x7'));var ejs=require(_0xbb59('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb59('0x9'));var squel=require(_0xbb59('0xa'));var crypto=require('crypto');var jsforce=require(_0xbb59('0xb'));var deskjs=require(_0xbb59('0xc'));var toCsv=require(_0xbb59('0x7'));var querystring=require(_0xbb59('0xd'));var Papa=require(_0xbb59('0xe'));var Redis=require(_0xbb59('0xf'));var authService=require(_0xbb59('0x10'));var qs=require(_0xbb59('0x11'));var as=require(_0xbb59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbb59('0x13'));var utils=require(_0xbb59('0x14'));var config=require(_0xbb59('0x15'));var licenseUtil=require(_0xbb59('0x16'));var db=require(_0xbb59('0x17'))['db'];function respondWithStatusCode(_0x536338,_0x43e60a){_0x43e60a=_0x43e60a||0xcc;return function(_0x3729ef){if(_0x3729ef){return _0x536338['sendStatus'](_0x43e60a);}return _0x536338[_0xbb59('0x18')](_0x43e60a)[_0xbb59('0x19')]();};}function respondWithResult(_0x1401a4,_0xcd98fc){_0xcd98fc=_0xcd98fc||0xc8;return function(_0x5aa28b){if(_0x5aa28b){return _0x1401a4[_0xbb59('0x18')](_0xcd98fc)[_0xbb59('0x1a')](_0x5aa28b);}};}function respondWithFilteredResult(_0x25b6b2,_0x4a20ac){return function(_0x34bc47){if(_0x34bc47){var _0x2eddcc=typeof _0x4a20ac[_0xbb59('0x1b')]===_0xbb59('0x1c')&&typeof _0x4a20ac[_0xbb59('0x1d')]===_0xbb59('0x1c');var _0x1cc2a2=_0x34bc47[_0xbb59('0x1e')];var _0x558a1d=_0x2eddcc?0x0:_0x4a20ac['offset'];var _0x2c0bd6=_0x2eddcc?_0x34bc47[_0xbb59('0x1e')]:_0x4a20ac[_0xbb59('0x1b')]+_0x4a20ac[_0xbb59('0x1d')];var _0x9f51e9;if(_0x2c0bd6>=_0x1cc2a2){_0x2c0bd6=_0x1cc2a2;_0x9f51e9=0xc8;}else{_0x9f51e9=0xce;}_0x25b6b2[_0xbb59('0x18')](_0x9f51e9);return _0x25b6b2[_0xbb59('0x1f')](_0xbb59('0x20'),_0x558a1d+'-'+_0x2c0bd6+'/'+_0x1cc2a2)[_0xbb59('0x1a')](_0x34bc47);}return null;};}function patchUpdates(_0x54af2f){return function(_0x3b73af){try{jsonpatch[_0xbb59('0x21')](_0x3b73af,_0x54af2f,!![]);}catch(_0x1af15a){return BPromise[_0xbb59('0x22')](_0x1af15a);}return _0x3b73af[_0xbb59('0x23')]();};}function saveUpdates(_0x3d2557,_0x4ab04f){return function(_0x5707a3){if(_0x5707a3){return _0x5707a3[_0xbb59('0x24')](_0x3d2557)[_0xbb59('0x25')](function(_0x4392de){return _0x4392de;});}return null;};}function removeEntity(_0x428c80,_0x26830c){return function(_0x1e2c21){if(_0x1e2c21){return _0x1e2c21[_0xbb59('0x26')]()[_0xbb59('0x25')](function(){var _0x154d90=_0x1e2c21[_0xbb59('0x27')]({'plain':!![]});var _0x27148b=_0xbb59('0x28');return db[_0xbb59('0x29')][_0xbb59('0x26')]({'where':{'type':_0x27148b,'resourceId':_0x154d90['id']}})[_0xbb59('0x25')](function(){return _0x1e2c21;});})[_0xbb59('0x25')](function(){_0x428c80[_0xbb59('0x18')](0xcc)[_0xbb59('0x19')]();});}};}function handleEntityNotFound(_0x3e9c86,_0x362888){return function(_0x19718f){if(!_0x19718f){_0x3e9c86[_0xbb59('0x2a')](0x194);}return _0x19718f;};}function handleError(_0xafe6ac,_0x2dca91){_0x2dca91=_0x2dca91||0x1f4;return function(_0x3df290){logger['error'](_0x3df290[_0xbb59('0x2b')]);if(_0x3df290[_0xbb59('0x2c')]){delete _0x3df290['name'];}_0xafe6ac[_0xbb59('0x18')](_0x2dca91)[_0xbb59('0x2d')](_0x3df290);};}exports[_0xbb59('0x2e')]=function(_0x1ba77f,_0x5c5271){var _0xf06c99={},_0x54ffc8={},_0x46d193={'count':0x0,'rows':[]};return db[_0xbb59('0x2f')][_0xbb59('0x30')]()[_0xbb59('0x25')](function(_0x3227df){_0x54ffc8['model']=_[_0xbb59('0x31')](_0x3227df);_0x54ffc8[_0xbb59('0x32')]=_[_0xbb59('0x31')](_0x1ba77f[_0xbb59('0x32')]);_0x54ffc8[_0xbb59('0x33')]=_[_0xbb59('0x34')](_0x54ffc8[_0xbb59('0x35')],_0x54ffc8[_0xbb59('0x32')]);_0xf06c99[_0xbb59('0x36')]=_['intersection'](_0x54ffc8['model'],qs[_0xbb59('0x37')](_0x1ba77f[_0xbb59('0x32')]['fields']));_0xf06c99[_0xbb59('0x36')]=_0xf06c99[_0xbb59('0x36')][_0xbb59('0x38')]?_0xf06c99[_0xbb59('0x36')]:_0x54ffc8[_0xbb59('0x35')];if(!_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x39')](_0xbb59('0x3a'))){_0xf06c99[_0xbb59('0x1d')]=qs['limit'](_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x1d')]);_0xf06c99[_0xbb59('0x1b')]=qs[_0xbb59('0x1b')](_0x1ba77f['query'][_0xbb59('0x1b')]);}_0xf06c99[_0xbb59('0x3b')]=qs[_0xbb59('0x3c')](_0x1ba77f[_0xbb59('0x32')]['sort']);_0xf06c99[_0xbb59('0x3d')]=qs[_0xbb59('0x33')](_[_0xbb59('0x3e')](_0x1ba77f[_0xbb59('0x32')],_0x54ffc8[_0xbb59('0x33')]),_0x3227df);if(_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x3f')]){_0xf06c99['where']=_[_0xbb59('0x40')](_0xf06c99['where'],{'$or':_[_0xbb59('0x41')](_0xf06c99[_0xbb59('0x36')],function(_0x38bcf9){var _0x14fc15={};_0x14fc15[_0x38bcf9]={'$like':'%'+_0x1ba77f[_0xbb59('0x32')][_0xbb59('0x3f')]+'%'};return _0x14fc15;})});}_0xf06c99=_[_0xbb59('0x40')]({},_0xf06c99,_0x1ba77f['options']);var _0x424a71={'where':_0xf06c99[_0xbb59('0x3d')]};return db[_0xbb59('0x2f')][_0xbb59('0x1e')](_0x424a71)[_0xbb59('0x25')](function(_0x41eb13){_0x46d193[_0xbb59('0x1e')]=_0x41eb13;if(_0x1ba77f[_0xbb59('0x32')]['includeAll']){_0xf06c99[_0xbb59('0x42')]=[{'all':!![]}];}return db[_0xbb59('0x2f')]['findAll'](_0xf06c99);})[_0xbb59('0x25')](function(_0x3faae1){_0x46d193[_0xbb59('0x43')]=_0x3faae1;return _0x46d193;})[_0xbb59('0x25')](respondWithFilteredResult(_0x5c5271,_0xf06c99))[_0xbb59('0x44')](handleError(_0x5c5271,null));})['catch'](handleError(_0x5c5271,null));};exports['show']=function(_0x3b8fb9,_0x47e168){var _0x5ea783={'raw':![],'where':{'id':_0x3b8fb9['params']['id']}},_0x1fe0f4={};_0x1fe0f4[_0xbb59('0x35')]=_['keys'](db[_0xbb59('0x2f')][_0xbb59('0x45')]);_0x1fe0f4['query']=_['keys'](_0x3b8fb9[_0xbb59('0x32')]);_0x1fe0f4[_0xbb59('0x33')]=_[_0xbb59('0x34')](_0x1fe0f4[_0xbb59('0x35')],_0x1fe0f4[_0xbb59('0x32')]);_0x5ea783[_0xbb59('0x36')]=_['intersection'](_0x1fe0f4[_0xbb59('0x35')],qs[_0xbb59('0x37')](_0x3b8fb9[_0xbb59('0x32')][_0xbb59('0x37')]));_0x5ea783[_0xbb59('0x36')]=_0x5ea783[_0xbb59('0x36')]['length']?_0x5ea783[_0xbb59('0x36')]:_0x1fe0f4['model'];if(_0x3b8fb9[_0xbb59('0x32')][_0xbb59('0x46')]){_0x5ea783['include']=[{'all':!![]}];}_0x5ea783=_['merge']({},_0x5ea783,_0x3b8fb9[_0xbb59('0x47')]);return db[_0xbb59('0x2f')][_0xbb59('0x48')](_0x5ea783)['then'](handleEntityNotFound(_0x47e168,null))[_0xbb59('0x25')](respondWithResult(_0x47e168,null))[_0xbb59('0x44')](handleError(_0x47e168,null));};exports[_0xbb59('0x49')]=function(_0x108a29,_0x11cff4){return db['CmCompany']['create'](_0x108a29['body'],{})[_0xbb59('0x25')](function(_0x4b9ee0){var _0x4fd5cf=_0x108a29[_0xbb59('0x4a')][_0xbb59('0x27')]({'plain':!![]});if(!_0x4fd5cf)throw new Error(_0xbb59('0x4b'));if(_0x4fd5cf['role']==='user'){var _0x5d2217=_0x4b9ee0[_0xbb59('0x27')]({'plain':!![]});var _0x31df6a=_0xbb59('0x28');return db[_0xbb59('0x4c')][_0xbb59('0x48')]({'where':{'name':_0x31df6a,'userProfileId':_0x4fd5cf['userProfileId']},'raw':!![]})['then'](function(_0x28643c){if(_0x28643c&&_0x28643c[_0xbb59('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d2217[_0xbb59('0x2c')],'resourceId':_0x5d2217['id'],'type':_0x28643c['name'],'sectionId':_0x28643c['id']},{})[_0xbb59('0x25')](function(){return _0x4b9ee0;});}else{return _0x4b9ee0;}})[_0xbb59('0x44')](function(_0x42f35e){logger[_0xbb59('0x4e')](_0xbb59('0x4f'),_0x42f35e);throw _0x42f35e;});}return _0x4b9ee0;})[_0xbb59('0x25')](respondWithResult(_0x11cff4,0xc9))[_0xbb59('0x44')](handleError(_0x11cff4,null));};exports['update']=function(_0x19f9c8,_0xf7682f){if(_0x19f9c8['body']['id']){delete _0x19f9c8[_0xbb59('0x50')]['id'];}return db[_0xbb59('0x2f')][_0xbb59('0x48')]({'where':{'id':_0x19f9c8[_0xbb59('0x51')]['id']}})['then'](handleEntityNotFound(_0xf7682f,null))['then'](saveUpdates(_0x19f9c8[_0xbb59('0x50')],null))[_0xbb59('0x25')](respondWithResult(_0xf7682f,null))[_0xbb59('0x44')](handleError(_0xf7682f,null));};exports[_0xbb59('0x26')]=function(_0x5ca638,_0x42957f){return db[_0xbb59('0x2f')][_0xbb59('0x48')]({'where':{'id':_0x5ca638[_0xbb59('0x51')]['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x42957f,null))[_0xbb59('0x25')](removeEntity(_0x42957f,null))[_0xbb59('0x44')](handleError(_0x42957f,null));};exports[_0xbb59('0x30')]=function(_0x147f08,_0x5c2b1e){return db[_0xbb59('0x2f')][_0xbb59('0x30')]()[_0xbb59('0x25')](respondWithResult(_0x5c2b1e,null))['catch'](handleError(_0x5c2b1e,null));};exports['addContacts']=function(_0x554108,_0x2226a3,_0x21d902){return db[_0xbb59('0x52')][_0xbb59('0x48')]({'where':{'id':_0x554108['params']['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x2226a3,null))[_0xbb59('0x25')](function(_0xc277d6){if(_0xc277d6){return _0xc277d6[_0xbb59('0x53')](_0x554108['body']['ids'],_[_0xbb59('0x54')](_0x554108['body'],[_0xbb59('0x55'),'id'])||{});}})[_0xbb59('0x25')](respondWithResult(_0x2226a3,null))[_0xbb59('0x44')](handleError(_0x2226a3,null));};exports[_0xbb59('0x56')]=function(_0x358cd3,_0x2a4e9d,_0x37688a){var _0x3bd7ac={};var _0x5d03b8={};var _0x46f6cd;var _0x36a6fd;return db[_0xbb59('0x2f')][_0xbb59('0x57')]({'where':{'id':_0x358cd3[_0xbb59('0x51')]['id']}})[_0xbb59('0x25')](handleEntityNotFound(_0x2a4e9d,null))['then'](function(_0x4d20c2){if(_0x4d20c2){_0x46f6cd=_0x4d20c2;_0x5d03b8['model']=_[_0xbb59('0x31')](db['CmContact']['rawAttributes']);_0x5d03b8[_0xbb59('0x32')]=_[_0xbb59('0x31')](_0x358cd3[_0xbb59('0x32')]);_0x5d03b8[_0xbb59('0x33')]=_['intersection'](_0x5d03b8[_0xbb59('0x35')],_0x5d03b8[_0xbb59('0x32')]);_0x3bd7ac[_0xbb59('0x36')]=_[_0xbb59('0x34')](_0x5d03b8[_0xbb59('0x35')],qs['fields'](_0x358cd3['query']['fields']));_0x3bd7ac[_0xbb59('0x36')]=_0x3bd7ac[_0xbb59('0x36')][_0xbb59('0x38')]?_0x3bd7ac['attributes']:_0x5d03b8[_0xbb59('0x35')];_0x3bd7ac[_0xbb59('0x3b')]=qs[_0xbb59('0x3c')](_0x358cd3['query']['sort']);_0x3bd7ac[_0xbb59('0x3d')]=qs[_0xbb59('0x33')](_['pick'](_0x358cd3[_0xbb59('0x32')],_0x5d03b8[_0xbb59('0x33')]));if(_0x358cd3[_0xbb59('0x32')]['filter']){_0x3bd7ac[_0xbb59('0x3d')]=_['merge'](_0x3bd7ac[_0xbb59('0x3d')],{'$or':_['map'](_0x3bd7ac[_0xbb59('0x36')],function(_0x34f3ca){var _0x195bca={};_0x195bca[_0x34f3ca]={'$like':'%'+_0x358cd3[_0xbb59('0x32')][_0xbb59('0x3f')]+'%'};return _0x195bca;})});}_0x3bd7ac=_['merge']({},_0x3bd7ac,_0x358cd3['options']);return _0x46f6cd[_0xbb59('0x56')](_0x3bd7ac);}})['then'](function(_0x118f15){if(_0x118f15){_0x36a6fd=_0x118f15[_0xbb59('0x38')];if(!_0x358cd3['query']['hasOwnProperty'](_0xbb59('0x3a'))){_0x3bd7ac[_0xbb59('0x1d')]=qs['limit'](_0x358cd3[_0xbb59('0x32')]['limit']);_0x3bd7ac[_0xbb59('0x1b')]=qs[_0xbb59('0x1b')](_0x358cd3[_0xbb59('0x32')][_0xbb59('0x1b')]);}return _0x46f6cd['getContacts'](_0x3bd7ac);}})[_0xbb59('0x25')](function(_0x346445){if(_0x346445){return _0x346445?{'count':_0x36a6fd,'rows':_0x346445}:null;}})['then'](respondWithResult(_0x2a4e9d,null))['catch'](handleError(_0x2a4e9d,null));}; \ No newline at end of file +var _0xd840=['filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','order','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','reject','update','then','Companies','UserProfileResource','destroy','end','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick'];(function(_0x6e46f,_0x10152e){var _0x2ef67a=function(_0x2d1b23){while(--_0x2d1b23){_0x6e46f['push'](_0x6e46f['shift']());}};_0x2ef67a(++_0x10152e);}(_0xd840,0xd0));var _0x0d84=function(_0x13d157,_0x202826){_0x13d157=_0x13d157-0x0;var _0x38924b=_0xd840[_0x13d157];return _0x38924b;};'use strict';var emlformat=require(_0x0d84('0x0'));var rimraf=require(_0x0d84('0x1'));var zipdir=require(_0x0d84('0x2'));var jsonpatch=require(_0x0d84('0x3'));var rp=require('request-promise');var moment=require(_0x0d84('0x4'));var BPromise=require(_0x0d84('0x5'));var Mustache=require(_0x0d84('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0d84('0x7'));var csv=require(_0x0d84('0x8'));var ejs=require(_0x0d84('0x9'));var fs=require('fs');var fs_extra=require(_0x0d84('0xa'));var _=require(_0x0d84('0xb'));var squel=require(_0x0d84('0xc'));var crypto=require(_0x0d84('0xd'));var jsforce=require(_0x0d84('0xe'));var deskjs=require(_0x0d84('0xf'));var toCsv=require(_0x0d84('0x8'));var querystring=require('querystring');var Papa=require(_0x0d84('0x10'));var Redis=require(_0x0d84('0x11'));var authService=require(_0x0d84('0x12'));var qs=require(_0x0d84('0x13'));var as=require(_0x0d84('0x14'));var hardwareService=require(_0x0d84('0x15'));var logger=require(_0x0d84('0x16'))(_0x0d84('0x17'));var utils=require('../../config/utils');var config=require(_0x0d84('0x18'));var licenseUtil=require(_0x0d84('0x19'));var db=require(_0x0d84('0x1a'))['db'];function respondWithStatusCode(_0x2c3a56,_0x581ebd){_0x581ebd=_0x581ebd||0xcc;return function(_0x2660d3){if(_0x2660d3){return _0x2c3a56[_0x0d84('0x1b')](_0x581ebd);}return _0x2c3a56[_0x0d84('0x1c')](_0x581ebd)['end']();};}function respondWithResult(_0x3a8d4d,_0x29b734){_0x29b734=_0x29b734||0xc8;return function(_0x57c758){if(_0x57c758){return _0x3a8d4d['status'](_0x29b734)['json'](_0x57c758);}};}function respondWithFilteredResult(_0x52a812,_0x4d2001){return function(_0x1ec94d){if(_0x1ec94d){var _0x510e53=typeof _0x4d2001[_0x0d84('0x1d')]===_0x0d84('0x1e')&&typeof _0x4d2001['limit']===_0x0d84('0x1e');var _0x6053b7=_0x1ec94d['count'];var _0xf61a3e=_0x510e53?0x0:_0x4d2001['offset'];var _0x130f22=_0x510e53?_0x1ec94d[_0x0d84('0x1f')]:_0x4d2001[_0x0d84('0x1d')]+_0x4d2001['limit'];var _0x1c16c7;if(_0x130f22>=_0x6053b7){_0x130f22=_0x6053b7;_0x1c16c7=0xc8;}else{_0x1c16c7=0xce;}_0x52a812[_0x0d84('0x1c')](_0x1c16c7);return _0x52a812[_0x0d84('0x20')](_0x0d84('0x21'),_0xf61a3e+'-'+_0x130f22+'/'+_0x6053b7)[_0x0d84('0x22')](_0x1ec94d);}return null;};}function patchUpdates(_0x1a2395){return function(_0x5d5c78){try{jsonpatch['apply'](_0x5d5c78,_0x1a2395,!![]);}catch(_0x13cd1e){return BPromise[_0x0d84('0x23')](_0x13cd1e);}return _0x5d5c78['save']();};}function saveUpdates(_0x2f312b,_0x44b861){return function(_0x2d09b3){if(_0x2d09b3){return _0x2d09b3[_0x0d84('0x24')](_0x2f312b)[_0x0d84('0x25')](function(_0x5eb6b1){return _0x5eb6b1;});}return null;};}function removeEntity(_0xc67be4,_0x44f82f){return function(_0x2f69ed){if(_0x2f69ed){return _0x2f69ed['destroy']()[_0x0d84('0x25')](function(){var _0x43d9e9=_0x2f69ed['get']({'plain':!![]});var _0x43c1cc=_0x0d84('0x26');return db[_0x0d84('0x27')][_0x0d84('0x28')]({'where':{'type':_0x43c1cc,'resourceId':_0x43d9e9['id']}})[_0x0d84('0x25')](function(){return _0x2f69ed;});})[_0x0d84('0x25')](function(){_0xc67be4[_0x0d84('0x1c')](0xcc)[_0x0d84('0x29')]();});}};}function handleEntityNotFound(_0x3bc3c3,_0x186a33){return function(_0x177c73){if(!_0x177c73){_0x3bc3c3['sendStatus'](0x194);}return _0x177c73;};}function handleError(_0x5b0188,_0x103b2d){_0x103b2d=_0x103b2d||0x1f4;return function(_0x11afa6){logger['error'](_0x11afa6[_0x0d84('0x2a')]);if(_0x11afa6[_0x0d84('0x2b')]){delete _0x11afa6[_0x0d84('0x2b')];}_0x5b0188[_0x0d84('0x1c')](_0x103b2d)[_0x0d84('0x2c')](_0x11afa6);};}exports['index']=function(_0x5d7967,_0x2fb903){var _0x2f5499={},_0x3ba01c={},_0x4b36f={'count':0x0,'rows':[]};return db[_0x0d84('0x2d')][_0x0d84('0x2e')]()[_0x0d84('0x25')](function(_0x3f8d5b){_0x3ba01c[_0x0d84('0x2f')]=_[_0x0d84('0x30')](_0x3f8d5b);_0x3ba01c[_0x0d84('0x31')]=_['keys'](_0x5d7967[_0x0d84('0x31')]);_0x3ba01c[_0x0d84('0x32')]=_['intersection'](_0x3ba01c['model'],_0x3ba01c[_0x0d84('0x31')]);_0x2f5499['attributes']=_[_0x0d84('0x33')](_0x3ba01c[_0x0d84('0x2f')],qs[_0x0d84('0x34')](_0x5d7967[_0x0d84('0x31')][_0x0d84('0x34')]));_0x2f5499[_0x0d84('0x35')]=_0x2f5499['attributes'][_0x0d84('0x36')]?_0x2f5499[_0x0d84('0x35')]:_0x3ba01c['model'];if(!_0x5d7967[_0x0d84('0x31')][_0x0d84('0x37')]('nolimit')){_0x2f5499[_0x0d84('0x38')]=qs[_0x0d84('0x38')](_0x5d7967[_0x0d84('0x31')]['limit']);_0x2f5499[_0x0d84('0x1d')]=qs[_0x0d84('0x1d')](_0x5d7967[_0x0d84('0x31')][_0x0d84('0x1d')]);}_0x2f5499['order']=qs[_0x0d84('0x39')](_0x5d7967[_0x0d84('0x31')][_0x0d84('0x39')]);_0x2f5499['where']=qs['filters'](_[_0x0d84('0x3a')](_0x5d7967[_0x0d84('0x31')],_0x3ba01c[_0x0d84('0x32')]),_0x3f8d5b);if(_0x5d7967[_0x0d84('0x31')][_0x0d84('0x3b')]){_0x2f5499[_0x0d84('0x3c')]=_[_0x0d84('0x3d')](_0x2f5499['where'],{'$or':_['map'](_0x2f5499[_0x0d84('0x35')],function(_0x55584d){var _0x39060b={};_0x39060b[_0x55584d]={'$like':'%'+_0x5d7967[_0x0d84('0x31')][_0x0d84('0x3b')]+'%'};return _0x39060b;})});}_0x2f5499=_[_0x0d84('0x3d')]({},_0x2f5499,_0x5d7967[_0x0d84('0x3e')]);var _0x464f25={'where':_0x2f5499[_0x0d84('0x3c')]};return db['CmCompany'][_0x0d84('0x1f')](_0x464f25)[_0x0d84('0x25')](function(_0x2e8c1b){_0x4b36f['count']=_0x2e8c1b;if(_0x5d7967[_0x0d84('0x31')][_0x0d84('0x3f')]){_0x2f5499[_0x0d84('0x40')]=[{'all':!![]}];}return db[_0x0d84('0x2d')][_0x0d84('0x41')](_0x2f5499);})['then'](function(_0x272a73){_0x4b36f[_0x0d84('0x42')]=_0x272a73;return _0x4b36f;})[_0x0d84('0x25')](respondWithFilteredResult(_0x2fb903,_0x2f5499))[_0x0d84('0x43')](handleError(_0x2fb903,null));})[_0x0d84('0x43')](handleError(_0x2fb903,null));};exports[_0x0d84('0x44')]=function(_0x1e88db,_0x401b3e){var _0x1365ef={'raw':![],'where':{'id':_0x1e88db[_0x0d84('0x45')]['id']}},_0x496f89={};_0x496f89[_0x0d84('0x2f')]=_[_0x0d84('0x30')](db['CmCompany'][_0x0d84('0x46')]);_0x496f89[_0x0d84('0x31')]=_[_0x0d84('0x30')](_0x1e88db[_0x0d84('0x31')]);_0x496f89['filters']=_['intersection'](_0x496f89['model'],_0x496f89['query']);_0x1365ef[_0x0d84('0x35')]=_['intersection'](_0x496f89['model'],qs[_0x0d84('0x34')](_0x1e88db[_0x0d84('0x31')][_0x0d84('0x34')]));_0x1365ef['attributes']=_0x1365ef[_0x0d84('0x35')][_0x0d84('0x36')]?_0x1365ef[_0x0d84('0x35')]:_0x496f89[_0x0d84('0x2f')];if(_0x1e88db[_0x0d84('0x31')]['includeAll']){_0x1365ef[_0x0d84('0x40')]=[{'all':!![]}];}_0x1365ef=_[_0x0d84('0x3d')]({},_0x1365ef,_0x1e88db[_0x0d84('0x3e')]);return db[_0x0d84('0x2d')][_0x0d84('0x47')](_0x1365ef)[_0x0d84('0x25')](handleEntityNotFound(_0x401b3e,null))['then'](respondWithResult(_0x401b3e,null))[_0x0d84('0x43')](handleError(_0x401b3e,null));};exports[_0x0d84('0x48')]=function(_0x4a1efc,_0x4cf914){return db[_0x0d84('0x2d')][_0x0d84('0x48')](_0x4a1efc[_0x0d84('0x49')],{})[_0x0d84('0x25')](function(_0x29c3ee){var _0x3ddac0=_0x4a1efc['user']['get']({'plain':!![]});if(!_0x3ddac0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ddac0['role']==='user'){var _0x61024d=_0x29c3ee[_0x0d84('0x4a')]({'plain':!![]});var _0x49109e=_0x0d84('0x26');return db[_0x0d84('0x4b')]['find']({'where':{'name':_0x49109e,'userProfileId':_0x3ddac0[_0x0d84('0x4c')]},'raw':!![]})[_0x0d84('0x25')](function(_0x17adec){if(_0x17adec&&_0x17adec[_0x0d84('0x4d')]===0x0){return db['UserProfileResource'][_0x0d84('0x48')]({'name':_0x61024d[_0x0d84('0x2b')],'resourceId':_0x61024d['id'],'type':_0x17adec[_0x0d84('0x2b')],'sectionId':_0x17adec['id']},{})[_0x0d84('0x25')](function(){return _0x29c3ee;});}else{return _0x29c3ee;}})[_0x0d84('0x43')](function(_0x2356b7){logger[_0x0d84('0x4e')](_0x0d84('0x4f'),_0x2356b7);throw _0x2356b7;});}return _0x29c3ee;})[_0x0d84('0x25')](respondWithResult(_0x4cf914,0xc9))[_0x0d84('0x43')](handleError(_0x4cf914,null));};exports[_0x0d84('0x24')]=function(_0x5d3de2,_0x5b1f80){if(_0x5d3de2[_0x0d84('0x49')]['id']){delete _0x5d3de2[_0x0d84('0x49')]['id'];}return db[_0x0d84('0x2d')][_0x0d84('0x47')]({'where':{'id':_0x5d3de2[_0x0d84('0x45')]['id']}})[_0x0d84('0x25')](handleEntityNotFound(_0x5b1f80,null))['then'](saveUpdates(_0x5d3de2[_0x0d84('0x49')],null))[_0x0d84('0x25')](respondWithResult(_0x5b1f80,null))[_0x0d84('0x43')](handleError(_0x5b1f80,null));};exports['destroy']=function(_0x114e7c,_0x4fd2bd){return db['CmCompany'][_0x0d84('0x47')]({'where':{'id':_0x114e7c[_0x0d84('0x45')]['id']}})['then'](handleEntityNotFound(_0x4fd2bd,null))['then'](removeEntity(_0x4fd2bd,null))[_0x0d84('0x43')](handleError(_0x4fd2bd,null));};exports[_0x0d84('0x2e')]=function(_0x1d12c8,_0x5f4482){return db['CmCompany'][_0x0d84('0x2e')]()['then'](respondWithResult(_0x5f4482,null))['catch'](handleError(_0x5f4482,null));};exports[_0x0d84('0x50')]=function(_0x510b28,_0x4257b4,_0x2b4ad9){return db[_0x0d84('0x51')]['find']({'where':{'id':_0x510b28[_0x0d84('0x45')]['id']}})[_0x0d84('0x25')](handleEntityNotFound(_0x4257b4,null))['then'](function(_0x5ca976){if(_0x5ca976){return _0x5ca976[_0x0d84('0x50')](_0x510b28['body'][_0x0d84('0x52')],_[_0x0d84('0x53')](_0x510b28[_0x0d84('0x49')],['ids','id'])||{});}})[_0x0d84('0x25')](respondWithResult(_0x4257b4,null))[_0x0d84('0x43')](handleError(_0x4257b4,null));};exports[_0x0d84('0x54')]=function(_0xbe1468,_0x6f5977,_0x10588b){var _0x507ce5={};var _0x756e64={};var _0xb5a29;var _0x4b6e2e;return db['CmCompany'][_0x0d84('0x55')]({'where':{'id':_0xbe1468[_0x0d84('0x45')]['id']}})['then'](handleEntityNotFound(_0x6f5977,null))[_0x0d84('0x25')](function(_0x5afc14){if(_0x5afc14){_0xb5a29=_0x5afc14;_0x756e64[_0x0d84('0x2f')]=_['keys'](db['CmContact']['rawAttributes']);_0x756e64[_0x0d84('0x31')]=_[_0x0d84('0x30')](_0xbe1468[_0x0d84('0x31')]);_0x756e64[_0x0d84('0x32')]=_[_0x0d84('0x33')](_0x756e64[_0x0d84('0x2f')],_0x756e64[_0x0d84('0x31')]);_0x507ce5[_0x0d84('0x35')]=_[_0x0d84('0x33')](_0x756e64['model'],qs[_0x0d84('0x34')](_0xbe1468[_0x0d84('0x31')][_0x0d84('0x34')]));_0x507ce5[_0x0d84('0x35')]=_0x507ce5[_0x0d84('0x35')]['length']?_0x507ce5[_0x0d84('0x35')]:_0x756e64[_0x0d84('0x2f')];_0x507ce5[_0x0d84('0x56')]=qs[_0x0d84('0x39')](_0xbe1468[_0x0d84('0x31')][_0x0d84('0x39')]);_0x507ce5[_0x0d84('0x3c')]=qs[_0x0d84('0x32')](_[_0x0d84('0x3a')](_0xbe1468[_0x0d84('0x31')],_0x756e64[_0x0d84('0x32')]));if(_0xbe1468[_0x0d84('0x31')][_0x0d84('0x3b')]){_0x507ce5['where']=_[_0x0d84('0x3d')](_0x507ce5[_0x0d84('0x3c')],{'$or':_[_0x0d84('0x57')](_0x507ce5[_0x0d84('0x35')],function(_0x46b3a8){var _0x472945={};_0x472945[_0x46b3a8]={'$like':'%'+_0xbe1468['query'][_0x0d84('0x3b')]+'%'};return _0x472945;})});}_0x507ce5=_['merge']({},_0x507ce5,_0xbe1468[_0x0d84('0x3e')]);return _0xb5a29[_0x0d84('0x54')](_0x507ce5);}})['then'](function(_0x3a8eb4){if(_0x3a8eb4){_0x4b6e2e=_0x3a8eb4[_0x0d84('0x36')];if(!_0xbe1468[_0x0d84('0x31')]['hasOwnProperty'](_0x0d84('0x58'))){_0x507ce5[_0x0d84('0x38')]=qs[_0x0d84('0x38')](_0xbe1468[_0x0d84('0x31')][_0x0d84('0x38')]);_0x507ce5[_0x0d84('0x1d')]=qs['offset'](_0xbe1468[_0x0d84('0x31')][_0x0d84('0x1d')]);}return _0xb5a29['getContacts'](_0x507ce5);}})[_0x0d84('0x25')](function(_0xbc4e54){if(_0xbc4e54){return _0xbc4e54?{'count':_0x4b6e2e,'rows':_0xbc4e54}:null;}})[_0x0d84('0x25')](respondWithResult(_0x6f5977,null))[_0x0d84('0x43')](handleError(_0x6f5977,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1572675..4ae2b03 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 _0x6932=['api','moment','bluebird','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x4c3fa1,_0x13f193){var _0x6f73be=function(_0x3802be){while(--_0x3802be){_0x4c3fa1['push'](_0x4c3fa1['shift']());}};_0x6f73be(++_0x13f193);}(_0x6932,0x132));var _0x2693=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6932[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x2693('0x0'));var util=require('util');var logger=require(_0x2693('0x1'))(_0x2693('0x2'));var moment=require(_0x2693('0x3'));var BPromise=require(_0x2693('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2693('0x5'));var rimraf=require('rimraf');var config=require(_0x2693('0x6'));var attributes=require(_0x2693('0x7'));module['exports']=function(_0x2ca330,_0x4f45ba){return _0x2ca330[_0x2693('0x8')](_0x2693('0x9'),attributes,{'tableName':_0x2693('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd887=['exports','define','cm_companies','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x35f591,_0x4f401c){var _0x5ade4f=function(_0x1a4fc2){while(--_0x1a4fc2){_0x35f591['push'](_0x35f591['shift']());}};_0x5ade4f(++_0x4f401c);}(_0xd887,0x177));var _0x7d88=function(_0x4dbdc3,_0x5a525d){_0x4dbdc3=_0x4dbdc3-0x0;var _0x1765ad=_0xd887[_0x4dbdc3];return _0x1765ad;};'use strict';var _=require(_0x7d88('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d88('0x1'));var moment=require(_0x7d88('0x2'));var BPromise=require(_0x7d88('0x3'));var rp=require(_0x7d88('0x4'));var fs=require('fs');var path=require(_0x7d88('0x5'));var rimraf=require(_0x7d88('0x6'));var config=require(_0x7d88('0x7'));var attributes=require(_0x7d88('0x8'));module[_0x7d88('0x9')]=function(_0xf8e042,_0x573edf){return _0xf8e042[_0x7d88('0xa')]('CmCompany',attributes,{'tableName':_0x7d88('0xb'),'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 9fcb3cc..cda4e86 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 _0xc063=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0xc063,0x172));var _0x3c06=function(_0x539eb6,_0x3843f8){_0x539eb6=_0x539eb6-0x0;var _0x2e3478=_0xc063[_0x539eb6];return _0x2e3478;};'use strict';var _=require(_0x3c06('0x0'));var util=require(_0x3c06('0x1'));var moment=require(_0x3c06('0x2'));var BPromise=require(_0x3c06('0x3'));var rs=require(_0x3c06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c06('0x5'))['db'];var utils=require(_0x3c06('0x6'));var logger=require(_0x3c06('0x7'))(_0x3c06('0x8'));var config=require(_0x3c06('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0d8a,_0x24c46b,_0x5ee827){return new BPromise(function(_0x545cdd,_0x1f7abc){return client['request'](_0x5a0d8a,_0x5ee827)[_0x3c06('0xb')](function(_0x572a62){logger[_0x3c06('0xc')](_0x3c06('0xd'),_0x24c46b,_0x3c06('0xe'));logger[_0x3c06('0xf')](_0x3c06('0x10'),_0x24c46b,_0x3c06('0xe'),JSON[_0x3c06('0x11')](_0x572a62));if(_0x572a62[_0x3c06('0x12')]){if(_0x572a62[_0x3c06('0x12')][_0x3c06('0x13')]===0x1f4){logger[_0x3c06('0x12')](_0x3c06('0xd'),_0x24c46b,_0x572a62['error']['message']);return _0x1f7abc(_0x572a62[_0x3c06('0x12')]['message']);}logger['error'](_0x3c06('0xd'),_0x24c46b,_0x572a62[_0x3c06('0x12')][_0x3c06('0x14')]);return _0x545cdd(_0x572a62['error'][_0x3c06('0x14')]);}else{logger[_0x3c06('0xc')]('CmCompany,\x20%s,\x20%s',_0x24c46b,'request\x20sent');_0x545cdd(_0x572a62[_0x3c06('0x15')][_0x3c06('0x14')]);}})['catch'](function(_0x123575){logger[_0x3c06('0x12')](_0x3c06('0xd'),_0x24c46b,_0x123575);_0x1f7abc(_0x123575);});});} \ No newline at end of file +var _0x2274=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x109b16,_0x255826){var _0x4e47a4=function(_0x1a4a8f){while(--_0x1a4a8f){_0x109b16['push'](_0x109b16['shift']());}};_0x4e47a4(++_0x255826);}(_0x2274,0x16b));var _0x4227=function(_0x4164ff,_0x2e9593){_0x4164ff=_0x4164ff-0x0;var _0x226d47=_0x2274[_0x4164ff];return _0x226d47;};'use strict';var _=require(_0x4227('0x0'));var util=require(_0x4227('0x1'));var moment=require(_0x4227('0x2'));var BPromise=require(_0x4227('0x3'));var rs=require(_0x4227('0x4'));var fs=require('fs');var Redis=require(_0x4227('0x5'));var db=require(_0x4227('0x6'))['db'];var utils=require(_0x4227('0x7'));var logger=require('../../config/logger')(_0x4227('0x8'));var config=require(_0x4227('0x9'));var jayson=require(_0x4227('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x209752,_0x58a018,_0x1c6527){return new BPromise(function(_0x51498b,_0x274b78){return client['request'](_0x209752,_0x1c6527)[_0x4227('0xb')](function(_0x44e8ef){logger[_0x4227('0xc')](_0x4227('0xd'),_0x58a018,_0x4227('0xe'));logger['debug'](_0x4227('0xf'),_0x58a018,_0x4227('0xe'),JSON[_0x4227('0x10')](_0x44e8ef));if(_0x44e8ef[_0x4227('0x11')]){if(_0x44e8ef[_0x4227('0x11')][_0x4227('0x12')]===0x1f4){logger[_0x4227('0x11')](_0x4227('0xd'),_0x58a018,_0x44e8ef[_0x4227('0x11')]['message']);return _0x274b78(_0x44e8ef[_0x4227('0x11')][_0x4227('0x13')]);}logger[_0x4227('0x11')](_0x4227('0xd'),_0x58a018,_0x44e8ef['error']['message']);return _0x51498b(_0x44e8ef['error']['message']);}else{logger[_0x4227('0xc')](_0x4227('0xd'),_0x58a018,_0x4227('0xe'));_0x51498b(_0x44e8ef['result'][_0x4227('0x13')]);}})[_0x4227('0x14')](function(_0x507864){logger[_0x4227('0x11')](_0x4227('0xd'),_0x58a018,_0x507864);_0x274b78(_0x507864);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a06c4da..2589c0d 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 _0xaf8d=['getContacts','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts'];(function(_0x2002a6,_0x2b870f){var _0x5e605e=function(_0x270382){while(--_0x270382){_0x2002a6['push'](_0x2002a6['shift']());}};_0x5e605e(++_0x2b870f);}(_0xaf8d,0x1d4));var _0xdaf8=function(_0x50248c,_0x1f7c71){_0x50248c=_0x50248c-0x0;var _0x20094f=_0xaf8d[_0x50248c];return _0x20094f;};'use strict';var multer=require(_0xdaf8('0x0'));var util=require(_0xdaf8('0x1'));var path=require(_0xdaf8('0x2'));var timeout=require(_0xdaf8('0x3'));var express=require(_0xdaf8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdaf8('0x5'));var interaction=require(_0xdaf8('0x6'));var config=require(_0xdaf8('0x7'));var controller=require('./cmCompany.controller');router[_0xdaf8('0x8')]('/',auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xa')]);router[_0xdaf8('0x8')](_0xdaf8('0xb'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xc')]);router['get'](_0xdaf8('0xd'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0xe')]);router['get'](_0xdaf8('0xf'),auth[_0xdaf8('0x9')](),controller[_0xdaf8('0x10')]);router[_0xdaf8('0x11')]('/',auth[_0xdaf8('0x9')](),controller[_0xdaf8('0x12')]);router['post']('/:id/contacts',auth[_0xdaf8('0x9')](),controller['addContacts']);router[_0xdaf8('0x13')](_0xdaf8('0xd'),auth[_0xdaf8('0x9')](),controller['update']);router['delete'](_0xdaf8('0xd'),auth['isAuthenticated'](),controller[_0xdaf8('0x14')]);module[_0xdaf8('0x15')]=router; \ No newline at end of file +var _0x532c=['/:id/contacts','post','create','addContacts','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','describe','/:id','isAuthenticated','show'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x532c,0xbb));var _0xc532=function(_0xe6f4dc,_0x4bd94a){_0xe6f4dc=_0xe6f4dc-0x0;var _0x1e9ede=_0x532c[_0xe6f4dc];return _0x1e9ede;};'use strict';var multer=require(_0xc532('0x0'));var util=require(_0xc532('0x1'));var path=require('path');var timeout=require(_0xc532('0x2'));var express=require(_0xc532('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc532('0x4'));var interaction=require(_0xc532('0x5'));var config=require(_0xc532('0x6'));var controller=require(_0xc532('0x7'));router[_0xc532('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc532('0x9')]);router[_0xc532('0x8')](_0xc532('0xa'),auth[_0xc532('0xb')](),controller[_0xc532('0xc')]);router[_0xc532('0x8')](_0xc532('0xd'),auth[_0xc532('0xb')](),controller['getContacts']);router[_0xc532('0xe')]('/',auth['isAuthenticated'](),controller[_0xc532('0xf')]);router[_0xc532('0xe')](_0xc532('0xd'),auth[_0xc532('0xb')](),controller[_0xc532('0x10')]);router['put'](_0xc532('0xa'),auth[_0xc532('0xb')](),controller[_0xc532('0x11')]);router['delete'](_0xc532('0xa'),auth['isAuthenticated'](),controller[_0xc532('0x12')]);module[_0xc532('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 81e89f8..ddd24c2 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 _0xb690=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb690,0x1af));var _0x0b69=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0xb690[_0x183256];return _0x5394a2;};'use strict';var _=require(_0x0b69('0x0'));var Sequelize=require(_0x0b69('0x1'));module[_0x0b69('0x2')]={'firstName':{'type':Sequelize[_0x0b69('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0b69('0x3')]},'street':{'type':Sequelize[_0x0b69('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0b69('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0b69('0x3')]},'description':{'type':Sequelize[_0x0b69('0x4')]},'phone':{'type':Sequelize[_0x0b69('0x3')]},'mobile':{'type':Sequelize[_0x0b69('0x3')]},'fax':{'type':Sequelize[_0x0b69('0x3')]},'email':{'type':Sequelize[_0x0b69('0x3')]},'url':{'type':Sequelize[_0x0b69('0x3')]},'facebook':{'type':Sequelize[_0x0b69('0x3')]},'fb_data':{'type':Sequelize[_0x0b69('0x3')]},'twitter':{'type':Sequelize[_0x0b69('0x3')]},'skype':{'type':Sequelize[_0x0b69('0x3')]},'teams':{'type':Sequelize[_0x0b69('0x3')]},'viber':{'type':Sequelize[_0x0b69('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x0b69('0x3')]},'telegram':{'type':Sequelize[_0x0b69('0x3')]},'UserId':{'type':Sequelize[_0x0b69('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x0b69('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0b69('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0b69('0x7')],'defaultValue':Sequelize[_0x0b69('0x8')]},'dialTimezone':{'type':Sequelize[_0x0b69('0x3')]},'utcOffset':{'type':Sequelize[_0x0b69('0x5')]}}; \ No newline at end of file +var _0xc6cb=['sequelize','exports','STRING','TEXT','INTEGER','NOW'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xc6cb,0xc6));var _0xbc6c=function(_0x547a87,_0x4d4e24){_0x547a87=_0x547a87-0x0;var _0x11fde1=_0xc6cb[_0x547a87];return _0x11fde1;};'use strict';var _=require('lodash');var Sequelize=require(_0xbc6c('0x0'));module[_0xbc6c('0x1')]={'firstName':{'type':Sequelize[_0xbc6c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbc6c('0x2')]},'street':{'type':Sequelize[_0xbc6c('0x2')]},'postalCode':{'type':Sequelize[_0xbc6c('0x2')]},'city':{'type':Sequelize[_0xbc6c('0x2')]},'country':{'type':Sequelize[_0xbc6c('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbc6c('0x2')]},'description':{'type':Sequelize[_0xbc6c('0x3')]},'phone':{'type':Sequelize[_0xbc6c('0x2')]},'mobile':{'type':Sequelize[_0xbc6c('0x2')]},'fax':{'type':Sequelize[_0xbc6c('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xbc6c('0x2')]},'facebook':{'type':Sequelize[_0xbc6c('0x2')]},'fb_data':{'type':Sequelize[_0xbc6c('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xbc6c('0x2')]},'teams':{'type':Sequelize[_0xbc6c('0x2')]},'viber':{'type':Sequelize[_0xbc6c('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xbc6c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xbc6c('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xbc6c('0x5')]},'dialTimezone':{'type':Sequelize[_0xbc6c('0x2')]},'utcOffset':{'type':Sequelize[_0xbc6c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ffdf8ed..1c47c58 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 _0xc9ac=['sms','openchannel','whatsapp','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','starttime','userSecondDisposition','userThirdDisposition','UserId','alias','createdAt','DESC','findAndCountAll','fullname','startCase','chat','Website','Account','closed','closedAt','note','secondDisposition','key','Owner','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','status','offset','undefined','count','set','json','update','then','end','sendStatus','error','stack','name','send','getOptions','findAll','query','user','CmContact','describe','tags','keys','cf_','columnName','CmCustomField','length','displayName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','catch','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','spread','contact','all','show','find','params','Tags','CmContactHasItem','ItemType','sequelize','Phones.OrderBy','cf_%d','$and','omit','pickBy','startsWith','map','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','values','phone','getTags','findOne','model','Tag','rawAttributes','filters','intersection','fields','attributes','order','sort','pick','filter','options','limit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','item','literal','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','createReadStream','parse','import','User','agent','No\x20ListId\x20specified','binding','fork','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xc9ac,0x129));var _0xcc9a=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xc9ac[_0x499210];return _0x2e153d;};'use strict';var moment=require(_0xcc9a('0x0'));var BPromise=require(_0xcc9a('0x1'));var util=require(_0xcc9a('0x2'));var path=require(_0xcc9a('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xcc9a('0x4'));var Redis=require(_0xcc9a('0x5'));var contacts=require(_0xcc9a('0x6'));var qs=require(_0xcc9a('0x7'));var logger=require(_0xcc9a('0x8'))('api');var config=require('../../config/environment');var shared=require(_0xcc9a('0x9'));var db=require(_0xcc9a('0xa'))['db'];config[_0xcc9a('0xb')]=_[_0xcc9a('0xc')](config[_0xcc9a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc9a('0xd'))['register'](socket);function respondWithResult(_0x2fa5e8,_0x22ce6c){_0x22ce6c=_0x22ce6c||0xc8;return function(_0x37a2b5){if(_0x37a2b5){return _0x2fa5e8[_0xcc9a('0xe')](_0x22ce6c)['json'](_0x37a2b5);}};}function respondWithFilteredResult(_0x8d133f,_0x46927b){return function(_0x595258){if(_0x595258){var _0x3a22f8=typeof _0x46927b[_0xcc9a('0xf')]===_0xcc9a('0x10')&&typeof _0x46927b['limit']===_0xcc9a('0x10');var _0x2d0ab1=_0x595258[_0xcc9a('0x11')];var _0x234c92=_0x3a22f8?0x0:_0x46927b[_0xcc9a('0xf')];var _0xcc13e4=_0x3a22f8?_0x595258['count']:_0x46927b[_0xcc9a('0xf')]+_0x46927b['limit'];var _0x129f17;if(_0xcc13e4>=_0x2d0ab1){_0xcc13e4=_0x2d0ab1;_0x129f17=0xc8;}else{_0x129f17=0xce;}_0x8d133f[_0xcc9a('0xe')](_0x129f17);return _0x8d133f[_0xcc9a('0x12')]('Content-Range',_0x234c92+'-'+_0xcc13e4+'/'+_0x2d0ab1)[_0xcc9a('0x13')](_0x595258);}return null;};}function saveUpdates(_0x38c374){return function(_0x3bce33){if(_0x3bce33){return _0x3bce33[_0xcc9a('0x14')](_0x38c374)[_0xcc9a('0x15')](function(_0x52961a){return _0x52961a;});}return null;};}function removeEntity(_0x3a92b6){return function(_0x1277e9){if(_0x1277e9){return _0x1277e9['destroy']()['then'](function(){_0x3a92b6[_0xcc9a('0xe')](0xcc)[_0xcc9a('0x16')]();});}};}function handleEntityNotFound(_0x29ccbf){return function(_0x5efd87){if(!_0x5efd87){_0x29ccbf[_0xcc9a('0x17')](0x194);}return _0x5efd87;};}function handleError(_0x35ce5e,_0x4d8e91){_0x4d8e91=_0x4d8e91||0x1f4;return function(_0x142f85){logger[_0xcc9a('0x18')](_0x142f85[_0xcc9a('0x19')]);if(_0x142f85[_0xcc9a('0x1a')]){delete _0x142f85[_0xcc9a('0x1a')];}_0x35ce5e[_0xcc9a('0xe')](_0x4d8e91)[_0xcc9a('0x1b')](_0x142f85);};}exports['index']=function(_0x3aa33d,_0x20916b){var _0x34768b={};return contacts['describe']()[_0xcc9a('0x15')](function(_0x5ec790){_0x34768b=qs[_0xcc9a('0x1c')](_0x5ec790,_0x3aa33d);return contacts[_0xcc9a('0x1d')](_0x3aa33d[_0xcc9a('0x1e')],_0x3aa33d[_0xcc9a('0x1f')],_0x34768b,_0x5ec790);})[_0xcc9a('0x15')](respondWithFilteredResult(_0x20916b,_0x34768b))['catch'](handleError(_0x20916b,null));};exports['destroy']=function(_0x248402,_0x4a216d){return db[_0xcc9a('0x20')]['find']({'where':{'id':_0x248402['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x4a216d,null))[_0xcc9a('0x15')](removeEntity(_0x4a216d,null))['catch'](handleError(_0x4a216d,null));};exports['describe']=function(_0x513021,_0x3defba){return db['CmContact'][_0xcc9a('0x21')]()[_0xcc9a('0x15')](function(_0xcde81e){delete _0xcde81e[_0xcc9a('0x22')];for(var _0x5e5287=0x0;_0x5e52870x0){return new Promise(function(_0x53fafe){var _0xd2508e=[];for(var _0x3ed251=0x0;_0x3ed251<_0x5eb148[_0xcc9a('0x27')];_0x3ed251++){_0xd2508e[_0xcc9a('0x54')](insertAdditionalPhones(_0x5eb148[_0x3ed251][_0xcc9a('0x57')],_0x5eb148[_0x3ed251][_0xcc9a('0x4f')]));}Promise[_0xcc9a('0x58')](_0xd2508e)['then'](function(){_0x53fafe(0x1);});})['then'](function(){return{'success':_0x292077,'failure':_0x18a403,'duplicates':_0x28569d};});}else{return{'success':_0x292077,'failure':_0x18a403,'duplicates':_0x28569d};}}})['then'](respondWithResult(_0x146740,0xc9))[_0xcc9a('0x2f')](handleError(_0x146740,null));};exports[_0xcc9a('0x59')]=function(_0x2aa88b,_0x1b1b0c){var _0x16ecca;return db['CmContact'][_0xcc9a('0x21')]()[_0xcc9a('0x15')](function(_0x2dc808){return db[_0xcc9a('0x20')][_0xcc9a('0x5a')]({'where':{'id':_0x2aa88b[_0xcc9a('0x5b')]['id']},'include':[{'model':db['Tag'],'as':_0xcc9a('0x5c'),'attributes':['id',_0xcc9a('0x1a'),'color'],'required':_0x2aa88b[_0xcc9a('0x1e')]['tag']?!![]:![]},{'model':db[_0xcc9a('0x5d')],'as':'Phones','where':{'CmContactId':_0x2aa88b[_0xcc9a('0x5b')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xcc9a('0x5e')}]}],'order':[db[_0xcc9a('0x5f')]['literal'](_0xcc9a('0x60'))],'attributes':_[_0xcc9a('0x23')](_0x2dc808)});})[_0xcc9a('0x15')](function(_0x38a72a){if(!_['isNil'](_0x38a72a)){_0x16ecca=_0x38a72a[_0xcc9a('0x33')]({'plain':!![]});var _0x3f1d70={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x38a72a&&_0x38a72a[_0xcc9a('0x55')]){if(_0x38a72a[_0xcc9a('0x55')]){_0x3f1d70[_0xcc9a('0x52')]['$and']['push']({'ListId':{'$ne':_0x38a72a[_0xcc9a('0x55')]}});}}return db['CmCustomField'][_0xcc9a('0x1d')](_0x3f1d70);}})[_0xcc9a('0x15')](function(_0x2c19d2){if(!_[_0xcc9a('0x4b')](_0x2c19d2)){return _['omit'](_0x16ecca,_['map'](_0x2c19d2,function(_0x16ea2f){return util['format'](_0xcc9a('0x61'),_0x16ea2f['id']);}));}})[_0xcc9a('0x15')](handleEntityNotFound(_0x1b1b0c,null))[_0xcc9a('0x15')](respondWithResult(_0x1b1b0c,null))['catch'](handleError(_0x1b1b0c,null));};exports['update']=function(_0x2a5c03,_0x5b343d){var _0x13ba10;if(_0x2a5c03[_0xcc9a('0x31')]['id']){delete _0x2a5c03[_0xcc9a('0x31')]['id'];}if(!_['isNil'](_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x4c')])){var _0x309a28=_0x2a5c03['body'][_0xcc9a('0x4c')];if(!_['isNil'](shared[_0xcc9a('0x4d')][_0x309a28]))_0x2a5c03['body']['utcOffset']=shared[_0xcc9a('0x4d')][_0x309a28][_0xcc9a('0x4e')];}return db['CmContact'][_0xcc9a('0x5a')]({'where':{'id':_0x2a5c03[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x5b343d,null))[_0xcc9a('0x15')](saveUpdates(_0x2a5c03[_0xcc9a('0x31')],null))[_0xcc9a('0x15')](function(_0x2f746d){_0x13ba10=_0x2f746d;var _0x128f83={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f746d&&_0x2f746d['ListId']){if(_0x2f746d[_0xcc9a('0x55')]){_0x128f83['where'][_0xcc9a('0x62')][_0xcc9a('0x54')]({'ListId':{'$ne':_0x2f746d[_0xcc9a('0x55')]}});}}return db[_0xcc9a('0x26')][_0xcc9a('0x1d')](_0x128f83);})[_0xcc9a('0x15')](function(_0x1cc95d){if(_0x1cc95d){return _[_0xcc9a('0x63')](_[_0xcc9a('0x64')](_0x2a5c03[_0xcc9a('0x31')],function(_0x1638e9,_0x6b3df2){return _[_0xcc9a('0x65')](_0x6b3df2,_0xcc9a('0x24'));}),_[_0xcc9a('0x66')](_0x1cc95d,function(_0x315ef2){return util[_0xcc9a('0x67')](_0xcc9a('0x61'),_0x315ef2['id']);}));}})[_0xcc9a('0x15')](function(_0x3a3fe9){if(_0x3a3fe9&&!_[_0xcc9a('0x68')](_0x3a3fe9)){var _0x4e8128=squel['update']()[_0xcc9a('0x69')](_0xcc9a('0x6a'))['setFields'](_0x3a3fe9)['where'](_0xcc9a('0x6b'),_0x2a5c03[_0xcc9a('0x5b')]['id'])[_0xcc9a('0x6c')]();return db[_0xcc9a('0x5f')][_0xcc9a('0x1e')](_0x4e8128['text'],{'replacements':_0x4e8128[_0xcc9a('0x6d')]});}})[_0xcc9a('0x15')](function(){if(_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x6e')]&&_0x13ba10){return db[_0xcc9a('0x37')][_0xcc9a('0x14')]({'phone':_0x2a5c03[_0xcc9a('0x31')][_0xcc9a('0x6e')],'OrderBy':0x0},{'where':{'ContactId':_0x13ba10['id']}});}})[_0xcc9a('0x15')](function(){return _0x13ba10;})[_0xcc9a('0x15')](respondWithResult(_0x5b343d,null))[_0xcc9a('0x2f')](handleError(_0x5b343d,null));};exports[_0xcc9a('0x6f')]=function(_0x476b5e,_0x1d0b6f){var _0x5180e6={};var _0x527aa0={};var _0x10ae68;var _0x5bfbaf;return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x476b5e[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x1d0b6f,null))[_0xcc9a('0x15')](function(_0x1b1903){if(_0x1b1903){_0x10ae68=_0x1b1903;_0x527aa0[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x72')][_0xcc9a('0x73')]);_0x527aa0['query']=_[_0xcc9a('0x23')](_0x476b5e[_0xcc9a('0x1e')]);_0x527aa0[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x527aa0['model'],_0x527aa0['query']);_0x5180e6['attributes']=_[_0xcc9a('0x75')](_0x527aa0[_0xcc9a('0x71')],qs[_0xcc9a('0x76')](_0x476b5e['query'][_0xcc9a('0x76')]));_0x5180e6[_0xcc9a('0x77')]=_0x5180e6[_0xcc9a('0x77')][_0xcc9a('0x27')]?_0x5180e6['attributes']:_0x527aa0[_0xcc9a('0x71')];_0x5180e6[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x79')]);_0x5180e6[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x476b5e[_0xcc9a('0x1e')],_0x527aa0[_0xcc9a('0x74')]));if(_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0x5180e6[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0x5180e6['where'],{'$or':_[_0xcc9a('0x66')](_0x5180e6[_0xcc9a('0x77')],function(_0x34edb5){var _0x48a4bc={};_0x48a4bc[_0x34edb5]={'$like':'%'+_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x48a4bc;})});}_0x5180e6=_[_0xcc9a('0x30')]({},_0x5180e6,_0x476b5e[_0xcc9a('0x7c')]);return _0x10ae68[_0xcc9a('0x6f')](_0x5180e6);}})[_0xcc9a('0x15')](function(_0x34cd20){if(_0x34cd20){_0x5bfbaf=_0x34cd20[_0xcc9a('0x27')];if(!_0x476b5e[_0xcc9a('0x1e')]['hasOwnProperty']('nolimit')){_0x5180e6[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x476b5e[_0xcc9a('0x1e')]['limit']);_0x5180e6[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x476b5e[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}return _0x10ae68[_0xcc9a('0x6f')](_0x5180e6);}})['then'](function(_0x20eac2){if(_0x20eac2){return _0x20eac2?{'count':_0x5bfbaf,'rows':_0x20eac2}:null;}})[_0xcc9a('0x15')](respondWithResult(_0x1d0b6f,null))['catch'](handleError(_0x1d0b6f,null));};exports[_0xcc9a('0x7e')]=function(_0xbc0891,_0x570d22){if(_0xbc0891[_0xcc9a('0x31')]['id']){delete _0xbc0891[_0xcc9a('0x31')]['id'];}return db['CmContact'][_0xcc9a('0x70')]({'where':{'id':_0xbc0891[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x570d22,null))[_0xcc9a('0x15')](function(_0x35dd1c){if(_0x35dd1c){return _0x35dd1c[_0xcc9a('0x7e')](_0xbc0891[_0xcc9a('0x31')][_0xcc9a('0x7f')]||[]);}return null;})['then'](respondWithResult(_0x570d22,null))['catch'](handleError(_0x570d22,null));};exports[_0xcc9a('0x80')]=function(_0x3650cc,_0x2931f4){var _0x1a986b=[];_0x1a986b[_0xcc9a('0x54')](addAdditionalPhones(_0x3650cc[_0xcc9a('0x31')]));Promise[_0xcc9a('0x58')](_0x1a986b)[_0xcc9a('0x15')](function(){_0x1a986b=[];_0x1a986b[_0xcc9a('0x54')](deleteCmHopperPhones(_0x3650cc['body']['id']));_0x1a986b[_0xcc9a('0x54')](addCmHopperPhones(_0x3650cc[_0xcc9a('0x31')]['id']));Promise[_0xcc9a('0x58')](_0x1a986b)[_0xcc9a('0x15')](function(){return[0x1];})['then'](respondWithResult(_0x2931f4,null));});};function addAdditionalPhones(_0x9dcbf6){var _0x35123b;return new Promise(function(_0x1e81bf){return db[_0xcc9a('0x5d')][_0xcc9a('0x38')]({'where':{'CmContactId':_0x9dcbf6['id']}})[_0xcc9a('0x15')](function(){db[_0xcc9a('0x81')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id',_0xcc9a('0x82')]})['then'](function(_0x7713e0){var _0x4a941b=[];for(var _0x1b39e8=0x0;_0x1b39e8<_0x9dcbf6[_0xcc9a('0x83')][_0xcc9a('0x27')];_0x1b39e8++){var _0x3917d6=_0x9dcbf6[_0xcc9a('0x84')]?_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])?'':_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8]:_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x85')]?_0x9dcbf6['items'][_0x1b39e8][_0xcc9a('0x85')]:'';var _0x4abd7c=_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['description'])?'':_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['description'];var _0x277d06=_0x3917d6+':'+_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x6e')]+'§'+_0x4abd7c;if(_[_0xcc9a('0x4b')](_0x35123b))_0x35123b=_0x277d06;else _0x35123b+=';'+_0x277d06;var _0x86db=null;var _0x16ed7d=null;if(_0x9dcbf6[_0xcc9a('0x84')]){if(!_[_0xcc9a('0x4b')](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])){_0x16ed7d=_[_0xcc9a('0x5a')](_0x7713e0,function(_0x5dca2a){return _0x5dca2a['id']===_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8];});if(!_[_0xcc9a('0x4b')](_0x16ed7d)){_0x86db=_0x16ed7d[_0xcc9a('0x82')];}}}else{if(!_[_0xcc9a('0x4b')](_0x9dcbf6['items'][_0x1b39e8])){_0x16ed7d=_[_0xcc9a('0x5a')](_0x7713e0,function(_0xd8895c){return _0xd8895c['id']===_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['ItemTypeId'];});if(!_[_0xcc9a('0x4b')](_0x16ed7d)){_0x86db=_0x1b39e8;}}}if(_[_0xcc9a('0x4b')](_0x86db)){_0x86db=0x64;}_0x4a941b[_0xcc9a('0x54')](addAdditionalPhone(_0x9dcbf6['id'],_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8][_0xcc9a('0x6e')],_0x9dcbf6[_0xcc9a('0x84')]?_['isNil'](_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8])?null:_0x9dcbf6[_0xcc9a('0x84')][_0x1b39e8]:_0x9dcbf6['items'][_0x1b39e8][_0xcc9a('0x85')]?_0x9dcbf6[_0xcc9a('0x83')][_0x1b39e8]['ItemTypeId']:null,_0x86db,_0x4abd7c));}Promise[_0xcc9a('0x58')](_0x4a941b)['then'](function(){db[_0xcc9a('0x20')]['update']({'AdditionalPhones':_0x35123b},{'where':{'id':_0x9dcbf6['id']}})['then'](function(){_0x1e81bf(0x1);});});});});});}function addAdditionalPhone(_0x3e2acd,_0x313e9e,_0x368fbd,_0xf3889a,_0x227fe2){return db[_0xcc9a('0x5d')][_0xcc9a('0x5a')]({'where':{'CmContactId':_0x3e2acd,'item':_0x313e9e}})[_0xcc9a('0x15')](function(_0x44b3e0){if(_0x44b3e0)logger[_0xcc9a('0x2b')](_0xcc9a('0x86'),_0x44b3e0);else{db[_0xcc9a('0x5d')][_0xcc9a('0x3b')]({'CmContactId':_0x3e2acd,'item':_0x313e9e,'ItemTypeId':_0x368fbd,'OrderBy':_0xf3889a,'ItemClass':'PHONE','description':_0x227fe2});}});}function deleteCmHopperPhones(_0x566f81){return new Promise(function(_0x2d0ab2){return db[_0xcc9a('0x37')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x566f81}})['then'](function(_0x43c756){db['CmHopperAdditionalPhone'][_0xcc9a('0x38')]({'where':{'CmHopperId':{'$in':_['map'](_0x43c756,'id')}}});})[_0xcc9a('0x15')](function(){_0x2d0ab2(0x1);});});}function addCmHopperPhones(_0x1404b2){return new Promise(function(_0x275925){return db['CmHopper'][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1404b2}})[_0xcc9a('0x15')](function(_0x1dee35){var _0x1eb391=[];_[_0xcc9a('0x66')](_0x1dee35,function(_0x2fa694){_0x1eb391[_0xcc9a('0x54')](createCmHopperPhone(_0x1404b2,_0x2fa694['id']));});Promise['all'](_0x1eb391)[_0xcc9a('0x15')](function(){_0x275925(0x1);});});});}function createCmHopperPhone(_0x3b3bb5,_0x183703){return new Promise(function(_0x5ed337){db['CmContactHasItem'][_0xcc9a('0x1d')]({'raw':!![],'attributes':[_0xcc9a('0x87'),_0xcc9a('0x82')],'where':{'CmContactId':_0x3b3bb5,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0xcc9a('0x82')],'as':'ItemType'}],'order':[_0xcc9a('0x82'),db[_0xcc9a('0x5f')][_0xcc9a('0x88')](_0xcc9a('0x89'))]})[_0xcc9a('0x15')](function(_0x33d75b){var _0xccfe1a=0x1;var _0x2e0e98=_[_0xcc9a('0x66')](_0x33d75b,function(_0x5fc9a){_0x5fc9a[_0xcc9a('0x8a')]=_0x183703;_0x5fc9a['phone']=_0x5fc9a[_0xcc9a('0x87')];_0x5fc9a['OrderBy']=_0xccfe1a;delete _0x5fc9a['ItemType.OrderBy'];_0xccfe1a=_0xccfe1a+0x1;return _0x5fc9a;});return db[_0xcc9a('0x8b')][_0xcc9a('0x8c')](_0x2e0e98,{});})[_0xcc9a('0x15')](function(){_0x5ed337(0x1);});});}function insertAdditionalPhones(_0x101b64,_0xc7803b){return new Promise(function(_0x3265da){var _0x29b78f=[];for(var _0x145288=0x0;_0x145288<_0xc7803b[_0xcc9a('0x27')];_0x145288++){var _0x2f9e31=_0xc7803b[_0x145288];_0x29b78f['push'](parseContactItemType(_0x2f9e31));}Promise['all'](_0x29b78f)[_0xcc9a('0x15')](function(){var _0x473dd2={'id':_0x101b64['id'],'items':_0xc7803b};return addAdditionalPhones(_0x473dd2)[_0xcc9a('0x15')](function(){return addCmHopperPhones(_0x101b64['id']);});})['then'](function(){_0x3265da(_0x101b64);});});}function parseContactItemType(_0x3f269f){return new Promise(function(_0x31e9d7){if(_0x3f269f[_0xcc9a('0x2e')]('ItemTypeId')){_0x31e9d7(_0x3f269f);}else{return db['ContactItemType'][_0xcc9a('0x5a')]({'where':{'name':_0x3f269f['ItemType']}})[_0xcc9a('0x15')](function(_0x86435d){if(_[_0xcc9a('0x4b')](_0x86435d))_0x3f269f['ItemTypeId']=null;else _0x3f269f[_0xcc9a('0x85')]=_0x86435d['id'];_0x31e9d7(_0x3f269f);});}});}exports[_0xcc9a('0x8d')]=function(_0x2a4bd6,_0x23a087){return db[_0xcc9a('0x5d')][_0xcc9a('0x1d')]({'raw':!![],'where':{'CmContactId':_0x2a4bd6[_0xcc9a('0x5b')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xcc9a('0x81')],'as':'ItemType'}],'order':[[_0xcc9a('0x82')],[db[_0xcc9a('0x5f')][_0xcc9a('0x88')](_0xcc9a('0x89'))]]})[_0xcc9a('0x15')](function(_0x586fa7){return _0x586fa7;})['then'](respondWithResult(_0x23a087,null))[_0xcc9a('0x2f')](handleError(_0x23a087,null));};exports[_0xcc9a('0x8e')]=function(_0x46e613,_0x22fddc){return db[_0xcc9a('0x5d')]['findAll']({'raw':!![],'where':{'CmContactId':_0x46e613['body'][_0xcc9a('0x8f')]}})['then'](function(_0x2d510a){var _0x3f6819=_[_0xcc9a('0x66')](_0x2d510a,function(_0x4a3a31){_0x4a3a31['CmContactId']=_0x46e613[_0xcc9a('0x31')][_0xcc9a('0x90')];return _0x4a3a31;});return db[_0xcc9a('0x5d')]['bulkCreate'](_0x3f6819,{});})[_0xcc9a('0x15')](function(){return addCmHopperPhones(_0x46e613[_0xcc9a('0x31')][_0xcc9a('0x90')]);})['then'](function(){return['ok'];})[_0xcc9a('0x15')](respondWithResult(_0x22fddc,null))[_0xcc9a('0x2f')](handleError(_0x22fddc,null));};exports[_0xcc9a('0x91')]=function(_0x7bd2ee,_0x295152){var _0x475e0b=[];_0x475e0b[_0xcc9a('0x54')](createCmHopperPhone(_0x7bd2ee[_0xcc9a('0x31')]['id'],_0x7bd2ee[_0xcc9a('0x31')][_0xcc9a('0x92')]));Promise['all'](_0x475e0b)[_0xcc9a('0x15')](function(){return[0x1];})[_0xcc9a('0x15')](respondWithResult(_0x295152,null));};exports['getHoppers']=function(_0x274bf3,_0x336a8a){var _0x5f529a={'raw':![],'where':{}};var _0x1e512b={};var _0x1bae14={'count':0x0,'rows':[]};return db['CmContact'][_0xcc9a('0x70')]({'where':{'id':_0x274bf3['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x336a8a,null))[_0xcc9a('0x15')](function(_0x148e38){if(_0x148e38){_0x1e512b[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x37')][_0xcc9a('0x73')]);_0x1e512b[_0xcc9a('0x1e')]=_[_0xcc9a('0x23')](_0x274bf3[_0xcc9a('0x1e')]);_0x1e512b[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x1e512b[_0xcc9a('0x71')],_0x1e512b[_0xcc9a('0x1e')]);_0x5f529a['attributes']=_[_0xcc9a('0x75')](_0x1e512b[_0xcc9a('0x71')],qs[_0xcc9a('0x76')](_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x76')]));_0x5f529a[_0xcc9a('0x77')]=_0x5f529a[_0xcc9a('0x77')]['length']?_0x5f529a[_0xcc9a('0x77')]:_0x1e512b['model'];if(!_0x274bf3[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0x5f529a[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x7d')]);_0x5f529a[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x274bf3['query'][_0xcc9a('0xf')]);}_0x5f529a[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x274bf3['query'][_0xcc9a('0x79')]);_0x5f529a['where']=qs['filters'](_[_0xcc9a('0x7a')](_0x274bf3[_0xcc9a('0x1e')],_0x1e512b[_0xcc9a('0x74')]));_0x5f529a[_0xcc9a('0x52')][_0xcc9a('0x94')]=_0x148e38['id'];if(_0x274bf3['query']['filter']){_0x5f529a[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0x5f529a[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x5f529a[_0xcc9a('0x77')],function(_0x3a242a){var _0x42ba47={};_0x42ba47[_0x3a242a]={'$like':'%'+_0x274bf3[_0xcc9a('0x1e')]['filter']+'%'};return _0x42ba47;})});}_0x5f529a=_[_0xcc9a('0x30')]({},_0x5f529a,_0x274bf3[_0xcc9a('0x7c')]);return db['CmHopper'][_0xcc9a('0x11')]({'where':_0x5f529a[_0xcc9a('0x52')]})[_0xcc9a('0x15')](function(_0x5b0aa2){_0x1bae14['count']=_0x5b0aa2;if(_0x274bf3[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x5f529a[_0xcc9a('0x96')]=[{'all':!![]}];}return db[_0xcc9a('0x37')][_0xcc9a('0x1d')](_0x5f529a);})[_0xcc9a('0x15')](function(_0x52f26c){_0x1bae14[_0xcc9a('0x97')]=_0x52f26c;return _0x1bae14;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x336a8a,_0x5f529a))[_0xcc9a('0x2f')](handleError(_0x336a8a,null));};exports[_0xcc9a('0x98')]=function(_0x2dabce,_0x57f167){var _0x3d25b5={'raw':!![],'where':{}};var _0x137092={};var _0x4f82c3={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')]['findOne']({'where':{'id':_0x2dabce[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x57f167,null))[_0xcc9a('0x15')](function(_0x55ff07){if(_0x55ff07){_0x137092[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db['CmHopperHistory'][_0xcc9a('0x73')]);_0x137092[_0xcc9a('0x1e')]=_[_0xcc9a('0x23')](_0x2dabce['query']);_0x137092[_0xcc9a('0x74')]=_[_0xcc9a('0x75')](_0x137092[_0xcc9a('0x71')],_0x137092[_0xcc9a('0x1e')]);_0x3d25b5[_0xcc9a('0x77')]=_[_0xcc9a('0x75')](_0x137092['model'],qs[_0xcc9a('0x76')](_0x2dabce[_0xcc9a('0x1e')]['fields']));_0x3d25b5[_0xcc9a('0x77')]=_0x3d25b5[_0xcc9a('0x77')]['length']?_0x3d25b5[_0xcc9a('0x77')]:_0x137092['model'];if(!_0x2dabce[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0x3d25b5[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x7d')]);_0x3d25b5['offset']=qs['offset'](_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}_0x3d25b5['order']=qs[_0xcc9a('0x79')](_0x2dabce[_0xcc9a('0x1e')]['sort']);_0x3d25b5[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x2dabce['query'],_0x137092['filters']));_0x3d25b5[_0xcc9a('0x52')]['ContactId']=_0x55ff07['id'];if(_0x2dabce['query'][_0xcc9a('0x7b')]){_0x3d25b5['where']=_[_0xcc9a('0x30')](_0x3d25b5[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x3d25b5[_0xcc9a('0x77')],function(_0x204aa8){var _0x39df45={};_0x39df45[_0x204aa8]={'$like':'%'+_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x39df45;})});}_0x3d25b5=_[_0xcc9a('0x30')]({},_0x3d25b5,_0x2dabce[_0xcc9a('0x7c')]);return db[_0xcc9a('0x44')][_0xcc9a('0x11')]({'where':_0x3d25b5['where']})['then'](function(_0x995ef3){_0x4f82c3[_0xcc9a('0x11')]=_0x995ef3;if(_0x2dabce[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x3d25b5['include']=[{'all':!![]}];}return db[_0xcc9a('0x44')][_0xcc9a('0x1d')](_0x3d25b5);})[_0xcc9a('0x15')](function(_0x2e98b7){_0x4f82c3[_0xcc9a('0x97')]=_0x2e98b7;return _0x4f82c3;});}})['then'](respondWithFilteredResult(_0x57f167,_0x3d25b5))[_0xcc9a('0x2f')](handleError(_0x57f167,null));};exports['getHopperFinals']=function(_0x37503f,_0x431658){var _0x11cead={'raw':!![],'where':{}};var _0x5de718={};var _0x143a8b={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x37503f['params']['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x431658,null))['then'](function(_0x30667b){if(_0x30667b){_0x5de718[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x43')][_0xcc9a('0x73')]);_0x5de718[_0xcc9a('0x1e')]=_['keys'](_0x37503f[_0xcc9a('0x1e')]);_0x5de718['filters']=_['intersection'](_0x5de718['model'],_0x5de718[_0xcc9a('0x1e')]);_0x11cead[_0xcc9a('0x77')]=_['intersection'](_0x5de718['model'],qs['fields'](_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x76')]));_0x11cead[_0xcc9a('0x77')]=_0x11cead[_0xcc9a('0x77')]['length']?_0x11cead[_0xcc9a('0x77')]:_0x5de718[_0xcc9a('0x71')];if(!_0x37503f['query'][_0xcc9a('0x2e')]('nolimit')){_0x11cead[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x37503f[_0xcc9a('0x1e')]['limit']);_0x11cead[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x37503f['query']['offset']);}_0x11cead[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x37503f[_0xcc9a('0x1e')]['sort']);_0x11cead[_0xcc9a('0x52')]=qs[_0xcc9a('0x74')](_[_0xcc9a('0x7a')](_0x37503f['query'],_0x5de718[_0xcc9a('0x74')]));_0x11cead[_0xcc9a('0x52')]['ContactId']=_0x30667b['id'];if(_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0x11cead['where']=_['merge'](_0x11cead[_0xcc9a('0x52')],{'$or':_[_0xcc9a('0x66')](_0x11cead['attributes'],function(_0x3e7383){var _0x19bb47={};_0x19bb47[_0x3e7383]={'$like':'%'+_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x19bb47;})});}_0x11cead=_[_0xcc9a('0x30')]({},_0x11cead,_0x37503f[_0xcc9a('0x7c')]);return db[_0xcc9a('0x43')][_0xcc9a('0x11')]({'where':_0x11cead[_0xcc9a('0x52')]})[_0xcc9a('0x15')](function(_0x37ef51){_0x143a8b['count']=_0x37ef51;if(_0x37503f[_0xcc9a('0x1e')][_0xcc9a('0x95')]){_0x11cead[_0xcc9a('0x96')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc9a('0x1d')](_0x11cead);})[_0xcc9a('0x15')](function(_0x4a1827){_0x143a8b[_0xcc9a('0x97')]=_0x4a1827;return _0x143a8b;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x431658,_0x11cead))[_0xcc9a('0x2f')](handleError(_0x431658,null));};exports[_0xcc9a('0x99')]=function(_0x386899,_0x4382bb){var _0xa32e94={'raw':!![],'where':{}};var _0x36c872={};var _0x35cbf8={'count':0x0,'rows':[]};return db[_0xcc9a('0x20')][_0xcc9a('0x70')]({'where':{'id':_0x386899[_0xcc9a('0x5b')]['id']}})[_0xcc9a('0x15')](handleEntityNotFound(_0x4382bb,null))[_0xcc9a('0x15')](function(_0x31f275){if(_0x31f275){_0x36c872[_0xcc9a('0x71')]=_[_0xcc9a('0x23')](db[_0xcc9a('0x9a')]['rawAttributes']);_0x36c872[_0xcc9a('0x1e')]=_['keys'](_0x386899[_0xcc9a('0x1e')]);_0x36c872['filters']=_[_0xcc9a('0x75')](_0x36c872[_0xcc9a('0x71')],_0x36c872[_0xcc9a('0x1e')]);_0xa32e94['attributes']=_[_0xcc9a('0x75')](_0x36c872['model'],qs[_0xcc9a('0x76')](_0x386899['query'][_0xcc9a('0x76')]));_0xa32e94[_0xcc9a('0x77')]=_0xa32e94[_0xcc9a('0x77')][_0xcc9a('0x27')]?_0xa32e94[_0xcc9a('0x77')]:_0x36c872[_0xcc9a('0x71')];if(!_0x386899[_0xcc9a('0x1e')]['hasOwnProperty'](_0xcc9a('0x93'))){_0xa32e94[_0xcc9a('0x7d')]=qs[_0xcc9a('0x7d')](_0x386899[_0xcc9a('0x1e')]['limit']);_0xa32e94['offset']=qs[_0xcc9a('0xf')](_0x386899[_0xcc9a('0x1e')][_0xcc9a('0xf')]);}_0xa32e94[_0xcc9a('0x78')]=qs[_0xcc9a('0x79')](_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x79')]);_0xa32e94[_0xcc9a('0x52')]=qs['filters'](_[_0xcc9a('0x7a')](_0x386899['query'],_0x36c872[_0xcc9a('0x74')]));_0xa32e94[_0xcc9a('0x52')][_0xcc9a('0x94')]=_0x31f275['id'];if(_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x7b')]){_0xa32e94[_0xcc9a('0x52')]=_[_0xcc9a('0x30')](_0xa32e94[_0xcc9a('0x52')],{'$or':_['map'](_0xa32e94[_0xcc9a('0x77')],function(_0x507557){var _0x36f13d={};_0x36f13d[_0x507557]={'$like':'%'+_0x386899[_0xcc9a('0x1e')][_0xcc9a('0x7b')]+'%'};return _0x36f13d;})});}_0xa32e94=_[_0xcc9a('0x30')]({},_0xa32e94,_0x386899[_0xcc9a('0x7c')]);return db[_0xcc9a('0x9a')][_0xcc9a('0x11')]({'where':_0xa32e94[_0xcc9a('0x52')]})['then'](function(_0x9e46ce){_0x35cbf8['count']=_0x9e46ce;if(_0x386899['query'][_0xcc9a('0x95')]){_0xa32e94[_0xcc9a('0x96')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcc9a('0x1d')](_0xa32e94);})[_0xcc9a('0x15')](function(_0x47c2c6){_0x35cbf8[_0xcc9a('0x97')]=_0x47c2c6;return _0x35cbf8;});}})[_0xcc9a('0x15')](respondWithFilteredResult(_0x4382bb,_0xa32e94))['catch'](handleError(_0x4382bb,null));};exports[_0xcc9a('0x9b')]=function(_0x550804,_0x568d69){try{if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x55')]){throw new Error('No\x20ListId\x20specified');}if(!_0x550804['body'][_0xcc9a('0x9c')]){throw new Error(_0xcc9a('0x9d'));}if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9e')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x550804[_0xcc9a('0x31')]['socket_timestamp']){throw new Error(_0xcc9a('0x9f'));}var _0x523024=_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9c')][_0xcc9a('0xa0')](',');var _0xa122c5=_0x550804['body'][_0xcc9a('0x9e')][_0xcc9a('0xa0')](',');if(!_0x523024['length']||!_0xa122c5[_0xcc9a('0x27')]||_0x523024[_0xcc9a('0x27')]!==_0xa122c5['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x550804[_0xcc9a('0x31')]['fields']=_[_0xcc9a('0xa1')](_0x523024,_0xa122c5);if(!_0x550804['body']['fields']['phone']){throw new Error(_0xcc9a('0xa2'));}if(!_0x550804[_0xcc9a('0x31')][_0xcc9a('0x76')][_0xcc9a('0xa3')]){throw new Error(_0xcc9a('0xa4'));}var _0xfed53f=path['join'](config['root'],_0xcc9a('0xa5'),_0x550804[_0xcc9a('0xa6')][_0xcc9a('0xa7')]);fs['chmodSync'](_0xfed53f,parseInt(_0xcc9a('0xa8'),0x8));var _0x21c677=require(_0xcc9a('0xa9'))['fork'](path[_0xcc9a('0x35')](__dirname,_0xcc9a('0xaa')),[_0xfed53f,_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9c')],_0x550804[_0xcc9a('0x31')][_0xcc9a('0x9e')],_0x550804[_0xcc9a('0x31')]['ListId'],_0x550804[_0xcc9a('0x31')][_0xcc9a('0xab')],_0x550804[_0xcc9a('0x31')]['duplicates'],_0x550804[_0xcc9a('0x31')][_0xcc9a('0xac')]]);return _0x568d69[_0xcc9a('0xe')](0xc8)['json']({'message':_0xcc9a('0xad'),'pid':_0x21c677['pid']});}catch(_0x195321){return _0x568d69[_0xcc9a('0xe')](0x1f4)[_0xcc9a('0x1b')](_0x195321);}};exports['upload']=function(_0xc374eb,_0x373a51){var _0x3fff27=fs[_0xcc9a('0xae')](_0xc374eb[_0xcc9a('0xa6')][_0xcc9a('0x3')]);Papa[_0xcc9a('0xaf')](_0x3fff27,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x27c9fb){return _0x373a51['status'](0xc8)[_0xcc9a('0x13')]({'file':_0xc374eb[_0xcc9a('0xa6')],'fields':_0x27c9fb['meta'][_0xcc9a('0x76')]});}});};exports[_0xcc9a('0xb0')]=function(_0x45e940,_0x4ee52e){return db[_0xcc9a('0xb1')][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcc9a('0xb2')}})[_0xcc9a('0x15')](function(_0x3f5921){var _0x27a648=![];if(!_0x45e940[_0xcc9a('0x31')]['ListId']){throw new Error(_0xcc9a('0xb3'));}if(!_0x45e940[_0xcc9a('0x31')][_0xcc9a('0xb4')][_0xcc9a('0x6e')]){throw new Error(_0xcc9a('0xa2'));}if(!_0x45e940['body'][_0xcc9a('0xb4')]['firstName']){throw new Error(_0xcc9a('0xa4'));}if(!_0x45e940[_0xcc9a('0x31')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x139eb6=require(_0xcc9a('0xa9'))[_0xcc9a('0xb5')](path[_0xcc9a('0x35')](__dirname,'../../components/import/cm/csv2'),[_0x45e940[_0xcc9a('0x5b')]['id'],JSON[_0xcc9a('0xb6')](_0x45e940[_0xcc9a('0x31')]),JSON['stringify'](_0x3f5921)]);_0x139eb6['on'](_0xcc9a('0xb7'),function(){_0x27a648=!![];return _0x4ee52e[_0xcc9a('0xe')](0xc8)['json']({'message':_0xcc9a('0xb8'),'pid':_0x139eb6[_0xcc9a('0xb9')]});});_0x139eb6['on'](_0xcc9a('0xba'),function(_0x4911ae){if(_0x4911ae&&!_0x27a648){return _0x4ee52e[_0xcc9a('0xe')](0x1f4)[_0xcc9a('0x13')]({'message':_0xcc9a('0xbb'),'pid':_0x139eb6['pid']});}});})[_0xcc9a('0x2f')](handleError(_0x4ee52e,null));};exports[_0xcc9a('0xbc')]=function(_0x2252d8,_0x29e056){return db['User'][_0xcc9a('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcc9a('0xb2')}})[_0xcc9a('0x15')](function(_0x53d2e7){var _0x2845c2=![];if(!_0x2252d8[_0xcc9a('0x31')][_0xcc9a('0x55')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2252d8[_0xcc9a('0x31')][_0xcc9a('0xb4')][_0xcc9a('0x6e')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2252d8[_0xcc9a('0x31')]['binding'][_0xcc9a('0xa3')]){throw new Error(_0xcc9a('0xa4'));}if(!_0x2252d8['body'][_0xcc9a('0xac')]){throw new Error(_0xcc9a('0x9f'));}var _0x24d0f2=require(_0xcc9a('0xa9'))[_0xcc9a('0xb5')](path['join'](__dirname,_0xcc9a('0xbd')),[_0x2252d8[_0xcc9a('0x5b')]['id'],JSON[_0xcc9a('0xb6')](_0x2252d8[_0xcc9a('0x31')]),JSON['stringify'](_0x53d2e7)]);_0x24d0f2['on'](_0xcc9a('0xb7'),function(){_0x2845c2=!![];return _0x29e056['status'](0xc8)[_0xcc9a('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x24d0f2['pid']});});_0x24d0f2['on'](_0xcc9a('0xba'),function(_0x16af58){if(_0x16af58&&!_0x2845c2){return _0x29e056['status'](0x1f4)[_0xcc9a('0x13')]({'message':'error\x20child\x20process','pid':_0x24d0f2[_0xcc9a('0xb9')]});}});})['catch'](handleError(_0x29e056,null));};exports[_0xcc9a('0xbe')]=function(_0x55045e,_0xc9336){var _0x202c31=['mail','chat',_0xcc9a('0xbf'),_0xcc9a('0xc0'),'fax',_0xcc9a('0xc1'),'voice'];var _0x5813c1={'offset':0x0,'order':qs[_0xcc9a('0x79')](_0xcc9a('0xc2'))},_0x425315={'count':0x0,'rows':[]};Promise[_0xcc9a('0xc3')]()['then'](function(){if(_0x55045e['query'][_0xcc9a('0xc4')]){if(!_[_0xcc9a('0xc5')](_0x202c31,_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc4')][_0xcc9a('0xc6')]())){throw new Error('Invalid\x20channel');}_0x202c31=[_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc4')][_0xcc9a('0xc6')]()];}if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){try{var _0x4be9b5=JSON[_0xcc9a('0xaf')](_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]);if(!moment(_0x4be9b5[_0xcc9a('0x32')])[_0xcc9a('0xc8')]()){throw new Error(_0xcc9a('0xc9'));}if(!moment(_0x4be9b5['to'])[_0xcc9a('0xc8')]()){throw new Error(_0xcc9a('0xca'));}}catch(_0x36326e){throw new Error(_0xcc9a('0xcb'));}}if(!_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0x2e')](_0xcc9a('0x93'))){_0x5813c1['limit']=qs['limit'](_0x55045e[_0xcc9a('0x1e')]['limit']||0xa);_0x5813c1[_0xcc9a('0xf')]=qs[_0xcc9a('0xf')](_0x55045e['query'][_0xcc9a('0xf')]);}var _0x37cb4b=_0x202c31[_0xcc9a('0x66')](function(_0x193812){if(_0x193812===_0xcc9a('0xcc')){var _0x2a566a={'attributes':['id',_0xcc9a('0xcd'),'type',_0xcc9a('0xce'),_0xcc9a('0xcf'),_0xcc9a('0xd0'),_0xcc9a('0xd1'),'endtime','duration','note','createdAt','userDisposition',_0xcc9a('0xd2'),_0xcc9a('0xd3'),_0xcc9a('0xd4')],'where':{'ContactId':_0x55045e[_0xcc9a('0x5b')]['id']},'include':[{'model':db[_0xcc9a('0xb1')],'as':_0xcc9a('0xb1'),'attributes':['id','name','fullname',_0xcc9a('0xd5')]}],'order':[[_0xcc9a('0xd6'),_0xcc9a('0xd7')]]};if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){_0x2a566a[_0xcc9a('0x52')]['createdAt']={'$gte':_0x4be9b5[_0xcc9a('0x32')],'$lte':_0x4be9b5['to']};}return db[_0xcc9a('0x46')][_0xcc9a('0xd8')](_0x2a566a)[_0xcc9a('0x15')](function(_0x29d7b9){_0x425315[_0xcc9a('0x11')]+=_0x29d7b9[_0xcc9a('0x11')];return _[_0xcc9a('0x66')](_0x29d7b9[_0xcc9a('0x97')],function(_0x434a2f){var _0x3bde43=_0x434a2f['get']({'plain':!![]});_0x3bde43[_0xcc9a('0xc4')]=_0x193812;if(_0x3bde43[_0xcc9a('0xb1')]){_0x3bde43[_0xcc9a('0xb1')]={'id':_0x3bde43[_0xcc9a('0xb1')]['id'],'name':_0x3bde43['User'][_0xcc9a('0x1a')],'fullname':_0x3bde43[_0xcc9a('0xb1')][_0xcc9a('0xd9')],'alias':_0x3bde43[_0xcc9a('0xb1')][_0xcc9a('0xd5')]};}return _0x3bde43;});});}else{var _0x2b0eb1=_[_0xcc9a('0xda')](_0x193812)+(_0x193812===_0xcc9a('0xdb')?_0xcc9a('0xdc'):_0xcc9a('0xdd'));var _0x29ff69={'attributes':['id',_0xcc9a('0xde'),_0xcc9a('0xdf'),_0xcc9a('0xd6'),_0xcc9a('0xe0'),'disposition',_0xcc9a('0xe1'),'thirdDisposition','UserId',_0x2b0eb1+'Id'],'where':{'ContactId':_0x55045e[_0xcc9a('0x5b')]['id']},'include':[{'model':db[_0x2b0eb1],'as':_0xcc9a('0xdd'),'attributes':['id','name',_0xcc9a('0xe2')]},{'model':db[_0xcc9a('0xb1')],'as':_0xcc9a('0xe3'),'attributes':['id','name',_0xcc9a('0xd9')]},{'model':db['Tag'],'as':_0xcc9a('0x5c'),'attributes':['id',_0xcc9a('0x1a'),_0xcc9a('0xe4')],'through':{'attributes':[]}}],'order':[[_0xcc9a('0xd6'),_0xcc9a('0xd7')]]};if(_0x55045e[_0xcc9a('0x1e')][_0xcc9a('0xc7')]){_0x29ff69['where'][_0xcc9a('0xd6')]={'$gte':_0x4be9b5[_0xcc9a('0x32')],'$lte':_0x4be9b5['to']};}switch(_0x193812){case _0xcc9a('0xdb'):_0x29ff69[_0xcc9a('0x77')][_0xcc9a('0x54')](_0xcc9a('0xe5'),_0xcc9a('0xe6'),_0xcc9a('0xe7'),_0xcc9a('0xe8'),'osName',_0xcc9a('0xe9'),_0xcc9a('0xea'),_0xcc9a('0xeb'),_0xcc9a('0xec'));break;case'mail':_0x29ff69[_0xcc9a('0x77')][_0xcc9a('0x54')](_0xcc9a('0xed'),'substatus');break;case'openchannel':_0x29ff69['attributes'][_0xcc9a('0x54')]('externalUrl','threadId');break;}return db[_['startCase'](_0x193812)+_0xcc9a('0xee')]['findAndCountAll'](_0x29ff69)[_0xcc9a('0x15')](function(_0x155a5e){_0x425315[_0xcc9a('0x11')]+=_0x155a5e[_0xcc9a('0x11')];return _[_0xcc9a('0x66')](_0x155a5e[_0xcc9a('0x97')],function(_0x1e6f76){var _0x1bd33c=_0x1e6f76[_0xcc9a('0x33')]({'plain':!![]});_0x1bd33c[_0xcc9a('0xc4')]=_0x193812;if(_0x1bd33c[_0xcc9a('0xe3')]){_0x1bd33c['Owner']={'id':_0x1bd33c['Owner']['id'],'name':_0x1bd33c[_0xcc9a('0xe3')][_0xcc9a('0x1a')],'fullname':_0x1bd33c[_0xcc9a('0xe3')][_0xcc9a('0xd9')]};}return _0x1bd33c;});});}});return Promise[_0xcc9a('0x58')](_0x37cb4b);})[_0xcc9a('0x15')](function(_0x21878a){return _(_0x21878a)[_0xcc9a('0xef')]()[_0xcc9a('0xf0')](_0xcc9a('0xd6'))[_0xcc9a('0xf1')]()[_0xcc9a('0xf2')]();})[_0xcc9a('0x15')](function(_0x5da051){_0x425315[_0xcc9a('0x97')]=_0x5813c1[_0xcc9a('0x7d')]?_0x5da051[_0xcc9a('0xf3')](_0x5813c1[_0xcc9a('0xf')],_0x5813c1[_0xcc9a('0xf')]+_0x5813c1[_0xcc9a('0x7d')]):_0x5da051;return _0x425315;})[_0xcc9a('0x15')](respondWithFilteredResult(_0xc9336,_0x5813c1))['catch'](handleError(_0xc9336,null));}; \ No newline at end of file +var _0xd65b=['set','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','catch','params','CmContact','tags','length','keys','startsWith','cf_','columnName','displayName','analytics','findAll','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','hasOwnProperty','push','contact','all','show','find','Tag','Tags','color','tag','Phones','ItemType','sequelize','literal','CmCustomField','omit','map','format','$and','pickBy','cf_%d','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','CmHopper','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','filters','pick','filter','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','phone','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','options','includeAll','include','rows','getHopperHistories','sort','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','sms','openchannel','fax','voice','-createdAt','resolve','channel','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','alias','DESC','fullname','startCase','Website','Account','closedAt','secondDisposition','UserId','key','chat','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','findAndCountAll','Owner','sortBy','value','bluebird','util','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','limit','count','offset'];(function(_0x100137,_0x3f5c1f){var _0x5a5e3c=function(_0x2f0f85){while(--_0x2f0f85){_0x100137['push'](_0x100137['shift']());}};_0x5a5e3c(++_0x3f5c1f);}(_0xd65b,0x1f2));var _0xbd65=function(_0x879c1,_0x4fd646){_0x879c1=_0x879c1-0x0;var _0x31bd3a=_0xd65b[_0x879c1];return _0x31bd3a;};'use strict';var moment=require('moment');var BPromise=require(_0xbd65('0x0'));var util=require(_0xbd65('0x1'));var path=require(_0xbd65('0x2'));var fs=require('fs');var _=require(_0xbd65('0x3'));var squel=require('squel');var Papa=require(_0xbd65('0x4'));var Redis=require(_0xbd65('0x5'));var contacts=require(_0xbd65('0x6'));var qs=require(_0xbd65('0x7'));var logger=require(_0xbd65('0x8'))(_0xbd65('0x9'));var config=require('../../config/environment');var shared=require(_0xbd65('0xa'));var db=require(_0xbd65('0xb'))['db'];config[_0xbd65('0xc')]=_[_0xbd65('0xd')](config[_0xbd65('0xc')],{'host':_0xbd65('0xe'),'port':0x18eb});var socket=require(_0xbd65('0xf'))(new Redis(config[_0xbd65('0xc')]));require(_0xbd65('0x10'))[_0xbd65('0x11')](socket);function respondWithResult(_0x524e3c,_0x42e82c){_0x42e82c=_0x42e82c||0xc8;return function(_0x3e606e){if(_0x3e606e){return _0x524e3c[_0xbd65('0x12')](_0x42e82c)[_0xbd65('0x13')](_0x3e606e);}};}function respondWithFilteredResult(_0x1b1f7d,_0x501ba9){return function(_0x989cd5){if(_0x989cd5){var _0x3eeaa1=typeof _0x501ba9['offset']===_0xbd65('0x14')&&typeof _0x501ba9[_0xbd65('0x15')]===_0xbd65('0x14');var _0x1a0d1c=_0x989cd5[_0xbd65('0x16')];var _0x1992e4=_0x3eeaa1?0x0:_0x501ba9[_0xbd65('0x17')];var _0x446dd2=_0x3eeaa1?_0x989cd5[_0xbd65('0x16')]:_0x501ba9[_0xbd65('0x17')]+_0x501ba9[_0xbd65('0x15')];var _0x4d000c;if(_0x446dd2>=_0x1a0d1c){_0x446dd2=_0x1a0d1c;_0x4d000c=0xc8;}else{_0x4d000c=0xce;}_0x1b1f7d['status'](_0x4d000c);return _0x1b1f7d[_0xbd65('0x18')]('Content-Range',_0x1992e4+'-'+_0x446dd2+'/'+_0x1a0d1c)[_0xbd65('0x13')](_0x989cd5);}return null;};}function saveUpdates(_0x31c662){return function(_0xc8a79){if(_0xc8a79){return _0xc8a79[_0xbd65('0x19')](_0x31c662)[_0xbd65('0x1a')](function(_0x42a189){return _0x42a189;});}return null;};}function removeEntity(_0x3e7675){return function(_0x5b0c76){if(_0x5b0c76){return _0x5b0c76[_0xbd65('0x1b')]()[_0xbd65('0x1a')](function(){_0x3e7675[_0xbd65('0x12')](0xcc)[_0xbd65('0x1c')]();});}};}function handleEntityNotFound(_0x3c198b){return function(_0x19f499){if(!_0x19f499){_0x3c198b[_0xbd65('0x1d')](0x194);}return _0x19f499;};}function handleError(_0x843852,_0x195270){_0x195270=_0x195270||0x1f4;return function(_0x18a03a){logger[_0xbd65('0x1e')](_0x18a03a[_0xbd65('0x1f')]);if(_0x18a03a[_0xbd65('0x20')]){delete _0x18a03a[_0xbd65('0x20')];}_0x843852[_0xbd65('0x12')](_0x195270)[_0xbd65('0x21')](_0x18a03a);};}exports[_0xbd65('0x22')]=function(_0x57317e,_0x3caa64){var _0x1e9af9={};return contacts[_0xbd65('0x23')]()['then'](function(_0x286aeb){_0x1e9af9=qs[_0xbd65('0x24')](_0x286aeb,_0x57317e);return contacts['findAll'](_0x57317e[_0xbd65('0x25')],_0x57317e[_0xbd65('0x26')],_0x1e9af9,_0x286aeb);})['then'](respondWithFilteredResult(_0x3caa64,_0x1e9af9))[_0xbd65('0x27')](handleError(_0x3caa64,null));};exports[_0xbd65('0x1b')]=function(_0x55032a,_0x14f450){return db['CmContact']['find']({'where':{'id':_0x55032a[_0xbd65('0x28')]['id']}})[_0xbd65('0x1a')](handleEntityNotFound(_0x14f450,null))[_0xbd65('0x1a')](removeEntity(_0x14f450,null))['catch'](handleError(_0x14f450,null));};exports['describe']=function(_0x4478b2,_0x3d1714){return db[_0xbd65('0x29')][_0xbd65('0x23')]()[_0xbd65('0x1a')](function(_0x21bf63){delete _0x21bf63[_0xbd65('0x2a')];for(var _0x4ab1e4=0x0;_0x4ab1e40x0){return new Promise(function(_0x47cb9b){var _0x409b47=[];for(var _0x4d6e06=0x0;_0x4d6e06<_0x21061a[_0xbd65('0x2b')];_0x4d6e06++){_0x409b47[_0xbd65('0x67')](insertAdditionalPhones(_0x21061a[_0x4d6e06][_0xbd65('0x68')],_0x21061a[_0x4d6e06][_0xbd65('0x5d')]));}Promise[_0xbd65('0x69')](_0x409b47)[_0xbd65('0x1a')](function(){_0x47cb9b(0x1);});})[_0xbd65('0x1a')](function(){return{'success':_0x362141,'failure':_0x424dfa,'duplicates':_0x515f1a};});}else{return{'success':_0x362141,'failure':_0x424dfa,'duplicates':_0x515f1a};}}})[_0xbd65('0x1a')](respondWithResult(_0x28bef1,0xc9))[_0xbd65('0x27')](handleError(_0x28bef1,null));};exports[_0xbd65('0x6a')]=function(_0x52c680,_0x2ca0d9){var _0x74f91f;return db[_0xbd65('0x29')][_0xbd65('0x23')]()[_0xbd65('0x1a')](function(_0x175148){return db[_0xbd65('0x29')][_0xbd65('0x6b')]({'where':{'id':_0x52c680[_0xbd65('0x28')]['id']},'include':[{'model':db[_0xbd65('0x6c')],'as':_0xbd65('0x6d'),'attributes':['id',_0xbd65('0x20'),_0xbd65('0x6e')],'required':_0x52c680[_0xbd65('0x25')][_0xbd65('0x6f')]?!![]:![]},{'model':db[_0xbd65('0x4d')],'as':_0xbd65('0x70'),'where':{'CmContactId':_0x52c680[_0xbd65('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbd65('0x71')}]}],'order':[db[_0xbd65('0x72')][_0xbd65('0x73')]('Phones.OrderBy')],'attributes':_['keys'](_0x175148)});})['then'](function(_0x1879ef){if(!_['isNil'](_0x1879ef)){_0x74f91f=_0x1879ef['get']({'plain':!![]});var _0x434733={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1879ef&&_0x1879ef['ListId']){if(_0x1879ef['ListId']){_0x434733['where']['$and'][_0xbd65('0x67')]({'ListId':{'$ne':_0x1879ef[_0xbd65('0x63')]}});}}return db[_0xbd65('0x74')][_0xbd65('0x32')](_0x434733);}})['then'](function(_0x1ccd62){if(!_[_0xbd65('0x59')](_0x1ccd62)){return _[_0xbd65('0x75')](_0x74f91f,_[_0xbd65('0x76')](_0x1ccd62,function(_0xa9ebb5){return util[_0xbd65('0x77')]('cf_%d',_0xa9ebb5['id']);}));}})[_0xbd65('0x1a')](handleEntityNotFound(_0x2ca0d9,null))[_0xbd65('0x1a')](respondWithResult(_0x2ca0d9,null))[_0xbd65('0x27')](handleError(_0x2ca0d9,null));};exports[_0xbd65('0x19')]=function(_0x4acd07,_0x43f7cb){var _0x1340c8;if(_0x4acd07[_0xbd65('0x39')]['id']){delete _0x4acd07[_0xbd65('0x39')]['id'];}if(!_[_0xbd65('0x59')](_0x4acd07[_0xbd65('0x39')]['dialTimezone'])){var _0x11be8d=_0x4acd07[_0xbd65('0x39')]['dialTimezone'];if(!_[_0xbd65('0x59')](shared['timezones'][_0x11be8d]))_0x4acd07['body'][_0xbd65('0x5c')]=shared[_0xbd65('0x5b')][_0x11be8d]['utcOffset'];}return db['CmContact'][_0xbd65('0x6b')]({'where':{'id':_0x4acd07[_0xbd65('0x28')]['id']}})['then'](handleEntityNotFound(_0x43f7cb,null))[_0xbd65('0x1a')](saveUpdates(_0x4acd07[_0xbd65('0x39')],null))['then'](function(_0x7101a6){_0x1340c8=_0x7101a6;var _0x34fc2d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x7101a6&&_0x7101a6[_0xbd65('0x63')]){if(_0x7101a6[_0xbd65('0x63')]){_0x34fc2d[_0xbd65('0x61')][_0xbd65('0x78')][_0xbd65('0x67')]({'ListId':{'$ne':_0x7101a6[_0xbd65('0x63')]}});}}return db['CmCustomField']['findAll'](_0x34fc2d);})[_0xbd65('0x1a')](function(_0x5a49be){if(_0x5a49be){return _['omit'](_[_0xbd65('0x79')](_0x4acd07[_0xbd65('0x39')],function(_0x3dd436,_0x3338c5){return _['startsWith'](_0x3338c5,_0xbd65('0x2e'));}),_[_0xbd65('0x76')](_0x5a49be,function(_0x2fc658){return util[_0xbd65('0x77')](_0xbd65('0x7a'),_0x2fc658['id']);}));}})[_0xbd65('0x1a')](function(_0x3de121){if(_0x3de121&&!_[_0xbd65('0x7b')](_0x3de121)){var _0x3c0244=squel[_0xbd65('0x19')]()['table'](_0xbd65('0x7c'))[_0xbd65('0x7d')](_0x3de121)['where'](_0xbd65('0x7e'),_0x4acd07[_0xbd65('0x28')]['id'])[_0xbd65('0x7f')]();return db[_0xbd65('0x72')]['query'](_0x3c0244[_0xbd65('0x80')],{'replacements':_0x3c0244[_0xbd65('0x35')]});}})['then'](function(){if(_0x4acd07['body']['phone']&&_0x1340c8){return db[_0xbd65('0x81')]['update']({'phone':_0x4acd07['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1340c8['id']}});}})[_0xbd65('0x1a')](function(){return _0x1340c8;})[_0xbd65('0x1a')](respondWithResult(_0x43f7cb,null))[_0xbd65('0x27')](handleError(_0x43f7cb,null));};exports[_0xbd65('0x82')]=function(_0x35074c,_0x972cb1){var _0x3d8436={};var _0x359149={};var _0x306f01;var _0x39ec70;return db[_0xbd65('0x29')][_0xbd65('0x83')]({'where':{'id':_0x35074c[_0xbd65('0x28')]['id']}})['then'](handleEntityNotFound(_0x972cb1,null))['then'](function(_0xec3688){if(_0xec3688){_0x306f01=_0xec3688;_0x359149[_0xbd65('0x84')]=_[_0xbd65('0x2c')](db[_0xbd65('0x6c')][_0xbd65('0x85')]);_0x359149['query']=_[_0xbd65('0x2c')](_0x35074c[_0xbd65('0x25')]);_0x359149['filters']=_[_0xbd65('0x86')](_0x359149['model'],_0x359149[_0xbd65('0x25')]);_0x3d8436[_0xbd65('0x87')]=_[_0xbd65('0x86')](_0x359149[_0xbd65('0x84')],qs[_0xbd65('0x88')](_0x35074c[_0xbd65('0x25')][_0xbd65('0x88')]));_0x3d8436['attributes']=_0x3d8436[_0xbd65('0x87')]['length']?_0x3d8436[_0xbd65('0x87')]:_0x359149[_0xbd65('0x84')];_0x3d8436[_0xbd65('0x89')]=qs['sort'](_0x35074c[_0xbd65('0x25')]['sort']);_0x3d8436['where']=qs[_0xbd65('0x8a')](_[_0xbd65('0x8b')](_0x35074c[_0xbd65('0x25')],_0x359149[_0xbd65('0x8a')]));if(_0x35074c['query'][_0xbd65('0x8c')]){_0x3d8436[_0xbd65('0x61')]=_[_0xbd65('0x38')](_0x3d8436[_0xbd65('0x61')],{'$or':_[_0xbd65('0x76')](_0x3d8436['attributes'],function(_0x11a295){var _0x4ce467={};_0x4ce467[_0x11a295]={'$like':'%'+_0x35074c[_0xbd65('0x25')][_0xbd65('0x8c')]+'%'};return _0x4ce467;})});}_0x3d8436=_[_0xbd65('0x38')]({},_0x3d8436,_0x35074c['options']);return _0x306f01['getTags'](_0x3d8436);}})[_0xbd65('0x1a')](function(_0x3ef9ae){if(_0x3ef9ae){_0x39ec70=_0x3ef9ae['length'];if(!_0x35074c[_0xbd65('0x25')]['hasOwnProperty'](_0xbd65('0x8d'))){_0x3d8436[_0xbd65('0x15')]=qs[_0xbd65('0x15')](_0x35074c['query'][_0xbd65('0x15')]);_0x3d8436[_0xbd65('0x17')]=qs['offset'](_0x35074c[_0xbd65('0x25')][_0xbd65('0x17')]);}return _0x306f01[_0xbd65('0x82')](_0x3d8436);}})['then'](function(_0x571077){if(_0x571077){return _0x571077?{'count':_0x39ec70,'rows':_0x571077}:null;}})['then'](respondWithResult(_0x972cb1,null))[_0xbd65('0x27')](handleError(_0x972cb1,null));};exports[_0xbd65('0x8e')]=function(_0x567cf5,_0x448d0d){if(_0x567cf5[_0xbd65('0x39')]['id']){delete _0x567cf5[_0xbd65('0x39')]['id'];}return db[_0xbd65('0x29')][_0xbd65('0x83')]({'where':{'id':_0x567cf5[_0xbd65('0x28')]['id']}})[_0xbd65('0x1a')](handleEntityNotFound(_0x448d0d,null))['then'](function(_0x33fb90){if(_0x33fb90){return _0x33fb90[_0xbd65('0x8e')](_0x567cf5[_0xbd65('0x39')][_0xbd65('0x8f')]||[]);}return null;})[_0xbd65('0x1a')](respondWithResult(_0x448d0d,null))[_0xbd65('0x27')](handleError(_0x448d0d,null));};exports[_0xbd65('0x90')]=function(_0x2ae72d,_0x3fd95b){var _0x8d999c=[];_0x8d999c[_0xbd65('0x67')](addAdditionalPhones(_0x2ae72d[_0xbd65('0x39')]));Promise['all'](_0x8d999c)[_0xbd65('0x1a')](function(){_0x8d999c=[];_0x8d999c[_0xbd65('0x67')](deleteCmHopperPhones(_0x2ae72d[_0xbd65('0x39')]['id']));_0x8d999c[_0xbd65('0x67')](addCmHopperPhones(_0x2ae72d['body']['id']));Promise[_0xbd65('0x69')](_0x8d999c)['then'](function(){return[0x1];})[_0xbd65('0x1a')](respondWithResult(_0x3fd95b,null));});};function addAdditionalPhones(_0x7d5786){var _0x2deef8;return new Promise(function(_0x5d3b8e){return db[_0xbd65('0x4d')][_0xbd65('0x1b')]({'where':{'CmContactId':_0x7d5786['id']}})[_0xbd65('0x1a')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xbd65('0x91')]})[_0xbd65('0x1a')](function(_0x5b70d2){var _0x1ab691=[];for(var _0x3cb24e=0x0;_0x3cb24e<_0x7d5786['items']['length'];_0x3cb24e++){var _0x282d9e=_0x7d5786['item_types']?_[_0xbd65('0x59')](_0x7d5786[_0xbd65('0x92')][_0x3cb24e])?'':_0x7d5786[_0xbd65('0x92')][_0x3cb24e]:_0x7d5786[_0xbd65('0x93')][_0x3cb24e]['ItemTypeId']?_0x7d5786[_0xbd65('0x93')][_0x3cb24e][_0xbd65('0x94')]:'';var _0x26acba=_[_0xbd65('0x59')](_0x7d5786[_0xbd65('0x93')][_0x3cb24e][_0xbd65('0x95')])?'':_0x7d5786[_0xbd65('0x93')][_0x3cb24e]['description'];var _0x53976a=_0x282d9e+':'+_0x7d5786[_0xbd65('0x93')][_0x3cb24e]['phone']+'§'+_0x26acba;if(_[_0xbd65('0x59')](_0x2deef8))_0x2deef8=_0x53976a;else _0x2deef8+=';'+_0x53976a;var _0x4453cc=null;var _0x2caf0d=null;if(_0x7d5786[_0xbd65('0x92')]){if(!_[_0xbd65('0x59')](_0x7d5786[_0xbd65('0x92')][_0x3cb24e])){_0x2caf0d=_[_0xbd65('0x6b')](_0x5b70d2,function(_0x10272b){return _0x10272b['id']===_0x7d5786[_0xbd65('0x92')][_0x3cb24e];});if(!_[_0xbd65('0x59')](_0x2caf0d)){_0x4453cc=_0x2caf0d[_0xbd65('0x91')];}}}else{if(!_[_0xbd65('0x59')](_0x7d5786['items'][_0x3cb24e])){_0x2caf0d=_[_0xbd65('0x6b')](_0x5b70d2,function(_0x5b06a4){return _0x5b06a4['id']===_0x7d5786[_0xbd65('0x93')][_0x3cb24e][_0xbd65('0x94')];});if(!_[_0xbd65('0x59')](_0x2caf0d)){_0x4453cc=_0x3cb24e;}}}if(_[_0xbd65('0x59')](_0x4453cc)){_0x4453cc=0x64;}_0x1ab691['push'](addAdditionalPhone(_0x7d5786['id'],_0x7d5786[_0xbd65('0x93')][_0x3cb24e][_0xbd65('0x96')],_0x7d5786[_0xbd65('0x92')]?_[_0xbd65('0x59')](_0x7d5786['item_types'][_0x3cb24e])?null:_0x7d5786[_0xbd65('0x92')][_0x3cb24e]:_0x7d5786[_0xbd65('0x93')][_0x3cb24e]['ItemTypeId']?_0x7d5786['items'][_0x3cb24e][_0xbd65('0x94')]:null,_0x4453cc,_0x26acba));}Promise['all'](_0x1ab691)[_0xbd65('0x1a')](function(){db[_0xbd65('0x29')][_0xbd65('0x19')]({'AdditionalPhones':_0x2deef8},{'where':{'id':_0x7d5786['id']}})[_0xbd65('0x1a')](function(){_0x5d3b8e(0x1);});});});});});}function addAdditionalPhone(_0x381c70,_0x2f479d,_0x111ec1,_0x37e002,_0x4550d5){return db[_0xbd65('0x4d')][_0xbd65('0x6b')]({'where':{'CmContactId':_0x381c70,'item':_0x2f479d}})['then'](function(_0x5aafa5){if(_0x5aafa5)logger[_0xbd65('0x36')]('contact\x20phone\x20exists',_0x5aafa5);else{db[_0xbd65('0x4d')][_0xbd65('0x43')]({'CmContactId':_0x381c70,'item':_0x2f479d,'ItemTypeId':_0x111ec1,'OrderBy':_0x37e002,'ItemClass':_0xbd65('0x97'),'description':_0x4550d5});}});}function deleteCmHopperPhones(_0x19579d){return new Promise(function(_0x34de83){return db[_0xbd65('0x81')][_0xbd65('0x32')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19579d}})[_0xbd65('0x1a')](function(_0x5cc937){db[_0xbd65('0x98')][_0xbd65('0x1b')]({'where':{'CmHopperId':{'$in':_[_0xbd65('0x76')](_0x5cc937,'id')}}});})[_0xbd65('0x1a')](function(){_0x34de83(0x1);});});}function addCmHopperPhones(_0x4f7388){return new Promise(function(_0x1eb202){return db[_0xbd65('0x81')][_0xbd65('0x32')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f7388}})['then'](function(_0x11e4e2){var _0x2527e8=[];_['map'](_0x11e4e2,function(_0x226749){_0x2527e8[_0xbd65('0x67')](createCmHopperPhone(_0x4f7388,_0x226749['id']));});Promise[_0xbd65('0x69')](_0x2527e8)[_0xbd65('0x1a')](function(){_0x1eb202(0x1);});});});}function createCmHopperPhone(_0x287b28,_0x1a0d91){return new Promise(function(_0x57b879){db[_0xbd65('0x4d')][_0xbd65('0x32')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x287b28,'ItemClass':_0xbd65('0x97')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0xbd65('0x71')}],'order':[_0xbd65('0x91'),db[_0xbd65('0x72')][_0xbd65('0x73')](_0xbd65('0x99'))]})['then'](function(_0xff2d1){var _0x266b6d=0x1;var _0x29498a=_[_0xbd65('0x76')](_0xff2d1,function(_0x48f333){_0x48f333[_0xbd65('0x9a')]=_0x1a0d91;_0x48f333[_0xbd65('0x96')]=_0x48f333[_0xbd65('0x9b')];_0x48f333['OrderBy']=_0x266b6d;delete _0x48f333['ItemType.OrderBy'];_0x266b6d=_0x266b6d+0x1;return _0x48f333;});return db[_0xbd65('0x98')][_0xbd65('0x5e')](_0x29498a,{});})['then'](function(){_0x57b879(0x1);});});}function insertAdditionalPhones(_0x13f77a,_0x512ace){return new Promise(function(_0x57faec){var _0x4446b8=[];for(var _0x2acafe=0x0;_0x2acafe<_0x512ace['length'];_0x2acafe++){var _0x36fa8e=_0x512ace[_0x2acafe];_0x4446b8[_0xbd65('0x67')](parseContactItemType(_0x36fa8e));}Promise[_0xbd65('0x69')](_0x4446b8)[_0xbd65('0x1a')](function(){var _0x302311={'id':_0x13f77a['id'],'items':_0x512ace};return addAdditionalPhones(_0x302311)['then'](function(){return addCmHopperPhones(_0x13f77a['id']);});})[_0xbd65('0x1a')](function(){_0x57faec(_0x13f77a);});});}function parseContactItemType(_0x506ba0){return new Promise(function(_0x3be2c1){if(_0x506ba0[_0xbd65('0x66')](_0xbd65('0x94'))){_0x3be2c1(_0x506ba0);}else{return db['ContactItemType'][_0xbd65('0x6b')]({'where':{'name':_0x506ba0[_0xbd65('0x71')]}})['then'](function(_0x4c83f2){if(_[_0xbd65('0x59')](_0x4c83f2))_0x506ba0['ItemTypeId']=null;else _0x506ba0[_0xbd65('0x94')]=_0x4c83f2['id'];_0x3be2c1(_0x506ba0);});}});}exports[_0xbd65('0x9c')]=function(_0x349536,_0x4a74dc){return db[_0xbd65('0x4d')][_0xbd65('0x32')]({'raw':!![],'where':{'CmContactId':_0x349536[_0xbd65('0x28')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0xbd65('0x71')}],'order':[[_0xbd65('0x91')],[db[_0xbd65('0x72')][_0xbd65('0x73')]('`ItemType`.OrderBy')]]})[_0xbd65('0x1a')](function(_0x4d8421){return _0x4d8421;})[_0xbd65('0x1a')](respondWithResult(_0x4a74dc,null))['catch'](handleError(_0x4a74dc,null));};exports[_0xbd65('0x9d')]=function(_0x1aff75,_0x467e45){return db[_0xbd65('0x4d')][_0xbd65('0x32')]({'raw':!![],'where':{'CmContactId':_0x1aff75[_0xbd65('0x39')]['fromContactId']}})[_0xbd65('0x1a')](function(_0x3bbb6c){var _0x39e098=_['map'](_0x3bbb6c,function(_0x4c4cef){_0x4c4cef[_0xbd65('0x9e')]=_0x1aff75[_0xbd65('0x39')][_0xbd65('0x9f')];return _0x4c4cef;});return db['CmContactHasItem'][_0xbd65('0x5e')](_0x39e098,{});})[_0xbd65('0x1a')](function(){return addCmHopperPhones(_0x1aff75[_0xbd65('0x39')][_0xbd65('0x9f')]);})[_0xbd65('0x1a')](function(){return['ok'];})[_0xbd65('0x1a')](respondWithResult(_0x467e45,null))['catch'](handleError(_0x467e45,null));};exports[_0xbd65('0xa0')]=function(_0xdec0ef,_0x486f7b){var _0x5b9a72=[];_0x5b9a72['push'](createCmHopperPhone(_0xdec0ef['body']['id'],_0xdec0ef[_0xbd65('0x39')]['hopperId']));Promise['all'](_0x5b9a72)['then'](function(){return[0x1];})[_0xbd65('0x1a')](respondWithResult(_0x486f7b,null));};exports[_0xbd65('0xa1')]=function(_0xaa93e0,_0x4107a5){var _0x1e4d62={'raw':![],'where':{}};var _0x456897={};var _0x418a61={'count':0x0,'rows':[]};return db[_0xbd65('0x29')]['findOne']({'where':{'id':_0xaa93e0[_0xbd65('0x28')]['id']}})['then'](handleEntityNotFound(_0x4107a5,null))[_0xbd65('0x1a')](function(_0x54df5b){if(_0x54df5b){_0x456897[_0xbd65('0x84')]=_[_0xbd65('0x2c')](db[_0xbd65('0x81')][_0xbd65('0x85')]);_0x456897[_0xbd65('0x25')]=_[_0xbd65('0x2c')](_0xaa93e0[_0xbd65('0x25')]);_0x456897[_0xbd65('0x8a')]=_[_0xbd65('0x86')](_0x456897[_0xbd65('0x84')],_0x456897[_0xbd65('0x25')]);_0x1e4d62[_0xbd65('0x87')]=_[_0xbd65('0x86')](_0x456897[_0xbd65('0x84')],qs['fields'](_0xaa93e0[_0xbd65('0x25')][_0xbd65('0x88')]));_0x1e4d62['attributes']=_0x1e4d62[_0xbd65('0x87')]['length']?_0x1e4d62[_0xbd65('0x87')]:_0x456897['model'];if(!_0xaa93e0['query'][_0xbd65('0x66')](_0xbd65('0x8d'))){_0x1e4d62[_0xbd65('0x15')]=qs[_0xbd65('0x15')](_0xaa93e0[_0xbd65('0x25')]['limit']);_0x1e4d62[_0xbd65('0x17')]=qs['offset'](_0xaa93e0[_0xbd65('0x25')][_0xbd65('0x17')]);}_0x1e4d62[_0xbd65('0x89')]=qs['sort'](_0xaa93e0[_0xbd65('0x25')]['sort']);_0x1e4d62[_0xbd65('0x61')]=qs[_0xbd65('0x8a')](_[_0xbd65('0x8b')](_0xaa93e0[_0xbd65('0x25')],_0x456897[_0xbd65('0x8a')]));_0x1e4d62[_0xbd65('0x61')][_0xbd65('0xa2')]=_0x54df5b['id'];if(_0xaa93e0[_0xbd65('0x25')]['filter']){_0x1e4d62[_0xbd65('0x61')]=_['merge'](_0x1e4d62['where'],{'$or':_[_0xbd65('0x76')](_0x1e4d62[_0xbd65('0x87')],function(_0x1b579b){var _0x50e1d0={};_0x50e1d0[_0x1b579b]={'$like':'%'+_0xaa93e0[_0xbd65('0x25')]['filter']+'%'};return _0x50e1d0;})});}_0x1e4d62=_[_0xbd65('0x38')]({},_0x1e4d62,_0xaa93e0[_0xbd65('0xa3')]);return db[_0xbd65('0x81')][_0xbd65('0x16')]({'where':_0x1e4d62[_0xbd65('0x61')]})['then'](function(_0x427860){_0x418a61[_0xbd65('0x16')]=_0x427860;if(_0xaa93e0[_0xbd65('0x25')][_0xbd65('0xa4')]){_0x1e4d62[_0xbd65('0xa5')]=[{'all':!![]}];}return db[_0xbd65('0x81')][_0xbd65('0x32')](_0x1e4d62);})['then'](function(_0xa27052){_0x418a61[_0xbd65('0xa6')]=_0xa27052;return _0x418a61;});}})[_0xbd65('0x1a')](respondWithFilteredResult(_0x4107a5,_0x1e4d62))[_0xbd65('0x27')](handleError(_0x4107a5,null));};exports[_0xbd65('0xa7')]=function(_0x5eb720,_0x40e002){var _0x235a85={'raw':!![],'where':{}};var _0x5d505b={};var _0xbd9b23={'count':0x0,'rows':[]};return db[_0xbd65('0x29')]['findOne']({'where':{'id':_0x5eb720[_0xbd65('0x28')]['id']}})['then'](handleEntityNotFound(_0x40e002,null))[_0xbd65('0x1a')](function(_0x945533){if(_0x945533){_0x5d505b['model']=_[_0xbd65('0x2c')](db['CmHopperHistory']['rawAttributes']);_0x5d505b[_0xbd65('0x25')]=_[_0xbd65('0x2c')](_0x5eb720[_0xbd65('0x25')]);_0x5d505b[_0xbd65('0x8a')]=_[_0xbd65('0x86')](_0x5d505b[_0xbd65('0x84')],_0x5d505b[_0xbd65('0x25')]);_0x235a85[_0xbd65('0x87')]=_['intersection'](_0x5d505b[_0xbd65('0x84')],qs[_0xbd65('0x88')](_0x5eb720[_0xbd65('0x25')][_0xbd65('0x88')]));_0x235a85[_0xbd65('0x87')]=_0x235a85[_0xbd65('0x87')][_0xbd65('0x2b')]?_0x235a85['attributes']:_0x5d505b['model'];if(!_0x5eb720[_0xbd65('0x25')]['hasOwnProperty']('nolimit')){_0x235a85['limit']=qs[_0xbd65('0x15')](_0x5eb720['query'][_0xbd65('0x15')]);_0x235a85['offset']=qs['offset'](_0x5eb720[_0xbd65('0x25')][_0xbd65('0x17')]);}_0x235a85[_0xbd65('0x89')]=qs[_0xbd65('0xa8')](_0x5eb720['query'][_0xbd65('0xa8')]);_0x235a85[_0xbd65('0x61')]=qs[_0xbd65('0x8a')](_[_0xbd65('0x8b')](_0x5eb720[_0xbd65('0x25')],_0x5d505b[_0xbd65('0x8a')]));_0x235a85['where'][_0xbd65('0xa2')]=_0x945533['id'];if(_0x5eb720[_0xbd65('0x25')]['filter']){_0x235a85[_0xbd65('0x61')]=_[_0xbd65('0x38')](_0x235a85['where'],{'$or':_[_0xbd65('0x76')](_0x235a85['attributes'],function(_0x108126){var _0x5dbffd={};_0x5dbffd[_0x108126]={'$like':'%'+_0x5eb720['query']['filter']+'%'};return _0x5dbffd;})});}_0x235a85=_['merge']({},_0x235a85,_0x5eb720[_0xbd65('0xa3')]);return db[_0xbd65('0x4f')][_0xbd65('0x16')]({'where':_0x235a85['where']})[_0xbd65('0x1a')](function(_0x50d565){_0xbd9b23[_0xbd65('0x16')]=_0x50d565;if(_0x5eb720[_0xbd65('0x25')][_0xbd65('0xa4')]){_0x235a85[_0xbd65('0xa5')]=[{'all':!![]}];}return db[_0xbd65('0x4f')][_0xbd65('0x32')](_0x235a85);})['then'](function(_0x4dd9b0){_0xbd9b23[_0xbd65('0xa6')]=_0x4dd9b0;return _0xbd9b23;});}})[_0xbd65('0x1a')](respondWithFilteredResult(_0x40e002,_0x235a85))[_0xbd65('0x27')](handleError(_0x40e002,null));};exports[_0xbd65('0xa9')]=function(_0x20bf08,_0x5b7985){var _0x209f5b={'raw':!![],'where':{}};var _0x3a6b36={};var _0x2f5bfd={'count':0x0,'rows':[]};return db[_0xbd65('0x29')][_0xbd65('0x83')]({'where':{'id':_0x20bf08[_0xbd65('0x28')]['id']}})[_0xbd65('0x1a')](handleEntityNotFound(_0x5b7985,null))['then'](function(_0x2f24cb){if(_0x2f24cb){_0x3a6b36['model']=_[_0xbd65('0x2c')](db[_0xbd65('0x4e')][_0xbd65('0x85')]);_0x3a6b36[_0xbd65('0x25')]=_['keys'](_0x20bf08[_0xbd65('0x25')]);_0x3a6b36[_0xbd65('0x8a')]=_[_0xbd65('0x86')](_0x3a6b36[_0xbd65('0x84')],_0x3a6b36[_0xbd65('0x25')]);_0x209f5b[_0xbd65('0x87')]=_[_0xbd65('0x86')](_0x3a6b36[_0xbd65('0x84')],qs[_0xbd65('0x88')](_0x20bf08['query'][_0xbd65('0x88')]));_0x209f5b[_0xbd65('0x87')]=_0x209f5b[_0xbd65('0x87')][_0xbd65('0x2b')]?_0x209f5b['attributes']:_0x3a6b36[_0xbd65('0x84')];if(!_0x20bf08[_0xbd65('0x25')]['hasOwnProperty'](_0xbd65('0x8d'))){_0x209f5b['limit']=qs['limit'](_0x20bf08[_0xbd65('0x25')][_0xbd65('0x15')]);_0x209f5b[_0xbd65('0x17')]=qs[_0xbd65('0x17')](_0x20bf08[_0xbd65('0x25')][_0xbd65('0x17')]);}_0x209f5b['order']=qs[_0xbd65('0xa8')](_0x20bf08['query'][_0xbd65('0xa8')]);_0x209f5b[_0xbd65('0x61')]=qs['filters'](_[_0xbd65('0x8b')](_0x20bf08[_0xbd65('0x25')],_0x3a6b36[_0xbd65('0x8a')]));_0x209f5b['where']['ContactId']=_0x2f24cb['id'];if(_0x20bf08[_0xbd65('0x25')]['filter']){_0x209f5b[_0xbd65('0x61')]=_[_0xbd65('0x38')](_0x209f5b[_0xbd65('0x61')],{'$or':_[_0xbd65('0x76')](_0x209f5b[_0xbd65('0x87')],function(_0x5313fc){var _0x4dc2f1={};_0x4dc2f1[_0x5313fc]={'$like':'%'+_0x20bf08[_0xbd65('0x25')][_0xbd65('0x8c')]+'%'};return _0x4dc2f1;})});}_0x209f5b=_[_0xbd65('0x38')]({},_0x209f5b,_0x20bf08[_0xbd65('0xa3')]);return db[_0xbd65('0x4e')][_0xbd65('0x16')]({'where':_0x209f5b[_0xbd65('0x61')]})['then'](function(_0xa1d004){_0x2f5bfd[_0xbd65('0x16')]=_0xa1d004;if(_0x20bf08[_0xbd65('0x25')][_0xbd65('0xa4')]){_0x209f5b[_0xbd65('0xa5')]=[{'all':!![]}];}return db[_0xbd65('0x4e')]['findAll'](_0x209f5b);})[_0xbd65('0x1a')](function(_0x62a90a){_0x2f5bfd[_0xbd65('0xa6')]=_0x62a90a;return _0x2f5bfd;});}})['then'](respondWithFilteredResult(_0x5b7985,_0x209f5b))[_0xbd65('0x27')](handleError(_0x5b7985,null));};exports['getJscriptySessions']=function(_0x95d8b7,_0x4705b7){var _0x3ee8b2={'raw':!![],'where':{}};var _0x27d0e0={};var _0x249fe7={'count':0x0,'rows':[]};return db[_0xbd65('0x29')][_0xbd65('0x83')]({'where':{'id':_0x95d8b7[_0xbd65('0x28')]['id']}})[_0xbd65('0x1a')](handleEntityNotFound(_0x4705b7,null))[_0xbd65('0x1a')](function(_0x4bd346){if(_0x4bd346){_0x27d0e0[_0xbd65('0x84')]=_['keys'](db[_0xbd65('0x56')]['rawAttributes']);_0x27d0e0[_0xbd65('0x25')]=_[_0xbd65('0x2c')](_0x95d8b7[_0xbd65('0x25')]);_0x27d0e0[_0xbd65('0x8a')]=_[_0xbd65('0x86')](_0x27d0e0[_0xbd65('0x84')],_0x27d0e0['query']);_0x3ee8b2[_0xbd65('0x87')]=_['intersection'](_0x27d0e0[_0xbd65('0x84')],qs[_0xbd65('0x88')](_0x95d8b7[_0xbd65('0x25')][_0xbd65('0x88')]));_0x3ee8b2[_0xbd65('0x87')]=_0x3ee8b2['attributes'][_0xbd65('0x2b')]?_0x3ee8b2[_0xbd65('0x87')]:_0x27d0e0[_0xbd65('0x84')];if(!_0x95d8b7['query']['hasOwnProperty'](_0xbd65('0x8d'))){_0x3ee8b2['limit']=qs[_0xbd65('0x15')](_0x95d8b7[_0xbd65('0x25')][_0xbd65('0x15')]);_0x3ee8b2['offset']=qs[_0xbd65('0x17')](_0x95d8b7[_0xbd65('0x25')][_0xbd65('0x17')]);}_0x3ee8b2[_0xbd65('0x89')]=qs[_0xbd65('0xa8')](_0x95d8b7[_0xbd65('0x25')][_0xbd65('0xa8')]);_0x3ee8b2[_0xbd65('0x61')]=qs[_0xbd65('0x8a')](_['pick'](_0x95d8b7[_0xbd65('0x25')],_0x27d0e0[_0xbd65('0x8a')]));_0x3ee8b2['where']['ContactId']=_0x4bd346['id'];if(_0x95d8b7[_0xbd65('0x25')][_0xbd65('0x8c')]){_0x3ee8b2[_0xbd65('0x61')]=_['merge'](_0x3ee8b2[_0xbd65('0x61')],{'$or':_['map'](_0x3ee8b2['attributes'],function(_0x52fe4f){var _0x473d76={};_0x473d76[_0x52fe4f]={'$like':'%'+_0x95d8b7[_0xbd65('0x25')][_0xbd65('0x8c')]+'%'};return _0x473d76;})});}_0x3ee8b2=_[_0xbd65('0x38')]({},_0x3ee8b2,_0x95d8b7[_0xbd65('0xa3')]);return db[_0xbd65('0x56')][_0xbd65('0x16')]({'where':_0x3ee8b2['where']})[_0xbd65('0x1a')](function(_0x819069){_0x249fe7[_0xbd65('0x16')]=_0x819069;if(_0x95d8b7[_0xbd65('0x25')][_0xbd65('0xa4')]){_0x3ee8b2[_0xbd65('0xa5')]=[{'all':!![]}];}return db[_0xbd65('0x56')][_0xbd65('0x32')](_0x3ee8b2);})[_0xbd65('0x1a')](function(_0x2351be){_0x249fe7[_0xbd65('0xa6')]=_0x2351be;return _0x249fe7;});}})['then'](respondWithFilteredResult(_0x4705b7,_0x3ee8b2))[_0xbd65('0x27')](handleError(_0x4705b7,null));};exports[_0xbd65('0xaa')]=function(_0x20117b,_0x6b47c){try{if(!_0x20117b['body']['ListId']){throw new Error(_0xbd65('0xab'));}if(!_0x20117b[_0xbd65('0x39')][_0xbd65('0xac')]){throw new Error(_0xbd65('0xad'));}if(!_0x20117b[_0xbd65('0x39')][_0xbd65('0xae')]){throw new Error(_0xbd65('0xaf'));}if(!_0x20117b[_0xbd65('0x39')][_0xbd65('0xb0')]){throw new Error(_0xbd65('0xb1'));}var _0x180c5c=_0x20117b[_0xbd65('0x39')][_0xbd65('0xac')][_0xbd65('0xb2')](',');var _0x4e75c8=_0x20117b[_0xbd65('0x39')][_0xbd65('0xae')][_0xbd65('0xb2')](',');if(!_0x180c5c[_0xbd65('0x2b')]||!_0x4e75c8[_0xbd65('0x2b')]||_0x180c5c[_0xbd65('0x2b')]!==_0x4e75c8[_0xbd65('0x2b')]){throw new Error(_0xbd65('0xb3'));}_0x20117b[_0xbd65('0x39')][_0xbd65('0x88')]=_[_0xbd65('0xb4')](_0x180c5c,_0x4e75c8);if(!_0x20117b['body'][_0xbd65('0x88')][_0xbd65('0x96')]){throw new Error(_0xbd65('0xb5'));}if(!_0x20117b[_0xbd65('0x39')][_0xbd65('0x88')][_0xbd65('0xb6')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x7ec2e8=path['join'](config[_0xbd65('0xb7')],_0xbd65('0xb8'),_0x20117b[_0xbd65('0xb9')][_0xbd65('0xba')]);fs[_0xbd65('0xbb')](_0x7ec2e8,parseInt(_0xbd65('0xbc'),0x8));var _0x5bd4c7=require(_0xbd65('0xbd'))[_0xbd65('0xbe')](path[_0xbd65('0x3d')](__dirname,'../../components/import/cm/csv'),[_0x7ec2e8,_0x20117b[_0xbd65('0x39')][_0xbd65('0xac')],_0x20117b['body'][_0xbd65('0xae')],_0x20117b[_0xbd65('0x39')]['ListId'],_0x20117b['body'][_0xbd65('0xbf')],_0x20117b['body']['duplicates'],_0x20117b[_0xbd65('0x39')][_0xbd65('0xb0')]]);return _0x6b47c[_0xbd65('0x12')](0xc8)[_0xbd65('0x13')]({'message':_0xbd65('0xc0'),'pid':_0x5bd4c7[_0xbd65('0xc1')]});}catch(_0xcb8044){return _0x6b47c[_0xbd65('0x12')](0x1f4)[_0xbd65('0x21')](_0xcb8044);}};exports[_0xbd65('0xc2')]=function(_0x4edf2b,_0x34515e){var _0x56ec4a=fs['createReadStream'](_0x4edf2b[_0xbd65('0xb9')]['path']);Papa['parse'](_0x56ec4a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4d49cc){return _0x34515e['status'](0xc8)[_0xbd65('0x13')]({'file':_0x4edf2b[_0xbd65('0xb9')],'fields':_0x4d49cc[_0xbd65('0xc3')][_0xbd65('0x88')]});}});};exports[_0xbd65('0xc4')]=function(_0x17941f,_0x2eb6aa){return db[_0xbd65('0xc5')][_0xbd65('0x32')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbd65('0xc6')}})[_0xbd65('0x1a')](function(_0x41286e){var _0x2e1dec=![];if(!_0x17941f['body'][_0xbd65('0x63')]){throw new Error(_0xbd65('0xab'));}if(!_0x17941f[_0xbd65('0x39')][_0xbd65('0xc7')][_0xbd65('0x96')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x17941f['body']['binding'][_0xbd65('0xb6')]){throw new Error(_0xbd65('0xc8'));}if(!_0x17941f['body'][_0xbd65('0xb0')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x13b203=require(_0xbd65('0xbd'))[_0xbd65('0xbe')](path[_0xbd65('0x3d')](__dirname,'../../components/import/cm/csv2'),[_0x17941f['params']['id'],JSON[_0xbd65('0xc9')](_0x17941f[_0xbd65('0x39')]),JSON[_0xbd65('0xc9')](_0x41286e)]);_0x13b203['on'](_0xbd65('0xca'),function(){_0x2e1dec=!![];return _0x2eb6aa[_0xbd65('0x12')](0xc8)['json']({'message':_0xbd65('0xcb'),'pid':_0x13b203[_0xbd65('0xc1')]});});_0x13b203['on'](_0xbd65('0xcc'),function(_0x214372){if(_0x214372&&!_0x2e1dec){return _0x2eb6aa[_0xbd65('0x12')](0x1f4)[_0xbd65('0x13')]({'message':_0xbd65('0xcd'),'pid':_0x13b203[_0xbd65('0xc1')]});}});})[_0xbd65('0x27')](handleError(_0x2eb6aa,null));};exports[_0xbd65('0xce')]=function(_0x517da4,_0x312541){return db[_0xbd65('0xc5')][_0xbd65('0x32')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbd65('0xc6')}})[_0xbd65('0x1a')](function(_0x360079){var _0x5ecefd=![];if(!_0x517da4[_0xbd65('0x39')][_0xbd65('0x63')]){throw new Error('No\x20ListId\x20specified');}if(!_0x517da4[_0xbd65('0x39')]['binding'][_0xbd65('0x96')]){throw new Error(_0xbd65('0xb5'));}if(!_0x517da4['body'][_0xbd65('0xc7')]['firstName']){throw new Error(_0xbd65('0xc8'));}if(!_0x517da4['body'][_0xbd65('0xb0')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x26d3e7=require(_0xbd65('0xbd'))[_0xbd65('0xbe')](path[_0xbd65('0x3d')](__dirname,_0xbd65('0xcf')),[_0x517da4[_0xbd65('0x28')]['id'],JSON[_0xbd65('0xc9')](_0x517da4[_0xbd65('0x39')]),JSON[_0xbd65('0xc9')](_0x360079)]);_0x26d3e7['on']('message',function(){_0x5ecefd=!![];return _0x312541['status'](0xc8)[_0xbd65('0x13')]({'message':_0xbd65('0xcb'),'pid':_0x26d3e7[_0xbd65('0xc1')]});});_0x26d3e7['on'](_0xbd65('0xcc'),function(_0x644367){if(_0x644367&&!_0x5ecefd){return _0x312541[_0xbd65('0x12')](0x1f4)[_0xbd65('0x13')]({'message':_0xbd65('0xcd'),'pid':_0x26d3e7[_0xbd65('0xc1')]});}});})[_0xbd65('0x27')](handleError(_0x312541,null));};exports[_0xbd65('0xd0')]=function(_0x4c7e99,_0x3229df){var _0x254a33=[_0xbd65('0xd1'),'chat',_0xbd65('0xd2'),_0xbd65('0xd3'),_0xbd65('0xd4'),'whatsapp',_0xbd65('0xd5')];var _0x1b3f05={'offset':0x0,'order':qs[_0xbd65('0xa8')](_0xbd65('0xd6'))},_0x9453e5={'count':0x0,'rows':[]};Promise[_0xbd65('0xd7')]()[_0xbd65('0x1a')](function(){if(_0x4c7e99[_0xbd65('0x25')][_0xbd65('0xd8')]){if(!_['includes'](_0x254a33,_0x4c7e99['query'][_0xbd65('0xd8')]['toLowerCase']())){throw new Error(_0xbd65('0xd9'));}_0x254a33=[_0x4c7e99[_0xbd65('0x25')][_0xbd65('0xd8')]['toLowerCase']()];}if(_0x4c7e99['query'][_0xbd65('0xda')]){try{var _0x2518df=JSON[_0xbd65('0xdb')](_0x4c7e99['query'][_0xbd65('0xda')]);if(!moment(_0x2518df[_0xbd65('0x3f')])[_0xbd65('0xdc')]()){throw new Error(_0xbd65('0xdd'));}if(!moment(_0x2518df['to'])[_0xbd65('0xdc')]()){throw new Error(_0xbd65('0xde'));}}catch(_0x84463f){throw new Error(_0xbd65('0xdf'));}}if(!_0x4c7e99[_0xbd65('0x25')][_0xbd65('0x66')]('nolimit')){_0x1b3f05['limit']=qs[_0xbd65('0x15')](_0x4c7e99[_0xbd65('0x25')][_0xbd65('0x15')]||0xa);_0x1b3f05[_0xbd65('0x17')]=qs[_0xbd65('0x17')](_0x4c7e99[_0xbd65('0x25')][_0xbd65('0x17')]);}var _0x18493b=_0x254a33['map'](function(_0x48eb53){if(_0x48eb53==='voice'){var _0x2c2ebc={'attributes':['id',_0xbd65('0xe0'),_0xbd65('0x34'),_0xbd65('0xe1'),_0xbd65('0xe2'),'callerid',_0xbd65('0xe3'),_0xbd65('0xe4'),_0xbd65('0xe5'),_0xbd65('0xe6'),_0xbd65('0xe7'),_0xbd65('0xe8'),_0xbd65('0xe9'),_0xbd65('0xea'),'UserId'],'where':{'ContactId':_0x4c7e99[_0xbd65('0x28')]['id']},'include':[{'model':db[_0xbd65('0xc5')],'as':_0xbd65('0xc5'),'attributes':['id',_0xbd65('0x20'),'fullname',_0xbd65('0xeb')]}],'order':[[_0xbd65('0xe7'),_0xbd65('0xec')]]};if(_0x4c7e99['query']['range']){_0x2c2ebc[_0xbd65('0x61')][_0xbd65('0xe7')]={'$gte':_0x2518df[_0xbd65('0x3f')],'$lte':_0x2518df['to']};}return db[_0xbd65('0x51')]['findAndCountAll'](_0x2c2ebc)[_0xbd65('0x1a')](function(_0x16c37d){_0x9453e5['count']+=_0x16c37d[_0xbd65('0x16')];return _[_0xbd65('0x76')](_0x16c37d[_0xbd65('0xa6')],function(_0x216e1b){var _0x32d05f=_0x216e1b[_0xbd65('0x3a')]({'plain':!![]});_0x32d05f[_0xbd65('0xd8')]=_0x48eb53;if(_0x32d05f[_0xbd65('0xc5')]){_0x32d05f['User']={'id':_0x32d05f[_0xbd65('0xc5')]['id'],'name':_0x32d05f[_0xbd65('0xc5')]['name'],'fullname':_0x32d05f['User'][_0xbd65('0xed')],'alias':_0x32d05f[_0xbd65('0xc5')]['alias']};}return _0x32d05f;});});}else{var _0xee6253=_[_0xbd65('0xee')](_0x48eb53)+(_0x48eb53==='chat'?_0xbd65('0xef'):_0xbd65('0xf0'));var _0x2b9470={'attributes':['id','closed',_0xbd65('0xf1'),_0xbd65('0xe7'),_0xbd65('0xe6'),'disposition',_0xbd65('0xf2'),'thirdDisposition',_0xbd65('0xf3'),_0xee6253+'Id'],'where':{'ContactId':_0x4c7e99[_0xbd65('0x28')]['id']},'include':[{'model':db[_0xee6253],'as':_0xbd65('0xf0'),'attributes':['id',_0xbd65('0x20'),_0xbd65('0xf4')]},{'model':db['User'],'as':'Owner','attributes':['id',_0xbd65('0x20'),'fullname']},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[['createdAt',_0xbd65('0xec')]]};if(_0x4c7e99['query'][_0xbd65('0xda')]){_0x2b9470[_0xbd65('0x61')]['createdAt']={'$gte':_0x2518df['from'],'$lte':_0x2518df['to']};}switch(_0x48eb53){case _0xbd65('0xf5'):_0x2b9470['attributes'][_0xbd65('0x67')](_0xbd65('0xf6'),_0xbd65('0xf7'),'customerPort',_0xbd65('0xf8'),_0xbd65('0xf9'),_0xbd65('0xfa'),'ratingType',_0xbd65('0xfb'),_0xbd65('0xfc'));break;case _0xbd65('0xd1'):_0x2b9470['attributes'][_0xbd65('0x67')](_0xbd65('0xfd'),_0xbd65('0xfe'));break;case _0xbd65('0xd3'):_0x2b9470['attributes'][_0xbd65('0x67')](_0xbd65('0xff'),_0xbd65('0x100'));break;}return db[_[_0xbd65('0xee')](_0x48eb53)+'Interaction'][_0xbd65('0x101')](_0x2b9470)[_0xbd65('0x1a')](function(_0x132587){_0x9453e5['count']+=_0x132587[_0xbd65('0x16')];return _['map'](_0x132587[_0xbd65('0xa6')],function(_0x32f1b8){var _0x1a53c0=_0x32f1b8['get']({'plain':!![]});_0x1a53c0[_0xbd65('0xd8')]=_0x48eb53;if(_0x1a53c0['Owner']){_0x1a53c0['Owner']={'id':_0x1a53c0[_0xbd65('0x102')]['id'],'name':_0x1a53c0[_0xbd65('0x102')]['name'],'fullname':_0x1a53c0[_0xbd65('0x102')][_0xbd65('0xed')]};}return _0x1a53c0;});});}});return Promise[_0xbd65('0x69')](_0x18493b);})[_0xbd65('0x1a')](function(_0x5be450){return _(_0x5be450)['flatten']()[_0xbd65('0x103')](_0xbd65('0xe7'))['reverse']()[_0xbd65('0x104')]();})[_0xbd65('0x1a')](function(_0x20cebb){_0x9453e5[_0xbd65('0xa6')]=_0x1b3f05[_0xbd65('0x15')]?_0x20cebb['slice'](_0x1b3f05[_0xbd65('0x17')],_0x1b3f05[_0xbd65('0x17')]+_0x1b3f05[_0xbd65('0x15')]):_0x20cebb;return _0x9453e5;})[_0xbd65('0x1a')](respondWithFilteredResult(_0x3229df,_0x1b3f05))[_0xbd65('0x27')](handleError(_0x3229df,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1f8ee59..42f3ac3 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 _0x1c52=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x409425,_0x3da267){var _0x5d46bf=function(_0x4b98af){while(--_0x4b98af){_0x409425['push'](_0x409425['shift']());}};_0x5d46bf(++_0x3da267);}(_0x1c52,0xa9));var _0x21c5=function(_0x2bebd4,_0x2f5ce7){_0x2bebd4=_0x2bebd4-0x0;var _0x8a9731=_0x1c52[_0x2bebd4];return _0x8a9731;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x21c5('0x0')](0x0);var events={'afterCreate':_0x21c5('0x1'),'afterUpdate':_0x21c5('0x2'),'afterDestroy':_0x21c5('0x3')};function emitEvent(_0x40db6b){return function(_0x31db26,_0x1795ee,_0x10995a){CmContactEvents[_0x21c5('0x4')](_0x40db6b+':'+_0x31db26['id'],_0x31db26);CmContactEvents['emit'](_0x40db6b,_0x31db26);_0x10995a(null);};}for(var e in events){if(events[_0x21c5('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x21c5('0x6')]=CmContactEvents; \ No newline at end of file +var _0xe98f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x375233,_0x165da0){var _0xb1fac5=function(_0x535787){while(--_0x535787){_0x375233['push'](_0x375233['shift']());}};_0xb1fac5(++_0x165da0);}(_0xe98f,0x1c0));var _0xfe98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfe98('0x0'));var CmContact=require(_0xfe98('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xfe98('0x2')](0x0);var events={'afterCreate':_0xfe98('0x3'),'afterUpdate':_0xfe98('0x4'),'afterDestroy':_0xfe98('0x5')};function emitEvent(_0x42794a){return function(_0x5e484c,_0x4695e8,_0x4e0c70){CmContactEvents[_0xfe98('0x6')](_0x42794a+':'+_0x5e484c['id'],_0x5e484c);CmContactEvents['emit'](_0x42794a,_0x5e484c);_0x4e0c70(null);};}for(var e in events){if(events[_0xfe98('0x7')](e)){var event=events[e];CmContact[_0xfe98('0x8')](e,emitEvent(event));}}module[_0xfe98('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index f14f9cf..112aedb 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 _0x3b9c=['utf8mb4','utf8mb4_unicode_ci','models','get','catch','error','message','destroy','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','dialTimezone','resolve','then','isNil','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','priority','callbackUniqueid','phone','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','CmList','Lists','map','all','BlackLists','CmHopperBlack','define','CmContact','cm_contacts','fti_cm_contacts','firstName','fax','email'];(function(_0x563182,_0xc17861){var _0x2003ce=function(_0x2495a6){while(--_0x2495a6){_0x563182['push'](_0x563182['shift']());}};_0x2003ce(++_0xc17861);}(_0x3b9c,0x1bf));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3b9('0x0'));var util=require('util');var logger=require(_0xc3b9('0x1'))(_0xc3b9('0x2'));var moment=require(_0xc3b9('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0xc3b9('0x4'));function getTimezoneCallbackAt(_0x4a87e6,_0x58add4,_0x3dea01,_0x57f3ca){var _0x33d027=_0x57f3ca?_0xc3b9('0x5'):_0xc3b9('0x6');var _0x2877b6=_0x3dea01[_0xc3b9('0x7')]?_0x3dea01[_0xc3b9('0x7')]:moment()[_0xc3b9('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x3dea01[_0xc3b9('0x9')])){return Promise[_0xc3b9('0xa')](_0x2877b6);}return _0x4a87e6[_0x33d027]['findOne']({'where':{'id':_0x58add4}})[_0xc3b9('0xb')](function(_0x3a76be){if(_['isNil'](_0x3a76be)||_[_0xc3b9('0xc')](_0x3a76be[_0xc3b9('0x9')])){return Promise['resolve'](_0x2877b6);}var _0x3ae9c4=shared[_0xc3b9('0xd')];var _0x302599=_0x3ae9c4[_0x3a76be[_0xc3b9('0x9')]];var _0x267c9f=_0x3ae9c4[_0x3dea01[_0xc3b9('0x9')]];if(_['isNil'](_0x302599)&&_[_0xc3b9('0xc')](_0x267c9f)){return Promise[_0xc3b9('0xa')](_0x2877b6);}var _0x29e130=_0x302599['utcOffset']-_0x267c9f[_0xc3b9('0xe')];var _0x2ec551=_0x3dea01[_0xc3b9('0x7')]?_0x3dea01[_0xc3b9('0x7')]:moment();_0x2877b6=moment(_0x2ec551)['add'](_0x29e130,_0xc3b9('0xf'))[_0xc3b9('0x8')](_0xc3b9('0x10'));return Promise[_0xc3b9('0xa')](_0x2877b6);});}function getNewHopperPayload(_0x36899d){return{'phone':_0x36899d['phone'],'ContactId':_0x36899d['id'],'ListId':_0x36899d[_0xc3b9('0x11')],'scheduledat':_0x36899d[_0xc3b9('0x7')]?_0x36899d[_0xc3b9('0x7')]:moment()[_0xc3b9('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x36899d['priority']?_0x36899d[_0xc3b9('0x12')]:0x2,'callback':_0x36899d[_0xc3b9('0x13')]?!![]:![],'callbackuniqueid':_0x36899d[_0xc3b9('0x13')]?_0x36899d[_0xc3b9('0x13')]:undefined,'callbackat':_0x36899d[_0xc3b9('0x13')]?moment()[_0xc3b9('0x8')](_0xc3b9('0x10')):undefined};}function handleAlwaysCheckDuplicate(_0xbbaf59,_0x4f650c,_0xead53f,_0x10e605){var _0x219384={'phone':_0xead53f[_0xc3b9('0x14')]};var _0x54aed6={'calleridnum':_0xead53f[_0xc3b9('0x14')]};if(_0x10e605){Object[_0xc3b9('0x15')](_0x219384,{'CampaignId':_0x4f650c['id']});Object['assign'](_0x54aed6,{'CampaignId':_0x4f650c['id']});}else{Object['assign'](_0x219384,{'VoiceQueueId':_0x4f650c['id']});Object['assign'](_0x54aed6,{'VoiceQueueId':_0x4f650c['id']});}return _0xbbaf59[_0xc3b9('0x16')][_0xc3b9('0x17')]({'where':_0x219384})['then'](function(_0x22e470){if(_0x22e470){throw new Error(_0xc3b9('0x18')+_0xead53f['phone']+_0xc3b9('0x19')+_0x4f650c['id']);}return _0xbbaf59[_0xc3b9('0x1a')][_0xc3b9('0x17')]({'where':_0x54aed6});})[_0xc3b9('0xb')](function(_0x3e7f78){if(_0x3e7f78){throw new Error(_0xc3b9('0x1b')+_0xead53f[_0xc3b9('0x14')]+_0xc3b9('0x19')+_0x4f650c['id']);}var _0x17ba35=getNewHopperPayload(_0xead53f);if(_0x10e605){_0x17ba35[_0xc3b9('0x1c')]=_0x4f650c['id'];}else{_0x17ba35['VoiceQueueId']=_0x4f650c['id'];}return _0xbbaf59['CmHopper'][_0xc3b9('0x1d')](_0x17ba35);});}function handleOnlyIfOpenCheckDuplicate(_0x31735b,_0x5cf4ef,_0x1d93d6,_0x58e573){var _0x55d7d8={'phone':_0x1d93d6[_0xc3b9('0x14')]};if(_0x58e573){Object[_0xc3b9('0x15')](_0x55d7d8,{'CampaignId':_0x5cf4ef['id']});}else{Object[_0xc3b9('0x15')](_0x55d7d8,{'VoiceQueueId':_0x5cf4ef['id']});}return _0x31735b['CmHopper'][_0xc3b9('0x17')]({'where':_0x55d7d8})[_0xc3b9('0xb')](function(_0x37965e){if(_0x37965e){throw new Error(_0xc3b9('0x1e')+_0x1d93d6['phone']+_0xc3b9('0x19')+_0x5cf4ef['id']);}var _0x30833d=getNewHopperPayload(_0x1d93d6);if(_0x58e573){_0x30833d['CampaignId']=_0x5cf4ef['id'];}else{_0x30833d[_0xc3b9('0x1f')]=_0x5cf4ef['id'];}return _0x31735b[_0xc3b9('0x16')]['create'](_0x30833d);});}function handleNeverCheckDuplicate(_0x231ea1,_0x5db624,_0x320f6a){var _0x4b193f=getNewHopperPayload(_0x320f6a);_0x4b193f[_0xc3b9('0x1f')]=_0x5db624['id'];return _0x231ea1['CmHopper'][_0xc3b9('0x1d')](_0x4b193f);}function handleCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa){return getTimezoneCallbackAt(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa)[_0xc3b9('0xb')](function(_0x179503){_0x2e980f[_0xc3b9('0x7')]=_0x179503;switch(_0x231bc4['dialCheckDuplicateType']){case'always':return handleAlwaysCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa);case _0xc3b9('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f,_0x2d06fa);default:return handleNeverCheckDuplicate(_0x3ad14b,_0x231bc4,_0x2e980f);}});}function createHopperForVoiceQueues(_0x87daff,_0x5885e9){return _0x87daff[_0xc3b9('0x6')][_0xc3b9('0x21')]({'where':{'type':_0xc3b9('0x22')},'attributes':['id',_0xc3b9('0x23'),_0xc3b9('0x9')],'include':[{'model':_0x87daff[_0xc3b9('0x24')],'as':_0xc3b9('0x25'),'where':{'id':_0x5885e9[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x5eb7ff){var _0x282cf8=_0x5eb7ff[_0xc3b9('0x26')](function(_0x5ea0a6){return handleCheckDuplicate(_0x87daff,_0x5ea0a6,_0x5885e9,![]);});return Promise[_0xc3b9('0x27')](_0x282cf8);});}function createHopperForCampaigns(_0x39f6a8,_0x3c5bb8){return _0x39f6a8['Campaign'][_0xc3b9('0x21')]({'attributes':['id',_0xc3b9('0x23'),_0xc3b9('0x9')],'include':[{'model':_0x39f6a8[_0xc3b9('0x24')],'as':_0xc3b9('0x25'),'where':{'id':_0x3c5bb8[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x27bd9){var _0x32aa9c=_0x27bd9[_0xc3b9('0x26')](function(_0x7b0a9){return handleCheckDuplicate(_0x39f6a8,_0x7b0a9,_0x3c5bb8,!![]);});return Promise['all'](_0x32aa9c);});}function createHopperBlackForVoiceQueues(_0x2ce3bb,_0x577439){return _0x2ce3bb[_0xc3b9('0x6')][_0xc3b9('0x21')]({'where':{'type':_0xc3b9('0x22')},'attributes':['id'],'include':[{'model':_0x2ce3bb['CmList'],'as':_0xc3b9('0x28'),'where':{'id':_0x577439[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x44ea43){var _0x38e312=_0x44ea43[_0xc3b9('0x26')](function(_0x37d7ab){return _0x2ce3bb[_0xc3b9('0x29')][_0xc3b9('0x1d')]({'phone':_0x577439[_0xc3b9('0x14')],'ContactId':_0x577439['id'],'ListId':_0x577439[_0xc3b9('0x11')],'VoiceQueueId':_0x37d7ab['id']});});return Promise['all'](_0x38e312);});}function createHopperBlackForCampaigns(_0x15c5cf,_0xa0de27){return _0x15c5cf[_0xc3b9('0x5')][_0xc3b9('0x21')]({'attributes':['id'],'include':[{'model':_0x15c5cf[_0xc3b9('0x24')],'as':'BlackLists','where':{'id':_0xa0de27[_0xc3b9('0x11')]}}],'raw':!![]})[_0xc3b9('0xb')](function(_0x302b8f){var _0x3b2d6f=_0x302b8f['map'](function(_0x3b496f){return _0x15c5cf[_0xc3b9('0x29')][_0xc3b9('0x1d')]({'phone':_0xa0de27[_0xc3b9('0x14')],'ContactId':_0xa0de27['id'],'ListId':_0xa0de27[_0xc3b9('0x11')],'CampaignId':_0x3b496f['id']});});return Promise[_0xc3b9('0x27')](_0x3b2d6f);});}module['exports']=function(_0x21015f){return _0x21015f[_0xc3b9('0x2a')](_0xc3b9('0x2b'),attributes,{'tableName':_0xc3b9('0x2c'),'paranoid':!![],'indexes':[{'name':_0xc3b9('0x14'),'fields':[_0xc3b9('0x14')]},{'name':_0xc3b9('0x2d'),'fields':[_0xc3b9('0x2e'),'lastName','phone','mobile',_0xc3b9('0x2f'),_0xc3b9('0x30')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xc3b9('0x31'),'collate':_0xc3b9('0x32'),'hooks':{'afterCreate':function(_0x189eaa,_0xbd0074,_0x5ee428){var _0xf5056a=_0x21015f[_0xc3b9('0x33')];var _0x43d315=_0x189eaa[_0xc3b9('0x34')]({'plain':!![]});if(!_0x43d315[_0xc3b9('0x11')]){logger['error']('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x43d315['id']);return _0x5ee428();}if(!_0x43d315[_0xc3b9('0x14')]){return _0x5ee428();}return createHopperForVoiceQueues(_0xf5056a,_0x43d315)[_0xc3b9('0xb')](function(){return createHopperBlackForVoiceQueues(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return createHopperForCampaigns(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return createHopperBlackForCampaigns(_0xf5056a,_0x43d315);})[_0xc3b9('0xb')](function(){return _0x5ee428();})[_0xc3b9('0x35')](function(_0x187edb){logger[_0xc3b9('0x36')]('[cmContact][afterCreate]',_0x187edb[_0xc3b9('0x37')]);_0x5ee428();});},'afterDestroy':function(_0x54339a,_0xf9e012,_0x1e1bd8){var _0x2c19a2=_0x21015f[_0xc3b9('0x33')];var _0x2e350b=_0x54339a[_0xc3b9('0x34')]({'plain':!![]});return _0x2c19a2[_0xc3b9('0x16')][_0xc3b9('0x21')]({'raw':!![],'where':{'ListId':_0x2e350b['ListId'],'ContactId':_0x2e350b['id']}})['then'](function(_0x4f6689){if(!_['isEmpty'](_0x4f6689)){var _0x518051=[];for(var _0x2e0904=0x0;_0x2e0904<_0x4f6689['length'];_0x2e0904+=0x1){var _0x3fb3a1=_0x2c19a2['CmHopper'][_0xc3b9('0x38')]({'where':{'ListId':_0x4f6689[_0x2e0904]['ListId'],'ContactId':_0x4f6689[_0x2e0904]['ContactId'],'VoiceQueueId':_0x4f6689[_0x2e0904]['VoiceQueueId'],'CampaignId':_0x4f6689[_0x2e0904][_0xc3b9('0x1c')]}});_0x518051[_0xc3b9('0x39')](_0x3fb3a1);}return Promise[_0xc3b9('0x27')](_0x518051);}})['then'](function(_0x2fe7bd){logger[_0xc3b9('0x3a')](_0xc3b9('0x3b'),util[_0xc3b9('0x3c')](_0x2fe7bd,{'showHidden':![],'depth':null}));_0x1e1bd8();})[_0xc3b9('0x35')](function(_0x2708de){logger[_0xc3b9('0x36')](_0xc3b9('0x3d'),util['inspect'](_0x2708de,{'showHidden':![],'depth':null}));_0x1e1bd8(_0x2708de);});}}});}; \ No newline at end of file +var _0x4051=['utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','CmHopper','findOne','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','dialCheckDuplicateType','always','findAll','CmList','map','all','Lists','outbound','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','catch','error','[cmContact][afterCreate]','message','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','resolve','timezones','dialTimezone'];(function(_0x1741a3,_0x3efb0b){var _0x3f9f7b=function(_0x35fd9f){while(--_0x35fd9f){_0x1741a3['push'](_0x1741a3['shift']());}};_0x3f9f7b(++_0x3efb0b);}(_0x4051,0xc1));var _0x1405=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4051[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x1405('0x0'));var util=require('util');var logger=require(_0x1405('0x1'))(_0x1405('0x2'));var moment=require(_0x1405('0x3'));var shared=require(_0x1405('0x4'));var attributes=require(_0x1405('0x5'));function getTimezoneCallbackAt(_0x36fbc9,_0x4b7d8b,_0x36fa2f,_0x5192af){var _0x4b05b7=_0x5192af?_0x1405('0x6'):_0x1405('0x7');var _0x33d3f5=_0x36fa2f['scheduledat']?_0x36fa2f[_0x1405('0x8')]:moment()['format'](_0x1405('0x9'));if(_['isNil'](_0x36fa2f['dialTimezone'])){return Promise['resolve'](_0x33d3f5);}return _0x36fbc9[_0x4b05b7]['findOne']({'where':{'id':_0x4b7d8b}})['then'](function(_0x337ffe){if(_[_0x1405('0xa')](_0x337ffe)||_[_0x1405('0xa')](_0x337ffe['dialTimezone'])){return Promise[_0x1405('0xb')](_0x33d3f5);}var _0x1fe096=shared[_0x1405('0xc')];var _0x4a91b9=_0x1fe096[_0x337ffe['dialTimezone']];var _0x296930=_0x1fe096[_0x36fa2f[_0x1405('0xd')]];if(_[_0x1405('0xa')](_0x4a91b9)&&_['isNil'](_0x296930)){return Promise['resolve'](_0x33d3f5);}var _0x2b23a9=_0x4a91b9[_0x1405('0xe')]-_0x296930[_0x1405('0xe')];var _0x2766b8=_0x36fa2f[_0x1405('0x8')]?_0x36fa2f[_0x1405('0x8')]:moment();_0x33d3f5=moment(_0x2766b8)[_0x1405('0xf')](_0x2b23a9,_0x1405('0x10'))['format'](_0x1405('0x9'));return Promise[_0x1405('0xb')](_0x33d3f5);});}function getNewHopperPayload(_0x4ade11){return{'phone':_0x4ade11[_0x1405('0x11')],'ContactId':_0x4ade11['id'],'ListId':_0x4ade11[_0x1405('0x12')],'scheduledat':_0x4ade11[_0x1405('0x8')]?_0x4ade11[_0x1405('0x8')]:moment()[_0x1405('0x13')](_0x1405('0x9')),'priority':_0x4ade11[_0x1405('0x14')]?_0x4ade11['priority']:0x2,'callback':_0x4ade11['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ade11[_0x1405('0x15')]?_0x4ade11[_0x1405('0x15')]:undefined,'callbackat':_0x4ade11['callbackUniqueid']?moment()[_0x1405('0x13')](_0x1405('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x263ce3,_0x1f8fac,_0x5d883b,_0x731ed1){var _0x4b6fd3={'phone':_0x5d883b[_0x1405('0x11')]};var _0xe84141={'calleridnum':_0x5d883b['phone']};if(_0x731ed1){Object['assign'](_0x4b6fd3,{'CampaignId':_0x1f8fac['id']});Object[_0x1405('0x16')](_0xe84141,{'CampaignId':_0x1f8fac['id']});}else{Object[_0x1405('0x16')](_0x4b6fd3,{'VoiceQueueId':_0x1f8fac['id']});Object[_0x1405('0x16')](_0xe84141,{'VoiceQueueId':_0x1f8fac['id']});}return _0x263ce3[_0x1405('0x17')][_0x1405('0x18')]({'where':_0x4b6fd3})[_0x1405('0x19')](function(_0x299ec7){if(_0x299ec7){throw new Error(_0x1405('0x1a')+_0x5d883b[_0x1405('0x11')]+_0x1405('0x1b')+_0x1f8fac['id']);}return _0x263ce3[_0x1405('0x1c')][_0x1405('0x18')]({'where':_0xe84141});})[_0x1405('0x19')](function(_0x3ec931){if(_0x3ec931){throw new Error(_0x1405('0x1d')+_0x5d883b[_0x1405('0x11')]+_0x1405('0x1b')+_0x1f8fac['id']);}var _0x5e187a=getNewHopperPayload(_0x5d883b);if(_0x731ed1){_0x5e187a['CampaignId']=_0x1f8fac['id'];}else{_0x5e187a[_0x1405('0x1e')]=_0x1f8fac['id'];}return _0x263ce3[_0x1405('0x17')][_0x1405('0x1f')](_0x5e187a);});}function handleOnlyIfOpenCheckDuplicate(_0xa5b56f,_0x3edc05,_0x15ae8c,_0x9f7801){var _0x4572c1={'phone':_0x15ae8c[_0x1405('0x11')]};if(_0x9f7801){Object[_0x1405('0x16')](_0x4572c1,{'CampaignId':_0x3edc05['id']});}else{Object[_0x1405('0x16')](_0x4572c1,{'VoiceQueueId':_0x3edc05['id']});}return _0xa5b56f[_0x1405('0x17')]['findOne']({'where':_0x4572c1})[_0x1405('0x19')](function(_0x21f35b){if(_0x21f35b){throw new Error(_0x1405('0x20')+_0x15ae8c['phone']+_0x1405('0x1b')+_0x3edc05['id']);}var _0x143228=getNewHopperPayload(_0x15ae8c);if(_0x9f7801){_0x143228[_0x1405('0x21')]=_0x3edc05['id'];}else{_0x143228[_0x1405('0x1e')]=_0x3edc05['id'];}return _0xa5b56f['CmHopper'][_0x1405('0x1f')](_0x143228);});}function handleNeverCheckDuplicate(_0xe6a2e2,_0x5ec121,_0x38b909){var _0x26f1c1=getNewHopperPayload(_0x38b909);_0x26f1c1[_0x1405('0x1e')]=_0x5ec121['id'];return _0xe6a2e2['CmHopper'][_0x1405('0x1f')](_0x26f1c1);}function handleCheckDuplicate(_0x53b59b,_0x593a93,_0xfba749,_0x32a9c2){return getTimezoneCallbackAt(_0x53b59b,_0x593a93,_0xfba749,_0x32a9c2)[_0x1405('0x19')](function(_0x24ab74){_0xfba749[_0x1405('0x8')]=_0x24ab74;switch(_0x593a93[_0x1405('0x22')]){case _0x1405('0x23'):return handleAlwaysCheckDuplicate(_0x53b59b,_0x593a93,_0xfba749,_0x32a9c2);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x53b59b,_0x593a93,_0xfba749,_0x32a9c2);default:return handleNeverCheckDuplicate(_0x53b59b,_0x593a93,_0xfba749);}});}function createHopperForVoiceQueues(_0x14510e,_0x5afd5e){return _0x14510e[_0x1405('0x7')][_0x1405('0x24')]({'where':{'type':'outbound'},'attributes':['id',_0x1405('0x22'),_0x1405('0xd')],'include':[{'model':_0x14510e[_0x1405('0x25')],'as':'Lists','where':{'id':_0x5afd5e[_0x1405('0x12')]}}],'raw':!![]})[_0x1405('0x19')](function(_0x1a21a0){var _0x22a166=_0x1a21a0[_0x1405('0x26')](function(_0x257621){return handleCheckDuplicate(_0x14510e,_0x257621,_0x5afd5e,![]);});return Promise[_0x1405('0x27')](_0x22a166);});}function createHopperForCampaigns(_0x514d8f,_0xf1cd79){return _0x514d8f[_0x1405('0x6')][_0x1405('0x24')]({'attributes':['id',_0x1405('0x22'),_0x1405('0xd')],'include':[{'model':_0x514d8f[_0x1405('0x25')],'as':_0x1405('0x28'),'where':{'id':_0xf1cd79[_0x1405('0x12')]}}],'raw':!![]})[_0x1405('0x19')](function(_0x33c683){var _0xd290bc=_0x33c683[_0x1405('0x26')](function(_0x4f2c15){return handleCheckDuplicate(_0x514d8f,_0x4f2c15,_0xf1cd79,!![]);});return Promise[_0x1405('0x27')](_0xd290bc);});}function createHopperBlackForVoiceQueues(_0x4bfcbb,_0x4c2b78){return _0x4bfcbb['VoiceQueue'][_0x1405('0x24')]({'where':{'type':_0x1405('0x29')},'attributes':['id'],'include':[{'model':_0x4bfcbb[_0x1405('0x25')],'as':_0x1405('0x2a'),'where':{'id':_0x4c2b78[_0x1405('0x12')]}}],'raw':!![]})['then'](function(_0x2097fd){var _0x12237e=_0x2097fd[_0x1405('0x26')](function(_0x316ee3){return _0x4bfcbb[_0x1405('0x2b')]['create']({'phone':_0x4c2b78[_0x1405('0x11')],'ContactId':_0x4c2b78['id'],'ListId':_0x4c2b78[_0x1405('0x12')],'VoiceQueueId':_0x316ee3['id']});});return Promise[_0x1405('0x27')](_0x12237e);});}function createHopperBlackForCampaigns(_0x234adc,_0x3d7117){return _0x234adc[_0x1405('0x6')]['findAll']({'attributes':['id'],'include':[{'model':_0x234adc[_0x1405('0x25')],'as':_0x1405('0x2a'),'where':{'id':_0x3d7117[_0x1405('0x12')]}}],'raw':!![]})[_0x1405('0x19')](function(_0x22adfb){var _0x23cf40=_0x22adfb[_0x1405('0x26')](function(_0x2c8b0d){return _0x234adc['CmHopperBlack']['create']({'phone':_0x3d7117[_0x1405('0x11')],'ContactId':_0x3d7117['id'],'ListId':_0x3d7117['ListId'],'CampaignId':_0x2c8b0d['id']});});return Promise['all'](_0x23cf40);});}module[_0x1405('0x2c')]=function(_0x23b469){return _0x23b469[_0x1405('0x2d')](_0x1405('0x2e'),attributes,{'tableName':_0x1405('0x2f'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1405('0x11')]},{'name':_0x1405('0x30'),'fields':[_0x1405('0x31'),'lastName',_0x1405('0x11'),_0x1405('0x32'),_0x1405('0x33'),_0x1405('0x34')],'type':_0x1405('0x35')}],'timestamps':!![],'charset':_0x1405('0x36'),'collate':_0x1405('0x37'),'hooks':{'afterCreate':function(_0x2169ce,_0x5a155c,_0x2929ca){var _0x429596=_0x23b469[_0x1405('0x38')];var _0xfde829=_0x2169ce[_0x1405('0x39')]({'plain':!![]});if(!_0xfde829[_0x1405('0x12')]){logger['error']('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0xfde829['id']);return _0x2929ca();}if(!_0xfde829[_0x1405('0x11')]){return _0x2929ca();}return createHopperForVoiceQueues(_0x429596,_0xfde829)[_0x1405('0x19')](function(){return createHopperBlackForVoiceQueues(_0x429596,_0xfde829);})['then'](function(){return createHopperForCampaigns(_0x429596,_0xfde829);})[_0x1405('0x19')](function(){return createHopperBlackForCampaigns(_0x429596,_0xfde829);})[_0x1405('0x19')](function(){return _0x2929ca();})[_0x1405('0x3a')](function(_0x5c9ceb){logger[_0x1405('0x3b')](_0x1405('0x3c'),_0x5c9ceb[_0x1405('0x3d')]);_0x2929ca();});},'afterDestroy':function(_0x5b86f1,_0x567e36,_0xa8551b){var _0x45534d=_0x23b469[_0x1405('0x38')];var _0x109a72=_0x5b86f1[_0x1405('0x39')]({'plain':!![]});return _0x45534d[_0x1405('0x17')][_0x1405('0x24')]({'raw':!![],'where':{'ListId':_0x109a72['ListId'],'ContactId':_0x109a72['id']}})[_0x1405('0x19')](function(_0x5d5203){if(!_['isEmpty'](_0x5d5203)){var _0x4ebf4b=[];for(var _0x4e1160=0x0;_0x4e1160<_0x5d5203[_0x1405('0x3e')];_0x4e1160+=0x1){var _0x172ab2=_0x45534d['CmHopper'][_0x1405('0x3f')]({'where':{'ListId':_0x5d5203[_0x4e1160][_0x1405('0x12')],'ContactId':_0x5d5203[_0x4e1160][_0x1405('0x40')],'VoiceQueueId':_0x5d5203[_0x4e1160][_0x1405('0x1e')],'CampaignId':_0x5d5203[_0x4e1160][_0x1405('0x21')]}});_0x4ebf4b[_0x1405('0x41')](_0x172ab2);}return Promise['all'](_0x4ebf4b);}})['then'](function(_0x11dcb0){logger['info'](_0x1405('0x42'),util[_0x1405('0x43')](_0x11dcb0,{'showHidden':![],'depth':null}));_0xa8551b();})[_0x1405('0x3a')](function(_0x37e908){logger[_0x1405('0x3b')](_0x1405('0x44'),util['inspect'](_0x37e908,{'showHidden':![],'depth':null}));_0xa8551b(_0x37e908);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 84b99a3..f3ae25f 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x17e42d,_0x4d990c){var _0x3f24f5=function(_0xc975aa){while(--_0xc975aa){_0x17e42d['push'](_0x17e42d['shift']());}};_0x3f24f5(++_0x4d990c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index f03ce35..a82e89d 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 _0x68fc=['STRING','sequelize','exports','INTEGER'];(function(_0x5af464,_0x24b35f){var _0x58375a=function(_0x5e6324){while(--_0x5e6324){_0x5af464['push'](_0x5af464['shift']());}};_0x58375a(++_0x24b35f);}(_0x68fc,0xa5));var _0xc68f=function(_0x2b049b,_0x250f3a){_0x2b049b=_0x2b049b-0x0;var _0x29bbeb=_0x68fc[_0x2b049b];return _0x29bbeb;};'use strict';var Sequelize=require(_0xc68f('0x0'));module[_0xc68f('0x1')]={'CmContactId':{'type':Sequelize[_0xc68f('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc68f('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc68f('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x1f63=['STRING','INTEGER','sequelize','exports'];(function(_0x55d94e,_0x34a202){var _0x37110c=function(_0x43b958){while(--_0x43b958){_0x55d94e['push'](_0x55d94e['shift']());}};_0x37110c(++_0x34a202);}(_0x1f63,0x7a));var _0x31f6=function(_0x23f988,_0x44a93e){_0x23f988=_0x23f988-0x0;var _0x163a2=_0x1f63[_0x23f988];return _0x163a2;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x31f6('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x31f6('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x31f6('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x31f6('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x31f6('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 e55ca40..1c3b4a5 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 _0x9df1=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','end','error','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','findAll','catch','show','keys','include','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1151fa,_0x2784a7){var _0x49da2b=function(_0x2d33ca){while(--_0x2d33ca){_0x1151fa['push'](_0x1151fa['shift']());}};_0x49da2b(++_0x2784a7);}(_0x9df1,0x17f));var _0x19df=function(_0x1bd9e5,_0x56a90c){_0x1bd9e5=_0x1bd9e5-0x0;var _0x931e59=_0x9df1[_0x1bd9e5];return _0x931e59;};'use strict';var emlformat=require(_0x19df('0x0'));var rimraf=require(_0x19df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19df('0x2'));var moment=require(_0x19df('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x19df('0x4'));var path=require(_0x19df('0x5'));var sox=require(_0x19df('0x6'));var csv=require(_0x19df('0x7'));var ejs=require(_0x19df('0x8'));var fs=require('fs');var fs_extra=require(_0x19df('0x9'));var _=require(_0x19df('0xa'));var squel=require('squel');var crypto=require(_0x19df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x19df('0xc'));var toCsv=require(_0x19df('0x7'));var querystring=require(_0x19df('0xd'));var Papa=require(_0x19df('0xe'));var Redis=require(_0x19df('0xf'));var authService=require(_0x19df('0x10'));var qs=require(_0x19df('0x11'));var as=require(_0x19df('0x12'));var hardwareService=require(_0x19df('0x13'));var logger=require(_0x19df('0x14'))(_0x19df('0x15'));var utils=require(_0x19df('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x19df('0x17'));var db=require(_0x19df('0x18'))['db'];function respondWithStatusCode(_0x30499d,_0x4e268c){_0x4e268c=_0x4e268c||0xcc;return function(_0x1e944e){if(_0x1e944e){return _0x30499d[_0x19df('0x19')](_0x4e268c);}return _0x30499d[_0x19df('0x1a')](_0x4e268c)['end']();};}function respondWithResult(_0x35cd03,_0x2cbb1d){_0x2cbb1d=_0x2cbb1d||0xc8;return function(_0x1b300e){if(_0x1b300e){return _0x35cd03[_0x19df('0x1a')](_0x2cbb1d)[_0x19df('0x1b')](_0x1b300e);}};}function respondWithFilteredResult(_0x4efe9a,_0x4020f8){return function(_0x4b1aea){if(_0x4b1aea){var _0x55f758=typeof _0x4020f8[_0x19df('0x1c')]===_0x19df('0x1d')&&typeof _0x4020f8['limit']===_0x19df('0x1d');var _0x3729e0=_0x4b1aea[_0x19df('0x1e')];var _0x45c2ee=_0x55f758?0x0:_0x4020f8[_0x19df('0x1c')];var _0x4e8509=_0x55f758?_0x4b1aea[_0x19df('0x1e')]:_0x4020f8[_0x19df('0x1c')]+_0x4020f8[_0x19df('0x1f')];var _0x5d0fe8;if(_0x4e8509>=_0x3729e0){_0x4e8509=_0x3729e0;_0x5d0fe8=0xc8;}else{_0x5d0fe8=0xce;}_0x4efe9a[_0x19df('0x1a')](_0x5d0fe8);return _0x4efe9a[_0x19df('0x20')](_0x19df('0x21'),_0x45c2ee+'-'+_0x4e8509+'/'+_0x3729e0)[_0x19df('0x1b')](_0x4b1aea);}return null;};}function patchUpdates(_0xf7f4e3){return function(_0x5a12ae){try{jsonpatch['apply'](_0x5a12ae,_0xf7f4e3,!![]);}catch(_0x4dbb97){return BPromise[_0x19df('0x22')](_0x4dbb97);}return _0x5a12ae[_0x19df('0x23')]();};}function saveUpdates(_0x2b80ca,_0x215044){return function(_0x64f9b3){if(_0x64f9b3){return _0x64f9b3['update'](_0x2b80ca)[_0x19df('0x24')](function(_0x375451){return _0x375451;});}return null;};}function removeEntity(_0x2111fd,_0x3a3147){return function(_0x325757){if(_0x325757){return _0x325757[_0x19df('0x25')]()[_0x19df('0x24')](function(){var _0x3b6514=_0x325757['get']({'plain':!![]});var _0x3f0953='CmContactHasItems';return db[_0x19df('0x26')][_0x19df('0x25')]({'where':{'type':_0x3f0953,'resourceId':_0x3b6514['id']}})[_0x19df('0x24')](function(){return _0x325757;});})[_0x19df('0x24')](function(){_0x2111fd[_0x19df('0x1a')](0xcc)[_0x19df('0x27')]();});}};}function handleEntityNotFound(_0xd3e021,_0x26199c){return function(_0x355941){if(!_0x355941){_0xd3e021['sendStatus'](0x194);}return _0x355941;};}function handleError(_0x792b66,_0x48e668){_0x48e668=_0x48e668||0x1f4;return function(_0x439ba5){logger[_0x19df('0x28')](_0x439ba5['stack']);if(_0x439ba5[_0x19df('0x29')]){delete _0x439ba5[_0x19df('0x29')];}_0x792b66['status'](_0x48e668)['send'](_0x439ba5);};}exports[_0x19df('0x2a')]=function(_0x42f06a,_0x275bc7){var _0xfbc9c9={},_0x2681f8={},_0x3c38ce={'count':0x0,'rows':[]};var _0x15d728=_[_0x19df('0x2b')](db[_0x19df('0x2c')][_0x19df('0x2d')],function(_0x1896b4){return{'name':_0x1896b4[_0x19df('0x2e')],'type':_0x1896b4[_0x19df('0x2f')][_0x19df('0x30')]};});_0x2681f8[_0x19df('0x31')]=_[_0x19df('0x2b')](_0x15d728,_0x19df('0x29'));_0x2681f8[_0x19df('0x32')]=_['keys'](_0x42f06a[_0x19df('0x32')]);_0x2681f8[_0x19df('0x33')]=_[_0x19df('0x34')](_0x2681f8[_0x19df('0x31')],_0x2681f8[_0x19df('0x32')]);_0xfbc9c9[_0x19df('0x35')]=_['intersection'](_0x2681f8[_0x19df('0x31')],qs[_0x19df('0x36')](_0x42f06a[_0x19df('0x32')]['fields']));_0xfbc9c9[_0x19df('0x35')]=_0xfbc9c9[_0x19df('0x35')][_0x19df('0x37')]?_0xfbc9c9[_0x19df('0x35')]:_0x2681f8[_0x19df('0x31')];if(!_0x42f06a['query']['hasOwnProperty'](_0x19df('0x38'))){_0xfbc9c9[_0x19df('0x1f')]=qs[_0x19df('0x1f')](_0x42f06a[_0x19df('0x32')]['limit']);_0xfbc9c9[_0x19df('0x1c')]=qs['offset'](_0x42f06a[_0x19df('0x32')]['offset']);}_0xfbc9c9['order']=qs[_0x19df('0x39')](_0x42f06a[_0x19df('0x32')][_0x19df('0x39')]);_0xfbc9c9[_0x19df('0x3a')]=qs['filters'](_[_0x19df('0x3b')](_0x42f06a[_0x19df('0x32')],_0x2681f8[_0x19df('0x33')]),_0x15d728);if(_0x42f06a[_0x19df('0x32')]['filter']){_0xfbc9c9[_0x19df('0x3a')]=_['merge'](_0xfbc9c9[_0x19df('0x3a')],{'$or':_[_0x19df('0x2b')](_0x15d728,function(_0x48c559){if(_0x48c559[_0x19df('0x2f')]!==_0x19df('0x3c')){var _0x371142={};_0x371142[_0x48c559[_0x19df('0x29')]]={'$like':'%'+_0x42f06a['query'][_0x19df('0x3d')]+'%'};return _0x371142;}})});}_0xfbc9c9=_[_0x19df('0x3e')]({},_0xfbc9c9,_0x42f06a['options']);var _0x298071={'where':_0xfbc9c9[_0x19df('0x3a')]};return db['CmContactHasItem'][_0x19df('0x1e')](_0x298071)[_0x19df('0x24')](function(_0x56d611){_0x3c38ce[_0x19df('0x1e')]=_0x56d611;if(_0x42f06a[_0x19df('0x32')]['includeAll']){_0xfbc9c9['include']=[{'all':!![]}];}return db[_0x19df('0x2c')][_0x19df('0x3f')](_0xfbc9c9);})[_0x19df('0x24')](function(_0x274724){_0x3c38ce['rows']=_0x274724;return _0x3c38ce;})[_0x19df('0x24')](respondWithFilteredResult(_0x275bc7,_0xfbc9c9))[_0x19df('0x40')](handleError(_0x275bc7,null));};exports[_0x19df('0x41')]=function(_0x31e41c,_0xc2a368){var _0x2e4799={'raw':!![],'where':{'id':_0x31e41c['params']['id']}},_0x1ce085={};_0x1ce085[_0x19df('0x31')]=_['keys'](db[_0x19df('0x2c')][_0x19df('0x2d')]);_0x1ce085[_0x19df('0x32')]=_[_0x19df('0x42')](_0x31e41c[_0x19df('0x32')]);_0x1ce085[_0x19df('0x33')]=_['intersection'](_0x1ce085[_0x19df('0x31')],_0x1ce085['query']);_0x2e4799[_0x19df('0x35')]=_[_0x19df('0x34')](_0x1ce085[_0x19df('0x31')],qs[_0x19df('0x36')](_0x31e41c[_0x19df('0x32')][_0x19df('0x36')]));_0x2e4799[_0x19df('0x35')]=_0x2e4799[_0x19df('0x35')][_0x19df('0x37')]?_0x2e4799[_0x19df('0x35')]:_0x1ce085[_0x19df('0x31')];if(_0x31e41c['query']['includeAll']){_0x2e4799[_0x19df('0x43')]=[{'all':!![]}];}_0x2e4799=_['merge']({},_0x2e4799,_0x31e41c[_0x19df('0x44')]);return db['CmContactHasItem'][_0x19df('0x45')](_0x2e4799)[_0x19df('0x24')](handleEntityNotFound(_0xc2a368,null))[_0x19df('0x24')](respondWithResult(_0xc2a368,null))[_0x19df('0x40')](handleError(_0xc2a368,null));};exports[_0x19df('0x46')]=function(_0x460071,_0x2de23b){return db[_0x19df('0x2c')]['create'](_0x460071['body'],{})[_0x19df('0x24')](function(_0xefe96d){var _0x2eab9c=_0x460071['user'][_0x19df('0x47')]({'plain':!![]});if(!_0x2eab9c)throw new Error(_0x19df('0x48'));if(_0x2eab9c[_0x19df('0x49')]===_0x19df('0x4a')){var _0x3ee808=_0xefe96d[_0x19df('0x47')]({'plain':!![]});var _0xe368a5=_0x19df('0x4b');return db['UserProfileSection'][_0x19df('0x45')]({'where':{'name':_0xe368a5,'userProfileId':_0x2eab9c[_0x19df('0x4c')]},'raw':!![]})[_0x19df('0x24')](function(_0x4470e4){if(_0x4470e4&&_0x4470e4[_0x19df('0x4d')]===0x0){return db[_0x19df('0x26')][_0x19df('0x46')]({'name':_0x3ee808[_0x19df('0x29')],'resourceId':_0x3ee808['id'],'type':_0x4470e4[_0x19df('0x29')],'sectionId':_0x4470e4['id']},{})[_0x19df('0x24')](function(){return _0xefe96d;});}else{return _0xefe96d;}})[_0x19df('0x40')](function(_0x4007d2){logger[_0x19df('0x28')](_0x19df('0x4e'),_0x4007d2);throw _0x4007d2;});}return _0xefe96d;})[_0x19df('0x24')](respondWithResult(_0x2de23b,0xc9))[_0x19df('0x40')](handleError(_0x2de23b,null));};exports[_0x19df('0x4f')]=function(_0x1db1f0,_0xa30f81){if(_0x1db1f0[_0x19df('0x50')]['id']){delete _0x1db1f0[_0x19df('0x50')]['id'];}return db[_0x19df('0x2c')]['find']({'where':{'id':_0x1db1f0[_0x19df('0x51')]['id']}})[_0x19df('0x24')](handleEntityNotFound(_0xa30f81,null))[_0x19df('0x24')](saveUpdates(_0x1db1f0[_0x19df('0x50')],null))[_0x19df('0x24')](respondWithResult(_0xa30f81,null))[_0x19df('0x40')](handleError(_0xa30f81,null));};exports['destroy']=function(_0x48b063,_0x4dad0d){return db[_0x19df('0x2c')][_0x19df('0x45')]({'where':{'id':_0x48b063['params']['id']}})[_0x19df('0x24')](handleEntityNotFound(_0x4dad0d,null))['then'](removeEntity(_0x4dad0d,null))['catch'](handleError(_0x4dad0d,null));}; \ No newline at end of file +var _0x920b=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','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','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x920b,0x173));var _0xb920=function(_0x2bf926,_0x25be23){_0x2bf926=_0x2bf926-0x0;var _0x5db065=_0x920b[_0x2bf926];return _0x5db065;};'use strict';var emlformat=require(_0xb920('0x0'));var rimraf=require(_0xb920('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb920('0x2'));var rp=require(_0xb920('0x3'));var moment=require(_0xb920('0x4'));var BPromise=require(_0xb920('0x5'));var Mustache=require(_0xb920('0x6'));var util=require(_0xb920('0x7'));var path=require(_0xb920('0x8'));var sox=require(_0xb920('0x9'));var csv=require(_0xb920('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb920('0xb'));var crypto=require('crypto');var jsforce=require(_0xb920('0xc'));var deskjs=require(_0xb920('0xd'));var toCsv=require(_0xb920('0xa'));var querystring=require('querystring');var Papa=require(_0xb920('0xe'));var Redis=require(_0xb920('0xf'));var authService=require(_0xb920('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb920('0x11'));var hardwareService=require(_0xb920('0x12'));var logger=require(_0xb920('0x13'))(_0xb920('0x14'));var utils=require(_0xb920('0x15'));var config=require(_0xb920('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb920('0x17'))['db'];function respondWithStatusCode(_0x1373ec,_0x1c7ead){_0x1c7ead=_0x1c7ead||0xcc;return function(_0x116225){if(_0x116225){return _0x1373ec[_0xb920('0x18')](_0x1c7ead);}return _0x1373ec[_0xb920('0x19')](_0x1c7ead)[_0xb920('0x1a')]();};}function respondWithResult(_0x28b93b,_0x42f7e5){_0x42f7e5=_0x42f7e5||0xc8;return function(_0x3e0341){if(_0x3e0341){return _0x28b93b[_0xb920('0x19')](_0x42f7e5)['json'](_0x3e0341);}};}function respondWithFilteredResult(_0x493b81,_0x33a913){return function(_0x51f46f){if(_0x51f46f){var _0x23692a=typeof _0x33a913['offset']===_0xb920('0x1b')&&typeof _0x33a913[_0xb920('0x1c')]==='undefined';var _0x2df926=_0x51f46f[_0xb920('0x1d')];var _0x5d0ba2=_0x23692a?0x0:_0x33a913[_0xb920('0x1e')];var _0x4d46f6=_0x23692a?_0x51f46f[_0xb920('0x1d')]:_0x33a913[_0xb920('0x1e')]+_0x33a913['limit'];var _0x587487;if(_0x4d46f6>=_0x2df926){_0x4d46f6=_0x2df926;_0x587487=0xc8;}else{_0x587487=0xce;}_0x493b81[_0xb920('0x19')](_0x587487);return _0x493b81['set'](_0xb920('0x1f'),_0x5d0ba2+'-'+_0x4d46f6+'/'+_0x2df926)[_0xb920('0x20')](_0x51f46f);}return null;};}function patchUpdates(_0xb6836b){return function(_0x35a7ee){try{jsonpatch[_0xb920('0x21')](_0x35a7ee,_0xb6836b,!![]);}catch(_0x106363){return BPromise[_0xb920('0x22')](_0x106363);}return _0x35a7ee[_0xb920('0x23')]();};}function saveUpdates(_0x231b0b,_0xaad1ca){return function(_0x59ee78){if(_0x59ee78){return _0x59ee78[_0xb920('0x24')](_0x231b0b)[_0xb920('0x25')](function(_0x59f30d){return _0x59f30d;});}return null;};}function removeEntity(_0x36ae3b,_0x37764e){return function(_0x51ae10){if(_0x51ae10){return _0x51ae10[_0xb920('0x26')]()[_0xb920('0x25')](function(){var _0x4b6ca1=_0x51ae10[_0xb920('0x27')]({'plain':!![]});var _0x36087f=_0xb920('0x28');return db[_0xb920('0x29')]['destroy']({'where':{'type':_0x36087f,'resourceId':_0x4b6ca1['id']}})[_0xb920('0x25')](function(){return _0x51ae10;});})[_0xb920('0x25')](function(){_0x36ae3b[_0xb920('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f758a,_0x4d991e){return function(_0x56d1a5){if(!_0x56d1a5){_0x2f758a['sendStatus'](0x194);}return _0x56d1a5;};}function handleError(_0x1e212f,_0x13f4d3){_0x13f4d3=_0x13f4d3||0x1f4;return function(_0x382097){logger[_0xb920('0x2a')](_0x382097[_0xb920('0x2b')]);if(_0x382097[_0xb920('0x2c')]){delete _0x382097[_0xb920('0x2c')];}_0x1e212f[_0xb920('0x19')](_0x13f4d3)[_0xb920('0x2d')](_0x382097);};}exports[_0xb920('0x2e')]=function(_0x31cab2,_0x52652b){var _0x1d2b65={},_0x17b71f={},_0x589666={'count':0x0,'rows':[]};var _0x2fb2ba=_['map'](db[_0xb920('0x2f')][_0xb920('0x30')],function(_0x11d61a){return{'name':_0x11d61a[_0xb920('0x31')],'type':_0x11d61a[_0xb920('0x32')][_0xb920('0x33')]};});_0x17b71f[_0xb920('0x34')]=_[_0xb920('0x35')](_0x2fb2ba,'name');_0x17b71f[_0xb920('0x36')]=_[_0xb920('0x37')](_0x31cab2[_0xb920('0x36')]);_0x17b71f[_0xb920('0x38')]=_[_0xb920('0x39')](_0x17b71f['model'],_0x17b71f[_0xb920('0x36')]);_0x1d2b65[_0xb920('0x3a')]=_[_0xb920('0x39')](_0x17b71f[_0xb920('0x34')],qs[_0xb920('0x3b')](_0x31cab2[_0xb920('0x36')][_0xb920('0x3b')]));_0x1d2b65[_0xb920('0x3a')]=_0x1d2b65['attributes'][_0xb920('0x3c')]?_0x1d2b65['attributes']:_0x17b71f[_0xb920('0x34')];if(!_0x31cab2[_0xb920('0x36')][_0xb920('0x3d')](_0xb920('0x3e'))){_0x1d2b65[_0xb920('0x1c')]=qs['limit'](_0x31cab2['query'][_0xb920('0x1c')]);_0x1d2b65[_0xb920('0x1e')]=qs[_0xb920('0x1e')](_0x31cab2[_0xb920('0x36')]['offset']);}_0x1d2b65['order']=qs[_0xb920('0x3f')](_0x31cab2[_0xb920('0x36')]['sort']);_0x1d2b65[_0xb920('0x40')]=qs['filters'](_[_0xb920('0x41')](_0x31cab2[_0xb920('0x36')],_0x17b71f[_0xb920('0x38')]),_0x2fb2ba);if(_0x31cab2[_0xb920('0x36')][_0xb920('0x42')]){_0x1d2b65['where']=_[_0xb920('0x43')](_0x1d2b65[_0xb920('0x40')],{'$or':_[_0xb920('0x35')](_0x2fb2ba,function(_0x3b5cdb){if(_0x3b5cdb[_0xb920('0x32')]!==_0xb920('0x44')){var _0x523a4e={};_0x523a4e[_0x3b5cdb['name']]={'$like':'%'+_0x31cab2[_0xb920('0x36')]['filter']+'%'};return _0x523a4e;}})});}_0x1d2b65=_[_0xb920('0x43')]({},_0x1d2b65,_0x31cab2[_0xb920('0x45')]);var _0x4e85f2={'where':_0x1d2b65[_0xb920('0x40')]};return db['CmContactHasItem'][_0xb920('0x1d')](_0x4e85f2)[_0xb920('0x25')](function(_0x25e004){_0x589666[_0xb920('0x1d')]=_0x25e004;if(_0x31cab2[_0xb920('0x36')][_0xb920('0x46')]){_0x1d2b65[_0xb920('0x47')]=[{'all':!![]}];}return db[_0xb920('0x2f')][_0xb920('0x48')](_0x1d2b65);})['then'](function(_0x430d34){_0x589666[_0xb920('0x49')]=_0x430d34;return _0x589666;})[_0xb920('0x25')](respondWithFilteredResult(_0x52652b,_0x1d2b65))[_0xb920('0x4a')](handleError(_0x52652b,null));};exports[_0xb920('0x4b')]=function(_0x5902bf,_0x5197ed){var _0x17abfb={'raw':!![],'where':{'id':_0x5902bf['params']['id']}},_0x3859ab={};_0x3859ab['model']=_['keys'](db['CmContactHasItem']['rawAttributes']);_0x3859ab[_0xb920('0x36')]=_[_0xb920('0x37')](_0x5902bf[_0xb920('0x36')]);_0x3859ab[_0xb920('0x38')]=_[_0xb920('0x39')](_0x3859ab[_0xb920('0x34')],_0x3859ab['query']);_0x17abfb[_0xb920('0x3a')]=_[_0xb920('0x39')](_0x3859ab[_0xb920('0x34')],qs[_0xb920('0x3b')](_0x5902bf[_0xb920('0x36')][_0xb920('0x3b')]));_0x17abfb[_0xb920('0x3a')]=_0x17abfb[_0xb920('0x3a')]['length']?_0x17abfb[_0xb920('0x3a')]:_0x3859ab[_0xb920('0x34')];if(_0x5902bf[_0xb920('0x36')][_0xb920('0x46')]){_0x17abfb['include']=[{'all':!![]}];}_0x17abfb=_[_0xb920('0x43')]({},_0x17abfb,_0x5902bf[_0xb920('0x45')]);return db[_0xb920('0x2f')][_0xb920('0x4c')](_0x17abfb)['then'](handleEntityNotFound(_0x5197ed,null))[_0xb920('0x25')](respondWithResult(_0x5197ed,null))[_0xb920('0x4a')](handleError(_0x5197ed,null));};exports[_0xb920('0x4d')]=function(_0x31509c,_0xa0d8a6){return db['CmContactHasItem']['create'](_0x31509c[_0xb920('0x4e')],{})['then'](function(_0x1349e1){var _0x114ede=_0x31509c[_0xb920('0x4f')][_0xb920('0x27')]({'plain':!![]});if(!_0x114ede)throw new Error(_0xb920('0x50'));if(_0x114ede[_0xb920('0x51')]==='user'){var _0x1862fd=_0x1349e1[_0xb920('0x27')]({'plain':!![]});var _0x7878f1='CmContactHasItems';return db[_0xb920('0x52')][_0xb920('0x4c')]({'where':{'name':_0x7878f1,'userProfileId':_0x114ede[_0xb920('0x53')]},'raw':!![]})[_0xb920('0x25')](function(_0x2a33aa){if(_0x2a33aa&&_0x2a33aa[_0xb920('0x54')]===0x0){return db[_0xb920('0x29')][_0xb920('0x4d')]({'name':_0x1862fd[_0xb920('0x2c')],'resourceId':_0x1862fd['id'],'type':_0x2a33aa[_0xb920('0x2c')],'sectionId':_0x2a33aa['id']},{})['then'](function(){return _0x1349e1;});}else{return _0x1349e1;}})['catch'](function(_0x5488bd){logger[_0xb920('0x2a')](_0xb920('0x55'),_0x5488bd);throw _0x5488bd;});}return _0x1349e1;})[_0xb920('0x25')](respondWithResult(_0xa0d8a6,0xc9))['catch'](handleError(_0xa0d8a6,null));};exports[_0xb920('0x24')]=function(_0x10f6de,_0x37207e){if(_0x10f6de['body']['id']){delete _0x10f6de[_0xb920('0x4e')]['id'];}return db['CmContactHasItem'][_0xb920('0x4c')]({'where':{'id':_0x10f6de[_0xb920('0x56')]['id']}})[_0xb920('0x25')](handleEntityNotFound(_0x37207e,null))[_0xb920('0x25')](saveUpdates(_0x10f6de[_0xb920('0x4e')],null))[_0xb920('0x25')](respondWithResult(_0x37207e,null))['catch'](handleError(_0x37207e,null));};exports[_0xb920('0x26')]=function(_0x1b1957,_0x3cd5d3){return db[_0xb920('0x2f')]['find']({'where':{'id':_0x1b1957['params']['id']}})[_0xb920('0x25')](handleEntityNotFound(_0x3cd5d3,null))['then'](removeEntity(_0x3cd5d3,null))[_0xb920('0x4a')](handleError(_0x3cd5d3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index c81b862..d79adea 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 _0xecf2=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','api','request-promise','path'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xecf2,0x100));var _0x2ecf=function(_0x5d9dea,_0x484fbd){_0x5d9dea=_0x5d9dea-0x0;var _0x3d0a84=_0xecf2[_0x5d9dea];return _0x3d0a84;};'use strict';var _=require(_0x2ecf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ecf('0x2'));var fs=require('fs');var path=require(_0x2ecf('0x3'));var rimraf=require(_0x2ecf('0x4'));var config=require(_0x2ecf('0x5'));var attributes=require(_0x2ecf('0x6'));module['exports']=function(_0x4332fb,_0x5a6aa5){return _0x4332fb[_0x2ecf('0x7')](_0x2ecf('0x8'),attributes,{'tableName':_0x2ecf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb6b=['rimraf','exports','define','cm_contact_has_items','util','bluebird','request-promise'];(function(_0x1fbc06,_0x4cfe7a){var _0x143c60=function(_0x26ad66){while(--_0x26ad66){_0x1fbc06['push'](_0x1fbc06['shift']());}};_0x143c60(++_0x4cfe7a);}(_0xbb6b,0x17e));var _0xbbb6=function(_0x2eec10,_0x58eb0c){_0x2eec10=_0x2eec10-0x0;var _0x1633b4=_0xbb6b[_0x2eec10];return _0x1633b4;};'use strict';var _=require('lodash');var util=require(_0xbbb6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbbb6('0x1'));var rp=require(_0xbbb6('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbb6('0x3'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xbbb6('0x4')]=function(_0x10c79b,_0x38ddc0){return _0x10c79b[_0xbbb6('0x5')]('CmContactHasItem',attributes,{'tableName':_0xbbb6('0x6'),'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 12293a4..f838dc3 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 _0xbb04=['ioredis','../../mysqldb','../../config/logger','rpc','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x39747e,_0x26a69c){var _0x51d0cf=function(_0x1cf954){while(--_0x1cf954){_0x39747e['push'](_0x39747e['shift']());}};_0x51d0cf(++_0x26a69c);}(_0xbb04,0x89));var _0x4bb0=function(_0x3c6456,_0x3be8db){_0x3c6456=_0x3c6456-0x0;var _0x258853=_0xbb04[_0x3c6456];return _0x258853;};'use strict';var _=require(_0x4bb0('0x0'));var util=require('util');var moment=require(_0x4bb0('0x1'));var BPromise=require(_0x4bb0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bb0('0x3'));var db=require(_0x4bb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bb0('0x5'))(_0x4bb0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bb0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190300,_0x19de21,_0x169056){return new BPromise(function(_0x1da0f5,_0x5f377a){return client[_0x4bb0('0x8')](_0x190300,_0x169056)['then'](function(_0x5aec0b){logger[_0x4bb0('0x9')](_0x4bb0('0xa'),_0x19de21,_0x4bb0('0xb'));logger[_0x4bb0('0xc')](_0x4bb0('0xd'),_0x19de21,'request\x20sent',JSON[_0x4bb0('0xe')](_0x5aec0b));if(_0x5aec0b[_0x4bb0('0xf')]){if(_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x10')]===0x1f4){logger[_0x4bb0('0xf')](_0x4bb0('0xa'),_0x19de21,_0x5aec0b['error']['message']);return _0x5f377a(_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x11')]);}logger[_0x4bb0('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x19de21,_0x5aec0b[_0x4bb0('0xf')][_0x4bb0('0x11')]);return _0x1da0f5(_0x5aec0b['error'][_0x4bb0('0x11')]);}else{logger[_0x4bb0('0x9')](_0x4bb0('0xa'),_0x19de21,_0x4bb0('0xb'));_0x1da0f5(_0x5aec0b[_0x4bb0('0x12')][_0x4bb0('0x11')]);}})[_0x4bb0('0x13')](function(_0x326dc2){logger[_0x4bb0('0xf')](_0x4bb0('0xa'),_0x19de21,_0x326dc2);_0x5f377a(_0x326dc2);});});} \ No newline at end of file +var _0x8d5c=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x494370,_0x2f41fc){var _0x59f028=function(_0xebcb72){while(--_0xebcb72){_0x494370['push'](_0x494370['shift']());}};_0x59f028(++_0x2f41fc);}(_0x8d5c,0x73));var _0xc8d5=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0x8d5c[_0x4df17c];return _0x4e79b5;};'use strict';var _=require(_0xc8d5('0x0'));var util=require(_0xc8d5('0x1'));var moment=require('moment');var BPromise=require(_0xc8d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8d5('0x3'));var db=require(_0xc8d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8d5('0x5'))(_0xc8d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xc8d5('0x7'));var client=jayson[_0xc8d5('0x8')][_0xc8d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48dbdf,_0x5b6274,_0x3ec5ec){return new BPromise(function(_0x573506,_0x4753dc){return client[_0xc8d5('0xa')](_0x48dbdf,_0x3ec5ec)[_0xc8d5('0xb')](function(_0x3e6b68){logger[_0xc8d5('0xc')](_0xc8d5('0xd'),_0x5b6274,_0xc8d5('0xe'));logger[_0xc8d5('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5b6274,_0xc8d5('0xe'),JSON[_0xc8d5('0x10')](_0x3e6b68));if(_0x3e6b68[_0xc8d5('0x11')]){if(_0x3e6b68[_0xc8d5('0x11')][_0xc8d5('0x12')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5b6274,_0x3e6b68[_0xc8d5('0x11')]['message']);return _0x4753dc(_0x3e6b68[_0xc8d5('0x11')][_0xc8d5('0x13')]);}logger[_0xc8d5('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x5b6274,_0x3e6b68[_0xc8d5('0x11')][_0xc8d5('0x13')]);return _0x573506(_0x3e6b68['error'][_0xc8d5('0x13')]);}else{logger[_0xc8d5('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x5b6274,_0xc8d5('0xe'));_0x573506(_0x3e6b68[_0xc8d5('0x14')][_0xc8d5('0x13')]);}})[_0xc8d5('0x15')](function(_0x463f08){logger[_0xc8d5('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x5b6274,_0x463f08);_0x4753dc(_0x463f08);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2e5f8d7..1b936c4 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 _0x3e07=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','create'];(function(_0x4f17f6,_0x350c26){var _0x387c32=function(_0x2621fa){while(--_0x2621fa){_0x4f17f6['push'](_0x4f17f6['shift']());}};_0x387c32(++_0x350c26);}(_0x3e07,0x17a));var _0x73e0=function(_0x2026a2,_0x3ae5b2){_0x2026a2=_0x2026a2-0x0;var _0x526b04=_0x3e07[_0x2026a2];return _0x526b04;};'use strict';var multer=require(_0x73e0('0x0'));var util=require('util');var path=require(_0x73e0('0x1'));var timeout=require(_0x73e0('0x2'));var express=require(_0x73e0('0x3'));var router=express[_0x73e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73e0('0x5'));var interaction=require(_0x73e0('0x6'));var config=require(_0x73e0('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x73e0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x73e0('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x73e0('0xa')]('/',auth[_0x73e0('0xb')](),controller[_0x73e0('0xc')]);router['put'](_0x73e0('0x9'),auth['isAuthenticated'](),controller[_0x73e0('0xd')]);router[_0x73e0('0xe')]('/:id',auth[_0x73e0('0xb')](),controller[_0x73e0('0xf')]);module[_0x73e0('0x10')]=router; \ No newline at end of file +var _0x234b=['path','connect-timeout','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','show','post','update','delete','destroy','multer','util'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x234b,0x8a));var _0xb234=function(_0x26d5cf,_0x2dee49){_0x26d5cf=_0x26d5cf-0x0;var _0x405e9d=_0x234b[_0x26d5cf];return _0x405e9d;};'use strict';var multer=require(_0xb234('0x0'));var util=require(_0xb234('0x1'));var path=require(_0xb234('0x2'));var timeout=require(_0xb234('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb234('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb234('0x5'));var controller=require(_0xb234('0x6'));router[_0xb234('0x7')]('/',auth[_0xb234('0x8')](),controller['index']);router['get']('/:id',auth[_0xb234('0x8')](),controller[_0xb234('0x9')]);router[_0xb234('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xb234('0x8')](),controller[_0xb234('0xb')]);router[_0xb234('0xc')]('/:id',auth[_0xb234('0x8')](),controller[_0xb234('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 476e36b..93e64bf 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 _0x1f15=['STRING','setDataValue','name','TEXT','type','select','getDataValue','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1f15,0x14f));var _0x51f1=function(_0x55b478,_0x2f4080){_0x55b478=_0x55b478-0x0;var _0x52d9c9=_0x1f15[_0x55b478];return _0x52d9c9;};'use strict';var Sequelize=require(_0x51f1('0x0'));var _=require(_0x51f1('0x1'));module[_0x51f1('0x2')]={'name':{'type':Sequelize[_0x51f1('0x3')],'get':function(_0x383054){return this['getDataValue'](_0x51f1('0x4'));}},'alias':{'type':Sequelize[_0x51f1('0x5')],'allowNull':![],'set':function(_0x59ca98){this[_0x51f1('0x6')](_0x51f1('0x4'),_0x59ca98?_0x59ca98:this['getDataValue'](_0x51f1('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x51f1('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x51f1('0x9'))===_0x51f1('0xa')){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0x51f1('0xb')](_0x51f1('0xc'));}},'set':function(_0x385335){if(Array[_0x51f1('0xd')](_0x385335)){this[_0x51f1('0x6')](_0x51f1('0xc'),JSON['stringify'](_0x385335));}else{this[_0x51f1('0x6')](_0x51f1('0xc'),_0x385335);}}},'required':{'type':Sequelize[_0x51f1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x51f1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x51f1('0xf')](_0x51f1('0x10'))}}; \ No newline at end of file +var _0x8d24=['exports','getDataValue','alias','STRING','name','TEXT','long','select','parse','values','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash'];(function(_0x37fadd,_0x251eb3){var _0x5f1499=function(_0x3496f0){while(--_0x3496f0){_0x37fadd['push'](_0x37fadd['shift']());}};_0x5f1499(++_0x251eb3);}(_0x8d24,0x11e));var _0x48d2=function(_0x96a34a,_0x48b3c6){_0x96a34a=_0x96a34a-0x0;var _0x4e325e=_0x8d24[_0x96a34a];return _0x4e325e;};'use strict';var Sequelize=require(_0x48d2('0x0'));var _=require(_0x48d2('0x1'));module[_0x48d2('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3ede57){return this[_0x48d2('0x3')](_0x48d2('0x4'));}},'alias':{'type':Sequelize[_0x48d2('0x5')],'allowNull':![],'set':function(_0x1dc087){this['setDataValue']('alias',_0x1dc087?_0x1dc087:this[_0x48d2('0x3')](_0x48d2('0x6')));}},'type':{'type':Sequelize[_0x48d2('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x48d2('0x7')](_0x48d2('0x8')),'get':function(){if(this[_0x48d2('0x3')]('type')===_0x48d2('0x9')){return JSON[_0x48d2('0xa')](this['getDataValue'](_0x48d2('0xb')));}else{return this[_0x48d2('0x3')](_0x48d2('0xb'));}},'set':function(_0x3b4b15){if(Array['isArray'](_0x3b4b15)){this[_0x48d2('0xc')](_0x48d2('0xb'),JSON[_0x48d2('0xd')](_0x3b4b15));}else{this[_0x48d2('0xc')]('values',_0x3b4b15);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x48d2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x48d2('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8e554f1..125354d 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 _0x0aed=['defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','util','path','sox','to-csv','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','end','status','offset','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','index','CmCustomField','fieldName','type','differenceBy','map','query','keys','model','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','body','find','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN'];(function(_0x30ac20,_0x553833){var _0x6149f6=function(_0x4e271e){while(--_0x4e271e){_0x30ac20['push'](_0x30ac20['shift']());}};_0x6149f6(++_0x553833);}(_0x0aed,0x19f));var _0xd0ae=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0x0aed[_0x2052cc];return _0x58609f;};'use strict';var emlformat=require(_0xd0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0ae('0x3'));var path=require(_0xd0ae('0x4'));var sox=require(_0xd0ae('0x5'));var csv=require(_0xd0ae('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0ae('0x7'));var squel=require(_0xd0ae('0x8'));var crypto=require('crypto');var jsforce=require(_0xd0ae('0x9'));var deskjs=require(_0xd0ae('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd0ae('0xb'));var Papa=require(_0xd0ae('0xc'));var Redis=require(_0xd0ae('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0ae('0xe'));var as=require(_0xd0ae('0xf'));var hardwareService=require(_0xd0ae('0x10'));var logger=require(_0xd0ae('0x11'))(_0xd0ae('0x12'));var utils=require(_0xd0ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd0ae('0x14'));var db=require(_0xd0ae('0x15'))['db'];function respondWithStatusCode(_0x58dcc5,_0x1e3dda){_0x1e3dda=_0x1e3dda||0xcc;return function(_0x5434e3){if(_0x5434e3){return _0x58dcc5[_0xd0ae('0x16')](_0x1e3dda);}return _0x58dcc5['status'](_0x1e3dda)[_0xd0ae('0x17')]();};}function respondWithResult(_0x379983,_0x2629d3){_0x2629d3=_0x2629d3||0xc8;return function(_0x45d7fd){if(_0x45d7fd){return _0x379983[_0xd0ae('0x18')](_0x2629d3)['json'](_0x45d7fd);}};}function respondWithFilteredResult(_0x525096,_0x5eb845){return function(_0x529a0e){if(_0x529a0e){var _0x4918df=typeof _0x5eb845[_0xd0ae('0x19')]==='undefined'&&typeof _0x5eb845['limit']==='undefined';var _0x4f9e73=_0x529a0e[_0xd0ae('0x1a')];var _0x307114=_0x4918df?0x0:_0x5eb845[_0xd0ae('0x19')];var _0x1bd0c4=_0x4918df?_0x529a0e[_0xd0ae('0x1a')]:_0x5eb845['offset']+_0x5eb845[_0xd0ae('0x1b')];var _0x56aa24;if(_0x1bd0c4>=_0x4f9e73){_0x1bd0c4=_0x4f9e73;_0x56aa24=0xc8;}else{_0x56aa24=0xce;}_0x525096[_0xd0ae('0x18')](_0x56aa24);return _0x525096['set'](_0xd0ae('0x1c'),_0x307114+'-'+_0x1bd0c4+'/'+_0x4f9e73)[_0xd0ae('0x1d')](_0x529a0e);}return null;};}function patchUpdates(_0x873fb6){return function(_0x2c568e){try{jsonpatch[_0xd0ae('0x1e')](_0x2c568e,_0x873fb6,!![]);}catch(_0x26a659){return BPromise[_0xd0ae('0x1f')](_0x26a659);}return _0x2c568e[_0xd0ae('0x20')]();};}function saveUpdates(_0x1a06dc,_0x2c4bce){return function(_0x19cd5a){if(_0x19cd5a){return _0x19cd5a[_0xd0ae('0x21')](_0x1a06dc)['then'](function(_0x41e96a){return _0x41e96a;});}return null;};}function removeEntity(_0x4ed310,_0x143b99){return function(_0x2ceedf){if(_0x2ceedf){return _0x2ceedf[_0xd0ae('0x22')]()[_0xd0ae('0x23')](function(){_0x4ed310[_0xd0ae('0x18')](0xcc)[_0xd0ae('0x17')]();});}};}function handleEntityNotFound(_0x550c6a,_0x225f06){return function(_0x167ce6){if(!_0x167ce6){_0x550c6a[_0xd0ae('0x16')](0x194);}return _0x167ce6;};}function handleError(_0x309fd5,_0x24acaa){_0x24acaa=_0x24acaa||0x1f4;return function(_0x4d1efe){logger['error'](_0x4d1efe[_0xd0ae('0x24')]);if(_0x4d1efe[_0xd0ae('0x25')]){delete _0x4d1efe[_0xd0ae('0x25')];}_0x309fd5[_0xd0ae('0x18')](_0x24acaa)['send'](_0x4d1efe);};}exports[_0xd0ae('0x26')]=function(_0x5db4d0,_0x257b8c){var _0xa9c7c8={},_0x180f71={},_0x17b404={'count':0x0,'rows':[]};var _0x498709=_['map'](db[_0xd0ae('0x27')]['rawAttributes'],function(_0x15234d){return{'name':_0x15234d[_0xd0ae('0x28')],'type':_0x15234d[_0xd0ae('0x29')]['key']};});_0x180f71['model']=_[_0xd0ae('0x2a')](_[_0xd0ae('0x2b')](_0x498709,_0xd0ae('0x25')),[_0xd0ae('0x25')]);_0x180f71[_0xd0ae('0x2c')]=_[_0xd0ae('0x2d')](_0x5db4d0[_0xd0ae('0x2c')]);_0x180f71['filters']=_['intersection'](_0x180f71[_0xd0ae('0x2e')],_0x180f71[_0xd0ae('0x2c')]);_0xa9c7c8[_0xd0ae('0x2f')]=_['intersection'](_0x180f71[_0xd0ae('0x2e')],qs[_0xd0ae('0x30')](_0x5db4d0['query'][_0xd0ae('0x30')]));_0xa9c7c8[_0xd0ae('0x2f')]=_0xa9c7c8[_0xd0ae('0x2f')]['length']?_0xa9c7c8['attributes']:_0x180f71[_0xd0ae('0x2e')];if(!_0x5db4d0['query']['hasOwnProperty'](_0xd0ae('0x31'))){_0xa9c7c8[_0xd0ae('0x1b')]=qs[_0xd0ae('0x1b')](_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x1b')]);_0xa9c7c8[_0xd0ae('0x19')]=qs['offset'](_0x5db4d0['query'][_0xd0ae('0x19')]);}_0xa9c7c8['order']=qs[_0xd0ae('0x32')](_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x32')]);_0xa9c7c8[_0xd0ae('0x33')]=qs[_0xd0ae('0x34')](_[_0xd0ae('0x35')](_0x5db4d0[_0xd0ae('0x2c')],_0x180f71[_0xd0ae('0x34')]),_0x498709);if(_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x36')]){_0xa9c7c8[_0xd0ae('0x33')]=_['merge'](_0xa9c7c8[_0xd0ae('0x33')],{'$or':_[_0xd0ae('0x2b')](_0x498709,function(_0xe826c6){if(_0xe826c6[_0xd0ae('0x29')]!==_0xd0ae('0x37')){var _0xb733af={};_0xb733af[_0xe826c6[_0xd0ae('0x25')]]={'$like':'%'+_0x5db4d0[_0xd0ae('0x2c')][_0xd0ae('0x36')]+'%'};return _0xb733af;}})});}_0xa9c7c8=_['merge']({},_0xa9c7c8,_0x5db4d0[_0xd0ae('0x38')]);var _0x400c36={'where':_0xa9c7c8[_0xd0ae('0x33')]};return db[_0xd0ae('0x27')][_0xd0ae('0x1a')](_0x400c36)['then'](function(_0x43b477){_0x17b404[_0xd0ae('0x1a')]=_0x43b477;if(_0x5db4d0['query'][_0xd0ae('0x39')]){_0xa9c7c8[_0xd0ae('0x3a')]=[{'all':!![]}];}return db['CmCustomField'][_0xd0ae('0x3b')](_0xa9c7c8);})[_0xd0ae('0x23')](function(_0x3441fd){_0x17b404[_0xd0ae('0x3c')]=_0x3441fd;return _0x17b404;})[_0xd0ae('0x23')](respondWithFilteredResult(_0x257b8c,_0xa9c7c8))[_0xd0ae('0x3d')](handleError(_0x257b8c,null));};exports[_0xd0ae('0x3e')]=function(_0x4dd4c5,_0x401201){var _0x3aabce={'raw':!![],'where':{'id':_0x4dd4c5[_0xd0ae('0x3f')]['id']}},_0x14cfaf={};_0x14cfaf[_0xd0ae('0x2e')]=_[_0xd0ae('0x2d')](db[_0xd0ae('0x27')]['rawAttributes']);_0x14cfaf[_0xd0ae('0x2c')]=_[_0xd0ae('0x2d')](_0x4dd4c5[_0xd0ae('0x2c')]);_0x14cfaf['filters']=_[_0xd0ae('0x40')](_0x14cfaf[_0xd0ae('0x2e')],_0x14cfaf['query']);_0x3aabce['attributes']=_['intersection'](_0x14cfaf[_0xd0ae('0x2e')],qs[_0xd0ae('0x30')](_0x4dd4c5[_0xd0ae('0x2c')][_0xd0ae('0x30')]));_0x3aabce['attributes']=_0x3aabce[_0xd0ae('0x2f')][_0xd0ae('0x41')]?_0x3aabce[_0xd0ae('0x2f')]:_0x14cfaf[_0xd0ae('0x2e')];if(_0x4dd4c5[_0xd0ae('0x2c')][_0xd0ae('0x39')]){_0x3aabce['include']=[{'all':!![]}];}_0x3aabce=_['merge']({},_0x3aabce,_0x4dd4c5[_0xd0ae('0x38')]);return db[_0xd0ae('0x27')]['find'](_0x3aabce)[_0xd0ae('0x23')](handleEntityNotFound(_0x401201,null))[_0xd0ae('0x23')](respondWithResult(_0x401201,null))[_0xd0ae('0x3d')](handleError(_0x401201,null));};exports['update']=function(_0x2d193e,_0x102af9){if(_0x2d193e[_0xd0ae('0x42')]['id']){delete _0x2d193e['body']['id'];}return db[_0xd0ae('0x27')][_0xd0ae('0x43')]({'where':{'id':_0x2d193e[_0xd0ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x102af9,null))['then'](saveUpdates(_0x2d193e[_0xd0ae('0x42')],null))[_0xd0ae('0x23')](respondWithResult(_0x102af9,null))[_0xd0ae('0x3d')](handleError(_0x102af9,null));};exports['destroy']=function(_0x593a78,_0x31908a){return db['CmCustomField'][_0xd0ae('0x43')]({'where':{'id':_0x593a78[_0xd0ae('0x3f')]['id']}})[_0xd0ae('0x23')](handleEntityNotFound(_0x31908a,null))[_0xd0ae('0x23')](removeEntity(_0x31908a,null))[_0xd0ae('0x3d')](handleError(_0x31908a,null));};exports['create']=function(_0x5709ee,_0x3db477){var _0x134820;return db[_0xd0ae('0x44')][_0xd0ae('0x45')](function(_0x5666c8){return db[_0xd0ae('0x27')][_0xd0ae('0x46')](_0x5709ee[_0xd0ae('0x42')],{'transaction':_0x5666c8})[_0xd0ae('0x23')](function(_0x1200b8){_0x134820=_0x1200b8;var _0x2065a8={'type':db[_0xd0ae('0x47')][_0xd0ae('0x48')],'transaction':_0x5666c8};switch(_0x5709ee['body'][_0xd0ae('0x29')]){case _0xd0ae('0x49'):_0x2065a8[_0xd0ae('0x29')]=db['Sequelize'][_0xd0ae('0x48')];break;case _0xd0ae('0x4a'):_0x2065a8[_0xd0ae('0x29')]=db[_0xd0ae('0x47')][_0xd0ae('0x4b')];break;case'switch':_0x2065a8[_0xd0ae('0x29')]=db[_0xd0ae('0x47')][_0xd0ae('0x4c')];_0x2065a8[_0xd0ae('0x4d')]=![];break;default:}return db['sequelize'][_0xd0ae('0x4e')]['addColumn'](_0xd0ae('0x4f'),util[_0xd0ae('0x50')](_0xd0ae('0x51'),_0x134820['id']),_0x2065a8);})[_0xd0ae('0x23')](function(){return _0x134820;});})[_0xd0ae('0x23')](respondWithResult(_0x3db477,0xc9))['catch'](handleError(_0x3db477,null));}; \ No newline at end of file +var _0xafec=['keys','filters','intersection','fields','attributes','length','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','catch','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','CmCustomField','fieldName','type','model','differenceBy','query'];(function(_0x2c48ea,_0x13436){var _0x147b7f=function(_0x40175d){while(--_0x40175d){_0x2c48ea['push'](_0x2c48ea['shift']());}};_0x147b7f(++_0x13436);}(_0xafec,0x1bb));var _0xcafe=function(_0x4b10e1,_0x5880a2){_0x4b10e1=_0x4b10e1-0x0;var _0x2da145=_0xafec[_0x4b10e1];return _0x2da145;};'use strict';var emlformat=require(_0xcafe('0x0'));var rimraf=require(_0xcafe('0x1'));var zipdir=require(_0xcafe('0x2'));var jsonpatch=require(_0xcafe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcafe('0x4'));var Mustache=require(_0xcafe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcafe('0x6'));var fs=require('fs');var fs_extra=require(_0xcafe('0x7'));var _=require('lodash');var squel=require(_0xcafe('0x8'));var crypto=require(_0xcafe('0x9'));var jsforce=require(_0xcafe('0xa'));var deskjs=require(_0xcafe('0xb'));var toCsv=require(_0xcafe('0xc'));var querystring=require(_0xcafe('0xd'));var Papa=require(_0xcafe('0xe'));var Redis=require('ioredis');var authService=require(_0xcafe('0xf'));var qs=require(_0xcafe('0x10'));var as=require(_0xcafe('0x11'));var hardwareService=require(_0xcafe('0x12'));var logger=require(_0xcafe('0x13'))(_0xcafe('0x14'));var utils=require(_0xcafe('0x15'));var config=require(_0xcafe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcafe('0x17'))['db'];function respondWithStatusCode(_0x339302,_0x28d640){_0x28d640=_0x28d640||0xcc;return function(_0xcc98ea){if(_0xcc98ea){return _0x339302['sendStatus'](_0x28d640);}return _0x339302['status'](_0x28d640)[_0xcafe('0x18')]();};}function respondWithResult(_0x3244d2,_0x3e445d){_0x3e445d=_0x3e445d||0xc8;return function(_0x3f28d1){if(_0x3f28d1){return _0x3244d2['status'](_0x3e445d)[_0xcafe('0x19')](_0x3f28d1);}};}function respondWithFilteredResult(_0x3e1153,_0x241973){return function(_0x275ce4){if(_0x275ce4){var _0x2cf820=typeof _0x241973[_0xcafe('0x1a')]==='undefined'&&typeof _0x241973['limit']===_0xcafe('0x1b');var _0x3c5274=_0x275ce4[_0xcafe('0x1c')];var _0xf85cf9=_0x2cf820?0x0:_0x241973[_0xcafe('0x1a')];var _0x330fa2=_0x2cf820?_0x275ce4[_0xcafe('0x1c')]:_0x241973[_0xcafe('0x1a')]+_0x241973[_0xcafe('0x1d')];var _0x4bf94f;if(_0x330fa2>=_0x3c5274){_0x330fa2=_0x3c5274;_0x4bf94f=0xc8;}else{_0x4bf94f=0xce;}_0x3e1153[_0xcafe('0x1e')](_0x4bf94f);return _0x3e1153[_0xcafe('0x1f')](_0xcafe('0x20'),_0xf85cf9+'-'+_0x330fa2+'/'+_0x3c5274)[_0xcafe('0x19')](_0x275ce4);}return null;};}function patchUpdates(_0x313754){return function(_0x575935){try{jsonpatch[_0xcafe('0x21')](_0x575935,_0x313754,!![]);}catch(_0x2b3109){return BPromise[_0xcafe('0x22')](_0x2b3109);}return _0x575935[_0xcafe('0x23')]();};}function saveUpdates(_0x285712,_0x4eb3ba){return function(_0x36f02f){if(_0x36f02f){return _0x36f02f[_0xcafe('0x24')](_0x285712)[_0xcafe('0x25')](function(_0x306112){return _0x306112;});}return null;};}function removeEntity(_0x3fa312,_0x316139){return function(_0x2219fb){if(_0x2219fb){return _0x2219fb[_0xcafe('0x26')]()[_0xcafe('0x25')](function(){_0x3fa312[_0xcafe('0x1e')](0xcc)[_0xcafe('0x18')]();});}};}function handleEntityNotFound(_0x55ef24,_0x1dc1a0){return function(_0x3df7be){if(!_0x3df7be){_0x55ef24['sendStatus'](0x194);}return _0x3df7be;};}function handleError(_0x2ce9e5,_0x31a91b){_0x31a91b=_0x31a91b||0x1f4;return function(_0x296174){logger['error'](_0x296174['stack']);if(_0x296174[_0xcafe('0x27')]){delete _0x296174[_0xcafe('0x27')];}_0x2ce9e5[_0xcafe('0x1e')](_0x31a91b)[_0xcafe('0x28')](_0x296174);};}exports[_0xcafe('0x29')]=function(_0x4751d0,_0x5874bf){var _0x18409a={},_0x471cf7={},_0x253964={'count':0x0,'rows':[]};var _0x4e4d21=_[_0xcafe('0x2a')](db[_0xcafe('0x2b')]['rawAttributes'],function(_0x327f62){return{'name':_0x327f62[_0xcafe('0x2c')],'type':_0x327f62[_0xcafe('0x2d')]['key']};});_0x471cf7[_0xcafe('0x2e')]=_[_0xcafe('0x2f')](_[_0xcafe('0x2a')](_0x4e4d21,'name'),[_0xcafe('0x27')]);_0x471cf7[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x4751d0[_0xcafe('0x30')]);_0x471cf7[_0xcafe('0x32')]=_[_0xcafe('0x33')](_0x471cf7[_0xcafe('0x2e')],_0x471cf7[_0xcafe('0x30')]);_0x18409a['attributes']=_[_0xcafe('0x33')](_0x471cf7[_0xcafe('0x2e')],qs[_0xcafe('0x34')](_0x4751d0['query'][_0xcafe('0x34')]));_0x18409a[_0xcafe('0x35')]=_0x18409a[_0xcafe('0x35')][_0xcafe('0x36')]?_0x18409a['attributes']:_0x471cf7['model'];if(!_0x4751d0[_0xcafe('0x30')]['hasOwnProperty']('nolimit')){_0x18409a['limit']=qs[_0xcafe('0x1d')](_0x4751d0[_0xcafe('0x30')]['limit']);_0x18409a[_0xcafe('0x1a')]=qs['offset'](_0x4751d0[_0xcafe('0x30')][_0xcafe('0x1a')]);}_0x18409a['order']=qs['sort'](_0x4751d0['query']['sort']);_0x18409a[_0xcafe('0x37')]=qs['filters'](_[_0xcafe('0x38')](_0x4751d0[_0xcafe('0x30')],_0x471cf7[_0xcafe('0x32')]),_0x4e4d21);if(_0x4751d0[_0xcafe('0x30')][_0xcafe('0x39')]){_0x18409a[_0xcafe('0x37')]=_['merge'](_0x18409a[_0xcafe('0x37')],{'$or':_['map'](_0x4e4d21,function(_0x114a13){if(_0x114a13[_0xcafe('0x2d')]!==_0xcafe('0x3a')){var _0x2a7f59={};_0x2a7f59[_0x114a13[_0xcafe('0x27')]]={'$like':'%'+_0x4751d0[_0xcafe('0x30')]['filter']+'%'};return _0x2a7f59;}})});}_0x18409a=_[_0xcafe('0x3b')]({},_0x18409a,_0x4751d0[_0xcafe('0x3c')]);var _0x1c217f={'where':_0x18409a[_0xcafe('0x37')]};return db[_0xcafe('0x2b')][_0xcafe('0x1c')](_0x1c217f)[_0xcafe('0x25')](function(_0x2919fa){_0x253964[_0xcafe('0x1c')]=_0x2919fa;if(_0x4751d0[_0xcafe('0x30')][_0xcafe('0x3d')]){_0x18409a[_0xcafe('0x3e')]=[{'all':!![]}];}return db[_0xcafe('0x2b')]['findAll'](_0x18409a);})[_0xcafe('0x25')](function(_0x4f6c2b){_0x253964[_0xcafe('0x3f')]=_0x4f6c2b;return _0x253964;})[_0xcafe('0x25')](respondWithFilteredResult(_0x5874bf,_0x18409a))['catch'](handleError(_0x5874bf,null));};exports[_0xcafe('0x40')]=function(_0xbcdad6,_0x2c8c1f){var _0x1722b5={'raw':!![],'where':{'id':_0xbcdad6[_0xcafe('0x41')]['id']}},_0x39e754={};_0x39e754[_0xcafe('0x2e')]=_[_0xcafe('0x31')](db['CmCustomField'][_0xcafe('0x42')]);_0x39e754[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0xbcdad6[_0xcafe('0x30')]);_0x39e754['filters']=_['intersection'](_0x39e754['model'],_0x39e754[_0xcafe('0x30')]);_0x1722b5['attributes']=_[_0xcafe('0x33')](_0x39e754['model'],qs[_0xcafe('0x34')](_0xbcdad6[_0xcafe('0x30')][_0xcafe('0x34')]));_0x1722b5[_0xcafe('0x35')]=_0x1722b5[_0xcafe('0x35')][_0xcafe('0x36')]?_0x1722b5[_0xcafe('0x35')]:_0x39e754[_0xcafe('0x2e')];if(_0xbcdad6[_0xcafe('0x30')][_0xcafe('0x3d')]){_0x1722b5['include']=[{'all':!![]}];}_0x1722b5=_[_0xcafe('0x3b')]({},_0x1722b5,_0xbcdad6[_0xcafe('0x3c')]);return db['CmCustomField']['find'](_0x1722b5)['then'](handleEntityNotFound(_0x2c8c1f,null))['then'](respondWithResult(_0x2c8c1f,null))[_0xcafe('0x43')](handleError(_0x2c8c1f,null));};exports['update']=function(_0x11b1b3,_0x4cf993){if(_0x11b1b3[_0xcafe('0x44')]['id']){delete _0x11b1b3[_0xcafe('0x44')]['id'];}return db['CmCustomField'][_0xcafe('0x45')]({'where':{'id':_0x11b1b3['params']['id']}})['then'](handleEntityNotFound(_0x4cf993,null))[_0xcafe('0x25')](saveUpdates(_0x11b1b3[_0xcafe('0x44')],null))[_0xcafe('0x25')](respondWithResult(_0x4cf993,null))[_0xcafe('0x43')](handleError(_0x4cf993,null));};exports[_0xcafe('0x26')]=function(_0x3db426,_0x5c21ca){return db[_0xcafe('0x2b')]['find']({'where':{'id':_0x3db426[_0xcafe('0x41')]['id']}})[_0xcafe('0x25')](handleEntityNotFound(_0x5c21ca,null))[_0xcafe('0x25')](removeEntity(_0x5c21ca,null))[_0xcafe('0x43')](handleError(_0x5c21ca,null));};exports[_0xcafe('0x46')]=function(_0x57e81b,_0x2f0c3c){var _0x57a155;return db[_0xcafe('0x47')]['transaction'](function(_0x14bbce){return db[_0xcafe('0x2b')][_0xcafe('0x46')](_0x57e81b[_0xcafe('0x44')],{'transaction':_0x14bbce})[_0xcafe('0x25')](function(_0x5feeda){_0x57a155=_0x5feeda;var _0x1b924d={'type':db[_0xcafe('0x48')][_0xcafe('0x49')],'transaction':_0x14bbce};switch(_0x57e81b['body'][_0xcafe('0x2d')]){case _0xcafe('0x4a'):_0x1b924d[_0xcafe('0x2d')]=db[_0xcafe('0x48')][_0xcafe('0x49')];break;case _0xcafe('0x4b'):_0x1b924d[_0xcafe('0x2d')]=db[_0xcafe('0x48')][_0xcafe('0x4c')];break;case _0xcafe('0x4d'):_0x1b924d['type']=db[_0xcafe('0x48')]['BOOLEAN'];_0x1b924d['defaultValue']=![];break;default:}return db[_0xcafe('0x47')][_0xcafe('0x4e')][_0xcafe('0x4f')](_0xcafe('0x50'),util['format'](_0xcafe('0x51'),_0x57a155['id']),_0x1b924d);})[_0xcafe('0x25')](function(){return _0x57a155;});})[_0xcafe('0x25')](respondWithResult(_0x2f0c3c,0xc9))[_0xcafe('0x43')](handleError(_0x2f0c3c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e29f20b..0da9972 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 _0xae7d=['CmCustomField','cm_custom_fields','../../config/logger','api','request-promise','path','../../config/environment','./cmCustomField.attributes','define'];(function(_0x50c70a,_0x4fcd5c){var _0x1f388a=function(_0xfe9d58){while(--_0xfe9d58){_0x50c70a['push'](_0x50c70a['shift']());}};_0x1f388a(++_0x4fcd5c);}(_0xae7d,0x65));var _0xdae7=function(_0x34d556,_0x50743d){_0x34d556=_0x34d556-0x0;var _0x36be93=_0xae7d[_0x34d556];return _0x36be93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdae7('0x0'))(_0xdae7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdae7('0x2'));var fs=require('fs');var path=require(_0xdae7('0x3'));var rimraf=require('rimraf');var config=require(_0xdae7('0x4'));var attributes=require(_0xdae7('0x5'));module['exports']=function(_0x50a6a3,_0x15a0b4){return _0x50a6a3[_0xdae7('0x6')](_0xdae7('0x7'),attributes,{'tableName':_0xdae7('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d25=['define','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmCustomField.attributes'];(function(_0x591197,_0x24b8db){var _0x3ec4df=function(_0x35accc){while(--_0x35accc){_0x591197['push'](_0x591197['shift']());}};_0x3ec4df(++_0x24b8db);}(_0x7d25,0x169));var _0x57d2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d25[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x57d2('0x0'));var util=require(_0x57d2('0x1'));var logger=require(_0x57d2('0x2'))(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require(_0x57d2('0x7'));var attributes=require(_0x57d2('0x8'));module['exports']=function(_0x1ee284,_0x4404c3){return _0x1ee284[_0x57d2('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index f3a7c3e..2f89e75 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 _0x7926=['catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59d546,_0x107f05){var _0x41fbdb=function(_0x413e68){while(--_0x413e68){_0x59d546['push'](_0x59d546['shift']());}};_0x41fbdb(++_0x107f05);}(_0x7926,0x112));var _0x6792=function(_0x19c1a3,_0x5d2a8f){_0x19c1a3=_0x19c1a3-0x0;var _0x12f2e5=_0x7926[_0x19c1a3];return _0x12f2e5;};'use strict';var _=require(_0x6792('0x0'));var util=require(_0x6792('0x1'));var moment=require('moment');var BPromise=require(_0x6792('0x2'));var rs=require(_0x6792('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6792('0x4'));var logger=require(_0x6792('0x5'))('rpc');var config=require(_0x6792('0x6'));var jayson=require(_0x6792('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2746df,_0x43184e,_0xbda335){return new BPromise(function(_0x5b88c4,_0x3981fb){return client[_0x6792('0x8')](_0x2746df,_0xbda335)[_0x6792('0x9')](function(_0x1bd291){logger[_0x6792('0xa')](_0x6792('0xb'),_0x43184e,_0x6792('0xc'));logger[_0x6792('0xd')](_0x6792('0xe'),_0x43184e,'request\x20sent',JSON[_0x6792('0xf')](_0x1bd291));if(_0x1bd291[_0x6792('0x10')]){if(_0x1bd291['error'][_0x6792('0x11')]===0x1f4){logger['error'](_0x6792('0xb'),_0x43184e,_0x1bd291[_0x6792('0x10')][_0x6792('0x12')]);return _0x3981fb(_0x1bd291[_0x6792('0x10')]['message']);}logger[_0x6792('0x10')](_0x6792('0xb'),_0x43184e,_0x1bd291[_0x6792('0x10')][_0x6792('0x12')]);return _0x5b88c4(_0x1bd291['error'][_0x6792('0x12')]);}else{logger[_0x6792('0xa')](_0x6792('0xb'),_0x43184e,'request\x20sent');_0x5b88c4(_0x1bd291[_0x6792('0x13')][_0x6792('0x12')]);}})[_0x6792('0x14')](function(_0x125e74){logger[_0x6792('0x10')](_0x6792('0xb'),_0x43184e,_0x125e74);_0x3981fb(_0x125e74);});});} \ No newline at end of file +var _0xa19f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x12b5d7,_0x431bd4){var _0x3c2f7f=function(_0x55c285){while(--_0x55c285){_0x12b5d7['push'](_0x12b5d7['shift']());}};_0x3c2f7f(++_0x431bd4);}(_0xa19f,0x70));var _0xfa19=function(_0x350ab0,_0x5587e7){_0x350ab0=_0x350ab0-0x0;var _0x49b2af=_0xa19f[_0x350ab0];return _0x49b2af;};'use strict';var _=require(_0xfa19('0x0'));var util=require(_0xfa19('0x1'));var moment=require(_0xfa19('0x2'));var BPromise=require(_0xfa19('0x3'));var rs=require(_0xfa19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa19('0x5'))['db'];var utils=require(_0xfa19('0x6'));var logger=require(_0xfa19('0x7'))('rpc');var config=require(_0xfa19('0x8'));var jayson=require(_0xfa19('0x9'));var client=jayson['client'][_0xfa19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f66f,_0x2997bc,_0x467b41){return new BPromise(function(_0x14a919,_0x9a5583){return client[_0xfa19('0xb')](_0x24f66f,_0x467b41)[_0xfa19('0xc')](function(_0x5e908f){logger[_0xfa19('0xd')](_0xfa19('0xe'),_0x2997bc,'request\x20sent');logger['debug'](_0xfa19('0xf'),_0x2997bc,_0xfa19('0x10'),JSON[_0xfa19('0x11')](_0x5e908f));if(_0x5e908f[_0xfa19('0x12')]){if(_0x5e908f[_0xfa19('0x12')][_0xfa19('0x13')]===0x1f4){logger[_0xfa19('0x12')](_0xfa19('0xe'),_0x2997bc,_0x5e908f['error'][_0xfa19('0x14')]);return _0x9a5583(_0x5e908f[_0xfa19('0x12')][_0xfa19('0x14')]);}logger[_0xfa19('0x12')](_0xfa19('0xe'),_0x2997bc,_0x5e908f[_0xfa19('0x12')][_0xfa19('0x14')]);return _0x14a919(_0x5e908f['error'][_0xfa19('0x14')]);}else{logger[_0xfa19('0xd')](_0xfa19('0xe'),_0x2997bc,_0xfa19('0x10'));_0x14a919(_0x5e908f[_0xfa19('0x15')][_0xfa19('0x14')]);}})[_0xfa19('0x16')](function(_0x2d471d){logger[_0xfa19('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2997bc,_0x2d471d);_0x9a5583(_0x2d471d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e60f03c..8fd5e38 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 _0xd101=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x250bbc,_0x3297f3){var _0x489e34=function(_0x67c2d3){while(--_0x67c2d3){_0x250bbc['push'](_0x250bbc['shift']());}};_0x489e34(++_0x3297f3);}(_0xd101,0xc1));var _0x1d10=function(_0x1cc3b3,_0xc12914){_0x1cc3b3=_0x1cc3b3-0x0;var _0x58e950=_0xd101[_0x1cc3b3];return _0x58e950;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmCustomField.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0xe')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller['destroy']);module[_0x1d10('0x13')]=router; \ No newline at end of file +var _0x0e6a=['isAuthenticated','index','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0e6a,0x100));var _0xa0e6=function(_0x14d992,_0xa6ea84){_0x14d992=_0x14d992-0x0;var _0x10a29f=_0x0e6a[_0x14d992];return _0x10a29f;};'use strict';var multer=require('multer');var util=require(_0xa0e6('0x0'));var path=require(_0xa0e6('0x1'));var timeout=require(_0xa0e6('0x2'));var express=require(_0xa0e6('0x3'));var router=express[_0xa0e6('0x4')]();var fs_extra=require(_0xa0e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa0e6('0x6'));var config=require(_0xa0e6('0x7'));var controller=require(_0xa0e6('0x8'));router[_0xa0e6('0x9')]('/',auth[_0xa0e6('0xa')](),controller[_0xa0e6('0xb')]);router['get']('/:id',auth[_0xa0e6('0xa')](),controller[_0xa0e6('0xc')]);router[_0xa0e6('0xd')]('/',auth[_0xa0e6('0xa')](),controller[_0xa0e6('0xe')]);router[_0xa0e6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0e6('0x10')]);router[_0xa0e6('0x11')]('/:id',auth[_0xa0e6('0xa')](),controller['destroy']);module[_0xa0e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 44797ce..58e7e67 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 _0x83b8=['UNSIGNED','BOOLEAN','contactListQueue','moment','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x532f2a,_0x23560c){var _0x1b9649=function(_0x44b11c){while(--_0x44b11c){_0x532f2a['push'](_0x532f2a['shift']());}};_0x1b9649(++_0x23560c);}(_0x83b8,0x175));var _0x883b=function(_0x531ab0,_0x288b83){_0x531ab0=_0x531ab0-0x0;var _0x2de4dc=_0x83b8[_0x531ab0];return _0x2de4dc;};'use strict';var moment=require(_0x883b('0x0'));var Sequelize=require(_0x883b('0x1'));module[_0x883b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x883b('0x3')],'defaultValue':moment()[_0x883b('0x4')](_0x883b('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x883b('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x883b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x883b('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x883b('0x9')},'ListId':{'type':Sequelize[_0x883b('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x883b('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x883b('0x9')},'CampaignId':{'type':Sequelize[_0x883b('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x883b('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x883b('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x883b('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xfc0f=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x6967bf,_0x29eaea){var _0x413429=function(_0xd91ff8){while(--_0xd91ff8){_0x6967bf['push'](_0x6967bf['shift']());}};_0x413429(++_0x29eaea);}(_0xfc0f,0xb0));var _0xffc0=function(_0x2020b6,_0x2ff986){_0x2020b6=_0x2020b6-0x0;var _0x2e0f62=_0xfc0f[_0x2020b6];return _0x2e0f62;};'use strict';var moment=require(_0xffc0('0x0'));var Sequelize=require('sequelize');module[_0xffc0('0x1')]={'phone':{'type':Sequelize[_0xffc0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xffc0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xffc0('0x4')],'defaultValue':moment()[_0xffc0('0x5')](_0xffc0('0x6'))},'countbusyretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xffc0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xffc0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xffc0('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xffc0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xffc0('0x7')],'unique':_0xffc0('0x9')},'ListId':{'type':Sequelize[_0xffc0('0x7')],'unique':_0xffc0('0x9')},'UserId':{'type':Sequelize[_0xffc0('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xffc0('0x9')},'CampaignId':{'type':Sequelize[_0xffc0('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xffc0('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xffc0('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xffc0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xffc0('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 1f00852..e8943f0 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 _0x1b20=['$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','then','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','CmContact','firstName','isNil','lastName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','keys','outbound','preview','dialOrderByScheduledAt','transaction','dialPreviewAutoRecallMe','direction','prev','priority','scheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','recallme','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','json','offset','limit','count','Content-Range','update','sendStatus','error','stack','send','map','CmHopper','rawAttributes','fieldName','key','name','query','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte'];(function(_0x2fa022,_0x3052e8){var _0x1f0355=function(_0x46b15c){while(--_0x46b15c){_0x2fa022['push'](_0x2fa022['shift']());}};_0x1f0355(++_0x3052e8);}(_0x1b20,0x66));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var _=require(_0x01b2('0x0'));var qs=require(_0x01b2('0x1'));var logger=require('../../config/logger')('api');var shared=require(_0x01b2('0x2'));var db=require(_0x01b2('0x3'))['db'];function respondWithResult(_0x2d6e99,_0x1150fc){_0x1150fc=_0x1150fc||0xc8;return function(_0x1cf757){if(_0x1cf757){return _0x2d6e99[_0x01b2('0x4')](_0x1150fc)[_0x01b2('0x5')](_0x1cf757);}};}function respondWithFilteredResult(_0x28de4a,_0x46e745){return function(_0xa64ad1){if(_0xa64ad1){var _0x43d561=typeof _0x46e745[_0x01b2('0x6')]==='undefined'&&typeof _0x46e745[_0x01b2('0x7')]==='undefined';var _0x2e975d=_0xa64ad1[_0x01b2('0x8')];var _0x3bad99=_0x43d561?0x0:_0x46e745[_0x01b2('0x6')];var _0x9c411f=_0x43d561?_0xa64ad1[_0x01b2('0x8')]:_0x46e745[_0x01b2('0x6')]+_0x46e745[_0x01b2('0x7')];var _0x55804c;if(_0x9c411f>=_0x2e975d){_0x9c411f=_0x2e975d;_0x55804c=0xc8;}else{_0x55804c=0xce;}_0x28de4a[_0x01b2('0x4')](_0x55804c);return _0x28de4a['set'](_0x01b2('0x9'),_0x3bad99+'-'+_0x9c411f+'/'+_0x2e975d)['json'](_0xa64ad1);}return null;};}function saveUpdates(_0x41a618,_0x8ac569){return function(_0x2c6d4d){if(_0x2c6d4d){return _0x2c6d4d[_0x01b2('0xa')](_0x41a618)['then'](function(_0x2f97d1){return _0x2f97d1;});}return null;};}function handleEntityNotFound(_0x2e7b31,_0x4f1c15){return function(_0x1626ba){if(!_0x1626ba){_0x2e7b31[_0x01b2('0xb')](0x194);}return _0x1626ba;};}function handleError(_0x5a36de,_0x299d0c){_0x299d0c=_0x299d0c||0x1f4;return function(_0x3d5833){logger[_0x01b2('0xc')](_0x3d5833[_0x01b2('0xd')]);if(_0x3d5833['name']){delete _0x3d5833['name'];}_0x5a36de[_0x01b2('0x4')](_0x299d0c)[_0x01b2('0xe')](_0x3d5833);};}exports['index']=function(_0x1eafc4,_0x444236){var _0x27a0bc={},_0x5986f5={},_0x25c55f={'count':0x0,'rows':[]};var _0x9f182b=_[_0x01b2('0xf')](db[_0x01b2('0x10')][_0x01b2('0x11')],function(_0x56ea3c){return{'name':_0x56ea3c[_0x01b2('0x12')],'type':_0x56ea3c['type'][_0x01b2('0x13')]};});_0x5986f5['model']=_[_0x01b2('0xf')](_0x9f182b,_0x01b2('0x14'));_0x5986f5[_0x01b2('0x15')]=_['keys'](_0x1eafc4[_0x01b2('0x15')]);_0x5986f5[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x5986f5[_0x01b2('0x18')],_0x5986f5[_0x01b2('0x15')]);_0x5986f5['filters']=_[_0x01b2('0x19')](_0x5986f5['filters'],['$and',_0x01b2('0x1a'),_0x01b2('0x1b'),_0x01b2('0x1c'),_0x01b2('0x1d'),_0x01b2('0x1e'),_0x01b2('0x1f'),'$eq',_0x01b2('0x20'),_0x01b2('0x21'),_0x01b2('0x22'),_0x01b2('0x23'),'$notIn',_0x01b2('0x24'),'$notLike',_0x01b2('0x25'),_0x01b2('0x26'),'$like',_0x01b2('0x27'),'$contains','$contained',_0x01b2('0x28')]);_0x27a0bc[_0x01b2('0x29')]=_['intersection'](_0x5986f5[_0x01b2('0x18')],qs[_0x01b2('0x2a')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x27a0bc[_0x01b2('0x29')]=_0x27a0bc[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x27a0bc[_0x01b2('0x29')]:_0x5986f5[_0x01b2('0x18')];if(!_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2c')]('nolimit')){_0x27a0bc[_0x01b2('0x7')]=qs[_0x01b2('0x7')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x7')]);_0x27a0bc[_0x01b2('0x6')]=qs[_0x01b2('0x6')](_0x1eafc4['query']['offset']);}_0x27a0bc[_0x01b2('0x2d')]=qs['sort'](_0x1eafc4['query'][_0x01b2('0x2e')]);_0x27a0bc[_0x01b2('0x2f')]=qs[_0x01b2('0x16')](_[_0x01b2('0x30')](_0x1eafc4['query'],_0x5986f5[_0x01b2('0x16')]),_0x9f182b);if(_0x1eafc4['query'][_0x01b2('0x31')]){_0x27a0bc['where']=_['merge'](_0x27a0bc['where'],{'$or':_[_0x01b2('0xf')](_0x9f182b,function(_0x29532e){if(_0x29532e[_0x01b2('0x32')]!==_0x01b2('0x33')){var _0x4d80d0={};_0x4d80d0[_0x29532e[_0x01b2('0x14')]]={'$like':'%'+_0x1eafc4[_0x01b2('0x15')]['filter']+'%'};return _0x4d80d0;}})});}_0x27a0bc=_[_0x01b2('0x34')]({},_0x27a0bc,_0x1eafc4[_0x01b2('0x35')]);var _0x13dbb4={'where':_0x27a0bc[_0x01b2('0x2f')]};return db[_0x01b2('0x10')][_0x01b2('0x8')](_0x13dbb4)['then'](function(_0x2fb530){_0x25c55f[_0x01b2('0x8')]=_0x2fb530;if(_0x1eafc4['query']['includeAll']){_0x27a0bc[_0x01b2('0x36')]=[{'all':!![]}];}return db[_0x01b2('0x10')][_0x01b2('0x37')](_0x27a0bc);})[_0x01b2('0x38')](function(_0x34fdb2){_0x25c55f[_0x01b2('0x39')]=_0x34fdb2;return _0x25c55f;})['then'](respondWithFilteredResult(_0x444236,_0x27a0bc))['catch'](handleError(_0x444236,null));};exports[_0x01b2('0x3a')]=function(_0x4ba89b,_0xbd7259){var _0x31878={'raw':!![],'where':{'id':_0x4ba89b[_0x01b2('0x3b')]['id']}},_0x1a1e3b={};_0x1a1e3b[_0x01b2('0x18')]=_['keys'](db[_0x01b2('0x10')][_0x01b2('0x11')]);_0x1a1e3b[_0x01b2('0x15')]=_['keys'](_0x4ba89b[_0x01b2('0x15')]);_0x1a1e3b[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x1a1e3b['model'],_0x1a1e3b[_0x01b2('0x15')]);_0x31878['attributes']=_[_0x01b2('0x17')](_0x1a1e3b[_0x01b2('0x18')],qs['fields'](_0x4ba89b[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x31878['attributes']=_0x31878[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x31878[_0x01b2('0x29')]:_0x1a1e3b[_0x01b2('0x18')];if(_0x4ba89b[_0x01b2('0x15')]['includeAll']){_0x31878[_0x01b2('0x36')]=[{'all':!![]}];}_0x31878=_[_0x01b2('0x34')]({},_0x31878,_0x4ba89b[_0x01b2('0x35')]);return db['CmHopper'][_0x01b2('0x3c')](_0x31878)[_0x01b2('0x38')](handleEntityNotFound(_0xbd7259,null))[_0x01b2('0x38')](respondWithResult(_0xbd7259,null))[_0x01b2('0x3d')](handleError(_0xbd7259,null));};exports[_0x01b2('0x3e')]=function(_0x3f9451,_0x3eda44){return db[_0x01b2('0x10')]['create'](_0x3f9451[_0x01b2('0x3f')],{})[_0x01b2('0x38')](respondWithResult(_0x3eda44,0xc9))[_0x01b2('0x3d')](handleError(_0x3eda44,null));};exports[_0x01b2('0xa')]=function(_0xf36d42,_0x3469b3){if(_0xf36d42[_0x01b2('0x3f')]['id']){delete _0xf36d42['body']['id'];}return db[_0x01b2('0x10')][_0x01b2('0x3c')]({'where':{'id':_0xf36d42[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x3469b3,null))['then'](saveUpdates(_0xf36d42['body'],null))[_0x01b2('0x38')](respondWithResult(_0x3469b3,null))[_0x01b2('0x3d')](handleError(_0x3469b3,null));};exports[_0x01b2('0x40')]=function(_0x49370d,_0x7a6cae){return db[_0x01b2('0x10')][_0x01b2('0x40')]()[_0x01b2('0x38')](respondWithResult(_0x7a6cae,null))[_0x01b2('0x3d')](handleError(_0x7a6cae,null));};exports[_0x01b2('0x41')]=function(_0x5b54c5,_0x2a8b8d){var _0x5e0e70;var _0x272d0d=_0x5b54c5['params']['id'];return db['CmHopper'][_0x01b2('0x3c')]({'where':{'id':_0x5b54c5[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x38')](function(_0x20cc59){if(_0x20cc59){return _0x20cc59['destroy']()['then'](function(_0x387954){return _0x387954;});}})[_0x01b2('0x38')](function(_0x3ee05b){_0x5e0e70=_0x3ee05b;if(_0x3ee05b){if(_0x3ee05b[_0x01b2('0x42')]||_0x3ee05b[_0x01b2('0x43')]){return db[_0x3ee05b[_0x01b2('0x42')]?'VoiceQueue':_0x01b2('0x44')][_0x01b2('0x3c')]({'where':{'id':_0x3ee05b[_0x01b2('0x42')]?_0x3ee05b[_0x01b2('0x42')]:_0x3ee05b[_0x01b2('0x43')]},'attributes':['id',_0x01b2('0x14')],'raw':!![]});}}})[_0x01b2('0x38')](function(_0x5dcafc){var _0x445fb2={};if(_0x5dcafc){_[_0x01b2('0x34')](_0x445fb2,_[_0x01b2('0x45')](_0x5e0e70[_0x01b2('0x46')],[_0x01b2('0x47'),_0x01b2('0x48'),'id']));_0x445fb2['state']=0x15;_0x445fb2[_0x01b2('0x49')]=_0x01b2('0x4a');_0x445fb2[_0x01b2('0x4b')]=_0x5dcafc[_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4c')]=_0x5b54c5[_0x01b2('0x4d')][_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4e')]=_0x5b54c5[_0x01b2('0x4d')]['id'];_0x445fb2[_0x01b2('0x4a')]=!![];_0x445fb2[_0x01b2('0x4f')]=moment()[_0x01b2('0x50')](_0x01b2('0x51'));_0x445fb2[_0x01b2('0x52')]=_0x5e0e70['phone'];_0x445fb2['campaigntype']=_0x5e0e70['VoiceQueueId']?'queue':_0x01b2('0x53');return db[_0x01b2('0x54')][_0x01b2('0x3c')]({'where':{'id':_0x445fb2['ContactId']},'attributes':[_0x01b2('0x55'),'lastName']})[_0x01b2('0x38')](function(_0x32371b){if(!_[_0x01b2('0x56')](_0x2a8b8d)&&!_[_0x01b2('0x56')](_0x32371b[_0x01b2('0x55')])){_0x445fb2['calleridname']=_0x32371b[_0x01b2('0x55')];if(!_['isNil'](_0x32371b[_0x01b2('0x57')])){_0x445fb2[_0x01b2('0x58')]+='\x20'+_0x32371b['lastName'];}}})[_0x01b2('0x59')](function(){return db['CmHopperFinal'][_0x01b2('0x3e')](_0x445fb2);});}})[_0x01b2('0x38')](function(_0x42c5b8){return db[_0x01b2('0x5a')][_0x01b2('0x41')]({'where':{'CmHopperId':_0x272d0d}});})[_0x01b2('0x38')](function(){return _0x2a8b8d[_0x01b2('0x4')](0xcc)[_0x01b2('0x5b')]();})[_0x01b2('0x3d')](handleError(_0x2a8b8d,null));};exports[_0x01b2('0x5c')]=function(_0x5d7da3,_0x2eb448){var _0x5655b6=[];return db[_0x01b2('0x54')][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x58c8de){_0x5655b6=_[_0x01b2('0x5d')](_0x58c8de);return _0x5d7da3['user']['getVoiceQueues']({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':_0x01b2('0x5f')},'attributes':['id',_0x01b2('0x60'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x01b2('0x38')](function(_0x330cb4){if(_0x330cb4&&_0x330cb4[_0x01b2('0x2b')]){return db['sequelize'][_0x01b2('0x61')](function(_0x429b89){var _0xcbef9c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x330cb4,'id')},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x56c794={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x330cb4)['filter']([_0x01b2('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x4ca277={'$or':[_0xcbef9c,_0x56c794]};var _0xbe104b=[];if(_0x5d7da3['body'][_0x01b2('0x63')]&&_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x63')]===_0x01b2('0x64')){if(!_['isEmpty'](_0x5d7da3[_0x01b2('0x3f')]['hopperIds'])){_0x4ca277['id']={'$in':_0x5d7da3[_0x01b2('0x3f')]['hopperIds']};}_0xbe104b=[[_0x01b2('0x65'),'ASC'],[_0x01b2('0x66'),_0x330cb4[0x0][_0x01b2('0x60')]==='ASC'?_0x01b2('0x67'):_0x01b2('0x68')],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6b')),['id',_0x01b2('0x67')]];}else{if(!_[_0x01b2('0x6c')](_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')])){_0x4ca277['id']={'$notIn':_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')]};}_0xbe104b=[[_0x01b2('0x65'),_0x01b2('0x67')],['scheduledAt',_0x330cb4[0x0]['dialOrderByScheduledAt']],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6e')),['id',_0x01b2('0x68')]];}return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x71'),'recallme'],'where':_0x4ca277,'order':_0xbe104b,'transaction':_0x429b89,'lock':_0x429b89[_0x01b2('0x72')][_0x01b2('0x73')],'include':[{'model':db[_0x01b2('0x54')],'as':_0x01b2('0x74'),'attributes':_0x5655b6,'include':[{'model':db[_0x01b2('0x75')],'as':_0x01b2('0x76'),'attributes':['id',_0x01b2('0x14')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x01b2('0x14')]},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id','name',_0x01b2('0x79')]}]})[_0x01b2('0x38')](function(_0x240558){if(_0x240558){return _0x240558['update']({'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']},{'transaction':_0x429b89});}});});}})[_0x01b2('0x38')](handleEntityNotFound(_0x2eb448,null))[_0x01b2('0x38')](respondWithResult(_0x2eb448,null))['catch'](handleError(_0x2eb448,null));};exports['getPreviewRecall']=function(_0x2a820d,_0x4f1d6a,_0x1e1155){var _0x10d19f=[];var _0x2f41b6=_0x2a820d[_0x01b2('0x3b')]['id'];var _0x19a417=_0x2a820d[_0x01b2('0x4d')]['id'];return db['CmContact'][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x45caa2){_0x10d19f=_[_0x01b2('0x5d')](_0x45caa2);return db[_0x01b2('0x69')][_0x01b2('0x61')](function(_0x5038b2){const _0x12f5ed={'id':_0x2f41b6};return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x7a')],'where':_0x12f5ed,'transaction':_0x5038b2,'lock':_0x5038b2[_0x01b2('0x72')]['UPDATE'],'include':[{'model':db[_0x01b2('0x54')],'as':'Contact','attributes':_0x10d19f,'include':[{'model':db[_0x01b2('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x01b2('0x7b')],'as':_0x01b2('0x7c'),'attributes':['id','name']},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id',_0x01b2('0x14'),_0x01b2('0x79')]}]})['then'](function(_0x4095c2){if(_0x4095c2){return _0x4095c2[_0x01b2('0xa')]({'UserId':_0x19a417},{'transaction':_0x5038b2});}});});})[_0x01b2('0x38')](handleEntityNotFound(_0x4f1d6a,null))[_0x01b2('0x38')](respondWithResult(_0x4f1d6a,null))[_0x01b2('0x3d')](handleError(_0x4f1d6a,null));};exports[_0x01b2('0x7d')]=function(_0x27de72,_0x44034b){return _0x27de72[_0x01b2('0x4d')][_0x01b2('0x7e')]({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x01b2('0x38')](function(_0x3e17c3){if(_0x3e17c3&&_0x3e17c3[_0x01b2('0x2b')]){return db[_0x01b2('0x10')][_0x01b2('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x3e17c3,'id')},'$or':[{'UserId':null},{'UserId':_0x27de72['user']['id']}]}});}return 0x0;})['then'](function(_0xd37088){if(!_[_0x01b2('0x56')](_0xd37088)&&_[_0x01b2('0x7f')](_0xd37088)){return _0x44034b[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'contacts':_0xd37088});}else{logger[_0x01b2('0xc')](_0x01b2('0x80'),_0x01b2('0x7d'),0x194,'entity\x20not\x20found');_0x44034b[_0x01b2('0xb')](0x194);}})[_0x01b2('0x3d')](handleError(_0x44034b,null));};exports[_0x01b2('0x81')]=function(_0x54ccc5,_0x24f9d4){var _0x2dec32=shared[_0x01b2('0x82')];var _0x35aef9=[];_['map'](_0x2dec32,function(_0x5b8abf){_0x35aef9['push']({'id':_0x5b8abf[_0x01b2('0x14')],'name':_0x5b8abf['name'],'utcOffset':_0x5b8abf[_0x01b2('0x83')]});});return _0x24f9d4[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'tz':_0x35aef9});};exports[_0x01b2('0x84')]=function(_0x176ef,_0x372585){var _0x46e1ef=shared[_0x01b2('0x82')];var _0x3fb15f={};if(!_[_0x01b2('0x56')](_0x46e1ef[_0x176ef['body']['id']]))_0x3fb15f=_0x46e1ef[_0x176ef[_0x01b2('0x3f')]['id']];return _0x372585[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')](_0x3fb15f);}; \ No newline at end of file +var _0x4b19=['limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$gt','$lt','$lte','$ne','$eq','$notBetween','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','merge','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','hopperIds','priority','ASC','scheduledAt','literal','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','CmList','List','dialActive','getPreviewRecall','Contact','Company','Queue','outbound','isNumber','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x4b19,0x195));var _0x94b1=function(_0x2acd0f,_0x3ac736){_0x2acd0f=_0x2acd0f-0x0;var _0x434b3e=_0x4b19[_0x2acd0f];return _0x434b3e;};'use strict';var moment=require(_0x94b1('0x0'));var _=require('lodash');var qs=require(_0x94b1('0x1'));var logger=require(_0x94b1('0x2'))(_0x94b1('0x3'));var shared=require('../../config/environment');var db=require(_0x94b1('0x4'))['db'];function respondWithResult(_0x3648ad,_0x2240b9){_0x2240b9=_0x2240b9||0xc8;return function(_0x4f607f){if(_0x4f607f){return _0x3648ad[_0x94b1('0x5')](_0x2240b9)[_0x94b1('0x6')](_0x4f607f);}};}function respondWithFilteredResult(_0x52d6c1,_0x24df76){return function(_0x110a52){if(_0x110a52){var _0x4ea1f9=typeof _0x24df76[_0x94b1('0x7')]===_0x94b1('0x8')&&typeof _0x24df76[_0x94b1('0x9')]==='undefined';var _0x15c0a9=_0x110a52['count'];var _0x4aafcc=_0x4ea1f9?0x0:_0x24df76[_0x94b1('0x7')];var _0x126424=_0x4ea1f9?_0x110a52[_0x94b1('0xa')]:_0x24df76[_0x94b1('0x7')]+_0x24df76[_0x94b1('0x9')];var _0x3aeb91;if(_0x126424>=_0x15c0a9){_0x126424=_0x15c0a9;_0x3aeb91=0xc8;}else{_0x3aeb91=0xce;}_0x52d6c1['status'](_0x3aeb91);return _0x52d6c1[_0x94b1('0xb')](_0x94b1('0xc'),_0x4aafcc+'-'+_0x126424+'/'+_0x15c0a9)[_0x94b1('0x6')](_0x110a52);}return null;};}function saveUpdates(_0x2b378c,_0x5cbf96){return function(_0x4a4fe6){if(_0x4a4fe6){return _0x4a4fe6[_0x94b1('0xd')](_0x2b378c)[_0x94b1('0xe')](function(_0x57de2f){return _0x57de2f;});}return null;};}function handleEntityNotFound(_0x5059d8,_0x9329c9){return function(_0xb9924c){if(!_0xb9924c){_0x5059d8['sendStatus'](0x194);}return _0xb9924c;};}function handleError(_0x3f3eab,_0x58fab3){_0x58fab3=_0x58fab3||0x1f4;return function(_0x4ea6a4){logger[_0x94b1('0xf')](_0x4ea6a4[_0x94b1('0x10')]);if(_0x4ea6a4[_0x94b1('0x11')]){delete _0x4ea6a4[_0x94b1('0x11')];}_0x3f3eab['status'](_0x58fab3)[_0x94b1('0x12')](_0x4ea6a4);};}exports[_0x94b1('0x13')]=function(_0xa29b90,_0x224099){var _0x3a6ae0={},_0x1abb7f={},_0x2d33dc={'count':0x0,'rows':[]};var _0x59d7cf=_[_0x94b1('0x14')](db[_0x94b1('0x15')][_0x94b1('0x16')],function(_0x5deb20){return{'name':_0x5deb20[_0x94b1('0x17')],'type':_0x5deb20[_0x94b1('0x18')]['key']};});_0x1abb7f[_0x94b1('0x19')]=_[_0x94b1('0x14')](_0x59d7cf,_0x94b1('0x11'));_0x1abb7f[_0x94b1('0x1a')]=_[_0x94b1('0x1b')](_0xa29b90[_0x94b1('0x1a')]);_0x1abb7f[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],_0x1abb7f[_0x94b1('0x1a')]);_0x1abb7f['filters']=_[_0x94b1('0x1e')](_0x1abb7f[_0x94b1('0x1c')],[_0x94b1('0x1f'),'$or',_0x94b1('0x20'),'$gte',_0x94b1('0x21'),_0x94b1('0x22'),_0x94b1('0x23'),_0x94b1('0x24'),'$not','$between',_0x94b1('0x25'),'$in',_0x94b1('0x26'),'$like',_0x94b1('0x27'),_0x94b1('0x28'),_0x94b1('0x29'),'$like',_0x94b1('0x2a'),_0x94b1('0x2b'),_0x94b1('0x2c'),_0x94b1('0x2d')]);_0x3a6ae0[_0x94b1('0x2e')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0xa29b90[_0x94b1('0x1a')]['fields']));_0x3a6ae0[_0x94b1('0x2e')]=_0x3a6ae0[_0x94b1('0x2e')]['length']?_0x3a6ae0[_0x94b1('0x2e')]:_0x1abb7f[_0x94b1('0x19')];if(!_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x30')](_0x94b1('0x31'))){_0x3a6ae0[_0x94b1('0x9')]=qs['limit'](_0xa29b90[_0x94b1('0x1a')]['limit']);_0x3a6ae0[_0x94b1('0x7')]=qs['offset'](_0xa29b90['query'][_0x94b1('0x7')]);}_0x3a6ae0[_0x94b1('0x32')]=qs[_0x94b1('0x33')](_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x33')]);_0x3a6ae0[_0x94b1('0x34')]=qs[_0x94b1('0x1c')](_[_0x94b1('0x35')](_0xa29b90[_0x94b1('0x1a')],_0x1abb7f[_0x94b1('0x1c')]),_0x59d7cf);if(_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]){_0x3a6ae0['where']=_['merge'](_0x3a6ae0[_0x94b1('0x34')],{'$or':_[_0x94b1('0x14')](_0x59d7cf,function(_0x298bc2){if(_0x298bc2[_0x94b1('0x18')]!==_0x94b1('0x37')){var _0x2ba486={};_0x2ba486[_0x298bc2[_0x94b1('0x11')]]={'$like':'%'+_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]+'%'};return _0x2ba486;}})});}_0x3a6ae0=_['merge']({},_0x3a6ae0,_0xa29b90[_0x94b1('0x38')]);var _0x4d18e8={'where':_0x3a6ae0[_0x94b1('0x34')]};return db[_0x94b1('0x15')][_0x94b1('0xa')](_0x4d18e8)['then'](function(_0x357798){_0x2d33dc[_0x94b1('0xa')]=_0x357798;if(_0xa29b90[_0x94b1('0x1a')]['includeAll']){_0x3a6ae0[_0x94b1('0x39')]=[{'all':!![]}];}return db[_0x94b1('0x15')][_0x94b1('0x3a')](_0x3a6ae0);})[_0x94b1('0xe')](function(_0x3e5b02){_0x2d33dc[_0x94b1('0x3b')]=_0x3e5b02;return _0x2d33dc;})[_0x94b1('0xe')](respondWithFilteredResult(_0x224099,_0x3a6ae0))[_0x94b1('0x3c')](handleError(_0x224099,null));};exports[_0x94b1('0x3d')]=function(_0x2d6f38,_0x32d009){var _0xfb5e55={'raw':!![],'where':{'id':_0x2d6f38['params']['id']}},_0x235a44={};_0x235a44[_0x94b1('0x19')]=_[_0x94b1('0x1b')](db[_0x94b1('0x15')][_0x94b1('0x16')]);_0x235a44[_0x94b1('0x1a')]=_['keys'](_0x2d6f38[_0x94b1('0x1a')]);_0x235a44[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x235a44[_0x94b1('0x19')],_0x235a44[_0x94b1('0x1a')]);_0xfb5e55[_0x94b1('0x2e')]=_['intersection'](_0x235a44[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0x2d6f38['query'][_0x94b1('0x2f')]));_0xfb5e55[_0x94b1('0x2e')]=_0xfb5e55['attributes'][_0x94b1('0x3e')]?_0xfb5e55[_0x94b1('0x2e')]:_0x235a44[_0x94b1('0x19')];if(_0x2d6f38['query'][_0x94b1('0x3f')]){_0xfb5e55[_0x94b1('0x39')]=[{'all':!![]}];}_0xfb5e55=_[_0x94b1('0x40')]({},_0xfb5e55,_0x2d6f38[_0x94b1('0x38')]);return db[_0x94b1('0x15')][_0x94b1('0x41')](_0xfb5e55)[_0x94b1('0xe')](handleEntityNotFound(_0x32d009,null))['then'](respondWithResult(_0x32d009,null))[_0x94b1('0x3c')](handleError(_0x32d009,null));};exports[_0x94b1('0x42')]=function(_0x163b8e,_0x4f023d){return db[_0x94b1('0x15')][_0x94b1('0x42')](_0x163b8e['body'],{})[_0x94b1('0xe')](respondWithResult(_0x4f023d,0xc9))[_0x94b1('0x3c')](handleError(_0x4f023d,null));};exports[_0x94b1('0xd')]=function(_0x4755c5,_0x13ec08){if(_0x4755c5[_0x94b1('0x43')]['id']){delete _0x4755c5[_0x94b1('0x43')]['id'];}return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x4755c5[_0x94b1('0x44')]['id']}})[_0x94b1('0xe')](handleEntityNotFound(_0x13ec08,null))[_0x94b1('0xe')](saveUpdates(_0x4755c5[_0x94b1('0x43')],null))[_0x94b1('0xe')](respondWithResult(_0x13ec08,null))[_0x94b1('0x3c')](handleError(_0x13ec08,null));};exports[_0x94b1('0x45')]=function(_0xfe1c8f,_0x2b22ee){return db[_0x94b1('0x15')]['describe']()[_0x94b1('0xe')](respondWithResult(_0x2b22ee,null))['catch'](handleError(_0x2b22ee,null));};exports[_0x94b1('0x46')]=function(_0x3fc0fc,_0x1d8e57){var _0x54fc33;var _0x4dacb2=_0x3fc0fc['params']['id'];return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x3fc0fc[_0x94b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d8e57,null))['then'](function(_0x4d2af3){if(_0x4d2af3){return _0x4d2af3[_0x94b1('0x46')]()[_0x94b1('0xe')](function(_0xbfd51b){return _0xbfd51b;});}})[_0x94b1('0xe')](function(_0x4109ca){_0x54fc33=_0x4109ca;if(_0x4109ca){if(_0x4109ca[_0x94b1('0x47')]||_0x4109ca[_0x94b1('0x48')]){return db[_0x4109ca['VoiceQueueId']?_0x94b1('0x49'):_0x94b1('0x4a')][_0x94b1('0x41')]({'where':{'id':_0x4109ca[_0x94b1('0x47')]?_0x4109ca[_0x94b1('0x47')]:_0x4109ca[_0x94b1('0x48')]},'attributes':['id',_0x94b1('0x11')],'raw':!![]});}}})[_0x94b1('0xe')](function(_0x37aa72){var _0x252a63={};if(_0x37aa72){_[_0x94b1('0x40')](_0x252a63,_[_0x94b1('0x4b')](_0x54fc33[_0x94b1('0x4c')],[_0x94b1('0x4d'),'updatedAt','id']));_0x252a63[_0x94b1('0x4e')]=0x15;_0x252a63[_0x94b1('0x4f')]=_0x94b1('0x50');_0x252a63[_0x94b1('0x51')]=_0x37aa72[_0x94b1('0x11')];_0x252a63[_0x94b1('0x52')]=_0x3fc0fc[_0x94b1('0x53')][_0x94b1('0x11')];_0x252a63[_0x94b1('0x54')]=_0x3fc0fc['user']['id'];_0x252a63[_0x94b1('0x50')]=!![];_0x252a63[_0x94b1('0x55')]=moment()[_0x94b1('0x56')](_0x94b1('0x57'));_0x252a63[_0x94b1('0x58')]=_0x54fc33[_0x94b1('0x59')];_0x252a63['campaigntype']=_0x54fc33[_0x94b1('0x47')]?_0x94b1('0x5a'):_0x94b1('0x5b');return db[_0x94b1('0x5c')][_0x94b1('0x41')]({'where':{'id':_0x252a63[_0x94b1('0x5d')]},'attributes':[_0x94b1('0x5e'),_0x94b1('0x5f')]})[_0x94b1('0xe')](function(_0x502d2c){if(!_['isNil'](_0x1d8e57)&&!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5e')])){_0x252a63[_0x94b1('0x61')]=_0x502d2c[_0x94b1('0x5e')];if(!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5f')])){_0x252a63[_0x94b1('0x61')]+='\x20'+_0x502d2c[_0x94b1('0x5f')];}}})[_0x94b1('0x62')](function(){return db[_0x94b1('0x63')][_0x94b1('0x42')](_0x252a63);});}})[_0x94b1('0xe')](function(_0x4d22ac){return db['CmHopperAdditionalPhone'][_0x94b1('0x46')]({'where':{'CmHopperId':_0x4dacb2}});})[_0x94b1('0xe')](function(){return _0x1d8e57[_0x94b1('0x5')](0xcc)[_0x94b1('0x64')]();})[_0x94b1('0x3c')](handleError(_0x1d8e57,null));};exports['getPreview']=function(_0x249c48,_0x478117){var _0x37e951=[];return db[_0x94b1('0x5c')][_0x94b1('0x45')]()['then'](function(_0x576a6d){_0x37e951=_[_0x94b1('0x1b')](_0x576a6d);return _0x249c48[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id',_0x94b1('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0xca90cf){if(_0xca90cf&&_0xca90cf[_0x94b1('0x3e')]){return db[_0x94b1('0x68')][_0x94b1('0x69')](function(_0x282081){var _0x1c0013={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0xca90cf,'id')},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x4a26cc={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xca90cf)[_0x94b1('0x36')]([_0x94b1('0x6a'),0x0])[_0x94b1('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x5b1340={'$or':[_0x1c0013,_0x4a26cc]};var _0x5615c8=[];if(_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]&&_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]==='prev'){if(!_['isEmpty'](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$in':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[[_0x94b1('0x6d'),_0x94b1('0x6e')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]==='ASC'?'DESC':_0x94b1('0x6e')],db['sequelize'][_0x94b1('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x94b1('0x71')]];}else{if(!_[_0x94b1('0x72')](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$notIn':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[['priority',_0x94b1('0x71')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]],db[_0x94b1('0x68')][_0x94b1('0x70')](_0x94b1('0x73')),['id',_0x94b1('0x6e')]];}return db['CmHopper'][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x59'),_0x94b1('0x76')],'where':_0x5b1340,'order':_0x5615c8,'transaction':_0x282081,'lock':_0x282081[_0x94b1('0x77')][_0x94b1('0x78')],'include':[{'model':db[_0x94b1('0x5c')],'as':'Contact','attributes':_0x37e951,'include':[{'model':db[_0x94b1('0x79')],'as':'Company','attributes':['id',_0x94b1('0x11')]}]},{'model':db[_0x94b1('0x7a')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xe48788){if(_0xe48788){return _0xe48788[_0x94b1('0xd')]({'UserId':_0x249c48[_0x94b1('0x53')]['id']},{'transaction':_0x282081});}});});}})['then'](handleEntityNotFound(_0x478117,null))[_0x94b1('0xe')](respondWithResult(_0x478117,null))[_0x94b1('0x3c')](handleError(_0x478117,null));};exports[_0x94b1('0x7d')]=function(_0x219939,_0x48472c,_0x46893d){var _0x486841=[];var _0x53faf9=_0x219939['params']['id'];var _0x2f05d5=_0x219939[_0x94b1('0x53')]['id'];return db[_0x94b1('0x5c')]['describe']()['then'](function(_0x587099){_0x486841=_[_0x94b1('0x1b')](_0x587099);return db[_0x94b1('0x68')]['transaction'](function(_0x5edb29){const _0x4c2a00={'id':_0x53faf9};return db[_0x94b1('0x15')][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x76')],'where':_0x4c2a00,'transaction':_0x5edb29,'lock':_0x5edb29['LOCK']['UPDATE'],'include':[{'model':db[_0x94b1('0x5c')],'as':_0x94b1('0x7e'),'attributes':_0x486841,'include':[{'model':db[_0x94b1('0x79')],'as':_0x94b1('0x7f'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x94b1('0x11')]},{'model':db[_0x94b1('0x49')],'as':_0x94b1('0x80'),'attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xc2894f){if(_0xc2894f){return _0xc2894f[_0x94b1('0xd')]({'UserId':_0x2f05d5},{'transaction':_0x5edb29});}});});})['then'](handleEntityNotFound(_0x48472c,null))[_0x94b1('0xe')](respondWithResult(_0x48472c,null))['catch'](handleError(_0x48472c,null));};exports['getOpenContacts']=function(_0x416055,_0x5edac4){return _0x416055[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':_0x94b1('0x81'),'dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id'],'raw':!![]})[_0x94b1('0xe')](function(_0x4f182c){if(_0x4f182c&&_0x4f182c[_0x94b1('0x3e')]){return db['CmHopper'][_0x94b1('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x4f182c,'id')},'$or':[{'UserId':null},{'UserId':_0x416055[_0x94b1('0x53')]['id']}]}});}return 0x0;})[_0x94b1('0xe')](function(_0x59f77a){if(!_['isNil'](_0x59f77a)&&_[_0x94b1('0x82')](_0x59f77a)){return _0x5edac4[_0x94b1('0x5')](0xc8)[_0x94b1('0x6')]({'contacts':_0x59f77a});}else{logger[_0x94b1('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x94b1('0x83'),0x194,'entity\x20not\x20found');_0x5edac4[_0x94b1('0x84')](0x194);}})['catch'](handleError(_0x5edac4,null));};exports[_0x94b1('0x85')]=function(_0x4ba865,_0x497c2f){var _0x3f0958=shared[_0x94b1('0x86')];var _0x594bbd=[];_[_0x94b1('0x14')](_0x3f0958,function(_0x1b9a5d){_0x594bbd[_0x94b1('0x87')]({'id':_0x1b9a5d['name'],'name':_0x1b9a5d[_0x94b1('0x11')],'utcOffset':_0x1b9a5d[_0x94b1('0x88')]});});return _0x497c2f[_0x94b1('0x5')](0xc8)['json']({'tz':_0x594bbd});};exports[_0x94b1('0x89')]=function(_0x4d6c7e,_0x595ae3){var _0x238963=shared['timezones'];var _0x3ca231={};if(!_['isNil'](_0x238963[_0x4d6c7e[_0x94b1('0x43')]['id']]))_0x3ca231=_0x238963[_0x4d6c7e['body']['id']];return _0x595ae3[_0x94b1('0x5')](0xc8)['json'](_0x3ca231);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4b8e373..b7ac152 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d118d,_0x4e71e2){var _0x1730fb=function(_0x2bf0c8){while(--_0x2bf0c8){_0x3d118d['push'](_0x3d118d['shift']());}};_0x1730fb(++_0x4e71e2);}(_0x5fab,0x177));var _0xb5fa=function(_0x845fcc,_0x518cfb){_0x845fcc=_0x845fcc-0x0;var _0x3a0e79=_0x5fab[_0x845fcc];return _0x3a0e79;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['CmHopper','scheduledat','phone','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x6f47,0xc7));var _0x76f4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6f47[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xa')]},{'name':_0x76f4('0xb'),'fields':[_0x76f4('0xb')]},{'name':_0x76f4('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 52eeff6..97c4f62 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 _0x493c=['where','info','CreateCmHopper','create','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','GetContactDialer','describe','transaction','order','LOCK','CmContact','Contact','keys','Agent','name','voicePause','UserId','push','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','destroy','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','all','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','util','moment','bluebird','../../config/logger','CmHopper','findAll','options','raw','attributes','limit','include','model','map','then','debug','GetCmHopper','stringify','catch','error','message','ShowCmHopper'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x493c,0x123));var _0xc493=function(_0x40fade,_0x36cc38){_0x40fade=_0x40fade-0x0;var _0x4eec6d=_0x493c[_0x40fade];return _0x4eec6d;};'use strict';var _=require('lodash');var util=require(_0xc493('0x0'));var moment=require(_0xc493('0x1'));var BPromise=require(_0xc493('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc493('0x3'))('rpc');exports['GetCmHopper']=function(_0xe51de9){var _0x2b2630=this;return new Promise(function(_0x12bc9f,_0x56f87d){return db[_0xc493('0x4')][_0xc493('0x5')]({'raw':_0xe51de9[_0xc493('0x6')]?_0xe51de9[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'where':_0xe51de9[_0xc493('0x6')]?_0xe51de9[_0xc493('0x6')]['where']||null:null,'attributes':_0xe51de9['options']?_0xe51de9[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0xe51de9['options']?_0xe51de9[_0xc493('0x6')][_0xc493('0x9')]||null:null,'include':_0xe51de9['options']?_0xe51de9['options'][_0xc493('0xa')]?_['map'](_0xe51de9[_0xc493('0x6')]['include'],function(_0x29931b){return{'model':db[_0x29931b[_0xc493('0xb')]],'as':_0x29931b['as'],'attributes':_0x29931b[_0xc493('0x8')],'include':_0x29931b[_0xc493('0xa')]?_[_0xc493('0xc')](_0x29931b[_0xc493('0xa')],function(_0x4bd447){return{'model':db[_0x4bd447[_0xc493('0xb')]],'as':_0x4bd447['as'],'attributes':_0x4bd447[_0xc493('0x8')],'include':_0x4bd447[_0xc493('0xa')]?_[_0xc493('0xc')](_0x4bd447[_0xc493('0xa')],function(_0x2ca881){return{'model':db[_0x2ca881[_0xc493('0xb')]],'as':_0x2ca881['as'],'attributes':_0x2ca881['attributes']};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x1e6717){logger['info']('GetCmHopper',_0xe51de9);logger[_0xc493('0xe')](_0xc493('0xf'),_0xe51de9,JSON[_0xc493('0x10')](_0x1e6717));_0x12bc9f(_0x1e6717);})[_0xc493('0x11')](function(_0x49c68a){logger[_0xc493('0x12')](_0xc493('0xf'),_0x49c68a[_0xc493('0x13')],_0xe51de9);_0x56f87d(_0x2b2630[_0xc493('0x12')](0x1f4,_0x49c68a[_0xc493('0x13')]));});});};exports[_0xc493('0x14')]=function(_0x1758c5){var _0x2b1e05=this;return new Promise(function(_0x54a467,_0x2b3fed){return db[_0xc493('0x4')]['find']({'raw':_0x1758c5['options']?_0x1758c5[_0xc493('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x1758c5[_0xc493('0x6')]?_0x1758c5['options'][_0xc493('0x15')]||null:null,'attributes':_0x1758c5[_0xc493('0x6')]?_0x1758c5[_0xc493('0x6')][_0xc493('0x8')]||null:null,'include':_0x1758c5[_0xc493('0x6')]?_0x1758c5[_0xc493('0x6')][_0xc493('0xa')]?_['map'](_0x1758c5[_0xc493('0x6')][_0xc493('0xa')],function(_0x4d5ad5){return{'model':db[_0x4d5ad5['model']],'as':_0x4d5ad5['as'],'attributes':_0x4d5ad5[_0xc493('0x8')],'include':_0x4d5ad5['include']?_[_0xc493('0xc')](_0x4d5ad5['include'],function(_0x3283b7){return{'model':db[_0x3283b7[_0xc493('0xb')]],'as':_0x3283b7['as'],'attributes':_0x3283b7['attributes'],'include':_0x3283b7['include']?_['map'](_0x3283b7[_0xc493('0xa')],function(_0x41941a){return{'model':db[_0x41941a[_0xc493('0xb')]],'as':_0x41941a['as'],'attributes':_0x41941a[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x462c0a){logger[_0xc493('0x16')]('ShowCmHopper',_0x1758c5);logger['debug'](_0xc493('0x14'),_0x1758c5,JSON[_0xc493('0x10')](_0x462c0a));_0x54a467(_0x462c0a);})['catch'](function(_0x110d8f){logger['error'](_0xc493('0x14'),_0x110d8f[_0xc493('0x13')],_0x1758c5);_0x2b3fed(_0x2b1e05[_0xc493('0x12')](0x1f4,_0x110d8f[_0xc493('0x13')]));});});};exports[_0xc493('0x17')]=function(_0x1c3e51){var _0x26e69b=this;return new Promise(function(_0x5e2b18,_0x133648){return db[_0xc493('0x4')][_0xc493('0x18')](_0x1c3e51['body'],{'raw':_0x1c3e51[_0xc493('0x6')]?_0x1c3e51[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![]})[_0xc493('0xd')](function(_0xd928cd){logger['info']('CreateCmHopper',_0x1c3e51);logger['debug'](_0xc493('0x17'),_0x1c3e51,JSON[_0xc493('0x10')](_0xd928cd));_0x5e2b18(_0xd928cd);})['catch'](function(_0x10aa3e){logger[_0xc493('0x12')](_0xc493('0x17'),_0x10aa3e[_0xc493('0x13')],_0x1c3e51);_0x133648(_0x26e69b[_0xc493('0x12')](0x1f4,_0x10aa3e['message']));});});};exports[_0xc493('0x19')]=function(_0x1171db){var _0x2559fd=this;return new Promise(function(_0x1463d9,_0x4e4ad6){return db[_0xc493('0x4')][_0xc493('0x1a')](_0x1171db['body'],{'raw':_0x1171db[_0xc493('0x6')]?_0x1171db['options'][_0xc493('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x15')]||null:null,'attributes':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0x1171db[_0xc493('0x6')]?_0x1171db[_0xc493('0x6')][_0xc493('0x9')]||null:null})[_0xc493('0xd')](function(_0x4ffba7){logger[_0xc493('0x16')](_0xc493('0x19'),_0x1171db);logger[_0xc493('0x16')](_0xc493('0x1b'),JSON[_0xc493('0x10')](_0x1171db[_0xc493('0x6')][_0xc493('0x15')]),_0x1171db[_0xc493('0x1c')][_0xc493('0x1d')]);logger['debug']('UpdateCmHopper',_0x1171db,JSON[_0xc493('0x10')](_0x4ffba7));_0x1463d9(_0x4ffba7);})[_0xc493('0x11')](function(_0x42cb6c){logger[_0xc493('0x12')](_0xc493('0x19'),_0x42cb6c[_0xc493('0x13')],_0x1171db);_0x4e4ad6(_0x2559fd['error'](0x1f4,_0x42cb6c[_0xc493('0x13')]));});});};exports[_0xc493('0x1e')]=function(_0x1f4de8){var _0x7e3988=this;return new Promise(function(_0x52a024,_0x43443e){return db[_0xc493('0x4')]['destroy']({'where':_0x1f4de8[_0xc493('0x6')]?_0x1f4de8[_0xc493('0x6')][_0xc493('0x15')]||null:null})['then'](function(_0xf710e6){logger[_0xc493('0x16')]('DestroyCmHopper',_0x1f4de8);logger[_0xc493('0xe')](_0xc493('0x1e'),_0x1f4de8,JSON['stringify'](_0xf710e6));_0x52a024(_0xf710e6);})[_0xc493('0x11')](function(_0x35c9b5){logger[_0xc493('0x12')](_0xc493('0x1e'),_0x35c9b5['message'],_0x1f4de8);_0x43443e(_0x7e3988[_0xc493('0x12')](0x1f4,_0x35c9b5[_0xc493('0x13')]));});});};exports[_0xc493('0x1f')]=function(_0x17d939){var _0x372535=this;return new Promise(function(_0xf208c4,_0x594552){return db['CmContact'][_0xc493('0x20')]()[_0xc493('0xd')](function(_0x389cee){return db['sequelize'][_0xc493('0x21')](function(_0x149dc4){return db[_0xc493('0x4')][_0xc493('0x5')]({'where':_0x17d939[_0xc493('0x6')]?_0x17d939['options'][_0xc493('0x15')]||null:null,'attributes':_0x17d939[_0xc493('0x6')]?_0x17d939[_0xc493('0x6')][_0xc493('0x8')]||null:null,'limit':_0x17d939[_0xc493('0x6')]?_0x17d939['options']['limit']||null:null,'order':_0x17d939['options']?_0x17d939[_0xc493('0x6')][_0xc493('0x22')]||null:null,'transaction':_0x149dc4,'lock':_0x149dc4[_0xc493('0x23')]['UPDATE'],'include':[{'model':db[_0xc493('0x24')],'as':_0xc493('0x25'),'attributes':_[_0xc493('0x26')](_0x389cee)},{'model':db['User'],'as':_0xc493('0x27'),'attributes':['id',_0xc493('0x28'),_0xc493('0x29')]}]})[_0xc493('0xd')](function(_0x458004){var _0x426494=[];var _0x2c58a9=[];for(var _0xeb36d4=0x0;_0xeb36d4<_0x458004['length'];_0xeb36d4+=0x1){var _0x3c0209=_0x458004[_0xeb36d4][_0xc493('0x2a')];if(_0x3c0209===null){_0x426494[_0xc493('0x2b')](_0x458004[_0xeb36d4][_0xc493('0x1a')](_0x17d939[_0xc493('0x1c')],{'transaction':_0x149dc4}));}else if(!_0x2c58a9['includes'](_0x3c0209)){_0x2c58a9[_0xc493('0x2b')](_0x3c0209);_0x426494['push'](_0x458004[_0xeb36d4][_0xc493('0x1a')](_0x17d939[_0xc493('0x1c')],{'transaction':_0x149dc4}));}}return BPromise['all'](_0x426494);});})[_0xc493('0xd')](function(_0x44cc2d){logger[_0xc493('0x16')](_0xc493('0x1f'),_0x17d939);if(_0x44cc2d[_0xc493('0x2c')]>0x0){logger[_0xc493('0x16')](_0xc493('0x2d'),_0x44cc2d[0x0]['dataValues']['id'],_0x44cc2d[0x0][_0xc493('0x2e')]['ContactId'],_0x44cc2d[0x0]['dataValues'][_0xc493('0x1d')]);}logger[_0xc493('0xe')](_0xc493('0x1f'),_0x17d939,JSON[_0xc493('0x10')](_0x44cc2d));_0xf208c4(_0x44cc2d);})[_0xc493('0x11')](function(_0x4c5ecb){logger[_0xc493('0x12')](_0xc493('0x1f'),_0x4c5ecb[_0xc493('0x13')],_0x17d939);_0x594552(_0x372535[_0xc493('0x12')](0x1f4,_0x4c5ecb[_0xc493('0x13')]));});});});};exports[_0xc493('0x2f')]=function(_0x294ddd){var _0x216a37=this;return new Promise(function(_0x9a9f12,_0x5fdf5d){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x435821){return db['CmHopperFinal'][_0xc493('0x18')](_0x294ddd['body'],{'raw':_0x294ddd[_0xc493('0x6')]?_0x294ddd[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'transaction':_0x435821})[_0xc493('0xd')](function(){logger[_0xc493('0x16')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc493('0x10')](_0x294ddd[_0xc493('0x6')][_0xc493('0x15')]),_0x294ddd[_0xc493('0x6')][_0xc493('0x15')][_0xc493('0x1d')]);return db[_0xc493('0x4')][_0xc493('0x31')]({'where':_0x294ddd[_0xc493('0x6')]?_0x294ddd['options'][_0xc493('0x15')]||null:null,'transaction':_0x435821});});})[_0xc493('0xd')](function(_0x300cd0){logger[_0xc493('0x16')]('MoveContactManagedDialer',_0x294ddd);logger[_0xc493('0xe')]('MoveContactManagedDialer',_0x294ddd,JSON['stringify'](_0x300cd0));_0x9a9f12(_0x300cd0);})[_0xc493('0x11')](function(_0x38a633){logger['error'](_0xc493('0x2f'),_0x38a633[_0xc493('0x13')],_0x294ddd);_0x5fdf5d(_0x216a37['error'](0x1f4,_0x38a633['message']));});});};exports['CountReScheduled']=function(_0xbe3753){var _0x1fc32a=this;return new Promise(function(_0x1f64b8,_0x545385){return db['CmHopper'][_0xc493('0x5')]({'raw':_0xbe3753[_0xc493('0x6')]?_0xbe3753[_0xc493('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0xbe3753[_0xc493('0x6')]?_0xbe3753[_0xc493('0x6')]['where']||null:null,'attributes':[[db[_0xc493('0x30')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc493('0x30')][_0xc493('0x32')](_0xc493('0x33')+util[_0xc493('0x34')](_0xc493('0x35'),moment()[_0xc493('0x34')](_0xc493('0x36')))+_0xc493('0x37')))),_0xc493('0x38')]]})[_0xc493('0xd')](function(_0x5095e8){logger[_0xc493('0x16')]('CountReScheduled',_0xbe3753);logger[_0xc493('0xe')]('CountReScheduled',_0xbe3753,JSON[_0xc493('0x10')](_0x5095e8));_0x1f64b8(_0x5095e8);})[_0xc493('0x11')](function(_0x5d3e9b){logger[_0xc493('0x12')](_0xc493('0x39'),_0x5d3e9b['message'],_0xbe3753);_0x545385(_0x1fc32a[_0xc493('0x12')](0x1f4,_0x5d3e9b[_0xc493('0x13')]));});});};exports[_0xc493('0x3a')]=function(_0x27744f){var _0x1010d1=this;return new Promise(function(_0x4f79b6,_0x6e3610){return db[_0xc493('0x24')][_0xc493('0x20')]()[_0xc493('0xd')](function(){return db['sequelize'][_0xc493('0x21')](function(_0x579eda){return db['CmHopper'][_0xc493('0x5')]({'where':_0x27744f[_0xc493('0x6')]?_0x27744f['options'][_0xc493('0x15')]||null:null,'attributes':_0x27744f[_0xc493('0x6')]?_0x27744f['options'][_0xc493('0x8')]||null:null,'limit':0x1,'order':_0x27744f[_0xc493('0x6')]?_0x27744f[_0xc493('0x6')][_0xc493('0x22')]||null:null,'group':db['CmHopper'][_0xc493('0x2a')],'transaction':_0x579eda,'lock':_0x579eda[_0xc493('0x23')][_0xc493('0x3b')],'include':_0x27744f['options']?_0x27744f[_0xc493('0x6')]['include']?_[_0xc493('0xc')](_0x27744f[_0xc493('0x6')][_0xc493('0xa')],function(_0x420813){return{'model':db[_0x420813[_0xc493('0xb')]],'as':_0x420813['as'],'attributes':_0x420813[_0xc493('0x8')],'include':_0x420813[_0xc493('0xa')]?_[_0xc493('0xc')](_0x420813[_0xc493('0xa')],function(_0x4322a7){return{'model':db[_0x4322a7[_0xc493('0xb')]],'as':_0x4322a7['as'],'attributes':_0x4322a7[_0xc493('0x8')],'include':_0x4322a7[_0xc493('0xa')]?_[_0xc493('0xc')](_0x4322a7['include'],function(_0x5a19f1){return{'model':db[_0x5a19f1['model']],'as':_0x5a19f1['as'],'attributes':_0x5a19f1[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xd')](function(_0x48e205){var _0x5cdde7=[];for(var _0x400e0f=0x0;_0x400e0f<_0x48e205[_0xc493('0x2c')];_0x400e0f+=0x1){_0x5cdde7[_0xc493('0x2b')](_0x48e205[_0x400e0f][_0xc493('0x1a')](_0x27744f[_0xc493('0x1c')],{'transaction':_0x579eda}));}return BPromise[_0xc493('0x3c')](_0x5cdde7);});})[_0xc493('0xd')](function(_0x416333){logger['info'](_0xc493('0x3a'),_0x27744f);logger[_0xc493('0xe')](_0xc493('0x3a'),_0x27744f,JSON['stringify'](_0x416333));_0x4f79b6(_0x416333);})['catch'](function(_0x199642){logger[_0xc493('0x12')](_0xc493('0x3a'),_0x199642[_0xc493('0x13')],_0x27744f);_0x6e3610(_0x1010d1[_0xc493('0x12')](0x1f4,_0x199642[_0xc493('0x13')]));});});});};exports[_0xc493('0x3d')]=function(_0x329107){var _0x2d4aaa=this;return new Promise(function(_0x2b1dec,_0x42cafb){db['CmContact']['describe']()['then'](function(_0x4ced15){return db[_0xc493('0x4')][_0xc493('0x5')]({'raw':_0x329107[_0xc493('0x6')]?_0x329107[_0xc493('0x6')][_0xc493('0x7')]===undefined?!![]:![]:!![],'where':_0x329107['options']?_0x329107[_0xc493('0x6')][_0xc493('0x15')]||null:null,'attributes':_0x329107[_0xc493('0x6')]?_0x329107[_0xc493('0x6')]['attributes']||null:null,'limit':_0x329107['options']?_0x329107[_0xc493('0x6')]['limit']||null:null,'include':_0x329107['options']?_0x329107[_0xc493('0x6')][_0xc493('0xa')]?_[_0xc493('0xc')](_0x329107[_0xc493('0x6')][_0xc493('0xa')],function(_0x3fcc52){return{'model':db[_0x3fcc52['model']],'as':_0x3fcc52['as'],'attributes':_0x3fcc52['as']===_0xc493('0x25')?_[_0xc493('0x26')](_0x4ced15):_0x3fcc52[_0xc493('0x8')],'include':_0x3fcc52[_0xc493('0xa')]?_[_0xc493('0xc')](_0x3fcc52[_0xc493('0xa')],function(_0x2bf1d1){return{'model':db[_0x2bf1d1[_0xc493('0xb')]],'as':_0x2bf1d1['as'],'attributes':_0x2bf1d1['attributes'],'include':_0x2bf1d1[_0xc493('0xa')]?_[_0xc493('0xc')](_0x2bf1d1['include'],function(_0x314143){return{'model':db[_0x314143[_0xc493('0xb')]],'as':_0x314143['as'],'attributes':_0x314143[_0xc493('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c41f){logger[_0xc493('0x16')]('GetCmHopper',_0x329107);logger[_0xc493('0xe')](_0xc493('0xf'),_0x329107,JSON[_0xc493('0x10')](_0x27c41f));_0x2b1dec(_0x27c41f);})[_0xc493('0x11')](function(_0x2159b5){logger[_0xc493('0x12')]('GetCmHopper',_0x2159b5[_0xc493('0x13')],_0x329107);_0x42cafb(_0x2d4aaa[_0xc493('0x12')](0x1f4,_0x2159b5[_0xc493('0x13')]));});});});};exports[_0xc493('0x3e')]=function(_0x4e85de){var _0x512b0f=this;return new Promise(function(_0x1171ae,_0xde0ad6){return db[_0xc493('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x4e85de[_0xc493('0x6')][_0xc493('0x15')][_0xc493('0x3f')]},'attributes':['id',_0xc493('0x40')],'order':[['id',_0xc493('0x41')]]})[_0xc493('0xd')](function(_0x34ebf8){logger[_0xc493('0x16')](_0xc493('0x42'),_0x4e85de);logger[_0xc493('0xe')](_0xc493('0x42'),_0x4e85de,JSON[_0xc493('0x10')](_0x34ebf8));_0x1171ae(_0x34ebf8);})[_0xc493('0x11')](function(_0x49aac5){logger[_0xc493('0x12')](_0xc493('0x42'),_0x49aac5[_0xc493('0x13')],_0x4e85de);_0xde0ad6(_0x512b0f[_0xc493('0x12')](0x1f4,_0x49aac5[_0xc493('0x13')]));});});};exports[_0xc493('0x43')]=function(_0x48f67e){var _0x558d92=this;return new Promise(function(_0x17c82d,_0x189d14){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x2f64d3){var _0x569422=_0x48f67e['options']&&_0x48f67e['options']['where']?_0x48f67e[_0xc493('0x6')][_0xc493('0x15')]:{};return db[_0xc493('0x4')][_0xc493('0x1a')](_0x48f67e[_0xc493('0x1c')],{'where':_0x569422,'transaction':_0x2f64d3})[_0xc493('0xd')](function(_0x3fa4ae){logger['info'](_0xc493('0x43'),_0x48f67e);logger[_0xc493('0xe')](_0xc493('0x43'),_0x48f67e,JSON[_0xc493('0x10')](_0x3fa4ae));_0x17c82d(_0x3fa4ae);})[_0xc493('0x11')](function(_0x416a90){logger[_0xc493('0x12')]('ResetActiveCalls',_0x416a90['message'],_0x48f67e);_0x189d14(_0x558d92['error'](0x1f4,_0x416a90[_0xc493('0x13')]));});});});};exports[_0xc493('0x44')]=function(_0x4c1c8b){var _0x3e61e8=this;var _0x3da32e=_0x4c1c8b['body'][_0xc493('0x15')][_0xc493('0x45')];var _0x426d91=_0x4c1c8b[_0xc493('0x1c')]['where'][_0xc493('0x46')];var _0x1adc01=_0x4c1c8b[_0xc493('0x1c')][_0xc493('0x15')][_0xc493('0x47')];return new Promise(function(_0x7c5963,_0x5a8dd7){return db['CmHopper'][_0xc493('0x5')]({'where':{'voiceQueueId':{'$in':_0x3da32e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc493('0x30')][_0xc493('0x32')](_0xc493('0x48')+_0x426d91+_0xc493('0x49')),'$gt':db[_0xc493('0x30')]['literal'](_0xc493('0x4a'))}},'UserId':{'$in':_0x1adc01}},'include':[{'model':db[_0xc493('0x24')],'as':_0xc493('0x25')},{'model':db[_0xc493('0x4b')],'as':_0xc493('0x27'),'attributes':['id',_0xc493('0x28'),_0xc493('0x29')]},{'model':db[_0xc493('0x4c')],'as':_0xc493('0x4d')}]})['then'](function(_0x44e05d){if(_0x44e05d[_0xc493('0x2c')]>0x0){return db[_0xc493('0x30')][_0xc493('0x21')](function(_0x1572df){return db['CmHopper'][_0xc493('0x1a')]({'recallmeNotifiedDate':db[_0xc493('0x30')][_0xc493('0x32')]('NOW()')},{'where':{'id':{'$in':_[_0xc493('0xc')](_0x44e05d,'id')}},'transaction':_0x1572df})['then'](function(){_0x7c5963(_0x44e05d);})[_0xc493('0x11')](function(_0x4ad435){logger[_0xc493('0x12')](_0xc493('0x44'),_0x4ad435['message'],_0x4c1c8b);_0x5a8dd7(_0x3e61e8['error'](0x1f4,_0x4ad435[_0xc493('0x13')]));});})[_0xc493('0x11')](function(_0x556b05){logger[_0xc493('0x12')](_0xc493('0x44'),_0x556b05[_0xc493('0x13')],_0x4c1c8b);_0x5a8dd7(_0x3e61e8[_0xc493('0x12')](0x1f4,_0x556b05[_0xc493('0x13')]));});}else{_0x7c5963(_0x44e05d);}});});}; \ No newline at end of file +var _0xf6f0=['include','model','then','info','debug','stringify','catch','error','ShowCmHopper','message','CreateCmHopper','create','body','UpdateCmHopper','update','raw','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','Contact','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xf6f0,0x132));var _0x0f6f=function(_0x240c9a,_0x100d6d){_0x240c9a=_0x240c9a-0x0;var _0xb239e9=_0xf6f0[_0x240c9a];return _0xb239e9;};'use strict';var _=require(_0x0f6f('0x0'));var util=require(_0x0f6f('0x1'));var moment=require(_0x0f6f('0x2'));var BPromise=require(_0x0f6f('0x3'));var db=require(_0x0f6f('0x4'))['db'];var logger=require('../../config/logger')(_0x0f6f('0x5'));exports[_0x0f6f('0x6')]=function(_0x7f8678){var _0x5d76fd=this;return new Promise(function(_0x326769,_0x12dede){return db[_0x0f6f('0x7')][_0x0f6f('0x8')]({'raw':_0x7f8678['options']?_0x7f8678[_0x0f6f('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x7f8678[_0x0f6f('0x9')]?_0x7f8678[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x7f8678['options']?_0x7f8678[_0x0f6f('0x9')][_0x0f6f('0xb')]||null:null,'limit':_0x7f8678['options']?_0x7f8678[_0x0f6f('0x9')][_0x0f6f('0xc')]||null:null,'include':_0x7f8678[_0x0f6f('0x9')]?_0x7f8678[_0x0f6f('0x9')]['include']?_[_0x0f6f('0xd')](_0x7f8678['options'][_0x0f6f('0xe')],function(_0x12a858){return{'model':db[_0x12a858[_0x0f6f('0xf')]],'as':_0x12a858['as'],'attributes':_0x12a858[_0x0f6f('0xb')],'include':_0x12a858['include']?_[_0x0f6f('0xd')](_0x12a858[_0x0f6f('0xe')],function(_0x50e8e5){return{'model':db[_0x50e8e5[_0x0f6f('0xf')]],'as':_0x50e8e5['as'],'attributes':_0x50e8e5[_0x0f6f('0xb')],'include':_0x50e8e5[_0x0f6f('0xe')]?_[_0x0f6f('0xd')](_0x50e8e5[_0x0f6f('0xe')],function(_0x15a67c){return{'model':db[_0x15a67c[_0x0f6f('0xf')]],'as':_0x15a67c['as'],'attributes':_0x15a67c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f6f('0x10')](function(_0x788dff){logger[_0x0f6f('0x11')](_0x0f6f('0x6'),_0x7f8678);logger[_0x0f6f('0x12')](_0x0f6f('0x6'),_0x7f8678,JSON[_0x0f6f('0x13')](_0x788dff));_0x326769(_0x788dff);})[_0x0f6f('0x14')](function(_0x3ffd08){logger['error'](_0x0f6f('0x6'),_0x3ffd08['message'],_0x7f8678);_0x12dede(_0x5d76fd[_0x0f6f('0x15')](0x1f4,_0x3ffd08['message']));});});};exports['ShowCmHopper']=function(_0x519729){var _0xd3f46=this;return new Promise(function(_0x3c8903,_0x574c49){return db[_0x0f6f('0x7')]['find']({'raw':_0x519729[_0x0f6f('0x9')]?_0x519729[_0x0f6f('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x519729[_0x0f6f('0x9')]?_0x519729[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x519729['options']?_0x519729[_0x0f6f('0x9')]['attributes']||null:null,'include':_0x519729[_0x0f6f('0x9')]?_0x519729[_0x0f6f('0x9')][_0x0f6f('0xe')]?_['map'](_0x519729['options'][_0x0f6f('0xe')],function(_0x328a20){return{'model':db[_0x328a20[_0x0f6f('0xf')]],'as':_0x328a20['as'],'attributes':_0x328a20['attributes'],'include':_0x328a20['include']?_['map'](_0x328a20[_0x0f6f('0xe')],function(_0x3763e3){return{'model':db[_0x3763e3[_0x0f6f('0xf')]],'as':_0x3763e3['as'],'attributes':_0x3763e3[_0x0f6f('0xb')],'include':_0x3763e3[_0x0f6f('0xe')]?_[_0x0f6f('0xd')](_0x3763e3[_0x0f6f('0xe')],function(_0xa6cfa6){return{'model':db[_0xa6cfa6[_0x0f6f('0xf')]],'as':_0xa6cfa6['as'],'attributes':_0xa6cfa6[_0x0f6f('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0f6f('0x10')](function(_0x5ebb2f){logger[_0x0f6f('0x11')](_0x0f6f('0x16'),_0x519729);logger[_0x0f6f('0x12')](_0x0f6f('0x16'),_0x519729,JSON[_0x0f6f('0x13')](_0x5ebb2f));_0x3c8903(_0x5ebb2f);})['catch'](function(_0x4115c7){logger['error']('ShowCmHopper',_0x4115c7[_0x0f6f('0x17')],_0x519729);_0x574c49(_0xd3f46['error'](0x1f4,_0x4115c7[_0x0f6f('0x17')]));});});};exports[_0x0f6f('0x18')]=function(_0x1a335c){var _0xd64593=this;return new Promise(function(_0x52a043,_0x1bbaec){return db[_0x0f6f('0x7')][_0x0f6f('0x19')](_0x1a335c[_0x0f6f('0x1a')],{'raw':_0x1a335c[_0x0f6f('0x9')]?_0x1a335c[_0x0f6f('0x9')]['raw']===undefined?!![]:![]:!![]})[_0x0f6f('0x10')](function(_0x40fc6c){logger['info'](_0x0f6f('0x18'),_0x1a335c);logger[_0x0f6f('0x12')](_0x0f6f('0x18'),_0x1a335c,JSON[_0x0f6f('0x13')](_0x40fc6c));_0x52a043(_0x40fc6c);})[_0x0f6f('0x14')](function(_0x5b36b4){logger[_0x0f6f('0x15')]('CreateCmHopper',_0x5b36b4[_0x0f6f('0x17')],_0x1a335c);_0x1bbaec(_0xd64593['error'](0x1f4,_0x5b36b4[_0x0f6f('0x17')]));});});};exports[_0x0f6f('0x1b')]=function(_0x1eeb97){var _0x303c67=this;return new Promise(function(_0x12106f,_0x252c6c){return db[_0x0f6f('0x7')][_0x0f6f('0x1c')](_0x1eeb97['body'],{'raw':_0x1eeb97[_0x0f6f('0x9')]?_0x1eeb97['options'][_0x0f6f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eeb97['options']?_0x1eeb97[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x1eeb97[_0x0f6f('0x9')]?_0x1eeb97[_0x0f6f('0x9')][_0x0f6f('0xb')]||null:null,'limit':_0x1eeb97[_0x0f6f('0x9')]?_0x1eeb97[_0x0f6f('0x9')]['limit']||null:null})[_0x0f6f('0x10')](function(_0xfb0e24){logger[_0x0f6f('0x11')](_0x0f6f('0x1b'),_0x1eeb97);logger[_0x0f6f('0x11')](_0x0f6f('0x1e'),JSON[_0x0f6f('0x13')](_0x1eeb97[_0x0f6f('0x9')][_0x0f6f('0xa')]),_0x1eeb97[_0x0f6f('0x1a')]['active']);logger['debug']('UpdateCmHopper',_0x1eeb97,JSON['stringify'](_0xfb0e24));_0x12106f(_0xfb0e24);})['catch'](function(_0x8ea48f){logger[_0x0f6f('0x15')]('UpdateCmHopper',_0x8ea48f[_0x0f6f('0x17')],_0x1eeb97);_0x252c6c(_0x303c67['error'](0x1f4,_0x8ea48f[_0x0f6f('0x17')]));});});};exports[_0x0f6f('0x1f')]=function(_0x46e68b){var _0x85ee3d=this;return new Promise(function(_0x5a4459,_0x2f9cd3){return db['CmHopper'][_0x0f6f('0x20')]({'where':_0x46e68b[_0x0f6f('0x9')]?_0x46e68b[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null})[_0x0f6f('0x10')](function(_0x55dc4c){logger[_0x0f6f('0x11')](_0x0f6f('0x1f'),_0x46e68b);logger[_0x0f6f('0x12')](_0x0f6f('0x1f'),_0x46e68b,JSON['stringify'](_0x55dc4c));_0x5a4459(_0x55dc4c);})[_0x0f6f('0x14')](function(_0x5da222){logger[_0x0f6f('0x15')]('DestroyCmHopper',_0x5da222['message'],_0x46e68b);_0x2f9cd3(_0x85ee3d[_0x0f6f('0x15')](0x1f4,_0x5da222['message']));});});};exports[_0x0f6f('0x21')]=function(_0x3dfda3){var _0x4c0a5e=this;return new Promise(function(_0x2157d5,_0x20d034){return db[_0x0f6f('0x22')][_0x0f6f('0x23')]()[_0x0f6f('0x10')](function(_0x5db019){return db[_0x0f6f('0x24')][_0x0f6f('0x25')](function(_0x258b35){return db['CmHopper'][_0x0f6f('0x8')]({'where':_0x3dfda3[_0x0f6f('0x9')]?_0x3dfda3[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x3dfda3[_0x0f6f('0x9')]?_0x3dfda3[_0x0f6f('0x9')][_0x0f6f('0xb')]||null:null,'limit':_0x3dfda3['options']?_0x3dfda3['options'][_0x0f6f('0xc')]||null:null,'order':_0x3dfda3['options']?_0x3dfda3[_0x0f6f('0x9')][_0x0f6f('0x26')]||null:null,'transaction':_0x258b35,'lock':_0x258b35[_0x0f6f('0x27')]['UPDATE'],'include':[{'model':db[_0x0f6f('0x22')],'as':'Contact','attributes':_[_0x0f6f('0x28')](_0x5db019)},{'model':db[_0x0f6f('0x29')],'as':_0x0f6f('0x2a'),'attributes':['id',_0x0f6f('0x2b'),'voicePause']}]})['then'](function(_0x74742a){var _0x530729=[];var _0x2fe059=[];for(var _0x1d32e9=0x0;_0x1d32e9<_0x74742a[_0x0f6f('0x2c')];_0x1d32e9+=0x1){var _0x14ad5c=_0x74742a[_0x1d32e9][_0x0f6f('0x2d')];if(_0x14ad5c===null){_0x530729[_0x0f6f('0x2e')](_0x74742a[_0x1d32e9][_0x0f6f('0x1c')](_0x3dfda3[_0x0f6f('0x1a')],{'transaction':_0x258b35}));}else if(!_0x2fe059[_0x0f6f('0x2f')](_0x14ad5c)){_0x2fe059['push'](_0x14ad5c);_0x530729[_0x0f6f('0x2e')](_0x74742a[_0x1d32e9][_0x0f6f('0x1c')](_0x3dfda3[_0x0f6f('0x1a')],{'transaction':_0x258b35}));}}return BPromise[_0x0f6f('0x30')](_0x530729);});})[_0x0f6f('0x10')](function(_0x9facf7){logger['info']('GetContactDialer',_0x3dfda3);if(_0x9facf7[_0x0f6f('0x2c')]>0x0){logger[_0x0f6f('0x11')](_0x0f6f('0x31'),_0x9facf7[0x0][_0x0f6f('0x32')]['id'],_0x9facf7[0x0][_0x0f6f('0x32')]['ContactId'],_0x9facf7[0x0][_0x0f6f('0x32')][_0x0f6f('0x33')]);}logger['debug'](_0x0f6f('0x21'),_0x3dfda3,JSON['stringify'](_0x9facf7));_0x2157d5(_0x9facf7);})[_0x0f6f('0x14')](function(_0x2ddb70){logger[_0x0f6f('0x15')]('GetContactDialer',_0x2ddb70['message'],_0x3dfda3);_0x20d034(_0x4c0a5e[_0x0f6f('0x15')](0x1f4,_0x2ddb70[_0x0f6f('0x17')]));});});});};exports[_0x0f6f('0x34')]=function(_0x132e46){var _0x483bfe=this;return new Promise(function(_0x2a6dcd,_0x1bbab6){return db[_0x0f6f('0x24')][_0x0f6f('0x25')](function(_0xd37992){return db[_0x0f6f('0x35')][_0x0f6f('0x19')](_0x132e46[_0x0f6f('0x1a')],{'raw':_0x132e46[_0x0f6f('0x9')]?_0x132e46[_0x0f6f('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0xd37992})[_0x0f6f('0x10')](function(){logger[_0x0f6f('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0f6f('0x13')](_0x132e46['options'][_0x0f6f('0xa')]),_0x132e46['options'][_0x0f6f('0xa')][_0x0f6f('0x33')]);return db[_0x0f6f('0x7')]['destroy']({'where':_0x132e46[_0x0f6f('0x9')]?_0x132e46[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'transaction':_0xd37992});});})[_0x0f6f('0x10')](function(_0x4a2a2b){logger[_0x0f6f('0x11')](_0x0f6f('0x34'),_0x132e46);logger[_0x0f6f('0x12')](_0x0f6f('0x34'),_0x132e46,JSON['stringify'](_0x4a2a2b));_0x2a6dcd(_0x4a2a2b);})[_0x0f6f('0x14')](function(_0x38ae4a){logger['error']('MoveContactManagedDialer',_0x38ae4a[_0x0f6f('0x17')],_0x132e46);_0x1bbab6(_0x483bfe['error'](0x1f4,_0x38ae4a[_0x0f6f('0x17')]));});});};exports[_0x0f6f('0x36')]=function(_0x597065){var _0x3501fe=this;return new Promise(function(_0x3ad1da,_0x3c08c3){return db['CmHopper'][_0x0f6f('0x8')]({'raw':_0x597065[_0x0f6f('0x9')]?_0x597065[_0x0f6f('0x9')][_0x0f6f('0x1d')]===undefined?!![]:![]:!![],'where':_0x597065[_0x0f6f('0x9')]?_0x597065['options']['where']||null:null,'attributes':[[db[_0x0f6f('0x24')]['fn'](_0x0f6f('0x37'),db[_0x0f6f('0x24')]['fn']('IF',db[_0x0f6f('0x24')][_0x0f6f('0x38')](_0x0f6f('0x39')+util['format'](_0x0f6f('0x3a'),moment()[_0x0f6f('0x3b')](_0x0f6f('0x3c')))+_0x0f6f('0x3d')))),_0x0f6f('0x3e')]]})[_0x0f6f('0x10')](function(_0x37532c){logger[_0x0f6f('0x11')]('CountReScheduled',_0x597065);logger['debug'](_0x0f6f('0x36'),_0x597065,JSON[_0x0f6f('0x13')](_0x37532c));_0x3ad1da(_0x37532c);})['catch'](function(_0x56dc3e){logger['error'](_0x0f6f('0x36'),_0x56dc3e[_0x0f6f('0x17')],_0x597065);_0x3c08c3(_0x3501fe['error'](0x1f4,_0x56dc3e[_0x0f6f('0x17')]));});});};exports[_0x0f6f('0x3f')]=function(_0x469fbb){var _0x2f1884=this;return new Promise(function(_0x3f8b09,_0x234da8){return db['CmContact'][_0x0f6f('0x23')]()[_0x0f6f('0x10')](function(){return db['sequelize']['transaction'](function(_0x5f21e7){return db[_0x0f6f('0x7')]['findAll']({'where':_0x469fbb[_0x0f6f('0x9')]?_0x469fbb[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x469fbb[_0x0f6f('0x9')]?_0x469fbb[_0x0f6f('0x9')][_0x0f6f('0xb')]||null:null,'limit':0x1,'order':_0x469fbb['options']?_0x469fbb['options'][_0x0f6f('0x26')]||null:null,'group':db[_0x0f6f('0x7')]['UserId'],'transaction':_0x5f21e7,'lock':_0x5f21e7[_0x0f6f('0x27')][_0x0f6f('0x40')],'include':_0x469fbb[_0x0f6f('0x9')]?_0x469fbb[_0x0f6f('0x9')][_0x0f6f('0xe')]?_[_0x0f6f('0xd')](_0x469fbb[_0x0f6f('0x9')][_0x0f6f('0xe')],function(_0x126e6e){return{'model':db[_0x126e6e[_0x0f6f('0xf')]],'as':_0x126e6e['as'],'attributes':_0x126e6e[_0x0f6f('0xb')],'include':_0x126e6e[_0x0f6f('0xe')]?_['map'](_0x126e6e[_0x0f6f('0xe')],function(_0x301341){return{'model':db[_0x301341[_0x0f6f('0xf')]],'as':_0x301341['as'],'attributes':_0x301341['attributes'],'include':_0x301341['include']?_[_0x0f6f('0xd')](_0x301341[_0x0f6f('0xe')],function(_0x17250e){return{'model':db[_0x17250e[_0x0f6f('0xf')]],'as':_0x17250e['as'],'attributes':_0x17250e[_0x0f6f('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0f6f('0x10')](function(_0x2e0695){var _0x12f8e6=[];for(var _0x341168=0x0;_0x341168<_0x2e0695[_0x0f6f('0x2c')];_0x341168+=0x1){_0x12f8e6['push'](_0x2e0695[_0x341168][_0x0f6f('0x1c')](_0x469fbb['body'],{'transaction':_0x5f21e7}));}return BPromise[_0x0f6f('0x30')](_0x12f8e6);});})[_0x0f6f('0x10')](function(_0x35cb60){logger[_0x0f6f('0x11')](_0x0f6f('0x3f'),_0x469fbb);logger[_0x0f6f('0x12')](_0x0f6f('0x3f'),_0x469fbb,JSON[_0x0f6f('0x13')](_0x35cb60));_0x3f8b09(_0x35cb60);})[_0x0f6f('0x14')](function(_0x306d9a){logger[_0x0f6f('0x15')](_0x0f6f('0x3f'),_0x306d9a[_0x0f6f('0x17')],_0x469fbb);_0x234da8(_0x2f1884[_0x0f6f('0x15')](0x1f4,_0x306d9a['message']));});});});};exports['GetCmHopperPreview']=function(_0x5b7682){var _0x4cc97f=this;return new Promise(function(_0x415b28,_0x5cab38){db['CmContact']['describe']()[_0x0f6f('0x10')](function(_0x412e31){return db['CmHopper'][_0x0f6f('0x8')]({'raw':_0x5b7682[_0x0f6f('0x9')]?_0x5b7682[_0x0f6f('0x9')][_0x0f6f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b7682[_0x0f6f('0x9')]?_0x5b7682[_0x0f6f('0x9')][_0x0f6f('0xa')]||null:null,'attributes':_0x5b7682[_0x0f6f('0x9')]?_0x5b7682[_0x0f6f('0x9')]['attributes']||null:null,'limit':_0x5b7682[_0x0f6f('0x9')]?_0x5b7682[_0x0f6f('0x9')]['limit']||null:null,'include':_0x5b7682[_0x0f6f('0x9')]?_0x5b7682[_0x0f6f('0x9')][_0x0f6f('0xe')]?_[_0x0f6f('0xd')](_0x5b7682[_0x0f6f('0x9')]['include'],function(_0x518010){return{'model':db[_0x518010[_0x0f6f('0xf')]],'as':_0x518010['as'],'attributes':_0x518010['as']===_0x0f6f('0x41')?_[_0x0f6f('0x28')](_0x412e31):_0x518010[_0x0f6f('0xb')],'include':_0x518010['include']?_[_0x0f6f('0xd')](_0x518010[_0x0f6f('0xe')],function(_0x17976f){return{'model':db[_0x17976f[_0x0f6f('0xf')]],'as':_0x17976f['as'],'attributes':_0x17976f[_0x0f6f('0xb')],'include':_0x17976f[_0x0f6f('0xe')]?_['map'](_0x17976f[_0x0f6f('0xe')],function(_0x8c8ae8){return{'model':db[_0x8c8ae8['model']],'as':_0x8c8ae8['as'],'attributes':_0x8c8ae8[_0x0f6f('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0f6f('0x10')](function(_0x15ec1f){logger[_0x0f6f('0x11')](_0x0f6f('0x6'),_0x5b7682);logger[_0x0f6f('0x12')](_0x0f6f('0x6'),_0x5b7682,JSON[_0x0f6f('0x13')](_0x15ec1f));_0x415b28(_0x15ec1f);})['catch'](function(_0x8da894){logger[_0x0f6f('0x15')](_0x0f6f('0x6'),_0x8da894[_0x0f6f('0x17')],_0x5b7682);_0x5cab38(_0x4cc97f[_0x0f6f('0x15')](0x1f4,_0x8da894[_0x0f6f('0x17')]));});});});};exports[_0x0f6f('0x42')]=function(_0x3d9232){var _0xe40c1f=this;return new Promise(function(_0x435dd3,_0x2d63a3){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x3d9232[_0x0f6f('0x9')][_0x0f6f('0xa')][_0x0f6f('0x43')]},'attributes':['id',_0x0f6f('0x44')],'order':[['id',_0x0f6f('0x45')]]})[_0x0f6f('0x10')](function(_0x33269a){logger[_0x0f6f('0x11')](_0x0f6f('0x46'),_0x3d9232);logger[_0x0f6f('0x12')](_0x0f6f('0x46'),_0x3d9232,JSON['stringify'](_0x33269a));_0x435dd3(_0x33269a);})[_0x0f6f('0x14')](function(_0x39ae53){logger[_0x0f6f('0x15')](_0x0f6f('0x46'),_0x39ae53[_0x0f6f('0x17')],_0x3d9232);_0x2d63a3(_0xe40c1f[_0x0f6f('0x15')](0x1f4,_0x39ae53[_0x0f6f('0x17')]));});});};exports['ResetActiveCalls']=function(_0x225fa6){var _0x43240e=this;return new Promise(function(_0x78860d,_0x378e94){return db['sequelize']['transaction'](function(_0x25ce00){var _0x325adf=_0x225fa6[_0x0f6f('0x9')]&&_0x225fa6[_0x0f6f('0x9')][_0x0f6f('0xa')]?_0x225fa6[_0x0f6f('0x9')]['where']:{};return db[_0x0f6f('0x7')][_0x0f6f('0x1c')](_0x225fa6[_0x0f6f('0x1a')],{'where':_0x325adf,'transaction':_0x25ce00})[_0x0f6f('0x10')](function(_0x278559){logger[_0x0f6f('0x11')]('ResetActiveCalls',_0x225fa6);logger[_0x0f6f('0x12')](_0x0f6f('0x47'),_0x225fa6,JSON[_0x0f6f('0x13')](_0x278559));_0x78860d(_0x278559);})[_0x0f6f('0x14')](function(_0x140e96){logger[_0x0f6f('0x15')](_0x0f6f('0x47'),_0x140e96[_0x0f6f('0x17')],_0x225fa6);_0x378e94(_0x43240e[_0x0f6f('0x15')](0x1f4,_0x140e96[_0x0f6f('0x17')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x57c31f){var _0x57a7cb=this;var _0x2eeb8c=_0x57c31f[_0x0f6f('0x1a')]['where'][_0x0f6f('0x48')];var _0x38e8aa=_0x57c31f['body'][_0x0f6f('0xa')]['interval'];var _0x377824=_0x57c31f[_0x0f6f('0x1a')]['where'][_0x0f6f('0x49')];return new Promise(function(_0x133a94,_0x4a7575){return db[_0x0f6f('0x7')][_0x0f6f('0x8')]({'where':{'voiceQueueId':{'$in':_0x2eeb8c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x0f6f('0x24')][_0x0f6f('0x38')](_0x0f6f('0x4a')+_0x38e8aa+_0x0f6f('0x4b')),'$gt':db['sequelize'][_0x0f6f('0x38')]('NOW()')}},'UserId':{'$in':_0x377824}},'include':[{'model':db[_0x0f6f('0x22')],'as':_0x0f6f('0x41')},{'model':db[_0x0f6f('0x29')],'as':_0x0f6f('0x2a'),'attributes':['id','name','voicePause']},{'model':db[_0x0f6f('0x4c')],'as':_0x0f6f('0x4d')}]})[_0x0f6f('0x10')](function(_0xb83d65){if(_0xb83d65[_0x0f6f('0x2c')]>0x0){return db[_0x0f6f('0x24')]['transaction'](function(_0x2c88a0){return db['CmHopper'][_0x0f6f('0x1c')]({'recallmeNotifiedDate':db[_0x0f6f('0x24')][_0x0f6f('0x38')](_0x0f6f('0x4e'))},{'where':{'id':{'$in':_[_0x0f6f('0xd')](_0xb83d65,'id')}},'transaction':_0x2c88a0})[_0x0f6f('0x10')](function(){_0x133a94(_0xb83d65);})[_0x0f6f('0x14')](function(_0x2eb5c1){logger[_0x0f6f('0x15')]('CmHopperHandlePreviewRecallNotifications',_0x2eb5c1['message'],_0x57c31f);_0x4a7575(_0x57a7cb[_0x0f6f('0x15')](0x1f4,_0x2eb5c1[_0x0f6f('0x17')]));});})[_0x0f6f('0x14')](function(_0x3c0bd8){logger[_0x0f6f('0x15')](_0x0f6f('0x4f'),_0x3c0bd8['message'],_0x57c31f);_0x4a7575(_0x57a7cb[_0x0f6f('0x15')](0x1f4,_0x3c0bd8['message']));});}else{_0x133a94(_0xb83d65);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 22c111d..363aab2 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 _0x14e4=['put','update','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview'];(function(_0x6cddd2,_0x519625){var _0x2a7212=function(_0x34a370){while(--_0x34a370){_0x6cddd2['push'](_0x6cddd2['shift']());}};_0x2a7212(++_0x519625);}(_0x14e4,0x15d));var _0x414e=function(_0xc3d3ec,_0x54cdb3){_0xc3d3ec=_0xc3d3ec-0x0;var _0x549649=_0x14e4[_0xc3d3ec];return _0x549649;};'use strict';var express=require(_0x414e('0x0'));var router=express[_0x414e('0x1')]();var auth=require(_0x414e('0x2'));var controller=require(_0x414e('0x3'));router[_0x414e('0x4')]('/',auth[_0x414e('0x5')](),controller[_0x414e('0x6')]);router[_0x414e('0x4')](_0x414e('0x7'),auth['isAuthenticated'](),controller[_0x414e('0x8')]);router[_0x414e('0x4')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x414e('0x9'),auth[_0x414e('0x5')](),controller[_0x414e('0xa')]);router[_0x414e('0x4')](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0xc')]);router[_0x414e('0x4')](_0x414e('0xd'),auth[_0x414e('0x5')](),controller[_0x414e('0xe')]);router[_0x414e('0xf')]('/',auth[_0x414e('0x5')](),controller[_0x414e('0x10')]);router[_0x414e('0xf')](_0x414e('0x11'),auth[_0x414e('0x5')](),controller[_0x414e('0x12')]);router[_0x414e('0xf')]('/timezone',auth[_0x414e('0x5')](),controller['getTimezone']);router[_0x414e('0x13')](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0x14')]);router['delete'](_0x414e('0xb'),auth[_0x414e('0x5')](),controller[_0x414e('0x15')]);module[_0x414e('0x16')]=router; \ No newline at end of file +var _0x455f=['getPreview','/timezone','delete','destroy','Router','get','index','/describe','isAuthenticated','/opencontacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview'];(function(_0x102942,_0x3a4804){var _0x333a5b=function(_0xeaa679){while(--_0xeaa679){_0x102942['push'](_0x102942['shift']());}};_0x333a5b(++_0x3a4804);}(_0x455f,0x148));var _0xf455=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x455f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xf455('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0xf455('0x1')]('/',auth['isAuthenticated'](),controller[_0xf455('0x2')]);router[_0xf455('0x1')](_0xf455('0x3'),auth[_0xf455('0x4')](),controller['describe']);router[_0xf455('0x1')](_0xf455('0x5'),auth[_0xf455('0x4')](),controller['getOpenContacts']);router[_0xf455('0x1')](_0xf455('0x6'),auth[_0xf455('0x4')](),controller[_0xf455('0x7')]);router[_0xf455('0x1')](_0xf455('0x8'),auth[_0xf455('0x4')](),controller['show']);router[_0xf455('0x1')](_0xf455('0x9'),auth[_0xf455('0x4')](),controller[_0xf455('0xa')]);router[_0xf455('0xb')]('/',auth[_0xf455('0x4')](),controller[_0xf455('0xc')]);router[_0xf455('0xb')](_0xf455('0xd'),auth[_0xf455('0x4')](),controller[_0xf455('0xe')]);router['post'](_0xf455('0xf'),auth[_0xf455('0x4')](),controller['getTimezone']);router['put'](_0xf455('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf455('0x10')](_0xf455('0x8'),auth['isAuthenticated'](),controller[_0xf455('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5bb8ee7..fcd4fed 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 _0x64bd=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x64bd,0x171));var _0xd64b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x64bd[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xd64b('0x0'));var Sequelize=require(_0xd64b('0x1'));module[_0xd64b('0x2')]={'CmHopperId':{'type':Sequelize[_0xd64b('0x3')]},'phone':{'type':Sequelize[_0xd64b('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd64b('0x5')](_0xd64b('0x6'))},'countbusyretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x526f=['INTEGER','STRING','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0x526f,0x19b));var _0xf526=function(_0x10d2de,_0x1859a5){_0x10d2de=_0x10d2de-0x0;var _0x49a47a=_0x526f[_0x10d2de];return _0x49a47a;};'use strict';var moment=require(_0xf526('0x0'));var Sequelize=require(_0xf526('0x1'));module[_0xf526('0x2')]={'CmHopperId':{'type':Sequelize[_0xf526('0x3')]},'phone':{'type':Sequelize[_0xf526('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf526('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xf526('0x5'))},'countbusyretry':{'type':Sequelize[_0xf526('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf526('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf526('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf526('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf526('0x3')],'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 7c0d77f..a7755e9 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 _0xb80d=['pick','filters','merge','VIRTUAL','filter','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','CmHopperAdditionalPhones','UserProfileResource','then','error','stack','name','index','map','CmHopperAdditionalPhone','type','key','query','keys','intersection','attributes','fields','length','model','nolimit','limit','order','sort','where'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xb80d,0x6f));var _0xdb80=function(_0x3bd7c5,_0x272ae9){_0x3bd7c5=_0x3bd7c5-0x0;var _0x423e00=_0xb80d[_0x3bd7c5];return _0x423e00;};'use strict';var emlformat=require(_0xdb80('0x0'));var rimraf=require(_0xdb80('0x1'));var zipdir=require(_0xdb80('0x2'));var jsonpatch=require(_0xdb80('0x3'));var rp=require(_0xdb80('0x4'));var moment=require(_0xdb80('0x5'));var BPromise=require(_0xdb80('0x6'));var Mustache=require(_0xdb80('0x7'));var util=require('util');var path=require(_0xdb80('0x8'));var sox=require(_0xdb80('0x9'));var csv=require(_0xdb80('0xa'));var ejs=require(_0xdb80('0xb'));var fs=require('fs');var fs_extra=require(_0xdb80('0xc'));var _=require(_0xdb80('0xd'));var squel=require(_0xdb80('0xe'));var crypto=require(_0xdb80('0xf'));var jsforce=require(_0xdb80('0x10'));var deskjs=require(_0xdb80('0x11'));var toCsv=require(_0xdb80('0xa'));var querystring=require(_0xdb80('0x12'));var Papa=require(_0xdb80('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb80('0x15'));var logger=require('../../config/logger')(_0xdb80('0x16'));var utils=require(_0xdb80('0x17'));var config=require(_0xdb80('0x18'));var licenseUtil=require(_0xdb80('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21bd3a,_0x13cff1){_0x13cff1=_0x13cff1||0xcc;return function(_0x5a44b7){if(_0x5a44b7){return _0x21bd3a[_0xdb80('0x1a')](_0x13cff1);}return _0x21bd3a[_0xdb80('0x1b')](_0x13cff1)[_0xdb80('0x1c')]();};}function respondWithResult(_0x17e4b6,_0x47a95a){_0x47a95a=_0x47a95a||0xc8;return function(_0x3a93b1){if(_0x3a93b1){return _0x17e4b6[_0xdb80('0x1b')](_0x47a95a)[_0xdb80('0x1d')](_0x3a93b1);}};}function respondWithFilteredResult(_0x235868,_0x13431c){return function(_0xc3d9d7){if(_0xc3d9d7){var _0x218c25=typeof _0x13431c[_0xdb80('0x1e')]===_0xdb80('0x1f')&&typeof _0x13431c['limit']===_0xdb80('0x1f');var _0x5bc241=_0xc3d9d7[_0xdb80('0x20')];var _0x3c45ac=_0x218c25?0x0:_0x13431c[_0xdb80('0x1e')];var _0x5c4d10=_0x218c25?_0xc3d9d7[_0xdb80('0x20')]:_0x13431c[_0xdb80('0x1e')]+_0x13431c['limit'];var _0x190a55;if(_0x5c4d10>=_0x5bc241){_0x5c4d10=_0x5bc241;_0x190a55=0xc8;}else{_0x190a55=0xce;}_0x235868['status'](_0x190a55);return _0x235868[_0xdb80('0x21')](_0xdb80('0x22'),_0x3c45ac+'-'+_0x5c4d10+'/'+_0x5bc241)[_0xdb80('0x1d')](_0xc3d9d7);}return null;};}function patchUpdates(_0x7e7af0){return function(_0x23d938){try{jsonpatch[_0xdb80('0x23')](_0x23d938,_0x7e7af0,!![]);}catch(_0x302873){return BPromise[_0xdb80('0x24')](_0x302873);}return _0x23d938[_0xdb80('0x25')]();};}function saveUpdates(_0x5c83a5,_0x169555){return function(_0x477732){if(_0x477732){return _0x477732[_0xdb80('0x26')](_0x5c83a5)['then'](function(_0x1d9348){return _0x1d9348;});}return null;};}function removeEntity(_0x3bd89c,_0x478dd1){return function(_0x4205e6){if(_0x4205e6){return _0x4205e6[_0xdb80('0x27')]()['then'](function(){var _0x460a2d=_0x4205e6['get']({'plain':!![]});var _0x16ca47=_0xdb80('0x28');return db[_0xdb80('0x29')][_0xdb80('0x27')]({'where':{'type':_0x16ca47,'resourceId':_0x460a2d['id']}})[_0xdb80('0x2a')](function(){return _0x4205e6;});})[_0xdb80('0x2a')](function(){_0x3bd89c[_0xdb80('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59787b,_0x32c01a){return function(_0x3b9c30){if(!_0x3b9c30){_0x59787b[_0xdb80('0x1a')](0x194);}return _0x3b9c30;};}function handleError(_0x5ede0d,_0x5a3fd6){_0x5a3fd6=_0x5a3fd6||0x1f4;return function(_0x3211fc){logger[_0xdb80('0x2b')](_0x3211fc[_0xdb80('0x2c')]);if(_0x3211fc['name']){delete _0x3211fc[_0xdb80('0x2d')];}_0x5ede0d['status'](_0x5a3fd6)['send'](_0x3211fc);};}exports[_0xdb80('0x2e')]=function(_0x1d2ca9,_0xf6c8b2){var _0x190725={},_0x4025ce={},_0x2ecab4={'count':0x0,'rows':[]};var _0x35a98e=_[_0xdb80('0x2f')](db[_0xdb80('0x30')]['rawAttributes'],function(_0xccca79){return{'name':_0xccca79['fieldName'],'type':_0xccca79[_0xdb80('0x31')][_0xdb80('0x32')]};});_0x4025ce['model']=_[_0xdb80('0x2f')](_0x35a98e,_0xdb80('0x2d'));_0x4025ce[_0xdb80('0x33')]=_[_0xdb80('0x34')](_0x1d2ca9[_0xdb80('0x33')]);_0x4025ce['filters']=_[_0xdb80('0x35')](_0x4025ce['model'],_0x4025ce[_0xdb80('0x33')]);_0x190725[_0xdb80('0x36')]=_[_0xdb80('0x35')](_0x4025ce['model'],qs[_0xdb80('0x37')](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x37')]));_0x190725[_0xdb80('0x36')]=_0x190725['attributes'][_0xdb80('0x38')]?_0x190725['attributes']:_0x4025ce[_0xdb80('0x39')];if(!_0x1d2ca9['query']['hasOwnProperty'](_0xdb80('0x3a'))){_0x190725['limit']=qs[_0xdb80('0x3b')](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x3b')]);_0x190725[_0xdb80('0x1e')]=qs['offset'](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x1e')]);}_0x190725[_0xdb80('0x3c')]=qs['sort'](_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x3d')]);_0x190725[_0xdb80('0x3e')]=qs['filters'](_[_0xdb80('0x3f')](_0x1d2ca9[_0xdb80('0x33')],_0x4025ce[_0xdb80('0x40')]),_0x35a98e);if(_0x1d2ca9[_0xdb80('0x33')]['filter']){_0x190725[_0xdb80('0x3e')]=_[_0xdb80('0x41')](_0x190725[_0xdb80('0x3e')],{'$or':_[_0xdb80('0x2f')](_0x35a98e,function(_0x203db2){if(_0x203db2['type']!==_0xdb80('0x42')){var _0x236b8c={};_0x236b8c[_0x203db2[_0xdb80('0x2d')]]={'$like':'%'+_0x1d2ca9[_0xdb80('0x33')][_0xdb80('0x43')]+'%'};return _0x236b8c;}})});}_0x190725=_['merge']({},_0x190725,_0x1d2ca9['options']);var _0x1860e7={'where':_0x190725['where']};return db[_0xdb80('0x30')][_0xdb80('0x20')](_0x1860e7)[_0xdb80('0x2a')](function(_0x471674){_0x2ecab4['count']=_0x471674;if(_0x1d2ca9['query']['includeAll']){_0x190725[_0xdb80('0x44')]=[{'all':!![]}];}return db[_0xdb80('0x30')]['findAll'](_0x190725);})[_0xdb80('0x2a')](function(_0x1d98e5){_0x2ecab4[_0xdb80('0x45')]=_0x1d98e5;return _0x2ecab4;})[_0xdb80('0x2a')](respondWithFilteredResult(_0xf6c8b2,_0x190725))[_0xdb80('0x46')](handleError(_0xf6c8b2,null));};exports[_0xdb80('0x47')]=function(_0xc41ed5,_0x531ba5){var _0x13060c={'raw':!![],'where':{'id':_0xc41ed5[_0xdb80('0x48')]['id']}},_0x1c1fac={};_0x1c1fac[_0xdb80('0x39')]=_['keys'](db[_0xdb80('0x30')][_0xdb80('0x49')]);_0x1c1fac[_0xdb80('0x33')]=_[_0xdb80('0x34')](_0xc41ed5[_0xdb80('0x33')]);_0x1c1fac[_0xdb80('0x40')]=_['intersection'](_0x1c1fac[_0xdb80('0x39')],_0x1c1fac[_0xdb80('0x33')]);_0x13060c[_0xdb80('0x36')]=_['intersection'](_0x1c1fac[_0xdb80('0x39')],qs[_0xdb80('0x37')](_0xc41ed5[_0xdb80('0x33')][_0xdb80('0x37')]));_0x13060c[_0xdb80('0x36')]=_0x13060c['attributes']['length']?_0x13060c[_0xdb80('0x36')]:_0x1c1fac['model'];if(_0xc41ed5[_0xdb80('0x33')][_0xdb80('0x4a')]){_0x13060c[_0xdb80('0x44')]=[{'all':!![]}];}_0x13060c=_['merge']({},_0x13060c,_0xc41ed5[_0xdb80('0x4b')]);return db[_0xdb80('0x30')][_0xdb80('0x4c')](_0x13060c)['then'](handleEntityNotFound(_0x531ba5,null))['then'](respondWithResult(_0x531ba5,null))[_0xdb80('0x46')](handleError(_0x531ba5,null));};exports[_0xdb80('0x4d')]=function(_0x1eabf7,_0x2e96a8){return db[_0xdb80('0x30')][_0xdb80('0x4d')](_0x1eabf7['body'],{})[_0xdb80('0x2a')](function(_0x561ae6){var _0x5e602c=_0x1eabf7[_0xdb80('0x4e')][_0xdb80('0x4f')]({'plain':!![]});if(!_0x5e602c)throw new Error(_0xdb80('0x50'));if(_0x5e602c[_0xdb80('0x51')]===_0xdb80('0x4e')){var _0x39e168=_0x561ae6[_0xdb80('0x4f')]({'plain':!![]});var _0x29e0ba=_0xdb80('0x28');return db[_0xdb80('0x52')][_0xdb80('0x4c')]({'where':{'name':_0x29e0ba,'userProfileId':_0x5e602c[_0xdb80('0x53')]},'raw':!![]})['then'](function(_0x46ed66){if(_0x46ed66&&_0x46ed66[_0xdb80('0x54')]===0x0){return db['UserProfileResource'][_0xdb80('0x4d')]({'name':_0x39e168['name'],'resourceId':_0x39e168['id'],'type':_0x46ed66['name'],'sectionId':_0x46ed66['id']},{})['then'](function(){return _0x561ae6;});}else{return _0x561ae6;}})[_0xdb80('0x46')](function(_0x4b960f){logger['error'](_0xdb80('0x55'),_0x4b960f);throw _0x4b960f;});}return _0x561ae6;})[_0xdb80('0x2a')](respondWithResult(_0x2e96a8,0xc9))[_0xdb80('0x46')](handleError(_0x2e96a8,null));};exports[_0xdb80('0x26')]=function(_0x126ff2,_0x2ec71b){if(_0x126ff2[_0xdb80('0x56')]['id']){delete _0x126ff2['body']['id'];}return db['CmHopperAdditionalPhone'][_0xdb80('0x4c')]({'where':{'id':_0x126ff2[_0xdb80('0x48')]['id']}})[_0xdb80('0x2a')](handleEntityNotFound(_0x2ec71b,null))[_0xdb80('0x2a')](saveUpdates(_0x126ff2[_0xdb80('0x56')],null))[_0xdb80('0x2a')](respondWithResult(_0x2ec71b,null))[_0xdb80('0x46')](handleError(_0x2ec71b,null));};exports[_0xdb80('0x27')]=function(_0x105833,_0x5b0a6a){return db[_0xdb80('0x30')][_0xdb80('0x4c')]({'where':{'id':_0x105833[_0xdb80('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0a6a,null))['then'](removeEntity(_0x5b0a6a,null))[_0xdb80('0x46')](handleError(_0x5b0a6a,null));}; \ No newline at end of file +var _0x92c2=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','CmHopperAdditionalPhone','find','create','body','role','user','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x10ee22,_0x56bd1e){var _0x213993=function(_0x5b0692){while(--_0x5b0692){_0x10ee22['push'](_0x10ee22['shift']());}};_0x213993(++_0x56bd1e);}(_0x92c2,0xe0));var _0x292c=function(_0x4e5336,_0x3b9dc3){_0x4e5336=_0x4e5336-0x0;var _0x4f32b0=_0x92c2[_0x4e5336];return _0x4f32b0;};'use strict';var emlformat=require(_0x292c('0x0'));var rimraf=require(_0x292c('0x1'));var zipdir=require(_0x292c('0x2'));var jsonpatch=require(_0x292c('0x3'));var rp=require(_0x292c('0x4'));var moment=require(_0x292c('0x5'));var BPromise=require(_0x292c('0x6'));var Mustache=require(_0x292c('0x7'));var util=require('util');var path=require(_0x292c('0x8'));var sox=require('sox');var csv=require(_0x292c('0x9'));var ejs=require(_0x292c('0xa'));var fs=require('fs');var fs_extra=require(_0x292c('0xb'));var _=require('lodash');var squel=require(_0x292c('0xc'));var crypto=require(_0x292c('0xd'));var jsforce=require(_0x292c('0xe'));var deskjs=require(_0x292c('0xf'));var toCsv=require(_0x292c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x292c('0x10'));var authService=require(_0x292c('0x11'));var qs=require(_0x292c('0x12'));var as=require(_0x292c('0x13'));var hardwareService=require(_0x292c('0x14'));var logger=require(_0x292c('0x15'))(_0x292c('0x16'));var utils=require('../../config/utils');var config=require(_0x292c('0x17'));var licenseUtil=require(_0x292c('0x18'));var db=require(_0x292c('0x19'))['db'];function respondWithStatusCode(_0x174bb3,_0x4e467f){_0x4e467f=_0x4e467f||0xcc;return function(_0x572478){if(_0x572478){return _0x174bb3[_0x292c('0x1a')](_0x4e467f);}return _0x174bb3[_0x292c('0x1b')](_0x4e467f)[_0x292c('0x1c')]();};}function respondWithResult(_0x17d0d2,_0x3d9cbb){_0x3d9cbb=_0x3d9cbb||0xc8;return function(_0x192ec0){if(_0x192ec0){return _0x17d0d2[_0x292c('0x1b')](_0x3d9cbb)['json'](_0x192ec0);}};}function respondWithFilteredResult(_0x14d788,_0x1fbc74){return function(_0x4c2d85){if(_0x4c2d85){var _0x41139c=typeof _0x1fbc74['offset']===_0x292c('0x1d')&&typeof _0x1fbc74['limit']==='undefined';var _0x48c57d=_0x4c2d85[_0x292c('0x1e')];var _0x7e93eb=_0x41139c?0x0:_0x1fbc74[_0x292c('0x1f')];var _0x5a3b21=_0x41139c?_0x4c2d85[_0x292c('0x1e')]:_0x1fbc74[_0x292c('0x1f')]+_0x1fbc74[_0x292c('0x20')];var _0x3fa86d;if(_0x5a3b21>=_0x48c57d){_0x5a3b21=_0x48c57d;_0x3fa86d=0xc8;}else{_0x3fa86d=0xce;}_0x14d788['status'](_0x3fa86d);return _0x14d788['set'](_0x292c('0x21'),_0x7e93eb+'-'+_0x5a3b21+'/'+_0x48c57d)[_0x292c('0x22')](_0x4c2d85);}return null;};}function patchUpdates(_0x5446d7){return function(_0x32d4cd){try{jsonpatch[_0x292c('0x23')](_0x32d4cd,_0x5446d7,!![]);}catch(_0x37aae7){return BPromise[_0x292c('0x24')](_0x37aae7);}return _0x32d4cd[_0x292c('0x25')]();};}function saveUpdates(_0x30e97b,_0x47e28d){return function(_0x207e78){if(_0x207e78){return _0x207e78['update'](_0x30e97b)[_0x292c('0x26')](function(_0x15f971){return _0x15f971;});}return null;};}function removeEntity(_0x2ee88f,_0x3bcf15){return function(_0x5b8da2){if(_0x5b8da2){return _0x5b8da2[_0x292c('0x27')]()[_0x292c('0x26')](function(){var _0x2c6265=_0x5b8da2[_0x292c('0x28')]({'plain':!![]});var _0x2e9404='CmHopperAdditionalPhones';return db[_0x292c('0x29')][_0x292c('0x27')]({'where':{'type':_0x2e9404,'resourceId':_0x2c6265['id']}})[_0x292c('0x26')](function(){return _0x5b8da2;});})[_0x292c('0x26')](function(){_0x2ee88f[_0x292c('0x1b')](0xcc)[_0x292c('0x1c')]();});}};}function handleEntityNotFound(_0x35a33f,_0x131bbf){return function(_0x272ea9){if(!_0x272ea9){_0x35a33f[_0x292c('0x1a')](0x194);}return _0x272ea9;};}function handleError(_0x4b91e2,_0x2afb52){_0x2afb52=_0x2afb52||0x1f4;return function(_0x903b57){logger[_0x292c('0x2a')](_0x903b57[_0x292c('0x2b')]);if(_0x903b57[_0x292c('0x2c')]){delete _0x903b57['name'];}_0x4b91e2[_0x292c('0x1b')](_0x2afb52)[_0x292c('0x2d')](_0x903b57);};}exports['index']=function(_0xa3502,_0x778341){var _0x25759f={},_0x31b553={},_0x1c773b={'count':0x0,'rows':[]};var _0x389d7b=_['map'](db['CmHopperAdditionalPhone'][_0x292c('0x2e')],function(_0x42dc4e){return{'name':_0x42dc4e[_0x292c('0x2f')],'type':_0x42dc4e['type'][_0x292c('0x30')]};});_0x31b553['model']=_[_0x292c('0x31')](_0x389d7b,_0x292c('0x2c'));_0x31b553[_0x292c('0x32')]=_[_0x292c('0x33')](_0xa3502[_0x292c('0x32')]);_0x31b553[_0x292c('0x34')]=_[_0x292c('0x35')](_0x31b553['model'],_0x31b553[_0x292c('0x32')]);_0x25759f[_0x292c('0x36')]=_['intersection'](_0x31b553[_0x292c('0x37')],qs[_0x292c('0x38')](_0xa3502[_0x292c('0x32')][_0x292c('0x38')]));_0x25759f[_0x292c('0x36')]=_0x25759f[_0x292c('0x36')][_0x292c('0x39')]?_0x25759f[_0x292c('0x36')]:_0x31b553[_0x292c('0x37')];if(!_0xa3502['query'][_0x292c('0x3a')](_0x292c('0x3b'))){_0x25759f[_0x292c('0x20')]=qs[_0x292c('0x20')](_0xa3502[_0x292c('0x32')][_0x292c('0x20')]);_0x25759f[_0x292c('0x1f')]=qs['offset'](_0xa3502[_0x292c('0x32')][_0x292c('0x1f')]);}_0x25759f['order']=qs[_0x292c('0x3c')](_0xa3502['query'][_0x292c('0x3c')]);_0x25759f['where']=qs['filters'](_[_0x292c('0x3d')](_0xa3502[_0x292c('0x32')],_0x31b553[_0x292c('0x34')]),_0x389d7b);if(_0xa3502[_0x292c('0x32')][_0x292c('0x3e')]){_0x25759f[_0x292c('0x3f')]=_[_0x292c('0x40')](_0x25759f[_0x292c('0x3f')],{'$or':_['map'](_0x389d7b,function(_0x4c5d1e){if(_0x4c5d1e[_0x292c('0x41')]!=='VIRTUAL'){var _0x5cb05a={};_0x5cb05a[_0x4c5d1e[_0x292c('0x2c')]]={'$like':'%'+_0xa3502[_0x292c('0x32')][_0x292c('0x3e')]+'%'};return _0x5cb05a;}})});}_0x25759f=_[_0x292c('0x40')]({},_0x25759f,_0xa3502[_0x292c('0x42')]);var _0x5286bd={'where':_0x25759f[_0x292c('0x3f')]};return db['CmHopperAdditionalPhone']['count'](_0x5286bd)[_0x292c('0x26')](function(_0x3d7981){_0x1c773b[_0x292c('0x1e')]=_0x3d7981;if(_0xa3502[_0x292c('0x32')][_0x292c('0x43')]){_0x25759f[_0x292c('0x44')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x25759f);})[_0x292c('0x26')](function(_0x36e59f){_0x1c773b[_0x292c('0x45')]=_0x36e59f;return _0x1c773b;})[_0x292c('0x26')](respondWithFilteredResult(_0x778341,_0x25759f))[_0x292c('0x46')](handleError(_0x778341,null));};exports[_0x292c('0x47')]=function(_0x43ab60,_0x276caa){var _0x2e4ed8={'raw':!![],'where':{'id':_0x43ab60['params']['id']}},_0x31b520={};_0x31b520[_0x292c('0x37')]=_[_0x292c('0x33')](db[_0x292c('0x48')][_0x292c('0x2e')]);_0x31b520[_0x292c('0x32')]=_['keys'](_0x43ab60['query']);_0x31b520[_0x292c('0x34')]=_[_0x292c('0x35')](_0x31b520['model'],_0x31b520[_0x292c('0x32')]);_0x2e4ed8[_0x292c('0x36')]=_[_0x292c('0x35')](_0x31b520[_0x292c('0x37')],qs['fields'](_0x43ab60[_0x292c('0x32')][_0x292c('0x38')]));_0x2e4ed8[_0x292c('0x36')]=_0x2e4ed8[_0x292c('0x36')][_0x292c('0x39')]?_0x2e4ed8[_0x292c('0x36')]:_0x31b520['model'];if(_0x43ab60[_0x292c('0x32')][_0x292c('0x43')]){_0x2e4ed8[_0x292c('0x44')]=[{'all':!![]}];}_0x2e4ed8=_[_0x292c('0x40')]({},_0x2e4ed8,_0x43ab60[_0x292c('0x42')]);return db[_0x292c('0x48')][_0x292c('0x49')](_0x2e4ed8)[_0x292c('0x26')](handleEntityNotFound(_0x276caa,null))[_0x292c('0x26')](respondWithResult(_0x276caa,null))[_0x292c('0x46')](handleError(_0x276caa,null));};exports[_0x292c('0x4a')]=function(_0x1a5504,_0x3fd294){return db[_0x292c('0x48')][_0x292c('0x4a')](_0x1a5504[_0x292c('0x4b')],{})[_0x292c('0x26')](function(_0x159953){var _0x468e24=_0x1a5504['user'][_0x292c('0x28')]({'plain':!![]});if(!_0x468e24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x468e24[_0x292c('0x4c')]===_0x292c('0x4d')){var _0x3515d7=_0x159953[_0x292c('0x28')]({'plain':!![]});var _0x531c99=_0x292c('0x4e');return db[_0x292c('0x4f')]['find']({'where':{'name':_0x531c99,'userProfileId':_0x468e24['userProfileId']},'raw':!![]})[_0x292c('0x26')](function(_0xda42bd){if(_0xda42bd&&_0xda42bd[_0x292c('0x50')]===0x0){return db[_0x292c('0x29')][_0x292c('0x4a')]({'name':_0x3515d7[_0x292c('0x2c')],'resourceId':_0x3515d7['id'],'type':_0xda42bd[_0x292c('0x2c')],'sectionId':_0xda42bd['id']},{})[_0x292c('0x26')](function(){return _0x159953;});}else{return _0x159953;}})[_0x292c('0x46')](function(_0x16db08){logger['error'](_0x292c('0x51'),_0x16db08);throw _0x16db08;});}return _0x159953;})[_0x292c('0x26')](respondWithResult(_0x3fd294,0xc9))[_0x292c('0x46')](handleError(_0x3fd294,null));};exports['update']=function(_0x4a9964,_0x1ab29a){if(_0x4a9964[_0x292c('0x4b')]['id']){delete _0x4a9964[_0x292c('0x4b')]['id'];}return db[_0x292c('0x48')][_0x292c('0x49')]({'where':{'id':_0x4a9964['params']['id']}})[_0x292c('0x26')](handleEntityNotFound(_0x1ab29a,null))[_0x292c('0x26')](saveUpdates(_0x4a9964['body'],null))[_0x292c('0x26')](respondWithResult(_0x1ab29a,null))[_0x292c('0x46')](handleError(_0x1ab29a,null));};exports[_0x292c('0x27')]=function(_0x534b44,_0x288bff){return db[_0x292c('0x48')]['find']({'where':{'id':_0x534b44['params']['id']}})['then'](handleEntityNotFound(_0x288bff,null))['then'](removeEntity(_0x288bff,null))[_0x292c('0x46')](handleError(_0x288bff,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index de1fb4f..d54c3a6 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 _0x14b9=['request-promise','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird'];(function(_0x4688f3,_0x1d5a1a){var _0x470c84=function(_0x39e953){while(--_0x39e953){_0x4688f3['push'](_0x4688f3['shift']());}};_0x470c84(++_0x1d5a1a);}(_0x14b9,0x11b));var _0x914b=function(_0x25fc6c,_0x57b6cb){_0x25fc6c=_0x25fc6c-0x0;var _0x23b59f=_0x14b9[_0x25fc6c];return _0x23b59f;};'use strict';var _=require(_0x914b('0x0'));var util=require(_0x914b('0x1'));var logger=require(_0x914b('0x2'))(_0x914b('0x3'));var moment=require('moment');var BPromise=require(_0x914b('0x4'));var rp=require(_0x914b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x914b('0x6'));var config=require('../../config/environment');var attributes=require(_0x914b('0x7'));module[_0x914b('0x8')]=function(_0x434299,_0xb7441b){return _0x434299[_0x914b('0x9')](_0x914b('0xa'),attributes,{'tableName':_0x914b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa108=['lodash','api','request-promise','path','rimraf','../../config/environment','exports','cm_hopper_additional_phones'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xa108,0x130));var _0x8a10=function(_0x2d95b2,_0x417ee8){_0x2d95b2=_0x2d95b2-0x0;var _0xae51f9=_0xa108[_0x2d95b2];return _0xae51f9;};'use strict';var _=require(_0x8a10('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8a10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a10('0x2'));var fs=require('fs');var path=require(_0x8a10('0x3'));var rimraf=require(_0x8a10('0x4'));var config=require(_0x8a10('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x8a10('0x6')]=function(_0x8cd970,_0x56d271){return _0x8cd970['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x8a10('0x7'),'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 32a93d4..04adf78 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 _0x9a2a=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countmachineretry','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','phone','sequelize','transaction','update','field','lodash'];(function(_0x37d22f,_0x4cdf96){var _0x2f79b8=function(_0x4b9ec8){while(--_0x4b9ec8){_0x37d22f['push'](_0x37d22f['shift']());}};_0x2f79b8(++_0x4cdf96);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x9a2a[_0x3b9570];return _0x28acdd;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});}exports[_0xa9a2('0x16')]=function(_0x22993f){var _0x4e3f13=this;return new Promise(function(_0x677249,_0x11ca21){return db[_0xa9a2('0x17')][_0xa9a2('0x18')]({'raw':!![],'where':{'ContactId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1a')],'ListId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1b')],'VoiceQueueId':_0x22993f[_0xa9a2('0x19')]['VoiceQueueId']===undefined?null:_0x22993f['body']['VoiceQueueId'],'CampaignId':_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1c')]===undefined?null:_0x22993f[_0xa9a2('0x19')]['CampaignId']}})[_0xa9a2('0xa')](function(_0x4ca2c4){if(_0x4ca2c4!=null){return db['CmHopperAdditionalPhone'][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ca2c4['id'],'OrderBy':{'$gt':_0x4ca2c4['OrderBy']}},'order':[[_0xa9a2('0x1d'),_0xa9a2('0x1e')]]})['then'](function(_0x377971){var _0x43a171=0x0;if(_0x377971){if(_0x377971[_0xa9a2('0x1f')]+_0x377971[_0xa9a2('0x20')]+_0x377971[_0xa9a2('0x21')]+_0x377971['countnosuchnumberretry']+_0x377971[_0xa9a2('0x22')]+_0x377971[_0xa9a2('0x23')]+_0x377971['countmachineretry']+_0x377971[_0xa9a2('0x24')]<_0x22993f[_0xa9a2('0x25')][_0xa9a2('0x26')])_0x43a171=0x1;_0x677249({'additional':_0x43a171});}else{return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ca2c4['id']},'order':[['OrderBy',_0xa9a2('0x1e')]]})['then'](function(_0x4670b8){var _0x56d01b=0x0;if(_0x4670b8){if(_0x4670b8['countbusyretry']+_0x4670b8['countcongestionretry']+_0x4670b8['countnoanswerretry']+_0x4670b8['countnosuchnumberretry']+_0x4670b8[_0xa9a2('0x22')]+_0x4670b8[_0xa9a2('0x23')]+_0x4670b8[_0xa9a2('0x28')]+_0x4670b8[_0xa9a2('0x24')]<_0x22993f[_0xa9a2('0x25')][_0xa9a2('0x26')])_0x56d01b=0x1;_0x677249({'additional':_0x56d01b});}else{_0x677249({'additional':0x0});}})[_0xa9a2('0x15')](function(_0x3c035c){logger['error'](_0xa9a2('0x16'),_0x3c035c[_0xa9a2('0x13')]);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x3c035c[_0xa9a2('0x13')]));});}})[_0xa9a2('0x15')](function(_0x33971c){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x33971c[_0xa9a2('0x13')]);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x33971c[_0xa9a2('0x13')]));});}else _0x677249({'additional':0x0});});});};exports[_0xa9a2('0x29')]=function(_0x9ca2ca){var _0x55fe73=this;return new Promise(function(_0x33a9f7,_0x40e307){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1a')],'ListId':_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1b')],'VoiceQueueId':_0x9ca2ca[_0xa9a2('0x19')]['VoiceQueueId']===undefined?null:_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x2a')],'CampaignId':_0x9ca2ca[_0xa9a2('0x19')]['CampaignId']===undefined?null:_0x9ca2ca[_0xa9a2('0x19')][_0xa9a2('0x1c')]}})[_0xa9a2('0xa')](function(_0x539881){if(_0x539881!=null){return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x539881['id'],'OrderBy':{'$gte':_0x539881[_0xa9a2('0x1d')]}},'order':[[_0xa9a2('0x1d'),_0xa9a2('0x1e')]]})[_0xa9a2('0xa')](function(_0x3e71e0){if(_0x3e71e0)return activateAdditionalPhone(_0x539881,_0x9ca2ca[_0xa9a2('0x19')],_0x3e71e0,_0x9ca2ca[_0xa9a2('0x2b')],_0x9ca2ca[_0xa9a2('0x2c')])[_0xa9a2('0xa')](function(_0x199469){_0x33a9f7(_0x199469);});else{return db[_0xa9a2('0x27')][_0xa9a2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x539881['id']},'order':[['OrderBy','ASC']]})[_0xa9a2('0xa')](function(_0x13b6fc){if(_0x13b6fc)return activateAdditionalPhone(_0x539881,_0x9ca2ca[_0xa9a2('0x19')],_0x13b6fc,_0x9ca2ca[_0xa9a2('0x2b')],_0x9ca2ca['waitTime'])[_0xa9a2('0xa')](function(_0x107e75){_0x33a9f7(_0x107e75);});else{_0x33a9f7({'id':_0x539881['id'],'phone':''});}})[_0xa9a2('0x15')](function(_0x297be3){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x297be3[_0xa9a2('0x13')]);_0x40e307(_0x55fe73[_0xa9a2('0x10')](0x1f4,_0x297be3[_0xa9a2('0x13')]));});}})['catch'](function(_0x4b515c){logger[_0xa9a2('0x10')]('VerifyAdditionalPhones',_0x4b515c[_0xa9a2('0x13')]);_0x40e307(_0x55fe73[_0xa9a2('0x10')](0x1f4,_0x4b515c[_0xa9a2('0x13')]));});}else _0x33a9f7(0x1);});});};function activateAdditionalPhone(_0xea3d02,_0xa716af,_0x12bc01,_0x455353,_0x66c4a0){return new Promise(function(_0x24b60e,_0x29f021){var _0x8ca9c7;if(_['isNil'](_0x12bc01[_0xa9a2('0x2d')])){_0x12bc01[_0xa9a2('0x2d')]=moment();}if(moment()>moment(_0x12bc01[_0xa9a2('0x2d')])){_0x8ca9c7=moment()[_0xa9a2('0x2e')](_0x66c4a0||0x3,_0xa9a2('0x2f'));}else{if(_0x12bc01[_0xa9a2('0x1d')]==0x0){_0x8ca9c7=moment(_0x12bc01[_0xa9a2('0x2d')]);}else{_0x8ca9c7=moment()[_0xa9a2('0x2e')](_0x66c4a0||0x3,_0xa9a2('0x2f'));}}if(_[_0xa9a2('0x30')](_0x8ca9c7)){_0x8ca9c7=moment()['add'](_0x66c4a0||0x3,_0xa9a2('0x2f'));}var _0x352255={'phone':_0xea3d02['phone'],'active':0x0,'OrderBy':_[_0xa9a2('0x30')](_0xea3d02[_0xa9a2('0x1d')])?0x0:_0xea3d02['OrderBy'],'scheduledat':moment()[_0xa9a2('0x2e')](_0x455353||0x1,_0xa9a2('0x2f')),'countbusyretry':_0xa716af['countbusyretry'],'countcongestionretry':_0xa716af[_0xa9a2('0x20')],'countnoanswerretry':_0xa716af['countnoanswerretry'],'countnosuchnumberretry':_0xa716af['countnosuchnumberretry'],'countdropretry':_0xa716af[_0xa9a2('0x22')],'countabandonedretry':_0xa716af[_0xa9a2('0x23')],'countmachineretry':_0xa716af[_0xa9a2('0x28')],'countagentrejectretry':_0xa716af[_0xa9a2('0x24')],'createdAt':_0xa716af[_0xa9a2('0x31')],'updatedAt':_0xa716af[_0xa9a2('0x32')]};var _0x826aa6={'CmHopperId':_0xea3d02['id'],'phone':_0x12bc01[_0xa9a2('0x33')],'active':0x0,'OrderBy':_[_0xa9a2('0x30')](_0x12bc01[_0xa9a2('0x1d')])?0x0:_0x12bc01['OrderBy'],'scheduledat':_0x8ca9c7,'countbusyretry':_0x12bc01[_0xa9a2('0x1f')],'countcongestionretry':_0x12bc01[_0xa9a2('0x20')],'countnoanswerretry':_0x12bc01['countnoanswerretry'],'countnosuchnumberretry':_0x12bc01['countnosuchnumberretry'],'countdropretry':_0x12bc01[_0xa9a2('0x22')],'countabandonedretry':_0x12bc01['countabandonedretry'],'countmachineretry':_0x12bc01['countmachineretry'],'countagentrejectretry':_0x12bc01[_0xa9a2('0x24')],'createdAt':_0x12bc01[_0xa9a2('0x31')],'updatedAt':_0x12bc01[_0xa9a2('0x32')]};return db[_0xa9a2('0x34')][_0xa9a2('0x35')](function(_0x10d7c1){return db[_0xa9a2('0x27')]['update'](_0x352255,{'where':{'id':_0x12bc01['id']}},{'transaction':_0x10d7c1})[_0xa9a2('0xa')](function(){return db[_0xa9a2('0x17')]['update'](_0x826aa6,{'where':{'id':_0xea3d02['id']}},{'transaction':_0x10d7c1});});})[_0xa9a2('0xa')](function(_0x27ec68){_0x24b60e({'id':_0xea3d02['id'],'phone':_0x12bc01['phone']});})[_0xa9a2('0x15')](function(_0x3a7fe3){logger[_0xa9a2('0x10')]('activateAdditionalPhone',_0x3a7fe3[_0xa9a2('0x13')]);_0x29f021({'error':_0x3a7fe3['message']});});});}exports['IncrementPreviewCounters']=function(_0x264368){var _0x1c3cec=this;return new Promise(function(_0x2308b7,_0x5c21df){return db[_0xa9a2('0x17')][_0xa9a2('0x36')](_0x264368[_0xa9a2('0x19')][_0xa9a2('0x37')],{'where':{'id':_0x264368['body']['id']}})[_0xa9a2('0xa')](function(_0x4c9569){_0x2308b7(_0x4c9569);})[_0xa9a2('0x15')](function(_0x134069){logger['error']('IncrementPreviewCounters',_0x134069['message']);_0x5c21df(_0x1c3cec[_0xa9a2('0x10')](0x1f4,_0x134069[_0xa9a2('0x13')]));});});}; \ No newline at end of file +var _0x7d68=['client','http','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','info','catch','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','duration','waitTime','VerifyAdditionalPhones','scheduledat','add','minutes','isNil','phone','countcongestionretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x7d68,0xa6));var _0x87d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x87d6('0x0'));var util=require(_0x87d6('0x1'));var moment=require(_0x87d6('0x2'));var BPromise=require(_0x87d6('0x3'));var rs=require(_0x87d6('0x4'));var fs=require('fs');var Redis=require(_0x87d6('0x5'));var db=require(_0x87d6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x87d6('0x7'))(_0x87d6('0x8'));var config=require(_0x87d6('0x9'));var jayson=require(_0x87d6('0xa'));var client=jayson[_0x87d6('0xb')][_0x87d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3298f3,_0x227d8,_0x4b0d8b){return new BPromise(function(_0x1e48e5,_0x202f11){return client[_0x87d6('0xd')](_0x3298f3,_0x4b0d8b)[_0x87d6('0xe')](function(_0x39616f){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x227d8,_0x87d6('0xf'));logger['debug'](_0x87d6('0x10'),_0x227d8,'request\x20sent',JSON[_0x87d6('0x11')](_0x39616f));if(_0x39616f[_0x87d6('0x12')]){if(_0x39616f[_0x87d6('0x12')][_0x87d6('0x13')]===0x1f4){logger[_0x87d6('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x227d8,_0x39616f[_0x87d6('0x12')][_0x87d6('0x14')]);return _0x202f11(_0x39616f[_0x87d6('0x12')][_0x87d6('0x14')]);}logger['error'](_0x87d6('0x15'),_0x227d8,_0x39616f[_0x87d6('0x12')][_0x87d6('0x14')]);return _0x1e48e5(_0x39616f[_0x87d6('0x12')][_0x87d6('0x14')]);}else{logger[_0x87d6('0x16')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x227d8,'request\x20sent');_0x1e48e5(_0x39616f['result'][_0x87d6('0x14')]);}})[_0x87d6('0x17')](function(_0x4b59d8){logger['error'](_0x87d6('0x15'),_0x227d8,_0x4b59d8);_0x202f11(_0x4b59d8);});});}exports['VerifyAdditionalPhones']=function(_0x32f906){var _0x5214d2=this;return new Promise(function(_0x285a28,_0x647582){return db[_0x87d6('0x18')][_0x87d6('0x19')]({'raw':!![],'where':{'ContactId':_0x32f906[_0x87d6('0x1a')][_0x87d6('0x1b')],'ListId':_0x32f906['body']['ListId'],'VoiceQueueId':_0x32f906[_0x87d6('0x1a')][_0x87d6('0x1c')]===undefined?null:_0x32f906[_0x87d6('0x1a')][_0x87d6('0x1c')],'CampaignId':_0x32f906[_0x87d6('0x1a')][_0x87d6('0x1d')]===undefined?null:_0x32f906[_0x87d6('0x1a')][_0x87d6('0x1d')]}})[_0x87d6('0xe')](function(_0xeccd70){if(_0xeccd70!=null){return db[_0x87d6('0x1e')][_0x87d6('0x19')]({'raw':!![],'where':{'CmHopperId':_0xeccd70['id'],'OrderBy':{'$gt':_0xeccd70[_0x87d6('0x1f')]}},'order':[[_0x87d6('0x1f'),_0x87d6('0x20')]]})[_0x87d6('0xe')](function(_0x7aac93){var _0x2b864c=0x0;if(_0x7aac93){if(_0x7aac93[_0x87d6('0x21')]+_0x7aac93['countcongestionretry']+_0x7aac93[_0x87d6('0x22')]+_0x7aac93[_0x87d6('0x23')]+_0x7aac93[_0x87d6('0x24')]+_0x7aac93[_0x87d6('0x25')]+_0x7aac93[_0x87d6('0x26')]+_0x7aac93[_0x87d6('0x27')]<_0x32f906[_0x87d6('0x28')][_0x87d6('0x29')])_0x2b864c=0x1;_0x285a28({'additional':_0x2b864c});}else{return db['CmHopperAdditionalPhone'][_0x87d6('0x19')]({'raw':!![],'where':{'CmHopperId':_0xeccd70['id']},'order':[[_0x87d6('0x1f'),_0x87d6('0x20')]]})[_0x87d6('0xe')](function(_0x364d0a){var _0x1b3cc2=0x0;if(_0x364d0a){if(_0x364d0a[_0x87d6('0x21')]+_0x364d0a['countcongestionretry']+_0x364d0a[_0x87d6('0x22')]+_0x364d0a['countnosuchnumberretry']+_0x364d0a[_0x87d6('0x24')]+_0x364d0a['countabandonedretry']+_0x364d0a[_0x87d6('0x26')]+_0x364d0a['countagentrejectretry']<_0x32f906[_0x87d6('0x28')]['dialGlobalMaxRetry'])_0x1b3cc2=0x1;_0x285a28({'additional':_0x1b3cc2});}else{_0x285a28({'additional':0x0});}})[_0x87d6('0x17')](function(_0x24f0b8){logger['error']('VerifyAdditionalPhones',_0x24f0b8[_0x87d6('0x14')]);_0x647582(_0x5214d2[_0x87d6('0x12')](0x1f4,_0x24f0b8[_0x87d6('0x14')]));});}})[_0x87d6('0x17')](function(_0x34b54a){logger[_0x87d6('0x12')]('VerifyAdditionalPhones',_0x34b54a[_0x87d6('0x14')]);_0x647582(_0x5214d2['error'](0x1f4,_0x34b54a[_0x87d6('0x14')]));});}else _0x285a28({'additional':0x0});});});};exports[_0x87d6('0x2a')]=function(_0x440d0b){var _0x54cbe6=this;return new Promise(function(_0x451cae,_0x55fd2f){return db[_0x87d6('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x440d0b['body']['ContactId'],'ListId':_0x440d0b[_0x87d6('0x1a')][_0x87d6('0x2b')],'VoiceQueueId':_0x440d0b[_0x87d6('0x1a')]['VoiceQueueId']===undefined?null:_0x440d0b['body']['VoiceQueueId'],'CampaignId':_0x440d0b[_0x87d6('0x1a')][_0x87d6('0x1d')]===undefined?null:_0x440d0b[_0x87d6('0x1a')]['CampaignId']}})[_0x87d6('0xe')](function(_0x20e788){if(_0x20e788!=null){return db[_0x87d6('0x1e')][_0x87d6('0x19')]({'raw':!![],'where':{'CmHopperId':_0x20e788['id'],'OrderBy':{'$gte':_0x20e788[_0x87d6('0x1f')]}},'order':[[_0x87d6('0x1f'),_0x87d6('0x20')]]})[_0x87d6('0xe')](function(_0x2e35f){if(_0x2e35f)return activateAdditionalPhone(_0x20e788,_0x440d0b[_0x87d6('0x1a')],_0x2e35f,_0x440d0b[_0x87d6('0x2c')],_0x440d0b['waitTime'])[_0x87d6('0xe')](function(_0x551f4c){_0x451cae(_0x551f4c);});else{return db['CmHopperAdditionalPhone'][_0x87d6('0x19')]({'raw':!![],'where':{'CmHopperId':_0x20e788['id']},'order':[[_0x87d6('0x1f'),'ASC']]})[_0x87d6('0xe')](function(_0x2c0ddb){if(_0x2c0ddb)return activateAdditionalPhone(_0x20e788,_0x440d0b[_0x87d6('0x1a')],_0x2c0ddb,_0x440d0b[_0x87d6('0x2c')],_0x440d0b[_0x87d6('0x2d')])['then'](function(_0x11dd70){_0x451cae(_0x11dd70);});else{_0x451cae({'id':_0x20e788['id'],'phone':''});}})[_0x87d6('0x17')](function(_0x2340f2){logger[_0x87d6('0x12')](_0x87d6('0x2e'),_0x2340f2[_0x87d6('0x14')]);_0x55fd2f(_0x54cbe6['error'](0x1f4,_0x2340f2[_0x87d6('0x14')]));});}})[_0x87d6('0x17')](function(_0x27f82c){logger['error']('VerifyAdditionalPhones',_0x27f82c['message']);_0x55fd2f(_0x54cbe6[_0x87d6('0x12')](0x1f4,_0x27f82c[_0x87d6('0x14')]));});}else _0x451cae(0x1);});});};function activateAdditionalPhone(_0x15fe23,_0x3c0aa7,_0x57ce19,_0x5360f0,_0x2396cb){return new Promise(function(_0x5012be,_0x5a371d){var _0x139496;if(_['isNil'](_0x57ce19[_0x87d6('0x2f')])){_0x57ce19[_0x87d6('0x2f')]=moment();}if(moment()>moment(_0x57ce19['scheduledat'])){_0x139496=moment()[_0x87d6('0x30')](_0x2396cb||0x3,_0x87d6('0x31'));}else{if(_0x57ce19[_0x87d6('0x1f')]==0x0){_0x139496=moment(_0x57ce19[_0x87d6('0x2f')]);}else{_0x139496=moment()['add'](_0x2396cb||0x3,_0x87d6('0x31'));}}if(_[_0x87d6('0x32')](_0x139496)){_0x139496=moment()[_0x87d6('0x30')](_0x2396cb||0x3,_0x87d6('0x31'));}var _0x4ce923={'phone':_0x15fe23[_0x87d6('0x33')],'active':0x0,'OrderBy':_[_0x87d6('0x32')](_0x15fe23[_0x87d6('0x1f')])?0x0:_0x15fe23[_0x87d6('0x1f')],'scheduledat':moment()['add'](_0x5360f0||0x1,_0x87d6('0x31')),'countbusyretry':_0x3c0aa7[_0x87d6('0x21')],'countcongestionretry':_0x3c0aa7[_0x87d6('0x34')],'countnoanswerretry':_0x3c0aa7[_0x87d6('0x22')],'countnosuchnumberretry':_0x3c0aa7['countnosuchnumberretry'],'countdropretry':_0x3c0aa7['countdropretry'],'countabandonedretry':_0x3c0aa7[_0x87d6('0x25')],'countmachineretry':_0x3c0aa7[_0x87d6('0x26')],'countagentrejectretry':_0x3c0aa7[_0x87d6('0x27')],'createdAt':_0x3c0aa7[_0x87d6('0x35')],'updatedAt':_0x3c0aa7[_0x87d6('0x36')]};var _0x35f988={'CmHopperId':_0x15fe23['id'],'phone':_0x57ce19[_0x87d6('0x33')],'active':0x0,'OrderBy':_[_0x87d6('0x32')](_0x57ce19[_0x87d6('0x1f')])?0x0:_0x57ce19['OrderBy'],'scheduledat':_0x139496,'countbusyretry':_0x57ce19[_0x87d6('0x21')],'countcongestionretry':_0x57ce19[_0x87d6('0x34')],'countnoanswerretry':_0x57ce19[_0x87d6('0x22')],'countnosuchnumberretry':_0x57ce19['countnosuchnumberretry'],'countdropretry':_0x57ce19[_0x87d6('0x24')],'countabandonedretry':_0x57ce19[_0x87d6('0x25')],'countmachineretry':_0x57ce19[_0x87d6('0x26')],'countagentrejectretry':_0x57ce19[_0x87d6('0x27')],'createdAt':_0x57ce19[_0x87d6('0x35')],'updatedAt':_0x57ce19['updatedAt']};return db[_0x87d6('0x37')]['transaction'](function(_0x594f7a){return db['CmHopperAdditionalPhone'][_0x87d6('0x38')](_0x4ce923,{'where':{'id':_0x57ce19['id']}},{'transaction':_0x594f7a})[_0x87d6('0xe')](function(){return db['CmHopper'][_0x87d6('0x38')](_0x35f988,{'where':{'id':_0x15fe23['id']}},{'transaction':_0x594f7a});});})[_0x87d6('0xe')](function(_0x377146){_0x5012be({'id':_0x15fe23['id'],'phone':_0x57ce19['phone']});})[_0x87d6('0x17')](function(_0x4708a1){logger[_0x87d6('0x12')](_0x87d6('0x39'),_0x4708a1[_0x87d6('0x14')]);_0x5a371d({'error':_0x4708a1[_0x87d6('0x14')]});});});}exports[_0x87d6('0x3a')]=function(_0x452e02){var _0x161078=this;return new Promise(function(_0x242489,_0x1cd03f){return db[_0x87d6('0x18')]['update'](_0x452e02[_0x87d6('0x1a')]['field'],{'where':{'id':_0x452e02[_0x87d6('0x1a')]['id']}})[_0x87d6('0xe')](function(_0x5a93c4){_0x242489(_0x5a93c4);})['catch'](function(_0x3e7ed8){logger[_0x87d6('0x12')](_0x87d6('0x3a'),_0x3e7ed8[_0x87d6('0x14')]);_0x1cd03f(_0x161078[_0x87d6('0x12')](0x1f4,_0x3e7ed8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ff6a168..a493e94 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 _0x570f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x196c6d,_0x43c2a){var _0x37c84a=function(_0x55ff89){while(--_0x55ff89){_0x196c6d['push'](_0x196c6d['shift']());}};_0x37c84a(++_0x43c2a);}(_0x570f,0x152));var _0xf570=function(_0x8f15dd,_0x1b132c){_0x8f15dd=_0x8f15dd-0x0;var _0x6a2868=_0x570f[_0x8f15dd];return _0x6a2868;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));var controller=require(_0xf570('0x8'));router[_0xf570('0x9')]('/',auth['isAuthenticated'](),controller[_0xf570('0xa')]);router['get'](_0xf570('0xb'),auth['isAuthenticated'](),controller[_0xf570('0xc')]);router['post']('/',auth[_0xf570('0xd')](),controller['create']);router[_0xf570('0xe')](_0xf570('0xb'),auth[_0xf570('0xd')](),controller[_0xf570('0xf')]);router[_0xf570('0x10')]('/:id',auth[_0xf570('0xd')](),controller[_0xf570('0x11')]);module[_0xf570('0x12')]=router; \ No newline at end of file +var _0x59a5=['create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post'];(function(_0x43344f,_0x4d4c59){var _0x1cdb35=function(_0x46d31d){while(--_0x46d31d){_0x43344f['push'](_0x43344f['shift']());}};_0x1cdb35(++_0x4d4c59);}(_0x59a5,0x157));var _0x559a=function(_0x59cdd9,_0x557316){_0x59cdd9=_0x59cdd9-0x0;var _0x41d6df=_0x59a5[_0x59cdd9];return _0x41d6df;};'use strict';var multer=require(_0x559a('0x0'));var util=require(_0x559a('0x1'));var path=require(_0x559a('0x2'));var timeout=require(_0x559a('0x3'));var express=require(_0x559a('0x4'));var router=express[_0x559a('0x5')]();var fs_extra=require(_0x559a('0x6'));var auth=require(_0x559a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x559a('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x559a('0x9')](),controller[_0x559a('0xa')]);router[_0x559a('0xb')](_0x559a('0xc'),auth[_0x559a('0x9')](),controller['show']);router[_0x559a('0xd')]('/',auth['isAuthenticated'](),controller[_0x559a('0xe')]);router['put'](_0x559a('0xc'),auth[_0x559a('0x9')](),controller['update']);router[_0x559a('0xf')](_0x559a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x559a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 66131ac..3043ccb 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 _0x0e5d=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0x0e5d,0x152));var _0xd0e5=function(_0x4f8d25,_0x2ce718){_0x4f8d25=_0x4f8d25-0x0;var _0x5943e5=_0x0e5d[_0x4f8d25];return _0x5943e5;};'use strict';var moment=require(_0xd0e5('0x0'));var Sequelize=require(_0xd0e5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xd0e5('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd0e5('0x3')],'unique':_0xd0e5('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd0e5('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd0e5('0x3')],'unique':_0xd0e5('0x4')}}; \ No newline at end of file +var _0x5e89=['contactListQueue','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5e89,0x19d));var _0x95e8=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5e89[_0x13b8f3];return _0x1a6d06;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x95e8('0x0')],'unique':_0x95e8('0x1')},'ListId':{'type':Sequelize[_0x95e8('0x0')],'unique':_0x95e8('0x1')},'VoiceQueueId':{'type':Sequelize[_0x95e8('0x0')],'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 dfd4497..c8226d7 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 _0x96f2=['model','query','keys','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','params','length','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','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','sendStatus','status','end','limit','count','set','json','reject','save','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key'];(function(_0x4b407a,_0x51ff40){var _0x580a75=function(_0x2dfd65){while(--_0x2dfd65){_0x4b407a['push'](_0x4b407a['shift']());}};_0x580a75(++_0x51ff40);}(_0x96f2,0xb0));var _0x296f=function(_0xbd6edf,_0x2cc5ab){_0xbd6edf=_0xbd6edf-0x0;var _0x1f12d6=_0x96f2[_0xbd6edf];return _0x1f12d6;};'use strict';var emlformat=require(_0x296f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x296f('0x1'));var jsonpatch=require(_0x296f('0x2'));var rp=require(_0x296f('0x3'));var moment=require('moment');var BPromise=require(_0x296f('0x4'));var Mustache=require(_0x296f('0x5'));var util=require(_0x296f('0x6'));var path=require('path');var sox=require(_0x296f('0x7'));var csv=require(_0x296f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x296f('0x9'));var squel=require(_0x296f('0xa'));var crypto=require(_0x296f('0xb'));var jsforce=require(_0x296f('0xc'));var deskjs=require(_0x296f('0xd'));var toCsv=require(_0x296f('0x8'));var querystring=require(_0x296f('0xe'));var Papa=require(_0x296f('0xf'));var Redis=require(_0x296f('0x10'));var authService=require(_0x296f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x296f('0x12'));var hardwareService=require(_0x296f('0x13'));var logger=require(_0x296f('0x14'))('api');var utils=require(_0x296f('0x15'));var config=require(_0x296f('0x16'));var licenseUtil=require(_0x296f('0x17'));var db=require(_0x296f('0x18'))['db'];function respondWithStatusCode(_0x5710ac,_0x4ef1e3){_0x4ef1e3=_0x4ef1e3||0xcc;return function(_0x5b8a18){if(_0x5b8a18){return _0x5710ac[_0x296f('0x19')](_0x4ef1e3);}return _0x5710ac[_0x296f('0x1a')](_0x4ef1e3)[_0x296f('0x1b')]();};}function respondWithResult(_0xe843fc,_0x550b64){_0x550b64=_0x550b64||0xc8;return function(_0xac5d0){if(_0xac5d0){return _0xe843fc['status'](_0x550b64)['json'](_0xac5d0);}};}function respondWithFilteredResult(_0x367e03,_0x2ae0f4){return function(_0x33654c){if(_0x33654c){var _0xa3d57a=typeof _0x2ae0f4['offset']==='undefined'&&typeof _0x2ae0f4[_0x296f('0x1c')]==='undefined';var _0x29f29f=_0x33654c[_0x296f('0x1d')];var _0xfc0b87=_0xa3d57a?0x0:_0x2ae0f4['offset'];var _0xcc2b48=_0xa3d57a?_0x33654c[_0x296f('0x1d')]:_0x2ae0f4['offset']+_0x2ae0f4[_0x296f('0x1c')];var _0x321646;if(_0xcc2b48>=_0x29f29f){_0xcc2b48=_0x29f29f;_0x321646=0xc8;}else{_0x321646=0xce;}_0x367e03[_0x296f('0x1a')](_0x321646);return _0x367e03[_0x296f('0x1e')]('Content-Range',_0xfc0b87+'-'+_0xcc2b48+'/'+_0x29f29f)[_0x296f('0x1f')](_0x33654c);}return null;};}function patchUpdates(_0x474721){return function(_0x54f5d8){try{jsonpatch['apply'](_0x54f5d8,_0x474721,!![]);}catch(_0x54e0de){return BPromise[_0x296f('0x20')](_0x54e0de);}return _0x54f5d8[_0x296f('0x21')]();};}function saveUpdates(_0x56cb8a,_0x2a9a1c){return function(_0x108c9b){if(_0x108c9b){return _0x108c9b[_0x296f('0x22')](_0x56cb8a)['then'](function(_0x4a1912){return _0x4a1912;});}return null;};}function removeEntity(_0x12abfb,_0x58bddc){return function(_0x54a0af){if(_0x54a0af){return _0x54a0af[_0x296f('0x23')]()['then'](function(){_0x12abfb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4c8c,_0x11e3fe){return function(_0x120482){if(!_0x120482){_0x3e4c8c[_0x296f('0x19')](0x194);}return _0x120482;};}function handleError(_0x2b8078,_0xd0aa08){_0xd0aa08=_0xd0aa08||0x1f4;return function(_0x58d8a0){logger['error'](_0x58d8a0[_0x296f('0x24')]);if(_0x58d8a0['name']){delete _0x58d8a0[_0x296f('0x25')];}_0x2b8078[_0x296f('0x1a')](_0xd0aa08)[_0x296f('0x26')](_0x58d8a0);};}exports[_0x296f('0x27')]=function(_0x345485,_0x28d624){var _0x5918eb={},_0x3e66a5={},_0x4eeb0b={'count':0x0,'rows':[]};var _0x167607=_[_0x296f('0x28')](db[_0x296f('0x29')][_0x296f('0x2a')],function(_0x3b5091){return{'name':_0x3b5091[_0x296f('0x2b')],'type':_0x3b5091[_0x296f('0x2c')][_0x296f('0x2d')]};});_0x3e66a5[_0x296f('0x2e')]=_[_0x296f('0x28')](_0x167607,_0x296f('0x25'));_0x3e66a5[_0x296f('0x2f')]=_[_0x296f('0x30')](_0x345485['query']);_0x3e66a5[_0x296f('0x31')]=_[_0x296f('0x32')](_0x3e66a5[_0x296f('0x2e')],_0x3e66a5[_0x296f('0x2f')]);_0x5918eb['attributes']=_['intersection'](_0x3e66a5['model'],qs[_0x296f('0x33')](_0x345485[_0x296f('0x2f')]['fields']));_0x5918eb[_0x296f('0x34')]=_0x5918eb[_0x296f('0x34')]['length']?_0x5918eb['attributes']:_0x3e66a5[_0x296f('0x2e')];if(!_0x345485[_0x296f('0x2f')]['hasOwnProperty'](_0x296f('0x35'))){_0x5918eb[_0x296f('0x1c')]=qs[_0x296f('0x1c')](_0x345485[_0x296f('0x2f')][_0x296f('0x1c')]);_0x5918eb[_0x296f('0x36')]=qs['offset'](_0x345485['query']['offset']);}_0x5918eb[_0x296f('0x37')]=qs['sort'](_0x345485['query'][_0x296f('0x38')]);_0x5918eb[_0x296f('0x39')]=qs[_0x296f('0x31')](_[_0x296f('0x3a')](_0x345485[_0x296f('0x2f')],_0x3e66a5[_0x296f('0x31')]),_0x167607);if(_0x345485[_0x296f('0x2f')]['filter']){_0x5918eb[_0x296f('0x39')]=_[_0x296f('0x3b')](_0x5918eb[_0x296f('0x39')],{'$or':_[_0x296f('0x28')](_0x167607,function(_0x47153f){if(_0x47153f[_0x296f('0x2c')]!==_0x296f('0x3c')){var _0x17208d={};_0x17208d[_0x47153f['name']]={'$like':'%'+_0x345485[_0x296f('0x2f')][_0x296f('0x3d')]+'%'};return _0x17208d;}})});}_0x5918eb=_['merge']({},_0x5918eb,_0x345485[_0x296f('0x3e')]);var _0x134d5d={'where':_0x5918eb['where']};return db['CmHopperBlack'][_0x296f('0x1d')](_0x134d5d)[_0x296f('0x3f')](function(_0x440813){_0x4eeb0b[_0x296f('0x1d')]=_0x440813;if(_0x345485[_0x296f('0x2f')][_0x296f('0x40')]){_0x5918eb[_0x296f('0x41')]=[{'all':!![]}];}return db[_0x296f('0x29')][_0x296f('0x42')](_0x5918eb);})['then'](function(_0x3145a4){_0x4eeb0b['rows']=_0x3145a4;return _0x4eeb0b;})[_0x296f('0x3f')](respondWithFilteredResult(_0x28d624,_0x5918eb))[_0x296f('0x43')](handleError(_0x28d624,null));};exports[_0x296f('0x44')]=function(_0x225be8,_0x57b54c){var _0xccced4={'raw':!![],'where':{'id':_0x225be8[_0x296f('0x45')]['id']}},_0x580a42={};_0x580a42['model']=_['keys'](db['CmHopperBlack'][_0x296f('0x2a')]);_0x580a42[_0x296f('0x2f')]=_[_0x296f('0x30')](_0x225be8[_0x296f('0x2f')]);_0x580a42[_0x296f('0x31')]=_[_0x296f('0x32')](_0x580a42[_0x296f('0x2e')],_0x580a42['query']);_0xccced4['attributes']=_[_0x296f('0x32')](_0x580a42['model'],qs[_0x296f('0x33')](_0x225be8[_0x296f('0x2f')][_0x296f('0x33')]));_0xccced4[_0x296f('0x34')]=_0xccced4[_0x296f('0x34')][_0x296f('0x46')]?_0xccced4[_0x296f('0x34')]:_0x580a42[_0x296f('0x2e')];if(_0x225be8['query']['includeAll']){_0xccced4[_0x296f('0x41')]=[{'all':!![]}];}_0xccced4=_[_0x296f('0x3b')]({},_0xccced4,_0x225be8[_0x296f('0x3e')]);return db[_0x296f('0x29')][_0x296f('0x47')](_0xccced4)[_0x296f('0x3f')](handleEntityNotFound(_0x57b54c,null))['then'](respondWithResult(_0x57b54c,null))['catch'](handleError(_0x57b54c,null));};exports[_0x296f('0x22')]=function(_0x3641e0,_0x4cf2b0){if(_0x3641e0['body']['id']){delete _0x3641e0[_0x296f('0x48')]['id'];}return db[_0x296f('0x29')]['find']({'where':{'id':_0x3641e0[_0x296f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cf2b0,null))['then'](saveUpdates(_0x3641e0['body'],null))[_0x296f('0x3f')](respondWithResult(_0x4cf2b0,null))[_0x296f('0x43')](handleError(_0x4cf2b0,null));};exports[_0x296f('0x23')]=function(_0x5e7ecc,_0x476992){return db[_0x296f('0x29')][_0x296f('0x47')]({'where':{'id':_0x5e7ecc['params']['id']}})[_0x296f('0x3f')](handleEntityNotFound(_0x476992,null))[_0x296f('0x3f')](removeEntity(_0x476992,null))['catch'](handleError(_0x476992,null));};exports[_0x296f('0x49')]=function(_0xd34b21,_0x5c70cc){return db[_0x296f('0x29')]['describe']()['then'](respondWithResult(_0x5c70cc,null))['catch'](handleError(_0x5c70cc,null));}; \ No newline at end of file +var _0xe81b=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map','CmHopperBlack','rawAttributes','fieldName','type','name','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','fields','include','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xe81b,0xe4));var _0xbe81=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe81b[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xbe81('0x0'));var rimraf=require(_0xbe81('0x1'));var zipdir=require(_0xbe81('0x2'));var jsonpatch=require(_0xbe81('0x3'));var rp=require(_0xbe81('0x4'));var moment=require(_0xbe81('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbe81('0x6'));var sox=require(_0xbe81('0x7'));var csv=require(_0xbe81('0x8'));var ejs=require(_0xbe81('0x9'));var fs=require('fs');var fs_extra=require(_0xbe81('0xa'));var _=require(_0xbe81('0xb'));var squel=require(_0xbe81('0xc'));var crypto=require(_0xbe81('0xd'));var jsforce=require(_0xbe81('0xe'));var deskjs=require(_0xbe81('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbe81('0x10'));var Redis=require(_0xbe81('0x11'));var authService=require(_0xbe81('0x12'));var qs=require(_0xbe81('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe81('0x14'));var logger=require(_0xbe81('0x15'))('api');var utils=require(_0xbe81('0x16'));var config=require(_0xbe81('0x17'));var licenseUtil=require(_0xbe81('0x18'));var db=require(_0xbe81('0x19'))['db'];function respondWithStatusCode(_0x1b6259,_0x1d92f6){_0x1d92f6=_0x1d92f6||0xcc;return function(_0x2059cb){if(_0x2059cb){return _0x1b6259[_0xbe81('0x1a')](_0x1d92f6);}return _0x1b6259[_0xbe81('0x1b')](_0x1d92f6)['end']();};}function respondWithResult(_0x1b4a0c,_0x59b6ab){_0x59b6ab=_0x59b6ab||0xc8;return function(_0xf30207){if(_0xf30207){return _0x1b4a0c['status'](_0x59b6ab)[_0xbe81('0x1c')](_0xf30207);}};}function respondWithFilteredResult(_0x36e263,_0x19f391){return function(_0x371591){if(_0x371591){var _0x49f2be=typeof _0x19f391[_0xbe81('0x1d')]==='undefined'&&typeof _0x19f391[_0xbe81('0x1e')]===_0xbe81('0x1f');var _0x44ac77=_0x371591[_0xbe81('0x20')];var _0x56d18f=_0x49f2be?0x0:_0x19f391[_0xbe81('0x1d')];var _0x55df5d=_0x49f2be?_0x371591[_0xbe81('0x20')]:_0x19f391['offset']+_0x19f391[_0xbe81('0x1e')];var _0x2adc1f;if(_0x55df5d>=_0x44ac77){_0x55df5d=_0x44ac77;_0x2adc1f=0xc8;}else{_0x2adc1f=0xce;}_0x36e263['status'](_0x2adc1f);return _0x36e263[_0xbe81('0x21')](_0xbe81('0x22'),_0x56d18f+'-'+_0x55df5d+'/'+_0x44ac77)[_0xbe81('0x1c')](_0x371591);}return null;};}function patchUpdates(_0x415c22){return function(_0x4bd37f){try{jsonpatch[_0xbe81('0x23')](_0x4bd37f,_0x415c22,!![]);}catch(_0x4cda12){return BPromise[_0xbe81('0x24')](_0x4cda12);}return _0x4bd37f[_0xbe81('0x25')]();};}function saveUpdates(_0x355a62,_0x49eccf){return function(_0x541369){if(_0x541369){return _0x541369[_0xbe81('0x26')](_0x355a62)[_0xbe81('0x27')](function(_0x50b2cd){return _0x50b2cd;});}return null;};}function removeEntity(_0x53f5b2,_0x1ebb18){return function(_0x4544ac){if(_0x4544ac){return _0x4544ac[_0xbe81('0x28')]()[_0xbe81('0x27')](function(){_0x53f5b2[_0xbe81('0x1b')](0xcc)[_0xbe81('0x29')]();});}};}function handleEntityNotFound(_0x15fc48,_0x2e08e7){return function(_0x1c27eb){if(!_0x1c27eb){_0x15fc48[_0xbe81('0x1a')](0x194);}return _0x1c27eb;};}function handleError(_0x111f0a,_0x3a30cd){_0x3a30cd=_0x3a30cd||0x1f4;return function(_0x187207){logger[_0xbe81('0x2a')](_0x187207[_0xbe81('0x2b')]);if(_0x187207['name']){delete _0x187207['name'];}_0x111f0a['status'](_0x3a30cd)[_0xbe81('0x2c')](_0x187207);};}exports['index']=function(_0x42cda6,_0x1e3d40){var _0x2d1819={},_0x293d3b={},_0x203d11={'count':0x0,'rows':[]};var _0x35245d=_[_0xbe81('0x2d')](db[_0xbe81('0x2e')][_0xbe81('0x2f')],function(_0x52bdf6){return{'name':_0x52bdf6[_0xbe81('0x30')],'type':_0x52bdf6[_0xbe81('0x31')]['key']};});_0x293d3b['model']=_['map'](_0x35245d,_0xbe81('0x32'));_0x293d3b[_0xbe81('0x33')]=_[_0xbe81('0x34')](_0x42cda6[_0xbe81('0x33')]);_0x293d3b[_0xbe81('0x35')]=_[_0xbe81('0x36')](_0x293d3b['model'],_0x293d3b[_0xbe81('0x33')]);_0x2d1819[_0xbe81('0x37')]=_[_0xbe81('0x36')](_0x293d3b[_0xbe81('0x38')],qs['fields'](_0x42cda6['query']['fields']));_0x2d1819['attributes']=_0x2d1819[_0xbe81('0x37')][_0xbe81('0x39')]?_0x2d1819['attributes']:_0x293d3b[_0xbe81('0x38')];if(!_0x42cda6['query'][_0xbe81('0x3a')](_0xbe81('0x3b'))){_0x2d1819[_0xbe81('0x1e')]=qs['limit'](_0x42cda6[_0xbe81('0x33')][_0xbe81('0x1e')]);_0x2d1819[_0xbe81('0x1d')]=qs[_0xbe81('0x1d')](_0x42cda6[_0xbe81('0x33')]['offset']);}_0x2d1819[_0xbe81('0x3c')]=qs[_0xbe81('0x3d')](_0x42cda6['query'][_0xbe81('0x3d')]);_0x2d1819[_0xbe81('0x3e')]=qs[_0xbe81('0x35')](_[_0xbe81('0x3f')](_0x42cda6[_0xbe81('0x33')],_0x293d3b[_0xbe81('0x35')]),_0x35245d);if(_0x42cda6[_0xbe81('0x33')]['filter']){_0x2d1819[_0xbe81('0x3e')]=_[_0xbe81('0x40')](_0x2d1819['where'],{'$or':_[_0xbe81('0x2d')](_0x35245d,function(_0x5480c6){if(_0x5480c6[_0xbe81('0x31')]!=='VIRTUAL'){var _0xbc5273={};_0xbc5273[_0x5480c6[_0xbe81('0x32')]]={'$like':'%'+_0x42cda6[_0xbe81('0x33')][_0xbe81('0x41')]+'%'};return _0xbc5273;}})});}_0x2d1819=_[_0xbe81('0x40')]({},_0x2d1819,_0x42cda6[_0xbe81('0x42')]);var _0x507687={'where':_0x2d1819[_0xbe81('0x3e')]};return db['CmHopperBlack'][_0xbe81('0x20')](_0x507687)[_0xbe81('0x27')](function(_0x4fd114){_0x203d11[_0xbe81('0x20')]=_0x4fd114;if(_0x42cda6['query'][_0xbe81('0x43')]){_0x2d1819['include']=[{'all':!![]}];}return db[_0xbe81('0x2e')][_0xbe81('0x44')](_0x2d1819);})['then'](function(_0x2ad50c){_0x203d11[_0xbe81('0x45')]=_0x2ad50c;return _0x203d11;})['then'](respondWithFilteredResult(_0x1e3d40,_0x2d1819))['catch'](handleError(_0x1e3d40,null));};exports[_0xbe81('0x46')]=function(_0x35fd23,_0x45ce07){var _0x1c1987={'raw':!![],'where':{'id':_0x35fd23[_0xbe81('0x47')]['id']}},_0x40581b={};_0x40581b[_0xbe81('0x38')]=_[_0xbe81('0x34')](db[_0xbe81('0x2e')][_0xbe81('0x2f')]);_0x40581b[_0xbe81('0x33')]=_[_0xbe81('0x34')](_0x35fd23[_0xbe81('0x33')]);_0x40581b[_0xbe81('0x35')]=_[_0xbe81('0x36')](_0x40581b['model'],_0x40581b[_0xbe81('0x33')]);_0x1c1987['attributes']=_[_0xbe81('0x36')](_0x40581b[_0xbe81('0x38')],qs[_0xbe81('0x48')](_0x35fd23[_0xbe81('0x33')][_0xbe81('0x48')]));_0x1c1987[_0xbe81('0x37')]=_0x1c1987[_0xbe81('0x37')][_0xbe81('0x39')]?_0x1c1987[_0xbe81('0x37')]:_0x40581b[_0xbe81('0x38')];if(_0x35fd23['query'][_0xbe81('0x43')]){_0x1c1987[_0xbe81('0x49')]=[{'all':!![]}];}_0x1c1987=_[_0xbe81('0x40')]({},_0x1c1987,_0x35fd23[_0xbe81('0x42')]);return db['CmHopperBlack']['find'](_0x1c1987)[_0xbe81('0x27')](handleEntityNotFound(_0x45ce07,null))[_0xbe81('0x27')](respondWithResult(_0x45ce07,null))[_0xbe81('0x4a')](handleError(_0x45ce07,null));};exports[_0xbe81('0x26')]=function(_0x25ae2e,_0x5e4783){if(_0x25ae2e[_0xbe81('0x4b')]['id']){delete _0x25ae2e[_0xbe81('0x4b')]['id'];}return db[_0xbe81('0x2e')]['find']({'where':{'id':_0x25ae2e[_0xbe81('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e4783,null))[_0xbe81('0x27')](saveUpdates(_0x25ae2e['body'],null))[_0xbe81('0x27')](respondWithResult(_0x5e4783,null))[_0xbe81('0x4a')](handleError(_0x5e4783,null));};exports[_0xbe81('0x28')]=function(_0x5d4c80,_0x59ed0f){return db[_0xbe81('0x2e')][_0xbe81('0x4c')]({'where':{'id':_0x5d4c80['params']['id']}})['then'](handleEntityNotFound(_0x59ed0f,null))[_0xbe81('0x27')](removeEntity(_0x59ed0f,null))['catch'](handleError(_0x59ed0f,null));};exports['describe']=function(_0x498e6b,_0x41c72f){return db['CmHopperBlack'][_0xbe81('0x4d')]()[_0xbe81('0x27')](respondWithResult(_0x41c72f,null))[_0xbe81('0x4a')](handleError(_0x41c72f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5f2f741..d8abc91 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 _0x6990=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b6f60,_0x5c33b4){var _0xac0557=function(_0x44b2f2){while(--_0x44b2f2){_0x3b6f60['push'](_0x3b6f60['shift']());}};_0xac0557(++_0x5c33b4);}(_0x6990,0x1e6));var _0x0699=function(_0x521ee4,_0x111563){_0x521ee4=_0x521ee4-0x0;var _0x4aaea8=_0x6990[_0x521ee4];return _0x4aaea8;};'use strict';var _=require('lodash');var util=require(_0x0699('0x0'));var logger=require(_0x0699('0x1'))(_0x0699('0x2'));var moment=require(_0x0699('0x3'));var BPromise=require(_0x0699('0x4'));var rp=require(_0x0699('0x5'));var fs=require('fs');var path=require(_0x0699('0x6'));var rimraf=require(_0x0699('0x7'));var config=require(_0x0699('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x0699('0x9')]=function(_0x3d2717,_0x177e50){return _0x3d2717[_0x0699('0xa')](_0x0699('0xb'),attributes,{'tableName':_0x0699('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebd8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','lodash'];(function(_0x2403f1,_0x577614){var _0x13c031=function(_0xdfb72f){while(--_0xdfb72f){_0x2403f1['push'](_0x2403f1['shift']());}};_0x13c031(++_0x577614);}(_0xebd8,0x167));var _0x8ebd=function(_0x163f3d,_0x51a691){_0x163f3d=_0x163f3d-0x0;var _0x422ec9=_0xebd8[_0x163f3d];return _0x422ec9;};'use strict';var _=require(_0x8ebd('0x0'));var util=require(_0x8ebd('0x1'));var logger=require(_0x8ebd('0x2'))(_0x8ebd('0x3'));var moment=require('moment');var BPromise=require(_0x8ebd('0x4'));var rp=require(_0x8ebd('0x5'));var fs=require('fs');var path=require(_0x8ebd('0x6'));var rimraf=require(_0x8ebd('0x7'));var config=require(_0x8ebd('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x8ebd('0x9')]=function(_0xf75ba7,_0x454355){return _0xf75ba7[_0x8ebd('0xa')](_0x8ebd('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2985ad4..7a38fcb 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 _0x353b=['options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','catch','DestroyCmHopperBlack','CmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetCmHopperBlack'];(function(_0x351b5c,_0x10b470){var _0x335606=function(_0x4528de){while(--_0x4528de){_0x351b5c['push'](_0x351b5c['shift']());}};_0x335606(++_0x10b470);}(_0x353b,0x1af));var _0xb353=function(_0x582e18,_0x4fd856){_0x582e18=_0x582e18-0x0;var _0x445d03=_0x353b[_0x582e18];return _0x445d03;};'use strict';var _=require(_0xb353('0x0'));var util=require(_0xb353('0x1'));var moment=require(_0xb353('0x2'));var BPromise=require(_0xb353('0x3'));var rs=require(_0xb353('0x4'));var fs=require('fs');var Redis=require(_0xb353('0x5'));var db=require(_0xb353('0x6'))['db'];var utils=require(_0xb353('0x7'));var logger=require(_0xb353('0x8'))(_0xb353('0x9'));var config=require(_0xb353('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb353('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4711e6,_0x4269bb,_0xf2fa87){return new BPromise(function(_0x10b068,_0x79281f){return client[_0xb353('0xc')](_0x4711e6,_0xf2fa87)[_0xb353('0xd')](function(_0x5048de){logger['info'](_0xb353('0xe'),_0x4269bb,_0xb353('0xf'));logger[_0xb353('0x10')](_0xb353('0x11'),_0x4269bb,_0xb353('0xf'),JSON[_0xb353('0x12')](_0x5048de));if(_0x5048de[_0xb353('0x13')]){if(_0x5048de[_0xb353('0x13')][_0xb353('0x14')]===0x1f4){logger['error'](_0xb353('0xe'),_0x4269bb,_0x5048de[_0xb353('0x13')][_0xb353('0x15')]);return _0x79281f(_0x5048de['error'][_0xb353('0x15')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4269bb,_0x5048de[_0xb353('0x13')]['message']);return _0x10b068(_0x5048de[_0xb353('0x13')][_0xb353('0x15')]);}else{logger[_0xb353('0x16')](_0xb353('0xe'),_0x4269bb,'request\x20sent');_0x10b068(_0x5048de[_0xb353('0x17')][_0xb353('0x15')]);}})['catch'](function(_0x110bfe){logger['error'](_0xb353('0xe'),_0x4269bb,_0x110bfe);_0x79281f(_0x110bfe);});});}exports[_0xb353('0x18')]=function(_0x2c1497){var _0x33a9be=this;return new Promise(function(_0x4b7f33,_0x2d578d){return db['CmHopperBlack']['findAll']({'raw':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')][_0xb353('0x1a')]||null:null,'attributes':_0x2c1497[_0xb353('0x19')]?_0x2c1497[_0xb353('0x19')][_0xb353('0x1b')]||null:null,'limit':_0x2c1497['options']?_0x2c1497[_0xb353('0x19')][_0xb353('0x1c')]||null:null,'include':_0x2c1497['options']?_0x2c1497[_0xb353('0x19')][_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x2c1497[_0xb353('0x19')][_0xb353('0x1d')],function(_0x47ab81){return{'model':db[_0x47ab81[_0xb353('0x1f')]],'as':_0x47ab81['as'],'attributes':_0x47ab81['attributes'],'include':_0x47ab81[_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x47ab81[_0xb353('0x1d')],function(_0x25d900){return{'model':db[_0x25d900[_0xb353('0x1f')]],'as':_0x25d900['as'],'attributes':_0x25d900['attributes'],'include':_0x25d900[_0xb353('0x1d')]?_[_0xb353('0x1e')](_0x25d900['include'],function(_0x2aae0e){return{'model':db[_0x2aae0e[_0xb353('0x1f')]],'as':_0x2aae0e['as'],'attributes':_0x2aae0e[_0xb353('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb353('0xd')](function(_0x4eb40a){logger['info'](_0xb353('0x18'),_0x2c1497);logger['debug']('GetCmHopperBlack',_0x2c1497,JSON[_0xb353('0x12')](_0x4eb40a));_0x4b7f33(_0x4eb40a);})['catch'](function(_0x2b9d62){logger[_0xb353('0x13')](_0xb353('0x18'),_0x2b9d62['message'],_0x2c1497);_0x2d578d(_0x33a9be[_0xb353('0x13')](0x1f4,_0x2b9d62[_0xb353('0x15')]));});});};exports[_0xb353('0x20')]=function(_0x18bd30){var _0x230761=this;return new Promise(function(_0x45ac61,_0xbced01){return db['CmHopperBlack'][_0xb353('0x21')](_0x18bd30['body'],{'raw':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')]['where']||null:null,'attributes':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x1b')]||null:null,'limit':_0x18bd30[_0xb353('0x19')]?_0x18bd30[_0xb353('0x19')][_0xb353('0x1c')]||null:null})[_0xb353('0xd')](function(_0x45b4e9){logger[_0xb353('0x16')](_0xb353('0x20'),_0x18bd30);logger[_0xb353('0x10')](_0xb353('0x20'),_0x18bd30,JSON[_0xb353('0x12')](_0x45b4e9));_0x45ac61(_0x45b4e9);})[_0xb353('0x23')](function(_0x4224d9){logger[_0xb353('0x13')](_0xb353('0x20'),_0x4224d9['message'],_0x18bd30);_0xbced01(_0x230761['error'](0x1f4,_0x4224d9[_0xb353('0x15')]));});});};exports[_0xb353('0x24')]=function(_0x5bb660){var _0x370964=this;return new Promise(function(_0xf82637,_0x3aefb3){return db[_0xb353('0x25')]['destroy']({'where':_0x5bb660['options']?_0x5bb660[_0xb353('0x19')]['where']||null:null})[_0xb353('0xd')](function(_0x4d4822){logger['info']('DestroyCmHopperBlack',_0x5bb660);logger[_0xb353('0x10')](_0xb353('0x24'),_0x5bb660,JSON[_0xb353('0x12')](_0x4d4822));_0xf82637(_0x4d4822);})['catch'](function(_0x8ca34){logger[_0xb353('0x13')](_0xb353('0x24'),_0x8ca34[_0xb353('0x15')],_0x5bb660);_0x3aefb3(_0x370964[_0xb353('0x13')](0x1f4,_0x8ca34[_0xb353('0x15')]));});});}; \ No newline at end of file +var _0x8c1b=['DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','stringify','update','body','UpdateCmHopperBlack'];(function(_0x5d85de,_0x2a351f){var _0x1b8416=function(_0x4e3899){while(--_0x4e3899){_0x5d85de['push'](_0x5d85de['shift']());}};_0x1b8416(++_0x2a351f);}(_0x8c1b,0xb0));var _0xb8c1=function(_0x333815,_0xbdc4bf){_0x333815=_0x333815-0x0;var _0x13aad4=_0x8c1b[_0x333815];return _0x13aad4;};'use strict';var _=require('lodash');var util=require(_0xb8c1('0x0'));var moment=require(_0xb8c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8c1('0x2'));var fs=require('fs');var Redis=require(_0xb8c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8c1('0x4'))(_0xb8c1('0x5'));var config=require(_0xb8c1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb8c1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x128fa4,_0x58e13b,_0xd765dc){return new BPromise(function(_0x2dce21,_0x5af096){return client[_0xb8c1('0x8')](_0x128fa4,_0xd765dc)[_0xb8c1('0x9')](function(_0x11002a){logger[_0xb8c1('0xa')](_0xb8c1('0xb'),_0x58e13b,_0xb8c1('0xc'));logger[_0xb8c1('0xd')](_0xb8c1('0xe'),_0x58e13b,_0xb8c1('0xc'),JSON['stringify'](_0x11002a));if(_0x11002a[_0xb8c1('0xf')]){if(_0x11002a[_0xb8c1('0xf')][_0xb8c1('0x10')]===0x1f4){logger[_0xb8c1('0xf')](_0xb8c1('0xb'),_0x58e13b,_0x11002a[_0xb8c1('0xf')][_0xb8c1('0x11')]);return _0x5af096(_0x11002a[_0xb8c1('0xf')][_0xb8c1('0x11')]);}logger[_0xb8c1('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x58e13b,_0x11002a['error'][_0xb8c1('0x11')]);return _0x2dce21(_0x11002a['error'][_0xb8c1('0x11')]);}else{logger['info'](_0xb8c1('0xb'),_0x58e13b,_0xb8c1('0xc'));_0x2dce21(_0x11002a[_0xb8c1('0x12')][_0xb8c1('0x11')]);}})[_0xb8c1('0x13')](function(_0x5b3b7b){logger['error'](_0xb8c1('0xb'),_0x58e13b,_0x5b3b7b);_0x5af096(_0x5b3b7b);});});}exports[_0xb8c1('0x14')]=function(_0x1c3b05){var _0x1fe5d0=this;return new Promise(function(_0x3b0266,_0x2bcc4a){return db[_0xb8c1('0x15')][_0xb8c1('0x16')]({'raw':_0x1c3b05[_0xb8c1('0x17')]?_0x1c3b05[_0xb8c1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c3b05[_0xb8c1('0x17')]?_0x1c3b05['options'][_0xb8c1('0x18')]||null:null,'attributes':_0x1c3b05[_0xb8c1('0x17')]?_0x1c3b05['options'][_0xb8c1('0x19')]||null:null,'limit':_0x1c3b05[_0xb8c1('0x17')]?_0x1c3b05[_0xb8c1('0x17')][_0xb8c1('0x1a')]||null:null,'include':_0x1c3b05[_0xb8c1('0x17')]?_0x1c3b05[_0xb8c1('0x17')][_0xb8c1('0x1b')]?_[_0xb8c1('0x1c')](_0x1c3b05[_0xb8c1('0x17')][_0xb8c1('0x1b')],function(_0x14f83a){return{'model':db[_0x14f83a[_0xb8c1('0x1d')]],'as':_0x14f83a['as'],'attributes':_0x14f83a[_0xb8c1('0x19')],'include':_0x14f83a[_0xb8c1('0x1b')]?_['map'](_0x14f83a[_0xb8c1('0x1b')],function(_0x1c5bb7){return{'model':db[_0x1c5bb7['model']],'as':_0x1c5bb7['as'],'attributes':_0x1c5bb7['attributes'],'include':_0x1c5bb7[_0xb8c1('0x1b')]?_['map'](_0x1c5bb7[_0xb8c1('0x1b')],function(_0x15474f){return{'model':db[_0x15474f['model']],'as':_0x15474f['as'],'attributes':_0x15474f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8c1('0x9')](function(_0x2307ac){logger['info']('GetCmHopperBlack',_0x1c3b05);logger['debug'](_0xb8c1('0x14'),_0x1c3b05,JSON[_0xb8c1('0x1e')](_0x2307ac));_0x3b0266(_0x2307ac);})['catch'](function(_0x559b63){logger['error'](_0xb8c1('0x14'),_0x559b63[_0xb8c1('0x11')],_0x1c3b05);_0x2bcc4a(_0x1fe5d0[_0xb8c1('0xf')](0x1f4,_0x559b63['message']));});});};exports['UpdateCmHopperBlack']=function(_0x33ec0c){var _0x27ae00=this;return new Promise(function(_0x29848e,_0xa1d3d3){return db['CmHopperBlack'][_0xb8c1('0x1f')](_0x33ec0c[_0xb8c1('0x20')],{'raw':_0x33ec0c[_0xb8c1('0x17')]?_0x33ec0c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ec0c[_0xb8c1('0x17')]?_0x33ec0c['options']['where']||null:null,'attributes':_0x33ec0c[_0xb8c1('0x17')]?_0x33ec0c[_0xb8c1('0x17')][_0xb8c1('0x19')]||null:null,'limit':_0x33ec0c[_0xb8c1('0x17')]?_0x33ec0c['options'][_0xb8c1('0x1a')]||null:null})[_0xb8c1('0x9')](function(_0x208ae1){logger[_0xb8c1('0xa')](_0xb8c1('0x21'),_0x33ec0c);logger[_0xb8c1('0xd')](_0xb8c1('0x21'),_0x33ec0c,JSON[_0xb8c1('0x1e')](_0x208ae1));_0x29848e(_0x208ae1);})['catch'](function(_0x4ae3f6){logger[_0xb8c1('0xf')](_0xb8c1('0x21'),_0x4ae3f6['message'],_0x33ec0c);_0xa1d3d3(_0x27ae00[_0xb8c1('0xf')](0x1f4,_0x4ae3f6[_0xb8c1('0x11')]));});});};exports[_0xb8c1('0x22')]=function(_0x576a06){var _0x2aca6c=this;return new Promise(function(_0xc065f5,_0x3e6187){return db[_0xb8c1('0x15')]['destroy']({'where':_0x576a06[_0xb8c1('0x17')]?_0x576a06[_0xb8c1('0x17')]['where']||null:null})[_0xb8c1('0x9')](function(_0x39e608){logger[_0xb8c1('0xa')](_0xb8c1('0x22'),_0x576a06);logger[_0xb8c1('0xd')](_0xb8c1('0x22'),_0x576a06,JSON[_0xb8c1('0x1e')](_0x39e608));_0xc065f5(_0x39e608);})[_0xb8c1('0x13')](function(_0x57cb4a){logger[_0xb8c1('0xf')](_0xb8c1('0x22'),_0x57cb4a[_0xb8c1('0x11')],_0x576a06);_0x3e6187(_0x2aca6c[_0xb8c1('0xf')](0x1f4,_0x57cb4a[_0xb8c1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6be8e19..1ec041e 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 _0x3831=['get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x3e5d3c,_0x3894e0){var _0x4e1c5e=function(_0x2f370d){while(--_0x2f370d){_0x3e5d3c['push'](_0x3e5d3c['shift']());}};_0x4e1c5e(++_0x3894e0);}(_0x3831,0x14c));var _0x1383=function(_0x3fbe46,_0x12a0d1){_0x3fbe46=_0x3fbe46-0x0;var _0x27c406=_0x3831[_0x3fbe46];return _0x27c406;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0xd')](_0x1383('0xb'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0xf')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);module['exports']=router; \ No newline at end of file +var _0x627e=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x4ec22c,_0x33e5a0){var _0x1ab28e=function(_0x82fc57){while(--_0x82fc57){_0x4ec22c['push'](_0x4ec22c['shift']());}};_0x1ab28e(++_0x33e5a0);}(_0x627e,0x14a));var _0xe627=function(_0x10183f,_0x2da1ea){_0x10183f=_0x10183f-0x0;var _0x14cb40=_0x627e[_0x10183f];return _0x14cb40;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xe')](_0xe627('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a302a9e..c9cc758 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 _0x1516=['diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x1d4d56,_0x335121){var _0x292a68=function(_0xd002e6){while(--_0xd002e6){_0x1d4d56['push'](_0x1d4d56['shift']());}};_0x292a68(++_0x335121);}(_0x1516,0x18f));var _0x6151=function(_0x3272db,_0x4ee2a6){_0x3272db=_0x3272db-0x0;var _0x542e40=_0x1516[_0x3272db];return _0x542e40;};'use strict';var Sequelize=require(_0x6151('0x0'));var moment=require('moment');module[_0x6151('0x1')]={'state':{'type':Sequelize[_0x6151('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6151('0x3')]},'scheduledat':{'type':Sequelize[_0x6151('0x4')]},'countbusyretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6151('0x3')]},'calleridname':{'type':Sequelize[_0x6151('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6151('0x4')]},'answertime':{'type':Sequelize[_0x6151('0x4')]},'droptime':{'type':Sequelize[_0x6151('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6151('0x3')]},'campaign':{'type':Sequelize[_0x6151('0x3')]},'campaigntype':{'type':Sequelize[_0x6151('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6151('0x3')]},'disposition':{'type':Sequelize[_0x6151('0x3')]},'secondDisposition':{'type':Sequelize[_0x6151('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6151('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x29917d){var _0x5da5be=this[_0x6151('0x5')](_0x6151('0x6'));if(_0x5da5be&&_0x29917d){this[_0x6151('0x7')](_0x6151('0x8'),moment(_0x29917d)[_0x6151('0x9')](moment(_0x5da5be),_0x6151('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6151('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6151('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6151('0x4')]},'deleted':{'type':Sequelize[_0x6151('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6151('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6151('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6151('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fdd=['STRING','DATE','INTEGER','getDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x5fdd,0x1e7));var _0xd5fd=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x5fdd[_0x1d3577];return _0x277d9a;};'use strict';var Sequelize=require(_0xd5fd('0x0'));var moment=require(_0xd5fd('0x1'));module[_0xd5fd('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd5fd('0x3')]},'scheduledat':{'type':Sequelize[_0xd5fd('0x4')]},'countbusyretry':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd5fd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd5fd('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd5fd('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd5fd('0x3')]},'starttime':{'type':Sequelize[_0xd5fd('0x4')]},'responsetime':{'type':Sequelize[_0xd5fd('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd5fd('0x4')]},'endtime':{'type':Sequelize[_0xd5fd('0x4')]},'ringtime':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd5fd('0x3')]},'campaign':{'type':Sequelize[_0xd5fd('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd5fd('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd5fd('0x3')]},'secondDisposition':{'type':Sequelize[_0xd5fd('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd5fd('0x3')]},'dispositionat':{'type':Sequelize[_0xd5fd('0x4')],'set':function(_0x3556b3){var _0x500221=this[_0xd5fd('0x6')]('endtime');if(_0x500221&&_0x3556b3){this['setDataValue'](_0xd5fd('0x7'),moment(_0x3556b3)['diff'](moment(_0x500221),_0xd5fd('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd5fd('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd5fd('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd5fd('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd5fd('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd5fd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd5fd('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd5fd('0x4')]},'recallme':{'type':Sequelize[_0xd5fd('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd5fd('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd5fd('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd5fd('0x5')],'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 4970032..b63096c 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 _0x781d=['length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['describe']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['describe']()[_0xd781('0x26')](respondWithResult(_0x16d16e,null))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x39ecdb,_0x336d30){if(_0x39ecdb[_0xd781('0x44')][_0xd781('0x45')]){delete _0x39ecdb['body'][_0xd781('0x45')];}return db[_0xd781('0x2c')][_0xd781('0x46')]({'where':{'uniqueid':_0x39ecdb['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x336d30,null))[_0xd781('0x26')](saveUpdates(_0x39ecdb['body'],null))[_0xd781('0x26')](respondWithResult(_0x336d30,null))[_0xd781('0x3f')](handleError(_0x336d30,null));};exports[_0xd781('0x47')]=function(_0x207546,_0x42a2f9,_0x599915){return db[_0xd781('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x207546[_0xd781('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xd781('0x4b')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xd781('0x4c')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal'](_0xd781('0x4f')))),_0xd781('0x50')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd781('0x53')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x54')))),_0xd781('0x55')]]})['then'](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x26')](respondWithResult(_0x42a2f9,null))[_0xd781('0x3f')](handleError(_0x42a2f9,null));};exports[_0xd781('0x56')]=function(_0x2c4874,_0x2e8bab,_0x38bd3e){return db[_0xd781('0x2c')][_0xd781('0x57')]({'raw':![],'where':{'CampaignId':_0x2c4874[_0xd781('0x41')]['id']},'attributes':[[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x58')))),_0xd781('0x59')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5a')))),_0xd781('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4f')))),_0xd781('0x50')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5b')))),_0xd781('0x53')],[db['sequelize']['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xd781('0x26')](handleEntityNotFound(_0x2e8bab,null))[_0xd781('0x26')](respondWithResult(_0x2e8bab,null))[_0xd781('0x3f')](handleError(_0x2e8bab,null));};exports[_0xd781('0x5c')]=function(_0x26a0a9,_0x172a05,_0x2e0401){return db[_0xd781('0x5d')][_0xd781('0x46')]({'where':{'id':_0x26a0a9['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x172a05,null))[_0xd781('0x26')](function(_0x4c712f){var _0x24e3f5;if(_0x4c712f){_0x24e3f5=squel['insert']()[_0xd781('0x5e')](_0xd781('0x5f'))['fromQuery'](['phone',_0xd781('0x60'),_0xd781('0x61'),_0xd781('0x62'),_0xd781('0x63'),_0xd781('0x64'),_0xd781('0x65')],squel['select']()[_0xd781('0x66')](_0xd781('0x67'),_0xd781('0x68'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),'ListId')[_0xd781('0x66')]('ANY_VALUE(VoiceQueueId)',_0xd781('0x63'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x65'))[_0xd781('0x6c')](_0xd781('0x6d'))[_0xd781('0x39')]('VoiceQueueId\x20=\x20?',_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]())['where'](_0xd781('0x6f'),_0x26a0a9[_0xd781('0x44')][_0xd781('0x70')]['toString']())['where'](_0xd781('0x71'))['where'](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x68'))[_0xd781('0x6c')]('cm_hopper')[_0xd781('0x39')](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))[_0xd781('0x6c')](_0xd781('0x6d'))['where'](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id']['toString']())[_0xd781('0x39')](_0xd781('0x76')))[_0xd781('0x77')]('ContactId'))[_0xd781('0x6e')]();return db[_0xd781('0x49')]['query'](_0x24e3f5);}return[];})[_0xd781('0x26')](respondWithResult(_0x172a05,null))['catch'](handleError(_0x172a05,null));};exports[_0xd781('0x78')]=function(_0x23dba5,_0x3e0749,_0x192c95){return db[_0xd781('0x79')]['find']({'where':{'id':_0x23dba5[_0xd781('0x41')]['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x3e0749,null))[_0xd781('0x26')](function(_0x3897bf){var _0xaa945b;if(_0x3897bf){_0xaa945b=squel[_0xd781('0x7a')]()['into'](_0xd781('0x5f'))[_0xd781('0x7b')](['phone',_0xd781('0x60'),_0xd781('0x61'),'ListId',_0xd781('0x7c'),_0xd781('0x64'),_0xd781('0x65')],squel[_0xd781('0x73')]()[_0xd781('0x66')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),_0xd781('0x62'))[_0xd781('0x66')]('ANY_VALUE(CampaignId)',_0xd781('0x7c'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')]('NOW()','updatedAt')['from'](_0xd781('0x6d'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id']['toString']())['where'](_0xd781('0x6f'),_0x23dba5[_0xd781('0x44')][_0xd781('0x70')][_0xd781('0x6e')]())['where'](_0xd781('0x71'))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')]('phone')[_0xd781('0x6c')](_0xd781('0x5f'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))['from']('cm_hopper_final')[_0xd781('0x39')](_0xd781('0x7d'),_0x23dba5['params']['id'][_0xd781('0x6e')]())[_0xd781('0x39')]('state\x20=\x204'))[_0xd781('0x77')](_0xd781('0x61')))['toString']();return db[_0xd781('0x49')]['query'](_0xaa945b);}return[];})[_0xd781('0x26')](respondWithResult(_0x3e0749,null))[_0xd781('0x3f')](handleError(_0x3e0749,null));};exports[_0xd781('0x7e')]=function(_0x52b9c6,_0x5a2252,_0x356c56){return db[_0xd781('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x63')],'CampaignId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x7c')],'ContactId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x61')]}})[_0xd781('0x26')](handleEntityNotFound(_0x5a2252,null))[_0xd781('0x26')](function(_0x532fd8){if(_0x532fd8){return _0x532fd8;}return null;})[_0xd781('0x26')](respondWithResult(_0x5a2252,null))[_0xd781('0x3f')](handleError(_0x5a2252,null));}; \ No newline at end of file +var _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`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','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x108a76,_0x160eee){var _0x495260=function(_0x1e9008){while(--_0x1e9008){_0x108a76['push'](_0x108a76['shift']());}};_0x495260(++_0x160eee);}(_0xeff8,0x186));var _0x8eff=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xeff8[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index fbccb25..f1b5bf1 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 _0x72c6=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x1b0307,_0x4336b1){var _0x5c8d34=function(_0x5b1b61){while(--_0x5b1b61){_0x1b0307['push'](_0x1b0307['shift']());}};_0x5c8d34(++_0x4336b1);}(_0x72c6,0x12d));var _0x672c=function(_0x432b00,_0x2e042a){_0x432b00=_0x432b00-0x0;var _0x38863d=_0x72c6[_0x432b00];return _0x38863d;};'use strict';var _=require(_0x672c('0x0'));var util=require('util');var logger=require(_0x672c('0x1'))(_0x672c('0x2'));var moment=require(_0x672c('0x3'));var BPromise=require('bluebird');var rp=require(_0x672c('0x4'));var fs=require('fs');var path=require(_0x672c('0x5'));var rimraf=require(_0x672c('0x6'));var config=require(_0x672c('0x7'));var attributes=require(_0x672c('0x8'));module[_0x672c('0x9')]=function(_0x18917a,_0x4de097){return _0x18917a[_0x672c('0xa')](_0x672c('0xb'),attributes,{'tableName':_0x672c('0xc'),'paranoid':![],'indexes':[{'name':_0x672c('0xd'),'fields':[_0x672c('0xd')]},{'name':'uniqueid','fields':[_0x672c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65c6=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x5e69a8,_0x7cce86){var _0x2d3bbc=function(_0x26cb35){while(--_0x26cb35){_0x5e69a8['push'](_0x5e69a8['shift']());}};_0x2d3bbc(++_0x7cce86);}(_0x65c6,0xba));var _0x665c=function(_0x1e2fbd,_0x1c1062){_0x1e2fbd=_0x1e2fbd-0x0;var _0x1b20b2=_0x65c6[_0x1e2fbd];return _0x1b20b2;};'use strict';var _=require('lodash');var util=require(_0x665c('0x0'));var logger=require('../../config/logger')(_0x665c('0x1'));var moment=require(_0x665c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x665c('0x3'));var rimraf=require(_0x665c('0x4'));var config=require(_0x665c('0x5'));var attributes=require(_0x665c('0x6'));module[_0x665c('0x7')]=function(_0x111cc5,_0x5865ce){return _0x111cc5[_0x665c('0x8')](_0x665c('0x9'),attributes,{'tableName':_0x665c('0xa'),'paranoid':![],'indexes':[{'name':_0x665c('0xb'),'fields':['calleridnum']},{'name':_0x665c('0xc'),'fields':[_0x665c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fdbcb5e..d3340a8 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x45bbea,_0x57d616){var _0x13c113=function(_0x5cabcf){while(--_0x5cabcf){_0x45bbea['push'](_0x45bbea['shift']());}};_0x13c113(++_0x57d616);}(_0xb10b,0x12a));var _0xbb10=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0xb10b[_0x22d7e6];return _0x72bc58;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x54ce6a,_0x266a3f){var _0x45c7fd=function(_0x13247c){while(--_0x13247c){_0x54ce6a['push'](_0x54ce6a['shift']());}};_0x45c7fd(++_0x266a3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eb874,_0x3d849f){_0x5eb874=_0x5eb874-0x0;var _0x5bbbd0=_0xb10b[_0x5eb874];return _0x5bbbd0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 289805d..b33dd22 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 _0xc5f1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x37870d,_0x356e02){var _0x1ae695=function(_0x508f6c){while(--_0x508f6c){_0x37870d['push'](_0x37870d['shift']());}};_0x1ae695(++_0x356e02);}(_0xc5f1,0xb1));var _0x1c5f=function(_0x4c819f,_0xa998a1){_0x4c819f=_0x4c819f-0x0;var _0x43320d=_0xc5f1[_0x4c819f];return _0x43320d;};'use strict';var multer=require(_0x1c5f('0x0'));var util=require('util');var path=require(_0x1c5f('0x1'));var timeout=require(_0x1c5f('0x2'));var express=require(_0x1c5f('0x3'));var router=express[_0x1c5f('0x4')]();var fs_extra=require(_0x1c5f('0x5'));var auth=require(_0x1c5f('0x6'));var interaction=require(_0x1c5f('0x7'));var config=require(_0x1c5f('0x8'));var controller=require(_0x1c5f('0x9'));router[_0x1c5f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c5f('0xa')]('/describe',auth[_0x1c5f('0xb')](),controller[_0x1c5f('0xc')]);router['get'](_0x1c5f('0xd'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0xe')]);router[_0x1c5f('0xa')](_0x1c5f('0xf'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x10')]);router['get'](_0x1c5f('0x11'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x12')]);router[_0x1c5f('0x13')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1c5f('0x13')](_0x1c5f('0x14'),auth['isAuthenticated'](),controller[_0x1c5f('0x15')]);router['post'](_0x1c5f('0x16'),auth[_0x1c5f('0xb')](),controller['checkContactHopper']);router[_0x1c5f('0x17')](_0x1c5f('0xd'),auth[_0x1c5f('0xb')](),controller[_0x1c5f('0x18')]);module[_0x1c5f('0x19')]=router; \ No newline at end of file +var _0x045b=['update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x436778,_0x40c2b2){var _0x3e3d3d=function(_0x3209b1){while(--_0x3209b1){_0x436778['push'](_0x436778['shift']());}};_0x3e3d3d(++_0x40c2b2);}(_0x045b,0x1ab));var _0xb045=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x045b[_0x3a78a0];return _0x48e917;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb045('0x0'));var timeout=require(_0xb045('0x1'));var express=require(_0xb045('0x2'));var router=express[_0xb045('0x3')]();var fs_extra=require(_0xb045('0x4'));var auth=require(_0xb045('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb045('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xb045('0x7')]('/',auth[_0xb045('0x8')](),controller[_0xb045('0x9')]);router[_0xb045('0x7')](_0xb045('0xa'),auth[_0xb045('0x8')](),controller[_0xb045('0xb')]);router[_0xb045('0x7')](_0xb045('0xc'),auth[_0xb045('0x8')](),controller[_0xb045('0xd')]);router[_0xb045('0x7')](_0xb045('0xe'),auth[_0xb045('0x8')](),controller[_0xb045('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xb045('0x8')](),controller[_0xb045('0x10')]);router[_0xb045('0x11')](_0xb045('0x12'),auth[_0xb045('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb045('0x11')](_0xb045('0x13'),auth[_0xb045('0x8')](),controller[_0xb045('0x14')]);router[_0xb045('0x11')](_0xb045('0x15'),auth[_0xb045('0x8')](),controller[_0xb045('0x16')]);router['put']('/:id',auth[_0xb045('0x8')](),controller[_0xb045('0x17')]);module[_0xb045('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7c1395f..104ed5f 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 _0xbcf8=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x10dfc9,_0x25b62c){var _0x154afc=function(_0x5099ac){while(--_0x5099ac){_0x10dfc9['push'](_0x10dfc9['shift']());}};_0x154afc(++_0x25b62c);}(_0xbcf8,0x15d));var _0x8bcf=function(_0x379340,_0x46b98f){_0x379340=_0x379340-0x0;var _0x4a0a1f=_0xbcf8[_0x379340];return _0x4a0a1f;};'use strict';var Sequelize=require(_0x8bcf('0x0'));module['exports']={'state':{'type':Sequelize[_0x8bcf('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8bcf('0x2')]},'countbusyretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8bcf('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8bcf('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8bcf('0x2')]},'responsetime':{'type':Sequelize[_0x8bcf('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8bcf('0x2')]},'ringtime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8bcf('0x3')]},'campaign':{'type':Sequelize[_0x8bcf('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8bcf('0x3')]},'amd':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8bcf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8bcf('0x2')]},'edited':{'type':Sequelize[_0x8bcf('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8bcf('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8bcf('0x3')]}}; \ No newline at end of file +var _0xfd6e=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4e69d3,_0x2264c0){var _0x40cd05=function(_0x44c8fd){while(--_0x44c8fd){_0x4e69d3['push'](_0x4e69d3['shift']());}};_0x40cd05(++_0x2264c0);}(_0xfd6e,0x183));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xefd6('0x0'));module[_0xefd6('0x1')]={'state':{'type':Sequelize[_0xefd6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xefd6('0x3')]},'scheduledat':{'type':Sequelize[_0xefd6('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xefd6('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xefd6('0x3')]},'calleridnum':{'type':Sequelize[_0xefd6('0x3')]},'calleridname':{'type':Sequelize[_0xefd6('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xefd6('0x4')]},'droptime':{'type':Sequelize[_0xefd6('0x4')]},'endtime':{'type':Sequelize[_0xefd6('0x4')]},'ringtime':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xefd6('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xefd6('0x3')]},'reason':{'type':Sequelize[_0xefd6('0x3')]},'amd':{'type':Sequelize[_0xefd6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xefd6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xefd6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xefd6('0x4')]},'recallme':{'type':Sequelize[_0xefd6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xefd6('0x4')]},'edited':{'type':Sequelize[_0xefd6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xefd6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 157bf0c..ef9d429 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 _0x570d=['create','body','describe','update','uniqueid','find','params','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','attributes','fields','length','order','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','intersection'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0x570d,0xd3));var _0xd570=function(_0x35ccde,_0xbe027){_0x35ccde=_0x35ccde-0x0;var _0xbd6110=_0x570d[_0x35ccde];return _0xbd6110;};'use strict';var emlformat=require(_0xd570('0x0'));var rimraf=require(_0xd570('0x1'));var zipdir=require(_0xd570('0x2'));var jsonpatch=require(_0xd570('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd570('0x4'));var path=require(_0xd570('0x5'));var sox=require(_0xd570('0x6'));var csv=require(_0xd570('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd570('0x8'));var squel=require(_0xd570('0x9'));var crypto=require(_0xd570('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd570('0x7'));var querystring=require('querystring');var Papa=require(_0xd570('0xb'));var Redis=require(_0xd570('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd570('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd570('0xe'))('api');var utils=require(_0xd570('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd570('0x10'))['db'];function respondWithStatusCode(_0x179c5f,_0x53f81c){_0x53f81c=_0x53f81c||0xcc;return function(_0x5c37ed){if(_0x5c37ed){return _0x179c5f['sendStatus'](_0x53f81c);}return _0x179c5f[_0xd570('0x11')](_0x53f81c)[_0xd570('0x12')]();};}function respondWithResult(_0x1632ca,_0xaf2e6b){_0xaf2e6b=_0xaf2e6b||0xc8;return function(_0x48a1f9){if(_0x48a1f9){return _0x1632ca[_0xd570('0x11')](_0xaf2e6b)[_0xd570('0x13')](_0x48a1f9);}};}function respondWithFilteredResult(_0x349d70,_0x2753e3){return function(_0x5ded65){if(_0x5ded65){var _0x8d9763=typeof _0x2753e3[_0xd570('0x14')]===_0xd570('0x15')&&typeof _0x2753e3['limit']===_0xd570('0x15');var _0x3adbd6=_0x5ded65[_0xd570('0x16')];var _0x2473ba=_0x8d9763?0x0:_0x2753e3[_0xd570('0x14')];var _0xfbdf78=_0x8d9763?_0x5ded65['count']:_0x2753e3[_0xd570('0x14')]+_0x2753e3[_0xd570('0x17')];var _0x46cdb9;if(_0xfbdf78>=_0x3adbd6){_0xfbdf78=_0x3adbd6;_0x46cdb9=0xc8;}else{_0x46cdb9=0xce;}_0x349d70[_0xd570('0x11')](_0x46cdb9);return _0x349d70[_0xd570('0x18')](_0xd570('0x19'),_0x2473ba+'-'+_0xfbdf78+'/'+_0x3adbd6)[_0xd570('0x13')](_0x5ded65);}return null;};}function patchUpdates(_0x427cb0){return function(_0x4fcd86){try{jsonpatch[_0xd570('0x1a')](_0x4fcd86,_0x427cb0,!![]);}catch(_0x2d1996){return BPromise['reject'](_0x2d1996);}return _0x4fcd86[_0xd570('0x1b')]();};}function saveUpdates(_0xdeab9f,_0x2f6c0e){return function(_0x1e27d1){if(_0x1e27d1){return _0x1e27d1['update'](_0xdeab9f)[_0xd570('0x1c')](function(_0x195c8b){return _0x195c8b;});}return null;};}function removeEntity(_0x28700e,_0x51f15c){return function(_0x17bad7){if(_0x17bad7){return _0x17bad7[_0xd570('0x1d')]()['then'](function(){_0x28700e[_0xd570('0x11')](0xcc)[_0xd570('0x12')]();});}};}function handleEntityNotFound(_0x53eee5,_0x1ba420){return function(_0x475399){if(!_0x475399){_0x53eee5[_0xd570('0x1e')](0x194);}return _0x475399;};}function handleError(_0x52c8f7,_0xcb84e2){_0xcb84e2=_0xcb84e2||0x1f4;return function(_0x4410c5){logger['error'](_0x4410c5[_0xd570('0x1f')]);if(_0x4410c5['name']){delete _0x4410c5[_0xd570('0x20')];}_0x52c8f7[_0xd570('0x11')](_0xcb84e2)[_0xd570('0x21')](_0x4410c5);};}exports[_0xd570('0x22')]=function(_0x5bbc3d,_0x22a983){var _0x3436dc={},_0x385044={},_0x1c8c97={'count':0x0,'rows':[]};var _0x55523f=_[_0xd570('0x23')](db[_0xd570('0x24')][_0xd570('0x25')],function(_0x27aaf7){return{'name':_0x27aaf7['fieldName'],'type':_0x27aaf7[_0xd570('0x26')][_0xd570('0x27')]};});_0x385044[_0xd570('0x28')]=_['map'](_0x55523f,_0xd570('0x20'));_0x385044['query']=_[_0xd570('0x29')](_0x5bbc3d['query']);_0x385044['filters']=_['intersection'](_0x385044[_0xd570('0x28')],_0x385044[_0xd570('0x2a')]);_0x3436dc[_0xd570('0x2b')]=_['intersection'](_0x385044[_0xd570('0x28')],qs[_0xd570('0x2c')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x2c')]));_0x3436dc['attributes']=_0x3436dc['attributes'][_0xd570('0x2d')]?_0x3436dc['attributes']:_0x385044[_0xd570('0x28')];if(!_0x5bbc3d['query']['hasOwnProperty']('nolimit')){_0x3436dc[_0xd570('0x17')]=qs[_0xd570('0x17')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x17')]);_0x3436dc['offset']=qs[_0xd570('0x14')](_0x5bbc3d[_0xd570('0x2a')]['offset']);}_0x3436dc[_0xd570('0x2e')]=qs[_0xd570('0x2f')](_0x5bbc3d[_0xd570('0x2a')][_0xd570('0x2f')]);_0x3436dc[_0xd570('0x30')]=qs['filters'](_[_0xd570('0x31')](_0x5bbc3d[_0xd570('0x2a')],_0x385044[_0xd570('0x32')]),_0x55523f);if(_0x5bbc3d['query']['filter']){_0x3436dc[_0xd570('0x30')]=_[_0xd570('0x33')](_0x3436dc[_0xd570('0x30')],{'$or':_[_0xd570('0x23')](_0x55523f,function(_0x576ebb){if(_0x576ebb[_0xd570('0x26')]!=='VIRTUAL'){var _0x59c236={};_0x59c236[_0x576ebb[_0xd570('0x20')]]={'$like':'%'+_0x5bbc3d['query'][_0xd570('0x34')]+'%'};return _0x59c236;}})});}_0x3436dc=_[_0xd570('0x33')]({},_0x3436dc,_0x5bbc3d[_0xd570('0x35')]);var _0x347712={'where':_0x3436dc[_0xd570('0x30')]};return db['CmHopperHistory']['count'](_0x347712)[_0xd570('0x1c')](function(_0xb6f38d){_0x1c8c97[_0xd570('0x16')]=_0xb6f38d;if(_0x5bbc3d['query'][_0xd570('0x36')]){_0x3436dc[_0xd570('0x37')]=[{'all':!![]}];}return db[_0xd570('0x24')][_0xd570('0x38')](_0x3436dc);})['then'](function(_0x375297){_0x1c8c97[_0xd570('0x39')]=_0x375297;return _0x1c8c97;})[_0xd570('0x1c')](respondWithFilteredResult(_0x22a983,_0x3436dc))[_0xd570('0x3a')](handleError(_0x22a983,null));};exports[_0xd570('0x3b')]=function(_0x4e1f82,_0x1a88e9){var _0x29f616={'raw':!![],'where':{'id':_0x4e1f82['params']['id']}},_0x2e04bb={};_0x2e04bb[_0xd570('0x28')]=_['keys'](db[_0xd570('0x24')][_0xd570('0x25')]);_0x2e04bb['query']=_['keys'](_0x4e1f82['query']);_0x2e04bb[_0xd570('0x32')]=_['intersection'](_0x2e04bb[_0xd570('0x28')],_0x2e04bb[_0xd570('0x2a')]);_0x29f616[_0xd570('0x2b')]=_[_0xd570('0x3c')](_0x2e04bb[_0xd570('0x28')],qs[_0xd570('0x2c')](_0x4e1f82[_0xd570('0x2a')][_0xd570('0x2c')]));_0x29f616[_0xd570('0x2b')]=_0x29f616['attributes'][_0xd570('0x2d')]?_0x29f616[_0xd570('0x2b')]:_0x2e04bb[_0xd570('0x28')];if(_0x4e1f82[_0xd570('0x2a')]['includeAll']){_0x29f616[_0xd570('0x37')]=[{'all':!![]}];}_0x29f616=_[_0xd570('0x33')]({},_0x29f616,_0x4e1f82[_0xd570('0x35')]);return db[_0xd570('0x24')]['find'](_0x29f616)[_0xd570('0x1c')](handleEntityNotFound(_0x1a88e9,null))['then'](respondWithResult(_0x1a88e9,null))[_0xd570('0x3a')](handleError(_0x1a88e9,null));};exports['create']=function(_0x4fb013,_0xd933e8){return db[_0xd570('0x24')][_0xd570('0x3d')](_0x4fb013[_0xd570('0x3e')],{})[_0xd570('0x1c')](respondWithResult(_0xd933e8,0xc9))[_0xd570('0x3a')](handleError(_0xd933e8,null));};exports[_0xd570('0x3f')]=function(_0x9d1093,_0x24c16a){return db[_0xd570('0x24')][_0xd570('0x3f')]()[_0xd570('0x1c')](respondWithResult(_0x24c16a,null))['catch'](handleError(_0x24c16a,null));};exports[_0xd570('0x40')]=function(_0x30ebea,_0x4f3fb7){if(_0x30ebea[_0xd570('0x3e')][_0xd570('0x41')]){delete _0x30ebea[_0xd570('0x3e')][_0xd570('0x41')];}return db['CmHopperHistory'][_0xd570('0x42')]({'where':{'uniqueid':_0x30ebea[_0xd570('0x43')]['id']}})[_0xd570('0x1c')](handleEntityNotFound(_0x4f3fb7,null))[_0xd570('0x1c')](saveUpdates(_0x30ebea[_0xd570('0x3e')],null))[_0xd570('0x1c')](respondWithResult(_0x4f3fb7,null))['catch'](handleError(_0x4f3fb7,null));}; \ No newline at end of file +var _0x955f=['merge','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x28591f,_0x4a012d){var _0x314e4c=function(_0x1f21a7){while(--_0x1f21a7){_0x28591f['push'](_0x28591f['shift']());}};_0x314e4c(++_0x4a012d);}(_0x955f,0x1cd));var _0xf955=function(_0x5678c5,_0x31c5ca){_0x5678c5=_0x5678c5-0x0;var _0x1c9a76=_0x955f[_0x5678c5];return _0x1c9a76;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf955('0x2'));var rp=require(_0xf955('0x3'));var moment=require('moment');var BPromise=require(_0xf955('0x4'));var Mustache=require(_0xf955('0x5'));var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require('to-csv');var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require(_0xf955('0xa'));var squel=require(_0xf955('0xb'));var crypto=require(_0xf955('0xc'));var jsforce=require(_0xf955('0xd'));var deskjs=require(_0xf955('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf955('0xf'));var Papa=require(_0xf955('0x10'));var Redis=require('ioredis');var authService=require(_0xf955('0x11'));var qs=require(_0xf955('0x12'));var as=require(_0xf955('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x14'))(_0xf955('0x15'));var utils=require(_0xf955('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf955('0x17'));var db=require(_0xf955('0x18'))['db'];function respondWithStatusCode(_0xe03645,_0x2d1895){_0x2d1895=_0x2d1895||0xcc;return function(_0x492daf){if(_0x492daf){return _0xe03645[_0xf955('0x19')](_0x2d1895);}return _0xe03645[_0xf955('0x1a')](_0x2d1895)[_0xf955('0x1b')]();};}function respondWithResult(_0x28cd39,_0x4bf688){_0x4bf688=_0x4bf688||0xc8;return function(_0x547367){if(_0x547367){return _0x28cd39['status'](_0x4bf688)[_0xf955('0x1c')](_0x547367);}};}function respondWithFilteredResult(_0x11550a,_0x4f5397){return function(_0x78d687){if(_0x78d687){var _0x22eb57=typeof _0x4f5397['offset']===_0xf955('0x1d')&&typeof _0x4f5397[_0xf955('0x1e')]===_0xf955('0x1d');var _0x13ba7c=_0x78d687[_0xf955('0x1f')];var _0x224ec0=_0x22eb57?0x0:_0x4f5397[_0xf955('0x20')];var _0x5e4877=_0x22eb57?_0x78d687[_0xf955('0x1f')]:_0x4f5397[_0xf955('0x20')]+_0x4f5397[_0xf955('0x1e')];var _0x4a2231;if(_0x5e4877>=_0x13ba7c){_0x5e4877=_0x13ba7c;_0x4a2231=0xc8;}else{_0x4a2231=0xce;}_0x11550a[_0xf955('0x1a')](_0x4a2231);return _0x11550a[_0xf955('0x21')]('Content-Range',_0x224ec0+'-'+_0x5e4877+'/'+_0x13ba7c)[_0xf955('0x1c')](_0x78d687);}return null;};}function patchUpdates(_0x4d63ac){return function(_0x23f905){try{jsonpatch['apply'](_0x23f905,_0x4d63ac,!![]);}catch(_0xebfd93){return BPromise[_0xf955('0x22')](_0xebfd93);}return _0x23f905[_0xf955('0x23')]();};}function saveUpdates(_0x411dec,_0x5667e5){return function(_0x4088aa){if(_0x4088aa){return _0x4088aa[_0xf955('0x24')](_0x411dec)[_0xf955('0x25')](function(_0x143e51){return _0x143e51;});}return null;};}function removeEntity(_0x22faac,_0x4f6dac){return function(_0x272749){if(_0x272749){return _0x272749['destroy']()[_0xf955('0x25')](function(){_0x22faac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x84cce3,_0x40b472){return function(_0x51a4e6){if(!_0x51a4e6){_0x84cce3[_0xf955('0x19')](0x194);}return _0x51a4e6;};}function handleError(_0x5b3e2d,_0x772435){_0x772435=_0x772435||0x1f4;return function(_0x1df7da){logger[_0xf955('0x26')](_0x1df7da[_0xf955('0x27')]);if(_0x1df7da[_0xf955('0x28')]){delete _0x1df7da[_0xf955('0x28')];}_0x5b3e2d['status'](_0x772435)['send'](_0x1df7da);};}exports[_0xf955('0x29')]=function(_0x3f5142,_0x3e069c){var _0x1bfcd0={},_0x3d6228={},_0x43bf75={'count':0x0,'rows':[]};var _0x308384=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x326e10){return{'name':_0x326e10[_0xf955('0x2a')],'type':_0x326e10[_0xf955('0x2b')][_0xf955('0x2c')]};});_0x3d6228[_0xf955('0x2d')]=_[_0xf955('0x2e')](_0x308384,'name');_0x3d6228[_0xf955('0x2f')]=_[_0xf955('0x30')](_0x3f5142[_0xf955('0x2f')]);_0x3d6228[_0xf955('0x31')]=_[_0xf955('0x32')](_0x3d6228[_0xf955('0x2d')],_0x3d6228[_0xf955('0x2f')]);_0x1bfcd0['attributes']=_[_0xf955('0x32')](_0x3d6228[_0xf955('0x2d')],qs['fields'](_0x3f5142['query'][_0xf955('0x33')]));_0x1bfcd0[_0xf955('0x34')]=_0x1bfcd0[_0xf955('0x34')][_0xf955('0x35')]?_0x1bfcd0['attributes']:_0x3d6228[_0xf955('0x2d')];if(!_0x3f5142[_0xf955('0x2f')][_0xf955('0x36')](_0xf955('0x37'))){_0x1bfcd0[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x3f5142['query'][_0xf955('0x1e')]);_0x1bfcd0['offset']=qs['offset'](_0x3f5142[_0xf955('0x2f')][_0xf955('0x20')]);}_0x1bfcd0[_0xf955('0x38')]=qs[_0xf955('0x39')](_0x3f5142['query'][_0xf955('0x39')]);_0x1bfcd0['where']=qs['filters'](_[_0xf955('0x3a')](_0x3f5142[_0xf955('0x2f')],_0x3d6228['filters']),_0x308384);if(_0x3f5142[_0xf955('0x2f')][_0xf955('0x3b')]){_0x1bfcd0['where']=_['merge'](_0x1bfcd0['where'],{'$or':_[_0xf955('0x2e')](_0x308384,function(_0x342e98){if(_0x342e98[_0xf955('0x2b')]!==_0xf955('0x3c')){var _0x30597d={};_0x30597d[_0x342e98['name']]={'$like':'%'+_0x3f5142[_0xf955('0x2f')][_0xf955('0x3b')]+'%'};return _0x30597d;}})});}_0x1bfcd0=_['merge']({},_0x1bfcd0,_0x3f5142[_0xf955('0x3d')]);var _0x102281={'where':_0x1bfcd0['where']};return db[_0xf955('0x3e')][_0xf955('0x1f')](_0x102281)['then'](function(_0x5c3d10){_0x43bf75[_0xf955('0x1f')]=_0x5c3d10;if(_0x3f5142[_0xf955('0x2f')][_0xf955('0x3f')]){_0x1bfcd0[_0xf955('0x40')]=[{'all':!![]}];}return db[_0xf955('0x3e')][_0xf955('0x41')](_0x1bfcd0);})['then'](function(_0x1f1ac4){_0x43bf75[_0xf955('0x42')]=_0x1f1ac4;return _0x43bf75;})['then'](respondWithFilteredResult(_0x3e069c,_0x1bfcd0))[_0xf955('0x43')](handleError(_0x3e069c,null));};exports[_0xf955('0x44')]=function(_0x194736,_0x43e211){var _0x10788d={'raw':!![],'where':{'id':_0x194736[_0xf955('0x45')]['id']}},_0x200eec={};_0x200eec[_0xf955('0x2d')]=_['keys'](db['CmHopperHistory'][_0xf955('0x46')]);_0x200eec[_0xf955('0x2f')]=_['keys'](_0x194736[_0xf955('0x2f')]);_0x200eec[_0xf955('0x31')]=_[_0xf955('0x32')](_0x200eec[_0xf955('0x2d')],_0x200eec[_0xf955('0x2f')]);_0x10788d[_0xf955('0x34')]=_[_0xf955('0x32')](_0x200eec[_0xf955('0x2d')],qs[_0xf955('0x33')](_0x194736[_0xf955('0x2f')][_0xf955('0x33')]));_0x10788d[_0xf955('0x34')]=_0x10788d[_0xf955('0x34')]['length']?_0x10788d[_0xf955('0x34')]:_0x200eec[_0xf955('0x2d')];if(_0x194736['query'][_0xf955('0x3f')]){_0x10788d[_0xf955('0x40')]=[{'all':!![]}];}_0x10788d=_[_0xf955('0x47')]({},_0x10788d,_0x194736[_0xf955('0x3d')]);return db[_0xf955('0x3e')]['find'](_0x10788d)[_0xf955('0x25')](handleEntityNotFound(_0x43e211,null))[_0xf955('0x25')](respondWithResult(_0x43e211,null))[_0xf955('0x43')](handleError(_0x43e211,null));};exports[_0xf955('0x48')]=function(_0x181746,_0x181686){return db[_0xf955('0x3e')][_0xf955('0x48')](_0x181746[_0xf955('0x49')],{})['then'](respondWithResult(_0x181686,0xc9))[_0xf955('0x43')](handleError(_0x181686,null));};exports[_0xf955('0x4a')]=function(_0x103cd6,_0x2feeef){return db['CmHopperHistory']['describe']()[_0xf955('0x25')](respondWithResult(_0x2feeef,null))['catch'](handleError(_0x2feeef,null));};exports[_0xf955('0x24')]=function(_0x5974b8,_0x56122f){if(_0x5974b8['body']['uniqueid']){delete _0x5974b8[_0xf955('0x49')][_0xf955('0x4b')];}return db[_0xf955('0x3e')]['find']({'where':{'uniqueid':_0x5974b8[_0xf955('0x45')]['id']}})[_0xf955('0x25')](handleEntityNotFound(_0x56122f,null))[_0xf955('0x25')](saveUpdates(_0x5974b8[_0xf955('0x49')],null))[_0xf955('0x25')](respondWithResult(_0x56122f,null))[_0xf955('0x43')](handleError(_0x56122f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index cd355c2..727e634 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 _0x3d04=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x82f869,_0x103e69){var _0x5cca39=function(_0x2bd79a){while(--_0x2bd79a){_0x82f869['push'](_0x82f869['shift']());}};_0x5cca39(++_0x103e69);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x43d0('0xb'),'fields':[_0x43d0('0xb')]},{'name':_0x43d0('0xc'),'fields':[_0x43d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x199d=['./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x43673c,_0x4b569b){var _0x34512e=function(_0x5cb16e){while(--_0x5cb16e){_0x43673c['push'](_0x43673c['shift']());}};_0x34512e(++_0x4b569b);}(_0x199d,0x13d));var _0xd199=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x199d[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var logger=require(_0xd199('0x2'))(_0xd199('0x3'));var moment=require(_0xd199('0x4'));var BPromise=require('bluebird');var rp=require(_0xd199('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd199('0x6'));var config=require(_0xd199('0x7'));var attributes=require(_0xd199('0x8'));module['exports']=function(_0x44dc53,_0x16825f){return _0x44dc53['define'](_0xd199('0x9'),attributes,{'tableName':_0xd199('0xa'),'paranoid':![],'indexes':[{'name':_0xd199('0xb'),'fields':['endtime']},{'name':_0xd199('0xc'),'fields':[_0xd199('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 381c520..8f0ed55 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 _0x3d0a=['`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','name','col','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','then','info','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0x396a1b,_0xf3a702){var _0xc19797=function(_0xbfe87d){while(--_0xbfe87d){_0x396a1b['push'](_0x396a1b['shift']());}};_0xc19797(++_0xf3a702);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d0a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa3d0('0x0'));var util=require('util');var moment=require(_0xa3d0('0x1'));var BPromise=require(_0xa3d0('0x2'));var rs=require(_0xa3d0('0x3'));var fs=require('fs');var Redis=require(_0xa3d0('0x4'));var db=require(_0xa3d0('0x5'))['db'];var utils=require(_0xa3d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3d0('0x7')][_0xa3d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e7cd,_0x5d20be,_0x517f0e){return new BPromise(function(_0x2ab25b,_0x53884f){return client['request'](_0x42e7cd,_0x517f0e)[_0xa3d0('0x9')](function(_0x5c3472){logger[_0xa3d0('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0xa3d0('0xb'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5d20be,'request\x20sent',JSON['stringify'](_0x5c3472));if(_0x5c3472['error']){if(_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xd')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0x5c3472[_0xa3d0('0xc')]['message']);return _0x53884f(_0x5c3472['error']['message']);}logger[_0xa3d0('0xc')](_0xa3d0('0xe'),_0x5d20be,_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xf')]);return _0x2ab25b(_0x5c3472[_0xa3d0('0xc')][_0xa3d0('0xf')]);}else{logger[_0xa3d0('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5d20be,_0xa3d0('0xb'));_0x2ab25b(_0x5c3472[_0xa3d0('0x10')][_0xa3d0('0xf')]);}})['catch'](function(_0x26e231){logger[_0xa3d0('0xc')](_0xa3d0('0xe'),_0x5d20be,_0x26e231);_0x53884f(_0x26e231);});});}exports[_0xa3d0('0x11')]=function(_0x2e138f){var _0x2c16b4=this;return new Promise(function(_0x46ff69,_0xb54dab){return db[_0xa3d0('0x12')][_0xa3d0('0x13')](_0x2e138f[_0xa3d0('0x14')],{'raw':_0x2e138f[_0xa3d0('0x15')]?_0x2e138f['options'][_0xa3d0('0x16')]===undefined?!![]:![]:!![]})[_0xa3d0('0x9')](function(_0x466155){logger[_0xa3d0('0xa')]('CreateCmHopperHistory',_0x2e138f);logger[_0xa3d0('0x17')](_0xa3d0('0x11'),_0x2e138f,JSON['stringify'](_0x466155));_0x46ff69(_0x466155);})[_0xa3d0('0x18')](function(_0x16c7c2){logger[_0xa3d0('0xc')](_0xa3d0('0x11'),_0x16c7c2[_0xa3d0('0xf')],_0x2e138f);_0xb54dab(_0x2c16b4[_0xa3d0('0xc')](0x1f4,_0x16c7c2['message']));});});};exports[_0xa3d0('0x19')]=function(_0x457556){var _0x33e0da=this;return new Promise(function(_0x8a729e,_0x195fe2){return db[_0xa3d0('0x12')]['findAll']({'raw':_0x457556[_0xa3d0('0x15')]?_0x457556[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x457556['options']?_0x457556['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['col']('id')),_0xa3d0('0x1c')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize'][_0xa3d0('0x1d')](_0xa3d0('0x1e')))),_0xa3d0('0x1f')],[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x20')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x21')))),_0xa3d0('0x22')],[db['sequelize']['fn'](_0xa3d0('0x23'),db['sequelize']['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x24')))),'predictiveIntervalAvgHoldtime'],[db[_0xa3d0('0x1b')]['fn']('AVG',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x25')))),_0xa3d0('0x26')]]})['then'](function(_0x2cffde){logger[_0xa3d0('0xa')](_0xa3d0('0x19'),_0x457556);logger[_0xa3d0('0x17')](_0xa3d0('0x19'),_0x457556,JSON[_0xa3d0('0x27')](_0x2cffde));_0x8a729e(_0x2cffde);})[_0xa3d0('0x18')](function(_0x55170d){logger['error'](_0xa3d0('0x19'),_0x55170d[_0xa3d0('0xf')],_0x457556);_0x195fe2(_0x33e0da[_0xa3d0('0xc')](0x1f4,_0x55170d[_0xa3d0('0xf')]));});});};exports[_0xa3d0('0x28')]=function(_0x148fe7){var _0x5cf5c6=this;return new Promise(function(_0x270ad4,_0x6673e7){return db[_0xa3d0('0x12')]['findAll']({'raw':_0x148fe7[_0xa3d0('0x15')]?_0x148fe7[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x148fe7['options']?_0x148fe7[_0xa3d0('0x15')]['where']||null:null,'attributes':[[_0xa3d0('0x29'),'name'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0xa3d0('0x2a')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db['sequelize']['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x203,\x201,\x20null'))),_0xa3d0('0x2b')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x1e')))),_0xa3d0('0x2c')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x2d')))),_0xa3d0('0x2e')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x2f')))),_0xa3d0('0x30')],[db['sequelize']['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa3d0('0x31')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa3d0('0x1d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa3d0('0x32')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal'](_0xa3d0('0x33')))),_0xa3d0('0x34')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x35')))),_0xa3d0('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x38')))),'outboundRejectCallsDay'],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa3d0('0x39')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db['sequelize'][_0xa3d0('0x1d')](_0xa3d0('0x3a')))),_0xa3d0('0x3b')],[db[_0xa3d0('0x1b')]['fn']('COUNT',db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')][_0xa3d0('0x1d')](_0xa3d0('0x3c')))),_0xa3d0('0x3d')]],'group':[_0xa3d0('0x29')]})['then'](function(_0x22f566){logger['info'](_0xa3d0('0x28'),_0x148fe7);logger[_0xa3d0('0x17')](_0xa3d0('0x28'),_0x148fe7,JSON[_0xa3d0('0x27')](_0x22f566));_0x270ad4(_0x22f566);})[_0xa3d0('0x18')](function(_0x519831){logger[_0xa3d0('0xc')](_0xa3d0('0x28'),_0x519831['message'],_0x148fe7);_0x6673e7(_0x5cf5c6[_0xa3d0('0xc')](0x1f4,_0x519831[_0xa3d0('0xf')]));});});};exports[_0xa3d0('0x3e')]=function(_0x5356bb){var _0x4348d3=this;return new Promise(function(_0x3067bf,_0x12ddac){return db['CmHopperHistory'][_0xa3d0('0x3f')]({'raw':_0x5356bb['options']?_0x5356bb[_0xa3d0('0x15')][_0xa3d0('0x16')]===undefined?!![]:![]:!![],'where':_0x5356bb['options']?_0x5356bb[_0xa3d0('0x15')]['where']||null:null,'attributes':[['campaign',_0xa3d0('0x40')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')][_0xa3d0('0x41')]('id')),_0xa3d0('0x42')],[db[_0xa3d0('0x1b')]['fn'](_0xa3d0('0x1a'),db[_0xa3d0('0x1b')]['fn']('IF',db[_0xa3d0('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xa3d0('0x29')]})['then'](function(_0x54a044){logger[_0xa3d0('0xa')]('GetCampaignHopperHistory',_0x5356bb);logger[_0xa3d0('0x17')]('GetCampaignHopperHistory',_0x5356bb,JSON[_0xa3d0('0x27')](_0x54a044));_0x3067bf(_0x54a044);})['catch'](function(_0x5e5c54){logger[_0xa3d0('0xc')](_0xa3d0('0x3e'),_0x5e5c54[_0xa3d0('0xf')],_0x5356bb);_0x12ddac(_0x4348d3[_0xa3d0('0xc')](0x1f4,_0x5e5c54['message']));});});}; \ No newline at end of file +var _0x41bb=['error','code','message','result','catch','CreateCmHopperHistory','create','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','CmHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ed9f7,_0x53498){var _0x24018d=function(_0x304e5d){while(--_0x304e5d){_0x4ed9f7['push'](_0x4ed9f7['shift']());}};_0x24018d(++_0x53498);}(_0x41bb,0xc5));var _0xb41b=function(_0x2d7832,_0x2ada44){_0x2d7832=_0x2d7832-0x0;var _0x2e852b=_0x41bb[_0x2d7832];return _0x2e852b;};'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')]('CmHopperHistory,\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);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['CmHopperHistory'][_0xb41b('0x16')](_0x47154d['body'],{'raw':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x53bc44){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x19')](_0x53bc44));_0x5df8c2(_0x53bc44);})[_0xb41b('0x14')](function(_0x4c73da){logger['error'](_0xb41b('0x15'),_0x4c73da[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783[_0xb41b('0x10')](0x1f4,_0x4c73da['message']));});});};exports[_0xb41b('0x1a')]=function(_0x2441d6){var _0x546101=this;return new Promise(function(_0x2a5306,_0x34f908){return db['CmHopperHistory'][_0xb41b('0x1b')]({'raw':_0x2441d6['options']?_0x2441d6[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x2441d6['options']?_0x2441d6[_0xb41b('0x17')][_0xb41b('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xb41b('0x1d')][_0xb41b('0x1e')]('id')),_0xb41b('0x1f')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')]['literal'](_0xb41b('0x21')))),_0xb41b('0x22')],[db['sequelize']['fn'](_0xb41b('0x20'),db['sequelize']['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0xb41b('0x24')],[db['sequelize']['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db['sequelize'][_0xb41b('0x23')](_0xb41b('0x25')))),_0xb41b('0x26')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x27'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x28')))),_0xb41b('0x29')],[db['sequelize']['fn'](_0xb41b('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0xb41b('0x23')](_0xb41b('0x2a')))),_0xb41b('0x2b')]]})[_0xb41b('0xb')](function(_0x1b8681){logger[_0xb41b('0xc')](_0xb41b('0x1a'),_0x2441d6);logger[_0xb41b('0xf')](_0xb41b('0x1a'),_0x2441d6,JSON[_0xb41b('0x19')](_0x1b8681));_0x2a5306(_0x1b8681);})[_0xb41b('0x14')](function(_0x5db85e){logger[_0xb41b('0x10')](_0xb41b('0x1a'),_0x5db85e[_0xb41b('0x12')],_0x2441d6);_0x34f908(_0x546101[_0xb41b('0x10')](0x1f4,_0x5db85e[_0xb41b('0x12')]));});});};exports[_0xb41b('0x2c')]=function(_0x54f782){var _0x5f5326=this;return new Promise(function(_0x376e4f,_0x375bb9){return db['CmHopperHistory'][_0xb41b('0x1b')]({'raw':_0x54f782[_0xb41b('0x17')]?_0x54f782[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x54f782[_0xb41b('0x17')]?_0x54f782['options'][_0xb41b('0x1c')]||null:null,'attributes':[['campaign',_0xb41b('0x2d')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x2e')))),_0xb41b('0x2f')],[db[_0xb41b('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb41b('0x23')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xb41b('0x1d')]['fn']('COUNT',db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x21')))),_0xb41b('0x30')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db['sequelize']['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x31')))),_0xb41b('0x32')],[db['sequelize']['fn'](_0xb41b('0x20'),db['sequelize']['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x33')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x34')))),_0xb41b('0x35')],[db[_0xb41b('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb41b('0x1d')]['literal'](_0xb41b('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0xb41b('0x1d')]['fn']('COUNT',db[_0xb41b('0x1d')]['fn']('IF',db['sequelize'][_0xb41b('0x23')](_0xb41b('0x37')))),_0xb41b('0x38')],[db[_0xb41b('0x1d')]['fn']('COUNT',db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')]['literal'](_0xb41b('0x39')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x3a')))),_0xb41b('0x3b')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x3c')))),_0xb41b('0x3d')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xb41b('0x3e')],[db['sequelize']['fn']('COUNT',db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x3f')))),_0xb41b('0x3d')],[db[_0xb41b('0x1d')]['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db[_0xb41b('0x1d')][_0xb41b('0x23')](_0xb41b('0x40')))),_0xb41b('0x41')]],'group':[_0xb41b('0x42')]})[_0xb41b('0xb')](function(_0x2a6124){logger[_0xb41b('0xc')](_0xb41b('0x2c'),_0x54f782);logger[_0xb41b('0xf')](_0xb41b('0x2c'),_0x54f782,JSON[_0xb41b('0x19')](_0x2a6124));_0x376e4f(_0x2a6124);})[_0xb41b('0x14')](function(_0x571a8c){logger[_0xb41b('0x10')]('GetVoiceQueueHopperHistory',_0x571a8c[_0xb41b('0x12')],_0x54f782);_0x375bb9(_0x5f5326[_0xb41b('0x10')](0x1f4,_0x571a8c[_0xb41b('0x12')]));});});};exports[_0xb41b('0x43')]=function(_0x231042){var _0x305f0e=this;return new Promise(function(_0x2bae07,_0x5ca174){return db[_0xb41b('0x44')][_0xb41b('0x1b')]({'raw':_0x231042[_0xb41b('0x17')]?_0x231042['options'][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x231042[_0xb41b('0x17')]?_0x231042[_0xb41b('0x17')][_0xb41b('0x1c')]||null:null,'attributes':[[_0xb41b('0x42'),_0xb41b('0x2d')],[db[_0xb41b('0x1d')]['fn']('COUNT',db['sequelize'][_0xb41b('0x1e')]('id')),_0xb41b('0x45')],[db['sequelize']['fn'](_0xb41b('0x20'),db[_0xb41b('0x1d')]['fn']('IF',db['sequelize'][_0xb41b('0x23')](_0xb41b('0x21')))),_0xb41b('0x46')]],'group':[_0xb41b('0x42')]})[_0xb41b('0xb')](function(_0x2c08ee){logger[_0xb41b('0xc')](_0xb41b('0x43'),_0x231042);logger[_0xb41b('0xf')](_0xb41b('0x43'),_0x231042,JSON['stringify'](_0x2c08ee));_0x2bae07(_0x2c08ee);})[_0xb41b('0x14')](function(_0x2e2927){logger['error']('GetCampaignHopperHistory',_0x2e2927[_0xb41b('0x12')],_0x231042);_0x5ca174(_0x305f0e[_0xb41b('0x10')](0x1f4,_0x2e2927[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index dca1691..b9de1f4 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 _0xeacf=['../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42e051,_0x57e549){var _0x1d9a3b=function(_0x1f87cc){while(--_0x1f87cc){_0x42e051['push'](_0x42e051['shift']());}};_0x1d9a3b(++_0x57e549);}(_0xeacf,0xe9));var _0xfeac=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xeacf[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0xfeac('0x0'));var util=require(_0xfeac('0x1'));var path=require(_0xfeac('0x2'));var timeout=require(_0xfeac('0x3'));var express=require(_0xfeac('0x4'));var router=express[_0xfeac('0x5')]();var fs_extra=require(_0xfeac('0x6'));var auth=require(_0xfeac('0x7'));var interaction=require(_0xfeac('0x8'));var config=require('../../config/environment');var controller=require(_0xfeac('0x9'));router['get']('/',auth[_0xfeac('0xa')](),controller[_0xfeac('0xb')]);router[_0xfeac('0xc')](_0xfeac('0xd'),auth[_0xfeac('0xa')](),controller['describe']);router[_0xfeac('0xc')](_0xfeac('0xe'),auth['isAuthenticated'](),controller[_0xfeac('0xf')]);router['post']('/',auth[_0xfeac('0xa')](),controller[_0xfeac('0x10')]);router[_0xfeac('0x11')]('/:id',auth[_0xfeac('0xa')](),controller[_0xfeac('0x12')]);module[_0xfeac('0x13')]=router; \ No newline at end of file +var _0x7117=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','path','express'];(function(_0x310008,_0x273bd1){var _0x1395f3=function(_0x307631){while(--_0x307631){_0x310008['push'](_0x310008['shift']());}};_0x1395f3(++_0x273bd1);}(_0x7117,0xe2));var _0x7711=function(_0x5ef6af,_0x534c46){_0x5ef6af=_0x5ef6af-0x0;var _0x3c1b5c=_0x7117[_0x5ef6af];return _0x3c1b5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7711('0x0'));var timeout=require('connect-timeout');var express=require(_0x7711('0x1'));var router=express[_0x7711('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7711('0x3'));var interaction=require(_0x7711('0x4'));var config=require(_0x7711('0x5'));var controller=require(_0x7711('0x6'));router[_0x7711('0x7')]('/',auth[_0x7711('0x8')](),controller[_0x7711('0x9')]);router[_0x7711('0x7')](_0x7711('0xa'),auth[_0x7711('0x8')](),controller[_0x7711('0xb')]);router['get'](_0x7711('0xc'),auth[_0x7711('0x8')](),controller[_0x7711('0xd')]);router[_0x7711('0xe')]('/',auth[_0x7711('0x8')](),controller[_0x7711('0xf')]);router[_0x7711('0x10')](_0x7711('0xc'),auth[_0x7711('0x8')](),controller[_0x7711('0x11')]);module[_0x7711('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 4e07abc..a10de95 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 _0x50a6=['exports','STRING','sequelize'];(function(_0x11f769,_0x5d296a){var _0x59a6b8=function(_0x2358f3){while(--_0x2358f3){_0x11f769['push'](_0x11f769['shift']());}};_0x59a6b8(++_0x5d296a);}(_0x50a6,0xa4));var _0x650a=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x50a6[_0x2e9b5b];return _0x734c46;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x650a('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc76=['name','exports','STRING'];(function(_0x1c0cc0,_0x279908){var _0x20f630=function(_0xb17a2c){while(--_0xb17a2c){_0x1c0cc0['push'](_0x1c0cc0['shift']());}};_0x20f630(++_0x279908);}(_0xfc76,0xb5));var _0x6fc7=function(_0x3f1ec0,_0x2efde4){_0x3f1ec0=_0x3f1ec0-0x0;var _0x21b747=_0xfc76[_0x3f1ec0];return _0x21b747;};'use strict';var Sequelize=require('sequelize');module[_0x6fc7('0x0')]={'name':{'type':Sequelize[_0x6fc7('0x1')],'unique':_0x6fc7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fc7('0x1')]},'dialPrefix':{'type':Sequelize[_0x6fc7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 53e359a..19f7cd4 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 _0x10d5=['defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','stack','send','index','map','CmList','fieldName','type','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','rows','catch','show','keys','rawAttributes','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','select','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','toString','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','BOOLEAN'];(function(_0x439cdf,_0x5df90f){var _0x545e6f=function(_0x296263){while(--_0x296263){_0x439cdf['push'](_0x439cdf['shift']());}};_0x545e6f(++_0x5df90f);}(_0x10d5,0xbc));var _0x510d=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x10d5[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x510d('0x0'));var rimraf=require(_0x510d('0x1'));var zipdir=require(_0x510d('0x2'));var jsonpatch=require(_0x510d('0x3'));var rp=require(_0x510d('0x4'));var moment=require(_0x510d('0x5'));var BPromise=require(_0x510d('0x6'));var Mustache=require(_0x510d('0x7'));var util=require(_0x510d('0x8'));var path=require(_0x510d('0x9'));var sox=require(_0x510d('0xa'));var csv=require(_0x510d('0xb'));var ejs=require(_0x510d('0xc'));var fs=require('fs');var fs_extra=require(_0x510d('0xd'));var _=require(_0x510d('0xe'));var squel=require(_0x510d('0xf'));var crypto=require(_0x510d('0x10'));var jsforce=require(_0x510d('0x11'));var deskjs=require(_0x510d('0x12'));var toCsv=require(_0x510d('0xb'));var querystring=require(_0x510d('0x13'));var Papa=require(_0x510d('0x14'));var Redis=require('ioredis');var authService=require(_0x510d('0x15'));var qs=require(_0x510d('0x16'));var as=require(_0x510d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x510d('0x18'))('api');var utils=require(_0x510d('0x19'));var config=require(_0x510d('0x1a'));var licenseUtil=require(_0x510d('0x1b'));var db=require(_0x510d('0x1c'))['db'];var csv_results;config[_0x510d('0x1d')]=_[_0x510d('0x1e')](config[_0x510d('0x1d')],{'host':_0x510d('0x1f'),'port':0x18eb});var socket=require(_0x510d('0x20'))(new Redis(config[_0x510d('0x1d')]));require(_0x510d('0x21'))[_0x510d('0x22')](socket);function respondWithStatusCode(_0x2df41f,_0x2aeaf2){_0x2aeaf2=_0x2aeaf2||0xcc;return function(_0x46bfa3){if(_0x46bfa3){return _0x2df41f[_0x510d('0x23')](_0x2aeaf2);}return _0x2df41f['status'](_0x2aeaf2)[_0x510d('0x24')]();};}function respondWithResult(_0x390b9b,_0x389687){_0x389687=_0x389687||0xc8;return function(_0x5f5754){if(_0x5f5754){return _0x390b9b[_0x510d('0x25')](_0x389687)[_0x510d('0x26')](_0x5f5754);}};}function respondWithFilteredResult(_0x184a3e,_0x5606ee){return function(_0x314776){if(_0x314776){var _0x44269d=typeof _0x5606ee[_0x510d('0x27')]===_0x510d('0x28')&&typeof _0x5606ee[_0x510d('0x29')]===_0x510d('0x28');var _0x23d119=_0x314776[_0x510d('0x2a')];var _0x19572b=_0x44269d?0x0:_0x5606ee[_0x510d('0x27')];var _0x23178c=_0x44269d?_0x314776[_0x510d('0x2a')]:_0x5606ee['offset']+_0x5606ee['limit'];var _0x18580e;if(_0x23178c>=_0x23d119){_0x23178c=_0x23d119;_0x18580e=0xc8;}else{_0x18580e=0xce;}_0x184a3e[_0x510d('0x25')](_0x18580e);return _0x184a3e[_0x510d('0x2b')](_0x510d('0x2c'),_0x19572b+'-'+_0x23178c+'/'+_0x23d119)[_0x510d('0x26')](_0x314776);}return null;};}function patchUpdates(_0x4abaaa){return function(_0x381f41){try{jsonpatch[_0x510d('0x2d')](_0x381f41,_0x4abaaa,!![]);}catch(_0x63df19){return BPromise[_0x510d('0x2e')](_0x63df19);}return _0x381f41[_0x510d('0x2f')]();};}function saveUpdates(_0xcb0d9b,_0x125e17){return function(_0x2ba597){if(_0x2ba597){return _0x2ba597[_0x510d('0x30')](_0xcb0d9b)['then'](function(_0x35875c){return _0x35875c;});}return null;};}function removeEntity(_0x1711d5,_0x574d4d){return function(_0x444c85){if(_0x444c85){return _0x444c85[_0x510d('0x31')]()[_0x510d('0x32')](function(){var _0x3b391f=_0x444c85[_0x510d('0x33')]({'plain':!![]});var _0x138f31=_0x510d('0x34');return db[_0x510d('0x35')][_0x510d('0x31')]({'where':{'type':_0x138f31,'resourceId':_0x3b391f['id']}})[_0x510d('0x32')](function(){return _0x444c85;});})[_0x510d('0x32')](function(){_0x1711d5[_0x510d('0x25')](0xcc)[_0x510d('0x24')]();});}};}function handleEntityNotFound(_0x57ff2b,_0x1f8d60){return function(_0xb467a8){if(!_0xb467a8){_0x57ff2b[_0x510d('0x23')](0x194);}return _0xb467a8;};}function handleError(_0x32e75e,_0x5f4d08){_0x5f4d08=_0x5f4d08||0x1f4;return function(_0x54f920){logger['error'](_0x54f920[_0x510d('0x36')]);if(_0x54f920['name']){delete _0x54f920['name'];}_0x32e75e[_0x510d('0x25')](_0x5f4d08)[_0x510d('0x37')](_0x54f920);};}exports[_0x510d('0x38')]=function(_0x239bb6,_0x31ea4b){var _0x1d0716={},_0x23acc1={},_0x6f30fc={'count':0x0,'rows':[]};var _0x229050=_[_0x510d('0x39')](db[_0x510d('0x3a')]['rawAttributes'],function(_0x3a1756){return{'name':_0x3a1756[_0x510d('0x3b')],'type':_0x3a1756[_0x510d('0x3c')]['key']};});_0x23acc1['model']=_[_0x510d('0x39')](_0x229050,_0x510d('0x3d'));_0x23acc1[_0x510d('0x3e')]=_['keys'](_0x239bb6[_0x510d('0x3e')]);_0x23acc1[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x23acc1[_0x510d('0x41')],_0x23acc1['query']);_0x1d0716['attributes']=_[_0x510d('0x40')](_0x23acc1[_0x510d('0x41')],qs[_0x510d('0x42')](_0x239bb6[_0x510d('0x3e')][_0x510d('0x42')]));_0x1d0716[_0x510d('0x43')]=_0x1d0716[_0x510d('0x43')]['length']?_0x1d0716['attributes']:_0x23acc1[_0x510d('0x41')];if(!_0x239bb6[_0x510d('0x3e')][_0x510d('0x44')](_0x510d('0x45'))){_0x1d0716[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x239bb6['query'][_0x510d('0x29')]);_0x1d0716[_0x510d('0x27')]=qs['offset'](_0x239bb6[_0x510d('0x3e')]['offset']);}_0x1d0716[_0x510d('0x46')]=qs[_0x510d('0x47')](_0x239bb6[_0x510d('0x3e')]['sort']);_0x1d0716[_0x510d('0x48')]=qs[_0x510d('0x3f')](_['pick'](_0x239bb6[_0x510d('0x3e')],_0x23acc1[_0x510d('0x3f')]),_0x229050);if(_0x239bb6[_0x510d('0x3e')]['filter']){_0x1d0716[_0x510d('0x48')]=_[_0x510d('0x49')](_0x1d0716[_0x510d('0x48')],{'$or':_['map'](_0x229050,function(_0x34dc89){if(_0x34dc89[_0x510d('0x3c')]!=='VIRTUAL'){var _0x2ba1c6={};_0x2ba1c6[_0x34dc89[_0x510d('0x3d')]]={'$like':'%'+_0x239bb6[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x2ba1c6;}})});}_0x1d0716=_[_0x510d('0x49')]({},_0x1d0716,_0x239bb6['options']);var _0x5564a4={'where':_0x1d0716[_0x510d('0x48')]};return db[_0x510d('0x3a')][_0x510d('0x2a')](_0x5564a4)['then'](function(_0x13674b){_0x6f30fc[_0x510d('0x2a')]=_0x13674b;if(_0x239bb6[_0x510d('0x3e')]['includeAll']){_0x1d0716[_0x510d('0x4b')]=[{'all':!![]}];}return db[_0x510d('0x3a')]['findAll'](_0x1d0716);})[_0x510d('0x32')](function(_0x5144e0){_0x6f30fc[_0x510d('0x4c')]=_0x5144e0;return _0x6f30fc;})[_0x510d('0x32')](respondWithFilteredResult(_0x31ea4b,_0x1d0716))[_0x510d('0x4d')](handleError(_0x31ea4b,null));};exports[_0x510d('0x4e')]=function(_0x4dbe93,_0x23cf64){var _0x3ce79f={'raw':![],'where':{'id':_0x4dbe93['params']['id']}},_0x5b14bb={};_0x5b14bb[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0x3a')][_0x510d('0x50')]);_0x5b14bb[_0x510d('0x3e')]=_[_0x510d('0x4f')](_0x4dbe93['query']);_0x5b14bb[_0x510d('0x3f')]=_['intersection'](_0x5b14bb[_0x510d('0x41')],_0x5b14bb['query']);_0x3ce79f[_0x510d('0x43')]=_[_0x510d('0x40')](_0x5b14bb[_0x510d('0x41')],qs[_0x510d('0x42')](_0x4dbe93['query'][_0x510d('0x42')]));_0x3ce79f[_0x510d('0x43')]=_0x3ce79f[_0x510d('0x43')][_0x510d('0x51')]?_0x3ce79f[_0x510d('0x43')]:_0x5b14bb['model'];if(_0x4dbe93['query']['includeAll']){_0x3ce79f[_0x510d('0x4b')]=[{'all':!![]}];}_0x3ce79f=_[_0x510d('0x49')]({},_0x3ce79f,_0x4dbe93[_0x510d('0x52')]);return db['CmList'][_0x510d('0x53')](_0x3ce79f)[_0x510d('0x32')](handleEntityNotFound(_0x23cf64,null))[_0x510d('0x32')](respondWithResult(_0x23cf64,null))[_0x510d('0x4d')](handleError(_0x23cf64,null));};exports['create']=function(_0x2895c8,_0x27e7c2){return db[_0x510d('0x3a')][_0x510d('0x54')](_0x2895c8['body'],{})[_0x510d('0x32')](function(_0x16ee79){var _0x3cad89=_0x2895c8[_0x510d('0x55')][_0x510d('0x33')]({'plain':!![]});if(!_0x3cad89)throw new Error(_0x510d('0x56'));if(_0x3cad89[_0x510d('0x57')]==='user'){var _0x5e2598=_0x16ee79['get']({'plain':!![]});var _0x1c3808=_0x510d('0x34');return db[_0x510d('0x58')]['find']({'where':{'name':_0x1c3808,'userProfileId':_0x3cad89[_0x510d('0x59')]},'raw':!![]})[_0x510d('0x32')](function(_0x1ba7e8){if(_0x1ba7e8&&_0x1ba7e8[_0x510d('0x5a')]===0x0){return db[_0x510d('0x35')][_0x510d('0x54')]({'name':_0x5e2598[_0x510d('0x3d')],'resourceId':_0x5e2598['id'],'type':_0x1ba7e8[_0x510d('0x3d')],'sectionId':_0x1ba7e8['id']},{})[_0x510d('0x32')](function(){return _0x16ee79;});}else{return _0x16ee79;}})[_0x510d('0x4d')](function(_0x33977d){logger[_0x510d('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33977d);throw _0x33977d;});}return _0x16ee79;})[_0x510d('0x32')](respondWithResult(_0x27e7c2,0xc9))[_0x510d('0x4d')](handleError(_0x27e7c2,null));};exports[_0x510d('0x30')]=function(_0xcd4987,_0x2936da){if(_0xcd4987[_0x510d('0x5c')]['id']){delete _0xcd4987[_0x510d('0x5c')]['id'];}return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0xcd4987[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x2936da,null))[_0x510d('0x32')](saveUpdates(_0xcd4987['body'],null))['then'](respondWithResult(_0x2936da,null))['catch'](handleError(_0x2936da,null));};exports[_0x510d('0x31')]=function(_0x1da7eb,_0x43bb75){return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0x1da7eb[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x43bb75,null))[_0x510d('0x32')](removeEntity(_0x43bb75,null))[_0x510d('0x4d')](handleError(_0x43bb75,null));};exports[_0x510d('0x5e')]=function(_0x13c52c,_0xf99957){return db[_0x510d('0x3a')][_0x510d('0x5e')]()[_0x510d('0x32')](respondWithResult(_0xf99957,null))[_0x510d('0x4d')](handleError(_0xf99957,null));};exports[_0x510d('0x5f')]=function(_0x43f370,_0x5f5a85,_0x37034b){if(_0x43f370[_0x510d('0x5c')]['id']){delete _0x43f370[_0x510d('0x5c')]['id'];}return db['CmList']['find']({'where':{'id':_0x43f370['params']['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x5f5a85,null))['then'](function(_0x446e27){if(_0x446e27){_0x43f370[_0x510d('0x5c')][_0x510d('0x60')]=_0x446e27['id'];return db[_0x510d('0x61')][_0x510d('0x54')](_0x43f370['body']);}})[_0x510d('0x32')](respondWithResult(_0x5f5a85,null))[_0x510d('0x4d')](handleError(_0x5f5a85,null));};exports[_0x510d('0x62')]=function(_0x2d3b1f,_0x5dbbeb,_0x1daa08){var _0x509a90={'raw':![],'where':{}};var _0x3f61e4={};var _0x40f27f={'count':0x0,'rows':[]};return db[_0x510d('0x3a')][_0x510d('0x63')]({'where':{'id':_0x2d3b1f[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5dbbeb,null))[_0x510d('0x32')](function(_0x892e0c){if(_0x892e0c){_0x3f61e4['model']=_[_0x510d('0x4f')](db[_0x510d('0x61')][_0x510d('0x50')]);_0x3f61e4[_0x510d('0x3e')]=_['keys'](_0x2d3b1f[_0x510d('0x3e')]);_0x3f61e4[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x3f61e4['model'],_0x3f61e4[_0x510d('0x3e')]);_0x509a90[_0x510d('0x43')]=_[_0x510d('0x40')](_0x3f61e4[_0x510d('0x41')],qs['fields'](_0x2d3b1f[_0x510d('0x3e')][_0x510d('0x42')]));_0x509a90['attributes']=_0x509a90[_0x510d('0x43')]['length']?_0x509a90[_0x510d('0x43')]:_0x3f61e4[_0x510d('0x41')];if(!_0x2d3b1f['query'][_0x510d('0x44')](_0x510d('0x45'))){_0x509a90[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x2d3b1f['query'][_0x510d('0x29')]);_0x509a90[_0x510d('0x27')]=qs[_0x510d('0x27')](_0x2d3b1f['query'][_0x510d('0x27')]);}_0x509a90[_0x510d('0x46')]=qs['sort'](_0x2d3b1f[_0x510d('0x3e')][_0x510d('0x47')]);_0x509a90[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x2d3b1f[_0x510d('0x3e')],_0x3f61e4[_0x510d('0x3f')]));_0x509a90['where'][_0x510d('0x60')]=_0x892e0c['id'];if(_0x2d3b1f['query'][_0x510d('0x4a')]){_0x509a90[_0x510d('0x48')]=_[_0x510d('0x49')](_0x509a90[_0x510d('0x48')],{'$or':_['map'](_0x509a90['attributes'],function(_0x35b501){var _0xfb1569={};_0xfb1569[_0x35b501]={'$like':'%'+_0x2d3b1f['query'][_0x510d('0x4a')]+'%'};return _0xfb1569;})});}_0x509a90=_[_0x510d('0x49')]({},_0x509a90,_0x2d3b1f['options']);return db[_0x510d('0x61')][_0x510d('0x2a')]({'where':_0x509a90[_0x510d('0x48')]})[_0x510d('0x32')](function(_0x12c67a){_0x40f27f[_0x510d('0x2a')]=_0x12c67a;if(_0x2d3b1f[_0x510d('0x3e')]['includeAll']){_0x509a90[_0x510d('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x510d('0x65')](_0x509a90);})[_0x510d('0x32')](function(_0x349eff){_0x40f27f[_0x510d('0x4c')]=_0x349eff;return _0x40f27f;});}})[_0x510d('0x32')](respondWithFilteredResult(_0x5dbbeb,_0x509a90))[_0x510d('0x4d')](handleError(_0x5dbbeb,null));};exports[_0x510d('0x66')]=function(_0x3a9983,_0x286f6b,_0x1d3f52){return db['CmList'][_0x510d('0x53')]({'where':{'id':_0x3a9983[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x286f6b,null))[_0x510d('0x32')](function(_0x347c72){if(_0x347c72){return _0x347c72[_0x510d('0x66')](_0x3a9983[_0x510d('0x3e')][_0x510d('0x67')]);}})['then'](respondWithStatusCode(_0x286f6b,null))[_0x510d('0x4d')](handleError(_0x286f6b,null));};exports[_0x510d('0x68')]=function(_0x2e26f5,_0x5893bd,_0x2c51e7){return db[_0x510d('0x3a')][_0x510d('0x53')]({'where':{'id':_0x2e26f5[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5893bd,null))[_0x510d('0x32')](function(_0x357e13){if(_0x357e13){var _0x29c599=[];var _0x298298={'success':[],'errors':[]};return db[_0x510d('0x69')][_0x510d('0x5e')]()['then'](function(_0x39bc64){if(_0x2e26f5['body'][_0x510d('0x6a')]&&_[_0x510d('0x6b')](_0x2e26f5['body'][_0x510d('0x6a')])){if(_0x2e26f5[_0x510d('0x5c')]['tags'][_0x510d('0x51')]){_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')][_0x510d('0x6c')](';')+';';}else{_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=null;}}else{_0x2e26f5[_0x510d('0x5c')][_0x510d('0x6a')]=null;}if(_0x2e26f5['body']&&_[_0x510d('0x6b')](_0x2e26f5[_0x510d('0x5c')])){for(var _0x5e2862=0x0;_0x5e2862<_0x2e26f5[_0x510d('0x5c')]['length'];_0x5e2862+=0x1){_0x2e26f5[_0x510d('0x5c')][_0x5e2862]['ListId']=_0x2e26f5['params']['id'];_0x29c599[_0x510d('0x6d')](_0x2e26f5[_0x510d('0x5c')][_0x5e2862]);}return BPromise[_0x510d('0x6e')](_0x29c599,function(_0x4733a5){return db[_0x510d('0x69')][_0x510d('0x54')](_['omit'](_0x4733a5,[_0x510d('0x67'),'id'])||{},{'fields':_[_0x510d('0x4f')](_0x39bc64),'raw':!![]})[_0x510d('0x32')](function(_0x2c03b9){_0x298298[_0x510d('0x6f')][_0x510d('0x6d')](_0x2c03b9[_0x510d('0x70')]);})['catch'](function(_0x13985c){_0x298298[_0x510d('0x71')][_0x510d('0x6d')]({'data':_0x4733a5,'error':_0x13985c[_0x510d('0x72')]});});})[_0x510d('0x32')](function(_0x4dcd3c){return _0x298298;})[_0x510d('0x4d')](function(_0x375c6f){return _0x375c6f;});}else{_0x5893bd[_0x510d('0x25')](0x190)[_0x510d('0x26')]({'message':_0x510d('0x73')});}});}})[_0x510d('0x32')](respondWithResult(_0x5893bd,null))[_0x510d('0x4d')](handleError(_0x5893bd,null));};exports[_0x510d('0x74')]=function(_0x136660,_0x1164de,_0x1d92f1){var _0x18ee60;return db[_0x510d('0x3a')]['find']({'where':{'id':_0x136660['params']['id']},'include':[{'model':db[_0x510d('0x75')],'as':_0x510d('0x76')}]})[_0x510d('0x32')](handleEntityNotFound(_0x1164de,null))[_0x510d('0x32')](function(_0x351485){if(_0x351485){_0x18ee60=_0x351485;return db[_0x510d('0x69')]['rawAttributes'];}})[_0x510d('0x32')](function(_0x52329b){if(_0x52329b){var _0x2af165={};var _0x1798bb={};_0x1798bb[_0x510d('0x41')]=_[_0x510d('0x77')](_[_0x510d('0x4f')](_0x52329b),_[_0x510d('0x39')](_0x18ee60['CustomFields'],function(_0x26e2cb){return util[_0x510d('0x78')]('cf_%d',_0x26e2cb['id']);}));_0x1798bb['query']=_[_0x510d('0x4f')](_0x136660[_0x510d('0x3e')]);_0x1798bb[_0x510d('0x3f')]=_[_0x510d('0x40')](_0x1798bb['model'],_0x1798bb[_0x510d('0x3e')]);_0x2af165[_0x510d('0x43')]=_['intersection'](_0x1798bb[_0x510d('0x41')],qs[_0x510d('0x42')](_0x136660[_0x510d('0x3e')][_0x510d('0x42')]));_0x2af165[_0x510d('0x43')]=_0x2af165[_0x510d('0x43')][_0x510d('0x51')]?_0x2af165['attributes']:_0x1798bb['model'];if(!_0x136660[_0x510d('0x3e')]['hasOwnProperty'](_0x510d('0x45'))){_0x2af165[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x136660['query'][_0x510d('0x29')]);_0x2af165['offset']=qs['offset'](_0x136660[_0x510d('0x3e')]['offset']);}_0x2af165['order']=qs['sort'](_0x136660[_0x510d('0x3e')][_0x510d('0x47')]);_0x2af165[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x136660[_0x510d('0x3e')],_0x1798bb[_0x510d('0x3f')]));_0x2af165[_0x510d('0x79')]=!![];if(_0x136660[_0x510d('0x3e')][_0x510d('0x4a')]){_0x2af165[_0x510d('0x48')]=_[_0x510d('0x49')](_0x2af165[_0x510d('0x48')],{'$or':_['map'](_0x2af165[_0x510d('0x43')],function(_0x595a68){var _0x395b5d={};_0x395b5d[_0x595a68]={'$like':'%'+_0x136660[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x395b5d;})});}_0x2af165=_[_0x510d('0x49')]({},_0x2af165,_0x136660[_0x510d('0x52')]);return _0x18ee60[_0x510d('0x74')](_0x2af165);}})[_0x510d('0x32')](respondWithResult(_0x1164de,null))[_0x510d('0x4d')](handleError(_0x1164de,null));};exports['getContactsCsv']=function(_0x39cab1,_0x22379f,_0x4b5c9b){var _0x172250;var _0x2fd668;var _0x2f7b9b;var _0x5a57ac=_0x39cab1[_0x510d('0x5d')]['id'];csv_results=[];return db[_0x510d('0x7a')][_0x510d('0x65')]({'attributes':['id',_0x510d('0x3d')],'raw':!![],'order':[_0x510d('0x7b')]})[_0x510d('0x32')](function(_0x1d2f2d){_0x172250=_0x1d2f2d;var _0xcb3fcf=_[_0x510d('0x4f')](db[_0x510d('0x69')]['rawAttributes']);return db[_0x510d('0x75')][_0x510d('0x65')]({'raw':!![],'attributes':['id',_0x510d('0x7c')]})[_0x510d('0x32')](function(_0x2aa5fd){_0x2fd668=_0x2aa5fd;var _0x19b28e=squel['select']()[_0x510d('0x42')](_0xcb3fcf)[_0x510d('0x7d')](_0x510d('0x7e'),'c')[_0x510d('0x48')](_0x510d('0x7f'),_0x5a57ac)[_0x510d('0x48')](_0x510d('0x80'))['distinct']();for(var _0x1c1f12=0x0;_0x1c1f12<_0x2fd668[_0x510d('0x51')];_0x1c1f12++){_0x19b28e[_0x510d('0x81')](_0x510d('0x82')+_0x2fd668[_0x1c1f12]['id'],_0x510d('0x83')+_0x2fd668[_0x1c1f12][_0x510d('0x7c')]);}for(var _0x1c1f12=0x0;_0x1c1f12<_0x172250[_0x510d('0x51')];_0x1c1f12++){_0x19b28e[_0x510d('0x81')](squel[_0x510d('0x84')]()['field']('item')[_0x510d('0x7d')](_0x510d('0x85'))[_0x510d('0x48')]('ItemTypeId\x20=\x20?',_0x172250[_0x1c1f12]['id'])[_0x510d('0x48')]('CmContactId\x20=\x20c.id'),_0x510d('0x86')+_0x172250[_0x1c1f12][_0x510d('0x3d')]);_0x19b28e['field'](squel[_0x510d('0x84')]()['field'](_0x510d('0x87'))[_0x510d('0x7d')](_0x510d('0x85'))[_0x510d('0x48')](_0x510d('0x88'),_0x172250[_0x1c1f12]['id'])['where']('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x172250[_0x1c1f12][_0x510d('0x3d')]);}var _0x42ffd8=[];_0x42ffd8['push'](_0x19b28e[_0x510d('0x89')]());BPromise[_0x510d('0x6e')](_0x42ffd8,handleQuery)[_0x510d('0x32')](function(_0x1ca286){handleQuery(_0x19b28e[_0x510d('0x89')]());var _0x43899c=csv_results[0x0];if(!_[_0x510d('0x8a')](_0x43899c)){var _0x53d427=toCsv(_0x43899c);var _0x2e81cf=Date[_0x510d('0x8b')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x5a57ac,_0x2e81cf),_0x53d427);_0x22379f[_0x510d('0x8c')](_0x510d('0x8d'),_0x510d('0x8e')+util[_0x510d('0x78')](_0x510d('0x8f'),_0x5a57ac,_0x2e81cf));_0x22379f['setHeader'](_0x510d('0x90'),_0x510d('0x91'));return _0x22379f[_0x510d('0x92')](util['format']('/tmp/list_%d_%s.csv',_0x5a57ac,_0x2e81cf));}else{return _0x22379f['sendStatus'](0xcc);}});});});};exports[_0x510d('0x93')]=function(_0x4c2ade,_0x21c53d,_0x670eac){var _0x2a2a6b;delete _0x4c2ade[_0x510d('0x5c')]['id'];return db[_0x510d('0x3a')]['findOne']({'where':{'id':_0x4c2ade[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x21c53d,null))[_0x510d('0x32')](function(_0x1e895d){if(_0x1e895d){return db[_0x510d('0x94')][_0x510d('0x95')](function(_0x155bd5){return db[_0x510d('0x75')][_0x510d('0x54')](_0x4c2ade[_0x510d('0x5c')],{'transaction':_0x155bd5})['then'](function(_0x4e9d00){_0x2a2a6b=_0x4e9d00;return _0x1e895d['addCustomFields'](_0x4e9d00,{'transaction':_0x155bd5});})['then'](function(){var _0xa7cc1d={'type':db[_0x510d('0x96')]['TEXT'],'transaction':_0x155bd5};switch(_0x4c2ade[_0x510d('0x5c')][_0x510d('0x3c')]){case _0x510d('0x97'):_0xa7cc1d['type']=db['Sequelize'][_0x510d('0x98')];break;case _0x510d('0x99'):_0xa7cc1d[_0x510d('0x3c')]=db[_0x510d('0x96')][_0x510d('0x9a')];break;case'switch':_0xa7cc1d[_0x510d('0x3c')]=db['Sequelize'][_0x510d('0x9b')];_0xa7cc1d[_0x510d('0x9c')]=![];break;default:}return db['sequelize'][_0x510d('0x9d')]['addColumn'](_0x510d('0x7e'),util[_0x510d('0x78')](_0x510d('0x9e'),_0x2a2a6b['id']),_0xa7cc1d);})[_0x510d('0x32')](function(){return _0x2a2a6b;});});}})[_0x510d('0x32')](respondWithResult(_0x21c53d,null))[_0x510d('0x4d')](handleError(_0x21c53d,null));};exports[_0x510d('0x9f')]=function(_0x374fdc,_0x52cd4c,_0x25298a){var _0x2b2d38={};var _0x11c9f8={};var _0x249d04;var _0x300139;return db[_0x510d('0x3a')][_0x510d('0x63')]({'where':{'id':_0x374fdc[_0x510d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52cd4c,null))['then'](function(_0x398e71){if(_0x398e71){_0x249d04=_0x398e71;_0x11c9f8[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0x75')]['rawAttributes']);_0x11c9f8['query']=_[_0x510d('0x4f')](_0x374fdc[_0x510d('0x3e')]);_0x11c9f8['filters']=_[_0x510d('0x40')](_0x11c9f8[_0x510d('0x41')],_0x11c9f8['query']);_0x2b2d38[_0x510d('0x43')]=_[_0x510d('0x40')](_0x11c9f8[_0x510d('0x41')],qs[_0x510d('0x42')](_0x374fdc['query']['fields']));_0x2b2d38[_0x510d('0x43')]=_0x2b2d38['attributes']['length']?_0x2b2d38['attributes']:_0x11c9f8[_0x510d('0x41')];_0x2b2d38['order']=qs[_0x510d('0x47')](_0x374fdc['query'][_0x510d('0x47')]);_0x2b2d38[_0x510d('0x48')]=qs[_0x510d('0x3f')](_[_0x510d('0x64')](_0x374fdc['query'],_0x11c9f8[_0x510d('0x3f')]));_0x2b2d38[_0x510d('0x48')]=_['merge'](_0x2b2d38[_0x510d('0x48')],{'$or':[{'ListId':_0x398e71['id']},{'ListId':null}]});if(_0x374fdc[_0x510d('0x3e')][_0x510d('0x4a')]){_0x2b2d38['where']=_['merge'](_0x2b2d38['where'],{'$or':_['map'](_0x2b2d38[_0x510d('0x43')],function(_0x294ab4){var _0x1b0d2c={};_0x1b0d2c[_0x294ab4]={'$like':'%'+_0x374fdc[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x1b0d2c;})});}_0x2b2d38=_[_0x510d('0x49')]({},_0x2b2d38,_0x374fdc[_0x510d('0x52')]);return db[_0x510d('0x75')][_0x510d('0xa0')](_0x2b2d38);}})[_0x510d('0x32')](respondWithResult(_0x52cd4c,null))[_0x510d('0x4d')](handleError(_0x52cd4c,null));};exports[_0x510d('0xa1')]=function(_0x1b6abe,_0x2acd88){return db[_0x510d('0x75')]['findAndCountAll']({'where':{'ListId':null}})[_0x510d('0x32')](handleEntityNotFound(_0x2acd88,null))[_0x510d('0x32')](function(_0x461c23){return _0x461c23;})['then'](respondWithResult(_0x2acd88,null))['catch'](handleError(_0x2acd88,null));};exports['addAgents']=function(_0x76e43,_0x34d8d3,_0x463952){return db['CmList'][_0x510d('0x53')]({'where':{'id':_0x76e43[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x34d8d3,null))[_0x510d('0x32')](function(_0x1b91dc){if(_0x1b91dc){return _0x1b91dc[_0x510d('0xa2')](_0x76e43[_0x510d('0x5c')]['ids'],_[_0x510d('0xa3')](_0x76e43['body'],[_0x510d('0x67'),'id'])||{})[_0x510d('0xa4')](function(_0x582cf6){for(var _0xd5c1af=0x0;_0xd5c1af<_0x76e43['body'][_0x510d('0x67')][_0x510d('0x51')];_0xd5c1af+=0x1){socket[_0x510d('0xa5')](_0x510d('0xa6'),{'UserId':Number(_0x76e43[_0x510d('0x5c')][_0x510d('0x67')][_0xd5c1af]),'CmListId':Number(_0x76e43['params']['id'])});}return _0x582cf6;});}})[_0x510d('0x32')](respondWithResult(_0x34d8d3,null))[_0x510d('0x4d')](handleError(_0x34d8d3,null));};exports[_0x510d('0xa7')]=function(_0x122ed1,_0x1abb13,_0x178b69){return db[_0x510d('0x3a')]['find']({'where':{'id':_0x122ed1[_0x510d('0x5d')]['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x1abb13,null))[_0x510d('0x32')](function(_0x4954cf){if(_0x4954cf){return _0x4954cf[_0x510d('0xa7')](_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')])[_0x510d('0x32')](function(){if(_[_0x510d('0x6b')](_0x122ed1['query']['ids'])){for(var _0x294b0a=0x0;_0x294b0a<_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')][_0x510d('0x51')];_0x294b0a+=0x1){socket[_0x510d('0xa5')](_0x510d('0xa8'),{'UserId':Number(_0x122ed1[_0x510d('0x3e')][_0x510d('0x67')][_0x294b0a]),'CmListId':Number(_0x122ed1[_0x510d('0x5d')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x122ed1[_0x510d('0x3e')]['ids']),'CmListId':Number(_0x122ed1[_0x510d('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1abb13,null))['catch'](handleError(_0x1abb13,null));};exports[_0x510d('0xa9')]=function(_0x40c5cd,_0x247aca,_0x289848){var _0x48c2aa={};var _0xa2a594={};var _0x3101c4;var _0x73ab59;return db['CmList']['findOne']({'where':{'id':_0x40c5cd['params']['id']}})[_0x510d('0x32')](handleEntityNotFound(_0x247aca,null))[_0x510d('0x32')](function(_0x3761ec){if(_0x3761ec){_0x3101c4=_0x3761ec;_0xa2a594[_0x510d('0x41')]=_[_0x510d('0x4f')](db[_0x510d('0xaa')][_0x510d('0x50')]);_0xa2a594['query']=_['keys'](_0x40c5cd[_0x510d('0x3e')]);_0xa2a594[_0x510d('0x3f')]=_[_0x510d('0x40')](_0xa2a594[_0x510d('0x41')],_0xa2a594[_0x510d('0x3e')]);_0x48c2aa[_0x510d('0x43')]=_['intersection'](_0xa2a594[_0x510d('0x41')],qs['fields'](_0x40c5cd[_0x510d('0x3e')][_0x510d('0x42')]));_0x48c2aa[_0x510d('0x43')]=_0x48c2aa[_0x510d('0x43')][_0x510d('0x51')]?_0x48c2aa['attributes']:_0xa2a594['model'];_0x48c2aa[_0x510d('0x46')]=qs['sort'](_0x40c5cd['query'][_0x510d('0x47')]);_0x48c2aa[_0x510d('0x48')]=qs['filters'](_[_0x510d('0x64')](_0x40c5cd['query'],_0xa2a594[_0x510d('0x3f')]));if(_0x40c5cd[_0x510d('0x3e')][_0x510d('0x4a')]){_0x48c2aa[_0x510d('0x48')]=_[_0x510d('0x49')](_0x48c2aa[_0x510d('0x48')],{'$or':_['map'](_0x48c2aa[_0x510d('0x43')],function(_0x4bb482){var _0x5739ad={};_0x5739ad[_0x4bb482]={'$like':'%'+_0x40c5cd[_0x510d('0x3e')][_0x510d('0x4a')]+'%'};return _0x5739ad;})});}_0x48c2aa=_[_0x510d('0x49')]({},_0x48c2aa,_0x40c5cd[_0x510d('0x52')]);return _0x3101c4[_0x510d('0xa9')](_0x48c2aa);}})[_0x510d('0x32')](function(_0x16a674){if(_0x16a674){_0x73ab59=_0x16a674['length'];if(!_0x40c5cd['query'][_0x510d('0x44')]('nolimit')){_0x48c2aa[_0x510d('0x29')]=qs[_0x510d('0x29')](_0x40c5cd[_0x510d('0x3e')]['limit']);_0x48c2aa[_0x510d('0x27')]=qs[_0x510d('0x27')](_0x40c5cd[_0x510d('0x3e')][_0x510d('0x27')]);}return _0x3101c4['getAgents'](_0x48c2aa);}})[_0x510d('0x32')](function(_0x3f251d){if(_0x3f251d){return _0x3f251d?{'count':_0x73ab59,'rows':_0x3f251d}:null;}})[_0x510d('0x32')](respondWithResult(_0x247aca,null))[_0x510d('0x4d')](handleError(_0x247aca,null));};function handleQuery(_0x2b1173){logger[_0x510d('0xab')](_0x2b1173);return db['sequelize'][_0x510d('0x3e')](_0x2b1173)[_0x510d('0xa4')](function(_0x51961b){csv_results['push'](_0x51961b);})[_0x510d('0x4d')](function(_0x19a57c){logger[_0x510d('0x5b')](_0x19a57c[_0x510d('0x72')]);});} \ No newline at end of file +var _0xb5a3=['map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','filter','options','where','findAll','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','include','removeDispositions','ids','CmContact','tags','isArray','push','each','omit','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','queryInterface','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','User','getAgents','info','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','offset','count','limit','Content-Range','apply','update','then','get','UserProfileResource','destroy','end','error','stack','name'];(function(_0x49a0b9,_0x8201dd){var _0x457f3e=function(_0x4abffd){while(--_0x4abffd){_0x49a0b9['push'](_0x49a0b9['shift']());}};_0x457f3e(++_0x8201dd);}(_0xb5a3,0x1b7));var _0x3b5a=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0xb5a3[_0x158e3b];return _0x551a1d;};'use strict';var emlformat=require(_0x3b5a('0x0'));var rimraf=require(_0x3b5a('0x1'));var zipdir=require(_0x3b5a('0x2'));var jsonpatch=require(_0x3b5a('0x3'));var rp=require(_0x3b5a('0x4'));var moment=require(_0x3b5a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3b5a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b5a('0x8'));var squel=require(_0x3b5a('0x9'));var crypto=require(_0x3b5a('0xa'));var jsforce=require(_0x3b5a('0xb'));var deskjs=require(_0x3b5a('0xc'));var toCsv=require(_0x3b5a('0xd'));var querystring=require(_0x3b5a('0xe'));var Papa=require(_0x3b5a('0xf'));var Redis=require(_0x3b5a('0x10'));var authService=require(_0x3b5a('0x11'));var qs=require(_0x3b5a('0x12'));var as=require(_0x3b5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b5a('0x14'))(_0x3b5a('0x15'));var utils=require(_0x3b5a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b5a('0x17'));var db=require(_0x3b5a('0x18'))['db'];var csv_results;config[_0x3b5a('0x19')]=_[_0x3b5a('0x1a')](config[_0x3b5a('0x19')],{'host':_0x3b5a('0x1b'),'port':0x18eb});var socket=require(_0x3b5a('0x1c'))(new Redis(config['redis']));require('./cmList.socket')[_0x3b5a('0x1d')](socket);function respondWithStatusCode(_0xa3b762,_0x2f9119){_0x2f9119=_0x2f9119||0xcc;return function(_0x44aa8f){if(_0x44aa8f){return _0xa3b762[_0x3b5a('0x1e')](_0x2f9119);}return _0xa3b762[_0x3b5a('0x1f')](_0x2f9119)['end']();};}function respondWithResult(_0x228f18,_0x2dfb07){_0x2dfb07=_0x2dfb07||0xc8;return function(_0x34a0fb){if(_0x34a0fb){return _0x228f18[_0x3b5a('0x1f')](_0x2dfb07)['json'](_0x34a0fb);}};}function respondWithFilteredResult(_0x479525,_0x46896c){return function(_0x950637){if(_0x950637){var _0x36541c=typeof _0x46896c['offset']===_0x3b5a('0x20')&&typeof _0x46896c['limit']===_0x3b5a('0x20');var _0x2f2655=_0x950637['count'];var _0x210c81=_0x36541c?0x0:_0x46896c[_0x3b5a('0x21')];var _0x5ac682=_0x36541c?_0x950637[_0x3b5a('0x22')]:_0x46896c[_0x3b5a('0x21')]+_0x46896c[_0x3b5a('0x23')];var _0x11a8f0;if(_0x5ac682>=_0x2f2655){_0x5ac682=_0x2f2655;_0x11a8f0=0xc8;}else{_0x11a8f0=0xce;}_0x479525[_0x3b5a('0x1f')](_0x11a8f0);return _0x479525['set'](_0x3b5a('0x24'),_0x210c81+'-'+_0x5ac682+'/'+_0x2f2655)['json'](_0x950637);}return null;};}function patchUpdates(_0x563417){return function(_0x100f6b){try{jsonpatch[_0x3b5a('0x25')](_0x100f6b,_0x563417,!![]);}catch(_0x3b6bc0){return BPromise['reject'](_0x3b6bc0);}return _0x100f6b['save']();};}function saveUpdates(_0x3fb4bf,_0x29304d){return function(_0x2cdcb9){if(_0x2cdcb9){return _0x2cdcb9[_0x3b5a('0x26')](_0x3fb4bf)['then'](function(_0x132c8b){return _0x132c8b;});}return null;};}function removeEntity(_0x17efc9,_0x16f685){return function(_0x303046){if(_0x303046){return _0x303046['destroy']()[_0x3b5a('0x27')](function(){var _0x5cfbb8=_0x303046[_0x3b5a('0x28')]({'plain':!![]});var _0x1b2fa6='Lists';return db[_0x3b5a('0x29')][_0x3b5a('0x2a')]({'where':{'type':_0x1b2fa6,'resourceId':_0x5cfbb8['id']}})[_0x3b5a('0x27')](function(){return _0x303046;});})[_0x3b5a('0x27')](function(){_0x17efc9[_0x3b5a('0x1f')](0xcc)[_0x3b5a('0x2b')]();});}};}function handleEntityNotFound(_0x5a65a2,_0x3399ac){return function(_0x3e0330){if(!_0x3e0330){_0x5a65a2['sendStatus'](0x194);}return _0x3e0330;};}function handleError(_0x84fa70,_0x5167e8){_0x5167e8=_0x5167e8||0x1f4;return function(_0x149315){logger[_0x3b5a('0x2c')](_0x149315[_0x3b5a('0x2d')]);if(_0x149315[_0x3b5a('0x2e')]){delete _0x149315['name'];}_0x84fa70['status'](_0x5167e8)['send'](_0x149315);};}exports['index']=function(_0x58deb5,_0x296efc){var _0x544cdb={},_0x3f1112={},_0x510043={'count':0x0,'rows':[]};var _0x2595dc=_[_0x3b5a('0x2f')](db[_0x3b5a('0x30')][_0x3b5a('0x31')],function(_0x31dd81){return{'name':_0x31dd81[_0x3b5a('0x32')],'type':_0x31dd81['type'][_0x3b5a('0x33')]};});_0x3f1112[_0x3b5a('0x34')]=_[_0x3b5a('0x2f')](_0x2595dc,_0x3b5a('0x2e'));_0x3f1112[_0x3b5a('0x35')]=_[_0x3b5a('0x36')](_0x58deb5[_0x3b5a('0x35')]);_0x3f1112[_0x3b5a('0x37')]=_['intersection'](_0x3f1112[_0x3b5a('0x34')],_0x3f1112[_0x3b5a('0x35')]);_0x544cdb['attributes']=_[_0x3b5a('0x38')](_0x3f1112[_0x3b5a('0x34')],qs['fields'](_0x58deb5[_0x3b5a('0x35')][_0x3b5a('0x39')]));_0x544cdb['attributes']=_0x544cdb[_0x3b5a('0x3a')][_0x3b5a('0x3b')]?_0x544cdb['attributes']:_0x3f1112[_0x3b5a('0x34')];if(!_0x58deb5['query'][_0x3b5a('0x3c')](_0x3b5a('0x3d'))){_0x544cdb[_0x3b5a('0x23')]=qs['limit'](_0x58deb5[_0x3b5a('0x35')]['limit']);_0x544cdb[_0x3b5a('0x21')]=qs[_0x3b5a('0x21')](_0x58deb5[_0x3b5a('0x35')][_0x3b5a('0x21')]);}_0x544cdb[_0x3b5a('0x3e')]=qs[_0x3b5a('0x3f')](_0x58deb5['query']['sort']);_0x544cdb['where']=qs[_0x3b5a('0x37')](_[_0x3b5a('0x40')](_0x58deb5[_0x3b5a('0x35')],_0x3f1112[_0x3b5a('0x37')]),_0x2595dc);if(_0x58deb5[_0x3b5a('0x35')]['filter']){_0x544cdb['where']=_[_0x3b5a('0x41')](_0x544cdb['where'],{'$or':_[_0x3b5a('0x2f')](_0x2595dc,function(_0x4b54a8){if(_0x4b54a8[_0x3b5a('0x42')]!==_0x3b5a('0x43')){var _0x471245={};_0x471245[_0x4b54a8[_0x3b5a('0x2e')]]={'$like':'%'+_0x58deb5[_0x3b5a('0x35')][_0x3b5a('0x44')]+'%'};return _0x471245;}})});}_0x544cdb=_[_0x3b5a('0x41')]({},_0x544cdb,_0x58deb5[_0x3b5a('0x45')]);var _0xc5c62b={'where':_0x544cdb[_0x3b5a('0x46')]};return db[_0x3b5a('0x30')][_0x3b5a('0x22')](_0xc5c62b)[_0x3b5a('0x27')](function(_0x21c15c){_0x510043[_0x3b5a('0x22')]=_0x21c15c;if(_0x58deb5['query']['includeAll']){_0x544cdb['include']=[{'all':!![]}];}return db[_0x3b5a('0x30')][_0x3b5a('0x47')](_0x544cdb);})[_0x3b5a('0x27')](function(_0x45efbf){_0x510043['rows']=_0x45efbf;return _0x510043;})['then'](respondWithFilteredResult(_0x296efc,_0x544cdb))[_0x3b5a('0x48')](handleError(_0x296efc,null));};exports['show']=function(_0x3e9ade,_0x38211a){var _0x903112={'raw':![],'where':{'id':_0x3e9ade['params']['id']}},_0x2e78ae={};_0x2e78ae[_0x3b5a('0x34')]=_[_0x3b5a('0x36')](db[_0x3b5a('0x30')]['rawAttributes']);_0x2e78ae[_0x3b5a('0x35')]=_[_0x3b5a('0x36')](_0x3e9ade[_0x3b5a('0x35')]);_0x2e78ae['filters']=_[_0x3b5a('0x38')](_0x2e78ae[_0x3b5a('0x34')],_0x2e78ae[_0x3b5a('0x35')]);_0x903112['attributes']=_[_0x3b5a('0x38')](_0x2e78ae['model'],qs['fields'](_0x3e9ade[_0x3b5a('0x35')][_0x3b5a('0x39')]));_0x903112['attributes']=_0x903112[_0x3b5a('0x3a')]['length']?_0x903112['attributes']:_0x2e78ae[_0x3b5a('0x34')];if(_0x3e9ade[_0x3b5a('0x35')][_0x3b5a('0x49')]){_0x903112['include']=[{'all':!![]}];}_0x903112=_[_0x3b5a('0x41')]({},_0x903112,_0x3e9ade[_0x3b5a('0x45')]);return db['CmList'][_0x3b5a('0x4a')](_0x903112)['then'](handleEntityNotFound(_0x38211a,null))['then'](respondWithResult(_0x38211a,null))[_0x3b5a('0x48')](handleError(_0x38211a,null));};exports[_0x3b5a('0x4b')]=function(_0x89829c,_0xe686f8){return db['CmList'][_0x3b5a('0x4b')](_0x89829c['body'],{})[_0x3b5a('0x27')](function(_0x135e1f){var _0x203955=_0x89829c[_0x3b5a('0x4c')][_0x3b5a('0x28')]({'plain':!![]});if(!_0x203955)throw new Error(_0x3b5a('0x4d'));if(_0x203955[_0x3b5a('0x4e')]===_0x3b5a('0x4c')){var _0x123a58=_0x135e1f[_0x3b5a('0x28')]({'plain':!![]});var _0x1cd5c1='Lists';return db['UserProfileSection'][_0x3b5a('0x4a')]({'where':{'name':_0x1cd5c1,'userProfileId':_0x203955[_0x3b5a('0x4f')]},'raw':!![]})[_0x3b5a('0x27')](function(_0x2b17d8){if(_0x2b17d8&&_0x2b17d8[_0x3b5a('0x50')]===0x0){return db[_0x3b5a('0x29')][_0x3b5a('0x4b')]({'name':_0x123a58[_0x3b5a('0x2e')],'resourceId':_0x123a58['id'],'type':_0x2b17d8[_0x3b5a('0x2e')],'sectionId':_0x2b17d8['id']},{})['then'](function(){return _0x135e1f;});}else{return _0x135e1f;}})[_0x3b5a('0x48')](function(_0xa7e130){logger['error'](_0x3b5a('0x51'),_0xa7e130);throw _0xa7e130;});}return _0x135e1f;})[_0x3b5a('0x27')](respondWithResult(_0xe686f8,0xc9))[_0x3b5a('0x48')](handleError(_0xe686f8,null));};exports['update']=function(_0x4295db,_0xd13103){if(_0x4295db[_0x3b5a('0x52')]['id']){delete _0x4295db[_0x3b5a('0x52')]['id'];}return db[_0x3b5a('0x30')][_0x3b5a('0x4a')]({'where':{'id':_0x4295db[_0x3b5a('0x53')]['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0xd13103,null))['then'](saveUpdates(_0x4295db[_0x3b5a('0x52')],null))['then'](respondWithResult(_0xd13103,null))[_0x3b5a('0x48')](handleError(_0xd13103,null));};exports[_0x3b5a('0x2a')]=function(_0x52f9a2,_0x44e55b){return db[_0x3b5a('0x30')]['find']({'where':{'id':_0x52f9a2[_0x3b5a('0x53')]['id']}})['then'](handleEntityNotFound(_0x44e55b,null))[_0x3b5a('0x27')](removeEntity(_0x44e55b,null))[_0x3b5a('0x48')](handleError(_0x44e55b,null));};exports[_0x3b5a('0x54')]=function(_0x14b956,_0x2a6f49){return db[_0x3b5a('0x30')][_0x3b5a('0x54')]()[_0x3b5a('0x27')](respondWithResult(_0x2a6f49,null))[_0x3b5a('0x48')](handleError(_0x2a6f49,null));};exports[_0x3b5a('0x55')]=function(_0x7d6192,_0x21525e,_0x12621c){if(_0x7d6192[_0x3b5a('0x52')]['id']){delete _0x7d6192['body']['id'];}return db[_0x3b5a('0x30')][_0x3b5a('0x4a')]({'where':{'id':_0x7d6192[_0x3b5a('0x53')]['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x21525e,null))[_0x3b5a('0x27')](function(_0x1ba238){if(_0x1ba238){_0x7d6192['body'][_0x3b5a('0x56')]=_0x1ba238['id'];return db[_0x3b5a('0x57')]['create'](_0x7d6192[_0x3b5a('0x52')]);}})[_0x3b5a('0x27')](respondWithResult(_0x21525e,null))[_0x3b5a('0x48')](handleError(_0x21525e,null));};exports['getDispositions']=function(_0xf0c4d8,_0x41947c,_0x2294b7){var _0x152999={'raw':![],'where':{}};var _0x2d5ff4={};var _0x2bddf3={'count':0x0,'rows':[]};return db[_0x3b5a('0x30')]['findOne']({'where':{'id':_0xf0c4d8[_0x3b5a('0x53')]['id']}})['then'](handleEntityNotFound(_0x41947c,null))[_0x3b5a('0x27')](function(_0x250c92){if(_0x250c92){_0x2d5ff4['model']=_['keys'](db['Disposition'][_0x3b5a('0x31')]);_0x2d5ff4['query']=_['keys'](_0xf0c4d8[_0x3b5a('0x35')]);_0x2d5ff4[_0x3b5a('0x37')]=_[_0x3b5a('0x38')](_0x2d5ff4[_0x3b5a('0x34')],_0x2d5ff4[_0x3b5a('0x35')]);_0x152999[_0x3b5a('0x3a')]=_['intersection'](_0x2d5ff4[_0x3b5a('0x34')],qs[_0x3b5a('0x39')](_0xf0c4d8[_0x3b5a('0x35')][_0x3b5a('0x39')]));_0x152999[_0x3b5a('0x3a')]=_0x152999['attributes'][_0x3b5a('0x3b')]?_0x152999[_0x3b5a('0x3a')]:_0x2d5ff4[_0x3b5a('0x34')];if(!_0xf0c4d8['query'][_0x3b5a('0x3c')](_0x3b5a('0x3d'))){_0x152999[_0x3b5a('0x23')]=qs[_0x3b5a('0x23')](_0xf0c4d8[_0x3b5a('0x35')][_0x3b5a('0x23')]);_0x152999[_0x3b5a('0x21')]=qs[_0x3b5a('0x21')](_0xf0c4d8[_0x3b5a('0x35')]['offset']);}_0x152999[_0x3b5a('0x3e')]=qs[_0x3b5a('0x3f')](_0xf0c4d8[_0x3b5a('0x35')]['sort']);_0x152999['where']=qs['filters'](_[_0x3b5a('0x40')](_0xf0c4d8['query'],_0x2d5ff4[_0x3b5a('0x37')]));_0x152999[_0x3b5a('0x46')][_0x3b5a('0x56')]=_0x250c92['id'];if(_0xf0c4d8[_0x3b5a('0x35')]['filter']){_0x152999[_0x3b5a('0x46')]=_['merge'](_0x152999[_0x3b5a('0x46')],{'$or':_[_0x3b5a('0x2f')](_0x152999[_0x3b5a('0x3a')],function(_0x490c0a){var _0x5e2162={};_0x5e2162[_0x490c0a]={'$like':'%'+_0xf0c4d8[_0x3b5a('0x35')][_0x3b5a('0x44')]+'%'};return _0x5e2162;})});}_0x152999=_[_0x3b5a('0x41')]({},_0x152999,_0xf0c4d8['options']);return db[_0x3b5a('0x57')][_0x3b5a('0x22')]({'where':_0x152999[_0x3b5a('0x46')]})[_0x3b5a('0x27')](function(_0x38f71b){_0x2bddf3['count']=_0x38f71b;if(_0xf0c4d8['query']['includeAll']){_0x152999[_0x3b5a('0x58')]=[{'all':!![]}];}return db[_0x3b5a('0x57')][_0x3b5a('0x47')](_0x152999);})[_0x3b5a('0x27')](function(_0x769f5b){_0x2bddf3['rows']=_0x769f5b;return _0x2bddf3;});}})[_0x3b5a('0x27')](respondWithFilteredResult(_0x41947c,_0x152999))[_0x3b5a('0x48')](handleError(_0x41947c,null));};exports[_0x3b5a('0x59')]=function(_0x249a1e,_0x4b68de,_0xdcc39d){return db[_0x3b5a('0x30')]['find']({'where':{'id':_0x249a1e[_0x3b5a('0x53')]['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x4b68de,null))['then'](function(_0xa2581e){if(_0xa2581e){return _0xa2581e[_0x3b5a('0x59')](_0x249a1e[_0x3b5a('0x35')][_0x3b5a('0x5a')]);}})['then'](respondWithStatusCode(_0x4b68de,null))[_0x3b5a('0x48')](handleError(_0x4b68de,null));};exports['addContacts']=function(_0x17314f,_0x2b3ff5,_0x476670){return db[_0x3b5a('0x30')]['find']({'where':{'id':_0x17314f['params']['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x2b3ff5,null))[_0x3b5a('0x27')](function(_0x280156){if(_0x280156){var _0x32bb99=[];var _0x139a2c={'success':[],'errors':[]};return db[_0x3b5a('0x5b')][_0x3b5a('0x54')]()[_0x3b5a('0x27')](function(_0x56d3d8){if(_0x17314f['body'][_0x3b5a('0x5c')]&&_[_0x3b5a('0x5d')](_0x17314f['body']['tags'])){if(_0x17314f[_0x3b5a('0x52')][_0x3b5a('0x5c')][_0x3b5a('0x3b')]){_0x17314f[_0x3b5a('0x52')][_0x3b5a('0x5c')]=_0x17314f['body'][_0x3b5a('0x5c')]['join'](';')+';';}else{_0x17314f['body'][_0x3b5a('0x5c')]=null;}}else{_0x17314f[_0x3b5a('0x52')][_0x3b5a('0x5c')]=null;}if(_0x17314f[_0x3b5a('0x52')]&&_[_0x3b5a('0x5d')](_0x17314f[_0x3b5a('0x52')])){for(var _0xe6efcb=0x0;_0xe6efcb<_0x17314f[_0x3b5a('0x52')][_0x3b5a('0x3b')];_0xe6efcb+=0x1){_0x17314f['body'][_0xe6efcb][_0x3b5a('0x56')]=_0x17314f[_0x3b5a('0x53')]['id'];_0x32bb99[_0x3b5a('0x5e')](_0x17314f[_0x3b5a('0x52')][_0xe6efcb]);}return BPromise[_0x3b5a('0x5f')](_0x32bb99,function(_0x372ee4){return db[_0x3b5a('0x5b')][_0x3b5a('0x4b')](_[_0x3b5a('0x60')](_0x372ee4,[_0x3b5a('0x5a'),'id'])||{},{'fields':_[_0x3b5a('0x36')](_0x56d3d8),'raw':!![]})[_0x3b5a('0x27')](function(_0x4d4e75){_0x139a2c['success'][_0x3b5a('0x5e')](_0x4d4e75[_0x3b5a('0x61')]);})['catch'](function(_0x3bcee8){_0x139a2c[_0x3b5a('0x62')]['push']({'data':_0x372ee4,'error':_0x3bcee8[_0x3b5a('0x63')]});});})['then'](function(_0x374866){return _0x139a2c;})[_0x3b5a('0x48')](function(_0x130da9){return _0x130da9;});}else{_0x2b3ff5['status'](0x190)[_0x3b5a('0x64')]({'message':_0x3b5a('0x65')});}});}})['then'](respondWithResult(_0x2b3ff5,null))[_0x3b5a('0x48')](handleError(_0x2b3ff5,null));};exports[_0x3b5a('0x66')]=function(_0x52d202,_0xde8823,_0x4da74b){var _0x735c3b;return db[_0x3b5a('0x30')][_0x3b5a('0x4a')]({'where':{'id':_0x52d202['params']['id']},'include':[{'model':db[_0x3b5a('0x67')],'as':_0x3b5a('0x68')}]})['then'](handleEntityNotFound(_0xde8823,null))[_0x3b5a('0x27')](function(_0x25614f){if(_0x25614f){_0x735c3b=_0x25614f;return db[_0x3b5a('0x5b')][_0x3b5a('0x31')];}})[_0x3b5a('0x27')](function(_0x9ea239){if(_0x9ea239){var _0x3177d1={};var _0x1fad7a={};_0x1fad7a[_0x3b5a('0x34')]=_[_0x3b5a('0x69')](_[_0x3b5a('0x36')](_0x9ea239),_[_0x3b5a('0x2f')](_0x735c3b[_0x3b5a('0x68')],function(_0xfd00a7){return util[_0x3b5a('0x6a')](_0x3b5a('0x6b'),_0xfd00a7['id']);}));_0x1fad7a[_0x3b5a('0x35')]=_[_0x3b5a('0x36')](_0x52d202['query']);_0x1fad7a[_0x3b5a('0x37')]=_[_0x3b5a('0x38')](_0x1fad7a[_0x3b5a('0x34')],_0x1fad7a[_0x3b5a('0x35')]);_0x3177d1['attributes']=_[_0x3b5a('0x38')](_0x1fad7a['model'],qs[_0x3b5a('0x39')](_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x39')]));_0x3177d1[_0x3b5a('0x3a')]=_0x3177d1[_0x3b5a('0x3a')][_0x3b5a('0x3b')]?_0x3177d1[_0x3b5a('0x3a')]:_0x1fad7a[_0x3b5a('0x34')];if(!_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x3c')]('nolimit')){_0x3177d1[_0x3b5a('0x23')]=qs[_0x3b5a('0x23')](_0x52d202['query'][_0x3b5a('0x23')]);_0x3177d1['offset']=qs[_0x3b5a('0x21')](_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x21')]);}_0x3177d1[_0x3b5a('0x3e')]=qs[_0x3b5a('0x3f')](_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x3f')]);_0x3177d1[_0x3b5a('0x46')]=qs[_0x3b5a('0x37')](_[_0x3b5a('0x40')](_0x52d202['query'],_0x1fad7a[_0x3b5a('0x37')]));_0x3177d1[_0x3b5a('0x6c')]=!![];if(_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x44')]){_0x3177d1['where']=_[_0x3b5a('0x41')](_0x3177d1['where'],{'$or':_[_0x3b5a('0x2f')](_0x3177d1[_0x3b5a('0x3a')],function(_0x356fec){var _0x49084f={};_0x49084f[_0x356fec]={'$like':'%'+_0x52d202[_0x3b5a('0x35')][_0x3b5a('0x44')]+'%'};return _0x49084f;})});}_0x3177d1=_[_0x3b5a('0x41')]({},_0x3177d1,_0x52d202['options']);return _0x735c3b[_0x3b5a('0x66')](_0x3177d1);}})['then'](respondWithResult(_0xde8823,null))[_0x3b5a('0x48')](handleError(_0xde8823,null));};exports[_0x3b5a('0x6d')]=function(_0x4e3348,_0xbf07fe,_0x29f9c8){var _0x2365e7;var _0x25635d;var _0x575c34;var _0x39a4cd=_0x4e3348[_0x3b5a('0x53')]['id'];csv_results=[];return db[_0x3b5a('0x6e')]['findAll']({'attributes':['id',_0x3b5a('0x2e')],'raw':!![],'order':[_0x3b5a('0x6f')]})[_0x3b5a('0x27')](function(_0x44a8bf){_0x2365e7=_0x44a8bf;var _0x5972cb=_[_0x3b5a('0x36')](db[_0x3b5a('0x5b')][_0x3b5a('0x31')]);return db[_0x3b5a('0x67')][_0x3b5a('0x47')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x251e39){_0x25635d=_0x251e39;var _0x4a0bce=squel[_0x3b5a('0x70')]()[_0x3b5a('0x39')](_0x5972cb)[_0x3b5a('0x71')](_0x3b5a('0x72'),'c')[_0x3b5a('0x46')](_0x3b5a('0x73'),_0x39a4cd)[_0x3b5a('0x46')](_0x3b5a('0x74'))[_0x3b5a('0x75')]();for(var _0x567c7d=0x0;_0x567c7d<_0x25635d[_0x3b5a('0x3b')];_0x567c7d++){_0x4a0bce[_0x3b5a('0x76')](_0x3b5a('0x77')+_0x25635d[_0x567c7d]['id'],'customField_'+_0x25635d[_0x567c7d][_0x3b5a('0x78')]);}for(var _0x567c7d=0x0;_0x567c7d<_0x2365e7['length'];_0x567c7d++){_0x4a0bce[_0x3b5a('0x76')](squel[_0x3b5a('0x70')]()['field'](_0x3b5a('0x79'))[_0x3b5a('0x71')](_0x3b5a('0x7a'))[_0x3b5a('0x46')](_0x3b5a('0x7b'),_0x2365e7[_0x567c7d]['id'])[_0x3b5a('0x46')]('CmContactId\x20=\x20c.id'),_0x3b5a('0x7c')+_0x2365e7[_0x567c7d][_0x3b5a('0x2e')]);_0x4a0bce['field'](squel[_0x3b5a('0x70')]()['field'](_0x3b5a('0x7d'))['from'](_0x3b5a('0x7a'))[_0x3b5a('0x46')](_0x3b5a('0x7b'),_0x2365e7[_0x567c7d]['id'])[_0x3b5a('0x46')](_0x3b5a('0x7e')),_0x3b5a('0x7f')+_0x2365e7[_0x567c7d][_0x3b5a('0x2e')]);}var _0x3a86b5=[];_0x3a86b5['push'](_0x4a0bce[_0x3b5a('0x80')]());BPromise[_0x3b5a('0x5f')](_0x3a86b5,handleQuery)[_0x3b5a('0x27')](function(_0x3f1693){handleQuery(_0x4a0bce['toString']());var _0x3b218e=csv_results[0x0];if(!_[_0x3b5a('0x81')](_0x3b218e)){var _0x137549=toCsv(_0x3b218e);var _0x5e073d=Date[_0x3b5a('0x82')]();fs[_0x3b5a('0x83')](util[_0x3b5a('0x6a')]('/tmp/list_%d_%s.csv',_0x39a4cd,_0x5e073d),_0x137549);_0xbf07fe['setHeader'](_0x3b5a('0x84'),'attachment;\x20filename='+util['format'](_0x3b5a('0x85'),_0x39a4cd,_0x5e073d));_0xbf07fe[_0x3b5a('0x86')](_0x3b5a('0x87'),_0x3b5a('0x88'));return _0xbf07fe[_0x3b5a('0x89')](util[_0x3b5a('0x6a')](_0x3b5a('0x8a'),_0x39a4cd,_0x5e073d));}else{return _0xbf07fe[_0x3b5a('0x1e')](0xcc);}});});});};exports[_0x3b5a('0x8b')]=function(_0x12e243,_0x2630ae,_0x5d6ce4){var _0x55d27b;delete _0x12e243['body']['id'];return db['CmList'][_0x3b5a('0x8c')]({'where':{'id':_0x12e243['params']['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x2630ae,null))[_0x3b5a('0x27')](function(_0x1b474b){if(_0x1b474b){return db[_0x3b5a('0x8d')][_0x3b5a('0x8e')](function(_0x1c3df4){return db[_0x3b5a('0x67')]['create'](_0x12e243[_0x3b5a('0x52')],{'transaction':_0x1c3df4})[_0x3b5a('0x27')](function(_0x2d117d){_0x55d27b=_0x2d117d;return _0x1b474b[_0x3b5a('0x8f')](_0x2d117d,{'transaction':_0x1c3df4});})['then'](function(){var _0x13cb07={'type':db[_0x3b5a('0x90')][_0x3b5a('0x91')],'transaction':_0x1c3df4};switch(_0x12e243[_0x3b5a('0x52')]['type']){case _0x3b5a('0x92'):_0x13cb07['type']=db['Sequelize'][_0x3b5a('0x91')];break;case _0x3b5a('0x93'):_0x13cb07[_0x3b5a('0x42')]=db[_0x3b5a('0x90')][_0x3b5a('0x94')];break;case'switch':_0x13cb07[_0x3b5a('0x42')]=db[_0x3b5a('0x90')]['BOOLEAN'];_0x13cb07['defaultValue']=![];break;default:}return db[_0x3b5a('0x8d')][_0x3b5a('0x95')]['addColumn']('cm_contacts',util[_0x3b5a('0x6a')](_0x3b5a('0x96'),_0x55d27b['id']),_0x13cb07);})[_0x3b5a('0x27')](function(){return _0x55d27b;});});}})['then'](respondWithResult(_0x2630ae,null))[_0x3b5a('0x48')](handleError(_0x2630ae,null));};exports[_0x3b5a('0x97')]=function(_0x3ef715,_0x52a025,_0x3c8f64){var _0x2668b9={};var _0xc3fb8a={};var _0x5580b5;var _0x344ac4;return db['CmList'][_0x3b5a('0x8c')]({'where':{'id':_0x3ef715[_0x3b5a('0x53')]['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x52a025,null))[_0x3b5a('0x27')](function(_0x3eaed3){if(_0x3eaed3){_0x5580b5=_0x3eaed3;_0xc3fb8a[_0x3b5a('0x34')]=_[_0x3b5a('0x36')](db[_0x3b5a('0x67')][_0x3b5a('0x31')]);_0xc3fb8a[_0x3b5a('0x35')]=_['keys'](_0x3ef715[_0x3b5a('0x35')]);_0xc3fb8a[_0x3b5a('0x37')]=_[_0x3b5a('0x38')](_0xc3fb8a[_0x3b5a('0x34')],_0xc3fb8a[_0x3b5a('0x35')]);_0x2668b9['attributes']=_['intersection'](_0xc3fb8a[_0x3b5a('0x34')],qs[_0x3b5a('0x39')](_0x3ef715[_0x3b5a('0x35')]['fields']));_0x2668b9[_0x3b5a('0x3a')]=_0x2668b9[_0x3b5a('0x3a')][_0x3b5a('0x3b')]?_0x2668b9['attributes']:_0xc3fb8a[_0x3b5a('0x34')];_0x2668b9[_0x3b5a('0x3e')]=qs[_0x3b5a('0x3f')](_0x3ef715['query']['sort']);_0x2668b9[_0x3b5a('0x46')]=qs['filters'](_['pick'](_0x3ef715[_0x3b5a('0x35')],_0xc3fb8a['filters']));_0x2668b9[_0x3b5a('0x46')]=_[_0x3b5a('0x41')](_0x2668b9['where'],{'$or':[{'ListId':_0x3eaed3['id']},{'ListId':null}]});if(_0x3ef715[_0x3b5a('0x35')]['filter']){_0x2668b9[_0x3b5a('0x46')]=_[_0x3b5a('0x41')](_0x2668b9[_0x3b5a('0x46')],{'$or':_[_0x3b5a('0x2f')](_0x2668b9[_0x3b5a('0x3a')],function(_0x445ad7){var _0x11bb68={};_0x11bb68[_0x445ad7]={'$like':'%'+_0x3ef715[_0x3b5a('0x35')][_0x3b5a('0x44')]+'%'};return _0x11bb68;})});}_0x2668b9=_[_0x3b5a('0x41')]({},_0x2668b9,_0x3ef715['options']);return db[_0x3b5a('0x67')]['findAndCountAll'](_0x2668b9);}})[_0x3b5a('0x27')](respondWithResult(_0x52a025,null))[_0x3b5a('0x48')](handleError(_0x52a025,null));};exports[_0x3b5a('0x98')]=function(_0x2b0b86,_0x334916){return db[_0x3b5a('0x67')][_0x3b5a('0x99')]({'where':{'ListId':null}})[_0x3b5a('0x27')](handleEntityNotFound(_0x334916,null))[_0x3b5a('0x27')](function(_0x69bdc9){return _0x69bdc9;})[_0x3b5a('0x27')](respondWithResult(_0x334916,null))['catch'](handleError(_0x334916,null));};exports[_0x3b5a('0x9a')]=function(_0x2bf1cc,_0x22d231,_0x2dea26){return db[_0x3b5a('0x30')][_0x3b5a('0x4a')]({'where':{'id':_0x2bf1cc[_0x3b5a('0x53')]['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x22d231,null))['then'](function(_0x1ef127){if(_0x1ef127){return _0x1ef127[_0x3b5a('0x9a')](_0x2bf1cc[_0x3b5a('0x52')]['ids'],_[_0x3b5a('0x60')](_0x2bf1cc['body'],[_0x3b5a('0x5a'),'id'])||{})['spread'](function(_0x3df4c9){for(var _0x28a602=0x0;_0x28a602<_0x2bf1cc[_0x3b5a('0x52')]['ids'][_0x3b5a('0x3b')];_0x28a602+=0x1){socket[_0x3b5a('0x9b')]('userCmList:save',{'UserId':Number(_0x2bf1cc[_0x3b5a('0x52')][_0x3b5a('0x5a')][_0x28a602]),'CmListId':Number(_0x2bf1cc['params']['id'])});}return _0x3df4c9;});}})[_0x3b5a('0x27')](respondWithResult(_0x22d231,null))[_0x3b5a('0x48')](handleError(_0x22d231,null));};exports[_0x3b5a('0x9c')]=function(_0x1de1cd,_0x40a548,_0x1a173d){return db[_0x3b5a('0x30')][_0x3b5a('0x4a')]({'where':{'id':_0x1de1cd['params']['id']}})[_0x3b5a('0x27')](handleEntityNotFound(_0x40a548,null))[_0x3b5a('0x27')](function(_0x3de6f4){if(_0x3de6f4){return _0x3de6f4[_0x3b5a('0x9c')](_0x1de1cd['query'][_0x3b5a('0x5a')])[_0x3b5a('0x27')](function(){if(_['isArray'](_0x1de1cd[_0x3b5a('0x35')][_0x3b5a('0x5a')])){for(var _0x14d1a9=0x0;_0x14d1a9<_0x1de1cd['query'][_0x3b5a('0x5a')][_0x3b5a('0x3b')];_0x14d1a9+=0x1){socket[_0x3b5a('0x9b')](_0x3b5a('0x9d'),{'UserId':Number(_0x1de1cd['query'][_0x3b5a('0x5a')][_0x14d1a9]),'CmListId':Number(_0x1de1cd['params']['id'])});}}else{socket[_0x3b5a('0x9b')](_0x3b5a('0x9d'),{'UserId':Number(_0x1de1cd[_0x3b5a('0x35')][_0x3b5a('0x5a')]),'CmListId':Number(_0x1de1cd[_0x3b5a('0x53')]['id'])});}});}})[_0x3b5a('0x27')](respondWithStatusCode(_0x40a548,null))[_0x3b5a('0x48')](handleError(_0x40a548,null));};exports['getAgents']=function(_0x211470,_0x4818a6,_0x3c732c){var _0x3fa943={};var _0x2050fa={};var _0x2727f7;var _0x50b347;return db[_0x3b5a('0x30')][_0x3b5a('0x8c')]({'where':{'id':_0x211470['params']['id']}})['then'](handleEntityNotFound(_0x4818a6,null))[_0x3b5a('0x27')](function(_0x3f5913){if(_0x3f5913){_0x2727f7=_0x3f5913;_0x2050fa[_0x3b5a('0x34')]=_[_0x3b5a('0x36')](db[_0x3b5a('0x9e')]['rawAttributes']);_0x2050fa[_0x3b5a('0x35')]=_[_0x3b5a('0x36')](_0x211470[_0x3b5a('0x35')]);_0x2050fa[_0x3b5a('0x37')]=_['intersection'](_0x2050fa['model'],_0x2050fa['query']);_0x3fa943[_0x3b5a('0x3a')]=_[_0x3b5a('0x38')](_0x2050fa[_0x3b5a('0x34')],qs[_0x3b5a('0x39')](_0x211470[_0x3b5a('0x35')]['fields']));_0x3fa943['attributes']=_0x3fa943[_0x3b5a('0x3a')][_0x3b5a('0x3b')]?_0x3fa943[_0x3b5a('0x3a')]:_0x2050fa['model'];_0x3fa943[_0x3b5a('0x3e')]=qs['sort'](_0x211470[_0x3b5a('0x35')]['sort']);_0x3fa943[_0x3b5a('0x46')]=qs[_0x3b5a('0x37')](_[_0x3b5a('0x40')](_0x211470['query'],_0x2050fa[_0x3b5a('0x37')]));if(_0x211470[_0x3b5a('0x35')][_0x3b5a('0x44')]){_0x3fa943[_0x3b5a('0x46')]=_[_0x3b5a('0x41')](_0x3fa943[_0x3b5a('0x46')],{'$or':_[_0x3b5a('0x2f')](_0x3fa943[_0x3b5a('0x3a')],function(_0x2c3c6f){var _0xed8e38={};_0xed8e38[_0x2c3c6f]={'$like':'%'+_0x211470[_0x3b5a('0x35')][_0x3b5a('0x44')]+'%'};return _0xed8e38;})});}_0x3fa943=_['merge']({},_0x3fa943,_0x211470[_0x3b5a('0x45')]);return _0x2727f7[_0x3b5a('0x9f')](_0x3fa943);}})[_0x3b5a('0x27')](function(_0x38d839){if(_0x38d839){_0x50b347=_0x38d839[_0x3b5a('0x3b')];if(!_0x211470[_0x3b5a('0x35')][_0x3b5a('0x3c')](_0x3b5a('0x3d'))){_0x3fa943[_0x3b5a('0x23')]=qs[_0x3b5a('0x23')](_0x211470['query'][_0x3b5a('0x23')]);_0x3fa943[_0x3b5a('0x21')]=qs[_0x3b5a('0x21')](_0x211470['query']['offset']);}return _0x2727f7[_0x3b5a('0x9f')](_0x3fa943);}})['then'](function(_0x4cc5d1){if(_0x4cc5d1){return _0x4cc5d1?{'count':_0x50b347,'rows':_0x4cc5d1}:null;}})[_0x3b5a('0x27')](respondWithResult(_0x4818a6,null))[_0x3b5a('0x48')](handleError(_0x4818a6,null));};function handleQuery(_0x13ea89){logger[_0x3b5a('0xa0')](_0x13ea89);return db['sequelize']['query'](_0x13ea89)[_0x3b5a('0xa1')](function(_0x414c2c){csv_results[_0x3b5a('0x5e')](_0x414c2c);})[_0x3b5a('0x48')](function(_0x11505b){logger[_0x3b5a('0x2c')](_0x11505b['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e8bd7c7..6316e5c 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1bbec1,_0x7e86d3){var _0x10ab97=function(_0xd461ca){while(--_0xd461ca){_0x1bbec1['push'](_0x1bbec1['shift']());}};_0x10ab97(++_0x7e86d3);}(_0x814b,0x1a2));var _0xb814=function(_0x34ecea,_0x3d11ce){_0x34ecea=_0x34ecea-0x0;var _0x44b6a8=_0x814b[_0x34ecea];return _0x44b6a8;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x500763,_0x10fa80){_0x500763=_0x500763-0x0;var _0x22cc53=_0xe14b[_0x500763];return _0x22cc53;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c2e00e5..ad19ad5 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0xdfdbec,_0x2c1cac){var _0x48810d=function(_0x5ef49c){while(--_0x5ef49c){_0xdfdbec['push'](_0xdfdbec['shift']());}};_0x48810d(++_0x2c1cac);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xaa88[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1be1=['define','cm_lists','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0x1be1,0x192));var _0x11be=function(_0x482d5e,_0x32297a){_0x482d5e=_0x482d5e-0x0;var _0x2df009=_0x1be1[_0x482d5e];return _0x2df009;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var moment=require('moment');var BPromise=require(_0x11be('0x2'));var rp=require(_0x11be('0x3'));var fs=require('fs');var path=require(_0x11be('0x4'));var rimraf=require(_0x11be('0x5'));var config=require('../../config/environment');var attributes=require(_0x11be('0x6'));module[_0x11be('0x7')]=function(_0x11f793,_0x479719){return _0x11f793[_0x11be('0x8')]('CmList',attributes,{'tableName':_0x11be('0x9'),'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 c941593..cc65147 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 _0x5bd1=['../../config/environment','http','redis','localhost','./cmList.socket','register','request','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bd1,0x8f));var _0x15bd=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x5bd1[_0x1a21ff];return _0x25afc1;};'use strict';var _=require('lodash');var util=require(_0x15bd('0x0'));var moment=require(_0x15bd('0x1'));var BPromise=require(_0x15bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15bd('0x3'));var db=require(_0x15bd('0x4'))['db'];var utils=require(_0x15bd('0x5'));var logger=require('../../config/logger')(_0x15bd('0x6'));var config=require(_0x15bd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x15bd('0x8')]({'port':0x232a});config[_0x15bd('0x9')]=_['defaults'](config[_0x15bd('0x9')],{'host':_0x15bd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15bd('0x9')]));require(_0x15bd('0xb'))[_0x15bd('0xc')](socket);function respondWithRpcPromise(_0x1aa9a1,_0x4a861,_0x4bb206){return new BPromise(function(_0x742c07,_0x59ace3){return client[_0x15bd('0xd')](_0x1aa9a1,_0x4bb206)[_0x15bd('0xe')](function(_0x97e529){logger['info']('CmList,\x20%s,\x20%s',_0x4a861,_0x15bd('0xf'));logger[_0x15bd('0x10')](_0x15bd('0x11'),_0x4a861,_0x15bd('0xf'),JSON[_0x15bd('0x12')](_0x97e529));if(_0x97e529[_0x15bd('0x13')]){if(_0x97e529[_0x15bd('0x13')][_0x15bd('0x14')]===0x1f4){logger[_0x15bd('0x13')](_0x15bd('0x15'),_0x4a861,_0x97e529['error'][_0x15bd('0x16')]);return _0x59ace3(_0x97e529['error'][_0x15bd('0x16')]);}logger[_0x15bd('0x13')]('CmList,\x20%s,\x20%s',_0x4a861,_0x97e529[_0x15bd('0x13')][_0x15bd('0x16')]);return _0x742c07(_0x97e529[_0x15bd('0x13')]['message']);}else{logger[_0x15bd('0x17')]('CmList,\x20%s,\x20%s',_0x4a861,_0x15bd('0xf'));_0x742c07(_0x97e529[_0x15bd('0x18')]['message']);}})['catch'](function(_0x5183bf){logger[_0x15bd('0x13')](_0x15bd('0x15'),_0x4a861,_0x5183bf);_0x59ace3(_0x5183bf);});});} \ No newline at end of file +var _0xa681=['redis','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa681,0x98));var _0x1a68=function(_0x91e2e,_0x21e2eb){_0x91e2e=_0x91e2e-0x0;var _0x5917cd=_0xa681[_0x91e2e];return _0x5917cd;};'use strict';var _=require(_0x1a68('0x0'));var util=require('util');var moment=require(_0x1a68('0x1'));var BPromise=require(_0x1a68('0x2'));var rs=require(_0x1a68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a68('0x4'));var logger=require(_0x1a68('0x5'))('rpc');var config=require(_0x1a68('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1a68('0x7')]['http']({'port':0x232a});config[_0x1a68('0x8')]=_['defaults'](config[_0x1a68('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a68('0x9'))(new Redis(config[_0x1a68('0x8')]));require(_0x1a68('0xa'))[_0x1a68('0xb')](socket);function respondWithRpcPromise(_0x4edc86,_0x19cb49,_0x4b8e30){return new BPromise(function(_0x31d00f,_0x57a49e){return client['request'](_0x4edc86,_0x4b8e30)[_0x1a68('0xc')](function(_0x56069b){logger[_0x1a68('0xd')](_0x1a68('0xe'),_0x19cb49,_0x1a68('0xf'));logger['debug'](_0x1a68('0x10'),_0x19cb49,_0x1a68('0xf'),JSON[_0x1a68('0x11')](_0x56069b));if(_0x56069b['error']){if(_0x56069b[_0x1a68('0x12')]['code']===0x1f4){logger[_0x1a68('0x12')](_0x1a68('0xe'),_0x19cb49,_0x56069b[_0x1a68('0x12')][_0x1a68('0x13')]);return _0x57a49e(_0x56069b['error'][_0x1a68('0x13')]);}logger['error']('CmList,\x20%s,\x20%s',_0x19cb49,_0x56069b[_0x1a68('0x12')]['message']);return _0x31d00f(_0x56069b['error'][_0x1a68('0x13')]);}else{logger[_0x1a68('0xd')](_0x1a68('0xe'),_0x19cb49,_0x1a68('0xf'));_0x31d00f(_0x56069b['result'][_0x1a68('0x13')]);}})['catch'](function(_0x10e2a4){logger['error'](_0x1a68('0xe'),_0x19cb49,_0x10e2a4);_0x57a49e(_0x10e2a4);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5ffab3e..ee24481 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 _0xcc4a=['register','length','save','emit','removeListener'];(function(_0x5662e0,_0x1839e8){var _0x282539=function(_0x58c3c6){while(--_0x58c3c6){_0x5662e0['push'](_0x5662e0['shift']());}};_0x282539(++_0x1839e8);}(_0xcc4a,0x101));var _0xacc4=function(_0xe18b68,_0x27b0db){_0xe18b68=_0xe18b68-0x0;var _0x44cf93=_0xcc4a[_0xe18b68];return _0x44cf93;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xacc4('0x0'),'remove','update'];function createListener(_0x3f55dc,_0x35ecb4){return function(_0x2c3991){_0x35ecb4[_0xacc4('0x1')](_0x3f55dc,_0x2c3991);};}function removeListener(_0x557fd7,_0x306b9e){return function(){CmListEvents[_0xacc4('0x2')](_0x557fd7,_0x306b9e);};}exports[_0xacc4('0x3')]=function(_0xa8bf4b){for(var _0x3be5b0=0x0,_0x34bcb8=events[_0xacc4('0x4')];_0x3be5b0<_0x34bcb8;_0x3be5b0++){var _0x10567a=events[_0x3be5b0];var _0x1bd592=createListener('cmList:'+_0x10567a,_0xa8bf4b);CmListEvents['on'](_0x10567a,_0x1bd592);}}; \ No newline at end of file +var _0x732f=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x10df11,_0x1cd60b){var _0x51748c=function(_0x40a6a4){while(--_0x40a6a4){_0x10df11['push'](_0x10df11['shift']());}};_0x51748c(++_0x1cd60b);}(_0x732f,0x129));var _0xf732=function(_0x2bbee4,_0x287798){_0x2bbee4=_0x2bbee4-0x0;var _0x209006=_0x732f[_0x2bbee4];return _0x209006;};'use strict';var CmListEvents=require(_0xf732('0x0'));var events=[_0xf732('0x1'),_0xf732('0x2'),_0xf732('0x3')];function createListener(_0x1b2a52,_0x30d28a){return function(_0x30459a){_0x30d28a[_0xf732('0x4')](_0x1b2a52,_0x30459a);};}function removeListener(_0x5dc08e,_0x5e3b01){return function(){CmListEvents[_0xf732('0x5')](_0x5dc08e,_0x5e3b01);};}exports[_0xf732('0x6')]=function(_0x22ff7c){for(var _0x5b0c22=0x0,_0x3494e3=events[_0xf732('0x7')];_0x5b0c22<_0x3494e3;_0x5b0c22++){var _0x5f1412=events[_0x5b0c22];var _0x28939d=createListener(_0xf732('0x8')+_0x5f1412,_0x22ff7c);CmListEvents['on'](_0x5f1412,_0x28939d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c952be5..69796aa 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 _0xc368=['getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x309be5,_0x5d1a05){var _0x342c84=function(_0x36479b){while(--_0x36479b){_0x309be5['push'](_0x309be5['shift']());}};_0x342c84(++_0x5d1a05);}(_0xc368,0x7b));var _0x8c36=function(_0x1732e5,_0x346730){_0x1732e5=_0x1732e5-0x0;var _0x4ae6fd=_0xc368[_0x1732e5];return _0x4ae6fd;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['get'](_0x8c36('0xe'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xf')]);router[_0x8c36('0x8')](_0x8c36('0x10'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x11')]);router[_0x8c36('0x8')](_0x8c36('0x12'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x8')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller['getCustomFields']);router[_0x8c36('0x8')]('/:id/users',auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x16')]('/',auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);router[_0x8c36('0x16')](_0x8c36('0xe'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x18')]);router['post'](_0x8c36('0x10'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x19')]);router[_0x8c36('0x16')](_0x8c36('0x14'),auth['isAuthenticated'](),controller[_0x8c36('0x1a')]);router[_0x8c36('0x16')](_0x8c36('0x1b'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1c')]);router[_0x8c36('0x1d')](_0x8c36('0x1e'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1f')]);router[_0x8c36('0x20')](_0x8c36('0x1e'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x21')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x8c36('0x20')](_0x8c36('0x1b'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x22')]);module[_0x8c36('0x23')]=router; \ No newline at end of file +var _0x036d=['getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','getCustomFields','/:id/users'];(function(_0x5cab0d,_0x3e73a4){var _0x44254b=function(_0x5c5179){while(--_0x5c5179){_0x5cab0d['push'](_0x5cab0d['shift']());}};_0x44254b(++_0x3e73a4);}(_0x036d,0x15d));var _0xd036=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x036d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd036('0x0'));var util=require('util');var path=require(_0xd036('0x1'));var timeout=require(_0xd036('0x2'));var express=require(_0xd036('0x3'));var router=express[_0xd036('0x4')]();var fs_extra=require(_0xd036('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd036('0x6'));var config=require(_0xd036('0x7'));var controller=require(_0xd036('0x8'));router[_0xd036('0x9')]('/',auth[_0xd036('0xa')](),controller[_0xd036('0xb')]);router[_0xd036('0x9')]('/describe',auth[_0xd036('0xa')](),controller[_0xd036('0xc')]);router[_0xd036('0x9')](_0xd036('0xd'),auth[_0xd036('0xa')](),controller[_0xd036('0xe')]);router[_0xd036('0x9')](_0xd036('0xf'),auth[_0xd036('0xa')](),controller['show']);router[_0xd036('0x9')](_0xd036('0x10'),auth[_0xd036('0xa')](),controller[_0xd036('0x11')]);router['get']('/:id/contacts',auth[_0xd036('0xa')](),controller['getContacts']);router[_0xd036('0x9')](_0xd036('0x12'),auth[_0xd036('0xa')](),controller['getContactsCsv']);router[_0xd036('0x9')]('/:id/fields',auth[_0xd036('0xa')](),controller[_0xd036('0x13')]);router[_0xd036('0x9')](_0xd036('0x14'),auth[_0xd036('0xa')](),controller[_0xd036('0x15')]);router[_0xd036('0x16')]('/',auth[_0xd036('0xa')](),controller[_0xd036('0x17')]);router[_0xd036('0x16')](_0xd036('0x10'),auth[_0xd036('0xa')](),controller[_0xd036('0x18')]);router[_0xd036('0x16')](_0xd036('0x19'),auth['isAuthenticated'](),controller[_0xd036('0x1a')]);router[_0xd036('0x16')](_0xd036('0x1b'),auth[_0xd036('0xa')](),controller[_0xd036('0x1c')]);router[_0xd036('0x16')](_0xd036('0x14'),auth[_0xd036('0xa')](),controller[_0xd036('0x1d')]);router[_0xd036('0x1e')](_0xd036('0xf'),auth[_0xd036('0xa')](),controller[_0xd036('0x1f')]);router['delete'](_0xd036('0xf'),auth[_0xd036('0xa')](),controller[_0xd036('0x20')]);router[_0xd036('0x21')](_0xd036('0x10'),auth[_0xd036('0xa')](),controller[_0xd036('0x22')]);router[_0xd036('0x21')](_0xd036('0x14'),auth[_0xd036('0xa')](),controller[_0xd036('0x23')]);module[_0xd036('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c41160f..b8e7188 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 _0xae45=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4d873f,_0x2474af){var _0x2d8787=function(_0x30dc9d){while(--_0x30dc9d){_0x4d873f['push'](_0x4d873f['shift']());}};_0x2d8787(++_0x2474af);}(_0xae45,0x114));var _0x5ae4=function(_0x2715ae,_0x37f781){_0x2715ae=_0x2715ae-0x0;var _0x418007=_0xae45[_0x2715ae];return _0x418007;};'use strict';var Sequelize=require(_0x5ae4('0x0'));module[_0x5ae4('0x1')]={'name':{'type':Sequelize[_0x5ae4('0x2')],'get':function(_0x1ef758){return this[_0x5ae4('0x3')](_0x5ae4('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x5ae4('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x5ae4('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xe29a=['sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xe29a,0x109));var _0xae29=function(_0x42a77f,_0x5c33ec){_0x42a77f=_0x42a77f-0x0;var _0x5d014c=_0xe29a[_0x42a77f];return _0x5d014c;};'use strict';var Sequelize=require(_0xae29('0x0'));module[_0xae29('0x1')]={'name':{'type':Sequelize[_0xae29('0x2')],'get':function(_0x1e2448){return this[_0xae29('0x3')]('field');}},'field':{'type':Sequelize[_0xae29('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xae29('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xae29('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 6f65bbf..eab7527 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5be4d7,_0x2fb537){var _0x1c5062=function(_0xfedff){while(--_0xfedff){_0x5be4d7['push'](_0x5be4d7['shift']());}};_0x1c5062(++_0x2fb537);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x499270,_0x8ab14f){var _0x38f12e=function(_0x162086){while(--_0x162086){_0x499270['push'](_0x499270['shift']());}};_0x38f12e(++_0x8ab14f);}(_0x7a54,0x106));var _0x47a5=function(_0x27938e,_0x1bd67a){_0x27938e=_0x27938e-0x0;var _0x2d4aa4=_0x7a54[_0x27938e];return _0x2d4aa4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e980675..94f3812 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 _0xc584=['define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xc584,0x1d7));var _0x4c58=function(_0x7cf8eb,_0x5a470e){_0x7cf8eb=_0x7cf8eb-0x0;var _0x24e417=_0xc584[_0x7cf8eb];return _0x24e417;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var logger=require(_0x4c58('0x1'))(_0x4c58('0x2'));var moment=require(_0x4c58('0x3'));var BPromise=require(_0x4c58('0x4'));var rp=require(_0x4c58('0x5'));var fs=require('fs');var path=require(_0x4c58('0x6'));var rimraf=require('rimraf');var config=require(_0x4c58('0x7'));var attributes=require(_0x4c58('0x8'));module['exports']=function(_0x346ce3,_0x5b9fc3){return _0x346ce3[_0x4c58('0x9')](_0x4c58('0xa'),attributes,{'tableName':_0x4c58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x998e=['tools_conditions','lodash','util','api','request-promise','path','rimraf','./condition.attributes','define','Condition'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x998e,0x173));var _0xe998=function(_0x5d164e,_0x1014de){_0x5d164e=_0x5d164e-0x0;var _0x3f12c6=_0x998e[_0x5d164e];return _0x3f12c6;};'use strict';var _=require(_0xe998('0x0'));var util=require(_0xe998('0x1'));var logger=require('../../config/logger')(_0xe998('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe998('0x3'));var fs=require('fs');var path=require(_0xe998('0x4'));var rimraf=require(_0xe998('0x5'));var config=require('../../config/environment');var attributes=require(_0xe998('0x6'));module['exports']=function(_0x418ffb,_0x136dc4){return _0x418ffb[_0xe998('0x7')](_0xe998('0x8'),attributes,{'tableName':_0xe998('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 bbcad89..308f878 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 _0x5e3d=['rpc','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x5e3d,0x19d));var _0xd5e3=function(_0x47519b,_0x323f18){_0x47519b=_0x47519b-0x0;var _0x44a600=_0x5e3d[_0x47519b];return _0x44a600;};'use strict';var _=require(_0xd5e3('0x0'));var util=require(_0xd5e3('0x1'));var moment=require(_0xd5e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5e3('0x3'));var fs=require('fs');var Redis=require(_0xd5e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5e3('0x5'));var logger=require(_0xd5e3('0x6'))(_0xd5e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5e3('0x8'));var client=jayson[_0xd5e3('0x9')][_0xd5e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494614,_0x17f2d4,_0xaf6a73){return new BPromise(function(_0x458037,_0x369f3c){return client['request'](_0x494614,_0xaf6a73)[_0xd5e3('0xb')](function(_0x28adcf){logger['info']('Condition,\x20%s,\x20%s',_0x17f2d4,_0xd5e3('0xc'));logger[_0xd5e3('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x17f2d4,_0xd5e3('0xc'),JSON[_0xd5e3('0xe')](_0x28adcf));if(_0x28adcf['error']){if(_0x28adcf[_0xd5e3('0xf')]['code']===0x1f4){logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x28adcf[_0xd5e3('0xf')][_0xd5e3('0x11')]);return _0x369f3c(_0x28adcf[_0xd5e3('0xf')][_0xd5e3('0x11')]);}logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x28adcf[_0xd5e3('0xf')]['message']);return _0x458037(_0x28adcf[_0xd5e3('0xf')]['message']);}else{logger[_0xd5e3('0x12')](_0xd5e3('0x10'),_0x17f2d4,'request\x20sent');_0x458037(_0x28adcf[_0xd5e3('0x13')][_0xd5e3('0x11')]);}})[_0xd5e3('0x14')](function(_0x38efbe){logger[_0xd5e3('0xf')](_0xd5e3('0x10'),_0x17f2d4,_0x38efbe);_0x369f3c(_0x38efbe);});});} \ No newline at end of file +var _0xfd9b=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xfd9b,0x1b8));var _0xbfd9=function(_0x592705,_0x3b2389){_0x592705=_0x592705-0x0;var _0x10dff0=_0xfd9b[_0x592705];return _0x10dff0;};'use strict';var _=require(_0xbfd9('0x0'));var util=require('util');var moment=require(_0xbfd9('0x1'));var BPromise=require(_0xbfd9('0x2'));var rs=require(_0xbfd9('0x3'));var fs=require('fs');var Redis=require(_0xbfd9('0x4'));var db=require(_0xbfd9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfd9('0x6'))(_0xbfd9('0x7'));var config=require(_0xbfd9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfd9('0x9')][_0xbfd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17cce6,_0x2eb4e3,_0x1b2792){return new BPromise(function(_0x540d7c,_0x3f0c85){return client[_0xbfd9('0xb')](_0x17cce6,_0x1b2792)[_0xbfd9('0xc')](function(_0x50ba97){logger['info'](_0xbfd9('0xd'),_0x2eb4e3,_0xbfd9('0xe'));logger['debug'](_0xbfd9('0xf'),_0x2eb4e3,_0xbfd9('0xe'),JSON[_0xbfd9('0x10')](_0x50ba97));if(_0x50ba97['error']){if(_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x12')]===0x1f4){logger['error'](_0xbfd9('0xd'),_0x2eb4e3,_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);return _0x3f0c85(_0x50ba97['error']['message']);}logger[_0xbfd9('0x11')](_0xbfd9('0xd'),_0x2eb4e3,_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);return _0x540d7c(_0x50ba97[_0xbfd9('0x11')][_0xbfd9('0x13')]);}else{logger[_0xbfd9('0x14')](_0xbfd9('0xd'),_0x2eb4e3,_0xbfd9('0xe'));_0x540d7c(_0x50ba97[_0xbfd9('0x15')][_0xbfd9('0x13')]);}})['catch'](function(_0x2e3ad2){logger[_0xbfd9('0x11')](_0xbfd9('0xd'),_0x2eb4e3,_0x2e3ad2);_0x3f0c85(_0x2e3ad2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index db39b51..4937b90 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 _0xed8b=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd9e5,_0x397369){var _0x129312=function(_0x21ce6d){while(--_0x21ce6d){_0x3dd9e5['push'](_0x3dd9e5['shift']());}};_0x129312(++_0x397369);}(_0xed8b,0x158));var _0xbed8=function(_0x254bb2,_0x31e8d1){_0x254bb2=_0x254bb2-0x0;var _0x590992=_0xed8b[_0x254bb2];return _0x590992;};'use strict';var multer=require(_0xbed8('0x0'));var util=require(_0xbed8('0x1'));var path=require(_0xbed8('0x2'));var timeout=require(_0xbed8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbed8('0x4'));var auth=require(_0xbed8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbed8('0x6'));var controller=require(_0xbed8('0x7'));router[_0xbed8('0x8')](_0xbed8('0x9'),auth[_0xbed8('0xa')](),controller[_0xbed8('0xb')]);router[_0xbed8('0xc')](_0xbed8('0x9'),auth[_0xbed8('0xa')](),controller['destroy']);module[_0xbed8('0xd')]=router; \ No newline at end of file +var _0x1b71=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','update','delete','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4d1a6b,_0x377826){var _0x58b680=function(_0x22354d){while(--_0x22354d){_0x4d1a6b['push'](_0x4d1a6b['shift']());}};_0x58b680(++_0x377826);}(_0x1b71,0x8a));var _0x11b7=function(_0x5d0a55,_0x4419dc){_0x5d0a55=_0x5d0a55-0x0;var _0x2e14f7=_0x1b71[_0x5d0a55];return _0x2e14f7;};'use strict';var multer=require(_0x11b7('0x0'));var util=require(_0x11b7('0x1'));var path=require(_0x11b7('0x2'));var timeout=require(_0x11b7('0x3'));var express=require(_0x11b7('0x4'));var router=express[_0x11b7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x11b7('0x6'));var interaction=require(_0x11b7('0x7'));var config=require(_0x11b7('0x8'));var controller=require(_0x11b7('0x9'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x11b7('0xa')]);router[_0x11b7('0xb')](_0x11b7('0xc'),auth[_0x11b7('0xd')](),controller[_0x11b7('0xe')]);module[_0x11b7('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c0d4dab..e1cc35f 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 _0xf6e8=['INTEGER','exports','STRING','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x4a2315,_0x23ca80){_0x4a2315=_0x4a2315-0x0;var _0x44133a=_0xf6e8[_0x4a2315];return _0x44133a;};'use strict';var Sequelize=require('sequelize');module[_0x8f6e('0x0')]={'name':{'type':Sequelize[_0x8f6e('0x1')],'allowNull':![],'unique':_0x8f6e('0x2')},'OrderBy':{'type':Sequelize[_0x8f6e('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8f6e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x93a5=['STRING','INTEGER','sequelize'];(function(_0x1fb621,_0x97df31){var _0x2c5ff8=function(_0x491b4a){while(--_0x491b4a){_0x1fb621['push'](_0x1fb621['shift']());}};_0x2c5ff8(++_0x97df31);}(_0x93a5,0x14f));var _0x593a=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x93a5[_0x5a4b42];return _0x5e81d6;};'use strict';var Sequelize=require(_0x593a('0x0'));module['exports']={'name':{'type':Sequelize[_0x593a('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x593a('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x593a('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 6a52a8d..c23a7bd 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 _0xf61e=['sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','UserProfileResource','status','error','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ContactItemType','includeAll','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','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','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xf61e,0x191));var _0xef61=function(_0x44cb0c,_0xe8b392){_0x44cb0c=_0x44cb0c-0x0;var _0x45e898=_0xf61e[_0x44cb0c];return _0x45e898;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){var _0x111bac=_0xfbee94['get']({'plain':!![]});var _0x16b144='ContactItemTypes';return db[_0xef61('0x29')][_0xef61('0x27')]({'where':{'type':_0x16b144,'resourceId':_0x111bac['id']}})[_0xef61('0x28')](function(){return _0xfbee94;});})[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x2a')](0xcc)[_0xef61('0x1e')]();});}};}function handleEntityNotFound(_0x258b5a,_0x23837f){return function(_0x297df7){if(!_0x297df7){_0x258b5a[_0xef61('0x1d')](0x194);}return _0x297df7;};}function handleError(_0x3a16ba,_0x18426f){_0x18426f=_0x18426f||0x1f4;return function(_0xeb9a62){logger[_0xef61('0x2b')](_0xeb9a62[_0xef61('0x2c')]);if(_0xeb9a62[_0xef61('0x2d')]){delete _0xeb9a62[_0xef61('0x2d')];}_0x3a16ba[_0xef61('0x2a')](_0x18426f)[_0xef61('0x2e')](_0xeb9a62);};}exports[_0xef61('0x2f')]=function(_0x43bc47,_0x53fa3b){var _0x4f35ad={},_0x51d5d1={},_0x38b522={'count':0x0,'rows':[]};var _0x36713e=_[_0xef61('0x30')](db['ContactItemType'][_0xef61('0x31')],function(_0x21d6f0){return{'name':_0x21d6f0['fieldName'],'type':_0x21d6f0[_0xef61('0x32')]['key']};});_0x51d5d1['model']=_[_0xef61('0x30')](_0x36713e,'name');_0x51d5d1[_0xef61('0x33')]=_['keys'](_0x43bc47[_0xef61('0x33')]);_0x51d5d1[_0xef61('0x34')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],_0x51d5d1[_0xef61('0x33')]);_0x4f35ad[_0xef61('0x37')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],qs[_0xef61('0x38')](_0x43bc47[_0xef61('0x33')]['fields']));_0x4f35ad[_0xef61('0x37')]=_0x4f35ad[_0xef61('0x37')][_0xef61('0x39')]?_0x4f35ad[_0xef61('0x37')]:_0x51d5d1[_0xef61('0x36')];if(!_0x43bc47['query'][_0xef61('0x3a')](_0xef61('0x3b'))){_0x4f35ad[_0xef61('0x23')]=qs['limit'](_0x43bc47['query']['limit']);_0x4f35ad[_0xef61('0x20')]=qs['offset'](_0x43bc47['query']['offset']);}_0x4f35ad[_0xef61('0x3c')]=qs[_0xef61('0x3d')](_0x43bc47[_0xef61('0x33')]['sort']);_0x4f35ad['where']=qs['filters'](_[_0xef61('0x3e')](_0x43bc47[_0xef61('0x33')],_0x51d5d1['filters']),_0x36713e);if(_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]){_0x4f35ad[_0xef61('0x40')]=_[_0xef61('0x41')](_0x4f35ad['where'],{'$or':_[_0xef61('0x30')](_0x36713e,function(_0x184063){if(_0x184063[_0xef61('0x32')]!==_0xef61('0x42')){var _0x54410d={};_0x54410d[_0x184063['name']]={'$like':'%'+_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]+'%'};return _0x54410d;}})});}_0x4f35ad=_[_0xef61('0x41')]({},_0x4f35ad,_0x43bc47['options']);var _0x3eee46={'where':_0x4f35ad[_0xef61('0x40')]};return db[_0xef61('0x43')][_0xef61('0x22')](_0x3eee46)['then'](function(_0x545597){_0x38b522['count']=_0x545597;if(_0x43bc47[_0xef61('0x33')][_0xef61('0x44')]){_0x4f35ad[_0xef61('0x45')]=[{'all':!![]}];}return db[_0xef61('0x43')][_0xef61('0x46')](_0x4f35ad);})[_0xef61('0x28')](function(_0xc9b467){_0x38b522['rows']=_0xc9b467;return _0x38b522;})[_0xef61('0x28')](respondWithFilteredResult(_0x53fa3b,_0x4f35ad))[_0xef61('0x47')](handleError(_0x53fa3b,null));};exports[_0xef61('0x48')]=function(_0x898c74,_0x51fac1){var _0x17279b={'raw':!![],'where':{'id':_0x898c74[_0xef61('0x49')]['id']}},_0x4686df={};_0x4686df[_0xef61('0x36')]=_[_0xef61('0x4a')](db[_0xef61('0x43')]['rawAttributes']);_0x4686df[_0xef61('0x33')]=_[_0xef61('0x4a')](_0x898c74[_0xef61('0x33')]);_0x4686df['filters']=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],_0x4686df[_0xef61('0x33')]);_0x17279b[_0xef61('0x37')]=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],qs['fields'](_0x898c74[_0xef61('0x33')][_0xef61('0x38')]));_0x17279b['attributes']=_0x17279b[_0xef61('0x37')][_0xef61('0x39')]?_0x17279b[_0xef61('0x37')]:_0x4686df[_0xef61('0x36')];if(_0x898c74['query'][_0xef61('0x44')]){_0x17279b[_0xef61('0x45')]=[{'all':!![]}];}_0x17279b=_[_0xef61('0x41')]({},_0x17279b,_0x898c74['options']);return db[_0xef61('0x43')][_0xef61('0x4b')](_0x17279b)['then'](handleEntityNotFound(_0x51fac1,null))[_0xef61('0x28')](respondWithResult(_0x51fac1,null))[_0xef61('0x47')](handleError(_0x51fac1,null));};exports[_0xef61('0x4c')]=function(_0x2904e0,_0x13bb20){return db[_0xef61('0x43')][_0xef61('0x4c')](_0x2904e0['body'],{})[_0xef61('0x28')](function(_0x505631){var _0x89c04e=_0x2904e0[_0xef61('0x4d')][_0xef61('0x4e')]({'plain':!![]});if(!_0x89c04e)throw new Error(_0xef61('0x4f'));if(_0x89c04e[_0xef61('0x50')]===_0xef61('0x4d')){var _0x3e23eb=_0x505631[_0xef61('0x4e')]({'plain':!![]});var _0x264877='ContactItemTypes';return db[_0xef61('0x51')][_0xef61('0x4b')]({'where':{'name':_0x264877,'userProfileId':_0x89c04e['userProfileId']},'raw':!![]})['then'](function(_0x122251){if(_0x122251&&_0x122251[_0xef61('0x52')]===0x0){return db['UserProfileResource'][_0xef61('0x4c')]({'name':_0x3e23eb['name'],'resourceId':_0x3e23eb['id'],'type':_0x122251[_0xef61('0x2d')],'sectionId':_0x122251['id']},{})[_0xef61('0x28')](function(){return _0x505631;});}else{return _0x505631;}})[_0xef61('0x47')](function(_0x2533f2){logger[_0xef61('0x2b')](_0xef61('0x53'),_0x2533f2);throw _0x2533f2;});}return _0x505631;})['then'](respondWithResult(_0x13bb20,0xc9))[_0xef61('0x47')](handleError(_0x13bb20,null));};exports[_0xef61('0x54')]=function(_0x5373f5,_0x29863d){if(_0x5373f5[_0xef61('0x55')]['id']){delete _0x5373f5['body']['id'];}return db['ContactItemType'][_0xef61('0x4b')]({'where':{'id':_0x5373f5['params']['id']}})['then'](handleEntityNotFound(_0x29863d,null))['then'](saveUpdates(_0x5373f5[_0xef61('0x55')],null))[_0xef61('0x28')](respondWithResult(_0x29863d,null))['catch'](handleError(_0x29863d,null));};exports[_0xef61('0x27')]=function(_0x1928a5,_0x34ae9d){return db[_0xef61('0x43')][_0xef61('0x4b')]({'where':{'id':_0x1928a5[_0xef61('0x49')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x34ae9d,null))[_0xef61('0x28')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1928a5[_0xef61('0x49')]['id']}}))[_0xef61('0x28')](removeEntity(_0x34ae9d,null))[_0xef61('0x47')](handleError(_0x34ae9d,null));}; \ No newline at end of file +var _0x1c7c=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ContactItemType','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x5a9183,_0x581f81){var _0xd757e=function(_0x5972f0){while(--_0x5972f0){_0x5a9183['push'](_0x5a9183['shift']());}};_0xd757e(++_0x581f81);}(_0x1c7c,0x164));var _0xc1c7=function(_0x3d93a7,_0x5913b4){_0x3d93a7=_0x3d93a7-0x0;var _0x52ddc9=_0x1c7c[_0x3d93a7];return _0x52ddc9;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['ContactItemType'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':!![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['ContactItemType'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='ContactItemTypes';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x26')]=function(_0x45dfa2,_0x1dc39f){if(_0x45dfa2[_0xc1c7('0x56')]['id']){delete _0x45dfa2['body']['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1dc39f,null))['then'](saveUpdates(_0x45dfa2[_0xc1c7('0x56')],null))[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,null))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports['destroy']=function(_0x1c636c,_0x48304a){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1c636c[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x48304a,null))[_0xc1c7('0x27')](db[_0xc1c7('0x57')][_0xc1c7('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1c636c['params']['id']}}))[_0xc1c7('0x27')](removeEntity(_0x48304a,null))[_0xc1c7('0x4d')](handleError(_0x48304a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 6f5ba1a..0bae472 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 _0xf600=['../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x59fb63,_0x5971bc){var _0x14b080=function(_0x4ec9fb){while(--_0x4ec9fb){_0x59fb63['push'](_0x59fb63['shift']());}};_0x14b080(++_0x5971bc);}(_0xf600,0x1a9));var _0x0f60=function(_0x34a8dd,_0x477c58){_0x34a8dd=_0x34a8dd-0x0;var _0x53da09=_0xf600[_0x34a8dd];return _0x53da09;};'use strict';var _=require(_0x0f60('0x0'));var util=require(_0x0f60('0x1'));var logger=require(_0x0f60('0x2'))(_0x0f60('0x3'));var moment=require('moment');var BPromise=require(_0x0f60('0x4'));var rp=require(_0x0f60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f60('0x6'));var config=require(_0x0f60('0x7'));var attributes=require(_0x0f60('0x8'));module[_0x0f60('0x9')]=function(_0x5ca1f2,_0x13a637){return _0x5ca1f2[_0x0f60('0xa')]('ContactItemType',attributes,{'tableName':_0x0f60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04b8=['exports','define','ContactItemType','tools_contact_item_types','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x54b7a6,_0x4f6cb9){var _0x4ecd83=function(_0x1e5131){while(--_0x1e5131){_0x54b7a6['push'](_0x54b7a6['shift']());}};_0x4ecd83(++_0x4f6cb9);}(_0x04b8,0x118));var _0x804b=function(_0x517426,_0x59d89c){_0x517426=_0x517426-0x0;var _0x3e6164=_0x04b8[_0x517426];return _0x3e6164;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x804b('0x0'))('api');var moment=require(_0x804b('0x1'));var BPromise=require(_0x804b('0x2'));var rp=require(_0x804b('0x3'));var fs=require('fs');var path=require(_0x804b('0x4'));var rimraf=require(_0x804b('0x5'));var config=require(_0x804b('0x6'));var attributes=require(_0x804b('0x7'));module[_0x804b('0x8')]=function(_0x26d7ce,_0x5170f9){return _0x26d7ce[_0x804b('0x9')](_0x804b('0xa'),attributes,{'tableName':_0x804b('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 2a809ef..9bf2f8a 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 _0x4e37=['ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4e37,0xd8));var _0x74e3=function(_0x360516,_0x4417e9){_0x360516=_0x360516-0x0;var _0x39df49=_0x4e37[_0x360516];return _0x39df49;};'use strict';var _=require(_0x74e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74e3('0x1'));var fs=require('fs');var Redis=require(_0x74e3('0x2'));var db=require(_0x74e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74e3('0x4'))(_0x74e3('0x5'));var config=require(_0x74e3('0x6'));var jayson=require(_0x74e3('0x7'));var client=jayson[_0x74e3('0x8')][_0x74e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ef4a5,_0x5df674,_0x24d08e){return new BPromise(function(_0x2f4e37,_0x5518a9){return client['request'](_0x4ef4a5,_0x24d08e)[_0x74e3('0xa')](function(_0x57453d){logger[_0x74e3('0xb')](_0x74e3('0xc'),_0x5df674,'request\x20sent');logger['debug'](_0x74e3('0xd'),_0x5df674,_0x74e3('0xe'),JSON[_0x74e3('0xf')](_0x57453d));if(_0x57453d['error']){if(_0x57453d['error']['code']===0x1f4){logger['error'](_0x74e3('0xc'),_0x5df674,_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);return _0x5518a9(_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);}logger['error'](_0x74e3('0xc'),_0x5df674,_0x57453d[_0x74e3('0x10')][_0x74e3('0x11')]);return _0x2f4e37(_0x57453d[_0x74e3('0x10')]['message']);}else{logger[_0x74e3('0xb')]('ContactItemType,\x20%s,\x20%s',_0x5df674,_0x74e3('0xe'));_0x2f4e37(_0x57453d[_0x74e3('0x12')][_0x74e3('0x11')]);}})['catch'](function(_0x1867b9){logger[_0x74e3('0x10')](_0x74e3('0xc'),_0x5df674,_0x1867b9);_0x5518a9(_0x1867b9);});});} \ No newline at end of file +var _0x304a=['../../config/logger','rpc','../../config/environment','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x304a,0x19a));var _0xa304=function(_0x133da2,_0xd55ffd){_0x133da2=_0x133da2-0x0;var _0x3d4e0c=_0x304a[_0x133da2];return _0x3d4e0c;};'use strict';var _=require(_0xa304('0x0'));var util=require(_0xa304('0x1'));var moment=require(_0xa304('0x2'));var BPromise=require(_0xa304('0x3'));var rs=require(_0xa304('0x4'));var fs=require('fs');var Redis=require(_0xa304('0x5'));var db=require(_0xa304('0x6'))['db'];var utils=require(_0xa304('0x7'));var logger=require(_0xa304('0x8'))(_0xa304('0x9'));var config=require(_0xa304('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa304('0xb')][_0xa304('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27b7d7,_0x149d2f,_0x439559){return new BPromise(function(_0x2376cc,_0x1f0052){return client[_0xa304('0xd')](_0x27b7d7,_0x439559)['then'](function(_0x1cff72){logger[_0xa304('0xe')](_0xa304('0xf'),_0x149d2f,_0xa304('0x10'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x149d2f,_0xa304('0x10'),JSON['stringify'](_0x1cff72));if(_0x1cff72[_0xa304('0x11')]){if(_0x1cff72[_0xa304('0x11')][_0xa304('0x12')]===0x1f4){logger[_0xa304('0x11')](_0xa304('0xf'),_0x149d2f,_0x1cff72[_0xa304('0x11')][_0xa304('0x13')]);return _0x1f0052(_0x1cff72[_0xa304('0x11')]['message']);}logger[_0xa304('0x11')]('ContactItemType,\x20%s,\x20%s',_0x149d2f,_0x1cff72[_0xa304('0x11')][_0xa304('0x13')]);return _0x2376cc(_0x1cff72[_0xa304('0x11')]['message']);}else{logger[_0xa304('0xe')](_0xa304('0xf'),_0x149d2f,_0xa304('0x10'));_0x2376cc(_0x1cff72[_0xa304('0x14')][_0xa304('0x13')]);}})[_0xa304('0x15')](function(_0xe1b137){logger[_0xa304('0x11')](_0xa304('0xf'),_0x149d2f,_0xe1b137);_0x1f0052(_0xe1b137);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a77a77c..5b1fb8d 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 _0xa83f=['isAuthenticated','show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3ba16c,_0x3d0502){var _0x32c463=function(_0x52be69){while(--_0x52be69){_0x3ba16c['push'](_0x3ba16c['shift']());}};_0x32c463(++_0x3d0502);}(_0xa83f,0xf8));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa83('0x0'));var util=require('util');var path=require(_0xfa83('0x1'));var timeout=require(_0xfa83('0x2'));var express=require(_0xfa83('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa83('0x4'));var interaction=require(_0xfa83('0x5'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xfa83('0x6')]('/',auth[_0xfa83('0x7')](),controller['index']);router[_0xfa83('0x6')]('/:id',auth[_0xfa83('0x7')](),controller[_0xfa83('0x8')]);router[_0xfa83('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa83('0xa')](_0xfa83('0xb'),auth['isAuthenticated'](),controller[_0xfa83('0xc')]);router[_0xfa83('0xd')]('/:id',auth[_0xfa83('0x7')](),controller['destroy']);module[_0xfa83('0xe')]=router; \ No newline at end of file +var _0x8883=['index','get','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated'];(function(_0x59a4d1,_0x1ebff2){var _0x301069=function(_0x301ef4){while(--_0x301ef4){_0x59a4d1['push'](_0x59a4d1['shift']());}};_0x301069(++_0x1ebff2);}(_0x8883,0x7d));var _0x3888=function(_0x402ddf,_0x169cae){_0x402ddf=_0x402ddf-0x0;var _0x58b8ab=_0x8883[_0x402ddf];return _0x58b8ab;};'use strict';var multer=require('multer');var util=require(_0x3888('0x0'));var path=require(_0x3888('0x1'));var timeout=require(_0x3888('0x2'));var express=require(_0x3888('0x3'));var router=express[_0x3888('0x4')]();var fs_extra=require(_0x3888('0x5'));var auth=require(_0x3888('0x6'));var interaction=require(_0x3888('0x7'));var config=require(_0x3888('0x8'));var controller=require(_0x3888('0x9'));router['get']('/',auth[_0x3888('0xa')](),controller[_0x3888('0xb')]);router[_0x3888('0xc')](_0x3888('0xd'),auth[_0x3888('0xa')](),controller['show']);router['post']('/',auth[_0x3888('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3888('0xe')](_0x3888('0xd'),auth[_0x3888('0xa')](),controller[_0x3888('0xf')]);module[_0x3888('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index fb03268..5a408b4 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x5e3606,_0x3a15e9){var _0x31bc08=function(_0x3264af){while(--_0x3264af){_0x5e3606['push'](_0x5e3606['shift']());}};_0x31bc08(++_0x3a15e9);}(_0x757a,0xde));var _0xa757=function(_0x321c68,_0x4459ea){_0x321c68=_0x321c68-0x0;var _0x36cd52=_0x757a[_0x321c68];return _0x36cd52;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d1a83ef..759cd8e 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 _0xbf5b=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','clone','params','find','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce'];(function(_0x3d195e,_0x57b963){var _0xc02374=function(_0xb68459){while(--_0xb68459){_0x3d195e['push'](_0x3d195e['shift']());}};_0xc02374(++_0x57b963);}(_0xbf5b,0x79));var _0xbbf5=function(_0x1cd23d,_0xec4ea5){_0x1cd23d=_0x1cd23d-0x0;var _0x5e8ad5=_0xbf5b[_0x1cd23d];return _0x5e8ad5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbf5('0x0'));var zipdir=require(_0xbbf5('0x1'));var jsonpatch=require(_0xbbf5('0x2'));var rp=require(_0xbbf5('0x3'));var moment=require(_0xbbf5('0x4'));var BPromise=require(_0xbbf5('0x5'));var Mustache=require(_0xbbf5('0x6'));var util=require(_0xbbf5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbbf5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbf5('0x9'));var squel=require(_0xbbf5('0xa'));var crypto=require(_0xbbf5('0xb'));var jsforce=require(_0xbbf5('0xc'));var deskjs=require(_0xbbf5('0xd'));var toCsv=require(_0xbbf5('0xe'));var querystring=require(_0xbbf5('0xf'));var Papa=require(_0xbbf5('0x10'));var Redis=require('ioredis');var authService=require(_0xbbf5('0x11'));var qs=require(_0xbbf5('0x12'));var as=require(_0xbbf5('0x13'));var hardwareService=require(_0xbbf5('0x14'));var logger=require(_0xbbf5('0x15'))(_0xbbf5('0x16'));var utils=require('../../config/utils');var config=require(_0xbbf5('0x17'));var licenseUtil=require(_0xbbf5('0x18'));var db=require(_0xbbf5('0x19'))['db'];config[_0xbbf5('0x1a')]=_[_0xbbf5('0x1b')](config[_0xbbf5('0x1a')],{'host':_0xbbf5('0x1c'),'port':0x18eb});var socket=require(_0xbbf5('0x1d'))(new Redis(config['redis']));require(_0xbbf5('0x1e'))[_0xbbf5('0x1f')](socket);function respondWithStatusCode(_0x49562f,_0x53d09f){_0x53d09f=_0x53d09f||0xcc;return function(_0x13ebfa){if(_0x13ebfa){return _0x49562f[_0xbbf5('0x20')](_0x53d09f);}return _0x49562f['status'](_0x53d09f)[_0xbbf5('0x21')]();};}function respondWithResult(_0x5117d3,_0x53ab0d){_0x53ab0d=_0x53ab0d||0xc8;return function(_0x5b4ff2){if(_0x5b4ff2){return _0x5117d3[_0xbbf5('0x22')](_0x53ab0d)[_0xbbf5('0x23')](_0x5b4ff2);}};}function respondWithFilteredResult(_0x13d977,_0x3d0b58){return function(_0x4209e7){if(_0x4209e7){var _0x58e7d5=typeof _0x3d0b58[_0xbbf5('0x24')]===_0xbbf5('0x25')&&typeof _0x3d0b58['limit']===_0xbbf5('0x25');var _0x3ad401=_0x4209e7[_0xbbf5('0x26')];var _0x4f134f=_0x58e7d5?0x0:_0x3d0b58[_0xbbf5('0x24')];var _0x1d64e7=_0x58e7d5?_0x4209e7[_0xbbf5('0x26')]:_0x3d0b58[_0xbbf5('0x24')]+_0x3d0b58[_0xbbf5('0x27')];var _0x24da35;if(_0x1d64e7>=_0x3ad401){_0x1d64e7=_0x3ad401;_0x24da35=0xc8;}else{_0x24da35=0xce;}_0x13d977[_0xbbf5('0x22')](_0x24da35);return _0x13d977[_0xbbf5('0x28')](_0xbbf5('0x29'),_0x4f134f+'-'+_0x1d64e7+'/'+_0x3ad401)[_0xbbf5('0x23')](_0x4209e7);}return null;};}function patchUpdates(_0x40d3fd){return function(_0x328bb5){try{jsonpatch[_0xbbf5('0x2a')](_0x328bb5,_0x40d3fd,!![]);}catch(_0x410734){return BPromise['reject'](_0x410734);}return _0x328bb5[_0xbbf5('0x2b')]();};}function saveUpdates(_0x5e7024,_0x49e3b1){return function(_0x160085){if(_0x160085){return _0x160085['update'](_0x5e7024)[_0xbbf5('0x2c')](function(_0x45f87a){return _0x45f87a;});}return null;};}function removeEntity(_0x1179fd,_0xb9516f){return function(_0x2dd7c4){if(_0x2dd7c4){return _0x2dd7c4[_0xbbf5('0x2d')]()[_0xbbf5('0x2c')](function(){var _0x329295=_0x2dd7c4[_0xbbf5('0x2e')]({'plain':!![]});var _0x1d91bb=_0xbbf5('0x2f');return db[_0xbbf5('0x30')][_0xbbf5('0x2d')]({'where':{'type':_0x1d91bb,'resourceId':_0x329295['id']}})['then'](function(){return _0x2dd7c4;});})[_0xbbf5('0x2c')](function(){_0x1179fd[_0xbbf5('0x22')](0xcc)[_0xbbf5('0x21')]();});}};}function handleEntityNotFound(_0x27e114,_0x4ab838){return function(_0x44dcae){if(!_0x44dcae){_0x27e114['sendStatus'](0x194);}return _0x44dcae;};}function handleError(_0x47cf15,_0x6d10b8){_0x6d10b8=_0x6d10b8||0x1f4;return function(_0x213063){logger[_0xbbf5('0x31')](_0x213063[_0xbbf5('0x32')]);if(_0x213063['name']){delete _0x213063[_0xbbf5('0x33')];}_0x47cf15[_0xbbf5('0x22')](_0x6d10b8)[_0xbbf5('0x34')](_0x213063);};}exports[_0xbbf5('0x35')]=function(_0x37a6ed,_0x412aa1){var _0xb850fa={},_0x3ee820={},_0x322c12={'count':0x0,'rows':[]};var _0x568761=_['map'](db[_0xbbf5('0x36')][_0xbbf5('0x37')],function(_0x2cabef){return{'name':_0x2cabef[_0xbbf5('0x38')],'type':_0x2cabef[_0xbbf5('0x39')][_0xbbf5('0x3a')]};});_0x3ee820['model']=_[_0xbbf5('0x3b')](_0x568761,_0xbbf5('0x33'));_0x3ee820['query']=_[_0xbbf5('0x3c')](_0x37a6ed[_0xbbf5('0x3d')]);_0x3ee820[_0xbbf5('0x3e')]=_[_0xbbf5('0x3f')](_0x3ee820['model'],_0x3ee820[_0xbbf5('0x3d')]);_0xb850fa[_0xbbf5('0x40')]=_[_0xbbf5('0x3f')](_0x3ee820[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x37a6ed['query'][_0xbbf5('0x42')]));_0xb850fa[_0xbbf5('0x40')]=_0xb850fa['attributes'][_0xbbf5('0x43')]?_0xb850fa['attributes']:_0x3ee820['model'];if(!_0x37a6ed['query'][_0xbbf5('0x44')](_0xbbf5('0x45'))){_0xb850fa[_0xbbf5('0x27')]=qs['limit'](_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x27')]);_0xb850fa[_0xbbf5('0x24')]=qs['offset'](_0x37a6ed[_0xbbf5('0x3d')]['offset']);}_0xb850fa['order']=qs[_0xbbf5('0x46')](_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x46')]);_0xb850fa[_0xbbf5('0x47')]=qs[_0xbbf5('0x3e')](_[_0xbbf5('0x48')](_0x37a6ed[_0xbbf5('0x3d')],_0x3ee820[_0xbbf5('0x3e')]),_0x568761);if(_0x37a6ed['query'][_0xbbf5('0x49')]){_0xb850fa['where']=_[_0xbbf5('0x4a')](_0xb850fa[_0xbbf5('0x47')],{'$or':_[_0xbbf5('0x3b')](_0x568761,function(_0x51094e){if(_0x51094e[_0xbbf5('0x39')]!==_0xbbf5('0x4b')){var _0x1c77c0={};_0x1c77c0[_0x51094e['name']]={'$like':'%'+_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x49')]+'%'};return _0x1c77c0;}})});}_0xb850fa=_['merge']({},_0xb850fa,_0x37a6ed['options']);var _0x2beeef={'where':_0xb850fa[_0xbbf5('0x47')]};return db[_0xbbf5('0x36')][_0xbbf5('0x26')](_0x2beeef)[_0xbbf5('0x2c')](function(_0x45c05e){_0x322c12['count']=_0x45c05e;if(_0x37a6ed[_0xbbf5('0x3d')][_0xbbf5('0x4c')]){_0xb850fa[_0xbbf5('0x4d')]=[{'all':!![]}];}return db[_0xbbf5('0x36')][_0xbbf5('0x4e')](_0xb850fa);})[_0xbbf5('0x2c')](function(_0x194da9){_0x322c12[_0xbbf5('0x4f')]=_0x194da9;return _0x322c12;})[_0xbbf5('0x2c')](respondWithFilteredResult(_0x412aa1,_0xb850fa))['catch'](handleError(_0x412aa1,null));};exports[_0xbbf5('0x50')]=function(_0x20286d,_0x25b38c){var _0x578242={'raw':![],'where':{'id':_0x20286d['params']['id']}},_0x7807d0={};_0x7807d0[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db[_0xbbf5('0x36')][_0xbbf5('0x37')]);_0x7807d0[_0xbbf5('0x3d')]=_[_0xbbf5('0x3c')](_0x20286d[_0xbbf5('0x3d')]);_0x7807d0[_0xbbf5('0x3e')]=_['intersection'](_0x7807d0[_0xbbf5('0x41')],_0x7807d0[_0xbbf5('0x3d')]);_0x578242[_0xbbf5('0x40')]=_[_0xbbf5('0x3f')](_0x7807d0[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x20286d['query'][_0xbbf5('0x42')]));_0x578242['attributes']=_0x578242['attributes'][_0xbbf5('0x43')]?_0x578242[_0xbbf5('0x40')]:_0x7807d0[_0xbbf5('0x41')];if(_0x20286d[_0xbbf5('0x3d')][_0xbbf5('0x4c')]){_0x578242['include']=[{'all':!![]}];}_0x578242=_[_0xbbf5('0x4a')]({},_0x578242,_0x20286d[_0xbbf5('0x51')]);return db[_0xbbf5('0x36')]['find'](_0x578242)[_0xbbf5('0x2c')](handleEntityNotFound(_0x25b38c,null))[_0xbbf5('0x2c')](respondWithResult(_0x25b38c,null))[_0xbbf5('0x52')](handleError(_0x25b38c,null));};exports['create']=function(_0x30657b,_0x4addab){return db[_0xbbf5('0x36')]['create'](_0x30657b[_0xbbf5('0x53')],{})['then'](function(_0x46f4b7){var _0x1b906a=_0x30657b[_0xbbf5('0x54')][_0xbbf5('0x2e')]({'plain':!![]});if(!_0x1b906a)throw new Error(_0xbbf5('0x55'));if(_0x1b906a[_0xbbf5('0x56')]===_0xbbf5('0x54')){var _0x589232=_0x46f4b7['get']({'plain':!![]});var _0x3564f6=_0xbbf5('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x3564f6,'userProfileId':_0x1b906a[_0xbbf5('0x57')]},'raw':!![]})[_0xbbf5('0x2c')](function(_0x54cf18){if(_0x54cf18&&_0x54cf18[_0xbbf5('0x58')]===0x0){return db[_0xbbf5('0x30')][_0xbbf5('0x59')]({'name':_0x589232[_0xbbf5('0x33')],'resourceId':_0x589232['id'],'type':_0x54cf18[_0xbbf5('0x33')],'sectionId':_0x54cf18['id']},{})[_0xbbf5('0x2c')](function(){return _0x46f4b7;});}else{return _0x46f4b7;}})[_0xbbf5('0x52')](function(_0x53ecd3){logger[_0xbbf5('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ecd3);throw _0x53ecd3;});}return _0x46f4b7;})[_0xbbf5('0x2c')](respondWithResult(_0x4addab,0xc9))[_0xbbf5('0x52')](handleError(_0x4addab,null));};exports[_0xbbf5('0x5a')]=function(_0x7bcf84,_0x5c2acf){var _0xc86104={'where':{'id':_0x7bcf84[_0xbbf5('0x5b')]['id']}},_0x264934={};_0x264934[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db['Dashboard'][_0xbbf5('0x37')]);_0xc86104['attributes']=_[_0xbbf5('0x3f')](_0x264934[_0xbbf5('0x41')],qs[_0xbbf5('0x42')](_0x7bcf84['query'][_0xbbf5('0x42')]));_0xc86104['attributes']=_0xc86104[_0xbbf5('0x40')][_0xbbf5('0x43')]?_0xc86104[_0xbbf5('0x40')]:_0x264934[_0xbbf5('0x41')];if(_0x7bcf84[_0xbbf5('0x3d')]['includeAll']){_0xc86104[_0xbbf5('0x4d')]=[{'all':!![]}];}_0xc86104=_[_0xbbf5('0x4a')]({},_0xc86104,_0x7bcf84[_0xbbf5('0x51')]);return db[_0xbbf5('0x36')][_0xbbf5('0x5c')](_0xc86104)[_0xbbf5('0x2c')](handleEntityNotFound(_0x5c2acf,null))['then'](function(_0x3344d3){if(_0x3344d3){var _0x5f00f3=_0x3344d3[_0xbbf5('0x2e')]({'plain':!![]});_0x5f00f3=qs[_0xbbf5('0x5d')](_0x5f00f3,['id',_0xbbf5('0x5e'),_0xbbf5('0x5f')]);_0x7bcf84[_0xbbf5('0x53')]=_[_0xbbf5('0x5d')](_0x7bcf84[_0xbbf5('0x53')],['id',_0xbbf5('0x5e'),_0xbbf5('0x5f')]);return db['Dashboard'][_0xbbf5('0x59')](_[_0xbbf5('0x4a')](_0x5f00f3,_0x7bcf84[_0xbbf5('0x53')]),{'include':_0x7bcf84[_0xbbf5('0x3d')][_0xbbf5('0x4c')]?[{'all':!![]}]:undefined})[_0xbbf5('0x2c')](function(_0x4e5cd7){var _0x5519ea=_0x7bcf84['user'][_0xbbf5('0x2e')]({'plain':!![]});if(!_0x5519ea)throw new Error(_0xbbf5('0x55'));if(_0x5519ea[_0xbbf5('0x56')]===_0xbbf5('0x54')){var _0x3a1e01=_0x4e5cd7[_0xbbf5('0x2e')]({'plain':!![]});var _0xd3f7c=_0xbbf5('0x2f');return db[_0xbbf5('0x60')]['find']({'where':{'name':_0xd3f7c,'userProfileId':_0x5519ea[_0xbbf5('0x57')]},'raw':!![]})['then'](function(_0x1e2656){if(_0x1e2656&&_0x1e2656['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3a1e01[_0xbbf5('0x33')],'resourceId':_0x3a1e01['id'],'type':_0x1e2656[_0xbbf5('0x33')],'sectionId':_0x1e2656['id']},{})[_0xbbf5('0x2c')](function(){return _0x4e5cd7;});}else{return _0x4e5cd7;}})['catch'](function(_0x4a0d3a){logger[_0xbbf5('0x31')](_0xbbf5('0x61'),_0x4a0d3a);throw _0x4a0d3a;});}return _0x4e5cd7;});}})[_0xbbf5('0x2c')](respondWithResult(_0x5c2acf,0xc9))[_0xbbf5('0x52')](handleError(_0x5c2acf,null));};exports[_0xbbf5('0x62')]=function(_0x29ade,_0x21f16c){if(_0x29ade[_0xbbf5('0x53')]['id']){delete _0x29ade[_0xbbf5('0x53')]['id'];}return db['Dashboard'][_0xbbf5('0x5c')]({'where':{'id':_0x29ade['params']['id']}})['then'](handleEntityNotFound(_0x21f16c,null))[_0xbbf5('0x2c')](saveUpdates(_0x29ade[_0xbbf5('0x53')],null))[_0xbbf5('0x2c')](respondWithResult(_0x21f16c,null))['catch'](handleError(_0x21f16c,null));};exports['destroy']=function(_0x3fe6f6,_0x1e87e6){return db[_0xbbf5('0x36')]['find']({'where':{'id':_0x3fe6f6[_0xbbf5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e87e6,null))['then'](removeEntity(_0x1e87e6,null))[_0xbbf5('0x52')](handleError(_0x1e87e6,null));};function widgetAttributes(_0x4c6d62){try{switch(_0x4c6d62['type']){case _0xbbf5('0x63'):return[{'name':'attrUrl','value':_0x4c6d62[_0xbbf5('0x64')]||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||'https://'}];case'custom':return[{'name':_0xbbf5('0x67'),'value':_0x4c6d62['attrPath']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62['attrs'][0x0][_0xbbf5('0x66')]:undefined)||''}];case _0xbbf5('0x68'):return[{'name':'attrHourFormat','value':_0x4c6d62['attrHourFormat']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x69')},{'name':_0xbbf5('0x6a'),'value':_0x4c6d62[_0xbbf5('0x6a')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6b')},{'name':_0xbbf5('0x6c'),'value':_0x4c6d62[_0xbbf5('0x6c')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2]['value']:undefined)||0xc}];case _0xbbf5('0x6d'):return[{'name':_0xbbf5('0x6e'),'value':_0x4c6d62[_0xbbf5('0x6e')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6f')},{'name':'attrVoiceQueues','value':_0x4c6d62[_0xbbf5('0x70')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||[]},{'name':_0xbbf5('0x6c'),'value':_0x4c6d62[_0xbbf5('0x6c')]||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2][_0xbbf5('0x66')]:undefined)||0x14},{'name':_0xbbf5('0x71'),'value':_0x4c6d62[_0xbbf5('0x71')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x3]?_0x4c6d62[_0xbbf5('0x65')][0x3]['value']:undefined)||_0xbbf5('0x72')},{'name':_0xbbf5('0x73'),'value':_0x4c6d62[_0xbbf5('0x73')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x4]?_0x4c6d62['attrs'][0x4][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x74'),'value':_0x4c6d62[_0xbbf5('0x74')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x5]?_0x4c6d62['attrs'][0x5][_0xbbf5('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4c6d62[_0xbbf5('0x75')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x6]?_0x4c6d62[_0xbbf5('0x65')][0x6][_0xbbf5('0x66')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4c6d62[_0xbbf5('0x76')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x7]?_0x4c6d62[_0xbbf5('0x65')][0x7]['value']:undefined)||''},{'name':_0xbbf5('0x77'),'value':_0x4c6d62['attrWhatsappAccounts']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x8]?_0x4c6d62[_0xbbf5('0x65')][0x8][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x78'),'value':_0x4c6d62[_0xbbf5('0x78')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x9]?_0x4c6d62[_0xbbf5('0x65')][0x9][_0xbbf5('0x66')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4c6d62[_0xbbf5('0x79')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62['attrs'][0x0][_0xbbf5('0x66')]:undefined)||_0xbbf5('0x6f')},{'name':_0xbbf5('0x7a'),'value':_0x4c6d62[_0xbbf5('0x7a')]||(_0x4c6d62['attrs']&&_0x4c6d62['attrs'][0x1]?_0x4c6d62['attrs'][0x1][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x7b'),'value':_0x4c6d62[_0xbbf5('0x7b')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x2]?_0x4c6d62[_0xbbf5('0x65')][0x2][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x70'),'value':_0x4c6d62['attrVoiceQueues']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x3]?_0x4c6d62[_0xbbf5('0x65')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4c6d62[_0xbbf5('0x71')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x4]?_0x4c6d62['attrs'][0x4]['value']:undefined)||_0xbbf5('0x72')},{'name':_0xbbf5('0x73'),'value':_0x4c6d62[_0xbbf5('0x73')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x5]?_0x4c6d62[_0xbbf5('0x65')][0x5]['value']:undefined)||''},{'name':_0xbbf5('0x74'),'value':_0x4c6d62[_0xbbf5('0x74')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x6]?_0x4c6d62[_0xbbf5('0x65')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4c6d62['attrSmsAccounts']||(_0x4c6d62['attrs']&&_0x4c6d62[_0xbbf5('0x65')][0x7]?_0x4c6d62[_0xbbf5('0x65')][0x7][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x76'),'value':_0x4c6d62['attrOpenchannelAccounts']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x8]?_0x4c6d62['attrs'][0x8][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x77'),'value':_0x4c6d62[_0xbbf5('0x77')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x9]?_0x4c6d62['attrs'][0x9][_0xbbf5('0x66')]:undefined)||''},{'name':_0xbbf5('0x78'),'value':_0x4c6d62['attrChatWebsites']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0xa]?_0x4c6d62[_0xbbf5('0x65')][0xa][_0xbbf5('0x66')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4c6d62[_0xbbf5('0x7c')]||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62['attrs'][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0]['type']:undefined)||null,'value':_0x4c6d62['attrReport']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x0]?_0x4c6d62[_0xbbf5('0x65')][0x0][_0xbbf5('0x66')]:undefined)||null},{'name':_0xbbf5('0x7d'),'value':_0x4c6d62['attrRefresh']||(_0x4c6d62[_0xbbf5('0x65')]&&_0x4c6d62[_0xbbf5('0x65')][0x1]?_0x4c6d62[_0xbbf5('0x65')][0x1][_0xbbf5('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x446d6b){logger[_0xbbf5('0x31')](_0xbbf5('0x7e'),JSON[_0xbbf5('0x7f')](_0x446d6b));return[];}}exports[_0xbbf5('0x80')]=function(_0x3ba5b0,_0x55f2d7,_0x3a9aed){if(_0x3ba5b0['body']['id']){delete _0x3ba5b0[_0xbbf5('0x53')]['id'];}return db['Dashboard'][_0xbbf5('0x5c')]({'where':{'id':_0x3ba5b0['params']['id']}})[_0xbbf5('0x2c')](handleEntityNotFound(_0x55f2d7,null))[_0xbbf5('0x2c')](function(_0x4e0a5c){if(_0x4e0a5c){_0x3ba5b0[_0xbbf5('0x53')][_0xbbf5('0x81')]=_0x4e0a5c['id'];_0x3ba5b0['body'][_0xbbf5('0x65')]=widgetAttributes(_0x3ba5b0[_0xbbf5('0x53')]);return db[_0xbbf5('0x82')][_0xbbf5('0x59')](_0x3ba5b0[_0xbbf5('0x53')]);}})[_0xbbf5('0x2c')](respondWithResult(_0x55f2d7,null))[_0xbbf5('0x52')](handleError(_0x55f2d7,null));};exports[_0xbbf5('0x83')]=function(_0x25da94,_0x5ab357,_0x16adef){var _0x38f1e1={};var _0x2e0f31={};var _0x5213c1;var _0x39d8b5;return db[_0xbbf5('0x36')][_0xbbf5('0x84')]({'where':{'id':_0x25da94[_0xbbf5('0x5b')]['id']}})[_0xbbf5('0x2c')](handleEntityNotFound(_0x5ab357,null))[_0xbbf5('0x2c')](function(_0x2e192e){if(_0x2e192e){_0x5213c1=_0x2e192e;_0x2e0f31[_0xbbf5('0x41')]=_[_0xbbf5('0x3c')](db[_0xbbf5('0x82')][_0xbbf5('0x37')]);_0x2e0f31[_0xbbf5('0x3d')]=_['keys'](_0x25da94[_0xbbf5('0x3d')]);_0x2e0f31[_0xbbf5('0x3e')]=_[_0xbbf5('0x3f')](_0x2e0f31[_0xbbf5('0x41')],_0x2e0f31[_0xbbf5('0x3d')]);_0x38f1e1[_0xbbf5('0x40')]=_['intersection'](_0x2e0f31['model'],qs[_0xbbf5('0x42')](_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x42')]));_0x38f1e1['attributes']=_0x38f1e1[_0xbbf5('0x40')][_0xbbf5('0x43')]?_0x38f1e1[_0xbbf5('0x40')]:_0x2e0f31['model'];_0x38f1e1[_0xbbf5('0x85')]=qs[_0xbbf5('0x46')](_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x46')]);_0x38f1e1[_0xbbf5('0x47')]=qs[_0xbbf5('0x3e')](_[_0xbbf5('0x48')](_0x25da94[_0xbbf5('0x3d')],_0x2e0f31['filters']));if(_0x25da94['query'][_0xbbf5('0x49')]){_0x38f1e1[_0xbbf5('0x47')]=_[_0xbbf5('0x4a')](_0x38f1e1[_0xbbf5('0x47')],{'$or':_[_0xbbf5('0x3b')](_0x38f1e1[_0xbbf5('0x40')],function(_0x224bc5){var _0x1ec145={};_0x1ec145[_0x224bc5]={'$like':'%'+_0x25da94[_0xbbf5('0x3d')]['filter']+'%'};return _0x1ec145;})});}_0x38f1e1=_[_0xbbf5('0x4a')]({},_0x38f1e1,_0x25da94[_0xbbf5('0x51')]);return _0x5213c1['getItems'](_0x38f1e1);}})[_0xbbf5('0x2c')](function(_0xe32909){if(_0xe32909){_0x39d8b5=_0xe32909[_0xbbf5('0x43')];if(!_0x25da94[_0xbbf5('0x3d')][_0xbbf5('0x44')]('nolimit')){_0x38f1e1['limit']=qs['limit'](_0x25da94['query']['limit']);_0x38f1e1[_0xbbf5('0x24')]=qs[_0xbbf5('0x24')](_0x25da94[_0xbbf5('0x3d')]['offset']);}return _0x5213c1[_0xbbf5('0x83')](_0x38f1e1);}})[_0xbbf5('0x2c')](function(_0x5b6a47){if(_0x5b6a47){return _0x5b6a47?{'count':_0x39d8b5,'rows':_0x5b6a47}:null;}})['then'](respondWithResult(_0x5ab357,null))['catch'](handleError(_0x5ab357,null));}; \ No newline at end of file +var _0x12f0=['../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','role','UserProfileSection','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x12f0,0xee));var _0x012f=function(_0x483822,_0xdb9051){_0x483822=_0x483822-0x0;var _0x371f0f=_0x12f0[_0x483822];return _0x371f0f;};'use strict';var emlformat=require(_0x012f('0x0'));var rimraf=require(_0x012f('0x1'));var zipdir=require(_0x012f('0x2'));var jsonpatch=require(_0x012f('0x3'));var rp=require(_0x012f('0x4'));var moment=require(_0x012f('0x5'));var BPromise=require(_0x012f('0x6'));var Mustache=require(_0x012f('0x7'));var util=require(_0x012f('0x8'));var path=require('path');var sox=require(_0x012f('0x9'));var csv=require(_0x012f('0xa'));var ejs=require(_0x012f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x012f('0xc'));var squel=require(_0x012f('0xd'));var crypto=require(_0x012f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x012f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x012f('0x10'));var Papa=require(_0x012f('0x11'));var Redis=require(_0x012f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x012f('0x13'));var as=require(_0x012f('0x14'));var hardwareService=require(_0x012f('0x15'));var logger=require(_0x012f('0x16'))(_0x012f('0x17'));var utils=require(_0x012f('0x18'));var config=require(_0x012f('0x19'));var licenseUtil=require(_0x012f('0x1a'));var db=require(_0x012f('0x1b'))['db'];config['redis']=_['defaults'](config[_0x012f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x012f('0x1d'))(new Redis(config[_0x012f('0x1c')]));require(_0x012f('0x1e'))[_0x012f('0x1f')](socket);function respondWithStatusCode(_0x1fe3c9,_0x177dd5){_0x177dd5=_0x177dd5||0xcc;return function(_0x382115){if(_0x382115){return _0x1fe3c9[_0x012f('0x20')](_0x177dd5);}return _0x1fe3c9[_0x012f('0x21')](_0x177dd5)['end']();};}function respondWithResult(_0x57afc7,_0x25156c){_0x25156c=_0x25156c||0xc8;return function(_0x30db35){if(_0x30db35){return _0x57afc7['status'](_0x25156c)['json'](_0x30db35);}};}function respondWithFilteredResult(_0x5be0b4,_0xdef1fe){return function(_0x718ff5){if(_0x718ff5){var _0x295e7a=typeof _0xdef1fe['offset']===_0x012f('0x22')&&typeof _0xdef1fe[_0x012f('0x23')]===_0x012f('0x22');var _0x17a248=_0x718ff5['count'];var _0x1d6f35=_0x295e7a?0x0:_0xdef1fe[_0x012f('0x24')];var _0x3b3fb2=_0x295e7a?_0x718ff5[_0x012f('0x25')]:_0xdef1fe[_0x012f('0x24')]+_0xdef1fe['limit'];var _0xd81cd6;if(_0x3b3fb2>=_0x17a248){_0x3b3fb2=_0x17a248;_0xd81cd6=0xc8;}else{_0xd81cd6=0xce;}_0x5be0b4[_0x012f('0x21')](_0xd81cd6);return _0x5be0b4[_0x012f('0x26')](_0x012f('0x27'),_0x1d6f35+'-'+_0x3b3fb2+'/'+_0x17a248)[_0x012f('0x28')](_0x718ff5);}return null;};}function patchUpdates(_0x5f3391){return function(_0x35187b){try{jsonpatch[_0x012f('0x29')](_0x35187b,_0x5f3391,!![]);}catch(_0x5924dc){return BPromise[_0x012f('0x2a')](_0x5924dc);}return _0x35187b['save']();};}function saveUpdates(_0x5b069a,_0x1ad277){return function(_0x1e93e4){if(_0x1e93e4){return _0x1e93e4[_0x012f('0x2b')](_0x5b069a)[_0x012f('0x2c')](function(_0x187c9d){return _0x187c9d;});}return null;};}function removeEntity(_0x2ba8ca,_0x36725e){return function(_0x5b4753){if(_0x5b4753){return _0x5b4753['destroy']()[_0x012f('0x2c')](function(){var _0x7ca95e=_0x5b4753[_0x012f('0x2d')]({'plain':!![]});var _0x2a9c49=_0x012f('0x2e');return db[_0x012f('0x2f')][_0x012f('0x30')]({'where':{'type':_0x2a9c49,'resourceId':_0x7ca95e['id']}})[_0x012f('0x2c')](function(){return _0x5b4753;});})[_0x012f('0x2c')](function(){_0x2ba8ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2206,_0x4abc4f){return function(_0x409011){if(!_0x409011){_0x2c2206['sendStatus'](0x194);}return _0x409011;};}function handleError(_0xa3b1e5,_0x40e5c3){_0x40e5c3=_0x40e5c3||0x1f4;return function(_0x3799f1){logger[_0x012f('0x31')](_0x3799f1[_0x012f('0x32')]);if(_0x3799f1[_0x012f('0x33')]){delete _0x3799f1[_0x012f('0x33')];}_0xa3b1e5[_0x012f('0x21')](_0x40e5c3)[_0x012f('0x34')](_0x3799f1);};}exports[_0x012f('0x35')]=function(_0x2d5f9f,_0x153380){var _0xd792df={},_0x154e1a={},_0xc7166={'count':0x0,'rows':[]};var _0x46c784=_['map'](db[_0x012f('0x36')][_0x012f('0x37')],function(_0x3d8d28){return{'name':_0x3d8d28[_0x012f('0x38')],'type':_0x3d8d28[_0x012f('0x39')][_0x012f('0x3a')]};});_0x154e1a[_0x012f('0x3b')]=_[_0x012f('0x3c')](_0x46c784,_0x012f('0x33'));_0x154e1a[_0x012f('0x3d')]=_[_0x012f('0x3e')](_0x2d5f9f[_0x012f('0x3d')]);_0x154e1a[_0x012f('0x3f')]=_[_0x012f('0x40')](_0x154e1a[_0x012f('0x3b')],_0x154e1a[_0x012f('0x3d')]);_0xd792df[_0x012f('0x41')]=_['intersection'](_0x154e1a['model'],qs[_0x012f('0x42')](_0x2d5f9f[_0x012f('0x3d')][_0x012f('0x42')]));_0xd792df[_0x012f('0x41')]=_0xd792df[_0x012f('0x41')][_0x012f('0x43')]?_0xd792df[_0x012f('0x41')]:_0x154e1a[_0x012f('0x3b')];if(!_0x2d5f9f[_0x012f('0x3d')][_0x012f('0x44')](_0x012f('0x45'))){_0xd792df[_0x012f('0x23')]=qs[_0x012f('0x23')](_0x2d5f9f[_0x012f('0x3d')][_0x012f('0x23')]);_0xd792df[_0x012f('0x24')]=qs[_0x012f('0x24')](_0x2d5f9f['query'][_0x012f('0x24')]);}_0xd792df[_0x012f('0x46')]=qs[_0x012f('0x47')](_0x2d5f9f[_0x012f('0x3d')][_0x012f('0x47')]);_0xd792df[_0x012f('0x48')]=qs['filters'](_[_0x012f('0x49')](_0x2d5f9f[_0x012f('0x3d')],_0x154e1a[_0x012f('0x3f')]),_0x46c784);if(_0x2d5f9f[_0x012f('0x3d')]['filter']){_0xd792df[_0x012f('0x48')]=_[_0x012f('0x4a')](_0xd792df[_0x012f('0x48')],{'$or':_[_0x012f('0x3c')](_0x46c784,function(_0x276004){if(_0x276004[_0x012f('0x39')]!=='VIRTUAL'){var _0x21469b={};_0x21469b[_0x276004[_0x012f('0x33')]]={'$like':'%'+_0x2d5f9f[_0x012f('0x3d')]['filter']+'%'};return _0x21469b;}})});}_0xd792df=_['merge']({},_0xd792df,_0x2d5f9f[_0x012f('0x4b')]);var _0x359e57={'where':_0xd792df[_0x012f('0x48')]};return db[_0x012f('0x36')]['count'](_0x359e57)['then'](function(_0x365424){_0xc7166[_0x012f('0x25')]=_0x365424;if(_0x2d5f9f[_0x012f('0x3d')]['includeAll']){_0xd792df[_0x012f('0x4c')]=[{'all':!![]}];}return db[_0x012f('0x36')][_0x012f('0x4d')](_0xd792df);})['then'](function(_0x15c82a){_0xc7166['rows']=_0x15c82a;return _0xc7166;})[_0x012f('0x2c')](respondWithFilteredResult(_0x153380,_0xd792df))['catch'](handleError(_0x153380,null));};exports[_0x012f('0x4e')]=function(_0x105672,_0x5478fe){var _0x452bc7={'raw':![],'where':{'id':_0x105672['params']['id']}},_0x556ae8={};_0x556ae8[_0x012f('0x3b')]=_[_0x012f('0x3e')](db[_0x012f('0x36')][_0x012f('0x37')]);_0x556ae8[_0x012f('0x3d')]=_[_0x012f('0x3e')](_0x105672[_0x012f('0x3d')]);_0x556ae8[_0x012f('0x3f')]=_[_0x012f('0x40')](_0x556ae8[_0x012f('0x3b')],_0x556ae8['query']);_0x452bc7['attributes']=_[_0x012f('0x40')](_0x556ae8[_0x012f('0x3b')],qs['fields'](_0x105672['query'][_0x012f('0x42')]));_0x452bc7[_0x012f('0x41')]=_0x452bc7[_0x012f('0x41')][_0x012f('0x43')]?_0x452bc7['attributes']:_0x556ae8[_0x012f('0x3b')];if(_0x105672['query'][_0x012f('0x4f')]){_0x452bc7[_0x012f('0x4c')]=[{'all':!![]}];}_0x452bc7=_['merge']({},_0x452bc7,_0x105672[_0x012f('0x4b')]);return db[_0x012f('0x36')][_0x012f('0x50')](_0x452bc7)[_0x012f('0x2c')](handleEntityNotFound(_0x5478fe,null))[_0x012f('0x2c')](respondWithResult(_0x5478fe,null))[_0x012f('0x51')](handleError(_0x5478fe,null));};exports[_0x012f('0x52')]=function(_0x1749c8,_0x298d13){return db[_0x012f('0x36')][_0x012f('0x52')](_0x1749c8[_0x012f('0x53')],{})[_0x012f('0x2c')](function(_0x495b2f){var _0x201077=_0x1749c8[_0x012f('0x54')]['get']({'plain':!![]});if(!_0x201077)throw new Error(_0x012f('0x55'));if(_0x201077['role']===_0x012f('0x54')){var _0x560b15=_0x495b2f[_0x012f('0x2d')]({'plain':!![]});var _0x17a9fa=_0x012f('0x2e');return db['UserProfileSection'][_0x012f('0x50')]({'where':{'name':_0x17a9fa,'userProfileId':_0x201077[_0x012f('0x56')]},'raw':!![]})[_0x012f('0x2c')](function(_0x47ca94){if(_0x47ca94&&_0x47ca94['autoAssociation']===0x0){return db[_0x012f('0x2f')]['create']({'name':_0x560b15['name'],'resourceId':_0x560b15['id'],'type':_0x47ca94['name'],'sectionId':_0x47ca94['id']},{})[_0x012f('0x2c')](function(){return _0x495b2f;});}else{return _0x495b2f;}})[_0x012f('0x51')](function(_0x418cc4){logger[_0x012f('0x31')](_0x012f('0x57'),_0x418cc4);throw _0x418cc4;});}return _0x495b2f;})[_0x012f('0x2c')](respondWithResult(_0x298d13,0xc9))['catch'](handleError(_0x298d13,null));};exports[_0x012f('0x58')]=function(_0x2a05b1,_0x307606){var _0x325f8a={'where':{'id':_0x2a05b1[_0x012f('0x59')]['id']}},_0x1ae206={};_0x1ae206[_0x012f('0x3b')]=_['keys'](db['Dashboard'][_0x012f('0x37')]);_0x325f8a[_0x012f('0x41')]=_[_0x012f('0x40')](_0x1ae206[_0x012f('0x3b')],qs['fields'](_0x2a05b1[_0x012f('0x3d')][_0x012f('0x42')]));_0x325f8a[_0x012f('0x41')]=_0x325f8a[_0x012f('0x41')][_0x012f('0x43')]?_0x325f8a[_0x012f('0x41')]:_0x1ae206[_0x012f('0x3b')];if(_0x2a05b1['query']['includeAll']){_0x325f8a[_0x012f('0x4c')]=[{'all':!![]}];}_0x325f8a=_['merge']({},_0x325f8a,_0x2a05b1[_0x012f('0x4b')]);return db[_0x012f('0x36')][_0x012f('0x50')](_0x325f8a)['then'](handleEntityNotFound(_0x307606,null))[_0x012f('0x2c')](function(_0x641512){if(_0x641512){var _0x27750f=_0x641512['get']({'plain':!![]});_0x27750f=qs['omit'](_0x27750f,['id',_0x012f('0x5a'),_0x012f('0x5b')]);_0x2a05b1[_0x012f('0x53')]=_[_0x012f('0x5c')](_0x2a05b1['body'],['id',_0x012f('0x5a'),_0x012f('0x5b')]);return db[_0x012f('0x36')][_0x012f('0x52')](_[_0x012f('0x4a')](_0x27750f,_0x2a05b1[_0x012f('0x53')]),{'include':_0x2a05b1[_0x012f('0x3d')][_0x012f('0x4f')]?[{'all':!![]}]:undefined})[_0x012f('0x2c')](function(_0x44c1ed){var _0x34e091=_0x2a05b1[_0x012f('0x54')]['get']({'plain':!![]});if(!_0x34e091)throw new Error(_0x012f('0x55'));if(_0x34e091[_0x012f('0x5d')]===_0x012f('0x54')){var _0x172aad=_0x44c1ed[_0x012f('0x2d')]({'plain':!![]});var _0x364c5b=_0x012f('0x2e');return db[_0x012f('0x5e')][_0x012f('0x50')]({'where':{'name':_0x364c5b,'userProfileId':_0x34e091[_0x012f('0x56')]},'raw':!![]})[_0x012f('0x2c')](function(_0xf9b1d){if(_0xf9b1d&&_0xf9b1d[_0x012f('0x5f')]===0x0){return db[_0x012f('0x2f')][_0x012f('0x52')]({'name':_0x172aad['name'],'resourceId':_0x172aad['id'],'type':_0xf9b1d[_0x012f('0x33')],'sectionId':_0xf9b1d['id']},{})[_0x012f('0x2c')](function(){return _0x44c1ed;});}else{return _0x44c1ed;}})[_0x012f('0x51')](function(_0x4e29b5){logger[_0x012f('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e29b5);throw _0x4e29b5;});}return _0x44c1ed;});}})['then'](respondWithResult(_0x307606,0xc9))[_0x012f('0x51')](handleError(_0x307606,null));};exports['update']=function(_0x127426,_0x30a251){if(_0x127426['body']['id']){delete _0x127426[_0x012f('0x53')]['id'];}return db[_0x012f('0x36')][_0x012f('0x50')]({'where':{'id':_0x127426['params']['id']}})['then'](handleEntityNotFound(_0x30a251,null))[_0x012f('0x2c')](saveUpdates(_0x127426[_0x012f('0x53')],null))['then'](respondWithResult(_0x30a251,null))['catch'](handleError(_0x30a251,null));};exports[_0x012f('0x30')]=function(_0x180fe6,_0x557bad){return db[_0x012f('0x36')][_0x012f('0x50')]({'where':{'id':_0x180fe6[_0x012f('0x59')]['id']}})[_0x012f('0x2c')](handleEntityNotFound(_0x557bad,null))[_0x012f('0x2c')](removeEntity(_0x557bad,null))[_0x012f('0x51')](handleError(_0x557bad,null));};function widgetAttributes(_0x2c7ed3){try{switch(_0x2c7ed3[_0x012f('0x39')]){case _0x012f('0x60'):return[{'name':_0x012f('0x61'),'value':_0x2c7ed3[_0x012f('0x61')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x0]?_0x2c7ed3[_0x012f('0x62')][0x0][_0x012f('0x63')]:undefined)||_0x012f('0x64')}];case _0x012f('0x65'):return[{'name':'attrPath','value':_0x2c7ed3[_0x012f('0x66')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x0]?_0x2c7ed3['attrs'][0x0][_0x012f('0x63')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2c7ed3[_0x012f('0x67')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x0]?_0x2c7ed3[_0x012f('0x62')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x012f('0x68'),'value':_0x2c7ed3[_0x012f('0x68')]||(_0x2c7ed3['attrs']&&_0x2c7ed3[_0x012f('0x62')][0x1]?_0x2c7ed3[_0x012f('0x62')][0x1][_0x012f('0x63')]:undefined)||_0x012f('0x69')},{'name':_0x012f('0x6a'),'value':_0x2c7ed3['attrFontSize']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x2]?_0x2c7ed3[_0x012f('0x62')][0x2]['value']:undefined)||0xc}];case _0x012f('0x6b'):return[{'name':_0x012f('0x6c'),'value':_0x2c7ed3['attrMetric']||(_0x2c7ed3['attrs']&&_0x2c7ed3['attrs'][0x0]?_0x2c7ed3[_0x012f('0x62')][0x0][_0x012f('0x63')]:undefined)||_0x012f('0x6d')},{'name':'attrVoiceQueues','value':_0x2c7ed3[_0x012f('0x6e')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x1]?_0x2c7ed3[_0x012f('0x62')][0x1]['value']:undefined)||[]},{'name':_0x012f('0x6a'),'value':_0x2c7ed3[_0x012f('0x6a')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x2]?_0x2c7ed3[_0x012f('0x62')][0x2]['value']:undefined)||0x14},{'name':_0x012f('0x6f'),'value':_0x2c7ed3[_0x012f('0x6f')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x3]?_0x2c7ed3['attrs'][0x3][_0x012f('0x63')]:undefined)||_0x012f('0x70')},{'name':'attrEmailAccounts','value':_0x2c7ed3[_0x012f('0x71')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x4]?_0x2c7ed3[_0x012f('0x62')][0x4][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x72'),'value':_0x2c7ed3[_0x012f('0x72')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x5]?_0x2c7ed3[_0x012f('0x62')][0x5][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x73'),'value':_0x2c7ed3[_0x012f('0x73')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x6]?_0x2c7ed3[_0x012f('0x62')][0x6][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x74'),'value':_0x2c7ed3[_0x012f('0x74')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x7]?_0x2c7ed3['attrs'][0x7][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x75'),'value':_0x2c7ed3['attrWhatsappAccounts']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x8]?_0x2c7ed3[_0x012f('0x62')][0x8][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x76'),'value':_0x2c7ed3[_0x012f('0x76')]||(_0x2c7ed3['attrs']&&_0x2c7ed3[_0x012f('0x62')][0x9]?_0x2c7ed3[_0x012f('0x62')][0x9][_0x012f('0x63')]:undefined)||''}];case _0x012f('0x77'):case _0x012f('0x78'):return[{'name':_0x012f('0x79'),'value':_0x2c7ed3[_0x012f('0x79')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x0]?_0x2c7ed3[_0x012f('0x62')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x2c7ed3['attrSerie2']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x1]?_0x2c7ed3[_0x012f('0x62')][0x1][_0x012f('0x63')]:undefined)||null},{'name':_0x012f('0x7a'),'value':_0x2c7ed3[_0x012f('0x7a')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x2]?_0x2c7ed3[_0x012f('0x62')][0x2][_0x012f('0x63')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2c7ed3['attrVoiceQueues']||(_0x2c7ed3['attrs']&&_0x2c7ed3[_0x012f('0x62')][0x3]?_0x2c7ed3[_0x012f('0x62')][0x3][_0x012f('0x63')]:undefined)||[]},{'name':_0x012f('0x6f'),'value':_0x2c7ed3[_0x012f('0x6f')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x4]?_0x2c7ed3[_0x012f('0x62')][0x4][_0x012f('0x63')]:undefined)||_0x012f('0x70')},{'name':_0x012f('0x71'),'value':_0x2c7ed3[_0x012f('0x71')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x5]?_0x2c7ed3[_0x012f('0x62')][0x5][_0x012f('0x63')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2c7ed3[_0x012f('0x72')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x6]?_0x2c7ed3[_0x012f('0x62')][0x6][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x73'),'value':_0x2c7ed3['attrSmsAccounts']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x7]?_0x2c7ed3[_0x012f('0x62')][0x7][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x74'),'value':_0x2c7ed3[_0x012f('0x74')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x8]?_0x2c7ed3['attrs'][0x8][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x75'),'value':_0x2c7ed3['attrWhatsappAccounts']||(_0x2c7ed3['attrs']&&_0x2c7ed3[_0x012f('0x62')][0x9]?_0x2c7ed3[_0x012f('0x62')][0x9][_0x012f('0x63')]:undefined)||''},{'name':_0x012f('0x76'),'value':_0x2c7ed3[_0x012f('0x76')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0xa]?_0x2c7ed3[_0x012f('0x62')][0xa][_0x012f('0x63')]:undefined)||''}];case'web-report':return[{'name':_0x012f('0x7b'),'type':_0x2c7ed3[_0x012f('0x7c')]||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3['attrs'][0x0]?_0x2c7ed3[_0x012f('0x62')][0x0][_0x012f('0x39')]:undefined)||null,'value':_0x2c7ed3['attrReport']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x0]?_0x2c7ed3['attrs'][0x0]['value']:undefined)||null},{'name':_0x012f('0x7d'),'value':_0x2c7ed3['attrRefresh']||(_0x2c7ed3[_0x012f('0x62')]&&_0x2c7ed3[_0x012f('0x62')][0x1]?_0x2c7ed3[_0x012f('0x62')][0x1][_0x012f('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x2858c7){logger['error']('widgetAttributes:\x20%s',JSON[_0x012f('0x7e')](_0x2858c7));return[];}}exports[_0x012f('0x7f')]=function(_0x3941dc,_0x36160e,_0x213def){if(_0x3941dc[_0x012f('0x53')]['id']){delete _0x3941dc['body']['id'];}return db[_0x012f('0x36')]['find']({'where':{'id':_0x3941dc[_0x012f('0x59')]['id']}})[_0x012f('0x2c')](handleEntityNotFound(_0x36160e,null))[_0x012f('0x2c')](function(_0x1f753e){if(_0x1f753e){_0x3941dc[_0x012f('0x53')][_0x012f('0x80')]=_0x1f753e['id'];_0x3941dc[_0x012f('0x53')][_0x012f('0x62')]=widgetAttributes(_0x3941dc['body']);return db[_0x012f('0x81')][_0x012f('0x52')](_0x3941dc[_0x012f('0x53')]);}})[_0x012f('0x2c')](respondWithResult(_0x36160e,null))[_0x012f('0x51')](handleError(_0x36160e,null));};exports[_0x012f('0x82')]=function(_0x14e419,_0x25f02d,_0x6bf100){var _0x5b5aa4={};var _0x17f73f={};var _0x3346dc;var _0x40163f;return db['Dashboard'][_0x012f('0x83')]({'where':{'id':_0x14e419[_0x012f('0x59')]['id']}})[_0x012f('0x2c')](handleEntityNotFound(_0x25f02d,null))[_0x012f('0x2c')](function(_0x501889){if(_0x501889){_0x3346dc=_0x501889;_0x17f73f[_0x012f('0x3b')]=_[_0x012f('0x3e')](db[_0x012f('0x81')][_0x012f('0x37')]);_0x17f73f[_0x012f('0x3d')]=_[_0x012f('0x3e')](_0x14e419[_0x012f('0x3d')]);_0x17f73f['filters']=_[_0x012f('0x40')](_0x17f73f['model'],_0x17f73f[_0x012f('0x3d')]);_0x5b5aa4[_0x012f('0x41')]=_['intersection'](_0x17f73f[_0x012f('0x3b')],qs['fields'](_0x14e419[_0x012f('0x3d')][_0x012f('0x42')]));_0x5b5aa4['attributes']=_0x5b5aa4[_0x012f('0x41')][_0x012f('0x43')]?_0x5b5aa4[_0x012f('0x41')]:_0x17f73f['model'];_0x5b5aa4[_0x012f('0x46')]=qs['sort'](_0x14e419[_0x012f('0x3d')][_0x012f('0x47')]);_0x5b5aa4[_0x012f('0x48')]=qs[_0x012f('0x3f')](_[_0x012f('0x49')](_0x14e419[_0x012f('0x3d')],_0x17f73f[_0x012f('0x3f')]));if(_0x14e419[_0x012f('0x3d')]['filter']){_0x5b5aa4[_0x012f('0x48')]=_[_0x012f('0x4a')](_0x5b5aa4['where'],{'$or':_[_0x012f('0x3c')](_0x5b5aa4['attributes'],function(_0x32d114){var _0x183aaf={};_0x183aaf[_0x32d114]={'$like':'%'+_0x14e419['query']['filter']+'%'};return _0x183aaf;})});}_0x5b5aa4=_[_0x012f('0x4a')]({},_0x5b5aa4,_0x14e419[_0x012f('0x4b')]);return _0x3346dc[_0x012f('0x82')](_0x5b5aa4);}})[_0x012f('0x2c')](function(_0x3190c9){if(_0x3190c9){_0x40163f=_0x3190c9[_0x012f('0x43')];if(!_0x14e419[_0x012f('0x3d')][_0x012f('0x44')](_0x012f('0x45'))){_0x5b5aa4[_0x012f('0x23')]=qs[_0x012f('0x23')](_0x14e419[_0x012f('0x3d')]['limit']);_0x5b5aa4[_0x012f('0x24')]=qs[_0x012f('0x24')](_0x14e419['query']['offset']);}return _0x3346dc[_0x012f('0x82')](_0x5b5aa4);}})[_0x012f('0x2c')](function(_0x2a03d6){if(_0x2a03d6){return _0x2a03d6?{'count':_0x40163f,'rows':_0x2a03d6}:null;}})[_0x012f('0x2c')](respondWithResult(_0x25f02d,null))[_0x012f('0x51')](handleError(_0x25f02d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 97f3f7d..66d24e5 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 _0xdb1e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb1e,0x18b));var _0xedb1=function(_0x2c4384,_0x32231b){_0x2c4384=_0x2c4384-0x0;var _0x5ddb04=_0xdb1e[_0x2c4384];return _0x5ddb04;};'use strict';var EventEmitter=require(_0xedb1('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xedb1('0x1')](0x0);var events={'afterCreate':_0xedb1('0x2'),'afterUpdate':_0xedb1('0x3'),'afterDestroy':_0xedb1('0x4')};function emitEvent(_0x3c588b){return function(_0x3ad146,_0x4ca440,_0x35cecb){DashboardEvents[_0xedb1('0x5')](_0x3c588b+':'+_0x3ad146['id'],_0x3ad146);DashboardEvents[_0xedb1('0x5')](_0x3c588b,_0x3ad146);_0x35cecb(null);};}for(var e in events){if(events[_0xedb1('0x6')](e)){var event=events[e];Dashboard[_0xedb1('0x7')](e,emitEvent(event));}}module[_0xedb1('0x8')]=DashboardEvents; \ No newline at end of file +var _0x4e86=['hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','update','emit'];(function(_0x563eb4,_0x29bbae){var _0x97db86=function(_0x5f144f){while(--_0x5f144f){_0x563eb4['push'](_0x563eb4['shift']());}};_0x97db86(++_0x29bbae);}(_0x4e86,0xf3));var _0x64e8=function(_0x3d0046,_0x3e6c84){_0x3d0046=_0x3d0046-0x0;var _0x5435a1=_0x4e86[_0x3d0046];return _0x5435a1;};'use strict';var EventEmitter=require(_0x64e8('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x64e8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x64e8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x64e8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5908d1){return function(_0x9c9ff,_0x585536,_0x3b8da9){DashboardEvents[_0x64e8('0x4')](_0x5908d1+':'+_0x9c9ff['id'],_0x9c9ff);DashboardEvents[_0x64e8('0x4')](_0x5908d1,_0x9c9ff);_0x3b8da9(null);};}for(var e in events){if(events[_0x64e8('0x5')](e)){var event=events[e];Dashboard[_0x64e8('0x6')](e,emitEvent(event));}}module[_0x64e8('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index c7ff05a..313600c 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 _0xaf83=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger','api'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xaf83,0x159));var _0x3af8=function(_0x58f0db,_0x4e59e1){_0x58f0db=_0x58f0db-0x0;var _0x24a34e=_0xaf83[_0x58f0db];return _0x24a34e;};'use strict';var _=require(_0x3af8('0x0'));var util=require('util');var logger=require(_0x3af8('0x1'))(_0x3af8('0x2'));var moment=require(_0x3af8('0x3'));var BPromise=require(_0x3af8('0x4'));var rp=require(_0x3af8('0x5'));var fs=require('fs');var path=require(_0x3af8('0x6'));var rimraf=require('rimraf');var config=require(_0x3af8('0x7'));var attributes=require(_0x3af8('0x8'));module[_0x3af8('0x9')]=function(_0xa1942e,_0x2e8b4c){return _0xa1942e[_0x3af8('0xa')]('Dashboard',attributes,{'tableName':_0x3af8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b7=['rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','../../config/logger','api','path'];(function(_0x526119,_0x5c4b34){var _0x402da2=function(_0x361fea){while(--_0x361fea){_0x526119['push'](_0x526119['shift']());}};_0x402da2(++_0x5c4b34);}(_0x98b7,0xc1));var _0x798b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x98b7[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var logger=require(_0x798b('0x2'))(_0x798b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x798b('0x4'));var rimraf=require(_0x798b('0x5'));var config=require(_0x798b('0x6'));var attributes=require(_0x798b('0x7'));module[_0x798b('0x8')]=function(_0x4c197e,_0x2bab89){return _0x4c197e['define'](_0x798b('0x9'),attributes,{'tableName':_0x798b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6b0697d..61396c9 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 _0x222a=['jayson/promise','client','http','redis','localhost','./dashboard.socket','register','request','then','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11f661,_0xfacb67){var _0x502cf4=function(_0xc295c){while(--_0xc295c){_0x11f661['push'](_0x11f661['shift']());}};_0x502cf4(++_0xfacb67);}(_0x222a,0x1ec));var _0xa222=function(_0x46ca9d,_0x5a68fe){_0x46ca9d=_0x46ca9d-0x0;var _0x49527e=_0x222a[_0x46ca9d];return _0x49527e;};'use strict';var _=require(_0xa222('0x0'));var util=require('util');var moment=require(_0xa222('0x1'));var BPromise=require(_0xa222('0x2'));var rs=require(_0xa222('0x3'));var fs=require('fs');var Redis=require(_0xa222('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa222('0x5'));var logger=require(_0xa222('0x6'))(_0xa222('0x7'));var config=require('../../config/environment');var jayson=require(_0xa222('0x8'));var client=jayson[_0xa222('0x9')][_0xa222('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa222('0xb')],{'host':_0xa222('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa222('0xd'))[_0xa222('0xe')](socket);function respondWithRpcPromise(_0x47ea6f,_0x399f51,_0x58645f){return new BPromise(function(_0x5efab4,_0xa2424a){return client[_0xa222('0xf')](_0x47ea6f,_0x58645f)[_0xa222('0x10')](function(_0x680317){logger[_0xa222('0x11')]('Dashboard,\x20%s,\x20%s',_0x399f51,_0xa222('0x12'));logger['debug'](_0xa222('0x13'),_0x399f51,_0xa222('0x12'),JSON['stringify'](_0x680317));if(_0x680317['error']){if(_0x680317[_0xa222('0x14')][_0xa222('0x15')]===0x1f4){logger[_0xa222('0x14')](_0xa222('0x16'),_0x399f51,_0x680317[_0xa222('0x14')][_0xa222('0x17')]);return _0xa2424a(_0x680317[_0xa222('0x14')][_0xa222('0x17')]);}logger['error'](_0xa222('0x16'),_0x399f51,_0x680317['error'][_0xa222('0x17')]);return _0x5efab4(_0x680317[_0xa222('0x14')][_0xa222('0x17')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x399f51,_0xa222('0x12'));_0x5efab4(_0x680317['result'][_0xa222('0x17')]);}})[_0xa222('0x18')](function(_0x4b3811){logger[_0xa222('0x14')](_0xa222('0x16'),_0x399f51,_0x4b3811);_0xa2424a(_0x4b3811);});});} \ No newline at end of file +var _0x8729=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info'];(function(_0x1c2f90,_0x45c60a){var _0x11e34f=function(_0x1abf75){while(--_0x1abf75){_0x1c2f90['push'](_0x1c2f90['shift']());}};_0x11e34f(++_0x45c60a);}(_0x8729,0xaa));var _0x9872=function(_0x130c71,_0x54a725){_0x130c71=_0x130c71-0x0;var _0x16848c=_0x8729[_0x130c71];return _0x16848c;};'use strict';var _=require(_0x9872('0x0'));var util=require(_0x9872('0x1'));var moment=require(_0x9872('0x2'));var BPromise=require(_0x9872('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9872('0x4'));var db=require(_0x9872('0x5'))['db'];var utils=require(_0x9872('0x6'));var logger=require(_0x9872('0x7'))(_0x9872('0x8'));var config=require(_0x9872('0x9'));var jayson=require(_0x9872('0xa'));var client=jayson[_0x9872('0xb')][_0x9872('0xc')]({'port':0x232a});config[_0x9872('0xd')]=_[_0x9872('0xe')](config['redis'],{'host':_0x9872('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9872('0xd')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x38880c,_0x3c0c29,_0x1cccb6){return new BPromise(function(_0x551007,_0x3193db){return client[_0x9872('0x10')](_0x38880c,_0x1cccb6)[_0x9872('0x11')](function(_0x4e9608){logger[_0x9872('0x12')](_0x9872('0x13'),_0x3c0c29,_0x9872('0x14'));logger[_0x9872('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3c0c29,_0x9872('0x14'),JSON[_0x9872('0x16')](_0x4e9608));if(_0x4e9608['error']){if(_0x4e9608[_0x9872('0x17')][_0x9872('0x18')]===0x1f4){logger[_0x9872('0x17')](_0x9872('0x13'),_0x3c0c29,_0x4e9608[_0x9872('0x17')][_0x9872('0x19')]);return _0x3193db(_0x4e9608[_0x9872('0x17')][_0x9872('0x19')]);}logger[_0x9872('0x17')](_0x9872('0x13'),_0x3c0c29,_0x4e9608[_0x9872('0x17')][_0x9872('0x19')]);return _0x551007(_0x4e9608[_0x9872('0x17')]['message']);}else{logger['info'](_0x9872('0x13'),_0x3c0c29,_0x9872('0x14'));_0x551007(_0x4e9608['result']['message']);}})[_0x9872('0x1a')](function(_0x31ad5d){logger['error'](_0x9872('0x13'),_0x3c0c29,_0x31ad5d);_0x3193db(_0x31ad5d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1f68678..2876e94 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 _0x4678=['register','dashboard:','./dashboard.events','save','remove','update'];(function(_0x251120,_0x463ca4){var _0xef58d1=function(_0x56135f){while(--_0x56135f){_0x251120['push'](_0x251120['shift']());}};_0xef58d1(++_0x463ca4);}(_0x4678,0x164));var _0x8467=function(_0x44316e,_0x390748){_0x44316e=_0x44316e-0x0;var _0x5aef18=_0x4678[_0x44316e];return _0x5aef18;};'use strict';var DashboardEvents=require(_0x8467('0x0'));var events=[_0x8467('0x1'),_0x8467('0x2'),_0x8467('0x3')];function createListener(_0x3d1b05,_0x3d8cb7){return function(_0x4bd344){_0x3d8cb7['emit'](_0x3d1b05,_0x4bd344);};}function removeListener(_0xb6b062,_0x23300d){return function(){DashboardEvents['removeListener'](_0xb6b062,_0x23300d);};}exports[_0x8467('0x4')]=function(_0x4d8b1a){for(var _0x3ec9ac=0x0,_0x58b1a7=events['length'];_0x3ec9ac<_0x58b1a7;_0x3ec9ac++){var _0x4484ac=events[_0x3ec9ac];var _0x1e7390=createListener(_0x8467('0x5')+_0x4484ac,_0x4d8b1a);DashboardEvents['on'](_0x4484ac,_0x1e7390);}}; \ No newline at end of file +var _0x9143=['length','dashboard:','./dashboard.events','save','remove','emit','removeListener','register'];(function(_0x492481,_0x1b0215){var _0x41a9c3=function(_0x55c4d0){while(--_0x55c4d0){_0x492481['push'](_0x492481['shift']());}};_0x41a9c3(++_0x1b0215);}(_0x9143,0xa2));var _0x3914=function(_0x8b004f,_0x51a191){_0x8b004f=_0x8b004f-0x0;var _0x3e1f49=_0x9143[_0x8b004f];return _0x3e1f49;};'use strict';var DashboardEvents=require(_0x3914('0x0'));var events=[_0x3914('0x1'),_0x3914('0x2'),'update'];function createListener(_0x3c3076,_0x350e80){return function(_0x28a7e1){_0x350e80[_0x3914('0x3')](_0x3c3076,_0x28a7e1);};}function removeListener(_0x2ba8b7,_0x2430c8){return function(){DashboardEvents[_0x3914('0x4')](_0x2ba8b7,_0x2430c8);};}exports[_0x3914('0x5')]=function(_0x2d57e7){for(var _0x5cdf6b=0x0,_0x57d712=events[_0x3914('0x6')];_0x5cdf6b<_0x57d712;_0x5cdf6b++){var _0xbf3bf4=events[_0x5cdf6b];var _0x57e2af=createListener(_0x3914('0x7')+_0xbf3bf4,_0x2d57e7);DashboardEvents['on'](_0xbf3bf4,_0x57e2af);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2c27f93..3d2f5c3 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 _0x9eca=['clone','put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','post','/:id/clone'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x9eca,0x1cf));var _0xa9ec=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0x9eca[_0x40d339];return _0x5cbd0b;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa9ec('0x3'));var router=express['Router']();var fs_extra=require(_0xa9ec('0x4'));var auth=require(_0xa9ec('0x5'));var interaction=require(_0xa9ec('0x6'));var config=require(_0xa9ec('0x7'));var controller=require(_0xa9ec('0x8'));router[_0xa9ec('0x9')]('/',auth['isAuthenticated'](),controller[_0xa9ec('0xa')]);router[_0xa9ec('0x9')](_0xa9ec('0xb'),auth[_0xa9ec('0xc')](),controller[_0xa9ec('0xd')]);router['get'](_0xa9ec('0xe'),auth[_0xa9ec('0xc')](),controller['getItems']);router[_0xa9ec('0xf')]('/',auth[_0xa9ec('0xc')](),controller['create']);router['post'](_0xa9ec('0x10'),auth[_0xa9ec('0xc')](),controller[_0xa9ec('0x11')]);router[_0xa9ec('0xf')](_0xa9ec('0xe'),auth['isAuthenticated'](),controller['addItem']);router[_0xa9ec('0x12')]('/:id',auth[_0xa9ec('0xc')](),controller['update']);router['delete'](_0xa9ec('0xb'),auth[_0xa9ec('0xc')](),controller['destroy']);module[_0xa9ec('0x13')]=router; \ No newline at end of file +var _0x074a=['/:id/clone','clone','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create'];(function(_0x17c5bb,_0x579cc5){var _0x1053d5=function(_0x59af40){while(--_0x59af40){_0x17c5bb['push'](_0x17c5bb['shift']());}};_0x1053d5(++_0x579cc5);}(_0x074a,0x7e));var _0xa074=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x074a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require(_0xa074('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa074('0x4'));var auth=require(_0xa074('0x5'));var interaction=require(_0xa074('0x6'));var config=require(_0xa074('0x7'));var controller=require(_0xa074('0x8'));router[_0xa074('0x9')]('/',auth[_0xa074('0xa')](),controller[_0xa074('0xb')]);router[_0xa074('0x9')](_0xa074('0xc'),auth[_0xa074('0xa')](),controller[_0xa074('0xd')]);router[_0xa074('0x9')](_0xa074('0xe'),auth[_0xa074('0xa')](),controller[_0xa074('0xf')]);router[_0xa074('0x10')]('/',auth['isAuthenticated'](),controller[_0xa074('0x11')]);router[_0xa074('0x10')](_0xa074('0x12'),auth[_0xa074('0xa')](),controller[_0xa074('0x13')]);router[_0xa074('0x10')](_0xa074('0xe'),auth[_0xa074('0xa')](),controller['addItem']);router[_0xa074('0x14')](_0xa074('0xc'),auth[_0xa074('0xa')](),controller[_0xa074('0x15')]);router['delete'](_0xa074('0xc'),auth['isAuthenticated'](),controller[_0xa074('0x16')]);module[_0xa074('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1c4f6d4..6ea0c5e 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 _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x486f1d,_0x90c2b5){_0x486f1d=_0x486f1d-0x0;var _0x5a2c2d=_0xfdbd[_0x486f1d];return _0x5a2c2d;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x2a6d2d,_0x4070bb){var _0x3cdc0b=function(_0x5ca2c4){while(--_0x5ca2c4){_0x2a6d2d['push'](_0x2a6d2d['shift']());}};_0x3cdc0b(++_0x4070bb);}(_0xadb5,0xad));var _0x5adb=function(_0x27c69d,_0x528221){_0x27c69d=_0x27c69d-0x0;var _0x316132=_0xadb5[_0x27c69d];return _0x316132;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ba32215..4554445 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 _0x7919=['fields','attributes','length','includeAll','merge','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection'];(function(_0x3cc05a,_0x1a0c6c){var _0x301bae=function(_0x24c71e){while(--_0x24c71e){_0x3cc05a['push'](_0x3cc05a['shift']());}};_0x301bae(++_0x1a0c6c);}(_0x7919,0xeb));var _0x9791=function(_0x392e38,_0x25a564){_0x392e38=_0x392e38-0x0;var _0x44d727=_0x7919[_0x392e38];return _0x44d727;};'use strict';var emlformat=require(_0x9791('0x0'));var rimraf=require(_0x9791('0x1'));var zipdir=require(_0x9791('0x2'));var jsonpatch=require(_0x9791('0x3'));var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require('mustache');var util=require(_0x9791('0x7'));var path=require(_0x9791('0x8'));var sox=require('sox');var csv=require(_0x9791('0x9'));var ejs=require(_0x9791('0xa'));var fs=require('fs');var fs_extra=require(_0x9791('0xb'));var _=require(_0x9791('0xc'));var squel=require(_0x9791('0xd'));var crypto=require('crypto');var jsforce=require(_0x9791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9791('0x10'));var as=require(_0x9791('0x11'));var hardwareService=require(_0x9791('0x12'));var logger=require(_0x9791('0x13'))(_0x9791('0x14'));var utils=require(_0x9791('0x15'));var config=require(_0x9791('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9791('0x17'))['db'];config['redis']=_[_0x9791('0x18')](config[_0x9791('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9791('0x1a'))(new Redis(config['redis']));require(_0x9791('0x1b'))[_0x9791('0x1c')](socket);function respondWithStatusCode(_0x1e05a2,_0x2d89d0){_0x2d89d0=_0x2d89d0||0xcc;return function(_0x11c83f){if(_0x11c83f){return _0x1e05a2[_0x9791('0x1d')](_0x2d89d0);}return _0x1e05a2[_0x9791('0x1e')](_0x2d89d0)[_0x9791('0x1f')]();};}function respondWithResult(_0x1b3626,_0x263bf4){_0x263bf4=_0x263bf4||0xc8;return function(_0x43a07e){if(_0x43a07e){return _0x1b3626[_0x9791('0x1e')](_0x263bf4)[_0x9791('0x20')](_0x43a07e);}};}function respondWithFilteredResult(_0x566a69,_0x2c6e99){return function(_0x402c83){if(_0x402c83){var _0x22b6fb=typeof _0x2c6e99[_0x9791('0x21')]===_0x9791('0x22')&&typeof _0x2c6e99['limit']===_0x9791('0x22');var _0x6d90c9=_0x402c83[_0x9791('0x23')];var _0x2cfaa2=_0x22b6fb?0x0:_0x2c6e99[_0x9791('0x21')];var _0xef3a83=_0x22b6fb?_0x402c83[_0x9791('0x23')]:_0x2c6e99[_0x9791('0x21')]+_0x2c6e99[_0x9791('0x24')];var _0x27a5e4;if(_0xef3a83>=_0x6d90c9){_0xef3a83=_0x6d90c9;_0x27a5e4=0xc8;}else{_0x27a5e4=0xce;}_0x566a69[_0x9791('0x1e')](_0x27a5e4);return _0x566a69['set'](_0x9791('0x25'),_0x2cfaa2+'-'+_0xef3a83+'/'+_0x6d90c9)['json'](_0x402c83);}return null;};}function patchUpdates(_0x4fe98f){return function(_0x571554){try{jsonpatch[_0x9791('0x26')](_0x571554,_0x4fe98f,!![]);}catch(_0x557e2b){return BPromise[_0x9791('0x27')](_0x557e2b);}return _0x571554[_0x9791('0x28')]();};}function saveUpdates(_0x7f08c8,_0x4ac5b5){return function(_0x620cb1){if(_0x620cb1){return _0x620cb1[_0x9791('0x29')](_0x7f08c8)[_0x9791('0x2a')](function(_0x4c3c00){return _0x4c3c00;});}return null;};}function removeEntity(_0x1c188b,_0x5264b6){return function(_0xc286ac){if(_0xc286ac){return _0xc286ac[_0x9791('0x2b')]()['then'](function(){_0x1c188b[_0x9791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2174d9,_0x545b9b){return function(_0x3baa79){if(!_0x3baa79){_0x2174d9[_0x9791('0x1d')](0x194);}return _0x3baa79;};}function handleError(_0x5d943f,_0x5f336c){_0x5f336c=_0x5f336c||0x1f4;return function(_0x55614a){logger[_0x9791('0x2c')](_0x55614a[_0x9791('0x2d')]);if(_0x55614a[_0x9791('0x2e')]){delete _0x55614a[_0x9791('0x2e')];}_0x5d943f['status'](_0x5f336c)[_0x9791('0x2f')](_0x55614a);};}exports[_0x9791('0x30')]=function(_0x52e9fd,_0x1814fa){var _0x309e58={'raw':![],'where':{'id':_0x52e9fd[_0x9791('0x31')]['id']}},_0x28522d={};_0x28522d[_0x9791('0x32')]=_[_0x9791('0x33')](db['DashboardItem'][_0x9791('0x34')]);_0x28522d[_0x9791('0x35')]=_[_0x9791('0x33')](_0x52e9fd['query']);_0x28522d[_0x9791('0x36')]=_['intersection'](_0x28522d[_0x9791('0x32')],_0x28522d['query']);_0x309e58['attributes']=_[_0x9791('0x37')](_0x28522d['model'],qs[_0x9791('0x38')](_0x52e9fd[_0x9791('0x35')]['fields']));_0x309e58[_0x9791('0x39')]=_0x309e58[_0x9791('0x39')][_0x9791('0x3a')]?_0x309e58['attributes']:_0x28522d[_0x9791('0x32')];if(_0x52e9fd[_0x9791('0x35')][_0x9791('0x3b')]){_0x309e58['include']=[{'all':!![]}];}_0x309e58=_[_0x9791('0x3c')]({},_0x309e58,_0x52e9fd['options']);return db[_0x9791('0x3d')]['find'](_0x309e58)[_0x9791('0x2a')](handleEntityNotFound(_0x1814fa,null))[_0x9791('0x2a')](respondWithResult(_0x1814fa,null))['catch'](handleError(_0x1814fa,null));};exports[_0x9791('0x2b')]=function(_0x34f7ff,_0x1ee18a){return db[_0x9791('0x3d')][_0x9791('0x3e')]({'where':{'id':_0x34f7ff['params']['id']}})[_0x9791('0x2a')](handleEntityNotFound(_0x1ee18a,null))[_0x9791('0x2a')](removeEntity(_0x1ee18a,null))[_0x9791('0x3f')](handleError(_0x1ee18a,null));};function widgetAttributes(_0xf3a1be){try{switch(_0xf3a1be[_0x9791('0x40')]){case _0x9791('0x41'):return[{'name':_0x9791('0x42'),'value':_0xf3a1be['attrUrl']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0][_0x9791('0x44')]:undefined)||'https://'}];case _0x9791('0x45'):return[{'name':_0x9791('0x46'),'value':_0xf3a1be['attrPath']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x0]?_0xf3a1be[_0x9791('0x43')][0x0]['value']:undefined)||''}];case _0x9791('0x47'):return[{'name':'attrHourFormat','value':_0xf3a1be['attrHourFormat']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0]['value']:undefined)||_0x9791('0x48')},{'name':_0x9791('0x49'),'value':_0xf3a1be['attrTimezone']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be['attrs'][0x1][_0x9791('0x44')]:undefined)||'0.00'},{'name':_0x9791('0x4a'),'value':_0xf3a1be[_0x9791('0x4a')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be[_0x9791('0x43')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x9791('0x4b'),'value':_0xf3a1be[_0x9791('0x4b')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0][_0x9791('0x44')]:undefined)||_0x9791('0x4c')},{'name':_0x9791('0x4d'),'value':_0xf3a1be[_0x9791('0x4d')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be[_0x9791('0x43')][0x1][_0x9791('0x44')]:undefined)||[]},{'name':_0x9791('0x4a'),'value':_0xf3a1be[_0x9791('0x4a')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be['attrs'][0x2][_0x9791('0x44')]:undefined)||0x14},{'name':_0x9791('0x4e'),'value':_0xf3a1be[_0x9791('0x4e')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x3]?_0xf3a1be[_0x9791('0x43')][0x3][_0x9791('0x44')]:undefined)||_0x9791('0x4f')},{'name':'attrEmailAccounts','value':_0xf3a1be[_0x9791('0x50')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x4]?_0xf3a1be[_0x9791('0x43')][0x4]['value']:undefined)||''},{'name':_0x9791('0x51'),'value':_0xf3a1be[_0x9791('0x51')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x5]?_0xf3a1be[_0x9791('0x43')][0x5]['value']:undefined)||''},{'name':_0x9791('0x52'),'value':_0xf3a1be['attrSmsAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x6]?_0xf3a1be[_0x9791('0x43')][0x6][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x53'),'value':_0xf3a1be[_0x9791('0x53')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x7]?_0xf3a1be[_0x9791('0x43')][0x7]['value']:undefined)||''},{'name':_0x9791('0x54'),'value':_0xf3a1be['attrWhatsappAccounts']||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x8]?_0xf3a1be[_0x9791('0x43')][0x8][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x55'),'value':_0xf3a1be[_0x9791('0x55')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x9]?_0xf3a1be[_0x9791('0x43')][0x9][_0x9791('0x44')]:undefined)||''}];case _0x9791('0x56'):case _0x9791('0x57'):return[{'name':_0x9791('0x58'),'value':_0xf3a1be[_0x9791('0x58')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be['attrs'][0x0]['value']:undefined)||_0x9791('0x4c')},{'name':_0x9791('0x59'),'value':_0xf3a1be[_0x9791('0x59')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be[_0x9791('0x43')][0x1][_0x9791('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0xf3a1be[_0x9791('0x5a')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x2]?_0xf3a1be[_0x9791('0x43')][0x2][_0x9791('0x44')]:undefined)||null},{'name':_0x9791('0x4d'),'value':_0xf3a1be[_0x9791('0x4d')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x3]?_0xf3a1be[_0x9791('0x43')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0xf3a1be[_0x9791('0x4e')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x4]?_0xf3a1be[_0x9791('0x43')][0x4][_0x9791('0x44')]:undefined)||'voice'},{'name':_0x9791('0x50'),'value':_0xf3a1be['attrEmailAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x5]?_0xf3a1be[_0x9791('0x43')][0x5][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x51'),'value':_0xf3a1be[_0x9791('0x51')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be['attrs'][0x6]?_0xf3a1be['attrs'][0x6][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x52'),'value':_0xf3a1be['attrSmsAccounts']||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x7]?_0xf3a1be[_0x9791('0x43')][0x7][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x53'),'value':_0xf3a1be['attrOpenchannelAccounts']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x8]?_0xf3a1be[_0x9791('0x43')][0x8][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x54'),'value':_0xf3a1be[_0x9791('0x54')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x9]?_0xf3a1be[_0x9791('0x43')][0x9][_0x9791('0x44')]:undefined)||''},{'name':_0x9791('0x55'),'value':_0xf3a1be['attrChatWebsites']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0xa]?_0xf3a1be[_0x9791('0x43')][0xa][_0x9791('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x9791('0x5b'),'type':_0xf3a1be[_0x9791('0x5c')]||(_0xf3a1be['attrs']&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0][_0x9791('0x40')]:undefined)||null,'value':_0xf3a1be['attrReport']||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x0]?_0xf3a1be[_0x9791('0x43')][0x0]['value']:undefined)||null},{'name':_0x9791('0x5d'),'value':_0xf3a1be[_0x9791('0x5d')]||(_0xf3a1be[_0x9791('0x43')]&&_0xf3a1be[_0x9791('0x43')][0x1]?_0xf3a1be['attrs'][0x1][_0x9791('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x578783){logger[_0x9791('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9791('0x5e')](_0x578783));return[];}}exports[_0x9791('0x5f')]=function(_0x5e2399,_0x1f0826){if(_0x5e2399[_0x9791('0x60')]){_0x5e2399[_0x9791('0x60')][_0x9791('0x43')]=widgetAttributes(_0x5e2399[_0x9791('0x60')]);}return db[_0x9791('0x3d')][_0x9791('0x5f')](_0x5e2399[_0x9791('0x60')],{})['then'](respondWithResult(_0x1f0826,0xc9))[_0x9791('0x3f')](handleError(_0x1f0826,null));};exports[_0x9791('0x29')]=function(_0x1f0d46,_0xbf59d){if(_0x1f0d46[_0x9791('0x60')]['id']){delete _0x1f0d46[_0x9791('0x60')]['id'];}_0x1f0d46[_0x9791('0x60')][_0x9791('0x43')]=widgetAttributes(_0x1f0d46[_0x9791('0x60')]);return db[_0x9791('0x3d')][_0x9791('0x3e')]({'where':{'id':_0x1f0d46[_0x9791('0x31')]['id']}})[_0x9791('0x2a')](handleEntityNotFound(_0xbf59d,null))[_0x9791('0x2a')](saveUpdates(_0x1f0d46[_0x9791('0x60')],null))[_0x9791('0x2a')](respondWithResult(_0xbf59d,null))[_0x9791('0x3f')](handleError(_0xbf59d,null));}; \ No newline at end of file +var _0x7958=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','catch','attrUrl','attrs','value','custom','attrPath','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x39a29e,_0xcc7e83){var _0x233f71=function(_0x56b126){while(--_0x56b126){_0x39a29e['push'](_0x39a29e['shift']());}};_0x233f71(++_0xcc7e83);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x8795('0x0'));var rimraf=require(_0x8795('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8795('0x2'));var rp=require(_0x8795('0x3'));var moment=require(_0x8795('0x4'));var BPromise=require(_0x8795('0x5'));var Mustache=require(_0x8795('0x6'));var util=require(_0x8795('0x7'));var path=require(_0x8795('0x8'));var sox=require(_0x8795('0x9'));var csv=require('to-csv');var ejs=require(_0x8795('0xa'));var fs=require('fs');var fs_extra=require(_0x8795('0xb'));var _=require(_0x8795('0xc'));var squel=require('squel');var crypto=require(_0x8795('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8795('0xe'));var toCsv=require(_0x8795('0xf'));var querystring=require(_0x8795('0x10'));var Papa=require(_0x8795('0x11'));var Redis=require(_0x8795('0x12'));var authService=require(_0x8795('0x13'));var qs=require(_0x8795('0x14'));var as=require(_0x8795('0x15'));var hardwareService=require(_0x8795('0x16'));var logger=require(_0x8795('0x17'))(_0x8795('0x18'));var utils=require(_0x8795('0x19'));var config=require(_0x8795('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8795('0x1b'))['db'];config[_0x8795('0x1c')]=_[_0x8795('0x1d')](config[_0x8795('0x1c')],{'host':_0x8795('0x1e'),'port':0x18eb});var socket=require(_0x8795('0x1f'))(new Redis(config[_0x8795('0x1c')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x595064,_0x283437){_0x283437=_0x283437||0xcc;return function(_0xb3f0d7){if(_0xb3f0d7){return _0x595064[_0x8795('0x20')](_0x283437);}return _0x595064[_0x8795('0x21')](_0x283437)[_0x8795('0x22')]();};}function respondWithResult(_0x2027c1,_0x3f835f){_0x3f835f=_0x3f835f||0xc8;return function(_0x5017fc){if(_0x5017fc){return _0x2027c1[_0x8795('0x21')](_0x3f835f)['json'](_0x5017fc);}};}function respondWithFilteredResult(_0x42005e,_0x1eed23){return function(_0x498eea){if(_0x498eea){var _0x2e5452=typeof _0x1eed23[_0x8795('0x23')]===_0x8795('0x24')&&typeof _0x1eed23[_0x8795('0x25')]==='undefined';var _0x1aae20=_0x498eea[_0x8795('0x26')];var _0x4a65f0=_0x2e5452?0x0:_0x1eed23[_0x8795('0x23')];var _0x2a9501=_0x2e5452?_0x498eea[_0x8795('0x26')]:_0x1eed23[_0x8795('0x23')]+_0x1eed23['limit'];var _0x1930ca;if(_0x2a9501>=_0x1aae20){_0x2a9501=_0x1aae20;_0x1930ca=0xc8;}else{_0x1930ca=0xce;}_0x42005e['status'](_0x1930ca);return _0x42005e['set'](_0x8795('0x27'),_0x4a65f0+'-'+_0x2a9501+'/'+_0x1aae20)['json'](_0x498eea);}return null;};}function patchUpdates(_0x396f97){return function(_0x237091){try{jsonpatch['apply'](_0x237091,_0x396f97,!![]);}catch(_0x2d5097){return BPromise[_0x8795('0x28')](_0x2d5097);}return _0x237091[_0x8795('0x29')]();};}function saveUpdates(_0x1aa57a,_0x170e1b){return function(_0x3db752){if(_0x3db752){return _0x3db752['update'](_0x1aa57a)['then'](function(_0x163707){return _0x163707;});}return null;};}function removeEntity(_0x4ff62c,_0x3ed14c){return function(_0x389c38){if(_0x389c38){return _0x389c38[_0x8795('0x2a')]()[_0x8795('0x2b')](function(){_0x4ff62c[_0x8795('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8dc441,_0xdef175){return function(_0x5e06c5){if(!_0x5e06c5){_0x8dc441[_0x8795('0x20')](0x194);}return _0x5e06c5;};}function handleError(_0x1baa26,_0x3ce361){_0x3ce361=_0x3ce361||0x1f4;return function(_0x28770c){logger[_0x8795('0x2c')](_0x28770c[_0x8795('0x2d')]);if(_0x28770c[_0x8795('0x2e')]){delete _0x28770c[_0x8795('0x2e')];}_0x1baa26[_0x8795('0x21')](_0x3ce361)[_0x8795('0x2f')](_0x28770c);};}exports[_0x8795('0x30')]=function(_0x4d5707,_0x3fd6e3){var _0xa5c815={'raw':![],'where':{'id':_0x4d5707[_0x8795('0x31')]['id']}},_0x3aab08={};_0x3aab08['model']=_[_0x8795('0x32')](db[_0x8795('0x33')][_0x8795('0x34')]);_0x3aab08[_0x8795('0x35')]=_[_0x8795('0x32')](_0x4d5707[_0x8795('0x35')]);_0x3aab08[_0x8795('0x36')]=_[_0x8795('0x37')](_0x3aab08['model'],_0x3aab08['query']);_0xa5c815[_0x8795('0x38')]=_[_0x8795('0x37')](_0x3aab08[_0x8795('0x39')],qs[_0x8795('0x3a')](_0x4d5707['query'][_0x8795('0x3a')]));_0xa5c815[_0x8795('0x38')]=_0xa5c815[_0x8795('0x38')][_0x8795('0x3b')]?_0xa5c815[_0x8795('0x38')]:_0x3aab08[_0x8795('0x39')];if(_0x4d5707[_0x8795('0x35')][_0x8795('0x3c')]){_0xa5c815[_0x8795('0x3d')]=[{'all':!![]}];}_0xa5c815=_[_0x8795('0x3e')]({},_0xa5c815,_0x4d5707[_0x8795('0x3f')]);return db[_0x8795('0x33')][_0x8795('0x40')](_0xa5c815)[_0x8795('0x2b')](handleEntityNotFound(_0x3fd6e3,null))[_0x8795('0x2b')](respondWithResult(_0x3fd6e3,null))[_0x8795('0x41')](handleError(_0x3fd6e3,null));};exports[_0x8795('0x2a')]=function(_0x3886f2,_0x394e29){return db[_0x8795('0x33')][_0x8795('0x40')]({'where':{'id':_0x3886f2[_0x8795('0x31')]['id']}})[_0x8795('0x2b')](handleEntityNotFound(_0x394e29,null))[_0x8795('0x2b')](removeEntity(_0x394e29,null))[_0x8795('0x41')](handleError(_0x394e29,null));};function widgetAttributes(_0x16ea8f){try{switch(_0x16ea8f['type']){case'iframe':return[{'name':_0x8795('0x42'),'value':_0x16ea8f[_0x8795('0x42')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x0]?_0x16ea8f['attrs'][0x0][_0x8795('0x44')]:undefined)||'https://'}];case _0x8795('0x45'):return[{'name':_0x8795('0x46'),'value':_0x16ea8f['attrPath']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x0]?_0x16ea8f[_0x8795('0x43')][0x0][_0x8795('0x44')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x16ea8f['attrHourFormat']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x0]?_0x16ea8f['attrs'][0x0][_0x8795('0x44')]:undefined)||_0x8795('0x47')},{'name':_0x8795('0x48'),'value':_0x16ea8f[_0x8795('0x48')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x1]?_0x16ea8f[_0x8795('0x43')][0x1]['value']:undefined)||_0x8795('0x49')},{'name':'attrFontSize','value':_0x16ea8f['attrFontSize']||(_0x16ea8f['attrs']&&_0x16ea8f[_0x8795('0x43')][0x2]?_0x16ea8f[_0x8795('0x43')][0x2][_0x8795('0x44')]:undefined)||0xc}];case _0x8795('0x4a'):return[{'name':_0x8795('0x4b'),'value':_0x16ea8f[_0x8795('0x4b')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x0]?_0x16ea8f['attrs'][0x0][_0x8795('0x44')]:undefined)||'total'},{'name':_0x8795('0x4c'),'value':_0x16ea8f[_0x8795('0x4c')]||(_0x16ea8f['attrs']&&_0x16ea8f[_0x8795('0x43')][0x1]?_0x16ea8f[_0x8795('0x43')][0x1]['value']:undefined)||[]},{'name':_0x8795('0x4d'),'value':_0x16ea8f[_0x8795('0x4d')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x2]?_0x16ea8f['attrs'][0x2][_0x8795('0x44')]:undefined)||0x14},{'name':_0x8795('0x4e'),'value':_0x16ea8f['attrChannel']||(_0x16ea8f['attrs']&&_0x16ea8f[_0x8795('0x43')][0x3]?_0x16ea8f[_0x8795('0x43')][0x3][_0x8795('0x44')]:undefined)||_0x8795('0x4f')},{'name':'attrEmailAccounts','value':_0x16ea8f[_0x8795('0x50')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x4]?_0x16ea8f[_0x8795('0x43')][0x4][_0x8795('0x44')]:undefined)||''},{'name':_0x8795('0x51'),'value':_0x16ea8f[_0x8795('0x51')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x5]?_0x16ea8f['attrs'][0x5][_0x8795('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x16ea8f[_0x8795('0x52')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x6]?_0x16ea8f[_0x8795('0x43')][0x6][_0x8795('0x44')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x16ea8f['attrOpenchannelAccounts']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x7]?_0x16ea8f[_0x8795('0x43')][0x7][_0x8795('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x16ea8f[_0x8795('0x53')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x8]?_0x16ea8f[_0x8795('0x43')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x16ea8f[_0x8795('0x54')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x9]?_0x16ea8f['attrs'][0x9]['value']:undefined)||''}];case _0x8795('0x55'):case _0x8795('0x56'):return[{'name':_0x8795('0x57'),'value':_0x16ea8f['attrSerie1']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x0]?_0x16ea8f[_0x8795('0x43')][0x0][_0x8795('0x44')]:undefined)||_0x8795('0x58')},{'name':_0x8795('0x59'),'value':_0x16ea8f[_0x8795('0x59')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x1]?_0x16ea8f[_0x8795('0x43')][0x1]['value']:undefined)||null},{'name':_0x8795('0x5a'),'value':_0x16ea8f[_0x8795('0x5a')]||(_0x16ea8f['attrs']&&_0x16ea8f['attrs'][0x2]?_0x16ea8f[_0x8795('0x43')][0x2][_0x8795('0x44')]:undefined)||null},{'name':_0x8795('0x4c'),'value':_0x16ea8f['attrVoiceQueues']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x3]?_0x16ea8f[_0x8795('0x43')][0x3][_0x8795('0x44')]:undefined)||[]},{'name':_0x8795('0x4e'),'value':_0x16ea8f['attrChannel']||(_0x16ea8f['attrs']&&_0x16ea8f['attrs'][0x4]?_0x16ea8f[_0x8795('0x43')][0x4][_0x8795('0x44')]:undefined)||'voice'},{'name':_0x8795('0x50'),'value':_0x16ea8f[_0x8795('0x50')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x5]?_0x16ea8f[_0x8795('0x43')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x16ea8f['attrFaxAccounts']||(_0x16ea8f['attrs']&&_0x16ea8f[_0x8795('0x43')][0x6]?_0x16ea8f[_0x8795('0x43')][0x6][_0x8795('0x44')]:undefined)||''},{'name':_0x8795('0x52'),'value':_0x16ea8f['attrSmsAccounts']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x7]?_0x16ea8f[_0x8795('0x43')][0x7][_0x8795('0x44')]:undefined)||''},{'name':_0x8795('0x5b'),'value':_0x16ea8f[_0x8795('0x5b')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x8]?_0x16ea8f[_0x8795('0x43')][0x8][_0x8795('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x16ea8f[_0x8795('0x53')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x9]?_0x16ea8f[_0x8795('0x43')][0x9][_0x8795('0x44')]:undefined)||''},{'name':_0x8795('0x54'),'value':_0x16ea8f[_0x8795('0x54')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0xa]?_0x16ea8f[_0x8795('0x43')][0xa][_0x8795('0x44')]:undefined)||''}];case _0x8795('0x5c'):return[{'name':_0x8795('0x5d'),'type':_0x16ea8f['reportType']||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f[_0x8795('0x43')][0x0]?_0x16ea8f['attrs'][0x0]['type']:undefined)||null,'value':_0x16ea8f[_0x8795('0x5d')]||(_0x16ea8f[_0x8795('0x43')]&&_0x16ea8f['attrs'][0x0]?_0x16ea8f[_0x8795('0x43')][0x0][_0x8795('0x44')]:undefined)||null},{'name':_0x8795('0x5e'),'value':_0x16ea8f[_0x8795('0x5e')]||(_0x16ea8f['attrs']&&_0x16ea8f['attrs'][0x1]?_0x16ea8f[_0x8795('0x43')][0x1][_0x8795('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x1219f6){logger['error'](_0x8795('0x5f'),JSON[_0x8795('0x60')](_0x1219f6));return[];}}exports[_0x8795('0x61')]=function(_0x1be553,_0x296a54){if(_0x1be553['body']){_0x1be553[_0x8795('0x62')][_0x8795('0x43')]=widgetAttributes(_0x1be553[_0x8795('0x62')]);}return db[_0x8795('0x33')][_0x8795('0x61')](_0x1be553['body'],{})[_0x8795('0x2b')](respondWithResult(_0x296a54,0xc9))['catch'](handleError(_0x296a54,null));};exports['update']=function(_0xcfdb92,_0x233927){if(_0xcfdb92[_0x8795('0x62')]['id']){delete _0xcfdb92[_0x8795('0x62')]['id'];}_0xcfdb92[_0x8795('0x62')][_0x8795('0x43')]=widgetAttributes(_0xcfdb92[_0x8795('0x62')]);return db[_0x8795('0x33')][_0x8795('0x40')]({'where':{'id':_0xcfdb92[_0x8795('0x31')]['id']}})[_0x8795('0x2b')](handleEntityNotFound(_0x233927,null))['then'](saveUpdates(_0xcfdb92[_0x8795('0x62')],null))[_0x8795('0x2b')](respondWithResult(_0x233927,null))[_0x8795('0x41')](handleError(_0x233927,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 65202ff..392948d 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 _0x3496=['exports','events','setMaxListeners','save','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3496,0x1a5));var _0x6349=function(_0x51f9ca,_0x3bb9db){_0x51f9ca=_0x51f9ca-0x0;var _0x4ea88a=_0x3496[_0x51f9ca];return _0x4ea88a;};'use strict';var EventEmitter=require(_0x6349('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6349('0x1')](0x0);var events={'afterCreate':_0x6349('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xa4ddf2){return function(_0x50fbf2,_0x18dfbf,_0x38bc12){DashboardItemEvents['emit'](_0xa4ddf2+':'+_0x50fbf2['id'],_0x50fbf2);DashboardItemEvents[_0x6349('0x3')](_0xa4ddf2,_0x50fbf2);_0x38bc12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x6349('0x4')](e,emitEvent(event));}}module[_0x6349('0x5')]=DashboardItemEvents; \ No newline at end of file +var _0xad81=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad81,0x168));var _0x1ad8=function(_0x1f4873,_0x38c7c3){_0x1f4873=_0x1f4873-0x0;var _0x4255f4=_0xad81[_0x1f4873];return _0x4255f4;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x1ad8('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1ad8('0x1')](0x0);var events={'afterCreate':_0x1ad8('0x2'),'afterUpdate':_0x1ad8('0x3'),'afterDestroy':_0x1ad8('0x4')};function emitEvent(_0x494874){return function(_0x12fb93,_0xd6649f,_0x58f97b){DashboardItemEvents[_0x1ad8('0x5')](_0x494874+':'+_0x12fb93['id'],_0x12fb93);DashboardItemEvents[_0x1ad8('0x5')](_0x494874,_0x12fb93);_0x58f97b(null);};}for(var e in events){if(events[_0x1ad8('0x6')](e)){var event=events[e];DashboardItem[_0x1ad8('0x7')](e,emitEvent(event));}}module[_0x1ad8('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 656e4d0..3605756 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 _0x20e7=['./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x20e7,0x178));var _0x720e=function(_0x58c462,_0x6fb9e1){_0x58c462=_0x58c462-0x0;var _0x580140=_0x20e7[_0x58c462];return _0x580140;};'use strict';var _=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var logger=require('../../config/logger')(_0x720e('0x2'));var moment=require(_0x720e('0x3'));var BPromise=require('bluebird');var rp=require(_0x720e('0x4'));var fs=require('fs');var path=require(_0x720e('0x5'));var rimraf=require(_0x720e('0x6'));var config=require(_0x720e('0x7'));var attributes=require(_0x720e('0x8'));module['exports']=function(_0x14ff38,_0x2b2c47){return _0x14ff38[_0x720e('0x9')](_0x720e('0xa'),attributes,{'tableName':_0x720e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf975=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xf975,0x1c8));var _0x5f97=function(_0x52d441,_0x343fb0){_0x52d441=_0x52d441-0x0;var _0x5cf70f=_0xf975[_0x52d441];return _0x5cf70f;};'use strict';var _=require('lodash');var util=require(_0x5f97('0x0'));var logger=require(_0x5f97('0x1'))(_0x5f97('0x2'));var moment=require(_0x5f97('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f97('0x4'));var rimraf=require(_0x5f97('0x5'));var config=require(_0x5f97('0x6'));var attributes=require(_0x5f97('0x7'));module[_0x5f97('0x8')]=function(_0x4b4dd5,_0x33ef5e){return _0x4b4dd5[_0x5f97('0x9')](_0x5f97('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index bbaf15d..866dfa3 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 _0x612b=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c3a92,_0x49a217){var _0x9d10ce=function(_0x187f8b){while(--_0x187f8b){_0x1c3a92['push'](_0x1c3a92['shift']());}};_0x9d10ce(++_0x49a217);}(_0x612b,0x147));var _0xb612=function(_0x166cbb,_0x4c692a){_0x166cbb=_0x166cbb-0x0;var _0x43a380=_0x612b[_0x166cbb];return _0x43a380;};'use strict';var _=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var moment=require('moment');var BPromise=require(_0xb612('0x2'));var rs=require(_0xb612('0x3'));var fs=require('fs');var Redis=require(_0xb612('0x4'));var db=require(_0xb612('0x5'))['db'];var utils=require(_0xb612('0x6'));var logger=require(_0xb612('0x7'))(_0xb612('0x8'));var config=require(_0xb612('0x9'));var jayson=require(_0xb612('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xb612('0xb')]=_[_0xb612('0xc')](config[_0xb612('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb612('0xd'))(new Redis(config[_0xb612('0xb')]));require('./dashboardItem.socket')[_0xb612('0xe')](socket);function respondWithRpcPromise(_0x14171a,_0x3fe9a4,_0x467935){return new BPromise(function(_0x1a74c5,_0x29ad94){return client[_0xb612('0xf')](_0x14171a,_0x467935)['then'](function(_0x116e77){logger[_0xb612('0x10')](_0xb612('0x11'),_0x3fe9a4,_0xb612('0x12'));logger[_0xb612('0x13')](_0xb612('0x14'),_0x3fe9a4,_0xb612('0x12'),JSON[_0xb612('0x15')](_0x116e77));if(_0x116e77['error']){if(_0x116e77[_0xb612('0x16')][_0xb612('0x17')]===0x1f4){logger[_0xb612('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3fe9a4,_0x116e77['error'][_0xb612('0x18')]);return _0x29ad94(_0x116e77[_0xb612('0x16')][_0xb612('0x18')]);}logger[_0xb612('0x16')](_0xb612('0x11'),_0x3fe9a4,_0x116e77['error'][_0xb612('0x18')]);return _0x1a74c5(_0x116e77[_0xb612('0x16')]['message']);}else{logger[_0xb612('0x10')](_0xb612('0x11'),_0x3fe9a4,'request\x20sent');_0x1a74c5(_0x116e77[_0xb612('0x19')][_0xb612('0x18')]);}})[_0xb612('0x1a')](function(_0xf6eb6d){logger[_0xb612('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3fe9a4,_0xf6eb6d);_0x29ad94(_0xf6eb6d);});});} \ No newline at end of file +var _0xa08d=['result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s'];(function(_0x57e2dd,_0x2df50f){var _0x411f8c=function(_0x26c1c4){while(--_0x26c1c4){_0x57e2dd['push'](_0x57e2dd['shift']());}};_0x411f8c(++_0x2df50f);}(_0xa08d,0xf1));var _0xda08=function(_0x43839e,_0x54d3c7){_0x43839e=_0x43839e-0x0;var _0x3d538a=_0xa08d[_0x43839e];return _0x3d538a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda08('0x0'));var BPromise=require(_0xda08('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda08('0x2'));var db=require(_0xda08('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xda08('0x4'))(_0xda08('0x5'));var config=require('../../config/environment');var jayson=require(_0xda08('0x6'));var client=jayson[_0xda08('0x7')]['http']({'port':0x232a});config[_0xda08('0x8')]=_['defaults'](config[_0xda08('0x8')],{'host':_0xda08('0x9'),'port':0x18eb});var socket=require(_0xda08('0xa'))(new Redis(config['redis']));require(_0xda08('0xb'))['register'](socket);function respondWithRpcPromise(_0x430001,_0xe78f33,_0x55dc79){return new BPromise(function(_0x486f90,_0x2e51d2){return client[_0xda08('0xc')](_0x430001,_0x55dc79)[_0xda08('0xd')](function(_0x5c44c5){logger[_0xda08('0xe')]('DashboardItem,\x20%s,\x20%s',_0xe78f33,_0xda08('0xf'));logger[_0xda08('0x10')](_0xda08('0x11'),_0xe78f33,_0xda08('0xf'),JSON[_0xda08('0x12')](_0x5c44c5));if(_0x5c44c5[_0xda08('0x13')]){if(_0x5c44c5[_0xda08('0x13')][_0xda08('0x14')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0xe78f33,_0x5c44c5[_0xda08('0x13')]['message']);return _0x2e51d2(_0x5c44c5[_0xda08('0x13')][_0xda08('0x15')]);}logger['error'](_0xda08('0x16'),_0xe78f33,_0x5c44c5['error']['message']);return _0x486f90(_0x5c44c5[_0xda08('0x13')][_0xda08('0x15')]);}else{logger[_0xda08('0xe')](_0xda08('0x16'),_0xe78f33,_0xda08('0xf'));_0x486f90(_0x5c44c5[_0xda08('0x17')][_0xda08('0x15')]);}})['catch'](function(_0x5d4ae2){logger[_0xda08('0x13')](_0xda08('0x16'),_0xe78f33,_0x5d4ae2);_0x2e51d2(_0x5d4ae2);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 36102c8..4e9158e 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 _0xb881=['dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register','length'];(function(_0x1eee9a,_0x98444){var _0x267fbf=function(_0x2ac43f){while(--_0x2ac43f){_0x1eee9a['push'](_0x1eee9a['shift']());}};_0x267fbf(++_0x98444);}(_0xb881,0xe9));var _0x1b88=function(_0x51ba06,_0x4ed036){_0x51ba06=_0x51ba06-0x0;var _0x32a797=_0xb881[_0x51ba06];return _0x32a797;};'use strict';var DashboardItemEvents=require(_0x1b88('0x0'));var events=['save',_0x1b88('0x1'),_0x1b88('0x2')];function createListener(_0x13b341,_0x375219){return function(_0x5c7119){_0x375219[_0x1b88('0x3')](_0x13b341,_0x5c7119);};}function removeListener(_0x3d022e,_0x2dba8f){return function(){DashboardItemEvents[_0x1b88('0x4')](_0x3d022e,_0x2dba8f);};}exports[_0x1b88('0x5')]=function(_0x147e8c){for(var _0x3a1957=0x0,_0x36176c=events[_0x1b88('0x6')];_0x3a1957<_0x36176c;_0x3a1957++){var _0x44e2c8=events[_0x3a1957];var _0x4ff7aa=createListener(_0x1b88('0x7')+_0x44e2c8,_0x147e8c);DashboardItemEvents['on'](_0x44e2c8,_0x4ff7aa);}}; \ No newline at end of file +var _0x8121=['save','update','emit','length','dashboardItem:','./dashboardItem.events'];(function(_0x4dbf11,_0x36a91f){var _0x571bf9=function(_0x3edd71){while(--_0x3edd71){_0x4dbf11['push'](_0x4dbf11['shift']());}};_0x571bf9(++_0x36a91f);}(_0x8121,0xef));var _0x1812=function(_0x3b7479,_0x1f7768){_0x3b7479=_0x3b7479-0x0;var _0x4bfef5=_0x8121[_0x3b7479];return _0x4bfef5;};'use strict';var DashboardItemEvents=require(_0x1812('0x0'));var events=[_0x1812('0x1'),'remove',_0x1812('0x2')];function createListener(_0x34cff6,_0x30c2bb){return function(_0x5b15e6){_0x30c2bb[_0x1812('0x3')](_0x34cff6,_0x5b15e6);};}function removeListener(_0x12de1c,_0x33bfeb){return function(){DashboardItemEvents['removeListener'](_0x12de1c,_0x33bfeb);};}exports['register']=function(_0x2cdb6d){for(var _0x361d04=0x0,_0x227fdf=events[_0x1812('0x4')];_0x361d04<_0x227fdf;_0x361d04++){var _0x5ac66c=events[_0x361d04];var _0x39eb4c=createListener(_0x1812('0x5')+_0x5ac66c,_0x2cdb6d);DashboardItemEvents['on'](_0x5ac66c,_0x39eb4c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d5ef2e7..74c1b6f 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 _0x9656=['/:id','show','post','isAuthenticated','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x9656,0xf6));var _0x6965=function(_0x3f92bb,_0x1fbe48){_0x3f92bb=_0x3f92bb-0x0;var _0x5e12e0=_0x9656[_0x3f92bb];return _0x5e12e0;};'use strict';var multer=require(_0x6965('0x0'));var util=require('util');var path=require(_0x6965('0x1'));var timeout=require('connect-timeout');var express=require(_0x6965('0x2'));var router=express[_0x6965('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6965('0x4'));var interaction=require(_0x6965('0x5'));var config=require(_0x6965('0x6'));var controller=require(_0x6965('0x7'));router[_0x6965('0x8')](_0x6965('0x9'),auth['isAuthenticated'](),controller[_0x6965('0xa')]);router[_0x6965('0xb')]('/',auth[_0x6965('0xc')](),controller['create']);router['put'](_0x6965('0x9'),auth[_0x6965('0xc')](),controller[_0x6965('0xd')]);router['delete'](_0x6965('0x9'),auth[_0x6965('0xc')](),controller[_0x6965('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc8eb=['isAuthenticated','show','post','create','/:id','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./dashboardItem.controller','get'];(function(_0x3c10d8,_0x241158){var _0x28236d=function(_0x525f09){while(--_0x525f09){_0x3c10d8['push'](_0x3c10d8['shift']());}};_0x28236d(++_0x241158);}(_0xc8eb,0x78));var _0xbc8e=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0xc8eb[_0x460666];return _0x555cbf;};'use strict';var multer=require(_0xbc8e('0x0'));var util=require(_0xbc8e('0x1'));var path=require(_0xbc8e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc8e('0x3')]();var fs_extra=require(_0xbc8e('0x4'));var auth=require(_0xbc8e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc8e('0x6'));router[_0xbc8e('0x7')]('/:id',auth[_0xbc8e('0x8')](),controller[_0xbc8e('0x9')]);router[_0xbc8e('0xa')]('/',auth[_0xbc8e('0x8')](),controller[_0xbc8e('0xb')]);router['put'](_0xbc8e('0xc'),auth[_0xbc8e('0x8')](),controller[_0xbc8e('0xd')]);router['delete'](_0xbc8e('0xc'),auth[_0xbc8e('0x8')](),controller[_0xbc8e('0xe')]);module[_0xbc8e('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d2e63a9..5013abc 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 _0x37d2=['third','first','sequelize','exports','STRING','ENUM'];(function(_0x7f8ffa,_0x52e224){var _0x19ec7c=function(_0x59f0ae){while(--_0x59f0ae){_0x7f8ffa['push'](_0x7f8ffa['shift']());}};_0x19ec7c(++_0x52e224);}(_0x37d2,0xe6));var _0x237d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x37d2[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x237d('0x0'));module[_0x237d('0x1')]={'name':{'type':Sequelize[_0x237d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x237d('0x3')]('first','second',_0x237d('0x4')),'allowNull':![],'defaultValue':_0x237d('0x5')},'description':{'type':Sequelize[_0x237d('0x2')]}}; \ No newline at end of file +var _0x8357=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x564062,_0x1c022d){var _0x456174=function(_0x1e2301){while(--_0x1e2301){_0x564062['push'](_0x564062['shift']());}};_0x456174(++_0x1c022d);}(_0x8357,0xa2));var _0x7835=function(_0x1f7a5a,_0x4795ad){_0x1f7a5a=_0x1f7a5a-0x0;var _0x4b7801=_0x8357[_0x1f7a5a];return _0x4b7801;};'use strict';var Sequelize=require(_0x7835('0x0'));module[_0x7835('0x1')]={'name':{'type':Sequelize[_0x7835('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7835('0x3')](_0x7835('0x4'),_0x7835('0x5'),_0x7835('0x6')),'allowNull':![],'defaultValue':_0x7835('0x4')},'description':{'type':Sequelize[_0x7835('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e9c55bf..5cbc41c 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 _0x6347=['bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Dispositions','then','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x6347,0x1c9));var _0x7634=function(_0x4bbd75,_0x71df2c){_0x4bbd75=_0x4bbd75-0x0;var _0x1358e0=_0x6347[_0x4bbd75];return _0x1358e0;};'use strict';var emlformat=require(_0x7634('0x0'));var rimraf=require(_0x7634('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7634('0x2'));var rp=require(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require(_0x7634('0x5'));var Mustache=require('mustache');var util=require(_0x7634('0x6'));var path=require('path');var sox=require(_0x7634('0x7'));var csv=require(_0x7634('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7634('0x9'));var squel=require(_0x7634('0xa'));var crypto=require(_0x7634('0xb'));var jsforce=require(_0x7634('0xc'));var deskjs=require(_0x7634('0xd'));var toCsv=require(_0x7634('0x8'));var querystring=require('querystring');var Papa=require(_0x7634('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7634('0xf'));var hardwareService=require(_0x7634('0x10'));var logger=require(_0x7634('0x11'))(_0x7634('0x12'));var utils=require(_0x7634('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7634('0x14'))['db'];function respondWithStatusCode(_0x1bde2c,_0x15c1bd){_0x15c1bd=_0x15c1bd||0xcc;return function(_0x22213f){if(_0x22213f){return _0x1bde2c[_0x7634('0x15')](_0x15c1bd);}return _0x1bde2c[_0x7634('0x16')](_0x15c1bd)[_0x7634('0x17')]();};}function respondWithResult(_0x2b505a,_0x54d77b){_0x54d77b=_0x54d77b||0xc8;return function(_0x3b0fd4){if(_0x3b0fd4){return _0x2b505a[_0x7634('0x16')](_0x54d77b)[_0x7634('0x18')](_0x3b0fd4);}};}function respondWithFilteredResult(_0x20dc07,_0x47b1b7){return function(_0x1f58f7){if(_0x1f58f7){var _0x4be9c7=typeof _0x47b1b7[_0x7634('0x19')]===_0x7634('0x1a')&&typeof _0x47b1b7[_0x7634('0x1b')]===_0x7634('0x1a');var _0x5cfed7=_0x1f58f7[_0x7634('0x1c')];var _0x4832e3=_0x4be9c7?0x0:_0x47b1b7[_0x7634('0x19')];var _0x3f8074=_0x4be9c7?_0x1f58f7['count']:_0x47b1b7[_0x7634('0x19')]+_0x47b1b7[_0x7634('0x1b')];var _0x5a95e2;if(_0x3f8074>=_0x5cfed7){_0x3f8074=_0x5cfed7;_0x5a95e2=0xc8;}else{_0x5a95e2=0xce;}_0x20dc07[_0x7634('0x16')](_0x5a95e2);return _0x20dc07['set'](_0x7634('0x1d'),_0x4832e3+'-'+_0x3f8074+'/'+_0x5cfed7)['json'](_0x1f58f7);}return null;};}function patchUpdates(_0x475635){return function(_0xbe6288){try{jsonpatch[_0x7634('0x1e')](_0xbe6288,_0x475635,!![]);}catch(_0x42b977){return BPromise['reject'](_0x42b977);}return _0xbe6288[_0x7634('0x1f')]();};}function saveUpdates(_0x347a56,_0x2a2538){return function(_0x462461){if(_0x462461){return _0x462461[_0x7634('0x20')](_0x347a56)['then'](function(_0xc68369){return _0xc68369;});}return null;};}function removeEntity(_0x5d3418,_0x40e3a8){return function(_0x2ab4fc){if(_0x2ab4fc){return _0x2ab4fc['destroy']()['then'](function(){var _0x59f821=_0x2ab4fc[_0x7634('0x21')]({'plain':!![]});var _0x512776=_0x7634('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x512776,'resourceId':_0x59f821['id']}})[_0x7634('0x23')](function(){return _0x2ab4fc;});})['then'](function(){_0x5d3418[_0x7634('0x16')](0xcc)[_0x7634('0x17')]();});}};}function handleEntityNotFound(_0x4cd8e5,_0x81ba23){return function(_0x40d5fc){if(!_0x40d5fc){_0x4cd8e5[_0x7634('0x15')](0x194);}return _0x40d5fc;};}function handleError(_0x352584,_0x3afa24){_0x3afa24=_0x3afa24||0x1f4;return function(_0x4df6d6){logger[_0x7634('0x24')](_0x4df6d6[_0x7634('0x25')]);if(_0x4df6d6['name']){delete _0x4df6d6[_0x7634('0x26')];}_0x352584[_0x7634('0x16')](_0x3afa24)[_0x7634('0x27')](_0x4df6d6);};}exports[_0x7634('0x28')]=function(_0x597455,_0x2016b0){var _0x2800e6={},_0x1fc451={},_0x48bf00={'count':0x0,'rows':[]};var _0x5df146=_[_0x7634('0x29')](db[_0x7634('0x2a')][_0x7634('0x2b')],function(_0x16123d){return{'name':_0x16123d[_0x7634('0x2c')],'type':_0x16123d[_0x7634('0x2d')]['key']};});_0x1fc451[_0x7634('0x2e')]=_[_0x7634('0x29')](_0x5df146,'name');_0x1fc451[_0x7634('0x2f')]=_['keys'](_0x597455[_0x7634('0x2f')]);_0x1fc451['filters']=_['intersection'](_0x1fc451[_0x7634('0x2e')],_0x1fc451[_0x7634('0x2f')]);_0x2800e6[_0x7634('0x30')]=_['intersection'](_0x1fc451['model'],qs[_0x7634('0x31')](_0x597455[_0x7634('0x2f')][_0x7634('0x31')]));_0x2800e6[_0x7634('0x30')]=_0x2800e6['attributes'][_0x7634('0x32')]?_0x2800e6[_0x7634('0x30')]:_0x1fc451[_0x7634('0x2e')];if(!_0x597455[_0x7634('0x2f')][_0x7634('0x33')](_0x7634('0x34'))){_0x2800e6[_0x7634('0x1b')]=qs[_0x7634('0x1b')](_0x597455[_0x7634('0x2f')][_0x7634('0x1b')]);_0x2800e6[_0x7634('0x19')]=qs['offset'](_0x597455[_0x7634('0x2f')][_0x7634('0x19')]);}_0x2800e6['order']=qs[_0x7634('0x35')](_0x597455['query'][_0x7634('0x35')]);_0x2800e6[_0x7634('0x36')]=qs[_0x7634('0x37')](_[_0x7634('0x38')](_0x597455[_0x7634('0x2f')],_0x1fc451['filters']),_0x5df146);if(_0x597455['query'][_0x7634('0x39')]){_0x2800e6[_0x7634('0x36')]=_[_0x7634('0x3a')](_0x2800e6[_0x7634('0x36')],{'$or':_[_0x7634('0x29')](_0x5df146,function(_0x38acfc){if(_0x38acfc[_0x7634('0x2d')]!==_0x7634('0x3b')){var _0x5ad900={};_0x5ad900[_0x38acfc[_0x7634('0x26')]]={'$like':'%'+_0x597455[_0x7634('0x2f')][_0x7634('0x39')]+'%'};return _0x5ad900;}})});}_0x2800e6=_['merge']({},_0x2800e6,_0x597455[_0x7634('0x3c')]);var _0x16e152={'where':_0x2800e6[_0x7634('0x36')]};return db[_0x7634('0x2a')][_0x7634('0x1c')](_0x16e152)[_0x7634('0x23')](function(_0x25152f){_0x48bf00[_0x7634('0x1c')]=_0x25152f;if(_0x597455['query'][_0x7634('0x3d')]){_0x2800e6['include']=[{'all':!![]}];}return db[_0x7634('0x2a')][_0x7634('0x3e')](_0x2800e6);})['then'](function(_0x5a7b65){_0x48bf00[_0x7634('0x3f')]=_0x5a7b65;return _0x48bf00;})['then'](respondWithFilteredResult(_0x2016b0,_0x2800e6))[_0x7634('0x40')](handleError(_0x2016b0,null));};exports[_0x7634('0x41')]=function(_0x3b822d,_0x56063c){var _0x4cf397={'raw':!![],'where':{'id':_0x3b822d[_0x7634('0x42')]['id']}},_0x391162={};_0x391162[_0x7634('0x2e')]=_[_0x7634('0x43')](db[_0x7634('0x2a')]['rawAttributes']);_0x391162[_0x7634('0x2f')]=_[_0x7634('0x43')](_0x3b822d['query']);_0x391162['filters']=_[_0x7634('0x44')](_0x391162[_0x7634('0x2e')],_0x391162[_0x7634('0x2f')]);_0x4cf397[_0x7634('0x30')]=_[_0x7634('0x44')](_0x391162[_0x7634('0x2e')],qs[_0x7634('0x31')](_0x3b822d[_0x7634('0x2f')][_0x7634('0x31')]));_0x4cf397[_0x7634('0x30')]=_0x4cf397['attributes'][_0x7634('0x32')]?_0x4cf397[_0x7634('0x30')]:_0x391162['model'];if(_0x3b822d[_0x7634('0x2f')][_0x7634('0x3d')]){_0x4cf397['include']=[{'all':!![]}];}_0x4cf397=_[_0x7634('0x3a')]({},_0x4cf397,_0x3b822d[_0x7634('0x3c')]);return db['Disposition']['find'](_0x4cf397)['then'](handleEntityNotFound(_0x56063c,null))[_0x7634('0x23')](respondWithResult(_0x56063c,null))[_0x7634('0x40')](handleError(_0x56063c,null));};exports[_0x7634('0x45')]=function(_0x122ccf,_0x438082){return db['Disposition'][_0x7634('0x45')](_0x122ccf[_0x7634('0x46')],{})[_0x7634('0x23')](function(_0x1126d3){var _0x58551f=_0x122ccf[_0x7634('0x47')][_0x7634('0x21')]({'plain':!![]});if(!_0x58551f)throw new Error(_0x7634('0x48'));if(_0x58551f['role']===_0x7634('0x47')){var _0x5c56c8=_0x1126d3[_0x7634('0x21')]({'plain':!![]});var _0x1288af='Dispositions';return db['UserProfileSection'][_0x7634('0x49')]({'where':{'name':_0x1288af,'userProfileId':_0x58551f[_0x7634('0x4a')]},'raw':!![]})[_0x7634('0x23')](function(_0x164f38){if(_0x164f38&&_0x164f38['autoAssociation']===0x0){return db['UserProfileResource'][_0x7634('0x45')]({'name':_0x5c56c8[_0x7634('0x26')],'resourceId':_0x5c56c8['id'],'type':_0x164f38[_0x7634('0x26')],'sectionId':_0x164f38['id']},{})['then'](function(){return _0x1126d3;});}else{return _0x1126d3;}})['catch'](function(_0x121e9b){logger[_0x7634('0x24')](_0x7634('0x4b'),_0x121e9b);throw _0x121e9b;});}return _0x1126d3;})['then'](respondWithResult(_0x438082,0xc9))[_0x7634('0x40')](handleError(_0x438082,null));};exports['update']=function(_0xb00f20,_0x34dfed){if(_0xb00f20[_0x7634('0x46')]['id']){delete _0xb00f20['body']['id'];}return db[_0x7634('0x2a')][_0x7634('0x49')]({'where':{'id':_0xb00f20['params']['id']}})['then'](handleEntityNotFound(_0x34dfed,null))[_0x7634('0x23')](saveUpdates(_0xb00f20[_0x7634('0x46')],null))[_0x7634('0x23')](respondWithResult(_0x34dfed,null))[_0x7634('0x40')](handleError(_0x34dfed,null));};exports[_0x7634('0x4c')]=function(_0x4f7d08,_0x51121a){return db[_0x7634('0x2a')][_0x7634('0x49')]({'where':{'id':_0x4f7d08[_0x7634('0x42')]['id']}})[_0x7634('0x23')](handleEntityNotFound(_0x51121a,null))[_0x7634('0x23')](removeEntity(_0x51121a,null))[_0x7634('0x40')](handleError(_0x51121a,null));}; \ No newline at end of file +var _0x62c9=['index','Disposition','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','find','create','body','user','get','role','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x62c9,0x11c));var _0x962c=function(_0x5ea31a,_0x38d69a){_0x5ea31a=_0x5ea31a-0x0;var _0x105828=_0x62c9[_0x5ea31a];return _0x105828;};'use strict';var emlformat=require(_0x962c('0x0'));var rimraf=require(_0x962c('0x1'));var zipdir=require(_0x962c('0x2'));var jsonpatch=require(_0x962c('0x3'));var rp=require(_0x962c('0x4'));var moment=require(_0x962c('0x5'));var BPromise=require(_0x962c('0x6'));var Mustache=require(_0x962c('0x7'));var util=require(_0x962c('0x8'));var path=require(_0x962c('0x9'));var sox=require(_0x962c('0xa'));var csv=require('to-csv');var ejs=require(_0x962c('0xb'));var fs=require('fs');var fs_extra=require(_0x962c('0xc'));var _=require(_0x962c('0xd'));var squel=require(_0x962c('0xe'));var crypto=require(_0x962c('0xf'));var jsforce=require(_0x962c('0x10'));var deskjs=require(_0x962c('0x11'));var toCsv=require(_0x962c('0x12'));var querystring=require('querystring');var Papa=require(_0x962c('0x13'));var Redis=require(_0x962c('0x14'));var authService=require(_0x962c('0x15'));var qs=require(_0x962c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x962c('0x17'));var logger=require(_0x962c('0x18'))(_0x962c('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x962c('0x1a'));var db=require(_0x962c('0x1b'))['db'];function respondWithStatusCode(_0x220576,_0x2da217){_0x2da217=_0x2da217||0xcc;return function(_0x97bab4){if(_0x97bab4){return _0x220576[_0x962c('0x1c')](_0x2da217);}return _0x220576['status'](_0x2da217)[_0x962c('0x1d')]();};}function respondWithResult(_0x146aee,_0x22de93){_0x22de93=_0x22de93||0xc8;return function(_0x273f30){if(_0x273f30){return _0x146aee['status'](_0x22de93)[_0x962c('0x1e')](_0x273f30);}};}function respondWithFilteredResult(_0x4bfc89,_0x5667ff){return function(_0x21cd65){if(_0x21cd65){var _0x2db53f=typeof _0x5667ff['offset']===_0x962c('0x1f')&&typeof _0x5667ff['limit']==='undefined';var _0x15374d=_0x21cd65[_0x962c('0x20')];var _0x67fa13=_0x2db53f?0x0:_0x5667ff[_0x962c('0x21')];var _0x4ef61=_0x2db53f?_0x21cd65[_0x962c('0x20')]:_0x5667ff['offset']+_0x5667ff[_0x962c('0x22')];var _0x2c4eeb;if(_0x4ef61>=_0x15374d){_0x4ef61=_0x15374d;_0x2c4eeb=0xc8;}else{_0x2c4eeb=0xce;}_0x4bfc89[_0x962c('0x23')](_0x2c4eeb);return _0x4bfc89[_0x962c('0x24')](_0x962c('0x25'),_0x67fa13+'-'+_0x4ef61+'/'+_0x15374d)['json'](_0x21cd65);}return null;};}function patchUpdates(_0xdc5ccf){return function(_0x15b3f9){try{jsonpatch['apply'](_0x15b3f9,_0xdc5ccf,!![]);}catch(_0x15388f){return BPromise[_0x962c('0x26')](_0x15388f);}return _0x15b3f9['save']();};}function saveUpdates(_0x4c0e79,_0x296bc8){return function(_0x37b6b1){if(_0x37b6b1){return _0x37b6b1[_0x962c('0x27')](_0x4c0e79)[_0x962c('0x28')](function(_0x2d932f){return _0x2d932f;});}return null;};}function removeEntity(_0xb66e1b,_0xe1ff97){return function(_0x41e23a){if(_0x41e23a){return _0x41e23a[_0x962c('0x29')]()[_0x962c('0x28')](function(){var _0x3df955=_0x41e23a['get']({'plain':!![]});var _0x37be5d=_0x962c('0x2a');return db[_0x962c('0x2b')][_0x962c('0x29')]({'where':{'type':_0x37be5d,'resourceId':_0x3df955['id']}})['then'](function(){return _0x41e23a;});})[_0x962c('0x28')](function(){_0xb66e1b[_0x962c('0x23')](0xcc)[_0x962c('0x1d')]();});}};}function handleEntityNotFound(_0x16904c,_0xd64bd2){return function(_0x2b18a9){if(!_0x2b18a9){_0x16904c[_0x962c('0x1c')](0x194);}return _0x2b18a9;};}function handleError(_0x484008,_0x205d05){_0x205d05=_0x205d05||0x1f4;return function(_0x4e308f){logger[_0x962c('0x2c')](_0x4e308f[_0x962c('0x2d')]);if(_0x4e308f[_0x962c('0x2e')]){delete _0x4e308f['name'];}_0x484008[_0x962c('0x23')](_0x205d05)[_0x962c('0x2f')](_0x4e308f);};}exports[_0x962c('0x30')]=function(_0x2fa1b5,_0x5db8c0){var _0x104cf2={},_0x56f31b={},_0x4dfd0a={'count':0x0,'rows':[]};var _0x88e8ec=_['map'](db[_0x962c('0x31')][_0x962c('0x32')],function(_0x431a9c){return{'name':_0x431a9c['fieldName'],'type':_0x431a9c[_0x962c('0x33')][_0x962c('0x34')]};});_0x56f31b['model']=_[_0x962c('0x35')](_0x88e8ec,_0x962c('0x2e'));_0x56f31b[_0x962c('0x36')]=_[_0x962c('0x37')](_0x2fa1b5[_0x962c('0x36')]);_0x56f31b[_0x962c('0x38')]=_[_0x962c('0x39')](_0x56f31b[_0x962c('0x3a')],_0x56f31b[_0x962c('0x36')]);_0x104cf2[_0x962c('0x3b')]=_['intersection'](_0x56f31b['model'],qs['fields'](_0x2fa1b5[_0x962c('0x36')][_0x962c('0x3c')]));_0x104cf2['attributes']=_0x104cf2[_0x962c('0x3b')][_0x962c('0x3d')]?_0x104cf2[_0x962c('0x3b')]:_0x56f31b[_0x962c('0x3a')];if(!_0x2fa1b5['query']['hasOwnProperty'](_0x962c('0x3e'))){_0x104cf2[_0x962c('0x22')]=qs['limit'](_0x2fa1b5[_0x962c('0x36')][_0x962c('0x22')]);_0x104cf2[_0x962c('0x21')]=qs['offset'](_0x2fa1b5[_0x962c('0x36')]['offset']);}_0x104cf2[_0x962c('0x3f')]=qs[_0x962c('0x40')](_0x2fa1b5[_0x962c('0x36')][_0x962c('0x40')]);_0x104cf2[_0x962c('0x41')]=qs[_0x962c('0x38')](_[_0x962c('0x42')](_0x2fa1b5['query'],_0x56f31b['filters']),_0x88e8ec);if(_0x2fa1b5[_0x962c('0x36')][_0x962c('0x43')]){_0x104cf2['where']=_[_0x962c('0x44')](_0x104cf2[_0x962c('0x41')],{'$or':_[_0x962c('0x35')](_0x88e8ec,function(_0x2218f8){if(_0x2218f8[_0x962c('0x33')]!==_0x962c('0x45')){var _0x406e89={};_0x406e89[_0x2218f8[_0x962c('0x2e')]]={'$like':'%'+_0x2fa1b5[_0x962c('0x36')]['filter']+'%'};return _0x406e89;}})});}_0x104cf2=_[_0x962c('0x44')]({},_0x104cf2,_0x2fa1b5[_0x962c('0x46')]);var _0x3b601a={'where':_0x104cf2['where']};return db[_0x962c('0x31')][_0x962c('0x20')](_0x3b601a)[_0x962c('0x28')](function(_0x2a865b){_0x4dfd0a[_0x962c('0x20')]=_0x2a865b;if(_0x2fa1b5[_0x962c('0x36')]['includeAll']){_0x104cf2['include']=[{'all':!![]}];}return db[_0x962c('0x31')]['findAll'](_0x104cf2);})[_0x962c('0x28')](function(_0x51811c){_0x4dfd0a[_0x962c('0x47')]=_0x51811c;return _0x4dfd0a;})['then'](respondWithFilteredResult(_0x5db8c0,_0x104cf2))[_0x962c('0x48')](handleError(_0x5db8c0,null));};exports[_0x962c('0x49')]=function(_0x3c10ef,_0x32ca42){var _0x4b8f6e={'raw':!![],'where':{'id':_0x3c10ef['params']['id']}},_0x2eeb0b={};_0x2eeb0b[_0x962c('0x3a')]=_[_0x962c('0x37')](db[_0x962c('0x31')][_0x962c('0x32')]);_0x2eeb0b[_0x962c('0x36')]=_['keys'](_0x3c10ef['query']);_0x2eeb0b['filters']=_[_0x962c('0x39')](_0x2eeb0b[_0x962c('0x3a')],_0x2eeb0b[_0x962c('0x36')]);_0x4b8f6e[_0x962c('0x3b')]=_[_0x962c('0x39')](_0x2eeb0b[_0x962c('0x3a')],qs[_0x962c('0x3c')](_0x3c10ef[_0x962c('0x36')]['fields']));_0x4b8f6e[_0x962c('0x3b')]=_0x4b8f6e[_0x962c('0x3b')][_0x962c('0x3d')]?_0x4b8f6e[_0x962c('0x3b')]:_0x2eeb0b['model'];if(_0x3c10ef[_0x962c('0x36')]['includeAll']){_0x4b8f6e['include']=[{'all':!![]}];}_0x4b8f6e=_[_0x962c('0x44')]({},_0x4b8f6e,_0x3c10ef[_0x962c('0x46')]);return db[_0x962c('0x31')][_0x962c('0x4a')](_0x4b8f6e)[_0x962c('0x28')](handleEntityNotFound(_0x32ca42,null))['then'](respondWithResult(_0x32ca42,null))[_0x962c('0x48')](handleError(_0x32ca42,null));};exports[_0x962c('0x4b')]=function(_0x383dce,_0x19240b){return db[_0x962c('0x31')]['create'](_0x383dce[_0x962c('0x4c')],{})[_0x962c('0x28')](function(_0x46d6da){var _0x5bbc91=_0x383dce[_0x962c('0x4d')][_0x962c('0x4e')]({'plain':!![]});if(!_0x5bbc91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bbc91[_0x962c('0x4f')]===_0x962c('0x4d')){var _0x53b384=_0x46d6da[_0x962c('0x4e')]({'plain':!![]});var _0x23257a=_0x962c('0x2a');return db[_0x962c('0x50')][_0x962c('0x4a')]({'where':{'name':_0x23257a,'userProfileId':_0x5bbc91['userProfileId']},'raw':!![]})[_0x962c('0x28')](function(_0x551905){if(_0x551905&&_0x551905[_0x962c('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x53b384[_0x962c('0x2e')],'resourceId':_0x53b384['id'],'type':_0x551905['name'],'sectionId':_0x551905['id']},{})[_0x962c('0x28')](function(){return _0x46d6da;});}else{return _0x46d6da;}})[_0x962c('0x48')](function(_0x44eb52){logger[_0x962c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44eb52);throw _0x44eb52;});}return _0x46d6da;})[_0x962c('0x28')](respondWithResult(_0x19240b,0xc9))[_0x962c('0x48')](handleError(_0x19240b,null));};exports[_0x962c('0x27')]=function(_0x4c0894,_0x179c0d){if(_0x4c0894['body']['id']){delete _0x4c0894[_0x962c('0x4c')]['id'];}return db[_0x962c('0x31')][_0x962c('0x4a')]({'where':{'id':_0x4c0894['params']['id']}})[_0x962c('0x28')](handleEntityNotFound(_0x179c0d,null))[_0x962c('0x28')](saveUpdates(_0x4c0894[_0x962c('0x4c')],null))['then'](respondWithResult(_0x179c0d,null))['catch'](handleError(_0x179c0d,null));};exports[_0x962c('0x29')]=function(_0x1f86fd,_0x3d98b6){return db[_0x962c('0x31')][_0x962c('0x4a')]({'where':{'id':_0x1f86fd[_0x962c('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d98b6,null))[_0x962c('0x28')](removeEntity(_0x3d98b6,null))[_0x962c('0x48')](handleError(_0x3d98b6,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ae74e3c..9e3581b 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 _0xf9aa=['name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x227743,_0x3ae9b9){var _0x55df7a=function(_0xe1db87){while(--_0xe1db87){_0x227743['push'](_0x227743['shift']());}};_0x55df7a(++_0x3ae9b9);}(_0xf9aa,0x171));var _0xaf9a=function(_0x9a7d5b,_0x50327f){_0x9a7d5b=_0x9a7d5b-0x0;var _0xe2a5b3=_0xf9aa[_0x9a7d5b];return _0xe2a5b3;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var logger=require(_0xaf9a('0x2'))(_0xaf9a('0x3'));var moment=require(_0xaf9a('0x4'));var BPromise=require(_0xaf9a('0x5'));var rp=require(_0xaf9a('0x6'));var fs=require('fs');var path=require(_0xaf9a('0x7'));var rimraf=require(_0xaf9a('0x8'));var config=require(_0xaf9a('0x9'));var attributes=require(_0xaf9a('0xa'));module[_0xaf9a('0xb')]=function(_0x174ec2,_0x13ab01){return _0x174ec2['define'](_0xaf9a('0xc'),attributes,{'tableName':_0xaf9a('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xaf9a('0xe'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x10')]},{'unique':!![],'name':_0xaf9a('0x11'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x12')]},{'unique':!![],'name':_0xaf9a('0x13'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x14')]},{'unique':!![],'name':_0xaf9a('0x15'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x16')]},{'unique':!![],'name':_0xaf9a('0x17'),'fields':['name',_0xaf9a('0x18')]},{'unique':!![],'name':_0xaf9a('0x19'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xaf9a('0x1a'),'fields':[_0xaf9a('0xf'),_0xaf9a('0x1b')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ad=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_whatsapp','WhatsappAccountId','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe7ad,0x186));var _0xde7a=function(_0x2fd087,_0x21f04d){_0x2fd087=_0x2fd087-0x0;var _0x480e0b=_0xe7ad[_0x2fd087];return _0x480e0b;};'use strict';var _=require('lodash');var util=require(_0xde7a('0x0'));var logger=require(_0xde7a('0x1'))(_0xde7a('0x2'));var moment=require(_0xde7a('0x3'));var BPromise=require(_0xde7a('0x4'));var rp=require(_0xde7a('0x5'));var fs=require('fs');var path=require(_0xde7a('0x6'));var rimraf=require(_0xde7a('0x7'));var config=require('../../config/environment');var attributes=require(_0xde7a('0x8'));module[_0xde7a('0x9')]=function(_0x19df6e,_0x499fb0){return _0x19df6e[_0xde7a('0xa')](_0xde7a('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xde7a('0xc'),'fields':[_0xde7a('0xd'),_0xde7a('0xe')]},{'unique':!![],'name':_0xde7a('0xf'),'fields':[_0xde7a('0xd'),_0xde7a('0x10')]},{'unique':!![],'name':_0xde7a('0x11'),'fields':[_0xde7a('0xd'),_0xde7a('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xde7a('0xd'),_0xde7a('0x13')]},{'unique':!![],'name':_0xde7a('0x14'),'fields':[_0xde7a('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xde7a('0x15'),'fields':[_0xde7a('0xd'),_0xde7a('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e5aa5f5..779317e 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4bcf58,_0x1fab13){var _0x417292=function(_0x3c34f8){while(--_0x3c34f8){_0x4bcf58['push'](_0x4bcf58['shift']());}};_0x417292(++_0x1fab13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a5de8,_0x2cd8be){var _0x2e79ad=function(_0x227e11){while(--_0x227e11){_0x5a5de8['push'](_0x5a5de8['shift']());}};_0x2e79ad(++_0x2cd8be);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index de65701..8e811cf 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 _0x7e7a=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x1e4134,_0x333db3){var _0x480df4=function(_0x7de484){while(--_0x7de484){_0x1e4134['push'](_0x1e4134['shift']());}};_0x480df4(++_0x333db3);}(_0x7e7a,0xf4));var _0xa7e7=function(_0x11170a,_0x18ecb8){_0x11170a=_0x11170a-0x0;var _0x5827e1=_0x7e7a[_0x11170a];return _0x5827e1;};'use strict';var multer=require(_0xa7e7('0x0'));var util=require(_0xa7e7('0x1'));var path=require('path');var timeout=require(_0xa7e7('0x2'));var express=require(_0xa7e7('0x3'));var router=express[_0xa7e7('0x4')]();var fs_extra=require(_0xa7e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7e7('0x6'));var config=require(_0xa7e7('0x7'));var controller=require(_0xa7e7('0x8'));router[_0xa7e7('0x9')]('/',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xb')]);router[_0xa7e7('0x9')]('/:id',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xc')]);router[_0xa7e7('0xd')]('/',auth[_0xa7e7('0xa')](),controller[_0xa7e7('0xe')]);router['put'](_0xa7e7('0xf'),auth['isAuthenticated'](),controller[_0xa7e7('0x10')]);router[_0xa7e7('0x11')](_0xa7e7('0xf'),auth['isAuthenticated'](),controller[_0xa7e7('0x12')]);module[_0xa7e7('0x13')]=router; \ No newline at end of file +var _0x5c02=['../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','create','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0x5c02,0xcd));var _0x25c0=function(_0x5d52ff,_0x5438a1){_0x5d52ff=_0x5d52ff-0x0;var _0x39e8c2=_0x5c02[_0x5d52ff];return _0x39e8c2;};'use strict';var multer=require(_0x25c0('0x0'));var util=require('util');var path=require(_0x25c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c0('0x2'));var router=express[_0x25c0('0x3')]();var fs_extra=require(_0x25c0('0x4'));var auth=require(_0x25c0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x25c0('0x6'));var controller=require(_0x25c0('0x7'));router['get']('/',auth[_0x25c0('0x8')](),controller[_0x25c0('0x9')]);router['get'](_0x25c0('0xa'),auth[_0x25c0('0x8')](),controller['show']);router['post']('/',auth[_0x25c0('0x8')](),controller[_0x25c0('0xb')]);router['put'](_0x25c0('0xa'),auth[_0x25c0('0x8')](),controller['update']);router[_0x25c0('0xc')](_0x25c0('0xa'),auth[_0x25c0('0x8')](),controller[_0x25c0('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8ce64fe..65b6c9f 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 _0xdf55=['INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xdf55,0x83));var _0x5df5=function(_0x4c9cb5,_0xcf85d4){_0x4c9cb5=_0x4c9cb5-0x0;var _0x20310b=_0xdf55[_0x4c9cb5];return _0x20310b;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5df5('0x2')]},'ecm':{'type':Sequelize[_0x5df5('0x3')]('yes','no'),'defaultValue':_0x5df5('0x4')},'headerinfo':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':_0x5df5('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5df5('0x6')},'minrate':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x7'),_0x5df5('0x8'),_0x5df5('0x9'),_0x5df5('0xa'),_0x5df5('0xb'),_0x5df5('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x7'),_0x5df5('0x8'),'7200','9600',_0x5df5('0xb'),'14400'),'defaultValue':_0x5df5('0xc')},'modem':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5df5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5df5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0xe'),_0x5df5('0xf'),_0x5df5('0x10'),_0x5df5('0x11')),'defaultValue':_0x5df5('0xe')},'key':{'type':Sequelize[_0x5df5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5df5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5df5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5df5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5df5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x5df5('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5df5('0x15'),'set':function(_0x45813f){if(!_0x45813f)this[_0x5df5('0x16')](_0x5df5('0x17'),null);this[_0x5df5('0x16')]('mandatoryDisposition',_0x45813f);}}}; \ No newline at end of file +var _0x9a5a=['IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','INTEGER','SIP'];(function(_0x3ae656,_0x33b396){var _0x136584=function(_0x4d54bc){while(--_0x4d54bc){_0x3ae656['push'](_0x3ae656['shift']());}};_0x136584(++_0x33b396);}(_0x9a5a,0x194));var _0xa9a5=function(_0x3edff3,_0x1744dc){_0x3edff3=_0x3edff3-0x0;var _0x411532=_0x9a5a[_0x3edff3];return _0x411532;};'use strict';var Sequelize=require(_0xa9a5('0x0'));module[_0xa9a5('0x1')]={'name':{'type':Sequelize[_0xa9a5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9a5('0x2')]},'ecm':{'type':Sequelize[_0xa9a5('0x3')]('yes','no'),'defaultValue':_0xa9a5('0x4')},'headerinfo':{'type':Sequelize[_0xa9a5('0x2')],'defaultValue':_0xa9a5('0x5')},'localstationid':{'type':Sequelize[_0xa9a5('0x2')],'unique':_0xa9a5('0x6')},'minrate':{'type':Sequelize[_0xa9a5('0x3')]('2400',_0xa9a5('0x7'),_0xa9a5('0x8'),_0xa9a5('0x9'),_0xa9a5('0xa'),_0xa9a5('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM']('2400',_0xa9a5('0x7'),_0xa9a5('0x8'),_0xa9a5('0x9'),_0xa9a5('0xa'),_0xa9a5('0xb')),'defaultValue':_0xa9a5('0xb')},'modem':{'type':Sequelize[_0xa9a5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa9a5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa9a5('0x3')](_0xa9a5('0xd'),_0xa9a5('0xe'),_0xa9a5('0xf'),'KHOMP'),'defaultValue':_0xa9a5('0xd')},'key':{'type':Sequelize[_0xa9a5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa9a5('0x10')],'defaultValue':function(){return _0xa9a5('0x11');}},'notificationSound':{'type':Sequelize[_0xa9a5('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa9a5('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9a5('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9a5('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9a5('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xa9a5('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xa9a5('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c505b){if(!_0x3c505b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa9a5('0x14')](_0xa9a5('0x15'),_0x3c505b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 71a3d03..eed5197 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 _0xe05f=['faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','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','describe','FaxAccountId','findOne','keys','Disposition','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway'];(function(_0x51e79e,_0x1c30bc){var _0x34692f=function(_0x5ed597){while(--_0x5ed597){_0x51e79e['push'](_0x51e79e['shift']());}};_0x34692f(++_0x1c30bc);}(_0xe05f,0x1b3));var _0xfe05=function(_0x457969,_0x4bb527){_0x457969=_0x457969-0x0;var _0x3a5e62=_0xe05f[_0x457969];return _0x3a5e62;};'use strict';var emlformat=require(_0xfe05('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe05('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe05('0x2'));var util=require(_0xfe05('0x3'));var path=require('path');var sox=require(_0xfe05('0x4'));var csv=require(_0xfe05('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe05('0x6'));var _=require(_0xfe05('0x7'));var squel=require(_0xfe05('0x8'));var crypto=require(_0xfe05('0x9'));var jsforce=require(_0xfe05('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe05('0x5'));var querystring=require(_0xfe05('0xb'));var Papa=require(_0xfe05('0xc'));var Redis=require(_0xfe05('0xd'));var authService=require(_0xfe05('0xe'));var qs=require(_0xfe05('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe05('0x10'));var logger=require(_0xfe05('0x11'))('api');var utils=require(_0xfe05('0x12'));var config=require(_0xfe05('0x13'));var licenseUtil=require(_0xfe05('0x14'));var db=require(_0xfe05('0x15'))['db'];config['redis']=_[_0xfe05('0x16')](config[_0xfe05('0x17')],{'host':_0xfe05('0x18'),'port':0x18eb});var socket=require(_0xfe05('0x19'))(new Redis(config[_0xfe05('0x17')]));require(_0xfe05('0x1a'))[_0xfe05('0x1b')](socket);var jayson=require(_0xfe05('0x1c'));var client=jayson[_0xfe05('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xfe05('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5030c9,_0x53d1ca,_0x19da1e,_0xb1d933){return new BPromise(function(_0x521593,_0x4fa4c7){var _0x22f5fa=_0xb1d933||client;return _0x22f5fa[_0xfe05('0x1e')](_0x5030c9,_0x19da1e)['then'](function(_0x1c35a9){logger[_0xfe05('0x1f')](_0xfe05('0x20'),_0x53d1ca,'request\x20sent');logger[_0xfe05('0x21')](_0xfe05('0x22'),_0x53d1ca,_0xfe05('0x23'),JSON[_0xfe05('0x24')](_0x1c35a9));if(_0x1c35a9[_0xfe05('0x25')]){if(_0x1c35a9[_0xfe05('0x25')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53d1ca,_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);return _0x4fa4c7(_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);}logger['error'](_0xfe05('0x20'),_0x53d1ca,_0x1c35a9[_0xfe05('0x25')]['message']);return _0x521593(_0x1c35a9[_0xfe05('0x25')][_0xfe05('0x26')]);}else{logger[_0xfe05('0x1f')](_0xfe05('0x20'),_0x53d1ca,_0xfe05('0x23'));_0x521593(_0x1c35a9[_0xfe05('0x27')]['message']);}})['catch'](function(_0x5d82af){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53d1ca,_0x5d82af);_0x4fa4c7(_0x5d82af);});});}function respondWithStatusCode(_0x5ee83f,_0x3571f2){_0x3571f2=_0x3571f2||0xcc;return function(_0x785544){if(_0x785544){return _0x5ee83f[_0xfe05('0x28')](_0x3571f2);}return _0x5ee83f['status'](_0x3571f2)[_0xfe05('0x29')]();};}function respondWithResult(_0x15616a,_0x4c307f){_0x4c307f=_0x4c307f||0xc8;return function(_0x4f747e){if(_0x4f747e){return _0x15616a[_0xfe05('0x2a')](_0x4c307f)[_0xfe05('0x2b')](_0x4f747e);}};}function respondWithFilteredResult(_0x2fa49e,_0x214829){return function(_0xe20837){if(_0xe20837){var _0x19d8c1=typeof _0x214829[_0xfe05('0x2c')]===_0xfe05('0x2d')&&typeof _0x214829[_0xfe05('0x2e')]==='undefined';var _0x484679=_0xe20837[_0xfe05('0x2f')];var _0x1b240d=_0x19d8c1?0x0:_0x214829[_0xfe05('0x2c')];var _0x4653ba=_0x19d8c1?_0xe20837[_0xfe05('0x2f')]:_0x214829[_0xfe05('0x2c')]+_0x214829[_0xfe05('0x2e')];var _0x47b81c;if(_0x4653ba>=_0x484679){_0x4653ba=_0x484679;_0x47b81c=0xc8;}else{_0x47b81c=0xce;}_0x2fa49e['status'](_0x47b81c);return _0x2fa49e[_0xfe05('0x30')](_0xfe05('0x31'),_0x1b240d+'-'+_0x4653ba+'/'+_0x484679)['json'](_0xe20837);}return null;};}function patchUpdates(_0x3e22db){return function(_0x2e6f1c){try{jsonpatch[_0xfe05('0x32')](_0x2e6f1c,_0x3e22db,!![]);}catch(_0x2fca67){return BPromise[_0xfe05('0x33')](_0x2fca67);}return _0x2e6f1c['save']();};}function saveUpdates(_0x26c584,_0x33b2a6){return function(_0x683136){if(_0x683136){return _0x683136[_0xfe05('0x34')](_0x26c584)[_0xfe05('0x35')](function(_0x5cc8f2){return _0x5cc8f2;});}return null;};}function removeEntity(_0x1ba102,_0x1ec0a8){return function(_0x203a91){if(_0x203a91){return _0x203a91[_0xfe05('0x36')]()[_0xfe05('0x35')](function(){var _0x3e17ca=_0x203a91[_0xfe05('0x37')]({'plain':!![]});var _0x399152=_0xfe05('0x38');return db[_0xfe05('0x39')][_0xfe05('0x36')]({'where':{'type':_0x399152,'resourceId':_0x3e17ca['id']}})[_0xfe05('0x35')](function(){return _0x203a91;});})['then'](function(){_0x1ba102[_0xfe05('0x2a')](0xcc)[_0xfe05('0x29')]();});}};}function handleEntityNotFound(_0xcdae32,_0xc9a5a6){return function(_0x28179f){if(!_0x28179f){_0xcdae32[_0xfe05('0x28')](0x194);}return _0x28179f;};}function handleError(_0x2545e1,_0x2f6dce){_0x2f6dce=_0x2f6dce||0x1f4;return function(_0x56c89e){logger[_0xfe05('0x25')](_0x56c89e[_0xfe05('0x3a')]);if(_0x56c89e[_0xfe05('0x3b')]){delete _0x56c89e['name'];}_0x2545e1[_0xfe05('0x2a')](_0x2f6dce)[_0xfe05('0x3c')](_0x56c89e);};}exports['index']=function(_0x10ff98,_0x4bbb97){var _0x4f9c36={'include':[{'model':db[_0xfe05('0x3d')],'as':_0xfe05('0x3e')}]},_0x11fff7={},_0x2f00af={'count':0x0,'rows':[]};var _0x482416=_[_0xfe05('0x3f')](db[_0xfe05('0x40')][_0xfe05('0x41')],function(_0xf2e649){return{'name':_0xf2e649[_0xfe05('0x42')],'type':_0xf2e649[_0xfe05('0x43')][_0xfe05('0x44')]};});_0x11fff7[_0xfe05('0x45')]=_[_0xfe05('0x3f')](_0x482416,_0xfe05('0x3b'));_0x11fff7[_0xfe05('0x46')]=_['keys'](_0x10ff98['query']);_0x11fff7[_0xfe05('0x47')]=_['intersection'](_0x11fff7['model'],_0x11fff7[_0xfe05('0x46')]);_0x4f9c36['attributes']=_['intersection'](_0x11fff7[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x48')]));_0x4f9c36[_0xfe05('0x49')]=_0x4f9c36[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x4f9c36[_0xfe05('0x49')]:_0x11fff7[_0xfe05('0x45')];if(!_0x10ff98[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x4f9c36[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x4f9c36[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x10ff98['query'][_0xfe05('0x2c')]);}_0x4f9c36[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x10ff98[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x4f9c36[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x10ff98[_0xfe05('0x46')],_0x11fff7[_0xfe05('0x47')]),_0x482416);if(_0x10ff98[_0xfe05('0x46')][_0xfe05('0x51')]){_0x4f9c36[_0xfe05('0x4f')]=_[_0xfe05('0x52')](_0x4f9c36[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x482416,function(_0x436f11){if(_0x436f11[_0xfe05('0x43')]!==_0xfe05('0x53')){var _0x9caf6f={};_0x9caf6f[_0x436f11[_0xfe05('0x3b')]]={'$like':'%'+_0x10ff98[_0xfe05('0x46')]['filter']+'%'};return _0x9caf6f;}})});}_0x4f9c36=_[_0xfe05('0x52')]({},_0x4f9c36,_0x10ff98[_0xfe05('0x54')]);var _0x2ac949={'where':_0x4f9c36[_0xfe05('0x4f')]};return db[_0xfe05('0x40')][_0xfe05('0x2f')](_0x2ac949)[_0xfe05('0x35')](function(_0x36b6d6){_0x2f00af[_0xfe05('0x2f')]=_0x36b6d6;if(_0x10ff98['query']['includeAll']){_0x4f9c36[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0x40')][_0xfe05('0x56')](_0x4f9c36);})[_0xfe05('0x35')](function(_0x5de7ef){_0x2f00af[_0xfe05('0x57')]=_0x5de7ef;return _0x2f00af;})[_0xfe05('0x35')](respondWithFilteredResult(_0x4bbb97,_0x4f9c36))['catch'](handleError(_0x4bbb97,null));};exports[_0xfe05('0x58')]=function(_0x289e43,_0x562edc){var _0x141064={'raw':![],'where':{'id':_0x289e43[_0xfe05('0x59')]['id']},'include':[{'model':db[_0xfe05('0x3d')],'as':_0xfe05('0x3e')}]},_0x3ed885={};_0x3ed885[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x40')]['rawAttributes']);_0x3ed885[_0xfe05('0x46')]=_['keys'](_0x289e43[_0xfe05('0x46')]);_0x3ed885[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x3ed885[_0xfe05('0x45')],_0x3ed885[_0xfe05('0x46')]);_0x141064[_0xfe05('0x49')]=_['intersection'](_0x3ed885[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x289e43[_0xfe05('0x46')]['fields']));_0x141064['attributes']=_0x141064['attributes'][_0xfe05('0x4a')]?_0x141064['attributes']:_0x3ed885[_0xfe05('0x45')];if(_0x289e43[_0xfe05('0x46')]['includeAll']){_0x141064[_0xfe05('0x55')]=[{'all':!![]}];}_0x141064=_['merge']({},_0x141064,_0x289e43[_0xfe05('0x54')]);return db[_0xfe05('0x40')][_0xfe05('0x5b')](_0x141064)[_0xfe05('0x35')](handleEntityNotFound(_0x562edc,null))[_0xfe05('0x35')](respondWithResult(_0x562edc,null))[_0xfe05('0x5c')](handleError(_0x562edc,null));};exports[_0xfe05('0x5d')]=function(_0x19cdbf,_0x5be3c7){return db[_0xfe05('0x40')]['create'](_0x19cdbf[_0xfe05('0x5e')],{})['then'](function(_0x16ab8e){var _0x426b42=_0x19cdbf[_0xfe05('0x5f')][_0xfe05('0x37')]({'plain':!![]});if(!_0x426b42)throw new Error(_0xfe05('0x60'));if(_0x426b42[_0xfe05('0x61')]===_0xfe05('0x5f')){var _0x1fa398=_0x16ab8e[_0xfe05('0x37')]({'plain':!![]});var _0x5e79dd=_0xfe05('0x38');return db[_0xfe05('0x62')]['find']({'where':{'name':_0x5e79dd,'userProfileId':_0x426b42[_0xfe05('0x63')]},'raw':!![]})['then'](function(_0x3aa1d1){if(_0x3aa1d1&&_0x3aa1d1['autoAssociation']===0x0){return db[_0xfe05('0x39')][_0xfe05('0x5d')]({'name':_0x1fa398['name'],'resourceId':_0x1fa398['id'],'type':_0x3aa1d1[_0xfe05('0x3b')],'sectionId':_0x3aa1d1['id']},{})[_0xfe05('0x35')](function(){return _0x16ab8e;});}else{return _0x16ab8e;}})['catch'](function(_0x1d062c){logger['error'](_0xfe05('0x64'),_0x1d062c);throw _0x1d062c;});}return _0x16ab8e;})['then'](respondWithResult(_0x5be3c7,0xc9))[_0xfe05('0x5c')](handleError(_0x5be3c7,null));};exports[_0xfe05('0x34')]=function(_0x202e07,_0x5591e9){if(_0x202e07['body']['id']){delete _0x202e07[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')]['find']({'where':{'id':_0x202e07['params']['id']},'include':[{'model':db[_0xfe05('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xfe05('0x35')](handleEntityNotFound(_0x5591e9,null))[_0xfe05('0x35')](saveUpdates(_0x202e07[_0xfe05('0x5e')],null))['then'](respondWithResult(_0x5591e9,null))[_0xfe05('0x5c')](handleError(_0x5591e9,null));};exports[_0xfe05('0x36')]=function(_0x8b07c,_0xbb29c7){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x8b07c['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xbb29c7,null))[_0xfe05('0x35')](removeEntity(_0xbb29c7,null))[_0xfe05('0x5c')](handleError(_0xbb29c7,null));};exports[_0xfe05('0x65')]=function(_0x5154cf,_0x58f065){return db['FaxAccount'][_0xfe05('0x65')]()['then'](respondWithResult(_0x58f065,null))[_0xfe05('0x5c')](handleError(_0x58f065,null));};exports['addDisposition']=function(_0x34d2bf,_0x707321,_0x3574ed){if(_0x34d2bf[_0xfe05('0x5e')]['id']){delete _0x34d2bf[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x34d2bf['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x707321,null))[_0xfe05('0x35')](function(_0x54aede){if(_0x54aede){_0x34d2bf[_0xfe05('0x5e')][_0xfe05('0x66')]=_0x54aede['id'];return db['Disposition'][_0xfe05('0x5d')](_0x34d2bf[_0xfe05('0x5e')]);}})['then'](respondWithResult(_0x707321,null))[_0xfe05('0x5c')](handleError(_0x707321,null));};exports['getDispositions']=function(_0x212756,_0xa681de,_0x539db6){var _0x5f465f={'raw':![],'where':{}};var _0x55bee7={};var _0x131f7e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfe05('0x67')]({'where':{'id':_0x212756['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa681de,null))[_0xfe05('0x35')](function(_0x32a03f){if(_0x32a03f){_0x55bee7['model']=_['keys'](db['Disposition'][_0xfe05('0x41')]);_0x55bee7['query']=_[_0xfe05('0x68')](_0x212756[_0xfe05('0x46')]);_0x55bee7[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x55bee7[_0xfe05('0x45')],_0x55bee7[_0xfe05('0x46')]);_0x5f465f['attributes']=_['intersection'](_0x55bee7['model'],qs[_0xfe05('0x48')](_0x212756[_0xfe05('0x46')][_0xfe05('0x48')]));_0x5f465f[_0xfe05('0x49')]=_0x5f465f[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x5f465f[_0xfe05('0x49')]:_0x55bee7['model'];if(!_0x212756['query']['hasOwnProperty'](_0xfe05('0x4c'))){_0x5f465f['limit']=qs[_0xfe05('0x2e')](_0x212756[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x5f465f['offset']=qs[_0xfe05('0x2c')](_0x212756['query'][_0xfe05('0x2c')]);}_0x5f465f['order']=qs[_0xfe05('0x4e')](_0x212756[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x5f465f[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x212756['query'],_0x55bee7[_0xfe05('0x47')]));_0x5f465f[_0xfe05('0x4f')]['FaxAccountId']=_0x32a03f['id'];if(_0x212756[_0xfe05('0x46')][_0xfe05('0x51')]){_0x5f465f[_0xfe05('0x4f')]=_['merge'](_0x5f465f['where'],{'$or':_[_0xfe05('0x3f')](_0x5f465f['attributes'],function(_0x13b657){var _0x4576fb={};_0x4576fb[_0x13b657]={'$like':'%'+_0x212756[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x4576fb;})});}_0x5f465f=_[_0xfe05('0x52')]({},_0x5f465f,_0x212756[_0xfe05('0x54')]);return db[_0xfe05('0x69')][_0xfe05('0x2f')]({'where':_0x5f465f['where']})[_0xfe05('0x35')](function(_0x51e2eb){_0x131f7e[_0xfe05('0x2f')]=_0x51e2eb;if(_0x212756[_0xfe05('0x46')][_0xfe05('0x6a')]){_0x5f465f[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0x69')][_0xfe05('0x56')](_0x5f465f);})[_0xfe05('0x35')](function(_0x5b2045){_0x131f7e[_0xfe05('0x57')]=_0x5b2045;return _0x131f7e;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xa681de,_0x5f465f))[_0xfe05('0x5c')](handleError(_0xa681de,null));};exports['removeDispositions']=function(_0x5668a7,_0x3dc60e,_0x5b048f){return db['FaxAccount'][_0xfe05('0x5b')]({'where':{'id':_0x5668a7[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x3dc60e,null))[_0xfe05('0x35')](function(_0x466bc7){if(_0x466bc7){return _0x466bc7[_0xfe05('0x6b')](_0x5668a7[_0xfe05('0x46')][_0xfe05('0x6c')]);}})[_0xfe05('0x35')](respondWithStatusCode(_0x3dc60e,null))[_0xfe05('0x5c')](handleError(_0x3dc60e,null));};exports[_0xfe05('0x6d')]=function(_0x47e1ac,_0x276bc4,_0x4ba851){if(_0x47e1ac[_0xfe05('0x5e')]['id']){delete _0x47e1ac[_0xfe05('0x5e')]['id'];}return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x47e1ac[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x276bc4,null))[_0xfe05('0x35')](function(_0x2be692){if(_0x2be692){_0x47e1ac['body'][_0xfe05('0x66')]=_0x2be692['id'];return db['CannedAnswer']['create'](_0x47e1ac[_0xfe05('0x5e')]);}})['then'](respondWithResult(_0x276bc4,null))[_0xfe05('0x5c')](handleError(_0x276bc4,null));};exports[_0xfe05('0x6e')]=function(_0x3e7c6a,_0xb9ea2a,_0x49996d){var _0x431ce5={'raw':![],'where':{}};var _0x153fd8={};var _0x481178={'count':0x0,'rows':[]};return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x3e7c6a[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xb9ea2a,null))[_0xfe05('0x35')](function(_0x2dc3b1){if(_0x2dc3b1){_0x153fd8[_0xfe05('0x45')]=_[_0xfe05('0x68')](db[_0xfe05('0x6f')][_0xfe05('0x41')]);_0x153fd8[_0xfe05('0x46')]=_['keys'](_0x3e7c6a[_0xfe05('0x46')]);_0x153fd8[_0xfe05('0x47')]=_['intersection'](_0x153fd8[_0xfe05('0x45')],_0x153fd8[_0xfe05('0x46')]);_0x431ce5['attributes']=_[_0xfe05('0x5a')](_0x153fd8[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x48')]));_0x431ce5[_0xfe05('0x49')]=_0x431ce5['attributes'][_0xfe05('0x4a')]?_0x431ce5[_0xfe05('0x49')]:_0x153fd8['model'];if(!_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x431ce5['limit']=qs[_0xfe05('0x2e')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x431ce5[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x3e7c6a['query'][_0xfe05('0x2c')]);}_0x431ce5[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x3e7c6a[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x431ce5[_0xfe05('0x4f')]=qs['filters'](_[_0xfe05('0x50')](_0x3e7c6a[_0xfe05('0x46')],_0x153fd8[_0xfe05('0x47')]));_0x431ce5[_0xfe05('0x4f')][_0xfe05('0x66')]=_0x2dc3b1['id'];if(_0x3e7c6a[_0xfe05('0x46')]['filter']){_0x431ce5[_0xfe05('0x4f')]=_['merge'](_0x431ce5[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x431ce5[_0xfe05('0x49')],function(_0x360bab){var _0x391a35={};_0x391a35[_0x360bab]={'$like':'%'+_0x3e7c6a[_0xfe05('0x46')]['filter']+'%'};return _0x391a35;})});}_0x431ce5=_[_0xfe05('0x52')]({},_0x431ce5,_0x3e7c6a['options']);return db[_0xfe05('0x6f')]['count']({'where':_0x431ce5['where']})[_0xfe05('0x35')](function(_0x440b79){_0x481178[_0xfe05('0x2f')]=_0x440b79;if(_0x3e7c6a['query'][_0xfe05('0x6a')]){_0x431ce5['include']=[{'all':!![]}];}return db[_0xfe05('0x6f')][_0xfe05('0x56')](_0x431ce5);})[_0xfe05('0x35')](function(_0x1c245b){_0x481178[_0xfe05('0x57')]=_0x1c245b;return _0x481178;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xb9ea2a,_0x431ce5))[_0xfe05('0x5c')](handleError(_0xb9ea2a,null));};exports['removeAnswers']=function(_0xfdb773,_0x14ab5b,_0x3497b5){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0xfdb773[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x14ab5b,null))[_0xfe05('0x35')](function(_0x1c7aa1){if(_0x1c7aa1){return _0x1c7aa1[_0xfe05('0x70')](_0xfdb773[_0xfe05('0x46')][_0xfe05('0x6c')]);}})[_0xfe05('0x35')](respondWithStatusCode(_0x14ab5b,null))['catch'](handleError(_0x14ab5b,null));};exports[_0xfe05('0x71')]=function(_0x42fdc7,_0x3f100c,_0x1347ba){return db[_0xfe05('0x72')][_0xfe05('0x5b')]({'where':{'id':_0x42fdc7[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x3f100c,null))[_0xfe05('0x35')](function(_0x178b66){if(_0x178b66){return _0x178b66[_0xfe05('0x71')](_0x42fdc7[_0xfe05('0x5e')][_0xfe05('0x6c')],_[_0xfe05('0x73')](_0x42fdc7[_0xfe05('0x5e')],[_0xfe05('0x6c'),'id'])||{});}})[_0xfe05('0x35')](respondWithResult(_0x3f100c,null))[_0xfe05('0x5c')](handleError(_0x3f100c,null));};exports['getInteractions']=function(_0x173b53,_0xa263f9,_0x3d1a74){var _0x32a859={'raw':![],'where':{}};var _0x34c45b={};var _0x402cb5={'count':0x0,'rows':[]};return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x173b53['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa263f9,null))[_0xfe05('0x35')](function(_0x542bde){if(_0x542bde){_0x34c45b[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x72')]['rawAttributes']);_0x34c45b[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x173b53[_0xfe05('0x46')]);_0x34c45b[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x34c45b[_0xfe05('0x45')],_0x34c45b['query']);_0x32a859[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x34c45b[_0xfe05('0x45')],qs['fields'](_0x173b53[_0xfe05('0x46')][_0xfe05('0x48')]));_0x32a859[_0xfe05('0x49')]=_0x32a859['attributes'][_0xfe05('0x4a')]?_0x32a859[_0xfe05('0x49')]:_0x34c45b[_0xfe05('0x45')];if(!_0x173b53[_0xfe05('0x46')][_0xfe05('0x4b')](_0xfe05('0x4c'))){_0x32a859[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x173b53[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x32a859[_0xfe05('0x2c')]=qs['offset'](_0x173b53[_0xfe05('0x46')][_0xfe05('0x2c')]);}_0x32a859['order']=qs[_0xfe05('0x4e')](_0x173b53[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x32a859[_0xfe05('0x4f')]=qs['filters'](_[_0xfe05('0x50')](_0x173b53['query'],_0x34c45b[_0xfe05('0x47')]));_0x32a859[_0xfe05('0x4f')]['FaxAccountId']=_0x542bde['id'];if(_0x173b53['query']['filter']){_0x32a859[_0xfe05('0x4f')]=_['merge'](_0x32a859['where'],{'$or':_[_0xfe05('0x3f')](_0x32a859[_0xfe05('0x49')],function(_0x3dd00b){var _0x389931={};_0x389931[_0x3dd00b]={'$like':'%'+_0x173b53[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x389931;})});}_0x32a859=_['merge']({},_0x32a859,_0x173b53[_0xfe05('0x54')]);return db[_0xfe05('0x72')][_0xfe05('0x2f')]({'where':_0x32a859['where']})[_0xfe05('0x35')](function(_0x12072c){_0x402cb5['count']=_0x12072c;if(_0x173b53['query'][_0xfe05('0x6a')]){_0x32a859[_0xfe05('0x55')]=[{'model':db[_0xfe05('0x74')],'as':_0xfe05('0x75'),'required':![]},{'model':db[_0xfe05('0x76')],'as':_0xfe05('0x77'),'attributes':[_0xfe05('0x3b'),_0xfe05('0x78'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xfe05('0x79'),'attributes':['id','name',_0xfe05('0x7a')],'where':_0x173b53[_0xfe05('0x46')]['tag']?{'id':_0x173b53[_0xfe05('0x46')][_0xfe05('0x7b')]}:undefined,'required':_0x173b53[_0xfe05('0x46')][_0xfe05('0x7b')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x32a859);})[_0xfe05('0x35')](function(_0x3308e3){_0x402cb5[_0xfe05('0x57')]=_0x3308e3;return _0x402cb5;});}})[_0xfe05('0x35')](respondWithFilteredResult(_0xa263f9,_0x32a859))[_0xfe05('0x5c')](handleError(_0xa263f9,null));};exports['addApplications']=function(_0x183191,_0x7b6d45){var _0x37661e=_0x183191[_0xfe05('0x59')]['id'];var _0x1b2e0a=_0x183191[_0xfe05('0x5e')];var _0xf303c3=0xc8;var _0x42b9b5=null;return db[_0xfe05('0x7c')][_0xfe05('0x7d')]({'isolationLevel':db[_0xfe05('0x7c')][_0xfe05('0x7e')][_0xfe05('0x7f')]['READ_COMMITTED']},function(_0x339b9c){return db[_0xfe05('0x40')][_0xfe05('0x67')]({'where':{'id':_0x37661e},'transaction':_0x339b9c})[_0xfe05('0x35')](function(_0x51cee9){if(_0x51cee9){return db[_0xfe05('0x80')][_0xfe05('0x36')]({'where':{'FaxAccountId':_0x37661e},'transaction':_0x339b9c})[_0xfe05('0x35')](function(){var _0x1ffa51=_[_0xfe05('0x3f')](_0x1b2e0a,function(_0xbb2d08){_0xbb2d08[_0xfe05('0x66')]=_0x37661e;return _0xbb2d08;});return db[_0xfe05('0x80')][_0xfe05('0x81')](_0x1ffa51,{'transaction':_0x339b9c});});}else{_0xf303c3=0x194;_0x42b9b5=[];}});})[_0xfe05('0x35')](function(){if(_0xf303c3!==0x194){return db['FaxApplication'][_0xfe05('0x82')]({'where':{'FaxAccountId':_0x37661e},'order':'priority'})[_0xfe05('0x35')](function(_0x2e0653){_0x42b9b5=_0x2e0653;});}})[_0xfe05('0x5c')](function(_0x580fe2){_0xf303c3=0x1f4;logger[_0xfe05('0x25')](_0x580fe2[_0xfe05('0x3a')]);if(_0x580fe2['name']){delete _0x580fe2[_0xfe05('0x3b')];}_0x42b9b5=_0x580fe2;})[_0xfe05('0x83')](function(){if(_0x42b9b5===null){_0x7b6d45[_0xfe05('0x28')](_0xf303c3);}else{if(_0xf303c3===0x1f4){_0x7b6d45[_0xfe05('0x2a')](_0xf303c3)[_0xfe05('0x3c')](_0x42b9b5);}else{_0x7b6d45['status'](_0xf303c3)['json'](_0x42b9b5);}}});};exports[_0xfe05('0x84')]=function(_0x2bfc89,_0xa2b339,_0x589e7a){var _0x566b08={};var _0x32a35c={};var _0x267758;var _0x351fe8;return db['FaxAccount'][_0xfe05('0x67')]({'where':{'id':_0x2bfc89['params']['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0xa2b339,null))[_0xfe05('0x35')](function(_0x3c49d5){if(_0x3c49d5){_0x267758=_0x3c49d5;_0x32a35c[_0xfe05('0x45')]=_['keys'](db[_0xfe05('0x80')][_0xfe05('0x41')]);_0x32a35c[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x2bfc89[_0xfe05('0x46')]);_0x32a35c[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x32a35c[_0xfe05('0x45')],_0x32a35c[_0xfe05('0x46')]);_0x566b08[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x32a35c[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x2bfc89['query'][_0xfe05('0x48')]));_0x566b08[_0xfe05('0x49')]=_0x566b08[_0xfe05('0x49')][_0xfe05('0x4a')]?_0x566b08[_0xfe05('0x49')]:_0x32a35c['model'];_0x566b08[_0xfe05('0x4d')]=qs['sort'](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x566b08[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_['pick'](_0x2bfc89[_0xfe05('0x46')],_0x32a35c[_0xfe05('0x47')]));if(_0x2bfc89['query']['filter']){_0x566b08['where']=_[_0xfe05('0x52')](_0x566b08[_0xfe05('0x4f')],{'$or':_[_0xfe05('0x3f')](_0x566b08[_0xfe05('0x49')],function(_0x2d3692){var _0x5d24ca={};_0x5d24ca[_0x2d3692]={'$like':'%'+_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x51')]+'%'};return _0x5d24ca;})});}_0x566b08=_[_0xfe05('0x52')]({},_0x566b08,_0x2bfc89['options']);return _0x267758[_0xfe05('0x84')](_0x566b08);}})[_0xfe05('0x35')](function(_0x538201){if(_0x538201){_0x351fe8=_0x538201[_0xfe05('0x4a')];if(!_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x4b')]('nolimit')){_0x566b08[_0xfe05('0x2e')]=qs['limit'](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x2e')]);_0x566b08[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x2bfc89[_0xfe05('0x46')][_0xfe05('0x2c')]);}return _0x267758[_0xfe05('0x84')](_0x566b08);}})[_0xfe05('0x35')](function(_0x5b6dec){if(_0x5b6dec){return _0x5b6dec?{'count':_0x351fe8,'rows':_0x5b6dec}:null;}})[_0xfe05('0x35')](respondWithResult(_0xa2b339,null))[_0xfe05('0x5c')](handleError(_0xa2b339,null));};function Extension(_0x4bddc2,_0x2f97f4,_0x568ca3,_0x20323){this[_0xfe05('0x85')]=_0xfe05('0x86');this[_0xfe05('0x87')]=_0x4bddc2[_0xfe05('0x88')];this[_0xfe05('0x89')]=_0x20323;this[_0xfe05('0x43')]=_0xfe05('0x8a');this[_0xfe05('0x8b')]=_0xfe05('0x8c');this[_0xfe05('0x66')]=_0x4bddc2['id'];this['priority']=_0x2f97f4;this[_0xfe05('0x8d')]=_0x568ca3;}function createExtensionsReciveFax(_0x228130){var _0x57f10f=0x1;var _0x39cdc5=[];_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,'','Answer'));_0x57f10f+=0x1;_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x8f'),_0xfe05('0x90')));_0x57f10f+=0x1;for(var _0x30c961 in _0x228130){if(_0x228130[_0xfe05('0x4b')](_0x30c961)&&(_0x30c961===_0xfe05('0x91')||_0x30c961==='localstationid'||_0x30c961===_0xfe05('0x92')||_0x30c961===_0xfe05('0x93')||_0x30c961===_0xfe05('0x94')||_0x30c961==='maxrate'||_0x30c961===_0xfe05('0x95')||_0x30c961===_0xfe05('0x96')||_0x30c961==='t38timeout')){_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x97')+_0x30c961+')='+_0x228130[_0x30c961],_0xfe05('0x90')));_0x57f10f+=0x1;}}_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,'6',_0xfe05('0x98')));_0x57f10f+=0x1;_0x39cdc5[_0xfe05('0x8e')](new Extension(_0x228130,_0x57f10f,_0xfe05('0x99'),_0xfe05('0x9a')));_0x57f10f=0x0;return _0x39cdc5;}exports[_0xfe05('0x9b')]=function(_0x8c356b,_0x258624,_0x294a18){var _0x428504;return db[_0xfe05('0x7c')][_0xfe05('0x7d')](function(_0x1dd5ab){return db['FaxAccount'][_0xfe05('0x5d')](_0x8c356b['body'],{'transaction':_0x1dd5ab})[_0xfe05('0x35')](function(_0x59f79f){_0x428504=_0x59f79f[_0xfe05('0x37')]({'plain':!![]});return db[_0xfe05('0x9c')][_0xfe05('0x81')](createExtensionsReciveFax(_0x428504),{'transaction':_0x1dd5ab});});})[_0xfe05('0x35')](function(){return _0x428504;})[_0xfe05('0x35')](respondWithResult(_0x258624,null))[_0xfe05('0x5c')](handleError(_0x258624,null));};exports[_0xfe05('0x9d')]=function(_0x7f5b4a,_0x1d3020,_0x5a0913){var _0x4fc86f;return db[_0xfe05('0x7c')][_0xfe05('0x7d')](function(_0x3e601a){return db[_0xfe05('0x40')]['update'](_0x7f5b4a['body'],{'where':{'id':_0x7f5b4a[_0xfe05('0x5e')]['id']},'transaction':_0x3e601a})['then'](function(_0x59c7e0){return db['VoiceExtension'][_0xfe05('0x36')]({'where':{'FaxAccountId':_0x7f5b4a[_0xfe05('0x5e')]['id']},'transaction':_0x3e601a})['then'](function(_0x541da3){return db[_0xfe05('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xfe05('0x73')](_0x7f5b4a[_0xfe05('0x5e')],[_0xfe05('0x9e'),_0xfe05('0x44'),_0xfe05('0x9f'),'updatedAt',_0xfe05('0xa0'),_0xfe05('0xa1')])),{'transaction':_0x3e601a});});});})[_0xfe05('0x35')](function(){return db[_0xfe05('0x40')][_0xfe05('0xa2')](_0x7f5b4a[_0xfe05('0x5e')]['id']);})[_0xfe05('0x35')](respondWithResult(_0x1d3020,null))[_0xfe05('0x5c')](handleError(_0x1d3020,null));};exports['getMessages']=function(_0x2acd4f,_0x4d5395,_0x3b57bb){var _0x9eb59c={'raw':!![],'where':{}};var _0x4ac31d={};var _0x1024a4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2acd4f['params']['id']}})['then'](handleEntityNotFound(_0x4d5395,null))[_0xfe05('0x35')](function(_0x2581a3){if(_0x2581a3){_0x4ac31d[_0xfe05('0x45')]=_[_0xfe05('0x68')](db['FaxMessage']['rawAttributes']);_0x4ac31d[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x2acd4f['query']);_0x4ac31d[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x4ac31d[_0xfe05('0x45')],_0x4ac31d['query']);_0x9eb59c[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x4ac31d[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x48')]));_0x9eb59c['attributes']=_0x9eb59c['attributes'][_0xfe05('0x4a')]?_0x9eb59c[_0xfe05('0x49')]:_0x4ac31d['model'];if(!_0x2acd4f['query']['hasOwnProperty'](_0xfe05('0x4c'))){_0x9eb59c[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x2acd4f[_0xfe05('0x46')]['limit']);_0x9eb59c[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x2c')]);}_0x9eb59c['order']=qs[_0xfe05('0x4e')](_0x2acd4f[_0xfe05('0x46')][_0xfe05('0x4e')]);_0x9eb59c[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x2acd4f['query'],_0x4ac31d[_0xfe05('0x47')]));_0x9eb59c[_0xfe05('0x4f')][_0xfe05('0x66')]=_0x2581a3['id'];if(_0x2acd4f['query'][_0xfe05('0x51')]){_0x9eb59c[_0xfe05('0x4f')]=_[_0xfe05('0x52')](_0x9eb59c['where'],{'$or':_[_0xfe05('0x3f')](_0x9eb59c[_0xfe05('0x49')],function(_0x5681d0){var _0x497ac1={};_0x497ac1[_0x5681d0]={'$like':'%'+_0x2acd4f[_0xfe05('0x46')]['filter']+'%'};return _0x497ac1;})});}if(_0x2acd4f[_0xfe05('0x46')]['$gte']){var _0x1ee333=_0x2acd4f[_0xfe05('0x46')][_0xfe05('0xa3')]['split'](',');var _0x559963={};_0x559963[_0x1ee333[0x0]]={'$gte':moment(_0x1ee333[0x1])[_0xfe05('0xa4')](_0xfe05('0xa5'))};_0x9eb59c[_0xfe05('0x4f')]=_['merge'](_0x9eb59c[_0xfe05('0x4f')],_0x559963);}_0x9eb59c=_['merge']({},_0x9eb59c,_0x2acd4f[_0xfe05('0x54')]);return db['FaxMessage']['count']({'where':_0x9eb59c[_0xfe05('0x4f')]})[_0xfe05('0x35')](function(_0x2940cc){_0x1024a4[_0xfe05('0x2f')]=_0x2940cc;if(_0x2acd4f['query'][_0xfe05('0x6a')]){_0x9eb59c[_0xfe05('0x55')]=[{'all':!![]}];}return db[_0xfe05('0xa6')]['findAll'](_0x9eb59c);})[_0xfe05('0x35')](function(_0x52cd9d){_0x1024a4[_0xfe05('0x57')]=_0x52cd9d;return _0x1024a4;});}})['then'](respondWithFilteredResult(_0x4d5395,_0x9eb59c))[_0xfe05('0x5c')](handleError(_0x4d5395,null));};exports[_0xfe05('0x3c')]=function(_0x457d02,_0x3729a6,_0x16333f){var _0x3a9559,_0x1b7ea9={},_0x3f9036;if(_0x457d02['body']['to']){_0x3f9036=_0x457d02[_0xfe05('0x5e')]['to'][0x0];}return db[_0xfe05('0x40')]['find']({'where':{'id':_0x457d02['params']['id']},'include':[{'model':db['CmList'],'as':_0xfe05('0xa7'),'include':[{'model':db[_0xfe05('0x74')],'as':'Contacts','where':{'fax':_0x3f9036},'limit':0x1,'order':[[_0xfe05('0xa8'),_0xfe05('0xa9')]]}]}]})[_0xfe05('0x35')](handleEntityNotFound(_0x3729a6,null))[_0xfe05('0x35')](function(_0x4afa2e){_0x3a9559=_0x4afa2e;if(_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')]&&_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xfe05('0x4a')]){for(var _0xe234b8=0x0;_0xe234b8<_0x457d02['body'][_0xfe05('0xaa')][_0xfe05('0x4a')];_0xe234b8+=0x1){_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xe234b8]={'filename':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][_0xe234b8][_0xfe05('0x3b')],'id':_0x457d02['body'][_0xfe05('0xaa')][_0xe234b8]['id'],'path':path[_0xfe05('0xab')](config['root'],_0xfe05('0xac'),_0x457d02['body'][_0xfe05('0xaa')][_0xe234b8]['basename'])};}}return respondWithRpcPromise(_0xfe05('0xad'),_0xfe05('0xad'),{'FaxAccountId':_['isNil'](_0x457d02[_0xfe05('0x59')]['id'])?undefined:_0x457d02[_0xfe05('0x59')]['id'],'path':_[_0xfe05('0xae')](_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0][_0xfe05('0xaf')])?undefined:_0x457d02['body'][_0xfe05('0xaa')][0x0]['path'],'fax':_[_0xfe05('0xae')](_0x457d02['body']['to'][0x0])?undefined:_0x457d02[_0xfe05('0x5e')]['to'][0x0]},client9002);})[_0xfe05('0x35')](function(){if(_0x3a9559){if(_['isNil'](_0x457d02[_0xfe05('0x5e')][_0xfe05('0xb0')])){_0x457d02['body'][_0xfe05('0xb0')]=util[_0xfe05('0xa4')](_0xfe05('0xb1'),_0x3a9559[_0xfe05('0x3b')],_0x3a9559[_0xfe05('0xb2')]);}if(_0x3a9559[_0xfe05('0xa7')]){if(_0x3a9559[_0xfe05('0xa7')][_0xfe05('0xb3')][_0xfe05('0x4a')]){return _0x3a9559[_0xfe05('0xa7')][_0xfe05('0xb3')][0x0];}else{return db[_0xfe05('0x74')][_0xfe05('0x5d')](_['defaults'](_0x457d02[_0xfe05('0x5e')],{'firstName':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'phone':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'fax':_0x457d02[_0xfe05('0x5e')]['to'][0x0],'ListId':_0x3a9559['ListId']}));}}else{throw new Error(_0xfe05('0xb4'));}}else{throw new Error(_0xfe05('0xb5'));}})[_0xfe05('0x35')](function(_0xe6a7a1){if(_0xe6a7a1){return db[_0xfe05('0x72')][_0xfe05('0x5b')]({'where':{'ContactId':_0xe6a7a1['id'],'closed':![],'FaxAccountId':_0x3a9559['id']}})[_0xfe05('0x35')](function(_0x5152b2){if(_0x5152b2){return[_0x5152b2,![]];}return db['FaxInteraction'][_0xfe05('0x5d')]({'UserId':_0x457d02[_0xfe05('0x5f')]['id'],'ContactId':_0xe6a7a1['id'],'FaxAccountId':_0x3a9559['id'],'fax':_0x457d02['body']['to'][0x0],'firstMsgDirection':_0xfe05('0xb6'),'Messages':[_[_0xfe05('0x52')](_0x457d02[_0xfe05('0x5e')],{'read':![],'body':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['filename'],'FaxAccountId':_0x3a9559['id'],'UserId':_0x457d02['user']['id'],'ContactId':_0xe6a7a1['id'],'AttachmentId':_0x457d02[_0xfe05('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xfe05('0xa6')],'as':'Messages'}]})['then'](function(_0x12fa3a){return[_0x12fa3a,!![]];});});}else{throw new Error(_0xfe05('0xb7'));}})[_0xfe05('0xb8')](function(_0x269854,_0x505180){if(_0x505180){return _0x269854;}return db[_0xfe05('0xa6')][_0xfe05('0x5d')]({'direction':_0xfe05('0xb6'),'read':![],'body':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['filename'],'FaxAccountId':_0x3a9559['id'],'FaxInteractionId':_0x269854['id'],'UserId':_0x457d02[_0xfe05('0x5f')]['id'],'ContactId':_0x269854['ContactId'],'AttachmentId':_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0]['id']})[_0xfe05('0x35')](function(_0x463872){_0x269854[_0xfe05('0xb9')]['Messages']=[];_0x269854['dataValues'][_0xfe05('0xba')][_0xfe05('0x8e')](_0x463872['dataValues']);return _0x269854;});})['then'](function(_0xe648a){respondWithRpcPromise(_0xfe05('0xbb'),'SendFax',{'FaxAccountId':_['isNil'](_0x457d02['params']['id'])?undefined:_0x457d02[_0xfe05('0x59')]['id'],'path':_['isNil'](_0x457d02['body'][_0xfe05('0xaa')][0x0]['path'])?undefined:_0x457d02[_0xfe05('0x5e')][_0xfe05('0xaa')][0x0][_0xfe05('0xaf')],'fax':_[_0xfe05('0xae')](_0x457d02['body']['to'][0x0])?undefined:_0x457d02[_0xfe05('0x5e')]['to'][0x0],'AttachmentId':_0x457d02[_0xfe05('0x5e')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1ad919){logger[_0xfe05('0x1f')]('SendFaxRpc,\x20%s',_0x1ad919);})[_0xfe05('0x5c')](function(_0x49e870){logger[_0xfe05('0x1f')]('SendFaxRpc,\x20%s',_0x49e870);});return _0xe648a;})[_0xfe05('0x35')](respondWithResult(_0x3729a6,null))[_0xfe05('0x5c')](handleError(_0x3729a6,null));};exports[_0xfe05('0xbc')]=function(_0x4710da,_0x51195c,_0x1ec0d7){return db[_0xfe05('0x40')]['find']({'where':{'id':_0x4710da[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x51195c,null))[_0xfe05('0x35')](function(_0x3ef44d){if(_0x3ef44d){return _0x3ef44d[_0xfe05('0xbc')](_0x4710da[_0xfe05('0x5e')]['ids'],_['omit'](_0x4710da[_0xfe05('0x5e')],[_0xfe05('0x6c'),'id'])||{})[_0xfe05('0xb8')](function(_0x478b49){for(var _0x3133b0=0x0;_0x3133b0<_0x4710da[_0xfe05('0x5e')][_0xfe05('0x6c')]['length'];_0x3133b0+=0x1){socket[_0xfe05('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x4710da['body'][_0xfe05('0x6c')][_0x3133b0]),'FaxAccountId':Number(_0x4710da[_0xfe05('0x59')]['id'])});}return _0x478b49;});}})[_0xfe05('0x35')](respondWithResult(_0x51195c,null))[_0xfe05('0x5c')](handleError(_0x51195c,null));};exports[_0xfe05('0xbe')]=function(_0x4f1043,_0x9732ef,_0x3a61ad){return db[_0xfe05('0x40')][_0xfe05('0x5b')]({'where':{'id':_0x4f1043[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x9732ef,null))[_0xfe05('0x35')](function(_0x5cb122){if(_0x5cb122){return _0x5cb122['removeAgents'](_0x4f1043['query'][_0xfe05('0x6c')])[_0xfe05('0x35')](function(){if(_[_0xfe05('0xbf')](_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')])){for(var _0x5786ad=0x0;_0x5786ad<_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')]['length'];_0x5786ad+=0x1){socket['emit'](_0xfe05('0xc0'),{'UserId':Number(_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')][_0x5786ad]),'FaxAccountId':Number(_0x4f1043[_0xfe05('0x59')]['id'])});}}else{socket['emit'](_0xfe05('0xc0'),{'UserId':Number(_0x4f1043[_0xfe05('0x46')][_0xfe05('0x6c')]),'FaxAccountId':Number(_0x4f1043[_0xfe05('0x59')]['id'])});}});}})[_0xfe05('0x35')](respondWithStatusCode(_0x9732ef,null))[_0xfe05('0x5c')](handleError(_0x9732ef,null));};exports[_0xfe05('0xc1')]=function(_0x3465e8,_0x5ad939,_0x1502a1){var _0x280356={};var _0x561640={};var _0x9c9c4e;var _0x4afac7;return db[_0xfe05('0x40')]['findOne']({'where':{'id':_0x3465e8[_0xfe05('0x59')]['id']}})[_0xfe05('0x35')](handleEntityNotFound(_0x5ad939,null))[_0xfe05('0x35')](function(_0x17af7d){if(_0x17af7d){_0x9c9c4e=_0x17af7d;_0x561640[_0xfe05('0x45')]=_[_0xfe05('0x68')](db[_0xfe05('0x76')][_0xfe05('0x41')]);_0x561640[_0xfe05('0x46')]=_[_0xfe05('0x68')](_0x3465e8[_0xfe05('0x46')]);_0x561640[_0xfe05('0x47')]=_[_0xfe05('0x5a')](_0x561640[_0xfe05('0x45')],_0x561640[_0xfe05('0x46')]);_0x280356[_0xfe05('0x49')]=_[_0xfe05('0x5a')](_0x561640[_0xfe05('0x45')],qs[_0xfe05('0x48')](_0x3465e8[_0xfe05('0x46')][_0xfe05('0x48')]));_0x280356[_0xfe05('0x49')]=_0x280356['attributes'][_0xfe05('0x4a')]?_0x280356[_0xfe05('0x49')]:_0x561640[_0xfe05('0x45')];_0x280356[_0xfe05('0x4d')]=qs[_0xfe05('0x4e')](_0x3465e8[_0xfe05('0x46')]['sort']);_0x280356[_0xfe05('0x4f')]=qs[_0xfe05('0x47')](_[_0xfe05('0x50')](_0x3465e8[_0xfe05('0x46')],_0x561640[_0xfe05('0x47')]));if(_0x3465e8[_0xfe05('0x46')][_0xfe05('0x51')]){_0x280356['where']=_[_0xfe05('0x52')](_0x280356[_0xfe05('0x4f')],{'$or':_['map'](_0x280356[_0xfe05('0x49')],function(_0x55b51a){var _0x1f5d0a={};_0x1f5d0a[_0x55b51a]={'$like':'%'+_0x3465e8[_0xfe05('0x46')]['filter']+'%'};return _0x1f5d0a;})});}_0x280356=_[_0xfe05('0x52')]({},_0x280356,_0x3465e8['options']);return _0x9c9c4e[_0xfe05('0xc1')](_0x280356);}})[_0xfe05('0x35')](function(_0x51fe77){if(_0x51fe77){_0x4afac7=_0x51fe77[_0xfe05('0x4a')];if(!_0x3465e8[_0xfe05('0x46')]['hasOwnProperty'](_0xfe05('0x4c'))){_0x280356[_0xfe05('0x2e')]=qs[_0xfe05('0x2e')](_0x3465e8[_0xfe05('0x46')]['limit']);_0x280356[_0xfe05('0x2c')]=qs[_0xfe05('0x2c')](_0x3465e8[_0xfe05('0x46')][_0xfe05('0x2c')]);}return _0x9c9c4e[_0xfe05('0xc1')](_0x280356);}})[_0xfe05('0x35')](function(_0x1a5164){if(_0x1a5164){return _0x1a5164?{'count':_0x4afac7,'rows':_0x1a5164}:null;}})[_0xfe05('0x35')](respondWithResult(_0x5ad939,null))[_0xfe05('0x5c')](handleError(_0x5ad939,null));}; \ No newline at end of file +var _0xea44=['Pause','mandatoryDispositionPause','FaxAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','options','count','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','body','Disposition','getDispositions','findOne','hasOwnProperty','order','FaxAccountId','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','path','from','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','addAgents','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../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','./faxAccount.socket','jayson/promise','http','client','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','stack','name','send','index'];(function(_0x4b1e80,_0x26ace0){var _0x896011=function(_0xb89daf){while(--_0xb89daf){_0x4b1e80['push'](_0x4b1e80['shift']());}};_0x896011(++_0x26ace0);}(_0xea44,0x148));var _0x4ea4=function(_0x408d17,_0x13ec0b){_0x408d17=_0x408d17-0x0;var _0x5b21e9=_0xea44[_0x408d17];return _0x5b21e9;};'use strict';var emlformat=require(_0x4ea4('0x0'));var rimraf=require(_0x4ea4('0x1'));var zipdir=require(_0x4ea4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ea4('0x3'));var BPromise=require(_0x4ea4('0x4'));var Mustache=require('mustache');var util=require(_0x4ea4('0x5'));var path=require('path');var sox=require(_0x4ea4('0x6'));var csv=require(_0x4ea4('0x7'));var ejs=require(_0x4ea4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ea4('0x9'));var crypto=require(_0x4ea4('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4ea4('0x7'));var querystring=require(_0x4ea4('0xb'));var Papa=require(_0x4ea4('0xc'));var Redis=require(_0x4ea4('0xd'));var authService=require(_0x4ea4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4ea4('0xf'));var hardwareService=require(_0x4ea4('0x10'));var logger=require(_0x4ea4('0x11'))(_0x4ea4('0x12'));var utils=require(_0x4ea4('0x13'));var config=require(_0x4ea4('0x14'));var licenseUtil=require(_0x4ea4('0x15'));var db=require(_0x4ea4('0x16'))['db'];config['redis']=_['defaults'](config[_0x4ea4('0x17')],{'host':_0x4ea4('0x18'),'port':0x18eb});var socket=require(_0x4ea4('0x19'))(new Redis(config['redis']));require(_0x4ea4('0x1a'))['register'](socket);var jayson=require(_0x4ea4('0x1b'));var client=jayson['client'][_0x4ea4('0x1c')]({'port':0x232c});var client9002=jayson[_0x4ea4('0x1d')][_0x4ea4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x20f40c,_0x577a3d,_0x1be753,_0x5a656b){return new BPromise(function(_0x371409,_0xa99056){var _0x36b738=_0x5a656b||client;return _0x36b738['request'](_0x20f40c,_0x1be753)[_0x4ea4('0x1e')](function(_0x50601e){logger['info']('FaxAccount,\x20%s,\x20%s',_0x577a3d,_0x4ea4('0x1f'));logger[_0x4ea4('0x20')](_0x4ea4('0x21'),_0x577a3d,_0x4ea4('0x1f'),JSON['stringify'](_0x50601e));if(_0x50601e[_0x4ea4('0x22')]){if(_0x50601e[_0x4ea4('0x22')]['code']===0x1f4){logger[_0x4ea4('0x22')](_0x4ea4('0x23'),_0x577a3d,_0x50601e['error'][_0x4ea4('0x24')]);return _0xa99056(_0x50601e[_0x4ea4('0x22')][_0x4ea4('0x24')]);}logger[_0x4ea4('0x22')]('FaxAccount,\x20%s,\x20%s',_0x577a3d,_0x50601e[_0x4ea4('0x22')][_0x4ea4('0x24')]);return _0x371409(_0x50601e[_0x4ea4('0x22')][_0x4ea4('0x24')]);}else{logger[_0x4ea4('0x25')](_0x4ea4('0x23'),_0x577a3d,'request\x20sent');_0x371409(_0x50601e[_0x4ea4('0x26')]['message']);}})['catch'](function(_0x2fc21a){logger[_0x4ea4('0x22')](_0x4ea4('0x23'),_0x577a3d,_0x2fc21a);_0xa99056(_0x2fc21a);});});}function respondWithStatusCode(_0x1a8fa9,_0x4bdfed){_0x4bdfed=_0x4bdfed||0xcc;return function(_0x4b3534){if(_0x4b3534){return _0x1a8fa9[_0x4ea4('0x27')](_0x4bdfed);}return _0x1a8fa9[_0x4ea4('0x28')](_0x4bdfed)[_0x4ea4('0x29')]();};}function respondWithResult(_0x541112,_0x19165a){_0x19165a=_0x19165a||0xc8;return function(_0x38a6e7){if(_0x38a6e7){return _0x541112[_0x4ea4('0x28')](_0x19165a)[_0x4ea4('0x2a')](_0x38a6e7);}};}function respondWithFilteredResult(_0x29ce3b,_0x41d06c){return function(_0x11eafc){if(_0x11eafc){var _0x28f234=typeof _0x41d06c[_0x4ea4('0x2b')]===_0x4ea4('0x2c')&&typeof _0x41d06c['limit']===_0x4ea4('0x2c');var _0x598478=_0x11eafc['count'];var _0x1ecd43=_0x28f234?0x0:_0x41d06c[_0x4ea4('0x2b')];var _0x33fa87=_0x28f234?_0x11eafc['count']:_0x41d06c[_0x4ea4('0x2b')]+_0x41d06c['limit'];var _0x5a375c;if(_0x33fa87>=_0x598478){_0x33fa87=_0x598478;_0x5a375c=0xc8;}else{_0x5a375c=0xce;}_0x29ce3b[_0x4ea4('0x28')](_0x5a375c);return _0x29ce3b[_0x4ea4('0x2d')](_0x4ea4('0x2e'),_0x1ecd43+'-'+_0x33fa87+'/'+_0x598478)[_0x4ea4('0x2a')](_0x11eafc);}return null;};}function patchUpdates(_0x1102de){return function(_0xae47c1){try{jsonpatch[_0x4ea4('0x2f')](_0xae47c1,_0x1102de,!![]);}catch(_0x40a7d8){return BPromise[_0x4ea4('0x30')](_0x40a7d8);}return _0xae47c1[_0x4ea4('0x31')]();};}function saveUpdates(_0x254314,_0x357649){return function(_0x54cbbd){if(_0x54cbbd){return _0x54cbbd[_0x4ea4('0x32')](_0x254314)[_0x4ea4('0x1e')](function(_0xfce58a){return _0xfce58a;});}return null;};}function removeEntity(_0xf014a8,_0x19e069){return function(_0xb83bcf){if(_0xb83bcf){return _0xb83bcf['destroy']()[_0x4ea4('0x1e')](function(){var _0x435416=_0xb83bcf[_0x4ea4('0x33')]({'plain':!![]});var _0x4b2d01=_0x4ea4('0x34');return db[_0x4ea4('0x35')]['destroy']({'where':{'type':_0x4b2d01,'resourceId':_0x435416['id']}})['then'](function(){return _0xb83bcf;});})[_0x4ea4('0x1e')](function(){_0xf014a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x118829,_0x134e92){return function(_0x36a21c){if(!_0x36a21c){_0x118829[_0x4ea4('0x27')](0x194);}return _0x36a21c;};}function handleError(_0x1af640,_0x161089){_0x161089=_0x161089||0x1f4;return function(_0x4e29da){logger[_0x4ea4('0x22')](_0x4e29da[_0x4ea4('0x36')]);if(_0x4e29da[_0x4ea4('0x37')]){delete _0x4e29da[_0x4ea4('0x37')];}_0x1af640[_0x4ea4('0x28')](_0x161089)[_0x4ea4('0x38')](_0x4e29da);};}exports[_0x4ea4('0x39')]=function(_0x27ab71,_0x1c2faa){var _0x494c2b={'include':[{'model':db[_0x4ea4('0x3a')],'as':_0x4ea4('0x3b')}]},_0x258b1e={},_0x2b6e69={'count':0x0,'rows':[]};var _0x4d6e57=_['map'](db[_0x4ea4('0x3c')]['rawAttributes'],function(_0x29bada){return{'name':_0x29bada[_0x4ea4('0x3d')],'type':_0x29bada['type'][_0x4ea4('0x3e')]};});_0x258b1e[_0x4ea4('0x3f')]=_[_0x4ea4('0x40')](_0x4d6e57,_0x4ea4('0x37'));_0x258b1e[_0x4ea4('0x41')]=_[_0x4ea4('0x42')](_0x27ab71[_0x4ea4('0x41')]);_0x258b1e[_0x4ea4('0x43')]=_[_0x4ea4('0x44')](_0x258b1e[_0x4ea4('0x3f')],_0x258b1e[_0x4ea4('0x41')]);_0x494c2b[_0x4ea4('0x45')]=_[_0x4ea4('0x44')](_0x258b1e[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x27ab71[_0x4ea4('0x41')]['fields']));_0x494c2b[_0x4ea4('0x45')]=_0x494c2b['attributes'][_0x4ea4('0x47')]?_0x494c2b[_0x4ea4('0x45')]:_0x258b1e[_0x4ea4('0x3f')];if(!_0x27ab71['query']['hasOwnProperty'](_0x4ea4('0x48'))){_0x494c2b[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x27ab71[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x494c2b[_0x4ea4('0x2b')]=qs[_0x4ea4('0x2b')](_0x27ab71[_0x4ea4('0x41')][_0x4ea4('0x2b')]);}_0x494c2b['order']=qs[_0x4ea4('0x4a')](_0x27ab71[_0x4ea4('0x41')][_0x4ea4('0x4a')]);_0x494c2b[_0x4ea4('0x4b')]=qs['filters'](_[_0x4ea4('0x4c')](_0x27ab71[_0x4ea4('0x41')],_0x258b1e[_0x4ea4('0x43')]),_0x4d6e57);if(_0x27ab71['query'][_0x4ea4('0x4d')]){_0x494c2b[_0x4ea4('0x4b')]=_[_0x4ea4('0x4e')](_0x494c2b[_0x4ea4('0x4b')],{'$or':_['map'](_0x4d6e57,function(_0xf11f79){if(_0xf11f79[_0x4ea4('0x4f')]!=='VIRTUAL'){var _0x5c7c49={};_0x5c7c49[_0xf11f79[_0x4ea4('0x37')]]={'$like':'%'+_0x27ab71[_0x4ea4('0x41')][_0x4ea4('0x4d')]+'%'};return _0x5c7c49;}})});}_0x494c2b=_[_0x4ea4('0x4e')]({},_0x494c2b,_0x27ab71[_0x4ea4('0x50')]);var _0x50995b={'where':_0x494c2b[_0x4ea4('0x4b')]};return db['FaxAccount'][_0x4ea4('0x51')](_0x50995b)[_0x4ea4('0x1e')](function(_0x124b60){_0x2b6e69[_0x4ea4('0x51')]=_0x124b60;if(_0x27ab71[_0x4ea4('0x41')]['includeAll']){_0x494c2b['include']=[{'all':!![]}];}return db[_0x4ea4('0x3c')][_0x4ea4('0x52')](_0x494c2b);})[_0x4ea4('0x1e')](function(_0x48fb87){_0x2b6e69[_0x4ea4('0x53')]=_0x48fb87;return _0x2b6e69;})[_0x4ea4('0x1e')](respondWithFilteredResult(_0x1c2faa,_0x494c2b))[_0x4ea4('0x54')](handleError(_0x1c2faa,null));};exports[_0x4ea4('0x55')]=function(_0x2c2821,_0x5683b6){var _0x1f0e64={'raw':![],'where':{'id':_0x2c2821[_0x4ea4('0x56')]['id']},'include':[{'model':db[_0x4ea4('0x3a')],'as':_0x4ea4('0x3b')}]},_0x5d909a={};_0x5d909a[_0x4ea4('0x3f')]=_[_0x4ea4('0x42')](db[_0x4ea4('0x3c')][_0x4ea4('0x57')]);_0x5d909a[_0x4ea4('0x41')]=_[_0x4ea4('0x42')](_0x2c2821['query']);_0x5d909a['filters']=_[_0x4ea4('0x44')](_0x5d909a[_0x4ea4('0x3f')],_0x5d909a[_0x4ea4('0x41')]);_0x1f0e64['attributes']=_['intersection'](_0x5d909a[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x2c2821['query']['fields']));_0x1f0e64['attributes']=_0x1f0e64[_0x4ea4('0x45')]['length']?_0x1f0e64['attributes']:_0x5d909a[_0x4ea4('0x3f')];if(_0x2c2821[_0x4ea4('0x41')]['includeAll']){_0x1f0e64[_0x4ea4('0x58')]=[{'all':!![]}];}_0x1f0e64=_[_0x4ea4('0x4e')]({},_0x1f0e64,_0x2c2821['options']);return db[_0x4ea4('0x3c')][_0x4ea4('0x59')](_0x1f0e64)[_0x4ea4('0x1e')](handleEntityNotFound(_0x5683b6,null))[_0x4ea4('0x1e')](respondWithResult(_0x5683b6,null))[_0x4ea4('0x54')](handleError(_0x5683b6,null));};exports[_0x4ea4('0x5a')]=function(_0x4c0127,_0x5eabdf){return db[_0x4ea4('0x3c')][_0x4ea4('0x5a')](_0x4c0127['body'],{})['then'](function(_0xe3a822){var _0x390726=_0x4c0127[_0x4ea4('0x5b')]['get']({'plain':!![]});if(!_0x390726)throw new Error(_0x4ea4('0x5c'));if(_0x390726['role']===_0x4ea4('0x5b')){var _0x1f8197=_0xe3a822[_0x4ea4('0x33')]({'plain':!![]});var _0x2dd505=_0x4ea4('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x2dd505,'userProfileId':_0x390726[_0x4ea4('0x5d')]},'raw':!![]})[_0x4ea4('0x1e')](function(_0x4d0bd5){if(_0x4d0bd5&&_0x4d0bd5[_0x4ea4('0x5e')]===0x0){return db['UserProfileResource'][_0x4ea4('0x5a')]({'name':_0x1f8197['name'],'resourceId':_0x1f8197['id'],'type':_0x4d0bd5[_0x4ea4('0x37')],'sectionId':_0x4d0bd5['id']},{})[_0x4ea4('0x1e')](function(){return _0xe3a822;});}else{return _0xe3a822;}})[_0x4ea4('0x54')](function(_0x5615a6){logger[_0x4ea4('0x22')](_0x4ea4('0x5f'),_0x5615a6);throw _0x5615a6;});}return _0xe3a822;})[_0x4ea4('0x1e')](respondWithResult(_0x5eabdf,0xc9))['catch'](handleError(_0x5eabdf,null));};exports['update']=function(_0xd42381,_0x2dad72){if(_0xd42381['body']['id']){delete _0xd42381['body']['id'];}return db[_0x4ea4('0x3c')]['find']({'where':{'id':_0xd42381[_0x4ea4('0x56')]['id']},'include':[{'model':db[_0x4ea4('0x3a')],'as':_0x4ea4('0x3b')}]})[_0x4ea4('0x1e')](handleEntityNotFound(_0x2dad72,null))[_0x4ea4('0x1e')](saveUpdates(_0xd42381['body'],null))['then'](respondWithResult(_0x2dad72,null))[_0x4ea4('0x54')](handleError(_0x2dad72,null));};exports[_0x4ea4('0x60')]=function(_0x5784b9,_0x3c9ac9){return db[_0x4ea4('0x3c')]['find']({'where':{'id':_0x5784b9[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x3c9ac9,null))[_0x4ea4('0x1e')](removeEntity(_0x3c9ac9,null))[_0x4ea4('0x54')](handleError(_0x3c9ac9,null));};exports[_0x4ea4('0x61')]=function(_0x46cc1b,_0x5d0a3e){return db[_0x4ea4('0x3c')][_0x4ea4('0x61')]()[_0x4ea4('0x1e')](respondWithResult(_0x5d0a3e,null))['catch'](handleError(_0x5d0a3e,null));};exports[_0x4ea4('0x62')]=function(_0x517a46,_0x306c0a,_0xa806e9){if(_0x517a46[_0x4ea4('0x63')]['id']){delete _0x517a46['body']['id'];}return db[_0x4ea4('0x3c')][_0x4ea4('0x59')]({'where':{'id':_0x517a46[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x306c0a,null))[_0x4ea4('0x1e')](function(_0x1420e9){if(_0x1420e9){_0x517a46['body']['FaxAccountId']=_0x1420e9['id'];return db[_0x4ea4('0x64')][_0x4ea4('0x5a')](_0x517a46[_0x4ea4('0x63')]);}})['then'](respondWithResult(_0x306c0a,null))[_0x4ea4('0x54')](handleError(_0x306c0a,null));};exports[_0x4ea4('0x65')]=function(_0x1cd1df,_0x3a0e55,_0xb01826){var _0x230454={'raw':![],'where':{}};var _0x429cfe={};var _0xc2ccbf={'count':0x0,'rows':[]};return db[_0x4ea4('0x3c')][_0x4ea4('0x66')]({'where':{'id':_0x1cd1df[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x3a0e55,null))[_0x4ea4('0x1e')](function(_0x1435b6){if(_0x1435b6){_0x429cfe[_0x4ea4('0x3f')]=_[_0x4ea4('0x42')](db[_0x4ea4('0x64')]['rawAttributes']);_0x429cfe[_0x4ea4('0x41')]=_[_0x4ea4('0x42')](_0x1cd1df['query']);_0x429cfe[_0x4ea4('0x43')]=_['intersection'](_0x429cfe[_0x4ea4('0x3f')],_0x429cfe[_0x4ea4('0x41')]);_0x230454[_0x4ea4('0x45')]=_['intersection'](_0x429cfe[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x1cd1df['query'][_0x4ea4('0x46')]));_0x230454[_0x4ea4('0x45')]=_0x230454[_0x4ea4('0x45')][_0x4ea4('0x47')]?_0x230454[_0x4ea4('0x45')]:_0x429cfe[_0x4ea4('0x3f')];if(!_0x1cd1df['query'][_0x4ea4('0x67')]('nolimit')){_0x230454[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x1cd1df['query']['limit']);_0x230454['offset']=qs[_0x4ea4('0x2b')](_0x1cd1df['query'][_0x4ea4('0x2b')]);}_0x230454[_0x4ea4('0x68')]=qs[_0x4ea4('0x4a')](_0x1cd1df['query'][_0x4ea4('0x4a')]);_0x230454['where']=qs[_0x4ea4('0x43')](_['pick'](_0x1cd1df[_0x4ea4('0x41')],_0x429cfe[_0x4ea4('0x43')]));_0x230454[_0x4ea4('0x4b')][_0x4ea4('0x69')]=_0x1435b6['id'];if(_0x1cd1df[_0x4ea4('0x41')]['filter']){_0x230454['where']=_['merge'](_0x230454[_0x4ea4('0x4b')],{'$or':_[_0x4ea4('0x40')](_0x230454['attributes'],function(_0x44e620){var _0x2482bd={};_0x2482bd[_0x44e620]={'$like':'%'+_0x1cd1df[_0x4ea4('0x41')]['filter']+'%'};return _0x2482bd;})});}_0x230454=_[_0x4ea4('0x4e')]({},_0x230454,_0x1cd1df[_0x4ea4('0x50')]);return db[_0x4ea4('0x64')][_0x4ea4('0x51')]({'where':_0x230454[_0x4ea4('0x4b')]})['then'](function(_0x3578e5){_0xc2ccbf[_0x4ea4('0x51')]=_0x3578e5;if(_0x1cd1df[_0x4ea4('0x41')][_0x4ea4('0x6a')]){_0x230454[_0x4ea4('0x58')]=[{'all':!![]}];}return db[_0x4ea4('0x64')][_0x4ea4('0x52')](_0x230454);})[_0x4ea4('0x1e')](function(_0x49f16c){_0xc2ccbf['rows']=_0x49f16c;return _0xc2ccbf;});}})[_0x4ea4('0x1e')](respondWithFilteredResult(_0x3a0e55,_0x230454))[_0x4ea4('0x54')](handleError(_0x3a0e55,null));};exports[_0x4ea4('0x6b')]=function(_0x49eee9,_0x451200,_0xc5e9e0){return db[_0x4ea4('0x3c')]['find']({'where':{'id':_0x49eee9[_0x4ea4('0x56')]['id']}})['then'](handleEntityNotFound(_0x451200,null))[_0x4ea4('0x1e')](function(_0xcd03a7){if(_0xcd03a7){return _0xcd03a7['removeDispositions'](_0x49eee9['query']['ids']);}})[_0x4ea4('0x1e')](respondWithStatusCode(_0x451200,null))[_0x4ea4('0x54')](handleError(_0x451200,null));};exports[_0x4ea4('0x6c')]=function(_0x3e3780,_0x3b6ac6,_0x258458){if(_0x3e3780[_0x4ea4('0x63')]['id']){delete _0x3e3780[_0x4ea4('0x63')]['id'];}return db[_0x4ea4('0x3c')]['find']({'where':{'id':_0x3e3780[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x3b6ac6,null))[_0x4ea4('0x1e')](function(_0x4bd168){if(_0x4bd168){_0x3e3780['body'][_0x4ea4('0x69')]=_0x4bd168['id'];return db[_0x4ea4('0x6d')]['create'](_0x3e3780['body']);}})['then'](respondWithResult(_0x3b6ac6,null))[_0x4ea4('0x54')](handleError(_0x3b6ac6,null));};exports[_0x4ea4('0x6e')]=function(_0x4c29f8,_0x46bec7,_0x3c38c3){var _0x5f1827={'raw':![],'where':{}};var _0x5f19ad={};var _0x31a70d={'count':0x0,'rows':[]};return db[_0x4ea4('0x3c')][_0x4ea4('0x66')]({'where':{'id':_0x4c29f8[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x46bec7,null))[_0x4ea4('0x1e')](function(_0x1e9b34){if(_0x1e9b34){_0x5f19ad[_0x4ea4('0x3f')]=_[_0x4ea4('0x42')](db[_0x4ea4('0x6d')]['rawAttributes']);_0x5f19ad[_0x4ea4('0x41')]=_[_0x4ea4('0x42')](_0x4c29f8[_0x4ea4('0x41')]);_0x5f19ad[_0x4ea4('0x43')]=_[_0x4ea4('0x44')](_0x5f19ad[_0x4ea4('0x3f')],_0x5f19ad[_0x4ea4('0x41')]);_0x5f1827['attributes']=_[_0x4ea4('0x44')](_0x5f19ad[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x4c29f8[_0x4ea4('0x41')][_0x4ea4('0x46')]));_0x5f1827[_0x4ea4('0x45')]=_0x5f1827[_0x4ea4('0x45')]['length']?_0x5f1827[_0x4ea4('0x45')]:_0x5f19ad[_0x4ea4('0x3f')];if(!_0x4c29f8[_0x4ea4('0x41')][_0x4ea4('0x67')](_0x4ea4('0x48'))){_0x5f1827[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x4c29f8[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x5f1827[_0x4ea4('0x2b')]=qs[_0x4ea4('0x2b')](_0x4c29f8[_0x4ea4('0x41')]['offset']);}_0x5f1827[_0x4ea4('0x68')]=qs['sort'](_0x4c29f8[_0x4ea4('0x41')][_0x4ea4('0x4a')]);_0x5f1827[_0x4ea4('0x4b')]=qs[_0x4ea4('0x43')](_['pick'](_0x4c29f8[_0x4ea4('0x41')],_0x5f19ad[_0x4ea4('0x43')]));_0x5f1827['where'][_0x4ea4('0x69')]=_0x1e9b34['id'];if(_0x4c29f8[_0x4ea4('0x41')]['filter']){_0x5f1827[_0x4ea4('0x4b')]=_[_0x4ea4('0x4e')](_0x5f1827[_0x4ea4('0x4b')],{'$or':_[_0x4ea4('0x40')](_0x5f1827[_0x4ea4('0x45')],function(_0x39c572){var _0x2b1099={};_0x2b1099[_0x39c572]={'$like':'%'+_0x4c29f8['query']['filter']+'%'};return _0x2b1099;})});}_0x5f1827=_[_0x4ea4('0x4e')]({},_0x5f1827,_0x4c29f8[_0x4ea4('0x50')]);return db['CannedAnswer'][_0x4ea4('0x51')]({'where':_0x5f1827[_0x4ea4('0x4b')]})[_0x4ea4('0x1e')](function(_0x59a487){_0x31a70d[_0x4ea4('0x51')]=_0x59a487;if(_0x4c29f8[_0x4ea4('0x41')][_0x4ea4('0x6a')]){_0x5f1827[_0x4ea4('0x58')]=[{'all':!![]}];}return db[_0x4ea4('0x6d')][_0x4ea4('0x52')](_0x5f1827);})[_0x4ea4('0x1e')](function(_0x328720){_0x31a70d[_0x4ea4('0x53')]=_0x328720;return _0x31a70d;});}})['then'](respondWithFilteredResult(_0x46bec7,_0x5f1827))['catch'](handleError(_0x46bec7,null));};exports[_0x4ea4('0x6f')]=function(_0x166206,_0x427813,_0x971e9c){return db['FaxAccount'][_0x4ea4('0x59')]({'where':{'id':_0x166206['params']['id']}})['then'](handleEntityNotFound(_0x427813,null))[_0x4ea4('0x1e')](function(_0x4ed340){if(_0x4ed340){return _0x4ed340[_0x4ea4('0x6f')](_0x166206['query'][_0x4ea4('0x70')]);}})[_0x4ea4('0x1e')](respondWithStatusCode(_0x427813,null))[_0x4ea4('0x54')](handleError(_0x427813,null));};exports['addInteraction']=function(_0x118b03,_0xc4450c,_0x2bffed){return db['FaxInteraction'][_0x4ea4('0x59')]({'where':{'id':_0x118b03[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0xc4450c,null))[_0x4ea4('0x1e')](function(_0x16d0c1){if(_0x16d0c1){return _0x16d0c1[_0x4ea4('0x71')](_0x118b03[_0x4ea4('0x63')][_0x4ea4('0x70')],_[_0x4ea4('0x72')](_0x118b03[_0x4ea4('0x63')],[_0x4ea4('0x70'),'id'])||{});}})[_0x4ea4('0x1e')](respondWithResult(_0xc4450c,null))[_0x4ea4('0x54')](handleError(_0xc4450c,null));};exports[_0x4ea4('0x73')]=function(_0x4e20e2,_0x2f8c77,_0xef0ae0){var _0x11748d={'raw':![],'where':{}};var _0x35167b={};var _0x539a93={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4e20e2[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x2f8c77,null))[_0x4ea4('0x1e')](function(_0x53e45b){if(_0x53e45b){_0x35167b['model']=_[_0x4ea4('0x42')](db[_0x4ea4('0x74')]['rawAttributes']);_0x35167b[_0x4ea4('0x41')]=_['keys'](_0x4e20e2[_0x4ea4('0x41')]);_0x35167b['filters']=_['intersection'](_0x35167b[_0x4ea4('0x3f')],_0x35167b[_0x4ea4('0x41')]);_0x11748d[_0x4ea4('0x45')]=_[_0x4ea4('0x44')](_0x35167b[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x4e20e2['query'][_0x4ea4('0x46')]));_0x11748d[_0x4ea4('0x45')]=_0x11748d[_0x4ea4('0x45')]['length']?_0x11748d['attributes']:_0x35167b[_0x4ea4('0x3f')];if(!_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x67')](_0x4ea4('0x48'))){_0x11748d[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x11748d['offset']=qs[_0x4ea4('0x2b')](_0x4e20e2['query']['offset']);}_0x11748d['order']=qs['sort'](_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x4a')]);_0x11748d[_0x4ea4('0x4b')]=qs[_0x4ea4('0x43')](_['pick'](_0x4e20e2['query'],_0x35167b['filters']));_0x11748d[_0x4ea4('0x4b')][_0x4ea4('0x69')]=_0x53e45b['id'];if(_0x4e20e2[_0x4ea4('0x41')]['filter']){_0x11748d[_0x4ea4('0x4b')]=_[_0x4ea4('0x4e')](_0x11748d[_0x4ea4('0x4b')],{'$or':_[_0x4ea4('0x40')](_0x11748d[_0x4ea4('0x45')],function(_0x2dae6d){var _0x359cbd={};_0x359cbd[_0x2dae6d]={'$like':'%'+_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x4d')]+'%'};return _0x359cbd;})});}_0x11748d=_[_0x4ea4('0x4e')]({},_0x11748d,_0x4e20e2[_0x4ea4('0x50')]);return db[_0x4ea4('0x74')][_0x4ea4('0x51')]({'where':_0x11748d[_0x4ea4('0x4b')]})[_0x4ea4('0x1e')](function(_0x3356d5){_0x539a93[_0x4ea4('0x51')]=_0x3356d5;if(_0x4e20e2['query']['includeAll']){_0x11748d[_0x4ea4('0x58')]=[{'model':db[_0x4ea4('0x75')],'as':_0x4ea4('0x76'),'required':![]},{'model':db[_0x4ea4('0x77')],'as':_0x4ea4('0x78'),'attributes':[_0x4ea4('0x37'),_0x4ea4('0x79'),_0x4ea4('0x7a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4ea4('0x37'),_0x4ea4('0x7b')],'where':_0x4e20e2['query'][_0x4ea4('0x7c')]?{'id':_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x7c')]}:undefined,'required':_0x4e20e2[_0x4ea4('0x41')][_0x4ea4('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x4ea4('0x52')](_0x11748d);})[_0x4ea4('0x1e')](function(_0x315d0f){_0x539a93['rows']=_0x315d0f;return _0x539a93;});}})[_0x4ea4('0x1e')](respondWithFilteredResult(_0x2f8c77,_0x11748d))[_0x4ea4('0x54')](handleError(_0x2f8c77,null));};exports[_0x4ea4('0x7d')]=function(_0x13f113,_0x2f6cb7){var _0x2a6084=_0x13f113['params']['id'];var _0x22dbeb=_0x13f113['body'];var _0x4f702e=0xc8;var _0x528949=null;return db[_0x4ea4('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x4ea4('0x7f')][_0x4ea4('0x80')][_0x4ea4('0x81')]},function(_0xbc8d0d){return db['FaxAccount']['findOne']({'where':{'id':_0x2a6084},'transaction':_0xbc8d0d})[_0x4ea4('0x1e')](function(_0xe61f41){if(_0xe61f41){return db[_0x4ea4('0x82')][_0x4ea4('0x60')]({'where':{'FaxAccountId':_0x2a6084},'transaction':_0xbc8d0d})[_0x4ea4('0x1e')](function(){var _0x54e102=_[_0x4ea4('0x40')](_0x22dbeb,function(_0x52566e){_0x52566e['FaxAccountId']=_0x2a6084;return _0x52566e;});return db[_0x4ea4('0x82')][_0x4ea4('0x83')](_0x54e102,{'transaction':_0xbc8d0d});});}else{_0x4f702e=0x194;_0x528949=[];}});})['then'](function(){if(_0x4f702e!==0x194){return db[_0x4ea4('0x82')][_0x4ea4('0x84')]({'where':{'FaxAccountId':_0x2a6084},'order':_0x4ea4('0x85')})[_0x4ea4('0x1e')](function(_0x4200ad){_0x528949=_0x4200ad;});}})[_0x4ea4('0x54')](function(_0x2261e9){_0x4f702e=0x1f4;logger[_0x4ea4('0x22')](_0x2261e9['stack']);if(_0x2261e9[_0x4ea4('0x37')]){delete _0x2261e9[_0x4ea4('0x37')];}_0x528949=_0x2261e9;})[_0x4ea4('0x86')](function(){if(_0x528949===null){_0x2f6cb7[_0x4ea4('0x27')](_0x4f702e);}else{if(_0x4f702e===0x1f4){_0x2f6cb7[_0x4ea4('0x28')](_0x4f702e)[_0x4ea4('0x38')](_0x528949);}else{_0x2f6cb7[_0x4ea4('0x28')](_0x4f702e)[_0x4ea4('0x2a')](_0x528949);}}});};exports['getApplications']=function(_0x2780a3,_0x16d855,_0x2162f2){var _0x2b7bbf={};var _0x4828ce={};var _0xa4e9d9;var _0x203f27;return db[_0x4ea4('0x3c')]['findOne']({'where':{'id':_0x2780a3['params']['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x16d855,null))[_0x4ea4('0x1e')](function(_0x3a47e6){if(_0x3a47e6){_0xa4e9d9=_0x3a47e6;_0x4828ce[_0x4ea4('0x3f')]=_[_0x4ea4('0x42')](db[_0x4ea4('0x82')]['rawAttributes']);_0x4828ce[_0x4ea4('0x41')]=_['keys'](_0x2780a3[_0x4ea4('0x41')]);_0x4828ce[_0x4ea4('0x43')]=_[_0x4ea4('0x44')](_0x4828ce[_0x4ea4('0x3f')],_0x4828ce[_0x4ea4('0x41')]);_0x2b7bbf[_0x4ea4('0x45')]=_[_0x4ea4('0x44')](_0x4828ce[_0x4ea4('0x3f')],qs['fields'](_0x2780a3['query'][_0x4ea4('0x46')]));_0x2b7bbf[_0x4ea4('0x45')]=_0x2b7bbf['attributes'][_0x4ea4('0x47')]?_0x2b7bbf['attributes']:_0x4828ce['model'];_0x2b7bbf[_0x4ea4('0x68')]=qs[_0x4ea4('0x4a')](_0x2780a3[_0x4ea4('0x41')]['sort']);_0x2b7bbf[_0x4ea4('0x4b')]=qs['filters'](_['pick'](_0x2780a3[_0x4ea4('0x41')],_0x4828ce[_0x4ea4('0x43')]));if(_0x2780a3['query'][_0x4ea4('0x4d')]){_0x2b7bbf['where']=_[_0x4ea4('0x4e')](_0x2b7bbf[_0x4ea4('0x4b')],{'$or':_[_0x4ea4('0x40')](_0x2b7bbf[_0x4ea4('0x45')],function(_0x446a09){var _0x25ae9f={};_0x25ae9f[_0x446a09]={'$like':'%'+_0x2780a3[_0x4ea4('0x41')][_0x4ea4('0x4d')]+'%'};return _0x25ae9f;})});}_0x2b7bbf=_['merge']({},_0x2b7bbf,_0x2780a3[_0x4ea4('0x50')]);return _0xa4e9d9[_0x4ea4('0x87')](_0x2b7bbf);}})[_0x4ea4('0x1e')](function(_0x224ced){if(_0x224ced){_0x203f27=_0x224ced[_0x4ea4('0x47')];if(!_0x2780a3[_0x4ea4('0x41')][_0x4ea4('0x67')]('nolimit')){_0x2b7bbf[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x2780a3[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x2b7bbf[_0x4ea4('0x2b')]=qs['offset'](_0x2780a3[_0x4ea4('0x41')][_0x4ea4('0x2b')]);}return _0xa4e9d9[_0x4ea4('0x87')](_0x2b7bbf);}})[_0x4ea4('0x1e')](function(_0x48df2a){if(_0x48df2a){return _0x48df2a?{'count':_0x203f27,'rows':_0x48df2a}:null;}})[_0x4ea4('0x1e')](respondWithResult(_0x16d855,null))[_0x4ea4('0x54')](handleError(_0x16d855,null));};function Extension(_0x1b6c88,_0x1aa878,_0x3d0bd7,_0x4c6614){this['context']='from-voip-provider';this['exten']=_0x1b6c88['localstationid'];this[_0x4ea4('0x88')]=_0x4c6614;this['type']=_0x4ea4('0x89');this[_0x4ea4('0x8a')]=_0x4ea4('0x8b');this[_0x4ea4('0x69')]=_0x1b6c88['id'];this['priority']=_0x1aa878;this[_0x4ea4('0x8c')]=_0x3d0bd7;}function createExtensionsReciveFax(_0x68a57f){var _0x301c44=0x1;var _0x509bc2=[];_0x509bc2['push'](new Extension(_0x68a57f,_0x301c44,'',_0x4ea4('0x8d')));_0x301c44+=0x1;_0x509bc2[_0x4ea4('0x8e')](new Extension(_0x68a57f,_0x301c44,_0x4ea4('0x8f'),_0x4ea4('0x90')));_0x301c44+=0x1;for(var _0x104d6e in _0x68a57f){if(_0x68a57f[_0x4ea4('0x67')](_0x104d6e)&&(_0x104d6e==='ecm'||_0x104d6e===_0x4ea4('0x91')||_0x104d6e===_0x4ea4('0x92')||_0x104d6e===_0x4ea4('0x93')||_0x104d6e===_0x4ea4('0x94')||_0x104d6e===_0x4ea4('0x95')||_0x104d6e===_0x4ea4('0x96')||_0x104d6e===_0x4ea4('0x97')||_0x104d6e==='t38timeout')){_0x509bc2[_0x4ea4('0x8e')](new Extension(_0x68a57f,_0x301c44,_0x4ea4('0x98')+_0x104d6e+')='+_0x68a57f[_0x104d6e],_0x4ea4('0x90')));_0x301c44+=0x1;}}_0x509bc2['push'](new Extension(_0x68a57f,_0x301c44,'6',_0x4ea4('0x99')));_0x301c44+=0x1;_0x509bc2[_0x4ea4('0x8e')](new Extension(_0x68a57f,_0x301c44,'/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'));_0x301c44=0x0;return _0x509bc2;}exports[_0x4ea4('0x9a')]=function(_0x95bef8,_0x3f9b57,_0x2bb971){var _0x1a715a;return db[_0x4ea4('0x7e')][_0x4ea4('0x9b')](function(_0x56b8fa){return db[_0x4ea4('0x3c')][_0x4ea4('0x5a')](_0x95bef8[_0x4ea4('0x63')],{'transaction':_0x56b8fa})[_0x4ea4('0x1e')](function(_0x411e14){_0x1a715a=_0x411e14['get']({'plain':!![]});return db[_0x4ea4('0x9c')][_0x4ea4('0x83')](createExtensionsReciveFax(_0x1a715a),{'transaction':_0x56b8fa});});})[_0x4ea4('0x1e')](function(){return _0x1a715a;})[_0x4ea4('0x1e')](respondWithResult(_0x3f9b57,null))['catch'](handleError(_0x3f9b57,null));};exports[_0x4ea4('0x9d')]=function(_0x4530d1,_0x47e0a8,_0x153093){var _0x3f082b;return db[_0x4ea4('0x7e')]['transaction'](function(_0x5632bb){return db['FaxAccount']['update'](_0x4530d1[_0x4ea4('0x63')],{'where':{'id':_0x4530d1[_0x4ea4('0x63')]['id']},'transaction':_0x5632bb})[_0x4ea4('0x1e')](function(_0x278dbf){return db[_0x4ea4('0x9c')][_0x4ea4('0x60')]({'where':{'FaxAccountId':_0x4530d1[_0x4ea4('0x63')]['id']},'transaction':_0x5632bb})[_0x4ea4('0x1e')](function(_0x1b6e34){return db[_0x4ea4('0x9c')][_0x4ea4('0x83')](createExtensionsReciveFax(_[_0x4ea4('0x72')](_0x4530d1[_0x4ea4('0x63')],[_0x4ea4('0x9e'),_0x4ea4('0x3e'),'createdAt',_0x4ea4('0x9f'),_0x4ea4('0xa0'),_0x4ea4('0xa1')])),{'transaction':_0x5632bb});});});})[_0x4ea4('0x1e')](function(){return db[_0x4ea4('0x3c')][_0x4ea4('0xa2')](_0x4530d1[_0x4ea4('0x63')]['id']);})['then'](respondWithResult(_0x47e0a8,null))[_0x4ea4('0x54')](handleError(_0x47e0a8,null));};exports[_0x4ea4('0xa3')]=function(_0x30124d,_0xbdecbc,_0x37aac1){var _0x28c089={'raw':!![],'where':{}};var _0x357dce={};var _0x3cef7e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4ea4('0x66')]({'where':{'id':_0x30124d[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0xbdecbc,null))[_0x4ea4('0x1e')](function(_0x31dd79){if(_0x31dd79){_0x357dce['model']=_[_0x4ea4('0x42')](db[_0x4ea4('0xa4')][_0x4ea4('0x57')]);_0x357dce[_0x4ea4('0x41')]=_[_0x4ea4('0x42')](_0x30124d[_0x4ea4('0x41')]);_0x357dce['filters']=_[_0x4ea4('0x44')](_0x357dce[_0x4ea4('0x3f')],_0x357dce[_0x4ea4('0x41')]);_0x28c089[_0x4ea4('0x45')]=_[_0x4ea4('0x44')](_0x357dce[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x46')]));_0x28c089[_0x4ea4('0x45')]=_0x28c089[_0x4ea4('0x45')][_0x4ea4('0x47')]?_0x28c089['attributes']:_0x357dce[_0x4ea4('0x3f')];if(!_0x30124d[_0x4ea4('0x41')]['hasOwnProperty'](_0x4ea4('0x48'))){_0x28c089[_0x4ea4('0x49')]=qs['limit'](_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x28c089[_0x4ea4('0x2b')]=qs['offset'](_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x2b')]);}_0x28c089[_0x4ea4('0x68')]=qs['sort'](_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x4a')]);_0x28c089[_0x4ea4('0x4b')]=qs[_0x4ea4('0x43')](_[_0x4ea4('0x4c')](_0x30124d[_0x4ea4('0x41')],_0x357dce['filters']));_0x28c089[_0x4ea4('0x4b')][_0x4ea4('0x69')]=_0x31dd79['id'];if(_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x4d')]){_0x28c089[_0x4ea4('0x4b')]=_[_0x4ea4('0x4e')](_0x28c089['where'],{'$or':_[_0x4ea4('0x40')](_0x28c089[_0x4ea4('0x45')],function(_0x3188dc){var _0x42a431={};_0x42a431[_0x3188dc]={'$like':'%'+_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x4d')]+'%'};return _0x42a431;})});}if(_0x30124d[_0x4ea4('0x41')][_0x4ea4('0xa5')]){var _0x1d39b1=_0x30124d[_0x4ea4('0x41')][_0x4ea4('0xa5')]['split'](',');var _0x113592={};_0x113592[_0x1d39b1[0x0]]={'$gte':moment(_0x1d39b1[0x1])[_0x4ea4('0xa6')](_0x4ea4('0xa7'))};_0x28c089['where']=_[_0x4ea4('0x4e')](_0x28c089['where'],_0x113592);}_0x28c089=_[_0x4ea4('0x4e')]({},_0x28c089,_0x30124d[_0x4ea4('0x50')]);return db[_0x4ea4('0xa4')][_0x4ea4('0x51')]({'where':_0x28c089['where']})['then'](function(_0x1f802f){_0x3cef7e[_0x4ea4('0x51')]=_0x1f802f;if(_0x30124d[_0x4ea4('0x41')][_0x4ea4('0x6a')]){_0x28c089[_0x4ea4('0x58')]=[{'all':!![]}];}return db[_0x4ea4('0xa4')]['findAll'](_0x28c089);})[_0x4ea4('0x1e')](function(_0x2fde29){_0x3cef7e[_0x4ea4('0x53')]=_0x2fde29;return _0x3cef7e;});}})[_0x4ea4('0x1e')](respondWithFilteredResult(_0xbdecbc,_0x28c089))[_0x4ea4('0x54')](handleError(_0xbdecbc,null));};exports['send']=function(_0x3895ff,_0x4430ac,_0x4122b5){var _0x3c301e,_0x493823={},_0x47fe84;if(_0x3895ff['body']['to']){_0x47fe84=_0x3895ff[_0x4ea4('0x63')]['to'][0x0];}return db[_0x4ea4('0x3c')][_0x4ea4('0x59')]({'where':{'id':_0x3895ff[_0x4ea4('0x56')]['id']},'include':[{'model':db[_0x4ea4('0xa8')],'as':_0x4ea4('0xa9'),'include':[{'model':db[_0x4ea4('0x75')],'as':_0x4ea4('0xaa'),'where':{'fax':_0x47fe84},'limit':0x1,'order':[['updatedAt',_0x4ea4('0xab')]]}]}]})[_0x4ea4('0x1e')](handleEntityNotFound(_0x4430ac,null))[_0x4ea4('0x1e')](function(_0x2ddc1e){_0x3c301e=_0x2ddc1e;if(_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')]&&_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][_0x4ea4('0x47')]){for(var _0x41540c=0x0;_0x41540c<_0x3895ff['body'][_0x4ea4('0xac')][_0x4ea4('0x47')];_0x41540c+=0x1){_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][_0x41540c]={'filename':_0x3895ff['body']['attachments'][_0x41540c][_0x4ea4('0x37')],'id':_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][_0x41540c]['id'],'path':path['join'](config['root'],_0x4ea4('0xad'),_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][_0x41540c]['basename'])};}}return respondWithRpcPromise(_0x4ea4('0xae'),_0x4ea4('0xae'),{'FaxAccountId':_[_0x4ea4('0xaf')](_0x3895ff[_0x4ea4('0x56')]['id'])?undefined:_0x3895ff[_0x4ea4('0x56')]['id'],'path':_[_0x4ea4('0xaf')](_0x3895ff['body'][_0x4ea4('0xac')][0x0][_0x4ea4('0xb0')])?undefined:_0x3895ff[_0x4ea4('0x63')]['attachments'][0x0][_0x4ea4('0xb0')],'fax':_['isNil'](_0x3895ff[_0x4ea4('0x63')]['to'][0x0])?undefined:_0x3895ff[_0x4ea4('0x63')]['to'][0x0]},client9002);})[_0x4ea4('0x1e')](function(){if(_0x3c301e){if(_[_0x4ea4('0xaf')](_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xb1')])){_0x3895ff[_0x4ea4('0x63')]['from']=util[_0x4ea4('0xa6')]('\x22%s\x22\x20<%s>',_0x3c301e[_0x4ea4('0x37')],_0x3c301e['fax']);}if(_0x3c301e[_0x4ea4('0xa9')]){if(_0x3c301e[_0x4ea4('0xa9')][_0x4ea4('0xaa')]['length']){return _0x3c301e['List']['Contacts'][0x0];}else{return db[_0x4ea4('0x75')][_0x4ea4('0x5a')](_[_0x4ea4('0xb2')](_0x3895ff['body'],{'firstName':_0x3895ff[_0x4ea4('0x63')]['to'][0x0],'phone':_0x3895ff[_0x4ea4('0x63')]['to'][0x0],'fax':_0x3895ff[_0x4ea4('0x63')]['to'][0x0],'ListId':_0x3c301e[_0x4ea4('0xa1')]}));}}else{throw new Error(_0x4ea4('0xb3'));}}else{throw new Error(_0x4ea4('0xb4'));}})[_0x4ea4('0x1e')](function(_0x59d78d){if(_0x59d78d){return db[_0x4ea4('0x74')][_0x4ea4('0x59')]({'where':{'ContactId':_0x59d78d['id'],'closed':![],'FaxAccountId':_0x3c301e['id']}})[_0x4ea4('0x1e')](function(_0x528596){if(_0x528596){return[_0x528596,![]];}return db[_0x4ea4('0x74')][_0x4ea4('0x5a')]({'UserId':_0x3895ff[_0x4ea4('0x5b')]['id'],'ContactId':_0x59d78d['id'],'FaxAccountId':_0x3c301e['id'],'fax':_0x3895ff['body']['to'][0x0],'firstMsgDirection':_0x4ea4('0xb5'),'Messages':[_[_0x4ea4('0x4e')](_0x3895ff[_0x4ea4('0x63')],{'read':![],'body':_0x3895ff[_0x4ea4('0x63')]['attachments'][0x0][_0x4ea4('0xb6')],'FaxAccountId':_0x3c301e['id'],'UserId':_0x3895ff[_0x4ea4('0x5b')]['id'],'ContactId':_0x59d78d['id'],'AttachmentId':_0x3895ff['body'][_0x4ea4('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x4ea4('0xa4')],'as':_0x4ea4('0xb7')}]})[_0x4ea4('0x1e')](function(_0x17d7bd){return[_0x17d7bd,!![]];});});}else{throw new Error(_0x4ea4('0xb8'));}})[_0x4ea4('0xb9')](function(_0x4660cd,_0x27efa9){if(_0x27efa9){return _0x4660cd;}return db[_0x4ea4('0xa4')]['create']({'direction':_0x4ea4('0xb5'),'read':![],'body':_0x3895ff[_0x4ea4('0x63')]['attachments'][0x0][_0x4ea4('0xb6')],'FaxAccountId':_0x3c301e['id'],'FaxInteractionId':_0x4660cd['id'],'UserId':_0x3895ff[_0x4ea4('0x5b')]['id'],'ContactId':_0x4660cd['ContactId'],'AttachmentId':_0x3895ff[_0x4ea4('0x63')]['attachments'][0x0]['id']})[_0x4ea4('0x1e')](function(_0x5832cb){_0x4660cd[_0x4ea4('0xba')][_0x4ea4('0xb7')]=[];_0x4660cd['dataValues'][_0x4ea4('0xb7')][_0x4ea4('0x8e')](_0x5832cb[_0x4ea4('0xba')]);return _0x4660cd;});})['then'](function(_0x53dc1e){respondWithRpcPromise(_0x4ea4('0xbb'),'SendFax',{'FaxAccountId':_[_0x4ea4('0xaf')](_0x3895ff[_0x4ea4('0x56')]['id'])?undefined:_0x3895ff[_0x4ea4('0x56')]['id'],'path':_['isNil'](_0x3895ff['body'][_0x4ea4('0xac')][0x0][_0x4ea4('0xb0')])?undefined:_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][0x0][_0x4ea4('0xb0')],'fax':_[_0x4ea4('0xaf')](_0x3895ff[_0x4ea4('0x63')]['to'][0x0])?undefined:_0x3895ff[_0x4ea4('0x63')]['to'][0x0],'AttachmentId':_0x3895ff[_0x4ea4('0x63')][_0x4ea4('0xac')][0x0]['id']},client9002)[_0x4ea4('0x1e')](function(_0xd5c12f){logger[_0x4ea4('0x25')]('SendFaxRpc,\x20%s',_0xd5c12f);})[_0x4ea4('0x54')](function(_0x5cc484){logger[_0x4ea4('0x25')]('SendFaxRpc,\x20%s',_0x5cc484);});return _0x53dc1e;})['then'](respondWithResult(_0x4430ac,null))['catch'](handleError(_0x4430ac,null));};exports['addAgents']=function(_0x21ec36,_0xdc72f9,_0x59ddc7){return db[_0x4ea4('0x3c')][_0x4ea4('0x59')]({'where':{'id':_0x21ec36[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0xdc72f9,null))[_0x4ea4('0x1e')](function(_0x556fb2){if(_0x556fb2){return _0x556fb2[_0x4ea4('0xbc')](_0x21ec36['body'][_0x4ea4('0x70')],_[_0x4ea4('0x72')](_0x21ec36[_0x4ea4('0x63')],[_0x4ea4('0x70'),'id'])||{})[_0x4ea4('0xb9')](function(_0x3d774f){for(var _0x484554=0x0;_0x484554<_0x21ec36[_0x4ea4('0x63')][_0x4ea4('0x70')]['length'];_0x484554+=0x1){socket[_0x4ea4('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x21ec36[_0x4ea4('0x63')]['ids'][_0x484554]),'FaxAccountId':Number(_0x21ec36[_0x4ea4('0x56')]['id'])});}return _0x3d774f;});}})['then'](respondWithResult(_0xdc72f9,null))[_0x4ea4('0x54')](handleError(_0xdc72f9,null));};exports['removeAgents']=function(_0x43b0a9,_0x55d9c9,_0x4b815b){return db['FaxAccount'][_0x4ea4('0x59')]({'where':{'id':_0x43b0a9[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x55d9c9,null))[_0x4ea4('0x1e')](function(_0x4c524c){if(_0x4c524c){return _0x4c524c[_0x4ea4('0xbe')](_0x43b0a9[_0x4ea4('0x41')]['ids'])['then'](function(){if(_[_0x4ea4('0xbf')](_0x43b0a9['query']['ids'])){for(var _0x44f651=0x0;_0x44f651<_0x43b0a9[_0x4ea4('0x41')][_0x4ea4('0x70')]['length'];_0x44f651+=0x1){socket[_0x4ea4('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x43b0a9['query'][_0x4ea4('0x70')][_0x44f651]),'FaxAccountId':Number(_0x43b0a9[_0x4ea4('0x56')]['id'])});}}else{socket[_0x4ea4('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x43b0a9[_0x4ea4('0x41')][_0x4ea4('0x70')]),'FaxAccountId':Number(_0x43b0a9[_0x4ea4('0x56')]['id'])});}});}})[_0x4ea4('0x1e')](respondWithStatusCode(_0x55d9c9,null))[_0x4ea4('0x54')](handleError(_0x55d9c9,null));};exports['getAgents']=function(_0x39d2ed,_0x3a9971,_0x1e8e32){var _0x3c74c0={};var _0x4bc389={};var _0x3557a5;var _0x39be1f;return db[_0x4ea4('0x3c')][_0x4ea4('0x66')]({'where':{'id':_0x39d2ed[_0x4ea4('0x56')]['id']}})[_0x4ea4('0x1e')](handleEntityNotFound(_0x3a9971,null))[_0x4ea4('0x1e')](function(_0x3e16f5){if(_0x3e16f5){_0x3557a5=_0x3e16f5;_0x4bc389['model']=_[_0x4ea4('0x42')](db[_0x4ea4('0x77')]['rawAttributes']);_0x4bc389['query']=_[_0x4ea4('0x42')](_0x39d2ed[_0x4ea4('0x41')]);_0x4bc389[_0x4ea4('0x43')]=_[_0x4ea4('0x44')](_0x4bc389[_0x4ea4('0x3f')],_0x4bc389['query']);_0x3c74c0[_0x4ea4('0x45')]=_[_0x4ea4('0x44')](_0x4bc389[_0x4ea4('0x3f')],qs[_0x4ea4('0x46')](_0x39d2ed[_0x4ea4('0x41')]['fields']));_0x3c74c0[_0x4ea4('0x45')]=_0x3c74c0[_0x4ea4('0x45')][_0x4ea4('0x47')]?_0x3c74c0[_0x4ea4('0x45')]:_0x4bc389['model'];_0x3c74c0[_0x4ea4('0x68')]=qs[_0x4ea4('0x4a')](_0x39d2ed[_0x4ea4('0x41')][_0x4ea4('0x4a')]);_0x3c74c0[_0x4ea4('0x4b')]=qs[_0x4ea4('0x43')](_[_0x4ea4('0x4c')](_0x39d2ed['query'],_0x4bc389[_0x4ea4('0x43')]));if(_0x39d2ed[_0x4ea4('0x41')][_0x4ea4('0x4d')]){_0x3c74c0[_0x4ea4('0x4b')]=_[_0x4ea4('0x4e')](_0x3c74c0[_0x4ea4('0x4b')],{'$or':_[_0x4ea4('0x40')](_0x3c74c0[_0x4ea4('0x45')],function(_0x3959dd){var _0x454f08={};_0x454f08[_0x3959dd]={'$like':'%'+_0x39d2ed['query']['filter']+'%'};return _0x454f08;})});}_0x3c74c0=_[_0x4ea4('0x4e')]({},_0x3c74c0,_0x39d2ed[_0x4ea4('0x50')]);return _0x3557a5['getAgents'](_0x3c74c0);}})[_0x4ea4('0x1e')](function(_0x444227){if(_0x444227){_0x39be1f=_0x444227[_0x4ea4('0x47')];if(!_0x39d2ed['query'][_0x4ea4('0x67')](_0x4ea4('0x48'))){_0x3c74c0[_0x4ea4('0x49')]=qs[_0x4ea4('0x49')](_0x39d2ed[_0x4ea4('0x41')][_0x4ea4('0x49')]);_0x3c74c0[_0x4ea4('0x2b')]=qs['offset'](_0x39d2ed[_0x4ea4('0x41')]['offset']);}return _0x3557a5[_0x4ea4('0xc0')](_0x3c74c0);}})[_0x4ea4('0x1e')](function(_0x277ee1){if(_0x277ee1){return _0x277ee1?{'count':_0x39be1f,'rows':_0x277ee1}:null;}})[_0x4ea4('0x1e')](respondWithResult(_0x3a9971,null))[_0x4ea4('0x54')](handleError(_0x3a9971,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2b4dde3..b58db03 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 _0xaf85=['emit','hasOwnProperty','events','../../mysqldb','FaxAccount','remove'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xaf85,0xb0));var _0x5af8=function(_0x44f630,_0xcdd7f8){_0x44f630=_0x44f630-0x0;var _0x3633ef=_0xaf85[_0x44f630];return _0x3633ef;};'use strict';var EventEmitter=require(_0x5af8('0x0'));var FaxAccount=require(_0x5af8('0x1'))['db'][_0x5af8('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5af8('0x3')};function emitEvent(_0x23e6db){return function(_0x25aebf,_0x334e87,_0x15c50f){FaxAccountEvents[_0x5af8('0x4')](_0x23e6db+':'+_0x25aebf['id'],_0x25aebf);FaxAccountEvents[_0x5af8('0x4')](_0x23e6db,_0x25aebf);_0x15c50f(null);};}for(var e in events){if(events[_0x5af8('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x9ad9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ad9,0xbc));var _0x99ad=function(_0x2a91f8,_0x449a8b){_0x2a91f8=_0x2a91f8-0x0;var _0x8e0541=_0x9ad9[_0x2a91f8];return _0x8e0541;};'use strict';var EventEmitter=require(_0x99ad('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x99ad('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x99ad('0x2')](0x0);var events={'afterCreate':_0x99ad('0x3'),'afterUpdate':_0x99ad('0x4'),'afterDestroy':_0x99ad('0x5')};function emitEvent(_0x5720e8){return function(_0x18bc80,_0x38d05d,_0x2b9dc0){FaxAccountEvents[_0x99ad('0x6')](_0x5720e8+':'+_0x18bc80['id'],_0x18bc80);FaxAccountEvents['emit'](_0x5720e8,_0x18bc80);_0x2b9dc0(null);};}for(var e in events){if(events[_0x99ad('0x7')](e)){var event=events[e];FaxAccount[_0x99ad('0x8')](e,emitEvent(event));}}module[_0x99ad('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index de61301..64c79fb 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 _0x6930=['fax_accounts','lodash','util','../../config/logger','api','./faxAccount.attributes','exports'];(function(_0x323303,_0x22c4fb){var _0x1bac97=function(_0x5baa41){while(--_0x5baa41){_0x323303['push'](_0x323303['shift']());}};_0x1bac97(++_0x22c4fb);}(_0x6930,0xf6));var _0x0693=function(_0x44438d,_0x54fcef){_0x44438d=_0x44438d-0x0;var _0x3b2f2f=_0x6930[_0x44438d];return _0x3b2f2f;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var logger=require(_0x0693('0x2'))(_0x0693('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0693('0x4'));module[_0x0693('0x5')]=function(_0x1e242b,_0x415ddf){return _0x1e242b['define']('FaxAccount',attributes,{'tableName':_0x0693('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb052=['fax_accounts','util','api','moment','request-promise','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xb052,0x141));var _0x2b05=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xb052[_0x4e4519];return _0x340044;};'use strict';var _=require('lodash');var util=require(_0x2b05('0x0'));var logger=require('../../config/logger')(_0x2b05('0x1'));var moment=require(_0x2b05('0x2'));var BPromise=require('bluebird');var rp=require(_0x2b05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b05('0x4'));var attributes=require(_0x2b05('0x5'));module[_0x2b05('0x6')]=function(_0x2f087d,_0x2f8bdd){return _0x2f087d[_0x2b05('0x7')](_0x2b05('0x8'),attributes,{'tableName':_0x2b05('0x9'),'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 704abea..d0fb031 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 _0xabab=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','FaxAccount','findAll','options','where','limit','include','map','attributes','model','GetFaxAccount','fax','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Contacts','FaxApplication','Applications','List','applications','list','orderBy','priority','asc','length','CmContact','create','contact','FaxInteraction','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created'];(function(_0x1398b1,_0x5e0318){var _0x3ee504=function(_0x163c9e){while(--_0x163c9e){_0x1398b1['push'](_0x1398b1['shift']());}};_0x3ee504(++_0x5e0318);}(_0xabab,0x124));var _0xbaba=function(_0x52bf5a,_0x47bb35){_0x52bf5a=_0x52bf5a-0x0;var _0xd5b6e8=_0xabab[_0x52bf5a];return _0xd5b6e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbaba('0x0'));var fs=require('fs');var Redis=require(_0xbaba('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaba('0x2'));var logger=require(_0xbaba('0x3'))(_0xbaba('0x4'));var config=require(_0xbaba('0x5'));var jayson=require(_0xbaba('0x6'));var client=jayson[_0xbaba('0x7')][_0xbaba('0x8')]({'port':0x232c});config[_0xbaba('0x9')]=_[_0xbaba('0xa')](config[_0xbaba('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbaba('0xb'))(new Redis(config[_0xbaba('0x9')]));require(_0xbaba('0xc'))[_0xbaba('0xd')](socket);function respondWithRpcPromise(_0xe4acf9,_0x3263c7,_0x194db5){return new BPromise(function(_0x548206,_0x2cd778){return client[_0xbaba('0xe')](_0xe4acf9,_0x194db5)[_0xbaba('0xf')](function(_0x3354d1){logger[_0xbaba('0x10')](_0xbaba('0x11'),_0x3263c7,'request\x20sent');logger[_0xbaba('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3263c7,_0xbaba('0x13'),JSON[_0xbaba('0x14')](_0x3354d1));if(_0x3354d1[_0xbaba('0x15')]){if(_0x3354d1[_0xbaba('0x15')][_0xbaba('0x16')]===0x1f4){logger[_0xbaba('0x15')](_0xbaba('0x11'),_0x3263c7,_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);return _0x2cd778(_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);}logger[_0xbaba('0x15')](_0xbaba('0x11'),_0x3263c7,_0x3354d1[_0xbaba('0x15')][_0xbaba('0x17')]);return _0x548206(_0x3354d1['error'][_0xbaba('0x17')]);}else{logger[_0xbaba('0x10')](_0xbaba('0x11'),_0x3263c7,_0xbaba('0x13'));_0x548206(_0x3354d1['result'][_0xbaba('0x17')]);}})[_0xbaba('0x18')](function(_0x3e7ccb){logger[_0xbaba('0x15')]('FaxAccount,\x20%s,\x20%s',_0x3263c7,_0x3e7ccb);_0x2cd778(_0x3e7ccb);});});}exports['GetFaxAccount']=function(_0x398149){var _0x214c5b=this;return new Promise(function(_0x26e50e,_0x28ac2e){return db[_0xbaba('0x19')][_0xbaba('0x1a')]({'raw':_0x398149[_0xbaba('0x1b')]?_0x398149['options']['raw']===undefined?!![]:![]:!![],'where':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1c')]||null:null,'attributes':_0x398149['options']?_0x398149['options']['attributes']||null:null,'limit':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1d')]||null:null,'include':_0x398149[_0xbaba('0x1b')]?_0x398149[_0xbaba('0x1b')][_0xbaba('0x1e')]?_[_0xbaba('0x1f')](_0x398149[_0xbaba('0x1b')][_0xbaba('0x1e')],function(_0xf1e157){return{'model':db[_0xf1e157['model']],'as':_0xf1e157['as'],'attributes':_0xf1e157[_0xbaba('0x20')],'include':_0xf1e157['include']?_[_0xbaba('0x1f')](_0xf1e157[_0xbaba('0x1e')],function(_0xcf40bd){return{'model':db[_0xcf40bd[_0xbaba('0x21')]],'as':_0xcf40bd['as'],'attributes':_0xcf40bd[_0xbaba('0x20')],'include':_0xcf40bd[_0xbaba('0x1e')]?_[_0xbaba('0x1f')](_0xcf40bd[_0xbaba('0x1e')],function(_0x45885e){return{'model':db[_0x45885e['model']],'as':_0x45885e['as'],'attributes':_0x45885e[_0xbaba('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbaba('0xf')](function(_0x525fc6){logger[_0xbaba('0x10')](_0xbaba('0x22'),_0x398149);logger['debug'](_0xbaba('0x22'),_0x398149,JSON[_0xbaba('0x14')](_0x525fc6));_0x26e50e(_0x525fc6);})[_0xbaba('0x18')](function(_0x432555){logger[_0xbaba('0x15')](_0xbaba('0x22'),_0x432555[_0xbaba('0x17')],_0x398149);_0x28ac2e(_0x214c5b['error'](0x1f4,_0x432555[_0xbaba('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x3ee15,_0x35ece2,_0x5a9764){var _0x2b3bf7=this;return new Promise(function(_0x552c84,_0x580c59){var _0x459002={'body':_0x3ee15['body'],'channel':_0xbaba('0x23')};var _0x1d39f2=[];var _0x1f3846=[];var _0x420523={};return db['CmContact'][_0xbaba('0x24')]()[_0xbaba('0xf')](function(_0x14c5e4){if(!_0x14c5e4){throw new db['Sequelize']['ValidationError'](_0xbaba('0x25'));}_0x1d39f2=_[_0xbaba('0x26')](_[_0xbaba('0x27')](_0x14c5e4),[_0xbaba('0x28'),_0xbaba('0x29')]);_0x1f3846=_['difference'](_['keys'](_0x14c5e4),[_0xbaba('0x28'),'updatedAt','CompanyId',_0xbaba('0x2a')]);if(_0x3ee15[_0xbaba('0x2b')]['id']){delete _0x3ee15[_0xbaba('0x2b')]['id'];}if(_[_0xbaba('0x2c')](_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')])){throw new db[(_0xbaba('0x2e'))][(_0xbaba('0x2f'))](_0xbaba('0x30'));}if(_[_0xbaba('0x2c')](_0x3ee15['body'][_0xbaba('0x2b')])||_0x3ee15[_0xbaba('0x2b')]['body']===''){throw new db[(_0xbaba('0x2e'))][(_0xbaba('0x2f'))](_0xbaba('0x31'));}if(_['isNil'](_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f3846);}if(!_['includes'](_0x1f3846,_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')])){throw new db[(_0xbaba('0x2e'))]['ValidationError'](_0xbaba('0x33')+_0x1f3846);}_0x420523[_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')]]=_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')];})[_0xbaba('0xf')](function(){return db[_0xbaba('0x19')][_0xbaba('0x34')]({'where':{'id':_0x3ee15[_0xbaba('0x35')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xbaba('0x36'),'where':_0x420523,'limit':0x1,'order':[[_0xbaba('0x29'),'DESC']]}]},{'model':db[_0xbaba('0x37')],'as':_0xbaba('0x38')}]});})[_0xbaba('0xf')](function(_0x2ccfa8){if(_0x2ccfa8&&_0x2ccfa8[_0xbaba('0x39')]){var _0x31abb6=_0x2ccfa8['get']({'plain':!![]});_0x459002['account']=_0x31abb6;_0x459002[_0xbaba('0x3a')]=_0x31abb6['Applications'];_0x459002[_0xbaba('0x3b')]=_0x31abb6[_0xbaba('0x39')];_0x459002[_0xbaba('0x3a')]=_[_0xbaba('0x3c')](_0x459002[_0xbaba('0x3a')],[_0xbaba('0x3d')],[_0xbaba('0x3e')]);if(_0x459002['account'][_0xbaba('0x38')]){delete _0x459002[_0xbaba('0x35')][_0xbaba('0x38')];}if(_0x459002[_0xbaba('0x35')]['List']&&_0x459002['account']['List'][_0xbaba('0x36')][_0xbaba('0x3f')]){return _0x459002[_0xbaba('0x35')][_0xbaba('0x39')]['Contacts'][0x0];}var _0x579b3a=_[_0xbaba('0xa')](_0x3ee15[_0xbaba('0x2b')],{'firstName':_0x3ee15[_0xbaba('0x2b')]['from'],'ListId':_0x31abb6['ListId']});_0x579b3a[_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x32')]]=_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x2d')];return db[_0xbaba('0x40')][_0xbaba('0x41')](_0x579b3a,{'fields':_0x1d39f2,'raw':!![]});}})[_0xbaba('0xf')](function(_0x27df22){_0x459002[_0xbaba('0x42')]=_0x27df22;if(_0x27df22){var _0x14c351={'ContactId':_0x27df22['id'],'FaxAccountId':_0x3ee15['account']['id'],'fax':_0x27df22[_0xbaba('0x23')]};return db[_0xbaba('0x43')][_0xbaba('0x34')]({'where':{'ContactId':_0x27df22['id'],'closed':![],'FaxAccountId':_0x3ee15[_0xbaba('0x35')]['id']}})[_0xbaba('0xf')](function(_0x1beab5){if(_0x1beab5){return[_0x1beab5,![]];}return db[_0xbaba('0x43')][_0xbaba('0x41')](_0x14c351)[_0xbaba('0xf')](function(_0x45a921){return[_0x45a921,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbaba('0x44')](function(_0x4d6e0b,_0x30363a){var _0x7860d5=_0x4d6e0b[_0xbaba('0x45')]({'plain':!![]});if(_0x30363a){if(_0x459002['account'][_0xbaba('0x46')]){_0x459002[_0xbaba('0x3a')][_0xbaba('0x47')]({'id':0x0,'priority':_0x459002[_0xbaba('0x3a')][_0xbaba('0x3f')]+0x1,'app':_0xbaba('0x48'),'appdata':_0xbaba('0x49'),'interval':_0xbaba('0x4a')});}_0x7860d5[_0xbaba('0x4b')]=!![];}else{_0x7860d5[_0xbaba('0x4b')]=![];}_0x459002[_0xbaba('0x4c')]=_0x7860d5;return db[_0xbaba('0x4d')][_0xbaba('0x41')]({'body':_0x3ee15['body'][_0xbaba('0x2b')],'FaxAccountId':_0x3ee15[_0xbaba('0x35')]['id'],'FaxInteractionId':_0x4d6e0b['id'],'direction':'in','ContactId':_0x4d6e0b[_0xbaba('0x4e')],'AttachmentId':_0x3ee15[_0xbaba('0x2b')][_0xbaba('0x4f')]});})['then'](function(_0x2c7aa8){_0x459002[_0xbaba('0x17')]=_0x2c7aa8;if(!_0x459002[_0xbaba('0x4c')][_0xbaba('0x50')])return;return db[_0xbaba('0x51')][_0xbaba('0x34')]({'attributes':['id',_0xbaba('0x52')],'where':{'id':_0x459002[_0xbaba('0x4c')][_0xbaba('0x50')]}});})[_0xbaba('0xf')](function(_0x4e0702){if(_0x4e0702){_0x459002[_0xbaba('0x3a')][_0xbaba('0x53')]({'id':0x0,'priority':0x0,'app':_0xbaba('0x54'),'appdata':_0x4e0702['name']+','+(_0x459002['account'][_0xbaba('0x55')]||0xa),'interval':'*,*,*,*'});}if(!_0x459002[_0xbaba('0x4c')][_0xbaba('0x56')])return;return db[_0xbaba('0x57')]['find']({'attributes':['id',_0xbaba('0x52')],'where':{'id':_0x459002[_0xbaba('0x4c')]['queueId']}});})[_0xbaba('0xf')](function(_0x4900d0){if(_0x4900d0){_0x459002['applications'][_0xbaba('0x53')]({'id':0x0,'priority':0x1,'app':_0xbaba('0x58'),'appdata':_0x4900d0[_0xbaba('0x52')]+','+(_0x459002['account'][_0xbaba('0x59')]||0x12c),'interval':_0xbaba('0x4a')});}return respondWithRpcPromise(_0xbaba('0x5a'),_0xbaba('0x5b'),_0x459002);})['then'](function(_0x2bc5b3){_0x552c84(_0x2bc5b3);})[_0xbaba('0x18')](function(_0x38992e){_0x580c59(_0x2b3bf7[_0xbaba('0x15')](0x1f4,_0x38992e[_0xbaba('0x17')]));});});}; \ No newline at end of file +var _0xfa77=['FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','priority','asc','Contacts','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','User','name','UserId','unshift','agent','FaxQueue','queueId','queue','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17dcaa,_0x256b30){var _0x2127ab=function(_0x4f1666){while(--_0x4f1666){_0x17dcaa['push'](_0x17dcaa['shift']());}};_0x2127ab(++_0x256b30);}(_0xfa77,0xa7));var _0x7fa7=function(_0x195971,_0x1bdd4e){_0x195971=_0x195971-0x0;var _0x455de2=_0xfa77[_0x195971];return _0x455de2;};'use strict';var _=require(_0x7fa7('0x0'));var util=require(_0x7fa7('0x1'));var moment=require('moment');var BPromise=require(_0x7fa7('0x2'));var rs=require(_0x7fa7('0x3'));var fs=require('fs');var Redis=require(_0x7fa7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7fa7('0x5'))(_0x7fa7('0x6'));var config=require(_0x7fa7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7fa7('0x8')][_0x7fa7('0x9')]({'port':0x232c});config[_0x7fa7('0xa')]=_['defaults'](config[_0x7fa7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fa7('0xb'))(new Redis(config[_0x7fa7('0xa')]));require(_0x7fa7('0xc'))['register'](socket);function respondWithRpcPromise(_0x5149de,_0x33c752,_0x5f4f65){return new BPromise(function(_0x256d91,_0x25f9fa){return client[_0x7fa7('0xd')](_0x5149de,_0x5f4f65)[_0x7fa7('0xe')](function(_0x15ec6f){logger[_0x7fa7('0xf')](_0x7fa7('0x10'),_0x33c752,_0x7fa7('0x11'));logger[_0x7fa7('0x12')](_0x7fa7('0x13'),_0x33c752,'request\x20sent',JSON[_0x7fa7('0x14')](_0x15ec6f));if(_0x15ec6f[_0x7fa7('0x15')]){if(_0x15ec6f[_0x7fa7('0x15')]['code']===0x1f4){logger['error'](_0x7fa7('0x10'),_0x33c752,_0x15ec6f[_0x7fa7('0x15')][_0x7fa7('0x16')]);return _0x25f9fa(_0x15ec6f[_0x7fa7('0x15')][_0x7fa7('0x16')]);}logger[_0x7fa7('0x15')](_0x7fa7('0x10'),_0x33c752,_0x15ec6f[_0x7fa7('0x15')][_0x7fa7('0x16')]);return _0x256d91(_0x15ec6f[_0x7fa7('0x15')][_0x7fa7('0x16')]);}else{logger[_0x7fa7('0xf')](_0x7fa7('0x10'),_0x33c752,_0x7fa7('0x11'));_0x256d91(_0x15ec6f[_0x7fa7('0x17')][_0x7fa7('0x16')]);}})[_0x7fa7('0x18')](function(_0x145671){logger[_0x7fa7('0x15')]('FaxAccount,\x20%s,\x20%s',_0x33c752,_0x145671);_0x25f9fa(_0x145671);});});}exports[_0x7fa7('0x19')]=function(_0x1d8b57){var _0x43d153=this;return new Promise(function(_0x1e9f60,_0x34d3d2){return db['FaxAccount']['findAll']({'raw':_0x1d8b57[_0x7fa7('0x1a')]?_0x1d8b57[_0x7fa7('0x1a')][_0x7fa7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d8b57['options']?_0x1d8b57['options']['where']||null:null,'attributes':_0x1d8b57[_0x7fa7('0x1a')]?_0x1d8b57[_0x7fa7('0x1a')][_0x7fa7('0x1c')]||null:null,'limit':_0x1d8b57['options']?_0x1d8b57[_0x7fa7('0x1a')][_0x7fa7('0x1d')]||null:null,'include':_0x1d8b57[_0x7fa7('0x1a')]?_0x1d8b57[_0x7fa7('0x1a')][_0x7fa7('0x1e')]?_[_0x7fa7('0x1f')](_0x1d8b57[_0x7fa7('0x1a')][_0x7fa7('0x1e')],function(_0x1aa253){return{'model':db[_0x1aa253['model']],'as':_0x1aa253['as'],'attributes':_0x1aa253[_0x7fa7('0x1c')],'include':_0x1aa253[_0x7fa7('0x1e')]?_[_0x7fa7('0x1f')](_0x1aa253[_0x7fa7('0x1e')],function(_0x4af595){return{'model':db[_0x4af595[_0x7fa7('0x20')]],'as':_0x4af595['as'],'attributes':_0x4af595[_0x7fa7('0x1c')],'include':_0x4af595[_0x7fa7('0x1e')]?_[_0x7fa7('0x1f')](_0x4af595['include'],function(_0x21ce2d){return{'model':db[_0x21ce2d[_0x7fa7('0x20')]],'as':_0x21ce2d['as'],'attributes':_0x21ce2d[_0x7fa7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7fa7('0xe')](function(_0x18a118){logger[_0x7fa7('0xf')]('GetFaxAccount',_0x1d8b57);logger[_0x7fa7('0x12')](_0x7fa7('0x19'),_0x1d8b57,JSON[_0x7fa7('0x14')](_0x18a118));_0x1e9f60(_0x18a118);})[_0x7fa7('0x18')](function(_0x3c85ec){logger[_0x7fa7('0x15')](_0x7fa7('0x19'),_0x3c85ec['message'],_0x1d8b57);_0x34d3d2(_0x43d153[_0x7fa7('0x15')](0x1f4,_0x3c85ec['message']));});});};exports[_0x7fa7('0x21')]=function(_0x5edb34,_0x20d1c4,_0x4d405d){var _0x90c423=this;return new Promise(function(_0x1650ba,_0x40484b){var _0x2ce459={'body':_0x5edb34[_0x7fa7('0x22')],'channel':'fax'};var _0x40cbea=[];var _0x2b9d97=[];var _0x434ee6={};return db[_0x7fa7('0x23')]['describe']()[_0x7fa7('0xe')](function(_0x4b3a70){if(!_0x4b3a70){throw new db['Sequelize'][(_0x7fa7('0x24'))](_0x7fa7('0x25'));}_0x40cbea=_['difference'](_[_0x7fa7('0x26')](_0x4b3a70),[_0x7fa7('0x27'),'updatedAt']);_0x2b9d97=_[_0x7fa7('0x28')](_[_0x7fa7('0x26')](_0x4b3a70),[_0x7fa7('0x27'),_0x7fa7('0x29'),_0x7fa7('0x2a'),_0x7fa7('0x2b')]);if(_0x5edb34[_0x7fa7('0x22')]['id']){delete _0x5edb34['body']['id'];}if(_['isNil'](_0x5edb34['body'][_0x7fa7('0x2c')])){throw new db['Sequelize'][(_0x7fa7('0x24'))](_0x7fa7('0x2d'));}if(_['isNil'](_0x5edb34['body'][_0x7fa7('0x22')])||_0x5edb34['body']['body']===''){throw new db[(_0x7fa7('0x2e'))][(_0x7fa7('0x24'))](_0x7fa7('0x2f'));}if(_[_0x7fa7('0x30')](_0x5edb34['body'][_0x7fa7('0x31')])){throw new db['Sequelize'][(_0x7fa7('0x24'))](_0x7fa7('0x32')+_0x2b9d97);}if(!_[_0x7fa7('0x33')](_0x2b9d97,_0x5edb34[_0x7fa7('0x22')]['mapKey'])){throw new db[(_0x7fa7('0x2e'))][(_0x7fa7('0x24'))](_0x7fa7('0x34')+_0x2b9d97);}_0x434ee6[_0x5edb34[_0x7fa7('0x22')][_0x7fa7('0x31')]]=_0x5edb34[_0x7fa7('0x22')][_0x7fa7('0x2c')];})[_0x7fa7('0xe')](function(){return db[_0x7fa7('0x35')][_0x7fa7('0x36')]({'where':{'id':_0x5edb34[_0x7fa7('0x37')]['id']},'include':[{'model':db[_0x7fa7('0x38')],'as':_0x7fa7('0x39'),'include':[{'model':db[_0x7fa7('0x23')],'as':'Contacts','where':_0x434ee6,'limit':0x1,'order':[[_0x7fa7('0x29'),_0x7fa7('0x3a')]]}]},{'model':db[_0x7fa7('0x3b')],'as':_0x7fa7('0x3c')}]});})[_0x7fa7('0xe')](function(_0x3d1ac2){if(_0x3d1ac2&&_0x3d1ac2[_0x7fa7('0x39')]){var _0x443124=_0x3d1ac2[_0x7fa7('0x3d')]({'plain':!![]});_0x2ce459['account']=_0x443124;_0x2ce459[_0x7fa7('0x3e')]=_0x443124[_0x7fa7('0x3c')];_0x2ce459['list']=_0x443124[_0x7fa7('0x39')];_0x2ce459[_0x7fa7('0x3e')]=_['orderBy'](_0x2ce459[_0x7fa7('0x3e')],[_0x7fa7('0x3f')],[_0x7fa7('0x40')]);if(_0x2ce459[_0x7fa7('0x37')][_0x7fa7('0x3c')]){delete _0x2ce459[_0x7fa7('0x37')][_0x7fa7('0x3c')];}if(_0x2ce459[_0x7fa7('0x37')][_0x7fa7('0x39')]&&_0x2ce459[_0x7fa7('0x37')][_0x7fa7('0x39')][_0x7fa7('0x41')][_0x7fa7('0x42')]){return _0x2ce459[_0x7fa7('0x37')][_0x7fa7('0x39')][_0x7fa7('0x41')][0x0];}var _0x44264f=_[_0x7fa7('0x43')](_0x5edb34[_0x7fa7('0x22')],{'firstName':_0x5edb34[_0x7fa7('0x22')][_0x7fa7('0x2c')],'ListId':_0x443124[_0x7fa7('0x2b')]});_0x44264f[_0x5edb34[_0x7fa7('0x22')][_0x7fa7('0x31')]]=_0x5edb34[_0x7fa7('0x22')]['from'];return db[_0x7fa7('0x23')][_0x7fa7('0x44')](_0x44264f,{'fields':_0x40cbea,'raw':!![]});}})[_0x7fa7('0xe')](function(_0x43a175){_0x2ce459[_0x7fa7('0x45')]=_0x43a175;if(_0x43a175){var _0x4f3be4={'ContactId':_0x43a175['id'],'FaxAccountId':_0x5edb34[_0x7fa7('0x37')]['id'],'fax':_0x43a175['fax']};return db[_0x7fa7('0x46')]['find']({'where':{'ContactId':_0x43a175['id'],'closed':![],'FaxAccountId':_0x5edb34['account']['id']}})[_0x7fa7('0xe')](function(_0x5490db){if(_0x5490db){return[_0x5490db,![]];}return db['FaxInteraction'][_0x7fa7('0x44')](_0x4f3be4)[_0x7fa7('0xe')](function(_0x3db010){return[_0x3db010,!![]];});});}else{throw new Error(_0x7fa7('0x47'));}})[_0x7fa7('0x48')](function(_0x15e0eb,_0x2b87f1){var _0x22916a=_0x15e0eb[_0x7fa7('0x3d')]({'plain':!![]});if(_0x2b87f1){if(_0x2ce459['account'][_0x7fa7('0x49')]){_0x2ce459[_0x7fa7('0x3e')][_0x7fa7('0x4a')]({'id':0x0,'priority':_0x2ce459[_0x7fa7('0x3e')]['length']+0x1,'app':_0x7fa7('0x4b'),'appdata':_0x7fa7('0x4c'),'interval':_0x7fa7('0x4d')});}_0x22916a[_0x7fa7('0x4e')]=!![];}else{_0x22916a[_0x7fa7('0x4e')]=![];}_0x2ce459['interaction']=_0x22916a;return db[_0x7fa7('0x4f')][_0x7fa7('0x44')]({'body':_0x5edb34['body']['body'],'FaxAccountId':_0x5edb34['account']['id'],'FaxInteractionId':_0x15e0eb['id'],'direction':'in','ContactId':_0x15e0eb[_0x7fa7('0x50')],'AttachmentId':_0x5edb34['body'][_0x7fa7('0x51')]});})[_0x7fa7('0xe')](function(_0x3c59af){_0x2ce459[_0x7fa7('0x16')]=_0x3c59af;if(!_0x2ce459[_0x7fa7('0x52')]['UserId'])return;return db[_0x7fa7('0x53')][_0x7fa7('0x36')]({'attributes':['id',_0x7fa7('0x54')],'where':{'id':_0x2ce459[_0x7fa7('0x52')][_0x7fa7('0x55')]}});})[_0x7fa7('0xe')](function(_0x7faa2a){if(_0x7faa2a){_0x2ce459['applications'][_0x7fa7('0x56')]({'id':0x0,'priority':0x0,'app':_0x7fa7('0x57'),'appdata':_0x7faa2a[_0x7fa7('0x54')]+','+(_0x2ce459[_0x7fa7('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x7fa7('0x4d')});}if(!_0x2ce459[_0x7fa7('0x52')]['queueId'])return;return db[_0x7fa7('0x58')][_0x7fa7('0x36')]({'attributes':['id',_0x7fa7('0x54')],'where':{'id':_0x2ce459[_0x7fa7('0x52')][_0x7fa7('0x59')]}});})[_0x7fa7('0xe')](function(_0x58d776){if(_0x58d776){_0x2ce459[_0x7fa7('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x7fa7('0x5a'),'appdata':_0x58d776[_0x7fa7('0x54')]+','+(_0x2ce459[_0x7fa7('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':_0x7fa7('0x4d')});}return respondWithRpcPromise(_0x7fa7('0x5b'),_0x7fa7('0x5c'),_0x2ce459);})['then'](function(_0x332e94){_0x1650ba(_0x332e94);})[_0x7fa7('0x18')](function(_0x2a4347){_0x40484b(_0x90c423[_0x7fa7('0x15')](0x1f4,_0x2a4347[_0x7fa7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f165666..dd9daa7 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 _0x0231=['./faxAccount.events','save','remove','update','removeListener','register','length','faxAccount:'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x0231,0x130));var _0x1023=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x0231[_0x49ca18];return _0x145d54;};'use strict';var FaxAccountEvents=require(_0x1023('0x0'));var events=[_0x1023('0x1'),_0x1023('0x2'),_0x1023('0x3')];function createListener(_0x2ec591,_0x3db879){return function(_0x184a3d){_0x3db879['emit'](_0x2ec591,_0x184a3d);};}function removeListener(_0x3ec16f,_0x46c749){return function(){FaxAccountEvents[_0x1023('0x4')](_0x3ec16f,_0x46c749);};}exports[_0x1023('0x5')]=function(_0x491f7f){for(var _0x1bd3bc=0x0,_0x8e6689=events[_0x1023('0x6')];_0x1bd3bc<_0x8e6689;_0x1bd3bc++){var _0x47eae7=events[_0x1bd3bc];var _0x4f1f77=createListener(_0x1023('0x7')+_0x47eae7,_0x491f7f);FaxAccountEvents['on'](_0x47eae7,_0x4f1f77);}}; \ No newline at end of file +var _0x5af9=['register','length','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5af9,0x162));var _0x95af=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x5af9[_0x187399];return _0x40fa92;};'use strict';var FaxAccountEvents=require(_0x95af('0x0'));var events=[_0x95af('0x1'),_0x95af('0x2'),_0x95af('0x3')];function createListener(_0x553cee,_0x3ce36b){return function(_0x470765){_0x3ce36b[_0x95af('0x4')](_0x553cee,_0x470765);};}function removeListener(_0x38761e,_0x4c1489){return function(){FaxAccountEvents[_0x95af('0x5')](_0x38761e,_0x4c1489);};}exports[_0x95af('0x6')]=function(_0x21bc21){for(var _0xf1d8cb=0x0,_0x56194f=events[_0x95af('0x7')];_0xf1d8cb<_0x56194f;_0xf1d8cb++){var _0x291824=events[_0xf1d8cb];var _0x2a5b2f=createListener('faxAccount:'+_0x291824,_0x21bc21);FaxAccountEvents['on'](_0x291824,_0x2a5b2f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d6ed70f..d08d229 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 _0x1257=['getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x1b9db4,_0x3294c5){var _0x263b4f=function(_0x33d958){while(--_0x33d958){_0x1b9db4['push'](_0x1b9db4['shift']());}};_0x263b4f(++_0x3294c5);}(_0x1257,0xb9));var _0x7125=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1257[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x7125('0x0'));var util=require(_0x7125('0x1'));var path=require(_0x7125('0x2'));var timeout=require(_0x7125('0x3'));var express=require('express');var router=express[_0x7125('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7125('0x5'));var config=require('../../config/environment');var controller=require(_0x7125('0x6'));router[_0x7125('0x7')]('/',auth[_0x7125('0x8')](),controller[_0x7125('0x9')]);router[_0x7125('0x7')](_0x7125('0xa'),auth['isAuthenticated'](),controller[_0x7125('0xb')]);router[_0x7125('0x7')](_0x7125('0xc'),auth['isAuthenticated'](),controller[_0x7125('0xd')]);router[_0x7125('0x7')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0xf')]);router[_0x7125('0x7')](_0x7125('0x10'),auth[_0x7125('0x8')](),controller[_0x7125('0x11')]);router[_0x7125('0x7')]('/:id/interactions',auth[_0x7125('0x8')](),controller[_0x7125('0x12')]);router[_0x7125('0x7')](_0x7125('0x13'),auth[_0x7125('0x8')](),controller[_0x7125('0x14')]);router[_0x7125('0x7')](_0x7125('0x15'),auth[_0x7125('0x8')](),controller['getMessages']);router['get'](_0x7125('0x16'),auth['isAuthenticated'](),controller[_0x7125('0x17')]);router[_0x7125('0x18')]('/',auth[_0x7125('0x8')](),controller[_0x7125('0x19')]);router[_0x7125('0x18')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0x1a')]);router[_0x7125('0x18')](_0x7125('0x10'),auth['isAuthenticated'](),controller[_0x7125('0x1b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7125('0x1c')]);router[_0x7125('0x18')]('/:id/applications',auth[_0x7125('0x8')](),controller[_0x7125('0x1d')]);router[_0x7125('0x18')]('/addaccountapplications',auth[_0x7125('0x8')](),controller[_0x7125('0x1e')]);router[_0x7125('0x18')](_0x7125('0x1f'),auth[_0x7125('0x8')](),controller['updateAccountApplications']);router[_0x7125('0x18')](_0x7125('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0x7125('0x16'),auth[_0x7125('0x8')](),controller[_0x7125('0x21')]);router[_0x7125('0x22')](_0x7125('0xc'),auth[_0x7125('0x8')](),controller[_0x7125('0x23')]);router['delete']('/:id',auth[_0x7125('0x8')](),controller['destroy']);router[_0x7125('0x24')](_0x7125('0xe'),auth[_0x7125('0x8')](),controller[_0x7125('0x25')]);router['delete'](_0x7125('0x10'),auth[_0x7125('0x8')](),controller[_0x7125('0x26')]);router[_0x7125('0x24')]('/:id/users',auth[_0x7125('0x8')](),controller[_0x7125('0x27')]);module['exports']=router; \ No newline at end of file +var _0xa5c1=['getApplications','getMessages','create','addDisposition','post','addAnswer','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','addAgents','update','delete','destroy','removeAnswers','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications'];(function(_0x5d61d2,_0x242b7a){var _0x16f58c=function(_0x41033b){while(--_0x41033b){_0x5d61d2['push'](_0x5d61d2['shift']());}};_0x16f58c(++_0x242b7a);}(_0xa5c1,0x1e6));var _0x1a5c=function(_0xb87ec6,_0x2cb994){_0xb87ec6=_0xb87ec6-0x0;var _0x1a53e0=_0xa5c1[_0xb87ec6];return _0x1a53e0;};'use strict';var multer=require(_0x1a5c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a5c('0x1'));var router=express[_0x1a5c('0x2')]();var fs_extra=require(_0x1a5c('0x3'));var auth=require(_0x1a5c('0x4'));var interaction=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var controller=require(_0x1a5c('0x7'));router[_0x1a5c('0x8')]('/',auth[_0x1a5c('0x9')](),controller[_0x1a5c('0xa')]);router[_0x1a5c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1a5c('0xb')]);router['get'](_0x1a5c('0xc'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0xd')]);router[_0x1a5c('0x8')](_0x1a5c('0xe'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0xf')]);router[_0x1a5c('0x8')](_0x1a5c('0x10'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x11')]);router['get'](_0x1a5c('0x12'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x13')]);router[_0x1a5c('0x8')](_0x1a5c('0x14'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x15')]);router[_0x1a5c('0x8')]('/:id/messages',auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x16')]);router[_0x1a5c('0x8')]('/:id/users',auth[_0x1a5c('0x9')](),controller['getAgents']);router['post']('/',auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x17')]);router['post'](_0x1a5c('0xe'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x18')]);router[_0x1a5c('0x19')]('/:id/canned_answers',auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x1a')]);router[_0x1a5c('0x19')](_0x1a5c('0x12'),auth['isAuthenticated'](),controller[_0x1a5c('0x1b')]);router[_0x1a5c('0x19')](_0x1a5c('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0x1a5c('0x19')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x1a5c('0x1c')]);router['post'](_0x1a5c('0x1d'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x1e')]);router['post'](_0x1a5c('0x1f'),auth[_0x1a5c('0x9')](),controller['send']);router[_0x1a5c('0x19')](_0x1a5c('0x20'),auth['isAuthenticated'](),controller[_0x1a5c('0x21')]);router['put'](_0x1a5c('0xc'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x22')]);router[_0x1a5c('0x23')](_0x1a5c('0xc'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x24')]);router['delete']('/:id/dispositions',auth[_0x1a5c('0x9')](),controller['removeDispositions']);router[_0x1a5c('0x23')](_0x1a5c('0x10'),auth[_0x1a5c('0x9')](),controller[_0x1a5c('0x25')]);router[_0x1a5c('0x23')](_0x1a5c('0x20'),auth[_0x1a5c('0x9')](),controller['removeAgents']);module[_0x1a5c('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 27cf510..71e5a7a 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 _0xf649=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf649,0x19a));var _0x9f64=function(_0xdc331e,_0x4d9605){_0xdc331e=_0xdc331e-0x0;var _0x2df59e=_0xf649[_0xdc331e];return _0x2df59e;};'use strict';var Sequelize=require('sequelize');module[_0x9f64('0x0')]={'priority':{'type':Sequelize[_0x9f64('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f64('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f64('0x3')}}; \ No newline at end of file +var _0x04fa=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0x04fa,0xeb));var _0xa04f=function(_0x3a1ff5,_0x1dc2df){_0x3a1ff5=_0x3a1ff5-0x0;var _0x144efd=_0x04fa[_0x3a1ff5];return _0x144efd;};'use strict';var Sequelize=require(_0xa04f('0x0'));module[_0xa04f('0x1')]={'priority':{'type':Sequelize[_0xa04f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa04f('0x3')],'allowNull':![],'defaultValue':_0xa04f('0x4')},'appdata':{'type':Sequelize[_0xa04f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa04f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9c96b03..d60ce18 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 _0xb575=['stack','name','send','index','FaxApplication','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error'];(function(_0x1015fb,_0x2bd4d6){var _0x49abc3=function(_0x45b6f0){while(--_0x45b6f0){_0x1015fb['push'](_0x1015fb['shift']());}};_0x49abc3(++_0x2bd4d6);}(_0xb575,0x139));var _0x5b57=function(_0x1cb4c4,_0x234cb0){_0x1cb4c4=_0x1cb4c4-0x0;var _0x26b813=_0xb575[_0x1cb4c4];return _0x26b813;};'use strict';var emlformat=require(_0x5b57('0x0'));var rimraf=require(_0x5b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b57('0x2'));var rp=require(_0x5b57('0x3'));var moment=require(_0x5b57('0x4'));var BPromise=require(_0x5b57('0x5'));var Mustache=require('mustache');var util=require(_0x5b57('0x6'));var path=require(_0x5b57('0x7'));var sox=require(_0x5b57('0x8'));var csv=require(_0x5b57('0x9'));var ejs=require(_0x5b57('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b57('0xb'));var squel=require('squel');var crypto=require(_0x5b57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5b57('0xd'));var toCsv=require(_0x5b57('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b57('0xe'));var authService=require(_0x5b57('0xf'));var qs=require(_0x5b57('0x10'));var as=require(_0x5b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b57('0x12'))(_0x5b57('0x13'));var utils=require(_0x5b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5b57('0x15'))['db'];function respondWithStatusCode(_0x46a9b7,_0x5620db){_0x5620db=_0x5620db||0xcc;return function(_0x4f9ce7){if(_0x4f9ce7){return _0x46a9b7['sendStatus'](_0x5620db);}return _0x46a9b7[_0x5b57('0x16')](_0x5620db)[_0x5b57('0x17')]();};}function respondWithResult(_0x365b58,_0x477a12){_0x477a12=_0x477a12||0xc8;return function(_0x2a3a97){if(_0x2a3a97){return _0x365b58[_0x5b57('0x16')](_0x477a12)[_0x5b57('0x18')](_0x2a3a97);}};}function respondWithFilteredResult(_0x2d0685,_0x100bba){return function(_0x3eb0ff){if(_0x3eb0ff){var _0x2be551=typeof _0x100bba[_0x5b57('0x19')]===_0x5b57('0x1a')&&typeof _0x100bba['limit']===_0x5b57('0x1a');var _0x452c74=_0x3eb0ff[_0x5b57('0x1b')];var _0x233457=_0x2be551?0x0:_0x100bba[_0x5b57('0x19')];var _0x545719=_0x2be551?_0x3eb0ff[_0x5b57('0x1b')]:_0x100bba[_0x5b57('0x19')]+_0x100bba[_0x5b57('0x1c')];var _0x5e2597;if(_0x545719>=_0x452c74){_0x545719=_0x452c74;_0x5e2597=0xc8;}else{_0x5e2597=0xce;}_0x2d0685[_0x5b57('0x16')](_0x5e2597);return _0x2d0685['set'](_0x5b57('0x1d'),_0x233457+'-'+_0x545719+'/'+_0x452c74)[_0x5b57('0x18')](_0x3eb0ff);}return null;};}function patchUpdates(_0x4a11c4){return function(_0x3b4db5){try{jsonpatch[_0x5b57('0x1e')](_0x3b4db5,_0x4a11c4,!![]);}catch(_0x4b30ca){return BPromise['reject'](_0x4b30ca);}return _0x3b4db5[_0x5b57('0x1f')]();};}function saveUpdates(_0x3570d5,_0xebc022){return function(_0x2eea28){if(_0x2eea28){return _0x2eea28[_0x5b57('0x20')](_0x3570d5)[_0x5b57('0x21')](function(_0x3947a1){return _0x3947a1;});}return null;};}function removeEntity(_0x371135,_0xa9c138){return function(_0x18cb8d){if(_0x18cb8d){return _0x18cb8d[_0x5b57('0x22')]()['then'](function(){_0x371135[_0x5b57('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30dd58,_0x3a4afb){return function(_0xfc8378){if(!_0xfc8378){_0x30dd58[_0x5b57('0x23')](0x194);}return _0xfc8378;};}function handleError(_0x137743,_0x202225){_0x202225=_0x202225||0x1f4;return function(_0x276556){logger[_0x5b57('0x24')](_0x276556[_0x5b57('0x25')]);if(_0x276556[_0x5b57('0x26')]){delete _0x276556[_0x5b57('0x26')];}_0x137743[_0x5b57('0x16')](_0x202225)[_0x5b57('0x27')](_0x276556);};}exports[_0x5b57('0x28')]=function(_0x3d8ecc,_0x4f147a){var _0x2d8462={},_0x25fc20={},_0xfd4d2c={'count':0x0,'rows':[]};var _0x4d2ab4=_['map'](db[_0x5b57('0x29')]['rawAttributes'],function(_0x3dbda0){return{'name':_0x3dbda0['fieldName'],'type':_0x3dbda0[_0x5b57('0x2a')]['key']};});_0x25fc20[_0x5b57('0x2b')]=_[_0x5b57('0x2c')](_0x4d2ab4,_0x5b57('0x26'));_0x25fc20[_0x5b57('0x2d')]=_[_0x5b57('0x2e')](_0x3d8ecc[_0x5b57('0x2d')]);_0x25fc20[_0x5b57('0x2f')]=_[_0x5b57('0x30')](_0x25fc20['model'],_0x25fc20[_0x5b57('0x2d')]);_0x2d8462[_0x5b57('0x31')]=_[_0x5b57('0x30')](_0x25fc20[_0x5b57('0x2b')],qs['fields'](_0x3d8ecc['query']['fields']));_0x2d8462[_0x5b57('0x31')]=_0x2d8462['attributes']['length']?_0x2d8462[_0x5b57('0x31')]:_0x25fc20[_0x5b57('0x2b')];if(!_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x32')](_0x5b57('0x33'))){_0x2d8462[_0x5b57('0x1c')]=qs[_0x5b57('0x1c')](_0x3d8ecc[_0x5b57('0x2d')]['limit']);_0x2d8462[_0x5b57('0x19')]=qs[_0x5b57('0x19')](_0x3d8ecc[_0x5b57('0x2d')]['offset']);}_0x2d8462[_0x5b57('0x34')]=qs[_0x5b57('0x35')](_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x35')]);_0x2d8462['where']=qs[_0x5b57('0x2f')](_['pick'](_0x3d8ecc[_0x5b57('0x2d')],_0x25fc20[_0x5b57('0x2f')]),_0x4d2ab4);if(_0x3d8ecc[_0x5b57('0x2d')]['filter']){_0x2d8462[_0x5b57('0x36')]=_['merge'](_0x2d8462[_0x5b57('0x36')],{'$or':_[_0x5b57('0x2c')](_0x4d2ab4,function(_0x290c69){if(_0x290c69[_0x5b57('0x2a')]!==_0x5b57('0x37')){var _0x4fe06a={};_0x4fe06a[_0x290c69[_0x5b57('0x26')]]={'$like':'%'+_0x3d8ecc[_0x5b57('0x2d')][_0x5b57('0x38')]+'%'};return _0x4fe06a;}})});}_0x2d8462=_[_0x5b57('0x39')]({},_0x2d8462,_0x3d8ecc[_0x5b57('0x3a')]);var _0x53327a={'where':_0x2d8462[_0x5b57('0x36')]};return db[_0x5b57('0x29')][_0x5b57('0x1b')](_0x53327a)['then'](function(_0x3db1c5){_0xfd4d2c['count']=_0x3db1c5;if(_0x3d8ecc['query'][_0x5b57('0x3b')]){_0x2d8462[_0x5b57('0x3c')]=[{'all':!![]}];}return db[_0x5b57('0x29')]['findAll'](_0x2d8462);})[_0x5b57('0x21')](function(_0x44cb9e){_0xfd4d2c[_0x5b57('0x3d')]=_0x44cb9e;return _0xfd4d2c;})[_0x5b57('0x21')](respondWithFilteredResult(_0x4f147a,_0x2d8462))[_0x5b57('0x3e')](handleError(_0x4f147a,null));};exports[_0x5b57('0x3f')]=function(_0x4cc2ac,_0x4e9c0b){var _0x3a2437={'raw':!![],'where':{'id':_0x4cc2ac[_0x5b57('0x40')]['id']}},_0x54a692={};_0x54a692[_0x5b57('0x2b')]=_[_0x5b57('0x2e')](db[_0x5b57('0x29')][_0x5b57('0x41')]);_0x54a692['query']=_[_0x5b57('0x2e')](_0x4cc2ac['query']);_0x54a692[_0x5b57('0x2f')]=_['intersection'](_0x54a692[_0x5b57('0x2b')],_0x54a692[_0x5b57('0x2d')]);_0x3a2437['attributes']=_[_0x5b57('0x30')](_0x54a692[_0x5b57('0x2b')],qs[_0x5b57('0x42')](_0x4cc2ac[_0x5b57('0x2d')][_0x5b57('0x42')]));_0x3a2437[_0x5b57('0x31')]=_0x3a2437['attributes']['length']?_0x3a2437[_0x5b57('0x31')]:_0x54a692[_0x5b57('0x2b')];if(_0x4cc2ac[_0x5b57('0x2d')]['includeAll']){_0x3a2437[_0x5b57('0x3c')]=[{'all':!![]}];}_0x3a2437=_['merge']({},_0x3a2437,_0x4cc2ac[_0x5b57('0x3a')]);return db[_0x5b57('0x29')][_0x5b57('0x43')](_0x3a2437)['then'](handleEntityNotFound(_0x4e9c0b,null))[_0x5b57('0x21')](respondWithResult(_0x4e9c0b,null))[_0x5b57('0x3e')](handleError(_0x4e9c0b,null));};exports[_0x5b57('0x44')]=function(_0x49a510,_0x15cbaa){return db['FaxApplication'][_0x5b57('0x44')](_0x49a510[_0x5b57('0x45')],{})['then'](respondWithResult(_0x15cbaa,0xc9))[_0x5b57('0x3e')](handleError(_0x15cbaa,null));};exports[_0x5b57('0x20')]=function(_0x225cca,_0x209820){if(_0x225cca[_0x5b57('0x45')]['id']){delete _0x225cca['body']['id'];}return db[_0x5b57('0x29')][_0x5b57('0x43')]({'where':{'id':_0x225cca[_0x5b57('0x40')]['id']}})[_0x5b57('0x21')](handleEntityNotFound(_0x209820,null))[_0x5b57('0x21')](saveUpdates(_0x225cca[_0x5b57('0x45')],null))['then'](respondWithResult(_0x209820,null))[_0x5b57('0x3e')](handleError(_0x209820,null));};exports[_0x5b57('0x22')]=function(_0x1dd525,_0x21737c){return db[_0x5b57('0x29')][_0x5b57('0x43')]({'where':{'id':_0x1dd525['params']['id']}})[_0x5b57('0x21')](handleEntityNotFound(_0x21737c,null))[_0x5b57('0x21')](removeEntity(_0x21737c,null))['catch'](handleError(_0x21737c,null));}; \ No newline at end of file +var _0x324b=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','options','include','FaxApplication','findAll','includeAll','merge','find','catch','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4f12f4,_0x4d3848){var _0x127887=function(_0x5345b8){while(--_0x5345b8){_0x4f12f4['push'](_0x4f12f4['shift']());}};_0x127887(++_0x4d3848);}(_0x324b,0x1eb));var _0xb324=function(_0x3ab943,_0xfb20f0){_0x3ab943=_0x3ab943-0x0;var _0x1a372a=_0x324b[_0x3ab943];return _0x1a372a;};'use strict';var emlformat=require(_0xb324('0x0'));var rimraf=require(_0xb324('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb324('0x2'));var rp=require(_0xb324('0x3'));var moment=require(_0xb324('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb324('0x5'));var util=require(_0xb324('0x6'));var path=require(_0xb324('0x7'));var sox=require(_0xb324('0x8'));var csv=require(_0xb324('0x9'));var ejs=require(_0xb324('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb324('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb324('0xc'));var toCsv=require(_0xb324('0x9'));var querystring=require(_0xb324('0xd'));var Papa=require(_0xb324('0xe'));var Redis=require(_0xb324('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb324('0x10'));var hardwareService=require(_0xb324('0x11'));var logger=require('../../config/logger')(_0xb324('0x12'));var utils=require(_0xb324('0x13'));var config=require(_0xb324('0x14'));var licenseUtil=require(_0xb324('0x15'));var db=require(_0xb324('0x16'))['db'];function respondWithStatusCode(_0x1926d8,_0x136c75){_0x136c75=_0x136c75||0xcc;return function(_0x5405c5){if(_0x5405c5){return _0x1926d8[_0xb324('0x17')](_0x136c75);}return _0x1926d8[_0xb324('0x18')](_0x136c75)[_0xb324('0x19')]();};}function respondWithResult(_0x4641ac,_0x10f318){_0x10f318=_0x10f318||0xc8;return function(_0xdad29b){if(_0xdad29b){return _0x4641ac[_0xb324('0x18')](_0x10f318)[_0xb324('0x1a')](_0xdad29b);}};}function respondWithFilteredResult(_0x53b58c,_0x2c3000){return function(_0x208cfb){if(_0x208cfb){var _0x418056=typeof _0x2c3000[_0xb324('0x1b')]===_0xb324('0x1c')&&typeof _0x2c3000[_0xb324('0x1d')]===_0xb324('0x1c');var _0x47c478=_0x208cfb['count'];var _0x5a34fe=_0x418056?0x0:_0x2c3000[_0xb324('0x1b')];var _0x3745a1=_0x418056?_0x208cfb[_0xb324('0x1e')]:_0x2c3000[_0xb324('0x1b')]+_0x2c3000[_0xb324('0x1d')];var _0x3a8e0f;if(_0x3745a1>=_0x47c478){_0x3745a1=_0x47c478;_0x3a8e0f=0xc8;}else{_0x3a8e0f=0xce;}_0x53b58c['status'](_0x3a8e0f);return _0x53b58c[_0xb324('0x1f')](_0xb324('0x20'),_0x5a34fe+'-'+_0x3745a1+'/'+_0x47c478)[_0xb324('0x1a')](_0x208cfb);}return null;};}function patchUpdates(_0x5c3957){return function(_0xb9a70a){try{jsonpatch[_0xb324('0x21')](_0xb9a70a,_0x5c3957,!![]);}catch(_0x3df485){return BPromise[_0xb324('0x22')](_0x3df485);}return _0xb9a70a['save']();};}function saveUpdates(_0x192411,_0x118b18){return function(_0x1aa2a7){if(_0x1aa2a7){return _0x1aa2a7[_0xb324('0x23')](_0x192411)[_0xb324('0x24')](function(_0x4d27e1){return _0x4d27e1;});}return null;};}function removeEntity(_0xf7e624,_0x2d38fa){return function(_0x2e6f2f){if(_0x2e6f2f){return _0x2e6f2f['destroy']()[_0xb324('0x24')](function(){_0xf7e624['status'](0xcc)[_0xb324('0x19')]();});}};}function handleEntityNotFound(_0x586756,_0x2c3e8c){return function(_0x140ed5){if(!_0x140ed5){_0x586756[_0xb324('0x17')](0x194);}return _0x140ed5;};}function handleError(_0x5c171d,_0x58efbb){_0x58efbb=_0x58efbb||0x1f4;return function(_0xde99a){logger[_0xb324('0x25')](_0xde99a[_0xb324('0x26')]);if(_0xde99a[_0xb324('0x27')]){delete _0xde99a[_0xb324('0x27')];}_0x5c171d[_0xb324('0x18')](_0x58efbb)[_0xb324('0x28')](_0xde99a);};}exports[_0xb324('0x29')]=function(_0x6605af,_0x3837ef){var _0x52b7a0={},_0x4bcff6={},_0x5953c9={'count':0x0,'rows':[]};var _0x492566=_[_0xb324('0x2a')](db['FaxApplication'][_0xb324('0x2b')],function(_0x51c3ec){return{'name':_0x51c3ec[_0xb324('0x2c')],'type':_0x51c3ec['type'][_0xb324('0x2d')]};});_0x4bcff6[_0xb324('0x2e')]=_[_0xb324('0x2a')](_0x492566,_0xb324('0x27'));_0x4bcff6[_0xb324('0x2f')]=_[_0xb324('0x30')](_0x6605af[_0xb324('0x2f')]);_0x4bcff6['filters']=_[_0xb324('0x31')](_0x4bcff6[_0xb324('0x2e')],_0x4bcff6[_0xb324('0x2f')]);_0x52b7a0[_0xb324('0x32')]=_[_0xb324('0x31')](_0x4bcff6[_0xb324('0x2e')],qs['fields'](_0x6605af[_0xb324('0x2f')][_0xb324('0x33')]));_0x52b7a0[_0xb324('0x32')]=_0x52b7a0[_0xb324('0x32')][_0xb324('0x34')]?_0x52b7a0['attributes']:_0x4bcff6['model'];if(!_0x6605af[_0xb324('0x2f')][_0xb324('0x35')](_0xb324('0x36'))){_0x52b7a0[_0xb324('0x1d')]=qs['limit'](_0x6605af[_0xb324('0x2f')][_0xb324('0x1d')]);_0x52b7a0[_0xb324('0x1b')]=qs[_0xb324('0x1b')](_0x6605af[_0xb324('0x2f')][_0xb324('0x1b')]);}_0x52b7a0[_0xb324('0x37')]=qs[_0xb324('0x38')](_0x6605af[_0xb324('0x2f')][_0xb324('0x38')]);_0x52b7a0[_0xb324('0x39')]=qs[_0xb324('0x3a')](_[_0xb324('0x3b')](_0x6605af[_0xb324('0x2f')],_0x4bcff6[_0xb324('0x3a')]),_0x492566);if(_0x6605af[_0xb324('0x2f')]['filter']){_0x52b7a0['where']=_['merge'](_0x52b7a0[_0xb324('0x39')],{'$or':_['map'](_0x492566,function(_0x2eaac8){if(_0x2eaac8[_0xb324('0x3c')]!==_0xb324('0x3d')){var _0x2dcd49={};_0x2dcd49[_0x2eaac8[_0xb324('0x27')]]={'$like':'%'+_0x6605af[_0xb324('0x2f')]['filter']+'%'};return _0x2dcd49;}})});}_0x52b7a0=_['merge']({},_0x52b7a0,_0x6605af[_0xb324('0x3e')]);var _0x227ad6={'where':_0x52b7a0[_0xb324('0x39')]};return db['FaxApplication'][_0xb324('0x1e')](_0x227ad6)['then'](function(_0x406078){_0x5953c9[_0xb324('0x1e')]=_0x406078;if(_0x6605af[_0xb324('0x2f')]['includeAll']){_0x52b7a0[_0xb324('0x3f')]=[{'all':!![]}];}return db[_0xb324('0x40')][_0xb324('0x41')](_0x52b7a0);})[_0xb324('0x24')](function(_0xa3bb80){_0x5953c9['rows']=_0xa3bb80;return _0x5953c9;})[_0xb324('0x24')](respondWithFilteredResult(_0x3837ef,_0x52b7a0))['catch'](handleError(_0x3837ef,null));};exports['show']=function(_0x25752d,_0x148cf0){var _0x48ad1f={'raw':!![],'where':{'id':_0x25752d['params']['id']}},_0x2c14dc={};_0x2c14dc[_0xb324('0x2e')]=_[_0xb324('0x30')](db[_0xb324('0x40')][_0xb324('0x2b')]);_0x2c14dc['query']=_['keys'](_0x25752d['query']);_0x2c14dc[_0xb324('0x3a')]=_[_0xb324('0x31')](_0x2c14dc['model'],_0x2c14dc[_0xb324('0x2f')]);_0x48ad1f[_0xb324('0x32')]=_[_0xb324('0x31')](_0x2c14dc[_0xb324('0x2e')],qs[_0xb324('0x33')](_0x25752d[_0xb324('0x2f')][_0xb324('0x33')]));_0x48ad1f[_0xb324('0x32')]=_0x48ad1f[_0xb324('0x32')][_0xb324('0x34')]?_0x48ad1f['attributes']:_0x2c14dc[_0xb324('0x2e')];if(_0x25752d[_0xb324('0x2f')][_0xb324('0x42')]){_0x48ad1f['include']=[{'all':!![]}];}_0x48ad1f=_[_0xb324('0x43')]({},_0x48ad1f,_0x25752d[_0xb324('0x3e')]);return db['FaxApplication'][_0xb324('0x44')](_0x48ad1f)[_0xb324('0x24')](handleEntityNotFound(_0x148cf0,null))[_0xb324('0x24')](respondWithResult(_0x148cf0,null))[_0xb324('0x45')](handleError(_0x148cf0,null));};exports[_0xb324('0x46')]=function(_0x5c034b,_0xcb1c0e){return db[_0xb324('0x40')][_0xb324('0x46')](_0x5c034b[_0xb324('0x47')],{})[_0xb324('0x24')](respondWithResult(_0xcb1c0e,0xc9))[_0xb324('0x45')](handleError(_0xcb1c0e,null));};exports[_0xb324('0x23')]=function(_0x162595,_0x335f8f){if(_0x162595[_0xb324('0x47')]['id']){delete _0x162595[_0xb324('0x47')]['id'];}return db[_0xb324('0x40')][_0xb324('0x44')]({'where':{'id':_0x162595[_0xb324('0x48')]['id']}})['then'](handleEntityNotFound(_0x335f8f,null))[_0xb324('0x24')](saveUpdates(_0x162595[_0xb324('0x47')],null))[_0xb324('0x24')](respondWithResult(_0x335f8f,null))[_0xb324('0x45')](handleError(_0x335f8f,null));};exports[_0xb324('0x49')]=function(_0xa51881,_0x7a0bfc){return db['FaxApplication'][_0xb324('0x44')]({'where':{'id':_0xa51881[_0xb324('0x48')]['id']}})['then'](handleEntityNotFound(_0x7a0bfc,null))['then'](removeEntity(_0x7a0bfc,null))[_0xb324('0x45')](handleError(_0x7a0bfc,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ae892f3..9ba0f2e 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 _0xccd4=['../../config/environment','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x35ae51,_0x4e5118){var _0x3a00e0=function(_0x345ff2){while(--_0x345ff2){_0x35ae51['push'](_0x35ae51['shift']());}};_0x3a00e0(++_0x4e5118);}(_0xccd4,0xdd));var _0x4ccd=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xccd4[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x4ccd('0x0'));var util=require('util');var logger=require(_0x4ccd('0x1'))(_0x4ccd('0x2'));var moment=require(_0x4ccd('0x3'));var BPromise=require(_0x4ccd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ccd('0x5'));var rimraf=require(_0x4ccd('0x6'));var config=require(_0x4ccd('0x7'));var attributes=require('./faxApplication.attributes');module[_0x4ccd('0x8')]=function(_0x987ff0,_0x1079e9){return _0x987ff0['define'](_0x4ccd('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ccd('0xa'),'collate':_0x4ccd('0xb')});}; \ No newline at end of file +var _0x0091=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x41af7c,_0x1ffcfa){var _0x3ee1a2=function(_0x15736d){while(--_0x15736d){_0x41af7c['push'](_0x41af7c['shift']());}};_0x3ee1a2(++_0x1ffcfa);}(_0x0091,0x110));var _0x1009=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0091[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1009('0x0'))(_0x1009('0x1'));var moment=require(_0x1009('0x2'));var BPromise=require(_0x1009('0x3'));var rp=require(_0x1009('0x4'));var fs=require('fs');var path=require(_0x1009('0x5'));var rimraf=require(_0x1009('0x6'));var config=require(_0x1009('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x104dd3,_0x20693b){return _0x104dd3[_0x1009('0x8')](_0x1009('0x9'),attributes,{'tableName':_0x1009('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1009('0xb'),'collate':_0x1009('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a77dd76..b2ae0db 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 _0xabc1=['request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info'];(function(_0x5c7ff5,_0x50506a){var _0x29824c=function(_0x28e05a){while(--_0x28e05a){_0x5c7ff5['push'](_0x5c7ff5['shift']());}};_0x29824c(++_0x50506a);}(_0xabc1,0x92));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var util=require(_0x1abc('0x1'));var moment=require('moment');var BPromise=require(_0x1abc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1abc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1abc('0x4'));var logger=require(_0x1abc('0x5'))(_0x1abc('0x6'));var config=require('../../config/environment');var jayson=require(_0x1abc('0x7'));var client=jayson[_0x1abc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edc0a,_0x36466b,_0x368773){return new BPromise(function(_0x188384,_0x4586d8){return client['request'](_0x4edc0a,_0x368773)['then'](function(_0x258b54){logger[_0x1abc('0x9')]('FaxApplication,\x20%s,\x20%s',_0x36466b,_0x1abc('0xa'));logger['debug'](_0x1abc('0xb'),_0x36466b,_0x1abc('0xa'),JSON[_0x1abc('0xc')](_0x258b54));if(_0x258b54[_0x1abc('0xd')]){if(_0x258b54[_0x1abc('0xd')][_0x1abc('0xe')]===0x1f4){logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54['error'][_0x1abc('0x10')]);return _0x4586d8(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);return _0x188384(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}else{logger['info'](_0x1abc('0xf'),_0x36466b,_0x1abc('0xa'));_0x188384(_0x258b54[_0x1abc('0x11')]['message']);}})[_0x1abc('0x12')](function(_0x5ae22f){logger['error'](_0x1abc('0xf'),_0x36466b,_0x5ae22f);_0x4586d8(_0x5ae22f);});});}exports['UpdateFaxApplication']=function(_0x13f268){var _0x2f3154=this;return new Promise(function(_0x4ef478,_0x1e2a2d){return db['FaxApplication']['update'](_0x13f268[_0x1abc('0x13')],{'raw':_0x13f268[_0x1abc('0x14')]?_0x13f268[_0x1abc('0x14')][_0x1abc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f268[_0x1abc('0x14')]?_0x13f268[_0x1abc('0x14')][_0x1abc('0x16')]||null:null,'attributes':_0x13f268['options']?_0x13f268[_0x1abc('0x14')][_0x1abc('0x17')]||null:null,'limit':_0x13f268['options']?_0x13f268[_0x1abc('0x14')][_0x1abc('0x18')]||null:null})['then'](function(_0x5f46d5){logger[_0x1abc('0x9')](_0x1abc('0x19'),_0x13f268);logger['debug'](_0x1abc('0x19'),_0x13f268,JSON[_0x1abc('0xc')](_0x5f46d5));_0x4ef478(_0x5f46d5);})['catch'](function(_0x269b1a){logger[_0x1abc('0xd')]('UpdateFaxApplication',_0x269b1a[_0x1abc('0x10')],_0x13f268);_0x1e2a2d(_0x2f3154['error'](0x1f4,_0x269b1a[_0x1abc('0x10')]));});});}; \ No newline at end of file +var _0xfcb8=['update','options','raw','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxApplication','FaxApplication'];(function(_0x4c912e,_0x27299d){var _0x2fa424=function(_0x4b0cfb){while(--_0x4b0cfb){_0x4c912e['push'](_0x4c912e['shift']());}};_0x2fa424(++_0x27299d);}(_0xfcb8,0x17e));var _0x8fcb=function(_0x48d7aa,_0x52349c){_0x48d7aa=_0x48d7aa-0x0;var _0x138fc6=_0xfcb8[_0x48d7aa];return _0x138fc6;};'use strict';var _=require(_0x8fcb('0x0'));var util=require(_0x8fcb('0x1'));var moment=require(_0x8fcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fcb('0x3'));var db=require(_0x8fcb('0x4'))['db'];var utils=require(_0x8fcb('0x5'));var logger=require(_0x8fcb('0x6'))(_0x8fcb('0x7'));var config=require(_0x8fcb('0x8'));var jayson=require(_0x8fcb('0x9'));var client=jayson[_0x8fcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44ed76,_0x17ad1d,_0x54804f){return new BPromise(function(_0x64a796,_0x2d2471){return client[_0x8fcb('0xb')](_0x44ed76,_0x54804f)[_0x8fcb('0xc')](function(_0x5e806e){logger[_0x8fcb('0xd')](_0x8fcb('0xe'),_0x17ad1d,_0x8fcb('0xf'));logger[_0x8fcb('0x10')](_0x8fcb('0x11'),_0x17ad1d,_0x8fcb('0xf'),JSON[_0x8fcb('0x12')](_0x5e806e));if(_0x5e806e[_0x8fcb('0x13')]){if(_0x5e806e[_0x8fcb('0x13')]['code']===0x1f4){logger[_0x8fcb('0x13')](_0x8fcb('0xe'),_0x17ad1d,_0x5e806e[_0x8fcb('0x13')][_0x8fcb('0x14')]);return _0x2d2471(_0x5e806e[_0x8fcb('0x13')]['message']);}logger[_0x8fcb('0x13')](_0x8fcb('0xe'),_0x17ad1d,_0x5e806e['error'][_0x8fcb('0x14')]);return _0x64a796(_0x5e806e[_0x8fcb('0x13')][_0x8fcb('0x14')]);}else{logger[_0x8fcb('0xd')](_0x8fcb('0xe'),_0x17ad1d,'request\x20sent');_0x64a796(_0x5e806e['result'][_0x8fcb('0x14')]);}})[_0x8fcb('0x15')](function(_0x1e0826){logger[_0x8fcb('0x13')](_0x8fcb('0xe'),_0x17ad1d,_0x1e0826);_0x2d2471(_0x1e0826);});});}exports[_0x8fcb('0x16')]=function(_0x2964d1){var _0x3d90d1=this;return new Promise(function(_0x4bb4e8,_0x5b3d66){return db[_0x8fcb('0x17')][_0x8fcb('0x18')](_0x2964d1['body'],{'raw':_0x2964d1[_0x8fcb('0x19')]?_0x2964d1[_0x8fcb('0x19')][_0x8fcb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2964d1[_0x8fcb('0x19')]?_0x2964d1[_0x8fcb('0x19')][_0x8fcb('0x1b')]||null:null,'attributes':_0x2964d1[_0x8fcb('0x19')]?_0x2964d1[_0x8fcb('0x19')]['attributes']||null:null,'limit':_0x2964d1[_0x8fcb('0x19')]?_0x2964d1[_0x8fcb('0x19')][_0x8fcb('0x1c')]||null:null})['then'](function(_0x2a46a0){logger[_0x8fcb('0xd')](_0x8fcb('0x16'),_0x2964d1);logger[_0x8fcb('0x10')]('UpdateFaxApplication',_0x2964d1,JSON[_0x8fcb('0x12')](_0x2a46a0));_0x4bb4e8(_0x2a46a0);})[_0x8fcb('0x15')](function(_0x209ac3){logger[_0x8fcb('0x13')](_0x8fcb('0x16'),_0x209ac3[_0x8fcb('0x14')],_0x2964d1);_0x5b3d66(_0x3d90d1['error'](0x1f4,_0x209ac3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 67f0a2f..d205da0 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 _0x7916=['/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index'];(function(_0x4591ee,_0x3a1daf){var _0x4cdb81=function(_0x22b5cf){while(--_0x22b5cf){_0x4591ee['push'](_0x4591ee['shift']());}};_0x4cdb81(++_0x3a1daf);}(_0x7916,0x128));var _0x6791=function(_0x2e27e9,_0x17e4c1){_0x2e27e9=_0x2e27e9-0x0;var _0x566cd1=_0x7916[_0x2e27e9];return _0x566cd1;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6791('0xc')]);router[_0x6791('0xd')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router[_0x6791('0xf')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);module[_0x6791('0x11')]=router; \ No newline at end of file +var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x8050d2,_0x1591ee){var _0x3dbf01=function(_0x11453a){while(--_0x11453a){_0x8050d2['push'](_0x8050d2['shift']());}};_0x3dbf01(++_0x1591ee);}(_0x4024,0x89));var _0x4402=function(_0x5012b8,_0x17fcd7){_0x5012b8=_0x5012b8-0x0;var _0x452e1a=_0x4024[_0x5012b8];return _0x452e1a;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b4f50e7..47cf77a 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 _0xfb11=['STRING','ENUM','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x4be009,_0x239bec){var _0x50b245=function(_0x15ce8a){while(--_0x15ce8a){_0x4be009['push'](_0x4be009['shift']());}};_0x50b245(++_0x239bec);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xfb11[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1fb1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1fb1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1fb1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1fb1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1fb1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1fb1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x1fb1('0x5')]}}; \ No newline at end of file +var _0xd4a2=['DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x55b8e5,_0x46cfe7){var _0x3b3691=function(_0x25ed17){while(--_0x25ed17){_0x55b8e5['push'](_0x55b8e5['shift']());}};_0x3b3691(++_0x46cfe7);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1ee48e,_0x345769){_0x1ee48e=_0x1ee48e-0x0;var _0x366aa7=_0xd4a2[_0x1ee48e];return _0x366aa7;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2d4a('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2d4a('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2d4a('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x2d4a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2d4a('0x3')]('in',_0x2d4a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2d4a('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x2d4a('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2d4a('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8464667..7cba353 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 _0xde9f=['attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','log','unlinkSync','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','fieldName','type','getOptions','findAll','fax','user','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','body','find','describe','addMessage','FaxMessage','getMessages','findOne','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','ids','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','toString','join','root','files','tmp','server'];(function(_0x21c795,_0x4840d5){var _0x482def=function(_0x45e193){while(--_0x45e193){_0x21c795['push'](_0x21c795['shift']());}};_0x482def(++_0x4840d5);}(_0xde9f,0x73));var _0xfde9=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0xde9f[_0x4f4d19];return _0x27a258;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xfde9('0x0'));var util=require('util');var path=require(_0xfde9('0x1'));var fs=require('fs');var _=require(_0xfde9('0x2'));var Redis=require(_0xfde9('0x3'));var interaction=require(_0xfde9('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xfde9('0x5'))('api');var config=require(_0xfde9('0x6'));var db=require('../../mysqldb')['db'];config[_0xfde9('0x7')]=_[_0xfde9('0x8')](config['redis'],{'host':_0xfde9('0x9'),'port':0x18eb});var socket=require(_0xfde9('0xa'))(new Redis(config[_0xfde9('0x7')]));require(_0xfde9('0xb'))['register'](socket);function respondWithStatusCode(_0xc14656,_0x487558){_0x487558=_0x487558||0xcc;return function(_0x5af4d){if(_0x5af4d){return _0xc14656[_0xfde9('0xc')](_0x487558);}return _0xc14656[_0xfde9('0xd')](_0x487558)[_0xfde9('0xe')]();};}function respondWithResult(_0x52dcc6,_0x576b4d){_0x576b4d=_0x576b4d||0xc8;return function(_0x50c954){if(_0x50c954){return _0x52dcc6[_0xfde9('0xd')](_0x576b4d)[_0xfde9('0xf')](_0x50c954);}};}function respondWithFilteredResult(_0x4b9efe,_0x537d4e){return function(_0x34a678){if(_0x34a678){var _0x532aac=typeof _0x537d4e[_0xfde9('0x10')]===_0xfde9('0x11')&&typeof _0x537d4e[_0xfde9('0x12')]===_0xfde9('0x11');var _0x3f6e0c=_0x34a678[_0xfde9('0x13')];var _0x11f332=_0x532aac?0x0:_0x537d4e[_0xfde9('0x10')];var _0x1bad59=_0x532aac?_0x34a678['count']:_0x537d4e['offset']+_0x537d4e[_0xfde9('0x12')];var _0xbc7ad6;if(_0x1bad59>=_0x3f6e0c){_0x1bad59=_0x3f6e0c;_0xbc7ad6=0xc8;}else{_0xbc7ad6=0xce;}_0x4b9efe[_0xfde9('0xd')](_0xbc7ad6);return _0x4b9efe['set'](_0xfde9('0x14'),_0x11f332+'-'+_0x1bad59+'/'+_0x3f6e0c)[_0xfde9('0xf')](_0x34a678);}return null;};}function saveUpdates(_0x3d602c){return function(_0x1b916f){if(_0x1b916f){return _0x1b916f[_0xfde9('0x15')](_0x3d602c)[_0xfde9('0x16')](function(_0xb3459b){return _0xb3459b;});}return null;};}function removeEntity(_0x1207e6){return function(_0x1bbc9d){if(_0x1bbc9d){return _0x1bbc9d[_0xfde9('0x17')]()[_0xfde9('0x16')](function(){_0x1207e6['status'](0xcc)[_0xfde9('0xe')]();});}};}function handleEntityNotFound(_0x1d7cae){return function(_0x547da5){if(!_0x547da5){_0x1d7cae[_0xfde9('0xc')](0x194);}return _0x547da5;};}function handleError(_0x3b78a2,_0x13a9fa){_0x13a9fa=_0x13a9fa||0x1f4;return function(_0x33e911){logger[_0xfde9('0x18')](_0x33e911[_0xfde9('0x19')]);if(_0x33e911[_0xfde9('0x1a')]){delete _0x33e911[_0xfde9('0x1a')];}_0x3b78a2[_0xfde9('0xd')](_0x13a9fa)[_0xfde9('0x1b')](_0x33e911);};}exports[_0xfde9('0x1c')]=function(_0x202fc8,_0x29e597){var _0x258e36={};var _0x38e2bd=_[_0xfde9('0x1d')](db[_0xfde9('0x1e')]['rawAttributes'],function(_0x4f0566){return{'name':_0x4f0566[_0xfde9('0x1f')],'type':_0x4f0566[_0xfde9('0x20')]['key']};});_0x258e36=qs[_0xfde9('0x21')](_0x38e2bd,_0x202fc8);return interaction[_0xfde9('0x22')](_0xfde9('0x23'),_0x202fc8['query'],_0x202fc8[_0xfde9('0x24')],_0x258e36,_0x38e2bd)[_0xfde9('0x16')](respondWithFilteredResult(_0x29e597,_0x258e36))[_0xfde9('0x25')](handleError(_0x29e597,null));};exports[_0xfde9('0x26')]=function(_0x2d509e,_0x21c2be){var _0x6d10bc={'raw':![],'where':{'id':_0x2d509e[_0xfde9('0x27')]['id']}},_0x55337c={};_0x55337c[_0xfde9('0x28')]=_[_0xfde9('0x29')](db[_0xfde9('0x1e')][_0xfde9('0x2a')]);_0x55337c[_0xfde9('0x2b')]=_[_0xfde9('0x29')](_0x2d509e['query']);_0x55337c[_0xfde9('0x2c')]=_[_0xfde9('0x2d')](_0x55337c['model'],_0x55337c[_0xfde9('0x2b')]);_0x6d10bc[_0xfde9('0x2e')]=_[_0xfde9('0x2d')](_0x55337c['model'],qs[_0xfde9('0x2f')](_0x2d509e['query']['fields']));_0x6d10bc[_0xfde9('0x2e')]=_0x6d10bc[_0xfde9('0x2e')][_0xfde9('0x30')]?_0x6d10bc[_0xfde9('0x2e')]:_0x55337c[_0xfde9('0x28')];if(_0x2d509e[_0xfde9('0x2b')][_0xfde9('0x31')]){_0x6d10bc[_0xfde9('0x32')]=[{'all':!![]}];}_0x6d10bc=_[_0xfde9('0x33')]({},_0x6d10bc,_0x2d509e[_0xfde9('0x34')]);return db[_0xfde9('0x1e')]['find'](_0x6d10bc)[_0xfde9('0x16')](handleEntityNotFound(_0x21c2be,null))[_0xfde9('0x16')](respondWithResult(_0x21c2be,null))['catch'](handleError(_0x21c2be,null));};exports['create']=function(_0x397d14,_0x4b03d2){return db[_0xfde9('0x1e')]['create'](_0x397d14[_0xfde9('0x35')],{})[_0xfde9('0x16')](respondWithResult(_0x4b03d2,0xc9))[_0xfde9('0x25')](handleError(_0x4b03d2,null));};exports[_0xfde9('0x15')]=function(_0x8044ab,_0x271dad){if(_0x8044ab[_0xfde9('0x35')]['id']){delete _0x8044ab['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x8044ab[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x271dad,null))[_0xfde9('0x16')](saveUpdates(_0x8044ab[_0xfde9('0x35')],null))[_0xfde9('0x16')](respondWithResult(_0x271dad,null))[_0xfde9('0x25')](handleError(_0x271dad,null));};exports['destroy']=function(_0x2d051d,_0x285c21){return db[_0xfde9('0x1e')][_0xfde9('0x36')]({'where':{'id':_0x2d051d[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x285c21,null))[_0xfde9('0x16')](removeEntity(_0x285c21,null))[_0xfde9('0x25')](handleError(_0x285c21,null));};exports[_0xfde9('0x37')]=function(_0xebfac8,_0x2d0c52){return db['FaxInteraction'][_0xfde9('0x37')]()[_0xfde9('0x16')](respondWithResult(_0x2d0c52,null))[_0xfde9('0x25')](handleError(_0x2d0c52,null));};exports[_0xfde9('0x38')]=function(_0x21f5c7,_0x32861b){return db[_0xfde9('0x39')][_0xfde9('0x36')]({'where':{'id':_0x21f5c7[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x32861b,null))[_0xfde9('0x16')](function(_0x31ddca){if(_0x31ddca){return _0x31ddca[_0xfde9('0x38')](_0x21f5c7['body']['ids'],_['omit'](_0x21f5c7[_0xfde9('0x35')],['ids','id'])||{});}})[_0xfde9('0x16')](respondWithResult(_0x32861b,null))['catch'](handleError(_0x32861b,null));};exports[_0xfde9('0x3a')]=function(_0x7fd46e,_0x2a5367){var _0x5a2450={'raw':![],'where':{}};var _0x4dc4cb={};var _0x575ad1={'count':0x0,'rows':[]};return db[_0xfde9('0x1e')][_0xfde9('0x3b')]({'where':{'id':_0x7fd46e[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x2a5367,null))['then'](function(_0x4465e0){if(_0x4465e0){_0x4dc4cb[_0xfde9('0x28')]=_[_0xfde9('0x29')](db[_0xfde9('0x39')][_0xfde9('0x2a')]);_0x4dc4cb[_0xfde9('0x2b')]=_[_0xfde9('0x29')](_0x7fd46e[_0xfde9('0x2b')]);_0x4dc4cb['filters']=_[_0xfde9('0x2d')](_0x4dc4cb[_0xfde9('0x28')],_0x4dc4cb[_0xfde9('0x2b')]);_0x5a2450[_0xfde9('0x2e')]=_[_0xfde9('0x2d')](_0x4dc4cb[_0xfde9('0x28')],qs['fields'](_0x7fd46e['query'][_0xfde9('0x2f')]));_0x5a2450[_0xfde9('0x2e')]=_0x5a2450[_0xfde9('0x2e')][_0xfde9('0x30')]?_0x5a2450[_0xfde9('0x2e')]:_0x4dc4cb[_0xfde9('0x28')];if(!_0x7fd46e['query']['hasOwnProperty']('nolimit')){_0x5a2450['limit']=qs[_0xfde9('0x12')](_0x7fd46e[_0xfde9('0x2b')]['limit']);_0x5a2450[_0xfde9('0x10')]=qs[_0xfde9('0x10')](_0x7fd46e['query'][_0xfde9('0x10')]);}_0x5a2450[_0xfde9('0x3c')]=qs[_0xfde9('0x3d')](_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3d')]);_0x5a2450[_0xfde9('0x3e')]=qs[_0xfde9('0x2c')](_['pick'](_0x7fd46e[_0xfde9('0x2b')],_0x4dc4cb[_0xfde9('0x2c')]));_0x5a2450['where']['FaxInteractionId']=_0x4465e0['id'];if(_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3f')]){_0x5a2450['where']=_['merge'](_0x5a2450[_0xfde9('0x3e')],{'$or':_[_0xfde9('0x1d')](_0x5a2450[_0xfde9('0x2e')],function(_0x28bd17){var _0x54f361={};_0x54f361[_0x28bd17]={'$like':'%'+_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x3f')]+'%'};return _0x54f361;})});}if(_0x7fd46e[_0xfde9('0x2b')][_0xfde9('0x40')]){var _0x475606=_0x7fd46e[_0xfde9('0x2b')]['$gte'][_0xfde9('0x41')](',');var _0x376cc6={};_0x376cc6[_0x475606[0x0]]={'$gte':moment(_0x475606[0x1])[_0xfde9('0x42')](_0xfde9('0x43'))};_0x5a2450[_0xfde9('0x3e')]=_[_0xfde9('0x33')](_0x5a2450[_0xfde9('0x3e')],_0x376cc6);}_0x5a2450=_[_0xfde9('0x33')]({},_0x5a2450,_0x7fd46e['options']);return db[_0xfde9('0x39')]['count']({'where':_0x5a2450[_0xfde9('0x3e')]})[_0xfde9('0x16')](function(_0x26e2e8){_0x575ad1['count']=_0x26e2e8;if(_0x7fd46e[_0xfde9('0x2b')]['includeAll']){_0x5a2450['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5a2450);})[_0xfde9('0x16')](function(_0x4ab33e){_0x575ad1['rows']=_0x4ab33e;return _0x575ad1;});}})[_0xfde9('0x16')](respondWithFilteredResult(_0x2a5367,_0x5a2450))['catch'](handleError(_0x2a5367,null));};exports['addTags']=function(_0x9472bf,_0x420719){return db['FaxInteraction']['find']({'where':{'id':_0x9472bf[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x420719,null))['then'](function(_0xb817fd){if(_0xb817fd){return _0xb817fd[_0xfde9('0x44')](_0x9472bf['body'][_0xfde9('0x45')],_[_0xfde9('0x46')](_0x9472bf[_0xfde9('0x35')],[_0xfde9('0x45'),'id'])||{})[_0xfde9('0x47')](function(){return db[_0xfde9('0x48')][_0xfde9('0x22')]({'attributes':['id',_0xfde9('0x1a'),_0xfde9('0x49')],'where':{'id':_0x9472bf['body'][_0xfde9('0x45')]}});})[_0xfde9('0x16')](function(_0x3d68d0){socket[_0xfde9('0x4a')](_0xfde9('0x4b'),{'id':Number(_0x9472bf['params']['id']),'tags':_0x3d68d0||[]});return{'id':Number(_0x9472bf[_0xfde9('0x27')]['id']),'tags':_0x3d68d0||[]};});}})['then'](respondWithResult(_0x420719,null))[_0xfde9('0x25')](handleError(_0x420719,null));};exports[_0xfde9('0x4c')]=function(_0x9a8f00,_0x5073d0){return db['FaxInteraction'][_0xfde9('0x36')]({'where':{'id':_0x9a8f00[_0xfde9('0x27')]['id']}})[_0xfde9('0x16')](handleEntityNotFound(_0x5073d0,null))[_0xfde9('0x16')](function(_0x14a31c){if(_0x14a31c){return _0x14a31c[_0xfde9('0x4c')](_0x9a8f00[_0xfde9('0x2b')][_0xfde9('0x45')]);}})['then'](respondWithStatusCode(_0x5073d0,null))[_0xfde9('0x25')](handleError(_0x5073d0,null));};exports['download']=function(_0x3c3545,_0x43f397){var _0x28fd71=moment()['unix']()[_0xfde9('0x4d')]();var _0x187ac9=path[_0xfde9('0x4e')](config[_0xfde9('0x4f')],'server',_0xfde9('0x50'),_0xfde9('0x51'));var _0xad0008=path['join'](config[_0xfde9('0x4f')],_0xfde9('0x52'),'files',_0xfde9('0x53'));var _0x18936a=path[_0xfde9('0x4e')](_0x187ac9,_0x28fd71);var _0x18e5da=util[_0xfde9('0x42')]('transcript-%d-%s.zip',_0x3c3545[_0xfde9('0x27')]['id'],_0x28fd71);var _0x1d606b=path['join'](_0x187ac9,_0x18e5da);var _0x277bc7=[];_0x277bc7[_0xfde9('0x54')]({'model':db[_0xfde9('0x55')],'as':'Attachment','raw':!![]});var _0xa08803=[{'model':db['FaxMessage'],'as':_0xfde9('0x56'),'attributes':['id',_0xfde9('0x35'),_0xfde9('0x57')],'include':_0x277bc7}];return db[_0xfde9('0x1e')][_0xfde9('0x36')]({'where':{'id':_0x3c3545['params']['id']},'include':_0xa08803})[_0xfde9('0x16')](handleEntityNotFound(_0x43f397,null))['then'](function(_0x430c54){if(_0x430c54&&_0x430c54[_0xfde9('0x56')]){var _0x22d9ab=_0x430c54[_0xfde9('0x58')]({'plain':!![]});fs[_0xfde9('0x59')](_0x18936a);for(var _0x35c68d=0x0;_0x35c68d<_0x22d9ab['Messages']['length'];_0x35c68d++){var _0x350bf0=_0x22d9ab[_0xfde9('0x56')][_0x35c68d][_0xfde9('0x55')];if(_0x350bf0){var _0x50c721=path[_0xfde9('0x4e')](_0xad0008,_0x350bf0[_0xfde9('0x5a')]);if(fs[_0xfde9('0x5b')](_0x50c721)){fs[_0xfde9('0x5c')](_0x50c721)[_0xfde9('0x5d')](fs[_0xfde9('0x5e')](path[_0xfde9('0x4e')](_0x18936a,_0x350bf0['basename'])));}}}return BPromise[_0xfde9('0x5f')]()[_0xfde9('0x16')](function(){return new BPromise(function(_0x537af4,_0x514260){zipdir(_0x18936a,{'saveTo':_0x1d606b},function(_0x164971,_0x1fb230){if(_0x164971)return _0x514260(_0x164971);return _0x537af4(_0x1fb230);});})[_0xfde9('0x16')](function(){return new BPromise(function(_0x3470ec,_0x34eed5){rimraf(_0x18936a,function(_0x4e8d30){if(_0x4e8d30)_0x34eed5(_0x4e8d30);return _0x3470ec();});});})[_0xfde9('0x16')](function(){return _0x43f397[_0xfde9('0x60')](_0x1d606b,_0x18e5da,function(_0x4ec638){if(_0x4ec638){console[_0xfde9('0x61')]('err',_0x4ec638);}else{fs[_0xfde9('0x62')](_0x1d606b);}});});});}else{return _0x43f397[_0xfde9('0xc')](0xc8);}})[_0xfde9('0x25')](handleError(_0x43f397,null));}; \ No newline at end of file +var _0x0ea1=['findOne','FaxMessage','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','ids','spread','Tag','faxInteractionTags:save','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','createWriteStream','resolve','download','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','then','destroy','stack','name','index','map','FaxInteraction','rawAttributes','type','key','getOptions','fax','user','params','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','addMessage','omit'];(function(_0x75b87,_0xc195ac){var _0x3998c9=function(_0xf8b1bf){while(--_0xf8b1bf){_0x75b87['push'](_0x75b87['shift']());}};_0x3998c9(++_0xc195ac);}(_0x0ea1,0xe9));var _0x10ea=function(_0x20b540,_0x35672b){_0x20b540=_0x20b540-0x0;var _0x28a370=_0x0ea1[_0x20b540];return _0x28a370;};'use strict';var rimraf=require(_0x10ea('0x0'));var zipdir=require(_0x10ea('0x1'));var moment=require(_0x10ea('0x2'));var BPromise=require('bluebird');var util=require(_0x10ea('0x3'));var path=require(_0x10ea('0x4'));var fs=require('fs');var _=require(_0x10ea('0x5'));var Redis=require(_0x10ea('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x10ea('0x7'));var logger=require(_0x10ea('0x8'))(_0x10ea('0x9'));var config=require(_0x10ea('0xa'));var db=require(_0x10ea('0xb'))['db'];config[_0x10ea('0xc')]=_[_0x10ea('0xd')](config[_0x10ea('0xc')],{'host':_0x10ea('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x10ea('0xf'))['register'](socket);function respondWithStatusCode(_0x564e45,_0x322d40){_0x322d40=_0x322d40||0xcc;return function(_0x327fc8){if(_0x327fc8){return _0x564e45[_0x10ea('0x10')](_0x322d40);}return _0x564e45[_0x10ea('0x11')](_0x322d40)[_0x10ea('0x12')]();};}function respondWithResult(_0x2fc942,_0x304164){_0x304164=_0x304164||0xc8;return function(_0x472f37){if(_0x472f37){return _0x2fc942['status'](_0x304164)['json'](_0x472f37);}};}function respondWithFilteredResult(_0x13fee1,_0x3c33b3){return function(_0x570f2e){if(_0x570f2e){var _0xfa8893=typeof _0x3c33b3[_0x10ea('0x13')]===_0x10ea('0x14')&&typeof _0x3c33b3[_0x10ea('0x15')]===_0x10ea('0x14');var _0x50763e=_0x570f2e[_0x10ea('0x16')];var _0x50ffe9=_0xfa8893?0x0:_0x3c33b3['offset'];var _0x32f3fe=_0xfa8893?_0x570f2e[_0x10ea('0x16')]:_0x3c33b3[_0x10ea('0x13')]+_0x3c33b3[_0x10ea('0x15')];var _0x51f521;if(_0x32f3fe>=_0x50763e){_0x32f3fe=_0x50763e;_0x51f521=0xc8;}else{_0x51f521=0xce;}_0x13fee1[_0x10ea('0x11')](_0x51f521);return _0x13fee1[_0x10ea('0x17')]('Content-Range',_0x50ffe9+'-'+_0x32f3fe+'/'+_0x50763e)[_0x10ea('0x18')](_0x570f2e);}return null;};}function saveUpdates(_0x5becb1){return function(_0x4e3100){if(_0x4e3100){return _0x4e3100['update'](_0x5becb1)[_0x10ea('0x19')](function(_0x5698b2){return _0x5698b2;});}return null;};}function removeEntity(_0x33562a){return function(_0x595cf2){if(_0x595cf2){return _0x595cf2[_0x10ea('0x1a')]()['then'](function(){_0x33562a[_0x10ea('0x11')](0xcc)[_0x10ea('0x12')]();});}};}function handleEntityNotFound(_0x29849f){return function(_0x11ee6a){if(!_0x11ee6a){_0x29849f[_0x10ea('0x10')](0x194);}return _0x11ee6a;};}function handleError(_0x843799,_0x537cf7){_0x537cf7=_0x537cf7||0x1f4;return function(_0x11b32d){logger['error'](_0x11b32d[_0x10ea('0x1b')]);if(_0x11b32d[_0x10ea('0x1c')]){delete _0x11b32d[_0x10ea('0x1c')];}_0x843799[_0x10ea('0x11')](_0x537cf7)['send'](_0x11b32d);};}exports[_0x10ea('0x1d')]=function(_0x1dfa25,_0x4b536b){var _0x255bb7={};var _0x148eb3=_[_0x10ea('0x1e')](db[_0x10ea('0x1f')][_0x10ea('0x20')],function(_0x44e832){return{'name':_0x44e832['fieldName'],'type':_0x44e832[_0x10ea('0x21')][_0x10ea('0x22')]};});_0x255bb7=qs[_0x10ea('0x23')](_0x148eb3,_0x1dfa25);return interaction['findAll'](_0x10ea('0x24'),_0x1dfa25['query'],_0x1dfa25[_0x10ea('0x25')],_0x255bb7,_0x148eb3)[_0x10ea('0x19')](respondWithFilteredResult(_0x4b536b,_0x255bb7))['catch'](handleError(_0x4b536b,null));};exports['show']=function(_0x528886,_0x147c6b){var _0x489d30={'raw':![],'where':{'id':_0x528886[_0x10ea('0x26')]['id']}},_0x27cde2={};_0x27cde2[_0x10ea('0x27')]=_['keys'](db[_0x10ea('0x1f')][_0x10ea('0x20')]);_0x27cde2['query']=_[_0x10ea('0x28')](_0x528886['query']);_0x27cde2[_0x10ea('0x29')]=_[_0x10ea('0x2a')](_0x27cde2[_0x10ea('0x27')],_0x27cde2[_0x10ea('0x2b')]);_0x489d30[_0x10ea('0x2c')]=_[_0x10ea('0x2a')](_0x27cde2[_0x10ea('0x27')],qs[_0x10ea('0x2d')](_0x528886[_0x10ea('0x2b')][_0x10ea('0x2d')]));_0x489d30['attributes']=_0x489d30['attributes'][_0x10ea('0x2e')]?_0x489d30[_0x10ea('0x2c')]:_0x27cde2[_0x10ea('0x27')];if(_0x528886[_0x10ea('0x2b')][_0x10ea('0x2f')]){_0x489d30[_0x10ea('0x30')]=[{'all':!![]}];}_0x489d30=_[_0x10ea('0x31')]({},_0x489d30,_0x528886[_0x10ea('0x32')]);return db[_0x10ea('0x1f')][_0x10ea('0x33')](_0x489d30)['then'](handleEntityNotFound(_0x147c6b,null))[_0x10ea('0x19')](respondWithResult(_0x147c6b,null))[_0x10ea('0x34')](handleError(_0x147c6b,null));};exports['create']=function(_0x5cb5be,_0x25562c){return db[_0x10ea('0x1f')][_0x10ea('0x35')](_0x5cb5be[_0x10ea('0x36')],{})[_0x10ea('0x19')](respondWithResult(_0x25562c,0xc9))[_0x10ea('0x34')](handleError(_0x25562c,null));};exports[_0x10ea('0x37')]=function(_0x5865dc,_0x1e75ef){if(_0x5865dc[_0x10ea('0x36')]['id']){delete _0x5865dc[_0x10ea('0x36')]['id'];}return db[_0x10ea('0x1f')]['find']({'where':{'id':_0x5865dc[_0x10ea('0x26')]['id']}})[_0x10ea('0x19')](handleEntityNotFound(_0x1e75ef,null))['then'](saveUpdates(_0x5865dc['body'],null))[_0x10ea('0x19')](respondWithResult(_0x1e75ef,null))['catch'](handleError(_0x1e75ef,null));};exports[_0x10ea('0x1a')]=function(_0x250931,_0x648b18){return db['FaxInteraction'][_0x10ea('0x33')]({'where':{'id':_0x250931[_0x10ea('0x26')]['id']}})['then'](handleEntityNotFound(_0x648b18,null))[_0x10ea('0x19')](removeEntity(_0x648b18,null))['catch'](handleError(_0x648b18,null));};exports['describe']=function(_0x7cd8cc,_0x36d80c){return db['FaxInteraction']['describe']()[_0x10ea('0x19')](respondWithResult(_0x36d80c,null))[_0x10ea('0x34')](handleError(_0x36d80c,null));};exports[_0x10ea('0x38')]=function(_0x43406b,_0x407834){return db['FaxMessage'][_0x10ea('0x33')]({'where':{'id':_0x43406b[_0x10ea('0x26')]['id']}})[_0x10ea('0x19')](handleEntityNotFound(_0x407834,null))[_0x10ea('0x19')](function(_0xcc6602){if(_0xcc6602){return _0xcc6602[_0x10ea('0x38')](_0x43406b['body']['ids'],_[_0x10ea('0x39')](_0x43406b[_0x10ea('0x36')],['ids','id'])||{});}})[_0x10ea('0x19')](respondWithResult(_0x407834,null))[_0x10ea('0x34')](handleError(_0x407834,null));};exports['getMessages']=function(_0x25eb49,_0x56f9a1){var _0x23fccb={'raw':![],'where':{}};var _0x504ebc={};var _0x86df0={'count':0x0,'rows':[]};return db[_0x10ea('0x1f')][_0x10ea('0x3a')]({'where':{'id':_0x25eb49['params']['id']}})['then'](handleEntityNotFound(_0x56f9a1,null))[_0x10ea('0x19')](function(_0x1bad36){if(_0x1bad36){_0x504ebc[_0x10ea('0x27')]=_['keys'](db[_0x10ea('0x3b')][_0x10ea('0x20')]);_0x504ebc[_0x10ea('0x2b')]=_[_0x10ea('0x28')](_0x25eb49[_0x10ea('0x2b')]);_0x504ebc[_0x10ea('0x29')]=_[_0x10ea('0x2a')](_0x504ebc[_0x10ea('0x27')],_0x504ebc['query']);_0x23fccb[_0x10ea('0x2c')]=_[_0x10ea('0x2a')](_0x504ebc['model'],qs[_0x10ea('0x2d')](_0x25eb49['query'][_0x10ea('0x2d')]));_0x23fccb[_0x10ea('0x2c')]=_0x23fccb['attributes'][_0x10ea('0x2e')]?_0x23fccb[_0x10ea('0x2c')]:_0x504ebc[_0x10ea('0x27')];if(!_0x25eb49['query'][_0x10ea('0x3c')](_0x10ea('0x3d'))){_0x23fccb[_0x10ea('0x15')]=qs[_0x10ea('0x15')](_0x25eb49[_0x10ea('0x2b')][_0x10ea('0x15')]);_0x23fccb[_0x10ea('0x13')]=qs[_0x10ea('0x13')](_0x25eb49[_0x10ea('0x2b')][_0x10ea('0x13')]);}_0x23fccb[_0x10ea('0x3e')]=qs[_0x10ea('0x3f')](_0x25eb49[_0x10ea('0x2b')][_0x10ea('0x3f')]);_0x23fccb['where']=qs['filters'](_['pick'](_0x25eb49[_0x10ea('0x2b')],_0x504ebc['filters']));_0x23fccb[_0x10ea('0x40')]['FaxInteractionId']=_0x1bad36['id'];if(_0x25eb49[_0x10ea('0x2b')][_0x10ea('0x41')]){_0x23fccb['where']=_['merge'](_0x23fccb[_0x10ea('0x40')],{'$or':_['map'](_0x23fccb[_0x10ea('0x2c')],function(_0x53bdba){var _0x17f2c4={};_0x17f2c4[_0x53bdba]={'$like':'%'+_0x25eb49[_0x10ea('0x2b')]['filter']+'%'};return _0x17f2c4;})});}if(_0x25eb49['query']['$gte']){var _0x4fdbce=_0x25eb49['query'][_0x10ea('0x42')][_0x10ea('0x43')](',');var _0xed8042={};_0xed8042[_0x4fdbce[0x0]]={'$gte':moment(_0x4fdbce[0x1])[_0x10ea('0x44')](_0x10ea('0x45'))};_0x23fccb[_0x10ea('0x40')]=_[_0x10ea('0x31')](_0x23fccb[_0x10ea('0x40')],_0xed8042);}_0x23fccb=_[_0x10ea('0x31')]({},_0x23fccb,_0x25eb49[_0x10ea('0x32')]);return db[_0x10ea('0x3b')]['count']({'where':_0x23fccb['where']})[_0x10ea('0x19')](function(_0x47b698){_0x86df0['count']=_0x47b698;if(_0x25eb49['query'][_0x10ea('0x2f')]){_0x23fccb[_0x10ea('0x30')]=[{'all':!![]}];}return db['FaxMessage'][_0x10ea('0x46')](_0x23fccb);})[_0x10ea('0x19')](function(_0x32df89){_0x86df0['rows']=_0x32df89;return _0x86df0;});}})[_0x10ea('0x19')](respondWithFilteredResult(_0x56f9a1,_0x23fccb))[_0x10ea('0x34')](handleError(_0x56f9a1,null));};exports[_0x10ea('0x47')]=function(_0x5b6f56,_0x263e4c){return db[_0x10ea('0x1f')][_0x10ea('0x33')]({'where':{'id':_0x5b6f56[_0x10ea('0x26')]['id']}})[_0x10ea('0x19')](handleEntityNotFound(_0x263e4c,null))['then'](function(_0x15303b){if(_0x15303b){return _0x15303b['setTags'](_0x5b6f56[_0x10ea('0x36')]['ids'],_[_0x10ea('0x39')](_0x5b6f56['body'],[_0x10ea('0x48'),'id'])||{})[_0x10ea('0x49')](function(){return db[_0x10ea('0x4a')]['findAll']({'attributes':['id',_0x10ea('0x1c'),'color'],'where':{'id':_0x5b6f56[_0x10ea('0x36')][_0x10ea('0x48')]}});})[_0x10ea('0x19')](function(_0x6d5720){socket['emit'](_0x10ea('0x4b'),{'id':Number(_0x5b6f56[_0x10ea('0x26')]['id']),'tags':_0x6d5720||[]});return{'id':Number(_0x5b6f56[_0x10ea('0x26')]['id']),'tags':_0x6d5720||[]};});}})['then'](respondWithResult(_0x263e4c,null))[_0x10ea('0x34')](handleError(_0x263e4c,null));};exports['removeTags']=function(_0x471684,_0x3fc52f){return db['FaxInteraction'][_0x10ea('0x33')]({'where':{'id':_0x471684[_0x10ea('0x26')]['id']}})[_0x10ea('0x19')](handleEntityNotFound(_0x3fc52f,null))[_0x10ea('0x19')](function(_0x170e2a){if(_0x170e2a){return _0x170e2a['removeTags'](_0x471684[_0x10ea('0x2b')]['ids']);}})[_0x10ea('0x19')](respondWithStatusCode(_0x3fc52f,null))[_0x10ea('0x34')](handleError(_0x3fc52f,null));};exports['download']=function(_0xe24acb,_0x53d5d8){var _0x1d2c72=moment()[_0x10ea('0x4c')]()[_0x10ea('0x4d')]();var _0x15ed9f=path[_0x10ea('0x4e')](config[_0x10ea('0x4f')],_0x10ea('0x50'),_0x10ea('0x51'),_0x10ea('0x52'));var _0x4a5b38=path[_0x10ea('0x4e')](config['root'],_0x10ea('0x50'),_0x10ea('0x51'),_0x10ea('0x53'));var _0x46e6bf=path['join'](_0x15ed9f,_0x1d2c72);var _0x2a26ab=util[_0x10ea('0x44')]('transcript-%d-%s.zip',_0xe24acb[_0x10ea('0x26')]['id'],_0x1d2c72);var _0x569bbb=path[_0x10ea('0x4e')](_0x15ed9f,_0x2a26ab);var _0x548b69=[];_0x548b69[_0x10ea('0x54')]({'model':db[_0x10ea('0x55')],'as':_0x10ea('0x55'),'raw':!![]});var _0x28d97d=[{'model':db[_0x10ea('0x3b')],'as':_0x10ea('0x56'),'attributes':['id','body','createdAt'],'include':_0x548b69}];return db['FaxInteraction'][_0x10ea('0x33')]({'where':{'id':_0xe24acb[_0x10ea('0x26')]['id']},'include':_0x28d97d})['then'](handleEntityNotFound(_0x53d5d8,null))[_0x10ea('0x19')](function(_0x10421e){if(_0x10421e&&_0x10421e[_0x10ea('0x56')]){var _0x23a121=_0x10421e[_0x10ea('0x57')]({'plain':!![]});fs[_0x10ea('0x58')](_0x46e6bf);for(var _0x2d5cca=0x0;_0x2d5cca<_0x23a121[_0x10ea('0x56')]['length'];_0x2d5cca++){var _0x478edd=_0x23a121[_0x10ea('0x56')][_0x2d5cca][_0x10ea('0x55')];if(_0x478edd){var _0x5cbd10=path[_0x10ea('0x4e')](_0x4a5b38,_0x478edd['basename']);if(fs[_0x10ea('0x59')](_0x5cbd10)){fs[_0x10ea('0x5a')](_0x5cbd10)['pipe'](fs[_0x10ea('0x5b')](path['join'](_0x46e6bf,_0x478edd['basename'])));}}}return BPromise[_0x10ea('0x5c')]()['then'](function(){return new BPromise(function(_0x85fa4a,_0x3dca60){zipdir(_0x46e6bf,{'saveTo':_0x569bbb},function(_0x32e955,_0x2e52e8){if(_0x32e955)return _0x3dca60(_0x32e955);return _0x85fa4a(_0x2e52e8);});})[_0x10ea('0x19')](function(){return new BPromise(function(_0x55207e,_0x4f7643){rimraf(_0x46e6bf,function(_0x51bdd9){if(_0x51bdd9)_0x4f7643(_0x51bdd9);return _0x55207e();});});})[_0x10ea('0x19')](function(){return _0x53d5d8[_0x10ea('0x5d')](_0x569bbb,_0x2a26ab,function(_0x11774b){if(_0x11774b){console[_0x10ea('0x5e')](_0x10ea('0x5f'),_0x11774b);}else{fs[_0x10ea('0x60')](_0x569bbb);}});});});}else{return _0x53d5d8[_0x10ea('0x10')](0xc8);}})[_0x10ea('0x34')](handleError(_0x53d5d8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 92c141e..ee7b2ab 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 _0x833c=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','getUsers','setDataValue','Users','map','then'];(function(_0x5bb90a,_0x5a16ad){var _0x5f267b=function(_0x4e6a09){while(--_0x4e6a09){_0x5bb90a['push'](_0x5bb90a['shift']());}};_0x5f267b(++_0x5a16ad);}(_0x833c,0x128));var _0xc833=function(_0x4b8b02,_0x314efc){_0x4b8b02=_0x4b8b02-0x0;var _0x404f9a=_0x833c[_0x4b8b02];return _0x404f9a;};'use strict';var EventEmitter=require(_0xc833('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xc833('0x1'))['db'][_0xc833('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc833('0x3'),'afterUpdate':_0xc833('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5338dc){return function(_0x34a87c,_0x26fd81,_0x2af1a8){_0x34a87c[_0xc833('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x192fc6){_0x34a87c[_0xc833('0x6')](_0xc833('0x7'),_0x192fc6[_0xc833('0x8')](function(_0x27e4c8){return{'id':_0x27e4c8['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x34a87c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc833('0x9')](function(_0x236600){_0x34a87c[_0xc833('0x6')](_0xc833('0xa'),_0x236600[_0xc833('0xb')]);FaxInteractionEvents[_0xc833('0xc')](_0x5338dc+':'+_0x34a87c['id'],_0x34a87c);FaxInteractionEvents[_0xc833('0xc')](_0x5338dc,_0x34a87c);_0x2af1a8(null);})[_0xc833('0xd')](_0x2af1a8(null));};}for(var e in events){if(events[_0xc833('0xe')](e)){var event=events[e];FaxInteraction[_0xc833('0xf')](e,emitEvent(event));}}module[_0xc833('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xa1db=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','catch','hasOwnProperty'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xa1db,0x191));var _0xba1d=function(_0x1874ec,_0x599576){_0x1874ec=_0x1874ec-0x0;var _0x2e6308=_0xa1db[_0x1874ec];return _0x2e6308;};'use strict';var EventEmitter=require(_0xba1d('0x0'));var FaxInteraction=require(_0xba1d('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xba1d('0x1'))['db'][_0xba1d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xba1d('0x3')](0x0);var events={'afterCreate':_0xba1d('0x4'),'afterUpdate':_0xba1d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x242d13){return function(_0x12c7ee,_0x228e83,_0x2ae3bd){_0x12c7ee['getUsers']({'attributes':['id'],'raw':!![]})[_0xba1d('0x6')](function(_0x1c3de9){_0x12c7ee[_0xba1d('0x7')](_0xba1d('0x8'),_0x1c3de9[_0xba1d('0x9')](function(_0x1d7bdc){return{'id':_0x1d7bdc['id']};}));return FaxMessage[_0xba1d('0xa')]({'where':{'FaxInteractionId':_0x12c7ee['id'],'direction':'in','read':![]},'raw':!![]});})[_0xba1d('0x6')](function(_0x36c54a){_0x12c7ee[_0xba1d('0x7')](_0xba1d('0xb'),_0x36c54a[_0xba1d('0xc')]);FaxInteractionEvents['emit'](_0x242d13+':'+_0x12c7ee['id'],_0x12c7ee);FaxInteractionEvents['emit'](_0x242d13,_0x12c7ee);_0x2ae3bd(null);})[_0xba1d('0xd')](_0x2ae3bd(null));};}for(var e in events){if(events[_0xba1d('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xba1d('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8c03c2f..a4aa2cd 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 _0x3713=['../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe0f242,_0x2f4ecf){var _0x3b801a=function(_0x29d08c){while(--_0x29d08c){_0xe0f242['push'](_0xe0f242['shift']());}};_0x3b801a(++_0x2f4ecf);}(_0x3713,0xa2));var _0x3371=function(_0xc9e6d1,_0x24fc3d){_0xc9e6d1=_0xc9e6d1-0x0;var _0x56b3c0=_0x3713[_0xc9e6d1];return _0x56b3c0;};'use strict';var _=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var logger=require(_0x3371('0x2'))(_0x3371('0x3'));var moment=require(_0x3371('0x4'));var BPromise=require(_0x3371('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3371('0x6'));var rimraf=require(_0x3371('0x7'));var config=require(_0x3371('0x8'));var attributes=require(_0x3371('0x9'));module['exports']=function(_0xa8c99c,_0x3e28b2){return _0xa8c99c[_0x3371('0xa')](_0x3371('0xb'),attributes,{'tableName':_0x3371('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7a3228,_0x594c75,_0x5963e1){if(_0x7a3228[_0x3371('0xd')]('closed')){_0x7a3228[_0x3371('0xe')]=moment()[_0x3371('0xf')](_0x3371('0x10'));}_0x5963e1(null,_0x7a3228);}}});}; \ No newline at end of file +var _0xdb4d=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x39556c,_0x2270d9){var _0x41bcbe=function(_0x577a48){while(--_0x577a48){_0x39556c['push'](_0x39556c['shift']());}};_0x41bcbe(++_0x2270d9);}(_0xdb4d,0x77));var _0xddb4=function(_0x34b838,_0x5d3965){_0x34b838=_0x34b838-0x0;var _0x503e93=_0xdb4d[_0x34b838];return _0x503e93;};'use strict';var _=require(_0xddb4('0x0'));var util=require('util');var logger=require(_0xddb4('0x1'))('api');var moment=require(_0xddb4('0x2'));var BPromise=require(_0xddb4('0x3'));var rp=require(_0xddb4('0x4'));var fs=require('fs');var path=require(_0xddb4('0x5'));var rimraf=require(_0xddb4('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x7bbf36,_0x5c2002){return _0x7bbf36['define'](_0xddb4('0x7'),attributes,{'tableName':_0xddb4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47bf57,_0xf60e5a,_0x38ef40){if(_0x47bf57[_0xddb4('0x9')](_0xddb4('0xa'))){_0x47bf57[_0xddb4('0xb')]=moment()[_0xddb4('0xc')](_0xddb4('0xd'));}_0x38ef40(null,_0x47bf57);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3683515..c1e1e00 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 _0xa4db=['redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','UpdateFaxInteraction','update','body','options','where','attributes','limit','then','debug','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x33a17b,_0x4e04ff){var _0x57e182=function(_0x5a62b7){while(--_0x5a62b7){_0x33a17b['push'](_0x33a17b['shift']());}};_0x57e182(++_0x4e04ff);}(_0xa4db,0x9b));var _0xba4d=function(_0x55bfbb,_0x3a8a07){_0x55bfbb=_0x55bfbb-0x0;var _0x5ecbe0=_0xa4db[_0x55bfbb];return _0x5ecbe0;};'use strict';var _=require('lodash');var util=require(_0xba4d('0x0'));var moment=require(_0xba4d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba4d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xba4d('0x3'));var logger=require('../../config/logger')(_0xba4d('0x4'));var config=require(_0xba4d('0x5'));var jayson=require(_0xba4d('0x6'));var client=jayson[_0xba4d('0x7')][_0xba4d('0x8')]({'port':0x232a});config[_0xba4d('0x9')]=_['defaults'](config[_0xba4d('0x9')],{'host':_0xba4d('0xa'),'port':0x18eb});var socket=require(_0xba4d('0xb'))(new Redis(config[_0xba4d('0x9')]));require(_0xba4d('0xc'))[_0xba4d('0xd')](socket);function respondWithRpcPromise(_0x341ec9,_0x63fde9,_0xae223d){return new BPromise(function(_0x55de1b,_0x47a7fb){return client[_0xba4d('0xe')](_0x341ec9,_0xae223d)['then'](function(_0x2ffa8a){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x63fde9,_0xba4d('0xf'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x63fde9,_0xba4d('0xf'),JSON[_0xba4d('0x10')](_0x2ffa8a));if(_0x2ffa8a['error']){if(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x12')]===0x1f4){logger[_0xba4d('0x11')](_0xba4d('0x13'),_0x63fde9,_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);return _0x47a7fb(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x63fde9,_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);return _0x55de1b(_0x2ffa8a[_0xba4d('0x11')][_0xba4d('0x14')]);}else{logger[_0xba4d('0x15')](_0xba4d('0x13'),_0x63fde9,'request\x20sent');_0x55de1b(_0x2ffa8a[_0xba4d('0x16')][_0xba4d('0x14')]);}})['catch'](function(_0x22b9c4){logger[_0xba4d('0x11')](_0xba4d('0x13'),_0x63fde9,_0x22b9c4);_0x47a7fb(_0x22b9c4);});});}exports[_0xba4d('0x17')]=function(_0x1fa775){var _0x24cd7c=this;return new Promise(function(_0x34b39c,_0x26475d){return db['FaxInteraction'][_0xba4d('0x18')](_0x1fa775[_0xba4d('0x19')],{'raw':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')][_0xba4d('0x1b')]||null:null,'attributes':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775['options'][_0xba4d('0x1c')]||null:null,'limit':_0x1fa775[_0xba4d('0x1a')]?_0x1fa775[_0xba4d('0x1a')][_0xba4d('0x1d')]||null:null})[_0xba4d('0x1e')](function(_0x18bd8f){logger['info'](_0xba4d('0x17'),_0x1fa775);logger[_0xba4d('0x1f')](_0xba4d('0x17'),_0x1fa775,JSON[_0xba4d('0x10')](_0x18bd8f));_0x34b39c(_0x18bd8f);})[_0xba4d('0x20')](function(_0x479c3a){logger[_0xba4d('0x11')](_0xba4d('0x17'),_0x479c3a[_0xba4d('0x14')],_0x1fa775);_0x26475d(_0x24cd7c[_0xba4d('0x11')](0x1f4,_0x479c3a[_0xba4d('0x14')]));});});};exports[_0xba4d('0x21')]=function(_0x3511a3){return new Promise(function(_0x4ac1f7,_0x213abe){return db[_0xba4d('0x22')][_0xba4d('0x23')]({'where':_0x3511a3[_0xba4d('0x1a')]?_0x3511a3[_0xba4d('0x1a')][_0xba4d('0x1b')]||null:null})[_0xba4d('0x1e')](function(_0x3870b1){if(_0x3870b1){return _0x3870b1[_0xba4d('0x24')](_0x3511a3[_0xba4d('0x19')][_0xba4d('0x25')],_[_0xba4d('0x26')](_0x3511a3[_0xba4d('0x19')],[_0xba4d('0x25'),'id'])||{});}})[_0xba4d('0x27')](function(_0x59afa6){logger[_0xba4d('0x15')](_0xba4d('0x28'),_0x3511a3);logger[_0xba4d('0x1f')](_0xba4d('0x28'),_0x3511a3,JSON[_0xba4d('0x10')](_0x59afa6));_0x4ac1f7(_0x59afa6);})['catch'](function(_0x6cd528){logger[_0xba4d('0x11')](_0xba4d('0x28'),_0x6cd528['message'],_0x3511a3);_0x213abe(_this[_0xba4d('0x11')](0x1f4,_0x6cd528[_0xba4d('0x14')]));});});}; \ No newline at end of file +var _0x0621=['debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x0621,0x13e));var _0x1062=function(_0x80a8ca,_0x5bbcc9){_0x80a8ca=_0x80a8ca-0x0;var _0x4602f5=_0x0621[_0x80a8ca];return _0x4602f5;};'use strict';var _=require(_0x1062('0x0'));var util=require(_0x1062('0x1'));var moment=require('moment');var BPromise=require(_0x1062('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1062('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1062('0x4'));var jayson=require(_0x1062('0x5'));var client=jayson[_0x1062('0x6')][_0x1062('0x7')]({'port':0x232a});config[_0x1062('0x8')]=_[_0x1062('0x9')](config[_0x1062('0x8')],{'host':_0x1062('0xa'),'port':0x18eb});var socket=require(_0x1062('0xb'))(new Redis(config[_0x1062('0x8')]));require(_0x1062('0xc'))[_0x1062('0xd')](socket);function respondWithRpcPromise(_0x136e13,_0x1b3127,_0x37fbe2){return new BPromise(function(_0x568914,_0x27ab99){return client[_0x1062('0xe')](_0x136e13,_0x37fbe2)[_0x1062('0xf')](function(_0x1d39d4){logger[_0x1062('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x1b3127,_0x1062('0x11'));logger[_0x1062('0x12')](_0x1062('0x13'),_0x1b3127,_0x1062('0x11'),JSON[_0x1062('0x14')](_0x1d39d4));if(_0x1d39d4[_0x1062('0x15')]){if(_0x1d39d4[_0x1062('0x15')][_0x1062('0x16')]===0x1f4){logger[_0x1062('0x15')](_0x1062('0x17'),_0x1b3127,_0x1d39d4['error'][_0x1062('0x18')]);return _0x27ab99(_0x1d39d4[_0x1062('0x15')][_0x1062('0x18')]);}logger[_0x1062('0x15')](_0x1062('0x17'),_0x1b3127,_0x1d39d4[_0x1062('0x15')][_0x1062('0x18')]);return _0x568914(_0x1d39d4[_0x1062('0x15')][_0x1062('0x18')]);}else{logger[_0x1062('0x10')](_0x1062('0x17'),_0x1b3127,_0x1062('0x11'));_0x568914(_0x1d39d4[_0x1062('0x19')][_0x1062('0x18')]);}})[_0x1062('0x1a')](function(_0xe0e3b8){logger[_0x1062('0x15')](_0x1062('0x17'),_0x1b3127,_0xe0e3b8);_0x27ab99(_0xe0e3b8);});});}exports[_0x1062('0x1b')]=function(_0x426c64){var _0x3bbcaa=this;return new Promise(function(_0x4ae926,_0x233a61){return db[_0x1062('0x1c')][_0x1062('0x1d')](_0x426c64[_0x1062('0x1e')],{'raw':_0x426c64['options']?_0x426c64[_0x1062('0x1f')][_0x1062('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426c64[_0x1062('0x1f')]?_0x426c64[_0x1062('0x1f')][_0x1062('0x21')]||null:null,'attributes':_0x426c64[_0x1062('0x1f')]?_0x426c64['options'][_0x1062('0x22')]||null:null,'limit':_0x426c64[_0x1062('0x1f')]?_0x426c64[_0x1062('0x1f')][_0x1062('0x23')]||null:null})[_0x1062('0xf')](function(_0x1a1659){logger[_0x1062('0x10')](_0x1062('0x1b'),_0x426c64);logger[_0x1062('0x12')](_0x1062('0x1b'),_0x426c64,JSON[_0x1062('0x14')](_0x1a1659));_0x4ae926(_0x1a1659);})[_0x1062('0x1a')](function(_0x4ffb6d){logger[_0x1062('0x15')](_0x1062('0x1b'),_0x4ffb6d[_0x1062('0x18')],_0x426c64);_0x233a61(_0x3bbcaa[_0x1062('0x15')](0x1f4,_0x4ffb6d['message']));});});};exports[_0x1062('0x24')]=function(_0x4e0a2a){return new Promise(function(_0x40a65d,_0x3840f8){return db['FaxInteraction']['find']({'where':_0x4e0a2a[_0x1062('0x1f')]?_0x4e0a2a[_0x1062('0x1f')]['where']||null:null})[_0x1062('0xf')](function(_0x5824ed){if(_0x5824ed){return _0x5824ed[_0x1062('0x25')](_0x4e0a2a['body'][_0x1062('0x26')],_[_0x1062('0x27')](_0x4e0a2a[_0x1062('0x1e')],['ids','id'])||{});}})[_0x1062('0x28')](function(_0x8f963b){logger[_0x1062('0x10')](_0x1062('0x29'),_0x4e0a2a);logger[_0x1062('0x12')](_0x1062('0x29'),_0x4e0a2a,JSON['stringify'](_0x8f963b));_0x40a65d(_0x8f963b);})[_0x1062('0x1a')](function(_0x12edb4){logger[_0x1062('0x15')](_0x1062('0x29'),_0x12edb4[_0x1062('0x18')],_0x4e0a2a);_0x3840f8(_this[_0x1062('0x15')](0x1f4,_0x12edb4[_0x1062('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1f4d233..ac8ea98 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 _0xd3b5=['emit','removeListener','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x53a4b4,_0xc9d9d8){var _0x349bab=function(_0x2e28c8){while(--_0x2e28c8){_0x53a4b4['push'](_0x53a4b4['shift']());}};_0x349bab(++_0xc9d9d8);}(_0xd3b5,0x1ca));var _0x5d3b=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xd3b5[_0x597484];return _0x218e64;};'use strict';var FaxInteractionEvents=require(_0x5d3b('0x0'));var events=[_0x5d3b('0x1'),_0x5d3b('0x2'),_0x5d3b('0x3')];function createListener(_0x3133d2,_0x25b9f1){return function(_0x295641){_0x25b9f1[_0x5d3b('0x4')](_0x3133d2,_0x295641);};}function removeListener(_0x3e9ee5,_0x17c5d6){return function(){FaxInteractionEvents[_0x5d3b('0x5')](_0x3e9ee5,_0x17c5d6);};}exports['register']=function(_0x125bd8){for(var _0x55c069=0x0,_0x47a0ac=events['length'];_0x55c069<_0x47a0ac;_0x55c069++){var _0x5938d1=events[_0x55c069];var _0x39f148=createListener(_0x5d3b('0x6')+_0x5938d1,_0x125bd8);FaxInteractionEvents['on'](_0x5938d1,_0x39f148);}}; \ No newline at end of file +var _0xb455=['save','remove','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb455,0x97));var _0x5b45=function(_0x45eef3,_0x28e10c){_0x45eef3=_0x45eef3-0x0;var _0x19dcfe=_0xb455[_0x45eef3];return _0x19dcfe;};'use strict';var FaxInteractionEvents=require(_0x5b45('0x0'));var events=[_0x5b45('0x1'),_0x5b45('0x2'),_0x5b45('0x3')];function createListener(_0x3886fb,_0x807972){return function(_0x17475d){_0x807972[_0x5b45('0x4')](_0x3886fb,_0x17475d);};}function removeListener(_0x168aec,_0x2ccabf){return function(){FaxInteractionEvents[_0x5b45('0x5')](_0x168aec,_0x2ccabf);};}exports[_0x5b45('0x6')]=function(_0x390d8e){for(var _0x4811c6=0x0,_0x2b528b=events[_0x5b45('0x7')];_0x4811c6<_0x2b528b;_0x4811c6++){var _0x49f28a=events[_0x4811c6];var _0x5aded2=createListener('faxInteraction:'+_0x49f28a,_0x390d8e);FaxInteractionEvents['on'](_0x49f28a,_0x5aded2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4e251c6..29ad74c 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 _0x999b=['./faxInteraction.controller','isAuthenticated','index','get','show','/:id/messages','download','post','create','addMessage','tracked','addTags','put','/:id','fax','faxinteraction:update','faxinteraction:destroy','destroy','delete','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x525068,_0x2c7eef){var _0x21fbb1=function(_0x298a97){while(--_0x298a97){_0x525068['push'](_0x525068['shift']());}};_0x21fbb1(++_0x2c7eef);}(_0x999b,0xe4));var _0xb999=function(_0x305e97,_0x49872b){_0x305e97=_0x305e97-0x0;var _0x4e9428=_0x999b[_0x305e97];return _0x4e9428;};'use strict';var multer=require('multer');var util=require(_0xb999('0x0'));var path=require('path');var timeout=require(_0xb999('0x1'));var express=require(_0xb999('0x2'));var router=express[_0xb999('0x3')]();var fs_extra=require(_0xb999('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb999('0x5'));var controller=require(_0xb999('0x6'));router['get']('/',auth[_0xb999('0x7')](),controller[_0xb999('0x8')]);router[_0xb999('0x9')]('/describe',auth[_0xb999('0x7')](),controller['describe']);router[_0xb999('0x9')]('/:id',auth[_0xb999('0x7')](),controller[_0xb999('0xa')]);router[_0xb999('0x9')](_0xb999('0xb'),auth[_0xb999('0x7')](),controller['getMessages']);router[_0xb999('0x9')]('/:id/download',auth[_0xb999('0x7')](),controller[_0xb999('0xc')]);router[_0xb999('0xd')]('/',auth[_0xb999('0x7')](),controller[_0xb999('0xe')]);router[_0xb999('0xd')](_0xb999('0xb'),auth['isAuthenticated'](),controller[_0xb999('0xf')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xb999('0x10')]('fax','faxinteraction:addtags'),controller[_0xb999('0x11')]);router[_0xb999('0x12')](_0xb999('0x13'),auth['isAuthenticated'](),interaction[_0xb999('0x10')](_0xb999('0x14'),_0xb999('0x15')),controller['update']);router['delete']('/:id',auth[_0xb999('0x7')](),interaction[_0xb999('0x10')](_0xb999('0x14'),_0xb999('0x16')),controller[_0xb999('0x17')]);router[_0xb999('0x18')]('/:id/tags',auth[_0xb999('0x7')](),controller['removeTags']);module[_0xb999('0x19')]=router; \ No newline at end of file +var _0xa1dd=['index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get'];(function(_0x1227cf,_0x516c6c){var _0x2e6f4e=function(_0x57cf38){while(--_0x57cf38){_0x1227cf['push'](_0x1227cf['shift']());}};_0x2e6f4e(++_0x516c6c);}(_0xa1dd,0x1e5));var _0xda1d=function(_0x1d81aa,_0xee98b2){_0x1d81aa=_0x1d81aa-0x0;var _0x4e4bd9=_0xa1dd[_0x1d81aa];return _0x4e4bd9;};'use strict';var multer=require(_0xda1d('0x0'));var util=require('util');var path=require(_0xda1d('0x1'));var timeout=require(_0xda1d('0x2'));var express=require(_0xda1d('0x3'));var router=express[_0xda1d('0x4')]();var fs_extra=require(_0xda1d('0x5'));var auth=require(_0xda1d('0x6'));var interaction=require(_0xda1d('0x7'));var config=require('../../config/environment');var controller=require(_0xda1d('0x8'));router[_0xda1d('0x9')]('/',auth['isAuthenticated'](),controller[_0xda1d('0xa')]);router[_0xda1d('0x9')](_0xda1d('0xb'),auth[_0xda1d('0xc')](),controller[_0xda1d('0xd')]);router[_0xda1d('0x9')](_0xda1d('0xe'),auth[_0xda1d('0xc')](),controller[_0xda1d('0xf')]);router[_0xda1d('0x9')](_0xda1d('0x10'),auth[_0xda1d('0xc')](),controller['getMessages']);router[_0xda1d('0x9')](_0xda1d('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xda1d('0x12')]('/',auth[_0xda1d('0xc')](),controller[_0xda1d('0x13')]);router[_0xda1d('0x12')]('/:id/messages',auth[_0xda1d('0xc')](),controller['addMessage']);router[_0xda1d('0x12')](_0xda1d('0x14'),auth[_0xda1d('0xc')](),interaction['tracked'](_0xda1d('0x15'),_0xda1d('0x16')),controller[_0xda1d('0x17')]);router[_0xda1d('0x18')](_0xda1d('0xe'),auth[_0xda1d('0xc')](),interaction['tracked'](_0xda1d('0x15'),_0xda1d('0x19')),controller[_0xda1d('0x1a')]);router[_0xda1d('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0xda1d('0x1c')](_0xda1d('0x15'),_0xda1d('0x1d')),controller[_0xda1d('0x1e')]);router['delete'](_0xda1d('0x14'),auth['isAuthenticated'](),controller[_0xda1d('0x1f')]);module[_0xda1d('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ef91c3c..6514d4e 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 _0xe739=['DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xe739,0x105));var _0x9e73=function(_0x424695,_0x187393){_0x424695=_0x424695-0x0;var _0x1d696a=_0xe739[_0x424695];return _0x1d696a;};'use strict';var Sequelize=require(_0x9e73('0x0'));module['exports']={'body':{'type':Sequelize[_0x9e73('0x1')](_0x9e73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9e73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9e73('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e73('0x4')]}}; \ No newline at end of file +var _0x9589=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9589,0xbc));var _0x9958=function(_0x3e99be,_0x56480a){_0x3e99be=_0x3e99be-0x0;var _0xdc9066=_0x9589[_0x3e99be];return _0xdc9066;};'use strict';var Sequelize=require(_0x9958('0x0'));module[_0x9958('0x1')]={'body':{'type':Sequelize[_0x9958('0x2')](_0x9958('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9958('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9958('0x5')),'defaultValue':_0x9958('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9958('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 001b9bc..dcdcfaf 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 _0xd406=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','json','apply','reject','sendStatus','stack','name','send','index','fieldName','key','model','map','keys','filters','intersection','query','attributes','length','nolimit','order','where','pick','filter','type','VIRTUAL','merge','includeAll','FaxMessage','rows','show','rawAttributes','fields','options','update','body','find','params','destroy','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','RejectMessage','rejectMessage','User','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x20ee39,_0x452829){var _0x154545=function(_0x1c3f56){while(--_0x1c3f56){_0x20ee39['push'](_0x20ee39['shift']());}};_0x154545(++_0x452829);}(_0xd406,0x10e));var _0x6d40=function(_0x2ce96d,_0x4e760a){_0x2ce96d=_0x2ce96d-0x0;var _0x502f2f=_0xd406[_0x2ce96d];return _0x502f2f;};'use strict';var emlformat=require(_0x6d40('0x0'));var rimraf=require(_0x6d40('0x1'));var zipdir=require(_0x6d40('0x2'));var jsonpatch=require(_0x6d40('0x3'));var rp=require(_0x6d40('0x4'));var moment=require(_0x6d40('0x5'));var BPromise=require(_0x6d40('0x6'));var Mustache=require(_0x6d40('0x7'));var util=require(_0x6d40('0x8'));var path=require(_0x6d40('0x9'));var sox=require(_0x6d40('0xa'));var csv=require(_0x6d40('0xb'));var ejs=require(_0x6d40('0xc'));var fs=require('fs');var fs_extra=require(_0x6d40('0xd'));var _=require(_0x6d40('0xe'));var squel=require(_0x6d40('0xf'));var crypto=require('crypto');var jsforce=require(_0x6d40('0x10'));var deskjs=require(_0x6d40('0x11'));var toCsv=require(_0x6d40('0xb'));var querystring=require(_0x6d40('0x12'));var Papa=require('papaparse');var Redis=require(_0x6d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6d40('0x14'));var as=require(_0x6d40('0x15'));var hardwareService=require(_0x6d40('0x16'));var logger=require('../../config/logger')(_0x6d40('0x17'));var utils=require('../../config/utils');var config=require(_0x6d40('0x18'));var licenseUtil=require(_0x6d40('0x19'));var db=require(_0x6d40('0x1a'))['db'];config[_0x6d40('0x1b')]=_[_0x6d40('0x1c')](config[_0x6d40('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d40('0x1d'))(new Redis(config[_0x6d40('0x1b')]));require(_0x6d40('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6d40('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x6d40('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe026a,_0x1fcc1d,_0x4790c6,_0x30865c){return new BPromise(function(_0x5f38c6,_0x12b5b3){var _0x25fc2c=_0x30865c||client;return _0x25fc2c[_0x6d40('0x20')](_0xe026a,_0x4790c6)[_0x6d40('0x21')](function(_0x134657){logger[_0x6d40('0x22')](_0x6d40('0x23'),_0x1fcc1d,_0x6d40('0x24'));logger['debug'](_0x6d40('0x25'),_0x1fcc1d,'request\x20sent',JSON[_0x6d40('0x26')](_0x134657));if(_0x134657[_0x6d40('0x27')]){if(_0x134657['error'][_0x6d40('0x28')]===0x1f4){logger[_0x6d40('0x27')]('FaxMessage,\x20%s,\x20%s',_0x1fcc1d,_0x134657[_0x6d40('0x27')]['message']);return _0x12b5b3(_0x134657[_0x6d40('0x27')]['message']);}logger['error'](_0x6d40('0x23'),_0x1fcc1d,_0x134657[_0x6d40('0x27')][_0x6d40('0x29')]);return _0x5f38c6(_0x134657[_0x6d40('0x27')]['message']);}else{logger['info'](_0x6d40('0x23'),_0x1fcc1d,_0x6d40('0x24'));_0x5f38c6(_0x134657[_0x6d40('0x2a')]['message']);}})[_0x6d40('0x2b')](function(_0x36f266){logger[_0x6d40('0x27')]('FaxMessage,\x20%s,\x20%s',_0x1fcc1d,_0x36f266);_0x12b5b3(_0x36f266);});});}function respondWithStatusCode(_0x9f269b,_0x1da94b){_0x1da94b=_0x1da94b||0xcc;return function(_0x5ea5dc){if(_0x5ea5dc){return _0x9f269b['sendStatus'](_0x1da94b);}return _0x9f269b[_0x6d40('0x2c')](_0x1da94b)[_0x6d40('0x2d')]();};}function respondWithResult(_0x43e056,_0xbd9698){_0xbd9698=_0xbd9698||0xc8;return function(_0x3c29d4){if(_0x3c29d4){return _0x43e056['status'](_0xbd9698)['json'](_0x3c29d4);}};}function respondWithFilteredResult(_0x28f999,_0xe8660e){return function(_0x10364c){if(_0x10364c){var _0x21035d=typeof _0xe8660e[_0x6d40('0x2e')]===_0x6d40('0x2f')&&typeof _0xe8660e['limit']===_0x6d40('0x2f');var _0x19f192=_0x10364c['count'];var _0x1dd490=_0x21035d?0x0:_0xe8660e['offset'];var _0x5f4e49=_0x21035d?_0x10364c[_0x6d40('0x30')]:_0xe8660e[_0x6d40('0x2e')]+_0xe8660e[_0x6d40('0x31')];var _0x1ff6ba;if(_0x5f4e49>=_0x19f192){_0x5f4e49=_0x19f192;_0x1ff6ba=0xc8;}else{_0x1ff6ba=0xce;}_0x28f999[_0x6d40('0x2c')](_0x1ff6ba);return _0x28f999[_0x6d40('0x32')]('Content-Range',_0x1dd490+'-'+_0x5f4e49+'/'+_0x19f192)[_0x6d40('0x33')](_0x10364c);}return null;};}function patchUpdates(_0x516fc3){return function(_0x5817e4){try{jsonpatch[_0x6d40('0x34')](_0x5817e4,_0x516fc3,!![]);}catch(_0x410a6c){return BPromise[_0x6d40('0x35')](_0x410a6c);}return _0x5817e4['save']();};}function saveUpdates(_0x4111b7,_0x5eed2f){return function(_0x1b7cd7){if(_0x1b7cd7){return _0x1b7cd7['update'](_0x4111b7)[_0x6d40('0x21')](function(_0x4347c4){return _0x4347c4;});}return null;};}function removeEntity(_0x458abf,_0x518bd5){return function(_0x525904){if(_0x525904){return _0x525904['destroy']()['then'](function(){_0x458abf[_0x6d40('0x2c')](0xcc)[_0x6d40('0x2d')]();});}};}function handleEntityNotFound(_0x1359a4,_0x3e7efe){return function(_0x55da76){if(!_0x55da76){_0x1359a4[_0x6d40('0x36')](0x194);}return _0x55da76;};}function handleError(_0x176f82,_0x38b8d4){_0x38b8d4=_0x38b8d4||0x1f4;return function(_0x5ea1d5){logger['error'](_0x5ea1d5[_0x6d40('0x37')]);if(_0x5ea1d5['name']){delete _0x5ea1d5[_0x6d40('0x38')];}_0x176f82[_0x6d40('0x2c')](_0x38b8d4)[_0x6d40('0x39')](_0x5ea1d5);};}exports[_0x6d40('0x3a')]=function(_0x227845,_0x53b13e){var _0x5787cd={},_0xd54213={},_0x101785={'count':0x0,'rows':[]};var _0xbc88a6=_['map'](db['FaxMessage']['rawAttributes'],function(_0x3e421b){return{'name':_0x3e421b[_0x6d40('0x3b')],'type':_0x3e421b['type'][_0x6d40('0x3c')]};});_0xd54213[_0x6d40('0x3d')]=_[_0x6d40('0x3e')](_0xbc88a6,_0x6d40('0x38'));_0xd54213['query']=_[_0x6d40('0x3f')](_0x227845['query']);_0xd54213[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0xd54213[_0x6d40('0x3d')],_0xd54213[_0x6d40('0x42')]);_0x5787cd['attributes']=_[_0x6d40('0x41')](_0xd54213['model'],qs['fields'](_0x227845[_0x6d40('0x42')]['fields']));_0x5787cd[_0x6d40('0x43')]=_0x5787cd['attributes'][_0x6d40('0x44')]?_0x5787cd[_0x6d40('0x43')]:_0xd54213[_0x6d40('0x3d')];if(!_0x227845[_0x6d40('0x42')]['hasOwnProperty'](_0x6d40('0x45'))){_0x5787cd[_0x6d40('0x31')]=qs[_0x6d40('0x31')](_0x227845['query'][_0x6d40('0x31')]);_0x5787cd[_0x6d40('0x2e')]=qs[_0x6d40('0x2e')](_0x227845[_0x6d40('0x42')][_0x6d40('0x2e')]);}_0x5787cd[_0x6d40('0x46')]=qs['sort'](_0x227845[_0x6d40('0x42')]['sort']);_0x5787cd[_0x6d40('0x47')]=qs[_0x6d40('0x40')](_[_0x6d40('0x48')](_0x227845[_0x6d40('0x42')],_0xd54213[_0x6d40('0x40')]),_0xbc88a6);if(_0x227845['query'][_0x6d40('0x49')]){_0x5787cd[_0x6d40('0x47')]=_['merge'](_0x5787cd['where'],{'$or':_['map'](_0xbc88a6,function(_0x1954f7){if(_0x1954f7[_0x6d40('0x4a')]!==_0x6d40('0x4b')){var _0x52c7f0={};_0x52c7f0[_0x1954f7[_0x6d40('0x38')]]={'$like':'%'+_0x227845[_0x6d40('0x42')][_0x6d40('0x49')]+'%'};return _0x52c7f0;}})});}_0x5787cd=_[_0x6d40('0x4c')]({},_0x5787cd,_0x227845['options']);var _0x540dd0={'where':_0x5787cd[_0x6d40('0x47')]};return db['FaxMessage'][_0x6d40('0x30')](_0x540dd0)[_0x6d40('0x21')](function(_0x3b2e49){_0x101785[_0x6d40('0x30')]=_0x3b2e49;if(_0x227845[_0x6d40('0x42')][_0x6d40('0x4d')]){_0x5787cd['include']=[{'all':!![]}];}return db[_0x6d40('0x4e')]['findAll'](_0x5787cd);})['then'](function(_0x2d7c48){_0x101785[_0x6d40('0x4f')]=_0x2d7c48;return _0x101785;})[_0x6d40('0x21')](respondWithFilteredResult(_0x53b13e,_0x5787cd))[_0x6d40('0x2b')](handleError(_0x53b13e,null));};exports[_0x6d40('0x50')]=function(_0x27e886,_0x569966){var _0x52e34b={'raw':!![],'where':{'id':_0x27e886['params']['id']}},_0x8820ca={};_0x8820ca['model']=_[_0x6d40('0x3f')](db[_0x6d40('0x4e')][_0x6d40('0x51')]);_0x8820ca['query']=_[_0x6d40('0x3f')](_0x27e886[_0x6d40('0x42')]);_0x8820ca[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0x8820ca[_0x6d40('0x3d')],_0x8820ca[_0x6d40('0x42')]);_0x52e34b['attributes']=_[_0x6d40('0x41')](_0x8820ca[_0x6d40('0x3d')],qs[_0x6d40('0x52')](_0x27e886[_0x6d40('0x42')][_0x6d40('0x52')]));_0x52e34b[_0x6d40('0x43')]=_0x52e34b[_0x6d40('0x43')][_0x6d40('0x44')]?_0x52e34b['attributes']:_0x8820ca[_0x6d40('0x3d')];if(_0x27e886[_0x6d40('0x42')][_0x6d40('0x4d')]){_0x52e34b['include']=[{'all':!![]}];}_0x52e34b=_[_0x6d40('0x4c')]({},_0x52e34b,_0x27e886[_0x6d40('0x53')]);return db[_0x6d40('0x4e')]['find'](_0x52e34b)[_0x6d40('0x21')](handleEntityNotFound(_0x569966,null))[_0x6d40('0x21')](respondWithResult(_0x569966,null))['catch'](handleError(_0x569966,null));};exports[_0x6d40('0x54')]=function(_0x146f8f,_0x496d17){if(_0x146f8f['body']['id']){delete _0x146f8f[_0x6d40('0x55')]['id'];}return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x146f8f[_0x6d40('0x57')]['id']}})[_0x6d40('0x21')](handleEntityNotFound(_0x496d17,null))[_0x6d40('0x21')](saveUpdates(_0x146f8f[_0x6d40('0x55')],null))[_0x6d40('0x21')](respondWithResult(_0x496d17,null))[_0x6d40('0x2b')](handleError(_0x496d17,null));};exports[_0x6d40('0x58')]=function(_0x1f342d,_0xeff2b9){return db['FaxMessage'][_0x6d40('0x56')]({'where':{'id':_0x1f342d['params']['id']}})[_0x6d40('0x21')](handleEntityNotFound(_0xeff2b9,null))[_0x6d40('0x21')](removeEntity(_0xeff2b9,null))['catch'](handleError(_0xeff2b9,null));};exports[_0x6d40('0x59')]=function(_0xb70fe8,_0x4e9af5){return db['FaxMessage'][_0x6d40('0x59')]()[_0x6d40('0x21')](respondWithResult(_0x4e9af5,null))['catch'](handleError(_0x4e9af5,null));};var interaction_log=require('../../config/logger')(_0x6d40('0x5a'));exports[_0x6d40('0x5b')]=function(_0x2b9c6c,_0x43194b,_0x7d73c1){var _0x3cb91e={'agent':{},'channel':_0x6d40('0x5c')};if(_0x2b9c6c[_0x6d40('0x55')]['id']){delete _0x2b9c6c['body']['id'];}_0x2b9c6c[_0x6d40('0x55')]['read']=!![];_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x5d')]=moment()[_0x6d40('0x5e')](_0x6d40('0x5f'));_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')]=_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')]||_0x2b9c6c[_0x6d40('0x61')]['id'];_0x3cb91e[_0x6d40('0x62')]['id']=_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')];return db['FaxMessage'][_0x6d40('0x56')]({'where':{'id':_0x2b9c6c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43194b,null))['then'](saveUpdates(_0x2b9c6c[_0x6d40('0x55')],null))[_0x6d40('0x21')](function(_0x3bc866){if(_0x3bc866){_0x3cb91e[_0x6d40('0x29')]=_0x3bc866[_0x6d40('0x63')]({'plain':!![]});return db[_0x6d40('0x64')][_0x6d40('0x56')]({'where':{'id':_0x3bc866[_0x6d40('0x65')]}});}return null;})[_0x6d40('0x21')](handleEntityNotFound(_0x43194b,null))['then'](function(_0x344638){if(_0x344638){return _0x344638[_0x6d40('0x54')]({'UserId':_0x2b9c6c['body'][_0x6d40('0x60')],'read1stAt':_['isNil'](_0x344638[_0x6d40('0x66')])?moment()[_0x6d40('0x5e')](_0x6d40('0x5f')):undefined});}return null;})[_0x6d40('0x21')](function(_0x1280b1){if(_0x1280b1){_0x3cb91e[_0x6d40('0x67')]=_0x1280b1[_0x6d40('0x63')]({'plain':!![]});interaction_log[_0x6d40('0x22')](_0x6d40('0x68'),_0x2b9c6c[_0x6d40('0x61')]['id'],_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x38')],_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x69')],_0x3cb91e['interaction']['id'],_0x2b9c6c[_0x6d40('0x55')]?JSON['stringify'](_0x2b9c6c[_0x6d40('0x55')]):_0x6d40('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x6d40('0x6b'),_0x3cb91e);}return null;})[_0x6d40('0x21')](function(_0x32572d){var _0x326125=_0x6d40('0x6c')+_0x32572d[_0x6d40('0x29')][_0x6d40('0x6d')];return db['sequelize']['query'](_0x326125,{'type':db[_0x6d40('0x6e')][_0x6d40('0x6f')][_0x6d40('0x70')],'raw':!![]})[_0x6d40('0x21')](function(_0x25c866){return _0x25c866;});})[_0x6d40('0x21')](function(_0x2aa4a3){if(_0x2aa4a3){_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x71')]=_0x2aa4a3[0x0];if(!_0x2b9c6c[_0x6d40('0x55')]['UserId'])return;return db['User'][_0x6d40('0x56')]({'where':{'id':_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x60')],'role':_0x6d40('0x62')},'attributes':['id',_0x6d40('0x38'),_0x6d40('0x72'),_0x6d40('0x73'),_0x6d40('0x74')],'raw':!![]});}return null;})[_0x6d40('0x21')](function(_0x2f8edd){if(!_0x2f8edd)return null;_0x3cb91e[_0x6d40('0x29')]['agent']=_0x2f8edd;return _0x3cb91e;})[_0x6d40('0x21')](function(_0x3a657e){if(_0x3a657e){if(_0x2b9c6c[_0x6d40('0x55')][_0x6d40('0x75')]){_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x76')]=util[_0x6d40('0x5e')](_0x6d40('0x77'),_0x2b9c6c[_0x6d40('0x61')][_0x6d40('0x38')]);_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x78')]=_0x3cb91e[_0x6d40('0x78')];_0x3cb91e[_0x6d40('0x29')][_0x6d40('0x79')]=_0x3cb91e['channel'];_0x3cb91e['message'][_0x6d40('0x7a')]=_0x6d40('0x5b');return respondWithRpcPromise('EventManager',_0x6d40('0x7b'),{'event':'acceptmessage','message':_0x3cb91e[_0x6d40('0x29')]},client9002)[_0x6d40('0x21')](function(){return _0x3cb91e;});}return _0x3cb91e;}return null;})[_0x6d40('0x21')](respondWithResult(_0x43194b,null))[_0x6d40('0x2b')](handleError(_0x43194b,null));};var interaction_log=require(_0x6d40('0x7c'))(_0x6d40('0x5a'));exports[_0x6d40('0x35')]=function(_0x17918c,_0x5b30e6,_0x18d9de){var _0x21c6b6={'agent':{},'channel':_0x6d40('0x5c')};if(_0x17918c['body']['id']){delete _0x17918c['body']['id'];}_0x17918c[_0x6d40('0x55')][_0x6d40('0x60')]=_0x17918c[_0x6d40('0x55')]['UserId']||_0x17918c[_0x6d40('0x61')]['id'];_0x21c6b6[_0x6d40('0x62')]['id']=_0x17918c[_0x6d40('0x55')][_0x6d40('0x60')];return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x17918c[_0x6d40('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b30e6,null))[_0x6d40('0x21')](function(_0x2a20bb){if(_0x2a20bb){_0x21c6b6['message']=_0x2a20bb[_0x6d40('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x6d40('0x56')]({'where':{'id':_0x2a20bb['FaxInteractionId']}});}return null;})[_0x6d40('0x21')](handleEntityNotFound(_0x5b30e6,null))['then'](function(_0x2def4d){if(_0x2def4d){_0x21c6b6[_0x6d40('0x67')]=_0x2def4d[_0x6d40('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17918c[_0x6d40('0x61')]['id'],_0x17918c[_0x6d40('0x61')][_0x6d40('0x38')],_0x17918c['user']['role'],_0x21c6b6[_0x6d40('0x67')]['id'],_0x17918c[_0x6d40('0x55')]?JSON[_0x6d40('0x26')](_0x17918c[_0x6d40('0x55')]):'null');return respondWithRpcPromise(_0x6d40('0x7d'),_0x6d40('0x7e'),_0x21c6b6);}return null;})[_0x6d40('0x21')](function(_0x92e9cd){var _0x420978='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x92e9cd[_0x6d40('0x29')][_0x6d40('0x6d')];return db['sequelize']['query'](_0x420978,{'type':db[_0x6d40('0x6e')][_0x6d40('0x6f')][_0x6d40('0x70')],'raw':!![]})['then'](function(_0x57ec86){return _0x57ec86;});})[_0x6d40('0x21')](function(_0x41d9ee){if(_0x41d9ee){_0x21c6b6['message'][_0x6d40('0x71')]=_0x41d9ee[0x0];if(!_0x17918c['body'][_0x6d40('0x60')])return;return db[_0x6d40('0x7f')][_0x6d40('0x56')]({'where':{'id':_0x17918c[_0x6d40('0x55')]['UserId'],'role':_0x6d40('0x62')},'attributes':['id','name',_0x6d40('0x72'),'email',_0x6d40('0x74')],'raw':!![]});}return null;})['then'](function(_0x1a0b2a){if(!_0x1a0b2a)return null;_0x21c6b6[_0x6d40('0x29')]['agent']=_0x1a0b2a;return _0x21c6b6;})[_0x6d40('0x21')](function(_0x27ef11){if(_0x27ef11){_0x27ef11[_0x6d40('0x29')][_0x6d40('0x76')]=util[_0x6d40('0x5e')](_0x6d40('0x77'),_0x17918c['user'][_0x6d40('0x38')]);_0x27ef11[_0x6d40('0x29')][_0x6d40('0x78')]=_0x21c6b6[_0x6d40('0x78')];_0x27ef11[_0x6d40('0x29')][_0x6d40('0x79')]=_0x21c6b6[_0x6d40('0x78')];_0x27ef11[_0x6d40('0x29')][_0x6d40('0x7a')]='reject';respondWithRpcPromise(_0x6d40('0x7b'),_0x6d40('0x7b'),{'event':_0x6d40('0x80'),'message':_0x27ef11[_0x6d40('0x29')]},client9002);return _0x21c6b6;}return null;})[_0x6d40('0x21')](respondWithResult(_0x5b30e6,null))[_0x6d40('0x2b')](handleError(_0x5b30e6,null));};exports[_0x6d40('0x81')]=function(_0x40f5b4,_0x5856b2){var _0x4a905c;return db[_0x6d40('0x4e')]['create'](_0x40f5b4[_0x6d40('0x55')],{})[_0x6d40('0x21')](function(_0x29e615){_0x4a905c=_0x29e615;return db[_0x6d40('0x82')][_0x6d40('0x83')]({'where':{'id':_0x4a905c[_0x6d40('0x6d')]}});})[_0x6d40('0x21')](function(_0x520ab5){if(_[_0x6d40('0x84')](_0x520ab5)){return;}else{_0x4a905c[_0x6d40('0x5c')]=_0x520ab5[_0x6d40('0x5c')];return db[_0x6d40('0x85')][_0x6d40('0x83')]({'where':{'id':_0x4a905c[_0x6d40('0x86')]}});}})[_0x6d40('0x21')](function(_0x3a64e6){return respondWithRpcPromise(_0x6d40('0x87'),'SendFax',{'FaxAccountId':_[_0x6d40('0x84')](_0x40f5b4['body'])?undefined:_0x40f5b4[_0x6d40('0x55')][_0x6d40('0x88')],'path':_[_0x6d40('0x84')](_0x3a64e6)?undefined:util[_0x6d40('0x5e')](_0x6d40('0x89'),_0x3a64e6[_0x6d40('0x8a')]),'fax':_[_0x6d40('0x84')](_0x4a905c['fax'])?undefined:_0x4a905c['fax'],'AttachmentId':_0x4a905c[_0x6d40('0x86')]},client9002);})['then'](respondWithResult(_0x5856b2,0xc9))['catch'](handleError(_0x5856b2,null));};exports[_0x6d40('0x8b')]=function(_0x202e90,_0x4b9c11){var _0x278ce1=path[_0x6d40('0x8c')](config['root'],'server','files','attachments');return db[_0x6d40('0x4e')][_0x6d40('0x56')]({'where':{'id':_0x202e90['params']['id']},'include':[{'model':db[_0x6d40('0x85')],'as':_0x6d40('0x85')}]})[_0x6d40('0x21')](handleEntityNotFound(_0x4b9c11,null))[_0x6d40('0x21')](function(_0x5af4ab){if(_0x5af4ab){return _0x4b9c11[_0x6d40('0x8b')](path[_0x6d40('0x8c')](_0x278ce1,_0x5af4ab[_0x6d40('0x85')][_0x6d40('0x8a')]));}})[_0x6d40('0x2b')](handleError(_0x4b9c11,null));}; \ No newline at end of file +var _0x61a5=['join','files','attachments','eml-format','zip-dir','fast-json-patch','moment','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','find','body','params','destroy','describe','../../config/logger','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','SIP/%s','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download'];(function(_0x4fa746,_0x1d70c4){var _0x408ff1=function(_0xe13f03){while(--_0xe13f03){_0x4fa746['push'](_0x4fa746['shift']());}};_0x408ff1(++_0x1d70c4);}(_0x61a5,0x19e));var _0x561a=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x61a5[_0x1a9204];return _0x17ca68;};'use strict';var emlformat=require(_0x561a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x561a('0x1'));var jsonpatch=require(_0x561a('0x2'));var rp=require('request-promise');var moment=require(_0x561a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x561a('0x4'));var util=require(_0x561a('0x5'));var path=require(_0x561a('0x6'));var sox=require(_0x561a('0x7'));var csv=require(_0x561a('0x8'));var ejs=require(_0x561a('0x9'));var fs=require('fs');var fs_extra=require(_0x561a('0xa'));var _=require(_0x561a('0xb'));var squel=require('squel');var crypto=require(_0x561a('0xc'));var jsforce=require(_0x561a('0xd'));var deskjs=require(_0x561a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x561a('0xf'));var Papa=require(_0x561a('0x10'));var Redis=require('ioredis');var authService=require(_0x561a('0x11'));var qs=require(_0x561a('0x12'));var as=require(_0x561a('0x13'));var hardwareService=require(_0x561a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x561a('0x15'));var config=require(_0x561a('0x16'));var licenseUtil=require(_0x561a('0x17'));var db=require(_0x561a('0x18'))['db'];config[_0x561a('0x19')]=_[_0x561a('0x1a')](config[_0x561a('0x19')],{'host':_0x561a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x561a('0x19')]));require(_0x561a('0x1c'))[_0x561a('0x1d')](socket);var jayson=require(_0x561a('0x1e'));var client=jayson['client'][_0x561a('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x561a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3a06d3,_0x85faed,_0x4172f8,_0x340dbc){return new BPromise(function(_0xb777ee,_0x495ded){var _0x53a683=_0x340dbc||client;return _0x53a683['request'](_0x3a06d3,_0x4172f8)['then'](function(_0xfff95c){logger[_0x561a('0x20')](_0x561a('0x21'),_0x85faed,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x85faed,_0x561a('0x22'),JSON[_0x561a('0x23')](_0xfff95c));if(_0xfff95c[_0x561a('0x24')]){if(_0xfff95c[_0x561a('0x24')][_0x561a('0x25')]===0x1f4){logger['error'](_0x561a('0x21'),_0x85faed,_0xfff95c[_0x561a('0x24')]['message']);return _0x495ded(_0xfff95c[_0x561a('0x24')][_0x561a('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x85faed,_0xfff95c[_0x561a('0x24')]['message']);return _0xb777ee(_0xfff95c['error']['message']);}else{logger['info'](_0x561a('0x21'),_0x85faed,'request\x20sent');_0xb777ee(_0xfff95c['result'][_0x561a('0x26')]);}})[_0x561a('0x27')](function(_0x5d8435){logger['error']('FaxMessage,\x20%s,\x20%s',_0x85faed,_0x5d8435);_0x495ded(_0x5d8435);});});}function respondWithStatusCode(_0x30657a,_0x19f15d){_0x19f15d=_0x19f15d||0xcc;return function(_0x4f25fb){if(_0x4f25fb){return _0x30657a[_0x561a('0x28')](_0x19f15d);}return _0x30657a['status'](_0x19f15d)[_0x561a('0x29')]();};}function respondWithResult(_0x3412b6,_0x19f5e5){_0x19f5e5=_0x19f5e5||0xc8;return function(_0x1eea93){if(_0x1eea93){return _0x3412b6[_0x561a('0x2a')](_0x19f5e5)[_0x561a('0x2b')](_0x1eea93);}};}function respondWithFilteredResult(_0x261efd,_0x310d40){return function(_0x44fd4d){if(_0x44fd4d){var _0x2293bf=typeof _0x310d40[_0x561a('0x2c')]===_0x561a('0x2d')&&typeof _0x310d40['limit']===_0x561a('0x2d');var _0x39fee8=_0x44fd4d[_0x561a('0x2e')];var _0x39a7f6=_0x2293bf?0x0:_0x310d40['offset'];var _0x459c4f=_0x2293bf?_0x44fd4d[_0x561a('0x2e')]:_0x310d40[_0x561a('0x2c')]+_0x310d40[_0x561a('0x2f')];var _0x30981f;if(_0x459c4f>=_0x39fee8){_0x459c4f=_0x39fee8;_0x30981f=0xc8;}else{_0x30981f=0xce;}_0x261efd[_0x561a('0x2a')](_0x30981f);return _0x261efd['set'](_0x561a('0x30'),_0x39a7f6+'-'+_0x459c4f+'/'+_0x39fee8)[_0x561a('0x2b')](_0x44fd4d);}return null;};}function patchUpdates(_0xffafe){return function(_0x15e3fe){try{jsonpatch[_0x561a('0x31')](_0x15e3fe,_0xffafe,!![]);}catch(_0x22aa9f){return BPromise[_0x561a('0x32')](_0x22aa9f);}return _0x15e3fe[_0x561a('0x33')]();};}function saveUpdates(_0x4b7de3,_0x97a2c7){return function(_0x1131c3){if(_0x1131c3){return _0x1131c3[_0x561a('0x34')](_0x4b7de3)[_0x561a('0x35')](function(_0x554fe1){return _0x554fe1;});}return null;};}function removeEntity(_0x5e8c86,_0x35e8cc){return function(_0x5235b1){if(_0x5235b1){return _0x5235b1['destroy']()[_0x561a('0x35')](function(){_0x5e8c86[_0x561a('0x2a')](0xcc)[_0x561a('0x29')]();});}};}function handleEntityNotFound(_0x3bb322,_0x36aceb){return function(_0x7b3d7f){if(!_0x7b3d7f){_0x3bb322[_0x561a('0x28')](0x194);}return _0x7b3d7f;};}function handleError(_0x128b43,_0x2bf324){_0x2bf324=_0x2bf324||0x1f4;return function(_0x556a97){logger['error'](_0x556a97['stack']);if(_0x556a97[_0x561a('0x36')]){delete _0x556a97[_0x561a('0x36')];}_0x128b43[_0x561a('0x2a')](_0x2bf324)['send'](_0x556a97);};}exports[_0x561a('0x37')]=function(_0x36f4b4,_0x31776a){var _0x1d3a6a={},_0xbfc4d0={},_0x3071df={'count':0x0,'rows':[]};var _0x5c59db=_[_0x561a('0x38')](db[_0x561a('0x39')][_0x561a('0x3a')],function(_0x11ec01){return{'name':_0x11ec01[_0x561a('0x3b')],'type':_0x11ec01[_0x561a('0x3c')][_0x561a('0x3d')]};});_0xbfc4d0[_0x561a('0x3e')]=_['map'](_0x5c59db,_0x561a('0x36'));_0xbfc4d0['query']=_[_0x561a('0x3f')](_0x36f4b4[_0x561a('0x40')]);_0xbfc4d0[_0x561a('0x41')]=_[_0x561a('0x42')](_0xbfc4d0[_0x561a('0x3e')],_0xbfc4d0['query']);_0x1d3a6a[_0x561a('0x43')]=_[_0x561a('0x42')](_0xbfc4d0['model'],qs[_0x561a('0x44')](_0x36f4b4['query'][_0x561a('0x44')]));_0x1d3a6a[_0x561a('0x43')]=_0x1d3a6a[_0x561a('0x43')][_0x561a('0x45')]?_0x1d3a6a[_0x561a('0x43')]:_0xbfc4d0[_0x561a('0x3e')];if(!_0x36f4b4[_0x561a('0x40')][_0x561a('0x46')]('nolimit')){_0x1d3a6a[_0x561a('0x2f')]=qs[_0x561a('0x2f')](_0x36f4b4[_0x561a('0x40')][_0x561a('0x2f')]);_0x1d3a6a['offset']=qs[_0x561a('0x2c')](_0x36f4b4[_0x561a('0x40')][_0x561a('0x2c')]);}_0x1d3a6a[_0x561a('0x47')]=qs['sort'](_0x36f4b4[_0x561a('0x40')]['sort']);_0x1d3a6a[_0x561a('0x48')]=qs['filters'](_[_0x561a('0x49')](_0x36f4b4[_0x561a('0x40')],_0xbfc4d0[_0x561a('0x41')]),_0x5c59db);if(_0x36f4b4['query']['filter']){_0x1d3a6a[_0x561a('0x48')]=_[_0x561a('0x4a')](_0x1d3a6a[_0x561a('0x48')],{'$or':_[_0x561a('0x38')](_0x5c59db,function(_0x2750a6){if(_0x2750a6[_0x561a('0x3c')]!=='VIRTUAL'){var _0xfa013f={};_0xfa013f[_0x2750a6['name']]={'$like':'%'+_0x36f4b4[_0x561a('0x40')][_0x561a('0x4b')]+'%'};return _0xfa013f;}})});}_0x1d3a6a=_[_0x561a('0x4a')]({},_0x1d3a6a,_0x36f4b4[_0x561a('0x4c')]);var _0x3717ef={'where':_0x1d3a6a['where']};return db[_0x561a('0x39')][_0x561a('0x2e')](_0x3717ef)[_0x561a('0x35')](function(_0x2b4ab4){_0x3071df[_0x561a('0x2e')]=_0x2b4ab4;if(_0x36f4b4['query'][_0x561a('0x4d')]){_0x1d3a6a[_0x561a('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x561a('0x4f')](_0x1d3a6a);})[_0x561a('0x35')](function(_0x4e426c){_0x3071df[_0x561a('0x50')]=_0x4e426c;return _0x3071df;})['then'](respondWithFilteredResult(_0x31776a,_0x1d3a6a))[_0x561a('0x27')](handleError(_0x31776a,null));};exports[_0x561a('0x51')]=function(_0x4dea87,_0x34ea92){var _0x80b59e={'raw':!![],'where':{'id':_0x4dea87['params']['id']}},_0x168135={};_0x168135[_0x561a('0x3e')]=_['keys'](db[_0x561a('0x39')][_0x561a('0x3a')]);_0x168135[_0x561a('0x40')]=_['keys'](_0x4dea87[_0x561a('0x40')]);_0x168135[_0x561a('0x41')]=_[_0x561a('0x42')](_0x168135[_0x561a('0x3e')],_0x168135[_0x561a('0x40')]);_0x80b59e[_0x561a('0x43')]=_[_0x561a('0x42')](_0x168135[_0x561a('0x3e')],qs['fields'](_0x4dea87[_0x561a('0x40')][_0x561a('0x44')]));_0x80b59e['attributes']=_0x80b59e[_0x561a('0x43')][_0x561a('0x45')]?_0x80b59e['attributes']:_0x168135[_0x561a('0x3e')];if(_0x4dea87[_0x561a('0x40')][_0x561a('0x4d')]){_0x80b59e[_0x561a('0x4e')]=[{'all':!![]}];}_0x80b59e=_[_0x561a('0x4a')]({},_0x80b59e,_0x4dea87[_0x561a('0x4c')]);return db['FaxMessage'][_0x561a('0x52')](_0x80b59e)[_0x561a('0x35')](handleEntityNotFound(_0x34ea92,null))[_0x561a('0x35')](respondWithResult(_0x34ea92,null))[_0x561a('0x27')](handleError(_0x34ea92,null));};exports['update']=function(_0x3e75f7,_0x2e7c90){if(_0x3e75f7[_0x561a('0x53')]['id']){delete _0x3e75f7[_0x561a('0x53')]['id'];}return db[_0x561a('0x39')]['find']({'where':{'id':_0x3e75f7[_0x561a('0x54')]['id']}})[_0x561a('0x35')](handleEntityNotFound(_0x2e7c90,null))['then'](saveUpdates(_0x3e75f7[_0x561a('0x53')],null))[_0x561a('0x35')](respondWithResult(_0x2e7c90,null))[_0x561a('0x27')](handleError(_0x2e7c90,null));};exports[_0x561a('0x55')]=function(_0x43c90c,_0x3d232c){return db[_0x561a('0x39')][_0x561a('0x52')]({'where':{'id':_0x43c90c[_0x561a('0x54')]['id']}})[_0x561a('0x35')](handleEntityNotFound(_0x3d232c,null))[_0x561a('0x35')](removeEntity(_0x3d232c,null))[_0x561a('0x27')](handleError(_0x3d232c,null));};exports[_0x561a('0x56')]=function(_0x5b9452,_0xae4212){return db[_0x561a('0x39')][_0x561a('0x56')]()[_0x561a('0x35')](respondWithResult(_0xae4212,null))[_0x561a('0x27')](handleError(_0xae4212,null));};var interaction_log=require(_0x561a('0x57'))('fax-interactions');exports[_0x561a('0x58')]=function(_0x4c0e69,_0x28cd70,_0x267f34){var _0x3ca5fe={'agent':{},'channel':_0x561a('0x59')};if(_0x4c0e69[_0x561a('0x53')]['id']){delete _0x4c0e69[_0x561a('0x53')]['id'];}_0x4c0e69['body']['read']=!![];_0x4c0e69[_0x561a('0x53')][_0x561a('0x5a')]=moment()[_0x561a('0x5b')](_0x561a('0x5c'));_0x4c0e69[_0x561a('0x53')][_0x561a('0x5d')]=_0x4c0e69[_0x561a('0x53')][_0x561a('0x5d')]||_0x4c0e69['user']['id'];_0x3ca5fe['agent']['id']=_0x4c0e69[_0x561a('0x53')][_0x561a('0x5d')];return db['FaxMessage'][_0x561a('0x52')]({'where':{'id':_0x4c0e69[_0x561a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28cd70,null))['then'](saveUpdates(_0x4c0e69[_0x561a('0x53')],null))[_0x561a('0x35')](function(_0x4ef7c8){if(_0x4ef7c8){_0x3ca5fe[_0x561a('0x26')]=_0x4ef7c8[_0x561a('0x5e')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4ef7c8[_0x561a('0x5f')]}});}return null;})[_0x561a('0x35')](handleEntityNotFound(_0x28cd70,null))['then'](function(_0x306151){if(_0x306151){return _0x306151[_0x561a('0x34')]({'UserId':_0x4c0e69[_0x561a('0x53')]['UserId'],'read1stAt':_[_0x561a('0x60')](_0x306151['read1stAt'])?moment()['format'](_0x561a('0x5c')):undefined});}return null;})['then'](function(_0x5365b1){if(_0x5365b1){_0x3ca5fe[_0x561a('0x61')]=_0x5365b1[_0x561a('0x5e')]({'plain':!![]});interaction_log[_0x561a('0x20')](_0x561a('0x62'),_0x4c0e69[_0x561a('0x63')]['id'],_0x4c0e69['user'][_0x561a('0x36')],_0x4c0e69['user']['role'],_0x3ca5fe[_0x561a('0x61')]['id'],_0x4c0e69[_0x561a('0x53')]?JSON[_0x561a('0x23')](_0x4c0e69['body']):_0x561a('0x64'));return respondWithRpcPromise('AcceptMessage',_0x561a('0x65'),_0x3ca5fe);}return null;})[_0x561a('0x35')](function(_0x5bf6ee){var _0x1e029a=_0x561a('0x66')+_0x5bf6ee[_0x561a('0x26')][_0x561a('0x67')];return db[_0x561a('0x68')][_0x561a('0x40')](_0x1e029a,{'type':db[_0x561a('0x69')][_0x561a('0x6a')][_0x561a('0x6b')],'raw':!![]})[_0x561a('0x35')](function(_0xc72933){return _0xc72933;});})['then'](function(_0x432c19){if(_0x432c19){_0x3ca5fe['message'][_0x561a('0x6c')]=_0x432c19[0x0];if(!_0x4c0e69[_0x561a('0x53')][_0x561a('0x5d')])return;return db['User'][_0x561a('0x52')]({'where':{'id':_0x4c0e69[_0x561a('0x53')][_0x561a('0x5d')],'role':_0x561a('0x6d')},'attributes':['id',_0x561a('0x36'),'fullname',_0x561a('0x6e'),'internal'],'raw':!![]});}return null;})[_0x561a('0x35')](function(_0x38856d){if(!_0x38856d)return null;_0x3ca5fe['message'][_0x561a('0x6d')]=_0x38856d;return _0x3ca5fe;})['then'](function(_0x28c416){if(_0x28c416){if(_0x4c0e69[_0x561a('0x53')][_0x561a('0x6f')]){_0x3ca5fe[_0x561a('0x26')][_0x561a('0x70')]=util[_0x561a('0x5b')]('SIP/%s',_0x4c0e69['user'][_0x561a('0x36')]);_0x3ca5fe[_0x561a('0x26')]['channel']=_0x3ca5fe[_0x561a('0x71')];_0x3ca5fe[_0x561a('0x26')][_0x561a('0x72')]=_0x3ca5fe[_0x561a('0x71')];_0x3ca5fe['message'][_0x561a('0x73')]=_0x561a('0x58');return respondWithRpcPromise(_0x561a('0x74'),_0x561a('0x74'),{'event':_0x561a('0x75'),'message':_0x3ca5fe[_0x561a('0x26')]},client9002)[_0x561a('0x35')](function(){return _0x3ca5fe;});}return _0x3ca5fe;}return null;})[_0x561a('0x35')](respondWithResult(_0x28cd70,null))[_0x561a('0x27')](handleError(_0x28cd70,null));};var interaction_log=require(_0x561a('0x57'))('fax-interactions');exports[_0x561a('0x32')]=function(_0xedce88,_0x106130,_0x28a280){var _0x4b31a0={'agent':{},'channel':_0x561a('0x59')};if(_0xedce88[_0x561a('0x53')]['id']){delete _0xedce88[_0x561a('0x53')]['id'];}_0xedce88[_0x561a('0x53')]['UserId']=_0xedce88[_0x561a('0x53')][_0x561a('0x5d')]||_0xedce88[_0x561a('0x63')]['id'];_0x4b31a0[_0x561a('0x6d')]['id']=_0xedce88[_0x561a('0x53')][_0x561a('0x5d')];return db[_0x561a('0x39')][_0x561a('0x52')]({'where':{'id':_0xedce88['params']['id'],'UserId':null}})[_0x561a('0x35')](handleEntityNotFound(_0x106130,null))[_0x561a('0x35')](function(_0x94a7a){if(_0x94a7a){_0x4b31a0[_0x561a('0x26')]=_0x94a7a[_0x561a('0x5e')]({'plain':!![]});return db[_0x561a('0x76')][_0x561a('0x52')]({'where':{'id':_0x94a7a['FaxInteractionId']}});}return null;})[_0x561a('0x35')](handleEntityNotFound(_0x106130,null))[_0x561a('0x35')](function(_0x24c269){if(_0x24c269){_0x4b31a0[_0x561a('0x61')]=_0x24c269['get']({'plain':!![]});interaction_log[_0x561a('0x20')](_0x561a('0x77'),_0xedce88[_0x561a('0x63')]['id'],_0xedce88['user'][_0x561a('0x36')],_0xedce88[_0x561a('0x63')]['role'],_0x4b31a0[_0x561a('0x61')]['id'],_0xedce88['body']?JSON[_0x561a('0x23')](_0xedce88[_0x561a('0x53')]):'null');return respondWithRpcPromise(_0x561a('0x78'),_0x561a('0x79'),_0x4b31a0);}return null;})['then'](function(_0x7e5f59){var _0x201d14=_0x561a('0x66')+_0x7e5f59[_0x561a('0x26')][_0x561a('0x67')];return db[_0x561a('0x68')]['query'](_0x201d14,{'type':db[_0x561a('0x69')][_0x561a('0x6a')][_0x561a('0x6b')],'raw':!![]})[_0x561a('0x35')](function(_0x4e7514){return _0x4e7514;});})[_0x561a('0x35')](function(_0x528917){if(_0x528917){_0x4b31a0[_0x561a('0x26')]['contact']=_0x528917[0x0];if(!_0xedce88[_0x561a('0x53')][_0x561a('0x5d')])return;return db[_0x561a('0x7a')][_0x561a('0x52')]({'where':{'id':_0xedce88[_0x561a('0x53')]['UserId'],'role':_0x561a('0x6d')},'attributes':['id',_0x561a('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x3f9af3){if(!_0x3f9af3)return null;_0x4b31a0[_0x561a('0x26')][_0x561a('0x6d')]=_0x3f9af3;return _0x4b31a0;})['then'](function(_0x164450){if(_0x164450){_0x164450[_0x561a('0x26')]['interface']=util['format'](_0x561a('0x7b'),_0xedce88[_0x561a('0x63')][_0x561a('0x36')]);_0x164450['message'][_0x561a('0x71')]=_0x4b31a0[_0x561a('0x71')];_0x164450[_0x561a('0x26')][_0x561a('0x72')]=_0x4b31a0[_0x561a('0x71')];_0x164450[_0x561a('0x26')][_0x561a('0x73')]=_0x561a('0x32');respondWithRpcPromise('EventManager',_0x561a('0x74'),{'event':_0x561a('0x7c'),'message':_0x164450[_0x561a('0x26')]},client9002);return _0x4b31a0;}return null;})[_0x561a('0x35')](respondWithResult(_0x106130,null))[_0x561a('0x27')](handleError(_0x106130,null));};exports[_0x561a('0x7d')]=function(_0x81ce52,_0x38680c){var _0x2957b7;return db[_0x561a('0x39')][_0x561a('0x7d')](_0x81ce52[_0x561a('0x53')],{})[_0x561a('0x35')](function(_0x278e37){_0x2957b7=_0x278e37;return db[_0x561a('0x7e')][_0x561a('0x7f')]({'where':{'id':_0x2957b7[_0x561a('0x67')]}});})[_0x561a('0x35')](function(_0x40dcd0){if(_[_0x561a('0x60')](_0x40dcd0)){return;}else{_0x2957b7[_0x561a('0x59')]=_0x40dcd0[_0x561a('0x59')];return db[_0x561a('0x80')][_0x561a('0x7f')]({'where':{'id':_0x2957b7['AttachmentId']}});}})[_0x561a('0x35')](function(_0x2e434a){return respondWithRpcPromise(_0x561a('0x81'),_0x561a('0x81'),{'FaxAccountId':_[_0x561a('0x60')](_0x81ce52['body'])?undefined:_0x81ce52[_0x561a('0x53')][_0x561a('0x82')],'path':_[_0x561a('0x60')](_0x2e434a)?undefined:util['format'](_0x561a('0x83'),_0x2e434a[_0x561a('0x84')]),'fax':_[_0x561a('0x60')](_0x2957b7['fax'])?undefined:_0x2957b7[_0x561a('0x59')],'AttachmentId':_0x2957b7['AttachmentId']},client9002);})[_0x561a('0x35')](respondWithResult(_0x38680c,0xc9))[_0x561a('0x27')](handleError(_0x38680c,null));};exports[_0x561a('0x85')]=function(_0x26beff,_0x33fdc0){var _0xa83de=path[_0x561a('0x86')](config['root'],'server',_0x561a('0x87'),_0x561a('0x88'));return db[_0x561a('0x39')][_0x561a('0x52')]({'where':{'id':_0x26beff[_0x561a('0x54')]['id']},'include':[{'model':db[_0x561a('0x80')],'as':_0x561a('0x80')}]})[_0x561a('0x35')](handleEntityNotFound(_0x33fdc0,null))[_0x561a('0x35')](function(_0x2c7c4a){if(_0x2c7c4a){return _0x33fdc0[_0x561a('0x85')](path[_0x561a('0x86')](_0xa83de,_0x2c7c4a[_0x561a('0x80')]['basename']));}})[_0x561a('0x27')](handleError(_0x33fdc0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 87d98eb..4cca517 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f35=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x3f35[_0x1e3c16];return _0x47a0c9;};'use strict';var EventEmitter=require(_0x53f3('0x0'));var FaxMessage=require(_0x53f3('0x1'))['db'][_0x53f3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x53f3('0x3')](0x0);var events={'afterCreate':_0x53f3('0x4'),'afterUpdate':_0x53f3('0x5'),'afterDestroy':_0x53f3('0x6')};function emitEvent(_0x58c9c6){return function(_0x118090,_0x5e8cc8,_0xc0bfc9){FaxMessageEvents['emit'](_0x58c9c6+':'+_0x118090['id'],_0x118090);FaxMessageEvents[_0x53f3('0x7')](_0x58c9c6,_0x118090);_0xc0bfc9(null);};}for(var e in events){if(events[_0x53f3('0x8')](e)){var event=events[e];FaxMessage[_0x53f3('0x9')](e,emitEvent(event));}}module[_0x53f3('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x2d2c=['../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0x11d9ac,_0xaa79c9){var _0x39a310=function(_0x58fbf5){while(--_0x58fbf5){_0x11d9ac['push'](_0x11d9ac['shift']());}};_0x39a310(++_0xaa79c9);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0x2d2c[_0x232ec0];return _0x356705;};'use strict';var EventEmitter=require(_0xc2d2('0x0'));var FaxMessage=require(_0xc2d2('0x1'))['db'][_0xc2d2('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc2d2('0x3')](0x0);var events={'afterCreate':_0xc2d2('0x4'),'afterUpdate':_0xc2d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c20ae){return function(_0x4ea94c,_0x22d836,_0x192a26){FaxMessageEvents[_0xc2d2('0x6')](_0x3c20ae+':'+_0x4ea94c['id'],_0x4ea94c);FaxMessageEvents[_0xc2d2('0x6')](_0x3c20ae,_0x4ea94c);_0x192a26(null);};}for(var e in events){if(events[_0xc2d2('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5262b89..d923502 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8cd=['out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x254f9d,_0x2a00c0){var _0x436dd3=function(_0x538a40){while(--_0x538a40){_0x254f9d['push'](_0x254f9d['shift']());}};_0x436dd3(++_0x2a00c0);}(_0xa8cd,0x142));var _0xda8c=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xa8cd[_0x2e58c7];return _0x26eb00;};'use strict';var _=require(_0xda8c('0x0'));var util=require(_0xda8c('0x1'));var logger=require(_0xda8c('0x2'))(_0xda8c('0x3'));var moment=require(_0xda8c('0x4'));var BPromise=require(_0xda8c('0x5'));var rp=require(_0xda8c('0x6'));var fs=require('fs');var path=require(_0xda8c('0x7'));var rimraf=require('rimraf');var config=require(_0xda8c('0x8'));var attributes=require(_0xda8c('0x9'));module[_0xda8c('0xa')]=function(_0x1c8693,_0x8f3fdb){return _0x1c8693[_0xda8c('0xb')](_0xda8c('0xc'),attributes,{'tableName':_0xda8c('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xda8c('0xe')],'type':_0xda8c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e611f,_0x2521a5,_0x383972){var _0x10a2ab=_0x1c8693['models'];var _0x42d410=_0x2e611f[_0xda8c('0x10')]({'plain':!![]});if(_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()==='in'||_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()===_0xda8c('0x13')&&!_0x42d410[_0xda8c('0x14')]&&!_['isNil'](_0x42d410[_0xda8c('0x15')])){_0x10a2ab[_0xda8c('0x16')][_0xda8c('0x17')]({'where':{'id':_0x42d410[_0xda8c('0x18')]}})[_0xda8c('0x19')](function(_0x388621){if(_0x388621){_0x388621[_0xda8c('0x1a')]({'lastMsgAt':_0x42d410[_0xda8c('0x1b')],'lastMsgDirection':_0x42d410[_0xda8c('0x11')][_0xda8c('0x12')]()});}})['catch'](function(_0x57d3e6){console[_0xda8c('0x1c')](_0x57d3e6);});}_0x383972();}},'charset':_0xda8c('0x1d'),'collate':_0xda8c('0x1e')});}; \ No newline at end of file +var _0x975c=['moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x975c,0x1a0));var _0xc975=function(_0x51f7b9,_0x2b8092){_0x51f7b9=_0x51f7b9-0x0;var _0x1c081f=_0x975c[_0x51f7b9];return _0x1c081f;};'use strict';var _=require(_0xc975('0x0'));var util=require(_0xc975('0x1'));var logger=require(_0xc975('0x2'))(_0xc975('0x3'));var moment=require(_0xc975('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc975('0x5'));var rimraf=require(_0xc975('0x6'));var config=require(_0xc975('0x7'));var attributes=require(_0xc975('0x8'));module['exports']=function(_0x25a852,_0x1235a3){return _0x25a852[_0xc975('0x9')](_0xc975('0xa'),attributes,{'tableName':_0xc975('0xb'),'paranoid':![],'indexes':[{'name':_0xc975('0xc'),'fields':[_0xc975('0xd')],'type':_0xc975('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8c4041,_0x368188,_0x272959){var _0x301a92=_0x25a852['models'];var _0x720fe1=_0x8c4041[_0xc975('0xf')]({'plain':!![]});if(_0x720fe1[_0xc975('0x10')][_0xc975('0x11')]()==='in'||_0x720fe1[_0xc975('0x10')]['toLowerCase']()==='out'&&!_0x720fe1[_0xc975('0x12')]&&!_[_0xc975('0x13')](_0x720fe1[_0xc975('0x14')])){_0x301a92[_0xc975('0x15')][_0xc975('0x16')]({'where':{'id':_0x720fe1['FaxInteractionId']}})[_0xc975('0x17')](function(_0x495b33){if(_0x495b33){_0x495b33[_0xc975('0x18')]({'lastMsgAt':_0x720fe1[_0xc975('0x19')],'lastMsgDirection':_0x720fe1[_0xc975('0x10')][_0xc975('0x11')]()});}})[_0xc975('0x1a')](function(_0x3af24c){console[_0xc975('0x1b')](_0x3af24c);});}_0x272959();}},'charset':_0xc975('0x1c'),'collate':_0xc975('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e05556d..8bffc0f 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','body','options','raw','then','FaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','bluebird','randomstring'];(function(_0x43dab2,_0x58a482){var _0x4c97e3=function(_0x3373d2){while(--_0x3373d2){_0x43dab2['push'](_0x43dab2['shift']());}};_0x4c97e3(++_0x58a482);}(_0xa41a,0x6b));var _0xaa41=function(_0x3f0b7e,_0x25c5a6){_0x3f0b7e=_0x3f0b7e-0x0;var _0x2bb8f3=_0xa41a[_0x3f0b7e];return _0x2bb8f3;};'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});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['FaxMessage']['create'](_0x35c753[_0xaa41('0x1c')],{'raw':_0x35c753['options']?_0x35c753[_0xaa41('0x1d')][_0xaa41('0x1e')]===undefined?!![]:![]:!![]})[_0xaa41('0x1f')](function(_0x1f27f3){logger[_0xaa41('0x11')]('CreateFaxMessage',_0x35c753);logger[_0xaa41('0x12')](_0xaa41('0x1b'),_0x35c753,JSON[_0xaa41('0x14')](_0x1f27f3));_0x2bf794(_0x1f27f3);})[_0xaa41('0x1a')](function(_0x274630){logger[_0xaa41('0x15')]('CreateFaxMessage',_0x274630['message'],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x274630['message']));});});};exports['UpdateFaxMessage']=function(_0x12e362){var _0x59707f=this;return new Promise(function(_0x536bed,_0x2d0ac0){return db[_0xaa41('0x20')][_0xaa41('0x21')](_0x12e362[_0xaa41('0x1c')],{'raw':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x22')]||null:null,'attributes':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x23')]||null:null,'limit':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['limit']||null:null})[_0xaa41('0x1f')](function(_0x48b48b){logger['info'](_0xaa41('0x24'),_0x12e362);logger[_0xaa41('0x12')]('UpdateFaxMessage',_0x12e362,JSON[_0xaa41('0x14')](_0x48b48b));_0x536bed(_0x48b48b);})[_0xaa41('0x1a')](function(_0x4e3b44){logger['error']('UpdateFaxMessage',_0x4e3b44[_0xaa41('0x18')],_0x12e362);_0x2d0ac0(_0x59707f[_0xaa41('0x15')](0x1f4,_0x4e3b44[_0xaa41('0x18')]));});});}; \ No newline at end of file +var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xed1f,0x6a));var _0xfed1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xed1f[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fc0dc4f..f4d46dc 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0db0=['remove','emit','./faxMessage.events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0db0,0x16a));var _0x00db=function(_0x4d0f0e,_0x21b7e0){_0x4d0f0e=_0x4d0f0e-0x0;var _0x654fad=_0x0db0[_0x4d0f0e];return _0x654fad;};'use strict';var FaxMessageEvents=require(_0x00db('0x0'));var events=['save',_0x00db('0x1'),'update'];function createListener(_0x2068ae,_0x302342){return function(_0x17f27f){_0x302342[_0x00db('0x2')](_0x2068ae,_0x17f27f);};}function removeListener(_0x395e2b,_0x52d740){return function(){FaxMessageEvents['removeListener'](_0x395e2b,_0x52d740);};}exports['register']=function(_0x1553ef){for(var _0x57b979=0x0,_0x379e88=events['length'];_0x57b979<_0x379e88;_0x57b979++){var _0x173fdc=events[_0x57b979];var _0x556cc8=createListener('faxMessage:'+_0x173fdc,_0x1553ef);FaxMessageEvents['on'](_0x173fdc,_0x556cc8);}}; \ No newline at end of file +var _0xcb89=['removeListener','register','length','faxMessage:','save','remove','update','emit'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xcb89,0x1dc));var _0x9cb8=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xcb89[_0x45d55e];return _0x29812a;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x9cb8('0x0'),_0x9cb8('0x1'),_0x9cb8('0x2')];function createListener(_0x2d02ab,_0x24ad8e){return function(_0x34a867){_0x24ad8e[_0x9cb8('0x3')](_0x2d02ab,_0x34a867);};}function removeListener(_0x3fae5e,_0xdf7fa4){return function(){FaxMessageEvents[_0x9cb8('0x4')](_0x3fae5e,_0xdf7fa4);};}exports[_0x9cb8('0x5')]=function(_0x29b722){for(var _0x3fd33f=0x0,_0x1acaac=events[_0x9cb8('0x6')];_0x3fd33f<_0x1acaac;_0x3fd33f++){var _0x2f2c83=events[_0x3fd33f];var _0x40099d=createListener(_0x9cb8('0x7')+_0x2f2c83,_0x29b722);FaxMessageEvents['on'](_0x2f2c83,_0x40099d);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ab4d2c3..f3d705b 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','download','fax','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x3f5a64,_0x56027f){var _0x3725b3=function(_0x3f6e57){while(--_0x3f6e57){_0x3f5a64['push'](_0x3f5a64['shift']());}};_0x3725b3(++_0x56027f);}(_0x44a3,0x1a9));var _0x344a=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x44a3[_0xb4788];return _0xd49d21;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/download',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),interaction['tracked'](_0x344a('0x10'),'faxmessage:create'),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x344a('0x13')]);router[_0x344a('0x12')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);router[_0x344a('0x12')]('/:id/reject',auth[_0x344a('0xb')](),controller[_0x344a('0x16')]);router[_0x344a('0x17')](_0x344a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x344a('0x18')]=router; \ No newline at end of file +var _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e0b7e42..8a6447c 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe07e=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x12cf3e,_0x3c67b7){var _0x1bc889=function(_0x528118){while(--_0x528118){_0x12cf3e['push'](_0x12cf3e['shift']());}};_0x1bc889(++_0x3c67b7);}(_0xe07e,0xa3));var _0xee07=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0xe07e[_0x13524d];return _0x9918b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee07('0x0')],'unique':_0xee07('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee07('0x0')]},'timeout':{'type':Sequelize[_0xee07('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee07('0x3')](_0xee07('0x4'),'beepall',_0xee07('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xee07('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf319=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x25a8bb,_0x3e1a5a){var _0x1e909e=function(_0x218dc3){while(--_0x218dc3){_0x25a8bb['push'](_0x25a8bb['shift']());}};_0x1e909e(++_0x3e1a5a);}(_0xf319,0xe8));var _0x9f31=function(_0x31b82f,_0x154114){_0x31b82f=_0x31b82f-0x0;var _0x2ac819=_0xf319[_0x31b82f];return _0x2ac819;};'use strict';var Sequelize=require(_0x9f31('0x0'));module[_0x9f31('0x1')]={'name':{'type':Sequelize[_0x9f31('0x2')],'unique':_0x9f31('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9f31('0x2')]},'timeout':{'type':Sequelize[_0x9f31('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9f31('0x5')]('rrmemory',_0x9f31('0x6'),_0x9f31('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9f31('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 3cb8ab7..665862d 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44fe=['spread','userFaxQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','sendStatus','stack','name','index','map','FaxQueue','fieldName','type','key','query','rows','catch','show','params','model','keys','attributes','intersection','fields','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','options','User','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','findAll','Agents','online','voicePause','flatMap','transaction','each','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','all','union','value','isEmpty','userFaxQueue:remove','omit'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x44fe,0x16f));var _0xe44f=function(_0x3500f0,_0x2a3fca){_0x3500f0=_0x3500f0-0x0;var _0x3d3dd2=_0x44fe[_0x3500f0];return _0x3d3dd2;};'use strict';var BPromise=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var _=require(_0xe44f('0x2'));var squel=require(_0xe44f('0x3'));var Redis=require(_0xe44f('0x4'));var qs=require(_0xe44f('0x5'));var logger=require(_0xe44f('0x6'))(_0xe44f('0x7'));var config=require(_0xe44f('0x8'));var db=require(_0xe44f('0x9'))['db'];config[_0xe44f('0xa')]=_['defaults'](config['redis'],{'host':_0xe44f('0xb'),'port':0x18eb});var socket=require(_0xe44f('0xc'))(new Redis(config['redis']));require(_0xe44f('0xd'))[_0xe44f('0xe')](socket);function respondWithStatusCode(_0x110de4,_0xdad72b){_0xdad72b=_0xdad72b||0xcc;return function(_0x47726a){if(_0x47726a){return _0x110de4['sendStatus'](_0xdad72b);}return _0x110de4[_0xe44f('0xf')](_0xdad72b)[_0xe44f('0x10')]();};}function respondWithResult(_0x44b180,_0x447184){_0x447184=_0x447184||0xc8;return function(_0x2d6ec5){if(_0x2d6ec5){return _0x44b180[_0xe44f('0xf')](_0x447184)[_0xe44f('0x11')](_0x2d6ec5);}};}function respondWithFilteredResult(_0xdb9b6c,_0x3b41c3){return function(_0x4971ab){if(_0x4971ab){var _0x1972ce=typeof _0x3b41c3[_0xe44f('0x12')]==='undefined'&&typeof _0x3b41c3[_0xe44f('0x13')]===_0xe44f('0x14');var _0x12cdf1=_0x4971ab[_0xe44f('0x15')];var _0x3c78e1=_0x1972ce?0x0:_0x3b41c3[_0xe44f('0x12')];var _0x3ec218=_0x1972ce?_0x4971ab[_0xe44f('0x15')]:_0x3b41c3['offset']+_0x3b41c3[_0xe44f('0x13')];var _0x1fa09f;if(_0x3ec218>=_0x12cdf1){_0x3ec218=_0x12cdf1;_0x1fa09f=0xc8;}else{_0x1fa09f=0xce;}_0xdb9b6c[_0xe44f('0xf')](_0x1fa09f);return _0xdb9b6c[_0xe44f('0x16')](_0xe44f('0x17'),_0x3c78e1+'-'+_0x3ec218+'/'+_0x12cdf1)[_0xe44f('0x11')](_0x4971ab);}return null;};}function saveUpdates(_0x3ee3f9){return function(_0x4029fe){if(_0x4029fe){return _0x4029fe[_0xe44f('0x18')](_0x3ee3f9)[_0xe44f('0x19')](function(_0x163af0){return _0x163af0;});}return null;};}function removeEntity(_0x3e7d5e){return function(_0x4c70e5){if(_0x4c70e5){return _0x4c70e5['destroy']()[_0xe44f('0x19')](function(){var _0x309a28=_0x4c70e5[_0xe44f('0x1a')]({'plain':!![]});var _0x117a30=_0xe44f('0x1b');return db[_0xe44f('0x1c')][_0xe44f('0x1d')]({'where':{'type':_0x117a30,'resourceId':_0x309a28['id']}})[_0xe44f('0x19')](function(){return _0x4c70e5;});})[_0xe44f('0x19')](function(){_0x3e7d5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2756e3){return function(_0x3fe450){if(!_0x3fe450){_0x2756e3[_0xe44f('0x1e')](0x194);}return _0x3fe450;};}function handleError(_0x3f7ef8,_0xf3c259){_0xf3c259=_0xf3c259||0x1f4;return function(_0x538a03){logger['error'](_0x538a03[_0xe44f('0x1f')]);if(_0x538a03[_0xe44f('0x20')]){delete _0x538a03[_0xe44f('0x20')];}_0x3f7ef8[_0xe44f('0xf')](_0xf3c259)['send'](_0x538a03);};}exports[_0xe44f('0x21')]=function(_0xb84f2d,_0x384c82){var _0x90d216={};var _0x59667c={'count':0x0,'rows':[]};var _0x45a632=_[_0xe44f('0x22')](db[_0xe44f('0x23')]['rawAttributes'],function(_0x4e3cce){return{'name':_0x4e3cce[_0xe44f('0x24')],'type':_0x4e3cce[_0xe44f('0x25')][_0xe44f('0x26')]};});_0x90d216=qs['getOptions'](_0x45a632,_0xb84f2d);var _0x460e67={'where':_0x90d216['where']};return db[_0xe44f('0x23')][_0xe44f('0x15')](_0x460e67)[_0xe44f('0x19')](function(_0x50eba5){_0x59667c['count']=_0x50eba5;_0x90d216['include']=qs['include'](_0xb84f2d[_0xe44f('0x27')]);return db[_0xe44f('0x23')]['findAll'](_0x90d216);})[_0xe44f('0x19')](function(_0x180047){_0x59667c[_0xe44f('0x28')]=_0x180047;return _0x59667c;})[_0xe44f('0x19')](respondWithFilteredResult(_0x384c82,_0x90d216))[_0xe44f('0x29')](handleError(_0x384c82,null));};exports[_0xe44f('0x2a')]=function(_0x59788c,_0x2f22d9){var _0x5af7ff={'raw':!![],'where':{'id':_0x59788c[_0xe44f('0x2b')]['id']}},_0x366f19={};_0x366f19[_0xe44f('0x2c')]=_['keys'](db[_0xe44f('0x23')]['rawAttributes']);_0x366f19[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x59788c[_0xe44f('0x27')]);_0x366f19['filters']=_['intersection'](_0x366f19[_0xe44f('0x2c')],_0x366f19[_0xe44f('0x27')]);_0x5af7ff[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x366f19['model'],qs[_0xe44f('0x30')](_0x59788c[_0xe44f('0x27')]['fields']));_0x5af7ff[_0xe44f('0x2e')]=_0x5af7ff[_0xe44f('0x2e')]['length']?_0x5af7ff[_0xe44f('0x2e')]:_0x366f19[_0xe44f('0x2c')];if(_0x59788c[_0xe44f('0x27')][_0xe44f('0x31')]){_0x5af7ff[_0xe44f('0x32')]=[{'all':!![]}];}_0x5af7ff=_[_0xe44f('0x33')]({},_0x5af7ff,_0x59788c['options']);return db['FaxQueue'][_0xe44f('0x34')](_0x5af7ff)['then'](handleEntityNotFound(_0x2f22d9,null))[_0xe44f('0x19')](respondWithResult(_0x2f22d9,null))[_0xe44f('0x29')](handleError(_0x2f22d9,null));};exports['create']=function(_0x9e5556,_0x41ff84){return db[_0xe44f('0x23')][_0xe44f('0x35')](_0x9e5556[_0xe44f('0x36')],{})[_0xe44f('0x19')](function(_0x2fe610){var _0x135cc2=_0x9e5556[_0xe44f('0x37')][_0xe44f('0x1a')]({'plain':!![]});if(!_0x135cc2)throw new Error(_0xe44f('0x38'));if(_0x135cc2[_0xe44f('0x39')]===_0xe44f('0x37')){var _0x2a82ca=_0x2fe610[_0xe44f('0x1a')]({'plain':!![]});var _0x1df395=_0xe44f('0x1b');return db[_0xe44f('0x3a')][_0xe44f('0x34')]({'where':{'name':_0x1df395,'userProfileId':_0x135cc2['userProfileId']},'raw':!![]})['then'](function(_0x22d813){if(_0x22d813&&_0x22d813[_0xe44f('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a82ca[_0xe44f('0x20')],'resourceId':_0x2a82ca['id'],'type':_0x22d813[_0xe44f('0x20')],'sectionId':_0x22d813['id']},{})[_0xe44f('0x19')](function(){return _0x2fe610;});}else{return _0x2fe610;}})[_0xe44f('0x29')](function(_0x5b38ac){logger[_0xe44f('0x3c')](_0xe44f('0x3d'),_0x5b38ac);throw _0x5b38ac;});}return _0x2fe610;})[_0xe44f('0x19')](respondWithResult(_0x41ff84,0xc9))[_0xe44f('0x29')](handleError(_0x41ff84,null));};exports[_0xe44f('0x18')]=function(_0x3b85a9,_0x481d88){if(_0x3b85a9[_0xe44f('0x36')]['id']){delete _0x3b85a9['body']['id'];}return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x3b85a9[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x481d88,null))['then'](saveUpdates(_0x3b85a9['body'],null))[_0xe44f('0x19')](respondWithResult(_0x481d88,null))[_0xe44f('0x29')](handleError(_0x481d88,null));};exports['destroy']=function(_0x5ea96c,_0x53252b){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5ea96c['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x53252b,null))['then'](removeEntity(_0x53252b,null))[_0xe44f('0x29')](handleError(_0x53252b,null));};exports['describe']=function(_0x492030,_0x42ee16){return db[_0xe44f('0x23')][_0xe44f('0x3e')]()[_0xe44f('0x19')](respondWithResult(_0x42ee16,null))[_0xe44f('0x29')](handleError(_0x42ee16,null));};exports[_0xe44f('0x3f')]=function(_0x553e10,_0x14d87a){var _0x4bcba8={'raw':!![],'where':{}},_0x1177f4={},_0x39fe4f;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x553e10[_0xe44f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x14d87a,null))[_0xe44f('0x19')](function(_0x4c2259){if(_0x4c2259){_0x39fe4f=_0x4c2259['get']({'plain':!![]});_0x1177f4['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x41')][_0xe44f('0x42')]);_0x1177f4[_0xe44f('0x27')]=_['keys'](_0x553e10[_0xe44f('0x27')]);_0x1177f4[_0xe44f('0x43')]=_['intersection'](_0x1177f4[_0xe44f('0x2c')],_0x1177f4[_0xe44f('0x27')]);_0x4bcba8[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x1177f4['model'],qs[_0xe44f('0x30')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x30')]));_0x4bcba8[_0xe44f('0x2e')]=_0x4bcba8[_0xe44f('0x2e')]['length']?_0x4bcba8[_0xe44f('0x2e')]:_0x1177f4[_0xe44f('0x2c')];if(!_0x553e10[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x4bcba8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x553e10[_0xe44f('0x27')]['limit']);_0x4bcba8[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x12')]);}_0x4bcba8[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x47')]);_0x4bcba8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x553e10['query'],_0x1177f4[_0xe44f('0x43')]));_0x4bcba8[_0xe44f('0x48')][_0xe44f('0x4a')]=_0x4c2259['id'];if(_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x4bcba8['where']=_[_0xe44f('0x33')](_0x4bcba8[_0xe44f('0x48')],{'$or':_[_0xe44f('0x22')](_0x4bcba8[_0xe44f('0x2e')],function(_0x3c9556){var _0x2a3055={};_0x2a3055[_0x3c9556]={'$like':'%'+_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x2a3055;})});}_0x4bcba8=_[_0xe44f('0x33')]({},_0x4bcba8,_0x553e10[_0xe44f('0x4c')]);return db[_0xe44f('0x41')]['findAll'](_0x4bcba8);}})[_0xe44f('0x19')](function(_0xb01d5f){if(_0xb01d5f){return db[_0xe44f('0x4d')][_0xe44f('0x4e')]({'where':{'id':_['map'](_0xb01d5f,'UserId'),'role':_0xe44f('0x4f')},'attributes':['id',_0xe44f('0x20'),_0xe44f('0x50'),_0xe44f('0x51'),'createdAt']});}})[_0xe44f('0x19')](function(_0x106e02){if(_0x106e02){return{'count':_0x106e02[_0xe44f('0x15')],'rows':_['map'](_0x106e02[_0xe44f('0x28')],function(_0x2a2090){return{'membername':_0x2a2090[_0xe44f('0x20')],'UserId':_0x2a2090['id'],'queue_name':_0x39fe4f[_0xe44f('0x20')],'FaxQueueId':_0x39fe4f['id'],'interface':util[_0xe44f('0x52')](_0xe44f('0x53'),_0xe44f('0x54'),_0x2a2090[_0xe44f('0x20')]),'penalty':0x0,'paused':_0x2a2090['faxPause'],'createdAt':_0x2a2090[_0xe44f('0x55')],'updatedAt':_0x2a2090['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14d87a,_0x4bcba8))[_0xe44f('0x29')](handleError(_0x14d87a,null));};exports[_0xe44f('0x56')]=function(_0x6382e8,_0x4839c6){var _0x493cc0={};var _0x52f53e={};var _0x1eb147;var _0xb781c7;return db['FaxQueue']['findOne']({'where':{'id':_0x6382e8[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x4839c6,null))[_0xe44f('0x19')](function(_0x4335ca){if(_0x4335ca){_0x1eb147=_0x4335ca;_0x52f53e['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x57')]['rawAttributes']);_0x52f53e['query']=_[_0xe44f('0x2d')](_0x6382e8['query']);_0x52f53e[_0xe44f('0x43')]=_['intersection'](_0x52f53e[_0xe44f('0x2c')],_0x52f53e[_0xe44f('0x27')]);_0x493cc0[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x52f53e['model'],qs[_0xe44f('0x30')](_0x6382e8['query'][_0xe44f('0x30')]));_0x493cc0['attributes']=_0x493cc0[_0xe44f('0x2e')][_0xe44f('0x58')]?_0x493cc0[_0xe44f('0x2e')]:_0x52f53e[_0xe44f('0x2c')];_0x493cc0[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x47')]);_0x493cc0[_0xe44f('0x48')]=qs['filters'](_['pick'](_0x6382e8[_0xe44f('0x27')],_0x52f53e['filters']));if(_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x493cc0[_0xe44f('0x48')]=_['merge'](_0x493cc0['where'],{'$or':_['map'](_0x493cc0[_0xe44f('0x2e')],function(_0x1b80ec){var _0x573734={};_0x573734[_0x1b80ec]={'$like':'%'+_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x573734;})});}_0x493cc0=_['merge']({},_0x493cc0,_0x6382e8[_0xe44f('0x4c')]);return _0x1eb147['getTeams'](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5d9bb3){if(_0x5d9bb3){_0xb781c7=_0x5d9bb3['length'];if(!_0x6382e8[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x493cc0[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x6382e8[_0xe44f('0x27')]['limit']);_0x493cc0[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x1eb147[_0xe44f('0x56')](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5ac123){if(_0x5ac123){return _0x5ac123?{'count':_0xb781c7,'rows':_0x5ac123}:null;}})[_0xe44f('0x19')](respondWithResult(_0x4839c6,null))[_0xe44f('0x29')](handleError(_0x4839c6,null));};exports[_0xe44f('0x59')]=function(_0x21ab43,_0x977bce){var _0x150561=_0x21ab43['body'][_0xe44f('0x5a')];return db['Team'][_0xe44f('0x5b')]({'where':{'id':_0x150561},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id',_0xe44f('0x20'),_0xe44f('0x5d'),_0xe44f('0x5e'),'interface'],'raw':!![]}]})[_0xe44f('0x19')](function(_0xf654c8){if(_0xf654c8){var _0x3dd3cd=_[_0xe44f('0x5f')](_0xf654c8,function(_0x3de607){var _0x36a9c8=_0x3de607[_0xe44f('0x1a')]({'plain':!![]});return _0x36a9c8[_0xe44f('0x5c')];});return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x21ab43[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x39c48d){return db['sequelize'][_0xe44f('0x60')](function(_0x1da6ff){return _0x39c48d[_0xe44f('0x59')](_0x150561,{'transaction':_0x1da6ff})[_0xe44f('0x19')](function(){return BPromise[_0xe44f('0x61')](_0x3dd3cd,function(_0x174a12){return db[_0xe44f('0x41')]['findOrCreate']({'where':{'UserId':_0x174a12['id'],'FaxQueueId':_0x21ab43[_0xe44f('0x2b')]['id']},'transaction':_0x1da6ff});});})[_0xe44f('0x19')](function(){_0x3dd3cd[_0xe44f('0x62')](function(_0x2b1f60){socket[_0xe44f('0x63')]('userFaxQueue:save',{'UserId':_0x2b1f60['id'],'FaxQueueId':_0x39c48d['id']});});});});});}})['then'](respondWithStatusCode(_0x977bce,null))['catch'](handleError(_0x977bce,null));};exports['removeTeams']=function(_0x5f08f2,_0x132d0c){return db[_0xe44f('0x57')][_0xe44f('0x5b')]({'where':{'id':_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x132d0c,null))[_0xe44f('0x19')](function(_0x7f9f9d){var _0x440ad9=_['map'](_0x7f9f9d,'id');var _0x5b22ae=[];var _0x22512b=[];var _0x417197=squel[_0xe44f('0x64')]();_0x417197[_0xe44f('0x65')](_0xe44f('0x66'))[_0xe44f('0x67')](_0xe44f('0x68'),'tq')['join'](_0xe44f('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe44f('0x48')]('FaxQueueId\x20=\x20?',_0x5f08f2['params']['id']);for(var _0x37f52c=0x0;_0x37f52c<_0x7f9f9d['length'];_0x37f52c+=0x1){let _0x4c4a68=_0x7f9f9d[_0x37f52c];for(var _0x2aea58=0x0;_0x2aea58<_0x4c4a68[_0xe44f('0x5c')][_0xe44f('0x58')];_0x2aea58+=0x1){let _0x4f07ce=_0x4c4a68['Agents'][_0x2aea58];var _0x183dd1=_0x417197['clone']();_0x183dd1[_0xe44f('0x48')](_0xe44f('0x6a'),_0x4f07ce['id']);_0x22512b[_0xe44f('0x6b')](db[_0xe44f('0x6c')][_0xe44f('0x27')](_0x183dd1['toString'](),{'type':db['sequelize'][_0xe44f('0x6d')]['SELECT']})[_0xe44f('0x19')](function(_0x5ca74e){if(_0x5ca74e[_0xe44f('0x58')]===0x1){return _0x4f07ce['id'];}else{var _0x36eb20=_[_0xe44f('0x6e')](_[_0xe44f('0x22')](_0x5ca74e,'TeamId'),function(_0x304b91){return _['includes'](_0x440ad9,_0x304b91);});if(_0x36eb20){return _0x4f07ce['id'];}}}));}}return BPromise[_0xe44f('0x6f')](_0x22512b)[_0xe44f('0x19')](function(_0x107f16){_0x5b22ae=_(_0x5b22ae)[_0xe44f('0x70')](_0x107f16)['compact']()[_0xe44f('0x71')]();return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5f08f2[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x268486){return db[_0xe44f('0x6c')]['transaction'](function(_0x4e7f54){return _0x268486['removeTeams'](_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')],{'transaction':_0x4e7f54})['then'](function(){if(!_[_0xe44f('0x72')](_0x5b22ae)){return _0x268486['removeAgents'](_0x5b22ae,{'transaction':_0x4e7f54});}})['then'](function(){_0x5b22ae['forEach'](function(_0x3be1bd){socket['emit'](_0xe44f('0x73'),{'UserId':_0x3be1bd,'FaxQueueId':_0x268486['id']});});});});});});})[_0xe44f('0x19')](respondWithStatusCode(_0x132d0c,null))['catch'](handleError(_0x132d0c,null));};exports['addAgents']=function(_0x56c0c5,_0x50111c){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x56c0c5['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x50111c,null))[_0xe44f('0x19')](function(_0x52cf4e){if(_0x52cf4e){return _0x52cf4e['addAgents'](_0x56c0c5['body'][_0xe44f('0x5a')],_[_0xe44f('0x74')](_0x56c0c5[_0xe44f('0x36')],['ids','id'])||{})[_0xe44f('0x75')](function(_0x1f87a5){for(var _0x122f4d=0x0;_0x122f4d<_0x56c0c5['body'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x122f4d+=0x1){socket[_0xe44f('0x63')](_0xe44f('0x76'),{'UserId':Number(_0x56c0c5[_0xe44f('0x36')]['ids'][_0x122f4d]),'FaxQueueId':Number(_0x56c0c5[_0xe44f('0x2b')]['id'])});}return _0x1f87a5;});}})[_0xe44f('0x19')](respondWithResult(_0x50111c,null))[_0xe44f('0x29')](handleError(_0x50111c,null));};exports[_0xe44f('0x77')]=function(_0x4a4972,_0x14c855){return db[_0xe44f('0x23')]['find']({'where':{'id':_0x4a4972['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x14c855,null))[_0xe44f('0x19')](function(_0xa5720a){if(_0xa5720a){return _0xa5720a['removeAgents'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])[_0xe44f('0x19')](function(){if(_['isArray'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])){for(var _0x42f17a=0x0;_0x42f17a<_0x4a4972['query'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x42f17a+=0x1){socket['emit'](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')][_0x42f17a]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}}else{socket[_0xe44f('0x63')](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}});}})[_0xe44f('0x19')](respondWithStatusCode(_0x14c855,null))[_0xe44f('0x29')](handleError(_0x14c855,null));};exports[_0xe44f('0x78')]=function(_0x42b38e,_0x1e7da6){var _0x51c2d8={};var _0x25d94b={};var _0x6c249c;var _0x3c1cb6;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x42b38e[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x1e7da6,null))[_0xe44f('0x19')](function(_0x36359c){if(_0x36359c){_0x6c249c=_0x36359c;_0x25d94b['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x4d')][_0xe44f('0x42')]);_0x25d94b[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x42b38e[_0xe44f('0x27')]);_0x25d94b[_0xe44f('0x43')]=_[_0xe44f('0x2f')](_0x25d94b[_0xe44f('0x2c')],_0x25d94b[_0xe44f('0x27')]);_0x51c2d8['attributes']=_['intersection'](_0x25d94b['model'],qs[_0xe44f('0x30')](_0x42b38e['query']['fields']));_0x51c2d8[_0xe44f('0x2e')]=_0x51c2d8['attributes'][_0xe44f('0x58')]?_0x51c2d8[_0xe44f('0x2e')]:_0x25d94b['model'];_0x51c2d8[_0xe44f('0x46')]=qs['sort'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x47')]);_0x51c2d8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x42b38e[_0xe44f('0x27')],_0x25d94b[_0xe44f('0x43')]));if(_0x42b38e['query'][_0xe44f('0x4b')]){_0x51c2d8[_0xe44f('0x48')]=_[_0xe44f('0x33')](_0x51c2d8['where'],{'$or':_[_0xe44f('0x22')](_0x51c2d8['attributes'],function(_0x2c4774){var _0x5b5476={};_0x5b5476[_0x2c4774]={'$like':'%'+_0x42b38e[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x5b5476;})});}_0x51c2d8=_[_0xe44f('0x33')]({},_0x51c2d8,_0x42b38e[_0xe44f('0x4c')]);return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})[_0xe44f('0x19')](function(_0xe42016){if(_0xe42016){_0x3c1cb6=_0xe42016['length'];if(!_0x42b38e[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x51c2d8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x13')]);_0x51c2d8[_0xe44f('0x12')]=qs['offset'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})['then'](function(_0x59ac0c){if(_0x59ac0c){return _0x59ac0c?{'count':_0x3c1cb6,'rows':_0x59ac0c}:null;}})[_0xe44f('0x19')](respondWithResult(_0x1e7da6,null))[_0xe44f('0x29')](handleError(_0x1e7da6,null));}; \ No newline at end of file +var _0x1574=['model','keys','intersection','fields','attributes','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserFaxQueue','filters','order','sort','FaxQueueId','filter','User','agent','updatedAt','createdAt','rows','format','%s/%s','faxPause','Team','pick','getTeams','hasOwnProperty','nolimit','addTeams','ids','online','voicePause','interface','flatMap','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','omit','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll'];(function(_0x13d030,_0x58f2fe){var _0x3969b0=function(_0x20e106){while(--_0x20e106){_0x13d030['push'](_0x13d030['shift']());}};_0x3969b0(++_0x58f2fe);}(_0x1574,0x148));var _0x4157=function(_0x1c3287,_0x29a0a9){_0x1c3287=_0x1c3287-0x0;var _0x1db298=_0x1574[_0x1c3287];return _0x1db298;};'use strict';var BPromise=require(_0x4157('0x0'));var util=require(_0x4157('0x1'));var _=require(_0x4157('0x2'));var squel=require(_0x4157('0x3'));var Redis=require('ioredis');var qs=require(_0x4157('0x4'));var logger=require(_0x4157('0x5'))(_0x4157('0x6'));var config=require(_0x4157('0x7'));var db=require(_0x4157('0x8'))['db'];config[_0x4157('0x9')]=_[_0x4157('0xa')](config[_0x4157('0x9')],{'host':_0x4157('0xb'),'port':0x18eb});var socket=require(_0x4157('0xc'))(new Redis(config[_0x4157('0x9')]));require(_0x4157('0xd'))[_0x4157('0xe')](socket);function respondWithStatusCode(_0xadb310,_0x388978){_0x388978=_0x388978||0xcc;return function(_0x504190){if(_0x504190){return _0xadb310[_0x4157('0xf')](_0x388978);}return _0xadb310['status'](_0x388978)['end']();};}function respondWithResult(_0x5a60a8,_0x2e221c){_0x2e221c=_0x2e221c||0xc8;return function(_0xa5e176){if(_0xa5e176){return _0x5a60a8[_0x4157('0x10')](_0x2e221c)['json'](_0xa5e176);}};}function respondWithFilteredResult(_0x43be92,_0x127130){return function(_0x4316a6){if(_0x4316a6){var _0x44de30=typeof _0x127130[_0x4157('0x11')]===_0x4157('0x12')&&typeof _0x127130[_0x4157('0x13')]===_0x4157('0x12');var _0x26a407=_0x4316a6[_0x4157('0x14')];var _0x6b6301=_0x44de30?0x0:_0x127130[_0x4157('0x11')];var _0x57b24a=_0x44de30?_0x4316a6[_0x4157('0x14')]:_0x127130['offset']+_0x127130[_0x4157('0x13')];var _0x382423;if(_0x57b24a>=_0x26a407){_0x57b24a=_0x26a407;_0x382423=0xc8;}else{_0x382423=0xce;}_0x43be92[_0x4157('0x10')](_0x382423);return _0x43be92[_0x4157('0x15')](_0x4157('0x16'),_0x6b6301+'-'+_0x57b24a+'/'+_0x26a407)[_0x4157('0x17')](_0x4316a6);}return null;};}function saveUpdates(_0x30dc0a){return function(_0x406a4b){if(_0x406a4b){return _0x406a4b[_0x4157('0x18')](_0x30dc0a)[_0x4157('0x19')](function(_0x2ddedc){return _0x2ddedc;});}return null;};}function removeEntity(_0x141b50){return function(_0x50ed87){if(_0x50ed87){return _0x50ed87[_0x4157('0x1a')]()['then'](function(){var _0x3c1c44=_0x50ed87[_0x4157('0x1b')]({'plain':!![]});var _0x4a60bf=_0x4157('0x1c');return db[_0x4157('0x1d')][_0x4157('0x1a')]({'where':{'type':_0x4a60bf,'resourceId':_0x3c1c44['id']}})[_0x4157('0x19')](function(){return _0x50ed87;});})[_0x4157('0x19')](function(){_0x141b50[_0x4157('0x10')](0xcc)[_0x4157('0x1e')]();});}};}function handleEntityNotFound(_0x2cb68a){return function(_0x16608f){if(!_0x16608f){_0x2cb68a['sendStatus'](0x194);}return _0x16608f;};}function handleError(_0x47b3e2,_0x13b319){_0x13b319=_0x13b319||0x1f4;return function(_0x4717ac){logger[_0x4157('0x1f')](_0x4717ac[_0x4157('0x20')]);if(_0x4717ac['name']){delete _0x4717ac[_0x4157('0x21')];}_0x47b3e2['status'](_0x13b319)[_0x4157('0x22')](_0x4717ac);};}exports[_0x4157('0x23')]=function(_0x1415da,_0x3ab98c){var _0x289423={};var _0x3940a0={'count':0x0,'rows':[]};var _0xd548a8=_[_0x4157('0x24')](db[_0x4157('0x25')][_0x4157('0x26')],function(_0x101e8f){return{'name':_0x101e8f[_0x4157('0x27')],'type':_0x101e8f[_0x4157('0x28')][_0x4157('0x29')]};});_0x289423=qs[_0x4157('0x2a')](_0xd548a8,_0x1415da);var _0x53ded7={'where':_0x289423[_0x4157('0x2b')]};return db['FaxQueue'][_0x4157('0x14')](_0x53ded7)[_0x4157('0x19')](function(_0x3088cb){_0x3940a0[_0x4157('0x14')]=_0x3088cb;_0x289423[_0x4157('0x2c')]=qs[_0x4157('0x2c')](_0x1415da[_0x4157('0x2d')]);return db[_0x4157('0x25')][_0x4157('0x2e')](_0x289423);})[_0x4157('0x19')](function(_0x3640b5){_0x3940a0['rows']=_0x3640b5;return _0x3940a0;})[_0x4157('0x19')](respondWithFilteredResult(_0x3ab98c,_0x289423))['catch'](handleError(_0x3ab98c,null));};exports['show']=function(_0x4a0599,_0x9114a4){var _0x39b74d={'raw':!![],'where':{'id':_0x4a0599['params']['id']}},_0x49a70f={};_0x49a70f[_0x4157('0x2f')]=_['keys'](db[_0x4157('0x25')][_0x4157('0x26')]);_0x49a70f[_0x4157('0x2d')]=_[_0x4157('0x30')](_0x4a0599['query']);_0x49a70f['filters']=_[_0x4157('0x31')](_0x49a70f[_0x4157('0x2f')],_0x49a70f[_0x4157('0x2d')]);_0x39b74d['attributes']=_[_0x4157('0x31')](_0x49a70f[_0x4157('0x2f')],qs[_0x4157('0x32')](_0x4a0599[_0x4157('0x2d')]['fields']));_0x39b74d['attributes']=_0x39b74d[_0x4157('0x33')][_0x4157('0x34')]?_0x39b74d[_0x4157('0x33')]:_0x49a70f[_0x4157('0x2f')];if(_0x4a0599[_0x4157('0x2d')][_0x4157('0x35')]){_0x39b74d[_0x4157('0x2c')]=[{'all':!![]}];}_0x39b74d=_[_0x4157('0x36')]({},_0x39b74d,_0x4a0599[_0x4157('0x37')]);return db[_0x4157('0x25')]['find'](_0x39b74d)[_0x4157('0x19')](handleEntityNotFound(_0x9114a4,null))[_0x4157('0x19')](respondWithResult(_0x9114a4,null))[_0x4157('0x38')](handleError(_0x9114a4,null));};exports[_0x4157('0x39')]=function(_0x505862,_0x1a8368){return db[_0x4157('0x25')][_0x4157('0x39')](_0x505862[_0x4157('0x3a')],{})['then'](function(_0x5cb3c5){var _0x7e8334=_0x505862[_0x4157('0x3b')][_0x4157('0x1b')]({'plain':!![]});if(!_0x7e8334)throw new Error(_0x4157('0x3c'));if(_0x7e8334[_0x4157('0x3d')]===_0x4157('0x3b')){var _0x534135=_0x5cb3c5[_0x4157('0x1b')]({'plain':!![]});var _0x2b763f='FaxQueues';return db[_0x4157('0x3e')][_0x4157('0x3f')]({'where':{'name':_0x2b763f,'userProfileId':_0x7e8334[_0x4157('0x40')]},'raw':!![]})[_0x4157('0x19')](function(_0x4dcf50){if(_0x4dcf50&&_0x4dcf50[_0x4157('0x41')]===0x0){return db[_0x4157('0x1d')][_0x4157('0x39')]({'name':_0x534135['name'],'resourceId':_0x534135['id'],'type':_0x4dcf50[_0x4157('0x21')],'sectionId':_0x4dcf50['id']},{})[_0x4157('0x19')](function(){return _0x5cb3c5;});}else{return _0x5cb3c5;}})[_0x4157('0x38')](function(_0x49407e){logger[_0x4157('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49407e);throw _0x49407e;});}return _0x5cb3c5;})[_0x4157('0x19')](respondWithResult(_0x1a8368,0xc9))[_0x4157('0x38')](handleError(_0x1a8368,null));};exports[_0x4157('0x18')]=function(_0x2b205b,_0x16d7cc){if(_0x2b205b[_0x4157('0x3a')]['id']){delete _0x2b205b['body']['id'];}return db[_0x4157('0x25')][_0x4157('0x3f')]({'where':{'id':_0x2b205b[_0x4157('0x42')]['id']}})[_0x4157('0x19')](handleEntityNotFound(_0x16d7cc,null))['then'](saveUpdates(_0x2b205b[_0x4157('0x3a')],null))['then'](respondWithResult(_0x16d7cc,null))['catch'](handleError(_0x16d7cc,null));};exports['destroy']=function(_0x45ea1a,_0x17c325){return db[_0x4157('0x25')]['find']({'where':{'id':_0x45ea1a[_0x4157('0x42')]['id']}})['then'](handleEntityNotFound(_0x17c325,null))[_0x4157('0x19')](removeEntity(_0x17c325,null))[_0x4157('0x38')](handleError(_0x17c325,null));};exports[_0x4157('0x43')]=function(_0x536d3e,_0x27416a){return db[_0x4157('0x25')][_0x4157('0x43')]()['then'](respondWithResult(_0x27416a,null))[_0x4157('0x38')](handleError(_0x27416a,null));};exports[_0x4157('0x44')]=function(_0x45827d,_0xc87417){var _0x309906={'raw':!![],'where':{}},_0x48020f={},_0x566e43;return db['FaxQueue'][_0x4157('0x45')]({'where':{'id':_0x45827d[_0x4157('0x42')]['id']}})[_0x4157('0x19')](handleEntityNotFound(_0xc87417,null))['then'](function(_0x4496f8){if(_0x4496f8){_0x566e43=_0x4496f8[_0x4157('0x1b')]({'plain':!![]});_0x48020f[_0x4157('0x2f')]=_[_0x4157('0x30')](db[_0x4157('0x46')][_0x4157('0x26')]);_0x48020f['query']=_[_0x4157('0x30')](_0x45827d[_0x4157('0x2d')]);_0x48020f[_0x4157('0x47')]=_['intersection'](_0x48020f['model'],_0x48020f['query']);_0x309906[_0x4157('0x33')]=_[_0x4157('0x31')](_0x48020f[_0x4157('0x2f')],qs[_0x4157('0x32')](_0x45827d[_0x4157('0x2d')][_0x4157('0x32')]));_0x309906[_0x4157('0x33')]=_0x309906[_0x4157('0x33')][_0x4157('0x34')]?_0x309906['attributes']:_0x48020f[_0x4157('0x2f')];if(!_0x45827d[_0x4157('0x2d')]['hasOwnProperty']('nolimit')){_0x309906[_0x4157('0x13')]=qs['limit'](_0x45827d[_0x4157('0x2d')]['limit']);_0x309906[_0x4157('0x11')]=qs['offset'](_0x45827d[_0x4157('0x2d')][_0x4157('0x11')]);}_0x309906[_0x4157('0x48')]=qs[_0x4157('0x49')](_0x45827d[_0x4157('0x2d')][_0x4157('0x49')]);_0x309906['where']=qs[_0x4157('0x47')](_['pick'](_0x45827d[_0x4157('0x2d')],_0x48020f[_0x4157('0x47')]));_0x309906['where'][_0x4157('0x4a')]=_0x4496f8['id'];if(_0x45827d[_0x4157('0x2d')][_0x4157('0x4b')]){_0x309906[_0x4157('0x2b')]=_['merge'](_0x309906[_0x4157('0x2b')],{'$or':_[_0x4157('0x24')](_0x309906[_0x4157('0x33')],function(_0x33ce4d){var _0x37660d={};_0x37660d[_0x33ce4d]={'$like':'%'+_0x45827d[_0x4157('0x2d')][_0x4157('0x4b')]+'%'};return _0x37660d;})});}_0x309906=_['merge']({},_0x309906,_0x45827d['options']);return db['UserFaxQueue'][_0x4157('0x2e')](_0x309906);}})[_0x4157('0x19')](function(_0xd6a370){if(_0xd6a370){return db[_0x4157('0x4c')]['findAndCountAll']({'where':{'id':_[_0x4157('0x24')](_0xd6a370,'UserId'),'role':_0x4157('0x4d')},'attributes':['id',_0x4157('0x21'),'faxPause',_0x4157('0x4e'),_0x4157('0x4f')]});}})[_0x4157('0x19')](function(_0x9fac28){if(_0x9fac28){return{'count':_0x9fac28[_0x4157('0x14')],'rows':_[_0x4157('0x24')](_0x9fac28[_0x4157('0x50')],function(_0x90261c){return{'membername':_0x90261c[_0x4157('0x21')],'UserId':_0x90261c['id'],'queue_name':_0x566e43[_0x4157('0x21')],'FaxQueueId':_0x566e43['id'],'interface':util[_0x4157('0x51')](_0x4157('0x52'),'SIP',_0x90261c[_0x4157('0x21')]),'penalty':0x0,'paused':_0x90261c[_0x4157('0x53')],'createdAt':_0x90261c[_0x4157('0x4f')],'updatedAt':_0x90261c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xc87417,_0x309906))[_0x4157('0x38')](handleError(_0xc87417,null));};exports['getTeams']=function(_0x564495,_0x4921d9){var _0x21a827={};var _0x549920={};var _0x30870f;var _0x4fd3ce;return db['FaxQueue'][_0x4157('0x45')]({'where':{'id':_0x564495[_0x4157('0x42')]['id']}})[_0x4157('0x19')](handleEntityNotFound(_0x4921d9,null))['then'](function(_0x591513){if(_0x591513){_0x30870f=_0x591513;_0x549920[_0x4157('0x2f')]=_[_0x4157('0x30')](db[_0x4157('0x54')][_0x4157('0x26')]);_0x549920['query']=_['keys'](_0x564495['query']);_0x549920[_0x4157('0x47')]=_[_0x4157('0x31')](_0x549920[_0x4157('0x2f')],_0x549920[_0x4157('0x2d')]);_0x21a827[_0x4157('0x33')]=_[_0x4157('0x31')](_0x549920[_0x4157('0x2f')],qs[_0x4157('0x32')](_0x564495['query'][_0x4157('0x32')]));_0x21a827[_0x4157('0x33')]=_0x21a827['attributes'][_0x4157('0x34')]?_0x21a827[_0x4157('0x33')]:_0x549920[_0x4157('0x2f')];_0x21a827[_0x4157('0x48')]=qs[_0x4157('0x49')](_0x564495[_0x4157('0x2d')][_0x4157('0x49')]);_0x21a827['where']=qs['filters'](_[_0x4157('0x55')](_0x564495[_0x4157('0x2d')],_0x549920['filters']));if(_0x564495['query'][_0x4157('0x4b')]){_0x21a827[_0x4157('0x2b')]=_[_0x4157('0x36')](_0x21a827['where'],{'$or':_[_0x4157('0x24')](_0x21a827[_0x4157('0x33')],function(_0xd4c7db){var _0x4cb5c7={};_0x4cb5c7[_0xd4c7db]={'$like':'%'+_0x564495[_0x4157('0x2d')][_0x4157('0x4b')]+'%'};return _0x4cb5c7;})});}_0x21a827=_['merge']({},_0x21a827,_0x564495['options']);return _0x30870f[_0x4157('0x56')](_0x21a827);}})[_0x4157('0x19')](function(_0x2a2e89){if(_0x2a2e89){_0x4fd3ce=_0x2a2e89[_0x4157('0x34')];if(!_0x564495['query'][_0x4157('0x57')](_0x4157('0x58'))){_0x21a827[_0x4157('0x13')]=qs[_0x4157('0x13')](_0x564495[_0x4157('0x2d')]['limit']);_0x21a827['offset']=qs[_0x4157('0x11')](_0x564495[_0x4157('0x2d')][_0x4157('0x11')]);}return _0x30870f['getTeams'](_0x21a827);}})[_0x4157('0x19')](function(_0xe7fa91){if(_0xe7fa91){return _0xe7fa91?{'count':_0x4fd3ce,'rows':_0xe7fa91}:null;}})['then'](respondWithResult(_0x4921d9,null))[_0x4157('0x38')](handleError(_0x4921d9,null));};exports[_0x4157('0x59')]=function(_0x15514f,_0x403f43){var _0x43156b=_0x15514f[_0x4157('0x3a')][_0x4157('0x5a')];return db['Team'][_0x4157('0x2e')]({'where':{'id':_0x43156b},'attributes':['id'],'include':[{'model':db[_0x4157('0x4c')],'as':'Agents','attributes':['id',_0x4157('0x21'),_0x4157('0x5b'),_0x4157('0x5c'),_0x4157('0x5d')],'raw':!![]}]})[_0x4157('0x19')](function(_0x1a12c0){if(_0x1a12c0){var _0x46d288=_[_0x4157('0x5e')](_0x1a12c0,function(_0x4a800f){var _0x17eb23=_0x4a800f[_0x4157('0x1b')]({'plain':!![]});return _0x17eb23['Agents'];});return db[_0x4157('0x25')][_0x4157('0x3f')]({'where':{'id':_0x15514f[_0x4157('0x42')]['id']}})[_0x4157('0x19')](function(_0x449863){return db['sequelize'][_0x4157('0x5f')](function(_0x557d86){return _0x449863[_0x4157('0x59')](_0x43156b,{'transaction':_0x557d86})[_0x4157('0x19')](function(){return BPromise[_0x4157('0x60')](_0x46d288,function(_0x423a96){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x423a96['id'],'FaxQueueId':_0x15514f[_0x4157('0x42')]['id']},'transaction':_0x557d86});});})[_0x4157('0x19')](function(){_0x46d288[_0x4157('0x61')](function(_0x1474f2){socket[_0x4157('0x62')](_0x4157('0x63'),{'UserId':_0x1474f2['id'],'FaxQueueId':_0x449863['id']});});});});});}})['then'](respondWithStatusCode(_0x403f43,null))[_0x4157('0x38')](handleError(_0x403f43,null));};exports[_0x4157('0x64')]=function(_0x1e0252,_0x21bf11){return db['Team'][_0x4157('0x2e')]({'where':{'id':_0x1e0252['query'][_0x4157('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x4157('0x4c')],'as':_0x4157('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4157('0x19')](handleEntityNotFound(_0x21bf11,null))[_0x4157('0x19')](function(_0x4370e1){var _0x3811c4=_[_0x4157('0x24')](_0x4370e1,'id');var _0x1b0c2b=[];var _0x2407f8=[];var _0x598c50=squel[_0x4157('0x66')]();_0x598c50[_0x4157('0x67')](_0x4157('0x68'))['from']('team_has_fax_queues','tq')[_0x4157('0x69')]('user_has_teams','ut',_0x4157('0x6a'))['where'](_0x4157('0x6b'),_0x1e0252[_0x4157('0x42')]['id']);for(var _0x702231=0x0;_0x702231<_0x4370e1[_0x4157('0x34')];_0x702231+=0x1){let _0x4a9a69=_0x4370e1[_0x702231];for(var _0x54be32=0x0;_0x54be32<_0x4a9a69['Agents'][_0x4157('0x34')];_0x54be32+=0x1){let _0x5f3d5b=_0x4a9a69[_0x4157('0x65')][_0x54be32];var _0x443760=_0x598c50[_0x4157('0x6c')]();_0x443760[_0x4157('0x2b')](_0x4157('0x6d'),_0x5f3d5b['id']);_0x2407f8['push'](db[_0x4157('0x6e')][_0x4157('0x2d')](_0x443760[_0x4157('0x6f')](),{'type':db[_0x4157('0x6e')][_0x4157('0x70')][_0x4157('0x71')]})['then'](function(_0x26708e){if(_0x26708e[_0x4157('0x34')]===0x1){return _0x5f3d5b['id'];}else{var _0x395c1a=_[_0x4157('0x72')](_['map'](_0x26708e,_0x4157('0x73')),function(_0x45c151){return _['includes'](_0x3811c4,_0x45c151);});if(_0x395c1a){return _0x5f3d5b['id'];}}}));}}return BPromise[_0x4157('0x74')](_0x2407f8)[_0x4157('0x19')](function(_0x426965){_0x1b0c2b=_(_0x1b0c2b)[_0x4157('0x75')](_0x426965)[_0x4157('0x76')]()['value']();return db[_0x4157('0x25')][_0x4157('0x3f')]({'where':{'id':_0x1e0252[_0x4157('0x42')]['id']}})[_0x4157('0x19')](function(_0x52226e){return db[_0x4157('0x6e')][_0x4157('0x5f')](function(_0x21bc61){return _0x52226e[_0x4157('0x64')](_0x1e0252['query'][_0x4157('0x5a')],{'transaction':_0x21bc61})[_0x4157('0x19')](function(){if(!_[_0x4157('0x77')](_0x1b0c2b)){return _0x52226e[_0x4157('0x78')](_0x1b0c2b,{'transaction':_0x21bc61});}})[_0x4157('0x19')](function(){_0x1b0c2b['forEach'](function(_0x14234d){socket[_0x4157('0x62')](_0x4157('0x79'),{'UserId':_0x14234d,'FaxQueueId':_0x52226e['id']});});});});});});})['then'](respondWithStatusCode(_0x21bf11,null))[_0x4157('0x38')](handleError(_0x21bf11,null));};exports['addAgents']=function(_0x2407bc,_0x48d2bc){return db[_0x4157('0x25')][_0x4157('0x3f')]({'where':{'id':_0x2407bc[_0x4157('0x42')]['id']}})[_0x4157('0x19')](handleEntityNotFound(_0x48d2bc,null))[_0x4157('0x19')](function(_0xe9db6d){if(_0xe9db6d){return _0xe9db6d['addAgents'](_0x2407bc[_0x4157('0x3a')]['ids'],_[_0x4157('0x7a')](_0x2407bc[_0x4157('0x3a')],[_0x4157('0x5a'),'id'])||{})['spread'](function(_0x29b0e2){for(var _0x5a506e=0x0;_0x5a506e<_0x2407bc[_0x4157('0x3a')][_0x4157('0x5a')]['length'];_0x5a506e+=0x1){socket[_0x4157('0x62')]('userFaxQueue:save',{'UserId':Number(_0x2407bc['body'][_0x4157('0x5a')][_0x5a506e]),'FaxQueueId':Number(_0x2407bc[_0x4157('0x42')]['id'])});}return _0x29b0e2;});}})[_0x4157('0x19')](respondWithResult(_0x48d2bc,null))['catch'](handleError(_0x48d2bc,null));};exports[_0x4157('0x78')]=function(_0x22218d,_0x4149e8){return db[_0x4157('0x25')]['find']({'where':{'id':_0x22218d[_0x4157('0x42')]['id']}})[_0x4157('0x19')](handleEntityNotFound(_0x4149e8,null))[_0x4157('0x19')](function(_0x498615){if(_0x498615){return _0x498615[_0x4157('0x78')](_0x22218d[_0x4157('0x2d')][_0x4157('0x5a')])[_0x4157('0x19')](function(){if(_[_0x4157('0x7b')](_0x22218d['query']['ids'])){for(var _0x33507a=0x0;_0x33507a<_0x22218d[_0x4157('0x2d')][_0x4157('0x5a')]['length'];_0x33507a+=0x1){socket[_0x4157('0x62')]('userFaxQueue:remove',{'UserId':Number(_0x22218d[_0x4157('0x2d')][_0x4157('0x5a')][_0x33507a]),'FaxQueueId':Number(_0x22218d[_0x4157('0x42')]['id'])});}}else{socket[_0x4157('0x62')](_0x4157('0x79'),{'UserId':Number(_0x22218d['query'][_0x4157('0x5a')]),'FaxQueueId':Number(_0x22218d[_0x4157('0x42')]['id'])});}});}})[_0x4157('0x19')](respondWithStatusCode(_0x4149e8,null))['catch'](handleError(_0x4149e8,null));};exports['getAgents']=function(_0x2ec4d7,_0x3ed443){var _0x8a84d3={};var _0x41233d={};var _0x21741e;var _0x59e0a3;return db['FaxQueue'][_0x4157('0x45')]({'where':{'id':_0x2ec4d7['params']['id']}})[_0x4157('0x19')](handleEntityNotFound(_0x3ed443,null))['then'](function(_0x15d0ae){if(_0x15d0ae){_0x21741e=_0x15d0ae;_0x41233d[_0x4157('0x2f')]=_['keys'](db[_0x4157('0x4c')][_0x4157('0x26')]);_0x41233d[_0x4157('0x2d')]=_['keys'](_0x2ec4d7[_0x4157('0x2d')]);_0x41233d['filters']=_[_0x4157('0x31')](_0x41233d[_0x4157('0x2f')],_0x41233d[_0x4157('0x2d')]);_0x8a84d3[_0x4157('0x33')]=_[_0x4157('0x31')](_0x41233d[_0x4157('0x2f')],qs[_0x4157('0x32')](_0x2ec4d7['query'][_0x4157('0x32')]));_0x8a84d3[_0x4157('0x33')]=_0x8a84d3['attributes'][_0x4157('0x34')]?_0x8a84d3[_0x4157('0x33')]:_0x41233d[_0x4157('0x2f')];_0x8a84d3[_0x4157('0x48')]=qs[_0x4157('0x49')](_0x2ec4d7['query']['sort']);_0x8a84d3[_0x4157('0x2b')]=qs['filters'](_[_0x4157('0x55')](_0x2ec4d7['query'],_0x41233d[_0x4157('0x47')]));if(_0x2ec4d7[_0x4157('0x2d')][_0x4157('0x4b')]){_0x8a84d3['where']=_[_0x4157('0x36')](_0x8a84d3['where'],{'$or':_[_0x4157('0x24')](_0x8a84d3[_0x4157('0x33')],function(_0x3afe07){var _0x3702e4={};_0x3702e4[_0x3afe07]={'$like':'%'+_0x2ec4d7[_0x4157('0x2d')][_0x4157('0x4b')]+'%'};return _0x3702e4;})});}_0x8a84d3=_['merge']({},_0x8a84d3,_0x2ec4d7[_0x4157('0x37')]);return _0x21741e[_0x4157('0x7c')](_0x8a84d3);}})[_0x4157('0x19')](function(_0x5d696e){if(_0x5d696e){_0x59e0a3=_0x5d696e[_0x4157('0x34')];if(!_0x2ec4d7[_0x4157('0x2d')][_0x4157('0x57')]('nolimit')){_0x8a84d3[_0x4157('0x13')]=qs[_0x4157('0x13')](_0x2ec4d7['query']['limit']);_0x8a84d3['offset']=qs[_0x4157('0x11')](_0x2ec4d7[_0x4157('0x2d')][_0x4157('0x11')]);}return _0x21741e[_0x4157('0x7c')](_0x8a84d3);}})[_0x4157('0x19')](function(_0x10d74d){if(_0x10d74d){return _0x10d74d?{'count':_0x59e0a3,'rows':_0x10d74d}:null;}})[_0x4157('0x19')](respondWithResult(_0x3ed443,null))[_0x4157('0x38')](handleError(_0x3ed443,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b2870ae..8fd17c8 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 _0x3a4f=['../../mysqldb','FaxQueue','save','remove','emit','exports'];(function(_0x41b235,_0x367b5e){var _0xf9996b=function(_0x17c7e8){while(--_0x17c7e8){_0x41b235['push'](_0x41b235['shift']());}};_0xf9996b(++_0x367b5e);}(_0x3a4f,0x1ce));var _0xf3a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a4f[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xf3a4('0x0'))['db'][_0xf3a4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3a4('0x2'),'afterUpdate':'update','afterDestroy':_0xf3a4('0x3')};function emitEvent(_0x3b584c){return function(_0x46f348,_0x26a2f1,_0x21091a){FaxQueueEvents[_0xf3a4('0x4')](_0x3b584c+':'+_0x46f348['id'],_0x46f348);FaxQueueEvents[_0xf3a4('0x4')](_0x3b584c,_0x46f348);_0x21091a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xf3a4('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0x6032=['emit','hasOwnProperty','exports','../../mysqldb','FaxQueue','save'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x6032,0x1d1));var _0x2603=function(_0x36a9f7,_0x54fde9){_0x36a9f7=_0x36a9f7-0x0;var _0x256935=_0x6032[_0x36a9f7];return _0x256935;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2603('0x0'))['db'][_0x2603('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2603('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x203c5f){return function(_0x5cbabd,_0x1cb3d4,_0x4396a5){FaxQueueEvents[_0x2603('0x3')](_0x203c5f+':'+_0x5cbabd['id'],_0x5cbabd);FaxQueueEvents[_0x2603('0x3')](_0x203c5f,_0x5cbabd);_0x4396a5(null);};}for(var e in events){if(events[_0x2603('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x2603('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index db836d1..1a8b33c 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 _0x025c=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports'];(function(_0x2462fb,_0x45f03c){var _0x37018c=function(_0x1f9952){while(--_0x1f9952){_0x2462fb['push'](_0x2462fb['shift']());}};_0x37018c(++_0x45f03c);}(_0x025c,0x182));var _0xc025=function(_0x3fd078,_0x10e4a5){_0x3fd078=_0x3fd078-0x0;var _0x53506c=_0x025c[_0x3fd078];return _0x53506c;};'use strict';var _=require(_0xc025('0x0'));var util=require(_0xc025('0x1'));var logger=require(_0xc025('0x2'))(_0xc025('0x3'));var moment=require(_0xc025('0x4'));var BPromise=require(_0xc025('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc025('0x6'));var rimraf=require('rimraf');var config=require(_0xc025('0x7'));var attributes=require(_0xc025('0x8'));module[_0xc025('0x9')]=function(_0x51a3ff,_0x953a7f){return _0x51a3ff['define']('FaxQueue',attributes,{'tableName':_0xc025('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe711=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0x337d69,_0x1c4904){var _0x562702=function(_0x222ba2){while(--_0x222ba2){_0x337d69['push'](_0x337d69['shift']());}};_0x562702(++_0x1c4904);}(_0xe711,0xe7));var _0x1e71=function(_0x44f715,_0x40bf6d){_0x44f715=_0x44f715-0x0;var _0x3e4914=_0xe711[_0x44f715];return _0x3e4914;};'use strict';var _=require('lodash');var util=require(_0x1e71('0x0'));var logger=require(_0x1e71('0x1'))('api');var moment=require(_0x1e71('0x2'));var BPromise=require(_0x1e71('0x3'));var rp=require(_0x1e71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e71('0x5'));var config=require(_0x1e71('0x6'));var attributes=require(_0x1e71('0x7'));module['exports']=function(_0x2cd97f,_0x321b93){return _0x2cd97f[_0x1e71('0x8')](_0x1e71('0x9'),attributes,{'tableName':_0x1e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 978402b..d3bc8b4 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 _0xdbe7=['ShowFaxQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','catch','FaxQueue','options','raw','attributes','limit','include','model','map','GetFaxQueue'];(function(_0x47bf0d,_0x35fbd5){var _0x12e061=function(_0x1d7057){while(--_0x1d7057){_0x47bf0d['push'](_0x47bf0d['shift']());}};_0x12e061(++_0x35fbd5);}(_0xdbe7,0x75));var _0x7dbe=function(_0x33106b,_0x4f4458){_0x33106b=_0x33106b-0x0;var _0x2ddd7d=_0xdbe7[_0x33106b];return _0x2ddd7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7dbe('0x0'));var BPromise=require(_0x7dbe('0x1'));var rs=require(_0x7dbe('0x2'));var fs=require('fs');var Redis=require(_0x7dbe('0x3'));var db=require(_0x7dbe('0x4'))['db'];var utils=require(_0x7dbe('0x5'));var logger=require(_0x7dbe('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dbe('0x7')][_0x7dbe('0x8')]({'port':0x232a});config[_0x7dbe('0x9')]=_[_0x7dbe('0xa')](config['redis'],{'host':_0x7dbe('0xb'),'port':0x18eb});var socket=require(_0x7dbe('0xc'))(new Redis(config[_0x7dbe('0x9')]));require(_0x7dbe('0xd'))['register'](socket);function respondWithRpcPromise(_0x3202ae,_0x229853,_0x2fa944){return new BPromise(function(_0x3678b1,_0x36a64b){return client[_0x7dbe('0xe')](_0x3202ae,_0x2fa944)[_0x7dbe('0xf')](function(_0x537c51){logger[_0x7dbe('0x10')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x7dbe('0x11'));logger[_0x7dbe('0x12')](_0x7dbe('0x13'),_0x229853,_0x7dbe('0x11'),JSON[_0x7dbe('0x14')](_0x537c51));if(_0x537c51[_0x7dbe('0x15')]){if(_0x537c51['error'][_0x7dbe('0x16')]===0x1f4){logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);return _0x36a64b(_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);}logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);return _0x3678b1(_0x537c51[_0x7dbe('0x15')][_0x7dbe('0x17')]);}else{logger['info'](_0x7dbe('0x18'),_0x229853,'request\x20sent');_0x3678b1(_0x537c51['result'][_0x7dbe('0x17')]);}})[_0x7dbe('0x19')](function(_0x4d8eac){logger[_0x7dbe('0x15')]('FaxQueue,\x20%s,\x20%s',_0x229853,_0x4d8eac);_0x36a64b(_0x4d8eac);});});}exports['GetFaxQueue']=function(_0x47090c){var _0x8e8117=this;return new Promise(function(_0x3dfe33,_0x5e38c4){return db[_0x7dbe('0x1a')]['findAll']({'raw':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1c')]===undefined?!![]:![]:!![],'where':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')]['where']||null:null,'attributes':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1d')]||null:null,'limit':_0x47090c['options']?_0x47090c['options'][_0x7dbe('0x1e')]||null:null,'include':_0x47090c[_0x7dbe('0x1b')]?_0x47090c[_0x7dbe('0x1b')][_0x7dbe('0x1f')]?_['map'](_0x47090c[_0x7dbe('0x1b')]['include'],function(_0x5f554b){return{'model':db[_0x5f554b[_0x7dbe('0x20')]],'as':_0x5f554b['as'],'attributes':_0x5f554b['attributes'],'include':_0x5f554b[_0x7dbe('0x1f')]?_[_0x7dbe('0x21')](_0x5f554b[_0x7dbe('0x1f')],function(_0x42cdd2){return{'model':db[_0x42cdd2['model']],'as':_0x42cdd2['as'],'attributes':_0x42cdd2['attributes'],'include':_0x42cdd2[_0x7dbe('0x1f')]?_[_0x7dbe('0x21')](_0x42cdd2[_0x7dbe('0x1f')],function(_0x277b0d){return{'model':db[_0x277b0d['model']],'as':_0x277b0d['as'],'attributes':_0x277b0d[_0x7dbe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7dbe('0xf')](function(_0x10f5e0){logger['info'](_0x7dbe('0x22'),_0x47090c);logger[_0x7dbe('0x12')](_0x7dbe('0x22'),_0x47090c,JSON[_0x7dbe('0x14')](_0x10f5e0));_0x3dfe33(_0x10f5e0);})[_0x7dbe('0x19')](function(_0x4b9422){logger[_0x7dbe('0x15')](_0x7dbe('0x22'),_0x4b9422['message'],_0x47090c);_0x5e38c4(_0x8e8117['error'](0x1f4,_0x4b9422['message']));});});};exports[_0x7dbe('0x23')]=function(_0x1374f0){var _0x6eee6d=this;return new Promise(function(_0x5dd976,_0x199796){return db[_0x7dbe('0x1a')][_0x7dbe('0x24')]({'raw':_0x1374f0[_0x7dbe('0x1b')]?_0x1374f0[_0x7dbe('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1374f0[_0x7dbe('0x1b')]?_0x1374f0['options'][_0x7dbe('0x25')]||null:null,'attributes':_0x1374f0['options']?_0x1374f0['options']['attributes']||null:null,'include':_0x1374f0['options']?_0x1374f0[_0x7dbe('0x1b')][_0x7dbe('0x1f')]?_['map'](_0x1374f0[_0x7dbe('0x1b')][_0x7dbe('0x1f')],function(_0x52b522){return{'model':db[_0x52b522[_0x7dbe('0x20')]],'as':_0x52b522['as'],'attributes':_0x52b522[_0x7dbe('0x1d')],'include':_0x52b522['include']?_[_0x7dbe('0x21')](_0x52b522[_0x7dbe('0x1f')],function(_0x3efa35){return{'model':db[_0x3efa35[_0x7dbe('0x20')]],'as':_0x3efa35['as'],'attributes':_0x3efa35[_0x7dbe('0x1d')],'include':_0x3efa35['include']?_[_0x7dbe('0x21')](_0x3efa35['include'],function(_0x44dce7){return{'model':db[_0x44dce7[_0x7dbe('0x20')]],'as':_0x44dce7['as'],'attributes':_0x44dce7[_0x7dbe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7dbe('0xf')](function(_0x469bdc){logger[_0x7dbe('0x10')]('ShowFaxQueue',_0x1374f0);logger[_0x7dbe('0x12')](_0x7dbe('0x23'),_0x1374f0,JSON[_0x7dbe('0x14')](_0x469bdc));_0x5dd976(_0x469bdc);})[_0x7dbe('0x19')](function(_0x15260b){logger[_0x7dbe('0x15')](_0x7dbe('0x23'),_0x15260b['message'],_0x1374f0);_0x199796(_0x6eee6d[_0x7dbe('0x15')](0x1f4,_0x15260b[_0x7dbe('0x17')]));});});}; \ No newline at end of file +var _0xab9f=['map','stringify','catch','ShowFaxQueue','FaxQueue','find','raw','where','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','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','error','message','result','GetFaxQueue','options','attributes','limit','include','model'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0xab9f,0x7d));var _0xfab9=function(_0x30ce9b,_0x2225c6){_0x30ce9b=_0x30ce9b-0x0;var _0x2dbab0=_0xab9f[_0x30ce9b];return _0x2dbab0;};'use strict';var _=require(_0xfab9('0x0'));var util=require(_0xfab9('0x1'));var moment=require('moment');var BPromise=require(_0xfab9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfab9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfab9('0x4'));var logger=require(_0xfab9('0x5'))(_0xfab9('0x6'));var config=require(_0xfab9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfab9('0x8')]['http']({'port':0x232a});config[_0xfab9('0x9')]=_[_0xfab9('0xa')](config['redis'],{'host':_0xfab9('0xb'),'port':0x18eb});var socket=require(_0xfab9('0xc'))(new Redis(config[_0xfab9('0x9')]));require(_0xfab9('0xd'))[_0xfab9('0xe')](socket);function respondWithRpcPromise(_0x2795cd,_0x2f2362,_0x539a97){return new BPromise(function(_0x504cbb,_0x45d8fc){return client[_0xfab9('0xf')](_0x2795cd,_0x539a97)[_0xfab9('0x10')](function(_0x5e0125){logger[_0xfab9('0x11')](_0xfab9('0x12'),_0x2f2362,_0xfab9('0x13'));logger[_0xfab9('0x14')](_0xfab9('0x15'),_0x2f2362,'request\x20sent',JSON['stringify'](_0x5e0125));if(_0x5e0125[_0xfab9('0x16')]){if(_0x5e0125['error']['code']===0x1f4){logger[_0xfab9('0x16')](_0xfab9('0x12'),_0x2f2362,_0x5e0125['error'][_0xfab9('0x17')]);return _0x45d8fc(_0x5e0125[_0xfab9('0x16')][_0xfab9('0x17')]);}logger[_0xfab9('0x16')]('FaxQueue,\x20%s,\x20%s',_0x2f2362,_0x5e0125[_0xfab9('0x16')][_0xfab9('0x17')]);return _0x504cbb(_0x5e0125[_0xfab9('0x16')][_0xfab9('0x17')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x2f2362,_0xfab9('0x13'));_0x504cbb(_0x5e0125[_0xfab9('0x18')][_0xfab9('0x17')]);}})['catch'](function(_0x1464f9){logger[_0xfab9('0x16')](_0xfab9('0x12'),_0x2f2362,_0x1464f9);_0x45d8fc(_0x1464f9);});});}exports[_0xfab9('0x19')]=function(_0x38b756){var _0xca23e9=this;return new Promise(function(_0x3ed136,_0x2f3590){return db['FaxQueue']['findAll']({'raw':_0x38b756[_0xfab9('0x1a')]?_0x38b756[_0xfab9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38b756[_0xfab9('0x1a')]?_0x38b756[_0xfab9('0x1a')]['where']||null:null,'attributes':_0x38b756['options']?_0x38b756[_0xfab9('0x1a')][_0xfab9('0x1b')]||null:null,'limit':_0x38b756[_0xfab9('0x1a')]?_0x38b756[_0xfab9('0x1a')][_0xfab9('0x1c')]||null:null,'include':_0x38b756[_0xfab9('0x1a')]?_0x38b756[_0xfab9('0x1a')][_0xfab9('0x1d')]?_['map'](_0x38b756[_0xfab9('0x1a')][_0xfab9('0x1d')],function(_0x4c606d){return{'model':db[_0x4c606d[_0xfab9('0x1e')]],'as':_0x4c606d['as'],'attributes':_0x4c606d[_0xfab9('0x1b')],'include':_0x4c606d[_0xfab9('0x1d')]?_['map'](_0x4c606d[_0xfab9('0x1d')],function(_0xdfb2){return{'model':db[_0xdfb2[_0xfab9('0x1e')]],'as':_0xdfb2['as'],'attributes':_0xdfb2[_0xfab9('0x1b')],'include':_0xdfb2[_0xfab9('0x1d')]?_[_0xfab9('0x1f')](_0xdfb2[_0xfab9('0x1d')],function(_0x58986c){return{'model':db[_0x58986c[_0xfab9('0x1e')]],'as':_0x58986c['as'],'attributes':_0x58986c[_0xfab9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfab9('0x10')](function(_0x28881e){logger[_0xfab9('0x11')](_0xfab9('0x19'),_0x38b756);logger['debug'](_0xfab9('0x19'),_0x38b756,JSON[_0xfab9('0x20')](_0x28881e));_0x3ed136(_0x28881e);})[_0xfab9('0x21')](function(_0xeee49a){logger[_0xfab9('0x16')](_0xfab9('0x19'),_0xeee49a[_0xfab9('0x17')],_0x38b756);_0x2f3590(_0xca23e9[_0xfab9('0x16')](0x1f4,_0xeee49a[_0xfab9('0x17')]));});});};exports[_0xfab9('0x22')]=function(_0x598b9d){var _0x298442=this;return new Promise(function(_0x24fc35,_0x38a367){return db[_0xfab9('0x23')][_0xfab9('0x24')]({'raw':_0x598b9d['options']?_0x598b9d[_0xfab9('0x1a')][_0xfab9('0x25')]===undefined?!![]:![]:!![],'where':_0x598b9d['options']?_0x598b9d[_0xfab9('0x1a')][_0xfab9('0x26')]||null:null,'attributes':_0x598b9d[_0xfab9('0x1a')]?_0x598b9d[_0xfab9('0x1a')]['attributes']||null:null,'include':_0x598b9d[_0xfab9('0x1a')]?_0x598b9d[_0xfab9('0x1a')][_0xfab9('0x1d')]?_[_0xfab9('0x1f')](_0x598b9d[_0xfab9('0x1a')]['include'],function(_0x9f285c){return{'model':db[_0x9f285c[_0xfab9('0x1e')]],'as':_0x9f285c['as'],'attributes':_0x9f285c['attributes'],'include':_0x9f285c[_0xfab9('0x1d')]?_['map'](_0x9f285c['include'],function(_0x3cc549){return{'model':db[_0x3cc549[_0xfab9('0x1e')]],'as':_0x3cc549['as'],'attributes':_0x3cc549[_0xfab9('0x1b')],'include':_0x3cc549[_0xfab9('0x1d')]?_['map'](_0x3cc549['include'],function(_0x555628){return{'model':db[_0x555628[_0xfab9('0x1e')]],'as':_0x555628['as'],'attributes':_0x555628[_0xfab9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48b333){logger['info'](_0xfab9('0x22'),_0x598b9d);logger[_0xfab9('0x14')](_0xfab9('0x22'),_0x598b9d,JSON['stringify'](_0x48b333));_0x24fc35(_0x48b333);})[_0xfab9('0x21')](function(_0x4262ee){logger['error'](_0xfab9('0x22'),_0x4262ee[_0xfab9('0x17')],_0x598b9d);_0x38a367(_0x298442['error'](0x1f4,_0x4262ee[_0xfab9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c1ecaf8..3f113e4 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 _0x8e14=['faxQueue:','./faxQueue.events','save','remove','update','emit','length'];(function(_0x5d95be,_0x462e3c){var _0x1e5f22=function(_0x32707b){while(--_0x32707b){_0x5d95be['push'](_0x5d95be['shift']());}};_0x1e5f22(++_0x462e3c);}(_0x8e14,0x1c8));var _0x48e1=function(_0x475e00,_0x32d51d){_0x475e00=_0x475e00-0x0;var _0x248dde=_0x8e14[_0x475e00];return _0x248dde;};'use strict';var FaxQueueEvents=require(_0x48e1('0x0'));var events=[_0x48e1('0x1'),_0x48e1('0x2'),_0x48e1('0x3')];function createListener(_0x1c5224,_0x66500e){return function(_0x1e3d06){_0x66500e[_0x48e1('0x4')](_0x1c5224,_0x1e3d06);};}function removeListener(_0x50ce27,_0x3a917a){return function(){FaxQueueEvents['removeListener'](_0x50ce27,_0x3a917a);};}exports['register']=function(_0x242792){for(var _0x2779eb=0x0,_0x1d1353=events[_0x48e1('0x5')];_0x2779eb<_0x1d1353;_0x2779eb++){var _0x440193=events[_0x2779eb];var _0x3e46e2=createListener(_0x48e1('0x6')+_0x440193,_0x242792);FaxQueueEvents['on'](_0x440193,_0x3e46e2);}}; \ No newline at end of file +var _0xa9ad=['remove','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x19532f,_0x5d34a9){var _0x340e25=function(_0x28df52){while(--_0x28df52){_0x19532f['push'](_0x19532f['shift']());}};_0x340e25(++_0x5d34a9);}(_0xa9ad,0x19b));var _0xda9a=function(_0x207256,_0x2ac351){_0x207256=_0x207256-0x0;var _0x1197b5=_0xa9ad[_0x207256];return _0x1197b5;};'use strict';var FaxQueueEvents=require(_0xda9a('0x0'));var events=[_0xda9a('0x1'),_0xda9a('0x2'),'update'];function createListener(_0x302559,_0x27b3f1){return function(_0x5a5ff7){_0x27b3f1[_0xda9a('0x3')](_0x302559,_0x5a5ff7);};}function removeListener(_0x1b2257,_0x40388e){return function(){FaxQueueEvents[_0xda9a('0x4')](_0x1b2257,_0x40388e);};}exports[_0xda9a('0x5')]=function(_0x26e677){for(var _0x173b81=0x0,_0x328716=events['length'];_0x173b81<_0x328716;_0x173b81++){var _0x2758be=events[_0x173b81];var _0x5e914a=createListener(_0xda9a('0x6')+_0x2758be,_0x26e677);FaxQueueEvents['on'](_0x2758be,_0x5e914a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1fc0b1a..f47e78d 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 _0xef17=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','describe','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','put','update','destroy'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0xef17,0x136));var _0x7ef1=function(_0x518370,_0x9c3902){_0x518370=_0x518370-0x0;var _0x5439fa=_0xef17[_0x518370];return _0x5439fa;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xb')](_0x7ef1('0xe'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xf')]);router[_0x7ef1('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ef1('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7ef1('0x11')]);router['post']('/',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0x14'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x13')](_0x7ef1('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7ef1('0x17')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x19')]);router['delete'](_0x7ef1('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7ef1('0x16'),auth['isAuthenticated'](),controller[_0x7ef1('0x1a')]);module[_0x7ef1('0x1b')]=router; \ No newline at end of file +var _0xacf4=['describe','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xacf4,0xe7));var _0x4acf=function(_0x2e11f4,_0x48eb5c){_0x2e11f4=_0x2e11f4-0x0;var _0x489000=_0xacf4[_0x2e11f4];return _0x489000;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getMembers']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x10')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x10')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x12')]);router[_0x4acf('0x10')](_0x4acf('0x13'),auth[_0x4acf('0xb')](),controller['addAgents']);router[_0x4acf('0x14')]('/:id',auth[_0x4acf('0xb')](),controller[_0x4acf('0x15')]);router[_0x4acf('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4acf('0x17')]);router[_0x4acf('0x16')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x18')]);router[_0x4acf('0x16')](_0x4acf('0x13'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x19')]);module[_0x4acf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 98dbff1..b94a6e9 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 _0x160c=['moment','sequelize','exports','STRING','DATE'];(function(_0xe7a99e,_0x4902a1){var _0x3bef5c=function(_0x60e02b){while(--_0x60e02b){_0xe7a99e['push'](_0xe7a99e['shift']());}};_0x3bef5c(++_0x4902a1);}(_0x160c,0x122));var _0xc160=function(_0x149e72,_0x376fc9){_0x149e72=_0x149e72-0x0;var _0x2ed697=_0x160c[_0x149e72];return _0x2ed697;};'use strict';var moment=require(_0xc160('0x0'));var Sequelize=require(_0xc160('0x1'));module[_0xc160('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc160('0x3')]},'joinAt':{'type':Sequelize[_0xc160('0x4')]},'leaveAt':{'type':Sequelize[_0xc160('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc160('0x4')]},'reason':{'type':Sequelize[_0xc160('0x3')]}}; \ No newline at end of file +var _0x9493=['DATE','moment','sequelize','STRING'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x9493,0x159));var _0x3949=function(_0x113227,_0xab6cd9){_0x113227=_0x113227-0x0;var _0x4d1c9e=_0x9493[_0x113227];return _0x4d1c9e;};'use strict';var moment=require(_0x3949('0x0'));var Sequelize=require(_0x3949('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3949('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3949('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3949('0x3')]},'acceptAt':{'type':Sequelize[_0x3949('0x3')]},'exitAt':{'type':Sequelize[_0x3949('0x3')]},'reason':{'type':Sequelize[_0x3949('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3ecc918..c40e0c2 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 _0x9224=['merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','FaxQueueReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x9224,0xa3));var _0x4922=function(_0x2940a0,_0x1f4c3c){_0x2940a0=_0x2940a0-0x0;var _0x486341=_0x9224[_0x2940a0];return _0x486341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4922('0x0'));var zipdir=require(_0x4922('0x1'));var jsonpatch=require(_0x4922('0x2'));var rp=require(_0x4922('0x3'));var moment=require(_0x4922('0x4'));var BPromise=require(_0x4922('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4922('0x6'));var csv=require('to-csv');var ejs=require(_0x4922('0x7'));var fs=require('fs');var fs_extra=require(_0x4922('0x8'));var _=require(_0x4922('0x9'));var squel=require(_0x4922('0xa'));var crypto=require(_0x4922('0xb'));var jsforce=require(_0x4922('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4922('0xd'));var querystring=require(_0x4922('0xe'));var Papa=require('papaparse');var Redis=require(_0x4922('0xf'));var authService=require(_0x4922('0x10'));var qs=require(_0x4922('0x11'));var as=require(_0x4922('0x12'));var hardwareService=require(_0x4922('0x13'));var logger=require(_0x4922('0x14'))(_0x4922('0x15'));var utils=require(_0x4922('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4922('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410502,_0x45de0c){_0x45de0c=_0x45de0c||0xcc;return function(_0x35ca3d){if(_0x35ca3d){return _0x410502[_0x4922('0x18')](_0x45de0c);}return _0x410502[_0x4922('0x19')](_0x45de0c)['end']();};}function respondWithResult(_0x103fa8,_0x704e23){_0x704e23=_0x704e23||0xc8;return function(_0x542410){if(_0x542410){return _0x103fa8[_0x4922('0x19')](_0x704e23)[_0x4922('0x1a')](_0x542410);}};}function respondWithFilteredResult(_0x15bf3a,_0x3010bb){return function(_0x434f62){if(_0x434f62){var _0x4385d2=typeof _0x3010bb[_0x4922('0x1b')]==='undefined'&&typeof _0x3010bb[_0x4922('0x1c')]==='undefined';var _0x15fe9e=_0x434f62[_0x4922('0x1d')];var _0x1d7fc2=_0x4385d2?0x0:_0x3010bb[_0x4922('0x1b')];var _0x2ef410=_0x4385d2?_0x434f62[_0x4922('0x1d')]:_0x3010bb['offset']+_0x3010bb[_0x4922('0x1c')];var _0x3abfbf;if(_0x2ef410>=_0x15fe9e){_0x2ef410=_0x15fe9e;_0x3abfbf=0xc8;}else{_0x3abfbf=0xce;}_0x15bf3a[_0x4922('0x19')](_0x3abfbf);return _0x15bf3a[_0x4922('0x1e')](_0x4922('0x1f'),_0x1d7fc2+'-'+_0x2ef410+'/'+_0x15fe9e)['json'](_0x434f62);}return null;};}function patchUpdates(_0x2b6a2d){return function(_0x20ef64){try{jsonpatch[_0x4922('0x20')](_0x20ef64,_0x2b6a2d,!![]);}catch(_0x183ec9){return BPromise[_0x4922('0x21')](_0x183ec9);}return _0x20ef64[_0x4922('0x22')]();};}function saveUpdates(_0x1c1243,_0x3b182b){return function(_0x5c766e){if(_0x5c766e){return _0x5c766e[_0x4922('0x23')](_0x1c1243)[_0x4922('0x24')](function(_0x4bd606){return _0x4bd606;});}return null;};}function removeEntity(_0x21859a,_0x23ce8d){return function(_0x4f93cb){if(_0x4f93cb){return _0x4f93cb[_0x4922('0x25')]()['then'](function(){_0x21859a[_0x4922('0x19')](0xcc)[_0x4922('0x26')]();});}};}function handleEntityNotFound(_0x26bb17,_0x4ee748){return function(_0x234ddf){if(!_0x234ddf){_0x26bb17[_0x4922('0x18')](0x194);}return _0x234ddf;};}function handleError(_0xb6bc60,_0x54a80c){_0x54a80c=_0x54a80c||0x1f4;return function(_0x3eb5d){logger['error'](_0x3eb5d[_0x4922('0x27')]);if(_0x3eb5d[_0x4922('0x28')]){delete _0x3eb5d[_0x4922('0x28')];}_0xb6bc60[_0x4922('0x19')](_0x54a80c)[_0x4922('0x29')](_0x3eb5d);};}exports['index']=function(_0x46cd81,_0x4cc26e){var _0x3e3c7d={},_0x416e26={},_0x49fbbd={'count':0x0,'rows':[]};var _0x5d65bd=_['map'](db[_0x4922('0x2a')]['rawAttributes'],function(_0x5e7709){return{'name':_0x5e7709[_0x4922('0x2b')],'type':_0x5e7709[_0x4922('0x2c')]['key']};});_0x416e26[_0x4922('0x2d')]=_[_0x4922('0x2e')](_0x5d65bd,_0x4922('0x28'));_0x416e26['query']=_['keys'](_0x46cd81[_0x4922('0x2f')]);_0x416e26[_0x4922('0x30')]=_[_0x4922('0x31')](_0x416e26['model'],_0x416e26[_0x4922('0x2f')]);_0x3e3c7d[_0x4922('0x32')]=_[_0x4922('0x31')](_0x416e26['model'],qs['fields'](_0x46cd81[_0x4922('0x2f')][_0x4922('0x33')]));_0x3e3c7d['attributes']=_0x3e3c7d[_0x4922('0x32')]['length']?_0x3e3c7d[_0x4922('0x32')]:_0x416e26[_0x4922('0x2d')];if(!_0x46cd81[_0x4922('0x2f')][_0x4922('0x34')](_0x4922('0x35'))){_0x3e3c7d[_0x4922('0x1c')]=qs[_0x4922('0x1c')](_0x46cd81['query'][_0x4922('0x1c')]);_0x3e3c7d[_0x4922('0x1b')]=qs[_0x4922('0x1b')](_0x46cd81[_0x4922('0x2f')][_0x4922('0x1b')]);}_0x3e3c7d[_0x4922('0x36')]=qs[_0x4922('0x37')](_0x46cd81[_0x4922('0x2f')][_0x4922('0x37')]);_0x3e3c7d[_0x4922('0x38')]=qs['filters'](_['pick'](_0x46cd81[_0x4922('0x2f')],_0x416e26[_0x4922('0x30')]),_0x5d65bd);if(_0x46cd81[_0x4922('0x2f')][_0x4922('0x39')]){_0x3e3c7d[_0x4922('0x38')]=_['merge'](_0x3e3c7d['where'],{'$or':_[_0x4922('0x2e')](_0x5d65bd,function(_0x29a332){if(_0x29a332[_0x4922('0x2c')]!==_0x4922('0x3a')){var _0xd56813={};_0xd56813[_0x29a332['name']]={'$like':'%'+_0x46cd81[_0x4922('0x2f')][_0x4922('0x39')]+'%'};return _0xd56813;}})});}_0x3e3c7d=_[_0x4922('0x3b')]({},_0x3e3c7d,_0x46cd81[_0x4922('0x3c')]);var _0x802dad={'where':_0x3e3c7d['where']};return db['FaxQueueReport'][_0x4922('0x1d')](_0x802dad)[_0x4922('0x24')](function(_0x554766){_0x49fbbd[_0x4922('0x1d')]=_0x554766;if(_0x46cd81['query'][_0x4922('0x3d')]){_0x3e3c7d[_0x4922('0x3e')]=[{'all':!![]}];}return db[_0x4922('0x2a')][_0x4922('0x3f')](_0x3e3c7d);})[_0x4922('0x24')](function(_0x499b26){_0x49fbbd['rows']=_0x499b26;return _0x49fbbd;})[_0x4922('0x24')](respondWithFilteredResult(_0x4cc26e,_0x3e3c7d))[_0x4922('0x40')](handleError(_0x4cc26e,null));};exports[_0x4922('0x41')]=function(_0x344dc0,_0x23c883){var _0x1e7f9f={'raw':!![],'where':{'id':_0x344dc0[_0x4922('0x42')]['id']}},_0xa2fec8={};_0xa2fec8[_0x4922('0x2d')]=_['keys'](db[_0x4922('0x2a')][_0x4922('0x43')]);_0xa2fec8[_0x4922('0x2f')]=_[_0x4922('0x44')](_0x344dc0['query']);_0xa2fec8[_0x4922('0x30')]=_[_0x4922('0x31')](_0xa2fec8[_0x4922('0x2d')],_0xa2fec8[_0x4922('0x2f')]);_0x1e7f9f['attributes']=_['intersection'](_0xa2fec8[_0x4922('0x2d')],qs[_0x4922('0x33')](_0x344dc0[_0x4922('0x2f')]['fields']));_0x1e7f9f['attributes']=_0x1e7f9f[_0x4922('0x32')][_0x4922('0x45')]?_0x1e7f9f[_0x4922('0x32')]:_0xa2fec8[_0x4922('0x2d')];if(_0x344dc0[_0x4922('0x2f')][_0x4922('0x3d')]){_0x1e7f9f[_0x4922('0x3e')]=[{'all':!![]}];}_0x1e7f9f=_[_0x4922('0x3b')]({},_0x1e7f9f,_0x344dc0['options']);return db[_0x4922('0x2a')][_0x4922('0x46')](_0x1e7f9f)[_0x4922('0x24')](handleEntityNotFound(_0x23c883,null))[_0x4922('0x24')](respondWithResult(_0x23c883,null))[_0x4922('0x40')](handleError(_0x23c883,null));};exports[_0x4922('0x47')]=function(_0x2bdd8a,_0x2b1375){return db[_0x4922('0x2a')][_0x4922('0x47')](_0x2bdd8a[_0x4922('0x48')],{})[_0x4922('0x24')](respondWithResult(_0x2b1375,0xc9))[_0x4922('0x40')](handleError(_0x2b1375,null));};exports[_0x4922('0x23')]=function(_0x4c7c02,_0x58fadf){if(_0x4c7c02[_0x4922('0x48')]['id']){delete _0x4c7c02['body']['id'];}return db[_0x4922('0x2a')][_0x4922('0x46')]({'where':{'id':_0x4c7c02[_0x4922('0x42')]['id']}})['then'](handleEntityNotFound(_0x58fadf,null))['then'](saveUpdates(_0x4c7c02[_0x4922('0x48')],null))[_0x4922('0x24')](respondWithResult(_0x58fadf,null))['catch'](handleError(_0x58fadf,null));};exports[_0x4922('0x25')]=function(_0x121b03,_0x58d663){return db[_0x4922('0x2a')][_0x4922('0x46')]({'where':{'id':_0x121b03[_0x4922('0x42')]['id']}})[_0x4922('0x24')](handleEntityNotFound(_0x58d663,null))[_0x4922('0x24')](removeEntity(_0x58d663,null))[_0x4922('0x40')](handleError(_0x58d663,null));};exports[_0x4922('0x49')]=function(_0xdd0450,_0x733b92){return db[_0x4922('0x2a')][_0x4922('0x49')]()['then'](respondWithResult(_0x733b92,null))[_0x4922('0x40')](handleError(_0x733b92,null));}; \ No newline at end of file +var _0xfd2f=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel'];(function(_0x3fb22d,_0x4d997b){var _0x42b188=function(_0x1ee8fc){while(--_0x1ee8fc){_0x3fb22d['push'](_0x3fb22d['shift']());}};_0x42b188(++_0x4d997b);}(_0xfd2f,0x14a));var _0xffd2=function(_0x2bc245,_0x43b8be){_0x2bc245=_0x2bc245-0x0;var _0x4375ca=_0xfd2f[_0x2bc245];return _0x4375ca;};'use strict';var emlformat=require(_0xffd2('0x0'));var rimraf=require(_0xffd2('0x1'));var zipdir=require(_0xffd2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffd2('0x3'));var moment=require('moment');var BPromise=require(_0xffd2('0x4'));var Mustache=require(_0xffd2('0x5'));var util=require('util');var path=require(_0xffd2('0x6'));var sox=require(_0xffd2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffd2('0x8'));var squel=require(_0xffd2('0x9'));var crypto=require('crypto');var jsforce=require(_0xffd2('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xffd2('0xb'));var Papa=require(_0xffd2('0xc'));var Redis=require(_0xffd2('0xd'));var authService=require(_0xffd2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffd2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xffd2('0x10'));var config=require(_0xffd2('0x11'));var licenseUtil=require(_0xffd2('0x12'));var db=require(_0xffd2('0x13'))['db'];function respondWithStatusCode(_0x31274a,_0x1f135b){_0x1f135b=_0x1f135b||0xcc;return function(_0x3cd101){if(_0x3cd101){return _0x31274a['sendStatus'](_0x1f135b);}return _0x31274a['status'](_0x1f135b)['end']();};}function respondWithResult(_0x4bf841,_0x2f0d34){_0x2f0d34=_0x2f0d34||0xc8;return function(_0x2e003f){if(_0x2e003f){return _0x4bf841['status'](_0x2f0d34)[_0xffd2('0x14')](_0x2e003f);}};}function respondWithFilteredResult(_0x391d70,_0x282fcb){return function(_0x229df3){if(_0x229df3){var _0x15caea=typeof _0x282fcb[_0xffd2('0x15')]===_0xffd2('0x16')&&typeof _0x282fcb[_0xffd2('0x17')]===_0xffd2('0x16');var _0x5422ef=_0x229df3[_0xffd2('0x18')];var _0x1f3c23=_0x15caea?0x0:_0x282fcb[_0xffd2('0x15')];var _0x53f6e6=_0x15caea?_0x229df3[_0xffd2('0x18')]:_0x282fcb[_0xffd2('0x15')]+_0x282fcb[_0xffd2('0x17')];var _0xc3dbc8;if(_0x53f6e6>=_0x5422ef){_0x53f6e6=_0x5422ef;_0xc3dbc8=0xc8;}else{_0xc3dbc8=0xce;}_0x391d70['status'](_0xc3dbc8);return _0x391d70['set'](_0xffd2('0x19'),_0x1f3c23+'-'+_0x53f6e6+'/'+_0x5422ef)[_0xffd2('0x14')](_0x229df3);}return null;};}function patchUpdates(_0x40a88c){return function(_0x5c6837){try{jsonpatch[_0xffd2('0x1a')](_0x5c6837,_0x40a88c,!![]);}catch(_0x5421d4){return BPromise[_0xffd2('0x1b')](_0x5421d4);}return _0x5c6837[_0xffd2('0x1c')]();};}function saveUpdates(_0x561bd1,_0x3ed47f){return function(_0x166ed0){if(_0x166ed0){return _0x166ed0[_0xffd2('0x1d')](_0x561bd1)[_0xffd2('0x1e')](function(_0x2b8ca2){return _0x2b8ca2;});}return null;};}function removeEntity(_0x2afc87,_0x260323){return function(_0x279bc6){if(_0x279bc6){return _0x279bc6[_0xffd2('0x1f')]()[_0xffd2('0x1e')](function(){_0x2afc87[_0xffd2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10671f,_0x188b16){return function(_0xb41c4e){if(!_0xb41c4e){_0x10671f[_0xffd2('0x21')](0x194);}return _0xb41c4e;};}function handleError(_0x387361,_0x44668e){_0x44668e=_0x44668e||0x1f4;return function(_0x532f6c){logger[_0xffd2('0x22')](_0x532f6c[_0xffd2('0x23')]);if(_0x532f6c[_0xffd2('0x24')]){delete _0x532f6c[_0xffd2('0x24')];}_0x387361[_0xffd2('0x20')](_0x44668e)[_0xffd2('0x25')](_0x532f6c);};}exports[_0xffd2('0x26')]=function(_0x47c014,_0x3130b9){var _0x4dd5cc={},_0x17dc21={},_0x46868d={'count':0x0,'rows':[]};var _0x14ba17=_[_0xffd2('0x27')](db[_0xffd2('0x28')][_0xffd2('0x29')],function(_0x4f31d2){return{'name':_0x4f31d2['fieldName'],'type':_0x4f31d2[_0xffd2('0x2a')]['key']};});_0x17dc21[_0xffd2('0x2b')]=_[_0xffd2('0x27')](_0x14ba17,_0xffd2('0x24'));_0x17dc21[_0xffd2('0x2c')]=_['keys'](_0x47c014['query']);_0x17dc21[_0xffd2('0x2d')]=_[_0xffd2('0x2e')](_0x17dc21['model'],_0x17dc21[_0xffd2('0x2c')]);_0x4dd5cc[_0xffd2('0x2f')]=_['intersection'](_0x17dc21[_0xffd2('0x2b')],qs[_0xffd2('0x30')](_0x47c014[_0xffd2('0x2c')]['fields']));_0x4dd5cc['attributes']=_0x4dd5cc[_0xffd2('0x2f')][_0xffd2('0x31')]?_0x4dd5cc[_0xffd2('0x2f')]:_0x17dc21[_0xffd2('0x2b')];if(!_0x47c014[_0xffd2('0x2c')]['hasOwnProperty']('nolimit')){_0x4dd5cc[_0xffd2('0x17')]=qs[_0xffd2('0x17')](_0x47c014[_0xffd2('0x2c')]['limit']);_0x4dd5cc[_0xffd2('0x15')]=qs[_0xffd2('0x15')](_0x47c014[_0xffd2('0x2c')]['offset']);}_0x4dd5cc[_0xffd2('0x32')]=qs[_0xffd2('0x33')](_0x47c014[_0xffd2('0x2c')][_0xffd2('0x33')]);_0x4dd5cc[_0xffd2('0x34')]=qs[_0xffd2('0x2d')](_[_0xffd2('0x35')](_0x47c014['query'],_0x17dc21[_0xffd2('0x2d')]),_0x14ba17);if(_0x47c014[_0xffd2('0x2c')][_0xffd2('0x36')]){_0x4dd5cc[_0xffd2('0x34')]=_[_0xffd2('0x37')](_0x4dd5cc[_0xffd2('0x34')],{'$or':_['map'](_0x14ba17,function(_0x18e464){if(_0x18e464[_0xffd2('0x2a')]!==_0xffd2('0x38')){var _0x2f564a={};_0x2f564a[_0x18e464[_0xffd2('0x24')]]={'$like':'%'+_0x47c014[_0xffd2('0x2c')][_0xffd2('0x36')]+'%'};return _0x2f564a;}})});}_0x4dd5cc=_['merge']({},_0x4dd5cc,_0x47c014[_0xffd2('0x39')]);var _0x5a51bb={'where':_0x4dd5cc['where']};return db[_0xffd2('0x28')][_0xffd2('0x18')](_0x5a51bb)[_0xffd2('0x1e')](function(_0x3cec81){_0x46868d[_0xffd2('0x18')]=_0x3cec81;if(_0x47c014['query'][_0xffd2('0x3a')]){_0x4dd5cc[_0xffd2('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4dd5cc);})[_0xffd2('0x1e')](function(_0x321cbd){_0x46868d[_0xffd2('0x3c')]=_0x321cbd;return _0x46868d;})[_0xffd2('0x1e')](respondWithFilteredResult(_0x3130b9,_0x4dd5cc))[_0xffd2('0x3d')](handleError(_0x3130b9,null));};exports[_0xffd2('0x3e')]=function(_0x510aea,_0x2d5e6c){var _0x58ec7b={'raw':!![],'where':{'id':_0x510aea[_0xffd2('0x3f')]['id']}},_0x397906={};_0x397906[_0xffd2('0x2b')]=_['keys'](db[_0xffd2('0x28')][_0xffd2('0x29')]);_0x397906['query']=_['keys'](_0x510aea[_0xffd2('0x2c')]);_0x397906[_0xffd2('0x2d')]=_[_0xffd2('0x2e')](_0x397906[_0xffd2('0x2b')],_0x397906[_0xffd2('0x2c')]);_0x58ec7b[_0xffd2('0x2f')]=_[_0xffd2('0x2e')](_0x397906[_0xffd2('0x2b')],qs[_0xffd2('0x30')](_0x510aea[_0xffd2('0x2c')]['fields']));_0x58ec7b[_0xffd2('0x2f')]=_0x58ec7b[_0xffd2('0x2f')]['length']?_0x58ec7b[_0xffd2('0x2f')]:_0x397906['model'];if(_0x510aea['query']['includeAll']){_0x58ec7b[_0xffd2('0x3b')]=[{'all':!![]}];}_0x58ec7b=_['merge']({},_0x58ec7b,_0x510aea['options']);return db[_0xffd2('0x28')]['find'](_0x58ec7b)[_0xffd2('0x1e')](handleEntityNotFound(_0x2d5e6c,null))[_0xffd2('0x1e')](respondWithResult(_0x2d5e6c,null))[_0xffd2('0x3d')](handleError(_0x2d5e6c,null));};exports[_0xffd2('0x40')]=function(_0x2fefa2,_0xdf872a){return db[_0xffd2('0x28')][_0xffd2('0x40')](_0x2fefa2[_0xffd2('0x41')],{})[_0xffd2('0x1e')](respondWithResult(_0xdf872a,0xc9))[_0xffd2('0x3d')](handleError(_0xdf872a,null));};exports[_0xffd2('0x1d')]=function(_0x44b681,_0x35969d){if(_0x44b681[_0xffd2('0x41')]['id']){delete _0x44b681['body']['id'];}return db[_0xffd2('0x28')][_0xffd2('0x42')]({'where':{'id':_0x44b681[_0xffd2('0x3f')]['id']}})[_0xffd2('0x1e')](handleEntityNotFound(_0x35969d,null))[_0xffd2('0x1e')](saveUpdates(_0x44b681['body'],null))['then'](respondWithResult(_0x35969d,null))[_0xffd2('0x3d')](handleError(_0x35969d,null));};exports['destroy']=function(_0x25ff29,_0x4658c6){return db[_0xffd2('0x28')][_0xffd2('0x42')]({'where':{'id':_0x25ff29[_0xffd2('0x3f')]['id']}})[_0xffd2('0x1e')](handleEntityNotFound(_0x4658c6,null))[_0xffd2('0x1e')](removeEntity(_0x4658c6,null))[_0xffd2('0x3d')](handleError(_0x4658c6,null));};exports['describe']=function(_0x4f5562,_0x187a5b){return db[_0xffd2('0x28')][_0xffd2('0x43')]()[_0xffd2('0x1e')](respondWithResult(_0x187a5b,null))['catch'](handleError(_0x187a5b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9a3e0bf..3e4c991 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x170a68,_0x4340d3){var _0x2c114a=function(_0x9d99af){while(--_0x9d99af){_0x170a68['push'](_0x170a68['shift']());}};_0x2c114a(++_0x4340d3);}(_0x4975,0x86));var _0x5497=function(_0x43c36f,_0x4be898){_0x43c36f=_0x43c36f-0x0;var _0x3938a0=_0x4975[_0x43c36f];return _0x3938a0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc26aff,_0x4d7ef7){var _0x3fe36c=function(_0x210ad2){while(--_0x210ad2){_0xc26aff['push'](_0xc26aff['shift']());}};_0x3fe36c(++_0x4d7ef7);}(_0x53ec,0x192));var _0xc53e=function(_0xf0c02d,_0x409c69){_0xf0c02d=_0xf0c02d-0x0;var _0x124e61=_0x53ec[_0xf0c02d];return _0x124e61;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f19e5c3..d41e8d2 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 _0x219d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util'];(function(_0x3a6446,_0x1c4ac1){var _0x12b443=function(_0x4f14cf){while(--_0x4f14cf){_0x3a6446['push'](_0x3a6446['shift']());}};_0x12b443(++_0x1c4ac1);}(_0x219d,0x1e8));var _0xd219=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x219d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var moment=require('moment');var BPromise=require(_0xd219('0x2'));var rs=require(_0xd219('0x3'));var fs=require('fs');var Redis=require(_0xd219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd219('0x5'));var logger=require(_0xd219('0x6'))(_0xd219('0x7'));var config=require(_0xd219('0x8'));var jayson=require(_0xd219('0x9'));var client=jayson['client'][_0xd219('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7295,_0x30043d,_0x4cd5b3){return new BPromise(function(_0x5d7b48,_0x28e866){return client[_0xd219('0xb')](_0x5d7295,_0x4cd5b3)[_0xd219('0xc')](function(_0x2805bc){logger[_0xd219('0xd')](_0xd219('0xe'),_0x30043d,_0xd219('0xf'));logger[_0xd219('0x10')](_0xd219('0x11'),_0x30043d,_0xd219('0xf'),JSON[_0xd219('0x12')](_0x2805bc));if(_0x2805bc[_0xd219('0x13')]){if(_0x2805bc[_0xd219('0x13')][_0xd219('0x14')]===0x1f4){logger[_0xd219('0x13')](_0xd219('0xe'),_0x30043d,_0x2805bc['error'][_0xd219('0x15')]);return _0x28e866(_0x2805bc[_0xd219('0x13')][_0xd219('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x30043d,_0x2805bc['error'][_0xd219('0x15')]);return _0x5d7b48(_0x2805bc[_0xd219('0x13')][_0xd219('0x15')]);}else{logger['info'](_0xd219('0xe'),_0x30043d,_0xd219('0xf'));_0x5d7b48(_0x2805bc[_0xd219('0x16')][_0xd219('0x15')]);}})[_0xd219('0x17')](function(_0x4711ba){logger[_0xd219('0x13')](_0xd219('0xe'),_0x30043d,_0x4711ba);_0x28e866(_0x4711ba);});});}exports[_0xd219('0x18')]=function(_0x33357f){var _0x28561d=this;return new Promise(function(_0x36f707,_0x54e1ac){return db[_0xd219('0x19')][_0xd219('0x1a')](_0x33357f[_0xd219('0x1b')],{'raw':_0x33357f[_0xd219('0x1c')]?_0x33357f[_0xd219('0x1c')][_0xd219('0x1d')]===undefined?!![]:![]:!![]})[_0xd219('0xc')](function(_0x1d0192){logger[_0xd219('0xd')](_0xd219('0x18'),_0x33357f);logger[_0xd219('0x10')](_0xd219('0x18'),_0x33357f,JSON[_0xd219('0x12')](_0x1d0192));_0x36f707(_0x1d0192);})[_0xd219('0x17')](function(_0x562ac1){logger[_0xd219('0x13')](_0xd219('0x18'),_0x562ac1[_0xd219('0x15')],_0x33357f);_0x54e1ac(_0x28561d[_0xd219('0x13')](0x1f4,_0x562ac1[_0xd219('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x2db0c8){var _0x5a37fd=this;return new Promise(function(_0x4b5068,_0x38a267){return db[_0xd219('0x19')][_0xd219('0x1e')](_0x2db0c8[_0xd219('0x1b')],{'raw':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x1f')]||null:null,'attributes':_0x2db0c8['options']?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x20')]||null:null,'limit':_0x2db0c8[_0xd219('0x1c')]?_0x2db0c8[_0xd219('0x1c')][_0xd219('0x21')]||null:null})[_0xd219('0xc')](function(_0x1de6e6){logger[_0xd219('0xd')](_0xd219('0x22'),_0x2db0c8);logger[_0xd219('0x10')]('UpdateFaxQueueReport',_0x2db0c8,JSON[_0xd219('0x12')](_0x1de6e6));_0x4b5068(_0x1de6e6);})[_0xd219('0x17')](function(_0x33efa6){logger[_0xd219('0x13')](_0xd219('0x22'),_0x33efa6[_0xd219('0x15')],_0x2db0c8);_0x38a267(_0x5a37fd['error'](0x1f4,_0x33efa6[_0xd219('0x15')]));});});}; \ No newline at end of file +var _0x44e0=['jayson/promise','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','raw','stringify','update','body','options','where','attributes','limit','UpdateFaxQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x97b4a3,_0x45269e){var _0x4421d8=function(_0x496a99){while(--_0x496a99){_0x97b4a3['push'](_0x97b4a3['shift']());}};_0x4421d8(++_0x45269e);}(_0x44e0,0x1b2));var _0x044e=function(_0x12ba4e,_0x41dd9d){_0x12ba4e=_0x12ba4e-0x0;var _0x176703=_0x44e0[_0x12ba4e];return _0x176703;};'use strict';var _=require('lodash');var util=require(_0x044e('0x0'));var moment=require('moment');var BPromise=require(_0x044e('0x1'));var rs=require(_0x044e('0x2'));var fs=require('fs');var Redis=require(_0x044e('0x3'));var db=require(_0x044e('0x4'))['db'];var utils=require(_0x044e('0x5'));var logger=require('../../config/logger')(_0x044e('0x6'));var config=require(_0x044e('0x7'));var jayson=require(_0x044e('0x8'));var client=jayson['client'][_0x044e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50341a,_0x2d1257,_0xd0f5bd){return new BPromise(function(_0x336e3e,_0x2f37ae){return client[_0x044e('0xa')](_0x50341a,_0xd0f5bd)[_0x044e('0xb')](function(_0x4526fa){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2d1257,_0x044e('0xc'));logger[_0x044e('0xd')](_0x044e('0xe'),_0x2d1257,'request\x20sent',JSON['stringify'](_0x4526fa));if(_0x4526fa['error']){if(_0x4526fa[_0x044e('0xf')][_0x044e('0x10')]===0x1f4){logger[_0x044e('0xf')](_0x044e('0x11'),_0x2d1257,_0x4526fa[_0x044e('0xf')]['message']);return _0x2f37ae(_0x4526fa[_0x044e('0xf')][_0x044e('0x12')]);}logger[_0x044e('0xf')](_0x044e('0x11'),_0x2d1257,_0x4526fa[_0x044e('0xf')][_0x044e('0x12')]);return _0x336e3e(_0x4526fa[_0x044e('0xf')]['message']);}else{logger[_0x044e('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x2d1257,_0x044e('0xc'));_0x336e3e(_0x4526fa[_0x044e('0x14')]['message']);}})[_0x044e('0x15')](function(_0xbb1ff5){logger[_0x044e('0xf')](_0x044e('0x11'),_0x2d1257,_0xbb1ff5);_0x2f37ae(_0xbb1ff5);});});}exports[_0x044e('0x16')]=function(_0x4ddf70){var _0x5bcf80=this;return new Promise(function(_0x4647d4,_0x1b59c3){return db[_0x044e('0x17')][_0x044e('0x18')](_0x4ddf70['body'],{'raw':_0x4ddf70['options']?_0x4ddf70['options'][_0x044e('0x19')]===undefined?!![]:![]:!![]})[_0x044e('0xb')](function(_0x5cba85){logger[_0x044e('0x13')](_0x044e('0x16'),_0x4ddf70);logger['debug'](_0x044e('0x16'),_0x4ddf70,JSON[_0x044e('0x1a')](_0x5cba85));_0x4647d4(_0x5cba85);})['catch'](function(_0x1a98cc){logger[_0x044e('0xf')](_0x044e('0x16'),_0x1a98cc[_0x044e('0x12')],_0x4ddf70);_0x1b59c3(_0x5bcf80['error'](0x1f4,_0x1a98cc[_0x044e('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x56533d){var _0x1b45e2=this;return new Promise(function(_0x4aefad,_0x1be428){return db['FaxQueueReport'][_0x044e('0x1b')](_0x56533d[_0x044e('0x1c')],{'raw':_0x56533d[_0x044e('0x1d')]?_0x56533d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56533d['options']?_0x56533d[_0x044e('0x1d')][_0x044e('0x1e')]||null:null,'attributes':_0x56533d[_0x044e('0x1d')]?_0x56533d['options'][_0x044e('0x1f')]||null:null,'limit':_0x56533d['options']?_0x56533d['options'][_0x044e('0x20')]||null:null})['then'](function(_0x43da60){logger[_0x044e('0x13')](_0x044e('0x21'),_0x56533d);logger[_0x044e('0xd')](_0x044e('0x21'),_0x56533d,JSON['stringify'](_0x43da60));_0x4aefad(_0x43da60);})['catch'](function(_0x143222){logger[_0x044e('0xf')](_0x044e('0x21'),_0x143222['message'],_0x56533d);_0x1be428(_0x1b45e2[_0x044e('0xf')](0x1f4,_0x143222[_0x044e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b13463c..a26da12 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 _0x6e8f=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x2359f6,_0x30f20b){var _0x1f716c=function(_0x5cd3b7){while(--_0x5cd3b7){_0x2359f6['push'](_0x2359f6['shift']());}};_0x1f716c(++_0x30f20b);}(_0x6e8f,0x76));var _0xf6e8=function(_0x1d8411,_0x20f72a){_0x1d8411=_0x1d8411-0x0;var _0x3a3833=_0x6e8f[_0x1d8411];return _0x3a3833;};'use strict';var multer=require(_0xf6e8('0x0'));var util=require('util');var path=require(_0xf6e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6e8('0x2'));var router=express[_0xf6e8('0x3')]();var fs_extra=require(_0xf6e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf6e8('0x5'));var config=require(_0xf6e8('0x6'));var controller=require('./faxQueueReport.controller');router[_0xf6e8('0x7')]('/',auth[_0xf6e8('0x8')](),controller[_0xf6e8('0x9')]);router[_0xf6e8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xf6e8('0xa'),auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xb')]);router['post']('/',auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xc')]);router['put'](_0xf6e8('0xa'),auth[_0xf6e8('0x8')](),controller[_0xf6e8('0xd')]);router[_0xf6e8('0xe')](_0xf6e8('0xa'),auth['isAuthenticated'](),controller[_0xf6e8('0xf')]);module[_0xf6e8('0x10')]=router; \ No newline at end of file +var _0x4f0c=['delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','update'];(function(_0x2eebdc,_0x30e8fb){var _0x21b620=function(_0x1f30e3){while(--_0x1f30e3){_0x2eebdc['push'](_0x2eebdc['shift']());}};_0x21b620(++_0x30e8fb);}(_0x4f0c,0x122));var _0xc4f0=function(_0x12b158,_0x1574dc){_0x12b158=_0x12b158-0x0;var _0x2faef6=_0x4f0c[_0x12b158];return _0x2faef6;};'use strict';var multer=require('multer');var util=require(_0xc4f0('0x0'));var path=require(_0xc4f0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4f0('0x2')]();var fs_extra=require(_0xc4f0('0x3'));var auth=require(_0xc4f0('0x4'));var interaction=require(_0xc4f0('0x5'));var config=require(_0xc4f0('0x6'));var controller=require(_0xc4f0('0x7'));router[_0xc4f0('0x8')]('/',auth[_0xc4f0('0x9')](),controller[_0xc4f0('0xa')]);router[_0xc4f0('0x8')](_0xc4f0('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc4f0('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc4f0('0x9')](),controller[_0xc4f0('0xd')]);router[_0xc4f0('0xe')](_0xc4f0('0xc'),auth[_0xc4f0('0x9')](),controller[_0xc4f0('0xf')]);router[_0xc4f0('0x10')]('/:id',auth[_0xc4f0('0x9')](),controller['destroy']);module[_0xc4f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 133d40a..5997b96 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ca92f,_0x1fbfc3){var _0x1945b9=function(_0x800cfa){while(--_0x800cfa){_0x2ca92f['push'](_0x2ca92f['shift']());}};_0x1945b9(++_0x1fbfc3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x00bb[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xb43b,0x1b2));var _0xbb43=function(_0x404aa8,_0x1df2c5){_0x404aa8=_0x404aa8-0x0;var _0x3b783a=_0xb43b[_0x404aa8];return _0x3b783a;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1be4525..7f3b5ad 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 _0xbcc8=['body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xbcc8,0x97));var _0x8bcc=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xbcc8[_0x1f1511];return _0x1d9ab8;};'use strict';var emlformat=require(_0x8bcc('0x0'));var rimraf=require(_0x8bcc('0x1'));var zipdir=require(_0x8bcc('0x2'));var jsonpatch=require(_0x8bcc('0x3'));var rp=require(_0x8bcc('0x4'));var moment=require(_0x8bcc('0x5'));var BPromise=require(_0x8bcc('0x6'));var Mustache=require(_0x8bcc('0x7'));var util=require(_0x8bcc('0x8'));var path=require('path');var sox=require(_0x8bcc('0x9'));var csv=require(_0x8bcc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bcc('0xb'));var _=require(_0x8bcc('0xc'));var squel=require(_0x8bcc('0xd'));var crypto=require(_0x8bcc('0xe'));var jsforce=require(_0x8bcc('0xf'));var deskjs=require(_0x8bcc('0x10'));var toCsv=require(_0x8bcc('0xa'));var querystring=require('querystring');var Papa=require(_0x8bcc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bcc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8bcc('0x13'));var config=require(_0x8bcc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bcc('0x15'))['db'];function respondWithStatusCode(_0x44a21d,_0x14c5e6){_0x14c5e6=_0x14c5e6||0xcc;return function(_0x22f506){if(_0x22f506){return _0x44a21d[_0x8bcc('0x16')](_0x14c5e6);}return _0x44a21d[_0x8bcc('0x17')](_0x14c5e6)[_0x8bcc('0x18')]();};}function respondWithResult(_0x231574,_0x306124){_0x306124=_0x306124||0xc8;return function(_0x38cf5e){if(_0x38cf5e){return _0x231574[_0x8bcc('0x17')](_0x306124)['json'](_0x38cf5e);}};}function respondWithFilteredResult(_0x7361f,_0x25c433){return function(_0x458120){if(_0x458120){var _0xf7eb34=typeof _0x25c433[_0x8bcc('0x19')]===_0x8bcc('0x1a')&&typeof _0x25c433[_0x8bcc('0x1b')]===_0x8bcc('0x1a');var _0x38c6a6=_0x458120['count'];var _0x4941d8=_0xf7eb34?0x0:_0x25c433[_0x8bcc('0x19')];var _0xfe175d=_0xf7eb34?_0x458120[_0x8bcc('0x1c')]:_0x25c433[_0x8bcc('0x19')]+_0x25c433['limit'];var _0x407820;if(_0xfe175d>=_0x38c6a6){_0xfe175d=_0x38c6a6;_0x407820=0xc8;}else{_0x407820=0xce;}_0x7361f[_0x8bcc('0x17')](_0x407820);return _0x7361f[_0x8bcc('0x1d')](_0x8bcc('0x1e'),_0x4941d8+'-'+_0xfe175d+'/'+_0x38c6a6)[_0x8bcc('0x1f')](_0x458120);}return null;};}function patchUpdates(_0x5ac5cd){return function(_0x5cd9d4){try{jsonpatch[_0x8bcc('0x20')](_0x5cd9d4,_0x5ac5cd,!![]);}catch(_0x4cc59a){return BPromise[_0x8bcc('0x21')](_0x4cc59a);}return _0x5cd9d4[_0x8bcc('0x22')]();};}function saveUpdates(_0x495846,_0x1c8901){return function(_0x41e534){if(_0x41e534){return _0x41e534['update'](_0x495846)['then'](function(_0x38fb04){return _0x38fb04;});}return null;};}function removeEntity(_0x210935,_0x249d50){return function(_0x5a5b3a){if(_0x5a5b3a){return _0x5a5b3a[_0x8bcc('0x23')]()[_0x8bcc('0x24')](function(){_0x210935[_0x8bcc('0x17')](0xcc)[_0x8bcc('0x18')]();});}};}function handleEntityNotFound(_0x5b18dd,_0x153589){return function(_0x1a4a9d){if(!_0x1a4a9d){_0x5b18dd[_0x8bcc('0x16')](0x194);}return _0x1a4a9d;};}function handleError(_0x122a2c,_0x144c22){_0x144c22=_0x144c22||0x1f4;return function(_0xdd8315){logger[_0x8bcc('0x25')](_0xdd8315[_0x8bcc('0x26')]);if(_0xdd8315[_0x8bcc('0x27')]){delete _0xdd8315[_0x8bcc('0x27')];}_0x122a2c[_0x8bcc('0x17')](_0x144c22)[_0x8bcc('0x28')](_0xdd8315);};}exports[_0x8bcc('0x29')]=function(_0x12b04d,_0x470e63){var _0x107064={},_0x1116b8={},_0x3b7b9b={'count':0x0,'rows':[]};var _0x92b29=_[_0x8bcc('0x2a')](db[_0x8bcc('0x2b')][_0x8bcc('0x2c')],function(_0xf7acd2){return{'name':_0xf7acd2['fieldName'],'type':_0xf7acd2[_0x8bcc('0x2d')][_0x8bcc('0x2e')]};});_0x1116b8['model']=_[_0x8bcc('0x2a')](_0x92b29,'name');_0x1116b8[_0x8bcc('0x2f')]=_[_0x8bcc('0x30')](_0x12b04d[_0x8bcc('0x2f')]);_0x1116b8[_0x8bcc('0x31')]=_['intersection'](_0x1116b8[_0x8bcc('0x32')],_0x1116b8[_0x8bcc('0x2f')]);_0x107064[_0x8bcc('0x33')]=_[_0x8bcc('0x34')](_0x1116b8[_0x8bcc('0x32')],qs[_0x8bcc('0x35')](_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x35')]));_0x107064[_0x8bcc('0x33')]=_0x107064[_0x8bcc('0x33')][_0x8bcc('0x36')]?_0x107064[_0x8bcc('0x33')]:_0x1116b8['model'];if(!_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x37')]('nolimit')){_0x107064['limit']=qs[_0x8bcc('0x1b')](_0x12b04d['query'][_0x8bcc('0x1b')]);_0x107064['offset']=qs[_0x8bcc('0x19')](_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x19')]);}_0x107064[_0x8bcc('0x38')]=qs['sort'](_0x12b04d[_0x8bcc('0x2f')]['sort']);_0x107064[_0x8bcc('0x39')]=qs[_0x8bcc('0x31')](_[_0x8bcc('0x3a')](_0x12b04d['query'],_0x1116b8[_0x8bcc('0x31')]),_0x92b29);if(_0x12b04d['query'][_0x8bcc('0x3b')]){_0x107064[_0x8bcc('0x39')]=_[_0x8bcc('0x3c')](_0x107064['where'],{'$or':_[_0x8bcc('0x2a')](_0x92b29,function(_0xe4f98e){if(_0xe4f98e[_0x8bcc('0x2d')]!==_0x8bcc('0x3d')){var _0x41419a={};_0x41419a[_0xe4f98e[_0x8bcc('0x27')]]={'$like':'%'+_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x3b')]+'%'};return _0x41419a;}})});}_0x107064=_['merge']({},_0x107064,_0x12b04d[_0x8bcc('0x3e')]);var _0x32ba62={'where':_0x107064[_0x8bcc('0x39')]};return db[_0x8bcc('0x2b')]['count'](_0x32ba62)[_0x8bcc('0x24')](function(_0x53008e){_0x3b7b9b['count']=_0x53008e;if(_0x12b04d[_0x8bcc('0x2f')][_0x8bcc('0x3f')]){_0x107064['include']=[{'all':!![]}];}return db[_0x8bcc('0x2b')][_0x8bcc('0x40')](_0x107064);})[_0x8bcc('0x24')](function(_0x42962f){_0x3b7b9b[_0x8bcc('0x41')]=_0x42962f;return _0x3b7b9b;})['then'](respondWithFilteredResult(_0x470e63,_0x107064))[_0x8bcc('0x42')](handleError(_0x470e63,null));};exports[_0x8bcc('0x43')]=function(_0x529f5c,_0x4ea065){var _0x5e76d2={'raw':!![],'where':{'id':_0x529f5c['params']['id']}},_0x35de48={};_0x35de48[_0x8bcc('0x32')]=_[_0x8bcc('0x30')](db['FaxTransferReport'][_0x8bcc('0x2c')]);_0x35de48[_0x8bcc('0x2f')]=_[_0x8bcc('0x30')](_0x529f5c[_0x8bcc('0x2f')]);_0x35de48[_0x8bcc('0x31')]=_[_0x8bcc('0x34')](_0x35de48[_0x8bcc('0x32')],_0x35de48[_0x8bcc('0x2f')]);_0x5e76d2['attributes']=_[_0x8bcc('0x34')](_0x35de48[_0x8bcc('0x32')],qs[_0x8bcc('0x35')](_0x529f5c['query'][_0x8bcc('0x35')]));_0x5e76d2['attributes']=_0x5e76d2[_0x8bcc('0x33')][_0x8bcc('0x36')]?_0x5e76d2[_0x8bcc('0x33')]:_0x35de48[_0x8bcc('0x32')];if(_0x529f5c[_0x8bcc('0x2f')]['includeAll']){_0x5e76d2[_0x8bcc('0x44')]=[{'all':!![]}];}_0x5e76d2=_[_0x8bcc('0x3c')]({},_0x5e76d2,_0x529f5c['options']);return db['FaxTransferReport'][_0x8bcc('0x45')](_0x5e76d2)[_0x8bcc('0x24')](handleEntityNotFound(_0x4ea065,null))[_0x8bcc('0x24')](respondWithResult(_0x4ea065,null))[_0x8bcc('0x42')](handleError(_0x4ea065,null));};exports[_0x8bcc('0x46')]=function(_0x30538f,_0x2b7b52){return db['FaxTransferReport'][_0x8bcc('0x46')](_0x30538f[_0x8bcc('0x47')],{})[_0x8bcc('0x24')](respondWithResult(_0x2b7b52,0xc9))[_0x8bcc('0x42')](handleError(_0x2b7b52,null));};exports['update']=function(_0x2fb4a7,_0x456ecd){if(_0x2fb4a7['body']['id']){delete _0x2fb4a7['body']['id'];}return db[_0x8bcc('0x2b')]['find']({'where':{'id':_0x2fb4a7['params']['id']}})[_0x8bcc('0x24')](handleEntityNotFound(_0x456ecd,null))[_0x8bcc('0x24')](saveUpdates(_0x2fb4a7[_0x8bcc('0x47')],null))[_0x8bcc('0x24')](respondWithResult(_0x456ecd,null))[_0x8bcc('0x42')](handleError(_0x456ecd,null));};exports[_0x8bcc('0x23')]=function(_0x505bf9,_0xab9d6b){return db['FaxTransferReport']['find']({'where':{'id':_0x505bf9[_0x8bcc('0x48')]['id']}})['then'](handleEntityNotFound(_0xab9d6b,null))[_0x8bcc('0x24')](removeEntity(_0xab9d6b,null))[_0x8bcc('0x42')](handleError(_0xab9d6b,null));};exports[_0x8bcc('0x49')]=function(_0x3a0409,_0x108677){return db[_0x8bcc('0x2b')]['describe']()[_0x8bcc('0x24')](respondWithResult(_0x108677,null))[_0x8bcc('0x42')](handleError(_0x108677,null));}; \ No newline at end of file +var _0x998e=['lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','FaxTransferReport','includeAll','findAll','catch','show','keys','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x998e,0xf8));var _0xe998=function(_0x22c90c,_0x573cf5){_0x22c90c=_0x22c90c-0x0;var _0x5c5c9f=_0x998e[_0x22c90c];return _0x5c5c9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe998('0x0'));var zipdir=require(_0xe998('0x1'));var jsonpatch=require(_0xe998('0x2'));var rp=require(_0xe998('0x3'));var moment=require('moment');var BPromise=require(_0xe998('0x4'));var Mustache=require('mustache');var util=require(_0xe998('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe998('0x6'));var ejs=require(_0xe998('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe998('0x8'));var squel=require(_0xe998('0x9'));var crypto=require('crypto');var jsforce=require(_0xe998('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe998('0xb'));var Redis=require('ioredis');var authService=require(_0xe998('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe998('0xd'));var hardwareService=require(_0xe998('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe998('0xf'))['db'];function respondWithStatusCode(_0x3992c7,_0x282a17){_0x282a17=_0x282a17||0xcc;return function(_0x32ac4a){if(_0x32ac4a){return _0x3992c7[_0xe998('0x10')](_0x282a17);}return _0x3992c7[_0xe998('0x11')](_0x282a17)[_0xe998('0x12')]();};}function respondWithResult(_0x111b1a,_0x5d8bb1){_0x5d8bb1=_0x5d8bb1||0xc8;return function(_0x1edfed){if(_0x1edfed){return _0x111b1a[_0xe998('0x11')](_0x5d8bb1)[_0xe998('0x13')](_0x1edfed);}};}function respondWithFilteredResult(_0x21ef57,_0x126f77){return function(_0x3d9778){if(_0x3d9778){var _0x3be765=typeof _0x126f77['offset']===_0xe998('0x14')&&typeof _0x126f77[_0xe998('0x15')]===_0xe998('0x14');var _0xf83b0d=_0x3d9778[_0xe998('0x16')];var _0x38da34=_0x3be765?0x0:_0x126f77[_0xe998('0x17')];var _0x116b16=_0x3be765?_0x3d9778[_0xe998('0x16')]:_0x126f77[_0xe998('0x17')]+_0x126f77[_0xe998('0x15')];var _0x4e2f85;if(_0x116b16>=_0xf83b0d){_0x116b16=_0xf83b0d;_0x4e2f85=0xc8;}else{_0x4e2f85=0xce;}_0x21ef57[_0xe998('0x11')](_0x4e2f85);return _0x21ef57[_0xe998('0x18')]('Content-Range',_0x38da34+'-'+_0x116b16+'/'+_0xf83b0d)[_0xe998('0x13')](_0x3d9778);}return null;};}function patchUpdates(_0x464249){return function(_0x543cb6){try{jsonpatch['apply'](_0x543cb6,_0x464249,!![]);}catch(_0x10fee2){return BPromise[_0xe998('0x19')](_0x10fee2);}return _0x543cb6['save']();};}function saveUpdates(_0x23b5b9,_0x21c58d){return function(_0x2f2d77){if(_0x2f2d77){return _0x2f2d77[_0xe998('0x1a')](_0x23b5b9)[_0xe998('0x1b')](function(_0x25001f){return _0x25001f;});}return null;};}function removeEntity(_0x339007,_0x124537){return function(_0x4f3e75){if(_0x4f3e75){return _0x4f3e75[_0xe998('0x1c')]()['then'](function(){_0x339007[_0xe998('0x11')](0xcc)[_0xe998('0x12')]();});}};}function handleEntityNotFound(_0x44f4c8,_0x5b696b){return function(_0x5b787e){if(!_0x5b787e){_0x44f4c8[_0xe998('0x10')](0x194);}return _0x5b787e;};}function handleError(_0x23854a,_0x5a341d){_0x5a341d=_0x5a341d||0x1f4;return function(_0x1de686){logger['error'](_0x1de686[_0xe998('0x1d')]);if(_0x1de686[_0xe998('0x1e')]){delete _0x1de686[_0xe998('0x1e')];}_0x23854a[_0xe998('0x11')](_0x5a341d)[_0xe998('0x1f')](_0x1de686);};}exports[_0xe998('0x20')]=function(_0x12895a,_0x509483){var _0x5b9200={},_0x2669d2={},_0x4fc727={'count':0x0,'rows':[]};var _0x3ad32d=_[_0xe998('0x21')](db['FaxTransferReport'][_0xe998('0x22')],function(_0x4a1d67){return{'name':_0x4a1d67[_0xe998('0x23')],'type':_0x4a1d67['type'][_0xe998('0x24')]};});_0x2669d2[_0xe998('0x25')]=_[_0xe998('0x21')](_0x3ad32d,_0xe998('0x1e'));_0x2669d2[_0xe998('0x26')]=_['keys'](_0x12895a[_0xe998('0x26')]);_0x2669d2[_0xe998('0x27')]=_[_0xe998('0x28')](_0x2669d2[_0xe998('0x25')],_0x2669d2['query']);_0x5b9200['attributes']=_[_0xe998('0x28')](_0x2669d2[_0xe998('0x25')],qs[_0xe998('0x29')](_0x12895a[_0xe998('0x26')][_0xe998('0x29')]));_0x5b9200[_0xe998('0x2a')]=_0x5b9200[_0xe998('0x2a')][_0xe998('0x2b')]?_0x5b9200[_0xe998('0x2a')]:_0x2669d2[_0xe998('0x25')];if(!_0x12895a['query']['hasOwnProperty'](_0xe998('0x2c'))){_0x5b9200[_0xe998('0x15')]=qs[_0xe998('0x15')](_0x12895a[_0xe998('0x26')][_0xe998('0x15')]);_0x5b9200[_0xe998('0x17')]=qs['offset'](_0x12895a[_0xe998('0x26')][_0xe998('0x17')]);}_0x5b9200[_0xe998('0x2d')]=qs[_0xe998('0x2e')](_0x12895a['query'][_0xe998('0x2e')]);_0x5b9200[_0xe998('0x2f')]=qs[_0xe998('0x27')](_[_0xe998('0x30')](_0x12895a[_0xe998('0x26')],_0x2669d2[_0xe998('0x27')]),_0x3ad32d);if(_0x12895a['query'][_0xe998('0x31')]){_0x5b9200[_0xe998('0x2f')]=_[_0xe998('0x32')](_0x5b9200[_0xe998('0x2f')],{'$or':_[_0xe998('0x21')](_0x3ad32d,function(_0x3cb0ae){if(_0x3cb0ae[_0xe998('0x33')]!=='VIRTUAL'){var _0x405bf6={};_0x405bf6[_0x3cb0ae['name']]={'$like':'%'+_0x12895a[_0xe998('0x26')]['filter']+'%'};return _0x405bf6;}})});}_0x5b9200=_[_0xe998('0x32')]({},_0x5b9200,_0x12895a[_0xe998('0x34')]);var _0x4b3990={'where':_0x5b9200[_0xe998('0x2f')]};return db[_0xe998('0x35')][_0xe998('0x16')](_0x4b3990)[_0xe998('0x1b')](function(_0x2409f0){_0x4fc727['count']=_0x2409f0;if(_0x12895a[_0xe998('0x26')][_0xe998('0x36')]){_0x5b9200['include']=[{'all':!![]}];}return db[_0xe998('0x35')][_0xe998('0x37')](_0x5b9200);})[_0xe998('0x1b')](function(_0x51e723){_0x4fc727['rows']=_0x51e723;return _0x4fc727;})['then'](respondWithFilteredResult(_0x509483,_0x5b9200))[_0xe998('0x38')](handleError(_0x509483,null));};exports[_0xe998('0x39')]=function(_0x3c647a,_0x526c52){var _0x3d1d0={'raw':!![],'where':{'id':_0x3c647a['params']['id']}},_0x40074c={};_0x40074c[_0xe998('0x25')]=_[_0xe998('0x3a')](db[_0xe998('0x35')][_0xe998('0x22')]);_0x40074c['query']=_['keys'](_0x3c647a['query']);_0x40074c['filters']=_[_0xe998('0x28')](_0x40074c[_0xe998('0x25')],_0x40074c[_0xe998('0x26')]);_0x3d1d0['attributes']=_[_0xe998('0x28')](_0x40074c['model'],qs[_0xe998('0x29')](_0x3c647a['query'][_0xe998('0x29')]));_0x3d1d0[_0xe998('0x2a')]=_0x3d1d0[_0xe998('0x2a')]['length']?_0x3d1d0[_0xe998('0x2a')]:_0x40074c[_0xe998('0x25')];if(_0x3c647a[_0xe998('0x26')][_0xe998('0x36')]){_0x3d1d0['include']=[{'all':!![]}];}_0x3d1d0=_[_0xe998('0x32')]({},_0x3d1d0,_0x3c647a['options']);return db[_0xe998('0x35')][_0xe998('0x3b')](_0x3d1d0)['then'](handleEntityNotFound(_0x526c52,null))[_0xe998('0x1b')](respondWithResult(_0x526c52,null))[_0xe998('0x38')](handleError(_0x526c52,null));};exports[_0xe998('0x3c')]=function(_0x2adc7d,_0x5a2915){return db['FaxTransferReport']['create'](_0x2adc7d[_0xe998('0x3d')],{})['then'](respondWithResult(_0x5a2915,0xc9))[_0xe998('0x38')](handleError(_0x5a2915,null));};exports[_0xe998('0x1a')]=function(_0x1ca28c,_0x379d50){if(_0x1ca28c[_0xe998('0x3d')]['id']){delete _0x1ca28c[_0xe998('0x3d')]['id'];}return db[_0xe998('0x35')][_0xe998('0x3b')]({'where':{'id':_0x1ca28c[_0xe998('0x3e')]['id']}})['then'](handleEntityNotFound(_0x379d50,null))[_0xe998('0x1b')](saveUpdates(_0x1ca28c[_0xe998('0x3d')],null))[_0xe998('0x1b')](respondWithResult(_0x379d50,null))[_0xe998('0x38')](handleError(_0x379d50,null));};exports['destroy']=function(_0x45a33d,_0xb234c1){return db['FaxTransferReport'][_0xe998('0x3b')]({'where':{'id':_0x45a33d[_0xe998('0x3e')]['id']}})[_0xe998('0x1b')](handleEntityNotFound(_0xb234c1,null))['then'](removeEntity(_0xb234c1,null))['catch'](handleError(_0xb234c1,null));};exports['describe']=function(_0x197640,_0x2692e1){return db[_0xe998('0x35')][_0xe998('0x3f')]()[_0xe998('0x1b')](respondWithResult(_0x2692e1,null))[_0xe998('0x38')](handleError(_0x2692e1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ea6628f..038f093 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 _0xbc5e=['bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1601ad,_0x4e4a92){var _0x3973aa=function(_0x39f34d){while(--_0x39f34d){_0x1601ad['push'](_0x1601ad['shift']());}};_0x3973aa(++_0x4e4a92);}(_0xbc5e,0x7d));var _0xebc5=function(_0x5b6332,_0x3a3348){_0x5b6332=_0x5b6332-0x0;var _0x1f315d=_0xbc5e[_0x5b6332];return _0x1f315d;};'use strict';var _=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var logger=require(_0xebc5('0x2'))(_0xebc5('0x3'));var moment=require(_0xebc5('0x4'));var BPromise=require(_0xebc5('0x5'));var rp=require(_0xebc5('0x6'));var fs=require('fs');var path=require(_0xebc5('0x7'));var rimraf=require(_0xebc5('0x8'));var config=require('../../config/environment');var attributes=require(_0xebc5('0x9'));module[_0xebc5('0xa')]=function(_0x19f4c6,_0x2cbf91){return _0x19f4c6[_0xebc5('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xebc5('0xc'),'fields':[_0xebc5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc16a=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0xc16a,0x160));var _0xac16=function(_0x4b8c43,_0x35b204){_0x4b8c43=_0x4b8c43-0x0;var _0x12cd55=_0xc16a[_0x4b8c43];return _0x12cd55;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var logger=require(_0xac16('0x2'))(_0xac16('0x3'));var moment=require(_0xac16('0x4'));var BPromise=require('bluebird');var rp=require(_0xac16('0x5'));var fs=require('fs');var path=require(_0xac16('0x6'));var rimraf=require(_0xac16('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2de644,_0xb3b293){return _0x2de644['define'](_0xac16('0x8'),attributes,{'tableName':_0xac16('0x9'),'paranoid':![],'indexes':[{'name':_0xac16('0xa'),'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 9ca8d31..608da79 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 _0xc902=['../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x546163,_0x2d4d18){var _0x1a07cb=function(_0x29f7e3){while(--_0x29f7e3){_0x546163['push'](_0x546163['shift']());}};_0x1a07cb(++_0x2d4d18);}(_0xc902,0xd3));var _0x2c90=function(_0x30281e,_0x206593){_0x30281e=_0x30281e-0x0;var _0x2ea42=_0xc902[_0x30281e];return _0x2ea42;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var moment=require('moment');var BPromise=require(_0x2c90('0x2'));var rs=require(_0x2c90('0x3'));var fs=require('fs');var Redis=require(_0x2c90('0x4'));var db=require(_0x2c90('0x5'))['db'];var utils=require(_0x2c90('0x6'));var logger=require(_0x2c90('0x7'))(_0x2c90('0x8'));var config=require(_0x2c90('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c90('0xa')][_0x2c90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e36d6,_0x38c95f,_0x120e98){return new BPromise(function(_0x52c707,_0x377ccc){return client[_0x2c90('0xc')](_0x1e36d6,_0x120e98)[_0x2c90('0xd')](function(_0x5913ba){logger[_0x2c90('0xe')](_0x2c90('0xf'),_0x38c95f,_0x2c90('0x10'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x38c95f,'request\x20sent',JSON['stringify'](_0x5913ba));if(_0x5913ba[_0x2c90('0x11')]){if(_0x5913ba['error']['code']===0x1f4){logger[_0x2c90('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x38c95f,_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);return _0x377ccc(_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);}logger['error'](_0x2c90('0xf'),_0x38c95f,_0x5913ba[_0x2c90('0x11')][_0x2c90('0x12')]);return _0x52c707(_0x5913ba['error'][_0x2c90('0x12')]);}else{logger[_0x2c90('0xe')](_0x2c90('0xf'),_0x38c95f,_0x2c90('0x10'));_0x52c707(_0x5913ba[_0x2c90('0x13')][_0x2c90('0x12')]);}})['catch'](function(_0xaa377a){logger[_0x2c90('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x38c95f,_0xaa377a);_0x377ccc(_0xaa377a);});});} \ No newline at end of file +var _0x3246=['FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x56f568,_0x2e432b){var _0x533072=function(_0x5620d1){while(--_0x5620d1){_0x56f568['push'](_0x56f568['shift']());}};_0x533072(++_0x2e432b);}(_0x3246,0x107));var _0x6324=function(_0x4ba878,_0x28102f){_0x4ba878=_0x4ba878-0x0;var _0xa12367=_0x3246[_0x4ba878];return _0xa12367;};'use strict';var _=require(_0x6324('0x0'));var util=require(_0x6324('0x1'));var moment=require(_0x6324('0x2'));var BPromise=require(_0x6324('0x3'));var rs=require(_0x6324('0x4'));var fs=require('fs');var Redis=require(_0x6324('0x5'));var db=require(_0x6324('0x6'))['db'];var utils=require(_0x6324('0x7'));var logger=require('../../config/logger')(_0x6324('0x8'));var config=require(_0x6324('0x9'));var jayson=require(_0x6324('0xa'));var client=jayson[_0x6324('0xb')][_0x6324('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c0cb3,_0x37e9ac,_0x45e5c7){return new BPromise(function(_0x2aabbd,_0x1b04ac){return client['request'](_0x4c0cb3,_0x45e5c7)['then'](function(_0x329c9f){logger['info'](_0x6324('0xd'),_0x37e9ac,'request\x20sent');logger['debug'](_0x6324('0xe'),_0x37e9ac,_0x6324('0xf'),JSON[_0x6324('0x10')](_0x329c9f));if(_0x329c9f[_0x6324('0x11')]){if(_0x329c9f['error'][_0x6324('0x12')]===0x1f4){logger[_0x6324('0x11')](_0x6324('0xd'),_0x37e9ac,_0x329c9f[_0x6324('0x11')][_0x6324('0x13')]);return _0x1b04ac(_0x329c9f[_0x6324('0x11')]['message']);}logger['error'](_0x6324('0xd'),_0x37e9ac,_0x329c9f['error'][_0x6324('0x13')]);return _0x2aabbd(_0x329c9f[_0x6324('0x11')][_0x6324('0x13')]);}else{logger[_0x6324('0x14')](_0x6324('0xd'),_0x37e9ac,_0x6324('0xf'));_0x2aabbd(_0x329c9f[_0x6324('0x15')][_0x6324('0x13')]);}})[_0x6324('0x16')](function(_0x5c005b){logger[_0x6324('0x11')](_0x6324('0xd'),_0x37e9ac,_0x5c005b);_0x1b04ac(_0x5c005b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 941b7e1..22b6ae3 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 _0xb9f8=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x17da62,_0x4ad6c1){var _0x2e7612=function(_0x373bf2){while(--_0x373bf2){_0x17da62['push'](_0x17da62['shift']());}};_0x2e7612(++_0x4ad6c1);}(_0xb9f8,0x16e));var _0x8b9f=function(_0x15662c,_0x579549){_0x15662c=_0x15662c-0x0;var _0x169164=_0xb9f8[_0x15662c];return _0x169164;};'use strict';var multer=require(_0x8b9f('0x0'));var util=require(_0x8b9f('0x1'));var path=require(_0x8b9f('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b9f('0x3'));var router=express[_0x8b9f('0x4')]();var fs_extra=require(_0x8b9f('0x5'));var auth=require(_0x8b9f('0x6'));var interaction=require(_0x8b9f('0x7'));var config=require(_0x8b9f('0x8'));var controller=require(_0x8b9f('0x9'));router[_0x8b9f('0xa')]('/',auth[_0x8b9f('0xb')](),controller[_0x8b9f('0xc')]);router[_0x8b9f('0xa')](_0x8b9f('0xd'),auth['isAuthenticated'](),controller[_0x8b9f('0xe')]);router[_0x8b9f('0xa')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x10')]);router[_0x8b9f('0x11')]('/',auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x12')]);router[_0x8b9f('0x13')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x14')]);router[_0x8b9f('0x15')](_0x8b9f('0xf'),auth[_0x8b9f('0xb')](),controller[_0x8b9f('0x16')]);module[_0x8b9f('0x17')]=router; \ No newline at end of file +var _0x550b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','update','delete','exports'];(function(_0x4aa821,_0x1227cd){var _0x45c5b4=function(_0x1b570b){while(--_0x1b570b){_0x4aa821['push'](_0x4aa821['shift']());}};_0x45c5b4(++_0x1227cd);}(_0x550b,0x17c));var _0xb550=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x550b[_0x5416db];return _0x243e35;};'use strict';var multer=require(_0xb550('0x0'));var util=require(_0xb550('0x1'));var path=require(_0xb550('0x2'));var timeout=require('connect-timeout');var express=require(_0xb550('0x3'));var router=express[_0xb550('0x4')]();var fs_extra=require(_0xb550('0x5'));var auth=require(_0xb550('0x6'));var interaction=require(_0xb550('0x7'));var config=require('../../config/environment');var controller=require(_0xb550('0x8'));router[_0xb550('0x9')]('/',auth[_0xb550('0xa')](),controller[_0xb550('0xb')]);router[_0xb550('0x9')]('/describe',auth[_0xb550('0xa')](),controller[_0xb550('0xc')]);router[_0xb550('0x9')](_0xb550('0xd'),auth[_0xb550('0xa')](),controller[_0xb550('0xe')]);router['post']('/',auth[_0xb550('0xa')](),controller[_0xb550('0xf')]);router['put'](_0xb550('0xd'),auth[_0xb550('0xa')](),controller[_0xb550('0x10')]);router[_0xb550('0x11')](_0xb550('0xd'),auth[_0xb550('0xa')](),controller['destroy']);module[_0xb550('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8642d28..e2f1277 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 _0x92d7=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x92d7,0xb3));var _0x792d=function(_0x21b012,_0x57f37a){_0x21b012=_0x21b012-0x0;var _0x253fb9=_0x92d7[_0x21b012];return _0x253fb9;};'use strict';var multer=require(_0x792d('0x0'));var util=require(_0x792d('0x1'));var path=require(_0x792d('0x2'));var timeout=require(_0x792d('0x3'));var express=require(_0x792d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x792d('0x5'));var interaction=require(_0x792d('0x6'));var config=require(_0x792d('0x7'));var controller=require('./intDeskAccount.controller');router[_0x792d('0x8')]('/',auth['isAuthenticated'](),controller[_0x792d('0x9')]);router['get'](_0x792d('0xa'),auth[_0x792d('0xb')](),controller[_0x792d('0xc')]);router[_0x792d('0x8')](_0x792d('0xd'),auth[_0x792d('0xb')](),controller[_0x792d('0xe')]);router[_0x792d('0x8')](_0x792d('0xf'),auth[_0x792d('0xb')](),controller[_0x792d('0x10')]);router[_0x792d('0x11')]('/',auth[_0x792d('0xb')](),controller[_0x792d('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x792d('0x13')]);router['put']('/:id',auth[_0x792d('0xb')](),controller[_0x792d('0x14')]);router[_0x792d('0x15')]('/:id',auth[_0x792d('0xb')](),controller[_0x792d('0x16')]);module[_0x792d('0x17')]=router; \ No newline at end of file +var _0xa7ef=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xa7ef,0x16a));var _0xfa7e=function(_0x306b4b,_0x20d2d8){_0x306b4b=_0x306b4b-0x0;var _0x4aaa49=_0xa7ef[_0x306b4b];return _0x4aaa49;};'use strict';var multer=require(_0xfa7e('0x0'));var util=require(_0xfa7e('0x1'));var path=require(_0xfa7e('0x2'));var timeout=require(_0xfa7e('0x3'));var express=require(_0xfa7e('0x4'));var router=express[_0xfa7e('0x5')]();var fs_extra=require(_0xfa7e('0x6'));var auth=require(_0xfa7e('0x7'));var interaction=require(_0xfa7e('0x8'));var config=require(_0xfa7e('0x9'));var controller=require(_0xfa7e('0xa'));router[_0xfa7e('0xb')]('/',auth[_0xfa7e('0xc')](),controller['index']);router[_0xfa7e('0xb')](_0xfa7e('0xd'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0xe')]);router[_0xfa7e('0xb')](_0xfa7e('0xf'),auth[_0xfa7e('0xc')](),controller['getConfigurations']);router[_0xfa7e('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xfa7e('0x10')]);router[_0xfa7e('0x11')]('/',auth['isAuthenticated'](),controller[_0xfa7e('0x12')]);router[_0xfa7e('0x11')](_0xfa7e('0xf'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x13')]);router[_0xfa7e('0x14')](_0xfa7e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfa7e('0x15')](_0xfa7e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa7e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 4b14ff8..bbc5753 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 _0x5420=['integrationTab','newTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x5420,0x16e));var _0x0542=function(_0x435b2b,_0x2ae02c){_0x435b2b=_0x435b2b-0x0;var _0x4b88f6=_0x5420[_0x435b2b];return _0x4b88f6;};'use strict';var Sequelize=require(_0x0542('0x0'));module[_0x0542('0x1')]={'name':{'type':Sequelize[_0x0542('0x2')]},'description':{'type':Sequelize[_0x0542('0x2')]},'username':{'type':Sequelize[_0x0542('0x2')]},'remoteUri':{'type':Sequelize[_0x0542('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x0542('0x3')),'defaultValue':_0x0542('0x3')},'password':{'type':Sequelize[_0x0542('0x2')]},'consumerKey':{'type':Sequelize[_0x0542('0x2')]},'consumerSecret':{'type':Sequelize[_0x0542('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x0542('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0542('0x4')](_0x0542('0x5'),_0x0542('0x6')),'defaultValue':_0x0542('0x5')}}; \ No newline at end of file +var _0x1caf=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0x1caf,0x1e7));var _0xf1ca=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1caf[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0xf1ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xf1ca('0x1')]},'description':{'type':Sequelize[_0xf1ca('0x1')]},'username':{'type':Sequelize[_0xf1ca('0x1')]},'remoteUri':{'type':Sequelize[_0xf1ca('0x1')]},'authType':{'type':Sequelize[_0xf1ca('0x2')](_0xf1ca('0x3')),'defaultValue':_0xf1ca('0x3')},'password':{'type':Sequelize[_0xf1ca('0x1')]},'consumerKey':{'type':Sequelize[_0xf1ca('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf1ca('0x1')]},'tokenSecret':{'type':Sequelize[_0xf1ca('0x1')]},'serverUrl':{'type':Sequelize[_0xf1ca('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf1ca('0x2')](_0xf1ca('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index cd47c4c..c1e5fe7 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 _0x48d3=['send','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','find','create','body','update','params','destroy','getConfigurations','findOne','DeskConfiguration','sort','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','error','name'];(function(_0x302ab3,_0x21ab7b){var _0x12c0ca=function(_0x91ebf6){while(--_0x91ebf6){_0x302ab3['push'](_0x302ab3['shift']());}};_0x12c0ca(++_0x21ab7b);}(_0x48d3,0x19d));var _0x348d=function(_0x40d3cf,_0x2e0df6){_0x40d3cf=_0x40d3cf-0x0;var _0x3a9e12=_0x48d3[_0x40d3cf];return _0x3a9e12;};'use strict';var emlformat=require(_0x348d('0x0'));var rimraf=require(_0x348d('0x1'));var zipdir=require(_0x348d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x348d('0x3'));var moment=require(_0x348d('0x4'));var BPromise=require(_0x348d('0x5'));var Mustache=require('mustache');var util=require(_0x348d('0x6'));var path=require(_0x348d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x348d('0x8'));var _=require(_0x348d('0x9'));var squel=require(_0x348d('0xa'));var crypto=require(_0x348d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x348d('0xc'));var toCsv=require(_0x348d('0xd'));var querystring=require('querystring');var Papa=require(_0x348d('0xe'));var Redis=require(_0x348d('0xf'));var authService=require(_0x348d('0x10'));var qs=require(_0x348d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x348d('0x12'))(_0x348d('0x13'));var utils=require(_0x348d('0x14'));var config=require(_0x348d('0x15'));var licenseUtil=require(_0x348d('0x16'));var db=require(_0x348d('0x17'))['db'];var integrations=require(_0x348d('0x18'));function respondWithStatusCode(_0x1450db,_0x2dbafd){_0x2dbafd=_0x2dbafd||0xcc;return function(_0x30f942){if(_0x30f942){return _0x1450db[_0x348d('0x19')](_0x2dbafd);}return _0x1450db['status'](_0x2dbafd)[_0x348d('0x1a')]();};}function respondWithResult(_0x3eebf5,_0x1bc1ab){_0x1bc1ab=_0x1bc1ab||0xc8;return function(_0x1f380a){if(_0x1f380a){return _0x3eebf5[_0x348d('0x1b')](_0x1bc1ab)[_0x348d('0x1c')](_0x1f380a);}};}function respondWithFilteredResult(_0x31a176,_0x580efb){return function(_0x4c4fea){if(_0x4c4fea){var _0x2285a1=typeof _0x580efb[_0x348d('0x1d')]===_0x348d('0x1e')&&typeof _0x580efb[_0x348d('0x1f')]===_0x348d('0x1e');var _0x3c86d1=_0x4c4fea[_0x348d('0x20')];var _0x2ad401=_0x2285a1?0x0:_0x580efb[_0x348d('0x1d')];var _0x551738=_0x2285a1?_0x4c4fea[_0x348d('0x20')]:_0x580efb[_0x348d('0x1d')]+_0x580efb[_0x348d('0x1f')];var _0x259a43;if(_0x551738>=_0x3c86d1){_0x551738=_0x3c86d1;_0x259a43=0xc8;}else{_0x259a43=0xce;}_0x31a176[_0x348d('0x1b')](_0x259a43);return _0x31a176[_0x348d('0x21')]('Content-Range',_0x2ad401+'-'+_0x551738+'/'+_0x3c86d1)[_0x348d('0x1c')](_0x4c4fea);}return null;};}function patchUpdates(_0x1b04cd){return function(_0x414d19){try{jsonpatch['apply'](_0x414d19,_0x1b04cd,!![]);}catch(_0x3abdf3){return BPromise[_0x348d('0x22')](_0x3abdf3);}return _0x414d19[_0x348d('0x23')]();};}function saveUpdates(_0x48cac2,_0x29aad4){return function(_0x5a3137){if(_0x5a3137){return _0x5a3137['update'](_0x48cac2)[_0x348d('0x24')](function(_0x59b044){return _0x59b044;});}return null;};}function removeEntity(_0xb363,_0x1df30d){return function(_0x3be666){if(_0x3be666){return _0x3be666['destroy']()[_0x348d('0x24')](function(){_0xb363[_0x348d('0x1b')](0xcc)[_0x348d('0x1a')]();});}};}function handleEntityNotFound(_0x852157,_0x252c90){return function(_0x174560){if(!_0x174560){_0x852157[_0x348d('0x19')](0x194);}return _0x174560;};}function handleError(_0x4bca08,_0x15e6dd){_0x15e6dd=_0x15e6dd||0x1f4;return function(_0x18d9d4){logger[_0x348d('0x25')](_0x18d9d4['stack']);if(_0x18d9d4[_0x348d('0x26')]){delete _0x18d9d4[_0x348d('0x26')];}_0x4bca08['status'](_0x15e6dd)[_0x348d('0x27')](_0x18d9d4);};}exports['index']=function(_0x1f473f,_0x2b9969){var _0x3a2fec={},_0x48cc43={},_0x6f861={'count':0x0,'rows':[]};var _0x1fe77b=_['map'](db[_0x348d('0x28')][_0x348d('0x29')],function(_0x51ab9e){return{'name':_0x51ab9e[_0x348d('0x2a')],'type':_0x51ab9e[_0x348d('0x2b')][_0x348d('0x2c')]};});_0x48cc43[_0x348d('0x2d')]=_[_0x348d('0x2e')](_0x1fe77b,_0x348d('0x26'));_0x48cc43[_0x348d('0x2f')]=_[_0x348d('0x30')](_0x1f473f[_0x348d('0x2f')]);_0x48cc43['filters']=_[_0x348d('0x31')](_0x48cc43['model'],_0x48cc43[_0x348d('0x2f')]);_0x3a2fec[_0x348d('0x32')]=_[_0x348d('0x31')](_0x48cc43['model'],qs[_0x348d('0x33')](_0x1f473f['query'][_0x348d('0x33')]));_0x3a2fec[_0x348d('0x32')]=_0x3a2fec[_0x348d('0x32')][_0x348d('0x34')]?_0x3a2fec[_0x348d('0x32')]:_0x48cc43[_0x348d('0x2d')];if(!_0x1f473f['query'][_0x348d('0x35')](_0x348d('0x36'))){_0x3a2fec[_0x348d('0x1f')]=qs['limit'](_0x1f473f[_0x348d('0x2f')][_0x348d('0x1f')]);_0x3a2fec[_0x348d('0x1d')]=qs['offset'](_0x1f473f[_0x348d('0x2f')][_0x348d('0x1d')]);}_0x3a2fec[_0x348d('0x37')]=qs['sort'](_0x1f473f['query']['sort']);_0x3a2fec[_0x348d('0x38')]=qs[_0x348d('0x39')](_['pick'](_0x1f473f[_0x348d('0x2f')],_0x48cc43['filters']),_0x1fe77b);if(_0x1f473f[_0x348d('0x2f')][_0x348d('0x3a')]){_0x3a2fec[_0x348d('0x38')]=_[_0x348d('0x3b')](_0x3a2fec[_0x348d('0x38')],{'$or':_[_0x348d('0x2e')](_0x1fe77b,function(_0x10adf2){if(_0x10adf2['type']!==_0x348d('0x3c')){var _0x598c0f={};_0x598c0f[_0x10adf2[_0x348d('0x26')]]={'$like':'%'+_0x1f473f[_0x348d('0x2f')][_0x348d('0x3a')]+'%'};return _0x598c0f;}})});}_0x3a2fec=_[_0x348d('0x3b')]({},_0x3a2fec,_0x1f473f[_0x348d('0x3d')]);var _0x2e4a42={'where':_0x3a2fec[_0x348d('0x38')]};return db[_0x348d('0x28')][_0x348d('0x20')](_0x2e4a42)['then'](function(_0x7b935d){_0x6f861[_0x348d('0x20')]=_0x7b935d;if(_0x1f473f[_0x348d('0x2f')]['includeAll']){_0x3a2fec[_0x348d('0x3e')]=[{'all':!![]}];}return db[_0x348d('0x28')]['findAll'](_0x3a2fec);})[_0x348d('0x24')](function(_0x208914){_0x6f861[_0x348d('0x3f')]=_0x208914;return _0x6f861;})[_0x348d('0x24')](respondWithFilteredResult(_0x2b9969,_0x3a2fec))[_0x348d('0x40')](handleError(_0x2b9969,null));};exports['show']=function(_0x4fab4f,_0x528558){var _0x541e57={'raw':![],'where':{'id':_0x4fab4f['params']['id']}},_0x3ea66d={};_0x3ea66d[_0x348d('0x2d')]=_[_0x348d('0x30')](db[_0x348d('0x28')][_0x348d('0x29')]);_0x3ea66d[_0x348d('0x2f')]=_[_0x348d('0x30')](_0x4fab4f[_0x348d('0x2f')]);_0x3ea66d[_0x348d('0x39')]=_[_0x348d('0x31')](_0x3ea66d[_0x348d('0x2d')],_0x3ea66d[_0x348d('0x2f')]);_0x541e57[_0x348d('0x32')]=_[_0x348d('0x31')](_0x3ea66d[_0x348d('0x2d')],qs[_0x348d('0x33')](_0x4fab4f['query'][_0x348d('0x33')]));_0x541e57[_0x348d('0x32')]=_0x541e57[_0x348d('0x32')]['length']?_0x541e57['attributes']:_0x3ea66d['model'];if(_0x4fab4f[_0x348d('0x2f')]['includeAll']){_0x541e57['include']=[{'all':!![]}];}_0x541e57=_[_0x348d('0x3b')]({},_0x541e57,_0x4fab4f['options']);return db[_0x348d('0x28')][_0x348d('0x41')](_0x541e57)['then'](handleEntityNotFound(_0x528558,null))[_0x348d('0x24')](respondWithResult(_0x528558,null))[_0x348d('0x40')](handleError(_0x528558,null));};exports['create']=function(_0x38aca4,_0x4d369a){return db[_0x348d('0x28')][_0x348d('0x42')](_0x38aca4[_0x348d('0x43')],{})[_0x348d('0x24')](respondWithResult(_0x4d369a,0xc9))[_0x348d('0x40')](handleError(_0x4d369a,null));};exports[_0x348d('0x44')]=function(_0x5c4573,_0x95ef7b){if(_0x5c4573[_0x348d('0x43')]['id']){delete _0x5c4573[_0x348d('0x43')]['id'];}return db[_0x348d('0x28')][_0x348d('0x41')]({'where':{'id':_0x5c4573[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x95ef7b,null))[_0x348d('0x24')](saveUpdates(_0x5c4573['body'],null))['then'](respondWithResult(_0x95ef7b,null))[_0x348d('0x40')](handleError(_0x95ef7b,null));};exports[_0x348d('0x46')]=function(_0x2df497,_0x1bb413){return db['DeskAccount']['find']({'where':{'id':_0x2df497[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x1bb413,null))[_0x348d('0x24')](removeEntity(_0x1bb413,null))['catch'](handleError(_0x1bb413,null));};exports[_0x348d('0x47')]=function(_0xb2d026,_0x4d7559,_0x4f6d35){var _0x23f768={};var _0x5397ea={};var _0x3364c8;var _0x33ebd9;return db[_0x348d('0x28')][_0x348d('0x48')]({'where':{'id':_0xb2d026[_0x348d('0x45')]['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x4d7559,null))[_0x348d('0x24')](function(_0x33ba43){if(_0x33ba43){_0x3364c8=_0x33ba43;_0x5397ea['model']=_['keys'](db[_0x348d('0x49')]['rawAttributes']);_0x5397ea[_0x348d('0x2f')]=_['keys'](_0xb2d026[_0x348d('0x2f')]);_0x5397ea[_0x348d('0x39')]=_[_0x348d('0x31')](_0x5397ea[_0x348d('0x2d')],_0x5397ea['query']);_0x23f768['attributes']=_[_0x348d('0x31')](_0x5397ea[_0x348d('0x2d')],qs[_0x348d('0x33')](_0xb2d026[_0x348d('0x2f')][_0x348d('0x33')]));_0x23f768[_0x348d('0x32')]=_0x23f768['attributes'][_0x348d('0x34')]?_0x23f768[_0x348d('0x32')]:_0x5397ea['model'];_0x23f768['order']=qs[_0x348d('0x4a')](_0xb2d026[_0x348d('0x2f')][_0x348d('0x4a')]);_0x23f768[_0x348d('0x38')]=qs['filters'](_[_0x348d('0x4b')](_0xb2d026[_0x348d('0x2f')],_0x5397ea[_0x348d('0x39')]));if(_0xb2d026[_0x348d('0x2f')][_0x348d('0x3a')]){_0x23f768['where']=_['merge'](_0x23f768[_0x348d('0x38')],{'$or':_['map'](_0x23f768[_0x348d('0x32')],function(_0xbfd278){var _0x25f1bd={};_0x25f1bd[_0xbfd278]={'$like':'%'+_0xb2d026[_0x348d('0x2f')][_0x348d('0x3a')]+'%'};return _0x25f1bd;})});}_0x23f768=_[_0x348d('0x3b')]({},_0x23f768,_0xb2d026[_0x348d('0x3d')]);return _0x3364c8[_0x348d('0x47')](_0x23f768);}})[_0x348d('0x24')](function(_0x3f589b){if(_0x3f589b){_0x33ebd9=_0x3f589b[_0x348d('0x34')];if(!_0xb2d026[_0x348d('0x2f')][_0x348d('0x35')](_0x348d('0x36'))){_0x23f768['limit']=qs[_0x348d('0x1f')](_0xb2d026[_0x348d('0x2f')]['limit']);_0x23f768[_0x348d('0x1d')]=qs[_0x348d('0x1d')](_0xb2d026['query'][_0x348d('0x1d')]);}return _0x3364c8['getConfigurations'](_0x23f768);}})[_0x348d('0x24')](function(_0x114188){if(_0x114188){return _0x114188?{'count':_0x33ebd9,'rows':_0x114188}:null;}})[_0x348d('0x24')](respondWithResult(_0x4d7559,null))[_0x348d('0x40')](handleError(_0x4d7559,null));};exports[_0x348d('0x4c')]=function(_0x40be60,_0x297d00,_0x738105){if(_0x40be60[_0x348d('0x43')]['id']){delete _0x40be60[_0x348d('0x43')]['id'];}return db['DeskAccount'][_0x348d('0x48')]({'where':{'id':_0x40be60['params']['id']}})[_0x348d('0x24')](handleEntityNotFound(_0x297d00,null))['then'](function(_0x4a74b5){if(_0x4a74b5){_0x40be60[_0x348d('0x43')][_0x348d('0x4d')]=_0x4a74b5['id'];_0x40be60[_0x348d('0x43')][_0x348d('0x4e')]=integrations[_0x348d('0x4f')](_0x40be60['body'][_0x348d('0x50')],_0x40be60['body']['type']);_0x40be60[_0x348d('0x43')][_0x348d('0x51')]=integrations[_0x348d('0x52')](_0x40be60[_0x348d('0x43')][_0x348d('0x50')],_0x40be60['body'][_0x348d('0x2b')]);return db['DeskConfiguration'][_0x348d('0x42')](_0x40be60[_0x348d('0x43')],{'include':[{'model':db[_0x348d('0x53')],'as':_0x348d('0x4e')},{'model':db[_0x348d('0x53')],'as':_0x348d('0x51')}]});}return null;})[_0x348d('0x24')](respondWithResult(_0x297d00,null))[_0x348d('0x40')](handleError(_0x297d00,null));};exports[_0x348d('0x54')]=function(_0x2472d6,_0x43c495,_0x43187a){var _0xe346bb=[{'name':'priority','label':_0x348d('0x55'),'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 _0x5389ba='';return db[_0x348d('0x28')]['findOne']({'where':{'id':_0x2472d6['params']['id']},'attributes':['id',_0x348d('0x56'),_0x348d('0x57'),_0x348d('0x58'),_0x348d('0x59'),_0x348d('0x5a'),_0x348d('0x5b'),_0x348d('0x5c'),_0x348d('0x5d')]})['then'](handleEntityNotFound(_0x43c495,null))[_0x348d('0x24')](function(_0x25b167){if(_0x25b167){_0x5389ba=_0x25b167[_0x348d('0x56')];var _0x134190=_0x5389ba['slice'](-0x1);if(_0x134190==='/'){_0x5389ba=_0x5389ba[_0x348d('0x5e')](0x0,_0x5389ba[_0x348d('0x5f')](_0x134190));}var _0x294271={'method':_0x348d('0x60'),'uri':util[_0x348d('0x61')]('%s/custom_fields',_0x5389ba),'headers':{'Content-Type':'application/json','Accept':_0x348d('0x62')},'json':!![]};if(_0x25b167['authType']===_0x348d('0x63')){_0x294271[_0x348d('0x64')][_0x348d('0x65')]=util['format'](_0x348d('0x66'),new Buffer(util[_0x348d('0x61')](_0x348d('0x67'),_0x25b167[_0x348d('0x58')],_0x25b167['password']))[_0x348d('0x68')](_0x348d('0x69')));}return rp(_0x294271)[_0x348d('0x24')](function(_0x310064){return _0xe346bb['concat'](_[_0x348d('0x2e')](_0x310064['_embedded'][_0x348d('0x6a')],function(_0x1d4a6c){return{'id':_0x1d4a6c[_0x348d('0x26')],'name':_0x1d4a6c['name'],'type':_0x1d4a6c[_0x348d('0x2b')],'active':_0x1d4a6c[_0x348d('0x6b')],'label':_0x1d4a6c[_0x348d('0x6c')],'custom':!![]};}));});}})[_0x348d('0x24')](function(_0x42faf8){return{'count':_0x42faf8[_0x348d('0x34')],'rows':_0x42faf8};})[_0x348d('0x24')](respondWithResult(_0x43c495,null))[_0x348d('0x40')](function(_0x50c69f){var _0x3a8e79=_0x2472d6['query']['test']?0x1f4:_0x50c69f[_0x348d('0x6d')]||0x1f4;logger['error'](_0x348d('0x6e'),'getFields',_0x3a8e79,JSON[_0x348d('0x6f')](_0x50c69f));delete _0x50c69f[_0x348d('0x26')];if(_0x3a8e79===0x191){_0x3a8e79=0x190;}_0x43c495[_0x348d('0x1b')](_0x3a8e79)['send'](_0x2472d6['query']['test']?{'message':_0x348d('0x70'),'statusCode':_0x50c69f['statusCode']}:_0x50c69f);});}; \ No newline at end of file +var _0x2ce3=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations','DeskConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','username','base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x617bee,_0x560e70){var _0x575fcb=function(_0x36cb62){while(--_0x36cb62){_0x617bee['push'](_0x617bee['shift']());}};_0x575fcb(++_0x560e70);}(_0x2ce3,0x1b2));var _0x32ce=function(_0x111624,_0x1c9213){_0x111624=_0x111624-0x0;var _0x4d989c=_0x2ce3[_0x111624];return _0x4d989c;};'use strict';var emlformat=require(_0x32ce('0x0'));var rimraf=require(_0x32ce('0x1'));var zipdir=require(_0x32ce('0x2'));var jsonpatch=require(_0x32ce('0x3'));var rp=require(_0x32ce('0x4'));var moment=require('moment');var BPromise=require(_0x32ce('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32ce('0x6'));var sox=require(_0x32ce('0x7'));var csv=require(_0x32ce('0x8'));var ejs=require(_0x32ce('0x9'));var fs=require('fs');var fs_extra=require(_0x32ce('0xa'));var _=require(_0x32ce('0xb'));var squel=require(_0x32ce('0xc'));var crypto=require(_0x32ce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x32ce('0xe'));var toCsv=require(_0x32ce('0x8'));var querystring=require(_0x32ce('0xf'));var Papa=require(_0x32ce('0x10'));var Redis=require('ioredis');var authService=require(_0x32ce('0x11'));var qs=require(_0x32ce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ce('0x13'));var logger=require(_0x32ce('0x14'))(_0x32ce('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32ce('0x16'));var db=require(_0x32ce('0x17'))['db'];var integrations=require(_0x32ce('0x18'));function respondWithStatusCode(_0x972d94,_0x381b8e){_0x381b8e=_0x381b8e||0xcc;return function(_0x31dd97){if(_0x31dd97){return _0x972d94[_0x32ce('0x19')](_0x381b8e);}return _0x972d94[_0x32ce('0x1a')](_0x381b8e)[_0x32ce('0x1b')]();};}function respondWithResult(_0x1004d0,_0xf4b9e5){_0xf4b9e5=_0xf4b9e5||0xc8;return function(_0x1d4474){if(_0x1d4474){return _0x1004d0['status'](_0xf4b9e5)[_0x32ce('0x1c')](_0x1d4474);}};}function respondWithFilteredResult(_0x11244b,_0x24d18b){return function(_0x16aef0){if(_0x16aef0){var _0x868033=typeof _0x24d18b[_0x32ce('0x1d')]===_0x32ce('0x1e')&&typeof _0x24d18b[_0x32ce('0x1f')]===_0x32ce('0x1e');var _0x1d9e9e=_0x16aef0[_0x32ce('0x20')];var _0x564bc2=_0x868033?0x0:_0x24d18b['offset'];var _0x4e16e4=_0x868033?_0x16aef0[_0x32ce('0x20')]:_0x24d18b[_0x32ce('0x1d')]+_0x24d18b['limit'];var _0x17358c;if(_0x4e16e4>=_0x1d9e9e){_0x4e16e4=_0x1d9e9e;_0x17358c=0xc8;}else{_0x17358c=0xce;}_0x11244b[_0x32ce('0x1a')](_0x17358c);return _0x11244b[_0x32ce('0x21')](_0x32ce('0x22'),_0x564bc2+'-'+_0x4e16e4+'/'+_0x1d9e9e)[_0x32ce('0x1c')](_0x16aef0);}return null;};}function patchUpdates(_0x795738){return function(_0x349a90){try{jsonpatch[_0x32ce('0x23')](_0x349a90,_0x795738,!![]);}catch(_0x5f2858){return BPromise[_0x32ce('0x24')](_0x5f2858);}return _0x349a90[_0x32ce('0x25')]();};}function saveUpdates(_0x4ee429,_0x4ed65d){return function(_0x4b2f50){if(_0x4b2f50){return _0x4b2f50[_0x32ce('0x26')](_0x4ee429)[_0x32ce('0x27')](function(_0xc5116a){return _0xc5116a;});}return null;};}function removeEntity(_0x556033,_0xe69327){return function(_0x1c920a){if(_0x1c920a){return _0x1c920a[_0x32ce('0x28')]()[_0x32ce('0x27')](function(){_0x556033[_0x32ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2065,_0x5ebb96){return function(_0x4cf566){if(!_0x4cf566){_0x2c2065[_0x32ce('0x19')](0x194);}return _0x4cf566;};}function handleError(_0x535479,_0x1d2f14){_0x1d2f14=_0x1d2f14||0x1f4;return function(_0x57667f){logger[_0x32ce('0x29')](_0x57667f[_0x32ce('0x2a')]);if(_0x57667f[_0x32ce('0x2b')]){delete _0x57667f[_0x32ce('0x2b')];}_0x535479[_0x32ce('0x1a')](_0x1d2f14)[_0x32ce('0x2c')](_0x57667f);};}exports[_0x32ce('0x2d')]=function(_0x43dc4b,_0x1c2d31){var _0x453268={},_0x1910fc={},_0x3bdabe={'count':0x0,'rows':[]};var _0x1d792c=_[_0x32ce('0x2e')](db[_0x32ce('0x2f')][_0x32ce('0x30')],function(_0x1b77a3){return{'name':_0x1b77a3[_0x32ce('0x31')],'type':_0x1b77a3[_0x32ce('0x32')][_0x32ce('0x33')]};});_0x1910fc[_0x32ce('0x34')]=_['map'](_0x1d792c,'name');_0x1910fc[_0x32ce('0x35')]=_['keys'](_0x43dc4b[_0x32ce('0x35')]);_0x1910fc[_0x32ce('0x36')]=_[_0x32ce('0x37')](_0x1910fc['model'],_0x1910fc[_0x32ce('0x35')]);_0x453268['attributes']=_['intersection'](_0x1910fc[_0x32ce('0x34')],qs['fields'](_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x38')]));_0x453268[_0x32ce('0x39')]=_0x453268[_0x32ce('0x39')][_0x32ce('0x3a')]?_0x453268[_0x32ce('0x39')]:_0x1910fc[_0x32ce('0x34')];if(!_0x43dc4b['query'][_0x32ce('0x3b')](_0x32ce('0x3c'))){_0x453268['limit']=qs[_0x32ce('0x1f')](_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x1f')]);_0x453268[_0x32ce('0x1d')]=qs[_0x32ce('0x1d')](_0x43dc4b[_0x32ce('0x35')]['offset']);}_0x453268[_0x32ce('0x3d')]=qs[_0x32ce('0x3e')](_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x3e')]);_0x453268[_0x32ce('0x3f')]=qs[_0x32ce('0x36')](_['pick'](_0x43dc4b[_0x32ce('0x35')],_0x1910fc[_0x32ce('0x36')]),_0x1d792c);if(_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x40')]){_0x453268['where']=_[_0x32ce('0x41')](_0x453268[_0x32ce('0x3f')],{'$or':_[_0x32ce('0x2e')](_0x1d792c,function(_0x232a19){if(_0x232a19[_0x32ce('0x32')]!==_0x32ce('0x42')){var _0x2e7e17={};_0x2e7e17[_0x232a19[_0x32ce('0x2b')]]={'$like':'%'+_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x40')]+'%'};return _0x2e7e17;}})});}_0x453268=_[_0x32ce('0x41')]({},_0x453268,_0x43dc4b[_0x32ce('0x43')]);var _0x20a3ba={'where':_0x453268['where']};return db[_0x32ce('0x2f')][_0x32ce('0x20')](_0x20a3ba)[_0x32ce('0x27')](function(_0x1f1c9d){_0x3bdabe[_0x32ce('0x20')]=_0x1f1c9d;if(_0x43dc4b[_0x32ce('0x35')][_0x32ce('0x44')]){_0x453268[_0x32ce('0x45')]=[{'all':!![]}];}return db['DeskAccount'][_0x32ce('0x46')](_0x453268);})[_0x32ce('0x27')](function(_0x3a0151){_0x3bdabe[_0x32ce('0x47')]=_0x3a0151;return _0x3bdabe;})[_0x32ce('0x27')](respondWithFilteredResult(_0x1c2d31,_0x453268))['catch'](handleError(_0x1c2d31,null));};exports[_0x32ce('0x48')]=function(_0x4082e1,_0x4fc704){var _0x220f1b={'raw':![],'where':{'id':_0x4082e1[_0x32ce('0x49')]['id']}},_0x58c334={};_0x58c334[_0x32ce('0x34')]=_['keys'](db[_0x32ce('0x2f')][_0x32ce('0x30')]);_0x58c334[_0x32ce('0x35')]=_[_0x32ce('0x4a')](_0x4082e1[_0x32ce('0x35')]);_0x58c334[_0x32ce('0x36')]=_[_0x32ce('0x37')](_0x58c334['model'],_0x58c334[_0x32ce('0x35')]);_0x220f1b[_0x32ce('0x39')]=_[_0x32ce('0x37')](_0x58c334[_0x32ce('0x34')],qs[_0x32ce('0x38')](_0x4082e1['query'][_0x32ce('0x38')]));_0x220f1b[_0x32ce('0x39')]=_0x220f1b[_0x32ce('0x39')][_0x32ce('0x3a')]?_0x220f1b[_0x32ce('0x39')]:_0x58c334[_0x32ce('0x34')];if(_0x4082e1['query'][_0x32ce('0x44')]){_0x220f1b[_0x32ce('0x45')]=[{'all':!![]}];}_0x220f1b=_[_0x32ce('0x41')]({},_0x220f1b,_0x4082e1['options']);return db[_0x32ce('0x2f')][_0x32ce('0x4b')](_0x220f1b)[_0x32ce('0x27')](handleEntityNotFound(_0x4fc704,null))[_0x32ce('0x27')](respondWithResult(_0x4fc704,null))[_0x32ce('0x4c')](handleError(_0x4fc704,null));};exports[_0x32ce('0x4d')]=function(_0x293dc0,_0x8e732d){return db[_0x32ce('0x2f')][_0x32ce('0x4d')](_0x293dc0[_0x32ce('0x4e')],{})['then'](respondWithResult(_0x8e732d,0xc9))[_0x32ce('0x4c')](handleError(_0x8e732d,null));};exports[_0x32ce('0x26')]=function(_0x550431,_0x5ceaee){if(_0x550431['body']['id']){delete _0x550431['body']['id'];}return db[_0x32ce('0x2f')][_0x32ce('0x4b')]({'where':{'id':_0x550431[_0x32ce('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ceaee,null))[_0x32ce('0x27')](saveUpdates(_0x550431[_0x32ce('0x4e')],null))['then'](respondWithResult(_0x5ceaee,null))['catch'](handleError(_0x5ceaee,null));};exports[_0x32ce('0x28')]=function(_0x88e647,_0x4704df){return db['DeskAccount'][_0x32ce('0x4b')]({'where':{'id':_0x88e647[_0x32ce('0x49')]['id']}})['then'](handleEntityNotFound(_0x4704df,null))[_0x32ce('0x27')](removeEntity(_0x4704df,null))[_0x32ce('0x4c')](handleError(_0x4704df,null));};exports[_0x32ce('0x4f')]=function(_0x53bd13,_0x4bc8c3,_0x583a6b){var _0x446dd2={};var _0x2a0d7b={};var _0x403aa9;var _0x392ca7;return db['DeskAccount']['findOne']({'where':{'id':_0x53bd13['params']['id']}})[_0x32ce('0x27')](handleEntityNotFound(_0x4bc8c3,null))['then'](function(_0x4dcd1c){if(_0x4dcd1c){_0x403aa9=_0x4dcd1c;_0x2a0d7b[_0x32ce('0x34')]=_[_0x32ce('0x4a')](db[_0x32ce('0x50')][_0x32ce('0x30')]);_0x2a0d7b[_0x32ce('0x35')]=_[_0x32ce('0x4a')](_0x53bd13[_0x32ce('0x35')]);_0x2a0d7b[_0x32ce('0x36')]=_['intersection'](_0x2a0d7b[_0x32ce('0x34')],_0x2a0d7b[_0x32ce('0x35')]);_0x446dd2[_0x32ce('0x39')]=_[_0x32ce('0x37')](_0x2a0d7b['model'],qs[_0x32ce('0x38')](_0x53bd13[_0x32ce('0x35')][_0x32ce('0x38')]));_0x446dd2[_0x32ce('0x39')]=_0x446dd2[_0x32ce('0x39')]['length']?_0x446dd2[_0x32ce('0x39')]:_0x2a0d7b[_0x32ce('0x34')];_0x446dd2[_0x32ce('0x3d')]=qs[_0x32ce('0x3e')](_0x53bd13[_0x32ce('0x35')][_0x32ce('0x3e')]);_0x446dd2[_0x32ce('0x3f')]=qs[_0x32ce('0x36')](_[_0x32ce('0x51')](_0x53bd13[_0x32ce('0x35')],_0x2a0d7b[_0x32ce('0x36')]));if(_0x53bd13['query'][_0x32ce('0x40')]){_0x446dd2[_0x32ce('0x3f')]=_[_0x32ce('0x41')](_0x446dd2[_0x32ce('0x3f')],{'$or':_[_0x32ce('0x2e')](_0x446dd2['attributes'],function(_0x4fd53d){var _0x35e52b={};_0x35e52b[_0x4fd53d]={'$like':'%'+_0x53bd13[_0x32ce('0x35')][_0x32ce('0x40')]+'%'};return _0x35e52b;})});}_0x446dd2=_['merge']({},_0x446dd2,_0x53bd13[_0x32ce('0x43')]);return _0x403aa9['getConfigurations'](_0x446dd2);}})[_0x32ce('0x27')](function(_0x1dcef3){if(_0x1dcef3){_0x392ca7=_0x1dcef3[_0x32ce('0x3a')];if(!_0x53bd13[_0x32ce('0x35')][_0x32ce('0x3b')](_0x32ce('0x3c'))){_0x446dd2[_0x32ce('0x1f')]=qs[_0x32ce('0x1f')](_0x53bd13[_0x32ce('0x35')][_0x32ce('0x1f')]);_0x446dd2[_0x32ce('0x1d')]=qs[_0x32ce('0x1d')](_0x53bd13['query']['offset']);}return _0x403aa9['getConfigurations'](_0x446dd2);}})[_0x32ce('0x27')](function(_0x363d42){if(_0x363d42){return _0x363d42?{'count':_0x392ca7,'rows':_0x363d42}:null;}})['then'](respondWithResult(_0x4bc8c3,null))[_0x32ce('0x4c')](handleError(_0x4bc8c3,null));};exports['addConfiguration']=function(_0xdada3d,_0xd215c1,_0xd982e0){if(_0xdada3d[_0x32ce('0x4e')]['id']){delete _0xdada3d[_0x32ce('0x4e')]['id'];}return db[_0x32ce('0x2f')]['findOne']({'where':{'id':_0xdada3d[_0x32ce('0x49')]['id']}})[_0x32ce('0x27')](handleEntityNotFound(_0xd215c1,null))['then'](function(_0x525961){if(_0x525961){_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x52')]=_0x525961['id'];_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x53')]=integrations[_0x32ce('0x54')](_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x55')],_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x32')]);_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x56')]=integrations['getDescriptions'](_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x55')],_0xdada3d[_0x32ce('0x4e')][_0x32ce('0x32')]);return db['DeskConfiguration'][_0x32ce('0x4d')](_0xdada3d['body'],{'include':[{'model':db[_0x32ce('0x57')],'as':_0x32ce('0x53')},{'model':db[_0x32ce('0x57')],'as':_0x32ce('0x56')}]});}return null;})[_0x32ce('0x27')](respondWithResult(_0xd215c1,null))[_0x32ce('0x4c')](handleError(_0xd215c1,null));};exports[_0x32ce('0x58')]=function(_0x7285f1,_0x8f5b6c,_0x380a4e){var _0x27329a=[{'name':'priority','label':_0x32ce('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2e2eab='';return db[_0x32ce('0x2f')][_0x32ce('0x5a')]({'where':{'id':_0x7285f1[_0x32ce('0x49')]['id']},'attributes':['id',_0x32ce('0x5b'),_0x32ce('0x5c'),'username',_0x32ce('0x5d'),_0x32ce('0x5e'),_0x32ce('0x5f'),_0x32ce('0x60'),'tokenSecret']})[_0x32ce('0x27')](handleEntityNotFound(_0x8f5b6c,null))[_0x32ce('0x27')](function(_0x3d3b66){if(_0x3d3b66){_0x2e2eab=_0x3d3b66[_0x32ce('0x5b')];var _0x410f4a=_0x2e2eab['slice'](-0x1);if(_0x410f4a==='/'){_0x2e2eab=_0x2e2eab['substring'](0x0,_0x2e2eab['lastIndexOf'](_0x410f4a));}var _0x50cb14={'method':_0x32ce('0x61'),'uri':util[_0x32ce('0x62')]('%s/custom_fields',_0x2e2eab),'headers':{'Content-Type':_0x32ce('0x63'),'Accept':_0x32ce('0x63')},'json':!![]};if(_0x3d3b66[_0x32ce('0x5c')]===_0x32ce('0x64')){_0x50cb14[_0x32ce('0x65')][_0x32ce('0x66')]=util['format'](_0x32ce('0x67'),new Buffer(util['format']('%s:%s',_0x3d3b66[_0x32ce('0x68')],_0x3d3b66['password']))['toString'](_0x32ce('0x69')));}return rp(_0x50cb14)[_0x32ce('0x27')](function(_0x509840){return _0x27329a[_0x32ce('0x6a')](_[_0x32ce('0x2e')](_0x509840['_embedded'][_0x32ce('0x6b')],function(_0x200757){return{'id':_0x200757[_0x32ce('0x2b')],'name':_0x200757['name'],'type':_0x200757[_0x32ce('0x32')],'active':_0x200757['active'],'label':_0x200757[_0x32ce('0x6c')],'custom':!![]};}));});}})[_0x32ce('0x27')](function(_0xaa45be){return{'count':_0xaa45be[_0x32ce('0x3a')],'rows':_0xaa45be};})[_0x32ce('0x27')](respondWithResult(_0x8f5b6c,null))[_0x32ce('0x4c')](function(_0x14c157){var _0x62191=_0x7285f1['query'][_0x32ce('0x6d')]?0x1f4:_0x14c157[_0x32ce('0x6e')]||0x1f4;logger[_0x32ce('0x29')](_0x32ce('0x6f'),_0x32ce('0x58'),_0x62191,JSON[_0x32ce('0x70')](_0x14c157));delete _0x14c157['name'];if(_0x62191===0x191){_0x62191=0x190;}_0x8f5b6c[_0x32ce('0x1a')](_0x62191)[_0x32ce('0x2c')](_0x7285f1['query'][_0x32ce('0x6d')]?{'message':_0x32ce('0x71'),'statusCode':_0x14c157['statusCode']}:_0x14c157);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 55b6e1f..c4ce830 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 _0xbb3d=['request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','int_desk_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x35e300,_0x5a661b){var _0x34ffa7=function(_0x31b18e){while(--_0x31b18e){_0x35e300['push'](_0x35e300['shift']());}};_0x34ffa7(++_0x5a661b);}(_0xbb3d,0x145));var _0xdbb3=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0xbb3d[_0x2842b4];return _0x2b9521;};'use strict';var _=require('lodash');var util=require(_0xdbb3('0x0'));var logger=require(_0xdbb3('0x1'))(_0xdbb3('0x2'));var moment=require(_0xdbb3('0x3'));var BPromise=require(_0xdbb3('0x4'));var rp=require(_0xdbb3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbb3('0x6'));var config=require(_0xdbb3('0x7'));var attributes=require(_0xdbb3('0x8'));var integrations=require(_0xdbb3('0x9'));module['exports']=function(_0x5c8ed2,_0x5d896b){return _0x5c8ed2['define']('DeskAccount',attributes,{'tableName':_0xdbb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5117=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','DeskAccount','lodash'];(function(_0x8dc073,_0x2d9b24){var _0x24a18f=function(_0x28f2d8){while(--_0x28f2d8){_0x8dc073['push'](_0x8dc073['shift']());}};_0x24a18f(++_0x2d9b24);}(_0x5117,0xef));var _0x7511=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x5117[_0x4429e0];return _0x51a5b3;};'use strict';var _=require(_0x7511('0x0'));var util=require(_0x7511('0x1'));var logger=require('../../config/logger')(_0x7511('0x2'));var moment=require('moment');var BPromise=require(_0x7511('0x3'));var rp=require(_0x7511('0x4'));var fs=require('fs');var path=require(_0x7511('0x5'));var rimraf=require(_0x7511('0x6'));var config=require(_0x7511('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7511('0x8'));module['exports']=function(_0x4b6ccf,_0x19c213){return _0x4b6ccf['define'](_0x7511('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 294560e..95e32a7 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 _0xa244=['attributes','limit','include','map','model','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0x47981e,_0x557751){var _0x5c66bc=function(_0x567911){while(--_0x567911){_0x47981e['push'](_0x47981e['shift']());}};_0x5c66bc(++_0x557751);}(_0xa244,0xfb));var _0x4a24=function(_0x53a7d,_0x3df61f){_0x53a7d=_0x53a7d-0x0;var _0x1f0308=_0xa244[_0x53a7d];return _0x1f0308;};'use strict';var _=require('lodash');var util=require(_0x4a24('0x0'));var moment=require(_0x4a24('0x1'));var BPromise=require(_0x4a24('0x2'));var rs=require(_0x4a24('0x3'));var fs=require('fs');var Redis=require(_0x4a24('0x4'));var db=require(_0x4a24('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a24('0x6'));var config=require(_0x4a24('0x7'));var jayson=require(_0x4a24('0x8'));var client=jayson[_0x4a24('0x9')][_0x4a24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x573a7e,_0x5e2a8d,_0x5708f3){return new BPromise(function(_0x1892ba,_0x4a168a){return client[_0x4a24('0xb')](_0x573a7e,_0x5708f3)[_0x4a24('0xc')](function(_0x5c3428){logger[_0x4a24('0xd')](_0x4a24('0xe'),_0x5e2a8d,'request\x20sent');logger[_0x4a24('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5e2a8d,'request\x20sent',JSON[_0x4a24('0x10')](_0x5c3428));if(_0x5c3428[_0x4a24('0x11')]){if(_0x5c3428[_0x4a24('0x11')][_0x4a24('0x12')]===0x1f4){logger['error'](_0x4a24('0xe'),_0x5e2a8d,_0x5c3428[_0x4a24('0x11')][_0x4a24('0x13')]);return _0x4a168a(_0x5c3428['error'][_0x4a24('0x13')]);}logger[_0x4a24('0x11')](_0x4a24('0xe'),_0x5e2a8d,_0x5c3428['error'][_0x4a24('0x13')]);return _0x1892ba(_0x5c3428[_0x4a24('0x11')]['message']);}else{logger[_0x4a24('0xd')](_0x4a24('0xe'),_0x5e2a8d,_0x4a24('0x14'));_0x1892ba(_0x5c3428[_0x4a24('0x15')][_0x4a24('0x13')]);}})[_0x4a24('0x16')](function(_0x1b0fd3){logger['error'](_0x4a24('0xe'),_0x5e2a8d,_0x1b0fd3);_0x4a168a(_0x1b0fd3);});});}exports[_0x4a24('0x17')]=function(_0x2ddbfc){var _0x3df11c=this;return new Promise(function(_0x115ba2,_0x57a5cc){return db[_0x4a24('0x18')][_0x4a24('0x19')]({'raw':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc['options'][_0x4a24('0x1c')]||null:null,'attributes':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc['options'][_0x4a24('0x1d')]||null:null,'limit':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1e')]||null:null,'include':_0x2ddbfc[_0x4a24('0x1a')]?_0x2ddbfc[_0x4a24('0x1a')][_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x2ddbfc[_0x4a24('0x1a')]['include'],function(_0x310c85){return{'model':db[_0x310c85[_0x4a24('0x21')]],'as':_0x310c85['as'],'attributes':_0x310c85['attributes'],'include':_0x310c85[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x310c85[_0x4a24('0x1f')],function(_0x55ba99){return{'model':db[_0x55ba99[_0x4a24('0x21')]],'as':_0x55ba99['as'],'attributes':_0x55ba99[_0x4a24('0x1d')],'include':_0x55ba99[_0x4a24('0x1f')]?_['map'](_0x55ba99[_0x4a24('0x1f')],function(_0x37446b){return{'model':db[_0x37446b[_0x4a24('0x21')]],'as':_0x37446b['as'],'attributes':_0x37446b[_0x4a24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4a24('0xc')](function(_0x5568de){logger[_0x4a24('0xd')](_0x4a24('0x17'),_0x2ddbfc);logger[_0x4a24('0xf')](_0x4a24('0x17'),_0x2ddbfc,JSON[_0x4a24('0x10')](_0x5568de));_0x115ba2(_0x5568de);})[_0x4a24('0x16')](function(_0x51a0c6){logger['error']('GetDeskAccount',_0x51a0c6[_0x4a24('0x13')],_0x2ddbfc);_0x57a5cc(_0x3df11c[_0x4a24('0x11')](0x1f4,_0x51a0c6[_0x4a24('0x13')]));});});};exports[_0x4a24('0x22')]=function(_0x2f5305){var _0x2405f2=this;return new Promise(function(_0x2b544f,_0x1df1c5){return db[_0x4a24('0x18')]['find']({'raw':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')]['where']||null:null,'attributes':_0x2f5305['options']?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1d')]||null:null,'include':_0x2f5305[_0x4a24('0x1a')]?_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x2f5305[_0x4a24('0x1a')][_0x4a24('0x1f')],function(_0xcec302){return{'model':db[_0xcec302['model']],'as':_0xcec302['as'],'attributes':_0xcec302[_0x4a24('0x1d')],'include':_0xcec302[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0xcec302[_0x4a24('0x1f')],function(_0x10ec10){return{'model':db[_0x10ec10[_0x4a24('0x21')]],'as':_0x10ec10['as'],'attributes':_0x10ec10['attributes'],'include':_0x10ec10[_0x4a24('0x1f')]?_[_0x4a24('0x20')](_0x10ec10['include'],function(_0xdc387c){return{'model':db[_0xdc387c[_0x4a24('0x21')]],'as':_0xdc387c['as'],'attributes':_0xdc387c[_0x4a24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4a24('0xc')](function(_0x2dd1e3){logger['info'](_0x4a24('0x22'),_0x2f5305);logger[_0x4a24('0xf')](_0x4a24('0x22'),_0x2f5305,JSON[_0x4a24('0x10')](_0x2dd1e3));_0x2b544f(_0x2dd1e3);})[_0x4a24('0x16')](function(_0x5c30f4){logger[_0x4a24('0x11')](_0x4a24('0x22'),_0x5c30f4[_0x4a24('0x13')],_0x2f5305);_0x1df1c5(_0x2405f2['error'](0x1f4,_0x5c30f4[_0x4a24('0x13')]));});});}; \ No newline at end of file +var _0x0074=['options','where','attributes','include','map','model','catch','find','raw','ShowDeskAccount','util','moment','randomstring','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','result','GetDeskAccount','DeskAccount','findAll'];(function(_0x18696d,_0x1dde33){var _0x2df19e=function(_0x25397a){while(--_0x25397a){_0x18696d['push'](_0x18696d['shift']());}};_0x2df19e(++_0x1dde33);}(_0x0074,0x12a));var _0x4007=function(_0x58d0f7,_0x26ca91){_0x58d0f7=_0x58d0f7-0x0;var _0x14615c=_0x0074[_0x58d0f7];return _0x14615c;};'use strict';var _=require('lodash');var util=require(_0x4007('0x0'));var moment=require(_0x4007('0x1'));var BPromise=require('bluebird');var rs=require(_0x4007('0x2'));var fs=require('fs');var Redis=require(_0x4007('0x3'));var db=require(_0x4007('0x4'))['db'];var utils=require(_0x4007('0x5'));var logger=require(_0x4007('0x6'))(_0x4007('0x7'));var config=require(_0x4007('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4007('0x9')][_0x4007('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c2496,_0x19766c,_0xfaf3a5){return new BPromise(function(_0x223677,_0x389016){return client[_0x4007('0xb')](_0x2c2496,_0xfaf3a5)[_0x4007('0xc')](function(_0x1b0b99){logger[_0x4007('0xd')](_0x4007('0xe'),_0x19766c,_0x4007('0xf'));logger[_0x4007('0x10')](_0x4007('0x11'),_0x19766c,_0x4007('0xf'),JSON[_0x4007('0x12')](_0x1b0b99));if(_0x1b0b99[_0x4007('0x13')]){if(_0x1b0b99['error'][_0x4007('0x14')]===0x1f4){logger[_0x4007('0x13')](_0x4007('0xe'),_0x19766c,_0x1b0b99[_0x4007('0x13')][_0x4007('0x15')]);return _0x389016(_0x1b0b99['error'][_0x4007('0x15')]);}logger[_0x4007('0x13')](_0x4007('0xe'),_0x19766c,_0x1b0b99[_0x4007('0x13')][_0x4007('0x15')]);return _0x223677(_0x1b0b99[_0x4007('0x13')][_0x4007('0x15')]);}else{logger[_0x4007('0xd')](_0x4007('0xe'),_0x19766c,_0x4007('0xf'));_0x223677(_0x1b0b99[_0x4007('0x16')][_0x4007('0x15')]);}})['catch'](function(_0x5597a0){logger[_0x4007('0x13')]('DeskAccount,\x20%s,\x20%s',_0x19766c,_0x5597a0);_0x389016(_0x5597a0);});});}exports[_0x4007('0x17')]=function(_0xa65798){var _0x2500d2=this;return new Promise(function(_0x1a50bc,_0x5656c7){return db[_0x4007('0x18')][_0x4007('0x19')]({'raw':_0xa65798[_0x4007('0x1a')]?_0xa65798['options']['raw']===undefined?!![]:![]:!![],'where':_0xa65798[_0x4007('0x1a')]?_0xa65798['options'][_0x4007('0x1b')]||null:null,'attributes':_0xa65798[_0x4007('0x1a')]?_0xa65798[_0x4007('0x1a')][_0x4007('0x1c')]||null:null,'limit':_0xa65798[_0x4007('0x1a')]?_0xa65798[_0x4007('0x1a')]['limit']||null:null,'include':_0xa65798['options']?_0xa65798[_0x4007('0x1a')][_0x4007('0x1d')]?_[_0x4007('0x1e')](_0xa65798[_0x4007('0x1a')][_0x4007('0x1d')],function(_0x2bcd30){return{'model':db[_0x2bcd30[_0x4007('0x1f')]],'as':_0x2bcd30['as'],'attributes':_0x2bcd30[_0x4007('0x1c')],'include':_0x2bcd30[_0x4007('0x1d')]?_[_0x4007('0x1e')](_0x2bcd30[_0x4007('0x1d')],function(_0x396a20){return{'model':db[_0x396a20['model']],'as':_0x396a20['as'],'attributes':_0x396a20[_0x4007('0x1c')],'include':_0x396a20['include']?_[_0x4007('0x1e')](_0x396a20[_0x4007('0x1d')],function(_0x497f06){return{'model':db[_0x497f06[_0x4007('0x1f')]],'as':_0x497f06['as'],'attributes':_0x497f06[_0x4007('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4007('0xc')](function(_0x58f3bb){logger['info']('GetDeskAccount',_0xa65798);logger[_0x4007('0x10')]('GetDeskAccount',_0xa65798,JSON['stringify'](_0x58f3bb));_0x1a50bc(_0x58f3bb);})[_0x4007('0x20')](function(_0x38a8fd){logger[_0x4007('0x13')](_0x4007('0x17'),_0x38a8fd[_0x4007('0x15')],_0xa65798);_0x5656c7(_0x2500d2['error'](0x1f4,_0x38a8fd[_0x4007('0x15')]));});});};exports['ShowDeskAccount']=function(_0x4101a4){var _0x157635=this;return new Promise(function(_0x174bf9,_0x20cbff){return db[_0x4007('0x18')][_0x4007('0x21')]({'raw':_0x4101a4['options']?_0x4101a4[_0x4007('0x1a')][_0x4007('0x22')]===undefined?!![]:![]:!![],'where':_0x4101a4[_0x4007('0x1a')]?_0x4101a4['options'][_0x4007('0x1b')]||null:null,'attributes':_0x4101a4[_0x4007('0x1a')]?_0x4101a4[_0x4007('0x1a')][_0x4007('0x1c')]||null:null,'include':_0x4101a4[_0x4007('0x1a')]?_0x4101a4[_0x4007('0x1a')][_0x4007('0x1d')]?_[_0x4007('0x1e')](_0x4101a4[_0x4007('0x1a')][_0x4007('0x1d')],function(_0xe3fd32){return{'model':db[_0xe3fd32['model']],'as':_0xe3fd32['as'],'attributes':_0xe3fd32['attributes'],'include':_0xe3fd32[_0x4007('0x1d')]?_['map'](_0xe3fd32['include'],function(_0x40f0cd){return{'model':db[_0x40f0cd['model']],'as':_0x40f0cd['as'],'attributes':_0x40f0cd[_0x4007('0x1c')],'include':_0x40f0cd[_0x4007('0x1d')]?_['map'](_0x40f0cd[_0x4007('0x1d')],function(_0x2da2f3){return{'model':db[_0x2da2f3[_0x4007('0x1f')]],'as':_0x2da2f3['as'],'attributes':_0x2da2f3[_0x4007('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4007('0xc')](function(_0x3086cd){logger[_0x4007('0xd')](_0x4007('0x23'),_0x4101a4);logger[_0x4007('0x10')](_0x4007('0x23'),_0x4101a4,JSON[_0x4007('0x12')](_0x3086cd));_0x174bf9(_0x3086cd);})['catch'](function(_0x2cbbd9){logger['error']('ShowDeskAccount',_0x2cbbd9[_0x4007('0x15')],_0x4101a4);_0x20cbff(_0x157635[_0x4007('0x13')](0x1f4,_0x2cbbd9[_0x4007('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 00b6dbc..36018ac 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0xca8958,_0x25eed8){var _0x3d7165=function(_0x5dcced){while(--_0x5dcced){_0xca8958['push'](_0xca8958['shift']());}};_0x3d7165(++_0x25eed8);}(_0x55ca,0x126));var _0xa55c=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x55ca[_0x206096];return _0x3f3b50;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x43dc7f,_0x480f26){var _0x6ce92a=function(_0xd51e51){while(--_0xd51e51){_0x43dc7f['push'](_0x43dc7f['shift']());}};_0x6ce92a(++_0x480f26);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7803f39..f279da5 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 _0x6f87=['exports'];(function(_0x27b58e,_0x1401b4){var _0xda59da=function(_0x1e9d61){while(--_0x1e9d61){_0x27b58e['push'](_0x27b58e['shift']());}};_0xda59da(++_0x1401b4);}(_0x6f87,0x1a8));var _0x76f8=function(_0x3b8f99,_0x718933){_0x3b8f99=_0x3b8f99-0x0;var _0x104c8a=_0x6f87[_0x3b8f99];return _0x104c8a;};'use strict';var Sequelize=require('sequelize');module[_0x76f8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ee6=['sequelize','exports'];(function(_0xe48a2c,_0x1cb2a0){var _0x124fc2=function(_0x3cf3de){while(--_0x3cf3de){_0xe48a2c['push'](_0xe48a2c['shift']());}};_0x124fc2(++_0x1cb2a0);}(_0x4ee6,0x138));var _0x64ee=function(_0x451244,_0x5370af){_0x451244=_0x451244-0x0;var _0x56fd98=_0x4ee6[_0x451244];return _0x56fd98;};'use strict';var Sequelize=require(_0x64ee('0x0'));module[_0x64ee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index aaf1bbb..354de6b 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 _0x2eda=['includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','update','params','getFields','DeskField','findOne','getSubjects','getDescriptions','getTags','Tag','map','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','DeskConfiguration','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x35c1db,_0xd75c15){var _0x4173ff=function(_0x5d6901){while(--_0x5d6901){_0x35c1db['push'](_0x35c1db['shift']());}};_0x4173ff(++_0xd75c15);}(_0x2eda,0x10f));var _0xa2ed=function(_0x2204b4,_0x48e285){_0x2204b4=_0x2204b4-0x0;var _0x38e722=_0x2eda[_0x2204b4];return _0x38e722;};'use strict';var emlformat=require(_0xa2ed('0x0'));var rimraf=require(_0xa2ed('0x1'));var zipdir=require(_0xa2ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2ed('0x3'));var moment=require(_0xa2ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa2ed('0x5'));var util=require('util');var path=require(_0xa2ed('0x6'));var sox=require(_0xa2ed('0x7'));var csv=require(_0xa2ed('0x8'));var ejs=require(_0xa2ed('0x9'));var fs=require('fs');var fs_extra=require(_0xa2ed('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ed('0xb'));var jsforce=require(_0xa2ed('0xc'));var deskjs=require(_0xa2ed('0xd'));var toCsv=require(_0xa2ed('0x8'));var querystring=require(_0xa2ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2ed('0xf'));var qs=require(_0xa2ed('0x10'));var as=require(_0xa2ed('0x11'));var hardwareService=require(_0xa2ed('0x12'));var logger=require(_0xa2ed('0x13'))(_0xa2ed('0x14'));var utils=require(_0xa2ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa2ed('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cf763,_0x27fabe){_0x27fabe=_0x27fabe||0xcc;return function(_0x2f3fcd){if(_0x2f3fcd){return _0x9cf763['sendStatus'](_0x27fabe);}return _0x9cf763[_0xa2ed('0x17')](_0x27fabe)[_0xa2ed('0x18')]();};}function respondWithResult(_0x302ab8,_0x39d463){_0x39d463=_0x39d463||0xc8;return function(_0x4ba518){if(_0x4ba518){return _0x302ab8[_0xa2ed('0x17')](_0x39d463)[_0xa2ed('0x19')](_0x4ba518);}};}function respondWithFilteredResult(_0x126055,_0x446951){return function(_0x4fb281){if(_0x4fb281){var _0x3bde49=typeof _0x446951[_0xa2ed('0x1a')]===_0xa2ed('0x1b')&&typeof _0x446951[_0xa2ed('0x1c')]===_0xa2ed('0x1b');var _0x12a1e0=_0x4fb281[_0xa2ed('0x1d')];var _0x1feed2=_0x3bde49?0x0:_0x446951['offset'];var _0x242895=_0x3bde49?_0x4fb281[_0xa2ed('0x1d')]:_0x446951['offset']+_0x446951[_0xa2ed('0x1c')];var _0x2061cc;if(_0x242895>=_0x12a1e0){_0x242895=_0x12a1e0;_0x2061cc=0xc8;}else{_0x2061cc=0xce;}_0x126055['status'](_0x2061cc);return _0x126055[_0xa2ed('0x1e')]('Content-Range',_0x1feed2+'-'+_0x242895+'/'+_0x12a1e0)[_0xa2ed('0x19')](_0x4fb281);}return null;};}function patchUpdates(_0x276422){return function(_0x5a9c9c){try{jsonpatch[_0xa2ed('0x1f')](_0x5a9c9c,_0x276422,!![]);}catch(_0x21a661){return BPromise[_0xa2ed('0x20')](_0x21a661);}return _0x5a9c9c[_0xa2ed('0x21')]();};}function saveUpdates(_0x527568,_0x311bbe){return function(_0x5e48f5){if(_0x5e48f5){return _0x5e48f5['update'](_0x527568)[_0xa2ed('0x22')](function(_0x3a1093){return _0x3a1093;});}return null;};}function removeEntity(_0x21f8f6,_0xa74fe7){return function(_0x513776){if(_0x513776){return _0x513776[_0xa2ed('0x23')]()[_0xa2ed('0x22')](function(){_0x21f8f6[_0xa2ed('0x17')](0xcc)[_0xa2ed('0x18')]();});}};}function handleEntityNotFound(_0x591045,_0x298135){return function(_0x5d4913){if(!_0x5d4913){_0x591045[_0xa2ed('0x24')](0x194);}return _0x5d4913;};}function handleError(_0x29605a,_0x199fb6){_0x199fb6=_0x199fb6||0x1f4;return function(_0x24277b){logger[_0xa2ed('0x25')](_0x24277b['stack']);if(_0x24277b[_0xa2ed('0x26')]){delete _0x24277b[_0xa2ed('0x26')];}_0x29605a[_0xa2ed('0x17')](_0x199fb6)[_0xa2ed('0x27')](_0x24277b);};}exports['index']=function(_0x384c39,_0x5042e3){var _0x1f5b08={},_0x3ea600={},_0x2e68c0={'count':0x0,'rows':[]};var _0x2f9568=_['map'](db[_0xa2ed('0x28')]['rawAttributes'],function(_0x4c8a6c){return{'name':_0x4c8a6c[_0xa2ed('0x29')],'type':_0x4c8a6c[_0xa2ed('0x2a')][_0xa2ed('0x2b')]};});_0x3ea600[_0xa2ed('0x2c')]=_['map'](_0x2f9568,_0xa2ed('0x26'));_0x3ea600[_0xa2ed('0x2d')]=_['keys'](_0x384c39['query']);_0x3ea600['filters']=_['intersection'](_0x3ea600[_0xa2ed('0x2c')],_0x3ea600['query']);_0x1f5b08[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x3ea600[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x384c39['query']['fields']));_0x1f5b08[_0xa2ed('0x2e')]=_0x1f5b08[_0xa2ed('0x2e')][_0xa2ed('0x31')]?_0x1f5b08[_0xa2ed('0x2e')]:_0x3ea600[_0xa2ed('0x2c')];if(!_0x384c39['query'][_0xa2ed('0x32')](_0xa2ed('0x33'))){_0x1f5b08[_0xa2ed('0x1c')]=qs[_0xa2ed('0x1c')](_0x384c39['query'][_0xa2ed('0x1c')]);_0x1f5b08['offset']=qs[_0xa2ed('0x1a')](_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x1a')]);}_0x1f5b08[_0xa2ed('0x34')]=qs['sort'](_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x1f5b08[_0xa2ed('0x36')]=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x384c39[_0xa2ed('0x2d')],_0x3ea600[_0xa2ed('0x37')]),_0x2f9568);if(_0x384c39['query']['filter']){_0x1f5b08['where']=_[_0xa2ed('0x39')](_0x1f5b08[_0xa2ed('0x36')],{'$or':_['map'](_0x2f9568,function(_0x4cc44e){if(_0x4cc44e['type']!==_0xa2ed('0x3a')){var _0x345688={};_0x345688[_0x4cc44e[_0xa2ed('0x26')]]={'$like':'%'+_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x3b')]+'%'};return _0x345688;}})});}_0x1f5b08=_[_0xa2ed('0x39')]({},_0x1f5b08,_0x384c39[_0xa2ed('0x3c')]);var _0x512f26={'where':_0x1f5b08[_0xa2ed('0x36')]};return db[_0xa2ed('0x28')][_0xa2ed('0x1d')](_0x512f26)[_0xa2ed('0x22')](function(_0x2f711f){_0x2e68c0[_0xa2ed('0x1d')]=_0x2f711f;if(_0x384c39[_0xa2ed('0x2d')][_0xa2ed('0x3d')]){_0x1f5b08[_0xa2ed('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xa2ed('0x3f')](_0x1f5b08);})[_0xa2ed('0x22')](function(_0x42e79b){_0x2e68c0['rows']=_0x42e79b;return _0x2e68c0;})[_0xa2ed('0x22')](respondWithFilteredResult(_0x5042e3,_0x1f5b08))[_0xa2ed('0x40')](handleError(_0x5042e3,null));};exports[_0xa2ed('0x41')]=function(_0x184463,_0x57aa28){var _0xb0ad7={'raw':![],'where':{'id':_0x184463['params']['id']}},_0x108477={};_0x108477['model']=_['keys'](db[_0xa2ed('0x28')][_0xa2ed('0x42')]);_0x108477[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x184463[_0xa2ed('0x2d')]);_0x108477[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x108477[_0xa2ed('0x2c')],_0x108477[_0xa2ed('0x2d')]);_0xb0ad7[_0xa2ed('0x2e')]=_['intersection'](_0x108477[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x184463[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0xb0ad7['attributes']=_0xb0ad7['attributes'][_0xa2ed('0x31')]?_0xb0ad7[_0xa2ed('0x2e')]:_0x108477[_0xa2ed('0x2c')];if(_0x184463['query'][_0xa2ed('0x3d')]){_0xb0ad7[_0xa2ed('0x3e')]=[{'all':!![]}];}_0xb0ad7=_[_0xa2ed('0x39')]({},_0xb0ad7,_0x184463['options']);return db[_0xa2ed('0x28')][_0xa2ed('0x44')](_0xb0ad7)[_0xa2ed('0x22')](handleEntityNotFound(_0x57aa28,null))['then'](respondWithResult(_0x57aa28,null))[_0xa2ed('0x40')](handleError(_0x57aa28,null));};exports['create']=function(_0x522292,_0x154f81){return db[_0xa2ed('0x28')][_0xa2ed('0x45')](_0x522292[_0xa2ed('0x46')],{})[_0xa2ed('0x22')](respondWithResult(_0x154f81,0xc9))[_0xa2ed('0x40')](handleError(_0x154f81,null));};exports[_0xa2ed('0x47')]=function(_0x421010,_0x27406b){if(_0x421010[_0xa2ed('0x46')]['id']){delete _0x421010[_0xa2ed('0x46')]['id'];}return db[_0xa2ed('0x28')]['find']({'where':{'id':_0x421010[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x27406b,null))[_0xa2ed('0x22')](saveUpdates(_0x421010[_0xa2ed('0x46')],null))[_0xa2ed('0x22')](respondWithResult(_0x27406b,null))[_0xa2ed('0x40')](handleError(_0x27406b,null));};exports['destroy']=function(_0x56d4c2,_0x4a5898){return db[_0xa2ed('0x28')][_0xa2ed('0x44')]({'where':{'id':_0x56d4c2['params']['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x4a5898,null))[_0xa2ed('0x22')](removeEntity(_0x4a5898,null))['catch'](handleError(_0x4a5898,null));};exports[_0xa2ed('0x49')]=function(_0x555175,_0x6446b1,_0x202ee2){var _0x5a9dd5={};var _0xa7e6e8={};var _0xdeb00b;var _0x6477ed;return db['DeskConfiguration']['findOne']({'where':{'id':_0x555175[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x6446b1,null))[_0xa2ed('0x22')](function(_0x46c4a2){if(_0x46c4a2){_0xdeb00b=_0x46c4a2;_0xa7e6e8[_0xa2ed('0x2c')]=_['keys'](db[_0xa2ed('0x4a')]['rawAttributes']);_0xa7e6e8[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x555175[_0xa2ed('0x2d')]);_0xa7e6e8[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0xa7e6e8[_0xa2ed('0x2c')],_0xa7e6e8['query']);_0x5a9dd5['attributes']=_['intersection'](_0xa7e6e8[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x555175[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x5a9dd5[_0xa2ed('0x2e')]=_0x5a9dd5[_0xa2ed('0x2e')][_0xa2ed('0x31')]?_0x5a9dd5['attributes']:_0xa7e6e8[_0xa2ed('0x2c')];_0x5a9dd5[_0xa2ed('0x34')]=qs[_0xa2ed('0x35')](_0x555175[_0xa2ed('0x2d')]['sort']);_0x5a9dd5[_0xa2ed('0x36')]=qs['filters'](_['pick'](_0x555175[_0xa2ed('0x2d')],_0xa7e6e8[_0xa2ed('0x37')]));if(_0x555175['query'][_0xa2ed('0x3b')]){_0x5a9dd5[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x5a9dd5[_0xa2ed('0x36')],{'$or':_['map'](_0x5a9dd5[_0xa2ed('0x2e')],function(_0x575111){var _0x3c5e55={};_0x3c5e55[_0x575111]={'$like':'%'+_0x555175[_0xa2ed('0x2d')]['filter']+'%'};return _0x3c5e55;})});}_0x5a9dd5=_[_0xa2ed('0x39')]({},_0x5a9dd5,_0x555175[_0xa2ed('0x3c')]);return _0xdeb00b[_0xa2ed('0x49')](_0x5a9dd5);}})['then'](function(_0x179811){if(_0x179811){_0x6477ed=_0x179811[_0xa2ed('0x31')];if(!_0x555175['query'][_0xa2ed('0x32')]('nolimit')){_0x5a9dd5[_0xa2ed('0x1c')]=qs['limit'](_0x555175[_0xa2ed('0x2d')][_0xa2ed('0x1c')]);_0x5a9dd5[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x555175['query'][_0xa2ed('0x1a')]);}return _0xdeb00b[_0xa2ed('0x49')](_0x5a9dd5);}})[_0xa2ed('0x22')](function(_0x120818){if(_0x120818){return _0x120818?{'count':_0x6477ed,'rows':_0x120818}:null;}})['then'](respondWithResult(_0x6446b1,null))['catch'](handleError(_0x6446b1,null));};exports['getSubjects']=function(_0x4bf260,_0x2e6018,_0x495b74){var _0x41537a={};var _0x1addbf={};var _0x56e60e;var _0xc2e3cf;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x4bf260[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x2e6018,null))[_0xa2ed('0x22')](function(_0x198ba0){if(_0x198ba0){_0x56e60e=_0x198ba0;_0x1addbf['model']=_['keys'](db[_0xa2ed('0x4a')]['rawAttributes']);_0x1addbf[_0xa2ed('0x2d')]=_['keys'](_0x4bf260[_0xa2ed('0x2d')]);_0x1addbf[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x1addbf[_0xa2ed('0x2c')],_0x1addbf[_0xa2ed('0x2d')]);_0x41537a[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x1addbf[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x41537a[_0xa2ed('0x2e')]=_0x41537a['attributes'][_0xa2ed('0x31')]?_0x41537a['attributes']:_0x1addbf['model'];_0x41537a[_0xa2ed('0x34')]=qs[_0xa2ed('0x35')](_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x41537a['where']=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x4bf260[_0xa2ed('0x2d')],_0x1addbf[_0xa2ed('0x37')]));if(_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x3b')]){_0x41537a[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x41537a[_0xa2ed('0x36')],{'$or':_['map'](_0x41537a[_0xa2ed('0x2e')],function(_0x463cd1){var _0x4df5bf={};_0x4df5bf[_0x463cd1]={'$like':'%'+_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x3b')]+'%'};return _0x4df5bf;})});}_0x41537a=_[_0xa2ed('0x39')]({},_0x41537a,_0x4bf260[_0xa2ed('0x3c')]);return _0x56e60e[_0xa2ed('0x4c')](_0x41537a);}})[_0xa2ed('0x22')](function(_0x1984c7){if(_0x1984c7){_0xc2e3cf=_0x1984c7['length'];if(!_0x4bf260[_0xa2ed('0x2d')][_0xa2ed('0x32')](_0xa2ed('0x33'))){_0x41537a['limit']=qs[_0xa2ed('0x1c')](_0x4bf260['query'][_0xa2ed('0x1c')]);_0x41537a[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x4bf260[_0xa2ed('0x2d')]['offset']);}return _0x56e60e[_0xa2ed('0x4c')](_0x41537a);}})[_0xa2ed('0x22')](function(_0x236eb4){if(_0x236eb4){return _0x236eb4?{'count':_0xc2e3cf,'rows':_0x236eb4}:null;}})[_0xa2ed('0x22')](respondWithResult(_0x2e6018,null))[_0xa2ed('0x40')](handleError(_0x2e6018,null));};exports[_0xa2ed('0x4d')]=function(_0x3b3981,_0x3bf278,_0x610f0b){var _0x7bc4f4={};var _0x1c4a24={};var _0x2e7ef6;var _0x336825;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x3b3981[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x3bf278,null))[_0xa2ed('0x22')](function(_0x19c368){if(_0x19c368){_0x2e7ef6=_0x19c368;_0x1c4a24[_0xa2ed('0x2c')]=_[_0xa2ed('0x43')](db[_0xa2ed('0x4a')][_0xa2ed('0x42')]);_0x1c4a24[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x3b3981['query']);_0x1c4a24[_0xa2ed('0x37')]=_[_0xa2ed('0x2f')](_0x1c4a24['model'],_0x1c4a24[_0xa2ed('0x2d')]);_0x7bc4f4['attributes']=_[_0xa2ed('0x2f')](_0x1c4a24['model'],qs['fields'](_0x3b3981[_0xa2ed('0x2d')]['fields']));_0x7bc4f4['attributes']=_0x7bc4f4['attributes'][_0xa2ed('0x31')]?_0x7bc4f4[_0xa2ed('0x2e')]:_0x1c4a24[_0xa2ed('0x2c')];_0x7bc4f4['order']=qs[_0xa2ed('0x35')](_0x3b3981['query'][_0xa2ed('0x35')]);_0x7bc4f4[_0xa2ed('0x36')]=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x3b3981[_0xa2ed('0x2d')],_0x1c4a24[_0xa2ed('0x37')]));if(_0x3b3981['query']['filter']){_0x7bc4f4[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x7bc4f4[_0xa2ed('0x36')],{'$or':_['map'](_0x7bc4f4[_0xa2ed('0x2e')],function(_0x3328ec){var _0x7a1c73={};_0x7a1c73[_0x3328ec]={'$like':'%'+_0x3b3981[_0xa2ed('0x2d')]['filter']+'%'};return _0x7a1c73;})});}_0x7bc4f4=_[_0xa2ed('0x39')]({},_0x7bc4f4,_0x3b3981['options']);return _0x2e7ef6[_0xa2ed('0x4d')](_0x7bc4f4);}})[_0xa2ed('0x22')](function(_0x649b39){if(_0x649b39){_0x336825=_0x649b39[_0xa2ed('0x31')];if(!_0x3b3981[_0xa2ed('0x2d')]['hasOwnProperty']('nolimit')){_0x7bc4f4[_0xa2ed('0x1c')]=qs[_0xa2ed('0x1c')](_0x3b3981['query']['limit']);_0x7bc4f4['offset']=qs[_0xa2ed('0x1a')](_0x3b3981[_0xa2ed('0x2d')][_0xa2ed('0x1a')]);}return _0x2e7ef6['getDescriptions'](_0x7bc4f4);}})[_0xa2ed('0x22')](function(_0x285bae){if(_0x285bae){return _0x285bae?{'count':_0x336825,'rows':_0x285bae}:null;}})[_0xa2ed('0x22')](respondWithResult(_0x3bf278,null))[_0xa2ed('0x40')](handleError(_0x3bf278,null));};exports[_0xa2ed('0x4e')]=function(_0x31b86b,_0x37fac7,_0x94933a){var _0x560889={};var _0x4872df={};var _0x5b692c;var _0x53f6b1;return db[_0xa2ed('0x28')][_0xa2ed('0x4b')]({'where':{'id':_0x31b86b['params']['id']}})['then'](handleEntityNotFound(_0x37fac7,null))['then'](function(_0x1cd1d3){if(_0x1cd1d3){_0x5b692c=_0x1cd1d3;_0x4872df[_0xa2ed('0x2c')]=_[_0xa2ed('0x43')](db[_0xa2ed('0x4f')][_0xa2ed('0x42')]);_0x4872df[_0xa2ed('0x2d')]=_[_0xa2ed('0x43')](_0x31b86b[_0xa2ed('0x2d')]);_0x4872df[_0xa2ed('0x37')]=_['intersection'](_0x4872df['model'],_0x4872df['query']);_0x560889[_0xa2ed('0x2e')]=_[_0xa2ed('0x2f')](_0x4872df[_0xa2ed('0x2c')],qs[_0xa2ed('0x30')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x30')]));_0x560889[_0xa2ed('0x2e')]=_0x560889['attributes']['length']?_0x560889['attributes']:_0x4872df[_0xa2ed('0x2c')];_0x560889['order']=qs[_0xa2ed('0x35')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x35')]);_0x560889['where']=qs[_0xa2ed('0x37')](_[_0xa2ed('0x38')](_0x31b86b[_0xa2ed('0x2d')],_0x4872df[_0xa2ed('0x37')]));if(_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x3b')]){_0x560889[_0xa2ed('0x36')]=_[_0xa2ed('0x39')](_0x560889[_0xa2ed('0x36')],{'$or':_[_0xa2ed('0x50')](_0x560889[_0xa2ed('0x2e')],function(_0x2463ea){var _0x4a555b={};_0x4a555b[_0x2463ea]={'$like':'%'+_0x31b86b['query'][_0xa2ed('0x3b')]+'%'};return _0x4a555b;})});}_0x560889=_[_0xa2ed('0x39')]({},_0x560889,_0x31b86b['options']);return _0x5b692c[_0xa2ed('0x4e')](_0x560889);}})['then'](function(_0x30009a){if(_0x30009a){_0x53f6b1=_0x30009a['length'];if(!_0x31b86b['query'][_0xa2ed('0x32')]('nolimit')){_0x560889['limit']=qs[_0xa2ed('0x1c')](_0x31b86b[_0xa2ed('0x2d')][_0xa2ed('0x1c')]);_0x560889[_0xa2ed('0x1a')]=qs[_0xa2ed('0x1a')](_0x31b86b['query']['offset']);}return _0x5b692c[_0xa2ed('0x4e')](_0x560889);}})[_0xa2ed('0x22')](function(_0x5b1e29){if(_0x5b1e29){return _0x5b1e29?{'count':_0x53f6b1,'rows':_0x5b1e29}:null;}})['then'](respondWithResult(_0x37fac7,null))['catch'](handleError(_0x37fac7,null));};exports[_0xa2ed('0x51')]=function(_0x247d46,_0x5f32aa,_0x2e8298){if(_0x247d46[_0xa2ed('0x46')]['id']){delete _0x247d46[_0xa2ed('0x46')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x247d46[_0xa2ed('0x48')]['id']}})[_0xa2ed('0x22')](handleEntityNotFound(_0x5f32aa,null))[_0xa2ed('0x22')](function(_0x3e94d2){if(_0x3e94d2){return _0x3e94d2[_0xa2ed('0x51')](_0x247d46[_0xa2ed('0x46')][_0xa2ed('0x52')]||[]);}return null;})['then'](respondWithResult(_0x5f32aa,null))[_0xa2ed('0x40')](handleError(_0x5f32aa,null));}; \ No newline at end of file +var _0x2d44=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','keys','create','body','find','DeskField','getFields','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x5f2dc8,_0x225807){var _0x4e51ad=function(_0x1bad65){while(--_0x1bad65){_0x5f2dc8['push'](_0x5f2dc8['shift']());}};_0x4e51ad(++_0x225807);}(_0x2d44,0xc1));var _0x42d4=function(_0x5b74be,_0x3b6e88){_0x5b74be=_0x5b74be-0x0;var _0x40b902=_0x2d44[_0x5b74be];return _0x40b902;};'use strict';var emlformat=require(_0x42d4('0x0'));var rimraf=require(_0x42d4('0x1'));var zipdir=require(_0x42d4('0x2'));var jsonpatch=require(_0x42d4('0x3'));var rp=require(_0x42d4('0x4'));var moment=require(_0x42d4('0x5'));var BPromise=require(_0x42d4('0x6'));var Mustache=require(_0x42d4('0x7'));var util=require('util');var path=require(_0x42d4('0x8'));var sox=require(_0x42d4('0x9'));var csv=require(_0x42d4('0xa'));var ejs=require(_0x42d4('0xb'));var fs=require('fs');var fs_extra=require(_0x42d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42d4('0xd'));var deskjs=require(_0x42d4('0xe'));var toCsv=require(_0x42d4('0xa'));var querystring=require(_0x42d4('0xf'));var Papa=require(_0x42d4('0x10'));var Redis=require(_0x42d4('0x11'));var authService=require(_0x42d4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42d4('0x13'));var logger=require(_0x42d4('0x14'))('api');var utils=require(_0x42d4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41fdcb,_0x4e07a5){_0x4e07a5=_0x4e07a5||0xcc;return function(_0x366b5a){if(_0x366b5a){return _0x41fdcb[_0x42d4('0x16')](_0x4e07a5);}return _0x41fdcb[_0x42d4('0x17')](_0x4e07a5)[_0x42d4('0x18')]();};}function respondWithResult(_0x364975,_0xe309a3){_0xe309a3=_0xe309a3||0xc8;return function(_0x3006d0){if(_0x3006d0){return _0x364975[_0x42d4('0x17')](_0xe309a3)[_0x42d4('0x19')](_0x3006d0);}};}function respondWithFilteredResult(_0x234e35,_0x455ebf){return function(_0x5a9e33){if(_0x5a9e33){var _0x74c8b5=typeof _0x455ebf[_0x42d4('0x1a')]===_0x42d4('0x1b')&&typeof _0x455ebf[_0x42d4('0x1c')]===_0x42d4('0x1b');var _0x2f2fbb=_0x5a9e33[_0x42d4('0x1d')];var _0x49f2f4=_0x74c8b5?0x0:_0x455ebf[_0x42d4('0x1a')];var _0x1a14e8=_0x74c8b5?_0x5a9e33[_0x42d4('0x1d')]:_0x455ebf[_0x42d4('0x1a')]+_0x455ebf['limit'];var _0x167d86;if(_0x1a14e8>=_0x2f2fbb){_0x1a14e8=_0x2f2fbb;_0x167d86=0xc8;}else{_0x167d86=0xce;}_0x234e35['status'](_0x167d86);return _0x234e35[_0x42d4('0x1e')](_0x42d4('0x1f'),_0x49f2f4+'-'+_0x1a14e8+'/'+_0x2f2fbb)[_0x42d4('0x19')](_0x5a9e33);}return null;};}function patchUpdates(_0x6899f8){return function(_0x4a2c91){try{jsonpatch[_0x42d4('0x20')](_0x4a2c91,_0x6899f8,!![]);}catch(_0x1b8706){return BPromise[_0x42d4('0x21')](_0x1b8706);}return _0x4a2c91[_0x42d4('0x22')]();};}function saveUpdates(_0x5d4cfd,_0x385beb){return function(_0x5f5d99){if(_0x5f5d99){return _0x5f5d99[_0x42d4('0x23')](_0x5d4cfd)['then'](function(_0x1f4f3f){return _0x1f4f3f;});}return null;};}function removeEntity(_0x54b062,_0x1c80c7){return function(_0x552cf0){if(_0x552cf0){return _0x552cf0[_0x42d4('0x24')]()[_0x42d4('0x25')](function(){_0x54b062[_0x42d4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e737,_0x5ec1b0){return function(_0x949da0){if(!_0x949da0){_0x11e737[_0x42d4('0x16')](0x194);}return _0x949da0;};}function handleError(_0x4f6b33,_0x15df8b){_0x15df8b=_0x15df8b||0x1f4;return function(_0x433cec){logger[_0x42d4('0x26')](_0x433cec[_0x42d4('0x27')]);if(_0x433cec[_0x42d4('0x28')]){delete _0x433cec[_0x42d4('0x28')];}_0x4f6b33[_0x42d4('0x17')](_0x15df8b)[_0x42d4('0x29')](_0x433cec);};}exports['index']=function(_0x21eadd,_0x3640d4){var _0x5e43e0={},_0x16d623={},_0x33e6a9={'count':0x0,'rows':[]};var _0xb1af31=_[_0x42d4('0x2a')](db['DeskConfiguration'][_0x42d4('0x2b')],function(_0xdb473e){return{'name':_0xdb473e[_0x42d4('0x2c')],'type':_0xdb473e[_0x42d4('0x2d')]['key']};});_0x16d623[_0x42d4('0x2e')]=_[_0x42d4('0x2a')](_0xb1af31,_0x42d4('0x28'));_0x16d623[_0x42d4('0x2f')]=_['keys'](_0x21eadd[_0x42d4('0x2f')]);_0x16d623[_0x42d4('0x30')]=_[_0x42d4('0x31')](_0x16d623['model'],_0x16d623[_0x42d4('0x2f')]);_0x5e43e0[_0x42d4('0x32')]=_[_0x42d4('0x31')](_0x16d623['model'],qs[_0x42d4('0x33')](_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x33')]));_0x5e43e0['attributes']=_0x5e43e0[_0x42d4('0x32')][_0x42d4('0x34')]?_0x5e43e0[_0x42d4('0x32')]:_0x16d623['model'];if(!_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x35')](_0x42d4('0x36'))){_0x5e43e0[_0x42d4('0x1c')]=qs[_0x42d4('0x1c')](_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x1c')]);_0x5e43e0[_0x42d4('0x1a')]=qs[_0x42d4('0x1a')](_0x21eadd[_0x42d4('0x2f')]['offset']);}_0x5e43e0[_0x42d4('0x37')]=qs[_0x42d4('0x38')](_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x38')]);_0x5e43e0[_0x42d4('0x39')]=qs[_0x42d4('0x30')](_[_0x42d4('0x3a')](_0x21eadd[_0x42d4('0x2f')],_0x16d623['filters']),_0xb1af31);if(_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x3b')]){_0x5e43e0[_0x42d4('0x39')]=_[_0x42d4('0x3c')](_0x5e43e0[_0x42d4('0x39')],{'$or':_[_0x42d4('0x2a')](_0xb1af31,function(_0x474317){if(_0x474317['type']!==_0x42d4('0x3d')){var _0x5d0f9d={};_0x5d0f9d[_0x474317['name']]={'$like':'%'+_0x21eadd[_0x42d4('0x2f')]['filter']+'%'};return _0x5d0f9d;}})});}_0x5e43e0=_[_0x42d4('0x3c')]({},_0x5e43e0,_0x21eadd[_0x42d4('0x3e')]);var _0x56869e={'where':_0x5e43e0[_0x42d4('0x39')]};return db[_0x42d4('0x3f')][_0x42d4('0x1d')](_0x56869e)['then'](function(_0x4a3dc6){_0x33e6a9[_0x42d4('0x1d')]=_0x4a3dc6;if(_0x21eadd[_0x42d4('0x2f')][_0x42d4('0x40')]){_0x5e43e0[_0x42d4('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x42d4('0x42')](_0x5e43e0);})[_0x42d4('0x25')](function(_0x13a7e9){_0x33e6a9['rows']=_0x13a7e9;return _0x33e6a9;})[_0x42d4('0x25')](respondWithFilteredResult(_0x3640d4,_0x5e43e0))[_0x42d4('0x43')](handleError(_0x3640d4,null));};exports[_0x42d4('0x44')]=function(_0x3c49ad,_0x53ec25){var _0x4df7ca={'raw':![],'where':{'id':_0x3c49ad[_0x42d4('0x45')]['id']}},_0x5e7b38={};_0x5e7b38[_0x42d4('0x2e')]=_[_0x42d4('0x46')](db[_0x42d4('0x3f')][_0x42d4('0x2b')]);_0x5e7b38['query']=_[_0x42d4('0x46')](_0x3c49ad[_0x42d4('0x2f')]);_0x5e7b38[_0x42d4('0x30')]=_[_0x42d4('0x31')](_0x5e7b38[_0x42d4('0x2e')],_0x5e7b38[_0x42d4('0x2f')]);_0x4df7ca[_0x42d4('0x32')]=_['intersection'](_0x5e7b38['model'],qs['fields'](_0x3c49ad[_0x42d4('0x2f')][_0x42d4('0x33')]));_0x4df7ca[_0x42d4('0x32')]=_0x4df7ca['attributes'][_0x42d4('0x34')]?_0x4df7ca[_0x42d4('0x32')]:_0x5e7b38['model'];if(_0x3c49ad[_0x42d4('0x2f')][_0x42d4('0x40')]){_0x4df7ca[_0x42d4('0x41')]=[{'all':!![]}];}_0x4df7ca=_[_0x42d4('0x3c')]({},_0x4df7ca,_0x3c49ad[_0x42d4('0x3e')]);return db['DeskConfiguration']['find'](_0x4df7ca)[_0x42d4('0x25')](handleEntityNotFound(_0x53ec25,null))[_0x42d4('0x25')](respondWithResult(_0x53ec25,null))[_0x42d4('0x43')](handleError(_0x53ec25,null));};exports[_0x42d4('0x47')]=function(_0x70f678,_0x39d977){return db[_0x42d4('0x3f')]['create'](_0x70f678[_0x42d4('0x48')],{})[_0x42d4('0x25')](respondWithResult(_0x39d977,0xc9))['catch'](handleError(_0x39d977,null));};exports[_0x42d4('0x23')]=function(_0x19425a,_0x2ce63e){if(_0x19425a[_0x42d4('0x48')]['id']){delete _0x19425a[_0x42d4('0x48')]['id'];}return db[_0x42d4('0x3f')][_0x42d4('0x49')]({'where':{'id':_0x19425a[_0x42d4('0x45')]['id']}})[_0x42d4('0x25')](handleEntityNotFound(_0x2ce63e,null))[_0x42d4('0x25')](saveUpdates(_0x19425a[_0x42d4('0x48')],null))[_0x42d4('0x25')](respondWithResult(_0x2ce63e,null))[_0x42d4('0x43')](handleError(_0x2ce63e,null));};exports['destroy']=function(_0x39645e,_0x268d84){return db[_0x42d4('0x3f')][_0x42d4('0x49')]({'where':{'id':_0x39645e[_0x42d4('0x45')]['id']}})[_0x42d4('0x25')](handleEntityNotFound(_0x268d84,null))[_0x42d4('0x25')](removeEntity(_0x268d84,null))[_0x42d4('0x43')](handleError(_0x268d84,null));};exports['getFields']=function(_0x55fdf5,_0x3504d0,_0x2d8322){var _0x4e0e64={};var _0x55c019={};var _0x159753;var _0x4fbeeb;return db[_0x42d4('0x3f')]['findOne']({'where':{'id':_0x55fdf5['params']['id']}})[_0x42d4('0x25')](handleEntityNotFound(_0x3504d0,null))[_0x42d4('0x25')](function(_0x20a18a){if(_0x20a18a){_0x159753=_0x20a18a;_0x55c019[_0x42d4('0x2e')]=_[_0x42d4('0x46')](db[_0x42d4('0x4a')]['rawAttributes']);_0x55c019[_0x42d4('0x2f')]=_[_0x42d4('0x46')](_0x55fdf5['query']);_0x55c019[_0x42d4('0x30')]=_[_0x42d4('0x31')](_0x55c019[_0x42d4('0x2e')],_0x55c019[_0x42d4('0x2f')]);_0x4e0e64[_0x42d4('0x32')]=_[_0x42d4('0x31')](_0x55c019[_0x42d4('0x2e')],qs[_0x42d4('0x33')](_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x33')]));_0x4e0e64[_0x42d4('0x32')]=_0x4e0e64['attributes'][_0x42d4('0x34')]?_0x4e0e64[_0x42d4('0x32')]:_0x55c019[_0x42d4('0x2e')];_0x4e0e64[_0x42d4('0x37')]=qs['sort'](_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x38')]);_0x4e0e64['where']=qs[_0x42d4('0x30')](_[_0x42d4('0x3a')](_0x55fdf5[_0x42d4('0x2f')],_0x55c019[_0x42d4('0x30')]));if(_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x3b')]){_0x4e0e64[_0x42d4('0x39')]=_[_0x42d4('0x3c')](_0x4e0e64[_0x42d4('0x39')],{'$or':_[_0x42d4('0x2a')](_0x4e0e64[_0x42d4('0x32')],function(_0x5a906f){var _0x55cdb7={};_0x55cdb7[_0x5a906f]={'$like':'%'+_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x3b')]+'%'};return _0x55cdb7;})});}_0x4e0e64=_[_0x42d4('0x3c')]({},_0x4e0e64,_0x55fdf5[_0x42d4('0x3e')]);return _0x159753[_0x42d4('0x4b')](_0x4e0e64);}})[_0x42d4('0x25')](function(_0x409b21){if(_0x409b21){_0x4fbeeb=_0x409b21[_0x42d4('0x34')];if(!_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x35')](_0x42d4('0x36'))){_0x4e0e64[_0x42d4('0x1c')]=qs['limit'](_0x55fdf5[_0x42d4('0x2f')]['limit']);_0x4e0e64[_0x42d4('0x1a')]=qs['offset'](_0x55fdf5[_0x42d4('0x2f')][_0x42d4('0x1a')]);}return _0x159753[_0x42d4('0x4b')](_0x4e0e64);}})[_0x42d4('0x25')](function(_0x1b5570){if(_0x1b5570){return _0x1b5570?{'count':_0x4fbeeb,'rows':_0x1b5570}:null;}})[_0x42d4('0x25')](respondWithResult(_0x3504d0,null))[_0x42d4('0x43')](handleError(_0x3504d0,null));};exports[_0x42d4('0x4c')]=function(_0xf2f6ad,_0x153ee1,_0x3fe1a2){var _0x4c2f58={};var _0x5f16ad={};var _0x4ccaf0;var _0x5e4777;return db['DeskConfiguration'][_0x42d4('0x4d')]({'where':{'id':_0xf2f6ad[_0x42d4('0x45')]['id']}})[_0x42d4('0x25')](handleEntityNotFound(_0x153ee1,null))[_0x42d4('0x25')](function(_0x4f6871){if(_0x4f6871){_0x4ccaf0=_0x4f6871;_0x5f16ad[_0x42d4('0x2e')]=_[_0x42d4('0x46')](db[_0x42d4('0x4a')][_0x42d4('0x2b')]);_0x5f16ad['query']=_['keys'](_0xf2f6ad[_0x42d4('0x2f')]);_0x5f16ad[_0x42d4('0x30')]=_['intersection'](_0x5f16ad[_0x42d4('0x2e')],_0x5f16ad['query']);_0x4c2f58[_0x42d4('0x32')]=_[_0x42d4('0x31')](_0x5f16ad[_0x42d4('0x2e')],qs['fields'](_0xf2f6ad[_0x42d4('0x2f')][_0x42d4('0x33')]));_0x4c2f58[_0x42d4('0x32')]=_0x4c2f58[_0x42d4('0x32')]['length']?_0x4c2f58['attributes']:_0x5f16ad[_0x42d4('0x2e')];_0x4c2f58['order']=qs[_0x42d4('0x38')](_0xf2f6ad['query'][_0x42d4('0x38')]);_0x4c2f58[_0x42d4('0x39')]=qs[_0x42d4('0x30')](_[_0x42d4('0x3a')](_0xf2f6ad[_0x42d4('0x2f')],_0x5f16ad['filters']));if(_0xf2f6ad['query'][_0x42d4('0x3b')]){_0x4c2f58['where']=_[_0x42d4('0x3c')](_0x4c2f58[_0x42d4('0x39')],{'$or':_[_0x42d4('0x2a')](_0x4c2f58[_0x42d4('0x32')],function(_0x5b2c2d){var _0x29fe99={};_0x29fe99[_0x5b2c2d]={'$like':'%'+_0xf2f6ad['query'][_0x42d4('0x3b')]+'%'};return _0x29fe99;})});}_0x4c2f58=_[_0x42d4('0x3c')]({},_0x4c2f58,_0xf2f6ad['options']);return _0x4ccaf0[_0x42d4('0x4c')](_0x4c2f58);}})[_0x42d4('0x25')](function(_0x277527){if(_0x277527){_0x5e4777=_0x277527[_0x42d4('0x34')];if(!_0xf2f6ad[_0x42d4('0x2f')][_0x42d4('0x35')](_0x42d4('0x36'))){_0x4c2f58[_0x42d4('0x1c')]=qs[_0x42d4('0x1c')](_0xf2f6ad[_0x42d4('0x2f')][_0x42d4('0x1c')]);_0x4c2f58[_0x42d4('0x1a')]=qs['offset'](_0xf2f6ad[_0x42d4('0x2f')][_0x42d4('0x1a')]);}return _0x4ccaf0[_0x42d4('0x4c')](_0x4c2f58);}})[_0x42d4('0x25')](function(_0x4c8d40){if(_0x4c8d40){return _0x4c8d40?{'count':_0x5e4777,'rows':_0x4c8d40}:null;}})['then'](respondWithResult(_0x153ee1,null))[_0x42d4('0x43')](handleError(_0x153ee1,null));};exports[_0x42d4('0x4e')]=function(_0x4ed705,_0x30602a,_0x360c5d){var _0x4d58bd={};var _0x4d8d36={};var _0x21802d;var _0x1c4d4a;return db['DeskConfiguration'][_0x42d4('0x4d')]({'where':{'id':_0x4ed705[_0x42d4('0x45')]['id']}})[_0x42d4('0x25')](handleEntityNotFound(_0x30602a,null))['then'](function(_0x567322){if(_0x567322){_0x21802d=_0x567322;_0x4d8d36[_0x42d4('0x2e')]=_['keys'](db[_0x42d4('0x4a')][_0x42d4('0x2b')]);_0x4d8d36[_0x42d4('0x2f')]=_['keys'](_0x4ed705[_0x42d4('0x2f')]);_0x4d8d36[_0x42d4('0x30')]=_[_0x42d4('0x31')](_0x4d8d36[_0x42d4('0x2e')],_0x4d8d36[_0x42d4('0x2f')]);_0x4d58bd[_0x42d4('0x32')]=_[_0x42d4('0x31')](_0x4d8d36[_0x42d4('0x2e')],qs[_0x42d4('0x33')](_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x33')]));_0x4d58bd[_0x42d4('0x32')]=_0x4d58bd[_0x42d4('0x32')][_0x42d4('0x34')]?_0x4d58bd['attributes']:_0x4d8d36[_0x42d4('0x2e')];_0x4d58bd[_0x42d4('0x37')]=qs[_0x42d4('0x38')](_0x4ed705['query'][_0x42d4('0x38')]);_0x4d58bd['where']=qs[_0x42d4('0x30')](_[_0x42d4('0x3a')](_0x4ed705[_0x42d4('0x2f')],_0x4d8d36[_0x42d4('0x30')]));if(_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x3b')]){_0x4d58bd[_0x42d4('0x39')]=_[_0x42d4('0x3c')](_0x4d58bd[_0x42d4('0x39')],{'$or':_[_0x42d4('0x2a')](_0x4d58bd['attributes'],function(_0x3adee0){var _0x4244ff={};_0x4244ff[_0x3adee0]={'$like':'%'+_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x3b')]+'%'};return _0x4244ff;})});}_0x4d58bd=_[_0x42d4('0x3c')]({},_0x4d58bd,_0x4ed705['options']);return _0x21802d[_0x42d4('0x4e')](_0x4d58bd);}})['then'](function(_0x1a563e){if(_0x1a563e){_0x1c4d4a=_0x1a563e[_0x42d4('0x34')];if(!_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x35')](_0x42d4('0x36'))){_0x4d58bd[_0x42d4('0x1c')]=qs[_0x42d4('0x1c')](_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x1c')]);_0x4d58bd[_0x42d4('0x1a')]=qs['offset'](_0x4ed705[_0x42d4('0x2f')][_0x42d4('0x1a')]);}return _0x21802d[_0x42d4('0x4e')](_0x4d58bd);}})[_0x42d4('0x25')](function(_0x42273c){if(_0x42273c){return _0x42273c?{'count':_0x1c4d4a,'rows':_0x42273c}:null;}})[_0x42d4('0x25')](respondWithResult(_0x30602a,null))[_0x42d4('0x43')](handleError(_0x30602a,null));};exports['getTags']=function(_0x312856,_0x23dd12,_0x250ac4){var _0xfc27a6={};var _0x1b7dd6={};var _0x562d78;var _0x2277a8;return db[_0x42d4('0x3f')][_0x42d4('0x4d')]({'where':{'id':_0x312856[_0x42d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x23dd12,null))[_0x42d4('0x25')](function(_0x1a54a6){if(_0x1a54a6){_0x562d78=_0x1a54a6;_0x1b7dd6[_0x42d4('0x2e')]=_[_0x42d4('0x46')](db[_0x42d4('0x4f')][_0x42d4('0x2b')]);_0x1b7dd6[_0x42d4('0x2f')]=_[_0x42d4('0x46')](_0x312856[_0x42d4('0x2f')]);_0x1b7dd6[_0x42d4('0x30')]=_[_0x42d4('0x31')](_0x1b7dd6['model'],_0x1b7dd6[_0x42d4('0x2f')]);_0xfc27a6[_0x42d4('0x32')]=_['intersection'](_0x1b7dd6[_0x42d4('0x2e')],qs[_0x42d4('0x33')](_0x312856['query']['fields']));_0xfc27a6[_0x42d4('0x32')]=_0xfc27a6[_0x42d4('0x32')][_0x42d4('0x34')]?_0xfc27a6[_0x42d4('0x32')]:_0x1b7dd6['model'];_0xfc27a6[_0x42d4('0x37')]=qs[_0x42d4('0x38')](_0x312856[_0x42d4('0x2f')][_0x42d4('0x38')]);_0xfc27a6['where']=qs[_0x42d4('0x30')](_[_0x42d4('0x3a')](_0x312856[_0x42d4('0x2f')],_0x1b7dd6[_0x42d4('0x30')]));if(_0x312856[_0x42d4('0x2f')][_0x42d4('0x3b')]){_0xfc27a6[_0x42d4('0x39')]=_['merge'](_0xfc27a6[_0x42d4('0x39')],{'$or':_[_0x42d4('0x2a')](_0xfc27a6[_0x42d4('0x32')],function(_0xa6e2b){var _0x3b56ed={};_0x3b56ed[_0xa6e2b]={'$like':'%'+_0x312856[_0x42d4('0x2f')][_0x42d4('0x3b')]+'%'};return _0x3b56ed;})});}_0xfc27a6=_[_0x42d4('0x3c')]({},_0xfc27a6,_0x312856[_0x42d4('0x3e')]);return _0x562d78[_0x42d4('0x50')](_0xfc27a6);}})[_0x42d4('0x25')](function(_0xd1fb47){if(_0xd1fb47){_0x2277a8=_0xd1fb47[_0x42d4('0x34')];if(!_0x312856[_0x42d4('0x2f')][_0x42d4('0x35')](_0x42d4('0x36'))){_0xfc27a6[_0x42d4('0x1c')]=qs[_0x42d4('0x1c')](_0x312856[_0x42d4('0x2f')][_0x42d4('0x1c')]);_0xfc27a6['offset']=qs[_0x42d4('0x1a')](_0x312856['query']['offset']);}return _0x562d78[_0x42d4('0x50')](_0xfc27a6);}})[_0x42d4('0x25')](function(_0x53fa5c){if(_0x53fa5c){return _0x53fa5c?{'count':_0x2277a8,'rows':_0x53fa5c}:null;}})['then'](respondWithResult(_0x23dd12,null))['catch'](handleError(_0x23dd12,null));};exports[_0x42d4('0x51')]=function(_0x50424b,_0x1bd223,_0x3648ff){if(_0x50424b[_0x42d4('0x48')]['id']){delete _0x50424b[_0x42d4('0x48')]['id'];}return db['DeskConfiguration'][_0x42d4('0x4d')]({'where':{'id':_0x50424b['params']['id']}})['then'](handleEntityNotFound(_0x1bd223,null))[_0x42d4('0x25')](function(_0x1ec2f3){if(_0x1ec2f3){return _0x1ec2f3['setTags'](_0x50424b[_0x42d4('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1bd223,null))[_0x42d4('0x43')](handleError(_0x1bd223,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0e24a6d..1b9194d 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 _0x9b00=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x23e92b,_0x2b39f8){var _0xc00ad6=function(_0x9157c2){while(--_0x9157c2){_0x23e92b['push'](_0x23e92b['shift']());}};_0xc00ad6(++_0x2b39f8);}(_0x9b00,0xcc));var _0x09b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b00[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var logger=require(_0x09b0('0x2'))('api');var moment=require(_0x09b0('0x3'));var BPromise=require(_0x09b0('0x4'));var rp=require(_0x09b0('0x5'));var fs=require('fs');var path=require(_0x09b0('0x6'));var rimraf=require(_0x09b0('0x7'));var config=require(_0x09b0('0x8'));var attributes=require(_0x09b0('0x9'));module['exports']=function(_0x79bc56,_0x57b9e0){return _0x79bc56[_0x09b0('0xa')](_0x09b0('0xb'),attributes,{'tableName':_0x09b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4614=['int_desk_configurations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x3cc0ed,_0x57c446){var _0x457028=function(_0x4d83e4){while(--_0x4d83e4){_0x3cc0ed['push'](_0x3cc0ed['shift']());}};_0x457028(++_0x57c446);}(_0x4614,0x85));var _0x4461=function(_0x28139f,_0x57da21){_0x28139f=_0x28139f-0x0;var _0x11ed47=_0x4614[_0x28139f];return _0x11ed47;};'use strict';var _=require(_0x4461('0x0'));var util=require(_0x4461('0x1'));var logger=require(_0x4461('0x2'))(_0x4461('0x3'));var moment=require('moment');var BPromise=require(_0x4461('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4461('0x5'));var config=require(_0x4461('0x6'));var attributes=require(_0x4461('0x7'));module[_0x4461('0x8')]=function(_0xb5af4d,_0xf4e5bc){return _0xb5af4d[_0x4461('0x9')](_0x4461('0xa'),attributes,{'tableName':_0x4461('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 86d636a..091eff3 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 _0xc2e3=['../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3f3131,_0x326527){var _0x350016=function(_0x96ec78){while(--_0x96ec78){_0x3f3131['push'](_0x3f3131['shift']());}};_0x350016(++_0x326527);}(_0xc2e3,0x1f3));var _0x3c2e=function(_0x2d41a3,_0x80e45b){_0x2d41a3=_0x2d41a3-0x0;var _0x5acc25=_0xc2e3[_0x2d41a3];return _0x5acc25;};'use strict';var _=require(_0x3c2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c2e('0x1'));var rs=require(_0x3c2e('0x2'));var fs=require('fs');var Redis=require(_0x3c2e('0x3'));var db=require(_0x3c2e('0x4'))['db'];var utils=require(_0x3c2e('0x5'));var logger=require('../../config/logger')(_0x3c2e('0x6'));var config=require(_0x3c2e('0x7'));var jayson=require(_0x3c2e('0x8'));var client=jayson[_0x3c2e('0x9')][_0x3c2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51be99,_0x43763c,_0x1fbbcf){return new BPromise(function(_0x2c52a7,_0x2d3b55){return client['request'](_0x51be99,_0x1fbbcf)[_0x3c2e('0xb')](function(_0x594c93){logger[_0x3c2e('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x43763c,'request\x20sent');logger[_0x3c2e('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x43763c,_0x3c2e('0xe'),JSON[_0x3c2e('0xf')](_0x594c93));if(_0x594c93['error']){if(_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x11')]===0x1f4){logger['error'](_0x3c2e('0x12'),_0x43763c,_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x13')]);return _0x2d3b55(_0x594c93[_0x3c2e('0x10')]['message']);}logger[_0x3c2e('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x43763c,_0x594c93['error']['message']);return _0x2c52a7(_0x594c93[_0x3c2e('0x10')][_0x3c2e('0x13')]);}else{logger[_0x3c2e('0xc')](_0x3c2e('0x12'),_0x43763c,_0x3c2e('0xe'));_0x2c52a7(_0x594c93[_0x3c2e('0x14')][_0x3c2e('0x13')]);}})[_0x3c2e('0x15')](function(_0x5e7865){logger[_0x3c2e('0x10')](_0x3c2e('0x12'),_0x43763c,_0x5e7865);_0x2d3b55(_0x5e7865);});});} \ No newline at end of file +var _0x07fa=['../../config/utils','../../config/logger','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1410b0,_0x1b73ba){var _0xc6b5a4=function(_0x8cbb09){while(--_0x8cbb09){_0x1410b0['push'](_0x1410b0['shift']());}};_0xc6b5a4(++_0x1b73ba);}(_0x07fa,0x177));var _0xa07f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x07fa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0xa07f('0x0'));var moment=require(_0xa07f('0x1'));var BPromise=require(_0xa07f('0x2'));var rs=require(_0xa07f('0x3'));var fs=require('fs');var Redis=require(_0xa07f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa07f('0x5'));var logger=require(_0xa07f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa07f('0x7')][_0xa07f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509d7a,_0x2ad2ff,_0x575be1){return new BPromise(function(_0x4eea76,_0x5d82e9){return client['request'](_0x509d7a,_0x575be1)[_0xa07f('0x9')](function(_0x288476){logger['info'](_0xa07f('0xa'),_0x2ad2ff,_0xa07f('0xb'));logger[_0xa07f('0xc')](_0xa07f('0xd'),_0x2ad2ff,_0xa07f('0xb'),JSON[_0xa07f('0xe')](_0x288476));if(_0x288476[_0xa07f('0xf')]){if(_0x288476[_0xa07f('0xf')]['code']===0x1f4){logger[_0xa07f('0xf')](_0xa07f('0xa'),_0x2ad2ff,_0x288476['error'][_0xa07f('0x10')]);return _0x5d82e9(_0x288476[_0xa07f('0xf')][_0xa07f('0x10')]);}logger['error'](_0xa07f('0xa'),_0x2ad2ff,_0x288476['error'][_0xa07f('0x10')]);return _0x4eea76(_0x288476[_0xa07f('0xf')][_0xa07f('0x10')]);}else{logger[_0xa07f('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2ad2ff,_0xa07f('0xb'));_0x4eea76(_0x288476[_0xa07f('0x12')][_0xa07f('0x10')]);}})[_0xa07f('0x13')](function(_0x4090a1){logger['error'](_0xa07f('0xa'),_0x2ad2ff,_0x4090a1);_0x5d82e9(_0x4090a1);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9af238d..99c6260 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 _0x6262=['delete','/:id','util','connect-timeout','express','Router','../../config/environment','get','index','isAuthenticated','show','post','create','update'];(function(_0x3e89eb,_0x118484){var _0x1cf4ab=function(_0x5a8f2d){while(--_0x5a8f2d){_0x3e89eb['push'](_0x3e89eb['shift']());}};_0x1cf4ab(++_0x118484);}(_0x6262,0x72));var _0x2626=function(_0x58a364,_0x3439f6){_0x58a364=_0x58a364-0x0;var _0x409b74=_0x6262[_0x58a364];return _0x409b74;};'use strict';var multer=require('multer');var util=require(_0x2626('0x0'));var path=require('path');var timeout=require(_0x2626('0x1'));var express=require(_0x2626('0x2'));var router=express[_0x2626('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2626('0x4'));var controller=require('./intDeskField.controller');router[_0x2626('0x5')]('/',auth['isAuthenticated'](),controller[_0x2626('0x6')]);router['get']('/:id',auth[_0x2626('0x7')](),controller[_0x2626('0x8')]);router[_0x2626('0x9')]('/',auth[_0x2626('0x7')](),controller[_0x2626('0xa')]);router['put']('/:id',auth[_0x2626('0x7')](),controller[_0x2626('0xb')]);router[_0x2626('0xc')](_0x2626('0xd'),auth[_0x2626('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4689=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xd8934b,_0x13ed44){var _0x58a26f=function(_0x58b4e5){while(--_0x58b4e5){_0xd8934b['push'](_0xd8934b['shift']());}};_0x58a26f(++_0x13ed44);}(_0x4689,0xf9));var _0x9468=function(_0x54333a,_0x209b84){_0x54333a=_0x54333a-0x0;var _0x3605f4=_0x4689[_0x54333a];return _0x3605f4;};'use strict';var multer=require(_0x9468('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9468('0x1'));var express=require(_0x9468('0x2'));var router=express[_0x9468('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9468('0x4'));var interaction=require(_0x9468('0x5'));var config=require('../../config/environment');var controller=require(_0x9468('0x6'));router[_0x9468('0x7')]('/',auth[_0x9468('0x8')](),controller[_0x9468('0x9')]);router[_0x9468('0x7')](_0x9468('0xa'),auth[_0x9468('0x8')](),controller[_0x9468('0xb')]);router['post']('/',auth[_0x9468('0x8')](),controller['create']);router[_0x9468('0xc')](_0x9468('0xa'),auth[_0x9468('0x8')](),controller['update']);router[_0x9468('0xd')](_0x9468('0xa'),auth['isAuthenticated'](),controller[_0x9468('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 80b12c1..d0ed872 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 _0xad89=['STRING','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x5181bf,_0x49af23){var _0x6167c3=function(_0x54a7bf){while(--_0x54a7bf){_0x5181bf['push'](_0x5181bf['shift']());}};_0x6167c3(++_0x49af23);}(_0xad89,0x1a9));var _0x9ad8=function(_0x12f4af,_0x4a2bb9){_0x12f4af=_0x12f4af-0x0;var _0x4c4d50=_0xad89[_0x12f4af];return _0x4c4d50;};'use strict';var Sequelize=require(_0x9ad8('0x0'));module[_0x9ad8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9ad8('0x2'),_0x9ad8('0x3'),_0x9ad8('0x4'),_0x9ad8('0x5')),'defaultValue':_0x9ad8('0x6')},'content':{'type':Sequelize[_0x9ad8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9ad8('0x6'),_0x9ad8('0x2'),_0x9ad8('0x3'))},'keyContent':{'type':Sequelize[_0x9ad8('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9ad8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ad8('0x7')]}}; \ No newline at end of file +var _0x5ea4=['customVariable','keyValue','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0xab649b,_0x1519e9){var _0x3b7584=function(_0x4b878e){while(--_0x4b878e){_0xab649b['push'](_0xab649b['shift']());}};_0x3b7584(++_0x1519e9);}(_0x5ea4,0x19d));var _0x45ea=function(_0x3d9e7f,_0x27dcd4){_0x3d9e7f=_0x3d9e7f-0x0;var _0x4216a4=_0x5ea4[_0x3d9e7f];return _0x4216a4;};'use strict';var Sequelize=require('sequelize');module[_0x45ea('0x0')]={'type':{'type':Sequelize[_0x45ea('0x1')](_0x45ea('0x2'),'variable',_0x45ea('0x3'),_0x45ea('0x4'),'picklist'),'defaultValue':_0x45ea('0x2')},'content':{'type':Sequelize[_0x45ea('0x5')]},'key':{'type':Sequelize[_0x45ea('0x5')]},'keyType':{'type':Sequelize[_0x45ea('0x1')](_0x45ea('0x2'),_0x45ea('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x45ea('0x5')]},'idField':{'type':Sequelize[_0x45ea('0x5')]},'nameField':{'type':Sequelize[_0x45ea('0x5')]},'customField':{'type':Sequelize[_0x45ea('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45ea('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8bdbe04..e39dc24 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 _0xd837=['Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','name','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','then','includeAll','include','rows','params','fields','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set'];(function(_0x2c7e51,_0x561e94){var _0x5c69fb=function(_0x5e4e54){while(--_0x5e4e54){_0x2c7e51['push'](_0x2c7e51['shift']());}};_0x5c69fb(++_0x561e94);}(_0xd837,0x1a1));var _0x7d83=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xd837[_0x236d24];return _0x1574cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d83('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d83('0x1'));var rp=require(_0x7d83('0x2'));var moment=require('moment');var BPromise=require(_0x7d83('0x3'));var Mustache=require('mustache');var util=require(_0x7d83('0x4'));var path=require(_0x7d83('0x5'));var sox=require(_0x7d83('0x6'));var csv=require(_0x7d83('0x7'));var ejs=require(_0x7d83('0x8'));var fs=require('fs');var fs_extra=require(_0x7d83('0x9'));var _=require(_0x7d83('0xa'));var squel=require(_0x7d83('0xb'));var crypto=require(_0x7d83('0xc'));var jsforce=require(_0x7d83('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d83('0xe'));var Papa=require(_0x7d83('0xf'));var Redis=require(_0x7d83('0x10'));var authService=require(_0x7d83('0x11'));var qs=require(_0x7d83('0x12'));var as=require(_0x7d83('0x13'));var hardwareService=require(_0x7d83('0x14'));var logger=require(_0x7d83('0x15'))('api');var utils=require(_0x7d83('0x16'));var config=require(_0x7d83('0x17'));var licenseUtil=require(_0x7d83('0x18'));var db=require(_0x7d83('0x19'))['db'];function respondWithStatusCode(_0x132130,_0x5335e1){_0x5335e1=_0x5335e1||0xcc;return function(_0x19165f){if(_0x19165f){return _0x132130['sendStatus'](_0x5335e1);}return _0x132130['status'](_0x5335e1)[_0x7d83('0x1a')]();};}function respondWithResult(_0x1586bf,_0xb49769){_0xb49769=_0xb49769||0xc8;return function(_0x42ba03){if(_0x42ba03){return _0x1586bf[_0x7d83('0x1b')](_0xb49769)['json'](_0x42ba03);}};}function respondWithFilteredResult(_0x30c006,_0x5ce871){return function(_0x156ce1){if(_0x156ce1){var _0x44553d=typeof _0x5ce871[_0x7d83('0x1c')]===_0x7d83('0x1d')&&typeof _0x5ce871['limit']==='undefined';var _0x2b947c=_0x156ce1['count'];var _0x426beb=_0x44553d?0x0:_0x5ce871['offset'];var _0x29ae09=_0x44553d?_0x156ce1[_0x7d83('0x1e')]:_0x5ce871['offset']+_0x5ce871[_0x7d83('0x1f')];var _0x44ba90;if(_0x29ae09>=_0x2b947c){_0x29ae09=_0x2b947c;_0x44ba90=0xc8;}else{_0x44ba90=0xce;}_0x30c006[_0x7d83('0x1b')](_0x44ba90);return _0x30c006[_0x7d83('0x20')](_0x7d83('0x21'),_0x426beb+'-'+_0x29ae09+'/'+_0x2b947c)[_0x7d83('0x22')](_0x156ce1);}return null;};}function patchUpdates(_0x3cdcb2){return function(_0x50856a){try{jsonpatch[_0x7d83('0x23')](_0x50856a,_0x3cdcb2,!![]);}catch(_0x3f033d){return BPromise[_0x7d83('0x24')](_0x3f033d);}return _0x50856a[_0x7d83('0x25')]();};}function saveUpdates(_0x22b0b7,_0x162320){return function(_0x12d2b6){if(_0x12d2b6){return _0x12d2b6[_0x7d83('0x26')](_0x22b0b7)['then'](function(_0x5dc560){return _0x5dc560;});}return null;};}function removeEntity(_0xe65f5e,_0x1329aa){return function(_0x44e0bb){if(_0x44e0bb){return _0x44e0bb[_0x7d83('0x27')]()['then'](function(){_0xe65f5e[_0x7d83('0x1b')](0xcc)[_0x7d83('0x1a')]();});}};}function handleEntityNotFound(_0x1d03a5,_0x1ad336){return function(_0x1aebb4){if(!_0x1aebb4){_0x1d03a5[_0x7d83('0x28')](0x194);}return _0x1aebb4;};}function handleError(_0x266033,_0x3b921e){_0x3b921e=_0x3b921e||0x1f4;return function(_0x1c251c){logger[_0x7d83('0x29')](_0x1c251c[_0x7d83('0x2a')]);if(_0x1c251c[_0x7d83('0x2b')]){delete _0x1c251c[_0x7d83('0x2b')];}_0x266033[_0x7d83('0x1b')](_0x3b921e)['send'](_0x1c251c);};}exports['index']=function(_0xac4328,_0x4489f4){var _0x8b464c={},_0x530067={},_0x2e2d7a={'count':0x0,'rows':[]};var _0x56a0ce=_[_0x7d83('0x2c')](db[_0x7d83('0x2d')][_0x7d83('0x2e')],function(_0x59570e){return{'name':_0x59570e[_0x7d83('0x2f')],'type':_0x59570e['type'][_0x7d83('0x30')]};});_0x530067[_0x7d83('0x31')]=_[_0x7d83('0x2c')](_0x56a0ce,_0x7d83('0x2b'));_0x530067[_0x7d83('0x32')]=_[_0x7d83('0x33')](_0xac4328[_0x7d83('0x32')]);_0x530067[_0x7d83('0x34')]=_[_0x7d83('0x35')](_0x530067[_0x7d83('0x31')],_0x530067['query']);_0x8b464c[_0x7d83('0x36')]=_[_0x7d83('0x35')](_0x530067['model'],qs['fields'](_0xac4328['query']['fields']));_0x8b464c['attributes']=_0x8b464c[_0x7d83('0x36')][_0x7d83('0x37')]?_0x8b464c[_0x7d83('0x36')]:_0x530067['model'];if(!_0xac4328[_0x7d83('0x32')][_0x7d83('0x38')](_0x7d83('0x39'))){_0x8b464c[_0x7d83('0x1f')]=qs[_0x7d83('0x1f')](_0xac4328[_0x7d83('0x32')]['limit']);_0x8b464c[_0x7d83('0x1c')]=qs['offset'](_0xac4328[_0x7d83('0x32')][_0x7d83('0x1c')]);}_0x8b464c['order']=qs[_0x7d83('0x3a')](_0xac4328[_0x7d83('0x32')]['sort']);_0x8b464c['where']=qs[_0x7d83('0x34')](_[_0x7d83('0x3b')](_0xac4328[_0x7d83('0x32')],_0x530067[_0x7d83('0x34')]),_0x56a0ce);if(_0xac4328['query']['filter']){_0x8b464c[_0x7d83('0x3c')]=_[_0x7d83('0x3d')](_0x8b464c[_0x7d83('0x3c')],{'$or':_[_0x7d83('0x2c')](_0x56a0ce,function(_0x40a1a9){if(_0x40a1a9[_0x7d83('0x3e')]!==_0x7d83('0x3f')){var _0x55b17d={};_0x55b17d[_0x40a1a9[_0x7d83('0x2b')]]={'$like':'%'+_0xac4328[_0x7d83('0x32')]['filter']+'%'};return _0x55b17d;}})});}_0x8b464c=_['merge']({},_0x8b464c,_0xac4328['options']);var _0x429ff3={'where':_0x8b464c[_0x7d83('0x3c')]};return db['DeskField'][_0x7d83('0x1e')](_0x429ff3)[_0x7d83('0x40')](function(_0x26aec3){_0x2e2d7a[_0x7d83('0x1e')]=_0x26aec3;if(_0xac4328[_0x7d83('0x32')][_0x7d83('0x41')]){_0x8b464c[_0x7d83('0x42')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x8b464c);})[_0x7d83('0x40')](function(_0x57010d){_0x2e2d7a[_0x7d83('0x43')]=_0x57010d;return _0x2e2d7a;})[_0x7d83('0x40')](respondWithFilteredResult(_0x4489f4,_0x8b464c))['catch'](handleError(_0x4489f4,null));};exports['show']=function(_0x1085ce,_0x41f111){var _0xed233a={'raw':!![],'where':{'id':_0x1085ce[_0x7d83('0x44')]['id']}},_0x5b3892={};_0x5b3892['model']=_[_0x7d83('0x33')](db[_0x7d83('0x2d')]['rawAttributes']);_0x5b3892['query']=_[_0x7d83('0x33')](_0x1085ce[_0x7d83('0x32')]);_0x5b3892[_0x7d83('0x34')]=_[_0x7d83('0x35')](_0x5b3892[_0x7d83('0x31')],_0x5b3892['query']);_0xed233a[_0x7d83('0x36')]=_[_0x7d83('0x35')](_0x5b3892[_0x7d83('0x31')],qs['fields'](_0x1085ce['query'][_0x7d83('0x45')]));_0xed233a[_0x7d83('0x36')]=_0xed233a[_0x7d83('0x36')]['length']?_0xed233a[_0x7d83('0x36')]:_0x5b3892[_0x7d83('0x31')];if(_0x1085ce['query'][_0x7d83('0x41')]){_0xed233a[_0x7d83('0x42')]=[{'all':!![]}];}_0xed233a=_[_0x7d83('0x3d')]({},_0xed233a,_0x1085ce[_0x7d83('0x46')]);return db[_0x7d83('0x2d')][_0x7d83('0x47')](_0xed233a)['then'](handleEntityNotFound(_0x41f111,null))[_0x7d83('0x40')](respondWithResult(_0x41f111,null))[_0x7d83('0x48')](handleError(_0x41f111,null));};exports[_0x7d83('0x49')]=function(_0x4c1e55,_0x3d2cad){return db[_0x7d83('0x2d')][_0x7d83('0x49')](_0x4c1e55[_0x7d83('0x4a')],{})[_0x7d83('0x40')](respondWithResult(_0x3d2cad,0xc9))[_0x7d83('0x48')](handleError(_0x3d2cad,null));};exports['update']=function(_0x112f7a,_0x85e8e6){if(_0x112f7a[_0x7d83('0x4a')]['id']){delete _0x112f7a['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x112f7a['params']['id']}})['then'](handleEntityNotFound(_0x85e8e6,null))['then'](saveUpdates(_0x112f7a[_0x7d83('0x4a')],null))[_0x7d83('0x40')](respondWithResult(_0x85e8e6,null))['catch'](handleError(_0x85e8e6,null));};exports[_0x7d83('0x27')]=function(_0x3431b7,_0x1d0fd9){return db[_0x7d83('0x2d')]['find']({'where':{'id':_0x3431b7[_0x7d83('0x44')]['id']}})[_0x7d83('0x40')](handleEntityNotFound(_0x1d0fd9,null))[_0x7d83('0x40')](removeEntity(_0x1d0fd9,null))[_0x7d83('0x48')](handleError(_0x1d0fd9,null));}; \ No newline at end of file +var _0xb6c9=['moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','params','eml-format','fast-json-patch'];(function(_0x1ee7bc,_0x3ea40d){var _0x494a38=function(_0x36b7ff){while(--_0x36b7ff){_0x1ee7bc['push'](_0x1ee7bc['shift']());}};_0x494a38(++_0x3ea40d);}(_0xb6c9,0x152));var _0x9b6c=function(_0x1dfe96,_0xacd7bf){_0x1dfe96=_0x1dfe96-0x0;var _0x23bb8a=_0xb6c9[_0x1dfe96];return _0x23bb8a;};'use strict';var emlformat=require(_0x9b6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b6c('0x1'));var rp=require('request-promise');var moment=require(_0x9b6c('0x2'));var BPromise=require(_0x9b6c('0x3'));var Mustache=require(_0x9b6c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9b6c('0x5'));var csv=require(_0x9b6c('0x6'));var ejs=require(_0x9b6c('0x7'));var fs=require('fs');var fs_extra=require(_0x9b6c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b6c('0x6'));var querystring=require('querystring');var Papa=require(_0x9b6c('0x9'));var Redis=require('ioredis');var authService=require(_0x9b6c('0xa'));var qs=require(_0x9b6c('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b6c('0xc'));var logger=require(_0x9b6c('0xd'))('api');var utils=require(_0x9b6c('0xe'));var config=require(_0x9b6c('0xf'));var licenseUtil=require(_0x9b6c('0x10'));var db=require(_0x9b6c('0x11'))['db'];function respondWithStatusCode(_0x25bb1f,_0x233254){_0x233254=_0x233254||0xcc;return function(_0x53cf85){if(_0x53cf85){return _0x25bb1f[_0x9b6c('0x12')](_0x233254);}return _0x25bb1f['status'](_0x233254)[_0x9b6c('0x13')]();};}function respondWithResult(_0x389425,_0x5683eb){_0x5683eb=_0x5683eb||0xc8;return function(_0x97fc98){if(_0x97fc98){return _0x389425['status'](_0x5683eb)[_0x9b6c('0x14')](_0x97fc98);}};}function respondWithFilteredResult(_0x502f5d,_0xe61b4b){return function(_0x284955){if(_0x284955){var _0x467fcb=typeof _0xe61b4b[_0x9b6c('0x15')]==='undefined'&&typeof _0xe61b4b[_0x9b6c('0x16')]===_0x9b6c('0x17');var _0x47ecce=_0x284955[_0x9b6c('0x18')];var _0x438065=_0x467fcb?0x0:_0xe61b4b[_0x9b6c('0x15')];var _0x456b41=_0x467fcb?_0x284955[_0x9b6c('0x18')]:_0xe61b4b[_0x9b6c('0x15')]+_0xe61b4b[_0x9b6c('0x16')];var _0x169969;if(_0x456b41>=_0x47ecce){_0x456b41=_0x47ecce;_0x169969=0xc8;}else{_0x169969=0xce;}_0x502f5d[_0x9b6c('0x19')](_0x169969);return _0x502f5d[_0x9b6c('0x1a')](_0x9b6c('0x1b'),_0x438065+'-'+_0x456b41+'/'+_0x47ecce)[_0x9b6c('0x14')](_0x284955);}return null;};}function patchUpdates(_0x58d303){return function(_0x341631){try{jsonpatch[_0x9b6c('0x1c')](_0x341631,_0x58d303,!![]);}catch(_0x271181){return BPromise[_0x9b6c('0x1d')](_0x271181);}return _0x341631[_0x9b6c('0x1e')]();};}function saveUpdates(_0x4b1d0d,_0x532596){return function(_0x113558){if(_0x113558){return _0x113558[_0x9b6c('0x1f')](_0x4b1d0d)[_0x9b6c('0x20')](function(_0x33f7fa){return _0x33f7fa;});}return null;};}function removeEntity(_0x2be9d,_0x1b9e64){return function(_0x2c5318){if(_0x2c5318){return _0x2c5318[_0x9b6c('0x21')]()[_0x9b6c('0x20')](function(){_0x2be9d[_0x9b6c('0x19')](0xcc)[_0x9b6c('0x13')]();});}};}function handleEntityNotFound(_0x5a2ae9,_0xce48bc){return function(_0x65a7c0){if(!_0x65a7c0){_0x5a2ae9[_0x9b6c('0x12')](0x194);}return _0x65a7c0;};}function handleError(_0x54056f,_0x3655c2){_0x3655c2=_0x3655c2||0x1f4;return function(_0xacafba){logger[_0x9b6c('0x22')](_0xacafba['stack']);if(_0xacafba[_0x9b6c('0x23')]){delete _0xacafba['name'];}_0x54056f[_0x9b6c('0x19')](_0x3655c2)['send'](_0xacafba);};}exports[_0x9b6c('0x24')]=function(_0x16c6b9,_0x1ca869){var _0x57c671={},_0x4de877={},_0x1bda2d={'count':0x0,'rows':[]};var _0x57c7c8=_['map'](db[_0x9b6c('0x25')][_0x9b6c('0x26')],function(_0x3ef62c){return{'name':_0x3ef62c[_0x9b6c('0x27')],'type':_0x3ef62c[_0x9b6c('0x28')][_0x9b6c('0x29')]};});_0x4de877[_0x9b6c('0x2a')]=_[_0x9b6c('0x2b')](_0x57c7c8,_0x9b6c('0x23'));_0x4de877[_0x9b6c('0x2c')]=_['keys'](_0x16c6b9[_0x9b6c('0x2c')]);_0x4de877['filters']=_[_0x9b6c('0x2d')](_0x4de877[_0x9b6c('0x2a')],_0x4de877[_0x9b6c('0x2c')]);_0x57c671['attributes']=_[_0x9b6c('0x2d')](_0x4de877[_0x9b6c('0x2a')],qs[_0x9b6c('0x2e')](_0x16c6b9[_0x9b6c('0x2c')]['fields']));_0x57c671['attributes']=_0x57c671[_0x9b6c('0x2f')][_0x9b6c('0x30')]?_0x57c671[_0x9b6c('0x2f')]:_0x4de877[_0x9b6c('0x2a')];if(!_0x16c6b9['query']['hasOwnProperty']('nolimit')){_0x57c671[_0x9b6c('0x16')]=qs[_0x9b6c('0x16')](_0x16c6b9[_0x9b6c('0x2c')][_0x9b6c('0x16')]);_0x57c671[_0x9b6c('0x15')]=qs['offset'](_0x16c6b9[_0x9b6c('0x2c')][_0x9b6c('0x15')]);}_0x57c671['order']=qs['sort'](_0x16c6b9[_0x9b6c('0x2c')][_0x9b6c('0x31')]);_0x57c671['where']=qs[_0x9b6c('0x32')](_[_0x9b6c('0x33')](_0x16c6b9[_0x9b6c('0x2c')],_0x4de877[_0x9b6c('0x32')]),_0x57c7c8);if(_0x16c6b9[_0x9b6c('0x2c')]['filter']){_0x57c671[_0x9b6c('0x34')]=_[_0x9b6c('0x35')](_0x57c671[_0x9b6c('0x34')],{'$or':_[_0x9b6c('0x2b')](_0x57c7c8,function(_0x158962){if(_0x158962[_0x9b6c('0x28')]!==_0x9b6c('0x36')){var _0x3175e3={};_0x3175e3[_0x158962[_0x9b6c('0x23')]]={'$like':'%'+_0x16c6b9[_0x9b6c('0x2c')][_0x9b6c('0x37')]+'%'};return _0x3175e3;}})});}_0x57c671=_['merge']({},_0x57c671,_0x16c6b9['options']);var _0x4ffd07={'where':_0x57c671[_0x9b6c('0x34')]};return db[_0x9b6c('0x25')][_0x9b6c('0x18')](_0x4ffd07)[_0x9b6c('0x20')](function(_0x17d46f){_0x1bda2d['count']=_0x17d46f;if(_0x16c6b9[_0x9b6c('0x2c')][_0x9b6c('0x38')]){_0x57c671[_0x9b6c('0x39')]=[{'all':!![]}];}return db[_0x9b6c('0x25')][_0x9b6c('0x3a')](_0x57c671);})[_0x9b6c('0x20')](function(_0x3a77f6){_0x1bda2d[_0x9b6c('0x3b')]=_0x3a77f6;return _0x1bda2d;})[_0x9b6c('0x20')](respondWithFilteredResult(_0x1ca869,_0x57c671))['catch'](handleError(_0x1ca869,null));};exports[_0x9b6c('0x3c')]=function(_0x2c6934,_0x14c71e){var _0x2ccb9d={'raw':!![],'where':{'id':_0x2c6934['params']['id']}},_0x15c271={};_0x15c271[_0x9b6c('0x2a')]=_[_0x9b6c('0x3d')](db[_0x9b6c('0x25')][_0x9b6c('0x26')]);_0x15c271[_0x9b6c('0x2c')]=_[_0x9b6c('0x3d')](_0x2c6934[_0x9b6c('0x2c')]);_0x15c271['filters']=_[_0x9b6c('0x2d')](_0x15c271[_0x9b6c('0x2a')],_0x15c271['query']);_0x2ccb9d[_0x9b6c('0x2f')]=_[_0x9b6c('0x2d')](_0x15c271['model'],qs[_0x9b6c('0x2e')](_0x2c6934[_0x9b6c('0x2c')][_0x9b6c('0x2e')]));_0x2ccb9d[_0x9b6c('0x2f')]=_0x2ccb9d[_0x9b6c('0x2f')][_0x9b6c('0x30')]?_0x2ccb9d[_0x9b6c('0x2f')]:_0x15c271['model'];if(_0x2c6934[_0x9b6c('0x2c')][_0x9b6c('0x38')]){_0x2ccb9d[_0x9b6c('0x39')]=[{'all':!![]}];}_0x2ccb9d=_[_0x9b6c('0x35')]({},_0x2ccb9d,_0x2c6934[_0x9b6c('0x3e')]);return db[_0x9b6c('0x25')][_0x9b6c('0x3f')](_0x2ccb9d)[_0x9b6c('0x20')](handleEntityNotFound(_0x14c71e,null))['then'](respondWithResult(_0x14c71e,null))[_0x9b6c('0x40')](handleError(_0x14c71e,null));};exports[_0x9b6c('0x41')]=function(_0x208a90,_0x1370ec){return db[_0x9b6c('0x25')][_0x9b6c('0x41')](_0x208a90[_0x9b6c('0x42')],{})[_0x9b6c('0x20')](respondWithResult(_0x1370ec,0xc9))[_0x9b6c('0x40')](handleError(_0x1370ec,null));};exports['update']=function(_0x480e3e,_0x41756b){if(_0x480e3e[_0x9b6c('0x42')]['id']){delete _0x480e3e[_0x9b6c('0x42')]['id'];}return db['DeskField'][_0x9b6c('0x3f')]({'where':{'id':_0x480e3e[_0x9b6c('0x43')]['id']}})[_0x9b6c('0x20')](handleEntityNotFound(_0x41756b,null))[_0x9b6c('0x20')](saveUpdates(_0x480e3e[_0x9b6c('0x42')],null))[_0x9b6c('0x20')](respondWithResult(_0x41756b,null))['catch'](handleError(_0x41756b,null));};exports[_0x9b6c('0x21')]=function(_0x362777,_0x50c927){return db[_0x9b6c('0x25')][_0x9b6c('0x3f')]({'where':{'id':_0x362777[_0x9b6c('0x43')]['id']}})[_0x9b6c('0x20')](handleEntityNotFound(_0x50c927,null))[_0x9b6c('0x20')](removeEntity(_0x50c927,null))[_0x9b6c('0x40')](handleError(_0x50c927,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 35daebd..73daffa 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 _0x1797=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index'];(function(_0x2b8f18,_0x2d70ed){var _0x1bc8cf=function(_0x5166df){while(--_0x5166df){_0x2b8f18['push'](_0x2b8f18['shift']());}};_0x1bc8cf(++_0x2d70ed);}(_0x1797,0x119));var _0x7179=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1797[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x7179('0x0'));var util=require(_0x7179('0x1'));var logger=require(_0x7179('0x2'))(_0x7179('0x3'));var moment=require(_0x7179('0x4'));var BPromise=require(_0x7179('0x5'));var rp=require(_0x7179('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7179('0x7'));var config=require(_0x7179('0x8'));var attributes=require(_0x7179('0x9'));module[_0x7179('0xa')]=function(_0xebb0ae,_0x385289){return _0xebb0ae['define']('DeskField',attributes,{'tableName':_0x7179('0xb'),'paranoid':![],'indexes':[{'name':_0x7179('0xc'),'fields':[_0x7179('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf86c=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x527db4,_0x21717f){var _0x2b5e46=function(_0x4aee20){while(--_0x4aee20){_0x527db4['push'](_0x527db4['shift']());}};_0x2b5e46(++_0x21717f);}(_0xf86c,0x93));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf86('0x0'));var util=require('util');var logger=require(_0xcf86('0x1'))('api');var moment=require(_0xcf86('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf86('0x3'));var fs=require('fs');var path=require(_0xcf86('0x4'));var rimraf=require(_0xcf86('0x5'));var config=require(_0xcf86('0x6'));var attributes=require(_0xcf86('0x7'));module[_0xcf86('0x8')]=function(_0x89e093,_0x36b0b3){return _0x89e093[_0xcf86('0x9')](_0xcf86('0xa'),attributes,{'tableName':_0xcf86('0xb'),'paranoid':![],'indexes':[{'name':_0xcf86('0xc'),'fields':[_0xcf86('0xd'),_0xcf86('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index b66a5af..e37eba0 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 _0xdd7c=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','client','info'];(function(_0x3c7f3f,_0x7499cd){var _0x3b789a=function(_0x30055e){while(--_0x30055e){_0x3c7f3f['push'](_0x3c7f3f['shift']());}};_0x3b789a(++_0x7499cd);}(_0xdd7c,0x191));var _0xcdd7=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0xdd7c[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0xcdd7('0x0'));var util=require('util');var moment=require(_0xcdd7('0x1'));var BPromise=require(_0xcdd7('0x2'));var rs=require(_0xcdd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdd7('0x4'))['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[_0xcdd7('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7190,_0x33ccbd,_0x8498d7){return new BPromise(function(_0x175ac6,_0x25dc0e){return client['request'](_0x3d7190,_0x8498d7)['then'](function(_0x417c44){logger[_0xcdd7('0x6')]('DeskField,\x20%s,\x20%s',_0x33ccbd,_0xcdd7('0x7'));logger[_0xcdd7('0x8')](_0xcdd7('0x9'),_0x33ccbd,'request\x20sent',JSON[_0xcdd7('0xa')](_0x417c44));if(_0x417c44[_0xcdd7('0xb')]){if(_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xc')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x33ccbd,_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xd')]);return _0x25dc0e(_0x417c44[_0xcdd7('0xb')]['message']);}logger[_0xcdd7('0xb')]('DeskField,\x20%s,\x20%s',_0x33ccbd,_0x417c44[_0xcdd7('0xb')][_0xcdd7('0xd')]);return _0x175ac6(_0x417c44['error'][_0xcdd7('0xd')]);}else{logger['info'](_0xcdd7('0xe'),_0x33ccbd,'request\x20sent');_0x175ac6(_0x417c44[_0xcdd7('0xf')][_0xcdd7('0xd')]);}})[_0xcdd7('0x10')](function(_0x51ad84){logger[_0xcdd7('0xb')](_0xcdd7('0xe'),_0x33ccbd,_0x51ad84);_0x25dc0e(_0x51ad84);});});} \ No newline at end of file +var _0x8e16=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskField,\x20%s,\x20%s'];(function(_0x42f5bc,_0x49f3b5){var _0x23ab80=function(_0x6b2d94){while(--_0x6b2d94){_0x42f5bc['push'](_0x42f5bc['shift']());}};_0x23ab80(++_0x49f3b5);}(_0x8e16,0x1d2));var _0x68e1=function(_0x18bdcb,_0x4036dd){_0x18bdcb=_0x18bdcb-0x0;var _0x365df6=_0x8e16[_0x18bdcb];return _0x365df6;};'use strict';var _=require('lodash');var util=require(_0x68e1('0x0'));var moment=require(_0x68e1('0x1'));var BPromise=require(_0x68e1('0x2'));var rs=require(_0x68e1('0x3'));var fs=require('fs');var Redis=require(_0x68e1('0x4'));var db=require(_0x68e1('0x5'))['db'];var utils=require(_0x68e1('0x6'));var logger=require(_0x68e1('0x7'))(_0x68e1('0x8'));var config=require(_0x68e1('0x9'));var jayson=require(_0x68e1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45cc32,_0x2a42bf,_0x20fc9d){return new BPromise(function(_0x33ed76,_0x1ebbc5){return client['request'](_0x45cc32,_0x20fc9d)[_0x68e1('0xb')](function(_0x39f594){logger[_0x68e1('0xc')](_0x68e1('0xd'),_0x2a42bf,_0x68e1('0xe'));logger[_0x68e1('0xf')](_0x68e1('0x10'),_0x2a42bf,_0x68e1('0xe'),JSON[_0x68e1('0x11')](_0x39f594));if(_0x39f594[_0x68e1('0x12')]){if(_0x39f594['error']['code']===0x1f4){logger['error'](_0x68e1('0xd'),_0x2a42bf,_0x39f594[_0x68e1('0x12')][_0x68e1('0x13')]);return _0x1ebbc5(_0x39f594[_0x68e1('0x12')][_0x68e1('0x13')]);}logger[_0x68e1('0x12')](_0x68e1('0xd'),_0x2a42bf,_0x39f594[_0x68e1('0x12')][_0x68e1('0x13')]);return _0x33ed76(_0x39f594['error']['message']);}else{logger[_0x68e1('0xc')](_0x68e1('0xd'),_0x2a42bf,'request\x20sent');_0x33ed76(_0x39f594['result'][_0x68e1('0x13')]);}})['catch'](function(_0x44ee1b){logger[_0x68e1('0x12')](_0x68e1('0xd'),_0x2a42bf,_0x44ee1b);_0x1ebbc5(_0x44ee1b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3c1dadf..d808d14 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 _0xf853=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xf94cab,_0x372d18){var _0x212f56=function(_0x2642d0){while(--_0x2642d0){_0xf94cab['push'](_0xf94cab['shift']());}};_0x212f56(++_0x372d18);}(_0xf853,0xcb));var _0x3f85=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0xf853[_0x585d09];return _0x7d9a14;};'use strict';var multer=require(_0x3f85('0x0'));var util=require(_0x3f85('0x1'));var path=require(_0x3f85('0x2'));var timeout=require(_0x3f85('0x3'));var express=require(_0x3f85('0x4'));var router=express[_0x3f85('0x5')]();var fs_extra=require(_0x3f85('0x6'));var auth=require(_0x3f85('0x7'));var interaction=require(_0x3f85('0x8'));var config=require(_0x3f85('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3f85('0xa')]);router[_0x3f85('0xb')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0xe')]);router[_0x3f85('0xb')](_0x3f85('0xf'),auth['isAuthenticated'](),controller[_0x3f85('0x10')]);router[_0x3f85('0xb')](_0x3f85('0x11'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x12')]);router[_0x3f85('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f85('0x13')](_0x3f85('0xf'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x14')]);router[_0x3f85('0x15')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x16')]);router[_0x3f85('0x17')](_0x3f85('0xc'),auth[_0x3f85('0xd')](),controller[_0x3f85('0x18')]);module[_0x3f85('0x19')]=router; \ No newline at end of file +var _0x3de6=['addConfiguration','put','update','delete','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3de6,0x73));var _0x63de=function(_0x35958e,_0x22d8b5){_0x35958e=_0x35958e-0x0;var _0x366337=_0x3de6[_0x35958e];return _0x366337;};'use strict';var multer=require(_0x63de('0x0'));var util=require(_0x63de('0x1'));var path=require(_0x63de('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x63de('0x3'));var interaction=require(_0x63de('0x4'));var config=require(_0x63de('0x5'));var controller=require(_0x63de('0x6'));router[_0x63de('0x7')]('/',auth[_0x63de('0x8')](),controller[_0x63de('0x9')]);router[_0x63de('0x7')](_0x63de('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x63de('0x7')](_0x63de('0xb'),auth[_0x63de('0x8')](),controller[_0x63de('0xc')]);router[_0x63de('0x7')](_0x63de('0xd'),auth[_0x63de('0x8')](),controller[_0x63de('0xe')]);router[_0x63de('0xf')]('/',auth[_0x63de('0x8')](),controller[_0x63de('0x10')]);router[_0x63de('0xf')](_0x63de('0xb'),auth[_0x63de('0x8')](),controller[_0x63de('0x11')]);router[_0x63de('0x12')](_0x63de('0xa'),auth[_0x63de('0x8')](),controller[_0x63de('0x13')]);router[_0x63de('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x63de('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3d18705..d7bd86b 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 _0x5a93=['exports','STRING','BOOLEAN'];(function(_0x7e7dd8,_0x5c00a9){var _0x2772ed=function(_0x1fc371){while(--_0x1fc371){_0x7e7dd8['push'](_0x7e7dd8['shift']());}};_0x2772ed(++_0x5c00a9);}(_0x5a93,0xf6));var _0x35a9=function(_0x8728f0,_0x45c302){_0x8728f0=_0x8728f0-0x0;var _0x292c15=_0x5a93[_0x8728f0];return _0x292c15;};'use strict';var Sequelize=require('sequelize');module[_0x35a9('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x35a9('0x1')]},'password':{'type':Sequelize[_0x35a9('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x35a9('0x1')]},'clientSecret':{'type':Sequelize[_0x35a9('0x1')]},'serverUrl':{'type':Sequelize[_0x35a9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x35a9('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa0a1=['STRING','BOOLEAN','sequelize'];(function(_0x2d8eac,_0x4d2f89){var _0x4af6a7=function(_0x1519da){while(--_0x1519da){_0x2d8eac['push'](_0x2d8eac['shift']());}};_0x4af6a7(++_0x4d2f89);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x57eace,_0x52a51a){_0x57eace=_0x57eace-0x0;var _0xd53fdd=_0xa0a1[_0x57eace];return _0xd53fdd;};'use strict';var Sequelize=require(_0x1a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a0a('0x1')]},'username':{'type':Sequelize[_0x1a0a('0x1')]},'password':{'type':Sequelize[_0x1a0a('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1a0a('0x1')]},'clientSecret':{'type':Sequelize[_0x1a0a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1a0a('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1a0a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 68235b9..ea46a2d 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 _0x7ef2=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','destroy','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','statusCode','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','DisplayName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys'];(function(_0x59e3e2,_0x1f809b){var _0xb9814e=function(_0x2b22bb){while(--_0x2b22bb){_0x59e3e2['push'](_0x59e3e2['shift']());}};_0xb9814e(++_0x1f809b);}(_0x7ef2,0x15d));var _0x27ef=function(_0x57ada9,_0x34e9e7){_0x57ada9=_0x57ada9-0x0;var _0x5dd266=_0x7ef2[_0x57ada9];return _0x5dd266;};'use strict';var rp=require(_0x27ef('0x0'));var util=require('util');var _=require(_0x27ef('0x1'));var qs=require(_0x27ef('0x2'));var logger=require('../../config/logger')(_0x27ef('0x3'));var db=require(_0x27ef('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x567b7a,_0x424685){_0x424685=_0x424685||0xc8;return function(_0x2ac02a){if(_0x2ac02a){return _0x567b7a['status'](_0x424685)[_0x27ef('0x5')](_0x2ac02a);}};}function respondWithFilteredResult(_0x294340,_0x285292){return function(_0x563446){if(_0x563446){var _0x133d91=typeof _0x285292[_0x27ef('0x6')]===_0x27ef('0x7')&&typeof _0x285292[_0x27ef('0x8')]===_0x27ef('0x7');var _0x4ec4e5=_0x563446[_0x27ef('0x9')];var _0x481aec=_0x133d91?0x0:_0x285292[_0x27ef('0x6')];var _0x484660=_0x133d91?_0x563446[_0x27ef('0x9')]:_0x285292['offset']+_0x285292[_0x27ef('0x8')];var _0x277c2b;if(_0x484660>=_0x4ec4e5){_0x484660=_0x4ec4e5;_0x277c2b=0xc8;}else{_0x277c2b=0xce;}_0x294340[_0x27ef('0xa')](_0x277c2b);return _0x294340[_0x27ef('0xb')](_0x27ef('0xc'),_0x481aec+'-'+_0x484660+'/'+_0x4ec4e5)[_0x27ef('0x5')](_0x563446);}return null;};}function saveUpdates(_0x29f976){return function(_0x52d93d){if(_0x52d93d){return _0x52d93d[_0x27ef('0xd')](_0x29f976)[_0x27ef('0xe')](function(_0x336247){return _0x336247;});}return null;};}function removeEntity(_0x52af16){return function(_0x4784d1){if(_0x4784d1){return _0x4784d1['destroy']()[_0x27ef('0xe')](function(){_0x52af16[_0x27ef('0xa')](0xcc)[_0x27ef('0xf')]();});}};}function handleEntityNotFound(_0x4bf112){return function(_0x448240){if(!_0x448240){_0x4bf112[_0x27ef('0x10')](0x194);}return _0x448240;};}function handleError(_0x21bfb9,_0x44745a){_0x44745a=_0x44745a||0x1f4;return function(_0x1d2803){logger[_0x27ef('0x11')](_0x1d2803[_0x27ef('0x12')]);if(_0x1d2803[_0x27ef('0x13')]){delete _0x1d2803['name'];}_0x21bfb9[_0x27ef('0xa')](_0x44745a)[_0x27ef('0x14')](_0x1d2803);};}exports[_0x27ef('0x15')]=function(_0x217368,_0x22d171){var _0x573ec5={},_0xe344fa={},_0xa2911a={'count':0x0,'rows':[]};var _0x50a11a=_[_0x27ef('0x16')](db[_0x27ef('0x17')]['rawAttributes'],function(_0x13a3fd){return{'name':_0x13a3fd[_0x27ef('0x18')],'type':_0x13a3fd[_0x27ef('0x19')][_0x27ef('0x1a')]};});_0xe344fa['model']=_['map'](_0x50a11a,_0x27ef('0x13'));_0xe344fa[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0x217368[_0x27ef('0x1b')]);_0xe344fa[_0x27ef('0x1d')]=_[_0x27ef('0x1e')](_0xe344fa[_0x27ef('0x1f')],_0xe344fa[_0x27ef('0x1b')]);_0x573ec5[_0x27ef('0x20')]=_[_0x27ef('0x1e')](_0xe344fa[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0x217368[_0x27ef('0x1b')][_0x27ef('0x21')]));_0x573ec5[_0x27ef('0x20')]=_0x573ec5[_0x27ef('0x20')][_0x27ef('0x22')]?_0x573ec5[_0x27ef('0x20')]:_0xe344fa[_0x27ef('0x1f')];if(!_0x217368[_0x27ef('0x1b')][_0x27ef('0x23')](_0x27ef('0x24'))){_0x573ec5['limit']=qs[_0x27ef('0x8')](_0x217368[_0x27ef('0x1b')][_0x27ef('0x8')]);_0x573ec5[_0x27ef('0x6')]=qs[_0x27ef('0x6')](_0x217368['query']['offset']);}_0x573ec5[_0x27ef('0x25')]=qs[_0x27ef('0x26')](_0x217368['query'][_0x27ef('0x26')]);_0x573ec5[_0x27ef('0x27')]=qs['filters'](_[_0x27ef('0x28')](_0x217368[_0x27ef('0x1b')],_0xe344fa['filters']),_0x50a11a);if(_0x217368[_0x27ef('0x1b')][_0x27ef('0x29')]){_0x573ec5['where']=_[_0x27ef('0x2a')](_0x573ec5[_0x27ef('0x27')],{'$or':_[_0x27ef('0x16')](_0x50a11a,function(_0x9f1e16){if(_0x9f1e16[_0x27ef('0x19')]!==_0x27ef('0x2b')){var _0x53eb8a={};_0x53eb8a[_0x9f1e16[_0x27ef('0x13')]]={'$like':'%'+_0x217368[_0x27ef('0x1b')][_0x27ef('0x29')]+'%'};return _0x53eb8a;}})});}_0x573ec5=_[_0x27ef('0x2a')]({},_0x573ec5,_0x217368['options']);var _0x239c5e={'where':_0x573ec5[_0x27ef('0x27')]};return db[_0x27ef('0x17')]['count'](_0x239c5e)[_0x27ef('0xe')](function(_0x424bf2){_0xa2911a[_0x27ef('0x9')]=_0x424bf2;if(_0x217368[_0x27ef('0x1b')][_0x27ef('0x2c')]){_0x573ec5[_0x27ef('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x27ef('0x2e')](_0x573ec5);})[_0x27ef('0xe')](function(_0x2676d7){_0xa2911a[_0x27ef('0x2f')]=_0x2676d7;return _0xa2911a;})[_0x27ef('0xe')](respondWithFilteredResult(_0x22d171,_0x573ec5))[_0x27ef('0x30')](handleError(_0x22d171,null));};exports['show']=function(_0x5ea24a,_0x8e0e22){var _0x6e9e36={'raw':![],'where':{'id':_0x5ea24a[_0x27ef('0x31')]['id']}},_0x43a368={};_0x43a368['model']=_['keys'](db[_0x27ef('0x17')][_0x27ef('0x32')]);_0x43a368[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0x5ea24a['query']);_0x43a368[_0x27ef('0x1d')]=_['intersection'](_0x43a368[_0x27ef('0x1f')],_0x43a368['query']);_0x6e9e36[_0x27ef('0x20')]=_['intersection'](_0x43a368[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0x5ea24a['query'][_0x27ef('0x21')]));_0x6e9e36[_0x27ef('0x20')]=_0x6e9e36[_0x27ef('0x20')][_0x27ef('0x22')]?_0x6e9e36[_0x27ef('0x20')]:_0x43a368[_0x27ef('0x1f')];if(_0x5ea24a[_0x27ef('0x1b')][_0x27ef('0x2c')]){_0x6e9e36[_0x27ef('0x2d')]=[{'all':!![]}];}_0x6e9e36=_['merge']({},_0x6e9e36,_0x5ea24a[_0x27ef('0x33')]);return db[_0x27ef('0x17')]['find'](_0x6e9e36)[_0x27ef('0xe')](handleEntityNotFound(_0x8e0e22,null))['then'](respondWithResult(_0x8e0e22,null))[_0x27ef('0x30')](handleError(_0x8e0e22,null));};exports[_0x27ef('0x34')]=function(_0x4e6ab1,_0x3326ac){return db[_0x27ef('0x17')][_0x27ef('0x34')](_0x4e6ab1['body'],{})['then'](respondWithResult(_0x3326ac,0xc9))[_0x27ef('0x30')](handleError(_0x3326ac,null));};exports[_0x27ef('0xd')]=function(_0x39aae5,_0x436f64){if(_0x39aae5[_0x27ef('0x35')]['id']){delete _0x39aae5[_0x27ef('0x35')]['id'];}return db[_0x27ef('0x17')]['find']({'where':{'id':_0x39aae5[_0x27ef('0x31')]['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x436f64,null))[_0x27ef('0xe')](saveUpdates(_0x39aae5[_0x27ef('0x35')],null))['then'](respondWithResult(_0x436f64,null))[_0x27ef('0x30')](handleError(_0x436f64,null));};exports[_0x27ef('0x36')]=function(_0x1650da,_0x58469b){return db['Dynamics365Account'][_0x27ef('0x37')]({'where':{'id':_0x1650da['params']['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x58469b,null))[_0x27ef('0xe')](removeEntity(_0x58469b,null))['catch'](handleError(_0x58469b,null));};exports[_0x27ef('0x38')]=function(_0xc4f502,_0x1c1c04){var _0x38ef69={};var _0x3955dc={};var _0x5b5899;var _0x2020d5;return db[_0x27ef('0x17')][_0x27ef('0x39')]({'where':{'id':_0xc4f502[_0x27ef('0x31')]['id']}})['then'](handleEntityNotFound(_0x1c1c04,null))[_0x27ef('0xe')](function(_0x3e054c){if(_0x3e054c){_0x5b5899=_0x3e054c;_0x3955dc[_0x27ef('0x1f')]=_['keys'](db[_0x27ef('0x3a')][_0x27ef('0x32')]);_0x3955dc[_0x27ef('0x1b')]=_[_0x27ef('0x1c')](_0xc4f502['query']);_0x3955dc[_0x27ef('0x1d')]=_[_0x27ef('0x1e')](_0x3955dc[_0x27ef('0x1f')],_0x3955dc[_0x27ef('0x1b')]);_0x38ef69[_0x27ef('0x20')]=_[_0x27ef('0x1e')](_0x3955dc[_0x27ef('0x1f')],qs[_0x27ef('0x21')](_0xc4f502[_0x27ef('0x1b')]['fields']));_0x38ef69['attributes']=_0x38ef69[_0x27ef('0x20')][_0x27ef('0x22')]?_0x38ef69[_0x27ef('0x20')]:_0x3955dc[_0x27ef('0x1f')];_0x38ef69[_0x27ef('0x25')]=qs['sort'](_0xc4f502[_0x27ef('0x1b')]['sort']);_0x38ef69[_0x27ef('0x27')]=qs[_0x27ef('0x1d')](_[_0x27ef('0x28')](_0xc4f502[_0x27ef('0x1b')],_0x3955dc['filters']));if(_0xc4f502['query']['filter']){_0x38ef69[_0x27ef('0x27')]=_['merge'](_0x38ef69[_0x27ef('0x27')],{'$or':_[_0x27ef('0x16')](_0x38ef69[_0x27ef('0x20')],function(_0x103766){var _0x2a2cf1={};_0x2a2cf1[_0x103766]={'$like':'%'+_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x29')]+'%'};return _0x2a2cf1;})});}_0x38ef69=_['merge']({},_0x38ef69,_0xc4f502[_0x27ef('0x33')]);return _0x5b5899[_0x27ef('0x38')](_0x38ef69);}})[_0x27ef('0xe')](function(_0x45e4f3){if(_0x45e4f3){_0x2020d5=_0x45e4f3['length'];if(!_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x23')](_0x27ef('0x24'))){_0x38ef69['limit']=qs[_0x27ef('0x8')](_0xc4f502['query'][_0x27ef('0x8')]);_0x38ef69[_0x27ef('0x6')]=qs[_0x27ef('0x6')](_0xc4f502[_0x27ef('0x1b')][_0x27ef('0x6')]);}return _0x5b5899['getConfigurations'](_0x38ef69);}})[_0x27ef('0xe')](function(_0x3516db){if(_0x3516db){return _0x3516db?{'count':_0x2020d5,'rows':_0x3516db}:null;}})[_0x27ef('0xe')](respondWithResult(_0x1c1c04,null))[_0x27ef('0x30')](handleError(_0x1c1c04,null));};exports[_0x27ef('0x3b')]=function(_0x5d0ac2,_0x31626a){if(_0x5d0ac2[_0x27ef('0x35')]['id']){delete _0x5d0ac2[_0x27ef('0x35')]['id'];}return db[_0x27ef('0x17')]['findOne']({'where':{'id':_0x5d0ac2[_0x27ef('0x31')]['id']}})[_0x27ef('0xe')](handleEntityNotFound(_0x31626a,null))[_0x27ef('0xe')](function(_0x464f32){if(_0x464f32){_0x5d0ac2['body'][_0x27ef('0x3c')]=_0x464f32['id'];_0x5d0ac2['body'][_0x27ef('0x3d')]=integrations[_0x27ef('0x3e')](_0x5d0ac2['body'][_0x27ef('0x3f')],_0x5d0ac2[_0x27ef('0x35')][_0x27ef('0x19')]);_0x5d0ac2['body'][_0x27ef('0x40')]=integrations[_0x27ef('0x41')](_0x5d0ac2[_0x27ef('0x35')][_0x27ef('0x3f')],_0x5d0ac2[_0x27ef('0x35')]['type']);return db[_0x27ef('0x3a')]['create'](_0x5d0ac2['body'],{'include':[{'model':db[_0x27ef('0x42')],'as':_0x27ef('0x3d')},{'model':db['Dynamics365Field'],'as':_0x27ef('0x40')}]});}return null;})[_0x27ef('0xe')](respondWithResult(_0x31626a,null))[_0x27ef('0x30')](handleError(_0x31626a,null));};function sanitizeRemoteUri(_0x17a4ce){var _0x8a0f3c=_0x17a4ce[_0x27ef('0x43')](-0x1);if(_0x8a0f3c==='/')return _0x17a4ce['substring'](0x0,_0x17a4ce[_0x27ef('0x44')](_0x8a0f3c));return _0x17a4ce;}function getWebApiUrl(_0x4b29d6){return util[_0x27ef('0x45')](_0x27ef('0x46'),_0x4b29d6);}exports[_0x27ef('0x47')]=function(_0x25d5e8,_0x436881){var _0x2aeb2a=_0x25d5e8['query'][_0x27ef('0x48')];var _0x1520f9=_0x2aeb2a===_0x27ef('0x49')?_0x27ef('0x4a'):'PhoneCall';var _0x2e10a0='';var _0x2636e4='';var _0x40d231='';var _0x31f653='';var _0x50479e='';var _0x1b2caa='';var _0x474554='';var _0x695bd5='';var _0x1f8a5a=[_0x27ef('0x4b'),_0x27ef('0x4c'),'customerid',_0x27ef('0x4d'),_0x27ef('0x4e'),_0x27ef('0x4f'),_0x27ef('0x50'),_0x27ef('0x51'),_0x27ef('0x52'),_0x27ef('0x53')];var _0x13c6f1=[_0x27ef('0x54'),_0x27ef('0x55'),_0x27ef('0x56'),_0x27ef('0x57'),'contactidname',_0x27ef('0x58'),_0x27ef('0x59'),_0x27ef('0x5a'),'createdbyexternalpartyname',_0x27ef('0x5b'),_0x27ef('0x5c'),_0x27ef('0x5d'),'createdon',_0x27ef('0x5e'),_0x27ef('0x5f'),_0x27ef('0x60'),_0x27ef('0x61'),'customeridyominame','emailaddress',_0x27ef('0x62'),_0x27ef('0x63'),_0x27ef('0x64'),_0x27ef('0x65'),_0x27ef('0x66'),_0x27ef('0x67'),_0x27ef('0x68'),_0x27ef('0x69'),_0x27ef('0x6a'),_0x27ef('0x6b'),_0x27ef('0x6c'),_0x27ef('0x6d'),_0x27ef('0x6e'),_0x27ef('0x6f'),'modifiedbyname',_0x27ef('0x70'),_0x27ef('0x71'),_0x27ef('0x72'),_0x27ef('0x73'),'msdyn_incidenttypename',_0x27ef('0x74'),'numberofchildincidents',_0x27ef('0x75'),_0x27ef('0x76'),_0x27ef('0x77'),_0x27ef('0x78'),'owneridyominame',_0x27ef('0x79'),'primarycontactidname',_0x27ef('0x7a'),_0x27ef('0x7b'),'productidname','productserialnumber','resolveby',_0x27ef('0x7c'),_0x27ef('0x7d'),'responsiblecontactidname',_0x27ef('0x7e'),_0x27ef('0x7f'),_0x27ef('0x80'),'slaname',_0x27ef('0x81'),_0x27ef('0x82'),'statuscode','subjectidname','ticketnumber',_0x27ef('0x83'),_0x27ef('0x84'),_0x27ef('0x85'),_0x27ef('0x86'),_0x27ef('0x87')];var _0x1a576a=_0x1f8a5a[_0x27ef('0x88')](_0x13c6f1);return db[_0x27ef('0x17')][_0x27ef('0x39')]({'where':{'id':_0x25d5e8[_0x27ef('0x31')]['id']},'attributes':['id',_0x27ef('0x89'),_0x27ef('0x8a'),_0x27ef('0x8b'),_0x27ef('0x8c'),_0x27ef('0x8d'),_0x27ef('0x8e'),_0x27ef('0x8f')],'include':[{'model':db[_0x27ef('0x90')],'as':_0x27ef('0x90'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x436881,null))['then'](function(_0x487de3){if(_0x487de3){if(_0x487de3[_0x27ef('0x8f')]){_0x487de3['access_token']=_0x487de3['CloudProvider'][_0x27ef('0x91')];_0x695bd5=sanitizeRemoteUri(_0x487de3[_0x27ef('0x90')]['data7']);_0x474554=getWebApiUrl(_0x695bd5);return _0x487de3;}_0x695bd5=sanitizeRemoteUri(_0x487de3[_0x27ef('0x8b')]);_0x474554=getWebApiUrl(_0x695bd5);var _0x212401={'method':'POST','uri':_0x27ef('0x92')+_0x487de3[_0x27ef('0x8c')]+_0x27ef('0x93'),'form':{'client_id':_0x487de3[_0x27ef('0x8d')],'resource':_0x695bd5,'username':_0x487de3['username'],'password':_0x487de3['password'],'grant_type':_0x27ef('0x8a'),'client_secret':_0x487de3[_0x27ef('0x8e')]},'json':!![]};return rp(_0x212401);}})[_0x27ef('0xe')](function(_0x5f07b9){_0x1b2caa=_0x5f07b9[_0x27ef('0x94')];var _0x413502={'method':_0x27ef('0x95'),'uri':encodeURI(_0x474554+_0x27ef('0x96')+_0x1520f9+'\x27'),'headers':{'Authorization':_0x27ef('0x97')+_0x1b2caa,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x413502);})[_0x27ef('0xe')](function(_0x59055f){var _0x3e29d8=_0x59055f[_0x27ef('0x99')][0x0];var _0x3e54cd=_0x3e29d8[_0x27ef('0x9a')];var _0x2c04db={'method':'GET','uri':_0x474554+_0x27ef('0x9b')+_0x3e54cd+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x27ef('0x97')+_0x1b2caa,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x2c04db);})[_0x27ef('0xe')](function(_0x13d652){_0x2e10a0=_0x13d652;_0x2636e4=_0x2e10a0[_0x27ef('0x9c')];_0x2636e4=_[_0x27ef('0x9d')](_0x2636e4,function(_0x747491){return!_0x1a576a[_0x27ef('0x9e')](_0x747491[_0x27ef('0x9f')]);});var _0x772ffd=[];var _0x2c2865=[];_0x2636e4['forEach'](function(_0x462505){if(_0x462505[_0x27ef('0xa0')]){var _0xc084c3=_0x462505[_0x27ef('0xa0')][_0x27ef('0xa1')](_0x462505[_0x27ef('0xa0')][_0x27ef('0x44')]('.')+0x1);if(_0xc084c3===_0x27ef('0xa2')){_0x772ffd['push'](getSelectList(_0x474554,_0x2aeb2a,_0x2c2865,_0x2e10a0['MetadataId'],_0x462505['MetadataId'],_0x1b2caa));}}});return Promise['all'](_0x772ffd);})[_0x27ef('0xe')](function(_0x24c6b5){_0x40d231=_0x24c6b5[0x0];var _0x231e8c=[];var _0x224698=[];_0x2636e4[_0x27ef('0xa3')](function(_0x217ae8){if(!_[_0x27ef('0xa4')](_0x217ae8[_0x27ef('0xa0')])){var _0x2a12e5=_0x217ae8[_0x27ef('0xa0')]['substring'](_0x217ae8[_0x27ef('0xa0')][_0x27ef('0x44')]('.')+0x1);if(_0x2a12e5===_0x27ef('0xa5')){_0x231e8c[_0x27ef('0xa6')](getBooleanList(_0x474554,_0x2aeb2a,_0x224698,_0x2e10a0[_0x27ef('0x9a')],_0x217ae8['MetadataId'],_0x1b2caa));}}});return Promise['all'](_0x231e8c);})[_0x27ef('0xe')](function(_0x1b991f){_0x31f653=_0x1b991f[0x0];var _0x5cb708=[];var _0x4f8387=[];_0x2636e4['forEach'](function(_0x3563c7){if(_0x3563c7['@odata.type']){var _0x40c623=_0x3563c7['@odata.type'][_0x27ef('0xa1')](_0x3563c7[_0x27ef('0xa0')]['lastIndexOf']('.')+0x1);if(_0x40c623===_0x27ef('0xa7')||_0x40c623==='DoubleAttributeMetadata'||_0x40c623===_0x27ef('0xa8')||_0x40c623===_0x27ef('0xa9')||_0x40c623==='MemoAttributeMetadata'||_0x40c623===_0x27ef('0xaa')||_0x40c623==='StatusAttributeMetadata'||_0x40c623===_0x27ef('0xab')||_0x40c623==='StateAttributeMetadata'||_0x40c623===_0x27ef('0xac')){_0x5cb708[_0x27ef('0xa6')](getInputList(_0x474554,_0x2aeb2a,_0x40c623,_0x4f8387,_0x2e10a0[_0x27ef('0x9a')],_0x3563c7[_0x27ef('0x9a')],_0x1b2caa));}}});return Promise[_0x27ef('0xad')](_0x5cb708);})[_0x27ef('0xe')](function(_0x8cfe82){_0x50479e=_0x8cfe82[0x0];var _0x409aa0=_0x40d231[_0x27ef('0x88')](_0x31f653)[_0x27ef('0x88')](_0x50479e);var _0x16cf4a={'count':_0x409aa0[_0x27ef('0x22')],'rows':_0x409aa0};return _0x16cf4a;})[_0x27ef('0xe')](respondWithResult(_0x436881,null))[_0x27ef('0x30')](function(_0x3b097c){var _0x12decb=_0x25d5e8[_0x27ef('0x1b')]['test']?0x1f4:_0x3b097c[_0x27ef('0xae')]||0x1f4;logger[_0x27ef('0x11')](_0x3b097c['stack']);delete _0x3b097c[_0x27ef('0x13')];if(_0x12decb===0x191){_0x12decb=0x190;}_0x436881[_0x27ef('0xa')](_0x12decb)[_0x27ef('0x14')](_0x25d5e8[_0x27ef('0x1b')][_0x27ef('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x3b097c[_0x27ef('0xae')]}:_0x3b097c);});};function getSelectList(_0x2e7cff,_0x1995cb,_0x62c447,_0x4b0947,_0x1a5e50,_0xf51d7b){var _0x26236a={'method':'GET','uri':_0x2e7cff+_0x27ef('0x9b')+_0x4b0947+_0x27ef('0xb0')+_0x1a5e50+_0x27ef('0xb1')+_0x27ef('0xb2'),'headers':{'Authorization':_0x27ef('0x97')+_0xf51d7b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26236a)[_0x27ef('0xe')](function(_0x7d9775){var _0x52d929=[];var _0x18c444=_0x7d9775[_0x27ef('0xb3')][_0x27ef('0xb4')];_0x18c444['forEach'](function(_0x501b67){_0x52d929[_0x27ef('0xa6')]({'name':_0x501b67[_0x27ef('0xb5')][_0x27ef('0xb6')][_0x27ef('0xb5')],'value':String(_0x501b67[_0x27ef('0xb7')])});});var _0x3c8291={'id':_0x1995cb+'_'+_0x7d9775[_0x27ef('0x9f')],'name':_0x7d9775['DisplayName']['UserLocalizedLabel'][_0x27ef('0xb5')],'custom':![],'options':_0x52d929};_0x62c447['push'](_0x3c8291);return _0x62c447;});}function getBooleanList(_0x22608e,_0x1114ac,_0x172f07,_0x2b5734,_0x49a22d,_0xc95cfb){var _0x25ebce={'method':'GET','uri':_0x22608e+_0x27ef('0x9b')+_0x2b5734+_0x27ef('0xb0')+_0x49a22d+_0x27ef('0xb8'),'headers':{'Authorization':_0x27ef('0x97')+_0xc95cfb,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0x25ebce)[_0x27ef('0xe')](function(_0x3756ab){var _0x538b88=[];_0x538b88[_0x27ef('0xa6')]({'name':_0x3756ab[_0x27ef('0xb3')][_0x27ef('0xb9')]['Label'][_0x27ef('0xb6')]['Label'],'value':_0x27ef('0xba')},{'name':_0x3756ab[_0x27ef('0xb3')]['FalseOption']['Label']['UserLocalizedLabel'][_0x27ef('0xb5')],'value':'false'});var _0x2de334={'id':_0x1114ac+'_'+_0x3756ab['LogicalName'],'name':_0x3756ab['DisplayName'][_0x27ef('0xb6')][_0x27ef('0xb5')],'custom':![],'options':_0x538b88};_0x172f07[_0x27ef('0xa6')](_0x2de334);return _0x172f07;});}function getInputList(_0x24e2ba,_0x1226ce,_0x387241,_0x191790,_0x330edc,_0x4ca4de,_0x8f46de){var _0xcb57d2={'method':_0x27ef('0x95'),'uri':_0x24e2ba+_0x27ef('0x9b')+_0x330edc+_0x27ef('0xb0')+_0x4ca4de+_0x27ef('0xbb')+_0x387241+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x27ef('0x97')+_0x8f46de,'If-None-Match':null,'OData-Version':_0x27ef('0x98')},'json':!![]};return rp(_0xcb57d2)[_0x27ef('0xe')](function(_0x52e3db){var _0x4ee2e9={'id':_0x1226ce+'_'+_0x52e3db[_0x27ef('0x9f')],'name':_0x52e3db[_0x27ef('0xbc')][_0x27ef('0xb6')]?_0x52e3db[_0x27ef('0xbc')][_0x27ef('0xb6')]['Label']:_0x52e3db[_0x27ef('0x9f')],'custom':![],'options':[]};_0x191790['push'](_0x4ee2e9);return _0x191790;});} \ No newline at end of file +var _0x6d10=['entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','remove','LogicalName','forEach','@odata.type','lastIndexOf','push','MetadataId','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','Dynamics365Account','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress'];(function(_0x5987ec,_0xcf3f9f){var _0x2b3065=function(_0x2c304e){while(--_0x2c304e){_0x5987ec['push'](_0x5987ec['shift']());}};_0x2b3065(++_0xcf3f9f);}(_0x6d10,0x1d4));var _0x06d1=function(_0x32aae1,_0x542947){_0x32aae1=_0x32aae1-0x0;var _0xeb665=_0x6d10[_0x32aae1];return _0xeb665;};'use strict';var rp=require(_0x06d1('0x0'));var util=require('util');var _=require(_0x06d1('0x1'));var qs=require(_0x06d1('0x2'));var logger=require(_0x06d1('0x3'))(_0x06d1('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x06d1('0x5'));function respondWithResult(_0x111a95,_0x5782fc){_0x5782fc=_0x5782fc||0xc8;return function(_0x2e0c77){if(_0x2e0c77){return _0x111a95[_0x06d1('0x6')](_0x5782fc)[_0x06d1('0x7')](_0x2e0c77);}};}function respondWithFilteredResult(_0x42bf68,_0x486b43){return function(_0x6c84d3){if(_0x6c84d3){var _0x46725b=typeof _0x486b43[_0x06d1('0x8')]===_0x06d1('0x9')&&typeof _0x486b43[_0x06d1('0xa')]===_0x06d1('0x9');var _0xabf3ab=_0x6c84d3[_0x06d1('0xb')];var _0x3c177d=_0x46725b?0x0:_0x486b43[_0x06d1('0x8')];var _0x3d0ad8=_0x46725b?_0x6c84d3[_0x06d1('0xb')]:_0x486b43[_0x06d1('0x8')]+_0x486b43[_0x06d1('0xa')];var _0x2b3ed7;if(_0x3d0ad8>=_0xabf3ab){_0x3d0ad8=_0xabf3ab;_0x2b3ed7=0xc8;}else{_0x2b3ed7=0xce;}_0x42bf68[_0x06d1('0x6')](_0x2b3ed7);return _0x42bf68['set'](_0x06d1('0xc'),_0x3c177d+'-'+_0x3d0ad8+'/'+_0xabf3ab)[_0x06d1('0x7')](_0x6c84d3);}return null;};}function saveUpdates(_0x2ab287){return function(_0x402856){if(_0x402856){return _0x402856[_0x06d1('0xd')](_0x2ab287)[_0x06d1('0xe')](function(_0x3ebc9b){return _0x3ebc9b;});}return null;};}function removeEntity(_0x3226de){return function(_0x3b8288){if(_0x3b8288){return _0x3b8288[_0x06d1('0xf')]()[_0x06d1('0xe')](function(){_0x3226de['status'](0xcc)[_0x06d1('0x10')]();});}};}function handleEntityNotFound(_0x5a33c8){return function(_0x1c822d){if(!_0x1c822d){_0x5a33c8[_0x06d1('0x11')](0x194);}return _0x1c822d;};}function handleError(_0x3950e3,_0x7f9b40){_0x7f9b40=_0x7f9b40||0x1f4;return function(_0x4d462a){logger[_0x06d1('0x12')](_0x4d462a['stack']);if(_0x4d462a[_0x06d1('0x13')]){delete _0x4d462a[_0x06d1('0x13')];}_0x3950e3[_0x06d1('0x6')](_0x7f9b40)[_0x06d1('0x14')](_0x4d462a);};}exports[_0x06d1('0x15')]=function(_0x310a89,_0xa4b1d1){var _0x1321c5={},_0x506271={},_0x212e8e={'count':0x0,'rows':[]};var _0x4e1004=_['map'](db[_0x06d1('0x16')][_0x06d1('0x17')],function(_0x4c7e87){return{'name':_0x4c7e87['fieldName'],'type':_0x4c7e87[_0x06d1('0x18')]['key']};});_0x506271[_0x06d1('0x19')]=_[_0x06d1('0x1a')](_0x4e1004,_0x06d1('0x13'));_0x506271[_0x06d1('0x1b')]=_[_0x06d1('0x1c')](_0x310a89[_0x06d1('0x1b')]);_0x506271[_0x06d1('0x1d')]=_[_0x06d1('0x1e')](_0x506271[_0x06d1('0x19')],_0x506271[_0x06d1('0x1b')]);_0x1321c5[_0x06d1('0x1f')]=_[_0x06d1('0x1e')](_0x506271[_0x06d1('0x19')],qs[_0x06d1('0x20')](_0x310a89[_0x06d1('0x1b')][_0x06d1('0x20')]));_0x1321c5['attributes']=_0x1321c5[_0x06d1('0x1f')][_0x06d1('0x21')]?_0x1321c5['attributes']:_0x506271[_0x06d1('0x19')];if(!_0x310a89['query'][_0x06d1('0x22')]('nolimit')){_0x1321c5[_0x06d1('0xa')]=qs[_0x06d1('0xa')](_0x310a89['query'][_0x06d1('0xa')]);_0x1321c5[_0x06d1('0x8')]=qs[_0x06d1('0x8')](_0x310a89[_0x06d1('0x1b')][_0x06d1('0x8')]);}_0x1321c5[_0x06d1('0x23')]=qs[_0x06d1('0x24')](_0x310a89['query'][_0x06d1('0x24')]);_0x1321c5['where']=qs[_0x06d1('0x1d')](_[_0x06d1('0x25')](_0x310a89[_0x06d1('0x1b')],_0x506271[_0x06d1('0x1d')]),_0x4e1004);if(_0x310a89[_0x06d1('0x1b')][_0x06d1('0x26')]){_0x1321c5[_0x06d1('0x27')]=_[_0x06d1('0x28')](_0x1321c5[_0x06d1('0x27')],{'$or':_['map'](_0x4e1004,function(_0x58eb9e){if(_0x58eb9e[_0x06d1('0x18')]!==_0x06d1('0x29')){var _0x24f4eb={};_0x24f4eb[_0x58eb9e[_0x06d1('0x13')]]={'$like':'%'+_0x310a89[_0x06d1('0x1b')][_0x06d1('0x26')]+'%'};return _0x24f4eb;}})});}_0x1321c5=_[_0x06d1('0x28')]({},_0x1321c5,_0x310a89[_0x06d1('0x2a')]);var _0x5929fd={'where':_0x1321c5[_0x06d1('0x27')]};return db[_0x06d1('0x16')][_0x06d1('0xb')](_0x5929fd)[_0x06d1('0xe')](function(_0x1dcf90){_0x212e8e[_0x06d1('0xb')]=_0x1dcf90;if(_0x310a89[_0x06d1('0x1b')][_0x06d1('0x2b')]){_0x1321c5['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x06d1('0x2c')](_0x1321c5);})[_0x06d1('0xe')](function(_0x4cf666){_0x212e8e[_0x06d1('0x2d')]=_0x4cf666;return _0x212e8e;})[_0x06d1('0xe')](respondWithFilteredResult(_0xa4b1d1,_0x1321c5))['catch'](handleError(_0xa4b1d1,null));};exports[_0x06d1('0x2e')]=function(_0x284ffb,_0x53b719){var _0x531616={'raw':![],'where':{'id':_0x284ffb[_0x06d1('0x2f')]['id']}},_0x25edbe={};_0x25edbe[_0x06d1('0x19')]=_[_0x06d1('0x1c')](db[_0x06d1('0x16')][_0x06d1('0x17')]);_0x25edbe[_0x06d1('0x1b')]=_[_0x06d1('0x1c')](_0x284ffb[_0x06d1('0x1b')]);_0x25edbe[_0x06d1('0x1d')]=_[_0x06d1('0x1e')](_0x25edbe[_0x06d1('0x19')],_0x25edbe[_0x06d1('0x1b')]);_0x531616[_0x06d1('0x1f')]=_[_0x06d1('0x1e')](_0x25edbe['model'],qs['fields'](_0x284ffb[_0x06d1('0x1b')][_0x06d1('0x20')]));_0x531616[_0x06d1('0x1f')]=_0x531616['attributes'][_0x06d1('0x21')]?_0x531616[_0x06d1('0x1f')]:_0x25edbe[_0x06d1('0x19')];if(_0x284ffb[_0x06d1('0x1b')][_0x06d1('0x2b')]){_0x531616[_0x06d1('0x30')]=[{'all':!![]}];}_0x531616=_['merge']({},_0x531616,_0x284ffb[_0x06d1('0x2a')]);return db['Dynamics365Account'][_0x06d1('0x31')](_0x531616)[_0x06d1('0xe')](handleEntityNotFound(_0x53b719,null))[_0x06d1('0xe')](respondWithResult(_0x53b719,null))['catch'](handleError(_0x53b719,null));};exports['create']=function(_0x17a80f,_0x1bf005){return db[_0x06d1('0x16')][_0x06d1('0x32')](_0x17a80f[_0x06d1('0x33')],{})[_0x06d1('0xe')](respondWithResult(_0x1bf005,0xc9))[_0x06d1('0x34')](handleError(_0x1bf005,null));};exports['update']=function(_0x190957,_0x16871b){if(_0x190957[_0x06d1('0x33')]['id']){delete _0x190957[_0x06d1('0x33')]['id'];}return db[_0x06d1('0x16')][_0x06d1('0x31')]({'where':{'id':_0x190957[_0x06d1('0x2f')]['id']}})[_0x06d1('0xe')](handleEntityNotFound(_0x16871b,null))[_0x06d1('0xe')](saveUpdates(_0x190957['body'],null))[_0x06d1('0xe')](respondWithResult(_0x16871b,null))[_0x06d1('0x34')](handleError(_0x16871b,null));};exports[_0x06d1('0xf')]=function(_0x47d995,_0x2ad9ff){return db[_0x06d1('0x16')][_0x06d1('0x31')]({'where':{'id':_0x47d995[_0x06d1('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2ad9ff,null))[_0x06d1('0xe')](removeEntity(_0x2ad9ff,null))['catch'](handleError(_0x2ad9ff,null));};exports[_0x06d1('0x35')]=function(_0x5a8418,_0x190c42){var _0x3c64c6={};var _0x5a0592={};var _0x484630;var _0x14a5e3;return db[_0x06d1('0x16')][_0x06d1('0x36')]({'where':{'id':_0x5a8418[_0x06d1('0x2f')]['id']}})[_0x06d1('0xe')](handleEntityNotFound(_0x190c42,null))[_0x06d1('0xe')](function(_0x2b1e58){if(_0x2b1e58){_0x484630=_0x2b1e58;_0x5a0592[_0x06d1('0x19')]=_[_0x06d1('0x1c')](db[_0x06d1('0x37')][_0x06d1('0x17')]);_0x5a0592['query']=_['keys'](_0x5a8418[_0x06d1('0x1b')]);_0x5a0592[_0x06d1('0x1d')]=_[_0x06d1('0x1e')](_0x5a0592[_0x06d1('0x19')],_0x5a0592[_0x06d1('0x1b')]);_0x3c64c6[_0x06d1('0x1f')]=_['intersection'](_0x5a0592['model'],qs[_0x06d1('0x20')](_0x5a8418[_0x06d1('0x1b')][_0x06d1('0x20')]));_0x3c64c6[_0x06d1('0x1f')]=_0x3c64c6[_0x06d1('0x1f')][_0x06d1('0x21')]?_0x3c64c6[_0x06d1('0x1f')]:_0x5a0592[_0x06d1('0x19')];_0x3c64c6[_0x06d1('0x23')]=qs[_0x06d1('0x24')](_0x5a8418[_0x06d1('0x1b')][_0x06d1('0x24')]);_0x3c64c6[_0x06d1('0x27')]=qs[_0x06d1('0x1d')](_['pick'](_0x5a8418[_0x06d1('0x1b')],_0x5a0592['filters']));if(_0x5a8418[_0x06d1('0x1b')][_0x06d1('0x26')]){_0x3c64c6[_0x06d1('0x27')]=_[_0x06d1('0x28')](_0x3c64c6[_0x06d1('0x27')],{'$or':_[_0x06d1('0x1a')](_0x3c64c6[_0x06d1('0x1f')],function(_0x462b38){var _0x5c45df={};_0x5c45df[_0x462b38]={'$like':'%'+_0x5a8418['query']['filter']+'%'};return _0x5c45df;})});}_0x3c64c6=_[_0x06d1('0x28')]({},_0x3c64c6,_0x5a8418['options']);return _0x484630[_0x06d1('0x35')](_0x3c64c6);}})[_0x06d1('0xe')](function(_0x1e8986){if(_0x1e8986){_0x14a5e3=_0x1e8986[_0x06d1('0x21')];if(!_0x5a8418['query'][_0x06d1('0x22')](_0x06d1('0x38'))){_0x3c64c6[_0x06d1('0xa')]=qs[_0x06d1('0xa')](_0x5a8418[_0x06d1('0x1b')][_0x06d1('0xa')]);_0x3c64c6[_0x06d1('0x8')]=qs[_0x06d1('0x8')](_0x5a8418[_0x06d1('0x1b')][_0x06d1('0x8')]);}return _0x484630[_0x06d1('0x35')](_0x3c64c6);}})['then'](function(_0x44e5f8){if(_0x44e5f8){return _0x44e5f8?{'count':_0x14a5e3,'rows':_0x44e5f8}:null;}})['then'](respondWithResult(_0x190c42,null))[_0x06d1('0x34')](handleError(_0x190c42,null));};exports[_0x06d1('0x39')]=function(_0x2dd67f,_0x57489b){if(_0x2dd67f[_0x06d1('0x33')]['id']){delete _0x2dd67f[_0x06d1('0x33')]['id'];}return db[_0x06d1('0x16')]['findOne']({'where':{'id':_0x2dd67f['params']['id']}})[_0x06d1('0xe')](handleEntityNotFound(_0x57489b,null))[_0x06d1('0xe')](function(_0x5e822b){if(_0x5e822b){_0x2dd67f[_0x06d1('0x33')][_0x06d1('0x3a')]=_0x5e822b['id'];_0x2dd67f[_0x06d1('0x33')]['Subjects']=integrations[_0x06d1('0x3b')](_0x2dd67f['body'][_0x06d1('0x3c')],_0x2dd67f['body'][_0x06d1('0x18')]);_0x2dd67f['body'][_0x06d1('0x3d')]=integrations[_0x06d1('0x3e')](_0x2dd67f[_0x06d1('0x33')][_0x06d1('0x3c')],_0x2dd67f['body'][_0x06d1('0x18')]);return db['Dynamics365Configuration'][_0x06d1('0x32')](_0x2dd67f[_0x06d1('0x33')],{'include':[{'model':db[_0x06d1('0x3f')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x06d1('0x3d')}]});}return null;})[_0x06d1('0xe')](respondWithResult(_0x57489b,null))[_0x06d1('0x34')](handleError(_0x57489b,null));};function sanitizeRemoteUri(_0x5cbe67){var _0x43a76f=_0x5cbe67[_0x06d1('0x40')](-0x1);if(_0x43a76f==='/')return _0x5cbe67[_0x06d1('0x41')](0x0,_0x5cbe67['lastIndexOf'](_0x43a76f));return _0x5cbe67;}function getWebApiUrl(_0x12a6a6){return util[_0x06d1('0x42')](_0x06d1('0x43'),_0x12a6a6);}exports['getFields']=function(_0x69d9a2,_0x3ec07e){var _0x221c84=_0x69d9a2[_0x06d1('0x1b')][_0x06d1('0x44')];var _0x4b573b=_0x221c84===_0x06d1('0x45')?_0x06d1('0x46'):_0x06d1('0x47');var _0x2d4cb5='';var _0x33ab21='';var _0x59816b='';var _0x1d7c3c='';var _0x2efb44='';var _0x1a8654='';var _0xfda9bc='';var _0x1911c7='';var _0x194227=[_0x06d1('0x48'),'description',_0x06d1('0x49'),'ownerid',_0x06d1('0x4a'),_0x06d1('0x4b'),'phonenumber',_0x06d1('0x4c'),_0x06d1('0x4d'),'phonecall_activity_parties'];var _0x1eef21=[_0x06d1('0x4e'),_0x06d1('0x4f'),_0x06d1('0x50'),_0x06d1('0x51'),_0x06d1('0x52'),'contactidyominame','contractdetailidname',_0x06d1('0x53'),_0x06d1('0x54'),'createdbyexternalpartyyominame',_0x06d1('0x55'),_0x06d1('0x56'),_0x06d1('0x57'),'createdonbehalfbyname',_0x06d1('0x58'),_0x06d1('0x59'),_0x06d1('0x5a'),_0x06d1('0x5b'),_0x06d1('0x5c'),_0x06d1('0x5d'),_0x06d1('0x5e'),_0x06d1('0x5f'),_0x06d1('0x60'),_0x06d1('0x61'),_0x06d1('0x62'),_0x06d1('0x63'),_0x06d1('0x64'),_0x06d1('0x65'),_0x06d1('0x66'),'lastonholdtime',_0x06d1('0x67'),'modifiedbyexternalpartyname',_0x06d1('0x68'),_0x06d1('0x69'),'modifiedbyyominame','modifiedon',_0x06d1('0x6a'),_0x06d1('0x6b'),_0x06d1('0x6c'),_0x06d1('0x6d'),'numberofchildincidents',_0x06d1('0x6e'),'overriddencreatedon',_0x06d1('0x6f'),'owneridtype',_0x06d1('0x70'),'parentcaseidname',_0x06d1('0x71'),_0x06d1('0x72'),'prioritycodename',_0x06d1('0x73'),_0x06d1('0x74'),_0x06d1('0x75'),_0x06d1('0x76'),_0x06d1('0x77'),'responsiblecontactidname',_0x06d1('0x78'),'sentimentvalue',_0x06d1('0x79'),_0x06d1('0x7a'),'socialprofileidname',_0x06d1('0x7b'),_0x06d1('0x7c'),_0x06d1('0x7d'),_0x06d1('0x7e'),_0x06d1('0x7f'),_0x06d1('0x80'),'traversedpath',_0x06d1('0x81'),_0x06d1('0x82')];var _0x48c076=_0x194227[_0x06d1('0x83')](_0x1eef21);return db[_0x06d1('0x16')]['findOne']({'where':{'id':_0x69d9a2[_0x06d1('0x2f')]['id']},'attributes':['id',_0x06d1('0x84'),'password',_0x06d1('0x85'),_0x06d1('0x86'),_0x06d1('0x87'),_0x06d1('0x88'),_0x06d1('0x89')],'include':[{'model':db[_0x06d1('0x8a')],'as':_0x06d1('0x8a'),'attributes':['id',_0x06d1('0x8b'),_0x06d1('0x8c')]}]})[_0x06d1('0xe')](handleEntityNotFound(_0x3ec07e,null))[_0x06d1('0xe')](function(_0x2a21dd){if(_0x2a21dd){if(_0x2a21dd[_0x06d1('0x89')]){_0x2a21dd['access_token']=_0x2a21dd[_0x06d1('0x8a')][_0x06d1('0x8b')];_0x1911c7=sanitizeRemoteUri(_0x2a21dd[_0x06d1('0x8a')][_0x06d1('0x8c')]);_0xfda9bc=getWebApiUrl(_0x1911c7);return _0x2a21dd;}_0x1911c7=sanitizeRemoteUri(_0x2a21dd[_0x06d1('0x85')]);_0xfda9bc=getWebApiUrl(_0x1911c7);var _0xd5b179={'method':_0x06d1('0x8d'),'uri':_0x06d1('0x8e')+_0x2a21dd[_0x06d1('0x86')]+_0x06d1('0x8f'),'form':{'client_id':_0x2a21dd[_0x06d1('0x87')],'resource':_0x1911c7,'username':_0x2a21dd['username'],'password':_0x2a21dd[_0x06d1('0x90')],'grant_type':_0x06d1('0x90'),'client_secret':_0x2a21dd[_0x06d1('0x88')]},'json':!![]};return rp(_0xd5b179);}})[_0x06d1('0xe')](function(_0x179c56){_0x1a8654=_0x179c56['access_token'];var _0x2b83a3={'method':_0x06d1('0x91'),'uri':encodeURI(_0xfda9bc+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4b573b+'\x27'),'headers':{'Authorization':_0x06d1('0x92')+_0x1a8654,'If-None-Match':null,'OData-Version':_0x06d1('0x93')},'json':!![]};return rp(_0x2b83a3);})[_0x06d1('0xe')](function(_0x16f315){var _0x1d4d80=_0x16f315[_0x06d1('0x94')][0x0];var _0xbbc48=_0x1d4d80['MetadataId'];var _0x429bed={'method':'GET','uri':_0xfda9bc+_0x06d1('0x95')+_0xbbc48+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x06d1('0x92')+_0x1a8654,'If-None-Match':null,'OData-Version':_0x06d1('0x93')},'json':!![]};return rp(_0x429bed);})[_0x06d1('0xe')](function(_0x20efa2){_0x2d4cb5=_0x20efa2;_0x33ab21=_0x2d4cb5[_0x06d1('0x96')];_0x33ab21=_[_0x06d1('0x97')](_0x33ab21,function(_0x265701){return!_0x48c076['includes'](_0x265701[_0x06d1('0x98')]);});var _0x5cfaa3=[];var _0x3b31f1=[];_0x33ab21[_0x06d1('0x99')](function(_0x353381){if(_0x353381[_0x06d1('0x9a')]){var _0x3cf182=_0x353381['@odata.type']['substring'](_0x353381['@odata.type'][_0x06d1('0x9b')]('.')+0x1);if(_0x3cf182==='PicklistAttributeMetadata'){_0x5cfaa3[_0x06d1('0x9c')](getSelectList(_0xfda9bc,_0x221c84,_0x3b31f1,_0x2d4cb5['MetadataId'],_0x353381[_0x06d1('0x9d')],_0x1a8654));}}});return Promise[_0x06d1('0x9e')](_0x5cfaa3);})['then'](function(_0x3885ee){_0x59816b=_0x3885ee[0x0];var _0x441a38=[];var _0x100d33=[];_0x33ab21[_0x06d1('0x99')](function(_0x1e0da2){if(!_['isNil'](_0x1e0da2[_0x06d1('0x9a')])){var _0x17be89=_0x1e0da2[_0x06d1('0x9a')]['substring'](_0x1e0da2[_0x06d1('0x9a')][_0x06d1('0x9b')]('.')+0x1);if(_0x17be89===_0x06d1('0x9f')){_0x441a38[_0x06d1('0x9c')](getBooleanList(_0xfda9bc,_0x221c84,_0x100d33,_0x2d4cb5[_0x06d1('0x9d')],_0x1e0da2['MetadataId'],_0x1a8654));}}});return Promise[_0x06d1('0x9e')](_0x441a38);})[_0x06d1('0xe')](function(_0xfb00a8){_0x1d7c3c=_0xfb00a8[0x0];var _0x3d53db=[];var _0x320eba=[];_0x33ab21[_0x06d1('0x99')](function(_0x6cc543){if(_0x6cc543[_0x06d1('0x9a')]){var _0xef7ce9=_0x6cc543['@odata.type'][_0x06d1('0x41')](_0x6cc543['@odata.type'][_0x06d1('0x9b')]('.')+0x1);if(_0xef7ce9===_0x06d1('0xa0')||_0xef7ce9===_0x06d1('0xa1')||_0xef7ce9===_0x06d1('0xa2')||_0xef7ce9===_0x06d1('0xa3')||_0xef7ce9===_0x06d1('0xa4')||_0xef7ce9===_0x06d1('0xa5')||_0xef7ce9===_0x06d1('0xa6')||_0xef7ce9===_0x06d1('0xa7')||_0xef7ce9===_0x06d1('0xa8')||_0xef7ce9===_0x06d1('0xa9')){_0x3d53db[_0x06d1('0x9c')](getInputList(_0xfda9bc,_0x221c84,_0xef7ce9,_0x320eba,_0x2d4cb5[_0x06d1('0x9d')],_0x6cc543[_0x06d1('0x9d')],_0x1a8654));}}});return Promise[_0x06d1('0x9e')](_0x3d53db);})[_0x06d1('0xe')](function(_0x1b8733){_0x2efb44=_0x1b8733[0x0];var _0x36ad46=_0x59816b[_0x06d1('0x83')](_0x1d7c3c)[_0x06d1('0x83')](_0x2efb44);var _0x3b032a={'count':_0x36ad46[_0x06d1('0x21')],'rows':_0x36ad46};return _0x3b032a;})[_0x06d1('0xe')](respondWithResult(_0x3ec07e,null))['catch'](function(_0x135544){var _0x23537e=_0x69d9a2[_0x06d1('0x1b')][_0x06d1('0xaa')]?0x1f4:_0x135544[_0x06d1('0xab')]||0x1f4;logger[_0x06d1('0x12')](_0x135544[_0x06d1('0xac')]);delete _0x135544[_0x06d1('0x13')];if(_0x23537e===0x191){_0x23537e=0x190;}_0x3ec07e[_0x06d1('0x6')](_0x23537e)[_0x06d1('0x14')](_0x69d9a2[_0x06d1('0x1b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x135544['statusCode']}:_0x135544);});};function getSelectList(_0x2119a2,_0x4e2e30,_0x22c3f2,_0x29647d,_0x22028c,_0x3623d5){var _0xf9d963={'method':'GET','uri':_0x2119a2+'EntityDefinitions('+_0x29647d+')/Attributes('+_0x22028c+_0x06d1('0xad')+_0x06d1('0xae'),'headers':{'Authorization':'Bearer\x20'+_0x3623d5,'If-None-Match':null,'OData-Version':_0x06d1('0x93')},'json':!![]};return rp(_0xf9d963)['then'](function(_0x427c13){var _0x22d956=[];var _0xdb0e11=_0x427c13['OptionSet'][_0x06d1('0xaf')];_0xdb0e11[_0x06d1('0x99')](function(_0x219280){_0x22d956['push']({'name':_0x219280[_0x06d1('0xb0')][_0x06d1('0xb1')][_0x06d1('0xb0')],'value':String(_0x219280[_0x06d1('0xb2')])});});var _0x134ae6={'id':_0x4e2e30+'_'+_0x427c13[_0x06d1('0x98')],'name':_0x427c13[_0x06d1('0xb3')][_0x06d1('0xb1')][_0x06d1('0xb0')],'custom':![],'options':_0x22d956};_0x22c3f2[_0x06d1('0x9c')](_0x134ae6);return _0x22c3f2;});}function getBooleanList(_0x4b269e,_0x427d6c,_0x218f95,_0x1ef1b1,_0xad1b3b,_0x33c1da){var _0x29cbe5={'method':_0x06d1('0x91'),'uri':_0x4b269e+_0x06d1('0x95')+_0x1ef1b1+_0x06d1('0xb4')+_0xad1b3b+_0x06d1('0xb5'),'headers':{'Authorization':_0x06d1('0x92')+_0x33c1da,'If-None-Match':null,'OData-Version':_0x06d1('0x93')},'json':!![]};return rp(_0x29cbe5)[_0x06d1('0xe')](function(_0x53d400){var _0x292781=[];_0x292781['push']({'name':_0x53d400['OptionSet'][_0x06d1('0xb6')][_0x06d1('0xb0')]['UserLocalizedLabel'][_0x06d1('0xb0')],'value':'true'},{'name':_0x53d400[_0x06d1('0xb7')][_0x06d1('0xb8')][_0x06d1('0xb0')][_0x06d1('0xb1')][_0x06d1('0xb0')],'value':_0x06d1('0xb9')});var _0x9c78b9={'id':_0x427d6c+'_'+_0x53d400[_0x06d1('0x98')],'name':_0x53d400[_0x06d1('0xb3')][_0x06d1('0xb1')][_0x06d1('0xb0')],'custom':![],'options':_0x292781};_0x218f95[_0x06d1('0x9c')](_0x9c78b9);return _0x218f95;});}function getInputList(_0x56b6c2,_0x50e9db,_0x551bd8,_0x1028cd,_0x3d7a0d,_0xc37d5e,_0x2fcb97){var _0x5c6684={'method':_0x06d1('0x91'),'uri':_0x56b6c2+_0x06d1('0x95')+_0x3d7a0d+_0x06d1('0xb4')+_0xc37d5e+_0x06d1('0xba')+_0x551bd8+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x06d1('0x92')+_0x2fcb97,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c6684)[_0x06d1('0xe')](function(_0x3803f1){var _0x37965e={'id':_0x50e9db+'_'+_0x3803f1[_0x06d1('0x98')],'name':_0x3803f1[_0x06d1('0xb3')][_0x06d1('0xb1')]?_0x3803f1['DisplayName'][_0x06d1('0xb1')]['Label']:_0x3803f1[_0x06d1('0x98')],'custom':![],'options':[]};_0x1028cd[_0x06d1('0x9c')](_0x37965e);return _0x1028cd;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b509a11..d3915d9 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x1ad164,_0x10af7f){var _0x1cfb0f=function(_0x5b4c4e){while(--_0x5b4c4e){_0x1ad164['push'](_0x1ad164['shift']());}};_0x1cfb0f(++_0x10af7f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 499d2ee..8c82f17 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 _0xad11=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4299d0,_0x500a91){var _0x5b5187=function(_0x2f359b){while(--_0x2f359b){_0x4299d0['push'](_0x4299d0['shift']());}};_0x5b5187(++_0x500a91);}(_0xad11,0xe2));var _0x1ad1=function(_0x4fe483,_0x57c2d3){_0x4fe483=_0x4fe483-0x0;var _0x13db76=_0xad11[_0x4fe483];return _0x13db76;};'use strict';var _=require(_0x1ad1('0x0'));var util=require(_0x1ad1('0x1'));var moment=require('moment');var BPromise=require(_0x1ad1('0x2'));var rs=require(_0x1ad1('0x3'));var fs=require('fs');var Redis=require(_0x1ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1ad1('0x5'))(_0x1ad1('0x6'));var config=require(_0x1ad1('0x7'));var jayson=require(_0x1ad1('0x8'));var client=jayson[_0x1ad1('0x9')][_0x1ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46af7e,_0x2058e1,_0x3d077a){return new BPromise(function(_0x19106d,_0x349840){return client[_0x1ad1('0xb')](_0x46af7e,_0x3d077a)[_0x1ad1('0xc')](function(_0x5b5b6d){logger[_0x1ad1('0xd')](_0x1ad1('0xe'),_0x2058e1,_0x1ad1('0xf'));logger[_0x1ad1('0x10')](_0x1ad1('0x11'),_0x2058e1,_0x1ad1('0xf'),JSON[_0x1ad1('0x12')](_0x5b5b6d));if(_0x5b5b6d[_0x1ad1('0x13')]){if(_0x5b5b6d[_0x1ad1('0x13')]['code']===0x1f4){logger[_0x1ad1('0x13')](_0x1ad1('0xe'),_0x2058e1,_0x5b5b6d['error']['message']);return _0x349840(_0x5b5b6d[_0x1ad1('0x13')][_0x1ad1('0x14')]);}logger[_0x1ad1('0x13')](_0x1ad1('0xe'),_0x2058e1,_0x5b5b6d[_0x1ad1('0x13')]['message']);return _0x19106d(_0x5b5b6d[_0x1ad1('0x13')]['message']);}else{logger[_0x1ad1('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2058e1,'request\x20sent');_0x19106d(_0x5b5b6d[_0x1ad1('0x15')][_0x1ad1('0x14')]);}})[_0x1ad1('0x16')](function(_0x4d0b68){logger[_0x1ad1('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x2058e1,_0x4d0b68);_0x349840(_0x4d0b68);});});}exports['GetDynamics365Account']=function(_0x15ea09){var _0x15347a=this;return new Promise(function(_0x4d4f32,_0x349032){return db['Dynamics365Account'][_0x1ad1('0x17')]({'raw':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x19')]===undefined?!![]:![]:!![],'where':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1a')]||null:null,'attributes':_0x15ea09['options']?_0x15ea09['options'][_0x1ad1('0x1b')]||null:null,'limit':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09['options']['limit']||null:null,'include':_0x15ea09[_0x1ad1('0x18')]?_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1c')]?_[_0x1ad1('0x1d')](_0x15ea09[_0x1ad1('0x18')][_0x1ad1('0x1c')],function(_0x353d72){return{'model':db[_0x353d72[_0x1ad1('0x1e')]],'as':_0x353d72['as'],'attributes':_0x353d72[_0x1ad1('0x1b')],'include':_0x353d72[_0x1ad1('0x1c')]?_['map'](_0x353d72[_0x1ad1('0x1c')],function(_0x415150){return{'model':db[_0x415150[_0x1ad1('0x1e')]],'as':_0x415150['as'],'attributes':_0x415150[_0x1ad1('0x1b')],'include':_0x415150[_0x1ad1('0x1c')]?_[_0x1ad1('0x1d')](_0x415150[_0x1ad1('0x1c')],function(_0x495d86){return{'model':db[_0x495d86[_0x1ad1('0x1e')]],'as':_0x495d86['as'],'attributes':_0x495d86[_0x1ad1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ad1('0xc')](function(_0x3c1f3e){logger[_0x1ad1('0xd')](_0x1ad1('0x1f'),_0x15ea09);logger['debug'](_0x1ad1('0x1f'),_0x15ea09,JSON[_0x1ad1('0x12')](_0x3c1f3e));_0x4d4f32(_0x3c1f3e);})[_0x1ad1('0x16')](function(_0x408ca5){logger[_0x1ad1('0x13')](_0x1ad1('0x1f'),_0x408ca5[_0x1ad1('0x14')],_0x15ea09);_0x349032(_0x15347a[_0x1ad1('0x13')](0x1f4,_0x408ca5[_0x1ad1('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x540b23){var _0x43c366=this;return new Promise(function(_0x2c452e,_0x48b952){return db['Dynamics365Account']['find']({'raw':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x540b23[_0x1ad1('0x18')]?_0x540b23['options'][_0x1ad1('0x1a')]||null:null,'attributes':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')][_0x1ad1('0x1b')]||null:null,'include':_0x540b23[_0x1ad1('0x18')]?_0x540b23[_0x1ad1('0x18')][_0x1ad1('0x1c')]?_['map'](_0x540b23['options'][_0x1ad1('0x1c')],function(_0x49629c){return{'model':db[_0x49629c['model']],'as':_0x49629c['as'],'attributes':_0x49629c[_0x1ad1('0x1b')],'include':_0x49629c[_0x1ad1('0x1c')]?_['map'](_0x49629c[_0x1ad1('0x1c')],function(_0x177c0e){return{'model':db[_0x177c0e[_0x1ad1('0x1e')]],'as':_0x177c0e['as'],'attributes':_0x177c0e[_0x1ad1('0x1b')],'include':_0x177c0e['include']?_[_0x1ad1('0x1d')](_0x177c0e['include'],function(_0x5786d7){return{'model':db[_0x5786d7[_0x1ad1('0x1e')]],'as':_0x5786d7['as'],'attributes':_0x5786d7[_0x1ad1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ad1('0xc')](function(_0x2e7435){logger[_0x1ad1('0xd')](_0x1ad1('0x20'),_0x540b23);logger['debug'](_0x1ad1('0x20'),_0x540b23,JSON[_0x1ad1('0x12')](_0x2e7435));_0x2c452e(_0x2e7435);})['catch'](function(_0x5ebe48){logger['error'](_0x1ad1('0x20'),_0x5ebe48[_0x1ad1('0x14')],_0x540b23);_0x48b952(_0x43c366[_0x1ad1('0x13')](0x1f4,_0x5ebe48[_0x1ad1('0x14')]));});});}; \ No newline at end of file +var _0xe912=['jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','Dynamics365Account','find','ShowDynamics365Account','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0xe912,0xa2));var _0x2e91=function(_0x5da078,_0xc01d5a){_0x5da078=_0x5da078-0x0;var _0x186399=_0xe912[_0x5da078];return _0x186399;};'use strict';var _=require(_0x2e91('0x0'));var util=require('util');var moment=require(_0x2e91('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e91('0x2'));var db=require(_0x2e91('0x3'))['db'];var utils=require(_0x2e91('0x4'));var logger=require(_0x2e91('0x5'))(_0x2e91('0x6'));var config=require(_0x2e91('0x7'));var jayson=require(_0x2e91('0x8'));var client=jayson['client'][_0x2e91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59aef4,_0x399d9a,_0x1fff68){return new BPromise(function(_0x1bf2e9,_0x1e73fd){return client['request'](_0x59aef4,_0x1fff68)[_0x2e91('0xa')](function(_0x530db4){logger[_0x2e91('0xb')](_0x2e91('0xc'),_0x399d9a,'request\x20sent');logger[_0x2e91('0xd')](_0x2e91('0xe'),_0x399d9a,_0x2e91('0xf'),JSON[_0x2e91('0x10')](_0x530db4));if(_0x530db4[_0x2e91('0x11')]){if(_0x530db4[_0x2e91('0x11')][_0x2e91('0x12')]===0x1f4){logger[_0x2e91('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x399d9a,_0x530db4[_0x2e91('0x11')][_0x2e91('0x13')]);return _0x1e73fd(_0x530db4[_0x2e91('0x11')][_0x2e91('0x13')]);}logger[_0x2e91('0x11')](_0x2e91('0xc'),_0x399d9a,_0x530db4[_0x2e91('0x11')][_0x2e91('0x13')]);return _0x1bf2e9(_0x530db4[_0x2e91('0x11')]['message']);}else{logger['info'](_0x2e91('0xc'),_0x399d9a,_0x2e91('0xf'));_0x1bf2e9(_0x530db4['result'][_0x2e91('0x13')]);}})[_0x2e91('0x14')](function(_0x346828){logger[_0x2e91('0x11')](_0x2e91('0xc'),_0x399d9a,_0x346828);_0x1e73fd(_0x346828);});});}exports[_0x2e91('0x15')]=function(_0x178260){var _0xd0598=this;return new Promise(function(_0x5686a6,_0x456a04){return db['Dynamics365Account'][_0x2e91('0x16')]({'raw':_0x178260[_0x2e91('0x17')]?_0x178260['options'][_0x2e91('0x18')]===undefined?!![]:![]:!![],'where':_0x178260[_0x2e91('0x17')]?_0x178260[_0x2e91('0x17')][_0x2e91('0x19')]||null:null,'attributes':_0x178260[_0x2e91('0x17')]?_0x178260[_0x2e91('0x17')][_0x2e91('0x1a')]||null:null,'limit':_0x178260[_0x2e91('0x17')]?_0x178260['options'][_0x2e91('0x1b')]||null:null,'include':_0x178260[_0x2e91('0x17')]?_0x178260[_0x2e91('0x17')][_0x2e91('0x1c')]?_['map'](_0x178260[_0x2e91('0x17')][_0x2e91('0x1c')],function(_0x3ff36e){return{'model':db[_0x3ff36e[_0x2e91('0x1d')]],'as':_0x3ff36e['as'],'attributes':_0x3ff36e[_0x2e91('0x1a')],'include':_0x3ff36e[_0x2e91('0x1c')]?_[_0x2e91('0x1e')](_0x3ff36e[_0x2e91('0x1c')],function(_0x1beed4){return{'model':db[_0x1beed4[_0x2e91('0x1d')]],'as':_0x1beed4['as'],'attributes':_0x1beed4[_0x2e91('0x1a')],'include':_0x1beed4[_0x2e91('0x1c')]?_[_0x2e91('0x1e')](_0x1beed4[_0x2e91('0x1c')],function(_0x29b090){return{'model':db[_0x29b090['model']],'as':_0x29b090['as'],'attributes':_0x29b090[_0x2e91('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x485205){logger[_0x2e91('0xb')](_0x2e91('0x15'),_0x178260);logger['debug'](_0x2e91('0x15'),_0x178260,JSON[_0x2e91('0x10')](_0x485205));_0x5686a6(_0x485205);})[_0x2e91('0x14')](function(_0x421308){logger[_0x2e91('0x11')](_0x2e91('0x15'),_0x421308[_0x2e91('0x13')],_0x178260);_0x456a04(_0xd0598[_0x2e91('0x11')](0x1f4,_0x421308['message']));});});};exports['ShowDynamics365Account']=function(_0x39139c){var _0x59e62a=this;return new Promise(function(_0x29b36a,_0x2ed9b0){return db[_0x2e91('0x1f')][_0x2e91('0x20')]({'raw':_0x39139c[_0x2e91('0x17')]?_0x39139c['options']['raw']===undefined?!![]:![]:!![],'where':_0x39139c[_0x2e91('0x17')]?_0x39139c[_0x2e91('0x17')]['where']||null:null,'attributes':_0x39139c[_0x2e91('0x17')]?_0x39139c[_0x2e91('0x17')][_0x2e91('0x1a')]||null:null,'include':_0x39139c[_0x2e91('0x17')]?_0x39139c[_0x2e91('0x17')][_0x2e91('0x1c')]?_['map'](_0x39139c[_0x2e91('0x17')][_0x2e91('0x1c')],function(_0x565353){return{'model':db[_0x565353['model']],'as':_0x565353['as'],'attributes':_0x565353['attributes'],'include':_0x565353[_0x2e91('0x1c')]?_[_0x2e91('0x1e')](_0x565353[_0x2e91('0x1c')],function(_0x520d61){return{'model':db[_0x520d61[_0x2e91('0x1d')]],'as':_0x520d61['as'],'attributes':_0x520d61[_0x2e91('0x1a')],'include':_0x520d61[_0x2e91('0x1c')]?_[_0x2e91('0x1e')](_0x520d61[_0x2e91('0x1c')],function(_0x227735){return{'model':db[_0x227735[_0x2e91('0x1d')]],'as':_0x227735['as'],'attributes':_0x227735[_0x2e91('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2e91('0xa')](function(_0x4f8a38){logger[_0x2e91('0xb')]('ShowDynamics365Account',_0x39139c);logger[_0x2e91('0xd')]('ShowDynamics365Account',_0x39139c,JSON[_0x2e91('0x10')](_0x4f8a38));_0x29b36a(_0x4f8a38);})[_0x2e91('0x14')](function(_0x1dff1d){logger[_0x2e91('0x11')](_0x2e91('0x21'),_0x1dff1d[_0x2e91('0x13')],_0x39139c);_0x2ed9b0(_0x59e62a[_0x2e91('0x11')](0x1f4,_0x1dff1d[_0x2e91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1387a4e..f1b4bcc 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 _0x3441=['/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','isAuthenticated','index','get'];(function(_0x3e0638,_0x5ad6a0){var _0x40f220=function(_0x369b31){while(--_0x369b31){_0x3e0638['push'](_0x3e0638['shift']());}};_0x40f220(++_0x5ad6a0);}(_0x3441,0x14b));var _0x1344=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0x3441[_0x411e5d];return _0x58298;};'use strict';var multer=require(_0x1344('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1344('0x1'));var express=require(_0x1344('0x2'));var router=express['Router']();var fs_extra=require(_0x1344('0x3'));var auth=require(_0x1344('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1344('0x5'));router['get']('/',auth[_0x1344('0x6')](),controller[_0x1344('0x7')]);router[_0x1344('0x8')](_0x1344('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1344('0x8')](_0x1344('0xa'),auth[_0x1344('0x6')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x1344('0x6')](),controller[_0x1344('0xb')]);router[_0x1344('0x8')](_0x1344('0xc'),auth[_0x1344('0x6')](),controller[_0x1344('0xd')]);router[_0x1344('0xe')]('/',auth[_0x1344('0x6')](),controller[_0x1344('0xf')]);router[_0x1344('0x10')](_0x1344('0x9'),auth[_0x1344('0x6')](),controller[_0x1344('0x11')]);router['delete'](_0x1344('0x9'),auth[_0x1344('0x6')](),controller[_0x1344('0x12')]);module[_0x1344('0x13')]=router; \ No newline at end of file +var _0xcb3e=['./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x22facf,_0x4a2b55){var _0x35c848=function(_0x48f8b2){while(--_0x48f8b2){_0x22facf['push'](_0x22facf['shift']());}};_0x35c848(++_0x4a2b55);}(_0xcb3e,0x79));var _0xecb3=function(_0x6ebfd6,_0x4d6a9c){_0x6ebfd6=_0x6ebfd6-0x0;var _0x5c004c=_0xcb3e[_0x6ebfd6];return _0x5c004c;};'use strict';var multer=require(_0xecb3('0x0'));var util=require('util');var path=require(_0xecb3('0x1'));var timeout=require(_0xecb3('0x2'));var express=require(_0xecb3('0x3'));var router=express[_0xecb3('0x4')]();var fs_extra=require(_0xecb3('0x5'));var auth=require(_0xecb3('0x6'));var interaction=require(_0xecb3('0x7'));var config=require(_0xecb3('0x8'));var controller=require(_0xecb3('0x9'));router[_0xecb3('0xa')]('/',auth[_0xecb3('0xb')](),controller[_0xecb3('0xc')]);router[_0xecb3('0xa')]('/:id',auth[_0xecb3('0xb')](),controller[_0xecb3('0xd')]);router[_0xecb3('0xa')](_0xecb3('0xe'),auth[_0xecb3('0xb')](),controller[_0xecb3('0xf')]);router[_0xecb3('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xecb3('0x10')]);router[_0xecb3('0xa')](_0xecb3('0x11'),auth[_0xecb3('0xb')](),controller[_0xecb3('0x12')]);router[_0xecb3('0x13')]('/',auth[_0xecb3('0xb')](),controller[_0xecb3('0x14')]);router[_0xecb3('0x15')](_0xecb3('0x16'),auth['isAuthenticated'](),controller[_0xecb3('0x17')]);router[_0xecb3('0x18')](_0xecb3('0x16'),auth[_0xecb3('0xb')](),controller['destroy']);module[_0xecb3('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ba5640e..560d379 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 _0x63ca=['STRING','ENUM','incident','nothing','contact','sequelize'];(function(_0xfab997,_0x3c1244){var _0x3e54bc=function(_0x7a08c6){while(--_0x7a08c6){_0xfab997['push'](_0xfab997['shift']());}};_0x3e54bc(++_0x3c1244);}(_0x63ca,0xc5));var _0xa63c=function(_0x3eb052,_0x5c8591){_0x3eb052=_0x3eb052-0x0;var _0x411e93=_0x63ca[_0x3eb052];return _0x411e93;};'use strict';var Sequelize=require(_0xa63c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa63c('0x1')]},'description':{'type':Sequelize[_0xa63c('0x1')]},'ticketType':{'type':Sequelize[_0xa63c('0x2')]('incident','phonecall'),'defaultValue':_0xa63c('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xa63c('0x4')),'defaultValue':_0xa63c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa63c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc384=['exports','STRING','ENUM','incident','phonecall','contact','BOOLEAN','sequelize'];(function(_0x197c36,_0x5cd3b9){var _0x57e185=function(_0x2b9d72){while(--_0x2b9d72){_0x197c36['push'](_0x197c36['shift']());}};_0x57e185(++_0x5cd3b9);}(_0xc384,0x19f));var _0x4c38=function(_0x45c448,_0x326332){_0x45c448=_0x45c448-0x0;var _0x415d10=_0xc384[_0x45c448];return _0x415d10;};'use strict';var Sequelize=require(_0x4c38('0x0'));module[_0x4c38('0x1')]={'name':{'type':Sequelize[_0x4c38('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4c38('0x3')](_0x4c38('0x4'),_0x4c38('0x5')),'defaultValue':_0x4c38('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact','nothing'),'defaultValue':_0x4c38('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x4c38('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4c38('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1d5c626..f2a5737 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 _0x8f06=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','includeAll','find','create','body','then','params','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8f06,0x6c));var _0x68f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f06[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68f0('0x0'));var zipdir=require(_0x68f0('0x1'));var jsonpatch=require(_0x68f0('0x2'));var rp=require(_0x68f0('0x3'));var moment=require(_0x68f0('0x4'));var BPromise=require(_0x68f0('0x5'));var Mustache=require(_0x68f0('0x6'));var util=require(_0x68f0('0x7'));var path=require('path');var sox=require(_0x68f0('0x8'));var csv=require(_0x68f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68f0('0xa'));var squel=require(_0x68f0('0xb'));var crypto=require('crypto');var jsforce=require(_0x68f0('0xc'));var deskjs=require(_0x68f0('0xd'));var toCsv=require(_0x68f0('0x9'));var querystring=require(_0x68f0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x68f0('0xf'));var qs=require(_0x68f0('0x10'));var as=require(_0x68f0('0x11'));var hardwareService=require(_0x68f0('0x12'));var logger=require(_0x68f0('0x13'))(_0x68f0('0x14'));var utils=require(_0x68f0('0x15'));var config=require(_0x68f0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x68f0('0x17'))['db'];function respondWithStatusCode(_0x1c904a,_0x280594){_0x280594=_0x280594||0xcc;return function(_0x4d4d32){if(_0x4d4d32){return _0x1c904a[_0x68f0('0x18')](_0x280594);}return _0x1c904a[_0x68f0('0x19')](_0x280594)[_0x68f0('0x1a')]();};}function respondWithResult(_0x5db1ff,_0xc879b9){_0xc879b9=_0xc879b9||0xc8;return function(_0x5d98d0){if(_0x5d98d0){return _0x5db1ff[_0x68f0('0x19')](_0xc879b9)[_0x68f0('0x1b')](_0x5d98d0);}};}function respondWithFilteredResult(_0x2e4c70,_0x1a6fde){return function(_0x72201f){if(_0x72201f){var _0x64404f=typeof _0x1a6fde[_0x68f0('0x1c')]===_0x68f0('0x1d')&&typeof _0x1a6fde[_0x68f0('0x1e')]==='undefined';var _0x39f95a=_0x72201f[_0x68f0('0x1f')];var _0x49d139=_0x64404f?0x0:_0x1a6fde['offset'];var _0x7d58e1=_0x64404f?_0x72201f[_0x68f0('0x1f')]:_0x1a6fde[_0x68f0('0x1c')]+_0x1a6fde[_0x68f0('0x1e')];var _0x3aa092;if(_0x7d58e1>=_0x39f95a){_0x7d58e1=_0x39f95a;_0x3aa092=0xc8;}else{_0x3aa092=0xce;}_0x2e4c70[_0x68f0('0x19')](_0x3aa092);return _0x2e4c70[_0x68f0('0x20')](_0x68f0('0x21'),_0x49d139+'-'+_0x7d58e1+'/'+_0x39f95a)[_0x68f0('0x1b')](_0x72201f);}return null;};}function patchUpdates(_0x5b9363){return function(_0x17290b){try{jsonpatch['apply'](_0x17290b,_0x5b9363,!![]);}catch(_0x1d439c){return BPromise[_0x68f0('0x22')](_0x1d439c);}return _0x17290b[_0x68f0('0x23')]();};}function saveUpdates(_0x2ff378,_0x228fe3){return function(_0x222e7c){if(_0x222e7c){return _0x222e7c['update'](_0x2ff378)['then'](function(_0x4dde44){return _0x4dde44;});}return null;};}function removeEntity(_0x4400f9,_0x8abfce){return function(_0x3d6c59){if(_0x3d6c59){return _0x3d6c59[_0x68f0('0x24')]()['then'](function(){_0x4400f9[_0x68f0('0x19')](0xcc)[_0x68f0('0x1a')]();});}};}function handleEntityNotFound(_0x4b7ad6,_0x24bb42){return function(_0x894ee6){if(!_0x894ee6){_0x4b7ad6[_0x68f0('0x18')](0x194);}return _0x894ee6;};}function handleError(_0x4c6880,_0x36fab7){_0x36fab7=_0x36fab7||0x1f4;return function(_0x3bc0fe){logger['error'](_0x3bc0fe[_0x68f0('0x25')]);if(_0x3bc0fe[_0x68f0('0x26')]){delete _0x3bc0fe[_0x68f0('0x26')];}_0x4c6880[_0x68f0('0x19')](_0x36fab7)[_0x68f0('0x27')](_0x3bc0fe);};}exports[_0x68f0('0x28')]=function(_0x1324e8,_0x1920a4){var _0x455806={},_0x46c9ba={},_0x54457d={'count':0x0,'rows':[]};var _0x571a22=_[_0x68f0('0x29')](db[_0x68f0('0x2a')][_0x68f0('0x2b')],function(_0x3e53ca){return{'name':_0x3e53ca[_0x68f0('0x2c')],'type':_0x3e53ca[_0x68f0('0x2d')]['key']};});_0x46c9ba[_0x68f0('0x2e')]=_[_0x68f0('0x29')](_0x571a22,_0x68f0('0x26'));_0x46c9ba[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x1324e8[_0x68f0('0x2f')]);_0x46c9ba[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x46c9ba[_0x68f0('0x2e')],_0x46c9ba[_0x68f0('0x2f')]);_0x455806['attributes']=_[_0x68f0('0x32')](_0x46c9ba[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x1324e8['query'][_0x68f0('0x33')]));_0x455806['attributes']=_0x455806[_0x68f0('0x34')][_0x68f0('0x35')]?_0x455806[_0x68f0('0x34')]:_0x46c9ba[_0x68f0('0x2e')];if(!_0x1324e8[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x455806[_0x68f0('0x1e')]=qs['limit'](_0x1324e8[_0x68f0('0x2f')][_0x68f0('0x1e')]);_0x455806[_0x68f0('0x1c')]=qs['offset'](_0x1324e8[_0x68f0('0x2f')]['offset']);}_0x455806[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x1324e8[_0x68f0('0x2f')]['sort']);_0x455806[_0x68f0('0x3a')]=qs['filters'](_[_0x68f0('0x3b')](_0x1324e8[_0x68f0('0x2f')],_0x46c9ba['filters']),_0x571a22);if(_0x1324e8[_0x68f0('0x2f')]['filter']){_0x455806['where']=_['merge'](_0x455806[_0x68f0('0x3a')],{'$or':_['map'](_0x571a22,function(_0x33eebc){if(_0x33eebc['type']!==_0x68f0('0x3c')){var _0x1e2beb={};_0x1e2beb[_0x33eebc[_0x68f0('0x26')]]={'$like':'%'+_0x1324e8['query'][_0x68f0('0x3d')]+'%'};return _0x1e2beb;}})});}_0x455806=_[_0x68f0('0x3e')]({},_0x455806,_0x1324e8[_0x68f0('0x3f')]);var _0xd45b05={'where':_0x455806[_0x68f0('0x3a')]};return db['Dynamics365Configuration']['count'](_0xd45b05)['then'](function(_0x3dcc15){_0x54457d['count']=_0x3dcc15;if(_0x1324e8['query']['includeAll']){_0x455806[_0x68f0('0x40')]=[{'all':!![]}];}return db[_0x68f0('0x2a')][_0x68f0('0x41')](_0x455806);})['then'](function(_0xfa8acb){_0x54457d[_0x68f0('0x42')]=_0xfa8acb;return _0x54457d;})['then'](respondWithFilteredResult(_0x1920a4,_0x455806))[_0x68f0('0x43')](handleError(_0x1920a4,null));};exports['show']=function(_0x4b476c,_0x572dc0){var _0x3b8040={'raw':![],'where':{'id':_0x4b476c['params']['id']}},_0x3b16b1={};_0x3b16b1[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db[_0x68f0('0x2a')][_0x68f0('0x2b')]);_0x3b16b1['query']=_['keys'](_0x4b476c[_0x68f0('0x2f')]);_0x3b16b1[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x3b16b1['model'],_0x3b16b1[_0x68f0('0x2f')]);_0x3b8040[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x3b16b1['model'],qs[_0x68f0('0x33')](_0x4b476c[_0x68f0('0x2f')]['fields']));_0x3b8040[_0x68f0('0x34')]=_0x3b8040[_0x68f0('0x34')][_0x68f0('0x35')]?_0x3b8040['attributes']:_0x3b16b1[_0x68f0('0x2e')];if(_0x4b476c[_0x68f0('0x2f')][_0x68f0('0x44')]){_0x3b8040[_0x68f0('0x40')]=[{'all':!![]}];}_0x3b8040=_['merge']({},_0x3b8040,_0x4b476c[_0x68f0('0x3f')]);return db['Dynamics365Configuration'][_0x68f0('0x45')](_0x3b8040)['then'](handleEntityNotFound(_0x572dc0,null))['then'](respondWithResult(_0x572dc0,null))[_0x68f0('0x43')](handleError(_0x572dc0,null));};exports[_0x68f0('0x46')]=function(_0x383cfd,_0x1bf71c){return db[_0x68f0('0x2a')]['create'](_0x383cfd[_0x68f0('0x47')],{})[_0x68f0('0x48')](respondWithResult(_0x1bf71c,0xc9))['catch'](handleError(_0x1bf71c,null));};exports['update']=function(_0x11ddda,_0x22fbbf){if(_0x11ddda[_0x68f0('0x47')]['id']){delete _0x11ddda[_0x68f0('0x47')]['id'];}return db[_0x68f0('0x2a')][_0x68f0('0x45')]({'where':{'id':_0x11ddda[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x22fbbf,null))[_0x68f0('0x48')](saveUpdates(_0x11ddda[_0x68f0('0x47')],null))[_0x68f0('0x48')](respondWithResult(_0x22fbbf,null))[_0x68f0('0x43')](handleError(_0x22fbbf,null));};exports[_0x68f0('0x24')]=function(_0xbe3c4f,_0x1f3413){return db['Dynamics365Configuration'][_0x68f0('0x45')]({'where':{'id':_0xbe3c4f[_0x68f0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f3413,null))[_0x68f0('0x48')](removeEntity(_0x1f3413,null))[_0x68f0('0x43')](handleError(_0x1f3413,null));};exports[_0x68f0('0x4a')]=function(_0x331b40,_0x288713,_0x5b2d59){var _0x587729={};var _0x2cc18f={};var _0x544cab;var _0x3e501f;return db[_0x68f0('0x2a')][_0x68f0('0x4b')]({'where':{'id':_0x331b40[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x288713,null))[_0x68f0('0x48')](function(_0x344c96){if(_0x344c96){_0x544cab=_0x344c96;_0x2cc18f[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db['Dynamics365Field'][_0x68f0('0x2b')]);_0x2cc18f[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x331b40[_0x68f0('0x2f')]);_0x2cc18f[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x2cc18f[_0x68f0('0x2e')],_0x2cc18f['query']);_0x587729[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x2cc18f[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x587729[_0x68f0('0x34')]=_0x587729[_0x68f0('0x34')][_0x68f0('0x35')]?_0x587729[_0x68f0('0x34')]:_0x2cc18f[_0x68f0('0x2e')];_0x587729[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x39')]);_0x587729[_0x68f0('0x3a')]=qs[_0x68f0('0x31')](_[_0x68f0('0x3b')](_0x331b40[_0x68f0('0x2f')],_0x2cc18f[_0x68f0('0x31')]));if(_0x331b40[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x587729[_0x68f0('0x3a')]=_['merge'](_0x587729[_0x68f0('0x3a')],{'$or':_[_0x68f0('0x29')](_0x587729[_0x68f0('0x34')],function(_0x49c88c){var _0x4c5b36={};_0x4c5b36[_0x49c88c]={'$like':'%'+_0x331b40[_0x68f0('0x2f')][_0x68f0('0x3d')]+'%'};return _0x4c5b36;})});}_0x587729=_[_0x68f0('0x3e')]({},_0x587729,_0x331b40[_0x68f0('0x3f')]);return _0x544cab[_0x68f0('0x4a')](_0x587729);}})[_0x68f0('0x48')](function(_0x3e44ac){if(_0x3e44ac){_0x3e501f=_0x3e44ac[_0x68f0('0x35')];if(!_0x331b40[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x587729['limit']=qs[_0x68f0('0x1e')](_0x331b40['query'][_0x68f0('0x1e')]);_0x587729[_0x68f0('0x1c')]=qs['offset'](_0x331b40[_0x68f0('0x2f')][_0x68f0('0x1c')]);}return _0x544cab[_0x68f0('0x4a')](_0x587729);}})[_0x68f0('0x48')](function(_0x1c1554){if(_0x1c1554){return _0x1c1554?{'count':_0x3e501f,'rows':_0x1c1554}:null;}})['then'](respondWithResult(_0x288713,null))[_0x68f0('0x43')](handleError(_0x288713,null));};exports[_0x68f0('0x4c')]=function(_0x2383b7,_0x8a663f,_0x552f52){var _0x161f09={};var _0x2c7d65={};var _0x2bfe06;var _0x5320a3;return db[_0x68f0('0x2a')]['findOne']({'where':{'id':_0x2383b7[_0x68f0('0x49')]['id']}})[_0x68f0('0x48')](handleEntityNotFound(_0x8a663f,null))['then'](function(_0x4a2af3){if(_0x4a2af3){_0x2bfe06=_0x4a2af3;_0x2c7d65[_0x68f0('0x2e')]=_[_0x68f0('0x30')](db[_0x68f0('0x4d')][_0x68f0('0x2b')]);_0x2c7d65[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x2383b7['query']);_0x2c7d65[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x2c7d65[_0x68f0('0x2e')],_0x2c7d65[_0x68f0('0x2f')]);_0x161f09[_0x68f0('0x34')]=_['intersection'](_0x2c7d65[_0x68f0('0x2e')],qs['fields'](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x161f09[_0x68f0('0x34')]=_0x161f09[_0x68f0('0x34')]['length']?_0x161f09[_0x68f0('0x34')]:_0x2c7d65[_0x68f0('0x2e')];_0x161f09[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x2383b7['query'][_0x68f0('0x39')]);_0x161f09['where']=qs[_0x68f0('0x31')](_['pick'](_0x2383b7['query'],_0x2c7d65[_0x68f0('0x31')]));if(_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x161f09[_0x68f0('0x3a')]=_[_0x68f0('0x3e')](_0x161f09[_0x68f0('0x3a')],{'$or':_[_0x68f0('0x29')](_0x161f09[_0x68f0('0x34')],function(_0x2fb91b){var _0x2c1cb3={};_0x2c1cb3[_0x2fb91b]={'$like':'%'+_0x2383b7['query']['filter']+'%'};return _0x2c1cb3;})});}_0x161f09=_['merge']({},_0x161f09,_0x2383b7[_0x68f0('0x3f')]);return _0x2bfe06[_0x68f0('0x4c')](_0x161f09);}})[_0x68f0('0x48')](function(_0x19db3c){if(_0x19db3c){_0x5320a3=_0x19db3c[_0x68f0('0x35')];if(!_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x36')](_0x68f0('0x37'))){_0x161f09[_0x68f0('0x1e')]=qs['limit'](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x1e')]);_0x161f09[_0x68f0('0x1c')]=qs[_0x68f0('0x1c')](_0x2383b7[_0x68f0('0x2f')][_0x68f0('0x1c')]);}return _0x2bfe06[_0x68f0('0x4c')](_0x161f09);}})[_0x68f0('0x48')](function(_0x1055d2){if(_0x1055d2){return _0x1055d2?{'count':_0x5320a3,'rows':_0x1055d2}:null;}})[_0x68f0('0x48')](respondWithResult(_0x8a663f,null))[_0x68f0('0x43')](handleError(_0x8a663f,null));};exports['getDescriptions']=function(_0x32d8c3,_0x144d64,_0xa07616){var _0x2a7229={};var _0x354df4={};var _0x23ef61;var _0x3c85d8;return db['Dynamics365Configuration'][_0x68f0('0x4b')]({'where':{'id':_0x32d8c3['params']['id']}})['then'](handleEntityNotFound(_0x144d64,null))[_0x68f0('0x48')](function(_0xda9dae){if(_0xda9dae){_0x23ef61=_0xda9dae;_0x354df4['model']=_[_0x68f0('0x30')](db[_0x68f0('0x4d')][_0x68f0('0x2b')]);_0x354df4[_0x68f0('0x2f')]=_[_0x68f0('0x30')](_0x32d8c3[_0x68f0('0x2f')]);_0x354df4[_0x68f0('0x31')]=_[_0x68f0('0x32')](_0x354df4[_0x68f0('0x2e')],_0x354df4[_0x68f0('0x2f')]);_0x2a7229[_0x68f0('0x34')]=_[_0x68f0('0x32')](_0x354df4[_0x68f0('0x2e')],qs[_0x68f0('0x33')](_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x33')]));_0x2a7229[_0x68f0('0x34')]=_0x2a7229[_0x68f0('0x34')][_0x68f0('0x35')]?_0x2a7229[_0x68f0('0x34')]:_0x354df4[_0x68f0('0x2e')];_0x2a7229[_0x68f0('0x38')]=qs[_0x68f0('0x39')](_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x39')]);_0x2a7229[_0x68f0('0x3a')]=qs[_0x68f0('0x31')](_[_0x68f0('0x3b')](_0x32d8c3[_0x68f0('0x2f')],_0x354df4[_0x68f0('0x31')]));if(_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x3d')]){_0x2a7229[_0x68f0('0x3a')]=_[_0x68f0('0x3e')](_0x2a7229['where'],{'$or':_[_0x68f0('0x29')](_0x2a7229[_0x68f0('0x34')],function(_0x324084){var _0x431449={};_0x431449[_0x324084]={'$like':'%'+_0x32d8c3[_0x68f0('0x2f')][_0x68f0('0x3d')]+'%'};return _0x431449;})});}_0x2a7229=_['merge']({},_0x2a7229,_0x32d8c3['options']);return _0x23ef61[_0x68f0('0x4e')](_0x2a7229);}})['then'](function(_0x5e9f7f){if(_0x5e9f7f){_0x3c85d8=_0x5e9f7f[_0x68f0('0x35')];if(!_0x32d8c3[_0x68f0('0x2f')]['hasOwnProperty'](_0x68f0('0x37'))){_0x2a7229[_0x68f0('0x1e')]=qs[_0x68f0('0x1e')](_0x32d8c3[_0x68f0('0x2f')]['limit']);_0x2a7229[_0x68f0('0x1c')]=qs[_0x68f0('0x1c')](_0x32d8c3['query'][_0x68f0('0x1c')]);}return _0x23ef61[_0x68f0('0x4e')](_0x2a7229);}})['then'](function(_0x40d0d6){if(_0x40d0d6){return _0x40d0d6?{'count':_0x3c85d8,'rows':_0x40d0d6}:null;}})['then'](respondWithResult(_0x144d64,null))[_0x68f0('0x43')](handleError(_0x144d64,null));}; \ No newline at end of file +var _0x6b50=['keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','Dynamics365Configuration','find','create','body','update','params','destroy','getFields','Dynamics365Field','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','query'];(function(_0x285314,_0x117c38){var _0x1e5080=function(_0x57e0e3){while(--_0x57e0e3){_0x285314['push'](_0x285314['shift']());}};_0x1e5080(++_0x117c38);}(_0x6b50,0x170));var _0x06b5=function(_0x15ecd2,_0x600e1c){_0x15ecd2=_0x15ecd2-0x0;var _0xd60d33=_0x6b50[_0x15ecd2];return _0xd60d33;};'use strict';var emlformat=require(_0x06b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06b5('0x1'));var jsonpatch=require(_0x06b5('0x2'));var rp=require(_0x06b5('0x3'));var moment=require(_0x06b5('0x4'));var BPromise=require(_0x06b5('0x5'));var Mustache=require(_0x06b5('0x6'));var util=require(_0x06b5('0x7'));var path=require(_0x06b5('0x8'));var sox=require('sox');var csv=require(_0x06b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x06b5('0xa'));var crypto=require(_0x06b5('0xb'));var jsforce=require(_0x06b5('0xc'));var deskjs=require(_0x06b5('0xd'));var toCsv=require(_0x06b5('0x9'));var querystring=require(_0x06b5('0xe'));var Papa=require(_0x06b5('0xf'));var Redis=require(_0x06b5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06b5('0x11'));var as=require(_0x06b5('0x12'));var hardwareService=require(_0x06b5('0x13'));var logger=require('../../config/logger')(_0x06b5('0x14'));var utils=require(_0x06b5('0x15'));var config=require(_0x06b5('0x16'));var licenseUtil=require(_0x06b5('0x17'));var db=require(_0x06b5('0x18'))['db'];function respondWithStatusCode(_0x26b8ce,_0x2f58f9){_0x2f58f9=_0x2f58f9||0xcc;return function(_0x47ec51){if(_0x47ec51){return _0x26b8ce[_0x06b5('0x19')](_0x2f58f9);}return _0x26b8ce[_0x06b5('0x1a')](_0x2f58f9)[_0x06b5('0x1b')]();};}function respondWithResult(_0x493728,_0x16f8e5){_0x16f8e5=_0x16f8e5||0xc8;return function(_0x5ef4de){if(_0x5ef4de){return _0x493728['status'](_0x16f8e5)['json'](_0x5ef4de);}};}function respondWithFilteredResult(_0x241ad9,_0x461819){return function(_0xda99b5){if(_0xda99b5){var _0x4968e9=typeof _0x461819['offset']===_0x06b5('0x1c')&&typeof _0x461819['limit']==='undefined';var _0x8ed2f8=_0xda99b5[_0x06b5('0x1d')];var _0x451dd4=_0x4968e9?0x0:_0x461819[_0x06b5('0x1e')];var _0x406346=_0x4968e9?_0xda99b5[_0x06b5('0x1d')]:_0x461819[_0x06b5('0x1e')]+_0x461819[_0x06b5('0x1f')];var _0x5ba0fe;if(_0x406346>=_0x8ed2f8){_0x406346=_0x8ed2f8;_0x5ba0fe=0xc8;}else{_0x5ba0fe=0xce;}_0x241ad9['status'](_0x5ba0fe);return _0x241ad9[_0x06b5('0x20')]('Content-Range',_0x451dd4+'-'+_0x406346+'/'+_0x8ed2f8)[_0x06b5('0x21')](_0xda99b5);}return null;};}function patchUpdates(_0x3e9154){return function(_0x47026d){try{jsonpatch[_0x06b5('0x22')](_0x47026d,_0x3e9154,!![]);}catch(_0x342aa2){return BPromise[_0x06b5('0x23')](_0x342aa2);}return _0x47026d[_0x06b5('0x24')]();};}function saveUpdates(_0x12f133,_0x44c784){return function(_0x2c909f){if(_0x2c909f){return _0x2c909f['update'](_0x12f133)[_0x06b5('0x25')](function(_0x2c3fc7){return _0x2c3fc7;});}return null;};}function removeEntity(_0x44dfa9,_0x22855f){return function(_0x1baf93){if(_0x1baf93){return _0x1baf93['destroy']()['then'](function(){_0x44dfa9[_0x06b5('0x1a')](0xcc)[_0x06b5('0x1b')]();});}};}function handleEntityNotFound(_0x4bd041,_0x2eafd9){return function(_0x4fd99c){if(!_0x4fd99c){_0x4bd041[_0x06b5('0x19')](0x194);}return _0x4fd99c;};}function handleError(_0x966ac0,_0x5be6fb){_0x5be6fb=_0x5be6fb||0x1f4;return function(_0x18cfe9){logger[_0x06b5('0x26')](_0x18cfe9[_0x06b5('0x27')]);if(_0x18cfe9[_0x06b5('0x28')]){delete _0x18cfe9[_0x06b5('0x28')];}_0x966ac0[_0x06b5('0x1a')](_0x5be6fb)[_0x06b5('0x29')](_0x18cfe9);};}exports[_0x06b5('0x2a')]=function(_0x5e8aef,_0x1f9bf4){var _0x48ae59={},_0x5b8a77={},_0x10476c={'count':0x0,'rows':[]};var _0x5b0123=_[_0x06b5('0x2b')](db['Dynamics365Configuration'][_0x06b5('0x2c')],function(_0xd33e4b){return{'name':_0xd33e4b[_0x06b5('0x2d')],'type':_0xd33e4b['type']['key']};});_0x5b8a77['model']=_[_0x06b5('0x2b')](_0x5b0123,'name');_0x5b8a77[_0x06b5('0x2e')]=_[_0x06b5('0x2f')](_0x5e8aef[_0x06b5('0x2e')]);_0x5b8a77[_0x06b5('0x30')]=_['intersection'](_0x5b8a77[_0x06b5('0x31')],_0x5b8a77[_0x06b5('0x2e')]);_0x48ae59['attributes']=_[_0x06b5('0x32')](_0x5b8a77[_0x06b5('0x31')],qs[_0x06b5('0x33')](_0x5e8aef['query'][_0x06b5('0x33')]));_0x48ae59[_0x06b5('0x34')]=_0x48ae59[_0x06b5('0x34')][_0x06b5('0x35')]?_0x48ae59[_0x06b5('0x34')]:_0x5b8a77[_0x06b5('0x31')];if(!_0x5e8aef['query'][_0x06b5('0x36')](_0x06b5('0x37'))){_0x48ae59[_0x06b5('0x1f')]=qs[_0x06b5('0x1f')](_0x5e8aef['query'][_0x06b5('0x1f')]);_0x48ae59[_0x06b5('0x1e')]=qs['offset'](_0x5e8aef['query']['offset']);}_0x48ae59[_0x06b5('0x38')]=qs['sort'](_0x5e8aef[_0x06b5('0x2e')][_0x06b5('0x39')]);_0x48ae59[_0x06b5('0x3a')]=qs[_0x06b5('0x30')](_[_0x06b5('0x3b')](_0x5e8aef['query'],_0x5b8a77[_0x06b5('0x30')]),_0x5b0123);if(_0x5e8aef[_0x06b5('0x2e')]['filter']){_0x48ae59[_0x06b5('0x3a')]=_[_0x06b5('0x3c')](_0x48ae59['where'],{'$or':_[_0x06b5('0x2b')](_0x5b0123,function(_0x2c2403){if(_0x2c2403[_0x06b5('0x3d')]!==_0x06b5('0x3e')){var _0x195269={};_0x195269[_0x2c2403[_0x06b5('0x28')]]={'$like':'%'+_0x5e8aef[_0x06b5('0x2e')][_0x06b5('0x3f')]+'%'};return _0x195269;}})});}_0x48ae59=_[_0x06b5('0x3c')]({},_0x48ae59,_0x5e8aef[_0x06b5('0x40')]);var _0x3a7811={'where':_0x48ae59['where']};return db['Dynamics365Configuration'][_0x06b5('0x1d')](_0x3a7811)[_0x06b5('0x25')](function(_0x20596f){_0x10476c[_0x06b5('0x1d')]=_0x20596f;if(_0x5e8aef[_0x06b5('0x2e')][_0x06b5('0x41')]){_0x48ae59[_0x06b5('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x06b5('0x43')](_0x48ae59);})[_0x06b5('0x25')](function(_0x5594b2){_0x10476c[_0x06b5('0x44')]=_0x5594b2;return _0x10476c;})[_0x06b5('0x25')](respondWithFilteredResult(_0x1f9bf4,_0x48ae59))[_0x06b5('0x45')](handleError(_0x1f9bf4,null));};exports[_0x06b5('0x46')]=function(_0x25c83e,_0x2810c6){var _0x5983c6={'raw':![],'where':{'id':_0x25c83e['params']['id']}},_0x4f22a3={};_0x4f22a3[_0x06b5('0x31')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x4f22a3['query']=_[_0x06b5('0x2f')](_0x25c83e[_0x06b5('0x2e')]);_0x4f22a3[_0x06b5('0x30')]=_[_0x06b5('0x32')](_0x4f22a3[_0x06b5('0x31')],_0x4f22a3['query']);_0x5983c6['attributes']=_[_0x06b5('0x32')](_0x4f22a3['model'],qs['fields'](_0x25c83e[_0x06b5('0x2e')][_0x06b5('0x33')]));_0x5983c6[_0x06b5('0x34')]=_0x5983c6[_0x06b5('0x34')]['length']?_0x5983c6[_0x06b5('0x34')]:_0x4f22a3[_0x06b5('0x31')];if(_0x25c83e[_0x06b5('0x2e')]['includeAll']){_0x5983c6[_0x06b5('0x42')]=[{'all':!![]}];}_0x5983c6=_[_0x06b5('0x3c')]({},_0x5983c6,_0x25c83e['options']);return db[_0x06b5('0x47')][_0x06b5('0x48')](_0x5983c6)[_0x06b5('0x25')](handleEntityNotFound(_0x2810c6,null))[_0x06b5('0x25')](respondWithResult(_0x2810c6,null))[_0x06b5('0x45')](handleError(_0x2810c6,null));};exports[_0x06b5('0x49')]=function(_0x5064ef,_0x47e93d){return db['Dynamics365Configuration']['create'](_0x5064ef[_0x06b5('0x4a')],{})['then'](respondWithResult(_0x47e93d,0xc9))[_0x06b5('0x45')](handleError(_0x47e93d,null));};exports[_0x06b5('0x4b')]=function(_0x51d673,_0x25481b){if(_0x51d673[_0x06b5('0x4a')]['id']){delete _0x51d673[_0x06b5('0x4a')]['id'];}return db[_0x06b5('0x47')][_0x06b5('0x48')]({'where':{'id':_0x51d673[_0x06b5('0x4c')]['id']}})[_0x06b5('0x25')](handleEntityNotFound(_0x25481b,null))[_0x06b5('0x25')](saveUpdates(_0x51d673[_0x06b5('0x4a')],null))['then'](respondWithResult(_0x25481b,null))['catch'](handleError(_0x25481b,null));};exports[_0x06b5('0x4d')]=function(_0x7904c5,_0x24f0e9){return db[_0x06b5('0x47')]['find']({'where':{'id':_0x7904c5[_0x06b5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24f0e9,null))[_0x06b5('0x25')](removeEntity(_0x24f0e9,null))[_0x06b5('0x45')](handleError(_0x24f0e9,null));};exports[_0x06b5('0x4e')]=function(_0xbdf133,_0x149460,_0x5899a0){var _0x1f3ef7={};var _0x1dec35={};var _0x56a9e1;var _0x22d15f;return db[_0x06b5('0x47')]['findOne']({'where':{'id':_0xbdf133[_0x06b5('0x4c')]['id']}})[_0x06b5('0x25')](handleEntityNotFound(_0x149460,null))[_0x06b5('0x25')](function(_0x5f69c0){if(_0x5f69c0){_0x56a9e1=_0x5f69c0;_0x1dec35[_0x06b5('0x31')]=_['keys'](db[_0x06b5('0x4f')][_0x06b5('0x2c')]);_0x1dec35[_0x06b5('0x2e')]=_['keys'](_0xbdf133[_0x06b5('0x2e')]);_0x1dec35[_0x06b5('0x30')]=_[_0x06b5('0x32')](_0x1dec35[_0x06b5('0x31')],_0x1dec35['query']);_0x1f3ef7[_0x06b5('0x34')]=_[_0x06b5('0x32')](_0x1dec35[_0x06b5('0x31')],qs[_0x06b5('0x33')](_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x33')]));_0x1f3ef7[_0x06b5('0x34')]=_0x1f3ef7[_0x06b5('0x34')][_0x06b5('0x35')]?_0x1f3ef7[_0x06b5('0x34')]:_0x1dec35[_0x06b5('0x31')];_0x1f3ef7[_0x06b5('0x38')]=qs[_0x06b5('0x39')](_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x39')]);_0x1f3ef7[_0x06b5('0x3a')]=qs['filters'](_[_0x06b5('0x3b')](_0xbdf133[_0x06b5('0x2e')],_0x1dec35[_0x06b5('0x30')]));if(_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x3f')]){_0x1f3ef7[_0x06b5('0x3a')]=_[_0x06b5('0x3c')](_0x1f3ef7['where'],{'$or':_[_0x06b5('0x2b')](_0x1f3ef7[_0x06b5('0x34')],function(_0x487bfa){var _0x1e05c7={};_0x1e05c7[_0x487bfa]={'$like':'%'+_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x3f')]+'%'};return _0x1e05c7;})});}_0x1f3ef7=_[_0x06b5('0x3c')]({},_0x1f3ef7,_0xbdf133['options']);return _0x56a9e1[_0x06b5('0x4e')](_0x1f3ef7);}})[_0x06b5('0x25')](function(_0x2655ff){if(_0x2655ff){_0x22d15f=_0x2655ff[_0x06b5('0x35')];if(!_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x36')]('nolimit')){_0x1f3ef7[_0x06b5('0x1f')]=qs['limit'](_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x1f')]);_0x1f3ef7[_0x06b5('0x1e')]=qs[_0x06b5('0x1e')](_0xbdf133[_0x06b5('0x2e')][_0x06b5('0x1e')]);}return _0x56a9e1[_0x06b5('0x4e')](_0x1f3ef7);}})[_0x06b5('0x25')](function(_0x2b3da8){if(_0x2b3da8){return _0x2b3da8?{'count':_0x22d15f,'rows':_0x2b3da8}:null;}})[_0x06b5('0x25')](respondWithResult(_0x149460,null))[_0x06b5('0x45')](handleError(_0x149460,null));};exports[_0x06b5('0x50')]=function(_0x1d175c,_0x190d3b,_0x37957b){var _0x4366c5={};var _0x4cc112={};var _0x55b43e;var _0x2d9c74;return db[_0x06b5('0x47')]['findOne']({'where':{'id':_0x1d175c['params']['id']}})[_0x06b5('0x25')](handleEntityNotFound(_0x190d3b,null))[_0x06b5('0x25')](function(_0x1736c9){if(_0x1736c9){_0x55b43e=_0x1736c9;_0x4cc112[_0x06b5('0x31')]=_['keys'](db[_0x06b5('0x4f')]['rawAttributes']);_0x4cc112[_0x06b5('0x2e')]=_['keys'](_0x1d175c['query']);_0x4cc112[_0x06b5('0x30')]=_[_0x06b5('0x32')](_0x4cc112[_0x06b5('0x31')],_0x4cc112[_0x06b5('0x2e')]);_0x4366c5[_0x06b5('0x34')]=_['intersection'](_0x4cc112[_0x06b5('0x31')],qs[_0x06b5('0x33')](_0x1d175c[_0x06b5('0x2e')]['fields']));_0x4366c5['attributes']=_0x4366c5[_0x06b5('0x34')][_0x06b5('0x35')]?_0x4366c5[_0x06b5('0x34')]:_0x4cc112[_0x06b5('0x31')];_0x4366c5[_0x06b5('0x38')]=qs['sort'](_0x1d175c[_0x06b5('0x2e')][_0x06b5('0x39')]);_0x4366c5[_0x06b5('0x3a')]=qs[_0x06b5('0x30')](_[_0x06b5('0x3b')](_0x1d175c['query'],_0x4cc112[_0x06b5('0x30')]));if(_0x1d175c[_0x06b5('0x2e')][_0x06b5('0x3f')]){_0x4366c5[_0x06b5('0x3a')]=_[_0x06b5('0x3c')](_0x4366c5['where'],{'$or':_[_0x06b5('0x2b')](_0x4366c5['attributes'],function(_0x13960e){var _0x4aa419={};_0x4aa419[_0x13960e]={'$like':'%'+_0x1d175c[_0x06b5('0x2e')][_0x06b5('0x3f')]+'%'};return _0x4aa419;})});}_0x4366c5=_[_0x06b5('0x3c')]({},_0x4366c5,_0x1d175c[_0x06b5('0x40')]);return _0x55b43e[_0x06b5('0x50')](_0x4366c5);}})[_0x06b5('0x25')](function(_0x13de1d){if(_0x13de1d){_0x2d9c74=_0x13de1d[_0x06b5('0x35')];if(!_0x1d175c[_0x06b5('0x2e')]['hasOwnProperty'](_0x06b5('0x37'))){_0x4366c5[_0x06b5('0x1f')]=qs['limit'](_0x1d175c[_0x06b5('0x2e')]['limit']);_0x4366c5[_0x06b5('0x1e')]=qs[_0x06b5('0x1e')](_0x1d175c[_0x06b5('0x2e')][_0x06b5('0x1e')]);}return _0x55b43e[_0x06b5('0x50')](_0x4366c5);}})[_0x06b5('0x25')](function(_0x1581b0){if(_0x1581b0){return _0x1581b0?{'count':_0x2d9c74,'rows':_0x1581b0}:null;}})[_0x06b5('0x25')](respondWithResult(_0x190d3b,null))[_0x06b5('0x45')](handleError(_0x190d3b,null));};exports[_0x06b5('0x51')]=function(_0x3a83d3,_0x428560,_0x518129){var _0x42d21d={};var _0x16118a={};var _0x5d05bb;var _0x2559d;return db[_0x06b5('0x47')][_0x06b5('0x52')]({'where':{'id':_0x3a83d3[_0x06b5('0x4c')]['id']}})[_0x06b5('0x25')](handleEntityNotFound(_0x428560,null))[_0x06b5('0x25')](function(_0x3e9d2d){if(_0x3e9d2d){_0x5d05bb=_0x3e9d2d;_0x16118a[_0x06b5('0x31')]=_[_0x06b5('0x2f')](db[_0x06b5('0x4f')][_0x06b5('0x2c')]);_0x16118a[_0x06b5('0x2e')]=_['keys'](_0x3a83d3[_0x06b5('0x2e')]);_0x16118a[_0x06b5('0x30')]=_[_0x06b5('0x32')](_0x16118a[_0x06b5('0x31')],_0x16118a[_0x06b5('0x2e')]);_0x42d21d['attributes']=_[_0x06b5('0x32')](_0x16118a[_0x06b5('0x31')],qs['fields'](_0x3a83d3[_0x06b5('0x2e')]['fields']));_0x42d21d['attributes']=_0x42d21d[_0x06b5('0x34')][_0x06b5('0x35')]?_0x42d21d['attributes']:_0x16118a[_0x06b5('0x31')];_0x42d21d['order']=qs[_0x06b5('0x39')](_0x3a83d3[_0x06b5('0x2e')]['sort']);_0x42d21d[_0x06b5('0x3a')]=qs[_0x06b5('0x30')](_[_0x06b5('0x3b')](_0x3a83d3['query'],_0x16118a[_0x06b5('0x30')]));if(_0x3a83d3[_0x06b5('0x2e')][_0x06b5('0x3f')]){_0x42d21d[_0x06b5('0x3a')]=_[_0x06b5('0x3c')](_0x42d21d[_0x06b5('0x3a')],{'$or':_[_0x06b5('0x2b')](_0x42d21d['attributes'],function(_0x423dd4){var _0x30a576={};_0x30a576[_0x423dd4]={'$like':'%'+_0x3a83d3[_0x06b5('0x2e')][_0x06b5('0x3f')]+'%'};return _0x30a576;})});}_0x42d21d=_[_0x06b5('0x3c')]({},_0x42d21d,_0x3a83d3[_0x06b5('0x40')]);return _0x5d05bb['getDescriptions'](_0x42d21d);}})[_0x06b5('0x25')](function(_0x13f143){if(_0x13f143){_0x2559d=_0x13f143[_0x06b5('0x35')];if(!_0x3a83d3[_0x06b5('0x2e')][_0x06b5('0x36')](_0x06b5('0x37'))){_0x42d21d[_0x06b5('0x1f')]=qs[_0x06b5('0x1f')](_0x3a83d3[_0x06b5('0x2e')][_0x06b5('0x1f')]);_0x42d21d[_0x06b5('0x1e')]=qs[_0x06b5('0x1e')](_0x3a83d3[_0x06b5('0x2e')][_0x06b5('0x1e')]);}return _0x5d05bb['getDescriptions'](_0x42d21d);}})[_0x06b5('0x25')](function(_0x59fc72){if(_0x59fc72){return _0x59fc72?{'count':_0x2559d,'rows':_0x59fc72}:null;}})[_0x06b5('0x25')](respondWithResult(_0x428560,null))[_0x06b5('0x45')](handleError(_0x428560,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4027692..d5956a9 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 _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x008c,0x188));var _0xc008=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x008c[_0x1de8cc];return _0x6f59fa;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0xe6beba,_0x3f15d1){var _0x2f1c08=function(_0x2e7d9f){while(--_0x2e7d9f){_0xe6beba['push'](_0xe6beba['shift']());}};_0x2f1c08(++_0x3f15d1);}(_0x008c,0x188));var _0xc008=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0x008c[_0x49d931];return _0x491a2a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index cee94bc..a979dd8 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 _0x1f3f=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x1f3f,0x165));var _0xf1f3=function(_0x2508fd,_0xa8375b){_0x2508fd=_0x2508fd-0x0;var _0x3ce952=_0x1f3f[_0x2508fd];return _0x3ce952;};'use strict';var _=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var moment=require(_0xf1f3('0x2'));var BPromise=require(_0xf1f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f3('0x4'))['db'];var utils=require(_0xf1f3('0x5'));var logger=require(_0xf1f3('0x6'))(_0xf1f3('0x7'));var config=require(_0xf1f3('0x8'));var jayson=require(_0xf1f3('0x9'));var client=jayson['client'][_0xf1f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f3ad,_0x3a1796,_0x856d5a){return new BPromise(function(_0x2c222d,_0x7a63d2){return client[_0xf1f3('0xb')](_0x25f3ad,_0x856d5a)[_0xf1f3('0xc')](function(_0x595b57){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3a1796,_0xf1f3('0xd'));logger[_0xf1f3('0xe')](_0xf1f3('0xf'),_0x3a1796,_0xf1f3('0xd'),JSON[_0xf1f3('0x10')](_0x595b57));if(_0x595b57[_0xf1f3('0x11')]){if(_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x12')]===0x1f4){logger['error'](_0xf1f3('0x13'),_0x3a1796,_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);return _0x7a63d2(_0x595b57[_0xf1f3('0x11')]['message']);}logger[_0xf1f3('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3a1796,_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);return _0x2c222d(_0x595b57[_0xf1f3('0x11')][_0xf1f3('0x14')]);}else{logger['info'](_0xf1f3('0x13'),_0x3a1796,_0xf1f3('0xd'));_0x2c222d(_0x595b57['result'][_0xf1f3('0x14')]);}})[_0xf1f3('0x15')](function(_0x238215){logger['error'](_0xf1f3('0x13'),_0x3a1796,_0x238215);_0x7a63d2(_0x238215);});});} \ No newline at end of file +var _0x6dc1=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','catch','lodash','util','randomstring'];(function(_0x263a09,_0x1054e3){var _0x38dd46=function(_0x4acf2){while(--_0x4acf2){_0x263a09['push'](_0x263a09['shift']());}};_0x38dd46(++_0x1054e3);}(_0x6dc1,0x1a1));var _0x16dc=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6dc1[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x16dc('0x0'));var util=require(_0x16dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16dc('0x2'));var fs=require('fs');var Redis=require(_0x16dc('0x3'));var db=require(_0x16dc('0x4'))['db'];var utils=require(_0x16dc('0x5'));var logger=require('../../config/logger')(_0x16dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x16dc('0x7')][_0x16dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x312694,_0x5c07e1,_0x3f396f){return new BPromise(function(_0x35028e,_0x1f86b2){return client[_0x16dc('0x9')](_0x312694,_0x3f396f)[_0x16dc('0xa')](function(_0xf40e13){logger[_0x16dc('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c07e1,_0x16dc('0xc'));logger[_0x16dc('0xd')](_0x16dc('0xe'),_0x5c07e1,_0x16dc('0xc'),JSON[_0x16dc('0xf')](_0xf40e13));if(_0xf40e13[_0x16dc('0x10')]){if(_0xf40e13[_0x16dc('0x10')][_0x16dc('0x11')]===0x1f4){logger[_0x16dc('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c07e1,_0xf40e13[_0x16dc('0x10')][_0x16dc('0x12')]);return _0x1f86b2(_0xf40e13[_0x16dc('0x10')][_0x16dc('0x12')]);}logger[_0x16dc('0x10')](_0x16dc('0x13'),_0x5c07e1,_0xf40e13[_0x16dc('0x10')][_0x16dc('0x12')]);return _0x35028e(_0xf40e13[_0x16dc('0x10')][_0x16dc('0x12')]);}else{logger[_0x16dc('0xb')](_0x16dc('0x13'),_0x5c07e1,_0x16dc('0xc'));_0x35028e(_0xf40e13['result'][_0x16dc('0x12')]);}})[_0x16dc('0x14')](function(_0x29606c){logger[_0x16dc('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c07e1,_0x29606c);_0x1f86b2(_0x29606c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bd9fc5b..c0883d6 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 _0xaec4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x361ddd,_0x503739){var _0x3a92da=function(_0x439b0e){while(--_0x439b0e){_0x361ddd['push'](_0x361ddd['shift']());}};_0x3a92da(++_0x503739);}(_0xaec4,0x1c4));var _0x4aec=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaec4[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x4aec('0x0'));var util=require('util');var path=require(_0x4aec('0x1'));var timeout=require(_0x4aec('0x2'));var express=require(_0x4aec('0x3'));var router=express[_0x4aec('0x4')]();var fs_extra=require(_0x4aec('0x5'));var auth=require(_0x4aec('0x6'));var interaction=require(_0x4aec('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x4aec('0x8')]('/',auth['isAuthenticated'](),controller[_0x4aec('0x9')]);router[_0x4aec('0x8')](_0x4aec('0xa'),auth[_0x4aec('0xb')](),controller[_0x4aec('0xc')]);router[_0x4aec('0xd')]('/',auth[_0x4aec('0xb')](),controller[_0x4aec('0xe')]);router[_0x4aec('0xf')]('/:id',auth[_0x4aec('0xb')](),controller[_0x4aec('0x10')]);router['delete'](_0x4aec('0xa'),auth[_0x4aec('0xb')](),controller[_0x4aec('0x11')]);module[_0x4aec('0x12')]=router; \ No newline at end of file +var _0x3932=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','create','update','delete','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3932,0x1f0));var _0x2393=function(_0x121f35,_0x5900cd){_0x121f35=_0x121f35-0x0;var _0x365177=_0x3932[_0x121f35];return _0x365177;};'use strict';var multer=require('multer');var util=require(_0x2393('0x0'));var path=require(_0x2393('0x1'));var timeout=require(_0x2393('0x2'));var express=require(_0x2393('0x3'));var router=express[_0x2393('0x4')]();var fs_extra=require(_0x2393('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2393('0x6'));var config=require(_0x2393('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x2393('0x8')](),controller[_0x2393('0x9')]);router[_0x2393('0xa')](_0x2393('0xb'),auth[_0x2393('0x8')](),controller['show']);router['post']('/',auth[_0x2393('0x8')](),controller[_0x2393('0xc')]);router['put'](_0x2393('0xb'),auth[_0x2393('0x8')](),controller[_0x2393('0xd')]);router[_0x2393('0xe')](_0x2393('0xb'),auth[_0x2393('0x8')](),controller[_0x2393('0xf')]);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 925e259..8be7cee 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 _0xe097=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3c136c,_0x45bd73){var _0x10b4ab=function(_0x3530e7){while(--_0x3530e7){_0x3c136c['push'](_0x3c136c['shift']());}};_0x10b4ab(++_0x45bd73);}(_0xe097,0xd8));var _0x7e09=function(_0xd76857,_0x137b6b){_0xd76857=_0xd76857-0x0;var _0x1fd9b1=_0xe097[_0xd76857];return _0x1fd9b1;};'use strict';var Sequelize=require(_0x7e09('0x0'));module[_0x7e09('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7e09('0x2'),_0x7e09('0x3'),_0x7e09('0x4'),_0x7e09('0x5'),_0x7e09('0x6')),'defaultValue':_0x7e09('0x2')},'content':{'type':Sequelize[_0x7e09('0x7')]},'key':{'type':Sequelize[_0x7e09('0x7')]},'keyType':{'type':Sequelize[_0x7e09('0x8')](_0x7e09('0x2'),_0x7e09('0x3'),_0x7e09('0x4'))},'keyContent':{'type':Sequelize[_0x7e09('0x7')]},'idField':{'type':Sequelize[_0x7e09('0x7')]},'nameField':{'type':Sequelize[_0x7e09('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2771=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x94c335,_0x3a47d8){var _0xe72cae=function(_0x14f12b){while(--_0x14f12b){_0x94c335['push'](_0x94c335['shift']());}};_0xe72cae(++_0x3a47d8);}(_0x2771,0x1bd));var _0x1277=function(_0x2f9626,_0x3451a7){_0x2f9626=_0x2f9626-0x0;var _0x2046b4=_0x2771[_0x2f9626];return _0x2046b4;};'use strict';var Sequelize=require('sequelize');module[_0x1277('0x0')]={'type':{'type':Sequelize[_0x1277('0x1')]('string',_0x1277('0x2'),_0x1277('0x3'),_0x1277('0x4'),'picklist'),'defaultValue':_0x1277('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1277('0x6')]},'keyType':{'type':Sequelize[_0x1277('0x1')](_0x1277('0x5'),_0x1277('0x2'),_0x1277('0x3'))},'keyContent':{'type':Sequelize[_0x1277('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1277('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1277('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 007c259..d34ea42 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 _0x29d3=['key','model','keys','query','attributes','intersection','fields','length','order','filters','pick','filter','where','merge','options','rows','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','Dynamics365Field','fieldName','type'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0x29d3,0x1b0));var _0x329d=function(_0x3c8df0,_0x5500ea){_0x3c8df0=_0x3c8df0-0x0;var _0x55fb99=_0x29d3[_0x3c8df0];return _0x55fb99;};'use strict';var emlformat=require(_0x329d('0x0'));var rimraf=require(_0x329d('0x1'));var zipdir=require(_0x329d('0x2'));var jsonpatch=require(_0x329d('0x3'));var rp=require(_0x329d('0x4'));var moment=require(_0x329d('0x5'));var BPromise=require(_0x329d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x329d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x329d('0x8'));var _=require(_0x329d('0x9'));var squel=require('squel');var crypto=require(_0x329d('0xa'));var jsforce=require(_0x329d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x329d('0xc'));var querystring=require(_0x329d('0xd'));var Papa=require(_0x329d('0xe'));var Redis=require('ioredis');var authService=require(_0x329d('0xf'));var qs=require(_0x329d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x329d('0x11'));var logger=require(_0x329d('0x12'))(_0x329d('0x13'));var utils=require('../../config/utils');var config=require(_0x329d('0x14'));var licenseUtil=require(_0x329d('0x15'));var db=require(_0x329d('0x16'))['db'];function respondWithStatusCode(_0x29a570,_0x54d716){_0x54d716=_0x54d716||0xcc;return function(_0x2bf73f){if(_0x2bf73f){return _0x29a570[_0x329d('0x17')](_0x54d716);}return _0x29a570[_0x329d('0x18')](_0x54d716)[_0x329d('0x19')]();};}function respondWithResult(_0x1e696c,_0x597bb2){_0x597bb2=_0x597bb2||0xc8;return function(_0x56bd9b){if(_0x56bd9b){return _0x1e696c[_0x329d('0x18')](_0x597bb2)['json'](_0x56bd9b);}};}function respondWithFilteredResult(_0x1fa508,_0x1a7771){return function(_0x4a6ea0){if(_0x4a6ea0){var _0x4ed1a3=typeof _0x1a7771[_0x329d('0x1a')]===_0x329d('0x1b')&&typeof _0x1a7771[_0x329d('0x1c')]===_0x329d('0x1b');var _0x53a48d=_0x4a6ea0['count'];var _0x5925d1=_0x4ed1a3?0x0:_0x1a7771['offset'];var _0x5c627b=_0x4ed1a3?_0x4a6ea0[_0x329d('0x1d')]:_0x1a7771[_0x329d('0x1a')]+_0x1a7771['limit'];var _0x7730b0;if(_0x5c627b>=_0x53a48d){_0x5c627b=_0x53a48d;_0x7730b0=0xc8;}else{_0x7730b0=0xce;}_0x1fa508[_0x329d('0x18')](_0x7730b0);return _0x1fa508['set'](_0x329d('0x1e'),_0x5925d1+'-'+_0x5c627b+'/'+_0x53a48d)[_0x329d('0x1f')](_0x4a6ea0);}return null;};}function patchUpdates(_0x3be020){return function(_0x15cd03){try{jsonpatch['apply'](_0x15cd03,_0x3be020,!![]);}catch(_0x507ac3){return BPromise[_0x329d('0x20')](_0x507ac3);}return _0x15cd03[_0x329d('0x21')]();};}function saveUpdates(_0x4bee7a,_0x40898b){return function(_0xdcbf64){if(_0xdcbf64){return _0xdcbf64[_0x329d('0x22')](_0x4bee7a)[_0x329d('0x23')](function(_0x2e605d){return _0x2e605d;});}return null;};}function removeEntity(_0x289f6c,_0x5bb990){return function(_0x1c0e36){if(_0x1c0e36){return _0x1c0e36[_0x329d('0x24')]()[_0x329d('0x23')](function(){_0x289f6c['status'](0xcc)[_0x329d('0x19')]();});}};}function handleEntityNotFound(_0x3ee931,_0x421a44){return function(_0x1a01bb){if(!_0x1a01bb){_0x3ee931[_0x329d('0x17')](0x194);}return _0x1a01bb;};}function handleError(_0x7d7de,_0x3ad3a2){_0x3ad3a2=_0x3ad3a2||0x1f4;return function(_0x12477c){logger['error'](_0x12477c['stack']);if(_0x12477c['name']){delete _0x12477c[_0x329d('0x25')];}_0x7d7de['status'](_0x3ad3a2)[_0x329d('0x26')](_0x12477c);};}exports[_0x329d('0x27')]=function(_0x5eb44c,_0x89c1f9){var _0x186222={},_0x58b886={},_0x35e8ab={'count':0x0,'rows':[]};var _0x448d6c=_[_0x329d('0x28')](db[_0x329d('0x29')]['rawAttributes'],function(_0x36fb57){return{'name':_0x36fb57[_0x329d('0x2a')],'type':_0x36fb57[_0x329d('0x2b')][_0x329d('0x2c')]};});_0x58b886[_0x329d('0x2d')]=_[_0x329d('0x28')](_0x448d6c,_0x329d('0x25'));_0x58b886['query']=_[_0x329d('0x2e')](_0x5eb44c[_0x329d('0x2f')]);_0x58b886['filters']=_['intersection'](_0x58b886[_0x329d('0x2d')],_0x58b886[_0x329d('0x2f')]);_0x186222[_0x329d('0x30')]=_[_0x329d('0x31')](_0x58b886['model'],qs[_0x329d('0x32')](_0x5eb44c[_0x329d('0x2f')]['fields']));_0x186222[_0x329d('0x30')]=_0x186222[_0x329d('0x30')][_0x329d('0x33')]?_0x186222[_0x329d('0x30')]:_0x58b886[_0x329d('0x2d')];if(!_0x5eb44c['query']['hasOwnProperty']('nolimit')){_0x186222[_0x329d('0x1c')]=qs[_0x329d('0x1c')](_0x5eb44c[_0x329d('0x2f')][_0x329d('0x1c')]);_0x186222[_0x329d('0x1a')]=qs['offset'](_0x5eb44c['query']['offset']);}_0x186222[_0x329d('0x34')]=qs['sort'](_0x5eb44c[_0x329d('0x2f')]['sort']);_0x186222['where']=qs[_0x329d('0x35')](_[_0x329d('0x36')](_0x5eb44c[_0x329d('0x2f')],_0x58b886[_0x329d('0x35')]),_0x448d6c);if(_0x5eb44c[_0x329d('0x2f')][_0x329d('0x37')]){_0x186222[_0x329d('0x38')]=_['merge'](_0x186222['where'],{'$or':_['map'](_0x448d6c,function(_0x398cd8){if(_0x398cd8['type']!=='VIRTUAL'){var _0x57e2a7={};_0x57e2a7[_0x398cd8['name']]={'$like':'%'+_0x5eb44c[_0x329d('0x2f')][_0x329d('0x37')]+'%'};return _0x57e2a7;}})});}_0x186222=_[_0x329d('0x39')]({},_0x186222,_0x5eb44c[_0x329d('0x3a')]);var _0x1a5067={'where':_0x186222[_0x329d('0x38')]};return db[_0x329d('0x29')][_0x329d('0x1d')](_0x1a5067)[_0x329d('0x23')](function(_0xb76523){_0x35e8ab[_0x329d('0x1d')]=_0xb76523;if(_0x5eb44c[_0x329d('0x2f')]['includeAll']){_0x186222['include']=[{'all':!![]}];}return db[_0x329d('0x29')]['findAll'](_0x186222);})[_0x329d('0x23')](function(_0x12eaf3){_0x35e8ab[_0x329d('0x3b')]=_0x12eaf3;return _0x35e8ab;})['then'](respondWithFilteredResult(_0x89c1f9,_0x186222))[_0x329d('0x3c')](handleError(_0x89c1f9,null));};exports[_0x329d('0x3d')]=function(_0x2dff4f,_0x476999){var _0x18bd0b={'raw':!![],'where':{'id':_0x2dff4f[_0x329d('0x3e')]['id']}},_0x4f73e3={};_0x4f73e3[_0x329d('0x2d')]=_[_0x329d('0x2e')](db[_0x329d('0x29')]['rawAttributes']);_0x4f73e3[_0x329d('0x2f')]=_[_0x329d('0x2e')](_0x2dff4f[_0x329d('0x2f')]);_0x4f73e3['filters']=_[_0x329d('0x31')](_0x4f73e3[_0x329d('0x2d')],_0x4f73e3[_0x329d('0x2f')]);_0x18bd0b[_0x329d('0x30')]=_[_0x329d('0x31')](_0x4f73e3[_0x329d('0x2d')],qs[_0x329d('0x32')](_0x2dff4f[_0x329d('0x2f')][_0x329d('0x32')]));_0x18bd0b[_0x329d('0x30')]=_0x18bd0b['attributes']['length']?_0x18bd0b['attributes']:_0x4f73e3[_0x329d('0x2d')];if(_0x2dff4f[_0x329d('0x2f')][_0x329d('0x3f')]){_0x18bd0b[_0x329d('0x40')]=[{'all':!![]}];}_0x18bd0b=_['merge']({},_0x18bd0b,_0x2dff4f[_0x329d('0x3a')]);return db[_0x329d('0x29')]['find'](_0x18bd0b)[_0x329d('0x23')](handleEntityNotFound(_0x476999,null))[_0x329d('0x23')](respondWithResult(_0x476999,null))['catch'](handleError(_0x476999,null));};exports[_0x329d('0x41')]=function(_0x52f31b,_0x14f5b9){return db[_0x329d('0x29')]['create'](_0x52f31b[_0x329d('0x42')],{})[_0x329d('0x23')](respondWithResult(_0x14f5b9,0xc9))[_0x329d('0x3c')](handleError(_0x14f5b9,null));};exports['update']=function(_0x1f27aa,_0x1f035b){if(_0x1f27aa[_0x329d('0x42')]['id']){delete _0x1f27aa['body']['id'];}return db[_0x329d('0x29')][_0x329d('0x43')]({'where':{'id':_0x1f27aa[_0x329d('0x3e')]['id']}})[_0x329d('0x23')](handleEntityNotFound(_0x1f035b,null))[_0x329d('0x23')](saveUpdates(_0x1f27aa['body'],null))['then'](respondWithResult(_0x1f035b,null))[_0x329d('0x3c')](handleError(_0x1f035b,null));};exports[_0x329d('0x24')]=function(_0x461551,_0x56d19e){return db[_0x329d('0x29')][_0x329d('0x43')]({'where':{'id':_0x461551['params']['id']}})['then'](handleEntityNotFound(_0x56d19e,null))[_0x329d('0x23')](removeEntity(_0x56d19e,null))[_0x329d('0x3c')](handleError(_0x56d19e,null));}; \ No newline at end of file +var _0x9aa1=['send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error','stack','name'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x9aa1,0x114));var _0x19aa=function(_0x1eab9d,_0x4f0059){_0x1eab9d=_0x1eab9d-0x0;var _0x1fbf08=_0x9aa1[_0x1eab9d];return _0x1fbf08;};'use strict';var emlformat=require(_0x19aa('0x0'));var rimraf=require(_0x19aa('0x1'));var zipdir=require(_0x19aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19aa('0x3'));var moment=require(_0x19aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x19aa('0x5'));var util=require(_0x19aa('0x6'));var path=require(_0x19aa('0x7'));var sox=require('sox');var csv=require(_0x19aa('0x8'));var ejs=require(_0x19aa('0x9'));var fs=require('fs');var fs_extra=require(_0x19aa('0xa'));var _=require(_0x19aa('0xb'));var squel=require(_0x19aa('0xc'));var crypto=require(_0x19aa('0xd'));var jsforce=require(_0x19aa('0xe'));var deskjs=require(_0x19aa('0xf'));var toCsv=require(_0x19aa('0x8'));var querystring=require('querystring');var Papa=require(_0x19aa('0x10'));var Redis=require(_0x19aa('0x11'));var authService=require(_0x19aa('0x12'));var qs=require(_0x19aa('0x13'));var as=require(_0x19aa('0x14'));var hardwareService=require(_0x19aa('0x15'));var logger=require('../../config/logger')(_0x19aa('0x16'));var utils=require(_0x19aa('0x17'));var config=require(_0x19aa('0x18'));var licenseUtil=require(_0x19aa('0x19'));var db=require(_0x19aa('0x1a'))['db'];function respondWithStatusCode(_0x6f9249,_0x5b6e92){_0x5b6e92=_0x5b6e92||0xcc;return function(_0x556513){if(_0x556513){return _0x6f9249[_0x19aa('0x1b')](_0x5b6e92);}return _0x6f9249[_0x19aa('0x1c')](_0x5b6e92)[_0x19aa('0x1d')]();};}function respondWithResult(_0x4c160f,_0x458e0c){_0x458e0c=_0x458e0c||0xc8;return function(_0xbd8fb){if(_0xbd8fb){return _0x4c160f[_0x19aa('0x1c')](_0x458e0c)['json'](_0xbd8fb);}};}function respondWithFilteredResult(_0x2eb89f,_0x280a2c){return function(_0x37a6d2){if(_0x37a6d2){var _0x4e581b=typeof _0x280a2c[_0x19aa('0x1e')]==='undefined'&&typeof _0x280a2c[_0x19aa('0x1f')]===_0x19aa('0x20');var _0x1bbac5=_0x37a6d2[_0x19aa('0x21')];var _0x8a0ef1=_0x4e581b?0x0:_0x280a2c[_0x19aa('0x1e')];var _0x488a08=_0x4e581b?_0x37a6d2[_0x19aa('0x21')]:_0x280a2c[_0x19aa('0x1e')]+_0x280a2c['limit'];var _0x252ddf;if(_0x488a08>=_0x1bbac5){_0x488a08=_0x1bbac5;_0x252ddf=0xc8;}else{_0x252ddf=0xce;}_0x2eb89f[_0x19aa('0x1c')](_0x252ddf);return _0x2eb89f[_0x19aa('0x22')](_0x19aa('0x23'),_0x8a0ef1+'-'+_0x488a08+'/'+_0x1bbac5)[_0x19aa('0x24')](_0x37a6d2);}return null;};}function patchUpdates(_0x309e78){return function(_0x53dc63){try{jsonpatch['apply'](_0x53dc63,_0x309e78,!![]);}catch(_0x126310){return BPromise[_0x19aa('0x25')](_0x126310);}return _0x53dc63[_0x19aa('0x26')]();};}function saveUpdates(_0xb33c61,_0x5c6950){return function(_0x227725){if(_0x227725){return _0x227725[_0x19aa('0x27')](_0xb33c61)[_0x19aa('0x28')](function(_0x5c0361){return _0x5c0361;});}return null;};}function removeEntity(_0x260f50,_0x672a37){return function(_0x20536c){if(_0x20536c){return _0x20536c['destroy']()['then'](function(){_0x260f50['status'](0xcc)[_0x19aa('0x1d')]();});}};}function handleEntityNotFound(_0x49bb9d,_0x34a910){return function(_0x2f885c){if(!_0x2f885c){_0x49bb9d['sendStatus'](0x194);}return _0x2f885c;};}function handleError(_0x38325e,_0x3b8a4c){_0x3b8a4c=_0x3b8a4c||0x1f4;return function(_0x1f63e8){logger[_0x19aa('0x29')](_0x1f63e8[_0x19aa('0x2a')]);if(_0x1f63e8[_0x19aa('0x2b')]){delete _0x1f63e8['name'];}_0x38325e[_0x19aa('0x1c')](_0x3b8a4c)[_0x19aa('0x2c')](_0x1f63e8);};}exports[_0x19aa('0x2d')]=function(_0x43d108,_0x5c4265){var _0x1120c1={},_0x5bade3={},_0x218787={'count':0x0,'rows':[]};var _0x223eab=_[_0x19aa('0x2e')](db[_0x19aa('0x2f')][_0x19aa('0x30')],function(_0x341db1){return{'name':_0x341db1[_0x19aa('0x31')],'type':_0x341db1[_0x19aa('0x32')][_0x19aa('0x33')]};});_0x5bade3[_0x19aa('0x34')]=_[_0x19aa('0x2e')](_0x223eab,_0x19aa('0x2b'));_0x5bade3[_0x19aa('0x35')]=_[_0x19aa('0x36')](_0x43d108[_0x19aa('0x35')]);_0x5bade3[_0x19aa('0x37')]=_[_0x19aa('0x38')](_0x5bade3['model'],_0x5bade3['query']);_0x1120c1[_0x19aa('0x39')]=_[_0x19aa('0x38')](_0x5bade3[_0x19aa('0x34')],qs['fields'](_0x43d108[_0x19aa('0x35')][_0x19aa('0x3a')]));_0x1120c1['attributes']=_0x1120c1[_0x19aa('0x39')][_0x19aa('0x3b')]?_0x1120c1[_0x19aa('0x39')]:_0x5bade3['model'];if(!_0x43d108['query'][_0x19aa('0x3c')](_0x19aa('0x3d'))){_0x1120c1[_0x19aa('0x1f')]=qs['limit'](_0x43d108[_0x19aa('0x35')][_0x19aa('0x1f')]);_0x1120c1[_0x19aa('0x1e')]=qs[_0x19aa('0x1e')](_0x43d108[_0x19aa('0x35')][_0x19aa('0x1e')]);}_0x1120c1[_0x19aa('0x3e')]=qs[_0x19aa('0x3f')](_0x43d108[_0x19aa('0x35')][_0x19aa('0x3f')]);_0x1120c1['where']=qs[_0x19aa('0x37')](_[_0x19aa('0x40')](_0x43d108['query'],_0x5bade3[_0x19aa('0x37')]),_0x223eab);if(_0x43d108['query'][_0x19aa('0x41')]){_0x1120c1[_0x19aa('0x42')]=_['merge'](_0x1120c1['where'],{'$or':_[_0x19aa('0x2e')](_0x223eab,function(_0x5b4e77){if(_0x5b4e77[_0x19aa('0x32')]!==_0x19aa('0x43')){var _0x5392db={};_0x5392db[_0x5b4e77[_0x19aa('0x2b')]]={'$like':'%'+_0x43d108[_0x19aa('0x35')][_0x19aa('0x41')]+'%'};return _0x5392db;}})});}_0x1120c1=_['merge']({},_0x1120c1,_0x43d108[_0x19aa('0x44')]);var _0x2733be={'where':_0x1120c1[_0x19aa('0x42')]};return db[_0x19aa('0x2f')][_0x19aa('0x21')](_0x2733be)[_0x19aa('0x28')](function(_0x984891){_0x218787[_0x19aa('0x21')]=_0x984891;if(_0x43d108[_0x19aa('0x35')][_0x19aa('0x45')]){_0x1120c1['include']=[{'all':!![]}];}return db[_0x19aa('0x2f')][_0x19aa('0x46')](_0x1120c1);})[_0x19aa('0x28')](function(_0x1a386c){_0x218787['rows']=_0x1a386c;return _0x218787;})[_0x19aa('0x28')](respondWithFilteredResult(_0x5c4265,_0x1120c1))[_0x19aa('0x47')](handleError(_0x5c4265,null));};exports[_0x19aa('0x48')]=function(_0x5d57ad,_0x57fcd4){var _0x4dbb05={'raw':!![],'where':{'id':_0x5d57ad[_0x19aa('0x49')]['id']}},_0x464d20={};_0x464d20['model']=_[_0x19aa('0x36')](db[_0x19aa('0x2f')]['rawAttributes']);_0x464d20[_0x19aa('0x35')]=_[_0x19aa('0x36')](_0x5d57ad['query']);_0x464d20[_0x19aa('0x37')]=_['intersection'](_0x464d20[_0x19aa('0x34')],_0x464d20[_0x19aa('0x35')]);_0x4dbb05['attributes']=_[_0x19aa('0x38')](_0x464d20[_0x19aa('0x34')],qs[_0x19aa('0x3a')](_0x5d57ad[_0x19aa('0x35')][_0x19aa('0x3a')]));_0x4dbb05[_0x19aa('0x39')]=_0x4dbb05['attributes'][_0x19aa('0x3b')]?_0x4dbb05['attributes']:_0x464d20[_0x19aa('0x34')];if(_0x5d57ad[_0x19aa('0x35')][_0x19aa('0x45')]){_0x4dbb05[_0x19aa('0x4a')]=[{'all':!![]}];}_0x4dbb05=_[_0x19aa('0x4b')]({},_0x4dbb05,_0x5d57ad[_0x19aa('0x44')]);return db['Dynamics365Field'][_0x19aa('0x4c')](_0x4dbb05)[_0x19aa('0x28')](handleEntityNotFound(_0x57fcd4,null))[_0x19aa('0x28')](respondWithResult(_0x57fcd4,null))[_0x19aa('0x47')](handleError(_0x57fcd4,null));};exports[_0x19aa('0x4d')]=function(_0xce0c99,_0x13d793){return db['Dynamics365Field'][_0x19aa('0x4d')](_0xce0c99[_0x19aa('0x4e')],{})['then'](respondWithResult(_0x13d793,0xc9))[_0x19aa('0x47')](handleError(_0x13d793,null));};exports[_0x19aa('0x27')]=function(_0x34b129,_0x4f7d6e){if(_0x34b129[_0x19aa('0x4e')]['id']){delete _0x34b129['body']['id'];}return db['Dynamics365Field'][_0x19aa('0x4c')]({'where':{'id':_0x34b129[_0x19aa('0x49')]['id']}})[_0x19aa('0x28')](handleEntityNotFound(_0x4f7d6e,null))[_0x19aa('0x28')](saveUpdates(_0x34b129['body'],null))[_0x19aa('0x28')](respondWithResult(_0x4f7d6e,null))[_0x19aa('0x47')](handleError(_0x4f7d6e,null));};exports[_0x19aa('0x4f')]=function(_0x558d96,_0x2fef66){return db[_0x19aa('0x2f')][_0x19aa('0x4c')]({'where':{'id':_0x558d96[_0x19aa('0x49')]['id']}})[_0x19aa('0x28')](handleEntityNotFound(_0x2fef66,null))[_0x19aa('0x28')](removeEntity(_0x2fef66,null))['catch'](handleError(_0x2fef66,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index dd1c5d4..a1c8784 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 _0xf645=['int_dynamics365_fields','idField','util','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x1ab9bb,_0x515e80){var _0x1ecc89=function(_0x927579){while(--_0x927579){_0x1ab9bb['push'](_0x1ab9bb['shift']());}};_0x1ecc89(++_0x515e80);}(_0xf645,0x66));var _0x5f64=function(_0x2ef789,_0x26a493){_0x2ef789=_0x2ef789-0x0;var _0xf29e80=_0xf645[_0x2ef789];return _0xf29e80;};'use strict';var _=require('lodash');var util=require(_0x5f64('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f64('0x1'));var BPromise=require(_0x5f64('0x2'));var rp=require(_0x5f64('0x3'));var fs=require('fs');var path=require(_0x5f64('0x4'));var rimraf=require('rimraf');var config=require(_0x5f64('0x5'));var attributes=require(_0x5f64('0x6'));module['exports']=function(_0x29b1b5,_0x5c6ef5){return _0x29b1b5[_0x5f64('0x7')]('Dynamics365Field',attributes,{'tableName':_0x5f64('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5f64('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0c4=['moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','util','../../config/logger','api'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa0c4,0x97));var _0x4a0c=function(_0x345af2,_0x4eee28){_0x345af2=_0x345af2-0x0;var _0x3decb0=_0xa0c4[_0x345af2];return _0x3decb0;};'use strict';var _=require('lodash');var util=require(_0x4a0c('0x0'));var logger=require(_0x4a0c('0x1'))(_0x4a0c('0x2'));var moment=require(_0x4a0c('0x3'));var BPromise=require(_0x4a0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a0c('0x5'));var rimraf=require(_0x4a0c('0x6'));var config=require(_0x4a0c('0x7'));var attributes=require(_0x4a0c('0x8'));module[_0x4a0c('0x9')]=function(_0x10edb0,_0x2ed1d6){return _0x10edb0[_0x4a0c('0xa')](_0x4a0c('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4a0c('0xc'),'fields':['idField',_0x4a0c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a70d02f..8893f95 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 _0x056c=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x481c1b,_0x29e064){var _0x485123=function(_0x7bb91b){while(--_0x7bb91b){_0x481c1b['push'](_0x481c1b['shift']());}};_0x485123(++_0x29e064);}(_0x056c,0x1cf));var _0xc056=function(_0x42bae6,_0x37979e){_0x42bae6=_0x42bae6-0x0;var _0x436662=_0x056c[_0x42bae6];return _0x436662;};'use strict';var _=require(_0xc056('0x0'));var util=require(_0xc056('0x1'));var moment=require('moment');var BPromise=require(_0xc056('0x2'));var rs=require(_0xc056('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc056('0x4'))['db'];var utils=require(_0xc056('0x5'));var logger=require('../../config/logger')(_0xc056('0x6'));var config=require(_0xc056('0x7'));var jayson=require(_0xc056('0x8'));var client=jayson[_0xc056('0x9')][_0xc056('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475098,_0xfd8484,_0x17a1a3){return new BPromise(function(_0x18846e,_0x11d628){return client[_0xc056('0xb')](_0x475098,_0x17a1a3)[_0xc056('0xc')](function(_0x34cb95){logger['info'](_0xc056('0xd'),_0xfd8484,'request\x20sent');logger[_0xc056('0xe')](_0xc056('0xf'),_0xfd8484,_0xc056('0x10'),JSON['stringify'](_0x34cb95));if(_0x34cb95[_0xc056('0x11')]){if(_0x34cb95['error'][_0xc056('0x12')]===0x1f4){logger['error'](_0xc056('0xd'),_0xfd8484,_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);return _0x11d628(_0x34cb95[_0xc056('0x11')]['message']);}logger[_0xc056('0x11')](_0xc056('0xd'),_0xfd8484,_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);return _0x18846e(_0x34cb95[_0xc056('0x11')][_0xc056('0x13')]);}else{logger[_0xc056('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0xfd8484,_0xc056('0x10'));_0x18846e(_0x34cb95[_0xc056('0x15')]['message']);}})[_0xc056('0x16')](function(_0xbd08ea){logger[_0xc056('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xfd8484,_0xbd08ea);_0x11d628(_0xbd08ea);});});} \ No newline at end of file +var _0x18e9=['debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x18e9,0xda));var _0x918e=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x18e9[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var moment=require(_0x918e('0x2'));var BPromise=require('bluebird');var rs=require(_0x918e('0x3'));var fs=require('fs');var Redis=require(_0x918e('0x4'));var db=require(_0x918e('0x5'))['db'];var utils=require(_0x918e('0x6'));var logger=require('../../config/logger')(_0x918e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x918e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x106c8c,_0x389bba,_0x305a66){return new BPromise(function(_0x563ee9,_0x582f2b){return client[_0x918e('0x9')](_0x106c8c,_0x305a66)[_0x918e('0xa')](function(_0x20d6c8){logger['info'](_0x918e('0xb'),_0x389bba,_0x918e('0xc'));logger[_0x918e('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x389bba,_0x918e('0xc'),JSON[_0x918e('0xe')](_0x20d6c8));if(_0x20d6c8[_0x918e('0xf')]){if(_0x20d6c8[_0x918e('0xf')][_0x918e('0x10')]===0x1f4){logger['error'](_0x918e('0xb'),_0x389bba,_0x20d6c8[_0x918e('0xf')][_0x918e('0x11')]);return _0x582f2b(_0x20d6c8[_0x918e('0xf')][_0x918e('0x11')]);}logger['error'](_0x918e('0xb'),_0x389bba,_0x20d6c8[_0x918e('0xf')]['message']);return _0x563ee9(_0x20d6c8['error'][_0x918e('0x11')]);}else{logger[_0x918e('0x12')](_0x918e('0xb'),_0x389bba,_0x918e('0xc'));_0x563ee9(_0x20d6c8[_0x918e('0x13')][_0x918e('0x11')]);}})[_0x918e('0x14')](function(_0x244204){logger[_0x918e('0xf')](_0x918e('0xb'),_0x389bba,_0x244204);_0x582f2b(_0x244204);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3c374e3..052c738 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 _0x62cf=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index'];(function(_0x1d3e30,_0x534a6d){var _0x3fcd34=function(_0x58aa3f){while(--_0x58aa3f){_0x1d3e30['push'](_0x1d3e30['shift']());}};_0x3fcd34(++_0x534a6d);}(_0x62cf,0x1da));var _0xf62c=function(_0x57ebb7,_0x27a907){_0x57ebb7=_0x57ebb7-0x0;var _0x19f361=_0x62cf[_0x57ebb7];return _0x19f361;};'use strict';var multer=require('multer');var util=require(_0xf62c('0x0'));var path=require('path');var timeout=require(_0xf62c('0x1'));var express=require(_0xf62c('0x2'));var router=express[_0xf62c('0x3')]();var fs_extra=require(_0xf62c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf62c('0x5'));var config=require(_0xf62c('0x6'));var controller=require(_0xf62c('0x7'));router[_0xf62c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf62c('0x9')]);router[_0xf62c('0x8')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller[_0xf62c('0xc')]);router['get'](_0xf62c('0xd'),auth[_0xf62c('0xb')](),controller[_0xf62c('0xe')]);router[_0xf62c('0x8')](_0xf62c('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xf62c('0x10')]('/',auth[_0xf62c('0xb')](),controller[_0xf62c('0x11')]);router[_0xf62c('0x10')](_0xf62c('0xd'),auth[_0xf62c('0xb')](),controller['addConfiguration']);router[_0xf62c('0x12')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller[_0xf62c('0x13')]);router[_0xf62c('0x14')](_0xf62c('0xa'),auth[_0xf62c('0xb')](),controller['destroy']);module[_0xf62c('0x15')]=router; \ No newline at end of file +var _0xe07b=['get','isAuthenticated','show','/:id/configurations','getConfigurations','post','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller'];(function(_0x456025,_0x4e29a9){var _0x234cee=function(_0x456817){while(--_0x456817){_0x456025['push'](_0x456025['shift']());}};_0x234cee(++_0x4e29a9);}(_0xe07b,0x138));var _0xbe07=function(_0x4ff180,_0x225029){_0x4ff180=_0x4ff180-0x0;var _0x26b516=_0xe07b[_0x4ff180];return _0x26b516;};'use strict';var multer=require(_0xbe07('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe07('0x1'));var express=require(_0xbe07('0x2'));var router=express[_0xbe07('0x3')]();var fs_extra=require(_0xbe07('0x4'));var auth=require(_0xbe07('0x5'));var interaction=require(_0xbe07('0x6'));var config=require('../../config/environment');var controller=require(_0xbe07('0x7'));router[_0xbe07('0x8')]('/',auth[_0xbe07('0x9')](),controller['index']);router[_0xbe07('0x8')]('/:id',auth[_0xbe07('0x9')](),controller[_0xbe07('0xa')]);router[_0xbe07('0x8')](_0xbe07('0xb'),auth['isAuthenticated'](),controller[_0xbe07('0xc')]);router[_0xbe07('0x8')]('/:id/fields',auth[_0xbe07('0x9')](),controller['getFields']);router[_0xbe07('0xd')]('/',auth[_0xbe07('0x9')](),controller[_0xbe07('0xe')]);router[_0xbe07('0xd')](_0xbe07('0xb'),auth[_0xbe07('0x9')](),controller['addConfiguration']);router['put'](_0xbe07('0xf'),auth[_0xbe07('0x9')](),controller[_0xbe07('0x10')]);router[_0xbe07('0x11')]('/:id',auth[_0xbe07('0x9')](),controller[_0xbe07('0x12')]);module[_0xbe07('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 89a0340..cc9e45e 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x141963,_0x35994c){var _0x1ab4d8=function(_0x4b9447){while(--_0x4b9447){_0x141963['push'](_0x141963['shift']());}};_0x1ab4d8(++_0x35994c);}(_0x5204,0xdf));var _0x4520=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x5204[_0x25cd2c];return _0x1e364c;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x1aa2c1,_0x42750f){var _0xb26b0a=function(_0x1b1bf0){while(--_0x1b1bf0){_0x1aa2c1['push'](_0x1aa2c1['shift']());}};_0xb26b0a(++_0x42750f);}(_0x7096,0x10c));var _0x6709=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7096[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 62faa79..8850621 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 _0x4a47=['model','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','getFields','apiKey','remoteUri','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','keys','query','filters'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x4a47,0xb5));var _0x74a4=function(_0x50e001,_0x45aa55){_0x50e001=_0x50e001-0x0;var _0x3fe4a2=_0x4a47[_0x50e001];return _0x3fe4a2;};'use strict';var emlformat=require(_0x74a4('0x0'));var rimraf=require(_0x74a4('0x1'));var zipdir=require(_0x74a4('0x2'));var jsonpatch=require(_0x74a4('0x3'));var rp=require(_0x74a4('0x4'));var moment=require('moment');var BPromise=require(_0x74a4('0x5'));var Mustache=require('mustache');var util=require(_0x74a4('0x6'));var path=require(_0x74a4('0x7'));var sox=require('sox');var csv=require(_0x74a4('0x8'));var ejs=require(_0x74a4('0x9'));var fs=require('fs');var fs_extra=require(_0x74a4('0xa'));var _=require('lodash');var squel=require(_0x74a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74a4('0x8'));var querystring=require(_0x74a4('0xd'));var Papa=require(_0x74a4('0xe'));var Redis=require(_0x74a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74a4('0x10'));var as=require(_0x74a4('0x11'));var hardwareService=require(_0x74a4('0x12'));var logger=require(_0x74a4('0x13'))('api');var utils=require(_0x74a4('0x14'));var config=require(_0x74a4('0x15'));var licenseUtil=require(_0x74a4('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43ffb8,_0x20eb02){_0x20eb02=_0x20eb02||0xcc;return function(_0x46d788){if(_0x46d788){return _0x43ffb8[_0x74a4('0x17')](_0x20eb02);}return _0x43ffb8[_0x74a4('0x18')](_0x20eb02)[_0x74a4('0x19')]();};}function respondWithResult(_0x391be4,_0x1d6f41){_0x1d6f41=_0x1d6f41||0xc8;return function(_0x39e2b4){if(_0x39e2b4){return _0x391be4[_0x74a4('0x18')](_0x1d6f41)[_0x74a4('0x1a')](_0x39e2b4);}};}function respondWithFilteredResult(_0x28c364,_0xc6796e){return function(_0x3c9fc9){if(_0x3c9fc9){var _0x3d9b8c=typeof _0xc6796e[_0x74a4('0x1b')]==='undefined'&&typeof _0xc6796e[_0x74a4('0x1c')]===_0x74a4('0x1d');var _0x327562=_0x3c9fc9[_0x74a4('0x1e')];var _0x55cf53=_0x3d9b8c?0x0:_0xc6796e[_0x74a4('0x1b')];var _0x105998=_0x3d9b8c?_0x3c9fc9[_0x74a4('0x1e')]:_0xc6796e[_0x74a4('0x1b')]+_0xc6796e['limit'];var _0x1eb6fb;if(_0x105998>=_0x327562){_0x105998=_0x327562;_0x1eb6fb=0xc8;}else{_0x1eb6fb=0xce;}_0x28c364[_0x74a4('0x18')](_0x1eb6fb);return _0x28c364['set'](_0x74a4('0x1f'),_0x55cf53+'-'+_0x105998+'/'+_0x327562)[_0x74a4('0x1a')](_0x3c9fc9);}return null;};}function patchUpdates(_0x5438d2){return function(_0x5d08d9){try{jsonpatch[_0x74a4('0x20')](_0x5d08d9,_0x5438d2,!![]);}catch(_0x3d6464){return BPromise[_0x74a4('0x21')](_0x3d6464);}return _0x5d08d9[_0x74a4('0x22')]();};}function saveUpdates(_0x484802,_0x4139af){return function(_0x506bac){if(_0x506bac){return _0x506bac['update'](_0x484802)[_0x74a4('0x23')](function(_0x404128){return _0x404128;});}return null;};}function removeEntity(_0x2eabd8,_0x5c3362){return function(_0x22f0fa){if(_0x22f0fa){return _0x22f0fa[_0x74a4('0x24')]()['then'](function(){_0x2eabd8[_0x74a4('0x18')](0xcc)[_0x74a4('0x19')]();});}};}function handleEntityNotFound(_0x4f4fc0,_0x12895a){return function(_0x3d9270){if(!_0x3d9270){_0x4f4fc0[_0x74a4('0x17')](0x194);}return _0x3d9270;};}function handleError(_0x54f5ed,_0x408140){_0x408140=_0x408140||0x1f4;return function(_0x23a74c){logger[_0x74a4('0x25')](_0x23a74c[_0x74a4('0x26')]);if(_0x23a74c[_0x74a4('0x27')]){delete _0x23a74c[_0x74a4('0x27')];}_0x54f5ed['status'](_0x408140)['send'](_0x23a74c);};}exports[_0x74a4('0x28')]=function(_0x4fe101,_0x1d252f){var _0x4a4a3d={},_0x446340={},_0x55f21e={'count':0x0,'rows':[]};var _0x5a1dad=_[_0x74a4('0x29')](db[_0x74a4('0x2a')][_0x74a4('0x2b')],function(_0x4b833d){return{'name':_0x4b833d['fieldName'],'type':_0x4b833d['type']['key']};});_0x446340['model']=_['map'](_0x5a1dad,_0x74a4('0x27'));_0x446340['query']=_[_0x74a4('0x2c')](_0x4fe101[_0x74a4('0x2d')]);_0x446340[_0x74a4('0x2e')]=_['intersection'](_0x446340[_0x74a4('0x2f')],_0x446340[_0x74a4('0x2d')]);_0x4a4a3d[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x446340[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x4a4a3d['attributes']=_0x4a4a3d[_0x74a4('0x30')][_0x74a4('0x33')]?_0x4a4a3d['attributes']:_0x446340[_0x74a4('0x2f')];if(!_0x4fe101['query']['hasOwnProperty'](_0x74a4('0x34'))){_0x4a4a3d[_0x74a4('0x1c')]=qs[_0x74a4('0x1c')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1c')]);_0x4a4a3d[_0x74a4('0x1b')]=qs[_0x74a4('0x1b')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x1b')]);}_0x4a4a3d['order']=qs[_0x74a4('0x35')](_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x35')]);_0x4a4a3d[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_['pick'](_0x4fe101[_0x74a4('0x2d')],_0x446340[_0x74a4('0x2e')]),_0x5a1dad);if(_0x4fe101['query'][_0x74a4('0x37')]){_0x4a4a3d[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x4a4a3d[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x5a1dad,function(_0x19c228){if(_0x19c228['type']!==_0x74a4('0x39')){var _0x2a0d4c={};_0x2a0d4c[_0x19c228['name']]={'$like':'%'+_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x37')]+'%'};return _0x2a0d4c;}})});}_0x4a4a3d=_[_0x74a4('0x38')]({},_0x4a4a3d,_0x4fe101[_0x74a4('0x3a')]);var _0x3088e9={'where':_0x4a4a3d['where']};return db[_0x74a4('0x2a')][_0x74a4('0x1e')](_0x3088e9)['then'](function(_0x200a70){_0x55f21e[_0x74a4('0x1e')]=_0x200a70;if(_0x4fe101[_0x74a4('0x2d')][_0x74a4('0x3b')]){_0x4a4a3d['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x74a4('0x3c')](_0x4a4a3d);})['then'](function(_0x4bfa7a){_0x55f21e[_0x74a4('0x3d')]=_0x4bfa7a;return _0x55f21e;})[_0x74a4('0x23')](respondWithFilteredResult(_0x1d252f,_0x4a4a3d))[_0x74a4('0x3e')](handleError(_0x1d252f,null));};exports['show']=function(_0x399c84,_0xf23a8a){var _0x53207c={'raw':![],'where':{'id':_0x399c84[_0x74a4('0x3f')]['id']}},_0x2df134={};_0x2df134[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db['FreshdeskAccount'][_0x74a4('0x2b')]);_0x2df134[_0x74a4('0x2d')]=_['keys'](_0x399c84[_0x74a4('0x2d')]);_0x2df134[_0x74a4('0x2e')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],_0x2df134[_0x74a4('0x2d')]);_0x53207c[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x2df134[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x399c84[_0x74a4('0x2d')][_0x74a4('0x32')]));_0x53207c['attributes']=_0x53207c[_0x74a4('0x30')]['length']?_0x53207c[_0x74a4('0x30')]:_0x2df134[_0x74a4('0x2f')];if(_0x399c84[_0x74a4('0x2d')]['includeAll']){_0x53207c[_0x74a4('0x40')]=[{'all':!![]}];}_0x53207c=_[_0x74a4('0x38')]({},_0x53207c,_0x399c84['options']);return db[_0x74a4('0x2a')][_0x74a4('0x41')](_0x53207c)[_0x74a4('0x23')](handleEntityNotFound(_0xf23a8a,null))[_0x74a4('0x23')](respondWithResult(_0xf23a8a,null))[_0x74a4('0x3e')](handleError(_0xf23a8a,null));};exports['create']=function(_0x49d4d0,_0x4fa783){return db[_0x74a4('0x2a')][_0x74a4('0x42')](_0x49d4d0[_0x74a4('0x43')],{})['then'](respondWithResult(_0x4fa783,0xc9))[_0x74a4('0x3e')](handleError(_0x4fa783,null));};exports[_0x74a4('0x44')]=function(_0x1c0ebf,_0x13697b){if(_0x1c0ebf['body']['id']){delete _0x1c0ebf[_0x74a4('0x43')]['id'];}return db[_0x74a4('0x2a')]['find']({'where':{'id':_0x1c0ebf['params']['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x13697b,null))[_0x74a4('0x23')](saveUpdates(_0x1c0ebf['body'],null))[_0x74a4('0x23')](respondWithResult(_0x13697b,null))[_0x74a4('0x3e')](handleError(_0x13697b,null));};exports['destroy']=function(_0x3fbead,_0x3c8df2){return db[_0x74a4('0x2a')][_0x74a4('0x41')]({'where':{'id':_0x3fbead[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x3c8df2,null))[_0x74a4('0x23')](removeEntity(_0x3c8df2,null))[_0x74a4('0x3e')](handleError(_0x3c8df2,null));};exports[_0x74a4('0x45')]=function(_0x21be32,_0x1a86d3,_0x86d342){var _0x9007b7={};var _0x29891c={};var _0x5d3ead;var _0xf2bbca;return db['FreshdeskAccount'][_0x74a4('0x46')]({'where':{'id':_0x21be32[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x1a86d3,null))[_0x74a4('0x23')](function(_0x7e745e){if(_0x7e745e){_0x5d3ead=_0x7e745e;_0x29891c[_0x74a4('0x2f')]=_[_0x74a4('0x2c')](db[_0x74a4('0x47')]['rawAttributes']);_0x29891c[_0x74a4('0x2d')]=_[_0x74a4('0x2c')](_0x21be32['query']);_0x29891c[_0x74a4('0x2e')]=_['intersection'](_0x29891c[_0x74a4('0x2f')],_0x29891c[_0x74a4('0x2d')]);_0x9007b7[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x29891c[_0x74a4('0x2f')],qs[_0x74a4('0x32')](_0x21be32[_0x74a4('0x2d')]['fields']));_0x9007b7[_0x74a4('0x30')]=_0x9007b7[_0x74a4('0x30')][_0x74a4('0x33')]?_0x9007b7[_0x74a4('0x30')]:_0x29891c[_0x74a4('0x2f')];_0x9007b7['order']=qs['sort'](_0x21be32['query']['sort']);_0x9007b7[_0x74a4('0x36')]=qs[_0x74a4('0x2e')](_[_0x74a4('0x48')](_0x21be32[_0x74a4('0x2d')],_0x29891c[_0x74a4('0x2e')]));if(_0x21be32[_0x74a4('0x2d')][_0x74a4('0x37')]){_0x9007b7[_0x74a4('0x36')]=_[_0x74a4('0x38')](_0x9007b7[_0x74a4('0x36')],{'$or':_[_0x74a4('0x29')](_0x9007b7[_0x74a4('0x30')],function(_0x24e1c2){var _0xc27550={};_0xc27550[_0x24e1c2]={'$like':'%'+_0x21be32['query'][_0x74a4('0x37')]+'%'};return _0xc27550;})});}_0x9007b7=_[_0x74a4('0x38')]({},_0x9007b7,_0x21be32['options']);return _0x5d3ead['getConfigurations'](_0x9007b7);}})[_0x74a4('0x23')](function(_0x5afcce){if(_0x5afcce){_0xf2bbca=_0x5afcce[_0x74a4('0x33')];if(!_0x21be32[_0x74a4('0x2d')][_0x74a4('0x49')](_0x74a4('0x34'))){_0x9007b7[_0x74a4('0x1c')]=qs['limit'](_0x21be32['query'][_0x74a4('0x1c')]);_0x9007b7['offset']=qs[_0x74a4('0x1b')](_0x21be32['query'][_0x74a4('0x1b')]);}return _0x5d3ead[_0x74a4('0x45')](_0x9007b7);}})[_0x74a4('0x23')](function(_0x157fbb){if(_0x157fbb){return _0x157fbb?{'count':_0xf2bbca,'rows':_0x157fbb}:null;}})[_0x74a4('0x23')](respondWithResult(_0x1a86d3,null))[_0x74a4('0x3e')](handleError(_0x1a86d3,null));};exports[_0x74a4('0x4a')]=function(_0x443d10,_0x54b89b,_0x562462){if(_0x443d10['body']['id']){delete _0x443d10['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x443d10[_0x74a4('0x3f')]['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x54b89b,null))[_0x74a4('0x23')](function(_0x4972dd){if(_0x4972dd){_0x443d10[_0x74a4('0x43')][_0x74a4('0x4b')]=_0x4972dd['id'];_0x443d10[_0x74a4('0x43')][_0x74a4('0x4c')]=integrations[_0x74a4('0x4d')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10['body'][_0x74a4('0x4f')]);_0x443d10[_0x74a4('0x43')][_0x74a4('0x50')]=integrations[_0x74a4('0x51')](_0x443d10[_0x74a4('0x43')][_0x74a4('0x4e')],_0x443d10[_0x74a4('0x43')]['type']);return db[_0x74a4('0x47')][_0x74a4('0x42')](_0x443d10[_0x74a4('0x43')],{'include':[{'model':db['FreshdeskField'],'as':_0x74a4('0x4c')},{'model':db['FreshdeskField'],'as':_0x74a4('0x50')}]});}return null;})[_0x74a4('0x23')](respondWithResult(_0x54b89b,null))[_0x74a4('0x3e')](handleError(_0x54b89b,null));};exports[_0x74a4('0x52')]=function(_0x42b265,_0x24d2ef,_0x5b3235){var _0x56858b='';return db[_0x74a4('0x2a')][_0x74a4('0x46')]({'where':{'id':_0x42b265[_0x74a4('0x3f')]['id']},'attributes':['id','remoteUri',_0x74a4('0x53')]})[_0x74a4('0x23')](handleEntityNotFound(_0x24d2ef,null))['then'](function(_0x89c771){if(_0x89c771){_0x56858b=_0x89c771[_0x74a4('0x54')];var _0x328f1b=_0x56858b[_0x74a4('0x55')](-0x1);if(_0x328f1b==='/'){_0x56858b=_0x56858b['substring'](0x0,_0x56858b[_0x74a4('0x56')](_0x328f1b));}return rp({'method':_0x74a4('0x57'),'uri':util[_0x74a4('0x58')]('%s/%s',_0x56858b,_0x74a4('0x59')),'headers':{'Authorization':util[_0x74a4('0x58')](_0x74a4('0x5a'),new Buffer(util['format'](_0x74a4('0x5b'),_0x89c771[_0x74a4('0x53')]))[_0x74a4('0x5c')](_0x74a4('0x5d')))},'json':!![]});}})[_0x74a4('0x23')](function(_0x3b2710){if(_0x3b2710){var _0x337cf2=[_0x74a4('0x5e'),_0x74a4('0x5f'),_0x74a4('0x60'),_0x74a4('0x61'),_0x74a4('0x18'),_0x74a4('0x62'),_0x74a4('0x63'),_0x74a4('0x64'),_0x74a4('0x65'),'group','company'];_[_0x74a4('0x66')](_0x3b2710,function(_0xaccd33){return _0x337cf2[_0x74a4('0x67')](_0xaccd33[_0x74a4('0x27')])||!_0xaccd33[_0x74a4('0x68')]&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x69')&&_0xaccd33[_0x74a4('0x4f')]!==_0x74a4('0x6a');});return{'count':_0x3b2710[_0x74a4('0x33')],'rows':_['map'](_0x3b2710,function(_0x284105){return{'id':_0x284105['name'],'name':_0x284105[_0x74a4('0x6b')],'custom':!_0x284105['default'],'options':_0x284105[_0x74a4('0x6c')]?_[_0x74a4('0x29')](_0x284105[_0x74a4('0x6c')],function(_0x4ba23e){return{'name':_[_0x74a4('0x6d')](_0x4ba23e),'value':_0x4ba23e};}):[]};})};}})['then'](respondWithResult(_0x24d2ef,null))['catch'](function(_0x1669d9){var _0x5c97a1=_0x42b265[_0x74a4('0x2d')]['test']?0x1f4:_0x1669d9[_0x74a4('0x6e')]||0x1f4;logger[_0x74a4('0x25')](_0x74a4('0x6f'),_0x74a4('0x52'),_0x5c97a1,JSON[_0x74a4('0x70')](_0x1669d9));delete _0x1669d9[_0x74a4('0x27')];if(_0x5c97a1===0x191){_0x5c97a1=0x190;}_0x24d2ef['status'](_0x5c97a1)['send'](_0x42b265[_0x74a4('0x2d')][_0x74a4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1669d9[_0x74a4('0x6e')]}:_0x1669d9);});}; \ No newline at end of file +var _0x30fe=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','json','save','update','then','sendStatus','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird'];(function(_0x319a77,_0x46a78c){var _0x24b627=function(_0x5c1ba8){while(--_0x5c1ba8){_0x319a77['push'](_0x319a77['shift']());}};_0x24b627(++_0x46a78c);}(_0x30fe,0x149));var _0xe30f=function(_0x2454a8,_0x3b008b){_0x2454a8=_0x2454a8-0x0;var _0x83d00b=_0x30fe[_0x2454a8];return _0x83d00b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30f('0x1'));var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require('papaparse');var Redis=require(_0xe30f('0x10'));var authService=require(_0xe30f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe30f('0x12'));var hardwareService=require(_0xe30f('0x13'));var logger=require(_0xe30f('0x14'))(_0xe30f('0x15'));var utils=require('../../config/utils');var config=require(_0xe30f('0x16'));var licenseUtil=require(_0xe30f('0x17'));var db=require(_0xe30f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3859df,_0x19970e){_0x19970e=_0x19970e||0xcc;return function(_0x14863b){if(_0x14863b){return _0x3859df['sendStatus'](_0x19970e);}return _0x3859df[_0xe30f('0x19')](_0x19970e)[_0xe30f('0x1a')]();};}function respondWithResult(_0x122e2a,_0x7d684c){_0x7d684c=_0x7d684c||0xc8;return function(_0x53c3d2){if(_0x53c3d2){return _0x122e2a['status'](_0x7d684c)['json'](_0x53c3d2);}};}function respondWithFilteredResult(_0x3c9680,_0x494ad3){return function(_0x2b6a9b){if(_0x2b6a9b){var _0x1efa22=typeof _0x494ad3['offset']===_0xe30f('0x1b')&&typeof _0x494ad3['limit']===_0xe30f('0x1b');var _0x18518b=_0x2b6a9b[_0xe30f('0x1c')];var _0x20c2a5=_0x1efa22?0x0:_0x494ad3[_0xe30f('0x1d')];var _0x5ae935=_0x1efa22?_0x2b6a9b['count']:_0x494ad3[_0xe30f('0x1d')]+_0x494ad3['limit'];var _0x391ae6;if(_0x5ae935>=_0x18518b){_0x5ae935=_0x18518b;_0x391ae6=0xc8;}else{_0x391ae6=0xce;}_0x3c9680['status'](_0x391ae6);return _0x3c9680[_0xe30f('0x1e')](_0xe30f('0x1f'),_0x20c2a5+'-'+_0x5ae935+'/'+_0x18518b)[_0xe30f('0x20')](_0x2b6a9b);}return null;};}function patchUpdates(_0x2a0432){return function(_0x1f4533){try{jsonpatch['apply'](_0x1f4533,_0x2a0432,!![]);}catch(_0x59dfbd){return BPromise['reject'](_0x59dfbd);}return _0x1f4533[_0xe30f('0x21')]();};}function saveUpdates(_0x5af7b5,_0x322ee0){return function(_0x67af81){if(_0x67af81){return _0x67af81[_0xe30f('0x22')](_0x5af7b5)[_0xe30f('0x23')](function(_0x7f7b1f){return _0x7f7b1f;});}return null;};}function removeEntity(_0x378d6f,_0x50bca4){return function(_0x2f0eef){if(_0x2f0eef){return _0x2f0eef['destroy']()[_0xe30f('0x23')](function(){_0x378d6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc220,_0x11a539){return function(_0x5c5bd4){if(!_0x5c5bd4){_0x4fc220[_0xe30f('0x24')](0x194);}return _0x5c5bd4;};}function handleError(_0x25e3cf,_0x37c716){_0x37c716=_0x37c716||0x1f4;return function(_0x15ad85){logger[_0xe30f('0x25')](_0x15ad85[_0xe30f('0x26')]);if(_0x15ad85['name']){delete _0x15ad85[_0xe30f('0x27')];}_0x25e3cf[_0xe30f('0x19')](_0x37c716)['send'](_0x15ad85);};}exports[_0xe30f('0x28')]=function(_0x2d67d4,_0x5a6cc3){var _0x500626={},_0x5ae256={},_0x44080a={'count':0x0,'rows':[]};var _0xccbdc7=_[_0xe30f('0x29')](db[_0xe30f('0x2a')][_0xe30f('0x2b')],function(_0x36f1b8){return{'name':_0x36f1b8['fieldName'],'type':_0x36f1b8[_0xe30f('0x2c')]['key']};});_0x5ae256[_0xe30f('0x2d')]=_[_0xe30f('0x29')](_0xccbdc7,_0xe30f('0x27'));_0x5ae256[_0xe30f('0x2e')]=_['keys'](_0x2d67d4[_0xe30f('0x2e')]);_0x5ae256[_0xe30f('0x2f')]=_[_0xe30f('0x30')](_0x5ae256['model'],_0x5ae256[_0xe30f('0x2e')]);_0x500626['attributes']=_[_0xe30f('0x30')](_0x5ae256[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x2d67d4[_0xe30f('0x2e')]['fields']));_0x500626[_0xe30f('0x32')]=_0x500626[_0xe30f('0x32')][_0xe30f('0x33')]?_0x500626[_0xe30f('0x32')]:_0x5ae256[_0xe30f('0x2d')];if(!_0x2d67d4[_0xe30f('0x2e')][_0xe30f('0x34')]('nolimit')){_0x500626[_0xe30f('0x35')]=qs[_0xe30f('0x35')](_0x2d67d4[_0xe30f('0x2e')]['limit']);_0x500626[_0xe30f('0x1d')]=qs[_0xe30f('0x1d')](_0x2d67d4['query'][_0xe30f('0x1d')]);}_0x500626['order']=qs[_0xe30f('0x36')](_0x2d67d4['query']['sort']);_0x500626['where']=qs[_0xe30f('0x2f')](_[_0xe30f('0x37')](_0x2d67d4['query'],_0x5ae256[_0xe30f('0x2f')]),_0xccbdc7);if(_0x2d67d4['query'][_0xe30f('0x38')]){_0x500626[_0xe30f('0x39')]=_[_0xe30f('0x3a')](_0x500626[_0xe30f('0x39')],{'$or':_['map'](_0xccbdc7,function(_0x4ae102){if(_0x4ae102[_0xe30f('0x2c')]!==_0xe30f('0x3b')){var _0x433ad6={};_0x433ad6[_0x4ae102[_0xe30f('0x27')]]={'$like':'%'+_0x2d67d4['query'][_0xe30f('0x38')]+'%'};return _0x433ad6;}})});}_0x500626=_['merge']({},_0x500626,_0x2d67d4[_0xe30f('0x3c')]);var _0x23f766={'where':_0x500626[_0xe30f('0x39')]};return db[_0xe30f('0x2a')]['count'](_0x23f766)['then'](function(_0x22fe6e){_0x44080a['count']=_0x22fe6e;if(_0x2d67d4[_0xe30f('0x2e')][_0xe30f('0x3d')]){_0x500626[_0xe30f('0x3e')]=[{'all':!![]}];}return db[_0xe30f('0x2a')]['findAll'](_0x500626);})[_0xe30f('0x23')](function(_0x2036cf){_0x44080a[_0xe30f('0x3f')]=_0x2036cf;return _0x44080a;})[_0xe30f('0x23')](respondWithFilteredResult(_0x5a6cc3,_0x500626))[_0xe30f('0x40')](handleError(_0x5a6cc3,null));};exports[_0xe30f('0x41')]=function(_0x400966,_0x2820f9){var _0x4a2c57={'raw':![],'where':{'id':_0x400966[_0xe30f('0x42')]['id']}},_0x32f0b4={};_0x32f0b4[_0xe30f('0x2d')]=_[_0xe30f('0x43')](db['FreshdeskAccount']['rawAttributes']);_0x32f0b4[_0xe30f('0x2e')]=_['keys'](_0x400966[_0xe30f('0x2e')]);_0x32f0b4['filters']=_[_0xe30f('0x30')](_0x32f0b4[_0xe30f('0x2d')],_0x32f0b4[_0xe30f('0x2e')]);_0x4a2c57[_0xe30f('0x32')]=_[_0xe30f('0x30')](_0x32f0b4[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x400966['query'][_0xe30f('0x31')]));_0x4a2c57[_0xe30f('0x32')]=_0x4a2c57[_0xe30f('0x32')]['length']?_0x4a2c57[_0xe30f('0x32')]:_0x32f0b4[_0xe30f('0x2d')];if(_0x400966[_0xe30f('0x2e')][_0xe30f('0x3d')]){_0x4a2c57['include']=[{'all':!![]}];}_0x4a2c57=_[_0xe30f('0x3a')]({},_0x4a2c57,_0x400966[_0xe30f('0x3c')]);return db[_0xe30f('0x2a')][_0xe30f('0x44')](_0x4a2c57)[_0xe30f('0x23')](handleEntityNotFound(_0x2820f9,null))[_0xe30f('0x23')](respondWithResult(_0x2820f9,null))['catch'](handleError(_0x2820f9,null));};exports[_0xe30f('0x45')]=function(_0x381980,_0x140a7b){return db[_0xe30f('0x2a')]['create'](_0x381980[_0xe30f('0x46')],{})['then'](respondWithResult(_0x140a7b,0xc9))[_0xe30f('0x40')](handleError(_0x140a7b,null));};exports[_0xe30f('0x22')]=function(_0x4e8afa,_0x4180c1){if(_0x4e8afa[_0xe30f('0x46')]['id']){delete _0x4e8afa[_0xe30f('0x46')]['id'];}return db['FreshdeskAccount'][_0xe30f('0x44')]({'where':{'id':_0x4e8afa[_0xe30f('0x42')]['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0x4180c1,null))[_0xe30f('0x23')](saveUpdates(_0x4e8afa[_0xe30f('0x46')],null))['then'](respondWithResult(_0x4180c1,null))['catch'](handleError(_0x4180c1,null));};exports['destroy']=function(_0x35a79e,_0x20fb4c){return db[_0xe30f('0x2a')][_0xe30f('0x44')]({'where':{'id':_0x35a79e[_0xe30f('0x42')]['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0x20fb4c,null))[_0xe30f('0x23')](removeEntity(_0x20fb4c,null))[_0xe30f('0x40')](handleError(_0x20fb4c,null));};exports[_0xe30f('0x47')]=function(_0x597d05,_0xab6318,_0x3bc3a5){var _0x424e0b={};var _0x272c87={};var _0x45449b;var _0x2c720d;return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x597d05['params']['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0xab6318,null))[_0xe30f('0x23')](function(_0x5602f9){if(_0x5602f9){_0x45449b=_0x5602f9;_0x272c87[_0xe30f('0x2d')]=_['keys'](db[_0xe30f('0x49')]['rawAttributes']);_0x272c87[_0xe30f('0x2e')]=_[_0xe30f('0x43')](_0x597d05[_0xe30f('0x2e')]);_0x272c87['filters']=_[_0xe30f('0x30')](_0x272c87['model'],_0x272c87[_0xe30f('0x2e')]);_0x424e0b[_0xe30f('0x32')]=_[_0xe30f('0x30')](_0x272c87[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x597d05['query'][_0xe30f('0x31')]));_0x424e0b[_0xe30f('0x32')]=_0x424e0b[_0xe30f('0x32')]['length']?_0x424e0b[_0xe30f('0x32')]:_0x272c87[_0xe30f('0x2d')];_0x424e0b['order']=qs[_0xe30f('0x36')](_0x597d05[_0xe30f('0x2e')]['sort']);_0x424e0b[_0xe30f('0x39')]=qs[_0xe30f('0x2f')](_[_0xe30f('0x37')](_0x597d05['query'],_0x272c87['filters']));if(_0x597d05[_0xe30f('0x2e')][_0xe30f('0x38')]){_0x424e0b['where']=_['merge'](_0x424e0b['where'],{'$or':_['map'](_0x424e0b[_0xe30f('0x32')],function(_0x3bebcd){var _0x2073e4={};_0x2073e4[_0x3bebcd]={'$like':'%'+_0x597d05[_0xe30f('0x2e')][_0xe30f('0x38')]+'%'};return _0x2073e4;})});}_0x424e0b=_[_0xe30f('0x3a')]({},_0x424e0b,_0x597d05[_0xe30f('0x3c')]);return _0x45449b[_0xe30f('0x47')](_0x424e0b);}})[_0xe30f('0x23')](function(_0x31eaa8){if(_0x31eaa8){_0x2c720d=_0x31eaa8[_0xe30f('0x33')];if(!_0x597d05[_0xe30f('0x2e')][_0xe30f('0x34')](_0xe30f('0x4a'))){_0x424e0b[_0xe30f('0x35')]=qs[_0xe30f('0x35')](_0x597d05['query'][_0xe30f('0x35')]);_0x424e0b[_0xe30f('0x1d')]=qs[_0xe30f('0x1d')](_0x597d05[_0xe30f('0x2e')]['offset']);}return _0x45449b['getConfigurations'](_0x424e0b);}})[_0xe30f('0x23')](function(_0x5b770b){if(_0x5b770b){return _0x5b770b?{'count':_0x2c720d,'rows':_0x5b770b}:null;}})[_0xe30f('0x23')](respondWithResult(_0xab6318,null))[_0xe30f('0x40')](handleError(_0xab6318,null));};exports[_0xe30f('0x4b')]=function(_0x2a1bac,_0xaf871b,_0x5c94a8){if(_0x2a1bac[_0xe30f('0x46')]['id']){delete _0x2a1bac['body']['id'];}return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x2a1bac['params']['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0xaf871b,null))[_0xe30f('0x23')](function(_0x1ca440){if(_0x1ca440){_0x2a1bac['body'][_0xe30f('0x4c')]=_0x1ca440['id'];_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4d')]=integrations['getSubjects'](_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4e')],_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x2c')]);_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4f')]=integrations['getDescriptions'](_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4e')],_0x2a1bac['body'][_0xe30f('0x2c')]);return db['FreshdeskConfiguration']['create'](_0x2a1bac['body'],{'include':[{'model':db[_0xe30f('0x50')],'as':_0xe30f('0x4d')},{'model':db[_0xe30f('0x50')],'as':_0xe30f('0x4f')}]});}return null;})[_0xe30f('0x23')](respondWithResult(_0xaf871b,null))[_0xe30f('0x40')](handleError(_0xaf871b,null));};exports[_0xe30f('0x51')]=function(_0x48a5a1,_0x25ed9e,_0x213ff4){var _0x50e693='';return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x48a5a1['params']['id']},'attributes':['id',_0xe30f('0x52'),'apiKey']})[_0xe30f('0x23')](handleEntityNotFound(_0x25ed9e,null))[_0xe30f('0x23')](function(_0x2bb384){if(_0x2bb384){_0x50e693=_0x2bb384[_0xe30f('0x52')];var _0x4fc345=_0x50e693[_0xe30f('0x53')](-0x1);if(_0x4fc345==='/'){_0x50e693=_0x50e693['substring'](0x0,_0x50e693[_0xe30f('0x54')](_0x4fc345));}return rp({'method':_0xe30f('0x55'),'uri':util[_0xe30f('0x56')](_0xe30f('0x57'),_0x50e693,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe30f('0x56')]('Basic\x20%s',new Buffer(util[_0xe30f('0x56')]('%s:X',_0x2bb384[_0xe30f('0x58')]))[_0xe30f('0x59')](_0xe30f('0x5a')))},'json':!![]});}})[_0xe30f('0x23')](function(_0x503f03){if(_0x503f03){var _0x655e33=[_0xe30f('0x5b'),_0xe30f('0x5c'),_0xe30f('0x5d'),_0xe30f('0x5e'),'status',_0xe30f('0x5f'),_0xe30f('0x60'),'source',_0xe30f('0x61'),_0xe30f('0x60'),_0xe30f('0x62')];_[_0xe30f('0x63')](_0x503f03,function(_0xf6e16c){return _0x655e33[_0xe30f('0x64')](_0xf6e16c[_0xe30f('0x27')])||!_0xf6e16c[_0xe30f('0x65')]&&_0xf6e16c[_0xe30f('0x2c')]!==_0xe30f('0x66')&&_0xf6e16c[_0xe30f('0x2c')]!==_0xe30f('0x67');});return{'count':_0x503f03[_0xe30f('0x33')],'rows':_[_0xe30f('0x29')](_0x503f03,function(_0x4f4fc7){return{'id':_0x4f4fc7[_0xe30f('0x27')],'name':_0x4f4fc7[_0xe30f('0x68')],'custom':!_0x4f4fc7[_0xe30f('0x65')],'options':_0x4f4fc7[_0xe30f('0x69')]?_[_0xe30f('0x29')](_0x4f4fc7[_0xe30f('0x69')],function(_0x5001b7){return{'name':_['capitalize'](_0x5001b7),'value':_0x5001b7};}):[]};})};}})[_0xe30f('0x23')](respondWithResult(_0x25ed9e,null))[_0xe30f('0x40')](function(_0x3f8ef3){var _0x1b02a2=_0x48a5a1[_0xe30f('0x2e')][_0xe30f('0x6a')]?0x1f4:_0x3f8ef3[_0xe30f('0x6b')]||0x1f4;logger['error'](_0xe30f('0x6c'),_0xe30f('0x51'),_0x1b02a2,JSON['stringify'](_0x3f8ef3));delete _0x3f8ef3[_0xe30f('0x27')];if(_0x1b02a2===0x191){_0x1b02a2=0x190;}_0x25ed9e[_0xe30f('0x19')](_0x1b02a2)[_0xe30f('0x6d')](_0x48a5a1[_0xe30f('0x2e')][_0xe30f('0x6a')]?{'message':_0xe30f('0x6e'),'statusCode':_0x3f8ef3[_0xe30f('0x6b')]}:_0x3f8ef3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 85621d5..bbac9c1 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 _0xf5f8=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf5f8,0x1b5));var _0x8f5f=function(_0x49b7ea,_0x403e3b){_0x49b7ea=_0x49b7ea-0x0;var _0x1c1147=_0xf5f8[_0x49b7ea];return _0x1c1147;};'use strict';var _=require(_0x8f5f('0x0'));var util=require(_0x8f5f('0x1'));var logger=require(_0x8f5f('0x2'))(_0x8f5f('0x3'));var moment=require(_0x8f5f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f5f('0x5'));var rimraf=require(_0x8f5f('0x6'));var config=require(_0x8f5f('0x7'));var attributes=require(_0x8f5f('0x8'));var integrations=require(_0x8f5f('0x9'));module[_0x8f5f('0xa')]=function(_0x1a2e6b,_0x494f8a){return _0x1a2e6b[_0x8f5f('0xb')](_0x8f5f('0xc'),attributes,{'tableName':_0x8f5f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fe=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x04fe,0xed));var _0xe04f=function(_0x5afeac,_0x18d1d4){_0x5afeac=_0x5afeac-0x0;var _0x5d7feb=_0x04fe[_0x5afeac];return _0x5d7feb;};'use strict';var _=require(_0xe04f('0x0'));var util=require(_0xe04f('0x1'));var logger=require(_0xe04f('0x2'))(_0xe04f('0x3'));var moment=require(_0xe04f('0x4'));var BPromise=require(_0xe04f('0x5'));var rp=require(_0xe04f('0x6'));var fs=require('fs');var path=require(_0xe04f('0x7'));var rimraf=require('rimraf');var config=require(_0xe04f('0x8'));var attributes=require(_0xe04f('0x9'));var integrations=require(_0xe04f('0xa'));module[_0xe04f('0xb')]=function(_0xb0a5cf,_0x529210){return _0xb0a5cf[_0xe04f('0xc')](_0xe04f('0xd'),attributes,{'tableName':_0xe04f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5dad882..9aa547b 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 _0xf412=['error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','model','attributes','ShowFreshdeskAccount','find','raw','map','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xf412,0x121));var _0x2f41=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xf412[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x2f41('0x0'));var util=require(_0x2f41('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f41('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f41('0x3'));var logger=require(_0x2f41('0x4'))(_0x2f41('0x5'));var config=require(_0x2f41('0x6'));var jayson=require(_0x2f41('0x7'));var client=jayson['client'][_0x2f41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56d57a,_0x22007d,_0x3c315e){return new BPromise(function(_0x4b85b7,_0x3bbafc){return client[_0x2f41('0x9')](_0x56d57a,_0x3c315e)[_0x2f41('0xa')](function(_0x324e87){logger[_0x2f41('0xb')](_0x2f41('0xc'),_0x22007d,_0x2f41('0xd'));logger[_0x2f41('0xe')](_0x2f41('0xf'),_0x22007d,_0x2f41('0xd'),JSON[_0x2f41('0x10')](_0x324e87));if(_0x324e87['error']){if(_0x324e87[_0x2f41('0x11')][_0x2f41('0x12')]===0x1f4){logger[_0x2f41('0x11')](_0x2f41('0xc'),_0x22007d,_0x324e87[_0x2f41('0x11')][_0x2f41('0x13')]);return _0x3bbafc(_0x324e87['error'][_0x2f41('0x13')]);}logger[_0x2f41('0x11')](_0x2f41('0xc'),_0x22007d,_0x324e87[_0x2f41('0x11')][_0x2f41('0x13')]);return _0x4b85b7(_0x324e87['error'][_0x2f41('0x13')]);}else{logger[_0x2f41('0xb')](_0x2f41('0xc'),_0x22007d,_0x2f41('0xd'));_0x4b85b7(_0x324e87['result'][_0x2f41('0x13')]);}})[_0x2f41('0x14')](function(_0x36c2c6){logger[_0x2f41('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x22007d,_0x36c2c6);_0x3bbafc(_0x36c2c6);});});}exports[_0x2f41('0x15')]=function(_0x5d2bd8){var _0x1efe1d=this;return new Promise(function(_0x1d22c8,_0xcd17a2){return db[_0x2f41('0x16')][_0x2f41('0x17')]({'raw':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x19')]||null:null,'attributes':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8['options']['attributes']||null:null,'limit':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x1a')]||null:null,'include':_0x5d2bd8[_0x2f41('0x18')]?_0x5d2bd8[_0x2f41('0x18')][_0x2f41('0x1b')]?_['map'](_0x5d2bd8[_0x2f41('0x18')]['include'],function(_0x101627){return{'model':db[_0x101627[_0x2f41('0x1c')]],'as':_0x101627['as'],'attributes':_0x101627[_0x2f41('0x1d')],'include':_0x101627['include']?_['map'](_0x101627['include'],function(_0x432163){return{'model':db[_0x432163[_0x2f41('0x1c')]],'as':_0x432163['as'],'attributes':_0x432163[_0x2f41('0x1d')],'include':_0x432163['include']?_['map'](_0x432163[_0x2f41('0x1b')],function(_0x24c5b4){return{'model':db[_0x24c5b4['model']],'as':_0x24c5b4['as'],'attributes':_0x24c5b4[_0x2f41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f41('0xa')](function(_0xd48b62){logger['info'](_0x2f41('0x15'),_0x5d2bd8);logger[_0x2f41('0xe')](_0x2f41('0x15'),_0x5d2bd8,JSON[_0x2f41('0x10')](_0xd48b62));_0x1d22c8(_0xd48b62);})[_0x2f41('0x14')](function(_0x44a837){logger[_0x2f41('0x11')]('GetFreshdeskAccount',_0x44a837[_0x2f41('0x13')],_0x5d2bd8);_0xcd17a2(_0x1efe1d[_0x2f41('0x11')](0x1f4,_0x44a837['message']));});});};exports[_0x2f41('0x1e')]=function(_0x1927c0){var _0x4b6f0c=this;return new Promise(function(_0x58dc59,_0x22d157){return db[_0x2f41('0x16')][_0x2f41('0x1f')]({'raw':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x20')]===undefined?!![]:![]:!![],'where':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')]['where']||null:null,'attributes':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x1d')]||null:null,'include':_0x1927c0[_0x2f41('0x18')]?_0x1927c0[_0x2f41('0x18')][_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x1927c0['options'][_0x2f41('0x1b')],function(_0x4e6e1c){return{'model':db[_0x4e6e1c['model']],'as':_0x4e6e1c['as'],'attributes':_0x4e6e1c[_0x2f41('0x1d')],'include':_0x4e6e1c[_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x4e6e1c[_0x2f41('0x1b')],function(_0x4578ac){return{'model':db[_0x4578ac['model']],'as':_0x4578ac['as'],'attributes':_0x4578ac[_0x2f41('0x1d')],'include':_0x4578ac[_0x2f41('0x1b')]?_[_0x2f41('0x21')](_0x4578ac[_0x2f41('0x1b')],function(_0x12f77d){return{'model':db[_0x12f77d[_0x2f41('0x1c')]],'as':_0x12f77d['as'],'attributes':_0x12f77d[_0x2f41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f41('0xa')](function(_0xcaf974){logger[_0x2f41('0xb')]('ShowFreshdeskAccount',_0x1927c0);logger[_0x2f41('0xe')](_0x2f41('0x1e'),_0x1927c0,JSON[_0x2f41('0x10')](_0xcaf974));_0x58dc59(_0xcaf974);})[_0x2f41('0x14')](function(_0x15778a){logger[_0x2f41('0x11')](_0x2f41('0x1e'),_0x15778a[_0x2f41('0x13')],_0x1927c0);_0x22d157(_0x4b6f0c['error'](0x1f4,_0x15778a[_0x2f41('0x13')]));});});}; \ No newline at end of file +var _0xc0b9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','find','ShowFreshdeskAccount','stringify','catch','lodash','util'];(function(_0x1dff36,_0x554dd3){var _0x31bd88=function(_0x3a4b7d){while(--_0x3a4b7d){_0x1dff36['push'](_0x1dff36['shift']());}};_0x31bd88(++_0x554dd3);}(_0xc0b9,0x152));var _0x9c0b=function(_0x78885,_0x4eb1e8){_0x78885=_0x78885-0x0;var _0x13b4cf=_0xc0b9[_0x78885];return _0x13b4cf;};'use strict';var _=require(_0x9c0b('0x0'));var util=require(_0x9c0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9c0b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c0b('0x3'))['db'];var utils=require(_0x9c0b('0x4'));var logger=require(_0x9c0b('0x5'))('rpc');var config=require(_0x9c0b('0x6'));var jayson=require(_0x9c0b('0x7'));var client=jayson[_0x9c0b('0x8')][_0x9c0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x209d03,_0x187312,_0x47e34){return new BPromise(function(_0x2b179f,_0x4d1546){return client[_0x9c0b('0xa')](_0x209d03,_0x47e34)[_0x9c0b('0xb')](function(_0x482a13){logger[_0x9c0b('0xc')](_0x9c0b('0xd'),_0x187312,_0x9c0b('0xe'));logger[_0x9c0b('0xf')](_0x9c0b('0x10'),_0x187312,'request\x20sent',JSON['stringify'](_0x482a13));if(_0x482a13[_0x9c0b('0x11')]){if(_0x482a13[_0x9c0b('0x11')]['code']===0x1f4){logger[_0x9c0b('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x187312,_0x482a13[_0x9c0b('0x11')]['message']);return _0x4d1546(_0x482a13[_0x9c0b('0x11')]['message']);}logger[_0x9c0b('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x187312,_0x482a13[_0x9c0b('0x11')]['message']);return _0x2b179f(_0x482a13[_0x9c0b('0x11')][_0x9c0b('0x12')]);}else{logger['info'](_0x9c0b('0xd'),_0x187312,_0x9c0b('0xe'));_0x2b179f(_0x482a13[_0x9c0b('0x13')][_0x9c0b('0x12')]);}})['catch'](function(_0x2d5f03){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x187312,_0x2d5f03);_0x4d1546(_0x2d5f03);});});}exports[_0x9c0b('0x14')]=function(_0x5bf919){var _0x3b63cb=this;return new Promise(function(_0x20f5a4,_0x1d1ecb){return db[_0x9c0b('0x15')][_0x9c0b('0x16')]({'raw':_0x5bf919[_0x9c0b('0x17')]?_0x5bf919['options'][_0x9c0b('0x18')]===undefined?!![]:![]:!![],'where':_0x5bf919[_0x9c0b('0x17')]?_0x5bf919[_0x9c0b('0x17')]['where']||null:null,'attributes':_0x5bf919['options']?_0x5bf919['options'][_0x9c0b('0x19')]||null:null,'limit':_0x5bf919[_0x9c0b('0x17')]?_0x5bf919[_0x9c0b('0x17')][_0x9c0b('0x1a')]||null:null,'include':_0x5bf919[_0x9c0b('0x17')]?_0x5bf919[_0x9c0b('0x17')][_0x9c0b('0x1b')]?_[_0x9c0b('0x1c')](_0x5bf919[_0x9c0b('0x17')]['include'],function(_0xca9576){return{'model':db[_0xca9576['model']],'as':_0xca9576['as'],'attributes':_0xca9576[_0x9c0b('0x19')],'include':_0xca9576[_0x9c0b('0x1b')]?_['map'](_0xca9576[_0x9c0b('0x1b')],function(_0x12584e){return{'model':db[_0x12584e[_0x9c0b('0x1d')]],'as':_0x12584e['as'],'attributes':_0x12584e['attributes'],'include':_0x12584e[_0x9c0b('0x1b')]?_[_0x9c0b('0x1c')](_0x12584e['include'],function(_0x423af){return{'model':db[_0x423af[_0x9c0b('0x1d')]],'as':_0x423af['as'],'attributes':_0x423af[_0x9c0b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c0b('0xb')](function(_0x52f630){logger[_0x9c0b('0xc')](_0x9c0b('0x14'),_0x5bf919);logger[_0x9c0b('0xf')](_0x9c0b('0x14'),_0x5bf919,JSON['stringify'](_0x52f630));_0x20f5a4(_0x52f630);})['catch'](function(_0x6a54c7){logger[_0x9c0b('0x11')](_0x9c0b('0x14'),_0x6a54c7[_0x9c0b('0x12')],_0x5bf919);_0x1d1ecb(_0x3b63cb[_0x9c0b('0x11')](0x1f4,_0x6a54c7[_0x9c0b('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x5ae3d0){var _0x548bf9=this;return new Promise(function(_0x356748,_0x3f70de){return db[_0x9c0b('0x15')][_0x9c0b('0x1e')]({'raw':_0x5ae3d0[_0x9c0b('0x17')]?_0x5ae3d0[_0x9c0b('0x17')][_0x9c0b('0x18')]===undefined?!![]:![]:!![],'where':_0x5ae3d0[_0x9c0b('0x17')]?_0x5ae3d0[_0x9c0b('0x17')]['where']||null:null,'attributes':_0x5ae3d0['options']?_0x5ae3d0[_0x9c0b('0x17')][_0x9c0b('0x19')]||null:null,'include':_0x5ae3d0[_0x9c0b('0x17')]?_0x5ae3d0[_0x9c0b('0x17')][_0x9c0b('0x1b')]?_[_0x9c0b('0x1c')](_0x5ae3d0[_0x9c0b('0x17')][_0x9c0b('0x1b')],function(_0x10f0e6){return{'model':db[_0x10f0e6[_0x9c0b('0x1d')]],'as':_0x10f0e6['as'],'attributes':_0x10f0e6[_0x9c0b('0x19')],'include':_0x10f0e6['include']?_[_0x9c0b('0x1c')](_0x10f0e6[_0x9c0b('0x1b')],function(_0x3c8b2f){return{'model':db[_0x3c8b2f['model']],'as':_0x3c8b2f['as'],'attributes':_0x3c8b2f[_0x9c0b('0x19')],'include':_0x3c8b2f[_0x9c0b('0x1b')]?_[_0x9c0b('0x1c')](_0x3c8b2f[_0x9c0b('0x1b')],function(_0x423685){return{'model':db[_0x423685['model']],'as':_0x423685['as'],'attributes':_0x423685[_0x9c0b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c0b('0xb')](function(_0x16746a){logger[_0x9c0b('0xc')](_0x9c0b('0x1f'),_0x5ae3d0);logger[_0x9c0b('0xf')](_0x9c0b('0x1f'),_0x5ae3d0,JSON[_0x9c0b('0x20')](_0x16746a));_0x356748(_0x16746a);})[_0x9c0b('0x21')](function(_0x192712){logger['error']('ShowFreshdeskAccount',_0x192712[_0x9c0b('0x12')],_0x5ae3d0);_0x3f70de(_0x548bf9['error'](0x1f4,_0x192712[_0x9c0b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 58c70bf..3339598 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 _0x65c4=['/:id/tags','setTags','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getTags','post','create'];(function(_0x4e4755,_0x1152a0){var _0x4e9370=function(_0x34bf29){while(--_0x34bf29){_0x4e4755['push'](_0x4e4755['shift']());}};_0x4e9370(++_0x1152a0);}(_0x65c4,0x1b6));var _0x465c=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x65c4[_0x1cd674];return _0x27928f;};'use strict';var multer=require(_0x465c('0x0'));var util=require(_0x465c('0x1'));var path=require(_0x465c('0x2'));var timeout=require('connect-timeout');var express=require(_0x465c('0x3'));var router=express[_0x465c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x465c('0x5'));var config=require(_0x465c('0x6'));var controller=require(_0x465c('0x7'));router[_0x465c('0x8')]('/',auth[_0x465c('0x9')](),controller[_0x465c('0xa')]);router['get']('/:id',auth[_0x465c('0x9')](),controller[_0x465c('0xb')]);router[_0x465c('0x8')](_0x465c('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x465c('0x9')](),controller[_0x465c('0xd')]);router['get'](_0x465c('0xe'),auth[_0x465c('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x465c('0x9')](),controller[_0x465c('0xf')]);router[_0x465c('0x10')]('/',auth[_0x465c('0x9')](),controller[_0x465c('0x11')]);router['post'](_0x465c('0x12'),auth[_0x465c('0x9')](),controller[_0x465c('0x13')]);router[_0x465c('0x14')](_0x465c('0x15'),auth[_0x465c('0x9')](),controller['update']);router['delete'](_0x465c('0x15'),auth[_0x465c('0x9')](),controller[_0x465c('0x16')]);module[_0x465c('0x17')]=router; \ No newline at end of file +var _0x44d1=['connect-timeout','express','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','exports','multer','util'];(function(_0x2df37e,_0x283cba){var _0x259b5f=function(_0x19124a){while(--_0x19124a){_0x2df37e['push'](_0x2df37e['shift']());}};_0x259b5f(++_0x283cba);}(_0x44d1,0x94));var _0x144d=function(_0x2f6fec,_0x17554a){_0x2f6fec=_0x2f6fec-0x0;var _0x56b334=_0x44d1[_0x2f6fec];return _0x56b334;};'use strict';var multer=require(_0x144d('0x0'));var util=require(_0x144d('0x1'));var path=require('path');var timeout=require(_0x144d('0x2'));var express=require(_0x144d('0x3'));var router=express['Router']();var fs_extra=require(_0x144d('0x4'));var auth=require(_0x144d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x144d('0x6'));router[_0x144d('0x7')]('/',auth[_0x144d('0x8')](),controller[_0x144d('0x9')]);router[_0x144d('0x7')](_0x144d('0xa'),auth[_0x144d('0x8')](),controller['show']);router[_0x144d('0x7')](_0x144d('0xb'),auth[_0x144d('0x8')](),controller[_0x144d('0xc')]);router[_0x144d('0x7')](_0x144d('0xd'),auth[_0x144d('0x8')](),controller[_0x144d('0xe')]);router[_0x144d('0x7')](_0x144d('0xf'),auth[_0x144d('0x8')](),controller[_0x144d('0x10')]);router['get'](_0x144d('0x11'),auth[_0x144d('0x8')](),controller[_0x144d('0x12')]);router[_0x144d('0x13')]('/',auth[_0x144d('0x8')](),controller['create']);router[_0x144d('0x13')](_0x144d('0x11'),auth[_0x144d('0x8')](),controller[_0x144d('0x14')]);router[_0x144d('0x15')](_0x144d('0xa'),auth['isAuthenticated'](),controller[_0x144d('0x16')]);router[_0x144d('0x17')](_0x144d('0xa'),auth[_0x144d('0x8')](),controller['destroy']);module[_0x144d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 40e2b70..c86082f 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 _0x5068=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5068,0x1b8));var _0x8506=function(_0x2d6183,_0x1e741c){_0x2d6183=_0x2d6183-0x0;var _0xe0f2e4=_0x5068[_0x2d6183];return _0xe0f2e4;};'use strict';var Sequelize=require(_0x8506('0x0'));module[_0x8506('0x1')]={'name':{'type':Sequelize[_0x8506('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a57=['sequelize','STRING'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x2a57,0x19e));var _0x72a5=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x2a57[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x72a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x72a5('0x1')]},'description':{'type':Sequelize[_0x72a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ecc6f24..7a378fc 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 _0x846c=['setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','findAll','catch','show','rawAttributes','includeAll','include','options','find','create','body','params','getFields','FreshdeskField','order','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag'];(function(_0xa3c2dc,_0x46e0da){var _0x2f967c=function(_0x1db84e){while(--_0x1db84e){_0xa3c2dc['push'](_0xa3c2dc['shift']());}};_0x2f967c(++_0x46e0da);}(_0x846c,0x151));var _0xc846=function(_0xe0277e,_0x5096e2){_0xe0277e=_0xe0277e-0x0;var _0xfe4003=_0x846c[_0xe0277e];return _0xfe4003;};'use strict';var emlformat=require(_0xc846('0x0'));var rimraf=require(_0xc846('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc846('0x2'));var rp=require(_0xc846('0x3'));var moment=require(_0xc846('0x4'));var BPromise=require(_0xc846('0x5'));var Mustache=require(_0xc846('0x6'));var util=require('util');var path=require(_0xc846('0x7'));var sox=require(_0xc846('0x8'));var csv=require('to-csv');var ejs=require(_0xc846('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc846('0xa'));var crypto=require(_0xc846('0xb'));var jsforce=require(_0xc846('0xc'));var deskjs=require(_0xc846('0xd'));var toCsv=require(_0xc846('0xe'));var querystring=require(_0xc846('0xf'));var Papa=require(_0xc846('0x10'));var Redis=require('ioredis');var authService=require(_0xc846('0x11'));var qs=require(_0xc846('0x12'));var as=require(_0xc846('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc846('0x14'))(_0xc846('0x15'));var utils=require(_0xc846('0x16'));var config=require(_0xc846('0x17'));var licenseUtil=require(_0xc846('0x18'));var db=require(_0xc846('0x19'))['db'];function respondWithStatusCode(_0x50f93c,_0x28939){_0x28939=_0x28939||0xcc;return function(_0x4365ad){if(_0x4365ad){return _0x50f93c['sendStatus'](_0x28939);}return _0x50f93c[_0xc846('0x1a')](_0x28939)[_0xc846('0x1b')]();};}function respondWithResult(_0xe24491,_0x31f950){_0x31f950=_0x31f950||0xc8;return function(_0x3d9333){if(_0x3d9333){return _0xe24491[_0xc846('0x1a')](_0x31f950)[_0xc846('0x1c')](_0x3d9333);}};}function respondWithFilteredResult(_0x20ab0d,_0x4c06d3){return function(_0x812266){if(_0x812266){var _0x4b65dc=typeof _0x4c06d3[_0xc846('0x1d')]===_0xc846('0x1e')&&typeof _0x4c06d3['limit']==='undefined';var _0x3cfeef=_0x812266['count'];var _0x3b2dce=_0x4b65dc?0x0:_0x4c06d3[_0xc846('0x1d')];var _0x358c9b=_0x4b65dc?_0x812266[_0xc846('0x1f')]:_0x4c06d3['offset']+_0x4c06d3[_0xc846('0x20')];var _0x8d19a8;if(_0x358c9b>=_0x3cfeef){_0x358c9b=_0x3cfeef;_0x8d19a8=0xc8;}else{_0x8d19a8=0xce;}_0x20ab0d[_0xc846('0x1a')](_0x8d19a8);return _0x20ab0d[_0xc846('0x21')](_0xc846('0x22'),_0x3b2dce+'-'+_0x358c9b+'/'+_0x3cfeef)[_0xc846('0x1c')](_0x812266);}return null;};}function patchUpdates(_0x389e60){return function(_0x1ddab0){try{jsonpatch[_0xc846('0x23')](_0x1ddab0,_0x389e60,!![]);}catch(_0x4ec9e2){return BPromise[_0xc846('0x24')](_0x4ec9e2);}return _0x1ddab0[_0xc846('0x25')]();};}function saveUpdates(_0x76f72d,_0x3f00f9){return function(_0x2915ef){if(_0x2915ef){return _0x2915ef['update'](_0x76f72d)['then'](function(_0x2675ed){return _0x2675ed;});}return null;};}function removeEntity(_0x44f31d,_0xff1464){return function(_0x449501){if(_0x449501){return _0x449501[_0xc846('0x26')]()[_0xc846('0x27')](function(){_0x44f31d[_0xc846('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef608,_0xa43d44){return function(_0x314f57){if(!_0x314f57){_0x5ef608[_0xc846('0x28')](0x194);}return _0x314f57;};}function handleError(_0x48d359,_0x291782){_0x291782=_0x291782||0x1f4;return function(_0x491664){logger['error'](_0x491664['stack']);if(_0x491664[_0xc846('0x29')]){delete _0x491664[_0xc846('0x29')];}_0x48d359['status'](_0x291782)[_0xc846('0x2a')](_0x491664);};}exports[_0xc846('0x2b')]=function(_0x27b4a0,_0x5ecd99){var _0x453b12={},_0x19ba68={},_0x1b0c26={'count':0x0,'rows':[]};var _0x592ec2=_[_0xc846('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x4450b8){return{'name':_0x4450b8['fieldName'],'type':_0x4450b8[_0xc846('0x2d')][_0xc846('0x2e')]};});_0x19ba68[_0xc846('0x2f')]=_[_0xc846('0x2c')](_0x592ec2,_0xc846('0x29'));_0x19ba68[_0xc846('0x30')]=_[_0xc846('0x31')](_0x27b4a0[_0xc846('0x30')]);_0x19ba68[_0xc846('0x32')]=_[_0xc846('0x33')](_0x19ba68['model'],_0x19ba68[_0xc846('0x30')]);_0x453b12[_0xc846('0x34')]=_[_0xc846('0x33')](_0x19ba68[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x35')]));_0x453b12[_0xc846('0x34')]=_0x453b12[_0xc846('0x34')][_0xc846('0x36')]?_0x453b12[_0xc846('0x34')]:_0x19ba68[_0xc846('0x2f')];if(!_0x27b4a0[_0xc846('0x30')][_0xc846('0x37')]('nolimit')){_0x453b12[_0xc846('0x20')]=qs[_0xc846('0x20')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x20')]);_0x453b12[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x1d')]);}_0x453b12['order']=qs[_0xc846('0x38')](_0x27b4a0[_0xc846('0x30')][_0xc846('0x38')]);_0x453b12[_0xc846('0x39')]=qs[_0xc846('0x32')](_[_0xc846('0x3a')](_0x27b4a0[_0xc846('0x30')],_0x19ba68[_0xc846('0x32')]),_0x592ec2);if(_0x27b4a0[_0xc846('0x30')][_0xc846('0x3b')]){_0x453b12[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x453b12[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0x592ec2,function(_0x474cb3){if(_0x474cb3['type']!==_0xc846('0x3d')){var _0x3c1f01={};_0x3c1f01[_0x474cb3[_0xc846('0x29')]]={'$like':'%'+_0x27b4a0[_0xc846('0x30')][_0xc846('0x3b')]+'%'};return _0x3c1f01;}})});}_0x453b12=_[_0xc846('0x3c')]({},_0x453b12,_0x27b4a0['options']);var _0x573bc9={'where':_0x453b12[_0xc846('0x39')]};return db[_0xc846('0x3e')]['count'](_0x573bc9)[_0xc846('0x27')](function(_0x162943){_0x1b0c26[_0xc846('0x1f')]=_0x162943;if(_0x27b4a0[_0xc846('0x30')]['includeAll']){_0x453b12['include']=[{'all':!![]}];}return db[_0xc846('0x3e')][_0xc846('0x3f')](_0x453b12);})[_0xc846('0x27')](function(_0x45f068){_0x1b0c26['rows']=_0x45f068;return _0x1b0c26;})[_0xc846('0x27')](respondWithFilteredResult(_0x5ecd99,_0x453b12))[_0xc846('0x40')](handleError(_0x5ecd99,null));};exports[_0xc846('0x41')]=function(_0x219560,_0x132f0e){var _0x5c097a={'raw':![],'where':{'id':_0x219560['params']['id']}},_0x1c85be={};_0x1c85be[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x3e')][_0xc846('0x42')]);_0x1c85be['query']=_[_0xc846('0x31')](_0x219560['query']);_0x1c85be[_0xc846('0x32')]=_['intersection'](_0x1c85be['model'],_0x1c85be[_0xc846('0x30')]);_0x5c097a[_0xc846('0x34')]=_[_0xc846('0x33')](_0x1c85be[_0xc846('0x2f')],qs['fields'](_0x219560['query'][_0xc846('0x35')]));_0x5c097a[_0xc846('0x34')]=_0x5c097a[_0xc846('0x34')]['length']?_0x5c097a[_0xc846('0x34')]:_0x1c85be[_0xc846('0x2f')];if(_0x219560['query'][_0xc846('0x43')]){_0x5c097a[_0xc846('0x44')]=[{'all':!![]}];}_0x5c097a=_[_0xc846('0x3c')]({},_0x5c097a,_0x219560[_0xc846('0x45')]);return db['FreshdeskConfiguration'][_0xc846('0x46')](_0x5c097a)['then'](handleEntityNotFound(_0x132f0e,null))[_0xc846('0x27')](respondWithResult(_0x132f0e,null))[_0xc846('0x40')](handleError(_0x132f0e,null));};exports[_0xc846('0x47')]=function(_0x1f88b5,_0x38e95b){return db[_0xc846('0x3e')]['create'](_0x1f88b5['body'],{})[_0xc846('0x27')](respondWithResult(_0x38e95b,0xc9))[_0xc846('0x40')](handleError(_0x38e95b,null));};exports['update']=function(_0x207593,_0x5c5933){if(_0x207593[_0xc846('0x48')]['id']){delete _0x207593[_0xc846('0x48')]['id'];}return db[_0xc846('0x3e')]['find']({'where':{'id':_0x207593[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x5c5933,null))[_0xc846('0x27')](saveUpdates(_0x207593[_0xc846('0x48')],null))['then'](respondWithResult(_0x5c5933,null))[_0xc846('0x40')](handleError(_0x5c5933,null));};exports['destroy']=function(_0xbea8a7,_0x159327){return db['FreshdeskConfiguration'][_0xc846('0x46')]({'where':{'id':_0xbea8a7['params']['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x159327,null))[_0xc846('0x27')](removeEntity(_0x159327,null))['catch'](handleError(_0x159327,null));};exports[_0xc846('0x4a')]=function(_0xc26979,_0x29fc7d,_0x19fb44){var _0x375401={};var _0x1fc1f8={};var _0x3126db;var _0x4bd1c6;return db[_0xc846('0x3e')]['findOne']({'where':{'id':_0xc26979['params']['id']}})['then'](handleEntityNotFound(_0x29fc7d,null))[_0xc846('0x27')](function(_0x2532be){if(_0x2532be){_0x3126db=_0x2532be;_0x1fc1f8[_0xc846('0x2f')]=_['keys'](db[_0xc846('0x4b')]['rawAttributes']);_0x1fc1f8[_0xc846('0x30')]=_[_0xc846('0x31')](_0xc26979['query']);_0x1fc1f8[_0xc846('0x32')]=_[_0xc846('0x33')](_0x1fc1f8[_0xc846('0x2f')],_0x1fc1f8[_0xc846('0x30')]);_0x375401[_0xc846('0x34')]=_[_0xc846('0x33')](_0x1fc1f8[_0xc846('0x2f')],qs['fields'](_0xc26979[_0xc846('0x30')][_0xc846('0x35')]));_0x375401[_0xc846('0x34')]=_0x375401['attributes'][_0xc846('0x36')]?_0x375401['attributes']:_0x1fc1f8[_0xc846('0x2f')];_0x375401[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0xc26979[_0xc846('0x30')][_0xc846('0x38')]);_0x375401[_0xc846('0x39')]=qs[_0xc846('0x32')](_[_0xc846('0x3a')](_0xc26979['query'],_0x1fc1f8[_0xc846('0x32')]));if(_0xc26979[_0xc846('0x30')][_0xc846('0x3b')]){_0x375401[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x375401['where'],{'$or':_[_0xc846('0x2c')](_0x375401[_0xc846('0x34')],function(_0x5847e6){var _0x1bb281={};_0x1bb281[_0x5847e6]={'$like':'%'+_0xc26979[_0xc846('0x30')][_0xc846('0x3b')]+'%'};return _0x1bb281;})});}_0x375401=_[_0xc846('0x3c')]({},_0x375401,_0xc26979[_0xc846('0x45')]);return _0x3126db['getFields'](_0x375401);}})[_0xc846('0x27')](function(_0x1f61b0){if(_0x1f61b0){_0x4bd1c6=_0x1f61b0['length'];if(!_0xc26979[_0xc846('0x30')][_0xc846('0x37')](_0xc846('0x4d'))){_0x375401[_0xc846('0x20')]=qs[_0xc846('0x20')](_0xc26979[_0xc846('0x30')][_0xc846('0x20')]);_0x375401[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0xc26979[_0xc846('0x30')][_0xc846('0x1d')]);}return _0x3126db[_0xc846('0x4a')](_0x375401);}})[_0xc846('0x27')](function(_0x57ac9){if(_0x57ac9){return _0x57ac9?{'count':_0x4bd1c6,'rows':_0x57ac9}:null;}})[_0xc846('0x27')](respondWithResult(_0x29fc7d,null))[_0xc846('0x40')](handleError(_0x29fc7d,null));};exports[_0xc846('0x4e')]=function(_0x592007,_0x35b4b9,_0x278ef8){var _0x561435={};var _0x4ad87f={};var _0xfe07d5;var _0xe52d70;return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x592007[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x35b4b9,null))[_0xc846('0x27')](function(_0x48cf06){if(_0x48cf06){_0xfe07d5=_0x48cf06;_0x4ad87f['model']=_[_0xc846('0x31')](db['FreshdeskField'][_0xc846('0x42')]);_0x4ad87f[_0xc846('0x30')]=_['keys'](_0x592007[_0xc846('0x30')]);_0x4ad87f[_0xc846('0x32')]=_[_0xc846('0x33')](_0x4ad87f[_0xc846('0x2f')],_0x4ad87f[_0xc846('0x30')]);_0x561435[_0xc846('0x34')]=_[_0xc846('0x33')](_0x4ad87f[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x592007['query'][_0xc846('0x35')]));_0x561435[_0xc846('0x34')]=_0x561435[_0xc846('0x34')][_0xc846('0x36')]?_0x561435['attributes']:_0x4ad87f[_0xc846('0x2f')];_0x561435[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x592007[_0xc846('0x30')][_0xc846('0x38')]);_0x561435[_0xc846('0x39')]=qs['filters'](_[_0xc846('0x3a')](_0x592007[_0xc846('0x30')],_0x4ad87f[_0xc846('0x32')]));if(_0x592007[_0xc846('0x30')][_0xc846('0x3b')]){_0x561435[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x561435['where'],{'$or':_[_0xc846('0x2c')](_0x561435['attributes'],function(_0x385a46){var _0x10d74b={};_0x10d74b[_0x385a46]={'$like':'%'+_0x592007['query'][_0xc846('0x3b')]+'%'};return _0x10d74b;})});}_0x561435=_[_0xc846('0x3c')]({},_0x561435,_0x592007[_0xc846('0x45')]);return _0xfe07d5[_0xc846('0x4e')](_0x561435);}})[_0xc846('0x27')](function(_0x2114e3){if(_0x2114e3){_0xe52d70=_0x2114e3[_0xc846('0x36')];if(!_0x592007['query'][_0xc846('0x37')](_0xc846('0x4d'))){_0x561435[_0xc846('0x20')]=qs[_0xc846('0x20')](_0x592007[_0xc846('0x30')][_0xc846('0x20')]);_0x561435[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x592007[_0xc846('0x30')][_0xc846('0x1d')]);}return _0xfe07d5[_0xc846('0x4e')](_0x561435);}})[_0xc846('0x27')](function(_0x40332d){if(_0x40332d){return _0x40332d?{'count':_0xe52d70,'rows':_0x40332d}:null;}})[_0xc846('0x27')](respondWithResult(_0x35b4b9,null))[_0xc846('0x40')](handleError(_0x35b4b9,null));};exports[_0xc846('0x50')]=function(_0x2f4910,_0x5ce1d2,_0x2e8d93){var _0xc21772={};var _0x174254={};var _0x38a305;var _0x2e0734;return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x2f4910[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x5ce1d2,null))[_0xc846('0x27')](function(_0x4be807){if(_0x4be807){_0x38a305=_0x4be807;_0x174254[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x4b')][_0xc846('0x42')]);_0x174254[_0xc846('0x30')]=_['keys'](_0x2f4910[_0xc846('0x30')]);_0x174254[_0xc846('0x32')]=_[_0xc846('0x33')](_0x174254[_0xc846('0x2f')],_0x174254[_0xc846('0x30')]);_0xc21772['attributes']=_['intersection'](_0x174254[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x2f4910[_0xc846('0x30')][_0xc846('0x35')]));_0xc21772[_0xc846('0x34')]=_0xc21772[_0xc846('0x34')][_0xc846('0x36')]?_0xc21772[_0xc846('0x34')]:_0x174254[_0xc846('0x2f')];_0xc21772[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x2f4910[_0xc846('0x30')][_0xc846('0x38')]);_0xc21772[_0xc846('0x39')]=qs[_0xc846('0x32')](_['pick'](_0x2f4910[_0xc846('0x30')],_0x174254[_0xc846('0x32')]));if(_0x2f4910[_0xc846('0x30')][_0xc846('0x3b')]){_0xc21772[_0xc846('0x39')]=_[_0xc846('0x3c')](_0xc21772[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0xc21772[_0xc846('0x34')],function(_0x5ebe1e){var _0x44f803={};_0x44f803[_0x5ebe1e]={'$like':'%'+_0x2f4910['query'][_0xc846('0x3b')]+'%'};return _0x44f803;})});}_0xc21772=_[_0xc846('0x3c')]({},_0xc21772,_0x2f4910[_0xc846('0x45')]);return _0x38a305[_0xc846('0x50')](_0xc21772);}})['then'](function(_0x4eb917){if(_0x4eb917){_0x2e0734=_0x4eb917[_0xc846('0x36')];if(!_0x2f4910['query']['hasOwnProperty'](_0xc846('0x4d'))){_0xc21772['limit']=qs[_0xc846('0x20')](_0x2f4910[_0xc846('0x30')]['limit']);_0xc21772[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x2f4910[_0xc846('0x30')][_0xc846('0x1d')]);}return _0x38a305[_0xc846('0x50')](_0xc21772);}})[_0xc846('0x27')](function(_0x4d092e){if(_0x4d092e){return _0x4d092e?{'count':_0x2e0734,'rows':_0x4d092e}:null;}})[_0xc846('0x27')](respondWithResult(_0x5ce1d2,null))[_0xc846('0x40')](handleError(_0x5ce1d2,null));};exports[_0xc846('0x51')]=function(_0x3fa3fb,_0x3396ee,_0x4de1e0){var _0x31cb2b={};var _0x5ee324={};var _0xb88fb2;var _0x46ac28;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3fa3fb[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0x3396ee,null))['then'](function(_0x1dd4ca){if(_0x1dd4ca){_0xb88fb2=_0x1dd4ca;_0x5ee324[_0xc846('0x2f')]=_[_0xc846('0x31')](db[_0xc846('0x52')]['rawAttributes']);_0x5ee324[_0xc846('0x30')]=_[_0xc846('0x31')](_0x3fa3fb['query']);_0x5ee324[_0xc846('0x32')]=_['intersection'](_0x5ee324[_0xc846('0x2f')],_0x5ee324[_0xc846('0x30')]);_0x31cb2b[_0xc846('0x34')]=_[_0xc846('0x33')](_0x5ee324[_0xc846('0x2f')],qs[_0xc846('0x35')](_0x3fa3fb['query'][_0xc846('0x35')]));_0x31cb2b[_0xc846('0x34')]=_0x31cb2b[_0xc846('0x34')][_0xc846('0x36')]?_0x31cb2b[_0xc846('0x34')]:_0x5ee324[_0xc846('0x2f')];_0x31cb2b[_0xc846('0x4c')]=qs[_0xc846('0x38')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x38')]);_0x31cb2b['where']=qs[_0xc846('0x32')](_['pick'](_0x3fa3fb[_0xc846('0x30')],_0x5ee324[_0xc846('0x32')]));if(_0x3fa3fb[_0xc846('0x30')][_0xc846('0x3b')]){_0x31cb2b[_0xc846('0x39')]=_[_0xc846('0x3c')](_0x31cb2b[_0xc846('0x39')],{'$or':_[_0xc846('0x2c')](_0x31cb2b['attributes'],function(_0x38904a){var _0x29433e={};_0x29433e[_0x38904a]={'$like':'%'+_0x3fa3fb[_0xc846('0x30')]['filter']+'%'};return _0x29433e;})});}_0x31cb2b=_[_0xc846('0x3c')]({},_0x31cb2b,_0x3fa3fb['options']);return _0xb88fb2[_0xc846('0x51')](_0x31cb2b);}})[_0xc846('0x27')](function(_0x190d75){if(_0x190d75){_0x46ac28=_0x190d75['length'];if(!_0x3fa3fb['query'][_0xc846('0x37')](_0xc846('0x4d'))){_0x31cb2b['limit']=qs[_0xc846('0x20')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x20')]);_0x31cb2b[_0xc846('0x1d')]=qs[_0xc846('0x1d')](_0x3fa3fb[_0xc846('0x30')][_0xc846('0x1d')]);}return _0xb88fb2[_0xc846('0x51')](_0x31cb2b);}})[_0xc846('0x27')](function(_0x5e1cc6){if(_0x5e1cc6){return _0x5e1cc6?{'count':_0x46ac28,'rows':_0x5e1cc6}:null;}})[_0xc846('0x27')](respondWithResult(_0x3396ee,null))['catch'](handleError(_0x3396ee,null));};exports[_0xc846('0x53')]=function(_0x4e8bbb,_0xca5795,_0x263e55){if(_0x4e8bbb[_0xc846('0x48')]['id']){delete _0x4e8bbb[_0xc846('0x48')]['id'];}return db[_0xc846('0x3e')][_0xc846('0x4f')]({'where':{'id':_0x4e8bbb[_0xc846('0x49')]['id']}})[_0xc846('0x27')](handleEntityNotFound(_0xca5795,null))['then'](function(_0xdd217d){if(_0xdd217d){return _0xdd217d['setTags'](_0x4e8bbb[_0xc846('0x48')]['ids']||[]);}return null;})[_0xc846('0x27')](respondWithResult(_0xca5795,null))['catch'](handleError(_0xca5795,null));}; \ No newline at end of file +var _0x09c4=['getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','FreshdeskConfiguration','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','rawAttributes','include','options','find','create','body','update','params','destroy','getFields','findOne','FreshdeskField','pick','hasOwnProperty','getSubjects','getDescriptions'];(function(_0x42c8ab,_0x447c1e){var _0x1f47ee=function(_0x136497){while(--_0x136497){_0x42c8ab['push'](_0x42c8ab['shift']());}};_0x1f47ee(++_0x447c1e);}(_0x09c4,0x109));var _0x409c=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x09c4[_0x383356];return _0x32ee5a;};'use strict';var emlformat=require(_0x409c('0x0'));var rimraf=require(_0x409c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x409c('0x2'));var rp=require(_0x409c('0x3'));var moment=require(_0x409c('0x4'));var BPromise=require(_0x409c('0x5'));var Mustache=require(_0x409c('0x6'));var util=require(_0x409c('0x7'));var path=require(_0x409c('0x8'));var sox=require('sox');var csv=require(_0x409c('0x9'));var ejs=require(_0x409c('0xa'));var fs=require('fs');var fs_extra=require(_0x409c('0xb'));var _=require(_0x409c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x409c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x409c('0x9'));var querystring=require(_0x409c('0xe'));var Papa=require(_0x409c('0xf'));var Redis=require(_0x409c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x409c('0x11'));var as=require(_0x409c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x409c('0x13'))(_0x409c('0x14'));var utils=require(_0x409c('0x15'));var config=require(_0x409c('0x16'));var licenseUtil=require(_0x409c('0x17'));var db=require(_0x409c('0x18'))['db'];function respondWithStatusCode(_0x4ba2e7,_0x4fcb48){_0x4fcb48=_0x4fcb48||0xcc;return function(_0x4f9162){if(_0x4f9162){return _0x4ba2e7[_0x409c('0x19')](_0x4fcb48);}return _0x4ba2e7[_0x409c('0x1a')](_0x4fcb48)['end']();};}function respondWithResult(_0x455fdd,_0x1a4187){_0x1a4187=_0x1a4187||0xc8;return function(_0xee4751){if(_0xee4751){return _0x455fdd['status'](_0x1a4187)[_0x409c('0x1b')](_0xee4751);}};}function respondWithFilteredResult(_0x5d8450,_0x330fa1){return function(_0x33851b){if(_0x33851b){var _0x434c06=typeof _0x330fa1[_0x409c('0x1c')]==='undefined'&&typeof _0x330fa1[_0x409c('0x1d')]===_0x409c('0x1e');var _0x2dc91a=_0x33851b['count'];var _0x24bb26=_0x434c06?0x0:_0x330fa1[_0x409c('0x1c')];var _0x3a2588=_0x434c06?_0x33851b[_0x409c('0x1f')]:_0x330fa1['offset']+_0x330fa1[_0x409c('0x1d')];var _0x28b7aa;if(_0x3a2588>=_0x2dc91a){_0x3a2588=_0x2dc91a;_0x28b7aa=0xc8;}else{_0x28b7aa=0xce;}_0x5d8450[_0x409c('0x1a')](_0x28b7aa);return _0x5d8450[_0x409c('0x20')](_0x409c('0x21'),_0x24bb26+'-'+_0x3a2588+'/'+_0x2dc91a)[_0x409c('0x1b')](_0x33851b);}return null;};}function patchUpdates(_0x350cb2){return function(_0x563156){try{jsonpatch[_0x409c('0x22')](_0x563156,_0x350cb2,!![]);}catch(_0x5dc93b){return BPromise[_0x409c('0x23')](_0x5dc93b);}return _0x563156[_0x409c('0x24')]();};}function saveUpdates(_0x464f3,_0x5f2053){return function(_0x57b5e5){if(_0x57b5e5){return _0x57b5e5['update'](_0x464f3)[_0x409c('0x25')](function(_0x3209df){return _0x3209df;});}return null;};}function removeEntity(_0x211033,_0x439be5){return function(_0xaa64ad){if(_0xaa64ad){return _0xaa64ad['destroy']()[_0x409c('0x25')](function(){_0x211033[_0x409c('0x1a')](0xcc)[_0x409c('0x26')]();});}};}function handleEntityNotFound(_0x3cf098,_0x44eaba){return function(_0x5c9a05){if(!_0x5c9a05){_0x3cf098[_0x409c('0x19')](0x194);}return _0x5c9a05;};}function handleError(_0xd71d3d,_0x146402){_0x146402=_0x146402||0x1f4;return function(_0x1f32c3){logger[_0x409c('0x27')](_0x1f32c3[_0x409c('0x28')]);if(_0x1f32c3['name']){delete _0x1f32c3[_0x409c('0x29')];}_0xd71d3d['status'](_0x146402)[_0x409c('0x2a')](_0x1f32c3);};}exports['index']=function(_0x57476b,_0x14913d){var _0x3791a6={},_0x4328e2={},_0x4c7e47={'count':0x0,'rows':[]};var _0x51bcc5=_[_0x409c('0x2b')](db[_0x409c('0x2c')]['rawAttributes'],function(_0x35c394){return{'name':_0x35c394[_0x409c('0x2d')],'type':_0x35c394[_0x409c('0x2e')][_0x409c('0x2f')]};});_0x4328e2['model']=_[_0x409c('0x2b')](_0x51bcc5,_0x409c('0x29'));_0x4328e2['query']=_[_0x409c('0x30')](_0x57476b[_0x409c('0x31')]);_0x4328e2[_0x409c('0x32')]=_[_0x409c('0x33')](_0x4328e2[_0x409c('0x34')],_0x4328e2[_0x409c('0x31')]);_0x3791a6[_0x409c('0x35')]=_[_0x409c('0x33')](_0x4328e2[_0x409c('0x34')],qs[_0x409c('0x36')](_0x57476b['query']['fields']));_0x3791a6['attributes']=_0x3791a6['attributes'][_0x409c('0x37')]?_0x3791a6[_0x409c('0x35')]:_0x4328e2[_0x409c('0x34')];if(!_0x57476b[_0x409c('0x31')]['hasOwnProperty'](_0x409c('0x38'))){_0x3791a6[_0x409c('0x1d')]=qs[_0x409c('0x1d')](_0x57476b[_0x409c('0x31')][_0x409c('0x1d')]);_0x3791a6[_0x409c('0x1c')]=qs[_0x409c('0x1c')](_0x57476b['query'][_0x409c('0x1c')]);}_0x3791a6[_0x409c('0x39')]=qs['sort'](_0x57476b[_0x409c('0x31')][_0x409c('0x3a')]);_0x3791a6['where']=qs[_0x409c('0x32')](_['pick'](_0x57476b[_0x409c('0x31')],_0x4328e2[_0x409c('0x32')]),_0x51bcc5);if(_0x57476b[_0x409c('0x31')][_0x409c('0x3b')]){_0x3791a6[_0x409c('0x3c')]=_[_0x409c('0x3d')](_0x3791a6[_0x409c('0x3c')],{'$or':_[_0x409c('0x2b')](_0x51bcc5,function(_0x52f96a){if(_0x52f96a['type']!==_0x409c('0x3e')){var _0x3eaffe={};_0x3eaffe[_0x52f96a[_0x409c('0x29')]]={'$like':'%'+_0x57476b[_0x409c('0x31')][_0x409c('0x3b')]+'%'};return _0x3eaffe;}})});}_0x3791a6=_['merge']({},_0x3791a6,_0x57476b['options']);var _0x4ee7b0={'where':_0x3791a6[_0x409c('0x3c')]};return db[_0x409c('0x2c')]['count'](_0x4ee7b0)['then'](function(_0x4312e8){_0x4c7e47['count']=_0x4312e8;if(_0x57476b['query'][_0x409c('0x3f')]){_0x3791a6['include']=[{'all':!![]}];}return db[_0x409c('0x2c')][_0x409c('0x40')](_0x3791a6);})[_0x409c('0x25')](function(_0x2d30ee){_0x4c7e47['rows']=_0x2d30ee;return _0x4c7e47;})['then'](respondWithFilteredResult(_0x14913d,_0x3791a6))[_0x409c('0x41')](handleError(_0x14913d,null));};exports[_0x409c('0x42')]=function(_0x6e6141,_0x272ffd){var _0x1530e2={'raw':![],'where':{'id':_0x6e6141['params']['id']}},_0x4a602c={};_0x4a602c['model']=_['keys'](db[_0x409c('0x2c')][_0x409c('0x43')]);_0x4a602c[_0x409c('0x31')]=_[_0x409c('0x30')](_0x6e6141['query']);_0x4a602c[_0x409c('0x32')]=_['intersection'](_0x4a602c[_0x409c('0x34')],_0x4a602c[_0x409c('0x31')]);_0x1530e2[_0x409c('0x35')]=_[_0x409c('0x33')](_0x4a602c[_0x409c('0x34')],qs[_0x409c('0x36')](_0x6e6141[_0x409c('0x31')]['fields']));_0x1530e2[_0x409c('0x35')]=_0x1530e2[_0x409c('0x35')][_0x409c('0x37')]?_0x1530e2[_0x409c('0x35')]:_0x4a602c[_0x409c('0x34')];if(_0x6e6141[_0x409c('0x31')][_0x409c('0x3f')]){_0x1530e2[_0x409c('0x44')]=[{'all':!![]}];}_0x1530e2=_['merge']({},_0x1530e2,_0x6e6141[_0x409c('0x45')]);return db[_0x409c('0x2c')][_0x409c('0x46')](_0x1530e2)[_0x409c('0x25')](handleEntityNotFound(_0x272ffd,null))[_0x409c('0x25')](respondWithResult(_0x272ffd,null))[_0x409c('0x41')](handleError(_0x272ffd,null));};exports[_0x409c('0x47')]=function(_0x4e5235,_0x1afbe9){return db['FreshdeskConfiguration']['create'](_0x4e5235[_0x409c('0x48')],{})['then'](respondWithResult(_0x1afbe9,0xc9))[_0x409c('0x41')](handleError(_0x1afbe9,null));};exports[_0x409c('0x49')]=function(_0x2371c1,_0x4dd2bd){if(_0x2371c1[_0x409c('0x48')]['id']){delete _0x2371c1[_0x409c('0x48')]['id'];}return db[_0x409c('0x2c')]['find']({'where':{'id':_0x2371c1[_0x409c('0x4a')]['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x4dd2bd,null))[_0x409c('0x25')](saveUpdates(_0x2371c1['body'],null))['then'](respondWithResult(_0x4dd2bd,null))[_0x409c('0x41')](handleError(_0x4dd2bd,null));};exports[_0x409c('0x4b')]=function(_0x509020,_0xdaa11e){return db[_0x409c('0x2c')][_0x409c('0x46')]({'where':{'id':_0x509020[_0x409c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdaa11e,null))[_0x409c('0x25')](removeEntity(_0xdaa11e,null))['catch'](handleError(_0xdaa11e,null));};exports[_0x409c('0x4c')]=function(_0x247059,_0x4ec953,_0x7d55c2){var _0x308684={};var _0x4123f6={};var _0x5255ce;var _0x2b88e3;return db[_0x409c('0x2c')][_0x409c('0x4d')]({'where':{'id':_0x247059[_0x409c('0x4a')]['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x4ec953,null))[_0x409c('0x25')](function(_0x3d5f60){if(_0x3d5f60){_0x5255ce=_0x3d5f60;_0x4123f6[_0x409c('0x34')]=_[_0x409c('0x30')](db[_0x409c('0x4e')][_0x409c('0x43')]);_0x4123f6[_0x409c('0x31')]=_[_0x409c('0x30')](_0x247059['query']);_0x4123f6['filters']=_['intersection'](_0x4123f6[_0x409c('0x34')],_0x4123f6['query']);_0x308684[_0x409c('0x35')]=_['intersection'](_0x4123f6[_0x409c('0x34')],qs[_0x409c('0x36')](_0x247059[_0x409c('0x31')][_0x409c('0x36')]));_0x308684['attributes']=_0x308684[_0x409c('0x35')][_0x409c('0x37')]?_0x308684['attributes']:_0x4123f6[_0x409c('0x34')];_0x308684[_0x409c('0x39')]=qs['sort'](_0x247059[_0x409c('0x31')][_0x409c('0x3a')]);_0x308684['where']=qs[_0x409c('0x32')](_[_0x409c('0x4f')](_0x247059['query'],_0x4123f6[_0x409c('0x32')]));if(_0x247059['query'][_0x409c('0x3b')]){_0x308684[_0x409c('0x3c')]=_[_0x409c('0x3d')](_0x308684[_0x409c('0x3c')],{'$or':_[_0x409c('0x2b')](_0x308684['attributes'],function(_0x735f4c){var _0x445cf1={};_0x445cf1[_0x735f4c]={'$like':'%'+_0x247059[_0x409c('0x31')][_0x409c('0x3b')]+'%'};return _0x445cf1;})});}_0x308684=_['merge']({},_0x308684,_0x247059[_0x409c('0x45')]);return _0x5255ce[_0x409c('0x4c')](_0x308684);}})[_0x409c('0x25')](function(_0x15ba69){if(_0x15ba69){_0x2b88e3=_0x15ba69['length'];if(!_0x247059['query'][_0x409c('0x50')](_0x409c('0x38'))){_0x308684[_0x409c('0x1d')]=qs[_0x409c('0x1d')](_0x247059['query'][_0x409c('0x1d')]);_0x308684[_0x409c('0x1c')]=qs[_0x409c('0x1c')](_0x247059[_0x409c('0x31')][_0x409c('0x1c')]);}return _0x5255ce['getFields'](_0x308684);}})[_0x409c('0x25')](function(_0x5761b1){if(_0x5761b1){return _0x5761b1?{'count':_0x2b88e3,'rows':_0x5761b1}:null;}})[_0x409c('0x25')](respondWithResult(_0x4ec953,null))[_0x409c('0x41')](handleError(_0x4ec953,null));};exports[_0x409c('0x51')]=function(_0x441b7b,_0x422bde,_0x41ee1f){var _0x55f384={};var _0x183099={};var _0x2fae57;var _0x17d7b1;return db[_0x409c('0x2c')]['findOne']({'where':{'id':_0x441b7b[_0x409c('0x4a')]['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x422bde,null))['then'](function(_0x46f627){if(_0x46f627){_0x2fae57=_0x46f627;_0x183099['model']=_[_0x409c('0x30')](db[_0x409c('0x4e')]['rawAttributes']);_0x183099[_0x409c('0x31')]=_['keys'](_0x441b7b['query']);_0x183099[_0x409c('0x32')]=_['intersection'](_0x183099[_0x409c('0x34')],_0x183099[_0x409c('0x31')]);_0x55f384[_0x409c('0x35')]=_[_0x409c('0x33')](_0x183099[_0x409c('0x34')],qs[_0x409c('0x36')](_0x441b7b[_0x409c('0x31')]['fields']));_0x55f384[_0x409c('0x35')]=_0x55f384[_0x409c('0x35')][_0x409c('0x37')]?_0x55f384['attributes']:_0x183099[_0x409c('0x34')];_0x55f384[_0x409c('0x39')]=qs['sort'](_0x441b7b['query'][_0x409c('0x3a')]);_0x55f384[_0x409c('0x3c')]=qs[_0x409c('0x32')](_['pick'](_0x441b7b[_0x409c('0x31')],_0x183099[_0x409c('0x32')]));if(_0x441b7b[_0x409c('0x31')][_0x409c('0x3b')]){_0x55f384['where']=_[_0x409c('0x3d')](_0x55f384['where'],{'$or':_['map'](_0x55f384['attributes'],function(_0x4b1368){var _0x122e0e={};_0x122e0e[_0x4b1368]={'$like':'%'+_0x441b7b[_0x409c('0x31')]['filter']+'%'};return _0x122e0e;})});}_0x55f384=_[_0x409c('0x3d')]({},_0x55f384,_0x441b7b['options']);return _0x2fae57[_0x409c('0x51')](_0x55f384);}})[_0x409c('0x25')](function(_0x1e317e){if(_0x1e317e){_0x17d7b1=_0x1e317e['length'];if(!_0x441b7b['query'][_0x409c('0x50')](_0x409c('0x38'))){_0x55f384[_0x409c('0x1d')]=qs['limit'](_0x441b7b[_0x409c('0x31')][_0x409c('0x1d')]);_0x55f384['offset']=qs[_0x409c('0x1c')](_0x441b7b[_0x409c('0x31')]['offset']);}return _0x2fae57[_0x409c('0x51')](_0x55f384);}})[_0x409c('0x25')](function(_0x225365){if(_0x225365){return _0x225365?{'count':_0x17d7b1,'rows':_0x225365}:null;}})['then'](respondWithResult(_0x422bde,null))['catch'](handleError(_0x422bde,null));};exports[_0x409c('0x52')]=function(_0x3846e2,_0x1ce66a,_0x31c7b1){var _0x2cd528={};var _0x16827c={};var _0x21a25b;var _0x5eea34;return db[_0x409c('0x2c')][_0x409c('0x4d')]({'where':{'id':_0x3846e2[_0x409c('0x4a')]['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x1ce66a,null))[_0x409c('0x25')](function(_0x605c17){if(_0x605c17){_0x21a25b=_0x605c17;_0x16827c[_0x409c('0x34')]=_[_0x409c('0x30')](db[_0x409c('0x4e')][_0x409c('0x43')]);_0x16827c[_0x409c('0x31')]=_[_0x409c('0x30')](_0x3846e2[_0x409c('0x31')]);_0x16827c['filters']=_[_0x409c('0x33')](_0x16827c[_0x409c('0x34')],_0x16827c[_0x409c('0x31')]);_0x2cd528[_0x409c('0x35')]=_[_0x409c('0x33')](_0x16827c[_0x409c('0x34')],qs['fields'](_0x3846e2[_0x409c('0x31')][_0x409c('0x36')]));_0x2cd528['attributes']=_0x2cd528[_0x409c('0x35')]['length']?_0x2cd528['attributes']:_0x16827c[_0x409c('0x34')];_0x2cd528[_0x409c('0x39')]=qs[_0x409c('0x3a')](_0x3846e2['query'][_0x409c('0x3a')]);_0x2cd528[_0x409c('0x3c')]=qs[_0x409c('0x32')](_[_0x409c('0x4f')](_0x3846e2[_0x409c('0x31')],_0x16827c[_0x409c('0x32')]));if(_0x3846e2[_0x409c('0x31')][_0x409c('0x3b')]){_0x2cd528['where']=_[_0x409c('0x3d')](_0x2cd528[_0x409c('0x3c')],{'$or':_[_0x409c('0x2b')](_0x2cd528[_0x409c('0x35')],function(_0x492dd1){var _0x55e9ec={};_0x55e9ec[_0x492dd1]={'$like':'%'+_0x3846e2[_0x409c('0x31')]['filter']+'%'};return _0x55e9ec;})});}_0x2cd528=_['merge']({},_0x2cd528,_0x3846e2[_0x409c('0x45')]);return _0x21a25b[_0x409c('0x52')](_0x2cd528);}})['then'](function(_0x17f90a){if(_0x17f90a){_0x5eea34=_0x17f90a['length'];if(!_0x3846e2[_0x409c('0x31')][_0x409c('0x50')]('nolimit')){_0x2cd528['limit']=qs[_0x409c('0x1d')](_0x3846e2['query'][_0x409c('0x1d')]);_0x2cd528[_0x409c('0x1c')]=qs[_0x409c('0x1c')](_0x3846e2[_0x409c('0x31')][_0x409c('0x1c')]);}return _0x21a25b[_0x409c('0x52')](_0x2cd528);}})[_0x409c('0x25')](function(_0x2cb8a9){if(_0x2cb8a9){return _0x2cb8a9?{'count':_0x5eea34,'rows':_0x2cb8a9}:null;}})[_0x409c('0x25')](respondWithResult(_0x1ce66a,null))[_0x409c('0x41')](handleError(_0x1ce66a,null));};exports[_0x409c('0x53')]=function(_0x383f13,_0x33ca6f,_0x459dd8){var _0x5a2ca1={};var _0x33cd6e={};var _0x34bedc;var _0x51028c;return db[_0x409c('0x2c')][_0x409c('0x4d')]({'where':{'id':_0x383f13[_0x409c('0x4a')]['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x33ca6f,null))[_0x409c('0x25')](function(_0x481d9b){if(_0x481d9b){_0x34bedc=_0x481d9b;_0x33cd6e[_0x409c('0x34')]=_[_0x409c('0x30')](db[_0x409c('0x54')][_0x409c('0x43')]);_0x33cd6e['query']=_[_0x409c('0x30')](_0x383f13[_0x409c('0x31')]);_0x33cd6e[_0x409c('0x32')]=_['intersection'](_0x33cd6e['model'],_0x33cd6e['query']);_0x5a2ca1['attributes']=_['intersection'](_0x33cd6e[_0x409c('0x34')],qs[_0x409c('0x36')](_0x383f13['query'][_0x409c('0x36')]));_0x5a2ca1['attributes']=_0x5a2ca1[_0x409c('0x35')][_0x409c('0x37')]?_0x5a2ca1['attributes']:_0x33cd6e[_0x409c('0x34')];_0x5a2ca1[_0x409c('0x39')]=qs[_0x409c('0x3a')](_0x383f13[_0x409c('0x31')][_0x409c('0x3a')]);_0x5a2ca1[_0x409c('0x3c')]=qs['filters'](_[_0x409c('0x4f')](_0x383f13[_0x409c('0x31')],_0x33cd6e[_0x409c('0x32')]));if(_0x383f13[_0x409c('0x31')][_0x409c('0x3b')]){_0x5a2ca1[_0x409c('0x3c')]=_[_0x409c('0x3d')](_0x5a2ca1['where'],{'$or':_[_0x409c('0x2b')](_0x5a2ca1[_0x409c('0x35')],function(_0x77fd39){var _0x46b9c0={};_0x46b9c0[_0x77fd39]={'$like':'%'+_0x383f13[_0x409c('0x31')]['filter']+'%'};return _0x46b9c0;})});}_0x5a2ca1=_['merge']({},_0x5a2ca1,_0x383f13['options']);return _0x34bedc[_0x409c('0x53')](_0x5a2ca1);}})[_0x409c('0x25')](function(_0x33d7ea){if(_0x33d7ea){_0x51028c=_0x33d7ea[_0x409c('0x37')];if(!_0x383f13[_0x409c('0x31')][_0x409c('0x50')](_0x409c('0x38'))){_0x5a2ca1[_0x409c('0x1d')]=qs[_0x409c('0x1d')](_0x383f13[_0x409c('0x31')][_0x409c('0x1d')]);_0x5a2ca1[_0x409c('0x1c')]=qs[_0x409c('0x1c')](_0x383f13[_0x409c('0x31')]['offset']);}return _0x34bedc[_0x409c('0x53')](_0x5a2ca1);}})[_0x409c('0x25')](function(_0x51c756){if(_0x51c756){return _0x51c756?{'count':_0x51028c,'rows':_0x51c756}:null;}})[_0x409c('0x25')](respondWithResult(_0x33ca6f,null))[_0x409c('0x41')](handleError(_0x33ca6f,null));};exports[_0x409c('0x55')]=function(_0x2ae857,_0x34dff8,_0x4df84e){if(_0x2ae857['body']['id']){delete _0x2ae857[_0x409c('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x409c('0x4d')]({'where':{'id':_0x2ae857['params']['id']}})[_0x409c('0x25')](handleEntityNotFound(_0x34dff8,null))[_0x409c('0x25')](function(_0x3488fd){if(_0x3488fd){return _0x3488fd[_0x409c('0x55')](_0x2ae857[_0x409c('0x48')][_0x409c('0x56')]||[]);}return null;})[_0x409c('0x25')](respondWithResult(_0x34dff8,null))['catch'](handleError(_0x34dff8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2cb33e7..82315ef 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 _0xcba3=['rimraf','../../config/environment','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird','request-promise','path'];(function(_0x726a6b,_0x43cb31){var _0x51733d=function(_0x22fdc5){while(--_0x22fdc5){_0x726a6b['push'](_0x726a6b['shift']());}};_0x51733d(++_0x43cb31);}(_0xcba3,0xb8));var _0x3cba=function(_0x574b5d,_0x517954){_0x574b5d=_0x574b5d-0x0;var _0x1dc2c9=_0xcba3[_0x574b5d];return _0x1dc2c9;};'use strict';var _=require(_0x3cba('0x0'));var util=require(_0x3cba('0x1'));var logger=require('../../config/logger')(_0x3cba('0x2'));var moment=require('moment');var BPromise=require(_0x3cba('0x3'));var rp=require(_0x3cba('0x4'));var fs=require('fs');var path=require(_0x3cba('0x5'));var rimraf=require(_0x3cba('0x6'));var config=require(_0x3cba('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x310834,_0x3c5b07){return _0x310834['define'](_0x3cba('0x8'),attributes,{'tableName':_0x3cba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7560=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x286c49,_0x2ee022){var _0x4673a3=function(_0x10e819){while(--_0x10e819){_0x286c49['push'](_0x286c49['shift']());}};_0x4673a3(++_0x2ee022);}(_0x7560,0x16c));var _0x0756=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x7560[_0x338338];return _0x3cf852;};'use strict';var _=require(_0x0756('0x0'));var util=require('util');var logger=require(_0x0756('0x1'))(_0x0756('0x2'));var moment=require(_0x0756('0x3'));var BPromise=require(_0x0756('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0756('0x5'));var rimraf=require('rimraf');var config=require(_0x0756('0x6'));var attributes=require(_0x0756('0x7'));module[_0x0756('0x8')]=function(_0x409d59,_0x6499b){return _0x409d59[_0x0756('0x9')](_0x0756('0xa'),attributes,{'tableName':_0x0756('0xb'),'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 6385c1c..569d0fb 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 _0x7a71=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x8a4f9f,_0x12b10f){var _0x5a5710=function(_0x1501b4){while(--_0x1501b4){_0x8a4f9f['push'](_0x8a4f9f['shift']());}};_0x5a5710(++_0x12b10f);}(_0x7a71,0xc7));var _0x17a7=function(_0xeb79bb,_0x5683a7){_0xeb79bb=_0xeb79bb-0x0;var _0x5c509e=_0x7a71[_0xeb79bb];return _0x5c509e;};'use strict';var _=require('lodash');var util=require(_0x17a7('0x0'));var moment=require(_0x17a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x17a7('0x2'));var fs=require('fs');var Redis=require(_0x17a7('0x3'));var db=require(_0x17a7('0x4'))['db'];var utils=require(_0x17a7('0x5'));var logger=require(_0x17a7('0x6'))(_0x17a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x17a7('0x8'));var client=jayson[_0x17a7('0x9')][_0x17a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x887972,_0x507d2c,_0x123ba4){return new BPromise(function(_0x4956d5,_0x5f01c5){return client[_0x17a7('0xb')](_0x887972,_0x123ba4)[_0x17a7('0xc')](function(_0x26994b){logger[_0x17a7('0xd')](_0x17a7('0xe'),_0x507d2c,'request\x20sent');logger[_0x17a7('0xf')](_0x17a7('0x10'),_0x507d2c,_0x17a7('0x11'),JSON[_0x17a7('0x12')](_0x26994b));if(_0x26994b[_0x17a7('0x13')]){if(_0x26994b['error']['code']===0x1f4){logger[_0x17a7('0x13')](_0x17a7('0xe'),_0x507d2c,_0x26994b[_0x17a7('0x13')][_0x17a7('0x14')]);return _0x5f01c5(_0x26994b[_0x17a7('0x13')][_0x17a7('0x14')]);}logger[_0x17a7('0x13')](_0x17a7('0xe'),_0x507d2c,_0x26994b['error'][_0x17a7('0x14')]);return _0x4956d5(_0x26994b['error'][_0x17a7('0x14')]);}else{logger[_0x17a7('0xd')](_0x17a7('0xe'),_0x507d2c,_0x17a7('0x11'));_0x4956d5(_0x26994b['result']['message']);}})['catch'](function(_0x4178ef){logger[_0x17a7('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x507d2c,_0x4178ef);_0x5f01c5(_0x4178ef);});});} \ No newline at end of file +var _0x3305=['../../config/logger','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x3305,0x1f3));var _0x5330=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3305[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x5330('0x0'));var moment=require(_0x5330('0x1'));var BPromise=require(_0x5330('0x2'));var rs=require(_0x5330('0x3'));var fs=require('fs');var Redis=require(_0x5330('0x4'));var db=require(_0x5330('0x5'))['db'];var utils=require(_0x5330('0x6'));var logger=require(_0x5330('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5330('0x8'));var client=jayson['client'][_0x5330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d165b,_0xf6b965,_0x2a1935){return new BPromise(function(_0x5eb98e,_0x45e61d){return client[_0x5330('0xa')](_0x2d165b,_0x2a1935)[_0x5330('0xb')](function(_0x1cf88a){logger[_0x5330('0xc')](_0x5330('0xd'),_0xf6b965,_0x5330('0xe'));logger[_0x5330('0xf')](_0x5330('0x10'),_0xf6b965,_0x5330('0xe'),JSON[_0x5330('0x11')](_0x1cf88a));if(_0x1cf88a[_0x5330('0x12')]){if(_0x1cf88a[_0x5330('0x12')][_0x5330('0x13')]===0x1f4){logger['error'](_0x5330('0xd'),_0xf6b965,_0x1cf88a[_0x5330('0x12')][_0x5330('0x14')]);return _0x45e61d(_0x1cf88a['error'][_0x5330('0x14')]);}logger[_0x5330('0x12')](_0x5330('0xd'),_0xf6b965,_0x1cf88a[_0x5330('0x12')][_0x5330('0x14')]);return _0x5eb98e(_0x1cf88a['error'][_0x5330('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0xf6b965,_0x5330('0xe'));_0x5eb98e(_0x1cf88a[_0x5330('0x15')]['message']);}})['catch'](function(_0x45e169){logger['error'](_0x5330('0xd'),_0xf6b965,_0x45e169);_0x45e61d(_0x45e169);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0b72be4..26277d2 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 _0xa37c=['isAuthenticated','index','/:id','show','post','delete','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xa37c,0x1ab));var _0xca37=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xa37c[_0x476c7];return _0x47ae56;};'use strict';var multer=require(_0xca37('0x0'));var util=require(_0xca37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca37('0x2')]();var fs_extra=require(_0xca37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xca37('0x4'));var config=require(_0xca37('0x5'));var controller=require(_0xca37('0x6'));router[_0xca37('0x7')]('/',auth[_0xca37('0x8')](),controller[_0xca37('0x9')]);router['get'](_0xca37('0xa'),auth['isAuthenticated'](),controller[_0xca37('0xb')]);router[_0xca37('0xc')]('/',auth[_0xca37('0x8')](),controller['create']);router['put'](_0xca37('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xca37('0xd')]('/:id',auth[_0xca37('0x8')](),controller['destroy']);module[_0xca37('0xe')]=router; \ No newline at end of file +var _0xe070=['get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0xe070,0x102));var _0x0e07=function(_0x5d2c6a,_0x196724){_0x5d2c6a=_0x5d2c6a-0x0;var _0x4420af=_0xe070[_0x5d2c6a];return _0x4420af;};'use strict';var multer=require(_0x0e07('0x0'));var util=require(_0x0e07('0x1'));var path=require('path');var timeout=require(_0x0e07('0x2'));var express=require(_0x0e07('0x3'));var router=express[_0x0e07('0x4')]();var fs_extra=require(_0x0e07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e07('0x6'));var config=require(_0x0e07('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x0e07('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e07('0x9')]);router[_0x0e07('0x8')](_0x0e07('0xa'),auth['isAuthenticated'](),controller[_0x0e07('0xb')]);router[_0x0e07('0xc')]('/',auth[_0x0e07('0xd')](),controller[_0x0e07('0xe')]);router['put'](_0x0e07('0xa'),auth[_0x0e07('0xd')](),controller[_0x0e07('0xf')]);router[_0x0e07('0x10')](_0x0e07('0xa'),auth[_0x0e07('0xd')](),controller[_0x0e07('0x11')]);module[_0x0e07('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 71d6776..5dd29a3 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 _0x4b4c=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x4b4c,0x76));var _0xc4b4=function(_0x6e7593,_0xd331aa){_0x6e7593=_0x6e7593-0x0;var _0x1da0b5=_0x4b4c[_0x6e7593];return _0x1da0b5;};'use strict';var Sequelize=require(_0xc4b4('0x0'));module[_0xc4b4('0x1')]={'type':{'type':Sequelize[_0xc4b4('0x2')](_0xc4b4('0x3'),_0xc4b4('0x4'),_0xc4b4('0x5'),_0xc4b4('0x6'),_0xc4b4('0x7')),'defaultValue':_0xc4b4('0x3')},'content':{'type':Sequelize[_0xc4b4('0x8')]},'key':{'type':Sequelize[_0xc4b4('0x8')]},'keyType':{'type':Sequelize[_0xc4b4('0x2')](_0xc4b4('0x3'),_0xc4b4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc4b4('0x8')]},'idField':{'type':Sequelize[_0xc4b4('0x8')]},'nameField':{'type':Sequelize[_0xc4b4('0x8')]},'customField':{'type':Sequelize[_0xc4b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4b4('0x8')]}}; \ No newline at end of file +var _0x4375=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2b4982,_0x25cfd9){var _0x56b6ed=function(_0x4738d4){while(--_0x4738d4){_0x2b4982['push'](_0x2b4982['shift']());}};_0x56b6ed(++_0x25cfd9);}(_0x4375,0x1dc));var _0x5437=function(_0x5ed6da,_0x2dc012){_0x5ed6da=_0x5ed6da-0x0;var _0x2d2d15=_0x4375[_0x5ed6da];return _0x2d2d15;};'use strict';var Sequelize=require(_0x5437('0x0'));module[_0x5437('0x1')]={'type':{'type':Sequelize[_0x5437('0x2')](_0x5437('0x3'),_0x5437('0x4'),_0x5437('0x5'),_0x5437('0x6'),_0x5437('0x7')),'defaultValue':_0x5437('0x3')},'content':{'type':Sequelize[_0x5437('0x8')]},'key':{'type':Sequelize[_0x5437('0x8')]},'keyType':{'type':Sequelize[_0x5437('0x2')](_0x5437('0x3'),_0x5437('0x4'),_0x5437('0x5'))},'keyContent':{'type':Sequelize[_0x5437('0x8')]},'idField':{'type':Sequelize[_0x5437('0x8')]},'nameField':{'type':Sequelize[_0x5437('0x8')]},'customField':{'type':Sequelize[_0x5437('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5437('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2b1481f..5a55f74 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 _0x7d98=['pick','filter','merge','where','include','FreshdeskField','findAll','rows','show','rawAttributes','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x7d98,0xe7));var _0x87d9=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x7d98[_0x128bef];return _0x1ba862;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['index']=function(_0x21916a,_0x3c0283){var _0x501c5={},_0x5e1b55={},_0x1d04a9={'count':0x0,'rows':[]};var _0x22a401=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x31122b){return{'name':_0x31122b[_0x87d9('0x2a')],'type':_0x31122b['type'][_0x87d9('0x2b')]};});_0x5e1b55['model']=_[_0x87d9('0x2c')](_0x22a401,'name');_0x5e1b55[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2f')]=_['intersection'](_0x5e1b55[_0x87d9('0x30')],_0x5e1b55[_0x87d9('0x2d')]);_0x501c5[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x5e1b55[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x21916a['query'][_0x87d9('0x33')]));_0x501c5[_0x87d9('0x31')]=_0x501c5[_0x87d9('0x31')][_0x87d9('0x34')]?_0x501c5[_0x87d9('0x31')]:_0x5e1b55[_0x87d9('0x30')];if(!_0x21916a[_0x87d9('0x2d')][_0x87d9('0x35')](_0x87d9('0x36'))){_0x501c5['limit']=qs[_0x87d9('0x1d')](_0x21916a[_0x87d9('0x2d')][_0x87d9('0x1d')]);_0x501c5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x21916a['query'][_0x87d9('0x1f')]);}_0x501c5[_0x87d9('0x37')]=qs[_0x87d9('0x38')](_0x21916a['query'][_0x87d9('0x38')]);_0x501c5['where']=qs[_0x87d9('0x2f')](_[_0x87d9('0x39')](_0x21916a[_0x87d9('0x2d')],_0x5e1b55[_0x87d9('0x2f')]),_0x22a401);if(_0x21916a['query'][_0x87d9('0x3a')]){_0x501c5['where']=_[_0x87d9('0x3b')](_0x501c5[_0x87d9('0x3c')],{'$or':_[_0x87d9('0x2c')](_0x22a401,function(_0x1af8eb){if(_0x1af8eb['type']!=='VIRTUAL'){var _0x2063de={};_0x2063de[_0x1af8eb['name']]={'$like':'%'+_0x21916a[_0x87d9('0x2d')]['filter']+'%'};return _0x2063de;}})});}_0x501c5=_[_0x87d9('0x3b')]({},_0x501c5,_0x21916a['options']);var _0xdf56e8={'where':_0x501c5[_0x87d9('0x3c')]};return db['FreshdeskField'][_0x87d9('0x1e')](_0xdf56e8)['then'](function(_0x4bc1ba){_0x1d04a9['count']=_0x4bc1ba;if(_0x21916a[_0x87d9('0x2d')]['includeAll']){_0x501c5[_0x87d9('0x3d')]=[{'all':!![]}];}return db[_0x87d9('0x3e')][_0x87d9('0x3f')](_0x501c5);})['then'](function(_0x915f05){_0x1d04a9[_0x87d9('0x40')]=_0x915f05;return _0x1d04a9;})[_0x87d9('0x25')](respondWithFilteredResult(_0x3c0283,_0x501c5))['catch'](handleError(_0x3c0283,null));};exports[_0x87d9('0x41')]=function(_0x58ec85,_0x5c2db5){var _0x59338e={'raw':!![],'where':{'id':_0x58ec85['params']['id']}},_0x39e807={};_0x39e807['model']=_[_0x87d9('0x2e')](db[_0x87d9('0x3e')][_0x87d9('0x42')]);_0x39e807[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x58ec85['query']);_0x39e807[_0x87d9('0x2f')]=_[_0x87d9('0x32')](_0x39e807['model'],_0x39e807['query']);_0x59338e[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x39e807[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x58ec85[_0x87d9('0x2d')][_0x87d9('0x33')]));_0x59338e[_0x87d9('0x31')]=_0x59338e[_0x87d9('0x31')]['length']?_0x59338e[_0x87d9('0x31')]:_0x39e807[_0x87d9('0x30')];if(_0x58ec85['query']['includeAll']){_0x59338e[_0x87d9('0x3d')]=[{'all':!![]}];}_0x59338e=_[_0x87d9('0x3b')]({},_0x59338e,_0x58ec85['options']);return db[_0x87d9('0x3e')]['find'](_0x59338e)['then'](handleEntityNotFound(_0x5c2db5,null))['then'](respondWithResult(_0x5c2db5,null))['catch'](handleError(_0x5c2db5,null));};exports[_0x87d9('0x43')]=function(_0x101446,_0x533a74){return db[_0x87d9('0x3e')][_0x87d9('0x43')](_0x101446[_0x87d9('0x44')],{})['then'](respondWithResult(_0x533a74,0xc9))[_0x87d9('0x45')](handleError(_0x533a74,null));};exports[_0x87d9('0x24')]=function(_0x2d4766,_0x384273){if(_0x2d4766[_0x87d9('0x44')]['id']){delete _0x2d4766[_0x87d9('0x44')]['id'];}return db['FreshdeskField'][_0x87d9('0x46')]({'where':{'id':_0x2d4766['params']['id']}})['then'](handleEntityNotFound(_0x384273,null))[_0x87d9('0x25')](saveUpdates(_0x2d4766[_0x87d9('0x44')],null))[_0x87d9('0x25')](respondWithResult(_0x384273,null))[_0x87d9('0x45')](handleError(_0x384273,null));};exports[_0x87d9('0x26')]=function(_0x4fdfa9,_0x4558f5){return db[_0x87d9('0x3e')][_0x87d9('0x46')]({'where':{'id':_0x4fdfa9[_0x87d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4558f5,null))[_0x87d9('0x25')](removeEntity(_0x4558f5,null))[_0x87d9('0x45')](handleError(_0x4558f5,null));}; \ No newline at end of file +var _0x4e81=['../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xf76ad5,_0x3e9729){var _0x3bd623=function(_0x3697c5){while(--_0x3697c5){_0xf76ad5['push'](_0xf76ad5['shift']());}};_0x3bd623(++_0x3e9729);}(_0x4e81,0x1bc));var _0x14e8=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x4e81[_0x5e4b85];return _0x5cd3cb;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x25')]();});}};}function handleEntityNotFound(_0x3eae0b,_0x20bfe8){return function(_0x333d44){if(!_0x333d44){_0x3eae0b['sendStatus'](0x194);}return _0x333d44;};}function handleError(_0x23a9dc,_0x3fd96d){_0x3fd96d=_0x3fd96d||0x1f4;return function(_0x3c09cb){logger[_0x14e8('0x26')](_0x3c09cb[_0x14e8('0x27')]);if(_0x3c09cb[_0x14e8('0x28')]){delete _0x3c09cb[_0x14e8('0x28')];}_0x23a9dc['status'](_0x3fd96d)[_0x14e8('0x29')](_0x3c09cb);};}exports[_0x14e8('0x2a')]=function(_0x393ab0,_0x5f5abb){var _0x48eed0={},_0x5cacd7={},_0x8fe0e2={'count':0x0,'rows':[]};var _0x2a408d=_['map'](db[_0x14e8('0x2b')][_0x14e8('0x2c')],function(_0x176e8f){return{'name':_0x176e8f[_0x14e8('0x2d')],'type':_0x176e8f['type'][_0x14e8('0x2e')]};});_0x5cacd7[_0x14e8('0x2f')]=_[_0x14e8('0x30')](_0x2a408d,_0x14e8('0x28'));_0x5cacd7[_0x14e8('0x31')]=_['keys'](_0x393ab0[_0x14e8('0x31')]);_0x5cacd7[_0x14e8('0x32')]=_[_0x14e8('0x33')](_0x5cacd7[_0x14e8('0x2f')],_0x5cacd7['query']);_0x48eed0[_0x14e8('0x34')]=_['intersection'](_0x5cacd7[_0x14e8('0x2f')],qs[_0x14e8('0x35')](_0x393ab0[_0x14e8('0x31')][_0x14e8('0x35')]));_0x48eed0[_0x14e8('0x34')]=_0x48eed0[_0x14e8('0x34')][_0x14e8('0x36')]?_0x48eed0[_0x14e8('0x34')]:_0x5cacd7[_0x14e8('0x2f')];if(!_0x393ab0[_0x14e8('0x31')][_0x14e8('0x37')](_0x14e8('0x38'))){_0x48eed0['limit']=qs['limit'](_0x393ab0['query'][_0x14e8('0x1e')]);_0x48eed0['offset']=qs[_0x14e8('0x1c')](_0x393ab0['query'][_0x14e8('0x1c')]);}_0x48eed0[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x393ab0[_0x14e8('0x31')]['sort']);_0x48eed0[_0x14e8('0x3b')]=qs['filters'](_[_0x14e8('0x3c')](_0x393ab0[_0x14e8('0x31')],_0x5cacd7[_0x14e8('0x32')]),_0x2a408d);if(_0x393ab0[_0x14e8('0x31')][_0x14e8('0x3d')]){_0x48eed0[_0x14e8('0x3b')]=_['merge'](_0x48eed0[_0x14e8('0x3b')],{'$or':_['map'](_0x2a408d,function(_0x30baf1){if(_0x30baf1[_0x14e8('0x3e')]!==_0x14e8('0x3f')){var _0x4cafe6={};_0x4cafe6[_0x30baf1[_0x14e8('0x28')]]={'$like':'%'+_0x393ab0[_0x14e8('0x31')]['filter']+'%'};return _0x4cafe6;}})});}_0x48eed0=_[_0x14e8('0x40')]({},_0x48eed0,_0x393ab0[_0x14e8('0x41')]);var _0x1f429a={'where':_0x48eed0[_0x14e8('0x3b')]};return db[_0x14e8('0x2b')][_0x14e8('0x1f')](_0x1f429a)[_0x14e8('0x24')](function(_0x38ec58){_0x8fe0e2[_0x14e8('0x1f')]=_0x38ec58;if(_0x393ab0[_0x14e8('0x31')][_0x14e8('0x42')]){_0x48eed0[_0x14e8('0x43')]=[{'all':!![]}];}return db[_0x14e8('0x2b')][_0x14e8('0x44')](_0x48eed0);})[_0x14e8('0x24')](function(_0x596ac7){_0x8fe0e2[_0x14e8('0x45')]=_0x596ac7;return _0x8fe0e2;})['then'](respondWithFilteredResult(_0x5f5abb,_0x48eed0))['catch'](handleError(_0x5f5abb,null));};exports['show']=function(_0x3d2d95,_0x5ed821){var _0x46a3c4={'raw':!![],'where':{'id':_0x3d2d95[_0x14e8('0x46')]['id']}},_0x45bff0={};_0x45bff0[_0x14e8('0x2f')]=_[_0x14e8('0x47')](db[_0x14e8('0x2b')][_0x14e8('0x2c')]);_0x45bff0[_0x14e8('0x31')]=_[_0x14e8('0x47')](_0x3d2d95[_0x14e8('0x31')]);_0x45bff0[_0x14e8('0x32')]=_['intersection'](_0x45bff0[_0x14e8('0x2f')],_0x45bff0[_0x14e8('0x31')]);_0x46a3c4[_0x14e8('0x34')]=_[_0x14e8('0x33')](_0x45bff0['model'],qs[_0x14e8('0x35')](_0x3d2d95[_0x14e8('0x31')]['fields']));_0x46a3c4['attributes']=_0x46a3c4[_0x14e8('0x34')]['length']?_0x46a3c4['attributes']:_0x45bff0[_0x14e8('0x2f')];if(_0x3d2d95[_0x14e8('0x31')]['includeAll']){_0x46a3c4[_0x14e8('0x43')]=[{'all':!![]}];}_0x46a3c4=_[_0x14e8('0x40')]({},_0x46a3c4,_0x3d2d95['options']);return db[_0x14e8('0x2b')][_0x14e8('0x48')](_0x46a3c4)[_0x14e8('0x24')](handleEntityNotFound(_0x5ed821,null))[_0x14e8('0x24')](respondWithResult(_0x5ed821,null))[_0x14e8('0x49')](handleError(_0x5ed821,null));};exports[_0x14e8('0x4a')]=function(_0x343529,_0x2541ad){return db[_0x14e8('0x2b')][_0x14e8('0x4a')](_0x343529[_0x14e8('0x4b')],{})[_0x14e8('0x24')](respondWithResult(_0x2541ad,0xc9))[_0x14e8('0x49')](handleError(_0x2541ad,null));};exports[_0x14e8('0x4c')]=function(_0x1bf742,_0x1f50bc){if(_0x1bf742['body']['id']){delete _0x1bf742[_0x14e8('0x4b')]['id'];}return db['FreshdeskField'][_0x14e8('0x48')]({'where':{'id':_0x1bf742[_0x14e8('0x46')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x1f50bc,null))[_0x14e8('0x24')](saveUpdates(_0x1bf742['body'],null))['then'](respondWithResult(_0x1f50bc,null))['catch'](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4d')]=function(_0x49657e,_0x55f9b0){return db[_0x14e8('0x2b')][_0x14e8('0x48')]({'where':{'id':_0x49657e['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x55f9b0,null))[_0x14e8('0x24')](removeEntity(_0x55f9b0,null))[_0x14e8('0x49')](handleError(_0x55f9b0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4016a04..1ec0790 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 _0xbfc9=['./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x295f38,_0x227ab8){var _0x4690f1=function(_0x4e85c7){while(--_0x4e85c7){_0x295f38['push'](_0x295f38['shift']());}};_0x4690f1(++_0x227ab8);}(_0xbfc9,0x173));var _0x9bfc=function(_0x582551,_0xd79827){_0x582551=_0x582551-0x0;var _0x2dd835=_0xbfc9[_0x582551];return _0x2dd835;};'use strict';var _=require(_0x9bfc('0x0'));var util=require(_0x9bfc('0x1'));var logger=require('../../config/logger')(_0x9bfc('0x2'));var moment=require('moment');var BPromise=require(_0x9bfc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bfc('0x4'));var rimraf=require(_0x9bfc('0x5'));var config=require(_0x9bfc('0x6'));var attributes=require(_0x9bfc('0x7'));module['exports']=function(_0x34b4ab,_0x277959){return _0x34b4ab[_0x9bfc('0x8')](_0x9bfc('0x9'),attributes,{'tableName':_0x9bfc('0xa'),'paranoid':![],'indexes':[{'name':_0x9bfc('0xb'),'fields':[_0x9bfc('0xc'),_0x9bfc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a5e=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x117995,_0x1da2de){var _0xe1574d=function(_0x3fb9ca){while(--_0x3fb9ca){_0x117995['push'](_0x117995['shift']());}};_0xe1574d(++_0x1da2de);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x333515,_0x2b0d8f){_0x333515=_0x333515-0x0;var _0x77373d=_0x3a5e[_0x333515];return _0x77373d;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var logger=require(_0xe3a5('0x2'))(_0xe3a5('0x3'));var moment=require(_0xe3a5('0x4'));var BPromise=require(_0xe3a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a5('0x6'));var rimraf=require(_0xe3a5('0x7'));var config=require(_0xe3a5('0x8'));var attributes=require(_0xe3a5('0x9'));module[_0xe3a5('0xa')]=function(_0x499f61,_0x5e1507){return _0x499f61[_0xe3a5('0xb')]('FreshdeskField',attributes,{'tableName':_0xe3a5('0xc'),'paranoid':![],'indexes':[{'name':_0xe3a5('0xd'),'fields':[_0xe3a5('0xe'),_0xe3a5('0xf')],'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 def19ea..ecd1191 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 _0x64d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','util','moment'];(function(_0x5cb5e6,_0x46722c){var _0x1093ac=function(_0x5e830d){while(--_0x5e830d){_0x5cb5e6['push'](_0x5cb5e6['shift']());}};_0x1093ac(++_0x46722c);}(_0x64d7,0x91));var _0x764d=function(_0x2610f9,_0x531c0b){_0x2610f9=_0x2610f9-0x0;var _0x553bc1=_0x64d7[_0x2610f9];return _0x553bc1;};'use strict';var _=require('lodash');var util=require(_0x764d('0x0'));var moment=require(_0x764d('0x1'));var BPromise=require(_0x764d('0x2'));var rs=require(_0x764d('0x3'));var fs=require('fs');var Redis=require(_0x764d('0x4'));var db=require(_0x764d('0x5'))['db'];var utils=require(_0x764d('0x6'));var logger=require(_0x764d('0x7'))(_0x764d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x764d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b989d,_0x40fe04,_0x3b5822){return new BPromise(function(_0x2a6bd8,_0x5cbee3){return client[_0x764d('0xa')](_0x3b989d,_0x3b5822)[_0x764d('0xb')](function(_0x3cb7db){logger['info'](_0x764d('0xc'),_0x40fe04,'request\x20sent');logger[_0x764d('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x40fe04,_0x764d('0xe'),JSON[_0x764d('0xf')](_0x3cb7db));if(_0x3cb7db['error']){if(_0x3cb7db[_0x764d('0x10')][_0x764d('0x11')]===0x1f4){logger[_0x764d('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x40fe04,_0x3cb7db[_0x764d('0x10')]['message']);return _0x5cbee3(_0x3cb7db[_0x764d('0x10')][_0x764d('0x12')]);}logger[_0x764d('0x10')](_0x764d('0xc'),_0x40fe04,_0x3cb7db[_0x764d('0x10')]['message']);return _0x2a6bd8(_0x3cb7db['error'][_0x764d('0x12')]);}else{logger[_0x764d('0x13')](_0x764d('0xc'),_0x40fe04,_0x764d('0xe'));_0x2a6bd8(_0x3cb7db['result']['message']);}})[_0x764d('0x14')](function(_0x59e1bf){logger[_0x764d('0x10')](_0x764d('0xc'),_0x40fe04,_0x59e1bf);_0x5cbee3(_0x59e1bf);});});} \ No newline at end of file +var _0xd5c9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd5c9,0x175));var _0x9d5c=function(_0x3aeabb,_0x269c71){_0x3aeabb=_0x3aeabb-0x0;var _0x20669b=_0xd5c9[_0x3aeabb];return _0x20669b;};'use strict';var _=require(_0x9d5c('0x0'));var util=require(_0x9d5c('0x1'));var moment=require(_0x9d5c('0x2'));var BPromise=require(_0x9d5c('0x3'));var rs=require(_0x9d5c('0x4'));var fs=require('fs');var Redis=require(_0x9d5c('0x5'));var db=require(_0x9d5c('0x6'))['db'];var utils=require(_0x9d5c('0x7'));var logger=require(_0x9d5c('0x8'))(_0x9d5c('0x9'));var config=require(_0x9d5c('0xa'));var jayson=require(_0x9d5c('0xb'));var client=jayson['client'][_0x9d5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310cf1,_0xc99dcd,_0x300ee8){return new BPromise(function(_0x4df00e,_0x193581){return client['request'](_0x310cf1,_0x300ee8)[_0x9d5c('0xd')](function(_0x4f56c3){logger[_0x9d5c('0xe')]('FreshdeskField,\x20%s,\x20%s',_0xc99dcd,_0x9d5c('0xf'));logger[_0x9d5c('0x10')](_0x9d5c('0x11'),_0xc99dcd,_0x9d5c('0xf'),JSON[_0x9d5c('0x12')](_0x4f56c3));if(_0x4f56c3[_0x9d5c('0x13')]){if(_0x4f56c3[_0x9d5c('0x13')][_0x9d5c('0x14')]===0x1f4){logger[_0x9d5c('0x13')]('FreshdeskField,\x20%s,\x20%s',_0xc99dcd,_0x4f56c3[_0x9d5c('0x13')]['message']);return _0x193581(_0x4f56c3[_0x9d5c('0x13')][_0x9d5c('0x15')]);}logger['error'](_0x9d5c('0x16'),_0xc99dcd,_0x4f56c3['error'][_0x9d5c('0x15')]);return _0x4df00e(_0x4f56c3[_0x9d5c('0x13')][_0x9d5c('0x15')]);}else{logger[_0x9d5c('0xe')](_0x9d5c('0x16'),_0xc99dcd,_0x9d5c('0xf'));_0x4df00e(_0x4f56c3[_0x9d5c('0x17')][_0x9d5c('0x15')]);}})[_0x9d5c('0x18')](function(_0x2b5f40){logger[_0x9d5c('0x13')](_0x9d5c('0x16'),_0xc99dcd,_0x2b5f40);_0x193581(_0x2b5f40);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 24d9d55..94e7e55 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 _0xae60=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x172648,_0x556f98){var _0x42d1fd=function(_0x32e554){while(--_0x32e554){_0x172648['push'](_0x172648['shift']());}};_0x42d1fd(++_0x556f98);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xae60[_0x2f45ea];return _0x485a84;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id/configurations',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x10')](_0x0ae6('0x12'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x16')](_0x0ae6('0xb'),auth['isAuthenticated'](),controller[_0x0ae6('0x17')]);module[_0x0ae6('0x18')]=router; \ No newline at end of file +var _0xf290=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x13bdbc,_0x5bb6b7){var _0x6ab3a2=function(_0x14a61a){while(--_0x14a61a){_0x13bdbc['push'](_0x13bdbc['shift']());}};_0x6ab3a2(++_0x5bb6b7);}(_0xf290,0xde));var _0x0f29=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xf290[_0x102b0c];return _0x9b15ca;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),controller['create']);router[_0x0f29('0x10')]('/:id/configurations',auth[_0x0f29('0xa')](),controller[_0x0f29('0x11')]);router[_0x0f29('0x12')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x13')]);router['delete'](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);module[_0x0f29('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 88a29dd..758d7a0 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 _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x42d58a,_0x4b8f7a){var _0x129e6a=function(_0x2f74ab){while(--_0x2f74ab){_0x42d58a['push'](_0x42d58a['shift']());}};_0x129e6a(++_0x4b8f7a);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6343=['STRING','remoteUri'];(function(_0x555105,_0x577248){var _0x39c589=function(_0x16aeef){while(--_0x16aeef){_0x555105['push'](_0x555105['shift']());}};_0x39c589(++_0x577248);}(_0x6343,0x168));var _0x3634=function(_0x55c622,_0x40b5cb){_0x55c622=_0x55c622-0x0;var _0x2bfaf2=_0x6343[_0x55c622];return _0x2bfaf2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3634('0x0')]},'description':{'type':Sequelize[_0x3634('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3634('0x1')},'serverUrl':{'type':Sequelize[_0x3634('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 565bc4c..535cc90 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 _0x21f4=['zip-dir','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FreshsalesAccount','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','FreshsalesConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','username','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x21f4,0x1ea));var _0x421f=function(_0x1abeba,_0x51ff94){_0x1abeba=_0x1abeba-0x0;var _0x53684c=_0x21f4[_0x1abeba];return _0x53684c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x421f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x421f('0x1'));var Mustache=require(_0x421f('0x2'));var util=require(_0x421f('0x3'));var path=require(_0x421f('0x4'));var sox=require(_0x421f('0x5'));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(_0x421f('0x6'));var crypto=require(_0x421f('0x7'));var jsforce=require(_0x421f('0x8'));var deskjs=require(_0x421f('0x9'));var toCsv=require('to-csv');var querystring=require(_0x421f('0xa'));var Papa=require(_0x421f('0xb'));var Redis=require(_0x421f('0xc'));var authService=require(_0x421f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x421f('0xe'));var hardwareService=require(_0x421f('0xf'));var logger=require(_0x421f('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x421f('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0x421f('0x12'));function respondWithStatusCode(_0x336c2f,_0x502344){_0x502344=_0x502344||0xcc;return function(_0x714ea5){if(_0x714ea5){return _0x336c2f[_0x421f('0x13')](_0x502344);}return _0x336c2f[_0x421f('0x14')](_0x502344)[_0x421f('0x15')]();};}function respondWithResult(_0x24ba92,_0x3b83e9){_0x3b83e9=_0x3b83e9||0xc8;return function(_0x3193e7){if(_0x3193e7){return _0x24ba92[_0x421f('0x14')](_0x3b83e9)['json'](_0x3193e7);}};}function respondWithFilteredResult(_0x55f1e7,_0xf0ded2){return function(_0x1fcaf0){if(_0x1fcaf0){var _0x5707fe=typeof _0xf0ded2[_0x421f('0x16')]==='undefined'&&typeof _0xf0ded2['limit']===_0x421f('0x17');var _0x597ffc=_0x1fcaf0[_0x421f('0x18')];var _0xd574f8=_0x5707fe?0x0:_0xf0ded2[_0x421f('0x16')];var _0x438da6=_0x5707fe?_0x1fcaf0[_0x421f('0x18')]:_0xf0ded2[_0x421f('0x16')]+_0xf0ded2[_0x421f('0x19')];var _0x464ce9;if(_0x438da6>=_0x597ffc){_0x438da6=_0x597ffc;_0x464ce9=0xc8;}else{_0x464ce9=0xce;}_0x55f1e7['status'](_0x464ce9);return _0x55f1e7[_0x421f('0x1a')](_0x421f('0x1b'),_0xd574f8+'-'+_0x438da6+'/'+_0x597ffc)[_0x421f('0x1c')](_0x1fcaf0);}return null;};}function patchUpdates(_0x2a1aea){return function(_0x51face){try{jsonpatch[_0x421f('0x1d')](_0x51face,_0x2a1aea,!![]);}catch(_0x383894){return BPromise[_0x421f('0x1e')](_0x383894);}return _0x51face['save']();};}function saveUpdates(_0xdb614d,_0x1174fe){return function(_0x2dde49){if(_0x2dde49){return _0x2dde49[_0x421f('0x1f')](_0xdb614d)['then'](function(_0x44b4d7){return _0x44b4d7;});}return null;};}function removeEntity(_0x531d5e,_0x11d3ed){return function(_0xa8b81f){if(_0xa8b81f){return _0xa8b81f[_0x421f('0x20')]()['then'](function(){_0x531d5e['status'](0xcc)[_0x421f('0x15')]();});}};}function handleEntityNotFound(_0x2ddf54,_0x249bed){return function(_0x3215be){if(!_0x3215be){_0x2ddf54[_0x421f('0x13')](0x194);}return _0x3215be;};}function handleError(_0x3ec19f,_0x4698ed){_0x4698ed=_0x4698ed||0x1f4;return function(_0x239649){logger[_0x421f('0x21')](_0x239649[_0x421f('0x22')]);if(_0x239649['name']){delete _0x239649[_0x421f('0x23')];}_0x3ec19f[_0x421f('0x14')](_0x4698ed)[_0x421f('0x24')](_0x239649);};}exports['index']=function(_0x325f8c,_0x1ef133){var _0x37ab04={},_0xcee760={},_0x24063f={'count':0x0,'rows':[]};var _0x2abe42=_[_0x421f('0x25')](db['FreshsalesAccount']['rawAttributes'],function(_0x3e1860){return{'name':_0x3e1860[_0x421f('0x26')],'type':_0x3e1860[_0x421f('0x27')][_0x421f('0x28')]};});_0xcee760['model']=_[_0x421f('0x25')](_0x2abe42,_0x421f('0x23'));_0xcee760[_0x421f('0x29')]=_[_0x421f('0x2a')](_0x325f8c[_0x421f('0x29')]);_0xcee760['filters']=_[_0x421f('0x2b')](_0xcee760[_0x421f('0x2c')],_0xcee760[_0x421f('0x29')]);_0x37ab04[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0xcee760[_0x421f('0x2c')],qs[_0x421f('0x2e')](_0x325f8c[_0x421f('0x29')]['fields']));_0x37ab04[_0x421f('0x2d')]=_0x37ab04['attributes'][_0x421f('0x2f')]?_0x37ab04[_0x421f('0x2d')]:_0xcee760['model'];if(!_0x325f8c[_0x421f('0x29')][_0x421f('0x30')](_0x421f('0x31'))){_0x37ab04['limit']=qs[_0x421f('0x19')](_0x325f8c[_0x421f('0x29')]['limit']);_0x37ab04[_0x421f('0x16')]=qs[_0x421f('0x16')](_0x325f8c[_0x421f('0x29')][_0x421f('0x16')]);}_0x37ab04[_0x421f('0x32')]=qs[_0x421f('0x33')](_0x325f8c[_0x421f('0x29')][_0x421f('0x33')]);_0x37ab04[_0x421f('0x34')]=qs[_0x421f('0x35')](_['pick'](_0x325f8c['query'],_0xcee760['filters']),_0x2abe42);if(_0x325f8c[_0x421f('0x29')][_0x421f('0x36')]){_0x37ab04[_0x421f('0x34')]=_[_0x421f('0x37')](_0x37ab04[_0x421f('0x34')],{'$or':_[_0x421f('0x25')](_0x2abe42,function(_0x12b861){if(_0x12b861[_0x421f('0x27')]!==_0x421f('0x38')){var _0x69ca3a={};_0x69ca3a[_0x12b861[_0x421f('0x23')]]={'$like':'%'+_0x325f8c[_0x421f('0x29')][_0x421f('0x36')]+'%'};return _0x69ca3a;}})});}_0x37ab04=_['merge']({},_0x37ab04,_0x325f8c[_0x421f('0x39')]);var _0x5db3c8={'where':_0x37ab04[_0x421f('0x34')]};return db[_0x421f('0x3a')][_0x421f('0x18')](_0x5db3c8)[_0x421f('0x3b')](function(_0x36fdd7){_0x24063f['count']=_0x36fdd7;if(_0x325f8c[_0x421f('0x29')][_0x421f('0x3c')]){_0x37ab04[_0x421f('0x3d')]=[{'all':!![]}];}return db[_0x421f('0x3a')][_0x421f('0x3e')](_0x37ab04);})['then'](function(_0x3e80d0){_0x24063f[_0x421f('0x3f')]=_0x3e80d0;return _0x24063f;})['then'](respondWithFilteredResult(_0x1ef133,_0x37ab04))[_0x421f('0x40')](handleError(_0x1ef133,null));};exports[_0x421f('0x41')]=function(_0x138e98,_0x6995b0){var _0x390ac8={'raw':![],'where':{'id':_0x138e98[_0x421f('0x42')]['id']}},_0x593005={};_0x593005['model']=_[_0x421f('0x2a')](db[_0x421f('0x3a')][_0x421f('0x43')]);_0x593005[_0x421f('0x29')]=_[_0x421f('0x2a')](_0x138e98[_0x421f('0x29')]);_0x593005[_0x421f('0x35')]=_[_0x421f('0x2b')](_0x593005['model'],_0x593005[_0x421f('0x29')]);_0x390ac8[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0x593005[_0x421f('0x2c')],qs['fields'](_0x138e98['query'][_0x421f('0x2e')]));_0x390ac8['attributes']=_0x390ac8[_0x421f('0x2d')][_0x421f('0x2f')]?_0x390ac8[_0x421f('0x2d')]:_0x593005[_0x421f('0x2c')];if(_0x138e98[_0x421f('0x29')]['includeAll']){_0x390ac8[_0x421f('0x3d')]=[{'all':!![]}];}_0x390ac8=_[_0x421f('0x37')]({},_0x390ac8,_0x138e98['options']);return db['FreshsalesAccount'][_0x421f('0x44')](_0x390ac8)[_0x421f('0x3b')](handleEntityNotFound(_0x6995b0,null))[_0x421f('0x3b')](respondWithResult(_0x6995b0,null))[_0x421f('0x40')](handleError(_0x6995b0,null));};exports[_0x421f('0x45')]=function(_0x5cb100,_0x46ad48){return db['FreshsalesAccount'][_0x421f('0x45')](_0x5cb100[_0x421f('0x46')],{})[_0x421f('0x3b')](respondWithResult(_0x46ad48,0xc9))[_0x421f('0x40')](handleError(_0x46ad48,null));};exports[_0x421f('0x1f')]=function(_0x1a0598,_0x3c2959){if(_0x1a0598[_0x421f('0x46')]['id']){delete _0x1a0598[_0x421f('0x46')]['id'];}return db['FreshsalesAccount'][_0x421f('0x44')]({'where':{'id':_0x1a0598[_0x421f('0x42')]['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x3c2959,null))[_0x421f('0x3b')](saveUpdates(_0x1a0598[_0x421f('0x46')],null))[_0x421f('0x3b')](respondWithResult(_0x3c2959,null))['catch'](handleError(_0x3c2959,null));};exports[_0x421f('0x20')]=function(_0x48ddfd,_0xcf6147){return db[_0x421f('0x3a')]['find']({'where':{'id':_0x48ddfd[_0x421f('0x42')]['id']}})['then'](handleEntityNotFound(_0xcf6147,null))[_0x421f('0x3b')](removeEntity(_0xcf6147,null))['catch'](handleError(_0xcf6147,null));};exports['getConfigurations']=function(_0x872162,_0x470342,_0x272e71){var _0x511dc5={};var _0x17afc1={};var _0x28d835;var _0x1c403a;return db[_0x421f('0x3a')][_0x421f('0x47')]({'where':{'id':_0x872162['params']['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x470342,null))[_0x421f('0x3b')](function(_0xcde601){if(_0xcde601){_0x28d835=_0xcde601;_0x17afc1[_0x421f('0x2c')]=_[_0x421f('0x2a')](db[_0x421f('0x48')][_0x421f('0x43')]);_0x17afc1['query']=_[_0x421f('0x2a')](_0x872162['query']);_0x17afc1[_0x421f('0x35')]=_['intersection'](_0x17afc1[_0x421f('0x2c')],_0x17afc1[_0x421f('0x29')]);_0x511dc5[_0x421f('0x2d')]=_[_0x421f('0x2b')](_0x17afc1['model'],qs[_0x421f('0x2e')](_0x872162[_0x421f('0x29')]['fields']));_0x511dc5['attributes']=_0x511dc5[_0x421f('0x2d')]['length']?_0x511dc5[_0x421f('0x2d')]:_0x17afc1['model'];_0x511dc5[_0x421f('0x32')]=qs[_0x421f('0x33')](_0x872162[_0x421f('0x29')][_0x421f('0x33')]);_0x511dc5[_0x421f('0x34')]=qs[_0x421f('0x35')](_[_0x421f('0x49')](_0x872162[_0x421f('0x29')],_0x17afc1[_0x421f('0x35')]));if(_0x872162[_0x421f('0x29')][_0x421f('0x36')]){_0x511dc5['where']=_[_0x421f('0x37')](_0x511dc5[_0x421f('0x34')],{'$or':_[_0x421f('0x25')](_0x511dc5[_0x421f('0x2d')],function(_0x49d215){var _0x6e136b={};_0x6e136b[_0x49d215]={'$like':'%'+_0x872162[_0x421f('0x29')][_0x421f('0x36')]+'%'};return _0x6e136b;})});}_0x511dc5=_['merge']({},_0x511dc5,_0x872162[_0x421f('0x39')]);return _0x28d835[_0x421f('0x4a')](_0x511dc5);}})[_0x421f('0x3b')](function(_0x2106d5){if(_0x2106d5){_0x1c403a=_0x2106d5[_0x421f('0x2f')];if(!_0x872162['query'][_0x421f('0x30')](_0x421f('0x31'))){_0x511dc5['limit']=qs[_0x421f('0x19')](_0x872162[_0x421f('0x29')]['limit']);_0x511dc5['offset']=qs[_0x421f('0x16')](_0x872162[_0x421f('0x29')][_0x421f('0x16')]);}return _0x28d835['getConfigurations'](_0x511dc5);}})[_0x421f('0x3b')](function(_0xeca2a8){if(_0xeca2a8){return _0xeca2a8?{'count':_0x1c403a,'rows':_0xeca2a8}:null;}})['then'](respondWithResult(_0x470342,null))[_0x421f('0x40')](handleError(_0x470342,null));};exports[_0x421f('0x4b')]=function(_0x7eae20,_0x1906c7,_0x40e536){if(_0x7eae20[_0x421f('0x46')]['id']){delete _0x7eae20['body']['id'];}return db[_0x421f('0x3a')]['findOne']({'where':{'id':_0x7eae20['params']['id']}})[_0x421f('0x3b')](handleEntityNotFound(_0x1906c7,null))[_0x421f('0x3b')](function(_0x3851fb){if(_0x3851fb){_0x7eae20[_0x421f('0x46')][_0x421f('0x4c')]=_0x3851fb['id'];_0x7eae20[_0x421f('0x46')][_0x421f('0x4d')]=integrations[_0x421f('0x4e')](_0x7eae20[_0x421f('0x46')]['channel'],_0x7eae20['body'][_0x421f('0x27')]);_0x7eae20['body'][_0x421f('0x4f')]=integrations[_0x421f('0x50')](_0x7eae20[_0x421f('0x46')]['channel'],_0x7eae20[_0x421f('0x46')][_0x421f('0x27')]);return db[_0x421f('0x48')][_0x421f('0x45')](_0x7eae20['body'],{'include':[{'model':db[_0x421f('0x51')],'as':'Subjects'},{'model':db[_0x421f('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1906c7,null))[_0x421f('0x40')](handleError(_0x1906c7,null));};exports[_0x421f('0x52')]=function(_0x461d8d,_0x49a12a,_0x2efb4d){var _0x11acf5='';var _0x3b7f3c='';return db[_0x421f('0x3a')][_0x421f('0x47')]({'where':{'id':_0x461d8d[_0x421f('0x42')]['id']},'attributes':['id','username',_0x421f('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x49a12a,null))['then'](function(_0x22ef14){if(_0x22ef14){_0x3b7f3c=_0x22ef14[_0x421f('0x54')];_0x11acf5=_0x22ef14['remoteUri'];var _0x1bbfdc=_0x22ef14[_0x421f('0x53')]['slice'](-0x1);if(_0x1bbfdc==='/'){_0x11acf5=_0x11acf5[_0x421f('0x55')](0x0,_0x11acf5[_0x421f('0x56')](_0x1bbfdc));}return rp({'method':_0x421f('0x57'),'uri':util[_0x421f('0x58')](_0x421f('0x59'),_0x11acf5,_0x421f('0x5a')),'headers':{'Authorization':_0x421f('0x5b')+_0x22ef14['apiKey']},'json':!![]});}})[_0x421f('0x3b')](function(_0x15a355){if(_0x15a355){var _0x54415b=_0x15a355['users'];var _0x1cbd8f=![];var _0x2bb6bc=null;for(_0x2bb6bc=0x0;_0x2bb6bc<_0x54415b[_0x421f('0x2f')];_0x2bb6bc++){if(_0x54415b[_0x2bb6bc][_0x421f('0x5c')]===_0x3b7f3c){_0x1cbd8f=!![];}}if(_0x1cbd8f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x49a12a,null))[_0x421f('0x40')](function(_0x304ee2){var _0x354bf5=_0x461d8d[_0x421f('0x29')][_0x421f('0x5d')]?0x1f4:_0x304ee2[_0x421f('0x5e')]||0x1f4;logger[_0x421f('0x21')](_0x421f('0x5f'),_0x421f('0x52'),_0x354bf5,JSON[_0x421f('0x60')](_0x304ee2));delete _0x304ee2[_0x421f('0x23')];if(_0x354bf5===0x191){_0x354bf5=0x190;}_0x49a12a[_0x421f('0x14')](_0x354bf5)['send'](_0x461d8d[_0x421f('0x29')]['test']?{'message':_0x421f('0x61'),'statusCode':_0x304ee2[_0x421f('0x5e')]}:_0x304ee2);});}; \ No newline at end of file +var _0xe34d=['map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','catch','show','params','keys','include','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','channel','FreshsalesField','Subjects','remoteUri','apiKey','username','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields','stringify','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index'];(function(_0x40d9c8,_0x42ddab){var _0x4b11fe=function(_0xc279ad){while(--_0xc279ad){_0x40d9c8['push'](_0x40d9c8['shift']());}};_0x4b11fe(++_0x42ddab);}(_0xe34d,0x16c));var _0xde34=function(_0x4e831,_0xcc379){_0x4e831=_0x4e831-0x0;var _0x454e48=_0xe34d[_0x4e831];return _0x454e48;};'use strict';var emlformat=require(_0xde34('0x0'));var rimraf=require(_0xde34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde34('0x2'));var rp=require(_0xde34('0x3'));var moment=require('moment');var BPromise=require(_0xde34('0x4'));var Mustache=require(_0xde34('0x5'));var util=require(_0xde34('0x6'));var path=require(_0xde34('0x7'));var sox=require(_0xde34('0x8'));var csv=require(_0xde34('0x9'));var ejs=require(_0xde34('0xa'));var fs=require('fs');var fs_extra=require(_0xde34('0xb'));var _=require(_0xde34('0xc'));var squel=require(_0xde34('0xd'));var crypto=require('crypto');var jsforce=require(_0xde34('0xe'));var deskjs=require(_0xde34('0xf'));var toCsv=require(_0xde34('0x9'));var querystring=require('querystring');var Papa=require(_0xde34('0x10'));var Redis=require(_0xde34('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde34('0x12'));var hardwareService=require(_0xde34('0x13'));var logger=require('../../config/logger')(_0xde34('0x14'));var utils=require(_0xde34('0x15'));var config=require(_0xde34('0x16'));var licenseUtil=require(_0xde34('0x17'));var db=require(_0xde34('0x18'))['db'];var integrations=require(_0xde34('0x19'));function respondWithStatusCode(_0x439418,_0x2850df){_0x2850df=_0x2850df||0xcc;return function(_0x261ae4){if(_0x261ae4){return _0x439418[_0xde34('0x1a')](_0x2850df);}return _0x439418['status'](_0x2850df)['end']();};}function respondWithResult(_0x42f0ce,_0x138790){_0x138790=_0x138790||0xc8;return function(_0x5879b2){if(_0x5879b2){return _0x42f0ce[_0xde34('0x1b')](_0x138790)[_0xde34('0x1c')](_0x5879b2);}};}function respondWithFilteredResult(_0x551879,_0x1daaf0){return function(_0xf8a106){if(_0xf8a106){var _0xaf9047=typeof _0x1daaf0[_0xde34('0x1d')]===_0xde34('0x1e')&&typeof _0x1daaf0[_0xde34('0x1f')]===_0xde34('0x1e');var _0x4ad799=_0xf8a106[_0xde34('0x20')];var _0x291e91=_0xaf9047?0x0:_0x1daaf0[_0xde34('0x1d')];var _0x878085=_0xaf9047?_0xf8a106['count']:_0x1daaf0[_0xde34('0x1d')]+_0x1daaf0[_0xde34('0x1f')];var _0xf8258d;if(_0x878085>=_0x4ad799){_0x878085=_0x4ad799;_0xf8258d=0xc8;}else{_0xf8258d=0xce;}_0x551879['status'](_0xf8258d);return _0x551879[_0xde34('0x21')](_0xde34('0x22'),_0x291e91+'-'+_0x878085+'/'+_0x4ad799)['json'](_0xf8a106);}return null;};}function patchUpdates(_0x226944){return function(_0x3a6ad6){try{jsonpatch[_0xde34('0x23')](_0x3a6ad6,_0x226944,!![]);}catch(_0x11540f){return BPromise[_0xde34('0x24')](_0x11540f);}return _0x3a6ad6[_0xde34('0x25')]();};}function saveUpdates(_0xe3e710,_0x22870a){return function(_0x59f9b6){if(_0x59f9b6){return _0x59f9b6[_0xde34('0x26')](_0xe3e710)[_0xde34('0x27')](function(_0x1978e8){return _0x1978e8;});}return null;};}function removeEntity(_0xb9bdcb,_0x57e58c){return function(_0x7f9706){if(_0x7f9706){return _0x7f9706[_0xde34('0x28')]()[_0xde34('0x27')](function(){_0xb9bdcb[_0xde34('0x1b')](0xcc)[_0xde34('0x29')]();});}};}function handleEntityNotFound(_0x45bce3,_0x44e1a9){return function(_0xce5e95){if(!_0xce5e95){_0x45bce3['sendStatus'](0x194);}return _0xce5e95;};}function handleError(_0x226b98,_0x170cb3){_0x170cb3=_0x170cb3||0x1f4;return function(_0x308a08){logger['error'](_0x308a08['stack']);if(_0x308a08[_0xde34('0x2a')]){delete _0x308a08[_0xde34('0x2a')];}_0x226b98[_0xde34('0x1b')](_0x170cb3)['send'](_0x308a08);};}exports[_0xde34('0x2b')]=function(_0x1f57d3,_0x3a754c){var _0x39ccb8={},_0x11bb6d={},_0x34a4ec={'count':0x0,'rows':[]};var _0x359576=_[_0xde34('0x2c')](db['FreshsalesAccount'][_0xde34('0x2d')],function(_0x10790b){return{'name':_0x10790b[_0xde34('0x2e')],'type':_0x10790b[_0xde34('0x2f')][_0xde34('0x30')]};});_0x11bb6d[_0xde34('0x31')]=_[_0xde34('0x2c')](_0x359576,_0xde34('0x2a'));_0x11bb6d[_0xde34('0x32')]=_['keys'](_0x1f57d3['query']);_0x11bb6d[_0xde34('0x33')]=_['intersection'](_0x11bb6d[_0xde34('0x31')],_0x11bb6d[_0xde34('0x32')]);_0x39ccb8['attributes']=_[_0xde34('0x34')](_0x11bb6d[_0xde34('0x31')],qs[_0xde34('0x35')](_0x1f57d3[_0xde34('0x32')][_0xde34('0x35')]));_0x39ccb8[_0xde34('0x36')]=_0x39ccb8[_0xde34('0x36')][_0xde34('0x37')]?_0x39ccb8['attributes']:_0x11bb6d[_0xde34('0x31')];if(!_0x1f57d3['query'][_0xde34('0x38')](_0xde34('0x39'))){_0x39ccb8[_0xde34('0x1f')]=qs[_0xde34('0x1f')](_0x1f57d3[_0xde34('0x32')][_0xde34('0x1f')]);_0x39ccb8[_0xde34('0x1d')]=qs['offset'](_0x1f57d3[_0xde34('0x32')]['offset']);}_0x39ccb8[_0xde34('0x3a')]=qs[_0xde34('0x3b')](_0x1f57d3[_0xde34('0x32')][_0xde34('0x3b')]);_0x39ccb8[_0xde34('0x3c')]=qs[_0xde34('0x33')](_[_0xde34('0x3d')](_0x1f57d3[_0xde34('0x32')],_0x11bb6d[_0xde34('0x33')]),_0x359576);if(_0x1f57d3[_0xde34('0x32')][_0xde34('0x3e')]){_0x39ccb8[_0xde34('0x3c')]=_[_0xde34('0x3f')](_0x39ccb8[_0xde34('0x3c')],{'$or':_[_0xde34('0x2c')](_0x359576,function(_0x4f2704){if(_0x4f2704[_0xde34('0x2f')]!==_0xde34('0x40')){var _0x5531d7={};_0x5531d7[_0x4f2704[_0xde34('0x2a')]]={'$like':'%'+_0x1f57d3[_0xde34('0x32')][_0xde34('0x3e')]+'%'};return _0x5531d7;}})});}_0x39ccb8=_[_0xde34('0x3f')]({},_0x39ccb8,_0x1f57d3[_0xde34('0x41')]);var _0x184f40={'where':_0x39ccb8[_0xde34('0x3c')]};return db[_0xde34('0x42')][_0xde34('0x20')](_0x184f40)[_0xde34('0x27')](function(_0x5ab18c){_0x34a4ec[_0xde34('0x20')]=_0x5ab18c;if(_0x1f57d3[_0xde34('0x32')][_0xde34('0x43')]){_0x39ccb8['include']=[{'all':!![]}];}return db[_0xde34('0x42')][_0xde34('0x44')](_0x39ccb8);})[_0xde34('0x27')](function(_0x1a2fcf){_0x34a4ec['rows']=_0x1a2fcf;return _0x34a4ec;})[_0xde34('0x27')](respondWithFilteredResult(_0x3a754c,_0x39ccb8))[_0xde34('0x45')](handleError(_0x3a754c,null));};exports[_0xde34('0x46')]=function(_0x43feb8,_0x23cef4){var _0x2b89c4={'raw':![],'where':{'id':_0x43feb8[_0xde34('0x47')]['id']}},_0x5477b9={};_0x5477b9[_0xde34('0x31')]=_['keys'](db[_0xde34('0x42')][_0xde34('0x2d')]);_0x5477b9['query']=_[_0xde34('0x48')](_0x43feb8['query']);_0x5477b9[_0xde34('0x33')]=_[_0xde34('0x34')](_0x5477b9['model'],_0x5477b9[_0xde34('0x32')]);_0x2b89c4[_0xde34('0x36')]=_[_0xde34('0x34')](_0x5477b9['model'],qs[_0xde34('0x35')](_0x43feb8[_0xde34('0x32')][_0xde34('0x35')]));_0x2b89c4['attributes']=_0x2b89c4[_0xde34('0x36')][_0xde34('0x37')]?_0x2b89c4[_0xde34('0x36')]:_0x5477b9['model'];if(_0x43feb8['query'][_0xde34('0x43')]){_0x2b89c4[_0xde34('0x49')]=[{'all':!![]}];}_0x2b89c4=_['merge']({},_0x2b89c4,_0x43feb8[_0xde34('0x41')]);return db[_0xde34('0x42')]['find'](_0x2b89c4)[_0xde34('0x27')](handleEntityNotFound(_0x23cef4,null))[_0xde34('0x27')](respondWithResult(_0x23cef4,null))[_0xde34('0x45')](handleError(_0x23cef4,null));};exports[_0xde34('0x4a')]=function(_0x30ec11,_0x19b442){return db[_0xde34('0x42')][_0xde34('0x4a')](_0x30ec11[_0xde34('0x4b')],{})['then'](respondWithResult(_0x19b442,0xc9))[_0xde34('0x45')](handleError(_0x19b442,null));};exports[_0xde34('0x26')]=function(_0x4d3ec3,_0xe79513){if(_0x4d3ec3[_0xde34('0x4b')]['id']){delete _0x4d3ec3[_0xde34('0x4b')]['id'];}return db['FreshsalesAccount'][_0xde34('0x4c')]({'where':{'id':_0x4d3ec3[_0xde34('0x47')]['id']}})[_0xde34('0x27')](handleEntityNotFound(_0xe79513,null))['then'](saveUpdates(_0x4d3ec3[_0xde34('0x4b')],null))[_0xde34('0x27')](respondWithResult(_0xe79513,null))[_0xde34('0x45')](handleError(_0xe79513,null));};exports[_0xde34('0x28')]=function(_0x51e040,_0x45fa3c){return db['FreshsalesAccount']['find']({'where':{'id':_0x51e040[_0xde34('0x47')]['id']}})['then'](handleEntityNotFound(_0x45fa3c,null))[_0xde34('0x27')](removeEntity(_0x45fa3c,null))['catch'](handleError(_0x45fa3c,null));};exports[_0xde34('0x4d')]=function(_0x240ad8,_0x434cea,_0x538764){var _0x1c4fb9={};var _0xa3fc04={};var _0x475e38;var _0x457bc5;return db[_0xde34('0x42')][_0xde34('0x4e')]({'where':{'id':_0x240ad8['params']['id']}})[_0xde34('0x27')](handleEntityNotFound(_0x434cea,null))['then'](function(_0x3b8eca){if(_0x3b8eca){_0x475e38=_0x3b8eca;_0xa3fc04['model']=_['keys'](db[_0xde34('0x4f')][_0xde34('0x2d')]);_0xa3fc04[_0xde34('0x32')]=_['keys'](_0x240ad8[_0xde34('0x32')]);_0xa3fc04['filters']=_[_0xde34('0x34')](_0xa3fc04[_0xde34('0x31')],_0xa3fc04['query']);_0x1c4fb9[_0xde34('0x36')]=_[_0xde34('0x34')](_0xa3fc04[_0xde34('0x31')],qs[_0xde34('0x35')](_0x240ad8[_0xde34('0x32')][_0xde34('0x35')]));_0x1c4fb9[_0xde34('0x36')]=_0x1c4fb9[_0xde34('0x36')][_0xde34('0x37')]?_0x1c4fb9[_0xde34('0x36')]:_0xa3fc04['model'];_0x1c4fb9[_0xde34('0x3a')]=qs['sort'](_0x240ad8[_0xde34('0x32')][_0xde34('0x3b')]);_0x1c4fb9['where']=qs[_0xde34('0x33')](_['pick'](_0x240ad8[_0xde34('0x32')],_0xa3fc04[_0xde34('0x33')]));if(_0x240ad8[_0xde34('0x32')]['filter']){_0x1c4fb9['where']=_[_0xde34('0x3f')](_0x1c4fb9[_0xde34('0x3c')],{'$or':_['map'](_0x1c4fb9['attributes'],function(_0x46b5a5){var _0xc05159={};_0xc05159[_0x46b5a5]={'$like':'%'+_0x240ad8[_0xde34('0x32')][_0xde34('0x3e')]+'%'};return _0xc05159;})});}_0x1c4fb9=_['merge']({},_0x1c4fb9,_0x240ad8[_0xde34('0x41')]);return _0x475e38['getConfigurations'](_0x1c4fb9);}})[_0xde34('0x27')](function(_0x460333){if(_0x460333){_0x457bc5=_0x460333['length'];if(!_0x240ad8['query'][_0xde34('0x38')]('nolimit')){_0x1c4fb9['limit']=qs[_0xde34('0x1f')](_0x240ad8[_0xde34('0x32')][_0xde34('0x1f')]);_0x1c4fb9['offset']=qs[_0xde34('0x1d')](_0x240ad8[_0xde34('0x32')][_0xde34('0x1d')]);}return _0x475e38[_0xde34('0x4d')](_0x1c4fb9);}})['then'](function(_0x27ebe2){if(_0x27ebe2){return _0x27ebe2?{'count':_0x457bc5,'rows':_0x27ebe2}:null;}})[_0xde34('0x27')](respondWithResult(_0x434cea,null))['catch'](handleError(_0x434cea,null));};exports[_0xde34('0x50')]=function(_0x28b7eb,_0x4d54a7,_0x4bd52d){if(_0x28b7eb[_0xde34('0x4b')]['id']){delete _0x28b7eb[_0xde34('0x4b')]['id'];}return db[_0xde34('0x42')][_0xde34('0x4e')]({'where':{'id':_0x28b7eb[_0xde34('0x47')]['id']}})[_0xde34('0x27')](handleEntityNotFound(_0x4d54a7,null))[_0xde34('0x27')](function(_0x4849e6){if(_0x4849e6){_0x28b7eb['body'][_0xde34('0x51')]=_0x4849e6['id'];_0x28b7eb[_0xde34('0x4b')]['Subjects']=integrations[_0xde34('0x52')](_0x28b7eb[_0xde34('0x4b')][_0xde34('0x53')],_0x28b7eb[_0xde34('0x4b')][_0xde34('0x2f')]);_0x28b7eb['body']['Descriptions']=integrations['getDescriptions'](_0x28b7eb[_0xde34('0x4b')][_0xde34('0x53')],_0x28b7eb[_0xde34('0x4b')][_0xde34('0x2f')]);return db[_0xde34('0x4f')]['create'](_0x28b7eb['body'],{'include':[{'model':db[_0xde34('0x54')],'as':_0xde34('0x55')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xde34('0x27')](respondWithResult(_0x4d54a7,null))['catch'](handleError(_0x4d54a7,null));};exports['getFields']=function(_0x14d679,_0x24065e,_0x40f8f0){var _0xb02834='';var _0x58cf9d='';return db[_0xde34('0x42')][_0xde34('0x4e')]({'where':{'id':_0x14d679[_0xde34('0x47')]['id']},'attributes':['id','username',_0xde34('0x56'),_0xde34('0x57')]})[_0xde34('0x27')](handleEntityNotFound(_0x24065e,null))[_0xde34('0x27')](function(_0x2392ef){if(_0x2392ef){_0x58cf9d=_0x2392ef[_0xde34('0x58')];_0xb02834=_0x2392ef[_0xde34('0x56')];var _0xde9653=_0x2392ef['remoteUri'][_0xde34('0x59')](-0x1);if(_0xde9653==='/'){_0xb02834=_0xb02834[_0xde34('0x5a')](0x0,_0xb02834['lastIndexOf'](_0xde9653));}return rp({'method':_0xde34('0x5b'),'uri':util['format'](_0xde34('0x5c'),_0xb02834,_0xde34('0x5d')),'headers':{'Authorization':_0xde34('0x5e')+_0x2392ef[_0xde34('0x57')]},'json':!![]});}})[_0xde34('0x27')](function(_0x25d6dc){if(_0x25d6dc){var _0x4f47af=_0x25d6dc[_0xde34('0x5f')];var _0x3cfae2=![];var _0x2bd550=null;for(_0x2bd550=0x0;_0x2bd550<_0x4f47af['length'];_0x2bd550++){if(_0x4f47af[_0x2bd550][_0xde34('0x60')]===_0x58cf9d){_0x3cfae2=!![];}}if(_0x3cfae2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xde34('0x27')](respondWithResult(_0x24065e,null))['catch'](function(_0x2b200c){var _0x41c22b=_0x14d679[_0xde34('0x32')][_0xde34('0x61')]?0x1f4:_0x2b200c[_0xde34('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xde34('0x63'),_0x41c22b,JSON[_0xde34('0x64')](_0x2b200c));delete _0x2b200c[_0xde34('0x2a')];if(_0x41c22b===0x191){_0x41c22b=0x190;}_0x24065e['status'](_0x41c22b)[_0xde34('0x65')](_0x14d679[_0xde34('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2b200c['statusCode']}:_0x2b200c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a012978..80022f2 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 _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x264de4,_0x41f555){var _0x4e004e=function(_0x43f7c8){while(--_0x43f7c8){_0x264de4['push'](_0x264de4['shift']());}};_0x4e004e(++_0x41f555);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1ee69b,_0x55a65b){_0x1ee69b=_0x1ee69b-0x0;var _0x33e413=_0xe5af[_0x1ee69b];return _0x33e413;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'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(_0x4b090f,_0x17df3b){var _0x16f828=function(_0x23e630){while(--_0x23e630){_0x4b090f['push'](_0x4b090f['shift']());}};_0x16f828(++_0x17df3b);}(_0x2ef3,0xba));var _0x32ef=function(_0x238ca7,_0x11cc9d){_0x238ca7=_0x238ca7-0x0;var _0x174533=_0x2ef3[_0x238ca7];return _0x174533;};'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 d2a7003..16088f3 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 _0x0120=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['FreshsalesAccount'][_0x0012('0x17')]({'raw':_0x1d0423[_0x0012('0x18')]?_0x1d0423['options'][_0x0012('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x1d0423['options']?_0x1d0423['options'][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1c')]||null:null,'include':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x1d0423['options'][_0x0012('0x1d')],function(_0x24a280){return{'model':db[_0x24a280['model']],'as':_0x24a280['as'],'attributes':_0x24a280[_0x0012('0x1b')],'include':_0x24a280[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x24a280[_0x0012('0x1d')],function(_0x42bcd7){return{'model':db[_0x42bcd7['model']],'as':_0x42bcd7['as'],'attributes':_0x42bcd7[_0x0012('0x1b')],'include':_0x42bcd7[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x42bcd7[_0x0012('0x1d')],function(_0x173cb3){return{'model':db[_0x173cb3[_0x0012('0x1f')]],'as':_0x173cb3['as'],'attributes':_0x173cb3[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0012('0x20')](function(_0x300e13){logger[_0x0012('0xd')](_0x0012('0x16'),_0x1d0423);logger[_0x0012('0x21')](_0x0012('0x16'),_0x1d0423,JSON[_0x0012('0x11')](_0x300e13));_0x1e78ee(_0x300e13);})[_0x0012('0x22')](function(_0x276389){logger[_0x0012('0x12')](_0x0012('0x16'),_0x276389[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1[_0x0012('0x12')](0x1f4,_0x276389[_0x0012('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x283134){var _0x1bb49b=this;return new Promise(function(_0x4c2601,_0x2fa6a2){return db[_0x0012('0x23')][_0x0012('0x24')]({'raw':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x283134['options']?_0x283134[_0x0012('0x18')][_0x0012('0x1b')]||null:null,'include':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x283134['options'][_0x0012('0x1d')],function(_0x30dfd8){return{'model':db[_0x30dfd8[_0x0012('0x1f')]],'as':_0x30dfd8['as'],'attributes':_0x30dfd8[_0x0012('0x1b')],'include':_0x30dfd8['include']?_['map'](_0x30dfd8[_0x0012('0x1d')],function(_0x30f8a2){return{'model':db[_0x30f8a2[_0x0012('0x1f')]],'as':_0x30f8a2['as'],'attributes':_0x30f8a2[_0x0012('0x1b')],'include':_0x30f8a2[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x30f8a2[_0x0012('0x1d')],function(_0x4f13b9){return{'model':db[_0x4f13b9[_0x0012('0x1f')]],'as':_0x4f13b9['as'],'attributes':_0x4f13b9[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196222){logger[_0x0012('0xd')](_0x0012('0x25'),_0x283134);logger[_0x0012('0x21')](_0x0012('0x25'),_0x283134,JSON[_0x0012('0x11')](_0x196222));_0x4c2601(_0x196222);})[_0x0012('0x22')](function(_0x4a4af8){logger[_0x0012('0x12')]('ShowFreshsalesAccount',_0x4a4af8[_0x0012('0x14')],_0x283134);_0x2fa6a2(_0x1bb49b['error'](0x1f4,_0x4a4af8['message']));});});}; \ No newline at end of file +var _0x9f0e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','ShowFreshsalesAccount','find','where','lodash','util'];(function(_0x1b676b,_0x30dfcc){var _0x14c5f7=function(_0x59b378){while(--_0x59b378){_0x1b676b['push'](_0x1b676b['shift']());}};_0x14c5f7(++_0x30dfcc);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4b3906,_0x3cd23e){_0x4b3906=_0x4b3906-0x0;var _0x34bc51=_0x9f0e[_0x4b3906];return _0x34bc51;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')]({'raw':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['where']||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'include':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x2ab12b['options'][_0xe9f0('0x1c')],function(_0x38b7ee){return{'model':db[_0x38b7ee[_0xe9f0('0x1e')]],'as':_0x38b7ee['as'],'attributes':_0x38b7ee[_0xe9f0('0x1f')],'include':_0x38b7ee[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x38b7ee[_0xe9f0('0x1c')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x1e')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x1d')](_0x1321bb[_0xe9f0('0x1c')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x1e')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x2613fd){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger[_0xe9f0('0xf')]('GetFreshsalesAccount',_0x2ab12b,JSON[_0xe9f0('0x11')](_0x2613fd));_0x59bf5a(_0x2613fd);})[_0xe9f0('0x15')](function(_0x44fb5b){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x44fb5b[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x44fb5b[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x20')]=function(_0x3dbe49){var _0x22806c=this;return new Promise(function(_0x617ad3,_0x445ad0){return db[_0xe9f0('0x17')][_0xe9f0('0x21')]({'raw':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x22')]||null:null,'attributes':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'include':_0x3dbe49['options']?_0x3dbe49['options']['include']?_[_0xe9f0('0x1d')](_0x3dbe49['options'][_0xe9f0('0x1c')],function(_0xc5fa13){return{'model':db[_0xc5fa13['model']],'as':_0xc5fa13['as'],'attributes':_0xc5fa13[_0xe9f0('0x1f')],'include':_0xc5fa13['include']?_['map'](_0xc5fa13['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x1e')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x165440[_0xe9f0('0x1c')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x1917c8){logger['info'](_0xe9f0('0x20'),_0x3dbe49);logger[_0xe9f0('0xf')](_0xe9f0('0x20'),_0x3dbe49,JSON[_0xe9f0('0x11')](_0x1917c8));_0x617ad3(_0x1917c8);})[_0xe9f0('0x15')](function(_0x552ec2){logger[_0xe9f0('0x12')](_0xe9f0('0x20'),_0x552ec2[_0xe9f0('0x13')],_0x3dbe49);_0x445ad0(_0x22806c['error'](0x1f4,_0x552ec2[_0xe9f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3f7a410..b2edbbc 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 _0xd0fb=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x130f4b,_0x47ad96){var _0xa81216=function(_0x54ee57){while(--_0x54ee57){_0x130f4b['push'](_0x130f4b['shift']());}};_0xa81216(++_0x47ad96);}(_0xd0fb,0x85));var _0xbd0f=function(_0x52ef65,_0x3b7378){_0x52ef65=_0x52ef65-0x0;var _0xd87bfa=_0xd0fb[_0x52ef65];return _0xd87bfa;};'use strict';var multer=require(_0xbd0f('0x0'));var util=require(_0xbd0f('0x1'));var path=require(_0xbd0f('0x2'));var timeout=require(_0xbd0f('0x3'));var express=require('express');var router=express[_0xbd0f('0x4')]();var fs_extra=require(_0xbd0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd0f('0x6'));var config=require(_0xbd0f('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xbd0f('0x8')]('/',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xa')]);router['get'](_0xbd0f('0xb'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xc')]);router[_0xbd0f('0x8')](_0xbd0f('0xd'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0xe')]);router[_0xbd0f('0x8')](_0xbd0f('0xf'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x10')]);router[_0xbd0f('0x8')](_0xbd0f('0x11'),auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x12')]);router[_0xbd0f('0x13')]('/',auth[_0xbd0f('0x9')](),controller['create']);router['put']('/:id',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x14')]);router['delete']('/:id',auth[_0xbd0f('0x9')](),controller[_0xbd0f('0x15')]);module[_0xbd0f('0x16')]=router; \ No newline at end of file +var _0x491e=['path','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x944797,_0x147b4c){var _0x1908ca=function(_0x5bde5f){while(--_0x5bde5f){_0x944797['push'](_0x944797['shift']());}};_0x1908ca(++_0x147b4c);}(_0x491e,0xb6));var _0xe491=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x491e[_0x340380];return _0x49ce1c;};'use strict';var multer=require(_0xe491('0x0'));var util=require(_0xe491('0x1'));var path=require(_0xe491('0x2'));var timeout=require('connect-timeout');var express=require(_0xe491('0x3'));var router=express[_0xe491('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe491('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe491('0x6'));var controller=require(_0xe491('0x7'));router['get']('/',auth[_0xe491('0x8')](),controller[_0xe491('0x9')]);router[_0xe491('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe491('0xb')]);router['get'](_0xe491('0xc'),auth['isAuthenticated'](),controller[_0xe491('0xd')]);router[_0xe491('0xa')](_0xe491('0xe'),auth[_0xe491('0x8')](),controller['getDescriptions']);router['get'](_0xe491('0xf'),auth[_0xe491('0x8')](),controller['getFields']);router[_0xe491('0x10')]('/',auth[_0xe491('0x8')](),controller['create']);router[_0xe491('0x11')](_0xe491('0x12'),auth['isAuthenticated'](),controller[_0xe491('0x13')]);router[_0xe491('0x14')](_0xe491('0x12'),auth[_0xe491('0x8')](),controller[_0xe491('0x15')]);module[_0xe491('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3372962..a52c17b 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 _0x2dcf=['exports','STRING'];(function(_0x56ca61,_0x187321){var _0x1e7bee=function(_0x1d6eb4){while(--_0x1d6eb4){_0x56ca61['push'](_0x56ca61['shift']());}};_0x1e7bee(++_0x187321);}(_0x2dcf,0xae));var _0xf2dc=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x2dcf[_0x18afca];return _0x11603f;};'use strict';var Sequelize=require('sequelize');module[_0xf2dc('0x0')]={'name':{'type':Sequelize[_0xf2dc('0x1')]},'description':{'type':Sequelize[_0xf2dc('0x1')]}}; \ No newline at end of file +var _0xe9f4=['STRING','sequelize'];(function(_0x482bac,_0x2ad787){var _0x35d510=function(_0x3b15ee){while(--_0x3b15ee){_0x482bac['push'](_0x482bac['shift']());}};_0x35d510(++_0x2ad787);}(_0xe9f4,0x13d));var _0x4e9f=function(_0x1598e4,_0x1d2809){_0x1598e4=_0x1598e4-0x0;var _0x3ae771=_0xe9f4[_0x1598e4];return _0x3ae771;};'use strict';var Sequelize=require(_0x4e9f('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e9f('0x1')]},'description':{'type':Sequelize[_0x4e9f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a6b0b5a..43d482b 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 _0x0b5a=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getSubjects','FreshsalesField','hasOwnProperty','nolimit','getDescriptions','getFields','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../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','then','destroy','stack','name','index','rawAttributes','fieldName','type'];(function(_0x107b1a,_0x5c0b3d){var _0x288b01=function(_0x86084a){while(--_0x86084a){_0x107b1a['push'](_0x107b1a['shift']());}};_0x288b01(++_0x5c0b3d);}(_0x0b5a,0x175));var _0xa0b5=function(_0x30c70c,_0xbe6d54){_0x30c70c=_0x30c70c-0x0;var _0x5cab7d=_0x0b5a[_0x30c70c];return _0x5cab7d;};'use strict';var emlformat=require(_0xa0b5('0x0'));var rimraf=require(_0xa0b5('0x1'));var zipdir=require(_0xa0b5('0x2'));var jsonpatch=require(_0xa0b5('0x3'));var rp=require(_0xa0b5('0x4'));var moment=require(_0xa0b5('0x5'));var BPromise=require(_0xa0b5('0x6'));var Mustache=require(_0xa0b5('0x7'));var util=require(_0xa0b5('0x8'));var path=require(_0xa0b5('0x9'));var sox=require(_0xa0b5('0xa'));var csv=require(_0xa0b5('0xb'));var ejs=require(_0xa0b5('0xc'));var fs=require('fs');var fs_extra=require(_0xa0b5('0xd'));var _=require(_0xa0b5('0xe'));var squel=require(_0xa0b5('0xf'));var crypto=require(_0xa0b5('0x10'));var jsforce=require(_0xa0b5('0x11'));var deskjs=require(_0xa0b5('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0b5('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0b5('0x14'));var hardwareService=require(_0xa0b5('0x15'));var logger=require('../../config/logger')(_0xa0b5('0x16'));var utils=require('../../config/utils');var config=require(_0xa0b5('0x17'));var licenseUtil=require(_0xa0b5('0x18'));var db=require(_0xa0b5('0x19'))['db'];function respondWithStatusCode(_0x31bac5,_0xca8aa7){_0xca8aa7=_0xca8aa7||0xcc;return function(_0x38e8c1){if(_0x38e8c1){return _0x31bac5[_0xa0b5('0x1a')](_0xca8aa7);}return _0x31bac5[_0xa0b5('0x1b')](_0xca8aa7)[_0xa0b5('0x1c')]();};}function respondWithResult(_0x3b336c,_0x3d5b04){_0x3d5b04=_0x3d5b04||0xc8;return function(_0x345cdd){if(_0x345cdd){return _0x3b336c[_0xa0b5('0x1b')](_0x3d5b04)[_0xa0b5('0x1d')](_0x345cdd);}};}function respondWithFilteredResult(_0x521c48,_0x1a5d9e){return function(_0x269e3c){if(_0x269e3c){var _0x593b7b=typeof _0x1a5d9e[_0xa0b5('0x1e')]===_0xa0b5('0x1f')&&typeof _0x1a5d9e['limit']===_0xa0b5('0x1f');var _0x1b9b45=_0x269e3c['count'];var _0x1b2a4c=_0x593b7b?0x0:_0x1a5d9e['offset'];var _0x2ff197=_0x593b7b?_0x269e3c[_0xa0b5('0x20')]:_0x1a5d9e['offset']+_0x1a5d9e[_0xa0b5('0x21')];var _0x2e6dab;if(_0x2ff197>=_0x1b9b45){_0x2ff197=_0x1b9b45;_0x2e6dab=0xc8;}else{_0x2e6dab=0xce;}_0x521c48['status'](_0x2e6dab);return _0x521c48[_0xa0b5('0x22')](_0xa0b5('0x23'),_0x1b2a4c+'-'+_0x2ff197+'/'+_0x1b9b45)[_0xa0b5('0x1d')](_0x269e3c);}return null;};}function patchUpdates(_0x147fd5){return function(_0x5cf2f1){try{jsonpatch[_0xa0b5('0x24')](_0x5cf2f1,_0x147fd5,!![]);}catch(_0x4ec755){return BPromise[_0xa0b5('0x25')](_0x4ec755);}return _0x5cf2f1[_0xa0b5('0x26')]();};}function saveUpdates(_0x5e9040,_0x3dae95){return function(_0x23bf71){if(_0x23bf71){return _0x23bf71['update'](_0x5e9040)[_0xa0b5('0x27')](function(_0x2346d5){return _0x2346d5;});}return null;};}function removeEntity(_0x51061e,_0x44773e){return function(_0x50aa3a){if(_0x50aa3a){return _0x50aa3a[_0xa0b5('0x28')]()[_0xa0b5('0x27')](function(){_0x51061e['status'](0xcc)[_0xa0b5('0x1c')]();});}};}function handleEntityNotFound(_0x58631f,_0x100610){return function(_0x3e04cd){if(!_0x3e04cd){_0x58631f['sendStatus'](0x194);}return _0x3e04cd;};}function handleError(_0x42fa2b,_0x4924e0){_0x4924e0=_0x4924e0||0x1f4;return function(_0x350aca){logger['error'](_0x350aca[_0xa0b5('0x29')]);if(_0x350aca[_0xa0b5('0x2a')]){delete _0x350aca[_0xa0b5('0x2a')];}_0x42fa2b[_0xa0b5('0x1b')](_0x4924e0)['send'](_0x350aca);};}exports[_0xa0b5('0x2b')]=function(_0x934795,_0x46a178){var _0x1e243a={},_0x36fd82={},_0x10edd6={'count':0x0,'rows':[]};var _0x45f27=_['map'](db['FreshsalesConfiguration'][_0xa0b5('0x2c')],function(_0x2b46b6){return{'name':_0x2b46b6[_0xa0b5('0x2d')],'type':_0x2b46b6[_0xa0b5('0x2e')][_0xa0b5('0x2f')]};});_0x36fd82[_0xa0b5('0x30')]=_['map'](_0x45f27,_0xa0b5('0x2a'));_0x36fd82[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x934795[_0xa0b5('0x31')]);_0x36fd82[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x36fd82[_0xa0b5('0x30')],_0x36fd82[_0xa0b5('0x31')]);_0x1e243a[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x36fd82[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x934795['query'][_0xa0b5('0x36')]));_0x1e243a[_0xa0b5('0x35')]=_0x1e243a[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x1e243a['attributes']:_0x36fd82[_0xa0b5('0x30')];if(!_0x934795[_0xa0b5('0x31')]['hasOwnProperty']('nolimit')){_0x1e243a[_0xa0b5('0x21')]=qs['limit'](_0x934795[_0xa0b5('0x31')]['limit']);_0x1e243a[_0xa0b5('0x1e')]=qs[_0xa0b5('0x1e')](_0x934795[_0xa0b5('0x31')]['offset']);}_0x1e243a[_0xa0b5('0x38')]=qs[_0xa0b5('0x39')](_0x934795[_0xa0b5('0x31')][_0xa0b5('0x39')]);_0x1e243a[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_[_0xa0b5('0x3b')](_0x934795[_0xa0b5('0x31')],_0x36fd82[_0xa0b5('0x33')]),_0x45f27);if(_0x934795[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x1e243a[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x1e243a[_0xa0b5('0x3a')],{'$or':_['map'](_0x45f27,function(_0x106f00){if(_0x106f00[_0xa0b5('0x2e')]!==_0xa0b5('0x3e')){var _0x3bae9d={};_0x3bae9d[_0x106f00[_0xa0b5('0x2a')]]={'$like':'%'+_0x934795[_0xa0b5('0x31')][_0xa0b5('0x3c')]+'%'};return _0x3bae9d;}})});}_0x1e243a=_[_0xa0b5('0x3d')]({},_0x1e243a,_0x934795[_0xa0b5('0x3f')]);var _0x1b0216={'where':_0x1e243a['where']};return db[_0xa0b5('0x40')][_0xa0b5('0x20')](_0x1b0216)[_0xa0b5('0x27')](function(_0x1cda30){_0x10edd6[_0xa0b5('0x20')]=_0x1cda30;if(_0x934795[_0xa0b5('0x31')][_0xa0b5('0x41')]){_0x1e243a[_0xa0b5('0x42')]=[{'all':!![]}];}return db[_0xa0b5('0x40')][_0xa0b5('0x43')](_0x1e243a);})[_0xa0b5('0x27')](function(_0x5d55ef){_0x10edd6[_0xa0b5('0x44')]=_0x5d55ef;return _0x10edd6;})['then'](respondWithFilteredResult(_0x46a178,_0x1e243a))[_0xa0b5('0x45')](handleError(_0x46a178,null));};exports[_0xa0b5('0x46')]=function(_0x2824cd,_0xf20f5f){var _0x19b04c={'raw':![],'where':{'id':_0x2824cd[_0xa0b5('0x47')]['id']}},_0x6d5745={};_0x6d5745[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db['FreshsalesConfiguration'][_0xa0b5('0x2c')]);_0x6d5745['query']=_[_0xa0b5('0x32')](_0x2824cd[_0xa0b5('0x31')]);_0x6d5745[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x6d5745[_0xa0b5('0x30')],_0x6d5745[_0xa0b5('0x31')]);_0x19b04c[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x6d5745[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x2824cd[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x19b04c[_0xa0b5('0x35')]=_0x19b04c[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x19b04c[_0xa0b5('0x35')]:_0x6d5745['model'];if(_0x2824cd[_0xa0b5('0x31')]['includeAll']){_0x19b04c[_0xa0b5('0x42')]=[{'all':!![]}];}_0x19b04c=_[_0xa0b5('0x3d')]({},_0x19b04c,_0x2824cd[_0xa0b5('0x3f')]);return db[_0xa0b5('0x40')][_0xa0b5('0x48')](_0x19b04c)[_0xa0b5('0x27')](handleEntityNotFound(_0xf20f5f,null))[_0xa0b5('0x27')](respondWithResult(_0xf20f5f,null))[_0xa0b5('0x45')](handleError(_0xf20f5f,null));};exports[_0xa0b5('0x49')]=function(_0x13a5fd,_0x5578c5){return db['FreshsalesConfiguration'][_0xa0b5('0x49')](_0x13a5fd[_0xa0b5('0x4a')],{})[_0xa0b5('0x27')](respondWithResult(_0x5578c5,0xc9))[_0xa0b5('0x45')](handleError(_0x5578c5,null));};exports[_0xa0b5('0x4b')]=function(_0x47b87d,_0x30e161){if(_0x47b87d[_0xa0b5('0x4a')]['id']){delete _0x47b87d[_0xa0b5('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0xa0b5('0x48')]({'where':{'id':_0x47b87d[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x30e161,null))[_0xa0b5('0x27')](saveUpdates(_0x47b87d[_0xa0b5('0x4a')],null))['then'](respondWithResult(_0x30e161,null))[_0xa0b5('0x45')](handleError(_0x30e161,null));};exports[_0xa0b5('0x28')]=function(_0x11771,_0x31bcbe){return db['FreshsalesConfiguration'][_0xa0b5('0x48')]({'where':{'id':_0x11771['params']['id']}})['then'](handleEntityNotFound(_0x31bcbe,null))[_0xa0b5('0x27')](removeEntity(_0x31bcbe,null))[_0xa0b5('0x45')](handleError(_0x31bcbe,null));};exports[_0xa0b5('0x4c')]=function(_0x2ff85a,_0x1e7d3e,_0x300da8){var _0x540d19={};var _0x4d52f1={};var _0x2f2ab9;var _0x52cd90;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x2ff85a[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x1e7d3e,null))['then'](function(_0x31b707){if(_0x31b707){_0x2f2ab9=_0x31b707;_0x4d52f1[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x4d52f1['query']=_['keys'](_0x2ff85a[_0xa0b5('0x31')]);_0x4d52f1[_0xa0b5('0x33')]=_[_0xa0b5('0x34')](_0x4d52f1[_0xa0b5('0x30')],_0x4d52f1[_0xa0b5('0x31')]);_0x540d19[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x4d52f1['model'],qs[_0xa0b5('0x36')](_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x540d19[_0xa0b5('0x35')]=_0x540d19[_0xa0b5('0x35')]['length']?_0x540d19[_0xa0b5('0x35')]:_0x4d52f1['model'];_0x540d19['order']=qs['sort'](_0x2ff85a['query'][_0xa0b5('0x39')]);_0x540d19[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_['pick'](_0x2ff85a['query'],_0x4d52f1[_0xa0b5('0x33')]));if(_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x540d19[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x540d19[_0xa0b5('0x3a')],{'$or':_['map'](_0x540d19[_0xa0b5('0x35')],function(_0x338fc5){var _0x5a55c5={};_0x5a55c5[_0x338fc5]={'$like':'%'+_0x2ff85a[_0xa0b5('0x31')]['filter']+'%'};return _0x5a55c5;})});}_0x540d19=_['merge']({},_0x540d19,_0x2ff85a[_0xa0b5('0x3f')]);return _0x2f2ab9['getSubjects'](_0x540d19);}})['then'](function(_0x2208b9){if(_0x2208b9){_0x52cd90=_0x2208b9[_0xa0b5('0x37')];if(!_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x4e')](_0xa0b5('0x4f'))){_0x540d19['limit']=qs[_0xa0b5('0x21')](_0x2ff85a[_0xa0b5('0x31')][_0xa0b5('0x21')]);_0x540d19[_0xa0b5('0x1e')]=qs[_0xa0b5('0x1e')](_0x2ff85a['query'][_0xa0b5('0x1e')]);}return _0x2f2ab9[_0xa0b5('0x4c')](_0x540d19);}})['then'](function(_0x4490ec){if(_0x4490ec){return _0x4490ec?{'count':_0x52cd90,'rows':_0x4490ec}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x1e7d3e,null))[_0xa0b5('0x45')](handleError(_0x1e7d3e,null));};exports['getDescriptions']=function(_0x4bc37c,_0x83d511,_0x8c53d){var _0x3a6486={};var _0x4378f0={};var _0x14f830;var _0x4b2c8a;return db[_0xa0b5('0x40')]['findOne']({'where':{'id':_0x4bc37c[_0xa0b5('0x47')]['id']}})[_0xa0b5('0x27')](handleEntityNotFound(_0x83d511,null))[_0xa0b5('0x27')](function(_0x1a23cb){if(_0x1a23cb){_0x14f830=_0x1a23cb;_0x4378f0['model']=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x4378f0[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x4bc37c[_0xa0b5('0x31')]);_0x4378f0['filters']=_[_0xa0b5('0x34')](_0x4378f0[_0xa0b5('0x30')],_0x4378f0[_0xa0b5('0x31')]);_0x3a6486['attributes']=_[_0xa0b5('0x34')](_0x4378f0[_0xa0b5('0x30')],qs['fields'](_0x4bc37c[_0xa0b5('0x31')]['fields']));_0x3a6486['attributes']=_0x3a6486[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x3a6486['attributes']:_0x4378f0[_0xa0b5('0x30')];_0x3a6486[_0xa0b5('0x38')]=qs[_0xa0b5('0x39')](_0x4bc37c[_0xa0b5('0x31')]['sort']);_0x3a6486[_0xa0b5('0x3a')]=qs[_0xa0b5('0x33')](_['pick'](_0x4bc37c[_0xa0b5('0x31')],_0x4378f0[_0xa0b5('0x33')]));if(_0x4bc37c['query'][_0xa0b5('0x3c')]){_0x3a6486[_0xa0b5('0x3a')]=_[_0xa0b5('0x3d')](_0x3a6486[_0xa0b5('0x3a')],{'$or':_['map'](_0x3a6486['attributes'],function(_0x16a2a7){var _0xd7fdc={};_0xd7fdc[_0x16a2a7]={'$like':'%'+_0x4bc37c['query']['filter']+'%'};return _0xd7fdc;})});}_0x3a6486=_['merge']({},_0x3a6486,_0x4bc37c[_0xa0b5('0x3f')]);return _0x14f830['getDescriptions'](_0x3a6486);}})[_0xa0b5('0x27')](function(_0x2d5104){if(_0x2d5104){_0x4b2c8a=_0x2d5104['length'];if(!_0x4bc37c[_0xa0b5('0x31')][_0xa0b5('0x4e')]('nolimit')){_0x3a6486[_0xa0b5('0x21')]=qs[_0xa0b5('0x21')](_0x4bc37c['query'][_0xa0b5('0x21')]);_0x3a6486['offset']=qs[_0xa0b5('0x1e')](_0x4bc37c[_0xa0b5('0x31')][_0xa0b5('0x1e')]);}return _0x14f830[_0xa0b5('0x50')](_0x3a6486);}})['then'](function(_0x53002b){if(_0x53002b){return _0x53002b?{'count':_0x4b2c8a,'rows':_0x53002b}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x83d511,null))['catch'](handleError(_0x83d511,null));};exports[_0xa0b5('0x51')]=function(_0x7eb729,_0x1de792,_0x554a95){var _0x2a0e08={};var _0x1a0611={};var _0x2a3ee5;var _0x239e77;return db[_0xa0b5('0x40')][_0xa0b5('0x52')]({'where':{'id':_0x7eb729['params']['id']}})['then'](handleEntityNotFound(_0x1de792,null))['then'](function(_0x234359){if(_0x234359){_0x2a3ee5=_0x234359;_0x1a0611[_0xa0b5('0x30')]=_[_0xa0b5('0x32')](db[_0xa0b5('0x4d')][_0xa0b5('0x2c')]);_0x1a0611[_0xa0b5('0x31')]=_[_0xa0b5('0x32')](_0x7eb729[_0xa0b5('0x31')]);_0x1a0611[_0xa0b5('0x33')]=_['intersection'](_0x1a0611[_0xa0b5('0x30')],_0x1a0611[_0xa0b5('0x31')]);_0x2a0e08[_0xa0b5('0x35')]=_[_0xa0b5('0x34')](_0x1a0611[_0xa0b5('0x30')],qs[_0xa0b5('0x36')](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x36')]));_0x2a0e08['attributes']=_0x2a0e08[_0xa0b5('0x35')][_0xa0b5('0x37')]?_0x2a0e08['attributes']:_0x1a0611[_0xa0b5('0x30')];_0x2a0e08[_0xa0b5('0x38')]=qs['sort'](_0x7eb729[_0xa0b5('0x31')]['sort']);_0x2a0e08['where']=qs[_0xa0b5('0x33')](_[_0xa0b5('0x3b')](_0x7eb729['query'],_0x1a0611[_0xa0b5('0x33')]));if(_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x3c')]){_0x2a0e08[_0xa0b5('0x3a')]=_['merge'](_0x2a0e08['where'],{'$or':_[_0xa0b5('0x53')](_0x2a0e08[_0xa0b5('0x35')],function(_0x23617c){var _0x1d76b={};_0x1d76b[_0x23617c]={'$like':'%'+_0x7eb729[_0xa0b5('0x31')]['filter']+'%'};return _0x1d76b;})});}_0x2a0e08=_[_0xa0b5('0x3d')]({},_0x2a0e08,_0x7eb729[_0xa0b5('0x3f')]);return _0x2a3ee5['getFields'](_0x2a0e08);}})['then'](function(_0x47a4bc){if(_0x47a4bc){_0x239e77=_0x47a4bc[_0xa0b5('0x37')];if(!_0x7eb729['query']['hasOwnProperty'](_0xa0b5('0x4f'))){_0x2a0e08[_0xa0b5('0x21')]=qs[_0xa0b5('0x21')](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x21')]);_0x2a0e08[_0xa0b5('0x1e')]=qs['offset'](_0x7eb729[_0xa0b5('0x31')][_0xa0b5('0x1e')]);}return _0x2a3ee5['getFields'](_0x2a0e08);}})['then'](function(_0x55c47c){if(_0x55c47c){return _0x55c47c?{'count':_0x239e77,'rows':_0x55c47c}:null;}})[_0xa0b5('0x27')](respondWithResult(_0x1de792,null))[_0xa0b5('0x45')](handleError(_0x1de792,null));}; \ No newline at end of file +var _0x5dc0=['FreshsalesField','getDescriptions','findOne','rawAttributes','getFields','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','reject','save','update','then','destroy','stack','name','send','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','find','create','body','params','getSubjects'];(function(_0x97f00f,_0x164c74){var _0x285847=function(_0x1e3f24){while(--_0x1e3f24){_0x97f00f['push'](_0x97f00f['shift']());}};_0x285847(++_0x164c74);}(_0x5dc0,0x1df));var _0x05dc=function(_0x4522c0,_0x2b54aa){_0x4522c0=_0x4522c0-0x0;var _0x42bf04=_0x5dc0[_0x4522c0];return _0x42bf04;};'use strict';var emlformat=require(_0x05dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05dc('0x1'));var rp=require(_0x05dc('0x2'));var moment=require(_0x05dc('0x3'));var BPromise=require(_0x05dc('0x4'));var Mustache=require(_0x05dc('0x5'));var util=require(_0x05dc('0x6'));var path=require(_0x05dc('0x7'));var sox=require('sox');var csv=require(_0x05dc('0x8'));var ejs=require(_0x05dc('0x9'));var fs=require('fs');var fs_extra=require(_0x05dc('0xa'));var _=require(_0x05dc('0xb'));var squel=require(_0x05dc('0xc'));var crypto=require(_0x05dc('0xd'));var jsforce=require(_0x05dc('0xe'));var deskjs=require(_0x05dc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x05dc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x05dc('0x11'));var as=require(_0x05dc('0x12'));var hardwareService=require(_0x05dc('0x13'));var logger=require(_0x05dc('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x05dc('0x15'));var licenseUtil=require(_0x05dc('0x16'));var db=require(_0x05dc('0x17'))['db'];function respondWithStatusCode(_0x17ac7f,_0x750814){_0x750814=_0x750814||0xcc;return function(_0x176c95){if(_0x176c95){return _0x17ac7f['sendStatus'](_0x750814);}return _0x17ac7f[_0x05dc('0x18')](_0x750814)[_0x05dc('0x19')]();};}function respondWithResult(_0x149e40,_0x4a39ea){_0x4a39ea=_0x4a39ea||0xc8;return function(_0x331505){if(_0x331505){return _0x149e40[_0x05dc('0x18')](_0x4a39ea)[_0x05dc('0x1a')](_0x331505);}};}function respondWithFilteredResult(_0x344f43,_0x4bb34e){return function(_0x3913b1){if(_0x3913b1){var _0x3302d7=typeof _0x4bb34e[_0x05dc('0x1b')]===_0x05dc('0x1c')&&typeof _0x4bb34e[_0x05dc('0x1d')]==='undefined';var _0x383e9c=_0x3913b1[_0x05dc('0x1e')];var _0x1ff920=_0x3302d7?0x0:_0x4bb34e[_0x05dc('0x1b')];var _0xfa28c7=_0x3302d7?_0x3913b1[_0x05dc('0x1e')]:_0x4bb34e[_0x05dc('0x1b')]+_0x4bb34e['limit'];var _0x566acd;if(_0xfa28c7>=_0x383e9c){_0xfa28c7=_0x383e9c;_0x566acd=0xc8;}else{_0x566acd=0xce;}_0x344f43[_0x05dc('0x18')](_0x566acd);return _0x344f43[_0x05dc('0x1f')](_0x05dc('0x20'),_0x1ff920+'-'+_0xfa28c7+'/'+_0x383e9c)[_0x05dc('0x1a')](_0x3913b1);}return null;};}function patchUpdates(_0x29bf02){return function(_0x39983f){try{jsonpatch[_0x05dc('0x21')](_0x39983f,_0x29bf02,!![]);}catch(_0xf7995d){return BPromise[_0x05dc('0x22')](_0xf7995d);}return _0x39983f[_0x05dc('0x23')]();};}function saveUpdates(_0x535708,_0x468eef){return function(_0x5afe50){if(_0x5afe50){return _0x5afe50[_0x05dc('0x24')](_0x535708)[_0x05dc('0x25')](function(_0x247950){return _0x247950;});}return null;};}function removeEntity(_0x337b40,_0x2921e2){return function(_0x3e9864){if(_0x3e9864){return _0x3e9864[_0x05dc('0x26')]()[_0x05dc('0x25')](function(){_0x337b40[_0x05dc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274504,_0x1f1f6f){return function(_0x5a7650){if(!_0x5a7650){_0x274504['sendStatus'](0x194);}return _0x5a7650;};}function handleError(_0x5dbbf7,_0x154e72){_0x154e72=_0x154e72||0x1f4;return function(_0x530f86){logger['error'](_0x530f86[_0x05dc('0x27')]);if(_0x530f86[_0x05dc('0x28')]){delete _0x530f86[_0x05dc('0x28')];}_0x5dbbf7[_0x05dc('0x18')](_0x154e72)[_0x05dc('0x29')](_0x530f86);};}exports['index']=function(_0x2f5d90,_0xb28421){var _0x1fa1fd={},_0xe1b461={},_0x42656a={'count':0x0,'rows':[]};var _0x417092=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x2c93fa){return{'name':_0x2c93fa['fieldName'],'type':_0x2c93fa['type'][_0x05dc('0x2a')]};});_0xe1b461[_0x05dc('0x2b')]=_[_0x05dc('0x2c')](_0x417092,_0x05dc('0x28'));_0xe1b461[_0x05dc('0x2d')]=_[_0x05dc('0x2e')](_0x2f5d90['query']);_0xe1b461['filters']=_['intersection'](_0xe1b461[_0x05dc('0x2b')],_0xe1b461[_0x05dc('0x2d')]);_0x1fa1fd[_0x05dc('0x2f')]=_[_0x05dc('0x30')](_0xe1b461[_0x05dc('0x2b')],qs[_0x05dc('0x31')](_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x31')]));_0x1fa1fd['attributes']=_0x1fa1fd['attributes'][_0x05dc('0x32')]?_0x1fa1fd['attributes']:_0xe1b461[_0x05dc('0x2b')];if(!_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x33')](_0x05dc('0x34'))){_0x1fa1fd[_0x05dc('0x1d')]=qs['limit'](_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x1d')]);_0x1fa1fd[_0x05dc('0x1b')]=qs[_0x05dc('0x1b')](_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x1b')]);}_0x1fa1fd[_0x05dc('0x35')]=qs[_0x05dc('0x36')](_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x36')]);_0x1fa1fd[_0x05dc('0x37')]=qs['filters'](_[_0x05dc('0x38')](_0x2f5d90['query'],_0xe1b461[_0x05dc('0x39')]),_0x417092);if(_0x2f5d90[_0x05dc('0x2d')]['filter']){_0x1fa1fd[_0x05dc('0x37')]=_[_0x05dc('0x3a')](_0x1fa1fd[_0x05dc('0x37')],{'$or':_[_0x05dc('0x2c')](_0x417092,function(_0x40be9c){if(_0x40be9c[_0x05dc('0x3b')]!==_0x05dc('0x3c')){var _0x96c951={};_0x96c951[_0x40be9c[_0x05dc('0x28')]]={'$like':'%'+_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x3d')]+'%'};return _0x96c951;}})});}_0x1fa1fd=_[_0x05dc('0x3a')]({},_0x1fa1fd,_0x2f5d90[_0x05dc('0x3e')]);var _0xdbecbe={'where':_0x1fa1fd[_0x05dc('0x37')]};return db[_0x05dc('0x3f')][_0x05dc('0x1e')](_0xdbecbe)[_0x05dc('0x25')](function(_0x14db43){_0x42656a[_0x05dc('0x1e')]=_0x14db43;if(_0x2f5d90[_0x05dc('0x2d')][_0x05dc('0x40')]){_0x1fa1fd[_0x05dc('0x41')]=[{'all':!![]}];}return db[_0x05dc('0x3f')][_0x05dc('0x42')](_0x1fa1fd);})[_0x05dc('0x25')](function(_0x34e1b4){_0x42656a[_0x05dc('0x43')]=_0x34e1b4;return _0x42656a;})[_0x05dc('0x25')](respondWithFilteredResult(_0xb28421,_0x1fa1fd))[_0x05dc('0x44')](handleError(_0xb28421,null));};exports['show']=function(_0x6be139,_0x3c0a88){var _0x4906fd={'raw':![],'where':{'id':_0x6be139['params']['id']}},_0x46bb9d={};_0x46bb9d[_0x05dc('0x2b')]=_[_0x05dc('0x2e')](db[_0x05dc('0x3f')]['rawAttributes']);_0x46bb9d[_0x05dc('0x2d')]=_[_0x05dc('0x2e')](_0x6be139[_0x05dc('0x2d')]);_0x46bb9d[_0x05dc('0x39')]=_['intersection'](_0x46bb9d[_0x05dc('0x2b')],_0x46bb9d[_0x05dc('0x2d')]);_0x4906fd['attributes']=_['intersection'](_0x46bb9d[_0x05dc('0x2b')],qs[_0x05dc('0x31')](_0x6be139[_0x05dc('0x2d')][_0x05dc('0x31')]));_0x4906fd[_0x05dc('0x2f')]=_0x4906fd[_0x05dc('0x2f')][_0x05dc('0x32')]?_0x4906fd[_0x05dc('0x2f')]:_0x46bb9d[_0x05dc('0x2b')];if(_0x6be139[_0x05dc('0x2d')][_0x05dc('0x40')]){_0x4906fd[_0x05dc('0x41')]=[{'all':!![]}];}_0x4906fd=_['merge']({},_0x4906fd,_0x6be139[_0x05dc('0x3e')]);return db[_0x05dc('0x3f')][_0x05dc('0x45')](_0x4906fd)['then'](handleEntityNotFound(_0x3c0a88,null))[_0x05dc('0x25')](respondWithResult(_0x3c0a88,null))[_0x05dc('0x44')](handleError(_0x3c0a88,null));};exports[_0x05dc('0x46')]=function(_0x435105,_0x1ffd3e){return db[_0x05dc('0x3f')][_0x05dc('0x46')](_0x435105[_0x05dc('0x47')],{})['then'](respondWithResult(_0x1ffd3e,0xc9))['catch'](handleError(_0x1ffd3e,null));};exports['update']=function(_0x4fc6f7,_0x18614d){if(_0x4fc6f7['body']['id']){delete _0x4fc6f7[_0x05dc('0x47')]['id'];}return db[_0x05dc('0x3f')][_0x05dc('0x45')]({'where':{'id':_0x4fc6f7[_0x05dc('0x48')]['id']}})[_0x05dc('0x25')](handleEntityNotFound(_0x18614d,null))[_0x05dc('0x25')](saveUpdates(_0x4fc6f7[_0x05dc('0x47')],null))[_0x05dc('0x25')](respondWithResult(_0x18614d,null))[_0x05dc('0x44')](handleError(_0x18614d,null));};exports[_0x05dc('0x26')]=function(_0x2227e5,_0x301290){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2227e5['params']['id']}})['then'](handleEntityNotFound(_0x301290,null))[_0x05dc('0x25')](removeEntity(_0x301290,null))['catch'](handleError(_0x301290,null));};exports[_0x05dc('0x49')]=function(_0x217a88,_0xe7f0f6,_0x317c87){var _0x246e88={};var _0xe627af={};var _0x3241d1;var _0x28ce44;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x217a88[_0x05dc('0x48')]['id']}})[_0x05dc('0x25')](handleEntityNotFound(_0xe7f0f6,null))[_0x05dc('0x25')](function(_0x1aa7ee){if(_0x1aa7ee){_0x3241d1=_0x1aa7ee;_0xe627af[_0x05dc('0x2b')]=_['keys'](db[_0x05dc('0x4a')]['rawAttributes']);_0xe627af['query']=_[_0x05dc('0x2e')](_0x217a88['query']);_0xe627af[_0x05dc('0x39')]=_[_0x05dc('0x30')](_0xe627af['model'],_0xe627af[_0x05dc('0x2d')]);_0x246e88[_0x05dc('0x2f')]=_[_0x05dc('0x30')](_0xe627af[_0x05dc('0x2b')],qs[_0x05dc('0x31')](_0x217a88[_0x05dc('0x2d')][_0x05dc('0x31')]));_0x246e88[_0x05dc('0x2f')]=_0x246e88['attributes']['length']?_0x246e88[_0x05dc('0x2f')]:_0xe627af[_0x05dc('0x2b')];_0x246e88[_0x05dc('0x35')]=qs[_0x05dc('0x36')](_0x217a88['query']['sort']);_0x246e88['where']=qs['filters'](_['pick'](_0x217a88[_0x05dc('0x2d')],_0xe627af[_0x05dc('0x39')]));if(_0x217a88[_0x05dc('0x2d')]['filter']){_0x246e88[_0x05dc('0x37')]=_[_0x05dc('0x3a')](_0x246e88[_0x05dc('0x37')],{'$or':_[_0x05dc('0x2c')](_0x246e88[_0x05dc('0x2f')],function(_0xf8c2d3){var _0x103ad8={};_0x103ad8[_0xf8c2d3]={'$like':'%'+_0x217a88[_0x05dc('0x2d')][_0x05dc('0x3d')]+'%'};return _0x103ad8;})});}_0x246e88=_[_0x05dc('0x3a')]({},_0x246e88,_0x217a88['options']);return _0x3241d1['getSubjects'](_0x246e88);}})['then'](function(_0x58d228){if(_0x58d228){_0x28ce44=_0x58d228[_0x05dc('0x32')];if(!_0x217a88[_0x05dc('0x2d')][_0x05dc('0x33')](_0x05dc('0x34'))){_0x246e88[_0x05dc('0x1d')]=qs['limit'](_0x217a88['query'][_0x05dc('0x1d')]);_0x246e88[_0x05dc('0x1b')]=qs[_0x05dc('0x1b')](_0x217a88[_0x05dc('0x2d')][_0x05dc('0x1b')]);}return _0x3241d1[_0x05dc('0x49')](_0x246e88);}})[_0x05dc('0x25')](function(_0x2e67d4){if(_0x2e67d4){return _0x2e67d4?{'count':_0x28ce44,'rows':_0x2e67d4}:null;}})[_0x05dc('0x25')](respondWithResult(_0xe7f0f6,null))[_0x05dc('0x44')](handleError(_0xe7f0f6,null));};exports[_0x05dc('0x4b')]=function(_0x2e4d05,_0x21c004,_0x4f15a6){var _0x1c388a={};var _0x16eb43={};var _0x847e88;var _0x280ab8;return db[_0x05dc('0x3f')][_0x05dc('0x4c')]({'where':{'id':_0x2e4d05[_0x05dc('0x48')]['id']}})[_0x05dc('0x25')](handleEntityNotFound(_0x21c004,null))['then'](function(_0x5cb74b){if(_0x5cb74b){_0x847e88=_0x5cb74b;_0x16eb43[_0x05dc('0x2b')]=_[_0x05dc('0x2e')](db['FreshsalesField'][_0x05dc('0x4d')]);_0x16eb43[_0x05dc('0x2d')]=_[_0x05dc('0x2e')](_0x2e4d05[_0x05dc('0x2d')]);_0x16eb43[_0x05dc('0x39')]=_[_0x05dc('0x30')](_0x16eb43[_0x05dc('0x2b')],_0x16eb43['query']);_0x1c388a[_0x05dc('0x2f')]=_['intersection'](_0x16eb43[_0x05dc('0x2b')],qs[_0x05dc('0x31')](_0x2e4d05[_0x05dc('0x2d')][_0x05dc('0x31')]));_0x1c388a[_0x05dc('0x2f')]=_0x1c388a[_0x05dc('0x2f')][_0x05dc('0x32')]?_0x1c388a[_0x05dc('0x2f')]:_0x16eb43[_0x05dc('0x2b')];_0x1c388a[_0x05dc('0x35')]=qs[_0x05dc('0x36')](_0x2e4d05['query'][_0x05dc('0x36')]);_0x1c388a[_0x05dc('0x37')]=qs[_0x05dc('0x39')](_[_0x05dc('0x38')](_0x2e4d05['query'],_0x16eb43[_0x05dc('0x39')]));if(_0x2e4d05['query'][_0x05dc('0x3d')]){_0x1c388a[_0x05dc('0x37')]=_['merge'](_0x1c388a[_0x05dc('0x37')],{'$or':_[_0x05dc('0x2c')](_0x1c388a[_0x05dc('0x2f')],function(_0x4ff04b){var _0x207361={};_0x207361[_0x4ff04b]={'$like':'%'+_0x2e4d05[_0x05dc('0x2d')][_0x05dc('0x3d')]+'%'};return _0x207361;})});}_0x1c388a=_['merge']({},_0x1c388a,_0x2e4d05[_0x05dc('0x3e')]);return _0x847e88[_0x05dc('0x4b')](_0x1c388a);}})[_0x05dc('0x25')](function(_0x66b49e){if(_0x66b49e){_0x280ab8=_0x66b49e[_0x05dc('0x32')];if(!_0x2e4d05[_0x05dc('0x2d')][_0x05dc('0x33')](_0x05dc('0x34'))){_0x1c388a['limit']=qs[_0x05dc('0x1d')](_0x2e4d05['query'][_0x05dc('0x1d')]);_0x1c388a[_0x05dc('0x1b')]=qs['offset'](_0x2e4d05[_0x05dc('0x2d')]['offset']);}return _0x847e88['getDescriptions'](_0x1c388a);}})[_0x05dc('0x25')](function(_0x227497){if(_0x227497){return _0x227497?{'count':_0x280ab8,'rows':_0x227497}:null;}})[_0x05dc('0x25')](respondWithResult(_0x21c004,null))[_0x05dc('0x44')](handleError(_0x21c004,null));};exports[_0x05dc('0x4e')]=function(_0x2f53c3,_0x360066,_0xd1f4e2){var _0x2c4495={};var _0x165c08={};var _0xbd67df;var _0x5b1e2b;return db[_0x05dc('0x3f')]['findOne']({'where':{'id':_0x2f53c3['params']['id']}})[_0x05dc('0x25')](handleEntityNotFound(_0x360066,null))[_0x05dc('0x25')](function(_0x3e0033){if(_0x3e0033){_0xbd67df=_0x3e0033;_0x165c08[_0x05dc('0x2b')]=_['keys'](db[_0x05dc('0x4a')]['rawAttributes']);_0x165c08[_0x05dc('0x2d')]=_['keys'](_0x2f53c3[_0x05dc('0x2d')]);_0x165c08[_0x05dc('0x39')]=_[_0x05dc('0x30')](_0x165c08[_0x05dc('0x2b')],_0x165c08[_0x05dc('0x2d')]);_0x2c4495[_0x05dc('0x2f')]=_['intersection'](_0x165c08[_0x05dc('0x2b')],qs[_0x05dc('0x31')](_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x31')]));_0x2c4495['attributes']=_0x2c4495['attributes']['length']?_0x2c4495[_0x05dc('0x2f')]:_0x165c08['model'];_0x2c4495[_0x05dc('0x35')]=qs['sort'](_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x36')]);_0x2c4495[_0x05dc('0x37')]=qs['filters'](_[_0x05dc('0x38')](_0x2f53c3[_0x05dc('0x2d')],_0x165c08[_0x05dc('0x39')]));if(_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x3d')]){_0x2c4495[_0x05dc('0x37')]=_[_0x05dc('0x3a')](_0x2c4495['where'],{'$or':_[_0x05dc('0x2c')](_0x2c4495[_0x05dc('0x2f')],function(_0xb73b24){var _0x201531={};_0x201531[_0xb73b24]={'$like':'%'+_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x3d')]+'%'};return _0x201531;})});}_0x2c4495=_[_0x05dc('0x3a')]({},_0x2c4495,_0x2f53c3[_0x05dc('0x3e')]);return _0xbd67df[_0x05dc('0x4e')](_0x2c4495);}})[_0x05dc('0x25')](function(_0xf8d8f8){if(_0xf8d8f8){_0x5b1e2b=_0xf8d8f8[_0x05dc('0x32')];if(!_0x2f53c3[_0x05dc('0x2d')]['hasOwnProperty']('nolimit')){_0x2c4495['limit']=qs[_0x05dc('0x1d')](_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x1d')]);_0x2c4495[_0x05dc('0x1b')]=qs['offset'](_0x2f53c3[_0x05dc('0x2d')][_0x05dc('0x1b')]);}return _0xbd67df['getFields'](_0x2c4495);}})[_0x05dc('0x25')](function(_0x1627d3){if(_0x1627d3){return _0x1627d3?{'count':_0x5b1e2b,'rows':_0x1627d3}:null;}})[_0x05dc('0x25')](respondWithResult(_0x360066,null))[_0x05dc('0x44')](handleError(_0x360066,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7bcb7a1..7281c35 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 _0x0c10=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1fd4cb,_0x25f3ee){var _0x45e715=function(_0x3e8e3a){while(--_0x3e8e3a){_0x1fd4cb['push'](_0x1fd4cb['shift']());}};_0x45e715(++_0x25f3ee);}(_0x0c10,0xfe));var _0x00c1=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x0c10[_0x40ad05];return _0x5cc00f;};'use strict';var _=require(_0x00c1('0x0'));var util=require(_0x00c1('0x1'));var logger=require(_0x00c1('0x2'))(_0x00c1('0x3'));var moment=require(_0x00c1('0x4'));var BPromise=require(_0x00c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00c1('0x6'));var rimraf=require(_0x00c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x00c1('0x8'));module[_0x00c1('0x9')]=function(_0x5151f6,_0x4fb8c2){return _0x5151f6[_0x00c1('0xa')](_0x00c1('0xb'),attributes,{'tableName':_0x00c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa024=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa024,0x10d));var _0x4a02=function(_0x31ac37,_0x9a1aa9){_0x31ac37=_0x31ac37-0x0;var _0x1c5c9e=_0xa024[_0x31ac37];return _0x1c5c9e;};'use strict';var _=require(_0x4a02('0x0'));var util=require('util');var logger=require(_0x4a02('0x1'))(_0x4a02('0x2'));var moment=require(_0x4a02('0x3'));var BPromise=require(_0x4a02('0x4'));var rp=require(_0x4a02('0x5'));var fs=require('fs');var path=require(_0x4a02('0x6'));var rimraf=require(_0x4a02('0x7'));var config=require(_0x4a02('0x8'));var attributes=require(_0x4a02('0x9'));module[_0x4a02('0xa')]=function(_0x1af73a,_0x270f2f){return _0x1af73a[_0x4a02('0xb')](_0x4a02('0xc'),attributes,{'tableName':_0x4a02('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b5488bc..ed0d2b0 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 _0xd81f=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xd81f,0x8a));var _0xfd81=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd81f[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0xfd81('0x0'));var util=require(_0xfd81('0x1'));var moment=require(_0xfd81('0x2'));var BPromise=require(_0xfd81('0x3'));var rs=require(_0xfd81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd81('0x5'))['db'];var utils=require(_0xfd81('0x6'));var logger=require(_0xfd81('0x7'))(_0xfd81('0x8'));var config=require(_0xfd81('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ef3fe,_0x1ab8e3,_0x28f5a2){return new BPromise(function(_0x473981,_0x2759b7){return client[_0xfd81('0xb')](_0x2ef3fe,_0x28f5a2)[_0xfd81('0xc')](function(_0x373491){logger[_0xfd81('0xd')](_0xfd81('0xe'),_0x1ab8e3,'request\x20sent');logger[_0xfd81('0xf')](_0xfd81('0x10'),_0x1ab8e3,'request\x20sent',JSON['stringify'](_0x373491));if(_0x373491[_0xfd81('0x11')]){if(_0x373491[_0xfd81('0x11')][_0xfd81('0x12')]===0x1f4){logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x373491[_0xfd81('0x11')][_0xfd81('0x13')]);return _0x2759b7(_0x373491[_0xfd81('0x11')]['message']);}logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x373491[_0xfd81('0x11')][_0xfd81('0x13')]);return _0x473981(_0x373491['error'][_0xfd81('0x13')]);}else{logger[_0xfd81('0xd')](_0xfd81('0xe'),_0x1ab8e3,_0xfd81('0x14'));_0x473981(_0x373491[_0xfd81('0x15')][_0xfd81('0x13')]);}})['catch'](function(_0x298152){logger[_0xfd81('0x11')](_0xfd81('0xe'),_0x1ab8e3,_0x298152);_0x2759b7(_0x298152);});});} \ No newline at end of file +var _0x6ada=['code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f56ff,_0x2515cf){var _0x269e80=function(_0x309763){while(--_0x309763){_0x2f56ff['push'](_0x2f56ff['shift']());}};_0x269e80(++_0x2515cf);}(_0x6ada,0x15e));var _0xa6ad=function(_0x501cc2,_0x440b99){_0x501cc2=_0x501cc2-0x0;var _0x3390df=_0x6ada[_0x501cc2];return _0x3390df;};'use strict';var _=require(_0xa6ad('0x0'));var util=require(_0xa6ad('0x1'));var moment=require(_0xa6ad('0x2'));var BPromise=require(_0xa6ad('0x3'));var rs=require(_0xa6ad('0x4'));var fs=require('fs');var Redis=require(_0xa6ad('0x5'));var db=require(_0xa6ad('0x6'))['db'];var utils=require(_0xa6ad('0x7'));var logger=require('../../config/logger')(_0xa6ad('0x8'));var config=require('../../config/environment');var jayson=require(_0xa6ad('0x9'));var client=jayson[_0xa6ad('0xa')][_0xa6ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x476d3c,_0xbe083b,_0x59f04d){return new BPromise(function(_0x1810b3,_0x130bea){return client[_0xa6ad('0xc')](_0x476d3c,_0x59f04d)['then'](function(_0x279380){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xbe083b,_0xa6ad('0xd'));logger[_0xa6ad('0xe')](_0xa6ad('0xf'),_0xbe083b,_0xa6ad('0xd'),JSON[_0xa6ad('0x10')](_0x279380));if(_0x279380[_0xa6ad('0x11')]){if(_0x279380[_0xa6ad('0x11')][_0xa6ad('0x12')]===0x1f4){logger[_0xa6ad('0x11')](_0xa6ad('0x13'),_0xbe083b,_0x279380['error']['message']);return _0x130bea(_0x279380[_0xa6ad('0x11')][_0xa6ad('0x14')]);}logger[_0xa6ad('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xbe083b,_0x279380[_0xa6ad('0x11')][_0xa6ad('0x14')]);return _0x1810b3(_0x279380[_0xa6ad('0x11')]['message']);}else{logger['info'](_0xa6ad('0x13'),_0xbe083b,_0xa6ad('0xd'));_0x1810b3(_0x279380[_0xa6ad('0x15')][_0xa6ad('0x14')]);}})[_0xa6ad('0x16')](function(_0x31d01c){logger[_0xa6ad('0x11')](_0xa6ad('0x13'),_0xbe083b,_0x31d01c);_0x130bea(_0x31d01c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index fe87924..726c13b 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 _0xc737=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x20d32c,_0x433c36){var _0x546acf=function(_0x1b4ffb){while(--_0x1b4ffb){_0x20d32c['push'](_0x20d32c['shift']());}};_0x546acf(++_0x433c36);}(_0xc737,0x154));var _0x7c73=function(_0xffaf6f,_0x3833bc){_0xffaf6f=_0xffaf6f-0x0;var _0x42bcf2=_0xc737[_0xffaf6f];return _0x42bcf2;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require(_0x7c73('0x2'));var timeout=require(_0x7c73('0x3'));var express=require('express');var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c73('0x7'));var controller=require(_0x7c73('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c73('0x9')]);router[_0x7c73('0xa')]('/:id',auth[_0x7c73('0xb')](),controller[_0x7c73('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c73('0xd')]);router[_0x7c73('0xe')](_0x7c73('0xf'),auth['isAuthenticated'](),controller[_0x7c73('0x10')]);router[_0x7c73('0x11')]('/:id',auth[_0x7c73('0xb')](),controller['destroy']);module[_0x7c73('0x12')]=router; \ No newline at end of file +var _0xc678=['update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','/:id'];(function(_0x1aedb8,_0x351d31){var _0x10b0d0=function(_0x39809e){while(--_0x39809e){_0x1aedb8['push'](_0x1aedb8['shift']());}};_0x10b0d0(++_0x351d31);}(_0xc678,0x1b4));var _0x8c67=function(_0x59e7b3,_0x1aacc3){_0x59e7b3=_0x59e7b3-0x0;var _0x4368f2=_0xc678[_0x59e7b3];return _0x4368f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c67('0x0'));var timeout=require(_0x8c67('0x1'));var express=require(_0x8c67('0x2'));var router=express['Router']();var fs_extra=require(_0x8c67('0x3'));var auth=require(_0x8c67('0x4'));var interaction=require(_0x8c67('0x5'));var config=require(_0x8c67('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x8c67('0x7')]('/',auth['isAuthenticated'](),controller[_0x8c67('0x8')]);router[_0x8c67('0x7')]('/:id',auth[_0x8c67('0x9')](),controller[_0x8c67('0xa')]);router[_0x8c67('0xb')]('/',auth[_0x8c67('0x9')](),controller[_0x8c67('0xc')]);router['put'](_0x8c67('0xd'),auth['isAuthenticated'](),controller[_0x8c67('0xe')]);router[_0x8c67('0xf')](_0x8c67('0xd'),auth['isAuthenticated'](),controller[_0x8c67('0x10')]);module[_0x8c67('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index db5e11a..cb273e3 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 _0xa786=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x3f1812,_0x2e919f){var _0x5b88ec=function(_0x90ed0d){while(--_0x90ed0d){_0x3f1812['push'](_0x3f1812['shift']());}};_0x5b88ec(++_0x2e919f);}(_0xa786,0x1d1));var _0x6a78=function(_0x5c6062,_0x3ae632){_0x5c6062=_0x5c6062-0x0;var _0x140331=_0xa786[_0x5c6062];return _0x140331;};'use strict';var Sequelize=require(_0x6a78('0x0'));module[_0x6a78('0x1')]={'type':{'type':Sequelize[_0x6a78('0x2')]('string',_0x6a78('0x3'),'customVariable',_0x6a78('0x4'),_0x6a78('0x5')),'defaultValue':_0x6a78('0x6')},'content':{'type':Sequelize[_0x6a78('0x7')]},'key':{'type':Sequelize[_0x6a78('0x7')]},'keyType':{'type':Sequelize[_0x6a78('0x2')](_0x6a78('0x6'),_0x6a78('0x3'),_0x6a78('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6a78('0x7')]},'nameField':{'type':Sequelize[_0x6a78('0x7')]},'customField':{'type':Sequelize[_0x6a78('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a78('0x7')]}}; \ No newline at end of file +var _0x92d8=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92d8,0xea));var _0x892d=function(_0x48c60a,_0x4805ac){_0x48c60a=_0x48c60a-0x0;var _0x391534=_0x92d8[_0x48c60a];return _0x391534;};'use strict';var Sequelize=require(_0x892d('0x0'));module[_0x892d('0x1')]={'type':{'type':Sequelize[_0x892d('0x2')](_0x892d('0x3'),_0x892d('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0x892d('0x3')},'content':{'type':Sequelize[_0x892d('0x5')]},'key':{'type':Sequelize[_0x892d('0x5')]},'keyType':{'type':Sequelize[_0x892d('0x2')](_0x892d('0x3'),_0x892d('0x4'),_0x892d('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x892d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x892d('0x7')],'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 9b92e5c..df35e87 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 _0x727b=['pick','filter','VIRTUAL','merge','includeAll','catch','show','params','include','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','FreshsalesField','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xe59443,_0x1c7fbc){var _0x155142=function(_0x147ab1){while(--_0x147ab1){_0xe59443['push'](_0xe59443['shift']());}};_0x155142(++_0x1c7fbc);}(_0x727b,0xec));var _0xb727=function(_0x3610bc,_0x37a897){_0x3610bc=_0x3610bc-0x0;var _0x374b84=_0x727b[_0x3610bc];return _0x374b84;};'use strict';var emlformat=require(_0xb727('0x0'));var rimraf=require(_0xb727('0x1'));var zipdir=require(_0xb727('0x2'));var jsonpatch=require(_0xb727('0x3'));var rp=require('request-promise');var moment=require(_0xb727('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb727('0x5'));var util=require(_0xb727('0x6'));var path=require(_0xb727('0x7'));var sox=require('sox');var csv=require(_0xb727('0x8'));var ejs=require(_0xb727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb727('0xa'));var squel=require('squel');var crypto=require(_0xb727('0xb'));var jsforce=require(_0xb727('0xc'));var deskjs=require(_0xb727('0xd'));var toCsv=require(_0xb727('0x8'));var querystring=require('querystring');var Papa=require(_0xb727('0xe'));var Redis=require(_0xb727('0xf'));var authService=require(_0xb727('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb727('0x11'));var hardwareService=require(_0xb727('0x12'));var logger=require('../../config/logger')(_0xb727('0x13'));var utils=require(_0xb727('0x14'));var config=require(_0xb727('0x15'));var licenseUtil=require(_0xb727('0x16'));var db=require(_0xb727('0x17'))['db'];function respondWithStatusCode(_0x50c728,_0xfa9dd){_0xfa9dd=_0xfa9dd||0xcc;return function(_0x35a428){if(_0x35a428){return _0x50c728['sendStatus'](_0xfa9dd);}return _0x50c728['status'](_0xfa9dd)[_0xb727('0x18')]();};}function respondWithResult(_0x457076,_0x48f1a5){_0x48f1a5=_0x48f1a5||0xc8;return function(_0x377737){if(_0x377737){return _0x457076[_0xb727('0x19')](_0x48f1a5)[_0xb727('0x1a')](_0x377737);}};}function respondWithFilteredResult(_0x317d1a,_0x1263a6){return function(_0x37bbc){if(_0x37bbc){var _0x39d307=typeof _0x1263a6[_0xb727('0x1b')]===_0xb727('0x1c')&&typeof _0x1263a6['limit']===_0xb727('0x1c');var _0x55da00=_0x37bbc[_0xb727('0x1d')];var _0x1dc037=_0x39d307?0x0:_0x1263a6['offset'];var _0x5d3b43=_0x39d307?_0x37bbc[_0xb727('0x1d')]:_0x1263a6['offset']+_0x1263a6[_0xb727('0x1e')];var _0x184b1d;if(_0x5d3b43>=_0x55da00){_0x5d3b43=_0x55da00;_0x184b1d=0xc8;}else{_0x184b1d=0xce;}_0x317d1a['status'](_0x184b1d);return _0x317d1a[_0xb727('0x1f')](_0xb727('0x20'),_0x1dc037+'-'+_0x5d3b43+'/'+_0x55da00)[_0xb727('0x1a')](_0x37bbc);}return null;};}function patchUpdates(_0x1ff963){return function(_0x571b07){try{jsonpatch[_0xb727('0x21')](_0x571b07,_0x1ff963,!![]);}catch(_0x25afd0){return BPromise[_0xb727('0x22')](_0x25afd0);}return _0x571b07[_0xb727('0x23')]();};}function saveUpdates(_0x595d91,_0x20d0d1){return function(_0x2f09b0){if(_0x2f09b0){return _0x2f09b0[_0xb727('0x24')](_0x595d91)[_0xb727('0x25')](function(_0x253d4d){return _0x253d4d;});}return null;};}function removeEntity(_0x2d5756,_0x24c89d){return function(_0x22b593){if(_0x22b593){return _0x22b593['destroy']()[_0xb727('0x25')](function(){_0x2d5756[_0xb727('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5683,_0x32dbe3){return function(_0x41d8d3){if(!_0x41d8d3){_0x1a5683[_0xb727('0x26')](0x194);}return _0x41d8d3;};}function handleError(_0x3889d5,_0x7656d8){_0x7656d8=_0x7656d8||0x1f4;return function(_0x3836a8){logger['error'](_0x3836a8['stack']);if(_0x3836a8[_0xb727('0x27')]){delete _0x3836a8[_0xb727('0x27')];}_0x3889d5[_0xb727('0x19')](_0x7656d8)[_0xb727('0x28')](_0x3836a8);};}exports[_0xb727('0x29')]=function(_0x522ba2,_0x423f40){var _0x5c5434={},_0x53c2f6={},_0x206ad6={'count':0x0,'rows':[]};var _0x2ea1b0=_[_0xb727('0x2a')](db[_0xb727('0x2b')][_0xb727('0x2c')],function(_0x229b11){return{'name':_0x229b11['fieldName'],'type':_0x229b11[_0xb727('0x2d')][_0xb727('0x2e')]};});_0x53c2f6['model']=_[_0xb727('0x2a')](_0x2ea1b0,_0xb727('0x27'));_0x53c2f6[_0xb727('0x2f')]=_[_0xb727('0x30')](_0x522ba2[_0xb727('0x2f')]);_0x53c2f6[_0xb727('0x31')]=_[_0xb727('0x32')](_0x53c2f6['model'],_0x53c2f6[_0xb727('0x2f')]);_0x5c5434[_0xb727('0x33')]=_[_0xb727('0x32')](_0x53c2f6[_0xb727('0x34')],qs[_0xb727('0x35')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x35')]));_0x5c5434[_0xb727('0x33')]=_0x5c5434['attributes'][_0xb727('0x36')]?_0x5c5434[_0xb727('0x33')]:_0x53c2f6['model'];if(!_0x522ba2[_0xb727('0x2f')][_0xb727('0x37')](_0xb727('0x38'))){_0x5c5434[_0xb727('0x1e')]=qs['limit'](_0x522ba2[_0xb727('0x2f')][_0xb727('0x1e')]);_0x5c5434[_0xb727('0x1b')]=qs[_0xb727('0x1b')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x1b')]);}_0x5c5434[_0xb727('0x39')]=qs[_0xb727('0x3a')](_0x522ba2[_0xb727('0x2f')][_0xb727('0x3a')]);_0x5c5434[_0xb727('0x3b')]=qs[_0xb727('0x31')](_[_0xb727('0x3c')](_0x522ba2[_0xb727('0x2f')],_0x53c2f6[_0xb727('0x31')]),_0x2ea1b0);if(_0x522ba2['query'][_0xb727('0x3d')]){_0x5c5434[_0xb727('0x3b')]=_['merge'](_0x5c5434[_0xb727('0x3b')],{'$or':_[_0xb727('0x2a')](_0x2ea1b0,function(_0x4e56a6){if(_0x4e56a6[_0xb727('0x2d')]!==_0xb727('0x3e')){var _0x11a79c={};_0x11a79c[_0x4e56a6[_0xb727('0x27')]]={'$like':'%'+_0x522ba2[_0xb727('0x2f')]['filter']+'%'};return _0x11a79c;}})});}_0x5c5434=_[_0xb727('0x3f')]({},_0x5c5434,_0x522ba2['options']);var _0x186ef7={'where':_0x5c5434[_0xb727('0x3b')]};return db[_0xb727('0x2b')][_0xb727('0x1d')](_0x186ef7)[_0xb727('0x25')](function(_0x281b52){_0x206ad6['count']=_0x281b52;if(_0x522ba2[_0xb727('0x2f')][_0xb727('0x40')]){_0x5c5434['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x5c5434);})['then'](function(_0x321fc7){_0x206ad6['rows']=_0x321fc7;return _0x206ad6;})[_0xb727('0x25')](respondWithFilteredResult(_0x423f40,_0x5c5434))[_0xb727('0x41')](handleError(_0x423f40,null));};exports[_0xb727('0x42')]=function(_0x26445,_0x4112d1){var _0x3de2ea={'raw':!![],'where':{'id':_0x26445[_0xb727('0x43')]['id']}},_0x1791e1={};_0x1791e1['model']=_[_0xb727('0x30')](db[_0xb727('0x2b')]['rawAttributes']);_0x1791e1['query']=_[_0xb727('0x30')](_0x26445['query']);_0x1791e1['filters']=_['intersection'](_0x1791e1[_0xb727('0x34')],_0x1791e1[_0xb727('0x2f')]);_0x3de2ea['attributes']=_[_0xb727('0x32')](_0x1791e1['model'],qs['fields'](_0x26445[_0xb727('0x2f')][_0xb727('0x35')]));_0x3de2ea['attributes']=_0x3de2ea['attributes'][_0xb727('0x36')]?_0x3de2ea[_0xb727('0x33')]:_0x1791e1[_0xb727('0x34')];if(_0x26445[_0xb727('0x2f')][_0xb727('0x40')]){_0x3de2ea[_0xb727('0x44')]=[{'all':!![]}];}_0x3de2ea=_['merge']({},_0x3de2ea,_0x26445[_0xb727('0x45')]);return db['FreshsalesField']['find'](_0x3de2ea)[_0xb727('0x25')](handleEntityNotFound(_0x4112d1,null))[_0xb727('0x25')](respondWithResult(_0x4112d1,null))[_0xb727('0x41')](handleError(_0x4112d1,null));};exports[_0xb727('0x46')]=function(_0x343f01,_0x580fac){return db[_0xb727('0x2b')][_0xb727('0x46')](_0x343f01[_0xb727('0x47')],{})[_0xb727('0x25')](respondWithResult(_0x580fac,0xc9))['catch'](handleError(_0x580fac,null));};exports[_0xb727('0x24')]=function(_0x2cc656,_0x49b623){if(_0x2cc656[_0xb727('0x47')]['id']){delete _0x2cc656[_0xb727('0x47')]['id'];}return db[_0xb727('0x2b')][_0xb727('0x48')]({'where':{'id':_0x2cc656[_0xb727('0x43')]['id']}})[_0xb727('0x25')](handleEntityNotFound(_0x49b623,null))['then'](saveUpdates(_0x2cc656[_0xb727('0x47')],null))[_0xb727('0x25')](respondWithResult(_0x49b623,null))[_0xb727('0x41')](handleError(_0x49b623,null));};exports[_0xb727('0x49')]=function(_0x56c1c8,_0x55a7cf){return db[_0xb727('0x2b')][_0xb727('0x48')]({'where':{'id':_0x56c1c8[_0xb727('0x43')]['id']}})[_0xb727('0x25')](handleEntityNotFound(_0x55a7cf,null))['then'](removeEntity(_0x55a7cf,null))[_0xb727('0x41')](handleError(_0x55a7cf,null));}; \ No newline at end of file +var _0xae23=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','save','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x3b321a,_0x2ea399){var _0x224c67=function(_0x4a91fc){while(--_0x4a91fc){_0x3b321a['push'](_0x3b321a['shift']());}};_0x224c67(++_0x2ea399);}(_0xae23,0xcb));var _0x3ae2=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xae23[_0x298ed3];return _0x5aad28;};'use strict';var emlformat=require(_0x3ae2('0x0'));var rimraf=require(_0x3ae2('0x1'));var zipdir=require(_0x3ae2('0x2'));var jsonpatch=require(_0x3ae2('0x3'));var rp=require(_0x3ae2('0x4'));var moment=require(_0x3ae2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3ae2('0x6'));var util=require(_0x3ae2('0x7'));var path=require('path');var sox=require(_0x3ae2('0x8'));var csv=require(_0x3ae2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ae2('0xa'));var _=require(_0x3ae2('0xb'));var squel=require('squel');var crypto=require(_0x3ae2('0xc'));var jsforce=require(_0x3ae2('0xd'));var deskjs=require(_0x3ae2('0xe'));var toCsv=require(_0x3ae2('0x9'));var querystring=require(_0x3ae2('0xf'));var Papa=require('papaparse');var Redis=require(_0x3ae2('0x10'));var authService=require(_0x3ae2('0x11'));var qs=require(_0x3ae2('0x12'));var as=require(_0x3ae2('0x13'));var hardwareService=require(_0x3ae2('0x14'));var logger=require(_0x3ae2('0x15'))('api');var utils=require(_0x3ae2('0x16'));var config=require(_0x3ae2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ae2('0x18'))['db'];function respondWithStatusCode(_0x32c387,_0x41b21d){_0x41b21d=_0x41b21d||0xcc;return function(_0x1c70c6){if(_0x1c70c6){return _0x32c387[_0x3ae2('0x19')](_0x41b21d);}return _0x32c387[_0x3ae2('0x1a')](_0x41b21d)['end']();};}function respondWithResult(_0x3a0403,_0x14e351){_0x14e351=_0x14e351||0xc8;return function(_0x4390da){if(_0x4390da){return _0x3a0403[_0x3ae2('0x1a')](_0x14e351)['json'](_0x4390da);}};}function respondWithFilteredResult(_0x4a1723,_0x5117f6){return function(_0x16b871){if(_0x16b871){var _0x549ed2=typeof _0x5117f6[_0x3ae2('0x1b')]==='undefined'&&typeof _0x5117f6[_0x3ae2('0x1c')]===_0x3ae2('0x1d');var _0x3f62d6=_0x16b871[_0x3ae2('0x1e')];var _0x453da2=_0x549ed2?0x0:_0x5117f6[_0x3ae2('0x1b')];var _0x5f2738=_0x549ed2?_0x16b871[_0x3ae2('0x1e')]:_0x5117f6[_0x3ae2('0x1b')]+_0x5117f6[_0x3ae2('0x1c')];var _0xa21545;if(_0x5f2738>=_0x3f62d6){_0x5f2738=_0x3f62d6;_0xa21545=0xc8;}else{_0xa21545=0xce;}_0x4a1723[_0x3ae2('0x1a')](_0xa21545);return _0x4a1723['set'](_0x3ae2('0x1f'),_0x453da2+'-'+_0x5f2738+'/'+_0x3f62d6)['json'](_0x16b871);}return null;};}function patchUpdates(_0x38ef8f){return function(_0x482281){try{jsonpatch['apply'](_0x482281,_0x38ef8f,!![]);}catch(_0x38d99f){return BPromise['reject'](_0x38d99f);}return _0x482281[_0x3ae2('0x20')]();};}function saveUpdates(_0x145b84,_0x1b882f){return function(_0x24cd3c){if(_0x24cd3c){return _0x24cd3c['update'](_0x145b84)[_0x3ae2('0x21')](function(_0x4580ac){return _0x4580ac;});}return null;};}function removeEntity(_0x3d87a5,_0x4e3602){return function(_0x15a8d5){if(_0x15a8d5){return _0x15a8d5[_0x3ae2('0x22')]()[_0x3ae2('0x21')](function(){_0x3d87a5[_0x3ae2('0x1a')](0xcc)[_0x3ae2('0x23')]();});}};}function handleEntityNotFound(_0x5d88a7,_0x530021){return function(_0xef6c7){if(!_0xef6c7){_0x5d88a7['sendStatus'](0x194);}return _0xef6c7;};}function handleError(_0x5e78d5,_0x357a4c){_0x357a4c=_0x357a4c||0x1f4;return function(_0x466012){logger[_0x3ae2('0x24')](_0x466012['stack']);if(_0x466012[_0x3ae2('0x25')]){delete _0x466012['name'];}_0x5e78d5['status'](_0x357a4c)[_0x3ae2('0x26')](_0x466012);};}exports[_0x3ae2('0x27')]=function(_0x25d8d7,_0x5720f5){var _0x483f52={},_0x2449ef={},_0x4e9f25={'count':0x0,'rows':[]};var _0x4d815d=_[_0x3ae2('0x28')](db['FreshsalesField'][_0x3ae2('0x29')],function(_0x5362f1){return{'name':_0x5362f1[_0x3ae2('0x2a')],'type':_0x5362f1[_0x3ae2('0x2b')][_0x3ae2('0x2c')]};});_0x2449ef[_0x3ae2('0x2d')]=_[_0x3ae2('0x28')](_0x4d815d,_0x3ae2('0x25'));_0x2449ef[_0x3ae2('0x2e')]=_[_0x3ae2('0x2f')](_0x25d8d7[_0x3ae2('0x2e')]);_0x2449ef[_0x3ae2('0x30')]=_[_0x3ae2('0x31')](_0x2449ef[_0x3ae2('0x2d')],_0x2449ef[_0x3ae2('0x2e')]);_0x483f52[_0x3ae2('0x32')]=_[_0x3ae2('0x31')](_0x2449ef['model'],qs[_0x3ae2('0x33')](_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x33')]));_0x483f52[_0x3ae2('0x32')]=_0x483f52[_0x3ae2('0x32')][_0x3ae2('0x34')]?_0x483f52[_0x3ae2('0x32')]:_0x2449ef[_0x3ae2('0x2d')];if(!_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x35')](_0x3ae2('0x36'))){_0x483f52[_0x3ae2('0x1c')]=qs[_0x3ae2('0x1c')](_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x1c')]);_0x483f52[_0x3ae2('0x1b')]=qs[_0x3ae2('0x1b')](_0x25d8d7['query'][_0x3ae2('0x1b')]);}_0x483f52[_0x3ae2('0x37')]=qs['sort'](_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x38')]);_0x483f52[_0x3ae2('0x39')]=qs[_0x3ae2('0x30')](_[_0x3ae2('0x3a')](_0x25d8d7[_0x3ae2('0x2e')],_0x2449ef[_0x3ae2('0x30')]),_0x4d815d);if(_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x3b')]){_0x483f52[_0x3ae2('0x39')]=_[_0x3ae2('0x3c')](_0x483f52[_0x3ae2('0x39')],{'$or':_['map'](_0x4d815d,function(_0x4fb15f){if(_0x4fb15f[_0x3ae2('0x2b')]!==_0x3ae2('0x3d')){var _0xd478a0={};_0xd478a0[_0x4fb15f[_0x3ae2('0x25')]]={'$like':'%'+_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x3b')]+'%'};return _0xd478a0;}})});}_0x483f52=_[_0x3ae2('0x3c')]({},_0x483f52,_0x25d8d7[_0x3ae2('0x3e')]);var _0x1ce929={'where':_0x483f52[_0x3ae2('0x39')]};return db[_0x3ae2('0x3f')][_0x3ae2('0x1e')](_0x1ce929)['then'](function(_0x1e8c9a){_0x4e9f25[_0x3ae2('0x1e')]=_0x1e8c9a;if(_0x25d8d7[_0x3ae2('0x2e')][_0x3ae2('0x40')]){_0x483f52['include']=[{'all':!![]}];}return db[_0x3ae2('0x3f')][_0x3ae2('0x41')](_0x483f52);})['then'](function(_0x5c957b){_0x4e9f25['rows']=_0x5c957b;return _0x4e9f25;})[_0x3ae2('0x21')](respondWithFilteredResult(_0x5720f5,_0x483f52))[_0x3ae2('0x42')](handleError(_0x5720f5,null));};exports[_0x3ae2('0x43')]=function(_0x2cc119,_0x4ef217){var _0xbae857={'raw':!![],'where':{'id':_0x2cc119[_0x3ae2('0x44')]['id']}},_0x15bf0d={};_0x15bf0d[_0x3ae2('0x2d')]=_[_0x3ae2('0x2f')](db[_0x3ae2('0x3f')][_0x3ae2('0x29')]);_0x15bf0d[_0x3ae2('0x2e')]=_['keys'](_0x2cc119[_0x3ae2('0x2e')]);_0x15bf0d['filters']=_[_0x3ae2('0x31')](_0x15bf0d[_0x3ae2('0x2d')],_0x15bf0d[_0x3ae2('0x2e')]);_0xbae857[_0x3ae2('0x32')]=_[_0x3ae2('0x31')](_0x15bf0d[_0x3ae2('0x2d')],qs[_0x3ae2('0x33')](_0x2cc119[_0x3ae2('0x2e')]['fields']));_0xbae857[_0x3ae2('0x32')]=_0xbae857[_0x3ae2('0x32')][_0x3ae2('0x34')]?_0xbae857[_0x3ae2('0x32')]:_0x15bf0d[_0x3ae2('0x2d')];if(_0x2cc119['query'][_0x3ae2('0x40')]){_0xbae857['include']=[{'all':!![]}];}_0xbae857=_[_0x3ae2('0x3c')]({},_0xbae857,_0x2cc119[_0x3ae2('0x3e')]);return db[_0x3ae2('0x3f')][_0x3ae2('0x45')](_0xbae857)[_0x3ae2('0x21')](handleEntityNotFound(_0x4ef217,null))['then'](respondWithResult(_0x4ef217,null))[_0x3ae2('0x42')](handleError(_0x4ef217,null));};exports[_0x3ae2('0x46')]=function(_0x1d58f6,_0x1a130b){return db[_0x3ae2('0x3f')][_0x3ae2('0x46')](_0x1d58f6[_0x3ae2('0x47')],{})[_0x3ae2('0x21')](respondWithResult(_0x1a130b,0xc9))[_0x3ae2('0x42')](handleError(_0x1a130b,null));};exports['update']=function(_0x20ca73,_0x473a55){if(_0x20ca73['body']['id']){delete _0x20ca73[_0x3ae2('0x47')]['id'];}return db[_0x3ae2('0x3f')][_0x3ae2('0x45')]({'where':{'id':_0x20ca73[_0x3ae2('0x44')]['id']}})[_0x3ae2('0x21')](handleEntityNotFound(_0x473a55,null))['then'](saveUpdates(_0x20ca73['body'],null))[_0x3ae2('0x21')](respondWithResult(_0x473a55,null))[_0x3ae2('0x42')](handleError(_0x473a55,null));};exports[_0x3ae2('0x22')]=function(_0x2712a0,_0x4472e6){return db['FreshsalesField'][_0x3ae2('0x45')]({'where':{'id':_0x2712a0[_0x3ae2('0x44')]['id']}})[_0x3ae2('0x21')](handleEntityNotFound(_0x4472e6,null))['then'](removeEntity(_0x4472e6,null))[_0x3ae2('0x42')](handleError(_0x4472e6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3f559c5..6732062 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 _0x5276=['exports','define','int_freshsales_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x5276,0x163));var _0x6527=function(_0x163b8d,_0x194eec){_0x163b8d=_0x163b8d-0x0;var _0x2134ff=_0x5276[_0x163b8d];return _0x2134ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6527('0x0'))(_0x6527('0x1'));var moment=require(_0x6527('0x2'));var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require(_0x6527('0x5'));var rimraf=require(_0x6527('0x6'));var config=require(_0x6527('0x7'));var attributes=require(_0x6527('0x8'));module[_0x6527('0x9')]=function(_0x3deb56,_0x9d7ba2){return _0x3deb56[_0x6527('0xa')]('FreshsalesField',attributes,{'tableName':_0x6527('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x6527('0xc'),_0x6527('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65c9=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index'];(function(_0x98b38a,_0x30c4b3){var _0xc94617=function(_0x16d088){while(--_0x16d088){_0x98b38a['push'](_0x98b38a['shift']());}};_0xc94617(++_0x30c4b3);}(_0x65c9,0x182));var _0x965c=function(_0xe52de9,_0x3bc257){_0xe52de9=_0xe52de9-0x0;var _0x5ee5f2=_0x65c9[_0xe52de9];return _0x5ee5f2;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('FreshsalesField',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[{'name':_0x965c('0xd'),'fields':[_0x965c('0xe'),_0x965c('0xf')],'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 faef6cb..91dac0d 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 _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1967,0x173));var _0x7196=function(_0x39bd70,_0x484d78){_0x39bd70=_0x39bd70-0x0;var _0x7524d7=_0x1967[_0x39bd70];return _0x7524d7;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x4975,0x86));var _0x5497=function(_0x359df3,_0x1d5495){_0x359df3=_0x359df3-0x0;var _0x5d9c57=_0x4975[_0x359df3];return _0x5d9c57;};'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});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c51061b..80bcd53 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x54fddc,_0x2399b0){var _0x16fbe1=function(_0x5c384a){while(--_0x5c384a){_0x54fddc['push'](_0x54fddc['shift']());}};_0x16fbe1(++_0x2399b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2fa810,_0x5c68d3){var _0x1cb8ba=function(_0x21f7a2){while(--_0x21f7a2){_0x2fa810['push'](_0x2fa810['shift']());}};_0x1cb8ba(++_0x5c68d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 495a720..b2ef1c0 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 _0xdfdd=['ENUM','newTab','sequelize','exports','STRING','username'];(function(_0x82213,_0x464cbb){var _0x5430ea=function(_0x395b33){while(--_0x395b33){_0x82213['push'](_0x82213['shift']());}};_0x5430ea(++_0x464cbb);}(_0xdfdd,0x104));var _0xddfd=function(_0x4c90b4,_0x163f70){_0x4c90b4=_0x4c90b4-0x0;var _0x4c4510=_0xdfdd[_0x4c90b4];return _0x4c4510;};'use strict';var Sequelize=require(_0xddfd('0x0'));module[_0xddfd('0x1')]={'name':{'type':Sequelize[_0xddfd('0x2')]},'description':{'type':Sequelize[_0xddfd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xddfd('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xddfd('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xddfd('0x2')]},'securityToken':{'type':Sequelize[_0xddfd('0x2')]},'serverUrl':{'type':Sequelize[_0xddfd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xddfd('0x4')]('integrationTab',_0xddfd('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf03d=['username','ENUM','newTab','sequelize','exports','STRING'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0xf03d,0x1a7));var _0xdf03=function(_0x5a17a6,_0x177a76){_0x5a17a6=_0x5a17a6-0x0;var _0x32d834=_0xf03d[_0x5a17a6];return _0x32d834;};'use strict';var Sequelize=require(_0xdf03('0x0'));module[_0xdf03('0x1')]={'name':{'type':Sequelize[_0xdf03('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdf03('0x2')],'unique':_0xdf03('0x3')},'remoteUri':{'type':Sequelize[_0xdf03('0x2')]},'password':{'type':Sequelize[_0xdf03('0x2')]},'clientId':{'type':Sequelize[_0xdf03('0x2')]},'clientSecret':{'type':Sequelize[_0xdf03('0x2')]},'securityToken':{'type':Sequelize[_0xdf03('0x2')]},'serverUrl':{'type':Sequelize[_0xdf03('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdf03('0x4')]('integrationTab',_0xdf03('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 22eacfc..23f553d 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 _0x4dcc=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','reject','update','then','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SalesforceAccount','findAll','rows','catch','show','params','create','body','find','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','clientId','clientSecret','username','password','securityToken','lastIndexOf','concat','isNil','describe','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','error','stringify','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x41dd01,_0x3287fe){var _0x1b2a58=function(_0x399d16){while(--_0x399d16){_0x41dd01['push'](_0x41dd01['shift']());}};_0x1b2a58(++_0x3287fe);}(_0x4dcc,0x144));var _0xc4dc=function(_0x53a97a,_0x3135e8){_0x53a97a=_0x53a97a-0x0;var _0x3ff3ff=_0x4dcc[_0x53a97a];return _0x3ff3ff;};'use strict';var emlformat=require(_0xc4dc('0x0'));var rimraf=require(_0xc4dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4dc('0x2'));var rp=require('request-promise');var moment=require(_0xc4dc('0x3'));var BPromise=require(_0xc4dc('0x4'));var Mustache=require('mustache');var util=require(_0xc4dc('0x5'));var path=require('path');var sox=require(_0xc4dc('0x6'));var csv=require('to-csv');var ejs=require(_0xc4dc('0x7'));var fs=require('fs');var fs_extra=require(_0xc4dc('0x8'));var _=require(_0xc4dc('0x9'));var squel=require(_0xc4dc('0xa'));var crypto=require('crypto');var jsforce=require(_0xc4dc('0xb'));var deskjs=require(_0xc4dc('0xc'));var toCsv=require(_0xc4dc('0xd'));var querystring=require(_0xc4dc('0xe'));var Papa=require(_0xc4dc('0xf'));var Redis=require(_0xc4dc('0x10'));var authService=require(_0xc4dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc4dc('0x12'));var hardwareService=require(_0xc4dc('0x13'));var logger=require(_0xc4dc('0x14'))('api');var utils=require(_0xc4dc('0x15'));var config=require(_0xc4dc('0x16'));var licenseUtil=require(_0xc4dc('0x17'));var db=require(_0xc4dc('0x18'))['db'];var integrations=require(_0xc4dc('0x19'));function respondWithStatusCode(_0x2570e2,_0x549df1){_0x549df1=_0x549df1||0xcc;return function(_0x229894){if(_0x229894){return _0x2570e2[_0xc4dc('0x1a')](_0x549df1);}return _0x2570e2[_0xc4dc('0x1b')](_0x549df1)['end']();};}function respondWithResult(_0x18f792,_0x16fbaa){_0x16fbaa=_0x16fbaa||0xc8;return function(_0x407efa){if(_0x407efa){return _0x18f792[_0xc4dc('0x1b')](_0x16fbaa)['json'](_0x407efa);}};}function respondWithFilteredResult(_0x364155,_0x1d1847){return function(_0x36569d){if(_0x36569d){var _0x4fae4b=typeof _0x1d1847['offset']==='undefined'&&typeof _0x1d1847['limit']===_0xc4dc('0x1c');var _0x4faaa6=_0x36569d[_0xc4dc('0x1d')];var _0x48e68d=_0x4fae4b?0x0:_0x1d1847[_0xc4dc('0x1e')];var _0x248a29=_0x4fae4b?_0x36569d['count']:_0x1d1847[_0xc4dc('0x1e')]+_0x1d1847[_0xc4dc('0x1f')];var _0x3ed800;if(_0x248a29>=_0x4faaa6){_0x248a29=_0x4faaa6;_0x3ed800=0xc8;}else{_0x3ed800=0xce;}_0x364155[_0xc4dc('0x1b')](_0x3ed800);return _0x364155[_0xc4dc('0x20')](_0xc4dc('0x21'),_0x48e68d+'-'+_0x248a29+'/'+_0x4faaa6)[_0xc4dc('0x22')](_0x36569d);}return null;};}function patchUpdates(_0x442fe1){return function(_0x1e53fe){try{jsonpatch['apply'](_0x1e53fe,_0x442fe1,!![]);}catch(_0x149e78){return BPromise[_0xc4dc('0x23')](_0x149e78);}return _0x1e53fe['save']();};}function saveUpdates(_0x259665,_0x1d7069){return function(_0x36a02c){if(_0x36a02c){return _0x36a02c[_0xc4dc('0x24')](_0x259665)['then'](function(_0x589445){return _0x589445;});}return null;};}function removeEntity(_0xef795f,_0x308c3){return function(_0x445cd6){if(_0x445cd6){return _0x445cd6['destroy']()[_0xc4dc('0x25')](function(){_0xef795f[_0xc4dc('0x1b')](0xcc)[_0xc4dc('0x26')]();});}};}function handleEntityNotFound(_0x4fafb9,_0x2da05d){return function(_0xd095d0){if(!_0xd095d0){_0x4fafb9[_0xc4dc('0x1a')](0x194);}return _0xd095d0;};}function handleError(_0x447ed5,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x47240f){logger['error'](_0x47240f[_0xc4dc('0x27')]);if(_0x47240f[_0xc4dc('0x28')]){delete _0x47240f[_0xc4dc('0x28')];}_0x447ed5[_0xc4dc('0x1b')](_0x3b7492)[_0xc4dc('0x29')](_0x47240f);};}exports[_0xc4dc('0x2a')]=function(_0x47dadc,_0x171536){var _0x6ec344={},_0xf6bcfd={},_0x1c2bca={'count':0x0,'rows':[]};var _0x2520e6=_[_0xc4dc('0x2b')](db['SalesforceAccount'][_0xc4dc('0x2c')],function(_0x49eae8){return{'name':_0x49eae8['fieldName'],'type':_0x49eae8[_0xc4dc('0x2d')][_0xc4dc('0x2e')]};});_0xf6bcfd[_0xc4dc('0x2f')]=_[_0xc4dc('0x2b')](_0x2520e6,_0xc4dc('0x28'));_0xf6bcfd[_0xc4dc('0x30')]=_[_0xc4dc('0x31')](_0x47dadc['query']);_0xf6bcfd[_0xc4dc('0x32')]=_['intersection'](_0xf6bcfd[_0xc4dc('0x2f')],_0xf6bcfd['query']);_0x6ec344[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0xf6bcfd[_0xc4dc('0x2f')],qs[_0xc4dc('0x35')](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x6ec344[_0xc4dc('0x33')]=_0x6ec344['attributes'][_0xc4dc('0x36')]?_0x6ec344[_0xc4dc('0x33')]:_0xf6bcfd[_0xc4dc('0x2f')];if(!_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x37')](_0xc4dc('0x38'))){_0x6ec344[_0xc4dc('0x1f')]=qs[_0xc4dc('0x1f')](_0x47dadc['query'][_0xc4dc('0x1f')]);_0x6ec344['offset']=qs[_0xc4dc('0x1e')](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x1e')]);}_0x6ec344[_0xc4dc('0x39')]=qs['sort'](_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x3a')]);_0x6ec344[_0xc4dc('0x3b')]=qs[_0xc4dc('0x32')](_['pick'](_0x47dadc[_0xc4dc('0x30')],_0xf6bcfd['filters']),_0x2520e6);if(_0x47dadc[_0xc4dc('0x30')][_0xc4dc('0x3c')]){_0x6ec344[_0xc4dc('0x3b')]=_['merge'](_0x6ec344[_0xc4dc('0x3b')],{'$or':_[_0xc4dc('0x2b')](_0x2520e6,function(_0x429442){if(_0x429442[_0xc4dc('0x2d')]!==_0xc4dc('0x3d')){var _0x4accab={};_0x4accab[_0x429442[_0xc4dc('0x28')]]={'$like':'%'+_0x47dadc[_0xc4dc('0x30')]['filter']+'%'};return _0x4accab;}})});}_0x6ec344=_[_0xc4dc('0x3e')]({},_0x6ec344,_0x47dadc[_0xc4dc('0x3f')]);var _0x35f5a9={'where':_0x6ec344['where']};return db[_0xc4dc('0x40')][_0xc4dc('0x1d')](_0x35f5a9)['then'](function(_0x1224df){_0x1c2bca[_0xc4dc('0x1d')]=_0x1224df;if(_0x47dadc[_0xc4dc('0x30')]['includeAll']){_0x6ec344['include']=[{'all':!![]}];}return db[_0xc4dc('0x40')][_0xc4dc('0x41')](_0x6ec344);})['then'](function(_0x34c2b7){_0x1c2bca[_0xc4dc('0x42')]=_0x34c2b7;return _0x1c2bca;})[_0xc4dc('0x25')](respondWithFilteredResult(_0x171536,_0x6ec344))[_0xc4dc('0x43')](handleError(_0x171536,null));};exports[_0xc4dc('0x44')]=function(_0x160d98,_0x7cd3e3){var _0x36f3c6={'raw':![],'where':{'id':_0x160d98[_0xc4dc('0x45')]['id']}},_0x360adc={};_0x360adc[_0xc4dc('0x2f')]=_['keys'](db[_0xc4dc('0x40')][_0xc4dc('0x2c')]);_0x360adc[_0xc4dc('0x30')]=_['keys'](_0x160d98[_0xc4dc('0x30')]);_0x360adc[_0xc4dc('0x32')]=_[_0xc4dc('0x34')](_0x360adc[_0xc4dc('0x2f')],_0x360adc[_0xc4dc('0x30')]);_0x36f3c6[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0x360adc['model'],qs['fields'](_0x160d98[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x36f3c6[_0xc4dc('0x33')]=_0x36f3c6['attributes'][_0xc4dc('0x36')]?_0x36f3c6[_0xc4dc('0x33')]:_0x360adc[_0xc4dc('0x2f')];if(_0x160d98[_0xc4dc('0x30')]['includeAll']){_0x36f3c6['include']=[{'all':!![]}];}_0x36f3c6=_[_0xc4dc('0x3e')]({},_0x36f3c6,_0x160d98[_0xc4dc('0x3f')]);return db[_0xc4dc('0x40')]['find'](_0x36f3c6)['then'](handleEntityNotFound(_0x7cd3e3,null))[_0xc4dc('0x25')](respondWithResult(_0x7cd3e3,null))[_0xc4dc('0x43')](handleError(_0x7cd3e3,null));};exports[_0xc4dc('0x46')]=function(_0x242989,_0x3e2fc4){return db[_0xc4dc('0x40')][_0xc4dc('0x46')](_0x242989['body'],{})[_0xc4dc('0x25')](respondWithResult(_0x3e2fc4,0xc9))['catch'](handleError(_0x3e2fc4,null));};exports[_0xc4dc('0x24')]=function(_0x4a6e5a,_0x3a6d5a){if(_0x4a6e5a[_0xc4dc('0x47')]['id']){delete _0x4a6e5a[_0xc4dc('0x47')]['id'];}return db[_0xc4dc('0x40')][_0xc4dc('0x48')]({'where':{'id':_0x4a6e5a[_0xc4dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a6d5a,null))['then'](saveUpdates(_0x4a6e5a[_0xc4dc('0x47')],null))[_0xc4dc('0x25')](respondWithResult(_0x3a6d5a,null))[_0xc4dc('0x43')](handleError(_0x3a6d5a,null));};exports[_0xc4dc('0x49')]=function(_0x28972f,_0xae3ade){return db[_0xc4dc('0x40')][_0xc4dc('0x48')]({'where':{'id':_0x28972f['params']['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0xae3ade,null))[_0xc4dc('0x25')](removeEntity(_0xae3ade,null))[_0xc4dc('0x43')](handleError(_0xae3ade,null));};exports['getConfigurations']=function(_0x176736,_0x33d3aa,_0xc1eadc){var _0x2b2d72={};var _0x304850={};var _0x4b7d25;var _0xd8f2a9;return db[_0xc4dc('0x40')][_0xc4dc('0x4a')]({'where':{'id':_0x176736[_0xc4dc('0x45')]['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0x33d3aa,null))[_0xc4dc('0x25')](function(_0x231373){if(_0x231373){_0x4b7d25=_0x231373;_0x304850[_0xc4dc('0x2f')]=_['keys'](db[_0xc4dc('0x4b')][_0xc4dc('0x2c')]);_0x304850[_0xc4dc('0x30')]=_[_0xc4dc('0x31')](_0x176736[_0xc4dc('0x30')]);_0x304850['filters']=_[_0xc4dc('0x34')](_0x304850[_0xc4dc('0x2f')],_0x304850[_0xc4dc('0x30')]);_0x2b2d72[_0xc4dc('0x33')]=_[_0xc4dc('0x34')](_0x304850[_0xc4dc('0x2f')],qs[_0xc4dc('0x35')](_0x176736[_0xc4dc('0x30')][_0xc4dc('0x35')]));_0x2b2d72['attributes']=_0x2b2d72[_0xc4dc('0x33')][_0xc4dc('0x36')]?_0x2b2d72[_0xc4dc('0x33')]:_0x304850[_0xc4dc('0x2f')];_0x2b2d72[_0xc4dc('0x39')]=qs[_0xc4dc('0x3a')](_0x176736[_0xc4dc('0x30')]['sort']);_0x2b2d72[_0xc4dc('0x3b')]=qs['filters'](_['pick'](_0x176736['query'],_0x304850['filters']));if(_0x176736[_0xc4dc('0x30')][_0xc4dc('0x3c')]){_0x2b2d72[_0xc4dc('0x3b')]=_['merge'](_0x2b2d72['where'],{'$or':_['map'](_0x2b2d72[_0xc4dc('0x33')],function(_0x50815b){var _0x1377ef={};_0x1377ef[_0x50815b]={'$like':'%'+_0x176736[_0xc4dc('0x30')][_0xc4dc('0x3c')]+'%'};return _0x1377ef;})});}_0x2b2d72=_[_0xc4dc('0x3e')]({},_0x2b2d72,_0x176736['options']);return _0x4b7d25[_0xc4dc('0x4c')](_0x2b2d72);}})[_0xc4dc('0x25')](function(_0x4ac85e){if(_0x4ac85e){_0xd8f2a9=_0x4ac85e[_0xc4dc('0x36')];if(!_0x176736[_0xc4dc('0x30')][_0xc4dc('0x37')](_0xc4dc('0x38'))){_0x2b2d72[_0xc4dc('0x1f')]=qs[_0xc4dc('0x1f')](_0x176736['query']['limit']);_0x2b2d72[_0xc4dc('0x1e')]=qs['offset'](_0x176736[_0xc4dc('0x30')][_0xc4dc('0x1e')]);}return _0x4b7d25['getConfigurations'](_0x2b2d72);}})[_0xc4dc('0x25')](function(_0x15cc63){if(_0x15cc63){return _0x15cc63?{'count':_0xd8f2a9,'rows':_0x15cc63}:null;}})[_0xc4dc('0x25')](respondWithResult(_0x33d3aa,null))[_0xc4dc('0x43')](handleError(_0x33d3aa,null));};exports[_0xc4dc('0x4d')]=function(_0x179f20,_0xc9cfbf,_0x220010){if(_0x179f20[_0xc4dc('0x47')]['id']){delete _0x179f20[_0xc4dc('0x47')]['id'];}return db['SalesforceAccount'][_0xc4dc('0x4a')]({'where':{'id':_0x179f20[_0xc4dc('0x45')]['id']}})[_0xc4dc('0x25')](handleEntityNotFound(_0xc9cfbf,null))[_0xc4dc('0x25')](function(_0x40032c){if(_0x40032c){_0x179f20[_0xc4dc('0x47')]['AccountId']=_0x40032c['id'];_0x179f20['body']['Subjects']=integrations['getSubjects'](_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x4e')],_0x179f20[_0xc4dc('0x47')]['type']);_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x4f')]=integrations[_0xc4dc('0x50')](_0x179f20['body']['channel'],_0x179f20[_0xc4dc('0x47')][_0xc4dc('0x2d')]);return db[_0xc4dc('0x4b')]['create'](_0x179f20['body'],{'include':[{'model':db[_0xc4dc('0x51')],'as':_0xc4dc('0x52')},{'model':db['SalesforceField'],'as':_0xc4dc('0x4f')}]});}return null;})[_0xc4dc('0x25')](respondWithResult(_0xc9cfbf,null))['catch'](handleError(_0xc9cfbf,null));};exports[_0xc4dc('0x53')]=function(_0x3dd717,_0x3ef9d5,_0x4518eb){var _0x50b2b6;var _0x822560='';var _0xede6d8=_0xc4dc('0x54');return db[_0xc4dc('0x40')][_0xc4dc('0x4a')]({'where':{'id':_0x3dd717[_0xc4dc('0x45')]['id']},'attributes':['id','remoteUri',_0xc4dc('0x55'),_0xc4dc('0x56'),_0xc4dc('0x57'),_0xc4dc('0x58'),_0xc4dc('0x59')]})['then'](handleEntityNotFound(_0x3ef9d5,null))[_0xc4dc('0x25')](function(_0x4ed11c){if(_0x4ed11c){_0x822560=_0x4ed11c['remoteUri'];var _0x1dd5ad=_0x822560['slice'](-0x1);if(_0x1dd5ad==='/'){_0x822560=_0x822560['substring'](0x0,_0x822560[_0xc4dc('0x5a')](_0x1dd5ad));}_0x50b2b6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x822560,'clientId':_0x4ed11c['clientId'],'clientSecret':_0x4ed11c[_0xc4dc('0x56')]}});return _0x50b2b6['login'](_0x4ed11c['username'],_0x4ed11c[_0xc4dc('0x58')][_0xc4dc('0x5b')](_0x4ed11c[_0xc4dc('0x59')]));}})[_0xc4dc('0x25')](function(_0x29d91f){if(_0x29d91f){if(!_[_0xc4dc('0x5c')](_0x3dd717['query']['ticketType'])){_0xede6d8=_0x3dd717[_0xc4dc('0x30')]['ticketType'];}return _0x50b2b6['sobject'](_0xede6d8)[_0xc4dc('0x5d')]();}})['then'](function(_0x4383c0){var _0x5158ed=['OwnerId','ActivityDate',_0xc4dc('0x5e'),_0xc4dc('0x5f'),_0xc4dc('0x60'),'Description'];var _0x249bb1=[_0xc4dc('0x61'),_0xc4dc('0x62'),_0xc4dc('0x63'),_0xc4dc('0x64'),_0xc4dc('0x65'),'textarea',_0xc4dc('0x66')];if(_0x4383c0){_[_0xc4dc('0x67')](_0x4383c0[_0xc4dc('0x35')],function(_0x3fccc5){return _0x5158ed[_0xc4dc('0x68')](_0x3fccc5[_0xc4dc('0x28')])||!_0x249bb1[_0xc4dc('0x68')](_0x3fccc5['type']);});return{'count':_0x4383c0[_0xc4dc('0x35')][_0xc4dc('0x36')],'rows':_[_0xc4dc('0x2b')](_0x4383c0['fields'],function(_0x39ead5){return{'id':_0x39ead5[_0xc4dc('0x28')],'name':_0x39ead5[_0xc4dc('0x69')],'custom':_0x39ead5['custom'],'options':_0x39ead5[_0xc4dc('0x6a')]['length']>0x0?_[_0xc4dc('0x2b')](_0x39ead5[_0xc4dc('0x6a')],function(_0x378f09){return{'name':_0x378f09[_0xc4dc('0x69')],'value':_0x378f09[_0xc4dc('0x6b')]};}):_0x39ead5[_0xc4dc('0x2d')]==_0xc4dc('0x64')?[{'name':_0xc4dc('0x6c'),'value':_0xc4dc('0x6d')},{'name':_0xc4dc('0x6e'),'value':_0xc4dc('0x6f')}]:[]};})};}})[_0xc4dc('0x25')](respondWithResult(_0x3ef9d5,null))['catch'](function(_0x59b6d9){var _0x49693c=_0x3dd717[_0xc4dc('0x30')][_0xc4dc('0x70')]?0x1f4:_0x59b6d9[_0xc4dc('0x71')]||0x1f4;logger[_0xc4dc('0x72')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49693c,JSON[_0xc4dc('0x73')](_0x59b6d9));delete _0x59b6d9['name'];if(_0x49693c===0x191){_0x49693c=0x190;}_0x3ef9d5['status'](_0x49693c)[_0xc4dc('0x29')](_0x3dd717[_0xc4dc('0x30')][_0xc4dc('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x59b6d9[_0xc4dc('0x71')]}:_0x59b6d9);});}; \ No newline at end of file +var _0x53a2=['False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','offset','limit','count','status','set','json','update','then','destroy','sendStatus','error','name','index','map','SalesforceAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','ticketType','sobject','OwnerId','Subject','Description','picklist','email','textarea','remove','includes','custom','picklistValues','label','value','True','true'];(function(_0xc3fa70,_0x5ec462){var _0x1391b8=function(_0x5429bc){while(--_0x5429bc){_0xc3fa70['push'](_0xc3fa70['shift']());}};_0x1391b8(++_0x5ec462);}(_0x53a2,0xea));var _0x253a=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x53a2[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0x253a('0x0'));var rimraf=require(_0x253a('0x1'));var zipdir=require(_0x253a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x253a('0x3'));var moment=require(_0x253a('0x4'));var BPromise=require(_0x253a('0x5'));var Mustache=require(_0x253a('0x6'));var util=require(_0x253a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x253a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x253a('0x9'));var _=require(_0x253a('0xa'));var squel=require(_0x253a('0xb'));var crypto=require(_0x253a('0xc'));var jsforce=require(_0x253a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x253a('0x8'));var querystring=require(_0x253a('0xe'));var Papa=require(_0x253a('0xf'));var Redis=require(_0x253a('0x10'));var authService=require(_0x253a('0x11'));var qs=require(_0x253a('0x12'));var as=require(_0x253a('0x13'));var hardwareService=require(_0x253a('0x14'));var logger=require(_0x253a('0x15'))('api');var utils=require(_0x253a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x253a('0x17'))['db'];var integrations=require(_0x253a('0x18'));function respondWithStatusCode(_0x130c08,_0x4f0c1c){_0x4f0c1c=_0x4f0c1c||0xcc;return function(_0x5da4d8){if(_0x5da4d8){return _0x130c08['sendStatus'](_0x4f0c1c);}return _0x130c08['status'](_0x4f0c1c)['end']();};}function respondWithResult(_0x10f4a1,_0x10ec5e){_0x10ec5e=_0x10ec5e||0xc8;return function(_0x454b26){if(_0x454b26){return _0x10f4a1['status'](_0x10ec5e)['json'](_0x454b26);}};}function respondWithFilteredResult(_0x22eb2a,_0x4c145c){return function(_0x310862){if(_0x310862){var _0x214ecd=typeof _0x4c145c[_0x253a('0x19')]==='undefined'&&typeof _0x4c145c[_0x253a('0x1a')]==='undefined';var _0x5487d6=_0x310862[_0x253a('0x1b')];var _0x1455d9=_0x214ecd?0x0:_0x4c145c[_0x253a('0x19')];var _0x4296f7=_0x214ecd?_0x310862[_0x253a('0x1b')]:_0x4c145c[_0x253a('0x19')]+_0x4c145c[_0x253a('0x1a')];var _0x4e10c9;if(_0x4296f7>=_0x5487d6){_0x4296f7=_0x5487d6;_0x4e10c9=0xc8;}else{_0x4e10c9=0xce;}_0x22eb2a[_0x253a('0x1c')](_0x4e10c9);return _0x22eb2a[_0x253a('0x1d')]('Content-Range',_0x1455d9+'-'+_0x4296f7+'/'+_0x5487d6)[_0x253a('0x1e')](_0x310862);}return null;};}function patchUpdates(_0x4c8422){return function(_0x322bf4){try{jsonpatch['apply'](_0x322bf4,_0x4c8422,!![]);}catch(_0x289dfc){return BPromise['reject'](_0x289dfc);}return _0x322bf4['save']();};}function saveUpdates(_0x10fd68,_0x57b38e){return function(_0x423098){if(_0x423098){return _0x423098[_0x253a('0x1f')](_0x10fd68)[_0x253a('0x20')](function(_0x2aaacc){return _0x2aaacc;});}return null;};}function removeEntity(_0x4adacb,_0x5c34f6){return function(_0x2a18aa){if(_0x2a18aa){return _0x2a18aa[_0x253a('0x21')]()[_0x253a('0x20')](function(){_0x4adacb[_0x253a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28bebc,_0x26b4dd){return function(_0x596059){if(!_0x596059){_0x28bebc[_0x253a('0x22')](0x194);}return _0x596059;};}function handleError(_0x509993,_0x27395d){_0x27395d=_0x27395d||0x1f4;return function(_0x5378c4){logger[_0x253a('0x23')](_0x5378c4['stack']);if(_0x5378c4[_0x253a('0x24')]){delete _0x5378c4[_0x253a('0x24')];}_0x509993[_0x253a('0x1c')](_0x27395d)['send'](_0x5378c4);};}exports[_0x253a('0x25')]=function(_0x11cdb2,_0xafdc35){var _0x3f8ef7={},_0xb29fb9={},_0x4b24aa={'count':0x0,'rows':[]};var _0x4b19b9=_[_0x253a('0x26')](db[_0x253a('0x27')]['rawAttributes'],function(_0x1848d9){return{'name':_0x1848d9[_0x253a('0x28')],'type':_0x1848d9[_0x253a('0x29')]['key']};});_0xb29fb9[_0x253a('0x2a')]=_['map'](_0x4b19b9,_0x253a('0x24'));_0xb29fb9[_0x253a('0x2b')]=_[_0x253a('0x2c')](_0x11cdb2[_0x253a('0x2b')]);_0xb29fb9[_0x253a('0x2d')]=_[_0x253a('0x2e')](_0xb29fb9[_0x253a('0x2a')],_0xb29fb9[_0x253a('0x2b')]);_0x3f8ef7[_0x253a('0x2f')]=_['intersection'](_0xb29fb9[_0x253a('0x2a')],qs[_0x253a('0x30')](_0x11cdb2[_0x253a('0x2b')][_0x253a('0x30')]));_0x3f8ef7['attributes']=_0x3f8ef7[_0x253a('0x2f')]['length']?_0x3f8ef7[_0x253a('0x2f')]:_0xb29fb9[_0x253a('0x2a')];if(!_0x11cdb2[_0x253a('0x2b')]['hasOwnProperty'](_0x253a('0x31'))){_0x3f8ef7[_0x253a('0x1a')]=qs[_0x253a('0x1a')](_0x11cdb2[_0x253a('0x2b')]['limit']);_0x3f8ef7[_0x253a('0x19')]=qs[_0x253a('0x19')](_0x11cdb2[_0x253a('0x2b')][_0x253a('0x19')]);}_0x3f8ef7[_0x253a('0x32')]=qs[_0x253a('0x33')](_0x11cdb2[_0x253a('0x2b')][_0x253a('0x33')]);_0x3f8ef7[_0x253a('0x34')]=qs[_0x253a('0x2d')](_[_0x253a('0x35')](_0x11cdb2[_0x253a('0x2b')],_0xb29fb9[_0x253a('0x2d')]),_0x4b19b9);if(_0x11cdb2['query']['filter']){_0x3f8ef7[_0x253a('0x34')]=_['merge'](_0x3f8ef7[_0x253a('0x34')],{'$or':_[_0x253a('0x26')](_0x4b19b9,function(_0x198ca7){if(_0x198ca7[_0x253a('0x29')]!=='VIRTUAL'){var _0x16a69e={};_0x16a69e[_0x198ca7[_0x253a('0x24')]]={'$like':'%'+_0x11cdb2['query'][_0x253a('0x36')]+'%'};return _0x16a69e;}})});}_0x3f8ef7=_[_0x253a('0x37')]({},_0x3f8ef7,_0x11cdb2[_0x253a('0x38')]);var _0x276b36={'where':_0x3f8ef7[_0x253a('0x34')]};return db[_0x253a('0x27')]['count'](_0x276b36)[_0x253a('0x20')](function(_0x55f9c8){_0x4b24aa['count']=_0x55f9c8;if(_0x11cdb2[_0x253a('0x2b')][_0x253a('0x39')]){_0x3f8ef7['include']=[{'all':!![]}];}return db[_0x253a('0x27')][_0x253a('0x3a')](_0x3f8ef7);})[_0x253a('0x20')](function(_0x277d90){_0x4b24aa[_0x253a('0x3b')]=_0x277d90;return _0x4b24aa;})[_0x253a('0x20')](respondWithFilteredResult(_0xafdc35,_0x3f8ef7))[_0x253a('0x3c')](handleError(_0xafdc35,null));};exports[_0x253a('0x3d')]=function(_0xa0500,_0x994b43){var _0xdcca22={'raw':![],'where':{'id':_0xa0500[_0x253a('0x3e')]['id']}},_0x35821d={};_0x35821d[_0x253a('0x2a')]=_[_0x253a('0x2c')](db[_0x253a('0x27')][_0x253a('0x3f')]);_0x35821d[_0x253a('0x2b')]=_[_0x253a('0x2c')](_0xa0500[_0x253a('0x2b')]);_0x35821d[_0x253a('0x2d')]=_[_0x253a('0x2e')](_0x35821d[_0x253a('0x2a')],_0x35821d[_0x253a('0x2b')]);_0xdcca22['attributes']=_[_0x253a('0x2e')](_0x35821d[_0x253a('0x2a')],qs[_0x253a('0x30')](_0xa0500[_0x253a('0x2b')]['fields']));_0xdcca22[_0x253a('0x2f')]=_0xdcca22['attributes']['length']?_0xdcca22['attributes']:_0x35821d[_0x253a('0x2a')];if(_0xa0500[_0x253a('0x2b')]['includeAll']){_0xdcca22[_0x253a('0x40')]=[{'all':!![]}];}_0xdcca22=_['merge']({},_0xdcca22,_0xa0500['options']);return db[_0x253a('0x27')][_0x253a('0x41')](_0xdcca22)['then'](handleEntityNotFound(_0x994b43,null))[_0x253a('0x20')](respondWithResult(_0x994b43,null))['catch'](handleError(_0x994b43,null));};exports[_0x253a('0x42')]=function(_0x2acfc0,_0x2234f9){return db[_0x253a('0x27')][_0x253a('0x42')](_0x2acfc0[_0x253a('0x43')],{})[_0x253a('0x20')](respondWithResult(_0x2234f9,0xc9))[_0x253a('0x3c')](handleError(_0x2234f9,null));};exports[_0x253a('0x1f')]=function(_0x59ae85,_0x468e5c){if(_0x59ae85[_0x253a('0x43')]['id']){delete _0x59ae85[_0x253a('0x43')]['id'];}return db[_0x253a('0x27')][_0x253a('0x41')]({'where':{'id':_0x59ae85[_0x253a('0x3e')]['id']}})[_0x253a('0x20')](handleEntityNotFound(_0x468e5c,null))[_0x253a('0x20')](saveUpdates(_0x59ae85[_0x253a('0x43')],null))[_0x253a('0x20')](respondWithResult(_0x468e5c,null))[_0x253a('0x3c')](handleError(_0x468e5c,null));};exports[_0x253a('0x21')]=function(_0x13a3cf,_0x49c178){return db[_0x253a('0x27')][_0x253a('0x41')]({'where':{'id':_0x13a3cf[_0x253a('0x3e')]['id']}})[_0x253a('0x20')](handleEntityNotFound(_0x49c178,null))[_0x253a('0x20')](removeEntity(_0x49c178,null))['catch'](handleError(_0x49c178,null));};exports[_0x253a('0x44')]=function(_0x531e8b,_0x8e2d7f,_0x158613){var _0x540835={};var _0x37ac27={};var _0x5840d1;var _0x437221;return db[_0x253a('0x27')][_0x253a('0x45')]({'where':{'id':_0x531e8b[_0x253a('0x3e')]['id']}})[_0x253a('0x20')](handleEntityNotFound(_0x8e2d7f,null))[_0x253a('0x20')](function(_0x4a43a5){if(_0x4a43a5){_0x5840d1=_0x4a43a5;_0x37ac27[_0x253a('0x2a')]=_['keys'](db[_0x253a('0x46')]['rawAttributes']);_0x37ac27[_0x253a('0x2b')]=_[_0x253a('0x2c')](_0x531e8b[_0x253a('0x2b')]);_0x37ac27[_0x253a('0x2d')]=_[_0x253a('0x2e')](_0x37ac27[_0x253a('0x2a')],_0x37ac27[_0x253a('0x2b')]);_0x540835['attributes']=_[_0x253a('0x2e')](_0x37ac27[_0x253a('0x2a')],qs['fields'](_0x531e8b['query']['fields']));_0x540835[_0x253a('0x2f')]=_0x540835[_0x253a('0x2f')][_0x253a('0x47')]?_0x540835[_0x253a('0x2f')]:_0x37ac27[_0x253a('0x2a')];_0x540835['order']=qs[_0x253a('0x33')](_0x531e8b[_0x253a('0x2b')][_0x253a('0x33')]);_0x540835[_0x253a('0x34')]=qs[_0x253a('0x2d')](_[_0x253a('0x35')](_0x531e8b[_0x253a('0x2b')],_0x37ac27[_0x253a('0x2d')]));if(_0x531e8b[_0x253a('0x2b')][_0x253a('0x36')]){_0x540835[_0x253a('0x34')]=_[_0x253a('0x37')](_0x540835[_0x253a('0x34')],{'$or':_[_0x253a('0x26')](_0x540835[_0x253a('0x2f')],function(_0x2a6d28){var _0xc94573={};_0xc94573[_0x2a6d28]={'$like':'%'+_0x531e8b['query'][_0x253a('0x36')]+'%'};return _0xc94573;})});}_0x540835=_[_0x253a('0x37')]({},_0x540835,_0x531e8b[_0x253a('0x38')]);return _0x5840d1['getConfigurations'](_0x540835);}})['then'](function(_0x2713f7){if(_0x2713f7){_0x437221=_0x2713f7[_0x253a('0x47')];if(!_0x531e8b['query'][_0x253a('0x48')]('nolimit')){_0x540835[_0x253a('0x1a')]=qs[_0x253a('0x1a')](_0x531e8b[_0x253a('0x2b')][_0x253a('0x1a')]);_0x540835[_0x253a('0x19')]=qs[_0x253a('0x19')](_0x531e8b[_0x253a('0x2b')]['offset']);}return _0x5840d1[_0x253a('0x44')](_0x540835);}})[_0x253a('0x20')](function(_0x50cdea){if(_0x50cdea){return _0x50cdea?{'count':_0x437221,'rows':_0x50cdea}:null;}})[_0x253a('0x20')](respondWithResult(_0x8e2d7f,null))[_0x253a('0x3c')](handleError(_0x8e2d7f,null));};exports['addConfiguration']=function(_0x54218d,_0x17984f,_0x609caa){if(_0x54218d['body']['id']){delete _0x54218d[_0x253a('0x43')]['id'];}return db[_0x253a('0x27')]['findOne']({'where':{'id':_0x54218d[_0x253a('0x3e')]['id']}})[_0x253a('0x20')](handleEntityNotFound(_0x17984f,null))[_0x253a('0x20')](function(_0x2e155e){if(_0x2e155e){_0x54218d[_0x253a('0x43')][_0x253a('0x49')]=_0x2e155e['id'];_0x54218d[_0x253a('0x43')][_0x253a('0x4a')]=integrations[_0x253a('0x4b')](_0x54218d[_0x253a('0x43')][_0x253a('0x4c')],_0x54218d[_0x253a('0x43')][_0x253a('0x29')]);_0x54218d[_0x253a('0x43')][_0x253a('0x4d')]=integrations[_0x253a('0x4e')](_0x54218d[_0x253a('0x43')][_0x253a('0x4c')],_0x54218d[_0x253a('0x43')][_0x253a('0x29')]);return db[_0x253a('0x46')]['create'](_0x54218d['body'],{'include':[{'model':db['SalesforceField'],'as':_0x253a('0x4a')},{'model':db[_0x253a('0x4f')],'as':_0x253a('0x4d')}]});}return null;})[_0x253a('0x20')](respondWithResult(_0x17984f,null))[_0x253a('0x3c')](handleError(_0x17984f,null));};exports[_0x253a('0x50')]=function(_0x2fe60f,_0x104ef1,_0x4b9eda){var _0x2c3239;var _0x595c6d='';var _0x52a228=_0x253a('0x51');return db[_0x253a('0x27')]['findOne']({'where':{'id':_0x2fe60f[_0x253a('0x3e')]['id']},'attributes':['id',_0x253a('0x52'),_0x253a('0x53'),_0x253a('0x54'),_0x253a('0x55'),_0x253a('0x56'),_0x253a('0x57')]})['then'](handleEntityNotFound(_0x104ef1,null))[_0x253a('0x20')](function(_0x41fc0a){if(_0x41fc0a){_0x595c6d=_0x41fc0a['remoteUri'];var _0x788915=_0x595c6d[_0x253a('0x58')](-0x1);if(_0x788915==='/'){_0x595c6d=_0x595c6d[_0x253a('0x59')](0x0,_0x595c6d[_0x253a('0x5a')](_0x788915));}_0x2c3239=new jsforce['Connection']({'oauth2':{'loginUrl':_0x595c6d,'clientId':_0x41fc0a[_0x253a('0x53')],'clientSecret':_0x41fc0a['clientSecret']}});return _0x2c3239[_0x253a('0x5b')](_0x41fc0a[_0x253a('0x55')],_0x41fc0a[_0x253a('0x56')]['concat'](_0x41fc0a[_0x253a('0x57')]));}})[_0x253a('0x20')](function(_0x37ca8c){if(_0x37ca8c){if(!_['isNil'](_0x2fe60f[_0x253a('0x2b')]['ticketType'])){_0x52a228=_0x2fe60f[_0x253a('0x2b')][_0x253a('0x5c')];}return _0x2c3239[_0x253a('0x5d')](_0x52a228)['describe']();}})[_0x253a('0x20')](function(_0x2aef01){var _0xeb2cee=[_0x253a('0x5e'),'ActivityDate','IsReminderSet','IsRecurrence',_0x253a('0x5f'),_0x253a('0x60')];var _0x900ef4=['string','int',_0x253a('0x61'),'boolean',_0x253a('0x62'),_0x253a('0x63'),'phone'];if(_0x2aef01){_[_0x253a('0x64')](_0x2aef01[_0x253a('0x30')],function(_0x139747){return _0xeb2cee[_0x253a('0x65')](_0x139747['name'])||!_0x900ef4[_0x253a('0x65')](_0x139747[_0x253a('0x29')]);});return{'count':_0x2aef01[_0x253a('0x30')]['length'],'rows':_['map'](_0x2aef01['fields'],function(_0x2e3763){return{'id':_0x2e3763[_0x253a('0x24')],'name':_0x2e3763['label'],'custom':_0x2e3763[_0x253a('0x66')],'options':_0x2e3763[_0x253a('0x67')]['length']>0x0?_[_0x253a('0x26')](_0x2e3763[_0x253a('0x67')],function(_0x5eda55){return{'name':_0x5eda55[_0x253a('0x68')],'value':_0x5eda55[_0x253a('0x69')]};}):_0x2e3763['type']=='boolean'?[{'name':_0x253a('0x6a'),'value':_0x253a('0x6b')},{'name':_0x253a('0x6c'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x104ef1,null))[_0x253a('0x3c')](function(_0x42277f){var _0x9d49ad=_0x2fe60f['query'][_0x253a('0x6d')]?0x1f4:_0x42277f[_0x253a('0x6e')]||0x1f4;logger[_0x253a('0x23')](_0x253a('0x6f'),_0x253a('0x50'),_0x9d49ad,JSON[_0x253a('0x70')](_0x42277f));delete _0x42277f[_0x253a('0x24')];if(_0x9d49ad===0x191){_0x9d49ad=0x190;}_0x104ef1[_0x253a('0x1c')](_0x9d49ad)['send'](_0x2fe60f['query'][_0x253a('0x6d')]?{'message':_0x253a('0x71'),'statusCode':_0x42277f[_0x253a('0x6e')]}:_0x42277f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2e7f2e8..4123b40 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 _0xda79=['api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util'];(function(_0x58d9c5,_0x575cb7){var _0x4ade69=function(_0x1b9dfd){while(--_0x1b9dfd){_0x58d9c5['push'](_0x58d9c5['shift']());}};_0x4ade69(++_0x575cb7);}(_0xda79,0x82));var _0x9da7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xda79[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require('../../config/logger')(_0x9da7('0x2'));var moment=require('moment');var BPromise=require(_0x9da7('0x3'));var rp=require(_0x9da7('0x4'));var fs=require('fs');var path=require(_0x9da7('0x5'));var rimraf=require('rimraf');var config=require(_0x9da7('0x6'));var attributes=require(_0x9da7('0x7'));var integrations=require(_0x9da7('0x8'));module[_0x9da7('0x9')]=function(_0x2d1a1,_0x1cfb66){return _0x2d1a1[_0x9da7('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7444=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x947810,_0x421b70){var _0x57acf5=function(_0x3a6a12){while(--_0x3a6a12){_0x947810['push'](_0x947810['shift']());}};_0x57acf5(++_0x421b70);}(_0x7444,0x83));var _0x4744=function(_0x3e18f2,_0x5f52a4){_0x3e18f2=_0x3e18f2-0x0;var _0x3ba21e=_0x7444[_0x3e18f2];return _0x3ba21e;};'use strict';var _=require(_0x4744('0x0'));var util=require(_0x4744('0x1'));var logger=require(_0x4744('0x2'))(_0x4744('0x3'));var moment=require(_0x4744('0x4'));var BPromise=require('bluebird');var rp=require(_0x4744('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4744('0x6'));var config=require(_0x4744('0x7'));var attributes=require(_0x4744('0x8'));var integrations=require(_0x4744('0x9'));module[_0x4744('0xa')]=function(_0x17e83d,_0x923c0e){return _0x17e83d[_0x4744('0xb')](_0x4744('0xc'),attributes,{'tableName':_0x4744('0xd'),'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 1e68940..00ae440 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 _0x1865=['map','model','attributes','include','debug','catch','ShowSalesforceAccount','find','then','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit'];(function(_0x5da853,_0x1d33c1){var _0x44fa40=function(_0x3691cc){while(--_0x3691cc){_0x5da853['push'](_0x5da853['shift']());}};_0x44fa40(++_0x1d33c1);}(_0x1865,0x6f));var _0x5186=function(_0x1a4a7a,_0x3a6a3c){_0x1a4a7a=_0x1a4a7a-0x0;var _0x57aaf2=_0x1865[_0x1a4a7a];return _0x57aaf2;};'use strict';var _=require(_0x5186('0x0'));var util=require('util');var moment=require(_0x5186('0x1'));var BPromise=require(_0x5186('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5186('0x3'))['db'];var utils=require(_0x5186('0x4'));var logger=require(_0x5186('0x5'))(_0x5186('0x6'));var config=require(_0x5186('0x7'));var jayson=require(_0x5186('0x8'));var client=jayson[_0x5186('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51af80,_0x22a55e,_0x3bfa27){return new BPromise(function(_0x4568b4,_0x170aed){return client['request'](_0x51af80,_0x3bfa27)['then'](function(_0x170df){logger[_0x5186('0xa')](_0x5186('0xb'),_0x22a55e,_0x5186('0xc'));logger['debug'](_0x5186('0xd'),_0x22a55e,'request\x20sent',JSON[_0x5186('0xe')](_0x170df));if(_0x170df[_0x5186('0xf')]){if(_0x170df[_0x5186('0xf')][_0x5186('0x10')]===0x1f4){logger[_0x5186('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x22a55e,_0x170df['error'][_0x5186('0x11')]);return _0x170aed(_0x170df[_0x5186('0xf')][_0x5186('0x11')]);}logger[_0x5186('0xf')](_0x5186('0xb'),_0x22a55e,_0x170df[_0x5186('0xf')]['message']);return _0x4568b4(_0x170df[_0x5186('0xf')][_0x5186('0x11')]);}else{logger[_0x5186('0xa')](_0x5186('0xb'),_0x22a55e,_0x5186('0xc'));_0x4568b4(_0x170df[_0x5186('0x12')][_0x5186('0x11')]);}})['catch'](function(_0x52009b){logger['error'](_0x5186('0xb'),_0x22a55e,_0x52009b);_0x170aed(_0x52009b);});});}exports[_0x5186('0x13')]=function(_0x468656){var _0x51b03f=this;return new Promise(function(_0x5ac2a2,_0x36887a){return db[_0x5186('0x14')][_0x5186('0x15')]({'raw':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')][_0x5186('0x17')]===undefined?!![]:![]:!![],'where':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['where']||null:null,'attributes':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['attributes']||null:null,'limit':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')][_0x5186('0x18')]||null:null,'include':_0x468656[_0x5186('0x16')]?_0x468656[_0x5186('0x16')]['include']?_[_0x5186('0x19')](_0x468656[_0x5186('0x16')]['include'],function(_0x113954){return{'model':db[_0x113954[_0x5186('0x1a')]],'as':_0x113954['as'],'attributes':_0x113954[_0x5186('0x1b')],'include':_0x113954['include']?_['map'](_0x113954['include'],function(_0x9eb71){return{'model':db[_0x9eb71[_0x5186('0x1a')]],'as':_0x9eb71['as'],'attributes':_0x9eb71['attributes'],'include':_0x9eb71[_0x5186('0x1c')]?_[_0x5186('0x19')](_0x9eb71['include'],function(_0x290fc5){return{'model':db[_0x290fc5[_0x5186('0x1a')]],'as':_0x290fc5['as'],'attributes':_0x290fc5[_0x5186('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x157437){logger[_0x5186('0xa')]('GetSalesforceAccount',_0x468656);logger[_0x5186('0x1d')](_0x5186('0x13'),_0x468656,JSON[_0x5186('0xe')](_0x157437));_0x5ac2a2(_0x157437);})[_0x5186('0x1e')](function(_0x4fe069){logger[_0x5186('0xf')](_0x5186('0x13'),_0x4fe069[_0x5186('0x11')],_0x468656);_0x36887a(_0x51b03f[_0x5186('0xf')](0x1f4,_0x4fe069[_0x5186('0x11')]));});});};exports[_0x5186('0x1f')]=function(_0x3eb6ee){var _0x27076b=this;return new Promise(function(_0x4c8ee7,_0x7a681b){return db['SalesforceAccount'][_0x5186('0x20')]({'raw':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['where']||null:null,'attributes':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['attributes']||null:null,'include':_0x3eb6ee[_0x5186('0x16')]?_0x3eb6ee[_0x5186('0x16')]['include']?_['map'](_0x3eb6ee[_0x5186('0x16')][_0x5186('0x1c')],function(_0x603ff4){return{'model':db[_0x603ff4['model']],'as':_0x603ff4['as'],'attributes':_0x603ff4[_0x5186('0x1b')],'include':_0x603ff4[_0x5186('0x1c')]?_['map'](_0x603ff4[_0x5186('0x1c')],function(_0x35ea5b){return{'model':db[_0x35ea5b[_0x5186('0x1a')]],'as':_0x35ea5b['as'],'attributes':_0x35ea5b[_0x5186('0x1b')],'include':_0x35ea5b['include']?_[_0x5186('0x19')](_0x35ea5b['include'],function(_0x5b73b4){return{'model':db[_0x5b73b4[_0x5186('0x1a')]],'as':_0x5b73b4['as'],'attributes':_0x5b73b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5186('0x21')](function(_0x472566){logger['info'](_0x5186('0x1f'),_0x3eb6ee);logger[_0x5186('0x1d')](_0x5186('0x1f'),_0x3eb6ee,JSON[_0x5186('0xe')](_0x472566));_0x4c8ee7(_0x472566);})[_0x5186('0x1e')](function(_0x1bd609){logger[_0x5186('0xf')](_0x5186('0x1f'),_0x1bd609[_0x5186('0x11')],_0x3eb6ee);_0x7a681b(_0x27076b[_0x5186('0xf')](0x1f4,_0x1bd609[_0x5186('0x11')]));});});}; \ No newline at end of file +var _0x0323=['model','debug','ShowSalesforceAccount','find','then','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0323,0x102));var _0x3032=function(_0x2667ca,_0x32bf7f){_0x2667ca=_0x2667ca-0x0;var _0x2095ef=_0x0323[_0x2667ca];return _0x2095ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3032('0x0'));var BPromise=require(_0x3032('0x1'));var rs=require(_0x3032('0x2'));var fs=require('fs');var Redis=require(_0x3032('0x3'));var db=require(_0x3032('0x4'))['db'];var utils=require(_0x3032('0x5'));var logger=require(_0x3032('0x6'))('rpc');var config=require(_0x3032('0x7'));var jayson=require(_0x3032('0x8'));var client=jayson[_0x3032('0x9')][_0x3032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x546186,_0x1294b6,_0x14cf5d){return new BPromise(function(_0x183d57,_0x249526){return client[_0x3032('0xb')](_0x546186,_0x14cf5d)['then'](function(_0x482620){logger[_0x3032('0xc')](_0x3032('0xd'),_0x1294b6,_0x3032('0xe'));logger['debug'](_0x3032('0xf'),_0x1294b6,_0x3032('0xe'),JSON['stringify'](_0x482620));if(_0x482620[_0x3032('0x10')]){if(_0x482620[_0x3032('0x10')][_0x3032('0x11')]===0x1f4){logger[_0x3032('0x10')](_0x3032('0xd'),_0x1294b6,_0x482620['error'][_0x3032('0x12')]);return _0x249526(_0x482620[_0x3032('0x10')][_0x3032('0x12')]);}logger[_0x3032('0x10')](_0x3032('0xd'),_0x1294b6,_0x482620[_0x3032('0x10')][_0x3032('0x12')]);return _0x183d57(_0x482620[_0x3032('0x10')][_0x3032('0x12')]);}else{logger[_0x3032('0xc')](_0x3032('0xd'),_0x1294b6,_0x3032('0xe'));_0x183d57(_0x482620['result'][_0x3032('0x12')]);}})[_0x3032('0x13')](function(_0x4aca35){logger[_0x3032('0x10')](_0x3032('0xd'),_0x1294b6,_0x4aca35);_0x249526(_0x4aca35);});});}exports[_0x3032('0x14')]=function(_0x735277){var _0x56fbda=this;return new Promise(function(_0x53cc47,_0x401419){return db[_0x3032('0x15')][_0x3032('0x16')]({'raw':_0x735277[_0x3032('0x17')]?_0x735277[_0x3032('0x17')][_0x3032('0x18')]===undefined?!![]:![]:!![],'where':_0x735277[_0x3032('0x17')]?_0x735277[_0x3032('0x17')][_0x3032('0x19')]||null:null,'attributes':_0x735277[_0x3032('0x17')]?_0x735277[_0x3032('0x17')][_0x3032('0x1a')]||null:null,'limit':_0x735277[_0x3032('0x17')]?_0x735277[_0x3032('0x17')][_0x3032('0x1b')]||null:null,'include':_0x735277[_0x3032('0x17')]?_0x735277['options'][_0x3032('0x1c')]?_[_0x3032('0x1d')](_0x735277[_0x3032('0x17')][_0x3032('0x1c')],function(_0x4d0771){return{'model':db[_0x4d0771[_0x3032('0x1e')]],'as':_0x4d0771['as'],'attributes':_0x4d0771['attributes'],'include':_0x4d0771[_0x3032('0x1c')]?_[_0x3032('0x1d')](_0x4d0771[_0x3032('0x1c')],function(_0x3129fe){return{'model':db[_0x3129fe['model']],'as':_0x3129fe['as'],'attributes':_0x3129fe[_0x3032('0x1a')],'include':_0x3129fe['include']?_[_0x3032('0x1d')](_0x3129fe[_0x3032('0x1c')],function(_0x39650b){return{'model':db[_0x39650b[_0x3032('0x1e')]],'as':_0x39650b['as'],'attributes':_0x39650b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x54fe67){logger['info'](_0x3032('0x14'),_0x735277);logger[_0x3032('0x1f')]('GetSalesforceAccount',_0x735277,JSON['stringify'](_0x54fe67));_0x53cc47(_0x54fe67);})[_0x3032('0x13')](function(_0x533801){logger[_0x3032('0x10')](_0x3032('0x14'),_0x533801['message'],_0x735277);_0x401419(_0x56fbda[_0x3032('0x10')](0x1f4,_0x533801['message']));});});};exports[_0x3032('0x20')]=function(_0x1ad75d){var _0x1b3191=this;return new Promise(function(_0x88adaf,_0x376aaf){return db[_0x3032('0x15')][_0x3032('0x21')]({'raw':_0x1ad75d[_0x3032('0x17')]?_0x1ad75d['options'][_0x3032('0x18')]===undefined?!![]:![]:!![],'where':_0x1ad75d[_0x3032('0x17')]?_0x1ad75d['options']['where']||null:null,'attributes':_0x1ad75d[_0x3032('0x17')]?_0x1ad75d['options']['attributes']||null:null,'include':_0x1ad75d[_0x3032('0x17')]?_0x1ad75d[_0x3032('0x17')]['include']?_[_0x3032('0x1d')](_0x1ad75d[_0x3032('0x17')][_0x3032('0x1c')],function(_0x204ce2){return{'model':db[_0x204ce2['model']],'as':_0x204ce2['as'],'attributes':_0x204ce2[_0x3032('0x1a')],'include':_0x204ce2['include']?_['map'](_0x204ce2[_0x3032('0x1c')],function(_0xb8aff0){return{'model':db[_0xb8aff0[_0x3032('0x1e')]],'as':_0xb8aff0['as'],'attributes':_0xb8aff0[_0x3032('0x1a')],'include':_0xb8aff0[_0x3032('0x1c')]?_[_0x3032('0x1d')](_0xb8aff0[_0x3032('0x1c')],function(_0x1cbea0){return{'model':db[_0x1cbea0[_0x3032('0x1e')]],'as':_0x1cbea0['as'],'attributes':_0x1cbea0[_0x3032('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3032('0x22')](function(_0x3e995f){logger[_0x3032('0xc')]('ShowSalesforceAccount',_0x1ad75d);logger['debug']('ShowSalesforceAccount',_0x1ad75d,JSON[_0x3032('0x23')](_0x3e995f));_0x88adaf(_0x3e995f);})[_0x3032('0x13')](function(_0x1c0dd1){logger[_0x3032('0x10')](_0x3032('0x20'),_0x1c0dd1[_0x3032('0x12')],_0x1ad75d);_0x376aaf(_0x1b3191['error'](0x1f4,_0x1c0dd1[_0x3032('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ce11180..5f4cf1f 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x56d02c,_0x5e20a1){var _0x43c693=function(_0x2f933d){while(--_0x2f933d){_0x56d02c['push'](_0x56d02c['shift']());}};_0x43c693(++_0x5e20a1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x1225fa,_0x253373){var _0x5198f9=function(_0x39827a){while(--_0x39827a){_0x1225fa['push'](_0x1225fa['shift']());}};_0x5198f9(++_0x253373);}(_0x7a54,0x106));var _0x47a5=function(_0x3bb67d,_0x7f66ea){_0x3bb67d=_0x3bb67d-0x0;var _0x5e9a52=_0x7a54[_0x3bb67d];return _0x5e9a52;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cee473b..449c2f3 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 _0x5cce=['account_contact_lead','account','sequelize','exports','STRING','ENUM','Task','Case','contact','lead'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5cce,0x160));var _0xe5cc=function(_0x3ebe8f,_0x310ba8){_0x3ebe8f=_0x3ebe8f-0x0;var _0x502270=_0x5cce[_0x3ebe8f];return _0x502270;};'use strict';var Sequelize=require(_0xe5cc('0x0'));module[_0xe5cc('0x1')]={'name':{'type':Sequelize[_0xe5cc('0x2')]},'description':{'type':Sequelize[_0xe5cc('0x2')]},'ticketType':{'type':Sequelize[_0xe5cc('0x3')](_0xe5cc('0x4'),_0xe5cc('0x5')),'defaultValue':_0xe5cc('0x4')},'moduleSearch':{'type':Sequelize[_0xe5cc('0x3')]('contact_lead',_0xe5cc('0x6'),_0xe5cc('0x7'),_0xe5cc('0x8'),_0xe5cc('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe5cc('0x3')]('nothing',_0xe5cc('0x6'),_0xe5cc('0x7'),_0xe5cc('0x9')),'defaultValue':_0xe5cc('0x7')},'leadId':{'type':Sequelize[_0xe5cc('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xe5cc('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xe5cc('0x2')]}}; \ No newline at end of file +var _0xa74b=['STRING','sequelize','exports','Case','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74b,0x140));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xba74('0x0'));module[_0xba74('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0xba74('0x2')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xba74('0x3')](_0xba74('0x4'),'contact',_0xba74('0x5'),_0xba74('0x6'),_0xba74('0x7')),'defaultValue':_0xba74('0x4')},'moduleCreate':{'type':Sequelize[_0xba74('0x3')](_0xba74('0x8'),_0xba74('0x9'),_0xba74('0x5'),_0xba74('0x7')),'defaultValue':_0xba74('0x5')},'leadId':{'type':Sequelize[_0xba74('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0xba74('0xa')]},'additionalSearchContact':{'type':Sequelize[_0xba74('0xa')]},'additionalSearchLead':{'type':Sequelize[_0xba74('0xa')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7d7ddda..18be9f0 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 _0xbf63=['filters','where','merge','map','filter','options','include','SalesforceConfiguration','findAll','catch','show','params','includeAll','create','body','find','destroy','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5d63a5,_0x53976c){var _0x534a5c=function(_0x1f6892){while(--_0x1f6892){_0x5d63a5['push'](_0x5d63a5['shift']());}};_0x534a5c(++_0x53976c);}(_0xbf63,0x1eb));var _0x3bf6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbf63[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x3bf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bf6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bf6('0x2'));var BPromise=require(_0x3bf6('0x3'));var Mustache=require(_0x3bf6('0x4'));var util=require(_0x3bf6('0x5'));var path=require(_0x3bf6('0x6'));var sox=require(_0x3bf6('0x7'));var csv=require(_0x3bf6('0x8'));var ejs=require(_0x3bf6('0x9'));var fs=require('fs');var fs_extra=require(_0x3bf6('0xa'));var _=require(_0x3bf6('0xb'));var squel=require(_0x3bf6('0xc'));var crypto=require(_0x3bf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3bf6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bf6('0xf'));var Redis=require(_0x3bf6('0x10'));var authService=require(_0x3bf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3bf6('0x12'));var hardwareService=require(_0x3bf6('0x13'));var logger=require(_0x3bf6('0x14'))(_0x3bf6('0x15'));var utils=require('../../config/utils');var config=require(_0x3bf6('0x16'));var licenseUtil=require(_0x3bf6('0x17'));var db=require(_0x3bf6('0x18'))['db'];function respondWithStatusCode(_0x57afa7,_0x3be423){_0x3be423=_0x3be423||0xcc;return function(_0x4dfe94){if(_0x4dfe94){return _0x57afa7[_0x3bf6('0x19')](_0x3be423);}return _0x57afa7[_0x3bf6('0x1a')](_0x3be423)[_0x3bf6('0x1b')]();};}function respondWithResult(_0xd7cac5,_0x4e9d24){_0x4e9d24=_0x4e9d24||0xc8;return function(_0x56a47b){if(_0x56a47b){return _0xd7cac5['status'](_0x4e9d24)['json'](_0x56a47b);}};}function respondWithFilteredResult(_0xa5818d,_0x19fe93){return function(_0x340865){if(_0x340865){var _0x48b89b=typeof _0x19fe93[_0x3bf6('0x1c')]==='undefined'&&typeof _0x19fe93[_0x3bf6('0x1d')]===_0x3bf6('0x1e');var _0x59ebbf=_0x340865[_0x3bf6('0x1f')];var _0x3944ef=_0x48b89b?0x0:_0x19fe93[_0x3bf6('0x1c')];var _0x267f28=_0x48b89b?_0x340865[_0x3bf6('0x1f')]:_0x19fe93[_0x3bf6('0x1c')]+_0x19fe93[_0x3bf6('0x1d')];var _0x247a89;if(_0x267f28>=_0x59ebbf){_0x267f28=_0x59ebbf;_0x247a89=0xc8;}else{_0x247a89=0xce;}_0xa5818d[_0x3bf6('0x1a')](_0x247a89);return _0xa5818d['set'](_0x3bf6('0x20'),_0x3944ef+'-'+_0x267f28+'/'+_0x59ebbf)['json'](_0x340865);}return null;};}function patchUpdates(_0x1ff99b){return function(_0x2c375e){try{jsonpatch[_0x3bf6('0x21')](_0x2c375e,_0x1ff99b,!![]);}catch(_0x1bf4e9){return BPromise['reject'](_0x1bf4e9);}return _0x2c375e[_0x3bf6('0x22')]();};}function saveUpdates(_0x13dd5e,_0x56caa3){return function(_0x3db9a2){if(_0x3db9a2){return _0x3db9a2[_0x3bf6('0x23')](_0x13dd5e)[_0x3bf6('0x24')](function(_0x2fd089){return _0x2fd089;});}return null;};}function removeEntity(_0x151b27,_0x356348){return function(_0x89cbcc){if(_0x89cbcc){return _0x89cbcc['destroy']()[_0x3bf6('0x24')](function(){_0x151b27[_0x3bf6('0x1a')](0xcc)[_0x3bf6('0x1b')]();});}};}function handleEntityNotFound(_0x55fae0,_0x3d3e8e){return function(_0x8ca4f5){if(!_0x8ca4f5){_0x55fae0[_0x3bf6('0x19')](0x194);}return _0x8ca4f5;};}function handleError(_0xa79ed4,_0x4f15f5){_0x4f15f5=_0x4f15f5||0x1f4;return function(_0x49d574){logger[_0x3bf6('0x25')](_0x49d574[_0x3bf6('0x26')]);if(_0x49d574[_0x3bf6('0x27')]){delete _0x49d574[_0x3bf6('0x27')];}_0xa79ed4[_0x3bf6('0x1a')](_0x4f15f5)[_0x3bf6('0x28')](_0x49d574);};}exports[_0x3bf6('0x29')]=function(_0x23c37b,_0x23118e){var _0x1d825f={},_0x2fd1f9={},_0x3b2304={'count':0x0,'rows':[]};var _0x167fb6=_['map'](db['SalesforceConfiguration'][_0x3bf6('0x2a')],function(_0x34b84b){return{'name':_0x34b84b['fieldName'],'type':_0x34b84b[_0x3bf6('0x2b')]['key']};});_0x2fd1f9['model']=_['map'](_0x167fb6,_0x3bf6('0x27'));_0x2fd1f9['query']=_[_0x3bf6('0x2c')](_0x23c37b['query']);_0x2fd1f9['filters']=_[_0x3bf6('0x2d')](_0x2fd1f9[_0x3bf6('0x2e')],_0x2fd1f9[_0x3bf6('0x2f')]);_0x1d825f[_0x3bf6('0x30')]=_['intersection'](_0x2fd1f9[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x23c37b['query'][_0x3bf6('0x31')]));_0x1d825f['attributes']=_0x1d825f[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x1d825f[_0x3bf6('0x30')]:_0x2fd1f9[_0x3bf6('0x2e')];if(!_0x23c37b['query'][_0x3bf6('0x33')](_0x3bf6('0x34'))){_0x1d825f[_0x3bf6('0x1d')]=qs[_0x3bf6('0x1d')](_0x23c37b[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x1d825f[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x23c37b[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}_0x1d825f[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x23c37b['query'][_0x3bf6('0x36')]);_0x1d825f['where']=qs[_0x3bf6('0x37')](_['pick'](_0x23c37b[_0x3bf6('0x2f')],_0x2fd1f9[_0x3bf6('0x37')]),_0x167fb6);if(_0x23c37b[_0x3bf6('0x2f')]['filter']){_0x1d825f[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x1d825f[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x167fb6,function(_0x2e99cc){if(_0x2e99cc['type']!=='VIRTUAL'){var _0x57c2ce={};_0x57c2ce[_0x2e99cc['name']]={'$like':'%'+_0x23c37b['query'][_0x3bf6('0x3b')]+'%'};return _0x57c2ce;}})});}_0x1d825f=_[_0x3bf6('0x39')]({},_0x1d825f,_0x23c37b[_0x3bf6('0x3c')]);var _0x1be12a={'where':_0x1d825f['where']};return db['SalesforceConfiguration'][_0x3bf6('0x1f')](_0x1be12a)[_0x3bf6('0x24')](function(_0x506e4c){_0x3b2304[_0x3bf6('0x1f')]=_0x506e4c;if(_0x23c37b['query']['includeAll']){_0x1d825f[_0x3bf6('0x3d')]=[{'all':!![]}];}return db[_0x3bf6('0x3e')][_0x3bf6('0x3f')](_0x1d825f);})[_0x3bf6('0x24')](function(_0x2c338f){_0x3b2304['rows']=_0x2c338f;return _0x3b2304;})['then'](respondWithFilteredResult(_0x23118e,_0x1d825f))[_0x3bf6('0x40')](handleError(_0x23118e,null));};exports[_0x3bf6('0x41')]=function(_0x517d63,_0x555c46){var _0x10d65c={'raw':![],'where':{'id':_0x517d63[_0x3bf6('0x42')]['id']}},_0x807443={};_0x807443[_0x3bf6('0x2e')]=_[_0x3bf6('0x2c')](db[_0x3bf6('0x3e')]['rawAttributes']);_0x807443[_0x3bf6('0x2f')]=_['keys'](_0x517d63[_0x3bf6('0x2f')]);_0x807443['filters']=_[_0x3bf6('0x2d')](_0x807443[_0x3bf6('0x2e')],_0x807443['query']);_0x10d65c[_0x3bf6('0x30')]=_[_0x3bf6('0x2d')](_0x807443[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x517d63[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x10d65c[_0x3bf6('0x30')]=_0x10d65c['attributes']['length']?_0x10d65c[_0x3bf6('0x30')]:_0x807443[_0x3bf6('0x2e')];if(_0x517d63[_0x3bf6('0x2f')][_0x3bf6('0x43')]){_0x10d65c['include']=[{'all':!![]}];}_0x10d65c=_['merge']({},_0x10d65c,_0x517d63['options']);return db['SalesforceConfiguration']['find'](_0x10d65c)[_0x3bf6('0x24')](handleEntityNotFound(_0x555c46,null))[_0x3bf6('0x24')](respondWithResult(_0x555c46,null))[_0x3bf6('0x40')](handleError(_0x555c46,null));};exports[_0x3bf6('0x44')]=function(_0xebd4c3,_0x30ff8a){return db[_0x3bf6('0x3e')][_0x3bf6('0x44')](_0xebd4c3[_0x3bf6('0x45')],{})[_0x3bf6('0x24')](respondWithResult(_0x30ff8a,0xc9))['catch'](handleError(_0x30ff8a,null));};exports['update']=function(_0x21a344,_0x2d985c){if(_0x21a344[_0x3bf6('0x45')]['id']){delete _0x21a344['body']['id'];}return db[_0x3bf6('0x3e')][_0x3bf6('0x46')]({'where':{'id':_0x21a344[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x2d985c,null))[_0x3bf6('0x24')](saveUpdates(_0x21a344[_0x3bf6('0x45')],null))[_0x3bf6('0x24')](respondWithResult(_0x2d985c,null))[_0x3bf6('0x40')](handleError(_0x2d985c,null));};exports[_0x3bf6('0x47')]=function(_0x4d90aa,_0x2b643a){return db['SalesforceConfiguration']['find']({'where':{'id':_0x4d90aa[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x2b643a,null))['then'](removeEntity(_0x2b643a,null))[_0x3bf6('0x40')](handleError(_0x2b643a,null));};exports[_0x3bf6('0x48')]=function(_0x32df20,_0x17771e,_0x140e34){var _0x2412ec={};var _0x356770={};var _0x1237e4;var _0x567b6b;return db['SalesforceConfiguration'][_0x3bf6('0x49')]({'where':{'id':_0x32df20[_0x3bf6('0x42')]['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x17771e,null))[_0x3bf6('0x24')](function(_0x4e9299){if(_0x4e9299){_0x1237e4=_0x4e9299;_0x356770[_0x3bf6('0x2e')]=_[_0x3bf6('0x2c')](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x356770[_0x3bf6('0x2f')]=_[_0x3bf6('0x2c')](_0x32df20[_0x3bf6('0x2f')]);_0x356770[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x356770[_0x3bf6('0x2e')],_0x356770[_0x3bf6('0x2f')]);_0x2412ec[_0x3bf6('0x30')]=_['intersection'](_0x356770[_0x3bf6('0x2e')],qs[_0x3bf6('0x31')](_0x32df20[_0x3bf6('0x2f')]['fields']));_0x2412ec[_0x3bf6('0x30')]=_0x2412ec[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x2412ec[_0x3bf6('0x30')]:_0x356770[_0x3bf6('0x2e')];_0x2412ec[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x32df20[_0x3bf6('0x2f')][_0x3bf6('0x36')]);_0x2412ec['where']=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x32df20[_0x3bf6('0x2f')],_0x356770[_0x3bf6('0x37')]));if(_0x32df20[_0x3bf6('0x2f')]['filter']){_0x2412ec[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x2412ec[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x2412ec[_0x3bf6('0x30')],function(_0xccbb40){var _0x3824af={};_0x3824af[_0xccbb40]={'$like':'%'+_0x32df20['query'][_0x3bf6('0x3b')]+'%'};return _0x3824af;})});}_0x2412ec=_['merge']({},_0x2412ec,_0x32df20[_0x3bf6('0x3c')]);return _0x1237e4['getFields'](_0x2412ec);}})[_0x3bf6('0x24')](function(_0x15b093){if(_0x15b093){_0x567b6b=_0x15b093[_0x3bf6('0x32')];if(!_0x32df20[_0x3bf6('0x2f')]['hasOwnProperty'](_0x3bf6('0x34'))){_0x2412ec['limit']=qs[_0x3bf6('0x1d')](_0x32df20[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x2412ec['offset']=qs['offset'](_0x32df20[_0x3bf6('0x2f')]['offset']);}return _0x1237e4['getFields'](_0x2412ec);}})[_0x3bf6('0x24')](function(_0x1cdb55){if(_0x1cdb55){return _0x1cdb55?{'count':_0x567b6b,'rows':_0x1cdb55}:null;}})['then'](respondWithResult(_0x17771e,null))[_0x3bf6('0x40')](handleError(_0x17771e,null));};exports[_0x3bf6('0x4c')]=function(_0x30a67a,_0x13b7d1,_0x422bae){var _0x53701d={};var _0x2f05b4={};var _0x203c54;var _0x6c3c86;return db['SalesforceConfiguration'][_0x3bf6('0x49')]({'where':{'id':_0x30a67a['params']['id']}})[_0x3bf6('0x24')](handleEntityNotFound(_0x13b7d1,null))[_0x3bf6('0x24')](function(_0x5c45fc){if(_0x5c45fc){_0x203c54=_0x5c45fc;_0x2f05b4[_0x3bf6('0x2e')]=_['keys'](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x2f05b4['query']=_['keys'](_0x30a67a[_0x3bf6('0x2f')]);_0x2f05b4[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x2f05b4[_0x3bf6('0x2e')],_0x2f05b4['query']);_0x53701d[_0x3bf6('0x30')]=_['intersection'](_0x2f05b4[_0x3bf6('0x2e')],qs['fields'](_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x53701d['attributes']=_0x53701d[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x53701d[_0x3bf6('0x30')]:_0x2f05b4['model'];_0x53701d[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x30a67a['query']['sort']);_0x53701d['where']=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x30a67a[_0x3bf6('0x2f')],_0x2f05b4[_0x3bf6('0x37')]));if(_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x3b')]){_0x53701d['where']=_['merge'](_0x53701d['where'],{'$or':_['map'](_0x53701d[_0x3bf6('0x30')],function(_0x3898db){var _0xa1ad08={};_0xa1ad08[_0x3898db]={'$like':'%'+_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x3b')]+'%'};return _0xa1ad08;})});}_0x53701d=_['merge']({},_0x53701d,_0x30a67a[_0x3bf6('0x3c')]);return _0x203c54[_0x3bf6('0x4c')](_0x53701d);}})[_0x3bf6('0x24')](function(_0x2b8e39){if(_0x2b8e39){_0x6c3c86=_0x2b8e39['length'];if(!_0x30a67a['query'][_0x3bf6('0x33')](_0x3bf6('0x34'))){_0x53701d[_0x3bf6('0x1d')]=qs[_0x3bf6('0x1d')](_0x30a67a['query'][_0x3bf6('0x1d')]);_0x53701d[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x30a67a[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}return _0x203c54[_0x3bf6('0x4c')](_0x53701d);}})[_0x3bf6('0x24')](function(_0x2c7779){if(_0x2c7779){return _0x2c7779?{'count':_0x6c3c86,'rows':_0x2c7779}:null;}})[_0x3bf6('0x24')](respondWithResult(_0x13b7d1,null))[_0x3bf6('0x40')](handleError(_0x13b7d1,null));};exports['getDescriptions']=function(_0x31b35f,_0x39489d,_0x44a915){var _0x20fee4={};var _0x238c77={};var _0x1a8b41;var _0x8a96f;return db[_0x3bf6('0x3e')][_0x3bf6('0x49')]({'where':{'id':_0x31b35f[_0x3bf6('0x42')]['id']}})['then'](handleEntityNotFound(_0x39489d,null))['then'](function(_0x4e9356){if(_0x4e9356){_0x1a8b41=_0x4e9356;_0x238c77['model']=_[_0x3bf6('0x2c')](db[_0x3bf6('0x4a')][_0x3bf6('0x2a')]);_0x238c77[_0x3bf6('0x2f')]=_[_0x3bf6('0x2c')](_0x31b35f[_0x3bf6('0x2f')]);_0x238c77[_0x3bf6('0x37')]=_[_0x3bf6('0x2d')](_0x238c77[_0x3bf6('0x2e')],_0x238c77[_0x3bf6('0x2f')]);_0x20fee4[_0x3bf6('0x30')]=_['intersection'](_0x238c77['model'],qs[_0x3bf6('0x31')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x31')]));_0x20fee4[_0x3bf6('0x30')]=_0x20fee4[_0x3bf6('0x30')][_0x3bf6('0x32')]?_0x20fee4[_0x3bf6('0x30')]:_0x238c77[_0x3bf6('0x2e')];_0x20fee4[_0x3bf6('0x35')]=qs[_0x3bf6('0x36')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x36')]);_0x20fee4[_0x3bf6('0x38')]=qs[_0x3bf6('0x37')](_[_0x3bf6('0x4b')](_0x31b35f[_0x3bf6('0x2f')],_0x238c77[_0x3bf6('0x37')]));if(_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x3b')]){_0x20fee4[_0x3bf6('0x38')]=_[_0x3bf6('0x39')](_0x20fee4[_0x3bf6('0x38')],{'$or':_[_0x3bf6('0x3a')](_0x20fee4[_0x3bf6('0x30')],function(_0x25f14d){var _0x14eb51={};_0x14eb51[_0x25f14d]={'$like':'%'+_0x31b35f[_0x3bf6('0x2f')]['filter']+'%'};return _0x14eb51;})});}_0x20fee4=_[_0x3bf6('0x39')]({},_0x20fee4,_0x31b35f[_0x3bf6('0x3c')]);return _0x1a8b41['getDescriptions'](_0x20fee4);}})[_0x3bf6('0x24')](function(_0x25ca94){if(_0x25ca94){_0x8a96f=_0x25ca94[_0x3bf6('0x32')];if(!_0x31b35f[_0x3bf6('0x2f')]['hasOwnProperty'](_0x3bf6('0x34'))){_0x20fee4[_0x3bf6('0x1d')]=qs['limit'](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x1d')]);_0x20fee4[_0x3bf6('0x1c')]=qs[_0x3bf6('0x1c')](_0x31b35f[_0x3bf6('0x2f')][_0x3bf6('0x1c')]);}return _0x1a8b41[_0x3bf6('0x4d')](_0x20fee4);}})['then'](function(_0x4ac55f){if(_0x4ac55f){return _0x4ac55f?{'count':_0x8a96f,'rows':_0x4ac55f}:null;}})[_0x3bf6('0x24')](respondWithResult(_0x39489d,null))[_0x3bf6('0x40')](handleError(_0x39489d,null));}; \ No newline at end of file +var _0x57c6=['../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','SalesforceField','getFields','findOne','nolimit','getDescriptions','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x56d863,_0x299404){var _0x458083=function(_0x27f3d8){while(--_0x27f3d8){_0x56d863['push'](_0x56d863['shift']());}};_0x458083(++_0x299404);}(_0x57c6,0x138));var _0x657c=function(_0x2874a5,_0x32b680){_0x2874a5=_0x2874a5-0x0;var _0x1e427a=_0x57c6[_0x2874a5];return _0x1e427a;};'use strict';var emlformat=require(_0x657c('0x0'));var rimraf=require(_0x657c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x657c('0x2'));var rp=require(_0x657c('0x3'));var moment=require(_0x657c('0x4'));var BPromise=require(_0x657c('0x5'));var Mustache=require(_0x657c('0x6'));var util=require(_0x657c('0x7'));var path=require(_0x657c('0x8'));var sox=require(_0x657c('0x9'));var csv=require(_0x657c('0xa'));var ejs=require(_0x657c('0xb'));var fs=require('fs');var fs_extra=require(_0x657c('0xc'));var _=require(_0x657c('0xd'));var squel=require(_0x657c('0xe'));var crypto=require(_0x657c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x657c('0x10'));var toCsv=require(_0x657c('0xa'));var querystring=require('querystring');var Papa=require(_0x657c('0x11'));var Redis=require(_0x657c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x657c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x657c('0x14'));var logger=require(_0x657c('0x15'))('api');var utils=require(_0x657c('0x16'));var config=require(_0x657c('0x17'));var licenseUtil=require(_0x657c('0x18'));var db=require(_0x657c('0x19'))['db'];function respondWithStatusCode(_0x3fdc1c,_0x16cea1){_0x16cea1=_0x16cea1||0xcc;return function(_0x197d23){if(_0x197d23){return _0x3fdc1c['sendStatus'](_0x16cea1);}return _0x3fdc1c[_0x657c('0x1a')](_0x16cea1)[_0x657c('0x1b')]();};}function respondWithResult(_0x46f117,_0x466ab6){_0x466ab6=_0x466ab6||0xc8;return function(_0x435755){if(_0x435755){return _0x46f117[_0x657c('0x1a')](_0x466ab6)['json'](_0x435755);}};}function respondWithFilteredResult(_0x2d3b48,_0x2949a6){return function(_0x1c85b6){if(_0x1c85b6){var _0x2ba336=typeof _0x2949a6[_0x657c('0x1c')]===_0x657c('0x1d')&&typeof _0x2949a6[_0x657c('0x1e')]==='undefined';var _0x2c1ed1=_0x1c85b6[_0x657c('0x1f')];var _0x260ccf=_0x2ba336?0x0:_0x2949a6['offset'];var _0x1f0cb2=_0x2ba336?_0x1c85b6['count']:_0x2949a6[_0x657c('0x1c')]+_0x2949a6['limit'];var _0x289bbe;if(_0x1f0cb2>=_0x2c1ed1){_0x1f0cb2=_0x2c1ed1;_0x289bbe=0xc8;}else{_0x289bbe=0xce;}_0x2d3b48['status'](_0x289bbe);return _0x2d3b48[_0x657c('0x20')](_0x657c('0x21'),_0x260ccf+'-'+_0x1f0cb2+'/'+_0x2c1ed1)[_0x657c('0x22')](_0x1c85b6);}return null;};}function patchUpdates(_0x58d943){return function(_0xe0cdf6){try{jsonpatch[_0x657c('0x23')](_0xe0cdf6,_0x58d943,!![]);}catch(_0x1994db){return BPromise[_0x657c('0x24')](_0x1994db);}return _0xe0cdf6[_0x657c('0x25')]();};}function saveUpdates(_0x2135fa,_0x2936f6){return function(_0x25739d){if(_0x25739d){return _0x25739d[_0x657c('0x26')](_0x2135fa)[_0x657c('0x27')](function(_0x2177b6){return _0x2177b6;});}return null;};}function removeEntity(_0x117a96,_0x2f053b){return function(_0x188781){if(_0x188781){return _0x188781['destroy']()[_0x657c('0x27')](function(){_0x117a96['status'](0xcc)[_0x657c('0x1b')]();});}};}function handleEntityNotFound(_0x479d85,_0x475081){return function(_0x18d35a){if(!_0x18d35a){_0x479d85[_0x657c('0x28')](0x194);}return _0x18d35a;};}function handleError(_0x20c510,_0x45f9f4){_0x45f9f4=_0x45f9f4||0x1f4;return function(_0x248c56){logger[_0x657c('0x29')](_0x248c56[_0x657c('0x2a')]);if(_0x248c56[_0x657c('0x2b')]){delete _0x248c56[_0x657c('0x2b')];}_0x20c510[_0x657c('0x1a')](_0x45f9f4)[_0x657c('0x2c')](_0x248c56);};}exports[_0x657c('0x2d')]=function(_0x4f8bc0,_0x1adbd5){var _0x2540cf={},_0x451f1e={},_0x36936d={'count':0x0,'rows':[]};var _0xfe6506=_[_0x657c('0x2e')](db[_0x657c('0x2f')][_0x657c('0x30')],function(_0x4ed46a){return{'name':_0x4ed46a[_0x657c('0x31')],'type':_0x4ed46a[_0x657c('0x32')][_0x657c('0x33')]};});_0x451f1e[_0x657c('0x34')]=_[_0x657c('0x2e')](_0xfe6506,_0x657c('0x2b'));_0x451f1e[_0x657c('0x35')]=_[_0x657c('0x36')](_0x4f8bc0['query']);_0x451f1e[_0x657c('0x37')]=_[_0x657c('0x38')](_0x451f1e[_0x657c('0x34')],_0x451f1e[_0x657c('0x35')]);_0x2540cf['attributes']=_[_0x657c('0x38')](_0x451f1e[_0x657c('0x34')],qs[_0x657c('0x39')](_0x4f8bc0[_0x657c('0x35')][_0x657c('0x39')]));_0x2540cf[_0x657c('0x3a')]=_0x2540cf['attributes'][_0x657c('0x3b')]?_0x2540cf['attributes']:_0x451f1e[_0x657c('0x34')];if(!_0x4f8bc0['query'][_0x657c('0x3c')]('nolimit')){_0x2540cf[_0x657c('0x1e')]=qs[_0x657c('0x1e')](_0x4f8bc0['query'][_0x657c('0x1e')]);_0x2540cf[_0x657c('0x1c')]=qs[_0x657c('0x1c')](_0x4f8bc0[_0x657c('0x35')][_0x657c('0x1c')]);}_0x2540cf[_0x657c('0x3d')]=qs['sort'](_0x4f8bc0['query'][_0x657c('0x3e')]);_0x2540cf[_0x657c('0x3f')]=qs['filters'](_[_0x657c('0x40')](_0x4f8bc0['query'],_0x451f1e['filters']),_0xfe6506);if(_0x4f8bc0['query'][_0x657c('0x41')]){_0x2540cf[_0x657c('0x3f')]=_[_0x657c('0x42')](_0x2540cf[_0x657c('0x3f')],{'$or':_['map'](_0xfe6506,function(_0x2b7268){if(_0x2b7268['type']!==_0x657c('0x43')){var _0x12d2d1={};_0x12d2d1[_0x2b7268[_0x657c('0x2b')]]={'$like':'%'+_0x4f8bc0['query'][_0x657c('0x41')]+'%'};return _0x12d2d1;}})});}_0x2540cf=_[_0x657c('0x42')]({},_0x2540cf,_0x4f8bc0['options']);var _0x389745={'where':_0x2540cf['where']};return db[_0x657c('0x2f')][_0x657c('0x1f')](_0x389745)[_0x657c('0x27')](function(_0x26a089){_0x36936d['count']=_0x26a089;if(_0x4f8bc0['query'][_0x657c('0x44')]){_0x2540cf[_0x657c('0x45')]=[{'all':!![]}];}return db[_0x657c('0x2f')][_0x657c('0x46')](_0x2540cf);})[_0x657c('0x27')](function(_0x5d5ea5){_0x36936d[_0x657c('0x47')]=_0x5d5ea5;return _0x36936d;})[_0x657c('0x27')](respondWithFilteredResult(_0x1adbd5,_0x2540cf))[_0x657c('0x48')](handleError(_0x1adbd5,null));};exports[_0x657c('0x49')]=function(_0x572bbf,_0x4ebf4c){var _0x820557={'raw':![],'where':{'id':_0x572bbf[_0x657c('0x4a')]['id']}},_0x1908a3={};_0x1908a3[_0x657c('0x34')]=_[_0x657c('0x36')](db[_0x657c('0x2f')][_0x657c('0x30')]);_0x1908a3[_0x657c('0x35')]=_['keys'](_0x572bbf[_0x657c('0x35')]);_0x1908a3[_0x657c('0x37')]=_[_0x657c('0x38')](_0x1908a3[_0x657c('0x34')],_0x1908a3[_0x657c('0x35')]);_0x820557[_0x657c('0x3a')]=_['intersection'](_0x1908a3[_0x657c('0x34')],qs[_0x657c('0x39')](_0x572bbf[_0x657c('0x35')][_0x657c('0x39')]));_0x820557[_0x657c('0x3a')]=_0x820557[_0x657c('0x3a')][_0x657c('0x3b')]?_0x820557[_0x657c('0x3a')]:_0x1908a3[_0x657c('0x34')];if(_0x572bbf[_0x657c('0x35')][_0x657c('0x44')]){_0x820557[_0x657c('0x45')]=[{'all':!![]}];}_0x820557=_[_0x657c('0x42')]({},_0x820557,_0x572bbf[_0x657c('0x4b')]);return db[_0x657c('0x2f')][_0x657c('0x4c')](_0x820557)[_0x657c('0x27')](handleEntityNotFound(_0x4ebf4c,null))[_0x657c('0x27')](respondWithResult(_0x4ebf4c,null))[_0x657c('0x48')](handleError(_0x4ebf4c,null));};exports['create']=function(_0x80bc39,_0x354b70){return db['SalesforceConfiguration']['create'](_0x80bc39[_0x657c('0x4d')],{})[_0x657c('0x27')](respondWithResult(_0x354b70,0xc9))['catch'](handleError(_0x354b70,null));};exports[_0x657c('0x26')]=function(_0x488f41,_0x13f154){if(_0x488f41[_0x657c('0x4d')]['id']){delete _0x488f41[_0x657c('0x4d')]['id'];}return db[_0x657c('0x2f')][_0x657c('0x4c')]({'where':{'id':_0x488f41['params']['id']}})[_0x657c('0x27')](handleEntityNotFound(_0x13f154,null))[_0x657c('0x27')](saveUpdates(_0x488f41[_0x657c('0x4d')],null))[_0x657c('0x27')](respondWithResult(_0x13f154,null))[_0x657c('0x48')](handleError(_0x13f154,null));};exports[_0x657c('0x4e')]=function(_0x378428,_0x1de909){return db[_0x657c('0x2f')][_0x657c('0x4c')]({'where':{'id':_0x378428[_0x657c('0x4a')]['id']}})[_0x657c('0x27')](handleEntityNotFound(_0x1de909,null))[_0x657c('0x27')](removeEntity(_0x1de909,null))[_0x657c('0x48')](handleError(_0x1de909,null));};exports['getFields']=function(_0x524e97,_0x10a3fc,_0x1fce3f){var _0x3e94ec={};var _0x3f7dd2={};var _0x7b4358;var _0xe1ff8c;return db[_0x657c('0x2f')]['findOne']({'where':{'id':_0x524e97['params']['id']}})['then'](handleEntityNotFound(_0x10a3fc,null))['then'](function(_0x41eaac){if(_0x41eaac){_0x7b4358=_0x41eaac;_0x3f7dd2['model']=_[_0x657c('0x36')](db[_0x657c('0x4f')][_0x657c('0x30')]);_0x3f7dd2[_0x657c('0x35')]=_[_0x657c('0x36')](_0x524e97['query']);_0x3f7dd2[_0x657c('0x37')]=_[_0x657c('0x38')](_0x3f7dd2[_0x657c('0x34')],_0x3f7dd2[_0x657c('0x35')]);_0x3e94ec[_0x657c('0x3a')]=_[_0x657c('0x38')](_0x3f7dd2[_0x657c('0x34')],qs[_0x657c('0x39')](_0x524e97[_0x657c('0x35')]['fields']));_0x3e94ec[_0x657c('0x3a')]=_0x3e94ec[_0x657c('0x3a')][_0x657c('0x3b')]?_0x3e94ec['attributes']:_0x3f7dd2[_0x657c('0x34')];_0x3e94ec[_0x657c('0x3d')]=qs[_0x657c('0x3e')](_0x524e97[_0x657c('0x35')][_0x657c('0x3e')]);_0x3e94ec['where']=qs['filters'](_['pick'](_0x524e97[_0x657c('0x35')],_0x3f7dd2[_0x657c('0x37')]));if(_0x524e97[_0x657c('0x35')][_0x657c('0x41')]){_0x3e94ec['where']=_[_0x657c('0x42')](_0x3e94ec[_0x657c('0x3f')],{'$or':_[_0x657c('0x2e')](_0x3e94ec[_0x657c('0x3a')],function(_0x550a93){var _0x1512de={};_0x1512de[_0x550a93]={'$like':'%'+_0x524e97[_0x657c('0x35')]['filter']+'%'};return _0x1512de;})});}_0x3e94ec=_[_0x657c('0x42')]({},_0x3e94ec,_0x524e97[_0x657c('0x4b')]);return _0x7b4358['getFields'](_0x3e94ec);}})[_0x657c('0x27')](function(_0x25a94a){if(_0x25a94a){_0xe1ff8c=_0x25a94a[_0x657c('0x3b')];if(!_0x524e97[_0x657c('0x35')][_0x657c('0x3c')]('nolimit')){_0x3e94ec[_0x657c('0x1e')]=qs[_0x657c('0x1e')](_0x524e97['query'][_0x657c('0x1e')]);_0x3e94ec[_0x657c('0x1c')]=qs[_0x657c('0x1c')](_0x524e97[_0x657c('0x35')][_0x657c('0x1c')]);}return _0x7b4358[_0x657c('0x50')](_0x3e94ec);}})[_0x657c('0x27')](function(_0x13c866){if(_0x13c866){return _0x13c866?{'count':_0xe1ff8c,'rows':_0x13c866}:null;}})[_0x657c('0x27')](respondWithResult(_0x10a3fc,null))[_0x657c('0x48')](handleError(_0x10a3fc,null));};exports['getSubjects']=function(_0x593398,_0x7185b4,_0x12d692){var _0x213804={};var _0x83d4b5={};var _0x551cc0;var _0x3b8d1c;return db[_0x657c('0x2f')][_0x657c('0x51')]({'where':{'id':_0x593398[_0x657c('0x4a')]['id']}})[_0x657c('0x27')](handleEntityNotFound(_0x7185b4,null))[_0x657c('0x27')](function(_0x12b6c1){if(_0x12b6c1){_0x551cc0=_0x12b6c1;_0x83d4b5[_0x657c('0x34')]=_[_0x657c('0x36')](db[_0x657c('0x4f')][_0x657c('0x30')]);_0x83d4b5[_0x657c('0x35')]=_[_0x657c('0x36')](_0x593398['query']);_0x83d4b5['filters']=_['intersection'](_0x83d4b5['model'],_0x83d4b5[_0x657c('0x35')]);_0x213804['attributes']=_[_0x657c('0x38')](_0x83d4b5[_0x657c('0x34')],qs['fields'](_0x593398[_0x657c('0x35')][_0x657c('0x39')]));_0x213804[_0x657c('0x3a')]=_0x213804[_0x657c('0x3a')][_0x657c('0x3b')]?_0x213804[_0x657c('0x3a')]:_0x83d4b5[_0x657c('0x34')];_0x213804[_0x657c('0x3d')]=qs['sort'](_0x593398['query'][_0x657c('0x3e')]);_0x213804[_0x657c('0x3f')]=qs['filters'](_[_0x657c('0x40')](_0x593398[_0x657c('0x35')],_0x83d4b5[_0x657c('0x37')]));if(_0x593398['query'][_0x657c('0x41')]){_0x213804[_0x657c('0x3f')]=_[_0x657c('0x42')](_0x213804[_0x657c('0x3f')],{'$or':_['map'](_0x213804[_0x657c('0x3a')],function(_0x3b6e06){var _0x494a06={};_0x494a06[_0x3b6e06]={'$like':'%'+_0x593398['query']['filter']+'%'};return _0x494a06;})});}_0x213804=_[_0x657c('0x42')]({},_0x213804,_0x593398['options']);return _0x551cc0['getSubjects'](_0x213804);}})[_0x657c('0x27')](function(_0x2b71d4){if(_0x2b71d4){_0x3b8d1c=_0x2b71d4[_0x657c('0x3b')];if(!_0x593398['query'][_0x657c('0x3c')](_0x657c('0x52'))){_0x213804[_0x657c('0x1e')]=qs['limit'](_0x593398[_0x657c('0x35')][_0x657c('0x1e')]);_0x213804[_0x657c('0x1c')]=qs['offset'](_0x593398[_0x657c('0x35')][_0x657c('0x1c')]);}return _0x551cc0['getSubjects'](_0x213804);}})['then'](function(_0x13e84d){if(_0x13e84d){return _0x13e84d?{'count':_0x3b8d1c,'rows':_0x13e84d}:null;}})[_0x657c('0x27')](respondWithResult(_0x7185b4,null))[_0x657c('0x48')](handleError(_0x7185b4,null));};exports[_0x657c('0x53')]=function(_0x22e15e,_0x39a414,_0x1bd5a3){var _0x4ace28={};var _0x57eacc={};var _0x2edd78;var _0x2065b5;return db[_0x657c('0x2f')]['findOne']({'where':{'id':_0x22e15e[_0x657c('0x4a')]['id']}})[_0x657c('0x27')](handleEntityNotFound(_0x39a414,null))[_0x657c('0x27')](function(_0xe2312a){if(_0xe2312a){_0x2edd78=_0xe2312a;_0x57eacc[_0x657c('0x34')]=_[_0x657c('0x36')](db['SalesforceField'][_0x657c('0x30')]);_0x57eacc[_0x657c('0x35')]=_['keys'](_0x22e15e['query']);_0x57eacc[_0x657c('0x37')]=_[_0x657c('0x38')](_0x57eacc[_0x657c('0x34')],_0x57eacc[_0x657c('0x35')]);_0x4ace28[_0x657c('0x3a')]=_[_0x657c('0x38')](_0x57eacc['model'],qs[_0x657c('0x39')](_0x22e15e[_0x657c('0x35')][_0x657c('0x39')]));_0x4ace28['attributes']=_0x4ace28[_0x657c('0x3a')][_0x657c('0x3b')]?_0x4ace28[_0x657c('0x3a')]:_0x57eacc[_0x657c('0x34')];_0x4ace28[_0x657c('0x3d')]=qs[_0x657c('0x3e')](_0x22e15e[_0x657c('0x35')]['sort']);_0x4ace28[_0x657c('0x3f')]=qs[_0x657c('0x37')](_['pick'](_0x22e15e['query'],_0x57eacc[_0x657c('0x37')]));if(_0x22e15e[_0x657c('0x35')][_0x657c('0x41')]){_0x4ace28[_0x657c('0x3f')]=_[_0x657c('0x42')](_0x4ace28[_0x657c('0x3f')],{'$or':_[_0x657c('0x2e')](_0x4ace28['attributes'],function(_0x54ce65){var _0x2356d9={};_0x2356d9[_0x54ce65]={'$like':'%'+_0x22e15e[_0x657c('0x35')][_0x657c('0x41')]+'%'};return _0x2356d9;})});}_0x4ace28=_[_0x657c('0x42')]({},_0x4ace28,_0x22e15e[_0x657c('0x4b')]);return _0x2edd78[_0x657c('0x53')](_0x4ace28);}})[_0x657c('0x27')](function(_0x378ae0){if(_0x378ae0){_0x2065b5=_0x378ae0[_0x657c('0x3b')];if(!_0x22e15e[_0x657c('0x35')][_0x657c('0x3c')](_0x657c('0x52'))){_0x4ace28['limit']=qs['limit'](_0x22e15e[_0x657c('0x35')]['limit']);_0x4ace28[_0x657c('0x1c')]=qs[_0x657c('0x1c')](_0x22e15e[_0x657c('0x35')][_0x657c('0x1c')]);}return _0x2edd78[_0x657c('0x53')](_0x4ace28);}})[_0x657c('0x27')](function(_0x152645){if(_0x152645){return _0x152645?{'count':_0x2065b5,'rows':_0x152645}:null;}})[_0x657c('0x27')](respondWithResult(_0x39a414,null))['catch'](handleError(_0x39a414,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 774b24a..26619fd 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 _0x4129=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','bluebird','request-promise'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0x4129,0x76));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9412('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9412('0x1'));var rp=require(_0x9412('0x2'));var fs=require('fs');var path=require(_0x9412('0x3'));var rimraf=require(_0x9412('0x4'));var config=require(_0x9412('0x5'));var attributes=require(_0x9412('0x6'));module[_0x9412('0x7')]=function(_0x25fb9b,_0x1be98d){return _0x25fb9b[_0x9412('0x8')](_0x9412('0x9'),attributes,{'tableName':_0x9412('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23a1=['int_salesforce_configurations','util','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x23a1,0x64));var _0x123a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x23a1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x123a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x123a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x123a('0x2'));var rimraf=require(_0x123a('0x3'));var config=require('../../config/environment');var attributes=require(_0x123a('0x4'));module[_0x123a('0x5')]=function(_0x324dbd,_0x2f8623){return _0x324dbd[_0x123a('0x6')](_0x123a('0x7'),attributes,{'tableName':_0x123a('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 c7bf0cb..4a4bccd 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 _0x484b=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x243e23,_0x33453a){var _0x9d84dd=function(_0xbfe48){while(--_0xbfe48){_0x243e23['push'](_0x243e23['shift']());}};_0x9d84dd(++_0x33453a);}(_0x484b,0x1ec));var _0xb484=function(_0x1e7ae4,_0x45991d){_0x1e7ae4=_0x1e7ae4-0x0;var _0x481545=_0x484b[_0x1e7ae4];return _0x481545;};'use strict';var _=require('lodash');var util=require(_0xb484('0x0'));var moment=require(_0xb484('0x1'));var BPromise=require('bluebird');var rs=require(_0xb484('0x2'));var fs=require('fs');var Redis=require(_0xb484('0x3'));var db=require(_0xb484('0x4'))['db'];var utils=require(_0xb484('0x5'));var logger=require(_0xb484('0x6'))('rpc');var config=require(_0xb484('0x7'));var jayson=require(_0xb484('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5891ed,_0x172ebc,_0x4aba25){return new BPromise(function(_0x1d5fb1,_0x113959){return client[_0xb484('0x9')](_0x5891ed,_0x4aba25)[_0xb484('0xa')](function(_0x5e4e45){logger[_0xb484('0xb')](_0xb484('0xc'),_0x172ebc,_0xb484('0xd'));logger[_0xb484('0xe')](_0xb484('0xf'),_0x172ebc,_0xb484('0xd'),JSON[_0xb484('0x10')](_0x5e4e45));if(_0x5e4e45[_0xb484('0x11')]){if(_0x5e4e45[_0xb484('0x11')][_0xb484('0x12')]===0x1f4){logger[_0xb484('0x11')](_0xb484('0xc'),_0x172ebc,_0x5e4e45['error']['message']);return _0x113959(_0x5e4e45['error'][_0xb484('0x13')]);}logger[_0xb484('0x11')](_0xb484('0xc'),_0x172ebc,_0x5e4e45[_0xb484('0x11')][_0xb484('0x13')]);return _0x1d5fb1(_0x5e4e45[_0xb484('0x11')]['message']);}else{logger[_0xb484('0xb')](_0xb484('0xc'),_0x172ebc,'request\x20sent');_0x1d5fb1(_0x5e4e45[_0xb484('0x14')]['message']);}})[_0xb484('0x15')](function(_0x34dcfc){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x172ebc,_0x34dcfc);_0x113959(_0x34dcfc);});});} \ No newline at end of file +var _0x7bbc=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x56fa5c,_0x46b71e){var _0x5cf91b=function(_0x4f3f03){while(--_0x4f3f03){_0x56fa5c['push'](_0x56fa5c['shift']());}};_0x5cf91b(++_0x46b71e);}(_0x7bbc,0x8d));var _0xc7bb=function(_0x1b1b55,_0x570568){_0x1b1b55=_0x1b1b55-0x0;var _0x12053b=_0x7bbc[_0x1b1b55];return _0x12053b;};'use strict';var _=require(_0xc7bb('0x0'));var util=require(_0xc7bb('0x1'));var moment=require('moment');var BPromise=require(_0xc7bb('0x2'));var rs=require(_0xc7bb('0x3'));var fs=require('fs');var Redis=require(_0xc7bb('0x4'));var db=require(_0xc7bb('0x5'))['db'];var utils=require(_0xc7bb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc7bb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d06e6,_0x117978,_0x5d9f0f){return new BPromise(function(_0x10949a,_0x4aeb48){return client[_0xc7bb('0x9')](_0x5d06e6,_0x5d9f0f)[_0xc7bb('0xa')](function(_0x20e6e5){logger[_0xc7bb('0xb')](_0xc7bb('0xc'),_0x117978,'request\x20sent');logger[_0xc7bb('0xd')](_0xc7bb('0xe'),_0x117978,_0xc7bb('0xf'),JSON[_0xc7bb('0x10')](_0x20e6e5));if(_0x20e6e5[_0xc7bb('0x11')]){if(_0x20e6e5['error'][_0xc7bb('0x12')]===0x1f4){logger[_0xc7bb('0x11')](_0xc7bb('0xc'),_0x117978,_0x20e6e5[_0xc7bb('0x11')]['message']);return _0x4aeb48(_0x20e6e5[_0xc7bb('0x11')][_0xc7bb('0x13')]);}logger[_0xc7bb('0x11')](_0xc7bb('0xc'),_0x117978,_0x20e6e5[_0xc7bb('0x11')]['message']);return _0x10949a(_0x20e6e5[_0xc7bb('0x11')][_0xc7bb('0x13')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x117978,_0xc7bb('0xf'));_0x10949a(_0x20e6e5['result'][_0xc7bb('0x13')]);}})['catch'](function(_0x3a2a80){logger[_0xc7bb('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x117978,_0x3a2a80);_0x4aeb48(_0x3a2a80);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 18ea2b5..dbb8fd8 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 _0xe1d7=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x466ae7,_0x1a7bb5){var _0x453444=function(_0xf63ea9){while(--_0xf63ea9){_0x466ae7['push'](_0x466ae7['shift']());}};_0x453444(++_0x1a7bb5);}(_0xe1d7,0x1f0));var _0x7e1d=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xe1d7[_0xccf869];return _0x21a9db;};'use strict';var multer=require(_0x7e1d('0x0'));var util=require('util');var path=require(_0x7e1d('0x1'));var timeout=require(_0x7e1d('0x2'));var express=require(_0x7e1d('0x3'));var router=express[_0x7e1d('0x4')]();var fs_extra=require(_0x7e1d('0x5'));var auth=require(_0x7e1d('0x6'));var interaction=require(_0x7e1d('0x7'));var config=require(_0x7e1d('0x8'));var controller=require(_0x7e1d('0x9'));router[_0x7e1d('0xa')]('/',auth[_0x7e1d('0xb')](),controller[_0x7e1d('0xc')]);router[_0x7e1d('0xa')](_0x7e1d('0xd'),auth[_0x7e1d('0xb')](),controller[_0x7e1d('0xe')]);router[_0x7e1d('0xf')]('/',auth[_0x7e1d('0xb')](),controller[_0x7e1d('0x10')]);router[_0x7e1d('0x11')](_0x7e1d('0xd'),auth[_0x7e1d('0xb')](),controller['update']);router[_0x7e1d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7e1d('0x13')]);module[_0x7e1d('0x14')]=router; \ No newline at end of file +var _0xbbed=['fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','put','update','path','express','Router'];(function(_0x3ebd9c,_0x8338cd){var _0x434ebf=function(_0x420063){while(--_0x420063){_0x3ebd9c['push'](_0x3ebd9c['shift']());}};_0x434ebf(++_0x8338cd);}(_0xbbed,0x65));var _0xdbbe=function(_0xcb3b3f,_0x314f94){_0xcb3b3f=_0xcb3b3f-0x0;var _0x4fe8ab=_0xbbed[_0xcb3b3f];return _0x4fe8ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbbe('0x0'));var timeout=require('connect-timeout');var express=require(_0xdbbe('0x1'));var router=express[_0xdbbe('0x2')]();var fs_extra=require(_0xdbbe('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdbbe('0x4'));var config=require('../../config/environment');var controller=require(_0xdbbe('0x5'));router[_0xdbbe('0x6')]('/',auth[_0xdbbe('0x7')](),controller['index']);router['get'](_0xdbbe('0x8'),auth[_0xdbbe('0x7')](),controller[_0xdbbe('0x9')]);router[_0xdbbe('0xa')]('/',auth[_0xdbbe('0x7')](),controller['create']);router[_0xdbbe('0xb')](_0xdbbe('0x8'),auth[_0xdbbe('0x7')](),controller[_0xdbbe('0xc')]);router['delete'](_0xdbbe('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2926cb0..56a674c 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 _0x9800=['sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0x9800,0x6c));var _0x0980=function(_0x21d164,_0x56f290){_0x21d164=_0x21d164-0x0;var _0x3ac5fd=_0x9800[_0x21d164];return _0x3ac5fd;};'use strict';var Sequelize=require(_0x0980('0x0'));module[_0x0980('0x1')]={'type':{'type':Sequelize[_0x0980('0x2')]('string',_0x0980('0x3'),'customVariable',_0x0980('0x4'),_0x0980('0x5')),'defaultValue':_0x0980('0x6')},'content':{'type':Sequelize[_0x0980('0x7')]},'key':{'type':Sequelize[_0x0980('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0980('0x3'),_0x0980('0x8'))},'keyContent':{'type':Sequelize[_0x0980('0x7')]},'idField':{'type':Sequelize[_0x0980('0x7')]},'variableName':{'type':Sequelize[_0x0980('0x7')]}}; \ No newline at end of file +var _0x1572=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x25f41c,_0x19b011){var _0x1bcad6=function(_0x2366fc){while(--_0x2366fc){_0x25f41c['push'](_0x25f41c['shift']());}};_0x1bcad6(++_0x19b011);}(_0x1572,0x1d7));var _0x2157=function(_0x5dcdcf,_0x2720ef){_0x5dcdcf=_0x5dcdcf-0x0;var _0x44b3f0=_0x1572[_0x5dcdcf];return _0x44b3f0;};'use strict';var Sequelize=require(_0x2157('0x0'));module[_0x2157('0x1')]={'type':{'type':Sequelize[_0x2157('0x2')](_0x2157('0x3'),_0x2157('0x4'),_0x2157('0x5'),_0x2157('0x6'),'picklist'),'defaultValue':_0x2157('0x3')},'content':{'type':Sequelize[_0x2157('0x7')]},'key':{'type':Sequelize[_0x2157('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x2157('0x3'),'variable',_0x2157('0x5'))},'keyContent':{'type':Sequelize[_0x2157('0x7')]},'idField':{'type':Sequelize[_0x2157('0x7')]},'variableName':{'type':Sequelize[_0x2157('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2cfe190..6f44424 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 _0x102b=['destroy','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','update','then'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x102b,0x146));var _0xb102=function(_0x4b817c,_0x19dbec){_0x4b817c=_0x4b817c-0x0;var _0x4a2c7d=_0x102b[_0x4b817c];return _0x4a2c7d;};'use strict';var emlformat=require(_0xb102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb102('0x1'));var jsonpatch=require(_0xb102('0x2'));var rp=require(_0xb102('0x3'));var moment=require(_0xb102('0x4'));var BPromise=require(_0xb102('0x5'));var Mustache=require('mustache');var util=require(_0xb102('0x6'));var path=require('path');var sox=require(_0xb102('0x7'));var csv=require(_0xb102('0x8'));var ejs=require(_0xb102('0x9'));var fs=require('fs');var fs_extra=require(_0xb102('0xa'));var _=require(_0xb102('0xb'));var squel=require(_0xb102('0xc'));var crypto=require('crypto');var jsforce=require(_0xb102('0xd'));var deskjs=require(_0xb102('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb102('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb102('0x10'));var hardwareService=require(_0xb102('0x11'));var logger=require(_0xb102('0x12'))(_0xb102('0x13'));var utils=require(_0xb102('0x14'));var config=require(_0xb102('0x15'));var licenseUtil=require(_0xb102('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5371c5,_0x202c09){_0x202c09=_0x202c09||0xcc;return function(_0x5312a6){if(_0x5312a6){return _0x5371c5[_0xb102('0x17')](_0x202c09);}return _0x5371c5[_0xb102('0x18')](_0x202c09)['end']();};}function respondWithResult(_0x3263ef,_0x223c14){_0x223c14=_0x223c14||0xc8;return function(_0x340351){if(_0x340351){return _0x3263ef[_0xb102('0x18')](_0x223c14)['json'](_0x340351);}};}function respondWithFilteredResult(_0xf4f58d,_0x4a13ce){return function(_0x4ef15c){if(_0x4ef15c){var _0x528895=typeof _0x4a13ce[_0xb102('0x19')]==='undefined'&&typeof _0x4a13ce[_0xb102('0x1a')]===_0xb102('0x1b');var _0x37ff48=_0x4ef15c['count'];var _0xfb192d=_0x528895?0x0:_0x4a13ce[_0xb102('0x19')];var _0x29b25d=_0x528895?_0x4ef15c[_0xb102('0x1c')]:_0x4a13ce[_0xb102('0x19')]+_0x4a13ce['limit'];var _0x420533;if(_0x29b25d>=_0x37ff48){_0x29b25d=_0x37ff48;_0x420533=0xc8;}else{_0x420533=0xce;}_0xf4f58d[_0xb102('0x18')](_0x420533);return _0xf4f58d[_0xb102('0x1d')](_0xb102('0x1e'),_0xfb192d+'-'+_0x29b25d+'/'+_0x37ff48)['json'](_0x4ef15c);}return null;};}function patchUpdates(_0x5db0f5){return function(_0x5cb969){try{jsonpatch['apply'](_0x5cb969,_0x5db0f5,!![]);}catch(_0x184b43){return BPromise[_0xb102('0x1f')](_0x184b43);}return _0x5cb969['save']();};}function saveUpdates(_0x3db12d,_0x581174){return function(_0x4ae4a6){if(_0x4ae4a6){return _0x4ae4a6[_0xb102('0x20')](_0x3db12d)[_0xb102('0x21')](function(_0x28c08a){return _0x28c08a;});}return null;};}function removeEntity(_0x5af043,_0x1beb0f){return function(_0x3caffe){if(_0x3caffe){return _0x3caffe[_0xb102('0x22')]()[_0xb102('0x21')](function(){_0x5af043[_0xb102('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10bfc3,_0x3e49c0){return function(_0x7df51f){if(!_0x7df51f){_0x10bfc3[_0xb102('0x17')](0x194);}return _0x7df51f;};}function handleError(_0x3a4198,_0xe5897c){_0xe5897c=_0xe5897c||0x1f4;return function(_0x227caf){logger['error'](_0x227caf[_0xb102('0x23')]);if(_0x227caf[_0xb102('0x24')]){delete _0x227caf[_0xb102('0x24')];}_0x3a4198['status'](_0xe5897c)[_0xb102('0x25')](_0x227caf);};}exports[_0xb102('0x26')]=function(_0x38c60f,_0x5dd50e){var _0x2f96e0={},_0x468dbc={},_0x3f8284={'count':0x0,'rows':[]};var _0x1c44a5=_['map'](db[_0xb102('0x27')][_0xb102('0x28')],function(_0x24a794){return{'name':_0x24a794[_0xb102('0x29')],'type':_0x24a794[_0xb102('0x2a')][_0xb102('0x2b')]};});_0x468dbc[_0xb102('0x2c')]=_[_0xb102('0x2d')](_0x1c44a5,_0xb102('0x24'));_0x468dbc[_0xb102('0x2e')]=_[_0xb102('0x2f')](_0x38c60f[_0xb102('0x2e')]);_0x468dbc[_0xb102('0x30')]=_[_0xb102('0x31')](_0x468dbc['model'],_0x468dbc[_0xb102('0x2e')]);_0x2f96e0[_0xb102('0x32')]=_['intersection'](_0x468dbc[_0xb102('0x2c')],qs[_0xb102('0x33')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x33')]));_0x2f96e0[_0xb102('0x32')]=_0x2f96e0[_0xb102('0x32')]['length']?_0x2f96e0['attributes']:_0x468dbc[_0xb102('0x2c')];if(!_0x38c60f[_0xb102('0x2e')][_0xb102('0x34')](_0xb102('0x35'))){_0x2f96e0[_0xb102('0x1a')]=qs[_0xb102('0x1a')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x1a')]);_0x2f96e0[_0xb102('0x19')]=qs[_0xb102('0x19')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x19')]);}_0x2f96e0[_0xb102('0x36')]=qs[_0xb102('0x37')](_0x38c60f[_0xb102('0x2e')][_0xb102('0x37')]);_0x2f96e0[_0xb102('0x38')]=qs[_0xb102('0x30')](_[_0xb102('0x39')](_0x38c60f['query'],_0x468dbc[_0xb102('0x30')]),_0x1c44a5);if(_0x38c60f[_0xb102('0x2e')][_0xb102('0x3a')]){_0x2f96e0['where']=_[_0xb102('0x3b')](_0x2f96e0[_0xb102('0x38')],{'$or':_[_0xb102('0x2d')](_0x1c44a5,function(_0x599c58){if(_0x599c58[_0xb102('0x2a')]!==_0xb102('0x3c')){var _0x8990a1={};_0x8990a1[_0x599c58[_0xb102('0x24')]]={'$like':'%'+_0x38c60f[_0xb102('0x2e')][_0xb102('0x3a')]+'%'};return _0x8990a1;}})});}_0x2f96e0=_['merge']({},_0x2f96e0,_0x38c60f[_0xb102('0x3d')]);var _0x5190a0={'where':_0x2f96e0[_0xb102('0x38')]};return db['SalesforceField'][_0xb102('0x1c')](_0x5190a0)[_0xb102('0x21')](function(_0x2ef50e){_0x3f8284['count']=_0x2ef50e;if(_0x38c60f[_0xb102('0x2e')][_0xb102('0x3e')]){_0x2f96e0['include']=[{'all':!![]}];}return db[_0xb102('0x27')][_0xb102('0x3f')](_0x2f96e0);})['then'](function(_0x5dc920){_0x3f8284['rows']=_0x5dc920;return _0x3f8284;})[_0xb102('0x21')](respondWithFilteredResult(_0x5dd50e,_0x2f96e0))['catch'](handleError(_0x5dd50e,null));};exports[_0xb102('0x40')]=function(_0xa00e5,_0x1a0b59){var _0x34c20d={'raw':!![],'where':{'id':_0xa00e5[_0xb102('0x41')]['id']}},_0x23553e={};_0x23553e[_0xb102('0x2c')]=_[_0xb102('0x2f')](db[_0xb102('0x27')][_0xb102('0x28')]);_0x23553e[_0xb102('0x2e')]=_['keys'](_0xa00e5[_0xb102('0x2e')]);_0x23553e['filters']=_['intersection'](_0x23553e[_0xb102('0x2c')],_0x23553e[_0xb102('0x2e')]);_0x34c20d[_0xb102('0x32')]=_['intersection'](_0x23553e[_0xb102('0x2c')],qs[_0xb102('0x33')](_0xa00e5[_0xb102('0x2e')]['fields']));_0x34c20d['attributes']=_0x34c20d[_0xb102('0x32')][_0xb102('0x42')]?_0x34c20d[_0xb102('0x32')]:_0x23553e[_0xb102('0x2c')];if(_0xa00e5[_0xb102('0x2e')][_0xb102('0x3e')]){_0x34c20d[_0xb102('0x43')]=[{'all':!![]}];}_0x34c20d=_['merge']({},_0x34c20d,_0xa00e5['options']);return db[_0xb102('0x27')][_0xb102('0x44')](_0x34c20d)[_0xb102('0x21')](handleEntityNotFound(_0x1a0b59,null))[_0xb102('0x21')](respondWithResult(_0x1a0b59,null))[_0xb102('0x45')](handleError(_0x1a0b59,null));};exports[_0xb102('0x46')]=function(_0x412345,_0x4e9f2c){return db[_0xb102('0x27')][_0xb102('0x46')](_0x412345[_0xb102('0x47')],{})[_0xb102('0x21')](respondWithResult(_0x4e9f2c,0xc9))[_0xb102('0x45')](handleError(_0x4e9f2c,null));};exports[_0xb102('0x20')]=function(_0x1ce7c5,_0x54bc0f){if(_0x1ce7c5[_0xb102('0x47')]['id']){delete _0x1ce7c5[_0xb102('0x47')]['id'];}return db[_0xb102('0x27')][_0xb102('0x44')]({'where':{'id':_0x1ce7c5['params']['id']}})[_0xb102('0x21')](handleEntityNotFound(_0x54bc0f,null))[_0xb102('0x21')](saveUpdates(_0x1ce7c5[_0xb102('0x47')],null))[_0xb102('0x21')](respondWithResult(_0x54bc0f,null))[_0xb102('0x45')](handleError(_0x54bc0f,null));};exports[_0xb102('0x22')]=function(_0xb9c2f2,_0x45dd2f){return db[_0xb102('0x27')]['find']({'where':{'id':_0xb9c2f2['params']['id']}})['then'](handleEntityNotFound(_0x45dd2f,null))[_0xb102('0x21')](removeEntity(_0x45dd2f,null))['catch'](handleError(_0x45dd2f,null));}; \ No newline at end of file +var _0xe803=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceField','rows','catch','show','params','keys','length','find','create','update','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2bd264,_0x53a5d4){var _0x3cd2e3=function(_0x125cd0){while(--_0x125cd0){_0x2bd264['push'](_0x2bd264['shift']());}};_0x3cd2e3(++_0x53a5d4);}(_0xe803,0x171));var _0x3e80=function(_0xb5e437,_0x572260){_0xb5e437=_0xb5e437-0x0;var _0x3c9e61=_0xe803[_0xb5e437];return _0x3c9e61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e80('0x0'));var jsonpatch=require(_0x3e80('0x1'));var rp=require(_0x3e80('0x2'));var moment=require(_0x3e80('0x3'));var BPromise=require(_0x3e80('0x4'));var Mustache=require(_0x3e80('0x5'));var util=require(_0x3e80('0x6'));var path=require('path');var sox=require(_0x3e80('0x7'));var csv=require(_0x3e80('0x8'));var ejs=require(_0x3e80('0x9'));var fs=require('fs');var fs_extra=require(_0x3e80('0xa'));var _=require(_0x3e80('0xb'));var squel=require(_0x3e80('0xc'));var crypto=require('crypto');var jsforce=require(_0x3e80('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e80('0x8'));var querystring=require(_0x3e80('0xe'));var Papa=require(_0x3e80('0xf'));var Redis=require(_0x3e80('0x10'));var authService=require(_0x3e80('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3e80('0x12'));var hardwareService=require(_0x3e80('0x13'));var logger=require(_0x3e80('0x14'))(_0x3e80('0x15'));var utils=require(_0x3e80('0x16'));var config=require(_0x3e80('0x17'));var licenseUtil=require(_0x3e80('0x18'));var db=require(_0x3e80('0x19'))['db'];function respondWithStatusCode(_0x52c6e6,_0x29660f){_0x29660f=_0x29660f||0xcc;return function(_0x2b5203){if(_0x2b5203){return _0x52c6e6[_0x3e80('0x1a')](_0x29660f);}return _0x52c6e6[_0x3e80('0x1b')](_0x29660f)[_0x3e80('0x1c')]();};}function respondWithResult(_0x393e0b,_0x57ba00){_0x57ba00=_0x57ba00||0xc8;return function(_0x441163){if(_0x441163){return _0x393e0b['status'](_0x57ba00)[_0x3e80('0x1d')](_0x441163);}};}function respondWithFilteredResult(_0x8dbff6,_0xe428ca){return function(_0x322a0a){if(_0x322a0a){var _0x1d54f5=typeof _0xe428ca[_0x3e80('0x1e')]===_0x3e80('0x1f')&&typeof _0xe428ca[_0x3e80('0x20')]==='undefined';var _0x5d9fd4=_0x322a0a[_0x3e80('0x21')];var _0xf20c2=_0x1d54f5?0x0:_0xe428ca['offset'];var _0x283093=_0x1d54f5?_0x322a0a['count']:_0xe428ca[_0x3e80('0x1e')]+_0xe428ca[_0x3e80('0x20')];var _0x56d0bf;if(_0x283093>=_0x5d9fd4){_0x283093=_0x5d9fd4;_0x56d0bf=0xc8;}else{_0x56d0bf=0xce;}_0x8dbff6[_0x3e80('0x1b')](_0x56d0bf);return _0x8dbff6[_0x3e80('0x22')](_0x3e80('0x23'),_0xf20c2+'-'+_0x283093+'/'+_0x5d9fd4)[_0x3e80('0x1d')](_0x322a0a);}return null;};}function patchUpdates(_0x329e5c){return function(_0x2aec13){try{jsonpatch[_0x3e80('0x24')](_0x2aec13,_0x329e5c,!![]);}catch(_0x331925){return BPromise[_0x3e80('0x25')](_0x331925);}return _0x2aec13[_0x3e80('0x26')]();};}function saveUpdates(_0x1e9923,_0x5453e8){return function(_0xb852b8){if(_0xb852b8){return _0xb852b8['update'](_0x1e9923)[_0x3e80('0x27')](function(_0x289ccb){return _0x289ccb;});}return null;};}function removeEntity(_0x245715,_0x4210da){return function(_0x168ca6){if(_0x168ca6){return _0x168ca6['destroy']()[_0x3e80('0x27')](function(){_0x245715[_0x3e80('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c1df,_0x5f6b1d){return function(_0x334fc8){if(!_0x334fc8){_0x39c1df[_0x3e80('0x1a')](0x194);}return _0x334fc8;};}function handleError(_0x3d2494,_0xe6d6eb){_0xe6d6eb=_0xe6d6eb||0x1f4;return function(_0x4e98a7){logger[_0x3e80('0x28')](_0x4e98a7[_0x3e80('0x29')]);if(_0x4e98a7[_0x3e80('0x2a')]){delete _0x4e98a7['name'];}_0x3d2494[_0x3e80('0x1b')](_0xe6d6eb)[_0x3e80('0x2b')](_0x4e98a7);};}exports['index']=function(_0x854964,_0xe63f3f){var _0x1c6178={},_0x2d17b9={},_0x1cb6bb={'count':0x0,'rows':[]};var _0xec9f19=_[_0x3e80('0x2c')](db['SalesforceField'][_0x3e80('0x2d')],function(_0x486017){return{'name':_0x486017[_0x3e80('0x2e')],'type':_0x486017[_0x3e80('0x2f')][_0x3e80('0x30')]};});_0x2d17b9['model']=_['map'](_0xec9f19,_0x3e80('0x2a'));_0x2d17b9['query']=_['keys'](_0x854964[_0x3e80('0x31')]);_0x2d17b9[_0x3e80('0x32')]=_[_0x3e80('0x33')](_0x2d17b9['model'],_0x2d17b9[_0x3e80('0x31')]);_0x1c6178[_0x3e80('0x34')]=_[_0x3e80('0x33')](_0x2d17b9[_0x3e80('0x35')],qs[_0x3e80('0x36')](_0x854964[_0x3e80('0x31')][_0x3e80('0x36')]));_0x1c6178[_0x3e80('0x34')]=_0x1c6178[_0x3e80('0x34')]['length']?_0x1c6178[_0x3e80('0x34')]:_0x2d17b9[_0x3e80('0x35')];if(!_0x854964[_0x3e80('0x31')][_0x3e80('0x37')](_0x3e80('0x38'))){_0x1c6178[_0x3e80('0x20')]=qs['limit'](_0x854964[_0x3e80('0x31')][_0x3e80('0x20')]);_0x1c6178[_0x3e80('0x1e')]=qs[_0x3e80('0x1e')](_0x854964[_0x3e80('0x31')][_0x3e80('0x1e')]);}_0x1c6178[_0x3e80('0x39')]=qs[_0x3e80('0x3a')](_0x854964['query'][_0x3e80('0x3a')]);_0x1c6178['where']=qs[_0x3e80('0x32')](_[_0x3e80('0x3b')](_0x854964[_0x3e80('0x31')],_0x2d17b9[_0x3e80('0x32')]),_0xec9f19);if(_0x854964[_0x3e80('0x31')][_0x3e80('0x3c')]){_0x1c6178[_0x3e80('0x3d')]=_[_0x3e80('0x3e')](_0x1c6178[_0x3e80('0x3d')],{'$or':_[_0x3e80('0x2c')](_0xec9f19,function(_0x4e7dbd){if(_0x4e7dbd[_0x3e80('0x2f')]!==_0x3e80('0x3f')){var _0x1ca783={};_0x1ca783[_0x4e7dbd[_0x3e80('0x2a')]]={'$like':'%'+_0x854964[_0x3e80('0x31')][_0x3e80('0x3c')]+'%'};return _0x1ca783;}})});}_0x1c6178=_[_0x3e80('0x3e')]({},_0x1c6178,_0x854964[_0x3e80('0x40')]);var _0x4ab296={'where':_0x1c6178[_0x3e80('0x3d')]};return db['SalesforceField']['count'](_0x4ab296)[_0x3e80('0x27')](function(_0xb88e75){_0x1cb6bb[_0x3e80('0x21')]=_0xb88e75;if(_0x854964[_0x3e80('0x31')][_0x3e80('0x41')]){_0x1c6178[_0x3e80('0x42')]=[{'all':!![]}];}return db[_0x3e80('0x43')]['findAll'](_0x1c6178);})[_0x3e80('0x27')](function(_0x6c4b3){_0x1cb6bb[_0x3e80('0x44')]=_0x6c4b3;return _0x1cb6bb;})[_0x3e80('0x27')](respondWithFilteredResult(_0xe63f3f,_0x1c6178))[_0x3e80('0x45')](handleError(_0xe63f3f,null));};exports[_0x3e80('0x46')]=function(_0x4affd5,_0x368f71){var _0x5ed1b7={'raw':!![],'where':{'id':_0x4affd5[_0x3e80('0x47')]['id']}},_0x17d1d9={};_0x17d1d9[_0x3e80('0x35')]=_[_0x3e80('0x48')](db['SalesforceField'][_0x3e80('0x2d')]);_0x17d1d9[_0x3e80('0x31')]=_['keys'](_0x4affd5[_0x3e80('0x31')]);_0x17d1d9['filters']=_[_0x3e80('0x33')](_0x17d1d9[_0x3e80('0x35')],_0x17d1d9[_0x3e80('0x31')]);_0x5ed1b7[_0x3e80('0x34')]=_[_0x3e80('0x33')](_0x17d1d9[_0x3e80('0x35')],qs['fields'](_0x4affd5[_0x3e80('0x31')]['fields']));_0x5ed1b7[_0x3e80('0x34')]=_0x5ed1b7[_0x3e80('0x34')][_0x3e80('0x49')]?_0x5ed1b7[_0x3e80('0x34')]:_0x17d1d9[_0x3e80('0x35')];if(_0x4affd5['query'][_0x3e80('0x41')]){_0x5ed1b7['include']=[{'all':!![]}];}_0x5ed1b7=_[_0x3e80('0x3e')]({},_0x5ed1b7,_0x4affd5[_0x3e80('0x40')]);return db[_0x3e80('0x43')][_0x3e80('0x4a')](_0x5ed1b7)[_0x3e80('0x27')](handleEntityNotFound(_0x368f71,null))['then'](respondWithResult(_0x368f71,null))[_0x3e80('0x45')](handleError(_0x368f71,null));};exports['create']=function(_0x113187,_0x5387f9){return db[_0x3e80('0x43')][_0x3e80('0x4b')](_0x113187['body'],{})[_0x3e80('0x27')](respondWithResult(_0x5387f9,0xc9))['catch'](handleError(_0x5387f9,null));};exports[_0x3e80('0x4c')]=function(_0x7782f7,_0x481c4e){if(_0x7782f7[_0x3e80('0x4d')]['id']){delete _0x7782f7['body']['id'];}return db[_0x3e80('0x43')]['find']({'where':{'id':_0x7782f7['params']['id']}})[_0x3e80('0x27')](handleEntityNotFound(_0x481c4e,null))[_0x3e80('0x27')](saveUpdates(_0x7782f7[_0x3e80('0x4d')],null))[_0x3e80('0x27')](respondWithResult(_0x481c4e,null))[_0x3e80('0x45')](handleError(_0x481c4e,null));};exports['destroy']=function(_0x367fcd,_0x48b694){return db[_0x3e80('0x43')]['find']({'where':{'id':_0x367fcd['params']['id']}})[_0x3e80('0x27')](handleEntityNotFound(_0x48b694,null))[_0x3e80('0x27')](removeEntity(_0x48b694,null))['catch'](handleError(_0x48b694,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b64bc11..676db63 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 _0x81a7=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x51a4cf,_0x538974){var _0x4e4746=function(_0x39b5bc){while(--_0x39b5bc){_0x51a4cf['push'](_0x51a4cf['shift']());}};_0x4e4746(++_0x538974);}(_0x81a7,0xb9));var _0x781a=function(_0x4cd309,_0x24d714){_0x4cd309=_0x4cd309-0x0;var _0x3e871e=_0x81a7[_0x4cd309];return _0x3e871e;};'use strict';var _=require(_0x781a('0x0'));var util=require(_0x781a('0x1'));var logger=require('../../config/logger')(_0x781a('0x2'));var moment=require(_0x781a('0x3'));var BPromise=require(_0x781a('0x4'));var rp=require(_0x781a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781a('0x6'));var config=require(_0x781a('0x7'));var attributes=require(_0x781a('0x8'));module[_0x781a('0x9')]=function(_0x479c13,_0x5c0a2f){return _0x479c13[_0x781a('0xa')](_0x781a('0xb'),attributes,{'tableName':_0x781a('0xc'),'paranoid':![],'indexes':[{'name':_0x781a('0xd'),'fields':['idField',_0x781a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b5=['int_salesforce_fields','salesforce_unique_index','FieldId','lodash','api','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x239a37,_0x1675c8){var _0x46db3c=function(_0x3c02a2){while(--_0x3c02a2){_0x239a37['push'](_0x239a37['shift']());}};_0x46db3c(++_0x1675c8);}(_0xc5b5,0x16b));var _0x5c5b=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xc5b5[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0x5c5b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5c5b('0x1'));var moment=require('moment');var BPromise=require(_0x5c5b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c5b('0x3'));var config=require(_0x5c5b('0x4'));var attributes=require(_0x5c5b('0x5'));module[_0x5c5b('0x6')]=function(_0x5608d7,_0x27cb01){return _0x5608d7[_0x5c5b('0x7')](_0x5c5b('0x8'),attributes,{'tableName':_0x5c5b('0x9'),'paranoid':![],'indexes':[{'name':_0x5c5b('0xa'),'fields':['idField',_0x5c5b('0xb')],'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 30e9c54..5f3a60b 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 _0x0ad1=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0xe8a45d,_0x3d0c26){var _0x419b15=function(_0x2cbd24){while(--_0x2cbd24){_0xe8a45d['push'](_0xe8a45d['shift']());}};_0x419b15(++_0x3d0c26);}(_0x0ad1,0x173));var _0x10ad=function(_0x9039e6,_0x939aaf){_0x9039e6=_0x9039e6-0x0;var _0x777cd7=_0x0ad1[_0x9039e6];return _0x777cd7;};'use strict';var _=require(_0x10ad('0x0'));var util=require(_0x10ad('0x1'));var moment=require(_0x10ad('0x2'));var BPromise=require(_0x10ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10ad('0x4'));var db=require(_0x10ad('0x5'))['db'];var utils=require(_0x10ad('0x6'));var logger=require(_0x10ad('0x7'))(_0x10ad('0x8'));var config=require(_0x10ad('0x9'));var jayson=require(_0x10ad('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2159c9,_0x424423,_0x487fdf){return new BPromise(function(_0x191652,_0x1271b0){return client[_0x10ad('0xb')](_0x2159c9,_0x487fdf)[_0x10ad('0xc')](function(_0x1e3456){logger[_0x10ad('0xd')](_0x10ad('0xe'),_0x424423,_0x10ad('0xf'));logger['debug'](_0x10ad('0x10'),_0x424423,_0x10ad('0xf'),JSON[_0x10ad('0x11')](_0x1e3456));if(_0x1e3456[_0x10ad('0x12')]){if(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x13')]===0x1f4){logger[_0x10ad('0x12')]('SalesforceField,\x20%s,\x20%s',_0x424423,_0x1e3456[_0x10ad('0x12')]['message']);return _0x1271b0(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x14')]);}logger[_0x10ad('0x12')]('SalesforceField,\x20%s,\x20%s',_0x424423,_0x1e3456[_0x10ad('0x12')]['message']);return _0x191652(_0x1e3456[_0x10ad('0x12')][_0x10ad('0x14')]);}else{logger[_0x10ad('0xd')](_0x10ad('0xe'),_0x424423,_0x10ad('0xf'));_0x191652(_0x1e3456[_0x10ad('0x15')][_0x10ad('0x14')]);}})['catch'](function(_0x2b7748){logger[_0x10ad('0x12')](_0x10ad('0xe'),_0x424423,_0x2b7748);_0x1271b0(_0x2b7748);});});} \ No newline at end of file +var _0x5d6d=['request','then','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','SalesforceField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d6d,0x1d8));var _0xd5d6=function(_0x292c30,_0x4eab37){_0x292c30=_0x292c30-0x0;var _0x386dc7=_0x5d6d[_0x292c30];return _0x386dc7;};'use strict';var _=require(_0xd5d6('0x0'));var util=require(_0xd5d6('0x1'));var moment=require(_0xd5d6('0x2'));var BPromise=require(_0xd5d6('0x3'));var rs=require(_0xd5d6('0x4'));var fs=require('fs');var Redis=require(_0xd5d6('0x5'));var db=require(_0xd5d6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5d6('0x7'))(_0xd5d6('0x8'));var config=require(_0xd5d6('0x9'));var jayson=require(_0xd5d6('0xa'));var client=jayson['client'][_0xd5d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1843e2,_0x57dfac,_0xe7f79d){return new BPromise(function(_0x565986,_0x551b84){return client[_0xd5d6('0xc')](_0x1843e2,_0xe7f79d)[_0xd5d6('0xd')](function(_0x5bc110){logger['info']('SalesforceField,\x20%s,\x20%s',_0x57dfac,'request\x20sent');logger[_0xd5d6('0xe')](_0xd5d6('0xf'),_0x57dfac,_0xd5d6('0x10'),JSON['stringify'](_0x5bc110));if(_0x5bc110[_0xd5d6('0x11')]){if(_0x5bc110[_0xd5d6('0x11')]['code']===0x1f4){logger[_0xd5d6('0x11')](_0xd5d6('0x12'),_0x57dfac,_0x5bc110[_0xd5d6('0x11')]['message']);return _0x551b84(_0x5bc110[_0xd5d6('0x11')][_0xd5d6('0x13')]);}logger[_0xd5d6('0x11')]('SalesforceField,\x20%s,\x20%s',_0x57dfac,_0x5bc110[_0xd5d6('0x11')]['message']);return _0x565986(_0x5bc110[_0xd5d6('0x11')][_0xd5d6('0x13')]);}else{logger[_0xd5d6('0x14')](_0xd5d6('0x12'),_0x57dfac,_0xd5d6('0x10'));_0x565986(_0x5bc110['result']['message']);}})[_0xd5d6('0x15')](function(_0x10c36b){logger[_0xd5d6('0x11')](_0xd5d6('0x12'),_0x57dfac,_0x10c36b);_0x551b84(_0x10c36b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9e3389f..41207d2 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 _0x4b3e=['path','connect-timeout','fs-extra','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','multer','util'];(function(_0x5d754d,_0x5999af){var _0x1d827c=function(_0x366bde){while(--_0x366bde){_0x5d754d['push'](_0x5d754d['shift']());}};_0x1d827c(++_0x5999af);}(_0x4b3e,0x1cc));var _0xe4b3=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x4b3e[_0x33593e];return _0x53db1a;};'use strict';var multer=require(_0xe4b3('0x0'));var util=require(_0xe4b3('0x1'));var path=require(_0xe4b3('0x2'));var timeout=require(_0xe4b3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4b3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe4b3('0x5'));var controller=require(_0xe4b3('0x6'));router[_0xe4b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4b3('0x8')]);router[_0xe4b3('0x7')](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller['show']);router[_0xe4b3('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe4b3('0xb')]);router[_0xe4b3('0x7')](_0xe4b3('0xc'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0xd')]);router[_0xe4b3('0xe')]('/',auth[_0xe4b3('0xa')](),controller[_0xe4b3('0xf')]);router[_0xe4b3('0xe')](_0xe4b3('0x10'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0x11')]);router['put'](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller['update']);router[_0xe4b3('0x12')](_0xe4b3('0x9'),auth[_0xe4b3('0xa')](),controller[_0xe4b3('0x13')]);module[_0xe4b3('0x14')]=router; \ No newline at end of file +var _0x9c54=['index','get','/:id','isAuthenticated','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x4390dc,_0x35fbae){var _0x115339=function(_0x5b133c){while(--_0x5b133c){_0x4390dc['push'](_0x4390dc['shift']());}};_0x115339(++_0x35fbae);}(_0x9c54,0x120));var _0x49c5=function(_0x29fe72,_0x5b4c3e){_0x29fe72=_0x29fe72-0x0;var _0x1c4ffc=_0x9c54[_0x29fe72];return _0x1c4ffc;};'use strict';var multer=require(_0x49c5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49c5('0x1')]();var fs_extra=require(_0x49c5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x49c5('0x3'));var config=require(_0x49c5('0x4'));var controller=require(_0x49c5('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x49c5('0x6')]);router[_0x49c5('0x7')](_0x49c5('0x8'),auth[_0x49c5('0x9')](),controller[_0x49c5('0xa')]);router[_0x49c5('0x7')]('/:id/configurations',auth[_0x49c5('0x9')](),controller[_0x49c5('0xb')]);router[_0x49c5('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x49c5('0xc')]);router['post']('/',auth[_0x49c5('0x9')](),controller[_0x49c5('0xd')]);router[_0x49c5('0xe')](_0x49c5('0xf'),auth['isAuthenticated'](),controller[_0x49c5('0x10')]);router[_0x49c5('0x11')]('/:id',auth[_0x49c5('0x9')](),controller[_0x49c5('0x12')]);router['delete'](_0x49c5('0x8'),auth['isAuthenticated'](),controller[_0x49c5('0x13')]);module[_0x49c5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d660de2..ffd1b4c 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 _0x3b37=['STRING','remoteUri','sequelize','exports'];(function(_0x463155,_0x52b6ff){var _0x44dbe8=function(_0x14dc3a){while(--_0x14dc3a){_0x463155['push'](_0x463155['shift']());}};_0x44dbe8(++_0x52b6ff);}(_0x3b37,0x9e));var _0x73b3=function(_0x1d5b08,_0x4abfe9){_0x1d5b08=_0x1d5b08-0x0;var _0x17a0c7=_0x3b37[_0x1d5b08];return _0x17a0c7;};'use strict';var Sequelize=require(_0x73b3('0x0'));module[_0x73b3('0x1')]={'name':{'type':Sequelize[_0x73b3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x73b3('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x73b3('0x2')]},'email':{'type':Sequelize[_0x73b3('0x2')]},'remoteUri':{'type':Sequelize[_0x73b3('0x2')],'unique':_0x73b3('0x3')},'serverUrl':{'type':Sequelize[_0x73b3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe04b=['username','remoteUri','sequelize','exports','STRING'];(function(_0x13f3e8,_0x442f0f){var _0x5f1812=function(_0x42e43d){while(--_0x42e43d){_0x13f3e8['push'](_0x13f3e8['shift']());}};_0x5f1812(++_0x442f0f);}(_0xe04b,0xc5));var _0xbe04=function(_0x3f1dc8,_0x3fd9c5){_0x3f1dc8=_0x3f1dc8-0x0;var _0xa9f1b4=_0xe04b[_0x3f1dc8];return _0xa9f1b4;};'use strict';var Sequelize=require(_0xbe04('0x0'));module[_0xbe04('0x1')]={'name':{'type':Sequelize[_0xbe04('0x2')]},'description':{'type':Sequelize[_0xbe04('0x2')]},'username':{'type':Sequelize[_0xbe04('0x2')],'unique':_0xbe04('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbe04('0x2')]},'remoteUri':{'type':Sequelize[_0xbe04('0x2')],'unique':_0xbe04('0x4')},'serverUrl':{'type':Sequelize[_0xbe04('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 5bc2dbf..472b6b2 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 _0xb110=['nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','include','rows','params','ServicenowAccount','rawAttributes','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','test','Wrong\x20credentials','statusCode','True','true','False','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','send','map','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x323fa2,_0x4ba631){var _0x277baa=function(_0x4351a6){while(--_0x4351a6){_0x323fa2['push'](_0x323fa2['shift']());}};_0x277baa(++_0x4ba631);}(_0xb110,0x12e));var _0x0b11=function(_0x3b5b83,_0x298489){_0x3b5b83=_0x3b5b83-0x0;var _0x537eea=_0xb110[_0x3b5b83];return _0x537eea;};'use strict';var emlformat=require(_0x0b11('0x0'));var rimraf=require(_0x0b11('0x1'));var zipdir=require(_0x0b11('0x2'));var jsonpatch=require(_0x0b11('0x3'));var rp=require(_0x0b11('0x4'));var moment=require(_0x0b11('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b11('0x6'));var util=require(_0x0b11('0x7'));var path=require('path');var sox=require(_0x0b11('0x8'));var csv=require(_0x0b11('0x9'));var ejs=require(_0x0b11('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0b11('0xb'));var crypto=require(_0x0b11('0xc'));var jsforce=require(_0x0b11('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b11('0x9'));var querystring=require(_0x0b11('0xe'));var Papa=require(_0x0b11('0xf'));var Redis=require(_0x0b11('0x10'));var authService=require(_0x0b11('0x11'));var qs=require(_0x0b11('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b11('0x13'))(_0x0b11('0x14'));var utils=require(_0x0b11('0x15'));var config=require(_0x0b11('0x16'));var licenseUtil=require(_0x0b11('0x17'));var db=require(_0x0b11('0x18'))['db'];var integrations=require(_0x0b11('0x19'));function respondWithStatusCode(_0x317946,_0x2ea83e){_0x2ea83e=_0x2ea83e||0xcc;return function(_0x9d3416){if(_0x9d3416){return _0x317946[_0x0b11('0x1a')](_0x2ea83e);}return _0x317946[_0x0b11('0x1b')](_0x2ea83e)[_0x0b11('0x1c')]();};}function respondWithResult(_0x14c6a4,_0x5351a6){_0x5351a6=_0x5351a6||0xc8;return function(_0x2af498){if(_0x2af498){return _0x14c6a4[_0x0b11('0x1b')](_0x5351a6)[_0x0b11('0x1d')](_0x2af498);}};}function respondWithFilteredResult(_0x4a5501,_0x51869c){return function(_0x5ee8b2){if(_0x5ee8b2){var _0x2c60ab=typeof _0x51869c[_0x0b11('0x1e')]===_0x0b11('0x1f')&&typeof _0x51869c[_0x0b11('0x20')]===_0x0b11('0x1f');var _0x4e4976=_0x5ee8b2['count'];var _0xe6d782=_0x2c60ab?0x0:_0x51869c[_0x0b11('0x1e')];var _0x28dffb=_0x2c60ab?_0x5ee8b2['count']:_0x51869c['offset']+_0x51869c[_0x0b11('0x20')];var _0x213e12;if(_0x28dffb>=_0x4e4976){_0x28dffb=_0x4e4976;_0x213e12=0xc8;}else{_0x213e12=0xce;}_0x4a5501['status'](_0x213e12);return _0x4a5501[_0x0b11('0x21')](_0x0b11('0x22'),_0xe6d782+'-'+_0x28dffb+'/'+_0x4e4976)['json'](_0x5ee8b2);}return null;};}function patchUpdates(_0x21908c){return function(_0x1d40e){try{jsonpatch[_0x0b11('0x23')](_0x1d40e,_0x21908c,!![]);}catch(_0x1e6b31){return BPromise['reject'](_0x1e6b31);}return _0x1d40e[_0x0b11('0x24')]();};}function saveUpdates(_0x482a7d,_0x1cfb1d){return function(_0x1e7ff4){if(_0x1e7ff4){return _0x1e7ff4[_0x0b11('0x25')](_0x482a7d)[_0x0b11('0x26')](function(_0x4936ff){return _0x4936ff;});}return null;};}function removeEntity(_0x5c45e3,_0x2bc0c2){return function(_0x9ad36a){if(_0x9ad36a){return _0x9ad36a[_0x0b11('0x27')]()[_0x0b11('0x26')](function(){_0x5c45e3['status'](0xcc)[_0x0b11('0x1c')]();});}};}function handleEntityNotFound(_0xe85b27,_0x9d7a7a){return function(_0x18c952){if(!_0x18c952){_0xe85b27[_0x0b11('0x1a')](0x194);}return _0x18c952;};}function handleError(_0x1ac187,_0x254998){_0x254998=_0x254998||0x1f4;return function(_0xfd0cdd){logger[_0x0b11('0x28')](_0xfd0cdd[_0x0b11('0x29')]);if(_0xfd0cdd['name']){delete _0xfd0cdd['name'];}_0x1ac187[_0x0b11('0x1b')](_0x254998)[_0x0b11('0x2a')](_0xfd0cdd);};}exports['index']=function(_0xdce856,_0x37d161){var _0x5944cb={},_0x3bb4be={},_0x38e322={'count':0x0,'rows':[]};var _0x2d0de3=_[_0x0b11('0x2b')](db['ServicenowAccount']['rawAttributes'],function(_0x4dc085){return{'name':_0x4dc085[_0x0b11('0x2c')],'type':_0x4dc085[_0x0b11('0x2d')][_0x0b11('0x2e')]};});_0x3bb4be[_0x0b11('0x2f')]=_['map'](_0x2d0de3,_0x0b11('0x30'));_0x3bb4be[_0x0b11('0x31')]=_[_0x0b11('0x32')](_0xdce856[_0x0b11('0x31')]);_0x3bb4be['filters']=_['intersection'](_0x3bb4be['model'],_0x3bb4be['query']);_0x5944cb['attributes']=_[_0x0b11('0x33')](_0x3bb4be[_0x0b11('0x2f')],qs[_0x0b11('0x34')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x34')]));_0x5944cb[_0x0b11('0x35')]=_0x5944cb['attributes'][_0x0b11('0x36')]?_0x5944cb[_0x0b11('0x35')]:_0x3bb4be[_0x0b11('0x2f')];if(!_0xdce856[_0x0b11('0x31')][_0x0b11('0x37')](_0x0b11('0x38'))){_0x5944cb[_0x0b11('0x20')]=qs[_0x0b11('0x20')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x20')]);_0x5944cb[_0x0b11('0x1e')]=qs[_0x0b11('0x1e')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x1e')]);}_0x5944cb['order']=qs[_0x0b11('0x39')](_0xdce856[_0x0b11('0x31')][_0x0b11('0x39')]);_0x5944cb[_0x0b11('0x3a')]=qs[_0x0b11('0x3b')](_[_0x0b11('0x3c')](_0xdce856[_0x0b11('0x31')],_0x3bb4be[_0x0b11('0x3b')]),_0x2d0de3);if(_0xdce856['query'][_0x0b11('0x3d')]){_0x5944cb[_0x0b11('0x3a')]=_[_0x0b11('0x3e')](_0x5944cb['where'],{'$or':_[_0x0b11('0x2b')](_0x2d0de3,function(_0x4a1975){if(_0x4a1975[_0x0b11('0x2d')]!=='VIRTUAL'){var _0x577ef2={};_0x577ef2[_0x4a1975['name']]={'$like':'%'+_0xdce856[_0x0b11('0x31')][_0x0b11('0x3d')]+'%'};return _0x577ef2;}})});}_0x5944cb=_[_0x0b11('0x3e')]({},_0x5944cb,_0xdce856[_0x0b11('0x3f')]);var _0x296fdc={'where':_0x5944cb['where']};return db['ServicenowAccount'][_0x0b11('0x40')](_0x296fdc)['then'](function(_0xcc8c75){_0x38e322[_0x0b11('0x40')]=_0xcc8c75;if(_0xdce856[_0x0b11('0x31')][_0x0b11('0x41')]){_0x5944cb[_0x0b11('0x42')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x5944cb);})['then'](function(_0x485726){_0x38e322[_0x0b11('0x43')]=_0x485726;return _0x38e322;})[_0x0b11('0x26')](respondWithFilteredResult(_0x37d161,_0x5944cb))['catch'](handleError(_0x37d161,null));};exports['show']=function(_0x50971b,_0x2a341d){var _0x58efcb={'raw':![],'where':{'id':_0x50971b[_0x0b11('0x44')]['id']}},_0x27c096={};_0x27c096[_0x0b11('0x2f')]=_[_0x0b11('0x32')](db[_0x0b11('0x45')][_0x0b11('0x46')]);_0x27c096['query']=_['keys'](_0x50971b['query']);_0x27c096[_0x0b11('0x3b')]=_[_0x0b11('0x33')](_0x27c096['model'],_0x27c096[_0x0b11('0x31')]);_0x58efcb['attributes']=_[_0x0b11('0x33')](_0x27c096[_0x0b11('0x2f')],qs[_0x0b11('0x34')](_0x50971b[_0x0b11('0x31')][_0x0b11('0x34')]));_0x58efcb[_0x0b11('0x35')]=_0x58efcb['attributes'][_0x0b11('0x36')]?_0x58efcb[_0x0b11('0x35')]:_0x27c096[_0x0b11('0x2f')];if(_0x50971b[_0x0b11('0x31')][_0x0b11('0x41')]){_0x58efcb[_0x0b11('0x42')]=[{'all':!![]}];}_0x58efcb=_[_0x0b11('0x3e')]({},_0x58efcb,_0x50971b[_0x0b11('0x3f')]);return db[_0x0b11('0x45')][_0x0b11('0x47')](_0x58efcb)[_0x0b11('0x26')](handleEntityNotFound(_0x2a341d,null))['then'](respondWithResult(_0x2a341d,null))[_0x0b11('0x48')](handleError(_0x2a341d,null));};exports[_0x0b11('0x49')]=function(_0x4000a7,_0xffbd3e){return db[_0x0b11('0x45')][_0x0b11('0x49')](_0x4000a7['body'],{})['then'](respondWithResult(_0xffbd3e,0xc9))[_0x0b11('0x48')](handleError(_0xffbd3e,null));};exports[_0x0b11('0x25')]=function(_0x1ec68c,_0x40a024){if(_0x1ec68c[_0x0b11('0x4a')]['id']){delete _0x1ec68c['body']['id'];}return db['ServicenowAccount'][_0x0b11('0x47')]({'where':{'id':_0x1ec68c['params']['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x40a024,null))['then'](saveUpdates(_0x1ec68c['body'],null))[_0x0b11('0x26')](respondWithResult(_0x40a024,null))[_0x0b11('0x48')](handleError(_0x40a024,null));};exports[_0x0b11('0x27')]=function(_0x53e13b,_0x3ece72){return db[_0x0b11('0x45')][_0x0b11('0x47')]({'where':{'id':_0x53e13b[_0x0b11('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ece72,null))[_0x0b11('0x26')](removeEntity(_0x3ece72,null))[_0x0b11('0x48')](handleError(_0x3ece72,null));};exports[_0x0b11('0x4b')]=function(_0x1c00ef,_0x36c84b,_0x123713){var _0x58885e={};var _0x3ab9e4={};var _0xe39107;var _0x583491;return db[_0x0b11('0x45')][_0x0b11('0x4c')]({'where':{'id':_0x1c00ef[_0x0b11('0x44')]['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x36c84b,null))[_0x0b11('0x26')](function(_0x8dd9fd){if(_0x8dd9fd){_0xe39107=_0x8dd9fd;_0x3ab9e4['model']=_[_0x0b11('0x32')](db[_0x0b11('0x4d')][_0x0b11('0x46')]);_0x3ab9e4[_0x0b11('0x31')]=_[_0x0b11('0x32')](_0x1c00ef[_0x0b11('0x31')]);_0x3ab9e4[_0x0b11('0x3b')]=_[_0x0b11('0x33')](_0x3ab9e4[_0x0b11('0x2f')],_0x3ab9e4[_0x0b11('0x31')]);_0x58885e[_0x0b11('0x35')]=_[_0x0b11('0x33')](_0x3ab9e4['model'],qs[_0x0b11('0x34')](_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x34')]));_0x58885e[_0x0b11('0x35')]=_0x58885e[_0x0b11('0x35')][_0x0b11('0x36')]?_0x58885e['attributes']:_0x3ab9e4[_0x0b11('0x2f')];_0x58885e[_0x0b11('0x4e')]=qs['sort'](_0x1c00ef['query'][_0x0b11('0x39')]);_0x58885e[_0x0b11('0x3a')]=qs['filters'](_[_0x0b11('0x3c')](_0x1c00ef[_0x0b11('0x31')],_0x3ab9e4['filters']));if(_0x1c00ef['query'][_0x0b11('0x3d')]){_0x58885e['where']=_['merge'](_0x58885e[_0x0b11('0x3a')],{'$or':_['map'](_0x58885e[_0x0b11('0x35')],function(_0x544408){var _0x2dfb70={};_0x2dfb70[_0x544408]={'$like':'%'+_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x3d')]+'%'};return _0x2dfb70;})});}_0x58885e=_[_0x0b11('0x3e')]({},_0x58885e,_0x1c00ef[_0x0b11('0x3f')]);return _0xe39107[_0x0b11('0x4b')](_0x58885e);}})['then'](function(_0x3cc3e0){if(_0x3cc3e0){_0x583491=_0x3cc3e0['length'];if(!_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x37')]('nolimit')){_0x58885e['limit']=qs['limit'](_0x1c00ef['query'][_0x0b11('0x20')]);_0x58885e[_0x0b11('0x1e')]=qs['offset'](_0x1c00ef[_0x0b11('0x31')][_0x0b11('0x1e')]);}return _0xe39107[_0x0b11('0x4b')](_0x58885e);}})[_0x0b11('0x26')](function(_0x69d909){if(_0x69d909){return _0x69d909?{'count':_0x583491,'rows':_0x69d909}:null;}})[_0x0b11('0x26')](respondWithResult(_0x36c84b,null))[_0x0b11('0x48')](handleError(_0x36c84b,null));};exports[_0x0b11('0x4f')]=function(_0x3bdbd1,_0x5d46c4,_0x124991){if(_0x3bdbd1['body']['id']){delete _0x3bdbd1['body']['id'];}return db[_0x0b11('0x45')][_0x0b11('0x4c')]({'where':{'id':_0x3bdbd1[_0x0b11('0x44')]['id']}})[_0x0b11('0x26')](handleEntityNotFound(_0x5d46c4,null))[_0x0b11('0x26')](function(_0x33116d){if(_0x33116d){_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x50')]=_0x33116d['id'];_0x3bdbd1['body']['Subjects']=integrations[_0x0b11('0x51')](_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x52')],_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x2d')]);_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x53')]=integrations[_0x0b11('0x54')](_0x3bdbd1[_0x0b11('0x4a')][_0x0b11('0x52')],_0x3bdbd1['body']['type']);return db[_0x0b11('0x4d')][_0x0b11('0x49')](_0x3bdbd1[_0x0b11('0x4a')],{'include':[{'model':db[_0x0b11('0x55')],'as':_0x0b11('0x56')},{'model':db[_0x0b11('0x55')],'as':'Descriptions'}]});}return null;})[_0x0b11('0x26')](respondWithResult(_0x5d46c4,null))[_0x0b11('0x48')](handleError(_0x5d46c4,null));};exports[_0x0b11('0x57')]=function(_0x3d3448,_0x1750dd,_0x3ca56c){var _0x533372=[_0x0b11('0x58'),_0x0b11('0x59'),_0x0b11('0x5a'),'subcategory','close_code','notify',_0x0b11('0x5b'),'severity','category'];var _0x2e8639=[_0x0b11('0x5c'),_0x0b11('0x58'),_0x0b11('0x5d'),_0x0b11('0x5e'),_0x0b11('0x5f'),_0x0b11('0x60'),_0x0b11('0x61'),_0x0b11('0x59'),_0x0b11('0x62'),_0x0b11('0x63'),_0x0b11('0x64'),_0x0b11('0x65'),_0x0b11('0x66'),'user_input','sys_created_on','sys_domain','state','sys_created_by',_0x0b11('0x5a'),_0x0b11('0x4e'),_0x0b11('0x67'),_0x0b11('0x68'),'cmdb_ci',_0x0b11('0x69'),_0x0b11('0x6a'),_0x0b11('0x6b'),_0x0b11('0x6c'),'business_service','priority',_0x0b11('0x6d'),_0x0b11('0x6e'),_0x0b11('0x6f'),'expected_start',_0x0b11('0x70'),'business_duration',_0x0b11('0x71'),_0x0b11('0x72'),_0x0b11('0x73'),_0x0b11('0x74'),_0x0b11('0x75'),_0x0b11('0x76'),'subcategory',_0x0b11('0x77'),_0x0b11('0x78'),_0x0b11('0x79'),'correlation_display','delivery_task','work_start',_0x0b11('0x7a'),'business_stc',_0x0b11('0x7b'),_0x0b11('0x7c'),_0x0b11('0x7d'),_0x0b11('0x7e'),_0x0b11('0x7f'),_0x0b11('0x80'),_0x0b11('0x81'),'follow_up',_0x0b11('0x82'),_0x0b11('0x83'),_0x0b11('0x84'),_0x0b11('0x85'),'incident_state','urgency',_0x0b11('0x86'),_0x0b11('0x87'),_0x0b11('0x88'),'activity_due','assigned_to',_0x0b11('0x89'),_0x0b11('0x8a'),_0x0b11('0x8b'),_0x0b11('0x8c'),_0x0b11('0x8d'),_0x0b11('0x8e'),_0x0b11('0x8f'),_0x0b11('0x90'),_0x0b11('0x91'),'escalation',_0x0b11('0x92'),_0x0b11('0x93'),_0x0b11('0x94'),_0x0b11('0x95')];var _0x2f6b27='';var _0x456c65='';var _0x292a49=[];var _0x841f67='';var _0x588d7c='';var _0x3bcb05=[];var _0x368ff0='';var _0x18d95d='';var _0x32cb79={};var _0x3fd341='';return db['ServicenowAccount'][_0x0b11('0x4c')]({'where':{'id':_0x3d3448[_0x0b11('0x44')]['id']},'attributes':['id','username',_0x0b11('0x96'),'email',_0x0b11('0x97'),_0x0b11('0x98')]})[_0x0b11('0x26')](handleEntityNotFound(_0x1750dd,null))['then'](function(_0x14bc09){if(_0x14bc09){_0x3fd341=_0x14bc09['remoteUri'];var _0x411ac6=_0x3fd341[_0x0b11('0x99')](-0x1);if(_0x411ac6==='/'){_0x3fd341=_0x3fd341[_0x0b11('0x9a')](0x0,_0x3fd341[_0x0b11('0x9b')](_0x411ac6));}_0x18d95d=util['format']('%s/api/now/doc/table/schema/',_0x3fd341);_0x368ff0=util[_0x0b11('0x9c')](_0x0b11('0x9d'),_0x3fd341);_0x32cb79={'user':_0x14bc09[_0x0b11('0x9e')],'pass':_0x14bc09[_0x0b11('0x96')]};var _0x5c9990={'method':_0x0b11('0x9f'),'uri':_0x18d95d+_0x0b11('0xa0'),'auth':_0x32cb79,'json':!![]};return rp(_0x5c9990);}})[_0x0b11('0x26')](function(_0x5ec69c){if(_0x5ec69c['result'][_0x0b11('0x36')]>0x0){_0x2f6b27=_0x5ec69c[_0x0b11('0xa1')];}console[_0x0b11('0xa2')]('incident\x20table\x20objects',_0x2f6b27);_0x3bcb05=[];_0x456c65=Object[_0x0b11('0xa3')]([],_0x2f6b27);_[_0x0b11('0xa4')](_0x456c65,function(_0x1a2cdb){return!_0x533372[_0x0b11('0xa5')](_0x1a2cdb[_0x0b11('0x30')]);});_0x456c65[_0x0b11('0xa6')](function(_0x377229){var _0x40562b=createFieldObject(_0x368ff0,_0x32cb79,_0x377229[_0x0b11('0xa7')],_0x377229[_0x0b11('0x30')],_0x377229['label'],![]);_0x3bcb05[_0x0b11('0xa8')](_0x40562b);});return Promise[_0x0b11('0xa9')](_0x3bcb05);})[_0x0b11('0x26')](function(_0x35909d){_0x292a49=_0x35909d;_0x841f67=Object[_0x0b11('0xa3')]([],_0x2f6b27);console['log']('TCL:\x20_object',_0x2f6b27);_[_0x0b11('0xa4')](_0x841f67,function(_0x2185df){return _0x2e8639[_0x0b11('0xa5')](_0x2185df[_0x0b11('0x30')]);});console[_0x0b11('0xa2')](_0x0b11('0xaa'),_0x841f67);_0x3bcb05=[];_0x841f67[_0x0b11('0xa6')](function(_0x3dffa0){var _0x199407=createFieldObject(_0x368ff0,_0x32cb79,_0x3dffa0[_0x0b11('0xa7')],_0x3dffa0[_0x0b11('0x30')],_0x3dffa0[_0x0b11('0xab')],!![]);_0x3bcb05['push'](_0x199407);});return Promise[_0x0b11('0xa9')](_0x3bcb05);})[_0x0b11('0x26')](function(_0x3f95fb){_0x588d7c=_0x3f95fb;var _0x4c0da9=_0x292a49['concat'](_0x588d7c);return{'count':_0x4c0da9[_0x0b11('0x36')],'rows':_0x4c0da9};})[_0x0b11('0x26')](respondWithResult(_0x1750dd,null))[_0x0b11('0x48')](function(_0x5b5934){console['log']('ServiceNow\x20error:\x20'+_0x5b5934);var _0x3ee467=_0x3d3448[_0x0b11('0x31')][_0x0b11('0xac')]?0x1f4:_0x5b5934['statusCode']||0x1f4;logger[_0x0b11('0x28')](_0x5b5934[_0x0b11('0x29')]);delete _0x5b5934[_0x0b11('0x30')];if(_0x3ee467===0x191){_0x3ee467=0x190;}_0x1750dd[_0x0b11('0x1b')](_0x3ee467)[_0x0b11('0x2a')](_0x3d3448[_0x0b11('0x31')][_0x0b11('0xac')]?{'message':_0x0b11('0xad'),'statusCode':_0x5b5934[_0x0b11('0xae')]}:_0x5b5934);});};function createFieldObject(_0x3a9b22,_0x531667,_0x36b495,_0x250993,_0x24451f,_0x5ecc42){return new Promise(function(_0x442e05,_0x2ddf7b){var _0x9abd5d={'id':_0x250993,'name':_0x24451f,'custom':_0x5ecc42};if(_0x36b495==='boolean'){_0x9abd5d[_0x0b11('0x3f')]=[{'name':_0x0b11('0xaf'),'value':_0x0b11('0xb0')},{'name':_0x0b11('0xb1'),'value':_0x0b11('0xb2')}];_0x442e05(_0x9abd5d);}else{var _0x109dd6={'method':_0x0b11('0x9f'),'uri':_0x3a9b22+'sys_choice?sysparm_query=name=incident^element='+_0x250993,'auth':_0x531667,'json':!![]};return rp(_0x109dd6)[_0x0b11('0x26')](function(_0x43d26d){var _0x19189f=[];if(_0x43d26d[_0x0b11('0xa1')][_0x0b11('0x36')]>0x0){_0x43d26d[_0x0b11('0xa1')][_0x0b11('0xa6')](function(_0x3fb9f9){if(_0x3fb9f9['inactive']===_0x0b11('0xb2')){var _0x51b5c7={'name':_0x3fb9f9[_0x0b11('0xab')],'value':_0x3fb9f9['value']};_0x19189f[_0x0b11('0xa8')](_0x51b5c7);}});}_0x9abd5d['options']=_0x19189f;if(_0x9abd5d[_0x0b11('0x3f')][_0x0b11('0x36')]>0x0){_0x442e05(_0x9abd5d);}else{if(_0x5ecc42==![]){_0x442e05();}else{_0x442e05(_0x9abd5d);}}});}});} \ No newline at end of file +var _0x1cf2=['correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','result','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','pick','AccountId','Descriptions','getDescriptions','channel','Subjects','ServicenowField','hold_reason','knowledge','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','comments','comments_and_work_notes','sys_tags','escalation','upon_approval'];(function(_0x38393c,_0x32ca58){var _0x5c4c9f=function(_0xb81636){while(--_0xb81636){_0x38393c['push'](_0x38393c['shift']());}};_0x5c4c9f(++_0x32ca58);}(_0x1cf2,0xd9));var _0x21cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1cf2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x21cf('0x0'));var rimraf=require(_0x21cf('0x1'));var zipdir=require(_0x21cf('0x2'));var jsonpatch=require(_0x21cf('0x3'));var rp=require('request-promise');var moment=require(_0x21cf('0x4'));var BPromise=require(_0x21cf('0x5'));var Mustache=require(_0x21cf('0x6'));var util=require(_0x21cf('0x7'));var path=require('path');var sox=require(_0x21cf('0x8'));var csv=require(_0x21cf('0x9'));var ejs=require(_0x21cf('0xa'));var fs=require('fs');var fs_extra=require(_0x21cf('0xb'));var _=require('lodash');var squel=require(_0x21cf('0xc'));var crypto=require(_0x21cf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21cf('0xe'));var toCsv=require(_0x21cf('0x9'));var querystring=require(_0x21cf('0xf'));var Papa=require(_0x21cf('0x10'));var Redis=require(_0x21cf('0x11'));var authService=require(_0x21cf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x21cf('0x13'));var hardwareService=require(_0x21cf('0x14'));var logger=require(_0x21cf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x21cf('0x16'));var licenseUtil=require(_0x21cf('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x19c612,_0xe6d55a){_0xe6d55a=_0xe6d55a||0xcc;return function(_0x3b74ee){if(_0x3b74ee){return _0x19c612[_0x21cf('0x18')](_0xe6d55a);}return _0x19c612[_0x21cf('0x19')](_0xe6d55a)[_0x21cf('0x1a')]();};}function respondWithResult(_0xf638c9,_0x187eda){_0x187eda=_0x187eda||0xc8;return function(_0x209984){if(_0x209984){return _0xf638c9[_0x21cf('0x19')](_0x187eda)[_0x21cf('0x1b')](_0x209984);}};}function respondWithFilteredResult(_0x55e2e7,_0x57e451){return function(_0x23c88d){if(_0x23c88d){var _0x501a78=typeof _0x57e451['offset']==='undefined'&&typeof _0x57e451[_0x21cf('0x1c')]===_0x21cf('0x1d');var _0x283ed1=_0x23c88d[_0x21cf('0x1e')];var _0x1f065b=_0x501a78?0x0:_0x57e451['offset'];var _0x5d0795=_0x501a78?_0x23c88d[_0x21cf('0x1e')]:_0x57e451[_0x21cf('0x1f')]+_0x57e451[_0x21cf('0x1c')];var _0x1f8bf1;if(_0x5d0795>=_0x283ed1){_0x5d0795=_0x283ed1;_0x1f8bf1=0xc8;}else{_0x1f8bf1=0xce;}_0x55e2e7[_0x21cf('0x19')](_0x1f8bf1);return _0x55e2e7[_0x21cf('0x20')](_0x21cf('0x21'),_0x1f065b+'-'+_0x5d0795+'/'+_0x283ed1)[_0x21cf('0x1b')](_0x23c88d);}return null;};}function patchUpdates(_0x4d9e69){return function(_0x209e34){try{jsonpatch[_0x21cf('0x22')](_0x209e34,_0x4d9e69,!![]);}catch(_0x23bdfd){return BPromise[_0x21cf('0x23')](_0x23bdfd);}return _0x209e34['save']();};}function saveUpdates(_0x480024,_0x34f254){return function(_0x1bdb95){if(_0x1bdb95){return _0x1bdb95['update'](_0x480024)['then'](function(_0x1e5cbd){return _0x1e5cbd;});}return null;};}function removeEntity(_0x2f8c68,_0x472250){return function(_0x33a250){if(_0x33a250){return _0x33a250['destroy']()[_0x21cf('0x24')](function(){_0x2f8c68[_0x21cf('0x19')](0xcc)[_0x21cf('0x1a')]();});}};}function handleEntityNotFound(_0x1f5b38,_0x54cec9){return function(_0x105c5f){if(!_0x105c5f){_0x1f5b38[_0x21cf('0x18')](0x194);}return _0x105c5f;};}function handleError(_0x3ba81e,_0xbe1308){_0xbe1308=_0xbe1308||0x1f4;return function(_0x4cb0ad){logger[_0x21cf('0x25')](_0x4cb0ad[_0x21cf('0x26')]);if(_0x4cb0ad[_0x21cf('0x27')]){delete _0x4cb0ad[_0x21cf('0x27')];}_0x3ba81e[_0x21cf('0x19')](_0xbe1308)[_0x21cf('0x28')](_0x4cb0ad);};}exports[_0x21cf('0x29')]=function(_0x28e0b4,_0x4533e3){var _0x5bb28f={},_0x51b11b={},_0x5a1ea8={'count':0x0,'rows':[]};var _0x281c25=_[_0x21cf('0x2a')](db[_0x21cf('0x2b')][_0x21cf('0x2c')],function(_0x2a9967){return{'name':_0x2a9967[_0x21cf('0x2d')],'type':_0x2a9967[_0x21cf('0x2e')][_0x21cf('0x2f')]};});_0x51b11b['model']=_[_0x21cf('0x2a')](_0x281c25,_0x21cf('0x27'));_0x51b11b['query']=_[_0x21cf('0x30')](_0x28e0b4[_0x21cf('0x31')]);_0x51b11b['filters']=_[_0x21cf('0x32')](_0x51b11b[_0x21cf('0x33')],_0x51b11b[_0x21cf('0x31')]);_0x5bb28f[_0x21cf('0x34')]=_[_0x21cf('0x32')](_0x51b11b[_0x21cf('0x33')],qs[_0x21cf('0x35')](_0x28e0b4[_0x21cf('0x31')][_0x21cf('0x35')]));_0x5bb28f[_0x21cf('0x34')]=_0x5bb28f[_0x21cf('0x34')][_0x21cf('0x36')]?_0x5bb28f['attributes']:_0x51b11b[_0x21cf('0x33')];if(!_0x28e0b4['query'][_0x21cf('0x37')]('nolimit')){_0x5bb28f[_0x21cf('0x1c')]=qs['limit'](_0x28e0b4[_0x21cf('0x31')]['limit']);_0x5bb28f[_0x21cf('0x1f')]=qs[_0x21cf('0x1f')](_0x28e0b4[_0x21cf('0x31')][_0x21cf('0x1f')]);}_0x5bb28f[_0x21cf('0x38')]=qs[_0x21cf('0x39')](_0x28e0b4[_0x21cf('0x31')][_0x21cf('0x39')]);_0x5bb28f[_0x21cf('0x3a')]=qs[_0x21cf('0x3b')](_['pick'](_0x28e0b4[_0x21cf('0x31')],_0x51b11b[_0x21cf('0x3b')]),_0x281c25);if(_0x28e0b4[_0x21cf('0x31')][_0x21cf('0x3c')]){_0x5bb28f[_0x21cf('0x3a')]=_['merge'](_0x5bb28f['where'],{'$or':_['map'](_0x281c25,function(_0x16f8db){if(_0x16f8db[_0x21cf('0x2e')]!==_0x21cf('0x3d')){var _0x1fd312={};_0x1fd312[_0x16f8db[_0x21cf('0x27')]]={'$like':'%'+_0x28e0b4[_0x21cf('0x31')][_0x21cf('0x3c')]+'%'};return _0x1fd312;}})});}_0x5bb28f=_[_0x21cf('0x3e')]({},_0x5bb28f,_0x28e0b4[_0x21cf('0x3f')]);var _0x31d267={'where':_0x5bb28f['where']};return db[_0x21cf('0x2b')][_0x21cf('0x1e')](_0x31d267)['then'](function(_0x501f76){_0x5a1ea8['count']=_0x501f76;if(_0x28e0b4['query'][_0x21cf('0x40')]){_0x5bb28f[_0x21cf('0x41')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x5bb28f);})[_0x21cf('0x24')](function(_0x187b76){_0x5a1ea8[_0x21cf('0x42')]=_0x187b76;return _0x5a1ea8;})[_0x21cf('0x24')](respondWithFilteredResult(_0x4533e3,_0x5bb28f))[_0x21cf('0x43')](handleError(_0x4533e3,null));};exports['show']=function(_0x3819e5,_0x161c26){var _0x58694e={'raw':![],'where':{'id':_0x3819e5[_0x21cf('0x44')]['id']}},_0x167245={};_0x167245[_0x21cf('0x33')]=_[_0x21cf('0x30')](db[_0x21cf('0x2b')][_0x21cf('0x2c')]);_0x167245['query']=_['keys'](_0x3819e5[_0x21cf('0x31')]);_0x167245[_0x21cf('0x3b')]=_[_0x21cf('0x32')](_0x167245[_0x21cf('0x33')],_0x167245[_0x21cf('0x31')]);_0x58694e[_0x21cf('0x34')]=_[_0x21cf('0x32')](_0x167245['model'],qs[_0x21cf('0x35')](_0x3819e5['query'][_0x21cf('0x35')]));_0x58694e[_0x21cf('0x34')]=_0x58694e[_0x21cf('0x34')][_0x21cf('0x36')]?_0x58694e[_0x21cf('0x34')]:_0x167245['model'];if(_0x3819e5['query'][_0x21cf('0x40')]){_0x58694e[_0x21cf('0x41')]=[{'all':!![]}];}_0x58694e=_['merge']({},_0x58694e,_0x3819e5[_0x21cf('0x3f')]);return db[_0x21cf('0x2b')][_0x21cf('0x45')](_0x58694e)[_0x21cf('0x24')](handleEntityNotFound(_0x161c26,null))['then'](respondWithResult(_0x161c26,null))['catch'](handleError(_0x161c26,null));};exports['create']=function(_0xa8fea4,_0x45839d){return db[_0x21cf('0x2b')][_0x21cf('0x46')](_0xa8fea4[_0x21cf('0x47')],{})[_0x21cf('0x24')](respondWithResult(_0x45839d,0xc9))[_0x21cf('0x43')](handleError(_0x45839d,null));};exports['update']=function(_0x3c1e95,_0x391621){if(_0x3c1e95[_0x21cf('0x47')]['id']){delete _0x3c1e95['body']['id'];}return db['ServicenowAccount'][_0x21cf('0x45')]({'where':{'id':_0x3c1e95[_0x21cf('0x44')]['id']}})[_0x21cf('0x24')](handleEntityNotFound(_0x391621,null))[_0x21cf('0x24')](saveUpdates(_0x3c1e95['body'],null))[_0x21cf('0x24')](respondWithResult(_0x391621,null))['catch'](handleError(_0x391621,null));};exports['destroy']=function(_0x38bbbe,_0x3fd611){return db[_0x21cf('0x2b')][_0x21cf('0x45')]({'where':{'id':_0x38bbbe[_0x21cf('0x44')]['id']}})[_0x21cf('0x24')](handleEntityNotFound(_0x3fd611,null))[_0x21cf('0x24')](removeEntity(_0x3fd611,null))[_0x21cf('0x43')](handleError(_0x3fd611,null));};exports[_0x21cf('0x48')]=function(_0x5755b8,_0x4e721f,_0x5f535a){var _0x453811={};var _0x125597={};var _0x5ebf6d;var _0x5c5b84;return db[_0x21cf('0x2b')][_0x21cf('0x49')]({'where':{'id':_0x5755b8['params']['id']}})[_0x21cf('0x24')](handleEntityNotFound(_0x4e721f,null))[_0x21cf('0x24')](function(_0x53d749){if(_0x53d749){_0x5ebf6d=_0x53d749;_0x125597['model']=_[_0x21cf('0x30')](db[_0x21cf('0x4a')][_0x21cf('0x2c')]);_0x125597[_0x21cf('0x31')]=_[_0x21cf('0x30')](_0x5755b8[_0x21cf('0x31')]);_0x125597[_0x21cf('0x3b')]=_[_0x21cf('0x32')](_0x125597[_0x21cf('0x33')],_0x125597[_0x21cf('0x31')]);_0x453811['attributes']=_[_0x21cf('0x32')](_0x125597['model'],qs[_0x21cf('0x35')](_0x5755b8['query']['fields']));_0x453811[_0x21cf('0x34')]=_0x453811[_0x21cf('0x34')][_0x21cf('0x36')]?_0x453811[_0x21cf('0x34')]:_0x125597[_0x21cf('0x33')];_0x453811[_0x21cf('0x38')]=qs[_0x21cf('0x39')](_0x5755b8[_0x21cf('0x31')][_0x21cf('0x39')]);_0x453811['where']=qs[_0x21cf('0x3b')](_[_0x21cf('0x4b')](_0x5755b8[_0x21cf('0x31')],_0x125597[_0x21cf('0x3b')]));if(_0x5755b8[_0x21cf('0x31')][_0x21cf('0x3c')]){_0x453811['where']=_[_0x21cf('0x3e')](_0x453811[_0x21cf('0x3a')],{'$or':_['map'](_0x453811[_0x21cf('0x34')],function(_0x3683bc){var _0x4a99d4={};_0x4a99d4[_0x3683bc]={'$like':'%'+_0x5755b8[_0x21cf('0x31')][_0x21cf('0x3c')]+'%'};return _0x4a99d4;})});}_0x453811=_[_0x21cf('0x3e')]({},_0x453811,_0x5755b8[_0x21cf('0x3f')]);return _0x5ebf6d[_0x21cf('0x48')](_0x453811);}})[_0x21cf('0x24')](function(_0x14677b){if(_0x14677b){_0x5c5b84=_0x14677b[_0x21cf('0x36')];if(!_0x5755b8['query'][_0x21cf('0x37')]('nolimit')){_0x453811[_0x21cf('0x1c')]=qs['limit'](_0x5755b8['query']['limit']);_0x453811[_0x21cf('0x1f')]=qs[_0x21cf('0x1f')](_0x5755b8[_0x21cf('0x31')][_0x21cf('0x1f')]);}return _0x5ebf6d[_0x21cf('0x48')](_0x453811);}})['then'](function(_0x404b74){if(_0x404b74){return _0x404b74?{'count':_0x5c5b84,'rows':_0x404b74}:null;}})['then'](respondWithResult(_0x4e721f,null))[_0x21cf('0x43')](handleError(_0x4e721f,null));};exports['addConfiguration']=function(_0x25e305,_0x2d3175,_0x599a04){if(_0x25e305['body']['id']){delete _0x25e305['body']['id'];}return db[_0x21cf('0x2b')][_0x21cf('0x49')]({'where':{'id':_0x25e305['params']['id']}})[_0x21cf('0x24')](handleEntityNotFound(_0x2d3175,null))[_0x21cf('0x24')](function(_0x20551e){if(_0x20551e){_0x25e305['body'][_0x21cf('0x4c')]=_0x20551e['id'];_0x25e305[_0x21cf('0x47')]['Subjects']=integrations['getSubjects'](_0x25e305['body']['channel'],_0x25e305['body']['type']);_0x25e305[_0x21cf('0x47')][_0x21cf('0x4d')]=integrations[_0x21cf('0x4e')](_0x25e305['body'][_0x21cf('0x4f')],_0x25e305[_0x21cf('0x47')][_0x21cf('0x2e')]);return db[_0x21cf('0x4a')][_0x21cf('0x46')](_0x25e305[_0x21cf('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x21cf('0x50')},{'model':db[_0x21cf('0x51')],'as':'Descriptions'}]});}return null;})[_0x21cf('0x24')](respondWithResult(_0x2d3175,null))[_0x21cf('0x43')](handleError(_0x2d3175,null));};exports['getFields']=function(_0x245475,_0x27eeee,_0x50e68c){var _0x254ccc=['made_sla',_0x21cf('0x52'),_0x21cf('0x53'),'subcategory',_0x21cf('0x54'),_0x21cf('0x55'),'incident_state',_0x21cf('0x56'),_0x21cf('0x57')];var _0x4de1e1=[_0x21cf('0x58'),'made_sla',_0x21cf('0x59'),_0x21cf('0x5a'),_0x21cf('0x5b'),_0x21cf('0x5c'),_0x21cf('0x5d'),_0x21cf('0x52'),_0x21cf('0x5e'),_0x21cf('0x5f'),_0x21cf('0x60'),_0x21cf('0x61'),_0x21cf('0x62'),_0x21cf('0x63'),'sys_created_on',_0x21cf('0x64'),_0x21cf('0x65'),_0x21cf('0x66'),_0x21cf('0x53'),_0x21cf('0x38'),_0x21cf('0x67'),_0x21cf('0x68'),_0x21cf('0x69'),_0x21cf('0x6a'),'impact',_0x21cf('0x6b'),_0x21cf('0x6c'),'business_service',_0x21cf('0x6d'),_0x21cf('0x6e'),_0x21cf('0x6f'),'time_worked',_0x21cf('0x70'),_0x21cf('0x71'),_0x21cf('0x72'),'group_list',_0x21cf('0x73'),'reopened_time',_0x21cf('0x74'),_0x21cf('0x75'),_0x21cf('0x76'),'subcategory',_0x21cf('0x77'),_0x21cf('0x78'),_0x21cf('0x54'),_0x21cf('0x79'),'delivery_task','work_start',_0x21cf('0x7a'),'business_stc',_0x21cf('0x7b'),_0x21cf('0x7c'),_0x21cf('0x7d'),_0x21cf('0x55'),_0x21cf('0x7e'),_0x21cf('0x7f'),_0x21cf('0x80'),_0x21cf('0x81'),_0x21cf('0x82'),_0x21cf('0x83'),_0x21cf('0x84'),'reopened_by','incident_state',_0x21cf('0x85'),_0x21cf('0x86'),_0x21cf('0x87'),_0x21cf('0x88'),_0x21cf('0x89'),'assigned_to',_0x21cf('0x56'),_0x21cf('0x8a'),'sla_due','approval',_0x21cf('0x8b'),'due_date','sys_mod_count','reopen_count',_0x21cf('0x8c'),_0x21cf('0x8d'),_0x21cf('0x8e'),_0x21cf('0x8f'),_0x21cf('0x90'),_0x21cf('0x57')];var _0x9ad977='';var _0x7b88fa='';var _0xb90f7e=[];var _0x8d515a='';var _0x253451='';var _0x53eb77=[];var _0x48221a='';var _0x49c88a='';var _0x1e7c11={};var _0x3e5295='';return db['ServicenowAccount'][_0x21cf('0x49')]({'where':{'id':_0x245475[_0x21cf('0x44')]['id']},'attributes':['id',_0x21cf('0x91'),'password',_0x21cf('0x92'),_0x21cf('0x93'),_0x21cf('0x94')]})[_0x21cf('0x24')](handleEntityNotFound(_0x27eeee,null))[_0x21cf('0x24')](function(_0x3f7e10){if(_0x3f7e10){_0x3e5295=_0x3f7e10['remoteUri'];var _0xccd24f=_0x3e5295[_0x21cf('0x95')](-0x1);if(_0xccd24f==='/'){_0x3e5295=_0x3e5295[_0x21cf('0x96')](0x0,_0x3e5295[_0x21cf('0x97')](_0xccd24f));}_0x49c88a=util[_0x21cf('0x98')](_0x21cf('0x99'),_0x3e5295);_0x48221a=util[_0x21cf('0x98')](_0x21cf('0x9a'),_0x3e5295);_0x1e7c11={'user':_0x3f7e10[_0x21cf('0x91')],'pass':_0x3f7e10['password']};var _0x530c57={'method':_0x21cf('0x9b'),'uri':_0x49c88a+_0x21cf('0x9c'),'auth':_0x1e7c11,'json':!![]};return rp(_0x530c57);}})[_0x21cf('0x24')](function(_0x36bf39){if(_0x36bf39['result']['length']>0x0){_0x9ad977=_0x36bf39['result'];}console['log'](_0x21cf('0x9d'),_0x9ad977);_0x53eb77=[];_0x7b88fa=Object[_0x21cf('0x9e')]([],_0x9ad977);_[_0x21cf('0x9f')](_0x7b88fa,function(_0x313b01){return!_0x254ccc[_0x21cf('0xa0')](_0x313b01[_0x21cf('0x27')]);});_0x7b88fa[_0x21cf('0xa1')](function(_0x2882a2){var _0x58a533=createFieldObject(_0x48221a,_0x1e7c11,_0x2882a2['internalType'],_0x2882a2[_0x21cf('0x27')],_0x2882a2['label'],![]);_0x53eb77[_0x21cf('0xa2')](_0x58a533);});return Promise[_0x21cf('0xa3')](_0x53eb77);})[_0x21cf('0x24')](function(_0x404b44){_0xb90f7e=_0x404b44;_0x8d515a=Object[_0x21cf('0x9e')]([],_0x9ad977);console[_0x21cf('0xa4')]('TCL:\x20_object',_0x9ad977);_[_0x21cf('0x9f')](_0x8d515a,function(_0x167707){return _0x4de1e1['includes'](_0x167707['name']);});console[_0x21cf('0xa4')](_0x21cf('0xa5'),_0x8d515a);_0x53eb77=[];_0x8d515a['forEach'](function(_0x7eeec1){var _0x4408c6=createFieldObject(_0x48221a,_0x1e7c11,_0x7eeec1['internalType'],_0x7eeec1[_0x21cf('0x27')],_0x7eeec1[_0x21cf('0xa6')],!![]);_0x53eb77[_0x21cf('0xa2')](_0x4408c6);});return Promise[_0x21cf('0xa3')](_0x53eb77);})[_0x21cf('0x24')](function(_0x439c65){_0x253451=_0x439c65;var _0x4f8d32=_0xb90f7e[_0x21cf('0xa7')](_0x253451);return{'count':_0x4f8d32[_0x21cf('0x36')],'rows':_0x4f8d32};})[_0x21cf('0x24')](respondWithResult(_0x27eeee,null))[_0x21cf('0x43')](function(_0x1bc31e){console[_0x21cf('0xa4')]('ServiceNow\x20error:\x20'+_0x1bc31e);var _0x3b29b4=_0x245475[_0x21cf('0x31')][_0x21cf('0xa8')]?0x1f4:_0x1bc31e[_0x21cf('0xa9')]||0x1f4;logger[_0x21cf('0x25')](_0x1bc31e[_0x21cf('0x26')]);delete _0x1bc31e[_0x21cf('0x27')];if(_0x3b29b4===0x191){_0x3b29b4=0x190;}_0x27eeee[_0x21cf('0x19')](_0x3b29b4)['send'](_0x245475['query'][_0x21cf('0xa8')]?{'message':_0x21cf('0xaa'),'statusCode':_0x1bc31e[_0x21cf('0xa9')]}:_0x1bc31e);});};function createFieldObject(_0x55f065,_0x295880,_0x56be5e,_0x31c14c,_0x2b2ba7,_0x57662f){return new Promise(function(_0x4f460b,_0x4f445c){var _0x331561={'id':_0x31c14c,'name':_0x2b2ba7,'custom':_0x57662f};if(_0x56be5e===_0x21cf('0xab')){_0x331561[_0x21cf('0x3f')]=[{'name':_0x21cf('0xac'),'value':_0x21cf('0xad')},{'name':_0x21cf('0xae'),'value':_0x21cf('0xaf')}];_0x4f460b(_0x331561);}else{var _0x16125a={'method':_0x21cf('0x9b'),'uri':_0x55f065+_0x21cf('0xb0')+_0x31c14c,'auth':_0x295880,'json':!![]};return rp(_0x16125a)[_0x21cf('0x24')](function(_0x2048c4){var _0x5ce9e4=[];if(_0x2048c4['result'][_0x21cf('0x36')]>0x0){_0x2048c4[_0x21cf('0xb1')]['forEach'](function(_0x532482){if(_0x532482[_0x21cf('0xb2')]===_0x21cf('0xaf')){var _0x3cdb1d={'name':_0x532482[_0x21cf('0xa6')],'value':_0x532482[_0x21cf('0xb3')]};_0x5ce9e4['push'](_0x3cdb1d);}});}_0x331561[_0x21cf('0x3f')]=_0x5ce9e4;if(_0x331561['options']['length']>0x0){_0x4f460b(_0x331561);}else{if(_0x57662f==![]){_0x4f460b();}else{_0x4f460b(_0x331561);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 165f417..40161fe 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 _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0xe109af,_0x17c337){var _0x599e29=function(_0x2d7c7b){while(--_0x2d7c7b){_0xe109af['push'](_0xe109af['shift']());}};_0x599e29(++_0x17c337);}(_0xdc97,0x13b));var _0x7dc9=function(_0x13ec3a,_0x52890d){_0x13ec3a=_0x13ec3a-0x0;var _0x2f4625=_0xdc97[_0x13ec3a];return _0x2f4625;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0xbf6e7a,_0x291599){var _0x1a9080=function(_0x19bd99){while(--_0x19bd99){_0xbf6e7a['push'](_0xbf6e7a['shift']());}};_0x1a9080(++_0x291599);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1f85ea,_0x2936f7){_0x1f85ea=_0x1f85ea-0x0;var _0x4289fa=_0xb4c7[_0x1f85ea];return _0x4289fa;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'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 04406de..3b93483 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 _0x4258=['limit','include','map','model','GetServicenowAccount','find','raw','ShowServicenowAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','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'];(function(_0x462e79,_0x13e601){var _0x502abc=function(_0x432436){while(--_0x432436){_0x462e79['push'](_0x462e79['shift']());}};_0x502abc(++_0x13e601);}(_0x4258,0x1b8));var _0x8425=function(_0x4c8fc7,_0x4760c2){_0x4c8fc7=_0x4c8fc7-0x0;var _0x1adab6=_0x4258[_0x4c8fc7];return _0x1adab6;};'use strict';var _=require(_0x8425('0x0'));var util=require(_0x8425('0x1'));var moment=require('moment');var BPromise=require(_0x8425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8425('0x3'))['db'];var utils=require(_0x8425('0x4'));var logger=require(_0x8425('0x5'))('rpc');var config=require(_0x8425('0x6'));var jayson=require(_0x8425('0x7'));var client=jayson[_0x8425('0x8')][_0x8425('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f83d0,_0x41fc9e,_0x465359){return new BPromise(function(_0x15e24c,_0x14ad67){return client[_0x8425('0xa')](_0x2f83d0,_0x465359)[_0x8425('0xb')](function(_0x2b364c){logger[_0x8425('0xc')](_0x8425('0xd'),_0x41fc9e,_0x8425('0xe'));logger[_0x8425('0xf')](_0x8425('0x10'),_0x41fc9e,'request\x20sent',JSON[_0x8425('0x11')](_0x2b364c));if(_0x2b364c['error']){if(_0x2b364c[_0x8425('0x12')][_0x8425('0x13')]===0x1f4){logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);return _0x14ad67(_0x2b364c['error']['message']);}logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);return _0x15e24c(_0x2b364c[_0x8425('0x12')][_0x8425('0x14')]);}else{logger[_0x8425('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x41fc9e,_0x8425('0xe'));_0x15e24c(_0x2b364c[_0x8425('0x15')][_0x8425('0x14')]);}})[_0x8425('0x16')](function(_0x5c5d11){logger[_0x8425('0x12')](_0x8425('0xd'),_0x41fc9e,_0x5c5d11);_0x14ad67(_0x5c5d11);});});}exports['GetServicenowAccount']=function(_0x29d005){var _0x54fea4=this;return new Promise(function(_0x462383,_0x513065){return db[_0x8425('0x17')][_0x8425('0x18')]({'raw':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29d005[_0x8425('0x19')]?_0x29d005['options'][_0x8425('0x1a')]||null:null,'attributes':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')][_0x8425('0x1b')]||null:null,'limit':_0x29d005[_0x8425('0x19')]?_0x29d005[_0x8425('0x19')][_0x8425('0x1c')]||null:null,'include':_0x29d005[_0x8425('0x19')]?_0x29d005['options'][_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x29d005[_0x8425('0x19')][_0x8425('0x1d')],function(_0xdc3611){return{'model':db[_0xdc3611[_0x8425('0x1f')]],'as':_0xdc3611['as'],'attributes':_0xdc3611[_0x8425('0x1b')],'include':_0xdc3611[_0x8425('0x1d')]?_[_0x8425('0x1e')](_0xdc3611[_0x8425('0x1d')],function(_0xf76605){return{'model':db[_0xf76605[_0x8425('0x1f')]],'as':_0xf76605['as'],'attributes':_0xf76605['attributes'],'include':_0xf76605[_0x8425('0x1d')]?_['map'](_0xf76605[_0x8425('0x1d')],function(_0x54b3db){return{'model':db[_0x54b3db[_0x8425('0x1f')]],'as':_0x54b3db['as'],'attributes':_0x54b3db[_0x8425('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8425('0xb')](function(_0x31aada){logger[_0x8425('0xc')](_0x8425('0x20'),_0x29d005);logger[_0x8425('0xf')](_0x8425('0x20'),_0x29d005,JSON['stringify'](_0x31aada));_0x462383(_0x31aada);})['catch'](function(_0x278617){logger[_0x8425('0x12')](_0x8425('0x20'),_0x278617['message'],_0x29d005);_0x513065(_0x54fea4[_0x8425('0x12')](0x1f4,_0x278617[_0x8425('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x12b7b5){var _0x393f76=this;return new Promise(function(_0x2a7fa7,_0x178509){return db['ServicenowAccount'][_0x8425('0x21')]({'raw':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x22')]===undefined?!![]:![]:!![],'where':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x1a')]||null:null,'attributes':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5[_0x8425('0x19')][_0x8425('0x1b')]||null:null,'include':_0x12b7b5[_0x8425('0x19')]?_0x12b7b5['options'][_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x12b7b5[_0x8425('0x19')][_0x8425('0x1d')],function(_0x1a90ec){return{'model':db[_0x1a90ec[_0x8425('0x1f')]],'as':_0x1a90ec['as'],'attributes':_0x1a90ec[_0x8425('0x1b')],'include':_0x1a90ec[_0x8425('0x1d')]?_[_0x8425('0x1e')](_0x1a90ec['include'],function(_0x213721){return{'model':db[_0x213721[_0x8425('0x1f')]],'as':_0x213721['as'],'attributes':_0x213721[_0x8425('0x1b')],'include':_0x213721['include']?_['map'](_0x213721['include'],function(_0x5a3e95){return{'model':db[_0x5a3e95['model']],'as':_0x5a3e95['as'],'attributes':_0x5a3e95[_0x8425('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8425('0xb')](function(_0x52d4a9){logger[_0x8425('0xc')](_0x8425('0x23'),_0x12b7b5);logger[_0x8425('0xf')](_0x8425('0x23'),_0x12b7b5,JSON[_0x8425('0x11')](_0x52d4a9));_0x2a7fa7(_0x52d4a9);})[_0x8425('0x16')](function(_0x3f3589){logger[_0x8425('0x12')](_0x8425('0x23'),_0x3f3589[_0x8425('0x14')],_0x12b7b5);_0x178509(_0x393f76[_0x8425('0x12')](0x1f4,_0x3f3589[_0x8425('0x14')]));});});}; \ No newline at end of file +var _0xcd88=['message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','include','map','model','ShowServicenowAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0xcd88,0x16c));var _0x8cd8=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xcd88[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var moment=require('moment');var BPromise=require(_0x8cd8('0x2'));var rs=require(_0x8cd8('0x3'));var fs=require('fs');var Redis=require(_0x8cd8('0x4'));var db=require(_0x8cd8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cd8('0x6'))(_0x8cd8('0x7'));var config=require(_0x8cd8('0x8'));var jayson=require(_0x8cd8('0x9'));var client=jayson[_0x8cd8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b472b,_0x32300d,_0x5816b7){return new BPromise(function(_0x2bd189,_0x429f50){return client[_0x8cd8('0xb')](_0x2b472b,_0x5816b7)[_0x8cd8('0xc')](function(_0x325ddc){logger[_0x8cd8('0xd')](_0x8cd8('0xe'),_0x32300d,_0x8cd8('0xf'));logger[_0x8cd8('0x10')](_0x8cd8('0x11'),_0x32300d,_0x8cd8('0xf'),JSON[_0x8cd8('0x12')](_0x325ddc));if(_0x325ddc[_0x8cd8('0x13')]){if(_0x325ddc[_0x8cd8('0x13')][_0x8cd8('0x14')]===0x1f4){logger[_0x8cd8('0x13')](_0x8cd8('0xe'),_0x32300d,_0x325ddc['error']['message']);return _0x429f50(_0x325ddc[_0x8cd8('0x13')][_0x8cd8('0x15')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x32300d,_0x325ddc['error'][_0x8cd8('0x15')]);return _0x2bd189(_0x325ddc[_0x8cd8('0x13')][_0x8cd8('0x15')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x32300d,_0x8cd8('0xf'));_0x2bd189(_0x325ddc[_0x8cd8('0x16')][_0x8cd8('0x15')]);}})[_0x8cd8('0x17')](function(_0x4e9d4e){logger[_0x8cd8('0x13')](_0x8cd8('0xe'),_0x32300d,_0x4e9d4e);_0x429f50(_0x4e9d4e);});});}exports[_0x8cd8('0x18')]=function(_0x5f21bd){var _0xf8d554=this;return new Promise(function(_0x3a6f0b,_0xc1669b){return db[_0x8cd8('0x19')]['findAll']({'raw':_0x5f21bd[_0x8cd8('0x1a')]?_0x5f21bd[_0x8cd8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5f21bd[_0x8cd8('0x1a')]?_0x5f21bd['options'][_0x8cd8('0x1b')]||null:null,'attributes':_0x5f21bd[_0x8cd8('0x1a')]?_0x5f21bd['options'][_0x8cd8('0x1c')]||null:null,'limit':_0x5f21bd[_0x8cd8('0x1a')]?_0x5f21bd['options']['limit']||null:null,'include':_0x5f21bd[_0x8cd8('0x1a')]?_0x5f21bd['options'][_0x8cd8('0x1d')]?_[_0x8cd8('0x1e')](_0x5f21bd[_0x8cd8('0x1a')][_0x8cd8('0x1d')],function(_0x8f8493){return{'model':db[_0x8f8493['model']],'as':_0x8f8493['as'],'attributes':_0x8f8493[_0x8cd8('0x1c')],'include':_0x8f8493[_0x8cd8('0x1d')]?_[_0x8cd8('0x1e')](_0x8f8493[_0x8cd8('0x1d')],function(_0x595215){return{'model':db[_0x595215['model']],'as':_0x595215['as'],'attributes':_0x595215['attributes'],'include':_0x595215['include']?_[_0x8cd8('0x1e')](_0x595215[_0x8cd8('0x1d')],function(_0xb72063){return{'model':db[_0xb72063[_0x8cd8('0x1f')]],'as':_0xb72063['as'],'attributes':_0xb72063['attributes']};}):[]};}):[]};}):[]:[]})[_0x8cd8('0xc')](function(_0x392df2){logger[_0x8cd8('0xd')](_0x8cd8('0x18'),_0x5f21bd);logger[_0x8cd8('0x10')](_0x8cd8('0x18'),_0x5f21bd,JSON[_0x8cd8('0x12')](_0x392df2));_0x3a6f0b(_0x392df2);})['catch'](function(_0x9316f2){logger[_0x8cd8('0x13')](_0x8cd8('0x18'),_0x9316f2[_0x8cd8('0x15')],_0x5f21bd);_0xc1669b(_0xf8d554[_0x8cd8('0x13')](0x1f4,_0x9316f2[_0x8cd8('0x15')]));});});};exports[_0x8cd8('0x20')]=function(_0x585636){var _0x960c13=this;return new Promise(function(_0x82a08,_0x5aa80d){return db['ServicenowAccount'][_0x8cd8('0x21')]({'raw':_0x585636[_0x8cd8('0x1a')]?_0x585636['options'][_0x8cd8('0x22')]===undefined?!![]:![]:!![],'where':_0x585636[_0x8cd8('0x1a')]?_0x585636[_0x8cd8('0x1a')]['where']||null:null,'attributes':_0x585636[_0x8cd8('0x1a')]?_0x585636[_0x8cd8('0x1a')][_0x8cd8('0x1c')]||null:null,'include':_0x585636[_0x8cd8('0x1a')]?_0x585636[_0x8cd8('0x1a')][_0x8cd8('0x1d')]?_[_0x8cd8('0x1e')](_0x585636[_0x8cd8('0x1a')][_0x8cd8('0x1d')],function(_0x40cdd7){return{'model':db[_0x40cdd7['model']],'as':_0x40cdd7['as'],'attributes':_0x40cdd7['attributes'],'include':_0x40cdd7[_0x8cd8('0x1d')]?_[_0x8cd8('0x1e')](_0x40cdd7[_0x8cd8('0x1d')],function(_0x5686fe){return{'model':db[_0x5686fe[_0x8cd8('0x1f')]],'as':_0x5686fe['as'],'attributes':_0x5686fe[_0x8cd8('0x1c')],'include':_0x5686fe['include']?_[_0x8cd8('0x1e')](_0x5686fe[_0x8cd8('0x1d')],function(_0x2a8e81){return{'model':db[_0x2a8e81[_0x8cd8('0x1f')]],'as':_0x2a8e81['as'],'attributes':_0x2a8e81[_0x8cd8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8cd8('0xc')](function(_0x4172ac){logger['info'](_0x8cd8('0x20'),_0x585636);logger[_0x8cd8('0x10')](_0x8cd8('0x20'),_0x585636,JSON[_0x8cd8('0x12')](_0x4172ac));_0x82a08(_0x4172ac);})['catch'](function(_0xd7de21){logger['error'](_0x8cd8('0x20'),_0xd7de21[_0x8cd8('0x15')],_0x585636);_0x5aa80d(_0x960c13[_0x8cd8('0x13')](0x1f4,_0xd7de21[_0x8cd8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 251836b..8e001de 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 _0x6932=['./intServicenowConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a39f0,_0x370d38){var _0x2a78ef=function(_0x911d04){while(--_0x911d04){_0x3a39f0['push'](_0x3a39f0['shift']());}};_0x2a78ef(++_0x370d38);}(_0x6932,0xd4));var _0x2693=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6932[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x2693('0x0'));var util=require(_0x2693('0x1'));var path=require(_0x2693('0x2'));var timeout=require(_0x2693('0x3'));var express=require('express');var router=express[_0x2693('0x4')]();var fs_extra=require(_0x2693('0x5'));var auth=require(_0x2693('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2693('0x7'));var controller=require(_0x2693('0x8'));router['get']('/',auth[_0x2693('0x9')](),controller['index']);router['get'](_0x2693('0xa'),auth[_0x2693('0x9')](),controller[_0x2693('0xb')]);router[_0x2693('0xc')](_0x2693('0xd'),auth[_0x2693('0x9')](),controller[_0x2693('0xe')]);router[_0x2693('0xc')](_0x2693('0xf'),auth[_0x2693('0x9')](),controller[_0x2693('0x10')]);router[_0x2693('0xc')](_0x2693('0x11'),auth[_0x2693('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x2693('0x9')](),controller[_0x2693('0x12')]);router['put'](_0x2693('0xa'),auth[_0x2693('0x9')](),controller[_0x2693('0x13')]);router[_0x2693('0x14')](_0x2693('0xa'),auth[_0x2693('0x9')](),controller['destroy']);module[_0x2693('0x15')]=router; \ No newline at end of file +var _0xcd5c=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd5c,0xca));var _0xccd5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcd5c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xccd5('0x0'));var util=require(_0xccd5('0x1'));var path=require(_0xccd5('0x2'));var timeout=require(_0xccd5('0x3'));var express=require(_0xccd5('0x4'));var router=express[_0xccd5('0x5')]();var fs_extra=require(_0xccd5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xccd5('0x7'));var controller=require(_0xccd5('0x8'));router[_0xccd5('0x9')]('/',auth[_0xccd5('0xa')](),controller[_0xccd5('0xb')]);router['get']('/:id',auth[_0xccd5('0xa')](),controller[_0xccd5('0xc')]);router[_0xccd5('0x9')](_0xccd5('0xd'),auth['isAuthenticated'](),controller[_0xccd5('0xe')]);router[_0xccd5('0x9')](_0xccd5('0xf'),auth[_0xccd5('0xa')](),controller['getSubjects']);router[_0xccd5('0x9')]('/:id/descriptions',auth[_0xccd5('0xa')](),controller[_0xccd5('0x10')]);router['post']('/',auth[_0xccd5('0xa')](),controller['create']);router[_0xccd5('0x11')](_0xccd5('0x12'),auth['isAuthenticated'](),controller[_0xccd5('0x13')]);router['delete'](_0xccd5('0x12'),auth['isAuthenticated'](),controller[_0xccd5('0x14')]);module[_0xccd5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4f63eaa..fdb8bab 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 _0xbf44=['exports','STRING','sequelize'];(function(_0x5750c0,_0x36b16f){var _0x21caef=function(_0x8a4abb){while(--_0x8a4abb){_0x5750c0['push'](_0x5750c0['shift']());}};_0x21caef(++_0x36b16f);}(_0xbf44,0x107));var _0x4bf4=function(_0x41d40b,_0x415ea0){_0x41d40b=_0x41d40b-0x0;var _0x13b700=_0xbf44[_0x41d40b];return _0x13b700;};'use strict';var Sequelize=require(_0x4bf4('0x0'));module[_0x4bf4('0x1')]={'name':{'type':Sequelize[_0x4bf4('0x2')]},'description':{'type':Sequelize[_0x4bf4('0x2')]}}; \ No newline at end of file +var _0x6183=['exports','sequelize'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x6183,0xaf));var _0x3618=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x6183[_0x52c4e9];return _0x252a03;};'use strict';var Sequelize=require(_0x3618('0x0'));module[_0x3618('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ba6d4fe..5d19344 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 _0x7983=['../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','attributes','fields','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','ServicenowConfiguration','include','show','params','keys','intersection','length','includeAll','find','catch','create','body','getFields','findOne','ServicenowField','getSubjects','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x38b8ba,_0x38a336){var _0x5316be=function(_0x404a7c){while(--_0x404a7c){_0x38b8ba['push'](_0x38b8ba['shift']());}};_0x5316be(++_0x38a336);}(_0x7983,0xd0));var _0x3798=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7983[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3798('0x0'));var zipdir=require(_0x3798('0x1'));var jsonpatch=require(_0x3798('0x2'));var rp=require(_0x3798('0x3'));var moment=require(_0x3798('0x4'));var BPromise=require(_0x3798('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3798('0x6'));var csv=require('to-csv');var ejs=require(_0x3798('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3798('0x8'));var squel=require(_0x3798('0x9'));var crypto=require(_0x3798('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3798('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3798('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3798('0xd'));var as=require(_0x3798('0xe'));var hardwareService=require(_0x3798('0xf'));var logger=require(_0x3798('0x10'))('api');var utils=require(_0x3798('0x11'));var config=require(_0x3798('0x12'));var licenseUtil=require(_0x3798('0x13'));var db=require(_0x3798('0x14'))['db'];function respondWithStatusCode(_0x4414a0,_0x529071){_0x529071=_0x529071||0xcc;return function(_0x5f1516){if(_0x5f1516){return _0x4414a0[_0x3798('0x15')](_0x529071);}return _0x4414a0['status'](_0x529071)[_0x3798('0x16')]();};}function respondWithResult(_0x1b6578,_0x23ebf9){_0x23ebf9=_0x23ebf9||0xc8;return function(_0x198f6f){if(_0x198f6f){return _0x1b6578[_0x3798('0x17')](_0x23ebf9)[_0x3798('0x18')](_0x198f6f);}};}function respondWithFilteredResult(_0xafad6d,_0x866584){return function(_0x2a1849){if(_0x2a1849){var _0x2fc5dd=typeof _0x866584[_0x3798('0x19')]==='undefined'&&typeof _0x866584[_0x3798('0x1a')]===_0x3798('0x1b');var _0x157c06=_0x2a1849[_0x3798('0x1c')];var _0x3bf7a0=_0x2fc5dd?0x0:_0x866584['offset'];var _0x16684e=_0x2fc5dd?_0x2a1849[_0x3798('0x1c')]:_0x866584['offset']+_0x866584[_0x3798('0x1a')];var _0x104bda;if(_0x16684e>=_0x157c06){_0x16684e=_0x157c06;_0x104bda=0xc8;}else{_0x104bda=0xce;}_0xafad6d[_0x3798('0x17')](_0x104bda);return _0xafad6d[_0x3798('0x1d')](_0x3798('0x1e'),_0x3bf7a0+'-'+_0x16684e+'/'+_0x157c06)[_0x3798('0x18')](_0x2a1849);}return null;};}function patchUpdates(_0x4dbf60){return function(_0x486a19){try{jsonpatch[_0x3798('0x1f')](_0x486a19,_0x4dbf60,!![]);}catch(_0xc556b7){return BPromise[_0x3798('0x20')](_0xc556b7);}return _0x486a19['save']();};}function saveUpdates(_0x174c0d,_0x3def9b){return function(_0x1675b6){if(_0x1675b6){return _0x1675b6[_0x3798('0x21')](_0x174c0d)[_0x3798('0x22')](function(_0xcad056){return _0xcad056;});}return null;};}function removeEntity(_0x4ec188,_0x531a59){return function(_0x946a26){if(_0x946a26){return _0x946a26[_0x3798('0x23')]()[_0x3798('0x22')](function(){_0x4ec188[_0x3798('0x17')](0xcc)[_0x3798('0x16')]();});}};}function handleEntityNotFound(_0x38de06,_0x43daa9){return function(_0x461bd9){if(!_0x461bd9){_0x38de06[_0x3798('0x15')](0x194);}return _0x461bd9;};}function handleError(_0x1c9641,_0x592f04){_0x592f04=_0x592f04||0x1f4;return function(_0x5bf81b){logger[_0x3798('0x24')](_0x5bf81b[_0x3798('0x25')]);if(_0x5bf81b[_0x3798('0x26')]){delete _0x5bf81b[_0x3798('0x26')];}_0x1c9641[_0x3798('0x17')](_0x592f04)[_0x3798('0x27')](_0x5bf81b);};}exports[_0x3798('0x28')]=function(_0x484365,_0x50abd9){var _0x581ad1={},_0x20f633={},_0x1e57b0={'count':0x0,'rows':[]};var _0x4b7115=_[_0x3798('0x29')](db['ServicenowConfiguration'][_0x3798('0x2a')],function(_0x2b789a){return{'name':_0x2b789a['fieldName'],'type':_0x2b789a['type'][_0x3798('0x2b')]};});_0x20f633[_0x3798('0x2c')]=_[_0x3798('0x29')](_0x4b7115,'name');_0x20f633[_0x3798('0x2d')]=_['keys'](_0x484365[_0x3798('0x2d')]);_0x20f633['filters']=_['intersection'](_0x20f633[_0x3798('0x2c')],_0x20f633['query']);_0x581ad1[_0x3798('0x2e')]=_['intersection'](_0x20f633['model'],qs[_0x3798('0x2f')](_0x484365[_0x3798('0x2d')][_0x3798('0x2f')]));_0x581ad1['attributes']=_0x581ad1[_0x3798('0x2e')]['length']?_0x581ad1[_0x3798('0x2e')]:_0x20f633[_0x3798('0x2c')];if(!_0x484365['query']['hasOwnProperty'](_0x3798('0x30'))){_0x581ad1[_0x3798('0x1a')]=qs['limit'](_0x484365['query']['limit']);_0x581ad1[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x484365['query'][_0x3798('0x19')]);}_0x581ad1[_0x3798('0x31')]=qs['sort'](_0x484365['query'][_0x3798('0x32')]);_0x581ad1['where']=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x484365[_0x3798('0x2d')],_0x20f633[_0x3798('0x33')]),_0x4b7115);if(_0x484365[_0x3798('0x2d')]['filter']){_0x581ad1[_0x3798('0x35')]=_[_0x3798('0x36')](_0x581ad1['where'],{'$or':_[_0x3798('0x29')](_0x4b7115,function(_0x37dba4){if(_0x37dba4[_0x3798('0x37')]!==_0x3798('0x38')){var _0x50786d={};_0x50786d[_0x37dba4['name']]={'$like':'%'+_0x484365[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x50786d;}})});}_0x581ad1=_[_0x3798('0x36')]({},_0x581ad1,_0x484365[_0x3798('0x3a')]);var _0x326289={'where':_0x581ad1['where']};return db[_0x3798('0x3b')][_0x3798('0x1c')](_0x326289)[_0x3798('0x22')](function(_0x28847c){_0x1e57b0[_0x3798('0x1c')]=_0x28847c;if(_0x484365[_0x3798('0x2d')]['includeAll']){_0x581ad1[_0x3798('0x3c')]=[{'all':!![]}];}return db[_0x3798('0x3b')]['findAll'](_0x581ad1);})['then'](function(_0x355437){_0x1e57b0['rows']=_0x355437;return _0x1e57b0;})['then'](respondWithFilteredResult(_0x50abd9,_0x581ad1))['catch'](handleError(_0x50abd9,null));};exports[_0x3798('0x3d')]=function(_0x1b0965,_0x5935a3){var _0x31cb4e={'raw':![],'where':{'id':_0x1b0965[_0x3798('0x3e')]['id']}},_0x505d71={};_0x505d71[_0x3798('0x2c')]=_[_0x3798('0x3f')](db['ServicenowConfiguration'][_0x3798('0x2a')]);_0x505d71[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x1b0965[_0x3798('0x2d')]);_0x505d71['filters']=_[_0x3798('0x40')](_0x505d71['model'],_0x505d71['query']);_0x31cb4e['attributes']=_[_0x3798('0x40')](_0x505d71[_0x3798('0x2c')],qs['fields'](_0x1b0965[_0x3798('0x2d')][_0x3798('0x2f')]));_0x31cb4e[_0x3798('0x2e')]=_0x31cb4e[_0x3798('0x2e')][_0x3798('0x41')]?_0x31cb4e[_0x3798('0x2e')]:_0x505d71[_0x3798('0x2c')];if(_0x1b0965[_0x3798('0x2d')][_0x3798('0x42')]){_0x31cb4e['include']=[{'all':!![]}];}_0x31cb4e=_[_0x3798('0x36')]({},_0x31cb4e,_0x1b0965[_0x3798('0x3a')]);return db[_0x3798('0x3b')][_0x3798('0x43')](_0x31cb4e)['then'](handleEntityNotFound(_0x5935a3,null))[_0x3798('0x22')](respondWithResult(_0x5935a3,null))[_0x3798('0x44')](handleError(_0x5935a3,null));};exports[_0x3798('0x45')]=function(_0x25813e,_0x481ac9){return db[_0x3798('0x3b')][_0x3798('0x45')](_0x25813e[_0x3798('0x46')],{})[_0x3798('0x22')](respondWithResult(_0x481ac9,0xc9))[_0x3798('0x44')](handleError(_0x481ac9,null));};exports[_0x3798('0x21')]=function(_0x5aa9b6,_0x48e3e5){if(_0x5aa9b6['body']['id']){delete _0x5aa9b6[_0x3798('0x46')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x5aa9b6['params']['id']}})['then'](handleEntityNotFound(_0x48e3e5,null))['then'](saveUpdates(_0x5aa9b6[_0x3798('0x46')],null))[_0x3798('0x22')](respondWithResult(_0x48e3e5,null))[_0x3798('0x44')](handleError(_0x48e3e5,null));};exports[_0x3798('0x23')]=function(_0x524424,_0x16de99){return db[_0x3798('0x3b')][_0x3798('0x43')]({'where':{'id':_0x524424[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x16de99,null))[_0x3798('0x22')](removeEntity(_0x16de99,null))[_0x3798('0x44')](handleError(_0x16de99,null));};exports[_0x3798('0x47')]=function(_0x3b9664,_0x5c0808,_0x2150e5){var _0x24b991={};var _0x4f1201={};var _0x26db72;var _0x5b1b13;return db['ServicenowConfiguration'][_0x3798('0x48')]({'where':{'id':_0x3b9664[_0x3798('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5c0808,null))[_0x3798('0x22')](function(_0x41b8b3){if(_0x41b8b3){_0x26db72=_0x41b8b3;_0x4f1201[_0x3798('0x2c')]=_['keys'](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x4f1201[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x3b9664[_0x3798('0x2d')]);_0x4f1201['filters']=_['intersection'](_0x4f1201[_0x3798('0x2c')],_0x4f1201['query']);_0x24b991['attributes']=_['intersection'](_0x4f1201[_0x3798('0x2c')],qs[_0x3798('0x2f')](_0x3b9664['query'][_0x3798('0x2f')]));_0x24b991[_0x3798('0x2e')]=_0x24b991[_0x3798('0x2e')][_0x3798('0x41')]?_0x24b991['attributes']:_0x4f1201['model'];_0x24b991[_0x3798('0x31')]=qs['sort'](_0x3b9664[_0x3798('0x2d')][_0x3798('0x32')]);_0x24b991[_0x3798('0x35')]=qs['filters'](_['pick'](_0x3b9664[_0x3798('0x2d')],_0x4f1201[_0x3798('0x33')]));if(_0x3b9664[_0x3798('0x2d')][_0x3798('0x39')]){_0x24b991[_0x3798('0x35')]=_[_0x3798('0x36')](_0x24b991[_0x3798('0x35')],{'$or':_[_0x3798('0x29')](_0x24b991[_0x3798('0x2e')],function(_0x290bed){var _0x2087eb={};_0x2087eb[_0x290bed]={'$like':'%'+_0x3b9664[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x2087eb;})});}_0x24b991=_[_0x3798('0x36')]({},_0x24b991,_0x3b9664[_0x3798('0x3a')]);return _0x26db72[_0x3798('0x47')](_0x24b991);}})[_0x3798('0x22')](function(_0x5dea39){if(_0x5dea39){_0x5b1b13=_0x5dea39[_0x3798('0x41')];if(!_0x3b9664[_0x3798('0x2d')]['hasOwnProperty'](_0x3798('0x30'))){_0x24b991[_0x3798('0x1a')]=qs[_0x3798('0x1a')](_0x3b9664[_0x3798('0x2d')]['limit']);_0x24b991[_0x3798('0x19')]=qs['offset'](_0x3b9664['query'][_0x3798('0x19')]);}return _0x26db72[_0x3798('0x47')](_0x24b991);}})[_0x3798('0x22')](function(_0xba7d61){if(_0xba7d61){return _0xba7d61?{'count':_0x5b1b13,'rows':_0xba7d61}:null;}})[_0x3798('0x22')](respondWithResult(_0x5c0808,null))['catch'](handleError(_0x5c0808,null));};exports[_0x3798('0x4a')]=function(_0x596f42,_0x2a048a,_0x29ddb6){var _0x232fc0={};var _0x39c39f={};var _0x2304b6;var _0x1bf92a;return db[_0x3798('0x3b')][_0x3798('0x48')]({'where':{'id':_0x596f42[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x2a048a,null))['then'](function(_0x307305){if(_0x307305){_0x2304b6=_0x307305;_0x39c39f[_0x3798('0x2c')]=_[_0x3798('0x3f')](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x39c39f[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x596f42[_0x3798('0x2d')]);_0x39c39f[_0x3798('0x33')]=_[_0x3798('0x40')](_0x39c39f[_0x3798('0x2c')],_0x39c39f[_0x3798('0x2d')]);_0x232fc0[_0x3798('0x2e')]=_['intersection'](_0x39c39f['model'],qs['fields'](_0x596f42['query'][_0x3798('0x2f')]));_0x232fc0[_0x3798('0x2e')]=_0x232fc0[_0x3798('0x2e')][_0x3798('0x41')]?_0x232fc0['attributes']:_0x39c39f[_0x3798('0x2c')];_0x232fc0[_0x3798('0x31')]=qs[_0x3798('0x32')](_0x596f42['query'][_0x3798('0x32')]);_0x232fc0[_0x3798('0x35')]=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x596f42[_0x3798('0x2d')],_0x39c39f[_0x3798('0x33')]));if(_0x596f42[_0x3798('0x2d')][_0x3798('0x39')]){_0x232fc0[_0x3798('0x35')]=_['merge'](_0x232fc0[_0x3798('0x35')],{'$or':_[_0x3798('0x29')](_0x232fc0[_0x3798('0x2e')],function(_0x905b4d){var _0x133f21={};_0x133f21[_0x905b4d]={'$like':'%'+_0x596f42[_0x3798('0x2d')]['filter']+'%'};return _0x133f21;})});}_0x232fc0=_[_0x3798('0x36')]({},_0x232fc0,_0x596f42[_0x3798('0x3a')]);return _0x2304b6[_0x3798('0x4a')](_0x232fc0);}})[_0x3798('0x22')](function(_0x2a07e9){if(_0x2a07e9){_0x1bf92a=_0x2a07e9['length'];if(!_0x596f42[_0x3798('0x2d')][_0x3798('0x4b')](_0x3798('0x30'))){_0x232fc0[_0x3798('0x1a')]=qs[_0x3798('0x1a')](_0x596f42[_0x3798('0x2d')]['limit']);_0x232fc0[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x596f42[_0x3798('0x2d')][_0x3798('0x19')]);}return _0x2304b6[_0x3798('0x4a')](_0x232fc0);}})['then'](function(_0x1d343f){if(_0x1d343f){return _0x1d343f?{'count':_0x1bf92a,'rows':_0x1d343f}:null;}})[_0x3798('0x22')](respondWithResult(_0x2a048a,null))['catch'](handleError(_0x2a048a,null));};exports['getDescriptions']=function(_0x3fa104,_0x16c06b,_0x2d35ed){var _0x1d400c={};var _0x4905df={};var _0x474d31;var _0x39eaab;return db[_0x3798('0x3b')]['findOne']({'where':{'id':_0x3fa104[_0x3798('0x3e')]['id']}})[_0x3798('0x22')](handleEntityNotFound(_0x16c06b,null))[_0x3798('0x22')](function(_0x41ab63){if(_0x41ab63){_0x474d31=_0x41ab63;_0x4905df[_0x3798('0x2c')]=_[_0x3798('0x3f')](db[_0x3798('0x49')][_0x3798('0x2a')]);_0x4905df[_0x3798('0x2d')]=_[_0x3798('0x3f')](_0x3fa104[_0x3798('0x2d')]);_0x4905df[_0x3798('0x33')]=_['intersection'](_0x4905df['model'],_0x4905df['query']);_0x1d400c[_0x3798('0x2e')]=_[_0x3798('0x40')](_0x4905df[_0x3798('0x2c')],qs[_0x3798('0x2f')](_0x3fa104['query'][_0x3798('0x2f')]));_0x1d400c[_0x3798('0x2e')]=_0x1d400c[_0x3798('0x2e')][_0x3798('0x41')]?_0x1d400c[_0x3798('0x2e')]:_0x4905df[_0x3798('0x2c')];_0x1d400c['order']=qs[_0x3798('0x32')](_0x3fa104[_0x3798('0x2d')][_0x3798('0x32')]);_0x1d400c[_0x3798('0x35')]=qs[_0x3798('0x33')](_[_0x3798('0x34')](_0x3fa104[_0x3798('0x2d')],_0x4905df[_0x3798('0x33')]));if(_0x3fa104[_0x3798('0x2d')]['filter']){_0x1d400c['where']=_[_0x3798('0x36')](_0x1d400c[_0x3798('0x35')],{'$or':_['map'](_0x1d400c['attributes'],function(_0x48fdf4){var _0x59b508={};_0x59b508[_0x48fdf4]={'$like':'%'+_0x3fa104[_0x3798('0x2d')][_0x3798('0x39')]+'%'};return _0x59b508;})});}_0x1d400c=_[_0x3798('0x36')]({},_0x1d400c,_0x3fa104[_0x3798('0x3a')]);return _0x474d31['getDescriptions'](_0x1d400c);}})[_0x3798('0x22')](function(_0x42ed69){if(_0x42ed69){_0x39eaab=_0x42ed69[_0x3798('0x41')];if(!_0x3fa104[_0x3798('0x2d')][_0x3798('0x4b')](_0x3798('0x30'))){_0x1d400c[_0x3798('0x1a')]=qs['limit'](_0x3fa104[_0x3798('0x2d')][_0x3798('0x1a')]);_0x1d400c[_0x3798('0x19')]=qs[_0x3798('0x19')](_0x3fa104['query'][_0x3798('0x19')]);}return _0x474d31['getDescriptions'](_0x1d400c);}})['then'](function(_0x2add77){if(_0x2add77){return _0x2add77?{'count':_0x39eaab,'rows':_0x2add77}:null;}})[_0x3798('0x22')](respondWithResult(_0x16c06b,null))[_0x3798('0x44')](handleError(_0x16c06b,null));}; \ No newline at end of file +var _0xe7d2=['then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','ServicenowField','pick','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','Content-Range','update'];(function(_0x25fdf4,_0x48165d){var _0x19cbf5=function(_0x1b88ec){while(--_0x1b88ec){_0x25fdf4['push'](_0x25fdf4['shift']());}};_0x19cbf5(++_0x48165d);}(_0xe7d2,0x108));var _0x2e7d=function(_0x3542a3,_0x390011){_0x3542a3=_0x3542a3-0x0;var _0xf9eac6=_0xe7d2[_0x3542a3];return _0xf9eac6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e7d('0x0'));var zipdir=require(_0x2e7d('0x1'));var jsonpatch=require(_0x2e7d('0x2'));var rp=require(_0x2e7d('0x3'));var moment=require(_0x2e7d('0x4'));var BPromise=require(_0x2e7d('0x5'));var Mustache=require('mustache');var util=require(_0x2e7d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2e7d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e7d('0x8'));var _=require(_0x2e7d('0x9'));var squel=require('squel');var crypto=require(_0x2e7d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e7d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e7d('0xc'));var Redis=require(_0x2e7d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2e7d('0xe'));var as=require(_0x2e7d('0xf'));var hardwareService=require(_0x2e7d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2e7d('0x11'));var config=require(_0x2e7d('0x12'));var licenseUtil=require(_0x2e7d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b901e,_0x86bad4){_0x86bad4=_0x86bad4||0xcc;return function(_0x5311e8){if(_0x5311e8){return _0x5b901e['sendStatus'](_0x86bad4);}return _0x5b901e[_0x2e7d('0x14')](_0x86bad4)['end']();};}function respondWithResult(_0x3d656d,_0x31ca1a){_0x31ca1a=_0x31ca1a||0xc8;return function(_0x2b1f52){if(_0x2b1f52){return _0x3d656d[_0x2e7d('0x14')](_0x31ca1a)[_0x2e7d('0x15')](_0x2b1f52);}};}function respondWithFilteredResult(_0x3b86a6,_0x319218){return function(_0x46f820){if(_0x46f820){var _0x3f797d=typeof _0x319218[_0x2e7d('0x16')]==='undefined'&&typeof _0x319218[_0x2e7d('0x17')]===_0x2e7d('0x18');var _0x3c4240=_0x46f820[_0x2e7d('0x19')];var _0x3950e1=_0x3f797d?0x0:_0x319218[_0x2e7d('0x16')];var _0x1eb664=_0x3f797d?_0x46f820['count']:_0x319218[_0x2e7d('0x16')]+_0x319218[_0x2e7d('0x17')];var _0x5cfe89;if(_0x1eb664>=_0x3c4240){_0x1eb664=_0x3c4240;_0x5cfe89=0xc8;}else{_0x5cfe89=0xce;}_0x3b86a6[_0x2e7d('0x14')](_0x5cfe89);return _0x3b86a6['set'](_0x2e7d('0x1a'),_0x3950e1+'-'+_0x1eb664+'/'+_0x3c4240)[_0x2e7d('0x15')](_0x46f820);}return null;};}function patchUpdates(_0x76cfcd){return function(_0x563797){try{jsonpatch['apply'](_0x563797,_0x76cfcd,!![]);}catch(_0x495ea1){return BPromise['reject'](_0x495ea1);}return _0x563797['save']();};}function saveUpdates(_0x38557f,_0x2e2cb9){return function(_0x93c179){if(_0x93c179){return _0x93c179[_0x2e7d('0x1b')](_0x38557f)[_0x2e7d('0x1c')](function(_0x199647){return _0x199647;});}return null;};}function removeEntity(_0x3cc071,_0x215eda){return function(_0x3f5ff3){if(_0x3f5ff3){return _0x3f5ff3[_0x2e7d('0x1d')]()[_0x2e7d('0x1c')](function(){_0x3cc071['status'](0xcc)[_0x2e7d('0x1e')]();});}};}function handleEntityNotFound(_0x348601,_0x1b0310){return function(_0x44c096){if(!_0x44c096){_0x348601['sendStatus'](0x194);}return _0x44c096;};}function handleError(_0x5b33d1,_0x1d2405){_0x1d2405=_0x1d2405||0x1f4;return function(_0xc99cf9){logger['error'](_0xc99cf9[_0x2e7d('0x1f')]);if(_0xc99cf9[_0x2e7d('0x20')]){delete _0xc99cf9[_0x2e7d('0x20')];}_0x5b33d1[_0x2e7d('0x14')](_0x1d2405)[_0x2e7d('0x21')](_0xc99cf9);};}exports[_0x2e7d('0x22')]=function(_0x4cecf3,_0x45cc13){var _0x31d112={},_0x5c61cd={},_0xb75988={'count':0x0,'rows':[]};var _0x5b8054=_[_0x2e7d('0x23')](db[_0x2e7d('0x24')][_0x2e7d('0x25')],function(_0x377723){return{'name':_0x377723[_0x2e7d('0x26')],'type':_0x377723['type']['key']};});_0x5c61cd[_0x2e7d('0x27')]=_[_0x2e7d('0x23')](_0x5b8054,_0x2e7d('0x20'));_0x5c61cd[_0x2e7d('0x28')]=_[_0x2e7d('0x29')](_0x4cecf3[_0x2e7d('0x28')]);_0x5c61cd[_0x2e7d('0x2a')]=_[_0x2e7d('0x2b')](_0x5c61cd[_0x2e7d('0x27')],_0x5c61cd['query']);_0x31d112[_0x2e7d('0x2c')]=_['intersection'](_0x5c61cd[_0x2e7d('0x27')],qs[_0x2e7d('0x2d')](_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x2d')]));_0x31d112[_0x2e7d('0x2c')]=_0x31d112['attributes'][_0x2e7d('0x2e')]?_0x31d112['attributes']:_0x5c61cd[_0x2e7d('0x27')];if(!_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x2f')]('nolimit')){_0x31d112['limit']=qs[_0x2e7d('0x17')](_0x4cecf3[_0x2e7d('0x28')]['limit']);_0x31d112[_0x2e7d('0x16')]=qs[_0x2e7d('0x16')](_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x16')]);}_0x31d112[_0x2e7d('0x30')]=qs[_0x2e7d('0x31')](_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x31')]);_0x31d112[_0x2e7d('0x32')]=qs[_0x2e7d('0x2a')](_['pick'](_0x4cecf3[_0x2e7d('0x28')],_0x5c61cd[_0x2e7d('0x2a')]),_0x5b8054);if(_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x33')]){_0x31d112[_0x2e7d('0x32')]=_[_0x2e7d('0x34')](_0x31d112[_0x2e7d('0x32')],{'$or':_[_0x2e7d('0x23')](_0x5b8054,function(_0x3e58a3){if(_0x3e58a3[_0x2e7d('0x35')]!==_0x2e7d('0x36')){var _0xfaa173={};_0xfaa173[_0x3e58a3['name']]={'$like':'%'+_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x33')]+'%'};return _0xfaa173;}})});}_0x31d112=_[_0x2e7d('0x34')]({},_0x31d112,_0x4cecf3[_0x2e7d('0x37')]);var _0xad1b7d={'where':_0x31d112[_0x2e7d('0x32')]};return db[_0x2e7d('0x24')]['count'](_0xad1b7d)[_0x2e7d('0x1c')](function(_0x54133b){_0xb75988[_0x2e7d('0x19')]=_0x54133b;if(_0x4cecf3[_0x2e7d('0x28')][_0x2e7d('0x38')]){_0x31d112[_0x2e7d('0x39')]=[{'all':!![]}];}return db[_0x2e7d('0x24')][_0x2e7d('0x3a')](_0x31d112);})[_0x2e7d('0x1c')](function(_0x4590d4){_0xb75988[_0x2e7d('0x3b')]=_0x4590d4;return _0xb75988;})[_0x2e7d('0x1c')](respondWithFilteredResult(_0x45cc13,_0x31d112))[_0x2e7d('0x3c')](handleError(_0x45cc13,null));};exports[_0x2e7d('0x3d')]=function(_0x188269,_0x5503d3){var _0x829a48={'raw':![],'where':{'id':_0x188269[_0x2e7d('0x3e')]['id']}},_0xa940a0={};_0xa940a0[_0x2e7d('0x27')]=_[_0x2e7d('0x29')](db[_0x2e7d('0x24')][_0x2e7d('0x25')]);_0xa940a0[_0x2e7d('0x28')]=_[_0x2e7d('0x29')](_0x188269[_0x2e7d('0x28')]);_0xa940a0[_0x2e7d('0x2a')]=_[_0x2e7d('0x2b')](_0xa940a0[_0x2e7d('0x27')],_0xa940a0[_0x2e7d('0x28')]);_0x829a48['attributes']=_[_0x2e7d('0x2b')](_0xa940a0[_0x2e7d('0x27')],qs[_0x2e7d('0x2d')](_0x188269[_0x2e7d('0x28')][_0x2e7d('0x2d')]));_0x829a48['attributes']=_0x829a48['attributes'][_0x2e7d('0x2e')]?_0x829a48[_0x2e7d('0x2c')]:_0xa940a0['model'];if(_0x188269[_0x2e7d('0x28')]['includeAll']){_0x829a48[_0x2e7d('0x39')]=[{'all':!![]}];}_0x829a48=_[_0x2e7d('0x34')]({},_0x829a48,_0x188269[_0x2e7d('0x37')]);return db['ServicenowConfiguration']['find'](_0x829a48)[_0x2e7d('0x1c')](handleEntityNotFound(_0x5503d3,null))['then'](respondWithResult(_0x5503d3,null))['catch'](handleError(_0x5503d3,null));};exports[_0x2e7d('0x3f')]=function(_0x46e8f7,_0x267e1a){return db['ServicenowConfiguration'][_0x2e7d('0x3f')](_0x46e8f7[_0x2e7d('0x40')],{})[_0x2e7d('0x1c')](respondWithResult(_0x267e1a,0xc9))['catch'](handleError(_0x267e1a,null));};exports[_0x2e7d('0x1b')]=function(_0x72dd1e,_0x4f362f){if(_0x72dd1e[_0x2e7d('0x40')]['id']){delete _0x72dd1e[_0x2e7d('0x40')]['id'];}return db[_0x2e7d('0x24')]['find']({'where':{'id':_0x72dd1e[_0x2e7d('0x3e')]['id']}})[_0x2e7d('0x1c')](handleEntityNotFound(_0x4f362f,null))[_0x2e7d('0x1c')](saveUpdates(_0x72dd1e[_0x2e7d('0x40')],null))[_0x2e7d('0x1c')](respondWithResult(_0x4f362f,null))[_0x2e7d('0x3c')](handleError(_0x4f362f,null));};exports['destroy']=function(_0x5bde18,_0x4cd8c3){return db['ServicenowConfiguration'][_0x2e7d('0x41')]({'where':{'id':_0x5bde18[_0x2e7d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cd8c3,null))[_0x2e7d('0x1c')](removeEntity(_0x4cd8c3,null))[_0x2e7d('0x3c')](handleError(_0x4cd8c3,null));};exports[_0x2e7d('0x42')]=function(_0x32348f,_0x3340e3,_0x19d8d9){var _0x2d8964={};var _0x36f30d={};var _0xcec704;var _0x238f64;return db[_0x2e7d('0x24')]['findOne']({'where':{'id':_0x32348f[_0x2e7d('0x3e')]['id']}})[_0x2e7d('0x1c')](handleEntityNotFound(_0x3340e3,null))[_0x2e7d('0x1c')](function(_0x30c0e5){if(_0x30c0e5){_0xcec704=_0x30c0e5;_0x36f30d['model']=_[_0x2e7d('0x29')](db[_0x2e7d('0x43')]['rawAttributes']);_0x36f30d[_0x2e7d('0x28')]=_[_0x2e7d('0x29')](_0x32348f[_0x2e7d('0x28')]);_0x36f30d[_0x2e7d('0x2a')]=_[_0x2e7d('0x2b')](_0x36f30d[_0x2e7d('0x27')],_0x36f30d['query']);_0x2d8964[_0x2e7d('0x2c')]=_[_0x2e7d('0x2b')](_0x36f30d[_0x2e7d('0x27')],qs['fields'](_0x32348f['query']['fields']));_0x2d8964[_0x2e7d('0x2c')]=_0x2d8964[_0x2e7d('0x2c')][_0x2e7d('0x2e')]?_0x2d8964[_0x2e7d('0x2c')]:_0x36f30d['model'];_0x2d8964[_0x2e7d('0x30')]=qs[_0x2e7d('0x31')](_0x32348f['query']['sort']);_0x2d8964[_0x2e7d('0x32')]=qs[_0x2e7d('0x2a')](_[_0x2e7d('0x44')](_0x32348f[_0x2e7d('0x28')],_0x36f30d[_0x2e7d('0x2a')]));if(_0x32348f[_0x2e7d('0x28')][_0x2e7d('0x33')]){_0x2d8964[_0x2e7d('0x32')]=_['merge'](_0x2d8964[_0x2e7d('0x32')],{'$or':_[_0x2e7d('0x23')](_0x2d8964[_0x2e7d('0x2c')],function(_0x5aaf87){var _0x374035={};_0x374035[_0x5aaf87]={'$like':'%'+_0x32348f[_0x2e7d('0x28')]['filter']+'%'};return _0x374035;})});}_0x2d8964=_[_0x2e7d('0x34')]({},_0x2d8964,_0x32348f[_0x2e7d('0x37')]);return _0xcec704[_0x2e7d('0x42')](_0x2d8964);}})[_0x2e7d('0x1c')](function(_0x5d6fc1){if(_0x5d6fc1){_0x238f64=_0x5d6fc1[_0x2e7d('0x2e')];if(!_0x32348f[_0x2e7d('0x28')][_0x2e7d('0x2f')](_0x2e7d('0x45'))){_0x2d8964['limit']=qs['limit'](_0x32348f[_0x2e7d('0x28')][_0x2e7d('0x17')]);_0x2d8964[_0x2e7d('0x16')]=qs[_0x2e7d('0x16')](_0x32348f['query'][_0x2e7d('0x16')]);}return _0xcec704[_0x2e7d('0x42')](_0x2d8964);}})['then'](function(_0x5ea91d){if(_0x5ea91d){return _0x5ea91d?{'count':_0x238f64,'rows':_0x5ea91d}:null;}})[_0x2e7d('0x1c')](respondWithResult(_0x3340e3,null))[_0x2e7d('0x3c')](handleError(_0x3340e3,null));};exports[_0x2e7d('0x46')]=function(_0x4fe171,_0x135347,_0x5a626b){var _0x3f30d7={};var _0x2e6af9={};var _0x2ee3cb;var _0xf45bc6;return db[_0x2e7d('0x24')][_0x2e7d('0x47')]({'where':{'id':_0x4fe171[_0x2e7d('0x3e')]['id']}})[_0x2e7d('0x1c')](handleEntityNotFound(_0x135347,null))[_0x2e7d('0x1c')](function(_0x3d3761){if(_0x3d3761){_0x2ee3cb=_0x3d3761;_0x2e6af9[_0x2e7d('0x27')]=_[_0x2e7d('0x29')](db[_0x2e7d('0x43')]['rawAttributes']);_0x2e6af9['query']=_[_0x2e7d('0x29')](_0x4fe171[_0x2e7d('0x28')]);_0x2e6af9['filters']=_[_0x2e7d('0x2b')](_0x2e6af9[_0x2e7d('0x27')],_0x2e6af9[_0x2e7d('0x28')]);_0x3f30d7[_0x2e7d('0x2c')]=_[_0x2e7d('0x2b')](_0x2e6af9['model'],qs[_0x2e7d('0x2d')](_0x4fe171[_0x2e7d('0x28')]['fields']));_0x3f30d7[_0x2e7d('0x2c')]=_0x3f30d7[_0x2e7d('0x2c')]['length']?_0x3f30d7['attributes']:_0x2e6af9[_0x2e7d('0x27')];_0x3f30d7[_0x2e7d('0x30')]=qs[_0x2e7d('0x31')](_0x4fe171[_0x2e7d('0x28')]['sort']);_0x3f30d7[_0x2e7d('0x32')]=qs[_0x2e7d('0x2a')](_[_0x2e7d('0x44')](_0x4fe171['query'],_0x2e6af9['filters']));if(_0x4fe171['query'][_0x2e7d('0x33')]){_0x3f30d7[_0x2e7d('0x32')]=_[_0x2e7d('0x34')](_0x3f30d7[_0x2e7d('0x32')],{'$or':_['map'](_0x3f30d7['attributes'],function(_0x146acc){var _0x45c6c1={};_0x45c6c1[_0x146acc]={'$like':'%'+_0x4fe171[_0x2e7d('0x28')][_0x2e7d('0x33')]+'%'};return _0x45c6c1;})});}_0x3f30d7=_[_0x2e7d('0x34')]({},_0x3f30d7,_0x4fe171[_0x2e7d('0x37')]);return _0x2ee3cb['getSubjects'](_0x3f30d7);}})['then'](function(_0x322178){if(_0x322178){_0xf45bc6=_0x322178[_0x2e7d('0x2e')];if(!_0x4fe171['query'][_0x2e7d('0x2f')](_0x2e7d('0x45'))){_0x3f30d7[_0x2e7d('0x17')]=qs[_0x2e7d('0x17')](_0x4fe171['query'][_0x2e7d('0x17')]);_0x3f30d7['offset']=qs[_0x2e7d('0x16')](_0x4fe171[_0x2e7d('0x28')]['offset']);}return _0x2ee3cb[_0x2e7d('0x46')](_0x3f30d7);}})[_0x2e7d('0x1c')](function(_0x3ccb65){if(_0x3ccb65){return _0x3ccb65?{'count':_0xf45bc6,'rows':_0x3ccb65}:null;}})[_0x2e7d('0x1c')](respondWithResult(_0x135347,null))[_0x2e7d('0x3c')](handleError(_0x135347,null));};exports[_0x2e7d('0x48')]=function(_0x52f656,_0x2f5d75,_0x37f0c9){var _0x4ee7de={};var _0x579f05={};var _0x834542;var _0x1427e4;return db[_0x2e7d('0x24')][_0x2e7d('0x47')]({'where':{'id':_0x52f656[_0x2e7d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2f5d75,null))[_0x2e7d('0x1c')](function(_0x345d80){if(_0x345d80){_0x834542=_0x345d80;_0x579f05['model']=_[_0x2e7d('0x29')](db[_0x2e7d('0x43')][_0x2e7d('0x25')]);_0x579f05['query']=_[_0x2e7d('0x29')](_0x52f656[_0x2e7d('0x28')]);_0x579f05[_0x2e7d('0x2a')]=_[_0x2e7d('0x2b')](_0x579f05[_0x2e7d('0x27')],_0x579f05[_0x2e7d('0x28')]);_0x4ee7de['attributes']=_[_0x2e7d('0x2b')](_0x579f05[_0x2e7d('0x27')],qs[_0x2e7d('0x2d')](_0x52f656['query']['fields']));_0x4ee7de[_0x2e7d('0x2c')]=_0x4ee7de[_0x2e7d('0x2c')][_0x2e7d('0x2e')]?_0x4ee7de['attributes']:_0x579f05[_0x2e7d('0x27')];_0x4ee7de['order']=qs[_0x2e7d('0x31')](_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x31')]);_0x4ee7de[_0x2e7d('0x32')]=qs[_0x2e7d('0x2a')](_['pick'](_0x52f656['query'],_0x579f05[_0x2e7d('0x2a')]));if(_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x33')]){_0x4ee7de[_0x2e7d('0x32')]=_[_0x2e7d('0x34')](_0x4ee7de[_0x2e7d('0x32')],{'$or':_[_0x2e7d('0x23')](_0x4ee7de[_0x2e7d('0x2c')],function(_0x54da06){var _0x943cc9={};_0x943cc9[_0x54da06]={'$like':'%'+_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x33')]+'%'};return _0x943cc9;})});}_0x4ee7de=_[_0x2e7d('0x34')]({},_0x4ee7de,_0x52f656[_0x2e7d('0x37')]);return _0x834542[_0x2e7d('0x48')](_0x4ee7de);}})['then'](function(_0x250620){if(_0x250620){_0x1427e4=_0x250620[_0x2e7d('0x2e')];if(!_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x2f')](_0x2e7d('0x45'))){_0x4ee7de[_0x2e7d('0x17')]=qs[_0x2e7d('0x17')](_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x17')]);_0x4ee7de['offset']=qs[_0x2e7d('0x16')](_0x52f656[_0x2e7d('0x28')][_0x2e7d('0x16')]);}return _0x834542[_0x2e7d('0x48')](_0x4ee7de);}})[_0x2e7d('0x1c')](function(_0x1bd643){if(_0x1bd643){return _0x1bd643?{'count':_0x1427e4,'rows':_0x1bd643}:null;}})[_0x2e7d('0x1c')](respondWithResult(_0x2f5d75,null))['catch'](handleError(_0x2f5d75,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3e38813..be8c066 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 _0xa7fa=['exports','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('ServicenowConfiguration',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20d8=['request-promise','path','rimraf','../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x20d8,0xee));var _0x820d=function(_0x3a25c2,_0x264dbf){_0x3a25c2=_0x3a25c2-0x0;var _0x381924=_0x20d8[_0x3a25c2];return _0x381924;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var logger=require(_0x820d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x820d('0x3'));var rp=require(_0x820d('0x4'));var fs=require('fs');var path=require(_0x820d('0x5'));var rimraf=require(_0x820d('0x6'));var config=require(_0x820d('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x820d('0x8')]=function(_0x160735,_0x3b801d){return _0x160735['define'](_0x820d('0x9'),attributes,{'tableName':_0x820d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 2d7d743..b68e9cc 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 _0x169c=['info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x1730ae,_0x1b3871){var _0x5de173=function(_0x2ce5ea){while(--_0x2ce5ea){_0x1730ae['push'](_0x1730ae['shift']());}};_0x5de173(++_0x1b3871);}(_0x169c,0xe3));var _0xc169=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x169c[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var moment=require(_0xc169('0x2'));var BPromise=require(_0xc169('0x3'));var rs=require(_0xc169('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc169('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc169('0x6'))(_0xc169('0x7'));var config=require(_0xc169('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc169('0x9')][_0xc169('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c5f45,_0x48d0b8,_0x11a4ee){return new BPromise(function(_0x19d93b,_0x4c1d7a){return client[_0xc169('0xb')](_0x2c5f45,_0x11a4ee)[_0xc169('0xc')](function(_0x1f8712){logger[_0xc169('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,_0xc169('0xe'));logger[_0xc169('0xf')](_0xc169('0x10'),_0x48d0b8,_0xc169('0xe'),JSON[_0xc169('0x11')](_0x1f8712));if(_0x1f8712[_0xc169('0x12')]){if(_0x1f8712[_0xc169('0x12')][_0xc169('0x13')]===0x1f4){logger[_0xc169('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,_0x1f8712['error'][_0xc169('0x14')]);return _0x4c1d7a(_0x1f8712[_0xc169('0x12')][_0xc169('0x14')]);}logger['error'](_0xc169('0x15'),_0x48d0b8,_0x1f8712[_0xc169('0x12')][_0xc169('0x14')]);return _0x19d93b(_0x1f8712[_0xc169('0x12')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x48d0b8,'request\x20sent');_0x19d93b(_0x1f8712[_0xc169('0x16')][_0xc169('0x14')]);}})[_0xc169('0x17')](function(_0x2fe7c4){logger['error'](_0xc169('0x15'),_0x48d0b8,_0x2fe7c4);_0x4c1d7a(_0x2fe7c4);});});} \ No newline at end of file +var _0x6e66=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6e66,0x9d));var _0x66e6=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x6e66[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0x66e6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x66e6('0x1'));var rs=require(_0x66e6('0x2'));var fs=require('fs');var Redis=require(_0x66e6('0x3'));var db=require(_0x66e6('0x4'))['db'];var utils=require(_0x66e6('0x5'));var logger=require(_0x66e6('0x6'))(_0x66e6('0x7'));var config=require(_0x66e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x66e6('0x9')][_0x66e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3094ba,_0x25a487,_0x491607){return new BPromise(function(_0x12b5eb,_0x7c5786){return client[_0x66e6('0xb')](_0x3094ba,_0x491607)[_0x66e6('0xc')](function(_0x4c6551){logger[_0x66e6('0xd')](_0x66e6('0xe'),_0x25a487,_0x66e6('0xf'));logger[_0x66e6('0x10')](_0x66e6('0x11'),_0x25a487,_0x66e6('0xf'),JSON[_0x66e6('0x12')](_0x4c6551));if(_0x4c6551[_0x66e6('0x13')]){if(_0x4c6551[_0x66e6('0x13')][_0x66e6('0x14')]===0x1f4){logger['error'](_0x66e6('0xe'),_0x25a487,_0x4c6551['error'][_0x66e6('0x15')]);return _0x7c5786(_0x4c6551[_0x66e6('0x13')][_0x66e6('0x15')]);}logger[_0x66e6('0x13')](_0x66e6('0xe'),_0x25a487,_0x4c6551['error'][_0x66e6('0x15')]);return _0x12b5eb(_0x4c6551['error'][_0x66e6('0x15')]);}else{logger[_0x66e6('0xd')](_0x66e6('0xe'),_0x25a487,_0x66e6('0xf'));_0x12b5eb(_0x4c6551[_0x66e6('0x16')][_0x66e6('0x15')]);}})[_0x66e6('0x17')](function(_0x2b93d0){logger[_0x66e6('0x13')](_0x66e6('0xe'),_0x25a487,_0x2b93d0);_0x7c5786(_0x2b93d0);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9f5b966..994127d 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 _0x5c87=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','update','delete'];(function(_0x504801,_0x483bd1){var _0x237d10=function(_0x57256a){while(--_0x57256a){_0x504801['push'](_0x504801['shift']());}};_0x237d10(++_0x483bd1);}(_0x5c87,0x1b7));var _0x75c8=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x5c87[_0x454165];return _0x56db53;};'use strict';var multer=require(_0x75c8('0x0'));var util=require('util');var path=require(_0x75c8('0x1'));var timeout=require(_0x75c8('0x2'));var express=require(_0x75c8('0x3'));var router=express[_0x75c8('0x4')]();var fs_extra=require(_0x75c8('0x5'));var auth=require(_0x75c8('0x6'));var interaction=require(_0x75c8('0x7'));var config=require(_0x75c8('0x8'));var controller=require(_0x75c8('0x9'));router['get']('/',auth[_0x75c8('0xa')](),controller[_0x75c8('0xb')]);router[_0x75c8('0xc')](_0x75c8('0xd'),auth[_0x75c8('0xa')](),controller[_0x75c8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x75c8('0xa')](),controller[_0x75c8('0xf')]);router[_0x75c8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x75c8('0x11')]);module[_0x75c8('0x12')]=router; \ No newline at end of file +var _0x6c92=['index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c92,0x80));var _0x26c9=function(_0x300c10,_0x3d416f){_0x300c10=_0x300c10-0x0;var _0x52aac4=_0x6c92[_0x300c10];return _0x52aac4;};'use strict';var multer=require(_0x26c9('0x0'));var util=require(_0x26c9('0x1'));var path=require(_0x26c9('0x2'));var timeout=require(_0x26c9('0x3'));var express=require(_0x26c9('0x4'));var router=express[_0x26c9('0x5')]();var fs_extra=require(_0x26c9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x26c9('0x7'));var config=require(_0x26c9('0x8'));var controller=require(_0x26c9('0x9'));router[_0x26c9('0xa')]('/',auth[_0x26c9('0xb')](),controller[_0x26c9('0xc')]);router[_0x26c9('0xa')](_0x26c9('0xd'),auth['isAuthenticated'](),controller[_0x26c9('0xe')]);router[_0x26c9('0xf')]('/',auth[_0x26c9('0xb')](),controller['create']);router[_0x26c9('0x10')](_0x26c9('0xd'),auth['isAuthenticated'](),controller[_0x26c9('0x11')]);router['delete'](_0x26c9('0xd'),auth[_0x26c9('0xb')](),controller[_0x26c9('0x12')]);module[_0x26c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 29c6dc4..eab5e9c 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 _0x5925=['sequelize','string','picklist','STRING','customVariable'];(function(_0x4e88de,_0xa524e6){var _0x1e8c31=function(_0x249b88){while(--_0x249b88){_0x4e88de['push'](_0x4e88de['shift']());}};_0x1e8c31(++_0xa524e6);}(_0x5925,0x140));var _0x5592=function(_0x348681,_0x486a1d){_0x348681=_0x348681-0x0;var _0x30d4b7=_0x5925[_0x348681];return _0x30d4b7;};'use strict';var Sequelize=require(_0x5592('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5592('0x1'),'variable','customVariable','keyValue',_0x5592('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5592('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5592('0x1'),'variable',_0x5592('0x4'))},'keyContent':{'type':Sequelize[_0x5592('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5592('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5592('0x3')]}}; \ No newline at end of file +var _0x18c3=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x38248d,_0x303488){var _0x170b73=function(_0x1c6d2a){while(--_0x1c6d2a){_0x38248d['push'](_0x38248d['shift']());}};_0x170b73(++_0x303488);}(_0x18c3,0x8f));var _0x318c=function(_0x138899,_0x448591){_0x138899=_0x138899-0x0;var _0xf271ac=_0x18c3[_0x138899];return _0xf271ac;};'use strict';var Sequelize=require(_0x318c('0x0'));module[_0x318c('0x1')]={'type':{'type':Sequelize[_0x318c('0x2')]('string',_0x318c('0x3'),'customVariable',_0x318c('0x4'),_0x318c('0x5')),'defaultValue':_0x318c('0x6')},'content':{'type':Sequelize[_0x318c('0x7')]},'key':{'type':Sequelize[_0x318c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x318c('0x6'),_0x318c('0x3'),_0x318c('0x8'))},'keyContent':{'type':Sequelize[_0x318c('0x7')]},'idField':{'type':Sequelize[_0x318c('0x7')]},'nameField':{'type':Sequelize[_0x318c('0x7')]},'customField':{'type':Sequelize[_0x318c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x318c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1cae438..73251ba 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 _0x9163=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','ServicenowField','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','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'];(function(_0x37470c,_0x4f7bab){var _0x1853f0=function(_0x2f078b){while(--_0x2f078b){_0x37470c['push'](_0x37470c['shift']());}};_0x1853f0(++_0x4f7bab);}(_0x9163,0xcd));var _0x3916=function(_0x2041f7,_0x49509d){_0x2041f7=_0x2041f7-0x0;var _0x3fbc1b=_0x9163[_0x2041f7];return _0x3fbc1b;};'use strict';var emlformat=require(_0x3916('0x0'));var rimraf=require(_0x3916('0x1'));var zipdir=require(_0x3916('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3916('0x3'));var util=require(_0x3916('0x4'));var path=require('path');var sox=require(_0x3916('0x5'));var csv=require(_0x3916('0x6'));var ejs=require(_0x3916('0x7'));var fs=require('fs');var fs_extra=require(_0x3916('0x8'));var _=require(_0x3916('0x9'));var squel=require(_0x3916('0xa'));var crypto=require(_0x3916('0xb'));var jsforce=require(_0x3916('0xc'));var deskjs=require(_0x3916('0xd'));var toCsv=require(_0x3916('0x6'));var querystring=require(_0x3916('0xe'));var Papa=require(_0x3916('0xf'));var Redis=require(_0x3916('0x10'));var authService=require(_0x3916('0x11'));var qs=require(_0x3916('0x12'));var as=require(_0x3916('0x13'));var hardwareService=require(_0x3916('0x14'));var logger=require(_0x3916('0x15'))(_0x3916('0x16'));var utils=require(_0x3916('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3916('0x18'));var db=require(_0x3916('0x19'))['db'];function respondWithStatusCode(_0x122f71,_0x2e994a){_0x2e994a=_0x2e994a||0xcc;return function(_0x9cbc54){if(_0x9cbc54){return _0x122f71[_0x3916('0x1a')](_0x2e994a);}return _0x122f71[_0x3916('0x1b')](_0x2e994a)[_0x3916('0x1c')]();};}function respondWithResult(_0x1f77ec,_0x39bcfb){_0x39bcfb=_0x39bcfb||0xc8;return function(_0x3914c8){if(_0x3914c8){return _0x1f77ec[_0x3916('0x1b')](_0x39bcfb)['json'](_0x3914c8);}};}function respondWithFilteredResult(_0x5888b1,_0x5f4a1a){return function(_0x52718f){if(_0x52718f){var _0x3e00e3=typeof _0x5f4a1a[_0x3916('0x1d')]===_0x3916('0x1e')&&typeof _0x5f4a1a[_0x3916('0x1f')]===_0x3916('0x1e');var _0x476cdb=_0x52718f[_0x3916('0x20')];var _0x318387=_0x3e00e3?0x0:_0x5f4a1a[_0x3916('0x1d')];var _0x29069c=_0x3e00e3?_0x52718f['count']:_0x5f4a1a[_0x3916('0x1d')]+_0x5f4a1a[_0x3916('0x1f')];var _0x1d82fc;if(_0x29069c>=_0x476cdb){_0x29069c=_0x476cdb;_0x1d82fc=0xc8;}else{_0x1d82fc=0xce;}_0x5888b1[_0x3916('0x1b')](_0x1d82fc);return _0x5888b1['set'](_0x3916('0x21'),_0x318387+'-'+_0x29069c+'/'+_0x476cdb)[_0x3916('0x22')](_0x52718f);}return null;};}function patchUpdates(_0x23f33f){return function(_0x52d349){try{jsonpatch[_0x3916('0x23')](_0x52d349,_0x23f33f,!![]);}catch(_0x4e6ee5){return BPromise[_0x3916('0x24')](_0x4e6ee5);}return _0x52d349[_0x3916('0x25')]();};}function saveUpdates(_0x2703f5,_0x9950aa){return function(_0x5a9d9d){if(_0x5a9d9d){return _0x5a9d9d['update'](_0x2703f5)[_0x3916('0x26')](function(_0x2d9bfb){return _0x2d9bfb;});}return null;};}function removeEntity(_0x181ee8,_0x488159){return function(_0xfbfa33){if(_0xfbfa33){return _0xfbfa33['destroy']()['then'](function(){_0x181ee8[_0x3916('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d095,_0x2d33b6){return function(_0x15079b){if(!_0x15079b){_0x46d095['sendStatus'](0x194);}return _0x15079b;};}function handleError(_0x18b56c,_0x1d5301){_0x1d5301=_0x1d5301||0x1f4;return function(_0x3a5ebb){logger[_0x3916('0x27')](_0x3a5ebb[_0x3916('0x28')]);if(_0x3a5ebb[_0x3916('0x29')]){delete _0x3a5ebb[_0x3916('0x29')];}_0x18b56c[_0x3916('0x1b')](_0x1d5301)['send'](_0x3a5ebb);};}exports[_0x3916('0x2a')]=function(_0x23df0e,_0x16415a){var _0x2c9741={},_0x35734c={},_0x329016={'count':0x0,'rows':[]};var _0x548991=_[_0x3916('0x2b')](db[_0x3916('0x2c')]['rawAttributes'],function(_0x1d01bc){return{'name':_0x1d01bc['fieldName'],'type':_0x1d01bc[_0x3916('0x2d')][_0x3916('0x2e')]};});_0x35734c[_0x3916('0x2f')]=_[_0x3916('0x2b')](_0x548991,_0x3916('0x29'));_0x35734c[_0x3916('0x30')]=_['keys'](_0x23df0e['query']);_0x35734c[_0x3916('0x31')]=_[_0x3916('0x32')](_0x35734c['model'],_0x35734c[_0x3916('0x30')]);_0x2c9741[_0x3916('0x33')]=_[_0x3916('0x32')](_0x35734c[_0x3916('0x2f')],qs['fields'](_0x23df0e[_0x3916('0x30')][_0x3916('0x34')]));_0x2c9741[_0x3916('0x33')]=_0x2c9741[_0x3916('0x33')][_0x3916('0x35')]?_0x2c9741[_0x3916('0x33')]:_0x35734c['model'];if(!_0x23df0e['query'][_0x3916('0x36')](_0x3916('0x37'))){_0x2c9741[_0x3916('0x1f')]=qs[_0x3916('0x1f')](_0x23df0e[_0x3916('0x30')][_0x3916('0x1f')]);_0x2c9741[_0x3916('0x1d')]=qs[_0x3916('0x1d')](_0x23df0e[_0x3916('0x30')][_0x3916('0x1d')]);}_0x2c9741[_0x3916('0x38')]=qs[_0x3916('0x39')](_0x23df0e[_0x3916('0x30')]['sort']);_0x2c9741['where']=qs['filters'](_[_0x3916('0x3a')](_0x23df0e['query'],_0x35734c[_0x3916('0x31')]),_0x548991);if(_0x23df0e[_0x3916('0x30')][_0x3916('0x3b')]){_0x2c9741[_0x3916('0x3c')]=_[_0x3916('0x3d')](_0x2c9741['where'],{'$or':_['map'](_0x548991,function(_0x257ae2){if(_0x257ae2[_0x3916('0x2d')]!==_0x3916('0x3e')){var _0x5ca0a3={};_0x5ca0a3[_0x257ae2[_0x3916('0x29')]]={'$like':'%'+_0x23df0e[_0x3916('0x30')][_0x3916('0x3b')]+'%'};return _0x5ca0a3;}})});}_0x2c9741=_[_0x3916('0x3d')]({},_0x2c9741,_0x23df0e[_0x3916('0x3f')]);var _0x209fa5={'where':_0x2c9741['where']};return db[_0x3916('0x2c')]['count'](_0x209fa5)[_0x3916('0x26')](function(_0x5b8212){_0x329016['count']=_0x5b8212;if(_0x23df0e['query']['includeAll']){_0x2c9741[_0x3916('0x40')]=[{'all':!![]}];}return db[_0x3916('0x2c')][_0x3916('0x41')](_0x2c9741);})[_0x3916('0x26')](function(_0x1e66b1){_0x329016[_0x3916('0x42')]=_0x1e66b1;return _0x329016;})[_0x3916('0x26')](respondWithFilteredResult(_0x16415a,_0x2c9741))[_0x3916('0x43')](handleError(_0x16415a,null));};exports[_0x3916('0x44')]=function(_0xc328bb,_0x4b8637){var _0x23902e={'raw':!![],'where':{'id':_0xc328bb[_0x3916('0x45')]['id']}},_0x2de4e4={};_0x2de4e4['model']=_['keys'](db[_0x3916('0x2c')][_0x3916('0x46')]);_0x2de4e4[_0x3916('0x30')]=_['keys'](_0xc328bb['query']);_0x2de4e4[_0x3916('0x31')]=_[_0x3916('0x32')](_0x2de4e4['model'],_0x2de4e4['query']);_0x23902e[_0x3916('0x33')]=_['intersection'](_0x2de4e4[_0x3916('0x2f')],qs[_0x3916('0x34')](_0xc328bb['query'][_0x3916('0x34')]));_0x23902e[_0x3916('0x33')]=_0x23902e[_0x3916('0x33')]['length']?_0x23902e[_0x3916('0x33')]:_0x2de4e4[_0x3916('0x2f')];if(_0xc328bb['query'][_0x3916('0x47')]){_0x23902e[_0x3916('0x40')]=[{'all':!![]}];}_0x23902e=_[_0x3916('0x3d')]({},_0x23902e,_0xc328bb[_0x3916('0x3f')]);return db['ServicenowField'][_0x3916('0x48')](_0x23902e)[_0x3916('0x26')](handleEntityNotFound(_0x4b8637,null))[_0x3916('0x26')](respondWithResult(_0x4b8637,null))[_0x3916('0x43')](handleError(_0x4b8637,null));};exports[_0x3916('0x49')]=function(_0x25c84f,_0x33beba){return db['ServicenowField'][_0x3916('0x49')](_0x25c84f[_0x3916('0x4a')],{})[_0x3916('0x26')](respondWithResult(_0x33beba,0xc9))[_0x3916('0x43')](handleError(_0x33beba,null));};exports[_0x3916('0x4b')]=function(_0x55ae95,_0x36b769){if(_0x55ae95[_0x3916('0x4a')]['id']){delete _0x55ae95['body']['id'];}return db['ServicenowField'][_0x3916('0x48')]({'where':{'id':_0x55ae95['params']['id']}})['then'](handleEntityNotFound(_0x36b769,null))['then'](saveUpdates(_0x55ae95[_0x3916('0x4a')],null))[_0x3916('0x26')](respondWithResult(_0x36b769,null))[_0x3916('0x43')](handleError(_0x36b769,null));};exports['destroy']=function(_0xc20321,_0x662841){return db[_0x3916('0x2c')][_0x3916('0x48')]({'where':{'id':_0xc20321['params']['id']}})[_0x3916('0x26')](handleEntityNotFound(_0x662841,null))[_0x3916('0x26')](removeEntity(_0x662841,null))[_0x3916('0x43')](handleError(_0x662841,null));}; \ No newline at end of file +var _0xe87a=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format'];(function(_0x57a4d0,_0xa6e6b){var _0xaaadee=function(_0x544da2){while(--_0x544da2){_0x57a4d0['push'](_0x57a4d0['shift']());}};_0xaaadee(++_0xa6e6b);}(_0xe87a,0x91));var _0xae87=function(_0x593d72,_0x5e6552){_0x593d72=_0x593d72-0x0;var _0x5ddb05=_0xe87a[_0x593d72];return _0x5ddb05;};'use strict';var emlformat=require(_0xae87('0x0'));var rimraf=require(_0xae87('0x1'));var zipdir=require(_0xae87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae87('0x3'));var moment=require(_0xae87('0x4'));var BPromise=require(_0xae87('0x5'));var Mustache=require(_0xae87('0x6'));var util=require(_0xae87('0x7'));var path=require(_0xae87('0x8'));var sox=require(_0xae87('0x9'));var csv=require(_0xae87('0xa'));var ejs=require(_0xae87('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae87('0xc'));var squel=require(_0xae87('0xd'));var crypto=require(_0xae87('0xe'));var jsforce=require(_0xae87('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xae87('0xa'));var querystring=require('querystring');var Papa=require(_0xae87('0x10'));var Redis=require(_0xae87('0x11'));var authService=require(_0xae87('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae87('0x13'));var hardwareService=require(_0xae87('0x14'));var logger=require('../../config/logger')(_0xae87('0x15'));var utils=require(_0xae87('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xae87('0x17'));var db=require(_0xae87('0x18'))['db'];function respondWithStatusCode(_0x10e024,_0x222d6f){_0x222d6f=_0x222d6f||0xcc;return function(_0x3f9d02){if(_0x3f9d02){return _0x10e024[_0xae87('0x19')](_0x222d6f);}return _0x10e024[_0xae87('0x1a')](_0x222d6f)['end']();};}function respondWithResult(_0xc69109,_0x345b4b){_0x345b4b=_0x345b4b||0xc8;return function(_0x5bb708){if(_0x5bb708){return _0xc69109[_0xae87('0x1a')](_0x345b4b)['json'](_0x5bb708);}};}function respondWithFilteredResult(_0x244696,_0x2f9d61){return function(_0x25a5d9){if(_0x25a5d9){var _0x577185=typeof _0x2f9d61[_0xae87('0x1b')]===_0xae87('0x1c')&&typeof _0x2f9d61[_0xae87('0x1d')]===_0xae87('0x1c');var _0x1bde7a=_0x25a5d9[_0xae87('0x1e')];var _0xd5ed7d=_0x577185?0x0:_0x2f9d61[_0xae87('0x1b')];var _0x14c064=_0x577185?_0x25a5d9[_0xae87('0x1e')]:_0x2f9d61[_0xae87('0x1b')]+_0x2f9d61[_0xae87('0x1d')];var _0x1a4451;if(_0x14c064>=_0x1bde7a){_0x14c064=_0x1bde7a;_0x1a4451=0xc8;}else{_0x1a4451=0xce;}_0x244696[_0xae87('0x1a')](_0x1a4451);return _0x244696[_0xae87('0x1f')]('Content-Range',_0xd5ed7d+'-'+_0x14c064+'/'+_0x1bde7a)['json'](_0x25a5d9);}return null;};}function patchUpdates(_0x69c4b3){return function(_0x56fc9f){try{jsonpatch['apply'](_0x56fc9f,_0x69c4b3,!![]);}catch(_0xdcba1e){return BPromise['reject'](_0xdcba1e);}return _0x56fc9f[_0xae87('0x20')]();};}function saveUpdates(_0x350599,_0x53a9fd){return function(_0x21a0d5){if(_0x21a0d5){return _0x21a0d5[_0xae87('0x21')](_0x350599)['then'](function(_0x25dc0b){return _0x25dc0b;});}return null;};}function removeEntity(_0x3bbdd4,_0x45696d){return function(_0x3ca26){if(_0x3ca26){return _0x3ca26[_0xae87('0x22')]()[_0xae87('0x23')](function(){_0x3bbdd4[_0xae87('0x1a')](0xcc)[_0xae87('0x24')]();});}};}function handleEntityNotFound(_0x112700,_0x7d27a9){return function(_0x1828a8){if(!_0x1828a8){_0x112700['sendStatus'](0x194);}return _0x1828a8;};}function handleError(_0xf8501f,_0x2842b3){_0x2842b3=_0x2842b3||0x1f4;return function(_0x1c3215){logger['error'](_0x1c3215[_0xae87('0x25')]);if(_0x1c3215[_0xae87('0x26')]){delete _0x1c3215['name'];}_0xf8501f[_0xae87('0x1a')](_0x2842b3)[_0xae87('0x27')](_0x1c3215);};}exports[_0xae87('0x28')]=function(_0x244bf1,_0x16548f){var _0x5d656b={},_0x1ac72a={},_0x5ece2a={'count':0x0,'rows':[]};var _0x3f291f=_[_0xae87('0x29')](db['ServicenowField'][_0xae87('0x2a')],function(_0x293895){return{'name':_0x293895[_0xae87('0x2b')],'type':_0x293895[_0xae87('0x2c')][_0xae87('0x2d')]};});_0x1ac72a['model']=_[_0xae87('0x29')](_0x3f291f,_0xae87('0x26'));_0x1ac72a['query']=_[_0xae87('0x2e')](_0x244bf1[_0xae87('0x2f')]);_0x1ac72a['filters']=_[_0xae87('0x30')](_0x1ac72a[_0xae87('0x31')],_0x1ac72a['query']);_0x5d656b['attributes']=_[_0xae87('0x30')](_0x1ac72a[_0xae87('0x31')],qs[_0xae87('0x32')](_0x244bf1[_0xae87('0x2f')][_0xae87('0x32')]));_0x5d656b[_0xae87('0x33')]=_0x5d656b['attributes'][_0xae87('0x34')]?_0x5d656b[_0xae87('0x33')]:_0x1ac72a['model'];if(!_0x244bf1[_0xae87('0x2f')]['hasOwnProperty'](_0xae87('0x35'))){_0x5d656b[_0xae87('0x1d')]=qs[_0xae87('0x1d')](_0x244bf1[_0xae87('0x2f')][_0xae87('0x1d')]);_0x5d656b[_0xae87('0x1b')]=qs[_0xae87('0x1b')](_0x244bf1['query'][_0xae87('0x1b')]);}_0x5d656b[_0xae87('0x36')]=qs[_0xae87('0x37')](_0x244bf1[_0xae87('0x2f')][_0xae87('0x37')]);_0x5d656b[_0xae87('0x38')]=qs[_0xae87('0x39')](_[_0xae87('0x3a')](_0x244bf1[_0xae87('0x2f')],_0x1ac72a[_0xae87('0x39')]),_0x3f291f);if(_0x244bf1['query'][_0xae87('0x3b')]){_0x5d656b[_0xae87('0x38')]=_[_0xae87('0x3c')](_0x5d656b['where'],{'$or':_[_0xae87('0x29')](_0x3f291f,function(_0xb38d47){if(_0xb38d47['type']!==_0xae87('0x3d')){var _0x49b231={};_0x49b231[_0xb38d47[_0xae87('0x26')]]={'$like':'%'+_0x244bf1[_0xae87('0x2f')][_0xae87('0x3b')]+'%'};return _0x49b231;}})});}_0x5d656b=_[_0xae87('0x3c')]({},_0x5d656b,_0x244bf1[_0xae87('0x3e')]);var _0x504df7={'where':_0x5d656b['where']};return db[_0xae87('0x3f')]['count'](_0x504df7)['then'](function(_0x5bde5e){_0x5ece2a[_0xae87('0x1e')]=_0x5bde5e;if(_0x244bf1[_0xae87('0x2f')][_0xae87('0x40')]){_0x5d656b['include']=[{'all':!![]}];}return db[_0xae87('0x3f')][_0xae87('0x41')](_0x5d656b);})[_0xae87('0x23')](function(_0x4def72){_0x5ece2a[_0xae87('0x42')]=_0x4def72;return _0x5ece2a;})['then'](respondWithFilteredResult(_0x16548f,_0x5d656b))[_0xae87('0x43')](handleError(_0x16548f,null));};exports['show']=function(_0x440fac,_0x4273b3){var _0x25043e={'raw':!![],'where':{'id':_0x440fac[_0xae87('0x44')]['id']}},_0x427435={};_0x427435[_0xae87('0x31')]=_['keys'](db[_0xae87('0x3f')][_0xae87('0x2a')]);_0x427435[_0xae87('0x2f')]=_['keys'](_0x440fac[_0xae87('0x2f')]);_0x427435[_0xae87('0x39')]=_[_0xae87('0x30')](_0x427435[_0xae87('0x31')],_0x427435[_0xae87('0x2f')]);_0x25043e['attributes']=_[_0xae87('0x30')](_0x427435[_0xae87('0x31')],qs['fields'](_0x440fac[_0xae87('0x2f')][_0xae87('0x32')]));_0x25043e[_0xae87('0x33')]=_0x25043e['attributes'][_0xae87('0x34')]?_0x25043e[_0xae87('0x33')]:_0x427435[_0xae87('0x31')];if(_0x440fac[_0xae87('0x2f')][_0xae87('0x40')]){_0x25043e[_0xae87('0x45')]=[{'all':!![]}];}_0x25043e=_['merge']({},_0x25043e,_0x440fac[_0xae87('0x3e')]);return db[_0xae87('0x3f')][_0xae87('0x46')](_0x25043e)[_0xae87('0x23')](handleEntityNotFound(_0x4273b3,null))[_0xae87('0x23')](respondWithResult(_0x4273b3,null))[_0xae87('0x43')](handleError(_0x4273b3,null));};exports[_0xae87('0x47')]=function(_0x3da13b,_0x2b989d){return db[_0xae87('0x3f')][_0xae87('0x47')](_0x3da13b['body'],{})['then'](respondWithResult(_0x2b989d,0xc9))[_0xae87('0x43')](handleError(_0x2b989d,null));};exports[_0xae87('0x21')]=function(_0x3d297d,_0x198fa5){if(_0x3d297d[_0xae87('0x48')]['id']){delete _0x3d297d['body']['id'];}return db[_0xae87('0x3f')][_0xae87('0x46')]({'where':{'id':_0x3d297d['params']['id']}})[_0xae87('0x23')](handleEntityNotFound(_0x198fa5,null))[_0xae87('0x23')](saveUpdates(_0x3d297d[_0xae87('0x48')],null))['then'](respondWithResult(_0x198fa5,null))[_0xae87('0x43')](handleError(_0x198fa5,null));};exports[_0xae87('0x22')]=function(_0x16f809,_0x42875c){return db[_0xae87('0x3f')]['find']({'where':{'id':_0x16f809[_0xae87('0x44')]['id']}})[_0xae87('0x23')](handleEntityNotFound(_0x42875c,null))[_0xae87('0x23')](removeEntity(_0x42875c,null))[_0xae87('0x43')](handleError(_0x42875c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9256fc5..224213c 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 _0xf571=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x21ca30,_0x1674a6){var _0x2655b9=function(_0xc08718){while(--_0xc08718){_0x21ca30['push'](_0x21ca30['shift']());}};_0x2655b9(++_0x1674a6);}(_0xf571,0xdf));var _0x1f57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf571[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1f57('0x0'));var util=require(_0x1f57('0x1'));var logger=require(_0x1f57('0x2'))(_0x1f57('0x3'));var moment=require('moment');var BPromise=require(_0x1f57('0x4'));var rp=require(_0x1f57('0x5'));var fs=require('fs');var path=require(_0x1f57('0x6'));var rimraf=require(_0x1f57('0x7'));var config=require(_0x1f57('0x8'));var attributes=require(_0x1f57('0x9'));module[_0x1f57('0xa')]=function(_0x33546c,_0x33fc83){return _0x33546c['define'](_0x1f57('0xb'),attributes,{'tableName':_0x1f57('0xc'),'paranoid':![],'indexes':[{'name':_0x1f57('0xd'),'fields':[_0x1f57('0xe'),_0x1f57('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a67=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x78c401,_0x269ce2){var _0x370c90=function(_0x3d9911){while(--_0x3d9911){_0x78c401['push'](_0x78c401['shift']());}};_0x370c90(++_0x269ce2);}(_0x3a67,0x189));var _0x73a6=function(_0x8b11c9,_0x3af901){_0x8b11c9=_0x8b11c9-0x0;var _0xa06546=_0x3a67[_0x8b11c9];return _0xa06546;};'use strict';var _=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var logger=require(_0x73a6('0x2'))(_0x73a6('0x3'));var moment=require('moment');var BPromise=require(_0x73a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73a6('0x5'));var rimraf=require(_0x73a6('0x6'));var config=require(_0x73a6('0x7'));var attributes=require(_0x73a6('0x8'));module[_0x73a6('0x9')]=function(_0x585021,_0x5ea7be){return _0x585021[_0x73a6('0xa')](_0x73a6('0xb'),attributes,{'tableName':_0x73a6('0xc'),'paranoid':![],'indexes':[{'name':_0x73a6('0xd'),'fields':[_0x73a6('0xe'),_0x73a6('0xf')],'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 6adad98..28f311e 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1a1c45,_0x4fdc66){_0x1a1c45=_0x1a1c45-0x0;var _0x3dbd0f=_0xbdb7[_0x1a1c45];return _0x3dbd0f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0xd92b83,_0x564693){_0xd92b83=_0xd92b83-0x0;var _0xf42b9e=_0xac4a[_0xd92b83];return _0xf42b9e;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e309295..f0bf68c 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x412ea2,_0x28c2fa){var _0x3980d5=function(_0x24e3d2){while(--_0x24e3d2){_0x412ea2['push'](_0x412ea2['shift']());}};_0x3980d5(++_0x28c2fa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4b7f7e,_0x3ec4a1){var _0x47576a=function(_0x24753f){while(--_0x24753f){_0x4b7f7e['push'](_0x4b7f7e['shift']());}};_0x47576a(++_0x3ec4a1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d3945d5..5f68857 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x110f6f,_0x486ce8){var _0x2794bc=function(_0x13a3da){while(--_0x13a3da){_0x110f6f['push'](_0x110f6f['shift']());}};_0x2794bc(++_0x486ce8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1e654b,_0x567aa3){var _0x509af7=function(_0x247aa2){while(--_0x247aa2){_0x1e654b['push'](_0x1e654b['shift']());}};_0x509af7(++_0x567aa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index ec2c834..1fdf1a2 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 _0x37c6=['AccountId','Subjects','getSubjects','channel','Descriptions','create','SugarcrmField','getFields','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','POST','%s%s','JSON','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','stringify','Calls','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','send','eml-format','request-promise','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','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','length','find','catch','update','body','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration'];(function(_0x1371df,_0xbaea0c){var _0x380a92=function(_0x3e8982){while(--_0x3e8982){_0x1371df['push'](_0x1371df['shift']());}};_0x380a92(++_0xbaea0c);}(_0x37c6,0x1ef));var _0x637c=function(_0x3a0cae,_0xf2f32e){_0x3a0cae=_0x3a0cae-0x0;var _0x245cc2=_0x37c6[_0x3a0cae];return _0x245cc2;};'use strict';var emlformat=require(_0x637c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x637c('0x1'));var moment=require('moment');var BPromise=require(_0x637c('0x2'));var Mustache=require(_0x637c('0x3'));var util=require('util');var path=require(_0x637c('0x4'));var sox=require(_0x637c('0x5'));var csv=require(_0x637c('0x6'));var ejs=require(_0x637c('0x7'));var fs=require('fs');var fs_extra=require(_0x637c('0x8'));var _=require(_0x637c('0x9'));var squel=require(_0x637c('0xa'));var crypto=require(_0x637c('0xb'));var jsforce=require(_0x637c('0xc'));var deskjs=require(_0x637c('0xd'));var toCsv=require(_0x637c('0x6'));var querystring=require(_0x637c('0xe'));var Papa=require(_0x637c('0xf'));var Redis=require(_0x637c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x637c('0x11'));var as=require(_0x637c('0x12'));var hardwareService=require(_0x637c('0x13'));var logger=require(_0x637c('0x14'))(_0x637c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x637c('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x637c('0x17'));function respondWithStatusCode(_0x378b64,_0x55b04f){_0x55b04f=_0x55b04f||0xcc;return function(_0x3a2772){if(_0x3a2772){return _0x378b64[_0x637c('0x18')](_0x55b04f);}return _0x378b64['status'](_0x55b04f)[_0x637c('0x19')]();};}function respondWithResult(_0x4d8f28,_0x46c57e){_0x46c57e=_0x46c57e||0xc8;return function(_0x4fd4fa){if(_0x4fd4fa){return _0x4d8f28[_0x637c('0x1a')](_0x46c57e)[_0x637c('0x1b')](_0x4fd4fa);}};}function respondWithFilteredResult(_0x18d3fe,_0x401658){return function(_0x216462){if(_0x216462){var _0x546986=typeof _0x401658[_0x637c('0x1c')]===_0x637c('0x1d')&&typeof _0x401658[_0x637c('0x1e')]===_0x637c('0x1d');var _0x4dfa67=_0x216462[_0x637c('0x1f')];var _0x44bcef=_0x546986?0x0:_0x401658[_0x637c('0x1c')];var _0x4b88dd=_0x546986?_0x216462[_0x637c('0x1f')]:_0x401658[_0x637c('0x1c')]+_0x401658[_0x637c('0x1e')];var _0x2f5806;if(_0x4b88dd>=_0x4dfa67){_0x4b88dd=_0x4dfa67;_0x2f5806=0xc8;}else{_0x2f5806=0xce;}_0x18d3fe[_0x637c('0x1a')](_0x2f5806);return _0x18d3fe[_0x637c('0x20')]('Content-Range',_0x44bcef+'-'+_0x4b88dd+'/'+_0x4dfa67)[_0x637c('0x1b')](_0x216462);}return null;};}function patchUpdates(_0x1d2076){return function(_0x45907f){try{jsonpatch['apply'](_0x45907f,_0x1d2076,!![]);}catch(_0x1945b8){return BPromise[_0x637c('0x21')](_0x1945b8);}return _0x45907f['save']();};}function saveUpdates(_0xe7180f,_0x273dd1){return function(_0x3c9448){if(_0x3c9448){return _0x3c9448['update'](_0xe7180f)[_0x637c('0x22')](function(_0x1b927c){return _0x1b927c;});}return null;};}function removeEntity(_0x5a1a0b,_0x329bb3){return function(_0x31d680){if(_0x31d680){return _0x31d680[_0x637c('0x23')]()[_0x637c('0x22')](function(){_0x5a1a0b[_0x637c('0x1a')](0xcc)[_0x637c('0x19')]();});}};}function handleEntityNotFound(_0x2aa088,_0x572b23){return function(_0x1ba9d2){if(!_0x1ba9d2){_0x2aa088[_0x637c('0x18')](0x194);}return _0x1ba9d2;};}function handleError(_0xbe090f,_0xe41341){_0xe41341=_0xe41341||0x1f4;return function(_0x2091da){logger[_0x637c('0x24')](_0x2091da[_0x637c('0x25')]);if(_0x2091da[_0x637c('0x26')]){delete _0x2091da[_0x637c('0x26')];}_0xbe090f[_0x637c('0x1a')](_0xe41341)['send'](_0x2091da);};}exports[_0x637c('0x27')]=function(_0x1ceb8c,_0x541924){var _0x1ca725={},_0xe8ff18={},_0x515aaf={'count':0x0,'rows':[]};var _0x3d2c55=_[_0x637c('0x28')](db[_0x637c('0x29')][_0x637c('0x2a')],function(_0x39d34e){return{'name':_0x39d34e[_0x637c('0x2b')],'type':_0x39d34e[_0x637c('0x2c')]['key']};});_0xe8ff18[_0x637c('0x2d')]=_[_0x637c('0x28')](_0x3d2c55,_0x637c('0x26'));_0xe8ff18[_0x637c('0x2e')]=_[_0x637c('0x2f')](_0x1ceb8c[_0x637c('0x2e')]);_0xe8ff18['filters']=_['intersection'](_0xe8ff18[_0x637c('0x2d')],_0xe8ff18[_0x637c('0x2e')]);_0x1ca725[_0x637c('0x30')]=_[_0x637c('0x31')](_0xe8ff18[_0x637c('0x2d')],qs[_0x637c('0x32')](_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x32')]));_0x1ca725[_0x637c('0x30')]=_0x1ca725[_0x637c('0x30')]['length']?_0x1ca725[_0x637c('0x30')]:_0xe8ff18[_0x637c('0x2d')];if(!_0x1ceb8c['query']['hasOwnProperty']('nolimit')){_0x1ca725['limit']=qs[_0x637c('0x1e')](_0x1ceb8c[_0x637c('0x2e')]['limit']);_0x1ca725[_0x637c('0x1c')]=qs['offset'](_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x1c')]);}_0x1ca725[_0x637c('0x33')]=qs[_0x637c('0x34')](_0x1ceb8c['query'][_0x637c('0x34')]);_0x1ca725[_0x637c('0x35')]=qs[_0x637c('0x36')](_[_0x637c('0x37')](_0x1ceb8c['query'],_0xe8ff18['filters']),_0x3d2c55);if(_0x1ceb8c[_0x637c('0x2e')]['filter']){_0x1ca725['where']=_['merge'](_0x1ca725[_0x637c('0x35')],{'$or':_[_0x637c('0x28')](_0x3d2c55,function(_0x335ae6){if(_0x335ae6[_0x637c('0x2c')]!==_0x637c('0x38')){var _0x18bc3d={};_0x18bc3d[_0x335ae6[_0x637c('0x26')]]={'$like':'%'+_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x39')]+'%'};return _0x18bc3d;}})});}_0x1ca725=_[_0x637c('0x3a')]({},_0x1ca725,_0x1ceb8c[_0x637c('0x3b')]);var _0x5ce342={'where':_0x1ca725[_0x637c('0x35')]};return db[_0x637c('0x29')][_0x637c('0x1f')](_0x5ce342)[_0x637c('0x22')](function(_0x3db2b4){_0x515aaf['count']=_0x3db2b4;if(_0x1ceb8c[_0x637c('0x2e')][_0x637c('0x3c')]){_0x1ca725[_0x637c('0x3d')]=[{'all':!![]}];}return db[_0x637c('0x29')]['findAll'](_0x1ca725);})[_0x637c('0x22')](function(_0x5dd58c){_0x515aaf[_0x637c('0x3e')]=_0x5dd58c;return _0x515aaf;})[_0x637c('0x22')](respondWithFilteredResult(_0x541924,_0x1ca725))['catch'](handleError(_0x541924,null));};exports[_0x637c('0x3f')]=function(_0x481eb7,_0x1820f5){var _0x270a28={'raw':![],'where':{'id':_0x481eb7[_0x637c('0x40')]['id']}},_0x5bfd8d={};_0x5bfd8d[_0x637c('0x2d')]=_['keys'](db[_0x637c('0x29')]['rawAttributes']);_0x5bfd8d[_0x637c('0x2e')]=_['keys'](_0x481eb7['query']);_0x5bfd8d['filters']=_[_0x637c('0x31')](_0x5bfd8d[_0x637c('0x2d')],_0x5bfd8d[_0x637c('0x2e')]);_0x270a28[_0x637c('0x30')]=_[_0x637c('0x31')](_0x5bfd8d[_0x637c('0x2d')],qs['fields'](_0x481eb7[_0x637c('0x2e')][_0x637c('0x32')]));_0x270a28[_0x637c('0x30')]=_0x270a28['attributes'][_0x637c('0x41')]?_0x270a28['attributes']:_0x5bfd8d[_0x637c('0x2d')];if(_0x481eb7[_0x637c('0x2e')][_0x637c('0x3c')]){_0x270a28[_0x637c('0x3d')]=[{'all':!![]}];}_0x270a28=_[_0x637c('0x3a')]({},_0x270a28,_0x481eb7[_0x637c('0x3b')]);return db[_0x637c('0x29')][_0x637c('0x42')](_0x270a28)[_0x637c('0x22')](handleEntityNotFound(_0x1820f5,null))[_0x637c('0x22')](respondWithResult(_0x1820f5,null))[_0x637c('0x43')](handleError(_0x1820f5,null));};exports['create']=function(_0x35d5ff,_0x40c5be){return db[_0x637c('0x29')]['create'](_0x35d5ff['body'],{})[_0x637c('0x22')](respondWithResult(_0x40c5be,0xc9))[_0x637c('0x43')](handleError(_0x40c5be,null));};exports[_0x637c('0x44')]=function(_0xbd7a02,_0x578e71){if(_0xbd7a02[_0x637c('0x45')]['id']){delete _0xbd7a02[_0x637c('0x45')]['id'];}return db[_0x637c('0x29')]['find']({'where':{'id':_0xbd7a02['params']['id']}})[_0x637c('0x22')](handleEntityNotFound(_0x578e71,null))[_0x637c('0x22')](saveUpdates(_0xbd7a02[_0x637c('0x45')],null))[_0x637c('0x22')](respondWithResult(_0x578e71,null))['catch'](handleError(_0x578e71,null));};exports[_0x637c('0x23')]=function(_0x5bcb2c,_0xceea01){return db[_0x637c('0x29')][_0x637c('0x42')]({'where':{'id':_0x5bcb2c['params']['id']}})[_0x637c('0x22')](handleEntityNotFound(_0xceea01,null))[_0x637c('0x22')](removeEntity(_0xceea01,null))[_0x637c('0x43')](handleError(_0xceea01,null));};exports[_0x637c('0x46')]=function(_0x4308c5,_0xc65ffb,_0x285337){var _0x476826={};var _0x44752a={};var _0x41b623;var _0x4b4b5e;return db[_0x637c('0x29')][_0x637c('0x47')]({'where':{'id':_0x4308c5[_0x637c('0x40')]['id']}})[_0x637c('0x22')](handleEntityNotFound(_0xc65ffb,null))[_0x637c('0x22')](function(_0x155c35){if(_0x155c35){_0x41b623=_0x155c35;_0x44752a[_0x637c('0x2d')]=_[_0x637c('0x2f')](db['SugarcrmConfiguration'][_0x637c('0x2a')]);_0x44752a['query']=_['keys'](_0x4308c5['query']);_0x44752a[_0x637c('0x36')]=_['intersection'](_0x44752a[_0x637c('0x2d')],_0x44752a['query']);_0x476826[_0x637c('0x30')]=_[_0x637c('0x31')](_0x44752a[_0x637c('0x2d')],qs['fields'](_0x4308c5[_0x637c('0x2e')]['fields']));_0x476826[_0x637c('0x30')]=_0x476826[_0x637c('0x30')]['length']?_0x476826['attributes']:_0x44752a['model'];_0x476826[_0x637c('0x33')]=qs['sort'](_0x4308c5['query'][_0x637c('0x34')]);_0x476826[_0x637c('0x35')]=qs[_0x637c('0x36')](_[_0x637c('0x37')](_0x4308c5[_0x637c('0x2e')],_0x44752a[_0x637c('0x36')]));if(_0x4308c5[_0x637c('0x2e')][_0x637c('0x39')]){_0x476826[_0x637c('0x35')]=_[_0x637c('0x3a')](_0x476826[_0x637c('0x35')],{'$or':_['map'](_0x476826[_0x637c('0x30')],function(_0x1bb82a){var _0x43ff1e={};_0x43ff1e[_0x1bb82a]={'$like':'%'+_0x4308c5[_0x637c('0x2e')]['filter']+'%'};return _0x43ff1e;})});}_0x476826=_[_0x637c('0x3a')]({},_0x476826,_0x4308c5[_0x637c('0x3b')]);return _0x41b623['getConfigurations'](_0x476826);}})[_0x637c('0x22')](function(_0x1cc65d){if(_0x1cc65d){_0x4b4b5e=_0x1cc65d['length'];if(!_0x4308c5[_0x637c('0x2e')][_0x637c('0x48')](_0x637c('0x49'))){_0x476826[_0x637c('0x1e')]=qs['limit'](_0x4308c5[_0x637c('0x2e')]['limit']);_0x476826[_0x637c('0x1c')]=qs[_0x637c('0x1c')](_0x4308c5[_0x637c('0x2e')][_0x637c('0x1c')]);}return _0x41b623[_0x637c('0x46')](_0x476826);}})[_0x637c('0x22')](function(_0x41575a){if(_0x41575a){return _0x41575a?{'count':_0x4b4b5e,'rows':_0x41575a}:null;}})[_0x637c('0x22')](respondWithResult(_0xc65ffb,null))['catch'](handleError(_0xc65ffb,null));};exports[_0x637c('0x4a')]=function(_0x5e2bc5,_0x28994b,_0x5cc3be){if(_0x5e2bc5[_0x637c('0x45')]['id']){delete _0x5e2bc5[_0x637c('0x45')]['id'];}return db[_0x637c('0x29')][_0x637c('0x47')]({'where':{'id':_0x5e2bc5[_0x637c('0x40')]['id']}})[_0x637c('0x22')](handleEntityNotFound(_0x28994b,null))[_0x637c('0x22')](function(_0x329a2d){if(_0x329a2d){_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4b')]=_0x329a2d['id'];_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4c')]=integrations[_0x637c('0x4d')](_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4e')],_0x5e2bc5[_0x637c('0x45')]['type']);_0x5e2bc5['body'][_0x637c('0x4f')]=integrations['getDescriptions'](_0x5e2bc5[_0x637c('0x45')][_0x637c('0x4e')],_0x5e2bc5[_0x637c('0x45')][_0x637c('0x2c')]);return db['SugarcrmConfiguration'][_0x637c('0x50')](_0x5e2bc5[_0x637c('0x45')],{'include':[{'model':db[_0x637c('0x51')],'as':_0x637c('0x4c')},{'model':db[_0x637c('0x51')],'as':_0x637c('0x4f')}]});}return null;})[_0x637c('0x22')](respondWithResult(_0x28994b,null))[_0x637c('0x43')](handleError(_0x28994b,null));};exports[_0x637c('0x52')]=function(_0x50cdea,_0x5bd5f2,_0x3ff29f){var _0x53893e='';var _0x1ac334=['id',_0x637c('0x26'),'assigned_user_id',_0x637c('0x53'),'description',_0x637c('0x54'),'duration_hours',_0x637c('0x55'),_0x637c('0x56'),_0x637c('0x57'),_0x637c('0x58'),_0x637c('0x59')];return db[_0x637c('0x29')]['findOne']({'where':{'id':_0x50cdea['params']['id']},'attributes':['id',_0x637c('0x5a'),_0x637c('0x5b'),_0x637c('0x5c')]})[_0x637c('0x22')](handleEntityNotFound(_0x5bd5f2,null))[_0x637c('0x22')](function(_0x5a6059){if(_0x5a6059){_0x53893e=_0x5a6059[_0x637c('0x5c')];var _0xef4e86=_0x53893e[_0x637c('0x5d')](-0x1);if(_0xef4e86==='/'){_0x53893e=_0x53893e['substring'](0x0,_0x53893e['lastIndexOf'](_0xef4e86));}return rp({'method':_0x637c('0x5e'),'uri':util['format'](_0x637c('0x5f'),_0x53893e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x637c('0x60'),'response_type':_0x637c('0x60'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5a6059['username'],'password':_0x5a6059[_0x637c('0x5b')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x5c748a){if(_0x5c748a&&_0x5c748a['name']!==_0x637c('0x61')&&_0x5c748a['name']!==_0x637c('0x62')){return rp({'method':_0x637c('0x5e'),'uri':util[_0x637c('0x63')](_0x637c('0x5f'),_0x53893e,_0x637c('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x637c('0x60'),'rest_data':JSON[_0x637c('0x65')]({'session':_0x5c748a['id'],'module_name':_0x637c('0x66')})}})[_0x637c('0x22')](function(_0xfe0bdd){if(_0xfe0bdd){var _0x3bbbd6=_[_0x637c('0x67')](_0xfe0bdd[_0x637c('0x68')]);_[_0x637c('0x69')](_0x3bbbd6,function(_0xf06cb){return _0x1ac334[_0x637c('0x6a')](_0xf06cb[_0x637c('0x26')]);});return{'count':_0x3bbbd6[_0x637c('0x41')],'rows':_[_0x637c('0x28')](_0x3bbbd6,function(_0x19e45d){return{'id':_0x19e45d[_0x637c('0x26')],'name':_0x19e45d[_0x637c('0x6b')],'custom':_['endsWith'](_0x19e45d[_0x637c('0x26')],'_c')?!![]:![],'options':_0x19e45d[_0x637c('0x3b')]?_[_0x637c('0x28')](_[_0x637c('0x67')](_0x19e45d[_0x637c('0x3b')]),function(_0x371751){return{'name':_0x371751[_0x637c('0x6c')],'value':_0x371751[_0x637c('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x5bd5f2,null))[_0x637c('0x43')](function(_0x1e2412){var _0xf6d39c=_0x50cdea['query']['test']?0x1f4:_0x1e2412[_0x637c('0x6d')]||0x1f4;logger['error'](_0x637c('0x6e'),'getFields',_0xf6d39c,JSON['stringify'](_0x1e2412));delete _0x1e2412[_0x637c('0x26')];if(_0xf6d39c===0x191){_0xf6d39c=0x190;}_0x5bd5f2[_0x637c('0x1a')](_0xf6d39c)['send'](_0x50cdea[_0x637c('0x2e')][_0x637c('0x6f')]?{'message':_0x637c('0x70'),'statusCode':_0x1e2412[_0x637c('0x6d')]}:_0x1e2412);});}else{var _0xfd51d1=0x1f4;_0x5bd5f2['status'](_0xfd51d1)[_0x637c('0x71')]({'message':_0x637c('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb08b=['show','find','body','update','getConfigurations','findOne','params','SugarcrmConfiguration','order','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_name','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','Calls','module_fields','remove','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb08b,0x19f));var _0xbb08=function(_0x5f0a20,_0x51e115){_0x5f0a20=_0x5f0a20-0x0;var _0x2a9e9a=_0xb08b[_0x5f0a20];return _0x2a9e9a;};'use strict';var emlformat=require(_0xbb08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb08('0x1'));var jsonpatch=require(_0xbb08('0x2'));var rp=require('request-promise');var moment=require(_0xbb08('0x3'));var BPromise=require(_0xbb08('0x4'));var Mustache=require('mustache');var util=require(_0xbb08('0x5'));var path=require('path');var sox=require(_0xbb08('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb08('0x7'));var _=require(_0xbb08('0x8'));var squel=require(_0xbb08('0x9'));var crypto=require(_0xbb08('0xa'));var jsforce=require(_0xbb08('0xb'));var deskjs=require(_0xbb08('0xc'));var toCsv=require(_0xbb08('0xd'));var querystring=require(_0xbb08('0xe'));var Papa=require(_0xbb08('0xf'));var Redis=require(_0xbb08('0x10'));var authService=require(_0xbb08('0x11'));var qs=require(_0xbb08('0x12'));var as=require(_0xbb08('0x13'));var hardwareService=require(_0xbb08('0x14'));var logger=require(_0xbb08('0x15'))(_0xbb08('0x16'));var utils=require(_0xbb08('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb08('0x18'));var db=require(_0xbb08('0x19'))['db'];var integrations=require(_0xbb08('0x1a'));function respondWithStatusCode(_0x2afe65,_0x2e652e){_0x2e652e=_0x2e652e||0xcc;return function(_0x56feb4){if(_0x56feb4){return _0x2afe65[_0xbb08('0x1b')](_0x2e652e);}return _0x2afe65[_0xbb08('0x1c')](_0x2e652e)[_0xbb08('0x1d')]();};}function respondWithResult(_0x445d2d,_0x1f355a){_0x1f355a=_0x1f355a||0xc8;return function(_0x1b3ec3){if(_0x1b3ec3){return _0x445d2d[_0xbb08('0x1c')](_0x1f355a)[_0xbb08('0x1e')](_0x1b3ec3);}};}function respondWithFilteredResult(_0x477b12,_0x2f53e7){return function(_0x1d8aa8){if(_0x1d8aa8){var _0x1c5352=typeof _0x2f53e7[_0xbb08('0x1f')]===_0xbb08('0x20')&&typeof _0x2f53e7['limit']===_0xbb08('0x20');var _0x2e2990=_0x1d8aa8['count'];var _0x39a13c=_0x1c5352?0x0:_0x2f53e7[_0xbb08('0x1f')];var _0x59d4d4=_0x1c5352?_0x1d8aa8[_0xbb08('0x21')]:_0x2f53e7[_0xbb08('0x1f')]+_0x2f53e7[_0xbb08('0x22')];var _0x46ea06;if(_0x59d4d4>=_0x2e2990){_0x59d4d4=_0x2e2990;_0x46ea06=0xc8;}else{_0x46ea06=0xce;}_0x477b12[_0xbb08('0x1c')](_0x46ea06);return _0x477b12[_0xbb08('0x23')](_0xbb08('0x24'),_0x39a13c+'-'+_0x59d4d4+'/'+_0x2e2990)[_0xbb08('0x1e')](_0x1d8aa8);}return null;};}function patchUpdates(_0x15ff5b){return function(_0x408171){try{jsonpatch[_0xbb08('0x25')](_0x408171,_0x15ff5b,!![]);}catch(_0x4ffa0f){return BPromise[_0xbb08('0x26')](_0x4ffa0f);}return _0x408171[_0xbb08('0x27')]();};}function saveUpdates(_0xab349e,_0x157f4d){return function(_0x24276d){if(_0x24276d){return _0x24276d['update'](_0xab349e)[_0xbb08('0x28')](function(_0x2fda37){return _0x2fda37;});}return null;};}function removeEntity(_0x456247,_0x2b4443){return function(_0x30d9d0){if(_0x30d9d0){return _0x30d9d0[_0xbb08('0x29')]()[_0xbb08('0x28')](function(){_0x456247[_0xbb08('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12975f,_0x4a47fd){return function(_0x3891dc){if(!_0x3891dc){_0x12975f[_0xbb08('0x1b')](0x194);}return _0x3891dc;};}function handleError(_0xaf1114,_0x5ce6bc){_0x5ce6bc=_0x5ce6bc||0x1f4;return function(_0x2f8678){logger[_0xbb08('0x2a')](_0x2f8678[_0xbb08('0x2b')]);if(_0x2f8678[_0xbb08('0x2c')]){delete _0x2f8678[_0xbb08('0x2c')];}_0xaf1114[_0xbb08('0x1c')](_0x5ce6bc)['send'](_0x2f8678);};}exports[_0xbb08('0x2d')]=function(_0x54bddc,_0x2f067b){var _0x16d7c9={},_0x1b2b1f={},_0x2f16c1={'count':0x0,'rows':[]};var _0x446358=_['map'](db[_0xbb08('0x2e')][_0xbb08('0x2f')],function(_0x2c5f68){return{'name':_0x2c5f68[_0xbb08('0x30')],'type':_0x2c5f68[_0xbb08('0x31')][_0xbb08('0x32')]};});_0x1b2b1f[_0xbb08('0x33')]=_[_0xbb08('0x34')](_0x446358,_0xbb08('0x2c'));_0x1b2b1f[_0xbb08('0x35')]=_[_0xbb08('0x36')](_0x54bddc[_0xbb08('0x35')]);_0x1b2b1f[_0xbb08('0x37')]=_[_0xbb08('0x38')](_0x1b2b1f[_0xbb08('0x33')],_0x1b2b1f['query']);_0x16d7c9[_0xbb08('0x39')]=_['intersection'](_0x1b2b1f[_0xbb08('0x33')],qs['fields'](_0x54bddc[_0xbb08('0x35')][_0xbb08('0x3a')]));_0x16d7c9['attributes']=_0x16d7c9[_0xbb08('0x39')][_0xbb08('0x3b')]?_0x16d7c9[_0xbb08('0x39')]:_0x1b2b1f[_0xbb08('0x33')];if(!_0x54bddc['query'][_0xbb08('0x3c')]('nolimit')){_0x16d7c9['limit']=qs[_0xbb08('0x22')](_0x54bddc[_0xbb08('0x35')]['limit']);_0x16d7c9['offset']=qs[_0xbb08('0x1f')](_0x54bddc[_0xbb08('0x35')]['offset']);}_0x16d7c9['order']=qs[_0xbb08('0x3d')](_0x54bddc['query'][_0xbb08('0x3d')]);_0x16d7c9[_0xbb08('0x3e')]=qs[_0xbb08('0x37')](_[_0xbb08('0x3f')](_0x54bddc[_0xbb08('0x35')],_0x1b2b1f[_0xbb08('0x37')]),_0x446358);if(_0x54bddc[_0xbb08('0x35')][_0xbb08('0x40')]){_0x16d7c9[_0xbb08('0x3e')]=_[_0xbb08('0x41')](_0x16d7c9['where'],{'$or':_[_0xbb08('0x34')](_0x446358,function(_0x3e2cbc){if(_0x3e2cbc[_0xbb08('0x31')]!==_0xbb08('0x42')){var _0x299569={};_0x299569[_0x3e2cbc[_0xbb08('0x2c')]]={'$like':'%'+_0x54bddc[_0xbb08('0x35')][_0xbb08('0x40')]+'%'};return _0x299569;}})});}_0x16d7c9=_[_0xbb08('0x41')]({},_0x16d7c9,_0x54bddc[_0xbb08('0x43')]);var _0x1c0c80={'where':_0x16d7c9[_0xbb08('0x3e')]};return db['SugarcrmAccount']['count'](_0x1c0c80)[_0xbb08('0x28')](function(_0x5aed92){_0x2f16c1[_0xbb08('0x21')]=_0x5aed92;if(_0x54bddc['query'][_0xbb08('0x44')]){_0x16d7c9[_0xbb08('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xbb08('0x46')](_0x16d7c9);})[_0xbb08('0x28')](function(_0x1572d9){_0x2f16c1[_0xbb08('0x47')]=_0x1572d9;return _0x2f16c1;})[_0xbb08('0x28')](respondWithFilteredResult(_0x2f067b,_0x16d7c9))[_0xbb08('0x48')](handleError(_0x2f067b,null));};exports[_0xbb08('0x49')]=function(_0x5c00c7,_0x156c28){var _0x2331ee={'raw':![],'where':{'id':_0x5c00c7['params']['id']}},_0x3dc136={};_0x3dc136['model']=_[_0xbb08('0x36')](db[_0xbb08('0x2e')][_0xbb08('0x2f')]);_0x3dc136[_0xbb08('0x35')]=_[_0xbb08('0x36')](_0x5c00c7[_0xbb08('0x35')]);_0x3dc136[_0xbb08('0x37')]=_[_0xbb08('0x38')](_0x3dc136[_0xbb08('0x33')],_0x3dc136[_0xbb08('0x35')]);_0x2331ee[_0xbb08('0x39')]=_[_0xbb08('0x38')](_0x3dc136[_0xbb08('0x33')],qs[_0xbb08('0x3a')](_0x5c00c7[_0xbb08('0x35')][_0xbb08('0x3a')]));_0x2331ee[_0xbb08('0x39')]=_0x2331ee[_0xbb08('0x39')][_0xbb08('0x3b')]?_0x2331ee[_0xbb08('0x39')]:_0x3dc136[_0xbb08('0x33')];if(_0x5c00c7[_0xbb08('0x35')][_0xbb08('0x44')]){_0x2331ee[_0xbb08('0x45')]=[{'all':!![]}];}_0x2331ee=_[_0xbb08('0x41')]({},_0x2331ee,_0x5c00c7[_0xbb08('0x43')]);return db[_0xbb08('0x2e')][_0xbb08('0x4a')](_0x2331ee)[_0xbb08('0x28')](handleEntityNotFound(_0x156c28,null))[_0xbb08('0x28')](respondWithResult(_0x156c28,null))[_0xbb08('0x48')](handleError(_0x156c28,null));};exports['create']=function(_0xa6a16f,_0x28ef71){return db[_0xbb08('0x2e')]['create'](_0xa6a16f[_0xbb08('0x4b')],{})[_0xbb08('0x28')](respondWithResult(_0x28ef71,0xc9))[_0xbb08('0x48')](handleError(_0x28ef71,null));};exports[_0xbb08('0x4c')]=function(_0x1552a8,_0x15a714){if(_0x1552a8['body']['id']){delete _0x1552a8[_0xbb08('0x4b')]['id'];}return db[_0xbb08('0x2e')][_0xbb08('0x4a')]({'where':{'id':_0x1552a8['params']['id']}})[_0xbb08('0x28')](handleEntityNotFound(_0x15a714,null))[_0xbb08('0x28')](saveUpdates(_0x1552a8[_0xbb08('0x4b')],null))[_0xbb08('0x28')](respondWithResult(_0x15a714,null))[_0xbb08('0x48')](handleError(_0x15a714,null));};exports[_0xbb08('0x29')]=function(_0x32ea69,_0x450d77){return db[_0xbb08('0x2e')][_0xbb08('0x4a')]({'where':{'id':_0x32ea69['params']['id']}})[_0xbb08('0x28')](handleEntityNotFound(_0x450d77,null))[_0xbb08('0x28')](removeEntity(_0x450d77,null))['catch'](handleError(_0x450d77,null));};exports[_0xbb08('0x4d')]=function(_0x2478bc,_0x13756d,_0x324584){var _0x168be3={};var _0xda89bd={};var _0x5e1acc;var _0x25d827;return db[_0xbb08('0x2e')][_0xbb08('0x4e')]({'where':{'id':_0x2478bc[_0xbb08('0x4f')]['id']}})[_0xbb08('0x28')](handleEntityNotFound(_0x13756d,null))[_0xbb08('0x28')](function(_0x4483a2){if(_0x4483a2){_0x5e1acc=_0x4483a2;_0xda89bd[_0xbb08('0x33')]=_[_0xbb08('0x36')](db[_0xbb08('0x50')][_0xbb08('0x2f')]);_0xda89bd['query']=_['keys'](_0x2478bc[_0xbb08('0x35')]);_0xda89bd['filters']=_[_0xbb08('0x38')](_0xda89bd[_0xbb08('0x33')],_0xda89bd[_0xbb08('0x35')]);_0x168be3[_0xbb08('0x39')]=_[_0xbb08('0x38')](_0xda89bd['model'],qs[_0xbb08('0x3a')](_0x2478bc[_0xbb08('0x35')][_0xbb08('0x3a')]));_0x168be3[_0xbb08('0x39')]=_0x168be3[_0xbb08('0x39')][_0xbb08('0x3b')]?_0x168be3[_0xbb08('0x39')]:_0xda89bd[_0xbb08('0x33')];_0x168be3[_0xbb08('0x51')]=qs[_0xbb08('0x3d')](_0x2478bc['query'][_0xbb08('0x3d')]);_0x168be3[_0xbb08('0x3e')]=qs[_0xbb08('0x37')](_['pick'](_0x2478bc['query'],_0xda89bd[_0xbb08('0x37')]));if(_0x2478bc[_0xbb08('0x35')][_0xbb08('0x40')]){_0x168be3['where']=_['merge'](_0x168be3[_0xbb08('0x3e')],{'$or':_['map'](_0x168be3[_0xbb08('0x39')],function(_0x1ebbd8){var _0x31b67e={};_0x31b67e[_0x1ebbd8]={'$like':'%'+_0x2478bc['query']['filter']+'%'};return _0x31b67e;})});}_0x168be3=_['merge']({},_0x168be3,_0x2478bc[_0xbb08('0x43')]);return _0x5e1acc['getConfigurations'](_0x168be3);}})[_0xbb08('0x28')](function(_0x1e1e9b){if(_0x1e1e9b){_0x25d827=_0x1e1e9b[_0xbb08('0x3b')];if(!_0x2478bc[_0xbb08('0x35')]['hasOwnProperty'](_0xbb08('0x52'))){_0x168be3[_0xbb08('0x22')]=qs[_0xbb08('0x22')](_0x2478bc[_0xbb08('0x35')][_0xbb08('0x22')]);_0x168be3['offset']=qs['offset'](_0x2478bc[_0xbb08('0x35')][_0xbb08('0x1f')]);}return _0x5e1acc[_0xbb08('0x4d')](_0x168be3);}})['then'](function(_0x18562e){if(_0x18562e){return _0x18562e?{'count':_0x25d827,'rows':_0x18562e}:null;}})[_0xbb08('0x28')](respondWithResult(_0x13756d,null))[_0xbb08('0x48')](handleError(_0x13756d,null));};exports['addConfiguration']=function(_0x2be1a5,_0x1a0841,_0x309766){if(_0x2be1a5[_0xbb08('0x4b')]['id']){delete _0x2be1a5[_0xbb08('0x4b')]['id'];}return db[_0xbb08('0x2e')]['findOne']({'where':{'id':_0x2be1a5[_0xbb08('0x4f')]['id']}})[_0xbb08('0x28')](handleEntityNotFound(_0x1a0841,null))[_0xbb08('0x28')](function(_0x4a2244){if(_0x4a2244){_0x2be1a5['body'][_0xbb08('0x53')]=_0x4a2244['id'];_0x2be1a5['body'][_0xbb08('0x54')]=integrations[_0xbb08('0x55')](_0x2be1a5['body'][_0xbb08('0x56')],_0x2be1a5['body'][_0xbb08('0x31')]);_0x2be1a5['body'][_0xbb08('0x57')]=integrations[_0xbb08('0x58')](_0x2be1a5[_0xbb08('0x4b')][_0xbb08('0x56')],_0x2be1a5[_0xbb08('0x4b')]['type']);return db[_0xbb08('0x50')][_0xbb08('0x59')](_0x2be1a5[_0xbb08('0x4b')],{'include':[{'model':db[_0xbb08('0x5a')],'as':_0xbb08('0x54')},{'model':db[_0xbb08('0x5a')],'as':_0xbb08('0x57')}]});}return null;})[_0xbb08('0x28')](respondWithResult(_0x1a0841,null))[_0xbb08('0x48')](handleError(_0x1a0841,null));};exports[_0xbb08('0x5b')]=function(_0x29e2e6,_0x26d1ea,_0x46503c){var _0x1dd6fb='';var _0x11322d=['id',_0xbb08('0x2c'),'assigned_user_id','created_by',_0xbb08('0x5c'),'date_start',_0xbb08('0x5d'),_0xbb08('0x5e'),'parent_id','parent_type',_0xbb08('0x5f'),'direction'];return db[_0xbb08('0x2e')][_0xbb08('0x4e')]({'where':{'id':_0x29e2e6[_0xbb08('0x4f')]['id']},'attributes':['id','username',_0xbb08('0x60'),_0xbb08('0x61')]})[_0xbb08('0x28')](handleEntityNotFound(_0x26d1ea,null))[_0xbb08('0x28')](function(_0x335328){if(_0x335328){_0x1dd6fb=_0x335328['remoteUri'];var _0x175624=_0x1dd6fb['slice'](-0x1);if(_0x175624==='/'){_0x1dd6fb=_0x1dd6fb[_0xbb08('0x62')](0x0,_0x1dd6fb[_0xbb08('0x63')](_0x175624));}return rp({'method':'POST','uri':util[_0xbb08('0x64')](_0xbb08('0x65'),_0x1dd6fb,_0xbb08('0x66')),'json':!![],'form':{'method':_0xbb08('0x67'),'input_type':_0xbb08('0x68'),'response_type':_0xbb08('0x68'),'rest_data':JSON[_0xbb08('0x69')]({'user_auth':{'user_name':_0x335328[_0xbb08('0x6a')],'password':_0x335328['password'],'encryption':_0xbb08('0x6b')},'application':_0xbb08('0x6c')})}});}})[_0xbb08('0x28')](function(_0x375944){if(_0x375944&&_0x375944['name']!=='Invalid\x20Login'&&_0x375944[_0xbb08('0x2c')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xbb08('0x64')](_0xbb08('0x65'),_0x1dd6fb,_0xbb08('0x66')),'json':!![],'form':{'method':_0xbb08('0x6d'),'input_type':_0xbb08('0x68'),'response_type':_0xbb08('0x68'),'rest_data':JSON[_0xbb08('0x69')]({'session':_0x375944['id'],'module_name':_0xbb08('0x6e')})}})['then'](function(_0x4581c5){if(_0x4581c5){var _0x250819=_['values'](_0x4581c5[_0xbb08('0x6f')]);_[_0xbb08('0x70')](_0x250819,function(_0x146a88){return _0x11322d['includes'](_0x146a88[_0xbb08('0x2c')]);});return{'count':_0x250819['length'],'rows':_['map'](_0x250819,function(_0x46cbf3){return{'id':_0x46cbf3[_0xbb08('0x2c')],'name':_0x46cbf3[_0xbb08('0x71')],'custom':_[_0xbb08('0x72')](_0x46cbf3[_0xbb08('0x2c')],'_c')?!![]:![],'options':_0x46cbf3[_0xbb08('0x43')]?_[_0xbb08('0x34')](_[_0xbb08('0x73')](_0x46cbf3[_0xbb08('0x43')]),function(_0x41ab8b){return{'name':_0x41ab8b[_0xbb08('0x74')],'value':_0x41ab8b[_0xbb08('0x2c')]};}):[]};})};}})[_0xbb08('0x28')](respondWithResult(_0x26d1ea,null))['catch'](function(_0xd108ac){var _0x310e58=_0x29e2e6[_0xbb08('0x35')][_0xbb08('0x75')]?0x1f4:_0xd108ac[_0xbb08('0x76')]||0x1f4;logger[_0xbb08('0x2a')](_0xbb08('0x77'),_0xbb08('0x5b'),_0x310e58,JSON['stringify'](_0xd108ac));delete _0xd108ac[_0xbb08('0x2c')];if(_0x310e58===0x191){_0x310e58=0x190;}_0x26d1ea[_0xbb08('0x1c')](_0x310e58)[_0xbb08('0x78')](_0x29e2e6[_0xbb08('0x35')]['test']?{'message':_0xbb08('0x79'),'statusCode':_0xd108ac['statusCode']}:_0xd108ac);});}else{var _0x5c9626=0x1f4;_0x26d1ea[_0xbb08('0x1c')](_0x5c9626)[_0xbb08('0x78')]({'message':_0xbb08('0x79'),'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 f5fce89..87dc3e8 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 _0x337f=['rimraf','../../config/environment','../../components/integrations/configuration','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x18fb62,_0x2bf8cf){var _0x5edc13=function(_0x420b22){while(--_0x420b22){_0x18fb62['push'](_0x18fb62['shift']());}};_0x5edc13(++_0x2bf8cf);}(_0x337f,0x11c));var _0xf337=function(_0x5dc8dd,_0x10ada4){_0x5dc8dd=_0x5dc8dd-0x0;var _0x16d583=_0x337f[_0x5dc8dd];return _0x16d583;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var logger=require(_0xf337('0x2'))('api');var moment=require(_0xf337('0x3'));var BPromise=require(_0xf337('0x4'));var rp=require(_0xf337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf337('0x8'));module['exports']=function(_0x4580a3,_0x5ae4d6){return _0x4580a3[_0xf337('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x3fe365,_0x366dc2){var _0x404f2d=function(_0x40f2db){while(--_0x40f2db){_0x3fe365['push'](_0x3fe365['shift']());}};_0x404f2d(++_0x366dc2);}(_0xef0a,0xdd));var _0xaef0=function(_0x1556e7,_0x45f7a9){_0x1556e7=_0x1556e7-0x0;var _0x7c06dc=_0xef0a[_0x1556e7];return _0x7c06dc;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var logger=require(_0xaef0('0x2'))(_0xaef0('0x3'));var moment=require(_0xaef0('0x4'));var BPromise=require(_0xaef0('0x5'));var rp=require(_0xaef0('0x6'));var fs=require('fs');var path=require(_0xaef0('0x7'));var rimraf=require(_0xaef0('0x8'));var config=require(_0xaef0('0x9'));var attributes=require(_0xaef0('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xaef0('0xb')]=function(_0x12dd17,_0x273fae){return _0x12dd17[_0xaef0('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 d39eda2..86a3de8 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 _0xf149=['map','then','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','limit','include','attributes','model'];(function(_0x5b5a08,_0x305a30){var _0x4f550f=function(_0x4cc4f1){while(--_0x4cc4f1){_0x5b5a08['push'](_0x5b5a08['shift']());}};_0x4f550f(++_0x305a30);}(_0xf149,0x97));var _0x9f14=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xf149[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var moment=require(_0x9f14('0x2'));var BPromise=require(_0x9f14('0x3'));var rs=require(_0x9f14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f14('0x5'))['db'];var utils=require(_0x9f14('0x6'));var logger=require(_0x9f14('0x7'))(_0x9f14('0x8'));var config=require(_0x9f14('0x9'));var jayson=require(_0x9f14('0xa'));var client=jayson[_0x9f14('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2126ef,_0x2122e2,_0x1f8079){return new BPromise(function(_0x2444df,_0x1e240e){return client['request'](_0x2126ef,_0x1f8079)['then'](function(_0x557c3f){logger[_0x9f14('0xc')](_0x9f14('0xd'),_0x2122e2,_0x9f14('0xe'));logger['debug'](_0x9f14('0xf'),_0x2122e2,_0x9f14('0xe'),JSON[_0x9f14('0x10')](_0x557c3f));if(_0x557c3f[_0x9f14('0x11')]){if(_0x557c3f[_0x9f14('0x11')][_0x9f14('0x12')]===0x1f4){logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x557c3f[_0x9f14('0x11')][_0x9f14('0x13')]);return _0x1e240e(_0x557c3f[_0x9f14('0x11')]['message']);}logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x557c3f[_0x9f14('0x11')][_0x9f14('0x13')]);return _0x2444df(_0x557c3f['error'][_0x9f14('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x2122e2,'request\x20sent');_0x2444df(_0x557c3f['result'][_0x9f14('0x13')]);}})[_0x9f14('0x14')](function(_0x5069b){logger[_0x9f14('0x11')](_0x9f14('0xd'),_0x2122e2,_0x5069b);_0x1e240e(_0x5069b);});});}exports['GetSugarcrmAccount']=function(_0x2b5a9c){var _0x251fc3=this;return new Promise(function(_0x5d2ce1,_0x1b6cb0){return db['SugarcrmAccount'][_0x9f14('0x15')]({'raw':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x17')]===undefined?!![]:![]:!![],'where':_0x2b5a9c['options']?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x18')]||null:null,'attributes':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')]['attributes']||null:null,'limit':_0x2b5a9c['options']?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x19')]||null:null,'include':_0x2b5a9c[_0x9f14('0x16')]?_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x1a')]?_['map'](_0x2b5a9c[_0x9f14('0x16')][_0x9f14('0x1a')],function(_0x22bc8d){return{'model':db[_0x22bc8d['model']],'as':_0x22bc8d['as'],'attributes':_0x22bc8d[_0x9f14('0x1b')],'include':_0x22bc8d['include']?_['map'](_0x22bc8d[_0x9f14('0x1a')],function(_0x51dd61){return{'model':db[_0x51dd61[_0x9f14('0x1c')]],'as':_0x51dd61['as'],'attributes':_0x51dd61[_0x9f14('0x1b')],'include':_0x51dd61[_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x51dd61[_0x9f14('0x1a')],function(_0xca5b9d){return{'model':db[_0xca5b9d[_0x9f14('0x1c')]],'as':_0xca5b9d['as'],'attributes':_0xca5b9d[_0x9f14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9f14('0x1e')](function(_0x46242d){logger[_0x9f14('0xc')](_0x9f14('0x1f'),_0x2b5a9c);logger['debug'](_0x9f14('0x1f'),_0x2b5a9c,JSON['stringify'](_0x46242d));_0x5d2ce1(_0x46242d);})[_0x9f14('0x14')](function(_0x55e669){logger[_0x9f14('0x11')](_0x9f14('0x1f'),_0x55e669[_0x9f14('0x13')],_0x2b5a9c);_0x1b6cb0(_0x251fc3[_0x9f14('0x11')](0x1f4,_0x55e669['message']));});});};exports[_0x9f14('0x20')]=function(_0x57bf83){var _0x453c36=this;return new Promise(function(_0x202de8,_0x2dcd1d){return db[_0x9f14('0x21')][_0x9f14('0x22')]({'raw':_0x57bf83[_0x9f14('0x16')]?_0x57bf83['options'][_0x9f14('0x17')]===undefined?!![]:![]:!![],'where':_0x57bf83['options']?_0x57bf83[_0x9f14('0x16')]['where']||null:null,'attributes':_0x57bf83[_0x9f14('0x16')]?_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1b')]||null:null,'include':_0x57bf83[_0x9f14('0x16')]?_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x57bf83[_0x9f14('0x16')][_0x9f14('0x1a')],function(_0x15893b){return{'model':db[_0x15893b[_0x9f14('0x1c')]],'as':_0x15893b['as'],'attributes':_0x15893b[_0x9f14('0x1b')],'include':_0x15893b[_0x9f14('0x1a')]?_['map'](_0x15893b['include'],function(_0x4672e5){return{'model':db[_0x4672e5[_0x9f14('0x1c')]],'as':_0x4672e5['as'],'attributes':_0x4672e5[_0x9f14('0x1b')],'include':_0x4672e5[_0x9f14('0x1a')]?_[_0x9f14('0x1d')](_0x4672e5['include'],function(_0x26db3d){return{'model':db[_0x26db3d['model']],'as':_0x26db3d['as'],'attributes':_0x26db3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f14('0x1e')](function(_0x400e0d){logger['info']('ShowSugarcrmAccount',_0x57bf83);logger[_0x9f14('0x23')](_0x9f14('0x20'),_0x57bf83,JSON[_0x9f14('0x10')](_0x400e0d));_0x202de8(_0x400e0d);})[_0x9f14('0x14')](function(_0x3de84d){logger[_0x9f14('0x11')](_0x9f14('0x20'),_0x3de84d[_0x9f14('0x13')],_0x57bf83);_0x2dcd1d(_0x453c36['error'](0x1f4,_0x3de84d['message']));});});}; \ No newline at end of file +var _0x3471=['find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','include','map','model','attributes','debug','ShowSugarcrmAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3471,0x156));var _0x1347=function(_0x9dc4ed,_0x4ec3f6){_0x9dc4ed=_0x9dc4ed-0x0;var _0x45fef2=_0x3471[_0x9dc4ed];return _0x45fef2;};'use strict';var _=require(_0x1347('0x0'));var util=require(_0x1347('0x1'));var moment=require('moment');var BPromise=require(_0x1347('0x2'));var rs=require(_0x1347('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1347('0x4'))['db'];var utils=require(_0x1347('0x5'));var logger=require('../../config/logger')(_0x1347('0x6'));var config=require(_0x1347('0x7'));var jayson=require(_0x1347('0x8'));var client=jayson[_0x1347('0x9')][_0x1347('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58821b,_0x4c828e,_0x12aeee){return new BPromise(function(_0x2812f6,_0x3fa205){return client['request'](_0x58821b,_0x12aeee)[_0x1347('0xb')](function(_0x4e039c){logger[_0x1347('0xc')](_0x1347('0xd'),_0x4c828e,_0x1347('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4c828e,_0x1347('0xe'),JSON[_0x1347('0xf')](_0x4e039c));if(_0x4e039c[_0x1347('0x10')]){if(_0x4e039c['error'][_0x1347('0x11')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4c828e,_0x4e039c[_0x1347('0x10')][_0x1347('0x12')]);return _0x3fa205(_0x4e039c['error']['message']);}logger[_0x1347('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x4c828e,_0x4e039c[_0x1347('0x10')][_0x1347('0x12')]);return _0x2812f6(_0x4e039c[_0x1347('0x10')]['message']);}else{logger['info'](_0x1347('0xd'),_0x4c828e,_0x1347('0xe'));_0x2812f6(_0x4e039c[_0x1347('0x13')]['message']);}})[_0x1347('0x14')](function(_0x5e0d5c){logger[_0x1347('0x10')](_0x1347('0xd'),_0x4c828e,_0x5e0d5c);_0x3fa205(_0x5e0d5c);});});}exports[_0x1347('0x15')]=function(_0x4ffd6f){var _0x5305c5=this;return new Promise(function(_0x366204,_0x366ca1){return db[_0x1347('0x16')][_0x1347('0x17')]({'raw':_0x4ffd6f[_0x1347('0x18')]?_0x4ffd6f[_0x1347('0x18')][_0x1347('0x19')]===undefined?!![]:![]:!![],'where':_0x4ffd6f[_0x1347('0x18')]?_0x4ffd6f[_0x1347('0x18')]['where']||null:null,'attributes':_0x4ffd6f['options']?_0x4ffd6f[_0x1347('0x18')]['attributes']||null:null,'limit':_0x4ffd6f[_0x1347('0x18')]?_0x4ffd6f['options']['limit']||null:null,'include':_0x4ffd6f['options']?_0x4ffd6f['options'][_0x1347('0x1a')]?_[_0x1347('0x1b')](_0x4ffd6f['options']['include'],function(_0x49297e){return{'model':db[_0x49297e[_0x1347('0x1c')]],'as':_0x49297e['as'],'attributes':_0x49297e[_0x1347('0x1d')],'include':_0x49297e[_0x1347('0x1a')]?_[_0x1347('0x1b')](_0x49297e[_0x1347('0x1a')],function(_0x40acaa){return{'model':db[_0x40acaa['model']],'as':_0x40acaa['as'],'attributes':_0x40acaa[_0x1347('0x1d')],'include':_0x40acaa['include']?_[_0x1347('0x1b')](_0x40acaa[_0x1347('0x1a')],function(_0x36d908){return{'model':db[_0x36d908[_0x1347('0x1c')]],'as':_0x36d908['as'],'attributes':_0x36d908[_0x1347('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1347('0xb')](function(_0x3b8174){logger[_0x1347('0xc')](_0x1347('0x15'),_0x4ffd6f);logger[_0x1347('0x1e')](_0x1347('0x15'),_0x4ffd6f,JSON[_0x1347('0xf')](_0x3b8174));_0x366204(_0x3b8174);})[_0x1347('0x14')](function(_0x549635){logger[_0x1347('0x10')](_0x1347('0x15'),_0x549635[_0x1347('0x12')],_0x4ffd6f);_0x366ca1(_0x5305c5[_0x1347('0x10')](0x1f4,_0x549635[_0x1347('0x12')]));});});};exports[_0x1347('0x1f')]=function(_0x543d59){var _0x5bde8d=this;return new Promise(function(_0x344c48,_0x5ed344){return db[_0x1347('0x16')][_0x1347('0x20')]({'raw':_0x543d59[_0x1347('0x18')]?_0x543d59['options'][_0x1347('0x19')]===undefined?!![]:![]:!![],'where':_0x543d59[_0x1347('0x18')]?_0x543d59[_0x1347('0x18')][_0x1347('0x21')]||null:null,'attributes':_0x543d59[_0x1347('0x18')]?_0x543d59[_0x1347('0x18')][_0x1347('0x1d')]||null:null,'include':_0x543d59['options']?_0x543d59[_0x1347('0x18')][_0x1347('0x1a')]?_['map'](_0x543d59[_0x1347('0x18')]['include'],function(_0xb484e2){return{'model':db[_0xb484e2['model']],'as':_0xb484e2['as'],'attributes':_0xb484e2[_0x1347('0x1d')],'include':_0xb484e2[_0x1347('0x1a')]?_[_0x1347('0x1b')](_0xb484e2[_0x1347('0x1a')],function(_0x572855){return{'model':db[_0x572855[_0x1347('0x1c')]],'as':_0x572855['as'],'attributes':_0x572855[_0x1347('0x1d')],'include':_0x572855[_0x1347('0x1a')]?_[_0x1347('0x1b')](_0x572855['include'],function(_0x4b9983){return{'model':db[_0x4b9983[_0x1347('0x1c')]],'as':_0x4b9983['as'],'attributes':_0x4b9983[_0x1347('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1347('0xb')](function(_0x4c301f){logger['info'](_0x1347('0x1f'),_0x543d59);logger[_0x1347('0x1e')](_0x1347('0x1f'),_0x543d59,JSON[_0x1347('0xf')](_0x4c301f));_0x344c48(_0x4c301f);})['catch'](function(_0x19c5bd){logger[_0x1347('0x10')](_0x1347('0x1f'),_0x19c5bd[_0x1347('0x12')],_0x543d59);_0x5ed344(_0x5bde8d[_0x1347('0x10')](0x1f4,_0x19c5bd[_0x1347('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9b8e24e..4f73918 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 _0xdd7a=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x4a328f,_0xd272ee){var _0x369988=function(_0x3eebff){while(--_0x3eebff){_0x4a328f['push'](_0x4a328f['shift']());}};_0x369988(++_0xd272ee);}(_0xdd7a,0x8e));var _0xadd7=function(_0xb8d136,_0x2992dc){_0xb8d136=_0xb8d136-0x0;var _0x2bc98a=_0xdd7a[_0xb8d136];return _0x2bc98a;};'use strict';var multer=require(_0xadd7('0x0'));var util=require(_0xadd7('0x1'));var path=require('path');var timeout=require(_0xadd7('0x2'));var express=require(_0xadd7('0x3'));var router=express[_0xadd7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xadd7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xadd7('0x6'));var controller=require(_0xadd7('0x7'));router[_0xadd7('0x8')]('/',auth[_0xadd7('0x9')](),controller[_0xadd7('0xa')]);router[_0xadd7('0x8')](_0xadd7('0xb'),auth[_0xadd7('0x9')](),controller[_0xadd7('0xc')]);router[_0xadd7('0x8')](_0xadd7('0xd'),auth[_0xadd7('0x9')](),controller['getFields']);router[_0xadd7('0x8')](_0xadd7('0xe'),auth[_0xadd7('0x9')](),controller[_0xadd7('0xf')]);router[_0xadd7('0x8')](_0xadd7('0x10'),auth['isAuthenticated'](),controller[_0xadd7('0x11')]);router[_0xadd7('0x12')]('/',auth['isAuthenticated'](),controller[_0xadd7('0x13')]);router[_0xadd7('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xadd7('0x15')]);router[_0xadd7('0x16')](_0xadd7('0xb'),auth[_0xadd7('0x9')](),controller[_0xadd7('0x17')]);module[_0xadd7('0x18')]=router; \ No newline at end of file +var _0x3b4a=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x594dc7,_0x269225){var _0x2e287d=function(_0x57f96c){while(--_0x57f96c){_0x594dc7['push'](_0x594dc7['shift']());}};_0x2e287d(++_0x269225);}(_0x3b4a,0x135));var _0xa3b4=function(_0x442614,_0x2542e5){_0x442614=_0x442614-0x0;var _0x225e21=_0x3b4a[_0x442614];return _0x225e21;};'use strict';var multer=require(_0xa3b4('0x0'));var util=require('util');var path=require(_0xa3b4('0x1'));var timeout=require(_0xa3b4('0x2'));var express=require(_0xa3b4('0x3'));var router=express['Router']();var fs_extra=require(_0xa3b4('0x4'));var auth=require(_0xa3b4('0x5'));var interaction=require(_0xa3b4('0x6'));var config=require('../../config/environment');var controller=require(_0xa3b4('0x7'));router[_0xa3b4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa3b4('0x8')]('/:id',auth[_0xa3b4('0x9')](),controller[_0xa3b4('0xa')]);router[_0xa3b4('0x8')](_0xa3b4('0xb'),auth[_0xa3b4('0x9')](),controller['getFields']);router[_0xa3b4('0x8')](_0xa3b4('0xc'),auth[_0xa3b4('0x9')](),controller[_0xa3b4('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa3b4('0xe')]);router[_0xa3b4('0xf')]('/',auth[_0xa3b4('0x9')](),controller['create']);router[_0xa3b4('0x10')](_0xa3b4('0x11'),auth[_0xa3b4('0x9')](),controller['update']);router[_0xa3b4('0x12')](_0xa3b4('0x11'),auth[_0xa3b4('0x9')](),controller[_0xa3b4('0x13')]);module[_0xa3b4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bdd63e2..5f04814 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 _0x2455=['STRING','sequelize','exports'];(function(_0x5ac93e,_0x1e9514){var _0x349d2c=function(_0x3b9220){while(--_0x3b9220){_0x5ac93e['push'](_0x5ac93e['shift']());}};_0x349d2c(++_0x1e9514);}(_0x2455,0x1e1));var _0x5245=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x2455[_0x39bc06];return _0x131143;};'use strict';var Sequelize=require(_0x5245('0x0'));module[_0x5245('0x1')]={'name':{'type':Sequelize[_0x5245('0x2')]},'description':{'type':Sequelize[_0x5245('0x2')]}}; \ No newline at end of file +var _0xa9b6=['STRING','exports'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xa9b6,0x7f));var _0x6a9b=function(_0xfced73,_0x409a1f){_0xfced73=_0xfced73-0x0;var _0x4f3730=_0xa9b6[_0xfced73];return _0x4f3730;};'use strict';var Sequelize=require('sequelize');module[_0x6a9b('0x0')]={'name':{'type':Sequelize[_0x6a9b('0x1')]},'description':{'type':Sequelize[_0x6a9b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a47322d..4fa6360 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 _0x5539=['sendStatus','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','update','getFields','SugarcrmField','sort','filter','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','then','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5539,0x7c));var _0x9553=function(_0x344890,_0x3332a2){_0x344890=_0x344890-0x0;var _0x210860=_0x5539[_0x344890];return _0x210860;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9553('0x0'));var zipdir=require(_0x9553('0x1'));var jsonpatch=require(_0x9553('0x2'));var rp=require(_0x9553('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9553('0x4'));var util=require(_0x9553('0x5'));var path=require(_0x9553('0x6'));var sox=require('sox');var csv=require(_0x9553('0x7'));var ejs=require(_0x9553('0x8'));var fs=require('fs');var fs_extra=require(_0x9553('0x9'));var _=require(_0x9553('0xa'));var squel=require(_0x9553('0xb'));var crypto=require(_0x9553('0xc'));var jsforce=require(_0x9553('0xd'));var deskjs=require(_0x9553('0xe'));var toCsv=require(_0x9553('0x7'));var querystring=require(_0x9553('0xf'));var Papa=require(_0x9553('0x10'));var Redis=require(_0x9553('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9553('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9553('0x13'));var logger=require(_0x9553('0x14'))(_0x9553('0x15'));var utils=require('../../config/utils');var config=require(_0x9553('0x16'));var licenseUtil=require(_0x9553('0x17'));var db=require(_0x9553('0x18'))['db'];function respondWithStatusCode(_0x2ff187,_0x108ed9){_0x108ed9=_0x108ed9||0xcc;return function(_0x2b6c00){if(_0x2b6c00){return _0x2ff187['sendStatus'](_0x108ed9);}return _0x2ff187['status'](_0x108ed9)[_0x9553('0x19')]();};}function respondWithResult(_0x1e6973,_0x299222){_0x299222=_0x299222||0xc8;return function(_0x1cf804){if(_0x1cf804){return _0x1e6973[_0x9553('0x1a')](_0x299222)[_0x9553('0x1b')](_0x1cf804);}};}function respondWithFilteredResult(_0x3db344,_0x10d506){return function(_0x38147b){if(_0x38147b){var _0x59014d=typeof _0x10d506[_0x9553('0x1c')]===_0x9553('0x1d')&&typeof _0x10d506[_0x9553('0x1e')]===_0x9553('0x1d');var _0x27c4fc=_0x38147b[_0x9553('0x1f')];var _0x4901fa=_0x59014d?0x0:_0x10d506[_0x9553('0x1c')];var _0x43899f=_0x59014d?_0x38147b[_0x9553('0x1f')]:_0x10d506[_0x9553('0x1c')]+_0x10d506['limit'];var _0x1086ea;if(_0x43899f>=_0x27c4fc){_0x43899f=_0x27c4fc;_0x1086ea=0xc8;}else{_0x1086ea=0xce;}_0x3db344[_0x9553('0x1a')](_0x1086ea);return _0x3db344[_0x9553('0x20')]('Content-Range',_0x4901fa+'-'+_0x43899f+'/'+_0x27c4fc)[_0x9553('0x1b')](_0x38147b);}return null;};}function patchUpdates(_0x4a438c){return function(_0x2cca45){try{jsonpatch[_0x9553('0x21')](_0x2cca45,_0x4a438c,!![]);}catch(_0x5370a8){return BPromise['reject'](_0x5370a8);}return _0x2cca45['save']();};}function saveUpdates(_0x232bcc,_0x5cc922){return function(_0x595ca8){if(_0x595ca8){return _0x595ca8['update'](_0x232bcc)[_0x9553('0x22')](function(_0x5186dc){return _0x5186dc;});}return null;};}function removeEntity(_0x44e43d,_0x9b0363){return function(_0x343e3f){if(_0x343e3f){return _0x343e3f[_0x9553('0x23')]()['then'](function(){_0x44e43d[_0x9553('0x1a')](0xcc)[_0x9553('0x19')]();});}};}function handleEntityNotFound(_0x24d966,_0x13d391){return function(_0x1a16c4){if(!_0x1a16c4){_0x24d966[_0x9553('0x24')](0x194);}return _0x1a16c4;};}function handleError(_0x18a1b5,_0x38240f){_0x38240f=_0x38240f||0x1f4;return function(_0xb1e0b){logger[_0x9553('0x25')](_0xb1e0b['stack']);if(_0xb1e0b[_0x9553('0x26')]){delete _0xb1e0b[_0x9553('0x26')];}_0x18a1b5[_0x9553('0x1a')](_0x38240f)[_0x9553('0x27')](_0xb1e0b);};}exports[_0x9553('0x28')]=function(_0x3f49a3,_0x590d07){var _0x3089d3={},_0x230675={},_0x31bb57={'count':0x0,'rows':[]};var _0xa3c335=_['map'](db[_0x9553('0x29')][_0x9553('0x2a')],function(_0x552697){return{'name':_0x552697[_0x9553('0x2b')],'type':_0x552697['type'][_0x9553('0x2c')]};});_0x230675[_0x9553('0x2d')]=_[_0x9553('0x2e')](_0xa3c335,_0x9553('0x26'));_0x230675['query']=_[_0x9553('0x2f')](_0x3f49a3[_0x9553('0x30')]);_0x230675[_0x9553('0x31')]=_[_0x9553('0x32')](_0x230675['model'],_0x230675[_0x9553('0x30')]);_0x3089d3[_0x9553('0x33')]=_[_0x9553('0x32')](_0x230675[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x3f49a3['query']['fields']));_0x3089d3[_0x9553('0x33')]=_0x3089d3[_0x9553('0x33')][_0x9553('0x35')]?_0x3089d3[_0x9553('0x33')]:_0x230675[_0x9553('0x2d')];if(!_0x3f49a3[_0x9553('0x30')]['hasOwnProperty'](_0x9553('0x36'))){_0x3089d3[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x3f49a3[_0x9553('0x30')][_0x9553('0x1e')]);_0x3089d3[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x3f49a3['query'][_0x9553('0x1c')]);}_0x3089d3[_0x9553('0x37')]=qs['sort'](_0x3f49a3[_0x9553('0x30')]['sort']);_0x3089d3[_0x9553('0x38')]=qs[_0x9553('0x31')](_[_0x9553('0x39')](_0x3f49a3[_0x9553('0x30')],_0x230675['filters']),_0xa3c335);if(_0x3f49a3['query']['filter']){_0x3089d3['where']=_['merge'](_0x3089d3['where'],{'$or':_['map'](_0xa3c335,function(_0x524cc2){if(_0x524cc2[_0x9553('0x3a')]!==_0x9553('0x3b')){var _0x4b7679={};_0x4b7679[_0x524cc2['name']]={'$like':'%'+_0x3f49a3[_0x9553('0x30')]['filter']+'%'};return _0x4b7679;}})});}_0x3089d3=_['merge']({},_0x3089d3,_0x3f49a3[_0x9553('0x3c')]);var _0x170240={'where':_0x3089d3[_0x9553('0x38')]};return db[_0x9553('0x29')]['count'](_0x170240)[_0x9553('0x22')](function(_0xb973ad){_0x31bb57[_0x9553('0x1f')]=_0xb973ad;if(_0x3f49a3[_0x9553('0x30')][_0x9553('0x3d')]){_0x3089d3[_0x9553('0x3e')]=[{'all':!![]}];}return db[_0x9553('0x29')]['findAll'](_0x3089d3);})[_0x9553('0x22')](function(_0x2025b6){_0x31bb57[_0x9553('0x3f')]=_0x2025b6;return _0x31bb57;})[_0x9553('0x22')](respondWithFilteredResult(_0x590d07,_0x3089d3))[_0x9553('0x40')](handleError(_0x590d07,null));};exports[_0x9553('0x41')]=function(_0x30ae44,_0x22b784){var _0x7a8dea={'raw':![],'where':{'id':_0x30ae44[_0x9553('0x42')]['id']}},_0x3f7307={};_0x3f7307['model']=_['keys'](db[_0x9553('0x29')][_0x9553('0x2a')]);_0x3f7307['query']=_['keys'](_0x30ae44[_0x9553('0x30')]);_0x3f7307[_0x9553('0x31')]=_[_0x9553('0x32')](_0x3f7307[_0x9553('0x2d')],_0x3f7307[_0x9553('0x30')]);_0x7a8dea['attributes']=_['intersection'](_0x3f7307[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x30ae44[_0x9553('0x30')][_0x9553('0x34')]));_0x7a8dea['attributes']=_0x7a8dea[_0x9553('0x33')][_0x9553('0x35')]?_0x7a8dea[_0x9553('0x33')]:_0x3f7307['model'];if(_0x30ae44[_0x9553('0x30')][_0x9553('0x3d')]){_0x7a8dea['include']=[{'all':!![]}];}_0x7a8dea=_[_0x9553('0x43')]({},_0x7a8dea,_0x30ae44['options']);return db[_0x9553('0x29')][_0x9553('0x44')](_0x7a8dea)[_0x9553('0x22')](handleEntityNotFound(_0x22b784,null))['then'](respondWithResult(_0x22b784,null))[_0x9553('0x40')](handleError(_0x22b784,null));};exports[_0x9553('0x45')]=function(_0x143fc7,_0x3ef7db){return db[_0x9553('0x29')][_0x9553('0x45')](_0x143fc7[_0x9553('0x46')],{})[_0x9553('0x22')](respondWithResult(_0x3ef7db,0xc9))[_0x9553('0x40')](handleError(_0x3ef7db,null));};exports[_0x9553('0x47')]=function(_0x3f9966,_0x56cba7){if(_0x3f9966[_0x9553('0x46')]['id']){delete _0x3f9966['body']['id'];}return db[_0x9553('0x29')]['find']({'where':{'id':_0x3f9966[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x56cba7,null))[_0x9553('0x22')](saveUpdates(_0x3f9966[_0x9553('0x46')],null))[_0x9553('0x22')](respondWithResult(_0x56cba7,null))[_0x9553('0x40')](handleError(_0x56cba7,null));};exports['destroy']=function(_0x4c1d14,_0x26e1d6){return db['SugarcrmConfiguration'][_0x9553('0x44')]({'where':{'id':_0x4c1d14[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x26e1d6,null))[_0x9553('0x22')](removeEntity(_0x26e1d6,null))[_0x9553('0x40')](handleError(_0x26e1d6,null));};exports[_0x9553('0x48')]=function(_0x2234de,_0x10929a,_0x11aa82){var _0x213521={};var _0x94d6af={};var _0x20859b;var _0x2dc925;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2234de[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0x10929a,null))[_0x9553('0x22')](function(_0x139312){if(_0x139312){_0x20859b=_0x139312;_0x94d6af[_0x9553('0x2d')]=_[_0x9553('0x2f')](db[_0x9553('0x49')]['rawAttributes']);_0x94d6af[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x2234de[_0x9553('0x30')]);_0x94d6af['filters']=_[_0x9553('0x32')](_0x94d6af[_0x9553('0x2d')],_0x94d6af[_0x9553('0x30')]);_0x213521[_0x9553('0x33')]=_[_0x9553('0x32')](_0x94d6af[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x2234de[_0x9553('0x30')][_0x9553('0x34')]));_0x213521[_0x9553('0x33')]=_0x213521['attributes']['length']?_0x213521[_0x9553('0x33')]:_0x94d6af[_0x9553('0x2d')];_0x213521[_0x9553('0x37')]=qs['sort'](_0x2234de[_0x9553('0x30')][_0x9553('0x4a')]);_0x213521['where']=qs[_0x9553('0x31')](_['pick'](_0x2234de[_0x9553('0x30')],_0x94d6af[_0x9553('0x31')]));if(_0x2234de[_0x9553('0x30')][_0x9553('0x4b')]){_0x213521[_0x9553('0x38')]=_[_0x9553('0x43')](_0x213521[_0x9553('0x38')],{'$or':_[_0x9553('0x2e')](_0x213521['attributes'],function(_0x267c44){var _0x1679c8={};_0x1679c8[_0x267c44]={'$like':'%'+_0x2234de[_0x9553('0x30')]['filter']+'%'};return _0x1679c8;})});}_0x213521=_[_0x9553('0x43')]({},_0x213521,_0x2234de[_0x9553('0x3c')]);return _0x20859b['getFields'](_0x213521);}})[_0x9553('0x22')](function(_0x240139){if(_0x240139){_0x2dc925=_0x240139[_0x9553('0x35')];if(!_0x2234de[_0x9553('0x30')][_0x9553('0x4c')](_0x9553('0x36'))){_0x213521[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x2234de[_0x9553('0x30')][_0x9553('0x1e')]);_0x213521[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x2234de['query'][_0x9553('0x1c')]);}return _0x20859b[_0x9553('0x48')](_0x213521);}})[_0x9553('0x22')](function(_0x5d8a54){if(_0x5d8a54){return _0x5d8a54?{'count':_0x2dc925,'rows':_0x5d8a54}:null;}})[_0x9553('0x22')](respondWithResult(_0x10929a,null))[_0x9553('0x40')](handleError(_0x10929a,null));};exports[_0x9553('0x4d')]=function(_0x3c12b5,_0x4075cf,_0x2445b1){var _0x54c078={};var _0x4182d9={};var _0x5018ae;var _0x11baa0;return db[_0x9553('0x29')][_0x9553('0x4e')]({'where':{'id':_0x3c12b5[_0x9553('0x42')]['id']}})['then'](handleEntityNotFound(_0x4075cf,null))[_0x9553('0x22')](function(_0xaff28c){if(_0xaff28c){_0x5018ae=_0xaff28c;_0x4182d9[_0x9553('0x2d')]=_['keys'](db[_0x9553('0x49')][_0x9553('0x2a')]);_0x4182d9[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x3c12b5[_0x9553('0x30')]);_0x4182d9['filters']=_[_0x9553('0x32')](_0x4182d9[_0x9553('0x2d')],_0x4182d9[_0x9553('0x30')]);_0x54c078[_0x9553('0x33')]=_['intersection'](_0x4182d9[_0x9553('0x2d')],qs[_0x9553('0x34')](_0x3c12b5[_0x9553('0x30')][_0x9553('0x34')]));_0x54c078[_0x9553('0x33')]=_0x54c078[_0x9553('0x33')][_0x9553('0x35')]?_0x54c078[_0x9553('0x33')]:_0x4182d9[_0x9553('0x2d')];_0x54c078[_0x9553('0x37')]=qs['sort'](_0x3c12b5['query'][_0x9553('0x4a')]);_0x54c078[_0x9553('0x38')]=qs[_0x9553('0x31')](_[_0x9553('0x39')](_0x3c12b5['query'],_0x4182d9[_0x9553('0x31')]));if(_0x3c12b5[_0x9553('0x30')]['filter']){_0x54c078[_0x9553('0x38')]=_['merge'](_0x54c078[_0x9553('0x38')],{'$or':_['map'](_0x54c078[_0x9553('0x33')],function(_0xc859cc){var _0x445f05={};_0x445f05[_0xc859cc]={'$like':'%'+_0x3c12b5[_0x9553('0x30')][_0x9553('0x4b')]+'%'};return _0x445f05;})});}_0x54c078=_[_0x9553('0x43')]({},_0x54c078,_0x3c12b5[_0x9553('0x3c')]);return _0x5018ae[_0x9553('0x4d')](_0x54c078);}})[_0x9553('0x22')](function(_0x437da1){if(_0x437da1){_0x11baa0=_0x437da1[_0x9553('0x35')];if(!_0x3c12b5[_0x9553('0x30')][_0x9553('0x4c')](_0x9553('0x36'))){_0x54c078[_0x9553('0x1e')]=qs['limit'](_0x3c12b5[_0x9553('0x30')][_0x9553('0x1e')]);_0x54c078[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x3c12b5[_0x9553('0x30')][_0x9553('0x1c')]);}return _0x5018ae['getSubjects'](_0x54c078);}})[_0x9553('0x22')](function(_0x16a773){if(_0x16a773){return _0x16a773?{'count':_0x11baa0,'rows':_0x16a773}:null;}})[_0x9553('0x22')](respondWithResult(_0x4075cf,null))[_0x9553('0x40')](handleError(_0x4075cf,null));};exports[_0x9553('0x4f')]=function(_0x53ac93,_0xd790ed,_0x39d6b1){var _0xd77812={};var _0x49a916={};var _0x166032;var _0x39eda5;return db[_0x9553('0x29')][_0x9553('0x4e')]({'where':{'id':_0x53ac93[_0x9553('0x42')]['id']}})[_0x9553('0x22')](handleEntityNotFound(_0xd790ed,null))[_0x9553('0x22')](function(_0x2e439d){if(_0x2e439d){_0x166032=_0x2e439d;_0x49a916[_0x9553('0x2d')]=_[_0x9553('0x2f')](db[_0x9553('0x49')][_0x9553('0x2a')]);_0x49a916[_0x9553('0x30')]=_[_0x9553('0x2f')](_0x53ac93[_0x9553('0x30')]);_0x49a916[_0x9553('0x31')]=_[_0x9553('0x32')](_0x49a916[_0x9553('0x2d')],_0x49a916[_0x9553('0x30')]);_0xd77812[_0x9553('0x33')]=_[_0x9553('0x32')](_0x49a916[_0x9553('0x2d')],qs['fields'](_0x53ac93['query'][_0x9553('0x34')]));_0xd77812[_0x9553('0x33')]=_0xd77812[_0x9553('0x33')]['length']?_0xd77812['attributes']:_0x49a916[_0x9553('0x2d')];_0xd77812[_0x9553('0x37')]=qs['sort'](_0x53ac93['query'][_0x9553('0x4a')]);_0xd77812[_0x9553('0x38')]=qs[_0x9553('0x31')](_['pick'](_0x53ac93[_0x9553('0x30')],_0x49a916[_0x9553('0x31')]));if(_0x53ac93[_0x9553('0x30')][_0x9553('0x4b')]){_0xd77812[_0x9553('0x38')]=_[_0x9553('0x43')](_0xd77812[_0x9553('0x38')],{'$or':_['map'](_0xd77812['attributes'],function(_0x57c149){var _0x3037af={};_0x3037af[_0x57c149]={'$like':'%'+_0x53ac93[_0x9553('0x30')]['filter']+'%'};return _0x3037af;})});}_0xd77812=_[_0x9553('0x43')]({},_0xd77812,_0x53ac93['options']);return _0x166032[_0x9553('0x4f')](_0xd77812);}})[_0x9553('0x22')](function(_0x3cf7b9){if(_0x3cf7b9){_0x39eda5=_0x3cf7b9['length'];if(!_0x53ac93['query'][_0x9553('0x4c')](_0x9553('0x36'))){_0xd77812[_0x9553('0x1e')]=qs[_0x9553('0x1e')](_0x53ac93[_0x9553('0x30')]['limit']);_0xd77812[_0x9553('0x1c')]=qs[_0x9553('0x1c')](_0x53ac93['query'][_0x9553('0x1c')]);}return _0x166032[_0x9553('0x4f')](_0xd77812);}})['then'](function(_0x39a9ad){if(_0x39a9ad){return _0x39a9ad?{'count':_0x39eda5,'rows':_0x39a9ad}:null;}})['then'](respondWithResult(_0xd790ed,null))[_0x9553('0x40')](handleError(_0xd790ed,null));}; \ No newline at end of file +var _0xe58c=['type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','SugarcrmConfiguration','rawAttributes'];(function(_0x3dca5f,_0x3bf609){var _0x2ad290=function(_0x35ca60){while(--_0x35ca60){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x2ad290(++_0x3bf609);}(_0xe58c,0x199));var _0xce58=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xe58c[_0x1b6c6d];return _0x290d9d;};'use strict';var emlformat=require(_0xce58('0x0'));var rimraf=require(_0xce58('0x1'));var zipdir=require(_0xce58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce58('0x3'));var moment=require('moment');var BPromise=require(_0xce58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xce58('0x5'));var sox=require(_0xce58('0x6'));var csv=require(_0xce58('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce58('0x8'));var squel=require('squel');var crypto=require(_0xce58('0x9'));var jsforce=require(_0xce58('0xa'));var deskjs=require(_0xce58('0xb'));var toCsv=require(_0xce58('0x7'));var querystring=require('querystring');var Papa=require(_0xce58('0xc'));var Redis=require(_0xce58('0xd'));var authService=require(_0xce58('0xe'));var qs=require(_0xce58('0xf'));var as=require(_0xce58('0x10'));var hardwareService=require(_0xce58('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xce58('0x12'));var licenseUtil=require(_0xce58('0x13'));var db=require(_0xce58('0x14'))['db'];function respondWithStatusCode(_0x5eff1d,_0xcdcea1){_0xcdcea1=_0xcdcea1||0xcc;return function(_0x504f4b){if(_0x504f4b){return _0x5eff1d[_0xce58('0x15')](_0xcdcea1);}return _0x5eff1d[_0xce58('0x16')](_0xcdcea1)[_0xce58('0x17')]();};}function respondWithResult(_0x2d4e91,_0x466d6a){_0x466d6a=_0x466d6a||0xc8;return function(_0x5fc0d){if(_0x5fc0d){return _0x2d4e91[_0xce58('0x16')](_0x466d6a)[_0xce58('0x18')](_0x5fc0d);}};}function respondWithFilteredResult(_0x498aba,_0x1921e5){return function(_0x59a3c0){if(_0x59a3c0){var _0x380bad=typeof _0x1921e5[_0xce58('0x19')]===_0xce58('0x1a')&&typeof _0x1921e5[_0xce58('0x1b')]==='undefined';var _0x398695=_0x59a3c0[_0xce58('0x1c')];var _0x12d56b=_0x380bad?0x0:_0x1921e5[_0xce58('0x19')];var _0x49f53f=_0x380bad?_0x59a3c0[_0xce58('0x1c')]:_0x1921e5['offset']+_0x1921e5['limit'];var _0x2e90e5;if(_0x49f53f>=_0x398695){_0x49f53f=_0x398695;_0x2e90e5=0xc8;}else{_0x2e90e5=0xce;}_0x498aba[_0xce58('0x16')](_0x2e90e5);return _0x498aba[_0xce58('0x1d')](_0xce58('0x1e'),_0x12d56b+'-'+_0x49f53f+'/'+_0x398695)[_0xce58('0x18')](_0x59a3c0);}return null;};}function patchUpdates(_0x2d1c56){return function(_0xeebba8){try{jsonpatch[_0xce58('0x1f')](_0xeebba8,_0x2d1c56,!![]);}catch(_0x437221){return BPromise[_0xce58('0x20')](_0x437221);}return _0xeebba8['save']();};}function saveUpdates(_0x4a89f9,_0x3beda2){return function(_0x275acb){if(_0x275acb){return _0x275acb[_0xce58('0x21')](_0x4a89f9)[_0xce58('0x22')](function(_0x3dd4b8){return _0x3dd4b8;});}return null;};}function removeEntity(_0x361663,_0x3add55){return function(_0x582ad6){if(_0x582ad6){return _0x582ad6[_0xce58('0x23')]()[_0xce58('0x22')](function(){_0x361663[_0xce58('0x16')](0xcc)[_0xce58('0x17')]();});}};}function handleEntityNotFound(_0xf27674,_0x32fb36){return function(_0x148026){if(!_0x148026){_0xf27674['sendStatus'](0x194);}return _0x148026;};}function handleError(_0x471e27,_0x3ed806){_0x3ed806=_0x3ed806||0x1f4;return function(_0x445eaf){logger[_0xce58('0x24')](_0x445eaf['stack']);if(_0x445eaf[_0xce58('0x25')]){delete _0x445eaf['name'];}_0x471e27['status'](_0x3ed806)['send'](_0x445eaf);};}exports[_0xce58('0x26')]=function(_0x56c1fd,_0x52f59c){var _0x38237e={},_0x802fd2={},_0x5f482b={'count':0x0,'rows':[]};var _0x4f3193=_['map'](db[_0xce58('0x27')][_0xce58('0x28')],function(_0x53fbdd){return{'name':_0x53fbdd['fieldName'],'type':_0x53fbdd[_0xce58('0x29')][_0xce58('0x2a')]};});_0x802fd2[_0xce58('0x2b')]=_[_0xce58('0x2c')](_0x4f3193,_0xce58('0x25'));_0x802fd2[_0xce58('0x2d')]=_['keys'](_0x56c1fd[_0xce58('0x2d')]);_0x802fd2[_0xce58('0x2e')]=_[_0xce58('0x2f')](_0x802fd2[_0xce58('0x2b')],_0x802fd2[_0xce58('0x2d')]);_0x38237e[_0xce58('0x30')]=_['intersection'](_0x802fd2[_0xce58('0x2b')],qs[_0xce58('0x31')](_0x56c1fd[_0xce58('0x2d')][_0xce58('0x31')]));_0x38237e[_0xce58('0x30')]=_0x38237e[_0xce58('0x30')][_0xce58('0x32')]?_0x38237e[_0xce58('0x30')]:_0x802fd2['model'];if(!_0x56c1fd[_0xce58('0x2d')][_0xce58('0x33')](_0xce58('0x34'))){_0x38237e[_0xce58('0x1b')]=qs[_0xce58('0x1b')](_0x56c1fd['query'][_0xce58('0x1b')]);_0x38237e[_0xce58('0x19')]=qs['offset'](_0x56c1fd[_0xce58('0x2d')][_0xce58('0x19')]);}_0x38237e[_0xce58('0x35')]=qs[_0xce58('0x36')](_0x56c1fd[_0xce58('0x2d')][_0xce58('0x36')]);_0x38237e[_0xce58('0x37')]=qs[_0xce58('0x2e')](_['pick'](_0x56c1fd[_0xce58('0x2d')],_0x802fd2[_0xce58('0x2e')]),_0x4f3193);if(_0x56c1fd['query'][_0xce58('0x38')]){_0x38237e[_0xce58('0x37')]=_[_0xce58('0x39')](_0x38237e[_0xce58('0x37')],{'$or':_[_0xce58('0x2c')](_0x4f3193,function(_0x440706){if(_0x440706['type']!==_0xce58('0x3a')){var _0x1be826={};_0x1be826[_0x440706[_0xce58('0x25')]]={'$like':'%'+_0x56c1fd['query'][_0xce58('0x38')]+'%'};return _0x1be826;}})});}_0x38237e=_[_0xce58('0x39')]({},_0x38237e,_0x56c1fd[_0xce58('0x3b')]);var _0x28ae80={'where':_0x38237e[_0xce58('0x37')]};return db[_0xce58('0x27')][_0xce58('0x1c')](_0x28ae80)['then'](function(_0x473762){_0x5f482b[_0xce58('0x1c')]=_0x473762;if(_0x56c1fd[_0xce58('0x2d')]['includeAll']){_0x38237e[_0xce58('0x3c')]=[{'all':!![]}];}return db[_0xce58('0x27')]['findAll'](_0x38237e);})[_0xce58('0x22')](function(_0x3e70ab){_0x5f482b[_0xce58('0x3d')]=_0x3e70ab;return _0x5f482b;})[_0xce58('0x22')](respondWithFilteredResult(_0x52f59c,_0x38237e))[_0xce58('0x3e')](handleError(_0x52f59c,null));};exports[_0xce58('0x3f')]=function(_0x327190,_0x45f07b){var _0x3dfb66={'raw':![],'where':{'id':_0x327190[_0xce58('0x40')]['id']}},_0x4f68f8={};_0x4f68f8[_0xce58('0x2b')]=_[_0xce58('0x41')](db[_0xce58('0x27')]['rawAttributes']);_0x4f68f8[_0xce58('0x2d')]=_[_0xce58('0x41')](_0x327190[_0xce58('0x2d')]);_0x4f68f8['filters']=_[_0xce58('0x2f')](_0x4f68f8[_0xce58('0x2b')],_0x4f68f8['query']);_0x3dfb66['attributes']=_[_0xce58('0x2f')](_0x4f68f8['model'],qs[_0xce58('0x31')](_0x327190[_0xce58('0x2d')][_0xce58('0x31')]));_0x3dfb66[_0xce58('0x30')]=_0x3dfb66[_0xce58('0x30')][_0xce58('0x32')]?_0x3dfb66[_0xce58('0x30')]:_0x4f68f8[_0xce58('0x2b')];if(_0x327190['query']['includeAll']){_0x3dfb66[_0xce58('0x3c')]=[{'all':!![]}];}_0x3dfb66=_[_0xce58('0x39')]({},_0x3dfb66,_0x327190[_0xce58('0x3b')]);return db[_0xce58('0x27')][_0xce58('0x42')](_0x3dfb66)[_0xce58('0x22')](handleEntityNotFound(_0x45f07b,null))[_0xce58('0x22')](respondWithResult(_0x45f07b,null))['catch'](handleError(_0x45f07b,null));};exports['create']=function(_0x32adb5,_0x1d839e){return db[_0xce58('0x27')][_0xce58('0x43')](_0x32adb5['body'],{})[_0xce58('0x22')](respondWithResult(_0x1d839e,0xc9))[_0xce58('0x3e')](handleError(_0x1d839e,null));};exports['update']=function(_0x34810e,_0x520dc4){if(_0x34810e[_0xce58('0x44')]['id']){delete _0x34810e[_0xce58('0x44')]['id'];}return db['SugarcrmConfiguration'][_0xce58('0x42')]({'where':{'id':_0x34810e[_0xce58('0x40')]['id']}})['then'](handleEntityNotFound(_0x520dc4,null))[_0xce58('0x22')](saveUpdates(_0x34810e[_0xce58('0x44')],null))['then'](respondWithResult(_0x520dc4,null))[_0xce58('0x3e')](handleError(_0x520dc4,null));};exports[_0xce58('0x23')]=function(_0x59983a,_0x26f07b){return db['SugarcrmConfiguration'][_0xce58('0x42')]({'where':{'id':_0x59983a[_0xce58('0x40')]['id']}})[_0xce58('0x22')](handleEntityNotFound(_0x26f07b,null))[_0xce58('0x22')](removeEntity(_0x26f07b,null))[_0xce58('0x3e')](handleError(_0x26f07b,null));};exports[_0xce58('0x45')]=function(_0x55cbe0,_0x136b41,_0x1c1c89){var _0x7f1b3b={};var _0x5cc24d={};var _0x4832b6;var _0x4fd7ee;return db[_0xce58('0x27')][_0xce58('0x46')]({'where':{'id':_0x55cbe0[_0xce58('0x40')]['id']}})[_0xce58('0x22')](handleEntityNotFound(_0x136b41,null))['then'](function(_0x20c709){if(_0x20c709){_0x4832b6=_0x20c709;_0x5cc24d[_0xce58('0x2b')]=_[_0xce58('0x41')](db[_0xce58('0x47')]['rawAttributes']);_0x5cc24d[_0xce58('0x2d')]=_[_0xce58('0x41')](_0x55cbe0[_0xce58('0x2d')]);_0x5cc24d[_0xce58('0x2e')]=_[_0xce58('0x2f')](_0x5cc24d['model'],_0x5cc24d[_0xce58('0x2d')]);_0x7f1b3b[_0xce58('0x30')]=_['intersection'](_0x5cc24d[_0xce58('0x2b')],qs[_0xce58('0x31')](_0x55cbe0[_0xce58('0x2d')][_0xce58('0x31')]));_0x7f1b3b['attributes']=_0x7f1b3b[_0xce58('0x30')][_0xce58('0x32')]?_0x7f1b3b[_0xce58('0x30')]:_0x5cc24d[_0xce58('0x2b')];_0x7f1b3b[_0xce58('0x35')]=qs[_0xce58('0x36')](_0x55cbe0['query'][_0xce58('0x36')]);_0x7f1b3b['where']=qs[_0xce58('0x2e')](_[_0xce58('0x48')](_0x55cbe0[_0xce58('0x2d')],_0x5cc24d['filters']));if(_0x55cbe0[_0xce58('0x2d')]['filter']){_0x7f1b3b['where']=_[_0xce58('0x39')](_0x7f1b3b[_0xce58('0x37')],{'$or':_[_0xce58('0x2c')](_0x7f1b3b['attributes'],function(_0x2f2f5b){var _0xb58674={};_0xb58674[_0x2f2f5b]={'$like':'%'+_0x55cbe0[_0xce58('0x2d')][_0xce58('0x38')]+'%'};return _0xb58674;})});}_0x7f1b3b=_['merge']({},_0x7f1b3b,_0x55cbe0[_0xce58('0x3b')]);return _0x4832b6['getFields'](_0x7f1b3b);}})[_0xce58('0x22')](function(_0x4854a2){if(_0x4854a2){_0x4fd7ee=_0x4854a2[_0xce58('0x32')];if(!_0x55cbe0[_0xce58('0x2d')]['hasOwnProperty'](_0xce58('0x34'))){_0x7f1b3b[_0xce58('0x1b')]=qs[_0xce58('0x1b')](_0x55cbe0[_0xce58('0x2d')]['limit']);_0x7f1b3b[_0xce58('0x19')]=qs[_0xce58('0x19')](_0x55cbe0[_0xce58('0x2d')][_0xce58('0x19')]);}return _0x4832b6[_0xce58('0x45')](_0x7f1b3b);}})[_0xce58('0x22')](function(_0x805e24){if(_0x805e24){return _0x805e24?{'count':_0x4fd7ee,'rows':_0x805e24}:null;}})[_0xce58('0x22')](respondWithResult(_0x136b41,null))['catch'](handleError(_0x136b41,null));};exports[_0xce58('0x49')]=function(_0x40696d,_0x137a2a,_0xdb706a){var _0x113531={};var _0x571272={};var _0x5110b1;var _0x531942;return db[_0xce58('0x27')]['findOne']({'where':{'id':_0x40696d[_0xce58('0x40')]['id']}})['then'](handleEntityNotFound(_0x137a2a,null))[_0xce58('0x22')](function(_0x511ea3){if(_0x511ea3){_0x5110b1=_0x511ea3;_0x571272[_0xce58('0x2b')]=_['keys'](db[_0xce58('0x47')]['rawAttributes']);_0x571272['query']=_[_0xce58('0x41')](_0x40696d[_0xce58('0x2d')]);_0x571272[_0xce58('0x2e')]=_[_0xce58('0x2f')](_0x571272[_0xce58('0x2b')],_0x571272[_0xce58('0x2d')]);_0x113531['attributes']=_['intersection'](_0x571272['model'],qs[_0xce58('0x31')](_0x40696d[_0xce58('0x2d')][_0xce58('0x31')]));_0x113531[_0xce58('0x30')]=_0x113531[_0xce58('0x30')][_0xce58('0x32')]?_0x113531[_0xce58('0x30')]:_0x571272[_0xce58('0x2b')];_0x113531[_0xce58('0x35')]=qs[_0xce58('0x36')](_0x40696d['query'][_0xce58('0x36')]);_0x113531[_0xce58('0x37')]=qs[_0xce58('0x2e')](_[_0xce58('0x48')](_0x40696d[_0xce58('0x2d')],_0x571272[_0xce58('0x2e')]));if(_0x40696d[_0xce58('0x2d')][_0xce58('0x38')]){_0x113531[_0xce58('0x37')]=_['merge'](_0x113531[_0xce58('0x37')],{'$or':_[_0xce58('0x2c')](_0x113531[_0xce58('0x30')],function(_0x11797b){var _0x42123c={};_0x42123c[_0x11797b]={'$like':'%'+_0x40696d['query'][_0xce58('0x38')]+'%'};return _0x42123c;})});}_0x113531=_[_0xce58('0x39')]({},_0x113531,_0x40696d[_0xce58('0x3b')]);return _0x5110b1['getSubjects'](_0x113531);}})[_0xce58('0x22')](function(_0x202e17){if(_0x202e17){_0x531942=_0x202e17[_0xce58('0x32')];if(!_0x40696d['query']['hasOwnProperty'](_0xce58('0x34'))){_0x113531[_0xce58('0x1b')]=qs[_0xce58('0x1b')](_0x40696d['query'][_0xce58('0x1b')]);_0x113531[_0xce58('0x19')]=qs['offset'](_0x40696d[_0xce58('0x2d')][_0xce58('0x19')]);}return _0x5110b1['getSubjects'](_0x113531);}})[_0xce58('0x22')](function(_0x744e65){if(_0x744e65){return _0x744e65?{'count':_0x531942,'rows':_0x744e65}:null;}})[_0xce58('0x22')](respondWithResult(_0x137a2a,null))[_0xce58('0x3e')](handleError(_0x137a2a,null));};exports[_0xce58('0x4a')]=function(_0x26834c,_0x543ead,_0x4a8b3e){var _0x41df80={};var _0x33425f={};var _0x55e788;var _0x3d95c7;return db[_0xce58('0x27')][_0xce58('0x46')]({'where':{'id':_0x26834c[_0xce58('0x40')]['id']}})[_0xce58('0x22')](handleEntityNotFound(_0x543ead,null))[_0xce58('0x22')](function(_0x11be06){if(_0x11be06){_0x55e788=_0x11be06;_0x33425f[_0xce58('0x2b')]=_[_0xce58('0x41')](db[_0xce58('0x47')]['rawAttributes']);_0x33425f[_0xce58('0x2d')]=_[_0xce58('0x41')](_0x26834c['query']);_0x33425f[_0xce58('0x2e')]=_[_0xce58('0x2f')](_0x33425f[_0xce58('0x2b')],_0x33425f[_0xce58('0x2d')]);_0x41df80[_0xce58('0x30')]=_[_0xce58('0x2f')](_0x33425f['model'],qs[_0xce58('0x31')](_0x26834c['query'][_0xce58('0x31')]));_0x41df80[_0xce58('0x30')]=_0x41df80[_0xce58('0x30')][_0xce58('0x32')]?_0x41df80['attributes']:_0x33425f[_0xce58('0x2b')];_0x41df80[_0xce58('0x35')]=qs['sort'](_0x26834c['query']['sort']);_0x41df80[_0xce58('0x37')]=qs[_0xce58('0x2e')](_['pick'](_0x26834c['query'],_0x33425f['filters']));if(_0x26834c[_0xce58('0x2d')][_0xce58('0x38')]){_0x41df80['where']=_['merge'](_0x41df80[_0xce58('0x37')],{'$or':_[_0xce58('0x2c')](_0x41df80[_0xce58('0x30')],function(_0x6f7d71){var _0x40e6c5={};_0x40e6c5[_0x6f7d71]={'$like':'%'+_0x26834c['query']['filter']+'%'};return _0x40e6c5;})});}_0x41df80=_['merge']({},_0x41df80,_0x26834c[_0xce58('0x3b')]);return _0x55e788[_0xce58('0x4a')](_0x41df80);}})['then'](function(_0x3d333b){if(_0x3d333b){_0x3d95c7=_0x3d333b[_0xce58('0x32')];if(!_0x26834c['query']['hasOwnProperty'](_0xce58('0x34'))){_0x41df80['limit']=qs[_0xce58('0x1b')](_0x26834c[_0xce58('0x2d')][_0xce58('0x1b')]);_0x41df80[_0xce58('0x19')]=qs[_0xce58('0x19')](_0x26834c[_0xce58('0x2d')][_0xce58('0x19')]);}return _0x55e788[_0xce58('0x4a')](_0x41df80);}})[_0xce58('0x22')](function(_0x109b4f){if(_0x109b4f){return _0x109b4f?{'count':_0x3d95c7,'rows':_0x109b4f}:null;}})[_0xce58('0x22')](respondWithResult(_0x543ead,null))[_0xce58('0x3e')](handleError(_0x543ead,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2f3b889..bf8949e 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 _0x5d6f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger'];(function(_0xa584ad,_0x487170){var _0x2ad711=function(_0x26ced0){while(--_0x26ced0){_0xa584ad['push'](_0xa584ad['shift']());}};_0x2ad711(++_0x487170);}(_0x5d6f,0x1b9));var _0xf5d6=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x5d6f[_0x3c54d3];return _0xd67c8f;};'use strict';var _=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var logger=require(_0xf5d6('0x2'))(_0xf5d6('0x3'));var moment=require(_0xf5d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5d6('0x5'));var fs=require('fs');var path=require(_0xf5d6('0x6'));var rimraf=require(_0xf5d6('0x7'));var config=require(_0xf5d6('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xf5d6('0x9')]=function(_0x549655,_0x3b61b1){return _0x549655[_0xf5d6('0xa')](_0xf5d6('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe64=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash'];(function(_0x31c6a6,_0x51f089){var _0x3a9ef9=function(_0x2feeca){while(--_0x2feeca){_0x31c6a6['push'](_0x31c6a6['shift']());}};_0x3a9ef9(++_0x51f089);}(_0xfe64,0x1df));var _0x4fe6=function(_0x3f35b9,_0x43174b){_0x3f35b9=_0x3f35b9-0x0;var _0x298ddb=_0xfe64[_0x3f35b9];return _0x298ddb;};'use strict';var _=require(_0x4fe6('0x0'));var util=require(_0x4fe6('0x1'));var logger=require(_0x4fe6('0x2'))('api');var moment=require(_0x4fe6('0x3'));var BPromise=require(_0x4fe6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fe6('0x5'));var rimraf=require(_0x4fe6('0x6'));var config=require(_0x4fe6('0x7'));var attributes=require(_0x4fe6('0x8'));module[_0x4fe6('0x9')]=function(_0x36aa9f,_0x21250a){return _0x36aa9f[_0x4fe6('0xa')](_0x4fe6('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','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 df96c82..5ae7299 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 _0x19ca=['../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf182,_0x22fffd){var _0x5f4c30=function(_0x593753){while(--_0x593753){_0xf182['push'](_0xf182['shift']());}};_0x5f4c30(++_0x22fffd);}(_0x19ca,0xdd));var _0xa19c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x19ca[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xa19c('0x0'));var util=require(_0xa19c('0x1'));var moment=require(_0xa19c('0x2'));var BPromise=require(_0xa19c('0x3'));var rs=require(_0xa19c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa19c('0x5'))['db'];var utils=require(_0xa19c('0x6'));var logger=require(_0xa19c('0x7'))(_0xa19c('0x8'));var config=require(_0xa19c('0x9'));var jayson=require(_0xa19c('0xa'));var client=jayson['client'][_0xa19c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x349fa,_0x58b690,_0x33ea3d){return new BPromise(function(_0x2ed74f,_0xda77b7){return client[_0xa19c('0xc')](_0x349fa,_0x33ea3d)[_0xa19c('0xd')](function(_0x5b2bde){logger['info'](_0xa19c('0xe'),_0x58b690,_0xa19c('0xf'));logger[_0xa19c('0x10')](_0xa19c('0x11'),_0x58b690,'request\x20sent',JSON[_0xa19c('0x12')](_0x5b2bde));if(_0x5b2bde[_0xa19c('0x13')]){if(_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x14')]===0x1f4){logger['error'](_0xa19c('0xe'),_0x58b690,_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x15')]);return _0xda77b7(_0x5b2bde['error'][_0xa19c('0x15')]);}logger[_0xa19c('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58b690,_0x5b2bde['error'][_0xa19c('0x15')]);return _0x2ed74f(_0x5b2bde[_0xa19c('0x13')][_0xa19c('0x15')]);}else{logger[_0xa19c('0x16')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58b690,_0xa19c('0xf'));_0x2ed74f(_0x5b2bde['result'][_0xa19c('0x15')]);}})['catch'](function(_0x2641e0){logger[_0xa19c('0x13')](_0xa19c('0xe'),_0x58b690,_0x2641e0);_0xda77b7(_0x2641e0);});});} \ No newline at end of file +var _0x70a6=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x70a6,0x7d));var _0x670a=function(_0x4de3e7,_0x402dbb){_0x4de3e7=_0x4de3e7-0x0;var _0x2e8ba7=_0x70a6[_0x4de3e7];return _0x2e8ba7;};'use strict';var _=require('lodash');var util=require(_0x670a('0x0'));var moment=require(_0x670a('0x1'));var BPromise=require(_0x670a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x670a('0x3'));var db=require(_0x670a('0x4'))['db'];var utils=require(_0x670a('0x5'));var logger=require(_0x670a('0x6'))(_0x670a('0x7'));var config=require(_0x670a('0x8'));var jayson=require(_0x670a('0x9'));var client=jayson[_0x670a('0xa')][_0x670a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d45e4,_0x30bedf,_0xa065e1){return new BPromise(function(_0x1d9549,_0x451b08){return client['request'](_0x3d45e4,_0xa065e1)[_0x670a('0xc')](function(_0x2d5392){logger['info'](_0x670a('0xd'),_0x30bedf,_0x670a('0xe'));logger['debug'](_0x670a('0xf'),_0x30bedf,_0x670a('0xe'),JSON[_0x670a('0x10')](_0x2d5392));if(_0x2d5392[_0x670a('0x11')]){if(_0x2d5392[_0x670a('0x11')][_0x670a('0x12')]===0x1f4){logger[_0x670a('0x11')](_0x670a('0xd'),_0x30bedf,_0x2d5392[_0x670a('0x11')][_0x670a('0x13')]);return _0x451b08(_0x2d5392['error']['message']);}logger['error'](_0x670a('0xd'),_0x30bedf,_0x2d5392['error']['message']);return _0x1d9549(_0x2d5392[_0x670a('0x11')][_0x670a('0x13')]);}else{logger[_0x670a('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x30bedf,_0x670a('0xe'));_0x1d9549(_0x2d5392[_0x670a('0x15')]['message']);}})[_0x670a('0x16')](function(_0x255e68){logger[_0x670a('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x30bedf,_0x255e68);_0x451b08(_0x255e68);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1d5fc8b..d3001e5 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 _0xb68e=['/:id','show','post','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x33dde6,_0x2c422a){var _0x5610d0=function(_0x315cee){while(--_0x315cee){_0x33dde6['push'](_0x33dde6['shift']());}};_0x5610d0(++_0x2c422a);}(_0xb68e,0x19b));var _0xeb68=function(_0x5ec09f,_0x1596c5){_0x5ec09f=_0x5ec09f-0x0;var _0x30d587=_0xb68e[_0x5ec09f];return _0x30d587;};'use strict';var multer=require(_0xeb68('0x0'));var util=require(_0xeb68('0x1'));var path=require('path');var timeout=require(_0xeb68('0x2'));var express=require('express');var router=express[_0xeb68('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeb68('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb68('0x5'));router[_0xeb68('0x6')]('/',auth[_0xeb68('0x7')](),controller[_0xeb68('0x8')]);router[_0xeb68('0x6')](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller[_0xeb68('0xa')]);router[_0xeb68('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller[_0xeb68('0xc')]);router['delete'](_0xeb68('0x9'),auth[_0xeb68('0x7')](),controller['destroy']);module[_0xeb68('0xd')]=router; \ No newline at end of file +var _0x6ca2=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x154d1e,_0x1f705a){var _0x17568e=function(_0x2da0bb){while(--_0x2da0bb){_0x154d1e['push'](_0x154d1e['shift']());}};_0x17568e(++_0x1f705a);}(_0x6ca2,0x1dd));var _0x26ca=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6ca2[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x26ca('0x0'));var util=require(_0x26ca('0x1'));var path=require(_0x26ca('0x2'));var timeout=require(_0x26ca('0x3'));var express=require(_0x26ca('0x4'));var router=express['Router']();var fs_extra=require(_0x26ca('0x5'));var auth=require(_0x26ca('0x6'));var interaction=require(_0x26ca('0x7'));var config=require(_0x26ca('0x8'));var controller=require(_0x26ca('0x9'));router[_0x26ca('0xa')]('/',auth[_0x26ca('0xb')](),controller[_0x26ca('0xc')]);router[_0x26ca('0xa')](_0x26ca('0xd'),auth[_0x26ca('0xb')](),controller['show']);router['post']('/',auth[_0x26ca('0xb')](),controller[_0x26ca('0xe')]);router[_0x26ca('0xf')](_0x26ca('0xd'),auth['isAuthenticated'](),controller[_0x26ca('0x10')]);router['delete'](_0x26ca('0xd'),auth[_0x26ca('0xb')](),controller[_0x26ca('0x11')]);module[_0x26ca('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 344c67d..206e2de 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 _0x3e70=['BOOLEAN','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x44f664,_0x4b2097){var _0x59d329=function(_0x251b89){while(--_0x251b89){_0x44f664['push'](_0x44f664['shift']());}};_0x59d329(++_0x4b2097);}(_0x3e70,0x71));var _0x03e7=function(_0x892f47,_0x1bb4be){_0x892f47=_0x892f47-0x0;var _0x17e7e8=_0x3e70[_0x892f47];return _0x17e7e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x03e7('0x0'),_0x03e7('0x1'),_0x03e7('0x2'),_0x03e7('0x3'),_0x03e7('0x4')),'defaultValue':_0x03e7('0x0')},'content':{'type':Sequelize[_0x03e7('0x5')]},'key':{'type':Sequelize[_0x03e7('0x5')]},'keyType':{'type':Sequelize[_0x03e7('0x6')](_0x03e7('0x0'),_0x03e7('0x1'),_0x03e7('0x2'))},'keyContent':{'type':Sequelize[_0x03e7('0x5')]},'idField':{'type':Sequelize[_0x03e7('0x5')]},'nameField':{'type':Sequelize[_0x03e7('0x5')]},'customField':{'type':Sequelize[_0x03e7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03e7('0x5')]}}; \ No newline at end of file +var _0x9ab4=['STRING','variable','sequelize','exports','ENUM','customVariable','picklist','string'];(function(_0x1392c4,_0x5a51c6){var _0x179f77=function(_0x14ecba){while(--_0x14ecba){_0x1392c4['push'](_0x1392c4['shift']());}};_0x179f77(++_0x5a51c6);}(_0x9ab4,0x10a));var _0x49ab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ab4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x49ab('0x0'));module[_0x49ab('0x1')]={'type':{'type':Sequelize[_0x49ab('0x2')]('string','variable',_0x49ab('0x3'),'keyValue',_0x49ab('0x4')),'defaultValue':_0x49ab('0x5')},'content':{'type':Sequelize[_0x49ab('0x6')]},'key':{'type':Sequelize[_0x49ab('0x6')]},'keyType':{'type':Sequelize[_0x49ab('0x2')](_0x49ab('0x5'),_0x49ab('0x7'),_0x49ab('0x3'))},'keyContent':{'type':Sequelize[_0x49ab('0x6')]},'idField':{'type':Sequelize[_0x49ab('0x6')]},'nameField':{'type':Sequelize[_0x49ab('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 323d713..9c2ef3a 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 _0xe16a=['limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','set','apply','save','update','then','destroy','end','sendStatus','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x301075,_0x33b785){var _0x1a04c5=function(_0x8d5143){while(--_0x8d5143){_0x301075['push'](_0x301075['shift']());}};_0x1a04c5(++_0x33b785);}(_0xe16a,0xae));var _0xae16=function(_0x2354c3,_0x59de7c){_0x2354c3=_0x2354c3-0x0;var _0x27db54=_0xe16a[_0x2354c3];return _0x27db54;};'use strict';var emlformat=require(_0xae16('0x0'));var rimraf=require(_0xae16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae16('0x2'));var moment=require(_0xae16('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae16('0x4'));var util=require(_0xae16('0x5'));var path=require(_0xae16('0x6'));var sox=require(_0xae16('0x7'));var csv=require(_0xae16('0x8'));var ejs=require(_0xae16('0x9'));var fs=require('fs');var fs_extra=require(_0xae16('0xa'));var _=require(_0xae16('0xb'));var squel=require(_0xae16('0xc'));var crypto=require(_0xae16('0xd'));var jsforce=require(_0xae16('0xe'));var deskjs=require(_0xae16('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae16('0x10'));var Papa=require(_0xae16('0x11'));var Redis=require('ioredis');var authService=require(_0xae16('0x12'));var qs=require(_0xae16('0x13'));var as=require(_0xae16('0x14'));var hardwareService=require(_0xae16('0x15'));var logger=require(_0xae16('0x16'))(_0xae16('0x17'));var utils=require(_0xae16('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xae16('0x19'));var db=require(_0xae16('0x1a'))['db'];function respondWithStatusCode(_0x5e41e0,_0x1cc7c0){_0x1cc7c0=_0x1cc7c0||0xcc;return function(_0x254da8){if(_0x254da8){return _0x5e41e0['sendStatus'](_0x1cc7c0);}return _0x5e41e0[_0xae16('0x1b')](_0x1cc7c0)['end']();};}function respondWithResult(_0x584e4b,_0x579b2c){_0x579b2c=_0x579b2c||0xc8;return function(_0x59edb3){if(_0x59edb3){return _0x584e4b[_0xae16('0x1b')](_0x579b2c)[_0xae16('0x1c')](_0x59edb3);}};}function respondWithFilteredResult(_0x281a72,_0x47d1d9){return function(_0x273d48){if(_0x273d48){var _0x543187=typeof _0x47d1d9[_0xae16('0x1d')]===_0xae16('0x1e')&&typeof _0x47d1d9['limit']===_0xae16('0x1e');var _0x2ffa77=_0x273d48['count'];var _0x50bebc=_0x543187?0x0:_0x47d1d9['offset'];var _0x865220=_0x543187?_0x273d48['count']:_0x47d1d9['offset']+_0x47d1d9['limit'];var _0x814fb9;if(_0x865220>=_0x2ffa77){_0x865220=_0x2ffa77;_0x814fb9=0xc8;}else{_0x814fb9=0xce;}_0x281a72[_0xae16('0x1b')](_0x814fb9);return _0x281a72[_0xae16('0x1f')]('Content-Range',_0x50bebc+'-'+_0x865220+'/'+_0x2ffa77)['json'](_0x273d48);}return null;};}function patchUpdates(_0x4e4c96){return function(_0x3ae604){try{jsonpatch[_0xae16('0x20')](_0x3ae604,_0x4e4c96,!![]);}catch(_0x329504){return BPromise['reject'](_0x329504);}return _0x3ae604[_0xae16('0x21')]();};}function saveUpdates(_0x1811b6,_0x8ec48f){return function(_0x12c349){if(_0x12c349){return _0x12c349[_0xae16('0x22')](_0x1811b6)[_0xae16('0x23')](function(_0x18407b){return _0x18407b;});}return null;};}function removeEntity(_0xc15f75,_0x1cc5dc){return function(_0x12e71a){if(_0x12e71a){return _0x12e71a[_0xae16('0x24')]()['then'](function(){_0xc15f75[_0xae16('0x1b')](0xcc)[_0xae16('0x25')]();});}};}function handleEntityNotFound(_0xf3a3ed,_0x487b69){return function(_0x29b75e){if(!_0x29b75e){_0xf3a3ed[_0xae16('0x26')](0x194);}return _0x29b75e;};}function handleError(_0x3973e1,_0x4da52e){_0x4da52e=_0x4da52e||0x1f4;return function(_0x381995){logger[_0xae16('0x27')](_0x381995['stack']);if(_0x381995[_0xae16('0x28')]){delete _0x381995[_0xae16('0x28')];}_0x3973e1[_0xae16('0x1b')](_0x4da52e)[_0xae16('0x29')](_0x381995);};}exports['index']=function(_0x57a37e,_0x556b79){var _0x4ee6b0={},_0x33b479={},_0x384ccd={'count':0x0,'rows':[]};var _0x53cb9e=_[_0xae16('0x2a')](db[_0xae16('0x2b')][_0xae16('0x2c')],function(_0x2ca97a){return{'name':_0x2ca97a[_0xae16('0x2d')],'type':_0x2ca97a[_0xae16('0x2e')][_0xae16('0x2f')]};});_0x33b479[_0xae16('0x30')]=_[_0xae16('0x2a')](_0x53cb9e,'name');_0x33b479[_0xae16('0x31')]=_['keys'](_0x57a37e[_0xae16('0x31')]);_0x33b479[_0xae16('0x32')]=_[_0xae16('0x33')](_0x33b479['model'],_0x33b479[_0xae16('0x31')]);_0x4ee6b0[_0xae16('0x34')]=_[_0xae16('0x33')](_0x33b479[_0xae16('0x30')],qs[_0xae16('0x35')](_0x57a37e['query'][_0xae16('0x35')]));_0x4ee6b0[_0xae16('0x34')]=_0x4ee6b0[_0xae16('0x34')][_0xae16('0x36')]?_0x4ee6b0[_0xae16('0x34')]:_0x33b479[_0xae16('0x30')];if(!_0x57a37e[_0xae16('0x31')][_0xae16('0x37')](_0xae16('0x38'))){_0x4ee6b0[_0xae16('0x39')]=qs['limit'](_0x57a37e['query'][_0xae16('0x39')]);_0x4ee6b0[_0xae16('0x1d')]=qs[_0xae16('0x1d')](_0x57a37e[_0xae16('0x31')]['offset']);}_0x4ee6b0[_0xae16('0x3a')]=qs[_0xae16('0x3b')](_0x57a37e[_0xae16('0x31')][_0xae16('0x3b')]);_0x4ee6b0[_0xae16('0x3c')]=qs[_0xae16('0x32')](_[_0xae16('0x3d')](_0x57a37e[_0xae16('0x31')],_0x33b479[_0xae16('0x32')]),_0x53cb9e);if(_0x57a37e[_0xae16('0x31')][_0xae16('0x3e')]){_0x4ee6b0['where']=_[_0xae16('0x3f')](_0x4ee6b0[_0xae16('0x3c')],{'$or':_['map'](_0x53cb9e,function(_0x1d005c){if(_0x1d005c[_0xae16('0x2e')]!==_0xae16('0x40')){var _0x48c86b={};_0x48c86b[_0x1d005c[_0xae16('0x28')]]={'$like':'%'+_0x57a37e[_0xae16('0x31')][_0xae16('0x3e')]+'%'};return _0x48c86b;}})});}_0x4ee6b0=_['merge']({},_0x4ee6b0,_0x57a37e['options']);var _0x1ef7f5={'where':_0x4ee6b0[_0xae16('0x3c')]};return db['SugarcrmField']['count'](_0x1ef7f5)['then'](function(_0xfd14e9){_0x384ccd[_0xae16('0x41')]=_0xfd14e9;if(_0x57a37e[_0xae16('0x31')][_0xae16('0x42')]){_0x4ee6b0[_0xae16('0x43')]=[{'all':!![]}];}return db[_0xae16('0x2b')][_0xae16('0x44')](_0x4ee6b0);})['then'](function(_0x4697df){_0x384ccd[_0xae16('0x45')]=_0x4697df;return _0x384ccd;})[_0xae16('0x23')](respondWithFilteredResult(_0x556b79,_0x4ee6b0))[_0xae16('0x46')](handleError(_0x556b79,null));};exports[_0xae16('0x47')]=function(_0x2a7471,_0x41a4be){var _0x1646ab={'raw':!![],'where':{'id':_0x2a7471['params']['id']}},_0x5703a5={};_0x5703a5['model']=_['keys'](db['SugarcrmField'][_0xae16('0x2c')]);_0x5703a5[_0xae16('0x31')]=_['keys'](_0x2a7471[_0xae16('0x31')]);_0x5703a5[_0xae16('0x32')]=_['intersection'](_0x5703a5['model'],_0x5703a5[_0xae16('0x31')]);_0x1646ab[_0xae16('0x34')]=_['intersection'](_0x5703a5[_0xae16('0x30')],qs[_0xae16('0x35')](_0x2a7471['query'][_0xae16('0x35')]));_0x1646ab[_0xae16('0x34')]=_0x1646ab[_0xae16('0x34')][_0xae16('0x36')]?_0x1646ab[_0xae16('0x34')]:_0x5703a5[_0xae16('0x30')];if(_0x2a7471[_0xae16('0x31')][_0xae16('0x42')]){_0x1646ab[_0xae16('0x43')]=[{'all':!![]}];}_0x1646ab=_[_0xae16('0x3f')]({},_0x1646ab,_0x2a7471[_0xae16('0x48')]);return db[_0xae16('0x2b')][_0xae16('0x49')](_0x1646ab)['then'](handleEntityNotFound(_0x41a4be,null))[_0xae16('0x23')](respondWithResult(_0x41a4be,null))[_0xae16('0x46')](handleError(_0x41a4be,null));};exports[_0xae16('0x4a')]=function(_0x2c6617,_0x45078a){return db['SugarcrmField'][_0xae16('0x4a')](_0x2c6617[_0xae16('0x4b')],{})[_0xae16('0x23')](respondWithResult(_0x45078a,0xc9))[_0xae16('0x46')](handleError(_0x45078a,null));};exports[_0xae16('0x22')]=function(_0x3eb8ed,_0x4b196c){if(_0x3eb8ed['body']['id']){delete _0x3eb8ed[_0xae16('0x4b')]['id'];}return db['SugarcrmField'][_0xae16('0x49')]({'where':{'id':_0x3eb8ed['params']['id']}})['then'](handleEntityNotFound(_0x4b196c,null))[_0xae16('0x23')](saveUpdates(_0x3eb8ed[_0xae16('0x4b')],null))[_0xae16('0x23')](respondWithResult(_0x4b196c,null))[_0xae16('0x46')](handleError(_0x4b196c,null));};exports[_0xae16('0x24')]=function(_0x2cc122,_0x23e4e9){return db[_0xae16('0x2b')][_0xae16('0x49')]({'where':{'id':_0x2cc122[_0xae16('0x4c')]['id']}})[_0xae16('0x23')](handleEntityNotFound(_0x23e4e9,null))[_0xae16('0x23')](removeEntity(_0x23e4e9,null))[_0xae16('0x46')](handleError(_0x23e4e9,null));}; \ No newline at end of file +var _0x0ae4=['pick','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x22736f,_0x4153bb){var _0x53c497=function(_0x1f19f5){while(--_0x1f19f5){_0x22736f['push'](_0x22736f['shift']());}};_0x53c497(++_0x4153bb);}(_0x0ae4,0xf1));var _0x40ae=function(_0x2496b3,_0x4f845c){_0x2496b3=_0x2496b3-0x0;var _0x379e8c=_0x0ae4[_0x2496b3];return _0x379e8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40ae('0x1'));var rp=require(_0x40ae('0x2'));var moment=require(_0x40ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40ae('0x4'));var util=require(_0x40ae('0x5'));var path=require(_0x40ae('0x6'));var sox=require(_0x40ae('0x7'));var csv=require(_0x40ae('0x8'));var ejs=require(_0x40ae('0x9'));var fs=require('fs');var fs_extra=require(_0x40ae('0xa'));var _=require(_0x40ae('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x40ae('0xc'));var deskjs=require(_0x40ae('0xd'));var toCsv=require(_0x40ae('0x8'));var querystring=require(_0x40ae('0xe'));var Papa=require(_0x40ae('0xf'));var Redis=require(_0x40ae('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x40ae('0x11'));var as=require(_0x40ae('0x12'));var hardwareService=require(_0x40ae('0x13'));var logger=require('../../config/logger')(_0x40ae('0x14'));var utils=require(_0x40ae('0x15'));var config=require(_0x40ae('0x16'));var licenseUtil=require(_0x40ae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409013,_0x1ac7ad){_0x1ac7ad=_0x1ac7ad||0xcc;return function(_0x58ae14){if(_0x58ae14){return _0x409013['sendStatus'](_0x1ac7ad);}return _0x409013[_0x40ae('0x18')](_0x1ac7ad)[_0x40ae('0x19')]();};}function respondWithResult(_0x301244,_0x2a6781){_0x2a6781=_0x2a6781||0xc8;return function(_0x1bce57){if(_0x1bce57){return _0x301244[_0x40ae('0x18')](_0x2a6781)[_0x40ae('0x1a')](_0x1bce57);}};}function respondWithFilteredResult(_0x398e36,_0x2774b2){return function(_0x49d437){if(_0x49d437){var _0x57aa05=typeof _0x2774b2[_0x40ae('0x1b')]===_0x40ae('0x1c')&&typeof _0x2774b2[_0x40ae('0x1d')]==='undefined';var _0x25ed75=_0x49d437['count'];var _0x103062=_0x57aa05?0x0:_0x2774b2[_0x40ae('0x1b')];var _0x2c0d70=_0x57aa05?_0x49d437['count']:_0x2774b2[_0x40ae('0x1b')]+_0x2774b2[_0x40ae('0x1d')];var _0x3f0d58;if(_0x2c0d70>=_0x25ed75){_0x2c0d70=_0x25ed75;_0x3f0d58=0xc8;}else{_0x3f0d58=0xce;}_0x398e36[_0x40ae('0x18')](_0x3f0d58);return _0x398e36['set'](_0x40ae('0x1e'),_0x103062+'-'+_0x2c0d70+'/'+_0x25ed75)[_0x40ae('0x1a')](_0x49d437);}return null;};}function patchUpdates(_0x35fdf4){return function(_0x112c63){try{jsonpatch[_0x40ae('0x1f')](_0x112c63,_0x35fdf4,!![]);}catch(_0xdc86e7){return BPromise['reject'](_0xdc86e7);}return _0x112c63[_0x40ae('0x20')]();};}function saveUpdates(_0x266350,_0x5163c5){return function(_0x780a06){if(_0x780a06){return _0x780a06[_0x40ae('0x21')](_0x266350)[_0x40ae('0x22')](function(_0x3a6ea6){return _0x3a6ea6;});}return null;};}function removeEntity(_0x385075,_0x431912){return function(_0x451052){if(_0x451052){return _0x451052[_0x40ae('0x23')]()[_0x40ae('0x22')](function(){_0x385075[_0x40ae('0x18')](0xcc)[_0x40ae('0x19')]();});}};}function handleEntityNotFound(_0x318701,_0x135f2e){return function(_0x3b0bc7){if(!_0x3b0bc7){_0x318701[_0x40ae('0x24')](0x194);}return _0x3b0bc7;};}function handleError(_0x22b122,_0x2dac19){_0x2dac19=_0x2dac19||0x1f4;return function(_0x11eba9){logger[_0x40ae('0x25')](_0x11eba9[_0x40ae('0x26')]);if(_0x11eba9[_0x40ae('0x27')]){delete _0x11eba9[_0x40ae('0x27')];}_0x22b122[_0x40ae('0x18')](_0x2dac19)[_0x40ae('0x28')](_0x11eba9);};}exports[_0x40ae('0x29')]=function(_0x448272,_0x492be9){var _0x10996a={},_0x2923c9={},_0x37deb9={'count':0x0,'rows':[]};var _0x2be1b6=_[_0x40ae('0x2a')](db[_0x40ae('0x2b')][_0x40ae('0x2c')],function(_0x4e557f){return{'name':_0x4e557f[_0x40ae('0x2d')],'type':_0x4e557f['type']['key']};});_0x2923c9[_0x40ae('0x2e')]=_[_0x40ae('0x2a')](_0x2be1b6,_0x40ae('0x27'));_0x2923c9[_0x40ae('0x2f')]=_['keys'](_0x448272['query']);_0x2923c9[_0x40ae('0x30')]=_[_0x40ae('0x31')](_0x2923c9[_0x40ae('0x2e')],_0x2923c9[_0x40ae('0x2f')]);_0x10996a[_0x40ae('0x32')]=_['intersection'](_0x2923c9[_0x40ae('0x2e')],qs[_0x40ae('0x33')](_0x448272[_0x40ae('0x2f')][_0x40ae('0x33')]));_0x10996a['attributes']=_0x10996a[_0x40ae('0x32')]['length']?_0x10996a[_0x40ae('0x32')]:_0x2923c9[_0x40ae('0x2e')];if(!_0x448272['query']['hasOwnProperty'](_0x40ae('0x34'))){_0x10996a[_0x40ae('0x1d')]=qs[_0x40ae('0x1d')](_0x448272['query'][_0x40ae('0x1d')]);_0x10996a[_0x40ae('0x1b')]=qs[_0x40ae('0x1b')](_0x448272['query'][_0x40ae('0x1b')]);}_0x10996a[_0x40ae('0x35')]=qs[_0x40ae('0x36')](_0x448272[_0x40ae('0x2f')][_0x40ae('0x36')]);_0x10996a['where']=qs['filters'](_[_0x40ae('0x37')](_0x448272[_0x40ae('0x2f')],_0x2923c9[_0x40ae('0x30')]),_0x2be1b6);if(_0x448272['query'][_0x40ae('0x38')]){_0x10996a['where']=_[_0x40ae('0x39')](_0x10996a[_0x40ae('0x3a')],{'$or':_[_0x40ae('0x2a')](_0x2be1b6,function(_0x5733b8){if(_0x5733b8[_0x40ae('0x3b')]!==_0x40ae('0x3c')){var _0x326329={};_0x326329[_0x5733b8['name']]={'$like':'%'+_0x448272[_0x40ae('0x2f')][_0x40ae('0x38')]+'%'};return _0x326329;}})});}_0x10996a=_[_0x40ae('0x39')]({},_0x10996a,_0x448272[_0x40ae('0x3d')]);var _0x1c6540={'where':_0x10996a['where']};return db[_0x40ae('0x2b')][_0x40ae('0x3e')](_0x1c6540)[_0x40ae('0x22')](function(_0x57231a){_0x37deb9[_0x40ae('0x3e')]=_0x57231a;if(_0x448272[_0x40ae('0x2f')][_0x40ae('0x3f')]){_0x10996a[_0x40ae('0x40')]=[{'all':!![]}];}return db[_0x40ae('0x2b')][_0x40ae('0x41')](_0x10996a);})[_0x40ae('0x22')](function(_0x4b4c55){_0x37deb9[_0x40ae('0x42')]=_0x4b4c55;return _0x37deb9;})[_0x40ae('0x22')](respondWithFilteredResult(_0x492be9,_0x10996a))[_0x40ae('0x43')](handleError(_0x492be9,null));};exports['show']=function(_0x553f88,_0x527b9c){var _0x3c94d8={'raw':!![],'where':{'id':_0x553f88['params']['id']}},_0x280c6b={};_0x280c6b[_0x40ae('0x2e')]=_['keys'](db[_0x40ae('0x2b')][_0x40ae('0x2c')]);_0x280c6b['query']=_[_0x40ae('0x44')](_0x553f88['query']);_0x280c6b[_0x40ae('0x30')]=_[_0x40ae('0x31')](_0x280c6b[_0x40ae('0x2e')],_0x280c6b[_0x40ae('0x2f')]);_0x3c94d8[_0x40ae('0x32')]=_[_0x40ae('0x31')](_0x280c6b[_0x40ae('0x2e')],qs['fields'](_0x553f88[_0x40ae('0x2f')][_0x40ae('0x33')]));_0x3c94d8[_0x40ae('0x32')]=_0x3c94d8[_0x40ae('0x32')][_0x40ae('0x45')]?_0x3c94d8['attributes']:_0x280c6b[_0x40ae('0x2e')];if(_0x553f88[_0x40ae('0x2f')][_0x40ae('0x3f')]){_0x3c94d8['include']=[{'all':!![]}];}_0x3c94d8=_[_0x40ae('0x39')]({},_0x3c94d8,_0x553f88[_0x40ae('0x3d')]);return db['SugarcrmField'][_0x40ae('0x46')](_0x3c94d8)[_0x40ae('0x22')](handleEntityNotFound(_0x527b9c,null))[_0x40ae('0x22')](respondWithResult(_0x527b9c,null))[_0x40ae('0x43')](handleError(_0x527b9c,null));};exports[_0x40ae('0x47')]=function(_0x4507d3,_0x2a2a72){return db[_0x40ae('0x2b')][_0x40ae('0x47')](_0x4507d3[_0x40ae('0x48')],{})[_0x40ae('0x22')](respondWithResult(_0x2a2a72,0xc9))[_0x40ae('0x43')](handleError(_0x2a2a72,null));};exports[_0x40ae('0x21')]=function(_0x364de9,_0xd28948){if(_0x364de9[_0x40ae('0x48')]['id']){delete _0x364de9[_0x40ae('0x48')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x364de9[_0x40ae('0x49')]['id']}})[_0x40ae('0x22')](handleEntityNotFound(_0xd28948,null))['then'](saveUpdates(_0x364de9['body'],null))['then'](respondWithResult(_0xd28948,null))[_0x40ae('0x43')](handleError(_0xd28948,null));};exports['destroy']=function(_0x26b807,_0x1de5d2){return db[_0x40ae('0x2b')][_0x40ae('0x46')]({'where':{'id':_0x26b807[_0x40ae('0x49')]['id']}})[_0x40ae('0x22')](handleEntityNotFound(_0x1de5d2,null))['then'](removeEntity(_0x1de5d2,null))['catch'](handleError(_0x1de5d2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1bb9efb..4406087 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 _0x3a6a=['lodash','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x3cb147,_0x5186aa){var _0xa21484=function(_0x53c4a7){while(--_0x53c4a7){_0x3cb147['push'](_0x3cb147['shift']());}};_0xa21484(++_0x5186aa);}(_0x3a6a,0x132));var _0xa3a6=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x3a6a[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xa3a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa3a6('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3a6('0x2'));var config=require(_0xa3a6('0x3'));var attributes=require(_0xa3a6('0x4'));module[_0xa3a6('0x5')]=function(_0x4d1979,_0x17b1e){return _0x4d1979[_0xa3a6('0x6')]('SugarcrmField',attributes,{'tableName':_0xa3a6('0x7'),'paranoid':![],'indexes':[{'name':_0xa3a6('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf314=['exports','define','sugarcrm_unique_index','idField','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0xf314,0xb8));var _0x4f31=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf314[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x4f31('0x0'));var util=require(_0x4f31('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4f31('0x2'));var rp=require(_0x4f31('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f31('0x4'));var config=require(_0x4f31('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x4f31('0x6')]=function(_0xf645e8,_0x14a9b6){return _0xf645e8[_0x4f31('0x7')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4f31('0x8'),'fields':[_0x4f31('0x9'),'FieldId'],'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 6882c1d..c83cb79 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 _0xe3f0=['catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4c78ee,_0x1202fa){var _0x1124b8=function(_0xd7804){while(--_0xd7804){_0x4c78ee['push'](_0x4c78ee['shift']());}};_0x1124b8(++_0x1202fa);}(_0xe3f0,0xc7));var _0x0e3f=function(_0x3824ee,_0x3b1fc4){_0x3824ee=_0x3824ee-0x0;var _0x32c800=_0xe3f0[_0x3824ee];return _0x32c800;};'use strict';var _=require(_0x0e3f('0x0'));var util=require(_0x0e3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e3f('0x2'));var db=require(_0x0e3f('0x3'))['db'];var utils=require(_0x0e3f('0x4'));var logger=require(_0x0e3f('0x5'))(_0x0e3f('0x6'));var config=require(_0x0e3f('0x7'));var jayson=require(_0x0e3f('0x8'));var client=jayson[_0x0e3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x524824,_0x4f6820,_0x3823f2){return new BPromise(function(_0x57b6bb,_0x435e01){return client[_0x0e3f('0xa')](_0x524824,_0x3823f2)[_0x0e3f('0xb')](function(_0x2ec04b){logger[_0x0e3f('0xc')](_0x0e3f('0xd'),_0x4f6820,_0x0e3f('0xe'));logger[_0x0e3f('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4f6820,_0x0e3f('0xe'),JSON[_0x0e3f('0x10')](_0x2ec04b));if(_0x2ec04b[_0x0e3f('0x11')]){if(_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4f6820,_0x2ec04b[_0x0e3f('0x11')]['message']);return _0x435e01(_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x13')]);}logger[_0x0e3f('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x4f6820,_0x2ec04b[_0x0e3f('0x11')][_0x0e3f('0x13')]);return _0x57b6bb(_0x2ec04b['error'][_0x0e3f('0x13')]);}else{logger[_0x0e3f('0xc')](_0x0e3f('0xd'),_0x4f6820,'request\x20sent');_0x57b6bb(_0x2ec04b[_0x0e3f('0x14')]['message']);}})[_0x0e3f('0x15')](function(_0x4ba8f4){logger['error'](_0x0e3f('0xd'),_0x4f6820,_0x4ba8f4);_0x435e01(_0x4ba8f4);});});} \ No newline at end of file +var _0x5277=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x5277,0xc5));var _0x7527=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5277[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7527('0x0'));var util=require(_0x7527('0x1'));var moment=require(_0x7527('0x2'));var BPromise=require(_0x7527('0x3'));var rs=require(_0x7527('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7527('0x5'));var logger=require(_0x7527('0x6'))(_0x7527('0x7'));var config=require(_0x7527('0x8'));var jayson=require(_0x7527('0x9'));var client=jayson[_0x7527('0xa')][_0x7527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x119186,_0x2c24df,_0x3bd5b4){return new BPromise(function(_0x5aff14,_0x5a59cc){return client[_0x7527('0xc')](_0x119186,_0x3bd5b4)['then'](function(_0x3551cc){logger[_0x7527('0xd')](_0x7527('0xe'),_0x2c24df,_0x7527('0xf'));logger['debug'](_0x7527('0x10'),_0x2c24df,'request\x20sent',JSON[_0x7527('0x11')](_0x3551cc));if(_0x3551cc['error']){if(_0x3551cc[_0x7527('0x12')]['code']===0x1f4){logger[_0x7527('0x12')](_0x7527('0xe'),_0x2c24df,_0x3551cc[_0x7527('0x12')][_0x7527('0x13')]);return _0x5a59cc(_0x3551cc[_0x7527('0x12')][_0x7527('0x13')]);}logger[_0x7527('0x12')](_0x7527('0xe'),_0x2c24df,_0x3551cc[_0x7527('0x12')][_0x7527('0x13')]);return _0x5aff14(_0x3551cc[_0x7527('0x12')]['message']);}else{logger[_0x7527('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2c24df,'request\x20sent');_0x5aff14(_0x3551cc[_0x7527('0x14')]['message']);}})[_0x7527('0x15')](function(_0x29a4e5){logger['error'](_0x7527('0xe'),_0x2c24df,_0x29a4e5);_0x5a59cc(_0x29a4e5);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 917400e..7f99c73 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 _0x643f=['getFields','post','create','/:id/configurations','/:id','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','show','get','getConfigurations','/:id/fields'];(function(_0x19017b,_0x56d52c){var _0x3becdc=function(_0x1e0fde){while(--_0x1e0fde){_0x19017b['push'](_0x19017b['shift']());}};_0x3becdc(++_0x56d52c);}(_0x643f,0x1e6));var _0xf643=function(_0x2437b0,_0x3c3194){_0x2437b0=_0x2437b0-0x0;var _0x2e5de9=_0x643f[_0x2437b0];return _0x2e5de9;};'use strict';var multer=require('multer');var util=require(_0xf643('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf643('0x1'));var router=express[_0xf643('0x2')]();var fs_extra=require(_0xf643('0x3'));var auth=require(_0xf643('0x4'));var interaction=require(_0xf643('0x5'));var config=require(_0xf643('0x6'));var controller=require(_0xf643('0x7'));router['get']('/',auth[_0xf643('0x8')](),controller[_0xf643('0x9')]);router['get']('/:id',auth[_0xf643('0x8')](),controller[_0xf643('0xa')]);router[_0xf643('0xb')]('/:id/configurations',auth[_0xf643('0x8')](),controller[_0xf643('0xc')]);router[_0xf643('0xb')](_0xf643('0xd'),auth[_0xf643('0x8')](),controller[_0xf643('0xe')]);router[_0xf643('0xf')]('/',auth[_0xf643('0x8')](),controller[_0xf643('0x10')]);router[_0xf643('0xf')](_0xf643('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xf643('0x8')](),controller['update']);router['delete'](_0xf643('0x12'),auth[_0xf643('0x8')](),controller['destroy']);module[_0xf643('0x13')]=router; \ No newline at end of file +var _0x50b9=['get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x28701f,_0x4a4981){var _0x2c9796=function(_0x4894c4){while(--_0x4894c4){_0x28701f['push'](_0x28701f['shift']());}};_0x2c9796(++_0x4a4981);}(_0x50b9,0x171));var _0x950b=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x50b9[_0x61b3ab];return _0x57097f;};'use strict';var multer=require(_0x950b('0x0'));var util=require('util');var path=require(_0x950b('0x1'));var timeout=require('connect-timeout');var express=require(_0x950b('0x2'));var router=express[_0x950b('0x3')]();var fs_extra=require(_0x950b('0x4'));var auth=require(_0x950b('0x5'));var interaction=require(_0x950b('0x6'));var config=require(_0x950b('0x7'));var controller=require(_0x950b('0x8'));router[_0x950b('0x9')]('/',auth[_0x950b('0xa')](),controller['index']);router[_0x950b('0x9')](_0x950b('0xb'),auth[_0x950b('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0x950b('0xa')](),controller[_0x950b('0xc')]);router[_0x950b('0x9')](_0x950b('0xd'),auth[_0x950b('0xa')](),controller[_0x950b('0xe')]);router[_0x950b('0xf')]('/',auth['isAuthenticated'](),controller[_0x950b('0x10')]);router[_0x950b('0xf')]('/:id/configurations',auth[_0x950b('0xa')](),controller['addConfiguration']);router['put'](_0x950b('0xb'),auth[_0x950b('0xa')](),controller[_0x950b('0x11')]);router[_0x950b('0x12')](_0x950b('0xb'),auth[_0x950b('0xa')](),controller[_0x950b('0x13')]);module[_0x950b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 403bcf5..985f089 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 _0x0e16=['exports','STRING','HelpDesk','sequelize'];(function(_0x1cfbdd,_0x4bdd68){var _0xdbe895=function(_0x1824d5){while(--_0x1824d5){_0x1cfbdd['push'](_0x1cfbdd['shift']());}};_0xdbe895(++_0x4bdd68);}(_0x0e16,0x87));var _0x60e1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0e16[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x60e1('0x0'));module[_0x60e1('0x1')]={'name':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x60e1('0x2')]},'username':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![],'defaultValue':_0x60e1('0x3')},'remoteUri':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x60e1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a87=['exports','STRING','HelpDesk','sequelize'];(function(_0x23b0ed,_0x33dba5){var _0x1e442b=function(_0x4d6ad6){while(--_0x4d6ad6){_0x23b0ed['push'](_0x23b0ed['shift']());}};_0x1e442b(++_0x33dba5);}(_0x1a87,0xc3));var _0x71a8=function(_0x1fe188,_0x11e1df){_0x1fe188=_0x1fe188-0x0;var _0x1b3e93=_0x1a87[_0x1fe188];return _0x1b3e93;};'use strict';var Sequelize=require(_0x71a8('0x0'));module[_0x71a8('0x1')]={'name':{'type':Sequelize[_0x71a8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x71a8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x71a8('0x3')},'remoteUri':{'type':Sequelize[_0x71a8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x71a8('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x71a8('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 de7d7c9..00a92dc 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 _0x966a=['description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','includes','remove','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','name','index','VtigerAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x966a,0x1ef));var _0xa966=function(_0x353c7a,_0x26f09b){_0x353c7a=_0x353c7a-0x0;var _0x475689=_0x966a[_0x353c7a];return _0x475689;};'use strict';var emlformat=require(_0xa966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa966('0x1'));var jsonpatch=require(_0xa966('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa966('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa966('0x4'));var fs=require('fs');var fs_extra=require(_0xa966('0x5'));var _=require(_0xa966('0x6'));var squel=require(_0xa966('0x7'));var crypto=require(_0xa966('0x8'));var jsforce=require(_0xa966('0x9'));var deskjs=require(_0xa966('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa966('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa966('0xc'));var as=require(_0xa966('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa966('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa966('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa966('0x10'));function respondWithStatusCode(_0x50be4f,_0x5b06ab){_0x5b06ab=_0x5b06ab||0xcc;return function(_0x5b534b){if(_0x5b534b){return _0x50be4f[_0xa966('0x11')](_0x5b06ab);}return _0x50be4f['status'](_0x5b06ab)[_0xa966('0x12')]();};}function respondWithResult(_0xe2642a,_0x4e64a3){_0x4e64a3=_0x4e64a3||0xc8;return function(_0x2414bb){if(_0x2414bb){return _0xe2642a['status'](_0x4e64a3)[_0xa966('0x13')](_0x2414bb);}};}function respondWithFilteredResult(_0x2b977d,_0x5dfe7a){return function(_0x56d91e){if(_0x56d91e){var _0x58c89d=typeof _0x5dfe7a[_0xa966('0x14')]==='undefined'&&typeof _0x5dfe7a[_0xa966('0x15')]==='undefined';var _0x590329=_0x56d91e[_0xa966('0x16')];var _0x572e82=_0x58c89d?0x0:_0x5dfe7a[_0xa966('0x14')];var _0x5705f2=_0x58c89d?_0x56d91e[_0xa966('0x16')]:_0x5dfe7a[_0xa966('0x14')]+_0x5dfe7a[_0xa966('0x15')];var _0xa736e5;if(_0x5705f2>=_0x590329){_0x5705f2=_0x590329;_0xa736e5=0xc8;}else{_0xa736e5=0xce;}_0x2b977d[_0xa966('0x17')](_0xa736e5);return _0x2b977d['set'](_0xa966('0x18'),_0x572e82+'-'+_0x5705f2+'/'+_0x590329)[_0xa966('0x13')](_0x56d91e);}return null;};}function patchUpdates(_0x2ed925){return function(_0xbb21f9){try{jsonpatch[_0xa966('0x19')](_0xbb21f9,_0x2ed925,!![]);}catch(_0x342429){return BPromise[_0xa966('0x1a')](_0x342429);}return _0xbb21f9[_0xa966('0x1b')]();};}function saveUpdates(_0x24e254,_0x510c43){return function(_0xf3d879){if(_0xf3d879){return _0xf3d879[_0xa966('0x1c')](_0x24e254)[_0xa966('0x1d')](function(_0x423eb0){return _0x423eb0;});}return null;};}function removeEntity(_0x39ad1d,_0x4b150b){return function(_0x36c001){if(_0x36c001){return _0x36c001[_0xa966('0x1e')]()[_0xa966('0x1d')](function(){_0x39ad1d[_0xa966('0x17')](0xcc)[_0xa966('0x12')]();});}};}function handleEntityNotFound(_0x57c33e,_0x10d41d){return function(_0x3a486e){if(!_0x3a486e){_0x57c33e[_0xa966('0x11')](0x194);}return _0x3a486e;};}function handleError(_0x368f4,_0x1276b9){_0x1276b9=_0x1276b9||0x1f4;return function(_0x476ad8){logger[_0xa966('0x1f')](_0x476ad8['stack']);if(_0x476ad8[_0xa966('0x20')]){delete _0x476ad8['name'];}_0x368f4[_0xa966('0x17')](_0x1276b9)['send'](_0x476ad8);};}exports[_0xa966('0x21')]=function(_0x5d77dd,_0x404c05){var _0x463207={},_0x3d88e7={},_0x243fca={'count':0x0,'rows':[]};var _0x6fe219=_['map'](db[_0xa966('0x22')]['rawAttributes'],function(_0x3e8a24){return{'name':_0x3e8a24[_0xa966('0x23')],'type':_0x3e8a24[_0xa966('0x24')][_0xa966('0x25')]};});_0x3d88e7[_0xa966('0x26')]=_[_0xa966('0x27')](_0x6fe219,_0xa966('0x20'));_0x3d88e7[_0xa966('0x28')]=_[_0xa966('0x29')](_0x5d77dd[_0xa966('0x28')]);_0x3d88e7[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0x3d88e7[_0xa966('0x26')],_0x3d88e7[_0xa966('0x28')]);_0x463207[_0xa966('0x2c')]=_[_0xa966('0x2b')](_0x3d88e7[_0xa966('0x26')],qs['fields'](_0x5d77dd['query'][_0xa966('0x2d')]));_0x463207[_0xa966('0x2c')]=_0x463207['attributes']['length']?_0x463207['attributes']:_0x3d88e7[_0xa966('0x26')];if(!_0x5d77dd[_0xa966('0x28')][_0xa966('0x2e')](_0xa966('0x2f'))){_0x463207['limit']=qs[_0xa966('0x15')](_0x5d77dd[_0xa966('0x28')][_0xa966('0x15')]);_0x463207[_0xa966('0x14')]=qs[_0xa966('0x14')](_0x5d77dd[_0xa966('0x28')][_0xa966('0x14')]);}_0x463207[_0xa966('0x30')]=qs[_0xa966('0x31')](_0x5d77dd[_0xa966('0x28')]['sort']);_0x463207[_0xa966('0x32')]=qs[_0xa966('0x2a')](_[_0xa966('0x33')](_0x5d77dd[_0xa966('0x28')],_0x3d88e7[_0xa966('0x2a')]),_0x6fe219);if(_0x5d77dd[_0xa966('0x28')]['filter']){_0x463207['where']=_[_0xa966('0x34')](_0x463207[_0xa966('0x32')],{'$or':_[_0xa966('0x27')](_0x6fe219,function(_0x42dbe9){if(_0x42dbe9['type']!==_0xa966('0x35')){var _0x2347a0={};_0x2347a0[_0x42dbe9['name']]={'$like':'%'+_0x5d77dd['query'][_0xa966('0x36')]+'%'};return _0x2347a0;}})});}_0x463207=_[_0xa966('0x34')]({},_0x463207,_0x5d77dd[_0xa966('0x37')]);var _0x1af7f6={'where':_0x463207[_0xa966('0x32')]};return db['VtigerAccount'][_0xa966('0x16')](_0x1af7f6)[_0xa966('0x1d')](function(_0x119ed0){_0x243fca['count']=_0x119ed0;if(_0x5d77dd[_0xa966('0x28')]['includeAll']){_0x463207[_0xa966('0x38')]=[{'all':!![]}];}return db[_0xa966('0x22')]['findAll'](_0x463207);})[_0xa966('0x1d')](function(_0x39dc43){_0x243fca[_0xa966('0x39')]=_0x39dc43;return _0x243fca;})['then'](respondWithFilteredResult(_0x404c05,_0x463207))[_0xa966('0x3a')](handleError(_0x404c05,null));};exports[_0xa966('0x3b')]=function(_0x12f049,_0x3a4c4e){var _0x3fa137={'raw':![],'where':{'id':_0x12f049['params']['id']}},_0xa3d702={};_0xa3d702[_0xa966('0x26')]=_[_0xa966('0x29')](db[_0xa966('0x22')][_0xa966('0x3c')]);_0xa3d702[_0xa966('0x28')]=_['keys'](_0x12f049[_0xa966('0x28')]);_0xa3d702[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0xa3d702[_0xa966('0x26')],_0xa3d702[_0xa966('0x28')]);_0x3fa137['attributes']=_[_0xa966('0x2b')](_0xa3d702[_0xa966('0x26')],qs['fields'](_0x12f049[_0xa966('0x28')][_0xa966('0x2d')]));_0x3fa137[_0xa966('0x2c')]=_0x3fa137['attributes'][_0xa966('0x3d')]?_0x3fa137['attributes']:_0xa3d702[_0xa966('0x26')];if(_0x12f049[_0xa966('0x28')][_0xa966('0x3e')]){_0x3fa137[_0xa966('0x38')]=[{'all':!![]}];}_0x3fa137=_['merge']({},_0x3fa137,_0x12f049['options']);return db['VtigerAccount'][_0xa966('0x3f')](_0x3fa137)['then'](handleEntityNotFound(_0x3a4c4e,null))['then'](respondWithResult(_0x3a4c4e,null))['catch'](handleError(_0x3a4c4e,null));};exports[_0xa966('0x40')]=function(_0x4535f7,_0x3de549){return db[_0xa966('0x22')][_0xa966('0x40')](_0x4535f7[_0xa966('0x41')],{})[_0xa966('0x1d')](respondWithResult(_0x3de549,0xc9))[_0xa966('0x3a')](handleError(_0x3de549,null));};exports[_0xa966('0x1c')]=function(_0x500569,_0x339a44){if(_0x500569['body']['id']){delete _0x500569[_0xa966('0x41')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x500569[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x339a44,null))[_0xa966('0x1d')](saveUpdates(_0x500569[_0xa966('0x41')],null))[_0xa966('0x1d')](respondWithResult(_0x339a44,null))['catch'](handleError(_0x339a44,null));};exports[_0xa966('0x1e')]=function(_0x4867fa,_0x17e910){return db[_0xa966('0x22')][_0xa966('0x3f')]({'where':{'id':_0x4867fa[_0xa966('0x42')]['id']}})['then'](handleEntityNotFound(_0x17e910,null))[_0xa966('0x1d')](removeEntity(_0x17e910,null))['catch'](handleError(_0x17e910,null));};exports['getConfigurations']=function(_0x286c03,_0x4f9dc4,_0x48a054){var _0x15912f={};var _0x18a950={};var _0x4b019e;var _0x2cb5b4;return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x286c03[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x4f9dc4,null))[_0xa966('0x1d')](function(_0x244254){if(_0x244254){_0x4b019e=_0x244254;_0x18a950['model']=_[_0xa966('0x29')](db[_0xa966('0x44')]['rawAttributes']);_0x18a950['query']=_[_0xa966('0x29')](_0x286c03[_0xa966('0x28')]);_0x18a950[_0xa966('0x2a')]=_[_0xa966('0x2b')](_0x18a950[_0xa966('0x26')],_0x18a950[_0xa966('0x28')]);_0x15912f['attributes']=_[_0xa966('0x2b')](_0x18a950[_0xa966('0x26')],qs['fields'](_0x286c03['query'][_0xa966('0x2d')]));_0x15912f[_0xa966('0x2c')]=_0x15912f[_0xa966('0x2c')][_0xa966('0x3d')]?_0x15912f[_0xa966('0x2c')]:_0x18a950[_0xa966('0x26')];_0x15912f[_0xa966('0x30')]=qs[_0xa966('0x31')](_0x286c03[_0xa966('0x28')]['sort']);_0x15912f[_0xa966('0x32')]=qs[_0xa966('0x2a')](_[_0xa966('0x33')](_0x286c03[_0xa966('0x28')],_0x18a950[_0xa966('0x2a')]));if(_0x286c03[_0xa966('0x28')][_0xa966('0x36')]){_0x15912f[_0xa966('0x32')]=_[_0xa966('0x34')](_0x15912f['where'],{'$or':_[_0xa966('0x27')](_0x15912f[_0xa966('0x2c')],function(_0x410c02){var _0x1fd6f7={};_0x1fd6f7[_0x410c02]={'$like':'%'+_0x286c03[_0xa966('0x28')][_0xa966('0x36')]+'%'};return _0x1fd6f7;})});}_0x15912f=_[_0xa966('0x34')]({},_0x15912f,_0x286c03['options']);return _0x4b019e[_0xa966('0x45')](_0x15912f);}})[_0xa966('0x1d')](function(_0x2ee45e){if(_0x2ee45e){_0x2cb5b4=_0x2ee45e[_0xa966('0x3d')];if(!_0x286c03[_0xa966('0x28')][_0xa966('0x2e')](_0xa966('0x2f'))){_0x15912f[_0xa966('0x15')]=qs['limit'](_0x286c03[_0xa966('0x28')][_0xa966('0x15')]);_0x15912f['offset']=qs[_0xa966('0x14')](_0x286c03[_0xa966('0x28')]['offset']);}return _0x4b019e['getConfigurations'](_0x15912f);}})['then'](function(_0x5ac695){if(_0x5ac695){return _0x5ac695?{'count':_0x2cb5b4,'rows':_0x5ac695}:null;}})[_0xa966('0x1d')](respondWithResult(_0x4f9dc4,null))[_0xa966('0x3a')](handleError(_0x4f9dc4,null));};exports[_0xa966('0x46')]=function(_0x329c87,_0x19242f,_0x1e245d){if(_0x329c87[_0xa966('0x41')]['id']){delete _0x329c87[_0xa966('0x41')]['id'];}return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x329c87[_0xa966('0x42')]['id']}})[_0xa966('0x1d')](handleEntityNotFound(_0x19242f,null))[_0xa966('0x1d')](function(_0x2a6b8a){if(_0x2a6b8a){_0x329c87[_0xa966('0x41')][_0xa966('0x47')]=_0x2a6b8a['id'];_0x329c87[_0xa966('0x41')][_0xa966('0x48')]=integrations[_0xa966('0x49')](_0x329c87['body'][_0xa966('0x4a')],_0x329c87[_0xa966('0x41')][_0xa966('0x24')]);_0x329c87[_0xa966('0x41')][_0xa966('0x4b')]=integrations[_0xa966('0x4c')](_0x329c87[_0xa966('0x41')][_0xa966('0x4a')],_0x329c87['body'][_0xa966('0x24')]);return db['VtigerConfiguration']['create'](_0x329c87[_0xa966('0x41')],{'include':[{'model':db[_0xa966('0x4d')],'as':_0xa966('0x48')},{'model':db['VtigerField'],'as':_0xa966('0x4b')}]});}return null;})[_0xa966('0x1d')](respondWithResult(_0x19242f,null))[_0xa966('0x3a')](handleError(_0x19242f,null));};var md5=require('md5');exports[_0xa966('0x4e')]=function(_0x38b042,_0x5ce71a,_0x523414){var _0x38fe0f=null;var _0x28a788=null;var _0x1f6b58=null;var _0x5aea54=null;var _0x47b2df='';return db[_0xa966('0x22')][_0xa966('0x43')]({'where':{'id':_0x38b042[_0xa966('0x42')]['id']},'attributes':['id',_0xa966('0x20'),_0xa966('0x4f'),_0xa966('0x50'),_0xa966('0x51'),_0xa966('0x52'),_0xa966('0x53'),_0xa966('0x54')]})['then'](handleEntityNotFound(_0x5ce71a,null))[_0xa966('0x1d')](function(_0x24931b){if(_0x24931b){_0x38fe0f=_0x24931b['username'];_0x28a788=_0x24931b[_0xa966('0x54')];_0x1f6b58=_0x24931b['moduleName'];_0x47b2df=_0x24931b['remoteUri'];var _0x3add6d=_0x47b2df[_0xa966('0x55')](-0x1);if(_0x3add6d==='/'){_0x47b2df=_0x47b2df['substring'](0x0,_0x47b2df[_0xa966('0x56')](_0x3add6d));}_0x5aea54=util[_0xa966('0x57')](_0xa966('0x58'),_0x47b2df);var _0xecdd91={'method':'GET','uri':_0x5aea54,'qs':{'operation':_0xa966('0x59'),'username':_0x24931b['username']},'json':!![]};return rp(_0xecdd91);}})['then'](function(_0x504cf0){if(_0x504cf0[_0xa966('0x5a')]){var _0x50aa4a={'method':_0xa966('0x5b'),'uri':_0x5aea54,'form':{'operation':_0xa966('0x5c'),'username':_0x38fe0f,'accessKey':md5(_0x504cf0[_0xa966('0x5d')][_0xa966('0x5e')]+_0x28a788)},'json':!![]};return rp(_0x50aa4a);}})['then'](function(_0x583f49){if(_0x583f49[_0xa966('0x5a')]){var _0x303fde={'method':'GET','uri':_0x5aea54,'qs':{'operation':_0xa966('0x5f'),'username':_0x38fe0f,'sessionName':_0x583f49['result'][_0xa966('0x60')],'elementType':_0x1f6b58},'json':!![]};return rp(_0x303fde);}})['then'](function(_0x31393d){if(_0x31393d[_0xa966('0x5a')]){var _0x1599a4=[_0xa966('0x61'),_0xa966('0x62'),_0xa966('0x63')];_['remove'](_0x31393d['result']['fields'],function(_0x975dd8){return _0x1599a4[_0xa966('0x64')](_0x975dd8[_0xa966('0x24')][_0xa966('0x20')]);});_[_0xa966('0x65')](_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')],function(_0x486beb){return _0x486beb['editable']===_0xa966('0x66');});return{'count':_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')][_0xa966('0x3d')],'rows':_[_0xa966('0x27')](_0x31393d[_0xa966('0x5d')][_0xa966('0x2d')],function(_0x1d030d){return{'id':_0x1d030d[_0xa966('0x20')],'name':_0x1d030d[_0xa966('0x67')],'custom':_[_0xa966('0x68')](_0x1d030d['name'],'cf_')?!![]:![],'options':_0x1d030d[_0xa966('0x24')]['name']==='picklist'&&_0x1d030d[_0xa966('0x24')][_0xa966('0x69')]['length']>0x0?_[_0xa966('0x27')](_0x1d030d[_0xa966('0x24')][_0xa966('0x69')],function(_0x376617){return{'name':_0x376617[_0xa966('0x67')],'value':_0x376617[_0xa966('0x6a')]};}):[]};})};}})[_0xa966('0x1d')](respondWithResult(_0x5ce71a,null))['catch'](function(_0x4c3e1d){console[_0xa966('0x6b')](_0xa966('0x6c')+_0x4c3e1d);var _0x1d8717=_0x38b042[_0xa966('0x28')][_0xa966('0x6d')]?0x1f4:_0x4c3e1d[_0xa966('0x6e')]||0x1f4;logger['error'](_0xa966('0x6f'),_0xa966('0x4e'),_0x1d8717,JSON[_0xa966('0x70')](_0x4c3e1d));delete _0x4c3e1d[_0xa966('0x20')];if(_0x1d8717===0x191){_0x1d8717=0x190;}_0x5ce71a[_0xa966('0x17')](_0x1d8717)[_0xa966('0x71')](_0x38b042['query']['test']?{'message':_0xa966('0x72'),'statusCode':_0x4c3e1d[_0xa966('0x6e')]}:_0x4c3e1d);});}; \ No newline at end of file +var _0x4636=['../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','length','include','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','cf_','picklistValues','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','bluebird','mustache','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3b21b8,_0x29b1aa){var _0x2c731b=function(_0x515b81){while(--_0x515b81){_0x3b21b8['push'](_0x3b21b8['shift']());}};_0x2c731b(++_0x29b1aa);}(_0x4636,0x145));var _0x6463=function(_0x3bfdc3,_0x1f5d8e){_0x3bfdc3=_0x3bfdc3-0x0;var _0x486f48=_0x4636[_0x3bfdc3];return _0x486f48;};'use strict';var emlformat=require(_0x6463('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6463('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6463('0x2'));var Mustache=require(_0x6463('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6463('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6463('0x5'));var _=require(_0x6463('0x6'));var squel=require(_0x6463('0x7'));var crypto=require('crypto');var jsforce=require(_0x6463('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6463('0x4'));var querystring=require(_0x6463('0x9'));var Papa=require(_0x6463('0xa'));var Redis=require(_0x6463('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x6463('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6463('0xd'));var logger=require(_0x6463('0xe'))(_0x6463('0xf'));var utils=require(_0x6463('0x10'));var config=require(_0x6463('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6463('0x12'))['db'];var integrations=require(_0x6463('0x13'));function respondWithStatusCode(_0x2e1e94,_0x4298a2){_0x4298a2=_0x4298a2||0xcc;return function(_0x105891){if(_0x105891){return _0x2e1e94[_0x6463('0x14')](_0x4298a2);}return _0x2e1e94[_0x6463('0x15')](_0x4298a2)['end']();};}function respondWithResult(_0x50cb8c,_0x51227f){_0x51227f=_0x51227f||0xc8;return function(_0x4b2281){if(_0x4b2281){return _0x50cb8c[_0x6463('0x15')](_0x51227f)[_0x6463('0x16')](_0x4b2281);}};}function respondWithFilteredResult(_0x478a31,_0xc7dfe2){return function(_0x2692e4){if(_0x2692e4){var _0x24c331=typeof _0xc7dfe2[_0x6463('0x17')]===_0x6463('0x18')&&typeof _0xc7dfe2[_0x6463('0x19')]===_0x6463('0x18');var _0x3186a7=_0x2692e4[_0x6463('0x1a')];var _0x4c13ef=_0x24c331?0x0:_0xc7dfe2[_0x6463('0x17')];var _0x1e4ee1=_0x24c331?_0x2692e4[_0x6463('0x1a')]:_0xc7dfe2[_0x6463('0x17')]+_0xc7dfe2['limit'];var _0x36504c;if(_0x1e4ee1>=_0x3186a7){_0x1e4ee1=_0x3186a7;_0x36504c=0xc8;}else{_0x36504c=0xce;}_0x478a31[_0x6463('0x15')](_0x36504c);return _0x478a31[_0x6463('0x1b')](_0x6463('0x1c'),_0x4c13ef+'-'+_0x1e4ee1+'/'+_0x3186a7)['json'](_0x2692e4);}return null;};}function patchUpdates(_0x54d3cd){return function(_0x1bbb59){try{jsonpatch[_0x6463('0x1d')](_0x1bbb59,_0x54d3cd,!![]);}catch(_0x48802e){return BPromise[_0x6463('0x1e')](_0x48802e);}return _0x1bbb59['save']();};}function saveUpdates(_0x39210d,_0x1331a2){return function(_0x1c3342){if(_0x1c3342){return _0x1c3342['update'](_0x39210d)[_0x6463('0x1f')](function(_0x22c2ce){return _0x22c2ce;});}return null;};}function removeEntity(_0x107a2b,_0x46bc1a){return function(_0xe1d425){if(_0xe1d425){return _0xe1d425[_0x6463('0x20')]()[_0x6463('0x1f')](function(){_0x107a2b[_0x6463('0x15')](0xcc)[_0x6463('0x21')]();});}};}function handleEntityNotFound(_0x439e69,_0x4de460){return function(_0x17837a){if(!_0x17837a){_0x439e69[_0x6463('0x14')](0x194);}return _0x17837a;};}function handleError(_0x208c7c,_0x42965f){_0x42965f=_0x42965f||0x1f4;return function(_0x26a1ce){logger[_0x6463('0x22')](_0x26a1ce['stack']);if(_0x26a1ce['name']){delete _0x26a1ce[_0x6463('0x23')];}_0x208c7c[_0x6463('0x15')](_0x42965f)[_0x6463('0x24')](_0x26a1ce);};}exports['index']=function(_0x2d7ca0,_0x24a843){var _0x4e79f3={},_0x5cf65f={},_0x412715={'count':0x0,'rows':[]};var _0x52a877=_[_0x6463('0x25')](db[_0x6463('0x26')][_0x6463('0x27')],function(_0x40b4b9){return{'name':_0x40b4b9[_0x6463('0x28')],'type':_0x40b4b9[_0x6463('0x29')]['key']};});_0x5cf65f[_0x6463('0x2a')]=_['map'](_0x52a877,_0x6463('0x23'));_0x5cf65f['query']=_[_0x6463('0x2b')](_0x2d7ca0[_0x6463('0x2c')]);_0x5cf65f['filters']=_[_0x6463('0x2d')](_0x5cf65f[_0x6463('0x2a')],_0x5cf65f[_0x6463('0x2c')]);_0x4e79f3[_0x6463('0x2e')]=_[_0x6463('0x2d')](_0x5cf65f['model'],qs[_0x6463('0x2f')](_0x2d7ca0['query'][_0x6463('0x2f')]));_0x4e79f3[_0x6463('0x2e')]=_0x4e79f3[_0x6463('0x2e')]['length']?_0x4e79f3[_0x6463('0x2e')]:_0x5cf65f[_0x6463('0x2a')];if(!_0x2d7ca0[_0x6463('0x2c')][_0x6463('0x30')](_0x6463('0x31'))){_0x4e79f3['limit']=qs[_0x6463('0x19')](_0x2d7ca0[_0x6463('0x2c')][_0x6463('0x19')]);_0x4e79f3[_0x6463('0x17')]=qs['offset'](_0x2d7ca0['query'][_0x6463('0x17')]);}_0x4e79f3[_0x6463('0x32')]=qs[_0x6463('0x33')](_0x2d7ca0[_0x6463('0x2c')]['sort']);_0x4e79f3[_0x6463('0x34')]=qs[_0x6463('0x35')](_[_0x6463('0x36')](_0x2d7ca0[_0x6463('0x2c')],_0x5cf65f[_0x6463('0x35')]),_0x52a877);if(_0x2d7ca0['query']['filter']){_0x4e79f3[_0x6463('0x34')]=_[_0x6463('0x37')](_0x4e79f3[_0x6463('0x34')],{'$or':_[_0x6463('0x25')](_0x52a877,function(_0x19f3da){if(_0x19f3da[_0x6463('0x29')]!==_0x6463('0x38')){var _0x27c1a2={};_0x27c1a2[_0x19f3da[_0x6463('0x23')]]={'$like':'%'+_0x2d7ca0[_0x6463('0x2c')][_0x6463('0x39')]+'%'};return _0x27c1a2;}})});}_0x4e79f3=_['merge']({},_0x4e79f3,_0x2d7ca0[_0x6463('0x3a')]);var _0x5db12a={'where':_0x4e79f3[_0x6463('0x34')]};return db[_0x6463('0x26')][_0x6463('0x1a')](_0x5db12a)[_0x6463('0x1f')](function(_0x159604){_0x412715[_0x6463('0x1a')]=_0x159604;if(_0x2d7ca0[_0x6463('0x2c')][_0x6463('0x3b')]){_0x4e79f3['include']=[{'all':!![]}];}return db[_0x6463('0x26')]['findAll'](_0x4e79f3);})['then'](function(_0xb82475){_0x412715['rows']=_0xb82475;return _0x412715;})['then'](respondWithFilteredResult(_0x24a843,_0x4e79f3))[_0x6463('0x3c')](handleError(_0x24a843,null));};exports[_0x6463('0x3d')]=function(_0x1c5472,_0x5f2512){var _0x3404d9={'raw':![],'where':{'id':_0x1c5472[_0x6463('0x3e')]['id']}},_0x72a9d0={};_0x72a9d0[_0x6463('0x2a')]=_['keys'](db[_0x6463('0x26')][_0x6463('0x27')]);_0x72a9d0[_0x6463('0x2c')]=_[_0x6463('0x2b')](_0x1c5472[_0x6463('0x2c')]);_0x72a9d0[_0x6463('0x35')]=_[_0x6463('0x2d')](_0x72a9d0[_0x6463('0x2a')],_0x72a9d0[_0x6463('0x2c')]);_0x3404d9[_0x6463('0x2e')]=_['intersection'](_0x72a9d0[_0x6463('0x2a')],qs[_0x6463('0x2f')](_0x1c5472['query']['fields']));_0x3404d9[_0x6463('0x2e')]=_0x3404d9[_0x6463('0x2e')][_0x6463('0x3f')]?_0x3404d9[_0x6463('0x2e')]:_0x72a9d0[_0x6463('0x2a')];if(_0x1c5472['query'][_0x6463('0x3b')]){_0x3404d9[_0x6463('0x40')]=[{'all':!![]}];}_0x3404d9=_[_0x6463('0x37')]({},_0x3404d9,_0x1c5472[_0x6463('0x3a')]);return db['VtigerAccount'][_0x6463('0x41')](_0x3404d9)[_0x6463('0x1f')](handleEntityNotFound(_0x5f2512,null))[_0x6463('0x1f')](respondWithResult(_0x5f2512,null))[_0x6463('0x3c')](handleError(_0x5f2512,null));};exports[_0x6463('0x42')]=function(_0x440e1a,_0x373376){return db[_0x6463('0x26')][_0x6463('0x42')](_0x440e1a[_0x6463('0x43')],{})[_0x6463('0x1f')](respondWithResult(_0x373376,0xc9))[_0x6463('0x3c')](handleError(_0x373376,null));};exports[_0x6463('0x44')]=function(_0x4030df,_0xf1f728){if(_0x4030df[_0x6463('0x43')]['id']){delete _0x4030df[_0x6463('0x43')]['id'];}return db[_0x6463('0x26')][_0x6463('0x41')]({'where':{'id':_0x4030df['params']['id']}})[_0x6463('0x1f')](handleEntityNotFound(_0xf1f728,null))['then'](saveUpdates(_0x4030df['body'],null))[_0x6463('0x1f')](respondWithResult(_0xf1f728,null))[_0x6463('0x3c')](handleError(_0xf1f728,null));};exports[_0x6463('0x20')]=function(_0x43080d,_0x15b836){return db[_0x6463('0x26')][_0x6463('0x41')]({'where':{'id':_0x43080d[_0x6463('0x3e')]['id']}})[_0x6463('0x1f')](handleEntityNotFound(_0x15b836,null))[_0x6463('0x1f')](removeEntity(_0x15b836,null))['catch'](handleError(_0x15b836,null));};exports[_0x6463('0x45')]=function(_0x2c16fe,_0x20ddc7,_0x2610a3){var _0xb5be03={};var _0x42a052={};var _0x1caf3e;var _0x903f65;return db[_0x6463('0x26')][_0x6463('0x46')]({'where':{'id':_0x2c16fe[_0x6463('0x3e')]['id']}})[_0x6463('0x1f')](handleEntityNotFound(_0x20ddc7,null))['then'](function(_0x8c7a4b){if(_0x8c7a4b){_0x1caf3e=_0x8c7a4b;_0x42a052[_0x6463('0x2a')]=_['keys'](db[_0x6463('0x47')][_0x6463('0x27')]);_0x42a052['query']=_[_0x6463('0x2b')](_0x2c16fe[_0x6463('0x2c')]);_0x42a052[_0x6463('0x35')]=_[_0x6463('0x2d')](_0x42a052[_0x6463('0x2a')],_0x42a052[_0x6463('0x2c')]);_0xb5be03['attributes']=_[_0x6463('0x2d')](_0x42a052['model'],qs[_0x6463('0x2f')](_0x2c16fe[_0x6463('0x2c')][_0x6463('0x2f')]));_0xb5be03[_0x6463('0x2e')]=_0xb5be03['attributes']['length']?_0xb5be03[_0x6463('0x2e')]:_0x42a052[_0x6463('0x2a')];_0xb5be03[_0x6463('0x32')]=qs['sort'](_0x2c16fe[_0x6463('0x2c')][_0x6463('0x33')]);_0xb5be03[_0x6463('0x34')]=qs[_0x6463('0x35')](_['pick'](_0x2c16fe[_0x6463('0x2c')],_0x42a052['filters']));if(_0x2c16fe[_0x6463('0x2c')][_0x6463('0x39')]){_0xb5be03[_0x6463('0x34')]=_['merge'](_0xb5be03[_0x6463('0x34')],{'$or':_[_0x6463('0x25')](_0xb5be03['attributes'],function(_0x34d4ba){var _0xbb88b7={};_0xbb88b7[_0x34d4ba]={'$like':'%'+_0x2c16fe[_0x6463('0x2c')]['filter']+'%'};return _0xbb88b7;})});}_0xb5be03=_['merge']({},_0xb5be03,_0x2c16fe['options']);return _0x1caf3e['getConfigurations'](_0xb5be03);}})[_0x6463('0x1f')](function(_0x4ba593){if(_0x4ba593){_0x903f65=_0x4ba593[_0x6463('0x3f')];if(!_0x2c16fe['query'][_0x6463('0x30')](_0x6463('0x31'))){_0xb5be03[_0x6463('0x19')]=qs['limit'](_0x2c16fe[_0x6463('0x2c')]['limit']);_0xb5be03[_0x6463('0x17')]=qs['offset'](_0x2c16fe[_0x6463('0x2c')]['offset']);}return _0x1caf3e['getConfigurations'](_0xb5be03);}})[_0x6463('0x1f')](function(_0x14c754){if(_0x14c754){return _0x14c754?{'count':_0x903f65,'rows':_0x14c754}:null;}})[_0x6463('0x1f')](respondWithResult(_0x20ddc7,null))[_0x6463('0x3c')](handleError(_0x20ddc7,null));};exports[_0x6463('0x48')]=function(_0x20303e,_0x585d78,_0x599795){if(_0x20303e['body']['id']){delete _0x20303e['body']['id'];}return db['VtigerAccount'][_0x6463('0x46')]({'where':{'id':_0x20303e[_0x6463('0x3e')]['id']}})[_0x6463('0x1f')](handleEntityNotFound(_0x585d78,null))['then'](function(_0x2b9ad4){if(_0x2b9ad4){_0x20303e[_0x6463('0x43')]['AccountId']=_0x2b9ad4['id'];_0x20303e[_0x6463('0x43')]['Subjects']=integrations[_0x6463('0x49')](_0x20303e[_0x6463('0x43')][_0x6463('0x4a')],_0x20303e['body'][_0x6463('0x29')]);_0x20303e[_0x6463('0x43')][_0x6463('0x4b')]=integrations[_0x6463('0x4c')](_0x20303e[_0x6463('0x43')]['channel'],_0x20303e[_0x6463('0x43')][_0x6463('0x29')]);return db[_0x6463('0x47')][_0x6463('0x42')](_0x20303e[_0x6463('0x43')],{'include':[{'model':db[_0x6463('0x4d')],'as':_0x6463('0x4e')},{'model':db[_0x6463('0x4d')],'as':_0x6463('0x4b')}]});}return null;})[_0x6463('0x1f')](respondWithResult(_0x585d78,null))['catch'](handleError(_0x585d78,null));};var md5=require(_0x6463('0x4f'));exports[_0x6463('0x50')]=function(_0x3534ea,_0x282d89,_0x4f3c2b){var _0x2690fc=null;var _0x3567e6=null;var _0x1b3da8=null;var _0x60cea0=null;var _0x3a7622='';return db['VtigerAccount'][_0x6463('0x46')]({'where':{'id':_0x3534ea[_0x6463('0x3e')]['id']},'attributes':['id',_0x6463('0x23'),_0x6463('0x51'),_0x6463('0x52'),_0x6463('0x53'),_0x6463('0x54'),_0x6463('0x55'),_0x6463('0x56')]})[_0x6463('0x1f')](handleEntityNotFound(_0x282d89,null))[_0x6463('0x1f')](function(_0x36bf5d){if(_0x36bf5d){_0x2690fc=_0x36bf5d['username'];_0x3567e6=_0x36bf5d[_0x6463('0x56')];_0x1b3da8=_0x36bf5d[_0x6463('0x53')];_0x3a7622=_0x36bf5d[_0x6463('0x54')];var _0xde8dd=_0x3a7622['slice'](-0x1);if(_0xde8dd==='/'){_0x3a7622=_0x3a7622[_0x6463('0x57')](0x0,_0x3a7622[_0x6463('0x58')](_0xde8dd));}_0x60cea0=util[_0x6463('0x59')](_0x6463('0x5a'),_0x3a7622);var _0x1e2038={'method':_0x6463('0x5b'),'uri':_0x60cea0,'qs':{'operation':_0x6463('0x5c'),'username':_0x36bf5d[_0x6463('0x51')]},'json':!![]};return rp(_0x1e2038);}})['then'](function(_0x1f5b52){if(_0x1f5b52['success']){var _0x4903d1={'method':'POST','uri':_0x60cea0,'form':{'operation':_0x6463('0x5d'),'username':_0x2690fc,'accessKey':md5(_0x1f5b52[_0x6463('0x5e')][_0x6463('0x5f')]+_0x3567e6)},'json':!![]};return rp(_0x4903d1);}})[_0x6463('0x1f')](function(_0xf4a457){if(_0xf4a457[_0x6463('0x60')]){var _0x48221d={'method':'GET','uri':_0x60cea0,'qs':{'operation':_0x6463('0x61'),'username':_0x2690fc,'sessionName':_0xf4a457['result'][_0x6463('0x62')],'elementType':_0x1b3da8},'json':!![]};return rp(_0x48221d);}})[_0x6463('0x1f')](function(_0x1f38aa){if(_0x1f38aa[_0x6463('0x60')]){var _0x604c29=[_0x6463('0x63'),_0x6463('0x64'),_0x6463('0x65')];_[_0x6463('0x66')](_0x1f38aa[_0x6463('0x5e')][_0x6463('0x2f')],function(_0x554607){return _0x604c29['includes'](_0x554607['type'][_0x6463('0x23')]);});_[_0x6463('0x66')](_0x1f38aa[_0x6463('0x5e')][_0x6463('0x2f')],function(_0x35ee03){return _0x35ee03[_0x6463('0x67')]===_0x6463('0x68');});return{'count':_0x1f38aa['result'][_0x6463('0x2f')][_0x6463('0x3f')],'rows':_['map'](_0x1f38aa[_0x6463('0x5e')][_0x6463('0x2f')],function(_0x2116ba){return{'id':_0x2116ba['name'],'name':_0x2116ba[_0x6463('0x69')],'custom':_['startsWith'](_0x2116ba[_0x6463('0x23')],_0x6463('0x6a'))?!![]:![],'options':_0x2116ba[_0x6463('0x29')][_0x6463('0x23')]==='picklist'&&_0x2116ba['type'][_0x6463('0x6b')]['length']>0x0?_[_0x6463('0x25')](_0x2116ba[_0x6463('0x29')][_0x6463('0x6b')],function(_0x23e620){return{'name':_0x23e620['label'],'value':_0x23e620[_0x6463('0x6c')]};}):[]};})};}})[_0x6463('0x1f')](respondWithResult(_0x282d89,null))['catch'](function(_0x4a3358){console['log']('vTiger\x20error:\x20'+_0x4a3358);var _0x21c480=_0x3534ea['query'][_0x6463('0x6d')]?0x1f4:_0x4a3358[_0x6463('0x6e')]||0x1f4;logger['error'](_0x6463('0x6f'),'getFields',_0x21c480,JSON[_0x6463('0x70')](_0x4a3358));delete _0x4a3358[_0x6463('0x23')];if(_0x21c480===0x191){_0x21c480=0x190;}_0x282d89['status'](_0x21c480)[_0x6463('0x24')](_0x3534ea[_0x6463('0x2c')][_0x6463('0x6d')]?{'message':_0x6463('0x71'),'statusCode':_0x4a3358[_0x6463('0x6e')]}:_0x4a3358);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 52d14e5..dbeb603 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 _0x0ed3=['int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x574841,_0x165eb6){var _0x552118=function(_0x4a3afc){while(--_0x4a3afc){_0x574841['push'](_0x574841['shift']());}};_0x552118(++_0x165eb6);}(_0x0ed3,0xd1));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x30ed('0x0'));var util=require(_0x30ed('0x1'));var logger=require(_0x30ed('0x2'))(_0x30ed('0x3'));var moment=require(_0x30ed('0x4'));var BPromise=require(_0x30ed('0x5'));var rp=require(_0x30ed('0x6'));var fs=require('fs');var path=require(_0x30ed('0x7'));var rimraf=require(_0x30ed('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x30ed('0x9'));module[_0x30ed('0xa')]=function(_0x57bc68,_0x3f9089){return _0x57bc68[_0x30ed('0xb')]('VtigerAccount',attributes,{'tableName':_0x30ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf293=['int_vtiger_accounts','util','../../config/logger','bluebird','rimraf','./intVtigerAccount.attributes','exports','define'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf293,0xc1));var _0x3f29=function(_0x5b4ba1,_0x453652){_0x5b4ba1=_0x5b4ba1-0x0;var _0x3a0299=_0xf293[_0x5b4ba1];return _0x3a0299;};'use strict';var _=require('lodash');var util=require(_0x3f29('0x0'));var logger=require(_0x3f29('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3f29('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f29('0x3'));var config=require('../../config/environment');var attributes=require(_0x3f29('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x3f29('0x5')]=function(_0x50f059,_0x8b8787){return _0x50f059[_0x3f29('0x6')]('VtigerAccount',attributes,{'tableName':_0x3f29('0x7'),'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 1a97e96..8ebf9cc 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 _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x27d409,_0x474e7d){var _0x135c4b=function(_0x29e74d){while(--_0x29e74d){_0x27d409['push'](_0x27d409['shift']());}};_0x135c4b(++_0x474e7d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x383523,_0x262138){_0x383523=_0x383523-0x0;var _0x29c502=_0xf7b4[_0x383523];return _0x29c502;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file +var _0x0565=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','GetVtigerAccount','options','raw','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x463791,_0xcee36c){var _0x58dd5c=function(_0x24267f){while(--_0x24267f){_0x463791['push'](_0x463791['shift']());}};_0x58dd5c(++_0xcee36c);}(_0x0565,0xf2));var _0x5056=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x0565[_0x576170];return _0x397c70;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});}exports[_0x5056('0x17')]=function(_0x4056ce){var _0x51b21e=this;return new Promise(function(_0x9ea88,_0x56537e){return db['VtigerAccount']['findAll']({'raw':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1b')]||null:null,'limit':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1c')]||null:null,'include':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')]['include']?_[_0x5056('0x1d')](_0x4056ce[_0x5056('0x18')]['include'],function(_0x4a64be){return{'model':db[_0x4a64be[_0x5056('0x1e')]],'as':_0x4a64be['as'],'attributes':_0x4a64be[_0x5056('0x1b')],'include':_0x4a64be[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x4a64be['include'],function(_0x267048){return{'model':db[_0x267048[_0x5056('0x1e')]],'as':_0x267048['as'],'attributes':_0x267048['attributes'],'include':_0x267048[_0x5056('0x1f')]?_['map'](_0x267048[_0x5056('0x1f')],function(_0x39d539){return{'model':db[_0x39d539[_0x5056('0x1e')]],'as':_0x39d539['as'],'attributes':_0x39d539[_0x5056('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x50f2a8){logger[_0x5056('0xf')](_0x5056('0x17'),_0x4056ce);logger[_0x5056('0x20')](_0x5056('0x17'),_0x4056ce,JSON['stringify'](_0x50f2a8));_0x9ea88(_0x50f2a8);})[_0x5056('0x21')](function(_0x5b0270){logger[_0x5056('0x16')]('GetVtigerAccount',_0x5b0270['message'],_0x4056ce);_0x56537e(_0x51b21e['error'](0x1f4,_0x5b0270[_0x5056('0x15')]));});});};exports[_0x5056('0x22')]=function(_0x482939){var _0x27f4be=this;return new Promise(function(_0x2c5728,_0x9e2986){return db[_0x5056('0x23')][_0x5056('0x24')]({'raw':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x482939['options']?_0x482939['options'][_0x5056('0x1b')]||null:null,'include':_0x482939[_0x5056('0x18')]?_0x482939['options'][_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x482939['options'][_0x5056('0x1f')],function(_0x378b33){return{'model':db[_0x378b33[_0x5056('0x1e')]],'as':_0x378b33['as'],'attributes':_0x378b33[_0x5056('0x1b')],'include':_0x378b33[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x378b33[_0x5056('0x1f')],function(_0x2f1d27){return{'model':db[_0x2f1d27[_0x5056('0x1e')]],'as':_0x2f1d27['as'],'attributes':_0x2f1d27[_0x5056('0x1b')],'include':_0x2f1d27[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x2f1d27[_0x5056('0x1f')],function(_0x3d7d78){return{'model':db[_0x3d7d78[_0x5056('0x1e')]],'as':_0x3d7d78['as'],'attributes':_0x3d7d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x483d1e){logger[_0x5056('0xf')](_0x5056('0x22'),_0x482939);logger[_0x5056('0x20')](_0x5056('0x22'),_0x482939,JSON['stringify'](_0x483d1e));_0x2c5728(_0x483d1e);})[_0x5056('0x21')](function(_0x32fecc){logger['error'](_0x5056('0x22'),_0x32fecc['message'],_0x482939);_0x9e2986(_0x27f4be[_0x5056('0x16')](0x1f4,_0x32fecc[_0x5056('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 02d4459..7e2da06 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 _0x4df3=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4df3,0x178));var _0x34df=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x4df3[_0x1fa759];return _0x2da9f4;};'use strict';var multer=require(_0x34df('0x0'));var util=require(_0x34df('0x1'));var path=require(_0x34df('0x2'));var timeout=require('connect-timeout');var express=require(_0x34df('0x3'));var router=express[_0x34df('0x4')]();var fs_extra=require(_0x34df('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x34df('0x6'));var controller=require(_0x34df('0x7'));router[_0x34df('0x8')]('/',auth[_0x34df('0x9')](),controller[_0x34df('0xa')]);router['get'](_0x34df('0xb'),auth[_0x34df('0x9')](),controller[_0x34df('0xc')]);router[_0x34df('0x8')](_0x34df('0xd'),auth['isAuthenticated'](),controller[_0x34df('0xe')]);router[_0x34df('0x8')](_0x34df('0xf'),auth['isAuthenticated'](),controller[_0x34df('0x10')]);router[_0x34df('0x8')](_0x34df('0x11'),auth[_0x34df('0x9')](),controller[_0x34df('0x12')]);router[_0x34df('0x13')]('/',auth['isAuthenticated'](),controller[_0x34df('0x14')]);router[_0x34df('0x15')](_0x34df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x34df('0x16')](_0x34df('0xb'),auth[_0x34df('0x9')](),controller[_0x34df('0x17')]);module[_0x34df('0x18')]=router; \ No newline at end of file +var _0x9ccc=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ccc,0x10b));var _0xc9cc=function(_0x1ba92a,_0x242f37){_0x1ba92a=_0x1ba92a-0x0;var _0x340f7d=_0x9ccc[_0x1ba92a];return _0x340f7d;};'use strict';var multer=require(_0xc9cc('0x0'));var util=require('util');var path=require(_0xc9cc('0x1'));var timeout=require(_0xc9cc('0x2'));var express=require(_0xc9cc('0x3'));var router=express[_0xc9cc('0x4')]();var fs_extra=require(_0xc9cc('0x5'));var auth=require(_0xc9cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc9cc('0x7'));var controller=require(_0xc9cc('0x8'));router[_0xc9cc('0x9')]('/',auth[_0xc9cc('0xa')](),controller[_0xc9cc('0xb')]);router[_0xc9cc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc9cc('0xc')]);router[_0xc9cc('0x9')](_0xc9cc('0xd'),auth[_0xc9cc('0xa')](),controller[_0xc9cc('0xe')]);router['get'](_0xc9cc('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xc9cc('0x10'),auth[_0xc9cc('0xa')](),controller[_0xc9cc('0x11')]);router[_0xc9cc('0x12')]('/',auth[_0xc9cc('0xa')](),controller[_0xc9cc('0x13')]);router['put'](_0xc9cc('0x14'),auth[_0xc9cc('0xa')](),controller['update']);router[_0xc9cc('0x15')](_0xc9cc('0x14'),auth[_0xc9cc('0xa')](),controller[_0xc9cc('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 83656c1..a0fdf83 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 _0xf699=['exports','STRING','sequelize'];(function(_0x5a2d6c,_0x4cb424){var _0x9341ed=function(_0x58b5b1){while(--_0x58b5b1){_0x5a2d6c['push'](_0x5a2d6c['shift']());}};_0x9341ed(++_0x4cb424);}(_0xf699,0x146));var _0x9f69=function(_0x567ab9,_0x240ddd){_0x567ab9=_0x567ab9-0x0;var _0xe262ee=_0xf699[_0x567ab9];return _0xe262ee;};'use strict';var Sequelize=require(_0x9f69('0x0'));module[_0x9f69('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f69('0x2')]}}; \ No newline at end of file +var _0x51f1=['STRING','sequelize','exports'];(function(_0x412145,_0x5bf3a5){var _0x280bc1=function(_0x4c78d2){while(--_0x4c78d2){_0x412145['push'](_0x412145['shift']());}};_0x280bc1(++_0x5bf3a5);}(_0x51f1,0xb5));var _0x151f=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0x51f1[_0x13e8ac];return _0xc77ea6;};'use strict';var Sequelize=require(_0x151f('0x0'));module[_0x151f('0x1')]={'name':{'type':Sequelize[_0x151f('0x2')]},'description':{'type':Sequelize[_0x151f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 23aeba5..cf08a35 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 _0x1cc7=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','getFields','findOne','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1cc7,0x15a));var _0x71cc=function(_0x463949,_0x215920){_0x463949=_0x463949-0x0;var _0x28292d=_0x1cc7[_0x463949];return _0x28292d;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['VtigerConfiguration'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5,_0x2cac03){var _0x3d0f9f={};var _0x5c88a3={};var _0x3edacf;var _0x1c311b;return db[_0x71cc('0x27')][_0x71cc('0x4a')]({'where':{'id':_0x36c71e[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x5c9ac5,null))[_0x71cc('0x1f')](function(_0x5236c0){if(_0x5236c0){_0x3edacf=_0x5236c0;_0x5c88a3[_0x71cc('0x2c')]=_[_0x71cc('0x2d')](db['VtigerField']['rawAttributes']);_0x5c88a3[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x36c71e['query']);_0x5c88a3[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x5c88a3[_0x71cc('0x2c')],_0x5c88a3[_0x71cc('0x2e')]);_0x3d0f9f[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x5c88a3['model'],qs['fields'](_0x36c71e[_0x71cc('0x2e')]['fields']));_0x3d0f9f['attributes']=_0x3d0f9f[_0x71cc('0x31')]['length']?_0x3d0f9f['attributes']:_0x5c88a3['model'];_0x3d0f9f['order']=qs['sort'](_0x36c71e[_0x71cc('0x2e')]['sort']);_0x3d0f9f['where']=qs[_0x71cc('0x2f')](_[_0x71cc('0x39')](_0x36c71e[_0x71cc('0x2e')],_0x5c88a3[_0x71cc('0x2f')]));if(_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x3d0f9f['where']=_['merge'](_0x3d0f9f['where'],{'$or':_[_0x71cc('0x26')](_0x3d0f9f[_0x71cc('0x31')],function(_0x4078a8){var _0x18811b={};_0x18811b[_0x4078a8]={'$like':'%'+_0x36c71e[_0x71cc('0x2e')]['filter']+'%'};return _0x18811b;})});}_0x3d0f9f=_[_0x71cc('0x3c')]({},_0x3d0f9f,_0x36c71e[_0x71cc('0x3d')]);return _0x3edacf['getFields'](_0x3d0f9f);}})['then'](function(_0x349d62){if(_0x349d62){_0x1c311b=_0x349d62[_0x71cc('0x33')];if(!_0x36c71e['query']['hasOwnProperty'](_0x71cc('0x35'))){_0x3d0f9f['limit']=qs['limit'](_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x3d0f9f[_0x71cc('0x16')]=qs['offset'](_0x36c71e[_0x71cc('0x2e')][_0x71cc('0x16')]);}return _0x3edacf[_0x71cc('0x49')](_0x3d0f9f);}})['then'](function(_0x56c295){if(_0x56c295){return _0x56c295?{'count':_0x1c311b,'rows':_0x56c295}:null;}})['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));};exports[_0x71cc('0x4b')]=function(_0x4092f7,_0xf1301,_0xaa5aca){var _0x184e30={};var _0x515d18={};var _0x48b10c;var _0x3cf283;return db[_0x71cc('0x27')][_0x71cc('0x4a')]({'where':{'id':_0x4092f7[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0xf1301,null))[_0x71cc('0x1f')](function(_0x1f8649){if(_0x1f8649){_0x48b10c=_0x1f8649;_0x515d18[_0x71cc('0x2c')]=_[_0x71cc('0x2d')](db[_0x71cc('0x4c')]['rawAttributes']);_0x515d18['query']=_[_0x71cc('0x2d')](_0x4092f7[_0x71cc('0x2e')]);_0x515d18[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x515d18[_0x71cc('0x2c')],_0x515d18[_0x71cc('0x2e')]);_0x184e30[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x515d18[_0x71cc('0x2c')],qs['fields'](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x184e30[_0x71cc('0x31')]=_0x184e30[_0x71cc('0x31')]['length']?_0x184e30['attributes']:_0x515d18[_0x71cc('0x2c')];_0x184e30[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x37')]);_0x184e30['where']=qs['filters'](_[_0x71cc('0x39')](_0x4092f7[_0x71cc('0x2e')],_0x515d18['filters']));if(_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x184e30[_0x71cc('0x38')]=_[_0x71cc('0x3c')](_0x184e30['where'],{'$or':_['map'](_0x184e30['attributes'],function(_0x2afcda){var _0x39cf93={};_0x39cf93[_0x2afcda]={'$like':'%'+_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x3a')]+'%'};return _0x39cf93;})});}_0x184e30=_[_0x71cc('0x3c')]({},_0x184e30,_0x4092f7[_0x71cc('0x3d')]);return _0x48b10c[_0x71cc('0x4b')](_0x184e30);}})[_0x71cc('0x1f')](function(_0x24a072){if(_0x24a072){_0x3cf283=_0x24a072[_0x71cc('0x33')];if(!_0x4092f7['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x184e30[_0x71cc('0x19')]=qs[_0x71cc('0x19')](_0x4092f7['query']['limit']);_0x184e30[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x4092f7[_0x71cc('0x2e')][_0x71cc('0x16')]);}return _0x48b10c[_0x71cc('0x4b')](_0x184e30);}})[_0x71cc('0x1f')](function(_0x482e21){if(_0x482e21){return _0x482e21?{'count':_0x3cf283,'rows':_0x482e21}:null;}})[_0x71cc('0x1f')](respondWithResult(_0xf1301,null))[_0x71cc('0x44')](handleError(_0xf1301,null));};exports['getDescriptions']=function(_0x508b82,_0x3d4edf,_0x350f34){var _0x1c18f8={};var _0x141a4e={};var _0x48d807;var _0x5a6b22;return db['VtigerConfiguration'][_0x71cc('0x4a')]({'where':{'id':_0x508b82['params']['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x3d4edf,null))[_0x71cc('0x1f')](function(_0x5d23c9){if(_0x5d23c9){_0x48d807=_0x5d23c9;_0x141a4e['model']=_[_0x71cc('0x2d')](db[_0x71cc('0x4c')][_0x71cc('0x28')]);_0x141a4e[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x508b82[_0x71cc('0x2e')]);_0x141a4e[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x141a4e[_0x71cc('0x2c')],_0x141a4e['query']);_0x1c18f8['attributes']=_[_0x71cc('0x30')](_0x141a4e[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x508b82[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x1c18f8['attributes']=_0x1c18f8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x1c18f8['attributes']:_0x141a4e['model'];_0x1c18f8[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x508b82[_0x71cc('0x2e')]['sort']);_0x1c18f8[_0x71cc('0x38')]=qs[_0x71cc('0x2f')](_[_0x71cc('0x39')](_0x508b82['query'],_0x141a4e[_0x71cc('0x2f')]));if(_0x508b82[_0x71cc('0x2e')]['filter']){_0x1c18f8[_0x71cc('0x38')]=_[_0x71cc('0x3c')](_0x1c18f8[_0x71cc('0x38')],{'$or':_[_0x71cc('0x26')](_0x1c18f8[_0x71cc('0x31')],function(_0x1d9bfe){var _0x3525e2={};_0x3525e2[_0x1d9bfe]={'$like':'%'+_0x508b82[_0x71cc('0x2e')][_0x71cc('0x3a')]+'%'};return _0x3525e2;})});}_0x1c18f8=_['merge']({},_0x1c18f8,_0x508b82[_0x71cc('0x3d')]);return _0x48d807[_0x71cc('0x4d')](_0x1c18f8);}})[_0x71cc('0x1f')](function(_0x153bc0){if(_0x153bc0){_0x5a6b22=_0x153bc0[_0x71cc('0x33')];if(!_0x508b82[_0x71cc('0x2e')][_0x71cc('0x34')]('nolimit')){_0x1c18f8[_0x71cc('0x19')]=qs[_0x71cc('0x19')](_0x508b82[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1c18f8['offset']=qs[_0x71cc('0x16')](_0x508b82[_0x71cc('0x2e')]['offset']);}return _0x48d807[_0x71cc('0x4d')](_0x1c18f8);}})[_0x71cc('0x1f')](function(_0x469269){if(_0x469269){return _0x469269?{'count':_0x5a6b22,'rows':_0x469269}:null;}})[_0x71cc('0x1f')](respondWithResult(_0x3d4edf,null))[_0x71cc('0x44')](handleError(_0x3d4edf,null));}; \ No newline at end of file +var _0xb353=['findOne','VtigerField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','desk.js','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','sendStatus','end','status','offset','undefined','count','limit','json','save','update','then','destroy','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','getFields'];(function(_0x1b6f3b,_0x4733f6){var _0x2945db=function(_0x1a4001){while(--_0x1a4001){_0x1b6f3b['push'](_0x1b6f3b['shift']());}};_0x2945db(++_0x4733f6);}(_0xb353,0x1e5));var _0x3b35=function(_0x4b0c72,_0x20cd87){_0x4b0c72=_0x4b0c72-0x0;var _0x20f469=_0xb353[_0x4b0c72];return _0x20f469;};'use strict';var emlformat=require(_0x3b35('0x0'));var rimraf=require(_0x3b35('0x1'));var zipdir=require(_0x3b35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b35('0x3'));var moment=require(_0x3b35('0x4'));var BPromise=require(_0x3b35('0x5'));var Mustache=require('mustache');var util=require(_0x3b35('0x6'));var path=require(_0x3b35('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b35('0x8'));var fs=require('fs');var fs_extra=require(_0x3b35('0x9'));var _=require(_0x3b35('0xa'));var squel=require('squel');var crypto=require(_0x3b35('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3b35('0xc'));var toCsv=require(_0x3b35('0xd'));var querystring=require(_0x3b35('0xe'));var Papa=require(_0x3b35('0xf'));var Redis=require(_0x3b35('0x10'));var authService=require(_0x3b35('0x11'));var qs=require(_0x3b35('0x12'));var as=require(_0x3b35('0x13'));var hardwareService=require(_0x3b35('0x14'));var logger=require(_0x3b35('0x15'))(_0x3b35('0x16'));var utils=require('../../config/utils');var config=require(_0x3b35('0x17'));var licenseUtil=require(_0x3b35('0x18'));var db=require(_0x3b35('0x19'))['db'];function respondWithStatusCode(_0x28f80b,_0x5d2058){_0x5d2058=_0x5d2058||0xcc;return function(_0x1fbe44){if(_0x1fbe44){return _0x28f80b[_0x3b35('0x1a')](_0x5d2058);}return _0x28f80b['status'](_0x5d2058)[_0x3b35('0x1b')]();};}function respondWithResult(_0x5f4c10,_0x442b28){_0x442b28=_0x442b28||0xc8;return function(_0x1b2ce0){if(_0x1b2ce0){return _0x5f4c10[_0x3b35('0x1c')](_0x442b28)['json'](_0x1b2ce0);}};}function respondWithFilteredResult(_0x489d6e,_0x1ac3e8){return function(_0x4e8867){if(_0x4e8867){var _0x2ce87f=typeof _0x1ac3e8[_0x3b35('0x1d')]===_0x3b35('0x1e')&&typeof _0x1ac3e8['limit']===_0x3b35('0x1e');var _0x59bd7c=_0x4e8867[_0x3b35('0x1f')];var _0x5277da=_0x2ce87f?0x0:_0x1ac3e8[_0x3b35('0x1d')];var _0x5925e0=_0x2ce87f?_0x4e8867[_0x3b35('0x1f')]:_0x1ac3e8[_0x3b35('0x1d')]+_0x1ac3e8[_0x3b35('0x20')];var _0x3003d9;if(_0x5925e0>=_0x59bd7c){_0x5925e0=_0x59bd7c;_0x3003d9=0xc8;}else{_0x3003d9=0xce;}_0x489d6e['status'](_0x3003d9);return _0x489d6e['set']('Content-Range',_0x5277da+'-'+_0x5925e0+'/'+_0x59bd7c)[_0x3b35('0x21')](_0x4e8867);}return null;};}function patchUpdates(_0x5a854a){return function(_0x456818){try{jsonpatch['apply'](_0x456818,_0x5a854a,!![]);}catch(_0x293685){return BPromise['reject'](_0x293685);}return _0x456818[_0x3b35('0x22')]();};}function saveUpdates(_0x5e8336,_0x575915){return function(_0x5f2639){if(_0x5f2639){return _0x5f2639[_0x3b35('0x23')](_0x5e8336)[_0x3b35('0x24')](function(_0x4de359){return _0x4de359;});}return null;};}function removeEntity(_0x41f7ec,_0x51b7de){return function(_0x5a4515){if(_0x5a4515){return _0x5a4515[_0x3b35('0x25')]()[_0x3b35('0x24')](function(){_0x41f7ec[_0x3b35('0x1c')](0xcc)[_0x3b35('0x1b')]();});}};}function handleEntityNotFound(_0x2ea54f,_0x145602){return function(_0x7dd7a4){if(!_0x7dd7a4){_0x2ea54f['sendStatus'](0x194);}return _0x7dd7a4;};}function handleError(_0xdf8596,_0x474626){_0x474626=_0x474626||0x1f4;return function(_0x419581){logger['error'](_0x419581[_0x3b35('0x26')]);if(_0x419581[_0x3b35('0x27')]){delete _0x419581['name'];}_0xdf8596[_0x3b35('0x1c')](_0x474626)['send'](_0x419581);};}exports[_0x3b35('0x28')]=function(_0x464401,_0x5e3dd0){var _0x531ac6={},_0x159d7f={},_0x1e3b9a={'count':0x0,'rows':[]};var _0x161fa0=_[_0x3b35('0x29')](db[_0x3b35('0x2a')][_0x3b35('0x2b')],function(_0x5c2c26){return{'name':_0x5c2c26[_0x3b35('0x2c')],'type':_0x5c2c26[_0x3b35('0x2d')][_0x3b35('0x2e')]};});_0x159d7f[_0x3b35('0x2f')]=_[_0x3b35('0x29')](_0x161fa0,'name');_0x159d7f[_0x3b35('0x30')]=_[_0x3b35('0x31')](_0x464401[_0x3b35('0x30')]);_0x159d7f[_0x3b35('0x32')]=_[_0x3b35('0x33')](_0x159d7f[_0x3b35('0x2f')],_0x159d7f[_0x3b35('0x30')]);_0x531ac6[_0x3b35('0x34')]=_['intersection'](_0x159d7f[_0x3b35('0x2f')],qs[_0x3b35('0x35')](_0x464401['query'][_0x3b35('0x35')]));_0x531ac6[_0x3b35('0x34')]=_0x531ac6[_0x3b35('0x34')][_0x3b35('0x36')]?_0x531ac6[_0x3b35('0x34')]:_0x159d7f[_0x3b35('0x2f')];if(!_0x464401[_0x3b35('0x30')][_0x3b35('0x37')](_0x3b35('0x38'))){_0x531ac6[_0x3b35('0x20')]=qs[_0x3b35('0x20')](_0x464401[_0x3b35('0x30')]['limit']);_0x531ac6[_0x3b35('0x1d')]=qs[_0x3b35('0x1d')](_0x464401[_0x3b35('0x30')][_0x3b35('0x1d')]);}_0x531ac6[_0x3b35('0x39')]=qs[_0x3b35('0x3a')](_0x464401[_0x3b35('0x30')][_0x3b35('0x3a')]);_0x531ac6[_0x3b35('0x3b')]=qs[_0x3b35('0x32')](_['pick'](_0x464401[_0x3b35('0x30')],_0x159d7f[_0x3b35('0x32')]),_0x161fa0);if(_0x464401['query'][_0x3b35('0x3c')]){_0x531ac6[_0x3b35('0x3b')]=_[_0x3b35('0x3d')](_0x531ac6[_0x3b35('0x3b')],{'$or':_[_0x3b35('0x29')](_0x161fa0,function(_0x16e37f){if(_0x16e37f[_0x3b35('0x2d')]!==_0x3b35('0x3e')){var _0x2ffbf6={};_0x2ffbf6[_0x16e37f[_0x3b35('0x27')]]={'$like':'%'+_0x464401['query'][_0x3b35('0x3c')]+'%'};return _0x2ffbf6;}})});}_0x531ac6=_[_0x3b35('0x3d')]({},_0x531ac6,_0x464401[_0x3b35('0x3f')]);var _0x31ee41={'where':_0x531ac6[_0x3b35('0x3b')]};return db['VtigerConfiguration'][_0x3b35('0x1f')](_0x31ee41)[_0x3b35('0x24')](function(_0x18b96f){_0x1e3b9a['count']=_0x18b96f;if(_0x464401[_0x3b35('0x30')]['includeAll']){_0x531ac6[_0x3b35('0x40')]=[{'all':!![]}];}return db[_0x3b35('0x2a')][_0x3b35('0x41')](_0x531ac6);})[_0x3b35('0x24')](function(_0x48a78a){_0x1e3b9a[_0x3b35('0x42')]=_0x48a78a;return _0x1e3b9a;})[_0x3b35('0x24')](respondWithFilteredResult(_0x5e3dd0,_0x531ac6))['catch'](handleError(_0x5e3dd0,null));};exports[_0x3b35('0x43')]=function(_0x5546b7,_0x59e2be){var _0x4556e8={'raw':![],'where':{'id':_0x5546b7[_0x3b35('0x44')]['id']}},_0x4583e1={};_0x4583e1[_0x3b35('0x2f')]=_[_0x3b35('0x31')](db[_0x3b35('0x2a')][_0x3b35('0x2b')]);_0x4583e1[_0x3b35('0x30')]=_[_0x3b35('0x31')](_0x5546b7[_0x3b35('0x30')]);_0x4583e1[_0x3b35('0x32')]=_[_0x3b35('0x33')](_0x4583e1[_0x3b35('0x2f')],_0x4583e1[_0x3b35('0x30')]);_0x4556e8[_0x3b35('0x34')]=_['intersection'](_0x4583e1['model'],qs['fields'](_0x5546b7[_0x3b35('0x30')]['fields']));_0x4556e8[_0x3b35('0x34')]=_0x4556e8[_0x3b35('0x34')]['length']?_0x4556e8[_0x3b35('0x34')]:_0x4583e1[_0x3b35('0x2f')];if(_0x5546b7[_0x3b35('0x30')][_0x3b35('0x45')]){_0x4556e8['include']=[{'all':!![]}];}_0x4556e8=_[_0x3b35('0x3d')]({},_0x4556e8,_0x5546b7[_0x3b35('0x3f')]);return db[_0x3b35('0x2a')][_0x3b35('0x46')](_0x4556e8)[_0x3b35('0x24')](handleEntityNotFound(_0x59e2be,null))[_0x3b35('0x24')](respondWithResult(_0x59e2be,null))['catch'](handleError(_0x59e2be,null));};exports['create']=function(_0x36d084,_0x3886d9){return db[_0x3b35('0x2a')][_0x3b35('0x47')](_0x36d084['body'],{})['then'](respondWithResult(_0x3886d9,0xc9))['catch'](handleError(_0x3886d9,null));};exports[_0x3b35('0x23')]=function(_0x4285d2,_0x3521ed){if(_0x4285d2[_0x3b35('0x48')]['id']){delete _0x4285d2['body']['id'];}return db['VtigerConfiguration'][_0x3b35('0x46')]({'where':{'id':_0x4285d2[_0x3b35('0x44')]['id']}})[_0x3b35('0x24')](handleEntityNotFound(_0x3521ed,null))['then'](saveUpdates(_0x4285d2[_0x3b35('0x48')],null))[_0x3b35('0x24')](respondWithResult(_0x3521ed,null))['catch'](handleError(_0x3521ed,null));};exports[_0x3b35('0x25')]=function(_0x3a1795,_0x54ff2e){return db[_0x3b35('0x2a')][_0x3b35('0x46')]({'where':{'id':_0x3a1795[_0x3b35('0x44')]['id']}})['then'](handleEntityNotFound(_0x54ff2e,null))[_0x3b35('0x24')](removeEntity(_0x54ff2e,null))[_0x3b35('0x49')](handleError(_0x54ff2e,null));};exports[_0x3b35('0x4a')]=function(_0x4f34de,_0x531270,_0x32b716){var _0x180e48={};var _0x1a79f2={};var _0x1786ce;var _0x1a0425;return db[_0x3b35('0x2a')][_0x3b35('0x4b')]({'where':{'id':_0x4f34de['params']['id']}})[_0x3b35('0x24')](handleEntityNotFound(_0x531270,null))[_0x3b35('0x24')](function(_0x481bbd){if(_0x481bbd){_0x1786ce=_0x481bbd;_0x1a79f2[_0x3b35('0x2f')]=_[_0x3b35('0x31')](db[_0x3b35('0x4c')][_0x3b35('0x2b')]);_0x1a79f2[_0x3b35('0x30')]=_[_0x3b35('0x31')](_0x4f34de['query']);_0x1a79f2[_0x3b35('0x32')]=_[_0x3b35('0x33')](_0x1a79f2['model'],_0x1a79f2[_0x3b35('0x30')]);_0x180e48[_0x3b35('0x34')]=_[_0x3b35('0x33')](_0x1a79f2[_0x3b35('0x2f')],qs[_0x3b35('0x35')](_0x4f34de[_0x3b35('0x30')][_0x3b35('0x35')]));_0x180e48[_0x3b35('0x34')]=_0x180e48[_0x3b35('0x34')][_0x3b35('0x36')]?_0x180e48[_0x3b35('0x34')]:_0x1a79f2[_0x3b35('0x2f')];_0x180e48[_0x3b35('0x39')]=qs['sort'](_0x4f34de[_0x3b35('0x30')][_0x3b35('0x3a')]);_0x180e48['where']=qs[_0x3b35('0x32')](_['pick'](_0x4f34de[_0x3b35('0x30')],_0x1a79f2[_0x3b35('0x32')]));if(_0x4f34de[_0x3b35('0x30')][_0x3b35('0x3c')]){_0x180e48[_0x3b35('0x3b')]=_[_0x3b35('0x3d')](_0x180e48[_0x3b35('0x3b')],{'$or':_[_0x3b35('0x29')](_0x180e48['attributes'],function(_0x78867f){var _0x5c8287={};_0x5c8287[_0x78867f]={'$like':'%'+_0x4f34de['query'][_0x3b35('0x3c')]+'%'};return _0x5c8287;})});}_0x180e48=_[_0x3b35('0x3d')]({},_0x180e48,_0x4f34de['options']);return _0x1786ce[_0x3b35('0x4a')](_0x180e48);}})[_0x3b35('0x24')](function(_0x40173d){if(_0x40173d){_0x1a0425=_0x40173d[_0x3b35('0x36')];if(!_0x4f34de[_0x3b35('0x30')]['hasOwnProperty'](_0x3b35('0x38'))){_0x180e48[_0x3b35('0x20')]=qs[_0x3b35('0x20')](_0x4f34de[_0x3b35('0x30')][_0x3b35('0x20')]);_0x180e48['offset']=qs['offset'](_0x4f34de['query'][_0x3b35('0x1d')]);}return _0x1786ce[_0x3b35('0x4a')](_0x180e48);}})[_0x3b35('0x24')](function(_0x1643f8){if(_0x1643f8){return _0x1643f8?{'count':_0x1a0425,'rows':_0x1643f8}:null;}})[_0x3b35('0x24')](respondWithResult(_0x531270,null))[_0x3b35('0x49')](handleError(_0x531270,null));};exports[_0x3b35('0x4d')]=function(_0x5d0c7d,_0x380ead,_0x68c870){var _0x2bd803={};var _0x3ad90c={};var _0x39a65f;var _0x1a63cb;return db[_0x3b35('0x2a')][_0x3b35('0x4b')]({'where':{'id':_0x5d0c7d[_0x3b35('0x44')]['id']}})[_0x3b35('0x24')](handleEntityNotFound(_0x380ead,null))[_0x3b35('0x24')](function(_0x8c350c){if(_0x8c350c){_0x39a65f=_0x8c350c;_0x3ad90c[_0x3b35('0x2f')]=_['keys'](db['VtigerField'][_0x3b35('0x2b')]);_0x3ad90c['query']=_['keys'](_0x5d0c7d['query']);_0x3ad90c['filters']=_[_0x3b35('0x33')](_0x3ad90c[_0x3b35('0x2f')],_0x3ad90c[_0x3b35('0x30')]);_0x2bd803[_0x3b35('0x34')]=_['intersection'](_0x3ad90c[_0x3b35('0x2f')],qs[_0x3b35('0x35')](_0x5d0c7d[_0x3b35('0x30')][_0x3b35('0x35')]));_0x2bd803[_0x3b35('0x34')]=_0x2bd803[_0x3b35('0x34')][_0x3b35('0x36')]?_0x2bd803[_0x3b35('0x34')]:_0x3ad90c['model'];_0x2bd803[_0x3b35('0x39')]=qs[_0x3b35('0x3a')](_0x5d0c7d[_0x3b35('0x30')][_0x3b35('0x3a')]);_0x2bd803[_0x3b35('0x3b')]=qs[_0x3b35('0x32')](_[_0x3b35('0x4e')](_0x5d0c7d['query'],_0x3ad90c[_0x3b35('0x32')]));if(_0x5d0c7d['query'][_0x3b35('0x3c')]){_0x2bd803[_0x3b35('0x3b')]=_['merge'](_0x2bd803[_0x3b35('0x3b')],{'$or':_[_0x3b35('0x29')](_0x2bd803[_0x3b35('0x34')],function(_0x279adb){var _0x172229={};_0x172229[_0x279adb]={'$like':'%'+_0x5d0c7d['query'][_0x3b35('0x3c')]+'%'};return _0x172229;})});}_0x2bd803=_[_0x3b35('0x3d')]({},_0x2bd803,_0x5d0c7d[_0x3b35('0x3f')]);return _0x39a65f[_0x3b35('0x4d')](_0x2bd803);}})[_0x3b35('0x24')](function(_0x17583d){if(_0x17583d){_0x1a63cb=_0x17583d[_0x3b35('0x36')];if(!_0x5d0c7d[_0x3b35('0x30')][_0x3b35('0x37')](_0x3b35('0x38'))){_0x2bd803[_0x3b35('0x20')]=qs[_0x3b35('0x20')](_0x5d0c7d[_0x3b35('0x30')]['limit']);_0x2bd803[_0x3b35('0x1d')]=qs['offset'](_0x5d0c7d['query'][_0x3b35('0x1d')]);}return _0x39a65f[_0x3b35('0x4d')](_0x2bd803);}})[_0x3b35('0x24')](function(_0xbb3c55){if(_0xbb3c55){return _0xbb3c55?{'count':_0x1a63cb,'rows':_0xbb3c55}:null;}})[_0x3b35('0x24')](respondWithResult(_0x380ead,null))[_0x3b35('0x49')](handleError(_0x380ead,null));};exports[_0x3b35('0x4f')]=function(_0x40f23c,_0x117836,_0x36c305){var _0x1fcd3e={};var _0x2fe619={};var _0x53fe64;var _0x4a77ff;return db[_0x3b35('0x2a')]['findOne']({'where':{'id':_0x40f23c[_0x3b35('0x44')]['id']}})['then'](handleEntityNotFound(_0x117836,null))['then'](function(_0x3d3479){if(_0x3d3479){_0x53fe64=_0x3d3479;_0x2fe619[_0x3b35('0x2f')]=_[_0x3b35('0x31')](db['VtigerField']['rawAttributes']);_0x2fe619['query']=_[_0x3b35('0x31')](_0x40f23c[_0x3b35('0x30')]);_0x2fe619[_0x3b35('0x32')]=_[_0x3b35('0x33')](_0x2fe619[_0x3b35('0x2f')],_0x2fe619[_0x3b35('0x30')]);_0x1fcd3e[_0x3b35('0x34')]=_['intersection'](_0x2fe619[_0x3b35('0x2f')],qs[_0x3b35('0x35')](_0x40f23c[_0x3b35('0x30')][_0x3b35('0x35')]));_0x1fcd3e[_0x3b35('0x34')]=_0x1fcd3e['attributes'][_0x3b35('0x36')]?_0x1fcd3e[_0x3b35('0x34')]:_0x2fe619['model'];_0x1fcd3e[_0x3b35('0x39')]=qs['sort'](_0x40f23c['query']['sort']);_0x1fcd3e[_0x3b35('0x3b')]=qs[_0x3b35('0x32')](_[_0x3b35('0x4e')](_0x40f23c[_0x3b35('0x30')],_0x2fe619[_0x3b35('0x32')]));if(_0x40f23c[_0x3b35('0x30')]['filter']){_0x1fcd3e['where']=_[_0x3b35('0x3d')](_0x1fcd3e[_0x3b35('0x3b')],{'$or':_[_0x3b35('0x29')](_0x1fcd3e['attributes'],function(_0x442643){var _0x4657bc={};_0x4657bc[_0x442643]={'$like':'%'+_0x40f23c[_0x3b35('0x30')][_0x3b35('0x3c')]+'%'};return _0x4657bc;})});}_0x1fcd3e=_[_0x3b35('0x3d')]({},_0x1fcd3e,_0x40f23c[_0x3b35('0x3f')]);return _0x53fe64['getDescriptions'](_0x1fcd3e);}})[_0x3b35('0x24')](function(_0x1af5b5){if(_0x1af5b5){_0x4a77ff=_0x1af5b5[_0x3b35('0x36')];if(!_0x40f23c['query'][_0x3b35('0x37')](_0x3b35('0x38'))){_0x1fcd3e[_0x3b35('0x20')]=qs[_0x3b35('0x20')](_0x40f23c[_0x3b35('0x30')][_0x3b35('0x20')]);_0x1fcd3e['offset']=qs[_0x3b35('0x1d')](_0x40f23c[_0x3b35('0x30')][_0x3b35('0x1d')]);}return _0x53fe64['getDescriptions'](_0x1fcd3e);}})[_0x3b35('0x24')](function(_0x2b710b){if(_0x2b710b){return _0x2b710b?{'count':_0x4a77ff,'rows':_0x2b710b}:null;}})[_0x3b35('0x24')](respondWithResult(_0x117836,null))[_0x3b35('0x49')](handleError(_0x117836,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1c48aab..3687582 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 _0x3acf=['VtigerConfiguration','util','api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3acf,0xb1));var _0xf3ac=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x3acf[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0xf3ac('0x0'));var logger=require('../../config/logger')(_0xf3ac('0x1'));var moment=require(_0xf3ac('0x2'));var BPromise=require(_0xf3ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3ac('0x4'));var config=require(_0xf3ac('0x5'));var attributes=require(_0xf3ac('0x6'));module['exports']=function(_0x37070d,_0x2af819){return _0x37070d['define'](_0xf3ac('0x7'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccf=['rimraf','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','path'];(function(_0x2cabbb,_0x12dfc0){var _0x3c7ae0=function(_0x3d9b58){while(--_0x3d9b58){_0x2cabbb['push'](_0x2cabbb['shift']());}};_0x3c7ae0(++_0x12dfc0);}(_0x4ccf,0x130));var _0xf4cc=function(_0x34d97c,_0x595f33){_0x34d97c=_0x34d97c-0x0;var _0x58c8af=_0x4ccf[_0x34d97c];return _0x58c8af;};'use strict';var _=require(_0xf4cc('0x0'));var util=require(_0xf4cc('0x1'));var logger=require(_0xf4cc('0x2'))(_0xf4cc('0x3'));var moment=require(_0xf4cc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4cc('0x5'));var rimraf=require(_0xf4cc('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0xf4cc('0x7')]=function(_0x11c39b,_0x6a96aa){return _0x11c39b[_0xf4cc('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xf4cc('0x9'),'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 29c68cb..b982f73 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 _0xa45c=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x26e8c8,_0x156146){var _0x2a25e7=function(_0xfde90b){while(--_0xfde90b){_0x26e8c8['push'](_0x26e8c8['shift']());}};_0x2a25e7(++_0x156146);}(_0xa45c,0x184));var _0xca45=function(_0x4a334e,_0x2cbdfa){_0x4a334e=_0x4a334e-0x0;var _0x4ec93c=_0xa45c[_0x4a334e];return _0x4ec93c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xca45('0x0'));var rs=require(_0xca45('0x1'));var fs=require('fs');var Redis=require(_0xca45('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x3'))(_0xca45('0x4'));var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46e4bb,_0x4a358c,_0x3eb4dc){return new BPromise(function(_0xcd4a5b,_0x40c50a){return client[_0xca45('0x8')](_0x46e4bb,_0x3eb4dc)[_0xca45('0x9')](function(_0x56ddac){logger[_0xca45('0xa')](_0xca45('0xb'),_0x4a358c,_0xca45('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4a358c,_0xca45('0xc'),JSON[_0xca45('0xd')](_0x56ddac));if(_0x56ddac[_0xca45('0xe')]){if(_0x56ddac[_0xca45('0xe')][_0xca45('0xf')]===0x1f4){logger[_0xca45('0xe')](_0xca45('0xb'),_0x4a358c,_0x56ddac['error'][_0xca45('0x10')]);return _0x40c50a(_0x56ddac[_0xca45('0xe')][_0xca45('0x10')]);}logger[_0xca45('0xe')](_0xca45('0xb'),_0x4a358c,_0x56ddac[_0xca45('0xe')][_0xca45('0x10')]);return _0xcd4a5b(_0x56ddac[_0xca45('0xe')]['message']);}else{logger[_0xca45('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x4a358c,'request\x20sent');_0xcd4a5b(_0x56ddac['result'][_0xca45('0x10')]);}})[_0xca45('0x11')](function(_0x59fda0){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4a358c,_0x59fda0);_0x40c50a(_0x59fda0);});});} \ No newline at end of file +var _0x4453=['ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x36f93a,_0x19e691){var _0x42fea3=function(_0x4950ed){while(--_0x4950ed){_0x36f93a['push'](_0x36f93a['shift']());}};_0x42fea3(++_0x19e691);}(_0x4453,0xce));var _0x3445=function(_0x3217f8,_0x4ecd2f){_0x3217f8=_0x3217f8-0x0;var _0x3804ba=_0x4453[_0x3217f8];return _0x3804ba;};'use strict';var _=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var moment=require(_0x3445('0x2'));var BPromise=require(_0x3445('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3445('0x4'));var db=require(_0x3445('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3445('0x6'))(_0x3445('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3445('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2149,_0x21d762,_0xfa8e86){return new BPromise(function(_0x11dc9b,_0x41f9ce){return client[_0x3445('0x9')](_0x4f2149,_0xfa8e86)[_0x3445('0xa')](function(_0xd81f3a){logger[_0x3445('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x21d762,'request\x20sent');logger[_0x3445('0xc')](_0x3445('0xd'),_0x21d762,'request\x20sent',JSON[_0x3445('0xe')](_0xd81f3a));if(_0xd81f3a[_0x3445('0xf')]){if(_0xd81f3a['error'][_0x3445('0x10')]===0x1f4){logger['error'](_0x3445('0x11'),_0x21d762,_0xd81f3a[_0x3445('0xf')][_0x3445('0x12')]);return _0x41f9ce(_0xd81f3a[_0x3445('0xf')]['message']);}logger[_0x3445('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x21d762,_0xd81f3a[_0x3445('0xf')][_0x3445('0x12')]);return _0x11dc9b(_0xd81f3a[_0x3445('0xf')][_0x3445('0x12')]);}else{logger['info'](_0x3445('0x11'),_0x21d762,_0x3445('0x13'));_0x11dc9b(_0xd81f3a[_0x3445('0x14')][_0x3445('0x12')]);}})['catch'](function(_0x1285b3){logger[_0x3445('0xf')](_0x3445('0x11'),_0x21d762,_0x1285b3);_0x41f9ce(_0x1285b3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 698d1c3..1cdc01d 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 _0xabb6=['index','get','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated'];(function(_0x23f0bf,_0x2409b9){var _0x5f0d69=function(_0x2b544f){while(--_0x2b544f){_0x23f0bf['push'](_0x23f0bf['shift']());}};_0x5f0d69(++_0x2409b9);}(_0xabb6,0x135));var _0x6abb=function(_0xa8f42f,_0x43083d){_0xa8f42f=_0xa8f42f-0x0;var _0x51b04b=_0xabb6[_0xa8f42f];return _0x51b04b;};'use strict';var multer=require(_0x6abb('0x0'));var util=require('util');var path=require(_0x6abb('0x1'));var timeout=require(_0x6abb('0x2'));var express=require(_0x6abb('0x3'));var router=express[_0x6abb('0x4')]();var fs_extra=require(_0x6abb('0x5'));var auth=require(_0x6abb('0x6'));var interaction=require(_0x6abb('0x7'));var config=require(_0x6abb('0x8'));var controller=require(_0x6abb('0x9'));router['get']('/',auth[_0x6abb('0xa')](),controller[_0x6abb('0xb')]);router[_0x6abb('0xc')](_0x6abb('0xd'),auth[_0x6abb('0xa')](),controller[_0x6abb('0xe')]);router[_0x6abb('0xf')]('/',auth[_0x6abb('0xa')](),controller[_0x6abb('0x10')]);router[_0x6abb('0x11')](_0x6abb('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6abb('0x12')]('/:id',auth[_0x6abb('0xa')](),controller[_0x6abb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6aa9=['update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','post','create','put','/:id'];(function(_0x4685a,_0x36b41d){var _0x333507=function(_0x342f60){while(--_0x342f60){_0x4685a['push'](_0x4685a['shift']());}};_0x333507(++_0x36b41d);}(_0x6aa9,0xed));var _0x96aa=function(_0x4914ea,_0xb7ea91){_0x4914ea=_0x4914ea-0x0;var _0x13e98c=_0x6aa9[_0x4914ea];return _0x13e98c;};'use strict';var multer=require('multer');var util=require(_0x96aa('0x0'));var path=require(_0x96aa('0x1'));var timeout=require(_0x96aa('0x2'));var express=require(_0x96aa('0x3'));var router=express['Router']();var fs_extra=require(_0x96aa('0x4'));var auth=require(_0x96aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x96aa('0x6'));var controller=require(_0x96aa('0x7'));router['get']('/',auth[_0x96aa('0x8')](),controller[_0x96aa('0x9')]);router[_0x96aa('0xa')]('/:id',auth[_0x96aa('0x8')](),controller['show']);router[_0x96aa('0xb')]('/',auth[_0x96aa('0x8')](),controller[_0x96aa('0xc')]);router[_0x96aa('0xd')](_0x96aa('0xe'),auth[_0x96aa('0x8')](),controller[_0x96aa('0xf')]);router['delete'](_0x96aa('0xe'),auth[_0x96aa('0x8')](),controller[_0x96aa('0x10')]);module[_0x96aa('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 3616497..c4675ac 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 _0xcc0f=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x25c18b,_0x47f089){var _0x493114=function(_0x575495){while(--_0x575495){_0x25c18b['push'](_0x25c18b['shift']());}};_0x493114(++_0x47f089);}(_0xcc0f,0x1b9));var _0xfcc0=function(_0x50aa0d,_0x54c5d9){_0x50aa0d=_0x50aa0d-0x0;var _0x49b870=_0xcc0f[_0x50aa0d];return _0x49b870;};'use strict';var Sequelize=require(_0xfcc0('0x0'));module[_0xfcc0('0x1')]={'type':{'type':Sequelize[_0xfcc0('0x2')]('string',_0xfcc0('0x3'),_0xfcc0('0x4'),_0xfcc0('0x5'),_0xfcc0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfcc0('0x7')]},'key':{'type':Sequelize[_0xfcc0('0x7')]},'keyType':{'type':Sequelize[_0xfcc0('0x2')](_0xfcc0('0x8'),_0xfcc0('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfcc0('0x7')]},'idField':{'type':Sequelize[_0xfcc0('0x7')]},'nameField':{'type':Sequelize[_0xfcc0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfcc0('0x7')]}}; \ No newline at end of file +var _0x9d63=['picklist','ENUM','STRING','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x26b14f,_0xcf2f69){var _0x566132=function(_0x5d41b3){while(--_0x5d41b3){_0x26b14f['push'](_0x26b14f['shift']());}};_0x566132(++_0xcf2f69);}(_0x9d63,0x100));var _0x39d6=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9d63[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x39d6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x39d6('0x1'),_0x39d6('0x2'),_0x39d6('0x3'),_0x39d6('0x4'),_0x39d6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x39d6('0x6')](_0x39d6('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x39d6('0x7')]},'idField':{'type':Sequelize[_0x39d6('0x7')]},'nameField':{'type':Sequelize[_0x39d6('0x7')]},'customField':{'type':Sequelize[_0x39d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39d6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e0d3ed7..d7c6fcf 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 _0xe18b=['error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy'];(function(_0x2aee6d,_0x56cbc8){var _0x1d292b=function(_0x2292ca){while(--_0x2292ca){_0x2aee6d['push'](_0x2aee6d['shift']());}};_0x1d292b(++_0x56cbc8);}(_0xe18b,0x1cd));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbe18('0x0'));var rimraf=require(_0xbe18('0x1'));var zipdir=require(_0xbe18('0x2'));var jsonpatch=require(_0xbe18('0x3'));var rp=require('request-promise');var moment=require(_0xbe18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe18('0x5'));var util=require(_0xbe18('0x6'));var path=require('path');var sox=require(_0xbe18('0x7'));var csv=require(_0xbe18('0x8'));var ejs=require(_0xbe18('0x9'));var fs=require('fs');var fs_extra=require(_0xbe18('0xa'));var _=require('lodash');var squel=require(_0xbe18('0xb'));var crypto=require('crypto');var jsforce=require(_0xbe18('0xc'));var deskjs=require(_0xbe18('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe18('0xe'));var Papa=require(_0xbe18('0xf'));var Redis=require(_0xbe18('0x10'));var authService=require(_0xbe18('0x11'));var qs=require(_0xbe18('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe18('0x13'));var logger=require(_0xbe18('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbe18('0x15'));var licenseUtil=require(_0xbe18('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3136eb,_0x5b2a0b){_0x5b2a0b=_0x5b2a0b||0xcc;return function(_0x57ac30){if(_0x57ac30){return _0x3136eb[_0xbe18('0x17')](_0x5b2a0b);}return _0x3136eb[_0xbe18('0x18')](_0x5b2a0b)[_0xbe18('0x19')]();};}function respondWithResult(_0x444a0f,_0x31ea2b){_0x31ea2b=_0x31ea2b||0xc8;return function(_0x5edbb0){if(_0x5edbb0){return _0x444a0f[_0xbe18('0x18')](_0x31ea2b)[_0xbe18('0x1a')](_0x5edbb0);}};}function respondWithFilteredResult(_0x4f8fb9,_0x3242fd){return function(_0xab34f0){if(_0xab34f0){var _0xf8e9ba=typeof _0x3242fd['offset']==='undefined'&&typeof _0x3242fd['limit']==='undefined';var _0x461c05=_0xab34f0[_0xbe18('0x1b')];var _0x4890d2=_0xf8e9ba?0x0:_0x3242fd[_0xbe18('0x1c')];var _0x2d3c6a=_0xf8e9ba?_0xab34f0[_0xbe18('0x1b')]:_0x3242fd['offset']+_0x3242fd[_0xbe18('0x1d')];var _0x325b0d;if(_0x2d3c6a>=_0x461c05){_0x2d3c6a=_0x461c05;_0x325b0d=0xc8;}else{_0x325b0d=0xce;}_0x4f8fb9[_0xbe18('0x18')](_0x325b0d);return _0x4f8fb9['set'](_0xbe18('0x1e'),_0x4890d2+'-'+_0x2d3c6a+'/'+_0x461c05)[_0xbe18('0x1a')](_0xab34f0);}return null;};}function patchUpdates(_0x341d5b){return function(_0x5cdc62){try{jsonpatch[_0xbe18('0x1f')](_0x5cdc62,_0x341d5b,!![]);}catch(_0x246557){return BPromise['reject'](_0x246557);}return _0x5cdc62[_0xbe18('0x20')]();};}function saveUpdates(_0x154d71,_0x543c72){return function(_0x3b80cb){if(_0x3b80cb){return _0x3b80cb[_0xbe18('0x21')](_0x154d71)[_0xbe18('0x22')](function(_0x12364d){return _0x12364d;});}return null;};}function removeEntity(_0x1d317a,_0x34def6){return function(_0x478260){if(_0x478260){return _0x478260[_0xbe18('0x23')]()[_0xbe18('0x22')](function(){_0x1d317a[_0xbe18('0x18')](0xcc)[_0xbe18('0x19')]();});}};}function handleEntityNotFound(_0xbbfd7a,_0x49bcf8){return function(_0x413555){if(!_0x413555){_0xbbfd7a['sendStatus'](0x194);}return _0x413555;};}function handleError(_0x3f66c3,_0x1a1b7b){_0x1a1b7b=_0x1a1b7b||0x1f4;return function(_0xc76d8d){logger[_0xbe18('0x24')](_0xc76d8d[_0xbe18('0x25')]);if(_0xc76d8d['name']){delete _0xc76d8d[_0xbe18('0x26')];}_0x3f66c3[_0xbe18('0x18')](_0x1a1b7b)[_0xbe18('0x27')](_0xc76d8d);};}exports['index']=function(_0x3d6b9b,_0x4bb1c8){var _0x2012ba={},_0x47dde2={},_0x573cc2={'count':0x0,'rows':[]};var _0x1fbb62=_[_0xbe18('0x28')](db[_0xbe18('0x29')][_0xbe18('0x2a')],function(_0x9db8da){return{'name':_0x9db8da[_0xbe18('0x2b')],'type':_0x9db8da[_0xbe18('0x2c')]['key']};});_0x47dde2[_0xbe18('0x2d')]=_[_0xbe18('0x28')](_0x1fbb62,_0xbe18('0x26'));_0x47dde2[_0xbe18('0x2e')]=_[_0xbe18('0x2f')](_0x3d6b9b[_0xbe18('0x2e')]);_0x47dde2['filters']=_[_0xbe18('0x30')](_0x47dde2[_0xbe18('0x2d')],_0x47dde2[_0xbe18('0x2e')]);_0x2012ba[_0xbe18('0x31')]=_[_0xbe18('0x30')](_0x47dde2[_0xbe18('0x2d')],qs[_0xbe18('0x32')](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x32')]));_0x2012ba[_0xbe18('0x31')]=_0x2012ba['attributes'][_0xbe18('0x33')]?_0x2012ba[_0xbe18('0x31')]:_0x47dde2[_0xbe18('0x2d')];if(!_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x34')](_0xbe18('0x35'))){_0x2012ba[_0xbe18('0x1d')]=qs[_0xbe18('0x1d')](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x1d')]);_0x2012ba['offset']=qs['offset'](_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x1c')]);}_0x2012ba[_0xbe18('0x36')]=qs[_0xbe18('0x37')](_0x3d6b9b['query'][_0xbe18('0x37')]);_0x2012ba[_0xbe18('0x38')]=qs[_0xbe18('0x39')](_[_0xbe18('0x3a')](_0x3d6b9b[_0xbe18('0x2e')],_0x47dde2[_0xbe18('0x39')]),_0x1fbb62);if(_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x3b')]){_0x2012ba['where']=_[_0xbe18('0x3c')](_0x2012ba[_0xbe18('0x38')],{'$or':_['map'](_0x1fbb62,function(_0x12ac97){if(_0x12ac97[_0xbe18('0x2c')]!==_0xbe18('0x3d')){var _0x49f540={};_0x49f540[_0x12ac97['name']]={'$like':'%'+_0x3d6b9b[_0xbe18('0x2e')]['filter']+'%'};return _0x49f540;}})});}_0x2012ba=_[_0xbe18('0x3c')]({},_0x2012ba,_0x3d6b9b[_0xbe18('0x3e')]);var _0x3ea96e={'where':_0x2012ba['where']};return db['VtigerField'][_0xbe18('0x1b')](_0x3ea96e)[_0xbe18('0x22')](function(_0x20de36){_0x573cc2[_0xbe18('0x1b')]=_0x20de36;if(_0x3d6b9b[_0xbe18('0x2e')][_0xbe18('0x3f')]){_0x2012ba[_0xbe18('0x40')]=[{'all':!![]}];}return db[_0xbe18('0x29')][_0xbe18('0x41')](_0x2012ba);})[_0xbe18('0x22')](function(_0x202192){_0x573cc2['rows']=_0x202192;return _0x573cc2;})[_0xbe18('0x22')](respondWithFilteredResult(_0x4bb1c8,_0x2012ba))[_0xbe18('0x42')](handleError(_0x4bb1c8,null));};exports['show']=function(_0x16b9f7,_0xfcd617){var _0xaf16b3={'raw':!![],'where':{'id':_0x16b9f7[_0xbe18('0x43')]['id']}},_0x47bee7={};_0x47bee7[_0xbe18('0x2d')]=_[_0xbe18('0x2f')](db[_0xbe18('0x29')]['rawAttributes']);_0x47bee7[_0xbe18('0x2e')]=_['keys'](_0x16b9f7[_0xbe18('0x2e')]);_0x47bee7['filters']=_[_0xbe18('0x30')](_0x47bee7[_0xbe18('0x2d')],_0x47bee7[_0xbe18('0x2e')]);_0xaf16b3[_0xbe18('0x31')]=_[_0xbe18('0x30')](_0x47bee7[_0xbe18('0x2d')],qs[_0xbe18('0x32')](_0x16b9f7[_0xbe18('0x2e')]['fields']));_0xaf16b3[_0xbe18('0x31')]=_0xaf16b3[_0xbe18('0x31')][_0xbe18('0x33')]?_0xaf16b3[_0xbe18('0x31')]:_0x47bee7[_0xbe18('0x2d')];if(_0x16b9f7[_0xbe18('0x2e')][_0xbe18('0x3f')]){_0xaf16b3[_0xbe18('0x40')]=[{'all':!![]}];}_0xaf16b3=_[_0xbe18('0x3c')]({},_0xaf16b3,_0x16b9f7[_0xbe18('0x3e')]);return db[_0xbe18('0x29')]['find'](_0xaf16b3)['then'](handleEntityNotFound(_0xfcd617,null))[_0xbe18('0x22')](respondWithResult(_0xfcd617,null))[_0xbe18('0x42')](handleError(_0xfcd617,null));};exports[_0xbe18('0x44')]=function(_0x25200e,_0xa5c2ea){return db[_0xbe18('0x29')]['create'](_0x25200e['body'],{})['then'](respondWithResult(_0xa5c2ea,0xc9))['catch'](handleError(_0xa5c2ea,null));};exports[_0xbe18('0x21')]=function(_0x4f2796,_0x1f8780){if(_0x4f2796['body']['id']){delete _0x4f2796[_0xbe18('0x45')]['id'];}return db[_0xbe18('0x29')][_0xbe18('0x46')]({'where':{'id':_0x4f2796[_0xbe18('0x43')]['id']}})[_0xbe18('0x22')](handleEntityNotFound(_0x1f8780,null))['then'](saveUpdates(_0x4f2796[_0xbe18('0x45')],null))[_0xbe18('0x22')](respondWithResult(_0x1f8780,null))[_0xbe18('0x42')](handleError(_0x1f8780,null));};exports[_0xbe18('0x23')]=function(_0x5cde54,_0x1e6b3f){return db[_0xbe18('0x29')][_0xbe18('0x46')]({'where':{'id':_0x5cde54['params']['id']}})[_0xbe18('0x22')](handleEntityNotFound(_0x1e6b3f,null))[_0xbe18('0x22')](removeEntity(_0x1e6b3f,null))['catch'](handleError(_0x1e6b3f,null));}; \ No newline at end of file +var _0xb104=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','then','destroy','name','index','map','VtigerField','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','eml-format','fast-json-patch','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb104,0x17d));var _0x4b10=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xb104[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0x4b10('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b10('0x1'));var rp=require(_0x4b10('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4b10('0x3'));var path=require('path');var sox=require(_0x4b10('0x4'));var csv=require(_0x4b10('0x5'));var ejs=require(_0x4b10('0x6'));var fs=require('fs');var fs_extra=require(_0x4b10('0x7'));var _=require(_0x4b10('0x8'));var squel=require(_0x4b10('0x9'));var crypto=require('crypto');var jsforce=require(_0x4b10('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4b10('0x5'));var querystring=require('querystring');var Papa=require(_0x4b10('0xb'));var Redis=require(_0x4b10('0xc'));var authService=require(_0x4b10('0xd'));var qs=require(_0x4b10('0xe'));var as=require(_0x4b10('0xf'));var hardwareService=require(_0x4b10('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4b10('0x11'));var licenseUtil=require(_0x4b10('0x12'));var db=require(_0x4b10('0x13'))['db'];function respondWithStatusCode(_0x5f4ed9,_0x323f98){_0x323f98=_0x323f98||0xcc;return function(_0x4ef124){if(_0x4ef124){return _0x5f4ed9[_0x4b10('0x14')](_0x323f98);}return _0x5f4ed9[_0x4b10('0x15')](_0x323f98)[_0x4b10('0x16')]();};}function respondWithResult(_0xc5bb21,_0x3bfbd9){_0x3bfbd9=_0x3bfbd9||0xc8;return function(_0x1f98c8){if(_0x1f98c8){return _0xc5bb21[_0x4b10('0x15')](_0x3bfbd9)[_0x4b10('0x17')](_0x1f98c8);}};}function respondWithFilteredResult(_0x3c41bd,_0x13d859){return function(_0x1f2ea8){if(_0x1f2ea8){var _0x1bbc80=typeof _0x13d859['offset']===_0x4b10('0x18')&&typeof _0x13d859['limit']===_0x4b10('0x18');var _0x2f04de=_0x1f2ea8[_0x4b10('0x19')];var _0xc42f9c=_0x1bbc80?0x0:_0x13d859[_0x4b10('0x1a')];var _0x16c864=_0x1bbc80?_0x1f2ea8[_0x4b10('0x19')]:_0x13d859['offset']+_0x13d859[_0x4b10('0x1b')];var _0x1c9ba6;if(_0x16c864>=_0x2f04de){_0x16c864=_0x2f04de;_0x1c9ba6=0xc8;}else{_0x1c9ba6=0xce;}_0x3c41bd[_0x4b10('0x15')](_0x1c9ba6);return _0x3c41bd['set'](_0x4b10('0x1c'),_0xc42f9c+'-'+_0x16c864+'/'+_0x2f04de)[_0x4b10('0x17')](_0x1f2ea8);}return null;};}function patchUpdates(_0x249b3a){return function(_0x477661){try{jsonpatch[_0x4b10('0x1d')](_0x477661,_0x249b3a,!![]);}catch(_0x17de31){return BPromise[_0x4b10('0x1e')](_0x17de31);}return _0x477661['save']();};}function saveUpdates(_0x36f69a,_0x46644e){return function(_0x57c507){if(_0x57c507){return _0x57c507['update'](_0x36f69a)[_0x4b10('0x1f')](function(_0x53b7d0){return _0x53b7d0;});}return null;};}function removeEntity(_0x2d984c,_0x2fef15){return function(_0x334290){if(_0x334290){return _0x334290[_0x4b10('0x20')]()[_0x4b10('0x1f')](function(){_0x2d984c['status'](0xcc)[_0x4b10('0x16')]();});}};}function handleEntityNotFound(_0xb75625,_0x582746){return function(_0x5949d0){if(!_0x5949d0){_0xb75625[_0x4b10('0x14')](0x194);}return _0x5949d0;};}function handleError(_0x31dc3e,_0x46d0b3){_0x46d0b3=_0x46d0b3||0x1f4;return function(_0x1519c6){logger['error'](_0x1519c6['stack']);if(_0x1519c6[_0x4b10('0x21')]){delete _0x1519c6[_0x4b10('0x21')];}_0x31dc3e[_0x4b10('0x15')](_0x46d0b3)['send'](_0x1519c6);};}exports[_0x4b10('0x22')]=function(_0x95c141,_0x22e08a){var _0x2aab8e={},_0x2107a2={},_0x29fdfe={'count':0x0,'rows':[]};var _0x36b9dc=_[_0x4b10('0x23')](db[_0x4b10('0x24')][_0x4b10('0x25')],function(_0xc94a7e){return{'name':_0xc94a7e['fieldName'],'type':_0xc94a7e[_0x4b10('0x26')][_0x4b10('0x27')]};});_0x2107a2['model']=_['map'](_0x36b9dc,_0x4b10('0x21'));_0x2107a2['query']=_[_0x4b10('0x28')](_0x95c141[_0x4b10('0x29')]);_0x2107a2[_0x4b10('0x2a')]=_[_0x4b10('0x2b')](_0x2107a2[_0x4b10('0x2c')],_0x2107a2['query']);_0x2aab8e[_0x4b10('0x2d')]=_[_0x4b10('0x2b')](_0x2107a2[_0x4b10('0x2c')],qs['fields'](_0x95c141[_0x4b10('0x29')]['fields']));_0x2aab8e['attributes']=_0x2aab8e[_0x4b10('0x2d')][_0x4b10('0x2e')]?_0x2aab8e[_0x4b10('0x2d')]:_0x2107a2[_0x4b10('0x2c')];if(!_0x95c141['query'][_0x4b10('0x2f')]('nolimit')){_0x2aab8e[_0x4b10('0x1b')]=qs['limit'](_0x95c141['query'][_0x4b10('0x1b')]);_0x2aab8e[_0x4b10('0x1a')]=qs[_0x4b10('0x1a')](_0x95c141[_0x4b10('0x29')]['offset']);}_0x2aab8e['order']=qs['sort'](_0x95c141[_0x4b10('0x29')]['sort']);_0x2aab8e[_0x4b10('0x30')]=qs['filters'](_[_0x4b10('0x31')](_0x95c141[_0x4b10('0x29')],_0x2107a2[_0x4b10('0x2a')]),_0x36b9dc);if(_0x95c141[_0x4b10('0x29')][_0x4b10('0x32')]){_0x2aab8e[_0x4b10('0x30')]=_['merge'](_0x2aab8e[_0x4b10('0x30')],{'$or':_['map'](_0x36b9dc,function(_0x1eb2c6){if(_0x1eb2c6[_0x4b10('0x26')]!==_0x4b10('0x33')){var _0x5a678e={};_0x5a678e[_0x1eb2c6['name']]={'$like':'%'+_0x95c141[_0x4b10('0x29')][_0x4b10('0x32')]+'%'};return _0x5a678e;}})});}_0x2aab8e=_[_0x4b10('0x34')]({},_0x2aab8e,_0x95c141[_0x4b10('0x35')]);var _0x3b4ffe={'where':_0x2aab8e[_0x4b10('0x30')]};return db[_0x4b10('0x24')]['count'](_0x3b4ffe)[_0x4b10('0x1f')](function(_0x1870b3){_0x29fdfe[_0x4b10('0x19')]=_0x1870b3;if(_0x95c141[_0x4b10('0x29')][_0x4b10('0x36')]){_0x2aab8e[_0x4b10('0x37')]=[{'all':!![]}];}return db[_0x4b10('0x24')]['findAll'](_0x2aab8e);})[_0x4b10('0x1f')](function(_0x3aec23){_0x29fdfe[_0x4b10('0x38')]=_0x3aec23;return _0x29fdfe;})[_0x4b10('0x1f')](respondWithFilteredResult(_0x22e08a,_0x2aab8e))[_0x4b10('0x39')](handleError(_0x22e08a,null));};exports[_0x4b10('0x3a')]=function(_0xc74f3b,_0x5e71ed){var _0x915ddd={'raw':!![],'where':{'id':_0xc74f3b[_0x4b10('0x3b')]['id']}},_0x2e6e45={};_0x2e6e45['model']=_[_0x4b10('0x28')](db[_0x4b10('0x24')][_0x4b10('0x25')]);_0x2e6e45[_0x4b10('0x29')]=_['keys'](_0xc74f3b['query']);_0x2e6e45[_0x4b10('0x2a')]=_[_0x4b10('0x2b')](_0x2e6e45[_0x4b10('0x2c')],_0x2e6e45[_0x4b10('0x29')]);_0x915ddd[_0x4b10('0x2d')]=_[_0x4b10('0x2b')](_0x2e6e45['model'],qs[_0x4b10('0x3c')](_0xc74f3b[_0x4b10('0x29')][_0x4b10('0x3c')]));_0x915ddd[_0x4b10('0x2d')]=_0x915ddd[_0x4b10('0x2d')][_0x4b10('0x2e')]?_0x915ddd[_0x4b10('0x2d')]:_0x2e6e45['model'];if(_0xc74f3b[_0x4b10('0x29')][_0x4b10('0x36')]){_0x915ddd[_0x4b10('0x37')]=[{'all':!![]}];}_0x915ddd=_['merge']({},_0x915ddd,_0xc74f3b[_0x4b10('0x35')]);return db[_0x4b10('0x24')][_0x4b10('0x3d')](_0x915ddd)[_0x4b10('0x1f')](handleEntityNotFound(_0x5e71ed,null))[_0x4b10('0x1f')](respondWithResult(_0x5e71ed,null))[_0x4b10('0x39')](handleError(_0x5e71ed,null));};exports[_0x4b10('0x3e')]=function(_0x25b217,_0x4b2e81){return db[_0x4b10('0x24')]['create'](_0x25b217[_0x4b10('0x3f')],{})['then'](respondWithResult(_0x4b2e81,0xc9))[_0x4b10('0x39')](handleError(_0x4b2e81,null));};exports['update']=function(_0x4303d6,_0x469c2b){if(_0x4303d6[_0x4b10('0x3f')]['id']){delete _0x4303d6['body']['id'];}return db['VtigerField'][_0x4b10('0x3d')]({'where':{'id':_0x4303d6[_0x4b10('0x3b')]['id']}})[_0x4b10('0x1f')](handleEntityNotFound(_0x469c2b,null))['then'](saveUpdates(_0x4303d6[_0x4b10('0x3f')],null))[_0x4b10('0x1f')](respondWithResult(_0x469c2b,null))[_0x4b10('0x39')](handleError(_0x469c2b,null));};exports[_0x4b10('0x20')]=function(_0x407651,_0x3aa844){return db[_0x4b10('0x24')][_0x4b10('0x3d')]({'where':{'id':_0x407651[_0x4b10('0x3b')]['id']}})[_0x4b10('0x1f')](handleEntityNotFound(_0x3aa844,null))['then'](removeEntity(_0x3aa844,null))[_0x4b10('0x39')](handleError(_0x3aa844,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f12b531..3b51ac8 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 _0xb14e=['rimraf','./intVtigerField.attributes','VtigerField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x51343f,_0x4a9b30){var _0x3d8113=function(_0x45b41e){while(--_0x45b41e){_0x51343f['push'](_0x51343f['shift']());}};_0x3d8113(++_0x4a9b30);}(_0xb14e,0x159));var _0xeb14=function(_0x3d3d40,_0x25152d){_0x3d3d40=_0x3d3d40-0x0;var _0x49e2cb=_0xb14e[_0x3d3d40];return _0x49e2cb;};'use strict';var _=require(_0xeb14('0x0'));var util=require(_0xeb14('0x1'));var logger=require(_0xeb14('0x2'))(_0xeb14('0x3'));var moment=require(_0xeb14('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb14('0x5'));var fs=require('fs');var path=require(_0xeb14('0x6'));var rimraf=require(_0xeb14('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb14('0x8'));module['exports']=function(_0x35aba8,_0x3241d6){return _0x35aba8['define'](_0xeb14('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xeb14('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x104e=['exports','define','VtigerField','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x104e,0x170));var _0xe104=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x104e[_0x2b49bc];return _0x43cc65;};'use strict';var _=require('lodash');var util=require(_0xe104('0x0'));var logger=require(_0xe104('0x1'))(_0xe104('0x2'));var moment=require(_0xe104('0x3'));var BPromise=require(_0xe104('0x4'));var rp=require(_0xe104('0x5'));var fs=require('fs');var path=require(_0xe104('0x6'));var rimraf=require(_0xe104('0x7'));var config=require(_0xe104('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xe104('0x9')]=function(_0x467668,_0xa4f120){return _0x467668[_0xe104('0xa')](_0xe104('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xe104('0xc'),'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 aac93ed..6ab8660 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 _0xbf0b=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d0786,_0x51217f){var _0x24fda2=function(_0x5b48f1){while(--_0x5b48f1){_0x4d0786['push'](_0x4d0786['shift']());}};_0x24fda2(++_0x51217f);}(_0xbf0b,0x16a));var _0xbbf0=function(_0x2220d6,_0x580e12){_0x2220d6=_0x2220d6-0x0;var _0x2e4d10=_0xbf0b[_0x2220d6];return _0x2e4d10;};'use strict';var _=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var moment=require(_0xbbf0('0x2'));var BPromise=require(_0xbbf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbf0('0x4'));var db=require(_0xbbf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbf0('0x6'))(_0xbbf0('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbf0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43cd5d,_0x511824,_0x3f7821){return new BPromise(function(_0x49f86c,_0x1e6dcc){return client[_0xbbf0('0x9')](_0x43cd5d,_0x3f7821)['then'](function(_0x1c18ce){logger[_0xbbf0('0xa')](_0xbbf0('0xb'),_0x511824,_0xbbf0('0xc'));logger[_0xbbf0('0xd')](_0xbbf0('0xe'),_0x511824,_0xbbf0('0xc'),JSON[_0xbbf0('0xf')](_0x1c18ce));if(_0x1c18ce[_0xbbf0('0x10')]){if(_0x1c18ce['error'][_0xbbf0('0x11')]===0x1f4){logger[_0xbbf0('0x10')]('VtigerField,\x20%s,\x20%s',_0x511824,_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);return _0x1e6dcc(_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);}logger[_0xbbf0('0x10')](_0xbbf0('0xb'),_0x511824,_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);return _0x49f86c(_0x1c18ce[_0xbbf0('0x10')][_0xbbf0('0x12')]);}else{logger['info'](_0xbbf0('0xb'),_0x511824,_0xbbf0('0xc'));_0x49f86c(_0x1c18ce[_0xbbf0('0x13')]['message']);}})[_0xbbf0('0x14')](function(_0x1f03ff){logger[_0xbbf0('0x10')](_0xbbf0('0xb'),_0x511824,_0x1f03ff);_0x1e6dcc(_0x1f03ff);});});} \ No newline at end of file +var _0x331f=['randomstring','../../config/logger','rpc','../../config/environment','request','then','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x4dbd92,_0x5200b5){var _0xd29994=function(_0xf6a732){while(--_0xf6a732){_0x4dbd92['push'](_0x4dbd92['shift']());}};_0xd29994(++_0x5200b5);}(_0x331f,0x18a));var _0xf331=function(_0x58eefa,_0x5f29be){_0x58eefa=_0x58eefa-0x0;var _0x51d3ce=_0x331f[_0x58eefa];return _0x51d3ce;};'use strict';var _=require(_0xf331('0x0'));var util=require('util');var moment=require(_0xf331('0x1'));var BPromise=require('bluebird');var rs=require(_0xf331('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf331('0x3'))(_0xf331('0x4'));var config=require(_0xf331('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc34cdf,_0xda9d24,_0x1c4266){return new BPromise(function(_0x1b9362,_0x224a00){return client[_0xf331('0x6')](_0xc34cdf,_0x1c4266)[_0xf331('0x7')](function(_0x22308a){logger[_0xf331('0x8')](_0xf331('0x9'),_0xda9d24,'request\x20sent');logger['debug'](_0xf331('0xa'),_0xda9d24,_0xf331('0xb'),JSON[_0xf331('0xc')](_0x22308a));if(_0x22308a['error']){if(_0x22308a[_0xf331('0xd')][_0xf331('0xe')]===0x1f4){logger[_0xf331('0xd')](_0xf331('0x9'),_0xda9d24,_0x22308a[_0xf331('0xd')][_0xf331('0xf')]);return _0x224a00(_0x22308a[_0xf331('0xd')]['message']);}logger['error'](_0xf331('0x9'),_0xda9d24,_0x22308a[_0xf331('0xd')][_0xf331('0xf')]);return _0x1b9362(_0x22308a[_0xf331('0xd')][_0xf331('0xf')]);}else{logger[_0xf331('0x8')](_0xf331('0x9'),_0xda9d24,'request\x20sent');_0x1b9362(_0x22308a[_0xf331('0x10')][_0xf331('0xf')]);}})[_0xf331('0x11')](function(_0x424790){logger[_0xf331('0xd')](_0xf331('0x9'),_0xda9d24,_0x424790);_0x224a00(_0x424790);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 847171f..c3d214e 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 _0x4b38=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','show','getConfigurations','/:id/fields','isAuthenticated','post','create','update'];(function(_0x51129d,_0x363ea2){var _0x40558a=function(_0x3d5509){while(--_0x3d5509){_0x51129d['push'](_0x51129d['shift']());}};_0x40558a(++_0x363ea2);}(_0x4b38,0x157));var _0x84b3=function(_0x258b8e,_0x1edf10){_0x258b8e=_0x258b8e-0x0;var _0x3c8e19=_0x4b38[_0x258b8e];return _0x3c8e19;};'use strict';var multer=require(_0x84b3('0x0'));var util=require('util');var path=require(_0x84b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x84b3('0x2'));var router=express[_0x84b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x84b3('0x4'));var interaction=require(_0x84b3('0x5'));var config=require('../../config/environment');var controller=require(_0x84b3('0x6'));router[_0x84b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x84b3('0x8')]);router['get'](_0x84b3('0x9'),auth['isAuthenticated'](),controller[_0x84b3('0xa')]);router[_0x84b3('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x84b3('0xb')]);router[_0x84b3('0x7')](_0x84b3('0xc'),auth[_0x84b3('0xd')](),controller['getFields']);router[_0x84b3('0xe')]('/',auth[_0x84b3('0xd')](),controller[_0x84b3('0xf')]);router[_0x84b3('0xe')]('/:id/configurations',auth[_0x84b3('0xd')](),controller['addConfiguration']);router['put'](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x10')]);router[_0x84b3('0x11')](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x12')]);module[_0x84b3('0x13')]=router; \ No newline at end of file +var _0xf687=['destroy','multer','util','path','express','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x5a2251,_0x1ba6b7){var _0x37ef60=function(_0x1be8bc){while(--_0x1be8bc){_0x5a2251['push'](_0x5a2251['shift']());}};_0x37ef60(++_0x1ba6b7);}(_0xf687,0x1cf));var _0x7f68=function(_0x33bbaa,_0x1f5395){_0x33bbaa=_0x33bbaa-0x0;var _0x579de3=_0xf687[_0x33bbaa];return _0x579de3;};'use strict';var multer=require(_0x7f68('0x0'));var util=require(_0x7f68('0x1'));var path=require(_0x7f68('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f68('0x3'));var router=express[_0x7f68('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f68('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f68('0x6'));router[_0x7f68('0x7')]('/',auth[_0x7f68('0x8')](),controller[_0x7f68('0x9')]);router['get'](_0x7f68('0xa'),auth[_0x7f68('0x8')](),controller[_0x7f68('0xb')]);router['get'](_0x7f68('0xc'),auth['isAuthenticated'](),controller[_0x7f68('0xd')]);router[_0x7f68('0x7')](_0x7f68('0xe'),auth[_0x7f68('0x8')](),controller[_0x7f68('0xf')]);router[_0x7f68('0x10')]('/',auth[_0x7f68('0x8')](),controller['create']);router[_0x7f68('0x10')](_0x7f68('0xc'),auth[_0x7f68('0x8')](),controller[_0x7f68('0x11')]);router[_0x7f68('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7f68('0x13')](_0x7f68('0xa'),auth[_0x7f68('0x8')](),controller[_0x7f68('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 8baf0df..c538dce 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 _0x9ab8=['token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0x3f4b07,_0x39c6c9){var _0x52fc3f=function(_0x447c25){while(--_0x447c25){_0x3f4b07['push'](_0x3f4b07['shift']());}};_0x52fc3f(++_0x39c6c9);}(_0x9ab8,0x81));var _0x89ab=function(_0x33b02b,_0x3bce6b){_0x33b02b=_0x33b02b-0x0;var _0x35c57f=_0x9ab8[_0x33b02b];return _0x35c57f;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x89ab('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x89ab('0x2')]},'remoteUri':{'type':Sequelize[_0x89ab('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x5'),_0x89ab('0x6')),'defaultValue':_0x89ab('0x5')},'serverUrl':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x7'),_0x89ab('0x8')),'defaultValue':_0x89ab('0x7')}}; \ No newline at end of file +var _0x41d0=['ENUM','password','token','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d0,0x1c6));var _0x041d=function(_0x53e7cb,_0x2d5c30){_0x53e7cb=_0x53e7cb-0x0;var _0x1327b1=_0x41d0[_0x53e7cb];return _0x1327b1;};'use strict';var Sequelize=require(_0x041d('0x0'));module[_0x041d('0x1')]={'name':{'type':Sequelize[_0x041d('0x2')]},'description':{'type':Sequelize[_0x041d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x041d('0x3')},'password':{'type':Sequelize[_0x041d('0x2')]},'token':{'type':Sequelize[_0x041d('0x2')]},'remoteUri':{'type':Sequelize[_0x041d('0x2')],'unique':_0x041d('0x4')},'authType':{'type':Sequelize[_0x041d('0x5')](_0x041d('0x6'),_0x041d('0x7')),'defaultValue':_0x041d('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x041d('0x5')]('integrationTab',_0x041d('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ae929bc..87e6d9d 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 _0xa478=['ZendeskAccount','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','index','map'];(function(_0x200e64,_0x510106){var _0x35e78d=function(_0x41005d){while(--_0x41005d){_0x200e64['push'](_0x200e64['shift']());}};_0x35e78d(++_0x510106);}(_0xa478,0x136));var _0x8a47=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xa478[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59efc7,_0x36941a){_0x36941a=_0x36941a||0xcc;return function(_0x12539c){if(_0x12539c){return _0x59efc7['sendStatus'](_0x36941a);}return _0x59efc7[_0x8a47('0x1a')](_0x36941a)[_0x8a47('0x1b')]();};}function respondWithResult(_0x1a9a6f,_0x55985c){_0x55985c=_0x55985c||0xc8;return function(_0x1c23e3){if(_0x1c23e3){return _0x1a9a6f[_0x8a47('0x1a')](_0x55985c)[_0x8a47('0x1c')](_0x1c23e3);}};}function respondWithFilteredResult(_0x1c8488,_0x41bdaf){return function(_0x18f2be){if(_0x18f2be){var _0x26fd48=typeof _0x41bdaf[_0x8a47('0x1d')]===_0x8a47('0x1e')&&typeof _0x41bdaf['limit']===_0x8a47('0x1e');var _0x1d0b04=_0x18f2be[_0x8a47('0x1f')];var _0x5f5884=_0x26fd48?0x0:_0x41bdaf[_0x8a47('0x1d')];var _0x5c62eb=_0x26fd48?_0x18f2be['count']:_0x41bdaf[_0x8a47('0x1d')]+_0x41bdaf[_0x8a47('0x20')];var _0x158e0c;if(_0x5c62eb>=_0x1d0b04){_0x5c62eb=_0x1d0b04;_0x158e0c=0xc8;}else{_0x158e0c=0xce;}_0x1c8488[_0x8a47('0x1a')](_0x158e0c);return _0x1c8488[_0x8a47('0x21')](_0x8a47('0x22'),_0x5f5884+'-'+_0x5c62eb+'/'+_0x1d0b04)[_0x8a47('0x1c')](_0x18f2be);}return null;};}function patchUpdates(_0x1bbed6){return function(_0x2b88a7){try{jsonpatch[_0x8a47('0x23')](_0x2b88a7,_0x1bbed6,!![]);}catch(_0x54ce6a){return BPromise[_0x8a47('0x24')](_0x54ce6a);}return _0x2b88a7['save']();};}function saveUpdates(_0x289f28,_0x3d7993){return function(_0x36908d){if(_0x36908d){return _0x36908d[_0x8a47('0x25')](_0x289f28)['then'](function(_0x116b5e){return _0x116b5e;});}return null;};}function removeEntity(_0x5ae186,_0x50f6ba){return function(_0x4d71f4){if(_0x4d71f4){return _0x4d71f4['destroy']()[_0x8a47('0x26')](function(){_0x5ae186[_0x8a47('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb0d4,_0xb4590d){return function(_0x42dae1){if(!_0x42dae1){_0x2bb0d4[_0x8a47('0x27')](0x194);}return _0x42dae1;};}function handleError(_0x44cf20,_0xd06be6){_0xd06be6=_0xd06be6||0x1f4;return function(_0x24a20b){logger['error'](_0x24a20b[_0x8a47('0x28')]);if(_0x24a20b['name']){delete _0x24a20b[_0x8a47('0x29')];}_0x44cf20[_0x8a47('0x1a')](_0xd06be6)['send'](_0x24a20b);};}exports[_0x8a47('0x2a')]=function(_0x526571,_0x4d5d32){var _0x12470a={},_0x9b51b8={},_0x1ddbcf={'count':0x0,'rows':[]};var _0x12f0b7=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')]['rawAttributes'],function(_0x353576){return{'name':_0x353576['fieldName'],'type':_0x353576['type'][_0x8a47('0x2d')]};});_0x9b51b8[_0x8a47('0x2e')]=_[_0x8a47('0x2b')](_0x12f0b7,_0x8a47('0x29'));_0x9b51b8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x526571[_0x8a47('0x2f')]);_0x9b51b8[_0x8a47('0x31')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],_0x9b51b8['query']);_0x12470a[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],qs['fields'](_0x526571[_0x8a47('0x2f')][_0x8a47('0x34')]));_0x12470a['attributes']=_0x12470a[_0x8a47('0x33')][_0x8a47('0x35')]?_0x12470a[_0x8a47('0x33')]:_0x9b51b8[_0x8a47('0x2e')];if(!_0x526571['query']['hasOwnProperty'](_0x8a47('0x36'))){_0x12470a[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x20')]);_0x12470a[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x526571['query']['offset']);}_0x12470a[_0x8a47('0x37')]=qs[_0x8a47('0x38')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x38')]);_0x12470a[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x526571[_0x8a47('0x2f')],_0x9b51b8[_0x8a47('0x31')]),_0x12f0b7);if(_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0x12470a['where']=_[_0x8a47('0x3c')](_0x12470a['where'],{'$or':_['map'](_0x12f0b7,function(_0x544fe2){if(_0x544fe2['type']!=='VIRTUAL'){var _0x3edb2e={};_0x3edb2e[_0x544fe2[_0x8a47('0x29')]]={'$like':'%'+_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]+'%'};return _0x3edb2e;}})});}_0x12470a=_[_0x8a47('0x3c')]({},_0x12470a,_0x526571[_0x8a47('0x3d')]);var _0x25c45b={'where':_0x12470a[_0x8a47('0x39')]};return db['ZendeskAccount']['count'](_0x25c45b)[_0x8a47('0x26')](function(_0x437b86){_0x1ddbcf[_0x8a47('0x1f')]=_0x437b86;if(_0x526571[_0x8a47('0x2f')]['includeAll']){_0x12470a[_0x8a47('0x3e')]=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3f')](_0x12470a);})[_0x8a47('0x26')](function(_0x1ef057){_0x1ddbcf['rows']=_0x1ef057;return _0x1ddbcf;})[_0x8a47('0x26')](respondWithFilteredResult(_0x4d5d32,_0x12470a))[_0x8a47('0x40')](handleError(_0x4d5d32,null));};exports[_0x8a47('0x41')]=function(_0x5d23ed,_0x2b3874){var _0x2c70ea={'raw':![],'where':{'id':_0x5d23ed[_0x8a47('0x42')]['id']}},_0xf313ec={};_0xf313ec['model']=_[_0x8a47('0x30')](db[_0x8a47('0x2c')][_0x8a47('0x43')]);_0xf313ec[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x5d23ed[_0x8a47('0x2f')]);_0xf313ec['filters']=_['intersection'](_0xf313ec[_0x8a47('0x2e')],_0xf313ec[_0x8a47('0x2f')]);_0x2c70ea[_0x8a47('0x33')]=_['intersection'](_0xf313ec[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x5d23ed['query']['fields']));_0x2c70ea[_0x8a47('0x33')]=_0x2c70ea['attributes'][_0x8a47('0x35')]?_0x2c70ea[_0x8a47('0x33')]:_0xf313ec[_0x8a47('0x2e')];if(_0x5d23ed[_0x8a47('0x2f')][_0x8a47('0x44')]){_0x2c70ea[_0x8a47('0x3e')]=[{'all':!![]}];}_0x2c70ea=_['merge']({},_0x2c70ea,_0x5d23ed['options']);return db[_0x8a47('0x2c')][_0x8a47('0x45')](_0x2c70ea)[_0x8a47('0x26')](handleEntityNotFound(_0x2b3874,null))[_0x8a47('0x26')](respondWithResult(_0x2b3874,null))[_0x8a47('0x40')](handleError(_0x2b3874,null));};exports['create']=function(_0x4898d0,_0x17a755){return db['ZendeskAccount'][_0x8a47('0x46')](_0x4898d0[_0x8a47('0x47')],{})['then'](respondWithResult(_0x17a755,0xc9))[_0x8a47('0x40')](handleError(_0x17a755,null));};exports[_0x8a47('0x25')]=function(_0x14e22c,_0x108c7f){if(_0x14e22c[_0x8a47('0x47')]['id']){delete _0x14e22c[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0x14e22c['params']['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x108c7f,null))[_0x8a47('0x26')](saveUpdates(_0x14e22c[_0x8a47('0x47')],null))[_0x8a47('0x26')](respondWithResult(_0x108c7f,null))['catch'](handleError(_0x108c7f,null));};exports[_0x8a47('0x48')]=function(_0xa428dd,_0x24e123){return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0xa428dd[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x24e123,null))['then'](removeEntity(_0x24e123,null))[_0x8a47('0x40')](handleError(_0x24e123,null));};exports['getConfigurations']=function(_0x1da8b7,_0x175023,_0x5a1b29){var _0xb05ed1={};var _0x4bf9a8={};var _0x315111;var _0x5c5577;return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x1da8b7[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x175023,null))[_0x8a47('0x26')](function(_0x144ce6){if(_0x144ce6){_0x315111=_0x144ce6;_0x4bf9a8[_0x8a47('0x2e')]=_[_0x8a47('0x30')](db[_0x8a47('0x49')][_0x8a47('0x43')]);_0x4bf9a8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x1da8b7[_0x8a47('0x2f')]);_0x4bf9a8['filters']=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],_0x4bf9a8['query']);_0xb05ed1[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x34')]));_0xb05ed1[_0x8a47('0x33')]=_0xb05ed1[_0x8a47('0x33')][_0x8a47('0x35')]?_0xb05ed1[_0x8a47('0x33')]:_0x4bf9a8[_0x8a47('0x2e')];_0xb05ed1[_0x8a47('0x37')]=qs['sort'](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x38')]);_0xb05ed1[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x1da8b7[_0x8a47('0x2f')],_0x4bf9a8[_0x8a47('0x31')]));if(_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0xb05ed1[_0x8a47('0x39')]=_[_0x8a47('0x3c')](_0xb05ed1[_0x8a47('0x39')],{'$or':_[_0x8a47('0x2b')](_0xb05ed1[_0x8a47('0x33')],function(_0x2edcaf){var _0x7664a8={};_0x7664a8[_0x2edcaf]={'$like':'%'+_0x1da8b7['query'][_0x8a47('0x3b')]+'%'};return _0x7664a8;})});}_0xb05ed1=_['merge']({},_0xb05ed1,_0x1da8b7[_0x8a47('0x3d')]);return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x21fdb5){if(_0x21fdb5){_0x5c5577=_0x21fdb5[_0x8a47('0x35')];if(!_0x1da8b7[_0x8a47('0x2f')]['hasOwnProperty'](_0x8a47('0x36'))){_0xb05ed1[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1da8b7['query']['limit']);_0xb05ed1[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x1da8b7['query'][_0x8a47('0x1d')]);}return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x17f20f){if(_0x17f20f){return _0x17f20f?{'count':_0x5c5577,'rows':_0x17f20f}:null;}})[_0x8a47('0x26')](respondWithResult(_0x175023,null))[_0x8a47('0x40')](handleError(_0x175023,null));};exports[_0x8a47('0x4b')]=function(_0x2932f1,_0x99848c,_0x1b834a){if(_0x2932f1[_0x8a47('0x47')]['id']){delete _0x2932f1[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x2932f1[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x99848c,null))[_0x8a47('0x26')](function(_0x13a002){if(_0x13a002){_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4c')]=_0x13a002['id'];_0x2932f1['body'][_0x8a47('0x4d')]=integrations['getSubjects'](_0x2932f1['body'][_0x8a47('0x4e')],_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4f')]);_0x2932f1[_0x8a47('0x47')][_0x8a47('0x50')]=integrations[_0x8a47('0x51')](_0x2932f1['body']['channel'],_0x2932f1[_0x8a47('0x47')]['type']);return db[_0x8a47('0x49')][_0x8a47('0x46')](_0x2932f1[_0x8a47('0x47')],{'include':[{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x4d')},{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x50')}]});}return null;})[_0x8a47('0x26')](respondWithResult(_0x99848c,null))['catch'](handleError(_0x99848c,null));};exports['getFields']=function(_0x435039,_0x131176,_0x2761bf){var _0x5d6ebc='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x435039[_0x8a47('0x42')]['id']},'attributes':['id','username',_0x8a47('0x53'),_0x8a47('0x54'),_0x8a47('0x55'),_0x8a47('0x56')]})['then'](handleEntityNotFound(_0x131176,null))[_0x8a47('0x26')](function(_0x55c590){if(_0x55c590){_0x5d6ebc=_0x55c590[_0x8a47('0x56')];var _0x430ee2=_0x5d6ebc[_0x8a47('0x57')](-0x1);if(_0x430ee2==='/'){_0x5d6ebc=_0x5d6ebc['substring'](0x0,_0x5d6ebc[_0x8a47('0x58')](_0x430ee2));}var _0x3f53ba={'method':'GET','uri':util[_0x8a47('0x59')](_0x8a47('0x5a'),_0x5d6ebc,_0x8a47('0x5b')),'json':!![]};switch(_0x55c590[_0x8a47('0x55')]){case _0x8a47('0x53'):_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util['format'](_0x8a47('0x5e'),_0x55c590[_0x8a47('0x5f')],_0x55c590['password']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;case'token':_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util[_0x8a47('0x59')](_0x8a47('0x62'),_0x55c590['username'],_0x55c590['token']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;default:throw new db[(_0x8a47('0x63'))][(_0x8a47('0x64'))](_0x8a47('0x65'));}return rp(_0x3f53ba);}})[_0x8a47('0x26')](function(_0x34bb61){if(_0x34bb61){var _0x4845fa=[_0x8a47('0x66'),_0x8a47('0x67'),_0x8a47('0x68'),'assignee'];_[_0x8a47('0x69')](_0x34bb61[_0x8a47('0x5b')],function(_0xa2ea5c){return _0x4845fa[_0x8a47('0x6a')](_0xa2ea5c[_0x8a47('0x4f')]);});return{'count':_0x34bb61[_0x8a47('0x5b')][_0x8a47('0x35')],'rows':_[_0x8a47('0x2b')](_0x34bb61['ticket_fields'],function(_0x509e91){return{'id':_0x509e91['id'],'name':_0x509e91[_0x8a47('0x6b')]>0x7?_0x509e91[_0x8a47('0x6c')]:_0x509e91[_0x8a47('0x4f')],'custom':_0x509e91['position']>0x7?!![]:![],'options':_0x509e91[_0x8a47('0x6d')]?_0x509e91[_0x8a47('0x6d')]:_0x509e91[_0x8a47('0x6e')]?_0x509e91[_0x8a47('0x6e')]:[]};})};}})[_0x8a47('0x26')](respondWithResult(_0x131176,null))[_0x8a47('0x40')](function(_0x18def4){var _0x2a2379=_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?0x1f4:_0x18def4[_0x8a47('0x70')]||0x1f4;logger[_0x8a47('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0x8a47('0x72'),_0x2a2379,JSON[_0x8a47('0x73')](_0x18def4));delete _0x18def4[_0x8a47('0x29')];if(_0x2a2379===0x191){_0x2a2379=0x190;}_0x131176[_0x8a47('0x1a')](_0x2a2379)[_0x8a47('0x74')](_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?{'message':_0x8a47('0x75'),'statusCode':_0x18def4[_0x8a47('0x70')]}:_0x18def4);});}; \ No newline at end of file +var _0xde2c=['error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','stack','name','send','index','map','ZendeskAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','destroy','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','headers','Basic\x20%s','%s:%s','username','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','ticket_fields','includes','position','title','custom_field_options','test'];(function(_0x137d4b,_0x1975ce){var _0x4b7368=function(_0x38bdd3){while(--_0x38bdd3){_0x137d4b['push'](_0x137d4b['shift']());}};_0x4b7368(++_0x1975ce);}(_0xde2c,0x7f));var _0xcde2=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xde2c[_0x28f1de];return _0x5b5dad;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];var integrations=require(_0xcde2('0x1a'));function respondWithStatusCode(_0x1ea4bb,_0x599294){_0x599294=_0x599294||0xcc;return function(_0x211215){if(_0x211215){return _0x1ea4bb['sendStatus'](_0x599294);}return _0x1ea4bb[_0xcde2('0x1b')](_0x599294)['end']();};}function respondWithResult(_0x4b0e0e,_0x34e079){_0x34e079=_0x34e079||0xc8;return function(_0x1c7103){if(_0x1c7103){return _0x4b0e0e[_0xcde2('0x1b')](_0x34e079)[_0xcde2('0x1c')](_0x1c7103);}};}function respondWithFilteredResult(_0x11665c,_0x5312c7){return function(_0x39b023){if(_0x39b023){var _0x4c558b=typeof _0x5312c7[_0xcde2('0x1d')]===_0xcde2('0x1e')&&typeof _0x5312c7[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x5223f1=_0x39b023['count'];var _0x4fe586=_0x4c558b?0x0:_0x5312c7[_0xcde2('0x1d')];var _0x582e84=_0x4c558b?_0x39b023[_0xcde2('0x20')]:_0x5312c7[_0xcde2('0x1d')]+_0x5312c7[_0xcde2('0x1f')];var _0x481fc0;if(_0x582e84>=_0x5223f1){_0x582e84=_0x5223f1;_0x481fc0=0xc8;}else{_0x481fc0=0xce;}_0x11665c[_0xcde2('0x1b')](_0x481fc0);return _0x11665c[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fe586+'-'+_0x582e84+'/'+_0x5223f1)[_0xcde2('0x1c')](_0x39b023);}return null;};}function patchUpdates(_0x43df7a){return function(_0x57210d){try{jsonpatch['apply'](_0x57210d,_0x43df7a,!![]);}catch(_0x5a92b9){return BPromise[_0xcde2('0x23')](_0x5a92b9);}return _0x57210d[_0xcde2('0x24')]();};}function saveUpdates(_0x2c9562,_0x4063d4){return function(_0xc86374){if(_0xc86374){return _0xc86374['update'](_0x2c9562)[_0xcde2('0x25')](function(_0x52368b){return _0x52368b;});}return null;};}function removeEntity(_0x280d8c,_0xb2123c){return function(_0x26d18e){if(_0x26d18e){return _0x26d18e['destroy']()['then'](function(){_0x280d8c[_0xcde2('0x1b')](0xcc)[_0xcde2('0x26')]();});}};}function handleEntityNotFound(_0x3e8aaf,_0x217ec9){return function(_0xcadb2){if(!_0xcadb2){_0x3e8aaf['sendStatus'](0x194);}return _0xcadb2;};}function handleError(_0x2d1d17,_0x45275a){_0x45275a=_0x45275a||0x1f4;return function(_0x1dce65){logger['error'](_0x1dce65[_0xcde2('0x27')]);if(_0x1dce65[_0xcde2('0x28')]){delete _0x1dce65[_0xcde2('0x28')];}_0x2d1d17[_0xcde2('0x1b')](_0x45275a)[_0xcde2('0x29')](_0x1dce65);};}exports[_0xcde2('0x2a')]=function(_0x40b12c,_0x3e492f){var _0x5bf1e6={},_0x3c3c01={},_0x4a0826={'count':0x0,'rows':[]};var _0x141072=_[_0xcde2('0x2b')](db[_0xcde2('0x2c')]['rawAttributes'],function(_0xae46dc){return{'name':_0xae46dc[_0xcde2('0x2d')],'type':_0xae46dc['type'][_0xcde2('0x2e')]};});_0x3c3c01[_0xcde2('0x2f')]=_[_0xcde2('0x2b')](_0x141072,_0xcde2('0x28'));_0x3c3c01[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x40b12c[_0xcde2('0x30')]);_0x3c3c01[_0xcde2('0x32')]=_['intersection'](_0x3c3c01[_0xcde2('0x2f')],_0x3c3c01[_0xcde2('0x30')]);_0x5bf1e6[_0xcde2('0x33')]=_[_0xcde2('0x34')](_0x3c3c01['model'],qs[_0xcde2('0x35')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x35')]));_0x5bf1e6[_0xcde2('0x33')]=_0x5bf1e6['attributes'][_0xcde2('0x36')]?_0x5bf1e6[_0xcde2('0x33')]:_0x3c3c01[_0xcde2('0x2f')];if(!_0x40b12c[_0xcde2('0x30')]['hasOwnProperty'](_0xcde2('0x37'))){_0x5bf1e6[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x1f')]);_0x5bf1e6['offset']=qs[_0xcde2('0x1d')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x1d')]);}_0x5bf1e6[_0xcde2('0x38')]=qs['sort'](_0x40b12c['query'][_0xcde2('0x39')]);_0x5bf1e6[_0xcde2('0x3a')]=qs[_0xcde2('0x32')](_[_0xcde2('0x3b')](_0x40b12c[_0xcde2('0x30')],_0x3c3c01[_0xcde2('0x32')]),_0x141072);if(_0x40b12c[_0xcde2('0x30')][_0xcde2('0x3c')]){_0x5bf1e6[_0xcde2('0x3a')]=_['merge'](_0x5bf1e6[_0xcde2('0x3a')],{'$or':_[_0xcde2('0x2b')](_0x141072,function(_0x30f843){if(_0x30f843[_0xcde2('0x3d')]!==_0xcde2('0x3e')){var _0x47b6ee={};_0x47b6ee[_0x30f843['name']]={'$like':'%'+_0x40b12c[_0xcde2('0x30')][_0xcde2('0x3c')]+'%'};return _0x47b6ee;}})});}_0x5bf1e6=_[_0xcde2('0x3f')]({},_0x5bf1e6,_0x40b12c[_0xcde2('0x40')]);var _0x144de9={'where':_0x5bf1e6[_0xcde2('0x3a')]};return db['ZendeskAccount']['count'](_0x144de9)['then'](function(_0x18f723){_0x4a0826[_0xcde2('0x20')]=_0x18f723;if(_0x40b12c[_0xcde2('0x30')][_0xcde2('0x41')]){_0x5bf1e6[_0xcde2('0x42')]=[{'all':!![]}];}return db[_0xcde2('0x2c')][_0xcde2('0x43')](_0x5bf1e6);})['then'](function(_0x48580a){_0x4a0826[_0xcde2('0x44')]=_0x48580a;return _0x4a0826;})['then'](respondWithFilteredResult(_0x3e492f,_0x5bf1e6))[_0xcde2('0x45')](handleError(_0x3e492f,null));};exports['show']=function(_0x1126b2,_0x3239a0){var _0x2cf372={'raw':![],'where':{'id':_0x1126b2[_0xcde2('0x46')]['id']}},_0x5ea9a9={};_0x5ea9a9['model']=_[_0xcde2('0x31')](db[_0xcde2('0x2c')][_0xcde2('0x47')]);_0x5ea9a9[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x1126b2[_0xcde2('0x30')]);_0x5ea9a9['filters']=_['intersection'](_0x5ea9a9[_0xcde2('0x2f')],_0x5ea9a9['query']);_0x2cf372['attributes']=_[_0xcde2('0x34')](_0x5ea9a9['model'],qs[_0xcde2('0x35')](_0x1126b2[_0xcde2('0x30')]['fields']));_0x2cf372[_0xcde2('0x33')]=_0x2cf372['attributes']['length']?_0x2cf372[_0xcde2('0x33')]:_0x5ea9a9[_0xcde2('0x2f')];if(_0x1126b2['query'][_0xcde2('0x41')]){_0x2cf372['include']=[{'all':!![]}];}_0x2cf372=_[_0xcde2('0x3f')]({},_0x2cf372,_0x1126b2[_0xcde2('0x40')]);return db[_0xcde2('0x2c')][_0xcde2('0x48')](_0x2cf372)[_0xcde2('0x25')](handleEntityNotFound(_0x3239a0,null))['then'](respondWithResult(_0x3239a0,null))[_0xcde2('0x45')](handleError(_0x3239a0,null));};exports[_0xcde2('0x49')]=function(_0x40d14b,_0x2c78a5){return db['ZendeskAccount']['create'](_0x40d14b[_0xcde2('0x4a')],{})['then'](respondWithResult(_0x2c78a5,0xc9))[_0xcde2('0x45')](handleError(_0x2c78a5,null));};exports[_0xcde2('0x4b')]=function(_0x381bd4,_0x16675f){if(_0x381bd4[_0xcde2('0x4a')]['id']){delete _0x381bd4[_0xcde2('0x4a')]['id'];}return db['ZendeskAccount'][_0xcde2('0x48')]({'where':{'id':_0x381bd4['params']['id']}})[_0xcde2('0x25')](handleEntityNotFound(_0x16675f,null))['then'](saveUpdates(_0x381bd4[_0xcde2('0x4a')],null))[_0xcde2('0x25')](respondWithResult(_0x16675f,null))[_0xcde2('0x45')](handleError(_0x16675f,null));};exports[_0xcde2('0x4c')]=function(_0x446cf0,_0x5071ce){return db['ZendeskAccount'][_0xcde2('0x48')]({'where':{'id':_0x446cf0['params']['id']}})[_0xcde2('0x25')](handleEntityNotFound(_0x5071ce,null))[_0xcde2('0x25')](removeEntity(_0x5071ce,null))[_0xcde2('0x45')](handleError(_0x5071ce,null));};exports[_0xcde2('0x4d')]=function(_0x1e1c9e,_0x9067c8,_0x3a0760){var _0x28bd25={};var _0x373cdc={};var _0x21585a;var _0x3c5a17;return db[_0xcde2('0x2c')]['findOne']({'where':{'id':_0x1e1c9e['params']['id']}})['then'](handleEntityNotFound(_0x9067c8,null))[_0xcde2('0x25')](function(_0x59a64d){if(_0x59a64d){_0x21585a=_0x59a64d;_0x373cdc[_0xcde2('0x2f')]=_[_0xcde2('0x31')](db[_0xcde2('0x4e')]['rawAttributes']);_0x373cdc[_0xcde2('0x30')]=_['keys'](_0x1e1c9e[_0xcde2('0x30')]);_0x373cdc['filters']=_[_0xcde2('0x34')](_0x373cdc[_0xcde2('0x2f')],_0x373cdc['query']);_0x28bd25[_0xcde2('0x33')]=_['intersection'](_0x373cdc['model'],qs[_0xcde2('0x35')](_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x35')]));_0x28bd25[_0xcde2('0x33')]=_0x28bd25[_0xcde2('0x33')][_0xcde2('0x36')]?_0x28bd25['attributes']:_0x373cdc[_0xcde2('0x2f')];_0x28bd25[_0xcde2('0x38')]=qs[_0xcde2('0x39')](_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x39')]);_0x28bd25[_0xcde2('0x3a')]=qs['filters'](_['pick'](_0x1e1c9e[_0xcde2('0x30')],_0x373cdc[_0xcde2('0x32')]));if(_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x3c')]){_0x28bd25['where']=_[_0xcde2('0x3f')](_0x28bd25[_0xcde2('0x3a')],{'$or':_[_0xcde2('0x2b')](_0x28bd25[_0xcde2('0x33')],function(_0x5e4733){var _0x35453a={};_0x35453a[_0x5e4733]={'$like':'%'+_0x1e1c9e['query'][_0xcde2('0x3c')]+'%'};return _0x35453a;})});}_0x28bd25=_[_0xcde2('0x3f')]({},_0x28bd25,_0x1e1c9e['options']);return _0x21585a[_0xcde2('0x4d')](_0x28bd25);}})[_0xcde2('0x25')](function(_0x408535){if(_0x408535){_0x3c5a17=_0x408535[_0xcde2('0x36')];if(!_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x4f')](_0xcde2('0x37'))){_0x28bd25[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x1e1c9e[_0xcde2('0x30')]['limit']);_0x28bd25[_0xcde2('0x1d')]=qs[_0xcde2('0x1d')](_0x1e1c9e['query'][_0xcde2('0x1d')]);}return _0x21585a[_0xcde2('0x4d')](_0x28bd25);}})[_0xcde2('0x25')](function(_0x5aaa3f){if(_0x5aaa3f){return _0x5aaa3f?{'count':_0x3c5a17,'rows':_0x5aaa3f}:null;}})[_0xcde2('0x25')](respondWithResult(_0x9067c8,null))[_0xcde2('0x45')](handleError(_0x9067c8,null));};exports[_0xcde2('0x50')]=function(_0x3b1ca7,_0x24ddd2,_0x3aa334){if(_0x3b1ca7[_0xcde2('0x4a')]['id']){delete _0x3b1ca7[_0xcde2('0x4a')]['id'];}return db[_0xcde2('0x2c')][_0xcde2('0x51')]({'where':{'id':_0x3b1ca7[_0xcde2('0x46')]['id']}})['then'](handleEntityNotFound(_0x24ddd2,null))['then'](function(_0x39c723){if(_0x39c723){_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x52')]=_0x39c723['id'];_0x3b1ca7['body']['Subjects']=integrations['getSubjects'](_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x53')],_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x3d')]);_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x54')]=integrations['getDescriptions'](_0x3b1ca7['body'][_0xcde2('0x53')],_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x3d')]);return db[_0xcde2('0x4e')][_0xcde2('0x49')](_0x3b1ca7[_0xcde2('0x4a')],{'include':[{'model':db[_0xcde2('0x55')],'as':_0xcde2('0x56')},{'model':db[_0xcde2('0x55')],'as':_0xcde2('0x54')}]});}return null;})[_0xcde2('0x25')](respondWithResult(_0x24ddd2,null))[_0xcde2('0x45')](handleError(_0x24ddd2,null));};exports[_0xcde2('0x57')]=function(_0x16b6b3,_0x3f46ca,_0xb5e3){var _0x3cf1aa='';return db[_0xcde2('0x2c')][_0xcde2('0x51')]({'where':{'id':_0x16b6b3[_0xcde2('0x46')]['id']},'attributes':['id','username',_0xcde2('0x58'),_0xcde2('0x59'),_0xcde2('0x5a'),_0xcde2('0x5b')]})[_0xcde2('0x25')](handleEntityNotFound(_0x3f46ca,null))['then'](function(_0x2e9714){if(_0x2e9714){_0x3cf1aa=_0x2e9714['remoteUri'];var _0x103932=_0x3cf1aa[_0xcde2('0x5c')](-0x1);if(_0x103932==='/'){_0x3cf1aa=_0x3cf1aa[_0xcde2('0x5d')](0x0,_0x3cf1aa[_0xcde2('0x5e')](_0x103932));}var _0x31815f={'method':_0xcde2('0x5f'),'uri':util[_0xcde2('0x60')]('%s/%s',_0x3cf1aa,'ticket_fields'),'json':!![]};switch(_0x2e9714[_0xcde2('0x5a')]){case'password':_0x31815f[_0xcde2('0x61')]={'Authorization':util[_0xcde2('0x60')](_0xcde2('0x62'),new Buffer(util[_0xcde2('0x60')](_0xcde2('0x63'),_0x2e9714[_0xcde2('0x64')],_0x2e9714[_0xcde2('0x58')]))['toString'](_0xcde2('0x65')))};break;case _0xcde2('0x59'):_0x31815f[_0xcde2('0x61')]={'Authorization':util[_0xcde2('0x60')]('Basic\x20%s',new Buffer(util[_0xcde2('0x60')](_0xcde2('0x66'),_0x2e9714[_0xcde2('0x64')],_0x2e9714[_0xcde2('0x59')]))[_0xcde2('0x67')](_0xcde2('0x65')))};break;default:throw new db[(_0xcde2('0x68'))][(_0xcde2('0x69'))](_0xcde2('0x6a'));}return rp(_0x31815f);}})[_0xcde2('0x25')](function(_0x213901){if(_0x213901){var _0x225ddd=[_0xcde2('0x6b'),'description',_0xcde2('0x6c'),_0xcde2('0x6d')];_[_0xcde2('0x6e')](_0x213901[_0xcde2('0x6f')],function(_0x1f1f71){return _0x225ddd[_0xcde2('0x70')](_0x1f1f71[_0xcde2('0x3d')]);});return{'count':_0x213901[_0xcde2('0x6f')][_0xcde2('0x36')],'rows':_[_0xcde2('0x2b')](_0x213901[_0xcde2('0x6f')],function(_0x18b0a1){return{'id':_0x18b0a1['id'],'name':_0x18b0a1[_0xcde2('0x71')]>0x7?_0x18b0a1[_0xcde2('0x72')]:_0x18b0a1[_0xcde2('0x3d')],'custom':_0x18b0a1[_0xcde2('0x71')]>0x7?!![]:![],'options':_0x18b0a1['system_field_options']?_0x18b0a1['system_field_options']:_0x18b0a1[_0xcde2('0x73')]?_0x18b0a1[_0xcde2('0x73')]:[]};})};}})[_0xcde2('0x25')](respondWithResult(_0x3f46ca,null))[_0xcde2('0x45')](function(_0x4ffd32){var _0x9afade=_0x16b6b3['query'][_0xcde2('0x74')]?0x1f4:_0x4ffd32['statusCode']||0x1f4;logger[_0xcde2('0x75')](_0xcde2('0x76'),'getFields',_0x9afade,JSON[_0xcde2('0x77')](_0x4ffd32));delete _0x4ffd32[_0xcde2('0x28')];if(_0x9afade===0x191){_0x9afade=0x190;}_0x3f46ca[_0xcde2('0x1b')](_0x9afade)['send'](_0x16b6b3[_0xcde2('0x30')][_0xcde2('0x74')]?{'message':_0xcde2('0x78'),'statusCode':_0x4ffd32[_0xcde2('0x79')]}:_0x4ffd32);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index cd1b55a..39d3337 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 _0x6407=['rimraf','../../config/environment','../../components/integrations/configuration','exports','int_zendesk_accounts','util','api','moment','bluebird','request-promise','path'];(function(_0x4c1b17,_0x4c3bb8){var _0x23694a=function(_0x102927){while(--_0x102927){_0x4c1b17['push'](_0x4c1b17['shift']());}};_0x23694a(++_0x4c3bb8);}(_0x6407,0xb5));var _0x7640=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6407[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x7640('0x0'));var logger=require('../../config/logger')(_0x7640('0x1'));var moment=require(_0x7640('0x2'));var BPromise=require(_0x7640('0x3'));var rp=require(_0x7640('0x4'));var fs=require('fs');var path=require(_0x7640('0x5'));var rimraf=require(_0x7640('0x6'));var config=require(_0x7640('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7640('0x8'));module[_0x7640('0x9')]=function(_0x59a1d3,_0x14f438){return _0x59a1d3['define']('ZendeskAccount',attributes,{'tableName':_0x7640('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b94=['exports','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0xeac779,_0x22f384){var _0x3c9f6c=function(_0x33cfb8){while(--_0x33cfb8){_0xeac779['push'](_0xeac779['shift']());}};_0x3c9f6c(++_0x22f384);}(_0x7b94,0xda));var _0x47b9=function(_0x832d9c,_0x5748c7){_0x832d9c=_0x832d9c-0x0;var _0xeaa28c=_0x7b94[_0x832d9c];return _0xeaa28c;};'use strict';var _=require(_0x47b9('0x0'));var util=require(_0x47b9('0x1'));var logger=require(_0x47b9('0x2'))(_0x47b9('0x3'));var moment=require(_0x47b9('0x4'));var BPromise=require(_0x47b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47b9('0x6'));var rimraf=require('rimraf');var config=require(_0x47b9('0x7'));var attributes=require(_0x47b9('0x8'));var integrations=require(_0x47b9('0x9'));module[_0x47b9('0xa')]=function(_0xa7ae3b,_0x3b02ef){return _0xa7ae3b['define']('ZendeskAccount',attributes,{'tableName':_0x47b9('0xb'),'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 8f34a62..0479717 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 _0xee2d=['jayson/promise','client','http','request','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','options','raw','where','attributes','map','include','model','then','ZendeskAccount','find','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xecab6a,_0x3c768a){var _0x40b98b=function(_0x448a28){while(--_0x448a28){_0xecab6a['push'](_0xecab6a['shift']());}};_0x40b98b(++_0x3c768a);}(_0xee2d,0xcf));var _0xdee2=function(_0xb65b81,_0x3a8a23){_0xb65b81=_0xb65b81-0x0;var _0x23091e=_0xee2d[_0xb65b81];return _0x23091e;};'use strict';var _=require(_0xdee2('0x0'));var util=require(_0xdee2('0x1'));var moment=require(_0xdee2('0x2'));var BPromise=require(_0xdee2('0x3'));var rs=require(_0xdee2('0x4'));var fs=require('fs');var Redis=require(_0xdee2('0x5'));var db=require(_0xdee2('0x6'))['db'];var utils=require(_0xdee2('0x7'));var logger=require('../../config/logger')(_0xdee2('0x8'));var config=require('../../config/environment');var jayson=require(_0xdee2('0x9'));var client=jayson[_0xdee2('0xa')][_0xdee2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xafad92,_0x3d0f68,_0x468162){return new BPromise(function(_0xef050f,_0x571930){return client[_0xdee2('0xc')](_0xafad92,_0x468162)['then'](function(_0x5cfa55){logger[_0xdee2('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x3d0f68,'request\x20sent');logger[_0xdee2('0xe')](_0xdee2('0xf'),_0x3d0f68,_0xdee2('0x10'),JSON[_0xdee2('0x11')](_0x5cfa55));if(_0x5cfa55[_0xdee2('0x12')]){if(_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x13')]===0x1f4){logger[_0xdee2('0x12')](_0xdee2('0x14'),_0x3d0f68,_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);return _0x571930(_0x5cfa55['error'][_0xdee2('0x15')]);}logger[_0xdee2('0x12')](_0xdee2('0x14'),_0x3d0f68,_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);return _0xef050f(_0x5cfa55[_0xdee2('0x12')][_0xdee2('0x15')]);}else{logger[_0xdee2('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x3d0f68,_0xdee2('0x10'));_0xef050f(_0x5cfa55[_0xdee2('0x16')]['message']);}})['catch'](function(_0x389188){logger['error'](_0xdee2('0x14'),_0x3d0f68,_0x389188);_0x571930(_0x389188);});});}exports[_0xdee2('0x17')]=function(_0x495878){var _0x487351=this;return new Promise(function(_0x55edeb,_0x1936ac){return db['ZendeskAccount']['findAll']({'raw':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x19')]===undefined?!![]:![]:!![],'where':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x1a')]||null:null,'attributes':_0x495878[_0xdee2('0x18')]?_0x495878[_0xdee2('0x18')][_0xdee2('0x1b')]||null:null,'limit':_0x495878[_0xdee2('0x18')]?_0x495878['options']['limit']||null:null,'include':_0x495878[_0xdee2('0x18')]?_0x495878['options']['include']?_[_0xdee2('0x1c')](_0x495878[_0xdee2('0x18')][_0xdee2('0x1d')],function(_0x583f38){return{'model':db[_0x583f38[_0xdee2('0x1e')]],'as':_0x583f38['as'],'attributes':_0x583f38['attributes'],'include':_0x583f38[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x583f38['include'],function(_0x140e07){return{'model':db[_0x140e07[_0xdee2('0x1e')]],'as':_0x140e07['as'],'attributes':_0x140e07[_0xdee2('0x1b')],'include':_0x140e07[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x140e07[_0xdee2('0x1d')],function(_0x37a75c){return{'model':db[_0x37a75c[_0xdee2('0x1e')]],'as':_0x37a75c['as'],'attributes':_0x37a75c[_0xdee2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdee2('0x1f')](function(_0x2bbafa){logger[_0xdee2('0xd')](_0xdee2('0x17'),_0x495878);logger[_0xdee2('0xe')]('GetZendeskAccount',_0x495878,JSON['stringify'](_0x2bbafa));_0x55edeb(_0x2bbafa);})['catch'](function(_0x107304){logger[_0xdee2('0x12')](_0xdee2('0x17'),_0x107304[_0xdee2('0x15')],_0x495878);_0x1936ac(_0x487351[_0xdee2('0x12')](0x1f4,_0x107304[_0xdee2('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x53f5f8){var _0x3d8c67=this;return new Promise(function(_0x3a819b,_0x37f196){return db[_0xdee2('0x20')][_0xdee2('0x21')]({'raw':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x19')]===undefined?!![]:![]:!![],'where':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1a')]||null:null,'attributes':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1b')]||null:null,'include':_0x53f5f8['options']?_0x53f5f8[_0xdee2('0x18')][_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x53f5f8[_0xdee2('0x18')]['include'],function(_0x12b1db){return{'model':db[_0x12b1db[_0xdee2('0x1e')]],'as':_0x12b1db['as'],'attributes':_0x12b1db['attributes'],'include':_0x12b1db[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x12b1db[_0xdee2('0x1d')],function(_0x4b0471){return{'model':db[_0x4b0471[_0xdee2('0x1e')]],'as':_0x4b0471['as'],'attributes':_0x4b0471[_0xdee2('0x1b')],'include':_0x4b0471[_0xdee2('0x1d')]?_[_0xdee2('0x1c')](_0x4b0471[_0xdee2('0x1d')],function(_0x29c53f){return{'model':db[_0x29c53f['model']],'as':_0x29c53f['as'],'attributes':_0x29c53f[_0xdee2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57b573){logger[_0xdee2('0xd')](_0xdee2('0x22'),_0x53f5f8);logger[_0xdee2('0xe')](_0xdee2('0x22'),_0x53f5f8,JSON[_0xdee2('0x11')](_0x57b573));_0x3a819b(_0x57b573);})[_0xdee2('0x23')](function(_0x3e95bd){logger[_0xdee2('0x12')](_0xdee2('0x22'),_0x3e95bd[_0xdee2('0x15')],_0x53f5f8);_0x37f196(_0x3d8c67['error'](0x1f4,_0x3e95bd[_0xdee2('0x15')]));});});}; \ No newline at end of file +var _0x489a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','options','raw','attributes','limit','include','model','debug','ShowZendeskAccount','ZendeskAccount','find','where','map','lodash','util','bluebird'];(function(_0x4236b8,_0x579cba){var _0x20afbf=function(_0x39ca13){while(--_0x39ca13){_0x4236b8['push'](_0x4236b8['shift']());}};_0x20afbf(++_0x579cba);}(_0x489a,0x66));var _0xa489=function(_0x34473f,_0x2b9c5c){_0x34473f=_0x34473f-0x0;var _0x25cf6f=_0x489a[_0x34473f];return _0x25cf6f;};'use strict';var _=require(_0xa489('0x0'));var util=require(_0xa489('0x1'));var moment=require('moment');var BPromise=require(_0xa489('0x2'));var rs=require(_0xa489('0x3'));var fs=require('fs');var Redis=require(_0xa489('0x4'));var db=require(_0xa489('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa489('0x6'));var config=require(_0xa489('0x7'));var jayson=require(_0xa489('0x8'));var client=jayson['client'][_0xa489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aa3b5,_0x4d21c2,_0x5c1c0e){return new BPromise(function(_0x50c4fc,_0x9b77bd){return client[_0xa489('0xa')](_0x1aa3b5,_0x5c1c0e)[_0xa489('0xb')](function(_0x158b91){logger[_0xa489('0xc')](_0xa489('0xd'),_0x4d21c2,_0xa489('0xe'));logger['debug'](_0xa489('0xf'),_0x4d21c2,_0xa489('0xe'),JSON[_0xa489('0x10')](_0x158b91));if(_0x158b91[_0xa489('0x11')]){if(_0x158b91[_0xa489('0x11')][_0xa489('0x12')]===0x1f4){logger[_0xa489('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x4d21c2,_0x158b91[_0xa489('0x11')]['message']);return _0x9b77bd(_0x158b91[_0xa489('0x11')][_0xa489('0x13')]);}logger['error'](_0xa489('0xd'),_0x4d21c2,_0x158b91['error'][_0xa489('0x13')]);return _0x50c4fc(_0x158b91[_0xa489('0x11')][_0xa489('0x13')]);}else{logger[_0xa489('0xc')](_0xa489('0xd'),_0x4d21c2,_0xa489('0xe'));_0x50c4fc(_0x158b91[_0xa489('0x14')][_0xa489('0x13')]);}})[_0xa489('0x15')](function(_0x141352){logger[_0xa489('0x11')](_0xa489('0xd'),_0x4d21c2,_0x141352);_0x9b77bd(_0x141352);});});}exports[_0xa489('0x16')]=function(_0x553c55){var _0x4e88a1=this;return new Promise(function(_0x441b0c,_0x57a1eb){return db['ZendeskAccount']['findAll']({'raw':_0x553c55['options']?_0x553c55[_0xa489('0x17')][_0xa489('0x18')]===undefined?!![]:![]:!![],'where':_0x553c55[_0xa489('0x17')]?_0x553c55[_0xa489('0x17')]['where']||null:null,'attributes':_0x553c55[_0xa489('0x17')]?_0x553c55[_0xa489('0x17')][_0xa489('0x19')]||null:null,'limit':_0x553c55[_0xa489('0x17')]?_0x553c55[_0xa489('0x17')][_0xa489('0x1a')]||null:null,'include':_0x553c55['options']?_0x553c55[_0xa489('0x17')][_0xa489('0x1b')]?_['map'](_0x553c55[_0xa489('0x17')]['include'],function(_0x382ecd){return{'model':db[_0x382ecd[_0xa489('0x1c')]],'as':_0x382ecd['as'],'attributes':_0x382ecd[_0xa489('0x19')],'include':_0x382ecd[_0xa489('0x1b')]?_['map'](_0x382ecd[_0xa489('0x1b')],function(_0x32d96a){return{'model':db[_0x32d96a[_0xa489('0x1c')]],'as':_0x32d96a['as'],'attributes':_0x32d96a[_0xa489('0x19')],'include':_0x32d96a[_0xa489('0x1b')]?_['map'](_0x32d96a[_0xa489('0x1b')],function(_0x41238e){return{'model':db[_0x41238e[_0xa489('0x1c')]],'as':_0x41238e['as'],'attributes':_0x41238e[_0xa489('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x300be2){logger[_0xa489('0xc')](_0xa489('0x16'),_0x553c55);logger[_0xa489('0x1d')](_0xa489('0x16'),_0x553c55,JSON[_0xa489('0x10')](_0x300be2));_0x441b0c(_0x300be2);})[_0xa489('0x15')](function(_0x143111){logger[_0xa489('0x11')](_0xa489('0x16'),_0x143111[_0xa489('0x13')],_0x553c55);_0x57a1eb(_0x4e88a1[_0xa489('0x11')](0x1f4,_0x143111[_0xa489('0x13')]));});});};exports[_0xa489('0x1e')]=function(_0x1dd1a7){var _0x233d4e=this;return new Promise(function(_0x2899e3,_0x506f64){return db[_0xa489('0x1f')][_0xa489('0x20')]({'raw':_0x1dd1a7[_0xa489('0x17')]?_0x1dd1a7[_0xa489('0x17')][_0xa489('0x18')]===undefined?!![]:![]:!![],'where':_0x1dd1a7['options']?_0x1dd1a7[_0xa489('0x17')][_0xa489('0x21')]||null:null,'attributes':_0x1dd1a7[_0xa489('0x17')]?_0x1dd1a7['options'][_0xa489('0x19')]||null:null,'include':_0x1dd1a7[_0xa489('0x17')]?_0x1dd1a7['options'][_0xa489('0x1b')]?_['map'](_0x1dd1a7[_0xa489('0x17')][_0xa489('0x1b')],function(_0x26d0cf){return{'model':db[_0x26d0cf[_0xa489('0x1c')]],'as':_0x26d0cf['as'],'attributes':_0x26d0cf[_0xa489('0x19')],'include':_0x26d0cf[_0xa489('0x1b')]?_[_0xa489('0x22')](_0x26d0cf[_0xa489('0x1b')],function(_0x4cb155){return{'model':db[_0x4cb155[_0xa489('0x1c')]],'as':_0x4cb155['as'],'attributes':_0x4cb155['attributes'],'include':_0x4cb155[_0xa489('0x1b')]?_[_0xa489('0x22')](_0x4cb155[_0xa489('0x1b')],function(_0x2d4d12){return{'model':db[_0x2d4d12['model']],'as':_0x2d4d12['as'],'attributes':_0x2d4d12[_0xa489('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa489('0xb')](function(_0x1513b0){logger[_0xa489('0xc')](_0xa489('0x1e'),_0x1dd1a7);logger['debug']('ShowZendeskAccount',_0x1dd1a7,JSON[_0xa489('0x10')](_0x1513b0));_0x2899e3(_0x1513b0);})[_0xa489('0x15')](function(_0x4bac93){logger['error'](_0xa489('0x1e'),_0x4bac93['message'],_0x1dd1a7);_0x506f64(_0x233d4e[_0xa489('0x11')](0x1f4,_0x4bac93[_0xa489('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index dcfd195..4e66710 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 _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x878f,0x173));var _0xf878=function(_0x5a1819,_0x2718de){_0x5a1819=_0x5a1819-0x0;var _0x44948d=_0x878f[_0x5a1819];return _0x44948d;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file +var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x77a3e0,_0x362b03){var _0x283b3b=function(_0x3d7c91){while(--_0x3d7c91){_0x77a3e0['push'](_0x77a3e0['shift']());}};_0x283b3b(++_0x362b03);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a7fbc,_0xa081de){_0x5a7fbc=_0x5a7fbc-0x0;var _0xcba0fc=_0x5eb8[_0x5a7fbc];return _0xcba0fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2bb1ca4..3e6ab0b 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 _0x842d=['STRING','sequelize'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x842d,0x10f));var _0xd842=function(_0x7d5a8b,_0x2aedef){_0x7d5a8b=_0x7d5a8b-0x0;var _0x56ac46=_0x842d[_0x7d5a8b];return _0x56ac46;};'use strict';var Sequelize=require(_0xd842('0x0'));module['exports']={'name':{'type':Sequelize[_0xd842('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ec4=['sequelize','exports','STRING'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x7ec4,0xd5));var _0x47ec=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7ec4[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x47ec('0x0'));module[_0x47ec('0x1')]={'name':{'type':Sequelize[_0x47ec('0x2')]},'description':{'type':Sequelize[_0x47ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e39cdb7..243efa3 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 _0x358c=['offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','merge','options','include','rows','catch','params','length','includeAll','find','create','body','getFields','findOne','ZendeskField','getDescriptions','Tag','getTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x10bfc0,_0x261768){var _0x37567f=function(_0x395c2d){while(--_0x395c2d){_0x10bfc0['push'](_0x10bfc0['shift']());}};_0x37567f(++_0x261768);}(_0x358c,0x17a));var _0xc358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x358c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc358('0x0'));var rimraf=require(_0xc358('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc358('0x2'));var rp=require(_0xc358('0x3'));var moment=require(_0xc358('0x4'));var BPromise=require(_0xc358('0x5'));var Mustache=require(_0xc358('0x6'));var util=require(_0xc358('0x7'));var path=require(_0xc358('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc358('0x9'));var fs=require('fs');var fs_extra=require(_0xc358('0xa'));var _=require(_0xc358('0xb'));var squel=require('squel');var crypto=require(_0xc358('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc358('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc358('0xe'));var Papa=require(_0xc358('0xf'));var Redis=require(_0xc358('0x10'));var authService=require(_0xc358('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc358('0x12'));var hardwareService=require(_0xc358('0x13'));var logger=require(_0xc358('0x14'))(_0xc358('0x15'));var utils=require(_0xc358('0x16'));var config=require(_0xc358('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bdf07,_0x581745){_0x581745=_0x581745||0xcc;return function(_0xeeef16){if(_0xeeef16){return _0x1bdf07['sendStatus'](_0x581745);}return _0x1bdf07[_0xc358('0x18')](_0x581745)[_0xc358('0x19')]();};}function respondWithResult(_0x1cc21e,_0x1950db){_0x1950db=_0x1950db||0xc8;return function(_0x201939){if(_0x201939){return _0x1cc21e[_0xc358('0x18')](_0x1950db)[_0xc358('0x1a')](_0x201939);}};}function respondWithFilteredResult(_0xa42d98,_0x5d2956){return function(_0xb02b58){if(_0xb02b58){var _0x11d9e0=typeof _0x5d2956[_0xc358('0x1b')]===_0xc358('0x1c')&&typeof _0x5d2956[_0xc358('0x1d')]==='undefined';var _0x3a1423=_0xb02b58[_0xc358('0x1e')];var _0x58e3c9=_0x11d9e0?0x0:_0x5d2956[_0xc358('0x1b')];var _0x1337a6=_0x11d9e0?_0xb02b58[_0xc358('0x1e')]:_0x5d2956[_0xc358('0x1b')]+_0x5d2956[_0xc358('0x1d')];var _0x2dff40;if(_0x1337a6>=_0x3a1423){_0x1337a6=_0x3a1423;_0x2dff40=0xc8;}else{_0x2dff40=0xce;}_0xa42d98[_0xc358('0x18')](_0x2dff40);return _0xa42d98[_0xc358('0x1f')]('Content-Range',_0x58e3c9+'-'+_0x1337a6+'/'+_0x3a1423)['json'](_0xb02b58);}return null;};}function patchUpdates(_0x5c64b7){return function(_0x5acfeb){try{jsonpatch[_0xc358('0x20')](_0x5acfeb,_0x5c64b7,!![]);}catch(_0x209789){return BPromise['reject'](_0x209789);}return _0x5acfeb[_0xc358('0x21')]();};}function saveUpdates(_0xb40d6a,_0x1f8716){return function(_0x42adbc){if(_0x42adbc){return _0x42adbc[_0xc358('0x22')](_0xb40d6a)[_0xc358('0x23')](function(_0x422824){return _0x422824;});}return null;};}function removeEntity(_0x4632cc,_0xfd4b2d){return function(_0x2cf7af){if(_0x2cf7af){return _0x2cf7af[_0xc358('0x24')]()[_0xc358('0x23')](function(){_0x4632cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c986e,_0x43a385){return function(_0x16f777){if(!_0x16f777){_0x4c986e['sendStatus'](0x194);}return _0x16f777;};}function handleError(_0x26d4c5,_0x2d0199){_0x2d0199=_0x2d0199||0x1f4;return function(_0x561ce8){logger[_0xc358('0x25')](_0x561ce8[_0xc358('0x26')]);if(_0x561ce8[_0xc358('0x27')]){delete _0x561ce8[_0xc358('0x27')];}_0x26d4c5[_0xc358('0x18')](_0x2d0199)[_0xc358('0x28')](_0x561ce8);};}exports[_0xc358('0x29')]=function(_0x4e85f5,_0x17135c){var _0x5e5357={},_0x4b0eac={},_0x1cff37={'count':0x0,'rows':[]};var _0x4204d9=_['map'](db[_0xc358('0x2a')][_0xc358('0x2b')],function(_0xc86569){return{'name':_0xc86569[_0xc358('0x2c')],'type':_0xc86569['type'][_0xc358('0x2d')]};});_0x4b0eac[_0xc358('0x2e')]=_['map'](_0x4204d9,_0xc358('0x27'));_0x4b0eac['query']=_[_0xc358('0x2f')](_0x4e85f5[_0xc358('0x30')]);_0x4b0eac[_0xc358('0x31')]=_[_0xc358('0x32')](_0x4b0eac[_0xc358('0x2e')],_0x4b0eac['query']);_0x5e5357['attributes']=_[_0xc358('0x32')](_0x4b0eac['model'],qs[_0xc358('0x33')](_0x4e85f5[_0xc358('0x30')][_0xc358('0x33')]));_0x5e5357[_0xc358('0x34')]=_0x5e5357[_0xc358('0x34')]['length']?_0x5e5357[_0xc358('0x34')]:_0x4b0eac[_0xc358('0x2e')];if(!_0x4e85f5[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x5e5357[_0xc358('0x1d')]=qs['limit'](_0x4e85f5[_0xc358('0x30')][_0xc358('0x1d')]);_0x5e5357[_0xc358('0x1b')]=qs[_0xc358('0x1b')](_0x4e85f5[_0xc358('0x30')][_0xc358('0x1b')]);}_0x5e5357[_0xc358('0x37')]=qs['sort'](_0x4e85f5['query'][_0xc358('0x38')]);_0x5e5357['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x4e85f5['query'],_0x4b0eac[_0xc358('0x31')]),_0x4204d9);if(_0x4e85f5[_0xc358('0x30')][_0xc358('0x3a')]){_0x5e5357[_0xc358('0x3b')]=_['merge'](_0x5e5357[_0xc358('0x3b')],{'$or':_[_0xc358('0x3c')](_0x4204d9,function(_0x44fe0a){if(_0x44fe0a[_0xc358('0x3d')]!==_0xc358('0x3e')){var _0x15dc48={};_0x15dc48[_0x44fe0a['name']]={'$like':'%'+_0x4e85f5[_0xc358('0x30')][_0xc358('0x3a')]+'%'};return _0x15dc48;}})});}_0x5e5357=_[_0xc358('0x3f')]({},_0x5e5357,_0x4e85f5[_0xc358('0x40')]);var _0x581e67={'where':_0x5e5357['where']};return db[_0xc358('0x2a')][_0xc358('0x1e')](_0x581e67)['then'](function(_0x160d33){_0x1cff37[_0xc358('0x1e')]=_0x160d33;if(_0x4e85f5[_0xc358('0x30')]['includeAll']){_0x5e5357[_0xc358('0x41')]=[{'all':!![]}];}return db[_0xc358('0x2a')]['findAll'](_0x5e5357);})[_0xc358('0x23')](function(_0x3cf2c3){_0x1cff37[_0xc358('0x42')]=_0x3cf2c3;return _0x1cff37;})[_0xc358('0x23')](respondWithFilteredResult(_0x17135c,_0x5e5357))[_0xc358('0x43')](handleError(_0x17135c,null));};exports['show']=function(_0x384d3b,_0x555d44){var _0x3b3d57={'raw':![],'where':{'id':_0x384d3b[_0xc358('0x44')]['id']}},_0x3a356d={};_0x3a356d['model']=_[_0xc358('0x2f')](db[_0xc358('0x2a')]['rawAttributes']);_0x3a356d[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x384d3b[_0xc358('0x30')]);_0x3a356d['filters']=_[_0xc358('0x32')](_0x3a356d[_0xc358('0x2e')],_0x3a356d['query']);_0x3b3d57[_0xc358('0x34')]=_['intersection'](_0x3a356d['model'],qs[_0xc358('0x33')](_0x384d3b[_0xc358('0x30')][_0xc358('0x33')]));_0x3b3d57[_0xc358('0x34')]=_0x3b3d57[_0xc358('0x34')][_0xc358('0x45')]?_0x3b3d57[_0xc358('0x34')]:_0x3a356d['model'];if(_0x384d3b[_0xc358('0x30')][_0xc358('0x46')]){_0x3b3d57[_0xc358('0x41')]=[{'all':!![]}];}_0x3b3d57=_[_0xc358('0x3f')]({},_0x3b3d57,_0x384d3b['options']);return db[_0xc358('0x2a')][_0xc358('0x47')](_0x3b3d57)[_0xc358('0x23')](handleEntityNotFound(_0x555d44,null))[_0xc358('0x23')](respondWithResult(_0x555d44,null))[_0xc358('0x43')](handleError(_0x555d44,null));};exports['create']=function(_0x52f8b,_0x27f7ce){return db[_0xc358('0x2a')][_0xc358('0x48')](_0x52f8b[_0xc358('0x49')],{})[_0xc358('0x23')](respondWithResult(_0x27f7ce,0xc9))[_0xc358('0x43')](handleError(_0x27f7ce,null));};exports[_0xc358('0x22')]=function(_0x50c0e0,_0x5eecb6){if(_0x50c0e0[_0xc358('0x49')]['id']){delete _0x50c0e0[_0xc358('0x49')]['id'];}return db[_0xc358('0x2a')][_0xc358('0x47')]({'where':{'id':_0x50c0e0[_0xc358('0x44')]['id']}})['then'](handleEntityNotFound(_0x5eecb6,null))[_0xc358('0x23')](saveUpdates(_0x50c0e0[_0xc358('0x49')],null))[_0xc358('0x23')](respondWithResult(_0x5eecb6,null))[_0xc358('0x43')](handleError(_0x5eecb6,null));};exports[_0xc358('0x24')]=function(_0x258474,_0x2e37c3){return db[_0xc358('0x2a')][_0xc358('0x47')]({'where':{'id':_0x258474['params']['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x2e37c3,null))[_0xc358('0x23')](removeEntity(_0x2e37c3,null))['catch'](handleError(_0x2e37c3,null));};exports[_0xc358('0x4a')]=function(_0x468929,_0x1f4349,_0x4c6a78){var _0x10480b={};var _0x1bacb2={};var _0x1bc673;var _0x1d6376;return db[_0xc358('0x2a')][_0xc358('0x4b')]({'where':{'id':_0x468929[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x1f4349,null))[_0xc358('0x23')](function(_0x3364fa){if(_0x3364fa){_0x1bc673=_0x3364fa;_0x1bacb2[_0xc358('0x2e')]=_['keys'](db['ZendeskField'][_0xc358('0x2b')]);_0x1bacb2[_0xc358('0x30')]=_['keys'](_0x468929[_0xc358('0x30')]);_0x1bacb2[_0xc358('0x31')]=_['intersection'](_0x1bacb2[_0xc358('0x2e')],_0x1bacb2['query']);_0x10480b[_0xc358('0x34')]=_[_0xc358('0x32')](_0x1bacb2[_0xc358('0x2e')],qs[_0xc358('0x33')](_0x468929[_0xc358('0x30')][_0xc358('0x33')]));_0x10480b[_0xc358('0x34')]=_0x10480b[_0xc358('0x34')][_0xc358('0x45')]?_0x10480b[_0xc358('0x34')]:_0x1bacb2['model'];_0x10480b[_0xc358('0x37')]=qs['sort'](_0x468929[_0xc358('0x30')]['sort']);_0x10480b['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x468929[_0xc358('0x30')],_0x1bacb2[_0xc358('0x31')]));if(_0x468929['query'][_0xc358('0x3a')]){_0x10480b[_0xc358('0x3b')]=_[_0xc358('0x3f')](_0x10480b['where'],{'$or':_[_0xc358('0x3c')](_0x10480b[_0xc358('0x34')],function(_0x57ba1e){var _0x2aff8f={};_0x2aff8f[_0x57ba1e]={'$like':'%'+_0x468929['query']['filter']+'%'};return _0x2aff8f;})});}_0x10480b=_[_0xc358('0x3f')]({},_0x10480b,_0x468929[_0xc358('0x40')]);return _0x1bc673[_0xc358('0x4a')](_0x10480b);}})[_0xc358('0x23')](function(_0x375ec3){if(_0x375ec3){_0x1d6376=_0x375ec3['length'];if(!_0x468929[_0xc358('0x30')][_0xc358('0x35')]('nolimit')){_0x10480b['limit']=qs[_0xc358('0x1d')](_0x468929['query'][_0xc358('0x1d')]);_0x10480b['offset']=qs[_0xc358('0x1b')](_0x468929[_0xc358('0x30')]['offset']);}return _0x1bc673[_0xc358('0x4a')](_0x10480b);}})['then'](function(_0x245488){if(_0x245488){return _0x245488?{'count':_0x1d6376,'rows':_0x245488}:null;}})[_0xc358('0x23')](respondWithResult(_0x1f4349,null))[_0xc358('0x43')](handleError(_0x1f4349,null));};exports['getSubjects']=function(_0x2c07d8,_0x2ef8a1,_0xee0971){var _0x523cee={};var _0x15b63d={};var _0x8ea3a8;var _0xd944a7;return db[_0xc358('0x2a')]['findOne']({'where':{'id':_0x2c07d8[_0xc358('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef8a1,null))[_0xc358('0x23')](function(_0x2e82af){if(_0x2e82af){_0x8ea3a8=_0x2e82af;_0x15b63d['model']=_['keys'](db[_0xc358('0x4c')][_0xc358('0x2b')]);_0x15b63d[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x2c07d8[_0xc358('0x30')]);_0x15b63d[_0xc358('0x31')]=_[_0xc358('0x32')](_0x15b63d[_0xc358('0x2e')],_0x15b63d[_0xc358('0x30')]);_0x523cee[_0xc358('0x34')]=_[_0xc358('0x32')](_0x15b63d[_0xc358('0x2e')],qs[_0xc358('0x33')](_0x2c07d8['query'][_0xc358('0x33')]));_0x523cee[_0xc358('0x34')]=_0x523cee[_0xc358('0x34')][_0xc358('0x45')]?_0x523cee[_0xc358('0x34')]:_0x15b63d[_0xc358('0x2e')];_0x523cee[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x2c07d8[_0xc358('0x30')][_0xc358('0x38')]);_0x523cee[_0xc358('0x3b')]=qs['filters'](_[_0xc358('0x39')](_0x2c07d8[_0xc358('0x30')],_0x15b63d['filters']));if(_0x2c07d8[_0xc358('0x30')]['filter']){_0x523cee['where']=_['merge'](_0x523cee['where'],{'$or':_[_0xc358('0x3c')](_0x523cee['attributes'],function(_0x2cf3dc){var _0x4ea1cd={};_0x4ea1cd[_0x2cf3dc]={'$like':'%'+_0x2c07d8[_0xc358('0x30')][_0xc358('0x3a')]+'%'};return _0x4ea1cd;})});}_0x523cee=_['merge']({},_0x523cee,_0x2c07d8[_0xc358('0x40')]);return _0x8ea3a8['getSubjects'](_0x523cee);}})['then'](function(_0x365541){if(_0x365541){_0xd944a7=_0x365541['length'];if(!_0x2c07d8[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x523cee['limit']=qs[_0xc358('0x1d')](_0x2c07d8['query'][_0xc358('0x1d')]);_0x523cee[_0xc358('0x1b')]=qs['offset'](_0x2c07d8['query']['offset']);}return _0x8ea3a8['getSubjects'](_0x523cee);}})['then'](function(_0x5d9abc){if(_0x5d9abc){return _0x5d9abc?{'count':_0xd944a7,'rows':_0x5d9abc}:null;}})[_0xc358('0x23')](respondWithResult(_0x2ef8a1,null))[_0xc358('0x43')](handleError(_0x2ef8a1,null));};exports['getDescriptions']=function(_0x5e4396,_0x11e30c,_0x57901d){var _0x386131={};var _0x33b10e={};var _0x352840;var _0x21ac3b;return db['ZendeskConfiguration'][_0xc358('0x4b')]({'where':{'id':_0x5e4396[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x11e30c,null))['then'](function(_0x30d4db){if(_0x30d4db){_0x352840=_0x30d4db;_0x33b10e[_0xc358('0x2e')]=_[_0xc358('0x2f')](db[_0xc358('0x4c')][_0xc358('0x2b')]);_0x33b10e[_0xc358('0x30')]=_[_0xc358('0x2f')](_0x5e4396['query']);_0x33b10e[_0xc358('0x31')]=_[_0xc358('0x32')](_0x33b10e['model'],_0x33b10e[_0xc358('0x30')]);_0x386131[_0xc358('0x34')]=_[_0xc358('0x32')](_0x33b10e[_0xc358('0x2e')],qs['fields'](_0x5e4396[_0xc358('0x30')]['fields']));_0x386131[_0xc358('0x34')]=_0x386131[_0xc358('0x34')][_0xc358('0x45')]?_0x386131[_0xc358('0x34')]:_0x33b10e[_0xc358('0x2e')];_0x386131[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x5e4396[_0xc358('0x30')]['sort']);_0x386131['where']=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x5e4396[_0xc358('0x30')],_0x33b10e[_0xc358('0x31')]));if(_0x5e4396[_0xc358('0x30')][_0xc358('0x3a')]){_0x386131['where']=_['merge'](_0x386131[_0xc358('0x3b')],{'$or':_[_0xc358('0x3c')](_0x386131['attributes'],function(_0x454542){var _0xe9eb71={};_0xe9eb71[_0x454542]={'$like':'%'+_0x5e4396['query'][_0xc358('0x3a')]+'%'};return _0xe9eb71;})});}_0x386131=_[_0xc358('0x3f')]({},_0x386131,_0x5e4396['options']);return _0x352840['getDescriptions'](_0x386131);}})[_0xc358('0x23')](function(_0x136e88){if(_0x136e88){_0x21ac3b=_0x136e88['length'];if(!_0x5e4396['query']['hasOwnProperty'](_0xc358('0x36'))){_0x386131[_0xc358('0x1d')]=qs['limit'](_0x5e4396[_0xc358('0x30')][_0xc358('0x1d')]);_0x386131[_0xc358('0x1b')]=qs[_0xc358('0x1b')](_0x5e4396['query'][_0xc358('0x1b')]);}return _0x352840[_0xc358('0x4d')](_0x386131);}})[_0xc358('0x23')](function(_0x1d8a23){if(_0x1d8a23){return _0x1d8a23?{'count':_0x21ac3b,'rows':_0x1d8a23}:null;}})['then'](respondWithResult(_0x11e30c,null))['catch'](handleError(_0x11e30c,null));};exports['getTags']=function(_0x2a0320,_0x21b3ad,_0x33d6d1){var _0x4203d9={};var _0x1aaa6b={};var _0x108945;var _0x1484f4;return db[_0xc358('0x2a')]['findOne']({'where':{'id':_0x2a0320[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x21b3ad,null))[_0xc358('0x23')](function(_0x1c5514){if(_0x1c5514){_0x108945=_0x1c5514;_0x1aaa6b['model']=_[_0xc358('0x2f')](db[_0xc358('0x4e')][_0xc358('0x2b')]);_0x1aaa6b['query']=_[_0xc358('0x2f')](_0x2a0320['query']);_0x1aaa6b[_0xc358('0x31')]=_[_0xc358('0x32')](_0x1aaa6b[_0xc358('0x2e')],_0x1aaa6b['query']);_0x4203d9[_0xc358('0x34')]=_[_0xc358('0x32')](_0x1aaa6b[_0xc358('0x2e')],qs['fields'](_0x2a0320[_0xc358('0x30')][_0xc358('0x33')]));_0x4203d9['attributes']=_0x4203d9[_0xc358('0x34')][_0xc358('0x45')]?_0x4203d9[_0xc358('0x34')]:_0x1aaa6b['model'];_0x4203d9[_0xc358('0x37')]=qs[_0xc358('0x38')](_0x2a0320[_0xc358('0x30')][_0xc358('0x38')]);_0x4203d9[_0xc358('0x3b')]=qs[_0xc358('0x31')](_[_0xc358('0x39')](_0x2a0320[_0xc358('0x30')],_0x1aaa6b[_0xc358('0x31')]));if(_0x2a0320[_0xc358('0x30')]['filter']){_0x4203d9[_0xc358('0x3b')]=_[_0xc358('0x3f')](_0x4203d9[_0xc358('0x3b')],{'$or':_['map'](_0x4203d9[_0xc358('0x34')],function(_0x150e1c){var _0x5b1447={};_0x5b1447[_0x150e1c]={'$like':'%'+_0x2a0320['query']['filter']+'%'};return _0x5b1447;})});}_0x4203d9=_[_0xc358('0x3f')]({},_0x4203d9,_0x2a0320[_0xc358('0x40')]);return _0x108945[_0xc358('0x4f')](_0x4203d9);}})['then'](function(_0x420c77){if(_0x420c77){_0x1484f4=_0x420c77['length'];if(!_0x2a0320[_0xc358('0x30')][_0xc358('0x35')](_0xc358('0x36'))){_0x4203d9['limit']=qs['limit'](_0x2a0320['query'][_0xc358('0x1d')]);_0x4203d9[_0xc358('0x1b')]=qs['offset'](_0x2a0320[_0xc358('0x30')]['offset']);}return _0x108945[_0xc358('0x4f')](_0x4203d9);}})['then'](function(_0x5447d6){if(_0x5447d6){return _0x5447d6?{'count':_0x1484f4,'rows':_0x5447d6}:null;}})[_0xc358('0x23')](respondWithResult(_0x21b3ad,null))[_0xc358('0x43')](handleError(_0x21b3ad,null));};exports['setTags']=function(_0x12ea38,_0x33f5f7,_0x3ae639){if(_0x12ea38[_0xc358('0x49')]['id']){delete _0x12ea38['body']['id'];}return db[_0xc358('0x2a')][_0xc358('0x4b')]({'where':{'id':_0x12ea38[_0xc358('0x44')]['id']}})[_0xc358('0x23')](handleEntityNotFound(_0x33f5f7,null))[_0xc358('0x23')](function(_0x1f49f7){if(_0x1f49f7){return _0x1f49f7['setTags'](_0x12ea38[_0xc358('0x49')][_0xc358('0x50')]||[]);}return null;})[_0xc358('0x23')](respondWithResult(_0x33f5f7,null))[_0xc358('0x43')](handleError(_0x33f5f7,null));}; \ No newline at end of file +var _0x85de=['fields','options','catch','create','body','find','getFields','findOne','getSubjects','ZendeskField','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','model','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','filter','where','ZendeskConfiguration','includeAll','include','show','params'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x85de,0x19e));var _0xe85d=function(_0x56f239,_0x4b8301){_0x56f239=_0x56f239-0x0;var _0x19bcdb=_0x85de[_0x56f239];return _0x19bcdb;};'use strict';var emlformat=require(_0xe85d('0x0'));var rimraf=require(_0xe85d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe85d('0x2'));var rp=require(_0xe85d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe85d('0x4'));var util=require(_0xe85d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe85d('0x6'));var ejs=require(_0xe85d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe85d('0x8'));var crypto=require(_0xe85d('0x9'));var jsforce=require(_0xe85d('0xa'));var deskjs=require(_0xe85d('0xb'));var toCsv=require(_0xe85d('0x6'));var querystring=require(_0xe85d('0xc'));var Papa=require('papaparse');var Redis=require(_0xe85d('0xd'));var authService=require(_0xe85d('0xe'));var qs=require(_0xe85d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x10'))('api');var utils=require(_0xe85d('0x11'));var config=require(_0xe85d('0x12'));var licenseUtil=require(_0xe85d('0x13'));var db=require(_0xe85d('0x14'))['db'];function respondWithStatusCode(_0x59f72a,_0x4c4fe5){_0x4c4fe5=_0x4c4fe5||0xcc;return function(_0x337858){if(_0x337858){return _0x59f72a[_0xe85d('0x15')](_0x4c4fe5);}return _0x59f72a[_0xe85d('0x16')](_0x4c4fe5)[_0xe85d('0x17')]();};}function respondWithResult(_0x48536a,_0x5c6e49){_0x5c6e49=_0x5c6e49||0xc8;return function(_0x92de8e){if(_0x92de8e){return _0x48536a[_0xe85d('0x16')](_0x5c6e49)[_0xe85d('0x18')](_0x92de8e);}};}function respondWithFilteredResult(_0x3e8328,_0x4fbf65){return function(_0x3a59cb){if(_0x3a59cb){var _0x596624=typeof _0x4fbf65[_0xe85d('0x19')]===_0xe85d('0x1a')&&typeof _0x4fbf65[_0xe85d('0x1b')]===_0xe85d('0x1a');var _0x5b51b0=_0x3a59cb[_0xe85d('0x1c')];var _0x57ad30=_0x596624?0x0:_0x4fbf65[_0xe85d('0x19')];var _0x28466d=_0x596624?_0x3a59cb[_0xe85d('0x1c')]:_0x4fbf65[_0xe85d('0x19')]+_0x4fbf65[_0xe85d('0x1b')];var _0x1ea217;if(_0x28466d>=_0x5b51b0){_0x28466d=_0x5b51b0;_0x1ea217=0xc8;}else{_0x1ea217=0xce;}_0x3e8328[_0xe85d('0x16')](_0x1ea217);return _0x3e8328[_0xe85d('0x1d')](_0xe85d('0x1e'),_0x57ad30+'-'+_0x28466d+'/'+_0x5b51b0)[_0xe85d('0x18')](_0x3a59cb);}return null;};}function patchUpdates(_0x13242c){return function(_0x55c5fe){try{jsonpatch['apply'](_0x55c5fe,_0x13242c,!![]);}catch(_0x293d31){return BPromise[_0xe85d('0x1f')](_0x293d31);}return _0x55c5fe[_0xe85d('0x20')]();};}function saveUpdates(_0x193322,_0x802ee0){return function(_0x154b0d){if(_0x154b0d){return _0x154b0d[_0xe85d('0x21')](_0x193322)[_0xe85d('0x22')](function(_0x29f781){return _0x29f781;});}return null;};}function removeEntity(_0x2ad21d,_0xb16cbc){return function(_0x1ecfb6){if(_0x1ecfb6){return _0x1ecfb6[_0xe85d('0x23')]()[_0xe85d('0x22')](function(){_0x2ad21d[_0xe85d('0x16')](0xcc)[_0xe85d('0x17')]();});}};}function handleEntityNotFound(_0x56a9ed,_0x32ddbf){return function(_0x27e226){if(!_0x27e226){_0x56a9ed['sendStatus'](0x194);}return _0x27e226;};}function handleError(_0xe71e4b,_0x340e98){_0x340e98=_0x340e98||0x1f4;return function(_0x3e01b6){logger[_0xe85d('0x24')](_0x3e01b6[_0xe85d('0x25')]);if(_0x3e01b6['name']){delete _0x3e01b6['name'];}_0xe71e4b[_0xe85d('0x16')](_0x340e98)[_0xe85d('0x26')](_0x3e01b6);};}exports[_0xe85d('0x27')]=function(_0x6bf8ac,_0x576f76){var _0x54d652={},_0x3ec929={},_0x39bf17={'count':0x0,'rows':[]};var _0x543d60=_[_0xe85d('0x28')](db['ZendeskConfiguration'][_0xe85d('0x29')],function(_0x387011){return{'name':_0x387011[_0xe85d('0x2a')],'type':_0x387011['type']['key']};});_0x3ec929[_0xe85d('0x2b')]=_[_0xe85d('0x28')](_0x543d60,_0xe85d('0x2c'));_0x3ec929[_0xe85d('0x2d')]=_[_0xe85d('0x2e')](_0x6bf8ac['query']);_0x3ec929[_0xe85d('0x2f')]=_['intersection'](_0x3ec929['model'],_0x3ec929[_0xe85d('0x2d')]);_0x54d652[_0xe85d('0x30')]=_[_0xe85d('0x31')](_0x3ec929[_0xe85d('0x2b')],qs['fields'](_0x6bf8ac['query']['fields']));_0x54d652['attributes']=_0x54d652[_0xe85d('0x30')][_0xe85d('0x32')]?_0x54d652[_0xe85d('0x30')]:_0x3ec929['model'];if(!_0x6bf8ac[_0xe85d('0x2d')][_0xe85d('0x33')](_0xe85d('0x34'))){_0x54d652[_0xe85d('0x1b')]=qs[_0xe85d('0x1b')](_0x6bf8ac[_0xe85d('0x2d')][_0xe85d('0x1b')]);_0x54d652[_0xe85d('0x19')]=qs[_0xe85d('0x19')](_0x6bf8ac[_0xe85d('0x2d')]['offset']);}_0x54d652[_0xe85d('0x35')]=qs[_0xe85d('0x36')](_0x6bf8ac[_0xe85d('0x2d')][_0xe85d('0x36')]);_0x54d652['where']=qs[_0xe85d('0x2f')](_[_0xe85d('0x37')](_0x6bf8ac[_0xe85d('0x2d')],_0x3ec929[_0xe85d('0x2f')]),_0x543d60);if(_0x6bf8ac[_0xe85d('0x2d')]['filter']){_0x54d652['where']=_[_0xe85d('0x38')](_0x54d652['where'],{'$or':_[_0xe85d('0x28')](_0x543d60,function(_0x35c584){if(_0x35c584[_0xe85d('0x39')]!==_0xe85d('0x3a')){var _0x3050ab={};_0x3050ab[_0x35c584[_0xe85d('0x2c')]]={'$like':'%'+_0x6bf8ac['query'][_0xe85d('0x3b')]+'%'};return _0x3050ab;}})});}_0x54d652=_[_0xe85d('0x38')]({},_0x54d652,_0x6bf8ac['options']);var _0xf28870={'where':_0x54d652[_0xe85d('0x3c')]};return db[_0xe85d('0x3d')][_0xe85d('0x1c')](_0xf28870)[_0xe85d('0x22')](function(_0x4c3fc7){_0x39bf17[_0xe85d('0x1c')]=_0x4c3fc7;if(_0x6bf8ac[_0xe85d('0x2d')][_0xe85d('0x3e')]){_0x54d652[_0xe85d('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x54d652);})['then'](function(_0x4fe359){_0x39bf17['rows']=_0x4fe359;return _0x39bf17;})['then'](respondWithFilteredResult(_0x576f76,_0x54d652))['catch'](handleError(_0x576f76,null));};exports[_0xe85d('0x40')]=function(_0x3e6a59,_0x2631cf){var _0x34e659={'raw':![],'where':{'id':_0x3e6a59[_0xe85d('0x41')]['id']}},_0x136932={};_0x136932[_0xe85d('0x2b')]=_[_0xe85d('0x2e')](db[_0xe85d('0x3d')][_0xe85d('0x29')]);_0x136932[_0xe85d('0x2d')]=_[_0xe85d('0x2e')](_0x3e6a59[_0xe85d('0x2d')]);_0x136932[_0xe85d('0x2f')]=_[_0xe85d('0x31')](_0x136932[_0xe85d('0x2b')],_0x136932[_0xe85d('0x2d')]);_0x34e659[_0xe85d('0x30')]=_['intersection'](_0x136932[_0xe85d('0x2b')],qs[_0xe85d('0x42')](_0x3e6a59[_0xe85d('0x2d')][_0xe85d('0x42')]));_0x34e659['attributes']=_0x34e659[_0xe85d('0x30')][_0xe85d('0x32')]?_0x34e659[_0xe85d('0x30')]:_0x136932[_0xe85d('0x2b')];if(_0x3e6a59[_0xe85d('0x2d')][_0xe85d('0x3e')]){_0x34e659['include']=[{'all':!![]}];}_0x34e659=_[_0xe85d('0x38')]({},_0x34e659,_0x3e6a59[_0xe85d('0x43')]);return db[_0xe85d('0x3d')]['find'](_0x34e659)[_0xe85d('0x22')](handleEntityNotFound(_0x2631cf,null))[_0xe85d('0x22')](respondWithResult(_0x2631cf,null))[_0xe85d('0x44')](handleError(_0x2631cf,null));};exports[_0xe85d('0x45')]=function(_0x2d37d5,_0x4eb165){return db['ZendeskConfiguration']['create'](_0x2d37d5[_0xe85d('0x46')],{})[_0xe85d('0x22')](respondWithResult(_0x4eb165,0xc9))[_0xe85d('0x44')](handleError(_0x4eb165,null));};exports[_0xe85d('0x21')]=function(_0x3fe51d,_0xb07847){if(_0x3fe51d[_0xe85d('0x46')]['id']){delete _0x3fe51d[_0xe85d('0x46')]['id'];}return db[_0xe85d('0x3d')][_0xe85d('0x47')]({'where':{'id':_0x3fe51d[_0xe85d('0x41')]['id']}})['then'](handleEntityNotFound(_0xb07847,null))[_0xe85d('0x22')](saveUpdates(_0x3fe51d[_0xe85d('0x46')],null))[_0xe85d('0x22')](respondWithResult(_0xb07847,null))[_0xe85d('0x44')](handleError(_0xb07847,null));};exports[_0xe85d('0x23')]=function(_0x1bb265,_0x31a31b){return db[_0xe85d('0x3d')][_0xe85d('0x47')]({'where':{'id':_0x1bb265[_0xe85d('0x41')]['id']}})[_0xe85d('0x22')](handleEntityNotFound(_0x31a31b,null))[_0xe85d('0x22')](removeEntity(_0x31a31b,null))[_0xe85d('0x44')](handleError(_0x31a31b,null));};exports[_0xe85d('0x48')]=function(_0x5b44a4,_0x5c0dc9,_0x159792){var _0x26b9d8={};var _0x5a6bcb={};var _0x4cc9ee;var _0x567082;return db[_0xe85d('0x3d')][_0xe85d('0x49')]({'where':{'id':_0x5b44a4['params']['id']}})[_0xe85d('0x22')](handleEntityNotFound(_0x5c0dc9,null))[_0xe85d('0x22')](function(_0x546606){if(_0x546606){_0x4cc9ee=_0x546606;_0x5a6bcb[_0xe85d('0x2b')]=_[_0xe85d('0x2e')](db['ZendeskField'][_0xe85d('0x29')]);_0x5a6bcb[_0xe85d('0x2d')]=_[_0xe85d('0x2e')](_0x5b44a4['query']);_0x5a6bcb[_0xe85d('0x2f')]=_[_0xe85d('0x31')](_0x5a6bcb[_0xe85d('0x2b')],_0x5a6bcb[_0xe85d('0x2d')]);_0x26b9d8['attributes']=_['intersection'](_0x5a6bcb[_0xe85d('0x2b')],qs[_0xe85d('0x42')](_0x5b44a4[_0xe85d('0x2d')]['fields']));_0x26b9d8[_0xe85d('0x30')]=_0x26b9d8[_0xe85d('0x30')][_0xe85d('0x32')]?_0x26b9d8[_0xe85d('0x30')]:_0x5a6bcb[_0xe85d('0x2b')];_0x26b9d8['order']=qs[_0xe85d('0x36')](_0x5b44a4[_0xe85d('0x2d')][_0xe85d('0x36')]);_0x26b9d8['where']=qs[_0xe85d('0x2f')](_[_0xe85d('0x37')](_0x5b44a4[_0xe85d('0x2d')],_0x5a6bcb[_0xe85d('0x2f')]));if(_0x5b44a4['query'][_0xe85d('0x3b')]){_0x26b9d8[_0xe85d('0x3c')]=_[_0xe85d('0x38')](_0x26b9d8[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x28')](_0x26b9d8['attributes'],function(_0x46106a){var _0x1e7fb2={};_0x1e7fb2[_0x46106a]={'$like':'%'+_0x5b44a4['query'][_0xe85d('0x3b')]+'%'};return _0x1e7fb2;})});}_0x26b9d8=_['merge']({},_0x26b9d8,_0x5b44a4[_0xe85d('0x43')]);return _0x4cc9ee[_0xe85d('0x48')](_0x26b9d8);}})[_0xe85d('0x22')](function(_0x12339a){if(_0x12339a){_0x567082=_0x12339a[_0xe85d('0x32')];if(!_0x5b44a4[_0xe85d('0x2d')][_0xe85d('0x33')](_0xe85d('0x34'))){_0x26b9d8['limit']=qs[_0xe85d('0x1b')](_0x5b44a4['query'][_0xe85d('0x1b')]);_0x26b9d8[_0xe85d('0x19')]=qs[_0xe85d('0x19')](_0x5b44a4[_0xe85d('0x2d')][_0xe85d('0x19')]);}return _0x4cc9ee['getFields'](_0x26b9d8);}})[_0xe85d('0x22')](function(_0x583c8a){if(_0x583c8a){return _0x583c8a?{'count':_0x567082,'rows':_0x583c8a}:null;}})[_0xe85d('0x22')](respondWithResult(_0x5c0dc9,null))[_0xe85d('0x44')](handleError(_0x5c0dc9,null));};exports[_0xe85d('0x4a')]=function(_0x4bed46,_0x484953,_0x93e364){var _0xc1190d={};var _0x3da604={};var _0x94a4a5;var _0x2a9d69;return db[_0xe85d('0x3d')][_0xe85d('0x49')]({'where':{'id':_0x4bed46[_0xe85d('0x41')]['id']}})['then'](handleEntityNotFound(_0x484953,null))['then'](function(_0x37b766){if(_0x37b766){_0x94a4a5=_0x37b766;_0x3da604['model']=_[_0xe85d('0x2e')](db[_0xe85d('0x4b')][_0xe85d('0x29')]);_0x3da604[_0xe85d('0x2d')]=_[_0xe85d('0x2e')](_0x4bed46[_0xe85d('0x2d')]);_0x3da604[_0xe85d('0x2f')]=_[_0xe85d('0x31')](_0x3da604['model'],_0x3da604[_0xe85d('0x2d')]);_0xc1190d[_0xe85d('0x30')]=_[_0xe85d('0x31')](_0x3da604[_0xe85d('0x2b')],qs[_0xe85d('0x42')](_0x4bed46[_0xe85d('0x2d')][_0xe85d('0x42')]));_0xc1190d[_0xe85d('0x30')]=_0xc1190d[_0xe85d('0x30')][_0xe85d('0x32')]?_0xc1190d[_0xe85d('0x30')]:_0x3da604['model'];_0xc1190d[_0xe85d('0x35')]=qs['sort'](_0x4bed46[_0xe85d('0x2d')][_0xe85d('0x36')]);_0xc1190d[_0xe85d('0x3c')]=qs['filters'](_[_0xe85d('0x37')](_0x4bed46[_0xe85d('0x2d')],_0x3da604[_0xe85d('0x2f')]));if(_0x4bed46['query']['filter']){_0xc1190d[_0xe85d('0x3c')]=_[_0xe85d('0x38')](_0xc1190d[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x28')](_0xc1190d[_0xe85d('0x30')],function(_0x2514e4){var _0x3e447a={};_0x3e447a[_0x2514e4]={'$like':'%'+_0x4bed46[_0xe85d('0x2d')][_0xe85d('0x3b')]+'%'};return _0x3e447a;})});}_0xc1190d=_[_0xe85d('0x38')]({},_0xc1190d,_0x4bed46[_0xe85d('0x43')]);return _0x94a4a5[_0xe85d('0x4a')](_0xc1190d);}})[_0xe85d('0x22')](function(_0x35edd0){if(_0x35edd0){_0x2a9d69=_0x35edd0[_0xe85d('0x32')];if(!_0x4bed46['query'][_0xe85d('0x33')](_0xe85d('0x34'))){_0xc1190d[_0xe85d('0x1b')]=qs['limit'](_0x4bed46['query']['limit']);_0xc1190d['offset']=qs['offset'](_0x4bed46[_0xe85d('0x2d')]['offset']);}return _0x94a4a5[_0xe85d('0x4a')](_0xc1190d);}})['then'](function(_0x4dd485){if(_0x4dd485){return _0x4dd485?{'count':_0x2a9d69,'rows':_0x4dd485}:null;}})[_0xe85d('0x22')](respondWithResult(_0x484953,null))[_0xe85d('0x44')](handleError(_0x484953,null));};exports['getDescriptions']=function(_0xdced0b,_0x3ce289,_0x17e0d9){var _0x41a7df={};var _0x338db1={};var _0x4208cd;var _0x2959a0;return db[_0xe85d('0x3d')][_0xe85d('0x49')]({'where':{'id':_0xdced0b[_0xe85d('0x41')]['id']}})[_0xe85d('0x22')](handleEntityNotFound(_0x3ce289,null))[_0xe85d('0x22')](function(_0x1807c9){if(_0x1807c9){_0x4208cd=_0x1807c9;_0x338db1[_0xe85d('0x2b')]=_[_0xe85d('0x2e')](db[_0xe85d('0x4b')]['rawAttributes']);_0x338db1[_0xe85d('0x2d')]=_['keys'](_0xdced0b[_0xe85d('0x2d')]);_0x338db1['filters']=_[_0xe85d('0x31')](_0x338db1[_0xe85d('0x2b')],_0x338db1[_0xe85d('0x2d')]);_0x41a7df['attributes']=_[_0xe85d('0x31')](_0x338db1[_0xe85d('0x2b')],qs[_0xe85d('0x42')](_0xdced0b[_0xe85d('0x2d')][_0xe85d('0x42')]));_0x41a7df[_0xe85d('0x30')]=_0x41a7df['attributes'][_0xe85d('0x32')]?_0x41a7df[_0xe85d('0x30')]:_0x338db1['model'];_0x41a7df[_0xe85d('0x35')]=qs[_0xe85d('0x36')](_0xdced0b['query'][_0xe85d('0x36')]);_0x41a7df['where']=qs[_0xe85d('0x2f')](_['pick'](_0xdced0b[_0xe85d('0x2d')],_0x338db1[_0xe85d('0x2f')]));if(_0xdced0b[_0xe85d('0x2d')][_0xe85d('0x3b')]){_0x41a7df['where']=_['merge'](_0x41a7df[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x28')](_0x41a7df[_0xe85d('0x30')],function(_0x3900df){var _0x328de0={};_0x328de0[_0x3900df]={'$like':'%'+_0xdced0b[_0xe85d('0x2d')]['filter']+'%'};return _0x328de0;})});}_0x41a7df=_[_0xe85d('0x38')]({},_0x41a7df,_0xdced0b[_0xe85d('0x43')]);return _0x4208cd['getDescriptions'](_0x41a7df);}})[_0xe85d('0x22')](function(_0x506654){if(_0x506654){_0x2959a0=_0x506654[_0xe85d('0x32')];if(!_0xdced0b[_0xe85d('0x2d')][_0xe85d('0x33')]('nolimit')){_0x41a7df[_0xe85d('0x1b')]=qs['limit'](_0xdced0b[_0xe85d('0x2d')]['limit']);_0x41a7df['offset']=qs['offset'](_0xdced0b[_0xe85d('0x2d')]['offset']);}return _0x4208cd['getDescriptions'](_0x41a7df);}})[_0xe85d('0x22')](function(_0x393ab5){if(_0x393ab5){return _0x393ab5?{'count':_0x2959a0,'rows':_0x393ab5}:null;}})[_0xe85d('0x22')](respondWithResult(_0x3ce289,null))[_0xe85d('0x44')](handleError(_0x3ce289,null));};exports['getTags']=function(_0x219a12,_0x596ea2,_0x1d6026){var _0x2dfe71={};var _0x16dd07={};var _0x78295d;var _0x31ef7b;return db[_0xe85d('0x3d')][_0xe85d('0x49')]({'where':{'id':_0x219a12[_0xe85d('0x41')]['id']}})[_0xe85d('0x22')](handleEntityNotFound(_0x596ea2,null))[_0xe85d('0x22')](function(_0x51b90d){if(_0x51b90d){_0x78295d=_0x51b90d;_0x16dd07[_0xe85d('0x2b')]=_[_0xe85d('0x2e')](db[_0xe85d('0x4c')][_0xe85d('0x29')]);_0x16dd07[_0xe85d('0x2d')]=_['keys'](_0x219a12[_0xe85d('0x2d')]);_0x16dd07[_0xe85d('0x2f')]=_['intersection'](_0x16dd07['model'],_0x16dd07[_0xe85d('0x2d')]);_0x2dfe71[_0xe85d('0x30')]=_[_0xe85d('0x31')](_0x16dd07['model'],qs[_0xe85d('0x42')](_0x219a12[_0xe85d('0x2d')][_0xe85d('0x42')]));_0x2dfe71['attributes']=_0x2dfe71[_0xe85d('0x30')][_0xe85d('0x32')]?_0x2dfe71[_0xe85d('0x30')]:_0x16dd07[_0xe85d('0x2b')];_0x2dfe71[_0xe85d('0x35')]=qs['sort'](_0x219a12['query'][_0xe85d('0x36')]);_0x2dfe71['where']=qs['filters'](_[_0xe85d('0x37')](_0x219a12[_0xe85d('0x2d')],_0x16dd07[_0xe85d('0x2f')]));if(_0x219a12[_0xe85d('0x2d')]['filter']){_0x2dfe71[_0xe85d('0x3c')]=_['merge'](_0x2dfe71[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x28')](_0x2dfe71[_0xe85d('0x30')],function(_0x3cc544){var _0x12b60d={};_0x12b60d[_0x3cc544]={'$like':'%'+_0x219a12[_0xe85d('0x2d')][_0xe85d('0x3b')]+'%'};return _0x12b60d;})});}_0x2dfe71=_[_0xe85d('0x38')]({},_0x2dfe71,_0x219a12['options']);return _0x78295d['getTags'](_0x2dfe71);}})[_0xe85d('0x22')](function(_0x554514){if(_0x554514){_0x31ef7b=_0x554514[_0xe85d('0x32')];if(!_0x219a12[_0xe85d('0x2d')]['hasOwnProperty']('nolimit')){_0x2dfe71[_0xe85d('0x1b')]=qs['limit'](_0x219a12[_0xe85d('0x2d')][_0xe85d('0x1b')]);_0x2dfe71[_0xe85d('0x19')]=qs['offset'](_0x219a12[_0xe85d('0x2d')][_0xe85d('0x19')]);}return _0x78295d[_0xe85d('0x4d')](_0x2dfe71);}})[_0xe85d('0x22')](function(_0x2b0117){if(_0x2b0117){return _0x2b0117?{'count':_0x31ef7b,'rows':_0x2b0117}:null;}})[_0xe85d('0x22')](respondWithResult(_0x596ea2,null))[_0xe85d('0x44')](handleError(_0x596ea2,null));};exports[_0xe85d('0x4e')]=function(_0xf12dc,_0x44b6ed,_0x4dee7c){if(_0xf12dc[_0xe85d('0x46')]['id']){delete _0xf12dc[_0xe85d('0x46')]['id'];}return db['ZendeskConfiguration'][_0xe85d('0x49')]({'where':{'id':_0xf12dc[_0xe85d('0x41')]['id']}})[_0xe85d('0x22')](handleEntityNotFound(_0x44b6ed,null))['then'](function(_0x17b6a4){if(_0x17b6a4){return _0x17b6a4[_0xe85d('0x4e')](_0xf12dc[_0xe85d('0x46')][_0xe85d('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x44b6ed,null))['catch'](handleError(_0x44b6ed,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cdc3574..fab078d 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 _0x0b0e=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xb5972a,_0xdd734d){var _0x3a5f0c=function(_0x3d79df){while(--_0x3d79df){_0xb5972a['push'](_0xb5972a['shift']());}};_0x3a5f0c(++_0xdd734d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0x0b0e[_0xfe26da];return _0x2abe6e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xab40,0xcd));var _0x0ab4=function(_0x57d956,_0xb4e5c0){_0x57d956=_0x57d956-0x0;var _0x7a1ac2=_0xab40[_0x57d956];return _0x7a1ac2;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'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 0d5d759..9beba69 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 _0xeb44=['rpc','jayson/promise','http','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34586d,_0x4b88cd){var _0xa8620c=function(_0x3ba342){while(--_0x3ba342){_0x34586d['push'](_0x34586d['shift']());}};_0xa8620c(++_0x4b88cd);}(_0xeb44,0x8c));var _0x4eb4=function(_0xeeab72,_0x461e98){_0xeeab72=_0xeeab72-0x0;var _0x3c20ab=_0xeb44[_0xeeab72];return _0x3c20ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4eb4('0x0'));var BPromise=require(_0x4eb4('0x1'));var rs=require(_0x4eb4('0x2'));var fs=require('fs');var Redis=require(_0x4eb4('0x3'));var db=require(_0x4eb4('0x4'))['db'];var utils=require(_0x4eb4('0x5'));var logger=require(_0x4eb4('0x6'))(_0x4eb4('0x7'));var config=require('../../config/environment');var jayson=require(_0x4eb4('0x8'));var client=jayson['client'][_0x4eb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e2937,_0xe15d92,_0x4571ba){return new BPromise(function(_0x2e6c87,_0x3c9d21){return client['request'](_0x7e2937,_0x4571ba)['then'](function(_0x2681b4){logger[_0x4eb4('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe15d92,_0x4eb4('0xb'));logger[_0x4eb4('0xc')](_0x4eb4('0xd'),_0xe15d92,'request\x20sent',JSON[_0x4eb4('0xe')](_0x2681b4));if(_0x2681b4['error']){if(_0x2681b4[_0x4eb4('0xf')][_0x4eb4('0x10')]===0x1f4){logger[_0x4eb4('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe15d92,_0x2681b4[_0x4eb4('0xf')][_0x4eb4('0x11')]);return _0x3c9d21(_0x2681b4['error']['message']);}logger[_0x4eb4('0xf')](_0x4eb4('0x12'),_0xe15d92,_0x2681b4[_0x4eb4('0xf')]['message']);return _0x2e6c87(_0x2681b4[_0x4eb4('0xf')]['message']);}else{logger[_0x4eb4('0xa')](_0x4eb4('0x12'),_0xe15d92,_0x4eb4('0xb'));_0x2e6c87(_0x2681b4[_0x4eb4('0x13')][_0x4eb4('0x11')]);}})[_0x4eb4('0x14')](function(_0x396bbd){logger['error'](_0x4eb4('0x12'),_0xe15d92,_0x396bbd);_0x3c9d21(_0x396bbd);});});} \ No newline at end of file +var _0x896c=['message','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x74640a,_0xbff408){var _0xe729f9=function(_0x1bb99a){while(--_0x1bb99a){_0x74640a['push'](_0x74640a['shift']());}};_0xe729f9(++_0xbff408);}(_0x896c,0x1e8));var _0xc896=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x896c[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0xc896('0x0'));var moment=require('moment');var BPromise=require(_0xc896('0x1'));var rs=require(_0xc896('0x2'));var fs=require('fs');var Redis=require(_0xc896('0x3'));var db=require(_0xc896('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc896('0x5'))('rpc');var config=require(_0xc896('0x6'));var jayson=require(_0xc896('0x7'));var client=jayson[_0xc896('0x8')][_0xc896('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x257b3d,_0x41f904,_0xa4af6e){return new BPromise(function(_0xdece03,_0x232770){return client['request'](_0x257b3d,_0xa4af6e)[_0xc896('0xa')](function(_0x2f40ea){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x41f904,_0xc896('0xb'));logger[_0xc896('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x41f904,_0xc896('0xb'),JSON[_0xc896('0xd')](_0x2f40ea));if(_0x2f40ea[_0xc896('0xe')]){if(_0x2f40ea[_0xc896('0xe')]['code']===0x1f4){logger['error'](_0xc896('0xf'),_0x41f904,_0x2f40ea['error']['message']);return _0x232770(_0x2f40ea[_0xc896('0xe')][_0xc896('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x41f904,_0x2f40ea[_0xc896('0xe')][_0xc896('0x10')]);return _0xdece03(_0x2f40ea['error'][_0xc896('0x10')]);}else{logger[_0xc896('0x11')](_0xc896('0xf'),_0x41f904,'request\x20sent');_0xdece03(_0x2f40ea['result'][_0xc896('0x10')]);}})['catch'](function(_0x759563){logger['error'](_0xc896('0xf'),_0x41f904,_0x759563);_0x232770(_0x759563);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 881458f..8ec6102 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 _0x969a=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','show','post','create','put','isAuthenticated'];(function(_0x27236e,_0x5319f2){var _0x3dbc69=function(_0x289d52){while(--_0x289d52){_0x27236e['push'](_0x27236e['shift']());}};_0x3dbc69(++_0x5319f2);}(_0x969a,0xd6));var _0xa969=function(_0x4397a3,_0x2b0013){_0x4397a3=_0x4397a3-0x0;var _0x58729e=_0x969a[_0x4397a3];return _0x58729e;};'use strict';var multer=require(_0xa969('0x0'));var util=require('util');var path=require(_0xa969('0x1'));var timeout=require(_0xa969('0x2'));var express=require(_0xa969('0x3'));var router=express[_0xa969('0x4')]();var fs_extra=require(_0xa969('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa969('0x6'));var config=require(_0xa969('0x7'));var controller=require(_0xa969('0x8'));router[_0xa969('0x9')]('/',auth['isAuthenticated'](),controller[_0xa969('0xa')]);router[_0xa969('0x9')](_0xa969('0xb'),auth['isAuthenticated'](),controller[_0xa969('0xc')]);router[_0xa969('0xd')]('/',auth['isAuthenticated'](),controller[_0xa969('0xe')]);router[_0xa969('0xf')]('/:id',auth[_0xa969('0x10')](),controller[_0xa969('0x11')]);router[_0xa969('0x12')](_0xa969('0xb'),auth[_0xa969('0x10')](),controller[_0xa969('0x13')]);module[_0xa969('0x14')]=router; \ No newline at end of file +var _0x2be7=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','post','create','put','/:id','destroy'];(function(_0x1ac7f3,_0x3c5e1d){var _0x548a85=function(_0x22259c){while(--_0x22259c){_0x1ac7f3['push'](_0x1ac7f3['shift']());}};_0x548a85(++_0x3c5e1d);}(_0x2be7,0x133));var _0x72be=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0x2be7[_0x563af1];return _0x58fccb;};'use strict';var multer=require(_0x72be('0x0'));var util=require(_0x72be('0x1'));var path=require(_0x72be('0x2'));var timeout=require(_0x72be('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x72be('0x4'));var auth=require(_0x72be('0x5'));var interaction=require(_0x72be('0x6'));var config=require(_0x72be('0x7'));var controller=require(_0x72be('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x72be('0x9')]('/:id',auth[_0x72be('0xa')](),controller[_0x72be('0xb')]);router[_0x72be('0xc')]('/',auth[_0x72be('0xa')](),controller[_0x72be('0xd')]);router[_0x72be('0xe')]('/:id',auth[_0x72be('0xa')](),controller['update']);router['delete'](_0x72be('0xf'),auth[_0x72be('0xa')](),controller[_0x72be('0x10')]);module[_0x72be('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 125e085..10cd482 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 _0x6abf=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x1406a2,_0x44b969){var _0x1fa385=function(_0x504fc4){while(--_0x504fc4){_0x1406a2['push'](_0x1406a2['shift']());}};_0x1fa385(++_0x44b969);}(_0x6abf,0xd5));var _0xf6ab=function(_0x53357f,_0x1c1616){_0x53357f=_0x53357f-0x0;var _0x51cd30=_0x6abf[_0x53357f];return _0x51cd30;};'use strict';var Sequelize=require(_0xf6ab('0x0'));module[_0xf6ab('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf6ab('0x2'),_0xf6ab('0x3'),_0xf6ab('0x4'),_0xf6ab('0x5'),'picklist'),'defaultValue':_0xf6ab('0x2')},'content':{'type':Sequelize[_0xf6ab('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf6ab('0x7')](_0xf6ab('0x2'),_0xf6ab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf6ab('0x6')]},'idField':{'type':Sequelize[_0xf6ab('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6ab('0x6')]}}; \ No newline at end of file +var _0xc677=['variable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x16ac25,_0x319ff2){var _0x3ebf0b=function(_0xa976dd){while(--_0xa976dd){_0x16ac25['push'](_0x16ac25['shift']());}};_0x3ebf0b(++_0x319ff2);}(_0xc677,0x180));var _0x7c67=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc677[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x7c67('0x0'));module[_0x7c67('0x1')]={'type':{'type':Sequelize[_0x7c67('0x2')]('string',_0x7c67('0x3'),'customVariable',_0x7c67('0x4'),_0x7c67('0x5')),'defaultValue':_0x7c67('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7c67('0x2')](_0x7c67('0x6'),_0x7c67('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7c67('0x7')]},'customField':{'type':Sequelize[_0x7c67('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c67('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 4212148..746c3da 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 _0xd68a=['fast-json-patch','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','save','update','then','destroy','stack','name','index','map','ZendeskField','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x5529fa,_0x1030a3){var _0x3f7313=function(_0x516862){while(--_0x516862){_0x5529fa['push'](_0x5529fa['shift']());}};_0x3f7313(++_0x1030a3);}(_0xd68a,0xc6));var _0xad68=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd68a[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xad68('0x0'));var rimraf=require(_0xad68('0x1'));var zipdir=require(_0xad68('0x2'));var jsonpatch=require(_0xad68('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad68('0x4'));var Mustache=require(_0xad68('0x5'));var util=require(_0xad68('0x6'));var path=require(_0xad68('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad68('0x9'));var crypto=require(_0xad68('0xa'));var jsforce=require(_0xad68('0xb'));var deskjs=require(_0xad68('0xc'));var toCsv=require(_0xad68('0xd'));var querystring=require(_0xad68('0xe'));var Papa=require(_0xad68('0xf'));var Redis=require(_0xad68('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xad68('0x11'));var as=require(_0xad68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xad68('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xad68('0x14'))['db'];function respondWithStatusCode(_0x285f5a,_0x4aba2f){_0x4aba2f=_0x4aba2f||0xcc;return function(_0x2181ea){if(_0x2181ea){return _0x285f5a[_0xad68('0x15')](_0x4aba2f);}return _0x285f5a[_0xad68('0x16')](_0x4aba2f)[_0xad68('0x17')]();};}function respondWithResult(_0x4d96c6,_0x494329){_0x494329=_0x494329||0xc8;return function(_0x37f9ec){if(_0x37f9ec){return _0x4d96c6[_0xad68('0x16')](_0x494329)['json'](_0x37f9ec);}};}function respondWithFilteredResult(_0x4c5ae2,_0x50da04){return function(_0x2c3649){if(_0x2c3649){var _0x5286cc=typeof _0x50da04[_0xad68('0x18')]===_0xad68('0x19')&&typeof _0x50da04[_0xad68('0x1a')]===_0xad68('0x19');var _0x6f57b4=_0x2c3649['count'];var _0x545714=_0x5286cc?0x0:_0x50da04[_0xad68('0x18')];var _0x3b36cd=_0x5286cc?_0x2c3649['count']:_0x50da04[_0xad68('0x18')]+_0x50da04['limit'];var _0x318f;if(_0x3b36cd>=_0x6f57b4){_0x3b36cd=_0x6f57b4;_0x318f=0xc8;}else{_0x318f=0xce;}_0x4c5ae2['status'](_0x318f);return _0x4c5ae2['set'](_0xad68('0x1b'),_0x545714+'-'+_0x3b36cd+'/'+_0x6f57b4)['json'](_0x2c3649);}return null;};}function patchUpdates(_0x463d40){return function(_0x1b2e02){try{jsonpatch['apply'](_0x1b2e02,_0x463d40,!![]);}catch(_0x2d4347){return BPromise['reject'](_0x2d4347);}return _0x1b2e02[_0xad68('0x1c')]();};}function saveUpdates(_0xe11425,_0x6ed158){return function(_0x2cab79){if(_0x2cab79){return _0x2cab79[_0xad68('0x1d')](_0xe11425)[_0xad68('0x1e')](function(_0xe09090){return _0xe09090;});}return null;};}function removeEntity(_0x4f5c50,_0x311555){return function(_0x3acc86){if(_0x3acc86){return _0x3acc86[_0xad68('0x1f')]()['then'](function(){_0x4f5c50[_0xad68('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469dd5,_0x2fada1){return function(_0x415eed){if(!_0x415eed){_0x469dd5['sendStatus'](0x194);}return _0x415eed;};}function handleError(_0x2c526c,_0x585ae1){_0x585ae1=_0x585ae1||0x1f4;return function(_0x4d1cec){logger['error'](_0x4d1cec[_0xad68('0x20')]);if(_0x4d1cec[_0xad68('0x21')]){delete _0x4d1cec[_0xad68('0x21')];}_0x2c526c[_0xad68('0x16')](_0x585ae1)['send'](_0x4d1cec);};}exports[_0xad68('0x22')]=function(_0x267f34,_0x7e8344){var _0x4aa051={},_0x404f81={},_0x4c0d2f={'count':0x0,'rows':[]};var _0x4e6867=_[_0xad68('0x23')](db[_0xad68('0x24')]['rawAttributes'],function(_0x6fb025){return{'name':_0x6fb025[_0xad68('0x25')],'type':_0x6fb025[_0xad68('0x26')]['key']};});_0x404f81['model']=_[_0xad68('0x23')](_0x4e6867,_0xad68('0x21'));_0x404f81[_0xad68('0x27')]=_[_0xad68('0x28')](_0x267f34['query']);_0x404f81[_0xad68('0x29')]=_[_0xad68('0x2a')](_0x404f81['model'],_0x404f81[_0xad68('0x27')]);_0x4aa051['attributes']=_[_0xad68('0x2a')](_0x404f81[_0xad68('0x2b')],qs['fields'](_0x267f34['query']['fields']));_0x4aa051[_0xad68('0x2c')]=_0x4aa051[_0xad68('0x2c')][_0xad68('0x2d')]?_0x4aa051[_0xad68('0x2c')]:_0x404f81[_0xad68('0x2b')];if(!_0x267f34[_0xad68('0x27')][_0xad68('0x2e')](_0xad68('0x2f'))){_0x4aa051['limit']=qs[_0xad68('0x1a')](_0x267f34[_0xad68('0x27')][_0xad68('0x1a')]);_0x4aa051[_0xad68('0x18')]=qs['offset'](_0x267f34[_0xad68('0x27')][_0xad68('0x18')]);}_0x4aa051['order']=qs['sort'](_0x267f34[_0xad68('0x27')][_0xad68('0x30')]);_0x4aa051['where']=qs[_0xad68('0x29')](_[_0xad68('0x31')](_0x267f34[_0xad68('0x27')],_0x404f81[_0xad68('0x29')]),_0x4e6867);if(_0x267f34['query'][_0xad68('0x32')]){_0x4aa051['where']=_[_0xad68('0x33')](_0x4aa051[_0xad68('0x34')],{'$or':_[_0xad68('0x23')](_0x4e6867,function(_0x1d2dec){if(_0x1d2dec[_0xad68('0x26')]!==_0xad68('0x35')){var _0x6e55d0={};_0x6e55d0[_0x1d2dec['name']]={'$like':'%'+_0x267f34['query']['filter']+'%'};return _0x6e55d0;}})});}_0x4aa051=_[_0xad68('0x33')]({},_0x4aa051,_0x267f34[_0xad68('0x36')]);var _0x3a7c3f={'where':_0x4aa051[_0xad68('0x34')]};return db[_0xad68('0x24')][_0xad68('0x37')](_0x3a7c3f)[_0xad68('0x1e')](function(_0x50d082){_0x4c0d2f[_0xad68('0x37')]=_0x50d082;if(_0x267f34['query'][_0xad68('0x38')]){_0x4aa051['include']=[{'all':!![]}];}return db[_0xad68('0x24')]['findAll'](_0x4aa051);})[_0xad68('0x1e')](function(_0x1405a0){_0x4c0d2f[_0xad68('0x39')]=_0x1405a0;return _0x4c0d2f;})['then'](respondWithFilteredResult(_0x7e8344,_0x4aa051))[_0xad68('0x3a')](handleError(_0x7e8344,null));};exports[_0xad68('0x3b')]=function(_0x5044d0,_0x960b21){var _0x2d1edb={'raw':!![],'where':{'id':_0x5044d0[_0xad68('0x3c')]['id']}},_0x460524={};_0x460524[_0xad68('0x2b')]=_[_0xad68('0x28')](db[_0xad68('0x24')][_0xad68('0x3d')]);_0x460524[_0xad68('0x27')]=_['keys'](_0x5044d0[_0xad68('0x27')]);_0x460524[_0xad68('0x29')]=_[_0xad68('0x2a')](_0x460524[_0xad68('0x2b')],_0x460524[_0xad68('0x27')]);_0x2d1edb[_0xad68('0x2c')]=_[_0xad68('0x2a')](_0x460524['model'],qs['fields'](_0x5044d0[_0xad68('0x27')][_0xad68('0x3e')]));_0x2d1edb[_0xad68('0x2c')]=_0x2d1edb[_0xad68('0x2c')]['length']?_0x2d1edb[_0xad68('0x2c')]:_0x460524[_0xad68('0x2b')];if(_0x5044d0[_0xad68('0x27')]['includeAll']){_0x2d1edb[_0xad68('0x3f')]=[{'all':!![]}];}_0x2d1edb=_[_0xad68('0x33')]({},_0x2d1edb,_0x5044d0[_0xad68('0x36')]);return db['ZendeskField'][_0xad68('0x40')](_0x2d1edb)[_0xad68('0x1e')](handleEntityNotFound(_0x960b21,null))[_0xad68('0x1e')](respondWithResult(_0x960b21,null))['catch'](handleError(_0x960b21,null));};exports['create']=function(_0x1fa9e9,_0x42c6d3){return db[_0xad68('0x24')][_0xad68('0x41')](_0x1fa9e9[_0xad68('0x42')],{})[_0xad68('0x1e')](respondWithResult(_0x42c6d3,0xc9))['catch'](handleError(_0x42c6d3,null));};exports[_0xad68('0x1d')]=function(_0x29dcfc,_0x4c2901){if(_0x29dcfc[_0xad68('0x42')]['id']){delete _0x29dcfc['body']['id'];}return db[_0xad68('0x24')][_0xad68('0x40')]({'where':{'id':_0x29dcfc['params']['id']}})['then'](handleEntityNotFound(_0x4c2901,null))['then'](saveUpdates(_0x29dcfc[_0xad68('0x42')],null))[_0xad68('0x1e')](respondWithResult(_0x4c2901,null))[_0xad68('0x3a')](handleError(_0x4c2901,null));};exports[_0xad68('0x1f')]=function(_0x201cae,_0x21cafc){return db[_0xad68('0x24')][_0xad68('0x40')]({'where':{'id':_0x201cae[_0xad68('0x3c')]['id']}})[_0xad68('0x1e')](handleEntityNotFound(_0x21cafc,null))['then'](removeEntity(_0x21cafc,null))[_0xad68('0x3a')](handleError(_0x21cafc,null));}; \ No newline at end of file +var _0xf963=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','map','ZendeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0xf1ceb4,_0x3443e6){var _0x42ed45=function(_0x9ec7fa){while(--_0x9ec7fa){_0xf1ceb4['push'](_0xf1ceb4['shift']());}};_0x42ed45(++_0x3443e6);}(_0xf963,0x161));var _0x3f96=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf963[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f96('0x0'));var zipdir=require(_0x3f96('0x1'));var jsonpatch=require(_0x3f96('0x2'));var rp=require(_0x3f96('0x3'));var moment=require(_0x3f96('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f96('0x5'));var util=require(_0x3f96('0x6'));var path=require(_0x3f96('0x7'));var sox=require(_0x3f96('0x8'));var csv=require('to-csv');var ejs=require(_0x3f96('0x9'));var fs=require('fs');var fs_extra=require(_0x3f96('0xa'));var _=require(_0x3f96('0xb'));var squel=require(_0x3f96('0xc'));var crypto=require(_0x3f96('0xd'));var jsforce=require(_0x3f96('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f96('0xf'));var querystring=require(_0x3f96('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f96('0x11'));var authService=require(_0x3f96('0x12'));var qs=require(_0x3f96('0x13'));var as=require(_0x3f96('0x14'));var hardwareService=require(_0x3f96('0x15'));var logger=require(_0x3f96('0x16'))(_0x3f96('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f96('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ce562,_0x173244){_0x173244=_0x173244||0xcc;return function(_0xe9432){if(_0xe9432){return _0x1ce562['sendStatus'](_0x173244);}return _0x1ce562[_0x3f96('0x19')](_0x173244)[_0x3f96('0x1a')]();};}function respondWithResult(_0x19c801,_0x59bde4){_0x59bde4=_0x59bde4||0xc8;return function(_0x49863b){if(_0x49863b){return _0x19c801[_0x3f96('0x19')](_0x59bde4)[_0x3f96('0x1b')](_0x49863b);}};}function respondWithFilteredResult(_0x304e7b,_0x3c4105){return function(_0x43fce1){if(_0x43fce1){var _0x500fe2=typeof _0x3c4105['offset']==='undefined'&&typeof _0x3c4105[_0x3f96('0x1c')]===_0x3f96('0x1d');var _0x26834e=_0x43fce1['count'];var _0x3a9e97=_0x500fe2?0x0:_0x3c4105['offset'];var _0xf34d45=_0x500fe2?_0x43fce1[_0x3f96('0x1e')]:_0x3c4105['offset']+_0x3c4105[_0x3f96('0x1c')];var _0x223cdf;if(_0xf34d45>=_0x26834e){_0xf34d45=_0x26834e;_0x223cdf=0xc8;}else{_0x223cdf=0xce;}_0x304e7b['status'](_0x223cdf);return _0x304e7b['set'](_0x3f96('0x1f'),_0x3a9e97+'-'+_0xf34d45+'/'+_0x26834e)[_0x3f96('0x1b')](_0x43fce1);}return null;};}function patchUpdates(_0x2bb330){return function(_0x24e915){try{jsonpatch[_0x3f96('0x20')](_0x24e915,_0x2bb330,!![]);}catch(_0x26fdf0){return BPromise[_0x3f96('0x21')](_0x26fdf0);}return _0x24e915[_0x3f96('0x22')]();};}function saveUpdates(_0x5892fa,_0x3cd94e){return function(_0x1d17b2){if(_0x1d17b2){return _0x1d17b2['update'](_0x5892fa)['then'](function(_0x1e4715){return _0x1e4715;});}return null;};}function removeEntity(_0x554cce,_0x5a6362){return function(_0x422d80){if(_0x422d80){return _0x422d80[_0x3f96('0x23')]()[_0x3f96('0x24')](function(){_0x554cce[_0x3f96('0x19')](0xcc)[_0x3f96('0x1a')]();});}};}function handleEntityNotFound(_0x547266,_0xd48a35){return function(_0x495503){if(!_0x495503){_0x547266[_0x3f96('0x25')](0x194);}return _0x495503;};}function handleError(_0x54133f,_0x8a6231){_0x8a6231=_0x8a6231||0x1f4;return function(_0x350801){logger[_0x3f96('0x26')](_0x350801[_0x3f96('0x27')]);if(_0x350801[_0x3f96('0x28')]){delete _0x350801[_0x3f96('0x28')];}_0x54133f[_0x3f96('0x19')](_0x8a6231)['send'](_0x350801);};}exports['index']=function(_0x1da33b,_0x2c0c38){var _0x2cf510={},_0x2f0d55={},_0x224bf6={'count':0x0,'rows':[]};var _0x27864a=_[_0x3f96('0x29')](db[_0x3f96('0x2a')][_0x3f96('0x2b')],function(_0x4515a8){return{'name':_0x4515a8['fieldName'],'type':_0x4515a8[_0x3f96('0x2c')][_0x3f96('0x2d')]};});_0x2f0d55[_0x3f96('0x2e')]=_['map'](_0x27864a,_0x3f96('0x28'));_0x2f0d55[_0x3f96('0x2f')]=_['keys'](_0x1da33b[_0x3f96('0x2f')]);_0x2f0d55[_0x3f96('0x30')]=_[_0x3f96('0x31')](_0x2f0d55[_0x3f96('0x2e')],_0x2f0d55[_0x3f96('0x2f')]);_0x2cf510[_0x3f96('0x32')]=_[_0x3f96('0x31')](_0x2f0d55[_0x3f96('0x2e')],qs[_0x3f96('0x33')](_0x1da33b[_0x3f96('0x2f')]['fields']));_0x2cf510['attributes']=_0x2cf510[_0x3f96('0x32')][_0x3f96('0x34')]?_0x2cf510[_0x3f96('0x32')]:_0x2f0d55[_0x3f96('0x2e')];if(!_0x1da33b['query']['hasOwnProperty']('nolimit')){_0x2cf510[_0x3f96('0x1c')]=qs[_0x3f96('0x1c')](_0x1da33b[_0x3f96('0x2f')][_0x3f96('0x1c')]);_0x2cf510['offset']=qs[_0x3f96('0x35')](_0x1da33b['query'][_0x3f96('0x35')]);}_0x2cf510[_0x3f96('0x36')]=qs[_0x3f96('0x37')](_0x1da33b[_0x3f96('0x2f')][_0x3f96('0x37')]);_0x2cf510[_0x3f96('0x38')]=qs[_0x3f96('0x30')](_[_0x3f96('0x39')](_0x1da33b[_0x3f96('0x2f')],_0x2f0d55[_0x3f96('0x30')]),_0x27864a);if(_0x1da33b['query'][_0x3f96('0x3a')]){_0x2cf510['where']=_[_0x3f96('0x3b')](_0x2cf510[_0x3f96('0x38')],{'$or':_[_0x3f96('0x29')](_0x27864a,function(_0xd15e6b){if(_0xd15e6b[_0x3f96('0x2c')]!==_0x3f96('0x3c')){var _0x2e480e={};_0x2e480e[_0xd15e6b[_0x3f96('0x28')]]={'$like':'%'+_0x1da33b[_0x3f96('0x2f')][_0x3f96('0x3a')]+'%'};return _0x2e480e;}})});}_0x2cf510=_['merge']({},_0x2cf510,_0x1da33b[_0x3f96('0x3d')]);var _0xc9f34f={'where':_0x2cf510[_0x3f96('0x38')]};return db[_0x3f96('0x2a')][_0x3f96('0x1e')](_0xc9f34f)['then'](function(_0x4c7971){_0x224bf6[_0x3f96('0x1e')]=_0x4c7971;if(_0x1da33b[_0x3f96('0x2f')]['includeAll']){_0x2cf510[_0x3f96('0x3e')]=[{'all':!![]}];}return db[_0x3f96('0x2a')][_0x3f96('0x3f')](_0x2cf510);})[_0x3f96('0x24')](function(_0xd0df8c){_0x224bf6[_0x3f96('0x40')]=_0xd0df8c;return _0x224bf6;})[_0x3f96('0x24')](respondWithFilteredResult(_0x2c0c38,_0x2cf510))[_0x3f96('0x41')](handleError(_0x2c0c38,null));};exports[_0x3f96('0x42')]=function(_0x1b3ea0,_0x492ccb){var _0x5351ec={'raw':!![],'where':{'id':_0x1b3ea0[_0x3f96('0x43')]['id']}},_0xbe2fff={};_0xbe2fff[_0x3f96('0x2e')]=_[_0x3f96('0x44')](db[_0x3f96('0x2a')][_0x3f96('0x2b')]);_0xbe2fff[_0x3f96('0x2f')]=_['keys'](_0x1b3ea0[_0x3f96('0x2f')]);_0xbe2fff[_0x3f96('0x30')]=_[_0x3f96('0x31')](_0xbe2fff[_0x3f96('0x2e')],_0xbe2fff[_0x3f96('0x2f')]);_0x5351ec['attributes']=_[_0x3f96('0x31')](_0xbe2fff[_0x3f96('0x2e')],qs[_0x3f96('0x33')](_0x1b3ea0[_0x3f96('0x2f')][_0x3f96('0x33')]));_0x5351ec[_0x3f96('0x32')]=_0x5351ec[_0x3f96('0x32')][_0x3f96('0x34')]?_0x5351ec[_0x3f96('0x32')]:_0xbe2fff[_0x3f96('0x2e')];if(_0x1b3ea0[_0x3f96('0x2f')][_0x3f96('0x45')]){_0x5351ec[_0x3f96('0x3e')]=[{'all':!![]}];}_0x5351ec=_[_0x3f96('0x3b')]({},_0x5351ec,_0x1b3ea0[_0x3f96('0x3d')]);return db[_0x3f96('0x2a')][_0x3f96('0x46')](_0x5351ec)['then'](handleEntityNotFound(_0x492ccb,null))[_0x3f96('0x24')](respondWithResult(_0x492ccb,null))[_0x3f96('0x41')](handleError(_0x492ccb,null));};exports[_0x3f96('0x47')]=function(_0x25d849,_0x5b3a07){return db[_0x3f96('0x2a')][_0x3f96('0x47')](_0x25d849[_0x3f96('0x48')],{})['then'](respondWithResult(_0x5b3a07,0xc9))[_0x3f96('0x41')](handleError(_0x5b3a07,null));};exports[_0x3f96('0x49')]=function(_0x6dc0d3,_0x2c28fe){if(_0x6dc0d3['body']['id']){delete _0x6dc0d3['body']['id'];}return db[_0x3f96('0x2a')]['find']({'where':{'id':_0x6dc0d3[_0x3f96('0x43')]['id']}})[_0x3f96('0x24')](handleEntityNotFound(_0x2c28fe,null))[_0x3f96('0x24')](saveUpdates(_0x6dc0d3[_0x3f96('0x48')],null))[_0x3f96('0x24')](respondWithResult(_0x2c28fe,null))['catch'](handleError(_0x2c28fe,null));};exports[_0x3f96('0x23')]=function(_0x3af9fa,_0x405a99){return db[_0x3f96('0x2a')][_0x3f96('0x46')]({'where':{'id':_0x3af9fa[_0x3f96('0x43')]['id']}})[_0x3f96('0x24')](handleEntityNotFound(_0x405a99,null))['then'](removeEntity(_0x405a99,null))[_0x3f96('0x41')](handleError(_0x405a99,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f59b659..14f94a1 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 _0x20d1=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x24d344,_0x4a2291){var _0x341736=function(_0x40fb8b){while(--_0x40fb8b){_0x24d344['push'](_0x24d344['shift']());}};_0x341736(++_0x4a2291);}(_0x20d1,0x75));var _0x120d=function(_0x3dc0c3,_0x11d641){_0x3dc0c3=_0x3dc0c3-0x0;var _0x5eede1=_0x20d1[_0x3dc0c3];return _0x5eede1;};'use strict';var _=require(_0x120d('0x0'));var util=require('util');var logger=require(_0x120d('0x1'))(_0x120d('0x2'));var moment=require(_0x120d('0x3'));var BPromise=require(_0x120d('0x4'));var rp=require(_0x120d('0x5'));var fs=require('fs');var path=require(_0x120d('0x6'));var rimraf=require(_0x120d('0x7'));var config=require('../../config/environment');var attributes=require(_0x120d('0x8'));module['exports']=function(_0x4d7baa,_0x1a8e20){return _0x4d7baa[_0x120d('0x9')](_0x120d('0xa'),attributes,{'tableName':_0x120d('0xb'),'paranoid':![],'indexes':[{'name':_0x120d('0xc'),'fields':['idField',_0x120d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x833f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','zendesk_unique_index','FieldId','lodash'];(function(_0x1278c4,_0x5c2d2d){var _0x365887=function(_0x316fc4){while(--_0x316fc4){_0x1278c4['push'](_0x1278c4['shift']());}};_0x365887(++_0x5c2d2d);}(_0x833f,0xa8));var _0xf833=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x833f[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0xf833('0x0'));var util=require(_0xf833('0x1'));var logger=require('../../config/logger')(_0xf833('0x2'));var moment=require(_0xf833('0x3'));var BPromise=require(_0xf833('0x4'));var rp=require(_0xf833('0x5'));var fs=require('fs');var path=require(_0xf833('0x6'));var rimraf=require(_0xf833('0x7'));var config=require(_0xf833('0x8'));var attributes=require(_0xf833('0x9'));module[_0xf833('0xa')]=function(_0x308e0f,_0x2d950e){return _0x308e0f['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf833('0xb'),'fields':['idField',_0xf833('0xc')],'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 9838bfa..f463c88 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 _0x5cdd=['request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x5cdd,0x12c));var _0xd5cd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5cdd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var moment=require('moment');var BPromise=require(_0xd5cd('0x2'));var rs=require(_0xd5cd('0x3'));var fs=require('fs');var Redis=require(_0xd5cd('0x4'));var db=require(_0xd5cd('0x5'))['db'];var utils=require(_0xd5cd('0x6'));var logger=require('../../config/logger')(_0xd5cd('0x7'));var config=require(_0xd5cd('0x8'));var jayson=require(_0xd5cd('0x9'));var client=jayson[_0xd5cd('0xa')][_0xd5cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d08f,_0x4c7a8c,_0x202f3b){return new BPromise(function(_0x198409,_0x24a6fb){return client[_0xd5cd('0xc')](_0x51d08f,_0x202f3b)[_0xd5cd('0xd')](function(_0x43869a){logger['info'](_0xd5cd('0xe'),_0x4c7a8c,_0xd5cd('0xf'));logger[_0xd5cd('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4c7a8c,_0xd5cd('0xf'),JSON[_0xd5cd('0x11')](_0x43869a));if(_0x43869a['error']){if(_0x43869a['error'][_0xd5cd('0x12')]===0x1f4){logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);return _0x24a6fb(_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);}logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x43869a['error']['message']);return _0x198409(_0x43869a[_0xd5cd('0x13')][_0xd5cd('0x14')]);}else{logger[_0xd5cd('0x15')](_0xd5cd('0xe'),_0x4c7a8c,_0xd5cd('0xf'));_0x198409(_0x43869a[_0xd5cd('0x16')][_0xd5cd('0x14')]);}})[_0xd5cd('0x17')](function(_0x2db0c1){logger[_0xd5cd('0x13')](_0xd5cd('0xe'),_0x4c7a8c,_0x2db0c1);_0x24a6fb(_0x2db0c1);});});} \ No newline at end of file +var _0xdd42=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd42,0x157));var _0x2dd4=function(_0xf8a06f,_0x5c8d98){_0xf8a06f=_0xf8a06f-0x0;var _0x27d964=_0xdd42[_0xf8a06f];return _0x27d964;};'use strict';var _=require(_0x2dd4('0x0'));var util=require('util');var moment=require(_0x2dd4('0x1'));var BPromise=require(_0x2dd4('0x2'));var rs=require(_0x2dd4('0x3'));var fs=require('fs');var Redis=require(_0x2dd4('0x4'));var db=require(_0x2dd4('0x5'))['db'];var utils=require(_0x2dd4('0x6'));var logger=require('../../config/logger')(_0x2dd4('0x7'));var config=require(_0x2dd4('0x8'));var jayson=require(_0x2dd4('0x9'));var client=jayson[_0x2dd4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a574d,_0x4eadcf,_0x3e0ec9){return new BPromise(function(_0xf58f06,_0xfb55a8){return client['request'](_0x1a574d,_0x3e0ec9)[_0x2dd4('0xb')](function(_0xb5ba0d){logger[_0x2dd4('0xc')](_0x2dd4('0xd'),_0x4eadcf,_0x2dd4('0xe'));logger[_0x2dd4('0xf')](_0x2dd4('0x10'),_0x4eadcf,'request\x20sent',JSON[_0x2dd4('0x11')](_0xb5ba0d));if(_0xb5ba0d[_0x2dd4('0x12')]){if(_0xb5ba0d[_0x2dd4('0x12')][_0x2dd4('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4eadcf,_0xb5ba0d[_0x2dd4('0x12')][_0x2dd4('0x14')]);return _0xfb55a8(_0xb5ba0d[_0x2dd4('0x12')][_0x2dd4('0x14')]);}logger[_0x2dd4('0x12')](_0x2dd4('0xd'),_0x4eadcf,_0xb5ba0d['error'][_0x2dd4('0x14')]);return _0xf58f06(_0xb5ba0d[_0x2dd4('0x12')][_0x2dd4('0x14')]);}else{logger[_0x2dd4('0xc')](_0x2dd4('0xd'),_0x4eadcf,_0x2dd4('0xe'));_0xf58f06(_0xb5ba0d[_0x2dd4('0x15')]['message']);}})[_0x2dd4('0x16')](function(_0x3ec1e2){logger[_0x2dd4('0x12')](_0x2dd4('0xd'),_0x4eadcf,_0x3ec1e2);_0xfb55a8(_0x3ec1e2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6c5fd63..47d64f6 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 _0xfbfe=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xfbfe,0x1ad));var _0xefbf=function(_0x56f329,_0x3e52ff){_0x56f329=_0x56f329-0x0;var _0x2ed786=_0xfbfe[_0x56f329];return _0x2ed786;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefbf('0x0'));var timeout=require(_0xefbf('0x1'));var express=require(_0xefbf('0x2'));var router=express[_0xefbf('0x3')]();var fs_extra=require(_0xefbf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xefbf('0x5'));var config=require(_0xefbf('0x6'));var controller=require(_0xefbf('0x7'));router[_0xefbf('0x8')]('/',auth[_0xefbf('0x9')](),controller['index']);router[_0xefbf('0x8')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0xb')]);router['get'](_0xefbf('0xc'),auth[_0xefbf('0x9')](),controller[_0xefbf('0xd')]);router[_0xefbf('0x8')](_0xefbf('0xe'),auth['isAuthenticated'](),controller[_0xefbf('0xf')]);router[_0xefbf('0x10')]('/',auth[_0xefbf('0x9')](),controller['create']);router[_0xefbf('0x10')](_0xefbf('0xc'),auth['isAuthenticated'](),controller[_0xefbf('0x11')]);router[_0xefbf('0x12')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0x13')]);router[_0xefbf('0x14')](_0xefbf('0xa'),auth[_0xefbf('0x9')](),controller[_0xefbf('0x15')]);module['exports']=router; \ No newline at end of file +var _0xaec4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xaec4,0x1a4));var _0x4aec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaec4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x4aec('0x0'));var util=require(_0x4aec('0x1'));var path=require(_0x4aec('0x2'));var timeout=require(_0x4aec('0x3'));var express=require('express');var router=express[_0x4aec('0x4')]();var fs_extra=require(_0x4aec('0x5'));var auth=require(_0x4aec('0x6'));var interaction=require(_0x4aec('0x7'));var config=require(_0x4aec('0x8'));var controller=require(_0x4aec('0x9'));router[_0x4aec('0xa')]('/',auth['isAuthenticated'](),controller[_0x4aec('0xb')]);router[_0x4aec('0xa')](_0x4aec('0xc'),auth[_0x4aec('0xd')](),controller[_0x4aec('0xe')]);router[_0x4aec('0xa')]('/:id/configurations',auth[_0x4aec('0xd')](),controller['getConfigurations']);router[_0x4aec('0xa')](_0x4aec('0xf'),auth['isAuthenticated'](),controller[_0x4aec('0x10')]);router[_0x4aec('0x11')]('/',auth['isAuthenticated'](),controller[_0x4aec('0x12')]);router[_0x4aec('0x11')](_0x4aec('0x13'),auth[_0x4aec('0xd')](),controller[_0x4aec('0x14')]);router['put']('/:id',auth[_0x4aec('0xd')](),controller[_0x4aec('0x15')]);router[_0x4aec('0x16')](_0x4aec('0xc'),auth[_0x4aec('0xd')](),controller[_0x4aec('0x17')]);module[_0x4aec('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a7fc6a3..bf8396d 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x17de40,_0x564903){var _0x233e21=function(_0x370c9f){while(--_0x370c9f){_0x17de40['push'](_0x17de40['shift']());}};_0x233e21(++_0x564903);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0x9bde=['STRING','exports'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2cac7b,_0x5f5573){_0x2cac7b=_0x2cac7b-0x0;var _0x3240b6=_0x9bde[_0x2cac7b];return _0x3240b6;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe9bd('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe9bd('0x1')]},'clientId':{'type':Sequelize[_0xe9bd('0x1')]},'clientSecret':{'type':Sequelize[_0xe9bd('0x1')]},'serverUrl':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe9bd('0x1')]},'refreshToken':{'type':Sequelize[_0xe9bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f0973a5..170f1b6 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 _0xf672=['Call_Duration','Call_Result','Call_Type','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','update','find','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId'];(function(_0x9717be,_0x3557cc){var _0x1e36b3=function(_0x4799d3){while(--_0x4799d3){_0x9717be['push'](_0x9717be['shift']());}};_0x1e36b3(++_0x3557cc);}(_0xf672,0x107));var _0x2f67=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf672[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x2f67('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f67('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f67('0x2'));var Mustache=require(_0x2f67('0x3'));var util=require(_0x2f67('0x4'));var path=require(_0x2f67('0x5'));var sox=require('sox');var csv=require(_0x2f67('0x6'));var ejs=require(_0x2f67('0x7'));var fs=require('fs');var fs_extra=require(_0x2f67('0x8'));var _=require(_0x2f67('0x9'));var squel=require('squel');var crypto=require(_0x2f67('0xa'));var jsforce=require(_0x2f67('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2f67('0x6'));var querystring=require('querystring');var Papa=require(_0x2f67('0xc'));var Redis=require(_0x2f67('0xd'));var authService=require(_0x2f67('0xe'));var qs=require(_0x2f67('0xf'));var as=require(_0x2f67('0x10'));var hardwareService=require(_0x2f67('0x11'));var logger=require(_0x2f67('0x12'))(_0x2f67('0x13'));var utils=require(_0x2f67('0x14'));var config=require(_0x2f67('0x15'));var licenseUtil=require(_0x2f67('0x16'));var db=require(_0x2f67('0x17'))['db'];var integrations=require(_0x2f67('0x18'));function respondWithStatusCode(_0x5d244c,_0x27f1b3){_0x27f1b3=_0x27f1b3||0xcc;return function(_0x24b99b){if(_0x24b99b){return _0x5d244c[_0x2f67('0x19')](_0x27f1b3);}return _0x5d244c[_0x2f67('0x1a')](_0x27f1b3)[_0x2f67('0x1b')]();};}function respondWithResult(_0x279fac,_0x3bcc7c){_0x3bcc7c=_0x3bcc7c||0xc8;return function(_0x2693f6){if(_0x2693f6){return _0x279fac[_0x2f67('0x1a')](_0x3bcc7c)[_0x2f67('0x1c')](_0x2693f6);}};}function respondWithFilteredResult(_0x2b81d9,_0x3eb603){return function(_0x330f08){if(_0x330f08){var _0x426c50=typeof _0x3eb603[_0x2f67('0x1d')]===_0x2f67('0x1e')&&typeof _0x3eb603[_0x2f67('0x1f')]==='undefined';var _0x9266ed=_0x330f08[_0x2f67('0x20')];var _0x5c6326=_0x426c50?0x0:_0x3eb603[_0x2f67('0x1d')];var _0x4a37b0=_0x426c50?_0x330f08['count']:_0x3eb603['offset']+_0x3eb603['limit'];var _0x3d76db;if(_0x4a37b0>=_0x9266ed){_0x4a37b0=_0x9266ed;_0x3d76db=0xc8;}else{_0x3d76db=0xce;}_0x2b81d9[_0x2f67('0x1a')](_0x3d76db);return _0x2b81d9[_0x2f67('0x21')]('Content-Range',_0x5c6326+'-'+_0x4a37b0+'/'+_0x9266ed)['json'](_0x330f08);}return null;};}function patchUpdates(_0x32f18b){return function(_0x5b2715){try{jsonpatch[_0x2f67('0x22')](_0x5b2715,_0x32f18b,!![]);}catch(_0x1ab33b){return BPromise[_0x2f67('0x23')](_0x1ab33b);}return _0x5b2715['save']();};}function saveUpdates(_0x9a8cd0,_0x11f2d2){return function(_0x27d498){if(_0x27d498){return _0x27d498['update'](_0x9a8cd0)[_0x2f67('0x24')](function(_0x59db4b){return _0x59db4b;});}return null;};}function removeEntity(_0x3d8f54,_0x5e022f){return function(_0xfb9088){if(_0xfb9088){return _0xfb9088[_0x2f67('0x25')]()[_0x2f67('0x24')](function(){_0x3d8f54[_0x2f67('0x1a')](0xcc)[_0x2f67('0x1b')]();});}};}function handleEntityNotFound(_0x4988c7,_0xf10ce3){return function(_0x2d491c){if(!_0x2d491c){_0x4988c7['sendStatus'](0x194);}return _0x2d491c;};}function handleError(_0x3130d6,_0x11aa7b){_0x11aa7b=_0x11aa7b||0x1f4;return function(_0x1eb576){logger[_0x2f67('0x26')](_0x1eb576[_0x2f67('0x27')]);if(_0x1eb576[_0x2f67('0x28')]){delete _0x1eb576[_0x2f67('0x28')];}_0x3130d6[_0x2f67('0x1a')](_0x11aa7b)[_0x2f67('0x29')](_0x1eb576);};}exports[_0x2f67('0x2a')]=function(_0x1d37fc,_0xb341e0){var _0x29910c={},_0x5e38ef={},_0x97c373={'count':0x0,'rows':[]};var _0x51e125=_[_0x2f67('0x2b')](db[_0x2f67('0x2c')][_0x2f67('0x2d')],function(_0x1c5114){return{'name':_0x1c5114['fieldName'],'type':_0x1c5114['type'][_0x2f67('0x2e')]};});_0x5e38ef[_0x2f67('0x2f')]=_[_0x2f67('0x2b')](_0x51e125,_0x2f67('0x28'));_0x5e38ef[_0x2f67('0x30')]=_[_0x2f67('0x31')](_0x1d37fc[_0x2f67('0x30')]);_0x5e38ef['filters']=_['intersection'](_0x5e38ef[_0x2f67('0x2f')],_0x5e38ef['query']);_0x29910c['attributes']=_[_0x2f67('0x32')](_0x5e38ef[_0x2f67('0x2f')],qs['fields'](_0x1d37fc[_0x2f67('0x30')]['fields']));_0x29910c[_0x2f67('0x33')]=_0x29910c[_0x2f67('0x33')][_0x2f67('0x34')]?_0x29910c[_0x2f67('0x33')]:_0x5e38ef['model'];if(!_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x35')](_0x2f67('0x36'))){_0x29910c[_0x2f67('0x1f')]=qs[_0x2f67('0x1f')](_0x1d37fc[_0x2f67('0x30')]['limit']);_0x29910c[_0x2f67('0x1d')]=qs[_0x2f67('0x1d')](_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x1d')]);}_0x29910c['order']=qs[_0x2f67('0x37')](_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x37')]);_0x29910c[_0x2f67('0x38')]=qs[_0x2f67('0x39')](_[_0x2f67('0x3a')](_0x1d37fc[_0x2f67('0x30')],_0x5e38ef[_0x2f67('0x39')]),_0x51e125);if(_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x3b')]){_0x29910c['where']=_[_0x2f67('0x3c')](_0x29910c[_0x2f67('0x38')],{'$or':_[_0x2f67('0x2b')](_0x51e125,function(_0x355a5f){if(_0x355a5f[_0x2f67('0x3d')]!==_0x2f67('0x3e')){var _0x54e824={};_0x54e824[_0x355a5f[_0x2f67('0x28')]]={'$like':'%'+_0x1d37fc[_0x2f67('0x30')][_0x2f67('0x3b')]+'%'};return _0x54e824;}})});}_0x29910c=_[_0x2f67('0x3c')]({},_0x29910c,_0x1d37fc[_0x2f67('0x3f')]);var _0x4a2731={'where':_0x29910c[_0x2f67('0x38')]};return db[_0x2f67('0x2c')][_0x2f67('0x20')](_0x4a2731)['then'](function(_0x46e7cd){_0x97c373[_0x2f67('0x20')]=_0x46e7cd;if(_0x1d37fc['query'][_0x2f67('0x40')]){_0x29910c[_0x2f67('0x41')]=[{'all':!![]}];}return db[_0x2f67('0x2c')][_0x2f67('0x42')](_0x29910c);})['then'](function(_0x181759){_0x97c373[_0x2f67('0x43')]=_0x181759;return _0x97c373;})['then'](respondWithFilteredResult(_0xb341e0,_0x29910c))[_0x2f67('0x44')](handleError(_0xb341e0,null));};exports[_0x2f67('0x45')]=function(_0x40514e,_0x3743e4){var _0x48dc5d={'raw':![],'where':{'id':_0x40514e[_0x2f67('0x46')]['id']}},_0x3be3cc={};_0x3be3cc[_0x2f67('0x2f')]=_[_0x2f67('0x31')](db[_0x2f67('0x2c')]['rawAttributes']);_0x3be3cc[_0x2f67('0x30')]=_['keys'](_0x40514e[_0x2f67('0x30')]);_0x3be3cc[_0x2f67('0x39')]=_[_0x2f67('0x32')](_0x3be3cc[_0x2f67('0x2f')],_0x3be3cc[_0x2f67('0x30')]);_0x48dc5d[_0x2f67('0x33')]=_[_0x2f67('0x32')](_0x3be3cc['model'],qs[_0x2f67('0x47')](_0x40514e['query'][_0x2f67('0x47')]));_0x48dc5d['attributes']=_0x48dc5d[_0x2f67('0x33')][_0x2f67('0x34')]?_0x48dc5d[_0x2f67('0x33')]:_0x3be3cc[_0x2f67('0x2f')];if(_0x40514e[_0x2f67('0x30')][_0x2f67('0x40')]){_0x48dc5d['include']=[{'all':!![]}];}_0x48dc5d=_[_0x2f67('0x3c')]({},_0x48dc5d,_0x40514e[_0x2f67('0x3f')]);return db[_0x2f67('0x2c')]['find'](_0x48dc5d)[_0x2f67('0x24')](handleEntityNotFound(_0x3743e4,null))[_0x2f67('0x24')](respondWithResult(_0x3743e4,null))[_0x2f67('0x44')](handleError(_0x3743e4,null));};exports[_0x2f67('0x48')]=function(_0x55b338,_0x5c5910){return db[_0x2f67('0x2c')][_0x2f67('0x48')](_0x55b338[_0x2f67('0x49')],{})[_0x2f67('0x24')](respondWithResult(_0x5c5910,0xc9))[_0x2f67('0x44')](handleError(_0x5c5910,null));};exports[_0x2f67('0x4a')]=function(_0x5642b1,_0x498c06){if(_0x5642b1[_0x2f67('0x49')]['id']){delete _0x5642b1[_0x2f67('0x49')]['id'];}return db[_0x2f67('0x2c')][_0x2f67('0x4b')]({'where':{'id':_0x5642b1[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x498c06,null))['then'](saveUpdates(_0x5642b1[_0x2f67('0x49')],null))[_0x2f67('0x24')](respondWithResult(_0x498c06,null))[_0x2f67('0x44')](handleError(_0x498c06,null));};exports[_0x2f67('0x25')]=function(_0x29746b,_0x29e5f3){return db[_0x2f67('0x2c')][_0x2f67('0x4b')]({'where':{'id':_0x29746b[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x29e5f3,null))[_0x2f67('0x24')](removeEntity(_0x29e5f3,null))['catch'](handleError(_0x29e5f3,null));};exports['getConfigurations']=function(_0x1e442e,_0x5c9482,_0x19dfb4){var _0x499a50={};var _0x5b50a9={};var _0x22a60c;var _0x5bcf4c;return db[_0x2f67('0x2c')]['findOne']({'where':{'id':_0x1e442e['params']['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x5c9482,null))[_0x2f67('0x24')](function(_0xbca1ac){if(_0xbca1ac){_0x22a60c=_0xbca1ac;_0x5b50a9[_0x2f67('0x2f')]=_[_0x2f67('0x31')](db['ZohoConfiguration'][_0x2f67('0x2d')]);_0x5b50a9[_0x2f67('0x30')]=_[_0x2f67('0x31')](_0x1e442e[_0x2f67('0x30')]);_0x5b50a9[_0x2f67('0x39')]=_['intersection'](_0x5b50a9[_0x2f67('0x2f')],_0x5b50a9[_0x2f67('0x30')]);_0x499a50['attributes']=_['intersection'](_0x5b50a9[_0x2f67('0x2f')],qs[_0x2f67('0x47')](_0x1e442e[_0x2f67('0x30')]['fields']));_0x499a50[_0x2f67('0x33')]=_0x499a50[_0x2f67('0x33')][_0x2f67('0x34')]?_0x499a50['attributes']:_0x5b50a9['model'];_0x499a50['order']=qs['sort'](_0x1e442e[_0x2f67('0x30')][_0x2f67('0x37')]);_0x499a50[_0x2f67('0x38')]=qs[_0x2f67('0x39')](_['pick'](_0x1e442e[_0x2f67('0x30')],_0x5b50a9[_0x2f67('0x39')]));if(_0x1e442e['query'][_0x2f67('0x3b')]){_0x499a50['where']=_['merge'](_0x499a50[_0x2f67('0x38')],{'$or':_[_0x2f67('0x2b')](_0x499a50['attributes'],function(_0x574e8a){var _0x555df9={};_0x555df9[_0x574e8a]={'$like':'%'+_0x1e442e['query'][_0x2f67('0x3b')]+'%'};return _0x555df9;})});}_0x499a50=_[_0x2f67('0x3c')]({},_0x499a50,_0x1e442e[_0x2f67('0x3f')]);return _0x22a60c['getConfigurations'](_0x499a50);}})[_0x2f67('0x24')](function(_0x1acf35){if(_0x1acf35){_0x5bcf4c=_0x1acf35[_0x2f67('0x34')];if(!_0x1e442e[_0x2f67('0x30')][_0x2f67('0x35')](_0x2f67('0x36'))){_0x499a50[_0x2f67('0x1f')]=qs[_0x2f67('0x1f')](_0x1e442e['query'][_0x2f67('0x1f')]);_0x499a50[_0x2f67('0x1d')]=qs[_0x2f67('0x1d')](_0x1e442e[_0x2f67('0x30')]['offset']);}return _0x22a60c['getConfigurations'](_0x499a50);}})[_0x2f67('0x24')](function(_0x57f4ae){if(_0x57f4ae){return _0x57f4ae?{'count':_0x5bcf4c,'rows':_0x57f4ae}:null;}})['then'](respondWithResult(_0x5c9482,null))[_0x2f67('0x44')](handleError(_0x5c9482,null));};exports['addConfiguration']=function(_0x2fb87b,_0x401955,_0x34d395){if(_0x2fb87b['body']['id']){delete _0x2fb87b['body']['id'];}return db['ZohoAccount'][_0x2f67('0x4c')]({'where':{'id':_0x2fb87b[_0x2f67('0x46')]['id']}})[_0x2f67('0x24')](handleEntityNotFound(_0x401955,null))[_0x2f67('0x24')](function(_0x2ad06e){if(_0x2ad06e){_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4d')]=_0x2ad06e['id'];_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4e')]=integrations['getSubjects'](_0x2fb87b[_0x2f67('0x49')]['channel'],_0x2fb87b['body'][_0x2f67('0x3d')]);_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x4f')]=integrations[_0x2f67('0x50')](_0x2fb87b['body'][_0x2f67('0x51')],_0x2fb87b[_0x2f67('0x49')][_0x2f67('0x3d')]);return db[_0x2f67('0x52')][_0x2f67('0x48')](_0x2fb87b[_0x2f67('0x49')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x2f67('0x53')],'as':_0x2f67('0x4f')}]});}return null;})[_0x2f67('0x24')](respondWithResult(_0x401955,null))['catch'](handleError(_0x401955,null));};function getAccessToken(_0x187664){return new Promise(function(_0x16cc5c,_0xce2903){var _0x3eb694;switch(_0x187664[_0x2f67('0x54')]){case'US':_0x3eb694=_0x2f67('0x55');break;case'AU':_0x3eb694=_0x2f67('0x56');break;case'EU':_0x3eb694='https://accounts.zoho.eu';break;case'IN':_0x3eb694=_0x2f67('0x57');break;case'CN':_0x3eb694='https://accounts.zoho.com.cn';break;default:_0x3eb694=_0x2f67('0x58');break;}var _0x286dc6={'method':'POST','uri':_0x3eb694+_0x2f67('0x59'),'qs':{'refresh_token':_0x187664['refreshToken'],'client_id':_0x187664[_0x2f67('0x5a')],'client_secret':_0x187664[_0x2f67('0x5b')],'grant_type':_0x2f67('0x5c')},'json':!![]};return rp(_0x286dc6)[_0x2f67('0x24')](function(_0x4f8d9d){if(_0x4f8d9d[_0x2f67('0x5d')]){_0x16cc5c(_0x4f8d9d[_0x2f67('0x5d')]);}else{_0xce2903('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2f67('0x44')](function(_0x1d0ac3){_0xce2903(_0x1d0ac3);});});}exports[_0x2f67('0x5e')]=function(_0x181d50,_0x4cbeb2,_0x42515f){var _0x15204d,_0x5e425c,_0x5a8f0e,_0x3a96d0,_0x442935;return db['ZohoAccount'][_0x2f67('0x4c')]({'where':{'id':_0x181d50['params']['id']},'attributes':['id',_0x2f67('0x5f'),_0x2f67('0x54'),_0x2f67('0x5a'),_0x2f67('0x5b'),_0x2f67('0x60'),_0x2f67('0x61'),_0x2f67('0x62')]})[_0x2f67('0x24')](handleEntityNotFound(_0x4cbeb2,null))[_0x2f67('0x24')](function(_0x2ba918){_0x442935=_0x2ba918;_0x15204d=_0x442935[_0x2f67('0x5f')];_0x5e425c=_0x15204d===_0x2f67('0x63')?'eu':_0x2f67('0x64');_0x5a8f0e=_0x442935['serverUrl'];var _0x3bc22a=_0x5a8f0e[_0x2f67('0x65')](-0x1);if(_0x3bc22a==='/'||_0x3bc22a==='\x5c'||_0x3bc22a===':'){_0x5a8f0e=_0x5a8f0e[_0x2f67('0x66')](0x0,_0x5a8f0e['lastIndexOf'](_0x3bc22a));}if(!_0x442935[_0x2f67('0x62')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x442935);})['then'](function(_0x5218a2){if(_0x5218a2){return rp({'method':_0x2f67('0x67'),'uri':util[_0x2f67('0x68')](_0x2f67('0x69'),_0x5e425c),'qs':{'module':'Calls'},'headers':{'Authorization':_0x2f67('0x6a')+_0x5218a2},'json':!![]});}})['then'](function(_0x404241){if(_0x404241){if(_0x404241[_0x2f67('0x6b')]&&_0x404241[_0x2f67('0x6b')][_0x2f67('0x26')]){throw new Error(_0x404241[_0x2f67('0x6b')][_0x2f67('0x26')]['message']);}var _0x1aed65=[];var _0x1e61e8=[];var _0x1ab7c7=[_0x2f67('0x6c'),_0x2f67('0x6d'),_0x2f67('0x6e'),_0x2f67('0x6f'),_0x2f67('0x70'),_0x2f67('0x71'),'Call_Start_Time',_0x2f67('0x72')];_0x1e61e8=_['remove'](_0x404241[_0x2f67('0x47')],function(_0x5bd581){return _0x1ab7c7['includes'](_0x5bd581[_0x2f67('0x73')]);});for(var _0xa2fc9d=0x0;_0xa2fc9d<_0x1e61e8[_0x2f67('0x34')];_0xa2fc9d++){if(_0x1e61e8[_0xa2fc9d][_0x2f67('0x74')]===![]){_0x1aed65[_0x2f67('0x75')]({'id':_0x1e61e8[_0xa2fc9d]['id'],'name':_0x1e61e8[_0xa2fc9d]['display_label'],'custom':_0x1e61e8[_0xa2fc9d][_0x2f67('0x76')],'options':_0x1e61e8[_0xa2fc9d]['data_type']===_0x2f67('0x77')&&_0x1e61e8[_0xa2fc9d]['pick_list_values'][_0x2f67('0x34')]>-0x1?_['map'](_0x1e61e8[_0xa2fc9d][_0x2f67('0x78')],function(_0x1e046a){return{'name':_0x1e046a,'value':_0x1e046a};}):[]});}}return{'count':_0x1aed65[_0x2f67('0x34')],'rows':_0x1aed65};}else{return{'count':0x0,'rows':[]};}})[_0x2f67('0x24')](respondWithResult(_0x4cbeb2,null))['catch'](function(_0x13e15d){var _0x10a1e0=_0x181d50['query']['test']?0x1f4:_0x13e15d[_0x2f67('0x79')]||0x1f4;logger[_0x2f67('0x26')](_0x2f67('0x7a'),_0x2f67('0x5e'),_0x10a1e0,JSON['stringify'](_0x13e15d));delete _0x13e15d[_0x2f67('0x28')];if(_0x10a1e0===0x191){_0x10a1e0=0x190;}_0x4cbeb2[_0x2f67('0x1a')](_0x10a1e0)[_0x2f67('0x29')](_0x181d50['query'][_0x2f67('0x7b')]?{'message':_0x2f67('0x7c'),'statusCode':_0x13e15d['statusCode']}:_0x13e15d);});}; \ No newline at end of file +var _0x69c7=['remove','includes','system_mandatory','push','display_label','data_type','pick_list_values','getFields','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','mustache','util','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/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','ZohoAccount','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','length','pick','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','access_token','host','zone','code','zoho.eu','serverUrl','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Subject','Description','WhoId','Call_Type'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x69c7,0x88));var _0x769c=function(_0x28a04e,_0x42c4bf){_0x28a04e=_0x28a04e-0x0;var _0x10ad3e=_0x69c7[_0x28a04e];return _0x10ad3e;};'use strict';var emlformat=require(_0x769c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x769c('0x1'));var jsonpatch=require(_0x769c('0x2'));var rp=require('request-promise');var moment=require(_0x769c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x769c('0x4'));var util=require(_0x769c('0x5'));var path=require(_0x769c('0x6'));var sox=require(_0x769c('0x7'));var csv=require(_0x769c('0x8'));var ejs=require(_0x769c('0x9'));var fs=require('fs');var fs_extra=require(_0x769c('0xa'));var _=require(_0x769c('0xb'));var squel=require(_0x769c('0xc'));var crypto=require(_0x769c('0xd'));var jsforce=require(_0x769c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x769c('0x8'));var querystring=require('querystring');var Papa=require(_0x769c('0xf'));var Redis=require(_0x769c('0x10'));var authService=require(_0x769c('0x11'));var qs=require(_0x769c('0x12'));var as=require(_0x769c('0x13'));var hardwareService=require(_0x769c('0x14'));var logger=require(_0x769c('0x15'))(_0x769c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x769c('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f1286,_0x1c0a79){_0x1c0a79=_0x1c0a79||0xcc;return function(_0x5dd2e3){if(_0x5dd2e3){return _0x3f1286[_0x769c('0x18')](_0x1c0a79);}return _0x3f1286[_0x769c('0x19')](_0x1c0a79)[_0x769c('0x1a')]();};}function respondWithResult(_0x209807,_0x15467b){_0x15467b=_0x15467b||0xc8;return function(_0x56f194){if(_0x56f194){return _0x209807[_0x769c('0x19')](_0x15467b)[_0x769c('0x1b')](_0x56f194);}};}function respondWithFilteredResult(_0x178c0c,_0x341230){return function(_0x1d9912){if(_0x1d9912){var _0x521688=typeof _0x341230[_0x769c('0x1c')]==='undefined'&&typeof _0x341230['limit']===_0x769c('0x1d');var _0x156911=_0x1d9912['count'];var _0x1c3251=_0x521688?0x0:_0x341230['offset'];var _0x11c5f6=_0x521688?_0x1d9912[_0x769c('0x1e')]:_0x341230['offset']+_0x341230[_0x769c('0x1f')];var _0x4e6c6b;if(_0x11c5f6>=_0x156911){_0x11c5f6=_0x156911;_0x4e6c6b=0xc8;}else{_0x4e6c6b=0xce;}_0x178c0c[_0x769c('0x19')](_0x4e6c6b);return _0x178c0c[_0x769c('0x20')](_0x769c('0x21'),_0x1c3251+'-'+_0x11c5f6+'/'+_0x156911)['json'](_0x1d9912);}return null;};}function patchUpdates(_0x57a1e7){return function(_0x418490){try{jsonpatch[_0x769c('0x22')](_0x418490,_0x57a1e7,!![]);}catch(_0x5f0b2a){return BPromise[_0x769c('0x23')](_0x5f0b2a);}return _0x418490[_0x769c('0x24')]();};}function saveUpdates(_0x4ae14a,_0x4c0f31){return function(_0x5ae058){if(_0x5ae058){return _0x5ae058[_0x769c('0x25')](_0x4ae14a)[_0x769c('0x26')](function(_0x4dd9c5){return _0x4dd9c5;});}return null;};}function removeEntity(_0x1905e6,_0x58470f){return function(_0x18b2e9){if(_0x18b2e9){return _0x18b2e9[_0x769c('0x27')]()[_0x769c('0x26')](function(){_0x1905e6['status'](0xcc)[_0x769c('0x1a')]();});}};}function handleEntityNotFound(_0x175624,_0x12777f){return function(_0x7f96a5){if(!_0x7f96a5){_0x175624[_0x769c('0x18')](0x194);}return _0x7f96a5;};}function handleError(_0x5c69b8,_0x4d6162){_0x4d6162=_0x4d6162||0x1f4;return function(_0x47e90d){logger['error'](_0x47e90d[_0x769c('0x28')]);if(_0x47e90d[_0x769c('0x29')]){delete _0x47e90d['name'];}_0x5c69b8[_0x769c('0x19')](_0x4d6162)[_0x769c('0x2a')](_0x47e90d);};}exports[_0x769c('0x2b')]=function(_0x36a60b,_0xca16fd){var _0x217647={},_0x5e6d6c={},_0xb2e982={'count':0x0,'rows':[]};var _0x39a46f=_[_0x769c('0x2c')](db['ZohoAccount']['rawAttributes'],function(_0x136428){return{'name':_0x136428[_0x769c('0x2d')],'type':_0x136428[_0x769c('0x2e')][_0x769c('0x2f')]};});_0x5e6d6c[_0x769c('0x30')]=_['map'](_0x39a46f,_0x769c('0x29'));_0x5e6d6c[_0x769c('0x31')]=_[_0x769c('0x32')](_0x36a60b[_0x769c('0x31')]);_0x5e6d6c['filters']=_[_0x769c('0x33')](_0x5e6d6c[_0x769c('0x30')],_0x5e6d6c[_0x769c('0x31')]);_0x217647[_0x769c('0x34')]=_[_0x769c('0x33')](_0x5e6d6c[_0x769c('0x30')],qs['fields'](_0x36a60b['query'][_0x769c('0x35')]));_0x217647[_0x769c('0x34')]=_0x217647['attributes']['length']?_0x217647[_0x769c('0x34')]:_0x5e6d6c[_0x769c('0x30')];if(!_0x36a60b[_0x769c('0x31')][_0x769c('0x36')](_0x769c('0x37'))){_0x217647[_0x769c('0x1f')]=qs[_0x769c('0x1f')](_0x36a60b[_0x769c('0x31')][_0x769c('0x1f')]);_0x217647['offset']=qs[_0x769c('0x1c')](_0x36a60b[_0x769c('0x31')][_0x769c('0x1c')]);}_0x217647['order']=qs[_0x769c('0x38')](_0x36a60b[_0x769c('0x31')]['sort']);_0x217647[_0x769c('0x39')]=qs[_0x769c('0x3a')](_['pick'](_0x36a60b[_0x769c('0x31')],_0x5e6d6c[_0x769c('0x3a')]),_0x39a46f);if(_0x36a60b['query'][_0x769c('0x3b')]){_0x217647['where']=_[_0x769c('0x3c')](_0x217647[_0x769c('0x39')],{'$or':_[_0x769c('0x2c')](_0x39a46f,function(_0x19d0dc){if(_0x19d0dc['type']!==_0x769c('0x3d')){var _0x4ffdf1={};_0x4ffdf1[_0x19d0dc[_0x769c('0x29')]]={'$like':'%'+_0x36a60b[_0x769c('0x31')][_0x769c('0x3b')]+'%'};return _0x4ffdf1;}})});}_0x217647=_[_0x769c('0x3c')]({},_0x217647,_0x36a60b[_0x769c('0x3e')]);var _0x4c96ef={'where':_0x217647['where']};return db['ZohoAccount']['count'](_0x4c96ef)[_0x769c('0x26')](function(_0x45ff96){_0xb2e982[_0x769c('0x1e')]=_0x45ff96;if(_0x36a60b[_0x769c('0x31')]['includeAll']){_0x217647[_0x769c('0x3f')]=[{'all':!![]}];}return db[_0x769c('0x40')][_0x769c('0x41')](_0x217647);})[_0x769c('0x26')](function(_0x2bc0de){_0xb2e982[_0x769c('0x42')]=_0x2bc0de;return _0xb2e982;})[_0x769c('0x26')](respondWithFilteredResult(_0xca16fd,_0x217647))[_0x769c('0x43')](handleError(_0xca16fd,null));};exports[_0x769c('0x44')]=function(_0x33cc82,_0x415081){var _0x1dbc67={'raw':![],'where':{'id':_0x33cc82[_0x769c('0x45')]['id']}},_0x18774f={};_0x18774f[_0x769c('0x30')]=_[_0x769c('0x32')](db[_0x769c('0x40')][_0x769c('0x46')]);_0x18774f[_0x769c('0x31')]=_['keys'](_0x33cc82[_0x769c('0x31')]);_0x18774f[_0x769c('0x3a')]=_[_0x769c('0x33')](_0x18774f[_0x769c('0x30')],_0x18774f[_0x769c('0x31')]);_0x1dbc67[_0x769c('0x34')]=_[_0x769c('0x33')](_0x18774f[_0x769c('0x30')],qs['fields'](_0x33cc82[_0x769c('0x31')][_0x769c('0x35')]));_0x1dbc67['attributes']=_0x1dbc67[_0x769c('0x34')]['length']?_0x1dbc67[_0x769c('0x34')]:_0x18774f[_0x769c('0x30')];if(_0x33cc82[_0x769c('0x31')][_0x769c('0x47')]){_0x1dbc67[_0x769c('0x3f')]=[{'all':!![]}];}_0x1dbc67=_[_0x769c('0x3c')]({},_0x1dbc67,_0x33cc82[_0x769c('0x3e')]);return db[_0x769c('0x40')][_0x769c('0x48')](_0x1dbc67)['then'](handleEntityNotFound(_0x415081,null))[_0x769c('0x26')](respondWithResult(_0x415081,null))[_0x769c('0x43')](handleError(_0x415081,null));};exports['create']=function(_0x2a1e9c,_0x36d38b){return db['ZohoAccount'][_0x769c('0x49')](_0x2a1e9c[_0x769c('0x4a')],{})[_0x769c('0x26')](respondWithResult(_0x36d38b,0xc9))[_0x769c('0x43')](handleError(_0x36d38b,null));};exports['update']=function(_0x4dd74e,_0x207478){if(_0x4dd74e[_0x769c('0x4a')]['id']){delete _0x4dd74e['body']['id'];}return db[_0x769c('0x40')][_0x769c('0x48')]({'where':{'id':_0x4dd74e[_0x769c('0x45')]['id']}})[_0x769c('0x26')](handleEntityNotFound(_0x207478,null))[_0x769c('0x26')](saveUpdates(_0x4dd74e['body'],null))[_0x769c('0x26')](respondWithResult(_0x207478,null))['catch'](handleError(_0x207478,null));};exports[_0x769c('0x27')]=function(_0x359cfd,_0x2154b4){return db[_0x769c('0x40')][_0x769c('0x48')]({'where':{'id':_0x359cfd[_0x769c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2154b4,null))[_0x769c('0x26')](removeEntity(_0x2154b4,null))[_0x769c('0x43')](handleError(_0x2154b4,null));};exports[_0x769c('0x4b')]=function(_0x48bdfa,_0x4dea78,_0x8397c2){var _0x9c85fb={};var _0x1d320f={};var _0x1775f6;var _0x18d81c;return db[_0x769c('0x40')][_0x769c('0x4c')]({'where':{'id':_0x48bdfa[_0x769c('0x45')]['id']}})[_0x769c('0x26')](handleEntityNotFound(_0x4dea78,null))['then'](function(_0x579495){if(_0x579495){_0x1775f6=_0x579495;_0x1d320f[_0x769c('0x30')]=_['keys'](db[_0x769c('0x4d')]['rawAttributes']);_0x1d320f[_0x769c('0x31')]=_[_0x769c('0x32')](_0x48bdfa['query']);_0x1d320f[_0x769c('0x3a')]=_[_0x769c('0x33')](_0x1d320f[_0x769c('0x30')],_0x1d320f[_0x769c('0x31')]);_0x9c85fb[_0x769c('0x34')]=_[_0x769c('0x33')](_0x1d320f['model'],qs[_0x769c('0x35')](_0x48bdfa['query'][_0x769c('0x35')]));_0x9c85fb['attributes']=_0x9c85fb[_0x769c('0x34')][_0x769c('0x4e')]?_0x9c85fb[_0x769c('0x34')]:_0x1d320f[_0x769c('0x30')];_0x9c85fb['order']=qs[_0x769c('0x38')](_0x48bdfa[_0x769c('0x31')][_0x769c('0x38')]);_0x9c85fb[_0x769c('0x39')]=qs['filters'](_[_0x769c('0x4f')](_0x48bdfa[_0x769c('0x31')],_0x1d320f[_0x769c('0x3a')]));if(_0x48bdfa[_0x769c('0x31')][_0x769c('0x3b')]){_0x9c85fb[_0x769c('0x39')]=_[_0x769c('0x3c')](_0x9c85fb['where'],{'$or':_[_0x769c('0x2c')](_0x9c85fb[_0x769c('0x34')],function(_0x443876){var _0x301903={};_0x301903[_0x443876]={'$like':'%'+_0x48bdfa['query'][_0x769c('0x3b')]+'%'};return _0x301903;})});}_0x9c85fb=_[_0x769c('0x3c')]({},_0x9c85fb,_0x48bdfa[_0x769c('0x3e')]);return _0x1775f6[_0x769c('0x4b')](_0x9c85fb);}})[_0x769c('0x26')](function(_0x115e0b){if(_0x115e0b){_0x18d81c=_0x115e0b[_0x769c('0x4e')];if(!_0x48bdfa[_0x769c('0x31')]['hasOwnProperty'](_0x769c('0x37'))){_0x9c85fb[_0x769c('0x1f')]=qs[_0x769c('0x1f')](_0x48bdfa[_0x769c('0x31')][_0x769c('0x1f')]);_0x9c85fb['offset']=qs['offset'](_0x48bdfa[_0x769c('0x31')]['offset']);}return _0x1775f6[_0x769c('0x4b')](_0x9c85fb);}})[_0x769c('0x26')](function(_0x511905){if(_0x511905){return _0x511905?{'count':_0x18d81c,'rows':_0x511905}:null;}})[_0x769c('0x26')](respondWithResult(_0x4dea78,null))[_0x769c('0x43')](handleError(_0x4dea78,null));};exports[_0x769c('0x50')]=function(_0x3692b8,_0x11b3d0,_0x5dd4db){if(_0x3692b8['body']['id']){delete _0x3692b8[_0x769c('0x4a')]['id'];}return db[_0x769c('0x40')][_0x769c('0x4c')]({'where':{'id':_0x3692b8[_0x769c('0x45')]['id']}})['then'](handleEntityNotFound(_0x11b3d0,null))[_0x769c('0x26')](function(_0x1c5a8b){if(_0x1c5a8b){_0x3692b8['body']['AccountId']=_0x1c5a8b['id'];_0x3692b8[_0x769c('0x4a')][_0x769c('0x51')]=integrations[_0x769c('0x52')](_0x3692b8[_0x769c('0x4a')]['channel'],_0x3692b8[_0x769c('0x4a')][_0x769c('0x2e')]);_0x3692b8[_0x769c('0x4a')][_0x769c('0x53')]=integrations[_0x769c('0x54')](_0x3692b8[_0x769c('0x4a')][_0x769c('0x55')],_0x3692b8[_0x769c('0x4a')][_0x769c('0x2e')]);return db[_0x769c('0x4d')][_0x769c('0x49')](_0x3692b8[_0x769c('0x4a')],{'include':[{'model':db['ZohoField'],'as':_0x769c('0x51')},{'model':db[_0x769c('0x56')],'as':_0x769c('0x53')}]});}return null;})[_0x769c('0x26')](respondWithResult(_0x11b3d0,null))[_0x769c('0x43')](handleError(_0x11b3d0,null));};function getAccessToken(_0x2c89a3){return new Promise(function(_0x28915f,_0x22dfa9){var _0x461137;switch(_0x2c89a3['zone']){case'US':_0x461137=_0x769c('0x57');break;case'AU':_0x461137=_0x769c('0x58');break;case'EU':_0x461137=_0x769c('0x59');break;case'IN':_0x461137=_0x769c('0x5a');break;case'CN':_0x461137=_0x769c('0x5b');break;default:_0x461137=_0x769c('0x59');break;}var _0x17dc8c={'method':_0x769c('0x5c'),'uri':_0x461137+'/oauth/v2/token','qs':{'refresh_token':_0x2c89a3[_0x769c('0x5d')],'client_id':_0x2c89a3[_0x769c('0x5e')],'client_secret':_0x2c89a3[_0x769c('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x17dc8c)[_0x769c('0x26')](function(_0x4ef5c1){if(_0x4ef5c1['access_token']){_0x28915f(_0x4ef5c1[_0x769c('0x60')]);}else{_0x22dfa9('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x254da3){_0x22dfa9(_0x254da3);});});}exports['getFields']=function(_0x136db8,_0x521ab0,_0x1702a6){var _0x1031bb,_0x108f7d,_0x2d3cf1,_0x2cad68,_0x331ec4;return db[_0x769c('0x40')]['findOne']({'where':{'id':_0x136db8[_0x769c('0x45')]['id']},'attributes':['id',_0x769c('0x61'),_0x769c('0x62'),_0x769c('0x5e'),_0x769c('0x5f'),'serverUrl',_0x769c('0x63'),'refreshToken']})[_0x769c('0x26')](handleEntityNotFound(_0x521ab0,null))['then'](function(_0x36c6f0){_0x331ec4=_0x36c6f0;_0x1031bb=_0x331ec4[_0x769c('0x61')];_0x108f7d=_0x1031bb===_0x769c('0x64')?'eu':'com';_0x2d3cf1=_0x331ec4[_0x769c('0x65')];var _0x1cd671=_0x2d3cf1[_0x769c('0x66')](-0x1);if(_0x1cd671==='/'||_0x1cd671==='\x5c'||_0x1cd671===':'){_0x2d3cf1=_0x2d3cf1['substring'](0x0,_0x2d3cf1['lastIndexOf'](_0x1cd671));}if(!_0x331ec4['refreshToken']){throw new Error(_0x769c('0x67'));}return getAccessToken(_0x331ec4);})[_0x769c('0x26')](function(_0x362b90){if(_0x362b90){return rp({'method':'GET','uri':util[_0x769c('0x68')](_0x769c('0x69'),_0x108f7d),'qs':{'module':_0x769c('0x6a')},'headers':{'Authorization':_0x769c('0x6b')+_0x362b90},'json':!![]});}})[_0x769c('0x26')](function(_0x2ae10f){if(_0x2ae10f){if(_0x2ae10f['response']&&_0x2ae10f[_0x769c('0x6c')][_0x769c('0x6d')]){throw new Error(_0x2ae10f[_0x769c('0x6c')][_0x769c('0x6d')]['message']);}var _0x11f9eb=[];var _0x4b7f19=[];var _0x52b567=['Owner',_0x769c('0x6e'),_0x769c('0x6f'),_0x769c('0x70'),'Call_Duration','Call_Result','Call_Start_Time',_0x769c('0x71')];_0x4b7f19=_[_0x769c('0x72')](_0x2ae10f[_0x769c('0x35')],function(_0x5a8c7a){return _0x52b567[_0x769c('0x73')](_0x5a8c7a['api_name']);});for(var _0x52497d=0x0;_0x52497d<_0x4b7f19[_0x769c('0x4e')];_0x52497d++){if(_0x4b7f19[_0x52497d][_0x769c('0x74')]===![]){_0x11f9eb[_0x769c('0x75')]({'id':_0x4b7f19[_0x52497d]['id'],'name':_0x4b7f19[_0x52497d][_0x769c('0x76')],'custom':_0x4b7f19[_0x52497d]['custom_field'],'options':_0x4b7f19[_0x52497d][_0x769c('0x77')]==='picklist'&&_0x4b7f19[_0x52497d]['pick_list_values']['length']>-0x1?_[_0x769c('0x2c')](_0x4b7f19[_0x52497d][_0x769c('0x78')],function(_0x1ee7e2){return{'name':_0x1ee7e2,'value':_0x1ee7e2};}):[]});}}return{'count':_0x11f9eb['length'],'rows':_0x11f9eb};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x521ab0,null))[_0x769c('0x43')](function(_0x1d18d0){var _0x43a59e=_0x136db8[_0x769c('0x31')]['test']?0x1f4:_0x1d18d0['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x769c('0x79'),_0x43a59e,JSON['stringify'](_0x1d18d0));delete _0x1d18d0['name'];if(_0x43a59e===0x191){_0x43a59e=0x190;}_0x521ab0['status'](_0x43a59e)[_0x769c('0x2a')](_0x136db8['query'][_0x769c('0x7a')]?{'message':_0x769c('0x7b'),'statusCode':_0x1d18d0[_0x769c('0x7c')]}:_0x1d18d0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6fb02dd..42f7cf0 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 _0x7ec6=['slice','lastIndexOf','https://accounts.zoho.com','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','../../config/logger','api','moment','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','clientSecret','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','serverUrl','code','application/x-www-form-urlencoded','then','parse','refreshToken','format','name','error','inspect','zone','host'];(function(_0x5349ca,_0x36de95){var _0x368856=function(_0xf12434){while(--_0xf12434){_0x5349ca['push'](_0x5349ca['shift']());}};_0x368856(++_0x36de95);}(_0x7ec6,0xfe));var _0x67ec=function(_0x953701,_0x5d2bf2){_0x953701=_0x953701-0x0;var _0x5a2c8f=_0x7ec6[_0x953701];return _0x5a2c8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x67ec('0x0'))(_0x67ec('0x1'));var moment=require(_0x67ec('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x67ec('0x3'));var rimraf=require(_0x67ec('0x4'));var config=require('../../config/environment');var attributes=require(_0x67ec('0x5'));var integrations=require(_0x67ec('0x6'));module[_0x67ec('0x7')]=function(_0x4bbbe4,_0x54d400){return _0x4bbbe4['define'](_0x67ec('0x8'),attributes,{'tableName':_0x67ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29f5a3,_0x269eb9,_0x1cdd8b){if(_0x29f5a3['changed']('zone')||_0x29f5a3[_0x67ec('0xa')]('serverUrl')||_0x29f5a3['changed']('clientId')||_0x29f5a3['changed'](_0x67ec('0xb'))||_0x29f5a3[_0x67ec('0xa')]('code')||_0x29f5a3[_0x67ec('0xa')]('host')){var _0x336a67,_0x173b75;_0x336a67=_0x29f5a3['serverUrl'];var _0x2d9792=_0x336a67['slice'](-0x1);if(_0x2d9792==='/'||_0x2d9792==='\x5c'||_0x2d9792===':'){_0x336a67=_0x336a67[_0x67ec('0xc')](0x0,_0x336a67['lastIndexOf'](_0x2d9792));}switch(_0x29f5a3['zone']){case'US':_0x173b75='https://accounts.zoho.com';break;case'AU':_0x173b75=_0x67ec('0xd');break;case'IN':_0x173b75=_0x67ec('0xe');break;case'CN':_0x173b75=_0x67ec('0xf');break;default:_0x173b75=_0x67ec('0x10');break;}var _0x447e29={'method':_0x67ec('0x11'),'uri':_0x173b75+_0x67ec('0x12'),'form':{'grant_type':_0x67ec('0x13'),'client_id':_0x29f5a3[_0x67ec('0x14')],'client_secret':_0x29f5a3[_0x67ec('0xb')],'redirect_uri':_0x29f5a3[_0x67ec('0x15')],'code':_0x29f5a3[_0x67ec('0x16')]},'headers':{'Content-Type':_0x67ec('0x17')}};return rp(_0x447e29)[_0x67ec('0x18')](function(_0x52ddee){var _0x2592a8=JSON[_0x67ec('0x19')](_0x52ddee);if(_0x2592a8['refresh_token']){_0x29f5a3[_0x67ec('0x1a')]=_0x2592a8['refresh_token'];logger['info'](util[_0x67ec('0x1b')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']));}else{logger[_0x67ec('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']),util[_0x67ec('0x1e')](_0x2592a8,{'showHidden':![],'depth':null}));}return _0x1cdd8b(null,_0x269eb9);})['catch'](function(_0x15d5a5){logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29f5a3[_0x67ec('0x1c')],_0x29f5a3['id']),util[_0x67ec('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x1cdd8b(_0x15d5a5);});}else{return _0x1cdd8b(null,_0x269eb9);}},'beforeUpdate':function(_0xc10e93,_0x5a059a,_0x5a3f12){if(_0xc10e93[_0x67ec('0xa')](_0x67ec('0x1f'))||_0xc10e93['changed'](_0x67ec('0x15'))||_0xc10e93['changed'](_0x67ec('0x14'))||_0xc10e93[_0x67ec('0xa')](_0x67ec('0xb'))||_0xc10e93[_0x67ec('0xa')](_0x67ec('0x16'))||_0xc10e93['changed'](_0x67ec('0x20'))){var _0xca919,_0x38d539;_0xca919=_0xc10e93['serverUrl'];var _0x3ad836=_0xca919[_0x67ec('0x21')](-0x1);if(_0x3ad836==='/'||_0x3ad836==='\x5c'||_0x3ad836===':'){_0xca919=_0xca919[_0x67ec('0xc')](0x0,_0xca919[_0x67ec('0x22')](_0x3ad836));}switch(_0xc10e93[_0x67ec('0x1f')]){case'US':_0x38d539=_0x67ec('0x23');break;case'AU':_0x38d539=_0x67ec('0xd');break;case'IN':_0x38d539=_0x67ec('0xe');break;case'CN':_0x38d539=_0x67ec('0xf');break;default:_0x38d539=_0x67ec('0x10');break;}var _0x3d9590={'method':'POST','uri':_0x38d539+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0xc10e93[_0x67ec('0x14')],'client_secret':_0xc10e93[_0x67ec('0xb')],'redirect_uri':_0xc10e93[_0x67ec('0x15')],'code':_0xc10e93[_0x67ec('0x16')]},'headers':{'Content-Type':_0x67ec('0x17')}};return rp(_0x3d9590)[_0x67ec('0x18')](function(_0x1393f8){var _0x4b8a15=JSON[_0x67ec('0x19')](_0x1393f8);if(_0x4b8a15[_0x67ec('0x24')]){_0xc10e93['refreshToken']=_0x4b8a15[_0x67ec('0x24')];logger[_0x67ec('0x25')](util[_0x67ec('0x1b')](_0x67ec('0x26'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']));}else{logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')](_0x67ec('0x27'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']),util[_0x67ec('0x1e')](_0x4b8a15,{'showHidden':![],'depth':null}));}return _0x5a3f12(null,_0x5a059a);})[_0x67ec('0x28')](function(_0x4faa44){logger[_0x67ec('0x1d')](util[_0x67ec('0x1b')](_0x67ec('0x27'),_0xc10e93[_0x67ec('0x1c')],_0xc10e93['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5a3f12(_0x4faa44);});}else{return _0x5a3f12(null,_0x5a059a);}}}});}; \ No newline at end of file +var _0x6d14=['path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','code','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','zone','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25870c,_0x22e7f5){var _0x122037=function(_0x5c300e){while(--_0x5c300e){_0x25870c['push'](_0x25870c['shift']());}};_0x122037(++_0x22e7f5);}(_0x6d14,0x134));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x46d1('0x0'));var util=require(_0x46d1('0x1'));var logger=require(_0x46d1('0x2'))(_0x46d1('0x3'));var moment=require(_0x46d1('0x4'));var BPromise=require(_0x46d1('0x5'));var rp=require(_0x46d1('0x6'));var fs=require('fs');var path=require(_0x46d1('0x7'));var rimraf=require('rimraf');var config=require(_0x46d1('0x8'));var attributes=require(_0x46d1('0x9'));var integrations=require(_0x46d1('0xa'));module[_0x46d1('0xb')]=function(_0x55c105,_0x3f0838){return _0x55c105[_0x46d1('0xc')](_0x46d1('0xd'),attributes,{'tableName':_0x46d1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f6e99,_0x2584b5,_0x373261){if(_0x3f6e99['changed']('zone')||_0x3f6e99[_0x46d1('0xf')](_0x46d1('0x10'))||_0x3f6e99[_0x46d1('0xf')](_0x46d1('0x11'))||_0x3f6e99[_0x46d1('0xf')](_0x46d1('0x12'))||_0x3f6e99[_0x46d1('0xf')]('code')||_0x3f6e99['changed']('host')){var _0x47f55d,_0x399036;_0x47f55d=_0x3f6e99[_0x46d1('0x10')];var _0x132f75=_0x47f55d[_0x46d1('0x13')](-0x1);if(_0x132f75==='/'||_0x132f75==='\x5c'||_0x132f75===':'){_0x47f55d=_0x47f55d[_0x46d1('0x14')](0x0,_0x47f55d[_0x46d1('0x15')](_0x132f75));}switch(_0x3f6e99['zone']){case'US':_0x399036=_0x46d1('0x16');break;case'AU':_0x399036=_0x46d1('0x17');break;case'IN':_0x399036=_0x46d1('0x18');break;case'CN':_0x399036='https://accounts.zoho.com.cn';break;default:_0x399036=_0x46d1('0x19');break;}var _0x369953={'method':_0x46d1('0x1a'),'uri':_0x399036+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3f6e99['clientId'],'client_secret':_0x3f6e99[_0x46d1('0x12')],'redirect_uri':_0x3f6e99[_0x46d1('0x10')],'code':_0x3f6e99[_0x46d1('0x1b')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x369953)['then'](function(_0x1678ed){var _0xbca974=JSON[_0x46d1('0x1c')](_0x1678ed);if(_0xbca974[_0x46d1('0x1d')]){_0x3f6e99[_0x46d1('0x1e')]=_0xbca974['refresh_token'];logger[_0x46d1('0x1f')](util[_0x46d1('0x20')](_0x46d1('0x21'),_0x3f6e99[_0x46d1('0x22')],_0x3f6e99['id']));}else{logger[_0x46d1('0x23')](util[_0x46d1('0x20')](_0x46d1('0x24'),_0x3f6e99[_0x46d1('0x22')],_0x3f6e99['id']),util[_0x46d1('0x25')](_0xbca974,{'showHidden':![],'depth':null}));}return _0x373261(null,_0x2584b5);})['catch'](function(_0x584aa5){logger[_0x46d1('0x23')](util[_0x46d1('0x20')](_0x46d1('0x24'),_0x3f6e99['name'],_0x3f6e99['id']),util[_0x46d1('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x373261(_0x584aa5);});}else{return _0x373261(null,_0x2584b5);}},'beforeUpdate':function(_0xbf1b7f,_0x2f51ce,_0x468f80){if(_0xbf1b7f[_0x46d1('0xf')](_0x46d1('0x26'))||_0xbf1b7f[_0x46d1('0xf')](_0x46d1('0x10'))||_0xbf1b7f[_0x46d1('0xf')](_0x46d1('0x11'))||_0xbf1b7f[_0x46d1('0xf')](_0x46d1('0x12'))||_0xbf1b7f[_0x46d1('0xf')](_0x46d1('0x1b'))||_0xbf1b7f[_0x46d1('0xf')]('host')){var _0x3f9eed,_0x36d0ca;_0x3f9eed=_0xbf1b7f[_0x46d1('0x10')];var _0x24465d=_0x3f9eed[_0x46d1('0x13')](-0x1);if(_0x24465d==='/'||_0x24465d==='\x5c'||_0x24465d===':'){_0x3f9eed=_0x3f9eed[_0x46d1('0x14')](0x0,_0x3f9eed['lastIndexOf'](_0x24465d));}switch(_0xbf1b7f[_0x46d1('0x26')]){case'US':_0x36d0ca=_0x46d1('0x16');break;case'AU':_0x36d0ca=_0x46d1('0x17');break;case'IN':_0x36d0ca=_0x46d1('0x18');break;case'CN':_0x36d0ca=_0x46d1('0x27');break;default:_0x36d0ca='https://accounts.zoho.eu';break;}var _0x135276={'method':'POST','uri':_0x36d0ca+_0x46d1('0x28'),'form':{'grant_type':_0x46d1('0x29'),'client_id':_0xbf1b7f[_0x46d1('0x11')],'client_secret':_0xbf1b7f[_0x46d1('0x12')],'redirect_uri':_0xbf1b7f[_0x46d1('0x10')],'code':_0xbf1b7f['code']},'headers':{'Content-Type':_0x46d1('0x2a')}};return rp(_0x135276)[_0x46d1('0x2b')](function(_0xc41fb5){var _0x153261=JSON['parse'](_0xc41fb5);if(_0x153261[_0x46d1('0x1d')]){_0xbf1b7f[_0x46d1('0x1e')]=_0x153261[_0x46d1('0x1d')];logger[_0x46d1('0x1f')](util[_0x46d1('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbf1b7f['name'],_0xbf1b7f['id']));}else{logger[_0x46d1('0x23')](util[_0x46d1('0x20')](_0x46d1('0x24'),_0xbf1b7f[_0x46d1('0x22')],_0xbf1b7f['id']),util[_0x46d1('0x25')](_0x153261,{'showHidden':![],'depth':null}));}return _0x468f80(null,_0x2f51ce);})[_0x46d1('0x2c')](function(_0x241751){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbf1b7f[_0x46d1('0x22')],_0xbf1b7f['id']),util[_0x46d1('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x468f80(_0x241751);});}else{return _0x468f80(null,_0x2f51ce);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 90942dd..1b26674 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 _0x6888=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','info','result','catch','GetZohoAccount','options','raw','where','attributes','map','include','model','ShowZohoAccount','ZohoAccount','find'];(function(_0x2511c0,_0x29a147){var _0x3afda5=function(_0x99de5){while(--_0x99de5){_0x2511c0['push'](_0x2511c0['shift']());}};_0x3afda5(++_0x29a147);}(_0x6888,0xd2));var _0x8688=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6888[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x8688('0x0'));var util=require('util');var moment=require(_0x8688('0x1'));var BPromise=require(_0x8688('0x2'));var rs=require(_0x8688('0x3'));var fs=require('fs');var Redis=require(_0x8688('0x4'));var db=require(_0x8688('0x5'))['db'];var utils=require(_0x8688('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8688('0x7'));var jayson=require(_0x8688('0x8'));var client=jayson[_0x8688('0x9')][_0x8688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa1a28,_0xcc92be,_0x5860a8){return new BPromise(function(_0x457991,_0x15f2b9){return client[_0x8688('0xb')](_0xfa1a28,_0x5860a8)[_0x8688('0xc')](function(_0x18723c){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xcc92be,_0x8688('0xd'));logger[_0x8688('0xe')](_0x8688('0xf'),_0xcc92be,_0x8688('0xd'),JSON[_0x8688('0x10')](_0x18723c));if(_0x18723c[_0x8688('0x11')]){if(_0x18723c[_0x8688('0x11')][_0x8688('0x12')]===0x1f4){logger[_0x8688('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xcc92be,_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);return _0x15f2b9(_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);}logger[_0x8688('0x11')](_0x8688('0x14'),_0xcc92be,_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);return _0x457991(_0x18723c[_0x8688('0x11')][_0x8688('0x13')]);}else{logger[_0x8688('0x15')](_0x8688('0x14'),_0xcc92be,'request\x20sent');_0x457991(_0x18723c[_0x8688('0x16')][_0x8688('0x13')]);}})[_0x8688('0x17')](function(_0x5ef2e6){logger[_0x8688('0x11')](_0x8688('0x14'),_0xcc92be,_0x5ef2e6);_0x15f2b9(_0x5ef2e6);});});}exports[_0x8688('0x18')]=function(_0x48eab9){var _0x48bcc9=this;return new Promise(function(_0x3c3021,_0x179355){return db['ZohoAccount']['findAll']({'raw':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1a')]===undefined?!![]:![]:!![],'where':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1b')]||null:null,'attributes':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')][_0x8688('0x1c')]||null:null,'limit':_0x48eab9['options']?_0x48eab9[_0x8688('0x19')]['limit']||null:null,'include':_0x48eab9[_0x8688('0x19')]?_0x48eab9[_0x8688('0x19')]['include']?_[_0x8688('0x1d')](_0x48eab9['options'][_0x8688('0x1e')],function(_0x3e92cd){return{'model':db[_0x3e92cd[_0x8688('0x1f')]],'as':_0x3e92cd['as'],'attributes':_0x3e92cd[_0x8688('0x1c')],'include':_0x3e92cd[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x3e92cd[_0x8688('0x1e')],function(_0x1e6aca){return{'model':db[_0x1e6aca['model']],'as':_0x1e6aca['as'],'attributes':_0x1e6aca[_0x8688('0x1c')],'include':_0x1e6aca[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x1e6aca[_0x8688('0x1e')],function(_0x4d4b9c){return{'model':db[_0x4d4b9c[_0x8688('0x1f')]],'as':_0x4d4b9c['as'],'attributes':_0x4d4b9c[_0x8688('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8688('0xc')](function(_0x481feb){logger[_0x8688('0x15')](_0x8688('0x18'),_0x48eab9);logger[_0x8688('0xe')]('GetZohoAccount',_0x48eab9,JSON[_0x8688('0x10')](_0x481feb));_0x3c3021(_0x481feb);})['catch'](function(_0x4ab1fb){logger['error'](_0x8688('0x18'),_0x4ab1fb[_0x8688('0x13')],_0x48eab9);_0x179355(_0x48bcc9[_0x8688('0x11')](0x1f4,_0x4ab1fb['message']));});});};exports[_0x8688('0x20')]=function(_0x24c55a){var _0xc3c53f=this;return new Promise(function(_0x2fabfa,_0x1af3d5){return db[_0x8688('0x21')][_0x8688('0x22')]({'raw':_0x24c55a[_0x8688('0x19')]?_0x24c55a[_0x8688('0x19')][_0x8688('0x1a')]===undefined?!![]:![]:!![],'where':_0x24c55a[_0x8688('0x19')]?_0x24c55a['options'][_0x8688('0x1b')]||null:null,'attributes':_0x24c55a['options']?_0x24c55a[_0x8688('0x19')][_0x8688('0x1c')]||null:null,'include':_0x24c55a['options']?_0x24c55a[_0x8688('0x19')][_0x8688('0x1e')]?_['map'](_0x24c55a['options'][_0x8688('0x1e')],function(_0x15ceb6){return{'model':db[_0x15ceb6[_0x8688('0x1f')]],'as':_0x15ceb6['as'],'attributes':_0x15ceb6['attributes'],'include':_0x15ceb6['include']?_[_0x8688('0x1d')](_0x15ceb6[_0x8688('0x1e')],function(_0x2c20ab){return{'model':db[_0x2c20ab['model']],'as':_0x2c20ab['as'],'attributes':_0x2c20ab['attributes'],'include':_0x2c20ab[_0x8688('0x1e')]?_[_0x8688('0x1d')](_0x2c20ab[_0x8688('0x1e')],function(_0x397262){return{'model':db[_0x397262[_0x8688('0x1f')]],'as':_0x397262['as'],'attributes':_0x397262[_0x8688('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8688('0xc')](function(_0x47a3b3){logger[_0x8688('0x15')](_0x8688('0x20'),_0x24c55a);logger['debug'](_0x8688('0x20'),_0x24c55a,JSON[_0x8688('0x10')](_0x47a3b3));_0x2fabfa(_0x47a3b3);})[_0x8688('0x17')](function(_0x3fe6c0){logger[_0x8688('0x11')](_0x8688('0x20'),_0x3fe6c0[_0x8688('0x13')],_0x24c55a);_0x1af3d5(_0xc3c53f[_0x8688('0x11')](0x1f4,_0x3fe6c0['message']));});});}; \ No newline at end of file +var _0xfc4f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZohoAccount','findAll','raw','options','attributes','limit','include','map','model','stringify','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1cd3a9,_0x4c9bcb){var _0x192d76=function(_0xe01d9a){while(--_0xe01d9a){_0x1cd3a9['push'](_0x1cd3a9['shift']());}};_0x192d76(++_0x4c9bcb);}(_0xfc4f,0x192));var _0xffc4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var moment=require(_0xffc4('0x1'));var BPromise=require(_0xffc4('0x2'));var rs=require(_0xffc4('0x3'));var fs=require('fs');var Redis=require(_0xffc4('0x4'));var db=require(_0xffc4('0x5'))['db'];var utils=require(_0xffc4('0x6'));var logger=require('../../config/logger')(_0xffc4('0x7'));var config=require(_0xffc4('0x8'));var jayson=require(_0xffc4('0x9'));var client=jayson[_0xffc4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257ab5,_0x261d03,_0x4c69e0){return new BPromise(function(_0x3ae6a2,_0x176434){return client[_0xffc4('0xb')](_0x257ab5,_0x4c69e0)[_0xffc4('0xc')](function(_0x4c6a2b){logger[_0xffc4('0xd')](_0xffc4('0xe'),_0x261d03,_0xffc4('0xf'));logger[_0xffc4('0x10')](_0xffc4('0x11'),_0x261d03,_0xffc4('0xf'),JSON['stringify'](_0x4c6a2b));if(_0x4c6a2b[_0xffc4('0x12')]){if(_0x4c6a2b[_0xffc4('0x12')][_0xffc4('0x13')]===0x1f4){logger[_0xffc4('0x12')](_0xffc4('0xe'),_0x261d03,_0x4c6a2b[_0xffc4('0x12')][_0xffc4('0x14')]);return _0x176434(_0x4c6a2b['error'][_0xffc4('0x14')]);}logger[_0xffc4('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x261d03,_0x4c6a2b[_0xffc4('0x12')][_0xffc4('0x14')]);return _0x3ae6a2(_0x4c6a2b['error'][_0xffc4('0x14')]);}else{logger[_0xffc4('0xd')](_0xffc4('0xe'),_0x261d03,_0xffc4('0xf'));_0x3ae6a2(_0x4c6a2b['result'][_0xffc4('0x14')]);}})[_0xffc4('0x15')](function(_0x3d3baa){logger[_0xffc4('0x12')](_0xffc4('0xe'),_0x261d03,_0x3d3baa);_0x176434(_0x3d3baa);});});}exports[_0xffc4('0x16')]=function(_0x9fa8ba){var _0x4460a1=this;return new Promise(function(_0x12ca28,_0x428502){return db['ZohoAccount'][_0xffc4('0x17')]({'raw':_0x9fa8ba['options']?_0x9fa8ba['options'][_0xffc4('0x18')]===undefined?!![]:![]:!![],'where':_0x9fa8ba[_0xffc4('0x19')]?_0x9fa8ba[_0xffc4('0x19')]['where']||null:null,'attributes':_0x9fa8ba[_0xffc4('0x19')]?_0x9fa8ba[_0xffc4('0x19')][_0xffc4('0x1a')]||null:null,'limit':_0x9fa8ba[_0xffc4('0x19')]?_0x9fa8ba[_0xffc4('0x19')][_0xffc4('0x1b')]||null:null,'include':_0x9fa8ba[_0xffc4('0x19')]?_0x9fa8ba['options'][_0xffc4('0x1c')]?_[_0xffc4('0x1d')](_0x9fa8ba[_0xffc4('0x19')][_0xffc4('0x1c')],function(_0x59e32b){return{'model':db[_0x59e32b['model']],'as':_0x59e32b['as'],'attributes':_0x59e32b[_0xffc4('0x1a')],'include':_0x59e32b[_0xffc4('0x1c')]?_['map'](_0x59e32b[_0xffc4('0x1c')],function(_0x179f87){return{'model':db[_0x179f87[_0xffc4('0x1e')]],'as':_0x179f87['as'],'attributes':_0x179f87['attributes'],'include':_0x179f87[_0xffc4('0x1c')]?_['map'](_0x179f87['include'],function(_0x3bf82d){return{'model':db[_0x3bf82d[_0xffc4('0x1e')]],'as':_0x3bf82d['as'],'attributes':_0x3bf82d['attributes']};}):[]};}):[]};}):[]:[]})[_0xffc4('0xc')](function(_0x389c79){logger[_0xffc4('0xd')](_0xffc4('0x16'),_0x9fa8ba);logger[_0xffc4('0x10')](_0xffc4('0x16'),_0x9fa8ba,JSON[_0xffc4('0x1f')](_0x389c79));_0x12ca28(_0x389c79);})['catch'](function(_0xb6f213){logger[_0xffc4('0x12')](_0xffc4('0x16'),_0xb6f213[_0xffc4('0x14')],_0x9fa8ba);_0x428502(_0x4460a1[_0xffc4('0x12')](0x1f4,_0xb6f213[_0xffc4('0x14')]));});});};exports[_0xffc4('0x20')]=function(_0xceab82){var _0xc9ae76=this;return new Promise(function(_0x6335bd,_0x2f6a82){return db['ZohoAccount'][_0xffc4('0x21')]({'raw':_0xceab82[_0xffc4('0x19')]?_0xceab82[_0xffc4('0x19')][_0xffc4('0x18')]===undefined?!![]:![]:!![],'where':_0xceab82[_0xffc4('0x19')]?_0xceab82[_0xffc4('0x19')]['where']||null:null,'attributes':_0xceab82[_0xffc4('0x19')]?_0xceab82[_0xffc4('0x19')][_0xffc4('0x1a')]||null:null,'include':_0xceab82[_0xffc4('0x19')]?_0xceab82[_0xffc4('0x19')][_0xffc4('0x1c')]?_['map'](_0xceab82[_0xffc4('0x19')]['include'],function(_0x512812){return{'model':db[_0x512812[_0xffc4('0x1e')]],'as':_0x512812['as'],'attributes':_0x512812[_0xffc4('0x1a')],'include':_0x512812[_0xffc4('0x1c')]?_[_0xffc4('0x1d')](_0x512812['include'],function(_0x42dd35){return{'model':db[_0x42dd35['model']],'as':_0x42dd35['as'],'attributes':_0x42dd35[_0xffc4('0x1a')],'include':_0x42dd35[_0xffc4('0x1c')]?_['map'](_0x42dd35['include'],function(_0xe62223){return{'model':db[_0xe62223[_0xffc4('0x1e')]],'as':_0xe62223['as'],'attributes':_0xe62223[_0xffc4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xffc4('0xc')](function(_0x536d98){logger[_0xffc4('0xd')](_0xffc4('0x20'),_0xceab82);logger[_0xffc4('0x10')](_0xffc4('0x20'),_0xceab82,JSON['stringify'](_0x536d98));_0x6335bd(_0x536d98);})[_0xffc4('0x15')](function(_0x178d91){logger[_0xffc4('0x12')](_0xffc4('0x20'),_0x178d91[_0xffc4('0x14')],_0xceab82);_0x2f6a82(_0xc9ae76[_0xffc4('0x12')](0x1f4,_0x178d91[_0xffc4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0b3878d..722c4c7 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 _0xf7c3=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x332a7f,_0x3e88f5){var _0x57d651=function(_0x29cdfa){while(--_0x29cdfa){_0x332a7f['push'](_0x332a7f['shift']());}};_0x57d651(++_0x3e88f5);}(_0xf7c3,0x161));var _0x3f7c=function(_0x19d87d,_0x45800d){_0x19d87d=_0x19d87d-0x0;var _0x422c8e=_0xf7c3[_0x19d87d];return _0x422c8e;};'use strict';var multer=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var path=require('path');var timeout=require(_0x3f7c('0x2'));var express=require(_0x3f7c('0x3'));var router=express[_0x3f7c('0x4')]();var fs_extra=require(_0x3f7c('0x5'));var auth=require(_0x3f7c('0x6'));var interaction=require(_0x3f7c('0x7'));var config=require(_0x3f7c('0x8'));var controller=require(_0x3f7c('0x9'));router[_0x3f7c('0xa')]('/',auth[_0x3f7c('0xb')](),controller[_0x3f7c('0xc')]);router[_0x3f7c('0xa')](_0x3f7c('0xd'),auth['isAuthenticated'](),controller[_0x3f7c('0xe')]);router[_0x3f7c('0xa')](_0x3f7c('0xf'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x10')]);router['get'](_0x3f7c('0x11'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x12')]);router[_0x3f7c('0xa')](_0x3f7c('0x13'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x14')]);router[_0x3f7c('0x15')]('/',auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x16')]);router['put'](_0x3f7c('0xd'),auth[_0x3f7c('0xb')](),controller[_0x3f7c('0x17')]);router[_0x3f7c('0x18')](_0x3f7c('0xd'),auth['isAuthenticated'](),controller[_0x3f7c('0x19')]);module[_0x3f7c('0x1a')]=router; \ No newline at end of file +var _0x8358=['/:id/descriptions','post','create','put','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x42db18,_0x235868){var _0x5a9a37=function(_0x10dd8f){while(--_0x10dd8f){_0x42db18['push'](_0x42db18['shift']());}};_0x5a9a37(++_0x235868);}(_0x8358,0x1d4));var _0x8835=function(_0x32ef19,_0x18434b){_0x32ef19=_0x32ef19-0x0;var _0x25228f=_0x8358[_0x32ef19];return _0x25228f;};'use strict';var multer=require('multer');var util=require(_0x8835('0x0'));var path=require(_0x8835('0x1'));var timeout=require('connect-timeout');var express=require(_0x8835('0x2'));var router=express[_0x8835('0x3')]();var fs_extra=require(_0x8835('0x4'));var auth=require(_0x8835('0x5'));var interaction=require(_0x8835('0x6'));var config=require('../../config/environment');var controller=require(_0x8835('0x7'));router[_0x8835('0x8')]('/',auth['isAuthenticated'](),controller[_0x8835('0x9')]);router[_0x8835('0x8')](_0x8835('0xa'),auth[_0x8835('0xb')](),controller['show']);router[_0x8835('0x8')](_0x8835('0xc'),auth['isAuthenticated'](),controller[_0x8835('0xd')]);router[_0x8835('0x8')](_0x8835('0xe'),auth[_0x8835('0xb')](),controller['getSubjects']);router[_0x8835('0x8')](_0x8835('0xf'),auth[_0x8835('0xb')](),controller['getDescriptions']);router[_0x8835('0x10')]('/',auth[_0x8835('0xb')](),controller[_0x8835('0x11')]);router[_0x8835('0x12')](_0x8835('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8835('0xa'),auth[_0x8835('0xb')](),controller[_0x8835('0x13')]);module[_0x8835('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9d6019e..453a346 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 _0x29fb=['nothing','contact_lead','sequelize','STRING','ENUM','lead','contact'];(function(_0x189496,_0x41b01c){var _0xf3d805=function(_0x2cc829){while(--_0x2cc829){_0x189496['push'](_0x189496['shift']());}};_0xf3d805(++_0x41b01c);}(_0x29fb,0x13d));var _0xb29f=function(_0x4464e0,_0x23186c){_0x4464e0=_0x4464e0-0x0;var _0x496a70=_0x29fb[_0x4464e0];return _0x496a70;};'use strict';var Sequelize=require(_0xb29f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb29f('0x1')]},'moduleCreate':{'type':Sequelize[_0xb29f('0x2')](_0xb29f('0x3'),_0xb29f('0x4'),_0xb29f('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xb29f('0x2')]('contact_lead',_0xb29f('0x4'),_0xb29f('0x3')),'defaultValue':_0xb29f('0x6')},'description':{'type':Sequelize[_0xb29f('0x1')]}}; \ No newline at end of file +var _0xdade=['contact_lead','sequelize','ENUM','lead','contact'];(function(_0x473b87,_0x3fb8d3){var _0x41e241=function(_0x3a4da4){while(--_0x3a4da4){_0x473b87['push'](_0x473b87['shift']());}};_0x41e241(++_0x3fb8d3);}(_0xdade,0x1e6));var _0xedad=function(_0x4c7e8e,_0x3c5035){_0x4c7e8e=_0x4c7e8e-0x0;var _0x503c3f=_0xdade[_0x4c7e8e];return _0x503c3f;};'use strict';var Sequelize=require(_0xedad('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xedad('0x1')](_0xedad('0x2'),'contact','nothing'),'defaultValue':_0xedad('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xedad('0x3'),_0xedad('0x2')),'defaultValue':_0xedad('0x4')},'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 ebc6314..62448a2 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 _0x77b3=['filter','VIRTUAL','options','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','getFields','findOne','ZohoField','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where'];(function(_0x4f1a12,_0x401962){var _0x1fabac=function(_0x21c68f){while(--_0x21c68f){_0x4f1a12['push'](_0x4f1a12['shift']());}};_0x1fabac(++_0x401962);}(_0x77b3,0x1ef));var _0x377b=function(_0x1edc74,_0xd181ef){_0x1edc74=_0x1edc74-0x0;var _0x44548b=_0x77b3[_0x1edc74];return _0x44548b;};'use strict';var emlformat=require(_0x377b('0x0'));var rimraf=require(_0x377b('0x1'));var zipdir=require(_0x377b('0x2'));var jsonpatch=require(_0x377b('0x3'));var rp=require('request-promise');var moment=require(_0x377b('0x4'));var BPromise=require(_0x377b('0x5'));var Mustache=require(_0x377b('0x6'));var util=require('util');var path=require(_0x377b('0x7'));var sox=require(_0x377b('0x8'));var csv=require('to-csv');var ejs=require(_0x377b('0x9'));var fs=require('fs');var fs_extra=require(_0x377b('0xa'));var _=require(_0x377b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x377b('0xc'));var deskjs=require(_0x377b('0xd'));var toCsv=require(_0x377b('0xe'));var querystring=require(_0x377b('0xf'));var Papa=require(_0x377b('0x10'));var Redis=require(_0x377b('0x11'));var authService=require(_0x377b('0x12'));var qs=require(_0x377b('0x13'));var as=require(_0x377b('0x14'));var hardwareService=require(_0x377b('0x15'));var logger=require('../../config/logger')(_0x377b('0x16'));var utils=require(_0x377b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49e503,_0xd4ca11){_0xd4ca11=_0xd4ca11||0xcc;return function(_0xd3eb72){if(_0xd3eb72){return _0x49e503[_0x377b('0x18')](_0xd4ca11);}return _0x49e503[_0x377b('0x19')](_0xd4ca11)[_0x377b('0x1a')]();};}function respondWithResult(_0x415b78,_0x1c84a2){_0x1c84a2=_0x1c84a2||0xc8;return function(_0x264ed4){if(_0x264ed4){return _0x415b78[_0x377b('0x19')](_0x1c84a2)[_0x377b('0x1b')](_0x264ed4);}};}function respondWithFilteredResult(_0x4acb65,_0x5dd8e7){return function(_0x3bfaef){if(_0x3bfaef){var _0x445ba5=typeof _0x5dd8e7[_0x377b('0x1c')]===_0x377b('0x1d')&&typeof _0x5dd8e7[_0x377b('0x1e')]==='undefined';var _0x26f9a0=_0x3bfaef['count'];var _0x5cf310=_0x445ba5?0x0:_0x5dd8e7[_0x377b('0x1c')];var _0x418d08=_0x445ba5?_0x3bfaef[_0x377b('0x1f')]:_0x5dd8e7[_0x377b('0x1c')]+_0x5dd8e7[_0x377b('0x1e')];var _0x5af534;if(_0x418d08>=_0x26f9a0){_0x418d08=_0x26f9a0;_0x5af534=0xc8;}else{_0x5af534=0xce;}_0x4acb65[_0x377b('0x19')](_0x5af534);return _0x4acb65[_0x377b('0x20')](_0x377b('0x21'),_0x5cf310+'-'+_0x418d08+'/'+_0x26f9a0)[_0x377b('0x1b')](_0x3bfaef);}return null;};}function patchUpdates(_0x2da92d){return function(_0x175413){try{jsonpatch[_0x377b('0x22')](_0x175413,_0x2da92d,!![]);}catch(_0x450d22){return BPromise[_0x377b('0x23')](_0x450d22);}return _0x175413[_0x377b('0x24')]();};}function saveUpdates(_0x25cde6,_0x9e239b){return function(_0x1f2745){if(_0x1f2745){return _0x1f2745[_0x377b('0x25')](_0x25cde6)[_0x377b('0x26')](function(_0x5da948){return _0x5da948;});}return null;};}function removeEntity(_0x4d310c,_0x5c3671){return function(_0x2b0acd){if(_0x2b0acd){return _0x2b0acd['destroy']()[_0x377b('0x26')](function(){_0x4d310c['status'](0xcc)[_0x377b('0x1a')]();});}};}function handleEntityNotFound(_0x5d4215,_0x15836f){return function(_0x2e8873){if(!_0x2e8873){_0x5d4215[_0x377b('0x18')](0x194);}return _0x2e8873;};}function handleError(_0x44715f,_0xc9eb9c){_0xc9eb9c=_0xc9eb9c||0x1f4;return function(_0x429f80){logger['error'](_0x429f80[_0x377b('0x27')]);if(_0x429f80[_0x377b('0x28')]){delete _0x429f80[_0x377b('0x28')];}_0x44715f[_0x377b('0x19')](_0xc9eb9c)['send'](_0x429f80);};}exports[_0x377b('0x29')]=function(_0x2f69fa,_0x5de4a5){var _0x55b5ce={},_0x2ba280={},_0x53e07d={'count':0x0,'rows':[]};var _0x474962=_[_0x377b('0x2a')](db[_0x377b('0x2b')][_0x377b('0x2c')],function(_0x419055){return{'name':_0x419055[_0x377b('0x2d')],'type':_0x419055['type'][_0x377b('0x2e')]};});_0x2ba280[_0x377b('0x2f')]=_[_0x377b('0x2a')](_0x474962,'name');_0x2ba280[_0x377b('0x30')]=_[_0x377b('0x31')](_0x2f69fa[_0x377b('0x30')]);_0x2ba280[_0x377b('0x32')]=_[_0x377b('0x33')](_0x2ba280['model'],_0x2ba280[_0x377b('0x30')]);_0x55b5ce['attributes']=_['intersection'](_0x2ba280[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x2f69fa[_0x377b('0x30')][_0x377b('0x34')]));_0x55b5ce[_0x377b('0x35')]=_0x55b5ce[_0x377b('0x35')][_0x377b('0x36')]?_0x55b5ce[_0x377b('0x35')]:_0x2ba280['model'];if(!_0x2f69fa[_0x377b('0x30')]['hasOwnProperty'](_0x377b('0x37'))){_0x55b5ce[_0x377b('0x1e')]=qs[_0x377b('0x1e')](_0x2f69fa[_0x377b('0x30')][_0x377b('0x1e')]);_0x55b5ce[_0x377b('0x1c')]=qs['offset'](_0x2f69fa[_0x377b('0x30')][_0x377b('0x1c')]);}_0x55b5ce[_0x377b('0x38')]=qs['sort'](_0x2f69fa['query']['sort']);_0x55b5ce[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x2f69fa['query'],_0x2ba280[_0x377b('0x32')]),_0x474962);if(_0x2f69fa[_0x377b('0x30')][_0x377b('0x3a')]){_0x55b5ce[_0x377b('0x39')]=_['merge'](_0x55b5ce[_0x377b('0x39')],{'$or':_[_0x377b('0x2a')](_0x474962,function(_0x4afb25){if(_0x4afb25['type']!==_0x377b('0x3b')){var _0x1e82c6={};_0x1e82c6[_0x4afb25['name']]={'$like':'%'+_0x2f69fa[_0x377b('0x30')]['filter']+'%'};return _0x1e82c6;}})});}_0x55b5ce=_['merge']({},_0x55b5ce,_0x2f69fa[_0x377b('0x3c')]);var _0x518de0={'where':_0x55b5ce['where']};return db[_0x377b('0x2b')][_0x377b('0x1f')](_0x518de0)[_0x377b('0x26')](function(_0x3b50aa){_0x53e07d[_0x377b('0x1f')]=_0x3b50aa;if(_0x2f69fa[_0x377b('0x30')]['includeAll']){_0x55b5ce[_0x377b('0x3d')]=[{'all':!![]}];}return db[_0x377b('0x2b')][_0x377b('0x3e')](_0x55b5ce);})['then'](function(_0x1e1b71){_0x53e07d[_0x377b('0x3f')]=_0x1e1b71;return _0x53e07d;})['then'](respondWithFilteredResult(_0x5de4a5,_0x55b5ce))[_0x377b('0x40')](handleError(_0x5de4a5,null));};exports[_0x377b('0x41')]=function(_0x4ced79,_0x147a5){var _0x29bc9e={'raw':![],'where':{'id':_0x4ced79[_0x377b('0x42')]['id']}},_0x116495={};_0x116495[_0x377b('0x2f')]=_[_0x377b('0x31')](db['ZohoConfiguration'][_0x377b('0x2c')]);_0x116495[_0x377b('0x30')]=_['keys'](_0x4ced79[_0x377b('0x30')]);_0x116495[_0x377b('0x32')]=_['intersection'](_0x116495['model'],_0x116495['query']);_0x29bc9e['attributes']=_[_0x377b('0x33')](_0x116495[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x4ced79['query'][_0x377b('0x34')]));_0x29bc9e['attributes']=_0x29bc9e[_0x377b('0x35')]['length']?_0x29bc9e['attributes']:_0x116495[_0x377b('0x2f')];if(_0x4ced79[_0x377b('0x30')]['includeAll']){_0x29bc9e[_0x377b('0x3d')]=[{'all':!![]}];}_0x29bc9e=_[_0x377b('0x43')]({},_0x29bc9e,_0x4ced79[_0x377b('0x3c')]);return db[_0x377b('0x2b')][_0x377b('0x44')](_0x29bc9e)[_0x377b('0x26')](handleEntityNotFound(_0x147a5,null))[_0x377b('0x26')](respondWithResult(_0x147a5,null))['catch'](handleError(_0x147a5,null));};exports['create']=function(_0x31f790,_0x5c81ad){return db['ZohoConfiguration'][_0x377b('0x45')](_0x31f790[_0x377b('0x46')],{})['then'](respondWithResult(_0x5c81ad,0xc9))[_0x377b('0x40')](handleError(_0x5c81ad,null));};exports[_0x377b('0x25')]=function(_0x4e441c,_0x5024b8){if(_0x4e441c[_0x377b('0x46')]['id']){delete _0x4e441c[_0x377b('0x46')]['id'];}return db['ZohoConfiguration'][_0x377b('0x44')]({'where':{'id':_0x4e441c['params']['id']}})['then'](handleEntityNotFound(_0x5024b8,null))[_0x377b('0x26')](saveUpdates(_0x4e441c[_0x377b('0x46')],null))[_0x377b('0x26')](respondWithResult(_0x5024b8,null))['catch'](handleError(_0x5024b8,null));};exports[_0x377b('0x47')]=function(_0x58427b,_0x2ab92c){return db[_0x377b('0x2b')]['find']({'where':{'id':_0x58427b['params']['id']}})['then'](handleEntityNotFound(_0x2ab92c,null))[_0x377b('0x26')](removeEntity(_0x2ab92c,null))['catch'](handleError(_0x2ab92c,null));};exports[_0x377b('0x48')]=function(_0x3034db,_0x2a988b,_0x14826a){var _0x5d14a0={};var _0x44bfb8={};var _0x51fc1b;var _0xabed6a;return db['ZohoConfiguration'][_0x377b('0x49')]({'where':{'id':_0x3034db[_0x377b('0x42')]['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x2a988b,null))[_0x377b('0x26')](function(_0x3aa44b){if(_0x3aa44b){_0x51fc1b=_0x3aa44b;_0x44bfb8[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')][_0x377b('0x2c')]);_0x44bfb8[_0x377b('0x30')]=_[_0x377b('0x31')](_0x3034db[_0x377b('0x30')]);_0x44bfb8[_0x377b('0x32')]=_[_0x377b('0x33')](_0x44bfb8[_0x377b('0x2f')],_0x44bfb8[_0x377b('0x30')]);_0x5d14a0[_0x377b('0x35')]=_[_0x377b('0x33')](_0x44bfb8[_0x377b('0x2f')],qs['fields'](_0x3034db['query']['fields']));_0x5d14a0[_0x377b('0x35')]=_0x5d14a0[_0x377b('0x35')][_0x377b('0x36')]?_0x5d14a0[_0x377b('0x35')]:_0x44bfb8[_0x377b('0x2f')];_0x5d14a0[_0x377b('0x38')]=qs[_0x377b('0x4b')](_0x3034db[_0x377b('0x30')][_0x377b('0x4b')]);_0x5d14a0[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x3034db[_0x377b('0x30')],_0x44bfb8[_0x377b('0x32')]));if(_0x3034db[_0x377b('0x30')][_0x377b('0x3a')]){_0x5d14a0[_0x377b('0x39')]=_['merge'](_0x5d14a0[_0x377b('0x39')],{'$or':_['map'](_0x5d14a0['attributes'],function(_0x223d1c){var _0x46e89d={};_0x46e89d[_0x223d1c]={'$like':'%'+_0x3034db[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x46e89d;})});}_0x5d14a0=_[_0x377b('0x43')]({},_0x5d14a0,_0x3034db[_0x377b('0x3c')]);return _0x51fc1b[_0x377b('0x48')](_0x5d14a0);}})[_0x377b('0x26')](function(_0x1d4510){if(_0x1d4510){_0xabed6a=_0x1d4510[_0x377b('0x36')];if(!_0x3034db[_0x377b('0x30')][_0x377b('0x4c')](_0x377b('0x37'))){_0x5d14a0[_0x377b('0x1e')]=qs['limit'](_0x3034db['query']['limit']);_0x5d14a0[_0x377b('0x1c')]=qs['offset'](_0x3034db[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x51fc1b[_0x377b('0x48')](_0x5d14a0);}})[_0x377b('0x26')](function(_0x223bb6){if(_0x223bb6){return _0x223bb6?{'count':_0xabed6a,'rows':_0x223bb6}:null;}})['then'](respondWithResult(_0x2a988b,null))[_0x377b('0x40')](handleError(_0x2a988b,null));};exports[_0x377b('0x4d')]=function(_0x47ab26,_0x2f5b0e,_0x1992e9){var _0xffbf33={};var _0x562228={};var _0x1b53fc;var _0x3fe50d;return db['ZohoConfiguration'][_0x377b('0x49')]({'where':{'id':_0x47ab26['params']['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x2f5b0e,null))['then'](function(_0x124a3f){if(_0x124a3f){_0x1b53fc=_0x124a3f;_0x562228[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')]['rawAttributes']);_0x562228[_0x377b('0x30')]=_[_0x377b('0x31')](_0x47ab26[_0x377b('0x30')]);_0x562228['filters']=_['intersection'](_0x562228[_0x377b('0x2f')],_0x562228[_0x377b('0x30')]);_0xffbf33[_0x377b('0x35')]=_[_0x377b('0x33')](_0x562228[_0x377b('0x2f')],qs['fields'](_0x47ab26[_0x377b('0x30')][_0x377b('0x34')]));_0xffbf33['attributes']=_0xffbf33[_0x377b('0x35')]['length']?_0xffbf33[_0x377b('0x35')]:_0x562228[_0x377b('0x2f')];_0xffbf33[_0x377b('0x38')]=qs['sort'](_0x47ab26['query']['sort']);_0xffbf33[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x47ab26['query'],_0x562228[_0x377b('0x32')]));if(_0x47ab26[_0x377b('0x30')][_0x377b('0x3a')]){_0xffbf33[_0x377b('0x39')]=_['merge'](_0xffbf33[_0x377b('0x39')],{'$or':_[_0x377b('0x2a')](_0xffbf33['attributes'],function(_0x583867){var _0x29c144={};_0x29c144[_0x583867]={'$like':'%'+_0x47ab26[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x29c144;})});}_0xffbf33=_[_0x377b('0x43')]({},_0xffbf33,_0x47ab26[_0x377b('0x3c')]);return _0x1b53fc[_0x377b('0x4d')](_0xffbf33);}})[_0x377b('0x26')](function(_0x4bf08a){if(_0x4bf08a){_0x3fe50d=_0x4bf08a['length'];if(!_0x47ab26['query'][_0x377b('0x4c')](_0x377b('0x37'))){_0xffbf33[_0x377b('0x1e')]=qs['limit'](_0x47ab26[_0x377b('0x30')][_0x377b('0x1e')]);_0xffbf33[_0x377b('0x1c')]=qs[_0x377b('0x1c')](_0x47ab26[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x1b53fc[_0x377b('0x4d')](_0xffbf33);}})[_0x377b('0x26')](function(_0x560fce){if(_0x560fce){return _0x560fce?{'count':_0x3fe50d,'rows':_0x560fce}:null;}})[_0x377b('0x26')](respondWithResult(_0x2f5b0e,null))[_0x377b('0x40')](handleError(_0x2f5b0e,null));};exports[_0x377b('0x4e')]=function(_0x4818d9,_0x59f0fd,_0x3fb654){var _0x3ff07c={};var _0x22bfd6={};var _0x2ed986;var _0xcd0548;return db[_0x377b('0x2b')][_0x377b('0x49')]({'where':{'id':_0x4818d9[_0x377b('0x42')]['id']}})[_0x377b('0x26')](handleEntityNotFound(_0x59f0fd,null))[_0x377b('0x26')](function(_0x25fb8f){if(_0x25fb8f){_0x2ed986=_0x25fb8f;_0x22bfd6[_0x377b('0x2f')]=_[_0x377b('0x31')](db[_0x377b('0x4a')][_0x377b('0x2c')]);_0x22bfd6[_0x377b('0x30')]=_['keys'](_0x4818d9[_0x377b('0x30')]);_0x22bfd6[_0x377b('0x32')]=_[_0x377b('0x33')](_0x22bfd6[_0x377b('0x2f')],_0x22bfd6[_0x377b('0x30')]);_0x3ff07c[_0x377b('0x35')]=_[_0x377b('0x33')](_0x22bfd6[_0x377b('0x2f')],qs[_0x377b('0x34')](_0x4818d9[_0x377b('0x30')][_0x377b('0x34')]));_0x3ff07c[_0x377b('0x35')]=_0x3ff07c[_0x377b('0x35')][_0x377b('0x36')]?_0x3ff07c[_0x377b('0x35')]:_0x22bfd6[_0x377b('0x2f')];_0x3ff07c['order']=qs[_0x377b('0x4b')](_0x4818d9['query'][_0x377b('0x4b')]);_0x3ff07c[_0x377b('0x39')]=qs[_0x377b('0x32')](_['pick'](_0x4818d9['query'],_0x22bfd6['filters']));if(_0x4818d9['query']['filter']){_0x3ff07c[_0x377b('0x39')]=_[_0x377b('0x43')](_0x3ff07c['where'],{'$or':_[_0x377b('0x2a')](_0x3ff07c[_0x377b('0x35')],function(_0x519f8d){var _0x54a91b={};_0x54a91b[_0x519f8d]={'$like':'%'+_0x4818d9[_0x377b('0x30')][_0x377b('0x3a')]+'%'};return _0x54a91b;})});}_0x3ff07c=_[_0x377b('0x43')]({},_0x3ff07c,_0x4818d9[_0x377b('0x3c')]);return _0x2ed986[_0x377b('0x4e')](_0x3ff07c);}})[_0x377b('0x26')](function(_0x62c9b1){if(_0x62c9b1){_0xcd0548=_0x62c9b1[_0x377b('0x36')];if(!_0x4818d9[_0x377b('0x30')][_0x377b('0x4c')](_0x377b('0x37'))){_0x3ff07c[_0x377b('0x1e')]=qs['limit'](_0x4818d9['query']['limit']);_0x3ff07c[_0x377b('0x1c')]=qs[_0x377b('0x1c')](_0x4818d9[_0x377b('0x30')][_0x377b('0x1c')]);}return _0x2ed986[_0x377b('0x4e')](_0x3ff07c);}})[_0x377b('0x26')](function(_0x4146ed){if(_0x4146ed){return _0x4146ed?{'count':_0xcd0548,'rows':_0x4146ed}:null;}})[_0x377b('0x26')](respondWithResult(_0x59f0fd,null))[_0x377b('0x40')](handleError(_0x59f0fd,null));}; \ No newline at end of file +var _0xcac0=['findAll','rows','catch','show','params','intersection','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','count','includeAll'];(function(_0x1f30bd,_0x486099){var _0xb724ac=function(_0x426837){while(--_0x426837){_0x1f30bd['push'](_0x1f30bd['shift']());}};_0xb724ac(++_0x486099);}(_0xcac0,0x10b));var _0x0cac=function(_0x5e0c9b,_0x15ed5d){_0x5e0c9b=_0x5e0c9b-0x0;var _0x172388=_0xcac0[_0x5e0c9b];return _0x172388;};'use strict';var emlformat=require(_0x0cac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cac('0x1'));var jsonpatch=require(_0x0cac('0x2'));var rp=require(_0x0cac('0x3'));var moment=require(_0x0cac('0x4'));var BPromise=require(_0x0cac('0x5'));var Mustache=require(_0x0cac('0x6'));var util=require(_0x0cac('0x7'));var path=require(_0x0cac('0x8'));var sox=require('sox');var csv=require(_0x0cac('0x9'));var ejs=require(_0x0cac('0xa'));var fs=require('fs');var fs_extra=require(_0x0cac('0xb'));var _=require('lodash');var squel=require(_0x0cac('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cac('0xd'));var deskjs=require(_0x0cac('0xe'));var toCsv=require(_0x0cac('0x9'));var querystring=require(_0x0cac('0xf'));var Papa=require(_0x0cac('0x10'));var Redis=require(_0x0cac('0x11'));var authService=require(_0x0cac('0x12'));var qs=require(_0x0cac('0x13'));var as=require(_0x0cac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cac('0x15'))(_0x0cac('0x16'));var utils=require(_0x0cac('0x17'));var config=require(_0x0cac('0x18'));var licenseUtil=require(_0x0cac('0x19'));var db=require(_0x0cac('0x1a'))['db'];function respondWithStatusCode(_0x4cb9b1,_0x2415a8){_0x2415a8=_0x2415a8||0xcc;return function(_0x29272f){if(_0x29272f){return _0x4cb9b1[_0x0cac('0x1b')](_0x2415a8);}return _0x4cb9b1[_0x0cac('0x1c')](_0x2415a8)[_0x0cac('0x1d')]();};}function respondWithResult(_0x192dde,_0x5e3317){_0x5e3317=_0x5e3317||0xc8;return function(_0x164dc4){if(_0x164dc4){return _0x192dde[_0x0cac('0x1c')](_0x5e3317)[_0x0cac('0x1e')](_0x164dc4);}};}function respondWithFilteredResult(_0x42c4d8,_0x35e032){return function(_0x48ea17){if(_0x48ea17){var _0x2fb6ac=typeof _0x35e032[_0x0cac('0x1f')]===_0x0cac('0x20')&&typeof _0x35e032['limit']===_0x0cac('0x20');var _0x100017=_0x48ea17['count'];var _0x325df9=_0x2fb6ac?0x0:_0x35e032['offset'];var _0x18b6b8=_0x2fb6ac?_0x48ea17['count']:_0x35e032[_0x0cac('0x1f')]+_0x35e032['limit'];var _0x109641;if(_0x18b6b8>=_0x100017){_0x18b6b8=_0x100017;_0x109641=0xc8;}else{_0x109641=0xce;}_0x42c4d8[_0x0cac('0x1c')](_0x109641);return _0x42c4d8[_0x0cac('0x21')](_0x0cac('0x22'),_0x325df9+'-'+_0x18b6b8+'/'+_0x100017)['json'](_0x48ea17);}return null;};}function patchUpdates(_0x373167){return function(_0x28a708){try{jsonpatch[_0x0cac('0x23')](_0x28a708,_0x373167,!![]);}catch(_0x38ce2b){return BPromise[_0x0cac('0x24')](_0x38ce2b);}return _0x28a708[_0x0cac('0x25')]();};}function saveUpdates(_0x2acb97,_0xd01590){return function(_0x7f96d5){if(_0x7f96d5){return _0x7f96d5[_0x0cac('0x26')](_0x2acb97)[_0x0cac('0x27')](function(_0x5946c5){return _0x5946c5;});}return null;};}function removeEntity(_0x52637e,_0x5b25a8){return function(_0x7bca4e){if(_0x7bca4e){return _0x7bca4e['destroy']()[_0x0cac('0x27')](function(){_0x52637e[_0x0cac('0x1c')](0xcc)[_0x0cac('0x1d')]();});}};}function handleEntityNotFound(_0x213eaa,_0x52e734){return function(_0x2babc5){if(!_0x2babc5){_0x213eaa[_0x0cac('0x1b')](0x194);}return _0x2babc5;};}function handleError(_0x59588c,_0x448a4d){_0x448a4d=_0x448a4d||0x1f4;return function(_0x3ab135){logger[_0x0cac('0x28')](_0x3ab135[_0x0cac('0x29')]);if(_0x3ab135[_0x0cac('0x2a')]){delete _0x3ab135[_0x0cac('0x2a')];}_0x59588c[_0x0cac('0x1c')](_0x448a4d)[_0x0cac('0x2b')](_0x3ab135);};}exports['index']=function(_0x5f5288,_0x4943be){var _0x1aeb22={},_0x70f1e9={},_0x72866f={'count':0x0,'rows':[]};var _0x27317f=_['map'](db[_0x0cac('0x2c')][_0x0cac('0x2d')],function(_0x1dd95d){return{'name':_0x1dd95d[_0x0cac('0x2e')],'type':_0x1dd95d['type'][_0x0cac('0x2f')]};});_0x70f1e9[_0x0cac('0x30')]=_[_0x0cac('0x31')](_0x27317f,_0x0cac('0x2a'));_0x70f1e9[_0x0cac('0x32')]=_[_0x0cac('0x33')](_0x5f5288[_0x0cac('0x32')]);_0x70f1e9[_0x0cac('0x34')]=_['intersection'](_0x70f1e9['model'],_0x70f1e9[_0x0cac('0x32')]);_0x1aeb22['attributes']=_['intersection'](_0x70f1e9[_0x0cac('0x30')],qs[_0x0cac('0x35')](_0x5f5288[_0x0cac('0x32')][_0x0cac('0x35')]));_0x1aeb22[_0x0cac('0x36')]=_0x1aeb22['attributes'][_0x0cac('0x37')]?_0x1aeb22[_0x0cac('0x36')]:_0x70f1e9['model'];if(!_0x5f5288[_0x0cac('0x32')][_0x0cac('0x38')](_0x0cac('0x39'))){_0x1aeb22['limit']=qs[_0x0cac('0x3a')](_0x5f5288[_0x0cac('0x32')][_0x0cac('0x3a')]);_0x1aeb22[_0x0cac('0x1f')]=qs[_0x0cac('0x1f')](_0x5f5288[_0x0cac('0x32')][_0x0cac('0x1f')]);}_0x1aeb22[_0x0cac('0x3b')]=qs[_0x0cac('0x3c')](_0x5f5288[_0x0cac('0x32')][_0x0cac('0x3c')]);_0x1aeb22[_0x0cac('0x3d')]=qs[_0x0cac('0x34')](_[_0x0cac('0x3e')](_0x5f5288[_0x0cac('0x32')],_0x70f1e9[_0x0cac('0x34')]),_0x27317f);if(_0x5f5288[_0x0cac('0x32')][_0x0cac('0x3f')]){_0x1aeb22[_0x0cac('0x3d')]=_['merge'](_0x1aeb22['where'],{'$or':_[_0x0cac('0x31')](_0x27317f,function(_0x283638){if(_0x283638[_0x0cac('0x40')]!=='VIRTUAL'){var _0x20e2e6={};_0x20e2e6[_0x283638[_0x0cac('0x2a')]]={'$like':'%'+_0x5f5288['query'][_0x0cac('0x3f')]+'%'};return _0x20e2e6;}})});}_0x1aeb22=_[_0x0cac('0x41')]({},_0x1aeb22,_0x5f5288[_0x0cac('0x42')]);var _0x12cdfc={'where':_0x1aeb22[_0x0cac('0x3d')]};return db[_0x0cac('0x2c')][_0x0cac('0x43')](_0x12cdfc)['then'](function(_0x215c27){_0x72866f[_0x0cac('0x43')]=_0x215c27;if(_0x5f5288[_0x0cac('0x32')][_0x0cac('0x44')]){_0x1aeb22['include']=[{'all':!![]}];}return db[_0x0cac('0x2c')][_0x0cac('0x45')](_0x1aeb22);})[_0x0cac('0x27')](function(_0x342ed2){_0x72866f[_0x0cac('0x46')]=_0x342ed2;return _0x72866f;})[_0x0cac('0x27')](respondWithFilteredResult(_0x4943be,_0x1aeb22))[_0x0cac('0x47')](handleError(_0x4943be,null));};exports[_0x0cac('0x48')]=function(_0x3c03a2,_0x4b2992){var _0x3e62ac={'raw':![],'where':{'id':_0x3c03a2[_0x0cac('0x49')]['id']}},_0x2232a6={};_0x2232a6['model']=_[_0x0cac('0x33')](db[_0x0cac('0x2c')][_0x0cac('0x2d')]);_0x2232a6['query']=_[_0x0cac('0x33')](_0x3c03a2[_0x0cac('0x32')]);_0x2232a6[_0x0cac('0x34')]=_[_0x0cac('0x4a')](_0x2232a6[_0x0cac('0x30')],_0x2232a6['query']);_0x3e62ac[_0x0cac('0x36')]=_[_0x0cac('0x4a')](_0x2232a6['model'],qs[_0x0cac('0x35')](_0x3c03a2[_0x0cac('0x32')][_0x0cac('0x35')]));_0x3e62ac['attributes']=_0x3e62ac['attributes']['length']?_0x3e62ac[_0x0cac('0x36')]:_0x2232a6[_0x0cac('0x30')];if(_0x3c03a2[_0x0cac('0x32')][_0x0cac('0x44')]){_0x3e62ac['include']=[{'all':!![]}];}_0x3e62ac=_['merge']({},_0x3e62ac,_0x3c03a2['options']);return db[_0x0cac('0x2c')][_0x0cac('0x4b')](_0x3e62ac)[_0x0cac('0x27')](handleEntityNotFound(_0x4b2992,null))[_0x0cac('0x27')](respondWithResult(_0x4b2992,null))[_0x0cac('0x47')](handleError(_0x4b2992,null));};exports[_0x0cac('0x4c')]=function(_0x52e45b,_0x308a55){return db[_0x0cac('0x2c')][_0x0cac('0x4c')](_0x52e45b[_0x0cac('0x4d')],{})[_0x0cac('0x27')](respondWithResult(_0x308a55,0xc9))['catch'](handleError(_0x308a55,null));};exports[_0x0cac('0x26')]=function(_0x2928f4,_0x16407c){if(_0x2928f4[_0x0cac('0x4d')]['id']){delete _0x2928f4['body']['id'];}return db[_0x0cac('0x2c')][_0x0cac('0x4b')]({'where':{'id':_0x2928f4['params']['id']}})[_0x0cac('0x27')](handleEntityNotFound(_0x16407c,null))[_0x0cac('0x27')](saveUpdates(_0x2928f4[_0x0cac('0x4d')],null))[_0x0cac('0x27')](respondWithResult(_0x16407c,null))[_0x0cac('0x47')](handleError(_0x16407c,null));};exports[_0x0cac('0x4e')]=function(_0x4a6518,_0x122ff4){return db[_0x0cac('0x2c')]['find']({'where':{'id':_0x4a6518[_0x0cac('0x49')]['id']}})[_0x0cac('0x27')](handleEntityNotFound(_0x122ff4,null))[_0x0cac('0x27')](removeEntity(_0x122ff4,null))[_0x0cac('0x47')](handleError(_0x122ff4,null));};exports[_0x0cac('0x4f')]=function(_0x527490,_0x334ad6,_0x322f27){var _0x4b1127={};var _0x4ace93={};var _0x4bf4fa;var _0xf4212d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x527490['params']['id']}})['then'](handleEntityNotFound(_0x334ad6,null))[_0x0cac('0x27')](function(_0x1511b6){if(_0x1511b6){_0x4bf4fa=_0x1511b6;_0x4ace93[_0x0cac('0x30')]=_[_0x0cac('0x33')](db[_0x0cac('0x50')]['rawAttributes']);_0x4ace93[_0x0cac('0x32')]=_[_0x0cac('0x33')](_0x527490[_0x0cac('0x32')]);_0x4ace93[_0x0cac('0x34')]=_['intersection'](_0x4ace93[_0x0cac('0x30')],_0x4ace93['query']);_0x4b1127['attributes']=_[_0x0cac('0x4a')](_0x4ace93[_0x0cac('0x30')],qs[_0x0cac('0x35')](_0x527490[_0x0cac('0x32')][_0x0cac('0x35')]));_0x4b1127[_0x0cac('0x36')]=_0x4b1127[_0x0cac('0x36')][_0x0cac('0x37')]?_0x4b1127[_0x0cac('0x36')]:_0x4ace93[_0x0cac('0x30')];_0x4b1127[_0x0cac('0x3b')]=qs[_0x0cac('0x3c')](_0x527490[_0x0cac('0x32')]['sort']);_0x4b1127[_0x0cac('0x3d')]=qs[_0x0cac('0x34')](_[_0x0cac('0x3e')](_0x527490[_0x0cac('0x32')],_0x4ace93[_0x0cac('0x34')]));if(_0x527490[_0x0cac('0x32')][_0x0cac('0x3f')]){_0x4b1127[_0x0cac('0x3d')]=_['merge'](_0x4b1127[_0x0cac('0x3d')],{'$or':_['map'](_0x4b1127['attributes'],function(_0x31615e){var _0x37d914={};_0x37d914[_0x31615e]={'$like':'%'+_0x527490[_0x0cac('0x32')][_0x0cac('0x3f')]+'%'};return _0x37d914;})});}_0x4b1127=_[_0x0cac('0x41')]({},_0x4b1127,_0x527490[_0x0cac('0x42')]);return _0x4bf4fa[_0x0cac('0x4f')](_0x4b1127);}})[_0x0cac('0x27')](function(_0x37dcbe){if(_0x37dcbe){_0xf4212d=_0x37dcbe[_0x0cac('0x37')];if(!_0x527490[_0x0cac('0x32')][_0x0cac('0x38')](_0x0cac('0x39'))){_0x4b1127[_0x0cac('0x3a')]=qs[_0x0cac('0x3a')](_0x527490[_0x0cac('0x32')]['limit']);_0x4b1127[_0x0cac('0x1f')]=qs['offset'](_0x527490[_0x0cac('0x32')][_0x0cac('0x1f')]);}return _0x4bf4fa[_0x0cac('0x4f')](_0x4b1127);}})[_0x0cac('0x27')](function(_0x3b0af6){if(_0x3b0af6){return _0x3b0af6?{'count':_0xf4212d,'rows':_0x3b0af6}:null;}})[_0x0cac('0x27')](respondWithResult(_0x334ad6,null))[_0x0cac('0x47')](handleError(_0x334ad6,null));};exports[_0x0cac('0x51')]=function(_0x20e2f9,_0x1ce446,_0x18c821){var _0x61b03a={};var _0x282d95={};var _0xc324ac;var _0x20f945;return db[_0x0cac('0x2c')][_0x0cac('0x52')]({'where':{'id':_0x20e2f9['params']['id']}})['then'](handleEntityNotFound(_0x1ce446,null))[_0x0cac('0x27')](function(_0x5bdb61){if(_0x5bdb61){_0xc324ac=_0x5bdb61;_0x282d95['model']=_[_0x0cac('0x33')](db[_0x0cac('0x50')][_0x0cac('0x2d')]);_0x282d95[_0x0cac('0x32')]=_[_0x0cac('0x33')](_0x20e2f9[_0x0cac('0x32')]);_0x282d95[_0x0cac('0x34')]=_[_0x0cac('0x4a')](_0x282d95[_0x0cac('0x30')],_0x282d95['query']);_0x61b03a[_0x0cac('0x36')]=_[_0x0cac('0x4a')](_0x282d95[_0x0cac('0x30')],qs[_0x0cac('0x35')](_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x35')]));_0x61b03a[_0x0cac('0x36')]=_0x61b03a[_0x0cac('0x36')][_0x0cac('0x37')]?_0x61b03a[_0x0cac('0x36')]:_0x282d95[_0x0cac('0x30')];_0x61b03a[_0x0cac('0x3b')]=qs[_0x0cac('0x3c')](_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x3c')]);_0x61b03a[_0x0cac('0x3d')]=qs['filters'](_[_0x0cac('0x3e')](_0x20e2f9[_0x0cac('0x32')],_0x282d95['filters']));if(_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x3f')]){_0x61b03a['where']=_[_0x0cac('0x41')](_0x61b03a[_0x0cac('0x3d')],{'$or':_[_0x0cac('0x31')](_0x61b03a[_0x0cac('0x36')],function(_0x572099){var _0x5cc14c={};_0x5cc14c[_0x572099]={'$like':'%'+_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x3f')]+'%'};return _0x5cc14c;})});}_0x61b03a=_[_0x0cac('0x41')]({},_0x61b03a,_0x20e2f9[_0x0cac('0x42')]);return _0xc324ac[_0x0cac('0x51')](_0x61b03a);}})[_0x0cac('0x27')](function(_0x24a0c7){if(_0x24a0c7){_0x20f945=_0x24a0c7['length'];if(!_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x38')]('nolimit')){_0x61b03a[_0x0cac('0x3a')]=qs[_0x0cac('0x3a')](_0x20e2f9['query'][_0x0cac('0x3a')]);_0x61b03a['offset']=qs[_0x0cac('0x1f')](_0x20e2f9[_0x0cac('0x32')][_0x0cac('0x1f')]);}return _0xc324ac[_0x0cac('0x51')](_0x61b03a);}})[_0x0cac('0x27')](function(_0xc4ca9d){if(_0xc4ca9d){return _0xc4ca9d?{'count':_0x20f945,'rows':_0xc4ca9d}:null;}})[_0x0cac('0x27')](respondWithResult(_0x1ce446,null))[_0x0cac('0x47')](handleError(_0x1ce446,null));};exports[_0x0cac('0x53')]=function(_0x2fb790,_0x22f982,_0x4e1677){var _0x53fcbe={};var _0x2fcd55={};var _0x1d415c;var _0x1e6195;return db[_0x0cac('0x2c')][_0x0cac('0x52')]({'where':{'id':_0x2fb790[_0x0cac('0x49')]['id']}})[_0x0cac('0x27')](handleEntityNotFound(_0x22f982,null))[_0x0cac('0x27')](function(_0x4ef26d){if(_0x4ef26d){_0x1d415c=_0x4ef26d;_0x2fcd55['model']=_[_0x0cac('0x33')](db[_0x0cac('0x50')][_0x0cac('0x2d')]);_0x2fcd55[_0x0cac('0x32')]=_[_0x0cac('0x33')](_0x2fb790['query']);_0x2fcd55['filters']=_['intersection'](_0x2fcd55[_0x0cac('0x30')],_0x2fcd55[_0x0cac('0x32')]);_0x53fcbe[_0x0cac('0x36')]=_[_0x0cac('0x4a')](_0x2fcd55[_0x0cac('0x30')],qs[_0x0cac('0x35')](_0x2fb790[_0x0cac('0x32')]['fields']));_0x53fcbe[_0x0cac('0x36')]=_0x53fcbe[_0x0cac('0x36')][_0x0cac('0x37')]?_0x53fcbe[_0x0cac('0x36')]:_0x2fcd55[_0x0cac('0x30')];_0x53fcbe[_0x0cac('0x3b')]=qs[_0x0cac('0x3c')](_0x2fb790[_0x0cac('0x32')][_0x0cac('0x3c')]);_0x53fcbe[_0x0cac('0x3d')]=qs['filters'](_['pick'](_0x2fb790[_0x0cac('0x32')],_0x2fcd55[_0x0cac('0x34')]));if(_0x2fb790[_0x0cac('0x32')][_0x0cac('0x3f')]){_0x53fcbe[_0x0cac('0x3d')]=_['merge'](_0x53fcbe['where'],{'$or':_[_0x0cac('0x31')](_0x53fcbe['attributes'],function(_0x160b9c){var _0x337c96={};_0x337c96[_0x160b9c]={'$like':'%'+_0x2fb790['query']['filter']+'%'};return _0x337c96;})});}_0x53fcbe=_['merge']({},_0x53fcbe,_0x2fb790[_0x0cac('0x42')]);return _0x1d415c['getDescriptions'](_0x53fcbe);}})[_0x0cac('0x27')](function(_0xd5b335){if(_0xd5b335){_0x1e6195=_0xd5b335[_0x0cac('0x37')];if(!_0x2fb790[_0x0cac('0x32')]['hasOwnProperty'](_0x0cac('0x39'))){_0x53fcbe[_0x0cac('0x3a')]=qs['limit'](_0x2fb790['query'][_0x0cac('0x3a')]);_0x53fcbe['offset']=qs[_0x0cac('0x1f')](_0x2fb790[_0x0cac('0x32')]['offset']);}return _0x1d415c[_0x0cac('0x53')](_0x53fcbe);}})[_0x0cac('0x27')](function(_0xc64524){if(_0xc64524){return _0xc64524?{'count':_0x1e6195,'rows':_0xc64524}:null;}})[_0x0cac('0x27')](respondWithResult(_0x22f982,null))[_0x0cac('0x47')](handleError(_0x22f982,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index adee2bc..835338c 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 _0x6b24=['moment','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x3199d7,_0x3ea674){var _0x3313bf=function(_0x49c4cb){while(--_0x49c4cb){_0x3199d7['push'](_0x3199d7['shift']());}};_0x3313bf(++_0x3ea674);}(_0x6b24,0x15b));var _0x46b2=function(_0x5b0f89,_0x303a8b){_0x5b0f89=_0x5b0f89-0x0;var _0x21ae25=_0x6b24[_0x5b0f89];return _0x21ae25;};'use strict';var _=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var logger=require(_0x46b2('0x2'))(_0x46b2('0x3'));var moment=require(_0x46b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x46b2('0x5'));var fs=require('fs');var path=require(_0x46b2('0x6'));var rimraf=require(_0x46b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x8'));module[_0x46b2('0x9')]=function(_0x44a356,_0x4e0afb){return _0x44a356[_0x46b2('0xa')](_0x46b2('0xb'),attributes,{'tableName':_0x46b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a9b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash'];(function(_0x3779e5,_0x23f33f){var _0xec11e1=function(_0x3b69b9){while(--_0x3b69b9){_0x3779e5['push'](_0x3779e5['shift']());}};_0xec11e1(++_0x23f33f);}(_0x5a9b,0xed));var _0xb5a9=function(_0x187a0a,_0x2d285c){_0x187a0a=_0x187a0a-0x0;var _0x1847a6=_0x5a9b[_0x187a0a];return _0x1847a6;};'use strict';var _=require(_0xb5a9('0x0'));var util=require(_0xb5a9('0x1'));var logger=require(_0xb5a9('0x2'))(_0xb5a9('0x3'));var moment=require(_0xb5a9('0x4'));var BPromise=require(_0xb5a9('0x5'));var rp=require(_0xb5a9('0x6'));var fs=require('fs');var path=require(_0xb5a9('0x7'));var rimraf=require(_0xb5a9('0x8'));var config=require(_0xb5a9('0x9'));var attributes=require(_0xb5a9('0xa'));module[_0xb5a9('0xb')]=function(_0x5c0415,_0x30d15b){return _0x5c0415[_0xb5a9('0xc')](_0xb5a9('0xd'),attributes,{'tableName':'int_zoho_configurations','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 82b5de5..13f94bc 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 _0x8f88=['http','request','then','info','request\x20sent','debug','stringify','code','ZohoConfiguration,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x8f88,0xb5));var _0x88f8=function(_0x2e140d,_0x333831){_0x2e140d=_0x2e140d-0x0;var _0x48cfe2=_0x8f88[_0x2e140d];return _0x48cfe2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88f8('0x0'));var BPromise=require(_0x88f8('0x1'));var rs=require(_0x88f8('0x2'));var fs=require('fs');var Redis=require(_0x88f8('0x3'));var db=require(_0x88f8('0x4'))['db'];var utils=require(_0x88f8('0x5'));var logger=require(_0x88f8('0x6'))(_0x88f8('0x7'));var config=require(_0x88f8('0x8'));var jayson=require(_0x88f8('0x9'));var client=jayson[_0x88f8('0xa')][_0x88f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4887f3,_0x42cf18,_0xe01b19){return new BPromise(function(_0x375141,_0x1126b3){return client[_0x88f8('0xc')](_0x4887f3,_0xe01b19)[_0x88f8('0xd')](function(_0x4b98f8){logger[_0x88f8('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x42cf18,_0x88f8('0xf'));logger[_0x88f8('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x42cf18,'request\x20sent',JSON[_0x88f8('0x11')](_0x4b98f8));if(_0x4b98f8['error']){if(_0x4b98f8['error'][_0x88f8('0x12')]===0x1f4){logger['error'](_0x88f8('0x13'),_0x42cf18,_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);return _0x1126b3(_0x4b98f8[_0x88f8('0x14')]['message']);}logger[_0x88f8('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x42cf18,_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);return _0x375141(_0x4b98f8[_0x88f8('0x14')][_0x88f8('0x15')]);}else{logger[_0x88f8('0xe')](_0x88f8('0x13'),_0x42cf18,_0x88f8('0xf'));_0x375141(_0x4b98f8[_0x88f8('0x16')][_0x88f8('0x15')]);}})[_0x88f8('0x17')](function(_0x3aff51){logger[_0x88f8('0x14')](_0x88f8('0x13'),_0x42cf18,_0x3aff51);_0x1126b3(_0x3aff51);});});} \ No newline at end of file +var _0x9d4a=['jayson/promise','http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x551127,_0xa21660){var _0x5e72d0=function(_0x4f8983){while(--_0x4f8983){_0x551127['push'](_0x551127['shift']());}};_0x5e72d0(++_0xa21660);}(_0x9d4a,0xdd));var _0xa9d4=function(_0x3dfd89,_0xa2cfab){_0x3dfd89=_0x3dfd89-0x0;var _0xcfaa6c=_0x9d4a[_0x3dfd89];return _0xcfaa6c;};'use strict';var _=require('lodash');var util=require(_0xa9d4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa9d4('0x1'));var fs=require('fs');var Redis=require(_0xa9d4('0x2'));var db=require(_0xa9d4('0x3'))['db'];var utils=require(_0xa9d4('0x4'));var logger=require('../../config/logger')(_0xa9d4('0x5'));var config=require(_0xa9d4('0x6'));var jayson=require(_0xa9d4('0x7'));var client=jayson['client'][_0xa9d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7ed6,_0x7b3521,_0x2dc9c9){return new BPromise(function(_0x35eee4,_0x41c502){return client['request'](_0x3f7ed6,_0x2dc9c9)['then'](function(_0x33f2f5){logger['info'](_0xa9d4('0x9'),_0x7b3521,_0xa9d4('0xa'));logger[_0xa9d4('0xb')](_0xa9d4('0xc'),_0x7b3521,_0xa9d4('0xa'),JSON[_0xa9d4('0xd')](_0x33f2f5));if(_0x33f2f5[_0xa9d4('0xe')]){if(_0x33f2f5['error'][_0xa9d4('0xf')]===0x1f4){logger[_0xa9d4('0xe')](_0xa9d4('0x9'),_0x7b3521,_0x33f2f5[_0xa9d4('0xe')]['message']);return _0x41c502(_0x33f2f5[_0xa9d4('0xe')]['message']);}logger['error'](_0xa9d4('0x9'),_0x7b3521,_0x33f2f5['error'][_0xa9d4('0x10')]);return _0x35eee4(_0x33f2f5['error']['message']);}else{logger[_0xa9d4('0x11')](_0xa9d4('0x9'),_0x7b3521,_0xa9d4('0xa'));_0x35eee4(_0x33f2f5['result']['message']);}})[_0xa9d4('0x12')](function(_0x443691){logger[_0xa9d4('0xe')](_0xa9d4('0x9'),_0x7b3521,_0x443691);_0x41c502(_0x443691);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 89602f2..f3102ad 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 _0x051c=['put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x1ddb03,_0xffb9c7){var _0x1e6726=function(_0x5c8da0){while(--_0x5c8da0){_0x1ddb03['push'](_0x1ddb03['shift']());}};_0x1e6726(++_0xffb9c7);}(_0x051c,0x16e));var _0xc051=function(_0x310953,_0x4871ae){_0x310953=_0x310953-0x0;var _0x4b1699=_0x051c[_0x310953];return _0x4b1699;};'use strict';var multer=require(_0xc051('0x0'));var util=require('util');var path=require(_0xc051('0x1'));var timeout=require('connect-timeout');var express=require(_0xc051('0x2'));var router=express['Router']();var fs_extra=require(_0xc051('0x3'));var auth=require(_0xc051('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc051('0x5'));var controller=require('./intZohoField.controller');router[_0xc051('0x6')]('/',auth[_0xc051('0x7')](),controller[_0xc051('0x8')]);router[_0xc051('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc051('0x9')]);router[_0xc051('0xa')]('/',auth[_0xc051('0x7')](),controller[_0xc051('0xb')]);router[_0xc051('0xc')](_0xc051('0xd'),auth[_0xc051('0x7')](),controller[_0xc051('0xe')]);router[_0xc051('0xf')](_0xc051('0xd'),auth['isAuthenticated'](),controller[_0xc051('0x10')]);module[_0xc051('0x11')]=router; \ No newline at end of file +var _0x9138=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x9138,0x151));var _0x8913=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x9138[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x8913('0x0'));var util=require(_0x8913('0x1'));var path=require('path');var timeout=require(_0x8913('0x2'));var express=require(_0x8913('0x3'));var router=express['Router']();var fs_extra=require(_0x8913('0x4'));var auth=require(_0x8913('0x5'));var interaction=require(_0x8913('0x6'));var config=require(_0x8913('0x7'));var controller=require(_0x8913('0x8'));router[_0x8913('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8913('0x9')](_0x8913('0xa'),auth[_0x8913('0xb')](),controller['show']);router[_0x8913('0xc')]('/',auth[_0x8913('0xb')](),controller[_0x8913('0xd')]);router[_0x8913('0xe')]('/:id',auth[_0x8913('0xb')](),controller['update']);router[_0x8913('0xf')]('/:id',auth[_0x8913('0xb')](),controller[_0x8913('0x10')]);module[_0x8913('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 56ee480..4d41eed 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 _0x76b2=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x57c6c4,_0x10bd9a){var _0x604afb=function(_0x1b1d1a){while(--_0x1b1d1a){_0x57c6c4['push'](_0x57c6c4['shift']());}};_0x604afb(++_0x10bd9a);}(_0x76b2,0x103));var _0x276b=function(_0x5e8c3f,_0x28f60d){_0x5e8c3f=_0x5e8c3f-0x0;var _0xa051c4=_0x76b2[_0x5e8c3f];return _0xa051c4;};'use strict';var Sequelize=require(_0x276b('0x0'));module[_0x276b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x276b('0x2'),_0x276b('0x3'),_0x276b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x276b('0x5')]},'key':{'type':Sequelize[_0x276b('0x5')]},'keyType':{'type':Sequelize[_0x276b('0x6')]('string',_0x276b('0x7'),_0x276b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x276b('0x5')]},'nameField':{'type':Sequelize[_0x276b('0x5')]},'customField':{'type':Sequelize[_0x276b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x276b('0x5')]}}; \ No newline at end of file +var _0xbf74=['exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x1296f8,_0x72e63){var _0x5b52a3=function(_0x8e3395){while(--_0x8e3395){_0x1296f8['push'](_0x1296f8['shift']());}};_0x5b52a3(++_0x72e63);}(_0xbf74,0x126));var _0x4bf7=function(_0x1a33a2,_0x4d128d){_0x1a33a2=_0x1a33a2-0x0;var _0x3e332f=_0xbf74[_0x1a33a2];return _0x3e332f;};'use strict';var Sequelize=require('sequelize');module[_0x4bf7('0x0')]={'type':{'type':Sequelize[_0x4bf7('0x1')]('string','variable',_0x4bf7('0x2'),_0x4bf7('0x3'),_0x4bf7('0x4')),'defaultValue':_0x4bf7('0x5')},'content':{'type':Sequelize[_0x4bf7('0x6')]},'key':{'type':Sequelize[_0x4bf7('0x6')]},'keyType':{'type':Sequelize[_0x4bf7('0x1')](_0x4bf7('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x4bf7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4bf7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4bf7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7dcbe67..ed11854 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 _0x9f6d=['save','then','destroy','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','params','ZohoField','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','undefined','limit','count','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f6d,0x140));var _0xd9f6=function(_0x21c62e,_0x225e32){_0x21c62e=_0x21c62e-0x0;var _0x2774f6=_0x9f6d[_0x21c62e];return _0x2774f6;};'use strict';var emlformat=require(_0xd9f6('0x0'));var rimraf=require(_0xd9f6('0x1'));var zipdir=require(_0xd9f6('0x2'));var jsonpatch=require(_0xd9f6('0x3'));var rp=require(_0xd9f6('0x4'));var moment=require(_0xd9f6('0x5'));var BPromise=require(_0xd9f6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd9f6('0x7'));var sox=require(_0xd9f6('0x8'));var csv=require(_0xd9f6('0x9'));var ejs=require(_0xd9f6('0xa'));var fs=require('fs');var fs_extra=require(_0xd9f6('0xb'));var _=require(_0xd9f6('0xc'));var squel=require('squel');var crypto=require(_0xd9f6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9f6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd9f6('0xe'));var authService=require(_0xd9f6('0xf'));var qs=require(_0xd9f6('0x10'));var as=require(_0xd9f6('0x11'));var hardwareService=require(_0xd9f6('0x12'));var logger=require(_0xd9f6('0x13'))(_0xd9f6('0x14'));var utils=require(_0xd9f6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd9f6('0x16'));var db=require(_0xd9f6('0x17'))['db'];function respondWithStatusCode(_0x53aeed,_0x1abcb7){_0x1abcb7=_0x1abcb7||0xcc;return function(_0x40d13e){if(_0x40d13e){return _0x53aeed[_0xd9f6('0x18')](_0x1abcb7);}return _0x53aeed[_0xd9f6('0x19')](_0x1abcb7)[_0xd9f6('0x1a')]();};}function respondWithResult(_0x3cde5e,_0x37ee27){_0x37ee27=_0x37ee27||0xc8;return function(_0x252f82){if(_0x252f82){return _0x3cde5e[_0xd9f6('0x19')](_0x37ee27)[_0xd9f6('0x1b')](_0x252f82);}};}function respondWithFilteredResult(_0x30aeae,_0x3bb89a){return function(_0x3f1f87){if(_0x3f1f87){var _0x44bcd9=typeof _0x3bb89a[_0xd9f6('0x1c')]===_0xd9f6('0x1d')&&typeof _0x3bb89a[_0xd9f6('0x1e')]==='undefined';var _0x48bf2e=_0x3f1f87[_0xd9f6('0x1f')];var _0x1b7811=_0x44bcd9?0x0:_0x3bb89a[_0xd9f6('0x1c')];var _0x2fe111=_0x44bcd9?_0x3f1f87['count']:_0x3bb89a[_0xd9f6('0x1c')]+_0x3bb89a[_0xd9f6('0x1e')];var _0x44f80c;if(_0x2fe111>=_0x48bf2e){_0x2fe111=_0x48bf2e;_0x44f80c=0xc8;}else{_0x44f80c=0xce;}_0x30aeae['status'](_0x44f80c);return _0x30aeae['set'](_0xd9f6('0x20'),_0x1b7811+'-'+_0x2fe111+'/'+_0x48bf2e)[_0xd9f6('0x1b')](_0x3f1f87);}return null;};}function patchUpdates(_0x472b2a){return function(_0x4250df){try{jsonpatch[_0xd9f6('0x21')](_0x4250df,_0x472b2a,!![]);}catch(_0x509b9e){return BPromise[_0xd9f6('0x22')](_0x509b9e);}return _0x4250df[_0xd9f6('0x23')]();};}function saveUpdates(_0x635e35,_0x12b38b){return function(_0x5b1698){if(_0x5b1698){return _0x5b1698['update'](_0x635e35)[_0xd9f6('0x24')](function(_0x561528){return _0x561528;});}return null;};}function removeEntity(_0x444156,_0x9829e8){return function(_0x42f3c9){if(_0x42f3c9){return _0x42f3c9[_0xd9f6('0x25')]()[_0xd9f6('0x24')](function(){_0x444156[_0xd9f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475adc,_0x36ed61){return function(_0x1350af){if(!_0x1350af){_0x475adc['sendStatus'](0x194);}return _0x1350af;};}function handleError(_0x27cd23,_0x421845){_0x421845=_0x421845||0x1f4;return function(_0x1492b4){logger['error'](_0x1492b4[_0xd9f6('0x26')]);if(_0x1492b4[_0xd9f6('0x27')]){delete _0x1492b4[_0xd9f6('0x27')];}_0x27cd23[_0xd9f6('0x19')](_0x421845)[_0xd9f6('0x28')](_0x1492b4);};}exports[_0xd9f6('0x29')]=function(_0x245275,_0x3ff00b){var _0x334dda={},_0x4b5f3d={},_0x5333aa={'count':0x0,'rows':[]};var _0x20bf32=_['map'](db['ZohoField']['rawAttributes'],function(_0x46149b){return{'name':_0x46149b['fieldName'],'type':_0x46149b['type'][_0xd9f6('0x2a')]};});_0x4b5f3d[_0xd9f6('0x2b')]=_[_0xd9f6('0x2c')](_0x20bf32,_0xd9f6('0x27'));_0x4b5f3d[_0xd9f6('0x2d')]=_[_0xd9f6('0x2e')](_0x245275[_0xd9f6('0x2d')]);_0x4b5f3d[_0xd9f6('0x2f')]=_[_0xd9f6('0x30')](_0x4b5f3d[_0xd9f6('0x2b')],_0x4b5f3d[_0xd9f6('0x2d')]);_0x334dda[_0xd9f6('0x31')]=_[_0xd9f6('0x30')](_0x4b5f3d[_0xd9f6('0x2b')],qs['fields'](_0x245275[_0xd9f6('0x2d')]['fields']));_0x334dda[_0xd9f6('0x31')]=_0x334dda[_0xd9f6('0x31')][_0xd9f6('0x32')]?_0x334dda[_0xd9f6('0x31')]:_0x4b5f3d['model'];if(!_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x33')](_0xd9f6('0x34'))){_0x334dda['limit']=qs[_0xd9f6('0x1e')](_0x245275['query']['limit']);_0x334dda[_0xd9f6('0x1c')]=qs[_0xd9f6('0x1c')](_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x1c')]);}_0x334dda['order']=qs[_0xd9f6('0x35')](_0x245275['query']['sort']);_0x334dda['where']=qs[_0xd9f6('0x2f')](_[_0xd9f6('0x36')](_0x245275[_0xd9f6('0x2d')],_0x4b5f3d[_0xd9f6('0x2f')]),_0x20bf32);if(_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x37')]){_0x334dda[_0xd9f6('0x38')]=_[_0xd9f6('0x39')](_0x334dda['where'],{'$or':_[_0xd9f6('0x2c')](_0x20bf32,function(_0x367556){if(_0x367556[_0xd9f6('0x3a')]!=='VIRTUAL'){var _0xe5da9a={};_0xe5da9a[_0x367556[_0xd9f6('0x27')]]={'$like':'%'+_0x245275[_0xd9f6('0x2d')]['filter']+'%'};return _0xe5da9a;}})});}_0x334dda=_[_0xd9f6('0x39')]({},_0x334dda,_0x245275[_0xd9f6('0x3b')]);var _0x3fa86f={'where':_0x334dda[_0xd9f6('0x38')]};return db['ZohoField'][_0xd9f6('0x1f')](_0x3fa86f)[_0xd9f6('0x24')](function(_0x290895){_0x5333aa[_0xd9f6('0x1f')]=_0x290895;if(_0x245275[_0xd9f6('0x2d')][_0xd9f6('0x3c')]){_0x334dda[_0xd9f6('0x3d')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x334dda);})[_0xd9f6('0x24')](function(_0x268649){_0x5333aa[_0xd9f6('0x3e')]=_0x268649;return _0x5333aa;})['then'](respondWithFilteredResult(_0x3ff00b,_0x334dda))[_0xd9f6('0x3f')](handleError(_0x3ff00b,null));};exports[_0xd9f6('0x40')]=function(_0x3212ea,_0x4765db){var _0x46fda0={'raw':!![],'where':{'id':_0x3212ea[_0xd9f6('0x41')]['id']}},_0x263dc2={};_0x263dc2[_0xd9f6('0x2b')]=_['keys'](db['ZohoField']['rawAttributes']);_0x263dc2[_0xd9f6('0x2d')]=_['keys'](_0x3212ea[_0xd9f6('0x2d')]);_0x263dc2[_0xd9f6('0x2f')]=_['intersection'](_0x263dc2[_0xd9f6('0x2b')],_0x263dc2[_0xd9f6('0x2d')]);_0x46fda0[_0xd9f6('0x31')]=_[_0xd9f6('0x30')](_0x263dc2[_0xd9f6('0x2b')],qs['fields'](_0x3212ea[_0xd9f6('0x2d')]['fields']));_0x46fda0[_0xd9f6('0x31')]=_0x46fda0['attributes'][_0xd9f6('0x32')]?_0x46fda0[_0xd9f6('0x31')]:_0x263dc2[_0xd9f6('0x2b')];if(_0x3212ea[_0xd9f6('0x2d')][_0xd9f6('0x3c')]){_0x46fda0[_0xd9f6('0x3d')]=[{'all':!![]}];}_0x46fda0=_['merge']({},_0x46fda0,_0x3212ea[_0xd9f6('0x3b')]);return db[_0xd9f6('0x42')][_0xd9f6('0x43')](_0x46fda0)[_0xd9f6('0x24')](handleEntityNotFound(_0x4765db,null))[_0xd9f6('0x24')](respondWithResult(_0x4765db,null))[_0xd9f6('0x3f')](handleError(_0x4765db,null));};exports[_0xd9f6('0x44')]=function(_0x51ec5c,_0x2d4724){return db['ZohoField'][_0xd9f6('0x44')](_0x51ec5c['body'],{})['then'](respondWithResult(_0x2d4724,0xc9))[_0xd9f6('0x3f')](handleError(_0x2d4724,null));};exports[_0xd9f6('0x45')]=function(_0x40492a,_0x30f8d2){if(_0x40492a['body']['id']){delete _0x40492a[_0xd9f6('0x46')]['id'];}return db[_0xd9f6('0x42')][_0xd9f6('0x43')]({'where':{'id':_0x40492a[_0xd9f6('0x41')]['id']}})['then'](handleEntityNotFound(_0x30f8d2,null))[_0xd9f6('0x24')](saveUpdates(_0x40492a[_0xd9f6('0x46')],null))[_0xd9f6('0x24')](respondWithResult(_0x30f8d2,null))[_0xd9f6('0x3f')](handleError(_0x30f8d2,null));};exports['destroy']=function(_0x57f6db,_0x1c99fb){return db[_0xd9f6('0x42')][_0xd9f6('0x43')]({'where':{'id':_0x57f6db[_0xd9f6('0x41')]['id']}})[_0xd9f6('0x24')](handleEntityNotFound(_0x1c99fb,null))[_0xd9f6('0x24')](removeEntity(_0x1c99fb,null))[_0xd9f6('0x3f')](handleError(_0x1c99fb,null));}; \ No newline at end of file +var _0x0d5b=['filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoField','type','key','map','keys','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','sort','where'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0d5b,0x19c));var _0xb0d5=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0d5b[_0x39e84d];return _0x1991bc;};'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(_0xb0d5('0x0'));var BPromise=require(_0xb0d5('0x1'));var Mustache=require(_0xb0d5('0x2'));var util=require(_0xb0d5('0x3'));var path=require('path');var sox=require(_0xb0d5('0x4'));var csv=require(_0xb0d5('0x5'));var ejs=require(_0xb0d5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb0d5('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0d5('0x8'));var toCsv=require(_0xb0d5('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb0d5('0x9'));var authService=require(_0xb0d5('0xa'));var qs=require(_0xb0d5('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0d5('0xc'));var logger=require(_0xb0d5('0xd'))('api');var utils=require(_0xb0d5('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d680,_0x11a27f){_0x11a27f=_0x11a27f||0xcc;return function(_0x2ecc8b){if(_0x2ecc8b){return _0x53d680[_0xb0d5('0xf')](_0x11a27f);}return _0x53d680['status'](_0x11a27f)[_0xb0d5('0x10')]();};}function respondWithResult(_0x5c985b,_0x13e425){_0x13e425=_0x13e425||0xc8;return function(_0x2c550f){if(_0x2c550f){return _0x5c985b[_0xb0d5('0x11')](_0x13e425)[_0xb0d5('0x12')](_0x2c550f);}};}function respondWithFilteredResult(_0x283306,_0xca7d1){return function(_0x5bbb92){if(_0x5bbb92){var _0x522121=typeof _0xca7d1[_0xb0d5('0x13')]===_0xb0d5('0x14')&&typeof _0xca7d1[_0xb0d5('0x15')]===_0xb0d5('0x14');var _0x2c97ef=_0x5bbb92[_0xb0d5('0x16')];var _0x52d84d=_0x522121?0x0:_0xca7d1[_0xb0d5('0x13')];var _0x100446=_0x522121?_0x5bbb92[_0xb0d5('0x16')]:_0xca7d1['offset']+_0xca7d1[_0xb0d5('0x15')];var _0x5f11e3;if(_0x100446>=_0x2c97ef){_0x100446=_0x2c97ef;_0x5f11e3=0xc8;}else{_0x5f11e3=0xce;}_0x283306[_0xb0d5('0x11')](_0x5f11e3);return _0x283306[_0xb0d5('0x17')]('Content-Range',_0x52d84d+'-'+_0x100446+'/'+_0x2c97ef)[_0xb0d5('0x12')](_0x5bbb92);}return null;};}function patchUpdates(_0x42ab68){return function(_0x2b0a35){try{jsonpatch[_0xb0d5('0x18')](_0x2b0a35,_0x42ab68,!![]);}catch(_0x2e7de1){return BPromise[_0xb0d5('0x19')](_0x2e7de1);}return _0x2b0a35[_0xb0d5('0x1a')]();};}function saveUpdates(_0x5bca02,_0x321b49){return function(_0x167b9a){if(_0x167b9a){return _0x167b9a[_0xb0d5('0x1b')](_0x5bca02)[_0xb0d5('0x1c')](function(_0x190bcb){return _0x190bcb;});}return null;};}function removeEntity(_0x4e7a1c,_0x79df97){return function(_0x4f9383){if(_0x4f9383){return _0x4f9383[_0xb0d5('0x1d')]()[_0xb0d5('0x1c')](function(){_0x4e7a1c[_0xb0d5('0x11')](0xcc)[_0xb0d5('0x10')]();});}};}function handleEntityNotFound(_0x227cdd,_0x2ded26){return function(_0x4a043a){if(!_0x4a043a){_0x227cdd[_0xb0d5('0xf')](0x194);}return _0x4a043a;};}function handleError(_0x5e1050,_0x5d746b){_0x5d746b=_0x5d746b||0x1f4;return function(_0x2dc6f0){logger[_0xb0d5('0x1e')](_0x2dc6f0[_0xb0d5('0x1f')]);if(_0x2dc6f0[_0xb0d5('0x20')]){delete _0x2dc6f0[_0xb0d5('0x20')];}_0x5e1050[_0xb0d5('0x11')](_0x5d746b)[_0xb0d5('0x21')](_0x2dc6f0);};}exports[_0xb0d5('0x22')]=function(_0x45ab34,_0x37870f){var _0x1bc4bc={},_0x22ec85={},_0x235a92={'count':0x0,'rows':[]};var _0x195b68=_['map'](db[_0xb0d5('0x23')]['rawAttributes'],function(_0x10efe2){return{'name':_0x10efe2['fieldName'],'type':_0x10efe2[_0xb0d5('0x24')][_0xb0d5('0x25')]};});_0x22ec85['model']=_[_0xb0d5('0x26')](_0x195b68,_0xb0d5('0x20'));_0x22ec85['query']=_[_0xb0d5('0x27')](_0x45ab34['query']);_0x22ec85['filters']=_[_0xb0d5('0x28')](_0x22ec85['model'],_0x22ec85['query']);_0x1bc4bc[_0xb0d5('0x29')]=_[_0xb0d5('0x28')](_0x22ec85[_0xb0d5('0x2a')],qs[_0xb0d5('0x2b')](_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x2b')]));_0x1bc4bc[_0xb0d5('0x29')]=_0x1bc4bc[_0xb0d5('0x29')][_0xb0d5('0x2d')]?_0x1bc4bc[_0xb0d5('0x29')]:_0x22ec85[_0xb0d5('0x2a')];if(!_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x2e')](_0xb0d5('0x2f'))){_0x1bc4bc[_0xb0d5('0x15')]=qs[_0xb0d5('0x15')](_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x15')]);_0x1bc4bc[_0xb0d5('0x13')]=qs[_0xb0d5('0x13')](_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x13')]);}_0x1bc4bc['order']=qs[_0xb0d5('0x30')](_0x45ab34['query']['sort']);_0x1bc4bc[_0xb0d5('0x31')]=qs[_0xb0d5('0x32')](_[_0xb0d5('0x33')](_0x45ab34[_0xb0d5('0x2c')],_0x22ec85['filters']),_0x195b68);if(_0x45ab34[_0xb0d5('0x2c')]['filter']){_0x1bc4bc[_0xb0d5('0x31')]=_[_0xb0d5('0x34')](_0x1bc4bc[_0xb0d5('0x31')],{'$or':_['map'](_0x195b68,function(_0x2e21e3){if(_0x2e21e3[_0xb0d5('0x24')]!==_0xb0d5('0x35')){var _0x2615d5={};_0x2615d5[_0x2e21e3[_0xb0d5('0x20')]]={'$like':'%'+_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x36')]+'%'};return _0x2615d5;}})});}_0x1bc4bc=_[_0xb0d5('0x34')]({},_0x1bc4bc,_0x45ab34[_0xb0d5('0x37')]);var _0x5b141a={'where':_0x1bc4bc[_0xb0d5('0x31')]};return db['ZohoField'][_0xb0d5('0x16')](_0x5b141a)[_0xb0d5('0x1c')](function(_0x496b1f){_0x235a92[_0xb0d5('0x16')]=_0x496b1f;if(_0x45ab34[_0xb0d5('0x2c')][_0xb0d5('0x38')]){_0x1bc4bc[_0xb0d5('0x39')]=[{'all':!![]}];}return db[_0xb0d5('0x23')][_0xb0d5('0x3a')](_0x1bc4bc);})['then'](function(_0x5318b4){_0x235a92[_0xb0d5('0x3b')]=_0x5318b4;return _0x235a92;})[_0xb0d5('0x1c')](respondWithFilteredResult(_0x37870f,_0x1bc4bc))[_0xb0d5('0x3c')](handleError(_0x37870f,null));};exports['show']=function(_0x489836,_0x1de770){var _0x47022f={'raw':!![],'where':{'id':_0x489836['params']['id']}},_0x2b1998={};_0x2b1998['model']=_[_0xb0d5('0x27')](db[_0xb0d5('0x23')][_0xb0d5('0x3d')]);_0x2b1998[_0xb0d5('0x2c')]=_[_0xb0d5('0x27')](_0x489836[_0xb0d5('0x2c')]);_0x2b1998[_0xb0d5('0x32')]=_['intersection'](_0x2b1998[_0xb0d5('0x2a')],_0x2b1998['query']);_0x47022f[_0xb0d5('0x29')]=_[_0xb0d5('0x28')](_0x2b1998[_0xb0d5('0x2a')],qs[_0xb0d5('0x2b')](_0x489836[_0xb0d5('0x2c')][_0xb0d5('0x2b')]));_0x47022f[_0xb0d5('0x29')]=_0x47022f[_0xb0d5('0x29')][_0xb0d5('0x2d')]?_0x47022f['attributes']:_0x2b1998['model'];if(_0x489836['query'][_0xb0d5('0x38')]){_0x47022f[_0xb0d5('0x39')]=[{'all':!![]}];}_0x47022f=_[_0xb0d5('0x34')]({},_0x47022f,_0x489836[_0xb0d5('0x37')]);return db[_0xb0d5('0x23')][_0xb0d5('0x3e')](_0x47022f)[_0xb0d5('0x1c')](handleEntityNotFound(_0x1de770,null))[_0xb0d5('0x1c')](respondWithResult(_0x1de770,null))[_0xb0d5('0x3c')](handleError(_0x1de770,null));};exports[_0xb0d5('0x3f')]=function(_0x5116e3,_0x12567c){return db[_0xb0d5('0x23')][_0xb0d5('0x3f')](_0x5116e3[_0xb0d5('0x40')],{})['then'](respondWithResult(_0x12567c,0xc9))[_0xb0d5('0x3c')](handleError(_0x12567c,null));};exports[_0xb0d5('0x1b')]=function(_0x3fed67,_0xa36076){if(_0x3fed67[_0xb0d5('0x40')]['id']){delete _0x3fed67[_0xb0d5('0x40')]['id'];}return db[_0xb0d5('0x23')]['find']({'where':{'id':_0x3fed67[_0xb0d5('0x41')]['id']}})['then'](handleEntityNotFound(_0xa36076,null))[_0xb0d5('0x1c')](saveUpdates(_0x3fed67['body'],null))['then'](respondWithResult(_0xa36076,null))[_0xb0d5('0x3c')](handleError(_0xa36076,null));};exports[_0xb0d5('0x1d')]=function(_0x4dcdd9,_0x288e53){return db[_0xb0d5('0x23')][_0xb0d5('0x3e')]({'where':{'id':_0x4dcdd9[_0xb0d5('0x41')]['id']}})[_0xb0d5('0x1c')](handleEntityNotFound(_0x288e53,null))['then'](removeEntity(_0x288e53,null))['catch'](handleError(_0x288e53,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1063019..1fd7bcd 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api'];(function(_0x246513,_0x450ad0){var _0x686fe6=function(_0x286f81){while(--_0x286f81){_0x246513['push'](_0x246513['shift']());}};_0x686fe6(++_0x450ad0);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0xfcf0[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['zoho_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9536,0x179));var _0x6953=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x9536[_0x3fd3a3];return _0xa3e4d5;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['idField',_0x6953('0xe')],'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 c1ca558..1df9f11 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 _0x5f51=['jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xec88f0,_0x3b9fe2){var _0x148be0=function(_0x4e1670){while(--_0x4e1670){_0xec88f0['push'](_0xec88f0['shift']());}};_0x148be0(++_0x3b9fe2);}(_0x5f51,0x157));var _0x15f5=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f51[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x15f5('0x0'));var util=require(_0x15f5('0x1'));var moment=require('moment');var BPromise=require(_0x15f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15f5('0x3'));var db=require(_0x15f5('0x4'))['db'];var utils=require(_0x15f5('0x5'));var logger=require(_0x15f5('0x6'))(_0x15f5('0x7'));var config=require(_0x15f5('0x8'));var jayson=require(_0x15f5('0x9'));var client=jayson[_0x15f5('0xa')][_0x15f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x560339,_0x22e8cf,_0x2f541b){return new BPromise(function(_0x2a14f0,_0x137b06){return client['request'](_0x560339,_0x2f541b)['then'](function(_0x42efae){logger[_0x15f5('0xc')](_0x15f5('0xd'),_0x22e8cf,_0x15f5('0xe'));logger[_0x15f5('0xf')](_0x15f5('0x10'),_0x22e8cf,'request\x20sent',JSON[_0x15f5('0x11')](_0x42efae));if(_0x42efae[_0x15f5('0x12')]){if(_0x42efae['error'][_0x15f5('0x13')]===0x1f4){logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x42efae[_0x15f5('0x12')][_0x15f5('0x14')]);return _0x137b06(_0x42efae[_0x15f5('0x12')][_0x15f5('0x14')]);}logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x42efae[_0x15f5('0x12')]['message']);return _0x2a14f0(_0x42efae['error'][_0x15f5('0x14')]);}else{logger[_0x15f5('0xc')](_0x15f5('0xd'),_0x22e8cf,_0x15f5('0xe'));_0x2a14f0(_0x42efae['result'][_0x15f5('0x14')]);}})[_0x15f5('0x15')](function(_0x586d35){logger[_0x15f5('0x12')](_0x15f5('0xd'),_0x22e8cf,_0x586d35);_0x137b06(_0x586d35);});});} \ No newline at end of file +var _0x4192=['http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f0a22,_0x2946c4){var _0x11fff4=function(_0x15a15a){while(--_0x15a15a){_0x5f0a22['push'](_0x5f0a22['shift']());}};_0x11fff4(++_0x2946c4);}(_0x4192,0xa9));var _0x2419=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x4192[_0x422be2];return _0x1b820e;};'use strict';var _=require(_0x2419('0x0'));var util=require(_0x2419('0x1'));var moment=require(_0x2419('0x2'));var BPromise=require(_0x2419('0x3'));var rs=require(_0x2419('0x4'));var fs=require('fs');var Redis=require(_0x2419('0x5'));var db=require(_0x2419('0x6'))['db'];var utils=require(_0x2419('0x7'));var logger=require(_0x2419('0x8'))(_0x2419('0x9'));var config=require(_0x2419('0xa'));var jayson=require(_0x2419('0xb'));var client=jayson[_0x2419('0xc')][_0x2419('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x48a3b2,_0x307a92,_0x2908bf){return new BPromise(function(_0x1e2fce,_0x31aec8){return client[_0x2419('0xe')](_0x48a3b2,_0x2908bf)[_0x2419('0xf')](function(_0x47332b){logger[_0x2419('0x10')](_0x2419('0x11'),_0x307a92,_0x2419('0x12'));logger[_0x2419('0x13')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x307a92,_0x2419('0x12'),JSON[_0x2419('0x14')](_0x47332b));if(_0x47332b[_0x2419('0x15')]){if(_0x47332b[_0x2419('0x15')][_0x2419('0x16')]===0x1f4){logger[_0x2419('0x15')](_0x2419('0x11'),_0x307a92,_0x47332b[_0x2419('0x15')][_0x2419('0x17')]);return _0x31aec8(_0x47332b[_0x2419('0x15')][_0x2419('0x17')]);}logger[_0x2419('0x15')]('ZohoField,\x20%s,\x20%s',_0x307a92,_0x47332b[_0x2419('0x15')][_0x2419('0x17')]);return _0x1e2fce(_0x47332b[_0x2419('0x15')][_0x2419('0x17')]);}else{logger[_0x2419('0x10')](_0x2419('0x11'),_0x307a92,_0x2419('0x12'));_0x1e2fce(_0x47332b[_0x2419('0x18')][_0x2419('0x17')]);}})[_0x2419('0x19')](function(_0x905fd5){logger[_0x2419('0x15')](_0x2419('0x11'),_0x307a92,_0x905fd5);_0x31aec8(_0x905fd5);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8a6fe7a..8958067 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e3b9b,_0x4060e2){var _0x39079a=function(_0x599b13){while(--_0x599b13){_0x3e3b9b['push'](_0x3e3b9b['shift']());}};_0x39079a(++_0x4060e2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcb91[_0x398294];return _0x2a872d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x591431,_0x24938b){var _0x53aeb4=function(_0x598b0d){while(--_0x598b0d){_0x591431['push'](_0x591431['shift']());}};_0x53aeb4(++_0x24938b);}(_0x70e0,0x17b));var _0x070e=function(_0x3b8c76,_0x56a0cb){_0x3b8c76=_0x3b8c76-0x0;var _0x1116cf=_0x70e0[_0x3b8c76];return _0x1116cf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f5c2a37..ce7ea37 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 _0x38f5=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x367284,_0x26688c){var _0xe5c015=function(_0x19705e){while(--_0x19705e){_0x367284['push'](_0x367284['shift']());}};_0xe5c015(++_0x26688c);}(_0x38f5,0x89));var _0x538f=function(_0x1ce01c,_0x3d45cf){_0x1ce01c=_0x1ce01c-0x0;var _0x2b86b9=_0x38f5[_0x1ce01c];return _0x2b86b9;};'use strict';var Sequelize=require('sequelize');module[_0x538f('0x0')]={'name':{'type':Sequelize[_0x538f('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x538f('0x1')],'allowNull':![],'unique':_0x538f('0x2')},'main':{'type':Sequelize[_0x538f('0x1')],'defaultValue':_0x538f('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x538f('0x1')]},'size':{'type':Sequelize[_0x538f('0x4')]},'active':{'type':Sequelize[_0x538f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x538f('0x1')]},'logo':{'type':Sequelize[_0x538f('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x538f('0x6')},'description':{'type':Sequelize[_0x538f('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x538f('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb885=['exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x4032f9,_0x2f0dd8){var _0x7b68fe=function(_0x1d1a98){while(--_0x1d1a98){_0x4032f9['push'](_0x4032f9['shift']());}};_0x7b68fe(++_0x2f0dd8);}(_0xb885,0x6f));var _0x5b88=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xb885[_0x5ac0f0];return _0x4aceec;};'use strict';var Sequelize=require(_0x5b88('0x0'));module[_0x5b88('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5b88('0x2')},'version':{'type':Sequelize[_0x5b88('0x3')],'allowNull':![],'unique':_0x5b88('0x2')},'main':{'type':Sequelize[_0x5b88('0x3')],'defaultValue':_0x5b88('0x4')},'filename':{'type':Sequelize[_0x5b88('0x3')]},'path':{'type':Sequelize[_0x5b88('0x3')]},'type':{'type':Sequelize[_0x5b88('0x3')]},'size':{'type':Sequelize[_0x5b88('0x5')]},'active':{'type':Sequelize[_0x5b88('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5b88('0x3')]},'logo':{'type':Sequelize[_0x5b88('0x3')]},'state':{'type':Sequelize[_0x5b88('0x3')],'unique':_0x5b88('0x7')},'description':{'type':Sequelize[_0x5b88('0x3')]},'title':{'type':Sequelize[_0x5b88('0x3')]},'remoteUri':{'type':Sequelize[_0x5b88('0x3')]},'link':{'type':Sequelize[_0x5b88('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 87f8de3..f51704f 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 _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x59c4e8,_0xebac9a){_0x59c4e8=_0x59c4e8-0x0;var _0x5a5a6e=_0xc2c7[_0x59c4e8];return _0x5a5a6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5496,0x175));var _0x6549=function(_0x9cb3ec,_0x26ac2a){_0x9cb3ec=_0x9cb3ec-0x0;var _0x10b5f7=_0x5496[_0x9cb3ec];return _0x10b5f7;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8aea930..1436ef1 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 _0xf78f=['exports','define','Integration','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51d89a,_0x3ec6af){var _0x150686=function(_0x21a8c2){while(--_0x21a8c2){_0x51d89a['push'](_0x51d89a['shift']());}};_0x150686(++_0x3ec6af);}(_0xf78f,0x111));var _0xff78=function(_0x4b48c2,_0x19e9cc){_0x4b48c2=_0x4b48c2-0x0;var _0x3d51e2=_0xf78f[_0x4b48c2];return _0x3d51e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff78('0x0'))('api');var moment=require(_0xff78('0x1'));var BPromise=require('bluebird');var rp=require(_0xff78('0x2'));var fs=require('fs');var path=require(_0xff78('0x3'));var rimraf=require(_0xff78('0x4'));var config=require(_0xff78('0x5'));var attributes=require('./integration.attributes');module[_0xff78('0x6')]=function(_0x3408ac,_0x71f224){return _0x3408ac[_0xff78('0x7')](_0xff78('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5963=['define','Integration','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1803c0,_0x4f1a69){var _0x3573b8=function(_0x2ec75e){while(--_0x2ec75e){_0x1803c0['push'](_0x1803c0['shift']());}};_0x3573b8(++_0x4f1a69);}(_0x5963,0x1e6));var _0x3596=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5963[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x3596('0x0'));var logger=require(_0x3596('0x1'))(_0x3596('0x2'));var moment=require(_0x3596('0x3'));var BPromise=require('bluebird');var rp=require(_0x3596('0x4'));var fs=require('fs');var path=require(_0x3596('0x5'));var rimraf=require(_0x3596('0x6'));var config=require(_0x3596('0x7'));var attributes=require('./integration.attributes');module[_0x3596('0x8')]=function(_0x2f83a1,_0x4eb0d5){return _0x2f83a1[_0x3596('0x9')](_0x3596('0xa'),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 adaee78..a348e95 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0xadb5,0xad));var _0x5adb=function(_0x293aa5,_0x1fdfa3){_0x293aa5=_0x293aa5-0x0;var _0xe298bb=_0xadb5[_0x293aa5];return _0xe298bb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1967,0x173));var _0x7196=function(_0x5a0d17,_0x2c8bb7){_0x5a0d17=_0x5a0d17-0x0;var _0xad9656=_0x1967[_0x5a0d17];return _0xad9656;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e8a0789..c7e2801 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x275511,_0x2b8e8f){var _0x418418=function(_0x19cbf2){while(--_0x19cbf2){_0x275511['push'](_0x275511['shift']());}};_0x418418(++_0x2b8e8f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x474037,_0x2a4c42){_0x474037=_0x474037-0x0;var _0x481f68=_0xc6ac[_0x474037];return _0x481f68;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x49e8aa,_0x5e433e){var _0x4ac592=function(_0x3ff4fe){while(--_0x3ff4fe){_0x49e8aa['push'](_0x49e8aa['shift']());}};_0x4ac592(++_0x5e433e);}(_0x4975,0x86));var _0x5497=function(_0x526227,_0x22f3f7){_0x526227=_0x526227-0x0;var _0x49843f=_0x4975[_0x526227];return _0x49843f;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1bdf3ee..41a039f 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 _0x04d0=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING'];(function(_0xe73021,_0x330885){var _0x1c4b81=function(_0x1b3391){while(--_0x1b3391){_0xe73021['push'](_0xe73021['shift']());}};_0x1c4b81(++_0x330885);}(_0x04d0,0x76));var _0x004d=function(_0x30c9fb,_0x459109){_0x30c9fb=_0x30c9fb-0x0;var _0x56fe61=_0x04d0[_0x30c9fb];return _0x56fe61;};'use strict';var Sequelize=require(_0x004d('0x0'));module['exports']={'integration':{'type':Sequelize[_0x004d('0x1')]},'eventChannel':{'type':Sequelize[_0x004d('0x1')]},'exitStatus':{'type':Sequelize[_0x004d('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x004d('0x2')]},'contacts':{'type':Sequelize[_0x004d('0x1')]},'uniqueid':{'type':Sequelize[_0x004d('0x1')]},'calleridnum':{'type':Sequelize[_0x004d('0x1')]},'calleridname':{'type':Sequelize[_0x004d('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x004d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x004d('0x3')]},'holdtime':{'type':Sequelize[_0x004d('0x2')]},'agentcomplete':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x004d('0x3')]},'talktime':{'type':Sequelize[_0x004d('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x004d('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x004d('0x3')]},'agentdump':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x004d('0x3')]},'lastevent':{'type':Sequelize[_0x004d('0x1')]},'channel':{'type':Sequelize[_0x004d('0x1')]},'channelstate':{'type':Sequelize[_0x004d('0x2')]},'channelstatedesc':{'type':Sequelize[_0x004d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x004d('0x1')]},'connectedlinename':{'type':Sequelize[_0x004d('0x1')]},'language':{'type':Sequelize[_0x004d('0x1')]},'accountcode':{'type':Sequelize[_0x004d('0x1')]},'context':{'type':Sequelize[_0x004d('0x1')]},'exten':{'type':Sequelize[_0x004d('0x1')]},'priority':{'type':Sequelize[_0x004d('0x1')]},'destchannel':{'type':Sequelize[_0x004d('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x004d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x004d('0x1')]},'destlanguage':{'type':Sequelize[_0x004d('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x004d('0x1')]},'destpriority':{'type':Sequelize[_0x004d('0x1')]},'destuniqueid':{'type':Sequelize[_0x004d('0x1')]},'messageId':{'type':Sequelize[_0x004d('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x004d('0x1')]},'to':{'type':Sequelize[_0x004d('0x1')]},'cc':{'type':Sequelize[_0x004d('0x1')]},'attachment':{'type':Sequelize[_0x004d('0x5')]},'html':{'type':Sequelize[_0x004d('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x004d('0x6')](_0x004d('0x7'),'SENDING',_0x004d('0x8'),_0x004d('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x004d('0x1')]},'appdata':{'type':Sequelize[_0x004d('0x1')]},'projectId':{'type':Sequelize[_0x004d('0x2')]}}; \ No newline at end of file +var _0x2320=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2320,0x13b));var _0x0232=function(_0x12a28e,_0x2f1bbe){_0x12a28e=_0x12a28e-0x0;var _0x25f86e=_0x2320[_0x12a28e];return _0x25f86e;};'use strict';var Sequelize=require(_0x0232('0x0'));module[_0x0232('0x1')]={'integration':{'type':Sequelize[_0x0232('0x2')]},'eventChannel':{'type':Sequelize[_0x0232('0x2')]},'exitStatus':{'type':Sequelize[_0x0232('0x2')]},'ticketId':{'type':Sequelize[_0x0232('0x2')]},'integrationId':{'type':Sequelize[_0x0232('0x3')]},'contacts':{'type':Sequelize[_0x0232('0x2')]},'uniqueid':{'type':Sequelize[_0x0232('0x2')]},'calleridnum':{'type':Sequelize[_0x0232('0x2')]},'calleridname':{'type':Sequelize[_0x0232('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0232('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x0232('0x4')]},'holdtime':{'type':Sequelize[_0x0232('0x3')]},'agentcomplete':{'type':Sequelize[_0x0232('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x0232('0x3')]},'agentacw':{'type':Sequelize[_0x0232('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x0232('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0232('0x4')]},'agentdump':{'type':Sequelize[_0x0232('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x0232('0x2')]},'channel':{'type':Sequelize[_0x0232('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x0232('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0232('0x2')]},'language':{'type':Sequelize[_0x0232('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0232('0x2')]},'exten':{'type':Sequelize[_0x0232('0x2')]},'priority':{'type':Sequelize[_0x0232('0x2')]},'destchannel':{'type':Sequelize[_0x0232('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0232('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0232('0x2')]},'destcalleridname':{'type':Sequelize[_0x0232('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x0232('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x0232('0x2')]},'destlanguage':{'type':Sequelize[_0x0232('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x0232('0x2')]},'destexten':{'type':Sequelize[_0x0232('0x2')]},'destpriority':{'type':Sequelize[_0x0232('0x2')]},'destuniqueid':{'type':Sequelize[_0x0232('0x2')]},'messageId':{'type':Sequelize[_0x0232('0x2')]},'inReplyTo':{'type':Sequelize[_0x0232('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0232('0x2')]},'to':{'type':Sequelize[_0x0232('0x2')]},'cc':{'type':Sequelize[_0x0232('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0232('0x6')]},'status':{'type':Sequelize[_0x0232('0x7')](_0x0232('0x8'),_0x0232('0x9'),_0x0232('0xa'),_0x0232('0xb'))},'url':{'type':Sequelize[_0x0232('0x2')]},'app':{'type':Sequelize[_0x0232('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b1c9ce5..4da15c6 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 _0x3998=['order','sort','where','filters','filter','VIRTUAL','options','include','rows','catch','show','params','keys','intersection','merge','find','create','body','update','describe','eml-format','zip-dir','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2c6c95,_0x3e88d6){var _0x109f35=function(_0x1f02e3){while(--_0x1f02e3){_0x2c6c95['push'](_0x2c6c95['shift']());}};_0x109f35(++_0x3e88d6);}(_0x3998,0xf2));var _0x8399=function(_0x163dd1,_0xc50470){_0x163dd1=_0x163dd1-0x0;var _0x591417=_0x3998[_0x163dd1];return _0x591417;};'use strict';var emlformat=require(_0x8399('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8399('0x1'));var jsonpatch=require(_0x8399('0x2'));var rp=require(_0x8399('0x3'));var moment=require(_0x8399('0x4'));var BPromise=require(_0x8399('0x5'));var Mustache=require(_0x8399('0x6'));var util=require(_0x8399('0x7'));var path=require('path');var sox=require(_0x8399('0x8'));var csv=require(_0x8399('0x9'));var ejs=require(_0x8399('0xa'));var fs=require('fs');var fs_extra=require(_0x8399('0xb'));var _=require(_0x8399('0xc'));var squel=require(_0x8399('0xd'));var crypto=require(_0x8399('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8399('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8399('0x10'));var Redis=require(_0x8399('0x11'));var authService=require(_0x8399('0x12'));var qs=require(_0x8399('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8399('0x14'));var logger=require(_0x8399('0x15'))('api');var utils=require(_0x8399('0x16'));var config=require(_0x8399('0x17'));var licenseUtil=require(_0x8399('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42cd69,_0x2892cc){_0x2892cc=_0x2892cc||0xcc;return function(_0x5c2fbd){if(_0x5c2fbd){return _0x42cd69[_0x8399('0x19')](_0x2892cc);}return _0x42cd69[_0x8399('0x1a')](_0x2892cc)[_0x8399('0x1b')]();};}function respondWithResult(_0x50d1b6,_0x1c8d5d){_0x1c8d5d=_0x1c8d5d||0xc8;return function(_0x3ff490){if(_0x3ff490){return _0x50d1b6[_0x8399('0x1a')](_0x1c8d5d)[_0x8399('0x1c')](_0x3ff490);}};}function respondWithFilteredResult(_0xd65be9,_0x42ff34){return function(_0x7de1ed){if(_0x7de1ed){var _0x4ca8ac=typeof _0x42ff34[_0x8399('0x1d')]===_0x8399('0x1e')&&typeof _0x42ff34[_0x8399('0x1f')]===_0x8399('0x1e');var _0x50b0b4=_0x7de1ed[_0x8399('0x20')];var _0x3346e3=_0x4ca8ac?0x0:_0x42ff34[_0x8399('0x1d')];var _0x2048b1=_0x4ca8ac?_0x7de1ed[_0x8399('0x20')]:_0x42ff34[_0x8399('0x1d')]+_0x42ff34[_0x8399('0x1f')];var _0x532467;if(_0x2048b1>=_0x50b0b4){_0x2048b1=_0x50b0b4;_0x532467=0xc8;}else{_0x532467=0xce;}_0xd65be9['status'](_0x532467);return _0xd65be9['set'](_0x8399('0x21'),_0x3346e3+'-'+_0x2048b1+'/'+_0x50b0b4)[_0x8399('0x1c')](_0x7de1ed);}return null;};}function patchUpdates(_0x4fc495){return function(_0x5472ad){try{jsonpatch['apply'](_0x5472ad,_0x4fc495,!![]);}catch(_0x137d3e){return BPromise[_0x8399('0x22')](_0x137d3e);}return _0x5472ad[_0x8399('0x23')]();};}function saveUpdates(_0x10ba48,_0x448073){return function(_0x53e916){if(_0x53e916){return _0x53e916['update'](_0x10ba48)[_0x8399('0x24')](function(_0x516fe0){return _0x516fe0;});}return null;};}function removeEntity(_0x269e65,_0x4c9e2e){return function(_0x2a6830){if(_0x2a6830){return _0x2a6830[_0x8399('0x25')]()['then'](function(){_0x269e65[_0x8399('0x1a')](0xcc)[_0x8399('0x1b')]();});}};}function handleEntityNotFound(_0x16fecc,_0x4f5976){return function(_0x7ada0a){if(!_0x7ada0a){_0x16fecc['sendStatus'](0x194);}return _0x7ada0a;};}function handleError(_0x22593b,_0x3375c0){_0x3375c0=_0x3375c0||0x1f4;return function(_0x7a49ba){logger[_0x8399('0x26')](_0x7a49ba[_0x8399('0x27')]);if(_0x7a49ba['name']){delete _0x7a49ba[_0x8399('0x28')];}_0x22593b[_0x8399('0x1a')](_0x3375c0)[_0x8399('0x29')](_0x7a49ba);};}exports[_0x8399('0x2a')]=function(_0x223f29,_0x1c143a){var _0x5389ab={},_0x461598={},_0x25126a={'count':0x0,'rows':[]};var _0x346903=_[_0x8399('0x2b')](db[_0x8399('0x2c')][_0x8399('0x2d')],function(_0x304380){return{'name':_0x304380[_0x8399('0x2e')],'type':_0x304380['type'][_0x8399('0x2f')]};});_0x461598[_0x8399('0x30')]=_['map'](_0x346903,_0x8399('0x28'));_0x461598['query']=_['keys'](_0x223f29[_0x8399('0x31')]);_0x461598['filters']=_['intersection'](_0x461598[_0x8399('0x30')],_0x461598['query']);_0x5389ab[_0x8399('0x32')]=_['intersection'](_0x461598[_0x8399('0x30')],qs[_0x8399('0x33')](_0x223f29['query'][_0x8399('0x33')]));_0x5389ab['attributes']=_0x5389ab[_0x8399('0x32')]['length']?_0x5389ab[_0x8399('0x32')]:_0x461598['model'];if(!_0x223f29[_0x8399('0x31')][_0x8399('0x34')](_0x8399('0x35'))){_0x5389ab['limit']=qs[_0x8399('0x1f')](_0x223f29[_0x8399('0x31')]['limit']);_0x5389ab['offset']=qs[_0x8399('0x1d')](_0x223f29['query'][_0x8399('0x1d')]);}_0x5389ab[_0x8399('0x36')]=qs[_0x8399('0x37')](_0x223f29[_0x8399('0x31')]['sort']);_0x5389ab[_0x8399('0x38')]=qs['filters'](_['pick'](_0x223f29[_0x8399('0x31')],_0x461598[_0x8399('0x39')]),_0x346903);if(_0x223f29[_0x8399('0x31')][_0x8399('0x3a')]){_0x5389ab[_0x8399('0x38')]=_['merge'](_0x5389ab['where'],{'$or':_[_0x8399('0x2b')](_0x346903,function(_0x3e11f5){if(_0x3e11f5['type']!==_0x8399('0x3b')){var _0x1a74f3={};_0x1a74f3[_0x3e11f5['name']]={'$like':'%'+_0x223f29['query']['filter']+'%'};return _0x1a74f3;}})});}_0x5389ab=_['merge']({},_0x5389ab,_0x223f29[_0x8399('0x3c')]);var _0x5e3795={'where':_0x5389ab['where']};return db[_0x8399('0x2c')][_0x8399('0x20')](_0x5e3795)[_0x8399('0x24')](function(_0x1d0bf0){_0x25126a['count']=_0x1d0bf0;if(_0x223f29['query']['includeAll']){_0x5389ab[_0x8399('0x3d')]=[{'all':!![]}];}return db[_0x8399('0x2c')]['findAll'](_0x5389ab);})[_0x8399('0x24')](function(_0x46d5b0){_0x25126a[_0x8399('0x3e')]=_0x46d5b0;return _0x25126a;})[_0x8399('0x24')](respondWithFilteredResult(_0x1c143a,_0x5389ab))[_0x8399('0x3f')](handleError(_0x1c143a,null));};exports[_0x8399('0x40')]=function(_0x2f91bd,_0x149e9a){var _0x561a14={'raw':![],'where':{'id':_0x2f91bd[_0x8399('0x41')]['id']}},_0x142be9={};_0x142be9[_0x8399('0x30')]=_[_0x8399('0x42')](db[_0x8399('0x2c')][_0x8399('0x2d')]);_0x142be9[_0x8399('0x31')]=_[_0x8399('0x42')](_0x2f91bd[_0x8399('0x31')]);_0x142be9[_0x8399('0x39')]=_[_0x8399('0x43')](_0x142be9['model'],_0x142be9[_0x8399('0x31')]);_0x561a14[_0x8399('0x32')]=_[_0x8399('0x43')](_0x142be9[_0x8399('0x30')],qs['fields'](_0x2f91bd[_0x8399('0x31')][_0x8399('0x33')]));_0x561a14[_0x8399('0x32')]=_0x561a14[_0x8399('0x32')]['length']?_0x561a14['attributes']:_0x142be9[_0x8399('0x30')];if(_0x2f91bd[_0x8399('0x31')]['includeAll']){_0x561a14[_0x8399('0x3d')]=[{'all':!![]}];}_0x561a14=_[_0x8399('0x44')]({},_0x561a14,_0x2f91bd['options']);return db[_0x8399('0x2c')][_0x8399('0x45')](_0x561a14)['then'](handleEntityNotFound(_0x149e9a,null))['then'](respondWithResult(_0x149e9a,null))[_0x8399('0x3f')](handleError(_0x149e9a,null));};exports[_0x8399('0x46')]=function(_0x4ad4ca,_0x3a135a){return db[_0x8399('0x2c')]['create'](_0x4ad4ca[_0x8399('0x47')],{})[_0x8399('0x24')](respondWithResult(_0x3a135a,0xc9))[_0x8399('0x3f')](handleError(_0x3a135a,null));};exports[_0x8399('0x48')]=function(_0x1e0da8,_0x289afd){if(_0x1e0da8['body']['id']){delete _0x1e0da8[_0x8399('0x47')]['id'];}return db['IntegrationReport'][_0x8399('0x45')]({'where':{'id':_0x1e0da8[_0x8399('0x41')]['id']}})[_0x8399('0x24')](handleEntityNotFound(_0x289afd,null))[_0x8399('0x24')](saveUpdates(_0x1e0da8[_0x8399('0x47')],null))[_0x8399('0x24')](respondWithResult(_0x289afd,null))[_0x8399('0x3f')](handleError(_0x289afd,null));};exports[_0x8399('0x25')]=function(_0x329c1f,_0x32d0c9){return db['IntegrationReport']['find']({'where':{'id':_0x329c1f[_0x8399('0x41')]['id']}})[_0x8399('0x24')](handleEntityNotFound(_0x32d0c9,null))['then'](removeEntity(_0x32d0c9,null))[_0x8399('0x3f')](handleError(_0x32d0c9,null));};exports[_0x8399('0x49')]=function(_0x3555bc,_0x40159e){return db[_0x8399('0x2c')][_0x8399('0x49')]()[_0x8399('0x24')](respondWithResult(_0x40159e,null))[_0x8399('0x3f')](handleError(_0x40159e,null));}; \ No newline at end of file +var _0xe54c=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','IntegrationReport','includeAll','include','findAll','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x1ec7f6,_0x4d73cc){var _0x4108d6=function(_0x22df74){while(--_0x22df74){_0x1ec7f6['push'](_0x1ec7f6['shift']());}};_0x4108d6(++_0x4d73cc);}(_0xe54c,0x104));var _0xce54=function(_0x5d8694,_0x12b8c2){_0x5d8694=_0x5d8694-0x0;var _0x442111=_0xe54c[_0x5d8694];return _0x442111;};'use strict';var emlformat=require(_0xce54('0x0'));var rimraf=require(_0xce54('0x1'));var zipdir=require(_0xce54('0x2'));var jsonpatch=require(_0xce54('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce54('0x4'));var Mustache=require(_0xce54('0x5'));var util=require(_0xce54('0x6'));var path=require(_0xce54('0x7'));var sox=require('sox');var csv=require(_0xce54('0x8'));var ejs=require(_0xce54('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce54('0xa'));var crypto=require(_0xce54('0xb'));var jsforce=require(_0xce54('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xce54('0x8'));var querystring=require(_0xce54('0xd'));var Papa=require(_0xce54('0xe'));var Redis=require(_0xce54('0xf'));var authService=require(_0xce54('0x10'));var qs=require(_0xce54('0x11'));var as=require(_0xce54('0x12'));var hardwareService=require(_0xce54('0x13'));var logger=require('../../config/logger')(_0xce54('0x14'));var utils=require('../../config/utils');var config=require(_0xce54('0x15'));var licenseUtil=require(_0xce54('0x16'));var db=require(_0xce54('0x17'))['db'];function respondWithStatusCode(_0x398c29,_0x4c03d0){_0x4c03d0=_0x4c03d0||0xcc;return function(_0x2b4da9){if(_0x2b4da9){return _0x398c29['sendStatus'](_0x4c03d0);}return _0x398c29[_0xce54('0x18')](_0x4c03d0)[_0xce54('0x19')]();};}function respondWithResult(_0x2b9931,_0x213fb0){_0x213fb0=_0x213fb0||0xc8;return function(_0x44de1b){if(_0x44de1b){return _0x2b9931[_0xce54('0x18')](_0x213fb0)[_0xce54('0x1a')](_0x44de1b);}};}function respondWithFilteredResult(_0x591556,_0x4754a2){return function(_0x538e43){if(_0x538e43){var _0x4d70cf=typeof _0x4754a2[_0xce54('0x1b')]==='undefined'&&typeof _0x4754a2['limit']===_0xce54('0x1c');var _0x22c080=_0x538e43[_0xce54('0x1d')];var _0x2f97b9=_0x4d70cf?0x0:_0x4754a2[_0xce54('0x1b')];var _0x318773=_0x4d70cf?_0x538e43['count']:_0x4754a2[_0xce54('0x1b')]+_0x4754a2[_0xce54('0x1e')];var _0xf383a0;if(_0x318773>=_0x22c080){_0x318773=_0x22c080;_0xf383a0=0xc8;}else{_0xf383a0=0xce;}_0x591556[_0xce54('0x18')](_0xf383a0);return _0x591556[_0xce54('0x1f')](_0xce54('0x20'),_0x2f97b9+'-'+_0x318773+'/'+_0x22c080)[_0xce54('0x1a')](_0x538e43);}return null;};}function patchUpdates(_0x53f770){return function(_0x378c9f){try{jsonpatch[_0xce54('0x21')](_0x378c9f,_0x53f770,!![]);}catch(_0x42bc41){return BPromise[_0xce54('0x22')](_0x42bc41);}return _0x378c9f[_0xce54('0x23')]();};}function saveUpdates(_0x1c39ae,_0x1dd52d){return function(_0x470155){if(_0x470155){return _0x470155[_0xce54('0x24')](_0x1c39ae)[_0xce54('0x25')](function(_0x376106){return _0x376106;});}return null;};}function removeEntity(_0x1d47ed,_0x4853a7){return function(_0x2b1ffd){if(_0x2b1ffd){return _0x2b1ffd['destroy']()['then'](function(){_0x1d47ed[_0xce54('0x18')](0xcc)[_0xce54('0x19')]();});}};}function handleEntityNotFound(_0xf9ef80,_0x301fec){return function(_0x3e8450){if(!_0x3e8450){_0xf9ef80['sendStatus'](0x194);}return _0x3e8450;};}function handleError(_0x550772,_0x41f5f7){_0x41f5f7=_0x41f5f7||0x1f4;return function(_0x510cfe){logger['error'](_0x510cfe[_0xce54('0x26')]);if(_0x510cfe[_0xce54('0x27')]){delete _0x510cfe['name'];}_0x550772[_0xce54('0x18')](_0x41f5f7)[_0xce54('0x28')](_0x510cfe);};}exports[_0xce54('0x29')]=function(_0x5d3f6c,_0xa8cbcd){var _0x37558f={},_0x288b38={},_0xbfc9ba={'count':0x0,'rows':[]};var _0x14509d=_[_0xce54('0x2a')](db['IntegrationReport']['rawAttributes'],function(_0x33ecea){return{'name':_0x33ecea[_0xce54('0x2b')],'type':_0x33ecea[_0xce54('0x2c')][_0xce54('0x2d')]};});_0x288b38[_0xce54('0x2e')]=_[_0xce54('0x2a')](_0x14509d,_0xce54('0x27'));_0x288b38[_0xce54('0x2f')]=_[_0xce54('0x30')](_0x5d3f6c[_0xce54('0x2f')]);_0x288b38[_0xce54('0x31')]=_[_0xce54('0x32')](_0x288b38[_0xce54('0x2e')],_0x288b38[_0xce54('0x2f')]);_0x37558f[_0xce54('0x33')]=_[_0xce54('0x32')](_0x288b38[_0xce54('0x2e')],qs['fields'](_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x34')]));_0x37558f[_0xce54('0x33')]=_0x37558f[_0xce54('0x33')]['length']?_0x37558f[_0xce54('0x33')]:_0x288b38['model'];if(!_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x35')](_0xce54('0x36'))){_0x37558f[_0xce54('0x1e')]=qs[_0xce54('0x1e')](_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x1e')]);_0x37558f[_0xce54('0x1b')]=qs[_0xce54('0x1b')](_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x1b')]);}_0x37558f['order']=qs['sort'](_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x37')]);_0x37558f[_0xce54('0x38')]=qs[_0xce54('0x31')](_[_0xce54('0x39')](_0x5d3f6c[_0xce54('0x2f')],_0x288b38[_0xce54('0x31')]),_0x14509d);if(_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x3a')]){_0x37558f[_0xce54('0x38')]=_[_0xce54('0x3b')](_0x37558f['where'],{'$or':_['map'](_0x14509d,function(_0x3a3e38){if(_0x3a3e38[_0xce54('0x2c')]!=='VIRTUAL'){var _0x361f9e={};_0x361f9e[_0x3a3e38[_0xce54('0x27')]]={'$like':'%'+_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x3a')]+'%'};return _0x361f9e;}})});}_0x37558f=_['merge']({},_0x37558f,_0x5d3f6c[_0xce54('0x3c')]);var _0x5f49ea={'where':_0x37558f[_0xce54('0x38')]};return db[_0xce54('0x3d')][_0xce54('0x1d')](_0x5f49ea)[_0xce54('0x25')](function(_0x596ba0){_0xbfc9ba[_0xce54('0x1d')]=_0x596ba0;if(_0x5d3f6c[_0xce54('0x2f')][_0xce54('0x3e')]){_0x37558f[_0xce54('0x3f')]=[{'all':!![]}];}return db[_0xce54('0x3d')][_0xce54('0x40')](_0x37558f);})[_0xce54('0x25')](function(_0x10f873){_0xbfc9ba['rows']=_0x10f873;return _0xbfc9ba;})[_0xce54('0x25')](respondWithFilteredResult(_0xa8cbcd,_0x37558f))[_0xce54('0x41')](handleError(_0xa8cbcd,null));};exports[_0xce54('0x42')]=function(_0x445ec2,_0x32e3a1){var _0xcc9cce={'raw':![],'where':{'id':_0x445ec2['params']['id']}},_0x164c81={};_0x164c81['model']=_[_0xce54('0x30')](db[_0xce54('0x3d')]['rawAttributes']);_0x164c81['query']=_['keys'](_0x445ec2[_0xce54('0x2f')]);_0x164c81['filters']=_['intersection'](_0x164c81[_0xce54('0x2e')],_0x164c81[_0xce54('0x2f')]);_0xcc9cce['attributes']=_[_0xce54('0x32')](_0x164c81[_0xce54('0x2e')],qs[_0xce54('0x34')](_0x445ec2['query'][_0xce54('0x34')]));_0xcc9cce[_0xce54('0x33')]=_0xcc9cce['attributes']['length']?_0xcc9cce[_0xce54('0x33')]:_0x164c81['model'];if(_0x445ec2['query'][_0xce54('0x3e')]){_0xcc9cce[_0xce54('0x3f')]=[{'all':!![]}];}_0xcc9cce=_[_0xce54('0x3b')]({},_0xcc9cce,_0x445ec2['options']);return db['IntegrationReport']['find'](_0xcc9cce)[_0xce54('0x25')](handleEntityNotFound(_0x32e3a1,null))['then'](respondWithResult(_0x32e3a1,null))['catch'](handleError(_0x32e3a1,null));};exports[_0xce54('0x43')]=function(_0x4d99ea,_0x4e1eb0){return db[_0xce54('0x3d')][_0xce54('0x43')](_0x4d99ea[_0xce54('0x44')],{})['then'](respondWithResult(_0x4e1eb0,0xc9))[_0xce54('0x41')](handleError(_0x4e1eb0,null));};exports[_0xce54('0x24')]=function(_0x398843,_0x4b9c98){if(_0x398843['body']['id']){delete _0x398843['body']['id'];}return db[_0xce54('0x3d')][_0xce54('0x45')]({'where':{'id':_0x398843['params']['id']}})['then'](handleEntityNotFound(_0x4b9c98,null))[_0xce54('0x25')](saveUpdates(_0x398843[_0xce54('0x44')],null))['then'](respondWithResult(_0x4b9c98,null))['catch'](handleError(_0x4b9c98,null));};exports['destroy']=function(_0x4d2147,_0xc49a7b){return db[_0xce54('0x3d')][_0xce54('0x45')]({'where':{'id':_0x4d2147[_0xce54('0x46')]['id']}})[_0xce54('0x25')](handleEntityNotFound(_0xc49a7b,null))[_0xce54('0x25')](removeEntity(_0xc49a7b,null))['catch'](handleError(_0xc49a7b,null));};exports[_0xce54('0x47')]=function(_0x2c5001,_0x48e173){return db[_0xce54('0x3d')][_0xce54('0x47')]()[_0xce54('0x25')](respondWithResult(_0x48e173,null))['catch'](handleError(_0x48e173,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7dc913b..e48c1b6 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 _0xa31e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','../../config/logger'];(function(_0x2dced6,_0x3ebeca){var _0x49774f=function(_0x45cca0){while(--_0x45cca0){_0x2dced6['push'](_0x2dced6['shift']());}};_0x49774f(++_0x3ebeca);}(_0xa31e,0x15a));var _0xea31=function(_0x4a00d0,_0x56d533){_0x4a00d0=_0x4a00d0-0x0;var _0x6e25bf=_0xa31e[_0x4a00d0];return _0x6e25bf;};'use strict';var _=require(_0xea31('0x0'));var util=require('util');var logger=require(_0xea31('0x1'))('api');var moment=require(_0xea31('0x2'));var BPromise=require(_0xea31('0x3'));var rp=require(_0xea31('0x4'));var fs=require('fs');var path=require(_0xea31('0x5'));var rimraf=require(_0xea31('0x6'));var config=require(_0xea31('0x7'));var attributes=require(_0xea31('0x8'));module['exports']=function(_0x1c9f10,_0x1bef5c){return _0x1c9f10[_0xea31('0x9')](_0xea31('0xa'),attributes,{'tableName':_0xea31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe02=['request-promise','rimraf','exports','define','report_integration','lodash','util','bluebird'];(function(_0x493a40,_0x375411){var _0x36abb3=function(_0x48e7a3){while(--_0x48e7a3){_0x493a40['push'](_0x493a40['shift']());}};_0x36abb3(++_0x375411);}(_0xfe02,0xdd));var _0x2fe0=function(_0x536076,_0x4c5460){_0x536076=_0x536076-0x0;var _0x246902=_0xfe02[_0x536076];return _0x246902;};'use strict';var _=require(_0x2fe0('0x0'));var util=require(_0x2fe0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2fe0('0x2'));var rp=require(_0x2fe0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fe0('0x4'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x2fe0('0x5')]=function(_0x201460,_0x32559c){return _0x201460[_0x2fe0('0x6')]('IntegrationReport',attributes,{'tableName':_0x2fe0('0x7'),'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 4556091..9f007ff 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1e77a2,_0x329255){var _0x2b9446=function(_0x3dd0d6){while(--_0x3dd0d6){_0x1e77a2['push'](_0x1e77a2['shift']());}};_0x2b9446(++_0x329255);}(_0x1261,0x144));var _0x1126=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0x1261[_0x291ec3];return _0x423b99;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index edd6f90..ac426c4 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 _0x0578=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','get','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy'];(function(_0x5bc95c,_0xfed759){var _0x3721fc=function(_0x49fca7){while(--_0x49fca7){_0x5bc95c['push'](_0x5bc95c['shift']());}};_0x3721fc(++_0xfed759);}(_0x0578,0x1b8));var _0x8057=function(_0x4ace09,_0x5b6e68){_0x4ace09=_0x4ace09-0x0;var _0x3fdf87=_0x0578[_0x4ace09];return _0x3fdf87;};'use strict';var multer=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var path=require(_0x8057('0x2'));var timeout=require(_0x8057('0x3'));var express=require(_0x8057('0x4'));var router=express['Router']();var fs_extra=require(_0x8057('0x5'));var auth=require(_0x8057('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8057('0x7'));var controller=require(_0x8057('0x8'));router['get']('/',auth[_0x8057('0x9')](),controller['index']);router[_0x8057('0xa')](_0x8057('0xb'),auth['isAuthenticated'](),controller[_0x8057('0xc')]);router['get'](_0x8057('0xd'),auth[_0x8057('0x9')](),controller[_0x8057('0xe')]);router[_0x8057('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8057('0xd'),auth[_0x8057('0x9')](),controller[_0x8057('0x10')]);router[_0x8057('0xf')](_0x8057('0x11'),auth[_0x8057('0x9')](),controller['addIntervals']);router[_0x8057('0x12')](_0x8057('0xb'),auth['isAuthenticated'](),controller[_0x8057('0x13')]);router[_0x8057('0x14')]('/:id',auth[_0x8057('0x9')](),controller[_0x8057('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2384=['../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','/:id/sub_intervals','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x2384,0x1aa));var _0x4238=function(_0x3aa676,_0x583096){_0x3aa676=_0x3aa676-0x0;var _0x33f7d5=_0x2384[_0x3aa676];return _0x33f7d5;};'use strict';var multer=require(_0x4238('0x0'));var util=require('util');var path=require(_0x4238('0x1'));var timeout=require(_0x4238('0x2'));var express=require(_0x4238('0x3'));var router=express[_0x4238('0x4')]();var fs_extra=require(_0x4238('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4238('0x6'));var config=require('../../config/environment');var controller=require(_0x4238('0x7'));router[_0x4238('0x8')]('/',auth[_0x4238('0x9')](),controller[_0x4238('0xa')]);router[_0x4238('0x8')](_0x4238('0xb'),auth[_0x4238('0x9')](),controller[_0x4238('0xc')]);router[_0x4238('0x8')]('/:id/sub_intervals',auth[_0x4238('0x9')](),controller[_0x4238('0xd')]);router['post']('/',auth[_0x4238('0x9')](),controller['create']);router['post'](_0x4238('0xe'),auth[_0x4238('0x9')](),controller[_0x4238('0xf')]);router[_0x4238('0x10')](_0x4238('0x11'),auth[_0x4238('0x9')](),controller[_0x4238('0x12')]);router[_0x4238('0x13')](_0x4238('0xb'),auth[_0x4238('0x9')](),controller[_0x4238('0x14')]);router[_0x4238('0x15')](_0x4238('0xb'),auth[_0x4238('0x9')](),controller[_0x4238('0x16')]);module[_0x4238('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 36550fb..075f588 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 _0xe808=['STRING','sequelize'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0xe808,0x151));var _0x8e80=function(_0x32e007,_0x553a84){_0x32e007=_0x32e007-0x0;var _0x26dae4=_0xe808[_0x32e007];return _0x26dae4;};'use strict';var Sequelize=require(_0x8e80('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e80('0x1')]},'description':{'type':Sequelize[_0x8e80('0x1')]},'interval':{'type':Sequelize[_0x8e80('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5b74=['exports','STRING'];(function(_0x4dd554,_0x1ae6eb){var _0x3bd45b=function(_0x364ffe){while(--_0x364ffe){_0x4dd554['push'](_0x4dd554['shift']());}};_0x3bd45b(++_0x1ae6eb);}(_0x5b74,0x1bc));var _0x45b7=function(_0x56727c,_0x3a4af4){_0x56727c=_0x56727c-0x0;var _0x1de7ba=_0x5b74[_0x56727c];return _0x1de7ba;};'use strict';var Sequelize=require('sequelize');module[_0x45b7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x45b7('0x1')]},'interval':{'type':Sequelize[_0x45b7('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 6761ee8..0c4e285 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 _0xe8fa=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','get','Intervals','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','Interval','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','sequelize','bulkCreate','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x4dd8e3,_0x297015){var _0x53c676=function(_0x323522){while(--_0x323522){_0x4dd8e3['push'](_0x4dd8e3['shift']());}};_0x53c676(++_0x297015);}(_0xe8fa,0x164));var _0xae8f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe8fa[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae8f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae8f('0x1'));var rp=require(_0xae8f('0x2'));var moment=require(_0xae8f('0x3'));var BPromise=require(_0xae8f('0x4'));var Mustache=require(_0xae8f('0x5'));var util=require(_0xae8f('0x6'));var path=require(_0xae8f('0x7'));var sox=require(_0xae8f('0x8'));var csv=require(_0xae8f('0x9'));var ejs=require(_0xae8f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae8f('0xb'));var squel=require(_0xae8f('0xc'));var crypto=require(_0xae8f('0xd'));var jsforce=require(_0xae8f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae8f('0xf'));var Redis=require(_0xae8f('0x10'));var authService=require(_0xae8f('0x11'));var qs=require(_0xae8f('0x12'));var as=require(_0xae8f('0x13'));var hardwareService=require(_0xae8f('0x14'));var logger=require('../../config/logger')(_0xae8f('0x15'));var utils=require('../../config/utils');var config=require(_0xae8f('0x16'));var licenseUtil=require(_0xae8f('0x17'));var db=require(_0xae8f('0x18'))['db'];var extensions=require(_0xae8f('0x19'));function respondWithStatusCode(_0x1541d1,_0x3df548){_0x3df548=_0x3df548||0xcc;return function(_0x53d469){if(_0x53d469){return _0x1541d1[_0xae8f('0x1a')](_0x3df548);}return _0x1541d1[_0xae8f('0x1b')](_0x3df548)[_0xae8f('0x1c')]();};}function respondWithResult(_0x59157c,_0x4f252c){_0x4f252c=_0x4f252c||0xc8;return function(_0xe332af){if(_0xe332af){return _0x59157c['status'](_0x4f252c)['json'](_0xe332af);}};}function respondWithFilteredResult(_0x659872,_0x2a6305){return function(_0x4a6504){if(_0x4a6504){var _0x258d80=typeof _0x2a6305[_0xae8f('0x1d')]===_0xae8f('0x1e')&&typeof _0x2a6305[_0xae8f('0x1f')]==='undefined';var _0x40ccd7=_0x4a6504['count'];var _0x24325d=_0x258d80?0x0:_0x2a6305[_0xae8f('0x1d')];var _0x17fcd4=_0x258d80?_0x4a6504[_0xae8f('0x20')]:_0x2a6305[_0xae8f('0x1d')]+_0x2a6305['limit'];var _0x4011c9;if(_0x17fcd4>=_0x40ccd7){_0x17fcd4=_0x40ccd7;_0x4011c9=0xc8;}else{_0x4011c9=0xce;}_0x659872[_0xae8f('0x1b')](_0x4011c9);return _0x659872['set'](_0xae8f('0x21'),_0x24325d+'-'+_0x17fcd4+'/'+_0x40ccd7)[_0xae8f('0x22')](_0x4a6504);}return null;};}function patchUpdates(_0x326d05){return function(_0x621b99){try{jsonpatch[_0xae8f('0x23')](_0x621b99,_0x326d05,!![]);}catch(_0x160cfb){return BPromise[_0xae8f('0x24')](_0x160cfb);}return _0x621b99['save']();};}function saveUpdates(_0x50707d,_0x2acf6b){return function(_0x817427){if(_0x817427){return _0x817427[_0xae8f('0x25')](_0x50707d)[_0xae8f('0x26')](function(_0x530e3a){return _0x530e3a;});}return null;};}function removeEntity(_0x54b4de,_0x41f40c){return function(_0x4f6142){if(_0x4f6142){return _0x4f6142[_0xae8f('0x27')]()[_0xae8f('0x26')](function(){var _0x378c92=_0x4f6142[_0xae8f('0x28')]({'plain':!![]});var _0xc95efb=_0xae8f('0x29');return db['UserProfileResource'][_0xae8f('0x27')]({'where':{'type':_0xc95efb,'resourceId':_0x378c92['id']}})[_0xae8f('0x26')](function(){return _0x4f6142;});})[_0xae8f('0x26')](function(){_0x54b4de[_0xae8f('0x1b')](0xcc)[_0xae8f('0x1c')]();});}};}function handleEntityNotFound(_0x4f0847,_0xd0882a){return function(_0x3c4223){if(!_0x3c4223){_0x4f0847[_0xae8f('0x1a')](0x194);}return _0x3c4223;};}function handleError(_0x112d89,_0xe35258){_0xe35258=_0xe35258||0x1f4;return function(_0x44a79e){logger[_0xae8f('0x2a')](_0x44a79e[_0xae8f('0x2b')]);if(_0x44a79e[_0xae8f('0x2c')]){delete _0x44a79e[_0xae8f('0x2c')];}_0x112d89['status'](_0xe35258)[_0xae8f('0x2d')](_0x44a79e);};}exports[_0xae8f('0x2e')]=function(_0x14fe9b,_0x3de475){var _0x31f742={},_0x5648f6={},_0x36adc1={'count':0x0,'rows':[]};var _0x465b5b=_[_0xae8f('0x2f')](db['Interval'][_0xae8f('0x30')],function(_0x5e1001){return{'name':_0x5e1001['fieldName'],'type':_0x5e1001[_0xae8f('0x31')]['key']};});_0x5648f6['model']=_['map'](_0x465b5b,_0xae8f('0x2c'));_0x5648f6[_0xae8f('0x32')]=_[_0xae8f('0x33')](_0x14fe9b[_0xae8f('0x32')]);_0x5648f6[_0xae8f('0x34')]=_[_0xae8f('0x35')](_0x5648f6[_0xae8f('0x36')],_0x5648f6[_0xae8f('0x32')]);_0x31f742[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x5648f6[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x38')]));_0x31f742['attributes']=_0x31f742[_0xae8f('0x37')][_0xae8f('0x39')]?_0x31f742[_0xae8f('0x37')]:_0x5648f6[_0xae8f('0x36')];if(!_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x3a')]('nolimit')){_0x31f742[_0xae8f('0x1f')]=qs[_0xae8f('0x1f')](_0x14fe9b['query'][_0xae8f('0x1f')]);_0x31f742['offset']=qs[_0xae8f('0x1d')](_0x14fe9b['query'][_0xae8f('0x1d')]);}_0x31f742[_0xae8f('0x3b')]=qs[_0xae8f('0x3c')](_0x14fe9b[_0xae8f('0x32')][_0xae8f('0x3c')]);_0x31f742[_0xae8f('0x3d')]=qs[_0xae8f('0x34')](_['pick'](_0x14fe9b[_0xae8f('0x32')],_0x5648f6[_0xae8f('0x34')]),_0x465b5b);if(_0x14fe9b['query']['filter']){_0x31f742[_0xae8f('0x3d')]=_['merge'](_0x31f742['where'],{'$or':_[_0xae8f('0x2f')](_0x465b5b,function(_0x8d5651){if(_0x8d5651[_0xae8f('0x31')]!==_0xae8f('0x3e')){var _0x35b082={};_0x35b082[_0x8d5651[_0xae8f('0x2c')]]={'$like':'%'+_0x14fe9b['query'][_0xae8f('0x3f')]+'%'};return _0x35b082;}})});}_0x31f742=_[_0xae8f('0x40')]({},_0x31f742,_0x14fe9b[_0xae8f('0x41')]);var _0x100676={'where':_0x31f742['where']};return db[_0xae8f('0x42')][_0xae8f('0x20')](_0x100676)[_0xae8f('0x26')](function(_0xe5762){_0x36adc1[_0xae8f('0x20')]=_0xe5762;if(_0x14fe9b['query'][_0xae8f('0x43')]){_0x31f742[_0xae8f('0x44')]=[{'all':!![]}];}return db[_0xae8f('0x42')][_0xae8f('0x45')](_0x31f742);})[_0xae8f('0x26')](function(_0x52dd3e){_0x36adc1[_0xae8f('0x46')]=_0x52dd3e;return _0x36adc1;})[_0xae8f('0x26')](respondWithFilteredResult(_0x3de475,_0x31f742))[_0xae8f('0x47')](handleError(_0x3de475,null));};exports[_0xae8f('0x48')]=function(_0x25164e,_0xcb7d25){var _0x4633b0={'raw':!![],'where':{'id':_0x25164e[_0xae8f('0x49')]['id']}},_0x387341={};_0x387341[_0xae8f('0x36')]=_[_0xae8f('0x33')](db['Interval'][_0xae8f('0x30')]);_0x387341[_0xae8f('0x32')]=_[_0xae8f('0x33')](_0x25164e[_0xae8f('0x32')]);_0x387341['filters']=_[_0xae8f('0x35')](_0x387341[_0xae8f('0x36')],_0x387341['query']);_0x4633b0[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x387341[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x25164e[_0xae8f('0x32')][_0xae8f('0x38')]));_0x4633b0[_0xae8f('0x37')]=_0x4633b0[_0xae8f('0x37')][_0xae8f('0x39')]?_0x4633b0[_0xae8f('0x37')]:_0x387341[_0xae8f('0x36')];if(_0x25164e[_0xae8f('0x32')][_0xae8f('0x43')]){_0x4633b0['include']=[{'all':!![]}];}_0x4633b0=_[_0xae8f('0x40')]({},_0x4633b0,_0x25164e[_0xae8f('0x41')]);return db[_0xae8f('0x42')]['find'](_0x4633b0)[_0xae8f('0x26')](handleEntityNotFound(_0xcb7d25,null))[_0xae8f('0x26')](respondWithResult(_0xcb7d25,null))[_0xae8f('0x47')](handleError(_0xcb7d25,null));};exports[_0xae8f('0x4a')]=function(_0x941b08,_0x1c320b){return db[_0xae8f('0x42')][_0xae8f('0x4a')](_0x941b08[_0xae8f('0x4b')],{})[_0xae8f('0x26')](function(_0x536ac0){var _0x4f2856=_0x941b08[_0xae8f('0x4c')][_0xae8f('0x28')]({'plain':!![]});if(!_0x4f2856)throw new Error(_0xae8f('0x4d'));if(_0x4f2856[_0xae8f('0x4e')]===_0xae8f('0x4c')){var _0xc90bb7=_0x536ac0[_0xae8f('0x28')]({'plain':!![]});var _0x509751='Intervals';return db[_0xae8f('0x4f')][_0xae8f('0x50')]({'where':{'name':_0x509751,'userProfileId':_0x4f2856['userProfileId']},'raw':!![]})['then'](function(_0x4e78d1){if(_0x4e78d1&&_0x4e78d1[_0xae8f('0x51')]===0x0){return db[_0xae8f('0x52')][_0xae8f('0x4a')]({'name':_0xc90bb7[_0xae8f('0x2c')],'resourceId':_0xc90bb7['id'],'type':_0x4e78d1['name'],'sectionId':_0x4e78d1['id']},{})[_0xae8f('0x26')](function(){return _0x536ac0;});}else{return _0x536ac0;}})[_0xae8f('0x47')](function(_0x2d81b4){logger[_0xae8f('0x2a')](_0xae8f('0x53'),_0x2d81b4);throw _0x2d81b4;});}return _0x536ac0;})[_0xae8f('0x26')](respondWithResult(_0x1c320b,0xc9))['catch'](handleError(_0x1c320b,null));};exports[_0xae8f('0x25')]=function(_0x38b61e,_0x135d9a){if(_0x38b61e[_0xae8f('0x4b')]['id']){delete _0x38b61e[_0xae8f('0x4b')]['id'];}return db[_0xae8f('0x42')]['find']({'where':{'id':_0x38b61e[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x135d9a,null))['then'](saveUpdates(_0x38b61e['body'],null))[_0xae8f('0x26')](respondWithResult(_0x135d9a,null))[_0xae8f('0x47')](handleError(_0x135d9a,null));};exports[_0xae8f('0x27')]=function(_0x4dd088,_0x48c82e){return db['Interval']['find']({'where':{'id':_0x4dd088[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x48c82e,null))[_0xae8f('0x26')](removeEntity(_0x48c82e,null))[_0xae8f('0x47')](handleError(_0x48c82e,null));};exports[_0xae8f('0x54')]=function(_0x4a2a07,_0x497844,_0x4f37ad){if(_0x4a2a07[_0xae8f('0x4b')]['id']){delete _0x4a2a07['body']['id'];}return db[_0xae8f('0x42')]['find']({'where':{'id':_0x4a2a07['params']['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x497844,null))[_0xae8f('0x26')](function(_0x8da9a4){if(_0x8da9a4){_0x4a2a07[_0xae8f('0x4b')][_0xae8f('0x55')]=_0x8da9a4['id'];return db['Interval']['create'](_0x4a2a07['body']);}})[_0xae8f('0x26')](respondWithResult(_0x497844,null))[_0xae8f('0x47')](handleError(_0x497844,null));};exports[_0xae8f('0x56')]=function(_0x3b3366,_0x1d276a,_0x37f2a2){var _0x3cc37d={};var _0x81f2bc={};var _0x4fcfb6;var _0x13f694;return db['Interval'][_0xae8f('0x57')]({'where':{'id':_0x3b3366['params']['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x1d276a,null))[_0xae8f('0x26')](function(_0x579ed7){if(_0x579ed7){_0x4fcfb6=_0x579ed7;_0x81f2bc[_0xae8f('0x36')]=_['keys'](db['Interval'][_0xae8f('0x30')]);_0x81f2bc[_0xae8f('0x32')]=_['keys'](_0x3b3366[_0xae8f('0x32')]);_0x81f2bc[_0xae8f('0x34')]=_[_0xae8f('0x35')](_0x81f2bc['model'],_0x81f2bc[_0xae8f('0x32')]);_0x3cc37d[_0xae8f('0x37')]=_[_0xae8f('0x35')](_0x81f2bc[_0xae8f('0x36')],qs[_0xae8f('0x38')](_0x3b3366[_0xae8f('0x32')][_0xae8f('0x38')]));_0x3cc37d[_0xae8f('0x37')]=_0x3cc37d[_0xae8f('0x37')]['length']?_0x3cc37d[_0xae8f('0x37')]:_0x81f2bc[_0xae8f('0x36')];_0x3cc37d[_0xae8f('0x3b')]=qs[_0xae8f('0x3c')](_0x3b3366['query'][_0xae8f('0x3c')]);_0x3cc37d[_0xae8f('0x3d')]=qs[_0xae8f('0x34')](_[_0xae8f('0x58')](_0x3b3366[_0xae8f('0x32')],_0x81f2bc[_0xae8f('0x34')]));if(_0x3b3366[_0xae8f('0x32')][_0xae8f('0x3f')]){_0x3cc37d['where']=_[_0xae8f('0x40')](_0x3cc37d[_0xae8f('0x3d')],{'$or':_[_0xae8f('0x2f')](_0x3cc37d[_0xae8f('0x37')],function(_0x185ab2){var _0x3cfac3={};_0x3cfac3[_0x185ab2]={'$like':'%'+_0x3b3366[_0xae8f('0x32')]['filter']+'%'};return _0x3cfac3;})});}_0x3cc37d=_[_0xae8f('0x40')]({},_0x3cc37d,_0x3b3366[_0xae8f('0x41')]);return _0x4fcfb6[_0xae8f('0x56')](_0x3cc37d);}})['then'](function(_0x3b54e4){if(_0x3b54e4){_0x13f694=_0x3b54e4[_0xae8f('0x39')];if(!_0x3b3366[_0xae8f('0x32')]['hasOwnProperty'](_0xae8f('0x59'))){_0x3cc37d['limit']=qs[_0xae8f('0x1f')](_0x3b3366[_0xae8f('0x32')][_0xae8f('0x1f')]);_0x3cc37d[_0xae8f('0x1d')]=qs[_0xae8f('0x1d')](_0x3b3366[_0xae8f('0x32')]['offset']);}return _0x4fcfb6[_0xae8f('0x56')](_0x3cc37d);}})[_0xae8f('0x26')](function(_0x4feed7){if(_0x4feed7){return _0x4feed7?{'count':_0x13f694,'rows':_0x4feed7}:null;}})[_0xae8f('0x26')](respondWithResult(_0x1d276a,null))['catch'](handleError(_0x1d276a,null));};exports['addIntervals']=function(_0x1cc8a4,_0x2d59d7,_0x23a8d5){return db['Interval'][_0xae8f('0x57')]({'where':{'id':_0x1cc8a4[_0xae8f('0x49')]['id']}})[_0xae8f('0x26')](handleEntityNotFound(_0x2d59d7,null))['then'](function(_0x231e3c){if(_0x231e3c){return db[_0xae8f('0x5a')]['transaction'](function(_0x1e7abd){return db[_0xae8f('0x42')][_0xae8f('0x27')]({'where':{'IntervalId':_0x1cc8a4[_0xae8f('0x49')]['id']},'transaction':_0x1e7abd})[_0xae8f('0x26')](function(_0x275636){var _0x11bcb1=_[_0xae8f('0x2f')](_0x1cc8a4[_0xae8f('0x4b')],function(_0x163692){delete _0x163692['id'];_0x163692[_0xae8f('0x55')]=_0x1cc8a4[_0xae8f('0x49')]['id'];return _0x163692;});return db[_0xae8f('0x42')][_0xae8f('0x5b')](_0x11bcb1,{'transaction':_0x1e7abd});});})[_0xae8f('0x26')](function(){return db[_0xae8f('0x42')][_0xae8f('0x45')]({'where':{'IntervalId':_0x1cc8a4['params']['id']}});});}})[_0xae8f('0x26')](respondWithResult(_0x2d59d7,null))[_0xae8f('0x47')](handleError(_0x2d59d7,null));}; \ No newline at end of file +var _0xb65d=['squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','apply','destroy','then','Intervals','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','options','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x2bb3df,_0x538894){var _0x308100=function(_0x269f01){while(--_0x269f01){_0x2bb3df['push'](_0x2bb3df['shift']());}};_0x308100(++_0x538894);}(_0xb65d,0x1c6));var _0xdb65=function(_0x31cafb,_0x17cec2){_0x31cafb=_0x31cafb-0x0;var _0x2185ed=_0xb65d[_0x31cafb];return _0x2185ed;};'use strict';var emlformat=require(_0xdb65('0x0'));var rimraf=require(_0xdb65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb65('0x2'));var rp=require(_0xdb65('0x3'));var moment=require('moment');var BPromise=require(_0xdb65('0x4'));var Mustache=require(_0xdb65('0x5'));var util=require(_0xdb65('0x6'));var path=require('path');var sox=require(_0xdb65('0x7'));var csv=require(_0xdb65('0x8'));var ejs=require(_0xdb65('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb65('0xa'));var squel=require(_0xdb65('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb65('0xc'));var deskjs=require(_0xdb65('0xd'));var toCsv=require(_0xdb65('0x8'));var querystring=require(_0xdb65('0xe'));var Papa=require(_0xdb65('0xf'));var Redis=require('ioredis');var authService=require(_0xdb65('0x10'));var qs=require(_0xdb65('0x11'));var as=require(_0xdb65('0x12'));var hardwareService=require(_0xdb65('0x13'));var logger=require(_0xdb65('0x14'))(_0xdb65('0x15'));var utils=require(_0xdb65('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb65('0x17'));var db=require(_0xdb65('0x18'))['db'];var extensions=require(_0xdb65('0x19'));function respondWithStatusCode(_0xd95619,_0x3e1a07){_0x3e1a07=_0x3e1a07||0xcc;return function(_0x52dc9d){if(_0x52dc9d){return _0xd95619[_0xdb65('0x1a')](_0x3e1a07);}return _0xd95619[_0xdb65('0x1b')](_0x3e1a07)[_0xdb65('0x1c')]();};}function respondWithResult(_0x52ec97,_0xae2191){_0xae2191=_0xae2191||0xc8;return function(_0x14057b){if(_0x14057b){return _0x52ec97['status'](_0xae2191)[_0xdb65('0x1d')](_0x14057b);}};}function respondWithFilteredResult(_0x553d42,_0x45b08c){return function(_0x5055f4){if(_0x5055f4){var _0x4543fe=typeof _0x45b08c[_0xdb65('0x1e')]==='undefined'&&typeof _0x45b08c[_0xdb65('0x1f')]===_0xdb65('0x20');var _0x21b195=_0x5055f4[_0xdb65('0x21')];var _0x460dc6=_0x4543fe?0x0:_0x45b08c[_0xdb65('0x1e')];var _0x44b170=_0x4543fe?_0x5055f4[_0xdb65('0x21')]:_0x45b08c[_0xdb65('0x1e')]+_0x45b08c[_0xdb65('0x1f')];var _0x1a2f09;if(_0x44b170>=_0x21b195){_0x44b170=_0x21b195;_0x1a2f09=0xc8;}else{_0x1a2f09=0xce;}_0x553d42[_0xdb65('0x1b')](_0x1a2f09);return _0x553d42['set']('Content-Range',_0x460dc6+'-'+_0x44b170+'/'+_0x21b195)[_0xdb65('0x1d')](_0x5055f4);}return null;};}function patchUpdates(_0xd27f37){return function(_0x30016f){try{jsonpatch[_0xdb65('0x22')](_0x30016f,_0xd27f37,!![]);}catch(_0x50544c){return BPromise['reject'](_0x50544c);}return _0x30016f['save']();};}function saveUpdates(_0x4353ea,_0x4cc903){return function(_0x1200ee){if(_0x1200ee){return _0x1200ee['update'](_0x4353ea)['then'](function(_0x2965f0){return _0x2965f0;});}return null;};}function removeEntity(_0x52e240,_0x407fbd){return function(_0x48ff3e){if(_0x48ff3e){return _0x48ff3e[_0xdb65('0x23')]()[_0xdb65('0x24')](function(){var _0x54f2c9=_0x48ff3e['get']({'plain':!![]});var _0xfa7ee=_0xdb65('0x25');return db['UserProfileResource'][_0xdb65('0x23')]({'where':{'type':_0xfa7ee,'resourceId':_0x54f2c9['id']}})['then'](function(){return _0x48ff3e;});})[_0xdb65('0x24')](function(){_0x52e240[_0xdb65('0x1b')](0xcc)[_0xdb65('0x1c')]();});}};}function handleEntityNotFound(_0x1a4abf,_0x38c8c0){return function(_0x44f0f7){if(!_0x44f0f7){_0x1a4abf[_0xdb65('0x1a')](0x194);}return _0x44f0f7;};}function handleError(_0x59341d,_0x5d2779){_0x5d2779=_0x5d2779||0x1f4;return function(_0x3cb6b0){logger[_0xdb65('0x26')](_0x3cb6b0[_0xdb65('0x27')]);if(_0x3cb6b0[_0xdb65('0x28')]){delete _0x3cb6b0['name'];}_0x59341d[_0xdb65('0x1b')](_0x5d2779)[_0xdb65('0x29')](_0x3cb6b0);};}exports[_0xdb65('0x2a')]=function(_0x4f7242,_0xf8cef3){var _0x49b583={},_0x3947d8={},_0x2e46e0={'count':0x0,'rows':[]};var _0x151ee3=_[_0xdb65('0x2b')](db[_0xdb65('0x2c')][_0xdb65('0x2d')],function(_0x3b9861){return{'name':_0x3b9861[_0xdb65('0x2e')],'type':_0x3b9861[_0xdb65('0x2f')][_0xdb65('0x30')]};});_0x3947d8['model']=_[_0xdb65('0x2b')](_0x151ee3,'name');_0x3947d8[_0xdb65('0x31')]=_[_0xdb65('0x32')](_0x4f7242[_0xdb65('0x31')]);_0x3947d8[_0xdb65('0x33')]=_[_0xdb65('0x34')](_0x3947d8[_0xdb65('0x35')],_0x3947d8['query']);_0x49b583[_0xdb65('0x36')]=_['intersection'](_0x3947d8[_0xdb65('0x35')],qs['fields'](_0x4f7242[_0xdb65('0x31')][_0xdb65('0x37')]));_0x49b583['attributes']=_0x49b583[_0xdb65('0x36')][_0xdb65('0x38')]?_0x49b583[_0xdb65('0x36')]:_0x3947d8[_0xdb65('0x35')];if(!_0x4f7242[_0xdb65('0x31')]['hasOwnProperty'](_0xdb65('0x39'))){_0x49b583[_0xdb65('0x1f')]=qs[_0xdb65('0x1f')](_0x4f7242[_0xdb65('0x31')][_0xdb65('0x1f')]);_0x49b583[_0xdb65('0x1e')]=qs[_0xdb65('0x1e')](_0x4f7242[_0xdb65('0x31')][_0xdb65('0x1e')]);}_0x49b583[_0xdb65('0x3a')]=qs[_0xdb65('0x3b')](_0x4f7242[_0xdb65('0x31')][_0xdb65('0x3b')]);_0x49b583[_0xdb65('0x3c')]=qs[_0xdb65('0x33')](_[_0xdb65('0x3d')](_0x4f7242[_0xdb65('0x31')],_0x3947d8[_0xdb65('0x33')]),_0x151ee3);if(_0x4f7242[_0xdb65('0x31')][_0xdb65('0x3e')]){_0x49b583[_0xdb65('0x3c')]=_[_0xdb65('0x3f')](_0x49b583[_0xdb65('0x3c')],{'$or':_['map'](_0x151ee3,function(_0x194f36){if(_0x194f36[_0xdb65('0x2f')]!==_0xdb65('0x40')){var _0x4de753={};_0x4de753[_0x194f36[_0xdb65('0x28')]]={'$like':'%'+_0x4f7242['query']['filter']+'%'};return _0x4de753;}})});}_0x49b583=_['merge']({},_0x49b583,_0x4f7242['options']);var _0x207df0={'where':_0x49b583[_0xdb65('0x3c')]};return db[_0xdb65('0x2c')][_0xdb65('0x21')](_0x207df0)['then'](function(_0x6b154b){_0x2e46e0[_0xdb65('0x21')]=_0x6b154b;if(_0x4f7242[_0xdb65('0x31')]['includeAll']){_0x49b583[_0xdb65('0x41')]=[{'all':!![]}];}return db[_0xdb65('0x2c')][_0xdb65('0x42')](_0x49b583);})[_0xdb65('0x24')](function(_0x580c5b){_0x2e46e0['rows']=_0x580c5b;return _0x2e46e0;})[_0xdb65('0x24')](respondWithFilteredResult(_0xf8cef3,_0x49b583))[_0xdb65('0x43')](handleError(_0xf8cef3,null));};exports[_0xdb65('0x44')]=function(_0x3efaba,_0x43aaee){var _0x3bd2e1={'raw':!![],'where':{'id':_0x3efaba[_0xdb65('0x45')]['id']}},_0x3e015a={};_0x3e015a['model']=_[_0xdb65('0x32')](db[_0xdb65('0x2c')][_0xdb65('0x2d')]);_0x3e015a[_0xdb65('0x31')]=_[_0xdb65('0x32')](_0x3efaba[_0xdb65('0x31')]);_0x3e015a[_0xdb65('0x33')]=_[_0xdb65('0x34')](_0x3e015a['model'],_0x3e015a[_0xdb65('0x31')]);_0x3bd2e1[_0xdb65('0x36')]=_[_0xdb65('0x34')](_0x3e015a[_0xdb65('0x35')],qs[_0xdb65('0x37')](_0x3efaba[_0xdb65('0x31')][_0xdb65('0x37')]));_0x3bd2e1[_0xdb65('0x36')]=_0x3bd2e1[_0xdb65('0x36')][_0xdb65('0x38')]?_0x3bd2e1[_0xdb65('0x36')]:_0x3e015a[_0xdb65('0x35')];if(_0x3efaba[_0xdb65('0x31')][_0xdb65('0x46')]){_0x3bd2e1[_0xdb65('0x41')]=[{'all':!![]}];}_0x3bd2e1=_[_0xdb65('0x3f')]({},_0x3bd2e1,_0x3efaba['options']);return db['Interval'][_0xdb65('0x47')](_0x3bd2e1)[_0xdb65('0x24')](handleEntityNotFound(_0x43aaee,null))[_0xdb65('0x24')](respondWithResult(_0x43aaee,null))[_0xdb65('0x43')](handleError(_0x43aaee,null));};exports['create']=function(_0x40f4c8,_0x37dfac){return db['Interval'][_0xdb65('0x48')](_0x40f4c8[_0xdb65('0x49')],{})[_0xdb65('0x24')](function(_0x311b53){var _0xcc3bc8=_0x40f4c8['user']['get']({'plain':!![]});if(!_0xcc3bc8)throw new Error(_0xdb65('0x4a'));if(_0xcc3bc8[_0xdb65('0x4b')]===_0xdb65('0x4c')){var _0x14caca=_0x311b53[_0xdb65('0x4d')]({'plain':!![]});var _0x4fc6ac=_0xdb65('0x25');return db[_0xdb65('0x4e')][_0xdb65('0x47')]({'where':{'name':_0x4fc6ac,'userProfileId':_0xcc3bc8[_0xdb65('0x4f')]},'raw':!![]})[_0xdb65('0x24')](function(_0xd1bc66){if(_0xd1bc66&&_0xd1bc66[_0xdb65('0x50')]===0x0){return db[_0xdb65('0x51')][_0xdb65('0x48')]({'name':_0x14caca[_0xdb65('0x28')],'resourceId':_0x14caca['id'],'type':_0xd1bc66[_0xdb65('0x28')],'sectionId':_0xd1bc66['id']},{})['then'](function(){return _0x311b53;});}else{return _0x311b53;}})[_0xdb65('0x43')](function(_0x1c840a){logger['error'](_0xdb65('0x52'),_0x1c840a);throw _0x1c840a;});}return _0x311b53;})[_0xdb65('0x24')](respondWithResult(_0x37dfac,0xc9))[_0xdb65('0x43')](handleError(_0x37dfac,null));};exports[_0xdb65('0x53')]=function(_0x1e1514,_0x140cde){if(_0x1e1514[_0xdb65('0x49')]['id']){delete _0x1e1514['body']['id'];}return db[_0xdb65('0x2c')]['find']({'where':{'id':_0x1e1514[_0xdb65('0x45')]['id']}})[_0xdb65('0x24')](handleEntityNotFound(_0x140cde,null))[_0xdb65('0x24')](saveUpdates(_0x1e1514[_0xdb65('0x49')],null))['then'](respondWithResult(_0x140cde,null))[_0xdb65('0x43')](handleError(_0x140cde,null));};exports[_0xdb65('0x23')]=function(_0x5459c6,_0xb1bb09){return db[_0xdb65('0x2c')]['find']({'where':{'id':_0x5459c6['params']['id']}})['then'](handleEntityNotFound(_0xb1bb09,null))[_0xdb65('0x24')](removeEntity(_0xb1bb09,null))['catch'](handleError(_0xb1bb09,null));};exports[_0xdb65('0x54')]=function(_0x431e90,_0x266c65,_0xfe576){if(_0x431e90[_0xdb65('0x49')]['id']){delete _0x431e90[_0xdb65('0x49')]['id'];}return db[_0xdb65('0x2c')][_0xdb65('0x47')]({'where':{'id':_0x431e90[_0xdb65('0x45')]['id']}})[_0xdb65('0x24')](handleEntityNotFound(_0x266c65,null))['then'](function(_0x232ca0){if(_0x232ca0){_0x431e90[_0xdb65('0x49')][_0xdb65('0x55')]=_0x232ca0['id'];return db[_0xdb65('0x2c')][_0xdb65('0x48')](_0x431e90[_0xdb65('0x49')]);}})[_0xdb65('0x24')](respondWithResult(_0x266c65,null))['catch'](handleError(_0x266c65,null));};exports[_0xdb65('0x56')]=function(_0x4a45e1,_0xb7a6ee,_0x487a4f){var _0x2929d4={};var _0x6668c4={};var _0xfa4c2b;var _0x5d85a0;return db[_0xdb65('0x2c')][_0xdb65('0x57')]({'where':{'id':_0x4a45e1['params']['id']}})['then'](handleEntityNotFound(_0xb7a6ee,null))['then'](function(_0x2df296){if(_0x2df296){_0xfa4c2b=_0x2df296;_0x6668c4[_0xdb65('0x35')]=_[_0xdb65('0x32')](db['Interval']['rawAttributes']);_0x6668c4['query']=_[_0xdb65('0x32')](_0x4a45e1[_0xdb65('0x31')]);_0x6668c4[_0xdb65('0x33')]=_[_0xdb65('0x34')](_0x6668c4[_0xdb65('0x35')],_0x6668c4[_0xdb65('0x31')]);_0x2929d4[_0xdb65('0x36')]=_[_0xdb65('0x34')](_0x6668c4['model'],qs[_0xdb65('0x37')](_0x4a45e1[_0xdb65('0x31')][_0xdb65('0x37')]));_0x2929d4[_0xdb65('0x36')]=_0x2929d4[_0xdb65('0x36')]['length']?_0x2929d4['attributes']:_0x6668c4[_0xdb65('0x35')];_0x2929d4['order']=qs[_0xdb65('0x3b')](_0x4a45e1[_0xdb65('0x31')]['sort']);_0x2929d4['where']=qs[_0xdb65('0x33')](_[_0xdb65('0x3d')](_0x4a45e1[_0xdb65('0x31')],_0x6668c4['filters']));if(_0x4a45e1[_0xdb65('0x31')][_0xdb65('0x3e')]){_0x2929d4[_0xdb65('0x3c')]=_[_0xdb65('0x3f')](_0x2929d4[_0xdb65('0x3c')],{'$or':_[_0xdb65('0x2b')](_0x2929d4[_0xdb65('0x36')],function(_0x47fdf8){var _0x35f961={};_0x35f961[_0x47fdf8]={'$like':'%'+_0x4a45e1['query'][_0xdb65('0x3e')]+'%'};return _0x35f961;})});}_0x2929d4=_['merge']({},_0x2929d4,_0x4a45e1[_0xdb65('0x58')]);return _0xfa4c2b['getIntervals'](_0x2929d4);}})['then'](function(_0x31c9b6){if(_0x31c9b6){_0x5d85a0=_0x31c9b6[_0xdb65('0x38')];if(!_0x4a45e1[_0xdb65('0x31')]['hasOwnProperty'](_0xdb65('0x39'))){_0x2929d4[_0xdb65('0x1f')]=qs[_0xdb65('0x1f')](_0x4a45e1[_0xdb65('0x31')]['limit']);_0x2929d4[_0xdb65('0x1e')]=qs[_0xdb65('0x1e')](_0x4a45e1[_0xdb65('0x31')][_0xdb65('0x1e')]);}return _0xfa4c2b[_0xdb65('0x56')](_0x2929d4);}})[_0xdb65('0x24')](function(_0x4cac7b){if(_0x4cac7b){return _0x4cac7b?{'count':_0x5d85a0,'rows':_0x4cac7b}:null;}})['then'](respondWithResult(_0xb7a6ee,null))['catch'](handleError(_0xb7a6ee,null));};exports[_0xdb65('0x59')]=function(_0x18e75f,_0x5412c2,_0x4d16e3){return db[_0xdb65('0x2c')]['findOne']({'where':{'id':_0x18e75f['params']['id']}})[_0xdb65('0x24')](handleEntityNotFound(_0x5412c2,null))[_0xdb65('0x24')](function(_0x2b2023){if(_0x2b2023){return db[_0xdb65('0x5a')][_0xdb65('0x5b')](function(_0x49b9e6){return db['Interval'][_0xdb65('0x23')]({'where':{'IntervalId':_0x18e75f[_0xdb65('0x45')]['id']},'transaction':_0x49b9e6})[_0xdb65('0x24')](function(_0x545a8a){var _0x2c7835=_[_0xdb65('0x2b')](_0x18e75f[_0xdb65('0x49')],function(_0xcf6c7d){delete _0xcf6c7d['id'];_0xcf6c7d[_0xdb65('0x55')]=_0x18e75f[_0xdb65('0x45')]['id'];return _0xcf6c7d;});return db[_0xdb65('0x2c')][_0xdb65('0x5c')](_0x2c7835,{'transaction':_0x49b9e6});});})[_0xdb65('0x24')](function(){return db['Interval'][_0xdb65('0x42')]({'where':{'IntervalId':_0x18e75f[_0xdb65('0x45')]['id']}});});}})[_0xdb65('0x24')](respondWithResult(_0x5412c2,null))['catch'](handleError(_0x5412c2,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b4c7758..eb9e9de 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 _0x2352=['map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','string','interval','then','all'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x2352,0x9d));var _0x2235=function(_0x28c275,_0x345caa){_0x28c275=_0x28c275-0x0;var _0x232969=_0x2352[_0x28c275];return _0x232969;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2235('0x0'));var iftime=require(_0x2235('0x1'))[_0x2235('0x2')];module[_0x2235('0x3')]=function(_0x3abdeb){return _0x3abdeb[_0x2235('0x4')]('Interval',attributes,{'tableName':_0x2235('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1af656){extensions[_0x2235('0x6')](_0x3abdeb,_0x1af656);},'afterBulkCreate':function(_0x4b426e,_0x14a467,_0x45267c){_0x45267c();extensions[_0x2235('0x6')](_0x3abdeb,_0x4b426e[0x0]);},'afterUpdate':function(_0x197296){extensions[_0x2235('0x6')](_0x3abdeb,_0x197296);},'afterDestroy':function(_0x49339d){extensions[_0x2235('0x6')](_0x3abdeb,_0x49339d);}},'instanceMethods':{'ifTime':function(_0x5b0ebb=undefined,_0x198b8f=new Date()){if(typeof this['interval']===_0x2235('0x7')){return iftime(this[_0x2235('0x8')],_0x5b0ebb,_0x198b8f);}else{return this['getIntervals']()[_0x2235('0x9')](function(_0x1cfc42){return Promise[_0x2235('0xa')](_0x1cfc42[_0x2235('0xb')](function(_0x16d4ec){return _0x16d4ec[_0x2235('0xc')](_0x5b0ebb,_0x198b8f);}));})['then'](function(_0x1d6bb1){return _0x1d6bb1[_0x2235('0xd')](function(_0x194803,_0x839df4){return _0x194803||_0x839df4;},![]);});}}}});}; \ No newline at end of file +var _0xf11f=['map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','tools_intervals','rewrite','interval','getIntervals','then','all'];(function(_0x341d0d,_0x5abfad){var _0x2d08a3=function(_0x4493a2){while(--_0x4493a2){_0x341d0d['push'](_0x341d0d['shift']());}};_0x2d08a3(++_0x5abfad);}(_0xf11f,0x15e));var _0xff11=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0xf11f[_0x8abd64];return _0xd2511e;};'use strict';var attributes=require(_0xff11('0x0'));var extensions=require(_0xff11('0x1'));var iftime=require(_0xff11('0x2'))[_0xff11('0x3')];module['exports']=function(_0x5d93ec){return _0x5d93ec['define']('Interval',attributes,{'tableName':_0xff11('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x55a7cb){extensions['rewrite'](_0x5d93ec,_0x55a7cb);},'afterBulkCreate':function(_0x45772c,_0x1ef412,_0x53f522){_0x53f522();extensions[_0xff11('0x5')](_0x5d93ec,_0x45772c[0x0]);},'afterUpdate':function(_0x39abc1){extensions['rewrite'](_0x5d93ec,_0x39abc1);},'afterDestroy':function(_0x380902){extensions['rewrite'](_0x5d93ec,_0x380902);}},'instanceMethods':{'ifTime':function(_0x26ce59=undefined,_0x9380b=new Date()){if(typeof this[_0xff11('0x6')]==='string'){return iftime(this[_0xff11('0x6')],_0x26ce59,_0x9380b);}else{return this[_0xff11('0x7')]()[_0xff11('0x8')](function(_0x1d592e){return Promise[_0xff11('0x9')](_0x1d592e[_0xff11('0xa')](function(_0x2af466){return _0x2af466['ifTime'](_0x26ce59,_0x9380b);}));})['then'](function(_0x272b9f){return _0x272b9f[_0xff11('0xb')](function(_0x137339,_0x4a0607){return _0x137339||_0x4a0607;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 67244c2..f226e46 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 _0x3e53=['GetInterval','debug','stringify','catch','error','message','ShowInterval','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','util','../../mysqldb','iftime','../../config/logger','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3e53,0xbd));var _0x33e5=function(_0x3d40f9,_0x514554){_0x3d40f9=_0x3d40f9-0x0;var _0x4108da=_0x3e53[_0x3d40f9];return _0x4108da;};'use strict';var _=require('lodash');var util=require(_0x33e5('0x0'));var db=require(_0x33e5('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x33e5('0x2')];var logger=require(_0x33e5('0x3'))('rpc');exports['GetInterval']=function(_0x18026c){var _0x5030ef=this;return new Promise(function(_0xeaf6b4,_0x3db67b){return db[_0x33e5('0x4')][_0x33e5('0x5')]({'raw':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0x7')]===undefined?!![]:![]:!![],'where':_0x18026c[_0x33e5('0x6')]?_0x18026c['options'][_0x33e5('0x8')]||null:null,'attributes':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0x9')]||null:null,'limit':_0x18026c['options']?_0x18026c[_0x33e5('0x6')][_0x33e5('0xa')]||null:null,'include':_0x18026c[_0x33e5('0x6')]?_0x18026c[_0x33e5('0x6')][_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x18026c[_0x33e5('0x6')][_0x33e5('0xb')],function(_0x3bcced){return{'model':db[_0x3bcced[_0x33e5('0xd')]],'as':_0x3bcced['as'],'attributes':_0x3bcced[_0x33e5('0x9')],'include':_0x3bcced[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x3bcced[_0x33e5('0xb')],function(_0x46036a){return{'model':db[_0x46036a['model']],'as':_0x46036a['as'],'attributes':_0x46036a['attributes'],'include':_0x46036a[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x46036a['include'],function(_0x16fd0c){return{'model':db[_0x16fd0c[_0x33e5('0xd')]],'as':_0x16fd0c['as'],'attributes':_0x16fd0c[_0x33e5('0x9')]};}):[]};}):[]};}):[]:[]})[_0x33e5('0xe')](function(_0x288fb0){logger[_0x33e5('0xf')](_0x33e5('0x10'),_0x18026c);logger[_0x33e5('0x11')](_0x33e5('0x10'),_0x18026c,JSON[_0x33e5('0x12')](_0x288fb0));_0xeaf6b4(_0x288fb0);})[_0x33e5('0x13')](function(_0x176651){logger[_0x33e5('0x14')](_0x33e5('0x10'),_0x176651[_0x33e5('0x15')],_0x18026c);_0x3db67b(_0x5030ef[_0x33e5('0x14')](0x1f4,_0x176651[_0x33e5('0x15')]));});});};exports[_0x33e5('0x16')]=function(_0x34e732){var _0x9d1573=this;return new Promise(function(_0x3baafc,_0x14ebe2){return db[_0x33e5('0x4')]['find']({'raw':_0x34e732['options']?_0x34e732[_0x33e5('0x6')][_0x33e5('0x7')]===undefined?!![]:![]:!![],'where':_0x34e732['options']?_0x34e732[_0x33e5('0x6')][_0x33e5('0x8')]||null:null,'attributes':_0x34e732[_0x33e5('0x6')]?_0x34e732[_0x33e5('0x6')][_0x33e5('0x9')]||null:null,'include':_0x34e732[_0x33e5('0x6')]?_0x34e732[_0x33e5('0x6')][_0x33e5('0xb')]?_[_0x33e5('0xc')](_0x34e732[_0x33e5('0x6')][_0x33e5('0xb')],function(_0xc6449e){return{'model':db[_0xc6449e[_0x33e5('0xd')]],'as':_0xc6449e['as'],'attributes':_0xc6449e[_0x33e5('0x9')],'include':_0xc6449e[_0x33e5('0xb')]?_[_0x33e5('0xc')](_0xc6449e[_0x33e5('0xb')],function(_0x4fe974){return{'model':db[_0x4fe974['model']],'as':_0x4fe974['as'],'attributes':_0x4fe974['attributes'],'include':_0x4fe974['include']?_[_0x33e5('0xc')](_0x4fe974[_0x33e5('0xb')],function(_0x1bfbed){return{'model':db[_0x1bfbed[_0x33e5('0xd')]],'as':_0x1bfbed['as'],'attributes':_0x1bfbed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b4a15){logger['info'](_0x33e5('0x16'),_0x34e732);logger[_0x33e5('0x11')](_0x33e5('0x16'),_0x34e732,JSON[_0x33e5('0x12')](_0x2b4a15));_0x3baafc(_0x2b4a15);})[_0x33e5('0x13')](function(_0x42f762){logger[_0x33e5('0x14')](_0x33e5('0x16'),_0x42f762[_0x33e5('0x15')],_0x34e732);_0x14ebe2(_0x9d1573[_0x33e5('0x14')](0x1f4,_0x42f762[_0x33e5('0x15')]));});});};function checkArrayOfIntervals(_0x5032d9,_0x260d73){var _0x5263cb=[];return db['Interval'][_0x33e5('0x5')]({'where':{'id':_0x5032d9}})[_0x33e5('0xe')](function(_0x7717d8){_0x5263cb=_0x7717d8;return Promise[_0x33e5('0x17')](_0x5263cb[_0x33e5('0xc')](function(_0x6f0ad2){return _0x6f0ad2[_0x33e5('0x18')](_0x260d73);}));})[_0x33e5('0xe')](function(_0x1a9912){var _0x5b7ae6=_0x1a9912[_0x33e5('0x19')](function(_0x5e81a4,_0x447442){return _0x5e81a4||_0x447442;},![]);logger[_0x33e5('0xf')](util[_0x33e5('0x1a')](_0x33e5('0x1b'),_0x5263cb[_0x33e5('0xc')](function(_0x5bbed0){return _0x5bbed0[_0x33e5('0x1c')];})['join'](',\x20'),_0x5263cb[_0x33e5('0xc')](function(_0x3d93ec){return _0x3d93ec['id'];})[_0x33e5('0x1d')](',\x20')));return _0x5b7ae6;});}function checkSingleInterval(_0x14eb92,_0x58bb50){return db['Interval'][_0x33e5('0x1e')](_0x14eb92)[_0x33e5('0xe')](function(_0x5da789){if(_0x5da789){logger[_0x33e5('0xf')](util[_0x33e5('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5da789[_0x33e5('0x1c')],_0x5da789['id']));return _0x5da789['ifTime'](_0x58bb50);}});}exports[_0x33e5('0x1f')]=function(_0x40a77c){var _0x10968f=_0x40a77c[_0x33e5('0x20')];var _0x4e847c=Array[_0x33e5('0x21')](_0x40a77c[_0x33e5('0x22')])?_0x40a77c[_0x33e5('0x22')]:typeof _0x40a77c[_0x33e5('0x22')]===_0x33e5('0x23')?[_0x40a77c[_0x33e5('0x22')]]:[];var _0x1955dc=_0x40a77c[_0x33e5('0x24')]||undefined;var _0x1eadea=![];if(_0x4e847c['length']){logger[_0x33e5('0xf')](util[_0x33e5('0x1a')](_0x33e5('0x25'),_0x4e847c[_0x33e5('0x1d')](';\x20')));}if(_0x1955dc){logger['info'](util[_0x33e5('0x1a')](_0x33e5('0x26'),_0x1955dc));}logger[_0x33e5('0x11')]('Iftime',_0x1eadea);logger[_0x33e5('0x27')](_0x33e5('0x1f'),_0x40a77c);return Promise[_0x33e5('0x28')]()[_0x33e5('0xe')](function(){if(Array[_0x33e5('0x21')](_0x10968f)){return checkArrayOfIntervals(_0x10968f,_0x1955dc);}else if(_0x10968f){return checkSingleInterval(_0x10968f,_0x1955dc);}})[_0x33e5('0xe')](function(_0x574897){var _0x2a8b64=_0x4e847c[_0x33e5('0x19')](function(_0x23c053,_0x2e28e9){return _0x23c053||iftime(_0x2e28e9,_0x1955dc);},![]);_0x1eadea=_0x574897||_0x2a8b64;return _0x1eadea;})['catch'](function(_0x26a23c){logger['error'](_0x33e5('0x1f'),_0x40a77c,_0x26a23c);throw this[_0x33e5('0x14')](0x1f4,_0x26a23c['message']);});}; \ No newline at end of file +var _0xbacb=['then','all','ifTime','reduce','name','join','format','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','model','map','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','find','where'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0xbacb,0x1b5));var _0xbbac=function(_0x225b3a,_0x52ead2){_0x225b3a=_0x225b3a-0x0;var _0x2d1743=_0xbacb[_0x225b3a];return _0x2d1743;};'use strict';var _=require(_0xbbac('0x0'));var util=require('util');var db=require(_0xbbac('0x1'))['db'];var iftime=require(_0xbbac('0x2'))[_0xbbac('0x3')];var logger=require(_0xbbac('0x4'))(_0xbbac('0x5'));exports['GetInterval']=function(_0x3eab4f){var _0x2d048c=this;return new Promise(function(_0x157493,_0x1cb8c7){return db[_0xbbac('0x6')][_0xbbac('0x7')]({'raw':_0x3eab4f[_0xbbac('0x8')]?_0x3eab4f[_0xbbac('0x8')][_0xbbac('0x9')]===undefined?!![]:![]:!![],'where':_0x3eab4f[_0xbbac('0x8')]?_0x3eab4f[_0xbbac('0x8')]['where']||null:null,'attributes':_0x3eab4f[_0xbbac('0x8')]?_0x3eab4f[_0xbbac('0x8')][_0xbbac('0xa')]||null:null,'limit':_0x3eab4f[_0xbbac('0x8')]?_0x3eab4f[_0xbbac('0x8')][_0xbbac('0xb')]||null:null,'include':_0x3eab4f[_0xbbac('0x8')]?_0x3eab4f[_0xbbac('0x8')]['include']?_['map'](_0x3eab4f['options'][_0xbbac('0xc')],function(_0x5c0c2c){return{'model':db[_0x5c0c2c[_0xbbac('0xd')]],'as':_0x5c0c2c['as'],'attributes':_0x5c0c2c[_0xbbac('0xa')],'include':_0x5c0c2c[_0xbbac('0xc')]?_[_0xbbac('0xe')](_0x5c0c2c[_0xbbac('0xc')],function(_0x4a096b){return{'model':db[_0x4a096b[_0xbbac('0xd')]],'as':_0x4a096b['as'],'attributes':_0x4a096b[_0xbbac('0xa')],'include':_0x4a096b[_0xbbac('0xc')]?_[_0xbbac('0xe')](_0x4a096b[_0xbbac('0xc')],function(_0x5b4ccc){return{'model':db[_0x5b4ccc[_0xbbac('0xd')]],'as':_0x5b4ccc['as'],'attributes':_0x5b4ccc[_0xbbac('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28ea00){logger[_0xbbac('0xf')](_0xbbac('0x10'),_0x3eab4f);logger[_0xbbac('0x11')](_0xbbac('0x10'),_0x3eab4f,JSON[_0xbbac('0x12')](_0x28ea00));_0x157493(_0x28ea00);})[_0xbbac('0x13')](function(_0x4bb55b){logger[_0xbbac('0x14')](_0xbbac('0x10'),_0x4bb55b[_0xbbac('0x15')],_0x3eab4f);_0x1cb8c7(_0x2d048c[_0xbbac('0x14')](0x1f4,_0x4bb55b[_0xbbac('0x15')]));});});};exports[_0xbbac('0x16')]=function(_0x1cc5f6){var _0x585302=this;return new Promise(function(_0x24d1f2,_0x4e8c3f){return db[_0xbbac('0x6')][_0xbbac('0x17')]({'raw':_0x1cc5f6[_0xbbac('0x8')]?_0x1cc5f6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cc5f6[_0xbbac('0x8')]?_0x1cc5f6[_0xbbac('0x8')][_0xbbac('0x18')]||null:null,'attributes':_0x1cc5f6[_0xbbac('0x8')]?_0x1cc5f6[_0xbbac('0x8')][_0xbbac('0xa')]||null:null,'include':_0x1cc5f6[_0xbbac('0x8')]?_0x1cc5f6[_0xbbac('0x8')]['include']?_['map'](_0x1cc5f6[_0xbbac('0x8')]['include'],function(_0x42f912){return{'model':db[_0x42f912['model']],'as':_0x42f912['as'],'attributes':_0x42f912[_0xbbac('0xa')],'include':_0x42f912[_0xbbac('0xc')]?_[_0xbbac('0xe')](_0x42f912[_0xbbac('0xc')],function(_0x123ed8){return{'model':db[_0x123ed8['model']],'as':_0x123ed8['as'],'attributes':_0x123ed8[_0xbbac('0xa')],'include':_0x123ed8[_0xbbac('0xc')]?_['map'](_0x123ed8[_0xbbac('0xc')],function(_0x1406a8){return{'model':db[_0x1406a8[_0xbbac('0xd')]],'as':_0x1406a8['as'],'attributes':_0x1406a8[_0xbbac('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b9d8){logger[_0xbbac('0xf')](_0xbbac('0x16'),_0x1cc5f6);logger['debug']('ShowInterval',_0x1cc5f6,JSON[_0xbbac('0x12')](_0x20b9d8));_0x24d1f2(_0x20b9d8);})[_0xbbac('0x13')](function(_0x473bce){logger['error'](_0xbbac('0x16'),_0x473bce[_0xbbac('0x15')],_0x1cc5f6);_0x4e8c3f(_0x585302['error'](0x1f4,_0x473bce[_0xbbac('0x15')]));});});};function checkArrayOfIntervals(_0x1fb4f4,_0x1ede61){var _0x14194c=[];return db[_0xbbac('0x6')][_0xbbac('0x7')]({'where':{'id':_0x1fb4f4}})[_0xbbac('0x19')](function(_0x4691aa){_0x14194c=_0x4691aa;return Promise[_0xbbac('0x1a')](_0x14194c[_0xbbac('0xe')](function(_0x2b5346){return _0x2b5346[_0xbbac('0x1b')](_0x1ede61);}));})[_0xbbac('0x19')](function(_0xcb175e){var _0x28fa42=_0xcb175e[_0xbbac('0x1c')](function(_0x241988,_0x35de3f){return _0x241988||_0x35de3f;},![]);logger[_0xbbac('0xf')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x14194c[_0xbbac('0xe')](function(_0x4343c0){return _0x4343c0[_0xbbac('0x1d')];})[_0xbbac('0x1e')](',\x20'),_0x14194c[_0xbbac('0xe')](function(_0x250fdb){return _0x250fdb['id'];})[_0xbbac('0x1e')](',\x20')));return _0x28fa42;});}function checkSingleInterval(_0x21acf7,_0x416ea5){return db[_0xbbac('0x6')]['findById'](_0x21acf7)[_0xbbac('0x19')](function(_0x377095){if(_0x377095){logger[_0xbbac('0xf')](util[_0xbbac('0x1f')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x377095[_0xbbac('0x1d')],_0x377095['id']));return _0x377095[_0xbbac('0x1b')](_0x416ea5);}});}exports['IntervalIftime']=function(_0x5ed27e){var _0x92092=_0x5ed27e[_0xbbac('0x20')];var _0x3e3b42=Array[_0xbbac('0x21')](_0x5ed27e['intervals'])?_0x5ed27e[_0xbbac('0x22')]:typeof _0x5ed27e[_0xbbac('0x22')]===_0xbbac('0x23')?[_0x5ed27e[_0xbbac('0x22')]]:[];var _0x50f9e7=_0x5ed27e[_0xbbac('0x24')]||undefined;var _0x11cab5=![];if(_0x3e3b42[_0xbbac('0x25')]){logger['info'](util['format'](_0xbbac('0x26'),_0x3e3b42[_0xbbac('0x1e')](';\x20')));}if(_0x50f9e7){logger[_0xbbac('0xf')](util['format'](_0xbbac('0x27'),_0x50f9e7));}logger[_0xbbac('0x11')](_0xbbac('0x28'),_0x11cab5);logger['silly'](_0xbbac('0x29'),_0x5ed27e);return Promise['resolve']()[_0xbbac('0x19')](function(){if(Array[_0xbbac('0x21')](_0x92092)){return checkArrayOfIntervals(_0x92092,_0x50f9e7);}else if(_0x92092){return checkSingleInterval(_0x92092,_0x50f9e7);}})['then'](function(_0x218955){var _0x2f14bd=_0x3e3b42[_0xbbac('0x1c')](function(_0xb8e73f,_0x13de07){return _0xb8e73f||iftime(_0x13de07,_0x50f9e7);},![]);_0x11cab5=_0x218955||_0x2f14bd;return _0x11cab5;})['catch'](function(_0xe82bc5){logger[_0xbbac('0x14')](_0xbbac('0x29'),_0x5ed27e,_0xe82bc5);throw this[_0xbbac('0x14')](0x1f4,_0xe82bc5[_0xbbac('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cf43666..d9dbd31 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x464909,_0x105153){var _0x2d1746=function(_0x49f777){while(--_0x49f777){_0x464909['push'](_0x464909['shift']());}};_0x2d1746(++_0x105153);}(_0x2032,0xd9));var _0x2203=function(_0x5cb9d3,_0x4b348b){_0x5cb9d3=_0x5cb9d3-0x0;var _0x2b0a3c=_0x2032[_0x5cb9d3];return _0x2b0a3c;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x5df1fc,_0x994e64){var _0x32064d=function(_0x2a726c){while(--_0x2a726c){_0x5df1fc['push'](_0x5df1fc['shift']());}};_0x32064d(++_0x994e64);}(_0xadb5,0xad));var _0x5adb=function(_0x2ba47c,_0x3196b9){_0x2ba47c=_0x2ba47c-0x0;var _0x5ed723=_0xadb5[_0x2ba47c];return _0x5ed723;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 499979b..f60f135 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 _0xc780=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc780,0xd7));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x0c78('0x0'));var https=require(_0x0c78('0x1'));var logger=require(_0x0c78('0x2'))(_0x0c78('0x3'));var USERNAME=_0x0c78('0x4');var PASSWORD=_0x0c78('0x5');function openIssue(_0x4c0ae5,_0x17c18e){var _0x2189f5={'fields':{'project':{'key':_0x4c0ae5['key']||_0x0c78('0x6')},'summary':(_0x4c0ae5['summary']||_0x0c78('0x7'))+_0x0c78('0x8')+_0x4c0ae5['ip'],'description':_0x4c0ae5[_0x0c78('0x9')]||JSON[_0x0c78('0xa')](_0x4c0ae5),'issuetype':{'name':_0x4c0ae5[_0x0c78('0xb')]||'Bug'}}};_0x2189f5[_0x0c78('0xc')][_0x0c78('0xd')]=_0x4c0ae5[_0x0c78('0xe')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0xf')]=_0x4c0ae5[_0x0c78('0x10')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x11')]=_0x4c0ae5['newToken'];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x12')]=_0x4c0ae5['name'];_0x2189f5['fields'][_0x0c78('0x13')]=_0x4c0ae5[_0x0c78('0x14')];_0x2189f5[_0x0c78('0xc')][_0x0c78('0x15')]=_0x4c0ae5['ip'];var _0x560d9a={'host':_0x0c78('0x16'),'port':0x1bb,'path':_0x0c78('0x17'),'method':_0x0c78('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0c78('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x0c78('0x1a')](_0x0c78('0x1b'))}};var _0x2e9b03=JSON['stringify'](_0x2189f5);var _0x27646a=https[_0x0c78('0x1c')](_0x560d9a,function(_0x34afa4){_0x34afa4[_0x0c78('0x1d')](_0x0c78('0x1e'));var _0x29dd68='';_0x34afa4['on']('data',function(_0x35891a){_0x29dd68+=_0x35891a;});_0x34afa4['on'](_0x0c78('0x1f'),function(){if(_0x17c18e){return _0x17c18e[_0x0c78('0x20')](_0x34afa4[_0x0c78('0x21')])[_0x0c78('0x22')](JSON[_0x0c78('0x23')](_0x29dd68));}});});_0x27646a['on'](_0x0c78('0x24'),function(_0xe08434){if(_0x17c18e){return _0x17c18e['status'](0x1f4)[_0x0c78('0x22')]({'errors':[{'message':_0x0c78('0x25'),'type':_0x0c78('0x26')}]});}});_0x27646a[_0x0c78('0x27')](_0x2e9b03);_0x27646a[_0x0c78('0x1f')]();}exports[_0x0c78('0x28')]=openIssue;exports['send']=function(_0x368428,_0x2d045c){_0x368428[_0x0c78('0x29')]['ip']=_0x368428[_0x0c78('0x2a')][_0x0c78('0x2b')]||_0x368428[_0x0c78('0x2c')][_0x0c78('0x2d')]||_0x368428[_0x0c78('0x2e')][_0x0c78('0x2d')]||_0x368428[_0x0c78('0x2c')][_0x0c78('0x2e')][_0x0c78('0x2d')];return openIssue(_0x368428[_0x0c78('0x29')],_0x2d045c);}; \ No newline at end of file +var _0x3bfd=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','Bug','fields','customfield_11500','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','error'];(function(_0xeef426,_0x21529f){var _0x35dcc6=function(_0x340cd6){while(--_0x340cd6){_0xeef426['push'](_0xeef426['shift']());}};_0x35dcc6(++_0x21529f);}(_0x3bfd,0x1ad));var _0xd3bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xd3bf('0x0'))(_0xd3bf('0x1'));var USERNAME=_0xd3bf('0x2');var PASSWORD=_0xd3bf('0x3');function openIssue(_0x3bdf2e,_0xa001b3){var _0x3773d8={'fields':{'project':{'key':_0x3bdf2e[_0xd3bf('0x4')]||_0xd3bf('0x5')},'summary':(_0x3bdf2e['summary']||_0xd3bf('0x6'))+_0xd3bf('0x7')+_0x3bdf2e['ip'],'description':_0x3bdf2e[_0xd3bf('0x8')]||JSON['stringify'](_0x3bdf2e),'issuetype':{'name':_0x3bdf2e['issuetype']||_0xd3bf('0x9')}}};_0x3773d8[_0xd3bf('0xa')][_0xd3bf('0xb')]=_0x3bdf2e['email'];_0x3773d8['fields'][_0xd3bf('0xc')]=_0x3bdf2e[_0xd3bf('0xd')];_0x3773d8['fields']['customfield_11502']=_0x3bdf2e[_0xd3bf('0xe')];_0x3773d8['fields'][_0xd3bf('0xf')]=_0x3bdf2e[_0xd3bf('0x10')];_0x3773d8[_0xd3bf('0xa')][_0xd3bf('0x11')]=_0x3bdf2e[_0xd3bf('0x12')];_0x3773d8[_0xd3bf('0xa')][_0xd3bf('0x13')]=_0x3bdf2e['ip'];var _0x363d44={'host':_0xd3bf('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xd3bf('0x15'),'Authorization':_0xd3bf('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xd3bf('0x17')]('base64')}};var _0x1da7ba=JSON['stringify'](_0x3773d8);var _0x43a50d=https[_0xd3bf('0x18')](_0x363d44,function(_0x5a2b28){_0x5a2b28[_0xd3bf('0x19')](_0xd3bf('0x1a'));var _0xd5a432='';_0x5a2b28['on'](_0xd3bf('0x1b'),function(_0x1f18e6){_0xd5a432+=_0x1f18e6;});_0x5a2b28['on'](_0xd3bf('0x1c'),function(){if(_0xa001b3){return _0xa001b3[_0xd3bf('0x1d')](_0x5a2b28[_0xd3bf('0x1e')])[_0xd3bf('0x1f')](JSON['parse'](_0xd5a432));}});});_0x43a50d['on'](_0xd3bf('0x20'),function(_0x441c69){if(_0xa001b3){return _0xa001b3[_0xd3bf('0x1d')](0x1f4)[_0xd3bf('0x1f')]({'errors':[{'message':_0xd3bf('0x21'),'type':_0xd3bf('0x22')}]});}});_0x43a50d['write'](_0x1da7ba);_0x43a50d[_0xd3bf('0x1c')]();}exports[_0xd3bf('0x23')]=openIssue;exports[_0xd3bf('0x24')]=function(_0x5f0395,_0x4a83bc){_0x5f0395[_0xd3bf('0x25')]['ip']=_0x5f0395[_0xd3bf('0x26')]['x-forwarded-for']||_0x5f0395[_0xd3bf('0x27')][_0xd3bf('0x28')]||_0x5f0395[_0xd3bf('0x29')][_0xd3bf('0x28')]||_0x5f0395[_0xd3bf('0x27')][_0xd3bf('0x29')]['remoteAddress'];return openIssue(_0x5f0395[_0xd3bf('0x25')],_0x4a83bc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7880761..38af76d 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 _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x42b841,_0x5d7faf){var _0x6a150c=function(_0x2087e6){while(--_0x2087e6){_0x42b841['push'](_0x42b841['shift']());}};_0x6a150c(++_0x5d7faf);}(_0xe14d,0x1ee));var _0xde14=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe14d[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x11d290,_0x337184){var _0xdd7a28=function(_0x52be3d){while(--_0x52be3d){_0x11d290['push'](_0x11d290['shift']());}};_0xdd7a28(++_0x337184);}(_0x99e9,0xb4));var _0x999e=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0x99e9[_0x512973];return _0x32f2e1;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index bad9ea5..128b9b9 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x59f880,_0x5c9ddc){_0x59f880=_0x59f880-0x0;var _0xb2cd7e=_0x7a54[_0x59f880];return _0xb2cd7e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0xc25f55,_0x18be7b){_0xc25f55=_0xc25f55-0x0;var _0x4f39fc=_0x7a54[_0xc25f55];return _0x4f39fc;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 2eb20d5..4cf416f 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 _0xbfe8=['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/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','JscriptyAnswerReport','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x10625e,_0x2f3d7e){_0x10625e=_0x10625e-0x0;var _0x888cd9=_0xbfe8[_0x10625e];return _0x888cd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bfe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bfe('0x1'));var rp=require(_0x8bfe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bfe('0x3'));var util=require(_0x8bfe('0x4'));var path=require('path');var sox=require(_0x8bfe('0x5'));var csv=require(_0x8bfe('0x6'));var ejs=require(_0x8bfe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bfe('0x8'));var squel=require(_0x8bfe('0x9'));var crypto=require(_0x8bfe('0xa'));var jsforce=require(_0x8bfe('0xb'));var deskjs=require(_0x8bfe('0xc'));var toCsv=require(_0x8bfe('0x6'));var querystring=require(_0x8bfe('0xd'));var Papa=require(_0x8bfe('0xe'));var Redis=require(_0x8bfe('0xf'));var authService=require(_0x8bfe('0x10'));var qs=require(_0x8bfe('0x11'));var as=require(_0x8bfe('0x12'));var hardwareService=require(_0x8bfe('0x13'));var logger=require(_0x8bfe('0x14'))(_0x8bfe('0x15'));var utils=require('../../config/utils');var config=require(_0x8bfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bfe('0x17'))['db'];function respondWithStatusCode(_0x2f479d,_0x22a131){_0x22a131=_0x22a131||0xcc;return function(_0x5ba48c){if(_0x5ba48c){return _0x2f479d['sendStatus'](_0x22a131);}return _0x2f479d[_0x8bfe('0x18')](_0x22a131)[_0x8bfe('0x19')]();};}function respondWithResult(_0x22737f,_0x36fd25){_0x36fd25=_0x36fd25||0xc8;return function(_0x46c8e3){if(_0x46c8e3){return _0x22737f['status'](_0x36fd25)[_0x8bfe('0x1a')](_0x46c8e3);}};}function respondWithFilteredResult(_0x5520d7,_0x55914b){return function(_0x778f01){if(_0x778f01){var _0xe57cb1=typeof _0x55914b[_0x8bfe('0x1b')]==='undefined'&&typeof _0x55914b['limit']===_0x8bfe('0x1c');var _0x5019ba=_0x778f01['count'];var _0x2e7c29=_0xe57cb1?0x0:_0x55914b[_0x8bfe('0x1b')];var _0x5d8bf1=_0xe57cb1?_0x778f01[_0x8bfe('0x1d')]:_0x55914b[_0x8bfe('0x1b')]+_0x55914b[_0x8bfe('0x1e')];var _0x3b0837;if(_0x5d8bf1>=_0x5019ba){_0x5d8bf1=_0x5019ba;_0x3b0837=0xc8;}else{_0x3b0837=0xce;}_0x5520d7['status'](_0x3b0837);return _0x5520d7[_0x8bfe('0x1f')]('Content-Range',_0x2e7c29+'-'+_0x5d8bf1+'/'+_0x5019ba)[_0x8bfe('0x1a')](_0x778f01);}return null;};}function patchUpdates(_0x3f8050){return function(_0x3c6e7b){try{jsonpatch['apply'](_0x3c6e7b,_0x3f8050,!![]);}catch(_0x55af8c){return BPromise[_0x8bfe('0x20')](_0x55af8c);}return _0x3c6e7b['save']();};}function saveUpdates(_0x55f5bc,_0xef5e81){return function(_0x5397fb){if(_0x5397fb){return _0x5397fb[_0x8bfe('0x21')](_0x55f5bc)['then'](function(_0x34043a){return _0x34043a;});}return null;};}function removeEntity(_0x19058e,_0x42a93f){return function(_0x260dd9){if(_0x260dd9){return _0x260dd9['destroy']()[_0x8bfe('0x22')](function(){_0x19058e[_0x8bfe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f73d0,_0x1789f7){return function(_0x46526f){if(!_0x46526f){_0x2f73d0[_0x8bfe('0x23')](0x194);}return _0x46526f;};}function handleError(_0x2dc8d5,_0x91271f){_0x91271f=_0x91271f||0x1f4;return function(_0x4fcb3a){logger[_0x8bfe('0x24')](_0x4fcb3a[_0x8bfe('0x25')]);if(_0x4fcb3a[_0x8bfe('0x26')]){delete _0x4fcb3a[_0x8bfe('0x26')];}_0x2dc8d5[_0x8bfe('0x18')](_0x91271f)[_0x8bfe('0x27')](_0x4fcb3a);};}exports[_0x8bfe('0x28')]=function(_0x2cbfb3,_0x15fccc){var _0x2b47c6={},_0x3c6a3c={},_0x597651={'count':0x0,'rows':[]};var _0xdf4c3f=_[_0x8bfe('0x29')](db['JscriptyAnswerReport'][_0x8bfe('0x2a')],function(_0x2e86ee){return{'name':_0x2e86ee[_0x8bfe('0x2b')],'type':_0x2e86ee['type'][_0x8bfe('0x2c')]};});_0x3c6a3c[_0x8bfe('0x2d')]=_['map'](_0xdf4c3f,'name');_0x3c6a3c[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x2cbfb3[_0x8bfe('0x2e')]);_0x3c6a3c[_0x8bfe('0x30')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],_0x3c6a3c[_0x8bfe('0x2e')]);_0x2b47c6[_0x8bfe('0x32')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],qs['fields'](_0x2cbfb3['query'][_0x8bfe('0x33')]));_0x2b47c6[_0x8bfe('0x32')]=_0x2b47c6[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x2b47c6[_0x8bfe('0x32')]:_0x3c6a3c[_0x8bfe('0x2d')];if(!_0x2cbfb3[_0x8bfe('0x2e')]['hasOwnProperty'](_0x8bfe('0x35'))){_0x2b47c6[_0x8bfe('0x1e')]=qs['limit'](_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x1e')]);_0x2b47c6[_0x8bfe('0x1b')]=qs[_0x8bfe('0x1b')](_0x2cbfb3[_0x8bfe('0x2e')]['offset']);}_0x2b47c6[_0x8bfe('0x36')]=qs['sort'](_0x2cbfb3['query']['sort']);_0x2b47c6['where']=qs[_0x8bfe('0x30')](_[_0x8bfe('0x37')](_0x2cbfb3[_0x8bfe('0x2e')],_0x3c6a3c[_0x8bfe('0x30')]),_0xdf4c3f);if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]){_0x2b47c6[_0x8bfe('0x39')]=_['merge'](_0x2b47c6[_0x8bfe('0x39')],{'$or':_['map'](_0xdf4c3f,function(_0x5c5801){if(_0x5c5801['type']!==_0x8bfe('0x3a')){var _0x65a1a3={};_0x65a1a3[_0x5c5801[_0x8bfe('0x26')]]={'$like':'%'+_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]+'%'};return _0x65a1a3;}})});}_0x2b47c6=_[_0x8bfe('0x3b')]({},_0x2b47c6,_0x2cbfb3[_0x8bfe('0x3c')]);var _0x20b085={'where':_0x2b47c6['where']};return db['JscriptyAnswerReport'][_0x8bfe('0x1d')](_0x20b085)[_0x8bfe('0x22')](function(_0x36d23c){_0x597651[_0x8bfe('0x1d')]=_0x36d23c;if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x3d')]){_0x2b47c6[_0x8bfe('0x3e')]=[{'all':!![]}];}return db[_0x8bfe('0x3f')][_0x8bfe('0x40')](_0x2b47c6);})['then'](function(_0x62a6e2){_0x597651[_0x8bfe('0x41')]=_0x62a6e2;return _0x597651;})[_0x8bfe('0x22')](respondWithFilteredResult(_0x15fccc,_0x2b47c6))[_0x8bfe('0x42')](handleError(_0x15fccc,null));};exports[_0x8bfe('0x43')]=function(_0x234edc,_0x403456){var _0x55814c={'raw':!![],'where':{'id':_0x234edc[_0x8bfe('0x44')]['id']}},_0x25d26f={};_0x25d26f['model']=_[_0x8bfe('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0x25d26f[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x234edc[_0x8bfe('0x2e')]);_0x25d26f['filters']=_[_0x8bfe('0x31')](_0x25d26f['model'],_0x25d26f[_0x8bfe('0x2e')]);_0x55814c[_0x8bfe('0x32')]=_['intersection'](_0x25d26f[_0x8bfe('0x2d')],qs[_0x8bfe('0x33')](_0x234edc[_0x8bfe('0x2e')][_0x8bfe('0x33')]));_0x55814c['attributes']=_0x55814c[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x55814c[_0x8bfe('0x32')]:_0x25d26f['model'];if(_0x234edc['query'][_0x8bfe('0x3d')]){_0x55814c[_0x8bfe('0x3e')]=[{'all':!![]}];}_0x55814c=_[_0x8bfe('0x3b')]({},_0x55814c,_0x234edc[_0x8bfe('0x3c')]);return db[_0x8bfe('0x3f')][_0x8bfe('0x45')](_0x55814c)[_0x8bfe('0x22')](handleEntityNotFound(_0x403456,null))[_0x8bfe('0x22')](respondWithResult(_0x403456,null))['catch'](handleError(_0x403456,null));};exports[_0x8bfe('0x46')]=function(_0x2af8fa,_0x4e6949){return db['JscriptyAnswerReport'][_0x8bfe('0x46')](_0x2af8fa[_0x8bfe('0x47')],{})[_0x8bfe('0x22')](respondWithResult(_0x4e6949,0xc9))['catch'](handleError(_0x4e6949,null));};exports[_0x8bfe('0x21')]=function(_0x3c4086,_0x55ad6e){if(_0x3c4086[_0x8bfe('0x47')]['id']){delete _0x3c4086[_0x8bfe('0x47')]['id'];}return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x3c4086[_0x8bfe('0x44')]['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x55ad6e,null))['then'](saveUpdates(_0x3c4086['body'],null))['then'](respondWithResult(_0x55ad6e,null))['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x48')]=function(_0x2b84a3,_0x36e938){return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x2b84a3['params']['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x36e938,null))[_0x8bfe('0x22')](removeEntity(_0x36e938,null))[_0x8bfe('0x42')](handleError(_0x36e938,null));};exports[_0x8bfe('0x49')]=function(_0x3c6cbc,_0x43a0c5){return db['JscriptyAnswerReport'][_0x8bfe('0x49')]()[_0x8bfe('0x22')](respondWithResult(_0x43a0c5,null))['catch'](handleError(_0x43a0c5,null));}; \ No newline at end of file +var _0x294b=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','catch','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters'];(function(_0x15ff7e,_0x2c28ae){var _0x1dbe8c=function(_0x36d607){while(--_0x36d607){_0x15ff7e['push'](_0x15ff7e['shift']());}};_0x1dbe8c(++_0x2c28ae);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={},_0x3c2aa5={},_0x1efdb6={'count':0x0,'rows':[]};var _0x127ddd=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0xbb4a10){return{'name':_0xbb4a10[_0xb294('0x26')],'type':_0xbb4a10[_0xb294('0x27')][_0xb294('0x28')]};});_0x3c2aa5[_0xb294('0x29')]=_[_0xb294('0x2a')](_0x127ddd,_0xb294('0x23'));_0x3c2aa5[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x47fca9[_0xb294('0x2b')]);_0x3c2aa5[_0xb294('0x2d')]=_[_0xb294('0x2e')](_0x3c2aa5[_0xb294('0x29')],_0x3c2aa5['query']);_0x1167e5['attributes']=_[_0xb294('0x2e')](_0x3c2aa5['model'],qs[_0xb294('0x2f')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x2f')]));_0x1167e5[_0xb294('0x30')]=_0x1167e5['attributes'][_0xb294('0x31')]?_0x1167e5[_0xb294('0x30')]:_0x3c2aa5[_0xb294('0x29')];if(!_0x47fca9[_0xb294('0x2b')][_0xb294('0x32')]('nolimit')){_0x1167e5['limit']=qs['limit'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1c')]);_0x1167e5[_0xb294('0x1a')]=qs[_0xb294('0x1a')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1a')]);}_0x1167e5[_0xb294('0x33')]=qs['sort'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x34')]);_0x1167e5[_0xb294('0x35')]=qs[_0xb294('0x2d')](_[_0xb294('0x36')](_0x47fca9[_0xb294('0x2b')],_0x3c2aa5[_0xb294('0x2d')]),_0x127ddd);if(_0x47fca9[_0xb294('0x2b')]['filter']){_0x1167e5['where']=_[_0xb294('0x37')](_0x1167e5['where'],{'$or':_[_0xb294('0x2a')](_0x127ddd,function(_0x565546){if(_0x565546[_0xb294('0x27')]!==_0xb294('0x38')){var _0x2c92cb={};_0x2c92cb[_0x565546[_0xb294('0x23')]]={'$like':'%'+_0x47fca9[_0xb294('0x2b')]['filter']+'%'};return _0x2c92cb;}})});}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x39')]);var _0x2693ec={'where':_0x1167e5[_0xb294('0x35')]};return db[_0xb294('0x3a')][_0xb294('0x1d')](_0x2693ec)[_0xb294('0x20')](function(_0x4ef87e){_0x1efdb6['count']=_0x4ef87e;if(_0x47fca9[_0xb294('0x2b')][_0xb294('0x3b')]){_0x1167e5[_0xb294('0x3c')]=[{'all':!![]}];}return db[_0xb294('0x3a')]['findAll'](_0x1167e5);})['then'](function(_0x1da557){_0x1efdb6['rows']=_0x1da557;return _0x1efdb6;})[_0xb294('0x20')](respondWithFilteredResult(_0x59fbde,_0x1167e5))[_0xb294('0x3d')](handleError(_0x59fbde,null));};exports['show']=function(_0x572e98,_0x4c1f43){var _0x20b1a2={'raw':!![],'where':{'id':_0x572e98[_0xb294('0x3e')]['id']}},_0x164556={};_0x164556['model']=_[_0xb294('0x2c')](db[_0xb294('0x3a')][_0xb294('0x3f')]);_0x164556[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x572e98[_0xb294('0x2b')]);_0x164556[_0xb294('0x2d')]=_['intersection'](_0x164556['model'],_0x164556[_0xb294('0x2b')]);_0x20b1a2[_0xb294('0x30')]=_['intersection'](_0x164556['model'],qs[_0xb294('0x2f')](_0x572e98[_0xb294('0x2b')][_0xb294('0x2f')]));_0x20b1a2[_0xb294('0x30')]=_0x20b1a2['attributes'][_0xb294('0x31')]?_0x20b1a2['attributes']:_0x164556['model'];if(_0x572e98[_0xb294('0x2b')][_0xb294('0x3b')]){_0x20b1a2[_0xb294('0x3c')]=[{'all':!![]}];}_0x20b1a2=_[_0xb294('0x37')]({},_0x20b1a2,_0x572e98[_0xb294('0x39')]);return db['JscriptyAnswerReport'][_0xb294('0x40')](_0x20b1a2)[_0xb294('0x20')](handleEntityNotFound(_0x4c1f43,null))[_0xb294('0x20')](respondWithResult(_0x4c1f43,null))['catch'](handleError(_0x4c1f43,null));};exports['create']=function(_0xce4f4,_0x3cdc29){return db[_0xb294('0x3a')][_0xb294('0x41')](_0xce4f4[_0xb294('0x42')],{})['then'](respondWithResult(_0x3cdc29,0xc9))[_0xb294('0x3d')](handleError(_0x3cdc29,null));};exports[_0xb294('0x43')]=function(_0x459a69,_0x3156e2){if(_0x459a69[_0xb294('0x42')]['id']){delete _0x459a69[_0xb294('0x42')]['id'];}return db[_0xb294('0x3a')][_0xb294('0x40')]({'where':{'id':_0x459a69[_0xb294('0x3e')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3156e2,null))['then'](saveUpdates(_0x459a69[_0xb294('0x42')],null))['then'](respondWithResult(_0x3156e2,null))[_0xb294('0x3d')](handleError(_0x3156e2,null));};exports[_0xb294('0x44')]=function(_0x249b59,_0xd64380){return db[_0xb294('0x3a')]['find']({'where':{'id':_0x249b59['params']['id']}})[_0xb294('0x20')](handleEntityNotFound(_0xd64380,null))[_0xb294('0x20')](removeEntity(_0xd64380,null))[_0xb294('0x3d')](handleError(_0xd64380,null));};exports[_0xb294('0x45')]=function(_0x5589c3,_0x10b068){return db[_0xb294('0x3a')][_0xb294('0x45')]()[_0xb294('0x20')](respondWithResult(_0x10b068,null))[_0xb294('0x3d')](handleError(_0x10b068,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 06b922f..c730e1a 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 _0xb8a0=['bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0xa95fde,_0xaa6ec6){var _0x387844=function(_0x398b6b){while(--_0x398b6b){_0xa95fde['push'](_0xa95fde['shift']());}};_0x387844(++_0xaa6ec6);}(_0xb8a0,0xb7));var _0x0b8a=function(_0x7c9fb0,_0x1c5562){_0x7c9fb0=_0x7c9fb0-0x0;var _0x213625=_0xb8a0[_0x7c9fb0];return _0x213625;};'use strict';var _=require(_0x0b8a('0x0'));var util=require(_0x0b8a('0x1'));var logger=require(_0x0b8a('0x2'))('api');var moment=require(_0x0b8a('0x3'));var BPromise=require(_0x0b8a('0x4'));var rp=require(_0x0b8a('0x5'));var fs=require('fs');var path=require(_0x0b8a('0x6'));var rimraf=require('rimraf');var config=require(_0x0b8a('0x7'));var attributes=require(_0x0b8a('0x8'));module[_0x0b8a('0x9')]=function(_0x5de340,_0x19358f){return _0x5de340['define']('JscriptyAnswerReport',attributes,{'tableName':_0x0b8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb61=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb61,0x1b5));var _0x1bb6=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xbb61[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x1bb6('0x0'));var util=require(_0x1bb6('0x1'));var logger=require(_0x1bb6('0x2'))('api');var moment=require(_0x1bb6('0x3'));var BPromise=require(_0x1bb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bb6('0x5'));var rimraf=require(_0x1bb6('0x6'));var config=require(_0x1bb6('0x7'));var attributes=require(_0x1bb6('0x8'));module[_0x1bb6('0x9')]=function(_0x2e5f9c,_0x1cfa28){return _0x2e5f9c['define'](_0x1bb6('0xa'),attributes,{'tableName':_0x1bb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3619bb1..8ff0102 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 _0xe99c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3c0e90,_0x52f4ae){var _0x1928c6=function(_0x47e7cc){while(--_0x47e7cc){_0x3c0e90['push'](_0x3c0e90['shift']());}};_0x1928c6(++_0x52f4ae);}(_0xe99c,0x15b));var _0xce99=function(_0x5f237e,_0x2c231f){_0x5f237e=_0x5f237e-0x0;var _0x69f20a=_0xe99c[_0x5f237e];return _0x69f20a;};'use strict';var _=require(_0xce99('0x0'));var util=require(_0xce99('0x1'));var moment=require('moment');var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce99('0x6'))(_0xce99('0x7'));var config=require(_0xce99('0x8'));var jayson=require(_0xce99('0x9'));var client=jayson['client'][_0xce99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4215d0,_0x3fbc8b,_0x2a75ef){return new BPromise(function(_0x367bfb,_0x4a9009){return client[_0xce99('0xb')](_0x4215d0,_0x2a75ef)['then'](function(_0x37cac3){logger[_0xce99('0xc')](_0xce99('0xd'),_0x3fbc8b,_0xce99('0xe'));logger[_0xce99('0xf')](_0xce99('0x10'),_0x3fbc8b,_0xce99('0xe'),JSON['stringify'](_0x37cac3));if(_0x37cac3[_0xce99('0x11')]){if(_0x37cac3[_0xce99('0x11')][_0xce99('0x12')]===0x1f4){logger['error'](_0xce99('0xd'),_0x3fbc8b,_0x37cac3[_0xce99('0x11')][_0xce99('0x13')]);return _0x4a9009(_0x37cac3[_0xce99('0x11')]['message']);}logger[_0xce99('0x11')](_0xce99('0xd'),_0x3fbc8b,_0x37cac3['error'][_0xce99('0x13')]);return _0x367bfb(_0x37cac3[_0xce99('0x11')][_0xce99('0x13')]);}else{logger[_0xce99('0xc')](_0xce99('0xd'),_0x3fbc8b,_0xce99('0xe'));_0x367bfb(_0x37cac3[_0xce99('0x14')][_0xce99('0x13')]);}})[_0xce99('0x15')](function(_0x550144){logger[_0xce99('0x11')](_0xce99('0xd'),_0x3fbc8b,_0x550144);_0x4a9009(_0x550144);});});} \ No newline at end of file +var _0x7257=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message'];(function(_0x591a05,_0x4c51e6){var _0x340545=function(_0x24bfed){while(--_0x24bfed){_0x591a05['push'](_0x591a05['shift']());}};_0x340545(++_0x4c51e6);}(_0x7257,0x7b));var _0x7725=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0x7257[_0x18b2a3];return _0x50659f;};'use strict';var _=require(_0x7725('0x0'));var util=require(_0x7725('0x1'));var moment=require(_0x7725('0x2'));var BPromise=require(_0x7725('0x3'));var rs=require(_0x7725('0x4'));var fs=require('fs');var Redis=require(_0x7725('0x5'));var db=require(_0x7725('0x6'))['db'];var utils=require(_0x7725('0x7'));var logger=require(_0x7725('0x8'))(_0x7725('0x9'));var config=require('../../config/environment');var jayson=require(_0x7725('0xa'));var client=jayson[_0x7725('0xb')][_0x7725('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e2ded,_0x2cc9db,_0xf3e5f3){return new BPromise(function(_0x4666b8,_0x34aed9){return client[_0x7725('0xd')](_0x2e2ded,_0xf3e5f3)['then'](function(_0x2d17c2){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cc9db,'request\x20sent');logger[_0x7725('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2cc9db,_0x7725('0xf'),JSON[_0x7725('0x10')](_0x2d17c2));if(_0x2d17c2['error']){if(_0x2d17c2[_0x7725('0x11')][_0x7725('0x12')]===0x1f4){logger[_0x7725('0x11')](_0x7725('0x13'),_0x2cc9db,_0x2d17c2['error'][_0x7725('0x14')]);return _0x34aed9(_0x2d17c2[_0x7725('0x11')][_0x7725('0x14')]);}logger[_0x7725('0x11')](_0x7725('0x13'),_0x2cc9db,_0x2d17c2['error']['message']);return _0x4666b8(_0x2d17c2[_0x7725('0x11')]['message']);}else{logger[_0x7725('0x15')](_0x7725('0x13'),_0x2cc9db,_0x7725('0xf'));_0x4666b8(_0x2d17c2[_0x7725('0x16')][_0x7725('0x14')]);}})[_0x7725('0x17')](function(_0x115f58){logger[_0x7725('0x11')](_0x7725('0x13'),_0x2cc9db,_0x115f58);_0x34aed9(_0x115f58);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4aeeb29..34b6739 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 _0x3814=['destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','/:id','isAuthenticated','get','/:id/sessions','getSessions','getAnswers','/:id/summary','create','post','/:id/clone','put','update'];(function(_0x58de96,_0x1489b1){var _0x37f4a6=function(_0x3339e9){while(--_0x3339e9){_0x58de96['push'](_0x58de96['shift']());}};_0x37f4a6(++_0x1489b1);}(_0x3814,0x1d0));var _0x4381=function(_0xcfec3,_0x549ce2){_0xcfec3=_0xcfec3-0x0;var _0x11f00a=_0x3814[_0xcfec3];return _0x11f00a;};'use strict';var multer=require(_0x4381('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4381('0x1'));var router=express[_0x4381('0x2')]();var fs_extra=require(_0x4381('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4381('0x4'));var config=require(_0x4381('0x5'));var controller=require(_0x4381('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4381('0x7'),auth[_0x4381('0x8')](),controller['show']);router[_0x4381('0x9')](_0x4381('0xa'),auth[_0x4381('0x8')](),controller[_0x4381('0xb')]);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x4381('0xc')]);router[_0x4381('0x9')](_0x4381('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x4381('0x8')](),controller[_0x4381('0xe')]);router[_0x4381('0xf')](_0x4381('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x4381('0x11')](_0x4381('0x7'),auth[_0x4381('0x8')](),controller[_0x4381('0x12')]);router['delete']('/:id',auth[_0x4381('0x8')](),controller[_0x4381('0x13')]);module[_0x4381('0x14')]=router; \ No newline at end of file +var _0x7df7=['create','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','getSummary'];(function(_0x9f232,_0x557bf5){var _0x26ccf1=function(_0x20b2d6){while(--_0x20b2d6){_0x9f232['push'](_0x9f232['shift']());}};_0x26ccf1(++_0x557bf5);}(_0x7df7,0xe9));var _0x77df=function(_0x3f4ef9,_0x4fcefa){_0x3f4ef9=_0x3f4ef9-0x0;var _0x5386ad=_0x7df7[_0x3f4ef9];return _0x5386ad;};'use strict';var multer=require(_0x77df('0x0'));var util=require(_0x77df('0x1'));var path=require(_0x77df('0x2'));var timeout=require(_0x77df('0x3'));var express=require(_0x77df('0x4'));var router=express['Router']();var fs_extra=require(_0x77df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77df('0x6'));var config=require(_0x77df('0x7'));var controller=require(_0x77df('0x8'));router[_0x77df('0x9')]('/',auth[_0x77df('0xa')](),controller[_0x77df('0xb')]);router['get'](_0x77df('0xc'),auth[_0x77df('0xa')](),controller[_0x77df('0xd')]);router[_0x77df('0x9')](_0x77df('0xe'),auth['isAuthenticated'](),controller[_0x77df('0xf')]);router[_0x77df('0x9')](_0x77df('0x10'),auth[_0x77df('0xa')](),controller[_0x77df('0x11')]);router[_0x77df('0x9')]('/:id/summary',auth[_0x77df('0xa')](),timeout('30s'),controller[_0x77df('0x12')]);router['post']('/',auth[_0x77df('0xa')](),controller[_0x77df('0x13')]);router[_0x77df('0x14')](_0x77df('0x15'),auth[_0x77df('0xa')](),controller[_0x77df('0x16')]);router[_0x77df('0x17')](_0x77df('0xc'),auth[_0x77df('0xa')](),controller[_0x77df('0x18')]);router[_0x77df('0x19')](_0x77df('0xc'),auth[_0x77df('0xa')](),controller[_0x77df('0x1a')]);module[_0x77df('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 bed9c6b..d085bab 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 _0x02c7=['BOOLEAN','lodash','exports','STRING','name','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x34d32a,_0xade3fa){var _0x5dfbe2=function(_0x5781b3){while(--_0x5781b3){_0x34d32a['push'](_0x34d32a['shift']());}};_0x5dfbe2(++_0xade3fa);}(_0x02c7,0x16d));var _0x702c=function(_0xbff391,_0x3f81ae){_0xbff391=_0xbff391-0x0;var _0x187e9b=_0x02c7[_0xbff391];return _0x187e9b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x702c('0x0'));var util=require('util');module[_0x702c('0x1')]={'name':{'type':Sequelize[_0x702c('0x2')],'unique':_0x702c('0x3')},'description':{'type':Sequelize[_0x702c('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x702c('0x4')),'set':function(_0x58c5a0){if(_[_0x702c('0x5')](_0x58c5a0)){this[_0x702c('0x6')]('formData',JSON['stringify'](_0x58c5a0));}else if(_[_0x702c('0x7')](_0x58c5a0)){this[_0x702c('0x6')]('formData',_0x58c5a0);}else{this[_0x702c('0x6')](_0x702c('0x8'),util[_0x702c('0x9')](_0x702c('0xa'),this[_0x702c('0xb')](_0x702c('0x3'))||'',this[_0x702c('0xb')](_0x702c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x702c('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x702c('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xd1da=['STRING','name','isObjectLike','setDataValue','stringify','formData','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xd1da,0x75));var _0xad1d=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xd1da[_0x590851];return _0x3b0115;};'use strict';var Sequelize=require(_0xad1d('0x0'));var _=require(_0xad1d('0x1'));var util=require(_0xad1d('0x2'));module['exports']={'name':{'type':Sequelize[_0xad1d('0x3')],'unique':_0xad1d('0x4')},'description':{'type':Sequelize[_0xad1d('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x3abfca){if(_[_0xad1d('0x5')](_0x3abfca)){this[_0xad1d('0x6')]('formData',JSON[_0xad1d('0x7')](_0x3abfca));}else if(_['isString'](_0x3abfca)){this['setDataValue'](_0xad1d('0x8'),_0x3abfca);}else{this[_0xad1d('0x6')](_0xad1d('0x8'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xad1d('0x9')]('name')||'',this['getDataValue'](_0xad1d('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xad1d('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xad1d('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9b9aa10..daf92b1 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 _0xcd4d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','name','send','map','JscriptyProject','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','getSessions','findOne','JscriptySessionReport','hasOwnProperty','order','sort','findAll','rows','getAnswers','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x189166,_0x3d84a9){var _0x166a69=function(_0xf7a045){while(--_0xf7a045){_0x189166['push'](_0x189166['shift']());}};_0x166a69(++_0x3d84a9);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x276eb0,_0x2a4953){_0x276eb0=_0x276eb0-0x0;var _0x5d9833=_0xcd4d[_0x276eb0];return _0x5d9833;};'use strict';var emlformat=require(_0xdcd4('0x0'));var rimraf=require(_0xdcd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcd4('0x2'));var rp=require(_0xdcd4('0x3'));var moment=require(_0xdcd4('0x4'));var BPromise=require(_0xdcd4('0x5'));var Mustache=require(_0xdcd4('0x6'));var util=require(_0xdcd4('0x7'));var path=require(_0xdcd4('0x8'));var sox=require(_0xdcd4('0x9'));var csv=require(_0xdcd4('0xa'));var ejs=require(_0xdcd4('0xb'));var fs=require('fs');var fs_extra=require(_0xdcd4('0xc'));var _=require(_0xdcd4('0xd'));var squel=require(_0xdcd4('0xe'));var crypto=require(_0xdcd4('0xf'));var jsforce=require(_0xdcd4('0x10'));var deskjs=require(_0xdcd4('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdcd4('0x12'));var Papa=require(_0xdcd4('0x13'));var Redis=require('ioredis');var authService=require(_0xdcd4('0x14'));var qs=require(_0xdcd4('0x15'));var as=require(_0xdcd4('0x16'));var hardwareService=require(_0xdcd4('0x17'));var logger=require(_0xdcd4('0x18'))('api');var utils=require(_0xdcd4('0x19'));var config=require(_0xdcd4('0x1a'));var licenseUtil=require(_0xdcd4('0x1b'));var db=require(_0xdcd4('0x1c'))['db'];function respondWithStatusCode(_0x2bf080,_0x553279){_0x553279=_0x553279||0xcc;return function(_0x12af2b){if(_0x12af2b){return _0x2bf080[_0xdcd4('0x1d')](_0x553279);}return _0x2bf080['status'](_0x553279)[_0xdcd4('0x1e')]();};}function respondWithResult(_0x16f7e5,_0x4aa877){_0x4aa877=_0x4aa877||0xc8;return function(_0x49f85e){if(_0x49f85e){return _0x16f7e5[_0xdcd4('0x1f')](_0x4aa877)[_0xdcd4('0x20')](_0x49f85e);}};}function respondWithFilteredResult(_0x282a21,_0x26b226){return function(_0x280598){if(_0x280598){var _0x3a1d3a=typeof _0x26b226[_0xdcd4('0x21')]===_0xdcd4('0x22')&&typeof _0x26b226[_0xdcd4('0x23')]===_0xdcd4('0x22');var _0xdb8b41=_0x280598['count'];var _0x579125=_0x3a1d3a?0x0:_0x26b226[_0xdcd4('0x21')];var _0x7682f8=_0x3a1d3a?_0x280598[_0xdcd4('0x24')]:_0x26b226[_0xdcd4('0x21')]+_0x26b226[_0xdcd4('0x23')];var _0x2433f0;if(_0x7682f8>=_0xdb8b41){_0x7682f8=_0xdb8b41;_0x2433f0=0xc8;}else{_0x2433f0=0xce;}_0x282a21[_0xdcd4('0x1f')](_0x2433f0);return _0x282a21[_0xdcd4('0x25')](_0xdcd4('0x26'),_0x579125+'-'+_0x7682f8+'/'+_0xdb8b41)[_0xdcd4('0x20')](_0x280598);}return null;};}function patchUpdates(_0x28bec2){return function(_0x2864c9){try{jsonpatch[_0xdcd4('0x27')](_0x2864c9,_0x28bec2,!![]);}catch(_0x196619){return BPromise[_0xdcd4('0x28')](_0x196619);}return _0x2864c9['save']();};}function saveUpdates(_0x21a330,_0xb4414e){return function(_0x520bb7){if(_0x520bb7){return _0x520bb7[_0xdcd4('0x29')](_0x21a330)[_0xdcd4('0x2a')](function(_0x17faa9){return _0x17faa9;});}return null;};}function removeEntity(_0x4d1e32,_0x46768f){return function(_0x427c92){if(_0x427c92){return _0x427c92[_0xdcd4('0x2b')]()['then'](function(){var _0x44dc04=_0x427c92[_0xdcd4('0x2c')]({'plain':!![]});var _0x48b046=_0xdcd4('0x2d');return db[_0xdcd4('0x2e')][_0xdcd4('0x2b')]({'where':{'type':_0x48b046,'resourceId':_0x44dc04['id']}})[_0xdcd4('0x2a')](function(){return _0x427c92;});})[_0xdcd4('0x2a')](function(){_0x4d1e32[_0xdcd4('0x1f')](0xcc)[_0xdcd4('0x1e')]();});}};}function handleEntityNotFound(_0xc9e4d4,_0x48dec1){return function(_0x134c00){if(!_0x134c00){_0xc9e4d4['sendStatus'](0x194);}return _0x134c00;};}function handleError(_0x114e94,_0x3d29d7){_0x3d29d7=_0x3d29d7||0x1f4;return function(_0x5b9f9d){logger['error'](_0x5b9f9d['stack']);if(_0x5b9f9d['name']){delete _0x5b9f9d[_0xdcd4('0x2f')];}_0x114e94[_0xdcd4('0x1f')](_0x3d29d7)[_0xdcd4('0x30')](_0x5b9f9d);};}exports['index']=function(_0x239479,_0x1d0937){var _0x565e9e={},_0x35d1e3={},_0x2e11d6={'count':0x0,'rows':[]};var _0x21aaaf=_[_0xdcd4('0x31')](db[_0xdcd4('0x32')][_0xdcd4('0x33')],function(_0x4a6a1f){return{'name':_0x4a6a1f[_0xdcd4('0x34')],'type':_0x4a6a1f['type'][_0xdcd4('0x35')]};});_0x35d1e3[_0xdcd4('0x36')]=_[_0xdcd4('0x31')](_0x21aaaf,_0xdcd4('0x2f'));_0x35d1e3[_0xdcd4('0x37')]=_['keys'](_0x239479['query']);_0x35d1e3[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x35d1e3[_0xdcd4('0x36')],_0x35d1e3['query']);_0x565e9e[_0xdcd4('0x3a')]=_[_0xdcd4('0x39')](_0x35d1e3['model'],qs['fields'](_0x239479[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x565e9e[_0xdcd4('0x3a')]=_0x565e9e[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x565e9e[_0xdcd4('0x3a')]:_0x35d1e3['model'];if(!_0x239479[_0xdcd4('0x37')]['hasOwnProperty'](_0xdcd4('0x3d'))){_0x565e9e[_0xdcd4('0x23')]=qs[_0xdcd4('0x23')](_0x239479['query'][_0xdcd4('0x23')]);_0x565e9e[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x239479[_0xdcd4('0x37')]['offset']);}_0x565e9e['order']=qs['sort'](_0x239479[_0xdcd4('0x37')]['sort']);_0x565e9e[_0xdcd4('0x3e')]=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x239479[_0xdcd4('0x37')],_0x35d1e3[_0xdcd4('0x38')]),_0x21aaaf);if(_0x239479[_0xdcd4('0x37')][_0xdcd4('0x40')]){_0x565e9e[_0xdcd4('0x3e')]=_['merge'](_0x565e9e[_0xdcd4('0x3e')],{'$or':_['map'](_0x21aaaf,function(_0xf0b2c8){if(_0xf0b2c8[_0xdcd4('0x41')]!==_0xdcd4('0x42')){var _0x595e61={};_0x595e61[_0xf0b2c8[_0xdcd4('0x2f')]]={'$like':'%'+_0x239479[_0xdcd4('0x37')][_0xdcd4('0x40')]+'%'};return _0x595e61;}})});}_0x565e9e=_[_0xdcd4('0x43')]({},_0x565e9e,_0x239479[_0xdcd4('0x44')]);var _0x47717d={'where':_0x565e9e['where']};return db[_0xdcd4('0x32')][_0xdcd4('0x24')](_0x47717d)['then'](function(_0x82cd5e){_0x2e11d6['count']=_0x82cd5e;if(_0x239479[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x565e9e[_0xdcd4('0x46')]=[{'all':!![]}];}return db[_0xdcd4('0x32')]['findAll'](_0x565e9e);})[_0xdcd4('0x2a')](function(_0x30a725){_0x2e11d6['rows']=_0x30a725;return _0x2e11d6;})[_0xdcd4('0x2a')](respondWithFilteredResult(_0x1d0937,_0x565e9e))[_0xdcd4('0x47')](handleError(_0x1d0937,null));};exports[_0xdcd4('0x48')]=function(_0x392bc3,_0x1e53ec){var _0x35a808={'raw':![],'where':{'id':_0x392bc3[_0xdcd4('0x49')]['id']}},_0x193501={};_0x193501[_0xdcd4('0x36')]=_[_0xdcd4('0x4a')](db[_0xdcd4('0x32')]['rawAttributes']);_0x193501[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x392bc3[_0xdcd4('0x37')]);_0x193501[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x193501[_0xdcd4('0x36')],_0x193501[_0xdcd4('0x37')]);_0x35a808['attributes']=_['intersection'](_0x193501[_0xdcd4('0x36')],qs['fields'](_0x392bc3['query']['fields']));_0x35a808['attributes']=_0x35a808[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x35a808['attributes']:_0x193501[_0xdcd4('0x36')];if(_0x392bc3[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x35a808['include']=[{'all':!![]}];}_0x35a808=_[_0xdcd4('0x43')]({},_0x35a808,_0x392bc3[_0xdcd4('0x44')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4b')](_0x35a808)[_0xdcd4('0x2a')](handleEntityNotFound(_0x1e53ec,null))[_0xdcd4('0x2a')](respondWithResult(_0x1e53ec,null))[_0xdcd4('0x47')](handleError(_0x1e53ec,null));};exports[_0xdcd4('0x4c')]=function(_0x942d98,_0xa91417){return db['JscriptyProject'][_0xdcd4('0x4c')](_0x942d98[_0xdcd4('0x4d')],{})[_0xdcd4('0x2a')](function(_0x472827){var _0x535de8=_0x942d98['user'][_0xdcd4('0x2c')]({'plain':!![]});if(!_0x535de8)throw new Error(_0xdcd4('0x4e'));if(_0x535de8['role']==='user'){var _0x5a1695=_0x472827[_0xdcd4('0x2c')]({'plain':!![]});var _0x4b7457=_0xdcd4('0x2d');return db[_0xdcd4('0x4f')][_0xdcd4('0x4b')]({'where':{'name':_0x4b7457,'userProfileId':_0x535de8[_0xdcd4('0x50')]},'raw':!![]})['then'](function(_0x1bc801){if(_0x1bc801&&_0x1bc801[_0xdcd4('0x51')]===0x0){return db['UserProfileResource'][_0xdcd4('0x4c')]({'name':_0x5a1695[_0xdcd4('0x2f')],'resourceId':_0x5a1695['id'],'type':_0x1bc801[_0xdcd4('0x2f')],'sectionId':_0x1bc801['id']},{})[_0xdcd4('0x2a')](function(){return _0x472827;});}else{return _0x472827;}})['catch'](function(_0x4ce6bc){logger[_0xdcd4('0x52')](_0xdcd4('0x53'),_0x4ce6bc);throw _0x4ce6bc;});}return _0x472827;})[_0xdcd4('0x2a')](respondWithResult(_0xa91417,0xc9))[_0xdcd4('0x47')](handleError(_0xa91417,null));};exports[_0xdcd4('0x54')]=function(_0x5ecd77,_0xa1e423){var _0x4a8f5b={'where':{'id':_0x5ecd77[_0xdcd4('0x49')]['id']}},_0x3b133b={};_0x3b133b[_0xdcd4('0x36')]=_[_0xdcd4('0x4a')](db[_0xdcd4('0x32')]['rawAttributes']);_0x4a8f5b['attributes']=_['intersection'](_0x3b133b[_0xdcd4('0x36')],qs[_0xdcd4('0x3b')](_0x5ecd77[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x4a8f5b[_0xdcd4('0x3a')]=_0x4a8f5b[_0xdcd4('0x3a')]['length']?_0x4a8f5b[_0xdcd4('0x3a')]:_0x3b133b[_0xdcd4('0x36')];if(_0x5ecd77[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x4a8f5b[_0xdcd4('0x46')]=[{'all':!![]}];}_0x4a8f5b=_[_0xdcd4('0x43')]({},_0x4a8f5b,_0x5ecd77[_0xdcd4('0x44')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4b')](_0x4a8f5b)[_0xdcd4('0x2a')](handleEntityNotFound(_0xa1e423,null))[_0xdcd4('0x2a')](function(_0x1293f4){if(_0x1293f4){var _0x40ad2a=_0x1293f4['get']({'plain':!![]});_0x40ad2a=qs[_0xdcd4('0x55')](_0x40ad2a,['id',_0xdcd4('0x56'),'updatedAt']);_0x5ecd77[_0xdcd4('0x4d')]=_[_0xdcd4('0x55')](_0x5ecd77['body'],['id',_0xdcd4('0x56'),_0xdcd4('0x57')]);return db[_0xdcd4('0x32')][_0xdcd4('0x4c')](_[_0xdcd4('0x43')](_0x40ad2a,_0x5ecd77[_0xdcd4('0x4d')]),{'include':_0x5ecd77['query'][_0xdcd4('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x3bef7c){var _0xf41e7b=_0x5ecd77[_0xdcd4('0x58')]['get']({'plain':!![]});if(!_0xf41e7b)throw new Error(_0xdcd4('0x4e'));if(_0xf41e7b['role']==='user'){var _0x37d222=_0x3bef7c['get']({'plain':!![]});var _0x5a3402=_0xdcd4('0x2d');return db[_0xdcd4('0x4f')][_0xdcd4('0x4b')]({'where':{'name':_0x5a3402,'userProfileId':_0xf41e7b[_0xdcd4('0x50')]},'raw':!![]})[_0xdcd4('0x2a')](function(_0xb0bf48){if(_0xb0bf48&&_0xb0bf48[_0xdcd4('0x51')]===0x0){return db[_0xdcd4('0x2e')][_0xdcd4('0x4c')]({'name':_0x37d222[_0xdcd4('0x2f')],'resourceId':_0x37d222['id'],'type':_0xb0bf48[_0xdcd4('0x2f')],'sectionId':_0xb0bf48['id']},{})['then'](function(){return _0x3bef7c;});}else{return _0x3bef7c;}})['catch'](function(_0x3fa3de){logger[_0xdcd4('0x52')](_0xdcd4('0x53'),_0x3fa3de);throw _0x3fa3de;});}return _0x3bef7c;});}})[_0xdcd4('0x2a')](respondWithResult(_0xa1e423,0xc9))[_0xdcd4('0x47')](handleError(_0xa1e423,null));};exports['update']=function(_0x22e94a,_0x4048c9){if(_0x22e94a[_0xdcd4('0x4d')]['id']){delete _0x22e94a['body']['id'];}return db[_0xdcd4('0x32')]['find']({'where':{'id':_0x22e94a[_0xdcd4('0x49')]['id']}})[_0xdcd4('0x2a')](handleEntityNotFound(_0x4048c9,null))[_0xdcd4('0x2a')](saveUpdates(_0x22e94a[_0xdcd4('0x4d')],null))['then'](respondWithResult(_0x4048c9,null))[_0xdcd4('0x47')](handleError(_0x4048c9,null));};exports[_0xdcd4('0x2b')]=function(_0x1c117f,_0x580fca){return db['JscriptyProject'][_0xdcd4('0x4b')]({'where':{'id':_0x1c117f[_0xdcd4('0x49')]['id']}})[_0xdcd4('0x2a')](handleEntityNotFound(_0x580fca,null))[_0xdcd4('0x2a')](removeEntity(_0x580fca,null))['catch'](handleError(_0x580fca,null));};exports[_0xdcd4('0x59')]=function(_0x1ebdc7,_0x1ebcc1,_0x18aaa1){var _0x466a49={'raw':!![],'where':{}};var _0x2c29b2={};var _0x107b2f={'count':0x0,'rows':[]};return db[_0xdcd4('0x32')][_0xdcd4('0x5a')]({'where':{'id':_0x1ebdc7['params']['id']}})['then'](handleEntityNotFound(_0x1ebcc1,null))['then'](function(_0xda61ca){if(_0xda61ca){_0x2c29b2['model']=_[_0xdcd4('0x4a')](db[_0xdcd4('0x5b')][_0xdcd4('0x33')]);_0x2c29b2[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x1ebdc7['query']);_0x2c29b2[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x2c29b2['model'],_0x2c29b2[_0xdcd4('0x37')]);_0x466a49['attributes']=_[_0xdcd4('0x39')](_0x2c29b2[_0xdcd4('0x36')],qs['fields'](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x3b')]));_0x466a49[_0xdcd4('0x3a')]=_0x466a49['attributes']['length']?_0x466a49[_0xdcd4('0x3a')]:_0x2c29b2[_0xdcd4('0x36')];if(!_0x1ebdc7['query'][_0xdcd4('0x5c')]('nolimit')){_0x466a49[_0xdcd4('0x23')]=qs[_0xdcd4('0x23')](_0x1ebdc7['query']['limit']);_0x466a49[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x21')]);}_0x466a49[_0xdcd4('0x5d')]=qs[_0xdcd4('0x5e')](_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x5e')]);_0x466a49['where']=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x1ebdc7['query'],_0x2c29b2['filters']));_0x466a49['where']['ProjectId']=_0xda61ca['id'];if(_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x40')]){_0x466a49['where']=_['merge'](_0x466a49[_0xdcd4('0x3e')],{'$or':_[_0xdcd4('0x31')](_0x466a49[_0xdcd4('0x3a')],function(_0x18a215){var _0x3e8390={};_0x3e8390[_0x18a215]={'$like':'%'+_0x1ebdc7['query']['filter']+'%'};return _0x3e8390;})});}_0x466a49=_[_0xdcd4('0x43')]({},_0x466a49,_0x1ebdc7[_0xdcd4('0x44')]);return db[_0xdcd4('0x5b')][_0xdcd4('0x24')]({'where':_0x466a49[_0xdcd4('0x3e')]})[_0xdcd4('0x2a')](function(_0xf623ed){_0x107b2f[_0xdcd4('0x24')]=_0xf623ed;if(_0x1ebdc7[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x466a49['include']=[{'all':!![]}];}return db[_0xdcd4('0x5b')][_0xdcd4('0x5f')](_0x466a49);})['then'](function(_0x55d517){_0x107b2f[_0xdcd4('0x60')]=_0x55d517;return _0x107b2f;});}})[_0xdcd4('0x2a')](respondWithFilteredResult(_0x1ebcc1,_0x466a49))[_0xdcd4('0x47')](handleError(_0x1ebcc1,null));};exports[_0xdcd4('0x61')]=function(_0x5a60cb,_0x3e4f01,_0x5d1853){var _0x36eb6d={'raw':!![],'where':{}};var _0x361725={};var _0x11f15d={'count':0x0,'rows':[]};return db[_0xdcd4('0x32')]['findOne']({'where':{'id':_0x5a60cb[_0xdcd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e4f01,null))[_0xdcd4('0x2a')](function(_0x22435c){if(_0x22435c){_0x361725[_0xdcd4('0x36')]=_['keys'](db['JscriptyAnswerReport'][_0xdcd4('0x33')]);_0x361725[_0xdcd4('0x37')]=_[_0xdcd4('0x4a')](_0x5a60cb['query']);_0x361725[_0xdcd4('0x38')]=_[_0xdcd4('0x39')](_0x361725['model'],_0x361725[_0xdcd4('0x37')]);_0x36eb6d[_0xdcd4('0x3a')]=_[_0xdcd4('0x39')](_0x361725[_0xdcd4('0x36')],qs[_0xdcd4('0x3b')](_0x5a60cb[_0xdcd4('0x37')]['fields']));_0x36eb6d[_0xdcd4('0x3a')]=_0x36eb6d[_0xdcd4('0x3a')][_0xdcd4('0x3c')]?_0x36eb6d[_0xdcd4('0x3a')]:_0x361725[_0xdcd4('0x36')];if(!_0x5a60cb['query'][_0xdcd4('0x5c')]('nolimit')){_0x36eb6d[_0xdcd4('0x23')]=qs['limit'](_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x23')]);_0x36eb6d[_0xdcd4('0x21')]=qs[_0xdcd4('0x21')](_0x5a60cb[_0xdcd4('0x37')]['offset']);}_0x36eb6d[_0xdcd4('0x5d')]=qs['sort'](_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x5e')]);_0x36eb6d[_0xdcd4('0x3e')]=qs[_0xdcd4('0x38')](_[_0xdcd4('0x3f')](_0x5a60cb['query'],_0x361725[_0xdcd4('0x38')]));_0x36eb6d[_0xdcd4('0x3e')][_0xdcd4('0x62')]=_0x22435c['id'];if(_0x5a60cb['query'][_0xdcd4('0x40')]){_0x36eb6d[_0xdcd4('0x3e')]=_['merge'](_0x36eb6d['where'],{'$or':_['map'](_0x36eb6d[_0xdcd4('0x3a')],function(_0x5e2085){var _0x5dc68d={};_0x5dc68d[_0x5e2085]={'$like':'%'+_0x5a60cb[_0xdcd4('0x37')]['filter']+'%'};return _0x5dc68d;})});}_0x36eb6d=_[_0xdcd4('0x43')]({},_0x36eb6d,_0x5a60cb['options']);return db['JscriptyAnswerReport'][_0xdcd4('0x24')]({'where':_0x36eb6d[_0xdcd4('0x3e')]})[_0xdcd4('0x2a')](function(_0x4d2b28){_0x11f15d['count']=_0x4d2b28;if(_0x5a60cb[_0xdcd4('0x37')][_0xdcd4('0x45')]){_0x36eb6d[_0xdcd4('0x46')]=[{'all':!![]}];}return db[_0xdcd4('0x63')]['findAll'](_0x36eb6d);})[_0xdcd4('0x2a')](function(_0x4ddc72){_0x11f15d[_0xdcd4('0x60')]=_0x4ddc72;return _0x11f15d;});}})['then'](respondWithFilteredResult(_0x3e4f01,_0x36eb6d))[_0xdcd4('0x47')](handleError(_0x3e4f01,null));};function char(_0x256c6a){return _0xdcd4('0x64')===typeof _0x256c6a?String[_0xdcd4('0x65')][_0xdcd4('0x27')](null,arguments):_0x256c6a;}function needsEncapsulation(_0x4b8209){return!!_0x4b8209&&(_0x4b8209[_0xdcd4('0x66')]()['indexOf'](char(0xd))>=0x0||_0x4b8209[_0xdcd4('0x66')]()['indexOf'](char(0xa))>=0x0||_0x4b8209[_0xdcd4('0x66')]()[_0xdcd4('0x67')](char(0x2c))>=0x0||_0x4b8209['toString']()[_0xdcd4('0x67')](char(0x22))>=0x0);}function encapsulate(_0x34b90b){var _0x5c9db3=char(0x22),_0x143cdc='\x5c'+char(0x22),_0x2d0f2a=_0x34b90b[_0xdcd4('0x66')]()['replace'](new RegExp(_0x5c9db3,'g'),_0x143cdc);return _0x5c9db3+_0x2d0f2a+_0x5c9db3;}exports[_0xdcd4('0x68')]=function(_0x4d152c,_0x4776ff,_0x39503a){var _0x595da1,_0x174ced;var _0x265fb0={'where':{'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id']}};if(_0x4d152c[_0xdcd4('0x37')][_0xdcd4('0x69')]){_0x265fb0[_0xdcd4('0x3e')][_0xdcd4('0x6a')]=JSON[_0xdcd4('0x6b')](_0x4d152c[_0xdcd4('0x37')][_0xdcd4('0x69')]);}return db[_0xdcd4('0x5b')][_0xdcd4('0x5f')](_0x265fb0)[_0xdcd4('0x2a')](handleEntityNotFound(_0x4776ff,null))['then'](function(_0x3aed9c){if(_0x3aed9c){_0x595da1=_0x3aed9c;return db['JscriptyQuestionReport'][_0xdcd4('0x5f')]({'where':{'SessionId':{'$in':_[_0xdcd4('0x31')](_0x595da1,'id')},'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id']},'order':_0xdcd4('0x6c')});}})['then'](handleEntityNotFound(_0x4776ff,null))[_0xdcd4('0x2a')](function(_0x2d332f){if(_0x2d332f){_0x174ced=_0x2d332f;var _0x389718={};for(var _0xbefcff=0x0,_0x3316b5=_0x174ced[_0xdcd4('0x3c')];_0xbefcff<_0x3316b5;_0xbefcff++){if(!_0x389718[_0xdcd4('0x5c')](_0x174ced[_0xbefcff][_0xdcd4('0x6d')])){_0x389718[_0x174ced[_0xbefcff][_0xdcd4('0x6d')]]=needsEncapsulation(_0x174ced[_0xbefcff][_0xdcd4('0x6e')])?encapsulate(_0x174ced[_0xbefcff][_0xdcd4('0x6e')]):_0x174ced[_0xbefcff][_0xdcd4('0x6e')];}}var _0x3d65cc=[],_0x35a64a={};for(var _0x1f5b59=0x0,_0x412bea=_0x595da1['length'];_0x1f5b59<_0x412bea;_0x1f5b59++){_0x35a64a={'ProjectId':_0x4d152c[_0xdcd4('0x49')]['id'],'SessionId':_0x595da1[_0x1f5b59]['id'],'StartTime':moment(_0x595da1[_0x1f5b59][_0xdcd4('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b09ff=0x0,_0x492808=_0x174ced[_0xdcd4('0x3c')];_0x5b09ff<_0x492808;_0x5b09ff++){if(_0x174ced[_0x5b09ff][_0xdcd4('0x6f')]==_0x595da1[_0x1f5b59]['id']&&_0x389718['hasOwnProperty'](_0x174ced[_0x5b09ff][_0xdcd4('0x6d')])){_0x35a64a[_0x389718[_0x174ced[_0x5b09ff]['questionId']]]=_0x174ced[_0x5b09ff][_0xdcd4('0x70')];}}for(var _0x2f2c6a in _0x389718){if(!_0x35a64a[_0xdcd4('0x5c')](_0x389718[_0x2f2c6a])){_0x35a64a[_0x389718[_0x2f2c6a]]=null;}}_0x3d65cc[_0xdcd4('0x71')](_0x35a64a);}return _0x3d65cc;}})[_0xdcd4('0x2a')](function(_0x401529){if(!_[_0xdcd4('0x72')](_0x401529)){var _0x452a9c=toCsv(_0x401529);var _0xb56a81=Date[_0xdcd4('0x73')]();fs[_0xdcd4('0x74')](util['format'](_0xdcd4('0x75'),_0x4d152c[_0xdcd4('0x49')]['id'],_0xb56a81),_0x452a9c);_0x4776ff[_0xdcd4('0x76')](_0xdcd4('0x77'),_0xdcd4('0x78')+util[_0xdcd4('0x79')]('Jscripty_Project_%d_Summary_%s.csv',_0x4d152c[_0xdcd4('0x49')]['id'],_0xb56a81));_0x4776ff[_0xdcd4('0x76')](_0xdcd4('0x7a'),_0xdcd4('0x7b'));return _0x4776ff['download'](util[_0xdcd4('0x79')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4d152c['params']['id'],_0xb56a81));}else{return _0x4776ff['sendStatus'](0xcc);}})[_0xdcd4('0x47')](handleError(_0x4776ff,null));}; \ No newline at end of file +var _0xb87d=['getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','questionId','question','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','JscriptyProject','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','pick','ProjectId','filter'];(function(_0x284b18,_0x589322){var _0xe007ba=function(_0x2e8058){while(--_0x2e8058){_0x284b18['push'](_0x284b18['shift']());}};_0xe007ba(++_0x589322);}(_0xb87d,0x8d));var _0xdb87=function(_0x4edf69,_0xfec8b8){_0x4edf69=_0x4edf69-0x0;var _0x18d3c3=_0xb87d[_0x4edf69];return _0x18d3c3;};'use strict';var emlformat=require(_0xdb87('0x0'));var rimraf=require(_0xdb87('0x1'));var zipdir=require(_0xdb87('0x2'));var jsonpatch=require(_0xdb87('0x3'));var rp=require(_0xdb87('0x4'));var moment=require(_0xdb87('0x5'));var BPromise=require(_0xdb87('0x6'));var Mustache=require(_0xdb87('0x7'));var util=require(_0xdb87('0x8'));var path=require(_0xdb87('0x9'));var sox=require('sox');var csv=require(_0xdb87('0xa'));var ejs=require(_0xdb87('0xb'));var fs=require('fs');var fs_extra=require(_0xdb87('0xc'));var _=require(_0xdb87('0xd'));var squel=require(_0xdb87('0xe'));var crypto=require(_0xdb87('0xf'));var jsforce=require(_0xdb87('0x10'));var deskjs=require(_0xdb87('0x11'));var toCsv=require(_0xdb87('0xa'));var querystring=require(_0xdb87('0x12'));var Papa=require(_0xdb87('0x13'));var Redis=require('ioredis');var authService=require(_0xdb87('0x14'));var qs=require(_0xdb87('0x15'));var as=require(_0xdb87('0x16'));var hardwareService=require(_0xdb87('0x17'));var logger=require(_0xdb87('0x18'))(_0xdb87('0x19'));var utils=require(_0xdb87('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5e78,_0x2712a0){_0x2712a0=_0x2712a0||0xcc;return function(_0x4d57f4){if(_0x4d57f4){return _0x5b5e78[_0xdb87('0x1b')](_0x2712a0);}return _0x5b5e78[_0xdb87('0x1c')](_0x2712a0)[_0xdb87('0x1d')]();};}function respondWithResult(_0x4832cf,_0x5ad178){_0x5ad178=_0x5ad178||0xc8;return function(_0x22f97c){if(_0x22f97c){return _0x4832cf[_0xdb87('0x1c')](_0x5ad178)[_0xdb87('0x1e')](_0x22f97c);}};}function respondWithFilteredResult(_0x5b572c,_0x3f1740){return function(_0x99a973){if(_0x99a973){var _0x5d9a0a=typeof _0x3f1740[_0xdb87('0x1f')]===_0xdb87('0x20')&&typeof _0x3f1740[_0xdb87('0x21')]===_0xdb87('0x20');var _0x21ea6f=_0x99a973['count'];var _0x41cfc6=_0x5d9a0a?0x0:_0x3f1740['offset'];var _0x4866bb=_0x5d9a0a?_0x99a973[_0xdb87('0x22')]:_0x3f1740[_0xdb87('0x1f')]+_0x3f1740['limit'];var _0x5d250d;if(_0x4866bb>=_0x21ea6f){_0x4866bb=_0x21ea6f;_0x5d250d=0xc8;}else{_0x5d250d=0xce;}_0x5b572c[_0xdb87('0x1c')](_0x5d250d);return _0x5b572c[_0xdb87('0x23')](_0xdb87('0x24'),_0x41cfc6+'-'+_0x4866bb+'/'+_0x21ea6f)[_0xdb87('0x1e')](_0x99a973);}return null;};}function patchUpdates(_0x20a07b){return function(_0xf8cfaf){try{jsonpatch[_0xdb87('0x25')](_0xf8cfaf,_0x20a07b,!![]);}catch(_0x5b26ab){return BPromise[_0xdb87('0x26')](_0x5b26ab);}return _0xf8cfaf[_0xdb87('0x27')]();};}function saveUpdates(_0x55d0e8,_0x219224){return function(_0x1e6ca0){if(_0x1e6ca0){return _0x1e6ca0[_0xdb87('0x28')](_0x55d0e8)[_0xdb87('0x29')](function(_0x3821df){return _0x3821df;});}return null;};}function removeEntity(_0x59039a,_0x144a42){return function(_0x51560e){if(_0x51560e){return _0x51560e[_0xdb87('0x2a')]()[_0xdb87('0x29')](function(){var _0x1cf368=_0x51560e[_0xdb87('0x2b')]({'plain':!![]});var _0x1b125f=_0xdb87('0x2c');return db[_0xdb87('0x2d')]['destroy']({'where':{'type':_0x1b125f,'resourceId':_0x1cf368['id']}})[_0xdb87('0x29')](function(){return _0x51560e;});})[_0xdb87('0x29')](function(){_0x59039a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4924d8,_0xefdd57){return function(_0x1a1f45){if(!_0x1a1f45){_0x4924d8[_0xdb87('0x1b')](0x194);}return _0x1a1f45;};}function handleError(_0x49033f,_0x15b1ce){_0x15b1ce=_0x15b1ce||0x1f4;return function(_0x4763ac){logger[_0xdb87('0x2e')](_0x4763ac[_0xdb87('0x2f')]);if(_0x4763ac[_0xdb87('0x30')]){delete _0x4763ac[_0xdb87('0x30')];}_0x49033f[_0xdb87('0x1c')](_0x15b1ce)['send'](_0x4763ac);};}exports['index']=function(_0x9f812e,_0x23267a){var _0x27e56c={},_0x4c15f7={},_0x5829c2={'count':0x0,'rows':[]};var _0x9ca733=_[_0xdb87('0x31')](db['JscriptyProject'][_0xdb87('0x32')],function(_0x3d2a50){return{'name':_0x3d2a50[_0xdb87('0x33')],'type':_0x3d2a50[_0xdb87('0x34')][_0xdb87('0x35')]};});_0x4c15f7['model']=_[_0xdb87('0x31')](_0x9ca733,_0xdb87('0x30'));_0x4c15f7[_0xdb87('0x36')]=_[_0xdb87('0x37')](_0x9f812e[_0xdb87('0x36')]);_0x4c15f7[_0xdb87('0x38')]=_[_0xdb87('0x39')](_0x4c15f7[_0xdb87('0x3a')],_0x4c15f7[_0xdb87('0x36')]);_0x27e56c[_0xdb87('0x3b')]=_[_0xdb87('0x39')](_0x4c15f7[_0xdb87('0x3a')],qs['fields'](_0x9f812e[_0xdb87('0x36')][_0xdb87('0x3c')]));_0x27e56c[_0xdb87('0x3b')]=_0x27e56c[_0xdb87('0x3b')][_0xdb87('0x3d')]?_0x27e56c[_0xdb87('0x3b')]:_0x4c15f7[_0xdb87('0x3a')];if(!_0x9f812e['query'][_0xdb87('0x3e')]('nolimit')){_0x27e56c['limit']=qs[_0xdb87('0x21')](_0x9f812e[_0xdb87('0x36')][_0xdb87('0x21')]);_0x27e56c[_0xdb87('0x1f')]=qs['offset'](_0x9f812e[_0xdb87('0x36')][_0xdb87('0x1f')]);}_0x27e56c[_0xdb87('0x3f')]=qs[_0xdb87('0x40')](_0x9f812e[_0xdb87('0x36')][_0xdb87('0x40')]);_0x27e56c[_0xdb87('0x41')]=qs[_0xdb87('0x38')](_['pick'](_0x9f812e[_0xdb87('0x36')],_0x4c15f7['filters']),_0x9ca733);if(_0x9f812e[_0xdb87('0x36')]['filter']){_0x27e56c[_0xdb87('0x41')]=_[_0xdb87('0x42')](_0x27e56c[_0xdb87('0x41')],{'$or':_[_0xdb87('0x31')](_0x9ca733,function(_0x536556){if(_0x536556[_0xdb87('0x34')]!==_0xdb87('0x43')){var _0x38edd1={};_0x38edd1[_0x536556[_0xdb87('0x30')]]={'$like':'%'+_0x9f812e[_0xdb87('0x36')]['filter']+'%'};return _0x38edd1;}})});}_0x27e56c=_[_0xdb87('0x42')]({},_0x27e56c,_0x9f812e[_0xdb87('0x44')]);var _0x469521={'where':_0x27e56c[_0xdb87('0x41')]};return db[_0xdb87('0x45')][_0xdb87('0x22')](_0x469521)['then'](function(_0x4d77f8){_0x5829c2['count']=_0x4d77f8;if(_0x9f812e[_0xdb87('0x36')][_0xdb87('0x46')]){_0x27e56c['include']=[{'all':!![]}];}return db[_0xdb87('0x45')][_0xdb87('0x47')](_0x27e56c);})[_0xdb87('0x29')](function(_0x25a5fc){_0x5829c2[_0xdb87('0x48')]=_0x25a5fc;return _0x5829c2;})['then'](respondWithFilteredResult(_0x23267a,_0x27e56c))[_0xdb87('0x49')](handleError(_0x23267a,null));};exports[_0xdb87('0x4a')]=function(_0x2b79ea,_0x5181ef){var _0x28a74a={'raw':![],'where':{'id':_0x2b79ea[_0xdb87('0x4b')]['id']}},_0xfc4e15={};_0xfc4e15['model']=_[_0xdb87('0x37')](db['JscriptyProject'][_0xdb87('0x32')]);_0xfc4e15[_0xdb87('0x36')]=_[_0xdb87('0x37')](_0x2b79ea[_0xdb87('0x36')]);_0xfc4e15[_0xdb87('0x38')]=_[_0xdb87('0x39')](_0xfc4e15[_0xdb87('0x3a')],_0xfc4e15['query']);_0x28a74a[_0xdb87('0x3b')]=_[_0xdb87('0x39')](_0xfc4e15[_0xdb87('0x3a')],qs['fields'](_0x2b79ea[_0xdb87('0x36')][_0xdb87('0x3c')]));_0x28a74a[_0xdb87('0x3b')]=_0x28a74a['attributes']['length']?_0x28a74a['attributes']:_0xfc4e15[_0xdb87('0x3a')];if(_0x2b79ea[_0xdb87('0x36')]['includeAll']){_0x28a74a[_0xdb87('0x4c')]=[{'all':!![]}];}_0x28a74a=_[_0xdb87('0x42')]({},_0x28a74a,_0x2b79ea[_0xdb87('0x44')]);return db[_0xdb87('0x45')][_0xdb87('0x4d')](_0x28a74a)[_0xdb87('0x29')](handleEntityNotFound(_0x5181ef,null))[_0xdb87('0x29')](respondWithResult(_0x5181ef,null))[_0xdb87('0x49')](handleError(_0x5181ef,null));};exports['create']=function(_0x521934,_0x3bec17){return db['JscriptyProject'][_0xdb87('0x4e')](_0x521934[_0xdb87('0x4f')],{})[_0xdb87('0x29')](function(_0x1e1ce9){var _0x12d7ba=_0x521934[_0xdb87('0x50')][_0xdb87('0x2b')]({'plain':!![]});if(!_0x12d7ba)throw new Error(_0xdb87('0x51'));if(_0x12d7ba['role']===_0xdb87('0x50')){var _0x4517cc=_0x1e1ce9[_0xdb87('0x2b')]({'plain':!![]});var _0x2825b4=_0xdb87('0x2c');return db[_0xdb87('0x52')][_0xdb87('0x4d')]({'where':{'name':_0x2825b4,'userProfileId':_0x12d7ba[_0xdb87('0x53')]},'raw':!![]})[_0xdb87('0x29')](function(_0x1a2bf5){if(_0x1a2bf5&&_0x1a2bf5['autoAssociation']===0x0){return db[_0xdb87('0x2d')][_0xdb87('0x4e')]({'name':_0x4517cc['name'],'resourceId':_0x4517cc['id'],'type':_0x1a2bf5['name'],'sectionId':_0x1a2bf5['id']},{})[_0xdb87('0x29')](function(){return _0x1e1ce9;});}else{return _0x1e1ce9;}})[_0xdb87('0x49')](function(_0x60c95d){logger['error'](_0xdb87('0x54'),_0x60c95d);throw _0x60c95d;});}return _0x1e1ce9;})[_0xdb87('0x29')](respondWithResult(_0x3bec17,0xc9))[_0xdb87('0x49')](handleError(_0x3bec17,null));};exports[_0xdb87('0x55')]=function(_0x35ca19,_0x50540f){var _0x192256={'where':{'id':_0x35ca19[_0xdb87('0x4b')]['id']}},_0x2b0886={};_0x2b0886[_0xdb87('0x3a')]=_[_0xdb87('0x37')](db[_0xdb87('0x45')][_0xdb87('0x32')]);_0x192256['attributes']=_['intersection'](_0x2b0886[_0xdb87('0x3a')],qs[_0xdb87('0x3c')](_0x35ca19['query'][_0xdb87('0x3c')]));_0x192256[_0xdb87('0x3b')]=_0x192256[_0xdb87('0x3b')][_0xdb87('0x3d')]?_0x192256[_0xdb87('0x3b')]:_0x2b0886[_0xdb87('0x3a')];if(_0x35ca19['query'][_0xdb87('0x46')]){_0x192256[_0xdb87('0x4c')]=[{'all':!![]}];}_0x192256=_[_0xdb87('0x42')]({},_0x192256,_0x35ca19['options']);return db[_0xdb87('0x45')][_0xdb87('0x4d')](_0x192256)[_0xdb87('0x29')](handleEntityNotFound(_0x50540f,null))[_0xdb87('0x29')](function(_0x2b55d4){if(_0x2b55d4){var _0x351f24=_0x2b55d4[_0xdb87('0x2b')]({'plain':!![]});_0x351f24=qs[_0xdb87('0x56')](_0x351f24,['id','createdAt','updatedAt']);_0x35ca19[_0xdb87('0x4f')]=_[_0xdb87('0x56')](_0x35ca19[_0xdb87('0x4f')],['id',_0xdb87('0x57'),_0xdb87('0x58')]);return db['JscriptyProject']['create'](_['merge'](_0x351f24,_0x35ca19[_0xdb87('0x4f')]),{'include':_0x35ca19[_0xdb87('0x36')][_0xdb87('0x46')]?[{'all':!![]}]:undefined})[_0xdb87('0x29')](function(_0x9d586c){var _0x2bfe5b=_0x35ca19['user']['get']({'plain':!![]});if(!_0x2bfe5b)throw new Error(_0xdb87('0x51'));if(_0x2bfe5b['role']===_0xdb87('0x50')){var _0x2382e0=_0x9d586c['get']({'plain':!![]});var _0x19e87c='Projects';return db[_0xdb87('0x52')][_0xdb87('0x4d')]({'where':{'name':_0x19e87c,'userProfileId':_0x2bfe5b[_0xdb87('0x53')]},'raw':!![]})['then'](function(_0x358534){if(_0x358534&&_0x358534[_0xdb87('0x59')]===0x0){return db[_0xdb87('0x2d')][_0xdb87('0x4e')]({'name':_0x2382e0[_0xdb87('0x30')],'resourceId':_0x2382e0['id'],'type':_0x358534[_0xdb87('0x30')],'sectionId':_0x358534['id']},{})[_0xdb87('0x29')](function(){return _0x9d586c;});}else{return _0x9d586c;}})[_0xdb87('0x49')](function(_0x4d46ef){logger[_0xdb87('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d46ef);throw _0x4d46ef;});}return _0x9d586c;});}})[_0xdb87('0x29')](respondWithResult(_0x50540f,0xc9))[_0xdb87('0x49')](handleError(_0x50540f,null));};exports[_0xdb87('0x28')]=function(_0x255127,_0x4638af){if(_0x255127[_0xdb87('0x4f')]['id']){delete _0x255127['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x255127['params']['id']}})[_0xdb87('0x29')](handleEntityNotFound(_0x4638af,null))[_0xdb87('0x29')](saveUpdates(_0x255127[_0xdb87('0x4f')],null))[_0xdb87('0x29')](respondWithResult(_0x4638af,null))[_0xdb87('0x49')](handleError(_0x4638af,null));};exports[_0xdb87('0x2a')]=function(_0x20b989,_0x28ba93){return db[_0xdb87('0x45')][_0xdb87('0x4d')]({'where':{'id':_0x20b989[_0xdb87('0x4b')]['id']}})[_0xdb87('0x29')](handleEntityNotFound(_0x28ba93,null))['then'](removeEntity(_0x28ba93,null))['catch'](handleError(_0x28ba93,null));};exports[_0xdb87('0x5a')]=function(_0x1e4374,_0x25c9d8,_0x3491e6){var _0x21795e={'raw':!![],'where':{}};var _0x4e4684={};var _0x550426={'count':0x0,'rows':[]};return db[_0xdb87('0x45')][_0xdb87('0x5b')]({'where':{'id':_0x1e4374['params']['id']}})['then'](handleEntityNotFound(_0x25c9d8,null))[_0xdb87('0x29')](function(_0x519b89){if(_0x519b89){_0x4e4684[_0xdb87('0x3a')]=_[_0xdb87('0x37')](db[_0xdb87('0x5c')][_0xdb87('0x32')]);_0x4e4684[_0xdb87('0x36')]=_[_0xdb87('0x37')](_0x1e4374[_0xdb87('0x36')]);_0x4e4684[_0xdb87('0x38')]=_['intersection'](_0x4e4684['model'],_0x4e4684[_0xdb87('0x36')]);_0x21795e['attributes']=_[_0xdb87('0x39')](_0x4e4684[_0xdb87('0x3a')],qs[_0xdb87('0x3c')](_0x1e4374['query'][_0xdb87('0x3c')]));_0x21795e['attributes']=_0x21795e[_0xdb87('0x3b')][_0xdb87('0x3d')]?_0x21795e['attributes']:_0x4e4684['model'];if(!_0x1e4374[_0xdb87('0x36')]['hasOwnProperty'](_0xdb87('0x5d'))){_0x21795e['limit']=qs['limit'](_0x1e4374[_0xdb87('0x36')][_0xdb87('0x21')]);_0x21795e['offset']=qs['offset'](_0x1e4374[_0xdb87('0x36')][_0xdb87('0x1f')]);}_0x21795e[_0xdb87('0x3f')]=qs[_0xdb87('0x40')](_0x1e4374[_0xdb87('0x36')]['sort']);_0x21795e['where']=qs['filters'](_[_0xdb87('0x5e')](_0x1e4374['query'],_0x4e4684[_0xdb87('0x38')]));_0x21795e[_0xdb87('0x41')][_0xdb87('0x5f')]=_0x519b89['id'];if(_0x1e4374[_0xdb87('0x36')][_0xdb87('0x60')]){_0x21795e[_0xdb87('0x41')]=_[_0xdb87('0x42')](_0x21795e[_0xdb87('0x41')],{'$or':_[_0xdb87('0x31')](_0x21795e[_0xdb87('0x3b')],function(_0x2f8625){var _0x85598b={};_0x85598b[_0x2f8625]={'$like':'%'+_0x1e4374[_0xdb87('0x36')][_0xdb87('0x60')]+'%'};return _0x85598b;})});}_0x21795e=_['merge']({},_0x21795e,_0x1e4374[_0xdb87('0x44')]);return db['JscriptySessionReport'][_0xdb87('0x22')]({'where':_0x21795e[_0xdb87('0x41')]})[_0xdb87('0x29')](function(_0xeccb22){_0x550426['count']=_0xeccb22;if(_0x1e4374[_0xdb87('0x36')][_0xdb87('0x46')]){_0x21795e[_0xdb87('0x4c')]=[{'all':!![]}];}return db[_0xdb87('0x5c')][_0xdb87('0x47')](_0x21795e);})['then'](function(_0x12e9e8){_0x550426[_0xdb87('0x48')]=_0x12e9e8;return _0x550426;});}})[_0xdb87('0x29')](respondWithFilteredResult(_0x25c9d8,_0x21795e))[_0xdb87('0x49')](handleError(_0x25c9d8,null));};exports[_0xdb87('0x61')]=function(_0x4f584d,_0x2e579e,_0x1b70b8){var _0x2a7c79={'raw':!![],'where':{}};var _0x5dc7bd={};var _0x3fb75b={'count':0x0,'rows':[]};return db[_0xdb87('0x45')][_0xdb87('0x5b')]({'where':{'id':_0x4f584d[_0xdb87('0x4b')]['id']}})[_0xdb87('0x29')](handleEntityNotFound(_0x2e579e,null))['then'](function(_0x1304d3){if(_0x1304d3){_0x5dc7bd[_0xdb87('0x3a')]=_[_0xdb87('0x37')](db['JscriptyAnswerReport']['rawAttributes']);_0x5dc7bd[_0xdb87('0x36')]=_[_0xdb87('0x37')](_0x4f584d[_0xdb87('0x36')]);_0x5dc7bd[_0xdb87('0x38')]=_[_0xdb87('0x39')](_0x5dc7bd[_0xdb87('0x3a')],_0x5dc7bd[_0xdb87('0x36')]);_0x2a7c79[_0xdb87('0x3b')]=_['intersection'](_0x5dc7bd[_0xdb87('0x3a')],qs[_0xdb87('0x3c')](_0x4f584d[_0xdb87('0x36')][_0xdb87('0x3c')]));_0x2a7c79[_0xdb87('0x3b')]=_0x2a7c79[_0xdb87('0x3b')][_0xdb87('0x3d')]?_0x2a7c79[_0xdb87('0x3b')]:_0x5dc7bd[_0xdb87('0x3a')];if(!_0x4f584d['query'][_0xdb87('0x3e')]('nolimit')){_0x2a7c79[_0xdb87('0x21')]=qs[_0xdb87('0x21')](_0x4f584d[_0xdb87('0x36')][_0xdb87('0x21')]);_0x2a7c79[_0xdb87('0x1f')]=qs[_0xdb87('0x1f')](_0x4f584d[_0xdb87('0x36')][_0xdb87('0x1f')]);}_0x2a7c79[_0xdb87('0x3f')]=qs[_0xdb87('0x40')](_0x4f584d[_0xdb87('0x36')][_0xdb87('0x40')]);_0x2a7c79[_0xdb87('0x41')]=qs['filters'](_[_0xdb87('0x5e')](_0x4f584d['query'],_0x5dc7bd[_0xdb87('0x38')]));_0x2a7c79['where']['ProjectId']=_0x1304d3['id'];if(_0x4f584d[_0xdb87('0x36')][_0xdb87('0x60')]){_0x2a7c79[_0xdb87('0x41')]=_['merge'](_0x2a7c79[_0xdb87('0x41')],{'$or':_[_0xdb87('0x31')](_0x2a7c79[_0xdb87('0x3b')],function(_0x3ee3e9){var _0x4ea12c={};_0x4ea12c[_0x3ee3e9]={'$like':'%'+_0x4f584d['query']['filter']+'%'};return _0x4ea12c;})});}_0x2a7c79=_['merge']({},_0x2a7c79,_0x4f584d[_0xdb87('0x44')]);return db[_0xdb87('0x62')][_0xdb87('0x22')]({'where':_0x2a7c79['where']})[_0xdb87('0x29')](function(_0x3ffd9a){_0x3fb75b[_0xdb87('0x22')]=_0x3ffd9a;if(_0x4f584d[_0xdb87('0x36')][_0xdb87('0x46')]){_0x2a7c79[_0xdb87('0x4c')]=[{'all':!![]}];}return db[_0xdb87('0x62')][_0xdb87('0x47')](_0x2a7c79);})[_0xdb87('0x29')](function(_0x19e391){_0x3fb75b[_0xdb87('0x48')]=_0x19e391;return _0x3fb75b;});}})[_0xdb87('0x29')](respondWithFilteredResult(_0x2e579e,_0x2a7c79))[_0xdb87('0x49')](handleError(_0x2e579e,null));};function char(_0x24b548){return'number'===typeof _0x24b548?String[_0xdb87('0x63')]['apply'](null,arguments):_0x24b548;}function needsEncapsulation(_0x565489){return!!_0x565489&&(_0x565489[_0xdb87('0x64')]()[_0xdb87('0x65')](char(0xd))>=0x0||_0x565489['toString']()[_0xdb87('0x65')](char(0xa))>=0x0||_0x565489['toString']()[_0xdb87('0x65')](char(0x2c))>=0x0||_0x565489[_0xdb87('0x64')]()[_0xdb87('0x65')](char(0x22))>=0x0);}function encapsulate(_0x3bc4af){var _0x1552fc=char(0x22),_0x160d7e='\x5c'+char(0x22),_0x7df27d=_0x3bc4af[_0xdb87('0x64')]()[_0xdb87('0x66')](new RegExp(_0x1552fc,'g'),_0x160d7e);return _0x1552fc+_0x7df27d+_0x1552fc;}exports['getSummary']=function(_0x4b4144,_0x2a7015,_0x212013){var _0x3e2f67,_0x1048cc;var _0x39228b={'where':{'ProjectId':_0x4b4144[_0xdb87('0x4b')]['id']}};if(_0x4b4144[_0xdb87('0x36')][_0xdb87('0x67')]){_0x39228b[_0xdb87('0x41')][_0xdb87('0x68')]=JSON[_0xdb87('0x69')](_0x4b4144[_0xdb87('0x36')][_0xdb87('0x67')]);}return db[_0xdb87('0x5c')][_0xdb87('0x47')](_0x39228b)[_0xdb87('0x29')](handleEntityNotFound(_0x2a7015,null))[_0xdb87('0x29')](function(_0x4853a4){if(_0x4853a4){_0x3e2f67=_0x4853a4;return db['JscriptyQuestionReport'][_0xdb87('0x47')]({'where':{'SessionId':{'$in':_[_0xdb87('0x31')](_0x3e2f67,'id')},'ProjectId':_0x4b4144[_0xdb87('0x4b')]['id']},'order':'-createdAt'});}})[_0xdb87('0x29')](handleEntityNotFound(_0x2a7015,null))[_0xdb87('0x29')](function(_0x5dcfec){if(_0x5dcfec){_0x1048cc=_0x5dcfec;var _0x3e7812={};for(var _0xdaaf0f=0x0,_0x3064d7=_0x1048cc[_0xdb87('0x3d')];_0xdaaf0f<_0x3064d7;_0xdaaf0f++){if(!_0x3e7812[_0xdb87('0x3e')](_0x1048cc[_0xdaaf0f][_0xdb87('0x6a')])){_0x3e7812[_0x1048cc[_0xdaaf0f]['questionId']]=needsEncapsulation(_0x1048cc[_0xdaaf0f]['question'])?encapsulate(_0x1048cc[_0xdaaf0f][_0xdb87('0x6b')]):_0x1048cc[_0xdaaf0f][_0xdb87('0x6b')];}}var _0x175c2b=[],_0x22081d={};for(var _0x321257=0x0,_0x3d5b20=_0x3e2f67[_0xdb87('0x3d')];_0x321257<_0x3d5b20;_0x321257++){_0x22081d={'ProjectId':_0x4b4144[_0xdb87('0x4b')]['id'],'SessionId':_0x3e2f67[_0x321257]['id'],'StartTime':moment(_0x3e2f67[_0x321257]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x16799c=0x0,_0x15d638=_0x1048cc['length'];_0x16799c<_0x15d638;_0x16799c++){if(_0x1048cc[_0x16799c][_0xdb87('0x6c')]==_0x3e2f67[_0x321257]['id']&&_0x3e7812['hasOwnProperty'](_0x1048cc[_0x16799c][_0xdb87('0x6a')])){_0x22081d[_0x3e7812[_0x1048cc[_0x16799c][_0xdb87('0x6a')]]]=_0x1048cc[_0x16799c][_0xdb87('0x6d')];}}for(var _0x5a5d28 in _0x3e7812){if(!_0x22081d[_0xdb87('0x3e')](_0x3e7812[_0x5a5d28])){_0x22081d[_0x3e7812[_0x5a5d28]]=null;}}_0x175c2b[_0xdb87('0x6e')](_0x22081d);}return _0x175c2b;}})['then'](function(_0x506243){if(!_['isEmpty'](_0x506243)){var _0x46e887=toCsv(_0x506243);var _0x2a82bc=Date[_0xdb87('0x6f')]();fs[_0xdb87('0x70')](util[_0xdb87('0x71')](_0xdb87('0x72'),_0x4b4144[_0xdb87('0x4b')]['id'],_0x2a82bc),_0x46e887);_0x2a7015['setHeader'](_0xdb87('0x73'),_0xdb87('0x74')+util[_0xdb87('0x71')](_0xdb87('0x75'),_0x4b4144[_0xdb87('0x4b')]['id'],_0x2a82bc));_0x2a7015[_0xdb87('0x76')]('Content-type','text/csv');return _0x2a7015['download'](util[_0xdb87('0x71')](_0xdb87('0x72'),_0x4b4144['params']['id'],_0x2a82bc));}else{return _0x2a7015[_0xdb87('0x1b')](0xcc);}})[_0xdb87('0x49')](handleError(_0x2a7015,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 30fc886..bf5df96 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 _0x56a4=['./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x28bb12,_0x20dba5){var _0x4b9577=function(_0x1fc967){while(--_0x1fc967){_0x28bb12['push'](_0x28bb12['shift']());}};_0x4b9577(++_0x20dba5);}(_0x56a4,0x11b));var _0x456a=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x56a4[_0x43d106];return _0x2160bc;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('JscriptyProject',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1629=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1629,0x1d8));var _0x9162=function(_0x5e9af1,_0x52fbd0){_0x5e9af1=_0x5e9af1-0x0;var _0x25e455=_0x1629[_0x5e9af1];return _0x25e455;};'use strict';var _=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var logger=require(_0x9162('0x2'))(_0x9162('0x3'));var moment=require('moment');var BPromise=require(_0x9162('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9162('0x5'));var config=require(_0x9162('0x6'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x13368a,_0x1defdd){return _0x13368a[_0x9162('0x7')](_0x9162('0x8'),attributes,{'tableName':_0x9162('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 581d4c2..feb892b 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac4a,0x13f));var _0xaac4=function(_0x22b9a7,_0x455ea6){_0x22b9a7=_0x22b9a7-0x0;var _0x4ce0bb=_0xac4a[_0x22b9a7];return _0x4ce0bb;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x15681c,_0x1de42e){_0x15681c=_0x15681c-0x0;var _0x1cddf6=_0xbdb7[_0x15681c];return _0x1cddf6;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7b16cae..1b4042b 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 _0x19dd=['create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xf7081d,_0x30aef2){var _0x20a813=function(_0x4d6619){while(--_0x4d6619){_0xf7081d['push'](_0xf7081d['shift']());}};_0x20a813(++_0x30aef2);}(_0x19dd,0x1e9));var _0xd19d=function(_0x2db20e,_0x16ba57){_0x2db20e=_0x2db20e-0x0;var _0x126722=_0x19dd[_0x2db20e];return _0x126722;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd19d('0x0'));var timeout=require(_0xd19d('0x1'));var express=require(_0xd19d('0x2'));var router=express[_0xd19d('0x3')]();var fs_extra=require(_0xd19d('0x4'));var auth=require(_0xd19d('0x5'));var interaction=require(_0xd19d('0x6'));var config=require(_0xd19d('0x7'));var controller=require(_0xd19d('0x8'));router[_0xd19d('0x9')]('/',auth[_0xd19d('0xa')](),controller[_0xd19d('0xb')]);router[_0xd19d('0x9')](_0xd19d('0xc'),auth[_0xd19d('0xa')](),controller[_0xd19d('0xd')]);router[_0xd19d('0x9')](_0xd19d('0xe'),auth[_0xd19d('0xa')](),controller[_0xd19d('0xf')]);router[_0xd19d('0x10')]('/',auth[_0xd19d('0xa')](),controller[_0xd19d('0x11')]);router[_0xd19d('0x12')](_0xd19d('0xe'),auth[_0xd19d('0xa')](),controller[_0xd19d('0x13')]);router[_0xd19d('0x14')]('/:id',auth[_0xd19d('0xa')](),controller['destroy']);module[_0xd19d('0x15')]=router; \ No newline at end of file +var _0xa2ea=['get','index','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xa2ea,0x13d));var _0xaa2e=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xa2ea[_0xaaf2e2];return _0x28bc36;};'use strict';var multer=require(_0xaa2e('0x0'));var util=require('util');var path=require(_0xaa2e('0x1'));var timeout=require('connect-timeout');var express=require(_0xaa2e('0x2'));var router=express[_0xaa2e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa2e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaa2e('0x5'));var controller=require(_0xaa2e('0x6'));router[_0xaa2e('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa2e('0x8')]);router[_0xaa2e('0x7')]('/describe',auth[_0xaa2e('0x9')](),controller[_0xaa2e('0xa')]);router[_0xaa2e('0x7')](_0xaa2e('0xb'),auth['isAuthenticated'](),controller[_0xaa2e('0xc')]);router[_0xaa2e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa2e('0xe')](_0xaa2e('0xb'),auth[_0xaa2e('0x9')](),controller['update']);router[_0xaa2e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xaa2e('0x10')]);module[_0xaa2e('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2c31279..dde87ba 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x46734f,_0x16d7de){_0x46734f=_0x46734f-0x0;var _0x2fff67=_0x7a54[_0x46734f];return _0x2fff67;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x5845dc,_0x4c2e50){_0x5845dc=_0x5845dc-0x0;var _0x100a05=_0x7a54[_0x5845dc];return _0x100a05;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index e459f8e..1654e96 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 _0x55e4=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','update','destroy','end','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','then','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x3cc248,_0x443931){var _0x2bf7e1=function(_0x57723e){while(--_0x57723e){_0x3cc248['push'](_0x3cc248['shift']());}};_0x2bf7e1(++_0x443931);}(_0x55e4,0x8b));var _0x455e=function(_0xdd3b2b,_0x543d86){_0xdd3b2b=_0xdd3b2b-0x0;var _0x2a7e7a=_0x55e4[_0xdd3b2b];return _0x2a7e7a;};'use strict';var emlformat=require(_0x455e('0x0'));var rimraf=require(_0x455e('0x1'));var zipdir=require(_0x455e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x455e('0x3'));var moment=require(_0x455e('0x4'));var BPromise=require(_0x455e('0x5'));var Mustache=require(_0x455e('0x6'));var util=require(_0x455e('0x7'));var path=require(_0x455e('0x8'));var sox=require('sox');var csv=require(_0x455e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x455e('0xa'));var _=require(_0x455e('0xb'));var squel=require(_0x455e('0xc'));var crypto=require(_0x455e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x455e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x455e('0xf'));var Redis=require(_0x455e('0x10'));var authService=require(_0x455e('0x11'));var qs=require(_0x455e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x455e('0x13'));var logger=require(_0x455e('0x14'))(_0x455e('0x15'));var utils=require(_0x455e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x455e('0x17'));var db=require(_0x455e('0x18'))['db'];function respondWithStatusCode(_0xed7b35,_0x5a8461){_0x5a8461=_0x5a8461||0xcc;return function(_0x3f0601){if(_0x3f0601){return _0xed7b35[_0x455e('0x19')](_0x5a8461);}return _0xed7b35[_0x455e('0x1a')](_0x5a8461)['end']();};}function respondWithResult(_0x7e5a3,_0x5955bc){_0x5955bc=_0x5955bc||0xc8;return function(_0x22532b){if(_0x22532b){return _0x7e5a3[_0x455e('0x1a')](_0x5955bc)[_0x455e('0x1b')](_0x22532b);}};}function respondWithFilteredResult(_0x28035a,_0x175c6b){return function(_0x47035f){if(_0x47035f){var _0x58a3a7=typeof _0x175c6b['offset']===_0x455e('0x1c')&&typeof _0x175c6b['limit']==='undefined';var _0x19b75b=_0x47035f[_0x455e('0x1d')];var _0x1154a8=_0x58a3a7?0x0:_0x175c6b[_0x455e('0x1e')];var _0xa64ed9=_0x58a3a7?_0x47035f[_0x455e('0x1d')]:_0x175c6b['offset']+_0x175c6b[_0x455e('0x1f')];var _0x2bab6a;if(_0xa64ed9>=_0x19b75b){_0xa64ed9=_0x19b75b;_0x2bab6a=0xc8;}else{_0x2bab6a=0xce;}_0x28035a[_0x455e('0x1a')](_0x2bab6a);return _0x28035a['set']('Content-Range',_0x1154a8+'-'+_0xa64ed9+'/'+_0x19b75b)[_0x455e('0x1b')](_0x47035f);}return null;};}function patchUpdates(_0x6d58f5){return function(_0x25d54d){try{jsonpatch[_0x455e('0x20')](_0x25d54d,_0x6d58f5,!![]);}catch(_0x5c1ae5){return BPromise[_0x455e('0x21')](_0x5c1ae5);}return _0x25d54d[_0x455e('0x22')]();};}function saveUpdates(_0x2c2289,_0x5e26d4){return function(_0x3c8f93){if(_0x3c8f93){return _0x3c8f93[_0x455e('0x23')](_0x2c2289)['then'](function(_0x33ea84){return _0x33ea84;});}return null;};}function removeEntity(_0x3d0628,_0x2ce175){return function(_0x1e136b){if(_0x1e136b){return _0x1e136b[_0x455e('0x24')]()['then'](function(){_0x3d0628[_0x455e('0x1a')](0xcc)[_0x455e('0x25')]();});}};}function handleEntityNotFound(_0xc321ed,_0xf91971){return function(_0x18e708){if(!_0x18e708){_0xc321ed[_0x455e('0x19')](0x194);}return _0x18e708;};}function handleError(_0x10e5f8,_0x3168b6){_0x3168b6=_0x3168b6||0x1f4;return function(_0x22e79d){logger[_0x455e('0x26')](_0x22e79d[_0x455e('0x27')]);if(_0x22e79d['name']){delete _0x22e79d[_0x455e('0x28')];}_0x10e5f8[_0x455e('0x1a')](_0x3168b6)[_0x455e('0x29')](_0x22e79d);};}exports['index']=function(_0x4470ae,_0x1990a9){var _0x5586fe={},_0xb72154={},_0x30eedc={'count':0x0,'rows':[]};var _0x568fa9=_[_0x455e('0x2a')](db[_0x455e('0x2b')][_0x455e('0x2c')],function(_0x1abb4b){return{'name':_0x1abb4b[_0x455e('0x2d')],'type':_0x1abb4b['type'][_0x455e('0x2e')]};});_0xb72154['model']=_[_0x455e('0x2a')](_0x568fa9,'name');_0xb72154[_0x455e('0x2f')]=_[_0x455e('0x30')](_0x4470ae[_0x455e('0x2f')]);_0xb72154[_0x455e('0x31')]=_['intersection'](_0xb72154[_0x455e('0x32')],_0xb72154[_0x455e('0x2f')]);_0x5586fe[_0x455e('0x33')]=_['intersection'](_0xb72154['model'],qs[_0x455e('0x34')](_0x4470ae[_0x455e('0x2f')][_0x455e('0x34')]));_0x5586fe['attributes']=_0x5586fe[_0x455e('0x33')][_0x455e('0x35')]?_0x5586fe[_0x455e('0x33')]:_0xb72154[_0x455e('0x32')];if(!_0x4470ae[_0x455e('0x2f')][_0x455e('0x36')]('nolimit')){_0x5586fe[_0x455e('0x1f')]=qs['limit'](_0x4470ae[_0x455e('0x2f')]['limit']);_0x5586fe[_0x455e('0x1e')]=qs[_0x455e('0x1e')](_0x4470ae[_0x455e('0x2f')][_0x455e('0x1e')]);}_0x5586fe[_0x455e('0x37')]=qs[_0x455e('0x38')](_0x4470ae['query'][_0x455e('0x38')]);_0x5586fe[_0x455e('0x39')]=qs['filters'](_[_0x455e('0x3a')](_0x4470ae[_0x455e('0x2f')],_0xb72154['filters']),_0x568fa9);if(_0x4470ae[_0x455e('0x2f')]['filter']){_0x5586fe[_0x455e('0x39')]=_[_0x455e('0x3b')](_0x5586fe[_0x455e('0x39')],{'$or':_[_0x455e('0x2a')](_0x568fa9,function(_0x30c6bb){if(_0x30c6bb['type']!=='VIRTUAL'){var _0x1005b2={};_0x1005b2[_0x30c6bb['name']]={'$like':'%'+_0x4470ae[_0x455e('0x2f')][_0x455e('0x3c')]+'%'};return _0x1005b2;}})});}_0x5586fe=_[_0x455e('0x3b')]({},_0x5586fe,_0x4470ae['options']);var _0x8a4ef1={'where':_0x5586fe[_0x455e('0x39')]};return db[_0x455e('0x2b')][_0x455e('0x1d')](_0x8a4ef1)[_0x455e('0x3d')](function(_0xbea10b){_0x30eedc[_0x455e('0x1d')]=_0xbea10b;if(_0x4470ae[_0x455e('0x2f')][_0x455e('0x3e')]){_0x5586fe['include']=[{'all':!![]}];}return db[_0x455e('0x2b')][_0x455e('0x3f')](_0x5586fe);})[_0x455e('0x3d')](function(_0x206a94){_0x30eedc[_0x455e('0x40')]=_0x206a94;return _0x30eedc;})['then'](respondWithFilteredResult(_0x1990a9,_0x5586fe))[_0x455e('0x41')](handleError(_0x1990a9,null));};exports[_0x455e('0x42')]=function(_0x2eae8b,_0x31833c){var _0x4e6c3a={'raw':!![],'where':{'id':_0x2eae8b[_0x455e('0x43')]['id']}},_0x317f1b={};_0x317f1b[_0x455e('0x32')]=_[_0x455e('0x30')](db['JscriptyQuestionReport'][_0x455e('0x2c')]);_0x317f1b['query']=_[_0x455e('0x30')](_0x2eae8b[_0x455e('0x2f')]);_0x317f1b[_0x455e('0x31')]=_[_0x455e('0x44')](_0x317f1b[_0x455e('0x32')],_0x317f1b[_0x455e('0x2f')]);_0x4e6c3a['attributes']=_['intersection'](_0x317f1b[_0x455e('0x32')],qs[_0x455e('0x34')](_0x2eae8b[_0x455e('0x2f')][_0x455e('0x34')]));_0x4e6c3a[_0x455e('0x33')]=_0x4e6c3a[_0x455e('0x33')][_0x455e('0x35')]?_0x4e6c3a[_0x455e('0x33')]:_0x317f1b[_0x455e('0x32')];if(_0x2eae8b[_0x455e('0x2f')]['includeAll']){_0x4e6c3a[_0x455e('0x45')]=[{'all':!![]}];}_0x4e6c3a=_['merge']({},_0x4e6c3a,_0x2eae8b[_0x455e('0x46')]);return db[_0x455e('0x2b')][_0x455e('0x47')](_0x4e6c3a)[_0x455e('0x3d')](handleEntityNotFound(_0x31833c,null))['then'](respondWithResult(_0x31833c,null))[_0x455e('0x41')](handleError(_0x31833c,null));};exports[_0x455e('0x48')]=function(_0x9cf26b,_0x1e1ffd){return db[_0x455e('0x2b')][_0x455e('0x48')](_0x9cf26b['body'],{})[_0x455e('0x3d')](respondWithResult(_0x1e1ffd,0xc9))['catch'](handleError(_0x1e1ffd,null));};exports[_0x455e('0x23')]=function(_0x2b5e2c,_0xb1a887){if(_0x2b5e2c[_0x455e('0x49')]['id']){delete _0x2b5e2c[_0x455e('0x49')]['id'];}return db[_0x455e('0x2b')][_0x455e('0x47')]({'where':{'id':_0x2b5e2c['params']['id']}})['then'](handleEntityNotFound(_0xb1a887,null))['then'](saveUpdates(_0x2b5e2c[_0x455e('0x49')],null))[_0x455e('0x3d')](respondWithResult(_0xb1a887,null))[_0x455e('0x41')](handleError(_0xb1a887,null));};exports[_0x455e('0x24')]=function(_0x1d84f2,_0x2945c2){return db['JscriptyQuestionReport'][_0x455e('0x47')]({'where':{'id':_0x1d84f2[_0x455e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2945c2,null))[_0x455e('0x3d')](removeEntity(_0x2945c2,null))[_0x455e('0x41')](handleError(_0x2945c2,null));};exports[_0x455e('0x4a')]=function(_0x12779c,_0x210847){return db['JscriptyQuestionReport'][_0x455e('0x4a')]()[_0x455e('0x3d')](respondWithResult(_0x210847,null))[_0x455e('0x41')](handleError(_0x210847,null));}; \ No newline at end of file +var _0x7ec8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','merge','where','type','options','JscriptyQuestionReport','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1ca7a9,_0x399eee){var _0xda35e1=function(_0x2fcf4e){while(--_0x2fcf4e){_0x1ca7a9['push'](_0x1ca7a9['shift']());}};_0xda35e1(++_0x399eee);}(_0x7ec8,0x1ab));var _0x87ec=function(_0x1e9df6,_0x30bc4f){_0x1e9df6=_0x1e9df6-0x0;var _0x4290a4=_0x7ec8[_0x1e9df6];return _0x4290a4;};'use strict';var emlformat=require(_0x87ec('0x0'));var rimraf=require(_0x87ec('0x1'));var zipdir=require(_0x87ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87ec('0x3'));var moment=require(_0x87ec('0x4'));var BPromise=require(_0x87ec('0x5'));var Mustache=require('mustache');var util=require(_0x87ec('0x6'));var path=require(_0x87ec('0x7'));var sox=require(_0x87ec('0x8'));var csv=require(_0x87ec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87ec('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x87ec('0xb'));var jsforce=require(_0x87ec('0xc'));var deskjs=require(_0x87ec('0xd'));var toCsv=require(_0x87ec('0x9'));var querystring=require(_0x87ec('0xe'));var Papa=require(_0x87ec('0xf'));var Redis=require(_0x87ec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87ec('0x11'));var as=require(_0x87ec('0x12'));var hardwareService=require(_0x87ec('0x13'));var logger=require('../../config/logger')(_0x87ec('0x14'));var utils=require(_0x87ec('0x15'));var config=require(_0x87ec('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x87ec('0x17'))['db'];function respondWithStatusCode(_0x1436f5,_0x47ee2b){_0x47ee2b=_0x47ee2b||0xcc;return function(_0x1da015){if(_0x1da015){return _0x1436f5['sendStatus'](_0x47ee2b);}return _0x1436f5[_0x87ec('0x18')](_0x47ee2b)[_0x87ec('0x19')]();};}function respondWithResult(_0x101227,_0x4f1719){_0x4f1719=_0x4f1719||0xc8;return function(_0x3c1563){if(_0x3c1563){return _0x101227[_0x87ec('0x18')](_0x4f1719)['json'](_0x3c1563);}};}function respondWithFilteredResult(_0x54638c,_0x568e60){return function(_0x419c06){if(_0x419c06){var _0x47cd4b=typeof _0x568e60[_0x87ec('0x1a')]===_0x87ec('0x1b')&&typeof _0x568e60[_0x87ec('0x1c')]===_0x87ec('0x1b');var _0x20e276=_0x419c06['count'];var _0x2cd8b4=_0x47cd4b?0x0:_0x568e60[_0x87ec('0x1a')];var _0x2b467f=_0x47cd4b?_0x419c06[_0x87ec('0x1d')]:_0x568e60[_0x87ec('0x1a')]+_0x568e60[_0x87ec('0x1c')];var _0x4e4e07;if(_0x2b467f>=_0x20e276){_0x2b467f=_0x20e276;_0x4e4e07=0xc8;}else{_0x4e4e07=0xce;}_0x54638c['status'](_0x4e4e07);return _0x54638c[_0x87ec('0x1e')](_0x87ec('0x1f'),_0x2cd8b4+'-'+_0x2b467f+'/'+_0x20e276)[_0x87ec('0x20')](_0x419c06);}return null;};}function patchUpdates(_0x3c4776){return function(_0x1fa32c){try{jsonpatch[_0x87ec('0x21')](_0x1fa32c,_0x3c4776,!![]);}catch(_0x4de6fa){return BPromise[_0x87ec('0x22')](_0x4de6fa);}return _0x1fa32c[_0x87ec('0x23')]();};}function saveUpdates(_0x598b8f,_0x372d70){return function(_0x5773db){if(_0x5773db){return _0x5773db[_0x87ec('0x24')](_0x598b8f)['then'](function(_0x5cdeb5){return _0x5cdeb5;});}return null;};}function removeEntity(_0x18135c,_0x36dfc5){return function(_0x201df6){if(_0x201df6){return _0x201df6[_0x87ec('0x25')]()[_0x87ec('0x26')](function(){_0x18135c['status'](0xcc)[_0x87ec('0x19')]();});}};}function handleEntityNotFound(_0xbf18cf,_0x4c0367){return function(_0x1f2612){if(!_0x1f2612){_0xbf18cf['sendStatus'](0x194);}return _0x1f2612;};}function handleError(_0x25395c,_0x1f7355){_0x1f7355=_0x1f7355||0x1f4;return function(_0x12f736){logger[_0x87ec('0x27')](_0x12f736[_0x87ec('0x28')]);if(_0x12f736[_0x87ec('0x29')]){delete _0x12f736[_0x87ec('0x29')];}_0x25395c[_0x87ec('0x18')](_0x1f7355)[_0x87ec('0x2a')](_0x12f736);};}exports[_0x87ec('0x2b')]=function(_0x1504f9,_0x1091a0){var _0x33b8d3={},_0x5f3afc={},_0x458c3d={'count':0x0,'rows':[]};var _0x59e298=_[_0x87ec('0x2c')](db['JscriptyQuestionReport'][_0x87ec('0x2d')],function(_0x539301){return{'name':_0x539301[_0x87ec('0x2e')],'type':_0x539301['type']['key']};});_0x5f3afc[_0x87ec('0x2f')]=_[_0x87ec('0x2c')](_0x59e298,'name');_0x5f3afc[_0x87ec('0x30')]=_[_0x87ec('0x31')](_0x1504f9[_0x87ec('0x30')]);_0x5f3afc[_0x87ec('0x32')]=_['intersection'](_0x5f3afc['model'],_0x5f3afc['query']);_0x33b8d3[_0x87ec('0x33')]=_[_0x87ec('0x34')](_0x5f3afc[_0x87ec('0x2f')],qs[_0x87ec('0x35')](_0x1504f9[_0x87ec('0x30')][_0x87ec('0x35')]));_0x33b8d3[_0x87ec('0x33')]=_0x33b8d3[_0x87ec('0x33')][_0x87ec('0x36')]?_0x33b8d3[_0x87ec('0x33')]:_0x5f3afc[_0x87ec('0x2f')];if(!_0x1504f9[_0x87ec('0x30')]['hasOwnProperty']('nolimit')){_0x33b8d3[_0x87ec('0x1c')]=qs['limit'](_0x1504f9[_0x87ec('0x30')]['limit']);_0x33b8d3[_0x87ec('0x1a')]=qs[_0x87ec('0x1a')](_0x1504f9[_0x87ec('0x30')][_0x87ec('0x1a')]);}_0x33b8d3[_0x87ec('0x37')]=qs[_0x87ec('0x38')](_0x1504f9[_0x87ec('0x30')][_0x87ec('0x38')]);_0x33b8d3['where']=qs[_0x87ec('0x32')](_[_0x87ec('0x39')](_0x1504f9[_0x87ec('0x30')],_0x5f3afc[_0x87ec('0x32')]),_0x59e298);if(_0x1504f9[_0x87ec('0x30')][_0x87ec('0x3a')]){_0x33b8d3['where']=_[_0x87ec('0x3b')](_0x33b8d3[_0x87ec('0x3c')],{'$or':_[_0x87ec('0x2c')](_0x59e298,function(_0x2e65bf){if(_0x2e65bf[_0x87ec('0x3d')]!=='VIRTUAL'){var _0x35a71e={};_0x35a71e[_0x2e65bf['name']]={'$like':'%'+_0x1504f9[_0x87ec('0x30')]['filter']+'%'};return _0x35a71e;}})});}_0x33b8d3=_[_0x87ec('0x3b')]({},_0x33b8d3,_0x1504f9[_0x87ec('0x3e')]);var _0x3b35d3={'where':_0x33b8d3[_0x87ec('0x3c')]};return db[_0x87ec('0x3f')][_0x87ec('0x1d')](_0x3b35d3)[_0x87ec('0x26')](function(_0x266058){_0x458c3d['count']=_0x266058;if(_0x1504f9[_0x87ec('0x30')]['includeAll']){_0x33b8d3[_0x87ec('0x40')]=[{'all':!![]}];}return db[_0x87ec('0x3f')]['findAll'](_0x33b8d3);})[_0x87ec('0x26')](function(_0x5c109b){_0x458c3d[_0x87ec('0x41')]=_0x5c109b;return _0x458c3d;})[_0x87ec('0x26')](respondWithFilteredResult(_0x1091a0,_0x33b8d3))[_0x87ec('0x42')](handleError(_0x1091a0,null));};exports[_0x87ec('0x43')]=function(_0x1319a3,_0x221986){var _0x1e27d8={'raw':!![],'where':{'id':_0x1319a3[_0x87ec('0x44')]['id']}},_0x1bf45f={};_0x1bf45f['model']=_[_0x87ec('0x31')](db['JscriptyQuestionReport'][_0x87ec('0x2d')]);_0x1bf45f[_0x87ec('0x30')]=_['keys'](_0x1319a3[_0x87ec('0x30')]);_0x1bf45f['filters']=_[_0x87ec('0x34')](_0x1bf45f[_0x87ec('0x2f')],_0x1bf45f[_0x87ec('0x30')]);_0x1e27d8['attributes']=_[_0x87ec('0x34')](_0x1bf45f[_0x87ec('0x2f')],qs['fields'](_0x1319a3['query'][_0x87ec('0x35')]));_0x1e27d8[_0x87ec('0x33')]=_0x1e27d8[_0x87ec('0x33')][_0x87ec('0x36')]?_0x1e27d8[_0x87ec('0x33')]:_0x1bf45f['model'];if(_0x1319a3[_0x87ec('0x30')][_0x87ec('0x45')]){_0x1e27d8[_0x87ec('0x40')]=[{'all':!![]}];}_0x1e27d8=_[_0x87ec('0x3b')]({},_0x1e27d8,_0x1319a3[_0x87ec('0x3e')]);return db[_0x87ec('0x3f')][_0x87ec('0x46')](_0x1e27d8)[_0x87ec('0x26')](handleEntityNotFound(_0x221986,null))[_0x87ec('0x26')](respondWithResult(_0x221986,null))['catch'](handleError(_0x221986,null));};exports[_0x87ec('0x47')]=function(_0x5f3e1f,_0xce8837){return db['JscriptyQuestionReport'][_0x87ec('0x47')](_0x5f3e1f[_0x87ec('0x48')],{})[_0x87ec('0x26')](respondWithResult(_0xce8837,0xc9))[_0x87ec('0x42')](handleError(_0xce8837,null));};exports['update']=function(_0x48b945,_0x10ee4d){if(_0x48b945[_0x87ec('0x48')]['id']){delete _0x48b945[_0x87ec('0x48')]['id'];}return db[_0x87ec('0x3f')][_0x87ec('0x46')]({'where':{'id':_0x48b945[_0x87ec('0x44')]['id']}})[_0x87ec('0x26')](handleEntityNotFound(_0x10ee4d,null))[_0x87ec('0x26')](saveUpdates(_0x48b945[_0x87ec('0x48')],null))[_0x87ec('0x26')](respondWithResult(_0x10ee4d,null))[_0x87ec('0x42')](handleError(_0x10ee4d,null));};exports[_0x87ec('0x25')]=function(_0x5d0a95,_0x527c7e){return db['JscriptyQuestionReport'][_0x87ec('0x46')]({'where':{'id':_0x5d0a95[_0x87ec('0x44')]['id']}})[_0x87ec('0x26')](handleEntityNotFound(_0x527c7e,null))[_0x87ec('0x26')](removeEntity(_0x527c7e,null))[_0x87ec('0x42')](handleError(_0x527c7e,null));};exports[_0x87ec('0x49')]=function(_0x202fcb,_0x35f073){return db[_0x87ec('0x3f')][_0x87ec('0x49')]()[_0x87ec('0x26')](respondWithResult(_0x35f073,null))[_0x87ec('0x42')](handleError(_0x35f073,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 99ffb9e..2f04187 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 _0x1a9d=['exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1a9d,0x1c6));var _0xd1a9=function(_0x125bfa,_0x43e986){_0x125bfa=_0x125bfa-0x0;var _0x29613f=_0x1a9d[_0x125bfa];return _0x29613f;};'use strict';var _=require(_0xd1a9('0x0'));var util=require(_0xd1a9('0x1'));var logger=require(_0xd1a9('0x2'))(_0xd1a9('0x3'));var moment=require(_0xd1a9('0x4'));var BPromise=require(_0xd1a9('0x5'));var rp=require(_0xd1a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1a9('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xd1a9('0x8')]=function(_0x1fdb0a,_0x2a295e){return _0x1fdb0a[_0xd1a9('0x9')](_0xd1a9('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33bd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','report_jscripty_questions','lodash'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x33bd,0x121));var _0xd33b=function(_0x2dcac5,_0x315146){_0x2dcac5=_0x2dcac5-0x0;var _0x6c1b73=_0x33bd[_0x2dcac5];return _0x6c1b73;};'use strict';var _=require(_0xd33b('0x0'));var util=require('util');var logger=require(_0xd33b('0x1'))(_0xd33b('0x2'));var moment=require(_0xd33b('0x3'));var BPromise=require(_0xd33b('0x4'));var rp=require(_0xd33b('0x5'));var fs=require('fs');var path=require(_0xd33b('0x6'));var rimraf=require(_0xd33b('0x7'));var config=require(_0xd33b('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x1382b2,_0xa55f8f){return _0x1382b2['define']('JscriptyQuestionReport',attributes,{'tableName':_0xd33b('0x9'),'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 28ea653..4b2ccd4 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 _0x4894=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4894,0x9f));var _0x4489=function(_0x321759,_0xce9854){_0x321759=_0x321759-0x0;var _0x1ca8a2=_0x4894[_0x321759];return _0x1ca8a2;};'use strict';var _=require('lodash');var util=require(_0x4489('0x0'));var moment=require(_0x4489('0x1'));var BPromise=require('bluebird');var rs=require(_0x4489('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4489('0x3'))['db'];var utils=require(_0x4489('0x4'));var logger=require(_0x4489('0x5'))(_0x4489('0x6'));var config=require(_0x4489('0x7'));var jayson=require(_0x4489('0x8'));var client=jayson['client'][_0x4489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b169,_0x509d7d,_0x2ba89f){return new BPromise(function(_0x54aa19,_0x3d9bd4){return client[_0x4489('0xa')](_0x45b169,_0x2ba89f)[_0x4489('0xb')](function(_0x3949dd){logger[_0x4489('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x509d7d,'request\x20sent');logger[_0x4489('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x509d7d,'request\x20sent',JSON[_0x4489('0xe')](_0x3949dd));if(_0x3949dd[_0x4489('0xf')]){if(_0x3949dd['error']['code']===0x1f4){logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);return _0x3d9bd4(_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);}logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x3949dd[_0x4489('0xf')]['message']);return _0x54aa19(_0x3949dd[_0x4489('0xf')][_0x4489('0x11')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x509d7d,_0x4489('0x12'));_0x54aa19(_0x3949dd['result']['message']);}})[_0x4489('0x13')](function(_0x387314){logger[_0x4489('0xf')](_0x4489('0x10'),_0x509d7d,_0x387314);_0x3d9bd4(_0x387314);});});} \ No newline at end of file +var _0xeefc=['info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0xc6e276,_0x5239dd){var _0x51734=function(_0x36b646){while(--_0x36b646){_0xc6e276['push'](_0xc6e276['shift']());}};_0x51734(++_0x5239dd);}(_0xeefc,0x128));var _0xceef=function(_0x36c7b4,_0x5e3f39){_0x36c7b4=_0x36c7b4-0x0;var _0x43e440=_0xeefc[_0x36c7b4];return _0x43e440;};'use strict';var _=require(_0xceef('0x0'));var util=require(_0xceef('0x1'));var moment=require('moment');var BPromise=require(_0xceef('0x2'));var rs=require(_0xceef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceef('0x4'))['db'];var utils=require(_0xceef('0x5'));var logger=require(_0xceef('0x6'))(_0xceef('0x7'));var config=require(_0xceef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xceef('0x9')][_0xceef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ea23,_0x118ded,_0x5e6abe){return new BPromise(function(_0x1e7833,_0xffe351){return client['request'](_0x33ea23,_0x5e6abe)[_0xceef('0xb')](function(_0x2ab5ab){logger[_0xceef('0xc')](_0xceef('0xd'),_0x118ded,'request\x20sent');logger[_0xceef('0xe')](_0xceef('0xf'),_0x118ded,_0xceef('0x10'),JSON[_0xceef('0x11')](_0x2ab5ab));if(_0x2ab5ab['error']){if(_0x2ab5ab['error']['code']===0x1f4){logger[_0xceef('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x118ded,_0x2ab5ab[_0xceef('0x12')]['message']);return _0xffe351(_0x2ab5ab['error'][_0xceef('0x13')]);}logger[_0xceef('0x12')](_0xceef('0xd'),_0x118ded,_0x2ab5ab[_0xceef('0x12')][_0xceef('0x13')]);return _0x1e7833(_0x2ab5ab['error'][_0xceef('0x13')]);}else{logger['info'](_0xceef('0xd'),_0x118ded,_0xceef('0x10'));_0x1e7833(_0x2ab5ab[_0xceef('0x14')][_0xceef('0x13')]);}})[_0xceef('0x15')](function(_0x40db98){logger[_0xceef('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x118ded,_0x40db98);_0xffe351(_0x40db98);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2ee1fc5..fac9177 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 _0xda96=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','/:id/questions','getQuestions','post','put','update','destroy'];(function(_0x281120,_0x407437){var _0x288731=function(_0x3da371){while(--_0x3da371){_0x281120['push'](_0x281120['shift']());}};_0x288731(++_0x407437);}(_0xda96,0x73));var _0x6da9=function(_0x5664fd,_0x58f991){_0x5664fd=_0x5664fd-0x0;var _0x95a400=_0xda96[_0x5664fd];return _0x95a400;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6da9('0x0'));var timeout=require(_0x6da9('0x1'));var express=require(_0x6da9('0x2'));var router=express[_0x6da9('0x3')]();var fs_extra=require(_0x6da9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6da9('0x5'));var config=require('../../config/environment');var controller=require(_0x6da9('0x6'));router[_0x6da9('0x7')]('/',auth['isAuthenticated'](),controller[_0x6da9('0x8')]);router[_0x6da9('0x7')](_0x6da9('0x9'),auth[_0x6da9('0xa')](),controller['describe']);router['get'](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller['show']);router[_0x6da9('0x7')](_0x6da9('0xc'),auth[_0x6da9('0xa')](),controller[_0x6da9('0xd')]);router[_0x6da9('0xe')]('/',auth[_0x6da9('0xa')](),controller['create']);router[_0x6da9('0xf')](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller[_0x6da9('0x10')]);router['delete'](_0x6da9('0xb'),auth[_0x6da9('0xa')](),controller[_0x6da9('0x11')]);module[_0x6da9('0x12')]=router; \ No newline at end of file +var _0x8909=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','index','/describe','describe','get','/:id','show','/:id/questions','put','isAuthenticated','update','delete','destroy','exports'];(function(_0x1da00e,_0x3bca10){var _0x53a4a3=function(_0xa5b791){while(--_0xa5b791){_0x1da00e['push'](_0x1da00e['shift']());}};_0x53a4a3(++_0x3bca10);}(_0x8909,0xcf));var _0x9890=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x8909[_0x7ad123];return _0x37d073;};'use strict';var multer=require(_0x9890('0x0'));var util=require(_0x9890('0x1'));var path=require(_0x9890('0x2'));var timeout=require(_0x9890('0x3'));var express=require(_0x9890('0x4'));var router=express[_0x9890('0x5')]();var fs_extra=require(_0x9890('0x6'));var auth=require(_0x9890('0x7'));var interaction=require(_0x9890('0x8'));var config=require('../../config/environment');var controller=require(_0x9890('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9890('0xa')]);router['get'](_0x9890('0xb'),auth['isAuthenticated'](),controller[_0x9890('0xc')]);router[_0x9890('0xd')](_0x9890('0xe'),auth['isAuthenticated'](),controller[_0x9890('0xf')]);router[_0x9890('0xd')](_0x9890('0x10'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9890('0x11')]('/:id',auth[_0x9890('0x12')](),controller[_0x9890('0x13')]);router[_0x9890('0x14')]('/:id',auth[_0x9890('0x12')](),controller[_0x9890('0x15')]);module[_0x9890('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index aaa2e0c..c9cd46e 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 _0xebde=['sequelize','DATE','setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x22a223,_0x4ecc6d){var _0xd8148d=function(_0xe0138d){while(--_0xe0138d){_0x22a223['push'](_0x22a223['shift']());}};_0xd8148d(++_0x4ecc6d);}(_0xebde,0x92));var _0xeebd=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xebde[_0x4ef734];return _0x33a7cb;};'use strict';var moment=require(_0xeebd('0x0'));var Sequelize=require(_0xeebd('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xeebd('0x2')],'set':function(_0x248bed){this['setDataValue']('starttime',_0x248bed);this[_0xeebd('0x3')]('endtime',moment()['format'](_0xeebd('0x4')));}},'endtime':{'type':Sequelize[_0xeebd('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xeebd('0x5')]},'queue':{'type':Sequelize[_0xeebd('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xeebd('0x5')]},'completed':{'type':Sequelize[_0xeebd('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0b2b=['DATE','setDataValue','endtime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x27bd74,_0x4a9313){var _0x2f9fc1=function(_0xbe9a47){while(--_0xbe9a47){_0x27bd74['push'](_0x27bd74['shift']());}};_0x2f9fc1(++_0x4a9313);}(_0x0b2b,0xb5));var _0xb0b2=function(_0x2a3505,_0x460caa){_0x2a3505=_0x2a3505-0x0;var _0x38f01c=_0x0b2b[_0x2a3505];return _0x38f01c;};'use strict';var moment=require(_0xb0b2('0x0'));var Sequelize=require(_0xb0b2('0x1'));module[_0xb0b2('0x2')]={'starttime':{'type':Sequelize[_0xb0b2('0x3')],'set':function(_0x3ff5b7){this[_0xb0b2('0x4')]('starttime',_0x3ff5b7);this[_0xb0b2('0x4')](_0xb0b2('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb0b2('0x6')]},'projectname':{'type':Sequelize[_0xb0b2('0x6')]},'queue':{'type':Sequelize[_0xb0b2('0x6')]},'uniqueid':{'type':Sequelize[_0xb0b2('0x6')]},'calleridname':{'type':Sequelize[_0xb0b2('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xb0b2('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 a1b9706..8455d49 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 _0x68f4=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','create','body','find','describe','getQuestions','filter','JscriptyQuestionReport','findAll','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x597fc6,_0x32f069){var _0x121bba=function(_0x8da8e2){while(--_0x8da8e2){_0x597fc6['push'](_0x597fc6['shift']());}};_0x121bba(++_0x32f069);}(_0x68f4,0x87));var _0x468f=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x68f4[_0x5951e8];return _0x20a1f5;};'use strict';var emlformat=require(_0x468f('0x0'));var rimraf=require(_0x468f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x468f('0x2'));var rp=require(_0x468f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x468f('0x4'));var util=require(_0x468f('0x5'));var path=require(_0x468f('0x6'));var sox=require(_0x468f('0x7'));var csv=require(_0x468f('0x8'));var ejs=require(_0x468f('0x9'));var fs=require('fs');var fs_extra=require(_0x468f('0xa'));var _=require(_0x468f('0xb'));var squel=require(_0x468f('0xc'));var crypto=require(_0x468f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x468f('0x8'));var querystring=require(_0x468f('0xe'));var Papa=require('papaparse');var Redis=require(_0x468f('0xf'));var authService=require(_0x468f('0x10'));var qs=require(_0x468f('0x11'));var as=require(_0x468f('0x12'));var hardwareService=require(_0x468f('0x13'));var logger=require('../../config/logger')(_0x468f('0x14'));var utils=require(_0x468f('0x15'));var config=require(_0x468f('0x16'));var licenseUtil=require(_0x468f('0x17'));var db=require(_0x468f('0x18'))['db'];function respondWithStatusCode(_0x295b64,_0x99afe7){_0x99afe7=_0x99afe7||0xcc;return function(_0x52acea){if(_0x52acea){return _0x295b64[_0x468f('0x19')](_0x99afe7);}return _0x295b64[_0x468f('0x1a')](_0x99afe7)[_0x468f('0x1b')]();};}function respondWithResult(_0xe5e9bf,_0x3ceedd){_0x3ceedd=_0x3ceedd||0xc8;return function(_0x104dbf){if(_0x104dbf){return _0xe5e9bf[_0x468f('0x1a')](_0x3ceedd)[_0x468f('0x1c')](_0x104dbf);}};}function respondWithFilteredResult(_0x3e0557,_0x85b846){return function(_0x3d5d90){if(_0x3d5d90){var _0x38b354=typeof _0x85b846[_0x468f('0x1d')]===_0x468f('0x1e')&&typeof _0x85b846[_0x468f('0x1f')]===_0x468f('0x1e');var _0x112589=_0x3d5d90[_0x468f('0x20')];var _0x43d6ff=_0x38b354?0x0:_0x85b846[_0x468f('0x1d')];var _0x5693bc=_0x38b354?_0x3d5d90[_0x468f('0x20')]:_0x85b846[_0x468f('0x1d')]+_0x85b846[_0x468f('0x1f')];var _0x17cf00;if(_0x5693bc>=_0x112589){_0x5693bc=_0x112589;_0x17cf00=0xc8;}else{_0x17cf00=0xce;}_0x3e0557[_0x468f('0x1a')](_0x17cf00);return _0x3e0557[_0x468f('0x21')](_0x468f('0x22'),_0x43d6ff+'-'+_0x5693bc+'/'+_0x112589)[_0x468f('0x1c')](_0x3d5d90);}return null;};}function patchUpdates(_0x9fbc23){return function(_0x3a8e72){try{jsonpatch[_0x468f('0x23')](_0x3a8e72,_0x9fbc23,!![]);}catch(_0x2112e4){return BPromise['reject'](_0x2112e4);}return _0x3a8e72['save']();};}function saveUpdates(_0x96f3e9,_0x5d3c22){return function(_0x4ac7c0){if(_0x4ac7c0){return _0x4ac7c0[_0x468f('0x24')](_0x96f3e9)[_0x468f('0x25')](function(_0x1d8f35){return _0x1d8f35;});}return null;};}function removeEntity(_0x4f6795,_0x300d23){return function(_0x451751){if(_0x451751){return _0x451751[_0x468f('0x26')]()[_0x468f('0x25')](function(){_0x4f6795[_0x468f('0x1a')](0xcc)[_0x468f('0x1b')]();});}};}function handleEntityNotFound(_0x5c02b9,_0x39d90a){return function(_0x22ccd4){if(!_0x22ccd4){_0x5c02b9['sendStatus'](0x194);}return _0x22ccd4;};}function handleError(_0x26db10,_0x5b50f3){_0x5b50f3=_0x5b50f3||0x1f4;return function(_0x149c9d){logger[_0x468f('0x27')](_0x149c9d[_0x468f('0x28')]);if(_0x149c9d[_0x468f('0x29')]){delete _0x149c9d['name'];}_0x26db10[_0x468f('0x1a')](_0x5b50f3)[_0x468f('0x2a')](_0x149c9d);};}exports[_0x468f('0x2b')]=function(_0x1b0955,_0x1d4213){var _0xc67b28={},_0x4a76d4={},_0x40260e={'count':0x0,'rows':[]};var _0x19f3c9=_['map'](db[_0x468f('0x2c')][_0x468f('0x2d')],function(_0x42295b){return{'name':_0x42295b['fieldName'],'type':_0x42295b[_0x468f('0x2e')][_0x468f('0x2f')]};});_0x4a76d4['model']=_[_0x468f('0x30')](_0x19f3c9,_0x468f('0x29'));_0x4a76d4[_0x468f('0x31')]=_[_0x468f('0x32')](_0x1b0955[_0x468f('0x31')]);_0x4a76d4[_0x468f('0x33')]=_[_0x468f('0x34')](_0x4a76d4[_0x468f('0x35')],_0x4a76d4[_0x468f('0x31')]);_0xc67b28[_0x468f('0x36')]=_['intersection'](_0x4a76d4[_0x468f('0x35')],qs[_0x468f('0x37')](_0x1b0955[_0x468f('0x31')][_0x468f('0x37')]));_0xc67b28['attributes']=_0xc67b28[_0x468f('0x36')]['length']?_0xc67b28['attributes']:_0x4a76d4['model'];if(!_0x1b0955[_0x468f('0x31')][_0x468f('0x38')](_0x468f('0x39'))){_0xc67b28['limit']=qs[_0x468f('0x1f')](_0x1b0955[_0x468f('0x31')][_0x468f('0x1f')]);_0xc67b28['offset']=qs[_0x468f('0x1d')](_0x1b0955[_0x468f('0x31')]['offset']);}_0xc67b28[_0x468f('0x3a')]=qs['sort'](_0x1b0955[_0x468f('0x31')][_0x468f('0x3b')]);_0xc67b28[_0x468f('0x3c')]=qs['filters'](_[_0x468f('0x3d')](_0x1b0955[_0x468f('0x31')],_0x4a76d4[_0x468f('0x33')]),_0x19f3c9);if(_0x1b0955[_0x468f('0x31')]['filter']){_0xc67b28['where']=_['merge'](_0xc67b28['where'],{'$or':_[_0x468f('0x30')](_0x19f3c9,function(_0x43ba0d){if(_0x43ba0d[_0x468f('0x2e')]!==_0x468f('0x3e')){var _0x11787={};_0x11787[_0x43ba0d[_0x468f('0x29')]]={'$like':'%'+_0x1b0955['query']['filter']+'%'};return _0x11787;}})});}_0xc67b28=_[_0x468f('0x3f')]({},_0xc67b28,_0x1b0955[_0x468f('0x40')]);var _0x1e876b={'where':_0xc67b28[_0x468f('0x3c')]};return db[_0x468f('0x2c')][_0x468f('0x20')](_0x1e876b)['then'](function(_0x369b4c){_0x40260e[_0x468f('0x20')]=_0x369b4c;if(_0x1b0955[_0x468f('0x31')][_0x468f('0x41')]){_0xc67b28[_0x468f('0x42')]=[{'all':!![]}];}return db[_0x468f('0x2c')]['findAll'](_0xc67b28);})['then'](function(_0x1f6acb){_0x40260e[_0x468f('0x43')]=_0x1f6acb;return _0x40260e;})['then'](respondWithFilteredResult(_0x1d4213,_0xc67b28))[_0x468f('0x44')](handleError(_0x1d4213,null));};exports[_0x468f('0x45')]=function(_0x1ec15f,_0x34f10c){var _0x391fd9={'raw':!![],'where':{'id':_0x1ec15f[_0x468f('0x46')]['id']}},_0x5a3b24={};_0x5a3b24[_0x468f('0x35')]=_[_0x468f('0x32')](db[_0x468f('0x2c')][_0x468f('0x2d')]);_0x5a3b24['query']=_['keys'](_0x1ec15f[_0x468f('0x31')]);_0x5a3b24[_0x468f('0x33')]=_['intersection'](_0x5a3b24[_0x468f('0x35')],_0x5a3b24['query']);_0x391fd9[_0x468f('0x36')]=_['intersection'](_0x5a3b24['model'],qs[_0x468f('0x37')](_0x1ec15f[_0x468f('0x31')][_0x468f('0x37')]));_0x391fd9[_0x468f('0x36')]=_0x391fd9[_0x468f('0x36')][_0x468f('0x47')]?_0x391fd9[_0x468f('0x36')]:_0x5a3b24[_0x468f('0x35')];if(_0x1ec15f['query'][_0x468f('0x41')]){_0x391fd9['include']=[{'all':!![]}];}_0x391fd9=_['merge']({},_0x391fd9,_0x1ec15f['options']);return db[_0x468f('0x2c')]['find'](_0x391fd9)['then'](handleEntityNotFound(_0x34f10c,null))[_0x468f('0x25')](respondWithResult(_0x34f10c,null))['catch'](handleError(_0x34f10c,null));};exports[_0x468f('0x48')]=function(_0x5aa8d9,_0x14bcd8){return db[_0x468f('0x2c')]['create'](_0x5aa8d9[_0x468f('0x49')],{})[_0x468f('0x25')](respondWithResult(_0x14bcd8,0xc9))[_0x468f('0x44')](handleError(_0x14bcd8,null));};exports[_0x468f('0x24')]=function(_0x2922e2,_0x57f4c8){if(_0x2922e2['body']['id']){delete _0x2922e2[_0x468f('0x49')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x2922e2[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x57f4c8,null))['then'](saveUpdates(_0x2922e2[_0x468f('0x49')],null))['then'](respondWithResult(_0x57f4c8,null))[_0x468f('0x44')](handleError(_0x57f4c8,null));};exports[_0x468f('0x26')]=function(_0x51e5a4,_0x3308e5){return db[_0x468f('0x2c')][_0x468f('0x4a')]({'where':{'id':_0x51e5a4[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x3308e5,null))['then'](removeEntity(_0x3308e5,null))[_0x468f('0x44')](handleError(_0x3308e5,null));};exports[_0x468f('0x4b')]=function(_0x213a2e,_0x819669){return db['JscriptySessionReport'][_0x468f('0x4b')]()['then'](respondWithResult(_0x819669,null))[_0x468f('0x44')](handleError(_0x819669,null));};exports[_0x468f('0x4c')]=function(_0x1b45e9,_0x60e4ec,_0x394f6d){var _0x27b485={'raw':!![],'where':{}};var _0xa655c2={};var _0x53dc96={'count':0x0,'rows':[]};return db[_0x468f('0x2c')]['findOne']({'where':{'id':_0x1b45e9[_0x468f('0x46')]['id']}})[_0x468f('0x25')](handleEntityNotFound(_0x60e4ec,null))[_0x468f('0x25')](function(_0x1d08af){if(_0x1d08af){_0xa655c2[_0x468f('0x35')]=_[_0x468f('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0xa655c2[_0x468f('0x31')]=_[_0x468f('0x32')](_0x1b45e9['query']);_0xa655c2['filters']=_[_0x468f('0x34')](_0xa655c2[_0x468f('0x35')],_0xa655c2[_0x468f('0x31')]);_0x27b485[_0x468f('0x36')]=_[_0x468f('0x34')](_0xa655c2['model'],qs['fields'](_0x1b45e9['query'][_0x468f('0x37')]));_0x27b485[_0x468f('0x36')]=_0x27b485[_0x468f('0x36')][_0x468f('0x47')]?_0x27b485[_0x468f('0x36')]:_0xa655c2[_0x468f('0x35')];if(!_0x1b45e9[_0x468f('0x31')][_0x468f('0x38')]('nolimit')){_0x27b485[_0x468f('0x1f')]=qs[_0x468f('0x1f')](_0x1b45e9[_0x468f('0x31')]['limit']);_0x27b485[_0x468f('0x1d')]=qs['offset'](_0x1b45e9[_0x468f('0x31')][_0x468f('0x1d')]);}_0x27b485['order']=qs[_0x468f('0x3b')](_0x1b45e9[_0x468f('0x31')][_0x468f('0x3b')]);_0x27b485[_0x468f('0x3c')]=qs['filters'](_['pick'](_0x1b45e9['query'],_0xa655c2['filters']));_0x27b485['where']['SessionId']=_0x1d08af['id'];if(_0x1b45e9['query'][_0x468f('0x4d')]){_0x27b485[_0x468f('0x3c')]=_['merge'](_0x27b485[_0x468f('0x3c')],{'$or':_['map'](_0x27b485[_0x468f('0x36')],function(_0x31b370){var _0x311558={};_0x311558[_0x31b370]={'$like':'%'+_0x1b45e9[_0x468f('0x31')][_0x468f('0x4d')]+'%'};return _0x311558;})});}_0x27b485=_[_0x468f('0x3f')]({},_0x27b485,_0x1b45e9['options']);return db['JscriptyQuestionReport'][_0x468f('0x20')]({'where':_0x27b485['where']})[_0x468f('0x25')](function(_0x8bc37d){_0x53dc96[_0x468f('0x20')]=_0x8bc37d;if(_0x1b45e9[_0x468f('0x31')]['includeAll']){_0x27b485[_0x468f('0x42')]=[{'all':!![]}];}return db[_0x468f('0x4e')][_0x468f('0x4f')](_0x27b485);})[_0x468f('0x25')](function(_0x155890){_0x53dc96['rows']=_0x155890;return _0x53dc96;});}})[_0x468f('0x25')](respondWithFilteredResult(_0x60e4ec,_0x27b485))['catch'](handleError(_0x60e4ec,null));}; \ No newline at end of file +var _0x8093=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','keys','rawAttributes','length','find','create','body','params','describe','findOne','JscriptyQuestionReport','hasOwnProperty','order','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel'];(function(_0x5d880c,_0xf031dc){var _0xec7eff=function(_0x2d9515){while(--_0x2d9515){_0x5d880c['push'](_0x5d880c['shift']());}};_0xec7eff(++_0xf031dc);}(_0x8093,0x8f));var _0x3809=function(_0x50e51a,_0x39e949){_0x50e51a=_0x50e51a-0x0;var _0xe02402=_0x8093[_0x50e51a];return _0xe02402;};'use strict';var emlformat=require(_0x3809('0x0'));var rimraf=require(_0x3809('0x1'));var zipdir=require(_0x3809('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3809('0x3'));var moment=require(_0x3809('0x4'));var BPromise=require(_0x3809('0x5'));var Mustache=require(_0x3809('0x6'));var util=require(_0x3809('0x7'));var path=require('path');var sox=require(_0x3809('0x8'));var csv=require(_0x3809('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3809('0xa'));var _=require(_0x3809('0xb'));var squel=require(_0x3809('0xc'));var crypto=require(_0x3809('0xd'));var jsforce=require(_0x3809('0xe'));var deskjs=require(_0x3809('0xf'));var toCsv=require(_0x3809('0x9'));var querystring=require(_0x3809('0x10'));var Papa=require(_0x3809('0x11'));var Redis=require(_0x3809('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3809('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3809('0x14'));var licenseUtil=require(_0x3809('0x15'));var db=require(_0x3809('0x16'))['db'];function respondWithStatusCode(_0x444960,_0x47dff6){_0x47dff6=_0x47dff6||0xcc;return function(_0x3c0ecf){if(_0x3c0ecf){return _0x444960['sendStatus'](_0x47dff6);}return _0x444960[_0x3809('0x17')](_0x47dff6)[_0x3809('0x18')]();};}function respondWithResult(_0xa0ebb7,_0x109d29){_0x109d29=_0x109d29||0xc8;return function(_0x53a653){if(_0x53a653){return _0xa0ebb7[_0x3809('0x17')](_0x109d29)['json'](_0x53a653);}};}function respondWithFilteredResult(_0x4c86be,_0x31d70f){return function(_0x7325b1){if(_0x7325b1){var _0x5ebb4a=typeof _0x31d70f[_0x3809('0x19')]===_0x3809('0x1a')&&typeof _0x31d70f[_0x3809('0x1b')]===_0x3809('0x1a');var _0x3b847b=_0x7325b1[_0x3809('0x1c')];var _0x19049c=_0x5ebb4a?0x0:_0x31d70f[_0x3809('0x19')];var _0x514cf2=_0x5ebb4a?_0x7325b1['count']:_0x31d70f['offset']+_0x31d70f['limit'];var _0x1c1316;if(_0x514cf2>=_0x3b847b){_0x514cf2=_0x3b847b;_0x1c1316=0xc8;}else{_0x1c1316=0xce;}_0x4c86be[_0x3809('0x17')](_0x1c1316);return _0x4c86be[_0x3809('0x1d')]('Content-Range',_0x19049c+'-'+_0x514cf2+'/'+_0x3b847b)[_0x3809('0x1e')](_0x7325b1);}return null;};}function patchUpdates(_0x462886){return function(_0x1600e9){try{jsonpatch[_0x3809('0x1f')](_0x1600e9,_0x462886,!![]);}catch(_0x58cf5f){return BPromise['reject'](_0x58cf5f);}return _0x1600e9[_0x3809('0x20')]();};}function saveUpdates(_0x33db6c,_0x1cf21f){return function(_0x2a08d7){if(_0x2a08d7){return _0x2a08d7[_0x3809('0x21')](_0x33db6c)[_0x3809('0x22')](function(_0xc43b47){return _0xc43b47;});}return null;};}function removeEntity(_0x2a114e,_0x25946b){return function(_0x108d27){if(_0x108d27){return _0x108d27[_0x3809('0x23')]()[_0x3809('0x22')](function(){_0x2a114e[_0x3809('0x17')](0xcc)[_0x3809('0x18')]();});}};}function handleEntityNotFound(_0x11bfa2,_0x412863){return function(_0x171b84){if(!_0x171b84){_0x11bfa2[_0x3809('0x24')](0x194);}return _0x171b84;};}function handleError(_0x22fa68,_0x6fd1d3){_0x6fd1d3=_0x6fd1d3||0x1f4;return function(_0x520482){logger[_0x3809('0x25')](_0x520482['stack']);if(_0x520482['name']){delete _0x520482[_0x3809('0x26')];}_0x22fa68[_0x3809('0x17')](_0x6fd1d3)[_0x3809('0x27')](_0x520482);};}exports[_0x3809('0x28')]=function(_0x5d7d4d,_0x3e610f){var _0x4472f5={},_0x5dcce1={},_0x5e096d={'count':0x0,'rows':[]};var _0x5f23f2=_[_0x3809('0x29')](db['JscriptySessionReport']['rawAttributes'],function(_0x4db108){return{'name':_0x4db108[_0x3809('0x2a')],'type':_0x4db108[_0x3809('0x2b')][_0x3809('0x2c')]};});_0x5dcce1[_0x3809('0x2d')]=_[_0x3809('0x29')](_0x5f23f2,_0x3809('0x26'));_0x5dcce1[_0x3809('0x2e')]=_['keys'](_0x5d7d4d[_0x3809('0x2e')]);_0x5dcce1[_0x3809('0x2f')]=_[_0x3809('0x30')](_0x5dcce1[_0x3809('0x2d')],_0x5dcce1['query']);_0x4472f5[_0x3809('0x31')]=_['intersection'](_0x5dcce1[_0x3809('0x2d')],qs[_0x3809('0x32')](_0x5d7d4d[_0x3809('0x2e')][_0x3809('0x32')]));_0x4472f5['attributes']=_0x4472f5[_0x3809('0x31')]['length']?_0x4472f5[_0x3809('0x31')]:_0x5dcce1[_0x3809('0x2d')];if(!_0x5d7d4d[_0x3809('0x2e')]['hasOwnProperty'](_0x3809('0x33'))){_0x4472f5[_0x3809('0x1b')]=qs[_0x3809('0x1b')](_0x5d7d4d[_0x3809('0x2e')]['limit']);_0x4472f5['offset']=qs[_0x3809('0x19')](_0x5d7d4d[_0x3809('0x2e')][_0x3809('0x19')]);}_0x4472f5['order']=qs[_0x3809('0x34')](_0x5d7d4d['query'][_0x3809('0x34')]);_0x4472f5[_0x3809('0x35')]=qs[_0x3809('0x2f')](_[_0x3809('0x36')](_0x5d7d4d['query'],_0x5dcce1[_0x3809('0x2f')]),_0x5f23f2);if(_0x5d7d4d[_0x3809('0x2e')]['filter']){_0x4472f5['where']=_[_0x3809('0x37')](_0x4472f5['where'],{'$or':_['map'](_0x5f23f2,function(_0x558491){if(_0x558491[_0x3809('0x2b')]!==_0x3809('0x38')){var _0x3b8cd7={};_0x3b8cd7[_0x558491[_0x3809('0x26')]]={'$like':'%'+_0x5d7d4d[_0x3809('0x2e')][_0x3809('0x39')]+'%'};return _0x3b8cd7;}})});}_0x4472f5=_[_0x3809('0x37')]({},_0x4472f5,_0x5d7d4d[_0x3809('0x3a')]);var _0x5894a0={'where':_0x4472f5[_0x3809('0x35')]};return db[_0x3809('0x3b')][_0x3809('0x1c')](_0x5894a0)[_0x3809('0x22')](function(_0x12cefd){_0x5e096d[_0x3809('0x1c')]=_0x12cefd;if(_0x5d7d4d['query'][_0x3809('0x3c')]){_0x4472f5[_0x3809('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3809('0x3e')](_0x4472f5);})[_0x3809('0x22')](function(_0x5649fa){_0x5e096d[_0x3809('0x3f')]=_0x5649fa;return _0x5e096d;})[_0x3809('0x22')](respondWithFilteredResult(_0x3e610f,_0x4472f5))[_0x3809('0x40')](handleError(_0x3e610f,null));};exports['show']=function(_0x4e3519,_0x5e8786){var _0x5068f8={'raw':!![],'where':{'id':_0x4e3519['params']['id']}},_0x158202={};_0x158202[_0x3809('0x2d')]=_[_0x3809('0x41')](db[_0x3809('0x3b')][_0x3809('0x42')]);_0x158202[_0x3809('0x2e')]=_[_0x3809('0x41')](_0x4e3519['query']);_0x158202[_0x3809('0x2f')]=_[_0x3809('0x30')](_0x158202['model'],_0x158202[_0x3809('0x2e')]);_0x5068f8[_0x3809('0x31')]=_[_0x3809('0x30')](_0x158202[_0x3809('0x2d')],qs[_0x3809('0x32')](_0x4e3519[_0x3809('0x2e')][_0x3809('0x32')]));_0x5068f8[_0x3809('0x31')]=_0x5068f8[_0x3809('0x31')][_0x3809('0x43')]?_0x5068f8[_0x3809('0x31')]:_0x158202[_0x3809('0x2d')];if(_0x4e3519[_0x3809('0x2e')]['includeAll']){_0x5068f8[_0x3809('0x3d')]=[{'all':!![]}];}_0x5068f8=_[_0x3809('0x37')]({},_0x5068f8,_0x4e3519[_0x3809('0x3a')]);return db['JscriptySessionReport'][_0x3809('0x44')](_0x5068f8)['then'](handleEntityNotFound(_0x5e8786,null))[_0x3809('0x22')](respondWithResult(_0x5e8786,null))[_0x3809('0x40')](handleError(_0x5e8786,null));};exports[_0x3809('0x45')]=function(_0x40bf70,_0x2341bf){return db[_0x3809('0x3b')][_0x3809('0x45')](_0x40bf70[_0x3809('0x46')],{})['then'](respondWithResult(_0x2341bf,0xc9))[_0x3809('0x40')](handleError(_0x2341bf,null));};exports[_0x3809('0x21')]=function(_0x33664c,_0xa10454){if(_0x33664c[_0x3809('0x46')]['id']){delete _0x33664c[_0x3809('0x46')]['id'];}return db[_0x3809('0x3b')][_0x3809('0x44')]({'where':{'id':_0x33664c['params']['id']}})[_0x3809('0x22')](handleEntityNotFound(_0xa10454,null))['then'](saveUpdates(_0x33664c[_0x3809('0x46')],null))[_0x3809('0x22')](respondWithResult(_0xa10454,null))[_0x3809('0x40')](handleError(_0xa10454,null));};exports[_0x3809('0x23')]=function(_0x418b52,_0x259432){return db['JscriptySessionReport']['find']({'where':{'id':_0x418b52[_0x3809('0x47')]['id']}})[_0x3809('0x22')](handleEntityNotFound(_0x259432,null))[_0x3809('0x22')](removeEntity(_0x259432,null))['catch'](handleError(_0x259432,null));};exports['describe']=function(_0x4e7898,_0x32d067){return db[_0x3809('0x3b')][_0x3809('0x48')]()[_0x3809('0x22')](respondWithResult(_0x32d067,null))[_0x3809('0x40')](handleError(_0x32d067,null));};exports['getQuestions']=function(_0x211b17,_0x3cb2eb,_0x5f3a76){var _0x30a692={'raw':!![],'where':{}};var _0x33d4ce={};var _0x526001={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3809('0x49')]({'where':{'id':_0x211b17['params']['id']}})[_0x3809('0x22')](handleEntityNotFound(_0x3cb2eb,null))[_0x3809('0x22')](function(_0x178d7a){if(_0x178d7a){_0x33d4ce[_0x3809('0x2d')]=_['keys'](db[_0x3809('0x4a')]['rawAttributes']);_0x33d4ce['query']=_[_0x3809('0x41')](_0x211b17[_0x3809('0x2e')]);_0x33d4ce[_0x3809('0x2f')]=_['intersection'](_0x33d4ce[_0x3809('0x2d')],_0x33d4ce[_0x3809('0x2e')]);_0x30a692[_0x3809('0x31')]=_['intersection'](_0x33d4ce[_0x3809('0x2d')],qs[_0x3809('0x32')](_0x211b17[_0x3809('0x2e')][_0x3809('0x32')]));_0x30a692[_0x3809('0x31')]=_0x30a692[_0x3809('0x31')][_0x3809('0x43')]?_0x30a692[_0x3809('0x31')]:_0x33d4ce[_0x3809('0x2d')];if(!_0x211b17[_0x3809('0x2e')][_0x3809('0x4b')]('nolimit')){_0x30a692[_0x3809('0x1b')]=qs[_0x3809('0x1b')](_0x211b17['query'][_0x3809('0x1b')]);_0x30a692[_0x3809('0x19')]=qs[_0x3809('0x19')](_0x211b17[_0x3809('0x2e')][_0x3809('0x19')]);}_0x30a692[_0x3809('0x4c')]=qs[_0x3809('0x34')](_0x211b17[_0x3809('0x2e')][_0x3809('0x34')]);_0x30a692[_0x3809('0x35')]=qs['filters'](_[_0x3809('0x36')](_0x211b17[_0x3809('0x2e')],_0x33d4ce['filters']));_0x30a692['where'][_0x3809('0x4d')]=_0x178d7a['id'];if(_0x211b17[_0x3809('0x2e')][_0x3809('0x39')]){_0x30a692['where']=_[_0x3809('0x37')](_0x30a692['where'],{'$or':_[_0x3809('0x29')](_0x30a692[_0x3809('0x31')],function(_0x2f9b54){var _0x46266f={};_0x46266f[_0x2f9b54]={'$like':'%'+_0x211b17[_0x3809('0x2e')]['filter']+'%'};return _0x46266f;})});}_0x30a692=_[_0x3809('0x37')]({},_0x30a692,_0x211b17[_0x3809('0x3a')]);return db[_0x3809('0x4a')]['count']({'where':_0x30a692[_0x3809('0x35')]})[_0x3809('0x22')](function(_0x5b39e9){_0x526001[_0x3809('0x1c')]=_0x5b39e9;if(_0x211b17[_0x3809('0x2e')]['includeAll']){_0x30a692[_0x3809('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3809('0x3e')](_0x30a692);})[_0x3809('0x22')](function(_0x13bfff){_0x526001['rows']=_0x13bfff;return _0x526001;});}})[_0x3809('0x22')](respondWithFilteredResult(_0x3cb2eb,_0x30a692))[_0x3809('0x40')](handleError(_0x3cb2eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index dac7d6d..fac513f 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 _0xc949=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x33dc26,_0x27d730){var _0x13b00a=function(_0x4bf546){while(--_0x4bf546){_0x33dc26['push'](_0x33dc26['shift']());}};_0x13b00a(++_0x27d730);}(_0xc949,0x181));var _0x9c94=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc949[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe1a964,_0x5ec09d){_0xe1a964=_0xe1a964-0x0;var _0x3de37b=_0x7fbe[_0xe1a964];return _0x3de37b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'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 740bc2c..2a4a2df 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 _0x5204=['rpc','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5204,0xdf));var _0x4520=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x5204[_0x16938f];return _0x5c66e9;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file +var _0xb016=['error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x323615,_0x513fbf){var _0x1674b9=function(_0x4be53b){while(--_0x4be53b){_0x323615['push'](_0x323615['shift']());}};_0x1674b9(++_0x513fbf);}(_0xb016,0x159));var _0x6b01=function(_0x48567f,_0x1ed40){_0x48567f=_0x48567f-0x0;var _0x51b8c1=_0xb016[_0x48567f];return _0x51b8c1;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4cf232f..f144c05 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 _0xe1e2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','util','path','connect-timeout'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xe1e2,0x11e));var _0x2e1e=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xe1e2[_0x22bf47];return _0x63e280;};'use strict';var multer=require('multer');var util=require(_0x2e1e('0x0'));var path=require(_0x2e1e('0x1'));var timeout=require(_0x2e1e('0x2'));var express=require(_0x2e1e('0x3'));var router=express['Router']();var fs_extra=require(_0x2e1e('0x4'));var auth=require(_0x2e1e('0x5'));var interaction=require(_0x2e1e('0x6'));var config=require(_0x2e1e('0x7'));var controller=require(_0x2e1e('0x8'));router[_0x2e1e('0x9')]('/',controller[_0x2e1e('0xa')]);router[_0x2e1e('0xb')](_0x2e1e('0xc'),auth[_0x2e1e('0xd')](),controller[_0x2e1e('0xe')]);router[_0x2e1e('0x9')]('/download_log_file',auth[_0x2e1e('0xd')](),controller[_0x2e1e('0xf')]);module[_0x2e1e('0x10')]=router; \ No newline at end of file +var _0x27bf=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','update','/download_log_file','isAuthenticated'];(function(_0xcd3fd1,_0x1a2ffc){var _0x29a9d3=function(_0x567df6){while(--_0x567df6){_0xcd3fd1['push'](_0xcd3fd1['shift']());}};_0x29a9d3(++_0x1a2ffc);}(_0x27bf,0x181));var _0xf27b=function(_0x116b40,_0x4f3b6a){_0x116b40=_0x116b40-0x0;var _0x59c8a2=_0x27bf[_0x116b40];return _0x59c8a2;};'use strict';var multer=require(_0xf27b('0x0'));var util=require('util');var path=require(_0xf27b('0x1'));var timeout=require(_0xf27b('0x2'));var express=require(_0xf27b('0x3'));var router=express[_0xf27b('0x4')]();var fs_extra=require(_0xf27b('0x5'));var auth=require(_0xf27b('0x6'));var interaction=require(_0xf27b('0x7'));var config=require('../../config/environment');var controller=require(_0xf27b('0x8'));router[_0xf27b('0x9')]('/',controller[_0xf27b('0xa')]);router[_0xf27b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf27b('0xc')]);router['get'](_0xf27b('0xd'),auth[_0xf27b('0xe')](),controller['downloadLogFile']);module[_0xf27b('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 b97fda7..4260cb5 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 _0x5840=['INTEGER','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5840,0xb5));var _0x0584=function(_0x4474fd,_0x133fa1){_0x4474fd=_0x4474fd-0x0;var _0x26b17c=_0x5840[_0x4474fd];return _0x26b17c;};'use strict';var Sequelize=require(_0x0584('0x0'));module[_0x0584('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x0584('0x2')]},'data2':{'type':Sequelize[_0x0584('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x0584('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5721=['TEXT','sequelize','exports'];(function(_0x3b9e13,_0x3cdc73){var _0x4ea299=function(_0x3dbfc2){while(--_0x3dbfc2){_0x3b9e13['push'](_0x3b9e13['shift']());}};_0x4ea299(++_0x3cdc73);}(_0x5721,0x196));var _0x1572=function(_0x453ef9,_0x32c3be){_0x453ef9=_0x453ef9-0x0;var _0x319c3a=_0x5721[_0x453ef9];return _0x319c3a;};'use strict';var Sequelize=require(_0x1572('0x0'));module[_0x1572('0x1')]={'license':{'type':Sequelize[_0x1572('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 5ab9931..e83ddaf 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 _0xba85=['join','/var','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','params','get','checkLicense','key','demo','license-info.log'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0xba85,0x120));var _0x5ba8=function(_0x344ed6,_0x3eb850){_0x344ed6=_0x344ed6-0x0;var _0xeec74e=_0xba85[_0x344ed6];return _0xeec74e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ba8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ba8('0x1'));var moment=require(_0x5ba8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ba8('0x3'));var util=require('util');var path=require(_0x5ba8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ba8('0x5'));var fs=require('fs');var fs_extra=require(_0x5ba8('0x6'));var _=require(_0x5ba8('0x7'));var squel=require(_0x5ba8('0x8'));var crypto=require(_0x5ba8('0x9'));var jsforce=require(_0x5ba8('0xa'));var deskjs=require(_0x5ba8('0xb'));var toCsv=require(_0x5ba8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ba8('0xd'));var authService=require(_0x5ba8('0xe'));var qs=require(_0x5ba8('0xf'));var as=require(_0x5ba8('0x10'));var hardwareService=require(_0x5ba8('0x11'));var logger=require(_0x5ba8('0x12'))('api');var utils=require(_0x5ba8('0x13'));var config=require(_0x5ba8('0x14'));var licenseUtil=require(_0x5ba8('0x15'));var db=require(_0x5ba8('0x16'))['db'];function respondWithStatusCode(_0x535afb,_0x2d3df9){_0x2d3df9=_0x2d3df9||0xcc;return function(_0xfd4d7a){if(_0xfd4d7a){return _0x535afb[_0x5ba8('0x17')](_0x2d3df9);}return _0x535afb['status'](_0x2d3df9)[_0x5ba8('0x18')]();};}function respondWithResult(_0x4ce0aa,_0x3f4127){_0x3f4127=_0x3f4127||0xc8;return function(_0x566f82){if(_0x566f82){return _0x4ce0aa[_0x5ba8('0x19')](_0x3f4127)[_0x5ba8('0x1a')](_0x566f82);}};}function respondWithFilteredResult(_0x1c11b6,_0x51c87a){return function(_0x3be54a){if(_0x3be54a){var _0x2b8900=typeof _0x51c87a[_0x5ba8('0x1b')]==='undefined'&&typeof _0x51c87a['limit']===_0x5ba8('0x1c');var _0x2d0dc9=_0x3be54a[_0x5ba8('0x1d')];var _0x596edb=_0x2b8900?0x0:_0x51c87a['offset'];var _0x3ac6e0=_0x2b8900?_0x3be54a['count']:_0x51c87a['offset']+_0x51c87a[_0x5ba8('0x1e')];var _0x59841e;if(_0x3ac6e0>=_0x2d0dc9){_0x3ac6e0=_0x2d0dc9;_0x59841e=0xc8;}else{_0x59841e=0xce;}_0x1c11b6[_0x5ba8('0x19')](_0x59841e);return _0x1c11b6[_0x5ba8('0x1f')](_0x5ba8('0x20'),_0x596edb+'-'+_0x3ac6e0+'/'+_0x2d0dc9)[_0x5ba8('0x1a')](_0x3be54a);}return null;};}function patchUpdates(_0x8d0008){return function(_0x13067c){try{jsonpatch[_0x5ba8('0x21')](_0x13067c,_0x8d0008,!![]);}catch(_0x2e54b1){return BPromise[_0x5ba8('0x22')](_0x2e54b1);}return _0x13067c[_0x5ba8('0x23')]();};}function saveUpdates(_0x7ecf13,_0x208248){return function(_0xca0eee){if(_0xca0eee){return _0xca0eee[_0x5ba8('0x24')](_0x7ecf13)[_0x5ba8('0x25')](function(_0x8b9963){return _0x8b9963;});}return null;};}function removeEntity(_0x209be6,_0x266430){return function(_0x1d705f){if(_0x1d705f){return _0x1d705f['destroy']()[_0x5ba8('0x25')](function(){_0x209be6['status'](0xcc)[_0x5ba8('0x18')]();});}};}function handleEntityNotFound(_0x306c38,_0x4314b0){return function(_0x67b0c9){if(!_0x67b0c9){_0x306c38[_0x5ba8('0x17')](0x194);}return _0x67b0c9;};}function handleError(_0x54f37c,_0x4b3e4e){_0x4b3e4e=_0x4b3e4e||0x1f4;return function(_0x3a7fba){logger[_0x5ba8('0x26')](_0x3a7fba[_0x5ba8('0x27')]);if(_0x3a7fba[_0x5ba8('0x28')]){delete _0x3a7fba[_0x5ba8('0x28')];}_0x54f37c[_0x5ba8('0x19')](_0x4b3e4e)[_0x5ba8('0x29')](_0x3a7fba);};}var utilLicense=require('../../config/license/util');exports[_0x5ba8('0x2a')]=function(_0xd622a1,_0x32945a){var _0x490138={'raw':!![],'where':{'id':0x1}},_0x27c85c={};_0x27c85c[_0x5ba8('0x2b')]=_[_0x5ba8('0x2c')](db[_0x5ba8('0x2d')][_0x5ba8('0x2e')]);_0x27c85c['query']=_['keys'](_0xd622a1[_0x5ba8('0x2f')]);_0x27c85c[_0x5ba8('0x30')]=_[_0x5ba8('0x31')](_0x27c85c[_0x5ba8('0x2b')],_0x27c85c[_0x5ba8('0x2f')]);_0x490138[_0x5ba8('0x32')]=_[_0x5ba8('0x31')](_0x27c85c['model'],qs['fields'](_0xd622a1['query'][_0x5ba8('0x33')]));_0x490138[_0x5ba8('0x32')]=_0x490138[_0x5ba8('0x32')][_0x5ba8('0x34')]?_0x490138[_0x5ba8('0x32')]:_0x27c85c['model'];_0x490138=_['merge']({},_0x490138,_0xd622a1[_0x5ba8('0x35')]);return utilLicense['getLicense'](_0x490138)['then'](respondWithResult(_0x32945a,null))[_0x5ba8('0x36')](handleError(_0x32945a,null));};exports['update']=function(_0x583fd8,_0x25b126){if(_0x583fd8[_0x5ba8('0x37')]['id']){delete _0x583fd8['body']['id'];}return db[_0x5ba8('0x2d')]['find']({'where':{'id':_0x583fd8[_0x5ba8('0x38')]['id']}})[_0x5ba8('0x25')](handleEntityNotFound(_0x25b126,null))[_0x5ba8('0x25')](function(_0x449167){var _0x2ce3b9=_0x449167[_0x5ba8('0x39')]({'plain':!![]});return utilLicense[_0x5ba8('0x3a')](_0x2ce3b9,_0x583fd8[_0x5ba8('0x37')][_0x5ba8('0x3b')]);})[_0x5ba8('0x25')](function(_0x2fb9a6){if(!_0x2fb9a6[_0x5ba8('0x3c')]){return saveUpdates(_0x583fd8[_0x5ba8('0x37')],null);}return _0x2fb9a6;})[_0x5ba8('0x25')](respondWithResult(_0x25b126,null))[_0x5ba8('0x36')](handleError(_0x25b126,null));};exports['downloadLogFile']=function(_0x1b9ed9,_0x12b26d){var _0x209241=_0x5ba8('0x3d');var _0x5b4479=path[_0x5ba8('0x3e')](_0x5ba8('0x3f'),_0x5ba8('0x40'),'xcally',_0x209241);_0x12b26d[_0x5ba8('0x41')]('Content-disposition',_0x5ba8('0x42')+_0x209241);_0x12b26d[_0x5ba8('0x1f')](_0x5ba8('0x43'),_0x5ba8('0x44'));_0x12b26d[_0x5ba8('0x45')](_0x5b4479);}; \ No newline at end of file +var _0x9cc2=['update','then','end','stack','name','send','index','License','rawAttributes','query','keys','filters','model','attributes','intersection','fields','length','merge','options','catch','body','params','get','key','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','download','fast-json-patch','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9cc2,0x15d));var _0x29cc=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x9cc2[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29cc('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29cc('0x1'));var Mustache=require(_0x29cc('0x2'));var util=require(_0x29cc('0x3'));var path=require('path');var sox=require(_0x29cc('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29cc('0x5'));var _=require(_0x29cc('0x6'));var squel=require(_0x29cc('0x7'));var crypto=require(_0x29cc('0x8'));var jsforce=require(_0x29cc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x29cc('0xa'));var querystring=require('querystring');var Papa=require(_0x29cc('0xb'));var Redis=require('ioredis');var authService=require(_0x29cc('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x29cc('0xd'));var hardwareService=require(_0x29cc('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x29cc('0xf'));var config=require(_0x29cc('0x10'));var licenseUtil=require(_0x29cc('0x11'));var db=require(_0x29cc('0x12'))['db'];function respondWithStatusCode(_0x4c6944,_0x332175){_0x332175=_0x332175||0xcc;return function(_0x4110e1){if(_0x4110e1){return _0x4c6944[_0x29cc('0x13')](_0x332175);}return _0x4c6944[_0x29cc('0x14')](_0x332175)['end']();};}function respondWithResult(_0x3e57d7,_0x247791){_0x247791=_0x247791||0xc8;return function(_0x120d0c){if(_0x120d0c){return _0x3e57d7[_0x29cc('0x14')](_0x247791)['json'](_0x120d0c);}};}function respondWithFilteredResult(_0x1ed51f,_0x295d6e){return function(_0x260b51){if(_0x260b51){var _0x2c8926=typeof _0x295d6e[_0x29cc('0x15')]===_0x29cc('0x16')&&typeof _0x295d6e[_0x29cc('0x17')]===_0x29cc('0x16');var _0x4df23e=_0x260b51[_0x29cc('0x18')];var _0x5500a4=_0x2c8926?0x0:_0x295d6e[_0x29cc('0x15')];var _0x4002ac=_0x2c8926?_0x260b51[_0x29cc('0x18')]:_0x295d6e[_0x29cc('0x15')]+_0x295d6e[_0x29cc('0x17')];var _0x402fe1;if(_0x4002ac>=_0x4df23e){_0x4002ac=_0x4df23e;_0x402fe1=0xc8;}else{_0x402fe1=0xce;}_0x1ed51f[_0x29cc('0x14')](_0x402fe1);return _0x1ed51f[_0x29cc('0x19')](_0x29cc('0x1a'),_0x5500a4+'-'+_0x4002ac+'/'+_0x4df23e)['json'](_0x260b51);}return null;};}function patchUpdates(_0x396d50){return function(_0x57e3b0){try{jsonpatch[_0x29cc('0x1b')](_0x57e3b0,_0x396d50,!![]);}catch(_0x1d96a6){return BPromise[_0x29cc('0x1c')](_0x1d96a6);}return _0x57e3b0['save']();};}function saveUpdates(_0x579c56,_0x330906){return function(_0x144534){if(_0x144534){return _0x144534[_0x29cc('0x1d')](_0x579c56)['then'](function(_0x1e9d2a){return _0x1e9d2a;});}return null;};}function removeEntity(_0xb11faa,_0x463c89){return function(_0x566080){if(_0x566080){return _0x566080['destroy']()[_0x29cc('0x1e')](function(){_0xb11faa['status'](0xcc)[_0x29cc('0x1f')]();});}};}function handleEntityNotFound(_0x16a160,_0x1a63d0){return function(_0x5b2f04){if(!_0x5b2f04){_0x16a160['sendStatus'](0x194);}return _0x5b2f04;};}function handleError(_0x3b3957,_0x151b73){_0x151b73=_0x151b73||0x1f4;return function(_0x4a59dc){logger['error'](_0x4a59dc[_0x29cc('0x20')]);if(_0x4a59dc[_0x29cc('0x21')]){delete _0x4a59dc['name'];}_0x3b3957[_0x29cc('0x14')](_0x151b73)[_0x29cc('0x22')](_0x4a59dc);};}var utilLicense=require(_0x29cc('0x11'));exports[_0x29cc('0x23')]=function(_0x4da2c3,_0x3ce659){var _0x170f08={'raw':!![],'where':{'id':0x1}},_0x2477a0={};_0x2477a0['model']=_['keys'](db[_0x29cc('0x24')][_0x29cc('0x25')]);_0x2477a0[_0x29cc('0x26')]=_[_0x29cc('0x27')](_0x4da2c3['query']);_0x2477a0[_0x29cc('0x28')]=_['intersection'](_0x2477a0[_0x29cc('0x29')],_0x2477a0[_0x29cc('0x26')]);_0x170f08[_0x29cc('0x2a')]=_[_0x29cc('0x2b')](_0x2477a0[_0x29cc('0x29')],qs[_0x29cc('0x2c')](_0x4da2c3[_0x29cc('0x26')][_0x29cc('0x2c')]));_0x170f08[_0x29cc('0x2a')]=_0x170f08[_0x29cc('0x2a')][_0x29cc('0x2d')]?_0x170f08[_0x29cc('0x2a')]:_0x2477a0[_0x29cc('0x29')];_0x170f08=_[_0x29cc('0x2e')]({},_0x170f08,_0x4da2c3[_0x29cc('0x2f')]);return utilLicense['getLicense'](_0x170f08)[_0x29cc('0x1e')](respondWithResult(_0x3ce659,null))[_0x29cc('0x30')](handleError(_0x3ce659,null));};exports[_0x29cc('0x1d')]=function(_0x59b5bd,_0x362a1a){if(_0x59b5bd['body']['id']){delete _0x59b5bd[_0x29cc('0x31')]['id'];}return db['License']['find']({'where':{'id':_0x59b5bd[_0x29cc('0x32')]['id']}})[_0x29cc('0x1e')](handleEntityNotFound(_0x362a1a,null))[_0x29cc('0x1e')](function(_0x1ea9d5){var _0x278b24=_0x1ea9d5[_0x29cc('0x33')]({'plain':!![]});return utilLicense['checkLicense'](_0x278b24,_0x59b5bd[_0x29cc('0x31')][_0x29cc('0x34')]);})[_0x29cc('0x1e')](function(_0x581855){if(!_0x581855['demo']){return saveUpdates(_0x59b5bd[_0x29cc('0x31')],null);}return _0x581855;})[_0x29cc('0x1e')](respondWithResult(_0x362a1a,null))['catch'](handleError(_0x362a1a,null));};exports[_0x29cc('0x35')]=function(_0x58a269,_0x311718){var _0x50448d=_0x29cc('0x36');var _0xced908=path['join'](_0x29cc('0x37'),_0x29cc('0x38'),_0x29cc('0x39'),_0x50448d);_0x311718[_0x29cc('0x3a')](_0x29cc('0x3b'),'attachment;\x20filename='+_0x50448d);_0x311718[_0x29cc('0x19')](_0x29cc('0x3c'),_0x29cc('0x3d'));_0x311718[_0x29cc('0x3e')](_0xced908);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 10fec48..8cbfc0f 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 _0xc0a1=['./license.attributes','exports','define','License','license','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xb68cdd,_0x45c638){var _0x130f67=function(_0x5040be){while(--_0x5040be){_0xb68cdd['push'](_0xb68cdd['shift']());}};_0x130f67(++_0x45c638);}(_0xc0a1,0x1f1));var _0x1c0a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xc0a1[_0x77d310];return _0x2cdce4;};'use strict';var _=require('lodash');var util=require(_0x1c0a('0x0'));var logger=require(_0x1c0a('0x1'))(_0x1c0a('0x2'));var moment=require('moment');var BPromise=require(_0x1c0a('0x3'));var rp=require(_0x1c0a('0x4'));var fs=require('fs');var path=require(_0x1c0a('0x5'));var rimraf=require('rimraf');var config=require(_0x1c0a('0x6'));var attributes=require(_0x1c0a('0x7'));module[_0x1c0a('0x8')]=function(_0x2647a8,_0x4f42b1){return _0x2647a8[_0x1c0a('0x9')](_0x1c0a('0xa'),attributes,{'tableName':_0x1c0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b70=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0xaa2563,_0x3bb11f){var _0x22d7f2=function(_0xe8467c){while(--_0xe8467c){_0xaa2563['push'](_0xaa2563['shift']());}};_0x22d7f2(++_0x3bb11f);}(_0x1b70,0x13e));var _0x01b7=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x1b70[_0x2b2b33];return _0x229157;};'use strict';var _=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var logger=require('../../config/logger')(_0x01b7('0x2'));var moment=require('moment');var BPromise=require(_0x01b7('0x3'));var rp=require(_0x01b7('0x4'));var fs=require('fs');var path=require(_0x01b7('0x5'));var rimraf=require(_0x01b7('0x6'));var config=require(_0x01b7('0x7'));var attributes=require(_0x01b7('0x8'));module[_0x01b7('0x9')]=function(_0x5e4bd3,_0x165ddf){return _0x5e4bd3[_0x01b7('0xa')](_0x01b7('0xb'),attributes,{'tableName':_0x01b7('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 d75066f..4d9a588 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 _0xe10b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x227f51,_0x8d50b9){var _0x5d1943=function(_0x3d2b07){while(--_0x3d2b07){_0x227f51['push'](_0x227f51['shift']());}};_0x5d1943(++_0x8d50b9);}(_0xe10b,0xda));var _0xbe10=function(_0x371c85,_0x264681){_0x371c85=_0x371c85-0x0;var _0x33fb3c=_0xe10b[_0x371c85];return _0x33fb3c;};'use strict';var _=require('lodash');var util=require(_0xbe10('0x0'));var moment=require(_0xbe10('0x1'));var BPromise=require(_0xbe10('0x2'));var rs=require(_0xbe10('0x3'));var fs=require('fs');var Redis=require(_0xbe10('0x4'));var db=require(_0xbe10('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbe10('0x6'));var jayson=require(_0xbe10('0x7'));var client=jayson[_0xbe10('0x8')][_0xbe10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c844,_0x1bf9c1,_0x3dbc62){return new BPromise(function(_0x136b94,_0x4ccfbd){return client[_0xbe10('0xa')](_0x27c844,_0x3dbc62)[_0xbe10('0xb')](function(_0x499621){logger['info'](_0xbe10('0xc'),_0x1bf9c1,_0xbe10('0xd'));logger[_0xbe10('0xe')](_0xbe10('0xf'),_0x1bf9c1,_0xbe10('0xd'),JSON[_0xbe10('0x10')](_0x499621));if(_0x499621[_0xbe10('0x11')]){if(_0x499621[_0xbe10('0x11')][_0xbe10('0x12')]===0x1f4){logger[_0xbe10('0x11')](_0xbe10('0xc'),_0x1bf9c1,_0x499621['error'][_0xbe10('0x13')]);return _0x4ccfbd(_0x499621['error']['message']);}logger[_0xbe10('0x11')](_0xbe10('0xc'),_0x1bf9c1,_0x499621[_0xbe10('0x11')]['message']);return _0x136b94(_0x499621['error'][_0xbe10('0x13')]);}else{logger['info'](_0xbe10('0xc'),_0x1bf9c1,_0xbe10('0xd'));_0x136b94(_0x499621[_0xbe10('0x14')]['message']);}})[_0xbe10('0x15')](function(_0x1f08f1){logger[_0xbe10('0x11')]('License,\x20%s,\x20%s',_0x1bf9c1,_0x1f08f1);_0x4ccfbd(_0x1f08f1);});});} \ No newline at end of file +var _0x9556=['jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x569f9a,_0x58cc03){var _0x33cafb=function(_0x4b2300){while(--_0x4b2300){_0x569f9a['push'](_0x569f9a['shift']());}};_0x33cafb(++_0x58cc03);}(_0x9556,0xc7));var _0x6955=function(_0x3453b4,_0x53074b){_0x3453b4=_0x3453b4-0x0;var _0x57a36b=_0x9556[_0x3453b4];return _0x57a36b;};'use strict';var _=require(_0x6955('0x0'));var util=require(_0x6955('0x1'));var moment=require('moment');var BPromise=require(_0x6955('0x2'));var rs=require(_0x6955('0x3'));var fs=require('fs');var Redis=require(_0x6955('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6955('0x5'));var logger=require(_0x6955('0x6'))('rpc');var config=require(_0x6955('0x7'));var jayson=require(_0x6955('0x8'));var client=jayson[_0x6955('0x9')][_0x6955('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x448d38,_0x352059,_0x1486a0){return new BPromise(function(_0x93a8ac,_0x40f32a){return client[_0x6955('0xb')](_0x448d38,_0x1486a0)[_0x6955('0xc')](function(_0x1ad03c){logger['info'](_0x6955('0xd'),_0x352059,_0x6955('0xe'));logger[_0x6955('0xf')](_0x6955('0x10'),_0x352059,_0x6955('0xe'),JSON['stringify'](_0x1ad03c));if(_0x1ad03c['error']){if(_0x1ad03c[_0x6955('0x11')][_0x6955('0x12')]===0x1f4){logger[_0x6955('0x11')]('License,\x20%s,\x20%s',_0x352059,_0x1ad03c[_0x6955('0x11')][_0x6955('0x13')]);return _0x40f32a(_0x1ad03c[_0x6955('0x11')][_0x6955('0x13')]);}logger[_0x6955('0x11')]('License,\x20%s,\x20%s',_0x352059,_0x1ad03c['error'][_0x6955('0x13')]);return _0x93a8ac(_0x1ad03c[_0x6955('0x11')]['message']);}else{logger[_0x6955('0x14')]('License,\x20%s,\x20%s',_0x352059,'request\x20sent');_0x93a8ac(_0x1ad03c[_0x6955('0x15')][_0x6955('0x13')]);}})[_0x6955('0x16')](function(_0x3fba52){logger[_0x6955('0x11')](_0x6955('0xd'),_0x352059,_0x3fba52);_0x40f32a(_0x3fba52);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ef95543..ff98cef 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 _0x473b=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/messages','getMessages','verifySmtp','/:id/users','post','addAnswer','create','/:id/in_servers','addImap','/:id/interactions','addApplications','send','addAgents','put','removeDispositions','delete','removeAnswers','removeSmtp','/:id','destroy','removeAgents','exports','multer'];(function(_0x17a760,_0x539893){var _0x354340=function(_0x1be248){while(--_0x1be248){_0x17a760['push'](_0x17a760['shift']());}};_0x354340(++_0x539893);}(_0x473b,0xd1));var _0xb473=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x473b[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0xb473('0x0'));var util=require(_0xb473('0x1'));var path=require(_0xb473('0x2'));var timeout=require('connect-timeout');var express=require(_0xb473('0x3'));var router=express['Router']();var fs_extra=require(_0xb473('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb473('0x5'));var config=require(_0xb473('0x6'));var controller=require('./mailAccount.controller');router[_0xb473('0x7')]('/',auth[_0xb473('0x8')](),controller[_0xb473('0x9')]);router[_0xb473('0x7')](_0xb473('0xa'),auth[_0xb473('0x8')](),controller[_0xb473('0xb')]);router[_0xb473('0x7')]('/:id',auth[_0xb473('0x8')](),controller[_0xb473('0xc')]);router['get'](_0xb473('0xd'),auth['isAuthenticated'](),controller[_0xb473('0xe')]);router[_0xb473('0x7')](_0xb473('0xf'),auth[_0xb473('0x8')](),controller['getAnswers']);router[_0xb473('0x7')]('/:id/in_servers',auth[_0xb473('0x8')](),controller[_0xb473('0x10')]);router['get'](_0xb473('0x11'),auth[_0xb473('0x8')](),controller[_0xb473('0x12')]);router[_0xb473('0x7')]('/:id/interactions',auth[_0xb473('0x8')](),controller[_0xb473('0x13')]);router[_0xb473('0x7')]('/:id/applications',auth[_0xb473('0x8')](),controller['getApplications']);router[_0xb473('0x7')](_0xb473('0x14'),auth[_0xb473('0x8')](),controller[_0xb473('0x15')]);router[_0xb473('0x7')]('/:id/verify',auth[_0xb473('0x8')](),controller[_0xb473('0x16')]);router[_0xb473('0x7')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller['getAgents']);router[_0xb473('0x18')](_0xb473('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb473('0x8')](),controller[_0xb473('0x19')]);router[_0xb473('0x18')]('/',auth[_0xb473('0x8')](),controller[_0xb473('0x1a')]);router[_0xb473('0x18')](_0xb473('0x1b'),auth['isAuthenticated'](),controller[_0xb473('0x1c')]);router['post'](_0xb473('0x11'),auth[_0xb473('0x8')](),controller['addSmtp']);router[_0xb473('0x18')](_0xb473('0x1d'),auth[_0xb473('0x8')](),controller['addInteraction']);router[_0xb473('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb473('0x1e')]);router[_0xb473('0x18')]('/:id/send',auth[_0xb473('0x8')](),controller[_0xb473('0x1f')]);router[_0xb473('0x18')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller[_0xb473('0x20')]);router[_0xb473('0x21')]('/:id',auth[_0xb473('0x8')](),controller['update']);router['delete']('/:id/dispositions',auth[_0xb473('0x8')](),controller[_0xb473('0x22')]);router[_0xb473('0x23')]('/:id/canned_answers',auth[_0xb473('0x8')](),controller[_0xb473('0x24')]);router[_0xb473('0x23')](_0xb473('0x1b'),auth['isAuthenticated'](),controller['removeImap']);router[_0xb473('0x23')]('/:id/out_servers',auth[_0xb473('0x8')](),controller[_0xb473('0x25')]);router[_0xb473('0x23')](_0xb473('0x26'),auth[_0xb473('0x8')](),controller[_0xb473('0x27')]);router[_0xb473('0x23')](_0xb473('0x17'),auth[_0xb473('0x8')](),controller[_0xb473('0x28')]);module[_0xb473('0x29')]=router; \ No newline at end of file +var _0xe9fd=['getDispositions','/:id/canned_answers','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','/:id/users','post','addAnswer','create','/:id/in_servers','addImap','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeSmtp','destroy','removeAgents','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x3d9532,_0x4816e6){var _0x54cbe2=function(_0x2f00b9){while(--_0x2f00b9){_0x3d9532['push'](_0x3d9532['shift']());}};_0x54cbe2(++_0x4816e6);}(_0xe9fd,0x194));var _0xde9f=function(_0x15783e,_0x22c267){_0x15783e=_0x15783e-0x0;var _0x3420fe=_0xe9fd[_0x15783e];return _0x3420fe;};'use strict';var multer=require(_0xde9f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde9f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde9f('0x2'));var auth=require(_0xde9f('0x3'));var interaction=require(_0xde9f('0x4'));var config=require(_0xde9f('0x5'));var controller=require(_0xde9f('0x6'));router[_0xde9f('0x7')]('/',auth[_0xde9f('0x8')](),controller['index']);router[_0xde9f('0x7')](_0xde9f('0x9'),auth[_0xde9f('0x8')](),controller[_0xde9f('0xa')]);router['get'](_0xde9f('0xb'),auth[_0xde9f('0x8')](),controller[_0xde9f('0xc')]);router[_0xde9f('0x7')](_0xde9f('0xd'),auth['isAuthenticated'](),controller[_0xde9f('0xe')]);router[_0xde9f('0x7')](_0xde9f('0xf'),auth[_0xde9f('0x8')](),controller['getAnswers']);router[_0xde9f('0x7')]('/:id/in_servers',auth[_0xde9f('0x8')](),controller['getImap']);router[_0xde9f('0x7')](_0xde9f('0x10'),auth['isAuthenticated'](),controller['getSmtp']);router['get'](_0xde9f('0x11'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x12')]);router[_0xde9f('0x7')](_0xde9f('0x13'),auth['isAuthenticated'](),controller[_0xde9f('0x14')]);router[_0xde9f('0x7')]('/:id/messages',auth[_0xde9f('0x8')](),controller['getMessages']);router[_0xde9f('0x7')](_0xde9f('0x15'),auth[_0xde9f('0x8')](),controller['verifySmtp']);router[_0xde9f('0x7')](_0xde9f('0x16'),auth[_0xde9f('0x8')](),controller['getAgents']);router[_0xde9f('0x17')](_0xde9f('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xde9f('0x17')](_0xde9f('0xf'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x18')]);router['post']('/',auth[_0xde9f('0x8')](),controller[_0xde9f('0x19')]);router['post'](_0xde9f('0x1a'),auth['isAuthenticated'](),controller[_0xde9f('0x1b')]);router[_0xde9f('0x17')](_0xde9f('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xde9f('0x17')](_0xde9f('0x11'),auth[_0xde9f('0x8')](),controller['addInteraction']);router[_0xde9f('0x17')](_0xde9f('0x13'),auth[_0xde9f('0x8')](),controller['addApplications']);router[_0xde9f('0x17')](_0xde9f('0x1c'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x1d')]);router[_0xde9f('0x17')](_0xde9f('0x16'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x1e')]);router[_0xde9f('0x1f')]('/:id',auth[_0xde9f('0x8')](),controller[_0xde9f('0x20')]);router[_0xde9f('0x21')](_0xde9f('0xd'),auth[_0xde9f('0x8')](),controller['removeDispositions']);router[_0xde9f('0x21')]('/:id/canned_answers',auth[_0xde9f('0x8')](),controller[_0xde9f('0x22')]);router[_0xde9f('0x21')]('/:id/in_servers',auth[_0xde9f('0x8')](),controller['removeImap']);router['delete'](_0xde9f('0x10'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x23')]);router[_0xde9f('0x21')](_0xde9f('0xb'),auth[_0xde9f('0x8')](),controller[_0xde9f('0x24')]);router[_0xde9f('0x21')](_0xde9f('0x16'),auth['isAuthenticated'](),controller[_0xde9f('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 73a4cd5..056e87c 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 _0x7de3=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT'];(function(_0x40aaf5,_0x19a868){var _0x52a10a=function(_0x22f91d){while(--_0x22f91d){_0x40aaf5['push'](_0x40aaf5['shift']());}};_0x52a10a(++_0x19a868);}(_0x7de3,0xba));var _0x37de=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7de3[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module[_0x37de('0x0')]={'description':{'type':Sequelize[_0x37de('0x1')]},'name':{'type':Sequelize[_0x37de('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x37de('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x37de('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x37de('0x3')]},'markAsUnread':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x37de('0x1')],'allowNull':![],'defaultValue':_0x37de('0x4')},'fontSize':{'type':Sequelize[_0x37de('0x5')](0x2)[_0x37de('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x37de('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[_0x37de('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x37de('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x37de('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x37de('0x2')],'defaultValue':![],'comment':_0x37de('0x8'),'set':function(_0x1ed20e){if(!_0x1ed20e)this[_0x37de('0x9')](_0x37de('0xa'),null);this['setDataValue'](_0x37de('0xb'),_0x1ed20e);}},'provider':{'type':Sequelize['ENUM'](_0x37de('0xc'),_0x37de('0xd'),_0x37de('0xe'),_0x37de('0xf')),'defaultValue':null,'get':function(){var _0x3cf811=this[_0x37de('0x10')](_0x37de('0x11'));return _0x3cf811||_0x37de('0x12');},'set':function(_0x291c9e){if(_0x291c9e===_0x37de('0x12')){_0x291c9e=null;}return this[_0x37de('0x9')](_0x37de('0x11'),_0x291c9e);}}}; \ No newline at end of file +var _0xfe92=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','sequelize','exports','STRING'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xfe92,0xfc));var _0x2fe9=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0xfe92[_0x12ddb2];return _0x10b6dd;};'use strict';var Sequelize=require(_0x2fe9('0x0'));module[_0x2fe9('0x1')]={'description':{'type':Sequelize[_0x2fe9('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2fe9('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2fe9('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2fe9('0x4')]},'markAsUnread':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2fe9('0x5')},'fontSize':{'type':Sequelize[_0x2fe9('0x6')](0x2)[_0x2fe9('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2fe9('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2fe9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2fe9('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2fe9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2fe9('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50612a){if(!_0x50612a)this[_0x2fe9('0x9')]('mandatoryDispositionPauseId',null);this[_0x2fe9('0x9')]('mandatoryDisposition',_0x50612a);}},'provider':{'type':Sequelize[_0x2fe9('0xa')](_0x2fe9('0xb'),_0x2fe9('0xc'),_0x2fe9('0xd'),_0x2fe9('0xe')),'defaultValue':null,'get':function(){var _0x3d1ae4=this['getDataValue'](_0x2fe9('0xf'));return _0x3d1ae4||_0x2fe9('0x10');},'set':function(_0x2e45b4){if(_0x2e45b4===_0x2fe9('0x10')){_0x2e45b4=null;}return this['setDataValue']('provider',_0x2e45b4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d0ac532..1964d26 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 _0x7adf=['intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','params','keys','includeAll','options','find','update','body','provider','custom','describe','addDisposition','Disposition','create','getDispositions','hasOwnProperty','order','MailAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','findOne','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','getSmtpOptions','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','User','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','get','MailAccounts','destroy','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query'];(function(_0x255733,_0x52db8c){var _0x2c0d55=function(_0x1062b0){while(--_0x1062b0){_0x255733['push'](_0x255733['shift']());}};_0x2c0d55(++_0x52db8c);}(_0x7adf,0x140));var _0xf7ad=function(_0x536442,_0x18e920){_0x536442=_0x536442-0x0;var _0x82516e=_0x7adf[_0x536442];return _0x82516e;};'use strict';var moment=require('moment');var BPromise=require(_0xf7ad('0x0'));var util=require(_0xf7ad('0x1'));var path=require(_0xf7ad('0x2'));var _=require(_0xf7ad('0x3'));var juice=require(_0xf7ad('0x4'));var Redis=require(_0xf7ad('0x5'));var qs=require(_0xf7ad('0x6'));var logger=require(_0xf7ad('0x7'))(_0xf7ad('0x8'));var config=require(_0xf7ad('0x9'));var db=require(_0xf7ad('0xa'))['db'];config['redis']=_['defaults'](config[_0xf7ad('0xb')],{'host':_0xf7ad('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf7ad('0xd'))[_0xf7ad('0xe')](socket);var jayson=require(_0xf7ad('0xf'));var client=jayson[_0xf7ad('0x10')][_0xf7ad('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x35c94c,_0x35f49f,_0x33c15c,_0x29dc40){return new BPromise(function(_0x1bdc69,_0x27f675){var _0x587599=_0x29dc40||client;return _0x587599[_0xf7ad('0x12')](_0x35c94c,_0x33c15c)[_0xf7ad('0x13')](function(_0x7692eb){logger[_0xf7ad('0x14')]('MailAccount,\x20%s,\x20%s',_0x35f49f,_0xf7ad('0x15'));logger[_0xf7ad('0x16')](_0xf7ad('0x17'),_0x35f49f,'request\x20sent',JSON[_0xf7ad('0x18')](_0x7692eb));if(_0x7692eb[_0xf7ad('0x19')]){if(_0x7692eb['error'][_0xf7ad('0x1a')]===0x1f4){logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x7692eb['error'][_0xf7ad('0x1c')]);return _0x27f675(_0x7692eb[_0xf7ad('0x19')][_0xf7ad('0x1c')]);}logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x7692eb[_0xf7ad('0x19')][_0xf7ad('0x1c')]);return _0x1bdc69(_0x7692eb['error'][_0xf7ad('0x1c')]);}else{logger[_0xf7ad('0x14')]('MailAccount,\x20%s,\x20%s',_0x35f49f,_0xf7ad('0x15'));_0x1bdc69(_0x7692eb[_0xf7ad('0x1d')]['message']);}})[_0xf7ad('0x1e')](function(_0x919e34){logger[_0xf7ad('0x19')](_0xf7ad('0x1b'),_0x35f49f,_0x919e34);_0x27f675(_0x919e34);});});}function respondWithStatusCode(_0x49c33d,_0x228b96){_0x228b96=_0x228b96||0xcc;return function(_0x44a4de){if(_0x44a4de){return _0x49c33d[_0xf7ad('0x1f')](_0x228b96);}return _0x49c33d['status'](_0x228b96)[_0xf7ad('0x20')]();};}function respondWithResult(_0x2ca489,_0x4b01ad){_0x4b01ad=_0x4b01ad||0xc8;return function(_0x35f081){if(_0x35f081){return _0x2ca489[_0xf7ad('0x21')](_0x4b01ad)[_0xf7ad('0x22')](_0x35f081);}};}function respondWithFilteredResult(_0x4565d0,_0x285f44){return function(_0x383180){if(_0x383180){var _0x168d36=typeof _0x285f44[_0xf7ad('0x23')]===_0xf7ad('0x24')&&typeof _0x285f44['limit']===_0xf7ad('0x24');var _0x4e10a2=_0x383180[_0xf7ad('0x25')];var _0x377082=_0x168d36?0x0:_0x285f44[_0xf7ad('0x23')];var _0x3377af=_0x168d36?_0x383180[_0xf7ad('0x25')]:_0x285f44[_0xf7ad('0x23')]+_0x285f44[_0xf7ad('0x26')];var _0x547899;if(_0x3377af>=_0x4e10a2){_0x3377af=_0x4e10a2;_0x547899=0xc8;}else{_0x547899=0xce;}_0x4565d0[_0xf7ad('0x21')](_0x547899);return _0x4565d0[_0xf7ad('0x27')]('Content-Range',_0x377082+'-'+_0x3377af+'/'+_0x4e10a2)['json'](_0x383180);}return null;};}function saveUpdates(_0x205c63){return function(_0x288af7){if(_0x288af7){return _0x288af7['update'](_0x205c63)[_0xf7ad('0x13')](function(_0x18f080){return _0x18f080;});}return null;};}function removeEntity(_0x262cf4){return function(_0x30fd07){if(_0x30fd07){return _0x30fd07['destroy']()['then'](function(){var _0x248421=_0x30fd07[_0xf7ad('0x28')]({'plain':!![]});var _0x50f616=_0xf7ad('0x29');return db['UserProfileResource'][_0xf7ad('0x2a')]({'where':{'type':_0x50f616,'resourceId':_0x248421['id']}})[_0xf7ad('0x13')](function(){return _0x30fd07;});})[_0xf7ad('0x13')](function(){_0x262cf4['status'](0xcc)[_0xf7ad('0x20')]();});}};}function handleEntityNotFound(_0x403103){return function(_0x24cd92){if(!_0x24cd92){_0x403103[_0xf7ad('0x1f')](0x194);}return _0x24cd92;};}function handleError(_0x5ee9c7,_0x1e84e2){_0x1e84e2=_0x1e84e2||0x1f4;return function(_0x1356ea){logger[_0xf7ad('0x19')](_0x1356ea[_0xf7ad('0x2b')]);if(_0x1356ea[_0xf7ad('0x2c')]){delete _0x1356ea[_0xf7ad('0x2c')];}_0x5ee9c7[_0xf7ad('0x21')](_0x1e84e2)['send'](_0x1356ea);};}function getImapHost(_0x36a8b6){switch(_0x36a8b6){case _0xf7ad('0x2d'):return _0xf7ad('0x2e');case _0xf7ad('0x2f'):return _0xf7ad('0x30');case _0xf7ad('0x31'):return'imap-mail.outlook.com';case _0xf7ad('0x32'):return _0xf7ad('0x33');}throw new Error(_0xf7ad('0x34'),_0x36a8b6);}function getSmtpHost(_0x47f3a6){switch(_0x47f3a6){case _0xf7ad('0x2d'):return'smtp.gmail.com';case _0xf7ad('0x2f'):return'smtp.mail.yahoo.com';case _0xf7ad('0x31'):return'smtp-mail.outlook.com';case _0xf7ad('0x32'):return _0xf7ad('0x35');}throw new Error(_0xf7ad('0x34'),_0x47f3a6);}function getAuthenticationOptions(_0x294816,_0x1e2151){var _0x35d314={};var _0x457654={};if(_0x294816){_0x35d314['user']=_0x457654[_0xf7ad('0x36')]=_0x1e2151[_0xf7ad('0x37')];_0x35d314['password']=_0x457654[_0xf7ad('0x38')]=_0x1e2151[_0xf7ad('0x39')];if(_0x1e2151[_0xf7ad('0x3a')]){_0x35d314['modernAuthentication']=_0x457654[_0xf7ad('0x3a')]=!![];_0x35d314[_0xf7ad('0x3b')]=_0x457654[_0xf7ad('0x3b')]=_0x1e2151[_0xf7ad('0x3b')];_0x35d314[_0xf7ad('0x39')]=_0x457654[_0xf7ad('0x38')]=null;}else{_0x35d314['CloudProviderId']=_0x457654[_0xf7ad('0x3b')]=null;}_0x35d314[_0xf7ad('0x3c')]=getImapHost(_0x294816);_0x35d314[_0xf7ad('0x3d')]=0x3e1;_0x457654[_0xf7ad('0x3c')]=getSmtpHost(_0x294816);_0x457654[_0xf7ad('0x3d')]=0x24b;_0x457654[_0xf7ad('0x3e')]=![];_0x35d314[_0xf7ad('0x3f')]=_0x457654[_0xf7ad('0x3f')]=null;}else{if(_0x1e2151[_0xf7ad('0x40')]){_0x35d314[_0xf7ad('0x36')]=_0x457654['user']=_0x1e2151[_0xf7ad('0x37')];_0x35d314['password']=_0x457654[_0xf7ad('0x38')]=_0x1e2151[_0xf7ad('0x39')];}else{_0x35d314[_0xf7ad('0x40')]=_0x457654[_0xf7ad('0x40')]=![];_0x35d314[_0xf7ad('0x36')]=_0x457654[_0xf7ad('0x36')]=null;_0x35d314[_0xf7ad('0x39')]=_0x457654[_0xf7ad('0x38')]=null;}_0x35d314[_0xf7ad('0x3c')]=_0x1e2151[_0xf7ad('0x41')][_0xf7ad('0x3c')];_0x35d314[_0xf7ad('0x3d')]=_0x1e2151[_0xf7ad('0x41')][_0xf7ad('0x3d')];_0x457654[_0xf7ad('0x3c')]=_0x1e2151[_0xf7ad('0x42')][_0xf7ad('0x3c')];_0x457654['port']=_0x1e2151[_0xf7ad('0x42')][_0xf7ad('0x3d')];}return{'Imap':_0x35d314,'Smtp':_0x457654};}exports['index']=function(_0x49e258,_0xf9e43a){var _0x24c985={'include':[{'model':db[_0xf7ad('0x43')],'as':_0xf7ad('0x41')},{'model':db[_0xf7ad('0x44')],'as':'Smtp'},{'model':db[_0xf7ad('0x45')],'as':_0xf7ad('0x46')}]},_0x3829bf={},_0x3ae3bf={'count':0x0,'rows':[]};var _0x43126a=_[_0xf7ad('0x47')](db[_0xf7ad('0x48')][_0xf7ad('0x49')],function(_0x47148e){return{'name':_0x47148e[_0xf7ad('0x4a')],'type':_0x47148e[_0xf7ad('0x4b')][_0xf7ad('0x4c')]};});_0x3829bf['model']=_[_0xf7ad('0x47')](_0x43126a,_0xf7ad('0x2c'));_0x3829bf[_0xf7ad('0x4d')]=_['keys'](_0x49e258[_0xf7ad('0x4d')]);_0x3829bf['filters']=_[_0xf7ad('0x4e')](_0x3829bf[_0xf7ad('0x4f')],_0x3829bf[_0xf7ad('0x4d')]);_0x24c985[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x3829bf[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x24c985[_0xf7ad('0x50')]=_0x24c985[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x24c985[_0xf7ad('0x50')]:_0x3829bf[_0xf7ad('0x4f')];if(!_0x49e258[_0xf7ad('0x4d')]['hasOwnProperty'](_0xf7ad('0x53'))){_0x24c985[_0xf7ad('0x26')]=qs['limit'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x24c985['offset']=qs['offset'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x24c985['order']=qs['sort'](_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x24c985[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x49e258[_0xf7ad('0x4d')],_0x3829bf[_0xf7ad('0x57')]),_0x43126a);if(_0x49e258[_0xf7ad('0x4d')]['filter']){_0x24c985[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x24c985[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x43126a,function(_0x2a28fa){if(_0x2a28fa[_0xf7ad('0x4b')]!==_0xf7ad('0x59')){var _0x135759={};_0x135759[_0x2a28fa['name']]={'$like':'%'+_0x49e258[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x135759;}})});}_0x24c985=_['merge']({},_0x24c985,_0x49e258['options']);var _0x5863a5={'where':_0x24c985[_0xf7ad('0x55')]};return db['MailAccount']['count'](_0x5863a5)[_0xf7ad('0x13')](function(_0xe47d3){_0x3ae3bf[_0xf7ad('0x25')]=_0xe47d3;if(_0x49e258[_0xf7ad('0x4d')]['includeAll']){_0x24c985[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x48')][_0xf7ad('0x5c')](_0x24c985);})[_0xf7ad('0x13')](function(_0x4a5b68){_0x3ae3bf[_0xf7ad('0x5d')]=_0x4a5b68;return _0x3ae3bf;})[_0xf7ad('0x13')](respondWithFilteredResult(_0xf9e43a,_0x24c985))['catch'](handleError(_0xf9e43a,null));};exports['show']=function(_0x29f909,_0x8cb6bf){var _0x15e71e={'raw':![],'where':{'id':_0x29f909[_0xf7ad('0x5e')]['id']},'include':[{'model':db[_0xf7ad('0x43')],'as':'Imap'},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42')},{'model':db[_0xf7ad('0x45')],'as':_0xf7ad('0x46')}]},_0x34059d={};_0x34059d[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x48')][_0xf7ad('0x49')]);_0x34059d[_0xf7ad('0x4d')]=_['keys'](_0x29f909['query']);_0x34059d[_0xf7ad('0x57')]=_['intersection'](_0x34059d[_0xf7ad('0x4f')],_0x34059d[_0xf7ad('0x4d')]);_0x15e71e[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x34059d[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x29f909['query'][_0xf7ad('0x51')]));_0x15e71e['attributes']=_0x15e71e[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x15e71e[_0xf7ad('0x50')]:_0x34059d['model'];if(_0x29f909['query'][_0xf7ad('0x60')]){_0x15e71e['include']=[{'all':!![]}];}_0x15e71e=_['merge']({},_0x15e71e,_0x29f909[_0xf7ad('0x61')]);return db[_0xf7ad('0x48')][_0xf7ad('0x62')](_0x15e71e)[_0xf7ad('0x13')](handleEntityNotFound(_0x8cb6bf,null))[_0xf7ad('0x13')](respondWithResult(_0x8cb6bf,null))[_0xf7ad('0x1e')](handleError(_0x8cb6bf,null));};exports[_0xf7ad('0x63')]=function(_0x55bd2e,_0x536f88){if(_0x55bd2e[_0xf7ad('0x64')]['id']){delete _0x55bd2e[_0xf7ad('0x64')]['id'];}var _0x32c848=_0x55bd2e['body'][_0xf7ad('0x65')]===_0xf7ad('0x66')?null:_0x55bd2e['body'][_0xf7ad('0x65')];var _0x5583b9=_0x55bd2e['body'][_0xf7ad('0x41')]||{};var _0x5b5983=_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x42')]||{};if(_0x32c848){_0x5583b9[_0xf7ad('0x3c')]=getImapHost(_0x32c848);_0x5583b9[_0xf7ad('0x3d')]=0x3e1;_0x5b5983[_0xf7ad('0x3c')]=getSmtpHost(_0x32c848);_0x5b5983[_0xf7ad('0x3d')]=0x24b;_0x5b5983[_0xf7ad('0x3e')]=![];}if(_0x5b5983[_0xf7ad('0x3a')]){_0x5b5983[_0xf7ad('0x3e')]=![];}else{_0x5b5983[_0xf7ad('0x3b')]=null;}if(!_0x5583b9[_0xf7ad('0x3a')])_0x5583b9['CloudProviderId']=null;_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')]=_0x5583b9;_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x42')]=_0x5b5983;return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x55bd2e[_0xf7ad('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42')},{'model':db['Pause'],'as':_0xf7ad('0x46')}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x536f88,null))[_0xf7ad('0x13')](function(_0x5d4782){if(!_0x5d4782)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5d4782['service'])delete _0x55bd2e['body'][_0xf7ad('0x41')];return _0x5d4782;})[_0xf7ad('0x13')](saveUpdates(_0x55bd2e['body'],null))[_0xf7ad('0x13')](function(_0x22f788){if(!_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')])return _0x22f788;return db[_0xf7ad('0x43')]['update'](_0x55bd2e[_0xf7ad('0x64')][_0xf7ad('0x41')],{'where':{'MailAccountId':_0x22f788['id']}})[_0xf7ad('0x13')](function(){return _0x22f788;});})['then'](function(_0x307b5f){if(!_0x55bd2e['body'][_0xf7ad('0x42')])return _0x307b5f;return db[_0xf7ad('0x44')][_0xf7ad('0x63')](_0x55bd2e['body'][_0xf7ad('0x42')],{'where':{'MailAccountId':_0x307b5f['id']}})[_0xf7ad('0x13')](function(){return _0x307b5f;});})[_0xf7ad('0x13')](respondWithResult(_0x536f88,null))['catch'](handleError(_0x536f88,null));};exports[_0xf7ad('0x67')]=function(_0x79422d,_0x4beeed){return db[_0xf7ad('0x48')]['describe']()[_0xf7ad('0x13')](respondWithResult(_0x4beeed,null))['catch'](handleError(_0x4beeed,null));};exports[_0xf7ad('0x68')]=function(_0x1eb141,_0x51c4dd){if(_0x1eb141[_0xf7ad('0x64')]['id']){delete _0x1eb141['body']['id'];}return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x1eb141[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x51c4dd,null))[_0xf7ad('0x13')](function(_0x188b03){if(_0x188b03){_0x1eb141[_0xf7ad('0x64')]['MailAccountId']=_0x188b03['id'];return db[_0xf7ad('0x69')][_0xf7ad('0x6a')](_0x1eb141[_0xf7ad('0x64')]);}})['then'](respondWithResult(_0x51c4dd,null))[_0xf7ad('0x1e')](handleError(_0x51c4dd,null));};exports[_0xf7ad('0x6b')]=function(_0x368123,_0x2116b4){var _0x337fe0={'raw':![],'where':{}};var _0x267797={};var _0x5884bd={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x368123['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x2116b4,null))[_0xf7ad('0x13')](function(_0x46e2ce){if(_0x46e2ce){_0x267797[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x69')][_0xf7ad('0x49')]);_0x267797[_0xf7ad('0x4d')]=_['keys'](_0x368123['query']);_0x267797[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x267797[_0xf7ad('0x4f')],_0x267797[_0xf7ad('0x4d')]);_0x337fe0[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x267797['model'],qs[_0xf7ad('0x51')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x337fe0['attributes']=_0x337fe0[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x337fe0['attributes']:_0x267797[_0xf7ad('0x4f')];if(!_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x337fe0[_0xf7ad('0x26')]=qs[_0xf7ad('0x26')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x337fe0[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x337fe0[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x368123['query'][_0xf7ad('0x54')]);_0x337fe0[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x368123[_0xf7ad('0x4d')],_0x267797[_0xf7ad('0x57')]));_0x337fe0[_0xf7ad('0x55')][_0xf7ad('0x6e')]=_0x46e2ce['id'];if(_0x368123[_0xf7ad('0x4d')]['filter']){_0x337fe0['where']=_['merge'](_0x337fe0[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x337fe0[_0xf7ad('0x50')],function(_0x3384ff){var _0x303060={};_0x303060[_0x3384ff]={'$like':'%'+_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x303060;})});}_0x337fe0=_['merge']({},_0x337fe0,_0x368123[_0xf7ad('0x61')]);return db[_0xf7ad('0x69')][_0xf7ad('0x25')]({'where':_0x337fe0['where']})[_0xf7ad('0x13')](function(_0x5ebaea){_0x5884bd['count']=_0x5ebaea;if(_0x368123[_0xf7ad('0x4d')][_0xf7ad('0x60')]){_0x337fe0[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x69')][_0xf7ad('0x5c')](_0x337fe0);})[_0xf7ad('0x13')](function(_0x227d6d){_0x5884bd[_0xf7ad('0x5d')]=_0x227d6d;return _0x5884bd;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0x2116b4,_0x337fe0))[_0xf7ad('0x1e')](handleError(_0x2116b4,null));};exports[_0xf7ad('0x6f')]=function(_0x8d55d9,_0xd2834d){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x8d55d9['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0xd2834d,null))[_0xf7ad('0x13')](function(_0xba6d8){if(_0xba6d8){return _0xba6d8[_0xf7ad('0x6f')](_0x8d55d9[_0xf7ad('0x4d')][_0xf7ad('0x70')]);}})['then'](respondWithStatusCode(_0xd2834d,null))[_0xf7ad('0x1e')](handleError(_0xd2834d,null));};exports[_0xf7ad('0x71')]=function(_0x17774c,_0x5279b0){if(_0x17774c['body']['id']){delete _0x17774c['body']['id'];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x17774c[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5279b0,null))[_0xf7ad('0x13')](function(_0xc1f51e){if(_0xc1f51e){_0x17774c[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0xc1f51e['id'];return db['CannedAnswer']['create'](_0x17774c[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x5279b0,null))[_0xf7ad('0x1e')](handleError(_0x5279b0,null));};exports[_0xf7ad('0x72')]=function(_0x40b6b5,_0x1c0ca2){var _0x1deae9={'raw':![],'where':{}};var _0xb59ab2={};var _0x4f9627={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x40b6b5[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x1c0ca2,null))['then'](function(_0x4846c0){if(_0x4846c0){_0xb59ab2['model']=_[_0xf7ad('0x5f')](db[_0xf7ad('0x73')][_0xf7ad('0x49')]);_0xb59ab2[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x40b6b5[_0xf7ad('0x4d')]);_0xb59ab2[_0xf7ad('0x57')]=_['intersection'](_0xb59ab2[_0xf7ad('0x4f')],_0xb59ab2['query']);_0x1deae9[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0xb59ab2['model'],qs[_0xf7ad('0x51')](_0x40b6b5['query'][_0xf7ad('0x51')]));_0x1deae9[_0xf7ad('0x50')]=_0x1deae9['attributes']['length']?_0x1deae9['attributes']:_0xb59ab2[_0xf7ad('0x4f')];if(!_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x1deae9[_0xf7ad('0x26')]=qs[_0xf7ad('0x26')](_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x1deae9['offset']=qs[_0xf7ad('0x23')](_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}_0x1deae9[_0xf7ad('0x6d')]=qs['sort'](_0x40b6b5['query'][_0xf7ad('0x54')]);_0x1deae9[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_['pick'](_0x40b6b5['query'],_0xb59ab2[_0xf7ad('0x57')]));_0x1deae9['where'][_0xf7ad('0x6e')]=_0x4846c0['id'];if(_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x1deae9['where']=_[_0xf7ad('0x58')](_0x1deae9[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x1deae9[_0xf7ad('0x50')],function(_0x5d9e9e){var _0x49cf71={};_0x49cf71[_0x5d9e9e]={'$like':'%'+_0x40b6b5[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x49cf71;})});}_0x1deae9=_['merge']({},_0x1deae9,_0x40b6b5[_0xf7ad('0x61')]);return db['CannedAnswer'][_0xf7ad('0x25')]({'where':_0x1deae9[_0xf7ad('0x55')]})['then'](function(_0x2a032d){_0x4f9627[_0xf7ad('0x25')]=_0x2a032d;if(_0x40b6b5['query'][_0xf7ad('0x60')]){_0x1deae9['include']=[{'all':!![]}];}return db[_0xf7ad('0x73')][_0xf7ad('0x5c')](_0x1deae9);})[_0xf7ad('0x13')](function(_0x1e28e1){_0x4f9627['rows']=_0x1e28e1;return _0x4f9627;});}})['then'](respondWithFilteredResult(_0x1c0ca2,_0x1deae9))[_0xf7ad('0x1e')](handleError(_0x1c0ca2,null));};exports[_0xf7ad('0x74')]=function(_0x2d25c0,_0x572074){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x2d25c0['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x572074,null))[_0xf7ad('0x13')](function(_0x21e3bd){if(_0x21e3bd){return _0x21e3bd[_0xf7ad('0x74')](_0x2d25c0[_0xf7ad('0x4d')][_0xf7ad('0x70')]);}})[_0xf7ad('0x13')](respondWithStatusCode(_0x572074,null))['catch'](handleError(_0x572074,null));};exports[_0xf7ad('0x6a')]=function(_0x7bc347,_0x3604ac){var _0x5b1aae={'name':_0x7bc347['body']['name'],'key':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x4c')],'provider':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x65')]===_0xf7ad('0x66')?null:_0x7bc347['body'][_0xf7ad('0x65')],'email':_0x7bc347[_0xf7ad('0x64')]['email'],'ListId':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x75')],'active':!_['isNil'](_0x7bc347['body'][_0xf7ad('0x76')])?_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x76')]:!![],'description':_0x7bc347[_0xf7ad('0x64')][_0xf7ad('0x77')]||null};var _0x510809=getAuthenticationOptions(_0x5b1aae[_0xf7ad('0x65')],_0x7bc347[_0xf7ad('0x64')]);_0x5b1aae[_0xf7ad('0x41')]=_0x510809[_0xf7ad('0x41')];_0x5b1aae[_0xf7ad('0x42')]=_0x510809[_0xf7ad('0x42')];return db[_0xf7ad('0x48')][_0xf7ad('0x6a')](_0x5b1aae,{'include':[{'model':db[_0xf7ad('0x44')],'as':'Smtp'},{'model':db[_0xf7ad('0x43')],'as':'Imap'}]})['then'](function(_0x46f6fb){var _0x540c02=_0x7bc347[_0xf7ad('0x36')][_0xf7ad('0x28')]({'plain':!![]});if(!_0x540c02)throw new Error(_0xf7ad('0x78'));if(_0x540c02[_0xf7ad('0x79')]==='user'){var _0x2813fe=_0x46f6fb[_0xf7ad('0x28')]({'plain':!![]});return db[_0xf7ad('0x7a')][_0xf7ad('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x540c02[_0xf7ad('0x7b')]},'raw':!![]})[_0xf7ad('0x13')](function(_0x529a7b){if(_0x529a7b&&_0x529a7b['autoAssociation']===0x0){return db[_0xf7ad('0x7c')][_0xf7ad('0x6a')]({'name':_0x2813fe[_0xf7ad('0x2c')],'resourceId':_0x2813fe['id'],'type':_0x529a7b['name'],'sectionId':_0x529a7b['id']},{})[_0xf7ad('0x13')](function(){return _0x46f6fb;});}else{return _0x46f6fb;}})[_0xf7ad('0x1e')](function(_0x5ef475){logger[_0xf7ad('0x19')](_0xf7ad('0x7d'),_0x5ef475);throw _0x5ef475;});}return _0x46f6fb;})['then'](respondWithResult(_0x3604ac,0xc9))['catch'](handleError(_0x3604ac,null));};exports[_0xf7ad('0x7e')]=function(_0x2710f6,_0x5ed398){return db[_0xf7ad('0x48')]['findOne']({'where':{'id':_0x2710f6['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5ed398,null))[_0xf7ad('0x13')](function(_0x294abc){if(_0x294abc){return _0x294abc['getImap']();}return null;})['then'](respondWithResult(_0x5ed398,null))['catch'](handleError(_0x5ed398,null));};exports['addImap']=function(_0x268c69,_0x3eae79){if(_0x268c69['body']['id']){delete _0x268c69[_0xf7ad('0x64')]['id'];}return db[_0xf7ad('0x48')]['find']({'where':{'id':_0x268c69[_0xf7ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3eae79,null))[_0xf7ad('0x13')](function(_0x483f8d){if(_0x483f8d){_0x268c69[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0x483f8d['id'];return db['MailServerIn'][_0xf7ad('0x6a')](_0x268c69[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x3eae79,null))['catch'](handleError(_0x3eae79,null));};exports[_0xf7ad('0x7f')]=function(_0x258dfe,_0x31bd48){return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x258dfe[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x31bd48,null))[_0xf7ad('0x13')](function(_0x39fc92){if(_0x39fc92){return _0x39fc92['setImap'](null);}return null;})[_0xf7ad('0x13')](respondWithStatusCode(_0x31bd48,null))['catch'](handleError(_0x31bd48,null));};exports[_0xf7ad('0x81')]=function(_0x1ed538,_0x4a8cff){return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x1ed538['params']['id']}})['then'](handleEntityNotFound(_0x4a8cff,null))[_0xf7ad('0x13')](function(_0x3190fb){if(_0x3190fb){return _0x3190fb['getSmtp']();}return null;})[_0xf7ad('0x13')](respondWithResult(_0x4a8cff,null))[_0xf7ad('0x1e')](handleError(_0x4a8cff,null));};exports[_0xf7ad('0x82')]=function(_0x5b88d6,_0x588f01){if(_0x5b88d6['body']['id']){delete _0x5b88d6[_0xf7ad('0x64')]['id'];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x5b88d6[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x588f01,null))[_0xf7ad('0x13')](function(_0xa4f1af){if(_0xa4f1af){_0x5b88d6[_0xf7ad('0x64')][_0xf7ad('0x6e')]=_0xa4f1af['id'];return db[_0xf7ad('0x44')][_0xf7ad('0x6a')](_0x5b88d6[_0xf7ad('0x64')]);}})[_0xf7ad('0x13')](respondWithResult(_0x588f01,null))['catch'](handleError(_0x588f01,null));};exports[_0xf7ad('0x83')]=function(_0x51ce5f,_0x578eb4){return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x51ce5f['params']['id']}})['then'](handleEntityNotFound(_0x578eb4,null))[_0xf7ad('0x13')](function(_0x4b88cc){if(_0x4b88cc){return _0x4b88cc[_0xf7ad('0x84')](null);}return null;})[_0xf7ad('0x13')](respondWithStatusCode(_0x578eb4,null))[_0xf7ad('0x1e')](handleError(_0x578eb4,null));};exports[_0xf7ad('0x85')]=function(_0x11e84d,_0x52f702){return db[_0xf7ad('0x86')][_0xf7ad('0x62')]({'where':{'id':_0x11e84d['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x52f702,null))[_0xf7ad('0x13')](function(_0x27ff1a){if(_0x27ff1a){return _0x27ff1a[_0xf7ad('0x85')](_0x11e84d['body'][_0xf7ad('0x70')],_[_0xf7ad('0x87')](_0x11e84d['body'],[_0xf7ad('0x70'),'id'])||{});}})[_0xf7ad('0x13')](respondWithResult(_0x52f702,null))[_0xf7ad('0x1e')](handleError(_0x52f702,null));};exports[_0xf7ad('0x88')]=function(_0xcbba08,_0x5eae9f){var _0x4404a9={'raw':![],'where':{}};var _0x355a31={};var _0x8641c8={'count':0x0,'rows':[]};return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0xcbba08[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x5eae9f,null))['then'](function(_0x45c945){if(_0x45c945){_0x355a31[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x86')]['rawAttributes']);_0x355a31[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0xcbba08[_0xf7ad('0x4d')]);_0x355a31[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x355a31[_0xf7ad('0x4f')],_0x355a31[_0xf7ad('0x4d')]);_0x4404a9[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x355a31[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x4404a9[_0xf7ad('0x50')]=_0x4404a9[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x4404a9[_0xf7ad('0x50')]:_0x355a31[_0xf7ad('0x4f')];if(!_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x4404a9[_0xf7ad('0x26')]=qs['limit'](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x4404a9[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0xcbba08[_0xf7ad('0x4d')]['offset']);}_0x4404a9[_0xf7ad('0x6d')]=qs['sort'](_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x4404a9[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0xcbba08[_0xf7ad('0x4d')],_0x355a31[_0xf7ad('0x57')]));_0x4404a9[_0xf7ad('0x55')]['MailAccountId']=_0x45c945['id'];if(_0xcbba08['query'][_0xf7ad('0x5a')]){_0x4404a9[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x4404a9[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x4404a9[_0xf7ad('0x50')],function(_0x263da5){var _0x5b0463={};_0x5b0463[_0x263da5]={'$like':'%'+_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x5b0463;})});}_0x4404a9=_[_0xf7ad('0x58')]({},_0x4404a9,_0xcbba08['options']);return db['MailInteraction'][_0xf7ad('0x25')]({'where':_0x4404a9['where']})[_0xf7ad('0x13')](function(_0x165aa9){_0x8641c8[_0xf7ad('0x25')]=_0x165aa9;if(_0xcbba08[_0xf7ad('0x4d')]['includeAll']){_0x4404a9[_0xf7ad('0x5b')]=[{'model':db[_0xf7ad('0x89')],'as':_0xf7ad('0x8a'),'required':![]},{'model':db['User'],'as':_0xf7ad('0x8b'),'attributes':['name',_0xf7ad('0x8c'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf7ad('0x2c'),_0xf7ad('0x8d')],'where':_0xcbba08[_0xf7ad('0x4d')][_0xf7ad('0x8e')]?{'id':_0xcbba08['query'][_0xf7ad('0x8e')]}:undefined,'required':_0xcbba08['query']['tag']?!![]:![]}];}return db['MailInteraction']['findAll'](_0x4404a9);})[_0xf7ad('0x13')](function(_0x1ffb1a){_0x8641c8[_0xf7ad('0x5d')]=_0x1ffb1a;return _0x8641c8;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0x5eae9f,_0x4404a9))[_0xf7ad('0x1e')](handleError(_0x5eae9f,null));};exports[_0xf7ad('0x8f')]=function addApplications(_0x471461,_0x43a7bb){var _0x5b0bf9=_0x471461[_0xf7ad('0x5e')]['id'];var _0x45f2e1=_0x471461[_0xf7ad('0x64')];var _0x2fa0e4=0xc8;var _0x5eb91d=null;return db['sequelize'][_0xf7ad('0x90')]({'isolationLevel':db[_0xf7ad('0x91')][_0xf7ad('0x92')]['ISOLATION_LEVELS'][_0xf7ad('0x93')]},function(_0x269b5a){return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x5b0bf9},'transaction':_0x269b5a})['then'](function(_0x2a8c4b){if(_0x2a8c4b){return db[_0xf7ad('0x94')][_0xf7ad('0x2a')]({'where':{'MailAccountId':_0x5b0bf9},'transaction':_0x269b5a})[_0xf7ad('0x13')](function(){var _0x372de6=_[_0xf7ad('0x47')](_0x45f2e1,function(_0x7cbca0){_0x7cbca0[_0xf7ad('0x6e')]=_0x5b0bf9;return _0x7cbca0;});return db['MailApplication'][_0xf7ad('0x95')](_0x372de6,{'transaction':_0x269b5a});});}else{_0x2fa0e4=0x194;_0x5eb91d=[];}});})['then'](function(){if(_0x2fa0e4!==0x194){return db['MailApplication'][_0xf7ad('0x96')]({'where':{'MailAccountId':_0x5b0bf9},'order':_0xf7ad('0x97')})[_0xf7ad('0x13')](function(_0x144077){_0x5eb91d=_0x144077;});}})[_0xf7ad('0x1e')](function(_0x2b4c88){_0x2fa0e4=0x1f4;logger[_0xf7ad('0x19')](_0x2b4c88['stack']);if(_0x2b4c88[_0xf7ad('0x2c')]){delete _0x2b4c88[_0xf7ad('0x2c')];}_0x5eb91d=_0x2b4c88;})[_0xf7ad('0x98')](function(){if(_0x5eb91d===null){_0x43a7bb[_0xf7ad('0x1f')](_0x2fa0e4);}else{if(_0x2fa0e4===0x1f4){_0x43a7bb[_0xf7ad('0x21')](_0x2fa0e4)[_0xf7ad('0x99')](_0x5eb91d);}else{_0x43a7bb['status'](_0x2fa0e4)[_0xf7ad('0x22')](_0x5eb91d);}}});};exports[_0xf7ad('0x9a')]=function(_0x4b8757,_0x523c25){var _0x146966={};var _0x38da34={};var _0x509fc3;var _0x2cc7d3;return db[_0xf7ad('0x48')][_0xf7ad('0x80')]({'where':{'id':_0x4b8757[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x523c25,null))[_0xf7ad('0x13')](function(_0x5a4eb5){if(_0x5a4eb5){_0x509fc3=_0x5a4eb5;_0x38da34[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0x94')][_0xf7ad('0x49')]);_0x38da34[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x4b8757['query']);_0x38da34[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x38da34[_0xf7ad('0x4f')],_0x38da34['query']);_0x146966[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x38da34[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x146966[_0xf7ad('0x50')]=_0x146966[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x146966[_0xf7ad('0x50')]:_0x38da34[_0xf7ad('0x4f')];_0x146966['order']=qs[_0xf7ad('0x54')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x146966[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0x4b8757[_0xf7ad('0x4d')],_0x38da34[_0xf7ad('0x57')]));if(_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x146966[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x146966[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x146966['attributes'],function(_0x4444d6){var _0x3c05b9={};_0x3c05b9[_0x4444d6]={'$like':'%'+_0x4b8757['query'][_0xf7ad('0x5a')]+'%'};return _0x3c05b9;})});}_0x146966=_[_0xf7ad('0x58')]({},_0x146966,_0x4b8757[_0xf7ad('0x61')]);return _0x509fc3['getApplications'](_0x146966);}})['then'](function(_0x3f2bf0){if(_0x3f2bf0){_0x2cc7d3=_0x3f2bf0[_0xf7ad('0x52')];if(!_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x146966['limit']=qs[_0xf7ad('0x26')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x26')]);_0x146966[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x4b8757[_0xf7ad('0x4d')][_0xf7ad('0x23')]);}return _0x509fc3[_0xf7ad('0x9a')](_0x146966);}})[_0xf7ad('0x13')](function(_0x3b0908){if(_0x3b0908){return _0x3b0908?{'count':_0x2cc7d3,'rows':_0x3b0908}:null;}})['then'](respondWithResult(_0x523c25,null))[_0xf7ad('0x1e')](handleError(_0x523c25,null));};exports[_0xf7ad('0x9b')]=function(_0x46fd93,_0xd725c0){var _0x4a238f={'raw':!![],'where':{}};var _0x43af97={};var _0x5e8f5f={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x46fd93[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0xd725c0,null))[_0xf7ad('0x13')](function(_0x298fc0){if(_0x298fc0){_0x43af97[_0xf7ad('0x4f')]=_['keys'](db[_0xf7ad('0x9c')][_0xf7ad('0x49')]);_0x43af97['query']=_[_0xf7ad('0x5f')](_0x46fd93[_0xf7ad('0x4d')]);_0x43af97[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x43af97[_0xf7ad('0x4f')],_0x43af97[_0xf7ad('0x4d')]);_0x4a238f[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x43af97[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x46fd93['query'][_0xf7ad('0x51')]));_0x4a238f[_0xf7ad('0x50')]=_0x4a238f[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x4a238f[_0xf7ad('0x50')]:_0x43af97[_0xf7ad('0x4f')];if(!_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x4a238f['limit']=qs[_0xf7ad('0x26')](_0x46fd93[_0xf7ad('0x4d')]['limit']);_0x4a238f[_0xf7ad('0x23')]=qs[_0xf7ad('0x23')](_0x46fd93[_0xf7ad('0x4d')]['offset']);}_0x4a238f[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x4a238f[_0xf7ad('0x55')]=qs['filters'](_[_0xf7ad('0x56')](_0x46fd93[_0xf7ad('0x4d')],_0x43af97[_0xf7ad('0x57')]));_0x4a238f[_0xf7ad('0x55')][_0xf7ad('0x6e')]=_0x298fc0['id'];if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x4a238f['where']=_[_0xf7ad('0x58')](_0x4a238f['where'],{'$or':_[_0xf7ad('0x47')](_0x4a238f[_0xf7ad('0x50')],function(_0x202aaa){var _0x244331={};_0x244331[_0x202aaa]={'$like':'%'+_0x46fd93[_0xf7ad('0x4d')]['filter']+'%'};return _0x244331;})});}if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x9d')]){var _0x46f29b=_0x46fd93['query'][_0xf7ad('0x9d')][_0xf7ad('0x9e')](',');var _0x34eb32={};_0x34eb32[_0x46f29b[0x0]]={'$gte':moment(_0x46f29b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a238f['where']=_[_0xf7ad('0x58')](_0x4a238f[_0xf7ad('0x55')],_0x34eb32);}_0x4a238f=_[_0xf7ad('0x58')]({},_0x4a238f,_0x46fd93[_0xf7ad('0x61')]);return db[_0xf7ad('0x9c')][_0xf7ad('0x25')]({'where':_0x4a238f['where']})[_0xf7ad('0x13')](function(_0x4f0c6d){_0x5e8f5f[_0xf7ad('0x25')]=_0x4f0c6d;if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x60')]){_0x4a238f[_0xf7ad('0x5b')]=[{'all':!![]}];}return db[_0xf7ad('0x9c')][_0xf7ad('0x5c')](_0x4a238f);})[_0xf7ad('0x13')](function(_0x1cebef){if(_0x46fd93[_0xf7ad('0x4d')][_0xf7ad('0x9f')]===_0xf7ad('0xa0')){for(var _0x3d4c5c=0x0;_0x3d4c5c<_0x1cebef[_0xf7ad('0x52')];_0x3d4c5c++){_0x1cebef[_0x3d4c5c][_0xf7ad('0x64')]=juice(_0x1cebef[_0x3d4c5c][_0xf7ad('0x64')]);}}_0x5e8f5f['rows']=_0x1cebef;return _0x5e8f5f;});}})[_0xf7ad('0x13')](respondWithFilteredResult(_0xd725c0,_0x4a238f))['catch'](handleError(_0xd725c0,null));};exports[_0xf7ad('0x99')]=function(_0x4a3144,_0x2e1dab){var _0x3371ac,_0x55f9f7={},_0x1c2965;if(_0x4a3144[_0xf7ad('0x64')]['to']){_0x1c2965=_0x4a3144[_0xf7ad('0x64')]['to'][_0xf7ad('0x9e')](',')[0x0];}return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x4a3144[_0xf7ad('0x5e')]['id']},'include':[{'model':db[_0xf7ad('0xa1')],'as':_0xf7ad('0xa2'),'include':[{'model':db[_0xf7ad('0x89')],'as':_0xf7ad('0xa3'),'where':{'email':_0x1c2965},'limit':0x1,'order':[[_0xf7ad('0xa4'),_0xf7ad('0xa5')]]}]},{'model':db[_0xf7ad('0x44')],'as':_0xf7ad('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xf7ad('0xa6'),'raw':!![]}]}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x2e1dab,null))['then'](function(_0x268f09){if(!_0x268f09)return;_0x3371ac=_0x268f09;if(!_0x268f09['Smtp'])throw new Error(_0xf7ad('0xa7'));if(_[_0xf7ad('0xa8')](_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xa9')])){_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xa9')]=util[_0xf7ad('0xaa')](_0xf7ad('0xab'),_0x268f09[_0xf7ad('0x2c')],_0x268f09[_0xf7ad('0xac')]||_0x268f09[_0xf7ad('0x42')][_0xf7ad('0x36')]);}if(_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xad')]&&_0x4a3144['body'][_0xf7ad('0xad')]['length']){for(var _0x5da19d=0x0;_0x5da19d<_0x4a3144['body'][_0xf7ad('0xad')][_0xf7ad('0x52')];_0x5da19d+=0x1){_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d]={'filename':_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d][_0xf7ad('0x2c')],'path':path[_0xf7ad('0xae')](config['root'],_0xf7ad('0xaf'),_0x4a3144[_0xf7ad('0x64')]['attachments'][_0x5da19d][_0xf7ad('0xb0')])};}}var _0x33a370=_0x268f09['getSmtpOptions']();return respondWithRpcPromise(_0xf7ad('0xb1'),_0xf7ad('0xb2'),{'account':_0x33a370,'message':_0x4a3144[_0xf7ad('0x64')]});})[_0xf7ad('0x13')](function(_0x442725){if(!_0x442725)return;_0x55f9f7=_0x442725;if(!_0x3371ac[_0xf7ad('0xa2')])throw new Error(_0xf7ad('0xb3'));if(_0x3371ac[_0xf7ad('0xa2')]['Contacts'][_0xf7ad('0x52')])return _0x3371ac[_0xf7ad('0xa2')][_0xf7ad('0xa3')][0x0];return db[_0xf7ad('0x89')]['create'](_['defaults'](_0x4a3144['body'],{'firstName':_0x4a3144[_0xf7ad('0x64')]['to'],'email':_0x4a3144[_0xf7ad('0x64')]['to'],'phone':_0x4a3144['body']['to'],'ListId':_0x3371ac[_0xf7ad('0x75')]}));})[_0xf7ad('0x13')](function(_0x149574){if(!_0x149574)return;var _0x411054={'UserId':_0x4a3144[_0xf7ad('0x36')]['id'],'ContactId':_0x149574['id'],'MailAccountId':_0x3371ac['id'],'inReplyTo':_0x55f9f7['messageId'],'to':_0x4a3144[_0xf7ad('0x64')]['from'],'cc':_0x4a3144[_0xf7ad('0x64')]['cc'],'subject':_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb4')],'attach':_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb5')],'firstMsgDirection':_0xf7ad('0xb6'),'lastMsgAt':moment()['format'](_0xf7ad('0xb7')),'lastMsgDirection':'out','Messages':[_[_0xf7ad('0x58')](_0x4a3144['body'],{'messageId':_0x55f9f7[_0xf7ad('0xb8')],'sentAt':moment()[_0xf7ad('0xaa')](_0xf7ad('0xb7')),'read':!![],'MailAccountId':_0x3371ac['id'],'UserId':_0x4a3144[_0xf7ad('0x36')]['id'],'ContactId':_0x149574['id']})]};if(_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb9')]){_0x411054=_[_0xf7ad('0x58')](_0x411054,_0x4a3144[_0xf7ad('0x64')][_0xf7ad('0xb9')]);}return db['MailInteraction']['create'](_0x411054,{'include':[{'model':db[_0xf7ad('0x9c')],'as':_0xf7ad('0xba')}]});})[_0xf7ad('0x13')](respondWithResult(_0x2e1dab,null))[_0xf7ad('0x1e')](handleError(_0x2e1dab,null));};exports['verifySmtp']=function(_0x5cc67c,_0x1cf3e7){return db['MailAccount'][_0xf7ad('0x62')]({'where':{'id':_0x5cc67c[_0xf7ad('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xf7ad('0x42'),'raw':!![],'include':[{'model':db[_0xf7ad('0xa6')],'as':_0xf7ad('0xa6'),'raw':!![]}]}]})[_0xf7ad('0x13')](handleEntityNotFound(_0x1cf3e7,null))['then'](function(_0x11fd34){if(!_0x11fd34[_0xf7ad('0x42')])return;var _0x1e162e=_0x11fd34[_0xf7ad('0xbb')]();return respondWithRpcPromise('VerifySmtp',_0xf7ad('0xbc'),{'account':_0x1e162e});})['then'](respondWithResult(_0x1cf3e7,null))[_0xf7ad('0x1e')](handleError(_0x1cf3e7,null));};exports[_0xf7ad('0x2a')]=function(_0x212dcc,_0x1a25a4){return db[_0xf7ad('0x48')]['find']({'where':{'id':_0x212dcc['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x1a25a4,null))[_0xf7ad('0x13')](function(_0x200d6f){if(_0x200d6f&&_0x200d6f[_0xf7ad('0x3f')]){throw new db[(_0xf7ad('0xbd'))][(_0xf7ad('0xbe'))](_0xf7ad('0xbf'));}return _0x200d6f;})['then'](removeEntity(_0x1a25a4,null))['catch'](handleError(_0x1a25a4,null));};exports['addAgents']=function(_0x29e78b,_0x11acf9){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x29e78b['params']['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x11acf9,null))[_0xf7ad('0x13')](function(_0x46a6b6){if(_0x46a6b6){return _0x46a6b6[_0xf7ad('0xc0')](_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')],_['omit'](_0x29e78b[_0xf7ad('0x64')],[_0xf7ad('0x70'),'id'])||{})[_0xf7ad('0xc1')](function(_0xd1ba93){for(var _0x4338bb=0x0;_0x4338bb<_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')][_0xf7ad('0x52')];_0x4338bb+=0x1){socket[_0xf7ad('0xc2')](_0xf7ad('0xc3'),{'UserId':Number(_0x29e78b[_0xf7ad('0x64')][_0xf7ad('0x70')][_0x4338bb]),'MailAccountId':Number(_0x29e78b['params']['id'])});}return _0xd1ba93;});}})[_0xf7ad('0x13')](respondWithResult(_0x11acf9,null))[_0xf7ad('0x1e')](handleError(_0x11acf9,null));};exports['removeAgents']=function(_0x169d58,_0x428a35){return db[_0xf7ad('0x48')][_0xf7ad('0x62')]({'where':{'id':_0x169d58[_0xf7ad('0x5e')]['id']}})[_0xf7ad('0x13')](handleEntityNotFound(_0x428a35,null))[_0xf7ad('0x13')](function(_0x13e92e){if(_0x13e92e){return _0x13e92e['removeAgents'](_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')])[_0xf7ad('0x13')](function(){if(_[_0xf7ad('0xc4')](_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')])){for(var _0x5ceea8=0x0;_0x5ceea8<_0x169d58[_0xf7ad('0x4d')]['ids'][_0xf7ad('0x52')];_0x5ceea8+=0x1){socket[_0xf7ad('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x169d58['query'][_0xf7ad('0x70')][_0x5ceea8]),'MailAccountId':Number(_0x169d58[_0xf7ad('0x5e')]['id'])});}}else{socket['emit'](_0xf7ad('0xc5'),{'UserId':Number(_0x169d58[_0xf7ad('0x4d')][_0xf7ad('0x70')]),'MailAccountId':Number(_0x169d58['params']['id'])});}});}})[_0xf7ad('0x13')](respondWithStatusCode(_0x428a35,null))['catch'](handleError(_0x428a35,null));};exports['getAgents']=function(_0x4a1bfc,_0xfe9f85){var _0x2dc942={};var _0x422c78={};var _0x33a72e;var _0x5f41eb;return db['MailAccount'][_0xf7ad('0x80')]({'where':{'id':_0x4a1bfc[_0xf7ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0xfe9f85,null))[_0xf7ad('0x13')](function(_0x311b32){if(_0x311b32){_0x33a72e=_0x311b32;_0x422c78[_0xf7ad('0x4f')]=_[_0xf7ad('0x5f')](db[_0xf7ad('0xc6')][_0xf7ad('0x49')]);_0x422c78[_0xf7ad('0x4d')]=_[_0xf7ad('0x5f')](_0x4a1bfc['query']);_0x422c78[_0xf7ad('0x57')]=_[_0xf7ad('0x4e')](_0x422c78[_0xf7ad('0x4f')],_0x422c78[_0xf7ad('0x4d')]);_0x2dc942[_0xf7ad('0x50')]=_[_0xf7ad('0x4e')](_0x422c78[_0xf7ad('0x4f')],qs[_0xf7ad('0x51')](_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x51')]));_0x2dc942[_0xf7ad('0x50')]=_0x2dc942[_0xf7ad('0x50')][_0xf7ad('0x52')]?_0x2dc942[_0xf7ad('0x50')]:_0x422c78[_0xf7ad('0x4f')];_0x2dc942[_0xf7ad('0x6d')]=qs[_0xf7ad('0x54')](_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x54')]);_0x2dc942[_0xf7ad('0x55')]=qs[_0xf7ad('0x57')](_[_0xf7ad('0x56')](_0x4a1bfc[_0xf7ad('0x4d')],_0x422c78[_0xf7ad('0x57')]));if(_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x5a')]){_0x2dc942[_0xf7ad('0x55')]=_[_0xf7ad('0x58')](_0x2dc942[_0xf7ad('0x55')],{'$or':_[_0xf7ad('0x47')](_0x2dc942[_0xf7ad('0x50')],function(_0x612c50){var _0x560fcb={};_0x560fcb[_0x612c50]={'$like':'%'+_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x5a')]+'%'};return _0x560fcb;})});}_0x2dc942=_['merge']({},_0x2dc942,_0x4a1bfc[_0xf7ad('0x61')]);return _0x33a72e['getAgents'](_0x2dc942);}})[_0xf7ad('0x13')](function(_0x43185e){if(_0x43185e){_0x5f41eb=_0x43185e['length'];if(!_0x4a1bfc[_0xf7ad('0x4d')][_0xf7ad('0x6c')](_0xf7ad('0x53'))){_0x2dc942[_0xf7ad('0x26')]=qs['limit'](_0x4a1bfc[_0xf7ad('0x4d')]['limit']);_0x2dc942['offset']=qs[_0xf7ad('0x23')](_0x4a1bfc['query']['offset']);}return _0x33a72e['getAgents'](_0x2dc942);}})[_0xf7ad('0x13')](function(_0xc44465){if(_0xc44465){return _0xc44465?{'count':_0x5f41eb,'rows':_0xc44465}:null;}})[_0xf7ad('0x13')](respondWithResult(_0xfe9f85,null))['catch'](handleError(_0xfe9f85,null));}; \ No newline at end of file +var _0x3233=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','service','authentication','Smtp','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','intersection','body','provider','custom','secure','find','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','map','findAll','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','ValidationError','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0xe54b2e,_0x456c13){var _0x41b0e9=function(_0xe7b287){while(--_0xe7b287){_0xe54b2e['push'](_0xe54b2e['shift']());}};_0x41b0e9(++_0x456c13);}(_0x3233,0x172));var _0x3323=function(_0x17380,_0x1c6714){_0x17380=_0x17380-0x0;var _0x2f4cc9=_0x3233[_0x17380];return _0x2f4cc9;};'use strict';var moment=require('moment');var BPromise=require(_0x3323('0x0'));var util=require(_0x3323('0x1'));var path=require(_0x3323('0x2'));var _=require(_0x3323('0x3'));var juice=require(_0x3323('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x3323('0x5'))['db'];config['redis']=_[_0x3323('0x6')](config[_0x3323('0x7')],{'host':_0x3323('0x8'),'port':0x18eb});var socket=require(_0x3323('0x9'))(new Redis(config['redis']));require(_0x3323('0xa'))[_0x3323('0xb')](socket);var jayson=require(_0x3323('0xc'));var client=jayson[_0x3323('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4bfded,_0x1eaa30,_0x5e5103,_0x5830ab){return new BPromise(function(_0x114bd8,_0x1983f6){var _0x10ffa1=_0x5830ab||client;return _0x10ffa1[_0x3323('0xe')](_0x4bfded,_0x5e5103)['then'](function(_0x2bf799){logger['info'](_0x3323('0xf'),_0x1eaa30,_0x3323('0x10'));logger['debug'](_0x3323('0x11'),_0x1eaa30,_0x3323('0x10'),JSON['stringify'](_0x2bf799));if(_0x2bf799[_0x3323('0x12')]){if(_0x2bf799[_0x3323('0x12')]['code']===0x1f4){logger[_0x3323('0x12')](_0x3323('0xf'),_0x1eaa30,_0x2bf799['error'][_0x3323('0x13')]);return _0x1983f6(_0x2bf799[_0x3323('0x12')]['message']);}logger[_0x3323('0x12')](_0x3323('0xf'),_0x1eaa30,_0x2bf799['error'][_0x3323('0x13')]);return _0x114bd8(_0x2bf799[_0x3323('0x12')][_0x3323('0x13')]);}else{logger[_0x3323('0x14')](_0x3323('0xf'),_0x1eaa30,'request\x20sent');_0x114bd8(_0x2bf799['result']['message']);}})[_0x3323('0x15')](function(_0x499b5a){logger['error'](_0x3323('0xf'),_0x1eaa30,_0x499b5a);_0x1983f6(_0x499b5a);});});}function respondWithStatusCode(_0x46928d,_0x286f57){_0x286f57=_0x286f57||0xcc;return function(_0x370dbc){if(_0x370dbc){return _0x46928d[_0x3323('0x16')](_0x286f57);}return _0x46928d['status'](_0x286f57)[_0x3323('0x17')]();};}function respondWithResult(_0x38a32b,_0x45d6a4){_0x45d6a4=_0x45d6a4||0xc8;return function(_0xd2ba82){if(_0xd2ba82){return _0x38a32b[_0x3323('0x18')](_0x45d6a4)[_0x3323('0x19')](_0xd2ba82);}};}function respondWithFilteredResult(_0x213475,_0x26e57a){return function(_0x22baf5){if(_0x22baf5){var _0x5c8ad2=typeof _0x26e57a[_0x3323('0x1a')]===_0x3323('0x1b')&&typeof _0x26e57a[_0x3323('0x1c')]===_0x3323('0x1b');var _0x5ea960=_0x22baf5[_0x3323('0x1d')];var _0x21b66b=_0x5c8ad2?0x0:_0x26e57a[_0x3323('0x1a')];var _0x2acbac=_0x5c8ad2?_0x22baf5['count']:_0x26e57a['offset']+_0x26e57a['limit'];var _0x526f13;if(_0x2acbac>=_0x5ea960){_0x2acbac=_0x5ea960;_0x526f13=0xc8;}else{_0x526f13=0xce;}_0x213475[_0x3323('0x18')](_0x526f13);return _0x213475[_0x3323('0x1e')](_0x3323('0x1f'),_0x21b66b+'-'+_0x2acbac+'/'+_0x5ea960)[_0x3323('0x19')](_0x22baf5);}return null;};}function saveUpdates(_0x2ac55a){return function(_0x49985f){if(_0x49985f){return _0x49985f[_0x3323('0x20')](_0x2ac55a)[_0x3323('0x21')](function(_0x274ebb){return _0x274ebb;});}return null;};}function removeEntity(_0x42a47e){return function(_0x1c0002){if(_0x1c0002){return _0x1c0002[_0x3323('0x22')]()['then'](function(){var _0x39600d=_0x1c0002[_0x3323('0x23')]({'plain':!![]});var _0x40896f=_0x3323('0x24');return db[_0x3323('0x25')][_0x3323('0x22')]({'where':{'type':_0x40896f,'resourceId':_0x39600d['id']}})[_0x3323('0x21')](function(){return _0x1c0002;});})[_0x3323('0x21')](function(){_0x42a47e[_0x3323('0x18')](0xcc)[_0x3323('0x17')]();});}};}function handleEntityNotFound(_0x2a53f1){return function(_0x13c889){if(!_0x13c889){_0x2a53f1[_0x3323('0x16')](0x194);}return _0x13c889;};}function handleError(_0x27a2e6,_0x5d38d3){_0x5d38d3=_0x5d38d3||0x1f4;return function(_0x254e36){logger[_0x3323('0x12')](_0x254e36[_0x3323('0x26')]);if(_0x254e36[_0x3323('0x27')]){delete _0x254e36[_0x3323('0x27')];}_0x27a2e6[_0x3323('0x18')](_0x5d38d3)['send'](_0x254e36);};}function getImapHost(_0xbfbdea){switch(_0xbfbdea){case _0x3323('0x28'):return _0x3323('0x29');case _0x3323('0x2a'):return _0x3323('0x2b');case _0x3323('0x2c'):return _0x3323('0x2d');case _0x3323('0x2e'):return _0x3323('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0xbfbdea);}function getSmtpHost(_0xdf88d1){switch(_0xdf88d1){case _0x3323('0x28'):return _0x3323('0x30');case'yahoo':return _0x3323('0x31');case _0x3323('0x2c'):return _0x3323('0x32');case _0x3323('0x2e'):return _0x3323('0x33');}throw new Error(_0x3323('0x34'),_0xdf88d1);}function getAuthenticationOptions(_0x29d82d,_0x5a92c1){var _0x202ceb={};var _0x466d25={};if(_0x29d82d){_0x202ceb[_0x3323('0x35')]=_0x466d25[_0x3323('0x35')]=_0x5a92c1[_0x3323('0x36')];_0x202ceb[_0x3323('0x37')]=_0x466d25['pass']=_0x5a92c1[_0x3323('0x37')];if(_0x5a92c1['modernAuthentication']){_0x202ceb[_0x3323('0x38')]=_0x466d25[_0x3323('0x38')]=!![];_0x202ceb['CloudProviderId']=_0x466d25['CloudProviderId']=_0x5a92c1[_0x3323('0x39')];_0x202ceb[_0x3323('0x37')]=_0x466d25[_0x3323('0x3a')]=null;}else{_0x202ceb[_0x3323('0x39')]=_0x466d25[_0x3323('0x39')]=null;}_0x202ceb[_0x3323('0x3b')]=getImapHost(_0x29d82d);_0x202ceb[_0x3323('0x3c')]=0x3e1;_0x466d25[_0x3323('0x3b')]=getSmtpHost(_0x29d82d);_0x466d25[_0x3323('0x3c')]=0x24b;_0x466d25['secure']=![];_0x202ceb['service']=_0x466d25[_0x3323('0x3d')]=null;}else{if(_0x5a92c1[_0x3323('0x3e')]){_0x202ceb[_0x3323('0x35')]=_0x466d25['user']=_0x5a92c1['username'];_0x202ceb[_0x3323('0x37')]=_0x466d25[_0x3323('0x3a')]=_0x5a92c1[_0x3323('0x37')];}else{_0x202ceb[_0x3323('0x3e')]=_0x466d25[_0x3323('0x3e')]=![];_0x202ceb[_0x3323('0x35')]=_0x466d25[_0x3323('0x35')]=null;_0x202ceb[_0x3323('0x37')]=_0x466d25[_0x3323('0x3a')]=null;}_0x202ceb[_0x3323('0x3b')]=_0x5a92c1['Imap'][_0x3323('0x3b')];_0x202ceb['port']=_0x5a92c1['Imap']['port'];_0x466d25['host']=_0x5a92c1[_0x3323('0x3f')][_0x3323('0x3b')];_0x466d25[_0x3323('0x3c')]=_0x5a92c1[_0x3323('0x3f')][_0x3323('0x3c')];}return{'Imap':_0x202ceb,'Smtp':_0x466d25};}exports[_0x3323('0x40')]=function(_0x295516,_0x557ef2){var _0x458f24={'include':[{'model':db['MailServerIn'],'as':_0x3323('0x41')},{'model':db[_0x3323('0x42')],'as':'Smtp'},{'model':db[_0x3323('0x43')],'as':_0x3323('0x44')}]},_0xdcac43={},_0x5052b2={'count':0x0,'rows':[]};var _0x1c12ac=_['map'](db[_0x3323('0x45')][_0x3323('0x46')],function(_0x229bb1){return{'name':_0x229bb1[_0x3323('0x47')],'type':_0x229bb1[_0x3323('0x48')][_0x3323('0x49')]};});_0xdcac43['model']=_['map'](_0x1c12ac,_0x3323('0x27'));_0xdcac43[_0x3323('0x4a')]=_['keys'](_0x295516['query']);_0xdcac43['filters']=_['intersection'](_0xdcac43[_0x3323('0x4b')],_0xdcac43[_0x3323('0x4a')]);_0x458f24['attributes']=_['intersection'](_0xdcac43['model'],qs[_0x3323('0x4c')](_0x295516[_0x3323('0x4a')][_0x3323('0x4c')]));_0x458f24['attributes']=_0x458f24[_0x3323('0x4d')][_0x3323('0x4e')]?_0x458f24[_0x3323('0x4d')]:_0xdcac43[_0x3323('0x4b')];if(!_0x295516[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x458f24[_0x3323('0x1c')]=qs[_0x3323('0x1c')](_0x295516[_0x3323('0x4a')]['limit']);_0x458f24[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x295516[_0x3323('0x4a')][_0x3323('0x1a')]);}_0x458f24[_0x3323('0x51')]=qs[_0x3323('0x52')](_0x295516[_0x3323('0x4a')][_0x3323('0x52')]);_0x458f24[_0x3323('0x53')]=qs[_0x3323('0x54')](_[_0x3323('0x55')](_0x295516[_0x3323('0x4a')],_0xdcac43['filters']),_0x1c12ac);if(_0x295516['query'][_0x3323('0x56')]){_0x458f24[_0x3323('0x53')]=_[_0x3323('0x57')](_0x458f24[_0x3323('0x53')],{'$or':_['map'](_0x1c12ac,function(_0x1d381a){if(_0x1d381a[_0x3323('0x48')]!==_0x3323('0x58')){var _0x41d9e1={};_0x41d9e1[_0x1d381a[_0x3323('0x27')]]={'$like':'%'+_0x295516[_0x3323('0x4a')][_0x3323('0x56')]+'%'};return _0x41d9e1;}})});}_0x458f24=_[_0x3323('0x57')]({},_0x458f24,_0x295516[_0x3323('0x59')]);var _0x2db44e={'where':_0x458f24['where']};return db[_0x3323('0x45')][_0x3323('0x1d')](_0x2db44e)[_0x3323('0x21')](function(_0x4dd707){_0x5052b2[_0x3323('0x1d')]=_0x4dd707;if(_0x295516[_0x3323('0x4a')][_0x3323('0x5a')]){_0x458f24[_0x3323('0x5b')]=[{'all':!![]}];}return db[_0x3323('0x45')]['findAll'](_0x458f24);})['then'](function(_0x3f9157){_0x5052b2[_0x3323('0x5c')]=_0x3f9157;return _0x5052b2;})[_0x3323('0x21')](respondWithFilteredResult(_0x557ef2,_0x458f24))[_0x3323('0x15')](handleError(_0x557ef2,null));};exports[_0x3323('0x5d')]=function(_0x132cdd,_0x4e02cc){var _0x16de05={'raw':![],'where':{'id':_0x132cdd[_0x3323('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3323('0x41')},{'model':db[_0x3323('0x42')],'as':'Smtp'},{'model':db[_0x3323('0x43')],'as':_0x3323('0x44')}]},_0x1f9c2a={};_0x1f9c2a['model']=_[_0x3323('0x5f')](db[_0x3323('0x45')]['rawAttributes']);_0x1f9c2a[_0x3323('0x4a')]=_[_0x3323('0x5f')](_0x132cdd[_0x3323('0x4a')]);_0x1f9c2a[_0x3323('0x54')]=_[_0x3323('0x60')](_0x1f9c2a[_0x3323('0x4b')],_0x1f9c2a['query']);_0x16de05[_0x3323('0x4d')]=_[_0x3323('0x60')](_0x1f9c2a['model'],qs[_0x3323('0x4c')](_0x132cdd[_0x3323('0x4a')][_0x3323('0x4c')]));_0x16de05[_0x3323('0x4d')]=_0x16de05[_0x3323('0x4d')][_0x3323('0x4e')]?_0x16de05[_0x3323('0x4d')]:_0x1f9c2a[_0x3323('0x4b')];if(_0x132cdd[_0x3323('0x4a')][_0x3323('0x5a')]){_0x16de05[_0x3323('0x5b')]=[{'all':!![]}];}_0x16de05=_[_0x3323('0x57')]({},_0x16de05,_0x132cdd[_0x3323('0x59')]);return db[_0x3323('0x45')]['find'](_0x16de05)[_0x3323('0x21')](handleEntityNotFound(_0x4e02cc,null))[_0x3323('0x21')](respondWithResult(_0x4e02cc,null))['catch'](handleError(_0x4e02cc,null));};exports[_0x3323('0x20')]=function(_0x4851c5,_0x43a900){if(_0x4851c5['body']['id']){delete _0x4851c5[_0x3323('0x61')]['id'];}var _0x40c5bb=_0x4851c5[_0x3323('0x61')][_0x3323('0x62')]===_0x3323('0x63')?null:_0x4851c5['body'][_0x3323('0x62')];var _0x28db2a=_0x4851c5['body'][_0x3323('0x41')]||{};var _0x1f40ef=_0x4851c5[_0x3323('0x61')]['Smtp']||{};if(_0x40c5bb){_0x28db2a[_0x3323('0x3b')]=getImapHost(_0x40c5bb);_0x28db2a['port']=0x3e1;_0x1f40ef[_0x3323('0x3b')]=getSmtpHost(_0x40c5bb);_0x1f40ef['port']=0x24b;_0x1f40ef[_0x3323('0x64')]=![];}if(_0x1f40ef[_0x3323('0x38')]){_0x1f40ef['secure']=![];}else{_0x1f40ef[_0x3323('0x39')]=null;}if(!_0x28db2a[_0x3323('0x38')])_0x28db2a[_0x3323('0x39')]=null;_0x4851c5[_0x3323('0x61')][_0x3323('0x41')]=_0x28db2a;_0x4851c5[_0x3323('0x61')][_0x3323('0x3f')]=_0x1f40ef;return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x4851c5['params']['id']},'include':[{'model':db[_0x3323('0x66')],'as':'Imap'},{'model':db[_0x3323('0x42')],'as':'Smtp'},{'model':db[_0x3323('0x43')],'as':_0x3323('0x44')}]})[_0x3323('0x21')](handleEntityNotFound(_0x43a900,null))[_0x3323('0x21')](function(_0x4f0cc9){if(!_0x4f0cc9)throw new Error(_0x3323('0x67'));if(_0x4f0cc9[_0x3323('0x3d')])delete _0x4851c5[_0x3323('0x61')]['Imap'];return _0x4f0cc9;})[_0x3323('0x21')](saveUpdates(_0x4851c5[_0x3323('0x61')],null))[_0x3323('0x21')](function(_0x562754){if(!_0x4851c5[_0x3323('0x61')]['Imap'])return _0x562754;return db[_0x3323('0x66')][_0x3323('0x20')](_0x4851c5['body'][_0x3323('0x41')],{'where':{'MailAccountId':_0x562754['id']}})['then'](function(){return _0x562754;});})[_0x3323('0x21')](function(_0xf6eda6){if(!_0x4851c5[_0x3323('0x61')][_0x3323('0x3f')])return _0xf6eda6;return db['MailServerOut']['update'](_0x4851c5[_0x3323('0x61')][_0x3323('0x3f')],{'where':{'MailAccountId':_0xf6eda6['id']}})[_0x3323('0x21')](function(){return _0xf6eda6;});})[_0x3323('0x21')](respondWithResult(_0x43a900,null))['catch'](handleError(_0x43a900,null));};exports[_0x3323('0x68')]=function(_0x4ce904,_0x1e49bc){return db[_0x3323('0x45')][_0x3323('0x68')]()[_0x3323('0x21')](respondWithResult(_0x1e49bc,null))[_0x3323('0x15')](handleError(_0x1e49bc,null));};exports[_0x3323('0x69')]=function(_0x2203b5,_0x2d3678){if(_0x2203b5[_0x3323('0x61')]['id']){delete _0x2203b5[_0x3323('0x61')]['id'];}return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x2203b5['params']['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x2d3678,null))['then'](function(_0x23b1a1){if(_0x23b1a1){_0x2203b5[_0x3323('0x61')][_0x3323('0x6a')]=_0x23b1a1['id'];return db['Disposition']['create'](_0x2203b5['body']);}})[_0x3323('0x21')](respondWithResult(_0x2d3678,null))[_0x3323('0x15')](handleError(_0x2d3678,null));};exports[_0x3323('0x6b')]=function(_0x15e841,_0x157182){var _0x1b5659={'raw':![],'where':{}};var _0x3dd35f={};var _0x5eef18={'count':0x0,'rows':[]};return db[_0x3323('0x45')][_0x3323('0x6c')]({'where':{'id':_0x15e841[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x157182,null))['then'](function(_0x188633){if(_0x188633){_0x3dd35f['model']=_[_0x3323('0x5f')](db[_0x3323('0x6d')]['rawAttributes']);_0x3dd35f['query']=_['keys'](_0x15e841[_0x3323('0x4a')]);_0x3dd35f[_0x3323('0x54')]=_['intersection'](_0x3dd35f[_0x3323('0x4b')],_0x3dd35f['query']);_0x1b5659['attributes']=_[_0x3323('0x60')](_0x3dd35f[_0x3323('0x4b')],qs[_0x3323('0x4c')](_0x15e841[_0x3323('0x4a')][_0x3323('0x4c')]));_0x1b5659[_0x3323('0x4d')]=_0x1b5659[_0x3323('0x4d')][_0x3323('0x4e')]?_0x1b5659[_0x3323('0x4d')]:_0x3dd35f['model'];if(!_0x15e841[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x1b5659[_0x3323('0x1c')]=qs[_0x3323('0x1c')](_0x15e841[_0x3323('0x4a')]['limit']);_0x1b5659[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x15e841[_0x3323('0x4a')][_0x3323('0x1a')]);}_0x1b5659[_0x3323('0x51')]=qs[_0x3323('0x52')](_0x15e841[_0x3323('0x4a')][_0x3323('0x52')]);_0x1b5659['where']=qs[_0x3323('0x54')](_[_0x3323('0x55')](_0x15e841[_0x3323('0x4a')],_0x3dd35f[_0x3323('0x54')]));_0x1b5659[_0x3323('0x53')][_0x3323('0x6a')]=_0x188633['id'];if(_0x15e841[_0x3323('0x4a')]['filter']){_0x1b5659[_0x3323('0x53')]=_[_0x3323('0x57')](_0x1b5659[_0x3323('0x53')],{'$or':_[_0x3323('0x6e')](_0x1b5659[_0x3323('0x4d')],function(_0x45e204){var _0xc0b36c={};_0xc0b36c[_0x45e204]={'$like':'%'+_0x15e841[_0x3323('0x4a')][_0x3323('0x56')]+'%'};return _0xc0b36c;})});}_0x1b5659=_['merge']({},_0x1b5659,_0x15e841[_0x3323('0x59')]);return db[_0x3323('0x6d')]['count']({'where':_0x1b5659[_0x3323('0x53')]})[_0x3323('0x21')](function(_0x317f0a){_0x5eef18['count']=_0x317f0a;if(_0x15e841['query']['includeAll']){_0x1b5659[_0x3323('0x5b')]=[{'all':!![]}];}return db[_0x3323('0x6d')][_0x3323('0x6f')](_0x1b5659);})[_0x3323('0x21')](function(_0x4e44d6){_0x5eef18[_0x3323('0x5c')]=_0x4e44d6;return _0x5eef18;});}})['then'](respondWithFilteredResult(_0x157182,_0x1b5659))[_0x3323('0x15')](handleError(_0x157182,null));};exports[_0x3323('0x70')]=function(_0x362e97,_0x7197a){return db[_0x3323('0x45')]['find']({'where':{'id':_0x362e97[_0x3323('0x5e')]['id']}})['then'](handleEntityNotFound(_0x7197a,null))[_0x3323('0x21')](function(_0x3c89c3){if(_0x3c89c3){return _0x3c89c3['removeDispositions'](_0x362e97['query'][_0x3323('0x71')]);}})[_0x3323('0x21')](respondWithStatusCode(_0x7197a,null))[_0x3323('0x15')](handleError(_0x7197a,null));};exports[_0x3323('0x72')]=function(_0x3fbc4f,_0x3b0f02){if(_0x3fbc4f[_0x3323('0x61')]['id']){delete _0x3fbc4f['body']['id'];}return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x3fbc4f[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x3b0f02,null))[_0x3323('0x21')](function(_0x24f365){if(_0x24f365){_0x3fbc4f['body'][_0x3323('0x6a')]=_0x24f365['id'];return db['CannedAnswer'][_0x3323('0x73')](_0x3fbc4f[_0x3323('0x61')]);}})[_0x3323('0x21')](respondWithResult(_0x3b0f02,null))[_0x3323('0x15')](handleError(_0x3b0f02,null));};exports[_0x3323('0x74')]=function(_0x5d891d,_0x19c52f){var _0x4de76d={'raw':![],'where':{}};var _0x5e2dd4={};var _0x164f11={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5d891d[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x19c52f,null))[_0x3323('0x21')](function(_0x1c2944){if(_0x1c2944){_0x5e2dd4[_0x3323('0x4b')]=_[_0x3323('0x5f')](db[_0x3323('0x75')][_0x3323('0x46')]);_0x5e2dd4[_0x3323('0x4a')]=_[_0x3323('0x5f')](_0x5d891d[_0x3323('0x4a')]);_0x5e2dd4[_0x3323('0x54')]=_[_0x3323('0x60')](_0x5e2dd4[_0x3323('0x4b')],_0x5e2dd4['query']);_0x4de76d[_0x3323('0x4d')]=_[_0x3323('0x60')](_0x5e2dd4[_0x3323('0x4b')],qs['fields'](_0x5d891d[_0x3323('0x4a')][_0x3323('0x4c')]));_0x4de76d['attributes']=_0x4de76d[_0x3323('0x4d')][_0x3323('0x4e')]?_0x4de76d[_0x3323('0x4d')]:_0x5e2dd4['model'];if(!_0x5d891d[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x4de76d['limit']=qs[_0x3323('0x1c')](_0x5d891d[_0x3323('0x4a')][_0x3323('0x1c')]);_0x4de76d[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x5d891d[_0x3323('0x4a')][_0x3323('0x1a')]);}_0x4de76d[_0x3323('0x51')]=qs['sort'](_0x5d891d[_0x3323('0x4a')][_0x3323('0x52')]);_0x4de76d[_0x3323('0x53')]=qs[_0x3323('0x54')](_[_0x3323('0x55')](_0x5d891d[_0x3323('0x4a')],_0x5e2dd4[_0x3323('0x54')]));_0x4de76d['where'][_0x3323('0x6a')]=_0x1c2944['id'];if(_0x5d891d[_0x3323('0x4a')][_0x3323('0x56')]){_0x4de76d[_0x3323('0x53')]=_['merge'](_0x4de76d[_0x3323('0x53')],{'$or':_[_0x3323('0x6e')](_0x4de76d[_0x3323('0x4d')],function(_0x46c73a){var _0x496395={};_0x496395[_0x46c73a]={'$like':'%'+_0x5d891d['query'][_0x3323('0x56')]+'%'};return _0x496395;})});}_0x4de76d=_['merge']({},_0x4de76d,_0x5d891d[_0x3323('0x59')]);return db[_0x3323('0x75')]['count']({'where':_0x4de76d[_0x3323('0x53')]})['then'](function(_0x27c426){_0x164f11[_0x3323('0x1d')]=_0x27c426;if(_0x5d891d[_0x3323('0x4a')][_0x3323('0x5a')]){_0x4de76d['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x3323('0x6f')](_0x4de76d);})[_0x3323('0x21')](function(_0x419cd6){_0x164f11['rows']=_0x419cd6;return _0x164f11;});}})['then'](respondWithFilteredResult(_0x19c52f,_0x4de76d))['catch'](handleError(_0x19c52f,null));};exports['removeAnswers']=function(_0x249804,_0x43b8bd){return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x249804[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x43b8bd,null))['then'](function(_0xa7f562){if(_0xa7f562){return _0xa7f562[_0x3323('0x76')](_0x249804[_0x3323('0x4a')][_0x3323('0x71')]);}})[_0x3323('0x21')](respondWithStatusCode(_0x43b8bd,null))[_0x3323('0x15')](handleError(_0x43b8bd,null));};exports['create']=function(_0x456957,_0x31168e){var _0x26cd1e={'name':_0x456957[_0x3323('0x61')]['name'],'key':_0x456957[_0x3323('0x61')][_0x3323('0x49')],'provider':_0x456957['body'][_0x3323('0x62')]==='custom'?null:_0x456957[_0x3323('0x61')]['provider'],'email':_0x456957[_0x3323('0x61')][_0x3323('0x77')],'ListId':_0x456957[_0x3323('0x61')]['ListId'],'active':!_['isNil'](_0x456957[_0x3323('0x61')]['active'])?_0x456957[_0x3323('0x61')][_0x3323('0x78')]:!![],'description':_0x456957[_0x3323('0x61')][_0x3323('0x79')]||null};var _0x5d89e1=getAuthenticationOptions(_0x26cd1e['provider'],_0x456957[_0x3323('0x61')]);_0x26cd1e[_0x3323('0x41')]=_0x5d89e1[_0x3323('0x41')];_0x26cd1e['Smtp']=_0x5d89e1[_0x3323('0x3f')];return db[_0x3323('0x45')]['create'](_0x26cd1e,{'include':[{'model':db['MailServerOut'],'as':_0x3323('0x3f')},{'model':db[_0x3323('0x66')],'as':_0x3323('0x41')}]})[_0x3323('0x21')](function(_0x3ef048){var _0x1354ae=_0x456957[_0x3323('0x35')]['get']({'plain':!![]});if(!_0x1354ae)throw new Error(_0x3323('0x7a'));if(_0x1354ae[_0x3323('0x7b')]==='user'){var _0x157631=_0x3ef048[_0x3323('0x23')]({'plain':!![]});return db[_0x3323('0x7c')][_0x3323('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0x1354ae[_0x3323('0x7d')]},'raw':!![]})[_0x3323('0x21')](function(_0x578916){if(_0x578916&&_0x578916[_0x3323('0x7e')]===0x0){return db['UserProfileResource'][_0x3323('0x73')]({'name':_0x157631['name'],'resourceId':_0x157631['id'],'type':_0x578916['name'],'sectionId':_0x578916['id']},{})['then'](function(){return _0x3ef048;});}else{return _0x3ef048;}})[_0x3323('0x15')](function(_0x2986e2){logger[_0x3323('0x12')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2986e2);throw _0x2986e2;});}return _0x3ef048;})['then'](respondWithResult(_0x31168e,0xc9))[_0x3323('0x15')](handleError(_0x31168e,null));};exports[_0x3323('0x7f')]=function(_0x529363,_0x1f203a){return db[_0x3323('0x45')]['findOne']({'where':{'id':_0x529363[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x1f203a,null))[_0x3323('0x21')](function(_0x2cd781){if(_0x2cd781){return _0x2cd781[_0x3323('0x7f')]();}return null;})[_0x3323('0x21')](respondWithResult(_0x1f203a,null))[_0x3323('0x15')](handleError(_0x1f203a,null));};exports[_0x3323('0x80')]=function(_0x3954c5,_0x668d6e){if(_0x3954c5[_0x3323('0x61')]['id']){delete _0x3954c5[_0x3323('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3954c5[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x668d6e,null))[_0x3323('0x21')](function(_0x3a1afb){if(_0x3a1afb){_0x3954c5[_0x3323('0x61')][_0x3323('0x6a')]=_0x3a1afb['id'];return db['MailServerIn'][_0x3323('0x73')](_0x3954c5['body']);}})[_0x3323('0x21')](respondWithResult(_0x668d6e,null))[_0x3323('0x15')](handleError(_0x668d6e,null));};exports[_0x3323('0x81')]=function(_0x3decf9,_0x1a64ea){return db['MailAccount'][_0x3323('0x6c')]({'where':{'id':_0x3decf9[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x1a64ea,null))['then'](function(_0x31b622){if(_0x31b622){return _0x31b622[_0x3323('0x82')](null);}return null;})[_0x3323('0x21')](respondWithStatusCode(_0x1a64ea,null))[_0x3323('0x15')](handleError(_0x1a64ea,null));};exports[_0x3323('0x83')]=function(_0x27bb77,_0x451585){return db['MailAccount'][_0x3323('0x6c')]({'where':{'id':_0x27bb77['params']['id']}})['then'](handleEntityNotFound(_0x451585,null))[_0x3323('0x21')](function(_0xc58ab5){if(_0xc58ab5){return _0xc58ab5['getSmtp']();}return null;})['then'](respondWithResult(_0x451585,null))[_0x3323('0x15')](handleError(_0x451585,null));};exports[_0x3323('0x84')]=function(_0x20ef4b,_0x53a308){if(_0x20ef4b[_0x3323('0x61')]['id']){delete _0x20ef4b[_0x3323('0x61')]['id'];}return db['MailAccount'][_0x3323('0x65')]({'where':{'id':_0x20ef4b[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x53a308,null))[_0x3323('0x21')](function(_0x2c2669){if(_0x2c2669){_0x20ef4b[_0x3323('0x61')]['MailAccountId']=_0x2c2669['id'];return db[_0x3323('0x42')]['create'](_0x20ef4b[_0x3323('0x61')]);}})[_0x3323('0x21')](respondWithResult(_0x53a308,null))['catch'](handleError(_0x53a308,null));};exports['removeSmtp']=function(_0x3bd28f,_0x14b48d){return db[_0x3323('0x45')]['findOne']({'where':{'id':_0x3bd28f[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x14b48d,null))[_0x3323('0x21')](function(_0x565f27){if(_0x565f27){return _0x565f27['setSmtp'](null);}return null;})[_0x3323('0x21')](respondWithStatusCode(_0x14b48d,null))[_0x3323('0x15')](handleError(_0x14b48d,null));};exports[_0x3323('0x85')]=function(_0x18f31d,_0x52810d){return db[_0x3323('0x86')][_0x3323('0x65')]({'where':{'id':_0x18f31d[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x52810d,null))['then'](function(_0x4d365f){if(_0x4d365f){return _0x4d365f[_0x3323('0x85')](_0x18f31d[_0x3323('0x61')][_0x3323('0x71')],_[_0x3323('0x87')](_0x18f31d['body'],[_0x3323('0x71'),'id'])||{});}})['then'](respondWithResult(_0x52810d,null))[_0x3323('0x15')](handleError(_0x52810d,null));};exports[_0x3323('0x88')]=function(_0x391b30,_0x32052d){var _0x42d067={'raw':![],'where':{}};var _0x15deb0={};var _0x18d844={'count':0x0,'rows':[]};return db[_0x3323('0x45')][_0x3323('0x6c')]({'where':{'id':_0x391b30[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x32052d,null))[_0x3323('0x21')](function(_0x49f3f6){if(_0x49f3f6){_0x15deb0[_0x3323('0x4b')]=_['keys'](db[_0x3323('0x86')]['rawAttributes']);_0x15deb0[_0x3323('0x4a')]=_['keys'](_0x391b30[_0x3323('0x4a')]);_0x15deb0[_0x3323('0x54')]=_['intersection'](_0x15deb0['model'],_0x15deb0['query']);_0x42d067[_0x3323('0x4d')]=_[_0x3323('0x60')](_0x15deb0[_0x3323('0x4b')],qs[_0x3323('0x4c')](_0x391b30[_0x3323('0x4a')][_0x3323('0x4c')]));_0x42d067[_0x3323('0x4d')]=_0x42d067['attributes'][_0x3323('0x4e')]?_0x42d067[_0x3323('0x4d')]:_0x15deb0[_0x3323('0x4b')];if(!_0x391b30[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x42d067[_0x3323('0x1c')]=qs[_0x3323('0x1c')](_0x391b30['query'][_0x3323('0x1c')]);_0x42d067[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x391b30[_0x3323('0x4a')][_0x3323('0x1a')]);}_0x42d067[_0x3323('0x51')]=qs[_0x3323('0x52')](_0x391b30['query'][_0x3323('0x52')]);_0x42d067[_0x3323('0x53')]=qs['filters'](_[_0x3323('0x55')](_0x391b30[_0x3323('0x4a')],_0x15deb0['filters']));_0x42d067[_0x3323('0x53')][_0x3323('0x6a')]=_0x49f3f6['id'];if(_0x391b30[_0x3323('0x4a')][_0x3323('0x56')]){_0x42d067['where']=_[_0x3323('0x57')](_0x42d067[_0x3323('0x53')],{'$or':_[_0x3323('0x6e')](_0x42d067['attributes'],function(_0x2d5783){var _0x352a80={};_0x352a80[_0x2d5783]={'$like':'%'+_0x391b30['query'][_0x3323('0x56')]+'%'};return _0x352a80;})});}_0x42d067=_[_0x3323('0x57')]({},_0x42d067,_0x391b30[_0x3323('0x59')]);return db[_0x3323('0x86')][_0x3323('0x1d')]({'where':_0x42d067[_0x3323('0x53')]})[_0x3323('0x21')](function(_0x27810f){_0x18d844[_0x3323('0x1d')]=_0x27810f;if(_0x391b30[_0x3323('0x4a')][_0x3323('0x5a')]){_0x42d067[_0x3323('0x5b')]=[{'model':db[_0x3323('0x89')],'as':_0x3323('0x8a'),'required':![]},{'model':db[_0x3323('0x8b')],'as':'Owner','attributes':['name',_0x3323('0x8c'),'internal'],'required':![]},{'model':db[_0x3323('0x8d')],'as':_0x3323('0x8e'),'attributes':['id',_0x3323('0x27'),_0x3323('0x8f')],'where':_0x391b30[_0x3323('0x4a')][_0x3323('0x90')]?{'id':_0x391b30[_0x3323('0x4a')][_0x3323('0x90')]}:undefined,'required':_0x391b30['query'][_0x3323('0x90')]?!![]:![]}];}return db['MailInteraction'][_0x3323('0x6f')](_0x42d067);})[_0x3323('0x21')](function(_0x469241){_0x18d844['rows']=_0x469241;return _0x18d844;});}})[_0x3323('0x21')](respondWithFilteredResult(_0x32052d,_0x42d067))[_0x3323('0x15')](handleError(_0x32052d,null));};exports[_0x3323('0x91')]=function addApplications(_0x34dd74,_0x3634cb){var _0x2963bb=_0x34dd74[_0x3323('0x5e')]['id'];var _0xf42894=_0x34dd74[_0x3323('0x61')];var _0x5e6c64=0xc8;var _0x3d91c1=null;return db[_0x3323('0x92')][_0x3323('0x93')]({'isolationLevel':db[_0x3323('0x92')]['Transaction']['ISOLATION_LEVELS'][_0x3323('0x94')]},function(_0xfaed43){return db[_0x3323('0x45')][_0x3323('0x6c')]({'where':{'id':_0x2963bb},'transaction':_0xfaed43})['then'](function(_0x298fba){if(_0x298fba){return db[_0x3323('0x95')][_0x3323('0x22')]({'where':{'MailAccountId':_0x2963bb},'transaction':_0xfaed43})['then'](function(){var _0x35289c=_['map'](_0xf42894,function(_0x223b0a){_0x223b0a['MailAccountId']=_0x2963bb;return _0x223b0a;});return db[_0x3323('0x95')][_0x3323('0x96')](_0x35289c,{'transaction':_0xfaed43});});}else{_0x5e6c64=0x194;_0x3d91c1=[];}});})[_0x3323('0x21')](function(){if(_0x5e6c64!==0x194){return db[_0x3323('0x95')][_0x3323('0x97')]({'where':{'MailAccountId':_0x2963bb},'order':_0x3323('0x98')})[_0x3323('0x21')](function(_0x378871){_0x3d91c1=_0x378871;});}})[_0x3323('0x15')](function(_0x1391b2){_0x5e6c64=0x1f4;logger[_0x3323('0x12')](_0x1391b2[_0x3323('0x26')]);if(_0x1391b2[_0x3323('0x27')]){delete _0x1391b2['name'];}_0x3d91c1=_0x1391b2;})[_0x3323('0x99')](function(){if(_0x3d91c1===null){_0x3634cb[_0x3323('0x16')](_0x5e6c64);}else{if(_0x5e6c64===0x1f4){_0x3634cb[_0x3323('0x18')](_0x5e6c64)[_0x3323('0x9a')](_0x3d91c1);}else{_0x3634cb[_0x3323('0x18')](_0x5e6c64)['json'](_0x3d91c1);}}});};exports['getApplications']=function(_0x2a83da,_0x297d44){var _0x3daf24={};var _0x18cf03={};var _0x5dd1d5;var _0x20410e;return db['MailAccount'][_0x3323('0x6c')]({'where':{'id':_0x2a83da[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x297d44,null))[_0x3323('0x21')](function(_0x3ae4f8){if(_0x3ae4f8){_0x5dd1d5=_0x3ae4f8;_0x18cf03[_0x3323('0x4b')]=_['keys'](db[_0x3323('0x95')][_0x3323('0x46')]);_0x18cf03[_0x3323('0x4a')]=_['keys'](_0x2a83da[_0x3323('0x4a')]);_0x18cf03[_0x3323('0x54')]=_[_0x3323('0x60')](_0x18cf03[_0x3323('0x4b')],_0x18cf03[_0x3323('0x4a')]);_0x3daf24[_0x3323('0x4d')]=_[_0x3323('0x60')](_0x18cf03[_0x3323('0x4b')],qs[_0x3323('0x4c')](_0x2a83da[_0x3323('0x4a')][_0x3323('0x4c')]));_0x3daf24['attributes']=_0x3daf24['attributes'][_0x3323('0x4e')]?_0x3daf24[_0x3323('0x4d')]:_0x18cf03[_0x3323('0x4b')];_0x3daf24['order']=qs[_0x3323('0x52')](_0x2a83da[_0x3323('0x4a')][_0x3323('0x52')]);_0x3daf24[_0x3323('0x53')]=qs['filters'](_['pick'](_0x2a83da[_0x3323('0x4a')],_0x18cf03[_0x3323('0x54')]));if(_0x2a83da['query'][_0x3323('0x56')]){_0x3daf24['where']=_[_0x3323('0x57')](_0x3daf24['where'],{'$or':_['map'](_0x3daf24[_0x3323('0x4d')],function(_0x33127a){var _0x48d71e={};_0x48d71e[_0x33127a]={'$like':'%'+_0x2a83da['query'][_0x3323('0x56')]+'%'};return _0x48d71e;})});}_0x3daf24=_['merge']({},_0x3daf24,_0x2a83da[_0x3323('0x59')]);return _0x5dd1d5['getApplications'](_0x3daf24);}})[_0x3323('0x21')](function(_0x44bcf5){if(_0x44bcf5){_0x20410e=_0x44bcf5[_0x3323('0x4e')];if(!_0x2a83da[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x3daf24['limit']=qs[_0x3323('0x1c')](_0x2a83da['query'][_0x3323('0x1c')]);_0x3daf24[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x2a83da[_0x3323('0x4a')]['offset']);}return _0x5dd1d5[_0x3323('0x9b')](_0x3daf24);}})[_0x3323('0x21')](function(_0x5ee21b){if(_0x5ee21b){return _0x5ee21b?{'count':_0x20410e,'rows':_0x5ee21b}:null;}})['then'](respondWithResult(_0x297d44,null))[_0x3323('0x15')](handleError(_0x297d44,null));};exports[_0x3323('0x9c')]=function(_0x80d390,_0x3c8193){var _0x54f780={'raw':!![],'where':{}};var _0x4c754d={};var _0x118c5d={'count':0x0,'rows':[]};return db[_0x3323('0x45')]['findOne']({'where':{'id':_0x80d390[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x3c8193,null))[_0x3323('0x21')](function(_0x4ff722){if(_0x4ff722){_0x4c754d[_0x3323('0x4b')]=_[_0x3323('0x5f')](db[_0x3323('0x9d')]['rawAttributes']);_0x4c754d[_0x3323('0x4a')]=_[_0x3323('0x5f')](_0x80d390[_0x3323('0x4a')]);_0x4c754d[_0x3323('0x54')]=_[_0x3323('0x60')](_0x4c754d[_0x3323('0x4b')],_0x4c754d[_0x3323('0x4a')]);_0x54f780[_0x3323('0x4d')]=_['intersection'](_0x4c754d['model'],qs[_0x3323('0x4c')](_0x80d390['query'][_0x3323('0x4c')]));_0x54f780['attributes']=_0x54f780[_0x3323('0x4d')]['length']?_0x54f780['attributes']:_0x4c754d[_0x3323('0x4b')];if(!_0x80d390[_0x3323('0x4a')][_0x3323('0x4f')](_0x3323('0x50'))){_0x54f780[_0x3323('0x1c')]=qs[_0x3323('0x1c')](_0x80d390[_0x3323('0x4a')]['limit']);_0x54f780['offset']=qs[_0x3323('0x1a')](_0x80d390[_0x3323('0x4a')][_0x3323('0x1a')]);}_0x54f780[_0x3323('0x51')]=qs[_0x3323('0x52')](_0x80d390['query']['sort']);_0x54f780[_0x3323('0x53')]=qs['filters'](_[_0x3323('0x55')](_0x80d390[_0x3323('0x4a')],_0x4c754d['filters']));_0x54f780[_0x3323('0x53')][_0x3323('0x6a')]=_0x4ff722['id'];if(_0x80d390['query'][_0x3323('0x56')]){_0x54f780[_0x3323('0x53')]=_[_0x3323('0x57')](_0x54f780[_0x3323('0x53')],{'$or':_[_0x3323('0x6e')](_0x54f780[_0x3323('0x4d')],function(_0x5ec642){var _0x2cae6b={};_0x2cae6b[_0x5ec642]={'$like':'%'+_0x80d390[_0x3323('0x4a')][_0x3323('0x56')]+'%'};return _0x2cae6b;})});}if(_0x80d390[_0x3323('0x4a')][_0x3323('0x9e')]){var _0x16ad78=_0x80d390[_0x3323('0x4a')]['$gte'][_0x3323('0x9f')](',');var _0x2f3073={};_0x2f3073[_0x16ad78[0x0]]={'$gte':moment(_0x16ad78[0x1])[_0x3323('0xa0')](_0x3323('0xa1'))};_0x54f780[_0x3323('0x53')]=_[_0x3323('0x57')](_0x54f780[_0x3323('0x53')],_0x2f3073);}_0x54f780=_[_0x3323('0x57')]({},_0x54f780,_0x80d390[_0x3323('0x59')]);return db[_0x3323('0x9d')][_0x3323('0x1d')]({'where':_0x54f780['where']})['then'](function(_0x390065){_0x118c5d[_0x3323('0x1d')]=_0x390065;if(_0x80d390['query']['includeAll']){_0x54f780[_0x3323('0x5b')]=[{'all':!![]}];}return db[_0x3323('0x9d')][_0x3323('0x6f')](_0x54f780);})[_0x3323('0x21')](function(_0x3aa086){if(_0x80d390[_0x3323('0x4a')][_0x3323('0xa2')]===_0x3323('0xa3')){for(var _0x24ba79=0x0;_0x24ba79<_0x3aa086[_0x3323('0x4e')];_0x24ba79++){_0x3aa086[_0x24ba79]['body']=juice(_0x3aa086[_0x24ba79][_0x3323('0x61')]);}}_0x118c5d[_0x3323('0x5c')]=_0x3aa086;return _0x118c5d;});}})[_0x3323('0x21')](respondWithFilteredResult(_0x3c8193,_0x54f780))[_0x3323('0x15')](handleError(_0x3c8193,null));};exports['send']=function(_0x5159a4,_0x43ca7f){var _0x56d954,_0x5d3998={},_0x4c1b67;if(_0x5159a4['body']['to']){_0x4c1b67=_0x5159a4[_0x3323('0x61')]['to'][_0x3323('0x9f')](',')[0x0];}return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x5159a4[_0x3323('0x5e')]['id']},'include':[{'model':db[_0x3323('0xa4')],'as':_0x3323('0xa5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4c1b67},'limit':0x1,'order':[[_0x3323('0xa6'),_0x3323('0xa7')]]}]},{'model':db['MailServerOut'],'as':_0x3323('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x3323('0x21')](handleEntityNotFound(_0x43ca7f,null))[_0x3323('0x21')](function(_0x561318){if(!_0x561318)return;_0x56d954=_0x561318;if(!_0x561318['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x5159a4[_0x3323('0x61')][_0x3323('0xa8')])){_0x5159a4['body'][_0x3323('0xa8')]=util['format']('%s\x20<%s>',_0x561318[_0x3323('0x27')],_0x561318[_0x3323('0x77')]||_0x561318['Smtp'][_0x3323('0x35')]);}if(_0x5159a4['body'][_0x3323('0xa9')]&&_0x5159a4['body'][_0x3323('0xa9')][_0x3323('0x4e')]){for(var _0x5f2321=0x0;_0x5f2321<_0x5159a4[_0x3323('0x61')][_0x3323('0xa9')][_0x3323('0x4e')];_0x5f2321+=0x1){_0x5159a4[_0x3323('0x61')][_0x3323('0xa9')][_0x5f2321]={'filename':_0x5159a4['body']['attachments'][_0x5f2321][_0x3323('0x27')],'path':path[_0x3323('0xaa')](config[_0x3323('0xab')],_0x3323('0xac'),_0x5159a4[_0x3323('0x61')][_0x3323('0xa9')][_0x5f2321][_0x3323('0xad')])};}}var _0xd702c5=_0x561318['getSmtpOptions']();return respondWithRpcPromise(_0x3323('0xae'),_0x3323('0xaf'),{'account':_0xd702c5,'message':_0x5159a4[_0x3323('0x61')]});})[_0x3323('0x21')](function(_0x33d615){if(!_0x33d615)return;_0x5d3998=_0x33d615;if(!_0x56d954[_0x3323('0xa5')])throw new Error(_0x3323('0xb0'));if(_0x56d954[_0x3323('0xa5')][_0x3323('0xb1')][_0x3323('0x4e')])return _0x56d954['List'][_0x3323('0xb1')][0x0];return db[_0x3323('0x89')][_0x3323('0x73')](_[_0x3323('0x6')](_0x5159a4['body'],{'firstName':_0x5159a4[_0x3323('0x61')]['to'],'email':_0x5159a4[_0x3323('0x61')]['to'],'phone':_0x5159a4[_0x3323('0x61')]['to'],'ListId':_0x56d954[_0x3323('0xb2')]}));})[_0x3323('0x21')](function(_0x36d3b6){if(!_0x36d3b6)return;var _0x3075c0={'UserId':_0x5159a4[_0x3323('0x35')]['id'],'ContactId':_0x36d3b6['id'],'MailAccountId':_0x56d954['id'],'inReplyTo':_0x5d3998[_0x3323('0xb3')],'to':_0x5159a4[_0x3323('0x61')]['from'],'cc':_0x5159a4['body']['cc'],'subject':_0x5159a4[_0x3323('0x61')][_0x3323('0xb4')],'attach':_0x5159a4['body'][_0x3323('0xb5')],'firstMsgDirection':_0x3323('0xb6'),'lastMsgAt':moment()[_0x3323('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x3323('0x57')](_0x5159a4[_0x3323('0x61')],{'messageId':_0x5d3998[_0x3323('0xb3')],'sentAt':moment()[_0x3323('0xa0')](_0x3323('0xa1')),'read':!![],'MailAccountId':_0x56d954['id'],'UserId':_0x5159a4[_0x3323('0x35')]['id'],'ContactId':_0x36d3b6['id']})]};if(_0x5159a4[_0x3323('0x61')][_0x3323('0xb7')]){_0x3075c0=_[_0x3323('0x57')](_0x3075c0,_0x5159a4['body'][_0x3323('0xb7')]);}return db[_0x3323('0x86')][_0x3323('0x73')](_0x3075c0,{'include':[{'model':db[_0x3323('0x9d')],'as':_0x3323('0xb8')}]});})[_0x3323('0x21')](respondWithResult(_0x43ca7f,null))[_0x3323('0x15')](handleError(_0x43ca7f,null));};exports[_0x3323('0xb9')]=function(_0xfa3b0b,_0x5c38ef){return db['MailAccount']['find']({'where':{'id':_0xfa3b0b[_0x3323('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x3323('0x3f'),'raw':!![],'include':[{'model':db[_0x3323('0xba')],'as':_0x3323('0xba'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5c38ef,null))['then'](function(_0x4cb683){if(!_0x4cb683['Smtp'])return;var _0x5d1a45=_0x4cb683[_0x3323('0xbb')]();return respondWithRpcPromise(_0x3323('0xbc'),_0x3323('0xb9'),{'account':_0x5d1a45});})[_0x3323('0x21')](respondWithResult(_0x5c38ef,null))[_0x3323('0x15')](handleError(_0x5c38ef,null));};exports['destroy']=function(_0x5dc788,_0x3b49bc){return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x5dc788[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x3b49bc,null))[_0x3323('0x21')](function(_0x22a22e){if(_0x22a22e&&_0x22a22e[_0x3323('0x3d')]){throw new db['Sequelize'][(_0x3323('0xbd'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x22a22e;})[_0x3323('0x21')](removeEntity(_0x3b49bc,null))['catch'](handleError(_0x3b49bc,null));};exports['addAgents']=function(_0xcc7454,_0x3aee0a){return db['MailAccount'][_0x3323('0x65')]({'where':{'id':_0xcc7454[_0x3323('0x5e')]['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x3aee0a,null))[_0x3323('0x21')](function(_0x4a839b){if(_0x4a839b){return _0x4a839b[_0x3323('0xbe')](_0xcc7454[_0x3323('0x61')][_0x3323('0x71')],_[_0x3323('0x87')](_0xcc7454[_0x3323('0x61')],[_0x3323('0x71'),'id'])||{})[_0x3323('0xbf')](function(_0x43181c){for(var _0x1d5118=0x0;_0x1d5118<_0xcc7454[_0x3323('0x61')][_0x3323('0x71')][_0x3323('0x4e')];_0x1d5118+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0xcc7454[_0x3323('0x61')][_0x3323('0x71')][_0x1d5118]),'MailAccountId':Number(_0xcc7454[_0x3323('0x5e')]['id'])});}return _0x43181c;});}})[_0x3323('0x21')](respondWithResult(_0x3aee0a,null))[_0x3323('0x15')](handleError(_0x3aee0a,null));};exports[_0x3323('0xc0')]=function(_0x48a1d3,_0x280834){return db[_0x3323('0x45')][_0x3323('0x65')]({'where':{'id':_0x48a1d3['params']['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x280834,null))[_0x3323('0x21')](function(_0x370a8c){if(_0x370a8c){return _0x370a8c[_0x3323('0xc0')](_0x48a1d3['query']['ids'])['then'](function(){if(_['isArray'](_0x48a1d3[_0x3323('0x4a')][_0x3323('0x71')])){for(var _0x25b8ee=0x0;_0x25b8ee<_0x48a1d3['query'][_0x3323('0x71')][_0x3323('0x4e')];_0x25b8ee+=0x1){socket[_0x3323('0xc1')](_0x3323('0xc2'),{'UserId':Number(_0x48a1d3[_0x3323('0x4a')][_0x3323('0x71')][_0x25b8ee]),'MailAccountId':Number(_0x48a1d3['params']['id'])});}}else{socket[_0x3323('0xc1')](_0x3323('0xc2'),{'UserId':Number(_0x48a1d3[_0x3323('0x4a')][_0x3323('0x71')]),'MailAccountId':Number(_0x48a1d3[_0x3323('0x5e')]['id'])});}});}})[_0x3323('0x21')](respondWithStatusCode(_0x280834,null))[_0x3323('0x15')](handleError(_0x280834,null));};exports[_0x3323('0xc3')]=function(_0x26a8a7,_0x49a1bb){var _0x2f197d={};var _0x382266={};var _0x58fa3d;var _0x5f5543;return db[_0x3323('0x45')][_0x3323('0x6c')]({'where':{'id':_0x26a8a7['params']['id']}})[_0x3323('0x21')](handleEntityNotFound(_0x49a1bb,null))[_0x3323('0x21')](function(_0x5a5a2a){if(_0x5a5a2a){_0x58fa3d=_0x5a5a2a;_0x382266[_0x3323('0x4b')]=_[_0x3323('0x5f')](db['User'][_0x3323('0x46')]);_0x382266[_0x3323('0x4a')]=_[_0x3323('0x5f')](_0x26a8a7[_0x3323('0x4a')]);_0x382266['filters']=_['intersection'](_0x382266['model'],_0x382266[_0x3323('0x4a')]);_0x2f197d[_0x3323('0x4d')]=_[_0x3323('0x60')](_0x382266[_0x3323('0x4b')],qs[_0x3323('0x4c')](_0x26a8a7[_0x3323('0x4a')][_0x3323('0x4c')]));_0x2f197d['attributes']=_0x2f197d[_0x3323('0x4d')][_0x3323('0x4e')]?_0x2f197d[_0x3323('0x4d')]:_0x382266[_0x3323('0x4b')];_0x2f197d[_0x3323('0x51')]=qs[_0x3323('0x52')](_0x26a8a7[_0x3323('0x4a')]['sort']);_0x2f197d[_0x3323('0x53')]=qs[_0x3323('0x54')](_['pick'](_0x26a8a7[_0x3323('0x4a')],_0x382266[_0x3323('0x54')]));if(_0x26a8a7[_0x3323('0x4a')][_0x3323('0x56')]){_0x2f197d[_0x3323('0x53')]=_['merge'](_0x2f197d[_0x3323('0x53')],{'$or':_[_0x3323('0x6e')](_0x2f197d[_0x3323('0x4d')],function(_0x3fbbb1){var _0x31f112={};_0x31f112[_0x3fbbb1]={'$like':'%'+_0x26a8a7[_0x3323('0x4a')][_0x3323('0x56')]+'%'};return _0x31f112;})});}_0x2f197d=_[_0x3323('0x57')]({},_0x2f197d,_0x26a8a7[_0x3323('0x59')]);return _0x58fa3d[_0x3323('0xc3')](_0x2f197d);}})['then'](function(_0x58779a){if(_0x58779a){_0x5f5543=_0x58779a[_0x3323('0x4e')];if(!_0x26a8a7[_0x3323('0x4a')][_0x3323('0x4f')]('nolimit')){_0x2f197d[_0x3323('0x1c')]=qs[_0x3323('0x1c')](_0x26a8a7['query'][_0x3323('0x1c')]);_0x2f197d[_0x3323('0x1a')]=qs[_0x3323('0x1a')](_0x26a8a7[_0x3323('0x4a')][_0x3323('0x1a')]);}return _0x58fa3d[_0x3323('0xc3')](_0x2f197d);}})[_0x3323('0x21')](function(_0x3df416){if(_0x3df416){return _0x3df416?{'count':_0x5f5543,'rows':_0x3df416}:null;}})[_0x3323('0x21')](respondWithResult(_0x49a1bb,null))[_0x3323('0x15')](handleError(_0x49a1bb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0154d57..b4c1030 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 _0x8daf=['save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x8daf,0x15c));var _0xf8da=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x8daf[_0x5aece9];return _0x1c46d6;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8da('0x0'),'afterUpdate':_0xf8da('0x1'),'afterDestroy':'remove'};function emitEvent(_0x3a62fe){return function(_0x109758,_0x258561,_0x3357f6){MailAccountEvents[_0xf8da('0x2')](_0x3a62fe+':'+_0x109758['id'],_0x109758);MailAccountEvents[_0xf8da('0x2')](_0x3a62fe,_0x109758);_0x3357f6(null);};}for(var e in events){if(events[_0xf8da('0x3')](e)){var event=events[e];MailAccount[_0xf8da('0x4')](e,emitEvent(event));}}module[_0xf8da('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x59ee=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x51b4f9,_0x312a57){var _0x45785d=function(_0x2382b5){while(--_0x2382b5){_0x51b4f9['push'](_0x51b4f9['shift']());}};_0x45785d(++_0x312a57);}(_0x59ee,0x1a0));var _0xe59e=function(_0x5a1d97,_0x265b5a){_0x5a1d97=_0x5a1d97-0x0;var _0x401646=_0x59ee[_0x5a1d97];return _0x401646;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xe59e('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe59e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe59e('0x2'),'afterDestroy':_0xe59e('0x3')};function emitEvent(_0xcc542a){return function(_0xd83641,_0x44e54f,_0xc26508){MailAccountEvents[_0xe59e('0x4')](_0xcc542a+':'+_0xd83641['id'],_0xd83641);MailAccountEvents[_0xe59e('0x4')](_0xcc542a,_0xd83641);_0xc26508(null);};}for(var e in events){if(events[_0xe59e('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xe59e('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b1d543f..bf32b1b 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 _0x6c52=['OAuth2','user','CloudProvider','pass','./mailAccount.attributes','exports','MailAccount','provider','custom','service','host','port','secure','Smtp','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x25023b,_0x383839){var _0x48b984=function(_0x3d3258){while(--_0x3d3258){_0x25023b['push'](_0x25023b['shift']());}};_0x48b984(++_0x383839);}(_0x6c52,0x1ea));var _0x26c5=function(_0x140f21,_0x3e9551){_0x140f21=_0x140f21-0x0;var _0x573a18=_0x6c52[_0x140f21];return _0x573a18;};'use strict';var attributes=require(_0x26c5('0x0'));module[_0x26c5('0x1')]=function(_0x2c1968){return _0x2c1968['define'](_0x26c5('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x364916=this;var _0x2ac549={'id':_0x364916['id'],'tls':{'rejectUnauthorized':![]}};if(_0x364916[_0x26c5('0x3')]!==_0x26c5('0x4')){_0x2ac549[_0x26c5('0x5')]=_0x364916[_0x26c5('0x3')];}else{_0x2ac549[_0x26c5('0x6')]=_0x364916['Smtp'][_0x26c5('0x6')];_0x2ac549[_0x26c5('0x7')]=_0x364916['Smtp'][_0x26c5('0x7')];_0x2ac549[_0x26c5('0x8')]=_0x364916[_0x26c5('0x9')]['secure'];}if(_0x364916[_0x26c5('0x9')][_0x26c5('0xa')]){if(_0x364916['Smtp'][_0x26c5('0xb')]){if(!_0x364916['Smtp']['CloudProvider'])throw new Error(_0x26c5('0xc'));_0x2ac549[_0x26c5('0xd')]={'type':_0x26c5('0xe'),'user':_0x364916[_0x26c5('0x9')][_0x26c5('0xf')],'accessToken':_0x364916[_0x26c5('0x9')][_0x26c5('0x10')]['data5']};}else{_0x2ac549[_0x26c5('0xd')]={'user':_0x364916[_0x26c5('0x9')][_0x26c5('0xf')],'pass':_0x364916[_0x26c5('0x9')][_0x26c5('0x11')]};}}return _0x2ac549;}}});}; \ No newline at end of file +var _0x5096=['MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','modernAuthentication','auth','OAuth2','user','data5','exports','define'];(function(_0x205488,_0x3b450c){var _0x342a90=function(_0x375e1a){while(--_0x375e1a){_0x205488['push'](_0x205488['shift']());}};_0x342a90(++_0x3b450c);}(_0x5096,0xee));var _0x6509=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0x5096[_0x557ba5];return _0x4c7d96;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x6509('0x0')]=function(_0x5da1a2){return _0x5da1a2[_0x6509('0x1')](_0x6509('0x2'),attributes,{'tableName':_0x6509('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x540c3f=this;var _0x53c10d={'id':_0x540c3f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x540c3f[_0x6509('0x4')]!=='custom'){_0x53c10d[_0x6509('0x5')]=_0x540c3f[_0x6509('0x4')];}else{_0x53c10d[_0x6509('0x6')]=_0x540c3f[_0x6509('0x7')][_0x6509('0x6')];_0x53c10d[_0x6509('0x8')]=_0x540c3f[_0x6509('0x7')][_0x6509('0x8')];_0x53c10d[_0x6509('0x9')]=_0x540c3f[_0x6509('0x7')][_0x6509('0x9')];}if(_0x540c3f['Smtp']['authentication']){if(_0x540c3f[_0x6509('0x7')][_0x6509('0xa')]){if(!_0x540c3f[_0x6509('0x7')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x53c10d[_0x6509('0xb')]={'type':_0x6509('0xc'),'user':_0x540c3f['Smtp'][_0x6509('0xd')],'accessToken':_0x540c3f[_0x6509('0x7')]['CloudProvider'][_0x6509('0xe')]};}else{_0x53c10d[_0x6509('0xb')]={'user':_0x540c3f[_0x6509('0x7')][_0x6509('0xd')],'pass':_0x540c3f[_0x6509('0x7')]['pass']};}}return _0x53c10d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b5fab45..d34fbc9 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 _0x2b83=['attributes','include','map','model','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','List','account','omit','smtpOptions','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','Contacts','defaults','create','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','format','interaction','attachments','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','User','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','name','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where'];(function(_0x170d06,_0x351221){var _0x3393de=function(_0x4edb56){while(--_0x4edb56){_0x170d06['push'](_0x170d06['shift']());}};_0x3393de(++_0x351221);}(_0x2b83,0x1d3));var _0x32b8=function(_0x57bcd6,_0xa2551b){_0x57bcd6=_0x57bcd6-0x0;var _0x210b71=_0x2b83[_0x57bcd6];return _0x210b71;};'use strict';var _=require('lodash');var moment=require(_0x32b8('0x0'));var BPromise=require(_0x32b8('0x1'));var rs=require('randomstring');var Redis=require(_0x32b8('0x2'));var db=require(_0x32b8('0x3'))['db'];var logger=require(_0x32b8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32b8('0x5'));var client=jayson[_0x32b8('0x6')]['http']({'port':0x232c});config[_0x32b8('0x7')]=_['defaults'](config[_0x32b8('0x7')],{'host':_0x32b8('0x8'),'port':0x18eb});var socket=require(_0x32b8('0x9'))(new Redis(config[_0x32b8('0x7')]));require('./mailAccount.socket')[_0x32b8('0xa')](socket);function respondWithRpcPromise(_0x2c9e57,_0x48257a,_0x4f2aa0){return new BPromise(function(_0x3f58a5,_0x5ecf4e){return client[_0x32b8('0xb')](_0x2c9e57,_0x4f2aa0)[_0x32b8('0xc')](function(_0x465672){logger[_0x32b8('0xd')]('MailAccount,\x20%s,\x20%s',_0x48257a,_0x32b8('0xe'));logger[_0x32b8('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48257a,'request\x20sent',JSON[_0x32b8('0x10')](_0x465672));if(_0x465672['error']){if(_0x465672[_0x32b8('0x11')]['code']===0x1f4){logger[_0x32b8('0x11')](_0x32b8('0x12'),_0x48257a,_0x465672[_0x32b8('0x11')][_0x32b8('0x13')]);return _0x5ecf4e(_0x465672[_0x32b8('0x11')]['message']);}logger['error'](_0x32b8('0x12'),_0x48257a,_0x465672['error']['message']);return _0x3f58a5(_0x465672['error'][_0x32b8('0x13')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x48257a,_0x32b8('0xe'));_0x3f58a5(_0x465672[_0x32b8('0x14')][_0x32b8('0x13')]);}})[_0x32b8('0x15')](function(_0x599bc3){logger['error']('MailAccount,\x20%s,\x20%s',_0x48257a,_0x599bc3);_0x5ecf4e(_0x599bc3);});});}exports[_0x32b8('0x16')]=function(_0x2ffea2){var _0x748394=this;return new Promise(function(_0x445da1,_0x4c6077){return db[_0x32b8('0x17')][_0x32b8('0x18')]({'raw':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1b')]||null:null,'attributes':_0x2ffea2['options']?_0x2ffea2['options'][_0x32b8('0x1c')]||null:null,'limit':_0x2ffea2['options']?_0x2ffea2[_0x32b8('0x19')]['limit']||null:null,'include':_0x2ffea2[_0x32b8('0x19')]?_0x2ffea2[_0x32b8('0x19')][_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x2ffea2[_0x32b8('0x19')]['include'],function(_0x4e1360){return{'model':db[_0x4e1360[_0x32b8('0x1f')]],'as':_0x4e1360['as'],'attributes':_0x4e1360[_0x32b8('0x1c')],'include':_0x4e1360[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x4e1360[_0x32b8('0x1d')],function(_0x57a6a3){return{'model':db[_0x57a6a3[_0x32b8('0x1f')]],'as':_0x57a6a3['as'],'attributes':_0x57a6a3[_0x32b8('0x1c')],'include':_0x57a6a3[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x57a6a3[_0x32b8('0x1d')],function(_0x17dd70){return{'model':db[_0x17dd70[_0x32b8('0x1f')]],'as':_0x17dd70['as'],'attributes':_0x17dd70[_0x32b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32b8('0xc')](function(_0xa225ec){logger[_0x32b8('0xd')](_0x32b8('0x16'),_0x2ffea2);logger[_0x32b8('0xf')]('GetMailAccount',_0x2ffea2,JSON[_0x32b8('0x10')](_0xa225ec));_0x445da1(_0xa225ec);})[_0x32b8('0x15')](function(_0x383b0e){logger[_0x32b8('0x11')](_0x32b8('0x16'),_0x383b0e[_0x32b8('0x13')],_0x2ffea2);_0x4c6077(_0x748394[_0x32b8('0x11')](0x1f4,_0x383b0e[_0x32b8('0x13')]));});});};exports[_0x32b8('0x20')]=function(_0x15f152){var _0x521bf4=this;return new Promise(function(_0x1833af,_0x3c1122){return db[_0x32b8('0x17')][_0x32b8('0x21')]({'raw':_0x15f152['options']?_0x15f152['options'][_0x32b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x15f152[_0x32b8('0x19')]?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1b')]||null:null,'attributes':_0x15f152['options']?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1c')]||null:null,'include':_0x15f152[_0x32b8('0x19')]?_0x15f152[_0x32b8('0x19')][_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x15f152[_0x32b8('0x19')][_0x32b8('0x1d')],function(_0x591ba8){return{'model':db[_0x591ba8[_0x32b8('0x1f')]],'as':_0x591ba8['as'],'attributes':_0x591ba8['attributes'],'include':_0x591ba8[_0x32b8('0x1d')]?_[_0x32b8('0x1e')](_0x591ba8[_0x32b8('0x1d')],function(_0xc5fa8b){return{'model':db[_0xc5fa8b[_0x32b8('0x1f')]],'as':_0xc5fa8b['as'],'attributes':_0xc5fa8b[_0x32b8('0x1c')],'include':_0xc5fa8b['include']?_[_0x32b8('0x1e')](_0xc5fa8b[_0x32b8('0x1d')],function(_0x7e13a9){return{'model':db[_0x7e13a9['model']],'as':_0x7e13a9['as'],'attributes':_0x7e13a9[_0x32b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449f52){if(_0x15f152[_0x32b8('0x19')][_0x32b8('0x22')]===!![])_0x449f52[_0x32b8('0x23')]('smtpOptions',_0x449f52[_0x32b8('0x24')]());logger[_0x32b8('0xd')](_0x32b8('0x20'),_0x15f152);logger['debug']('ShowMailAccount',_0x15f152,JSON[_0x32b8('0x10')](_0x449f52));_0x1833af(_0x449f52);})[_0x32b8('0x15')](function(_0x117a08){logger['error']('ShowMailAccount',_0x117a08['message'],_0x15f152);_0x3c1122(_0x521bf4[_0x32b8('0x11')](0x1f4,_0x117a08[_0x32b8('0x13')]));});});};exports[_0x32b8('0x25')]=function(_0x544fe5){var _0x305428=this;return new Promise(function(_0x14c109,_0x895b74){var _0x273d5f={'body':_0x544fe5[_0x32b8('0x26')],'channel':_0x32b8('0x27')};var _0x8dd996=_[_0x32b8('0x28')](_['keys'](db[_0x32b8('0x29')]['rawAttributes']),['createdAt','updatedAt','CompanyId',_0x32b8('0x2a')]);var _0x50e6e3=![];if(_0x544fe5[_0x32b8('0x26')]['id']){delete _0x544fe5['body']['id'];}if(_['isNil'](_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2b')])){return _0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x32b8('0x2c')](_0x544fe5[_0x32b8('0x26')][_0x32b8('0x26')])||_0x544fe5['body']['body']===''){return _0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x32b8('0x2c')](_0x544fe5['body'][_0x32b8('0x2d')])){return _0x895b74(_0x305428['error'](0x1f4,_0x32b8('0x2e')+_0x8dd996));}if(!_[_0x32b8('0x2f')](_0x8dd996,_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')])){return _0x895b74(_0x305428['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8dd996));}var _0x923049={};_0x923049[_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')]]=_0x544fe5['body']['from'];return db[_0x32b8('0x17')][_0x32b8('0x21')]({'where':{'id':_0x544fe5['account']['id']},'include':[{'model':db[_0x32b8('0x30')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x923049,'limit':0x1,'order':[[_0x32b8('0x31'),_0x32b8('0x32')]]}]},{'model':db[_0x32b8('0x33')],'as':_0x32b8('0x34')},{'model':db['MailServerOut'],'as':_0x32b8('0x35'),'include':[{'model':db[_0x32b8('0x36')],'as':_0x32b8('0x36')}]}]})[_0x32b8('0xc')](function(_0x1a5bd4){if(_0x1a5bd4&&_0x1a5bd4[_0x32b8('0x37')]){var _0x25a2a8=_0x1a5bd4['get']({'plain':!![]});_0x273d5f[_0x32b8('0x38')]=_[_0x32b8('0x39')](_0x25a2a8,[_0x32b8('0x34'),_0x32b8('0x37')]);_0x273d5f[_0x32b8('0x38')][_0x32b8('0x3a')]=_0x1a5bd4[_0x32b8('0x24')]();_0x273d5f[_0x32b8('0x3b')]=_0x25a2a8[_0x32b8('0x34')];_0x273d5f['list']=_0x25a2a8['List'];_0x273d5f[_0x32b8('0x3b')]=_[_0x32b8('0x3c')](_0x273d5f[_0x32b8('0x3b')],[_0x32b8('0x3d')],[_0x32b8('0x3e')]);if(_0x273d5f[_0x32b8('0x38')]&&_0x273d5f['account'][_0x32b8('0x3f')]){_0x273d5f[_0x32b8('0x3b')][_0x32b8('0x40')]({'id':0x0,'priority':_0x273d5f[_0x32b8('0x3b')]['length']+0x1,'app':_0x32b8('0x41'),'appdata':_0x32b8('0x3f'),'interval':_0x32b8('0x42')});}if(_0x273d5f['account'][_0x32b8('0x34')]){delete _0x273d5f[_0x32b8('0x38')][_0x32b8('0x34')];}if(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x37')]){delete _0x273d5f[_0x32b8('0x38')][_0x32b8('0x37')];}if(_0x25a2a8['List'][_0x32b8('0x43')]['length']){return _0x25a2a8['List'][_0x32b8('0x43')][0x0];}var _0x2d458e=_[_0x32b8('0x44')](_0x544fe5[_0x32b8('0x26')],{'firstName':_0x544fe5[_0x32b8('0x26')]['from'],'ListId':_0x25a2a8[_0x32b8('0x2a')]});_0x2d458e[_0x544fe5[_0x32b8('0x26')][_0x32b8('0x2d')]]=_0x544fe5['body'][_0x32b8('0x2b')];return db[_0x32b8('0x29')][_0x32b8('0x45')](_0x2d458e);}else{throw new Error('List\x20not\x20found');}})[_0x32b8('0xc')](function(_0x531b62){_0x273d5f[_0x32b8('0x46')]=_0x531b62;if(_0x531b62){if(!_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x47')]){_0x544fe5['body'][_0x32b8('0x13')]['messageId']=rs[_0x32b8('0x48')]()+'\x20'+_0x544fe5['body']['message']['from'];}var _0x1618db={'ContactId':_0x531b62['id'],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id'],'inReplyTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['messageId'],'to':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'cc':_0x544fe5[_0x32b8('0x26')]['message']['cc'],'subject':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x49')],'attach':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x4a')],'lastMsgAt':moment()['format'](_0x32b8('0x4b')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id']},'include':[{'model':db[_0x32b8('0x4c')],'as':_0x32b8('0x4d'),'attributes':['messageId'],'where':{'messageId':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x4e')]}}]})[_0x32b8('0xc')](function(_0x419969){if(_0x419969){return[_0x419969,![]];}return db[_0x32b8('0x4f')][_0x32b8('0x45')](_0x1618db)[_0x32b8('0xc')](function(_0x13c351){return[_0x13c351,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x32b8('0x50')](function(_0x3ff3ad,_0x5a1e0a){if(_0x3ff3ad){_0x50e6e3=_0x5a1e0a;if(!_0x5a1e0a){return _0x3ff3ad[_0x32b8('0x51')]({'inReplyTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x47')],'to':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'cc':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['cc'],'subject':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x49')],'attach':_0x3ff3ad['attach']?_0x3ff3ad[_0x32b8('0x4a')]:_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x4a')],'substatus':null,'substatusAt':moment()[_0x32b8('0x52')](_0x32b8('0x4b')),'lastMsgAt':moment()[_0x32b8('0x52')](_0x32b8('0x4b')),'lastMsgDirection':'in'});}else{return _0x3ff3ad;}}})[_0x32b8('0xc')](function(_0x8310c7){_0x273d5f['interaction']=_0x8310c7['get']({'plain':!![]});_0x273d5f[_0x32b8('0x53')]['created']=_0x50e6e3;return db[_0x32b8('0x4c')][_0x32b8('0x45')]({'body':_0x544fe5[_0x32b8('0x26')]['body'],'MailAccountId':_0x544fe5[_0x32b8('0x38')]['id'],'MailInteractionId':_0x8310c7['id'],'direction':'in','ContactId':_0x273d5f[_0x32b8('0x46')]['id'],'messageId':_0x544fe5['body'][_0x32b8('0x13')]['messageId'],'from':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x2b')],'to':_0x544fe5[_0x32b8('0x26')]['message']['to'],'cc':_0x544fe5[_0x32b8('0x26')]['message']['cc'],'subject':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['subject'],'attach':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x4a')],'Attachments':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x54')],'originTo':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['originTo'],'originCc':_0x544fe5[_0x32b8('0x26')]['message'][_0x32b8('0x55')],'bcc':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['bcc'],'ChatWebsiteId':_0x544fe5['body'][_0x32b8('0x13')][_0x32b8('0x56')]||null,'originChannel':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')]['originChannel']||_0x32b8('0x57'),'ChatOfflineMessageId':_0x544fe5[_0x32b8('0x26')][_0x32b8('0x13')][_0x32b8('0x58')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32b8('0xc')](function(_0x5bc582){_0x273d5f[_0x32b8('0x13')]=_0x5bc582;if(!_0x273d5f[_0x32b8('0x53')]['UserId']){return;}return db[_0x32b8('0x59')][_0x32b8('0x21')]({'attributes':['id','name'],'where':{'id':_0x273d5f[_0x32b8('0x53')]['UserId']}});})[_0x32b8('0xc')](function(_0x41dd0e){if(_0x41dd0e){_0x273d5f[_0x32b8('0x3b')][_0x32b8('0x5a')]({'id':0x0,'priority':0x0,'app':_0x32b8('0x5b'),'appdata':_0x41dd0e['name']+','+(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x5c')]||0xa),'interval':_0x32b8('0x42')});}if(!_0x273d5f[_0x32b8('0x53')][_0x32b8('0x5d')]){return;}return db[_0x32b8('0x5e')][_0x32b8('0x21')]({'attributes':['id',_0x32b8('0x5f')],'where':{'id':_0x273d5f['interaction'][_0x32b8('0x5d')]}});})['then'](function(_0x238c22){if(_0x238c22){_0x273d5f['applications'][_0x32b8('0x5a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x238c22['name']+','+(_0x273d5f[_0x32b8('0x38')][_0x32b8('0x60')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32b8('0x61'),_0x32b8('0x62'),_0x273d5f);})[_0x32b8('0xc')](function(_0x315a32){_0x14c109(_0x315a32);})['catch'](function(_0x180000){_0x895b74(_0x305428[_0x32b8('0x11')](0x1f4,_0x180000['message']));});});}; \ No newline at end of file +var _0xc949=['from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Applications','Smtp','CloudProvider','get','omit','List','smtpOptions','applications','list','orderBy','priority','push','length','close','autoclose','*,*,*,*','Contacts','List\x20not\x20found','contact','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','MailInteraction','create','Contact\x20not\x20found','update','attach','format','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','queueId','MailQueue','queue','waitForTheAssignedQueue','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','difference','keys','CmContact','createdAt','updatedAt','ListId'];(function(_0x116229,_0x485785){var _0x3876a0=function(_0x41fa79){while(--_0x41fa79){_0x116229['push'](_0x116229['shift']());}};_0x3876a0(++_0x485785);}(_0xc949,0x181));var _0x9c94=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc949[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9c94('0x0'));var moment=require('moment');var BPromise=require(_0x9c94('0x1'));var rs=require(_0x9c94('0x2'));var Redis=require(_0x9c94('0x3'));var db=require(_0x9c94('0x4'))['db'];var logger=require('../../config/logger')(_0x9c94('0x5'));var config=require(_0x9c94('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c94('0x7')][_0x9c94('0x8')]({'port':0x232c});config[_0x9c94('0x9')]=_[_0x9c94('0xa')](config['redis'],{'host':_0x9c94('0xb'),'port':0x18eb});var socket=require(_0x9c94('0xc'))(new Redis(config[_0x9c94('0x9')]));require(_0x9c94('0xd'))[_0x9c94('0xe')](socket);function respondWithRpcPromise(_0x423e62,_0x174a53,_0x454b16){return new BPromise(function(_0x417063,_0x3287f8){return client['request'](_0x423e62,_0x454b16)[_0x9c94('0xf')](function(_0x18aa3a){logger[_0x9c94('0x10')](_0x9c94('0x11'),_0x174a53,_0x9c94('0x12'));logger[_0x9c94('0x13')](_0x9c94('0x14'),_0x174a53,_0x9c94('0x12'),JSON[_0x9c94('0x15')](_0x18aa3a));if(_0x18aa3a[_0x9c94('0x16')]){if(_0x18aa3a[_0x9c94('0x16')][_0x9c94('0x17')]===0x1f4){logger[_0x9c94('0x16')](_0x9c94('0x11'),_0x174a53,_0x18aa3a['error'][_0x9c94('0x18')]);return _0x3287f8(_0x18aa3a['error'][_0x9c94('0x18')]);}logger[_0x9c94('0x16')]('MailAccount,\x20%s,\x20%s',_0x174a53,_0x18aa3a[_0x9c94('0x16')]['message']);return _0x417063(_0x18aa3a['error'][_0x9c94('0x18')]);}else{logger['info'](_0x9c94('0x11'),_0x174a53,_0x9c94('0x12'));_0x417063(_0x18aa3a['result'][_0x9c94('0x18')]);}})[_0x9c94('0x19')](function(_0x412804){logger[_0x9c94('0x16')](_0x9c94('0x11'),_0x174a53,_0x412804);_0x3287f8(_0x412804);});});}exports[_0x9c94('0x1a')]=function(_0x3e361c){var _0x5cb39c=this;return new Promise(function(_0x2c9736,_0x39e336){return db['MailAccount'][_0x9c94('0x1b')]({'raw':_0x3e361c[_0x9c94('0x1c')]?_0x3e361c[_0x9c94('0x1c')][_0x9c94('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e361c[_0x9c94('0x1c')]?_0x3e361c[_0x9c94('0x1c')][_0x9c94('0x1e')]||null:null,'attributes':_0x3e361c[_0x9c94('0x1c')]?_0x3e361c[_0x9c94('0x1c')][_0x9c94('0x1f')]||null:null,'limit':_0x3e361c[_0x9c94('0x1c')]?_0x3e361c[_0x9c94('0x1c')][_0x9c94('0x20')]||null:null,'include':_0x3e361c[_0x9c94('0x1c')]?_0x3e361c['options'][_0x9c94('0x21')]?_[_0x9c94('0x22')](_0x3e361c['options'][_0x9c94('0x21')],function(_0x2c3d25){return{'model':db[_0x2c3d25[_0x9c94('0x23')]],'as':_0x2c3d25['as'],'attributes':_0x2c3d25[_0x9c94('0x1f')],'include':_0x2c3d25[_0x9c94('0x21')]?_['map'](_0x2c3d25[_0x9c94('0x21')],function(_0x45cf4d){return{'model':db[_0x45cf4d['model']],'as':_0x45cf4d['as'],'attributes':_0x45cf4d[_0x9c94('0x1f')],'include':_0x45cf4d['include']?_[_0x9c94('0x22')](_0x45cf4d[_0x9c94('0x21')],function(_0x330bd4){return{'model':db[_0x330bd4[_0x9c94('0x23')]],'as':_0x330bd4['as'],'attributes':_0x330bd4[_0x9c94('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9c94('0xf')](function(_0xf30dd1){logger['info']('GetMailAccount',_0x3e361c);logger[_0x9c94('0x13')](_0x9c94('0x1a'),_0x3e361c,JSON[_0x9c94('0x15')](_0xf30dd1));_0x2c9736(_0xf30dd1);})['catch'](function(_0x25a6b9){logger['error'](_0x9c94('0x1a'),_0x25a6b9[_0x9c94('0x18')],_0x3e361c);_0x39e336(_0x5cb39c[_0x9c94('0x16')](0x1f4,_0x25a6b9['message']));});});};exports['ShowMailAccount']=function(_0x1f4e4f){var _0x41937d=this;return new Promise(function(_0x1f91ef,_0x48cbe0){return db['MailAccount']['find']({'raw':_0x1f4e4f['options']?_0x1f4e4f[_0x9c94('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f4e4f[_0x9c94('0x1c')]?_0x1f4e4f[_0x9c94('0x1c')]['where']||null:null,'attributes':_0x1f4e4f['options']?_0x1f4e4f[_0x9c94('0x1c')][_0x9c94('0x1f')]||null:null,'include':_0x1f4e4f[_0x9c94('0x1c')]?_0x1f4e4f[_0x9c94('0x1c')][_0x9c94('0x21')]?_[_0x9c94('0x22')](_0x1f4e4f[_0x9c94('0x1c')][_0x9c94('0x21')],function(_0x2c1e89){return{'model':db[_0x2c1e89[_0x9c94('0x23')]],'as':_0x2c1e89['as'],'attributes':_0x2c1e89[_0x9c94('0x1f')],'include':_0x2c1e89[_0x9c94('0x21')]?_[_0x9c94('0x22')](_0x2c1e89[_0x9c94('0x21')],function(_0x3060e8){return{'model':db[_0x3060e8[_0x9c94('0x23')]],'as':_0x3060e8['as'],'attributes':_0x3060e8[_0x9c94('0x1f')],'include':_0x3060e8[_0x9c94('0x21')]?_['map'](_0x3060e8[_0x9c94('0x21')],function(_0x230685){return{'model':db[_0x230685[_0x9c94('0x23')]],'as':_0x230685['as'],'attributes':_0x230685[_0x9c94('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9c94('0xf')](function(_0x11aad3){if(_0x1f4e4f[_0x9c94('0x1c')]['smtp']===!![])_0x11aad3[_0x9c94('0x24')]('smtpOptions',_0x11aad3[_0x9c94('0x25')]());logger[_0x9c94('0x10')](_0x9c94('0x26'),_0x1f4e4f);logger[_0x9c94('0x13')]('ShowMailAccount',_0x1f4e4f,JSON[_0x9c94('0x15')](_0x11aad3));_0x1f91ef(_0x11aad3);})['catch'](function(_0x29f77b){logger[_0x9c94('0x16')](_0x9c94('0x26'),_0x29f77b['message'],_0x1f4e4f);_0x48cbe0(_0x41937d[_0x9c94('0x16')](0x1f4,_0x29f77b['message']));});});};exports[_0x9c94('0x27')]=function(_0x4e8bf0){var _0x4f552b=this;return new Promise(function(_0x9a75f0,_0x1dbada){var _0x11c1c0={'body':_0x4e8bf0[_0x9c94('0x28')],'channel':'mail'};var _0x437910=_[_0x9c94('0x29')](_[_0x9c94('0x2a')](db[_0x9c94('0x2b')]['rawAttributes']),[_0x9c94('0x2c'),_0x9c94('0x2d'),'CompanyId',_0x9c94('0x2e')]);var _0x3d8b31=![];if(_0x4e8bf0[_0x9c94('0x28')]['id']){delete _0x4e8bf0['body']['id'];}if(_['isNil'](_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x2f')])){return _0x1dbada(_0x4f552b[_0x9c94('0x16')](0x1f4,_0x9c94('0x30')));}if(_[_0x9c94('0x31')](_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x28')])||_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x28')]===''){return _0x1dbada(_0x4f552b[_0x9c94('0x16')](0x1f4,_0x9c94('0x32')));}if(_['isNil'](_0x4e8bf0[_0x9c94('0x28')]['mapKey'])){return _0x1dbada(_0x4f552b[_0x9c94('0x16')](0x1f4,_0x9c94('0x33')+_0x437910));}if(!_[_0x9c94('0x34')](_0x437910,_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x35')])){return _0x1dbada(_0x4f552b[_0x9c94('0x16')](0x1f4,_0x9c94('0x36')+_0x437910));}var _0x4aeabc={};_0x4aeabc[_0x4e8bf0['body'][_0x9c94('0x35')]]=_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x2f')];return db['MailAccount'][_0x9c94('0x37')]({'where':{'id':_0x4e8bf0[_0x9c94('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4aeabc,'limit':0x1,'order':[[_0x9c94('0x2d'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x9c94('0x39')},{'model':db['MailServerOut'],'as':_0x9c94('0x3a'),'include':[{'model':db[_0x9c94('0x3b')],'as':_0x9c94('0x3b')}]}]})[_0x9c94('0xf')](function(_0x22eaa4){if(_0x22eaa4&&_0x22eaa4['List']){var _0x33ccef=_0x22eaa4[_0x9c94('0x3c')]({'plain':!![]});_0x11c1c0[_0x9c94('0x38')]=_[_0x9c94('0x3d')](_0x33ccef,[_0x9c94('0x39'),_0x9c94('0x3e')]);_0x11c1c0['account'][_0x9c94('0x3f')]=_0x22eaa4['getSmtpOptions']();_0x11c1c0[_0x9c94('0x40')]=_0x33ccef[_0x9c94('0x39')];_0x11c1c0[_0x9c94('0x41')]=_0x33ccef['List'];_0x11c1c0[_0x9c94('0x40')]=_[_0x9c94('0x42')](_0x11c1c0['applications'],[_0x9c94('0x43')],['asc']);if(_0x11c1c0[_0x9c94('0x38')]&&_0x11c1c0[_0x9c94('0x38')]['autoclose']){_0x11c1c0['applications'][_0x9c94('0x44')]({'id':0x0,'priority':_0x11c1c0['applications'][_0x9c94('0x45')]+0x1,'app':_0x9c94('0x46'),'appdata':_0x9c94('0x47'),'interval':_0x9c94('0x48')});}if(_0x11c1c0['account'][_0x9c94('0x39')]){delete _0x11c1c0[_0x9c94('0x38')]['Applications'];}if(_0x11c1c0['account'][_0x9c94('0x3e')]){delete _0x11c1c0[_0x9c94('0x38')][_0x9c94('0x3e')];}if(_0x33ccef[_0x9c94('0x3e')][_0x9c94('0x49')][_0x9c94('0x45')]){return _0x33ccef['List'][_0x9c94('0x49')][0x0];}var _0x135239=_[_0x9c94('0xa')](_0x4e8bf0[_0x9c94('0x28')],{'firstName':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x2f')],'ListId':_0x33ccef['ListId']});_0x135239[_0x4e8bf0[_0x9c94('0x28')]['mapKey']]=_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x2f')];return db[_0x9c94('0x2b')]['create'](_0x135239);}else{throw new Error(_0x9c94('0x4a'));}})['then'](function(_0x4cfd03){_0x11c1c0[_0x9c94('0x4b')]=_0x4cfd03;if(_0x4cfd03){if(!_0x4e8bf0[_0x9c94('0x28')]['message'][_0x9c94('0x4c')]){_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x4c')]=rs[_0x9c94('0x4d')]()+'\x20'+_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x2f')];}var _0xead975={'ContactId':_0x4cfd03['id'],'MailAccountId':_0x4e8bf0[_0x9c94('0x38')]['id'],'inReplyTo':_0x4e8bf0[_0x9c94('0x28')]['message']['messageId'],'to':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['from'],'cc':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['cc'],'subject':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x4e')],'attach':_0x4e8bf0[_0x9c94('0x28')]['message']['attach'],'lastMsgAt':moment()['format'](_0x9c94('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x4e8bf0[_0x9c94('0x38')]['id']},'include':[{'model':db[_0x9c94('0x50')],'as':_0x9c94('0x51'),'attributes':[_0x9c94('0x4c')],'where':{'messageId':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['inReplyTo']}}]})[_0x9c94('0xf')](function(_0x592b3e){if(_0x592b3e){return[_0x592b3e,![]];}return db[_0x9c94('0x52')][_0x9c94('0x53')](_0xead975)['then'](function(_0x1e3e42){return[_0x1e3e42,!![]];});});}else{throw new Error(_0x9c94('0x54'));}})['spread'](function(_0x3deac6,_0x23c324){if(_0x3deac6){_0x3d8b31=_0x23c324;if(!_0x23c324){return _0x3deac6[_0x9c94('0x55')]({'inReplyTo':_0x4e8bf0[_0x9c94('0x28')]['message'][_0x9c94('0x4c')],'to':_0x4e8bf0[_0x9c94('0x28')]['message']['from'],'cc':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['cc'],'subject':_0x4e8bf0[_0x9c94('0x28')]['message']['subject'],'attach':_0x3deac6[_0x9c94('0x56')]?_0x3deac6[_0x9c94('0x56')]:_0x4e8bf0[_0x9c94('0x28')]['message'][_0x9c94('0x56')],'substatus':null,'substatusAt':moment()[_0x9c94('0x57')](_0x9c94('0x4f')),'lastMsgAt':moment()[_0x9c94('0x57')](_0x9c94('0x4f')),'lastMsgDirection':'in'});}else{return _0x3deac6;}}})[_0x9c94('0xf')](function(_0x4ff9ea){_0x11c1c0[_0x9c94('0x58')]=_0x4ff9ea[_0x9c94('0x3c')]({'plain':!![]});_0x11c1c0[_0x9c94('0x58')][_0x9c94('0x59')]=_0x3d8b31;return db[_0x9c94('0x50')][_0x9c94('0x53')]({'body':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x28')],'MailAccountId':_0x4e8bf0[_0x9c94('0x38')]['id'],'MailInteractionId':_0x4ff9ea['id'],'direction':'in','ContactId':_0x11c1c0[_0x9c94('0x4b')]['id'],'messageId':_0x4e8bf0[_0x9c94('0x28')]['message']['messageId'],'from':_0x4e8bf0[_0x9c94('0x28')]['message']['from'],'to':_0x4e8bf0['body'][_0x9c94('0x18')]['to'],'cc':_0x4e8bf0[_0x9c94('0x28')]['message']['cc'],'subject':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x4e')],'attach':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['attach'],'Attachments':_0x4e8bf0[_0x9c94('0x28')]['message'][_0x9c94('0x5a')],'originTo':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x5b')],'originCc':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x5c')],'bcc':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x5d')],'ChatWebsiteId':_0x4e8bf0[_0x9c94('0x28')]['message'][_0x9c94('0x5e')]||null,'originChannel':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')]['originChannel']||_0x9c94('0x5f'),'ChatOfflineMessageId':_0x4e8bf0[_0x9c94('0x28')][_0x9c94('0x18')][_0x9c94('0x60')]||null},{'include':[{'model':db[_0x9c94('0x61')],'as':_0x9c94('0x62')}]});})[_0x9c94('0xf')](function(_0x5c02f2){_0x11c1c0[_0x9c94('0x18')]=_0x5c02f2;if(!_0x11c1c0[_0x9c94('0x58')][_0x9c94('0x63')]){return;}return db['User'][_0x9c94('0x37')]({'attributes':['id',_0x9c94('0x64')],'where':{'id':_0x11c1c0[_0x9c94('0x58')][_0x9c94('0x63')]}});})['then'](function(_0x3fa6be){if(_0x3fa6be){_0x11c1c0[_0x9c94('0x40')][_0x9c94('0x65')]({'id':0x0,'priority':0x0,'app':_0x9c94('0x66'),'appdata':_0x3fa6be[_0x9c94('0x64')]+','+(_0x11c1c0[_0x9c94('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x11c1c0[_0x9c94('0x58')][_0x9c94('0x67')]){return;}return db[_0x9c94('0x68')]['find']({'attributes':['id',_0x9c94('0x64')],'where':{'id':_0x11c1c0[_0x9c94('0x58')][_0x9c94('0x67')]}});})['then'](function(_0x44dbb1){if(_0x44dbb1){_0x11c1c0['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x9c94('0x69'),'appdata':_0x44dbb1[_0x9c94('0x64')]+','+(_0x11c1c0['account'][_0x9c94('0x6a')]||0x12c),'interval':_0x9c94('0x48')});}return respondWithRpcPromise('Start',_0x9c94('0x6b'),_0x11c1c0);})[_0x9c94('0xf')](function(_0xe7fc99){_0x9a75f0(_0xe7fc99);})[_0x9c94('0x19')](function(_0x3fc56a){_0x1dbada(_0x4f552b[_0x9c94('0x16')](0x1f4,_0x3fc56a[_0x9c94('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f167e14..f6b3512 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 _0x5665=['removeListener','mailAccount:','./mailAccount.events','remove','emit'];(function(_0x5dcd6a,_0x484a00){var _0x135b5e=function(_0x5541d3){while(--_0x5541d3){_0x5dcd6a['push'](_0x5dcd6a['shift']());}};_0x135b5e(++_0x484a00);}(_0x5665,0x183));var _0x5566=function(_0x547698,_0x2c177a){_0x547698=_0x547698-0x0;var _0x15fd16=_0x5665[_0x547698];return _0x15fd16;};'use strict';var MailAccountEvents=require(_0x5566('0x0'));var events=['save',_0x5566('0x1'),'update'];function createListener(_0x999bd1,_0x16e638){return function(_0x28c30c){_0x16e638[_0x5566('0x2')](_0x999bd1,_0x28c30c);};}function removeListener(_0x2a76,_0x5ee65c){return function(){MailAccountEvents[_0x5566('0x3')](_0x2a76,_0x5ee65c);};}exports['register']=function(_0x1509d7){for(var _0x59c1af=0x0,_0x36ad47=events['length'];_0x59c1af<_0x36ad47;_0x59c1af++){var _0x11ef4d=events[_0x59c1af];var _0x220770=createListener(_0x5566('0x4')+_0x11ef4d,_0x1509d7);MailAccountEvents['on'](_0x11ef4d,_0x220770);}}; \ No newline at end of file +var _0xabd3=['update','removeListener','register','length','mailAccount:','remove'];(function(_0x56b22e,_0x7dddfa){var _0x2006c0=function(_0x13d93e){while(--_0x13d93e){_0x56b22e['push'](_0x56b22e['shift']());}};_0x2006c0(++_0x7dddfa);}(_0xabd3,0x1f1));var _0x3abd=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0xabd3[_0x4bb2b9];return _0x40e2a2;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x3abd('0x0'),_0x3abd('0x1')];function createListener(_0x52c10e,_0x2094e3){return function(_0x3fd8a7){_0x2094e3['emit'](_0x52c10e,_0x3fd8a7);};}function removeListener(_0x2f94c9,_0x382d3a){return function(){MailAccountEvents[_0x3abd('0x2')](_0x2f94c9,_0x382d3a);};}exports[_0x3abd('0x3')]=function(_0xf0e861){for(var _0x2892fe=0x0,_0x2587d3=events[_0x3abd('0x4')];_0x2892fe<_0x2587d3;_0x2892fe++){var _0x35eaa4=events[_0x2892fe];var _0x4c5749=createListener(_0x3abd('0x5')+_0x35eaa4,_0xf0e861);MailAccountEvents['on'](_0x35eaa4,_0x4c5749);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index b21310c..acc8f5d 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 _0x4982=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put','/:id','destroy','multer','util','connect-timeout'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0x4982,0x66));var _0x2498=function(_0x421fa9,_0x5da593){_0x421fa9=_0x421fa9-0x0;var _0x366b27=_0x4982[_0x421fa9];return _0x366b27;};'use strict';var multer=require(_0x2498('0x0'));var util=require(_0x2498('0x1'));var path=require('path');var timeout=require(_0x2498('0x2'));var express=require(_0x2498('0x3'));var router=express[_0x2498('0x4')]();var fs_extra=require(_0x2498('0x5'));var auth=require(_0x2498('0x6'));var interaction=require(_0x2498('0x7'));var config=require(_0x2498('0x8'));var controller=require(_0x2498('0x9'));router[_0x2498('0xa')]('/:id',auth[_0x2498('0xb')](),controller['show']);router[_0x2498('0xc')]('/:id',auth[_0x2498('0xb')](),controller['update']);router['delete'](_0x2498('0xd'),auth[_0x2498('0xb')](),controller[_0x2498('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6e94=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path'];(function(_0x52a283,_0x77fbf8){var _0x38841=function(_0x4b9249){while(--_0x4b9249){_0x52a283['push'](_0x52a283['shift']());}};_0x38841(++_0x77fbf8);}(_0x6e94,0x97));var _0x46e9=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0x6e94[_0xf237f7];return _0x2c183b;};'use strict';var multer=require('multer');var util=require(_0x46e9('0x0'));var path=require(_0x46e9('0x1'));var timeout=require('connect-timeout');var express=require(_0x46e9('0x2'));var router=express[_0x46e9('0x3')]();var fs_extra=require(_0x46e9('0x4'));var auth=require(_0x46e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x46e9('0x6'));var controller=require(_0x46e9('0x7'));router[_0x46e9('0x8')](_0x46e9('0x9'),auth[_0x46e9('0xa')](),controller[_0x46e9('0xb')]);router[_0x46e9('0xc')](_0x46e9('0x9'),auth[_0x46e9('0xa')](),controller[_0x46e9('0xd')]);router[_0x46e9('0xe')]('/:id',auth[_0x46e9('0xa')](),controller[_0x46e9('0xf')]);module[_0x46e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 344e46c..09e2a81 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 _0xfdc7=['TEXT','STRING','*,*,*,*','sequelize','noop'];(function(_0xc2dccb,_0x5957f2){var _0x3239b3=function(_0x58f337){while(--_0x58f337){_0xc2dccb['push'](_0xc2dccb['shift']());}};_0x3239b3(++_0x5957f2);}(_0xfdc7,0x99));var _0x7fdc=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xfdc7[_0x55ff3e];return _0x2709eb;};'use strict';var Sequelize=require(_0x7fdc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7fdc('0x1')},'appdata':{'type':Sequelize[_0x7fdc('0x2')]()},'description':{'type':Sequelize[_0x7fdc('0x3')]},'interval':{'type':Sequelize[_0x7fdc('0x3')],'defaultValue':_0x7fdc('0x4')}}; \ No newline at end of file +var _0xf803=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4f7662,_0x5b87f4){var _0x57f13e=function(_0x589182){while(--_0x589182){_0x4f7662['push'](_0x4f7662['shift']());}};_0x57f13e(++_0x5b87f4);}(_0xf803,0x106));var _0x3f80=function(_0x416a30,_0x2257e9){_0x416a30=_0x416a30-0x0;var _0x3e6ba7=_0xf803[_0x416a30];return _0x3e6ba7;};'use strict';var Sequelize=require(_0x3f80('0x0'));module[_0x3f80('0x1')]={'priority':{'type':Sequelize[_0x3f80('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3f80('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f80('0x4')]()},'description':{'type':Sequelize[_0x3f80('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3f80('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7884008..27ca945 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2e1f2c,_0x1524e0){var _0x1e5a28=function(_0x1ae334){while(--_0x1ae334){_0x2e1f2c['push'](_0x2e1f2c['shift']());}};_0x1e5a28(++_0x1524e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x138599,_0x1f640f){var _0x566dbd=function(_0x5a542e){while(--_0x5a542e){_0x138599['push'](_0x138599['shift']());}};_0x566dbd(++_0x1f640f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 40b741e..af23110 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 _0xba7d=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba7d,0x1db));var _0xdba7=function(_0x398a71,_0x343ef0){_0x398a71=_0x398a71-0x0;var _0x2c0eed=_0xba7d[_0x398a71];return _0x2c0eed;};'use strict';var _=require(_0xdba7('0x0'));var util=require(_0xdba7('0x1'));var logger=require(_0xdba7('0x2'))(_0xdba7('0x3'));var moment=require(_0xdba7('0x4'));var BPromise=require(_0xdba7('0x5'));var rp=require(_0xdba7('0x6'));var fs=require('fs');var path=require(_0xdba7('0x7'));var rimraf=require(_0xdba7('0x8'));var config=require(_0xdba7('0x9'));var attributes=require(_0xdba7('0xa'));module['exports']=function(_0x33e608,_0x5b528d){return _0x33e608[_0xdba7('0xb')](_0xdba7('0xc'),attributes,{'tableName':_0xdba7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdba7('0xe'),'collate':_0xdba7('0xf')});}; \ No newline at end of file +var _0xa6f0=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6f0,0xb1));var _0x0a6f=function(_0x4a9e86,_0x4086bd){_0x4a9e86=_0x4a9e86-0x0;var _0x231ef1=_0xa6f0[_0x4a9e86];return _0x231ef1;};'use strict';var _=require(_0x0a6f('0x0'));var util=require(_0x0a6f('0x1'));var logger=require(_0x0a6f('0x2'))(_0x0a6f('0x3'));var moment=require(_0x0a6f('0x4'));var BPromise=require(_0x0a6f('0x5'));var rp=require(_0x0a6f('0x6'));var fs=require('fs');var path=require(_0x0a6f('0x7'));var rimraf=require(_0x0a6f('0x8'));var config=require(_0x0a6f('0x9'));var attributes=require(_0x0a6f('0xa'));module[_0x0a6f('0xb')]=function(_0x15f2b7,_0x4b225a){return _0x15f2b7[_0x0a6f('0xc')](_0x0a6f('0xd'),attributes,{'tableName':_0x0a6f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0a6f('0xf'),'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 ebe77e6..0220e47 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 _0x264a=['UpdateMailApplication','MailApplication','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result'];(function(_0x5ec95a,_0x344b14){var _0x504fb7=function(_0x58aefc){while(--_0x58aefc){_0x5ec95a['push'](_0x5ec95a['shift']());}};_0x504fb7(++_0x344b14);}(_0x264a,0x1e6));var _0xa264=function(_0x3014fe,_0xe7fe68){_0x3014fe=_0x3014fe-0x0;var _0x67b54d=_0x264a[_0x3014fe];return _0x67b54d;};'use strict';var _=require(_0xa264('0x0'));var util=require(_0xa264('0x1'));var moment=require(_0xa264('0x2'));var BPromise=require(_0xa264('0x3'));var rs=require(_0xa264('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa264('0x5'))['db'];var utils=require(_0xa264('0x6'));var logger=require(_0xa264('0x7'))(_0xa264('0x8'));var config=require(_0xa264('0x9'));var jayson=require(_0xa264('0xa'));var client=jayson[_0xa264('0xb')][_0xa264('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422d05,_0x42d270,_0x2b88bd){return new BPromise(function(_0x1b403c,_0x383781){return client[_0xa264('0xd')](_0x422d05,_0x2b88bd)[_0xa264('0xe')](function(_0x572dd7){logger[_0xa264('0xf')]('MailApplication,\x20%s,\x20%s',_0x42d270,'request\x20sent');logger[_0xa264('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x42d270,_0xa264('0x11'),JSON[_0xa264('0x12')](_0x572dd7));if(_0x572dd7[_0xa264('0x13')]){if(_0x572dd7['error'][_0xa264('0x14')]===0x1f4){logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);return _0x383781(_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);}logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);return _0x1b403c(_0x572dd7[_0xa264('0x13')][_0xa264('0x16')]);}else{logger[_0xa264('0xf')](_0xa264('0x15'),_0x42d270,'request\x20sent');_0x1b403c(_0x572dd7[_0xa264('0x17')]['message']);}})['catch'](function(_0x3889a2){logger[_0xa264('0x13')](_0xa264('0x15'),_0x42d270,_0x3889a2);_0x383781(_0x3889a2);});});}exports[_0xa264('0x18')]=function(_0x3efb00){var _0x437162=this;return new Promise(function(_0x5c28b9,_0xa1d68a){return db[_0xa264('0x19')]['update'](_0x3efb00[_0xa264('0x1a')],{'raw':_0x3efb00[_0xa264('0x1b')]?_0x3efb00['options'][_0xa264('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')]['where']||null:null,'attributes':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')]['attributes']||null:null,'limit':_0x3efb00[_0xa264('0x1b')]?_0x3efb00[_0xa264('0x1b')][_0xa264('0x1d')]||null:null})[_0xa264('0xe')](function(_0x57ec47){logger[_0xa264('0xf')](_0xa264('0x18'),_0x3efb00);logger['debug'](_0xa264('0x18'),_0x3efb00,JSON[_0xa264('0x12')](_0x57ec47));_0x5c28b9(_0x57ec47);})['catch'](function(_0x2a2922){logger['error']('UpdateMailApplication',_0x2a2922[_0xa264('0x16')],_0x3efb00);_0xa1d68a(_0x437162[_0xa264('0x13')](0x1f4,_0x2a2922[_0xa264('0x16')]));});});}; \ No newline at end of file +var _0x1ba8=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','attributes','limit','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x1ba8,0x117));var _0x81ba=function(_0x34c18a,_0x3907ce){_0x34c18a=_0x34c18a-0x0;var _0x3b5d47=_0x1ba8[_0x34c18a];return _0x3b5d47;};'use strict';var _=require(_0x81ba('0x0'));var util=require(_0x81ba('0x1'));var moment=require('moment');var BPromise=require(_0x81ba('0x2'));var rs=require(_0x81ba('0x3'));var fs=require('fs');var Redis=require(_0x81ba('0x4'));var db=require(_0x81ba('0x5'))['db'];var utils=require(_0x81ba('0x6'));var logger=require('../../config/logger')(_0x81ba('0x7'));var config=require(_0x81ba('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40d75a,_0x5ed2e0,_0x51876f){return new BPromise(function(_0x31a776,_0x14d6b4){return client[_0x81ba('0x9')](_0x40d75a,_0x51876f)['then'](function(_0x265718){logger[_0x81ba('0xa')](_0x81ba('0xb'),_0x5ed2e0,_0x81ba('0xc'));logger[_0x81ba('0xd')](_0x81ba('0xe'),_0x5ed2e0,_0x81ba('0xc'),JSON[_0x81ba('0xf')](_0x265718));if(_0x265718[_0x81ba('0x10')]){if(_0x265718[_0x81ba('0x10')][_0x81ba('0x11')]===0x1f4){logger['error'](_0x81ba('0xb'),_0x5ed2e0,_0x265718[_0x81ba('0x10')][_0x81ba('0x12')]);return _0x14d6b4(_0x265718['error']['message']);}logger[_0x81ba('0x10')]('MailApplication,\x20%s,\x20%s',_0x5ed2e0,_0x265718[_0x81ba('0x10')]['message']);return _0x31a776(_0x265718[_0x81ba('0x10')]['message']);}else{logger[_0x81ba('0xa')](_0x81ba('0xb'),_0x5ed2e0,_0x81ba('0xc'));_0x31a776(_0x265718[_0x81ba('0x13')]['message']);}})[_0x81ba('0x14')](function(_0x2a1a2f){logger[_0x81ba('0x10')](_0x81ba('0xb'),_0x5ed2e0,_0x2a1a2f);_0x14d6b4(_0x2a1a2f);});});}exports[_0x81ba('0x15')]=function(_0x4ae9a7){var _0x2919f2=this;return new Promise(function(_0x16bfb3,_0xecdd50){return db[_0x81ba('0x16')][_0x81ba('0x17')](_0x4ae9a7[_0x81ba('0x18')],{'raw':_0x4ae9a7[_0x81ba('0x19')]?_0x4ae9a7[_0x81ba('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ae9a7[_0x81ba('0x19')]?_0x4ae9a7['options']['where']||null:null,'attributes':_0x4ae9a7[_0x81ba('0x19')]?_0x4ae9a7[_0x81ba('0x19')][_0x81ba('0x1a')]||null:null,'limit':_0x4ae9a7[_0x81ba('0x19')]?_0x4ae9a7[_0x81ba('0x19')][_0x81ba('0x1b')]||null:null})[_0x81ba('0x1c')](function(_0xc53c07){logger[_0x81ba('0xa')](_0x81ba('0x15'),_0x4ae9a7);logger[_0x81ba('0xd')](_0x81ba('0x15'),_0x4ae9a7,JSON['stringify'](_0xc53c07));_0x16bfb3(_0xc53c07);})[_0x81ba('0x14')](function(_0x5d86a5){logger['error']('UpdateMailApplication',_0x5d86a5[_0x81ba('0x12')],_0x4ae9a7);_0xecdd50(_0x2919f2[_0x81ba('0x10')](0x1f4,_0x5d86a5[_0x81ba('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1652260..ac4220c 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 _0xfa68=['/:id/download','post','/:id/tags','tracked','mail','addTags','put','/:id','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages'];(function(_0x5bb149,_0x456cdc){var _0x1c85f5=function(_0x3c0645){while(--_0x3c0645){_0x5bb149['push'](_0x5bb149['shift']());}};_0x1c85f5(++_0x456cdc);}(_0xfa68,0x86));var _0x8fa6=function(_0x24c246,_0x3f0c88){_0x24c246=_0x24c246-0x0;var _0x3d6517=_0xfa68[_0x24c246];return _0x3d6517;};'use strict';var express=require(_0x8fa6('0x0'));var router=express[_0x8fa6('0x1')]();var auth=require(_0x8fa6('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x8fa6('0x3'));router[_0x8fa6('0x4')]('/',auth[_0x8fa6('0x5')](),controller['index']);router[_0x8fa6('0x4')](_0x8fa6('0x6'),auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x7')]);router[_0x8fa6('0x4')]('/:id',auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x8')]);router['get'](_0x8fa6('0x9'),auth[_0x8fa6('0x5')](),controller['getMessages']);router['get'](_0x8fa6('0xa'),auth[_0x8fa6('0x5')](),controller['download']);router[_0x8fa6('0xb')]('/',auth[_0x8fa6('0x5')](),controller['create']);router['post'](_0x8fa6('0x9'),auth[_0x8fa6('0x5')](),controller['addMessage']);router[_0x8fa6('0xb')](_0x8fa6('0xc'),auth['isAuthenticated'](),interaction[_0x8fa6('0xd')](_0x8fa6('0xe'),'mailinteraction:addtags'),controller[_0x8fa6('0xf')]);router[_0x8fa6('0x10')](_0x8fa6('0x11'),auth[_0x8fa6('0x5')](),interaction[_0x8fa6('0xd')]('mail','mailinteraction:update'),controller[_0x8fa6('0x12')]);router['delete'](_0x8fa6('0x11'),auth[_0x8fa6('0x5')](),interaction[_0x8fa6('0xd')]('mail',_0x8fa6('0x13')),controller[_0x8fa6('0x14')]);router[_0x8fa6('0x15')]('/:id/tags',auth[_0x8fa6('0x5')](),controller[_0x8fa6('0x16')]);module[_0x8fa6('0x17')]=router; \ No newline at end of file +var _0x8b32=['Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','create','/:id/messages','addMessage','post','mailinteraction:addtags','addTags','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports'];(function(_0x535abd,_0x5ac377){var _0x256a30=function(_0x450bdd){while(--_0x450bdd){_0x535abd['push'](_0x535abd['shift']());}};_0x256a30(++_0x5ac377);}(_0x8b32,0x1ee));var _0x28b3=function(_0x45c20f,_0x297bf2){_0x45c20f=_0x45c20f-0x0;var _0x4fc218=_0x8b32[_0x45c20f];return _0x4fc218;};'use strict';var express=require('express');var router=express[_0x28b3('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0x28b3('0x1'));var controller=require(_0x28b3('0x2'));router[_0x28b3('0x3')]('/',auth[_0x28b3('0x4')](),controller[_0x28b3('0x5')]);router['get']('/describe',auth[_0x28b3('0x4')](),controller[_0x28b3('0x6')]);router['get'](_0x28b3('0x7'),auth['isAuthenticated'](),controller[_0x28b3('0x8')]);router['get']('/:id/messages',auth[_0x28b3('0x4')](),controller[_0x28b3('0x9')]);router['get'](_0x28b3('0xa'),auth[_0x28b3('0x4')](),controller[_0x28b3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28b3('0xc')]);router['post'](_0x28b3('0xd'),auth[_0x28b3('0x4')](),controller[_0x28b3('0xe')]);router[_0x28b3('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked']('mail',_0x28b3('0x10')),controller[_0x28b3('0x11')]);router['put'](_0x28b3('0x7'),auth[_0x28b3('0x4')](),interaction[_0x28b3('0x12')](_0x28b3('0x13'),_0x28b3('0x14')),controller[_0x28b3('0x15')]);router[_0x28b3('0x16')](_0x28b3('0x7'),auth[_0x28b3('0x4')](),interaction[_0x28b3('0x12')](_0x28b3('0x13'),_0x28b3('0x17')),controller[_0x28b3('0x18')]);router[_0x28b3('0x16')]('/:id/tags',auth[_0x28b3('0x4')](),controller['removeTags']);module[_0x28b3('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index de5c938..32c9aaf 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 _0x5c60=['iconv','exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out','INTEGER'];(function(_0xcbc60d,_0x2e604a){var _0x102149=function(_0x3c0991){while(--_0x3c0991){_0xcbc60d['push'](_0xcbc60d['shift']());}};_0x102149(++_0x2e604a);}(_0x5c60,0xb4));var _0x05c6=function(_0x194b87,_0x445891){_0x194b87=_0x194b87-0x0;var _0x47f6ba=_0x5c60[_0x194b87];return _0x47f6ba;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x05c6('0x0'));module[_0x05c6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05c6('0x2')]},'disposition':{'type':Sequelize[_0x05c6('0x3')]},'secondDisposition':{'type':Sequelize[_0x05c6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x05c6('0x3')]},'inReplyTo':{'type':Sequelize[_0x05c6('0x3')](0x1fe)},'to':{'type':Sequelize[_0x05c6('0x3')]},'cc':{'type':Sequelize[_0x05c6('0x4')]('long')},'subject':{'type':Sequelize[_0x05c6('0x4')]()},'attach':{'type':Sequelize[_0x05c6('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x05c6('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x05c6('0x6')]('in',_0x05c6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05c6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x05c6('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x05c6('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x05c6('0x8')]}}; \ No newline at end of file +var _0x37dc=['ENUM','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','out'];(function(_0x1ff905,_0x52ccc6){var _0x385152=function(_0x10f096){while(--_0x10f096){_0x1ff905['push'](_0x1ff905['shift']());}};_0x385152(++_0x52ccc6);}(_0x37dc,0xd1));var _0xc37d=function(_0x3f5530,_0x1b3bde){_0x3f5530=_0x3f5530-0x0;var _0x4c93bc=_0x37dc[_0x3f5530];return _0x4c93bc;};'use strict';var Sequelize=require(_0xc37d('0x0'));var iconv=require(_0xc37d('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc37d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc37d('0x3')]},'disposition':{'type':Sequelize[_0xc37d('0x4')]},'secondDisposition':{'type':Sequelize[_0xc37d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc37d('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc37d('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc37d('0x4')]},'cc':{'type':Sequelize[_0xc37d('0x5')]('long')},'subject':{'type':Sequelize[_0xc37d('0x5')]()},'attach':{'type':Sequelize[_0xc37d('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc37d('0x3')]},'substatus':{'type':Sequelize[_0xc37d('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc37d('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc37d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc37d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc37d('0x7')]('in',_0xc37d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc37d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc37d('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3cf89bd..044f252 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 _0xf9a2=['unlinkSync','eml-format','rimraf','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','html-entities','redis','defaults','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','error','stack','name','send','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','intersection','attributes','fields','includeAll','options','find','catch','create','update','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','include','true','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Attachments','basename','readFileSync'];(function(_0x3efe22,_0x3702b7){var _0x99543=function(_0x3a095d){while(--_0x3a095d){_0x3efe22['push'](_0x3efe22['shift']());}};_0x99543(++_0x3702b7);}(_0xf9a2,0x72));var _0x2f9a=function(_0x4fc79e,_0x3b1919){_0x4fc79e=_0x4fc79e-0x0;var _0x301cba=_0xf9a2[_0x4fc79e];return _0x301cba;};'use strict';var emlformat=require(_0x2f9a('0x0'));var rimraf=require(_0x2f9a('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x2f9a('0x2'));var util=require(_0x2f9a('0x3'));var path=require(_0x2f9a('0x4'));var fs=require('fs');var _=require(_0x2f9a('0x5'));var juice=require(_0x2f9a('0x6'));var Redis=require(_0x2f9a('0x7'));var interaction=require(_0x2f9a('0x8'));var qs=require(_0x2f9a('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x2f9a('0xa'));var db=require(_0x2f9a('0xb'))['db'];var htmlEntities=require(_0x2f9a('0xc'));config[_0x2f9a('0xd')]=_[_0x2f9a('0xe')](config[_0x2f9a('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f9a('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1ddd38,_0x4a26e7){_0x4a26e7=_0x4a26e7||0xcc;return function(_0x6ccbf5){if(_0x6ccbf5){return _0x1ddd38[_0x2f9a('0xf')](_0x4a26e7);}return _0x1ddd38[_0x2f9a('0x10')](_0x4a26e7)[_0x2f9a('0x11')]();};}function respondWithResult(_0x381b1b,_0x95c2c){_0x95c2c=_0x95c2c||0xc8;return function(_0x43c083){if(_0x43c083){return _0x381b1b[_0x2f9a('0x10')](_0x95c2c)[_0x2f9a('0x12')](_0x43c083);}};}function respondWithFilteredResult(_0x260c4b,_0x28c298){return function(_0x4d15fe){if(_0x4d15fe){var _0x420fbd=typeof _0x28c298[_0x2f9a('0x13')]==='undefined'&&typeof _0x28c298[_0x2f9a('0x14')]===_0x2f9a('0x15');var _0x15092e=_0x4d15fe[_0x2f9a('0x16')];var _0x4b43e8=_0x420fbd?0x0:_0x28c298[_0x2f9a('0x13')];var _0x7a90b7=_0x420fbd?_0x4d15fe[_0x2f9a('0x16')]:_0x28c298[_0x2f9a('0x13')]+_0x28c298[_0x2f9a('0x14')];var _0x199c8d;if(_0x7a90b7>=_0x15092e){_0x7a90b7=_0x15092e;_0x199c8d=0xc8;}else{_0x199c8d=0xce;}_0x260c4b[_0x2f9a('0x10')](_0x199c8d);return _0x260c4b[_0x2f9a('0x17')](_0x2f9a('0x18'),_0x4b43e8+'-'+_0x7a90b7+'/'+_0x15092e)[_0x2f9a('0x12')](_0x4d15fe);}return null;};}function saveUpdates(_0x26da34){return function(_0x31ad96){if(_0x31ad96){return _0x31ad96['update'](_0x26da34)['then'](function(_0x101426){return _0x101426;});}return null;};}function removeEntity(_0x408bdf){return function(_0xbe96b5){if(_0xbe96b5){return _0xbe96b5[_0x2f9a('0x19')]()[_0x2f9a('0x1a')](function(){_0x408bdf[_0x2f9a('0x10')](0xcc)[_0x2f9a('0x11')]();});}};}function handleEntityNotFound(_0x385108){return function(_0x1ef7c1){if(!_0x1ef7c1){_0x385108[_0x2f9a('0xf')](0x194);}return _0x1ef7c1;};}function handleError(_0x2a74af,_0x793c2f){_0x793c2f=_0x793c2f||0x1f4;return function(_0x20d5c9){logger[_0x2f9a('0x1b')](_0x20d5c9[_0x2f9a('0x1c')]);if(_0x20d5c9['name']){delete _0x20d5c9[_0x2f9a('0x1d')];}_0x2a74af['status'](_0x793c2f)[_0x2f9a('0x1e')](_0x20d5c9);};}exports['index']=function(_0x368d60,_0xf274cc){var _0x166809={};var _0x37c601=_['map'](db[_0x2f9a('0x1f')][_0x2f9a('0x20')],function(_0x4cc8df){return{'name':_0x4cc8df[_0x2f9a('0x21')],'type':_0x4cc8df[_0x2f9a('0x22')][_0x2f9a('0x23')]};});_0x166809=qs[_0x2f9a('0x24')](_0x37c601,_0x368d60);return interaction[_0x2f9a('0x25')](_0x2f9a('0x26'),_0x368d60[_0x2f9a('0x27')],_0x368d60[_0x2f9a('0x28')],_0x166809,_0x37c601)[_0x2f9a('0x1a')](respondWithFilteredResult(_0xf274cc,_0x166809))['catch'](handleError(_0xf274cc,null));};exports[_0x2f9a('0x29')]=function(_0x1a4994,_0x187cff){var _0xea62af={'raw':![],'where':{'id':_0x1a4994[_0x2f9a('0x2a')]['id']}},_0xe69211={};_0xe69211[_0x2f9a('0x2b')]=_[_0x2f9a('0x2c')](db[_0x2f9a('0x1f')][_0x2f9a('0x20')]);_0xe69211[_0x2f9a('0x27')]=_[_0x2f9a('0x2c')](_0x1a4994['query']);_0xe69211['filters']=_[_0x2f9a('0x2d')](_0xe69211['model'],_0xe69211[_0x2f9a('0x27')]);_0xea62af[_0x2f9a('0x2e')]=_[_0x2f9a('0x2d')](_0xe69211['model'],qs['fields'](_0x1a4994[_0x2f9a('0x27')][_0x2f9a('0x2f')]));_0xea62af[_0x2f9a('0x2e')]=_0xea62af['attributes']['length']?_0xea62af[_0x2f9a('0x2e')]:_0xe69211[_0x2f9a('0x2b')];if(_0x1a4994[_0x2f9a('0x27')][_0x2f9a('0x30')]){_0xea62af['include']=[{'all':!![]}];}_0xea62af=_['merge']({},_0xea62af,_0x1a4994[_0x2f9a('0x31')]);return db[_0x2f9a('0x1f')][_0x2f9a('0x32')](_0xea62af)[_0x2f9a('0x1a')](handleEntityNotFound(_0x187cff,null))[_0x2f9a('0x1a')](respondWithResult(_0x187cff,null))[_0x2f9a('0x33')](handleError(_0x187cff,null));};exports[_0x2f9a('0x34')]=function(_0x43b380,_0x288dcd){return db[_0x2f9a('0x1f')][_0x2f9a('0x34')](_0x43b380['body'],{})[_0x2f9a('0x1a')](respondWithResult(_0x288dcd,0xc9))[_0x2f9a('0x33')](handleError(_0x288dcd,null));};exports[_0x2f9a('0x35')]=function(_0x539f0c,_0x22c5ac){if(_0x539f0c['body']['id']){delete _0x539f0c[_0x2f9a('0x36')]['id'];}return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x539f0c['params']['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x22c5ac,null))[_0x2f9a('0x1a')](saveUpdates(_0x539f0c[_0x2f9a('0x36')],null))['then'](respondWithResult(_0x22c5ac,null))[_0x2f9a('0x33')](handleError(_0x22c5ac,null));};exports[_0x2f9a('0x19')]=function(_0x4a576d,_0x45b563){return db[_0x2f9a('0x1f')][_0x2f9a('0x32')]({'where':{'id':_0x4a576d[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x45b563,null))[_0x2f9a('0x1a')](removeEntity(_0x45b563,null))[_0x2f9a('0x33')](handleError(_0x45b563,null));};exports[_0x2f9a('0x37')]=function(_0x52dad7,_0x2bf6b1){return db[_0x2f9a('0x1f')][_0x2f9a('0x37')]()[_0x2f9a('0x1a')](respondWithResult(_0x2bf6b1,null))[_0x2f9a('0x33')](handleError(_0x2bf6b1,null));};exports[_0x2f9a('0x38')]=function(_0x180e0c,_0x531bed){return db[_0x2f9a('0x39')][_0x2f9a('0x32')]({'where':{'id':_0x180e0c[_0x2f9a('0x2a')]['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x531bed,null))[_0x2f9a('0x1a')](function(_0x2fb22f){if(_0x2fb22f){return _0x2fb22f[_0x2f9a('0x38')](_0x180e0c['body'][_0x2f9a('0x3a')],_[_0x2f9a('0x3b')](_0x180e0c[_0x2f9a('0x36')],[_0x2f9a('0x3a'),'id'])||{});}})[_0x2f9a('0x1a')](respondWithResult(_0x531bed,null))[_0x2f9a('0x33')](handleError(_0x531bed,null));};exports[_0x2f9a('0x3c')]=function(_0x166d8e,_0x48b956){var _0x224894={'raw':![],'where':{}};var _0x368771={};var _0x5e037b={'count':0x0,'rows':[]};return db[_0x2f9a('0x1f')][_0x2f9a('0x3d')]({'where':{'id':_0x166d8e[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48b956,null))[_0x2f9a('0x1a')](function(_0x452129){if(_0x452129){_0x368771[_0x2f9a('0x2b')]=_[_0x2f9a('0x2c')](db[_0x2f9a('0x39')]['rawAttributes']);_0x368771[_0x2f9a('0x27')]=_[_0x2f9a('0x2c')](_0x166d8e[_0x2f9a('0x27')]);_0x368771[_0x2f9a('0x3e')]=_[_0x2f9a('0x2d')](_0x368771[_0x2f9a('0x2b')],_0x368771[_0x2f9a('0x27')]);_0x224894['attributes']=_[_0x2f9a('0x2d')](_0x368771['model'],qs[_0x2f9a('0x2f')](_0x166d8e[_0x2f9a('0x27')]['fields']));_0x224894[_0x2f9a('0x2e')]=_0x224894[_0x2f9a('0x2e')][_0x2f9a('0x3f')]?_0x224894[_0x2f9a('0x2e')]:_0x368771[_0x2f9a('0x2b')];if(!_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x40')](_0x2f9a('0x41'))){_0x224894[_0x2f9a('0x14')]=qs[_0x2f9a('0x14')](_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x14')]);_0x224894[_0x2f9a('0x13')]=qs[_0x2f9a('0x13')](_0x166d8e['query']['offset']);}_0x224894[_0x2f9a('0x42')]=qs[_0x2f9a('0x43')](_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x43')]);_0x224894[_0x2f9a('0x44')]=qs['filters'](_[_0x2f9a('0x45')](_0x166d8e[_0x2f9a('0x27')],_0x368771['filters']));_0x224894[_0x2f9a('0x44')][_0x2f9a('0x46')]=_0x452129['id'];if(_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x47')]){_0x224894[_0x2f9a('0x44')]=_['merge'](_0x224894['where'],{'$or':_['map'](_0x224894[_0x2f9a('0x2e')],function(_0x140b3a){var _0x4ce8b6={};_0x4ce8b6[_0x140b3a]={'$like':'%'+_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x47')]+'%'};return _0x4ce8b6;})});}if(_0x166d8e['query'][_0x2f9a('0x48')]){var _0x184f84=_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x48')][_0x2f9a('0x49')](',');var _0x29cb99={};_0x29cb99[_0x184f84[0x0]]={'$gte':moment(_0x184f84[0x1])[_0x2f9a('0x4a')](_0x2f9a('0x4b'))};_0x224894[_0x2f9a('0x44')]=_[_0x2f9a('0x4c')](_0x224894[_0x2f9a('0x44')],_0x29cb99);}_0x224894=_['merge']({},_0x224894,_0x166d8e[_0x2f9a('0x31')]);return db['MailMessage'][_0x2f9a('0x16')]({'where':_0x224894[_0x2f9a('0x44')]})['then'](function(_0x268d3f){_0x5e037b[_0x2f9a('0x16')]=_0x268d3f;if(_0x166d8e[_0x2f9a('0x27')][_0x2f9a('0x30')]){_0x224894[_0x2f9a('0x4d')]=[{'all':!![]}];}return db[_0x2f9a('0x39')][_0x2f9a('0x25')](_0x224894);})[_0x2f9a('0x1a')](function(_0x3f871c){if(_0x166d8e[_0x2f9a('0x27')]['inlineCss']===_0x2f9a('0x4e')){for(var _0x4a9817=0x0;_0x4a9817<_0x3f871c['length'];_0x4a9817++){_0x3f871c[_0x4a9817][_0x2f9a('0x36')]=juice(_0x3f871c[_0x4a9817][_0x2f9a('0x36')]);}}_0x5e037b['rows']=_0x3f871c;return _0x5e037b;});}})[_0x2f9a('0x1a')](respondWithFilteredResult(_0x48b956,_0x224894))[_0x2f9a('0x33')](handleError(_0x48b956,null));};exports[_0x2f9a('0x4f')]=function(_0x523a0e,_0x3ef296){return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x523a0e[_0x2f9a('0x2a')]['id']}})[_0x2f9a('0x1a')](handleEntityNotFound(_0x3ef296,null))[_0x2f9a('0x1a')](function(_0x4389c1){if(_0x4389c1){return _0x4389c1['setTags'](_0x523a0e['body'][_0x2f9a('0x3a')],_[_0x2f9a('0x3b')](_0x523a0e['body'],['ids','id'])||{})[_0x2f9a('0x50')](function(){return db[_0x2f9a('0x51')][_0x2f9a('0x25')]({'attributes':['id',_0x2f9a('0x1d'),_0x2f9a('0x52')],'where':{'id':_0x523a0e[_0x2f9a('0x36')][_0x2f9a('0x3a')]}});})['then'](function(_0x3e24ce){socket[_0x2f9a('0x53')](_0x2f9a('0x54'),{'id':Number(_0x523a0e[_0x2f9a('0x2a')]['id']),'tags':_0x3e24ce||[]});return{'id':Number(_0x523a0e[_0x2f9a('0x2a')]['id']),'tags':_0x3e24ce||[]};});}})[_0x2f9a('0x1a')](respondWithResult(_0x3ef296,null))['catch'](handleError(_0x3ef296,null));};exports[_0x2f9a('0x55')]=function(_0x3b66a3,_0x1a4139){return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0x3b66a3[_0x2f9a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1a4139,null))[_0x2f9a('0x1a')](function(_0x2cb83f){if(_0x2cb83f){return _0x2cb83f[_0x2f9a('0x55')](_0x3b66a3[_0x2f9a('0x27')][_0x2f9a('0x3a')]);}})[_0x2f9a('0x1a')](respondWithStatusCode(_0x1a4139,null))[_0x2f9a('0x33')](handleError(_0x1a4139,null));};exports[_0x2f9a('0x56')]=function(_0xfe9dfe,_0x425fa4){var _0x9cf5f2=moment()[_0x2f9a('0x57')]()[_0x2f9a('0x58')]();var _0x427e69=path['join'](config[_0x2f9a('0x59')],'server',_0x2f9a('0x5a'),_0x2f9a('0x5b'));var _0x3b98f9=path[_0x2f9a('0x5c')](config['root'],_0x2f9a('0x5d'),'files',_0x2f9a('0x5e'));var _0x334d77=path['join'](_0x427e69,_0x9cf5f2);var _0x12ba06=util[_0x2f9a('0x4a')]('transcript-%d-%s.zip',_0xfe9dfe[_0x2f9a('0x2a')]['id'],_0x9cf5f2);var _0x4c5e47=path[_0x2f9a('0x5c')](_0x427e69,_0x12ba06);var _0x5c6000=[];if(_0xfe9dfe[_0x2f9a('0x27')][_0x2f9a('0x5e')]){_0x5c6000[_0x2f9a('0x5f')]({'model':db[_0x2f9a('0x60')],'as':'Attachments','raw':!![]});}var _0x5d4051=[{'model':db[_0x2f9a('0x39')],'as':_0x2f9a('0x61'),'attributes':['id',_0x2f9a('0x36'),_0x2f9a('0x62'),'to','cc','bcc',_0x2f9a('0x63'),_0x2f9a('0x64')],'where':{'secret':![]},'order':qs[_0x2f9a('0x43')]('id'),'include':_0x5c6000}];return db['MailInteraction'][_0x2f9a('0x32')]({'where':{'id':_0xfe9dfe['params']['id']},'include':_0x5d4051})['then'](handleEntityNotFound(_0x425fa4,null))[_0x2f9a('0x1a')](function(_0x32fc24){if(_0x32fc24&&_0x32fc24[_0x2f9a('0x61')]){var _0x50085c=_0x32fc24[_0x2f9a('0x65')]({'plain':!![]});fs[_0x2f9a('0x66')](_0x334d77);return BPromise[_0x2f9a('0x67')](_0x50085c[_0x2f9a('0x61')],function(_0x5b33b5,_0x130b8d){var _0x13acda={'from':_0x5b33b5[_0x2f9a('0x62')],'to':_0x5b33b5['to']||_0x2f9a('0x68'),'subject':_0x5b33b5['subject'],'html':htmlEntities[_0x2f9a('0x69')](_0x5b33b5[_0x2f9a('0x36')]),'headers':{'Date':moment(_0x5b33b5[_0x2f9a('0x64')])[_0x2f9a('0x4a')](_0x2f9a('0x6a'))},'attachments':[]};if(_0x5b33b5['cc']){_0x13acda['headers']['Cc']=_0x5b33b5['cc'];}if(_0x5b33b5[_0x2f9a('0x6b')]){_0x13acda[_0x2f9a('0x6c')]['Bcc']=_0x5b33b5[_0x2f9a('0x6b')];}return new BPromise(function(_0x74f3b9,_0x14aeda){if(_0x5b33b5['Attachments']){for(var _0x3b6e30=0x0;_0x3b6e30<_0x5b33b5[_0x2f9a('0x6d')]['length'];_0x3b6e30++){var _0x59cc81=_0x5b33b5[_0x2f9a('0x6d')][_0x3b6e30];var _0x323f62=path[_0x2f9a('0x5c')](_0x3b98f9,_0x59cc81[_0x2f9a('0x6e')]);if(fs['existsSync'](_0x323f62)){_0x13acda[_0x2f9a('0x5e')][_0x2f9a('0x5f')]({'name':_0x59cc81[_0x2f9a('0x1d')],'contentType':_0x59cc81['type'],'data':fs[_0x2f9a('0x6f')](_0x323f62)});}}}emlformat['build'](_0x13acda,function(_0xbff93f,_0x36da8d){if(_0xbff93f)return _0x14aeda(_0xbff93f);fs['writeFileSync'](path[_0x2f9a('0x5c')](_0x334d77,util[_0x2f9a('0x4a')]('message%d.eml',_0x130b8d)),_0x36da8d);return _0x74f3b9(_0x36da8d);});});})[_0x2f9a('0x1a')](function(){return new BPromise(function(_0x3ee3fe,_0x366143){zipdir(_0x334d77,{'saveTo':_0x4c5e47},function(_0x193f96,_0x47125f){if(_0x193f96)return _0x366143(_0x193f96);return _0x3ee3fe(_0x47125f);});})[_0x2f9a('0x1a')](function(){return new BPromise(function(_0x261d89,_0x4c3847){rimraf(_0x334d77,function(_0x5d5a86){if(_0x5d5a86)_0x4c3847(_0x5d5a86);return _0x261d89();});});})['then'](function(){return _0x425fa4['download'](_0x4c5e47,_0x12ba06,function(_0xc62ea6){if(!_0xc62ea6)fs[_0x2f9a('0x70')](_0x4c5e47);});});});}else{return _0x425fa4[_0x2f9a('0xf')](0xc8);}})[_0x2f9a('0x33')](handleError(_0x425fa4,null));}; \ No newline at end of file +var _0x88f5=['index','MailInteraction','rawAttributes','fieldName','type','findAll','mail','user','catch','show','model','keys','query','filters','attributes','intersection','fields','length','includeAll','include','merge','create','body','find','params','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','nolimit','sort','where','pick','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','rows','addTags','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','bcc','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','stack','name'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x88f5,0x196));var _0x588f=function(_0x4987c2,_0x3c4f3b){_0x4987c2=_0x4987c2-0x0;var _0x55001a=_0x88f5[_0x4987c2];return _0x55001a;};'use strict';var emlformat=require(_0x588f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x588f('0x1'));var moment=require(_0x588f('0x2'));var BPromise=require(_0x588f('0x3'));var util=require(_0x588f('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x588f('0x5'));var juice=require(_0x588f('0x6'));var Redis=require(_0x588f('0x7'));var interaction=require(_0x588f('0x8'));var qs=require(_0x588f('0x9'));var logger=require(_0x588f('0xa'))(_0x588f('0xb'));var config=require(_0x588f('0xc'));var db=require(_0x588f('0xd'))['db'];var htmlEntities=require(_0x588f('0xe'));config[_0x588f('0xf')]=_[_0x588f('0x10')](config['redis'],{'host':_0x588f('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x588f('0xf')]));require('./mailInteraction.socket')[_0x588f('0x12')](socket);function respondWithStatusCode(_0x537860,_0x4292d5){_0x4292d5=_0x4292d5||0xcc;return function(_0x318070){if(_0x318070){return _0x537860[_0x588f('0x13')](_0x4292d5);}return _0x537860['status'](_0x4292d5)['end']();};}function respondWithResult(_0x2fc4f6,_0x853f8e){_0x853f8e=_0x853f8e||0xc8;return function(_0x12a203){if(_0x12a203){return _0x2fc4f6[_0x588f('0x14')](_0x853f8e)['json'](_0x12a203);}};}function respondWithFilteredResult(_0x5dde70,_0x519b69){return function(_0x9cf716){if(_0x9cf716){var _0x8ce906=typeof _0x519b69[_0x588f('0x15')]===_0x588f('0x16')&&typeof _0x519b69[_0x588f('0x17')]===_0x588f('0x16');var _0x5bb755=_0x9cf716['count'];var _0x5db4b1=_0x8ce906?0x0:_0x519b69[_0x588f('0x15')];var _0x30a90e=_0x8ce906?_0x9cf716[_0x588f('0x18')]:_0x519b69[_0x588f('0x15')]+_0x519b69[_0x588f('0x17')];var _0xe82cff;if(_0x30a90e>=_0x5bb755){_0x30a90e=_0x5bb755;_0xe82cff=0xc8;}else{_0xe82cff=0xce;}_0x5dde70['status'](_0xe82cff);return _0x5dde70[_0x588f('0x19')](_0x588f('0x1a'),_0x5db4b1+'-'+_0x30a90e+'/'+_0x5bb755)[_0x588f('0x1b')](_0x9cf716);}return null;};}function saveUpdates(_0x401c2a){return function(_0x1d5fa6){if(_0x1d5fa6){return _0x1d5fa6[_0x588f('0x1c')](_0x401c2a)[_0x588f('0x1d')](function(_0x331b8b){return _0x331b8b;});}return null;};}function removeEntity(_0x5624f0){return function(_0x4a1271){if(_0x4a1271){return _0x4a1271[_0x588f('0x1e')]()[_0x588f('0x1d')](function(){_0x5624f0[_0x588f('0x14')](0xcc)[_0x588f('0x1f')]();});}};}function handleEntityNotFound(_0x11ca8d){return function(_0x48deb0){if(!_0x48deb0){_0x11ca8d[_0x588f('0x13')](0x194);}return _0x48deb0;};}function handleError(_0x250da1,_0x572d0c){_0x572d0c=_0x572d0c||0x1f4;return function(_0x56f912){logger['error'](_0x56f912[_0x588f('0x20')]);if(_0x56f912[_0x588f('0x21')]){delete _0x56f912[_0x588f('0x21')];}_0x250da1[_0x588f('0x14')](_0x572d0c)['send'](_0x56f912);};}exports[_0x588f('0x22')]=function(_0x18d137,_0x269cb2){var _0x55099d={};var _0x1bc432=_['map'](db[_0x588f('0x23')][_0x588f('0x24')],function(_0x28ffbb){return{'name':_0x28ffbb[_0x588f('0x25')],'type':_0x28ffbb[_0x588f('0x26')]['key']};});_0x55099d=qs['getOptions'](_0x1bc432,_0x18d137);return interaction[_0x588f('0x27')](_0x588f('0x28'),_0x18d137['query'],_0x18d137[_0x588f('0x29')],_0x55099d,_0x1bc432)[_0x588f('0x1d')](respondWithFilteredResult(_0x269cb2,_0x55099d))[_0x588f('0x2a')](handleError(_0x269cb2,null));};exports[_0x588f('0x2b')]=function(_0x37a268,_0x1e9050){var _0x553c05={'raw':![],'where':{'id':_0x37a268['params']['id']}},_0x25d743={};_0x25d743[_0x588f('0x2c')]=_[_0x588f('0x2d')](db[_0x588f('0x23')][_0x588f('0x24')]);_0x25d743[_0x588f('0x2e')]=_[_0x588f('0x2d')](_0x37a268[_0x588f('0x2e')]);_0x25d743[_0x588f('0x2f')]=_['intersection'](_0x25d743[_0x588f('0x2c')],_0x25d743[_0x588f('0x2e')]);_0x553c05[_0x588f('0x30')]=_[_0x588f('0x31')](_0x25d743[_0x588f('0x2c')],qs[_0x588f('0x32')](_0x37a268[_0x588f('0x2e')]['fields']));_0x553c05[_0x588f('0x30')]=_0x553c05[_0x588f('0x30')][_0x588f('0x33')]?_0x553c05[_0x588f('0x30')]:_0x25d743[_0x588f('0x2c')];if(_0x37a268[_0x588f('0x2e')][_0x588f('0x34')]){_0x553c05[_0x588f('0x35')]=[{'all':!![]}];}_0x553c05=_[_0x588f('0x36')]({},_0x553c05,_0x37a268['options']);return db[_0x588f('0x23')]['find'](_0x553c05)[_0x588f('0x1d')](handleEntityNotFound(_0x1e9050,null))['then'](respondWithResult(_0x1e9050,null))['catch'](handleError(_0x1e9050,null));};exports[_0x588f('0x37')]=function(_0x4b6cd6,_0x35d070){return db['MailInteraction'][_0x588f('0x37')](_0x4b6cd6[_0x588f('0x38')],{})['then'](respondWithResult(_0x35d070,0xc9))['catch'](handleError(_0x35d070,null));};exports[_0x588f('0x1c')]=function(_0x4d0c0f,_0xd3479a){if(_0x4d0c0f[_0x588f('0x38')]['id']){delete _0x4d0c0f[_0x588f('0x38')]['id'];}return db['MailInteraction'][_0x588f('0x39')]({'where':{'id':_0x4d0c0f[_0x588f('0x3a')]['id']}})[_0x588f('0x1d')](handleEntityNotFound(_0xd3479a,null))[_0x588f('0x1d')](saveUpdates(_0x4d0c0f[_0x588f('0x38')],null))[_0x588f('0x1d')](respondWithResult(_0xd3479a,null))['catch'](handleError(_0xd3479a,null));};exports[_0x588f('0x1e')]=function(_0x1e3f6b,_0x2ea88b){return db['MailInteraction'][_0x588f('0x39')]({'where':{'id':_0x1e3f6b['params']['id']}})['then'](handleEntityNotFound(_0x2ea88b,null))[_0x588f('0x1d')](removeEntity(_0x2ea88b,null))[_0x588f('0x2a')](handleError(_0x2ea88b,null));};exports[_0x588f('0x3b')]=function(_0x322dbe,_0x446f75){return db['MailInteraction'][_0x588f('0x3b')]()[_0x588f('0x1d')](respondWithResult(_0x446f75,null))['catch'](handleError(_0x446f75,null));};exports[_0x588f('0x3c')]=function(_0x379571,_0x45a9fc){return db[_0x588f('0x3d')]['find']({'where':{'id':_0x379571[_0x588f('0x3a')]['id']}})[_0x588f('0x1d')](handleEntityNotFound(_0x45a9fc,null))[_0x588f('0x1d')](function(_0x5b2312){if(_0x5b2312){return _0x5b2312[_0x588f('0x3c')](_0x379571['body'][_0x588f('0x3e')],_[_0x588f('0x3f')](_0x379571[_0x588f('0x38')],[_0x588f('0x3e'),'id'])||{});}})[_0x588f('0x1d')](respondWithResult(_0x45a9fc,null))[_0x588f('0x2a')](handleError(_0x45a9fc,null));};exports[_0x588f('0x40')]=function(_0x44ce53,_0x26a2dc){var _0x1acc13={'raw':![],'where':{}};var _0x5c3e49={};var _0x4e208e={'count':0x0,'rows':[]};return db[_0x588f('0x23')][_0x588f('0x41')]({'where':{'id':_0x44ce53[_0x588f('0x3a')]['id']}})[_0x588f('0x1d')](handleEntityNotFound(_0x26a2dc,null))[_0x588f('0x1d')](function(_0x2a177e){if(_0x2a177e){_0x5c3e49[_0x588f('0x2c')]=_[_0x588f('0x2d')](db[_0x588f('0x3d')][_0x588f('0x24')]);_0x5c3e49[_0x588f('0x2e')]=_[_0x588f('0x2d')](_0x44ce53[_0x588f('0x2e')]);_0x5c3e49[_0x588f('0x2f')]=_[_0x588f('0x31')](_0x5c3e49[_0x588f('0x2c')],_0x5c3e49['query']);_0x1acc13['attributes']=_[_0x588f('0x31')](_0x5c3e49[_0x588f('0x2c')],qs[_0x588f('0x32')](_0x44ce53[_0x588f('0x2e')][_0x588f('0x32')]));_0x1acc13[_0x588f('0x30')]=_0x1acc13['attributes'][_0x588f('0x33')]?_0x1acc13[_0x588f('0x30')]:_0x5c3e49[_0x588f('0x2c')];if(!_0x44ce53[_0x588f('0x2e')]['hasOwnProperty'](_0x588f('0x42'))){_0x1acc13['limit']=qs[_0x588f('0x17')](_0x44ce53[_0x588f('0x2e')][_0x588f('0x17')]);_0x1acc13[_0x588f('0x15')]=qs['offset'](_0x44ce53[_0x588f('0x2e')][_0x588f('0x15')]);}_0x1acc13['order']=qs[_0x588f('0x43')](_0x44ce53[_0x588f('0x2e')][_0x588f('0x43')]);_0x1acc13[_0x588f('0x44')]=qs[_0x588f('0x2f')](_[_0x588f('0x45')](_0x44ce53[_0x588f('0x2e')],_0x5c3e49[_0x588f('0x2f')]));_0x1acc13[_0x588f('0x44')]['MailInteractionId']=_0x2a177e['id'];if(_0x44ce53[_0x588f('0x2e')][_0x588f('0x46')]){_0x1acc13[_0x588f('0x44')]=_[_0x588f('0x36')](_0x1acc13[_0x588f('0x44')],{'$or':_[_0x588f('0x47')](_0x1acc13[_0x588f('0x30')],function(_0x10b6bd){var _0x574196={};_0x574196[_0x10b6bd]={'$like':'%'+_0x44ce53[_0x588f('0x2e')][_0x588f('0x46')]+'%'};return _0x574196;})});}if(_0x44ce53[_0x588f('0x2e')][_0x588f('0x48')]){var _0x8601fa=_0x44ce53[_0x588f('0x2e')][_0x588f('0x48')]['split'](',');var _0x3454ce={};_0x3454ce[_0x8601fa[0x0]]={'$gte':moment(_0x8601fa[0x1])[_0x588f('0x49')](_0x588f('0x4a'))};_0x1acc13[_0x588f('0x44')]=_[_0x588f('0x36')](_0x1acc13[_0x588f('0x44')],_0x3454ce);}_0x1acc13=_[_0x588f('0x36')]({},_0x1acc13,_0x44ce53[_0x588f('0x4b')]);return db[_0x588f('0x3d')][_0x588f('0x18')]({'where':_0x1acc13[_0x588f('0x44')]})[_0x588f('0x1d')](function(_0x5a5c96){_0x4e208e['count']=_0x5a5c96;if(_0x44ce53[_0x588f('0x2e')][_0x588f('0x34')]){_0x1acc13[_0x588f('0x35')]=[{'all':!![]}];}return db[_0x588f('0x3d')]['findAll'](_0x1acc13);})[_0x588f('0x1d')](function(_0x516473){if(_0x44ce53[_0x588f('0x2e')][_0x588f('0x4c')]===_0x588f('0x4d')){for(var _0x784233=0x0;_0x784233<_0x516473['length'];_0x784233++){_0x516473[_0x784233][_0x588f('0x38')]=juice(_0x516473[_0x784233]['body']);}}_0x4e208e[_0x588f('0x4e')]=_0x516473;return _0x4e208e;});}})['then'](respondWithFilteredResult(_0x26a2dc,_0x1acc13))['catch'](handleError(_0x26a2dc,null));};exports[_0x588f('0x4f')]=function(_0x58a5d4,_0x55b773){return db[_0x588f('0x23')][_0x588f('0x39')]({'where':{'id':_0x58a5d4[_0x588f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x55b773,null))[_0x588f('0x1d')](function(_0x247637){if(_0x247637){return _0x247637['setTags'](_0x58a5d4['body'][_0x588f('0x3e')],_[_0x588f('0x3f')](_0x58a5d4[_0x588f('0x38')],[_0x588f('0x3e'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x588f('0x50')],'where':{'id':_0x58a5d4[_0x588f('0x38')]['ids']}});})['then'](function(_0xdfe10a){socket[_0x588f('0x51')](_0x588f('0x52'),{'id':Number(_0x58a5d4[_0x588f('0x3a')]['id']),'tags':_0xdfe10a||[]});return{'id':Number(_0x58a5d4['params']['id']),'tags':_0xdfe10a||[]};});}})[_0x588f('0x1d')](respondWithResult(_0x55b773,null))[_0x588f('0x2a')](handleError(_0x55b773,null));};exports['removeTags']=function(_0x485e5f,_0x33dd5f){return db[_0x588f('0x23')][_0x588f('0x39')]({'where':{'id':_0x485e5f[_0x588f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x33dd5f,null))[_0x588f('0x1d')](function(_0x5c4df4){if(_0x5c4df4){return _0x5c4df4[_0x588f('0x53')](_0x485e5f[_0x588f('0x2e')][_0x588f('0x3e')]);}})[_0x588f('0x1d')](respondWithStatusCode(_0x33dd5f,null))['catch'](handleError(_0x33dd5f,null));};exports[_0x588f('0x54')]=function(_0x4b9ad1,_0xf1911f){var _0x410e08=moment()[_0x588f('0x55')]()[_0x588f('0x56')]();var _0x383880=path[_0x588f('0x57')](config[_0x588f('0x58')],'server',_0x588f('0x59'),_0x588f('0x5a'));var _0x4b1a24=path[_0x588f('0x57')](config[_0x588f('0x58')],'server',_0x588f('0x59'),_0x588f('0x5b'));var _0x1df080=path[_0x588f('0x57')](_0x383880,_0x410e08);var _0x511f55=util[_0x588f('0x49')](_0x588f('0x5c'),_0x4b9ad1['params']['id'],_0x410e08);var _0x30e503=path['join'](_0x383880,_0x511f55);var _0x1b9aaa=[];if(_0x4b9ad1['query'][_0x588f('0x5b')]){_0x1b9aaa[_0x588f('0x5d')]({'model':db[_0x588f('0x5e')],'as':'Attachments','raw':!![]});}var _0x53b002=[{'model':db[_0x588f('0x3d')],'as':_0x588f('0x5f'),'attributes':['id','body',_0x588f('0x60'),'to','cc',_0x588f('0x61'),'subject',_0x588f('0x62')],'where':{'secret':![]},'order':qs[_0x588f('0x43')]('id'),'include':_0x1b9aaa}];return db[_0x588f('0x23')]['find']({'where':{'id':_0x4b9ad1[_0x588f('0x3a')]['id']},'include':_0x53b002})[_0x588f('0x1d')](handleEntityNotFound(_0xf1911f,null))[_0x588f('0x1d')](function(_0xa37eb5){if(_0xa37eb5&&_0xa37eb5[_0x588f('0x5f')]){var _0x5b4f06=_0xa37eb5[_0x588f('0x63')]({'plain':!![]});fs[_0x588f('0x64')](_0x1df080);return BPromise['each'](_0x5b4f06[_0x588f('0x5f')],function(_0x4497c7,_0x317adc){var _0x13c269={'from':_0x4497c7[_0x588f('0x60')],'to':_0x4497c7['to']||_0x588f('0x65'),'subject':_0x4497c7['subject'],'html':htmlEntities[_0x588f('0x66')](_0x4497c7[_0x588f('0x38')]),'headers':{'Date':moment(_0x4497c7[_0x588f('0x62')])[_0x588f('0x49')](_0x588f('0x67'))},'attachments':[]};if(_0x4497c7['cc']){_0x13c269[_0x588f('0x68')]['Cc']=_0x4497c7['cc'];}if(_0x4497c7[_0x588f('0x61')]){_0x13c269[_0x588f('0x68')]['Bcc']=_0x4497c7['bcc'];}return new BPromise(function(_0x55d7bd,_0x3f22a5){if(_0x4497c7[_0x588f('0x69')]){for(var _0x5d5383=0x0;_0x5d5383<_0x4497c7[_0x588f('0x69')][_0x588f('0x33')];_0x5d5383++){var _0x9b9511=_0x4497c7[_0x588f('0x69')][_0x5d5383];var _0x1b31f4=path[_0x588f('0x57')](_0x4b1a24,_0x9b9511[_0x588f('0x6a')]);if(fs[_0x588f('0x6b')](_0x1b31f4)){_0x13c269[_0x588f('0x5b')][_0x588f('0x5d')]({'name':_0x9b9511[_0x588f('0x21')],'contentType':_0x9b9511[_0x588f('0x26')],'data':fs['readFileSync'](_0x1b31f4)});}}}emlformat['build'](_0x13c269,function(_0x247087,_0x1711c3){if(_0x247087)return _0x3f22a5(_0x247087);fs['writeFileSync'](path[_0x588f('0x57')](_0x1df080,util[_0x588f('0x49')](_0x588f('0x6c'),_0x317adc)),_0x1711c3);return _0x55d7bd(_0x1711c3);});});})[_0x588f('0x1d')](function(){return new BPromise(function(_0x1a1a70,_0x1d43aa){zipdir(_0x1df080,{'saveTo':_0x30e503},function(_0x516d6f,_0x168cc7){if(_0x516d6f)return _0x1d43aa(_0x516d6f);return _0x1a1a70(_0x168cc7);});})[_0x588f('0x1d')](function(){return new BPromise(function(_0x503e1d,_0x197ed8){rimraf(_0x1df080,function(_0x1e7198){if(_0x1e7198)_0x197ed8(_0x1e7198);return _0x503e1d();});});})[_0x588f('0x1d')](function(){return _0xf1911f[_0x588f('0x54')](_0x30e503,_0x511f55,function(_0x44bc0f){if(!_0x44bc0f)fs[_0x588f('0x6d')](_0x30e503);});});});}else{return _0xf1911f['sendStatus'](0xc8);}})['catch'](handleError(_0xf1911f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e99fa73..be0c7dd 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 _0x780c=['catch','hook','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','emit'];(function(_0x31ff69,_0x374548){var _0x47d90f=function(_0x57a717){while(--_0x57a717){_0x31ff69['push'](_0x31ff69['shift']());}};_0x47d90f(++_0x374548);}(_0x780c,0x72));var _0xc780=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x780c[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0xc780('0x0'));var MailInteraction=require(_0xc780('0x1'))['db'][_0xc780('0x2')];var MailMessage=require(_0xc780('0x1'))['db'][_0xc780('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc780('0x4'),'afterUpdate':_0xc780('0x5'),'afterDestroy':_0xc780('0x6')};function emitEvent(_0x26a423){return function(_0x56a8bc,_0x35e8d5,_0x1f4260){_0x56a8bc[_0xc780('0x7')]({'attributes':['id'],'raw':!![]})[_0xc780('0x8')](function(_0x378a20){_0x56a8bc['setDataValue'](_0xc780('0x9'),_0x378a20[_0xc780('0xa')](function(_0xac5329){return{'id':_0xac5329['id']};}));return MailMessage[_0xc780('0xb')]({'where':{'MailInteractionId':_0x56a8bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc780('0x8')](function(_0xb0d3d7){_0x56a8bc[_0xc780('0xc')]('unreadMessages',_0xb0d3d7['length']);MailInteractionEvents[_0xc780('0xd')](_0x26a423+':'+_0x56a8bc['id'],_0x56a8bc);MailInteractionEvents[_0xc780('0xd')](_0x26a423,_0x56a8bc);_0x1f4260(null);})[_0xc780('0xe')](_0x1f4260(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xc780('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x07a4=['../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','length','emit','catch','hook','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x07a4,0x1ef));var _0x407a=function(_0x3934a8,_0x503106){_0x3934a8=_0x3934a8-0x0;var _0x51da04=_0x07a4[_0x3934a8];return _0x51da04;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x407a('0x0'))['db'][_0x407a('0x1')];var MailMessage=require(_0x407a('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x407a('0x2')](0x0);var events={'afterCreate':_0x407a('0x3'),'afterUpdate':_0x407a('0x4'),'afterDestroy':_0x407a('0x5')};function emitEvent(_0x37fc3a){return function(_0x27f9ca,_0x39af7c,_0x44cc95){_0x27f9ca[_0x407a('0x6')]({'attributes':['id'],'raw':!![]})[_0x407a('0x7')](function(_0xb11909){_0x27f9ca[_0x407a('0x8')]('Users',_0xb11909[_0x407a('0x9')](function(_0x123c25){return{'id':_0x123c25['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x27f9ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x407a('0x7')](function(_0x17c0fa){_0x27f9ca[_0x407a('0x8')]('unreadMessages',_0x17c0fa[_0x407a('0xa')]);MailInteractionEvents['emit'](_0x37fc3a+':'+_0x27f9ca['id'],_0x27f9ca);MailInteractionEvents[_0x407a('0xb')](_0x37fc3a,_0x27f9ca);_0x44cc95(null);})[_0x407a('0xc')](_0x44cc95(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x407a('0xd')](e,emitEvent(event));}}module[_0x407a('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ded2c01..43dea31 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 _0x769a=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatusAt','models','get','MailMessage'];(function(_0x8261bb,_0x48e718){var _0x530867=function(_0x4b2b4e){while(--_0x4b2b4e){_0x8261bb['push'](_0x8261bb['shift']());}};_0x530867(++_0x48e718);}(_0x769a,0xb8));var _0xa769=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x769a[_0x430459];return _0x3a2439;};'use strict';var _=require(_0xa769('0x0'));var util=require(_0xa769('0x1'));var logger=require(_0xa769('0x2'))(_0xa769('0x3'));var moment=require(_0xa769('0x4'));var BPromise=require(_0xa769('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa769('0x6'));var rimraf=require(_0xa769('0x7'));var config=require(_0xa769('0x8'));var attributes=require(_0xa769('0x9'));module[_0xa769('0xa')]=function(_0x31504b,_0x41b1f3){return _0x31504b[_0xa769('0xb')](_0xa769('0xc'),attributes,{'tableName':_0xa769('0xd'),'paranoid':![],'indexes':[{'name':_0xa769('0xe'),'fields':['subject','to'],'type':_0xa769('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xde22ec,_0x26e744,_0x2a886d){if(_0xde22ec[_0xa769('0x10')]){_0xde22ec['substatusAt']=moment()['format'](_0xa769('0x11'));}if(_0xde22ec[_0xa769('0x12')]){_0xde22ec[_0xa769('0x13')]=moment()[_0xa769('0x14')](_0xa769('0x11'));}_0x2a886d(null,_0x26e744);},'beforeUpdate':function(_0x41c8d7,_0x2a037c,_0x2bb484){if(_0x41c8d7[_0xa769('0x15')](_0xa769('0x10'))){_0x41c8d7[_0xa769('0x16')]=_0x41c8d7[_0xa769('0x10')]?moment()[_0xa769('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x41c8d7['changed'](_0xa769('0x12'))){_0x41c8d7['closedAt']=moment()[_0xa769('0x14')](_0xa769('0x11'));_0x41c8d7['substatus']=null;_0x41c8d7[_0xa769('0x16')]=null;}_0x2bb484(null,_0x41c8d7);},'afterUpdate':function(_0x1aafeb,_0x2744bd,_0x478e8d){var _0x271668=_0x31504b[_0xa769('0x17')];var _0x4430e2=_0x1aafeb[_0xa769('0x18')]({'plain':!![]});if(_0x4430e2[_0xa769('0x12')]){return _0x271668[_0xa769('0x19')][_0xa769('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x4430e2['id']}})['then'](function(){_0x478e8d();})[_0xa769('0x1b')](function(_0x300873){_0x478e8d(_0x300873);});}else{_0x478e8d();}}},'charset':_0xa769('0x1c'),'collate':_0xa769('0x1d')});}; \ No newline at end of file +var _0xae86=['path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','then','catch','utf8mb4','lodash','util','api','bluebird','request-promise'];(function(_0x3e167a,_0x548cd8){var _0x1853cb=function(_0x22fb1e){while(--_0x22fb1e){_0x3e167a['push'](_0x3e167a['shift']());}};_0x1853cb(++_0x548cd8);}(_0xae86,0x133));var _0x6ae8=function(_0x167a99,_0x1bbb59){_0x167a99=_0x167a99-0x0;var _0x442d62=_0xae86[_0x167a99];return _0x442d62;};'use strict';var _=require(_0x6ae8('0x0'));var util=require(_0x6ae8('0x1'));var logger=require('../../config/logger')(_0x6ae8('0x2'));var moment=require('moment');var BPromise=require(_0x6ae8('0x3'));var rp=require(_0x6ae8('0x4'));var fs=require('fs');var path=require(_0x6ae8('0x5'));var rimraf=require(_0x6ae8('0x6'));var config=require(_0x6ae8('0x7'));var attributes=require(_0x6ae8('0x8'));module[_0x6ae8('0x9')]=function(_0x59f6ae,_0x33329c){return _0x59f6ae[_0x6ae8('0xa')](_0x6ae8('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x6ae8('0xc'),'fields':['subject','to'],'type':_0x6ae8('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb13fd0,_0x3fa4ce,_0x3a8631){if(_0xb13fd0[_0x6ae8('0xe')]){_0xb13fd0[_0x6ae8('0xf')]=moment()[_0x6ae8('0x10')](_0x6ae8('0x11'));}if(_0xb13fd0[_0x6ae8('0x12')]){_0xb13fd0[_0x6ae8('0x13')]=moment()[_0x6ae8('0x10')](_0x6ae8('0x11'));}_0x3a8631(null,_0x3fa4ce);},'beforeUpdate':function(_0x31ac68,_0x9bf5e4,_0x152c89){if(_0x31ac68['changed'](_0x6ae8('0xe'))){_0x31ac68['substatusAt']=_0x31ac68[_0x6ae8('0xe')]?moment()['format'](_0x6ae8('0x11')):null;}if(_0x31ac68[_0x6ae8('0x14')](_0x6ae8('0x12'))){_0x31ac68['closedAt']=moment()['format'](_0x6ae8('0x11'));_0x31ac68[_0x6ae8('0xe')]=null;_0x31ac68[_0x6ae8('0xf')]=null;}_0x152c89(null,_0x31ac68);},'afterUpdate':function(_0xf8fb92,_0x4f21c9,_0xa4a785){var _0x261cec=_0x59f6ae['models'];var _0x17f650=_0xf8fb92['get']({'plain':!![]});if(_0x17f650[_0x6ae8('0x12')]){return _0x261cec[_0x6ae8('0x15')][_0x6ae8('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x17f650['id']}})[_0x6ae8('0x17')](function(){_0xa4a785();})[_0x6ae8('0x18')](function(_0x2d78af){_0xa4a785(_0x2d78af);});}else{_0xa4a785();}}},'charset':_0x6ae8('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f92c4c8..9d58a25 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 _0xc69b=['message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','stringify','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x570ced,_0x34262b){var _0x2cf1dc=function(_0x4823d9){while(--_0x4823d9){_0x570ced['push'](_0x570ced['shift']());}};_0x2cf1dc(++_0x34262b);}(_0xc69b,0xcf));var _0xbc69=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xc69b[_0x4b7b69];return _0x173b4c;};'use strict';var _=require(_0xbc69('0x0'));var util=require('util');var moment=require(_0xbc69('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc69('0x2'));var fs=require('fs');var Redis=require(_0xbc69('0x3'));var db=require(_0xbc69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc69('0x6'));var client=jayson[_0xbc69('0x7')]['http']({'port':0x232a});config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc69('0xa'))(new Redis(config[_0xbc69('0x8')]));require(_0xbc69('0xb'))[_0xbc69('0xc')](socket);function respondWithRpcPromise(_0x3adb11,_0x57be21,_0x181560){return new BPromise(function(_0x2e8394,_0xd7337e){return client[_0xbc69('0xd')](_0x3adb11,_0x181560)[_0xbc69('0xe')](function(_0x5dc950){logger[_0xbc69('0xf')](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));logger[_0xbc69('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x57be21,_0xbc69('0x11'),JSON['stringify'](_0x5dc950));if(_0x5dc950[_0xbc69('0x13')]){if(_0x5dc950['error'][_0xbc69('0x14')]===0x1f4){logger[_0xbc69('0x13')]('MailInteraction,\x20%s,\x20%s',_0x57be21,_0x5dc950['error'][_0xbc69('0x15')]);return _0xd7337e(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);return _0x2e8394(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}else{logger['info'](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));_0x2e8394(_0x5dc950[_0xbc69('0x16')][_0xbc69('0x15')]);}})[_0xbc69('0x17')](function(_0x4cca15){logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x4cca15);_0xd7337e(_0x4cca15);});});}exports[_0xbc69('0x18')]=function(_0x19aa26){var _0x1ba59f=this;return new Promise(function(_0x71fbd9,_0x4e00ec){return db[_0xbc69('0x19')][_0xbc69('0x1a')](_0x19aa26[_0xbc69('0x1b')],{'raw':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null,'attributes':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')]['attributes']||null:null,'limit':_0x19aa26['options']?_0x19aa26[_0xbc69('0x1c')]['limit']||null:null})[_0xbc69('0xe')](function(_0x47d454){logger[_0xbc69('0xf')](_0xbc69('0x18'),_0x19aa26);logger['debug'](_0xbc69('0x18'),_0x19aa26,JSON[_0xbc69('0x1f')](_0x47d454));_0x71fbd9(_0x47d454);})[_0xbc69('0x17')](function(_0x4b22e5){logger[_0xbc69('0x13')]('UpdateMailInteraction',_0x4b22e5[_0xbc69('0x15')],_0x19aa26);_0x4e00ec(_0x1ba59f[_0xbc69('0x13')](0x1f4,_0x4b22e5[_0xbc69('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xe424c2){return new Promise(function(_0x182473,_0x582908){return db[_0xbc69('0x19')][_0xbc69('0x20')]({'where':_0xe424c2[_0xbc69('0x1c')]?_0xe424c2[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null})['then'](function(_0x53a7f0){if(_0x53a7f0){return _0x53a7f0[_0xbc69('0x21')](_0xe424c2[_0xbc69('0x1b')][_0xbc69('0x22')],_[_0xbc69('0x23')](_0xe424c2[_0xbc69('0x1b')],[_0xbc69('0x22'),'id'])||{});}})[_0xbc69('0x24')](function(_0xc72391){logger[_0xbc69('0xf')](_0xbc69('0x25'),_0xe424c2);logger[_0xbc69('0x12')]('AddTags',_0xe424c2,JSON[_0xbc69('0x1f')](_0xc72391));_0x182473(_0xc72391);})['catch'](function(_0x54f6a6){logger[_0xbc69('0x13')](_0xbc69('0x25'),_0x54f6a6[_0xbc69('0x15')],_0xe424c2);_0x582908(_this['error'](0x1f4,_0x54f6a6['message']));});});}; \ No newline at end of file +var _0xbff5=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xbff5,0x1bc));var _0x5bff=function(_0x28f2b8,_0x5c74f2){_0x28f2b8=_0x28f2b8-0x0;var _0x1d88f7=_0xbff5[_0x28f2b8];return _0x1d88f7;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});config[_0x5bff('0xb')]=_[_0x5bff('0xc')](config[_0x5bff('0xb')],{'host':_0x5bff('0xd'),'port':0x18eb});var socket=require(_0x5bff('0xe'))(new Redis(config[_0x5bff('0xb')]));require('./mailInteraction.socket')[_0x5bff('0xf')](socket);function respondWithRpcPromise(_0x5e7d10,_0x1d8197,_0x40b806){return new BPromise(function(_0x4fc146,_0x3e72e9){return client['request'](_0x5e7d10,_0x40b806)[_0x5bff('0x10')](function(_0x4ff164){logger[_0x5bff('0x11')](_0x5bff('0x12'),_0x1d8197,'request\x20sent');logger[_0x5bff('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1d8197,_0x5bff('0x14'),JSON[_0x5bff('0x15')](_0x4ff164));if(_0x4ff164['error']){if(_0x4ff164[_0x5bff('0x16')][_0x5bff('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x1d8197,_0x4ff164[_0x5bff('0x16')][_0x5bff('0x18')]);return _0x3e72e9(_0x4ff164[_0x5bff('0x16')]['message']);}logger[_0x5bff('0x16')](_0x5bff('0x12'),_0x1d8197,_0x4ff164[_0x5bff('0x16')]['message']);return _0x4fc146(_0x4ff164[_0x5bff('0x16')][_0x5bff('0x18')]);}else{logger[_0x5bff('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1d8197,_0x5bff('0x14'));_0x4fc146(_0x4ff164[_0x5bff('0x19')][_0x5bff('0x18')]);}})[_0x5bff('0x1a')](function(_0x5216dc){logger[_0x5bff('0x16')]('MailInteraction,\x20%s,\x20%s',_0x1d8197,_0x5216dc);_0x3e72e9(_0x5216dc);});});}exports[_0x5bff('0x1b')]=function(_0x4d0111){var _0x1fc4cf=this;return new Promise(function(_0x13d5d0,_0x2a83ce){return db[_0x5bff('0x1c')][_0x5bff('0x1d')](_0x4d0111[_0x5bff('0x1e')],{'raw':_0x4d0111[_0x5bff('0x1f')]?_0x4d0111[_0x5bff('0x1f')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d0111['options']?_0x4d0111[_0x5bff('0x1f')][_0x5bff('0x21')]||null:null,'attributes':_0x4d0111[_0x5bff('0x1f')]?_0x4d0111[_0x5bff('0x1f')][_0x5bff('0x22')]||null:null,'limit':_0x4d0111[_0x5bff('0x1f')]?_0x4d0111[_0x5bff('0x1f')][_0x5bff('0x23')]||null:null})['then'](function(_0x5741d9){logger[_0x5bff('0x11')]('UpdateMailInteraction',_0x4d0111);logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0x4d0111,JSON[_0x5bff('0x15')](_0x5741d9));_0x13d5d0(_0x5741d9);})[_0x5bff('0x1a')](function(_0xfa361d){logger[_0x5bff('0x16')](_0x5bff('0x1b'),_0xfa361d[_0x5bff('0x18')],_0x4d0111);_0x2a83ce(_0x1fc4cf['error'](0x1f4,_0xfa361d['message']));});});};exports[_0x5bff('0x24')]=function(_0x2dd52f){return new Promise(function(_0x4d7640,_0x36a7d2){return db['MailInteraction']['find']({'where':_0x2dd52f[_0x5bff('0x1f')]?_0x2dd52f['options'][_0x5bff('0x21')]||null:null})[_0x5bff('0x10')](function(_0x2d692a){if(_0x2d692a){return _0x2d692a[_0x5bff('0x25')](_0x2dd52f['body'][_0x5bff('0x26')],_['omit'](_0x2dd52f[_0x5bff('0x1e')],['ids','id'])||{});}})[_0x5bff('0x27')](function(_0x100d0c){logger[_0x5bff('0x11')](_0x5bff('0x28'),_0x2dd52f);logger[_0x5bff('0x13')](_0x5bff('0x28'),_0x2dd52f,JSON['stringify'](_0x100d0c));_0x4d7640(_0x100d0c);})[_0x5bff('0x1a')](function(_0x31c33f){logger[_0x5bff('0x16')](_0x5bff('0x28'),_0x31c33f[_0x5bff('0x18')],_0x2dd52f);_0x36a7d2(_this[_0x5bff('0x16')](0x1f4,_0x31c33f[_0x5bff('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b2aa3d6..8dd6094 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 _0xeede=['mailInteraction:','./mailInteraction.events','save','remove','removeListener','register','length'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0xeede,0x86));var _0xeeed=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xeede[_0x43e4b3];return _0x10c655;};'use strict';var MailInteractionEvents=require(_0xeeed('0x0'));var events=[_0xeeed('0x1'),_0xeeed('0x2'),'update'];function createListener(_0x3a03b1,_0x2f2b72){return function(_0x4120a8){_0x2f2b72['emit'](_0x3a03b1,_0x4120a8);};}function removeListener(_0x427cda,_0xb7c81f){return function(){MailInteractionEvents[_0xeeed('0x3')](_0x427cda,_0xb7c81f);};}exports[_0xeeed('0x4')]=function(_0xca8cde){for(var _0x138166=0x0,_0x240ef1=events[_0xeeed('0x5')];_0x138166<_0x240ef1;_0x138166++){var _0x4f5b23=events[_0x138166];var _0x2e32b6=createListener(_0xeeed('0x6')+_0x4f5b23,_0xca8cde);MailInteractionEvents['on'](_0x4f5b23,_0x2e32b6);}}; \ No newline at end of file +var _0xb5da=['emit','length','mailInteraction:','save','update'];(function(_0x3ac4e7,_0x9f6f40){var _0x2f044c=function(_0x4e6039){while(--_0x4e6039){_0x3ac4e7['push'](_0x3ac4e7['shift']());}};_0x2f044c(++_0x9f6f40);}(_0xb5da,0x139));var _0xab5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5da[_0x502c7d];return _0x30b7ed;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xab5d('0x0'),'remove',_0xab5d('0x1')];function createListener(_0x1a0402,_0x31b4dd){return function(_0x5f144f){_0x31b4dd[_0xab5d('0x2')](_0x1a0402,_0x5f144f);};}function removeListener(_0x4c34d7,_0x59d732){return function(){MailInteractionEvents['removeListener'](_0x4c34d7,_0x59d732);};}exports['register']=function(_0x449f38){for(var _0xcd4012=0x0,_0x454013=events[_0xab5d('0x3')];_0xcd4012<_0x454013;_0xcd4012++){var _0xe9bac6=events[_0xcd4012];var _0x1dec6b=createListener(_0xab5d('0x4')+_0xe9bac6,_0x449f38);MailInteractionEvents['on'](_0xe9bac6,_0x1dec6b);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 98eac6e..e642227 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb934=['describe','exports','express','Router','../../components/auth/service','get','/describe','isAuthenticated'];(function(_0x22e26e,_0x3144fc){var _0x57c32d=function(_0x464cdb){while(--_0x464cdb){_0x22e26e['push'](_0x22e26e['shift']());}};_0x57c32d(++_0x3144fc);}(_0xb934,0x92));var _0x4b93=function(_0x5a7123,_0xf3d016){_0x5a7123=_0x5a7123-0x0;var _0x166efc=_0xb934[_0x5a7123];return _0x166efc;};'use strict';var express=require(_0x4b93('0x0'));var router=express[_0x4b93('0x1')]();var auth=require(_0x4b93('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x4b93('0x3')](_0x4b93('0x4'),auth[_0x4b93('0x5')](),controller[_0x4b93('0x6')]);module[_0x4b93('0x7')]=router; \ No newline at end of file +var _0x2087=['isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe'];(function(_0x353733,_0x25ce9b){var _0x29ae26=function(_0x58b1b3){while(--_0x58b1b3){_0x353733['push'](_0x353733['shift']());}};_0x29ae26(++_0x25ce9b);}(_0x2087,0xf3));var _0x7208=function(_0x233966,_0x5b6367){_0x233966=_0x233966-0x0;var _0x4489eb=_0x2087[_0x233966];return _0x4489eb;};'use strict';var express=require(_0x7208('0x0'));var router=express[_0x7208('0x1')]();var auth=require(_0x7208('0x2'));var controller=require(_0x7208('0x3'));router['get'](_0x7208('0x4'),auth[_0x7208('0x5')](),controller[_0x7208('0x6')]);module[_0x7208('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 43ac891..a61dff1 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4e4c09,_0x50f642){var _0x617d1d=function(_0x2fd7fb){while(--_0x2fd7fb){_0x4e4c09['push'](_0x4e4c09['shift']());}};_0x617d1d(++_0x50f642);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4a9f0f,_0x2dafd0){var _0x3527fe=function(_0x3fc4f2){while(--_0x3fc4f2){_0x4a9f0f['push'](_0x4a9f0f['shift']());}};_0x3527fe(++_0x2dafd0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index a839406..3061dcf 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ce=['INTEGER'];(function(_0x25a528,_0xa25773){var _0xe3dd11=function(_0x19547c){while(--_0x19547c){_0x25a528['push'](_0x25a528['shift']());}};_0xe3dd11(++_0xa25773);}(_0xd2ce,0x195));var _0xed2c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xd2ce[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize[_0xed2c('0x0')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xed2c('0x0')],'defaultValue':null}}; \ No newline at end of file +var _0xfdab=['exports'];(function(_0x350bee,_0x5822b2){var _0x2854e6=function(_0xc3871d){while(--_0xc3871d){_0x350bee['push'](_0x350bee['shift']());}};_0x2854e6(++_0x5822b2);}(_0xfdab,0x99));var _0xbfda=function(_0x4aa78a,_0x15c09c){_0x4aa78a=_0x4aa78a-0x0;var _0x444b3b=_0xfdab[_0x4aa78a];return _0x444b3b;};'use strict';var Sequelize=require('sequelize');module[_0xbfda('0x0')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index dc4428c..cc484b5 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8231=['./mailInteractionHasTag','exports','mail_interaction_has_tags'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x8231,0x117));var _0x1823=function(_0x2612be,_0x2117dd){_0x2612be=_0x2612be-0x0;var _0x48ef56=_0x8231[_0x2612be];return _0x48ef56;};'use strict';var attributes=require(_0x1823('0x0'));module[_0x1823('0x1')]=function(_0x485ab8){return _0x485ab8['define']('MailInteractionHasTag',attributes,{'tableName':_0x1823('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7abb=['define','mail_interaction_has_tags'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x7abb,0xc6));var _0xb7ab=function(_0xb00542,_0x1e07ad){_0xb00542=_0xb00542-0x0;var _0x3458fd=_0x7abb[_0xb00542];return _0x3458fd;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x455082){return _0x455082[_0xb7ab('0x0')]('MailInteractionHasTag',attributes,{'tableName':_0xb7ab('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7c1a3fd..7fa6c9b 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 _0x9c00=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','isAuthenticated','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','express','Router'];(function(_0x2b06d9,_0x370826){var _0x22841b=function(_0x2fbad5){while(--_0x2fbad5){_0x2b06d9['push'](_0x2b06d9['shift']());}};_0x22841b(++_0x370826);}(_0x9c00,0x1a0));var _0x09c0=function(_0x35655f,_0x23dfc3){_0x35655f=_0x35655f-0x0;var _0x1f2ae8=_0x9c00[_0x35655f];return _0x1f2ae8;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),interaction[_0x09c0('0x10')](_0x09c0('0x11'),_0x09c0('0x12')),controller[_0x09c0('0x13')]);router[_0x09c0('0x14')](_0x09c0('0x15'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);router[_0x09c0('0x14')](_0x09c0('0x17'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x18')]);router[_0x09c0('0x14')](_0x09c0('0x19'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1a')]);router[_0x09c0('0x1b')](_0x09c0('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x976a=['../../config/environment','./mailMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','mail','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a36de,_0x1e2367){var _0x3d92a3=function(_0x252d49){while(--_0x252d49){_0x3a36de['push'](_0x3a36de['shift']());}};_0x3d92a3(++_0x1e2367);}(_0x976a,0xf4));var _0xa976=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x976a[_0x208d75];return _0x382d27;};'use strict';var multer=require(_0xa976('0x0'));var util=require(_0xa976('0x1'));var path=require(_0xa976('0x2'));var timeout=require('connect-timeout');var express=require(_0xa976('0x3'));var router=express[_0xa976('0x4')]();var fs_extra=require(_0xa976('0x5'));var auth=require(_0xa976('0x6'));var interaction=require(_0xa976('0x7'));var config=require(_0xa976('0x8'));var controller=require(_0xa976('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa976('0xa')](_0xa976('0xb'),auth[_0xa976('0xc')](),controller[_0xa976('0xd')]);router[_0xa976('0xa')](_0xa976('0xe'),auth[_0xa976('0xc')](),controller[_0xa976('0xf')]);router[_0xa976('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xa976('0x10')]('/',auth[_0xa976('0xc')](),interaction[_0xa976('0x11')](_0xa976('0x12'),'mailmessage:create'),controller[_0xa976('0x13')]);router[_0xa976('0x14')](_0xa976('0xe'),auth[_0xa976('0xc')](),controller[_0xa976('0x15')]);router[_0xa976('0x14')]('/:id/accept',auth[_0xa976('0xc')](),controller[_0xa976('0x16')]);router[_0xa976('0x14')](_0xa976('0x17'),auth[_0xa976('0xc')](),controller[_0xa976('0x18')]);router[_0xa976('0x19')](_0xa976('0xe'),auth[_0xa976('0xc')](),controller[_0xa976('0x1a')]);module[_0xa976('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7fe6a37..15e7c9a 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 _0x6b12=['lodash','exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','Email','Chat','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b12,0x1a3));var _0x26b1=function(_0x538f84,_0x12c40a){_0x538f84=_0x538f84-0x0;var _0x43519e=_0x6b12[_0x538f84];return _0x43519e;};'use strict';var Sequelize=require(_0x26b1('0x0'));var _=require(_0x26b1('0x1'));module[_0x26b1('0x2')]={'body':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x26b1('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x26b1('0x6')]('in',_0x26b1('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x26b1('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x26b1('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x26b1('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x26b1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x26b1('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x26b1('0xb')]},'originTo':{'type':Sequelize['TEXT'](_0x26b1('0x4'))},'originCc':{'type':Sequelize[_0x26b1('0x3')](_0x26b1('0x4'))},'originChannel':{'type':Sequelize[_0x26b1('0x6')](_0x26b1('0xc'),_0x26b1('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x17f1=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize'];(function(_0x283d04,_0x41d78f){var _0x513c81=function(_0x450a05){while(--_0x450a05){_0x283d04['push'](_0x283d04['shift']());}};_0x513c81(++_0x41d78f);}(_0x17f1,0xf6));var _0x117f=function(_0x294bd1,_0x24e0cb){_0x294bd1=_0x294bd1-0x0;var _0x55603d=_0x17f1[_0x294bd1];return _0x55603d;};'use strict';var Sequelize=require(_0x117f('0x0'));var _=require(_0x117f('0x1'));module[_0x117f('0x2')]={'body':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x5'))},'read':{'type':Sequelize[_0x117f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x117f('0x7')]('in',_0x117f('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x117f('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x4'))},'cc':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x4'))},'bcc':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x117f('0xa')]},'attach':{'type':Sequelize[_0x117f('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x117f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x117f('0xa')]},'originTo':{'type':Sequelize[_0x117f('0x3')](_0x117f('0x4'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM'](_0x117f('0xc'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 645d48e..b69fc37 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 _0xd574=['rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','email','internal','reject','rejectmessage','toString','files','tmp','server','Attachment','Attachments','from','subject','decode','bcc','headers','push','readFileSync','build','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','Content-Range','update','destroy','end','sendStatus','stack','send','map','MailMessage','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','find','body','params','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','user','agent','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x4c6290,_0x2221ae){var _0x1798d8=function(_0x1d353b){while(--_0x1d353b){_0x4c6290['push'](_0x4c6290['shift']());}};_0x1798d8(++_0x2221ae);}(_0xd574,0xb4));var _0x4d57=function(_0x2592cc,_0x275ff7){_0x2592cc=_0x2592cc-0x0;var _0x57197b=_0xd574[_0x2592cc];return _0x57197b;};'use strict';var emlformat=require(_0x4d57('0x0'));var moment=require(_0x4d57('0x1'));var BPromise=require(_0x4d57('0x2'));var util=require(_0x4d57('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x4d57('0x4'));var Redis=require(_0x4d57('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x4d57('0x6'));var logger=require(_0x4d57('0x7'))(_0x4d57('0x8'));var interaction_log=require(_0x4d57('0x7'))(_0x4d57('0x9'));var config=require(_0x4d57('0xa'));var db=require(_0x4d57('0xb'))['db'];config[_0x4d57('0xc')]=_['defaults'](config[_0x4d57('0xc')],{'host':_0x4d57('0xd'),'port':0x18eb});var socket=require(_0x4d57('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x4d57('0xf'))[_0x4d57('0x10')](socket);var jayson=require(_0x4d57('0x11'));var client=jayson[_0x4d57('0x12')][_0x4d57('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x4d57('0x13')]({'port':0x232b});var client9002=jayson['client'][_0x4d57('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x169adc,_0x54ec2d,_0x281fd4,_0x433c06){return new BPromise(function(_0x1e3539,_0x3fae9c){var _0x52a5f3=_0x433c06||client;return _0x52a5f3[_0x4d57('0x14')](_0x169adc,_0x281fd4)[_0x4d57('0x15')](function(_0x1eae94){logger[_0x4d57('0x16')](_0x4d57('0x17'),_0x54ec2d,_0x4d57('0x18'));logger[_0x4d57('0x19')](_0x4d57('0x1a'),_0x54ec2d,_0x4d57('0x18'),JSON[_0x4d57('0x1b')](_0x1eae94));if(_0x1eae94[_0x4d57('0x1c')]){if(_0x1eae94['error']['code']===0x1f4){logger[_0x4d57('0x1c')](_0x4d57('0x17'),_0x54ec2d,_0x1eae94[_0x4d57('0x1c')][_0x4d57('0x1d')]);return _0x3fae9c(_0x1eae94[_0x4d57('0x1c')][_0x4d57('0x1d')]);}logger[_0x4d57('0x1c')]('MailMessage,\x20%s,\x20%s',_0x54ec2d,_0x1eae94[_0x4d57('0x1c')]['message']);return _0x1e3539(_0x1eae94['error'][_0x4d57('0x1d')]);}else{logger[_0x4d57('0x16')]('MailMessage,\x20%s,\x20%s',_0x54ec2d,_0x4d57('0x18'));_0x1e3539(_0x1eae94[_0x4d57('0x1e')][_0x4d57('0x1d')]);}})[_0x4d57('0x1f')](function(_0x3ff658){logger[_0x4d57('0x1c')](_0x4d57('0x17'),_0x54ec2d,_0x3ff658);_0x3fae9c(_0x3ff658);});});}function respondWithResult(_0x55040f,_0x2d9e17){_0x2d9e17=_0x2d9e17||0xc8;return function(_0x30d4d6){if(_0x30d4d6){return _0x55040f[_0x4d57('0x20')](_0x2d9e17)[_0x4d57('0x21')](_0x30d4d6);}};}function respondWithFilteredResult(_0x535c01,_0x3bd468){return function(_0x24eb82){if(_0x24eb82){var _0x2123bd=typeof _0x3bd468[_0x4d57('0x22')]===_0x4d57('0x23')&&typeof _0x3bd468[_0x4d57('0x24')]===_0x4d57('0x23');var _0x14b0da=_0x24eb82['count'];var _0x22d0b5=_0x2123bd?0x0:_0x3bd468[_0x4d57('0x22')];var _0x5e1916=_0x2123bd?_0x24eb82['count']:_0x3bd468[_0x4d57('0x22')]+_0x3bd468[_0x4d57('0x24')];var _0x2f1a25;if(_0x5e1916>=_0x14b0da){_0x5e1916=_0x14b0da;_0x2f1a25=0xc8;}else{_0x2f1a25=0xce;}_0x535c01['status'](_0x2f1a25);return _0x535c01['set'](_0x4d57('0x25'),_0x22d0b5+'-'+_0x5e1916+'/'+_0x14b0da)[_0x4d57('0x21')](_0x24eb82);}return null;};}function saveUpdates(_0x5a191f){return function(_0x40dc79){if(_0x40dc79){return _0x40dc79[_0x4d57('0x26')](_0x5a191f)[_0x4d57('0x15')](function(_0x56ff85){return _0x56ff85;});}return null;};}function removeEntity(_0x35071d){return function(_0x5574f0){if(_0x5574f0){return _0x5574f0[_0x4d57('0x27')]()[_0x4d57('0x15')](function(){_0x35071d[_0x4d57('0x20')](0xcc)[_0x4d57('0x28')]();});}};}function handleEntityNotFound(_0x1ab593){return function(_0x4043d7){if(!_0x4043d7){_0x1ab593[_0x4d57('0x29')](0x194);}return _0x4043d7;};}function handleError(_0x3a5d0a,_0x23fbd8){_0x23fbd8=_0x23fbd8||0x1f4;return function(_0x3b6d08){logger[_0x4d57('0x1c')](_0x3b6d08[_0x4d57('0x2a')]);if(_0x3b6d08['name']){delete _0x3b6d08['name'];}_0x3a5d0a[_0x4d57('0x20')](_0x23fbd8)[_0x4d57('0x2b')](_0x3b6d08);};}exports['index']=function(_0x3bba68,_0x3f7d61){var _0x15d933={},_0x9ed347={},_0x53830c={'count':0x0,'rows':[]};var _0x3d9694=_[_0x4d57('0x2c')](db[_0x4d57('0x2d')][_0x4d57('0x2e')],function(_0x1ef1ca){return{'name':_0x1ef1ca[_0x4d57('0x2f')],'type':_0x1ef1ca[_0x4d57('0x30')][_0x4d57('0x31')]};});_0x9ed347['model']=_[_0x4d57('0x2c')](_0x3d9694,_0x4d57('0x32'));_0x9ed347['query']=_['keys'](_0x3bba68[_0x4d57('0x33')]);_0x9ed347[_0x4d57('0x34')]=_[_0x4d57('0x35')](_0x9ed347['model'],_0x9ed347['query']);_0x15d933[_0x4d57('0x36')]=_[_0x4d57('0x35')](_0x9ed347[_0x4d57('0x37')],qs['fields'](_0x3bba68[_0x4d57('0x33')][_0x4d57('0x38')]));_0x15d933[_0x4d57('0x36')]=_0x15d933['attributes'][_0x4d57('0x39')]?_0x15d933[_0x4d57('0x36')]:_0x9ed347['model'];if(!_0x3bba68['query'][_0x4d57('0x3a')]('nolimit')){_0x15d933[_0x4d57('0x24')]=qs[_0x4d57('0x24')](_0x3bba68[_0x4d57('0x33')]['limit']);_0x15d933[_0x4d57('0x22')]=qs['offset'](_0x3bba68['query'][_0x4d57('0x22')]);}_0x15d933['order']=qs[_0x4d57('0x3b')](_0x3bba68['query']['sort']);_0x15d933[_0x4d57('0x3c')]=qs['filters'](_[_0x4d57('0x3d')](_0x3bba68['query'],_0x9ed347[_0x4d57('0x34')]),_0x3d9694);if(_0x3bba68[_0x4d57('0x33')][_0x4d57('0x3e')]){_0x15d933['where']=_[_0x4d57('0x3f')](_0x15d933[_0x4d57('0x3c')],{'$or':_['map'](_0x3d9694,function(_0x2c8394){if(_0x2c8394[_0x4d57('0x30')]!==_0x4d57('0x40')){var _0x265d19={};_0x265d19[_0x2c8394['name']]={'$like':'%'+_0x3bba68[_0x4d57('0x33')][_0x4d57('0x3e')]+'%'};return _0x265d19;}})});}_0x15d933=_[_0x4d57('0x3f')]({},_0x15d933,_0x3bba68[_0x4d57('0x41')]);var _0x26d602={'where':_0x15d933['where']};return db[_0x4d57('0x2d')][_0x4d57('0x42')](_0x26d602)[_0x4d57('0x15')](function(_0x247ff5){_0x53830c[_0x4d57('0x42')]=_0x247ff5;if(_0x3bba68[_0x4d57('0x33')][_0x4d57('0x43')]){_0x15d933[_0x4d57('0x44')]=[{'all':!![]}];}return db[_0x4d57('0x2d')]['findAll'](_0x15d933);})[_0x4d57('0x15')](function(_0x5120f1){_0x53830c[_0x4d57('0x45')]=_0x5120f1;return _0x53830c;})[_0x4d57('0x15')](respondWithFilteredResult(_0x3f7d61,_0x15d933))[_0x4d57('0x1f')](handleError(_0x3f7d61,null));};exports[_0x4d57('0x46')]=function(_0x27c4b6,_0x2c5968){var _0x4775a1={'raw':!![],'where':{'id':_0x27c4b6['params']['id']}},_0x4ac3ca={};_0x4ac3ca[_0x4d57('0x37')]=_[_0x4d57('0x47')](db[_0x4d57('0x2d')][_0x4d57('0x2e')]);_0x4ac3ca['query']=_[_0x4d57('0x47')](_0x27c4b6[_0x4d57('0x33')]);_0x4ac3ca[_0x4d57('0x34')]=_['intersection'](_0x4ac3ca[_0x4d57('0x37')],_0x4ac3ca[_0x4d57('0x33')]);_0x4775a1[_0x4d57('0x36')]=_[_0x4d57('0x35')](_0x4ac3ca[_0x4d57('0x37')],qs[_0x4d57('0x38')](_0x27c4b6[_0x4d57('0x33')]['fields']));_0x4775a1[_0x4d57('0x36')]=_0x4775a1[_0x4d57('0x36')]['length']?_0x4775a1[_0x4d57('0x36')]:_0x4ac3ca[_0x4d57('0x37')];if(_0x27c4b6[_0x4d57('0x33')][_0x4d57('0x43')]){_0x4775a1[_0x4d57('0x44')]=[{'all':!![]}];}_0x4775a1=_[_0x4d57('0x3f')]({},_0x4775a1,_0x27c4b6[_0x4d57('0x41')]);return db[_0x4d57('0x2d')][_0x4d57('0x48')](_0x4775a1)[_0x4d57('0x15')](handleEntityNotFound(_0x2c5968,null))[_0x4d57('0x15')](respondWithResult(_0x2c5968,null))['catch'](handleError(_0x2c5968,null));};exports[_0x4d57('0x26')]=function(_0x80164d,_0x15fb2f){if(_0x80164d['body']['id']){delete _0x80164d[_0x4d57('0x49')]['id'];}return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x80164d[_0x4d57('0x4a')]['id']}})[_0x4d57('0x15')](handleEntityNotFound(_0x15fb2f,null))[_0x4d57('0x15')](saveUpdates(_0x80164d[_0x4d57('0x49')],null))[_0x4d57('0x15')](respondWithResult(_0x15fb2f,null))[_0x4d57('0x1f')](handleError(_0x15fb2f,null));};exports[_0x4d57('0x27')]=function(_0x41c3ff,_0x583da8){return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x41c3ff['params']['id']}})[_0x4d57('0x15')](handleEntityNotFound(_0x583da8,null))['then'](removeEntity(_0x583da8,null))[_0x4d57('0x1f')](handleError(_0x583da8,null));};exports[_0x4d57('0x4b')]=function(_0x46c1c6,_0x527424){return db[_0x4d57('0x2d')][_0x4d57('0x4b')]()[_0x4d57('0x15')](respondWithResult(_0x527424,null))[_0x4d57('0x1f')](handleError(_0x527424,null));};exports[_0x4d57('0x4c')]=function(_0x56b616,_0x3b302f){return db['MailMessage'][_0x4d57('0x4c')](_0x56b616[_0x4d57('0x49')])[_0x4d57('0x15')](function(_0x463751){if(_0x463751){if(_0x463751[_0x4d57('0x4d')]===_0x4d57('0x4e')&&!_0x463751[_0x4d57('0x4f')]){var _0x12dcf7,_0x40ffc3,_0x286efa;if(_0x56b616[_0x4d57('0x49')]['to']){_0x40ffc3=_0x56b616[_0x4d57('0x49')]['to']['split'](',')[0x0];}return db[_0x4d57('0x50')][_0x4d57('0x51')]({'where':{'id':_0x463751[_0x4d57('0x52')]},'include':[{'model':db[_0x4d57('0x53')],'as':_0x4d57('0x54'),'include':[{'model':db['CmContact'],'as':_0x4d57('0x55'),'where':{'email':_0x40ffc3},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x4d57('0x56')],'as':_0x4d57('0x57'),'raw':!![],'include':[{'model':db[_0x4d57('0x58')],'as':_0x4d57('0x58'),'raw':!![]}]}]})['then'](function(_0x2c7954){_0x12dcf7=_0x2c7954;if(!_0x12dcf7||!_0x12dcf7[_0x4d57('0x57')])return;var _0x1fcc56=_0x12dcf7[_0x4d57('0x59')]();if(_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')]&&_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x4d57('0x39')]){for(var _0x65981a=0x0;_0x65981a<_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x4d57('0x39')];_0x65981a+=0x1){_0x56b616['body'][_0x4d57('0x5a')][_0x65981a]={'filename':_0x56b616[_0x4d57('0x49')][_0x4d57('0x5a')][_0x65981a][_0x4d57('0x32')],'path':path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],_0x4d57('0x5d'),_0x56b616['body'][_0x4d57('0x5a')][_0x65981a][_0x4d57('0x5e')])};}}_0x286efa={'account':_0x1fcc56,'message':_0x56b616[_0x4d57('0x49')]};return;})[_0x4d57('0x15')](function(){if(_0x12dcf7['List']){if(_0x12dcf7[_0x4d57('0x54')][_0x4d57('0x55')][_0x4d57('0x39')]){return _0x12dcf7[_0x4d57('0x54')]['Contacts'][0x0];}else{return db[_0x4d57('0x5f')][_0x4d57('0x4c')](_[_0x4d57('0x60')](_0x56b616[_0x4d57('0x49')],{'firstName':_0x56b616[_0x4d57('0x49')]['to'],'email':_0x56b616['body']['to'],'phone':_0x56b616['body']['to'],'ListId':_0x12dcf7[_0x4d57('0x61')]}));}}else{throw new Error(_0x4d57('0x62'));}})[_0x4d57('0x15')](function(){if(_0x286efa){return respondWithRpcPromise(_0x4d57('0x63'),'sendMail',_0x286efa,client9003)[_0x4d57('0x15')](function(_0x5b2c68){return _0x463751[_0x4d57('0x26')]({'read':!![],'messageId':_0x5b2c68['messageId'],'sentAt':moment()[_0x4d57('0x64')](_0x4d57('0x65'))});})['catch'](function(_0x21fb6d){logger[_0x4d57('0x1c')]('%s',JSON['stringify'](_0x21fb6d));return _0x463751;});}return _0x463751;});}return _0x463751;}})['then'](respondWithResult(_0x3b302f,0xc9))[_0x4d57('0x1f')](handleError(_0x3b302f,null));};exports['accept']=function(_0x249170,_0x3ee9fc){var _0x3445c4={'agent':{},'channel':_0x4d57('0x66')};if(_0x249170[_0x4d57('0x49')]['id']){delete _0x249170[_0x4d57('0x49')]['id'];}_0x249170[_0x4d57('0x49')][_0x4d57('0x67')]=!![];_0x249170['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x249170[_0x4d57('0x49')][_0x4d57('0x68')]=_0x249170[_0x4d57('0x49')][_0x4d57('0x68')]||_0x249170[_0x4d57('0x69')]['id'];_0x3445c4[_0x4d57('0x6a')]['id']=_0x249170[_0x4d57('0x49')][_0x4d57('0x68')];return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x249170[_0x4d57('0x4a')]['id'],'UserId':null}})[_0x4d57('0x15')](handleEntityNotFound(_0x3ee9fc,null))[_0x4d57('0x15')](saveUpdates(_0x249170[_0x4d57('0x49')],null))[_0x4d57('0x15')](function(_0x6abb56){if(_0x6abb56){_0x3445c4[_0x4d57('0x1d')]=_0x6abb56['get']({'plain':!![]});return db['MailInteraction'][_0x4d57('0x48')]({'where':{'id':_0x6abb56[_0x4d57('0x6b')]}});}return null;})[_0x4d57('0x15')](handleEntityNotFound(_0x3ee9fc,null))['then'](function(_0x204fbf){if(_0x204fbf){return _0x204fbf[_0x4d57('0x26')]({'UserId':_0x249170[_0x4d57('0x49')][_0x4d57('0x68')],'read1stAt':_['isNil'](_0x204fbf[_0x4d57('0x6c')])?moment()[_0x4d57('0x64')](_0x4d57('0x65')):undefined});}return null;})[_0x4d57('0x15')](function(_0x3cdcee){if(_0x3cdcee){_0x3445c4[_0x4d57('0x6d')]=_0x3cdcee[_0x4d57('0x6e')]({'plain':!![]});interaction_log[_0x4d57('0x16')](_0x4d57('0x6f'),_0x249170[_0x4d57('0x69')]['id'],_0x249170[_0x4d57('0x69')]['name'],_0x249170[_0x4d57('0x69')]['role'],_0x3445c4[_0x4d57('0x6d')]['id'],_0x249170[_0x4d57('0x49')]?JSON[_0x4d57('0x1b')](_0x249170[_0x4d57('0x49')]):_0x4d57('0x70'));return respondWithRpcPromise(_0x4d57('0x71'),_0x4d57('0x72'),_0x3445c4);}return null;})[_0x4d57('0x15')](function(_0x53921a){var _0x30f6a5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53921a[_0x4d57('0x1d')][_0x4d57('0x73')];return db[_0x4d57('0x74')][_0x4d57('0x33')](_0x30f6a5,{'type':db[_0x4d57('0x75')][_0x4d57('0x76')][_0x4d57('0x77')],'raw':!![]})[_0x4d57('0x15')](function(_0x1a5462){return _0x1a5462;});})[_0x4d57('0x15')](function(_0x487723){if(_0x487723){_0x3445c4['message'][_0x4d57('0x78')]=_0x487723[0x0];if(!_0x249170[_0x4d57('0x49')][_0x4d57('0x68')])return;return db[_0x4d57('0x79')][_0x4d57('0x48')]({'where':{'id':_0x249170[_0x4d57('0x49')][_0x4d57('0x68')],'role':_0x4d57('0x6a')},'attributes':['id',_0x4d57('0x32'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x53426e){if(!_0x53426e)return null;_0x3445c4['message'][_0x4d57('0x6a')]=_0x53426e;return _0x3445c4;})[_0x4d57('0x15')](function(_0xe2ed65){if(_0xe2ed65){if(_0x249170['body'][_0x4d57('0x7a')]){_0x3445c4['message'][_0x4d57('0x7b')]=util[_0x4d57('0x64')](_0x4d57('0x7c'),_0x249170[_0x4d57('0x69')][_0x4d57('0x32')]);_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7d')]=_0x3445c4[_0x4d57('0x7d')];_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7e')]=_0x3445c4[_0x4d57('0x7d')];_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x7f')]=_0x4d57('0x80');_0x3445c4[_0x4d57('0x1d')][_0x4d57('0x49')]=htmlToText[_0x4d57('0x81')](_0x3445c4['message'][_0x4d57('0x49')]);return respondWithRpcPromise(_0x4d57('0x82'),_0x4d57('0x82'),{'event':_0x4d57('0x83'),'message':_0x3445c4['message']},client9002)['then'](function(){return _0x3445c4;});}return _0x3445c4;}return null;})[_0x4d57('0x15')](respondWithResult(_0x3ee9fc,null))[_0x4d57('0x1f')](handleError(_0x3ee9fc,null));};exports['reject']=function(_0x139122,_0x1fa644){var _0x1a8c67={'agent':{},'channel':_0x4d57('0x66')};if(_0x139122[_0x4d57('0x49')]['id']){delete _0x139122['body']['id'];}_0x139122[_0x4d57('0x49')]['UserId']=_0x139122['body'][_0x4d57('0x68')]||_0x139122['user']['id'];_0x1a8c67[_0x4d57('0x6a')]['id']=_0x139122[_0x4d57('0x49')][_0x4d57('0x68')];return db[_0x4d57('0x2d')][_0x4d57('0x48')]({'where':{'id':_0x139122[_0x4d57('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fa644,null))[_0x4d57('0x15')](function(_0x485f63){if(_0x485f63){_0x1a8c67['message']=_0x485f63[_0x4d57('0x6e')]({'plain':!![]});return db[_0x4d57('0x84')]['find']({'where':{'id':_0x485f63[_0x4d57('0x6b')]}});}return null;})[_0x4d57('0x15')](handleEntityNotFound(_0x1fa644,null))[_0x4d57('0x15')](function(_0x588ae1){if(_0x588ae1){_0x1a8c67['interaction']=_0x588ae1[_0x4d57('0x6e')]({'plain':!![]});interaction_log[_0x4d57('0x16')](_0x4d57('0x85'),_0x139122['user']['id'],_0x139122[_0x4d57('0x69')][_0x4d57('0x32')],_0x139122['user']['role'],_0x1a8c67[_0x4d57('0x6d')]['id'],_0x139122[_0x4d57('0x49')]?JSON['stringify'](_0x139122[_0x4d57('0x49')]):'null');return respondWithRpcPromise('RejectMessage',_0x4d57('0x86'),_0x1a8c67);}return null;})[_0x4d57('0x15')](function(_0x2bbfbd){var _0x304292=_0x4d57('0x87')+_0x2bbfbd[_0x4d57('0x1d')][_0x4d57('0x73')];return db['sequelize'][_0x4d57('0x33')](_0x304292,{'type':db[_0x4d57('0x75')][_0x4d57('0x76')][_0x4d57('0x77')],'raw':!![]})['then'](function(_0x3f2679){return _0x3f2679;});})['then'](function(_0xb15917){if(_0xb15917){_0x1a8c67['message'][_0x4d57('0x78')]=_0xb15917[0x0];if(!_0x139122[_0x4d57('0x49')][_0x4d57('0x68')])return;return db[_0x4d57('0x79')]['find']({'where':{'id':_0x139122[_0x4d57('0x49')][_0x4d57('0x68')],'role':_0x4d57('0x6a')},'attributes':['id',_0x4d57('0x32'),_0x4d57('0x88'),_0x4d57('0x89'),_0x4d57('0x8a')],'raw':!![]});}return null;})['then'](function(_0x473197){if(!_0x473197)return null;_0x1a8c67[_0x4d57('0x1d')][_0x4d57('0x6a')]=_0x473197;return _0x1a8c67;})['then'](function(_0x5aeb5b){if(_0x5aeb5b){_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7b')]=util['format'](_0x4d57('0x7c'),_0x139122['user'][_0x4d57('0x32')]);_0x5aeb5b[_0x4d57('0x1d')]['channel']=_0x1a8c67[_0x4d57('0x7d')];_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7e')]=_0x1a8c67[_0x4d57('0x7d')];_0x5aeb5b[_0x4d57('0x1d')][_0x4d57('0x7f')]=_0x4d57('0x8b');_0x5aeb5b['message']['body']=htmlToText['fromString'](_0x1a8c67['message'][_0x4d57('0x49')]);respondWithRpcPromise(_0x4d57('0x82'),_0x4d57('0x82'),{'event':_0x4d57('0x8c'),'message':_0x5aeb5b['message']},client9002);return _0x1a8c67;}return null;})[_0x4d57('0x15')](respondWithResult(_0x1fa644,null))[_0x4d57('0x1f')](handleError(_0x1fa644,null));};exports['download']=function(_0x14ac96,_0x26a4cc){var _0x122f5e=moment()['unix']()[_0x4d57('0x8d')]();var _0x5e2560=path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],'server',_0x4d57('0x8e'),_0x4d57('0x8f'));var _0x41404b=path[_0x4d57('0x5b')](config[_0x4d57('0x5c')],_0x4d57('0x90'),_0x4d57('0x8e'),_0x4d57('0x5a'));var _0x36dc3f=util[_0x4d57('0x64')]('message-%s.eml',_0x122f5e);return db[_0x4d57('0x2d')]['find']({'where':{'id':_0x14ac96['params']['id']},'attributes':['id',_0x4d57('0x49'),'from','to','cc','bcc','subject','createdAt'],'include':_0x14ac96[_0x4d57('0x33')]['attachments']?[{'model':db[_0x4d57('0x91')],'as':_0x4d57('0x92')}]:undefined})[_0x4d57('0x15')](handleEntityNotFound(_0x26a4cc,null))[_0x4d57('0x15')](function(_0xf6c420){if(_0xf6c420){var _0x326a3c=_0xf6c420;var _0x1dc9ca={'from':_0x326a3c[_0x4d57('0x93')],'to':_0x326a3c['to'],'subject':_0x326a3c[_0x4d57('0x94')],'html':htmlEntities[_0x4d57('0x95')](_0x326a3c[_0x4d57('0x49')]),'headers':{'Date':moment(_0x326a3c['createdAt'])[_0x4d57('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xf6c420['cc']){_0x1dc9ca['headers']['Cc']=_0xf6c420['cc'];}if(_0xf6c420[_0x4d57('0x96')]){_0x1dc9ca[_0x4d57('0x97')]['Bcc']=_0xf6c420[_0x4d57('0x96')];}return new BPromise(function(_0x538454,_0x6697c2){if(_0xf6c420[_0x4d57('0x92')]){for(var _0x208578=0x0;_0x208578<_0xf6c420[_0x4d57('0x92')][_0x4d57('0x39')];_0x208578++){var _0x2eca97=_0xf6c420['Attachments'][_0x208578];var _0x1e976d=path[_0x4d57('0x5b')](_0x41404b,_0x2eca97[_0x4d57('0x5e')]);if(fs['existsSync'](_0x1e976d)){_0x1dc9ca[_0x4d57('0x5a')][_0x4d57('0x98')]({'name':_0x2eca97[_0x4d57('0x32')],'contentType':_0x2eca97[_0x4d57('0x30')],'data':fs[_0x4d57('0x99')](_0x1e976d)});}}}emlformat[_0x4d57('0x9a')](_0x1dc9ca,function(_0x4c6e95,_0x5e1d5f){if(_0x4c6e95)return _0x6697c2(_0x4c6e95);fs['writeFileSync'](path[_0x4d57('0x5b')](_0x5e2560,_0x36dc3f),_0x5e1d5f);return _0x538454(_0x5e1d5f);});});}})[_0x4d57('0x15')](function(_0x259e9a){if(_0x259e9a){return _0x26a4cc[_0x4d57('0x9b')](path[_0x4d57('0x5b')](_0x5e2560,_0x36dc3f),_0x36dc3f,function(_0x3235ce){if(!_0x3235ce)fs[_0x4d57('0x9c')](path['join'](_0x5e2560,_0x36dc3f));});}})['catch'](handleError(_0x26a4cc,null));}; \ No newline at end of file +var _0x556c=['json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','fieldName','key','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','MailMessage','includeAll','include','findAll','rows','catch','show','params','fields','length','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','agent','get','MailInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','MailInteraction','RejectMessage','rejectMessage','User','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','join','basename','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x281684,_0x1eae63){var _0x513920=function(_0x3f80e8){while(--_0x3f80e8){_0x281684['push'](_0x281684['shift']());}};_0x513920(++_0x1eae63);}(_0x556c,0x123));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc556('0x0'));var moment=require(_0xc556('0x1'));var BPromise=require(_0xc556('0x2'));var util=require('util');var path=require(_0xc556('0x3'));var fs=require('fs');var _=require(_0xc556('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xc556('0x5'));var qs=require(_0xc556('0x6'));var logger=require(_0xc556('0x7'))(_0xc556('0x8'));var interaction_log=require('../../config/logger')(_0xc556('0x9'));var config=require(_0xc556('0xa'));var db=require(_0xc556('0xb'))['db'];config[_0xc556('0xc')]=_[_0xc556('0xd')](config[_0xc556('0xc')],{'host':_0xc556('0xe'),'port':0x18eb});var socket=require(_0xc556('0xf'))(new Redis(config[_0xc556('0xc')]));var htmlEntities=require('html-entities');require(_0xc556('0x10'))[_0xc556('0x11')](socket);var jayson=require(_0xc556('0x12'));var client=jayson[_0xc556('0x13')][_0xc556('0x14')]({'port':0x232c});var client9003=jayson['client'][_0xc556('0x14')]({'port':0x232b});var client9002=jayson[_0xc556('0x13')][_0xc556('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1feb31,_0x370107,_0xc5d218,_0x1a21e6){return new BPromise(function(_0x15149f,_0x3c7a54){var _0x29565c=_0x1a21e6||client;return _0x29565c[_0xc556('0x15')](_0x1feb31,_0xc5d218)[_0xc556('0x16')](function(_0x1f06c3){logger['info'](_0xc556('0x17'),_0x370107,_0xc556('0x18'));logger[_0xc556('0x19')](_0xc556('0x1a'),_0x370107,_0xc556('0x18'),JSON[_0xc556('0x1b')](_0x1f06c3));if(_0x1f06c3[_0xc556('0x1c')]){if(_0x1f06c3['error'][_0xc556('0x1d')]===0x1f4){logger[_0xc556('0x1c')](_0xc556('0x17'),_0x370107,_0x1f06c3[_0xc556('0x1c')][_0xc556('0x1e')]);return _0x3c7a54(_0x1f06c3[_0xc556('0x1c')][_0xc556('0x1e')]);}logger[_0xc556('0x1c')](_0xc556('0x17'),_0x370107,_0x1f06c3[_0xc556('0x1c')][_0xc556('0x1e')]);return _0x15149f(_0x1f06c3[_0xc556('0x1c')][_0xc556('0x1e')]);}else{logger[_0xc556('0x1f')]('MailMessage,\x20%s,\x20%s',_0x370107,_0xc556('0x18'));_0x15149f(_0x1f06c3[_0xc556('0x20')]['message']);}})['catch'](function(_0x479a9a){logger[_0xc556('0x1c')](_0xc556('0x17'),_0x370107,_0x479a9a);_0x3c7a54(_0x479a9a);});});}function respondWithResult(_0x28e43b,_0x12bbb0){_0x12bbb0=_0x12bbb0||0xc8;return function(_0x42f04a){if(_0x42f04a){return _0x28e43b['status'](_0x12bbb0)[_0xc556('0x21')](_0x42f04a);}};}function respondWithFilteredResult(_0x446eb6,_0x2983ec){return function(_0x4a1d8e){if(_0x4a1d8e){var _0x3bed22=typeof _0x2983ec[_0xc556('0x22')]===_0xc556('0x23')&&typeof _0x2983ec[_0xc556('0x24')]===_0xc556('0x23');var _0x1f5f88=_0x4a1d8e[_0xc556('0x25')];var _0x4397e8=_0x3bed22?0x0:_0x2983ec[_0xc556('0x22')];var _0x34e5ab=_0x3bed22?_0x4a1d8e[_0xc556('0x25')]:_0x2983ec[_0xc556('0x22')]+_0x2983ec[_0xc556('0x24')];var _0x4400ce;if(_0x34e5ab>=_0x1f5f88){_0x34e5ab=_0x1f5f88;_0x4400ce=0xc8;}else{_0x4400ce=0xce;}_0x446eb6[_0xc556('0x26')](_0x4400ce);return _0x446eb6[_0xc556('0x27')](_0xc556('0x28'),_0x4397e8+'-'+_0x34e5ab+'/'+_0x1f5f88)[_0xc556('0x21')](_0x4a1d8e);}return null;};}function saveUpdates(_0x340a0f){return function(_0x5d5b17){if(_0x5d5b17){return _0x5d5b17[_0xc556('0x29')](_0x340a0f)[_0xc556('0x16')](function(_0x16f8ad){return _0x16f8ad;});}return null;};}function removeEntity(_0x1018a6){return function(_0x1bcb2e){if(_0x1bcb2e){return _0x1bcb2e[_0xc556('0x2a')]()['then'](function(){_0x1018a6[_0xc556('0x26')](0xcc)[_0xc556('0x2b')]();});}};}function handleEntityNotFound(_0x4a815b){return function(_0x50c20f){if(!_0x50c20f){_0x4a815b[_0xc556('0x2c')](0x194);}return _0x50c20f;};}function handleError(_0x5fcf53,_0x2d0ce1){_0x2d0ce1=_0x2d0ce1||0x1f4;return function(_0x5cdb1c){logger[_0xc556('0x1c')](_0x5cdb1c[_0xc556('0x2d')]);if(_0x5cdb1c[_0xc556('0x2e')]){delete _0x5cdb1c[_0xc556('0x2e')];}_0x5fcf53[_0xc556('0x26')](_0x2d0ce1)[_0xc556('0x2f')](_0x5cdb1c);};}exports['index']=function(_0x52bcea,_0x1f18e0){var _0x1cc85c={},_0x2e1e1b={},_0x20af82={'count':0x0,'rows':[]};var _0x44d037=_['map'](db['MailMessage']['rawAttributes'],function(_0x3f10df){return{'name':_0x3f10df[_0xc556('0x30')],'type':_0x3f10df['type'][_0xc556('0x31')]};});_0x2e1e1b[_0xc556('0x32')]=_[_0xc556('0x33')](_0x44d037,'name');_0x2e1e1b[_0xc556('0x34')]=_[_0xc556('0x35')](_0x52bcea[_0xc556('0x34')]);_0x2e1e1b[_0xc556('0x36')]=_['intersection'](_0x2e1e1b['model'],_0x2e1e1b[_0xc556('0x34')]);_0x1cc85c[_0xc556('0x37')]=_[_0xc556('0x38')](_0x2e1e1b[_0xc556('0x32')],qs['fields'](_0x52bcea[_0xc556('0x34')]['fields']));_0x1cc85c['attributes']=_0x1cc85c[_0xc556('0x37')]['length']?_0x1cc85c[_0xc556('0x37')]:_0x2e1e1b[_0xc556('0x32')];if(!_0x52bcea[_0xc556('0x34')][_0xc556('0x39')](_0xc556('0x3a'))){_0x1cc85c['limit']=qs[_0xc556('0x24')](_0x52bcea['query'][_0xc556('0x24')]);_0x1cc85c[_0xc556('0x22')]=qs[_0xc556('0x22')](_0x52bcea[_0xc556('0x34')][_0xc556('0x22')]);}_0x1cc85c[_0xc556('0x3b')]=qs[_0xc556('0x3c')](_0x52bcea[_0xc556('0x34')]['sort']);_0x1cc85c[_0xc556('0x3d')]=qs[_0xc556('0x36')](_['pick'](_0x52bcea[_0xc556('0x34')],_0x2e1e1b[_0xc556('0x36')]),_0x44d037);if(_0x52bcea[_0xc556('0x34')]['filter']){_0x1cc85c[_0xc556('0x3d')]=_[_0xc556('0x3e')](_0x1cc85c[_0xc556('0x3d')],{'$or':_[_0xc556('0x33')](_0x44d037,function(_0x1c8a57){if(_0x1c8a57[_0xc556('0x3f')]!==_0xc556('0x40')){var _0x599cbe={};_0x599cbe[_0x1c8a57['name']]={'$like':'%'+_0x52bcea[_0xc556('0x34')][_0xc556('0x41')]+'%'};return _0x599cbe;}})});}_0x1cc85c=_[_0xc556('0x3e')]({},_0x1cc85c,_0x52bcea[_0xc556('0x42')]);var _0x57e2aa={'where':_0x1cc85c[_0xc556('0x3d')]};return db[_0xc556('0x43')]['count'](_0x57e2aa)[_0xc556('0x16')](function(_0x28b3fc){_0x20af82[_0xc556('0x25')]=_0x28b3fc;if(_0x52bcea[_0xc556('0x34')][_0xc556('0x44')]){_0x1cc85c[_0xc556('0x45')]=[{'all':!![]}];}return db[_0xc556('0x43')][_0xc556('0x46')](_0x1cc85c);})['then'](function(_0x35d43b){_0x20af82[_0xc556('0x47')]=_0x35d43b;return _0x20af82;})[_0xc556('0x16')](respondWithFilteredResult(_0x1f18e0,_0x1cc85c))[_0xc556('0x48')](handleError(_0x1f18e0,null));};exports[_0xc556('0x49')]=function(_0x4feb14,_0x541c74){var _0x44d832={'raw':!![],'where':{'id':_0x4feb14[_0xc556('0x4a')]['id']}},_0x38da91={};_0x38da91[_0xc556('0x32')]=_[_0xc556('0x35')](db[_0xc556('0x43')]['rawAttributes']);_0x38da91[_0xc556('0x34')]=_[_0xc556('0x35')](_0x4feb14[_0xc556('0x34')]);_0x38da91[_0xc556('0x36')]=_['intersection'](_0x38da91['model'],_0x38da91[_0xc556('0x34')]);_0x44d832[_0xc556('0x37')]=_[_0xc556('0x38')](_0x38da91[_0xc556('0x32')],qs['fields'](_0x4feb14[_0xc556('0x34')][_0xc556('0x4b')]));_0x44d832[_0xc556('0x37')]=_0x44d832['attributes'][_0xc556('0x4c')]?_0x44d832[_0xc556('0x37')]:_0x38da91[_0xc556('0x32')];if(_0x4feb14[_0xc556('0x34')][_0xc556('0x44')]){_0x44d832[_0xc556('0x45')]=[{'all':!![]}];}_0x44d832=_[_0xc556('0x3e')]({},_0x44d832,_0x4feb14['options']);return db[_0xc556('0x43')]['find'](_0x44d832)[_0xc556('0x16')](handleEntityNotFound(_0x541c74,null))[_0xc556('0x16')](respondWithResult(_0x541c74,null))[_0xc556('0x48')](handleError(_0x541c74,null));};exports['update']=function(_0x10ecbd,_0x500940){if(_0x10ecbd['body']['id']){delete _0x10ecbd[_0xc556('0x4d')]['id'];}return db[_0xc556('0x43')][_0xc556('0x4e')]({'where':{'id':_0x10ecbd[_0xc556('0x4a')]['id']}})[_0xc556('0x16')](handleEntityNotFound(_0x500940,null))[_0xc556('0x16')](saveUpdates(_0x10ecbd['body'],null))['then'](respondWithResult(_0x500940,null))[_0xc556('0x48')](handleError(_0x500940,null));};exports[_0xc556('0x2a')]=function(_0x2179a1,_0x2434b7){return db[_0xc556('0x43')][_0xc556('0x4e')]({'where':{'id':_0x2179a1[_0xc556('0x4a')]['id']}})[_0xc556('0x16')](handleEntityNotFound(_0x2434b7,null))[_0xc556('0x16')](removeEntity(_0x2434b7,null))['catch'](handleError(_0x2434b7,null));};exports[_0xc556('0x4f')]=function(_0x1cdc28,_0x57c08d){return db['MailMessage'][_0xc556('0x4f')]()['then'](respondWithResult(_0x57c08d,null))[_0xc556('0x48')](handleError(_0x57c08d,null));};exports[_0xc556('0x50')]=function(_0xb412d4,_0x403cb9){return db[_0xc556('0x43')][_0xc556('0x50')](_0xb412d4[_0xc556('0x4d')])[_0xc556('0x16')](function(_0x235237){if(_0x235237){if(_0x235237[_0xc556('0x51')]===_0xc556('0x52')&&!_0x235237[_0xc556('0x53')]){var _0x237221,_0x3df34a,_0x5b2af6;if(_0xb412d4[_0xc556('0x4d')]['to']){_0x3df34a=_0xb412d4[_0xc556('0x4d')]['to'][_0xc556('0x54')](',')[0x0];}return db[_0xc556('0x55')][_0xc556('0x56')]({'where':{'id':_0x235237['MailAccountId']},'include':[{'model':db[_0xc556('0x57')],'as':_0xc556('0x58'),'include':[{'model':db[_0xc556('0x59')],'as':_0xc556('0x5a'),'where':{'email':_0x3df34a},'limit':0x1,'order':[[_0xc556('0x5b'),_0xc556('0x5c')]]}]},{'model':db[_0xc556('0x5d')],'as':_0xc556('0x5e'),'raw':!![],'include':[{'model':db[_0xc556('0x5f')],'as':'CloudProvider','raw':!![]}]}]})[_0xc556('0x16')](function(_0x78aee4){_0x237221=_0x78aee4;if(!_0x237221||!_0x237221['Smtp'])return;var _0x5964af=_0x237221[_0xc556('0x60')]();if(_0xb412d4[_0xc556('0x4d')][_0xc556('0x61')]&&_0xb412d4[_0xc556('0x4d')][_0xc556('0x61')][_0xc556('0x4c')]){for(var _0x27ceb1=0x0;_0x27ceb1<_0xb412d4['body'][_0xc556('0x61')][_0xc556('0x4c')];_0x27ceb1+=0x1){_0xb412d4[_0xc556('0x4d')][_0xc556('0x61')][_0x27ceb1]={'filename':_0xb412d4[_0xc556('0x4d')][_0xc556('0x61')][_0x27ceb1][_0xc556('0x2e')],'path':path['join'](config[_0xc556('0x62')],_0xc556('0x63'),_0xb412d4[_0xc556('0x4d')][_0xc556('0x61')][_0x27ceb1]['basename'])};}}_0x5b2af6={'account':_0x5964af,'message':_0xb412d4[_0xc556('0x4d')]};return;})[_0xc556('0x16')](function(){if(_0x237221[_0xc556('0x58')]){if(_0x237221[_0xc556('0x58')][_0xc556('0x5a')][_0xc556('0x4c')]){return _0x237221[_0xc556('0x58')][_0xc556('0x5a')][0x0];}else{return db[_0xc556('0x59')][_0xc556('0x50')](_[_0xc556('0xd')](_0xb412d4[_0xc556('0x4d')],{'firstName':_0xb412d4['body']['to'],'email':_0xb412d4[_0xc556('0x4d')]['to'],'phone':_0xb412d4[_0xc556('0x4d')]['to'],'ListId':_0x237221['ListId']}));}}else{throw new Error(_0xc556('0x64'));}})['then'](function(){if(_0x5b2af6){return respondWithRpcPromise('SendMail','sendMail',_0x5b2af6,client9003)[_0xc556('0x16')](function(_0x3b48cb){return _0x235237[_0xc556('0x29')]({'read':!![],'messageId':_0x3b48cb[_0xc556('0x65')],'sentAt':moment()[_0xc556('0x66')](_0xc556('0x67'))});})['catch'](function(_0x8cd924){logger[_0xc556('0x1c')]('%s',JSON[_0xc556('0x1b')](_0x8cd924));return _0x235237;});}return _0x235237;});}return _0x235237;}})[_0xc556('0x16')](respondWithResult(_0x403cb9,0xc9))['catch'](handleError(_0x403cb9,null));};exports['accept']=function(_0x3adc66,_0x5cef4e){var _0x4edcc8={'agent':{},'channel':_0xc556('0x68')};if(_0x3adc66[_0xc556('0x4d')]['id']){delete _0x3adc66[_0xc556('0x4d')]['id'];}_0x3adc66[_0xc556('0x4d')][_0xc556('0x69')]=!![];_0x3adc66[_0xc556('0x4d')]['readAt']=moment()[_0xc556('0x66')](_0xc556('0x67'));_0x3adc66[_0xc556('0x4d')]['UserId']=_0x3adc66[_0xc556('0x4d')][_0xc556('0x6a')]||_0x3adc66['user']['id'];_0x4edcc8[_0xc556('0x6b')]['id']=_0x3adc66[_0xc556('0x4d')][_0xc556('0x6a')];return db[_0xc556('0x43')][_0xc556('0x4e')]({'where':{'id':_0x3adc66[_0xc556('0x4a')]['id'],'UserId':null}})[_0xc556('0x16')](handleEntityNotFound(_0x5cef4e,null))[_0xc556('0x16')](saveUpdates(_0x3adc66[_0xc556('0x4d')],null))['then'](function(_0xe60298){if(_0xe60298){_0x4edcc8['message']=_0xe60298[_0xc556('0x6c')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xe60298[_0xc556('0x6d')]}});}return null;})[_0xc556('0x16')](handleEntityNotFound(_0x5cef4e,null))[_0xc556('0x16')](function(_0x241c0e){if(_0x241c0e){return _0x241c0e[_0xc556('0x29')]({'UserId':_0x3adc66[_0xc556('0x4d')][_0xc556('0x6a')],'read1stAt':_[_0xc556('0x6e')](_0x241c0e[_0xc556('0x6f')])?moment()[_0xc556('0x66')](_0xc556('0x67')):undefined});}return null;})[_0xc556('0x16')](function(_0x874b5f){if(_0x874b5f){_0x4edcc8[_0xc556('0x70')]=_0x874b5f['get']({'plain':!![]});interaction_log[_0xc556('0x1f')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3adc66[_0xc556('0x71')]['id'],_0x3adc66[_0xc556('0x71')][_0xc556('0x2e')],_0x3adc66[_0xc556('0x71')][_0xc556('0x72')],_0x4edcc8['interaction']['id'],_0x3adc66[_0xc556('0x4d')]?JSON['stringify'](_0x3adc66[_0xc556('0x4d')]):_0xc556('0x73'));return respondWithRpcPromise(_0xc556('0x74'),'acceptMessage',_0x4edcc8);}return null;})['then'](function(_0x120650){var _0x68f42b=_0xc556('0x75')+_0x120650[_0xc556('0x1e')][_0xc556('0x76')];return db[_0xc556('0x77')][_0xc556('0x34')](_0x68f42b,{'type':db[_0xc556('0x78')]['QueryTypes'][_0xc556('0x79')],'raw':!![]})[_0xc556('0x16')](function(_0xb9d5f9){return _0xb9d5f9;});})[_0xc556('0x16')](function(_0x1cea9a){if(_0x1cea9a){_0x4edcc8[_0xc556('0x1e')][_0xc556('0x7a')]=_0x1cea9a[0x0];if(!_0x3adc66[_0xc556('0x4d')]['UserId'])return;return db['User'][_0xc556('0x4e')]({'where':{'id':_0x3adc66[_0xc556('0x4d')][_0xc556('0x6a')],'role':'agent'},'attributes':['id',_0xc556('0x2e'),_0xc556('0x7b'),_0xc556('0x7c'),_0xc556('0x7d')],'raw':!![]});}return null;})[_0xc556('0x16')](function(_0x40fc07){if(!_0x40fc07)return null;_0x4edcc8[_0xc556('0x1e')][_0xc556('0x6b')]=_0x40fc07;return _0x4edcc8;})[_0xc556('0x16')](function(_0x53da02){if(_0x53da02){if(_0x3adc66[_0xc556('0x4d')]['manual']){_0x4edcc8[_0xc556('0x1e')][_0xc556('0x7e')]=util[_0xc556('0x66')](_0xc556('0x7f'),_0x3adc66[_0xc556('0x71')][_0xc556('0x2e')]);_0x4edcc8[_0xc556('0x1e')][_0xc556('0x80')]=_0x4edcc8[_0xc556('0x80')];_0x4edcc8[_0xc556('0x1e')]['motionChannel']=_0x4edcc8['channel'];_0x4edcc8[_0xc556('0x1e')][_0xc556('0x81')]=_0xc556('0x82');_0x4edcc8[_0xc556('0x1e')]['body']=htmlToText[_0xc556('0x83')](_0x4edcc8[_0xc556('0x1e')][_0xc556('0x4d')]);return respondWithRpcPromise(_0xc556('0x84'),_0xc556('0x84'),{'event':'acceptmessage','message':_0x4edcc8[_0xc556('0x1e')]},client9002)[_0xc556('0x16')](function(){return _0x4edcc8;});}return _0x4edcc8;}return null;})[_0xc556('0x16')](respondWithResult(_0x5cef4e,null))['catch'](handleError(_0x5cef4e,null));};exports[_0xc556('0x85')]=function(_0x40ed97,_0x3829c1){var _0x473b26={'agent':{},'channel':_0xc556('0x68')};if(_0x40ed97[_0xc556('0x4d')]['id']){delete _0x40ed97[_0xc556('0x4d')]['id'];}_0x40ed97[_0xc556('0x4d')][_0xc556('0x6a')]=_0x40ed97['body'][_0xc556('0x6a')]||_0x40ed97[_0xc556('0x71')]['id'];_0x473b26[_0xc556('0x6b')]['id']=_0x40ed97[_0xc556('0x4d')][_0xc556('0x6a')];return db[_0xc556('0x43')][_0xc556('0x4e')]({'where':{'id':_0x40ed97[_0xc556('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3829c1,null))[_0xc556('0x16')](function(_0x2bb633){if(_0x2bb633){_0x473b26[_0xc556('0x1e')]=_0x2bb633[_0xc556('0x6c')]({'plain':!![]});return db[_0xc556('0x86')][_0xc556('0x4e')]({'where':{'id':_0x2bb633[_0xc556('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x3829c1,null))[_0xc556('0x16')](function(_0x2c70b6){if(_0x2c70b6){_0x473b26['interaction']=_0x2c70b6['get']({'plain':!![]});interaction_log[_0xc556('0x1f')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40ed97[_0xc556('0x71')]['id'],_0x40ed97[_0xc556('0x71')]['name'],_0x40ed97[_0xc556('0x71')][_0xc556('0x72')],_0x473b26[_0xc556('0x70')]['id'],_0x40ed97[_0xc556('0x4d')]?JSON[_0xc556('0x1b')](_0x40ed97[_0xc556('0x4d')]):_0xc556('0x73'));return respondWithRpcPromise(_0xc556('0x87'),_0xc556('0x88'),_0x473b26);}return null;})[_0xc556('0x16')](function(_0x4a55bc){var _0x5a2d7c=_0xc556('0x75')+_0x4a55bc[_0xc556('0x1e')][_0xc556('0x76')];return db[_0xc556('0x77')][_0xc556('0x34')](_0x5a2d7c,{'type':db[_0xc556('0x78')]['QueryTypes'][_0xc556('0x79')],'raw':!![]})[_0xc556('0x16')](function(_0x51ce61){return _0x51ce61;});})[_0xc556('0x16')](function(_0x1392e7){if(_0x1392e7){_0x473b26[_0xc556('0x1e')][_0xc556('0x7a')]=_0x1392e7[0x0];if(!_0x40ed97[_0xc556('0x4d')]['UserId'])return;return db[_0xc556('0x89')][_0xc556('0x4e')]({'where':{'id':_0x40ed97[_0xc556('0x4d')]['UserId'],'role':_0xc556('0x6b')},'attributes':['id','name','fullname','email',_0xc556('0x7d')],'raw':!![]});}return null;})[_0xc556('0x16')](function(_0x324736){if(!_0x324736)return null;_0x473b26[_0xc556('0x1e')][_0xc556('0x6b')]=_0x324736;return _0x473b26;})[_0xc556('0x16')](function(_0x79f18c){if(_0x79f18c){_0x79f18c[_0xc556('0x1e')][_0xc556('0x7e')]=util[_0xc556('0x66')](_0xc556('0x7f'),_0x40ed97[_0xc556('0x71')][_0xc556('0x2e')]);_0x79f18c[_0xc556('0x1e')]['channel']=_0x473b26[_0xc556('0x80')];_0x79f18c[_0xc556('0x1e')][_0xc556('0x8a')]=_0x473b26[_0xc556('0x80')];_0x79f18c['message'][_0xc556('0x81')]=_0xc556('0x85');_0x79f18c[_0xc556('0x1e')][_0xc556('0x4d')]=htmlToText[_0xc556('0x83')](_0x473b26[_0xc556('0x1e')][_0xc556('0x4d')]);respondWithRpcPromise(_0xc556('0x84'),'EventManager',{'event':_0xc556('0x8b'),'message':_0x79f18c[_0xc556('0x1e')]},client9002);return _0x473b26;}return null;})['then'](respondWithResult(_0x3829c1,null))[_0xc556('0x48')](handleError(_0x3829c1,null));};exports[_0xc556('0x8c')]=function(_0xe9e6aa,_0x173db1){var _0xd74dec=moment()[_0xc556('0x8d')]()[_0xc556('0x8e')]();var _0x5432bf=path['join'](config[_0xc556('0x62')],_0xc556('0x8f'),_0xc556('0x90'),_0xc556('0x91'));var _0x359570=path['join'](config[_0xc556('0x62')],_0xc556('0x8f'),_0xc556('0x90'),_0xc556('0x61'));var _0x5b24fb=util[_0xc556('0x66')]('message-%s.eml',_0xd74dec);return db[_0xc556('0x43')][_0xc556('0x4e')]({'where':{'id':_0xe9e6aa[_0xc556('0x4a')]['id']},'attributes':['id',_0xc556('0x4d'),'from','to','cc','bcc',_0xc556('0x92'),_0xc556('0x93')],'include':_0xe9e6aa['query'][_0xc556('0x61')]?[{'model':db[_0xc556('0x94')],'as':_0xc556('0x95')}]:undefined})[_0xc556('0x16')](handleEntityNotFound(_0x173db1,null))[_0xc556('0x16')](function(_0x5afd76){if(_0x5afd76){var _0x536a28=_0x5afd76;var _0x5523f3={'from':_0x536a28[_0xc556('0x96')],'to':_0x536a28['to'],'subject':_0x536a28[_0xc556('0x92')],'html':htmlEntities[_0xc556('0x97')](_0x536a28['body']),'headers':{'Date':moment(_0x536a28[_0xc556('0x93')])[_0xc556('0x66')](_0xc556('0x98'))},'attachments':[]};if(_0x5afd76['cc']){_0x5523f3[_0xc556('0x99')]['Cc']=_0x5afd76['cc'];}if(_0x5afd76['bcc']){_0x5523f3[_0xc556('0x99')][_0xc556('0x9a')]=_0x5afd76[_0xc556('0x9b')];}return new BPromise(function(_0x1e8605,_0x1542a9){if(_0x5afd76[_0xc556('0x95')]){for(var _0x40681d=0x0;_0x40681d<_0x5afd76[_0xc556('0x95')][_0xc556('0x4c')];_0x40681d++){var _0x5df50a=_0x5afd76[_0xc556('0x95')][_0x40681d];var _0x38b503=path[_0xc556('0x9c')](_0x359570,_0x5df50a[_0xc556('0x9d')]);if(fs[_0xc556('0x9e')](_0x38b503)){_0x5523f3[_0xc556('0x61')][_0xc556('0x9f')]({'name':_0x5df50a[_0xc556('0x2e')],'contentType':_0x5df50a[_0xc556('0x3f')],'data':fs['readFileSync'](_0x38b503)});}}}emlformat[_0xc556('0xa0')](_0x5523f3,function(_0xac8760,_0xada47b){if(_0xac8760)return _0x1542a9(_0xac8760);fs['writeFileSync'](path[_0xc556('0x9c')](_0x5432bf,_0x5b24fb),_0xada47b);return _0x1e8605(_0xada47b);});});}})['then'](function(_0x3c666e){if(_0x3c666e){return _0x173db1[_0xc556('0x8c')](path[_0xc556('0x9c')](_0x5432bf,_0x5b24fb),_0x5b24fb,function(_0x4f4cea){if(!_0x4f4cea)fs[_0xc556('0xa1')](path[_0xc556('0x9c')](_0x5432bf,_0x5b24fb));});}})[_0xc556('0x48')](handleError(_0x173db1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e6680bf..9d01f20 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc03e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc03e,0xd6));var _0xec03=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc03e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xec03('0x0'));var MailMessage=require(_0xec03('0x1'))['db'][_0xec03('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xec03('0x3')](0x0);var events={'afterCreate':_0xec03('0x4'),'afterUpdate':_0xec03('0x5'),'afterDestroy':_0xec03('0x6')};function emitEvent(_0x3b816f){return function(_0x42fb74,_0xd1a87c,_0x44d5c9){MailMessageEvents['emit'](_0x3b816f+':'+_0x42fb74['id'],_0x42fb74);MailMessageEvents[_0xec03('0x7')](_0x3b816f,_0x42fb74);_0x44d5c9(null);};}for(var e in events){if(events[_0xec03('0x8')](e)){var event=events[e];MailMessage[_0xec03('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x4e77=['events','../../mysqldb','update','remove','emit','hasOwnProperty','exports'];(function(_0xe511e2,_0xcbc165){var _0x2a29ff=function(_0x13c947){while(--_0x13c947){_0xe511e2['push'](_0xe511e2['shift']());}};_0x2a29ff(++_0xcbc165);}(_0x4e77,0x19d));var _0x74e7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4e77[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x74e7('0x0'));var MailMessage=require(_0x74e7('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x74e7('0x2'),'afterDestroy':_0x74e7('0x3')};function emitEvent(_0xc4d82d){return function(_0x3660f5,_0x10335c,_0x427500){MailMessageEvents[_0x74e7('0x4')](_0xc4d82d+':'+_0x3660f5['id'],_0x3660f5);MailMessageEvents[_0x74e7('0x4')](_0xc4d82d,_0x3660f5);_0x427500(null);};}for(var e in events){if(events[_0x74e7('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x74e7('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 21a5ece..90470a0 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb1b=['secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','get','direction','toLowerCase','out'];(function(_0x591172,_0x3e2128){var _0x5c9240=function(_0xd897b3){while(--_0xd897b3){_0x591172['push'](_0x591172['shift']());}};_0x5c9240(++_0x3e2128);}(_0xfb1b,0xd5));var _0xbfb1=function(_0x10afb2,_0x431e94){_0x10afb2=_0x10afb2-0x0;var _0x23c228=_0xfb1b[_0x10afb2];return _0x23c228;};'use strict';var _=require('lodash');var util=require(_0xbfb1('0x0'));var logger=require('../../config/logger')(_0xbfb1('0x1'));var moment=require('moment');var BPromise=require(_0xbfb1('0x2'));var rp=require(_0xbfb1('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xbfb1('0x4'));var rimraf=require(_0xbfb1('0x5'));var config=require(_0xbfb1('0x6'));var attributes=require(_0xbfb1('0x7'));module[_0xbfb1('0x8')]=function(_0x4fc9d4,_0x282765){return _0x4fc9d4['define'](_0xbfb1('0x9'),attributes,{'tableName':_0xbfb1('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbfb1('0xb')]},{'name':_0xbfb1('0xc'),'fields':[_0xbfb1('0xd'),_0xbfb1('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd51d8,_0x5cc0da,_0x79d312){if(_0xd51d8['body']){_0xd51d8[_0xbfb1('0xd')]=htmlToText['fromString'](_0xd51d8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x79d312(null,_0x5cc0da);},'afterCreate':function(_0x1de0ec,_0x439664,_0x3708b4){var _0x38d2bc=_0x4fc9d4['models'];var _0x2af49b=_0x1de0ec[_0xbfb1('0xf')]({'plain':!![]});if(_0x2af49b[_0xbfb1('0x10')]['toLowerCase']()==='in'||_0x2af49b[_0xbfb1('0x10')][_0xbfb1('0x11')]()===_0xbfb1('0x12')&&!_0x2af49b[_0xbfb1('0x13')]&&!_[_0xbfb1('0x14')](_0x2af49b[_0xbfb1('0x15')])){_0x38d2bc[_0xbfb1('0x16')][_0xbfb1('0x17')]({'where':{'id':_0x2af49b[_0xbfb1('0x18')]}})[_0xbfb1('0x19')](function(_0x4bc66d){if(_0x4bc66d){_0x4bc66d['update']({'lastMsgAt':_0x2af49b[_0xbfb1('0x1a')],'lastMsgDirection':_0x2af49b['direction'][_0xbfb1('0x11')]()});}})[_0xbfb1('0x1b')](function(_0x2fdcff){console['error'](_0x2fdcff);});}_0x3708b4();}},'charset':_0xbfb1('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7fca=['update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then'];(function(_0x3baa05,_0x207228){var _0x3b2b8d=function(_0x51d764){while(--_0x51d764){_0x3baa05['push'](_0x3baa05['shift']());}};_0x3b2b8d(++_0x207228);}(_0x7fca,0x124));var _0xa7fc=function(_0x38d218,_0xd2f4be){_0x38d218=_0x38d218-0x0;var _0x3329e5=_0x7fca[_0x38d218];return _0x3329e5;};'use strict';var _=require(_0xa7fc('0x0'));var util=require(_0xa7fc('0x1'));var logger=require(_0xa7fc('0x2'))(_0xa7fc('0x3'));var moment=require(_0xa7fc('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7fc('0x5'));var htmlToText=require(_0xa7fc('0x6'));var fs=require('fs');var path=require(_0xa7fc('0x7'));var rimraf=require(_0xa7fc('0x8'));var config=require(_0xa7fc('0x9'));var attributes=require(_0xa7fc('0xa'));module[_0xa7fc('0xb')]=function(_0x4adb1a,_0x1e2f38){return _0x4adb1a[_0xa7fc('0xc')]('MailMessage',attributes,{'tableName':_0xa7fc('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa7fc('0xe')]},{'name':_0xa7fc('0xf'),'fields':[_0xa7fc('0x10'),_0xa7fc('0x11')],'type':_0xa7fc('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x361328,_0xfe7c32,_0x2dfed0){if(_0x361328[_0xa7fc('0x13')]){_0x361328['plainBody']=htmlToText[_0xa7fc('0x14')](_0x361328[_0xa7fc('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2dfed0(null,_0xfe7c32);},'afterCreate':function(_0x109421,_0x1f500e,_0x4aba72){var _0x2d485b=_0x4adb1a[_0xa7fc('0x15')];var _0x4b59b0=_0x109421[_0xa7fc('0x16')]({'plain':!![]});if(_0x4b59b0[_0xa7fc('0x17')][_0xa7fc('0x18')]()==='in'||_0x4b59b0[_0xa7fc('0x17')][_0xa7fc('0x18')]()===_0xa7fc('0x19')&&!_0x4b59b0[_0xa7fc('0x1a')]&&!_[_0xa7fc('0x1b')](_0x4b59b0[_0xa7fc('0x1c')])){_0x2d485b[_0xa7fc('0x1d')][_0xa7fc('0x1e')]({'where':{'id':_0x4b59b0['MailInteractionId']}})[_0xa7fc('0x1f')](function(_0x3cd050){if(_0x3cd050){_0x3cd050[_0xa7fc('0x20')]({'lastMsgAt':_0x4b59b0[_0xa7fc('0x21')],'lastMsgDirection':_0x4b59b0[_0xa7fc('0x17')][_0xa7fc('0x18')]()});}})[_0xa7fc('0x22')](function(_0x162d3a){console['error'](_0x162d3a);});}_0x4aba72();}},'charset':_0xa7fc('0x23'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 563a792..dee1da5 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1fa85d,_0x298a9b){var _0x488959=function(_0x3f6213){while(--_0x3f6213){_0x1fa85d['push'](_0x1fa85d['shift']());}};_0x488959(++_0x298a9b);}(_0x14a0,0x8e));var _0x014a=function(_0x43cec0,_0x268416){_0x43cec0=_0x43cec0-0x0;var _0x1de61d=_0x14a0[_0x43cec0];return _0x1de61d;};'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});config['redis']=_[_0x014a('0xa')](config[_0x014a('0xb')],{'host':_0x014a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x014a('0xd'))['register'](socket);function respondWithRpcPromise(_0x490ea2,_0x5aa52f,_0x4f3539){return new BPromise(function(_0x330469,_0x4c7418){return client[_0x014a('0xe')](_0x490ea2,_0x4f3539)[_0x014a('0xf')](function(_0x543bbf){logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));logger[_0x014a('0x13')](_0x014a('0x14'),_0x5aa52f,_0x014a('0x12'),JSON[_0x014a('0x15')](_0x543bbf));if(_0x543bbf[_0x014a('0x16')]){if(_0x543bbf[_0x014a('0x16')][_0x014a('0x17')]===0x1f4){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x4c7418(_0x543bbf[_0x014a('0x16')]['message']);}logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x330469(_0x543bbf[_0x014a('0x16')][_0x014a('0x18')]);}else{logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));_0x330469(_0x543bbf[_0x014a('0x19')][_0x014a('0x18')]);}})[_0x014a('0x1a')](function(_0x3b9341){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x3b9341);_0x4c7418(_0x3b9341);});});}exports[_0x014a('0x1b')]=function(_0x34e5c3){var _0x5c69c5=this;return new Promise(function(_0x359903,_0x109a9c){return db[_0x014a('0x1c')][_0x014a('0x1d')](_0x34e5c3[_0x014a('0x1e')],{'raw':_0x34e5c3[_0x014a('0x1f')]?_0x34e5c3[_0x014a('0x1f')][_0x014a('0x20')]===undefined?!![]:![]:!![]})[_0x014a('0xf')](function(_0x486e66){logger[_0x014a('0x10')]('CreateMailMessage',_0x34e5c3);logger[_0x014a('0x13')](_0x014a('0x1b'),_0x34e5c3,JSON[_0x014a('0x15')](_0x486e66));_0x359903(_0x486e66);})[_0x014a('0x1a')](function(_0x2b3c10){logger[_0x014a('0x16')](_0x014a('0x1b'),_0x2b3c10[_0x014a('0x18')],_0x34e5c3);_0x109a9c(_0x5c69c5[_0x014a('0x16')](0x1f4,_0x2b3c10['message']));});});}; \ No newline at end of file +var _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xda2d,0x102));var _0xdda2=function(_0x3dfdce,_0x4ba418){_0x3dfdce=_0x3dfdce-0x0;var _0xf3405a=_0xda2d[_0x3dfdce];return _0xf3405a;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('MailMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('MailMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateMailMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 755b85d..44cb484 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6de8=['removeListener','register','save','emit'];(function(_0x45aa75,_0x389fd2){var _0x5bac72=function(_0x17ebfe){while(--_0x17ebfe){_0x45aa75['push'](_0x45aa75['shift']());}};_0x5bac72(++_0x389fd2);}(_0x6de8,0x126));var _0x86de=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6de8[_0x263a74];return _0x2aa86c;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x86de('0x0'),'remove','update'];function createListener(_0x43f089,_0x19236c){return function(_0x46713f){_0x19236c[_0x86de('0x1')](_0x43f089,_0x46713f);};}function removeListener(_0x1b3659,_0x255609){return function(){MailMessageEvents[_0x86de('0x2')](_0x1b3659,_0x255609);};}exports[_0x86de('0x3')]=function(_0x5b22ac){for(var _0x5f2eca=0x0,_0x4663c9=events['length'];_0x5f2eca<_0x4663c9;_0x5f2eca++){var _0x5039b3=events[_0x5f2eca];var _0x131456=createListener('mailMessage:'+_0x5039b3,_0x5b22ac);MailMessageEvents['on'](_0x5039b3,_0x131456);}}; \ No newline at end of file +var _0x4deb=['./mailMessage.events','save','update','removeListener','register','length','mailMessage:'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x4deb,0x17a));var _0xb4de=function(_0x4d36a4,_0x303dd0){_0x4d36a4=_0x4d36a4-0x0;var _0x8d4548=_0x4deb[_0x4d36a4];return _0x8d4548;};'use strict';var MailMessageEvents=require(_0xb4de('0x0'));var events=[_0xb4de('0x1'),'remove',_0xb4de('0x2')];function createListener(_0x464235,_0xde1e44){return function(_0x30f751){_0xde1e44['emit'](_0x464235,_0x30f751);};}function removeListener(_0x21e86c,_0x2ec52b){return function(){MailMessageEvents[_0xb4de('0x3')](_0x21e86c,_0x2ec52b);};}exports[_0xb4de('0x4')]=function(_0x58d73e){for(var _0xa4b739=0x0,_0x1d3865=events[_0xb4de('0x5')];_0xa4b739<_0x1d3865;_0xa4b739++){var _0x46eb88=events[_0xa4b739];var _0x2b3c39=createListener(_0xb4de('0x6')+_0x46eb88,_0x58d73e);MailMessageEvents['on'](_0x46eb88,_0x2b3c39);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c158c0d..8cd0771 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9841=['delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x9841,0x164));var _0x1984=function(_0x2ef8fa,_0x54eede){_0x2ef8fa=_0x2ef8fa-0x0;var _0x6960af=_0x9841[_0x2ef8fa];return _0x6960af;};'use strict';var multer=require(_0x1984('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1984('0x1'));var express=require(_0x1984('0x2'));var router=express[_0x1984('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1984('0x4'));var interaction=require(_0x1984('0x5'));var config=require(_0x1984('0x6'));var controller=require('./mailQueue.controller');router[_0x1984('0x7')]('/',auth[_0x1984('0x8')](),controller['index']);router[_0x1984('0x7')](_0x1984('0x9'),auth[_0x1984('0x8')](),controller[_0x1984('0xa')]);router[_0x1984('0x7')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller['show']);router[_0x1984('0x7')](_0x1984('0xc'),auth[_0x1984('0x8')](),controller['getMembers']);router[_0x1984('0x7')]('/:id/teams',auth[_0x1984('0x8')](),controller[_0x1984('0xd')]);router[_0x1984('0x7')](_0x1984('0xe'),auth['isAuthenticated'](),controller[_0x1984('0xf')]);router[_0x1984('0x10')]('/',auth[_0x1984('0x8')](),controller['create']);router[_0x1984('0x10')](_0x1984('0x11'),auth[_0x1984('0x8')](),controller[_0x1984('0x12')]);router[_0x1984('0x10')](_0x1984('0xe'),auth['isAuthenticated'](),controller[_0x1984('0x13')]);router[_0x1984('0x14')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller[_0x1984('0x15')]);router[_0x1984('0x16')](_0x1984('0xb'),auth[_0x1984('0x8')](),controller[_0x1984('0x17')]);router[_0x1984('0x16')](_0x1984('0x11'),auth[_0x1984('0x8')](),controller[_0x1984('0x18')]);router[_0x1984('0x16')](_0x1984('0xe'),auth[_0x1984('0x8')](),controller[_0x1984('0x19')]);module[_0x1984('0x1a')]=router; \ No newline at end of file +var _0xc232=['/:id/teams','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id','update','delete','destroy'];(function(_0x133853,_0x19454f){var _0x4bfc1f=function(_0x42be5e){while(--_0x42be5e){_0x133853['push'](_0x133853['shift']());}};_0x4bfc1f(++_0x19454f);}(_0xc232,0xbe));var _0x2c23=function(_0x326fb0,_0x54416f){_0x326fb0=_0x326fb0-0x0;var _0x18f8de=_0xc232[_0x326fb0];return _0x18f8de;};'use strict';var multer=require(_0x2c23('0x0'));var util=require(_0x2c23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2c23('0x2'));var router=express[_0x2c23('0x3')]();var fs_extra=require(_0x2c23('0x4'));var auth=require(_0x2c23('0x5'));var interaction=require(_0x2c23('0x6'));var config=require('../../config/environment');var controller=require(_0x2c23('0x7'));router[_0x2c23('0x8')]('/',auth[_0x2c23('0x9')](),controller[_0x2c23('0xa')]);router[_0x2c23('0x8')](_0x2c23('0xb'),auth[_0x2c23('0x9')](),controller[_0x2c23('0xc')]);router['get']('/:id',auth[_0x2c23('0x9')](),controller[_0x2c23('0xd')]);router['get'](_0x2c23('0xe'),auth['isAuthenticated'](),controller[_0x2c23('0xf')]);router[_0x2c23('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2c23('0x8')](_0x2c23('0x10'),auth[_0x2c23('0x9')](),controller[_0x2c23('0x11')]);router['post']('/',auth[_0x2c23('0x9')](),controller[_0x2c23('0x12')]);router[_0x2c23('0x13')]('/:id/teams',auth[_0x2c23('0x9')](),controller[_0x2c23('0x14')]);router[_0x2c23('0x13')]('/:id/users',auth[_0x2c23('0x9')](),controller[_0x2c23('0x15')]);router[_0x2c23('0x16')](_0x2c23('0x17'),auth['isAuthenticated'](),controller[_0x2c23('0x18')]);router[_0x2c23('0x19')](_0x2c23('0x17'),auth[_0x2c23('0x9')](),controller[_0x2c23('0x1a')]);router[_0x2c23('0x19')](_0x2c23('0x1b'),auth[_0x2c23('0x9')](),controller[_0x2c23('0x1c')]);router[_0x2c23('0x19')](_0x2c23('0x10'),auth[_0x2c23('0x9')](),controller[_0x2c23('0x1d')]);module[_0x2c23('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9d95d31..8aa5d61 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f90=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x6f90,0xdf));var _0x06f9=function(_0x4088a4,_0x4218ee){_0x4088a4=_0x4088a4-0x0;var _0x5e621e=_0x6f90[_0x4088a4];return _0x5e621e;};'use strict';var Sequelize=require(_0x06f9('0x0'));module[_0x06f9('0x1')]={'name':{'type':Sequelize[_0x06f9('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x06f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x06f9('0x4')](_0x06f9('0x5'),_0x06f9('0x6'),_0x06f9('0x7'))}}; \ No newline at end of file +var _0x56e4=['beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x57da58,_0x5c16c7){var _0xdc827a=function(_0xb9ddc3){while(--_0xb9ddc3){_0x57da58['push'](_0x57da58['shift']());}};_0xdc827a(++_0x5c16c7);}(_0x56e4,0x16a));var _0x456e=function(_0xc247e7,_0x1e0f7a){_0xc247e7=_0xc247e7-0x0;var _0x182dc0=_0x56e4[_0xc247e7];return _0x182dc0;};'use strict';var Sequelize=require(_0x456e('0x0'));module[_0x456e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x456e('0x2')]},'timeout':{'type':Sequelize[_0x456e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x456e('0x4'),_0x456e('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5398843..7a70ae1 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51ce=['set','Content-Range','update','then','destroy','get','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','rows','catch','show','params','model','MailQueue','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserMailQueue','nolimit','order','sort','pick','filter','findAll','User','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','findOne','Team','options','hasOwnProperty','online','voicePause','flatMap','Agents','sequelize','addTeams','findOrCreate','emit','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','undefined','limit','count','offset'];(function(_0x5dec99,_0x5d2958){var _0x3a47c5=function(_0x59be1d){while(--_0x59be1d){_0x5dec99['push'](_0x5dec99['shift']());}};_0x3a47c5(++_0x5d2958);}(_0x51ce,0x69));var _0xe51c=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x51ce[_0x2dbcef];return _0x5a90ea;};'use strict';var BPromise=require('bluebird');var util=require(_0xe51c('0x0'));var _=require('lodash');var squel=require(_0xe51c('0x1'));var Redis=require(_0xe51c('0x2'));var qs=require(_0xe51c('0x3'));var logger=require(_0xe51c('0x4'))(_0xe51c('0x5'));var config=require(_0xe51c('0x6'));var db=require(_0xe51c('0x7'))['db'];config[_0xe51c('0x8')]=_[_0xe51c('0x9')](config[_0xe51c('0x8')],{'host':_0xe51c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x3d442b,_0x10a297){_0x10a297=_0x10a297||0xcc;return function(_0x4f8457){if(_0x4f8457){return _0x3d442b['sendStatus'](_0x10a297);}return _0x3d442b[_0xe51c('0xb')](_0x10a297)[_0xe51c('0xc')]();};}function respondWithResult(_0x5628ba,_0x68eed6){_0x68eed6=_0x68eed6||0xc8;return function(_0x8b8fc5){if(_0x8b8fc5){return _0x5628ba[_0xe51c('0xb')](_0x68eed6)[_0xe51c('0xd')](_0x8b8fc5);}};}function respondWithFilteredResult(_0x4a2432,_0x5ccc85){return function(_0x5371b1){if(_0x5371b1){var _0x4eaf4f=typeof _0x5ccc85['offset']===_0xe51c('0xe')&&typeof _0x5ccc85[_0xe51c('0xf')]===_0xe51c('0xe');var _0x118860=_0x5371b1[_0xe51c('0x10')];var _0x14bd90=_0x4eaf4f?0x0:_0x5ccc85[_0xe51c('0x11')];var _0x26bc10=_0x4eaf4f?_0x5371b1[_0xe51c('0x10')]:_0x5ccc85[_0xe51c('0x11')]+_0x5ccc85[_0xe51c('0xf')];var _0x2f4e7e;if(_0x26bc10>=_0x118860){_0x26bc10=_0x118860;_0x2f4e7e=0xc8;}else{_0x2f4e7e=0xce;}_0x4a2432[_0xe51c('0xb')](_0x2f4e7e);return _0x4a2432[_0xe51c('0x12')](_0xe51c('0x13'),_0x14bd90+'-'+_0x26bc10+'/'+_0x118860)[_0xe51c('0xd')](_0x5371b1);}return null;};}function saveUpdates(_0x33e785){return function(_0x4d6948){if(_0x4d6948){return _0x4d6948[_0xe51c('0x14')](_0x33e785)[_0xe51c('0x15')](function(_0x35c94b){return _0x35c94b;});}return null;};}function removeEntity(_0x2cb938){return function(_0x1879bb){if(_0x1879bb){return _0x1879bb[_0xe51c('0x16')]()[_0xe51c('0x15')](function(){var _0x3213a8=_0x1879bb[_0xe51c('0x17')]({'plain':!![]});var _0x232d3b='MailQueues';return db['UserProfileResource'][_0xe51c('0x16')]({'where':{'type':_0x232d3b,'resourceId':_0x3213a8['id']}})[_0xe51c('0x15')](function(){return _0x1879bb;});})[_0xe51c('0x15')](function(){_0x2cb938['status'](0xcc)[_0xe51c('0xc')]();});}};}function handleEntityNotFound(_0x1df34f){return function(_0x1361db){if(!_0x1361db){_0x1df34f[_0xe51c('0x18')](0x194);}return _0x1361db;};}function handleError(_0x5aaea5,_0x1cda73){_0x1cda73=_0x1cda73||0x1f4;return function(_0xcf4ee){logger['error'](_0xcf4ee[_0xe51c('0x19')]);if(_0xcf4ee[_0xe51c('0x1a')]){delete _0xcf4ee[_0xe51c('0x1a')];}_0x5aaea5[_0xe51c('0xb')](_0x1cda73)[_0xe51c('0x1b')](_0xcf4ee);};}exports[_0xe51c('0x1c')]=function(_0x5884d4,_0x3627a4){var _0x4a747d={};var _0xc00ce3={'count':0x0,'rows':[]};var _0x3dd7fe=_[_0xe51c('0x1d')](db['MailQueue'][_0xe51c('0x1e')],function(_0x209b53){return{'name':_0x209b53[_0xe51c('0x1f')],'type':_0x209b53[_0xe51c('0x20')][_0xe51c('0x21')]};});_0x4a747d=qs[_0xe51c('0x22')](_0x3dd7fe,_0x5884d4);var _0xc1de7e={'where':_0x4a747d[_0xe51c('0x23')]};return db['MailQueue']['count'](_0xc1de7e)['then'](function(_0x188ebc){_0xc00ce3[_0xe51c('0x10')]=_0x188ebc;_0x4a747d['include']=qs[_0xe51c('0x24')](_0x5884d4['query']);return db['MailQueue']['findAll'](_0x4a747d);})[_0xe51c('0x15')](function(_0x46ffb6){_0xc00ce3[_0xe51c('0x25')]=_0x46ffb6;return _0xc00ce3;})[_0xe51c('0x15')](respondWithFilteredResult(_0x3627a4,_0x4a747d))[_0xe51c('0x26')](handleError(_0x3627a4,null));};exports[_0xe51c('0x27')]=function(_0xe0eb16,_0x338c2d){var _0x550569={'raw':!![],'where':{'id':_0xe0eb16[_0xe51c('0x28')]['id']}},_0x249a84={};_0x249a84[_0xe51c('0x29')]=_['keys'](db[_0xe51c('0x2a')]['rawAttributes']);_0x249a84['query']=_[_0xe51c('0x2b')](_0xe0eb16[_0xe51c('0x2c')]);_0x249a84[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x249a84[_0xe51c('0x29')],_0x249a84[_0xe51c('0x2c')]);_0x550569['attributes']=_[_0xe51c('0x2e')](_0x249a84['model'],qs['fields'](_0xe0eb16[_0xe51c('0x2c')][_0xe51c('0x2f')]));_0x550569[_0xe51c('0x30')]=_0x550569[_0xe51c('0x30')][_0xe51c('0x31')]?_0x550569[_0xe51c('0x30')]:_0x249a84['model'];if(_0xe0eb16[_0xe51c('0x2c')][_0xe51c('0x32')]){_0x550569[_0xe51c('0x24')]=[{'all':!![]}];}_0x550569=_[_0xe51c('0x33')]({},_0x550569,_0xe0eb16['options']);return db[_0xe51c('0x2a')]['find'](_0x550569)[_0xe51c('0x15')](handleEntityNotFound(_0x338c2d,null))[_0xe51c('0x15')](respondWithResult(_0x338c2d,null))[_0xe51c('0x26')](handleError(_0x338c2d,null));};exports[_0xe51c('0x34')]=function(_0x5566ac,_0x2d9069){return db[_0xe51c('0x2a')]['create'](_0x5566ac[_0xe51c('0x35')],{})[_0xe51c('0x15')](function(_0x4da005){var _0x5e3bf1=_0x5566ac[_0xe51c('0x36')][_0xe51c('0x17')]({'plain':!![]});if(!_0x5e3bf1)throw new Error(_0xe51c('0x37'));if(_0x5e3bf1[_0xe51c('0x38')]==='user'){var _0x46f25c=_0x4da005[_0xe51c('0x17')]({'plain':!![]});var _0x30f457=_0xe51c('0x39');return db[_0xe51c('0x3a')]['find']({'where':{'name':_0x30f457,'userProfileId':_0x5e3bf1[_0xe51c('0x3b')]},'raw':!![]})['then'](function(_0x5d70d3){if(_0x5d70d3&&_0x5d70d3[_0xe51c('0x3c')]===0x0){return db[_0xe51c('0x3d')][_0xe51c('0x34')]({'name':_0x46f25c[_0xe51c('0x1a')],'resourceId':_0x46f25c['id'],'type':_0x5d70d3[_0xe51c('0x1a')],'sectionId':_0x5d70d3['id']},{})[_0xe51c('0x15')](function(){return _0x4da005;});}else{return _0x4da005;}})[_0xe51c('0x26')](function(_0x3081a6){logger[_0xe51c('0x3e')](_0xe51c('0x3f'),_0x3081a6);throw _0x3081a6;});}return _0x4da005;})[_0xe51c('0x15')](respondWithResult(_0x2d9069,0xc9))['catch'](handleError(_0x2d9069,null));};exports['update']=function(_0x470f22,_0x30ce05){if(_0x470f22[_0xe51c('0x35')]['id']){delete _0x470f22[_0xe51c('0x35')]['id'];}return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x470f22[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x30ce05,null))[_0xe51c('0x15')](saveUpdates(_0x470f22[_0xe51c('0x35')],null))[_0xe51c('0x15')](respondWithResult(_0x30ce05,null))[_0xe51c('0x26')](handleError(_0x30ce05,null));};exports['destroy']=function(_0x1cdf9c,_0x5182b4){return db[_0xe51c('0x2a')]['find']({'where':{'id':_0x1cdf9c[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x5182b4,null))[_0xe51c('0x15')](removeEntity(_0x5182b4,null))[_0xe51c('0x26')](handleError(_0x5182b4,null));};exports[_0xe51c('0x41')]=function(_0x59dad4,_0x430f7b){return db[_0xe51c('0x2a')][_0xe51c('0x41')]()['then'](respondWithResult(_0x430f7b,null))['catch'](handleError(_0x430f7b,null));};exports[_0xe51c('0x42')]=function(_0x3539da,_0x303489){var _0x2dbec4={'raw':!![],'where':{}},_0x185d80={},_0x48cebd;return db[_0xe51c('0x2a')]['findOne']({'where':{'id':_0x3539da[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x303489,null))[_0xe51c('0x15')](function(_0xdc19f0){if(_0xdc19f0){_0x48cebd=_0xdc19f0[_0xe51c('0x17')]({'plain':!![]});_0x185d80['model']=_[_0xe51c('0x2b')](db[_0xe51c('0x43')][_0xe51c('0x1e')]);_0x185d80[_0xe51c('0x2c')]=_[_0xe51c('0x2b')](_0x3539da[_0xe51c('0x2c')]);_0x185d80['filters']=_['intersection'](_0x185d80[_0xe51c('0x29')],_0x185d80['query']);_0x2dbec4['attributes']=_['intersection'](_0x185d80[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x3539da['query'][_0xe51c('0x2f')]));_0x2dbec4[_0xe51c('0x30')]=_0x2dbec4[_0xe51c('0x30')][_0xe51c('0x31')]?_0x2dbec4[_0xe51c('0x30')]:_0x185d80[_0xe51c('0x29')];if(!_0x3539da[_0xe51c('0x2c')]['hasOwnProperty'](_0xe51c('0x44'))){_0x2dbec4[_0xe51c('0xf')]=qs[_0xe51c('0xf')](_0x3539da[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x2dbec4['offset']=qs[_0xe51c('0x11')](_0x3539da['query'][_0xe51c('0x11')]);}_0x2dbec4[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x3539da[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x2dbec4[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_[_0xe51c('0x47')](_0x3539da['query'],_0x185d80[_0xe51c('0x2d')]));_0x2dbec4[_0xe51c('0x23')]['MailQueueId']=_0xdc19f0['id'];if(_0x3539da[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x2dbec4['where']=_['merge'](_0x2dbec4[_0xe51c('0x23')],{'$or':_[_0xe51c('0x1d')](_0x2dbec4['attributes'],function(_0x55fcaf){var _0x2d532f={};_0x2d532f[_0x55fcaf]={'$like':'%'+_0x3539da[_0xe51c('0x2c')][_0xe51c('0x48')]+'%'};return _0x2d532f;})});}_0x2dbec4=_['merge']({},_0x2dbec4,_0x3539da['options']);return db[_0xe51c('0x43')][_0xe51c('0x49')](_0x2dbec4);}})[_0xe51c('0x15')](function(_0x2354f1){if(_0x2354f1){return db[_0xe51c('0x4a')]['findAndCountAll']({'where':{'id':_[_0xe51c('0x1d')](_0x2354f1,_0xe51c('0x4b')),'role':_0xe51c('0x4c')},'attributes':['id',_0xe51c('0x1a'),_0xe51c('0x4d'),_0xe51c('0x4e'),_0xe51c('0x4f')]});}})['then'](function(_0x591ff9){if(_0x591ff9){return{'count':_0x591ff9[_0xe51c('0x10')],'rows':_[_0xe51c('0x1d')](_0x591ff9[_0xe51c('0x25')],function(_0x225c23){return{'membername':_0x225c23[_0xe51c('0x1a')],'UserId':_0x225c23['id'],'queue_name':_0x48cebd[_0xe51c('0x1a')],'MailQueueId':_0x48cebd['id'],'interface':util['format']('%s/%s',_0xe51c('0x50'),_0x225c23['name']),'penalty':0x0,'paused':_0x225c23[_0xe51c('0x4d')],'createdAt':_0x225c23[_0xe51c('0x4f')],'updatedAt':_0x225c23[_0xe51c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe51c('0x15')](respondWithFilteredResult(_0x303489,_0x2dbec4))['catch'](handleError(_0x303489,null));};exports[_0xe51c('0x51')]=function(_0x550636,_0xa1f2d0){var _0x18e041={};var _0x4da0d0={};var _0x1e3811;var _0x2a4d86;return db[_0xe51c('0x2a')][_0xe51c('0x52')]({'where':{'id':_0x550636[_0xe51c('0x28')]['id']}})['then'](handleEntityNotFound(_0xa1f2d0,null))[_0xe51c('0x15')](function(_0x3dde87){if(_0x3dde87){_0x1e3811=_0x3dde87;_0x4da0d0['model']=_[_0xe51c('0x2b')](db[_0xe51c('0x53')][_0xe51c('0x1e')]);_0x4da0d0[_0xe51c('0x2c')]=_['keys'](_0x550636[_0xe51c('0x2c')]);_0x4da0d0[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x4da0d0[_0xe51c('0x29')],_0x4da0d0[_0xe51c('0x2c')]);_0x18e041[_0xe51c('0x30')]=_[_0xe51c('0x2e')](_0x4da0d0[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x550636['query'][_0xe51c('0x2f')]));_0x18e041[_0xe51c('0x30')]=_0x18e041[_0xe51c('0x30')][_0xe51c('0x31')]?_0x18e041[_0xe51c('0x30')]:_0x4da0d0[_0xe51c('0x29')];_0x18e041[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x550636[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x18e041[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_['pick'](_0x550636['query'],_0x4da0d0[_0xe51c('0x2d')]));if(_0x550636[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x18e041[_0xe51c('0x23')]=_[_0xe51c('0x33')](_0x18e041['where'],{'$or':_['map'](_0x18e041[_0xe51c('0x30')],function(_0x59b31f){var _0x28d8f8={};_0x28d8f8[_0x59b31f]={'$like':'%'+_0x550636[_0xe51c('0x2c')]['filter']+'%'};return _0x28d8f8;})});}_0x18e041=_['merge']({},_0x18e041,_0x550636[_0xe51c('0x54')]);return _0x1e3811[_0xe51c('0x51')](_0x18e041);}})['then'](function(_0x55824d){if(_0x55824d){_0x2a4d86=_0x55824d['length'];if(!_0x550636[_0xe51c('0x2c')][_0xe51c('0x55')]('nolimit')){_0x18e041[_0xe51c('0xf')]=qs[_0xe51c('0xf')](_0x550636[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x18e041['offset']=qs['offset'](_0x550636[_0xe51c('0x2c')][_0xe51c('0x11')]);}return _0x1e3811[_0xe51c('0x51')](_0x18e041);}})[_0xe51c('0x15')](function(_0x50e326){if(_0x50e326){return _0x50e326?{'count':_0x2a4d86,'rows':_0x50e326}:null;}})[_0xe51c('0x15')](respondWithResult(_0xa1f2d0,null))['catch'](handleError(_0xa1f2d0,null));};exports['addTeams']=function(_0x57d845,_0x4c6390){var _0x334032=_0x57d845[_0xe51c('0x35')]['ids'];return db[_0xe51c('0x53')][_0xe51c('0x49')]({'where':{'id':_0x334032},'attributes':['id'],'include':[{'model':db[_0xe51c('0x4a')],'as':'Agents','attributes':['id','name',_0xe51c('0x56'),_0xe51c('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x13d540){if(_0x13d540){var _0x4abaf3=_[_0xe51c('0x58')](_0x13d540,function(_0x45dabf){var _0x16e3bc=_0x45dabf[_0xe51c('0x17')]({'plain':!![]});return _0x16e3bc[_0xe51c('0x59')];});return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x57d845[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](function(_0x3b6c04){return db[_0xe51c('0x5a')]['transaction'](function(_0x4d184a){return _0x3b6c04[_0xe51c('0x5b')](_0x334032,{'transaction':_0x4d184a})[_0xe51c('0x15')](function(){return BPromise['each'](_0x4abaf3,function(_0x54ba2a){return db[_0xe51c('0x43')][_0xe51c('0x5c')]({'where':{'UserId':_0x54ba2a['id'],'MailQueueId':_0x57d845['params']['id']},'transaction':_0x4d184a});});})[_0xe51c('0x15')](function(){_0x4abaf3['forEach'](function(_0x1fe9f9){socket[_0xe51c('0x5d')]('userMailQueue:save',{'UserId':_0x1fe9f9['id'],'MailQueueId':_0x3b6c04['id']});});});});});}})['then'](respondWithStatusCode(_0x4c6390,null))['catch'](handleError(_0x4c6390,null));};exports['removeTeams']=function(_0x389360,_0x27f4b3){return db[_0xe51c('0x53')][_0xe51c('0x49')]({'where':{'id':_0x389360['query'][_0xe51c('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xe51c('0x4a')],'as':_0xe51c('0x59'),'attributes':['id'],'raw':!![]}]})[_0xe51c('0x15')](handleEntityNotFound(_0x27f4b3,null))['then'](function(_0x42c333){var _0x4bae6c=_[_0xe51c('0x1d')](_0x42c333,'id');var _0x2a5221=[];var _0x267bf0=[];var _0x248a50=squel['select']();_0x248a50[_0xe51c('0x5f')](_0xe51c('0x60'))[_0xe51c('0x61')](_0xe51c('0x62'),'tq')[_0xe51c('0x63')](_0xe51c('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe51c('0x65'),_0x389360[_0xe51c('0x28')]['id']);for(var _0x25850e=0x0;_0x25850e<_0x42c333[_0xe51c('0x31')];_0x25850e+=0x1){let _0x5074f6=_0x42c333[_0x25850e];for(var _0x57a45a=0x0;_0x57a45a<_0x5074f6[_0xe51c('0x59')][_0xe51c('0x31')];_0x57a45a+=0x1){let _0x518666=_0x5074f6['Agents'][_0x57a45a];var _0x35b460=_0x248a50[_0xe51c('0x66')]();_0x35b460[_0xe51c('0x23')]('ut.UserId\x20=\x20?',_0x518666['id']);_0x267bf0[_0xe51c('0x67')](db[_0xe51c('0x5a')][_0xe51c('0x2c')](_0x35b460[_0xe51c('0x68')](),{'type':db[_0xe51c('0x5a')][_0xe51c('0x69')][_0xe51c('0x6a')]})[_0xe51c('0x15')](function(_0x11af02){if(_0x11af02[_0xe51c('0x31')]===0x1){return _0x518666['id'];}else{var _0x1231dd=_[_0xe51c('0x6b')](_['map'](_0x11af02,'TeamId'),function(_0xd8142){return _['includes'](_0x4bae6c,_0xd8142);});if(_0x1231dd){return _0x518666['id'];}}}));}}return BPromise[_0xe51c('0x6c')](_0x267bf0)[_0xe51c('0x15')](function(_0x12af49){_0x2a5221=_(_0x2a5221)[_0xe51c('0x6d')](_0x12af49)[_0xe51c('0x6e')]()[_0xe51c('0x6f')]();return db[_0xe51c('0x2a')][_0xe51c('0x40')]({'where':{'id':_0x389360[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](function(_0x31bf94){return db[_0xe51c('0x5a')][_0xe51c('0x70')](function(_0x509f7b){return _0x31bf94['removeTeams'](_0x389360[_0xe51c('0x2c')][_0xe51c('0x5e')],{'transaction':_0x509f7b})[_0xe51c('0x15')](function(){if(!_[_0xe51c('0x71')](_0x2a5221)){return _0x31bf94[_0xe51c('0x72')](_0x2a5221,{'transaction':_0x509f7b});}})['then'](function(){_0x2a5221[_0xe51c('0x73')](function(_0x370335){socket[_0xe51c('0x5d')]('userMailQueue:remove',{'UserId':_0x370335,'MailQueueId':_0x31bf94['id']});});});});});});})[_0xe51c('0x15')](respondWithStatusCode(_0x27f4b3,null))['catch'](handleError(_0x27f4b3,null));};exports[_0xe51c('0x74')]=function(_0x538170,_0x312404){return db['MailQueue']['find']({'where':{'id':_0x538170[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x312404,null))[_0xe51c('0x15')](function(_0x4f914b){if(_0x4f914b){return _0x4f914b[_0xe51c('0x74')](_0x538170[_0xe51c('0x35')][_0xe51c('0x5e')],_[_0xe51c('0x75')](_0x538170[_0xe51c('0x35')],['ids','id'])||{})[_0xe51c('0x76')](function(_0x43509b){for(var _0x11bee6=0x0;_0x11bee6<_0x538170['body'][_0xe51c('0x5e')][_0xe51c('0x31')];_0x11bee6+=0x1){socket[_0xe51c('0x5d')](_0xe51c('0x77'),{'UserId':Number(_0x538170[_0xe51c('0x35')][_0xe51c('0x5e')][_0x11bee6]),'MailQueueId':Number(_0x538170[_0xe51c('0x28')]['id'])});}return _0x43509b;});}})['then'](respondWithResult(_0x312404,null))[_0xe51c('0x26')](handleError(_0x312404,null));};exports[_0xe51c('0x72')]=function(_0x5da2bc,_0x6446d4){return db['MailQueue'][_0xe51c('0x40')]({'where':{'id':_0x5da2bc[_0xe51c('0x28')]['id']}})[_0xe51c('0x15')](handleEntityNotFound(_0x6446d4,null))['then'](function(_0x4b7569){if(_0x4b7569){return _0x4b7569[_0xe51c('0x72')](_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')])[_0xe51c('0x15')](function(){if(_[_0xe51c('0x78')](_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')])){for(var _0xbb981e=0x0;_0xbb981e<_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')][_0xe51c('0x31')];_0xbb981e+=0x1){socket['emit'](_0xe51c('0x79'),{'UserId':Number(_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')][_0xbb981e]),'MailQueueId':Number(_0x5da2bc[_0xe51c('0x28')]['id'])});}}else{socket['emit'](_0xe51c('0x79'),{'UserId':Number(_0x5da2bc[_0xe51c('0x2c')][_0xe51c('0x5e')]),'MailQueueId':Number(_0x5da2bc[_0xe51c('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x6446d4,null))['catch'](handleError(_0x6446d4,null));};exports[_0xe51c('0x7a')]=function(_0x23c2e2,_0x590860){var _0x5bf82b={};var _0x1594e2={};var _0x6aa61d;var _0x3a994a;return db['MailQueue'][_0xe51c('0x52')]({'where':{'id':_0x23c2e2[_0xe51c('0x28')]['id']}})['then'](handleEntityNotFound(_0x590860,null))[_0xe51c('0x15')](function(_0x3fdc6c){if(_0x3fdc6c){_0x6aa61d=_0x3fdc6c;_0x1594e2[_0xe51c('0x29')]=_[_0xe51c('0x2b')](db[_0xe51c('0x4a')][_0xe51c('0x1e')]);_0x1594e2[_0xe51c('0x2c')]=_[_0xe51c('0x2b')](_0x23c2e2['query']);_0x1594e2[_0xe51c('0x2d')]=_[_0xe51c('0x2e')](_0x1594e2[_0xe51c('0x29')],_0x1594e2[_0xe51c('0x2c')]);_0x5bf82b[_0xe51c('0x30')]=_[_0xe51c('0x2e')](_0x1594e2[_0xe51c('0x29')],qs[_0xe51c('0x2f')](_0x23c2e2['query'][_0xe51c('0x2f')]));_0x5bf82b['attributes']=_0x5bf82b[_0xe51c('0x30')][_0xe51c('0x31')]?_0x5bf82b[_0xe51c('0x30')]:_0x1594e2[_0xe51c('0x29')];_0x5bf82b[_0xe51c('0x45')]=qs[_0xe51c('0x46')](_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x46')]);_0x5bf82b[_0xe51c('0x23')]=qs[_0xe51c('0x2d')](_[_0xe51c('0x47')](_0x23c2e2[_0xe51c('0x2c')],_0x1594e2[_0xe51c('0x2d')]));if(_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x48')]){_0x5bf82b['where']=_[_0xe51c('0x33')](_0x5bf82b[_0xe51c('0x23')],{'$or':_[_0xe51c('0x1d')](_0x5bf82b[_0xe51c('0x30')],function(_0xf9d363){var _0x42a484={};_0x42a484[_0xf9d363]={'$like':'%'+_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0x48')]+'%'};return _0x42a484;})});}_0x5bf82b=_[_0xe51c('0x33')]({},_0x5bf82b,_0x23c2e2['options']);return _0x6aa61d[_0xe51c('0x7a')](_0x5bf82b);}})[_0xe51c('0x15')](function(_0x1d6166){if(_0x1d6166){_0x3a994a=_0x1d6166['length'];if(!_0x23c2e2[_0xe51c('0x2c')]['hasOwnProperty']('nolimit')){_0x5bf82b['limit']=qs[_0xe51c('0xf')](_0x23c2e2[_0xe51c('0x2c')][_0xe51c('0xf')]);_0x5bf82b[_0xe51c('0x11')]=qs[_0xe51c('0x11')](_0x23c2e2[_0xe51c('0x2c')]['offset']);}return _0x6aa61d[_0xe51c('0x7a')](_0x5bf82b);}})[_0xe51c('0x15')](function(_0x3d9e72){if(_0x3d9e72){return _0x3d9e72?{'count':_0x3a994a,'rows':_0x3d9e72}:null;}})['then'](respondWithResult(_0x590860,null))[_0xe51c('0x26')](handleError(_0x590860,null));}; \ No newline at end of file +var _0x97b0=['UserProfileResource','end','sendStatus','name','send','rawAttributes','fieldName','type','key','getOptions','where','MailQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','get','role','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','map','User','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','status','json','offset','count','limit','set','Content-Range','update','then','destroy'];(function(_0x37c571,_0x260ffc){var _0x1ab1e2=function(_0xdb60db){while(--_0xdb60db){_0x37c571['push'](_0x37c571['shift']());}};_0x1ab1e2(++_0x260ffc);}(_0x97b0,0xe0));var _0x097b=function(_0x36aadf,_0x4a8c25){_0x36aadf=_0x36aadf-0x0;var _0x1b840d=_0x97b0[_0x36aadf];return _0x1b840d;};'use strict';var BPromise=require(_0x097b('0x0'));var util=require('util');var _=require(_0x097b('0x1'));var squel=require(_0x097b('0x2'));var Redis=require(_0x097b('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x097b('0x4'));var config=require(_0x097b('0x5'));var db=require(_0x097b('0x6'))['db'];config[_0x097b('0x7')]=_[_0x097b('0x8')](config[_0x097b('0x7')],{'host':_0x097b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x097b('0x7')]));require(_0x097b('0xa'))[_0x097b('0xb')](socket);function respondWithStatusCode(_0xd00b5e,_0xb031db){_0xb031db=_0xb031db||0xcc;return function(_0x21b915){if(_0x21b915){return _0xd00b5e['sendStatus'](_0xb031db);}return _0xd00b5e[_0x097b('0xc')](_0xb031db)['end']();};}function respondWithResult(_0x230b61,_0x3929b4){_0x3929b4=_0x3929b4||0xc8;return function(_0x25bd35){if(_0x25bd35){return _0x230b61[_0x097b('0xc')](_0x3929b4)[_0x097b('0xd')](_0x25bd35);}};}function respondWithFilteredResult(_0x43083e,_0xc7f33f){return function(_0x24dbd8){if(_0x24dbd8){var _0x21762b=typeof _0xc7f33f[_0x097b('0xe')]==='undefined'&&typeof _0xc7f33f['limit']==='undefined';var _0x443459=_0x24dbd8[_0x097b('0xf')];var _0x1d3f43=_0x21762b?0x0:_0xc7f33f['offset'];var _0x372c29=_0x21762b?_0x24dbd8[_0x097b('0xf')]:_0xc7f33f[_0x097b('0xe')]+_0xc7f33f[_0x097b('0x10')];var _0x311883;if(_0x372c29>=_0x443459){_0x372c29=_0x443459;_0x311883=0xc8;}else{_0x311883=0xce;}_0x43083e[_0x097b('0xc')](_0x311883);return _0x43083e[_0x097b('0x11')](_0x097b('0x12'),_0x1d3f43+'-'+_0x372c29+'/'+_0x443459)[_0x097b('0xd')](_0x24dbd8);}return null;};}function saveUpdates(_0x2cbe29){return function(_0xc44aff){if(_0xc44aff){return _0xc44aff[_0x097b('0x13')](_0x2cbe29)[_0x097b('0x14')](function(_0x16a59e){return _0x16a59e;});}return null;};}function removeEntity(_0x5eb59d){return function(_0x2a180a){if(_0x2a180a){return _0x2a180a[_0x097b('0x15')]()[_0x097b('0x14')](function(){var _0x325a1d=_0x2a180a['get']({'plain':!![]});var _0x5647db='MailQueues';return db[_0x097b('0x16')][_0x097b('0x15')]({'where':{'type':_0x5647db,'resourceId':_0x325a1d['id']}})[_0x097b('0x14')](function(){return _0x2a180a;});})[_0x097b('0x14')](function(){_0x5eb59d[_0x097b('0xc')](0xcc)[_0x097b('0x17')]();});}};}function handleEntityNotFound(_0x44c2df){return function(_0x30818f){if(!_0x30818f){_0x44c2df[_0x097b('0x18')](0x194);}return _0x30818f;};}function handleError(_0x2b1267,_0x2b8388){_0x2b8388=_0x2b8388||0x1f4;return function(_0x1d9d12){logger['error'](_0x1d9d12['stack']);if(_0x1d9d12[_0x097b('0x19')]){delete _0x1d9d12[_0x097b('0x19')];}_0x2b1267[_0x097b('0xc')](_0x2b8388)[_0x097b('0x1a')](_0x1d9d12);};}exports['index']=function(_0x453444,_0x30c4e3){var _0x23aa63={};var _0x52df37={'count':0x0,'rows':[]};var _0x3b50b3=_['map'](db['MailQueue'][_0x097b('0x1b')],function(_0x592ee9){return{'name':_0x592ee9[_0x097b('0x1c')],'type':_0x592ee9[_0x097b('0x1d')][_0x097b('0x1e')]};});_0x23aa63=qs[_0x097b('0x1f')](_0x3b50b3,_0x453444);var _0x21a513={'where':_0x23aa63[_0x097b('0x20')]};return db[_0x097b('0x21')][_0x097b('0xf')](_0x21a513)[_0x097b('0x14')](function(_0x3f3242){_0x52df37[_0x097b('0xf')]=_0x3f3242;_0x23aa63[_0x097b('0x22')]=qs['include'](_0x453444[_0x097b('0x23')]);return db[_0x097b('0x21')][_0x097b('0x24')](_0x23aa63);})[_0x097b('0x14')](function(_0x541354){_0x52df37[_0x097b('0x25')]=_0x541354;return _0x52df37;})[_0x097b('0x14')](respondWithFilteredResult(_0x30c4e3,_0x23aa63))[_0x097b('0x26')](handleError(_0x30c4e3,null));};exports[_0x097b('0x27')]=function(_0x580e6b,_0x1c85fd){var _0x2fda64={'raw':!![],'where':{'id':_0x580e6b[_0x097b('0x28')]['id']}},_0x396f72={};_0x396f72[_0x097b('0x29')]=_[_0x097b('0x2a')](db['MailQueue'][_0x097b('0x1b')]);_0x396f72['query']=_[_0x097b('0x2a')](_0x580e6b['query']);_0x396f72[_0x097b('0x2b')]=_['intersection'](_0x396f72[_0x097b('0x29')],_0x396f72[_0x097b('0x23')]);_0x2fda64[_0x097b('0x2c')]=_[_0x097b('0x2d')](_0x396f72[_0x097b('0x29')],qs[_0x097b('0x2e')](_0x580e6b[_0x097b('0x23')][_0x097b('0x2e')]));_0x2fda64['attributes']=_0x2fda64[_0x097b('0x2c')][_0x097b('0x2f')]?_0x2fda64[_0x097b('0x2c')]:_0x396f72[_0x097b('0x29')];if(_0x580e6b[_0x097b('0x23')][_0x097b('0x30')]){_0x2fda64[_0x097b('0x22')]=[{'all':!![]}];}_0x2fda64=_[_0x097b('0x31')]({},_0x2fda64,_0x580e6b[_0x097b('0x32')]);return db[_0x097b('0x21')][_0x097b('0x33')](_0x2fda64)[_0x097b('0x14')](handleEntityNotFound(_0x1c85fd,null))['then'](respondWithResult(_0x1c85fd,null))[_0x097b('0x26')](handleError(_0x1c85fd,null));};exports[_0x097b('0x34')]=function(_0x567038,_0x32eb5f){return db[_0x097b('0x21')][_0x097b('0x34')](_0x567038['body'],{})['then'](function(_0x456698){var _0x270b50=_0x567038['user'][_0x097b('0x35')]({'plain':!![]});if(!_0x270b50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x270b50[_0x097b('0x36')]===_0x097b('0x37')){var _0x3c5c7b=_0x456698[_0x097b('0x35')]({'plain':!![]});var _0x245d69=_0x097b('0x38');return db[_0x097b('0x39')][_0x097b('0x33')]({'where':{'name':_0x245d69,'userProfileId':_0x270b50[_0x097b('0x3a')]},'raw':!![]})['then'](function(_0x4b0461){if(_0x4b0461&&_0x4b0461[_0x097b('0x3b')]===0x0){return db[_0x097b('0x16')][_0x097b('0x34')]({'name':_0x3c5c7b[_0x097b('0x19')],'resourceId':_0x3c5c7b['id'],'type':_0x4b0461[_0x097b('0x19')],'sectionId':_0x4b0461['id']},{})[_0x097b('0x14')](function(){return _0x456698;});}else{return _0x456698;}})[_0x097b('0x26')](function(_0x451785){logger['error'](_0x097b('0x3c'),_0x451785);throw _0x451785;});}return _0x456698;})[_0x097b('0x14')](respondWithResult(_0x32eb5f,0xc9))[_0x097b('0x26')](handleError(_0x32eb5f,null));};exports[_0x097b('0x13')]=function(_0x1df9ac,_0x5908a0){if(_0x1df9ac[_0x097b('0x3d')]['id']){delete _0x1df9ac[_0x097b('0x3d')]['id'];}return db[_0x097b('0x21')][_0x097b('0x33')]({'where':{'id':_0x1df9ac['params']['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x5908a0,null))[_0x097b('0x14')](saveUpdates(_0x1df9ac['body'],null))[_0x097b('0x14')](respondWithResult(_0x5908a0,null))['catch'](handleError(_0x5908a0,null));};exports[_0x097b('0x15')]=function(_0x102b14,_0x1ff6e3){return db[_0x097b('0x21')][_0x097b('0x33')]({'where':{'id':_0x102b14[_0x097b('0x28')]['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x1ff6e3,null))[_0x097b('0x14')](removeEntity(_0x1ff6e3,null))['catch'](handleError(_0x1ff6e3,null));};exports[_0x097b('0x3e')]=function(_0x457278,_0x58118f){return db[_0x097b('0x21')][_0x097b('0x3e')]()[_0x097b('0x14')](respondWithResult(_0x58118f,null))[_0x097b('0x26')](handleError(_0x58118f,null));};exports[_0x097b('0x3f')]=function(_0x3196ae,_0x3f0331){var _0x12700d={'raw':!![],'where':{}},_0x59dd76={},_0x5bbe98;return db[_0x097b('0x21')][_0x097b('0x40')]({'where':{'id':_0x3196ae[_0x097b('0x28')]['id']}})['then'](handleEntityNotFound(_0x3f0331,null))[_0x097b('0x14')](function(_0x1a73ad){if(_0x1a73ad){_0x5bbe98=_0x1a73ad[_0x097b('0x35')]({'plain':!![]});_0x59dd76['model']=_[_0x097b('0x2a')](db['UserMailQueue'][_0x097b('0x1b')]);_0x59dd76['query']=_[_0x097b('0x2a')](_0x3196ae['query']);_0x59dd76[_0x097b('0x2b')]=_['intersection'](_0x59dd76[_0x097b('0x29')],_0x59dd76[_0x097b('0x23')]);_0x12700d[_0x097b('0x2c')]=_[_0x097b('0x2d')](_0x59dd76['model'],qs[_0x097b('0x2e')](_0x3196ae['query'][_0x097b('0x2e')]));_0x12700d['attributes']=_0x12700d['attributes']['length']?_0x12700d[_0x097b('0x2c')]:_0x59dd76[_0x097b('0x29')];if(!_0x3196ae[_0x097b('0x23')][_0x097b('0x41')](_0x097b('0x42'))){_0x12700d[_0x097b('0x10')]=qs[_0x097b('0x10')](_0x3196ae['query'][_0x097b('0x10')]);_0x12700d[_0x097b('0xe')]=qs['offset'](_0x3196ae['query'][_0x097b('0xe')]);}_0x12700d[_0x097b('0x43')]=qs[_0x097b('0x44')](_0x3196ae[_0x097b('0x23')][_0x097b('0x44')]);_0x12700d[_0x097b('0x20')]=qs['filters'](_[_0x097b('0x45')](_0x3196ae['query'],_0x59dd76[_0x097b('0x2b')]));_0x12700d[_0x097b('0x20')][_0x097b('0x46')]=_0x1a73ad['id'];if(_0x3196ae['query'][_0x097b('0x47')]){_0x12700d[_0x097b('0x20')]=_[_0x097b('0x31')](_0x12700d[_0x097b('0x20')],{'$or':_[_0x097b('0x48')](_0x12700d[_0x097b('0x2c')],function(_0x177648){var _0x3660a9={};_0x3660a9[_0x177648]={'$like':'%'+_0x3196ae[_0x097b('0x23')][_0x097b('0x47')]+'%'};return _0x3660a9;})});}_0x12700d=_[_0x097b('0x31')]({},_0x12700d,_0x3196ae['options']);return db['UserMailQueue'][_0x097b('0x24')](_0x12700d);}})[_0x097b('0x14')](function(_0xe07618){if(_0xe07618){return db[_0x097b('0x49')]['findAndCountAll']({'where':{'id':_['map'](_0xe07618,_0x097b('0x4a')),'role':_0x097b('0x4b')},'attributes':['id',_0x097b('0x19'),_0x097b('0x4c'),_0x097b('0x4d'),'createdAt']});}})[_0x097b('0x14')](function(_0x188cef){if(_0x188cef){return{'count':_0x188cef['count'],'rows':_[_0x097b('0x48')](_0x188cef[_0x097b('0x25')],function(_0x15e3a3){return{'membername':_0x15e3a3[_0x097b('0x19')],'UserId':_0x15e3a3['id'],'queue_name':_0x5bbe98['name'],'MailQueueId':_0x5bbe98['id'],'interface':util[_0x097b('0x4e')](_0x097b('0x4f'),_0x097b('0x50'),_0x15e3a3[_0x097b('0x19')]),'penalty':0x0,'paused':_0x15e3a3[_0x097b('0x4c')],'createdAt':_0x15e3a3[_0x097b('0x51')],'updatedAt':_0x15e3a3[_0x097b('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x097b('0x14')](respondWithFilteredResult(_0x3f0331,_0x12700d))[_0x097b('0x26')](handleError(_0x3f0331,null));};exports[_0x097b('0x52')]=function(_0x20bc19,_0x59a834){var _0x2bac09={};var _0x1f91a0={};var _0x116c94;var _0x6aba85;return db[_0x097b('0x21')][_0x097b('0x40')]({'where':{'id':_0x20bc19['params']['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x59a834,null))[_0x097b('0x14')](function(_0x37257f){if(_0x37257f){_0x116c94=_0x37257f;_0x1f91a0[_0x097b('0x29')]=_['keys'](db[_0x097b('0x53')]['rawAttributes']);_0x1f91a0[_0x097b('0x23')]=_['keys'](_0x20bc19[_0x097b('0x23')]);_0x1f91a0[_0x097b('0x2b')]=_['intersection'](_0x1f91a0['model'],_0x1f91a0[_0x097b('0x23')]);_0x2bac09['attributes']=_[_0x097b('0x2d')](_0x1f91a0[_0x097b('0x29')],qs[_0x097b('0x2e')](_0x20bc19[_0x097b('0x23')][_0x097b('0x2e')]));_0x2bac09[_0x097b('0x2c')]=_0x2bac09[_0x097b('0x2c')][_0x097b('0x2f')]?_0x2bac09[_0x097b('0x2c')]:_0x1f91a0[_0x097b('0x29')];_0x2bac09[_0x097b('0x43')]=qs['sort'](_0x20bc19['query'][_0x097b('0x44')]);_0x2bac09[_0x097b('0x20')]=qs[_0x097b('0x2b')](_[_0x097b('0x45')](_0x20bc19[_0x097b('0x23')],_0x1f91a0['filters']));if(_0x20bc19['query'][_0x097b('0x47')]){_0x2bac09['where']=_[_0x097b('0x31')](_0x2bac09[_0x097b('0x20')],{'$or':_[_0x097b('0x48')](_0x2bac09[_0x097b('0x2c')],function(_0x48b91c){var _0x1f6a3e={};_0x1f6a3e[_0x48b91c]={'$like':'%'+_0x20bc19[_0x097b('0x23')][_0x097b('0x47')]+'%'};return _0x1f6a3e;})});}_0x2bac09=_[_0x097b('0x31')]({},_0x2bac09,_0x20bc19[_0x097b('0x32')]);return _0x116c94[_0x097b('0x52')](_0x2bac09);}})[_0x097b('0x14')](function(_0xb53da5){if(_0xb53da5){_0x6aba85=_0xb53da5[_0x097b('0x2f')];if(!_0x20bc19['query']['hasOwnProperty']('nolimit')){_0x2bac09[_0x097b('0x10')]=qs[_0x097b('0x10')](_0x20bc19[_0x097b('0x23')][_0x097b('0x10')]);_0x2bac09[_0x097b('0xe')]=qs[_0x097b('0xe')](_0x20bc19[_0x097b('0x23')]['offset']);}return _0x116c94[_0x097b('0x52')](_0x2bac09);}})[_0x097b('0x14')](function(_0xff5234){if(_0xff5234){return _0xff5234?{'count':_0x6aba85,'rows':_0xff5234}:null;}})[_0x097b('0x14')](respondWithResult(_0x59a834,null))[_0x097b('0x26')](handleError(_0x59a834,null));};exports[_0x097b('0x54')]=function(_0x5d422f,_0x5528a5){var _0x1b2e75=_0x5d422f[_0x097b('0x3d')]['ids'];return db[_0x097b('0x53')][_0x097b('0x24')]({'where':{'id':_0x1b2e75},'attributes':['id'],'include':[{'model':db[_0x097b('0x49')],'as':_0x097b('0x55'),'attributes':['id','name',_0x097b('0x56'),_0x097b('0x57'),_0x097b('0x58')],'raw':!![]}]})['then'](function(_0x116afb){if(_0x116afb){var _0x4b5a58=_[_0x097b('0x59')](_0x116afb,function(_0x4590da){var _0x1c8334=_0x4590da[_0x097b('0x35')]({'plain':!![]});return _0x1c8334['Agents'];});return db[_0x097b('0x21')][_0x097b('0x33')]({'where':{'id':_0x5d422f[_0x097b('0x28')]['id']}})[_0x097b('0x14')](function(_0x4a76b4){return db[_0x097b('0x5a')][_0x097b('0x5b')](function(_0x5e2295){return _0x4a76b4['addTeams'](_0x1b2e75,{'transaction':_0x5e2295})[_0x097b('0x14')](function(){return BPromise[_0x097b('0x5c')](_0x4b5a58,function(_0x5d86cd){return db['UserMailQueue'][_0x097b('0x5d')]({'where':{'UserId':_0x5d86cd['id'],'MailQueueId':_0x5d422f[_0x097b('0x28')]['id']},'transaction':_0x5e2295});});})['then'](function(){_0x4b5a58[_0x097b('0x5e')](function(_0x5ebbf8){socket['emit'](_0x097b('0x5f'),{'UserId':_0x5ebbf8['id'],'MailQueueId':_0x4a76b4['id']});});});});});}})['then'](respondWithStatusCode(_0x5528a5,null))[_0x097b('0x26')](handleError(_0x5528a5,null));};exports[_0x097b('0x60')]=function(_0x2d6595,_0x88f73){return db[_0x097b('0x53')][_0x097b('0x24')]({'where':{'id':_0x2d6595[_0x097b('0x23')][_0x097b('0x61')]},'attributes':['id'],'include':[{'model':db[_0x097b('0x49')],'as':_0x097b('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x88f73,null))[_0x097b('0x14')](function(_0x6ab66){var _0x1c687f=_[_0x097b('0x48')](_0x6ab66,'id');var _0x332ace=[];var _0x1ae98e=[];var _0x53acfb=squel[_0x097b('0x62')]();_0x53acfb[_0x097b('0x63')](_0x097b('0x64'))[_0x097b('0x65')](_0x097b('0x66'),'tq')['join'](_0x097b('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x097b('0x20')](_0x097b('0x68'),_0x2d6595['params']['id']);for(var _0x3ca0a4=0x0;_0x3ca0a4<_0x6ab66[_0x097b('0x2f')];_0x3ca0a4+=0x1){let _0x5766f3=_0x6ab66[_0x3ca0a4];for(var _0x79afc4=0x0;_0x79afc4<_0x5766f3['Agents']['length'];_0x79afc4+=0x1){let _0x9523f4=_0x5766f3[_0x097b('0x55')][_0x79afc4];var _0x2d326c=_0x53acfb[_0x097b('0x69')]();_0x2d326c[_0x097b('0x20')](_0x097b('0x6a'),_0x9523f4['id']);_0x1ae98e[_0x097b('0x6b')](db['sequelize'][_0x097b('0x23')](_0x2d326c[_0x097b('0x6c')](),{'type':db[_0x097b('0x5a')]['QueryTypes'][_0x097b('0x6d')]})[_0x097b('0x14')](function(_0x18ba6e){if(_0x18ba6e[_0x097b('0x2f')]===0x1){return _0x9523f4['id'];}else{var _0x5b8c5c=_[_0x097b('0x6e')](_[_0x097b('0x48')](_0x18ba6e,'TeamId'),function(_0x158284){return _[_0x097b('0x6f')](_0x1c687f,_0x158284);});if(_0x5b8c5c){return _0x9523f4['id'];}}}));}}return BPromise['all'](_0x1ae98e)[_0x097b('0x14')](function(_0x585225){_0x332ace=_(_0x332ace)[_0x097b('0x70')](_0x585225)[_0x097b('0x71')]()[_0x097b('0x72')]();return db[_0x097b('0x21')][_0x097b('0x33')]({'where':{'id':_0x2d6595[_0x097b('0x28')]['id']}})['then'](function(_0x140616){return db['sequelize'][_0x097b('0x5b')](function(_0x1caa65){return _0x140616['removeTeams'](_0x2d6595[_0x097b('0x23')][_0x097b('0x61')],{'transaction':_0x1caa65})['then'](function(){if(!_[_0x097b('0x73')](_0x332ace)){return _0x140616[_0x097b('0x74')](_0x332ace,{'transaction':_0x1caa65});}})[_0x097b('0x14')](function(){_0x332ace['forEach'](function(_0x5cf83e){socket[_0x097b('0x75')](_0x097b('0x76'),{'UserId':_0x5cf83e,'MailQueueId':_0x140616['id']});});});});});});})[_0x097b('0x14')](respondWithStatusCode(_0x88f73,null))[_0x097b('0x26')](handleError(_0x88f73,null));};exports[_0x097b('0x77')]=function(_0x584cda,_0x317a77){return db['MailQueue'][_0x097b('0x33')]({'where':{'id':_0x584cda[_0x097b('0x28')]['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x317a77,null))[_0x097b('0x14')](function(_0xc9afed){if(_0xc9afed){return _0xc9afed[_0x097b('0x77')](_0x584cda['body'][_0x097b('0x61')],_[_0x097b('0x78')](_0x584cda[_0x097b('0x3d')],[_0x097b('0x61'),'id'])||{})[_0x097b('0x79')](function(_0x2cfa5c){for(var _0x3c3142=0x0;_0x3c3142<_0x584cda['body'][_0x097b('0x61')][_0x097b('0x2f')];_0x3c3142+=0x1){socket['emit'](_0x097b('0x5f'),{'UserId':Number(_0x584cda[_0x097b('0x3d')][_0x097b('0x61')][_0x3c3142]),'MailQueueId':Number(_0x584cda[_0x097b('0x28')]['id'])});}return _0x2cfa5c;});}})['then'](respondWithResult(_0x317a77,null))[_0x097b('0x26')](handleError(_0x317a77,null));};exports[_0x097b('0x74')]=function(_0x12320b,_0x5339a8){return db[_0x097b('0x21')]['find']({'where':{'id':_0x12320b[_0x097b('0x28')]['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x5339a8,null))[_0x097b('0x14')](function(_0x29fdef){if(_0x29fdef){return _0x29fdef[_0x097b('0x74')](_0x12320b[_0x097b('0x23')][_0x097b('0x61')])[_0x097b('0x14')](function(){if(_['isArray'](_0x12320b[_0x097b('0x23')]['ids'])){for(var _0x19be9e=0x0;_0x19be9e<_0x12320b[_0x097b('0x23')][_0x097b('0x61')][_0x097b('0x2f')];_0x19be9e+=0x1){socket[_0x097b('0x75')](_0x097b('0x76'),{'UserId':Number(_0x12320b[_0x097b('0x23')][_0x097b('0x61')][_0x19be9e]),'MailQueueId':Number(_0x12320b[_0x097b('0x28')]['id'])});}}else{socket[_0x097b('0x75')](_0x097b('0x76'),{'UserId':Number(_0x12320b[_0x097b('0x23')][_0x097b('0x61')]),'MailQueueId':Number(_0x12320b[_0x097b('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x5339a8,null))['catch'](handleError(_0x5339a8,null));};exports[_0x097b('0x7a')]=function(_0x48b121,_0x4c3142){var _0x199b7b={};var _0x2a8486={};var _0x51e596;var _0x461dde;return db[_0x097b('0x21')][_0x097b('0x40')]({'where':{'id':_0x48b121[_0x097b('0x28')]['id']}})[_0x097b('0x14')](handleEntityNotFound(_0x4c3142,null))[_0x097b('0x14')](function(_0x598ca6){if(_0x598ca6){_0x51e596=_0x598ca6;_0x2a8486['model']=_['keys'](db[_0x097b('0x49')][_0x097b('0x1b')]);_0x2a8486[_0x097b('0x23')]=_[_0x097b('0x2a')](_0x48b121[_0x097b('0x23')]);_0x2a8486[_0x097b('0x2b')]=_['intersection'](_0x2a8486['model'],_0x2a8486[_0x097b('0x23')]);_0x199b7b['attributes']=_['intersection'](_0x2a8486['model'],qs[_0x097b('0x2e')](_0x48b121['query'][_0x097b('0x2e')]));_0x199b7b['attributes']=_0x199b7b[_0x097b('0x2c')][_0x097b('0x2f')]?_0x199b7b['attributes']:_0x2a8486[_0x097b('0x29')];_0x199b7b[_0x097b('0x43')]=qs['sort'](_0x48b121['query']['sort']);_0x199b7b[_0x097b('0x20')]=qs['filters'](_[_0x097b('0x45')](_0x48b121['query'],_0x2a8486[_0x097b('0x2b')]));if(_0x48b121['query'][_0x097b('0x47')]){_0x199b7b['where']=_['merge'](_0x199b7b['where'],{'$or':_[_0x097b('0x48')](_0x199b7b['attributes'],function(_0x5d6215){var _0xe41d8c={};_0xe41d8c[_0x5d6215]={'$like':'%'+_0x48b121['query'][_0x097b('0x47')]+'%'};return _0xe41d8c;})});}_0x199b7b=_['merge']({},_0x199b7b,_0x48b121[_0x097b('0x32')]);return _0x51e596[_0x097b('0x7a')](_0x199b7b);}})['then'](function(_0x36e81c){if(_0x36e81c){_0x461dde=_0x36e81c[_0x097b('0x2f')];if(!_0x48b121['query'][_0x097b('0x41')]('nolimit')){_0x199b7b[_0x097b('0x10')]=qs['limit'](_0x48b121[_0x097b('0x23')][_0x097b('0x10')]);_0x199b7b[_0x097b('0xe')]=qs[_0x097b('0xe')](_0x48b121[_0x097b('0x23')][_0x097b('0xe')]);}return _0x51e596['getAgents'](_0x199b7b);}})[_0x097b('0x14')](function(_0x5b0858){if(_0x5b0858){return _0x5b0858?{'count':_0x461dde,'rows':_0x5b0858}:null;}})[_0x097b('0x14')](respondWithResult(_0x4c3142,null))[_0x097b('0x26')](handleError(_0x4c3142,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3f67298..f1f4ec6 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 _0x0f5e=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x36e900,_0x4b0279){var _0xeccc59=function(_0x198867){while(--_0x198867){_0x36e900['push'](_0x36e900['shift']());}};_0xeccc59(++_0x4b0279);}(_0x0f5e,0x177));var _0xe0f5=function(_0x14bbb2,_0x332f86){_0x14bbb2=_0x14bbb2-0x0;var _0x2026ca=_0x0f5e[_0x14bbb2];return _0x2026ca;};'use strict';var EventEmitter=require(_0xe0f5('0x0'));var MailQueue=require(_0xe0f5('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0f5('0x2'),'afterUpdate':_0xe0f5('0x3'),'afterDestroy':_0xe0f5('0x4')};function emitEvent(_0xb02936){return function(_0x1fc531,_0x1ba229,_0x57459b){MailQueueEvents[_0xe0f5('0x5')](_0xb02936+':'+_0x1fc531['id'],_0x1fc531);MailQueueEvents[_0xe0f5('0x5')](_0xb02936,_0x1fc531);_0x57459b(null);};}for(var e in events){if(events[_0xe0f5('0x6')](e)){var event=events[e];MailQueue[_0xe0f5('0x7')](e,emitEvent(event));}}module[_0xe0f5('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x7109=['emit','hasOwnProperty','exports','events','MailQueue','setMaxListeners','update','remove'];(function(_0x5e20b2,_0x436473){var _0x3d0579=function(_0x1fce6e){while(--_0x1fce6e){_0x5e20b2['push'](_0x5e20b2['shift']());}};_0x3d0579(++_0x436473);}(_0x7109,0x113));var _0x9710=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x7109[_0x146a85];return _0x1b59bf;};'use strict';var EventEmitter=require(_0x9710('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x9710('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9710('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9710('0x3'),'afterDestroy':_0x9710('0x4')};function emitEvent(_0x3f4985){return function(_0x487afe,_0x5b95b5,_0x5d80f7){MailQueueEvents[_0x9710('0x5')](_0x3f4985+':'+_0x487afe['id'],_0x487afe);MailQueueEvents['emit'](_0x3f4985,_0x487afe);_0x5d80f7(null);};}for(var e in events){if(events[_0x9710('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x9710('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 f8e96e3..b1752ed 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 _0x4f80=['request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','lodash','util','api','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4f80,0xb7));var _0x04f8=function(_0x1e441f,_0x51dcad){_0x1e441f=_0x1e441f-0x0;var _0x5dc8d4=_0x4f80[_0x1e441f];return _0x5dc8d4;};'use strict';var _=require(_0x04f8('0x0'));var util=require(_0x04f8('0x1'));var logger=require('../../config/logger')(_0x04f8('0x2'));var moment=require('moment');var BPromise=require(_0x04f8('0x3'));var rp=require(_0x04f8('0x4'));var fs=require('fs');var path=require(_0x04f8('0x5'));var rimraf=require(_0x04f8('0x6'));var config=require('../../config/environment');var attributes=require(_0x04f8('0x7'));module[_0x04f8('0x8')]=function(_0x1a1645,_0x526127){return _0x1a1645[_0x04f8('0x9')](_0x04f8('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf075=['rimraf','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19c694,_0x811d91){var _0x5db81a=function(_0x177715){while(--_0x177715){_0x19c694['push'](_0x19c694['shift']());}};_0x5db81a(++_0x811d91);}(_0xf075,0x122));var _0x5f07=function(_0x6d2b8a,_0x1ad4e7){_0x6d2b8a=_0x6d2b8a-0x0;var _0x1d6c1d=_0xf075[_0x6d2b8a];return _0x1d6c1d;};'use strict';var _=require(_0x5f07('0x0'));var util=require(_0x5f07('0x1'));var logger=require(_0x5f07('0x2'))('api');var moment=require(_0x5f07('0x3'));var BPromise=require(_0x5f07('0x4'));var rp=require(_0x5f07('0x5'));var fs=require('fs');var path=require(_0x5f07('0x6'));var rimraf=require(_0x5f07('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x2ca3b8,_0x430ffc){return _0x2ca3b8[_0x5f07('0x8')](_0x5f07('0x9'),attributes,{'tableName':_0x5f07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 88047ea..623065c 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 _0x9e1d=['MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','result','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info'];(function(_0x4b0b34,_0x2e2f7c){var _0x574dc5=function(_0x253a7a){while(--_0x253a7a){_0x4b0b34['push'](_0x4b0b34['shift']());}};_0x574dc5(++_0x2e2f7c);}(_0x9e1d,0x12e));var _0xd9e1=function(_0x7087c3,_0xafa184){_0x7087c3=_0x7087c3-0x0;var _0x2b70db=_0x9e1d[_0x7087c3];return _0x2b70db;};'use strict';var _=require(_0xd9e1('0x0'));var util=require(_0xd9e1('0x1'));var moment=require(_0xd9e1('0x2'));var BPromise=require(_0xd9e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e1('0x4'));var db=require(_0xd9e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9e1('0x6'))(_0xd9e1('0x7'));var config=require(_0xd9e1('0x8'));var jayson=require(_0xd9e1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd9e1('0xa')]=_['defaults'](config[_0xd9e1('0xa')],{'host':_0xd9e1('0xb'),'port':0x18eb});var socket=require(_0xd9e1('0xc'))(new Redis(config['redis']));require(_0xd9e1('0xd'))[_0xd9e1('0xe')](socket);function respondWithRpcPromise(_0x3233aa,_0x436ed9,_0x109505){return new BPromise(function(_0x26f14b,_0x478f19){return client[_0xd9e1('0xf')](_0x3233aa,_0x109505)[_0xd9e1('0x10')](function(_0x58834e){logger[_0xd9e1('0x11')](_0xd9e1('0x12'),_0x436ed9,'request\x20sent');logger[_0xd9e1('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x436ed9,_0xd9e1('0x14'),JSON[_0xd9e1('0x15')](_0x58834e));if(_0x58834e[_0xd9e1('0x16')]){if(_0x58834e[_0xd9e1('0x16')][_0xd9e1('0x17')]===0x1f4){logger[_0xd9e1('0x16')]('MailQueue,\x20%s,\x20%s',_0x436ed9,_0x58834e['error']['message']);return _0x478f19(_0x58834e[_0xd9e1('0x16')]['message']);}logger[_0xd9e1('0x16')]('MailQueue,\x20%s,\x20%s',_0x436ed9,_0x58834e[_0xd9e1('0x16')]['message']);return _0x26f14b(_0x58834e[_0xd9e1('0x16')]['message']);}else{logger[_0xd9e1('0x11')](_0xd9e1('0x12'),_0x436ed9,_0xd9e1('0x14'));_0x26f14b(_0x58834e[_0xd9e1('0x18')][_0xd9e1('0x19')]);}})[_0xd9e1('0x1a')](function(_0x220297){logger['error'](_0xd9e1('0x12'),_0x436ed9,_0x220297);_0x478f19(_0x220297);});});}exports[_0xd9e1('0x1b')]=function(_0x58befc){var _0x1956b6=this;return new Promise(function(_0x4c0cd3,_0x5da2c7){return db[_0xd9e1('0x1c')][_0xd9e1('0x1d')]({'raw':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x20')]||null:null,'attributes':_0x58befc[_0xd9e1('0x1e')]?_0x58befc[_0xd9e1('0x1e')]['attributes']||null:null,'limit':_0x58befc[_0xd9e1('0x1e')]?_0x58befc['options'][_0xd9e1('0x21')]||null:null,'include':_0x58befc['options']?_0x58befc[_0xd9e1('0x1e')][_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0x58befc[_0xd9e1('0x1e')]['include'],function(_0x25807b){return{'model':db[_0x25807b['model']],'as':_0x25807b['as'],'attributes':_0x25807b[_0xd9e1('0x24')],'include':_0x25807b[_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0x25807b[_0xd9e1('0x22')],function(_0x58210a){return{'model':db[_0x58210a[_0xd9e1('0x25')]],'as':_0x58210a['as'],'attributes':_0x58210a[_0xd9e1('0x24')],'include':_0x58210a['include']?_['map'](_0x58210a[_0xd9e1('0x22')],function(_0x3cd58a){return{'model':db[_0x3cd58a[_0xd9e1('0x25')]],'as':_0x3cd58a['as'],'attributes':_0x3cd58a[_0xd9e1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28b2c6){logger[_0xd9e1('0x11')](_0xd9e1('0x1b'),_0x58befc);logger[_0xd9e1('0x13')]('GetMailQueue',_0x58befc,JSON['stringify'](_0x28b2c6));_0x4c0cd3(_0x28b2c6);})[_0xd9e1('0x1a')](function(_0x52a315){logger[_0xd9e1('0x16')]('GetMailQueue',_0x52a315[_0xd9e1('0x19')],_0x58befc);_0x5da2c7(_0x1956b6[_0xd9e1('0x16')](0x1f4,_0x52a315['message']));});});};exports[_0xd9e1('0x26')]=function(_0x29696d){var _0x5b00d2=this;return new Promise(function(_0x2345b6,_0x200273){return db[_0xd9e1('0x1c')][_0xd9e1('0x27')]({'raw':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')][_0xd9e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')]['where']||null:null,'attributes':_0x29696d[_0xd9e1('0x1e')]?_0x29696d[_0xd9e1('0x1e')][_0xd9e1('0x24')]||null:null,'include':_0x29696d[_0xd9e1('0x1e')]?_0x29696d['options'][_0xd9e1('0x22')]?_['map'](_0x29696d['options'][_0xd9e1('0x22')],function(_0xed9009){return{'model':db[_0xed9009[_0xd9e1('0x25')]],'as':_0xed9009['as'],'attributes':_0xed9009[_0xd9e1('0x24')],'include':_0xed9009[_0xd9e1('0x22')]?_[_0xd9e1('0x23')](_0xed9009[_0xd9e1('0x22')],function(_0x33c656){return{'model':db[_0x33c656[_0xd9e1('0x25')]],'as':_0x33c656['as'],'attributes':_0x33c656['attributes'],'include':_0x33c656[_0xd9e1('0x22')]?_['map'](_0x33c656['include'],function(_0x53b988){return{'model':db[_0x53b988[_0xd9e1('0x25')]],'as':_0x53b988['as'],'attributes':_0x53b988[_0xd9e1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43a00f){logger[_0xd9e1('0x11')](_0xd9e1('0x26'),_0x29696d);logger['debug'](_0xd9e1('0x26'),_0x29696d,JSON[_0xd9e1('0x15')](_0x43a00f));_0x2345b6(_0x43a00f);})[_0xd9e1('0x1a')](function(_0x5bfb61){logger[_0xd9e1('0x16')]('ShowMailQueue',_0x5bfb61[_0xd9e1('0x19')],_0x29696d);_0x200273(_0x5b00d2[_0xd9e1('0x16')](0x1f4,_0x5bfb61[_0xd9e1('0x19')]));});});}; \ No newline at end of file +var _0xe492=['include','map','model','attributes','then','GetMailQueue','stringify','catch','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailQueue','findAll','options','raw','limit'];(function(_0x482fe3,_0x35350e){var _0x222b39=function(_0x1b3222){while(--_0x1b3222){_0x482fe3['push'](_0x482fe3['shift']());}};_0x222b39(++_0x35350e);}(_0xe492,0x169));var _0x2e49=function(_0x3495ec,_0x57ff2d){_0x3495ec=_0x3495ec-0x0;var _0x178430=_0xe492[_0x3495ec];return _0x178430;};'use strict';var _=require(_0x2e49('0x0'));var util=require(_0x2e49('0x1'));var moment=require(_0x2e49('0x2'));var BPromise=require(_0x2e49('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e49('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e49('0x5'));var logger=require(_0x2e49('0x6'))(_0x2e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x2e49('0x8'));var client=jayson[_0x2e49('0x9')][_0x2e49('0xa')]({'port':0x232a});config[_0x2e49('0xb')]=_['defaults'](config[_0x2e49('0xb')],{'host':_0x2e49('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2e49('0xd'))[_0x2e49('0xe')](socket);function respondWithRpcPromise(_0x532a9b,_0x436e45,_0x92a85b){return new BPromise(function(_0x4e070d,_0x2e743f){return client['request'](_0x532a9b,_0x92a85b)['then'](function(_0x4bb56d){logger[_0x2e49('0xf')](_0x2e49('0x10'),_0x436e45,'request\x20sent');logger[_0x2e49('0x11')](_0x2e49('0x12'),_0x436e45,_0x2e49('0x13'),JSON['stringify'](_0x4bb56d));if(_0x4bb56d[_0x2e49('0x14')]){if(_0x4bb56d[_0x2e49('0x14')][_0x2e49('0x15')]===0x1f4){logger[_0x2e49('0x14')](_0x2e49('0x10'),_0x436e45,_0x4bb56d['error'][_0x2e49('0x16')]);return _0x2e743f(_0x4bb56d[_0x2e49('0x14')][_0x2e49('0x16')]);}logger[_0x2e49('0x14')](_0x2e49('0x10'),_0x436e45,_0x4bb56d[_0x2e49('0x14')]['message']);return _0x4e070d(_0x4bb56d[_0x2e49('0x14')]['message']);}else{logger[_0x2e49('0xf')](_0x2e49('0x10'),_0x436e45,_0x2e49('0x13'));_0x4e070d(_0x4bb56d[_0x2e49('0x17')][_0x2e49('0x16')]);}})['catch'](function(_0x5e6729){logger[_0x2e49('0x14')](_0x2e49('0x10'),_0x436e45,_0x5e6729);_0x2e743f(_0x5e6729);});});}exports['GetMailQueue']=function(_0x2c126c){var _0x41dfda=this;return new Promise(function(_0x4cb407,_0xd21fa9){return db[_0x2e49('0x18')][_0x2e49('0x19')]({'raw':_0x2c126c[_0x2e49('0x1a')]?_0x2c126c[_0x2e49('0x1a')][_0x2e49('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c126c[_0x2e49('0x1a')]?_0x2c126c[_0x2e49('0x1a')]['where']||null:null,'attributes':_0x2c126c[_0x2e49('0x1a')]?_0x2c126c['options']['attributes']||null:null,'limit':_0x2c126c[_0x2e49('0x1a')]?_0x2c126c['options'][_0x2e49('0x1c')]||null:null,'include':_0x2c126c[_0x2e49('0x1a')]?_0x2c126c[_0x2e49('0x1a')][_0x2e49('0x1d')]?_[_0x2e49('0x1e')](_0x2c126c['options']['include'],function(_0x44a567){return{'model':db[_0x44a567[_0x2e49('0x1f')]],'as':_0x44a567['as'],'attributes':_0x44a567[_0x2e49('0x20')],'include':_0x44a567[_0x2e49('0x1d')]?_['map'](_0x44a567[_0x2e49('0x1d')],function(_0x2c0a3b){return{'model':db[_0x2c0a3b[_0x2e49('0x1f')]],'as':_0x2c0a3b['as'],'attributes':_0x2c0a3b[_0x2e49('0x20')],'include':_0x2c0a3b[_0x2e49('0x1d')]?_['map'](_0x2c0a3b[_0x2e49('0x1d')],function(_0x4a8044){return{'model':db[_0x4a8044[_0x2e49('0x1f')]],'as':_0x4a8044['as'],'attributes':_0x4a8044['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e49('0x21')](function(_0x2dd33d){logger['info'](_0x2e49('0x22'),_0x2c126c);logger[_0x2e49('0x11')](_0x2e49('0x22'),_0x2c126c,JSON[_0x2e49('0x23')](_0x2dd33d));_0x4cb407(_0x2dd33d);})[_0x2e49('0x24')](function(_0x75ebcb){logger[_0x2e49('0x14')]('GetMailQueue',_0x75ebcb[_0x2e49('0x16')],_0x2c126c);_0xd21fa9(_0x41dfda[_0x2e49('0x14')](0x1f4,_0x75ebcb[_0x2e49('0x16')]));});});};exports[_0x2e49('0x25')]=function(_0x244c86){var _0x47002c=this;return new Promise(function(_0x5c2757,_0x43e6b3){return db[_0x2e49('0x18')][_0x2e49('0x26')]({'raw':_0x244c86[_0x2e49('0x1a')]?_0x244c86['options'][_0x2e49('0x1b')]===undefined?!![]:![]:!![],'where':_0x244c86[_0x2e49('0x1a')]?_0x244c86[_0x2e49('0x1a')]['where']||null:null,'attributes':_0x244c86[_0x2e49('0x1a')]?_0x244c86['options'][_0x2e49('0x20')]||null:null,'include':_0x244c86[_0x2e49('0x1a')]?_0x244c86[_0x2e49('0x1a')][_0x2e49('0x1d')]?_[_0x2e49('0x1e')](_0x244c86[_0x2e49('0x1a')][_0x2e49('0x1d')],function(_0x3f7af9){return{'model':db[_0x3f7af9[_0x2e49('0x1f')]],'as':_0x3f7af9['as'],'attributes':_0x3f7af9[_0x2e49('0x20')],'include':_0x3f7af9[_0x2e49('0x1d')]?_['map'](_0x3f7af9[_0x2e49('0x1d')],function(_0x27489c){return{'model':db[_0x27489c[_0x2e49('0x1f')]],'as':_0x27489c['as'],'attributes':_0x27489c[_0x2e49('0x20')],'include':_0x27489c['include']?_[_0x2e49('0x1e')](_0x27489c[_0x2e49('0x1d')],function(_0x7ed6b0){return{'model':db[_0x7ed6b0['model']],'as':_0x7ed6b0['as'],'attributes':_0x7ed6b0[_0x2e49('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2e49('0x21')](function(_0x3adcea){logger['info'](_0x2e49('0x25'),_0x244c86);logger['debug']('ShowMailQueue',_0x244c86,JSON[_0x2e49('0x23')](_0x3adcea));_0x5c2757(_0x3adcea);})['catch'](function(_0x37dcfa){logger[_0x2e49('0x14')](_0x2e49('0x25'),_0x37dcfa[_0x2e49('0x16')],_0x244c86);_0x43e6b3(_0x47002c[_0x2e49('0x14')](0x1f4,_0x37dcfa[_0x2e49('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b5a5fc4..4b3ce1b 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 _0xfe99=['remove','update','emit','removeListener','register','length','mailQueue:','save'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfe99,0x11f));var _0x9fe9=function(_0x1cf979,_0x53c123){_0x1cf979=_0x1cf979-0x0;var _0x2eda48=_0xfe99[_0x1cf979];return _0x2eda48;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9fe9('0x0'),_0x9fe9('0x1'),_0x9fe9('0x2')];function createListener(_0x3113,_0x2dd6ac){return function(_0x1bc527){_0x2dd6ac[_0x9fe9('0x3')](_0x3113,_0x1bc527);};}function removeListener(_0x491bd7,_0x2dbfae){return function(){MailQueueEvents[_0x9fe9('0x4')](_0x491bd7,_0x2dbfae);};}exports[_0x9fe9('0x5')]=function(_0x3b31ce){for(var _0x25cd36=0x0,_0x46e6c5=events[_0x9fe9('0x6')];_0x25cd36<_0x46e6c5;_0x25cd36++){var _0x1e544d=events[_0x25cd36];var _0x1e63b9=createListener(_0x9fe9('0x7')+_0x1e544d,_0x3b31ce);MailQueueEvents['on'](_0x1e544d,_0x1e63b9);}}; \ No newline at end of file +var _0xe975=['length','mailQueue:','save','remove','update','emit','removeListener','register'];(function(_0x4ec839,_0x2ad44e){var _0x54b732=function(_0x209f66){while(--_0x209f66){_0x4ec839['push'](_0x4ec839['shift']());}};_0x54b732(++_0x2ad44e);}(_0xe975,0x1da));var _0x5e97=function(_0x1994ff,_0x49e3d3){_0x1994ff=_0x1994ff-0x0;var _0x3ba889=_0xe975[_0x1994ff];return _0x3ba889;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x5e97('0x0'),_0x5e97('0x1'),_0x5e97('0x2')];function createListener(_0x22334b,_0x20af82){return function(_0xa4b049){_0x20af82[_0x5e97('0x3')](_0x22334b,_0xa4b049);};}function removeListener(_0x53e2a9,_0x367c71){return function(){MailQueueEvents[_0x5e97('0x4')](_0x53e2a9,_0x367c71);};}exports[_0x5e97('0x5')]=function(_0x1014a2){for(var _0x55c508=0x0,_0x1f40a7=events[_0x5e97('0x6')];_0x55c508<_0x1f40a7;_0x55c508++){var _0x9f8fce=events[_0x55c508];var _0x4b36f8=createListener(_0x5e97('0x7')+_0x9f8fce,_0x1014a2);MailQueueEvents['on'](_0x9f8fce,_0x4b36f8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e04bc2a..4195f35 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 _0x8a5d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x2a30e5,_0x320656){var _0x2ab913=function(_0xf735b4){while(--_0xf735b4){_0x2a30e5['push'](_0x2a30e5['shift']());}};_0x2ab913(++_0x320656);}(_0x8a5d,0x104));var _0xd8a5=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x8a5d[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require('multer');var util=require(_0xd8a5('0x0'));var path=require(_0xd8a5('0x1'));var timeout=require(_0xd8a5('0x2'));var express=require('express');var router=express[_0xd8a5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd8a5('0x4'));var interaction=require(_0xd8a5('0x5'));var config=require(_0xd8a5('0x6'));var controller=require(_0xd8a5('0x7'));router[_0xd8a5('0x8')]('/',auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xa')]);router['get'](_0xd8a5('0xb'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xc')]);router[_0xd8a5('0x8')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0xe')]);router[_0xd8a5('0xf')]('/',auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x10')]);router[_0xd8a5('0x11')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x12')]);router[_0xd8a5('0x13')](_0xd8a5('0xd'),auth[_0xd8a5('0x9')](),controller[_0xd8a5('0x14')]);module[_0xd8a5('0x15')]=router; \ No newline at end of file +var _0x8591=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8591,0x1c6));var _0x1859=function(_0x63bd85,_0x2f877a){_0x63bd85=_0x63bd85-0x0;var _0x4a2d28=_0x8591[_0x63bd85];return _0x4a2d28;};'use strict';var multer=require(_0x1859('0x0'));var util=require(_0x1859('0x1'));var path=require(_0x1859('0x2'));var timeout=require(_0x1859('0x3'));var express=require(_0x1859('0x4'));var router=express['Router']();var fs_extra=require(_0x1859('0x5'));var auth=require(_0x1859('0x6'));var interaction=require(_0x1859('0x7'));var config=require(_0x1859('0x8'));var controller=require(_0x1859('0x9'));router[_0x1859('0xa')]('/',auth[_0x1859('0xb')](),controller[_0x1859('0xc')]);router[_0x1859('0xa')](_0x1859('0xd'),auth[_0x1859('0xb')](),controller[_0x1859('0xe')]);router['get'](_0x1859('0xf'),auth[_0x1859('0xb')](),controller['show']);router[_0x1859('0x10')]('/',auth[_0x1859('0xb')](),controller[_0x1859('0x11')]);router[_0x1859('0x12')](_0x1859('0xf'),auth[_0x1859('0xb')](),controller[_0x1859('0x13')]);router[_0x1859('0x14')]('/:id',auth[_0x1859('0xb')](),controller[_0x1859('0x15')]);module[_0x1859('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f60c842..b2ba1ad 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 _0xba27=['sequelize','exports','STRING','DATE'];(function(_0x443b42,_0xe3f647){var _0x2b706b=function(_0x26abce){while(--_0x26abce){_0x443b42['push'](_0x443b42['shift']());}};_0x2b706b(++_0xe3f647);}(_0xba27,0x15c));var _0x7ba2=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xba27[_0x349367];return _0x14179b;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ba2('0x0'));module[_0x7ba2('0x1')]={'uniqueid':{'type':Sequelize[_0x7ba2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7ba2('0x2')]},'joinAt':{'type':Sequelize[_0x7ba2('0x3')]},'leaveAt':{'type':Sequelize[_0x7ba2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ba2('0x3')]},'reason':{'type':Sequelize[_0x7ba2('0x2')]}}; \ No newline at end of file +var _0xb3d3=['exports','STRING','DATE','moment','sequelize'];(function(_0x4081f7,_0x5b2d46){var _0x37cbd1=function(_0x521f91){while(--_0x521f91){_0x4081f7['push'](_0x4081f7['shift']());}};_0x37cbd1(++_0x5b2d46);}(_0xb3d3,0xc6));var _0x3b3d=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xb3d3[_0x5d1044];return _0x3cd90e;};'use strict';var moment=require(_0x3b3d('0x0'));var Sequelize=require(_0x3b3d('0x1'));module[_0x3b3d('0x2')]={'uniqueid':{'type':Sequelize[_0x3b3d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3b3d('0x3')]},'joinAt':{'type':Sequelize[_0x3b3d('0x4')]},'leaveAt':{'type':Sequelize[_0x3b3d('0x4')]},'acceptAt':{'type':Sequelize[_0x3b3d('0x4')]},'exitAt':{'type':Sequelize[_0x3b3d('0x4')]},'reason':{'type':Sequelize[_0x3b3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7bc71bc..a0fd836 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 _0x056b=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','stack','name','send','MailQueueReport','rawAttributes'];(function(_0x571f28,_0x51320b){var _0x5b8667=function(_0x236314){while(--_0x236314){_0x571f28['push'](_0x571f28['shift']());}};_0x5b8667(++_0x51320b);}(_0x056b,0xb6));var _0xb056=function(_0x24e893,_0x130483){_0x24e893=_0x24e893-0x0;var _0x437e82=_0x056b[_0x24e893];return _0x437e82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a14f,_0x10b9b3){return function(_0x5c39db){if(!_0x5c39db){_0x44a14f[_0xb056('0x1b')](0x194);}return _0x5c39db;};}function handleError(_0x265782,_0x2ae873){_0x2ae873=_0x2ae873||0x1f4;return function(_0x1d2c66){logger[_0xb056('0x28')](_0x1d2c66[_0xb056('0x29')]);if(_0x1d2c66[_0xb056('0x2a')]){delete _0x1d2c66[_0xb056('0x2a')];}_0x265782['status'](_0x2ae873)[_0xb056('0x2b')](_0x1d2c66);};}exports['index']=function(_0x3d83d3,_0x9c6f4a){var _0x294874={},_0x488185={},_0xd53267={'count':0x0,'rows':[]};var _0x264569=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x329eaa){return{'name':_0x329eaa[_0xb056('0x2e')],'type':_0x329eaa[_0xb056('0x2f')]['key']};});_0x488185[_0xb056('0x30')]=_[_0xb056('0x31')](_0x264569,_0xb056('0x2a'));_0x488185[_0xb056('0x32')]=_[_0xb056('0x33')](_0x3d83d3['query']);_0x488185[_0xb056('0x34')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],_0x488185[_0xb056('0x32')]);_0x294874[_0xb056('0x36')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],qs[_0xb056('0x37')](_0x3d83d3['query'][_0xb056('0x37')]));_0x294874['attributes']=_0x294874[_0xb056('0x36')]['length']?_0x294874['attributes']:_0x488185[_0xb056('0x30')];if(!_0x3d83d3[_0xb056('0x32')][_0xb056('0x38')](_0xb056('0x39'))){_0x294874[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x3d83d3[_0xb056('0x32')]['limit']);_0x294874[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x3d83d3['query']['offset']);}_0x294874[_0xb056('0x3a')]=qs[_0xb056('0x3b')](_0x3d83d3[_0xb056('0x32')]['sort']);_0x294874[_0xb056('0x3c')]=qs[_0xb056('0x34')](_[_0xb056('0x3d')](_0x3d83d3[_0xb056('0x32')],_0x488185[_0xb056('0x34')]),_0x264569);if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]){_0x294874[_0xb056('0x3c')]=_[_0xb056('0x3f')](_0x294874[_0xb056('0x3c')],{'$or':_[_0xb056('0x31')](_0x264569,function(_0x1afc7f){if(_0x1afc7f['type']!==_0xb056('0x40')){var _0x4acc94={};_0x4acc94[_0x1afc7f[_0xb056('0x2a')]]={'$like':'%'+_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]+'%'};return _0x4acc94;}})});}_0x294874=_[_0xb056('0x3f')]({},_0x294874,_0x3d83d3[_0xb056('0x41')]);var _0x661784={'where':_0x294874[_0xb056('0x3c')]};return db[_0xb056('0x2c')]['count'](_0x661784)[_0xb056('0x26')](function(_0x21a34b){_0xd53267[_0xb056('0x21')]=_0x21a34b;if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x42')]){_0x294874['include']=[{'all':!![]}];}return db[_0xb056('0x2c')][_0xb056('0x43')](_0x294874);})[_0xb056('0x26')](function(_0x216f72){_0xd53267[_0xb056('0x44')]=_0x216f72;return _0xd53267;})[_0xb056('0x26')](respondWithFilteredResult(_0x9c6f4a,_0x294874))['catch'](handleError(_0x9c6f4a,null));};exports[_0xb056('0x45')]=function(_0x5040f6,_0x3bcc3d){var _0xc729f3={'raw':!![],'where':{'id':_0x5040f6[_0xb056('0x46')]['id']}},_0x21d98e={};_0x21d98e[_0xb056('0x30')]=_[_0xb056('0x33')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0x21d98e[_0xb056('0x32')]=_[_0xb056('0x33')](_0x5040f6['query']);_0x21d98e[_0xb056('0x34')]=_[_0xb056('0x35')](_0x21d98e[_0xb056('0x30')],_0x21d98e['query']);_0xc729f3[_0xb056('0x36')]=_[_0xb056('0x35')](_0x21d98e['model'],qs['fields'](_0x5040f6[_0xb056('0x32')][_0xb056('0x37')]));_0xc729f3[_0xb056('0x36')]=_0xc729f3[_0xb056('0x36')]['length']?_0xc729f3['attributes']:_0x21d98e['model'];if(_0x5040f6['query']['includeAll']){_0xc729f3['include']=[{'all':!![]}];}_0xc729f3=_[_0xb056('0x3f')]({},_0xc729f3,_0x5040f6['options']);return db[_0xb056('0x2c')][_0xb056('0x47')](_0xc729f3)[_0xb056('0x26')](handleEntityNotFound(_0x3bcc3d,null))[_0xb056('0x26')](respondWithResult(_0x3bcc3d,null))[_0xb056('0x48')](handleError(_0x3bcc3d,null));};exports[_0xb056('0x49')]=function(_0x45b4aa,_0x1d3f86){return db['MailQueueReport'][_0xb056('0x49')](_0x45b4aa[_0xb056('0x4a')],{})['then'](respondWithResult(_0x1d3f86,0xc9))[_0xb056('0x48')](handleError(_0x1d3f86,null));};exports[_0xb056('0x25')]=function(_0xe40439,_0x2f2d22){if(_0xe40439[_0xb056('0x4a')]['id']){delete _0xe40439[_0xb056('0x4a')]['id'];}return db['MailQueueReport'][_0xb056('0x47')]({'where':{'id':_0xe40439['params']['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x2f2d22,null))[_0xb056('0x26')](saveUpdates(_0xe40439[_0xb056('0x4a')],null))[_0xb056('0x26')](respondWithResult(_0x2f2d22,null))[_0xb056('0x48')](handleError(_0x2f2d22,null));};exports[_0xb056('0x27')]=function(_0x2b6733,_0x25bb16){return db['MailQueueReport'][_0xb056('0x47')]({'where':{'id':_0x2b6733[_0xb056('0x46')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x25bb16,null))[_0xb056('0x26')](removeEntity(_0x25bb16,null))[_0xb056('0x48')](handleError(_0x25bb16,null));};exports[_0xb056('0x4b')]=function(_0x3de967,_0x43fb4a){return db['MailQueueReport'][_0xb056('0x4b')]()[_0xb056('0x26')](respondWithResult(_0x43fb4a,null))[_0xb056('0x48')](handleError(_0x43fb4a,null));}; \ No newline at end of file +var _0x4e2e=['name','send','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack'];(function(_0x111ef3,_0x493f8b){var _0x25e31a=function(_0x1e91f0){while(--_0x1e91f0){_0x111ef3['push'](_0x111ef3['shift']());}};_0x25e31a(++_0x493f8b);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x24b6a2,_0x38c41b){_0x24b6a2=_0x24b6a2-0x0;var _0x565e12=_0x4e2e[_0x24b6a2];return _0x565e12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['MailQueueReport'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['MailQueueReport'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));};exports[_0xe4e2('0x4c')]=function(_0x582674,_0x169251){return db[_0xe4e2('0x2c')]['describe']()[_0xe4e2('0x26')](respondWithResult(_0x169251,null))[_0xe4e2('0x43')](handleError(_0x169251,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4a3d581..6337f5c 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 _0x4e6b=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3d95f8,_0x45f525){var _0x583a21=function(_0x127b2e){while(--_0x127b2e){_0x3d95f8['push'](_0x3d95f8['shift']());}};_0x583a21(++_0x45f525);}(_0x4e6b,0x172));var _0xb4e6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4e6b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var logger=require('../../config/logger')(_0xb4e6('0x2'));var moment=require('moment');var BPromise=require(_0xb4e6('0x3'));var rp=require(_0xb4e6('0x4'));var fs=require('fs');var path=require(_0xb4e6('0x5'));var rimraf=require(_0xb4e6('0x6'));var config=require(_0xb4e6('0x7'));var attributes=require(_0xb4e6('0x8'));module[_0xb4e6('0x9')]=function(_0x1d7883,_0x1cda58){return _0x1d7883[_0xb4e6('0xa')](_0xb4e6('0xb'),attributes,{'tableName':_0xb4e6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc700=['uniqueid','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x3dbff8,_0x4028f4){var _0x525516=function(_0x1bc0b3){while(--_0x1bc0b3){_0x3dbff8['push'](_0x3dbff8['shift']());}};_0x525516(++_0x4028f4);}(_0xc700,0x9b));var _0x0c70=function(_0xb5700e,_0x1208dc){_0xb5700e=_0xb5700e-0x0;var _0x5fb105=_0xc700[_0xb5700e];return _0x5fb105;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0c70('0x0'));var moment=require(_0x0c70('0x1'));var BPromise=require(_0x0c70('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c70('0x3'));var rimraf=require(_0x0c70('0x4'));var config=require(_0x0c70('0x5'));var attributes=require(_0x0c70('0x6'));module[_0x0c70('0x7')]=function(_0x8bb62d,_0x22b771){return _0x8bb62d[_0x0c70('0x8')](_0x0c70('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x0c70('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index cbc76bd..78d7b86 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x40375c,_0x57ea2f){var _0xdca3fb=function(_0xb4ee4){while(--_0xb4ee4){_0x40375c['push'](_0x40375c['shift']());}};_0xdca3fb(++_0x57ea2f);}(_0x2ef3,0xba));var _0x32ef=function(_0x28ffb0,_0x53ec49){_0x28ffb0=_0x28ffb0-0x0;var _0x234cd9=_0x2ef3[_0x28ffb0];return _0x234cd9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x519eb3,_0x3e146d){var _0x44d03f=function(_0x55bc9c){while(--_0x55bc9c){_0x519eb3['push'](_0x519eb3['shift']());}};_0x44d03f(++_0x3e146d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b88d1,_0x22075b){_0x3b88d1=_0x3b88d1-0x0;var _0x393ed5=_0x5f2f[_0x3b88d1];return _0x393ed5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b3694af..7e0ed33 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a9948,_0x5a063e){var _0x1f4210=function(_0x2f8f26){while(--_0x2f8f26){_0x5a9948['push'](_0x5a9948['shift']());}};_0x1f4210(++_0x5a063e);}(_0xe706,0xa3));var _0x6e70=function(_0x581e01,_0x241cbd){_0x581e01=_0x581e01-0x0;var _0x558b54=_0xe706[_0x581e01];return _0x558b54;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5457e1,_0x5ed18b){var _0x2153dc=function(_0x5b720a){while(--_0x5b720a){_0x5457e1['push'](_0x5457e1['shift']());}};_0x2153dc(++_0x5ed18b);}(_0xe706,0xa3));var _0x6e70=function(_0x2a3e5f,_0x24c745){_0x2a3e5f=_0x2a3e5f-0x0;var _0xfdbebc=_0xe706[_0x2a3e5f];return _0xfdbebc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3aa0e11..6a809f3 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 _0x0f04=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f04,0x1de));var _0x40f0=function(_0x50fecb,_0x667edb){_0x50fecb=_0x50fecb-0x0;var _0x1d76a2=_0x0f04[_0x50fecb];return _0x1d76a2;};'use strict';var Sequelize=require('sequelize');module[_0x40f0('0x0')]={'description':{'type':Sequelize[_0x40f0('0x1')]},'host':{'type':Sequelize[_0x40f0('0x1')]},'authentication':{'type':Sequelize[_0x40f0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x40f0('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x40f0('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x40f0('0x1')],'defaultValue':_0x40f0('0x4')},'connTimeout':{'type':Sequelize[_0x40f0('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x40f0('0x1')]},'modernAuthentication':{'type':Sequelize[_0x40f0('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x24fe=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x582065,_0x5ab9cf){var _0x1938ed=function(_0x290866){while(--_0x290866){_0x582065['push'](_0x582065['shift']());}};_0x1938ed(++_0x5ab9cf);}(_0x24fe,0xef));var _0xe24f=function(_0x2e3d2f,_0x144d88){_0x2e3d2f=_0x2e3d2f-0x0;var _0x21b632=_0x24fe[_0x2e3d2f];return _0x21b632;};'use strict';var Sequelize=require(_0xe24f('0x0'));module[_0xe24f('0x1')]={'description':{'type':Sequelize[_0xe24f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe24f('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe24f('0x3')]},'tls':{'type':Sequelize[_0xe24f('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe24f('0x2')],'defaultValue':_0xe24f('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xe24f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 46e1181..fbfb13b 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 _0x014c=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x59b470,_0x2d1b3a){var _0x1bbd91=function(_0xe98c12){while(--_0xe98c12){_0x59b470['push'](_0x59b470['shift']());}};_0x1bbd91(++_0x2d1b3a);}(_0x014c,0x190));var _0xc014=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x014c[_0xbf5e16];return _0x5975a5;};'use strict';var _=require('lodash');var util=require(_0xc014('0x0'));var logger=require(_0xc014('0x1'))(_0xc014('0x2'));var moment=require(_0xc014('0x3'));var BPromise=require(_0xc014('0x4'));var rp=require(_0xc014('0x5'));var fs=require('fs');var path=require(_0xc014('0x6'));var rimraf=require(_0xc014('0x7'));var config=require('../../config/environment');var attributes=require(_0xc014('0x8'));module[_0xc014('0x9')]=function(_0x1de2e5,_0x3cdb86){return _0x1de2e5['define'](_0xc014('0xa'),attributes,{'tableName':_0xc014('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f95=['api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in','lodash','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4f95,0x18a));var _0x54f9=function(_0x41b072,_0x153509){_0x41b072=_0x41b072-0x0;var _0xd5621a=_0x4f95[_0x41b072];return _0xd5621a;};'use strict';var _=require(_0x54f9('0x0'));var util=require(_0x54f9('0x1'));var logger=require('../../config/logger')(_0x54f9('0x2'));var moment=require(_0x54f9('0x3'));var BPromise=require(_0x54f9('0x4'));var rp=require(_0x54f9('0x5'));var fs=require('fs');var path=require(_0x54f9('0x6'));var rimraf=require('rimraf');var config=require(_0x54f9('0x7'));var attributes=require(_0x54f9('0x8'));module[_0x54f9('0x9')]=function(_0x2de249,_0x429caf){return _0x2de249['define']('MailServerIn',attributes,{'tableName':_0x54f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 98fb22d..1a08388 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 _0x18a9=['raw','where','attributes','include','model','map','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','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','MailServerIn','options'];(function(_0x2b4c49,_0x5a3e8a){var _0x18b246=function(_0x1d4c2f){while(--_0x1d4c2f){_0x2b4c49['push'](_0x2b4c49['shift']());}};_0x18b246(++_0x5a3e8a);}(_0x18a9,0x15b));var _0x918a=function(_0x39bc67,_0x4d286d){_0x39bc67=_0x39bc67-0x0;var _0x11d4cc=_0x18a9[_0x39bc67];return _0x11d4cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x918a('0x0'));var BPromise=require(_0x918a('0x1'));var rs=require(_0x918a('0x2'));var fs=require('fs');var Redis=require(_0x918a('0x3'));var db=require(_0x918a('0x4'))['db'];var utils=require(_0x918a('0x5'));var logger=require(_0x918a('0x6'))(_0x918a('0x7'));var config=require(_0x918a('0x8'));var jayson=require(_0x918a('0x9'));var client=jayson[_0x918a('0xa')][_0x918a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492c39,_0xdb8dd8,_0x266256){return new BPromise(function(_0x51caca,_0x40518f){return client[_0x918a('0xc')](_0x492c39,_0x266256)[_0x918a('0xd')](function(_0x224a87){logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,_0x918a('0x10'));logger['debug'](_0x918a('0x11'),_0xdb8dd8,_0x918a('0x10'),JSON[_0x918a('0x12')](_0x224a87));if(_0x224a87[_0x918a('0x13')]){if(_0x224a87['error'][_0x918a('0x14')]===0x1f4){logger[_0x918a('0x13')]('MailServerIn,\x20%s,\x20%s',_0xdb8dd8,_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);return _0x40518f(_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);}logger['error'](_0x918a('0xf'),_0xdb8dd8,_0x224a87['error'][_0x918a('0x15')]);return _0x51caca(_0x224a87['error']['message']);}else{logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,'request\x20sent');_0x51caca(_0x224a87[_0x918a('0x16')]['message']);}})[_0x918a('0x17')](function(_0x17f988){logger[_0x918a('0x13')]('MailServerIn,\x20%s,\x20%s',_0xdb8dd8,_0x17f988);_0x40518f(_0x17f988);});});}exports[_0x918a('0x18')]=function(_0x51e467){var _0x199eb1=this;return new Promise(function(_0x22e347,_0x38ca45){return db[_0x918a('0x19')]['findAll']({'raw':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1b')]===undefined?!![]:![]:!![],'where':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1c')]||null:null,'attributes':_0x51e467[_0x918a('0x1a')]?_0x51e467['options'][_0x918a('0x1d')]||null:null,'limit':_0x51e467['options']?_0x51e467[_0x918a('0x1a')]['limit']||null:null,'include':_0x51e467['options']?_0x51e467['options'][_0x918a('0x1e')]?_['map'](_0x51e467[_0x918a('0x1a')][_0x918a('0x1e')],function(_0xadd3bc){return{'model':db[_0xadd3bc[_0x918a('0x1f')]],'as':_0xadd3bc['as'],'attributes':_0xadd3bc[_0x918a('0x1d')],'include':_0xadd3bc[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xadd3bc[_0x918a('0x1e')],function(_0xfdad4a){return{'model':db[_0xfdad4a[_0x918a('0x1f')]],'as':_0xfdad4a['as'],'attributes':_0xfdad4a['attributes'],'include':_0xfdad4a[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xfdad4a[_0x918a('0x1e')],function(_0x4a77c6){return{'model':db[_0x4a77c6[_0x918a('0x1f')]],'as':_0x4a77c6['as'],'attributes':_0x4a77c6[_0x918a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x918a('0xd')](function(_0x549cb4){logger[_0x918a('0xe')](_0x918a('0x18'),_0x51e467);logger[_0x918a('0x21')](_0x918a('0x18'),_0x51e467,JSON[_0x918a('0x12')](_0x549cb4));_0x22e347(_0x549cb4);})[_0x918a('0x17')](function(_0x51361c){logger['error']('GetMailServerIn',_0x51361c[_0x918a('0x15')],_0x51e467);_0x38ca45(_0x199eb1[_0x918a('0x13')](0x1f4,_0x51361c['message']));});});}; \ No newline at end of file +var _0x3b1b=['randomstring','ioredis','rpc','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','GetMailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','then','catch','util','moment','bluebird'];(function(_0x65d13d,_0x49e929){var _0x309bb3=function(_0x2d7f73){while(--_0x2d7f73){_0x65d13d['push'](_0x65d13d['shift']());}};_0x309bb3(++_0x49e929);}(_0x3b1b,0x75));var _0xb3b1=function(_0x53d3bd,_0x5c9e65){_0x53d3bd=_0x53d3bd-0x0;var _0x30b85e=_0x3b1b[_0x53d3bd];return _0x30b85e;};'use strict';var _=require('lodash');var util=require(_0xb3b1('0x0'));var moment=require(_0xb3b1('0x1'));var BPromise=require(_0xb3b1('0x2'));var rs=require(_0xb3b1('0x3'));var fs=require('fs');var Redis=require(_0xb3b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3b1('0x5'));var config=require('../../config/environment');var jayson=require(_0xb3b1('0x6'));var client=jayson[_0xb3b1('0x7')][_0xb3b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7b864b,_0x2d553a,_0x470457){return new BPromise(function(_0x3a3133,_0xbc998a){return client[_0xb3b1('0x9')](_0x7b864b,_0x470457)['then'](function(_0x6baf4b){logger['info'](_0xb3b1('0xa'),_0x2d553a,_0xb3b1('0xb'));logger[_0xb3b1('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2d553a,'request\x20sent',JSON[_0xb3b1('0xd')](_0x6baf4b));if(_0x6baf4b[_0xb3b1('0xe')]){if(_0x6baf4b[_0xb3b1('0xe')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2d553a,_0x6baf4b['error'][_0xb3b1('0xf')]);return _0xbc998a(_0x6baf4b[_0xb3b1('0xe')][_0xb3b1('0xf')]);}logger[_0xb3b1('0xe')](_0xb3b1('0xa'),_0x2d553a,_0x6baf4b[_0xb3b1('0xe')]['message']);return _0x3a3133(_0x6baf4b[_0xb3b1('0xe')][_0xb3b1('0xf')]);}else{logger[_0xb3b1('0x10')](_0xb3b1('0xa'),_0x2d553a,_0xb3b1('0xb'));_0x3a3133(_0x6baf4b[_0xb3b1('0x11')][_0xb3b1('0xf')]);}})['catch'](function(_0x404eef){logger[_0xb3b1('0xe')]('MailServerIn,\x20%s,\x20%s',_0x2d553a,_0x404eef);_0xbc998a(_0x404eef);});});}exports[_0xb3b1('0x12')]=function(_0x5b66ce){var _0x1cc52c=this;return new Promise(function(_0x14f0de,_0x2abc05){return db['MailServerIn'][_0xb3b1('0x13')]({'raw':_0x5b66ce[_0xb3b1('0x14')]?_0x5b66ce[_0xb3b1('0x14')][_0xb3b1('0x15')]===undefined?!![]:![]:!![],'where':_0x5b66ce[_0xb3b1('0x14')]?_0x5b66ce[_0xb3b1('0x14')][_0xb3b1('0x16')]||null:null,'attributes':_0x5b66ce[_0xb3b1('0x14')]?_0x5b66ce[_0xb3b1('0x14')]['attributes']||null:null,'limit':_0x5b66ce[_0xb3b1('0x14')]?_0x5b66ce[_0xb3b1('0x14')][_0xb3b1('0x17')]||null:null,'include':_0x5b66ce[_0xb3b1('0x14')]?_0x5b66ce['options'][_0xb3b1('0x18')]?_[_0xb3b1('0x19')](_0x5b66ce[_0xb3b1('0x14')]['include'],function(_0xb85890){return{'model':db[_0xb85890[_0xb3b1('0x1a')]],'as':_0xb85890['as'],'attributes':_0xb85890[_0xb3b1('0x1b')],'include':_0xb85890[_0xb3b1('0x18')]?_[_0xb3b1('0x19')](_0xb85890['include'],function(_0x324626){return{'model':db[_0x324626[_0xb3b1('0x1a')]],'as':_0x324626['as'],'attributes':_0x324626[_0xb3b1('0x1b')],'include':_0x324626['include']?_['map'](_0x324626[_0xb3b1('0x18')],function(_0x17d6e4){return{'model':db[_0x17d6e4[_0xb3b1('0x1a')]],'as':_0x17d6e4['as'],'attributes':_0x17d6e4[_0xb3b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb3b1('0x1c')](function(_0xcfb3e2){logger[_0xb3b1('0x10')](_0xb3b1('0x12'),_0x5b66ce);logger[_0xb3b1('0xc')](_0xb3b1('0x12'),_0x5b66ce,JSON[_0xb3b1('0xd')](_0xcfb3e2));_0x14f0de(_0xcfb3e2);})[_0xb3b1('0x1d')](function(_0x4443b2){logger[_0xb3b1('0xe')](_0xb3b1('0x12'),_0x4443b2[_0xb3b1('0xf')],_0x5b66ce);_0x2abc05(_0x1cc52c[_0xb3b1('0xe')](0x1f4,_0x4443b2[_0xb3b1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 1bdc564..ef04537 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ff8ceab..d1a791c 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 _0xc900=['INTEGER','BOOLEAN','STRING'];(function(_0x1a6b8e,_0x42a281){var _0x141887=function(_0x1f7c79){while(--_0x1f7c79){_0x1a6b8e['push'](_0x1a6b8e['shift']());}};_0x141887(++_0x42a281);}(_0xc900,0xb3));var _0x0c90=function(_0x308623,_0x1b1fd3){_0x308623=_0x308623-0x0;var _0x5ca563=_0xc900[_0x308623];return _0x5ca563;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0c90('0x0')]},'host':{'type':Sequelize[_0x0c90('0x0')]},'user':{'type':Sequelize[_0x0c90('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0c90('0x1')]},'secure':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd8b0=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0d8b('0x2')]},'port':{'type':Sequelize[_0x0d8b('0x3')]},'secure':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x0d8b('0x2')]},'authentication':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9f3bee2..1805d1e 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 _0x7fd5=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','findAll','rows','catch','show','include','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x1f282b,_0x18221b){var _0x202f29=function(_0x50f494){while(--_0x50f494){_0x1f282b['push'](_0x1f282b['shift']());}};_0x202f29(++_0x18221b);}(_0x7fd5,0x8c));var _0x57fd=function(_0x24fc2c,_0x47b500){_0x24fc2c=_0x24fc2c-0x0;var _0x483de4=_0x7fd5[_0x24fc2c];return _0x483de4;};'use strict';var emlformat=require(_0x57fd('0x0'));var rimraf=require(_0x57fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57fd('0x2'));var rp=require(_0x57fd('0x3'));var moment=require('moment');var BPromise=require(_0x57fd('0x4'));var Mustache=require(_0x57fd('0x5'));var util=require(_0x57fd('0x6'));var path=require(_0x57fd('0x7'));var sox=require(_0x57fd('0x8'));var csv=require(_0x57fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57fd('0xa'));var squel=require(_0x57fd('0xb'));var crypto=require(_0x57fd('0xc'));var jsforce=require(_0x57fd('0xd'));var deskjs=require(_0x57fd('0xe'));var toCsv=require(_0x57fd('0x9'));var querystring=require(_0x57fd('0xf'));var Papa=require(_0x57fd('0x10'));var Redis=require(_0x57fd('0x11'));var authService=require(_0x57fd('0x12'));var qs=require(_0x57fd('0x13'));var as=require(_0x57fd('0x14'));var hardwareService=require(_0x57fd('0x15'));var logger=require(_0x57fd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x57fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x57fd('0x18'))['db'];function respondWithStatusCode(_0x5c854c,_0x5d4bd8){_0x5d4bd8=_0x5d4bd8||0xcc;return function(_0x32ad07){if(_0x32ad07){return _0x5c854c[_0x57fd('0x19')](_0x5d4bd8);}return _0x5c854c[_0x57fd('0x1a')](_0x5d4bd8)[_0x57fd('0x1b')]();};}function respondWithResult(_0xadde42,_0x21a743){_0x21a743=_0x21a743||0xc8;return function(_0xc55e69){if(_0xc55e69){return _0xadde42[_0x57fd('0x1a')](_0x21a743)[_0x57fd('0x1c')](_0xc55e69);}};}function respondWithFilteredResult(_0x117ecc,_0x4c1dcc){return function(_0x2593ef){if(_0x2593ef){var _0x19d5d9=typeof _0x4c1dcc[_0x57fd('0x1d')]===_0x57fd('0x1e')&&typeof _0x4c1dcc[_0x57fd('0x1f')]==='undefined';var _0x5f219b=_0x2593ef[_0x57fd('0x20')];var _0x3e799d=_0x19d5d9?0x0:_0x4c1dcc['offset'];var _0x380e88=_0x19d5d9?_0x2593ef['count']:_0x4c1dcc[_0x57fd('0x1d')]+_0x4c1dcc['limit'];var _0x3b820b;if(_0x380e88>=_0x5f219b){_0x380e88=_0x5f219b;_0x3b820b=0xc8;}else{_0x3b820b=0xce;}_0x117ecc[_0x57fd('0x1a')](_0x3b820b);return _0x117ecc[_0x57fd('0x21')]('Content-Range',_0x3e799d+'-'+_0x380e88+'/'+_0x5f219b)[_0x57fd('0x1c')](_0x2593ef);}return null;};}function patchUpdates(_0x51147b){return function(_0xf49fde){try{jsonpatch[_0x57fd('0x22')](_0xf49fde,_0x51147b,!![]);}catch(_0x250b75){return BPromise[_0x57fd('0x23')](_0x250b75);}return _0xf49fde[_0x57fd('0x24')]();};}function saveUpdates(_0x970dd3,_0x414cf7){return function(_0xcb275f){if(_0xcb275f){return _0xcb275f['update'](_0x970dd3)['then'](function(_0x1a1a19){return _0x1a1a19;});}return null;};}function removeEntity(_0x577581,_0x1173c3){return function(_0x37358c){if(_0x37358c){return _0x37358c[_0x57fd('0x25')]()[_0x57fd('0x26')](function(){_0x577581[_0x57fd('0x1a')](0xcc)[_0x57fd('0x1b')]();});}};}function handleEntityNotFound(_0x508b9c,_0x3bdb3e){return function(_0x4489d5){if(!_0x4489d5){_0x508b9c['sendStatus'](0x194);}return _0x4489d5;};}function handleError(_0x2a427e,_0x6b2a44){_0x6b2a44=_0x6b2a44||0x1f4;return function(_0x1815a2){logger[_0x57fd('0x27')](_0x1815a2[_0x57fd('0x28')]);if(_0x1815a2[_0x57fd('0x29')]){delete _0x1815a2['name'];}_0x2a427e['status'](_0x6b2a44)['send'](_0x1815a2);};}exports['index']=function(_0x13a6ff,_0x42733b){var _0x1d650e={},_0x55d853={},_0x5b341d={'count':0x0,'rows':[]};var _0x93953=_['map'](db[_0x57fd('0x2a')][_0x57fd('0x2b')],function(_0x4ad900){return{'name':_0x4ad900[_0x57fd('0x2c')],'type':_0x4ad900[_0x57fd('0x2d')][_0x57fd('0x2e')]};});_0x55d853['model']=_['map'](_0x93953,_0x57fd('0x29'));_0x55d853[_0x57fd('0x2f')]=_[_0x57fd('0x30')](_0x13a6ff[_0x57fd('0x2f')]);_0x55d853[_0x57fd('0x31')]=_[_0x57fd('0x32')](_0x55d853[_0x57fd('0x33')],_0x55d853[_0x57fd('0x2f')]);_0x1d650e[_0x57fd('0x34')]=_[_0x57fd('0x32')](_0x55d853[_0x57fd('0x33')],qs[_0x57fd('0x35')](_0x13a6ff['query']['fields']));_0x1d650e['attributes']=_0x1d650e['attributes'][_0x57fd('0x36')]?_0x1d650e[_0x57fd('0x34')]:_0x55d853['model'];if(!_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x37')](_0x57fd('0x38'))){_0x1d650e[_0x57fd('0x1f')]=qs[_0x57fd('0x1f')](_0x13a6ff['query']['limit']);_0x1d650e[_0x57fd('0x1d')]=qs['offset'](_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x1d')]);}_0x1d650e[_0x57fd('0x39')]=qs[_0x57fd('0x3a')](_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x3a')]);_0x1d650e[_0x57fd('0x3b')]=qs[_0x57fd('0x31')](_[_0x57fd('0x3c')](_0x13a6ff[_0x57fd('0x2f')],_0x55d853[_0x57fd('0x31')]),_0x93953);if(_0x13a6ff['query']['filter']){_0x1d650e[_0x57fd('0x3b')]=_[_0x57fd('0x3d')](_0x1d650e[_0x57fd('0x3b')],{'$or':_[_0x57fd('0x3e')](_0x93953,function(_0x170ed3){if(_0x170ed3[_0x57fd('0x2d')]!==_0x57fd('0x3f')){var _0x5df8ba={};_0x5df8ba[_0x170ed3[_0x57fd('0x29')]]={'$like':'%'+_0x13a6ff[_0x57fd('0x2f')][_0x57fd('0x40')]+'%'};return _0x5df8ba;}})});}_0x1d650e=_[_0x57fd('0x3d')]({},_0x1d650e,_0x13a6ff[_0x57fd('0x41')]);var _0x390e87={'where':_0x1d650e[_0x57fd('0x3b')]};return db[_0x57fd('0x2a')]['count'](_0x390e87)['then'](function(_0x2a00fe){_0x5b341d[_0x57fd('0x20')]=_0x2a00fe;if(_0x13a6ff['query']['includeAll']){_0x1d650e['include']=[{'all':!![]}];}return db[_0x57fd('0x2a')][_0x57fd('0x42')](_0x1d650e);})[_0x57fd('0x26')](function(_0x3dcf5c){_0x5b341d[_0x57fd('0x43')]=_0x3dcf5c;return _0x5b341d;})['then'](respondWithFilteredResult(_0x42733b,_0x1d650e))[_0x57fd('0x44')](handleError(_0x42733b,null));};exports[_0x57fd('0x45')]=function(_0x29f4a8,_0x2fad2f){var _0x19943f={'raw':!![],'where':{'id':_0x29f4a8['params']['id']}},_0x425651={};_0x425651[_0x57fd('0x33')]=_[_0x57fd('0x30')](db['MailServerOut'][_0x57fd('0x2b')]);_0x425651[_0x57fd('0x2f')]=_['keys'](_0x29f4a8['query']);_0x425651[_0x57fd('0x31')]=_[_0x57fd('0x32')](_0x425651[_0x57fd('0x33')],_0x425651[_0x57fd('0x2f')]);_0x19943f[_0x57fd('0x34')]=_[_0x57fd('0x32')](_0x425651['model'],qs[_0x57fd('0x35')](_0x29f4a8[_0x57fd('0x2f')][_0x57fd('0x35')]));_0x19943f[_0x57fd('0x34')]=_0x19943f[_0x57fd('0x34')][_0x57fd('0x36')]?_0x19943f[_0x57fd('0x34')]:_0x425651[_0x57fd('0x33')];if(_0x29f4a8['query']['includeAll']){_0x19943f[_0x57fd('0x46')]=[{'all':!![]}];}_0x19943f=_[_0x57fd('0x3d')]({},_0x19943f,_0x29f4a8[_0x57fd('0x41')]);return db['MailServerOut'][_0x57fd('0x47')](_0x19943f)[_0x57fd('0x26')](handleEntityNotFound(_0x2fad2f,null))[_0x57fd('0x26')](respondWithResult(_0x2fad2f,null))[_0x57fd('0x44')](handleError(_0x2fad2f,null));};exports[_0x57fd('0x48')]=function(_0x55ea57,_0x416a9f){return db[_0x57fd('0x2a')][_0x57fd('0x48')](_0x55ea57[_0x57fd('0x49')],{})[_0x57fd('0x26')](respondWithResult(_0x416a9f,0xc9))[_0x57fd('0x44')](handleError(_0x416a9f,null));};exports[_0x57fd('0x4a')]=function(_0x28b85f,_0x2c2961){if(_0x28b85f[_0x57fd('0x49')]['id']){delete _0x28b85f[_0x57fd('0x49')]['id'];}return db['MailServerOut'][_0x57fd('0x47')]({'where':{'id':_0x28b85f[_0x57fd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c2961,null))[_0x57fd('0x26')](saveUpdates(_0x28b85f[_0x57fd('0x49')],null))[_0x57fd('0x26')](respondWithResult(_0x2c2961,null))[_0x57fd('0x44')](handleError(_0x2c2961,null));};exports[_0x57fd('0x25')]=function(_0x57fcdc,_0x3b5e56){return db['MailServerOut'][_0x57fd('0x47')]({'where':{'id':_0x57fcdc[_0x57fd('0x4b')]['id']}})[_0x57fd('0x26')](handleEntityNotFound(_0x3b5e56,null))[_0x57fd('0x26')](removeEntity(_0x3b5e56,null))[_0x57fd('0x44')](handleError(_0x3b5e56,null));}; \ No newline at end of file +var _0x599a=['length','hasOwnProperty','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/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','then','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x1cad5b,_0x57ce89){var _0x517a51=function(_0x5d671b){while(--_0x5d671b){_0x1cad5b['push'](_0x1cad5b['shift']());}};_0x517a51(++_0x57ce89);}(_0x599a,0x100));var _0xa599=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x599a[_0x368e09];return _0x14b7df;};'use strict';var emlformat=require(_0xa599('0x0'));var rimraf=require(_0xa599('0x1'));var zipdir=require(_0xa599('0x2'));var jsonpatch=require(_0xa599('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa599('0x4'));var Mustache=require(_0xa599('0x5'));var util=require(_0xa599('0x6'));var path=require(_0xa599('0x7'));var sox=require(_0xa599('0x8'));var csv=require(_0xa599('0x9'));var ejs=require(_0xa599('0xa'));var fs=require('fs');var fs_extra=require(_0xa599('0xb'));var _=require(_0xa599('0xc'));var squel=require(_0xa599('0xd'));var crypto=require(_0xa599('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa599('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa599('0x10'));var Redis=require(_0xa599('0x11'));var authService=require(_0xa599('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa599('0x13'));var hardwareService=require(_0xa599('0x14'));var logger=require(_0xa599('0x15'))(_0xa599('0x16'));var utils=require(_0xa599('0x17'));var config=require(_0xa599('0x18'));var licenseUtil=require(_0xa599('0x19'));var db=require(_0xa599('0x1a'))['db'];function respondWithStatusCode(_0x3723a3,_0x6f9d18){_0x6f9d18=_0x6f9d18||0xcc;return function(_0x2761f7){if(_0x2761f7){return _0x3723a3[_0xa599('0x1b')](_0x6f9d18);}return _0x3723a3[_0xa599('0x1c')](_0x6f9d18)[_0xa599('0x1d')]();};}function respondWithResult(_0x3d4b8d,_0x45594e){_0x45594e=_0x45594e||0xc8;return function(_0x1bb0cc){if(_0x1bb0cc){return _0x3d4b8d[_0xa599('0x1c')](_0x45594e)[_0xa599('0x1e')](_0x1bb0cc);}};}function respondWithFilteredResult(_0xaf9e10,_0x4b87f1){return function(_0x20d11b){if(_0x20d11b){var _0x43e60d=typeof _0x4b87f1[_0xa599('0x1f')]===_0xa599('0x20')&&typeof _0x4b87f1[_0xa599('0x21')]===_0xa599('0x20');var _0x52cfc3=_0x20d11b['count'];var _0x3fbb8a=_0x43e60d?0x0:_0x4b87f1[_0xa599('0x1f')];var _0x57ddce=_0x43e60d?_0x20d11b[_0xa599('0x22')]:_0x4b87f1[_0xa599('0x1f')]+_0x4b87f1['limit'];var _0x20da31;if(_0x57ddce>=_0x52cfc3){_0x57ddce=_0x52cfc3;_0x20da31=0xc8;}else{_0x20da31=0xce;}_0xaf9e10[_0xa599('0x1c')](_0x20da31);return _0xaf9e10['set'](_0xa599('0x23'),_0x3fbb8a+'-'+_0x57ddce+'/'+_0x52cfc3)[_0xa599('0x1e')](_0x20d11b);}return null;};}function patchUpdates(_0x5a9211){return function(_0x12ce40){try{jsonpatch[_0xa599('0x24')](_0x12ce40,_0x5a9211,!![]);}catch(_0x256ed7){return BPromise[_0xa599('0x25')](_0x256ed7);}return _0x12ce40[_0xa599('0x26')]();};}function saveUpdates(_0x4566db,_0x533afc){return function(_0x47c309){if(_0x47c309){return _0x47c309['update'](_0x4566db)[_0xa599('0x27')](function(_0x34f5c3){return _0x34f5c3;});}return null;};}function removeEntity(_0x21d9e8,_0xd35711){return function(_0x54c86a){if(_0x54c86a){return _0x54c86a['destroy']()[_0xa599('0x27')](function(){_0x21d9e8['status'](0xcc)[_0xa599('0x1d')]();});}};}function handleEntityNotFound(_0x2c0670,_0xcf2077){return function(_0x1f2a9f){if(!_0x1f2a9f){_0x2c0670[_0xa599('0x1b')](0x194);}return _0x1f2a9f;};}function handleError(_0xf560f5,_0x479dc8){_0x479dc8=_0x479dc8||0x1f4;return function(_0x521ce6){logger[_0xa599('0x28')](_0x521ce6['stack']);if(_0x521ce6[_0xa599('0x29')]){delete _0x521ce6[_0xa599('0x29')];}_0xf560f5['status'](_0x479dc8)[_0xa599('0x2a')](_0x521ce6);};}exports[_0xa599('0x2b')]=function(_0x411dde,_0x9c14a0){var _0x133283={},_0x3d1e11={},_0x5cae3d={'count':0x0,'rows':[]};var _0x4ebc98=_[_0xa599('0x2c')](db[_0xa599('0x2d')][_0xa599('0x2e')],function(_0x1f87ff){return{'name':_0x1f87ff[_0xa599('0x2f')],'type':_0x1f87ff[_0xa599('0x30')][_0xa599('0x31')]};});_0x3d1e11[_0xa599('0x32')]=_[_0xa599('0x2c')](_0x4ebc98,'name');_0x3d1e11[_0xa599('0x33')]=_[_0xa599('0x34')](_0x411dde[_0xa599('0x33')]);_0x3d1e11['filters']=_[_0xa599('0x35')](_0x3d1e11[_0xa599('0x32')],_0x3d1e11[_0xa599('0x33')]);_0x133283[_0xa599('0x36')]=_['intersection'](_0x3d1e11[_0xa599('0x32')],qs[_0xa599('0x37')](_0x411dde[_0xa599('0x33')][_0xa599('0x37')]));_0x133283[_0xa599('0x36')]=_0x133283[_0xa599('0x36')][_0xa599('0x38')]?_0x133283[_0xa599('0x36')]:_0x3d1e11[_0xa599('0x32')];if(!_0x411dde[_0xa599('0x33')][_0xa599('0x39')]('nolimit')){_0x133283[_0xa599('0x21')]=qs[_0xa599('0x21')](_0x411dde[_0xa599('0x33')][_0xa599('0x21')]);_0x133283[_0xa599('0x1f')]=qs['offset'](_0x411dde['query']['offset']);}_0x133283[_0xa599('0x3a')]=qs[_0xa599('0x3b')](_0x411dde[_0xa599('0x33')]['sort']);_0x133283['where']=qs[_0xa599('0x3c')](_[_0xa599('0x3d')](_0x411dde[_0xa599('0x33')],_0x3d1e11[_0xa599('0x3c')]),_0x4ebc98);if(_0x411dde[_0xa599('0x33')]['filter']){_0x133283['where']=_[_0xa599('0x3e')](_0x133283[_0xa599('0x3f')],{'$or':_[_0xa599('0x2c')](_0x4ebc98,function(_0x2710ab){if(_0x2710ab[_0xa599('0x30')]!==_0xa599('0x40')){var _0x30f655={};_0x30f655[_0x2710ab[_0xa599('0x29')]]={'$like':'%'+_0x411dde['query'][_0xa599('0x41')]+'%'};return _0x30f655;}})});}_0x133283=_[_0xa599('0x3e')]({},_0x133283,_0x411dde[_0xa599('0x42')]);var _0x4b7bdb={'where':_0x133283['where']};return db['MailServerOut'][_0xa599('0x22')](_0x4b7bdb)[_0xa599('0x27')](function(_0x254921){_0x5cae3d['count']=_0x254921;if(_0x411dde[_0xa599('0x33')][_0xa599('0x43')]){_0x133283[_0xa599('0x44')]=[{'all':!![]}];}return db[_0xa599('0x2d')][_0xa599('0x45')](_0x133283);})['then'](function(_0x2e108f){_0x5cae3d[_0xa599('0x46')]=_0x2e108f;return _0x5cae3d;})[_0xa599('0x27')](respondWithFilteredResult(_0x9c14a0,_0x133283))['catch'](handleError(_0x9c14a0,null));};exports[_0xa599('0x47')]=function(_0x310f38,_0x276eb8){var _0x330668={'raw':!![],'where':{'id':_0x310f38[_0xa599('0x48')]['id']}},_0x629220={};_0x629220[_0xa599('0x32')]=_[_0xa599('0x34')](db['MailServerOut'][_0xa599('0x2e')]);_0x629220[_0xa599('0x33')]=_[_0xa599('0x34')](_0x310f38[_0xa599('0x33')]);_0x629220[_0xa599('0x3c')]=_[_0xa599('0x35')](_0x629220[_0xa599('0x32')],_0x629220[_0xa599('0x33')]);_0x330668[_0xa599('0x36')]=_['intersection'](_0x629220['model'],qs[_0xa599('0x37')](_0x310f38[_0xa599('0x33')][_0xa599('0x37')]));_0x330668[_0xa599('0x36')]=_0x330668['attributes']['length']?_0x330668[_0xa599('0x36')]:_0x629220['model'];if(_0x310f38[_0xa599('0x33')][_0xa599('0x43')]){_0x330668[_0xa599('0x44')]=[{'all':!![]}];}_0x330668=_[_0xa599('0x3e')]({},_0x330668,_0x310f38['options']);return db[_0xa599('0x2d')]['find'](_0x330668)[_0xa599('0x27')](handleEntityNotFound(_0x276eb8,null))[_0xa599('0x27')](respondWithResult(_0x276eb8,null))['catch'](handleError(_0x276eb8,null));};exports[_0xa599('0x49')]=function(_0x5592df,_0x21578b){return db[_0xa599('0x2d')][_0xa599('0x49')](_0x5592df[_0xa599('0x4a')],{})[_0xa599('0x27')](respondWithResult(_0x21578b,0xc9))[_0xa599('0x4b')](handleError(_0x21578b,null));};exports['update']=function(_0x2f71ca,_0x3fe8ca){if(_0x2f71ca[_0xa599('0x4a')]['id']){delete _0x2f71ca[_0xa599('0x4a')]['id'];}return db[_0xa599('0x2d')][_0xa599('0x4c')]({'where':{'id':_0x2f71ca[_0xa599('0x48')]['id']}})[_0xa599('0x27')](handleEntityNotFound(_0x3fe8ca,null))[_0xa599('0x27')](saveUpdates(_0x2f71ca[_0xa599('0x4a')],null))['then'](respondWithResult(_0x3fe8ca,null))['catch'](handleError(_0x3fe8ca,null));};exports[_0xa599('0x4d')]=function(_0x15647d,_0x5b429c){return db['MailServerOut']['find']({'where':{'id':_0x15647d[_0xa599('0x48')]['id']}})[_0xa599('0x27')](handleEntityNotFound(_0x5b429c,null))[_0xa599('0x27')](removeEntity(_0x5b429c,null))[_0xa599('0x4b')](handleError(_0x5b429c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eee9f61..de58a44 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 _0xc5fe=['../../config/environment','exports','mail_servers_out','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc5fe,0x1e0));var _0xec5f=function(_0xcdc46b,_0x5007bf){_0xcdc46b=_0xcdc46b-0x0;var _0x4f46cb=_0xc5fe[_0xcdc46b];return _0x4f46cb;};'use strict';var _=require('lodash');var util=require(_0xec5f('0x0'));var logger=require(_0xec5f('0x1'))(_0xec5f('0x2'));var moment=require(_0xec5f('0x3'));var BPromise=require(_0xec5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec5f('0x5'));var rimraf=require('rimraf');var config=require(_0xec5f('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xec5f('0x7')]=function(_0x5da9fe,_0x55d28e){return _0x5da9fe['define']('MailServerOut',attributes,{'tableName':_0xec5f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3377=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x77a933,_0x1cdd24){var _0x9df572=function(_0x3e3c6a){while(--_0x3e3c6a){_0x77a933['push'](_0x77a933['shift']());}};_0x9df572(++_0x1cdd24);}(_0x3377,0x1e4));var _0x7337=function(_0x183eac,_0x296f89){_0x183eac=_0x183eac-0x0;var _0x59c060=_0x3377[_0x183eac];return _0x59c060;};'use strict';var _=require(_0x7337('0x0'));var util=require(_0x7337('0x1'));var logger=require(_0x7337('0x2'))('api');var moment=require(_0x7337('0x3'));var BPromise=require(_0x7337('0x4'));var rp=require(_0x7337('0x5'));var fs=require('fs');var path=require(_0x7337('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7337('0x7'));module[_0x7337('0x8')]=function(_0x21c613,_0x33497c){return _0x21c613[_0x7337('0x9')](_0x7337('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2fd8704..0209b22 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4702cf,_0x5e6a24){var _0x45d9b9=function(_0x3bed56){while(--_0x3bed56){_0x4702cf['push'](_0x4702cf['shift']());}};_0x45d9b9(++_0x5e6a24);}(_0x1261,0x144));var _0x1126=function(_0x18e333,_0x1caf42){_0x18e333=_0x18e333-0x0;var _0x41c26e=_0x1261[_0x18e333];return _0x41c26e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x72527e,_0x313f59){var _0x345f19=function(_0x496bcf){while(--_0x496bcf){_0x72527e['push'](_0x72527e['shift']());}};_0x345f19(++_0x313f59);}(_0x2ef3,0xba));var _0x32ef=function(_0x5de1d4,_0x31b8cf){_0x5de1d4=_0x5de1d4-0x0;var _0x52e857=_0x2ef3[_0x5de1d4];return _0x52e857;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fdb41e5..edf8897 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 _0x0d69=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','create','put','update','delete','destroy'];(function(_0x2d7894,_0x424de2){var _0x5a5bfc=function(_0x2b8019){while(--_0x2b8019){_0x2d7894['push'](_0x2d7894['shift']());}};_0x5a5bfc(++_0x424de2);}(_0x0d69,0xa8));var _0x90d6=function(_0x7ac4c8,_0x270ea5){_0x7ac4c8=_0x7ac4c8-0x0;var _0x3e0ed0=_0x0d69[_0x7ac4c8];return _0x3e0ed0;};'use strict';var multer=require(_0x90d6('0x0'));var util=require(_0x90d6('0x1'));var path=require(_0x90d6('0x2'));var timeout=require(_0x90d6('0x3'));var express=require(_0x90d6('0x4'));var router=express['Router']();var fs_extra=require(_0x90d6('0x5'));var auth=require(_0x90d6('0x6'));var interaction=require(_0x90d6('0x7'));var config=require(_0x90d6('0x8'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x90d6('0x9')](),controller[_0x90d6('0xa')]);router['get'](_0x90d6('0xb'),auth[_0x90d6('0x9')](),controller[_0x90d6('0xc')]);router[_0x90d6('0xd')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0xf')]);router['post']('/',auth[_0x90d6('0x9')](),controller[_0x90d6('0x10')]);router[_0x90d6('0x11')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0x12')]);router[_0x90d6('0x13')](_0x90d6('0xe'),auth[_0x90d6('0x9')](),controller[_0x90d6('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc52a=['/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc52a,0x197));var _0xac52=function(_0x48b2cb,_0x5da5e7){_0x48b2cb=_0x48b2cb-0x0;var _0x3ad90f=_0xc52a[_0x48b2cb];return _0x3ad90f;};'use strict';var multer=require(_0xac52('0x0'));var util=require(_0xac52('0x1'));var path=require('path');var timeout=require(_0xac52('0x2'));var express=require(_0xac52('0x3'));var router=express[_0xac52('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac52('0x5'));var config=require('../../config/environment');var controller=require(_0xac52('0x6'));router[_0xac52('0x7')]('/',auth[_0xac52('0x8')](),controller[_0xac52('0x9')]);router[_0xac52('0x7')](_0xac52('0xa'),auth[_0xac52('0x8')](),controller['describe']);router['get'](_0xac52('0xb'),auth[_0xac52('0x8')](),controller[_0xac52('0xc')]);router[_0xac52('0xd')]('/',auth[_0xac52('0x8')](),controller[_0xac52('0xe')]);router[_0xac52('0xf')](_0xac52('0xb'),auth[_0xac52('0x8')](),controller[_0xac52('0x10')]);router[_0xac52('0x11')]('/:id',auth[_0xac52('0x8')](),controller[_0xac52('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index dd271ec..890445b 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 _0xcd59=['exports','STRING','name','sequelize'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xcd59[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'name':{'type':Sequelize[_0x9cd5('0x2')],'unique':_0x9cd5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9cd5('0x2')]}}; \ No newline at end of file +var _0x2d72=['sequelize','exports','STRING','name'];(function(_0x2abd62,_0x36911e){var _0x1c41af=function(_0x431f8f){while(--_0x431f8f){_0x2abd62['push'](_0x2abd62['shift']());}};_0x1c41af(++_0x36911e);}(_0x2d72,0xa8));var _0x22d7=function(_0x2cafbe,_0x189598){_0x2cafbe=_0x2cafbe-0x0;var _0x2d99a9=_0x2d72[_0x2cafbe];return _0x2d99a9;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'name':{'type':Sequelize[_0x22d7('0x2')],'unique':_0x22d7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 4d4e267..9076fdd 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 _0x2581=['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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x433439,_0x46c160){var _0x5d7489=function(_0x55505e){while(--_0x55505e){_0x433439['push'](_0x433439['shift']());}};_0x5d7489(++_0x46c160);}(_0x2581,0xda));var _0x1258=function(_0x41acdb,_0x21d8fd){_0x41acdb=_0x41acdb-0x0;var _0x1273c7=_0x2581[_0x41acdb];return _0x1273c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1258('0x0'));var jsonpatch=require(_0x1258('0x1'));var rp=require(_0x1258('0x2'));var moment=require(_0x1258('0x3'));var BPromise=require(_0x1258('0x4'));var Mustache=require('mustache');var util=require(_0x1258('0x5'));var path=require(_0x1258('0x6'));var sox=require(_0x1258('0x7'));var csv=require('to-csv');var ejs=require(_0x1258('0x8'));var fs=require('fs');var fs_extra=require(_0x1258('0x9'));var _=require(_0x1258('0xa'));var squel=require('squel');var crypto=require(_0x1258('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1258('0xc'));var toCsv=require(_0x1258('0xd'));var querystring=require(_0x1258('0xe'));var Papa=require(_0x1258('0xf'));var Redis=require(_0x1258('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1258('0x11'));var as=require(_0x1258('0x12'));var hardwareService=require(_0x1258('0x13'));var logger=require(_0x1258('0x14'))(_0x1258('0x15'));var utils=require(_0x1258('0x16'));var config=require(_0x1258('0x17'));var licenseUtil=require(_0x1258('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451d95,_0x32a615){_0x32a615=_0x32a615||0xcc;return function(_0x5b389){if(_0x5b389){return _0x451d95[_0x1258('0x19')](_0x32a615);}return _0x451d95[_0x1258('0x1a')](_0x32a615)[_0x1258('0x1b')]();};}function respondWithResult(_0x407da4,_0x524c93){_0x524c93=_0x524c93||0xc8;return function(_0x3c036d){if(_0x3c036d){return _0x407da4[_0x1258('0x1a')](_0x524c93)[_0x1258('0x1c')](_0x3c036d);}};}function respondWithFilteredResult(_0x31f8ac,_0x517f2a){return function(_0x45e134){if(_0x45e134){var _0x594929=typeof _0x517f2a['offset']===_0x1258('0x1d')&&typeof _0x517f2a[_0x1258('0x1e')]===_0x1258('0x1d');var _0x5a34f1=_0x45e134[_0x1258('0x1f')];var _0x4a5774=_0x594929?0x0:_0x517f2a[_0x1258('0x20')];var _0x4bd10e=_0x594929?_0x45e134[_0x1258('0x1f')]:_0x517f2a[_0x1258('0x20')]+_0x517f2a[_0x1258('0x1e')];var _0x4e1817;if(_0x4bd10e>=_0x5a34f1){_0x4bd10e=_0x5a34f1;_0x4e1817=0xc8;}else{_0x4e1817=0xce;}_0x31f8ac['status'](_0x4e1817);return _0x31f8ac[_0x1258('0x21')](_0x1258('0x22'),_0x4a5774+'-'+_0x4bd10e+'/'+_0x5a34f1)[_0x1258('0x1c')](_0x45e134);}return null;};}function patchUpdates(_0x47e9cd){return function(_0x20a9da){try{jsonpatch[_0x1258('0x23')](_0x20a9da,_0x47e9cd,!![]);}catch(_0x186f2b){return BPromise[_0x1258('0x24')](_0x186f2b);}return _0x20a9da['save']();};}function saveUpdates(_0x57f158,_0xba817f){return function(_0x3e5f77){if(_0x3e5f77){return _0x3e5f77[_0x1258('0x25')](_0x57f158)['then'](function(_0x4c29f0){return _0x4c29f0;});}return null;};}function removeEntity(_0x489e65,_0x2226ab){return function(_0x3d1098){if(_0x3d1098){return _0x3d1098['destroy']()[_0x1258('0x26')](function(){_0x489e65[_0x1258('0x1a')](0xcc)[_0x1258('0x1b')]();});}};}function handleEntityNotFound(_0x2adf14,_0x2e4c78){return function(_0x59dba1){if(!_0x59dba1){_0x2adf14[_0x1258('0x19')](0x194);}return _0x59dba1;};}function handleError(_0x2e15d3,_0x2219b3){_0x2219b3=_0x2219b3||0x1f4;return function(_0x4948ff){logger[_0x1258('0x27')](_0x4948ff[_0x1258('0x28')]);if(_0x4948ff[_0x1258('0x29')]){delete _0x4948ff[_0x1258('0x29')];}_0x2e15d3[_0x1258('0x1a')](_0x2219b3)[_0x1258('0x2a')](_0x4948ff);};}exports['index']=function(_0x17ddff,_0xdc1488){var _0x187168={},_0x38f4b0={},_0x2d419d={'count':0x0,'rows':[]};var _0xd3a080=_[_0x1258('0x2b')](db[_0x1258('0x2c')][_0x1258('0x2d')],function(_0x53f2b5){return{'name':_0x53f2b5[_0x1258('0x2e')],'type':_0x53f2b5['type'][_0x1258('0x2f')]};});_0x38f4b0[_0x1258('0x30')]=_['map'](_0xd3a080,_0x1258('0x29'));_0x38f4b0[_0x1258('0x31')]=_[_0x1258('0x32')](_0x17ddff[_0x1258('0x31')]);_0x38f4b0['filters']=_['intersection'](_0x38f4b0[_0x1258('0x30')],_0x38f4b0[_0x1258('0x31')]);_0x187168[_0x1258('0x33')]=_[_0x1258('0x34')](_0x38f4b0[_0x1258('0x30')],qs['fields'](_0x17ddff[_0x1258('0x31')][_0x1258('0x35')]));_0x187168[_0x1258('0x33')]=_0x187168[_0x1258('0x33')][_0x1258('0x36')]?_0x187168[_0x1258('0x33')]:_0x38f4b0[_0x1258('0x30')];if(!_0x17ddff[_0x1258('0x31')][_0x1258('0x37')]('nolimit')){_0x187168[_0x1258('0x1e')]=qs[_0x1258('0x1e')](_0x17ddff[_0x1258('0x31')][_0x1258('0x1e')]);_0x187168['offset']=qs[_0x1258('0x20')](_0x17ddff[_0x1258('0x31')][_0x1258('0x20')]);}_0x187168[_0x1258('0x38')]=qs['sort'](_0x17ddff['query'][_0x1258('0x39')]);_0x187168[_0x1258('0x3a')]=qs['filters'](_[_0x1258('0x3b')](_0x17ddff['query'],_0x38f4b0[_0x1258('0x3c')]),_0xd3a080);if(_0x17ddff[_0x1258('0x31')][_0x1258('0x3d')]){_0x187168[_0x1258('0x3a')]=_[_0x1258('0x3e')](_0x187168[_0x1258('0x3a')],{'$or':_[_0x1258('0x2b')](_0xd3a080,function(_0x4d5fb1){if(_0x4d5fb1['type']!==_0x1258('0x3f')){var _0x28d637={};_0x28d637[_0x4d5fb1[_0x1258('0x29')]]={'$like':'%'+_0x17ddff['query']['filter']+'%'};return _0x28d637;}})});}_0x187168=_['merge']({},_0x187168,_0x17ddff['options']);var _0x3a4f8f={'where':_0x187168[_0x1258('0x3a')]};return db[_0x1258('0x2c')][_0x1258('0x1f')](_0x3a4f8f)['then'](function(_0x256db6){_0x2d419d[_0x1258('0x1f')]=_0x256db6;if(_0x17ddff['query'][_0x1258('0x40')]){_0x187168[_0x1258('0x41')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x187168);})['then'](function(_0x30afa3){_0x2d419d[_0x1258('0x42')]=_0x30afa3;return _0x2d419d;})['then'](respondWithFilteredResult(_0xdc1488,_0x187168))[_0x1258('0x43')](handleError(_0xdc1488,null));};exports[_0x1258('0x44')]=function(_0x48b8a2,_0xd6c33b){var _0x181750={'raw':!![],'where':{'id':_0x48b8a2[_0x1258('0x45')]['id']}},_0x571d42={};_0x571d42[_0x1258('0x30')]=_[_0x1258('0x32')](db[_0x1258('0x2c')][_0x1258('0x2d')]);_0x571d42[_0x1258('0x31')]=_['keys'](_0x48b8a2['query']);_0x571d42[_0x1258('0x3c')]=_[_0x1258('0x34')](_0x571d42[_0x1258('0x30')],_0x571d42[_0x1258('0x31')]);_0x181750['attributes']=_[_0x1258('0x34')](_0x571d42['model'],qs[_0x1258('0x35')](_0x48b8a2['query'][_0x1258('0x35')]));_0x181750['attributes']=_0x181750[_0x1258('0x33')]['length']?_0x181750[_0x1258('0x33')]:_0x571d42['model'];if(_0x48b8a2[_0x1258('0x31')][_0x1258('0x40')]){_0x181750['include']=[{'all':!![]}];}_0x181750=_['merge']({},_0x181750,_0x48b8a2['options']);return db['MailSubstatus'][_0x1258('0x46')](_0x181750)[_0x1258('0x26')](handleEntityNotFound(_0xd6c33b,null))[_0x1258('0x26')](respondWithResult(_0xd6c33b,null))['catch'](handleError(_0xd6c33b,null));};exports[_0x1258('0x47')]=function(_0x282699,_0x3d85f0){return db[_0x1258('0x2c')][_0x1258('0x47')](_0x282699[_0x1258('0x48')],{})[_0x1258('0x26')](respondWithResult(_0x3d85f0,0xc9))['catch'](handleError(_0x3d85f0,null));};exports[_0x1258('0x25')]=function(_0x1037f3,_0x34fa20){if(_0x1037f3[_0x1258('0x48')]['id']){delete _0x1037f3[_0x1258('0x48')]['id'];}return db[_0x1258('0x2c')][_0x1258('0x46')]({'where':{'id':_0x1037f3['params']['id']}})['then'](handleEntityNotFound(_0x34fa20,null))[_0x1258('0x26')](saveUpdates(_0x1037f3[_0x1258('0x48')],null))[_0x1258('0x26')](respondWithResult(_0x34fa20,null))[_0x1258('0x43')](handleError(_0x34fa20,null));};exports[_0x1258('0x49')]=function(_0x4fb9b7,_0x29cbb2){return db[_0x1258('0x2c')][_0x1258('0x46')]({'where':{'id':_0x4fb9b7[_0x1258('0x45')]['id']}})['then'](handleEntityNotFound(_0x29cbb2,null))[_0x1258('0x26')](removeEntity(_0x29cbb2,null))['catch'](handleError(_0x29cbb2,null));};exports[_0x1258('0x4a')]=function(_0xad48a3,_0x58e279){return db[_0x1258('0x2c')][_0x1258('0x4a')]()[_0x1258('0x26')](respondWithResult(_0x58e279,null))['catch'](handleError(_0x58e279,null));}; \ No newline at end of file +var _0xe59c=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','MailSubstatus','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x12db52,_0x2f4f54){var _0x2b91bd=function(_0x1a20f0){while(--_0x1a20f0){_0x12db52['push'](_0x12db52['shift']());}};_0x2b91bd(++_0x2f4f54);}(_0xe59c,0x1aa));var _0xce59=function(_0x377c90,_0x3faf86){_0x377c90=_0x377c90-0x0;var _0x251bbc=_0xe59c[_0x377c90];return _0x251bbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce59('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce59('0x1'));var rp=require(_0xce59('0x2'));var moment=require(_0xce59('0x3'));var BPromise=require(_0xce59('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xce59('0x5'));var csv=require(_0xce59('0x6'));var ejs=require(_0xce59('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce59('0x8'));var squel=require(_0xce59('0x9'));var crypto=require(_0xce59('0xa'));var jsforce=require(_0xce59('0xb'));var deskjs=require(_0xce59('0xc'));var toCsv=require(_0xce59('0x6'));var querystring=require(_0xce59('0xd'));var Papa=require(_0xce59('0xe'));var Redis=require(_0xce59('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce59('0x10'));var hardwareService=require(_0xce59('0x11'));var logger=require('../../config/logger')(_0xce59('0x12'));var utils=require(_0xce59('0x13'));var config=require(_0xce59('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8e525e,_0x13b3b1){_0x13b3b1=_0x13b3b1||0xcc;return function(_0x402bb7){if(_0x402bb7){return _0x8e525e[_0xce59('0x15')](_0x13b3b1);}return _0x8e525e[_0xce59('0x16')](_0x13b3b1)['end']();};}function respondWithResult(_0x52a7f9,_0x156314){_0x156314=_0x156314||0xc8;return function(_0x214369){if(_0x214369){return _0x52a7f9[_0xce59('0x16')](_0x156314)[_0xce59('0x17')](_0x214369);}};}function respondWithFilteredResult(_0x334731,_0x539e74){return function(_0xd91ef6){if(_0xd91ef6){var _0x45267e=typeof _0x539e74['offset']===_0xce59('0x18')&&typeof _0x539e74['limit']===_0xce59('0x18');var _0x36627b=_0xd91ef6['count'];var _0x47ca6c=_0x45267e?0x0:_0x539e74['offset'];var _0x512c7c=_0x45267e?_0xd91ef6[_0xce59('0x19')]:_0x539e74['offset']+_0x539e74[_0xce59('0x1a')];var _0x40c8b1;if(_0x512c7c>=_0x36627b){_0x512c7c=_0x36627b;_0x40c8b1=0xc8;}else{_0x40c8b1=0xce;}_0x334731[_0xce59('0x16')](_0x40c8b1);return _0x334731[_0xce59('0x1b')](_0xce59('0x1c'),_0x47ca6c+'-'+_0x512c7c+'/'+_0x36627b)['json'](_0xd91ef6);}return null;};}function patchUpdates(_0x1b04d8){return function(_0x3d8e2b){try{jsonpatch[_0xce59('0x1d')](_0x3d8e2b,_0x1b04d8,!![]);}catch(_0xea770){return BPromise[_0xce59('0x1e')](_0xea770);}return _0x3d8e2b[_0xce59('0x1f')]();};}function saveUpdates(_0x1dd874,_0x5c86da){return function(_0x4955d0){if(_0x4955d0){return _0x4955d0[_0xce59('0x20')](_0x1dd874)[_0xce59('0x21')](function(_0x438da3){return _0x438da3;});}return null;};}function removeEntity(_0xa5b241,_0x49458f){return function(_0x3e3106){if(_0x3e3106){return _0x3e3106[_0xce59('0x22')]()[_0xce59('0x21')](function(){_0xa5b241[_0xce59('0x16')](0xcc)[_0xce59('0x23')]();});}};}function handleEntityNotFound(_0x299015,_0x32bf53){return function(_0x24dd96){if(!_0x24dd96){_0x299015[_0xce59('0x15')](0x194);}return _0x24dd96;};}function handleError(_0xcb525f,_0x3bdaf4){_0x3bdaf4=_0x3bdaf4||0x1f4;return function(_0x49576f){logger[_0xce59('0x24')](_0x49576f[_0xce59('0x25')]);if(_0x49576f['name']){delete _0x49576f[_0xce59('0x26')];}_0xcb525f['status'](_0x3bdaf4)['send'](_0x49576f);};}exports[_0xce59('0x27')]=function(_0x4dbcd9,_0x3f1668){var _0x2d0f3e={},_0x43e1f2={},_0x3f7908={'count':0x0,'rows':[]};var _0x3bcdb9=_[_0xce59('0x28')](db[_0xce59('0x29')]['rawAttributes'],function(_0x1f9eb5){return{'name':_0x1f9eb5['fieldName'],'type':_0x1f9eb5[_0xce59('0x2a')][_0xce59('0x2b')]};});_0x43e1f2[_0xce59('0x2c')]=_['map'](_0x3bcdb9,_0xce59('0x26'));_0x43e1f2[_0xce59('0x2d')]=_[_0xce59('0x2e')](_0x4dbcd9[_0xce59('0x2d')]);_0x43e1f2[_0xce59('0x2f')]=_[_0xce59('0x30')](_0x43e1f2[_0xce59('0x2c')],_0x43e1f2['query']);_0x2d0f3e[_0xce59('0x31')]=_[_0xce59('0x30')](_0x43e1f2[_0xce59('0x2c')],qs[_0xce59('0x32')](_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x32')]));_0x2d0f3e['attributes']=_0x2d0f3e['attributes'][_0xce59('0x33')]?_0x2d0f3e['attributes']:_0x43e1f2[_0xce59('0x2c')];if(!_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x34')](_0xce59('0x35'))){_0x2d0f3e[_0xce59('0x1a')]=qs[_0xce59('0x1a')](_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x1a')]);_0x2d0f3e[_0xce59('0x36')]=qs[_0xce59('0x36')](_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x36')]);}_0x2d0f3e[_0xce59('0x37')]=qs[_0xce59('0x38')](_0x4dbcd9['query']['sort']);_0x2d0f3e[_0xce59('0x39')]=qs[_0xce59('0x2f')](_[_0xce59('0x3a')](_0x4dbcd9[_0xce59('0x2d')],_0x43e1f2[_0xce59('0x2f')]),_0x3bcdb9);if(_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x3b')]){_0x2d0f3e[_0xce59('0x39')]=_[_0xce59('0x3c')](_0x2d0f3e[_0xce59('0x39')],{'$or':_[_0xce59('0x28')](_0x3bcdb9,function(_0x13ef2d){if(_0x13ef2d[_0xce59('0x2a')]!==_0xce59('0x3d')){var _0x37fe8f={};_0x37fe8f[_0x13ef2d[_0xce59('0x26')]]={'$like':'%'+_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x3b')]+'%'};return _0x37fe8f;}})});}_0x2d0f3e=_['merge']({},_0x2d0f3e,_0x4dbcd9[_0xce59('0x3e')]);var _0x3d109d={'where':_0x2d0f3e['where']};return db['MailSubstatus'][_0xce59('0x19')](_0x3d109d)[_0xce59('0x21')](function(_0x381014){_0x3f7908['count']=_0x381014;if(_0x4dbcd9[_0xce59('0x2d')][_0xce59('0x3f')]){_0x2d0f3e[_0xce59('0x40')]=[{'all':!![]}];}return db[_0xce59('0x29')][_0xce59('0x41')](_0x2d0f3e);})['then'](function(_0x31fa8f){_0x3f7908[_0xce59('0x42')]=_0x31fa8f;return _0x3f7908;})[_0xce59('0x21')](respondWithFilteredResult(_0x3f1668,_0x2d0f3e))['catch'](handleError(_0x3f1668,null));};exports['show']=function(_0x4084c9,_0xdf706b){var _0x14358a={'raw':!![],'where':{'id':_0x4084c9[_0xce59('0x43')]['id']}},_0x2c4a5f={};_0x2c4a5f[_0xce59('0x2c')]=_[_0xce59('0x2e')](db[_0xce59('0x29')]['rawAttributes']);_0x2c4a5f[_0xce59('0x2d')]=_[_0xce59('0x2e')](_0x4084c9['query']);_0x2c4a5f[_0xce59('0x2f')]=_[_0xce59('0x30')](_0x2c4a5f['model'],_0x2c4a5f[_0xce59('0x2d')]);_0x14358a[_0xce59('0x31')]=_['intersection'](_0x2c4a5f[_0xce59('0x2c')],qs[_0xce59('0x32')](_0x4084c9[_0xce59('0x2d')]['fields']));_0x14358a['attributes']=_0x14358a[_0xce59('0x31')]['length']?_0x14358a[_0xce59('0x31')]:_0x2c4a5f[_0xce59('0x2c')];if(_0x4084c9[_0xce59('0x2d')][_0xce59('0x3f')]){_0x14358a[_0xce59('0x40')]=[{'all':!![]}];}_0x14358a=_[_0xce59('0x3c')]({},_0x14358a,_0x4084c9['options']);return db[_0xce59('0x29')][_0xce59('0x44')](_0x14358a)[_0xce59('0x21')](handleEntityNotFound(_0xdf706b,null))[_0xce59('0x21')](respondWithResult(_0xdf706b,null))[_0xce59('0x45')](handleError(_0xdf706b,null));};exports[_0xce59('0x46')]=function(_0x113cd1,_0x31867b){return db[_0xce59('0x29')][_0xce59('0x46')](_0x113cd1[_0xce59('0x47')],{})[_0xce59('0x21')](respondWithResult(_0x31867b,0xc9))[_0xce59('0x45')](handleError(_0x31867b,null));};exports[_0xce59('0x20')]=function(_0x3ec0a5,_0x53870a){if(_0x3ec0a5[_0xce59('0x47')]['id']){delete _0x3ec0a5[_0xce59('0x47')]['id'];}return db['MailSubstatus'][_0xce59('0x44')]({'where':{'id':_0x3ec0a5['params']['id']}})[_0xce59('0x21')](handleEntityNotFound(_0x53870a,null))[_0xce59('0x21')](saveUpdates(_0x3ec0a5[_0xce59('0x47')],null))[_0xce59('0x21')](respondWithResult(_0x53870a,null))[_0xce59('0x45')](handleError(_0x53870a,null));};exports[_0xce59('0x22')]=function(_0x541a72,_0x296313){return db[_0xce59('0x29')][_0xce59('0x44')]({'where':{'id':_0x541a72[_0xce59('0x43')]['id']}})['then'](handleEntityNotFound(_0x296313,null))['then'](removeEntity(_0x296313,null))[_0xce59('0x45')](handleError(_0x296313,null));};exports[_0xce59('0x48')]=function(_0x571366,_0x4f0c8c){return db[_0xce59('0x29')][_0xce59('0x48')]()[_0xce59('0x21')](respondWithResult(_0x4f0c8c,null))['catch'](handleError(_0x4f0c8c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e089302..f88a6c1 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4686=['hasOwnProperty','hook','exports','MailSubstatus','update','emit'];(function(_0x5630db,_0x176962){var _0x2c40a6=function(_0x3c6fe4){while(--_0x3c6fe4){_0x5630db['push'](_0x5630db['shift']());}};_0x2c40a6(++_0x176962);}(_0x4686,0x1dd));var _0x6468=function(_0x53d85d,_0x36ca43){_0x53d85d=_0x53d85d-0x0;var _0x546a8a=_0x4686[_0x53d85d];return _0x546a8a;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x6468('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x6468('0x1')};function emitEvent(_0x5027c2){return function(_0x23d462,_0x15079a,_0x68f9b5){MailSubstatusEvents[_0x6468('0x2')](_0x5027c2+':'+_0x23d462['id'],_0x23d462);MailSubstatusEvents[_0x6468('0x2')](_0x5027c2,_0x23d462);_0x68f9b5(null);};}for(var e in events){if(events[_0x6468('0x3')](e)){var event=events[e];MailSubstatus[_0x6468('0x4')](e,emitEvent(event));}}module[_0x6468('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x2527=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x385e76,_0x464f24){var _0x1329d8=function(_0x4265a4){while(--_0x4265a4){_0x385e76['push'](_0x385e76['shift']());}};_0x1329d8(++_0x464f24);}(_0x2527,0x158));var _0x7252=function(_0x1c4a95,_0x220813){_0x1c4a95=_0x1c4a95-0x0;var _0x1c40b5=_0x2527[_0x1c4a95];return _0x1c40b5;};'use strict';var EventEmitter=require(_0x7252('0x0'));var MailSubstatus=require(_0x7252('0x1'))['db'][_0x7252('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7252('0x3')](0x0);var events={'afterUpdate':_0x7252('0x4')};function emitEvent(_0x4617ca){return function(_0x1b4a48,_0x33cb72,_0x4c811c){MailSubstatusEvents[_0x7252('0x5')](_0x4617ca+':'+_0x1b4a48['id'],_0x1b4a48);MailSubstatusEvents[_0x7252('0x5')](_0x4617ca,_0x1b4a48);_0x4c811c(null);};}for(var e in events){if(events[_0x7252('0x6')](e)){var event=events[e];MailSubstatus[_0x7252('0x7')](e,emitEvent(event));}}module[_0x7252('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index fa9c5b3..4077483 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 _0x023d=['name','mailSubstatus','_previousDataValues','catch','exports','models','mail_substatuses','Condition','update'];(function(_0x5dd752,_0x1be018){var _0x5066df=function(_0x53ea5f){while(--_0x53ea5f){_0x5dd752['push'](_0x5dd752['shift']());}};_0x5066df(++_0x1be018);}(_0x023d,0x67));var _0xd023=function(_0x53309c,_0x21c68a){_0x53309c=_0x53309c-0x0;var _0x13d243=_0x023d[_0x53309c];return _0x13d243;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xd023('0x0')]=function(_0x4f01da){var _0x2a85ec=_0x4f01da[_0xd023('0x1')];return _0x4f01da['define']('MailSubstatus',attributes,{'tableName':_0xd023('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4c460f,_0x35e6ed,_0x1c9881){return _0x2a85ec[_0xd023('0x3')][_0xd023('0x4')]({'value':_0x4c460f[_0xd023('0x5')]},{'where':{'field':_0xd023('0x6'),'value':_0x4c460f[_0xd023('0x7')]['name']}})['then'](function(){_0x1c9881();})[_0xd023('0x8')](function(_0x536bbd){_0x1c9881(_0x536bbd);});}}});}; \ No newline at end of file +var _0x2607=['catch','./mailSubstatus.attributes','exports','models','define','Condition','update','name','mailSubstatus','then'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0x2607,0x19b));var _0x7260=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x2607[_0x310d10];return _0x1fb8af;};'use strict';var attributes=require(_0x7260('0x0'));module[_0x7260('0x1')]=function(_0x555291){var _0x3ad0f2=_0x555291[_0x7260('0x2')];return _0x555291[_0x7260('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x8b269a,_0x50882a,_0x9433f3){return _0x3ad0f2[_0x7260('0x4')][_0x7260('0x5')]({'value':_0x8b269a[_0x7260('0x6')]},{'where':{'field':_0x7260('0x7'),'value':_0x8b269a['_previousDataValues']['name']}})[_0x7260('0x8')](function(){_0x9433f3();})[_0x7260('0x9')](function(_0x523e64){_0x9433f3(_0x523e64);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 85ae2cb..c8ac908 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 _0x9040=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x25e700,_0x120fb6){var _0x2d5367=function(_0x29e25a){while(--_0x29e25a){_0x25e700['push'](_0x25e700['shift']());}};_0x2d5367(++_0x120fb6);}(_0x9040,0x74));var _0x0904=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9040[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x0904('0x0'));var util=require(_0x0904('0x1'));var moment=require('moment');var BPromise=require(_0x0904('0x2'));var rs=require(_0x0904('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0904('0x4'));var logger=require(_0x0904('0x5'))(_0x0904('0x6'));var config=require(_0x0904('0x7'));var jayson=require(_0x0904('0x8'));var client=jayson[_0x0904('0x9')][_0x0904('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1963e2,_0x39335c,_0x4a1c3d){return new BPromise(function(_0x16c6b3,_0x334a23){return client['request'](_0x1963e2,_0x4a1c3d)[_0x0904('0xb')](function(_0x5ab8d7){logger[_0x0904('0xc')](_0x0904('0xd'),_0x39335c,_0x0904('0xe'));logger[_0x0904('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x39335c,'request\x20sent',JSON[_0x0904('0x10')](_0x5ab8d7));if(_0x5ab8d7[_0x0904('0x11')]){if(_0x5ab8d7[_0x0904('0x11')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x39335c,_0x5ab8d7[_0x0904('0x11')][_0x0904('0x12')]);return _0x334a23(_0x5ab8d7[_0x0904('0x11')][_0x0904('0x12')]);}logger[_0x0904('0x11')](_0x0904('0xd'),_0x39335c,_0x5ab8d7['error'][_0x0904('0x12')]);return _0x16c6b3(_0x5ab8d7[_0x0904('0x11')]['message']);}else{logger[_0x0904('0xc')](_0x0904('0xd'),_0x39335c,_0x0904('0xe'));_0x16c6b3(_0x5ab8d7['result'][_0x0904('0x12')]);}})[_0x0904('0x13')](function(_0x1e37b0){logger[_0x0904('0x11')](_0x0904('0xd'),_0x39335c,_0x1e37b0);_0x334a23(_0x1e37b0);});});} \ No newline at end of file +var _0x1abe=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util','moment','bluebird','randomstring'];(function(_0x117a69,_0x31d289){var _0x758ef9=function(_0x5ad710){while(--_0x5ad710){_0x117a69['push'](_0x117a69['shift']());}};_0x758ef9(++_0x31d289);}(_0x1abe,0xc2));var _0xe1ab=function(_0x4d960f,_0x2ea3e3){_0x4d960f=_0x4d960f-0x0;var _0x37471f=_0x1abe[_0x4d960f];return _0x37471f;};'use strict';var _=require('lodash');var util=require(_0xe1ab('0x0'));var moment=require(_0xe1ab('0x1'));var BPromise=require(_0xe1ab('0x2'));var rs=require(_0xe1ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1ab('0x4'));var logger=require(_0xe1ab('0x5'))(_0xe1ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xe1ab('0x7'));var client=jayson[_0xe1ab('0x8')][_0xe1ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ca1e4,_0x204853,_0x4ab978){return new BPromise(function(_0x4ff408,_0x32cb6c){return client[_0xe1ab('0xa')](_0x4ca1e4,_0x4ab978)['then'](function(_0x330328){logger['info'](_0xe1ab('0xb'),_0x204853,'request\x20sent');logger[_0xe1ab('0xc')](_0xe1ab('0xd'),_0x204853,_0xe1ab('0xe'),JSON['stringify'](_0x330328));if(_0x330328[_0xe1ab('0xf')]){if(_0x330328[_0xe1ab('0xf')]['code']===0x1f4){logger[_0xe1ab('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x204853,_0x330328[_0xe1ab('0xf')]['message']);return _0x32cb6c(_0x330328[_0xe1ab('0xf')][_0xe1ab('0x10')]);}logger[_0xe1ab('0xf')](_0xe1ab('0xb'),_0x204853,_0x330328[_0xe1ab('0xf')]['message']);return _0x4ff408(_0x330328[_0xe1ab('0xf')][_0xe1ab('0x10')]);}else{logger['info'](_0xe1ab('0xb'),_0x204853,'request\x20sent');_0x4ff408(_0x330328['result']['message']);}})[_0xe1ab('0x11')](function(_0x1afc21){logger[_0xe1ab('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x204853,_0x1afc21);_0x32cb6c(_0x1afc21);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index efb7d95..4ae4e87 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 _0x0b32=['./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x0b32,0x110));var _0x20b3=function(_0x5c999e,_0x536932){_0x5c999e=_0x5c999e-0x0;var _0x2eb589=_0x0b32[_0x5c999e];return _0x2eb589;};'use strict';var multer=require(_0x20b3('0x0'));var util=require('util');var path=require(_0x20b3('0x1'));var timeout=require(_0x20b3('0x2'));var express=require(_0x20b3('0x3'));var router=express[_0x20b3('0x4')]();var fs_extra=require(_0x20b3('0x5'));var auth=require(_0x20b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20b3('0x7'));var controller=require(_0x20b3('0x8'));router['get']('/',auth[_0x20b3('0x9')](),controller[_0x20b3('0xa')]);router[_0x20b3('0xb')](_0x20b3('0xc'),auth[_0x20b3('0x9')](),controller[_0x20b3('0xd')]);router[_0x20b3('0xb')](_0x20b3('0xe'),auth[_0x20b3('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x20b3('0xf')]('/:id',auth[_0x20b3('0x9')](),controller[_0x20b3('0x10')]);router[_0x20b3('0x11')](_0x20b3('0xe'),auth[_0x20b3('0x9')](),controller[_0x20b3('0x12')]);module[_0x20b3('0x13')]=router; \ No newline at end of file +var _0x9b77=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','destroy','exports'];(function(_0x5962a8,_0x477c04){var _0x25b2bd=function(_0x5f3b7d){while(--_0x5f3b7d){_0x5962a8['push'](_0x5962a8['shift']());}};_0x25b2bd(++_0x477c04);}(_0x9b77,0x169));var _0x79b7=function(_0x325c1d,_0xaac33){_0x325c1d=_0x325c1d-0x0;var _0x41620d=_0x9b77[_0x325c1d];return _0x41620d;};'use strict';var multer=require('multer');var util=require(_0x79b7('0x0'));var path=require(_0x79b7('0x1'));var timeout=require(_0x79b7('0x2'));var express=require(_0x79b7('0x3'));var router=express[_0x79b7('0x4')]();var fs_extra=require(_0x79b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x79b7('0x6'));var config=require(_0x79b7('0x7'));var controller=require('./mailTransferReport.controller');router[_0x79b7('0x8')]('/',auth[_0x79b7('0x9')](),controller[_0x79b7('0xa')]);router[_0x79b7('0x8')](_0x79b7('0xb'),auth['isAuthenticated'](),controller[_0x79b7('0xc')]);router[_0x79b7('0x8')](_0x79b7('0xd'),auth[_0x79b7('0x9')](),controller['show']);router[_0x79b7('0xe')]('/',auth[_0x79b7('0x9')](),controller['create']);router[_0x79b7('0xf')](_0x79b7('0xd'),auth[_0x79b7('0x9')](),controller['update']);router[_0x79b7('0x10')](_0x79b7('0xd'),auth[_0x79b7('0x9')](),controller[_0x79b7('0x11')]);module[_0x79b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 9772cca..388cc1f 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3ddbf5,_0x55a958){var _0x1caa47=function(_0x1715d1){while(--_0x1715d1){_0x3ddbf5['push'](_0x3ddbf5['shift']());}};_0x1caa47(++_0x55a958);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0xf3cd[_0x292423];return _0x2801cb;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3925ff,_0x3fe6e5){var _0x1f16d5=function(_0xc538a2){while(--_0xc538a2){_0x3925ff['push'](_0x3925ff['shift']());}};_0x1f16d5(++_0x3fe6e5);}(_0x34e8,0x12c));var _0x834e=function(_0x123dab,_0x17f98a){_0x123dab=_0x123dab-0x0;var _0x41bada=_0x34e8[_0x123dab];return _0x41bada;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 81515ac..af5e8d7 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 _0xa276=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','MailTransferReport','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','update','find','describe','eml-format','rimraf','zip-dir'];(function(_0x180770,_0xbc82cf){var _0x2b0def=function(_0x4a0533){while(--_0x4a0533){_0x180770['push'](_0x180770['shift']());}};_0x2b0def(++_0xbc82cf);}(_0xa276,0x8b));var _0x6a27=function(_0x22ada8,_0x23a7ea){_0x22ada8=_0x22ada8-0x0;var _0x506e36=_0xa276[_0x22ada8];return _0x506e36;};'use strict';var emlformat=require(_0x6a27('0x0'));var rimraf=require(_0x6a27('0x1'));var zipdir=require(_0x6a27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a27('0x3'));var BPromise=require(_0x6a27('0x4'));var Mustache=require('mustache');var util=require(_0x6a27('0x5'));var path=require(_0x6a27('0x6'));var sox=require(_0x6a27('0x7'));var csv=require(_0x6a27('0x8'));var ejs=require(_0x6a27('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a27('0xa'));var squel=require(_0x6a27('0xb'));var crypto=require(_0x6a27('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6a27('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6a27('0xe'));var Papa=require(_0x6a27('0xf'));var Redis=require(_0x6a27('0x10'));var authService=require(_0x6a27('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a27('0x12'));var hardwareService=require(_0x6a27('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a27('0x14'));var licenseUtil=require(_0x6a27('0x15'));var db=require(_0x6a27('0x16'))['db'];function respondWithStatusCode(_0x326bad,_0x226dc2){_0x226dc2=_0x226dc2||0xcc;return function(_0x37c0a8){if(_0x37c0a8){return _0x326bad[_0x6a27('0x17')](_0x226dc2);}return _0x326bad[_0x6a27('0x18')](_0x226dc2)[_0x6a27('0x19')]();};}function respondWithResult(_0x8f5a96,_0x4a1d9e){_0x4a1d9e=_0x4a1d9e||0xc8;return function(_0x297591){if(_0x297591){return _0x8f5a96[_0x6a27('0x18')](_0x4a1d9e)[_0x6a27('0x1a')](_0x297591);}};}function respondWithFilteredResult(_0x387774,_0x261933){return function(_0x46271c){if(_0x46271c){var _0x1b67f6=typeof _0x261933[_0x6a27('0x1b')]===_0x6a27('0x1c')&&typeof _0x261933[_0x6a27('0x1d')]===_0x6a27('0x1c');var _0x467c0f=_0x46271c[_0x6a27('0x1e')];var _0x42e4f=_0x1b67f6?0x0:_0x261933[_0x6a27('0x1b')];var _0x647410=_0x1b67f6?_0x46271c[_0x6a27('0x1e')]:_0x261933[_0x6a27('0x1b')]+_0x261933[_0x6a27('0x1d')];var _0x57d010;if(_0x647410>=_0x467c0f){_0x647410=_0x467c0f;_0x57d010=0xc8;}else{_0x57d010=0xce;}_0x387774[_0x6a27('0x18')](_0x57d010);return _0x387774['set']('Content-Range',_0x42e4f+'-'+_0x647410+'/'+_0x467c0f)[_0x6a27('0x1a')](_0x46271c);}return null;};}function patchUpdates(_0x2017bd){return function(_0x4bf498){try{jsonpatch[_0x6a27('0x1f')](_0x4bf498,_0x2017bd,!![]);}catch(_0x499897){return BPromise[_0x6a27('0x20')](_0x499897);}return _0x4bf498[_0x6a27('0x21')]();};}function saveUpdates(_0x15570d,_0x1b506f){return function(_0x2b05f5){if(_0x2b05f5){return _0x2b05f5['update'](_0x15570d)[_0x6a27('0x22')](function(_0x4a6334){return _0x4a6334;});}return null;};}function removeEntity(_0x23cc5e,_0x140719){return function(_0x50c493){if(_0x50c493){return _0x50c493[_0x6a27('0x23')]()[_0x6a27('0x22')](function(){_0x23cc5e[_0x6a27('0x18')](0xcc)[_0x6a27('0x19')]();});}};}function handleEntityNotFound(_0x2e4f23,_0x2a667a){return function(_0x216fce){if(!_0x216fce){_0x2e4f23[_0x6a27('0x17')](0x194);}return _0x216fce;};}function handleError(_0x1bbf04,_0x1e82d4){_0x1e82d4=_0x1e82d4||0x1f4;return function(_0x4162ac){logger['error'](_0x4162ac[_0x6a27('0x24')]);if(_0x4162ac[_0x6a27('0x25')]){delete _0x4162ac['name'];}_0x1bbf04[_0x6a27('0x18')](_0x1e82d4)[_0x6a27('0x26')](_0x4162ac);};}exports[_0x6a27('0x27')]=function(_0x389a02,_0x90ec67){var _0x5f0ac5={},_0x2d6220={},_0x3c6ef8={'count':0x0,'rows':[]};var _0x1c3667=_['map'](db[_0x6a27('0x28')]['rawAttributes'],function(_0x3bbd97){return{'name':_0x3bbd97['fieldName'],'type':_0x3bbd97[_0x6a27('0x29')]['key']};});_0x2d6220[_0x6a27('0x2a')]=_['map'](_0x1c3667,'name');_0x2d6220['query']=_['keys'](_0x389a02[_0x6a27('0x2b')]);_0x2d6220[_0x6a27('0x2c')]=_[_0x6a27('0x2d')](_0x2d6220[_0x6a27('0x2a')],_0x2d6220[_0x6a27('0x2b')]);_0x5f0ac5['attributes']=_['intersection'](_0x2d6220['model'],qs['fields'](_0x389a02[_0x6a27('0x2b')][_0x6a27('0x2e')]));_0x5f0ac5['attributes']=_0x5f0ac5['attributes'][_0x6a27('0x2f')]?_0x5f0ac5[_0x6a27('0x30')]:_0x2d6220[_0x6a27('0x2a')];if(!_0x389a02[_0x6a27('0x2b')][_0x6a27('0x31')](_0x6a27('0x32'))){_0x5f0ac5[_0x6a27('0x1d')]=qs[_0x6a27('0x1d')](_0x389a02[_0x6a27('0x2b')][_0x6a27('0x1d')]);_0x5f0ac5[_0x6a27('0x1b')]=qs[_0x6a27('0x1b')](_0x389a02['query'][_0x6a27('0x1b')]);}_0x5f0ac5[_0x6a27('0x33')]=qs['sort'](_0x389a02[_0x6a27('0x2b')]['sort']);_0x5f0ac5[_0x6a27('0x34')]=qs[_0x6a27('0x2c')](_[_0x6a27('0x35')](_0x389a02[_0x6a27('0x2b')],_0x2d6220['filters']),_0x1c3667);if(_0x389a02[_0x6a27('0x2b')][_0x6a27('0x36')]){_0x5f0ac5[_0x6a27('0x34')]=_['merge'](_0x5f0ac5['where'],{'$or':_['map'](_0x1c3667,function(_0x3236d8){if(_0x3236d8[_0x6a27('0x29')]!==_0x6a27('0x37')){var _0x3ff133={};_0x3ff133[_0x3236d8[_0x6a27('0x25')]]={'$like':'%'+_0x389a02[_0x6a27('0x2b')][_0x6a27('0x36')]+'%'};return _0x3ff133;}})});}_0x5f0ac5=_['merge']({},_0x5f0ac5,_0x389a02['options']);var _0x171937={'where':_0x5f0ac5[_0x6a27('0x34')]};return db[_0x6a27('0x28')][_0x6a27('0x1e')](_0x171937)[_0x6a27('0x22')](function(_0x3d3553){_0x3c6ef8['count']=_0x3d3553;if(_0x389a02[_0x6a27('0x2b')][_0x6a27('0x38')]){_0x5f0ac5[_0x6a27('0x39')]=[{'all':!![]}];}return db[_0x6a27('0x28')][_0x6a27('0x3a')](_0x5f0ac5);})[_0x6a27('0x22')](function(_0x76ef0){_0x3c6ef8[_0x6a27('0x3b')]=_0x76ef0;return _0x3c6ef8;})[_0x6a27('0x22')](respondWithFilteredResult(_0x90ec67,_0x5f0ac5))[_0x6a27('0x3c')](handleError(_0x90ec67,null));};exports[_0x6a27('0x3d')]=function(_0x479229,_0xd2d3d4){var _0x3febaf={'raw':!![],'where':{'id':_0x479229[_0x6a27('0x3e')]['id']}},_0x4ce623={};_0x4ce623[_0x6a27('0x2a')]=_[_0x6a27('0x3f')](db[_0x6a27('0x28')][_0x6a27('0x40')]);_0x4ce623[_0x6a27('0x2b')]=_['keys'](_0x479229[_0x6a27('0x2b')]);_0x4ce623[_0x6a27('0x2c')]=_['intersection'](_0x4ce623['model'],_0x4ce623[_0x6a27('0x2b')]);_0x3febaf[_0x6a27('0x30')]=_['intersection'](_0x4ce623[_0x6a27('0x2a')],qs[_0x6a27('0x2e')](_0x479229['query'][_0x6a27('0x2e')]));_0x3febaf['attributes']=_0x3febaf['attributes'][_0x6a27('0x2f')]?_0x3febaf[_0x6a27('0x30')]:_0x4ce623[_0x6a27('0x2a')];if(_0x479229[_0x6a27('0x2b')][_0x6a27('0x38')]){_0x3febaf[_0x6a27('0x39')]=[{'all':!![]}];}_0x3febaf=_['merge']({},_0x3febaf,_0x479229[_0x6a27('0x41')]);return db['MailTransferReport']['find'](_0x3febaf)[_0x6a27('0x22')](handleEntityNotFound(_0xd2d3d4,null))[_0x6a27('0x22')](respondWithResult(_0xd2d3d4,null))[_0x6a27('0x3c')](handleError(_0xd2d3d4,null));};exports[_0x6a27('0x42')]=function(_0x556c96,_0x450016){return db['MailTransferReport'][_0x6a27('0x42')](_0x556c96[_0x6a27('0x43')],{})['then'](respondWithResult(_0x450016,0xc9))['catch'](handleError(_0x450016,null));};exports[_0x6a27('0x44')]=function(_0x552062,_0x14e2b7){if(_0x552062[_0x6a27('0x43')]['id']){delete _0x552062[_0x6a27('0x43')]['id'];}return db[_0x6a27('0x28')]['find']({'where':{'id':_0x552062[_0x6a27('0x3e')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0x14e2b7,null))[_0x6a27('0x22')](saveUpdates(_0x552062['body'],null))['then'](respondWithResult(_0x14e2b7,null))[_0x6a27('0x3c')](handleError(_0x14e2b7,null));};exports[_0x6a27('0x23')]=function(_0xd8ed94,_0xbab1b9){return db['MailTransferReport'][_0x6a27('0x45')]({'where':{'id':_0xd8ed94[_0x6a27('0x3e')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0xbab1b9,null))[_0x6a27('0x22')](removeEntity(_0xbab1b9,null))[_0x6a27('0x3c')](handleError(_0xbab1b9,null));};exports[_0x6a27('0x46')]=function(_0x20918a,_0xac58d4){return db['MailTransferReport'][_0x6a27('0x46')]()[_0x6a27('0x22')](respondWithResult(_0xac58d4,null))[_0x6a27('0x3c')](handleError(_0xac58d4,null));}; \ No newline at end of file +var _0x4473=['undefined','limit','set','reject','update','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','show','includeAll','include','options','find','create','body','catch','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x5e186b,_0x17fb57){var _0x360a11=function(_0x134839){while(--_0x134839){_0x5e186b['push'](_0x5e186b['shift']());}};_0x360a11(++_0x17fb57);}(_0x4473,0xb5));var _0x3447=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4473[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x3447('0x0'));var rimraf=require(_0x3447('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3447('0x2'));var rp=require(_0x3447('0x3'));var moment=require(_0x3447('0x4'));var BPromise=require(_0x3447('0x5'));var Mustache=require('mustache');var util=require(_0x3447('0x6'));var path=require(_0x3447('0x7'));var sox=require('sox');var csv=require(_0x3447('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3447('0x9'));var _=require(_0x3447('0xa'));var squel=require('squel');var crypto=require(_0x3447('0xb'));var jsforce=require(_0x3447('0xc'));var deskjs=require(_0x3447('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3447('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3447('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3447('0x10'));var logger=require('../../config/logger')(_0x3447('0x11'));var utils=require(_0x3447('0x12'));var config=require(_0x3447('0x13'));var licenseUtil=require(_0x3447('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ecede,_0x31488d){_0x31488d=_0x31488d||0xcc;return function(_0x3b6d79){if(_0x3b6d79){return _0x1ecede[_0x3447('0x15')](_0x31488d);}return _0x1ecede[_0x3447('0x16')](_0x31488d)[_0x3447('0x17')]();};}function respondWithResult(_0x379030,_0x53d1d1){_0x53d1d1=_0x53d1d1||0xc8;return function(_0x547f3c){if(_0x547f3c){return _0x379030[_0x3447('0x16')](_0x53d1d1)[_0x3447('0x18')](_0x547f3c);}};}function respondWithFilteredResult(_0xd98783,_0xa57851){return function(_0x14404c){if(_0x14404c){var _0x4232f6=typeof _0xa57851[_0x3447('0x19')]===_0x3447('0x1a')&&typeof _0xa57851['limit']==='undefined';var _0x5b4395=_0x14404c['count'];var _0x4c85b8=_0x4232f6?0x0:_0xa57851[_0x3447('0x19')];var _0x15faa6=_0x4232f6?_0x14404c['count']:_0xa57851['offset']+_0xa57851[_0x3447('0x1b')];var _0x4d154a;if(_0x15faa6>=_0x5b4395){_0x15faa6=_0x5b4395;_0x4d154a=0xc8;}else{_0x4d154a=0xce;}_0xd98783[_0x3447('0x16')](_0x4d154a);return _0xd98783[_0x3447('0x1c')]('Content-Range',_0x4c85b8+'-'+_0x15faa6+'/'+_0x5b4395)['json'](_0x14404c);}return null;};}function patchUpdates(_0x212fed){return function(_0x2d94d9){try{jsonpatch['apply'](_0x2d94d9,_0x212fed,!![]);}catch(_0x32a354){return BPromise[_0x3447('0x1d')](_0x32a354);}return _0x2d94d9['save']();};}function saveUpdates(_0xe5c7ce,_0x14fc51){return function(_0x5bfce5){if(_0x5bfce5){return _0x5bfce5[_0x3447('0x1e')](_0xe5c7ce)[_0x3447('0x1f')](function(_0x417ca7){return _0x417ca7;});}return null;};}function removeEntity(_0x1ba35a,_0x28ccad){return function(_0x431df0){if(_0x431df0){return _0x431df0[_0x3447('0x20')]()['then'](function(){_0x1ba35a['status'](0xcc)[_0x3447('0x17')]();});}};}function handleEntityNotFound(_0x4da29d,_0x2723ef){return function(_0x4f504b){if(!_0x4f504b){_0x4da29d[_0x3447('0x15')](0x194);}return _0x4f504b;};}function handleError(_0x436c1c,_0x3442ca){_0x3442ca=_0x3442ca||0x1f4;return function(_0x28d73d){logger[_0x3447('0x21')](_0x28d73d['stack']);if(_0x28d73d[_0x3447('0x22')]){delete _0x28d73d[_0x3447('0x22')];}_0x436c1c[_0x3447('0x16')](_0x3442ca)[_0x3447('0x23')](_0x28d73d);};}exports[_0x3447('0x24')]=function(_0x2f86ad,_0x312915){var _0x2ffbf8={},_0x20e562={},_0x2ade30={'count':0x0,'rows':[]};var _0x3167bd=_[_0x3447('0x25')](db[_0x3447('0x26')][_0x3447('0x27')],function(_0x591e82){return{'name':_0x591e82['fieldName'],'type':_0x591e82[_0x3447('0x28')][_0x3447('0x29')]};});_0x20e562[_0x3447('0x2a')]=_[_0x3447('0x25')](_0x3167bd,_0x3447('0x22'));_0x20e562[_0x3447('0x2b')]=_[_0x3447('0x2c')](_0x2f86ad['query']);_0x20e562[_0x3447('0x2d')]=_[_0x3447('0x2e')](_0x20e562[_0x3447('0x2a')],_0x20e562['query']);_0x2ffbf8[_0x3447('0x2f')]=_[_0x3447('0x2e')](_0x20e562[_0x3447('0x2a')],qs[_0x3447('0x30')](_0x2f86ad[_0x3447('0x2b')][_0x3447('0x30')]));_0x2ffbf8[_0x3447('0x2f')]=_0x2ffbf8[_0x3447('0x2f')][_0x3447('0x31')]?_0x2ffbf8[_0x3447('0x2f')]:_0x20e562[_0x3447('0x2a')];if(!_0x2f86ad[_0x3447('0x2b')][_0x3447('0x32')](_0x3447('0x33'))){_0x2ffbf8[_0x3447('0x1b')]=qs['limit'](_0x2f86ad[_0x3447('0x2b')]['limit']);_0x2ffbf8['offset']=qs['offset'](_0x2f86ad[_0x3447('0x2b')][_0x3447('0x19')]);}_0x2ffbf8['order']=qs[_0x3447('0x34')](_0x2f86ad['query'][_0x3447('0x34')]);_0x2ffbf8[_0x3447('0x35')]=qs[_0x3447('0x2d')](_[_0x3447('0x36')](_0x2f86ad[_0x3447('0x2b')],_0x20e562['filters']),_0x3167bd);if(_0x2f86ad[_0x3447('0x2b')][_0x3447('0x37')]){_0x2ffbf8[_0x3447('0x35')]=_[_0x3447('0x38')](_0x2ffbf8[_0x3447('0x35')],{'$or':_[_0x3447('0x25')](_0x3167bd,function(_0x12a7f1){if(_0x12a7f1[_0x3447('0x28')]!==_0x3447('0x39')){var _0x1e962f={};_0x1e962f[_0x12a7f1[_0x3447('0x22')]]={'$like':'%'+_0x2f86ad[_0x3447('0x2b')][_0x3447('0x37')]+'%'};return _0x1e962f;}})});}_0x2ffbf8=_[_0x3447('0x38')]({},_0x2ffbf8,_0x2f86ad['options']);var _0xbf1e29={'where':_0x2ffbf8[_0x3447('0x35')]};return db['MailTransferReport'][_0x3447('0x3a')](_0xbf1e29)[_0x3447('0x1f')](function(_0x28b9c9){_0x2ade30['count']=_0x28b9c9;if(_0x2f86ad[_0x3447('0x2b')]['includeAll']){_0x2ffbf8['include']=[{'all':!![]}];}return db[_0x3447('0x26')]['findAll'](_0x2ffbf8);})[_0x3447('0x1f')](function(_0x2ab941){_0x2ade30['rows']=_0x2ab941;return _0x2ade30;})[_0x3447('0x1f')](respondWithFilteredResult(_0x312915,_0x2ffbf8))['catch'](handleError(_0x312915,null));};exports[_0x3447('0x3b')]=function(_0x5aa52a,_0x5551c1){var _0x20bc82={'raw':!![],'where':{'id':_0x5aa52a['params']['id']}},_0x3a56d4={};_0x3a56d4[_0x3447('0x2a')]=_[_0x3447('0x2c')](db[_0x3447('0x26')]['rawAttributes']);_0x3a56d4[_0x3447('0x2b')]=_['keys'](_0x5aa52a[_0x3447('0x2b')]);_0x3a56d4[_0x3447('0x2d')]=_[_0x3447('0x2e')](_0x3a56d4[_0x3447('0x2a')],_0x3a56d4[_0x3447('0x2b')]);_0x20bc82[_0x3447('0x2f')]=_[_0x3447('0x2e')](_0x3a56d4[_0x3447('0x2a')],qs[_0x3447('0x30')](_0x5aa52a[_0x3447('0x2b')][_0x3447('0x30')]));_0x20bc82[_0x3447('0x2f')]=_0x20bc82['attributes']['length']?_0x20bc82['attributes']:_0x3a56d4[_0x3447('0x2a')];if(_0x5aa52a[_0x3447('0x2b')][_0x3447('0x3c')]){_0x20bc82[_0x3447('0x3d')]=[{'all':!![]}];}_0x20bc82=_[_0x3447('0x38')]({},_0x20bc82,_0x5aa52a[_0x3447('0x3e')]);return db['MailTransferReport'][_0x3447('0x3f')](_0x20bc82)['then'](handleEntityNotFound(_0x5551c1,null))[_0x3447('0x1f')](respondWithResult(_0x5551c1,null))['catch'](handleError(_0x5551c1,null));};exports['create']=function(_0x5bcd92,_0x4ce95e){return db[_0x3447('0x26')][_0x3447('0x40')](_0x5bcd92['body'],{})[_0x3447('0x1f')](respondWithResult(_0x4ce95e,0xc9))['catch'](handleError(_0x4ce95e,null));};exports['update']=function(_0x550f27,_0x111303){if(_0x550f27['body']['id']){delete _0x550f27[_0x3447('0x41')]['id'];}return db['MailTransferReport'][_0x3447('0x3f')]({'where':{'id':_0x550f27['params']['id']}})[_0x3447('0x1f')](handleEntityNotFound(_0x111303,null))[_0x3447('0x1f')](saveUpdates(_0x550f27[_0x3447('0x41')],null))[_0x3447('0x1f')](respondWithResult(_0x111303,null))[_0x3447('0x42')](handleError(_0x111303,null));};exports['destroy']=function(_0x36da60,_0x5eeb59){return db[_0x3447('0x26')][_0x3447('0x3f')]({'where':{'id':_0x36da60[_0x3447('0x43')]['id']}})[_0x3447('0x1f')](handleEntityNotFound(_0x5eeb59,null))[_0x3447('0x1f')](removeEntity(_0x5eeb59,null))[_0x3447('0x42')](handleError(_0x5eeb59,null));};exports[_0x3447('0x44')]=function(_0x4f9d9d,_0x3160fa){return db[_0x3447('0x26')]['describe']()[_0x3447('0x1f')](respondWithResult(_0x3160fa,null))[_0x3447('0x42')](handleError(_0x3160fa,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b2bdda7..78ba304 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 _0xeb0d=['../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','moment','bluebird','path','rimraf'];(function(_0x2c73fa,_0x41b660){var _0x201374=function(_0xb0a36c){while(--_0xb0a36c){_0x2c73fa['push'](_0x2c73fa['shift']());}};_0x201374(++_0x41b660);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x1b6685,_0x553c4d){_0x1b6685=_0x1b6685-0x0;var _0x31280b=_0xeb0d[_0x1b6685];return _0x31280b;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('MailTransferReport',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[{'name':_0xdeb0('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe48=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x4936fb,_0x10fda9){var _0x4430ab=function(_0xd722c3){while(--_0xd722c3){_0x4936fb['push'](_0x4936fb['shift']());}};_0x4430ab(++_0x10fda9);}(_0xbe48,0x121));var _0x8be4=function(_0x38735a,_0x5389c4){_0x38735a=_0x38735a-0x0;var _0x584667=_0xbe48[_0x38735a];return _0x584667;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var logger=require(_0x8be4('0x2'))(_0x8be4('0x3'));var moment=require(_0x8be4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be4('0x5'));var rimraf=require(_0x8be4('0x6'));var config=require('../../config/environment');var attributes=require(_0x8be4('0x7'));module[_0x8be4('0x8')]=function(_0x286baa,_0x2312e8){return _0x286baa[_0x8be4('0x9')](_0x8be4('0xa'),attributes,{'tableName':_0x8be4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8be4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a417691..47edb61 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 _0x8dd2=['MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x8dd2,0x16c));var _0x28dd=function(_0x100f05,_0x2de0fa){_0x100f05=_0x100f05-0x0;var _0x2bcde1=_0x8dd2[_0x100f05];return _0x2bcde1;};'use strict';var _=require(_0x28dd('0x0'));var util=require(_0x28dd('0x1'));var moment=require('moment');var BPromise=require(_0x28dd('0x2'));var rs=require(_0x28dd('0x3'));var fs=require('fs');var Redis=require(_0x28dd('0x4'));var db=require(_0x28dd('0x5'))['db'];var utils=require(_0x28dd('0x6'));var logger=require(_0x28dd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28dd('0x8')][_0x28dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x279df8,_0x541c81,_0x33eb86){return new BPromise(function(_0x4d627a,_0x3dbeae){return client[_0x28dd('0xa')](_0x279df8,_0x33eb86)['then'](function(_0x170649){logger[_0x28dd('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x541c81,_0x28dd('0xc'));logger['debug'](_0x28dd('0xd'),_0x541c81,_0x28dd('0xc'),JSON['stringify'](_0x170649));if(_0x170649[_0x28dd('0xe')]){if(_0x170649[_0x28dd('0xe')][_0x28dd('0xf')]===0x1f4){logger['error'](_0x28dd('0x10'),_0x541c81,_0x170649[_0x28dd('0xe')]['message']);return _0x3dbeae(_0x170649[_0x28dd('0xe')][_0x28dd('0x11')]);}logger[_0x28dd('0xe')](_0x28dd('0x10'),_0x541c81,_0x170649[_0x28dd('0xe')]['message']);return _0x4d627a(_0x170649[_0x28dd('0xe')][_0x28dd('0x11')]);}else{logger[_0x28dd('0xb')](_0x28dd('0x10'),_0x541c81,_0x28dd('0xc'));_0x4d627a(_0x170649['result'][_0x28dd('0x11')]);}})[_0x28dd('0x12')](function(_0x7ed795){logger[_0x28dd('0xe')](_0x28dd('0x10'),_0x541c81,_0x7ed795);_0x3dbeae(_0x7ed795);});});} \ No newline at end of file +var _0xb51a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb51a,0x10f));var _0xab51=function(_0x5cacf1,_0x42dc5d){_0x5cacf1=_0x5cacf1-0x0;var _0xd54641=_0xb51a[_0x5cacf1];return _0xd54641;};'use strict';var _=require(_0xab51('0x0'));var util=require('util');var moment=require(_0xab51('0x1'));var BPromise=require('bluebird');var rs=require(_0xab51('0x2'));var fs=require('fs');var Redis=require(_0xab51('0x3'));var db=require(_0xab51('0x4'))['db'];var utils=require(_0xab51('0x5'));var logger=require(_0xab51('0x6'))(_0xab51('0x7'));var config=require(_0xab51('0x8'));var jayson=require(_0xab51('0x9'));var client=jayson[_0xab51('0xa')][_0xab51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f1da3,_0x500f9c,_0x3b4f51){return new BPromise(function(_0x324d9a,_0x2df805){return client[_0xab51('0xc')](_0x1f1da3,_0x3b4f51)['then'](function(_0x56fb51){logger[_0xab51('0xd')](_0xab51('0xe'),_0x500f9c,_0xab51('0xf'));logger['debug'](_0xab51('0x10'),_0x500f9c,_0xab51('0xf'),JSON[_0xab51('0x11')](_0x56fb51));if(_0x56fb51[_0xab51('0x12')]){if(_0x56fb51['error'][_0xab51('0x13')]===0x1f4){logger[_0xab51('0x12')](_0xab51('0xe'),_0x500f9c,_0x56fb51[_0xab51('0x12')][_0xab51('0x14')]);return _0x2df805(_0x56fb51['error'][_0xab51('0x14')]);}logger[_0xab51('0x12')](_0xab51('0xe'),_0x500f9c,_0x56fb51['error'][_0xab51('0x14')]);return _0x324d9a(_0x56fb51[_0xab51('0x12')][_0xab51('0x14')]);}else{logger['info'](_0xab51('0xe'),_0x500f9c,_0xab51('0xf'));_0x324d9a(_0x56fb51[_0xab51('0x15')][_0xab51('0x14')]);}})[_0xab51('0x16')](function(_0x484385){logger[_0xab51('0x12')](_0xab51('0xe'),_0x500f9c,_0x484385);_0x2df805(_0x484385);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9e8d191..e1495af 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 _0xedb3=['../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xedb3,0x67));var _0x3edb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xedb3[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x3edb('0x0'));var util=require(_0x3edb('0x1'));var path=require(_0x3edb('0x2'));var timeout=require(_0x3edb('0x3'));var express=require(_0x3edb('0x4'));var router=express['Router']();var fs_extra=require(_0x3edb('0x5'));var auth=require(_0x3edb('0x6'));var interaction=require(_0x3edb('0x7'));var config=require('../../config/environment');var controller=require(_0x3edb('0x8'));router[_0x3edb('0x9')]('/',auth[_0x3edb('0xa')](),controller[_0x3edb('0xb')]);router[_0x3edb('0x9')](_0x3edb('0xc'),auth[_0x3edb('0xa')](),controller[_0x3edb('0xd')]);router[_0x3edb('0x9')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller[_0x3edb('0xf')]);router[_0x3edb('0x10')]('/',auth[_0x3edb('0xa')](),controller[_0x3edb('0x11')]);router[_0x3edb('0x12')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller['update']);router[_0x3edb('0x13')](_0x3edb('0xe'),auth[_0x3edb('0xa')](),controller[_0x3edb('0x14')]);module[_0x3edb('0x15')]=router; \ No newline at end of file +var _0x3d30=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','describe','show','post','create','put','update','/:id','multer','connect-timeout'];(function(_0x97cc12,_0x54d583){var _0x5a25d7=function(_0x46add6){while(--_0x46add6){_0x97cc12['push'](_0x97cc12['shift']());}};_0x5a25d7(++_0x54d583);}(_0x3d30,0xd6));var _0x03d3=function(_0x1e4cb3,_0x22a379){_0x1e4cb3=_0x1e4cb3-0x0;var _0x4d47fe=_0x3d30[_0x1e4cb3];return _0x4d47fe;};'use strict';var multer=require(_0x03d3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03d3('0x1'));var express=require(_0x03d3('0x2'));var router=express[_0x03d3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x03d3('0x4'));var interaction=require(_0x03d3('0x5'));var config=require(_0x03d3('0x6'));var controller=require(_0x03d3('0x7'));router['get']('/',auth[_0x03d3('0x8')](),controller[_0x03d3('0x9')]);router[_0x03d3('0xa')]('/describe',auth[_0x03d3('0x8')](),controller[_0x03d3('0xb')]);router['get']('/:id',auth[_0x03d3('0x8')](),controller[_0x03d3('0xc')]);router[_0x03d3('0xd')]('/',auth[_0x03d3('0x8')](),controller[_0x03d3('0xe')]);router[_0x03d3('0xf')]('/:id',auth[_0x03d3('0x8')](),controller[_0x03d3('0x10')]);router['delete'](_0x03d3('0x11'),auth[_0x03d3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9d1c20e..f5f4c1b 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 _0x5eba=['sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]'];(function(_0x4f81cd,_0x19ad69){var _0x43a889=function(_0x47743e){while(--_0x47743e){_0x4f81cd['push'](_0x4f81cd['shift']());}};_0x43a889(++_0x19ad69);}(_0x5eba,0xa5));var _0xa5eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5eba[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xa5eb('0x0'));var moment=require('moment');module[_0xa5eb('0x1')]={'channel':{'type':Sequelize[_0xa5eb('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa5eb('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xa5eb('0x3'),'comment':_0xa5eb('0x4')},'duration':{'type':Sequelize[_0xa5eb('0x5')]},'enterAt':{'type':Sequelize[_0xa5eb('0x6')]},'exitAt':{'type':Sequelize[_0xa5eb('0x6')],'set':function(_0x298302){var _0x44b5bc=moment(_0x298302);var _0x38b08f=moment(this['getDataValue'](_0xa5eb('0x7')));var _0x4da221=_0x44b5bc[_0xa5eb('0x8')](_0x38b08f,_0xa5eb('0x9'));this['setDataValue']('exitAt',_0x298302);this[_0xa5eb('0xa')](_0xa5eb('0xb'),_0x4da221>=0x0?_0x4da221:null);}},'data1':{'type':Sequelize[_0xa5eb('0x2')],'comment':_0xa5eb('0xc')},'data2':{'type':Sequelize[_0xa5eb('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xa5eb('0x2')],'comment':_0xa5eb('0xd')},'data4':{'type':Sequelize[_0xa5eb('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xa5eb('0xe')},'role':{'type':Sequelize[_0xa5eb('0x2')]},'internal':{'type':Sequelize[_0xa5eb('0x5')]},'uniqueid':{'type':Sequelize[_0xa5eb('0x2')]}}; \ No newline at end of file +var _0x4d72=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','exports','STRING'];(function(_0x56de9d,_0x413b89){var _0x5b63fd=function(_0x2a5d13){while(--_0x2a5d13){_0x56de9d['push'](_0x56de9d['shift']());}};_0x5b63fd(++_0x413b89);}(_0x4d72,0x15c));var _0x24d7=function(_0x3e400b,_0x57a6bb){_0x3e400b=_0x3e400b-0x0;var _0x2ce387=_0x4d72[_0x3e400b];return _0x2ce387;};'use strict';var Sequelize=require(_0x24d7('0x0'));var moment=require(_0x24d7('0x1'));module[_0x24d7('0x2')]={'channel':{'type':Sequelize[_0x24d7('0x3')]},'membername':{'type':Sequelize[_0x24d7('0x3')]},'interface':{'type':Sequelize[_0x24d7('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x24d7('0x4')},'duration':{'type':Sequelize[_0x24d7('0x5')]},'enterAt':{'type':Sequelize[_0x24d7('0x6')]},'exitAt':{'type':Sequelize[_0x24d7('0x6')],'set':function(_0x5a83c6){var _0x160545=moment(_0x5a83c6);var _0x5bc84d=moment(this[_0x24d7('0x7')]('enterAt'));var _0x4386b1=_0x160545[_0x24d7('0x8')](_0x5bc84d,_0x24d7('0x9'));this['setDataValue'](_0x24d7('0xa'),_0x5a83c6);this[_0x24d7('0xb')](_0x24d7('0xc'),_0x4386b1>=0x0?_0x4386b1:null);}},'data1':{'type':Sequelize[_0x24d7('0x3')],'comment':_0x24d7('0xd')},'data2':{'type':Sequelize[_0x24d7('0x3')],'comment':_0x24d7('0xe')},'data3':{'type':Sequelize[_0x24d7('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x24d7('0x3')],'comment':_0x24d7('0xf')},'data5':{'type':Sequelize[_0x24d7('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8528759..fefbd25 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ef38d,_0x19d520){_0x1ef38d=_0x1ef38d-0x0;var _0x4bb5cf=_0xedd9[_0x1ef38d];return _0x4bb5cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x25dfe3,_0x8699a8){var _0xa2ea8b=function(_0x7cbe06){while(--_0x7cbe06){_0x25dfe3['push'](_0x25dfe3['shift']());}};_0xa2ea8b(++_0x8699a8);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ccfb228..2b8f61b 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 _0xf61a=['../../config/logger','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface','util'];(function(_0x50f8e4,_0x258cd2){var _0xe731b7=function(_0x4c46a7){while(--_0x4c46a7){_0x50f8e4['push'](_0x50f8e4['shift']());}};_0xe731b7(++_0x258cd2);}(_0xf61a,0xe3));var _0xaf61=function(_0x26b4ff,_0x49cda7){_0x26b4ff=_0x26b4ff-0x0;var _0x1f2856=_0xf61a[_0x26b4ff];return _0x1f2856;};'use strict';var _=require('lodash');var util=require(_0xaf61('0x0'));var logger=require(_0xaf61('0x1'))(_0xaf61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf61('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf61('0x4'));var config=require(_0xaf61('0x5'));var attributes=require(_0xaf61('0x6'));module[_0xaf61('0x7')]=function(_0x242dfb,_0x508567){return _0x242dfb['define'](_0xaf61('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xaf61('0x9'),'fields':[_0xaf61('0xa'),_0xaf61('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e2d=['interface','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername'];(function(_0x4758e5,_0x51c609){var _0x17f5d4=function(_0x5a0a42){while(--_0x5a0a42){_0x4758e5['push'](_0x4758e5['shift']());}};_0x17f5d4(++_0x51c609);}(_0x1e2d,0x127));var _0xd1e2=function(_0x400672,_0x243a7e){_0x400672=_0x400672-0x0;var _0x27ed65=_0x1e2d[_0x400672];return _0x27ed65;};'use strict';var _=require('lodash');var util=require(_0xd1e2('0x0'));var logger=require(_0xd1e2('0x1'))(_0xd1e2('0x2'));var moment=require('moment');var BPromise=require(_0xd1e2('0x3'));var rp=require(_0xd1e2('0x4'));var fs=require('fs');var path=require(_0xd1e2('0x5'));var rimraf=require('rimraf');var config=require(_0xd1e2('0x6'));var attributes=require(_0xd1e2('0x7'));module['exports']=function(_0x205aeb,_0x2b14e0){return _0x205aeb[_0xd1e2('0x8')](_0xd1e2('0x9'),attributes,{'tableName':_0xd1e2('0xa'),'paranoid':![],'indexes':[{'name':_0xd1e2('0xb'),'fields':[_0xd1e2('0xc'),_0xd1e2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 39b57fe..46419a9 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 _0x3d4b=['attributes','then','debug','CreateMemberReport','create','body','where','catch','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','limit','include','model','map'];(function(_0x116279,_0x17fc0d){var _0x521ac8=function(_0x4690e7){while(--_0x4690e7){_0x116279['push'](_0x116279['shift']());}};_0x521ac8(++_0x17fc0d);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x572f57,_0x2feb1c){_0x572f57=_0x572f57-0x0;var _0x42f1ec=_0x3d4b[_0x572f57];return _0x42f1ec;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});}exports[_0xb3d4('0x15')]=function(_0x1676a5){var _0x270298=this;return new Promise(function(_0x233adc,_0x5688d4){return db[_0xb3d4('0x16')][_0xb3d4('0x17')]({'raw':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['where']||null:null,'attributes':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['attributes']||null:null,'limit':_0x1676a5['options']?_0x1676a5['options'][_0xb3d4('0x1a')]||null:null,'include':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x1b')]?_['map'](_0x1676a5['options'][_0xb3d4('0x1b')],function(_0x51c3a9){return{'model':db[_0x51c3a9[_0xb3d4('0x1c')]],'as':_0x51c3a9['as'],'attributes':_0x51c3a9['attributes'],'include':_0x51c3a9['include']?_[_0xb3d4('0x1d')](_0x51c3a9[_0xb3d4('0x1b')],function(_0x1fdbf6){return{'model':db[_0x1fdbf6['model']],'as':_0x1fdbf6['as'],'attributes':_0x1fdbf6[_0xb3d4('0x1e')],'include':_0x1fdbf6['include']?_['map'](_0x1fdbf6[_0xb3d4('0x1b')],function(_0x5482a4){return{'model':db[_0x5482a4[_0xb3d4('0x1c')]],'as':_0x5482a4['as'],'attributes':_0x5482a4[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x552da8){logger['info'](_0xb3d4('0x15'),_0x1676a5);logger[_0xb3d4('0x20')](_0xb3d4('0x15'),_0x1676a5,JSON['stringify'](_0x552da8));_0x233adc(_0x552da8);})['catch'](function(_0x4921c1){logger[_0xb3d4('0x11')](_0xb3d4('0x15'),_0x4921c1[_0xb3d4('0x13')],_0x1676a5);_0x5688d4(_0x270298['error'](0x1f4,_0x4921c1[_0xb3d4('0x13')]));});});};exports[_0xb3d4('0x21')]=function(_0x37cff4){var _0x5a3fe7=this;return new Promise(function(_0x447200,_0x98a5ff){return db['MemberReport'][_0xb3d4('0x22')](_0x37cff4['body'],{'raw':_0x37cff4['options']?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![]})[_0xb3d4('0x1f')](function(_0x3204f1){logger[_0xb3d4('0xc')](_0xb3d4('0x21'),_0x37cff4);logger[_0xb3d4('0x20')](_0xb3d4('0x21'),_0x37cff4,JSON[_0xb3d4('0x10')](_0x3204f1));_0x447200(_0x3204f1);})['catch'](function(_0x35ade5){logger[_0xb3d4('0x11')](_0xb3d4('0x21'),_0x35ade5['message'],_0x37cff4);_0x98a5ff(_0x5a3fe7[_0xb3d4('0x11')](0x1f4,_0x35ade5['message']));});});};exports['UpdateMemberReport']=function(_0x56da7d){var _0x45c8ab=this;return new Promise(function(_0x359084,_0x58ae1d){return db[_0xb3d4('0x16')]['update'](_0x56da7d[_0xb3d4('0x23')],{'raw':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d['options'][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x24')]||null:null,'attributes':_0x56da7d['options']?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1e')]||null:null,'limit':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1a')]||null:null})[_0xb3d4('0x1f')](function(_0x265574){logger['info']('UpdateMemberReport',_0x56da7d);logger[_0xb3d4('0x20')]('UpdateMemberReport',_0x56da7d,JSON[_0xb3d4('0x10')](_0x265574));_0x359084(_0x265574);})[_0xb3d4('0x25')](function(_0x5e5b95){logger[_0xb3d4('0x11')](_0xb3d4('0x26'),_0x5e5b95['message'],_0x56da7d);_0x58ae1d(_0x45c8ab[_0xb3d4('0x11')](0x1f4,_0x5e5b95[_0xb3d4('0x13')]));});});}; \ No newline at end of file +var _0x6299=['include','model','then','stringify','CreateMemberReport','MemberReport','create','UpdateMemberReport','update','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','map'];(function(_0x696610,_0x1de31a){var _0x5cedab=function(_0x2966ef){while(--_0x2966ef){_0x696610['push'](_0x696610['shift']());}};_0x5cedab(++_0x1de31a);}(_0x6299,0x169));var _0x9629=function(_0x3b658d,_0x5c3c37){_0x3b658d=_0x3b658d-0x0;var _0x457b89=_0x6299[_0x3b658d];return _0x457b89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9629('0x0'));var BPromise=require(_0x9629('0x1'));var rs=require(_0x9629('0x2'));var fs=require('fs');var Redis=require(_0x9629('0x3'));var db=require(_0x9629('0x4'))['db'];var utils=require(_0x9629('0x5'));var logger=require('../../config/logger')(_0x9629('0x6'));var config=require(_0x9629('0x7'));var jayson=require(_0x9629('0x8'));var client=jayson[_0x9629('0x9')][_0x9629('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d5981,_0x57c6fe,_0x2c5ca5){return new BPromise(function(_0x1754e6,_0x533868){return client['request'](_0x5d5981,_0x2c5ca5)['then'](function(_0x439129){logger[_0x9629('0xb')](_0x9629('0xc'),_0x57c6fe,'request\x20sent');logger[_0x9629('0xd')](_0x9629('0xe'),_0x57c6fe,_0x9629('0xf'),JSON['stringify'](_0x439129));if(_0x439129[_0x9629('0x10')]){if(_0x439129[_0x9629('0x10')][_0x9629('0x11')]===0x1f4){logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x439129['error'][_0x9629('0x12')]);return _0x533868(_0x439129[_0x9629('0x10')][_0x9629('0x12')]);}logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x439129[_0x9629('0x10')]['message']);return _0x1754e6(_0x439129[_0x9629('0x10')][_0x9629('0x12')]);}else{logger[_0x9629('0xb')](_0x9629('0xc'),_0x57c6fe,_0x9629('0xf'));_0x1754e6(_0x439129[_0x9629('0x13')]['message']);}})[_0x9629('0x14')](function(_0x3524f8){logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x3524f8);_0x533868(_0x3524f8);});});}exports[_0x9629('0x15')]=function(_0x3f777a){var _0x3df55f=this;return new Promise(function(_0x447f28,_0x1fbacf){return db['MemberReport'][_0x9629('0x16')]({'raw':_0x3f777a['options']?_0x3f777a[_0x9629('0x17')][_0x9629('0x18')]===undefined?!![]:![]:!![],'where':_0x3f777a['options']?_0x3f777a[_0x9629('0x17')][_0x9629('0x19')]||null:null,'attributes':_0x3f777a[_0x9629('0x17')]?_0x3f777a[_0x9629('0x17')][_0x9629('0x1a')]||null:null,'limit':_0x3f777a['options']?_0x3f777a['options'][_0x9629('0x1b')]||null:null,'include':_0x3f777a[_0x9629('0x17')]?_0x3f777a[_0x9629('0x17')]['include']?_[_0x9629('0x1c')](_0x3f777a[_0x9629('0x17')][_0x9629('0x1d')],function(_0x4ae0c7){return{'model':db[_0x4ae0c7['model']],'as':_0x4ae0c7['as'],'attributes':_0x4ae0c7[_0x9629('0x1a')],'include':_0x4ae0c7[_0x9629('0x1d')]?_[_0x9629('0x1c')](_0x4ae0c7[_0x9629('0x1d')],function(_0x1232ec){return{'model':db[_0x1232ec[_0x9629('0x1e')]],'as':_0x1232ec['as'],'attributes':_0x1232ec['attributes'],'include':_0x1232ec[_0x9629('0x1d')]?_['map'](_0x1232ec[_0x9629('0x1d')],function(_0x1db0d9){return{'model':db[_0x1db0d9[_0x9629('0x1e')]],'as':_0x1db0d9['as'],'attributes':_0x1db0d9[_0x9629('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9629('0x1f')](function(_0xe7c85c){logger[_0x9629('0xb')](_0x9629('0x15'),_0x3f777a);logger[_0x9629('0xd')]('GetMemberReport',_0x3f777a,JSON[_0x9629('0x20')](_0xe7c85c));_0x447f28(_0xe7c85c);})[_0x9629('0x14')](function(_0x596376){logger[_0x9629('0x10')](_0x9629('0x15'),_0x596376[_0x9629('0x12')],_0x3f777a);_0x1fbacf(_0x3df55f[_0x9629('0x10')](0x1f4,_0x596376['message']));});});};exports[_0x9629('0x21')]=function(_0x2de66e){var _0x5cf1b6=this;return new Promise(function(_0x160eb9,_0x505590){return db[_0x9629('0x22')][_0x9629('0x23')](_0x2de66e['body'],{'raw':_0x2de66e['options']?_0x2de66e[_0x9629('0x17')][_0x9629('0x18')]===undefined?!![]:![]:!![]})[_0x9629('0x1f')](function(_0x87346b){logger[_0x9629('0xb')](_0x9629('0x21'),_0x2de66e);logger[_0x9629('0xd')](_0x9629('0x21'),_0x2de66e,JSON[_0x9629('0x20')](_0x87346b));_0x160eb9(_0x87346b);})[_0x9629('0x14')](function(_0x16ee32){logger['error'](_0x9629('0x21'),_0x16ee32['message'],_0x2de66e);_0x505590(_0x5cf1b6[_0x9629('0x10')](0x1f4,_0x16ee32[_0x9629('0x12')]));});});};exports[_0x9629('0x24')]=function(_0x641e2e){var _0x1a44dd=this;return new Promise(function(_0x5c9c41,_0x261b3f){return db[_0x9629('0x22')][_0x9629('0x25')](_0x641e2e[_0x9629('0x26')],{'raw':_0x641e2e[_0x9629('0x17')]?_0x641e2e[_0x9629('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x641e2e[_0x9629('0x17')]?_0x641e2e[_0x9629('0x17')]['where']||null:null,'attributes':_0x641e2e['options']?_0x641e2e[_0x9629('0x17')][_0x9629('0x1a')]||null:null,'limit':_0x641e2e[_0x9629('0x17')]?_0x641e2e['options'][_0x9629('0x1b')]||null:null})[_0x9629('0x1f')](function(_0x1d0c8b){logger[_0x9629('0xb')](_0x9629('0x24'),_0x641e2e);logger[_0x9629('0xd')](_0x9629('0x24'),_0x641e2e,JSON[_0x9629('0x20')](_0x1d0c8b));_0x5c9c41(_0x1d0c8b);})[_0x9629('0x14')](function(_0x22d49d){logger[_0x9629('0x10')]('UpdateMemberReport',_0x22d49d[_0x9629('0x12')],_0x641e2e);_0x261b3f(_0x1a44dd[_0x9629('0x10')](0x1f4,_0x22d49d[_0x9629('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7640934..dccaf71 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 _0xb63f=['fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','connect-timeout','express','Router'];(function(_0x53f118,_0x5e5740){var _0x3b4087=function(_0x48eca6){while(--_0x48eca6){_0x53f118['push'](_0x53f118['shift']());}};_0x3b4087(++_0x5e5740);}(_0xb63f,0x193));var _0xfb63=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb63f[_0xd22d95];return _0x15d7a3;};'use strict';var multer=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var path=require('path');var timeout=require(_0xfb63('0x2'));var express=require(_0xfb63('0x3'));var router=express[_0xfb63('0x4')]();var fs_extra=require(_0xfb63('0x5'));var auth=require(_0xfb63('0x6'));var interaction=require(_0xfb63('0x7'));var config=require('../../config/environment');var controller=require(_0xfb63('0x8'));router[_0xfb63('0x9')]('/',controller[_0xfb63('0xa')]);module[_0xfb63('0xb')]=router; \ No newline at end of file +var _0xb2cf=['./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x46001d,_0x4a1ab6){var _0x57cb00=function(_0x363a69){while(--_0x363a69){_0x46001d['push'](_0x46001d['shift']());}};_0x57cb00(++_0x4a1ab6);}(_0xb2cf,0x10c));var _0xfb2c=function(_0x3f4ba9,_0x46cf52){_0x3f4ba9=_0x3f4ba9-0x0;var _0x25aa17=_0xb2cf[_0x3f4ba9];return _0x25aa17;};'use strict';var multer=require(_0xfb2c('0x0'));var util=require(_0xfb2c('0x1'));var path=require(_0xfb2c('0x2'));var timeout=require(_0xfb2c('0x3'));var express=require(_0xfb2c('0x4'));var router=express['Router']();var fs_extra=require(_0xfb2c('0x5'));var auth=require(_0xfb2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2c('0x7'));var controller=require(_0xfb2c('0x8'));router[_0xfb2c('0x9')]('/',controller[_0xfb2c('0xa')]);module[_0xfb2c('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 1f45f1b..4a27b17 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 _0x2e0a=['STRING','version','sequelize'];(function(_0x14b01a,_0x47a80b){var _0x52b34f=function(_0x6dcc72){while(--_0x6dcc72){_0x14b01a['push'](_0x14b01a['shift']());}};_0x52b34f(++_0x47a80b);}(_0x2e0a,0x122));var _0xa2e0=function(_0x37c394,_0x53536a){_0x37c394=_0x37c394-0x0;var _0x1fb3f7=_0x2e0a[_0x37c394];return _0x1fb3f7;};'use strict';var Sequelize=require(_0xa2e0('0x0'));module['exports']={'version':{'type':Sequelize[_0xa2e0('0x1')],'unique':_0xa2e0('0x2')}}; \ No newline at end of file +var _0x33ea=['STRING','exports'];(function(_0x5227d1,_0x5aa8df){var _0x176210=function(_0x3c4dad){while(--_0x3c4dad){_0x5227d1['push'](_0x5227d1['shift']());}};_0x176210(++_0x5aa8df);}(_0x33ea,0xa3));var _0xa33e=function(_0x5b76cf,_0x4c70ad){_0x5b76cf=_0x5b76cf-0x0;var _0x1f251b=_0x33ea[_0x5b76cf];return _0x1f251b;};'use strict';var Sequelize=require('sequelize');module[_0xa33e('0x0')]={'version':{'type':Sequelize[_0xa33e('0x1')],'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 e34de24..7c4dfa3 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 _0x75bc=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5631b9,_0x3c43f2){var _0x37b9ea=function(_0x446465){while(--_0x446465){_0x5631b9['push'](_0x5631b9['shift']());}};_0x37b9ea(++_0x3c43f2);}(_0x75bc,0x10f));var _0xc75b=function(_0x58805e,_0x427435){_0x58805e=_0x58805e-0x0;var _0x35e220=_0x75bc[_0x58805e];return _0x35e220;};'use strict';var emlformat=require(_0xc75b('0x0'));var rimraf=require(_0xc75b('0x1'));var zipdir=require(_0xc75b('0x2'));var jsonpatch=require(_0xc75b('0x3'));var rp=require(_0xc75b('0x4'));var moment=require(_0xc75b('0x5'));var BPromise=require(_0xc75b('0x6'));var Mustache=require(_0xc75b('0x7'));var util=require(_0xc75b('0x8'));var path=require(_0xc75b('0x9'));var sox=require(_0xc75b('0xa'));var csv=require(_0xc75b('0xb'));var ejs=require(_0xc75b('0xc'));var fs=require('fs');var fs_extra=require(_0xc75b('0xd'));var _=require(_0xc75b('0xe'));var squel=require(_0xc75b('0xf'));var crypto=require(_0xc75b('0x10'));var jsforce=require(_0xc75b('0x11'));var deskjs=require(_0xc75b('0x12'));var toCsv=require(_0xc75b('0xb'));var querystring=require(_0xc75b('0x13'));var Papa=require('papaparse');var Redis=require(_0xc75b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc75b('0x15'));var as=require(_0xc75b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc75b('0x17'));var utils=require('../../config/utils');var config=require(_0xc75b('0x18'));var licenseUtil=require(_0xc75b('0x19'));var db=require(_0xc75b('0x1a'))['db'];function respondWithStatusCode(_0x43e22e,_0x32921e){_0x32921e=_0x32921e||0xcc;return function(_0x8cf925){if(_0x8cf925){return _0x43e22e[_0xc75b('0x1b')](_0x32921e);}return _0x43e22e[_0xc75b('0x1c')](_0x32921e)[_0xc75b('0x1d')]();};}function respondWithResult(_0xcdc8fb,_0xdea2c){_0xdea2c=_0xdea2c||0xc8;return function(_0x453e0a){if(_0x453e0a){return _0xcdc8fb[_0xc75b('0x1c')](_0xdea2c)['json'](_0x453e0a);}};}function respondWithFilteredResult(_0x352684,_0x4a0eae){return function(_0x556f4c){if(_0x556f4c){var _0x21bfb6=typeof _0x4a0eae[_0xc75b('0x1e')]===_0xc75b('0x1f')&&typeof _0x4a0eae['limit']==='undefined';var _0x360d8b=_0x556f4c[_0xc75b('0x20')];var _0x3c6f1d=_0x21bfb6?0x0:_0x4a0eae[_0xc75b('0x1e')];var _0x43c547=_0x21bfb6?_0x556f4c['count']:_0x4a0eae[_0xc75b('0x1e')]+_0x4a0eae[_0xc75b('0x21')];var _0x2fe7a6;if(_0x43c547>=_0x360d8b){_0x43c547=_0x360d8b;_0x2fe7a6=0xc8;}else{_0x2fe7a6=0xce;}_0x352684['status'](_0x2fe7a6);return _0x352684[_0xc75b('0x22')](_0xc75b('0x23'),_0x3c6f1d+'-'+_0x43c547+'/'+_0x360d8b)[_0xc75b('0x24')](_0x556f4c);}return null;};}function patchUpdates(_0x141b19){return function(_0x494880){try{jsonpatch[_0xc75b('0x25')](_0x494880,_0x141b19,!![]);}catch(_0x1ba9cd){return BPromise[_0xc75b('0x26')](_0x1ba9cd);}return _0x494880[_0xc75b('0x27')]();};}function saveUpdates(_0x1960fa,_0x4bfc45){return function(_0x4777d8){if(_0x4777d8){return _0x4777d8[_0xc75b('0x28')](_0x1960fa)['then'](function(_0x50108e){return _0x50108e;});}return null;};}function removeEntity(_0x9dcc5c,_0x11d202){return function(_0x940da8){if(_0x940da8){return _0x940da8[_0xc75b('0x29')]()[_0xc75b('0x2a')](function(){_0x9dcc5c['status'](0xcc)[_0xc75b('0x1d')]();});}};}function handleEntityNotFound(_0x2b40d6,_0x2fa6a8){return function(_0x1dac54){if(!_0x1dac54){_0x2b40d6[_0xc75b('0x1b')](0x194);}return _0x1dac54;};}function handleError(_0x404b4e,_0x375aa5){_0x375aa5=_0x375aa5||0x1f4;return function(_0x5ea0ed){logger[_0xc75b('0x2b')](_0x5ea0ed[_0xc75b('0x2c')]);if(_0x5ea0ed[_0xc75b('0x2d')]){delete _0x5ea0ed[_0xc75b('0x2d')];}_0x404b4e[_0xc75b('0x1c')](_0x375aa5)[_0xc75b('0x2e')](_0x5ea0ed);};}exports[_0xc75b('0x2f')]=function(_0x5ee7b4,_0x3da2fb){var _0xaea4ff={},_0x3bacb1={},_0x22f87b={'count':0x0,'rows':[]};var _0x15d5c2=_[_0xc75b('0x30')](db[_0xc75b('0x31')][_0xc75b('0x32')],function(_0x294ef4){return{'name':_0x294ef4[_0xc75b('0x33')],'type':_0x294ef4[_0xc75b('0x34')][_0xc75b('0x35')]};});_0x3bacb1[_0xc75b('0x36')]=_[_0xc75b('0x30')](_0x15d5c2,_0xc75b('0x2d'));_0x3bacb1[_0xc75b('0x37')]=_[_0xc75b('0x38')](_0x5ee7b4['query']);_0x3bacb1[_0xc75b('0x39')]=_[_0xc75b('0x3a')](_0x3bacb1[_0xc75b('0x36')],_0x3bacb1[_0xc75b('0x37')]);_0xaea4ff[_0xc75b('0x3b')]=_[_0xc75b('0x3a')](_0x3bacb1[_0xc75b('0x36')],qs[_0xc75b('0x3c')](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x3c')]));_0xaea4ff[_0xc75b('0x3b')]=_0xaea4ff[_0xc75b('0x3b')][_0xc75b('0x3d')]?_0xaea4ff[_0xc75b('0x3b')]:_0x3bacb1['model'];if(!_0x5ee7b4['query']['hasOwnProperty']('nolimit')){_0xaea4ff[_0xc75b('0x21')]=qs['limit'](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x21')]);_0xaea4ff[_0xc75b('0x1e')]=qs[_0xc75b('0x1e')](_0x5ee7b4['query'][_0xc75b('0x1e')]);}_0xaea4ff[_0xc75b('0x3e')]=qs['sort'](_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x3f')]);_0xaea4ff['where']=qs['filters'](_[_0xc75b('0x40')](_0x5ee7b4[_0xc75b('0x37')],_0x3bacb1[_0xc75b('0x39')]),_0x15d5c2);if(_0x5ee7b4[_0xc75b('0x37')]['filter']){_0xaea4ff['where']=_['merge'](_0xaea4ff[_0xc75b('0x41')],{'$or':_[_0xc75b('0x30')](_0x15d5c2,function(_0x6a0496){if(_0x6a0496[_0xc75b('0x34')]!==_0xc75b('0x42')){var _0x1b547a={};_0x1b547a[_0x6a0496[_0xc75b('0x2d')]]={'$like':'%'+_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x43')]+'%'};return _0x1b547a;}})});}_0xaea4ff=_[_0xc75b('0x44')]({},_0xaea4ff,_0x5ee7b4['options']);var _0x415cce={'where':_0xaea4ff[_0xc75b('0x41')]};return db[_0xc75b('0x31')][_0xc75b('0x20')](_0x415cce)['then'](function(_0x194005){_0x22f87b[_0xc75b('0x20')]=_0x194005;if(_0x5ee7b4[_0xc75b('0x37')][_0xc75b('0x45')]){_0xaea4ff[_0xc75b('0x46')]=[{'all':!![]}];}return db[_0xc75b('0x31')]['findAll'](_0xaea4ff);})['then'](function(_0x2a2480){_0x22f87b[_0xc75b('0x47')]=_0x2a2480;return _0x22f87b;})[_0xc75b('0x2a')](respondWithFilteredResult(_0x3da2fb,_0xaea4ff))[_0xc75b('0x48')](handleError(_0x3da2fb,null));}; \ No newline at end of file +var _0x0a82=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','rows','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x0a82,0xfc));var _0x20a8=function(_0x1d0dbe,_0x5c3510){_0x1d0dbe=_0x1d0dbe-0x0;var _0x345c52=_0x0a82[_0x1d0dbe];return _0x345c52;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x20a8('0x0'));var jsonpatch=require(_0x20a8('0x1'));var rp=require(_0x20a8('0x2'));var moment=require(_0x20a8('0x3'));var BPromise=require(_0x20a8('0x4'));var Mustache=require(_0x20a8('0x5'));var util=require(_0x20a8('0x6'));var path=require(_0x20a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20a8('0x8'));var _=require('lodash');var squel=require(_0x20a8('0x9'));var crypto=require(_0x20a8('0xa'));var jsforce=require(_0x20a8('0xb'));var deskjs=require(_0x20a8('0xc'));var toCsv=require(_0x20a8('0xd'));var querystring=require(_0x20a8('0xe'));var Papa=require('papaparse');var Redis=require(_0x20a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20a8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20a8('0x11'));var logger=require(_0x20a8('0x12'))(_0x20a8('0x13'));var utils=require('../../config/utils');var config=require(_0x20a8('0x14'));var licenseUtil=require(_0x20a8('0x15'));var db=require(_0x20a8('0x16'))['db'];function respondWithStatusCode(_0x1149a4,_0x58e0c7){_0x58e0c7=_0x58e0c7||0xcc;return function(_0x5e26d7){if(_0x5e26d7){return _0x1149a4[_0x20a8('0x17')](_0x58e0c7);}return _0x1149a4[_0x20a8('0x18')](_0x58e0c7)[_0x20a8('0x19')]();};}function respondWithResult(_0x3adf12,_0x34433d){_0x34433d=_0x34433d||0xc8;return function(_0x1fd5c8){if(_0x1fd5c8){return _0x3adf12[_0x20a8('0x18')](_0x34433d)[_0x20a8('0x1a')](_0x1fd5c8);}};}function respondWithFilteredResult(_0x422c8a,_0x1d0dd8){return function(_0x1fba0a){if(_0x1fba0a){var _0x539e7e=typeof _0x1d0dd8[_0x20a8('0x1b')]==='undefined'&&typeof _0x1d0dd8['limit']===_0x20a8('0x1c');var _0x2568c7=_0x1fba0a['count'];var _0x4f708f=_0x539e7e?0x0:_0x1d0dd8['offset'];var _0x4e12ef=_0x539e7e?_0x1fba0a['count']:_0x1d0dd8[_0x20a8('0x1b')]+_0x1d0dd8[_0x20a8('0x1d')];var _0x43acfa;if(_0x4e12ef>=_0x2568c7){_0x4e12ef=_0x2568c7;_0x43acfa=0xc8;}else{_0x43acfa=0xce;}_0x422c8a[_0x20a8('0x18')](_0x43acfa);return _0x422c8a[_0x20a8('0x1e')](_0x20a8('0x1f'),_0x4f708f+'-'+_0x4e12ef+'/'+_0x2568c7)[_0x20a8('0x1a')](_0x1fba0a);}return null;};}function patchUpdates(_0x386487){return function(_0x376172){try{jsonpatch[_0x20a8('0x20')](_0x376172,_0x386487,!![]);}catch(_0xdfb9b6){return BPromise['reject'](_0xdfb9b6);}return _0x376172[_0x20a8('0x21')]();};}function saveUpdates(_0x237394,_0x492aa3){return function(_0x2ee0f6){if(_0x2ee0f6){return _0x2ee0f6['update'](_0x237394)[_0x20a8('0x22')](function(_0x37d913){return _0x37d913;});}return null;};}function removeEntity(_0x5d3e96,_0x54c67c){return function(_0x360efb){if(_0x360efb){return _0x360efb[_0x20a8('0x23')]()[_0x20a8('0x22')](function(){_0x5d3e96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x142052,_0x346879){return function(_0x1f9e08){if(!_0x1f9e08){_0x142052[_0x20a8('0x17')](0x194);}return _0x1f9e08;};}function handleError(_0x33c191,_0x4cf394){_0x4cf394=_0x4cf394||0x1f4;return function(_0x377db8){logger['error'](_0x377db8[_0x20a8('0x24')]);if(_0x377db8[_0x20a8('0x25')]){delete _0x377db8[_0x20a8('0x25')];}_0x33c191[_0x20a8('0x18')](_0x4cf394)[_0x20a8('0x26')](_0x377db8);};}exports[_0x20a8('0x27')]=function(_0x2ab41a,_0x520175){var _0xebf9f0={},_0x122fb3={},_0x31d551={'count':0x0,'rows':[]};var _0x27ea5f=_['map'](db[_0x20a8('0x28')][_0x20a8('0x29')],function(_0x5f4202){return{'name':_0x5f4202[_0x20a8('0x2a')],'type':_0x5f4202[_0x20a8('0x2b')][_0x20a8('0x2c')]};});_0x122fb3[_0x20a8('0x2d')]=_[_0x20a8('0x2e')](_0x27ea5f,'name');_0x122fb3[_0x20a8('0x2f')]=_[_0x20a8('0x30')](_0x2ab41a[_0x20a8('0x2f')]);_0x122fb3[_0x20a8('0x31')]=_[_0x20a8('0x32')](_0x122fb3[_0x20a8('0x2d')],_0x122fb3['query']);_0xebf9f0[_0x20a8('0x33')]=_['intersection'](_0x122fb3[_0x20a8('0x2d')],qs[_0x20a8('0x34')](_0x2ab41a[_0x20a8('0x2f')][_0x20a8('0x34')]));_0xebf9f0[_0x20a8('0x33')]=_0xebf9f0[_0x20a8('0x33')][_0x20a8('0x35')]?_0xebf9f0[_0x20a8('0x33')]:_0x122fb3[_0x20a8('0x2d')];if(!_0x2ab41a[_0x20a8('0x2f')][_0x20a8('0x36')](_0x20a8('0x37'))){_0xebf9f0[_0x20a8('0x1d')]=qs[_0x20a8('0x1d')](_0x2ab41a[_0x20a8('0x2f')][_0x20a8('0x1d')]);_0xebf9f0[_0x20a8('0x1b')]=qs['offset'](_0x2ab41a[_0x20a8('0x2f')]['offset']);}_0xebf9f0[_0x20a8('0x38')]=qs[_0x20a8('0x39')](_0x2ab41a[_0x20a8('0x2f')]['sort']);_0xebf9f0[_0x20a8('0x3a')]=qs[_0x20a8('0x31')](_[_0x20a8('0x3b')](_0x2ab41a[_0x20a8('0x2f')],_0x122fb3[_0x20a8('0x31')]),_0x27ea5f);if(_0x2ab41a[_0x20a8('0x2f')]['filter']){_0xebf9f0[_0x20a8('0x3a')]=_['merge'](_0xebf9f0[_0x20a8('0x3a')],{'$or':_[_0x20a8('0x2e')](_0x27ea5f,function(_0x3e421f){if(_0x3e421f[_0x20a8('0x2b')]!==_0x20a8('0x3c')){var _0x573d6f={};_0x573d6f[_0x3e421f[_0x20a8('0x25')]]={'$like':'%'+_0x2ab41a[_0x20a8('0x2f')][_0x20a8('0x3d')]+'%'};return _0x573d6f;}})});}_0xebf9f0=_['merge']({},_0xebf9f0,_0x2ab41a[_0x20a8('0x3e')]);var _0x5c5c6c={'where':_0xebf9f0[_0x20a8('0x3a')]};return db['Migration'][_0x20a8('0x3f')](_0x5c5c6c)['then'](function(_0x34d316){_0x31d551[_0x20a8('0x3f')]=_0x34d316;if(_0x2ab41a[_0x20a8('0x2f')][_0x20a8('0x40')]){_0xebf9f0[_0x20a8('0x41')]=[{'all':!![]}];}return db[_0x20a8('0x28')]['findAll'](_0xebf9f0);})['then'](function(_0x33caf0){_0x31d551[_0x20a8('0x42')]=_0x33caf0;return _0x31d551;})[_0x20a8('0x22')](respondWithFilteredResult(_0x520175,_0xebf9f0))[_0x20a8('0x43')](handleError(_0x520175,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 03913b0..51d08b6 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 _0x90f0=['migrations','lodash','util','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x378d37,_0x21b6f2){var _0x42a8cf=function(_0xcf4d8c){while(--_0xcf4d8c){_0x378d37['push'](_0x378d37['shift']());}};_0x42a8cf(++_0x21b6f2);}(_0x90f0,0x79));var _0x090f=function(_0x1fd563,_0x196466){_0x1fd563=_0x1fd563-0x0;var _0x4673f3=_0x90f0[_0x1fd563];return _0x4673f3;};'use strict';var _=require(_0x090f('0x0'));var util=require(_0x090f('0x1'));var logger=require('../../config/logger')(_0x090f('0x2'));var moment=require(_0x090f('0x3'));var BPromise=require('bluebird');var rp=require(_0x090f('0x4'));var fs=require('fs');var path=require(_0x090f('0x5'));var rimraf=require(_0x090f('0x6'));var config=require('../../config/environment');var attributes=require(_0x090f('0x7'));module[_0x090f('0x8')]=function(_0x4c908c,_0x16e91d){return _0x4c908c[_0x090f('0x9')](_0x090f('0xa'),attributes,{'tableName':_0x090f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x706c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util'];(function(_0x28ddff,_0x395614){var _0x4c62c7=function(_0x376fd1){while(--_0x376fd1){_0x28ddff['push'](_0x28ddff['shift']());}};_0x4c62c7(++_0x395614);}(_0x706c,0x184));var _0xc706=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x706c[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0xc706('0x0'));var util=require(_0xc706('0x1'));var logger=require(_0xc706('0x2'))(_0xc706('0x3'));var moment=require(_0xc706('0x4'));var BPromise=require(_0xc706('0x5'));var rp=require(_0xc706('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc706('0x7'));var config=require('../../config/environment');var attributes=require(_0xc706('0x8'));module[_0xc706('0x9')]=function(_0x1c9582,_0x28e8b4){return _0x1c9582[_0xc706('0xa')](_0xc706('0xb'),attributes,{'tableName':_0xc706('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index c4f4dc4..c511095 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 _0x7794=['randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7794,0x7b));var _0x4779=function(_0x1c6416,_0x2431f3){_0x1c6416=_0x1c6416-0x0;var _0x49ebb3=_0x7794[_0x1c6416];return _0x49ebb3;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('Migration,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});} \ No newline at end of file +var _0x35ba=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Migration,\x20%s,\x20%s'];(function(_0xf94cbe,_0x1b5fc0){var _0x38ff87=function(_0xfe88f8){while(--_0xfe88f8){_0xf94cbe['push'](_0xf94cbe['shift']());}};_0x38ff87(++_0x1b5fc0);}(_0x35ba,0x8c));var _0xa35b=function(_0x4c89cd,_0x2c57e2){_0x4c89cd=_0x4c89cd-0x0;var _0x1090d2=_0x35ba[_0x4c89cd];return _0x1090d2;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var moment=require(_0xa35b('0x2'));var BPromise=require(_0xa35b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa35b('0x4'));var db=require(_0xa35b('0x5'))['db'];var utils=require(_0xa35b('0x6'));var logger=require(_0xa35b('0x7'))(_0xa35b('0x8'));var config=require(_0xa35b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa35b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f0063,_0x121c8b,_0x2be599){return new BPromise(function(_0x42da91,_0x3ceb59){return client['request'](_0x7f0063,_0x2be599)[_0xa35b('0xb')](function(_0x24a4cf){logger[_0xa35b('0xc')](_0xa35b('0xd'),_0x121c8b,_0xa35b('0xe'));logger[_0xa35b('0xf')](_0xa35b('0x10'),_0x121c8b,_0xa35b('0xe'),JSON[_0xa35b('0x11')](_0x24a4cf));if(_0x24a4cf['error']){if(_0x24a4cf[_0xa35b('0x12')]['code']===0x1f4){logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x121c8b,_0x24a4cf[_0xa35b('0x12')][_0xa35b('0x13')]);return _0x3ceb59(_0x24a4cf[_0xa35b('0x12')]['message']);}logger[_0xa35b('0x12')]('Migration,\x20%s,\x20%s',_0x121c8b,_0x24a4cf[_0xa35b('0x12')]['message']);return _0x42da91(_0x24a4cf[_0xa35b('0x12')][_0xa35b('0x13')]);}else{logger['info'](_0xa35b('0xd'),_0x121c8b,_0xa35b('0xe'));_0x42da91(_0x24a4cf[_0xa35b('0x14')][_0xa35b('0x13')]);}})[_0xa35b('0x15')](function(_0x3f1c6f){logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x121c8b,_0x3f1c6f);_0x3ceb59(_0x3f1c6f);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 73e89ed..8fcccce 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 _0x6050=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','post','isAuthenticated','create'];(function(_0x4470dc,_0x277b43){var _0x2105ff=function(_0x3f7ffc){while(--_0x3f7ffc){_0x4470dc['push'](_0x4470dc['shift']());}};_0x2105ff(++_0x277b43);}(_0x6050,0x196));var _0x0605=function(_0x55bccc,_0x1e258f){_0x55bccc=_0x55bccc-0x0;var _0x5a18d2=_0x6050[_0x55bccc];return _0x5a18d2;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')]('/',auth[_0x0605('0xc')](),controller[_0x0605('0xd')]);router[_0x0605('0xe')]('/:id',auth[_0x0605('0xc')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xc')](),controller[_0x0605('0x12')]);module[_0x0605('0x13')]=router; \ No newline at end of file +var _0xc15b=['./network.controller','get','isAuthenticated','show','post','put','/:id','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5779b6,_0x322ea4){var _0xb78705=function(_0xccd109){while(--_0xccd109){_0x5779b6['push'](_0x5779b6['shift']());}};_0xb78705(++_0x322ea4);}(_0xc15b,0x159));var _0xbc15=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xc15b[_0x5c3ae9];return _0x3f5950;};'use strict';var multer=require(_0xbc15('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc15('0x1'));var router=express[_0xbc15('0x2')]();var fs_extra=require(_0xbc15('0x3'));var auth=require(_0xbc15('0x4'));var interaction=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var controller=require(_0xbc15('0x7'));router[_0xbc15('0x8')]('/',auth[_0xbc15('0x9')](),controller['index']);router[_0xbc15('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbc15('0xa')]);router[_0xbc15('0xb')]('/',auth[_0xbc15('0x9')](),controller['create']);router[_0xbc15('0xc')](_0xbc15('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbc15('0xe')](_0xbc15('0xd'),auth[_0xbc15('0x9')](),controller['destroy']);module[_0xbc15('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9be69c8..b4cacb4 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 _0xa74b=['turn','STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa74b,0x1a6));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xba74('0x0'));module[_0xba74('0x1')]={'type':{'type':Sequelize[_0xba74('0x2')](_0xba74('0x3'),'externip',_0xba74('0x4'),_0xba74('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xba74('0x6')]}}; \ No newline at end of file +var _0x2209=['stun','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x1784e5,_0x305050){var _0x514eb3=function(_0x4e466e){while(--_0x4e466e){_0x1784e5['push'](_0x1784e5['shift']());}};_0x514eb3(++_0x305050);}(_0x2209,0x1ad));var _0x9220=function(_0x1b5eb9,_0x5cda83){_0x1b5eb9=_0x1b5eb9-0x0;var _0x2eb2cb=_0x2209[_0x1b5eb9];return _0x2eb2cb;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'type':{'type':Sequelize[_0x9220('0x2')](_0x9220('0x3'),_0x9220('0x4'),_0x9220('0x5'),'turn')},'value':{'type':Sequelize[_0x9220('0x6')]},'username':{'type':Sequelize[_0x9220('0x6')]},'password':{'type':Sequelize[_0x9220('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 146c52b..5948209 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 _0xa9e2=['result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','create','body','toUpperCase','readFileSync','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','find','STUN','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3fb386,_0x5c6111){var _0x2983e5=function(_0x4d8417){while(--_0x4d8417){_0x3fb386['push'](_0x3fb386['shift']());}};_0x2983e5(++_0x5c6111);}(_0xa9e2,0x9b));var _0x2a9e=function(_0x3aeea5,_0x7da3dd){_0x3aeea5=_0x3aeea5-0x0;var _0x3f58ea=_0xa9e2[_0x3aeea5];return _0x3f58ea;};'use strict';var util=require(_0x2a9e('0x0'));var path=require(_0x2a9e('0x1'));var ejs=require(_0x2a9e('0x2'));var fs=require('fs');var _=require(_0x2a9e('0x3'));var qs=require(_0x2a9e('0x4'));var logger=require(_0x2a9e('0x5'))('api');var config=require(_0x2a9e('0x6'));var db=require(_0x2a9e('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2a9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47c16b,_0x457787,_0x5debb9,_0x1ed026){return new Promise(function(_0x221b7c,_0x1801c0){var _0x51ed69=_0x1ed026||client;return _0x51ed69[_0x2a9e('0x9')](_0x47c16b,_0x5debb9)[_0x2a9e('0xa')](function(_0xb7c881){logger['info'](_0x2a9e('0xb'),_0x457787,_0x2a9e('0xc'));logger[_0x2a9e('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x457787,_0x2a9e('0xc'),JSON[_0x2a9e('0xe')](_0xb7c881));if(_0xb7c881[_0x2a9e('0xf')]){if(_0xb7c881[_0x2a9e('0xf')][_0x2a9e('0x10')]===0x1f4){logger['error'](_0x2a9e('0xb'),_0x457787,_0xb7c881['error'][_0x2a9e('0x11')]);return _0x1801c0(_0xb7c881['error'][_0x2a9e('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x457787,_0xb7c881['error']['message']);return _0x221b7c(_0xb7c881['error'][_0x2a9e('0x11')]);}else{logger[_0x2a9e('0x12')](_0x2a9e('0xb'),_0x457787,_0x2a9e('0xc'));_0x221b7c(_0xb7c881[_0x2a9e('0x13')][_0x2a9e('0x11')]);}})[_0x2a9e('0x14')](function(_0x56500e){logger[_0x2a9e('0xf')]('Network,\x20%s,\x20%s',_0x457787,_0x56500e);_0x1801c0(_0x56500e);});});}function respondWithResult(_0x171564,_0x59d2aa){_0x59d2aa=_0x59d2aa||0xc8;return function(_0x4b1fff){if(_0x4b1fff){return _0x171564[_0x2a9e('0x15')](_0x59d2aa)[_0x2a9e('0x16')](_0x4b1fff);}};}function respondWithFilteredResult(_0x254771,_0x23a81c){return function(_0x195eef){if(_0x195eef){var _0x196f5a=typeof _0x23a81c['offset']===_0x2a9e('0x17')&&typeof _0x23a81c['limit']===_0x2a9e('0x17');var _0xe3adec=_0x195eef[_0x2a9e('0x18')];var _0x4428ec=_0x196f5a?0x0:_0x23a81c[_0x2a9e('0x19')];var _0x3db3ca=_0x196f5a?_0x195eef[_0x2a9e('0x18')]:_0x23a81c['offset']+_0x23a81c[_0x2a9e('0x1a')];var _0x4bf803;if(_0x3db3ca>=_0xe3adec){_0x3db3ca=_0xe3adec;_0x4bf803=0xc8;}else{_0x4bf803=0xce;}_0x254771[_0x2a9e('0x15')](_0x4bf803);return _0x254771[_0x2a9e('0x1b')](_0x2a9e('0x1c'),_0x4428ec+'-'+_0x3db3ca+'/'+_0xe3adec)[_0x2a9e('0x16')](_0x195eef);}return null;};}function saveUpdates(_0x3d030a){return function(_0x16bb13){if(_0x16bb13){return _0x16bb13[_0x2a9e('0x1d')](_0x3d030a)[_0x2a9e('0xa')](function(_0x1bd079){return _0x1bd079;});}return null;};}function removeEntity(_0x10e992){return function(_0x19581c){if(_0x19581c){return _0x19581c[_0x2a9e('0x1e')]()[_0x2a9e('0xa')](function(){_0x10e992[_0x2a9e('0x15')](0xcc)[_0x2a9e('0x1f')]();});}};}function handleEntityNotFound(_0x3c6a32){return function(_0x6d04b9){if(!_0x6d04b9){_0x3c6a32[_0x2a9e('0x20')](0x194);}return _0x6d04b9;};}function handleError(_0x3c1ccf,_0x417ae2){_0x417ae2=_0x417ae2||0x1f4;return function(_0x2da12f){logger[_0x2a9e('0xf')](_0x2da12f[_0x2a9e('0x21')]);if(_0x2da12f[_0x2a9e('0x22')]){delete _0x2da12f[_0x2a9e('0x22')];}_0x3c1ccf[_0x2a9e('0x15')](_0x417ae2)[_0x2a9e('0x23')](_0x2da12f);};}exports[_0x2a9e('0x24')]=function(_0x33ccfd,_0x33d52e){var _0x298adb={},_0x208c33={},_0x40d5af={'count':0x0,'rows':[]};var _0xe9fb67=_[_0x2a9e('0x25')](db[_0x2a9e('0x26')][_0x2a9e('0x27')],function(_0x55e04f){return{'name':_0x55e04f[_0x2a9e('0x28')],'type':_0x55e04f[_0x2a9e('0x29')][_0x2a9e('0x2a')]};});_0x208c33[_0x2a9e('0x2b')]=_['map'](_0xe9fb67,_0x2a9e('0x22'));_0x208c33[_0x2a9e('0x2c')]=_[_0x2a9e('0x2d')](_0x33ccfd['query']);_0x208c33['filters']=_[_0x2a9e('0x2e')](_0x208c33['model'],_0x208c33[_0x2a9e('0x2c')]);_0x298adb['attributes']=_[_0x2a9e('0x2e')](_0x208c33[_0x2a9e('0x2b')],qs[_0x2a9e('0x2f')](_0x33ccfd['query'][_0x2a9e('0x2f')]));_0x298adb[_0x2a9e('0x30')]=_0x298adb['attributes'][_0x2a9e('0x31')]?_0x298adb[_0x2a9e('0x30')]:_0x208c33[_0x2a9e('0x2b')];if(!_0x33ccfd['query']['hasOwnProperty']('nolimit')){_0x298adb[_0x2a9e('0x1a')]=qs['limit'](_0x33ccfd[_0x2a9e('0x2c')]['limit']);_0x298adb[_0x2a9e('0x19')]=qs[_0x2a9e('0x19')](_0x33ccfd[_0x2a9e('0x2c')]['offset']);}_0x298adb[_0x2a9e('0x32')]=qs['sort'](_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x33')]);_0x298adb[_0x2a9e('0x34')]=qs['filters'](_['pick'](_0x33ccfd[_0x2a9e('0x2c')],_0x208c33[_0x2a9e('0x35')]),_0xe9fb67);if(_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x36')]){_0x298adb[_0x2a9e('0x34')]=_['merge'](_0x298adb[_0x2a9e('0x34')],{'$or':_['map'](_0xe9fb67,function(_0x4a55d4){if(_0x4a55d4[_0x2a9e('0x29')]!==_0x2a9e('0x37')){var _0x54392d={};_0x54392d[_0x4a55d4[_0x2a9e('0x22')]]={'$like':'%'+_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x36')]+'%'};return _0x54392d;}})});}_0x298adb=_[_0x2a9e('0x38')]({},_0x298adb,_0x33ccfd['options']);var _0x3adc46={'where':_0x298adb[_0x2a9e('0x34')]};return db[_0x2a9e('0x26')][_0x2a9e('0x18')](_0x3adc46)[_0x2a9e('0xa')](function(_0x455f2f){_0x40d5af[_0x2a9e('0x18')]=_0x455f2f;if(_0x33ccfd[_0x2a9e('0x2c')][_0x2a9e('0x39')]){_0x298adb[_0x2a9e('0x3a')]=[{'all':!![]}];}return db['Network'][_0x2a9e('0x3b')](_0x298adb);})[_0x2a9e('0xa')](function(_0x42f525){_0x40d5af[_0x2a9e('0x3c')]=_0x42f525;return _0x40d5af;})[_0x2a9e('0xa')](respondWithFilteredResult(_0x33d52e,_0x298adb))[_0x2a9e('0x14')](handleError(_0x33d52e,null));};exports[_0x2a9e('0x3d')]=function(_0x246f9b,_0x217505){var _0x29a239={'raw':!![],'where':{'id':_0x246f9b[_0x2a9e('0x3e')]['id']}},_0x37d598={};_0x37d598[_0x2a9e('0x2b')]=_[_0x2a9e('0x2d')](db['Network'][_0x2a9e('0x27')]);_0x37d598[_0x2a9e('0x2c')]=_['keys'](_0x246f9b[_0x2a9e('0x2c')]);_0x37d598[_0x2a9e('0x35')]=_['intersection'](_0x37d598['model'],_0x37d598['query']);_0x29a239[_0x2a9e('0x30')]=_[_0x2a9e('0x2e')](_0x37d598[_0x2a9e('0x2b')],qs['fields'](_0x246f9b[_0x2a9e('0x2c')][_0x2a9e('0x2f')]));_0x29a239[_0x2a9e('0x30')]=_0x29a239['attributes'][_0x2a9e('0x31')]?_0x29a239[_0x2a9e('0x30')]:_0x37d598[_0x2a9e('0x2b')];if(_0x246f9b['query'][_0x2a9e('0x39')]){_0x29a239[_0x2a9e('0x3a')]=[{'all':!![]}];}_0x29a239=_['merge']({},_0x29a239,_0x246f9b[_0x2a9e('0x3f')]);return db['Network']['find'](_0x29a239)[_0x2a9e('0xa')](handleEntityNotFound(_0x217505,null))['then'](respondWithResult(_0x217505,null))[_0x2a9e('0x14')](handleError(_0x217505,null));};exports[_0x2a9e('0x40')]=function(_0x274969,_0x441d47){var _0x19b120;return db[_0x2a9e('0x26')]['create'](_0x274969[_0x2a9e('0x41')],{'raw':!![]})[_0x2a9e('0xa')](function(_0x110fbd){_0x19b120=_0x110fbd;return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x274969[_0x2a9e('0x41')][_0x2a9e('0x29')]},'raw':!![]});})['then'](function(_0x29fa3b){if(_0x19b120[_0x2a9e('0x29')][_0x2a9e('0x42')]()=='STUN'){var _0x3863b3=fs[_0x2a9e('0x43')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x2a9e('0x44'));var _0x1db041=ejs['render'](_0x3863b3,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x1db041);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':_0x2a9e('0x48')});}else if(_0x19b120['type'][_0x2a9e('0x42')]()==_0x2a9e('0x49')){var _0x258f8a=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x4fdf45=ejs[_0x2a9e('0x4d')](_0x258f8a,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x4e'),_0x4fdf45);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':'res_stun_monitor.so'});}else{var _0x5c72c0=fs[_0x2a9e('0x43')](path['join'](config['root'],_0x2a9e('0x4f')),_0x2a9e('0x44'));var _0x1e860d=ejs[_0x2a9e('0x4d')](_0x5c72c0,{'networks':_0x29fa3b||[]});fs[_0x2a9e('0x45')](util[_0x2a9e('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x274969[_0x2a9e('0x41')]['type'][_0x2a9e('0x51')]()),_0x1e860d);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x40'),{'module':_0x2a9e('0x52')});}})['then'](function(){return _0x19b120;})[_0x2a9e('0xa')](respondWithResult(_0x441d47,0xc9))[_0x2a9e('0x14')](handleError(_0x441d47,null));};exports[_0x2a9e('0x1d')]=function(_0x579fd0,_0x2229df){var _0x517624;return db[_0x2a9e('0x26')][_0x2a9e('0x53')]({'where':{'id':_0x579fd0[_0x2a9e('0x3e')]['id']}})[_0x2a9e('0xa')](handleEntityNotFound(_0x2229df,null))['then'](saveUpdates(_0x579fd0[_0x2a9e('0x41')],null))['then'](function(_0x3b2977){if(_0x3b2977){_0x517624=_0x3b2977;return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x517624['type']},'raw':!![]});}return null;})[_0x2a9e('0xa')](function(_0x5614e8){if(_0x517624[_0x2a9e('0x29')][_0x2a9e('0x42')]()==_0x2a9e('0x54')){var _0x2896bd=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x55')),_0x2a9e('0x44'));var _0x1156ea=ejs['render'](_0x2896bd,{'networks':_0x5614e8||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x1156ea);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1d'),{'module':_0x2a9e('0x48')});}else if(_0x517624[_0x2a9e('0x29')][_0x2a9e('0x42')]()=='TURN'){var _0x11f644=fs['readFileSync'](path['join'](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x4a97f9=ejs[_0x2a9e('0x4d')](_0x11f644,{'networks':_0x5614e8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4a97f9);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1d'),{'module':_0x2a9e('0x48')});}else{var _0x249441=fs[_0x2a9e('0x43')](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4f')),'utf8');var _0x48ef9d=ejs[_0x2a9e('0x4d')](_0x249441,{'networks':_0x5614e8||[]});fs['writeFileSync'](util[_0x2a9e('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x579fd0[_0x2a9e('0x41')]['type']['toLowerCase']()),_0x48ef9d);return respondWithRpcPromise(_0x2a9e('0x47'),'update',{'module':_0x2a9e('0x52')});}})[_0x2a9e('0xa')](function(_0x45618f){if(_0x45618f){return _0x517624;}return null;})[_0x2a9e('0xa')](respondWithResult(_0x2229df,null))[_0x2a9e('0x14')](handleError(_0x2229df,null));};exports['destroy']=function(_0x5282d6,_0x160ac7){var _0x1df32c;return db['Network'][_0x2a9e('0x53')]({'where':{'id':_0x5282d6[_0x2a9e('0x3e')]['id']}})[_0x2a9e('0xa')](function(_0x1f7e25){_0x1df32c=_0x1f7e25;return _0x1f7e25;})[_0x2a9e('0xa')](handleEntityNotFound(_0x160ac7,null))[_0x2a9e('0xa')](removeEntity(_0x160ac7,null))['then'](function(){if(_0x1df32c){return db[_0x2a9e('0x26')][_0x2a9e('0x3b')]({'where':{'type':_0x1df32c[_0x2a9e('0x29')]},'raw':!![]});}})[_0x2a9e('0xa')](function(_0x450d96){if(_0x1df32c[_0x2a9e('0x29')]['toUpperCase']()==_0x2a9e('0x54')){var _0x1bc9dd=fs['readFileSync'](path[_0x2a9e('0x4a')](config['root'],_0x2a9e('0x55')),_0x2a9e('0x44'));var _0x96fb3=ejs[_0x2a9e('0x4d')](_0x1bc9dd,{'networks':_0x450d96||[]});fs[_0x2a9e('0x45')](_0x2a9e('0x46'),_0x96fb3);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x1df32c['type'][_0x2a9e('0x42')]()=='TURN'){var _0x512b58=fs[_0x2a9e('0x43')](path['join'](config[_0x2a9e('0x4b')],_0x2a9e('0x4c')),_0x2a9e('0x44'));var _0x1a1618=ejs[_0x2a9e('0x4d')](_0x512b58,{'networks':_0x450d96||[]});fs[_0x2a9e('0x45')]('/etc/asterisk/turn_xcally.conf',_0x1a1618);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':_0x2a9e('0x48')});}else{var _0x512cd1=fs['readFileSync'](path[_0x2a9e('0x4a')](config[_0x2a9e('0x4b')],_0x2a9e('0x4f')),_0x2a9e('0x44'));var _0x11fbed=ejs[_0x2a9e('0x4d')](_0x512cd1,{'networks':_0x450d96||[]});fs['writeFileSync'](util[_0x2a9e('0x50')](_0x2a9e('0x56'),_0x1df32c[_0x2a9e('0x29')][_0x2a9e('0x51')]()),_0x11fbed);return respondWithRpcPromise(_0x2a9e('0x47'),_0x2a9e('0x1e'),{'module':_0x2a9e('0x52')});}})[_0x2a9e('0x14')](handleError(_0x160ac7,null));}; \ No newline at end of file +var _0xe55b=['catch','show','merge','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/network.ejs','find','params','util','path','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','undefined','count','offset','limit','Content-Range','destroy','end','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll'];(function(_0x54319a,_0x4cc13c){var _0x57224d=function(_0x4a57d6){while(--_0x4a57d6){_0x54319a['push'](_0x54319a['shift']());}};_0x57224d(++_0x4cc13c);}(_0xe55b,0x168));var _0xbe55=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0xe55b[_0x401d67];return _0x25076b;};'use strict';var util=require(_0xbe55('0x0'));var path=require(_0xbe55('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe55('0x2'));var qs=require(_0xbe55('0x3'));var logger=require('../../config/logger')(_0xbe55('0x4'));var config=require(_0xbe55('0x5'));var db=require(_0xbe55('0x6'))['db'];var jayson=require(_0xbe55('0x7'));var client=jayson[_0xbe55('0x8')][_0xbe55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x425b33,_0xb2e4fe,_0x137455,_0x5a1842){return new Promise(function(_0x5a74a9,_0x13d826){var _0x4dfe00=_0x5a1842||client;return _0x4dfe00['request'](_0x425b33,_0x137455)[_0xbe55('0xa')](function(_0x52cb9c){logger[_0xbe55('0xb')](_0xbe55('0xc'),_0xb2e4fe,_0xbe55('0xd'));logger['debug'](_0xbe55('0xe'),_0xb2e4fe,'request\x20sent',JSON[_0xbe55('0xf')](_0x52cb9c));if(_0x52cb9c[_0xbe55('0x10')]){if(_0x52cb9c[_0xbe55('0x10')][_0xbe55('0x11')]===0x1f4){logger[_0xbe55('0x10')]('Network,\x20%s,\x20%s',_0xb2e4fe,_0x52cb9c['error'][_0xbe55('0x12')]);return _0x13d826(_0x52cb9c['error'][_0xbe55('0x12')]);}logger[_0xbe55('0x10')](_0xbe55('0xc'),_0xb2e4fe,_0x52cb9c['error'][_0xbe55('0x12')]);return _0x5a74a9(_0x52cb9c[_0xbe55('0x10')][_0xbe55('0x12')]);}else{logger[_0xbe55('0xb')]('Network,\x20%s,\x20%s',_0xb2e4fe,_0xbe55('0xd'));_0x5a74a9(_0x52cb9c['result'][_0xbe55('0x12')]);}})['catch'](function(_0x31639e){logger[_0xbe55('0x10')](_0xbe55('0xc'),_0xb2e4fe,_0x31639e);_0x13d826(_0x31639e);});});}function respondWithResult(_0xe1a7da,_0x5dd9ab){_0x5dd9ab=_0x5dd9ab||0xc8;return function(_0x119085){if(_0x119085){return _0xe1a7da[_0xbe55('0x13')](_0x5dd9ab)[_0xbe55('0x14')](_0x119085);}};}function respondWithFilteredResult(_0x3a4820,_0xec2deb){return function(_0x3aabd5){if(_0x3aabd5){var _0x170d72=typeof _0xec2deb['offset']===_0xbe55('0x15')&&typeof _0xec2deb['limit']===_0xbe55('0x15');var _0x12c451=_0x3aabd5['count'];var _0x43bfc1=_0x170d72?0x0:_0xec2deb['offset'];var _0x409bdc=_0x170d72?_0x3aabd5[_0xbe55('0x16')]:_0xec2deb[_0xbe55('0x17')]+_0xec2deb[_0xbe55('0x18')];var _0x1a0351;if(_0x409bdc>=_0x12c451){_0x409bdc=_0x12c451;_0x1a0351=0xc8;}else{_0x1a0351=0xce;}_0x3a4820['status'](_0x1a0351);return _0x3a4820['set'](_0xbe55('0x19'),_0x43bfc1+'-'+_0x409bdc+'/'+_0x12c451)[_0xbe55('0x14')](_0x3aabd5);}return null;};}function saveUpdates(_0x10c885){return function(_0x3f9703){if(_0x3f9703){return _0x3f9703['update'](_0x10c885)[_0xbe55('0xa')](function(_0x21ff2b){return _0x21ff2b;});}return null;};}function removeEntity(_0x192b3d){return function(_0x22d9ed){if(_0x22d9ed){return _0x22d9ed[_0xbe55('0x1a')]()['then'](function(){_0x192b3d[_0xbe55('0x13')](0xcc)[_0xbe55('0x1b')]();});}};}function handleEntityNotFound(_0x2b9c45){return function(_0x4881f5){if(!_0x4881f5){_0x2b9c45[_0xbe55('0x1c')](0x194);}return _0x4881f5;};}function handleError(_0x3bc1f3,_0x3b026b){_0x3b026b=_0x3b026b||0x1f4;return function(_0x18c6d7){logger[_0xbe55('0x10')](_0x18c6d7[_0xbe55('0x1d')]);if(_0x18c6d7[_0xbe55('0x1e')]){delete _0x18c6d7[_0xbe55('0x1e')];}_0x3bc1f3[_0xbe55('0x13')](_0x3b026b)[_0xbe55('0x1f')](_0x18c6d7);};}exports['index']=function(_0x219661,_0x4d0c44){var _0x4c08c6={},_0x386e07={},_0x51bf4c={'count':0x0,'rows':[]};var _0x3bd898=_[_0xbe55('0x20')](db[_0xbe55('0x21')][_0xbe55('0x22')],function(_0x206fb0){return{'name':_0x206fb0[_0xbe55('0x23')],'type':_0x206fb0[_0xbe55('0x24')]['key']};});_0x386e07[_0xbe55('0x25')]=_[_0xbe55('0x20')](_0x3bd898,_0xbe55('0x1e'));_0x386e07[_0xbe55('0x26')]=_[_0xbe55('0x27')](_0x219661[_0xbe55('0x26')]);_0x386e07[_0xbe55('0x28')]=_[_0xbe55('0x29')](_0x386e07[_0xbe55('0x25')],_0x386e07[_0xbe55('0x26')]);_0x4c08c6[_0xbe55('0x2a')]=_[_0xbe55('0x29')](_0x386e07[_0xbe55('0x25')],qs[_0xbe55('0x2b')](_0x219661[_0xbe55('0x26')]['fields']));_0x4c08c6[_0xbe55('0x2a')]=_0x4c08c6[_0xbe55('0x2a')]['length']?_0x4c08c6[_0xbe55('0x2a')]:_0x386e07[_0xbe55('0x25')];if(!_0x219661[_0xbe55('0x26')][_0xbe55('0x2c')](_0xbe55('0x2d'))){_0x4c08c6[_0xbe55('0x18')]=qs[_0xbe55('0x18')](_0x219661[_0xbe55('0x26')][_0xbe55('0x18')]);_0x4c08c6[_0xbe55('0x17')]=qs[_0xbe55('0x17')](_0x219661[_0xbe55('0x26')][_0xbe55('0x17')]);}_0x4c08c6[_0xbe55('0x2e')]=qs['sort'](_0x219661[_0xbe55('0x26')][_0xbe55('0x2f')]);_0x4c08c6['where']=qs[_0xbe55('0x28')](_[_0xbe55('0x30')](_0x219661[_0xbe55('0x26')],_0x386e07['filters']),_0x3bd898);if(_0x219661[_0xbe55('0x26')][_0xbe55('0x31')]){_0x4c08c6[_0xbe55('0x32')]=_['merge'](_0x4c08c6[_0xbe55('0x32')],{'$or':_[_0xbe55('0x20')](_0x3bd898,function(_0x3cd0ff){if(_0x3cd0ff[_0xbe55('0x24')]!=='VIRTUAL'){var _0x1a64e0={};_0x1a64e0[_0x3cd0ff[_0xbe55('0x1e')]]={'$like':'%'+_0x219661[_0xbe55('0x26')][_0xbe55('0x31')]+'%'};return _0x1a64e0;}})});}_0x4c08c6=_['merge']({},_0x4c08c6,_0x219661[_0xbe55('0x33')]);var _0x1d0dcf={'where':_0x4c08c6[_0xbe55('0x32')]};return db['Network']['count'](_0x1d0dcf)[_0xbe55('0xa')](function(_0x139d1b){_0x51bf4c[_0xbe55('0x16')]=_0x139d1b;if(_0x219661['query'][_0xbe55('0x34')]){_0x4c08c6[_0xbe55('0x35')]=[{'all':!![]}];}return db[_0xbe55('0x21')][_0xbe55('0x36')](_0x4c08c6);})[_0xbe55('0xa')](function(_0x48af31){_0x51bf4c['rows']=_0x48af31;return _0x51bf4c;})[_0xbe55('0xa')](respondWithFilteredResult(_0x4d0c44,_0x4c08c6))[_0xbe55('0x37')](handleError(_0x4d0c44,null));};exports[_0xbe55('0x38')]=function(_0x39d2d7,_0x37351a){var _0x4283fc={'raw':!![],'where':{'id':_0x39d2d7['params']['id']}},_0x11c34d={};_0x11c34d[_0xbe55('0x25')]=_[_0xbe55('0x27')](db[_0xbe55('0x21')][_0xbe55('0x22')]);_0x11c34d[_0xbe55('0x26')]=_[_0xbe55('0x27')](_0x39d2d7['query']);_0x11c34d[_0xbe55('0x28')]=_[_0xbe55('0x29')](_0x11c34d['model'],_0x11c34d[_0xbe55('0x26')]);_0x4283fc['attributes']=_[_0xbe55('0x29')](_0x11c34d[_0xbe55('0x25')],qs[_0xbe55('0x2b')](_0x39d2d7[_0xbe55('0x26')][_0xbe55('0x2b')]));_0x4283fc[_0xbe55('0x2a')]=_0x4283fc['attributes']['length']?_0x4283fc[_0xbe55('0x2a')]:_0x11c34d['model'];if(_0x39d2d7[_0xbe55('0x26')][_0xbe55('0x34')]){_0x4283fc['include']=[{'all':!![]}];}_0x4283fc=_[_0xbe55('0x39')]({},_0x4283fc,_0x39d2d7[_0xbe55('0x33')]);return db[_0xbe55('0x21')]['find'](_0x4283fc)[_0xbe55('0xa')](handleEntityNotFound(_0x37351a,null))[_0xbe55('0xa')](respondWithResult(_0x37351a,null))[_0xbe55('0x37')](handleError(_0x37351a,null));};exports[_0xbe55('0x3a')]=function(_0x267ef6,_0x9f5145){var _0x5e422f;return db[_0xbe55('0x21')]['create'](_0x267ef6[_0xbe55('0x3b')],{'raw':!![]})[_0xbe55('0xa')](function(_0x2bd178){_0x5e422f=_0x2bd178;return db[_0xbe55('0x21')][_0xbe55('0x36')]({'where':{'type':_0x267ef6[_0xbe55('0x3b')][_0xbe55('0x24')]},'raw':!![]});})['then'](function(_0x4be69e){if(_0x5e422f[_0xbe55('0x24')][_0xbe55('0x3c')]()==_0xbe55('0x3d')){var _0x5f3ff0=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],_0xbe55('0x41')),_0xbe55('0x42'));var _0x14d776=ejs[_0xbe55('0x43')](_0x5f3ff0,{'networks':_0x4be69e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x14d776);return respondWithRpcPromise(_0xbe55('0x44'),_0xbe55('0x3a'),{'module':_0xbe55('0x45')});}else if(_0x5e422f[_0xbe55('0x24')]['toUpperCase']()=='TURN'){var _0x19d807=fs['readFileSync'](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],_0xbe55('0x46')),_0xbe55('0x42'));var _0x59e11d=ejs['render'](_0x19d807,{'networks':_0x4be69e||[]});fs[_0xbe55('0x47')](_0xbe55('0x48'),_0x59e11d);return respondWithRpcPromise(_0xbe55('0x44'),_0xbe55('0x3a'),{'module':_0xbe55('0x45')});}else{var _0x51f51c=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],'server/files/templates/network.ejs'),_0xbe55('0x42'));var _0x48b887=ejs[_0xbe55('0x43')](_0x51f51c,{'networks':_0x4be69e||[]});fs[_0xbe55('0x47')](util[_0xbe55('0x49')](_0xbe55('0x4a'),_0x267ef6[_0xbe55('0x3b')][_0xbe55('0x24')][_0xbe55('0x4b')]()),_0x48b887);return respondWithRpcPromise('Reload',_0xbe55('0x3a'),{'module':_0xbe55('0x4c')});}})['then'](function(){return _0x5e422f;})[_0xbe55('0xa')](respondWithResult(_0x9f5145,0xc9))[_0xbe55('0x37')](handleError(_0x9f5145,null));};exports[_0xbe55('0x4d')]=function(_0x402794,_0x1a8648){var _0x5a452d;return db[_0xbe55('0x21')]['find']({'where':{'id':_0x402794['params']['id']}})['then'](handleEntityNotFound(_0x1a8648,null))[_0xbe55('0xa')](saveUpdates(_0x402794[_0xbe55('0x3b')],null))[_0xbe55('0xa')](function(_0x3c5110){if(_0x3c5110){_0x5a452d=_0x3c5110;return db[_0xbe55('0x21')][_0xbe55('0x36')]({'where':{'type':_0x5a452d[_0xbe55('0x24')]},'raw':!![]});}return null;})[_0xbe55('0xa')](function(_0x1fe50c){if(_0x5a452d[_0xbe55('0x24')][_0xbe55('0x3c')]()==_0xbe55('0x3d')){var _0x5cc2a5=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xbe55('0x42'));var _0x4173c8=ejs[_0xbe55('0x43')](_0x5cc2a5,{'networks':_0x1fe50c||[]});fs[_0xbe55('0x47')](_0xbe55('0x4e'),_0x4173c8);return respondWithRpcPromise(_0xbe55('0x44'),_0xbe55('0x4d'),{'module':_0xbe55('0x45')});}else if(_0x5a452d[_0xbe55('0x24')][_0xbe55('0x3c')]()==_0xbe55('0x4f')){var _0x37803c=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],_0xbe55('0x46')),'utf8');var _0x53c553=ejs[_0xbe55('0x43')](_0x37803c,{'networks':_0x1fe50c||[]});fs[_0xbe55('0x47')](_0xbe55('0x48'),_0x53c553);return respondWithRpcPromise(_0xbe55('0x44'),_0xbe55('0x4d'),{'module':_0xbe55('0x45')});}else{var _0x52d627=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],_0xbe55('0x50')),_0xbe55('0x42'));var _0x75d3c8=ejs[_0xbe55('0x43')](_0x52d627,{'networks':_0x1fe50c||[]});fs[_0xbe55('0x47')](util['format'](_0xbe55('0x4a'),_0x402794[_0xbe55('0x3b')][_0xbe55('0x24')][_0xbe55('0x4b')]()),_0x75d3c8);return respondWithRpcPromise(_0xbe55('0x44'),_0xbe55('0x4d'),{'module':'chan_sip.so'});}})['then'](function(_0x4d8ca0){if(_0x4d8ca0){return _0x5a452d;}return null;})['then'](respondWithResult(_0x1a8648,null))['catch'](handleError(_0x1a8648,null));};exports[_0xbe55('0x1a')]=function(_0x2d92af,_0x103cfb){var _0x3d48d7;return db['Network'][_0xbe55('0x51')]({'where':{'id':_0x2d92af[_0xbe55('0x52')]['id']}})['then'](function(_0x5889ab){_0x3d48d7=_0x5889ab;return _0x5889ab;})['then'](handleEntityNotFound(_0x103cfb,null))['then'](removeEntity(_0x103cfb,null))[_0xbe55('0xa')](function(){if(_0x3d48d7){return db[_0xbe55('0x21')]['findAll']({'where':{'type':_0x3d48d7[_0xbe55('0x24')]},'raw':!![]});}})[_0xbe55('0xa')](function(_0x10e439){if(_0x3d48d7[_0xbe55('0x24')][_0xbe55('0x3c')]()==_0xbe55('0x3d')){var _0x144242=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],'server/files/templates/stun_multiple.ejs'),_0xbe55('0x42'));var _0x3a538e=ejs[_0xbe55('0x43')](_0x144242,{'networks':_0x10e439||[]});fs[_0xbe55('0x47')](_0xbe55('0x4e'),_0x3a538e);return respondWithRpcPromise('Reload',_0xbe55('0x1a'),{'module':_0xbe55('0x45')});}else if(_0x3d48d7[_0xbe55('0x24')][_0xbe55('0x3c')]()==_0xbe55('0x4f')){var _0x10a847=fs[_0xbe55('0x3e')](path[_0xbe55('0x3f')](config[_0xbe55('0x40')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0xee87b3=ejs[_0xbe55('0x43')](_0x10a847,{'networks':_0x10e439||[]});fs[_0xbe55('0x47')](_0xbe55('0x48'),_0xee87b3);return respondWithRpcPromise('Reload',_0xbe55('0x1a'),{'module':_0xbe55('0x45')});}else{var _0x3ac34b=fs['readFileSync'](path[_0xbe55('0x3f')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x25793f=ejs[_0xbe55('0x43')](_0x3ac34b,{'networks':_0x10e439||[]});fs['writeFileSync'](util[_0xbe55('0x49')](_0xbe55('0x4a'),_0x3d48d7[_0xbe55('0x24')][_0xbe55('0x4b')]()),_0x25793f);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});}})['catch'](handleError(_0x103cfb,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6281923..01d8d65 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 _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x1e558d,_0x309ad0){var _0x4cf263=function(_0x4aec1f){while(--_0x4aec1f){_0x1e558d['push'](_0x1e558d['shift']());}};_0x4cf263(++_0x309ad0);}(_0x0db9,0xa3));var _0x90db=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x0db9[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7af2=['../../config/environment','./network.attributes','exports','define','network','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3f769d,_0x4bb1b0){var _0x4a375e=function(_0x55d5c9){while(--_0x55d5c9){_0x3f769d['push'](_0x3f769d['shift']());}};_0x4a375e(++_0x4bb1b0);}(_0x7af2,0x119));var _0x27af=function(_0x41e963,_0xe97bf7){_0x41e963=_0x41e963-0x0;var _0xdc2768=_0x7af2[_0x41e963];return _0xdc2768;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var BPromise=require('bluebird');var rp=require(_0x27af('0x4'));var fs=require('fs');var path=require(_0x27af('0x5'));var rimraf=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var attributes=require(_0x27af('0x8'));module[_0x27af('0x9')]=function(_0x350532,_0x184630){return _0x350532[_0x27af('0xa')]('Network',attributes,{'tableName':_0x27af('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 79e07d3..e48d7f9 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x267ee1,_0x140792){_0x267ee1=_0x267ee1-0x0;var _0x3fc2ba=_0x7a54[_0x267ee1];return _0x3fc2ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x178e0b,_0x1b8a7f){var _0x4bb85c=function(_0x178f0f){while(--_0x178f0f){_0x178e0b['push'](_0x178e0b['shift']());}};_0x4bb85c(++_0x1b8a7f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2b2d7f9..f85f137 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 _0x3423=['/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2175a3,_0x426e08){var _0x3d308b=function(_0x3756fa){while(--_0x3756fa){_0x2175a3['push'](_0x2175a3['shift']());}};_0x3d308b(++_0x426e08);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x9')]('/:id/interactions',auth[_0x3342('0xa')](),controller[_0x3342('0x13')]);router[_0x3342('0x9')](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x15')]);router[_0x3342('0x16')]('/',auth['isAuthenticated'](),controller[_0x3342('0x17')]);router[_0x3342('0x16')]('/:id/dispositions',auth[_0x3342('0xa')](),controller[_0x3342('0x18')]);router['post']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x19')]);router[_0x3342('0x16')](_0x3342('0x1a'),controller[_0x3342('0x1b')]);router[_0x3342('0x16')](_0x3342('0x11'),auth[_0x3342('0xa')](),controller[_0x3342('0x1c')]);router['post'](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x1d')]);router['post'](_0x3342('0x1e'),auth[_0x3342('0xa')](),controller['send']);router[_0x3342('0x1f')](_0x3342('0xe'),auth['isAuthenticated'](),controller[_0x3342('0x20')]);router['delete'](_0x3342('0xe'),auth[_0x3342('0xa')](),controller[_0x3342('0x21')]);router[_0x3342('0x22')](_0x3342('0xf'),auth[_0x3342('0xa')](),controller[_0x3342('0x23')]);router[_0x3342('0x22')]('/:id/canned_answers',auth[_0x3342('0xa')](),controller['removeAnswers']);router['delete'](_0x3342('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3342('0x24')]=router; \ No newline at end of file +var _0xf4f4=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4f2b04,_0x2be08a){_0x4f2b04=_0x4f2b04-0x0;var _0x5bb169=_0xf4f4[_0x4f2b04];return _0x5bb169;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./openchannelAccount.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4f4f('0x8')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x8')](_0x4f4f('0x13'),auth['isAuthenticated'](),controller[_0x4f4f('0x14')]);router['get'](_0x4f4f('0x15'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x16')]);router[_0x4f4f('0x17')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0x18')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4f4f('0x19')]);router[_0x4f4f('0x17')](_0x4f4f('0x10'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x17')](_0x4f4f('0x1b'),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x17')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1d')]);router['post'](_0x4f4f('0x15'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1e')]);router[_0x4f4f('0x17')](_0x4f4f('0x1f'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x20')]);router[_0x4f4f('0x21')](_0x4f4f('0x22'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x23')]);router[_0x4f4f('0x24')](_0x4f4f('0x22'),auth[_0x4f4f('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x25')]);router['delete'](_0x4f4f('0x10'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x26')]);router[_0x4f4f('0x24')](_0x4f4f('0x15'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d2a7be5..3974e6c 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 _0x5b4a=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','generate','STRING','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(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x5b4a,0x12e));var _0xa5b4=function(_0x259d97,_0x2a07a4){_0x259d97=_0x259d97-0x0;var _0x5eac44=_0x5b4a[_0x259d97];return _0x5eac44;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa5b4('0x0'));module[_0xa5b4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa5b4('0x2')]();}},'replyUri':{'type':Sequelize[_0xa5b4('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa5b4('0x4')],'defaultValue':function(){return _0xa5b4('0x5');}},'notificationSound':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa5b4('0x3')]},'queueTransfer':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa5b4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xa5b4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa5b4('0x6')],'defaultValue':![],'comment':_0xa5b4('0x9'),'set':function(_0x5b53d8){if(!_0x5b53d8)this[_0xa5b4('0xa')](_0xa5b4('0xb'),null);this[_0xa5b4('0xa')](_0xa5b4('0xc'),_0x5b53d8);}}}; \ No newline at end of file +var _0xbab9=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1c0a34,_0x3745fe){var _0x3a0f2f=function(_0x5e3d2b){while(--_0x5e3d2b){_0x1c0a34['push'](_0x1c0a34['shift']());}};_0x3a0f2f(++_0x3745fe);}(_0xbab9,0x1e3));var _0x9bab=function(_0x1aa9e0,_0x30aebd){_0x1aa9e0=_0x1aa9e0-0x0;var _0x5a07ca=_0xbab9[_0x1aa9e0];return _0x5a07ca;};'use strict';var Sequelize=require(_0x9bab('0x0'));var rs=require(_0x9bab('0x1'));module[_0x9bab('0x2')]={'name':{'type':Sequelize[_0x9bab('0x3')],'unique':_0x9bab('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x9bab('0x3')]},'token':{'type':Sequelize[_0x9bab('0x3')],'defaultValue':function(){return rs[_0x9bab('0x5')]();}},'replyUri':{'type':Sequelize[_0x9bab('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9bab('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9bab('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9bab('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9bab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9bab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9bab('0x3')]},'queueTransfer':{'type':Sequelize[_0x9bab('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9bab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9bab('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9bab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9bab('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x9bab('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9bab('0x7')],'defaultValue':![],'comment':_0x9bab('0xa'),'set':function(_0x3cf7e5){if(!_0x3cf7e5)this[_0x9bab('0xb')]('mandatoryDispositionPauseId',null);this[_0x9bab('0xb')](_0x9bab('0xc'),_0x3cf7e5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d7c203f..3638058 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 _0xe641=['find','userProfileId','autoAssociation','UserProfileResource','body','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','nolimit','CannedAnswer','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','DESC','OpenchannelApplication','Applications','account','applications','list','priority','Contacts','from','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','OpenchannelAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','OpenchannelAccount','findAll','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection'];(function(_0x44450c,_0x39f7e0){var _0x4e53ad=function(_0x578047){while(--_0x578047){_0x44450c['push'](_0x44450c['shift']());}};_0x4e53ad(++_0x39f7e0);}(_0xe641,0x1ec));var _0x1e64=function(_0x31919b,_0x41056d){_0x31919b=_0x31919b-0x0;var _0x29e2f1=_0xe641[_0x31919b];return _0x29e2f1;};'use strict';var emlformat=require(_0x1e64('0x0'));var rimraf=require(_0x1e64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e64('0x2'));var rp=require(_0x1e64('0x3'));var moment=require(_0x1e64('0x4'));var BPromise=require(_0x1e64('0x5'));var Mustache=require(_0x1e64('0x6'));var util=require(_0x1e64('0x7'));var path=require(_0x1e64('0x8'));var sox=require(_0x1e64('0x9'));var csv=require(_0x1e64('0xa'));var ejs=require(_0x1e64('0xb'));var fs=require('fs');var fs_extra=require(_0x1e64('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e64('0xd'));var jsforce=require(_0x1e64('0xe'));var deskjs=require(_0x1e64('0xf'));var toCsv=require(_0x1e64('0xa'));var querystring=require(_0x1e64('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e64('0x11'));var authService=require(_0x1e64('0x12'));var qs=require(_0x1e64('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e64('0x14'))(_0x1e64('0x15'));var utils=require(_0x1e64('0x16'));var config=require(_0x1e64('0x17'));var licenseUtil=require(_0x1e64('0x18'));var db=require('../../mysqldb')['db'];config[_0x1e64('0x19')]=_[_0x1e64('0x1a')](config[_0x1e64('0x19')],{'host':_0x1e64('0x1b'),'port':0x18eb});var socket=require(_0x1e64('0x1c'))(new Redis(config[_0x1e64('0x19')]));require(_0x1e64('0x1d'))[_0x1e64('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1e64('0x1f')][_0x1e64('0x20')]({'port':0x232c});var client9002=jayson[_0x1e64('0x1f')][_0x1e64('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x16b1b2,_0x3a513c,_0x566fb5,_0x55e83f){return new BPromise(function(_0x4d2e35,_0x7cc083){var _0x2a48e2=_0x55e83f||client;return _0x2a48e2[_0x1e64('0x21')](_0x16b1b2,_0x566fb5)[_0x1e64('0x22')](function(_0x2ffddf){logger['info'](_0x1e64('0x23'),_0x3a513c,_0x1e64('0x24'));logger[_0x1e64('0x25')](_0x1e64('0x26'),_0x3a513c,'request\x20sent',JSON[_0x1e64('0x27')](_0x2ffddf));if(_0x2ffddf['error']){if(_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x29')]===0x1f4){logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x2ffddf[_0x1e64('0x28')]['message']);return _0x7cc083(_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x2a')]);}logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x2ffddf[_0x1e64('0x28')][_0x1e64('0x2a')]);return _0x4d2e35(_0x2ffddf['error'][_0x1e64('0x2a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3a513c,'request\x20sent');_0x4d2e35(_0x2ffddf[_0x1e64('0x2b')][_0x1e64('0x2a')]);}})['catch'](function(_0x546f30){logger[_0x1e64('0x28')](_0x1e64('0x23'),_0x3a513c,_0x546f30);_0x7cc083(_0x546f30);});});}function respondWithStatusCode(_0x7b7f9b,_0x135131){_0x135131=_0x135131||0xcc;return function(_0x3427d3){if(_0x3427d3){return _0x7b7f9b['sendStatus'](_0x135131);}return _0x7b7f9b[_0x1e64('0x2c')](_0x135131)[_0x1e64('0x2d')]();};}function respondWithResult(_0x1d0e78,_0x3956a6){_0x3956a6=_0x3956a6||0xc8;return function(_0x278325){if(_0x278325){return _0x1d0e78[_0x1e64('0x2c')](_0x3956a6)[_0x1e64('0x2e')](_0x278325);}};}function respondWithFilteredResult(_0x23abcb,_0x5d79f6){return function(_0x4f861a){if(_0x4f861a){var _0x49f0c5=typeof _0x5d79f6[_0x1e64('0x2f')]===_0x1e64('0x30')&&typeof _0x5d79f6[_0x1e64('0x31')]===_0x1e64('0x30');var _0xdfc268=_0x4f861a[_0x1e64('0x32')];var _0x114cf9=_0x49f0c5?0x0:_0x5d79f6['offset'];var _0x23a32c=_0x49f0c5?_0x4f861a['count']:_0x5d79f6[_0x1e64('0x2f')]+_0x5d79f6[_0x1e64('0x31')];var _0x423bfe;if(_0x23a32c>=_0xdfc268){_0x23a32c=_0xdfc268;_0x423bfe=0xc8;}else{_0x423bfe=0xce;}_0x23abcb[_0x1e64('0x2c')](_0x423bfe);return _0x23abcb[_0x1e64('0x33')]('Content-Range',_0x114cf9+'-'+_0x23a32c+'/'+_0xdfc268)[_0x1e64('0x2e')](_0x4f861a);}return null;};}function patchUpdates(_0x527a8f){return function(_0x58f21a){try{jsonpatch[_0x1e64('0x34')](_0x58f21a,_0x527a8f,!![]);}catch(_0x3dce3b){return BPromise[_0x1e64('0x35')](_0x3dce3b);}return _0x58f21a[_0x1e64('0x36')]();};}function saveUpdates(_0x28ba97,_0x1fd1d2){return function(_0x44e3d6){if(_0x44e3d6){return _0x44e3d6[_0x1e64('0x37')](_0x28ba97)[_0x1e64('0x22')](function(_0x467678){return _0x467678;});}return null;};}function removeEntity(_0x5d705e,_0x170bc1){return function(_0x44cc2f){if(_0x44cc2f){return _0x44cc2f[_0x1e64('0x38')]()[_0x1e64('0x22')](function(){var _0x1b2d08=_0x44cc2f['get']({'plain':!![]});var _0x4648b2=_0x1e64('0x39');return db['UserProfileResource'][_0x1e64('0x38')]({'where':{'type':_0x4648b2,'resourceId':_0x1b2d08['id']}})[_0x1e64('0x22')](function(){return _0x44cc2f;});})[_0x1e64('0x22')](function(){_0x5d705e[_0x1e64('0x2c')](0xcc)[_0x1e64('0x2d')]();});}};}function handleEntityNotFound(_0x5dc115,_0x9dd35f){return function(_0x86c9c8){if(!_0x86c9c8){_0x5dc115[_0x1e64('0x3a')](0x194);}return _0x86c9c8;};}function handleError(_0x3f7e75,_0x57b8db){_0x57b8db=_0x57b8db||0x1f4;return function(_0x4cf170){logger[_0x1e64('0x28')](_0x4cf170[_0x1e64('0x3b')]);if(_0x4cf170[_0x1e64('0x3c')]){delete _0x4cf170[_0x1e64('0x3c')];}_0x3f7e75[_0x1e64('0x2c')](_0x57b8db)[_0x1e64('0x3d')](_0x4cf170);};}exports[_0x1e64('0x3e')]=function(_0xce5931,_0x23f08d){var _0x31b120={'include':[{'model':db[_0x1e64('0x3f')],'as':_0x1e64('0x40')}]},_0x4f1e8a={},_0xdf4048={'count':0x0,'rows':[]};var _0x5a84a4=_[_0x1e64('0x41')](db['OpenchannelAccount'][_0x1e64('0x42')],function(_0x2cfa08){return{'name':_0x2cfa08[_0x1e64('0x43')],'type':_0x2cfa08[_0x1e64('0x44')][_0x1e64('0x45')]};});_0x4f1e8a['model']=_['map'](_0x5a84a4,_0x1e64('0x3c'));_0x4f1e8a[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0xce5931['query']);_0x4f1e8a[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x4f1e8a[_0x1e64('0x4a')],_0x4f1e8a[_0x1e64('0x46')]);_0x31b120['attributes']=_[_0x1e64('0x49')](_0x4f1e8a[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x31b120['attributes']=_0x31b120[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x31b120[_0x1e64('0x4c')]:_0x4f1e8a[_0x1e64('0x4a')];if(!_0xce5931[_0x1e64('0x46')][_0x1e64('0x4e')]('nolimit')){_0x31b120[_0x1e64('0x31')]=qs['limit'](_0xce5931[_0x1e64('0x46')]['limit']);_0x31b120[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x31b120[_0x1e64('0x4f')]=qs[_0x1e64('0x50')](_0xce5931[_0x1e64('0x46')][_0x1e64('0x50')]);_0x31b120[_0x1e64('0x51')]=qs['filters'](_[_0x1e64('0x52')](_0xce5931[_0x1e64('0x46')],_0x4f1e8a['filters']),_0x5a84a4);if(_0xce5931[_0x1e64('0x46')][_0x1e64('0x53')]){_0x31b120[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x31b120[_0x1e64('0x51')],{'$or':_['map'](_0x5a84a4,function(_0xd0ee6e){if(_0xd0ee6e[_0x1e64('0x44')]!==_0x1e64('0x55')){var _0x5c889e={};_0x5c889e[_0xd0ee6e[_0x1e64('0x3c')]]={'$like':'%'+_0xce5931['query'][_0x1e64('0x53')]+'%'};return _0x5c889e;}})});}_0x31b120=_['merge']({},_0x31b120,_0xce5931['options']);var _0x2bc7c8={'where':_0x31b120[_0x1e64('0x51')]};return db['OpenchannelAccount']['count'](_0x2bc7c8)[_0x1e64('0x22')](function(_0x490408){_0xdf4048[_0x1e64('0x32')]=_0x490408;if(_0xce5931[_0x1e64('0x46')][_0x1e64('0x56')]){_0x31b120[_0x1e64('0x57')]=[{'all':!![]}];}return db[_0x1e64('0x58')][_0x1e64('0x59')](_0x31b120);})[_0x1e64('0x22')](function(_0x5a4c57){_0xdf4048['rows']=_0x5a4c57;return _0xdf4048;})[_0x1e64('0x22')](respondWithFilteredResult(_0x23f08d,_0x31b120))[_0x1e64('0x5a')](handleError(_0x23f08d,null));};exports[_0x1e64('0x5b')]=function(_0xc6265f,_0x9b4587){var _0xf8467d={'raw':![],'where':{'id':_0xc6265f['params']['id']},'include':[{'model':db[_0x1e64('0x3f')],'as':'mandatoryDispositionPause'}]},_0x29ff02={};_0x29ff02[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x58')][_0x1e64('0x42')]);_0x29ff02[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0xc6265f[_0x1e64('0x46')]);_0x29ff02['filters']=_[_0x1e64('0x49')](_0x29ff02[_0x1e64('0x4a')],_0x29ff02['query']);_0xf8467d[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x29ff02[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0xc6265f['query'][_0x1e64('0x4b')]));_0xf8467d[_0x1e64('0x4c')]=_0xf8467d[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0xf8467d[_0x1e64('0x4c')]:_0x29ff02['model'];if(_0xc6265f[_0x1e64('0x46')][_0x1e64('0x56')]){_0xf8467d[_0x1e64('0x57')]=[{'all':!![]}];}_0xf8467d=_[_0x1e64('0x54')]({},_0xf8467d,_0xc6265f[_0x1e64('0x5c')]);return db[_0x1e64('0x58')]['find'](_0xf8467d)[_0x1e64('0x22')](handleEntityNotFound(_0x9b4587,null))[_0x1e64('0x22')](respondWithResult(_0x9b4587,null))[_0x1e64('0x5a')](handleError(_0x9b4587,null));};exports[_0x1e64('0x5d')]=function(_0x14fe1f,_0x56890a){return db[_0x1e64('0x58')][_0x1e64('0x5d')](_0x14fe1f['body'],{})[_0x1e64('0x22')](function(_0x250d38){var _0x9c92c8=_0x14fe1f[_0x1e64('0x5e')]['get']({'plain':!![]});if(!_0x9c92c8)throw new Error(_0x1e64('0x5f'));if(_0x9c92c8[_0x1e64('0x60')]===_0x1e64('0x5e')){var _0x3fc7e8=_0x250d38[_0x1e64('0x61')]({'plain':!![]});var _0xe17284=_0x1e64('0x39');return db[_0x1e64('0x62')][_0x1e64('0x63')]({'where':{'name':_0xe17284,'userProfileId':_0x9c92c8[_0x1e64('0x64')]},'raw':!![]})[_0x1e64('0x22')](function(_0x4d4ecc){if(_0x4d4ecc&&_0x4d4ecc[_0x1e64('0x65')]===0x0){return db[_0x1e64('0x66')]['create']({'name':_0x3fc7e8[_0x1e64('0x3c')],'resourceId':_0x3fc7e8['id'],'type':_0x4d4ecc['name'],'sectionId':_0x4d4ecc['id']},{})[_0x1e64('0x22')](function(){return _0x250d38;});}else{return _0x250d38;}})[_0x1e64('0x5a')](function(_0x41d24e){logger[_0x1e64('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41d24e);throw _0x41d24e;});}return _0x250d38;})[_0x1e64('0x22')](respondWithResult(_0x56890a,0xc9))[_0x1e64('0x5a')](handleError(_0x56890a,null));};exports[_0x1e64('0x37')]=function(_0x1b9837,_0x5f9425){if(_0x1b9837[_0x1e64('0x67')]['id']){delete _0x1b9837['body']['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1b9837['params']['id']},'include':[{'model':db[_0x1e64('0x3f')],'as':_0x1e64('0x40')}]})['then'](handleEntityNotFound(_0x5f9425,null))['then'](saveUpdates(_0x1b9837[_0x1e64('0x67')],null))['then'](respondWithResult(_0x5f9425,null))[_0x1e64('0x5a')](handleError(_0x5f9425,null));};exports[_0x1e64('0x38')]=function(_0x57295d,_0x31273e){return db['OpenchannelAccount'][_0x1e64('0x63')]({'where':{'id':_0x57295d[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x31273e,null))[_0x1e64('0x22')](removeEntity(_0x31273e,null))['catch'](handleError(_0x31273e,null));};exports[_0x1e64('0x69')]=function(_0x218e32,_0x5bca91){return db[_0x1e64('0x58')][_0x1e64('0x69')]()['then'](respondWithResult(_0x5bca91,null))[_0x1e64('0x5a')](handleError(_0x5bca91,null));};exports['addDisposition']=function(_0x50e76e,_0x51914c,_0x499228){if(_0x50e76e['body']['id']){delete _0x50e76e[_0x1e64('0x67')]['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x50e76e[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x51914c,null))['then'](function(_0x1b3b65){if(_0x1b3b65){_0x50e76e[_0x1e64('0x67')][_0x1e64('0x6a')]=_0x1b3b65['id'];return db[_0x1e64('0x6b')][_0x1e64('0x5d')](_0x50e76e['body']);}})[_0x1e64('0x22')](respondWithResult(_0x51914c,null))[_0x1e64('0x5a')](handleError(_0x51914c,null));};exports[_0x1e64('0x6c')]=function(_0x113648,_0x3d2171,_0x4c3b1d){var _0x1ffc65={'raw':![],'where':{}};var _0x2f0848={};var _0x3e464c={'count':0x0,'rows':[]};return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x113648[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x3d2171,null))[_0x1e64('0x22')](function(_0x121a56){if(_0x121a56){_0x2f0848['model']=_[_0x1e64('0x47')](db[_0x1e64('0x6b')][_0x1e64('0x42')]);_0x2f0848[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x113648[_0x1e64('0x46')]);_0x2f0848[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x2f0848[_0x1e64('0x4a')],_0x2f0848[_0x1e64('0x46')]);_0x1ffc65[_0x1e64('0x4c')]=_['intersection'](_0x2f0848['model'],qs[_0x1e64('0x4b')](_0x113648[_0x1e64('0x46')]['fields']));_0x1ffc65['attributes']=_0x1ffc65[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x1ffc65[_0x1e64('0x4c')]:_0x2f0848['model'];if(!_0x113648['query'][_0x1e64('0x4e')]('nolimit')){_0x1ffc65[_0x1e64('0x31')]=qs[_0x1e64('0x31')](_0x113648['query'][_0x1e64('0x31')]);_0x1ffc65[_0x1e64('0x2f')]=qs['offset'](_0x113648['query'][_0x1e64('0x2f')]);}_0x1ffc65[_0x1e64('0x4f')]=qs['sort'](_0x113648['query'][_0x1e64('0x50')]);_0x1ffc65['where']=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x113648[_0x1e64('0x46')],_0x2f0848[_0x1e64('0x48')]));_0x1ffc65[_0x1e64('0x51')][_0x1e64('0x6a')]=_0x121a56['id'];if(_0x113648[_0x1e64('0x46')][_0x1e64('0x53')]){_0x1ffc65[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x1ffc65[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x1ffc65[_0x1e64('0x4c')],function(_0x76db66){var _0x449513={};_0x449513[_0x76db66]={'$like':'%'+_0x113648[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x449513;})});}_0x1ffc65=_[_0x1e64('0x54')]({},_0x1ffc65,_0x113648['options']);return db['Disposition'][_0x1e64('0x32')]({'where':_0x1ffc65['where']})[_0x1e64('0x22')](function(_0xd53a44){_0x3e464c[_0x1e64('0x32')]=_0xd53a44;if(_0x113648[_0x1e64('0x46')]['includeAll']){_0x1ffc65['include']=[{'all':!![]}];}return db[_0x1e64('0x6b')][_0x1e64('0x59')](_0x1ffc65);})[_0x1e64('0x22')](function(_0x245bf4){_0x3e464c[_0x1e64('0x6e')]=_0x245bf4;return _0x3e464c;});}})[_0x1e64('0x22')](respondWithFilteredResult(_0x3d2171,_0x1ffc65))[_0x1e64('0x5a')](handleError(_0x3d2171,null));};exports['removeDispositions']=function(_0x29800b,_0x1bd4ad,_0x1d0d71){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x29800b['params']['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x1bd4ad,null))[_0x1e64('0x22')](function(_0x26f396){if(_0x26f396){return _0x26f396[_0x1e64('0x6f')](_0x29800b[_0x1e64('0x46')][_0x1e64('0x70')]);}})[_0x1e64('0x22')](respondWithStatusCode(_0x1bd4ad,null))[_0x1e64('0x5a')](handleError(_0x1bd4ad,null));};exports[_0x1e64('0x71')]=function(_0x436f1,_0x4aad56,_0x434a92){if(_0x436f1['body']['id']){delete _0x436f1[_0x1e64('0x67')]['id'];}return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x436f1[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x4aad56,null))[_0x1e64('0x22')](function(_0x831a77){if(_0x831a77){_0x436f1[_0x1e64('0x67')][_0x1e64('0x6a')]=_0x831a77['id'];return db['CannedAnswer']['create'](_0x436f1[_0x1e64('0x67')]);}})[_0x1e64('0x22')](respondWithResult(_0x4aad56,null))[_0x1e64('0x5a')](handleError(_0x4aad56,null));};exports['getAnswers']=function(_0x424c6f,_0x37c02b,_0x2261d8){var _0x125574={'raw':![],'where':{}};var _0x5ebd3e={};var _0x1e896a={'count':0x0,'rows':[]};return db[_0x1e64('0x58')]['findOne']({'where':{'id':_0x424c6f[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x37c02b,null))[_0x1e64('0x22')](function(_0x20e96d){if(_0x20e96d){_0x5ebd3e[_0x1e64('0x4a')]=_['keys'](db['CannedAnswer'][_0x1e64('0x42')]);_0x5ebd3e[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x424c6f[_0x1e64('0x46')]);_0x5ebd3e[_0x1e64('0x48')]=_['intersection'](_0x5ebd3e['model'],_0x5ebd3e['query']);_0x125574['attributes']=_['intersection'](_0x5ebd3e[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x125574[_0x1e64('0x4c')]=_0x125574[_0x1e64('0x4c')]['length']?_0x125574[_0x1e64('0x4c')]:_0x5ebd3e[_0x1e64('0x4a')];if(!_0x424c6f['query']['hasOwnProperty'](_0x1e64('0x72'))){_0x125574[_0x1e64('0x31')]=qs['limit'](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x31')]);_0x125574[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x125574[_0x1e64('0x4f')]=qs['sort'](_0x424c6f[_0x1e64('0x46')][_0x1e64('0x50')]);_0x125574['where']=qs['filters'](_[_0x1e64('0x52')](_0x424c6f[_0x1e64('0x46')],_0x5ebd3e[_0x1e64('0x48')]));_0x125574['where'][_0x1e64('0x6a')]=_0x20e96d['id'];if(_0x424c6f[_0x1e64('0x46')][_0x1e64('0x53')]){_0x125574['where']=_['merge'](_0x125574[_0x1e64('0x51')],{'$or':_['map'](_0x125574[_0x1e64('0x4c')],function(_0x5c856b){var _0x12647f={};_0x12647f[_0x5c856b]={'$like':'%'+_0x424c6f[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x12647f;})});}_0x125574=_[_0x1e64('0x54')]({},_0x125574,_0x424c6f[_0x1e64('0x5c')]);return db[_0x1e64('0x73')][_0x1e64('0x32')]({'where':_0x125574[_0x1e64('0x51')]})[_0x1e64('0x22')](function(_0x244e6c){_0x1e896a[_0x1e64('0x32')]=_0x244e6c;if(_0x424c6f[_0x1e64('0x46')][_0x1e64('0x56')]){_0x125574[_0x1e64('0x57')]=[{'all':!![]}];}return db[_0x1e64('0x73')][_0x1e64('0x59')](_0x125574);})['then'](function(_0x3fa90d){_0x1e896a[_0x1e64('0x6e')]=_0x3fa90d;return _0x1e896a;});}})['then'](respondWithFilteredResult(_0x37c02b,_0x125574))[_0x1e64('0x5a')](handleError(_0x37c02b,null));};exports[_0x1e64('0x74')]=function(_0x68c95,_0xe27cb,_0x374f31){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x68c95[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0xe27cb,null))[_0x1e64('0x22')](function(_0x41412b){if(_0x41412b){return _0x41412b['removeAnswers'](_0x68c95['query'][_0x1e64('0x70')]);}})['then'](respondWithStatusCode(_0xe27cb,null))[_0x1e64('0x5a')](handleError(_0xe27cb,null));};exports['notify']=function(_0x2b90bf,_0x40508d,_0x513147){var _0x287e91={'body':_0x2b90bf[_0x1e64('0x67')],'channel':_0x1e64('0x75')};var _0x31374f=[];var _0x58077f=[];var _0x5b8df5={};var _0xac3ec5=![];return db['CmContact']['describe']()[_0x1e64('0x22')](function(_0x32a83c){if(!_0x32a83c){throw new db[(_0x1e64('0x76'))][(_0x1e64('0x77'))](_0x1e64('0x78'));}_0x31374f=_[_0x1e64('0x79')](_[_0x1e64('0x47')](_0x32a83c),[_0x1e64('0x7a'),_0x1e64('0x7b')]);_0x58077f=_['difference'](_['keys'](_0x32a83c),['createdAt',_0x1e64('0x7b'),_0x1e64('0x7c'),'ListId']);if(_0x2b90bf[_0x1e64('0x67')]['id']){delete _0x2b90bf[_0x1e64('0x67')]['id'];}if(_[_0x1e64('0x7d')](_0x2b90bf[_0x1e64('0x67')]['from'])){throw new db['Sequelize'][(_0x1e64('0x77'))](_0x1e64('0x7e'));}if(_['isNil'](_0x2b90bf['body']['body'])||_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x67')]===''){throw new db[(_0x1e64('0x76'))][(_0x1e64('0x77'))](_0x1e64('0x7f'));}if(_[_0x1e64('0x7d')](_0x2b90bf[_0x1e64('0x67')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x1e64('0x80')+_0x58077f);}if(!_[_0x1e64('0x81')](_0x58077f,_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x82')])){throw new db[(_0x1e64('0x76'))]['ValidationError'](_0x1e64('0x83')+_0x58077f);}_0x5b8df5[_0x2b90bf['body'][_0x1e64('0x82')]]=_0x2b90bf[_0x1e64('0x67')]['from'];})[_0x1e64('0x22')](function(){return db['OpenchannelAccount'][_0x1e64('0x63')]({'where':{'id':_0x2b90bf[_0x1e64('0x68')]['id']},'include':[{'model':db[_0x1e64('0x84')],'as':_0x1e64('0x85'),'include':[{'model':db[_0x1e64('0x86')],'as':'Contacts','where':_0x5b8df5,'limit':0x1,'order':[['updatedAt',_0x1e64('0x87')]]}]},{'model':db[_0x1e64('0x88')],'as':_0x1e64('0x89')}]});})[_0x1e64('0x22')](handleEntityNotFound(_0x40508d,null))[_0x1e64('0x22')](function(_0x8b8044){if(_0x8b8044&&_0x8b8044[_0x1e64('0x85')]){_0x287e91[_0x1e64('0x8a')]=_0x8b8044;_0x287e91[_0x1e64('0x8b')]=_0x8b8044['Applications'];_0x287e91[_0x1e64('0x8c')]=_0x8b8044[_0x1e64('0x85')];_0x287e91['applications']=_['orderBy'](_0x287e91['applications'],[_0x1e64('0x8d')],['asc']);if(_0x287e91[_0x1e64('0x8a')][_0x1e64('0x89')]){delete _0x287e91[_0x1e64('0x8a')][_0x1e64('0x89')];}if(_0x287e91['account']['List']&&_0x287e91[_0x1e64('0x8a')][_0x1e64('0x85')]['Contacts'][_0x1e64('0x4d')]){return _0x287e91[_0x1e64('0x8a')][_0x1e64('0x85')][_0x1e64('0x8e')][0x0];}var _0x422aac=_['defaults'](_0x2b90bf['body'],{'firstName':_0x2b90bf['body'][_0x1e64('0x8f')],'ListId':_0x8b8044[_0x1e64('0x90')]});_0x422aac[_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x82')]]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x8f')];return db[_0x1e64('0x86')]['create'](_0x422aac,{'fields':_0x31374f,'raw':!![]});}})[_0x1e64('0x22')](handleEntityNotFound(_0x40508d,null))['then'](function(_0x5aac3f){_0x287e91[_0x1e64('0x91')]=_0x5aac3f;if(_0x5aac3f){var _0x51705d={'ContactId':_0x5aac3f['id'],'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'from':(_0x5aac3f[_0x1e64('0x92')]||'')+'\x20'+(_0x5aac3f[_0x1e64('0x93')]||'')};var _0x1f21d5={'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'closed':![]};if(_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')]){_0x1f21d5[_0x1e64('0x94')]=_0x2b90bf['body'][_0x1e64('0x94')];return db['OpenchannelInteraction'][_0x1e64('0x63')]({'where':_0x1f21d5})['then'](function(_0x534c79){if(_0x534c79){return[_0x534c79,![]];}_0x51705d[_0x1e64('0x94')]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')];_0x51705d[_0x1e64('0x95')]=_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x95')];return db[_0x1e64('0x96')][_0x1e64('0x5d')](_0x51705d)[_0x1e64('0x22')](function(_0x1b8a99){return[_0x1b8a99,!![]];});});}else{_0x1f21d5[_0x1e64('0x94')]=null;}_0x1f21d5['ContactId']=_0x5aac3f['id'];return db[_0x1e64('0x96')][_0x1e64('0x63')]({'where':_0x1f21d5})[_0x1e64('0x22')](function(_0x10f43c){if(_0x10f43c){return[_0x10f43c,![]];}return db[_0x1e64('0x96')][_0x1e64('0x5d')](_0x51705d)['then'](function(_0x566403){return[_0x566403,!![]];});});}})[_0x1e64('0x97')](function(_0x459929,_0x14975b){if(_0x459929){_0xac3ec5=_0x14975b;if(!_0x14975b){var _0x3158a7={'from':(_0x287e91[_0x1e64('0x91')]['firstName']||'')+'\x20'+(_0x287e91[_0x1e64('0x91')][_0x1e64('0x93')]||'')};if(_0x2b90bf[_0x1e64('0x67')][_0x1e64('0x94')]&&_0x2b90bf['body'][_0x1e64('0x98')]&&_0x2b90bf['body'][_0x1e64('0x94')]!=_0x2b90bf[_0x1e64('0x67')]['messageId']){_0x3158a7[_0x1e64('0x94')]=_0x2b90bf[_0x1e64('0x67')]['messageId'];}return _0x459929[_0x1e64('0x37')](_0x3158a7);}else{return _0x459929;}}})[_0x1e64('0x22')](function(_0x4ef668){_0x287e91[_0x1e64('0x99')]=_0x4ef668['get']({'plain':!![]});_0x287e91[_0x1e64('0x99')][_0x1e64('0x9a')]=_0xac3ec5;if(_0x287e91[_0x1e64('0x99')]['created']){if(_0x287e91[_0x1e64('0x8a')][_0x1e64('0x9b')]){_0x287e91[_0x1e64('0x8b')][_0x1e64('0x9c')]({'id':0x0,'priority':_0x287e91[_0x1e64('0x8b')][_0x1e64('0x4d')]+0x1,'app':_0x1e64('0x9d'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x1e64('0x5d')]({'body':_0x2b90bf['body'][_0x1e64('0x67')],'OpenchannelAccountId':_0x2b90bf[_0x1e64('0x68')]['id'],'OpenchannelInteractionId':_0x4ef668['id'],'direction':'in','ContactId':_0x287e91[_0x1e64('0x91')]['id'],'AttachmentId':_0x2b90bf[_0x1e64('0x67')]['AttachmentId']});})[_0x1e64('0x22')](function(_0x287ac9){_0x287e91['message']=_0x287ac9;if(!_0x287e91['interaction'][_0x1e64('0x9e')])return;return db[_0x1e64('0x9f')][_0x1e64('0x63')]({'attributes':['id',_0x1e64('0x3c')],'where':{'id':_0x287e91[_0x1e64('0x99')][_0x1e64('0x9e')]}});})[_0x1e64('0x22')](function(_0x3a5837){if(_0x3a5837){_0x287e91[_0x1e64('0x8b')][_0x1e64('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a5837[_0x1e64('0x3c')]+','+(_0x287e91['account'][_0x1e64('0xa1')]||0xa),'interval':_0x1e64('0xa2')});}if(!_0x287e91[_0x1e64('0x99')][_0x1e64('0xa3')])return;return db[_0x1e64('0xa4')][_0x1e64('0x63')]({'attributes':['id',_0x1e64('0x3c')],'where':{'id':_0x287e91[_0x1e64('0x99')][_0x1e64('0xa3')]}});})[_0x1e64('0x22')](function(_0x449d26){if(_0x449d26){_0x287e91[_0x1e64('0x8b')][_0x1e64('0xa0')]({'id':0x0,'priority':0x1,'app':_0x1e64('0xa5'),'appdata':_0x449d26[_0x1e64('0x3c')]+','+(_0x287e91[_0x1e64('0x8a')][_0x1e64('0xa6')]||0x12c),'interval':_0x1e64('0xa2')});}return respondWithRpcPromise(_0x1e64('0xa7'),_0x1e64('0xa8'),_0x287e91);})['then'](function(_0x4be348){respondWithRpcPromise('EventManager',_0x1e64('0xa9'),{'event':_0x1e64('0xaa'),'message':_0x4be348},client9002);return _0x4be348;})[_0x1e64('0x22')](respondWithResult(_0x40508d,null))['catch'](handleError(_0x40508d,null));};exports[_0x1e64('0xab')]=function(_0x4f8785,_0x48377d){var _0x571f65=_0x4f8785[_0x1e64('0x68')]['id'];var _0x10f313=_0x4f8785[_0x1e64('0x67')];var _0x1e5114=0xc8;var _0x2a22da=null;return db[_0x1e64('0xac')][_0x1e64('0xad')]({'isolationLevel':db[_0x1e64('0xac')][_0x1e64('0xae')][_0x1e64('0xaf')][_0x1e64('0xb0')]},function(_0x54d9c3){return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x571f65},'transaction':_0x54d9c3})[_0x1e64('0x22')](function(_0x67b7b3){if(_0x67b7b3){return db[_0x1e64('0x88')]['destroy']({'where':{'OpenchannelAccountId':_0x571f65},'transaction':_0x54d9c3})['then'](function(){var _0x85800=_[_0x1e64('0x41')](_0x10f313,function(_0x4453d3){_0x4453d3['OpenchannelAccountId']=_0x571f65;return _0x4453d3;});return db[_0x1e64('0x88')]['bulkCreate'](_0x85800,{'transaction':_0x54d9c3});});}else{_0x1e5114=0x194;_0x2a22da=[];}});})['then'](function(){if(_0x1e5114!==0x194){return db[_0x1e64('0x88')][_0x1e64('0xb1')]({'where':{'OpenchannelAccountId':_0x571f65},'order':_0x1e64('0x8d')})[_0x1e64('0x22')](function(_0x232169){_0x2a22da=_0x232169;});}})[_0x1e64('0x5a')](function(_0x293505){_0x1e5114=0x1f4;logger[_0x1e64('0x28')](_0x293505[_0x1e64('0x3b')]);if(_0x293505['name']){delete _0x293505[_0x1e64('0x3c')];}_0x2a22da=_0x293505;})[_0x1e64('0xb2')](function(){if(_0x2a22da===null){_0x48377d[_0x1e64('0x3a')](_0x1e5114);}else{if(_0x1e5114===0x1f4){_0x48377d['status'](_0x1e5114)['send'](_0x2a22da);}else{_0x48377d[_0x1e64('0x2c')](_0x1e5114)[_0x1e64('0x2e')](_0x2a22da);}}});};exports[_0x1e64('0xb3')]=function(_0x43e063,_0x355999,_0x462349){var _0x561a52={};var _0x25bae8={};var _0x3024ad;var _0x2fb06a;return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x43e063[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x355999,null))[_0x1e64('0x22')](function(_0x2c0304){if(_0x2c0304){_0x3024ad=_0x2c0304;_0x25bae8[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x88')][_0x1e64('0x42')]);_0x25bae8[_0x1e64('0x46')]=_['keys'](_0x43e063[_0x1e64('0x46')]);_0x25bae8[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x25bae8[_0x1e64('0x4a')],_0x25bae8[_0x1e64('0x46')]);_0x561a52[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x25bae8['model'],qs[_0x1e64('0x4b')](_0x43e063[_0x1e64('0x46')]['fields']));_0x561a52[_0x1e64('0x4c')]=_0x561a52[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x561a52[_0x1e64('0x4c')]:_0x25bae8[_0x1e64('0x4a')];_0x561a52['order']=qs[_0x1e64('0x50')](_0x43e063[_0x1e64('0x46')][_0x1e64('0x50')]);_0x561a52[_0x1e64('0x51')]=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x43e063['query'],_0x25bae8['filters']));if(_0x43e063['query'][_0x1e64('0x53')]){_0x561a52[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x561a52[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x561a52[_0x1e64('0x4c')],function(_0x4a1a5c){var _0x1cf93f={};_0x1cf93f[_0x4a1a5c]={'$like':'%'+_0x43e063[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0x1cf93f;})});}_0x561a52=_['merge']({},_0x561a52,_0x43e063['options']);return _0x3024ad[_0x1e64('0xb3')](_0x561a52);}})[_0x1e64('0x22')](function(_0x3eb690){if(_0x3eb690){_0x2fb06a=_0x3eb690[_0x1e64('0x4d')];if(!_0x43e063[_0x1e64('0x46')][_0x1e64('0x4e')]('nolimit')){_0x561a52[_0x1e64('0x31')]=qs[_0x1e64('0x31')](_0x43e063['query'][_0x1e64('0x31')]);_0x561a52['offset']=qs[_0x1e64('0x2f')](_0x43e063[_0x1e64('0x46')][_0x1e64('0x2f')]);}return _0x3024ad['getApplications'](_0x561a52);}})[_0x1e64('0x22')](function(_0x270121){if(_0x270121){return _0x270121?{'count':_0x2fb06a,'rows':_0x270121}:null;}})[_0x1e64('0x22')](respondWithResult(_0x355999,null))[_0x1e64('0x5a')](handleError(_0x355999,null));};exports['getInteractions']=function(_0x4b593d,_0x14a6d2,_0x2df19d){var _0x5a5b61={'raw':![],'where':{}};var _0x7295ee={};var _0x1f4d1e={'count':0x0,'rows':[]};return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x4b593d['params']['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x14a6d2,null))['then'](function(_0x29e2fa){if(_0x29e2fa){_0x7295ee[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db[_0x1e64('0x96')][_0x1e64('0x42')]);_0x7295ee[_0x1e64('0x46')]=_['keys'](_0x4b593d[_0x1e64('0x46')]);_0x7295ee[_0x1e64('0x48')]=_[_0x1e64('0x49')](_0x7295ee['model'],_0x7295ee[_0x1e64('0x46')]);_0x5a5b61[_0x1e64('0x4c')]=_[_0x1e64('0x49')](_0x7295ee[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x4b593d[_0x1e64('0x46')][_0x1e64('0x4b')]));_0x5a5b61[_0x1e64('0x4c')]=_0x5a5b61[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x5a5b61[_0x1e64('0x4c')]:_0x7295ee[_0x1e64('0x4a')];if(!_0x4b593d[_0x1e64('0x46')]['hasOwnProperty'](_0x1e64('0x72'))){_0x5a5b61[_0x1e64('0x31')]=qs['limit'](_0x4b593d['query'][_0x1e64('0x31')]);_0x5a5b61[_0x1e64('0x2f')]=qs[_0x1e64('0x2f')](_0x4b593d[_0x1e64('0x46')][_0x1e64('0x2f')]);}_0x5a5b61[_0x1e64('0x4f')]=qs[_0x1e64('0x50')](_0x4b593d[_0x1e64('0x46')]['sort']);_0x5a5b61[_0x1e64('0x51')]=qs[_0x1e64('0x48')](_[_0x1e64('0x52')](_0x4b593d[_0x1e64('0x46')],_0x7295ee['filters']));_0x5a5b61['where'][_0x1e64('0x6a')]=_0x29e2fa['id'];if(_0x4b593d['query'][_0x1e64('0x53')]){_0x5a5b61[_0x1e64('0x51')]=_[_0x1e64('0x54')](_0x5a5b61[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x5a5b61[_0x1e64('0x4c')],function(_0x391513){var _0x403738={};_0x403738[_0x391513]={'$like':'%'+_0x4b593d['query'][_0x1e64('0x53')]+'%'};return _0x403738;})});}_0x5a5b61=_[_0x1e64('0x54')]({},_0x5a5b61,_0x4b593d['options']);return db[_0x1e64('0x96')][_0x1e64('0x32')]({'where':_0x5a5b61[_0x1e64('0x51')]})[_0x1e64('0x22')](function(_0x187db7){_0x1f4d1e['count']=_0x187db7;if(_0x4b593d[_0x1e64('0x46')][_0x1e64('0x56')]){_0x5a5b61[_0x1e64('0x57')]=[{'model':db[_0x1e64('0x86')],'as':'Contact','required':![]},{'model':db[_0x1e64('0x9f')],'as':_0x1e64('0xb4'),'attributes':[_0x1e64('0x3c'),_0x1e64('0xb5'),_0x1e64('0xb6')],'required':![]},{'model':db['Tag'],'as':_0x1e64('0xb7'),'attributes':['id',_0x1e64('0x3c'),_0x1e64('0xb8')],'where':_0x4b593d[_0x1e64('0x46')][_0x1e64('0xb9')]?{'id':_0x4b593d[_0x1e64('0x46')]['tag']}:undefined,'required':_0x4b593d[_0x1e64('0x46')][_0x1e64('0xb9')]?!![]:![]}];}return db[_0x1e64('0x96')][_0x1e64('0x59')](_0x5a5b61);})['then'](function(_0x2acc85){_0x1f4d1e[_0x1e64('0x6e')]=_0x2acc85;return _0x1f4d1e;});}})[_0x1e64('0x22')](respondWithFilteredResult(_0x14a6d2,_0x5a5b61))[_0x1e64('0x5a')](handleError(_0x14a6d2,null));};exports[_0x1e64('0xba')]=function(_0x1fee26,_0x30dcec,_0x339aad){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1fee26[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x30dcec,null))[_0x1e64('0x22')](function(_0x1e77e2){if(_0x1e77e2){return _0x1e77e2[_0x1e64('0xba')](_0x1fee26['body']['ids'],_[_0x1e64('0xbb')](_0x1fee26[_0x1e64('0x67')],['ids','id'])||{})[_0x1e64('0x97')](function(_0x3da4fb){for(var _0x284b94=0x0;_0x284b94<_0x1fee26[_0x1e64('0x67')][_0x1e64('0x70')][_0x1e64('0x4d')];_0x284b94+=0x1){socket[_0x1e64('0xbc')]('userOpenchannelAccount:save',{'UserId':Number(_0x1fee26[_0x1e64('0x67')][_0x1e64('0x70')][_0x284b94]),'OpenchannelAccountId':Number(_0x1fee26[_0x1e64('0x68')]['id'])});}return _0x3da4fb;});}})[_0x1e64('0x22')](respondWithResult(_0x30dcec,null))['catch'](handleError(_0x30dcec,null));};exports['removeAgents']=function(_0x2b7497,_0x288a71,_0x1ce2db){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x2b7497[_0x1e64('0x68')]['id']}})[_0x1e64('0x22')](handleEntityNotFound(_0x288a71,null))['then'](function(_0x1eb4ce){if(_0x1eb4ce){return _0x1eb4ce[_0x1e64('0xbd')](_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')])[_0x1e64('0x22')](function(){if(_[_0x1e64('0xbe')](_0x2b7497['query'][_0x1e64('0x70')])){for(var _0x49ed90=0x0;_0x49ed90<_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')][_0x1e64('0x4d')];_0x49ed90+=0x1){socket[_0x1e64('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')][_0x49ed90]),'OpenchannelAccountId':Number(_0x2b7497[_0x1e64('0x68')]['id'])});}}else{socket['emit'](_0x1e64('0xbf'),{'UserId':Number(_0x2b7497[_0x1e64('0x46')][_0x1e64('0x70')]),'OpenchannelAccountId':Number(_0x2b7497[_0x1e64('0x68')]['id'])});}});}})[_0x1e64('0x22')](respondWithStatusCode(_0x288a71,null))[_0x1e64('0x5a')](handleError(_0x288a71,null));};exports[_0x1e64('0xc0')]=function(_0x36e341,_0x136fc8,_0x46cc9e){var _0x42a45d={};var _0x4314d0={};var _0x38817b;var _0x2382dc;return db[_0x1e64('0x58')]['findOne']({'where':{'id':_0x36e341[_0x1e64('0x68')]['id']}})['then'](handleEntityNotFound(_0x136fc8,null))['then'](function(_0x32aad4){if(_0x32aad4){_0x38817b=_0x32aad4;_0x4314d0[_0x1e64('0x4a')]=_[_0x1e64('0x47')](db['User']['rawAttributes']);_0x4314d0[_0x1e64('0x46')]=_[_0x1e64('0x47')](_0x36e341[_0x1e64('0x46')]);_0x4314d0[_0x1e64('0x48')]=_['intersection'](_0x4314d0['model'],_0x4314d0[_0x1e64('0x46')]);_0x42a45d['attributes']=_['intersection'](_0x4314d0[_0x1e64('0x4a')],qs[_0x1e64('0x4b')](_0x36e341[_0x1e64('0x46')]['fields']));_0x42a45d['attributes']=_0x42a45d[_0x1e64('0x4c')][_0x1e64('0x4d')]?_0x42a45d['attributes']:_0x4314d0[_0x1e64('0x4a')];_0x42a45d['order']=qs[_0x1e64('0x50')](_0x36e341[_0x1e64('0x46')][_0x1e64('0x50')]);_0x42a45d['where']=qs['filters'](_[_0x1e64('0x52')](_0x36e341['query'],_0x4314d0[_0x1e64('0x48')]));if(_0x36e341[_0x1e64('0x46')][_0x1e64('0x53')]){_0x42a45d['where']=_['merge'](_0x42a45d[_0x1e64('0x51')],{'$or':_[_0x1e64('0x41')](_0x42a45d['attributes'],function(_0x181ca0){var _0xde492e={};_0xde492e[_0x181ca0]={'$like':'%'+_0x36e341[_0x1e64('0x46')][_0x1e64('0x53')]+'%'};return _0xde492e;})});}_0x42a45d=_[_0x1e64('0x54')]({},_0x42a45d,_0x36e341[_0x1e64('0x5c')]);return _0x38817b[_0x1e64('0xc0')](_0x42a45d);}})[_0x1e64('0x22')](function(_0x30461a){if(_0x30461a){_0x2382dc=_0x30461a[_0x1e64('0x4d')];if(!_0x36e341['query'][_0x1e64('0x4e')](_0x1e64('0x72'))){_0x42a45d[_0x1e64('0x31')]=qs['limit'](_0x36e341[_0x1e64('0x46')]['limit']);_0x42a45d['offset']=qs[_0x1e64('0x2f')](_0x36e341[_0x1e64('0x46')][_0x1e64('0x2f')]);}return _0x38817b[_0x1e64('0xc0')](_0x42a45d);}})['then'](function(_0xd2fc0){if(_0xd2fc0){return _0xd2fc0?{'count':_0x2382dc,'rows':_0xd2fc0}:null;}})[_0x1e64('0x22')](respondWithResult(_0x136fc8,null))[_0x1e64('0x5a')](handleError(_0x136fc8,null));};exports['send']=function(_0x148608,_0xbb07e3,_0x8e1ff5){var _0x76e36f,_0x17a1c8,_0x3e5560;if(_[_0x1e64('0x7d')](_0x148608[_0x1e64('0x67')][_0x1e64('0x67')])||_0x148608['body'][_0x1e64('0x67')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e64('0x7d')](_0x148608['body']['to'])){}_0x76e36f=_0x148608[_0x1e64('0x67')]['to'];return db[_0x1e64('0x58')][_0x1e64('0x6d')]({'where':{'id':_0x148608['params']['id']}})['then'](handleEntityNotFound(_0xbb07e3,null))[_0x1e64('0x22')](function(_0x1ab468){if(_0x1ab468){return db[_0x1e64('0x58')][_0x1e64('0x63')]({'where':{'id':_0x1ab468['id']},'include':[{'model':db[_0x1e64('0x84')],'as':_0x1e64('0x85'),'include':[{'model':db[_0x1e64('0x86')],'as':_0x1e64('0x8e'),'where':{[_0x1ab468[_0x1e64('0x82')]]:_0x76e36f},'limit':0x1,'order':[['updatedAt',_0x1e64('0x87')]]}]}]})[_0x1e64('0x22')](handleEntityNotFound(_0xbb07e3,null))['then'](function(_0x5dcf98){if(_0x5dcf98&&_0x5dcf98['List']){_0x17a1c8=_0x5dcf98[_0x1e64('0x61')]({'plain':!![]});if(_0x17a1c8[_0x1e64('0x85')]&&_0x17a1c8[_0x1e64('0x85')][_0x1e64('0x8e')][_0x1e64('0x4d')]){return _0x17a1c8[_0x1e64('0x85')]['Contacts'][0x0];}return db[_0x1e64('0x86')][_0x1e64('0x5d')](_[_0x1e64('0x1a')](_0x148608[_0x1e64('0x67')],{'firstName':_0x76e36f,[_0x5dcf98['mapKey']]:_0x76e36f,'phone':_0x76e36f,'ListId':_0x17a1c8[_0x1e64('0x90')]}));}})['then'](handleEntityNotFound(_0xbb07e3,null))[_0x1e64('0x22')](function(_0x19c7a9){if(_0x19c7a9){_0x3e5560=_0x19c7a9;return db[_0x1e64('0x96')][_0x1e64('0x63')]({'where':{'ContactId':_0x3e5560['id'],'closed':![],'OpenchannelAccountId':_0x17a1c8['id']}})[_0x1e64('0x22')](function(_0x60db95){if(_0x60db95){return[_0x60db95,![]];}return db[_0x1e64('0x96')][_0x1e64('0x5d')]({'UserId':_0x148608['user']['id'],'ContactId':_0x3e5560['id'],'OpenchannelAccountId':_0x17a1c8['id'],'lastMsgDirection':_0x1e64('0xc1'),'firstMsgDirection':_0x1e64('0xc1'),'Messages':[_[_0x1e64('0x54')](_0x148608[_0x1e64('0x67')],{'read':![],'body':_0x148608[_0x1e64('0x67')][_0x1e64('0x67')],'OpenchannelAccountId':_0x17a1c8['id'],'UserId':_0x148608[_0x1e64('0x5e')]['id'],'ContactId':_0x3e5560['id']})]},{'include':[{'model':db[_0x1e64('0xc2')],'as':_0x1e64('0xc3')}]})[_0x1e64('0x22')](function(_0x1fecfc){return[_0x1fecfc,!![]];});});}})['spread'](function(_0x3b42e4,_0x3bd5c6){if(_0x3bd5c6){return _0x3b42e4;}return db[_0x1e64('0xc2')][_0x1e64('0x5d')](_[_0x1e64('0x54')](_0x148608['body'],{'read':![],'body':_0x148608[_0x1e64('0x67')][_0x1e64('0x67')],'OpenchannelAccountId':_0x17a1c8['id'],'OpenchannelInteractionId':_0x3b42e4['id'],'UserId':_0x148608[_0x1e64('0x5e')]['id'],'ContactId':_0x3e5560['id']}))[_0x1e64('0x22')](function(_0xae2cc4){_0x3b42e4[_0x1e64('0xc4')][_0x1e64('0xc3')]=[];_0x3b42e4[_0x1e64('0xc4')]['Messages'][_0x1e64('0x9c')](_0xae2cc4[_0x1e64('0xc4')]);return _0x3b42e4;});});}})[_0x1e64('0x22')](respondWithResult(_0xbb07e3,null))[_0x1e64('0x5a')](handleError(_0xbb07e3,null));}; \ No newline at end of file +var _0xf966=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','keys','create','role','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','params','OpenchannelAccountId','Disposition','length','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','include','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xf966,0x184));var _0x6f96=function(_0x934cfd,_0x1bd2b2){_0x934cfd=_0x934cfd-0x0;var _0xab5bd3=_0xf966[_0x934cfd];return _0xab5bd3;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require(_0x6f96('0x1'));var zipdir=require(_0x6f96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require('mustache');var util=require(_0x6f96('0x6'));var path=require(_0x6f96('0x7'));var sox=require(_0x6f96('0x8'));var csv=require('to-csv');var ejs=require(_0x6f96('0x9'));var fs=require('fs');var fs_extra=require(_0x6f96('0xa'));var _=require(_0x6f96('0xb'));var squel=require(_0x6f96('0xc'));var crypto=require(_0x6f96('0xd'));var jsforce=require(_0x6f96('0xe'));var deskjs=require(_0x6f96('0xf'));var toCsv=require(_0x6f96('0x10'));var querystring=require(_0x6f96('0x11'));var Papa=require(_0x6f96('0x12'));var Redis=require(_0x6f96('0x13'));var authService=require(_0x6f96('0x14'));var qs=require(_0x6f96('0x15'));var as=require(_0x6f96('0x16'));var hardwareService=require(_0x6f96('0x17'));var logger=require('../../config/logger')(_0x6f96('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f96('0x19'));var db=require(_0x6f96('0x1a'))['db'];config['redis']=_[_0x6f96('0x1b')](config[_0x6f96('0x1c')],{'host':_0x6f96('0x1d'),'port':0x18eb});var socket=require(_0x6f96('0x1e'))(new Redis(config[_0x6f96('0x1c')]));require(_0x6f96('0x1f'))[_0x6f96('0x20')](socket);var jayson=require(_0x6f96('0x21'));var client=jayson['client'][_0x6f96('0x22')]({'port':0x232c});var client9002=jayson[_0x6f96('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203054,_0x2cd321,_0x55346c,_0x58c7aa){return new BPromise(function(_0x2cb315,_0x3eb97e){var _0x130de4=_0x58c7aa||client;return _0x130de4['request'](_0x203054,_0x55346c)[_0x6f96('0x24')](function(_0x48c4d5){logger[_0x6f96('0x25')](_0x6f96('0x26'),_0x2cd321,'request\x20sent');logger['debug'](_0x6f96('0x27'),_0x2cd321,_0x6f96('0x28'),JSON['stringify'](_0x48c4d5));if(_0x48c4d5[_0x6f96('0x29')]){if(_0x48c4d5['error'][_0x6f96('0x2a')]===0x1f4){logger[_0x6f96('0x29')](_0x6f96('0x26'),_0x2cd321,_0x48c4d5[_0x6f96('0x29')][_0x6f96('0x2b')]);return _0x3eb97e(_0x48c4d5['error'][_0x6f96('0x2b')]);}logger['error'](_0x6f96('0x26'),_0x2cd321,_0x48c4d5[_0x6f96('0x29')]['message']);return _0x2cb315(_0x48c4d5[_0x6f96('0x29')]['message']);}else{logger[_0x6f96('0x25')](_0x6f96('0x26'),_0x2cd321,_0x6f96('0x28'));_0x2cb315(_0x48c4d5[_0x6f96('0x2c')][_0x6f96('0x2b')]);}})[_0x6f96('0x2d')](function(_0x475ee9){logger[_0x6f96('0x29')](_0x6f96('0x26'),_0x2cd321,_0x475ee9);_0x3eb97e(_0x475ee9);});});}function respondWithStatusCode(_0x4f33e7,_0x3329a2){_0x3329a2=_0x3329a2||0xcc;return function(_0xe3cf23){if(_0xe3cf23){return _0x4f33e7[_0x6f96('0x2e')](_0x3329a2);}return _0x4f33e7[_0x6f96('0x2f')](_0x3329a2)[_0x6f96('0x30')]();};}function respondWithResult(_0x10c8f9,_0x490c5b){_0x490c5b=_0x490c5b||0xc8;return function(_0x4ad5ff){if(_0x4ad5ff){return _0x10c8f9['status'](_0x490c5b)[_0x6f96('0x31')](_0x4ad5ff);}};}function respondWithFilteredResult(_0x105796,_0x37b404){return function(_0x4821a8){if(_0x4821a8){var _0x19941b=typeof _0x37b404[_0x6f96('0x32')]===_0x6f96('0x33')&&typeof _0x37b404[_0x6f96('0x34')]===_0x6f96('0x33');var _0x566cb1=_0x4821a8[_0x6f96('0x35')];var _0xa25290=_0x19941b?0x0:_0x37b404['offset'];var _0xf7e1ff=_0x19941b?_0x4821a8[_0x6f96('0x35')]:_0x37b404[_0x6f96('0x32')]+_0x37b404[_0x6f96('0x34')];var _0x12ce91;if(_0xf7e1ff>=_0x566cb1){_0xf7e1ff=_0x566cb1;_0x12ce91=0xc8;}else{_0x12ce91=0xce;}_0x105796[_0x6f96('0x2f')](_0x12ce91);return _0x105796[_0x6f96('0x36')](_0x6f96('0x37'),_0xa25290+'-'+_0xf7e1ff+'/'+_0x566cb1)['json'](_0x4821a8);}return null;};}function patchUpdates(_0x348f31){return function(_0x1a63ed){try{jsonpatch[_0x6f96('0x38')](_0x1a63ed,_0x348f31,!![]);}catch(_0x58ef0){return BPromise[_0x6f96('0x39')](_0x58ef0);}return _0x1a63ed[_0x6f96('0x3a')]();};}function saveUpdates(_0x4e0248,_0x15d5fe){return function(_0x51c094){if(_0x51c094){return _0x51c094[_0x6f96('0x3b')](_0x4e0248)[_0x6f96('0x24')](function(_0x33028d){return _0x33028d;});}return null;};}function removeEntity(_0x15707b,_0x5b3f1c){return function(_0x21f749){if(_0x21f749){return _0x21f749['destroy']()[_0x6f96('0x24')](function(){var _0xb90cbd=_0x21f749['get']({'plain':!![]});var _0x34b72f='OpenchannelAccounts';return db[_0x6f96('0x3c')][_0x6f96('0x3d')]({'where':{'type':_0x34b72f,'resourceId':_0xb90cbd['id']}})[_0x6f96('0x24')](function(){return _0x21f749;});})[_0x6f96('0x24')](function(){_0x15707b[_0x6f96('0x2f')](0xcc)[_0x6f96('0x30')]();});}};}function handleEntityNotFound(_0x530520,_0x4ee4a1){return function(_0x169bf7){if(!_0x169bf7){_0x530520['sendStatus'](0x194);}return _0x169bf7;};}function handleError(_0x1b63a4,_0x52f869){_0x52f869=_0x52f869||0x1f4;return function(_0x3e0b67){logger[_0x6f96('0x29')](_0x3e0b67[_0x6f96('0x3e')]);if(_0x3e0b67[_0x6f96('0x3f')]){delete _0x3e0b67[_0x6f96('0x3f')];}_0x1b63a4[_0x6f96('0x2f')](_0x52f869)['send'](_0x3e0b67);};}exports[_0x6f96('0x40')]=function(_0x42320d,_0x9be8f5){var _0x20a6de={'include':[{'model':db[_0x6f96('0x41')],'as':_0x6f96('0x42')}]},_0x5dda29={},_0x3b2ad8={'count':0x0,'rows':[]};var _0x2fa5a1=_[_0x6f96('0x43')](db[_0x6f96('0x44')][_0x6f96('0x45')],function(_0x4141e4){return{'name':_0x4141e4[_0x6f96('0x46')],'type':_0x4141e4[_0x6f96('0x47')][_0x6f96('0x48')]};});_0x5dda29[_0x6f96('0x49')]=_[_0x6f96('0x43')](_0x2fa5a1,_0x6f96('0x3f'));_0x5dda29[_0x6f96('0x4a')]=_['keys'](_0x42320d[_0x6f96('0x4a')]);_0x5dda29['filters']=_['intersection'](_0x5dda29[_0x6f96('0x49')],_0x5dda29[_0x6f96('0x4a')]);_0x20a6de[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x5dda29[_0x6f96('0x49')],qs['fields'](_0x42320d[_0x6f96('0x4a')][_0x6f96('0x4d')]));_0x20a6de[_0x6f96('0x4b')]=_0x20a6de[_0x6f96('0x4b')]['length']?_0x20a6de[_0x6f96('0x4b')]:_0x5dda29[_0x6f96('0x49')];if(!_0x42320d[_0x6f96('0x4a')][_0x6f96('0x4e')]('nolimit')){_0x20a6de[_0x6f96('0x34')]=qs[_0x6f96('0x34')](_0x42320d[_0x6f96('0x4a')][_0x6f96('0x34')]);_0x20a6de[_0x6f96('0x32')]=qs[_0x6f96('0x32')](_0x42320d[_0x6f96('0x4a')][_0x6f96('0x32')]);}_0x20a6de['order']=qs['sort'](_0x42320d[_0x6f96('0x4a')][_0x6f96('0x4f')]);_0x20a6de[_0x6f96('0x50')]=qs[_0x6f96('0x51')](_[_0x6f96('0x52')](_0x42320d['query'],_0x5dda29[_0x6f96('0x51')]),_0x2fa5a1);if(_0x42320d[_0x6f96('0x4a')][_0x6f96('0x53')]){_0x20a6de[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0x20a6de[_0x6f96('0x50')],{'$or':_[_0x6f96('0x43')](_0x2fa5a1,function(_0x74b112){if(_0x74b112[_0x6f96('0x47')]!==_0x6f96('0x55')){var _0x23902c={};_0x23902c[_0x74b112[_0x6f96('0x3f')]]={'$like':'%'+_0x42320d[_0x6f96('0x4a')][_0x6f96('0x53')]+'%'};return _0x23902c;}})});}_0x20a6de=_[_0x6f96('0x54')]({},_0x20a6de,_0x42320d[_0x6f96('0x56')]);var _0x9e28e0={'where':_0x20a6de[_0x6f96('0x50')]};return db['OpenchannelAccount'][_0x6f96('0x35')](_0x9e28e0)[_0x6f96('0x24')](function(_0x53f437){_0x3b2ad8[_0x6f96('0x35')]=_0x53f437;if(_0x42320d[_0x6f96('0x4a')][_0x6f96('0x57')]){_0x20a6de['include']=[{'all':!![]}];}return db[_0x6f96('0x44')][_0x6f96('0x58')](_0x20a6de);})['then'](function(_0x37558e){_0x3b2ad8['rows']=_0x37558e;return _0x3b2ad8;})['then'](respondWithFilteredResult(_0x9be8f5,_0x20a6de))[_0x6f96('0x2d')](handleError(_0x9be8f5,null));};exports[_0x6f96('0x59')]=function(_0x3f6d3f,_0x2fe9c8){var _0x2ceb43={'raw':![],'where':{'id':_0x3f6d3f['params']['id']},'include':[{'model':db['Pause'],'as':_0x6f96('0x42')}]},_0x146f1e={};_0x146f1e[_0x6f96('0x49')]=_[_0x6f96('0x5a')](db[_0x6f96('0x44')][_0x6f96('0x45')]);_0x146f1e[_0x6f96('0x4a')]=_['keys'](_0x3f6d3f[_0x6f96('0x4a')]);_0x146f1e['filters']=_[_0x6f96('0x4c')](_0x146f1e[_0x6f96('0x49')],_0x146f1e[_0x6f96('0x4a')]);_0x2ceb43[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x146f1e[_0x6f96('0x49')],qs['fields'](_0x3f6d3f[_0x6f96('0x4a')]['fields']));_0x2ceb43[_0x6f96('0x4b')]=_0x2ceb43['attributes']['length']?_0x2ceb43[_0x6f96('0x4b')]:_0x146f1e[_0x6f96('0x49')];if(_0x3f6d3f[_0x6f96('0x4a')][_0x6f96('0x57')]){_0x2ceb43['include']=[{'all':!![]}];}_0x2ceb43=_[_0x6f96('0x54')]({},_0x2ceb43,_0x3f6d3f[_0x6f96('0x56')]);return db[_0x6f96('0x44')]['find'](_0x2ceb43)[_0x6f96('0x24')](handleEntityNotFound(_0x2fe9c8,null))[_0x6f96('0x24')](respondWithResult(_0x2fe9c8,null))[_0x6f96('0x2d')](handleError(_0x2fe9c8,null));};exports[_0x6f96('0x5b')]=function(_0x524c74,_0x5b3fd0){return db['OpenchannelAccount'][_0x6f96('0x5b')](_0x524c74['body'],{})['then'](function(_0x5876be){var _0x64db92=_0x524c74['user']['get']({'plain':!![]});if(!_0x64db92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x64db92[_0x6f96('0x5c')]==='user'){var _0x24db32=_0x5876be[_0x6f96('0x5d')]({'plain':!![]});var _0xbf2c45='OpenchannelAccounts';return db['UserProfileSection'][_0x6f96('0x5e')]({'where':{'name':_0xbf2c45,'userProfileId':_0x64db92[_0x6f96('0x5f')]},'raw':!![]})[_0x6f96('0x24')](function(_0x182a3a){if(_0x182a3a&&_0x182a3a[_0x6f96('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x24db32[_0x6f96('0x3f')],'resourceId':_0x24db32['id'],'type':_0x182a3a[_0x6f96('0x3f')],'sectionId':_0x182a3a['id']},{})[_0x6f96('0x24')](function(){return _0x5876be;});}else{return _0x5876be;}})[_0x6f96('0x2d')](function(_0x28b585){logger[_0x6f96('0x29')](_0x6f96('0x61'),_0x28b585);throw _0x28b585;});}return _0x5876be;})['then'](respondWithResult(_0x5b3fd0,0xc9))[_0x6f96('0x2d')](handleError(_0x5b3fd0,null));};exports['update']=function(_0x50d15f,_0x5a14d2){if(_0x50d15f[_0x6f96('0x62')]['id']){delete _0x50d15f[_0x6f96('0x62')]['id'];}return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x50d15f['params']['id']},'include':[{'model':db[_0x6f96('0x41')],'as':'mandatoryDispositionPause'}]})[_0x6f96('0x24')](handleEntityNotFound(_0x5a14d2,null))[_0x6f96('0x24')](saveUpdates(_0x50d15f['body'],null))[_0x6f96('0x24')](respondWithResult(_0x5a14d2,null))[_0x6f96('0x2d')](handleError(_0x5a14d2,null));};exports[_0x6f96('0x3d')]=function(_0x1928bc,_0x210cfd){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x1928bc['params']['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x210cfd,null))[_0x6f96('0x24')](removeEntity(_0x210cfd,null))[_0x6f96('0x2d')](handleError(_0x210cfd,null));};exports[_0x6f96('0x63')]=function(_0x423eb3,_0x1d7530){return db[_0x6f96('0x44')]['describe']()['then'](respondWithResult(_0x1d7530,null))[_0x6f96('0x2d')](handleError(_0x1d7530,null));};exports[_0x6f96('0x64')]=function(_0xf314bb,_0x594306,_0x27107d){if(_0xf314bb[_0x6f96('0x62')]['id']){delete _0xf314bb[_0x6f96('0x62')]['id'];}return db[_0x6f96('0x44')]['find']({'where':{'id':_0xf314bb[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x594306,null))[_0x6f96('0x24')](function(_0x377f80){if(_0x377f80){_0xf314bb[_0x6f96('0x62')][_0x6f96('0x66')]=_0x377f80['id'];return db['Disposition'][_0x6f96('0x5b')](_0xf314bb['body']);}})[_0x6f96('0x24')](respondWithResult(_0x594306,null))[_0x6f96('0x2d')](handleError(_0x594306,null));};exports['getDispositions']=function(_0x46d52a,_0x5da397,_0x5b947a){var _0x588483={'raw':![],'where':{}};var _0x29772c={};var _0x1e0826={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46d52a[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x5da397,null))['then'](function(_0x4bc614){if(_0x4bc614){_0x29772c[_0x6f96('0x49')]=_[_0x6f96('0x5a')](db[_0x6f96('0x67')][_0x6f96('0x45')]);_0x29772c[_0x6f96('0x4a')]=_[_0x6f96('0x5a')](_0x46d52a[_0x6f96('0x4a')]);_0x29772c[_0x6f96('0x51')]=_[_0x6f96('0x4c')](_0x29772c[_0x6f96('0x49')],_0x29772c[_0x6f96('0x4a')]);_0x588483[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x29772c[_0x6f96('0x49')],qs['fields'](_0x46d52a[_0x6f96('0x4a')]['fields']));_0x588483[_0x6f96('0x4b')]=_0x588483['attributes'][_0x6f96('0x68')]?_0x588483[_0x6f96('0x4b')]:_0x29772c[_0x6f96('0x49')];if(!_0x46d52a['query'][_0x6f96('0x4e')](_0x6f96('0x69'))){_0x588483['limit']=qs[_0x6f96('0x34')](_0x46d52a[_0x6f96('0x4a')][_0x6f96('0x34')]);_0x588483['offset']=qs[_0x6f96('0x32')](_0x46d52a[_0x6f96('0x4a')][_0x6f96('0x32')]);}_0x588483['order']=qs[_0x6f96('0x4f')](_0x46d52a[_0x6f96('0x4a')][_0x6f96('0x4f')]);_0x588483[_0x6f96('0x50')]=qs[_0x6f96('0x51')](_[_0x6f96('0x52')](_0x46d52a['query'],_0x29772c[_0x6f96('0x51')]));_0x588483[_0x6f96('0x50')][_0x6f96('0x66')]=_0x4bc614['id'];if(_0x46d52a[_0x6f96('0x4a')]['filter']){_0x588483[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0x588483['where'],{'$or':_[_0x6f96('0x43')](_0x588483[_0x6f96('0x4b')],function(_0x3af029){var _0x3a9904={};_0x3a9904[_0x3af029]={'$like':'%'+_0x46d52a[_0x6f96('0x4a')][_0x6f96('0x53')]+'%'};return _0x3a9904;})});}_0x588483=_[_0x6f96('0x54')]({},_0x588483,_0x46d52a[_0x6f96('0x56')]);return db[_0x6f96('0x67')]['count']({'where':_0x588483['where']})[_0x6f96('0x24')](function(_0x184c62){_0x1e0826[_0x6f96('0x35')]=_0x184c62;if(_0x46d52a['query'][_0x6f96('0x57')]){_0x588483['include']=[{'all':!![]}];}return db[_0x6f96('0x67')]['findAll'](_0x588483);})['then'](function(_0x56e4c2){_0x1e0826[_0x6f96('0x6a')]=_0x56e4c2;return _0x1e0826;});}})[_0x6f96('0x24')](respondWithFilteredResult(_0x5da397,_0x588483))['catch'](handleError(_0x5da397,null));};exports[_0x6f96('0x6b')]=function(_0x54e62c,_0x43f66d,_0x20096f){return db['OpenchannelAccount'][_0x6f96('0x5e')]({'where':{'id':_0x54e62c[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x43f66d,null))[_0x6f96('0x24')](function(_0x4c1442){if(_0x4c1442){return _0x4c1442[_0x6f96('0x6b')](_0x54e62c[_0x6f96('0x4a')][_0x6f96('0x6c')]);}})[_0x6f96('0x24')](respondWithStatusCode(_0x43f66d,null))[_0x6f96('0x2d')](handleError(_0x43f66d,null));};exports[_0x6f96('0x6d')]=function(_0x15be3b,_0x34f8e9,_0xd284c5){if(_0x15be3b[_0x6f96('0x62')]['id']){delete _0x15be3b[_0x6f96('0x62')]['id'];}return db[_0x6f96('0x44')]['find']({'where':{'id':_0x15be3b[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x34f8e9,null))[_0x6f96('0x24')](function(_0x50288a){if(_0x50288a){_0x15be3b['body'][_0x6f96('0x66')]=_0x50288a['id'];return db[_0x6f96('0x6e')]['create'](_0x15be3b[_0x6f96('0x62')]);}})['then'](respondWithResult(_0x34f8e9,null))['catch'](handleError(_0x34f8e9,null));};exports[_0x6f96('0x6f')]=function(_0x4b23aa,_0x210de7,_0x52e481){var _0xbdb0f3={'raw':![],'where':{}};var _0x86b29c={};var _0x4d8ccb={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6f96('0x70')]({'where':{'id':_0x4b23aa['params']['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x210de7,null))[_0x6f96('0x24')](function(_0x40b074){if(_0x40b074){_0x86b29c['model']=_[_0x6f96('0x5a')](db[_0x6f96('0x6e')]['rawAttributes']);_0x86b29c[_0x6f96('0x4a')]=_[_0x6f96('0x5a')](_0x4b23aa[_0x6f96('0x4a')]);_0x86b29c[_0x6f96('0x51')]=_[_0x6f96('0x4c')](_0x86b29c[_0x6f96('0x49')],_0x86b29c[_0x6f96('0x4a')]);_0xbdb0f3[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x86b29c[_0x6f96('0x49')],qs['fields'](_0x4b23aa[_0x6f96('0x4a')][_0x6f96('0x4d')]));_0xbdb0f3[_0x6f96('0x4b')]=_0xbdb0f3[_0x6f96('0x4b')][_0x6f96('0x68')]?_0xbdb0f3['attributes']:_0x86b29c[_0x6f96('0x49')];if(!_0x4b23aa['query']['hasOwnProperty'](_0x6f96('0x69'))){_0xbdb0f3['limit']=qs[_0x6f96('0x34')](_0x4b23aa['query']['limit']);_0xbdb0f3[_0x6f96('0x32')]=qs['offset'](_0x4b23aa['query'][_0x6f96('0x32')]);}_0xbdb0f3[_0x6f96('0x71')]=qs[_0x6f96('0x4f')](_0x4b23aa['query'][_0x6f96('0x4f')]);_0xbdb0f3[_0x6f96('0x50')]=qs[_0x6f96('0x51')](_['pick'](_0x4b23aa[_0x6f96('0x4a')],_0x86b29c[_0x6f96('0x51')]));_0xbdb0f3[_0x6f96('0x50')]['OpenchannelAccountId']=_0x40b074['id'];if(_0x4b23aa[_0x6f96('0x4a')][_0x6f96('0x53')]){_0xbdb0f3[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0xbdb0f3[_0x6f96('0x50')],{'$or':_[_0x6f96('0x43')](_0xbdb0f3[_0x6f96('0x4b')],function(_0x2a166d){var _0x2611bc={};_0x2611bc[_0x2a166d]={'$like':'%'+_0x4b23aa['query'][_0x6f96('0x53')]+'%'};return _0x2611bc;})});}_0xbdb0f3=_[_0x6f96('0x54')]({},_0xbdb0f3,_0x4b23aa['options']);return db['CannedAnswer'][_0x6f96('0x35')]({'where':_0xbdb0f3[_0x6f96('0x50')]})[_0x6f96('0x24')](function(_0x20ea69){_0x4d8ccb['count']=_0x20ea69;if(_0x4b23aa[_0x6f96('0x4a')][_0x6f96('0x57')]){_0xbdb0f3[_0x6f96('0x72')]=[{'all':!![]}];}return db[_0x6f96('0x6e')][_0x6f96('0x58')](_0xbdb0f3);})['then'](function(_0x3f48cf){_0x4d8ccb[_0x6f96('0x6a')]=_0x3f48cf;return _0x4d8ccb;});}})[_0x6f96('0x24')](respondWithFilteredResult(_0x210de7,_0xbdb0f3))[_0x6f96('0x2d')](handleError(_0x210de7,null));};exports[_0x6f96('0x73')]=function(_0x403091,_0x74e730,_0x53f9b6){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x403091[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x74e730,null))['then'](function(_0x416c4a){if(_0x416c4a){return _0x416c4a[_0x6f96('0x73')](_0x403091['query'][_0x6f96('0x6c')]);}})[_0x6f96('0x24')](respondWithStatusCode(_0x74e730,null))[_0x6f96('0x2d')](handleError(_0x74e730,null));};exports[_0x6f96('0x74')]=function(_0x1d5f01,_0xa7110f,_0x4b35c7){var _0x5c5db0={'body':_0x1d5f01[_0x6f96('0x62')],'channel':_0x6f96('0x75')};var _0x51daef=[];var _0x5c26b6=[];var _0x324fce={};var _0x174797=![];return db[_0x6f96('0x76')][_0x6f96('0x63')]()[_0x6f96('0x24')](function(_0x213cc4){if(!_0x213cc4){throw new db['Sequelize'][(_0x6f96('0x77'))](_0x6f96('0x78'));}_0x51daef=_[_0x6f96('0x79')](_[_0x6f96('0x5a')](_0x213cc4),['createdAt','updatedAt']);_0x5c26b6=_[_0x6f96('0x79')](_['keys'](_0x213cc4),[_0x6f96('0x7a'),_0x6f96('0x7b'),_0x6f96('0x7c'),'ListId']);if(_0x1d5f01[_0x6f96('0x62')]['id']){delete _0x1d5f01[_0x6f96('0x62')]['id'];}if(_[_0x6f96('0x7d')](_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x7e')])){throw new db[(_0x6f96('0x7f'))]['ValidationError'](_0x6f96('0x80'));}if(_[_0x6f96('0x7d')](_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x62')])||_0x1d5f01[_0x6f96('0x62')]['body']===''){throw new db[(_0x6f96('0x7f'))][(_0x6f96('0x77'))](_0x6f96('0x81'));}if(_[_0x6f96('0x7d')](_0x1d5f01[_0x6f96('0x62')]['mapKey'])){throw new db[(_0x6f96('0x7f'))][(_0x6f96('0x77'))](_0x6f96('0x82')+_0x5c26b6);}if(!_[_0x6f96('0x83')](_0x5c26b6,_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x84')])){throw new db[(_0x6f96('0x7f'))][(_0x6f96('0x77'))](_0x6f96('0x85')+_0x5c26b6);}_0x324fce[_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x84')]]=_0x1d5f01['body'][_0x6f96('0x7e')];})['then'](function(){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x1d5f01[_0x6f96('0x65')]['id']},'include':[{'model':db[_0x6f96('0x86')],'as':_0x6f96('0x87'),'include':[{'model':db[_0x6f96('0x76')],'as':_0x6f96('0x88'),'where':_0x324fce,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x6f96('0x89')],'as':_0x6f96('0x8a')}]});})['then'](handleEntityNotFound(_0xa7110f,null))[_0x6f96('0x24')](function(_0xbce343){if(_0xbce343&&_0xbce343[_0x6f96('0x87')]){_0x5c5db0[_0x6f96('0x8b')]=_0xbce343;_0x5c5db0['applications']=_0xbce343[_0x6f96('0x8a')];_0x5c5db0[_0x6f96('0x8c')]=_0xbce343['List'];_0x5c5db0[_0x6f96('0x8d')]=_[_0x6f96('0x8e')](_0x5c5db0[_0x6f96('0x8d')],[_0x6f96('0x8f')],[_0x6f96('0x90')]);if(_0x5c5db0[_0x6f96('0x8b')][_0x6f96('0x8a')]){delete _0x5c5db0[_0x6f96('0x8b')][_0x6f96('0x8a')];}if(_0x5c5db0[_0x6f96('0x8b')]['List']&&_0x5c5db0[_0x6f96('0x8b')][_0x6f96('0x87')][_0x6f96('0x88')]['length']){return _0x5c5db0['account'][_0x6f96('0x87')][_0x6f96('0x88')][0x0];}var _0xfb271e=_['defaults'](_0x1d5f01[_0x6f96('0x62')],{'firstName':_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x7e')],'ListId':_0xbce343[_0x6f96('0x91')]});_0xfb271e[_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x84')]]=_0x1d5f01[_0x6f96('0x62')]['from'];return db[_0x6f96('0x76')][_0x6f96('0x5b')](_0xfb271e,{'fields':_0x51daef,'raw':!![]});}})[_0x6f96('0x24')](handleEntityNotFound(_0xa7110f,null))[_0x6f96('0x24')](function(_0x164d9c){_0x5c5db0[_0x6f96('0x92')]=_0x164d9c;if(_0x164d9c){var _0x2223c9={'ContactId':_0x164d9c['id'],'OpenchannelAccountId':_0x1d5f01[_0x6f96('0x65')]['id'],'from':(_0x164d9c['firstName']||'')+'\x20'+(_0x164d9c[_0x6f96('0x93')]||'')};var _0x5a30ab={'OpenchannelAccountId':_0x1d5f01[_0x6f96('0x65')]['id'],'closed':![]};if(_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x94')]){_0x5a30ab[_0x6f96('0x94')]=_0x1d5f01['body'][_0x6f96('0x94')];return db[_0x6f96('0x95')][_0x6f96('0x5e')]({'where':_0x5a30ab})[_0x6f96('0x24')](function(_0x526906){if(_0x526906){return[_0x526906,![]];}_0x2223c9['threadId']=_0x1d5f01[_0x6f96('0x62')]['threadId'];_0x2223c9[_0x6f96('0x96')]=_0x1d5f01[_0x6f96('0x62')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x2223c9)[_0x6f96('0x24')](function(_0x555238){return[_0x555238,!![]];});});}else{_0x5a30ab[_0x6f96('0x94')]=null;}_0x5a30ab[_0x6f96('0x97')]=_0x164d9c['id'];return db['OpenchannelInteraction']['find']({'where':_0x5a30ab})['then'](function(_0x3b840e){if(_0x3b840e){return[_0x3b840e,![]];}return db[_0x6f96('0x95')][_0x6f96('0x5b')](_0x2223c9)[_0x6f96('0x24')](function(_0x2eec6a){return[_0x2eec6a,!![]];});});}})[_0x6f96('0x98')](function(_0xd2d0a2,_0x4dcc1e){if(_0xd2d0a2){_0x174797=_0x4dcc1e;if(!_0x4dcc1e){var _0x327a65={'from':(_0x5c5db0['contact']['firstName']||'')+'\x20'+(_0x5c5db0[_0x6f96('0x92')]['lastName']||'')};if(_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x94')]&&_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x99')]&&_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x94')]!=_0x1d5f01['body'][_0x6f96('0x99')]){_0x327a65['threadId']=_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x99')];}return _0xd2d0a2[_0x6f96('0x3b')](_0x327a65);}else{return _0xd2d0a2;}}})['then'](function(_0x524afe){_0x5c5db0[_0x6f96('0x9a')]=_0x524afe[_0x6f96('0x5d')]({'plain':!![]});_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0x9b')]=_0x174797;if(_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0x9b')]){if(_0x5c5db0[_0x6f96('0x8b')]['autoclose']){_0x5c5db0[_0x6f96('0x8d')][_0x6f96('0x9c')]({'id':0x0,'priority':_0x5c5db0[_0x6f96('0x8d')][_0x6f96('0x68')]+0x1,'app':'close','appdata':_0x6f96('0x9d'),'interval':'*,*,*,*'});}}return db[_0x6f96('0x9e')][_0x6f96('0x5b')]({'body':_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x62')],'OpenchannelAccountId':_0x1d5f01[_0x6f96('0x65')]['id'],'OpenchannelInteractionId':_0x524afe['id'],'direction':'in','ContactId':_0x5c5db0[_0x6f96('0x92')]['id'],'AttachmentId':_0x1d5f01[_0x6f96('0x62')][_0x6f96('0x9f')]});})[_0x6f96('0x24')](function(_0x22f13b){_0x5c5db0[_0x6f96('0x2b')]=_0x22f13b;if(!_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0xa0')])return;return db[_0x6f96('0xa1')][_0x6f96('0x5e')]({'attributes':['id',_0x6f96('0x3f')],'where':{'id':_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0xa0')]}});})[_0x6f96('0x24')](function(_0x41d885){if(_0x41d885){_0x5c5db0['applications'][_0x6f96('0xa2')]({'id':0x0,'priority':0x0,'app':_0x6f96('0xa3'),'appdata':_0x41d885[_0x6f96('0x3f')]+','+(_0x5c5db0['account'][_0x6f96('0xa4')]||0xa),'interval':_0x6f96('0xa5')});}if(!_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0xa6')])return;return db[_0x6f96('0xa7')][_0x6f96('0x5e')]({'attributes':['id',_0x6f96('0x3f')],'where':{'id':_0x5c5db0[_0x6f96('0x9a')][_0x6f96('0xa6')]}});})['then'](function(_0x28a9de){if(_0x28a9de){_0x5c5db0[_0x6f96('0x8d')][_0x6f96('0xa2')]({'id':0x0,'priority':0x1,'app':_0x6f96('0xa8'),'appdata':_0x28a9de['name']+','+(_0x5c5db0[_0x6f96('0x8b')][_0x6f96('0xa9')]||0x12c),'interval':_0x6f96('0xa5')});}return respondWithRpcPromise(_0x6f96('0xaa'),_0x6f96('0xab'),_0x5c5db0);})[_0x6f96('0x24')](function(_0x2e7ba7){respondWithRpcPromise(_0x6f96('0xac'),_0x6f96('0xac'),{'event':'notify','message':_0x2e7ba7},client9002);return _0x2e7ba7;})[_0x6f96('0x24')](respondWithResult(_0xa7110f,null))[_0x6f96('0x2d')](handleError(_0xa7110f,null));};exports[_0x6f96('0xad')]=function(_0x5bea30,_0x375cf3){var _0x192980=_0x5bea30['params']['id'];var _0x3f8159=_0x5bea30[_0x6f96('0x62')];var _0x521250=0xc8;var _0x1d0b5d=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x6f96('0xae')][_0x6f96('0xaf')][_0x6f96('0xb0')]},function(_0x4adab9){return db[_0x6f96('0x44')][_0x6f96('0x70')]({'where':{'id':_0x192980},'transaction':_0x4adab9})['then'](function(_0x59fd12){if(_0x59fd12){return db['OpenchannelApplication'][_0x6f96('0x3d')]({'where':{'OpenchannelAccountId':_0x192980},'transaction':_0x4adab9})['then'](function(){var _0x715c9f=_['map'](_0x3f8159,function(_0x34b5de){_0x34b5de[_0x6f96('0x66')]=_0x192980;return _0x34b5de;});return db['OpenchannelApplication'][_0x6f96('0xb1')](_0x715c9f,{'transaction':_0x4adab9});});}else{_0x521250=0x194;_0x1d0b5d=[];}});})[_0x6f96('0x24')](function(){if(_0x521250!==0x194){return db[_0x6f96('0x89')][_0x6f96('0xb2')]({'where':{'OpenchannelAccountId':_0x192980},'order':_0x6f96('0x8f')})[_0x6f96('0x24')](function(_0xf1ed96){_0x1d0b5d=_0xf1ed96;});}})['catch'](function(_0x1b13b4){_0x521250=0x1f4;logger[_0x6f96('0x29')](_0x1b13b4[_0x6f96('0x3e')]);if(_0x1b13b4['name']){delete _0x1b13b4[_0x6f96('0x3f')];}_0x1d0b5d=_0x1b13b4;})[_0x6f96('0xb3')](function(){if(_0x1d0b5d===null){_0x375cf3[_0x6f96('0x2e')](_0x521250);}else{if(_0x521250===0x1f4){_0x375cf3[_0x6f96('0x2f')](_0x521250)[_0x6f96('0xb4')](_0x1d0b5d);}else{_0x375cf3['status'](_0x521250)[_0x6f96('0x31')](_0x1d0b5d);}}});};exports[_0x6f96('0xb5')]=function(_0x581b29,_0x31a206,_0x25a15d){var _0x596f65={};var _0x43fa57={};var _0xabb994;var _0x267854;return db[_0x6f96('0x44')]['findOne']({'where':{'id':_0x581b29[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x31a206,null))[_0x6f96('0x24')](function(_0x4926a4){if(_0x4926a4){_0xabb994=_0x4926a4;_0x43fa57['model']=_['keys'](db[_0x6f96('0x89')]['rawAttributes']);_0x43fa57[_0x6f96('0x4a')]=_['keys'](_0x581b29['query']);_0x43fa57['filters']=_[_0x6f96('0x4c')](_0x43fa57[_0x6f96('0x49')],_0x43fa57[_0x6f96('0x4a')]);_0x596f65[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x43fa57['model'],qs[_0x6f96('0x4d')](_0x581b29['query'][_0x6f96('0x4d')]));_0x596f65[_0x6f96('0x4b')]=_0x596f65[_0x6f96('0x4b')][_0x6f96('0x68')]?_0x596f65[_0x6f96('0x4b')]:_0x43fa57[_0x6f96('0x49')];_0x596f65[_0x6f96('0x71')]=qs[_0x6f96('0x4f')](_0x581b29[_0x6f96('0x4a')][_0x6f96('0x4f')]);_0x596f65[_0x6f96('0x50')]=qs[_0x6f96('0x51')](_[_0x6f96('0x52')](_0x581b29[_0x6f96('0x4a')],_0x43fa57[_0x6f96('0x51')]));if(_0x581b29[_0x6f96('0x4a')][_0x6f96('0x53')]){_0x596f65[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0x596f65[_0x6f96('0x50')],{'$or':_[_0x6f96('0x43')](_0x596f65[_0x6f96('0x4b')],function(_0x14496c){var _0x27ab51={};_0x27ab51[_0x14496c]={'$like':'%'+_0x581b29[_0x6f96('0x4a')][_0x6f96('0x53')]+'%'};return _0x27ab51;})});}_0x596f65=_[_0x6f96('0x54')]({},_0x596f65,_0x581b29['options']);return _0xabb994['getApplications'](_0x596f65);}})[_0x6f96('0x24')](function(_0x36a325){if(_0x36a325){_0x267854=_0x36a325[_0x6f96('0x68')];if(!_0x581b29[_0x6f96('0x4a')][_0x6f96('0x4e')](_0x6f96('0x69'))){_0x596f65[_0x6f96('0x34')]=qs['limit'](_0x581b29[_0x6f96('0x4a')][_0x6f96('0x34')]);_0x596f65[_0x6f96('0x32')]=qs[_0x6f96('0x32')](_0x581b29['query'][_0x6f96('0x32')]);}return _0xabb994[_0x6f96('0xb5')](_0x596f65);}})['then'](function(_0x53caa8){if(_0x53caa8){return _0x53caa8?{'count':_0x267854,'rows':_0x53caa8}:null;}})[_0x6f96('0x24')](respondWithResult(_0x31a206,null))[_0x6f96('0x2d')](handleError(_0x31a206,null));};exports[_0x6f96('0xb6')]=function(_0x3df248,_0x3be03d,_0x44ab26){var _0x422468={'raw':![],'where':{}};var _0x509e9f={};var _0x30c067={'count':0x0,'rows':[]};return db[_0x6f96('0x44')][_0x6f96('0x70')]({'where':{'id':_0x3df248['params']['id']}})['then'](handleEntityNotFound(_0x3be03d,null))[_0x6f96('0x24')](function(_0x5a72ca){if(_0x5a72ca){_0x509e9f[_0x6f96('0x49')]=_['keys'](db[_0x6f96('0x95')][_0x6f96('0x45')]);_0x509e9f[_0x6f96('0x4a')]=_[_0x6f96('0x5a')](_0x3df248[_0x6f96('0x4a')]);_0x509e9f[_0x6f96('0x51')]=_[_0x6f96('0x4c')](_0x509e9f[_0x6f96('0x49')],_0x509e9f['query']);_0x422468[_0x6f96('0x4b')]=_[_0x6f96('0x4c')](_0x509e9f['model'],qs[_0x6f96('0x4d')](_0x3df248['query'][_0x6f96('0x4d')]));_0x422468[_0x6f96('0x4b')]=_0x422468['attributes'][_0x6f96('0x68')]?_0x422468[_0x6f96('0x4b')]:_0x509e9f[_0x6f96('0x49')];if(!_0x3df248[_0x6f96('0x4a')][_0x6f96('0x4e')](_0x6f96('0x69'))){_0x422468[_0x6f96('0x34')]=qs[_0x6f96('0x34')](_0x3df248[_0x6f96('0x4a')][_0x6f96('0x34')]);_0x422468[_0x6f96('0x32')]=qs[_0x6f96('0x32')](_0x3df248['query'][_0x6f96('0x32')]);}_0x422468['order']=qs[_0x6f96('0x4f')](_0x3df248[_0x6f96('0x4a')][_0x6f96('0x4f')]);_0x422468['where']=qs[_0x6f96('0x51')](_[_0x6f96('0x52')](_0x3df248[_0x6f96('0x4a')],_0x509e9f['filters']));_0x422468[_0x6f96('0x50')][_0x6f96('0x66')]=_0x5a72ca['id'];if(_0x3df248[_0x6f96('0x4a')][_0x6f96('0x53')]){_0x422468[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0x422468[_0x6f96('0x50')],{'$or':_[_0x6f96('0x43')](_0x422468[_0x6f96('0x4b')],function(_0x327e38){var _0x314f9e={};_0x314f9e[_0x327e38]={'$like':'%'+_0x3df248[_0x6f96('0x4a')][_0x6f96('0x53')]+'%'};return _0x314f9e;})});}_0x422468=_[_0x6f96('0x54')]({},_0x422468,_0x3df248[_0x6f96('0x56')]);return db[_0x6f96('0x95')][_0x6f96('0x35')]({'where':_0x422468['where']})[_0x6f96('0x24')](function(_0x10ec10){_0x30c067[_0x6f96('0x35')]=_0x10ec10;if(_0x3df248[_0x6f96('0x4a')][_0x6f96('0x57')]){_0x422468[_0x6f96('0x72')]=[{'model':db['CmContact'],'as':_0x6f96('0xb7'),'required':![]},{'model':db[_0x6f96('0xa1')],'as':_0x6f96('0xb8'),'attributes':['name',_0x6f96('0xb9'),_0x6f96('0xba')],'required':![]},{'model':db[_0x6f96('0xbb')],'as':_0x6f96('0xbc'),'attributes':['id',_0x6f96('0x3f'),_0x6f96('0xbd')],'where':_0x3df248[_0x6f96('0x4a')][_0x6f96('0xbe')]?{'id':_0x3df248[_0x6f96('0x4a')][_0x6f96('0xbe')]}:undefined,'required':_0x3df248[_0x6f96('0x4a')][_0x6f96('0xbe')]?!![]:![]}];}return db[_0x6f96('0x95')][_0x6f96('0x58')](_0x422468);})[_0x6f96('0x24')](function(_0x42b3da){_0x30c067['rows']=_0x42b3da;return _0x30c067;});}})[_0x6f96('0x24')](respondWithFilteredResult(_0x3be03d,_0x422468))[_0x6f96('0x2d')](handleError(_0x3be03d,null));};exports[_0x6f96('0xbf')]=function(_0x46b2ee,_0x190aaa,_0x116ce7){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x46b2ee[_0x6f96('0x65')]['id']}})['then'](handleEntityNotFound(_0x190aaa,null))[_0x6f96('0x24')](function(_0x2ff8fd){if(_0x2ff8fd){return _0x2ff8fd[_0x6f96('0xbf')](_0x46b2ee[_0x6f96('0x62')][_0x6f96('0x6c')],_['omit'](_0x46b2ee[_0x6f96('0x62')],[_0x6f96('0x6c'),'id'])||{})[_0x6f96('0x98')](function(_0x384e6f){for(var _0x3bb85b=0x0;_0x3bb85b<_0x46b2ee['body']['ids'][_0x6f96('0x68')];_0x3bb85b+=0x1){socket['emit'](_0x6f96('0xc0'),{'UserId':Number(_0x46b2ee[_0x6f96('0x62')][_0x6f96('0x6c')][_0x3bb85b]),'OpenchannelAccountId':Number(_0x46b2ee['params']['id'])});}return _0x384e6f;});}})[_0x6f96('0x24')](respondWithResult(_0x190aaa,null))[_0x6f96('0x2d')](handleError(_0x190aaa,null));};exports[_0x6f96('0xc1')]=function(_0x427276,_0xc1fe87,_0x411d86){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x427276[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0xc1fe87,null))[_0x6f96('0x24')](function(_0x2a4308){if(_0x2a4308){return _0x2a4308[_0x6f96('0xc1')](_0x427276['query'][_0x6f96('0x6c')])[_0x6f96('0x24')](function(){if(_[_0x6f96('0xc2')](_0x427276[_0x6f96('0x4a')]['ids'])){for(var _0x4d0df6=0x0;_0x4d0df6<_0x427276[_0x6f96('0x4a')]['ids'][_0x6f96('0x68')];_0x4d0df6+=0x1){socket[_0x6f96('0xc3')](_0x6f96('0xc4'),{'UserId':Number(_0x427276[_0x6f96('0x4a')][_0x6f96('0x6c')][_0x4d0df6]),'OpenchannelAccountId':Number(_0x427276['params']['id'])});}}else{socket[_0x6f96('0xc3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x427276[_0x6f96('0x4a')]['ids']),'OpenchannelAccountId':Number(_0x427276[_0x6f96('0x65')]['id'])});}});}})[_0x6f96('0x24')](respondWithStatusCode(_0xc1fe87,null))['catch'](handleError(_0xc1fe87,null));};exports[_0x6f96('0xc5')]=function(_0x3220f7,_0x9af269,_0x598456){var _0x21e999={};var _0x4804db={};var _0x56fd44;var _0x323b98;return db[_0x6f96('0x44')][_0x6f96('0x70')]({'where':{'id':_0x3220f7[_0x6f96('0x65')]['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x9af269,null))[_0x6f96('0x24')](function(_0x2d3d31){if(_0x2d3d31){_0x56fd44=_0x2d3d31;_0x4804db[_0x6f96('0x49')]=_[_0x6f96('0x5a')](db[_0x6f96('0xa1')][_0x6f96('0x45')]);_0x4804db[_0x6f96('0x4a')]=_[_0x6f96('0x5a')](_0x3220f7[_0x6f96('0x4a')]);_0x4804db[_0x6f96('0x51')]=_[_0x6f96('0x4c')](_0x4804db[_0x6f96('0x49')],_0x4804db[_0x6f96('0x4a')]);_0x21e999['attributes']=_[_0x6f96('0x4c')](_0x4804db[_0x6f96('0x49')],qs[_0x6f96('0x4d')](_0x3220f7[_0x6f96('0x4a')]['fields']));_0x21e999[_0x6f96('0x4b')]=_0x21e999[_0x6f96('0x4b')]['length']?_0x21e999[_0x6f96('0x4b')]:_0x4804db[_0x6f96('0x49')];_0x21e999[_0x6f96('0x71')]=qs[_0x6f96('0x4f')](_0x3220f7['query'][_0x6f96('0x4f')]);_0x21e999[_0x6f96('0x50')]=qs[_0x6f96('0x51')](_[_0x6f96('0x52')](_0x3220f7[_0x6f96('0x4a')],_0x4804db[_0x6f96('0x51')]));if(_0x3220f7[_0x6f96('0x4a')][_0x6f96('0x53')]){_0x21e999[_0x6f96('0x50')]=_[_0x6f96('0x54')](_0x21e999[_0x6f96('0x50')],{'$or':_[_0x6f96('0x43')](_0x21e999['attributes'],function(_0x5cf703){var _0x46d7fa={};_0x46d7fa[_0x5cf703]={'$like':'%'+_0x3220f7[_0x6f96('0x4a')]['filter']+'%'};return _0x46d7fa;})});}_0x21e999=_[_0x6f96('0x54')]({},_0x21e999,_0x3220f7[_0x6f96('0x56')]);return _0x56fd44['getAgents'](_0x21e999);}})[_0x6f96('0x24')](function(_0x48d94a){if(_0x48d94a){_0x323b98=_0x48d94a[_0x6f96('0x68')];if(!_0x3220f7[_0x6f96('0x4a')][_0x6f96('0x4e')](_0x6f96('0x69'))){_0x21e999[_0x6f96('0x34')]=qs['limit'](_0x3220f7[_0x6f96('0x4a')]['limit']);_0x21e999['offset']=qs['offset'](_0x3220f7[_0x6f96('0x4a')][_0x6f96('0x32')]);}return _0x56fd44['getAgents'](_0x21e999);}})[_0x6f96('0x24')](function(_0x55c40c){if(_0x55c40c){return _0x55c40c?{'count':_0x323b98,'rows':_0x55c40c}:null;}})[_0x6f96('0x24')](respondWithResult(_0x9af269,null))[_0x6f96('0x2d')](handleError(_0x9af269,null));};exports[_0x6f96('0xb4')]=function(_0x1760c0,_0x25d57b,_0x925ed9){var _0x41eefe,_0xd0b0ff,_0x52f192;if(_[_0x6f96('0x7d')](_0x1760c0[_0x6f96('0x62')][_0x6f96('0x62')])||_0x1760c0[_0x6f96('0x62')][_0x6f96('0x62')]===''){throw new db[(_0x6f96('0x7f'))][(_0x6f96('0x77'))](_0x6f96('0x81'));}if(_['isNil'](_0x1760c0['body']['to'])){}_0x41eefe=_0x1760c0[_0x6f96('0x62')]['to'];return db[_0x6f96('0x44')][_0x6f96('0x70')]({'where':{'id':_0x1760c0['params']['id']}})[_0x6f96('0x24')](handleEntityNotFound(_0x25d57b,null))['then'](function(_0x28554e){if(_0x28554e){return db[_0x6f96('0x44')][_0x6f96('0x5e')]({'where':{'id':_0x28554e['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6f96('0x76')],'as':_0x6f96('0x88'),'where':{[_0x28554e[_0x6f96('0x84')]]:_0x41eefe},'limit':0x1,'order':[[_0x6f96('0x7b'),_0x6f96('0xc6')]]}]}]})[_0x6f96('0x24')](handleEntityNotFound(_0x25d57b,null))[_0x6f96('0x24')](function(_0x2d3ee7){if(_0x2d3ee7&&_0x2d3ee7['List']){_0xd0b0ff=_0x2d3ee7[_0x6f96('0x5d')]({'plain':!![]});if(_0xd0b0ff['List']&&_0xd0b0ff[_0x6f96('0x87')][_0x6f96('0x88')][_0x6f96('0x68')]){return _0xd0b0ff[_0x6f96('0x87')][_0x6f96('0x88')][0x0];}return db['CmContact']['create'](_[_0x6f96('0x1b')](_0x1760c0[_0x6f96('0x62')],{'firstName':_0x41eefe,[_0x2d3ee7['mapKey']]:_0x41eefe,'phone':_0x41eefe,'ListId':_0xd0b0ff[_0x6f96('0x91')]}));}})[_0x6f96('0x24')](handleEntityNotFound(_0x25d57b,null))[_0x6f96('0x24')](function(_0x41e40f){if(_0x41e40f){_0x52f192=_0x41e40f;return db[_0x6f96('0x95')][_0x6f96('0x5e')]({'where':{'ContactId':_0x52f192['id'],'closed':![],'OpenchannelAccountId':_0xd0b0ff['id']}})[_0x6f96('0x24')](function(_0x3f1bef){if(_0x3f1bef){return[_0x3f1bef,![]];}return db[_0x6f96('0x95')][_0x6f96('0x5b')]({'UserId':_0x1760c0[_0x6f96('0xc7')]['id'],'ContactId':_0x52f192['id'],'OpenchannelAccountId':_0xd0b0ff['id'],'lastMsgDirection':_0x6f96('0xc8'),'firstMsgDirection':'out','Messages':[_[_0x6f96('0x54')](_0x1760c0[_0x6f96('0x62')],{'read':![],'body':_0x1760c0[_0x6f96('0x62')]['body'],'OpenchannelAccountId':_0xd0b0ff['id'],'UserId':_0x1760c0['user']['id'],'ContactId':_0x52f192['id']})]},{'include':[{'model':db[_0x6f96('0x9e')],'as':_0x6f96('0xc9')}]})[_0x6f96('0x24')](function(_0x502909){return[_0x502909,!![]];});});}})[_0x6f96('0x98')](function(_0x14ebdb,_0x2c4b61){if(_0x2c4b61){return _0x14ebdb;}return db[_0x6f96('0x9e')][_0x6f96('0x5b')](_[_0x6f96('0x54')](_0x1760c0['body'],{'read':![],'body':_0x1760c0[_0x6f96('0x62')][_0x6f96('0x62')],'OpenchannelAccountId':_0xd0b0ff['id'],'OpenchannelInteractionId':_0x14ebdb['id'],'UserId':_0x1760c0['user']['id'],'ContactId':_0x52f192['id']}))['then'](function(_0x143d3b){_0x14ebdb[_0x6f96('0xca')][_0x6f96('0xc9')]=[];_0x14ebdb[_0x6f96('0xca')][_0x6f96('0xc9')][_0x6f96('0x9c')](_0x143d3b[_0x6f96('0xca')]);return _0x14ebdb;});});}})[_0x6f96('0x24')](respondWithResult(_0x25d57b,null))[_0x6f96('0x2d')](handleError(_0x25d57b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 04d582d..668d954 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 _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x1390a0,_0x499668){var _0x359f67=function(_0x3daff4){while(--_0x3daff4){_0x1390a0['push'](_0x1390a0['shift']());}};_0x359f67(++_0x499668);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xb4e6[_0x9d1e6b];return _0x2b3070;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0xadd709,_0x52be4a){var _0x2569af=function(_0x27658a){while(--_0x27658a){_0xadd709['push'](_0xadd709['shift']());}};_0x2569af(++_0x52be4a);}(_0x41bb,0xc5));var _0xb41b=function(_0x2e2dab,_0x5a85fe){_0x2e2dab=_0x2e2dab-0x0;var _0x1fbbd7=_0x41bb[_0x2e2dab];return _0x1fbbd7;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var OpenchannelAccount=require(_0xb41b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](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 62d7174..95f0cab 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x53dc12,_0x4884b6){var _0x1b2f64=function(_0x208e19){while(--_0x208e19){_0x53dc12['push'](_0x53dc12['shift']());}};_0x1b2f64(++_0x4884b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x181e3a,_0x2362bc){var _0x5dbbbd=function(_0x11d7b8){while(--_0x11d7b8){_0x181e3a['push'](_0x181e3a['shift']());}};_0x5dbbbd(++_0x2362bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index a56c6ad..331f773 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 _0x705f=['jayson/promise','client','http','redis','localhost','./openchannelAccount.socket','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a0fa7,_0x4a00f9){var _0x992bee=function(_0x3dbb1d){while(--_0x3dbb1d){_0x3a0fa7['push'](_0x3a0fa7['shift']());}};_0x992bee(++_0x4a00f9);}(_0x705f,0x75));var _0xf705=function(_0x820d7b,_0xa5564c){_0x820d7b=_0x820d7b-0x0;var _0x249af0=_0x705f[_0x820d7b];return _0x249af0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});config[_0xf705('0xb')]=_['defaults'](config['redis'],{'host':_0xf705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf705('0xb')]));require(_0xf705('0xd'))['register'](socket);function respondWithRpcPromise(_0x4bd6fd,_0x1f9ab1,_0xc6fbde){return new BPromise(function(_0xfe67fe,_0x45316b){return client[_0xf705('0xe')](_0x4bd6fd,_0xc6fbde)[_0xf705('0xf')](function(_0x13db14){logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));logger[_0xf705('0x12')](_0xf705('0x13'),_0x1f9ab1,_0xf705('0x11'),JSON[_0xf705('0x14')](_0x13db14));if(_0x13db14['error']){if(_0x13db14['error'][_0xf705('0x15')]===0x1f4){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14[_0xf705('0x16')]['message']);return _0x45316b(_0x13db14[_0xf705('0x16')][_0xf705('0x18')]);}logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x13db14['error'][_0xf705('0x18')]);return _0xfe67fe(_0x13db14['error'][_0xf705('0x18')]);}else{logger[_0xf705('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f9ab1,_0xf705('0x11'));_0xfe67fe(_0x13db14['result'][_0xf705('0x18')]);}})['catch'](function(_0x57d537){logger[_0xf705('0x16')](_0xf705('0x17'),_0x1f9ab1,_0x57d537);_0x45316b(_0x57d537);});});} \ No newline at end of file +var _0x00b3=['OpenchannelAccount,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x00b3,0x17a));var _0x300b=function(_0x17a32a,_0x335e15){_0x17a32a=_0x17a32a-0x0;var _0x426958=_0x00b3[_0x17a32a];return _0x426958;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x300b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x300b('0xa')]));require(_0x300b('0xb'))[_0x300b('0xc')](socket);function respondWithRpcPromise(_0x4d8d78,_0x42e5a5,_0x3d907e){return new BPromise(function(_0x243abf,_0x212b2b){return client['request'](_0x4d8d78,_0x3d907e)[_0x300b('0xd')](function(_0x2eeb2d){logger[_0x300b('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x300b('0xf'));logger[_0x300b('0x10')](_0x300b('0x11'),_0x42e5a5,_0x300b('0xf'),JSON[_0x300b('0x12')](_0x2eeb2d));if(_0x2eeb2d[_0x300b('0x13')]){if(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x2eeb2d['error']['message']);return _0x212b2b(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x2eeb2d['error']['message']);return _0x243abf(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}else{logger[_0x300b('0xe')](_0x300b('0x16'),_0x42e5a5,'request\x20sent');_0x243abf(_0x2eeb2d[_0x300b('0x17')][_0x300b('0x15')]);}})[_0x300b('0x18')](function(_0x5cba7c){logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x5cba7c);_0x212b2b(_0x5cba7c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6ae9198..009106d 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 _0x1542=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x41b1a1,_0x1efb9f){var _0x59342a=function(_0x114f91){while(--_0x114f91){_0x41b1a1['push'](_0x41b1a1['shift']());}};_0x59342a(++_0x1efb9f);}(_0x1542,0x116));var _0x2154=function(_0x19c4e5,_0x6c0736){_0x19c4e5=_0x19c4e5-0x0;var _0x2ddc52=_0x1542[_0x19c4e5];return _0x2ddc52;};'use strict';var OpenchannelAccountEvents=require(_0x2154('0x0'));var events=[_0x2154('0x1'),_0x2154('0x2'),_0x2154('0x3')];function createListener(_0x229bed,_0x4faf69){return function(_0x42644b){_0x4faf69[_0x2154('0x4')](_0x229bed,_0x42644b);};}function removeListener(_0x13e41b,_0x4ded8a){return function(){OpenchannelAccountEvents[_0x2154('0x5')](_0x13e41b,_0x4ded8a);};}exports[_0x2154('0x6')]=function(_0x5406f9){for(var _0x13d9c2=0x0,_0x23abb5=events[_0x2154('0x7')];_0x13d9c2<_0x23abb5;_0x13d9c2++){var _0x791345=events[_0x13d9c2];var _0x2e6295=createListener(_0x2154('0x8')+_0x791345,_0x5406f9);OpenchannelAccountEvents['on'](_0x791345,_0x2e6295);}}; \ No newline at end of file +var _0xf2a6=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x17fa4f,_0x49718d){_0x17fa4f=_0x17fa4f-0x0;var _0x5d46e6=_0xf2a6[_0x17fa4f];return _0x5d46e6;};'use strict';var OpenchannelAccountEvents=require(_0x6f2a('0x0'));var events=['save','remove','update'];function createListener(_0x1b32c0,_0x5b2cbc){return function(_0x3b14e2){_0x5b2cbc[_0x6f2a('0x1')](_0x1b32c0,_0x3b14e2);};}function removeListener(_0x454ff7,_0x32ddb6){return function(){OpenchannelAccountEvents[_0x6f2a('0x2')](_0x454ff7,_0x32ddb6);};}exports[_0x6f2a('0x3')]=function(_0x4684f4){for(var _0x19ebe9=0x0,_0x1efd8=events[_0x6f2a('0x4')];_0x19ebe9<_0x1efd8;_0x19ebe9++){var _0x4b4fde=events[_0x19ebe9];var _0x379b80=createListener(_0x6f2a('0x5')+_0x4b4fde,_0x4684f4);OpenchannelAccountEvents['on'](_0x4b4fde,_0x379b80);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8e4bf04..04a1465 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 _0xd25d=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x442939,_0xe783a){var _0x45dd63=function(_0x5578ed){while(--_0x5578ed){_0x442939['push'](_0x442939['shift']());}};_0x45dd63(++_0xe783a);}(_0xd25d,0x79));var _0xdd25=function(_0x51687f,_0x35c457){_0x51687f=_0x51687f-0x0;var _0x5bb285=_0xd25d[_0x51687f];return _0x5bb285;};'use strict';var multer=require(_0xdd25('0x0'));var util=require('util');var path=require(_0xdd25('0x1'));var timeout=require(_0xdd25('0x2'));var express=require(_0xdd25('0x3'));var router=express[_0xdd25('0x4')]();var fs_extra=require(_0xdd25('0x5'));var auth=require(_0xdd25('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xdd25('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd25('0x8')]);router[_0xdd25('0x7')](_0xdd25('0x9'),auth[_0xdd25('0xa')](),controller[_0xdd25('0xb')]);router[_0xdd25('0xc')]('/',auth['isAuthenticated'](),controller[_0xdd25('0xd')]);router['put'](_0xdd25('0x9'),auth['isAuthenticated'](),controller[_0xdd25('0xe')]);router[_0xdd25('0xf')]('/:id',auth[_0xdd25('0xa')](),controller[_0xdd25('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5c1d=['put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','get','/:id','show','post','create'];(function(_0x10ce3b,_0x4d3b36){var _0x58ce08=function(_0x35d9c7){while(--_0x35d9c7){_0x10ce3b['push'](_0x10ce3b['shift']());}};_0x58ce08(++_0x4d3b36);}(_0x5c1d,0x113));var _0xd5c1=function(_0x51f20e,_0x1976b1){_0x51f20e=_0x51f20e-0x0;var _0x299ea7=_0x5c1d[_0x51f20e];return _0x299ea7;};'use strict';var multer=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var path=require('path');var timeout=require(_0xd5c1('0x2'));var express=require(_0xd5c1('0x3'));var router=express[_0xd5c1('0x4')]();var fs_extra=require(_0xd5c1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd5c1('0x6'));var config=require('../../config/environment');var controller=require(_0xd5c1('0x7'));router['get']('/',auth[_0xd5c1('0x8')](),controller['index']);router[_0xd5c1('0x9')](_0xd5c1('0xa'),auth['isAuthenticated'](),controller[_0xd5c1('0xb')]);router[_0xd5c1('0xc')]('/',auth[_0xd5c1('0x8')](),controller[_0xd5c1('0xd')]);router[_0xd5c1('0xe')](_0xd5c1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd5c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd5c1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f3823fa..a330df5 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 _0x0ed7=['TEXT','*,*,*,*','sequelize','noop'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ed7,0x1ea));var _0x70ed=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0x0ed7[_0x385467];return _0x5ed67e;};'use strict';var Sequelize=require(_0x70ed('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x70ed('0x1')},'appdata':{'type':Sequelize[_0x70ed('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x70ed('0x3')}}; \ No newline at end of file +var _0x6b9b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x1a478a,_0x5d5ccd){var _0x2733ae=function(_0x2093c3){while(--_0x2093c3){_0x1a478a['push'](_0x1a478a['shift']());}};_0x2733ae(++_0x5d5ccd);}(_0x6b9b,0x80));var _0xb6b9=function(_0x50c724,_0x1b8917){_0x50c724=_0x50c724-0x0;var _0x372719=_0x6b9b[_0x50c724];return _0x372719;};'use strict';var Sequelize=require(_0xb6b9('0x0'));module[_0xb6b9('0x1')]={'priority':{'type':Sequelize[_0xb6b9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6b9('0x3')},'appdata':{'type':Sequelize[_0xb6b9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb6b9('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 298fd2d..bf82e2f 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 _0xf7d1=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','OpenchannelApplication','then','includeAll','include','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5685e7,_0x2d5cbb){var _0x315011=function(_0x367a8c){while(--_0x367a8c){_0x5685e7['push'](_0x5685e7['shift']());}};_0x315011(++_0x2d5cbb);}(_0xf7d1,0x1a8));var _0x1f7d=function(_0x349542,_0x2ba7e5){_0x349542=_0x349542-0x0;var _0x479110=_0xf7d1[_0x349542];return _0x479110;};'use strict';var emlformat=require(_0x1f7d('0x0'));var rimraf=require(_0x1f7d('0x1'));var zipdir=require(_0x1f7d('0x2'));var jsonpatch=require(_0x1f7d('0x3'));var rp=require(_0x1f7d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f7d('0x5'));var util=require(_0x1f7d('0x6'));var path=require(_0x1f7d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f7d('0x8'));var _=require(_0x1f7d('0x9'));var squel=require(_0x1f7d('0xa'));var crypto=require(_0x1f7d('0xb'));var jsforce=require(_0x1f7d('0xc'));var deskjs=require(_0x1f7d('0xd'));var toCsv=require(_0x1f7d('0xe'));var querystring=require('querystring');var Papa=require(_0x1f7d('0xf'));var Redis=require(_0x1f7d('0x10'));var authService=require(_0x1f7d('0x11'));var qs=require(_0x1f7d('0x12'));var as=require(_0x1f7d('0x13'));var hardwareService=require(_0x1f7d('0x14'));var logger=require(_0x1f7d('0x15'))(_0x1f7d('0x16'));var utils=require(_0x1f7d('0x17'));var config=require(_0x1f7d('0x18'));var licenseUtil=require(_0x1f7d('0x19'));var db=require(_0x1f7d('0x1a'))['db'];function respondWithStatusCode(_0x414831,_0x2652da){_0x2652da=_0x2652da||0xcc;return function(_0x8df899){if(_0x8df899){return _0x414831[_0x1f7d('0x1b')](_0x2652da);}return _0x414831[_0x1f7d('0x1c')](_0x2652da)[_0x1f7d('0x1d')]();};}function respondWithResult(_0x4dc4a2,_0x5196c){_0x5196c=_0x5196c||0xc8;return function(_0x48eff8){if(_0x48eff8){return _0x4dc4a2[_0x1f7d('0x1c')](_0x5196c)[_0x1f7d('0x1e')](_0x48eff8);}};}function respondWithFilteredResult(_0x568f62,_0x2248f8){return function(_0x5c60a1){if(_0x5c60a1){var _0x1264af=typeof _0x2248f8[_0x1f7d('0x1f')]==='undefined'&&typeof _0x2248f8[_0x1f7d('0x20')]===_0x1f7d('0x21');var _0x5f4baf=_0x5c60a1[_0x1f7d('0x22')];var _0x180ecd=_0x1264af?0x0:_0x2248f8[_0x1f7d('0x1f')];var _0x1aa8ca=_0x1264af?_0x5c60a1['count']:_0x2248f8['offset']+_0x2248f8['limit'];var _0x3061c0;if(_0x1aa8ca>=_0x5f4baf){_0x1aa8ca=_0x5f4baf;_0x3061c0=0xc8;}else{_0x3061c0=0xce;}_0x568f62['status'](_0x3061c0);return _0x568f62['set'](_0x1f7d('0x23'),_0x180ecd+'-'+_0x1aa8ca+'/'+_0x5f4baf)['json'](_0x5c60a1);}return null;};}function patchUpdates(_0x2ad67e){return function(_0x4265fe){try{jsonpatch[_0x1f7d('0x24')](_0x4265fe,_0x2ad67e,!![]);}catch(_0x4d8d4b){return BPromise['reject'](_0x4d8d4b);}return _0x4265fe[_0x1f7d('0x25')]();};}function saveUpdates(_0xa4dcf0,_0x51d579){return function(_0x39f5b0){if(_0x39f5b0){return _0x39f5b0[_0x1f7d('0x26')](_0xa4dcf0)['then'](function(_0x42854d){return _0x42854d;});}return null;};}function removeEntity(_0x1c5c71,_0x14ece7){return function(_0x4b5d83){if(_0x4b5d83){return _0x4b5d83[_0x1f7d('0x27')]()['then'](function(){_0x1c5c71[_0x1f7d('0x1c')](0xcc)[_0x1f7d('0x1d')]();});}};}function handleEntityNotFound(_0x57a02b,_0xb26346){return function(_0x58e767){if(!_0x58e767){_0x57a02b[_0x1f7d('0x1b')](0x194);}return _0x58e767;};}function handleError(_0x3ca6ac,_0x373afe){_0x373afe=_0x373afe||0x1f4;return function(_0x2b13d3){logger['error'](_0x2b13d3[_0x1f7d('0x28')]);if(_0x2b13d3['name']){delete _0x2b13d3[_0x1f7d('0x29')];}_0x3ca6ac[_0x1f7d('0x1c')](_0x373afe)[_0x1f7d('0x2a')](_0x2b13d3);};}exports[_0x1f7d('0x2b')]=function(_0x1f41ec,_0x1167c3){var _0x101e10={},_0x16d23e={},_0x524bc4={'count':0x0,'rows':[]};var _0x14e068=_[_0x1f7d('0x2c')](db['OpenchannelApplication']['rawAttributes'],function(_0x565ff2){return{'name':_0x565ff2[_0x1f7d('0x2d')],'type':_0x565ff2['type']['key']};});_0x16d23e[_0x1f7d('0x2e')]=_[_0x1f7d('0x2c')](_0x14e068,_0x1f7d('0x29'));_0x16d23e[_0x1f7d('0x2f')]=_[_0x1f7d('0x30')](_0x1f41ec['query']);_0x16d23e[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x16d23e['model'],_0x16d23e[_0x1f7d('0x2f')]);_0x101e10[_0x1f7d('0x33')]=_[_0x1f7d('0x32')](_0x16d23e['model'],qs[_0x1f7d('0x34')](_0x1f41ec['query'][_0x1f7d('0x34')]));_0x101e10[_0x1f7d('0x33')]=_0x101e10[_0x1f7d('0x33')][_0x1f7d('0x35')]?_0x101e10[_0x1f7d('0x33')]:_0x16d23e[_0x1f7d('0x2e')];if(!_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x36')](_0x1f7d('0x37'))){_0x101e10[_0x1f7d('0x20')]=qs[_0x1f7d('0x20')](_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x20')]);_0x101e10[_0x1f7d('0x1f')]=qs[_0x1f7d('0x1f')](_0x1f41ec[_0x1f7d('0x2f')]['offset']);}_0x101e10[_0x1f7d('0x38')]=qs['sort'](_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x39')]);_0x101e10[_0x1f7d('0x3a')]=qs[_0x1f7d('0x31')](_[_0x1f7d('0x3b')](_0x1f41ec[_0x1f7d('0x2f')],_0x16d23e[_0x1f7d('0x31')]),_0x14e068);if(_0x1f41ec[_0x1f7d('0x2f')]['filter']){_0x101e10[_0x1f7d('0x3a')]=_[_0x1f7d('0x3c')](_0x101e10[_0x1f7d('0x3a')],{'$or':_[_0x1f7d('0x2c')](_0x14e068,function(_0x1906e2){if(_0x1906e2['type']!=='VIRTUAL'){var _0x2cf55a={};_0x2cf55a[_0x1906e2[_0x1f7d('0x29')]]={'$like':'%'+_0x1f41ec[_0x1f7d('0x2f')][_0x1f7d('0x3d')]+'%'};return _0x2cf55a;}})});}_0x101e10=_[_0x1f7d('0x3c')]({},_0x101e10,_0x1f41ec[_0x1f7d('0x3e')]);var _0x109926={'where':_0x101e10[_0x1f7d('0x3a')]};return db[_0x1f7d('0x3f')][_0x1f7d('0x22')](_0x109926)[_0x1f7d('0x40')](function(_0x120f2f){_0x524bc4['count']=_0x120f2f;if(_0x1f41ec['query'][_0x1f7d('0x41')]){_0x101e10[_0x1f7d('0x42')]=[{'all':!![]}];}return db[_0x1f7d('0x3f')]['findAll'](_0x101e10);})[_0x1f7d('0x40')](function(_0x2078ee){_0x524bc4['rows']=_0x2078ee;return _0x524bc4;})[_0x1f7d('0x40')](respondWithFilteredResult(_0x1167c3,_0x101e10))[_0x1f7d('0x43')](handleError(_0x1167c3,null));};exports[_0x1f7d('0x44')]=function(_0x4e2b31,_0x4ad387){var _0x1523f9={'raw':!![],'where':{'id':_0x4e2b31[_0x1f7d('0x45')]['id']}},_0x1930e4={};_0x1930e4[_0x1f7d('0x2e')]=_[_0x1f7d('0x30')](db[_0x1f7d('0x3f')][_0x1f7d('0x46')]);_0x1930e4[_0x1f7d('0x2f')]=_[_0x1f7d('0x30')](_0x4e2b31[_0x1f7d('0x2f')]);_0x1930e4[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x1930e4[_0x1f7d('0x2e')],_0x1930e4[_0x1f7d('0x2f')]);_0x1523f9['attributes']=_[_0x1f7d('0x32')](_0x1930e4[_0x1f7d('0x2e')],qs['fields'](_0x4e2b31[_0x1f7d('0x2f')]['fields']));_0x1523f9['attributes']=_0x1523f9[_0x1f7d('0x33')][_0x1f7d('0x35')]?_0x1523f9[_0x1f7d('0x33')]:_0x1930e4[_0x1f7d('0x2e')];if(_0x4e2b31['query'][_0x1f7d('0x41')]){_0x1523f9[_0x1f7d('0x42')]=[{'all':!![]}];}_0x1523f9=_[_0x1f7d('0x3c')]({},_0x1523f9,_0x4e2b31[_0x1f7d('0x3e')]);return db['OpenchannelApplication'][_0x1f7d('0x47')](_0x1523f9)['then'](handleEntityNotFound(_0x4ad387,null))[_0x1f7d('0x40')](respondWithResult(_0x4ad387,null))['catch'](handleError(_0x4ad387,null));};exports['create']=function(_0x58e4ff,_0x38252f){return db[_0x1f7d('0x3f')][_0x1f7d('0x48')](_0x58e4ff[_0x1f7d('0x49')],{})[_0x1f7d('0x40')](respondWithResult(_0x38252f,0xc9))[_0x1f7d('0x43')](handleError(_0x38252f,null));};exports[_0x1f7d('0x26')]=function(_0x508933,_0x3b4630){if(_0x508933[_0x1f7d('0x49')]['id']){delete _0x508933[_0x1f7d('0x49')]['id'];}return db[_0x1f7d('0x3f')]['find']({'where':{'id':_0x508933[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x40')](handleEntityNotFound(_0x3b4630,null))[_0x1f7d('0x40')](saveUpdates(_0x508933[_0x1f7d('0x49')],null))[_0x1f7d('0x40')](respondWithResult(_0x3b4630,null))[_0x1f7d('0x43')](handleError(_0x3b4630,null));};exports[_0x1f7d('0x27')]=function(_0x3cf92d,_0x5be70d){return db['OpenchannelApplication'][_0x1f7d('0x47')]({'where':{'id':_0x3cf92d['params']['id']}})[_0x1f7d('0x40')](handleEntityNotFound(_0x5be70d,null))['then'](removeEntity(_0x5be70d,null))['catch'](handleError(_0x5be70d,null));}; \ No newline at end of file +var _0x10ab=['attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','create','find','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','key','model','query','keys','filters','intersection','fields'];(function(_0x54460b,_0x2ea1b6){var _0x4c82ba=function(_0x9c397){while(--_0x9c397){_0x54460b['push'](_0x54460b['shift']());}};_0x4c82ba(++_0x2ea1b6);}(_0x10ab,0x17d));var _0xb10a=function(_0x2bdf04,_0x5e608e){_0x2bdf04=_0x2bdf04-0x0;var _0x33ce04=_0x10ab[_0x2bdf04];return _0x33ce04;};'use strict';var emlformat=require(_0xb10a('0x0'));var rimraf=require(_0xb10a('0x1'));var zipdir=require(_0xb10a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb10a('0x3'));var moment=require(_0xb10a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb10a('0x5'));var util=require(_0xb10a('0x6'));var path=require('path');var sox=require(_0xb10a('0x7'));var csv=require(_0xb10a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb10a('0x9'));var squel=require(_0xb10a('0xa'));var crypto=require(_0xb10a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb10a('0xc'));var toCsv=require(_0xb10a('0x8'));var querystring=require(_0xb10a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb10a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb10a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb10a('0x10'))(_0xb10a('0x11'));var utils=require('../../config/utils');var config=require(_0xb10a('0x12'));var licenseUtil=require(_0xb10a('0x13'));var db=require(_0xb10a('0x14'))['db'];function respondWithStatusCode(_0x4ce62d,_0x4f0da1){_0x4f0da1=_0x4f0da1||0xcc;return function(_0x100894){if(_0x100894){return _0x4ce62d[_0xb10a('0x15')](_0x4f0da1);}return _0x4ce62d[_0xb10a('0x16')](_0x4f0da1)[_0xb10a('0x17')]();};}function respondWithResult(_0x57f23d,_0x12d5d5){_0x12d5d5=_0x12d5d5||0xc8;return function(_0x1fd46c){if(_0x1fd46c){return _0x57f23d[_0xb10a('0x16')](_0x12d5d5)[_0xb10a('0x18')](_0x1fd46c);}};}function respondWithFilteredResult(_0x1338f2,_0x38f410){return function(_0x5b72b4){if(_0x5b72b4){var _0x18afda=typeof _0x38f410[_0xb10a('0x19')]===_0xb10a('0x1a')&&typeof _0x38f410['limit']==='undefined';var _0x134c98=_0x5b72b4[_0xb10a('0x1b')];var _0x5a4b6e=_0x18afda?0x0:_0x38f410[_0xb10a('0x19')];var _0x507c7f=_0x18afda?_0x5b72b4[_0xb10a('0x1b')]:_0x38f410['offset']+_0x38f410[_0xb10a('0x1c')];var _0x143b37;if(_0x507c7f>=_0x134c98){_0x507c7f=_0x134c98;_0x143b37=0xc8;}else{_0x143b37=0xce;}_0x1338f2[_0xb10a('0x16')](_0x143b37);return _0x1338f2[_0xb10a('0x1d')](_0xb10a('0x1e'),_0x5a4b6e+'-'+_0x507c7f+'/'+_0x134c98)[_0xb10a('0x18')](_0x5b72b4);}return null;};}function patchUpdates(_0x2a4a8f){return function(_0x41cc28){try{jsonpatch[_0xb10a('0x1f')](_0x41cc28,_0x2a4a8f,!![]);}catch(_0x4e40ba){return BPromise[_0xb10a('0x20')](_0x4e40ba);}return _0x41cc28[_0xb10a('0x21')]();};}function saveUpdates(_0x193100,_0x29e157){return function(_0x484f04){if(_0x484f04){return _0x484f04['update'](_0x193100)[_0xb10a('0x22')](function(_0x3b1733){return _0x3b1733;});}return null;};}function removeEntity(_0xe6021a,_0x5e43bc){return function(_0x10c136){if(_0x10c136){return _0x10c136[_0xb10a('0x23')]()[_0xb10a('0x22')](function(){_0xe6021a[_0xb10a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cb2e,_0x315a63){return function(_0xc70d6e){if(!_0xc70d6e){_0x46cb2e['sendStatus'](0x194);}return _0xc70d6e;};}function handleError(_0x5d4869,_0x43826b){_0x43826b=_0x43826b||0x1f4;return function(_0x2a5b11){logger[_0xb10a('0x24')](_0x2a5b11[_0xb10a('0x25')]);if(_0x2a5b11[_0xb10a('0x26')]){delete _0x2a5b11[_0xb10a('0x26')];}_0x5d4869[_0xb10a('0x16')](_0x43826b)[_0xb10a('0x27')](_0x2a5b11);};}exports[_0xb10a('0x28')]=function(_0x4ef89b,_0x29eeea){var _0x544e61={},_0x247910={},_0x132e81={'count':0x0,'rows':[]};var _0x274a70=_[_0xb10a('0x29')](db[_0xb10a('0x2a')]['rawAttributes'],function(_0x3bd963){return{'name':_0x3bd963[_0xb10a('0x2b')],'type':_0x3bd963['type'][_0xb10a('0x2c')]};});_0x247910[_0xb10a('0x2d')]=_[_0xb10a('0x29')](_0x274a70,'name');_0x247910[_0xb10a('0x2e')]=_[_0xb10a('0x2f')](_0x4ef89b[_0xb10a('0x2e')]);_0x247910[_0xb10a('0x30')]=_[_0xb10a('0x31')](_0x247910[_0xb10a('0x2d')],_0x247910[_0xb10a('0x2e')]);_0x544e61['attributes']=_['intersection'](_0x247910[_0xb10a('0x2d')],qs[_0xb10a('0x32')](_0x4ef89b['query'][_0xb10a('0x32')]));_0x544e61[_0xb10a('0x33')]=_0x544e61['attributes'][_0xb10a('0x34')]?_0x544e61['attributes']:_0x247910['model'];if(!_0x4ef89b['query']['hasOwnProperty'](_0xb10a('0x35'))){_0x544e61[_0xb10a('0x1c')]=qs[_0xb10a('0x1c')](_0x4ef89b['query'][_0xb10a('0x1c')]);_0x544e61[_0xb10a('0x19')]=qs['offset'](_0x4ef89b['query'][_0xb10a('0x19')]);}_0x544e61[_0xb10a('0x36')]=qs['sort'](_0x4ef89b[_0xb10a('0x2e')][_0xb10a('0x37')]);_0x544e61[_0xb10a('0x38')]=qs['filters'](_[_0xb10a('0x39')](_0x4ef89b[_0xb10a('0x2e')],_0x247910[_0xb10a('0x30')]),_0x274a70);if(_0x4ef89b[_0xb10a('0x2e')]['filter']){_0x544e61[_0xb10a('0x38')]=_[_0xb10a('0x3a')](_0x544e61[_0xb10a('0x38')],{'$or':_['map'](_0x274a70,function(_0x44ba11){if(_0x44ba11['type']!==_0xb10a('0x3b')){var _0x30a67d={};_0x30a67d[_0x44ba11['name']]={'$like':'%'+_0x4ef89b[_0xb10a('0x2e')][_0xb10a('0x3c')]+'%'};return _0x30a67d;}})});}_0x544e61=_[_0xb10a('0x3a')]({},_0x544e61,_0x4ef89b[_0xb10a('0x3d')]);var _0xee454b={'where':_0x544e61[_0xb10a('0x38')]};return db[_0xb10a('0x2a')]['count'](_0xee454b)[_0xb10a('0x22')](function(_0x2077f7){_0x132e81[_0xb10a('0x1b')]=_0x2077f7;if(_0x4ef89b[_0xb10a('0x2e')][_0xb10a('0x3e')]){_0x544e61[_0xb10a('0x3f')]=[{'all':!![]}];}return db[_0xb10a('0x2a')]['findAll'](_0x544e61);})[_0xb10a('0x22')](function(_0x274479){_0x132e81[_0xb10a('0x40')]=_0x274479;return _0x132e81;})['then'](respondWithFilteredResult(_0x29eeea,_0x544e61))[_0xb10a('0x41')](handleError(_0x29eeea,null));};exports[_0xb10a('0x42')]=function(_0x52a64a,_0x3fceca){var _0x4c0b36={'raw':!![],'where':{'id':_0x52a64a[_0xb10a('0x43')]['id']}},_0x445ce3={};_0x445ce3[_0xb10a('0x2d')]=_[_0xb10a('0x2f')](db['OpenchannelApplication'][_0xb10a('0x44')]);_0x445ce3[_0xb10a('0x2e')]=_[_0xb10a('0x2f')](_0x52a64a[_0xb10a('0x2e')]);_0x445ce3[_0xb10a('0x30')]=_[_0xb10a('0x31')](_0x445ce3[_0xb10a('0x2d')],_0x445ce3[_0xb10a('0x2e')]);_0x4c0b36[_0xb10a('0x33')]=_[_0xb10a('0x31')](_0x445ce3[_0xb10a('0x2d')],qs[_0xb10a('0x32')](_0x52a64a[_0xb10a('0x2e')][_0xb10a('0x32')]));_0x4c0b36[_0xb10a('0x33')]=_0x4c0b36[_0xb10a('0x33')][_0xb10a('0x34')]?_0x4c0b36[_0xb10a('0x33')]:_0x445ce3[_0xb10a('0x2d')];if(_0x52a64a[_0xb10a('0x2e')]['includeAll']){_0x4c0b36[_0xb10a('0x3f')]=[{'all':!![]}];}_0x4c0b36=_[_0xb10a('0x3a')]({},_0x4c0b36,_0x52a64a[_0xb10a('0x3d')]);return db[_0xb10a('0x2a')]['find'](_0x4c0b36)[_0xb10a('0x22')](handleEntityNotFound(_0x3fceca,null))[_0xb10a('0x22')](respondWithResult(_0x3fceca,null))[_0xb10a('0x41')](handleError(_0x3fceca,null));};exports[_0xb10a('0x45')]=function(_0x5a5252,_0x4b7988){return db[_0xb10a('0x2a')][_0xb10a('0x45')](_0x5a5252['body'],{})[_0xb10a('0x22')](respondWithResult(_0x4b7988,0xc9))[_0xb10a('0x41')](handleError(_0x4b7988,null));};exports['update']=function(_0x2f00e1,_0x2aea51){if(_0x2f00e1['body']['id']){delete _0x2f00e1['body']['id'];}return db[_0xb10a('0x2a')][_0xb10a('0x46')]({'where':{'id':_0x2f00e1['params']['id']}})[_0xb10a('0x22')](handleEntityNotFound(_0x2aea51,null))[_0xb10a('0x22')](saveUpdates(_0x2f00e1[_0xb10a('0x47')],null))[_0xb10a('0x22')](respondWithResult(_0x2aea51,null))[_0xb10a('0x41')](handleError(_0x2aea51,null));};exports['destroy']=function(_0xaec8a4,_0x460fc7){return db[_0xb10a('0x2a')]['find']({'where':{'id':_0xaec8a4['params']['id']}})[_0xb10a('0x22')](handleEntityNotFound(_0x460fc7,null))[_0xb10a('0x22')](removeEntity(_0x460fc7,null))[_0xb10a('0x41')](handleError(_0x460fc7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 29094e8..26d5bf6 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 _0x6383=['exports','define','openchannel_applications','utf8mb4','lodash','util','api','moment','bluebird','path','./openchannelApplication.attributes'];(function(_0x56585b,_0x2f45cd){var _0xe7002f=function(_0x57b451){while(--_0x57b451){_0x56585b['push'](_0x56585b['shift']());}};_0xe7002f(++_0x2f45cd);}(_0x6383,0x117));var _0x3638=function(_0x2e7b74,_0x313472){_0x2e7b74=_0x2e7b74-0x0;var _0x54a082=_0x6383[_0x2e7b74];return _0x54a082;};'use strict';var _=require(_0x3638('0x0'));var util=require(_0x3638('0x1'));var logger=require('../../config/logger')(_0x3638('0x2'));var moment=require(_0x3638('0x3'));var BPromise=require(_0x3638('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3638('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3638('0x6'));module[_0x3638('0x7')]=function(_0x4e9c33,_0x3b7eaa){return _0x4e9c33[_0x3638('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x3638('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3638('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x091c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x091c,0xd3));var _0xc091=function(_0x244682,_0x4b174e){_0x244682=_0x244682-0x0;var _0x41dfc3=_0x091c[_0x244682];return _0x41dfc3;};'use strict';var _=require(_0xc091('0x0'));var util=require(_0xc091('0x1'));var logger=require(_0xc091('0x2'))(_0xc091('0x3'));var moment=require('moment');var BPromise=require(_0xc091('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc091('0x5'));var rimraf=require(_0xc091('0x6'));var config=require(_0xc091('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0xc091('0x8')]=function(_0x1c03e5,_0x2990c8){return _0x1c03e5[_0xc091('0x9')](_0xc091('0xa'),attributes,{'tableName':_0xc091('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc091('0xc'),'collate':_0xc091('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 33eb7d5..3f74719 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 _0x286a=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','attributes'];(function(_0x3aa931,_0x845306){var _0x48214e=function(_0x3f6e1b){while(--_0x3f6e1b){_0x3aa931['push'](_0x3aa931['shift']());}};_0x48214e(++_0x845306);}(_0x286a,0xe9));var _0xa286=function(_0x14e861,_0xb0836e){_0x14e861=_0x14e861-0x0;var _0x20e408=_0x286a[_0x14e861];return _0x20e408;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var moment=require(_0xa286('0x2'));var BPromise=require(_0xa286('0x3'));var rs=require(_0xa286('0x4'));var fs=require('fs');var Redis=require(_0xa286('0x5'));var db=require(_0xa286('0x6'))['db'];var utils=require(_0xa286('0x7'));var logger=require(_0xa286('0x8'))(_0xa286('0x9'));var config=require(_0xa286('0xa'));var jayson=require(_0xa286('0xb'));var client=jayson[_0xa286('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45df6c,_0x23549d,_0x4c65c7){return new BPromise(function(_0x41f4dc,_0x12d707){return client[_0xa286('0xd')](_0x45df6c,_0x4c65c7)['then'](function(_0x4efc98){logger[_0xa286('0xe')](_0xa286('0xf'),_0x23549d,_0xa286('0x10'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x23549d,_0xa286('0x10'),JSON[_0xa286('0x11')](_0x4efc98));if(_0x4efc98[_0xa286('0x12')]){if(_0x4efc98['error']['code']===0x1f4){logger[_0xa286('0x12')](_0xa286('0xf'),_0x23549d,_0x4efc98['error']['message']);return _0x12d707(_0x4efc98['error'][_0xa286('0x13')]);}logger[_0xa286('0x12')](_0xa286('0xf'),_0x23549d,_0x4efc98['error'][_0xa286('0x13')]);return _0x41f4dc(_0x4efc98[_0xa286('0x12')]['message']);}else{logger['info'](_0xa286('0xf'),_0x23549d,_0xa286('0x10'));_0x41f4dc(_0x4efc98[_0xa286('0x14')]['message']);}})[_0xa286('0x15')](function(_0x24217d){logger['error'](_0xa286('0xf'),_0x23549d,_0x24217d);_0x12d707(_0x24217d);});});}exports[_0xa286('0x16')]=function(_0x26abaa){var _0x3900e5=this;return new Promise(function(_0x35475f,_0x448025){return db[_0xa286('0x17')][_0xa286('0x18')](_0x26abaa['body'],{'raw':_0x26abaa[_0xa286('0x19')]?_0x26abaa[_0xa286('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26abaa['options']?_0x26abaa[_0xa286('0x19')][_0xa286('0x1a')]||null:null,'attributes':_0x26abaa[_0xa286('0x19')]?_0x26abaa['options'][_0xa286('0x1b')]||null:null,'limit':_0x26abaa[_0xa286('0x19')]?_0x26abaa[_0xa286('0x19')][_0xa286('0x1c')]||null:null})['then'](function(_0x6e55d7){logger[_0xa286('0xe')](_0xa286('0x16'),_0x26abaa);logger['debug'](_0xa286('0x16'),_0x26abaa,JSON[_0xa286('0x11')](_0x6e55d7));_0x35475f(_0x6e55d7);})[_0xa286('0x15')](function(_0x396888){logger['error'](_0xa286('0x16'),_0x396888[_0xa286('0x13')],_0x26abaa);_0x448025(_0x3900e5[_0xa286('0x12')](0x1f4,_0x396888[_0xa286('0x13')]));});});}; \ No newline at end of file +var _0x0343=['stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0343,0x1e1));var _0x3034=function(_0x4f750b,_0x4e3e43){_0x4f750b=_0x4f750b-0x0;var _0x918b39=_0x0343[_0x4f750b];return _0x918b39;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var moment=require('moment');var BPromise=require(_0x3034('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3034('0x3'))['db'];var utils=require(_0x3034('0x4'));var logger=require(_0x3034('0x5'))(_0x3034('0x6'));var config=require(_0x3034('0x7'));var jayson=require(_0x3034('0x8'));var client=jayson[_0x3034('0x9')][_0x3034('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b271b,_0x3fe8bc,_0xe265a9){return new BPromise(function(_0x4ff3d9,_0x3d4d51){return client['request'](_0x2b271b,_0xe265a9)[_0x3034('0xb')](function(_0x2118a0){logger[_0x3034('0xc')](_0x3034('0xd'),_0x3fe8bc,_0x3034('0xe'));logger[_0x3034('0xf')](_0x3034('0x10'),_0x3fe8bc,_0x3034('0xe'),JSON['stringify'](_0x2118a0));if(_0x2118a0['error']){if(_0x2118a0[_0x3034('0x11')][_0x3034('0x12')]===0x1f4){logger[_0x3034('0x11')](_0x3034('0xd'),_0x3fe8bc,_0x2118a0[_0x3034('0x11')][_0x3034('0x13')]);return _0x3d4d51(_0x2118a0['error'][_0x3034('0x13')]);}logger[_0x3034('0x11')](_0x3034('0xd'),_0x3fe8bc,_0x2118a0['error']['message']);return _0x4ff3d9(_0x2118a0[_0x3034('0x11')][_0x3034('0x13')]);}else{logger[_0x3034('0xc')](_0x3034('0xd'),_0x3fe8bc,'request\x20sent');_0x4ff3d9(_0x2118a0[_0x3034('0x14')]['message']);}})[_0x3034('0x15')](function(_0x21b672){logger['error'](_0x3034('0xd'),_0x3fe8bc,_0x21b672);_0x3d4d51(_0x21b672);});});}exports[_0x3034('0x16')]=function(_0x599807){var _0x35bb57=this;return new Promise(function(_0x464df2,_0x3a1b9d){return db[_0x3034('0x17')][_0x3034('0x18')](_0x599807[_0x3034('0x19')],{'raw':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599807[_0x3034('0x1a')]?_0x599807['options'][_0x3034('0x1c')]||null:null,'attributes':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1d')]||null:null,'limit':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1e')]||null:null})[_0x3034('0xb')](function(_0x52160f){logger['info'](_0x3034('0x16'),_0x599807);logger[_0x3034('0xf')](_0x3034('0x16'),_0x599807,JSON[_0x3034('0x1f')](_0x52160f));_0x464df2(_0x52160f);})[_0x3034('0x15')](function(_0x3b134c){logger['error'](_0x3034('0x16'),_0x3b134c['message'],_0x599807);_0x3a1b9d(_0x35bb57[_0x3034('0x11')](0x1f4,_0x3b134c[_0x3034('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8fd04a0..0766c88 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 _0x4f9b=['./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannel','openchannelinteraction:destroy','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x4f9b,0x154));var _0xb4f9=function(_0x59e62a,_0x24befb){_0x59e62a=_0x59e62a-0x0;var _0x283057=_0x4f9b[_0x59e62a];return _0x283057;};'use strict';var multer=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4f9('0x2'));var router=express[_0xb4f9('0x3')]();var fs_extra=require(_0xb4f9('0x4'));var auth=require(_0xb4f9('0x5'));var interaction=require(_0xb4f9('0x6'));var config=require(_0xb4f9('0x7'));var controller=require(_0xb4f9('0x8'));router[_0xb4f9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4f9('0xa')]);router[_0xb4f9('0x9')](_0xb4f9('0xb'),auth[_0xb4f9('0xc')](),controller['describe']);router[_0xb4f9('0x9')](_0xb4f9('0xd'),auth[_0xb4f9('0xc')](),controller['show']);router[_0xb4f9('0x9')]('/:id/messages',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xe')]);router[_0xb4f9('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb4f9('0xf')]);router[_0xb4f9('0x10')]('/',auth[_0xb4f9('0xc')](),controller['create']);router[_0xb4f9('0x10')](_0xb4f9('0x11'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x12')]);router[_0xb4f9('0x10')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),interaction[_0xb4f9('0x14')]('openchannel',_0xb4f9('0x15')),controller[_0xb4f9('0x16')]);router[_0xb4f9('0x17')](_0xb4f9('0xd'),auth['isAuthenticated'](),interaction[_0xb4f9('0x14')]('openchannel',_0xb4f9('0x18')),controller[_0xb4f9('0x19')]);router['delete'](_0xb4f9('0xd'),auth['isAuthenticated'](),interaction[_0xb4f9('0x14')](_0xb4f9('0x1a'),_0xb4f9('0x1b')),controller['destroy']);router[_0xb4f9('0x1c')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x1962=['delete','/:id/tags','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get','index','/describe','/:id','isAuthenticated','show','getMessages','download','post','/:id/messages','addMessage','tracked','openchannel','addTags','destroy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1962,0x149));var _0x2196=function(_0x26224c,_0x1a354c){_0x26224c=_0x26224c-0x0;var _0x4c2bc5=_0x1962[_0x26224c];return _0x4c2bc5;};'use strict';var multer=require(_0x2196('0x0'));var util=require(_0x2196('0x1'));var path=require(_0x2196('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2196('0x3')]();var fs_extra=require(_0x2196('0x4'));var auth=require(_0x2196('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x2196('0x6')]('/',auth['isAuthenticated'](),controller[_0x2196('0x7')]);router[_0x2196('0x6')](_0x2196('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x2196('0x6')](_0x2196('0x9'),auth[_0x2196('0xa')](),controller[_0x2196('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x2196('0xc')]);router[_0x2196('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2196('0xd')]);router['post']('/',auth[_0x2196('0xa')](),controller['create']);router[_0x2196('0xe')](_0x2196('0xf'),auth[_0x2196('0xa')](),controller[_0x2196('0x10')]);router[_0x2196('0xe')]('/:id/tags',auth[_0x2196('0xa')](),interaction[_0x2196('0x11')](_0x2196('0x12'),'openchannelinteraction:addtags'),controller[_0x2196('0x13')]);router['put'](_0x2196('0x9'),auth[_0x2196('0xa')](),interaction[_0x2196('0x11')]('openchannel','openchannelinteraction:update'),controller['update']);router['delete'](_0x2196('0x9'),auth['isAuthenticated'](),interaction[_0x2196('0x11')]('openchannel','openchannelinteraction:destroy'),controller[_0x2196('0x14')]);router[_0x2196('0x15')](_0x2196('0x16'),auth[_0x2196('0xa')](),controller[_0x2196('0x17')]);module[_0x2196('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index efb402d..0191be8 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 _0xc116=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xa20c56,_0x2b48b6){var _0x2f9eaa=function(_0x29f8ed){while(--_0x29f8ed){_0xa20c56['push'](_0xa20c56['shift']());}};_0x2f9eaa(++_0x2b48b6);}(_0xc116,0x164));var _0x6c11=function(_0x386de8,_0x13ae17){_0x386de8=_0x386de8-0x0;var _0x469b3c=_0xc116[_0x386de8];return _0x469b3c;};'use strict';var Sequelize=require(_0x6c11('0x0'));module[_0x6c11('0x1')]={'closed':{'type':Sequelize[_0x6c11('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6c11('0x3')]},'disposition':{'type':Sequelize[_0x6c11('0x4')]},'secondDisposition':{'type':Sequelize[_0x6c11('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6c11('0x4')]},'note':{'type':Sequelize[_0x6c11('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6c11('0x4')]},'externalUrl':{'type':Sequelize[_0x6c11('0x4')]},'lastMsgAt':{'type':Sequelize[_0x6c11('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6c11('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6c11('0x5')]('in',_0x6c11('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x6c11('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x93ed=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93ed,0xfe));var _0xd93e=function(_0x23aa26,_0x2018b0){_0x23aa26=_0x23aa26-0x0;var _0x3b7501=_0x93ed[_0x23aa26];return _0x3b7501;};'use strict';var Sequelize=require(_0xd93e('0x0'));module[_0xd93e('0x1')]={'closed':{'type':Sequelize[_0xd93e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd93e('0x3')]},'disposition':{'type':Sequelize[_0xd93e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd93e('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd93e('0x3')]},'threadId':{'type':Sequelize[_0xd93e('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xd93e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd93e('0x5')]('in',_0xd93e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd93e('0x5')]('in',_0xd93e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd93e('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bd74136..9692404 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 _0xf3c7=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','end','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','findAll','openchannel','query','catch','show','type','from','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','find','create','body','update','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','fullname','get','mkdirSync','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Private','createReadStream','pipe','createWriteStream','basename','System','Contact','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','rimraf','zip-dir','moment','util','ejs','lodash','../../components/parsers/qs','../../components/export/pdf'];(function(_0xe0d554,_0x425f68){var _0x566b75=function(_0x1281ab){while(--_0x1281ab){_0xe0d554['push'](_0xe0d554['shift']());}};_0x566b75(++_0x425f68);}(_0xf3c7,0x79));var _0x7f3c=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xf3c7[_0x874cf1];return _0x233579;};'use strict';var rimraf=require(_0x7f3c('0x0'));var zipdir=require(_0x7f3c('0x1'));var moment=require(_0x7f3c('0x2'));var util=require(_0x7f3c('0x3'));var path=require('path');var ejs=require(_0x7f3c('0x4'));var fs=require('fs');var _=require(_0x7f3c('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x7f3c('0x6'));var pdf=require(_0x7f3c('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x7f3c('0x8'));var db=require(_0x7f3c('0x9'))['db'];config[_0x7f3c('0xa')]=_['defaults'](config[_0x7f3c('0xa')],{'host':_0x7f3c('0xb'),'port':0x18eb});var socket=require(_0x7f3c('0xc'))(new Redis(config['redis']));require(_0x7f3c('0xd'))[_0x7f3c('0xe')](socket);function respondWithStatusCode(_0xd60c0e,_0x48321e){_0x48321e=_0x48321e||0xcc;return function(_0x3a8cf7){if(_0x3a8cf7){return _0xd60c0e[_0x7f3c('0xf')](_0x48321e);}return _0xd60c0e[_0x7f3c('0x10')](_0x48321e)['end']();};}function respondWithResult(_0x18d0f9,_0x3d250f){_0x3d250f=_0x3d250f||0xc8;return function(_0x561022){if(_0x561022){return _0x18d0f9['status'](_0x3d250f)['json'](_0x561022);}};}function respondWithFilteredResult(_0x12aaaa,_0xe208fe){return function(_0xf52521){if(_0xf52521){var _0x1093d5=typeof _0xe208fe[_0x7f3c('0x11')]===_0x7f3c('0x12')&&typeof _0xe208fe[_0x7f3c('0x13')]===_0x7f3c('0x12');var _0x46b463=_0xf52521['count'];var _0x3f81ad=_0x1093d5?0x0:_0xe208fe['offset'];var _0x127e4d=_0x1093d5?_0xf52521[_0x7f3c('0x14')]:_0xe208fe[_0x7f3c('0x11')]+_0xe208fe[_0x7f3c('0x13')];var _0x1ee245;if(_0x127e4d>=_0x46b463){_0x127e4d=_0x46b463;_0x1ee245=0xc8;}else{_0x1ee245=0xce;}_0x12aaaa['status'](_0x1ee245);return _0x12aaaa[_0x7f3c('0x15')](_0x7f3c('0x16'),_0x3f81ad+'-'+_0x127e4d+'/'+_0x46b463)[_0x7f3c('0x17')](_0xf52521);}return null;};}function saveUpdates(_0x38a76f){return function(_0x59363c){if(_0x59363c){return _0x59363c['update'](_0x38a76f)['then'](function(_0x3ff2ad){return _0x3ff2ad;});}return null;};}function removeEntity(_0xb274f){return function(_0x185d66){if(_0x185d66){return _0x185d66[_0x7f3c('0x18')]()[_0x7f3c('0x19')](function(){_0xb274f[_0x7f3c('0x10')](0xcc)[_0x7f3c('0x1a')]();});}};}function handleEntityNotFound(_0x1bf358){return function(_0x5587a8){if(!_0x5587a8){_0x1bf358[_0x7f3c('0xf')](0x194);}return _0x5587a8;};}function handleError(_0x2fbb93,_0x3f69a0){_0x3f69a0=_0x3f69a0||0x1f4;return function(_0x43d21f){logger[_0x7f3c('0x1b')](_0x43d21f[_0x7f3c('0x1c')]);if(_0x43d21f[_0x7f3c('0x1d')]){delete _0x43d21f[_0x7f3c('0x1d')];}_0x2fbb93[_0x7f3c('0x10')](_0x3f69a0)[_0x7f3c('0x1e')](_0x43d21f);};}exports[_0x7f3c('0x1f')]=function(_0x244130,_0x32ca03){var _0x4effad={};var _0x483311=_[_0x7f3c('0x20')](db[_0x7f3c('0x21')][_0x7f3c('0x22')],function(_0x2c80e5){return{'name':_0x2c80e5[_0x7f3c('0x23')],'type':_0x2c80e5['type'][_0x7f3c('0x24')]};});_0x4effad=qs['getOptions'](_0x483311,_0x244130);return interaction[_0x7f3c('0x25')](_0x7f3c('0x26'),_0x244130[_0x7f3c('0x27')],_0x244130['user'],_0x4effad,_0x483311)[_0x7f3c('0x19')](respondWithFilteredResult(_0x32ca03,_0x4effad))[_0x7f3c('0x28')](handleError(_0x32ca03,null));};exports[_0x7f3c('0x29')]=function(_0x58c311,_0x305bd8){var _0x53c40f={};if(_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x2a')]&&_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x2a')]===_0x7f3c('0x2b')){_0x53c40f[_0x7f3c('0x2b')]=_0x58c311['params']['id'];}else{_0x53c40f['id']=_0x58c311[_0x7f3c('0x2c')]['id'];}var _0x3cbac7={'raw':![],'where':_0x53c40f},_0x53f217={};_0x53f217[_0x7f3c('0x2d')]=_[_0x7f3c('0x2e')](db[_0x7f3c('0x21')][_0x7f3c('0x22')]);_0x53f217[_0x7f3c('0x27')]=_[_0x7f3c('0x2e')](_0x58c311[_0x7f3c('0x27')]);_0x53f217[_0x7f3c('0x2f')]=_[_0x7f3c('0x30')](_0x53f217[_0x7f3c('0x2d')],_0x53f217[_0x7f3c('0x27')]);_0x3cbac7[_0x7f3c('0x31')]=_[_0x7f3c('0x30')](_0x53f217[_0x7f3c('0x2d')],qs[_0x7f3c('0x32')](_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x32')]));_0x3cbac7[_0x7f3c('0x31')]=_0x3cbac7['attributes']['length']?_0x3cbac7['attributes']:_0x53f217[_0x7f3c('0x2d')];if(_0x58c311[_0x7f3c('0x27')][_0x7f3c('0x33')]){_0x3cbac7['include']=[{'all':!![]}];}_0x3cbac7=_[_0x7f3c('0x34')]({},_0x3cbac7,_0x58c311['options']);return db['OpenchannelInteraction'][_0x7f3c('0x35')](_0x3cbac7)[_0x7f3c('0x19')](handleEntityNotFound(_0x305bd8,null))['then'](respondWithResult(_0x305bd8,null))['catch'](handleError(_0x305bd8,null));};exports[_0x7f3c('0x36')]=function(_0x572839,_0x3f4ccb){return db['OpenchannelInteraction']['create'](_0x572839[_0x7f3c('0x37')],{})[_0x7f3c('0x19')](respondWithResult(_0x3f4ccb,0xc9))[_0x7f3c('0x28')](handleError(_0x3f4ccb,null));};exports[_0x7f3c('0x38')]=function(_0x2aa6d6,_0x4e4f50){if(_0x2aa6d6[_0x7f3c('0x37')]['id']){delete _0x2aa6d6[_0x7f3c('0x37')]['id'];}return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x2aa6d6[_0x7f3c('0x2c')]['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x4e4f50,null))[_0x7f3c('0x19')](saveUpdates(_0x2aa6d6[_0x7f3c('0x37')],null))[_0x7f3c('0x19')](respondWithResult(_0x4e4f50,null))[_0x7f3c('0x28')](handleError(_0x4e4f50,null));};exports[_0x7f3c('0x18')]=function(_0x5f0e85,_0x15f4e9){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x5f0e85['params']['id']}})['then'](handleEntityNotFound(_0x15f4e9,null))[_0x7f3c('0x19')](removeEntity(_0x15f4e9,null))[_0x7f3c('0x28')](handleError(_0x15f4e9,null));};exports[_0x7f3c('0x39')]=function(_0xd7b151,_0x368e2b){return db[_0x7f3c('0x21')][_0x7f3c('0x39')]()['then'](respondWithResult(_0x368e2b,null))[_0x7f3c('0x28')](handleError(_0x368e2b,null));};exports['addMessage']=function(_0x1c377c,_0x241849){return db['OpenchannelMessage'][_0x7f3c('0x35')]({'where':{'id':_0x1c377c[_0x7f3c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x241849,null))[_0x7f3c('0x19')](function(_0x1a320c){if(_0x1a320c){return _0x1a320c[_0x7f3c('0x3a')](_0x1c377c[_0x7f3c('0x37')]['ids'],_[_0x7f3c('0x3b')](_0x1c377c[_0x7f3c('0x37')],[_0x7f3c('0x3c'),'id'])||{});}})[_0x7f3c('0x19')](respondWithResult(_0x241849,null))['catch'](handleError(_0x241849,null));};exports[_0x7f3c('0x3d')]=function(_0x1de0b2,_0x28713d){var _0x9d1f65={'raw':![],'where':{}};var _0x486367={};var _0x39a5ad={'count':0x0,'rows':[]};return db[_0x7f3c('0x21')][_0x7f3c('0x3e')]({'where':{'id':_0x1de0b2[_0x7f3c('0x2c')]['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x28713d,null))[_0x7f3c('0x19')](function(_0x38ef92){if(_0x38ef92){_0x486367['model']=_[_0x7f3c('0x2e')](db[_0x7f3c('0x3f')][_0x7f3c('0x22')]);_0x486367['query']=_['keys'](_0x1de0b2[_0x7f3c('0x27')]);_0x486367[_0x7f3c('0x2f')]=_[_0x7f3c('0x30')](_0x486367[_0x7f3c('0x2d')],_0x486367[_0x7f3c('0x27')]);_0x9d1f65[_0x7f3c('0x31')]=_[_0x7f3c('0x30')](_0x486367[_0x7f3c('0x2d')],qs[_0x7f3c('0x32')](_0x1de0b2[_0x7f3c('0x27')]['fields']));_0x9d1f65[_0x7f3c('0x31')]=_0x9d1f65['attributes']['length']?_0x9d1f65[_0x7f3c('0x31')]:_0x486367[_0x7f3c('0x2d')];if(!_0x1de0b2[_0x7f3c('0x27')]['hasOwnProperty'](_0x7f3c('0x40'))){_0x9d1f65[_0x7f3c('0x13')]=qs['limit'](_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x13')]);_0x9d1f65[_0x7f3c('0x11')]=qs[_0x7f3c('0x11')](_0x1de0b2['query'][_0x7f3c('0x11')]);}_0x9d1f65[_0x7f3c('0x41')]=qs[_0x7f3c('0x42')](_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x42')]);_0x9d1f65[_0x7f3c('0x43')]=qs['filters'](_[_0x7f3c('0x44')](_0x1de0b2[_0x7f3c('0x27')],_0x486367[_0x7f3c('0x2f')]));_0x9d1f65[_0x7f3c('0x43')][_0x7f3c('0x45')]=_0x38ef92['id'];if(_0x1de0b2[_0x7f3c('0x27')]['filter']){_0x9d1f65['where']=_[_0x7f3c('0x34')](_0x9d1f65[_0x7f3c('0x43')],{'$or':_[_0x7f3c('0x20')](_0x9d1f65[_0x7f3c('0x31')],function(_0x486b75){var _0x4180dc={};_0x4180dc[_0x486b75]={'$like':'%'+_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x46')]+'%'};return _0x4180dc;})});}if(_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x47')]){var _0x318a3b=_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x47')][_0x7f3c('0x48')](',');var _0x53518b={};_0x53518b[_0x318a3b[0x0]]={'$gte':moment(_0x318a3b[0x1])[_0x7f3c('0x49')](_0x7f3c('0x4a'))};_0x9d1f65[_0x7f3c('0x43')]=_[_0x7f3c('0x34')](_0x9d1f65[_0x7f3c('0x43')],_0x53518b);}_0x9d1f65=_[_0x7f3c('0x34')]({},_0x9d1f65,_0x1de0b2[_0x7f3c('0x4b')]);return db['OpenchannelMessage'][_0x7f3c('0x14')]({'where':_0x9d1f65[_0x7f3c('0x43')]})[_0x7f3c('0x19')](function(_0x26a90e){_0x39a5ad[_0x7f3c('0x14')]=_0x26a90e;if(_0x1de0b2[_0x7f3c('0x27')][_0x7f3c('0x33')]){_0x9d1f65[_0x7f3c('0x4c')]=[{'all':!![]}];}return db[_0x7f3c('0x3f')][_0x7f3c('0x25')](_0x9d1f65);})['then'](function(_0x464592){_0x39a5ad[_0x7f3c('0x4d')]=_0x464592;return _0x39a5ad;});}})[_0x7f3c('0x19')](respondWithFilteredResult(_0x28713d,_0x9d1f65))[_0x7f3c('0x28')](handleError(_0x28713d,null));};exports[_0x7f3c('0x4e')]=function(_0x3f7e2d,_0x36e62f){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x3f7e2d['params']['id']}})[_0x7f3c('0x19')](handleEntityNotFound(_0x36e62f,null))[_0x7f3c('0x19')](function(_0x2b1d46){if(_0x2b1d46){return _0x2b1d46['setTags'](_0x3f7e2d['body'][_0x7f3c('0x3c')],_[_0x7f3c('0x3b')](_0x3f7e2d[_0x7f3c('0x37')],[_0x7f3c('0x3c'),'id'])||{})[_0x7f3c('0x4f')](function(){return db[_0x7f3c('0x50')][_0x7f3c('0x25')]({'attributes':['id',_0x7f3c('0x1d'),_0x7f3c('0x51')],'where':{'id':_0x3f7e2d[_0x7f3c('0x37')][_0x7f3c('0x3c')]}});})[_0x7f3c('0x19')](function(_0x1c7da9){socket['emit'](_0x7f3c('0x52'),{'id':Number(_0x3f7e2d['params']['id']),'tags':_0x1c7da9||[]});return{'id':Number(_0x3f7e2d[_0x7f3c('0x2c')]['id']),'tags':_0x1c7da9||[]};});}})['then'](respondWithResult(_0x36e62f,null))['catch'](handleError(_0x36e62f,null));};exports[_0x7f3c('0x53')]=function(_0x3f4bdc,_0x54f425){return db[_0x7f3c('0x21')][_0x7f3c('0x35')]({'where':{'id':_0x3f4bdc['params']['id']}})['then'](handleEntityNotFound(_0x54f425,null))[_0x7f3c('0x19')](function(_0x23606c){if(_0x23606c){return _0x23606c['removeTags'](_0x3f4bdc[_0x7f3c('0x27')]['ids']);}})[_0x7f3c('0x19')](respondWithStatusCode(_0x54f425,null))[_0x7f3c('0x28')](handleError(_0x54f425,null));};exports[_0x7f3c('0x54')]=function(_0x56d808,_0x3dfd8d){var _0x4d0e59=moment()[_0x7f3c('0x55')]()[_0x7f3c('0x56')]();var _0x3a819d=path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],'server',_0x7f3c('0x59'),_0x7f3c('0x5a'));var _0x195b70=path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],_0x7f3c('0x5b'),_0x7f3c('0x59'),_0x7f3c('0x5c'));var _0x57daf0=path[_0x7f3c('0x57')](_0x3a819d,_0x4d0e59);var _0x507761=util[_0x7f3c('0x49')](_0x7f3c('0x5d'),_0x56d808['params']['id'],_0x4d0e59);var _0x50846c=path['join'](_0x3a819d,_0x507761);var _0x4a0c1b=[];_0x4a0c1b['push']({'model':db[_0x7f3c('0x5e')],'as':_0x7f3c('0x5e'),'attributes':['id','fullname'],'raw':!![]});_0x4a0c1b[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x60')],'as':'Contact','attributes':['id',_0x7f3c('0x61'),_0x7f3c('0x62')],'raw':!![]});if(_0x56d808[_0x7f3c('0x27')][_0x7f3c('0x5c')]){_0x4a0c1b[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x63')],'as':_0x7f3c('0x63'),'raw':!![]});}var _0x25431f=[{'model':db[_0x7f3c('0x3f')],'as':_0x7f3c('0x64'),'attributes':['id',_0x7f3c('0x37'),_0x7f3c('0x65'),_0x7f3c('0x66'),_0x7f3c('0x67'),_0x7f3c('0x68')],'include':_0x4a0c1b}];_0x25431f[_0x7f3c('0x5f')]({'model':db['OpenchannelAccount'],'as':_0x7f3c('0x69'),'attributes':['id',_0x7f3c('0x1d')]});_0x25431f[_0x7f3c('0x5f')]({'model':db[_0x7f3c('0x5e')],'as':'Owner','attributes':['id',_0x7f3c('0x6a')]});return db[_0x7f3c('0x21')]['find']({'where':{'id':_0x56d808['params']['id']},'include':_0x25431f})['then'](handleEntityNotFound(_0x3dfd8d,null))[_0x7f3c('0x19')](function(_0x350bed){if(_0x350bed){var _0x276465=_0x350bed[_0x7f3c('0x6b')]({'plain':!![]});fs[_0x7f3c('0x6c')](_0x57daf0);var _0x2eb1f1={'channel':_0x7f3c('0x6d'),'account':_0x276465[_0x7f3c('0x69')]['name'],'agent':_0x276465[_0x7f3c('0x6e')]?_0x276465[_0x7f3c('0x6e')][_0x7f3c('0x6a')]:_0x7f3c('0x6f'),'createdAt':moment(_0x276465[_0x7f3c('0x65')])[_0x7f3c('0x49')](_0x7f3c('0x4a'))[_0x7f3c('0x56')](),'closedAt':_0x276465['closed']?moment(_0x276465[_0x7f3c('0x70')])[_0x7f3c('0x49')](_0x7f3c('0x4a'))[_0x7f3c('0x56')]():'','disposition':_0x276465[_0x7f3c('0x71')],'visibility':_0x276465[_0x7f3c('0x72')]?'Public':_0x7f3c('0x73'),'messages':_(_0x276465[_0x7f3c('0x64')])[_0x7f3c('0x46')]({'secret':![]})[_0x7f3c('0x20')](function(_0x267fbd){if(_0x267fbd[_0x7f3c('0x63')]){var _0x80adc1=path['join'](_0x195b70,_0x267fbd['Attachment']['basename']);if(fs['existsSync'](_0x80adc1)){fs[_0x7f3c('0x74')](_0x80adc1)[_0x7f3c('0x75')](fs[_0x7f3c('0x76')](path['join'](_0x57daf0,_0x267fbd['Attachment'][_0x7f3c('0x77')])));}}return{'date':moment(_0x267fbd[_0x7f3c('0x65')])[_0x7f3c('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7f3c('0x56')](),'sender':_0x267fbd[_0x7f3c('0x66')]==='out'?_0x267fbd[_0x7f3c('0x5e')]?_0x267fbd[_0x7f3c('0x5e')][_0x7f3c('0x6a')]:_0x7f3c('0x78'):_0x267fbd[_0x7f3c('0x79')]['firstName']+(_0x267fbd[_0x7f3c('0x79')]['lastName']?'\x20'+_0x267fbd['Contact'][_0x7f3c('0x62')]:''),'body':_0x267fbd[_0x7f3c('0x63')]?_0x267fbd['Attachment'][_0x7f3c('0x77')]:_0x267fbd['body'],'direction':_0x267fbd[_0x7f3c('0x66')]===_0x7f3c('0x7a')?'A':'C','secret':_0x267fbd['secret'],'read':_0x267fbd[_0x7f3c('0x68')],'attachment':_0x267fbd['Attachment']};})[_0x7f3c('0x7b')]()};return ejs[_0x7f3c('0x7c')](path[_0x7f3c('0x57')](config[_0x7f3c('0x58')],_0x7f3c('0x5b'),_0x7f3c('0x7d'),_0x7f3c('0x7e')),{'interaction':_0x2eb1f1})[_0x7f3c('0x19')](function(_0x4d07aa){var _0x18ac69=path[_0x7f3c('0x57')](_0x57daf0,_0x7f3c('0x7f')+_0x276465['id']+'-'+_0x4d0e59+_0x7f3c('0x80'));var _0xd87fed={'path':_0x18ac69,'channel':_0x7f3c('0x6d'),'interactionId':_0x276465['id']};return pdf['createPdfFromHTML'](_0x4d07aa,_0xd87fed);})[_0x7f3c('0x19')](function(){return new Promise(function(_0x11a50,_0x593879){zipdir(_0x57daf0,{'saveTo':_0x50846c},function(_0x2cae08,_0x1acca0){if(_0x2cae08)return _0x593879(_0x2cae08);return _0x11a50(_0x1acca0);});})[_0x7f3c('0x19')](function(){return new Promise(function(_0x3ab551,_0x4761ef){rimraf(_0x57daf0,function(_0x38c386){if(_0x38c386)_0x4761ef(_0x38c386);return _0x3ab551();});});})[_0x7f3c('0x19')](function(){return _0x3dfd8d[_0x7f3c('0x54')](_0x50846c,_0x507761,function(_0x342088){if(_0x342088){logger[_0x7f3c('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x342088);}else{fs['unlinkSync'](_0x50846c);}});});});}else{return _0x3dfd8d['sendStatus'](0xc8);}})[_0x7f3c('0x28')](handleError(_0x3dfd8d,null));}; \ No newline at end of file +var _0xe186=['openchannelInteractionTags:save','removeTags','download','toString','join','root','files','tmp','push','User','fullname','CmContact','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','mkdirSync','Owner','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','basename','createReadStream','createWriteStream','System','lastName','out','secret','value','renderFile','server','downloadInteraction.ejs','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','index','OpenchannelInteraction','rawAttributes','type','key','getOptions','openchannel','query','user','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','map','$gte','split','format','findAll','rows','addTags','setTags','omit','spread','Tag','color','emit'];(function(_0xab8aed,_0x395dfe){var _0x4efd54=function(_0x1c6940){while(--_0x1c6940){_0xab8aed['push'](_0xab8aed['shift']());}};_0x4efd54(++_0x395dfe);}(_0xe186,0xb3));var _0x6e18=function(_0x5e9d45,_0x540782){_0x5e9d45=_0x5e9d45-0x0;var _0x2a1dce=_0xe186[_0x5e9d45];return _0x2a1dce;};'use strict';var rimraf=require(_0x6e18('0x0'));var zipdir=require(_0x6e18('0x1'));var moment=require(_0x6e18('0x2'));var util=require(_0x6e18('0x3'));var path=require(_0x6e18('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e18('0x5'));var Redis=require(_0x6e18('0x6'));var interaction=require(_0x6e18('0x7'));var qs=require(_0x6e18('0x8'));var pdf=require(_0x6e18('0x9'));var logger=require(_0x6e18('0xa'))('api');var config=require(_0x6e18('0xb'));var db=require(_0x6e18('0xc'))['db'];config['redis']=_[_0x6e18('0xd')](config[_0x6e18('0xe')],{'host':_0x6e18('0xf'),'port':0x18eb});var socket=require(_0x6e18('0x10'))(new Redis(config[_0x6e18('0xe')]));require(_0x6e18('0x11'))[_0x6e18('0x12')](socket);function respondWithStatusCode(_0xea7c0c,_0x253ec3){_0x253ec3=_0x253ec3||0xcc;return function(_0x2052f3){if(_0x2052f3){return _0xea7c0c[_0x6e18('0x13')](_0x253ec3);}return _0xea7c0c[_0x6e18('0x14')](_0x253ec3)[_0x6e18('0x15')]();};}function respondWithResult(_0x3910d7,_0x1c8313){_0x1c8313=_0x1c8313||0xc8;return function(_0x5bff83){if(_0x5bff83){return _0x3910d7[_0x6e18('0x14')](_0x1c8313)[_0x6e18('0x16')](_0x5bff83);}};}function respondWithFilteredResult(_0x4e4ad1,_0x53e1e3){return function(_0x522fcc){if(_0x522fcc){var _0x5dac69=typeof _0x53e1e3[_0x6e18('0x17')]===_0x6e18('0x18')&&typeof _0x53e1e3['limit']===_0x6e18('0x18');var _0x238336=_0x522fcc['count'];var _0x258f33=_0x5dac69?0x0:_0x53e1e3[_0x6e18('0x17')];var _0x1e170d=_0x5dac69?_0x522fcc[_0x6e18('0x19')]:_0x53e1e3[_0x6e18('0x17')]+_0x53e1e3[_0x6e18('0x1a')];var _0x132533;if(_0x1e170d>=_0x238336){_0x1e170d=_0x238336;_0x132533=0xc8;}else{_0x132533=0xce;}_0x4e4ad1[_0x6e18('0x14')](_0x132533);return _0x4e4ad1[_0x6e18('0x1b')](_0x6e18('0x1c'),_0x258f33+'-'+_0x1e170d+'/'+_0x238336)[_0x6e18('0x16')](_0x522fcc);}return null;};}function saveUpdates(_0x145c6d){return function(_0x4af0c6){if(_0x4af0c6){return _0x4af0c6[_0x6e18('0x1d')](_0x145c6d)['then'](function(_0x3916ac){return _0x3916ac;});}return null;};}function removeEntity(_0x480411){return function(_0x1bc460){if(_0x1bc460){return _0x1bc460['destroy']()[_0x6e18('0x1e')](function(){_0x480411[_0x6e18('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256395){return function(_0xb639){if(!_0xb639){_0x256395[_0x6e18('0x13')](0x194);}return _0xb639;};}function handleError(_0x56ee72,_0x5a1106){_0x5a1106=_0x5a1106||0x1f4;return function(_0x21d1b4){logger[_0x6e18('0x1f')](_0x21d1b4[_0x6e18('0x20')]);if(_0x21d1b4['name']){delete _0x21d1b4[_0x6e18('0x21')];}_0x56ee72[_0x6e18('0x14')](_0x5a1106)['send'](_0x21d1b4);};}exports[_0x6e18('0x22')]=function(_0x160ea9,_0x55dc07){var _0x387cc1={};var _0x2b679a=_['map'](db[_0x6e18('0x23')][_0x6e18('0x24')],function(_0x1cbe0f){return{'name':_0x1cbe0f['fieldName'],'type':_0x1cbe0f[_0x6e18('0x25')][_0x6e18('0x26')]};});_0x387cc1=qs[_0x6e18('0x27')](_0x2b679a,_0x160ea9);return interaction['findAll'](_0x6e18('0x28'),_0x160ea9[_0x6e18('0x29')],_0x160ea9[_0x6e18('0x2a')],_0x387cc1,_0x2b679a)[_0x6e18('0x1e')](respondWithFilteredResult(_0x55dc07,_0x387cc1))['catch'](handleError(_0x55dc07,null));};exports[_0x6e18('0x2b')]=function(_0xb3e012,_0x9b0c65){var _0x2fa5e3={};if(_0xb3e012[_0x6e18('0x29')][_0x6e18('0x25')]&&_0xb3e012['query']['type']===_0x6e18('0x2c')){_0x2fa5e3['from']=_0xb3e012[_0x6e18('0x2d')]['id'];}else{_0x2fa5e3['id']=_0xb3e012[_0x6e18('0x2d')]['id'];}var _0x25cf59={'raw':![],'where':_0x2fa5e3},_0x3b1d5a={};_0x3b1d5a['model']=_[_0x6e18('0x2e')](db[_0x6e18('0x23')][_0x6e18('0x24')]);_0x3b1d5a[_0x6e18('0x29')]=_[_0x6e18('0x2e')](_0xb3e012[_0x6e18('0x29')]);_0x3b1d5a[_0x6e18('0x2f')]=_[_0x6e18('0x30')](_0x3b1d5a[_0x6e18('0x31')],_0x3b1d5a[_0x6e18('0x29')]);_0x25cf59[_0x6e18('0x32')]=_[_0x6e18('0x30')](_0x3b1d5a[_0x6e18('0x31')],qs[_0x6e18('0x33')](_0xb3e012[_0x6e18('0x29')][_0x6e18('0x33')]));_0x25cf59['attributes']=_0x25cf59[_0x6e18('0x32')][_0x6e18('0x34')]?_0x25cf59['attributes']:_0x3b1d5a[_0x6e18('0x31')];if(_0xb3e012[_0x6e18('0x29')][_0x6e18('0x35')]){_0x25cf59[_0x6e18('0x36')]=[{'all':!![]}];}_0x25cf59=_[_0x6e18('0x37')]({},_0x25cf59,_0xb3e012[_0x6e18('0x38')]);return db['OpenchannelInteraction'][_0x6e18('0x39')](_0x25cf59)['then'](handleEntityNotFound(_0x9b0c65,null))[_0x6e18('0x1e')](respondWithResult(_0x9b0c65,null))[_0x6e18('0x3a')](handleError(_0x9b0c65,null));};exports[_0x6e18('0x3b')]=function(_0x150ab6,_0x5e35d8){return db['OpenchannelInteraction'][_0x6e18('0x3b')](_0x150ab6['body'],{})['then'](respondWithResult(_0x5e35d8,0xc9))[_0x6e18('0x3a')](handleError(_0x5e35d8,null));};exports[_0x6e18('0x1d')]=function(_0x4a4abe,_0x1f6396){if(_0x4a4abe[_0x6e18('0x3c')]['id']){delete _0x4a4abe[_0x6e18('0x3c')]['id'];}return db[_0x6e18('0x23')][_0x6e18('0x39')]({'where':{'id':_0x4a4abe[_0x6e18('0x2d')]['id']}})[_0x6e18('0x1e')](handleEntityNotFound(_0x1f6396,null))['then'](saveUpdates(_0x4a4abe[_0x6e18('0x3c')],null))[_0x6e18('0x1e')](respondWithResult(_0x1f6396,null))['catch'](handleError(_0x1f6396,null));};exports['destroy']=function(_0x4bfc58,_0x1df0be){return db[_0x6e18('0x23')]['find']({'where':{'id':_0x4bfc58[_0x6e18('0x2d')]['id']}})[_0x6e18('0x1e')](handleEntityNotFound(_0x1df0be,null))[_0x6e18('0x1e')](removeEntity(_0x1df0be,null))[_0x6e18('0x3a')](handleError(_0x1df0be,null));};exports['describe']=function(_0x1948d1,_0x113e69){return db[_0x6e18('0x23')]['describe']()[_0x6e18('0x1e')](respondWithResult(_0x113e69,null))['catch'](handleError(_0x113e69,null));};exports[_0x6e18('0x3d')]=function(_0x39a339,_0x4e35e2){return db[_0x6e18('0x3e')]['find']({'where':{'id':_0x39a339[_0x6e18('0x2d')]['id']}})[_0x6e18('0x1e')](handleEntityNotFound(_0x4e35e2,null))[_0x6e18('0x1e')](function(_0x51e0f6){if(_0x51e0f6){return _0x51e0f6[_0x6e18('0x3d')](_0x39a339[_0x6e18('0x3c')]['ids'],_['omit'](_0x39a339[_0x6e18('0x3c')],[_0x6e18('0x3f'),'id'])||{});}})[_0x6e18('0x1e')](respondWithResult(_0x4e35e2,null))[_0x6e18('0x3a')](handleError(_0x4e35e2,null));};exports[_0x6e18('0x40')]=function(_0x410bb7,_0x269266){var _0x8646a8={'raw':![],'where':{}};var _0x2b3e84={};var _0x48d75c={'count':0x0,'rows':[]};return db[_0x6e18('0x23')][_0x6e18('0x41')]({'where':{'id':_0x410bb7[_0x6e18('0x2d')]['id']}})['then'](handleEntityNotFound(_0x269266,null))['then'](function(_0x5002d0){if(_0x5002d0){_0x2b3e84[_0x6e18('0x31')]=_['keys'](db[_0x6e18('0x3e')][_0x6e18('0x24')]);_0x2b3e84[_0x6e18('0x29')]=_[_0x6e18('0x2e')](_0x410bb7['query']);_0x2b3e84[_0x6e18('0x2f')]=_[_0x6e18('0x30')](_0x2b3e84[_0x6e18('0x31')],_0x2b3e84['query']);_0x8646a8['attributes']=_[_0x6e18('0x30')](_0x2b3e84[_0x6e18('0x31')],qs[_0x6e18('0x33')](_0x410bb7[_0x6e18('0x29')]['fields']));_0x8646a8['attributes']=_0x8646a8[_0x6e18('0x32')][_0x6e18('0x34')]?_0x8646a8[_0x6e18('0x32')]:_0x2b3e84[_0x6e18('0x31')];if(!_0x410bb7[_0x6e18('0x29')][_0x6e18('0x42')](_0x6e18('0x43'))){_0x8646a8['limit']=qs['limit'](_0x410bb7[_0x6e18('0x29')]['limit']);_0x8646a8[_0x6e18('0x17')]=qs[_0x6e18('0x17')](_0x410bb7[_0x6e18('0x29')][_0x6e18('0x17')]);}_0x8646a8[_0x6e18('0x44')]=qs[_0x6e18('0x45')](_0x410bb7['query']['sort']);_0x8646a8[_0x6e18('0x46')]=qs['filters'](_[_0x6e18('0x47')](_0x410bb7['query'],_0x2b3e84[_0x6e18('0x2f')]));_0x8646a8['where'][_0x6e18('0x48')]=_0x5002d0['id'];if(_0x410bb7['query'][_0x6e18('0x49')]){_0x8646a8[_0x6e18('0x46')]=_[_0x6e18('0x37')](_0x8646a8[_0x6e18('0x46')],{'$or':_[_0x6e18('0x4a')](_0x8646a8[_0x6e18('0x32')],function(_0x20787a){var _0x41dd28={};_0x41dd28[_0x20787a]={'$like':'%'+_0x410bb7[_0x6e18('0x29')]['filter']+'%'};return _0x41dd28;})});}if(_0x410bb7[_0x6e18('0x29')]['$gte']){var _0xa75a0f=_0x410bb7[_0x6e18('0x29')][_0x6e18('0x4b')][_0x6e18('0x4c')](',');var _0x1c4dc7={};_0x1c4dc7[_0xa75a0f[0x0]]={'$gte':moment(_0xa75a0f[0x1])[_0x6e18('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x8646a8[_0x6e18('0x46')]=_['merge'](_0x8646a8[_0x6e18('0x46')],_0x1c4dc7);}_0x8646a8=_['merge']({},_0x8646a8,_0x410bb7[_0x6e18('0x38')]);return db[_0x6e18('0x3e')][_0x6e18('0x19')]({'where':_0x8646a8[_0x6e18('0x46')]})[_0x6e18('0x1e')](function(_0xbd28ac){_0x48d75c[_0x6e18('0x19')]=_0xbd28ac;if(_0x410bb7['query'][_0x6e18('0x35')]){_0x8646a8[_0x6e18('0x36')]=[{'all':!![]}];}return db[_0x6e18('0x3e')][_0x6e18('0x4e')](_0x8646a8);})['then'](function(_0xd08814){_0x48d75c[_0x6e18('0x4f')]=_0xd08814;return _0x48d75c;});}})['then'](respondWithFilteredResult(_0x269266,_0x8646a8))['catch'](handleError(_0x269266,null));};exports[_0x6e18('0x50')]=function(_0x220d9e,_0x12a7d0){return db[_0x6e18('0x23')][_0x6e18('0x39')]({'where':{'id':_0x220d9e[_0x6e18('0x2d')]['id']}})[_0x6e18('0x1e')](handleEntityNotFound(_0x12a7d0,null))[_0x6e18('0x1e')](function(_0x5953db){if(_0x5953db){return _0x5953db[_0x6e18('0x51')](_0x220d9e[_0x6e18('0x3c')][_0x6e18('0x3f')],_[_0x6e18('0x52')](_0x220d9e['body'],['ids','id'])||{})[_0x6e18('0x53')](function(){return db[_0x6e18('0x54')][_0x6e18('0x4e')]({'attributes':['id','name',_0x6e18('0x55')],'where':{'id':_0x220d9e['body'][_0x6e18('0x3f')]}});})[_0x6e18('0x1e')](function(_0x346326){socket[_0x6e18('0x56')](_0x6e18('0x57'),{'id':Number(_0x220d9e[_0x6e18('0x2d')]['id']),'tags':_0x346326||[]});return{'id':Number(_0x220d9e[_0x6e18('0x2d')]['id']),'tags':_0x346326||[]};});}})[_0x6e18('0x1e')](respondWithResult(_0x12a7d0,null))[_0x6e18('0x3a')](handleError(_0x12a7d0,null));};exports['removeTags']=function(_0x261398,_0x6214e1){return db[_0x6e18('0x23')][_0x6e18('0x39')]({'where':{'id':_0x261398['params']['id']}})['then'](handleEntityNotFound(_0x6214e1,null))[_0x6e18('0x1e')](function(_0x4403b3){if(_0x4403b3){return _0x4403b3[_0x6e18('0x58')](_0x261398[_0x6e18('0x29')][_0x6e18('0x3f')]);}})[_0x6e18('0x1e')](respondWithStatusCode(_0x6214e1,null))['catch'](handleError(_0x6214e1,null));};exports[_0x6e18('0x59')]=function(_0x183e91,_0x1b92d3){var _0x1a6537=moment()['unix']()[_0x6e18('0x5a')]();var _0x448558=path[_0x6e18('0x5b')](config[_0x6e18('0x5c')],'server',_0x6e18('0x5d'),_0x6e18('0x5e'));var _0x4d7c8b=path['join'](config[_0x6e18('0x5c')],'server',_0x6e18('0x5d'),'attachments');var _0x2c51d2=path[_0x6e18('0x5b')](_0x448558,_0x1a6537);var _0xbd5167=util[_0x6e18('0x4d')]('transcript-%d-%s.zip',_0x183e91['params']['id'],_0x1a6537);var _0x22fc31=path[_0x6e18('0x5b')](_0x448558,_0xbd5167);var _0xf7ee3d=[];_0xf7ee3d[_0x6e18('0x5f')]({'model':db[_0x6e18('0x60')],'as':_0x6e18('0x60'),'attributes':['id',_0x6e18('0x61')],'raw':!![]});_0xf7ee3d[_0x6e18('0x5f')]({'model':db[_0x6e18('0x62')],'as':_0x6e18('0x63'),'attributes':['id',_0x6e18('0x64'),'lastName'],'raw':!![]});if(_0x183e91[_0x6e18('0x29')][_0x6e18('0x65')]){_0xf7ee3d[_0x6e18('0x5f')]({'model':db[_0x6e18('0x66')],'as':_0x6e18('0x66'),'raw':!![]});}var _0x356f2e=[{'model':db[_0x6e18('0x3e')],'as':_0x6e18('0x67'),'attributes':['id',_0x6e18('0x3c'),_0x6e18('0x68'),_0x6e18('0x69'),'secret',_0x6e18('0x6a')],'include':_0xf7ee3d}];_0x356f2e[_0x6e18('0x5f')]({'model':db[_0x6e18('0x6b')],'as':_0x6e18('0x6c'),'attributes':['id',_0x6e18('0x21')]});_0x356f2e[_0x6e18('0x5f')]({'model':db['User'],'as':'Owner','attributes':['id',_0x6e18('0x61')]});return db[_0x6e18('0x23')][_0x6e18('0x39')]({'where':{'id':_0x183e91[_0x6e18('0x2d')]['id']},'include':_0x356f2e})[_0x6e18('0x1e')](handleEntityNotFound(_0x1b92d3,null))[_0x6e18('0x1e')](function(_0x325fb5){if(_0x325fb5){var _0x4ddcdf=_0x325fb5['get']({'plain':!![]});fs[_0x6e18('0x6d')](_0x2c51d2);var _0x52c029={'channel':'Openchannel','account':_0x4ddcdf[_0x6e18('0x6c')][_0x6e18('0x21')],'agent':_0x4ddcdf[_0x6e18('0x6e')]?_0x4ddcdf[_0x6e18('0x6e')][_0x6e18('0x61')]:_0x6e18('0x6f'),'createdAt':moment(_0x4ddcdf[_0x6e18('0x68')])[_0x6e18('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6e18('0x5a')](),'closedAt':_0x4ddcdf[_0x6e18('0x70')]?moment(_0x4ddcdf['closedAt'])[_0x6e18('0x4d')](_0x6e18('0x71'))[_0x6e18('0x5a')]():'','disposition':_0x4ddcdf[_0x6e18('0x72')],'visibility':_0x4ddcdf[_0x6e18('0x73')]?_0x6e18('0x74'):'Private','messages':_(_0x4ddcdf['Messages'])[_0x6e18('0x49')]({'secret':![]})[_0x6e18('0x4a')](function(_0x2d1dfe){if(_0x2d1dfe[_0x6e18('0x66')]){var _0x5b6913=path[_0x6e18('0x5b')](_0x4d7c8b,_0x2d1dfe[_0x6e18('0x66')][_0x6e18('0x75')]);if(fs['existsSync'](_0x5b6913)){fs[_0x6e18('0x76')](_0x5b6913)['pipe'](fs[_0x6e18('0x77')](path['join'](_0x2c51d2,_0x2d1dfe[_0x6e18('0x66')][_0x6e18('0x75')])));}}return{'date':moment(_0x2d1dfe['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6e18('0x5a')](),'sender':_0x2d1dfe[_0x6e18('0x69')]==='out'?_0x2d1dfe[_0x6e18('0x60')]?_0x2d1dfe[_0x6e18('0x60')][_0x6e18('0x61')]:_0x6e18('0x78'):_0x2d1dfe[_0x6e18('0x63')][_0x6e18('0x64')]+(_0x2d1dfe[_0x6e18('0x63')][_0x6e18('0x79')]?'\x20'+_0x2d1dfe[_0x6e18('0x63')]['lastName']:''),'body':_0x2d1dfe['Attachment']?_0x2d1dfe[_0x6e18('0x66')][_0x6e18('0x75')]:_0x2d1dfe[_0x6e18('0x3c')],'direction':_0x2d1dfe[_0x6e18('0x69')]===_0x6e18('0x7a')?'A':'C','secret':_0x2d1dfe[_0x6e18('0x7b')],'read':_0x2d1dfe['read'],'attachment':_0x2d1dfe['Attachment']};})[_0x6e18('0x7c')]()};return ejs[_0x6e18('0x7d')](path['join'](config['root'],_0x6e18('0x7e'),'views',_0x6e18('0x7f')),{'interaction':_0x52c029})[_0x6e18('0x1e')](function(_0xbbedad){var _0x2cae0b=path['join'](_0x2c51d2,'transcript-'+_0x4ddcdf['id']+'-'+_0x1a6537+_0x6e18('0x80'));var _0x18dc66={'path':_0x2cae0b,'channel':_0x6e18('0x81'),'interactionId':_0x4ddcdf['id']};return pdf[_0x6e18('0x82')](_0xbbedad,_0x18dc66);})[_0x6e18('0x1e')](function(){return new Promise(function(_0x3ef8b6,_0x5090b7){zipdir(_0x2c51d2,{'saveTo':_0x22fc31},function(_0x34aa64,_0x40cdee){if(_0x34aa64)return _0x5090b7(_0x34aa64);return _0x3ef8b6(_0x40cdee);});})[_0x6e18('0x1e')](function(){return new Promise(function(_0x3cc8c7,_0x4bf04c){rimraf(_0x2c51d2,function(_0x4ff1f9){if(_0x4ff1f9)_0x4bf04c(_0x4ff1f9);return _0x3cc8c7();});});})['then'](function(){return _0x1b92d3[_0x6e18('0x59')](_0x22fc31,_0xbd5167,function(_0x151245){if(_0x151245){logger[_0x6e18('0x1f')](_0x6e18('0x83'),_0x151245);}else{fs[_0x6e18('0x84')](_0x22fc31);}});});});}else{return _0x1b92d3[_0x6e18('0x13')](0xc8);}})[_0x6e18('0x3a')](handleError(_0x1b92d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f3692d0..d0aee6d 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 _0x2c43=['length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','update','then','setDataValue','Users'];(function(_0x34ed6d,_0xce1d11){var _0x1a5993=function(_0x15131e){while(--_0x15131e){_0x34ed6d['push'](_0x34ed6d['shift']());}};_0x1a5993(++_0xce1d11);}(_0x2c43,0x67));var _0x32c4=function(_0x4035e2,_0x102b9d){_0x4035e2=_0x4035e2-0x0;var _0x1f0ed9=_0x2c43[_0x4035e2];return _0x1f0ed9;};'use strict';var EventEmitter=require(_0x32c4('0x0'));var OpenchannelInteraction=require(_0x32c4('0x1'))['db'][_0x32c4('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x32c4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x81b3d6){return function(_0x1def03,_0x384a38,_0x4d02b8){_0x1def03['getUsers']({'attributes':['id'],'raw':!![]})[_0x32c4('0x4')](function(_0x56588e){_0x1def03[_0x32c4('0x5')](_0x32c4('0x6'),_0x56588e['map'](function(_0x2922e5){return{'id':_0x2922e5['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1def03['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32c4('0x4')](function(_0x549037){_0x1def03['setDataValue']('unreadMessages',_0x549037[_0x32c4('0x7')]);OpenchannelInteractionEvents[_0x32c4('0x8')](_0x81b3d6+':'+_0x1def03['id'],_0x1def03);OpenchannelInteractionEvents[_0x32c4('0x8')](_0x81b3d6,_0x1def03);_0x4d02b8(null);})[_0x32c4('0x9')](_0x4d02b8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x32c4('0xa')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3c63=['update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save'];(function(_0x2a27ef,_0x396a3d){var _0x34edb0=function(_0x3b89fa){while(--_0x3b89fa){_0x2a27ef['push'](_0x2a27ef['shift']());}};_0x34edb0(++_0x396a3d);}(_0x3c63,0xe0));var _0x33c6=function(_0x1d7218,_0x34cc1a){_0x1d7218=_0x1d7218-0x0;var _0x253cd7=_0x3c63[_0x1d7218];return _0x253cd7;};'use strict';var EventEmitter=require(_0x33c6('0x0'));var OpenchannelInteraction=require(_0x33c6('0x1'))['db'][_0x33c6('0x2')];var OpenchannelMessage=require(_0x33c6('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33c6('0x3'),'afterUpdate':_0x33c6('0x4'),'afterDestroy':_0x33c6('0x5')};function emitEvent(_0x3ca3b0){return function(_0xaf053a,_0x4f2e1d,_0x101b59){_0xaf053a[_0x33c6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x425d56){_0xaf053a[_0x33c6('0x7')](_0x33c6('0x8'),_0x425d56[_0x33c6('0x9')](function(_0x302f6e){return{'id':_0x302f6e['id']};}));return OpenchannelMessage[_0x33c6('0xa')]({'where':{'OpenchannelInteractionId':_0xaf053a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x33c6('0xb')](function(_0x3422a7){_0xaf053a['setDataValue'](_0x33c6('0xc'),_0x3422a7[_0x33c6('0xd')]);OpenchannelInteractionEvents[_0x33c6('0xe')](_0x3ca3b0+':'+_0xaf053a['id'],_0xaf053a);OpenchannelInteractionEvents[_0x33c6('0xe')](_0x3ca3b0,_0xaf053a);_0x101b59(null);})[_0x33c6('0xf')](_0x101b59(null));};}for(var e in events){if(events[_0x33c6('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x33c6('0x11')](e,emitEvent(event));}}module[_0x33c6('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ba8bfb6..69b321c 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 _0x1be6=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5ed93c,_0x2906d3){var _0x4e8de8=function(_0x46afa6){while(--_0x46afa6){_0x5ed93c['push'](_0x5ed93c['shift']());}};_0x4e8de8(++_0x2906d3);}(_0x1be6,0x8f));var _0x61be=function(_0x97264,_0x5db8a7){_0x97264=_0x97264-0x0;var _0x4c3d58=_0x1be6[_0x97264];return _0x4c3d58;};'use strict';var _=require(_0x61be('0x0'));var util=require(_0x61be('0x1'));var logger=require(_0x61be('0x2'))(_0x61be('0x3'));var moment=require('moment');var BPromise=require(_0x61be('0x4'));var rp=require(_0x61be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x61be('0x6'));var attributes=require(_0x61be('0x7'));module['exports']=function(_0x2d4001,_0x176e04){return _0x2d4001['define'](_0x61be('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61be('0x9'),'collate':_0x61be('0xa'),'hooks':{'beforeUpdate':function(_0x2853a6,_0x1f4f9c,_0x56ab67){if(_0x2853a6[_0x61be('0xb')](_0x61be('0xc'))){_0x2853a6[_0x61be('0xd')]=moment()[_0x61be('0xe')](_0x61be('0xf'));}_0x56ab67(null,_0x2853a6);}}});}; \ No newline at end of file +var _0x2e8f=['utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x2394cd,_0x2c07a1){var _0x19fe9a=function(_0x7323){while(--_0x7323){_0x2394cd['push'](_0x2394cd['shift']());}};_0x19fe9a(++_0x2c07a1);}(_0x2e8f,0x180));var _0xf2e8=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x2e8f[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require(_0xf2e8('0x0'));var util=require('util');var logger=require(_0xf2e8('0x1'))(_0xf2e8('0x2'));var moment=require(_0xf2e8('0x3'));var BPromise=require(_0xf2e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2e8('0x5'));var rimraf=require(_0xf2e8('0x6'));var config=require(_0xf2e8('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xf2e8('0x8')]=function(_0x402ea0,_0x3004af){return _0x402ea0[_0xf2e8('0x9')](_0xf2e8('0xa'),attributes,{'tableName':_0xf2e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2e8('0xc'),'collate':_0xf2e8('0xd'),'hooks':{'beforeUpdate':function(_0x37f7a4,_0xef970d,_0x52a34e){if(_0x37f7a4[_0xf2e8('0xe')](_0xf2e8('0xf'))){_0x37f7a4['closedAt']=moment()[_0xf2e8('0x10')](_0xf2e8('0x11'));}_0x52a34e(null,_0x37f7a4);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e01bfd6..f0e6a8d 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 _0xc148=['find','body','ids','omit','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','debug'];(function(_0x361d7a,_0x53aa8f){var _0x107d0b=function(_0x5087db){while(--_0x5087db){_0x361d7a['push'](_0x361d7a['shift']());}};_0x107d0b(++_0x53aa8f);}(_0xc148,0x7d));var _0x8c14=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc148[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x8c14('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c14('0x1'));var fs=require('fs');var Redis=require(_0x8c14('0x2'));var db=require(_0x8c14('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c14('0x4'))(_0x8c14('0x5'));var config=require(_0x8c14('0x6'));var jayson=require(_0x8c14('0x7'));var client=jayson['client'][_0x8c14('0x8')]({'port':0x232a});config[_0x8c14('0x9')]=_[_0x8c14('0xa')](config[_0x8c14('0x9')],{'host':_0x8c14('0xb'),'port':0x18eb});var socket=require(_0x8c14('0xc'))(new Redis(config['redis']));require(_0x8c14('0xd'))[_0x8c14('0xe')](socket);function respondWithRpcPromise(_0x23cb3e,_0x314713,_0x25cb5a){return new BPromise(function(_0x4645b9,_0x4d4519){return client[_0x8c14('0xf')](_0x23cb3e,_0x25cb5a)[_0x8c14('0x10')](function(_0x7cbb05){logger[_0x8c14('0x11')](_0x8c14('0x12'),_0x314713,_0x8c14('0x13'));logger['debug'](_0x8c14('0x14'),_0x314713,_0x8c14('0x13'),JSON[_0x8c14('0x15')](_0x7cbb05));if(_0x7cbb05[_0x8c14('0x16')]){if(_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x17')]===0x1f4){logger[_0x8c14('0x16')](_0x8c14('0x12'),_0x314713,_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);return _0x4d4519(_0x7cbb05['error'][_0x8c14('0x18')]);}logger[_0x8c14('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x314713,_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);return _0x4645b9(_0x7cbb05[_0x8c14('0x16')][_0x8c14('0x18')]);}else{logger[_0x8c14('0x11')](_0x8c14('0x12'),_0x314713,'request\x20sent');_0x4645b9(_0x7cbb05[_0x8c14('0x19')][_0x8c14('0x18')]);}})[_0x8c14('0x1a')](function(_0x2aa8da){logger[_0x8c14('0x16')](_0x8c14('0x12'),_0x314713,_0x2aa8da);_0x4d4519(_0x2aa8da);});});}exports[_0x8c14('0x1b')]=function(_0x40ca32){var _0x4af6c2=this;return new Promise(function(_0x273d98,_0x1c63bf){return db[_0x8c14('0x1c')]['update'](_0x40ca32['body'],{'raw':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32['options'][_0x8c14('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32['options'][_0x8c14('0x1f')]||null:null,'attributes':_0x40ca32[_0x8c14('0x1d')]?_0x40ca32[_0x8c14('0x1d')][_0x8c14('0x20')]||null:null,'limit':_0x40ca32['options']?_0x40ca32[_0x8c14('0x1d')][_0x8c14('0x21')]||null:null})[_0x8c14('0x10')](function(_0xdeffc3){logger[_0x8c14('0x11')]('UpdateOpenchannelInteraction',_0x40ca32);logger[_0x8c14('0x22')](_0x8c14('0x1b'),_0x40ca32,JSON[_0x8c14('0x15')](_0xdeffc3));_0x273d98(_0xdeffc3);})[_0x8c14('0x1a')](function(_0x3ae0b7){logger[_0x8c14('0x16')](_0x8c14('0x1b'),_0x3ae0b7['message'],_0x40ca32);_0x1c63bf(_0x4af6c2[_0x8c14('0x16')](0x1f4,_0x3ae0b7[_0x8c14('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x43c12e){return new Promise(function(_0x3780cd,_0xbb0d23){return db['OpenchannelInteraction'][_0x8c14('0x23')]({'where':_0x43c12e[_0x8c14('0x1d')]?_0x43c12e[_0x8c14('0x1d')]['where']||null:null})[_0x8c14('0x10')](function(_0x3e94e5){if(_0x3e94e5){return _0x3e94e5['addTags'](_0x43c12e[_0x8c14('0x24')][_0x8c14('0x25')],_[_0x8c14('0x26')](_0x43c12e[_0x8c14('0x24')],['ids','id'])||{});}})['spread'](function(_0x1918f3){logger['info']('AddTags',_0x43c12e);logger[_0x8c14('0x22')]('AddTags',_0x43c12e,JSON[_0x8c14('0x15')](_0x1918f3));_0x3780cd(_0x1918f3);})[_0x8c14('0x1a')](function(_0xf9eabe){logger[_0x8c14('0x16')](_0x8c14('0x27'),_0xf9eabe[_0x8c14('0x18')],_0x43c12e);_0xbb0d23(_this[_0x8c14('0x16')](0x1f4,_0xf9eabe[_0x8c14('0x18')]));});});}; \ No newline at end of file +var _0x8abb=['attributes','then','debug','catch','AddTagsToOpenchannelInteraction','addTags','omit','ids','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where'];(function(_0x477282,_0x169cd1){var _0x34d1e8=function(_0x50751e){while(--_0x50751e){_0x477282['push'](_0x477282['shift']());}};_0x34d1e8(++_0x169cd1);}(_0x8abb,0xc2));var _0xb8ab=function(_0x2df308,_0x142c10){_0x2df308=_0x2df308-0x0;var _0x3bc0f1=_0x8abb[_0x2df308];return _0x3bc0f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb8ab('0x0'));var BPromise=require(_0xb8ab('0x1'));var rs=require(_0xb8ab('0x2'));var fs=require('fs');var Redis=require(_0xb8ab('0x3'));var db=require(_0xb8ab('0x4'))['db'];var utils=require(_0xb8ab('0x5'));var logger=require(_0xb8ab('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8ab('0x7')][_0xb8ab('0x8')]({'port':0x232a});config[_0xb8ab('0x9')]=_['defaults'](config[_0xb8ab('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ab('0xa'))(new Redis(config[_0xb8ab('0x9')]));require(_0xb8ab('0xb'))[_0xb8ab('0xc')](socket);function respondWithRpcPromise(_0x579891,_0xcc1ef0,_0x4c9740){return new BPromise(function(_0x2135a3,_0x2574e4){return client[_0xb8ab('0xd')](_0x579891,_0x4c9740)['then'](function(_0x343f29){logger['info'](_0xb8ab('0xe'),_0xcc1ef0,'request\x20sent');logger['debug'](_0xb8ab('0xf'),_0xcc1ef0,'request\x20sent',JSON[_0xb8ab('0x10')](_0x343f29));if(_0x343f29[_0xb8ab('0x11')]){if(_0x343f29['error'][_0xb8ab('0x12')]===0x1f4){logger[_0xb8ab('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xcc1ef0,_0x343f29[_0xb8ab('0x11')]['message']);return _0x2574e4(_0x343f29[_0xb8ab('0x11')][_0xb8ab('0x13')]);}logger[_0xb8ab('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xcc1ef0,_0x343f29[_0xb8ab('0x11')][_0xb8ab('0x13')]);return _0x2135a3(_0x343f29[_0xb8ab('0x11')]['message']);}else{logger[_0xb8ab('0x14')](_0xb8ab('0xe'),_0xcc1ef0,'request\x20sent');_0x2135a3(_0x343f29[_0xb8ab('0x15')]['message']);}})['catch'](function(_0xc3c39a){logger[_0xb8ab('0x11')](_0xb8ab('0xe'),_0xcc1ef0,_0xc3c39a);_0x2574e4(_0xc3c39a);});});}exports[_0xb8ab('0x16')]=function(_0x2cb4f2){var _0x5b909d=this;return new Promise(function(_0x151c01,_0x3a6415){return db[_0xb8ab('0x17')]['update'](_0x2cb4f2[_0xb8ab('0x18')],{'raw':_0x2cb4f2[_0xb8ab('0x19')]?_0x2cb4f2[_0xb8ab('0x19')][_0xb8ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cb4f2[_0xb8ab('0x19')]?_0x2cb4f2['options'][_0xb8ab('0x1b')]||null:null,'attributes':_0x2cb4f2[_0xb8ab('0x19')]?_0x2cb4f2[_0xb8ab('0x19')][_0xb8ab('0x1c')]||null:null,'limit':_0x2cb4f2[_0xb8ab('0x19')]?_0x2cb4f2['options']['limit']||null:null})[_0xb8ab('0x1d')](function(_0x55f4ae){logger[_0xb8ab('0x14')]('UpdateOpenchannelInteraction',_0x2cb4f2);logger[_0xb8ab('0x1e')](_0xb8ab('0x16'),_0x2cb4f2,JSON[_0xb8ab('0x10')](_0x55f4ae));_0x151c01(_0x55f4ae);})[_0xb8ab('0x1f')](function(_0x3ba842){logger[_0xb8ab('0x11')](_0xb8ab('0x16'),_0x3ba842[_0xb8ab('0x13')],_0x2cb4f2);_0x3a6415(_0x5b909d['error'](0x1f4,_0x3ba842[_0xb8ab('0x13')]));});});};exports[_0xb8ab('0x20')]=function(_0x472731){return new Promise(function(_0x396aa7,_0x4ffaf4){return db[_0xb8ab('0x17')]['find']({'where':_0x472731[_0xb8ab('0x19')]?_0x472731['options'][_0xb8ab('0x1b')]||null:null})['then'](function(_0x212ba9){if(_0x212ba9){return _0x212ba9[_0xb8ab('0x21')](_0x472731[_0xb8ab('0x18')]['ids'],_[_0xb8ab('0x22')](_0x472731[_0xb8ab('0x18')],[_0xb8ab('0x23'),'id'])||{});}})['spread'](function(_0x45a2bf){logger['info'](_0xb8ab('0x24'),_0x472731);logger[_0xb8ab('0x1e')](_0xb8ab('0x24'),_0x472731,JSON[_0xb8ab('0x10')](_0x45a2bf));_0x396aa7(_0x45a2bf);})[_0xb8ab('0x1f')](function(_0xd48a6e){logger[_0xb8ab('0x11')]('AddTags',_0xd48a6e['message'],_0x472731);_0x4ffaf4(_this[_0xb8ab('0x11')](0x1f4,_0xd48a6e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a476dd8..a6853a3 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 _0x5473=['./openchannelInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x3ba553,_0x1b3afb){var _0x2c8bbf=function(_0x26ba01){while(--_0x26ba01){_0x3ba553['push'](_0x3ba553['shift']());}};_0x2c8bbf(++_0x1b3afb);}(_0x5473,0x19d));var _0x3547=function(_0x4f8e84,_0x36adc9){_0x4f8e84=_0x4f8e84-0x0;var _0x2ab68f=_0x5473[_0x4f8e84];return _0x2ab68f;};'use strict';var OpenchannelInteractionEvents=require(_0x3547('0x0'));var events=[_0x3547('0x1'),'remove',_0x3547('0x2')];function createListener(_0x277630,_0x43e7a0){return function(_0x245217){_0x43e7a0[_0x3547('0x3')](_0x277630,_0x245217);};}function removeListener(_0x28e3d4,_0xf1c1f1){return function(){OpenchannelInteractionEvents[_0x3547('0x4')](_0x28e3d4,_0xf1c1f1);};}exports[_0x3547('0x5')]=function(_0x5d0a1f){for(var _0x197905=0x0,_0x42c1b8=events[_0x3547('0x6')];_0x197905<_0x42c1b8;_0x197905++){var _0x3fdc02=events[_0x197905];var _0x9acc25=createListener('openchannelInteraction:'+_0x3fdc02,_0x5d0a1f);OpenchannelInteractionEvents['on'](_0x3fdc02,_0x9acc25);}}; \ No newline at end of file +var _0xd486=['remove','update','removeListener','register','length','openchannelInteraction:','save'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xd486,0x172));var _0x6d48=function(_0x5a6be0,_0x247442){_0x5a6be0=_0x5a6be0-0x0;var _0x32096e=_0xd486[_0x5a6be0];return _0x32096e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x6d48('0x0'),_0x6d48('0x1'),_0x6d48('0x2')];function createListener(_0x115be2,_0x3a388d){return function(_0x5e4ac9){_0x3a388d['emit'](_0x115be2,_0x5e4ac9);};}function removeListener(_0x261a11,_0x25eef4){return function(){OpenchannelInteractionEvents[_0x6d48('0x3')](_0x261a11,_0x25eef4);};}exports[_0x6d48('0x4')]=function(_0x17c4c7){for(var _0x446c9f=0x0,_0xe79fe7=events[_0x6d48('0x5')];_0x446c9f<_0xe79fe7;_0x446c9f++){var _0x3eb062=events[_0x446c9f];var _0x28697a=createListener(_0x6d48('0x6')+_0x3eb062,_0x17c4c7);OpenchannelInteractionEvents['on'](_0x3eb062,_0x28697a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 794bd86..76e53fe 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x73aef5,_0x5b2293){var _0x29be73=function(_0x1c9129){while(--_0x1c9129){_0x73aef5['push'](_0x73aef5['shift']());}};_0x29be73(++_0x5b2293);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2a6ab8,_0x5eb621){var _0x5752ab=function(_0x49766d){while(--_0x49766d){_0x2a6ab8['push'](_0x2a6ab8['shift']());}};_0x5752ab(++_0x5eb621);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xcb91[_0x1dbaf7];return _0x593f05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5fd3e0c..7556fca 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 _0xf69c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x27efc5,_0x4afa2a){var _0x17cc9e=function(_0x185b38){while(--_0x185b38){_0x27efc5['push'](_0x27efc5['shift']());}};_0x17cc9e(++_0x4afa2a);}(_0xf69c,0x1e2));var _0xcf69=function(_0x44e78e,_0x5f2ba5){_0x44e78e=_0x44e78e-0x0;var _0xff1bb2=_0xf69c[_0x44e78e];return _0xff1bb2;};'use strict';var Sequelize=require(_0xcf69('0x0'));module[_0xcf69('0x1')]={'body':{'type':Sequelize[_0xcf69('0x2')](_0xcf69('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xcf69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf69('0x5')]('in',_0xcf69('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xcf69('0x7')]},'providerName':{'type':Sequelize[_0xcf69('0x8')]},'providerResponse':{'type':Sequelize[_0xcf69('0x2')]}}; \ No newline at end of file +var _0x9d9b=['STRING','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x111b19,_0x5c0b26){_0x111b19=_0x111b19-0x0;var _0x2aa1cc=_0x9d9b[_0x111b19];return _0x2aa1cc;};'use strict';var Sequelize=require('sequelize');module[_0xb9d9('0x0')]={'body':{'type':Sequelize[_0xb9d9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb9d9('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb9d9('0x3')]('in',_0xb9d9('0x4')),'defaultValue':_0xb9d9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb9d9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 82a2e6d..4468e94 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 _0x6c25=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','motionChannel','event','rejectmessage','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params','find','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction'];(function(_0x4ab77c,_0x13a5fc){var _0x35bc3d=function(_0x151ff3){while(--_0x151ff3){_0x4ab77c['push'](_0x4ab77c['shift']());}};_0x35bc3d(++_0x13a5fc);}(_0x6c25,0x9d));var _0x56c2=function(_0x4ea37f,_0x43cd78){_0x4ea37f=_0x4ea37f-0x0;var _0x1578ba=_0x6c25[_0x4ea37f];return _0x1578ba;};'use strict';var emlformat=require(_0x56c2('0x0'));var rimraf=require(_0x56c2('0x1'));var zipdir=require(_0x56c2('0x2'));var jsonpatch=require(_0x56c2('0x3'));var rp=require('request-promise');var moment=require(_0x56c2('0x4'));var BPromise=require(_0x56c2('0x5'));var Mustache=require(_0x56c2('0x6'));var util=require(_0x56c2('0x7'));var path=require(_0x56c2('0x8'));var sox=require(_0x56c2('0x9'));var csv=require(_0x56c2('0xa'));var ejs=require(_0x56c2('0xb'));var fs=require('fs');var fs_extra=require(_0x56c2('0xc'));var _=require('lodash');var squel=require(_0x56c2('0xd'));var crypto=require(_0x56c2('0xe'));var jsforce=require(_0x56c2('0xf'));var deskjs=require(_0x56c2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56c2('0x11'));var Papa=require(_0x56c2('0x12'));var Redis=require(_0x56c2('0x13'));var authService=require(_0x56c2('0x14'));var qs=require(_0x56c2('0x15'));var as=require(_0x56c2('0x16'));var hardwareService=require(_0x56c2('0x17'));var logger=require(_0x56c2('0x18'))('api');var utils=require(_0x56c2('0x19'));var config=require(_0x56c2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c2('0x1b'))['db'];config['redis']=_[_0x56c2('0x1c')](config[_0x56c2('0x1d')],{'host':_0x56c2('0x1e'),'port':0x18eb});var socket=require(_0x56c2('0x1f'))(new Redis(config['redis']));require(_0x56c2('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x56c2('0x21')][_0x56c2('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x57b40e,_0x436024,_0x1d0374,_0x5ab627){return new BPromise(function(_0x4fb634,_0x19905d){var _0x2b0470=_0x5ab627||client;return _0x2b0470['request'](_0x57b40e,_0x1d0374)[_0x56c2('0x23')](function(_0x2a87e0){logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,_0x56c2('0x26'));logger['debug'](_0x56c2('0x27'),_0x436024,'request\x20sent',JSON[_0x56c2('0x28')](_0x2a87e0));if(_0x2a87e0[_0x56c2('0x29')]){if(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2a')]===0x1f4){logger[_0x56c2('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x436024,_0x2a87e0[_0x56c2('0x29')]['message']);return _0x19905d(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}logger['error'](_0x56c2('0x25'),_0x436024,_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);return _0x4fb634(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}else{logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,'request\x20sent');_0x4fb634(_0x2a87e0[_0x56c2('0x2c')][_0x56c2('0x2b')]);}})[_0x56c2('0x2d')](function(_0x4b326f){logger[_0x56c2('0x29')](_0x56c2('0x25'),_0x436024,_0x4b326f);_0x19905d(_0x4b326f);});});}function respondWithStatusCode(_0x4e6561,_0x1c97d5){_0x1c97d5=_0x1c97d5||0xcc;return function(_0x19780f){if(_0x19780f){return _0x4e6561[_0x56c2('0x2e')](_0x1c97d5);}return _0x4e6561[_0x56c2('0x2f')](_0x1c97d5)[_0x56c2('0x30')]();};}function respondWithResult(_0x3bd4eb,_0x2a2a71){_0x2a2a71=_0x2a2a71||0xc8;return function(_0x187079){if(_0x187079){return _0x3bd4eb[_0x56c2('0x2f')](_0x2a2a71)[_0x56c2('0x31')](_0x187079);}};}function respondWithFilteredResult(_0x232c0f,_0x3fabc7){return function(_0x56f161){if(_0x56f161){var _0xf0f454=typeof _0x3fabc7[_0x56c2('0x32')]===_0x56c2('0x33')&&typeof _0x3fabc7['limit']===_0x56c2('0x33');var _0x5bfd82=_0x56f161[_0x56c2('0x34')];var _0x13d5ff=_0xf0f454?0x0:_0x3fabc7[_0x56c2('0x32')];var _0x5d63e5=_0xf0f454?_0x56f161['count']:_0x3fabc7[_0x56c2('0x32')]+_0x3fabc7['limit'];var _0x3f5802;if(_0x5d63e5>=_0x5bfd82){_0x5d63e5=_0x5bfd82;_0x3f5802=0xc8;}else{_0x3f5802=0xce;}_0x232c0f[_0x56c2('0x2f')](_0x3f5802);return _0x232c0f[_0x56c2('0x35')]('Content-Range',_0x13d5ff+'-'+_0x5d63e5+'/'+_0x5bfd82)[_0x56c2('0x31')](_0x56f161);}return null;};}function patchUpdates(_0x2f5dbd){return function(_0x3434d5){try{jsonpatch['apply'](_0x3434d5,_0x2f5dbd,!![]);}catch(_0x2cb1ae){return BPromise[_0x56c2('0x36')](_0x2cb1ae);}return _0x3434d5[_0x56c2('0x37')]();};}function saveUpdates(_0x318ff6,_0x3ee92f){return function(_0x3052e6){if(_0x3052e6){return _0x3052e6[_0x56c2('0x38')](_0x318ff6)[_0x56c2('0x23')](function(_0x26a2fa){return _0x26a2fa;});}return null;};}function removeEntity(_0x1ddf2e,_0x9c6bb8){return function(_0x48af43){if(_0x48af43){return _0x48af43[_0x56c2('0x39')]()[_0x56c2('0x23')](function(){_0x1ddf2e[_0x56c2('0x2f')](0xcc)[_0x56c2('0x30')]();});}};}function handleEntityNotFound(_0xe8b81f,_0x14a4e8){return function(_0x2f0a48){if(!_0x2f0a48){_0xe8b81f[_0x56c2('0x2e')](0x194);}return _0x2f0a48;};}function handleError(_0xddf64b,_0x50f615){_0x50f615=_0x50f615||0x1f4;return function(_0x2a8187){logger['error'](_0x2a8187['stack']);if(_0x2a8187['name']){delete _0x2a8187[_0x56c2('0x3a')];}_0xddf64b['status'](_0x50f615)[_0x56c2('0x3b')](_0x2a8187);};}exports[_0x56c2('0x3c')]=function(_0x3e95a9,_0x14cad7){var _0x3d0696={},_0x5b9db0={},_0x25db36={'count':0x0,'rows':[]};var _0x2e1c3e=_[_0x56c2('0x3d')](db[_0x56c2('0x3e')][_0x56c2('0x3f')],function(_0x10c16c){return{'name':_0x10c16c[_0x56c2('0x40')],'type':_0x10c16c[_0x56c2('0x41')][_0x56c2('0x42')]};});_0x5b9db0['model']=_[_0x56c2('0x3d')](_0x2e1c3e,_0x56c2('0x3a'));_0x5b9db0['query']=_['keys'](_0x3e95a9[_0x56c2('0x43')]);_0x5b9db0[_0x56c2('0x44')]=_[_0x56c2('0x45')](_0x5b9db0[_0x56c2('0x46')],_0x5b9db0[_0x56c2('0x43')]);_0x3d0696[_0x56c2('0x47')]=_[_0x56c2('0x45')](_0x5b9db0['model'],qs['fields'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x48')]));_0x3d0696[_0x56c2('0x47')]=_0x3d0696['attributes'][_0x56c2('0x49')]?_0x3d0696[_0x56c2('0x47')]:_0x5b9db0[_0x56c2('0x46')];if(!_0x3e95a9['query']['hasOwnProperty'](_0x56c2('0x4a'))){_0x3d0696['limit']=qs[_0x56c2('0x4b')](_0x3e95a9['query'][_0x56c2('0x4b')]);_0x3d0696[_0x56c2('0x32')]=qs['offset'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x32')]);}_0x3d0696[_0x56c2('0x4c')]=qs[_0x56c2('0x4d')](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4d')]);_0x3d0696['where']=qs[_0x56c2('0x44')](_['pick'](_0x3e95a9[_0x56c2('0x43')],_0x5b9db0[_0x56c2('0x44')]),_0x2e1c3e);if(_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]){_0x3d0696[_0x56c2('0x4f')]=_[_0x56c2('0x50')](_0x3d0696[_0x56c2('0x4f')],{'$or':_[_0x56c2('0x3d')](_0x2e1c3e,function(_0x4a32ee){if(_0x4a32ee[_0x56c2('0x41')]!==_0x56c2('0x51')){var _0x89a99f={};_0x89a99f[_0x4a32ee['name']]={'$like':'%'+_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]+'%'};return _0x89a99f;}})});}_0x3d0696=_[_0x56c2('0x50')]({},_0x3d0696,_0x3e95a9[_0x56c2('0x52')]);var _0x2bdb71={'where':_0x3d0696[_0x56c2('0x4f')]};return db[_0x56c2('0x3e')][_0x56c2('0x34')](_0x2bdb71)['then'](function(_0x40492d){_0x25db36[_0x56c2('0x34')]=_0x40492d;if(_0x3e95a9['query']['includeAll']){_0x3d0696[_0x56c2('0x53')]=[{'all':!![]}];}return db[_0x56c2('0x3e')][_0x56c2('0x54')](_0x3d0696);})[_0x56c2('0x23')](function(_0x1693ee){_0x25db36['rows']=_0x1693ee;return _0x25db36;})[_0x56c2('0x23')](respondWithFilteredResult(_0x14cad7,_0x3d0696))[_0x56c2('0x2d')](handleError(_0x14cad7,null));};exports[_0x56c2('0x55')]=function(_0x24fc75,_0x2c12b4){var _0x4cb5bb={'raw':!![],'where':{'id':_0x24fc75[_0x56c2('0x56')]['id']}},_0x419fc2={};_0x419fc2[_0x56c2('0x46')]=_['keys'](db[_0x56c2('0x3e')]['rawAttributes']);_0x419fc2[_0x56c2('0x43')]=_['keys'](_0x24fc75[_0x56c2('0x43')]);_0x419fc2['filters']=_[_0x56c2('0x45')](_0x419fc2['model'],_0x419fc2[_0x56c2('0x43')]);_0x4cb5bb[_0x56c2('0x47')]=_['intersection'](_0x419fc2[_0x56c2('0x46')],qs[_0x56c2('0x48')](_0x24fc75[_0x56c2('0x43')][_0x56c2('0x48')]));_0x4cb5bb['attributes']=_0x4cb5bb[_0x56c2('0x47')][_0x56c2('0x49')]?_0x4cb5bb[_0x56c2('0x47')]:_0x419fc2[_0x56c2('0x46')];if(_0x24fc75['query']['includeAll']){_0x4cb5bb[_0x56c2('0x53')]=[{'all':!![]}];}_0x4cb5bb=_[_0x56c2('0x50')]({},_0x4cb5bb,_0x24fc75[_0x56c2('0x52')]);return db[_0x56c2('0x3e')][_0x56c2('0x57')](_0x4cb5bb)[_0x56c2('0x23')](handleEntityNotFound(_0x2c12b4,null))['then'](respondWithResult(_0x2c12b4,null))['catch'](handleError(_0x2c12b4,null));};exports['create']=function(_0x2bab39,_0xb96ef0){return db['OpenchannelMessage']['create'](_0x2bab39[_0x56c2('0x58')],{})[_0x56c2('0x23')](respondWithResult(_0xb96ef0,0xc9))[_0x56c2('0x2d')](handleError(_0xb96ef0,null));};exports[_0x56c2('0x38')]=function(_0x5706d5,_0x1f105b){if(_0x5706d5[_0x56c2('0x58')]['id']){delete _0x5706d5[_0x56c2('0x58')]['id'];}return db['OpenchannelMessage'][_0x56c2('0x57')]({'where':{'id':_0x5706d5[_0x56c2('0x56')]['id']}})[_0x56c2('0x23')](handleEntityNotFound(_0x1f105b,null))[_0x56c2('0x23')](saveUpdates(_0x5706d5[_0x56c2('0x58')],null))[_0x56c2('0x23')](respondWithResult(_0x1f105b,null))[_0x56c2('0x2d')](handleError(_0x1f105b,null));};exports[_0x56c2('0x39')]=function(_0x2ef814,_0x5419a7){return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x2ef814[_0x56c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5419a7,null))[_0x56c2('0x23')](removeEntity(_0x5419a7,null))['catch'](handleError(_0x5419a7,null));};exports[_0x56c2('0x59')]=function(_0x1b5b27,_0x7d1e2f){return db['OpenchannelMessage'][_0x56c2('0x59')]()[_0x56c2('0x23')](respondWithResult(_0x7d1e2f,null))['catch'](handleError(_0x7d1e2f,null));};var interaction_log=require(_0x56c2('0x18'))('openchannel-interactions');exports[_0x56c2('0x5a')]=function(_0x2e8247,_0x324ca5,_0x132709){var _0x7a69a4={'agent':{},'channel':'openchannel'};if(_0x2e8247['body']['id']){delete _0x2e8247[_0x56c2('0x58')]['id'];}_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5b')]=!![];_0x2e8247[_0x56c2('0x58')]['readAt']=moment()[_0x56c2('0x5c')](_0x56c2('0x5d'));_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]||_0x2e8247[_0x56c2('0x5f')]['id'];_0x7a69a4[_0x56c2('0x60')]['id']=_0x2e8247[_0x56c2('0x58')]['UserId'];return db[_0x56c2('0x3e')]['find']({'where':{'id':_0x2e8247[_0x56c2('0x56')]['id'],'UserId':null}})[_0x56c2('0x23')](handleEntityNotFound(_0x324ca5,null))['then'](saveUpdates(_0x2e8247[_0x56c2('0x58')],null))[_0x56c2('0x23')](function(_0x362ee8){if(_0x362ee8){_0x7a69a4[_0x56c2('0x2b')]=_0x362ee8[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x362ee8['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x324ca5,null))[_0x56c2('0x23')](function(_0x8e3f4f){if(_0x8e3f4f){return _0x8e3f4f[_0x56c2('0x38')]({'UserId':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'read1stAt':_[_0x56c2('0x62')](_0x8e3f4f[_0x56c2('0x63')])?moment()[_0x56c2('0x5c')](_0x56c2('0x5d')):undefined});}return null;})[_0x56c2('0x23')](function(_0x4c522f){if(_0x4c522f){_0x7a69a4[_0x56c2('0x64')]=_0x4c522f[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x65'),_0x2e8247['user']['id'],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x66')],_0x7a69a4[_0x56c2('0x64')]['id'],_0x2e8247[_0x56c2('0x58')]?JSON[_0x56c2('0x28')](_0x2e8247[_0x56c2('0x58')]):'null');return respondWithRpcPromise(_0x56c2('0x67'),_0x56c2('0x68'),_0x7a69a4);}return null;})['then'](function(_0x4a41e7){var _0x4c956c=_0x56c2('0x69')+_0x4a41e7[_0x56c2('0x2b')]['ContactId'];return db['sequelize']['query'](_0x4c956c,{'type':db[_0x56c2('0x6a')][_0x56c2('0x6b')]['SELECT'],'raw':!![]})[_0x56c2('0x23')](function(_0x36537a){return _0x36537a;});})[_0x56c2('0x23')](function(_0x6a9e91){if(_0x6a9e91){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x6a9e91[0x0];if(!_0x2e8247[_0x56c2('0x58')]['UserId'])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),_0x56c2('0x6e'),_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})[_0x56c2('0x23')](function(_0x14e4c5){if(!_0x14e4c5)return null;_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x60')]=_0x14e4c5;return _0x7a69a4;})[_0x56c2('0x23')](function(_0x19300f){if(_0x19300f){if(_0x2e8247[_0x56c2('0x58')][_0x56c2('0x71')]){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x72')]=util[_0x56c2('0x5c')](_0x56c2('0x73'),_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4['message']['motionChannel']=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4[_0x56c2('0x2b')]['event']=_0x56c2('0x5a');return respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':'acceptmessage','message':_0x7a69a4[_0x56c2('0x2b')]},client9002)[_0x56c2('0x23')](function(){return _0x7a69a4;});}return _0x7a69a4;}return null;})['then'](respondWithResult(_0x324ca5,null))[_0x56c2('0x2d')](handleError(_0x324ca5,null));};var interaction_log=require('../../config/logger')(_0x56c2('0x76'));exports[_0x56c2('0x36')]=function(_0x1d7ae7,_0x4211b6,_0x3b877c){var _0x5cdfc5={'agent':{},'channel':_0x56c2('0x77')};if(_0x1d7ae7[_0x56c2('0x58')]['id']){delete _0x1d7ae7[_0x56c2('0x58')]['id'];}_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x1d7ae7['body'][_0x56c2('0x5e')]||_0x1d7ae7[_0x56c2('0x5f')]['id'];_0x5cdfc5[_0x56c2('0x60')]['id']=_0x1d7ae7['body']['UserId'];return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0x113b29){if(_0x113b29){_0x5cdfc5['message']=_0x113b29[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x113b29[_0x56c2('0x78')]}});}return null;})[_0x56c2('0x23')](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0xf18e77){if(_0xf18e77){_0x5cdfc5['interaction']=_0xf18e77[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x79'),_0x1d7ae7[_0x56c2('0x5f')]['id'],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x66')],_0x5cdfc5['interaction']['id'],_0x1d7ae7[_0x56c2('0x58')]?JSON['stringify'](_0x1d7ae7['body']):_0x56c2('0x7a'));return respondWithRpcPromise(_0x56c2('0x7b'),_0x56c2('0x7c'),_0x5cdfc5);}return null;})[_0x56c2('0x23')](function(_0x47860c){var _0x218176='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47860c['message'][_0x56c2('0x7d')];return db['sequelize'][_0x56c2('0x43')](_0x218176,{'type':db[_0x56c2('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0xc85ef3){return _0xc85ef3;});})[_0x56c2('0x23')](function(_0x276ca0){if(_0x276ca0){_0x5cdfc5[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x276ca0[0x0];if(!_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),'fullname',_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})['then'](function(_0x28b4fe){if(!_0x28b4fe)return null;_0x5cdfc5['message'][_0x56c2('0x60')]=_0x28b4fe;return _0x5cdfc5;})['then'](function(_0x85fcf){if(_0x85fcf){_0x85fcf['message'][_0x56c2('0x72')]=util['format'](_0x56c2('0x73'),_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x5cdfc5[_0x56c2('0x74')];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7e')]=_0x5cdfc5['channel'];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':_0x56c2('0x80'),'message':_0x85fcf[_0x56c2('0x2b')]},client9002);return _0x5cdfc5;}return null;})[_0x56c2('0x23')](respondWithResult(_0x4211b6,null))['catch'](handleError(_0x4211b6,null));}; \ No newline at end of file +var _0x1d7e=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','destroy','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','OpenchannelMessage','includeAll','include','findAll','rows','show','find','create','body','update','params','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','format','motionChannel','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1d7e[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];config[_0xe1d7('0x17')]=_[_0xe1d7('0x18')](config[_0xe1d7('0x17')],{'host':_0xe1d7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1d7('0x17')]));require(_0xe1d7('0x1a'))[_0xe1d7('0x1b')](socket);var jayson=require(_0xe1d7('0x1c'));var client=jayson[_0xe1d7('0x1d')][_0xe1d7('0x1e')]({'port':0x232c});var client9002=jayson[_0xe1d7('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x391f55,_0x328898,_0x419cf3,_0x56e1c6){return new BPromise(function(_0x41cd11,_0x1f6980){var _0x800c15=_0x56e1c6||client;return _0x800c15[_0xe1d7('0x1f')](_0x391f55,_0x419cf3)[_0xe1d7('0x20')](function(_0x446ce6){logger[_0xe1d7('0x21')](_0xe1d7('0x22'),_0x328898,_0xe1d7('0x23'));logger[_0xe1d7('0x24')](_0xe1d7('0x25'),_0x328898,_0xe1d7('0x23'),JSON['stringify'](_0x446ce6));if(_0x446ce6[_0xe1d7('0x26')]){if(_0x446ce6[_0xe1d7('0x26')][_0xe1d7('0x27')]===0x1f4){logger[_0xe1d7('0x26')](_0xe1d7('0x22'),_0x328898,_0x446ce6['error'][_0xe1d7('0x28')]);return _0x1f6980(_0x446ce6[_0xe1d7('0x26')][_0xe1d7('0x28')]);}logger[_0xe1d7('0x26')](_0xe1d7('0x22'),_0x328898,_0x446ce6['error'][_0xe1d7('0x28')]);return _0x41cd11(_0x446ce6[_0xe1d7('0x26')][_0xe1d7('0x28')]);}else{logger[_0xe1d7('0x21')](_0xe1d7('0x22'),_0x328898,_0xe1d7('0x23'));_0x41cd11(_0x446ce6[_0xe1d7('0x29')][_0xe1d7('0x28')]);}})[_0xe1d7('0x2a')](function(_0x2e47f7){logger['error'](_0xe1d7('0x22'),_0x328898,_0x2e47f7);_0x1f6980(_0x2e47f7);});});}function respondWithStatusCode(_0x7c1923,_0x3abcb3){_0x3abcb3=_0x3abcb3||0xcc;return function(_0x4fea12){if(_0x4fea12){return _0x7c1923[_0xe1d7('0x2b')](_0x3abcb3);}return _0x7c1923[_0xe1d7('0x2c')](_0x3abcb3)[_0xe1d7('0x2d')]();};}function respondWithResult(_0x303523,_0x471c82){_0x471c82=_0x471c82||0xc8;return function(_0x42e74d){if(_0x42e74d){return _0x303523[_0xe1d7('0x2c')](_0x471c82)['json'](_0x42e74d);}};}function respondWithFilteredResult(_0x3e8ca3,_0x4a3344){return function(_0xbc38f3){if(_0xbc38f3){var _0x264481=typeof _0x4a3344['offset']==='undefined'&&typeof _0x4a3344[_0xe1d7('0x2e')]===_0xe1d7('0x2f');var _0x34eea8=_0xbc38f3[_0xe1d7('0x30')];var _0x2786d0=_0x264481?0x0:_0x4a3344['offset'];var _0x311c5f=_0x264481?_0xbc38f3[_0xe1d7('0x30')]:_0x4a3344[_0xe1d7('0x31')]+_0x4a3344[_0xe1d7('0x2e')];var _0x1d5d22;if(_0x311c5f>=_0x34eea8){_0x311c5f=_0x34eea8;_0x1d5d22=0xc8;}else{_0x1d5d22=0xce;}_0x3e8ca3['status'](_0x1d5d22);return _0x3e8ca3[_0xe1d7('0x32')](_0xe1d7('0x33'),_0x2786d0+'-'+_0x311c5f+'/'+_0x34eea8)[_0xe1d7('0x34')](_0xbc38f3);}return null;};}function patchUpdates(_0x1e0fe8){return function(_0x430acd){try{jsonpatch[_0xe1d7('0x35')](_0x430acd,_0x1e0fe8,!![]);}catch(_0x1c044b){return BPromise[_0xe1d7('0x36')](_0x1c044b);}return _0x430acd['save']();};}function saveUpdates(_0x2df96d,_0x15ba98){return function(_0x3a0aab){if(_0x3a0aab){return _0x3a0aab['update'](_0x2df96d)[_0xe1d7('0x20')](function(_0x2fa371){return _0x2fa371;});}return null;};}function removeEntity(_0x2056fb,_0x697993){return function(_0x30727d){if(_0x30727d){return _0x30727d[_0xe1d7('0x37')]()['then'](function(){_0x2056fb[_0xe1d7('0x2c')](0xcc)[_0xe1d7('0x2d')]();});}};}function handleEntityNotFound(_0x18fed0,_0x77fe1d){return function(_0x1b09a5){if(!_0x1b09a5){_0x18fed0[_0xe1d7('0x2b')](0x194);}return _0x1b09a5;};}function handleError(_0x5dc895,_0x3b3e1b){_0x3b3e1b=_0x3b3e1b||0x1f4;return function(_0x228f2c){logger[_0xe1d7('0x26')](_0x228f2c['stack']);if(_0x228f2c[_0xe1d7('0x38')]){delete _0x228f2c[_0xe1d7('0x38')];}_0x5dc895[_0xe1d7('0x2c')](_0x3b3e1b)['send'](_0x228f2c);};}exports[_0xe1d7('0x39')]=function(_0x594f4a,_0x558000){var _0xae9a55={},_0x4cd830={},_0x2e7e5d={'count':0x0,'rows':[]};var _0x371c2e=_[_0xe1d7('0x3a')](db['OpenchannelMessage'][_0xe1d7('0x3b')],function(_0xcf5b78){return{'name':_0xcf5b78['fieldName'],'type':_0xcf5b78[_0xe1d7('0x3c')]['key']};});_0x4cd830[_0xe1d7('0x3d')]=_['map'](_0x371c2e,_0xe1d7('0x38'));_0x4cd830[_0xe1d7('0x3e')]=_[_0xe1d7('0x3f')](_0x594f4a[_0xe1d7('0x3e')]);_0x4cd830[_0xe1d7('0x40')]=_[_0xe1d7('0x41')](_0x4cd830[_0xe1d7('0x3d')],_0x4cd830[_0xe1d7('0x3e')]);_0xae9a55[_0xe1d7('0x42')]=_['intersection'](_0x4cd830[_0xe1d7('0x3d')],qs['fields'](_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x43')]));_0xae9a55[_0xe1d7('0x42')]=_0xae9a55[_0xe1d7('0x42')][_0xe1d7('0x44')]?_0xae9a55[_0xe1d7('0x42')]:_0x4cd830[_0xe1d7('0x3d')];if(!_0x594f4a['query'][_0xe1d7('0x45')](_0xe1d7('0x46'))){_0xae9a55[_0xe1d7('0x2e')]=qs[_0xe1d7('0x2e')](_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x2e')]);_0xae9a55['offset']=qs[_0xe1d7('0x31')](_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x31')]);}_0xae9a55['order']=qs[_0xe1d7('0x47')](_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x47')]);_0xae9a55[_0xe1d7('0x48')]=qs[_0xe1d7('0x40')](_['pick'](_0x594f4a[_0xe1d7('0x3e')],_0x4cd830[_0xe1d7('0x40')]),_0x371c2e);if(_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x49')]){_0xae9a55[_0xe1d7('0x48')]=_[_0xe1d7('0x4a')](_0xae9a55[_0xe1d7('0x48')],{'$or':_[_0xe1d7('0x3a')](_0x371c2e,function(_0x3dc78a){if(_0x3dc78a[_0xe1d7('0x3c')]!=='VIRTUAL'){var _0x2ff0be={};_0x2ff0be[_0x3dc78a[_0xe1d7('0x38')]]={'$like':'%'+_0x594f4a[_0xe1d7('0x3e')]['filter']+'%'};return _0x2ff0be;}})});}_0xae9a55=_['merge']({},_0xae9a55,_0x594f4a[_0xe1d7('0x4b')]);var _0x41d585={'where':_0xae9a55[_0xe1d7('0x48')]};return db[_0xe1d7('0x4c')][_0xe1d7('0x30')](_0x41d585)['then'](function(_0x1dd8a0){_0x2e7e5d['count']=_0x1dd8a0;if(_0x594f4a[_0xe1d7('0x3e')][_0xe1d7('0x4d')]){_0xae9a55[_0xe1d7('0x4e')]=[{'all':!![]}];}return db[_0xe1d7('0x4c')][_0xe1d7('0x4f')](_0xae9a55);})['then'](function(_0x34fb33){_0x2e7e5d[_0xe1d7('0x50')]=_0x34fb33;return _0x2e7e5d;})[_0xe1d7('0x20')](respondWithFilteredResult(_0x558000,_0xae9a55))['catch'](handleError(_0x558000,null));};exports[_0xe1d7('0x51')]=function(_0x2a46e4,_0x2a7a76){var _0x5999ed={'raw':!![],'where':{'id':_0x2a46e4['params']['id']}},_0x175b75={};_0x175b75[_0xe1d7('0x3d')]=_[_0xe1d7('0x3f')](db[_0xe1d7('0x4c')]['rawAttributes']);_0x175b75['query']=_[_0xe1d7('0x3f')](_0x2a46e4[_0xe1d7('0x3e')]);_0x175b75[_0xe1d7('0x40')]=_[_0xe1d7('0x41')](_0x175b75['model'],_0x175b75[_0xe1d7('0x3e')]);_0x5999ed[_0xe1d7('0x42')]=_[_0xe1d7('0x41')](_0x175b75[_0xe1d7('0x3d')],qs['fields'](_0x2a46e4[_0xe1d7('0x3e')][_0xe1d7('0x43')]));_0x5999ed[_0xe1d7('0x42')]=_0x5999ed[_0xe1d7('0x42')][_0xe1d7('0x44')]?_0x5999ed['attributes']:_0x175b75[_0xe1d7('0x3d')];if(_0x2a46e4[_0xe1d7('0x3e')][_0xe1d7('0x4d')]){_0x5999ed[_0xe1d7('0x4e')]=[{'all':!![]}];}_0x5999ed=_['merge']({},_0x5999ed,_0x2a46e4[_0xe1d7('0x4b')]);return db['OpenchannelMessage'][_0xe1d7('0x52')](_0x5999ed)[_0xe1d7('0x20')](handleEntityNotFound(_0x2a7a76,null))[_0xe1d7('0x20')](respondWithResult(_0x2a7a76,null))[_0xe1d7('0x2a')](handleError(_0x2a7a76,null));};exports['create']=function(_0x910fe4,_0x1029e0){return db['OpenchannelMessage'][_0xe1d7('0x53')](_0x910fe4[_0xe1d7('0x54')],{})[_0xe1d7('0x20')](respondWithResult(_0x1029e0,0xc9))[_0xe1d7('0x2a')](handleError(_0x1029e0,null));};exports[_0xe1d7('0x55')]=function(_0x3bb0c5,_0x2baa8b){if(_0x3bb0c5[_0xe1d7('0x54')]['id']){delete _0x3bb0c5[_0xe1d7('0x54')]['id'];}return db[_0xe1d7('0x4c')]['find']({'where':{'id':_0x3bb0c5['params']['id']}})['then'](handleEntityNotFound(_0x2baa8b,null))[_0xe1d7('0x20')](saveUpdates(_0x3bb0c5[_0xe1d7('0x54')],null))[_0xe1d7('0x20')](respondWithResult(_0x2baa8b,null))['catch'](handleError(_0x2baa8b,null));};exports['destroy']=function(_0x2712b7,_0x113d44){return db['OpenchannelMessage']['find']({'where':{'id':_0x2712b7[_0xe1d7('0x56')]['id']}})[_0xe1d7('0x20')](handleEntityNotFound(_0x113d44,null))[_0xe1d7('0x20')](removeEntity(_0x113d44,null))[_0xe1d7('0x2a')](handleError(_0x113d44,null));};exports[_0xe1d7('0x57')]=function(_0x11f218,_0x54f1cd){return db['OpenchannelMessage'][_0xe1d7('0x57')]()['then'](respondWithResult(_0x54f1cd,null))[_0xe1d7('0x2a')](handleError(_0x54f1cd,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xe1d7('0x58')]=function(_0x5d3b70,_0x1401c8,_0x4d781f){var _0x25a1ec={'agent':{},'channel':_0xe1d7('0x59')};if(_0x5d3b70[_0xe1d7('0x54')]['id']){delete _0x5d3b70[_0xe1d7('0x54')]['id'];}_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x5a')]=!![];_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x5b')]=moment()['format'](_0xe1d7('0x5c'));_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x5d')]=_0x5d3b70[_0xe1d7('0x54')]['UserId']||_0x5d3b70[_0xe1d7('0x5e')]['id'];_0x25a1ec[_0xe1d7('0x5f')]['id']=_0x5d3b70['body'][_0xe1d7('0x5d')];return db['OpenchannelMessage'][_0xe1d7('0x52')]({'where':{'id':_0x5d3b70['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1401c8,null))[_0xe1d7('0x20')](saveUpdates(_0x5d3b70[_0xe1d7('0x54')],null))[_0xe1d7('0x20')](function(_0x3f69fa){if(_0x3f69fa){_0x25a1ec[_0xe1d7('0x28')]=_0x3f69fa[_0xe1d7('0x60')]({'plain':!![]});return db[_0xe1d7('0x61')][_0xe1d7('0x52')]({'where':{'id':_0x3f69fa[_0xe1d7('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1401c8,null))[_0xe1d7('0x20')](function(_0x137803){if(_0x137803){return _0x137803['update']({'UserId':_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x5d')],'read1stAt':_[_0xe1d7('0x63')](_0x137803[_0xe1d7('0x64')])?moment()['format'](_0xe1d7('0x5c')):undefined});}return null;})[_0xe1d7('0x20')](function(_0x34cbcd){if(_0x34cbcd){_0x25a1ec[_0xe1d7('0x65')]=_0x34cbcd[_0xe1d7('0x60')]({'plain':!![]});interaction_log[_0xe1d7('0x21')](_0xe1d7('0x66'),_0x5d3b70['user']['id'],_0x5d3b70[_0xe1d7('0x5e')][_0xe1d7('0x38')],_0x5d3b70[_0xe1d7('0x5e')][_0xe1d7('0x67')],_0x25a1ec[_0xe1d7('0x65')]['id'],_0x5d3b70[_0xe1d7('0x54')]?JSON['stringify'](_0x5d3b70['body']):_0xe1d7('0x68'));return respondWithRpcPromise('AcceptMessage',_0xe1d7('0x69'),_0x25a1ec);}return null;})[_0xe1d7('0x20')](function(_0x59a7e7){var _0x5ba40d=_0xe1d7('0x6a')+_0x59a7e7['message'][_0xe1d7('0x6b')];return db[_0xe1d7('0x6c')]['query'](_0x5ba40d,{'type':db['Sequelize'][_0xe1d7('0x6d')]['SELECT'],'raw':!![]})[_0xe1d7('0x20')](function(_0x36dc64){return _0x36dc64;});})[_0xe1d7('0x20')](function(_0x13331b){if(_0x13331b){_0x25a1ec['message'][_0xe1d7('0x6e')]=_0x13331b[0x0];if(!_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x5d')])return;return db[_0xe1d7('0x6f')][_0xe1d7('0x52')]({'where':{'id':_0x5d3b70[_0xe1d7('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0xe1d7('0x38'),_0xe1d7('0x70'),_0xe1d7('0x71'),_0xe1d7('0x72')],'raw':!![]});}return null;})['then'](function(_0x4b9e10){if(!_0x4b9e10)return null;_0x25a1ec[_0xe1d7('0x28')][_0xe1d7('0x5f')]=_0x4b9e10;return _0x25a1ec;})[_0xe1d7('0x20')](function(_0x322f65){if(_0x322f65){if(_0x5d3b70[_0xe1d7('0x54')][_0xe1d7('0x73')]){_0x25a1ec[_0xe1d7('0x28')][_0xe1d7('0x74')]=util['format'](_0xe1d7('0x75'),_0x5d3b70['user'][_0xe1d7('0x38')]);_0x25a1ec[_0xe1d7('0x28')][_0xe1d7('0x76')]=_0x25a1ec[_0xe1d7('0x76')];_0x25a1ec[_0xe1d7('0x28')]['motionChannel']=_0x25a1ec[_0xe1d7('0x76')];_0x25a1ec['message'][_0xe1d7('0x77')]=_0xe1d7('0x58');return respondWithRpcPromise(_0xe1d7('0x78'),'EventManager',{'event':_0xe1d7('0x79'),'message':_0x25a1ec['message']},client9002)[_0xe1d7('0x20')](function(){return _0x25a1ec;});}return _0x25a1ec;}return null;})[_0xe1d7('0x20')](respondWithResult(_0x1401c8,null))['catch'](handleError(_0x1401c8,null));};var interaction_log=require('../../config/logger')(_0xe1d7('0x7a'));exports[_0xe1d7('0x36')]=function(_0x131b35,_0x41a340,_0x424579){var _0x25d859={'agent':{},'channel':_0xe1d7('0x59')};if(_0x131b35[_0xe1d7('0x54')]['id']){delete _0x131b35[_0xe1d7('0x54')]['id'];}_0x131b35[_0xe1d7('0x54')]['UserId']=_0x131b35[_0xe1d7('0x54')][_0xe1d7('0x5d')]||_0x131b35['user']['id'];_0x25d859[_0xe1d7('0x5f')]['id']=_0x131b35[_0xe1d7('0x54')][_0xe1d7('0x5d')];return db[_0xe1d7('0x4c')][_0xe1d7('0x52')]({'where':{'id':_0x131b35['params']['id'],'UserId':null}})[_0xe1d7('0x20')](handleEntityNotFound(_0x41a340,null))[_0xe1d7('0x20')](function(_0x1228d9){if(_0x1228d9){_0x25d859[_0xe1d7('0x28')]=_0x1228d9[_0xe1d7('0x60')]({'plain':!![]});return db[_0xe1d7('0x61')][_0xe1d7('0x52')]({'where':{'id':_0x1228d9['OpenchannelInteractionId']}});}return null;})[_0xe1d7('0x20')](handleEntityNotFound(_0x41a340,null))['then'](function(_0x4a47b8){if(_0x4a47b8){_0x25d859[_0xe1d7('0x65')]=_0x4a47b8[_0xe1d7('0x60')]({'plain':!![]});interaction_log['info'](_0xe1d7('0x7b'),_0x131b35['user']['id'],_0x131b35[_0xe1d7('0x5e')][_0xe1d7('0x38')],_0x131b35[_0xe1d7('0x5e')][_0xe1d7('0x67')],_0x25d859[_0xe1d7('0x65')]['id'],_0x131b35[_0xe1d7('0x54')]?JSON['stringify'](_0x131b35[_0xe1d7('0x54')]):_0xe1d7('0x68'));return respondWithRpcPromise(_0xe1d7('0x7c'),_0xe1d7('0x7d'),_0x25d859);}return null;})[_0xe1d7('0x20')](function(_0x107799){var _0x85bad8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x107799[_0xe1d7('0x28')]['ContactId'];return db[_0xe1d7('0x6c')][_0xe1d7('0x3e')](_0x85bad8,{'type':db['Sequelize'][_0xe1d7('0x6d')][_0xe1d7('0x7e')],'raw':!![]})[_0xe1d7('0x20')](function(_0x51ab23){return _0x51ab23;});})[_0xe1d7('0x20')](function(_0xf4e84e){if(_0xf4e84e){_0x25d859[_0xe1d7('0x28')][_0xe1d7('0x6e')]=_0xf4e84e[0x0];if(!_0x131b35[_0xe1d7('0x54')][_0xe1d7('0x5d')])return;return db[_0xe1d7('0x6f')][_0xe1d7('0x52')]({'where':{'id':_0x131b35[_0xe1d7('0x54')]['UserId'],'role':_0xe1d7('0x5f')},'attributes':['id','name',_0xe1d7('0x70'),'email',_0xe1d7('0x72')],'raw':!![]});}return null;})[_0xe1d7('0x20')](function(_0x40dfca){if(!_0x40dfca)return null;_0x25d859[_0xe1d7('0x28')][_0xe1d7('0x5f')]=_0x40dfca;return _0x25d859;})['then'](function(_0x144343){if(_0x144343){_0x144343[_0xe1d7('0x28')][_0xe1d7('0x74')]=util[_0xe1d7('0x7f')](_0xe1d7('0x75'),_0x131b35[_0xe1d7('0x5e')]['name']);_0x144343[_0xe1d7('0x28')][_0xe1d7('0x76')]=_0x25d859['channel'];_0x144343['message'][_0xe1d7('0x80')]=_0x25d859[_0xe1d7('0x76')];_0x144343[_0xe1d7('0x28')][_0xe1d7('0x77')]=_0xe1d7('0x36');respondWithRpcPromise(_0xe1d7('0x78'),_0xe1d7('0x78'),{'event':_0xe1d7('0x81'),'message':_0x144343['message']},client9002);return _0x25d859;}return null;})[_0xe1d7('0x20')](respondWithResult(_0x41a340,null))[_0xe1d7('0x2a')](handleError(_0x41a340,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index da5382e..369a450 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf33=['hasOwnProperty','hook','events','OpenchannelMessage','remove','emit'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0xcf33,0x182));var _0x3cf3=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcf33[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require(_0x3cf3('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x3cf3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3cf3('0x2')};function emitEvent(_0xbde1bf){return function(_0x11f58d,_0x43be78,_0x509d23){OpenchannelMessageEvents[_0x3cf3('0x3')](_0xbde1bf+':'+_0x11f58d['id'],_0x11f58d);OpenchannelMessageEvents['emit'](_0xbde1bf,_0x11f58d);_0x509d23(null);};}for(var e in events){if(events[_0x3cf3('0x4')](e)){var event=events[e];OpenchannelMessage[_0x3cf3('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x38b5=['events','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x38b5,0xa8));var _0x538b=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x38b5[_0x2d2ca2];return _0x48489d;};'use strict';var EventEmitter=require(_0x538b('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x538b('0x1')](0x0);var events={'afterCreate':_0x538b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2cb146){return function(_0x32d4dd,_0x3f4de8,_0x40f70e){OpenchannelMessageEvents[_0x538b('0x3')](_0x2cb146+':'+_0x32d4dd['id'],_0x32d4dd);OpenchannelMessageEvents[_0x538b('0x3')](_0x2cb146,_0x32d4dd);_0x40f70e(null);};}for(var e in events){if(events[_0x538b('0x4')](e)){var event=events[e];OpenchannelMessage[_0x538b('0x5')](e,emitEvent(event));}}module[_0x538b('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 58a7f47..9558907 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1172=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','then','find','OpenchannelAccountId','Contact','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','info','threadId','update','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x42c241,_0x505e52){var _0x5cc387=function(_0x38197e){while(--_0x38197e){_0x42c241['push'](_0x42c241['shift']());}};_0x5cc387(++_0x505e52);}(_0x1172,0xc6));var _0x2117=function(_0xcc2b1e,_0x1da238){_0xcc2b1e=_0xcc2b1e-0x0;var _0x1c4b5d=_0x1172[_0xcc2b1e];return _0x1c4b5d;};'use strict';var _=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var logger=require(_0x2117('0x2'))(_0x2117('0x3'));var moment=require(_0x2117('0x4'));var BPromise=require(_0x2117('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2117('0x6'));var rimraf=require(_0x2117('0x7'));var config=require(_0x2117('0x8'));var attributes=require(_0x2117('0x9'));module[_0x2117('0xa')]=function(_0x57cf3b,_0xeaf308){return _0x57cf3b[_0x2117('0xb')](_0x2117('0xc'),attributes,{'tableName':_0x2117('0xd'),'paranoid':![],'indexes':[{'name':_0x2117('0xe'),'fields':[_0x2117('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdaac21,_0x5794b5,_0x23e6c0){var _0x2438b3=_0x57cf3b[_0x2117('0x10')];var _0x2bdcdc=_0xdaac21['get']({'plain':!![]});if(_0x2bdcdc[_0x2117('0x11')][_0x2117('0x12')]()==='in'||_0x2bdcdc[_0x2117('0x11')][_0x2117('0x12')]()===_0x2117('0x13')&&!_0x2bdcdc[_0x2117('0x14')]&&!_[_0x2117('0x15')](_0x2bdcdc[_0x2117('0x16')])){_0x2438b3[_0x2117('0x17')][_0x2117('0x18')]({'where':{'id':_0x2bdcdc[_0x2117('0x19')]}})['then'](function(_0x3ac0bc){if(_0x3ac0bc){_0x3ac0bc['update']({'lastMsgAt':_0x2bdcdc[_0x2117('0x1a')],'lastMsgDirection':_0x2bdcdc[_0x2117('0x11')]['toLowerCase']()});}})[_0x2117('0x1b')](function(_0xd27468){console[_0x2117('0x1c')](_0xd27468);});}if(_0x2bdcdc[_0x2117('0x11')]===_0x2117('0x13')&&!_0x2bdcdc[_0x2117('0x14')]){var _0x4f2d03;_0x2438b3[_0x2117('0x1d')]['describe']()[_0x2117('0x1e')](function(_0x3d6986){return _0x2438b3['OpenchannelAccount'][_0x2117('0x1f')]({'where':{'id':_0x2bdcdc[_0x2117('0x20')]},'include':[{'model':_0x2438b3['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x2bdcdc[_0x2117('0x19')]},'limit':0x1,'include':[{'model':_0x2438b3[_0x2117('0x1d')],'as':_0x2117('0x21'),'attributes':_['keys'](_0x3d6986)}]}]});})[_0x2117('0x1e')](function(_0x50b657){_0x4f2d03=_0x50b657[_0x2117('0x22')]({'plain':!![]});if(_0x4f2d03&&_0x4f2d03[_0x2117('0x23')]){logger['info'](_0x2117('0x24'),_0x2117('0x25'),util[_0x2117('0x26')](_0x2117('0x27'),_0x2bdcdc['id'],_0x4f2d03[_0x2117('0x23')]));if(_0x4f2d03['Interactions']&&_0x4f2d03[_0x2117('0x28')][_0x2117('0x29')]){_0x2bdcdc[_0x2117('0x2a')]=_[_0x2117('0x2b')](_0x4f2d03[_0x2117('0x28')][0x0],'Contact');_0x2bdcdc[_0x2117('0x21')]=_0x4f2d03[_0x2117('0x28')][0x0]['Contact'];}var _0x5794b5={'method':_0x2117('0x2c'),'uri':encodeURI(_0x4f2d03[_0x2117('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5794b5[_0x2117('0x2d')]){case _0x2117('0x2e'):_0x5794b5['qs']=_0x2bdcdc;break;case'POST':_0x5794b5[_0x2117('0xf')]=_0x2bdcdc;break;}return rp(_0x5794b5)['then'](function(_0x2dd36d){logger[_0x2117('0x2f')](_0x2117('0x24'),'afterCreate',util[_0x2117('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2bdcdc['id'],_0x4f2d03[_0x2117('0x23')]));if(_0x2dd36d[_0x2117('0xf')]['threadId']&&_0x2dd36d[_0x2117('0xf')]['threadId']!=_0x2bdcdc[_0x2117('0x2a')][_0x2117('0x30')]){return _0x2438b3[_0x2117('0x17')]['update']({'threadId':_0x2dd36d['body'][_0x2117('0x30')]},{'where':{'id':_0x2bdcdc[_0x2117('0x2a')]['id']}});}else{return;}})[_0x2117('0x1e')](function(){return _0xdaac21[_0x2117('0x31')]({'read':!![]});})[_0x2117('0x1b')](function(_0x908a6a){logger[_0x2117('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x2117('0x25'),util[_0x2117('0x32')](_0x908a6a,{'showHidden':![],'depth':null}));_0x23e6c0();});}else{_0x23e6c0();}})[_0x2117('0x33')](function(){_0x23e6c0();});}else{_0x23e6c0();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x22e9=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','path','../../config/environment','exports','define','openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x22e9,0x158));var _0x922e=function(_0x500439,_0x24b02e){_0x500439=_0x500439-0x0;var _0x476501=_0x22e9[_0x500439];return _0x476501;};'use strict';var _=require(_0x922e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x922e('0x1'));var BPromise=require(_0x922e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x922e('0x3'));var rimraf=require('rimraf');var config=require(_0x922e('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0x922e('0x5')]=function(_0x2ae925,_0x105d88){return _0x2ae925[_0x922e('0x6')]('OpenchannelMessage',attributes,{'tableName':_0x922e('0x7'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x922e('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2042c2,_0x23066c,_0x243593){var _0x95f551=_0x2ae925[_0x922e('0x9')];var _0x199c53=_0x2042c2[_0x922e('0xa')]({'plain':!![]});if(_0x199c53[_0x922e('0xb')][_0x922e('0xc')]()==='in'||_0x199c53[_0x922e('0xb')]['toLowerCase']()===_0x922e('0xd')&&!_0x199c53[_0x922e('0xe')]&&!_[_0x922e('0xf')](_0x199c53[_0x922e('0x10')])){_0x95f551[_0x922e('0x11')]['findOne']({'where':{'id':_0x199c53['OpenchannelInteractionId']}})['then'](function(_0x5c6140){if(_0x5c6140){_0x5c6140[_0x922e('0x12')]({'lastMsgAt':_0x199c53[_0x922e('0x13')],'lastMsgDirection':_0x199c53[_0x922e('0xb')]['toLowerCase']()});}})[_0x922e('0x14')](function(_0x13211a){console[_0x922e('0x15')](_0x13211a);});}if(_0x199c53['direction']==='out'&&!_0x199c53[_0x922e('0xe')]){var _0x52d701;_0x95f551[_0x922e('0x16')][_0x922e('0x17')]()[_0x922e('0x18')](function(_0xa472d2){return _0x95f551[_0x922e('0x19')][_0x922e('0x1a')]({'where':{'id':_0x199c53['OpenchannelAccountId']},'include':[{'model':_0x95f551[_0x922e('0x11')],'as':_0x922e('0x1b'),'where':{'id':_0x199c53[_0x922e('0x1c')]},'limit':0x1,'include':[{'model':_0x95f551[_0x922e('0x16')],'as':'Contact','attributes':_[_0x922e('0x1d')](_0xa472d2)}]}]});})[_0x922e('0x18')](function(_0x2f6695){_0x52d701=_0x2f6695[_0x922e('0xa')]({'plain':!![]});if(_0x52d701&&_0x52d701[_0x922e('0x1e')]){logger['info'](_0x922e('0x1f'),'afterCreate',util[_0x922e('0x20')](_0x922e('0x21'),_0x199c53['id'],_0x52d701[_0x922e('0x1e')]));if(_0x52d701['Interactions']&&_0x52d701['Interactions'][_0x922e('0x22')]){_0x199c53[_0x922e('0x23')]=_[_0x922e('0x24')](_0x52d701[_0x922e('0x1b')][0x0],_0x922e('0x25'));_0x199c53['Contact']=_0x52d701[_0x922e('0x1b')][0x0][_0x922e('0x25')];}var _0x23066c={'method':'POST','uri':encodeURI(_0x52d701[_0x922e('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23066c['method']){case'GET':_0x23066c['qs']=_0x199c53;break;case _0x922e('0x26'):_0x23066c[_0x922e('0x27')]=_0x199c53;break;}return rp(_0x23066c)[_0x922e('0x18')](function(_0x27c13f){logger['info'](_0x922e('0x1f'),_0x922e('0x28'),util[_0x922e('0x20')](_0x922e('0x29'),_0x199c53['id'],_0x52d701[_0x922e('0x1e')]));if(_0x27c13f[_0x922e('0x27')]['threadId']&&_0x27c13f[_0x922e('0x27')]['threadId']!=_0x199c53['Interaction'][_0x922e('0x2a')]){return _0x95f551[_0x922e('0x11')][_0x922e('0x12')]({'threadId':_0x27c13f['body'][_0x922e('0x2a')]},{'where':{'id':_0x199c53[_0x922e('0x23')]['id']}});}else{return;}})['then'](function(){return _0x2042c2[_0x922e('0x12')]({'read':!![]});})[_0x922e('0x14')](function(_0x2312a1){logger[_0x922e('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x922e('0x28'),util[_0x922e('0x2b')](_0x2312a1,{'showHidden':![],'depth':null}));_0x243593();});}else{_0x243593();}})[_0x922e('0x2c')](function(){_0x243593();});}else{_0x243593();}}},'charset':_0x922e('0x2d'),'collate':_0x922e('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 77b3244..16a6108 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x59e3f0,_0x43a9bf){var _0x2eaf15=function(_0x537c3d){while(--_0x537c3d){_0x59e3f0['push'](_0x59e3f0['shift']());}};_0x2eaf15(++_0x43a9bf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x0b0e[_0x2390bd];return _0x3a969d;};'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});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x33121c,_0x4d6cae){var _0x123d4a=function(_0x310b80){while(--_0x310b80){_0x33121c['push'](_0x33121c['shift']());}};_0x123d4a(++_0x4d6cae);}(_0x7a54,0x106));var _0x47a5=function(_0x2f1991,_0x20f6ed){_0x2f1991=_0x2f1991-0x0;var _0x4f0fa0=_0x7a54[_0x2f1991];return _0x4f0fa0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6a20c1a..c30f723 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf89=['emit','removeListener','register','./openchannelMessage.events','save','remove','update'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xdf89,0x16f));var _0x9df8=function(_0x38e6d1,_0x2fe815){_0x38e6d1=_0x38e6d1-0x0;var _0x4a8e17=_0xdf89[_0x38e6d1];return _0x4a8e17;};'use strict';var OpenchannelMessageEvents=require(_0x9df8('0x0'));var events=[_0x9df8('0x1'),_0x9df8('0x2'),_0x9df8('0x3')];function createListener(_0x89bce8,_0x19f262){return function(_0x18463a){_0x19f262[_0x9df8('0x4')](_0x89bce8,_0x18463a);};}function removeListener(_0x31b021,_0x57a211){return function(){OpenchannelMessageEvents[_0x9df8('0x5')](_0x31b021,_0x57a211);};}exports[_0x9df8('0x6')]=function(_0xa87d49){for(var _0x16ef8f=0x0,_0x174cbc=events['length'];_0x16ef8f<_0x174cbc;_0x16ef8f++){var _0x35f5f1=events[_0x16ef8f];var _0x335854=createListener('openchannelMessage:'+_0x35f5f1,_0xa87d49);OpenchannelMessageEvents['on'](_0x35f5f1,_0x335854);}}; \ No newline at end of file +var _0x9e43=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x34e221,_0x5aa84b){var _0x33d162=function(_0x388bb3){while(--_0x388bb3){_0x34e221['push'](_0x34e221['shift']());}};_0x33d162(++_0x5aa84b);}(_0x9e43,0x18a));var _0x39e4=function(_0xf8d80e,_0x442160){_0xf8d80e=_0xf8d80e-0x0;var _0x510240=_0x9e43[_0xf8d80e];return _0x510240;};'use strict';var OpenchannelMessageEvents=require(_0x39e4('0x0'));var events=[_0x39e4('0x1'),_0x39e4('0x2'),_0x39e4('0x3')];function createListener(_0x282d0c,_0x60d16a){return function(_0x5d29ee){_0x60d16a[_0x39e4('0x4')](_0x282d0c,_0x5d29ee);};}function removeListener(_0x56f750,_0x1b637f){return function(){OpenchannelMessageEvents[_0x39e4('0x5')](_0x56f750,_0x1b637f);};}exports['register']=function(_0x452528){for(var _0x3d0a58=0x0,_0x1fd3c3=events[_0x39e4('0x6')];_0x3d0a58<_0x1fd3c3;_0x3d0a58++){var _0x290163=events[_0x3d0a58];var _0x177b05=createListener(_0x39e4('0x7')+_0x290163,_0x452528);OpenchannelMessageEvents['on'](_0x290163,_0x177b05);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index fb178f4..ec4b8fa 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d14=['addTeams','put','destroy','delete','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x138a6b,_0x4e85f5){var _0x313d4a=function(_0x5e6b06){while(--_0x5e6b06){_0x138a6b['push'](_0x138a6b['shift']());}};_0x313d4a(++_0x4e85f5);}(_0x2d14,0x18c));var _0x42d1=function(_0x9725c0,_0x3b6b9b){_0x9725c0=_0x9725c0-0x0;var _0x513242=_0x2d14[_0x9725c0];return _0x513242;};'use strict';var multer=require(_0x42d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42d1('0x1'));var express=require(_0x42d1('0x2'));var router=express[_0x42d1('0x3')]();var fs_extra=require(_0x42d1('0x4'));var auth=require(_0x42d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42d1('0x6'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x42d1('0x7')](),controller[_0x42d1('0x8')]);router[_0x42d1('0x9')]('/describe',auth[_0x42d1('0x7')](),controller[_0x42d1('0xa')]);router['get'](_0x42d1('0xb'),auth[_0x42d1('0x7')](),controller[_0x42d1('0xc')]);router['get'](_0x42d1('0xd'),auth[_0x42d1('0x7')](),controller[_0x42d1('0xe')]);router['get'](_0x42d1('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x42d1('0x9')](_0x42d1('0x10'),auth['isAuthenticated'](),controller[_0x42d1('0x11')]);router[_0x42d1('0x12')]('/',auth[_0x42d1('0x7')](),controller[_0x42d1('0x13')]);router['post'](_0x42d1('0xf'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x14')]);router[_0x42d1('0x12')](_0x42d1('0x10'),auth[_0x42d1('0x7')](),controller['addAgents']);router[_0x42d1('0x15')]('/:id',auth[_0x42d1('0x7')](),controller['update']);router['delete'](_0x42d1('0xb'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x16')]);router[_0x42d1('0x17')](_0x42d1('0xf'),auth[_0x42d1('0x7')](),controller[_0x42d1('0x18')]);router['delete'](_0x42d1('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x42d1('0x19')]=router; \ No newline at end of file +var _0x6a88=['put','update','delete','removeTeams','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents'];(function(_0x5c5ec2,_0x5a11ed){var _0xc38a29=function(_0x3db2de){while(--_0x3db2de){_0x5c5ec2['push'](_0x5c5ec2['shift']());}};_0xc38a29(++_0x5a11ed);}(_0x6a88,0xbc));var _0x86a8=function(_0x34ac75,_0x75b3a2){_0x34ac75=_0x34ac75-0x0;var _0x389365=_0x6a88[_0x34ac75];return _0x389365;};'use strict';var multer=require(_0x86a8('0x0'));var util=require('util');var path=require(_0x86a8('0x1'));var timeout=require('connect-timeout');var express=require(_0x86a8('0x2'));var router=express['Router']();var fs_extra=require(_0x86a8('0x3'));var auth=require(_0x86a8('0x4'));var interaction=require(_0x86a8('0x5'));var config=require('../../config/environment');var controller=require(_0x86a8('0x6'));router[_0x86a8('0x7')]('/',auth[_0x86a8('0x8')](),controller[_0x86a8('0x9')]);router[_0x86a8('0x7')]('/describe',auth[_0x86a8('0x8')](),controller['describe']);router[_0x86a8('0x7')](_0x86a8('0xa'),auth[_0x86a8('0x8')](),controller['show']);router['get'](_0x86a8('0xb'),auth[_0x86a8('0x8')](),controller[_0x86a8('0xc')]);router[_0x86a8('0x7')](_0x86a8('0xd'),auth[_0x86a8('0x8')](),controller['getTeams']);router[_0x86a8('0x7')](_0x86a8('0xe'),auth['isAuthenticated'](),controller[_0x86a8('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x86a8('0x10')](_0x86a8('0xd'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x11')]);router[_0x86a8('0x10')](_0x86a8('0xe'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x12')]);router[_0x86a8('0x13')](_0x86a8('0xa'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x14')]);router[_0x86a8('0x15')]('/:id',auth[_0x86a8('0x8')](),controller['destroy']);router[_0x86a8('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x86a8('0x16')]);router['delete'](_0x86a8('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a8d28b3..9d08a47 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c86=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2493a3,_0x24ba04){var _0x50ad43=function(_0x1dbc38){while(--_0x1dbc38){_0x2493a3['push'](_0x2493a3['shift']());}};_0x50ad43(++_0x24ba04);}(_0x8c86,0x17b));var _0x68c8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8c86[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x68c8('0x0'));module[_0x68c8('0x1')]={'name':{'type':Sequelize[_0x68c8('0x2')],'unique':_0x68c8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68c8('0x2')]},'timeout':{'type':Sequelize[_0x68c8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68c8('0x5')](_0x68c8('0x6'),_0x68c8('0x7'),_0x68c8('0x8'))}}; \ No newline at end of file +var _0xd991=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x26c19d,_0x3f70ab){var _0x247430=function(_0x222422){while(--_0x222422){_0x26c19d['push'](_0x26c19d['shift']());}};_0x247430(++_0x3f70ab);}(_0xd991,0x67));var _0x1d99=function(_0x1706bb,_0x208671){_0x1706bb=_0x1706bb-0x0;var _0x5bc81d=_0xd991[_0x1706bb];return _0x5bc81d;};'use strict';var Sequelize=require(_0x1d99('0x0'));module[_0x1d99('0x1')]={'name':{'type':Sequelize[_0x1d99('0x2')],'unique':_0x1d99('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1d99('0x2')]},'timeout':{'type':Sequelize[_0x1d99('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1d99('0x5'),_0x1d99('0x6'),_0x1d99('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2ee8b0b..3ed72dc 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d1a=['role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','order','sort','pick','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','interface','Agents','each','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','sequelize','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','OpenchannelQueue','include','findAll','catch','show','params','keys','query','filters','intersection','model','fields','attributes','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x4d1a,0xb3));var _0xa4d1=function(_0x178f8d,_0x26e72d){_0x178f8d=_0x178f8d-0x0;var _0xa25d2e=_0x4d1a[_0x178f8d];return _0xa25d2e;};'use strict';var BPromise=require(_0xa4d1('0x0'));var util=require(_0xa4d1('0x1'));var _=require(_0xa4d1('0x2'));var squel=require('squel');var Redis=require(_0xa4d1('0x3'));var qs=require(_0xa4d1('0x4'));var logger=require('../../config/logger')(_0xa4d1('0x5'));var config=require(_0xa4d1('0x6'));var db=require(_0xa4d1('0x7'))['db'];config[_0xa4d1('0x8')]=_['defaults'](config[_0xa4d1('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4d1('0x9'))(new Redis(config[_0xa4d1('0x8')]));require(_0xa4d1('0xa'))[_0xa4d1('0xb')](socket);function respondWithStatusCode(_0x31dcd7,_0x426021){_0x426021=_0x426021||0xcc;return function(_0x3e5892){if(_0x3e5892){return _0x31dcd7[_0xa4d1('0xc')](_0x426021);}return _0x31dcd7[_0xa4d1('0xd')](_0x426021)[_0xa4d1('0xe')]();};}function respondWithResult(_0x3ed918,_0x117277){_0x117277=_0x117277||0xc8;return function(_0x34e6a1){if(_0x34e6a1){return _0x3ed918[_0xa4d1('0xd')](_0x117277)[_0xa4d1('0xf')](_0x34e6a1);}};}function respondWithFilteredResult(_0x104c45,_0x2e637c){return function(_0x32309d){if(_0x32309d){var _0x22c778=typeof _0x2e637c[_0xa4d1('0x10')]===_0xa4d1('0x11')&&typeof _0x2e637c[_0xa4d1('0x12')]===_0xa4d1('0x11');var _0x4589f9=_0x32309d[_0xa4d1('0x13')];var _0x1b554b=_0x22c778?0x0:_0x2e637c[_0xa4d1('0x10')];var _0x2966a9=_0x22c778?_0x32309d[_0xa4d1('0x13')]:_0x2e637c[_0xa4d1('0x10')]+_0x2e637c[_0xa4d1('0x12')];var _0x30aabd;if(_0x2966a9>=_0x4589f9){_0x2966a9=_0x4589f9;_0x30aabd=0xc8;}else{_0x30aabd=0xce;}_0x104c45[_0xa4d1('0xd')](_0x30aabd);return _0x104c45[_0xa4d1('0x14')](_0xa4d1('0x15'),_0x1b554b+'-'+_0x2966a9+'/'+_0x4589f9)['json'](_0x32309d);}return null;};}function saveUpdates(_0x37520c){return function(_0x5c8f46){if(_0x5c8f46){return _0x5c8f46[_0xa4d1('0x16')](_0x37520c)[_0xa4d1('0x17')](function(_0x32bc9e){return _0x32bc9e;});}return null;};}function removeEntity(_0x38807f){return function(_0x48696d){if(_0x48696d){return _0x48696d[_0xa4d1('0x18')]()[_0xa4d1('0x17')](function(){var _0x4fbb1a=_0x48696d['get']({'plain':!![]});var _0x1688c8=_0xa4d1('0x19');return db['UserProfileResource'][_0xa4d1('0x18')]({'where':{'type':_0x1688c8,'resourceId':_0x4fbb1a['id']}})[_0xa4d1('0x17')](function(){return _0x48696d;});})[_0xa4d1('0x17')](function(){_0x38807f[_0xa4d1('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc446){return function(_0x37fee6){if(!_0x37fee6){_0x1cc446[_0xa4d1('0xc')](0x194);}return _0x37fee6;};}function handleError(_0x2522ae,_0x22779c){_0x22779c=_0x22779c||0x1f4;return function(_0x4886f5){logger[_0xa4d1('0x1a')](_0x4886f5[_0xa4d1('0x1b')]);if(_0x4886f5['name']){delete _0x4886f5[_0xa4d1('0x1c')];}_0x2522ae[_0xa4d1('0xd')](_0x22779c)[_0xa4d1('0x1d')](_0x4886f5);};}exports[_0xa4d1('0x1e')]=function(_0x1918c1,_0x4cb13e){var _0x190009={};var _0xed0810={'count':0x0,'rows':[]};var _0xedf137=_[_0xa4d1('0x1f')](db['OpenchannelQueue'][_0xa4d1('0x20')],function(_0x1f5e23){return{'name':_0x1f5e23[_0xa4d1('0x21')],'type':_0x1f5e23[_0xa4d1('0x22')][_0xa4d1('0x23')]};});_0x190009=qs[_0xa4d1('0x24')](_0xedf137,_0x1918c1);var _0x21610c={'where':_0x190009[_0xa4d1('0x25')]};return db[_0xa4d1('0x26')][_0xa4d1('0x13')](_0x21610c)[_0xa4d1('0x17')](function(_0x3aba64){_0xed0810['count']=_0x3aba64;_0x190009[_0xa4d1('0x27')]=qs[_0xa4d1('0x27')](_0x1918c1['query']);return db[_0xa4d1('0x26')][_0xa4d1('0x28')](_0x190009);})[_0xa4d1('0x17')](function(_0x1a37d5){_0xed0810['rows']=_0x1a37d5;return _0xed0810;})[_0xa4d1('0x17')](respondWithFilteredResult(_0x4cb13e,_0x190009))[_0xa4d1('0x29')](handleError(_0x4cb13e,null));};exports[_0xa4d1('0x2a')]=function(_0x17bebb,_0x529c62){var _0x497a5e={'raw':!![],'where':{'id':_0x17bebb[_0xa4d1('0x2b')]['id']}},_0x895969={};_0x895969['model']=_[_0xa4d1('0x2c')](db[_0xa4d1('0x26')][_0xa4d1('0x20')]);_0x895969[_0xa4d1('0x2d')]=_['keys'](_0x17bebb[_0xa4d1('0x2d')]);_0x895969[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x895969[_0xa4d1('0x30')],_0x895969['query']);_0x497a5e['attributes']=_[_0xa4d1('0x2f')](_0x895969['model'],qs[_0xa4d1('0x31')](_0x17bebb[_0xa4d1('0x2d')][_0xa4d1('0x31')]));_0x497a5e[_0xa4d1('0x32')]=_0x497a5e['attributes']['length']?_0x497a5e[_0xa4d1('0x32')]:_0x895969[_0xa4d1('0x30')];if(_0x17bebb[_0xa4d1('0x2d')]['includeAll']){_0x497a5e[_0xa4d1('0x27')]=[{'all':!![]}];}_0x497a5e=_[_0xa4d1('0x33')]({},_0x497a5e,_0x17bebb[_0xa4d1('0x34')]);return db[_0xa4d1('0x26')]['find'](_0x497a5e)[_0xa4d1('0x17')](handleEntityNotFound(_0x529c62,null))[_0xa4d1('0x17')](respondWithResult(_0x529c62,null))[_0xa4d1('0x29')](handleError(_0x529c62,null));};exports[_0xa4d1('0x35')]=function(_0x58bc34,_0x4180c2){return db['OpenchannelQueue'][_0xa4d1('0x35')](_0x58bc34[_0xa4d1('0x36')],{})[_0xa4d1('0x17')](function(_0xd3011e){var _0x5196f4=_0x58bc34[_0xa4d1('0x37')]['get']({'plain':!![]});if(!_0x5196f4)throw new Error(_0xa4d1('0x38'));if(_0x5196f4[_0xa4d1('0x39')]===_0xa4d1('0x37')){var _0x517695=_0xd3011e[_0xa4d1('0x3a')]({'plain':!![]});var _0x134457=_0xa4d1('0x19');return db[_0xa4d1('0x3b')][_0xa4d1('0x3c')]({'where':{'name':_0x134457,'userProfileId':_0x5196f4[_0xa4d1('0x3d')]},'raw':!![]})[_0xa4d1('0x17')](function(_0x5e09a7){if(_0x5e09a7&&_0x5e09a7[_0xa4d1('0x3e')]===0x0){return db[_0xa4d1('0x3f')]['create']({'name':_0x517695[_0xa4d1('0x1c')],'resourceId':_0x517695['id'],'type':_0x5e09a7['name'],'sectionId':_0x5e09a7['id']},{})[_0xa4d1('0x17')](function(){return _0xd3011e;});}else{return _0xd3011e;}})[_0xa4d1('0x29')](function(_0x4ff34c){logger[_0xa4d1('0x1a')](_0xa4d1('0x40'),_0x4ff34c);throw _0x4ff34c;});}return _0xd3011e;})['then'](respondWithResult(_0x4180c2,0xc9))['catch'](handleError(_0x4180c2,null));};exports[_0xa4d1('0x16')]=function(_0x3b12c1,_0x393e27){if(_0x3b12c1[_0xa4d1('0x36')]['id']){delete _0x3b12c1[_0xa4d1('0x36')]['id'];}return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x3b12c1[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x393e27,null))['then'](saveUpdates(_0x3b12c1['body'],null))[_0xa4d1('0x17')](respondWithResult(_0x393e27,null))[_0xa4d1('0x29')](handleError(_0x393e27,null));};exports[_0xa4d1('0x18')]=function(_0x5621ae,_0x15264d){return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x5621ae[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x15264d,null))['then'](removeEntity(_0x15264d,null))[_0xa4d1('0x29')](handleError(_0x15264d,null));};exports[_0xa4d1('0x41')]=function(_0x50c5de,_0x308cb6){return db[_0xa4d1('0x26')][_0xa4d1('0x41')]()[_0xa4d1('0x17')](respondWithResult(_0x308cb6,null))[_0xa4d1('0x29')](handleError(_0x308cb6,null));};exports[_0xa4d1('0x42')]=function(_0xd9bd27,_0x183bce){var _0x2d15a6={'raw':!![],'where':{}},_0x3f026a={},_0x3c4cf9;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0xd9bd27[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x183bce,null))[_0xa4d1('0x17')](function(_0x26c620){if(_0x26c620){_0x3c4cf9=_0x26c620['get']({'plain':!![]});_0x3f026a[_0xa4d1('0x30')]=_['keys'](db[_0xa4d1('0x44')][_0xa4d1('0x20')]);_0x3f026a['query']=_[_0xa4d1('0x2c')](_0xd9bd27[_0xa4d1('0x2d')]);_0x3f026a[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x3f026a['model'],_0x3f026a[_0xa4d1('0x2d')]);_0x2d15a6[_0xa4d1('0x32')]=_[_0xa4d1('0x2f')](_0x3f026a[_0xa4d1('0x30')],qs[_0xa4d1('0x31')](_0xd9bd27[_0xa4d1('0x2d')]['fields']));_0x2d15a6[_0xa4d1('0x32')]=_0x2d15a6[_0xa4d1('0x32')][_0xa4d1('0x45')]?_0x2d15a6[_0xa4d1('0x32')]:_0x3f026a[_0xa4d1('0x30')];if(!_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x46')]('nolimit')){_0x2d15a6['limit']=qs[_0xa4d1('0x12')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x2d15a6['offset']=qs[_0xa4d1('0x10')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x10')]);}_0x2d15a6[_0xa4d1('0x47')]=qs[_0xa4d1('0x48')](_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x48')]);_0x2d15a6[_0xa4d1('0x25')]=qs['filters'](_[_0xa4d1('0x49')](_0xd9bd27[_0xa4d1('0x2d')],_0x3f026a[_0xa4d1('0x2e')]));_0x2d15a6[_0xa4d1('0x25')]['OpenchannelQueueId']=_0x26c620['id'];if(_0xd9bd27['query'][_0xa4d1('0x4a')]){_0x2d15a6[_0xa4d1('0x25')]=_[_0xa4d1('0x33')](_0x2d15a6[_0xa4d1('0x25')],{'$or':_[_0xa4d1('0x1f')](_0x2d15a6[_0xa4d1('0x32')],function(_0x2fa65f){var _0x515122={};_0x515122[_0x2fa65f]={'$like':'%'+_0xd9bd27[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x515122;})});}_0x2d15a6=_[_0xa4d1('0x33')]({},_0x2d15a6,_0xd9bd27['options']);return db[_0xa4d1('0x44')][_0xa4d1('0x28')](_0x2d15a6);}})[_0xa4d1('0x17')](function(_0x64626e){if(_0x64626e){return db[_0xa4d1('0x4b')][_0xa4d1('0x4c')]({'where':{'id':_['map'](_0x64626e,_0xa4d1('0x4d')),'role':_0xa4d1('0x4e')},'attributes':['id',_0xa4d1('0x1c'),_0xa4d1('0x4f'),_0xa4d1('0x50'),_0xa4d1('0x51')]});}})[_0xa4d1('0x17')](function(_0x235305){if(_0x235305){return{'count':_0x235305[_0xa4d1('0x13')],'rows':_[_0xa4d1('0x1f')](_0x235305['rows'],function(_0x549915){return{'membername':_0x549915['name'],'UserId':_0x549915['id'],'queue_name':_0x3c4cf9[_0xa4d1('0x1c')],'OpenchannelQueueId':_0x3c4cf9['id'],'interface':util['format']('%s/%s',_0xa4d1('0x52'),_0x549915[_0xa4d1('0x1c')]),'penalty':0x0,'paused':_0x549915[_0xa4d1('0x4f')],'createdAt':_0x549915['createdAt'],'updatedAt':_0x549915['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa4d1('0x17')](respondWithFilteredResult(_0x183bce,_0x2d15a6))[_0xa4d1('0x29')](handleError(_0x183bce,null));};exports[_0xa4d1('0x53')]=function(_0x3fe8eb,_0x53f1ec){var _0x1e4a57={};var _0x27e970={};var _0x56c7ea;var _0x220dca;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0x3fe8eb[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x53f1ec,null))['then'](function(_0x556508){if(_0x556508){_0x56c7ea=_0x556508;_0x27e970[_0xa4d1('0x30')]=_[_0xa4d1('0x2c')](db[_0xa4d1('0x54')][_0xa4d1('0x20')]);_0x27e970[_0xa4d1('0x2d')]=_[_0xa4d1('0x2c')](_0x3fe8eb['query']);_0x27e970[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x27e970['model'],_0x27e970['query']);_0x1e4a57['attributes']=_[_0xa4d1('0x2f')](_0x27e970[_0xa4d1('0x30')],qs['fields'](_0x3fe8eb[_0xa4d1('0x2d')]['fields']));_0x1e4a57[_0xa4d1('0x32')]=_0x1e4a57['attributes'][_0xa4d1('0x45')]?_0x1e4a57[_0xa4d1('0x32')]:_0x27e970[_0xa4d1('0x30')];_0x1e4a57[_0xa4d1('0x47')]=qs[_0xa4d1('0x48')](_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x48')]);_0x1e4a57[_0xa4d1('0x25')]=qs[_0xa4d1('0x2e')](_[_0xa4d1('0x49')](_0x3fe8eb[_0xa4d1('0x2d')],_0x27e970[_0xa4d1('0x2e')]));if(_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x4a')]){_0x1e4a57[_0xa4d1('0x25')]=_['merge'](_0x1e4a57[_0xa4d1('0x25')],{'$or':_[_0xa4d1('0x1f')](_0x1e4a57['attributes'],function(_0x5eea2a){var _0x4fef87={};_0x4fef87[_0x5eea2a]={'$like':'%'+_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x4fef87;})});}_0x1e4a57=_[_0xa4d1('0x33')]({},_0x1e4a57,_0x3fe8eb[_0xa4d1('0x34')]);return _0x56c7ea[_0xa4d1('0x53')](_0x1e4a57);}})['then'](function(_0x34ad6d){if(_0x34ad6d){_0x220dca=_0x34ad6d[_0xa4d1('0x45')];if(!_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x46')](_0xa4d1('0x55'))){_0x1e4a57['limit']=qs[_0xa4d1('0x12')](_0x3fe8eb[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x1e4a57['offset']=qs['offset'](_0x3fe8eb['query'][_0xa4d1('0x10')]);}return _0x56c7ea[_0xa4d1('0x53')](_0x1e4a57);}})['then'](function(_0x26cd65){if(_0x26cd65){return _0x26cd65?{'count':_0x220dca,'rows':_0x26cd65}:null;}})[_0xa4d1('0x17')](respondWithResult(_0x53f1ec,null))['catch'](handleError(_0x53f1ec,null));};exports[_0xa4d1('0x56')]=function(_0x354106,_0x1c3c75){var _0x1e7ade=_0x354106[_0xa4d1('0x36')][_0xa4d1('0x57')];return db[_0xa4d1('0x54')][_0xa4d1('0x28')]({'where':{'id':_0x1e7ade},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa4d1('0x1c'),_0xa4d1('0x58'),'voicePause',_0xa4d1('0x59')],'raw':!![]}]})[_0xa4d1('0x17')](function(_0x2d1bf5){if(_0x2d1bf5){var _0x2bd678=_['flatMap'](_0x2d1bf5,function(_0x442c40){var _0x5f371a=_0x442c40[_0xa4d1('0x3a')]({'plain':!![]});return _0x5f371a[_0xa4d1('0x5a')];});return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x354106['params']['id']}})['then'](function(_0x297686){return db['sequelize']['transaction'](function(_0xa4ec38){return _0x297686[_0xa4d1('0x56')](_0x1e7ade,{'transaction':_0xa4ec38})[_0xa4d1('0x17')](function(){return BPromise[_0xa4d1('0x5b')](_0x2bd678,function(_0x383af2){return db[_0xa4d1('0x44')]['findOrCreate']({'where':{'UserId':_0x383af2['id'],'OpenchannelQueueId':_0x354106[_0xa4d1('0x2b')]['id']},'transaction':_0xa4ec38});});})[_0xa4d1('0x17')](function(){_0x2bd678['forEach'](function(_0x220e46){socket[_0xa4d1('0x5c')](_0xa4d1('0x5d'),{'UserId':_0x220e46['id'],'OpenchannelQueueId':_0x297686['id']});});});});});}})[_0xa4d1('0x17')](respondWithStatusCode(_0x1c3c75,null))[_0xa4d1('0x29')](handleError(_0x1c3c75,null));};exports[_0xa4d1('0x5e')]=function(_0x113703,_0xf3dc60){return db[_0xa4d1('0x54')]['findAll']({'where':{'id':_0x113703[_0xa4d1('0x2d')][_0xa4d1('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa4d1('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf3dc60,null))['then'](function(_0x1c503e){var _0x4f03a4=_['map'](_0x1c503e,'id');var _0x147c0b=[];var _0x581221=[];var _0x4c49a0=squel[_0xa4d1('0x5f')]();_0x4c49a0[_0xa4d1('0x60')](_0xa4d1('0x61'))['from'](_0xa4d1('0x62'),'tq')['join'](_0xa4d1('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa4d1('0x25')](_0xa4d1('0x64'),_0x113703[_0xa4d1('0x2b')]['id']);for(var _0x5f1a71=0x0;_0x5f1a71<_0x1c503e[_0xa4d1('0x45')];_0x5f1a71+=0x1){let _0x503c12=_0x1c503e[_0x5f1a71];for(var _0x40b0f8=0x0;_0x40b0f8<_0x503c12[_0xa4d1('0x5a')][_0xa4d1('0x45')];_0x40b0f8+=0x1){let _0x16ef12=_0x503c12[_0xa4d1('0x5a')][_0x40b0f8];var _0x85a995=_0x4c49a0[_0xa4d1('0x65')]();_0x85a995[_0xa4d1('0x25')]('ut.UserId\x20=\x20?',_0x16ef12['id']);_0x581221['push'](db['sequelize']['query'](_0x85a995['toString'](),{'type':db[_0xa4d1('0x66')]['QueryTypes'][_0xa4d1('0x67')]})['then'](function(_0x3faa99){if(_0x3faa99['length']===0x1){return _0x16ef12['id'];}else{var _0x4a555b=_[_0xa4d1('0x68')](_[_0xa4d1('0x1f')](_0x3faa99,_0xa4d1('0x69')),function(_0x38dd0d){return _[_0xa4d1('0x6a')](_0x4f03a4,_0x38dd0d);});if(_0x4a555b){return _0x16ef12['id'];}}}));}}return BPromise['all'](_0x581221)[_0xa4d1('0x17')](function(_0x116e63){_0x147c0b=_(_0x147c0b)[_0xa4d1('0x6b')](_0x116e63)[_0xa4d1('0x6c')]()[_0xa4d1('0x6d')]();return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x113703[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](function(_0x14a156){return db[_0xa4d1('0x66')][_0xa4d1('0x6e')](function(_0x32b87b){return _0x14a156[_0xa4d1('0x5e')](_0x113703[_0xa4d1('0x2d')][_0xa4d1('0x57')],{'transaction':_0x32b87b})[_0xa4d1('0x17')](function(){if(!_[_0xa4d1('0x6f')](_0x147c0b)){return _0x14a156[_0xa4d1('0x70')](_0x147c0b,{'transaction':_0x32b87b});}})[_0xa4d1('0x17')](function(){_0x147c0b['forEach'](function(_0x49780d){socket[_0xa4d1('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x49780d,'OpenchannelQueueId':_0x14a156['id']});});});});});});})[_0xa4d1('0x17')](respondWithStatusCode(_0xf3dc60,null))[_0xa4d1('0x29')](handleError(_0xf3dc60,null));};exports[_0xa4d1('0x71')]=function(_0x4381ed,_0x42a0e9){return db['OpenchannelQueue'][_0xa4d1('0x3c')]({'where':{'id':_0x4381ed[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x42a0e9,null))[_0xa4d1('0x17')](function(_0x323d3d){if(_0x323d3d){return _0x323d3d['addAgents'](_0x4381ed[_0xa4d1('0x36')][_0xa4d1('0x57')],_[_0xa4d1('0x72')](_0x4381ed[_0xa4d1('0x36')],[_0xa4d1('0x57'),'id'])||{})[_0xa4d1('0x73')](function(_0x18096f){for(var _0xc2322=0x0;_0xc2322<_0x4381ed[_0xa4d1('0x36')]['ids'][_0xa4d1('0x45')];_0xc2322+=0x1){socket['emit'](_0xa4d1('0x5d'),{'UserId':Number(_0x4381ed[_0xa4d1('0x36')][_0xa4d1('0x57')][_0xc2322]),'OpenchannelQueueId':Number(_0x4381ed[_0xa4d1('0x2b')]['id'])});}return _0x18096f;});}})[_0xa4d1('0x17')](respondWithResult(_0x42a0e9,null))['catch'](handleError(_0x42a0e9,null));};exports[_0xa4d1('0x70')]=function(_0x1a72d5,_0x1f192f){return db[_0xa4d1('0x26')][_0xa4d1('0x3c')]({'where':{'id':_0x1a72d5[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x1f192f,null))[_0xa4d1('0x17')](function(_0x2426b2){if(_0x2426b2){return _0x2426b2['removeAgents'](_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')])[_0xa4d1('0x17')](function(){if(_['isArray'](_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')])){for(var _0x3ef8c1=0x0;_0x3ef8c1<_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')][_0xa4d1('0x45')];_0x3ef8c1+=0x1){socket[_0xa4d1('0x5c')](_0xa4d1('0x74'),{'UserId':Number(_0x1a72d5[_0xa4d1('0x2d')][_0xa4d1('0x57')][_0x3ef8c1]),'OpenchannelQueueId':Number(_0x1a72d5[_0xa4d1('0x2b')]['id'])});}}else{socket[_0xa4d1('0x5c')](_0xa4d1('0x74'),{'UserId':Number(_0x1a72d5[_0xa4d1('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x1a72d5['params']['id'])});}});}})[_0xa4d1('0x17')](respondWithStatusCode(_0x1f192f,null))[_0xa4d1('0x29')](handleError(_0x1f192f,null));};exports[_0xa4d1('0x75')]=function(_0x275688,_0x34b435){var _0x5f12c8={};var _0x14d8fc={};var _0x58484b;var _0x3fc018;return db[_0xa4d1('0x26')][_0xa4d1('0x43')]({'where':{'id':_0x275688[_0xa4d1('0x2b')]['id']}})[_0xa4d1('0x17')](handleEntityNotFound(_0x34b435,null))[_0xa4d1('0x17')](function(_0x8b058a){if(_0x8b058a){_0x58484b=_0x8b058a;_0x14d8fc[_0xa4d1('0x30')]=_[_0xa4d1('0x2c')](db['User'][_0xa4d1('0x20')]);_0x14d8fc[_0xa4d1('0x2d')]=_[_0xa4d1('0x2c')](_0x275688['query']);_0x14d8fc[_0xa4d1('0x2e')]=_[_0xa4d1('0x2f')](_0x14d8fc['model'],_0x14d8fc['query']);_0x5f12c8[_0xa4d1('0x32')]=_[_0xa4d1('0x2f')](_0x14d8fc[_0xa4d1('0x30')],qs['fields'](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x31')]));_0x5f12c8[_0xa4d1('0x32')]=_0x5f12c8[_0xa4d1('0x32')][_0xa4d1('0x45')]?_0x5f12c8['attributes']:_0x14d8fc[_0xa4d1('0x30')];_0x5f12c8[_0xa4d1('0x47')]=qs['sort'](_0x275688['query'][_0xa4d1('0x48')]);_0x5f12c8[_0xa4d1('0x25')]=qs[_0xa4d1('0x2e')](_['pick'](_0x275688[_0xa4d1('0x2d')],_0x14d8fc['filters']));if(_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x4a')]){_0x5f12c8[_0xa4d1('0x25')]=_[_0xa4d1('0x33')](_0x5f12c8['where'],{'$or':_[_0xa4d1('0x1f')](_0x5f12c8[_0xa4d1('0x32')],function(_0x35ed77){var _0x445f18={};_0x445f18[_0x35ed77]={'$like':'%'+_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x4a')]+'%'};return _0x445f18;})});}_0x5f12c8=_[_0xa4d1('0x33')]({},_0x5f12c8,_0x275688[_0xa4d1('0x34')]);return _0x58484b[_0xa4d1('0x75')](_0x5f12c8);}})['then'](function(_0xcf6b26){if(_0xcf6b26){_0x3fc018=_0xcf6b26[_0xa4d1('0x45')];if(!_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x46')](_0xa4d1('0x55'))){_0x5f12c8[_0xa4d1('0x12')]=qs[_0xa4d1('0x12')](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x12')]);_0x5f12c8[_0xa4d1('0x10')]=qs['offset'](_0x275688[_0xa4d1('0x2d')][_0xa4d1('0x10')]);}return _0x58484b[_0xa4d1('0x75')](_0x5f12c8);}})[_0xa4d1('0x17')](function(_0x5b7e2c){if(_0x5b7e2c){return _0x5b7e2c?{'count':_0x3fc018,'rows':_0x5b7e2c}:null;}})[_0xa4d1('0x17')](respondWithResult(_0x34b435,null))[_0xa4d1('0x29')](handleError(_0x34b435,null));}; \ No newline at end of file +var _0x3ea1=['createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','count','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','User','UserId','agent','openchannelPause'];(function(_0x5ddf2d,_0x395542){var _0x6b2dff=function(_0x1cd0ab){while(--_0x1cd0ab){_0x5ddf2d['push'](_0x5ddf2d['shift']());}};_0x6b2dff(++_0x395542);}(_0x3ea1,0xa7));var _0x13ea=function(_0x5f3944,_0x5b631b){_0x5f3944=_0x5f3944-0x0;var _0x4d63a1=_0x3ea1[_0x5f3944];return _0x4d63a1;};'use strict';var BPromise=require('bluebird');var util=require(_0x13ea('0x0'));var _=require(_0x13ea('0x1'));var squel=require(_0x13ea('0x2'));var Redis=require(_0x13ea('0x3'));var qs=require(_0x13ea('0x4'));var logger=require(_0x13ea('0x5'))(_0x13ea('0x6'));var config=require(_0x13ea('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x13ea('0x8')](config[_0x13ea('0x9')],{'host':_0x13ea('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13ea('0x9')]));require(_0x13ea('0xb'))[_0x13ea('0xc')](socket);function respondWithStatusCode(_0x1d77fa,_0x26cf4b){_0x26cf4b=_0x26cf4b||0xcc;return function(_0x569cf1){if(_0x569cf1){return _0x1d77fa[_0x13ea('0xd')](_0x26cf4b);}return _0x1d77fa[_0x13ea('0xe')](_0x26cf4b)[_0x13ea('0xf')]();};}function respondWithResult(_0x304f63,_0x4e5739){_0x4e5739=_0x4e5739||0xc8;return function(_0x213535){if(_0x213535){return _0x304f63[_0x13ea('0xe')](_0x4e5739)['json'](_0x213535);}};}function respondWithFilteredResult(_0x579552,_0x4f254c){return function(_0x103556){if(_0x103556){var _0x329a40=typeof _0x4f254c[_0x13ea('0x10')]===_0x13ea('0x11')&&typeof _0x4f254c[_0x13ea('0x12')]===_0x13ea('0x11');var _0x3bfa6e=_0x103556['count'];var _0x1040ed=_0x329a40?0x0:_0x4f254c[_0x13ea('0x10')];var _0x176446=_0x329a40?_0x103556['count']:_0x4f254c['offset']+_0x4f254c[_0x13ea('0x12')];var _0x3e9363;if(_0x176446>=_0x3bfa6e){_0x176446=_0x3bfa6e;_0x3e9363=0xc8;}else{_0x3e9363=0xce;}_0x579552[_0x13ea('0xe')](_0x3e9363);return _0x579552[_0x13ea('0x13')](_0x13ea('0x14'),_0x1040ed+'-'+_0x176446+'/'+_0x3bfa6e)['json'](_0x103556);}return null;};}function saveUpdates(_0x140451){return function(_0x4ae147){if(_0x4ae147){return _0x4ae147[_0x13ea('0x15')](_0x140451)['then'](function(_0x40ec38){return _0x40ec38;});}return null;};}function removeEntity(_0x300218){return function(_0x440e1e){if(_0x440e1e){return _0x440e1e[_0x13ea('0x16')]()[_0x13ea('0x17')](function(){var _0xf2d95a=_0x440e1e[_0x13ea('0x18')]({'plain':!![]});var _0x1507a3='OpenchannelQueues';return db[_0x13ea('0x19')][_0x13ea('0x16')]({'where':{'type':_0x1507a3,'resourceId':_0xf2d95a['id']}})[_0x13ea('0x17')](function(){return _0x440e1e;});})[_0x13ea('0x17')](function(){_0x300218[_0x13ea('0xe')](0xcc)[_0x13ea('0xf')]();});}};}function handleEntityNotFound(_0x5c35c9){return function(_0x5a272c){if(!_0x5a272c){_0x5c35c9[_0x13ea('0xd')](0x194);}return _0x5a272c;};}function handleError(_0x31af53,_0x2d5bcf){_0x2d5bcf=_0x2d5bcf||0x1f4;return function(_0x3da9ea){logger[_0x13ea('0x1a')](_0x3da9ea[_0x13ea('0x1b')]);if(_0x3da9ea[_0x13ea('0x1c')]){delete _0x3da9ea[_0x13ea('0x1c')];}_0x31af53['status'](_0x2d5bcf)[_0x13ea('0x1d')](_0x3da9ea);};}exports['index']=function(_0x267408,_0x309a93){var _0xc7dece={};var _0x1248f1={'count':0x0,'rows':[]};var _0x28f1d5=_[_0x13ea('0x1e')](db[_0x13ea('0x1f')][_0x13ea('0x20')],function(_0xf74cb){return{'name':_0xf74cb[_0x13ea('0x21')],'type':_0xf74cb[_0x13ea('0x22')][_0x13ea('0x23')]};});_0xc7dece=qs[_0x13ea('0x24')](_0x28f1d5,_0x267408);var _0x6c9c29={'where':_0xc7dece['where']};return db[_0x13ea('0x1f')]['count'](_0x6c9c29)[_0x13ea('0x17')](function(_0xb529f6){_0x1248f1[_0x13ea('0x25')]=_0xb529f6;_0xc7dece[_0x13ea('0x26')]=qs[_0x13ea('0x26')](_0x267408['query']);return db['OpenchannelQueue'][_0x13ea('0x27')](_0xc7dece);})[_0x13ea('0x17')](function(_0x559a5c){_0x1248f1[_0x13ea('0x28')]=_0x559a5c;return _0x1248f1;})['then'](respondWithFilteredResult(_0x309a93,_0xc7dece))[_0x13ea('0x29')](handleError(_0x309a93,null));};exports[_0x13ea('0x2a')]=function(_0x516e5f,_0x1eb4c7){var _0x2c10af={'raw':!![],'where':{'id':_0x516e5f[_0x13ea('0x2b')]['id']}},_0xdd9d09={};_0xdd9d09[_0x13ea('0x2c')]=_[_0x13ea('0x2d')](db[_0x13ea('0x1f')][_0x13ea('0x20')]);_0xdd9d09[_0x13ea('0x2e')]=_[_0x13ea('0x2d')](_0x516e5f[_0x13ea('0x2e')]);_0xdd9d09[_0x13ea('0x2f')]=_[_0x13ea('0x30')](_0xdd9d09[_0x13ea('0x2c')],_0xdd9d09[_0x13ea('0x2e')]);_0x2c10af[_0x13ea('0x31')]=_[_0x13ea('0x30')](_0xdd9d09[_0x13ea('0x2c')],qs[_0x13ea('0x32')](_0x516e5f['query'][_0x13ea('0x32')]));_0x2c10af['attributes']=_0x2c10af[_0x13ea('0x31')]['length']?_0x2c10af[_0x13ea('0x31')]:_0xdd9d09[_0x13ea('0x2c')];if(_0x516e5f['query'][_0x13ea('0x33')]){_0x2c10af[_0x13ea('0x26')]=[{'all':!![]}];}_0x2c10af=_[_0x13ea('0x34')]({},_0x2c10af,_0x516e5f[_0x13ea('0x35')]);return db[_0x13ea('0x1f')][_0x13ea('0x36')](_0x2c10af)[_0x13ea('0x17')](handleEntityNotFound(_0x1eb4c7,null))[_0x13ea('0x17')](respondWithResult(_0x1eb4c7,null))[_0x13ea('0x29')](handleError(_0x1eb4c7,null));};exports['create']=function(_0x1ad6e0,_0x5710d3){return db[_0x13ea('0x1f')]['create'](_0x1ad6e0[_0x13ea('0x37')],{})[_0x13ea('0x17')](function(_0x31cebe){var _0x1bcbde=_0x1ad6e0[_0x13ea('0x38')][_0x13ea('0x18')]({'plain':!![]});if(!_0x1bcbde)throw new Error(_0x13ea('0x39'));if(_0x1bcbde[_0x13ea('0x3a')]===_0x13ea('0x38')){var _0x279e9c=_0x31cebe[_0x13ea('0x18')]({'plain':!![]});var _0x58f1ff='OpenchannelQueues';return db[_0x13ea('0x3b')][_0x13ea('0x36')]({'where':{'name':_0x58f1ff,'userProfileId':_0x1bcbde[_0x13ea('0x3c')]},'raw':!![]})[_0x13ea('0x17')](function(_0x1641d1){if(_0x1641d1&&_0x1641d1['autoAssociation']===0x0){return db[_0x13ea('0x19')][_0x13ea('0x3d')]({'name':_0x279e9c['name'],'resourceId':_0x279e9c['id'],'type':_0x1641d1[_0x13ea('0x1c')],'sectionId':_0x1641d1['id']},{})[_0x13ea('0x17')](function(){return _0x31cebe;});}else{return _0x31cebe;}})['catch'](function(_0x2b92e3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b92e3);throw _0x2b92e3;});}return _0x31cebe;})['then'](respondWithResult(_0x5710d3,0xc9))[_0x13ea('0x29')](handleError(_0x5710d3,null));};exports[_0x13ea('0x15')]=function(_0x4e16c7,_0x37186c){if(_0x4e16c7[_0x13ea('0x37')]['id']){delete _0x4e16c7[_0x13ea('0x37')]['id'];}return db[_0x13ea('0x1f')][_0x13ea('0x36')]({'where':{'id':_0x4e16c7[_0x13ea('0x2b')]['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x37186c,null))[_0x13ea('0x17')](saveUpdates(_0x4e16c7['body'],null))[_0x13ea('0x17')](respondWithResult(_0x37186c,null))[_0x13ea('0x29')](handleError(_0x37186c,null));};exports[_0x13ea('0x16')]=function(_0xadc018,_0x27492f){return db[_0x13ea('0x1f')][_0x13ea('0x36')]({'where':{'id':_0xadc018[_0x13ea('0x2b')]['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x27492f,null))[_0x13ea('0x17')](removeEntity(_0x27492f,null))[_0x13ea('0x29')](handleError(_0x27492f,null));};exports[_0x13ea('0x3e')]=function(_0x59c549,_0x4a96c4){return db[_0x13ea('0x1f')][_0x13ea('0x3e')]()[_0x13ea('0x17')](respondWithResult(_0x4a96c4,null))['catch'](handleError(_0x4a96c4,null));};exports[_0x13ea('0x3f')]=function(_0x27e7da,_0x4ef736){var _0x25a274={'raw':!![],'where':{}},_0x35a6cd={},_0x8b5647;return db[_0x13ea('0x1f')][_0x13ea('0x40')]({'where':{'id':_0x27e7da[_0x13ea('0x2b')]['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x4ef736,null))[_0x13ea('0x17')](function(_0x2d49f6){if(_0x2d49f6){_0x8b5647=_0x2d49f6[_0x13ea('0x18')]({'plain':!![]});_0x35a6cd[_0x13ea('0x2c')]=_[_0x13ea('0x2d')](db[_0x13ea('0x41')][_0x13ea('0x20')]);_0x35a6cd['query']=_[_0x13ea('0x2d')](_0x27e7da[_0x13ea('0x2e')]);_0x35a6cd['filters']=_[_0x13ea('0x30')](_0x35a6cd[_0x13ea('0x2c')],_0x35a6cd['query']);_0x25a274[_0x13ea('0x31')]=_[_0x13ea('0x30')](_0x35a6cd['model'],qs[_0x13ea('0x32')](_0x27e7da['query']['fields']));_0x25a274[_0x13ea('0x31')]=_0x25a274[_0x13ea('0x31')][_0x13ea('0x42')]?_0x25a274[_0x13ea('0x31')]:_0x35a6cd['model'];if(!_0x27e7da[_0x13ea('0x2e')][_0x13ea('0x43')](_0x13ea('0x44'))){_0x25a274[_0x13ea('0x12')]=qs[_0x13ea('0x12')](_0x27e7da['query'][_0x13ea('0x12')]);_0x25a274[_0x13ea('0x10')]=qs[_0x13ea('0x10')](_0x27e7da[_0x13ea('0x2e')][_0x13ea('0x10')]);}_0x25a274[_0x13ea('0x45')]=qs[_0x13ea('0x46')](_0x27e7da['query'][_0x13ea('0x46')]);_0x25a274[_0x13ea('0x47')]=qs[_0x13ea('0x2f')](_[_0x13ea('0x48')](_0x27e7da[_0x13ea('0x2e')],_0x35a6cd[_0x13ea('0x2f')]));_0x25a274[_0x13ea('0x47')][_0x13ea('0x49')]=_0x2d49f6['id'];if(_0x27e7da['query'][_0x13ea('0x4a')]){_0x25a274[_0x13ea('0x47')]=_['merge'](_0x25a274[_0x13ea('0x47')],{'$or':_[_0x13ea('0x1e')](_0x25a274['attributes'],function(_0x482e04){var _0x21fe48={};_0x21fe48[_0x482e04]={'$like':'%'+_0x27e7da[_0x13ea('0x2e')][_0x13ea('0x4a')]+'%'};return _0x21fe48;})});}_0x25a274=_[_0x13ea('0x34')]({},_0x25a274,_0x27e7da[_0x13ea('0x35')]);return db[_0x13ea('0x41')][_0x13ea('0x27')](_0x25a274);}})[_0x13ea('0x17')](function(_0x582366){if(_0x582366){return db[_0x13ea('0x4b')]['findAndCountAll']({'where':{'id':_[_0x13ea('0x1e')](_0x582366,_0x13ea('0x4c')),'role':_0x13ea('0x4d')},'attributes':['id',_0x13ea('0x1c'),_0x13ea('0x4e'),'updatedAt',_0x13ea('0x4f')]});}})[_0x13ea('0x17')](function(_0x2c0bab){if(_0x2c0bab){return{'count':_0x2c0bab['count'],'rows':_[_0x13ea('0x1e')](_0x2c0bab[_0x13ea('0x28')],function(_0x3633e5){return{'membername':_0x3633e5[_0x13ea('0x1c')],'UserId':_0x3633e5['id'],'queue_name':_0x8b5647[_0x13ea('0x1c')],'OpenchannelQueueId':_0x8b5647['id'],'interface':util[_0x13ea('0x50')](_0x13ea('0x51'),_0x13ea('0x52'),_0x3633e5[_0x13ea('0x1c')]),'penalty':0x0,'paused':_0x3633e5[_0x13ea('0x4e')],'createdAt':_0x3633e5['createdAt'],'updatedAt':_0x3633e5[_0x13ea('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x13ea('0x17')](respondWithFilteredResult(_0x4ef736,_0x25a274))[_0x13ea('0x29')](handleError(_0x4ef736,null));};exports[_0x13ea('0x54')]=function(_0x4197f8,_0x348311){var _0x4c9ce9={};var _0x5e9c6b={};var _0x3773e9;var _0x308339;return db[_0x13ea('0x1f')]['findOne']({'where':{'id':_0x4197f8['params']['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x348311,null))['then'](function(_0x42b10d){if(_0x42b10d){_0x3773e9=_0x42b10d;_0x5e9c6b['model']=_[_0x13ea('0x2d')](db['Team'][_0x13ea('0x20')]);_0x5e9c6b[_0x13ea('0x2e')]=_[_0x13ea('0x2d')](_0x4197f8[_0x13ea('0x2e')]);_0x5e9c6b['filters']=_[_0x13ea('0x30')](_0x5e9c6b[_0x13ea('0x2c')],_0x5e9c6b[_0x13ea('0x2e')]);_0x4c9ce9['attributes']=_['intersection'](_0x5e9c6b[_0x13ea('0x2c')],qs[_0x13ea('0x32')](_0x4197f8[_0x13ea('0x2e')][_0x13ea('0x32')]));_0x4c9ce9[_0x13ea('0x31')]=_0x4c9ce9[_0x13ea('0x31')][_0x13ea('0x42')]?_0x4c9ce9[_0x13ea('0x31')]:_0x5e9c6b[_0x13ea('0x2c')];_0x4c9ce9['order']=qs[_0x13ea('0x46')](_0x4197f8[_0x13ea('0x2e')][_0x13ea('0x46')]);_0x4c9ce9['where']=qs['filters'](_[_0x13ea('0x48')](_0x4197f8[_0x13ea('0x2e')],_0x5e9c6b[_0x13ea('0x2f')]));if(_0x4197f8[_0x13ea('0x2e')][_0x13ea('0x4a')]){_0x4c9ce9[_0x13ea('0x47')]=_[_0x13ea('0x34')](_0x4c9ce9[_0x13ea('0x47')],{'$or':_['map'](_0x4c9ce9[_0x13ea('0x31')],function(_0x13c3e0){var _0x3277c5={};_0x3277c5[_0x13c3e0]={'$like':'%'+_0x4197f8[_0x13ea('0x2e')]['filter']+'%'};return _0x3277c5;})});}_0x4c9ce9=_[_0x13ea('0x34')]({},_0x4c9ce9,_0x4197f8[_0x13ea('0x35')]);return _0x3773e9[_0x13ea('0x54')](_0x4c9ce9);}})[_0x13ea('0x17')](function(_0x3928e4){if(_0x3928e4){_0x308339=_0x3928e4[_0x13ea('0x42')];if(!_0x4197f8[_0x13ea('0x2e')][_0x13ea('0x43')](_0x13ea('0x44'))){_0x4c9ce9['limit']=qs['limit'](_0x4197f8[_0x13ea('0x2e')]['limit']);_0x4c9ce9[_0x13ea('0x10')]=qs['offset'](_0x4197f8['query'][_0x13ea('0x10')]);}return _0x3773e9[_0x13ea('0x54')](_0x4c9ce9);}})[_0x13ea('0x17')](function(_0x3ef058){if(_0x3ef058){return _0x3ef058?{'count':_0x308339,'rows':_0x3ef058}:null;}})[_0x13ea('0x17')](respondWithResult(_0x348311,null))[_0x13ea('0x29')](handleError(_0x348311,null));};exports[_0x13ea('0x55')]=function(_0x3412b5,_0x555beb){var _0x2f4484=_0x3412b5['body'][_0x13ea('0x56')];return db[_0x13ea('0x57')]['findAll']({'where':{'id':_0x2f4484},'attributes':['id'],'include':[{'model':db[_0x13ea('0x4b')],'as':_0x13ea('0x58'),'attributes':['id',_0x13ea('0x1c'),_0x13ea('0x59'),'voicePause',_0x13ea('0x5a')],'raw':!![]}]})['then'](function(_0x1eaaca){if(_0x1eaaca){var _0x280876=_[_0x13ea('0x5b')](_0x1eaaca,function(_0x36b324){var _0x18efbb=_0x36b324['get']({'plain':!![]});return _0x18efbb[_0x13ea('0x58')];});return db['OpenchannelQueue'][_0x13ea('0x36')]({'where':{'id':_0x3412b5[_0x13ea('0x2b')]['id']}})[_0x13ea('0x17')](function(_0x5380b3){return db[_0x13ea('0x5c')]['transaction'](function(_0x49fd57){return _0x5380b3['addTeams'](_0x2f4484,{'transaction':_0x49fd57})[_0x13ea('0x17')](function(){return BPromise['each'](_0x280876,function(_0x52e91d){return db[_0x13ea('0x41')]['findOrCreate']({'where':{'UserId':_0x52e91d['id'],'OpenchannelQueueId':_0x3412b5[_0x13ea('0x2b')]['id']},'transaction':_0x49fd57});});})[_0x13ea('0x17')](function(){_0x280876[_0x13ea('0x5d')](function(_0x498aac){socket[_0x13ea('0x5e')]('userOpenchannelQueue:save',{'UserId':_0x498aac['id'],'OpenchannelQueueId':_0x5380b3['id']});});});});});}})['then'](respondWithStatusCode(_0x555beb,null))[_0x13ea('0x29')](handleError(_0x555beb,null));};exports[_0x13ea('0x5f')]=function(_0x11bf00,_0x4617a7){return db[_0x13ea('0x57')][_0x13ea('0x27')]({'where':{'id':_0x11bf00[_0x13ea('0x2e')][_0x13ea('0x56')]},'attributes':['id'],'include':[{'model':db[_0x13ea('0x4b')],'as':_0x13ea('0x58'),'attributes':['id'],'raw':!![]}]})[_0x13ea('0x17')](handleEntityNotFound(_0x4617a7,null))[_0x13ea('0x17')](function(_0x2a83fa){var _0x2b8039=_[_0x13ea('0x1e')](_0x2a83fa,'id');var _0x2b7156=[];var _0x3ded85=[];var _0x13c02f=squel[_0x13ea('0x60')]();_0x13c02f[_0x13ea('0x61')](_0x13ea('0x62'))[_0x13ea('0x63')](_0x13ea('0x64'),'tq')[_0x13ea('0x65')]('user_has_teams','ut',_0x13ea('0x66'))[_0x13ea('0x47')]('OpenchannelQueueId\x20=\x20?',_0x11bf00['params']['id']);for(var _0x388c20=0x0;_0x388c20<_0x2a83fa[_0x13ea('0x42')];_0x388c20+=0x1){let _0x263bef=_0x2a83fa[_0x388c20];for(var _0x5ed51b=0x0;_0x5ed51b<_0x263bef[_0x13ea('0x58')][_0x13ea('0x42')];_0x5ed51b+=0x1){let _0x59f5e7=_0x263bef[_0x13ea('0x58')][_0x5ed51b];var _0x3cd4a0=_0x13c02f[_0x13ea('0x67')]();_0x3cd4a0['where']('ut.UserId\x20=\x20?',_0x59f5e7['id']);_0x3ded85[_0x13ea('0x68')](db['sequelize'][_0x13ea('0x2e')](_0x3cd4a0[_0x13ea('0x69')](),{'type':db[_0x13ea('0x5c')][_0x13ea('0x6a')][_0x13ea('0x6b')]})[_0x13ea('0x17')](function(_0x33873c){if(_0x33873c[_0x13ea('0x42')]===0x1){return _0x59f5e7['id'];}else{var _0x3e80c5=_[_0x13ea('0x6c')](_[_0x13ea('0x1e')](_0x33873c,_0x13ea('0x6d')),function(_0x6d5297){return _[_0x13ea('0x6e')](_0x2b8039,_0x6d5297);});if(_0x3e80c5){return _0x59f5e7['id'];}}}));}}return BPromise[_0x13ea('0x6f')](_0x3ded85)[_0x13ea('0x17')](function(_0x34f9ec){_0x2b7156=_(_0x2b7156)[_0x13ea('0x70')](_0x34f9ec)[_0x13ea('0x71')]()['value']();return db['OpenchannelQueue'][_0x13ea('0x36')]({'where':{'id':_0x11bf00['params']['id']}})[_0x13ea('0x17')](function(_0x113ed9){return db[_0x13ea('0x5c')]['transaction'](function(_0x418cd9){return _0x113ed9['removeTeams'](_0x11bf00['query'][_0x13ea('0x56')],{'transaction':_0x418cd9})[_0x13ea('0x17')](function(){if(!_[_0x13ea('0x72')](_0x2b7156)){return _0x113ed9['removeAgents'](_0x2b7156,{'transaction':_0x418cd9});}})[_0x13ea('0x17')](function(){_0x2b7156['forEach'](function(_0x5f2e4c){socket[_0x13ea('0x5e')](_0x13ea('0x73'),{'UserId':_0x5f2e4c,'OpenchannelQueueId':_0x113ed9['id']});});});});});});})['then'](respondWithStatusCode(_0x4617a7,null))['catch'](handleError(_0x4617a7,null));};exports[_0x13ea('0x74')]=function(_0x3239e6,_0x5be143){return db[_0x13ea('0x1f')][_0x13ea('0x36')]({'where':{'id':_0x3239e6[_0x13ea('0x2b')]['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x5be143,null))[_0x13ea('0x17')](function(_0x1c195b){if(_0x1c195b){return _0x1c195b[_0x13ea('0x74')](_0x3239e6['body'][_0x13ea('0x56')],_[_0x13ea('0x75')](_0x3239e6['body'],[_0x13ea('0x56'),'id'])||{})[_0x13ea('0x76')](function(_0x2514bb){for(var _0x56ffc6=0x0;_0x56ffc6<_0x3239e6[_0x13ea('0x37')]['ids'][_0x13ea('0x42')];_0x56ffc6+=0x1){socket['emit'](_0x13ea('0x77'),{'UserId':Number(_0x3239e6['body']['ids'][_0x56ffc6]),'OpenchannelQueueId':Number(_0x3239e6[_0x13ea('0x2b')]['id'])});}return _0x2514bb;});}})[_0x13ea('0x17')](respondWithResult(_0x5be143,null))[_0x13ea('0x29')](handleError(_0x5be143,null));};exports['removeAgents']=function(_0x12f192,_0x2e8f36){return db[_0x13ea('0x1f')][_0x13ea('0x36')]({'where':{'id':_0x12f192[_0x13ea('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2e8f36,null))[_0x13ea('0x17')](function(_0x49dfe7){if(_0x49dfe7){return _0x49dfe7[_0x13ea('0x78')](_0x12f192['query']['ids'])[_0x13ea('0x17')](function(){if(_[_0x13ea('0x79')](_0x12f192[_0x13ea('0x2e')][_0x13ea('0x56')])){for(var _0x29d389=0x0;_0x29d389<_0x12f192[_0x13ea('0x2e')][_0x13ea('0x56')]['length'];_0x29d389+=0x1){socket[_0x13ea('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x12f192[_0x13ea('0x2e')][_0x13ea('0x56')][_0x29d389]),'OpenchannelQueueId':Number(_0x12f192['params']['id'])});}}else{socket[_0x13ea('0x5e')](_0x13ea('0x73'),{'UserId':Number(_0x12f192[_0x13ea('0x2e')]['ids']),'OpenchannelQueueId':Number(_0x12f192[_0x13ea('0x2b')]['id'])});}});}})[_0x13ea('0x17')](respondWithStatusCode(_0x2e8f36,null))[_0x13ea('0x29')](handleError(_0x2e8f36,null));};exports[_0x13ea('0x7a')]=function(_0x3a40f4,_0x501cff){var _0x5b1a40={};var _0x2325d9={};var _0x4fd693;var _0x108f9e;return db['OpenchannelQueue'][_0x13ea('0x40')]({'where':{'id':_0x3a40f4['params']['id']}})[_0x13ea('0x17')](handleEntityNotFound(_0x501cff,null))['then'](function(_0x3c5c4d){if(_0x3c5c4d){_0x4fd693=_0x3c5c4d;_0x2325d9[_0x13ea('0x2c')]=_[_0x13ea('0x2d')](db['User'][_0x13ea('0x20')]);_0x2325d9[_0x13ea('0x2e')]=_[_0x13ea('0x2d')](_0x3a40f4['query']);_0x2325d9[_0x13ea('0x2f')]=_[_0x13ea('0x30')](_0x2325d9[_0x13ea('0x2c')],_0x2325d9[_0x13ea('0x2e')]);_0x5b1a40[_0x13ea('0x31')]=_[_0x13ea('0x30')](_0x2325d9[_0x13ea('0x2c')],qs[_0x13ea('0x32')](_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x32')]));_0x5b1a40['attributes']=_0x5b1a40['attributes'][_0x13ea('0x42')]?_0x5b1a40['attributes']:_0x2325d9[_0x13ea('0x2c')];_0x5b1a40[_0x13ea('0x45')]=qs[_0x13ea('0x46')](_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x46')]);_0x5b1a40['where']=qs[_0x13ea('0x2f')](_[_0x13ea('0x48')](_0x3a40f4[_0x13ea('0x2e')],_0x2325d9[_0x13ea('0x2f')]));if(_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x4a')]){_0x5b1a40[_0x13ea('0x47')]=_[_0x13ea('0x34')](_0x5b1a40[_0x13ea('0x47')],{'$or':_['map'](_0x5b1a40['attributes'],function(_0x518dfa){var _0x1d8e65={};_0x1d8e65[_0x518dfa]={'$like':'%'+_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x4a')]+'%'};return _0x1d8e65;})});}_0x5b1a40=_[_0x13ea('0x34')]({},_0x5b1a40,_0x3a40f4[_0x13ea('0x35')]);return _0x4fd693[_0x13ea('0x7a')](_0x5b1a40);}})[_0x13ea('0x17')](function(_0xc83f21){if(_0xc83f21){_0x108f9e=_0xc83f21['length'];if(!_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x43')](_0x13ea('0x44'))){_0x5b1a40[_0x13ea('0x12')]=qs[_0x13ea('0x12')](_0x3a40f4[_0x13ea('0x2e')][_0x13ea('0x12')]);_0x5b1a40['offset']=qs[_0x13ea('0x10')](_0x3a40f4[_0x13ea('0x2e')]['offset']);}return _0x4fd693[_0x13ea('0x7a')](_0x5b1a40);}})[_0x13ea('0x17')](function(_0x223615){if(_0x223615){return _0x223615?{'count':_0x108f9e,'rows':_0x223615}:null;}})[_0x13ea('0x17')](respondWithResult(_0x501cff,null))['catch'](handleError(_0x501cff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 11b243c..3c7d525 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 _0x0e14=['hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','emit','hasOwnProperty'];(function(_0x432ddf,_0x2b599f){var _0x2895b8=function(_0x3d77cf){while(--_0x3d77cf){_0x432ddf['push'](_0x432ddf['shift']());}};_0x2895b8(++_0x2b599f);}(_0x0e14,0x119));var _0x40e1=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x0e14[_0xf71120];return _0xbe2fd3;};'use strict';var EventEmitter=require(_0x40e1('0x0'));var OpenchannelQueue=require(_0x40e1('0x1'))['db'][_0x40e1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x40e1('0x3'),'afterUpdate':_0x40e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30e516){return function(_0x38c58c,_0x127ea5,_0x46fc20){OpenchannelQueueEvents['emit'](_0x30e516+':'+_0x38c58c['id'],_0x38c58c);OpenchannelQueueEvents[_0x40e1('0x5')](_0x30e516,_0x38c58c);_0x46fc20(null);};}for(var e in events){if(events[_0x40e1('0x6')](e)){var event=events[e];OpenchannelQueue[_0x40e1('0x7')](e,emitEvent(event));}}module[_0x40e1('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xfcd4=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xfcd4,0x175));var _0x4fcd=function(_0x32b5da,_0x45d994){_0x32b5da=_0x32b5da-0x0;var _0x1304ab=_0xfcd4[_0x32b5da];return _0x1304ab;};'use strict';var EventEmitter=require(_0x4fcd('0x0'));var OpenchannelQueue=require(_0x4fcd('0x1'))['db'][_0x4fcd('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4fcd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fcd('0x4'),'afterDestroy':_0x4fcd('0x5')};function emitEvent(_0x32cc3d){return function(_0x45d90c,_0x32f0fe,_0x52260d){OpenchannelQueueEvents[_0x4fcd('0x6')](_0x32cc3d+':'+_0x45d90c['id'],_0x45d90c);OpenchannelQueueEvents[_0x4fcd('0x6')](_0x32cc3d,_0x45d90c);_0x52260d(null);};}for(var e in events){if(events[_0x4fcd('0x7')](e)){var event=events[e];OpenchannelQueue[_0x4fcd('0x8')](e,emitEvent(event));}}module[_0x4fcd('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 5d5ac2e..3e3ac42 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 _0x151c=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','openchannel_queues','util'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0x151c,0xf9));var _0xc151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x151c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc151('0x0'));var logger=require(_0xc151('0x1'))(_0xc151('0x2'));var moment=require('moment');var BPromise=require(_0xc151('0x3'));var rp=require(_0xc151('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc151('0x5'));var config=require(_0xc151('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xc151('0x7')]=function(_0x4d8655,_0x10b218){return _0x4d8655[_0xc151('0x8')]('OpenchannelQueue',attributes,{'tableName':_0xc151('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7692=['OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7692,0x106));var _0x2769=function(_0x2e2ce8,_0x436b78){_0x2e2ce8=_0x2e2ce8-0x0;var _0x1d92a7=_0x7692[_0x2e2ce8];return _0x1d92a7;};'use strict';var _=require('lodash');var util=require(_0x2769('0x0'));var logger=require(_0x2769('0x1'))(_0x2769('0x2'));var moment=require(_0x2769('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2769('0x4'));var attributes=require(_0x2769('0x5'));module[_0x2769('0x6')]=function(_0x4e9ad5,_0x1b2a16){return _0x4e9ad5[_0x2769('0x7')](_0x2769('0x8'),attributes,{'tableName':_0x2769('0x9'),'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 c349885..1eb1868 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 _0x3fbd=['then','debug','ShowOpenchannelQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0x3fbd,0xf5));var _0xd3fb=function(_0xfb7c03,_0x426640){_0xfb7c03=_0xfb7c03-0x0;var _0x8324d5=_0x3fbd[_0xfb7c03];return _0x8324d5;};'use strict';var _=require(_0xd3fb('0x0'));var util=require(_0xd3fb('0x1'));var moment=require(_0xd3fb('0x2'));var BPromise=require(_0xd3fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3fb('0x4'));var db=require(_0xd3fb('0x5'))['db'];var utils=require(_0xd3fb('0x6'));var logger=require('../../config/logger')(_0xd3fb('0x7'));var config=require(_0xd3fb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3fb('0x9')]({'port':0x232a});config['redis']=_[_0xd3fb('0xa')](config[_0xd3fb('0xb')],{'host':_0xd3fb('0xc'),'port':0x18eb});var socket=require(_0xd3fb('0xd'))(new Redis(config[_0xd3fb('0xb')]));require(_0xd3fb('0xe'))[_0xd3fb('0xf')](socket);function respondWithRpcPromise(_0x4c2602,_0x4bf6e4,_0x324b00){return new BPromise(function(_0x3246fb,_0xaf9c19){return client['request'](_0x4c2602,_0x324b00)['then'](function(_0x528489){logger[_0xd3fb('0x10')](_0xd3fb('0x11'),_0x4bf6e4,_0xd3fb('0x12'));logger['debug'](_0xd3fb('0x13'),_0x4bf6e4,_0xd3fb('0x12'),JSON[_0xd3fb('0x14')](_0x528489));if(_0x528489[_0xd3fb('0x15')]){if(_0x528489['error'][_0xd3fb('0x16')]===0x1f4){logger[_0xd3fb('0x15')](_0xd3fb('0x11'),_0x4bf6e4,_0x528489['error'][_0xd3fb('0x17')]);return _0xaf9c19(_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4bf6e4,_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);return _0x3246fb(_0x528489[_0xd3fb('0x15')][_0xd3fb('0x17')]);}else{logger[_0xd3fb('0x10')](_0xd3fb('0x11'),_0x4bf6e4,_0xd3fb('0x12'));_0x3246fb(_0x528489[_0xd3fb('0x18')][_0xd3fb('0x17')]);}})[_0xd3fb('0x19')](function(_0x10934a){logger[_0xd3fb('0x15')](_0xd3fb('0x11'),_0x4bf6e4,_0x10934a);_0xaf9c19(_0x10934a);});});}exports[_0xd3fb('0x1a')]=function(_0x197483){var _0x3ae4e0=this;return new Promise(function(_0x330116,_0x299375){return db[_0xd3fb('0x1b')]['findAll']({'raw':_0x197483['options']?_0x197483[_0xd3fb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1d')]||null:null,'attributes':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1e')]||null:null,'limit':_0x197483['options']?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x1f')]||null:null,'include':_0x197483[_0xd3fb('0x1c')]?_0x197483[_0xd3fb('0x1c')][_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x197483[_0xd3fb('0x1c')]['include'],function(_0x2bbe38){return{'model':db[_0x2bbe38[_0xd3fb('0x22')]],'as':_0x2bbe38['as'],'attributes':_0x2bbe38[_0xd3fb('0x1e')],'include':_0x2bbe38[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x2bbe38[_0xd3fb('0x20')],function(_0x34be6b){return{'model':db[_0x34be6b[_0xd3fb('0x22')]],'as':_0x34be6b['as'],'attributes':_0x34be6b[_0xd3fb('0x1e')],'include':_0x34be6b[_0xd3fb('0x20')]?_['map'](_0x34be6b[_0xd3fb('0x20')],function(_0x402f0b){return{'model':db[_0x402f0b[_0xd3fb('0x22')]],'as':_0x402f0b['as'],'attributes':_0x402f0b[_0xd3fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3fb('0x23')](function(_0x1dc531){logger[_0xd3fb('0x10')]('GetOpenchannelQueue',_0x197483);logger[_0xd3fb('0x24')]('GetOpenchannelQueue',_0x197483,JSON['stringify'](_0x1dc531));_0x330116(_0x1dc531);})['catch'](function(_0x483602){logger[_0xd3fb('0x15')]('GetOpenchannelQueue',_0x483602[_0xd3fb('0x17')],_0x197483);_0x299375(_0x3ae4e0['error'](0x1f4,_0x483602[_0xd3fb('0x17')]));});});};exports[_0xd3fb('0x25')]=function(_0xbe0022){var _0x4fa863=this;return new Promise(function(_0xf25c74,_0x39c1a7){return db[_0xd3fb('0x1b')][_0xd3fb('0x26')]({'raw':_0xbe0022['options']?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x27')]===undefined?!![]:![]:!![],'where':_0xbe0022['options']?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x1d')]||null:null,'attributes':_0xbe0022[_0xd3fb('0x1c')]?_0xbe0022['options'][_0xd3fb('0x1e')]||null:null,'include':_0xbe0022[_0xd3fb('0x1c')]?_0xbe0022[_0xd3fb('0x1c')][_0xd3fb('0x20')]?_['map'](_0xbe0022['options']['include'],function(_0x640f75){return{'model':db[_0x640f75[_0xd3fb('0x22')]],'as':_0x640f75['as'],'attributes':_0x640f75['attributes'],'include':_0x640f75[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x640f75[_0xd3fb('0x20')],function(_0x3ff51f){return{'model':db[_0x3ff51f[_0xd3fb('0x22')]],'as':_0x3ff51f['as'],'attributes':_0x3ff51f[_0xd3fb('0x1e')],'include':_0x3ff51f[_0xd3fb('0x20')]?_[_0xd3fb('0x21')](_0x3ff51f[_0xd3fb('0x20')],function(_0x4a7cc9){return{'model':db[_0x4a7cc9[_0xd3fb('0x22')]],'as':_0x4a7cc9['as'],'attributes':_0x4a7cc9[_0xd3fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3fb('0x23')](function(_0x3cfc0b){logger[_0xd3fb('0x10')]('ShowOpenchannelQueue',_0xbe0022);logger[_0xd3fb('0x24')](_0xd3fb('0x25'),_0xbe0022,JSON[_0xd3fb('0x14')](_0x3cfc0b));_0xf25c74(_0x3cfc0b);})[_0xd3fb('0x19')](function(_0x388bb7){logger['error'](_0xd3fb('0x25'),_0x388bb7[_0xd3fb('0x17')],_0xbe0022);_0x39c1a7(_0x4fa863['error'](0x1f4,_0x388bb7[_0xd3fb('0x17')]));});});}; \ No newline at end of file +var _0xc902=['defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','include','model','stringify','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x3c9fcf,_0x4f639f){var _0x26d6a5=function(_0x352d4c){while(--_0x352d4c){_0x3c9fcf['push'](_0x3c9fcf['shift']());}};_0x26d6a5(++_0x4f639f);}(_0xc902,0x15c));var _0x2c90=function(_0x20d368,_0x553afd){_0x20d368=_0x20d368-0x0;var _0x52032e=_0xc902[_0x20d368];return _0x52032e;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var moment=require(_0x2c90('0x2'));var BPromise=require(_0x2c90('0x3'));var rs=require(_0x2c90('0x4'));var fs=require('fs');var Redis=require(_0x2c90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c90('0x6'));var logger=require(_0x2c90('0x7'))(_0x2c90('0x8'));var config=require(_0x2c90('0x9'));var jayson=require(_0x2c90('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x2c90('0xb')]=_[_0x2c90('0xc')](config[_0x2c90('0xb')],{'host':_0x2c90('0xd'),'port':0x18eb});var socket=require(_0x2c90('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x2c90('0xf')](socket);function respondWithRpcPromise(_0x4a0495,_0x128764,_0x196bee){return new BPromise(function(_0xedc4c9,_0x44529d){return client[_0x2c90('0x10')](_0x4a0495,_0x196bee)[_0x2c90('0x11')](function(_0x876e34){logger[_0x2c90('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x128764,_0x2c90('0x13'));logger[_0x2c90('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x128764,_0x2c90('0x13'),JSON['stringify'](_0x876e34));if(_0x876e34[_0x2c90('0x15')]){if(_0x876e34[_0x2c90('0x15')][_0x2c90('0x16')]===0x1f4){logger[_0x2c90('0x15')](_0x2c90('0x17'),_0x128764,_0x876e34[_0x2c90('0x15')]['message']);return _0x44529d(_0x876e34[_0x2c90('0x15')][_0x2c90('0x18')]);}logger[_0x2c90('0x15')](_0x2c90('0x17'),_0x128764,_0x876e34[_0x2c90('0x15')][_0x2c90('0x18')]);return _0xedc4c9(_0x876e34[_0x2c90('0x15')][_0x2c90('0x18')]);}else{logger[_0x2c90('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x128764,_0x2c90('0x13'));_0xedc4c9(_0x876e34[_0x2c90('0x19')]['message']);}})['catch'](function(_0x5a93f8){logger[_0x2c90('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x128764,_0x5a93f8);_0x44529d(_0x5a93f8);});});}exports[_0x2c90('0x1a')]=function(_0x3a487d){var _0x5df5db=this;return new Promise(function(_0x2b9d7a,_0x8804ff){return db[_0x2c90('0x1b')][_0x2c90('0x1c')]({'raw':_0x3a487d[_0x2c90('0x1d')]?_0x3a487d[_0x2c90('0x1d')][_0x2c90('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a487d[_0x2c90('0x1d')]?_0x3a487d[_0x2c90('0x1d')][_0x2c90('0x1f')]||null:null,'attributes':_0x3a487d[_0x2c90('0x1d')]?_0x3a487d[_0x2c90('0x1d')][_0x2c90('0x20')]||null:null,'limit':_0x3a487d[_0x2c90('0x1d')]?_0x3a487d[_0x2c90('0x1d')]['limit']||null:null,'include':_0x3a487d[_0x2c90('0x1d')]?_0x3a487d['options']['include']?_[_0x2c90('0x21')](_0x3a487d[_0x2c90('0x1d')][_0x2c90('0x22')],function(_0x3064ed){return{'model':db[_0x3064ed['model']],'as':_0x3064ed['as'],'attributes':_0x3064ed[_0x2c90('0x20')],'include':_0x3064ed[_0x2c90('0x22')]?_[_0x2c90('0x21')](_0x3064ed[_0x2c90('0x22')],function(_0x4a3bb3){return{'model':db[_0x4a3bb3[_0x2c90('0x23')]],'as':_0x4a3bb3['as'],'attributes':_0x4a3bb3[_0x2c90('0x20')],'include':_0x4a3bb3['include']?_[_0x2c90('0x21')](_0x4a3bb3[_0x2c90('0x22')],function(_0x151462){return{'model':db[_0x151462[_0x2c90('0x23')]],'as':_0x151462['as'],'attributes':_0x151462[_0x2c90('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2137b6){logger['info'](_0x2c90('0x1a'),_0x3a487d);logger[_0x2c90('0x14')]('GetOpenchannelQueue',_0x3a487d,JSON[_0x2c90('0x24')](_0x2137b6));_0x2b9d7a(_0x2137b6);})[_0x2c90('0x25')](function(_0x54f9dd){logger[_0x2c90('0x15')](_0x2c90('0x1a'),_0x54f9dd['message'],_0x3a487d);_0x8804ff(_0x5df5db[_0x2c90('0x15')](0x1f4,_0x54f9dd[_0x2c90('0x18')]));});});};exports[_0x2c90('0x26')]=function(_0x507108){var _0x560459=this;return new Promise(function(_0x40e8dc,_0x28934c){return db[_0x2c90('0x1b')][_0x2c90('0x27')]({'raw':_0x507108['options']?_0x507108['options'][_0x2c90('0x1e')]===undefined?!![]:![]:!![],'where':_0x507108['options']?_0x507108[_0x2c90('0x1d')][_0x2c90('0x1f')]||null:null,'attributes':_0x507108[_0x2c90('0x1d')]?_0x507108['options'][_0x2c90('0x20')]||null:null,'include':_0x507108[_0x2c90('0x1d')]?_0x507108['options'][_0x2c90('0x22')]?_[_0x2c90('0x21')](_0x507108[_0x2c90('0x1d')][_0x2c90('0x22')],function(_0x4b90dd){return{'model':db[_0x4b90dd['model']],'as':_0x4b90dd['as'],'attributes':_0x4b90dd[_0x2c90('0x20')],'include':_0x4b90dd[_0x2c90('0x22')]?_[_0x2c90('0x21')](_0x4b90dd[_0x2c90('0x22')],function(_0x35c8cf){return{'model':db[_0x35c8cf[_0x2c90('0x23')]],'as':_0x35c8cf['as'],'attributes':_0x35c8cf[_0x2c90('0x20')],'include':_0x35c8cf[_0x2c90('0x22')]?_['map'](_0x35c8cf[_0x2c90('0x22')],function(_0x38cca4){return{'model':db[_0x38cca4[_0x2c90('0x23')]],'as':_0x38cca4['as'],'attributes':_0x38cca4[_0x2c90('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2c90('0x11')](function(_0x2bcdfb){logger['info'](_0x2c90('0x26'),_0x507108);logger[_0x2c90('0x14')](_0x2c90('0x26'),_0x507108,JSON[_0x2c90('0x24')](_0x2bcdfb));_0x40e8dc(_0x2bcdfb);})[_0x2c90('0x25')](function(_0x39b709){logger['error'](_0x2c90('0x26'),_0x39b709[_0x2c90('0x18')],_0x507108);_0x28934c(_0x560459[_0x2c90('0x15')](0x1f4,_0x39b709[_0x2c90('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 31854db..ad2ace5 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 _0x0b76=['./openchannelQueue.events','save','remove','update','removeListener','register','length'];(function(_0x260da4,_0x28125){var _0x1b031a=function(_0x171622){while(--_0x171622){_0x260da4['push'](_0x260da4['shift']());}};_0x1b031a(++_0x28125);}(_0x0b76,0x77));var _0x60b7=function(_0x2e536f,_0x3190be){_0x2e536f=_0x2e536f-0x0;var _0x156b71=_0x0b76[_0x2e536f];return _0x156b71;};'use strict';var OpenchannelQueueEvents=require(_0x60b7('0x0'));var events=[_0x60b7('0x1'),_0x60b7('0x2'),_0x60b7('0x3')];function createListener(_0x2c68db,_0x43bc6a){return function(_0x62618e){_0x43bc6a['emit'](_0x2c68db,_0x62618e);};}function removeListener(_0x248583,_0x409578){return function(){OpenchannelQueueEvents[_0x60b7('0x4')](_0x248583,_0x409578);};}exports[_0x60b7('0x5')]=function(_0x1b4a82){for(var _0x2397fa=0x0,_0x13dff8=events[_0x60b7('0x6')];_0x2397fa<_0x13dff8;_0x2397fa++){var _0x252362=events[_0x2397fa];var _0x1e8896=createListener('openchannelQueue:'+_0x252362,_0x1b4a82);OpenchannelQueueEvents['on'](_0x252362,_0x1e8896);}}; \ No newline at end of file +var _0xd127=['removeListener','register','./openchannelQueue.events','remove','update','emit'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xd127,0x80));var _0x7d12=function(_0x139394,_0x1ddbc1){_0x139394=_0x139394-0x0;var _0x1dcc21=_0xd127[_0x139394];return _0x1dcc21;};'use strict';var OpenchannelQueueEvents=require(_0x7d12('0x0'));var events=['save',_0x7d12('0x1'),_0x7d12('0x2')];function createListener(_0x533977,_0x3ee028){return function(_0x4eacd4){_0x3ee028[_0x7d12('0x3')](_0x533977,_0x4eacd4);};}function removeListener(_0x4e3e76,_0x239db0){return function(){OpenchannelQueueEvents[_0x7d12('0x4')](_0x4e3e76,_0x239db0);};}exports[_0x7d12('0x5')]=function(_0x2cc77f){for(var _0x3fcec0=0x0,_0x526ef6=events['length'];_0x3fcec0<_0x526ef6;_0x3fcec0++){var _0x26d8ea=events[_0x3fcec0];var _0x524248=createListener('openchannelQueue:'+_0x26d8ea,_0x2cc77f);OpenchannelQueueEvents['on'](_0x26d8ea,_0x524248);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d15e9ad..480a530 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 _0xd421=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x2881ce,_0x410186){var _0x3c6fb3=function(_0x5174a4){while(--_0x5174a4){_0x2881ce['push'](_0x2881ce['shift']());}};_0x3c6fb3(++_0x410186);}(_0xd421,0x10a));var _0x1d42=function(_0x2d1386,_0x47a6c0){_0x2d1386=_0x2d1386-0x0;var _0x253c8e=_0xd421[_0x2d1386];return _0x253c8e;};'use strict';var multer=require(_0x1d42('0x0'));var util=require(_0x1d42('0x1'));var path=require('path');var timeout=require(_0x1d42('0x2'));var express=require(_0x1d42('0x3'));var router=express[_0x1d42('0x4')]();var fs_extra=require(_0x1d42('0x5'));var auth=require(_0x1d42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d42('0x7'));var controller=require(_0x1d42('0x8'));router['get']('/',auth[_0x1d42('0x9')](),controller[_0x1d42('0xa')]);router[_0x1d42('0xb')](_0x1d42('0xc'),auth[_0x1d42('0x9')](),controller[_0x1d42('0xd')]);router[_0x1d42('0xb')](_0x1d42('0xe'),auth['isAuthenticated'](),controller[_0x1d42('0xf')]);router[_0x1d42('0x10')]('/',auth[_0x1d42('0x9')](),controller[_0x1d42('0x11')]);router[_0x1d42('0x12')](_0x1d42('0xe'),auth[_0x1d42('0x9')](),controller['update']);router[_0x1d42('0x13')](_0x1d42('0xe'),auth[_0x1d42('0x9')](),controller[_0x1d42('0x14')]);module[_0x1d42('0x15')]=router; \ No newline at end of file +var _0xf6d7=['update','multer','path','connect-timeout','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x45edd0,_0x3f4de4){var _0x9c8a62=function(_0x265c9b){while(--_0x265c9b){_0x45edd0['push'](_0x45edd0['shift']());}};_0x9c8a62(++_0x3f4de4);}(_0xf6d7,0x71));var _0x7f6d=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0xf6d7[_0x3cb21e];return _0xeacd6a;};'use strict';var multer=require(_0x7f6d('0x0'));var util=require('util');var path=require(_0x7f6d('0x1'));var timeout=require(_0x7f6d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f6d('0x4'));var controller=require(_0x7f6d('0x5'));router[_0x7f6d('0x6')]('/',auth[_0x7f6d('0x7')](),controller[_0x7f6d('0x8')]);router[_0x7f6d('0x6')](_0x7f6d('0x9'),auth['isAuthenticated'](),controller[_0x7f6d('0xa')]);router[_0x7f6d('0x6')](_0x7f6d('0xb'),auth[_0x7f6d('0x7')](),controller['show']);router[_0x7f6d('0xc')]('/',auth[_0x7f6d('0x7')](),controller[_0x7f6d('0xd')]);router[_0x7f6d('0xe')](_0x7f6d('0xb'),auth[_0x7f6d('0x7')](),controller[_0x7f6d('0xf')]);router['delete'](_0x7f6d('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4a0771a..f877aa5 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 _0x4677=['DATE','moment','sequelize','exports','STRING'];(function(_0x1c3169,_0x180ec1){var _0x1116c9=function(_0x46c425){while(--_0x46c425){_0x1c3169['push'](_0x1c3169['shift']());}};_0x1116c9(++_0x180ec1);}(_0x4677,0x105));var _0x7467=function(_0x1d85c3,_0x45771d){_0x1d85c3=_0x1d85c3-0x0;var _0x10598a=_0x4677[_0x1d85c3];return _0x10598a;};'use strict';var moment=require(_0x7467('0x0'));var Sequelize=require(_0x7467('0x1'));module[_0x7467('0x2')]={'uniqueid':{'type':Sequelize[_0x7467('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7467('0x3')]},'joinAt':{'type':Sequelize[_0x7467('0x4')]},'leaveAt':{'type':Sequelize[_0x7467('0x4')]},'acceptAt':{'type':Sequelize[_0x7467('0x4')]},'exitAt':{'type':Sequelize[_0x7467('0x4')]},'reason':{'type':Sequelize[_0x7467('0x3')]}}; \ No newline at end of file +var _0x3923=['moment','sequelize','exports','STRING','DATE'];(function(_0x1ca035,_0x259969){var _0x258b49=function(_0x29b42b){while(--_0x29b42b){_0x1ca035['push'](_0x1ca035['shift']());}};_0x258b49(++_0x259969);}(_0x3923,0x1e0));var _0x3392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3923[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x3392('0x0'));var Sequelize=require(_0x3392('0x1'));module[_0x3392('0x2')]={'uniqueid':{'type':Sequelize[_0x3392('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3392('0x4')]},'leaveAt':{'type':Sequelize[_0x3392('0x4')]},'acceptAt':{'type':Sequelize[_0x3392('0x4')]},'exitAt':{'type':Sequelize[_0x3392('0x4')]},'reason':{'type':Sequelize[_0x3392('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c978048..c07141c 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 _0x1e2d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x28e424,_0x4d6508){var _0x25ab59=function(_0x3ff7b4){while(--_0x3ff7b4){_0x28e424['push'](_0x28e424['shift']());}};_0x25ab59(++_0x4d6508);}(_0x1e2d,0x10b));var _0xd1e2=function(_0x2a2c50,_0x3f863e){_0x2a2c50=_0x2a2c50-0x0;var _0x11457a=_0x1e2d[_0x2a2c50];return _0x11457a;};'use strict';var emlformat=require(_0xd1e2('0x0'));var rimraf=require(_0xd1e2('0x1'));var zipdir=require(_0xd1e2('0x2'));var jsonpatch=require(_0xd1e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd1e2('0x4'));var Mustache=require(_0xd1e2('0x5'));var util=require(_0xd1e2('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1e2('0x7'));var _=require(_0xd1e2('0x8'));var squel=require(_0xd1e2('0x9'));var crypto=require('crypto');var jsforce=require(_0xd1e2('0xa'));var deskjs=require(_0xd1e2('0xb'));var toCsv=require(_0xd1e2('0xc'));var querystring=require(_0xd1e2('0xd'));var Papa=require(_0xd1e2('0xe'));var Redis=require(_0xd1e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd1e2('0x10'));var as=require(_0xd1e2('0x11'));var hardwareService=require(_0xd1e2('0x12'));var logger=require('../../config/logger')(_0xd1e2('0x13'));var utils=require('../../config/utils');var config=require(_0xd1e2('0x14'));var licenseUtil=require(_0xd1e2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3a5fa,_0x18cb2c){_0x18cb2c=_0x18cb2c||0xcc;return function(_0x310c2e){if(_0x310c2e){return _0xb3a5fa[_0xd1e2('0x16')](_0x18cb2c);}return _0xb3a5fa[_0xd1e2('0x17')](_0x18cb2c)['end']();};}function respondWithResult(_0x1606b4,_0x398a02){_0x398a02=_0x398a02||0xc8;return function(_0x2bba29){if(_0x2bba29){return _0x1606b4[_0xd1e2('0x17')](_0x398a02)[_0xd1e2('0x18')](_0x2bba29);}};}function respondWithFilteredResult(_0x4e95b5,_0x2cc911){return function(_0x4df0c4){if(_0x4df0c4){var _0xbb7cab=typeof _0x2cc911[_0xd1e2('0x19')]===_0xd1e2('0x1a')&&typeof _0x2cc911[_0xd1e2('0x1b')]===_0xd1e2('0x1a');var _0x2cedad=_0x4df0c4[_0xd1e2('0x1c')];var _0x59af72=_0xbb7cab?0x0:_0x2cc911[_0xd1e2('0x19')];var _0x32db44=_0xbb7cab?_0x4df0c4['count']:_0x2cc911[_0xd1e2('0x19')]+_0x2cc911['limit'];var _0x82f642;if(_0x32db44>=_0x2cedad){_0x32db44=_0x2cedad;_0x82f642=0xc8;}else{_0x82f642=0xce;}_0x4e95b5[_0xd1e2('0x17')](_0x82f642);return _0x4e95b5[_0xd1e2('0x1d')]('Content-Range',_0x59af72+'-'+_0x32db44+'/'+_0x2cedad)['json'](_0x4df0c4);}return null;};}function patchUpdates(_0x3de61f){return function(_0x4990f6){try{jsonpatch[_0xd1e2('0x1e')](_0x4990f6,_0x3de61f,!![]);}catch(_0x1dc8b9){return BPromise[_0xd1e2('0x1f')](_0x1dc8b9);}return _0x4990f6[_0xd1e2('0x20')]();};}function saveUpdates(_0x1cbd8a,_0x513eed){return function(_0x52ae4d){if(_0x52ae4d){return _0x52ae4d[_0xd1e2('0x21')](_0x1cbd8a)[_0xd1e2('0x22')](function(_0x63031b){return _0x63031b;});}return null;};}function removeEntity(_0x51cd42,_0x416e39){return function(_0x1baedd){if(_0x1baedd){return _0x1baedd[_0xd1e2('0x23')]()[_0xd1e2('0x22')](function(){_0x51cd42[_0xd1e2('0x17')](0xcc)[_0xd1e2('0x24')]();});}};}function handleEntityNotFound(_0x292da1,_0x123207){return function(_0x33334e){if(!_0x33334e){_0x292da1[_0xd1e2('0x16')](0x194);}return _0x33334e;};}function handleError(_0x4eb5ad,_0x88384b){_0x88384b=_0x88384b||0x1f4;return function(_0x2dae68){logger[_0xd1e2('0x25')](_0x2dae68[_0xd1e2('0x26')]);if(_0x2dae68[_0xd1e2('0x27')]){delete _0x2dae68[_0xd1e2('0x27')];}_0x4eb5ad[_0xd1e2('0x17')](_0x88384b)[_0xd1e2('0x28')](_0x2dae68);};}exports['index']=function(_0x1cf3a1,_0x25da0d){var _0x5ea171={},_0x2e942c={},_0x5984b2={'count':0x0,'rows':[]};var _0x55db4e=_[_0xd1e2('0x29')](db[_0xd1e2('0x2a')][_0xd1e2('0x2b')],function(_0x16cd5d){return{'name':_0x16cd5d[_0xd1e2('0x2c')],'type':_0x16cd5d[_0xd1e2('0x2d')]['key']};});_0x2e942c['model']=_[_0xd1e2('0x29')](_0x55db4e,_0xd1e2('0x27'));_0x2e942c['query']=_[_0xd1e2('0x2e')](_0x1cf3a1[_0xd1e2('0x2f')]);_0x2e942c[_0xd1e2('0x30')]=_[_0xd1e2('0x31')](_0x2e942c['model'],_0x2e942c[_0xd1e2('0x2f')]);_0x5ea171[_0xd1e2('0x32')]=_[_0xd1e2('0x31')](_0x2e942c[_0xd1e2('0x33')],qs[_0xd1e2('0x34')](_0x1cf3a1[_0xd1e2('0x2f')]['fields']));_0x5ea171['attributes']=_0x5ea171[_0xd1e2('0x32')][_0xd1e2('0x35')]?_0x5ea171['attributes']:_0x2e942c[_0xd1e2('0x33')];if(!_0x1cf3a1['query']['hasOwnProperty'](_0xd1e2('0x36'))){_0x5ea171['limit']=qs[_0xd1e2('0x1b')](_0x1cf3a1[_0xd1e2('0x2f')]['limit']);_0x5ea171[_0xd1e2('0x19')]=qs[_0xd1e2('0x19')](_0x1cf3a1['query'][_0xd1e2('0x19')]);}_0x5ea171['order']=qs[_0xd1e2('0x37')](_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x37')]);_0x5ea171[_0xd1e2('0x38')]=qs['filters'](_[_0xd1e2('0x39')](_0x1cf3a1[_0xd1e2('0x2f')],_0x2e942c['filters']),_0x55db4e);if(_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3a')]){_0x5ea171['where']=_[_0xd1e2('0x3b')](_0x5ea171[_0xd1e2('0x38')],{'$or':_['map'](_0x55db4e,function(_0xdcca88){if(_0xdcca88['type']!=='VIRTUAL'){var _0xf03fc7={};_0xf03fc7[_0xdcca88[_0xd1e2('0x27')]]={'$like':'%'+_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3a')]+'%'};return _0xf03fc7;}})});}_0x5ea171=_[_0xd1e2('0x3b')]({},_0x5ea171,_0x1cf3a1[_0xd1e2('0x3c')]);var _0x70783f={'where':_0x5ea171[_0xd1e2('0x38')]};return db[_0xd1e2('0x2a')][_0xd1e2('0x1c')](_0x70783f)[_0xd1e2('0x22')](function(_0x3b9af1){_0x5984b2['count']=_0x3b9af1;if(_0x1cf3a1[_0xd1e2('0x2f')][_0xd1e2('0x3d')]){_0x5ea171[_0xd1e2('0x3e')]=[{'all':!![]}];}return db[_0xd1e2('0x2a')][_0xd1e2('0x3f')](_0x5ea171);})[_0xd1e2('0x22')](function(_0x19ad7e){_0x5984b2['rows']=_0x19ad7e;return _0x5984b2;})[_0xd1e2('0x22')](respondWithFilteredResult(_0x25da0d,_0x5ea171))[_0xd1e2('0x40')](handleError(_0x25da0d,null));};exports[_0xd1e2('0x41')]=function(_0xcbded6,_0x374bae){var _0x301138={'raw':!![],'where':{'id':_0xcbded6[_0xd1e2('0x42')]['id']}},_0x51f10b={};_0x51f10b['model']=_['keys'](db[_0xd1e2('0x2a')][_0xd1e2('0x2b')]);_0x51f10b['query']=_['keys'](_0xcbded6['query']);_0x51f10b[_0xd1e2('0x30')]=_[_0xd1e2('0x31')](_0x51f10b[_0xd1e2('0x33')],_0x51f10b['query']);_0x301138[_0xd1e2('0x32')]=_[_0xd1e2('0x31')](_0x51f10b['model'],qs[_0xd1e2('0x34')](_0xcbded6[_0xd1e2('0x2f')][_0xd1e2('0x34')]));_0x301138['attributes']=_0x301138['attributes'][_0xd1e2('0x35')]?_0x301138['attributes']:_0x51f10b[_0xd1e2('0x33')];if(_0xcbded6['query'][_0xd1e2('0x3d')]){_0x301138['include']=[{'all':!![]}];}_0x301138=_['merge']({},_0x301138,_0xcbded6[_0xd1e2('0x3c')]);return db['OpenchannelQueueReport']['find'](_0x301138)[_0xd1e2('0x22')](handleEntityNotFound(_0x374bae,null))[_0xd1e2('0x22')](respondWithResult(_0x374bae,null))[_0xd1e2('0x40')](handleError(_0x374bae,null));};exports[_0xd1e2('0x43')]=function(_0x22928e,_0xa21bb4){return db[_0xd1e2('0x2a')][_0xd1e2('0x43')](_0x22928e[_0xd1e2('0x44')],{})[_0xd1e2('0x22')](respondWithResult(_0xa21bb4,0xc9))['catch'](handleError(_0xa21bb4,null));};exports[_0xd1e2('0x21')]=function(_0x241897,_0x568cb2){if(_0x241897[_0xd1e2('0x44')]['id']){delete _0x241897[_0xd1e2('0x44')]['id'];}return db[_0xd1e2('0x2a')][_0xd1e2('0x45')]({'where':{'id':_0x241897['params']['id']}})[_0xd1e2('0x22')](handleEntityNotFound(_0x568cb2,null))[_0xd1e2('0x22')](saveUpdates(_0x241897[_0xd1e2('0x44')],null))['then'](respondWithResult(_0x568cb2,null))[_0xd1e2('0x40')](handleError(_0x568cb2,null));};exports[_0xd1e2('0x23')]=function(_0x5a9ade,_0xd1bdcb){return db['OpenchannelQueueReport'][_0xd1e2('0x45')]({'where':{'id':_0x5a9ade[_0xd1e2('0x42')]['id']}})[_0xd1e2('0x22')](handleEntityNotFound(_0xd1bdcb,null))[_0xd1e2('0x22')](removeEntity(_0xd1bdcb,null))[_0xd1e2('0x40')](handleError(_0xd1bdcb,null));};exports[_0xd1e2('0x46')]=function(_0x187614,_0x971bb2){return db[_0xd1e2('0x2a')][_0xd1e2('0x46')]()[_0xd1e2('0x22')](respondWithResult(_0x971bb2,null))[_0xd1e2('0x40')](handleError(_0x971bb2,null));}; \ No newline at end of file +var _0x543d=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x543d,0xdf));var _0xd543=function(_0x108b66,_0x37db88){_0x108b66=_0x108b66-0x0;var _0x3ed76=_0x543d[_0x108b66];return _0x3ed76;};'use strict';var emlformat=require(_0xd543('0x0'));var rimraf=require(_0xd543('0x1'));var zipdir=require(_0xd543('0x2'));var jsonpatch=require(_0xd543('0x3'));var rp=require(_0xd543('0x4'));var moment=require(_0xd543('0x5'));var BPromise=require(_0xd543('0x6'));var Mustache=require(_0xd543('0x7'));var util=require(_0xd543('0x8'));var path=require('path');var sox=require(_0xd543('0x9'));var csv=require(_0xd543('0xa'));var ejs=require(_0xd543('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd543('0xc'));var squel=require(_0xd543('0xd'));var crypto=require(_0xd543('0xe'));var jsforce=require(_0xd543('0xf'));var deskjs=require(_0xd543('0x10'));var toCsv=require(_0xd543('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd543('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd543('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd543('0x13'));var logger=require(_0xd543('0x14'))(_0xd543('0x15'));var utils=require(_0xd543('0x16'));var config=require(_0xd543('0x17'));var licenseUtil=require(_0xd543('0x18'));var db=require(_0xd543('0x19'))['db'];function respondWithStatusCode(_0xd089ad,_0x372b75){_0x372b75=_0x372b75||0xcc;return function(_0x2feb3e){if(_0x2feb3e){return _0xd089ad['sendStatus'](_0x372b75);}return _0xd089ad[_0xd543('0x1a')](_0x372b75)[_0xd543('0x1b')]();};}function respondWithResult(_0x572e77,_0x3df3da){_0x3df3da=_0x3df3da||0xc8;return function(_0x295312){if(_0x295312){return _0x572e77[_0xd543('0x1a')](_0x3df3da)[_0xd543('0x1c')](_0x295312);}};}function respondWithFilteredResult(_0x473253,_0x192bb4){return function(_0x46e233){if(_0x46e233){var _0x11c977=typeof _0x192bb4['offset']===_0xd543('0x1d')&&typeof _0x192bb4['limit']===_0xd543('0x1d');var _0x25d47c=_0x46e233[_0xd543('0x1e')];var _0x301c8f=_0x11c977?0x0:_0x192bb4[_0xd543('0x1f')];var _0x47cc1b=_0x11c977?_0x46e233['count']:_0x192bb4['offset']+_0x192bb4[_0xd543('0x20')];var _0x2fd998;if(_0x47cc1b>=_0x25d47c){_0x47cc1b=_0x25d47c;_0x2fd998=0xc8;}else{_0x2fd998=0xce;}_0x473253[_0xd543('0x1a')](_0x2fd998);return _0x473253['set'](_0xd543('0x21'),_0x301c8f+'-'+_0x47cc1b+'/'+_0x25d47c)[_0xd543('0x1c')](_0x46e233);}return null;};}function patchUpdates(_0x2f7048){return function(_0x200762){try{jsonpatch[_0xd543('0x22')](_0x200762,_0x2f7048,!![]);}catch(_0x4bb249){return BPromise[_0xd543('0x23')](_0x4bb249);}return _0x200762[_0xd543('0x24')]();};}function saveUpdates(_0x2d85fe,_0x3f61bb){return function(_0x5a252e){if(_0x5a252e){return _0x5a252e[_0xd543('0x25')](_0x2d85fe)[_0xd543('0x26')](function(_0x1ec675){return _0x1ec675;});}return null;};}function removeEntity(_0x26e176,_0xf20ae2){return function(_0x703966){if(_0x703966){return _0x703966[_0xd543('0x27')]()['then'](function(){_0x26e176[_0xd543('0x1a')](0xcc)[_0xd543('0x1b')]();});}};}function handleEntityNotFound(_0x52c94b,_0x127ab1){return function(_0x2ffbe7){if(!_0x2ffbe7){_0x52c94b[_0xd543('0x28')](0x194);}return _0x2ffbe7;};}function handleError(_0x3605df,_0x1df49a){_0x1df49a=_0x1df49a||0x1f4;return function(_0x324218){logger[_0xd543('0x29')](_0x324218['stack']);if(_0x324218[_0xd543('0x2a')]){delete _0x324218[_0xd543('0x2a')];}_0x3605df[_0xd543('0x1a')](_0x1df49a)[_0xd543('0x2b')](_0x324218);};}exports['index']=function(_0x3bfcee,_0x580c1f){var _0x343536={},_0x157efe={},_0x598eb2={'count':0x0,'rows':[]};var _0x1a1416=_[_0xd543('0x2c')](db[_0xd543('0x2d')][_0xd543('0x2e')],function(_0x4b2bbb){return{'name':_0x4b2bbb[_0xd543('0x2f')],'type':_0x4b2bbb[_0xd543('0x30')][_0xd543('0x31')]};});_0x157efe['model']=_[_0xd543('0x2c')](_0x1a1416,_0xd543('0x2a'));_0x157efe[_0xd543('0x32')]=_[_0xd543('0x33')](_0x3bfcee[_0xd543('0x32')]);_0x157efe[_0xd543('0x34')]=_[_0xd543('0x35')](_0x157efe[_0xd543('0x36')],_0x157efe[_0xd543('0x32')]);_0x343536[_0xd543('0x37')]=_[_0xd543('0x35')](_0x157efe['model'],qs['fields'](_0x3bfcee[_0xd543('0x32')][_0xd543('0x38')]));_0x343536[_0xd543('0x37')]=_0x343536['attributes'][_0xd543('0x39')]?_0x343536[_0xd543('0x37')]:_0x157efe[_0xd543('0x36')];if(!_0x3bfcee[_0xd543('0x32')][_0xd543('0x3a')](_0xd543('0x3b'))){_0x343536[_0xd543('0x20')]=qs[_0xd543('0x20')](_0x3bfcee[_0xd543('0x32')][_0xd543('0x20')]);_0x343536[_0xd543('0x1f')]=qs[_0xd543('0x1f')](_0x3bfcee[_0xd543('0x32')][_0xd543('0x1f')]);}_0x343536[_0xd543('0x3c')]=qs[_0xd543('0x3d')](_0x3bfcee[_0xd543('0x32')][_0xd543('0x3d')]);_0x343536[_0xd543('0x3e')]=qs[_0xd543('0x34')](_['pick'](_0x3bfcee[_0xd543('0x32')],_0x157efe[_0xd543('0x34')]),_0x1a1416);if(_0x3bfcee[_0xd543('0x32')]['filter']){_0x343536['where']=_[_0xd543('0x3f')](_0x343536['where'],{'$or':_[_0xd543('0x2c')](_0x1a1416,function(_0xa15df2){if(_0xa15df2[_0xd543('0x30')]!==_0xd543('0x40')){var _0x5b4fe6={};_0x5b4fe6[_0xa15df2[_0xd543('0x2a')]]={'$like':'%'+_0x3bfcee[_0xd543('0x32')][_0xd543('0x41')]+'%'};return _0x5b4fe6;}})});}_0x343536=_['merge']({},_0x343536,_0x3bfcee[_0xd543('0x42')]);var _0x33d43b={'where':_0x343536[_0xd543('0x3e')]};return db[_0xd543('0x2d')]['count'](_0x33d43b)[_0xd543('0x26')](function(_0x1e1471){_0x598eb2[_0xd543('0x1e')]=_0x1e1471;if(_0x3bfcee[_0xd543('0x32')][_0xd543('0x43')]){_0x343536[_0xd543('0x44')]=[{'all':!![]}];}return db[_0xd543('0x2d')][_0xd543('0x45')](_0x343536);})['then'](function(_0x208e0e){_0x598eb2['rows']=_0x208e0e;return _0x598eb2;})[_0xd543('0x26')](respondWithFilteredResult(_0x580c1f,_0x343536))[_0xd543('0x46')](handleError(_0x580c1f,null));};exports['show']=function(_0x3d8f51,_0x73d69c){var _0x89c798={'raw':!![],'where':{'id':_0x3d8f51[_0xd543('0x47')]['id']}},_0x2f8455={};_0x2f8455[_0xd543('0x36')]=_[_0xd543('0x33')](db['OpenchannelQueueReport'][_0xd543('0x2e')]);_0x2f8455['query']=_[_0xd543('0x33')](_0x3d8f51['query']);_0x2f8455['filters']=_['intersection'](_0x2f8455[_0xd543('0x36')],_0x2f8455[_0xd543('0x32')]);_0x89c798['attributes']=_[_0xd543('0x35')](_0x2f8455[_0xd543('0x36')],qs[_0xd543('0x38')](_0x3d8f51[_0xd543('0x32')][_0xd543('0x38')]));_0x89c798[_0xd543('0x37')]=_0x89c798['attributes']['length']?_0x89c798[_0xd543('0x37')]:_0x2f8455[_0xd543('0x36')];if(_0x3d8f51[_0xd543('0x32')]['includeAll']){_0x89c798['include']=[{'all':!![]}];}_0x89c798=_[_0xd543('0x3f')]({},_0x89c798,_0x3d8f51[_0xd543('0x42')]);return db[_0xd543('0x2d')][_0xd543('0x48')](_0x89c798)[_0xd543('0x26')](handleEntityNotFound(_0x73d69c,null))[_0xd543('0x26')](respondWithResult(_0x73d69c,null))[_0xd543('0x46')](handleError(_0x73d69c,null));};exports[_0xd543('0x49')]=function(_0x185884,_0x2accaa){return db[_0xd543('0x2d')][_0xd543('0x49')](_0x185884['body'],{})[_0xd543('0x26')](respondWithResult(_0x2accaa,0xc9))[_0xd543('0x46')](handleError(_0x2accaa,null));};exports[_0xd543('0x25')]=function(_0x2c4324,_0x5365c2){if(_0x2c4324[_0xd543('0x4a')]['id']){delete _0x2c4324[_0xd543('0x4a')]['id'];}return db[_0xd543('0x2d')][_0xd543('0x48')]({'where':{'id':_0x2c4324[_0xd543('0x47')]['id']}})['then'](handleEntityNotFound(_0x5365c2,null))[_0xd543('0x26')](saveUpdates(_0x2c4324[_0xd543('0x4a')],null))[_0xd543('0x26')](respondWithResult(_0x5365c2,null))['catch'](handleError(_0x5365c2,null));};exports[_0xd543('0x27')]=function(_0xa29890,_0x470498){return db[_0xd543('0x2d')][_0xd543('0x48')]({'where':{'id':_0xa29890['params']['id']}})[_0xd543('0x26')](handleEntityNotFound(_0x470498,null))[_0xd543('0x26')](removeEntity(_0x470498,null))[_0xd543('0x46')](handleError(_0x470498,null));};exports[_0xd543('0x4b')]=function(_0x357606,_0x2cf9bf){return db[_0xd543('0x2d')]['describe']()['then'](respondWithResult(_0x2cf9bf,null))[_0xd543('0x46')](handleError(_0x2cf9bf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 40b2e4d..981a92b 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x388a90,_0x4f7927){var _0x26699d=function(_0x46b97a){while(--_0x46b97a){_0x388a90['push'](_0x388a90['shift']());}};_0x26699d(++_0x4f7927);}(_0x7a54,0x106));var _0x47a5=function(_0x23bdf2,_0x402cdc){_0x23bdf2=_0x23bdf2-0x0;var _0x136760=_0x7a54[_0x23bdf2];return _0x136760;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x365d25,_0x4c99a8){var _0x5d7693=function(_0xab3635){while(--_0xab3635){_0x365d25['push'](_0x365d25['shift']());}};_0x5d7693(++_0x4c99a8);}(_0x1261,0x144));var _0x1126=function(_0x161f85,_0x1b1968){_0x161f85=_0x161f85-0x0;var _0x3f98ad=_0x1261[_0x161f85];return _0x3f98ad;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index fe0e296..068080e 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 _0x8580=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','attributes','limit','then','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8580,0x1c7));var _0x0858=function(_0x420e57,_0x1ac7fc){_0x420e57=_0x420e57-0x0;var _0x32e16f=_0x8580[_0x420e57];return _0x32e16f;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3515b4,_0x38e3f7,_0x4981a7){return new BPromise(function(_0x9c611c,_0x3ae92b){return client[_0x0858('0x8')](_0x3515b4,_0x4981a7)['then'](function(_0x4ceffb){logger[_0x0858('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x38e3f7,_0x0858('0xa'));logger[_0x0858('0xb')](_0x0858('0xc'),_0x38e3f7,_0x0858('0xa'),JSON[_0x0858('0xd')](_0x4ceffb));if(_0x4ceffb[_0x0858('0xe')]){if(_0x4ceffb[_0x0858('0xe')][_0x0858('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x38e3f7,_0x4ceffb[_0x0858('0xe')]['message']);return _0x3ae92b(_0x4ceffb['error']['message']);}logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x4ceffb['error'][_0x0858('0x11')]);return _0x9c611c(_0x4ceffb[_0x0858('0xe')][_0x0858('0x11')]);}else{logger[_0x0858('0x9')](_0x0858('0x10'),_0x38e3f7,_0x0858('0xa'));_0x9c611c(_0x4ceffb[_0x0858('0x12')][_0x0858('0x11')]);}})[_0x0858('0x13')](function(_0x39e967){logger[_0x0858('0xe')](_0x0858('0x10'),_0x38e3f7,_0x39e967);_0x3ae92b(_0x39e967);});});}exports['CreateOpenchannelQueueReport']=function(_0x2b73c2){var _0x4d376b=this;return new Promise(function(_0x284ebd,_0x37f90b){return db[_0x0858('0x14')][_0x0858('0x15')](_0x2b73c2[_0x0858('0x16')],{'raw':_0x2b73c2['options']?_0x2b73c2[_0x0858('0x17')][_0x0858('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1ea1a7){logger['info']('CreateOpenchannelQueueReport',_0x2b73c2);logger[_0x0858('0xb')](_0x0858('0x19'),_0x2b73c2,JSON[_0x0858('0xd')](_0x1ea1a7));_0x284ebd(_0x1ea1a7);})[_0x0858('0x13')](function(_0x29ac2b){logger['error'](_0x0858('0x19'),_0x29ac2b['message'],_0x2b73c2);_0x37f90b(_0x4d376b[_0x0858('0xe')](0x1f4,_0x29ac2b['message']));});});};exports[_0x0858('0x1a')]=function(_0x425745){var _0x32d21d=this;return new Promise(function(_0xdd5116,_0x4fe016){return db[_0x0858('0x14')][_0x0858('0x1b')](_0x425745[_0x0858('0x16')],{'raw':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1c')]||null:null,'attributes':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1d')]||null:null,'limit':_0x425745[_0x0858('0x17')]?_0x425745[_0x0858('0x17')][_0x0858('0x1e')]||null:null})[_0x0858('0x1f')](function(_0x2607c1){logger[_0x0858('0x9')]('UpdateOpenchannelQueueReport',_0x425745);logger[_0x0858('0xb')](_0x0858('0x1a'),_0x425745,JSON[_0x0858('0xd')](_0x2607c1));_0xdd5116(_0x2607c1);})[_0x0858('0x13')](function(_0xdcbd78){logger[_0x0858('0xe')](_0x0858('0x1a'),_0xdcbd78[_0x0858('0x11')],_0x425745);_0x4fe016(_0x32d21d['error'](0x1f4,_0xdcbd78[_0x0858('0x11')]));});});}; \ No newline at end of file +var _0xa9fc=['body','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','OpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fc,0x19f));var _0xca9f=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa9fc[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});}exports['CreateOpenchannelQueueReport']=function(_0x22c161){var _0x2b3cfc=this;return new Promise(function(_0x1543aa,_0x83aa2b){return db[_0xca9f('0x13')]['create'](_0x22c161[_0xca9f('0x14')],{'raw':_0x22c161['options']?_0x22c161[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![]})[_0xca9f('0xa')](function(_0x2799e8){logger[_0xca9f('0xb')]('CreateOpenchannelQueueReport',_0x22c161);logger[_0xca9f('0xd')](_0xca9f('0x17'),_0x22c161,JSON[_0xca9f('0x18')](_0x2799e8));_0x1543aa(_0x2799e8);})[_0xca9f('0x19')](function(_0x239b30){logger['error']('CreateOpenchannelQueueReport',_0x239b30[_0xca9f('0x11')],_0x22c161);_0x83aa2b(_0x2b3cfc[_0xca9f('0xf')](0x1f4,_0x239b30[_0xca9f('0x11')]));});});};exports[_0xca9f('0x1a')]=function(_0x319b3b){var _0x558ecd=this;return new Promise(function(_0x40ef71,_0x1f7939){return db[_0xca9f('0x13')]['update'](_0x319b3b[_0xca9f('0x14')],{'raw':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options'][_0xca9f('0x1b')]||null:null,'attributes':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x1c')]||null:null,'limit':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options']['limit']||null:null})[_0xca9f('0xa')](function(_0x5dfa6f){logger[_0xca9f('0xb')](_0xca9f('0x1a'),_0x319b3b);logger[_0xca9f('0xd')](_0xca9f('0x1a'),_0x319b3b,JSON['stringify'](_0x5dfa6f));_0x40ef71(_0x5dfa6f);})['catch'](function(_0xf153c8){logger['error'](_0xca9f('0x1a'),_0xf153c8['message'],_0x319b3b);_0x1f7939(_0x558ecd[_0xca9f('0xf')](0x1f4,_0xf153c8[_0xca9f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 38397dc..e5f80c0 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 _0x5df1=['fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','/describe','get','show','post','create','put','update','destroy','path','connect-timeout'];(function(_0x50e702,_0x59c34f){var _0xbd3476=function(_0x24caad){while(--_0x24caad){_0x50e702['push'](_0x50e702['shift']());}};_0xbd3476(++_0x59c34f);}(_0x5df1,0x148));var _0x15df=function(_0xc26fbd,_0x79092c){_0xc26fbd=_0xc26fbd-0x0;var _0x35ad07=_0x5df1[_0xc26fbd];return _0x35ad07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15df('0x0'));var timeout=require(_0x15df('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15df('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15df('0x3'));var controller=require(_0x15df('0x4'));router['get']('/',auth[_0x15df('0x5')](),controller[_0x15df('0x6')]);router['get'](_0x15df('0x7'),auth[_0x15df('0x5')](),controller['describe']);router[_0x15df('0x8')]('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0x9')]);router[_0x15df('0xa')]('/',auth[_0x15df('0x5')](),controller[_0x15df('0xb')]);router[_0x15df('0xc')]('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0xd')]);router['delete']('/:id',auth[_0x15df('0x5')](),controller[_0x15df('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe15d=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x1f935c,_0x26ec37){var _0x14eb3d=function(_0x3d1381){while(--_0x3d1381){_0x1f935c['push'](_0x1f935c['shift']());}};_0x14eb3d(++_0x26ec37);}(_0xe15d,0x1e8));var _0xde15=function(_0x41cbe9,_0x3e85a2){_0x41cbe9=_0x41cbe9-0x0;var _0x431628=_0xe15d[_0x41cbe9];return _0x431628;};'use strict';var multer=require(_0xde15('0x0'));var util=require(_0xde15('0x1'));var path=require(_0xde15('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde15('0x3')]();var fs_extra=require(_0xde15('0x4'));var auth=require(_0xde15('0x5'));var interaction=require(_0xde15('0x6'));var config=require(_0xde15('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xde15('0x8')](),controller['index']);router[_0xde15('0x9')](_0xde15('0xa'),auth['isAuthenticated'](),controller[_0xde15('0xb')]);router['get'](_0xde15('0xc'),auth[_0xde15('0x8')](),controller[_0xde15('0xd')]);router[_0xde15('0xe')]('/',auth[_0xde15('0x8')](),controller[_0xde15('0xf')]);router['put']('/:id',auth[_0xde15('0x8')](),controller[_0xde15('0x10')]);router[_0xde15('0x11')](_0xde15('0xc'),auth[_0xde15('0x8')](),controller[_0xde15('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4a5d6cb..512bddc 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2bc4b6,_0x452461){_0x2bc4b6=_0x2bc4b6-0x0;var _0x22b4e3=_0xb43b[_0x2bc4b6];return _0x22b4e3;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x10f060,_0x312a7b){var _0x512722=function(_0x2b0ce0){while(--_0x2b0ce0){_0x10f060['push'](_0x10f060['shift']());}};_0x512722(++_0x312a7b);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 3c00399..9f5680f 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 _0x5d76=['filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','save','update','then','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x47ecd0,_0x5f315f){var _0x916089=function(_0x5a442a){while(--_0x5a442a){_0x47ecd0['push'](_0x47ecd0['shift']());}};_0x916089(++_0x5f315f);}(_0x5d76,0x196));var _0x65d7=function(_0x21188f,_0x5427d3){_0x21188f=_0x21188f-0x0;var _0x5c57ce=_0x5d76[_0x21188f];return _0x5c57ce;};'use strict';var emlformat=require(_0x65d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65d7('0x1'));var jsonpatch=require(_0x65d7('0x2'));var rp=require('request-promise');var moment=require(_0x65d7('0x3'));var BPromise=require(_0x65d7('0x4'));var Mustache=require('mustache');var util=require(_0x65d7('0x5'));var path=require(_0x65d7('0x6'));var sox=require(_0x65d7('0x7'));var csv=require(_0x65d7('0x8'));var ejs=require(_0x65d7('0x9'));var fs=require('fs');var fs_extra=require(_0x65d7('0xa'));var _=require(_0x65d7('0xb'));var squel=require(_0x65d7('0xc'));var crypto=require(_0x65d7('0xd'));var jsforce=require(_0x65d7('0xe'));var deskjs=require(_0x65d7('0xf'));var toCsv=require(_0x65d7('0x8'));var querystring=require(_0x65d7('0x10'));var Papa=require(_0x65d7('0x11'));var Redis=require(_0x65d7('0x12'));var authService=require(_0x65d7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x65d7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d7('0x15'))(_0x65d7('0x16'));var utils=require(_0x65d7('0x17'));var config=require(_0x65d7('0x18'));var licenseUtil=require(_0x65d7('0x19'));var db=require(_0x65d7('0x1a'))['db'];function respondWithStatusCode(_0x28eb00,_0x294bac){_0x294bac=_0x294bac||0xcc;return function(_0xa8d5b4){if(_0xa8d5b4){return _0x28eb00['sendStatus'](_0x294bac);}return _0x28eb00[_0x65d7('0x1b')](_0x294bac)[_0x65d7('0x1c')]();};}function respondWithResult(_0x9c6596,_0x2d4e84){_0x2d4e84=_0x2d4e84||0xc8;return function(_0x45f995){if(_0x45f995){return _0x9c6596[_0x65d7('0x1b')](_0x2d4e84)[_0x65d7('0x1d')](_0x45f995);}};}function respondWithFilteredResult(_0x521f1d,_0x34bbae){return function(_0x2d17de){if(_0x2d17de){var _0x41981b=typeof _0x34bbae[_0x65d7('0x1e')]===_0x65d7('0x1f')&&typeof _0x34bbae['limit']===_0x65d7('0x1f');var _0xf2e2f8=_0x2d17de[_0x65d7('0x20')];var _0x511890=_0x41981b?0x0:_0x34bbae[_0x65d7('0x1e')];var _0x338391=_0x41981b?_0x2d17de[_0x65d7('0x20')]:_0x34bbae[_0x65d7('0x1e')]+_0x34bbae['limit'];var _0x5a6af8;if(_0x338391>=_0xf2e2f8){_0x338391=_0xf2e2f8;_0x5a6af8=0xc8;}else{_0x5a6af8=0xce;}_0x521f1d[_0x65d7('0x1b')](_0x5a6af8);return _0x521f1d['set'](_0x65d7('0x21'),_0x511890+'-'+_0x338391+'/'+_0xf2e2f8)['json'](_0x2d17de);}return null;};}function patchUpdates(_0x177926){return function(_0x8a4e7c){try{jsonpatch['apply'](_0x8a4e7c,_0x177926,!![]);}catch(_0x8463a6){return BPromise['reject'](_0x8463a6);}return _0x8a4e7c[_0x65d7('0x22')]();};}function saveUpdates(_0x1be6ed,_0x174304){return function(_0x674c76){if(_0x674c76){return _0x674c76[_0x65d7('0x23')](_0x1be6ed)[_0x65d7('0x24')](function(_0x77bdb2){return _0x77bdb2;});}return null;};}function removeEntity(_0x1da5ef,_0x83b208){return function(_0x4ad389){if(_0x4ad389){return _0x4ad389['destroy']()[_0x65d7('0x24')](function(){_0x1da5ef[_0x65d7('0x1b')](0xcc)[_0x65d7('0x1c')]();});}};}function handleEntityNotFound(_0x3c135b,_0x4d4908){return function(_0x1d161f){if(!_0x1d161f){_0x3c135b[_0x65d7('0x25')](0x194);}return _0x1d161f;};}function handleError(_0x10a64f,_0xc3b9bc){_0xc3b9bc=_0xc3b9bc||0x1f4;return function(_0x3ece4d){logger[_0x65d7('0x26')](_0x3ece4d['stack']);if(_0x3ece4d['name']){delete _0x3ece4d[_0x65d7('0x27')];}_0x10a64f[_0x65d7('0x1b')](_0xc3b9bc)[_0x65d7('0x28')](_0x3ece4d);};}exports[_0x65d7('0x29')]=function(_0x21f899,_0xb95b88){var _0x214421={},_0x16b5b9={},_0x4a13e4={'count':0x0,'rows':[]};var _0x2a3e63=_[_0x65d7('0x2a')](db[_0x65d7('0x2b')][_0x65d7('0x2c')],function(_0x6670e0){return{'name':_0x6670e0[_0x65d7('0x2d')],'type':_0x6670e0['type'][_0x65d7('0x2e')]};});_0x16b5b9[_0x65d7('0x2f')]=_[_0x65d7('0x2a')](_0x2a3e63,_0x65d7('0x27'));_0x16b5b9[_0x65d7('0x30')]=_[_0x65d7('0x31')](_0x21f899[_0x65d7('0x30')]);_0x16b5b9[_0x65d7('0x32')]=_[_0x65d7('0x33')](_0x16b5b9[_0x65d7('0x2f')],_0x16b5b9[_0x65d7('0x30')]);_0x214421['attributes']=_[_0x65d7('0x33')](_0x16b5b9['model'],qs[_0x65d7('0x34')](_0x21f899['query'][_0x65d7('0x34')]));_0x214421['attributes']=_0x214421['attributes'][_0x65d7('0x35')]?_0x214421[_0x65d7('0x36')]:_0x16b5b9[_0x65d7('0x2f')];if(!_0x21f899['query'][_0x65d7('0x37')](_0x65d7('0x38'))){_0x214421[_0x65d7('0x39')]=qs[_0x65d7('0x39')](_0x21f899[_0x65d7('0x30')][_0x65d7('0x39')]);_0x214421[_0x65d7('0x1e')]=qs[_0x65d7('0x1e')](_0x21f899[_0x65d7('0x30')][_0x65d7('0x1e')]);}_0x214421['order']=qs['sort'](_0x21f899['query'][_0x65d7('0x3a')]);_0x214421['where']=qs[_0x65d7('0x32')](_[_0x65d7('0x3b')](_0x21f899[_0x65d7('0x30')],_0x16b5b9[_0x65d7('0x32')]),_0x2a3e63);if(_0x21f899[_0x65d7('0x30')][_0x65d7('0x3c')]){_0x214421[_0x65d7('0x3d')]=_[_0x65d7('0x3e')](_0x214421[_0x65d7('0x3d')],{'$or':_[_0x65d7('0x2a')](_0x2a3e63,function(_0x2636e2){if(_0x2636e2[_0x65d7('0x3f')]!==_0x65d7('0x40')){var _0x2a4842={};_0x2a4842[_0x2636e2[_0x65d7('0x27')]]={'$like':'%'+_0x21f899[_0x65d7('0x30')][_0x65d7('0x3c')]+'%'};return _0x2a4842;}})});}_0x214421=_[_0x65d7('0x3e')]({},_0x214421,_0x21f899[_0x65d7('0x41')]);var _0x26159f={'where':_0x214421[_0x65d7('0x3d')]};return db[_0x65d7('0x2b')]['count'](_0x26159f)['then'](function(_0x58e4d8){_0x4a13e4[_0x65d7('0x20')]=_0x58e4d8;if(_0x21f899[_0x65d7('0x30')]['includeAll']){_0x214421[_0x65d7('0x42')]=[{'all':!![]}];}return db[_0x65d7('0x2b')][_0x65d7('0x43')](_0x214421);})[_0x65d7('0x24')](function(_0x9fdff9){_0x4a13e4[_0x65d7('0x44')]=_0x9fdff9;return _0x4a13e4;})[_0x65d7('0x24')](respondWithFilteredResult(_0xb95b88,_0x214421))[_0x65d7('0x45')](handleError(_0xb95b88,null));};exports[_0x65d7('0x46')]=function(_0x4970f7,_0x1e560a){var _0x2601c4={'raw':!![],'where':{'id':_0x4970f7[_0x65d7('0x47')]['id']}},_0x5aabc7={};_0x5aabc7['model']=_[_0x65d7('0x31')](db[_0x65d7('0x2b')][_0x65d7('0x2c')]);_0x5aabc7['query']=_[_0x65d7('0x31')](_0x4970f7[_0x65d7('0x30')]);_0x5aabc7[_0x65d7('0x32')]=_[_0x65d7('0x33')](_0x5aabc7[_0x65d7('0x2f')],_0x5aabc7[_0x65d7('0x30')]);_0x2601c4[_0x65d7('0x36')]=_[_0x65d7('0x33')](_0x5aabc7[_0x65d7('0x2f')],qs['fields'](_0x4970f7[_0x65d7('0x30')][_0x65d7('0x34')]));_0x2601c4['attributes']=_0x2601c4[_0x65d7('0x36')][_0x65d7('0x35')]?_0x2601c4[_0x65d7('0x36')]:_0x5aabc7[_0x65d7('0x2f')];if(_0x4970f7[_0x65d7('0x30')]['includeAll']){_0x2601c4[_0x65d7('0x42')]=[{'all':!![]}];}_0x2601c4=_[_0x65d7('0x3e')]({},_0x2601c4,_0x4970f7[_0x65d7('0x41')]);return db[_0x65d7('0x2b')]['find'](_0x2601c4)[_0x65d7('0x24')](handleEntityNotFound(_0x1e560a,null))[_0x65d7('0x24')](respondWithResult(_0x1e560a,null))['catch'](handleError(_0x1e560a,null));};exports['create']=function(_0x3641c4,_0x5cfb28){return db[_0x65d7('0x2b')]['create'](_0x3641c4[_0x65d7('0x48')],{})[_0x65d7('0x24')](respondWithResult(_0x5cfb28,0xc9))[_0x65d7('0x45')](handleError(_0x5cfb28,null));};exports[_0x65d7('0x23')]=function(_0x450baa,_0x84c333){if(_0x450baa[_0x65d7('0x48')]['id']){delete _0x450baa['body']['id'];}return db[_0x65d7('0x2b')]['find']({'where':{'id':_0x450baa[_0x65d7('0x47')]['id']}})[_0x65d7('0x24')](handleEntityNotFound(_0x84c333,null))[_0x65d7('0x24')](saveUpdates(_0x450baa[_0x65d7('0x48')],null))[_0x65d7('0x24')](respondWithResult(_0x84c333,null))[_0x65d7('0x45')](handleError(_0x84c333,null));};exports[_0x65d7('0x49')]=function(_0x2a4ce3,_0x2acde2){return db['OpenchannelTransferReport'][_0x65d7('0x4a')]({'where':{'id':_0x2a4ce3[_0x65d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2acde2,null))['then'](removeEntity(_0x2acde2,null))['catch'](handleError(_0x2acde2,null));};exports['describe']=function(_0x1dd31f,_0x18e813){return db['OpenchannelTransferReport'][_0x65d7('0x4b')]()[_0x65d7('0x24')](respondWithResult(_0x18e813,null))[_0x65d7('0x45')](handleError(_0x18e813,null));}; \ No newline at end of file +var _0x5180=['squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5180,0x113));var _0x0518=function(_0x1a5182,_0x25b2dd){_0x1a5182=_0x1a5182-0x0;var _0x37d275=_0x5180[_0x1a5182];return _0x37d275;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0518('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0518('0x1'));var rp=require(_0x0518('0x2'));var moment=require('moment');var BPromise=require(_0x0518('0x3'));var Mustache=require(_0x0518('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0518('0x5'));var ejs=require(_0x0518('0x6'));var fs=require('fs');var fs_extra=require(_0x0518('0x7'));var _=require(_0x0518('0x8'));var squel=require(_0x0518('0x9'));var crypto=require('crypto');var jsforce=require(_0x0518('0xa'));var deskjs=require(_0x0518('0xb'));var toCsv=require(_0x0518('0x5'));var querystring=require(_0x0518('0xc'));var Papa=require(_0x0518('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0518('0xe'))(_0x0518('0xf'));var utils=require(_0x0518('0x10'));var config=require(_0x0518('0x11'));var licenseUtil=require(_0x0518('0x12'));var db=require(_0x0518('0x13'))['db'];function respondWithStatusCode(_0x446a24,_0x18d02a){_0x18d02a=_0x18d02a||0xcc;return function(_0x1d8910){if(_0x1d8910){return _0x446a24[_0x0518('0x14')](_0x18d02a);}return _0x446a24[_0x0518('0x15')](_0x18d02a)[_0x0518('0x16')]();};}function respondWithResult(_0x4e80ec,_0x27f601){_0x27f601=_0x27f601||0xc8;return function(_0x39aba7){if(_0x39aba7){return _0x4e80ec[_0x0518('0x15')](_0x27f601)[_0x0518('0x17')](_0x39aba7);}};}function respondWithFilteredResult(_0x17ce72,_0x9b8c50){return function(_0x29c479){if(_0x29c479){var _0x5e3010=typeof _0x9b8c50[_0x0518('0x18')]==='undefined'&&typeof _0x9b8c50[_0x0518('0x19')]===_0x0518('0x1a');var _0x13a8b6=_0x29c479[_0x0518('0x1b')];var _0x30f804=_0x5e3010?0x0:_0x9b8c50[_0x0518('0x18')];var _0x241152=_0x5e3010?_0x29c479[_0x0518('0x1b')]:_0x9b8c50[_0x0518('0x18')]+_0x9b8c50[_0x0518('0x19')];var _0x113f68;if(_0x241152>=_0x13a8b6){_0x241152=_0x13a8b6;_0x113f68=0xc8;}else{_0x113f68=0xce;}_0x17ce72[_0x0518('0x15')](_0x113f68);return _0x17ce72[_0x0518('0x1c')](_0x0518('0x1d'),_0x30f804+'-'+_0x241152+'/'+_0x13a8b6)[_0x0518('0x17')](_0x29c479);}return null;};}function patchUpdates(_0x17afac){return function(_0x2b7bfb){try{jsonpatch['apply'](_0x2b7bfb,_0x17afac,!![]);}catch(_0x4776b7){return BPromise[_0x0518('0x1e')](_0x4776b7);}return _0x2b7bfb[_0x0518('0x1f')]();};}function saveUpdates(_0x5d0ca6,_0x15a428){return function(_0x56c9de){if(_0x56c9de){return _0x56c9de[_0x0518('0x20')](_0x5d0ca6)[_0x0518('0x21')](function(_0x5e652e){return _0x5e652e;});}return null;};}function removeEntity(_0x486927,_0x118692){return function(_0xe7c479){if(_0xe7c479){return _0xe7c479[_0x0518('0x22')]()[_0x0518('0x21')](function(){_0x486927[_0x0518('0x15')](0xcc)[_0x0518('0x16')]();});}};}function handleEntityNotFound(_0x310052,_0x29bc5f){return function(_0x28e1be){if(!_0x28e1be){_0x310052[_0x0518('0x14')](0x194);}return _0x28e1be;};}function handleError(_0x21496c,_0x5de8a0){_0x5de8a0=_0x5de8a0||0x1f4;return function(_0x2c4a31){logger['error'](_0x2c4a31['stack']);if(_0x2c4a31[_0x0518('0x23')]){delete _0x2c4a31[_0x0518('0x23')];}_0x21496c[_0x0518('0x15')](_0x5de8a0)[_0x0518('0x24')](_0x2c4a31);};}exports[_0x0518('0x25')]=function(_0xac792,_0xcce52b){var _0x3afa33={},_0x5a3057={},_0x19ca65={'count':0x0,'rows':[]};var _0x278b57=_[_0x0518('0x26')](db[_0x0518('0x27')][_0x0518('0x28')],function(_0x2060a2){return{'name':_0x2060a2['fieldName'],'type':_0x2060a2['type'][_0x0518('0x29')]};});_0x5a3057[_0x0518('0x2a')]=_[_0x0518('0x26')](_0x278b57,_0x0518('0x23'));_0x5a3057[_0x0518('0x2b')]=_[_0x0518('0x2c')](_0xac792['query']);_0x5a3057['filters']=_[_0x0518('0x2d')](_0x5a3057[_0x0518('0x2a')],_0x5a3057[_0x0518('0x2b')]);_0x3afa33[_0x0518('0x2e')]=_[_0x0518('0x2d')](_0x5a3057[_0x0518('0x2a')],qs[_0x0518('0x2f')](_0xac792[_0x0518('0x2b')][_0x0518('0x2f')]));_0x3afa33[_0x0518('0x2e')]=_0x3afa33[_0x0518('0x2e')][_0x0518('0x30')]?_0x3afa33[_0x0518('0x2e')]:_0x5a3057[_0x0518('0x2a')];if(!_0xac792['query'][_0x0518('0x31')]('nolimit')){_0x3afa33[_0x0518('0x19')]=qs[_0x0518('0x19')](_0xac792[_0x0518('0x2b')][_0x0518('0x19')]);_0x3afa33['offset']=qs['offset'](_0xac792[_0x0518('0x2b')][_0x0518('0x18')]);}_0x3afa33[_0x0518('0x32')]=qs[_0x0518('0x33')](_0xac792[_0x0518('0x2b')][_0x0518('0x33')]);_0x3afa33[_0x0518('0x34')]=qs[_0x0518('0x35')](_[_0x0518('0x36')](_0xac792[_0x0518('0x2b')],_0x5a3057[_0x0518('0x35')]),_0x278b57);if(_0xac792[_0x0518('0x2b')][_0x0518('0x37')]){_0x3afa33[_0x0518('0x34')]=_[_0x0518('0x38')](_0x3afa33[_0x0518('0x34')],{'$or':_[_0x0518('0x26')](_0x278b57,function(_0x138df6){if(_0x138df6[_0x0518('0x39')]!==_0x0518('0x3a')){var _0xf5bbb={};_0xf5bbb[_0x138df6[_0x0518('0x23')]]={'$like':'%'+_0xac792[_0x0518('0x2b')][_0x0518('0x37')]+'%'};return _0xf5bbb;}})});}_0x3afa33=_[_0x0518('0x38')]({},_0x3afa33,_0xac792[_0x0518('0x3b')]);var _0x2fa9ba={'where':_0x3afa33[_0x0518('0x34')]};return db[_0x0518('0x27')][_0x0518('0x1b')](_0x2fa9ba)[_0x0518('0x21')](function(_0x4f7151){_0x19ca65[_0x0518('0x1b')]=_0x4f7151;if(_0xac792[_0x0518('0x2b')][_0x0518('0x3c')]){_0x3afa33[_0x0518('0x3d')]=[{'all':!![]}];}return db[_0x0518('0x27')][_0x0518('0x3e')](_0x3afa33);})[_0x0518('0x21')](function(_0x248171){_0x19ca65[_0x0518('0x3f')]=_0x248171;return _0x19ca65;})[_0x0518('0x21')](respondWithFilteredResult(_0xcce52b,_0x3afa33))[_0x0518('0x40')](handleError(_0xcce52b,null));};exports[_0x0518('0x41')]=function(_0x7e6b2d,_0x3028c9){var _0x3c9511={'raw':!![],'where':{'id':_0x7e6b2d[_0x0518('0x42')]['id']}},_0x34f09c={};_0x34f09c[_0x0518('0x2a')]=_[_0x0518('0x2c')](db['OpenchannelTransferReport'][_0x0518('0x28')]);_0x34f09c[_0x0518('0x2b')]=_['keys'](_0x7e6b2d[_0x0518('0x2b')]);_0x34f09c[_0x0518('0x35')]=_[_0x0518('0x2d')](_0x34f09c[_0x0518('0x2a')],_0x34f09c[_0x0518('0x2b')]);_0x3c9511[_0x0518('0x2e')]=_['intersection'](_0x34f09c['model'],qs[_0x0518('0x2f')](_0x7e6b2d['query']['fields']));_0x3c9511['attributes']=_0x3c9511[_0x0518('0x2e')][_0x0518('0x30')]?_0x3c9511[_0x0518('0x2e')]:_0x34f09c[_0x0518('0x2a')];if(_0x7e6b2d[_0x0518('0x2b')][_0x0518('0x3c')]){_0x3c9511[_0x0518('0x3d')]=[{'all':!![]}];}_0x3c9511=_[_0x0518('0x38')]({},_0x3c9511,_0x7e6b2d['options']);return db[_0x0518('0x27')][_0x0518('0x43')](_0x3c9511)['then'](handleEntityNotFound(_0x3028c9,null))['then'](respondWithResult(_0x3028c9,null))[_0x0518('0x40')](handleError(_0x3028c9,null));};exports[_0x0518('0x44')]=function(_0x72746f,_0x12787d){return db[_0x0518('0x27')][_0x0518('0x44')](_0x72746f[_0x0518('0x45')],{})[_0x0518('0x21')](respondWithResult(_0x12787d,0xc9))[_0x0518('0x40')](handleError(_0x12787d,null));};exports[_0x0518('0x20')]=function(_0x55fd5d,_0x3119a9){if(_0x55fd5d['body']['id']){delete _0x55fd5d[_0x0518('0x45')]['id'];}return db[_0x0518('0x27')][_0x0518('0x43')]({'where':{'id':_0x55fd5d['params']['id']}})['then'](handleEntityNotFound(_0x3119a9,null))[_0x0518('0x21')](saveUpdates(_0x55fd5d[_0x0518('0x45')],null))['then'](respondWithResult(_0x3119a9,null))[_0x0518('0x40')](handleError(_0x3119a9,null));};exports[_0x0518('0x22')]=function(_0x3e8c4d,_0x1fdb6b){return db['OpenchannelTransferReport'][_0x0518('0x43')]({'where':{'id':_0x3e8c4d[_0x0518('0x42')]['id']}})[_0x0518('0x21')](handleEntityNotFound(_0x1fdb6b,null))[_0x0518('0x21')](removeEntity(_0x1fdb6b,null))[_0x0518('0x40')](handleError(_0x1fdb6b,null));};exports[_0x0518('0x46')]=function(_0x5e6d87,_0x16bdba){return db[_0x0518('0x27')][_0x0518('0x46')]()[_0x0518('0x21')](respondWithResult(_0x16bdba,null))[_0x0518('0x40')](handleError(_0x16bdba,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6190dd6..7d4fb7a 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 _0x9ba2=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x35fcd8,_0x5ba4a0){var _0x526766=function(_0x558075){while(--_0x558075){_0x35fcd8['push'](_0x35fcd8['shift']());}};_0x526766(++_0x5ba4a0);}(_0x9ba2,0xe4));var _0x29ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9ba2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x29ba('0x0'));var logger=require(_0x29ba('0x1'))(_0x29ba('0x2'));var moment=require('moment');var BPromise=require(_0x29ba('0x3'));var rp=require(_0x29ba('0x4'));var fs=require('fs');var path=require(_0x29ba('0x5'));var rimraf=require(_0x29ba('0x6'));var config=require(_0x29ba('0x7'));var attributes=require(_0x29ba('0x8'));module[_0x29ba('0x9')]=function(_0x46a4fc,_0x213ddb){return _0x46a4fc[_0x29ba('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x29ba('0xb'),'paranoid':![],'indexes':[{'name':_0x29ba('0xc'),'fields':[_0x29ba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57e6=['moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','../../config/logger','api'];(function(_0x2553aa,_0x420113){var _0x315462=function(_0x36a1c2){while(--_0x36a1c2){_0x2553aa['push'](_0x2553aa['shift']());}};_0x315462(++_0x420113);}(_0x57e6,0x1d7));var _0x657e=function(_0x502ca3,_0x36be36){_0x502ca3=_0x502ca3-0x0;var _0x27f42c=_0x57e6[_0x502ca3];return _0x27f42c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x657e('0x0'))(_0x657e('0x1'));var moment=require(_0x657e('0x2'));var BPromise=require(_0x657e('0x3'));var rp=require(_0x657e('0x4'));var fs=require('fs');var path=require(_0x657e('0x5'));var rimraf=require('rimraf');var config=require(_0x657e('0x6'));var attributes=require(_0x657e('0x7'));module['exports']=function(_0x59b619,_0x3e4493){return _0x59b619[_0x657e('0x8')](_0x657e('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x657e('0xa'),'fields':[_0x657e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7f02e8a..7a96b59 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 _0x2fed=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2fed,0x7c));var _0xd2fe=function(_0x45da43,_0x4657f3){_0x45da43=_0x45da43-0x0;var _0x4ce941=_0x2fed[_0x45da43];return _0x4ce941;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require(_0xd2fe('0x3'));var rs=require(_0xd2fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd2fe('0x7'));var jayson=require(_0xd2fe('0x8'));var client=jayson[_0xd2fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7bf5,_0x44e015,_0x3b6591){return new BPromise(function(_0x42a8fb,_0x47996a){return client[_0xd2fe('0xa')](_0x2f7bf5,_0x3b6591)[_0xd2fe('0xb')](function(_0x815784){logger[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x44e015,_0xd2fe('0xe'));logger[_0xd2fe('0xf')](_0xd2fe('0x10'),_0x44e015,_0xd2fe('0xe'),JSON[_0xd2fe('0x11')](_0x815784));if(_0x815784[_0xd2fe('0x12')]){if(_0x815784[_0xd2fe('0x12')][_0xd2fe('0x13')]===0x1f4){logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')][_0xd2fe('0x14')]);return _0x47996a(_0x815784[_0xd2fe('0x12')]['message']);}logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')]['message']);return _0x42a8fb(_0x815784['error']['message']);}else{logger[_0xd2fe('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x44e015,_0xd2fe('0xe'));_0x42a8fb(_0x815784[_0xd2fe('0x15')][_0xd2fe('0x14')]);}})[_0xd2fe('0x16')](function(_0x303ca2){logger[_0xd2fe('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x44e015,_0x303ca2);_0x47996a(_0x303ca2);});});} \ No newline at end of file +var _0x038b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis'];(function(_0x13cd0a,_0x13147c){var _0x1ab38e=function(_0x1f6d8b){while(--_0x1f6d8b){_0x13cd0a['push'](_0x13cd0a['shift']());}};_0x1ab38e(++_0x13147c);}(_0x038b,0x114));var _0xb038=function(_0x1f667b,_0x352513){_0x1f667b=_0x1f667b-0x0;var _0x497889=_0x038b[_0x1f667b];return _0x497889;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var moment=require(_0xb038('0x1'));var BPromise=require(_0xb038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb038('0x4'));var logger=require(_0xb038('0x5'))('rpc');var config=require(_0xb038('0x6'));var jayson=require(_0xb038('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){return client[_0xb038('0x8')](_0x2e3e64,_0x1534a9)[_0xb038('0x9')](function(_0x4d85b4){logger['info'](_0xb038('0xa'),_0x1b077a,_0xb038('0xb'));logger['debug'](_0xb038('0xc'),_0x1b077a,_0xb038('0xb'),JSON[_0xb038('0xd')](_0x4d85b4));if(_0x4d85b4[_0xb038('0xe')]){if(_0x4d85b4[_0xb038('0xe')][_0xb038('0xf')]===0x1f4){logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);return _0x48a4d7(_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);}logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);return _0x4b4085(_0x4d85b4[_0xb038('0xe')]['message']);}else{logger[_0xb038('0x11')](_0xb038('0xa'),_0x1b077a,_0xb038('0xb'));_0x4b4085(_0x4d85b4[_0xb038('0x12')][_0xb038('0x10')]);}})[_0xb038('0x13')](function(_0x5246c3){logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x5246c3);_0x48a4d7(_0x5246c3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index fa38ffd..769b1a0 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 _0xb05e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xb05e,0x83));var _0xeb05=function(_0x4b9a62,_0x528ba3){_0x4b9a62=_0x4b9a62-0x0;var _0x45c582=_0xb05e[_0x4b9a62];return _0x45c582;};'use strict';var multer=require(_0xeb05('0x0'));var util=require(_0xeb05('0x1'));var path=require(_0xeb05('0x2'));var timeout=require(_0xeb05('0x3'));var express=require(_0xeb05('0x4'));var router=express[_0xeb05('0x5')]();var fs_extra=require(_0xeb05('0x6'));var auth=require(_0xeb05('0x7'));var interaction=require(_0xeb05('0x8'));var config=require(_0xeb05('0x9'));var controller=require(_0xeb05('0xa'));router['get']('/',auth[_0xeb05('0xb')](),controller[_0xeb05('0xc')]);router[_0xeb05('0xd')](_0xeb05('0xe'),auth['isAuthenticated'](),controller[_0xeb05('0xf')]);router['post']('/',auth[_0xeb05('0xb')](),controller[_0xeb05('0x10')]);router[_0xeb05('0x11')](_0xeb05('0xe'),auth[_0xeb05('0xb')](),controller[_0xeb05('0x12')]);router[_0xeb05('0x13')](_0xeb05('0xe'),auth[_0xeb05('0xb')](),controller[_0xeb05('0x14')]);module[_0xeb05('0x15')]=router; \ No newline at end of file +var _0x4759=['../../components/auth/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4759,0x13c));var _0x9475=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x4759[_0xa98302];return _0x1ad8e3;};'use strict';var multer=require(_0x9475('0x0'));var util=require(_0x9475('0x1'));var path=require(_0x9475('0x2'));var timeout=require(_0x9475('0x3'));var express=require(_0x9475('0x4'));var router=express[_0x9475('0x5')]();var fs_extra=require(_0x9475('0x6'));var auth=require(_0x9475('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9475('0x8'));router[_0x9475('0x9')]('/',auth[_0x9475('0xa')](),controller[_0x9475('0xb')]);router['get'](_0x9475('0xc'),auth[_0x9475('0xa')](),controller[_0x9475('0xd')]);router[_0x9475('0xe')]('/',auth[_0x9475('0xa')](),controller[_0x9475('0xf')]);router['put'](_0x9475('0xc'),auth[_0x9475('0xa')](),controller[_0x9475('0x10')]);router[_0x9475('0x11')]('/:id',auth[_0x9475('0xa')](),controller[_0x9475('0x12')]);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 b55a80a..d20810e 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 _0x2405=['sequelize','exports','STRING'];(function(_0xacb225,_0xcd502d){var _0x2684df=function(_0x154c38){while(--_0x154c38){_0xacb225['push'](_0xacb225['shift']());}};_0x2684df(++_0xcd502d);}(_0x2405,0xf3));var _0x5240=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x2405[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require(_0x5240('0x0'));module[_0x5240('0x1')]={'name':{'type':Sequelize[_0x5240('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f11=['STRING','name'];(function(_0x4bea50,_0x18ea16){var _0x500311=function(_0x3c3a76){while(--_0x3c3a76){_0x4bea50['push'](_0x4bea50['shift']());}};_0x500311(++_0x18ea16);}(_0x6f11,0x1ca));var _0x16f1=function(_0x537356,_0x12c808){_0x537356=_0x537356-0x0;var _0x2593b6=_0x6f11[_0x537356];return _0x2593b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16f1('0x0')],'unique':_0x16f1('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x16f1('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0d029f0..be8ca64 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 _0xde32=['../../config/environment','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','error','name','send','map','Pause','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xde32,0x11f));var _0x2de3=function(_0x43a5a8,_0x3501da){_0x43a5a8=_0x43a5a8-0x0;var _0xd8e926=_0xde32[_0x43a5a8];return _0xd8e926;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2de3('0x0'));var jsonpatch=require(_0x2de3('0x1'));var rp=require(_0x2de3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2de3('0x3'));var sox=require(_0x2de3('0x4'));var csv=require(_0x2de3('0x5'));var ejs=require(_0x2de3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2de3('0x7'));var squel=require(_0x2de3('0x8'));var crypto=require(_0x2de3('0x9'));var jsforce=require(_0x2de3('0xa'));var deskjs=require(_0x2de3('0xb'));var toCsv=require(_0x2de3('0x5'));var querystring=require(_0x2de3('0xc'));var Papa=require(_0x2de3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2de3('0xe'));var hardwareService=require(_0x2de3('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x2de3('0x10'));var config=require(_0x2de3('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b2fed,_0x117794){_0x117794=_0x117794||0xcc;return function(_0x3ba630){if(_0x3ba630){return _0x3b2fed[_0x2de3('0x12')](_0x117794);}return _0x3b2fed['status'](_0x117794)[_0x2de3('0x13')]();};}function respondWithResult(_0x5f3906,_0x5a0a43){_0x5a0a43=_0x5a0a43||0xc8;return function(_0x436b60){if(_0x436b60){return _0x5f3906[_0x2de3('0x14')](_0x5a0a43)[_0x2de3('0x15')](_0x436b60);}};}function respondWithFilteredResult(_0x38c932,_0x5bfde8){return function(_0x7635cc){if(_0x7635cc){var _0x3b9c5b=typeof _0x5bfde8['offset']===_0x2de3('0x16')&&typeof _0x5bfde8['limit']===_0x2de3('0x16');var _0x4c486f=_0x7635cc[_0x2de3('0x17')];var _0x3fc6d4=_0x3b9c5b?0x0:_0x5bfde8[_0x2de3('0x18')];var _0xa48ca2=_0x3b9c5b?_0x7635cc['count']:_0x5bfde8[_0x2de3('0x18')]+_0x5bfde8[_0x2de3('0x19')];var _0x13afbe;if(_0xa48ca2>=_0x4c486f){_0xa48ca2=_0x4c486f;_0x13afbe=0xc8;}else{_0x13afbe=0xce;}_0x38c932['status'](_0x13afbe);return _0x38c932['set'](_0x2de3('0x1a'),_0x3fc6d4+'-'+_0xa48ca2+'/'+_0x4c486f)['json'](_0x7635cc);}return null;};}function patchUpdates(_0x478174){return function(_0x35250a){try{jsonpatch[_0x2de3('0x1b')](_0x35250a,_0x478174,!![]);}catch(_0x16e0c6){return BPromise[_0x2de3('0x1c')](_0x16e0c6);}return _0x35250a[_0x2de3('0x1d')]();};}function saveUpdates(_0x211a7d,_0x1a6bd9){return function(_0x50e1b9){if(_0x50e1b9){return _0x50e1b9['update'](_0x211a7d)[_0x2de3('0x1e')](function(_0x123c79){return _0x123c79;});}return null;};}function removeEntity(_0x30e57b,_0xb43bea){return function(_0xc62dd6){if(_0xc62dd6){return _0xc62dd6[_0x2de3('0x1f')]()[_0x2de3('0x1e')](function(){var _0xbe4d52=_0xc62dd6['get']({'plain':!![]});var _0x1d990f=_0x2de3('0x20');return db[_0x2de3('0x21')][_0x2de3('0x1f')]({'where':{'type':_0x1d990f,'resourceId':_0xbe4d52['id']}})[_0x2de3('0x1e')](function(){return _0xc62dd6;});})[_0x2de3('0x1e')](function(){_0x30e57b[_0x2de3('0x14')](0xcc)[_0x2de3('0x13')]();});}};}function handleEntityNotFound(_0x293c67,_0x42a7d9){return function(_0x2b9f6d){if(!_0x2b9f6d){_0x293c67[_0x2de3('0x12')](0x194);}return _0x2b9f6d;};}function handleError(_0x48a132,_0x4a186b){_0x4a186b=_0x4a186b||0x1f4;return function(_0x2e4132){logger[_0x2de3('0x22')](_0x2e4132['stack']);if(_0x2e4132[_0x2de3('0x23')]){delete _0x2e4132[_0x2de3('0x23')];}_0x48a132[_0x2de3('0x14')](_0x4a186b)[_0x2de3('0x24')](_0x2e4132);};}exports['index']=function(_0x30595a,_0x203765){var _0xd1ac5f={},_0x256a05={},_0x4389ea={'count':0x0,'rows':[]};var _0x480a2b=_[_0x2de3('0x25')](db[_0x2de3('0x26')][_0x2de3('0x27')],function(_0x31c1c8){return{'name':_0x31c1c8['fieldName'],'type':_0x31c1c8[_0x2de3('0x28')][_0x2de3('0x29')]};});_0x256a05[_0x2de3('0x2a')]=_[_0x2de3('0x25')](_0x480a2b,_0x2de3('0x23'));_0x256a05[_0x2de3('0x2b')]=_[_0x2de3('0x2c')](_0x30595a[_0x2de3('0x2b')]);_0x256a05['filters']=_[_0x2de3('0x2d')](_0x256a05[_0x2de3('0x2a')],_0x256a05[_0x2de3('0x2b')]);_0xd1ac5f[_0x2de3('0x2e')]=_[_0x2de3('0x2d')](_0x256a05[_0x2de3('0x2a')],qs[_0x2de3('0x2f')](_0x30595a[_0x2de3('0x2b')]['fields']));_0xd1ac5f[_0x2de3('0x2e')]=_0xd1ac5f['attributes'][_0x2de3('0x30')]?_0xd1ac5f['attributes']:_0x256a05['model'];if(!_0x30595a[_0x2de3('0x2b')][_0x2de3('0x31')](_0x2de3('0x32'))){_0xd1ac5f[_0x2de3('0x19')]=qs[_0x2de3('0x19')](_0x30595a['query']['limit']);_0xd1ac5f['offset']=qs[_0x2de3('0x18')](_0x30595a[_0x2de3('0x2b')][_0x2de3('0x18')]);}_0xd1ac5f['order']=qs[_0x2de3('0x33')](_0x30595a[_0x2de3('0x2b')][_0x2de3('0x33')]);_0xd1ac5f['where']=qs[_0x2de3('0x34')](_[_0x2de3('0x35')](_0x30595a[_0x2de3('0x2b')],_0x256a05['filters']),_0x480a2b);if(_0x30595a[_0x2de3('0x2b')][_0x2de3('0x36')]){_0xd1ac5f['where']=_['merge'](_0xd1ac5f[_0x2de3('0x37')],{'$or':_[_0x2de3('0x25')](_0x480a2b,function(_0x3c82cb){if(_0x3c82cb['type']!==_0x2de3('0x38')){var _0x147bcd={};_0x147bcd[_0x3c82cb[_0x2de3('0x23')]]={'$like':'%'+_0x30595a['query']['filter']+'%'};return _0x147bcd;}})});}_0xd1ac5f=_['merge']({},_0xd1ac5f,_0x30595a[_0x2de3('0x39')]);var _0x524d16={'where':_0xd1ac5f[_0x2de3('0x37')]};return db[_0x2de3('0x26')][_0x2de3('0x17')](_0x524d16)[_0x2de3('0x1e')](function(_0x521e73){_0x4389ea['count']=_0x521e73;if(_0x30595a[_0x2de3('0x2b')][_0x2de3('0x3a')]){_0xd1ac5f[_0x2de3('0x3b')]=[{'all':!![]}];}return db[_0x2de3('0x26')]['findAll'](_0xd1ac5f);})[_0x2de3('0x1e')](function(_0x45cda3){_0x4389ea[_0x2de3('0x3c')]=_0x45cda3;return _0x4389ea;})[_0x2de3('0x1e')](respondWithFilteredResult(_0x203765,_0xd1ac5f))['catch'](handleError(_0x203765,null));};exports[_0x2de3('0x3d')]=function(_0x5a233f,_0x59a31f){var _0x1553c9={'raw':!![],'where':{'id':_0x5a233f[_0x2de3('0x3e')]['id']}},_0x4a2145={};_0x4a2145['model']=_[_0x2de3('0x2c')](db[_0x2de3('0x26')][_0x2de3('0x27')]);_0x4a2145[_0x2de3('0x2b')]=_[_0x2de3('0x2c')](_0x5a233f[_0x2de3('0x2b')]);_0x4a2145[_0x2de3('0x34')]=_[_0x2de3('0x2d')](_0x4a2145[_0x2de3('0x2a')],_0x4a2145[_0x2de3('0x2b')]);_0x1553c9['attributes']=_['intersection'](_0x4a2145['model'],qs[_0x2de3('0x2f')](_0x5a233f[_0x2de3('0x2b')][_0x2de3('0x2f')]));_0x1553c9[_0x2de3('0x2e')]=_0x1553c9['attributes'][_0x2de3('0x30')]?_0x1553c9[_0x2de3('0x2e')]:_0x4a2145[_0x2de3('0x2a')];if(_0x5a233f[_0x2de3('0x2b')]['includeAll']){_0x1553c9[_0x2de3('0x3b')]=[{'all':!![]}];}_0x1553c9=_[_0x2de3('0x3f')]({},_0x1553c9,_0x5a233f[_0x2de3('0x39')]);return db['Pause'][_0x2de3('0x40')](_0x1553c9)[_0x2de3('0x1e')](handleEntityNotFound(_0x59a31f,null))[_0x2de3('0x1e')](respondWithResult(_0x59a31f,null))['catch'](handleError(_0x59a31f,null));};exports[_0x2de3('0x41')]=function(_0x55942c,_0xd42102){return db['Pause'][_0x2de3('0x41')](_0x55942c[_0x2de3('0x42')],{})[_0x2de3('0x1e')](function(_0x54dd32){var _0x53f7ff=_0x55942c['user'][_0x2de3('0x43')]({'plain':!![]});if(!_0x53f7ff)throw new Error(_0x2de3('0x44'));if(_0x53f7ff[_0x2de3('0x45')]==='user'){var _0x454b81=_0x54dd32[_0x2de3('0x43')]({'plain':!![]});var _0x3c574f='Pauses';return db[_0x2de3('0x46')][_0x2de3('0x40')]({'where':{'name':_0x3c574f,'userProfileId':_0x53f7ff[_0x2de3('0x47')]},'raw':!![]})[_0x2de3('0x1e')](function(_0x2ff9f0){if(_0x2ff9f0&&_0x2ff9f0[_0x2de3('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x454b81['name'],'resourceId':_0x454b81['id'],'type':_0x2ff9f0[_0x2de3('0x23')],'sectionId':_0x2ff9f0['id']},{})[_0x2de3('0x1e')](function(){return _0x54dd32;});}else{return _0x54dd32;}})[_0x2de3('0x49')](function(_0x2662c0){logger[_0x2de3('0x22')](_0x2de3('0x4a'),_0x2662c0);throw _0x2662c0;});}return _0x54dd32;})[_0x2de3('0x1e')](respondWithResult(_0xd42102,0xc9))['catch'](handleError(_0xd42102,null));};exports[_0x2de3('0x4b')]=function(_0x539d9f,_0x1316f0){if(_0x539d9f['body']['id']){delete _0x539d9f['body']['id'];}return db[_0x2de3('0x26')][_0x2de3('0x40')]({'where':{'id':_0x539d9f[_0x2de3('0x3e')]['id']}})[_0x2de3('0x1e')](handleEntityNotFound(_0x1316f0,null))[_0x2de3('0x1e')](saveUpdates(_0x539d9f[_0x2de3('0x42')],null))[_0x2de3('0x1e')](respondWithResult(_0x1316f0,null))[_0x2de3('0x49')](handleError(_0x1316f0,null));};exports[_0x2de3('0x1f')]=function(_0x3f95d4,_0x5491a0){return db[_0x2de3('0x26')][_0x2de3('0x40')]({'where':{'id':_0x3f95d4[_0x2de3('0x3e')]['id']}})[_0x2de3('0x1e')](handleEntityNotFound(_0x5491a0,null))['then'](removeEntity(_0x5491a0,null))[_0x2de3('0x49')](handleError(_0x5491a0,null));}; \ No newline at end of file +var _0x3132=['destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','Pause','rawAttributes','fieldName','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x503707,_0x283b40){var _0x277ea3=function(_0x24812a){while(--_0x24812a){_0x503707['push'](_0x503707['shift']());}};_0x277ea3(++_0x283b40);}(_0x3132,0x1ee));var _0x2313=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x3132[_0xa9a245];return _0x2d0eaa;};'use strict';var emlformat=require(_0x2313('0x0'));var rimraf=require(_0x2313('0x1'));var zipdir=require(_0x2313('0x2'));var jsonpatch=require(_0x2313('0x3'));var rp=require(_0x2313('0x4'));var moment=require(_0x2313('0x5'));var BPromise=require(_0x2313('0x6'));var Mustache=require('mustache');var util=require(_0x2313('0x7'));var path=require('path');var sox=require(_0x2313('0x8'));var csv=require(_0x2313('0x9'));var ejs=require(_0x2313('0xa'));var fs=require('fs');var fs_extra=require(_0x2313('0xb'));var _=require(_0x2313('0xc'));var squel=require(_0x2313('0xd'));var crypto=require(_0x2313('0xe'));var jsforce=require(_0x2313('0xf'));var deskjs=require(_0x2313('0x10'));var toCsv=require(_0x2313('0x9'));var querystring=require(_0x2313('0x11'));var Papa=require(_0x2313('0x12'));var Redis=require('ioredis');var authService=require(_0x2313('0x13'));var qs=require(_0x2313('0x14'));var as=require(_0x2313('0x15'));var hardwareService=require(_0x2313('0x16'));var logger=require(_0x2313('0x17'))(_0x2313('0x18'));var utils=require('../../config/utils');var config=require(_0x2313('0x19'));var licenseUtil=require(_0x2313('0x1a'));var db=require(_0x2313('0x1b'))['db'];function respondWithStatusCode(_0x3f17c5,_0x305bb1){_0x305bb1=_0x305bb1||0xcc;return function(_0x4dfb98){if(_0x4dfb98){return _0x3f17c5['sendStatus'](_0x305bb1);}return _0x3f17c5['status'](_0x305bb1)[_0x2313('0x1c')]();};}function respondWithResult(_0x43fb2c,_0x3f9757){_0x3f9757=_0x3f9757||0xc8;return function(_0x5ebed0){if(_0x5ebed0){return _0x43fb2c[_0x2313('0x1d')](_0x3f9757)[_0x2313('0x1e')](_0x5ebed0);}};}function respondWithFilteredResult(_0x60264a,_0x352fc5){return function(_0x1f6e0a){if(_0x1f6e0a){var _0x13810e=typeof _0x352fc5[_0x2313('0x1f')]===_0x2313('0x20')&&typeof _0x352fc5[_0x2313('0x21')]===_0x2313('0x20');var _0x235ce4=_0x1f6e0a[_0x2313('0x22')];var _0x54b7db=_0x13810e?0x0:_0x352fc5[_0x2313('0x1f')];var _0x4a691e=_0x13810e?_0x1f6e0a[_0x2313('0x22')]:_0x352fc5['offset']+_0x352fc5[_0x2313('0x21')];var _0x180ff8;if(_0x4a691e>=_0x235ce4){_0x4a691e=_0x235ce4;_0x180ff8=0xc8;}else{_0x180ff8=0xce;}_0x60264a[_0x2313('0x1d')](_0x180ff8);return _0x60264a['set'](_0x2313('0x23'),_0x54b7db+'-'+_0x4a691e+'/'+_0x235ce4)[_0x2313('0x1e')](_0x1f6e0a);}return null;};}function patchUpdates(_0x3cc27a){return function(_0x2e7799){try{jsonpatch[_0x2313('0x24')](_0x2e7799,_0x3cc27a,!![]);}catch(_0x2488c0){return BPromise[_0x2313('0x25')](_0x2488c0);}return _0x2e7799[_0x2313('0x26')]();};}function saveUpdates(_0x58740b,_0x4688df){return function(_0x14bddd){if(_0x14bddd){return _0x14bddd[_0x2313('0x27')](_0x58740b)['then'](function(_0x131cf6){return _0x131cf6;});}return null;};}function removeEntity(_0x2754bf,_0x682512){return function(_0x7d3a85){if(_0x7d3a85){return _0x7d3a85[_0x2313('0x28')]()[_0x2313('0x29')](function(){var _0x44d1aa=_0x7d3a85[_0x2313('0x2a')]({'plain':!![]});var _0x5143c5='Pauses';return db[_0x2313('0x2b')]['destroy']({'where':{'type':_0x5143c5,'resourceId':_0x44d1aa['id']}})[_0x2313('0x29')](function(){return _0x7d3a85;});})[_0x2313('0x29')](function(){_0x2754bf[_0x2313('0x1d')](0xcc)[_0x2313('0x1c')]();});}};}function handleEntityNotFound(_0x54f2e2,_0x107748){return function(_0x692ab3){if(!_0x692ab3){_0x54f2e2[_0x2313('0x2c')](0x194);}return _0x692ab3;};}function handleError(_0x5ec2e6,_0x1ff8b3){_0x1ff8b3=_0x1ff8b3||0x1f4;return function(_0x4fab97){logger[_0x2313('0x2d')](_0x4fab97[_0x2313('0x2e')]);if(_0x4fab97[_0x2313('0x2f')]){delete _0x4fab97['name'];}_0x5ec2e6[_0x2313('0x1d')](_0x1ff8b3)[_0x2313('0x30')](_0x4fab97);};}exports[_0x2313('0x31')]=function(_0x103db0,_0x5a2b95){var _0x36a59d={},_0x4097a1={},_0x26c512={'count':0x0,'rows':[]};var _0x5e07bb=_['map'](db[_0x2313('0x32')][_0x2313('0x33')],function(_0xabd11f){return{'name':_0xabd11f[_0x2313('0x34')],'type':_0xabd11f['type']['key']};});_0x4097a1['model']=_[_0x2313('0x35')](_0x5e07bb,_0x2313('0x2f'));_0x4097a1[_0x2313('0x36')]=_[_0x2313('0x37')](_0x103db0[_0x2313('0x36')]);_0x4097a1['filters']=_['intersection'](_0x4097a1[_0x2313('0x38')],_0x4097a1[_0x2313('0x36')]);_0x36a59d[_0x2313('0x39')]=_[_0x2313('0x3a')](_0x4097a1[_0x2313('0x38')],qs[_0x2313('0x3b')](_0x103db0[_0x2313('0x36')]['fields']));_0x36a59d[_0x2313('0x39')]=_0x36a59d[_0x2313('0x39')]['length']?_0x36a59d[_0x2313('0x39')]:_0x4097a1[_0x2313('0x38')];if(!_0x103db0[_0x2313('0x36')][_0x2313('0x3c')]('nolimit')){_0x36a59d[_0x2313('0x21')]=qs[_0x2313('0x21')](_0x103db0[_0x2313('0x36')][_0x2313('0x21')]);_0x36a59d[_0x2313('0x1f')]=qs[_0x2313('0x1f')](_0x103db0[_0x2313('0x36')]['offset']);}_0x36a59d['order']=qs[_0x2313('0x3d')](_0x103db0[_0x2313('0x36')][_0x2313('0x3d')]);_0x36a59d[_0x2313('0x3e')]=qs['filters'](_[_0x2313('0x3f')](_0x103db0['query'],_0x4097a1[_0x2313('0x40')]),_0x5e07bb);if(_0x103db0[_0x2313('0x36')]['filter']){_0x36a59d[_0x2313('0x3e')]=_[_0x2313('0x41')](_0x36a59d[_0x2313('0x3e')],{'$or':_[_0x2313('0x35')](_0x5e07bb,function(_0x5f4d1d){if(_0x5f4d1d[_0x2313('0x42')]!==_0x2313('0x43')){var _0x3136e7={};_0x3136e7[_0x5f4d1d[_0x2313('0x2f')]]={'$like':'%'+_0x103db0[_0x2313('0x36')][_0x2313('0x44')]+'%'};return _0x3136e7;}})});}_0x36a59d=_[_0x2313('0x41')]({},_0x36a59d,_0x103db0[_0x2313('0x45')]);var _0x6e09ec={'where':_0x36a59d[_0x2313('0x3e')]};return db[_0x2313('0x32')]['count'](_0x6e09ec)[_0x2313('0x29')](function(_0x138fc4){_0x26c512[_0x2313('0x22')]=_0x138fc4;if(_0x103db0['query'][_0x2313('0x46')]){_0x36a59d[_0x2313('0x47')]=[{'all':!![]}];}return db[_0x2313('0x32')][_0x2313('0x48')](_0x36a59d);})['then'](function(_0x1e4b4c){_0x26c512[_0x2313('0x49')]=_0x1e4b4c;return _0x26c512;})[_0x2313('0x29')](respondWithFilteredResult(_0x5a2b95,_0x36a59d))['catch'](handleError(_0x5a2b95,null));};exports[_0x2313('0x4a')]=function(_0x1b9a66,_0x29ac39){var _0x4157f3={'raw':!![],'where':{'id':_0x1b9a66[_0x2313('0x4b')]['id']}},_0x36d9c5={};_0x36d9c5[_0x2313('0x38')]=_[_0x2313('0x37')](db['Pause'][_0x2313('0x33')]);_0x36d9c5['query']=_[_0x2313('0x37')](_0x1b9a66[_0x2313('0x36')]);_0x36d9c5[_0x2313('0x40')]=_[_0x2313('0x3a')](_0x36d9c5[_0x2313('0x38')],_0x36d9c5[_0x2313('0x36')]);_0x4157f3[_0x2313('0x39')]=_[_0x2313('0x3a')](_0x36d9c5[_0x2313('0x38')],qs['fields'](_0x1b9a66[_0x2313('0x36')][_0x2313('0x3b')]));_0x4157f3[_0x2313('0x39')]=_0x4157f3[_0x2313('0x39')][_0x2313('0x4c')]?_0x4157f3[_0x2313('0x39')]:_0x36d9c5[_0x2313('0x38')];if(_0x1b9a66['query'][_0x2313('0x46')]){_0x4157f3[_0x2313('0x47')]=[{'all':!![]}];}_0x4157f3=_[_0x2313('0x41')]({},_0x4157f3,_0x1b9a66[_0x2313('0x45')]);return db['Pause'][_0x2313('0x4d')](_0x4157f3)[_0x2313('0x29')](handleEntityNotFound(_0x29ac39,null))[_0x2313('0x29')](respondWithResult(_0x29ac39,null))[_0x2313('0x4e')](handleError(_0x29ac39,null));};exports[_0x2313('0x4f')]=function(_0x35041e,_0x85ab71){return db['Pause'][_0x2313('0x4f')](_0x35041e[_0x2313('0x50')],{})[_0x2313('0x29')](function(_0x5942c5){var _0x3fb722=_0x35041e[_0x2313('0x51')]['get']({'plain':!![]});if(!_0x3fb722)throw new Error(_0x2313('0x52'));if(_0x3fb722[_0x2313('0x53')]===_0x2313('0x51')){var _0x37b6bf=_0x5942c5[_0x2313('0x2a')]({'plain':!![]});var _0x2f969f=_0x2313('0x54');return db[_0x2313('0x55')][_0x2313('0x4d')]({'where':{'name':_0x2f969f,'userProfileId':_0x3fb722[_0x2313('0x56')]},'raw':!![]})[_0x2313('0x29')](function(_0x5eea5a){if(_0x5eea5a&&_0x5eea5a[_0x2313('0x57')]===0x0){return db['UserProfileResource'][_0x2313('0x4f')]({'name':_0x37b6bf['name'],'resourceId':_0x37b6bf['id'],'type':_0x5eea5a[_0x2313('0x2f')],'sectionId':_0x5eea5a['id']},{})['then'](function(){return _0x5942c5;});}else{return _0x5942c5;}})[_0x2313('0x4e')](function(_0x5dd565){logger[_0x2313('0x2d')](_0x2313('0x58'),_0x5dd565);throw _0x5dd565;});}return _0x5942c5;})['then'](respondWithResult(_0x85ab71,0xc9))[_0x2313('0x4e')](handleError(_0x85ab71,null));};exports[_0x2313('0x27')]=function(_0x47c90a,_0x4f7392){if(_0x47c90a['body']['id']){delete _0x47c90a[_0x2313('0x50')]['id'];}return db['Pause']['find']({'where':{'id':_0x47c90a[_0x2313('0x4b')]['id']}})[_0x2313('0x29')](handleEntityNotFound(_0x4f7392,null))[_0x2313('0x29')](saveUpdates(_0x47c90a[_0x2313('0x50')],null))['then'](respondWithResult(_0x4f7392,null))[_0x2313('0x4e')](handleError(_0x4f7392,null));};exports[_0x2313('0x28')]=function(_0x584a21,_0x351a09){return db[_0x2313('0x32')][_0x2313('0x4d')]({'where':{'id':_0x584a21[_0x2313('0x4b')]['id']}})[_0x2313('0x29')](handleEntityNotFound(_0x351a09,null))[_0x2313('0x29')](removeEntity(_0x351a09,null))[_0x2313('0x4e')](handleError(_0x351a09,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index d193f61..add7253 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x7217,0x19e));var _0x7721=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x7217[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x3009e5,_0x54464c){var _0x40075d=function(_0x5c5306){while(--_0x5c5306){_0x3009e5['push'](_0x3009e5['shift']());}};_0x40075d(++_0x54464c);}(_0x326f,0xd1));var _0xf326=function(_0x35422c,_0x3d9fdf){_0x35422c=_0x35422c-0x0;var _0x2374eb=_0x326f[_0x35422c];return _0x2374eb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('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 41a4605..3dac2bf 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2ad648,_0x2db2be){var _0x57b907=function(_0x17800d){while(--_0x17800d){_0x2ad648['push'](_0x2ad648['shift']());}};_0x57b907(++_0x2db2be);}(_0x7a54,0x106));var _0x47a5=function(_0x28ee6d,_0x58aa5c){_0x28ee6d=_0x28ee6d-0x0;var _0x429971=_0x7a54[_0x28ee6d];return _0x429971;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x327d29,_0x49517c){var _0x3f4429=function(_0x166683){while(--_0x166683){_0x327d29['push'](_0x327d29['shift']());}};_0x3f4429(++_0x49517c);}(_0x7a54,0x106));var _0x47a5=function(_0x50bf7d,_0x25e26f){_0x50bf7d=_0x50bf7d-0x0;var _0x28ce65=_0x7a54[_0x50bf7d];return _0x28ce65;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e49b68f..d05530d 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 _0x54ef=['show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','extname','post','upload','webhookPost','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','isAuthenticated'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x54ef,0x112));var _0xf54e=function(_0x2604c2,_0x2689af){_0x2604c2=_0x2604c2-0x0;var _0x1be0c0=_0x54ef[_0x2604c2];return _0x1be0c0;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),controller['webhookGet']);router[_0xf54e('0xb')]('/:id',auth[_0xf54e('0xd')](),controller[_0xf54e('0xe')]);router['get'](_0xf54e('0xf'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x10')]);var upload=multer({'storage':multer[_0xf54e('0x11')]({'destination':function(_0x5f232a,_0x558502,_0xc939ab){_0xc939ab(null,path[_0xf54e('0x12')](config[_0xf54e('0x13')],'server/files/plugins'));},'filename':function(_0x358c88,_0x4b0ee1,_0x4bd828){_0x4b0ee1[_0xf54e('0x14')]=_0x4b0ee1[_0xf54e('0x14')][_0xf54e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd828(null,util[_0xf54e('0x16')]('%s-%s%s',path[_0xf54e('0x17')](_0x4b0ee1[_0xf54e('0x14')],path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])),Date['now'](),path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])));}})});router[_0xf54e('0x19')]('/',upload['single']('file'),controller[_0xf54e('0x1a')]);router[_0xf54e('0x19')](_0xf54e('0xc'),controller[_0xf54e('0x1b')]);router[_0xf54e('0x1c')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x1e')]);router[_0xf54e('0x1f')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x1cc7=['path','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/webhook','webhookGet','/:id','show','/:id/download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','webhookPost','put','delete','exports','multer','util'];(function(_0x6487e3,_0x3ef5ac){var _0x4c1f77=function(_0x63f9e0){while(--_0x63f9e0){_0x6487e3['push'](_0x6487e3['shift']());}};_0x4c1f77(++_0x3ef5ac);}(_0x1cc7,0x15a));var _0x71cc=function(_0x47f312,_0x40c204){_0x47f312=_0x47f312-0x0;var _0x34e152=_0x1cc7[_0x47f312];return _0x34e152;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x71cc('0x3'));var auth=require(_0x71cc('0x4'));var interaction=require(_0x71cc('0x5'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x71cc('0x6')](),controller['index']);router[_0x71cc('0x7')](_0x71cc('0x8'),controller[_0x71cc('0x9')]);router[_0x71cc('0x7')](_0x71cc('0xa'),auth['isAuthenticated'](),controller[_0x71cc('0xb')]);router[_0x71cc('0x7')](_0x71cc('0xc'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b7514,_0xeb4747,_0x2db190){_0x2db190(null,path[_0x71cc('0xd')](config['root'],_0x71cc('0xe')));},'filename':function(_0x550b3c,_0x1aad83,_0x4f9c5c){_0x1aad83[_0x71cc('0xf')]=_0x1aad83['originalname'][_0x71cc('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f9c5c(null,util[_0x71cc('0x11')](_0x71cc('0x12'),path[_0x71cc('0x13')](_0x1aad83[_0x71cc('0xf')],path['extname'](_0x1aad83[_0x71cc('0xf')])),Date[_0x71cc('0x14')](),path[_0x71cc('0x15')](_0x1aad83[_0x71cc('0xf')])));}})});router[_0x71cc('0x16')]('/',upload[_0x71cc('0x17')](_0x71cc('0x18')),controller['upload']);router[_0x71cc('0x16')](_0x71cc('0x8'),controller[_0x71cc('0x19')]);router[_0x71cc('0x1a')](_0x71cc('0xa'),auth[_0x71cc('0x6')](),controller['update']);router[_0x71cc('0x1b')](_0x71cc('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x71cc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9a5e733..e924f55 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 _0x43b0=['sequelize','STRING','ENUM','html','script','TEXT','BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x24d0ed,_0x15735a){var _0x5ca169=function(_0x21a028){while(--_0x21a028){_0x24d0ed['push'](_0x24d0ed['shift']());}};_0x5ca169(++_0x15735a);}(_0x43b0,0x11e));var _0x043b=function(_0x3a5fba,_0x120224){_0x3a5fba=_0x3a5fba-0x0;var _0x291753=_0x43b0[_0x3a5fba];return _0x291753;};'use strict';var Sequelize=require(_0x043b('0x0'));module['exports']={'name':{'type':Sequelize[_0x043b('0x1')]},'type':{'type':Sequelize[_0x043b('0x2')](_0x043b('0x3'),_0x043b('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x043b('0x5')]},'path':{'type':Sequelize[_0x043b('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x043b('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x043b('0x2')]('adminOnly',_0x043b('0x7'),_0x043b('0x8'),_0x043b('0x9')),'defaultValue':_0x043b('0x8'),'comment':_0x043b('0xa')},'icon':{'type':Sequelize[_0x043b('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x043b('0x1')]},'scriptPath':{'type':Sequelize[_0x043b('0x1')]}}; \ No newline at end of file +var _0xc1cc=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0xc1cc,0x13f));var _0xcc1c=function(_0x237b89,_0x11548f){_0x237b89=_0x237b89-0x0;var _0x282e5c=_0xc1cc[_0x237b89];return _0x282e5c;};'use strict';var Sequelize=require(_0xcc1c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcc1c('0x1')]('html',_0xcc1c('0x2'))},'description':{'type':Sequelize[_0xcc1c('0x3')]},'version':{'type':Sequelize[_0xcc1c('0x3')]},'path':{'type':Sequelize[_0xcc1c('0x4')],'comment':_0xcc1c('0x5')},'active':{'type':Sequelize[_0xcc1c('0x6')],'defaultValue':0x0,'comment':_0xcc1c('0x7')},'sidebar':{'type':Sequelize[_0xcc1c('0x1')](_0xcc1c('0x8'),_0xcc1c('0x9'),'always',_0xcc1c('0xa')),'defaultValue':_0xcc1c('0xb'),'comment':_0xcc1c('0xc')},'icon':{'type':Sequelize[_0xcc1c('0x4')]},'adminUrl':{'type':Sequelize[_0xcc1c('0x4')]},'agentUrl':{'type':Sequelize[_0xcc1c('0x4')]},'scriptName':{'type':Sequelize[_0xcc1c('0x4')]},'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 d8cc94a..3607be3 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 _0xf733=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','params','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','basename','node_modules/**/*','join','close','existsSync','download','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Zip\x20archive\x20removed','dirname','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','sendStatus','webhookPost','resolve','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv'];(function(_0xefe23d,_0xed34c1){var _0x27a83b=function(_0x35d774){while(--_0x35d774){_0xefe23d['push'](_0xefe23d['shift']());}};_0x27a83b(++_0xed34c1);}(_0xf733,0x9d));var _0x3f73=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0xf733[_0x19a90e];return _0xa49b11;};'use strict';var emlformat=require(_0x3f73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f73('0x1'));var rp=require(_0x3f73('0x2'));var moment=require('moment');var BPromise=require(_0x3f73('0x3'));var Mustache=require('mustache');var util=require(_0x3f73('0x4'));var path=require(_0x3f73('0x5'));var sox=require(_0x3f73('0x6'));var csv=require(_0x3f73('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f73('0x8'));var _=require('lodash');var squel=require(_0x3f73('0x9'));var crypto=require(_0x3f73('0xa'));var jsforce=require(_0x3f73('0xb'));var deskjs=require(_0x3f73('0xc'));var toCsv=require(_0x3f73('0x7'));var querystring=require(_0x3f73('0xd'));var Papa=require(_0x3f73('0xe'));var extract=require(_0x3f73('0xf'));var rimraf=require(_0x3f73('0x10'));var archiver=require(_0x3f73('0x11'));var Redis=require(_0x3f73('0x12'));var authService=require(_0x3f73('0x13'));var qs=require(_0x3f73('0x14'));var as=require(_0x3f73('0x15'));var hardwareService=require(_0x3f73('0x16'));var logger=require('../../config/logger')(_0x3f73('0x17'));var utils=require(_0x3f73('0x18'));var config=require(_0x3f73('0x19'));var licenseUtil=require(_0x3f73('0x1a'));var db=require(_0x3f73('0x1b'))['db'];config[_0x3f73('0x1c')]=_[_0x3f73('0x1d')](config['redis'],{'host':_0x3f73('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x2d23cc,_0x267942){_0x267942=_0x267942||0xcc;return function(_0x38a004){if(_0x38a004){return _0x2d23cc['sendStatus'](_0x267942);}return _0x2d23cc[_0x3f73('0x1f')](_0x267942)[_0x3f73('0x20')]();};}function respondWithResult(_0x50b5b7,_0x84a561){_0x84a561=_0x84a561||0xc8;return function(_0x11f406){if(_0x11f406){return _0x50b5b7[_0x3f73('0x1f')](_0x84a561)[_0x3f73('0x21')](_0x11f406);}};}function respondWithFilteredResult(_0x1a84cb,_0x41ae46){return function(_0x58f388){if(_0x58f388){var _0x117a10=typeof _0x41ae46[_0x3f73('0x22')]===_0x3f73('0x23')&&typeof _0x41ae46['limit']===_0x3f73('0x23');var _0x1ae0d4=_0x58f388[_0x3f73('0x24')];var _0x5c5b68=_0x117a10?0x0:_0x41ae46[_0x3f73('0x22')];var _0x302b14=_0x117a10?_0x58f388['count']:_0x41ae46[_0x3f73('0x22')]+_0x41ae46[_0x3f73('0x25')];var _0x38bc3a;if(_0x302b14>=_0x1ae0d4){_0x302b14=_0x1ae0d4;_0x38bc3a=0xc8;}else{_0x38bc3a=0xce;}_0x1a84cb[_0x3f73('0x1f')](_0x38bc3a);return _0x1a84cb['set'](_0x3f73('0x26'),_0x5c5b68+'-'+_0x302b14+'/'+_0x1ae0d4)[_0x3f73('0x21')](_0x58f388);}return null;};}function patchUpdates(_0x42581b){return function(_0x45c19c){try{jsonpatch[_0x3f73('0x27')](_0x45c19c,_0x42581b,!![]);}catch(_0x55019b){return BPromise[_0x3f73('0x28')](_0x55019b);}return _0x45c19c[_0x3f73('0x29')]();};}function saveUpdates(_0x2223ee,_0x34a468){return function(_0x7d7120){if(_0x7d7120){return _0x7d7120[_0x3f73('0x2a')](_0x2223ee)['then'](function(_0x253678){return _0x253678;});}return null;};}function removeEntity(_0x4725ed,_0x570ec9){return function(_0x243620){if(_0x243620){return _0x243620[_0x3f73('0x2b')]()[_0x3f73('0x2c')](function(){var _0x15033c=_0x243620[_0x3f73('0x2d')]({'plain':!![]});var _0xb55e7c=_0x3f73('0x2e');return db[_0x3f73('0x2f')]['destroy']({'where':{'type':_0xb55e7c,'resourceId':_0x15033c['id']}})['then'](function(){return _0x243620;});})[_0x3f73('0x2c')](function(){_0x4725ed[_0x3f73('0x1f')](0xcc)[_0x3f73('0x20')]();});}};}function handleEntityNotFound(_0x1bb9fd,_0x28de4e){return function(_0x7e2409){if(!_0x7e2409){_0x1bb9fd['sendStatus'](0x194);}return _0x7e2409;};}function handleError(_0x4326f3,_0x2ebe37){_0x2ebe37=_0x2ebe37||0x1f4;return function(_0x9db78a){logger[_0x3f73('0x30')](_0x9db78a[_0x3f73('0x31')]);if(_0x9db78a[_0x3f73('0x32')]){delete _0x9db78a['name'];}_0x4326f3[_0x3f73('0x1f')](_0x2ebe37)[_0x3f73('0x33')](_0x9db78a);};}exports[_0x3f73('0x34')]=function(_0x19117a,_0x255bb3){var _0x1d649c={},_0x11ffbf={},_0x314f14={'count':0x0,'rows':[]};var _0x5b3df7=_[_0x3f73('0x35')](db[_0x3f73('0x36')][_0x3f73('0x37')],function(_0x3ba808){return{'name':_0x3ba808[_0x3f73('0x38')],'type':_0x3ba808['type'][_0x3f73('0x39')]};});_0x11ffbf[_0x3f73('0x3a')]=_[_0x3f73('0x35')](_0x5b3df7,'name');_0x11ffbf[_0x3f73('0x3b')]=_['keys'](_0x19117a['query']);_0x11ffbf[_0x3f73('0x3c')]=_[_0x3f73('0x3d')](_0x11ffbf[_0x3f73('0x3a')],_0x11ffbf[_0x3f73('0x3b')]);_0x1d649c['attributes']=_[_0x3f73('0x3d')](_0x11ffbf['model'],qs[_0x3f73('0x3e')](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x3e')]));_0x1d649c[_0x3f73('0x3f')]=_0x1d649c['attributes'][_0x3f73('0x40')]?_0x1d649c[_0x3f73('0x3f')]:_0x11ffbf[_0x3f73('0x3a')];if(!_0x19117a['query'][_0x3f73('0x41')](_0x3f73('0x42'))){_0x1d649c['limit']=qs[_0x3f73('0x25')](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x25')]);_0x1d649c[_0x3f73('0x22')]=qs['offset'](_0x19117a[_0x3f73('0x3b')][_0x3f73('0x22')]);}_0x1d649c[_0x3f73('0x43')]=qs[_0x3f73('0x44')](_0x19117a[_0x3f73('0x3b')]['sort']);_0x1d649c[_0x3f73('0x45')]=qs['filters'](_[_0x3f73('0x46')](_0x19117a[_0x3f73('0x3b')],_0x11ffbf[_0x3f73('0x3c')]),_0x5b3df7);if(_0x19117a[_0x3f73('0x3b')][_0x3f73('0x47')]){_0x1d649c['where']=_['merge'](_0x1d649c['where'],{'$or':_[_0x3f73('0x35')](_0x5b3df7,function(_0x371b4c){if(_0x371b4c[_0x3f73('0x48')]!==_0x3f73('0x49')){var _0x21370a={};_0x21370a[_0x371b4c[_0x3f73('0x32')]]={'$like':'%'+_0x19117a[_0x3f73('0x3b')][_0x3f73('0x47')]+'%'};return _0x21370a;}})});}_0x1d649c=_[_0x3f73('0x4a')]({},_0x1d649c,_0x19117a['options']);var _0x282942={'where':_0x1d649c[_0x3f73('0x45')]};return db['Plugin'][_0x3f73('0x24')](_0x282942)[_0x3f73('0x2c')](function(_0x1dda9c){_0x314f14[_0x3f73('0x24')]=_0x1dda9c;if(_0x19117a[_0x3f73('0x3b')][_0x3f73('0x4b')]){_0x1d649c['include']=[{'all':!![]}];}return db[_0x3f73('0x36')][_0x3f73('0x4c')](_0x1d649c);})[_0x3f73('0x2c')](function(_0x56e366){_0x314f14[_0x3f73('0x4d')]=_0x56e366;return _0x314f14;})['then'](respondWithFilteredResult(_0x255bb3,_0x1d649c))[_0x3f73('0x4e')](handleError(_0x255bb3,null));};exports[_0x3f73('0x4f')]=function(_0x1bef52,_0x21d0ec){var _0x5f300e={'raw':!![],'where':{'id':_0x1bef52['params']['id']}},_0x2c8bae={};_0x2c8bae[_0x3f73('0x3a')]=_[_0x3f73('0x50')](db[_0x3f73('0x36')]['rawAttributes']);_0x2c8bae[_0x3f73('0x3b')]=_[_0x3f73('0x50')](_0x1bef52[_0x3f73('0x3b')]);_0x2c8bae['filters']=_[_0x3f73('0x3d')](_0x2c8bae['model'],_0x2c8bae[_0x3f73('0x3b')]);_0x5f300e[_0x3f73('0x3f')]=_[_0x3f73('0x3d')](_0x2c8bae[_0x3f73('0x3a')],qs[_0x3f73('0x3e')](_0x1bef52[_0x3f73('0x3b')][_0x3f73('0x3e')]));_0x5f300e[_0x3f73('0x3f')]=_0x5f300e[_0x3f73('0x3f')][_0x3f73('0x40')]?_0x5f300e[_0x3f73('0x3f')]:_0x2c8bae['model'];if(_0x1bef52[_0x3f73('0x3b')][_0x3f73('0x4b')]){_0x5f300e[_0x3f73('0x51')]=[{'all':!![]}];}_0x5f300e=_[_0x3f73('0x4a')]({},_0x5f300e,_0x1bef52[_0x3f73('0x52')]);return db['Plugin'][_0x3f73('0x53')](_0x5f300e)[_0x3f73('0x2c')](handleEntityNotFound(_0x21d0ec,null))[_0x3f73('0x2c')](respondWithResult(_0x21d0ec,null))[_0x3f73('0x4e')](handleError(_0x21d0ec,null));};exports['download']=function(_0x3f31a1,_0x46e498,_0x520a83){return db['Plugin'][_0x3f73('0x53')]({'where':{'id':_0x3f31a1[_0x3f73('0x54')]['id']},'attributes':['name','path'],'raw':!![]})[_0x3f73('0x2c')](handleEntityNotFound(_0x46e498,null))[_0x3f73('0x2c')](function(_0x871123){if(_0x871123){var _0x2de0c5=path['join'](config[_0x3f73('0x55')],_0x3f73('0x56'),util[_0x3f73('0x57')](_0x3f73('0x58'),path['basename'](_0x871123[_0x3f73('0x5')])));var _0x59862b=fs[_0x3f73('0x59')](_0x2de0c5);var _0x5c6df9=archiver(_0x3f73('0x5a'),{'zlib':{'level':0x9}});_0x5c6df9['on'](_0x3f73('0x5b'),function(_0x118e14){if(_0x118e14[_0x3f73('0x5c')]==='ENOENT'){logger['error'](_0x118e14);}else{throw new db[(_0x3f73('0x5d'))][(_0x3f73('0x5e'))](_0x3f73('0x5f'));}});_0x5c6df9['on'](_0x3f73('0x30'),function(_0x21d9c0){throw new db[(_0x3f73('0x5d'))]['Error'](_0x3f73('0x5f'));});_0x5c6df9['pipe'](_0x59862b);_0x5c6df9['glob']('**/*',{'cwd':path['join'](config[_0x3f73('0x55')],'server/files/plugins',path['dirname'](_0x871123[_0x3f73('0x5')])),'ignore':[path['join'](path[_0x3f73('0x60')](_0x871123['path']),_0x3f73('0x61')),path[_0x3f73('0x62')](path[_0x3f73('0x60')](_0x871123[_0x3f73('0x5')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x59862b['on'](_0x3f73('0x63'),function(){if(!fs[_0x3f73('0x64')](_0x2de0c5)){throw new db[(_0x3f73('0x5d'))][(_0x3f73('0x5e'))]('Plugin\x20not\x20found');}return _0x46e498[_0x3f73('0x65')](_0x2de0c5,util[_0x3f73('0x57')](_0x3f73('0x58'),path[_0x3f73('0x60')](_0x871123[_0x3f73('0x5')])),function(_0x52e723){if(_0x52e723){throw new db[(_0x3f73('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2de0c5);logger['info'](_0x3f73('0x66'));logger['info'](_0x3f73('0x67'));});});}return null;})['catch'](handleError(_0x46e498,null));};exports[_0x3f73('0x68')]=function(_0x3e0619,_0x2f9c36,_0x4751cd){var _0x31a043=path[_0x3f73('0x60')](_0x3e0619['file'][_0x3f73('0x69')],path[_0x3f73('0x6a')](_0x3e0619[_0x3f73('0x6b')][_0x3f73('0x69')]));var _0x442f7e=path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),_0x3e0619['file']['filename']);var _0x4073f3=path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),_0x31a043);logger[_0x3f73('0x6c')](_0x3f73('0x6d'),_0x442f7e);logger[_0x3f73('0x6c')](_0x3f73('0x6e'),_0x4073f3);try{fs[_0x3f73('0x6f')](_0x442f7e,parseInt(_0x3f73('0x70'),0x8));extract(_0x442f7e,{'dir':_0x4073f3},function(_0x10e727){if(_0x10e727){logger[_0x3f73('0x30')](_0x10e727);handleError(_0x10e727,!![]);};var _0xf64a2a=fs[_0x3f73('0x71')](_0x4073f3);if(_0xf64a2a[_0x3f73('0x40')]>0x1){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')](_0x3f73('0x72'));return _0x4751cd(new Error(_0x3f73('0x72')));}var _0x270f11=fs[_0x3f73('0x73')](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0]));if(_0x270f11['isFile']()){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')]('Invalid\x20plugin\x20structure');return _0x4751cd(new Error(_0x3f73('0x72')));}if(_0x270f11['isDirectory']()){var _0x3abda1=fs['readdirSync'](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0]));if(_0x3abda1['length']===0x0){removeReferences(_0x442f7e,_0x4073f3);logger[_0x3f73('0x30')](_0x3f73('0x72'));return _0x4751cd(new Error(_0x3f73('0x72')));}var _0x52c331=_0x3abda1[_0x3f73('0x74')](function(_0xfa35c3){return _0xfa35c3==='manifest.json';});if(!_0x52c331){return _0x4751cd(new Error(_0x3f73('0x75')));}var _0x333c4b=fs[_0x3f73('0x76')](path[_0x3f73('0x62')](_0x4073f3,_0xf64a2a[0x0],'manifest.json'));var _0x32d2eb=JSON['parse'](_0x333c4b);if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x32')]){return _0x4751cd(new Error(_0x3f73('0x77')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x48')]){return _0x4751cd(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x78')]){return _0x4751cd(new Error(_0x3f73('0x79')));}if('undefined'==typeof _0x32d2eb[_0x3f73('0x7a')]){return _0x4751cd(new Error(_0x3f73('0x7b')));}if(_0x32d2eb[_0x3f73('0x48')]===_0x3f73('0x7c')){if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]){return _0x4751cd(new Error(_0x3f73('0x7e')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')]&&_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]['agent']){return _0x4751cd(new Error(_0x3f73('0x80')));}}else if(_0x32d2eb[_0x3f73('0x48')]===_0x3f73('0x81')){if('undefined'==typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x82')]){return _0x4751cd(new Error(_0x3f73('0x83')));}if(_0x3f73('0x23')==typeof _0x32d2eb[_0x3f73('0x7a')]['scriptPath']){return _0x4751cd(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4751cd(new Error(_0x3f73('0x84')));}var _0x25cff1=_0x32d2eb[_0x3f73('0x32')];var _0x27da3d=_0x32d2eb['description'];var _0x11e8b5=_0x32d2eb[_0x3f73('0x48')];var _0x48da73=_0x32d2eb[_0x3f73('0x85')]?_0x32d2eb[_0x3f73('0x85')]:_0x3f73('0x86');var _0x4ae785=_0x32d2eb[_0x3f73('0x87')]?_0x32d2eb['icon']:_0x3f73('0x88');var _0x14f5dc='';var _0x173721='';var _0x4cdf2c='';var _0x27bd13='';var _0x14fc13=_0x32d2eb[_0x3f73('0x78')];if(_0x11e8b5===_0x3f73('0x7c')){if(_0x3f73('0x23')!=typeof _0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')]){var _0x3032dd=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0x3032dd)){_0x14f5dc=path[_0x3f73('0x62')]('plugins',_0x31a043,_0xf64a2a[0x0],_0x3032dd);}else{_0x14f5dc=_0x3032dd;}}else{logger[_0x3f73('0x6c')](_0x3f73('0x8a'));}if(_0x3f73('0x23')!=typeof _0x32d2eb['parameters']['views'][_0x3f73('0x8b')]){var _0xb651bb=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')][_0x3f73('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0xb651bb)){_0x173721=path[_0x3f73('0x62')](_0x3f73('0x8c'),_0x31a043,_0xf64a2a[0x0],_0xb651bb);}else{_0x173721=_0xb651bb;}}else{logger[_0x3f73('0x6c')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x11e8b5==='script'){_0x4cdf2c=_0x32d2eb['parameters'][_0x3f73('0x82')];_0x27bd13=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x8d')];if(_0x3f73('0x23')!=typeof _0x32d2eb[_0x3f73('0x7a')]['views']){if('undefined'!=typeof _0x32d2eb[_0x3f73('0x7a')]['views'][_0x3f73('0x7f')]){var _0x3032dd=_0x32d2eb[_0x3f73('0x7a')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0x3032dd)){_0x14f5dc=path[_0x3f73('0x62')](_0x3f73('0x8c'),_0x31a043,_0xf64a2a[0x0],_0x3032dd);}else{_0x14f5dc=_0x3032dd;}}if('undefined'!=typeof _0x32d2eb['parameters'][_0x3f73('0x7d')]['agent']){var _0xb651bb=_0x32d2eb[_0x3f73('0x7a')][_0x3f73('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3f73('0x89')](_0xb651bb)){_0x173721=path[_0x3f73('0x62')]('plugins',_0x31a043,_0xf64a2a[0x0],_0xb651bb);}else{_0x173721=_0xb651bb;}}}}var _0x8044c6={'name':_0x25cff1,'description':_0x27da3d,'path':path[_0x3f73('0x62')](_0x31a043,_0xf64a2a[0x0]),'type':_0x11e8b5,'sidebar':_0x48da73,'icon':_0x4ae785,'adminUrl':_0x14f5dc,'agentUrl':_0x173721,'scriptName':_0x4cdf2c,'scriptPath':_0x27bd13,'version':_0x14fc13};removeReferences(_0x442f7e,null);return db[_0x3f73('0x36')][_0x3f73('0x8e')](_0x8044c6)[_0x3f73('0x2c')](function(_0x366337){var _0x509193={'role':_0x3e0619[_0x3f73('0x8f')][_0x3f73('0x90')],'userProfileId':_0x3e0619['body'][_0x3f73('0x91')]};if(!_0x509193)throw new Error(_0x3f73('0x92'));if(_0x509193[_0x3f73('0x90')]===_0x3f73('0x93')){var _0x2fe050=_0x366337['get']({'plain':!![]});return db['UserProfileSection'][_0x3f73('0x53')]({'where':{'name':_0x3f73('0x2e'),'userProfileId':_0x509193['userProfileId']},'raw':!![]})['then'](function(_0x2aeba5){if(_0x2aeba5&&_0x2aeba5['autoAssociation']===0x0){return db[_0x3f73('0x2f')][_0x3f73('0x8e')]({'name':_0x2fe050['name'],'resourceId':_0x2fe050['id'],'type':_0x2aeba5[_0x3f73('0x32')],'sectionId':_0x2aeba5['id']},{})['then'](function(){return _0x366337;});}else{return _0x366337;}})[_0x3f73('0x4e')](function(_0x4a431d){logger[_0x3f73('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a431d);throw _0x4a431d;});}return _0x366337;})[_0x3f73('0x2c')](respondWithResult(_0x2f9c36,null))['catch'](handleError(_0x2f9c36,null));}});}catch(_0x465e9f){_0x2f9c36[_0x3f73('0x1f')](0x1f4)[_0x3f73('0x33')](_0x465e9f);}};function removeReferences(_0x481a07,_0x2fd083){try{if(_0x481a07){fs['unlinkSync'](_0x481a07);logger[_0x3f73('0x6c')](_0x3f73('0x94'));}if(_0x2fd083){rimraf(_0x2fd083,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x2d619c){logger[_0x3f73('0x30')](_0x2d619c);}}exports[_0x3f73('0x2a')]=function(_0x170c28,_0x3ed10d,_0x5d591a){return db['Plugin']['find']({'where':{'id':_0x170c28['params']['id']}})[_0x3f73('0x2c')](handleEntityNotFound(_0x3ed10d,null))[_0x3f73('0x2c')](saveUpdates(_0x170c28[_0x3f73('0x8f')],null))[_0x3f73('0x2c')](respondWithResult(_0x3ed10d,null))[_0x3f73('0x4e')](handleError(_0x3ed10d,null));};exports['delete']=function(_0x3b0f12,_0x20d475,_0x4bd475){return db[_0x3f73('0x36')][_0x3f73('0x53')]({'where':{'id':_0x3b0f12[_0x3f73('0x54')]['id']}})[_0x3f73('0x2c')](function(_0x3dfd60){if(_0x3dfd60){return _0x3dfd60[_0x3f73('0x2b')]();}})[_0x3f73('0x2c')](function(_0x3e59d4){rimraf(path[_0x3f73('0x62')](config[_0x3f73('0x55')],_0x3f73('0x56'),path[_0x3f73('0x95')](_0x3e59d4[_0x3f73('0x5')])),function(){});return _0x3e59d4;})[_0x3f73('0x2c')](handleEntityNotFound(_0x20d475,null))['then'](respondWithStatusCode(_0x20d475,null))[_0x3f73('0x4e')](handleError(_0x20d475,null));};exports['webhookGet']=function(_0x44ac34,_0x1b9db5,_0x5c2b48){return BPromise['resolve']()[_0x3f73('0x2c')](function(){if(!_0x44ac34[_0x3f73('0x3b')]['path']){throw new Error(_0x3f73('0x96'));}if(!_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x97')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38c878=_0x44ac34[_0x3f73('0x3b')]['hostname']?_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x98')]+':'+_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x97')]:'http://localhost:'+_0x44ac34[_0x3f73('0x3b')]['port'];var _0x4ebd76=_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x21')]?_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x21')]:!![];var _0x2d033a=_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x99')]?_0x44ac34['query'][_0x3f73('0x99')]:null;var _0x32abfa={'method':_0x44ac34[_0x3f73('0x9a')],'uri':util[_0x3f73('0x57')](_0x3f73('0x9b'),_0x38c878,_0x44ac34[_0x3f73('0x3b')][_0x3f73('0x5')]),'json':_0x4ebd76,'resolveWithFullResponse':!![],'encoding':_0x2d033a,'qs':_0x44ac34[_0x3f73('0x3b')]};if(_0x44ac34[_0x3f73('0x9c')]){_0x32abfa[_0x3f73('0x9c')]=_0x44ac34[_0x3f73('0x9c')];if(_0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9d')]){delete _0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9d')];}}if(_0x32abfa[_0x3f73('0x9c')][_0x3f73('0x9e')]){delete _0x32abfa[_0x3f73('0x9c')]['content-type'];}return rp(_0x32abfa);})['then'](function(_0x436d19){if(_0x436d19){_0x1b9db5[_0x3f73('0x9f')](_0x436d19[_0x3f73('0x9c')]);logger['info'](_0x436d19[_0x3f73('0x8f')]);if(_[_0x3f73('0xa0')](_0x44ac34['query'][_0x3f73('0x5')],'download')&&_0x436d19[_0x3f73('0xa1')]==0x1f4){return _0x1b9db5[_0x3f73('0xa2')](_0x436d19[_0x3f73('0xa1')]);}else{return _0x1b9db5[_0x3f73('0x1f')](_0x436d19[_0x3f73('0xa1')])[_0x3f73('0x33')](_0x436d19[_0x3f73('0x8f')]);}}else{return _0x1b9db5[_0x3f73('0xa2')](0xc8);}})[_0x3f73('0x4e')](handleError(_0x1b9db5,null));};exports[_0x3f73('0xa3')]=function(_0xebf16b,_0x1f069a,_0x41c04d){return BPromise[_0x3f73('0xa4')]()['then'](function(){if(!_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xebf16b['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3ada28=_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x98')]?_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x98')]+':'+_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x97')]:'http://localhost:'+_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x97')];var _0xaf80af=_0xebf16b['query'][_0x3f73('0x21')]?_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x21')]:!![];var _0x394c95=_0xebf16b[_0x3f73('0x3b')][_0x3f73('0x99')]?_0xebf16b['query'][_0x3f73('0x99')]:null;var _0x277f62={'method':_0xebf16b['method'],'uri':util['format']('%s%s',_0x3ada28,_0xebf16b[_0x3f73('0x3b')]['path']),'json':_0xaf80af,'resolveWithFullResponse':!![],'encoding':_0x394c95,'body':_0xebf16b['body']};if(_0xebf16b[_0x3f73('0x9c')]){_0x277f62[_0x3f73('0x9c')]=_0xebf16b['headers'];if(_0x277f62[_0x3f73('0x9c')]['content-length']){delete _0x277f62[_0x3f73('0x9c')][_0x3f73('0x9d')];}}if(_0x277f62[_0x3f73('0x9c')][_0x3f73('0x9e')]){delete _0x277f62['headers']['content-type'];}return rp(_0x277f62);})[_0x3f73('0x2c')](function(_0x410971){if(_0x410971){_0x1f069a[_0x3f73('0x9f')](_0x410971[_0x3f73('0x9c')]);logger[_0x3f73('0x6c')](_0x410971[_0x3f73('0x8f')]);return _0x1f069a[_0x3f73('0x1f')](_0x410971[_0x3f73('0xa1')])[_0x3f73('0x33')](_0x410971[_0x3f73('0x8f')]);}else{return _0x1f069a[_0x3f73('0xa2')](0xc8);}})[_0x3f73('0x4e')](handleError(_0x1f069a,null));}; \ No newline at end of file +var _0x2e59=['file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','length','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','%s%s','headers','content-length','content-type','download','statusCode','webhookPost','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Plugins','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Plugin','includeAll','findAll','rows','catch','show','params','include','options','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','root','dirname','node_modules/**/*','finalize','close','existsSync','Error','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload'];(function(_0x46f69e,_0x4f5985){var _0x3a4134=function(_0x378aa4){while(--_0x378aa4){_0x46f69e['push'](_0x46f69e['shift']());}};_0x3a4134(++_0x4f5985);}(_0x2e59,0x19c));var _0x92e5=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x2e59[_0x4ed4d2];return _0x15ae2e;};'use strict';var emlformat=require(_0x92e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92e5('0x2'));var moment=require(_0x92e5('0x3'));var BPromise=require(_0x92e5('0x4'));var Mustache=require(_0x92e5('0x5'));var util=require('util');var path=require(_0x92e5('0x6'));var sox=require(_0x92e5('0x7'));var csv=require(_0x92e5('0x8'));var ejs=require(_0x92e5('0x9'));var fs=require('fs');var fs_extra=require(_0x92e5('0xa'));var _=require(_0x92e5('0xb'));var squel=require('squel');var crypto=require(_0x92e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92e5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x92e5('0xe'));var archiver=require(_0x92e5('0xf'));var Redis=require(_0x92e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x92e5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x92e5('0x12'))(_0x92e5('0x13'));var utils=require(_0x92e5('0x14'));var config=require(_0x92e5('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x92e5('0x16')]=_[_0x92e5('0x17')](config[_0x92e5('0x16')],{'host':_0x92e5('0x18'),'port':0x18eb});var socket=require(_0x92e5('0x19'))(new Redis(config[_0x92e5('0x16')]));require(_0x92e5('0x1a'))[_0x92e5('0x1b')](socket);function respondWithStatusCode(_0x15c760,_0x3c6f9c){_0x3c6f9c=_0x3c6f9c||0xcc;return function(_0x47f935){if(_0x47f935){return _0x15c760[_0x92e5('0x1c')](_0x3c6f9c);}return _0x15c760[_0x92e5('0x1d')](_0x3c6f9c)[_0x92e5('0x1e')]();};}function respondWithResult(_0x3b5d68,_0x3fe8a9){_0x3fe8a9=_0x3fe8a9||0xc8;return function(_0x31e014){if(_0x31e014){return _0x3b5d68['status'](_0x3fe8a9)[_0x92e5('0x1f')](_0x31e014);}};}function respondWithFilteredResult(_0x53b2fd,_0x43f52e){return function(_0x472154){if(_0x472154){var _0x51b89b=typeof _0x43f52e[_0x92e5('0x20')]===_0x92e5('0x21')&&typeof _0x43f52e[_0x92e5('0x22')]===_0x92e5('0x21');var _0x6ac2ee=_0x472154[_0x92e5('0x23')];var _0x3eaa23=_0x51b89b?0x0:_0x43f52e[_0x92e5('0x20')];var _0x3f6c99=_0x51b89b?_0x472154[_0x92e5('0x23')]:_0x43f52e[_0x92e5('0x20')]+_0x43f52e[_0x92e5('0x22')];var _0x3347f0;if(_0x3f6c99>=_0x6ac2ee){_0x3f6c99=_0x6ac2ee;_0x3347f0=0xc8;}else{_0x3347f0=0xce;}_0x53b2fd['status'](_0x3347f0);return _0x53b2fd[_0x92e5('0x24')](_0x92e5('0x25'),_0x3eaa23+'-'+_0x3f6c99+'/'+_0x6ac2ee)[_0x92e5('0x1f')](_0x472154);}return null;};}function patchUpdates(_0x537a0c){return function(_0x3f0b06){try{jsonpatch['apply'](_0x3f0b06,_0x537a0c,!![]);}catch(_0x31945d){return BPromise[_0x92e5('0x26')](_0x31945d);}return _0x3f0b06[_0x92e5('0x27')]();};}function saveUpdates(_0x4f13cf,_0x4487d3){return function(_0x43fd1b){if(_0x43fd1b){return _0x43fd1b[_0x92e5('0x28')](_0x4f13cf)[_0x92e5('0x29')](function(_0x2a70b2){return _0x2a70b2;});}return null;};}function removeEntity(_0x324378,_0x1f2850){return function(_0x721af3){if(_0x721af3){return _0x721af3['destroy']()[_0x92e5('0x29')](function(){var _0x1fb70c=_0x721af3[_0x92e5('0x2a')]({'plain':!![]});var _0x5205cb=_0x92e5('0x2b');return db[_0x92e5('0x2c')][_0x92e5('0x2d')]({'where':{'type':_0x5205cb,'resourceId':_0x1fb70c['id']}})[_0x92e5('0x29')](function(){return _0x721af3;});})['then'](function(){_0x324378[_0x92e5('0x1d')](0xcc)[_0x92e5('0x1e')]();});}};}function handleEntityNotFound(_0x85552d,_0x3d339f){return function(_0x19ca20){if(!_0x19ca20){_0x85552d[_0x92e5('0x1c')](0x194);}return _0x19ca20;};}function handleError(_0x5a7c3a,_0x30e7be){_0x30e7be=_0x30e7be||0x1f4;return function(_0x2ac27d){logger['error'](_0x2ac27d[_0x92e5('0x2e')]);if(_0x2ac27d[_0x92e5('0x2f')]){delete _0x2ac27d[_0x92e5('0x2f')];}_0x5a7c3a['status'](_0x30e7be)[_0x92e5('0x30')](_0x2ac27d);};}exports[_0x92e5('0x31')]=function(_0x1ca7af,_0x323b75){var _0x39ed38={},_0x441be9={},_0x514275={'count':0x0,'rows':[]};var _0x400c39=_[_0x92e5('0x32')](db['Plugin'][_0x92e5('0x33')],function(_0x2eaee3){return{'name':_0x2eaee3[_0x92e5('0x34')],'type':_0x2eaee3[_0x92e5('0x35')][_0x92e5('0x36')]};});_0x441be9[_0x92e5('0x37')]=_[_0x92e5('0x32')](_0x400c39,_0x92e5('0x2f'));_0x441be9[_0x92e5('0x38')]=_[_0x92e5('0x39')](_0x1ca7af['query']);_0x441be9[_0x92e5('0x3a')]=_[_0x92e5('0x3b')](_0x441be9[_0x92e5('0x37')],_0x441be9['query']);_0x39ed38[_0x92e5('0x3c')]=_[_0x92e5('0x3b')](_0x441be9[_0x92e5('0x37')],qs[_0x92e5('0x3d')](_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x3d')]));_0x39ed38[_0x92e5('0x3c')]=_0x39ed38[_0x92e5('0x3c')]['length']?_0x39ed38[_0x92e5('0x3c')]:_0x441be9[_0x92e5('0x37')];if(!_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x3e')](_0x92e5('0x3f'))){_0x39ed38[_0x92e5('0x22')]=qs['limit'](_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x22')]);_0x39ed38[_0x92e5('0x20')]=qs['offset'](_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x20')]);}_0x39ed38[_0x92e5('0x40')]=qs[_0x92e5('0x41')](_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x41')]);_0x39ed38[_0x92e5('0x42')]=qs[_0x92e5('0x3a')](_[_0x92e5('0x43')](_0x1ca7af[_0x92e5('0x38')],_0x441be9['filters']),_0x400c39);if(_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x44')]){_0x39ed38[_0x92e5('0x42')]=_[_0x92e5('0x45')](_0x39ed38['where'],{'$or':_[_0x92e5('0x32')](_0x400c39,function(_0x3892ba){if(_0x3892ba['type']!==_0x92e5('0x46')){var _0x4b17cc={};_0x4b17cc[_0x3892ba[_0x92e5('0x2f')]]={'$like':'%'+_0x1ca7af['query']['filter']+'%'};return _0x4b17cc;}})});}_0x39ed38=_[_0x92e5('0x45')]({},_0x39ed38,_0x1ca7af['options']);var _0x1b368c={'where':_0x39ed38[_0x92e5('0x42')]};return db[_0x92e5('0x47')][_0x92e5('0x23')](_0x1b368c)[_0x92e5('0x29')](function(_0x572c6b){_0x514275['count']=_0x572c6b;if(_0x1ca7af[_0x92e5('0x38')][_0x92e5('0x48')]){_0x39ed38['include']=[{'all':!![]}];}return db[_0x92e5('0x47')][_0x92e5('0x49')](_0x39ed38);})[_0x92e5('0x29')](function(_0x385d94){_0x514275[_0x92e5('0x4a')]=_0x385d94;return _0x514275;})[_0x92e5('0x29')](respondWithFilteredResult(_0x323b75,_0x39ed38))[_0x92e5('0x4b')](handleError(_0x323b75,null));};exports[_0x92e5('0x4c')]=function(_0x882c04,_0xeef00d){var _0x2caf19={'raw':!![],'where':{'id':_0x882c04[_0x92e5('0x4d')]['id']}},_0x3af030={};_0x3af030[_0x92e5('0x37')]=_[_0x92e5('0x39')](db['Plugin'][_0x92e5('0x33')]);_0x3af030[_0x92e5('0x38')]=_[_0x92e5('0x39')](_0x882c04[_0x92e5('0x38')]);_0x3af030[_0x92e5('0x3a')]=_['intersection'](_0x3af030[_0x92e5('0x37')],_0x3af030['query']);_0x2caf19[_0x92e5('0x3c')]=_['intersection'](_0x3af030[_0x92e5('0x37')],qs[_0x92e5('0x3d')](_0x882c04['query'][_0x92e5('0x3d')]));_0x2caf19['attributes']=_0x2caf19[_0x92e5('0x3c')]['length']?_0x2caf19['attributes']:_0x3af030[_0x92e5('0x37')];if(_0x882c04[_0x92e5('0x38')][_0x92e5('0x48')]){_0x2caf19[_0x92e5('0x4e')]=[{'all':!![]}];}_0x2caf19=_[_0x92e5('0x45')]({},_0x2caf19,_0x882c04[_0x92e5('0x4f')]);return db['Plugin']['find'](_0x2caf19)[_0x92e5('0x29')](handleEntityNotFound(_0xeef00d,null))['then'](respondWithResult(_0xeef00d,null))['catch'](handleError(_0xeef00d,null));};exports['download']=function(_0x233081,_0x4a5c08,_0x4335f1){return db[_0x92e5('0x47')][_0x92e5('0x50')]({'where':{'id':_0x233081[_0x92e5('0x4d')]['id']},'attributes':['name',_0x92e5('0x6')],'raw':!![]})[_0x92e5('0x29')](handleEntityNotFound(_0x4a5c08,null))[_0x92e5('0x29')](function(_0x572db5){if(_0x572db5){var _0x20b021=path[_0x92e5('0x51')](config['root'],_0x92e5('0x52'),util[_0x92e5('0x53')](_0x92e5('0x54'),path[_0x92e5('0x55')](_0x572db5['path'])));var _0x53456f=fs[_0x92e5('0x56')](_0x20b021);var _0x14ce2a=archiver(_0x92e5('0x57'),{'zlib':{'level':0x9}});_0x14ce2a['on'](_0x92e5('0x58'),function(_0x3b7bb2){if(_0x3b7bb2[_0x92e5('0x59')]==='ENOENT'){logger[_0x92e5('0x5a')](_0x3b7bb2);}else{throw new db[(_0x92e5('0x5b'))]['Error'](_0x92e5('0x5c'));}});_0x14ce2a['on'](_0x92e5('0x5a'),function(_0xc7e9c7){throw new db[(_0x92e5('0x5b'))]['Error'](_0x92e5('0x5c'));});_0x14ce2a['pipe'](_0x53456f);_0x14ce2a['glob'](_0x92e5('0x5d'),{'cwd':path[_0x92e5('0x51')](config[_0x92e5('0x5e')],_0x92e5('0x52'),path[_0x92e5('0x5f')](_0x572db5[_0x92e5('0x6')])),'ignore':[path[_0x92e5('0x51')](path[_0x92e5('0x55')](_0x572db5[_0x92e5('0x6')]),_0x92e5('0x60')),path[_0x92e5('0x51')](path['basename'](_0x572db5[_0x92e5('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x92e5('0x61')]();_0x53456f['on'](_0x92e5('0x62'),function(){if(!fs[_0x92e5('0x63')](_0x20b021)){throw new db[(_0x92e5('0x5b'))][(_0x92e5('0x64'))](_0x92e5('0x65'));}return _0x4a5c08['download'](_0x20b021,util[_0x92e5('0x53')]('%s.zip',path[_0x92e5('0x55')](_0x572db5[_0x92e5('0x6')])),function(_0x321669){if(_0x321669){throw new db[(_0x92e5('0x5b'))][(_0x92e5('0x64'))](_0x92e5('0x66'));}fs[_0x92e5('0x67')](_0x20b021);logger[_0x92e5('0x68')]('Download\x20completed');logger[_0x92e5('0x68')](_0x92e5('0x69'));});});}return null;})[_0x92e5('0x4b')](handleError(_0x4a5c08,null));};exports[_0x92e5('0x6a')]=function(_0x205445,_0x5c4bae,_0x48a8c1){var _0xeaa206=path[_0x92e5('0x55')](_0x205445[_0x92e5('0x6b')][_0x92e5('0x6c')],path[_0x92e5('0x6d')](_0x205445[_0x92e5('0x6b')][_0x92e5('0x6c')]));var _0x4fef36=path[_0x92e5('0x51')](config['root'],_0x92e5('0x52'),_0x205445[_0x92e5('0x6b')][_0x92e5('0x6c')]);var _0x460cbe=path[_0x92e5('0x51')](config[_0x92e5('0x5e')],_0x92e5('0x52'),_0xeaa206);logger[_0x92e5('0x68')](_0x92e5('0x6e'),_0x4fef36);logger['info'](_0x92e5('0x6f'),_0x460cbe);try{fs[_0x92e5('0x70')](_0x4fef36,parseInt(_0x92e5('0x71'),0x8));extract(_0x4fef36,{'dir':_0x460cbe},function(_0x1235d2){if(_0x1235d2){logger[_0x92e5('0x5a')](_0x1235d2);handleError(_0x1235d2,!![]);};var _0x20a418=fs['readdirSync'](_0x460cbe);if(_0x20a418['length']>0x1){removeReferences(_0x4fef36,_0x460cbe);logger['error']('Invalid\x20plugin\x20structure');return _0x48a8c1(new Error(_0x92e5('0x72')));}var _0x4d8496=fs['lstatSync'](path[_0x92e5('0x51')](_0x460cbe,_0x20a418[0x0]));if(_0x4d8496[_0x92e5('0x73')]()){removeReferences(_0x4fef36,_0x460cbe);logger[_0x92e5('0x5a')](_0x92e5('0x72'));return _0x48a8c1(new Error(_0x92e5('0x72')));}if(_0x4d8496[_0x92e5('0x74')]()){var _0x5671ff=fs[_0x92e5('0x75')](path['join'](_0x460cbe,_0x20a418[0x0]));if(_0x5671ff[_0x92e5('0x76')]===0x0){removeReferences(_0x4fef36,_0x460cbe);logger[_0x92e5('0x5a')](_0x92e5('0x72'));return _0x48a8c1(new Error(_0x92e5('0x72')));}var _0x4239a7=_0x5671ff[_0x92e5('0x77')](function(_0x19e874){return _0x19e874==='manifest.json';});if(!_0x4239a7){return _0x48a8c1(new Error(_0x92e5('0x78')));}var _0x3491f8=fs['readFileSync'](path[_0x92e5('0x51')](_0x460cbe,_0x20a418[0x0],_0x92e5('0x79')));var _0x54f080=JSON[_0x92e5('0x7a')](_0x3491f8);if(_0x92e5('0x21')==typeof _0x54f080['name']){return _0x48a8c1(new Error(_0x92e5('0x7b')));}if(_0x92e5('0x21')==typeof _0x54f080[_0x92e5('0x35')]){return _0x48a8c1(new Error(_0x92e5('0x7c')));}if(_0x92e5('0x21')==typeof _0x54f080[_0x92e5('0x7d')]){return _0x48a8c1(new Error(_0x92e5('0x7e')));}if(_0x92e5('0x21')==typeof _0x54f080[_0x92e5('0x7f')]){return _0x48a8c1(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x54f080[_0x92e5('0x35')]==='html'){if('undefined'==typeof _0x54f080[_0x92e5('0x7f')]['views']){return _0x48a8c1(new Error(_0x92e5('0x80')));}if('undefined'==typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x81')][_0x92e5('0x82')]&&_0x92e5('0x21')==typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x81')][_0x92e5('0x83')]){return _0x48a8c1(new Error(_0x92e5('0x84')));}}else if(_0x54f080[_0x92e5('0x35')]===_0x92e5('0x85')){if(_0x92e5('0x21')==typeof _0x54f080['parameters']['scriptName']){return _0x48a8c1(new Error(_0x92e5('0x86')));}if(_0x92e5('0x21')==typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x87')]){return _0x48a8c1(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x48a8c1(new Error(_0x92e5('0x88')));}var _0x2416a2=_0x54f080[_0x92e5('0x2f')];var _0x54c82e=_0x54f080[_0x92e5('0x89')];var _0x1402d4=_0x54f080['type'];var _0x1f57ab=_0x54f080['sidebar']?_0x54f080[_0x92e5('0x8a')]:_0x92e5('0x8b');var _0x34b528=_0x54f080[_0x92e5('0x8c')]?_0x54f080['icon']:_0x92e5('0x8d');var _0x32c106='';var _0x5749f0='';var _0x277df5='';var _0x3dac01='';var _0x9fcdc4=_0x54f080[_0x92e5('0x7d')];if(_0x1402d4==='html'){if('undefined'!=typeof _0x54f080[_0x92e5('0x7f')]['views'][_0x92e5('0x82')]){var _0x33f0e9=_0x54f080['parameters'][_0x92e5('0x81')][_0x92e5('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x92e5('0x8e')](_0x33f0e9)){_0x32c106=path[_0x92e5('0x51')](_0x92e5('0x8f'),_0xeaa206,_0x20a418[0x0],_0x33f0e9);}else{_0x32c106=_0x33f0e9;}}else{logger[_0x92e5('0x68')](_0x92e5('0x90'));}if(_0x92e5('0x21')!=typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x81')][_0x92e5('0x83')]){var _0x1846f8=_0x54f080['parameters']['views'][_0x92e5('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x92e5('0x8e')](_0x1846f8)){_0x5749f0=path['join'](_0x92e5('0x8f'),_0xeaa206,_0x20a418[0x0],_0x1846f8);}else{_0x5749f0=_0x1846f8;}}else{logger['info'](_0x92e5('0x91'));}}else if(_0x1402d4==='script'){_0x277df5=_0x54f080[_0x92e5('0x7f')]['scriptName'];_0x3dac01=_0x54f080[_0x92e5('0x7f')][_0x92e5('0x87')];if(_0x92e5('0x21')!=typeof _0x54f080[_0x92e5('0x7f')]['views']){if(_0x92e5('0x21')!=typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x81')][_0x92e5('0x82')]){var _0x33f0e9=_0x54f080['parameters']['views'][_0x92e5('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x92e5('0x8e')](_0x33f0e9)){_0x32c106=path[_0x92e5('0x51')](_0x92e5('0x8f'),_0xeaa206,_0x20a418[0x0],_0x33f0e9);}else{_0x32c106=_0x33f0e9;}}if(_0x92e5('0x21')!=typeof _0x54f080[_0x92e5('0x7f')][_0x92e5('0x81')][_0x92e5('0x83')]){var _0x1846f8=_0x54f080['parameters'][_0x92e5('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x92e5('0x8e')](_0x1846f8)){_0x5749f0=path[_0x92e5('0x51')](_0x92e5('0x8f'),_0xeaa206,_0x20a418[0x0],_0x1846f8);}else{_0x5749f0=_0x1846f8;}}}}var _0x36c258={'name':_0x2416a2,'description':_0x54c82e,'path':path[_0x92e5('0x51')](_0xeaa206,_0x20a418[0x0]),'type':_0x1402d4,'sidebar':_0x1f57ab,'icon':_0x34b528,'adminUrl':_0x32c106,'agentUrl':_0x5749f0,'scriptName':_0x277df5,'scriptPath':_0x3dac01,'version':_0x9fcdc4};removeReferences(_0x4fef36,null);return db[_0x92e5('0x47')][_0x92e5('0x92')](_0x36c258)[_0x92e5('0x29')](function(_0x310462){var _0x2bd15b={'role':_0x205445[_0x92e5('0x93')][_0x92e5('0x94')],'userProfileId':_0x205445[_0x92e5('0x93')][_0x92e5('0x95')]};if(!_0x2bd15b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd15b[_0x92e5('0x94')]===_0x92e5('0x96')){var _0x3428e8=_0x310462['get']({'plain':!![]});return db[_0x92e5('0x97')]['find']({'where':{'name':_0x92e5('0x2b'),'userProfileId':_0x2bd15b[_0x92e5('0x95')]},'raw':!![]})[_0x92e5('0x29')](function(_0x56f786){if(_0x56f786&&_0x56f786[_0x92e5('0x98')]===0x0){return db[_0x92e5('0x2c')][_0x92e5('0x92')]({'name':_0x3428e8[_0x92e5('0x2f')],'resourceId':_0x3428e8['id'],'type':_0x56f786[_0x92e5('0x2f')],'sectionId':_0x56f786['id']},{})[_0x92e5('0x29')](function(){return _0x310462;});}else{return _0x310462;}})[_0x92e5('0x4b')](function(_0x5e3c56){logger[_0x92e5('0x5a')](_0x92e5('0x99'),_0x5e3c56);throw _0x5e3c56;});}return _0x310462;})[_0x92e5('0x29')](respondWithResult(_0x5c4bae,null))[_0x92e5('0x4b')](handleError(_0x5c4bae,null));}});}catch(_0x4680ce){_0x5c4bae[_0x92e5('0x1d')](0x1f4)[_0x92e5('0x30')](_0x4680ce);}};function removeReferences(_0x2253e2,_0x19ccbf){try{if(_0x2253e2){fs['unlinkSync'](_0x2253e2);logger[_0x92e5('0x68')](_0x92e5('0x9a'));}if(_0x19ccbf){rimraf(_0x19ccbf,function(){});logger[_0x92e5('0x68')](_0x92e5('0x9b'));}}catch(_0x9f20ab){logger[_0x92e5('0x5a')](_0x9f20ab);}}exports['update']=function(_0x500fb6,_0x3f01bf,_0x4437c7){return db[_0x92e5('0x47')][_0x92e5('0x50')]({'where':{'id':_0x500fb6[_0x92e5('0x4d')]['id']}})[_0x92e5('0x29')](handleEntityNotFound(_0x3f01bf,null))[_0x92e5('0x29')](saveUpdates(_0x500fb6[_0x92e5('0x93')],null))[_0x92e5('0x29')](respondWithResult(_0x3f01bf,null))[_0x92e5('0x4b')](handleError(_0x3f01bf,null));};exports[_0x92e5('0x9c')]=function(_0x244c8f,_0x1946ca,_0x3761b1){return db[_0x92e5('0x47')][_0x92e5('0x50')]({'where':{'id':_0x244c8f[_0x92e5('0x4d')]['id']}})[_0x92e5('0x29')](function(_0x31cd1b){if(_0x31cd1b){return _0x31cd1b[_0x92e5('0x2d')]();}})[_0x92e5('0x29')](function(_0xa7a32a){rimraf(path[_0x92e5('0x51')](config['root'],_0x92e5('0x52'),path[_0x92e5('0x5f')](_0xa7a32a['path'])),function(){});return _0xa7a32a;})['then'](handleEntityNotFound(_0x1946ca,null))['then'](respondWithStatusCode(_0x1946ca,null))[_0x92e5('0x4b')](handleError(_0x1946ca,null));};exports[_0x92e5('0x9d')]=function(_0x4fef6e,_0x4e6a24,_0x176a37){return BPromise[_0x92e5('0x9e')]()[_0x92e5('0x29')](function(){if(!_0x4fef6e['query'][_0x92e5('0x6')]){throw new Error(_0x92e5('0x9f'));}if(!_0x4fef6e['query']['port']){throw new Error(_0x92e5('0xa0'));}var _0x4a1c4b=_0x4fef6e[_0x92e5('0x38')][_0x92e5('0xa1')]?_0x4fef6e[_0x92e5('0x38')][_0x92e5('0xa1')]+':'+_0x4fef6e['query']['port']:_0x92e5('0xa2')+_0x4fef6e[_0x92e5('0x38')][_0x92e5('0xa3')];var _0x5c9c61=_0x4fef6e[_0x92e5('0x38')][_0x92e5('0x1f')]?_0x4fef6e[_0x92e5('0x38')][_0x92e5('0x1f')]:!![];var _0x49f503=_0x4fef6e[_0x92e5('0x38')]['encoding']?_0x4fef6e[_0x92e5('0x38')][_0x92e5('0xa4')]:null;var _0x4cd170={'method':_0x4fef6e[_0x92e5('0xa5')],'uri':util[_0x92e5('0x53')](_0x92e5('0xa6'),_0x4a1c4b,_0x4fef6e['query'][_0x92e5('0x6')]),'json':_0x5c9c61,'resolveWithFullResponse':!![],'encoding':_0x49f503,'qs':_0x4fef6e[_0x92e5('0x38')]};if(_0x4fef6e['headers']){_0x4cd170[_0x92e5('0xa7')]=_0x4fef6e[_0x92e5('0xa7')];if(_0x4cd170['headers'][_0x92e5('0xa8')]){delete _0x4cd170[_0x92e5('0xa7')]['content-length'];}}if(_0x4cd170[_0x92e5('0xa7')][_0x92e5('0xa9')]){delete _0x4cd170[_0x92e5('0xa7')]['content-type'];}return rp(_0x4cd170);})[_0x92e5('0x29')](function(_0x4432c7){if(_0x4432c7){_0x4e6a24['set'](_0x4432c7['headers']);logger[_0x92e5('0x68')](_0x4432c7[_0x92e5('0x93')]);if(_['endsWith'](_0x4fef6e[_0x92e5('0x38')][_0x92e5('0x6')],_0x92e5('0xaa'))&&_0x4432c7['statusCode']==0x1f4){return _0x4e6a24[_0x92e5('0x1c')](_0x4432c7[_0x92e5('0xab')]);}else{return _0x4e6a24[_0x92e5('0x1d')](_0x4432c7['statusCode'])[_0x92e5('0x30')](_0x4432c7[_0x92e5('0x93')]);}}else{return _0x4e6a24[_0x92e5('0x1c')](0xc8);}})[_0x92e5('0x4b')](handleError(_0x4e6a24,null));};exports[_0x92e5('0xac')]=function(_0x2db1d1,_0x244253,_0x249fba){return BPromise[_0x92e5('0x9e')]()[_0x92e5('0x29')](function(){if(!_0x2db1d1[_0x92e5('0x38')]['path']){throw new Error(_0x92e5('0x9f'));}if(!_0x2db1d1['query'][_0x92e5('0xa3')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a82b2=_0x2db1d1['query'][_0x92e5('0xa1')]?_0x2db1d1['query'][_0x92e5('0xa1')]+':'+_0x2db1d1[_0x92e5('0x38')][_0x92e5('0xa3')]:_0x92e5('0xa2')+_0x2db1d1[_0x92e5('0x38')][_0x92e5('0xa3')];var _0x48164c=_0x2db1d1[_0x92e5('0x38')]['json']?_0x2db1d1[_0x92e5('0x38')][_0x92e5('0x1f')]:!![];var _0x3079bb=_0x2db1d1[_0x92e5('0x38')][_0x92e5('0xa4')]?_0x2db1d1['query'][_0x92e5('0xa4')]:null;var _0x48fd0d={'method':_0x2db1d1[_0x92e5('0xa5')],'uri':util[_0x92e5('0x53')]('%s%s',_0x5a82b2,_0x2db1d1[_0x92e5('0x38')][_0x92e5('0x6')]),'json':_0x48164c,'resolveWithFullResponse':!![],'encoding':_0x3079bb,'body':_0x2db1d1[_0x92e5('0x93')]};if(_0x2db1d1[_0x92e5('0xa7')]){_0x48fd0d[_0x92e5('0xa7')]=_0x2db1d1['headers'];if(_0x48fd0d['headers'][_0x92e5('0xa8')]){delete _0x48fd0d['headers'][_0x92e5('0xa8')];}}if(_0x48fd0d[_0x92e5('0xa7')][_0x92e5('0xa9')]){delete _0x48fd0d[_0x92e5('0xa7')][_0x92e5('0xa9')];}return rp(_0x48fd0d);})['then'](function(_0x2bf45f){if(_0x2bf45f){_0x244253[_0x92e5('0x24')](_0x2bf45f[_0x92e5('0xa7')]);logger[_0x92e5('0x68')](_0x2bf45f[_0x92e5('0x93')]);return _0x244253[_0x92e5('0x1d')](_0x2bf45f[_0x92e5('0xab')])[_0x92e5('0x30')](_0x2bf45f[_0x92e5('0x93')]);}else{return _0x244253[_0x92e5('0x1c')](0xc8);}})[_0x92e5('0x4b')](handleError(_0x244253,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4c8910a..809ed16 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 _0x5655=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x38d105,_0x11b3f2){var _0xb1e4e2=function(_0x5c532e){while(--_0x5c532e){_0x38d105['push'](_0x38d105['shift']());}};_0xb1e4e2(++_0x11b3f2);}(_0x5655,0x15e));var _0x5565=function(_0x20a8e1,_0x4be9a8){_0x20a8e1=_0x20a8e1-0x0;var _0x589cfd=_0x5655[_0x20a8e1];return _0x589cfd;};'use strict';var EventEmitter=require(_0x5565('0x0'));var Plugin=require(_0x5565('0x1'))['db'][_0x5565('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5565('0x3')](0x0);var events={'afterCreate':_0x5565('0x4'),'afterUpdate':_0x5565('0x5'),'afterDestroy':'remove'};function emitEvent(_0x480b69){return function(_0x307c01,_0x58e4f5,_0x247aa3){PluginEvents[_0x5565('0x6')](_0x480b69+':'+_0x307c01['id'],_0x307c01);PluginEvents[_0x5565('0x6')](_0x480b69,_0x307c01);_0x247aa3(null);};}for(var e in events){if(events[_0x5565('0x7')](e)){var event=events[e];Plugin[_0x5565('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5b20=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x23bc1f,_0x1a44cd){var _0x435db5=function(_0x2f0337){while(--_0x2f0337){_0x23bc1f['push'](_0x23bc1f['shift']());}};_0x435db5(++_0x1a44cd);}(_0x5b20,0x86));var _0x05b2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5b20[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x05b2('0x0'));var Plugin=require(_0x05b2('0x1'))['db'][_0x05b2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x05b2('0x3')](0x0);var events={'afterCreate':_0x05b2('0x4'),'afterUpdate':_0x05b2('0x5'),'afterDestroy':_0x05b2('0x6')};function emitEvent(_0x7d6d53){return function(_0x19cb65,_0x1d9490,_0x1d5270){PluginEvents['emit'](_0x7d6d53+':'+_0x19cb65['id'],_0x19cb65);PluginEvents[_0x05b2('0x7')](_0x7d6d53,_0x19cb65);_0x1d5270(null);};}for(var e in events){if(events[_0x05b2('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x05b2('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a276185..0ca74ba 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 _0xeac6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger'];(function(_0x108126,_0x54af88){var _0x33bb4c=function(_0x2d229d){while(--_0x2d229d){_0x108126['push'](_0x108126['shift']());}};_0x33bb4c(++_0x54af88);}(_0xeac6,0xc0));var _0x6eac=function(_0x165001,_0x5b4c14){_0x165001=_0x165001-0x0;var _0x3d0acd=_0xeac6[_0x165001];return _0x3d0acd;};'use strict';var _=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var logger=require(_0x6eac('0x2'))('api');var moment=require(_0x6eac('0x3'));var BPromise=require(_0x6eac('0x4'));var rp=require(_0x6eac('0x5'));var fs=require('fs');var path=require(_0x6eac('0x6'));var rimraf=require(_0x6eac('0x7'));var config=require(_0x6eac('0x8'));var attributes=require(_0x6eac('0x9'));module[_0x6eac('0xa')]=function(_0xebef33,_0x429b19){return _0xebef33[_0x6eac('0xb')](_0x6eac('0xc'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f1=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x2d7867,_0x9db5fd){var _0x13d030=function(_0x2a6637){while(--_0x2a6637){_0x2d7867['push'](_0x2d7867['shift']());}};_0x13d030(++_0x9db5fd);}(_0xb2f1,0x115));var _0x1b2f=function(_0x471833,_0x1e5706){_0x471833=_0x471833-0x0;var _0x20cdf4=_0xb2f1[_0x471833];return _0x20cdf4;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require(_0x1b2f('0x2'))(_0x1b2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require(_0x1b2f('0x6'));var config=require(_0x1b2f('0x7'));var attributes=require(_0x1b2f('0x8'));module[_0x1b2f('0x9')]=function(_0x7425f9,_0x37f00c){return _0x7425f9[_0x1b2f('0xa')](_0x1b2f('0xb'),attributes,{'tableName':_0x1b2f('0xc'),'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 8443497..24c18fb 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 _0x34f6=['error','code','message','info','result','catch','CreatePlugin','Plugin','create','options','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2146bf,_0x2085ab){var _0x2cbb04=function(_0x278cc8){while(--_0x278cc8){_0x2146bf['push'](_0x2146bf['shift']());}};_0x2cbb04(++_0x2085ab);}(_0x34f6,0x8e));var _0x634f=function(_0x4fbae4,_0x35f842){_0x4fbae4=_0x4fbae4-0x0;var _0x1a291b=_0x34f6[_0x4fbae4];return _0x1a291b;};'use strict';var _=require(_0x634f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x634f('0x1'));var rs=require(_0x634f('0x2'));var fs=require('fs');var Redis=require(_0x634f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x634f('0x4'));var logger=require(_0x634f('0x5'))(_0x634f('0x6'));var config=require('../../config/environment');var jayson=require(_0x634f('0x7'));var client=jayson[_0x634f('0x8')][_0x634f('0x9')]({'port':0x232a});config[_0x634f('0xa')]=_[_0x634f('0xb')](config[_0x634f('0xa')],{'host':_0x634f('0xc'),'port':0x18eb});var socket=require(_0x634f('0xd'))(new Redis(config[_0x634f('0xa')]));require(_0x634f('0xe'))[_0x634f('0xf')](socket);function respondWithRpcPromise(_0x1ebb19,_0x5a3b0d,_0x4979fe){return new BPromise(function(_0x53250d,_0x465c46){return client[_0x634f('0x10')](_0x1ebb19,_0x4979fe)[_0x634f('0x11')](function(_0x17c3b8){logger['info'](_0x634f('0x12'),_0x5a3b0d,_0x634f('0x13'));logger[_0x634f('0x14')](_0x634f('0x15'),_0x5a3b0d,_0x634f('0x13'),JSON[_0x634f('0x16')](_0x17c3b8));if(_0x17c3b8[_0x634f('0x17')]){if(_0x17c3b8[_0x634f('0x17')][_0x634f('0x18')]===0x1f4){logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x17c3b8[_0x634f('0x17')][_0x634f('0x19')]);return _0x465c46(_0x17c3b8['error'][_0x634f('0x19')]);}logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x17c3b8[_0x634f('0x17')][_0x634f('0x19')]);return _0x53250d(_0x17c3b8['error']['message']);}else{logger[_0x634f('0x1a')](_0x634f('0x12'),_0x5a3b0d,_0x634f('0x13'));_0x53250d(_0x17c3b8[_0x634f('0x1b')][_0x634f('0x19')]);}})[_0x634f('0x1c')](function(_0x40a59d){logger[_0x634f('0x17')](_0x634f('0x12'),_0x5a3b0d,_0x40a59d);_0x465c46(_0x40a59d);});});}exports[_0x634f('0x1d')]=function(_0x427d53){var _0x2c08e4=this;return new Promise(function(_0x85de5a,_0x4648c9){return db[_0x634f('0x1e')][_0x634f('0x1f')](_0x427d53['body'],{'raw':_0x427d53[_0x634f('0x20')]?_0x427d53['options']['raw']===undefined?!![]:![]:!![]})[_0x634f('0x11')](function(_0xf0698a){logger[_0x634f('0x1a')](_0x634f('0x1d'),_0x427d53);logger['debug'](_0x634f('0x1d'),_0x427d53,JSON[_0x634f('0x16')](_0xf0698a));_0x85de5a(_0xf0698a);})[_0x634f('0x1c')](function(_0x24857c){logger[_0x634f('0x17')]('CreatePlugin',_0x24857c[_0x634f('0x19')],_0x427d53);_0x4648c9(_0x2c08e4[_0x634f('0x17')](0x1f4,_0x24857c[_0x634f('0x19')]));});});}; \ No newline at end of file +var _0x20ba=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin','create','options','raw','debug','catch'];(function(_0x2ca9f7,_0x30abfc){var _0x5af256=function(_0x16a7f9){while(--_0x16a7f9){_0x2ca9f7['push'](_0x2ca9f7['shift']());}};_0x5af256(++_0x30abfc);}(_0x20ba,0x1a4));var _0xa20b=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0x20ba[_0x1709e7];return _0x402819;};'use strict';var _=require(_0xa20b('0x0'));var util=require(_0xa20b('0x1'));var moment=require('moment');var BPromise=require(_0xa20b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa20b('0x3'));var db=require(_0xa20b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa20b('0x5'))(_0xa20b('0x6'));var config=require(_0xa20b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa20b('0x8')]['http']({'port':0x232a});config[_0xa20b('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa20b('0xa'))(new Redis(config[_0xa20b('0x9')]));require(_0xa20b('0xb'))['register'](socket);function respondWithRpcPromise(_0x16e712,_0x506e6b,_0x80980c){return new BPromise(function(_0x4a7210,_0x83b088){return client[_0xa20b('0xc')](_0x16e712,_0x80980c)[_0xa20b('0xd')](function(_0x156601){logger[_0xa20b('0xe')](_0xa20b('0xf'),_0x506e6b,_0xa20b('0x10'));logger['debug'](_0xa20b('0x11'),_0x506e6b,_0xa20b('0x10'),JSON[_0xa20b('0x12')](_0x156601));if(_0x156601[_0xa20b('0x13')]){if(_0x156601[_0xa20b('0x13')][_0xa20b('0x14')]===0x1f4){logger['error'](_0xa20b('0xf'),_0x506e6b,_0x156601['error'][_0xa20b('0x15')]);return _0x83b088(_0x156601[_0xa20b('0x13')][_0xa20b('0x15')]);}logger[_0xa20b('0x13')](_0xa20b('0xf'),_0x506e6b,_0x156601[_0xa20b('0x13')]['message']);return _0x4a7210(_0x156601[_0xa20b('0x13')][_0xa20b('0x15')]);}else{logger[_0xa20b('0xe')](_0xa20b('0xf'),_0x506e6b,'request\x20sent');_0x4a7210(_0x156601[_0xa20b('0x16')][_0xa20b('0x15')]);}})['catch'](function(_0x37d3ba){logger[_0xa20b('0x13')](_0xa20b('0xf'),_0x506e6b,_0x37d3ba);_0x83b088(_0x37d3ba);});});}exports[_0xa20b('0x17')]=function(_0x3b39dd){var _0x53fc3d=this;return new Promise(function(_0x2cf00d,_0x2ad6f9){return db[_0xa20b('0x18')][_0xa20b('0x19')](_0x3b39dd['body'],{'raw':_0x3b39dd[_0xa20b('0x1a')]?_0x3b39dd[_0xa20b('0x1a')][_0xa20b('0x1b')]===undefined?!![]:![]:!![]})[_0xa20b('0xd')](function(_0x205fb2){logger[_0xa20b('0xe')](_0xa20b('0x17'),_0x3b39dd);logger[_0xa20b('0x1c')](_0xa20b('0x17'),_0x3b39dd,JSON[_0xa20b('0x12')](_0x205fb2));_0x2cf00d(_0x205fb2);})[_0xa20b('0x1d')](function(_0x138de6){logger[_0xa20b('0x13')]('CreatePlugin',_0x138de6[_0xa20b('0x15')],_0x3b39dd);_0x2ad6f9(_0x53fc3d[_0xa20b('0x13')](0x1f4,_0x138de6['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f8560ea..74d8919 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 _0x546e=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x26404d,_0xdab8ab){var _0x40eaa8=function(_0x4dc899){while(--_0x4dc899){_0x26404d['push'](_0x26404d['shift']());}};_0x40eaa8(++_0xdab8ab);}(_0x546e,0x160));var _0xe546=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x546e[_0x1b828b];return _0x98da1a;};'use strict';var PluginEvents=require(_0xe546('0x0'));var events=[_0xe546('0x1'),_0xe546('0x2'),_0xe546('0x3')];function createListener(_0x5dc385,_0x2bb36e){return function(_0x4106b2){_0x2bb36e[_0xe546('0x4')](_0x5dc385,_0x4106b2);};}function removeListener(_0x58b2d8,_0x1d8aaf){return function(){PluginEvents[_0xe546('0x5')](_0x58b2d8,_0x1d8aaf);};}exports[_0xe546('0x6')]=function(_0xb03715){for(var _0x25e31c=0x0,_0x20df31=events[_0xe546('0x7')];_0x25e31c<_0x20df31;_0x25e31c++){var _0x4ec517=events[_0x25e31c];var _0x1cfdf8=createListener(_0xe546('0x8')+_0x4ec517,_0xb03715);PluginEvents['on'](_0x4ec517,_0x1cfdf8);}}; \ No newline at end of file +var _0xc358=['remove','update','emit','removeListener','register','./plugin.events','save'];(function(_0x50710d,_0x169a0f){var _0x36c5d2=function(_0x3acd0d){while(--_0x3acd0d){_0x50710d['push'](_0x50710d['shift']());}};_0x36c5d2(++_0x169a0f);}(_0xc358,0x108));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x8c35('0x0'));var events=[_0x8c35('0x1'),_0x8c35('0x2'),_0x8c35('0x3')];function createListener(_0x142fa2,_0x1fc6c2){return function(_0x3df0a8){_0x1fc6c2[_0x8c35('0x4')](_0x142fa2,_0x3df0a8);};}function removeListener(_0x13ec32,_0x1f0ba2){return function(){PluginEvents[_0x8c35('0x5')](_0x13ec32,_0x1f0ba2);};}exports[_0x8c35('0x6')]=function(_0xe37c50){for(var _0x57ed53=0x0,_0x2bc1c3=events['length'];_0x57ed53<_0x2bc1c3;_0x57ed53++){var _0x31f5f0=events[_0x57ed53];var _0x56e1d3=createListener('plugin:'+_0x31f5f0,_0xe37c50);PluginEvents['on'](_0x31f5f0,_0x56e1d3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6a333a2..674fada 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x227542,_0x1e5faf){var _0x400ef9=function(_0x7e57e5){while(--_0x7e57e5){_0x227542['push'](_0x227542['shift']());}};_0x400ef9(++_0x1e5faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0xfc3f97,_0x569c0a){var _0x4b0e1d=function(_0x43ce28){while(--_0x43ce28){_0xfc3f97['push'](_0xfc3f97['shift']());}};_0x4b0e1d(++_0x569c0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index e804b16..422dc5b 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 _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xde2c,0x7f));var _0xcde2=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xde2c[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file +var _0x6f0d=['../../files/plugins','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','send','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','bluebird','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','script'];(function(_0x206c93,_0x52dc4a){var _0x502819=function(_0x1cd0cc){while(--_0x1cd0cc){_0x206c93['push'](_0x206c93['shift']());}};_0x502819(++_0x52dc4a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x362d01,_0x444331){_0x362d01=_0x362d01-0x0;var _0xf352f1=_0x6f0d[_0x362d01];return _0xf352f1;};'use strict';var _=require('lodash');var pm2=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var path=require(_0xd6f0('0x3'));var exec=require('child_process')[_0xd6f0('0x4')];var BPromise=require(_0xd6f0('0x5'));function handleEntityNotFound(_0x2f78fb,_0x25344b){return function(_0x3a757f){if(!_0x3a757f){_0x2f78fb['sendStatus'](0x194);;}return _0x3a757f;};}function respondWithResult(_0x2d2ce6,_0x4a8b0c){_0x4a8b0c=_0x4a8b0c||0xc8;return function(_0xe21ac4){if(_0xe21ac4){return _0x2d2ce6[_0xd6f0('0x6')](_0x4a8b0c)[_0xd6f0('0x7')](_0xe21ac4);}return null;};}function handleError(_0x1a48a0,_0x4c4916){_0x4c4916=_0x4c4916||0x1f4;return function(_0x507048){logger[_0xd6f0('0x8')](_0x507048[_0xd6f0('0x9')]);if(_0x507048[_0xd6f0('0xa')]){delete _0x507048[_0xd6f0('0xa')];}_0x1a48a0[_0xd6f0('0x6')](_0x4c4916)['send'](_0x507048);};}function execChildProcess(){return new BPromise(function(_0x136eee,_0xee144c){exec(_0xd6f0('0xb'),function(_0x44bba6,_0x4d10a1,_0x1ce8d5){logger[_0xd6f0('0xc')](_0x4d10a1);logger[_0xd6f0('0xc')](_0x1ce8d5);if(_0x44bba6){logger[_0xd6f0('0x8')](_0x44bba6);return _0xee144c(_0x44bba6);}return _0x136eee(_0x4d10a1);});});}exports[_0xd6f0('0xd')]=function(_0x409549,_0x2bf5b8){return pm2[_0xd6f0('0xe')]()[_0xd6f0('0xf')](function(_0x4ab979){if(_0x4ab979){var _0x2b3f32=_[_0xd6f0('0x10')](_0x4ab979,function(_0x4c1559){return _0x4c1559[_0xd6f0('0xa')]==='express'||_0x4c1559[_0xd6f0('0xa')]===_0xd6f0('0x11');});return{'rows':_0x2b3f32,'count':_0x2b3f32[_0xd6f0('0x12')]};}return null;})[_0xd6f0('0xf')](respondWithResult(_0x2bf5b8,null))[_0xd6f0('0x13')](handleError(_0x2bf5b8,null));};exports[_0xd6f0('0x14')]=function(_0x25da0c,_0x29fbb9){return pm2[_0xd6f0('0x15')](_0x25da0c[_0xd6f0('0x16')]['id'])[_0xd6f0('0xf')](respondWithResult(_0x29fbb9,null))[_0xd6f0('0xf')](handleEntityNotFound(_0x29fbb9,null))[_0xd6f0('0x13')](handleError(_0x29fbb9,null));};exports[_0xd6f0('0x17')]=function(_0x1f43d7,_0xde87d4){if(_0x1f43d7['body']['name']&&_0x1f43d7[_0xd6f0('0x18')][_0xd6f0('0x19')]){var _0x1158dc=path['join'](__dirname,_0xd6f0('0x1a'),_0x1f43d7[_0xd6f0('0x18')]['script']);var _0x86dde0=process['cwd']();process[_0xd6f0('0x1b')](path[_0xd6f0('0x1c')](_0x1158dc));return execChildProcess()['then'](function(_0xb9e820){process[_0xd6f0('0x1b')](_0x86dde0);return pm2['start']({'name':_0x1f43d7[_0xd6f0('0x18')][_0xd6f0('0xa')],'script':_0x1158dc});})[_0xd6f0('0xf')](function(_0x5b1a62){pm2[_0xd6f0('0x1d')]();return _0x5b1a62[0x0];})[_0xd6f0('0xf')](respondWithResult(_0xde87d4,0xc9))['catch'](handleError(_0xde87d4,null));}else{return _0xde87d4[_0xd6f0('0x6')](0x1f4)['send']({'message':_0xd6f0('0x1e')});}};exports[_0xd6f0('0x1f')]=function(_0x1630dc,_0x3c1bff){if(_0x1630dc[_0xd6f0('0x18')]['id']){delete _0x1630dc[_0xd6f0('0x18')]['id'];}var _0x12d6ec={'online':_0xd6f0('0x20'),'stopped':'stop'};if(_0x12d6ec[_0xd6f0('0x21')](_0x1630dc[_0xd6f0('0x18')]['status'])){return pm2[_0x12d6ec[_0x1630dc[_0xd6f0('0x18')][_0xd6f0('0x6')]]](_0x1630dc[_0xd6f0('0x16')]['id'])[_0xd6f0('0xf')](respondWithResult(_0x3c1bff,0xc8))[_0xd6f0('0x13')](handleError(_0x3c1bff,null));}else{return _0x3c1bff[_0xd6f0('0x6')](0x1f4)[_0xd6f0('0x22')]({'message':_0xd6f0('0x23')});}};exports[_0xd6f0('0x24')]=function(_0x43f72f,_0x1dff9b){if(_0x43f72f[_0xd6f0('0x18')]['id']){delete _0x43f72f[_0xd6f0('0x18')]['id'];}if(_0x43f72f[_0xd6f0('0x16')]['id']){return pm2[_0xd6f0('0x25')](_0x43f72f[_0xd6f0('0x16')]['id'])[_0xd6f0('0xf')](function(_0x376890){pm2[_0xd6f0('0x1d')]();return _0x376890[0x0];})[_0xd6f0('0xf')](respondWithResult(_0x1dff9b,null))[_0xd6f0('0x13')](handleError(_0x1dff9b,null));}else{return _0x1dff9b[_0xd6f0('0x6')](0x1f4)['send']({'message':_0xd6f0('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 51efa42..af92e69 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c1d=['isAuthenticated','getAgents','get','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x5bb508,_0x22b021){var _0x20d3ff=function(_0x19c3a3){while(--_0x19c3a3){_0x5bb508['push'](_0x5bb508['shift']());}};_0x20d3ff(++_0x22b021);}(_0x3c1d,0x171));var _0xd3c1=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3c1d[_0xa148b7];return _0x51efd3;};'use strict';var express=require(_0xd3c1('0x0'));var router=express[_0xd3c1('0x1')]();var auth=require(_0xd3c1('0x2'));var controller=require(_0xd3c1('0x3'));router['get'](_0xd3c1('0x4'),auth[_0xd3c1('0x5')](),controller[_0xd3c1('0x6')]);router[_0xd3c1('0x7')](_0xd3c1('0x8'),auth[_0xd3c1('0x5')](),controller[_0xd3c1('0x9')]);module[_0xd3c1('0xa')]=router; \ No newline at end of file +var _0xd3f9=['/queues','getQueues','express','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x4b01a2,_0x24fa0d){var _0x404971=function(_0xa6d1d0){while(--_0xa6d1d0){_0x4b01a2['push'](_0x4b01a2['shift']());}};_0x404971(++_0x24fa0d);}(_0xd3f9,0x122));var _0x9d3f=function(_0x326427,_0x2c0f30){_0x326427=_0x326427-0x0;var _0x343782=_0xd3f9[_0x326427];return _0x343782;};'use strict';var express=require(_0x9d3f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x9d3f('0x1'));router[_0x9d3f('0x2')](_0x9d3f('0x3'),auth[_0x9d3f('0x4')](),controller[_0x9d3f('0x5')]);router[_0x9d3f('0x2')](_0x9d3f('0x6'),auth[_0x9d3f('0x4')](),controller[_0x9d3f('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index fba1c2a..bfc0a3a 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa294=['format','Queue','type','fields','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','rows','getAgentIdsByStatus','map','User','rawAttributes','fieldName','key','role','getOptions','raw','length','sequelize','literal','FIELD(id,','forEach','push','Pause','merge','where','user','userProfileId','Agents','agent','online','extraQueryConditions','assign','omit','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel'];(function(_0x27a125,_0x330c0e){var _0x36eac1=function(_0x49265f){while(--_0x49265f){_0x27a125['push'](_0x27a125['shift']());}};_0x36eac1(++_0x330c0e);}(_0xa294,0x176));var _0x4a29=function(_0x14b835,_0x4c7e96){_0x14b835=_0x14b835-0x0;var _0x49a0f8=_0xa294[_0x14b835];return _0x49a0f8;};'use strict';var _=require(_0x4a29('0x0'));var util=require(_0x4a29('0x1'));var rta=require(_0x4a29('0x2'));var rtq=require(_0x4a29('0x3'));var qs=require(_0x4a29('0x4'));var utils=require(_0x4a29('0x5'));var db=require(_0x4a29('0x6'))['db'];var APIBadRequestError=require(_0x4a29('0x7'))['APIBadRequestError'];var APIHandleError=require(_0x4a29('0x7'))[_0x4a29('0x8')];function respondWithFilteredResult(_0x4a3ef7,_0x64470b){return function(_0x360af0){if(_0x360af0){var _0x1bbfbb=typeof _0x64470b[_0x4a29('0x9')]===_0x4a29('0xa')&&typeof _0x64470b[_0x4a29('0xb')]===_0x4a29('0xa');var _0x1fd79d=_0x360af0[_0x4a29('0xc')];var _0x1b38b0=_0x1bbfbb?0x0:_0x64470b['offset'];var _0x36387e=_0x1bbfbb?_0x360af0['count']:_0x64470b[_0x4a29('0x9')]+_0x64470b[_0x4a29('0xb')];var _0x344f24;if(_0x36387e>=_0x1fd79d){_0x36387e=_0x1fd79d;_0x344f24=0xc8;}else{_0x344f24=0xce;}_0x4a3ef7[_0x4a29('0xd')](_0x344f24);return _0x4a3ef7[_0x4a29('0xe')](_0x4a29('0xf'),_0x1b38b0+'-'+_0x36387e+'/'+_0x1fd79d)['json'](_0x360af0);}return null;};}exports['getAgents']=function(_0x4e8a33,_0x59c75c){var _0xb0d507={'count':0x0,'rows':[]};var _0x551a10={};var _0x32049e;var _0x4a3ba2=utils[_0x4a29('0x10')]();var _0x34cb00;var _0x1abdd2;var _0x2d869d=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x12')];var _0x2f06ac=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x13')];var _0x5ebd4d=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x14')];var _0x1b0abc=_0x2f06ac===_0x4a29('0x15')||_0x2f06ac===_0x4a29('0x16')?!![]:![];var _0x14fd15=[];var _0x2a23a6;var _0x145e9a;Promise['resolve']()[_0x4a29('0x17')](function(){if(_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')]){if(!utils['isValidChannel'](_0x4e8a33[_0x4a29('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0x4a29('0x19'),_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')]));}_0x32049e=_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x18')][_0x4a29('0x1a')]();}if(!_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]||!_0x4e8a33[_0x4a29('0x11')]['sort'][_0x4a29('0x1c')]('globalStatus')){_0x4e8a33['query'][_0x4a29('0x1b')]=rta[_0x4a29('0x1d')](_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]);return;}var _0x89106=rta[_0x4a29('0x1e')](_0x4e8a33['query'][_0x4a29('0x1b')]);_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x1b')]=_0x89106['fields'][_0x4a29('0x1f')](',');_0x2a23a6=_0x89106[_0x4a29('0x20')];})[_0x4a29('0x17')](function(){if(!_0x2d869d){return[];}return rta[_0x4a29('0x21')](_0x2d869d,_0x32049e);})['then'](function(_0x27b385){_0x14fd15=_0x27b385;return rta['getRealtimeAgents']();})[_0x4a29('0x17')](function(_0x58ef4f){_0x1abdd2=_0x58ef4f[_0x4a29('0x22')];if((!_0x2f06ac||_0x1b0abc)&&!_0x2a23a6){return _0x14fd15;}if(_0x2a23a6&&!_0x2f06ac){return rta['getSortedAgentsIdsByStatus'](_0x1abdd2,_0x14fd15,_0x2a23a6);}else{return rta[_0x4a29('0x23')](_0x1abdd2,_0x14fd15,_0x2f06ac);}})[_0x4a29('0x17')](function(_0x28c116){_0x14fd15=_0x28c116;var _0x49ac30=![];if(_0x14fd15['length']===0x0){if(_0x2d869d||_0x2f06ac){_0x49ac30=!![];}if(_0x1b0abc){_0x49ac30=![];}}if(_0x49ac30){return _0xb0d507;}var _0x280149=_[_0x4a29('0x24')](db[_0x4a29('0x25')][_0x4a29('0x26')],function(_0x9ffe3c){return{'name':_0x9ffe3c[_0x4a29('0x27')],'type':_0x9ffe3c['type'][_0x4a29('0x28')]};});_0x4e8a33[_0x4a29('0x11')][_0x4a29('0x29')]='agent';_0x551a10=qs[_0x4a29('0x2a')](_0x280149,_0x4e8a33);_0x551a10[_0x4a29('0x2b')]=!![];var _0x56ea79=[];if(_0x14fd15[_0x4a29('0x2c')]>0x0){_0x56ea79['push']({'id':{'$in':_0x14fd15}});if(_0x2a23a6&&!_0x2f06ac){_0x145e9a=[db[_0x4a29('0x2d')][_0x4a29('0x2e')](_0x4a29('0x2f')+_0x14fd15+')')];_0x551a10['order']=_0x145e9a;}}if(_0x1b0abc){_0x4a3ba2[_0x4a29('0x30')](function(_0x3020c2){var _0x1dd1b0=!![];if(_0x2f06ac===_0x4a29('0x16')&&_0x32049e!==_0x3020c2){_0x1dd1b0=![];}_0x56ea79['push']({[_0x3020c2+'Pause']:_0x1dd1b0});});if(_0x5ebd4d){_0x56ea79['push']({'pauseType':_0x5ebd4d});}}else if(_0x2f06ac){_0x4a3ba2[_0x4a29('0x30')](function(_0x32c7d2){_0x56ea79[_0x4a29('0x31')]({[_0x32c7d2+_0x4a29('0x32')]:![]});});}_0x551a10['where']=_[_0x4a29('0x33')](_0x551a10[_0x4a29('0x34')],{'$and':_0x56ea79});if(_0x4e8a33['user'][_0x4a29('0x29')]===_0x4a29('0x35')){var _0x2414c6={'params':{'id':_0x4e8a33[_0x4a29('0x35')][_0x4a29('0x36')]},'query':{'section':_0x4a29('0x37'),'role':_0x4a29('0x38'),'raw':!![],'ids':_0x14fd15,'customSorting':_0x145e9a}};if(_0x4e8a33['query']['online']){_0x2414c6[_0x4a29('0x11')][_0x4a29('0x39')]=!![];}if(_0x1b0abc){_0x2414c6['query'][_0x4a29('0x3a')]=_0x56ea79;}_0x2414c6[_0x4a29('0x11')]=Object[_0x4a29('0x3b')](_0x2414c6[_0x4a29('0x11')],_[_0x4a29('0x3c')](_0x4e8a33['query'],'id'));return db['UserProfile'][_0x4a29('0x3d')](_0x2414c6);}return db[_0x4a29('0x25')][_0x4a29('0x3e')](_0x551a10);})['then'](function(_0x353a4f){_0xb0d507[_0x4a29('0xc')]=_0x353a4f[_0x4a29('0xc')];_0x34cb00=_0x353a4f[_0x4a29('0x22')];return _0x34cb00[_0x4a29('0x24')](function(_0x3ab705){var _0x2b6a3c=_[_0x4a29('0x3f')](_0x1abdd2,['id',_0x3ab705['id']]);if(_0x2b6a3c){var _0x6b96ad=rta[_0x4a29('0x40')](_0x2b6a3c);_[_0x4a29('0x33')](_0x3ab705,_0x6b96ad);}_0x3ab705[_0x4a29('0x41')]=rta[_0x4a29('0x42')](_0x3ab705);if(_0x3ab705[_0x4a29('0x41')][_0x4a29('0x1c')](_0x4a29('0x15'))){_0x4a3ba2[_0x4a29('0x30')](function(_0x2f9957){if(_0x3ab705[_0x2f9957+_0x4a29('0x32')]){if(_0x2f9957==='voice'){if(_0x3ab705[_0x4a29('0x43')]!==_0x4a29('0x44')){_0x3ab705[_0x4a29('0x43')]=_0x4a29('0x15');}}else{_0x3ab705[_0x2f9957+_0x4a29('0x45')]=_0x4a29('0x15');}}});}return _0x3ab705;});})['then'](function(_0x583b0b){if(!_0x2a23a6||_0x145e9a){return _0x583b0b;}return rta[_0x4a29('0x46')](_0x583b0b,_0x2a23a6);})[_0x4a29('0x17')](function(_0x4962ec){var _0x5a740c=rta[_0x4a29('0x47')]();_0xb0d507[_0x4a29('0x22')]=_0x4962ec[_0x4a29('0x24')](function(_0x3e97cd){return _[_0x4a29('0x48')](_0x3e97cd,_0x5a740c);});return _0xb0d507;})[_0x4a29('0x17')](respondWithFilteredResult(_0x59c75c,_0x551a10))[_0x4a29('0x49')](APIHandleError(_0x59c75c));};exports[_0x4a29('0x4a')]=function(_0xec88bd,_0x3c5db3){var _0x100219={'count':0x0,'rows':[]};var _0x2bc7ed={};var _0x5b5251;var _0x1e2647;var _0x491b3d;Promise['resolve']()[_0x4a29('0x17')](function(){if(_0xec88bd[_0x4a29('0x11')][_0x4a29('0x18')]){if(!utils[_0x4a29('0x4b')](_0xec88bd[_0x4a29('0x11')][_0x4a29('0x18')])){throw new APIBadRequestError(util[_0x4a29('0x4c')](_0x4a29('0x19'),_0xec88bd['query'][_0x4a29('0x18')]));}_0x5b5251=_0xec88bd[_0x4a29('0x11')]['channel'][_0x4a29('0x1a')]();}var _0x178c14=_['startCase'](_0x5b5251)+_0x4a29('0x4d');var _0x174c97=_[_0x4a29('0x24')](db[_0x178c14][_0x4a29('0x26')],function(_0x554cc0){return{'name':_0x554cc0[_0x4a29('0x27')],'type':_0x554cc0[_0x4a29('0x4e')][_0x4a29('0x28')]};});if(!_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4f')]){var _0x3eda58=['id',_0x4a29('0x50')];if(_0x5b5251===_0x4a29('0x51')){_0x3eda58[_0x4a29('0x31')](_0x4a29('0x4e'));if(_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]===_0x4a29('0x52')){_0x3eda58['push']([_0x4a29('0x53'),_0x4a29('0x54')]);}}_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4f')]=_0x3eda58['join'](',');}_0x2bc7ed=qs[_0x4a29('0x2a')](_0x174c97,_0xec88bd);if(_0xec88bd[_0x4a29('0x35')][_0x4a29('0x29')]==='user'){var _0x4a7cd9={'params':{'id':_0xec88bd['user']['userProfileId']},'query':{'section':_0x5b5251==='voice'&&_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]===_0x4a29('0x52')?_0x4a29('0x55'):_[_0x4a29('0x56')](_0x5b5251)+_0x4a29('0x57'),'type':_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')],'nolimit':!![],'sort':'name','filter':_0xec88bd[_0x4a29('0x11')][_0x4a29('0x58')]}};_0x4a7cd9[_0x4a29('0x11')]=Object[_0x4a29('0x3b')](_0x4a7cd9[_0x4a29('0x11')],_0xec88bd['query']);delete _0x4a7cd9['query']['id'];return db['UserProfile'][_0x4a29('0x3d')](_0x4a7cd9);}return db[_0x178c14][_0x4a29('0x3e')](_0x2bc7ed);})[_0x4a29('0x17')](function(_0x5f4b62){_0x100219['count']=_0x5f4b62[_0x4a29('0xc')];_0x1e2647=_0x5f4b62['rows'];return rtq[_0x4a29('0x59')](_0xec88bd,_0x5b5251);})[_0x4a29('0x17')](function(_0x238ef3){_0x491b3d=_0x238ef3[_0x4a29('0x22')];return rtq['initializeQueues'](_0x1e2647,_0x491b3d,_0x5b5251,_0xec88bd[_0x4a29('0x11')][_0x4a29('0x4e')]);})[_0x4a29('0x17')](function(_0x868d6e){_0x100219[_0x4a29('0x22')]=_0x868d6e;return _0x100219;})[_0x4a29('0x17')](respondWithFilteredResult(_0x3c5db3,_0x2bc7ed))[_0x4a29('0x49')](APIHandleError(_0x3c5db3));}; \ No newline at end of file +var _0x99c7=['map','User','rawAttributes','type','key','agent','length','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign','omit','UserProfile','getResources','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','catch','getQueues','startCase','Queue','fieldName','outbound','dialActive','dialMethod','Queues','filter','findAndCountAll','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','APIBadRequestError','../../errors/api','offset','undefined','limit','count','status','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus'];(function(_0x34de85,_0x553d15){var _0x31d7d9=function(_0x41cf9f){while(--_0x41cf9f){_0x34de85['push'](_0x34de85['shift']());}};_0x31d7d9(++_0x553d15);}(_0x99c7,0x182));var _0x799c=function(_0x4d225a,_0x10cfa2){_0x4d225a=_0x4d225a-0x0;var _0x49fb4c=_0x99c7[_0x4d225a];return _0x49fb4c;};'use strict';var _=require(_0x799c('0x0'));var util=require(_0x799c('0x1'));var rta=require(_0x799c('0x2'));var rtq=require(_0x799c('0x3'));var qs=require(_0x799c('0x4'));var utils=require('../../config/utils');var db=require(_0x799c('0x5'))['db'];var APIBadRequestError=require('../../errors/api')[_0x799c('0x6')];var APIHandleError=require(_0x799c('0x7'))['handleError'];function respondWithFilteredResult(_0xaf9225,_0x1d0f3e){return function(_0x388f43){if(_0x388f43){var _0xdd0315=typeof _0x1d0f3e[_0x799c('0x8')]===_0x799c('0x9')&&typeof _0x1d0f3e[_0x799c('0xa')]===_0x799c('0x9');var _0xfe051f=_0x388f43[_0x799c('0xb')];var _0x5bf8eb=_0xdd0315?0x0:_0x1d0f3e['offset'];var _0x340c2d=_0xdd0315?_0x388f43[_0x799c('0xb')]:_0x1d0f3e['offset']+_0x1d0f3e['limit'];var _0xffce7a;if(_0x340c2d>=_0xfe051f){_0x340c2d=_0xfe051f;_0xffce7a=0xc8;}else{_0xffce7a=0xce;}_0xaf9225[_0x799c('0xc')](_0xffce7a);return _0xaf9225['set']('Content-Range',_0x5bf8eb+'-'+_0x340c2d+'/'+_0xfe051f)[_0x799c('0xd')](_0x388f43);}return null;};}exports[_0x799c('0xe')]=function(_0x10875b,_0x3f4ae4){var _0x367a98={'count':0x0,'rows':[]};var _0x422a64={};var _0x411150;var _0x75e379=utils[_0x799c('0xf')]();var _0x183343;var _0x7545a4;var _0x29c93c=_0x10875b[_0x799c('0x10')]['globalQueueFilter'];var _0x297509=_0x10875b[_0x799c('0x10')][_0x799c('0x11')];var _0x1f2bb2=_0x10875b[_0x799c('0x10')][_0x799c('0x12')];var _0x3fe2f3=_0x297509===_0x799c('0x13')||_0x297509==='*pause'?!![]:![];var _0x2cab0c=[];var _0x346874;var _0x4eeb17;Promise[_0x799c('0x14')]()[_0x799c('0x15')](function(){if(_0x10875b[_0x799c('0x10')][_0x799c('0x16')]){if(!utils[_0x799c('0x17')](_0x10875b[_0x799c('0x10')]['channel'])){throw new APIBadRequestError(util[_0x799c('0x18')](_0x799c('0x19'),_0x10875b['query']['channel']));}_0x411150=_0x10875b[_0x799c('0x10')][_0x799c('0x16')][_0x799c('0x1a')]();}if(!_0x10875b[_0x799c('0x10')]['sort']||!_0x10875b[_0x799c('0x10')][_0x799c('0x1b')][_0x799c('0x1c')](_0x799c('0x1d'))){_0x10875b[_0x799c('0x10')]['sort']=rta[_0x799c('0x1e')](_0x10875b['query'][_0x799c('0x1b')]);return;}var _0x18656e=rta['getUpdatedSortOptions'](_0x10875b[_0x799c('0x10')][_0x799c('0x1b')]);_0x10875b[_0x799c('0x10')][_0x799c('0x1b')]=_0x18656e[_0x799c('0x1f')][_0x799c('0x20')](',');_0x346874=_0x18656e[_0x799c('0x21')];})[_0x799c('0x15')](function(){if(!_0x29c93c){return[];}return rta[_0x799c('0x22')](_0x29c93c,_0x411150);})[_0x799c('0x15')](function(_0x28189d){_0x2cab0c=_0x28189d;return rta[_0x799c('0x23')]();})[_0x799c('0x15')](function(_0x382133){_0x7545a4=_0x382133[_0x799c('0x24')];if((!_0x297509||_0x3fe2f3)&&!_0x346874){return _0x2cab0c;}if(_0x346874&&!_0x297509){return rta[_0x799c('0x25')](_0x7545a4,_0x2cab0c,_0x346874);}else{return rta[_0x799c('0x26')](_0x7545a4,_0x2cab0c,_0x297509);}})[_0x799c('0x15')](function(_0x1ee514){_0x2cab0c=_0x1ee514;var _0x201a7a=![];if(_0x2cab0c['length']===0x0){if(_0x29c93c||_0x297509){_0x201a7a=!![];}if(_0x3fe2f3){_0x201a7a=![];}}if(_0x201a7a){return _0x367a98;}var _0x42f49b=_[_0x799c('0x27')](db[_0x799c('0x28')][_0x799c('0x29')],function(_0x3b4754){return{'name':_0x3b4754['fieldName'],'type':_0x3b4754[_0x799c('0x2a')][_0x799c('0x2b')]};});_0x10875b[_0x799c('0x10')]['role']=_0x799c('0x2c');_0x422a64=qs['getOptions'](_0x42f49b,_0x10875b);_0x422a64['raw']=!![];var _0x3a84d3=[];if(_0x2cab0c[_0x799c('0x2d')]>0x0){_0x3a84d3[_0x799c('0x2e')]({'id':{'$in':_0x2cab0c}});if(_0x346874&&!_0x297509){_0x4eeb17=[db[_0x799c('0x2f')][_0x799c('0x30')](_0x799c('0x31')+_0x2cab0c+')')];_0x422a64[_0x799c('0x21')]=_0x4eeb17;}}if(_0x3fe2f3){_0x75e379[_0x799c('0x32')](function(_0x307859){var _0x39b88d=!![];if(_0x297509===_0x799c('0x33')&&_0x411150!==_0x307859){_0x39b88d=![];}_0x3a84d3[_0x799c('0x2e')]({[_0x307859+_0x799c('0x34')]:_0x39b88d});});if(_0x1f2bb2){_0x3a84d3[_0x799c('0x2e')]({'pauseType':_0x1f2bb2});}}else if(_0x297509){_0x75e379['forEach'](function(_0x7baae2){_0x3a84d3['push']({[_0x7baae2+_0x799c('0x34')]:![]});});}_0x422a64[_0x799c('0x35')]=_[_0x799c('0x36')](_0x422a64[_0x799c('0x35')],{'$and':_0x3a84d3});if(_0x10875b[_0x799c('0x37')][_0x799c('0x38')]===_0x799c('0x37')){var _0x4cf881={'params':{'id':_0x10875b[_0x799c('0x37')][_0x799c('0x39')]},'query':{'section':_0x799c('0x3a'),'role':_0x799c('0x2c'),'raw':!![],'ids':_0x2cab0c,'customSorting':_0x4eeb17}};if(_0x10875b[_0x799c('0x10')][_0x799c('0x3b')]){_0x4cf881[_0x799c('0x10')]['online']=!![];}if(_0x3fe2f3){_0x4cf881[_0x799c('0x10')][_0x799c('0x3c')]=_0x3a84d3;}_0x4cf881[_0x799c('0x10')]=Object[_0x799c('0x3d')](_0x4cf881[_0x799c('0x10')],_[_0x799c('0x3e')](_0x10875b[_0x799c('0x10')],'id'));return db[_0x799c('0x3f')][_0x799c('0x40')](_0x4cf881);}return db[_0x799c('0x28')]['findAndCountAll'](_0x422a64);})['then'](function(_0x2029e){_0x367a98[_0x799c('0xb')]=_0x2029e['count'];_0x183343=_0x2029e[_0x799c('0x24')];return _0x183343[_0x799c('0x27')](function(_0x3db72b){var _0xca31f3=_[_0x799c('0x41')](_0x7545a4,['id',_0x3db72b['id']]);if(_0xca31f3){var _0x1d895b=rta[_0x799c('0x42')](_0xca31f3);_[_0x799c('0x36')](_0x3db72b,_0x1d895b);}_0x3db72b[_0x799c('0x1d')]=rta[_0x799c('0x43')](_0x3db72b);if(_0x3db72b[_0x799c('0x1d')][_0x799c('0x1c')](_0x799c('0x13'))){_0x75e379[_0x799c('0x32')](function(_0x4afcd8){if(_0x3db72b[_0x4afcd8+_0x799c('0x34')]){if(_0x4afcd8===_0x799c('0x44')){if(_0x3db72b[_0x799c('0x45')]!==_0x799c('0x46')){_0x3db72b['voiceStatus']='pause';}}else{_0x3db72b[_0x4afcd8+_0x799c('0x47')]=_0x799c('0x13');}}});}return _0x3db72b;});})[_0x799c('0x15')](function(_0x14f6ce){if(!_0x346874||_0x4eeb17){return _0x14f6ce;}return rta[_0x799c('0x48')](_0x14f6ce,_0x346874);})['then'](function(_0x4d35ee){var _0x43e531=rta['getRealtimeAgentsQueryFields']();_0x367a98[_0x799c('0x24')]=_0x4d35ee[_0x799c('0x27')](function(_0x5bd55e){return _['pick'](_0x5bd55e,_0x43e531);});return _0x367a98;})[_0x799c('0x15')](respondWithFilteredResult(_0x3f4ae4,_0x422a64))[_0x799c('0x49')](APIHandleError(_0x3f4ae4));};exports[_0x799c('0x4a')]=function(_0x2f9ffb,_0x14b521){var _0x233658={'count':0x0,'rows':[]};var _0x38c87d={};var _0xc03cca;var _0x34134a;var _0x30f058;Promise['resolve']()[_0x799c('0x15')](function(){if(_0x2f9ffb['query'][_0x799c('0x16')]){if(!utils[_0x799c('0x17')](_0x2f9ffb['query'][_0x799c('0x16')])){throw new APIBadRequestError(util[_0x799c('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2f9ffb[_0x799c('0x10')][_0x799c('0x16')]));}_0xc03cca=_0x2f9ffb[_0x799c('0x10')][_0x799c('0x16')]['toLowerCase']();}var _0x411811=_[_0x799c('0x4b')](_0xc03cca)+_0x799c('0x4c');var _0x5a1ae8=_['map'](db[_0x411811][_0x799c('0x29')],function(_0x5589e1){return{'name':_0x5589e1[_0x799c('0x4d')],'type':_0x5589e1[_0x799c('0x2a')][_0x799c('0x2b')]};});if(!_0x2f9ffb[_0x799c('0x10')][_0x799c('0x1f')]){var _0x389e37=['id','name'];if(_0xc03cca===_0x799c('0x44')){_0x389e37[_0x799c('0x2e')]('type');if(_0x2f9ffb[_0x799c('0x10')][_0x799c('0x2a')]===_0x799c('0x4e')){_0x389e37[_0x799c('0x2e')]([_0x799c('0x4f'),_0x799c('0x50')]);}}_0x2f9ffb['query'][_0x799c('0x1f')]=_0x389e37[_0x799c('0x20')](',');}_0x38c87d=qs['getOptions'](_0x5a1ae8,_0x2f9ffb);if(_0x2f9ffb[_0x799c('0x37')][_0x799c('0x38')]===_0x799c('0x37')){var _0x57f68e={'params':{'id':_0x2f9ffb[_0x799c('0x37')][_0x799c('0x39')]},'query':{'section':_0xc03cca==='voice'&&_0x2f9ffb[_0x799c('0x10')][_0x799c('0x2a')]===_0x799c('0x4e')?'QueueCampaigns':_[_0x799c('0x4b')](_0xc03cca)+_0x799c('0x51'),'type':_0x2f9ffb[_0x799c('0x10')][_0x799c('0x2a')],'nolimit':!![],'sort':'name','filter':_0x2f9ffb[_0x799c('0x10')][_0x799c('0x52')]}};_0x57f68e[_0x799c('0x10')]=Object['assign'](_0x57f68e[_0x799c('0x10')],_0x2f9ffb['query']);delete _0x57f68e[_0x799c('0x10')]['id'];return db['UserProfile'][_0x799c('0x40')](_0x57f68e);}return db[_0x411811][_0x799c('0x53')](_0x38c87d);})[_0x799c('0x15')](function(_0x56427d){_0x233658[_0x799c('0xb')]=_0x56427d['count'];_0x34134a=_0x56427d[_0x799c('0x24')];return rtq[_0x799c('0x54')](_0x2f9ffb,_0xc03cca);})[_0x799c('0x15')](function(_0x2c8e71){_0x30f058=_0x2c8e71['rows'];return rtq['initializeQueues'](_0x34134a,_0x30f058,_0xc03cca,_0x2f9ffb[_0x799c('0x10')]['type']);})[_0x799c('0x15')](function(_0x40ce6e){_0x233658[_0x799c('0x24')]=_0x40ce6e;return _0x233658;})['then'](respondWithFilteredResult(_0x14b521,_0x38c87d))[_0x799c('0x49')](APIHandleError(_0x14b521));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a217d0c..e111542 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x199bdd,_0x5f09e2){var _0x5c4f2f=function(_0xac4ba8){while(--_0xac4ba8){_0x199bdd['push'](_0x199bdd['shift']());}};_0x5c4f2f(++_0x5f09e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x419b7a,_0x299ca7){var _0x4e284d=function(_0x42a9f5){while(--_0x42a9f5){_0x419b7a['push'](_0x419b7a['shift']());}};_0x4e284d(++_0x299ca7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 13ab58a..a556ef0 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 _0x565f=['exports','INTEGER','STRING','DATE'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0x565f,0x68));var _0xf565=function(_0x3887a3,_0x5155c6){_0x3887a3=_0x3887a3-0x0;var _0x155e10=_0x565f[_0x3887a3];return _0x155e10;};'use strict';var Sequelize=require('sequelize');module[_0xf565('0x0')]={'state':{'type':Sequelize[_0xf565('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf565('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xf565('0x2')]},'starttime':{'type':Sequelize[_0xf565('0x3')]},'responsetime':{'type':Sequelize[_0xf565('0x3')]},'ringtime':{'type':Sequelize[_0xf565('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf565('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3831=['sequelize','INTEGER','STRING','DATE'];(function(_0x2eb907,_0xd36a7d){var _0x51d19c=function(_0x3bec12){while(--_0x3bec12){_0x2eb907['push'](_0x2eb907['shift']());}};_0x51d19c(++_0xd36a7d);}(_0x3831,0x14c));var _0x1383=function(_0x421c11,_0xcf7560){_0x421c11=_0x421c11-0x0;var _0x317709=_0x3831[_0x421c11];return _0x317709;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'state':{'type':Sequelize[_0x1383('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1383('0x2')]},'scheduledat':{'type':Sequelize[_0x1383('0x3')]},'uniqueid':{'type':Sequelize[_0x1383('0x2')]},'starttime':{'type':Sequelize[_0x1383('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1383('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1383('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index b366fc2..59c1a1a 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 _0xe1ce=['../../config/logger','api','moment','request-promise','path','rimraf','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x5ddcff,_0x3df8ef){var _0x55a734=function(_0xbbaf39){while(--_0xbbaf39){_0x5ddcff['push'](_0x5ddcff['shift']());}};_0x55a734(++_0x3df8ef);}(_0xe1ce,0x18a));var _0xee1c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xe1ce[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xee1c('0x0'));var util=require(_0xee1c('0x1'));var logger=require(_0xee1c('0x2'))(_0xee1c('0x3'));var moment=require(_0xee1c('0x4'));var BPromise=require('bluebird');var rp=require(_0xee1c('0x5'));var fs=require('fs');var path=require(_0xee1c('0x6'));var rimraf=require(_0xee1c('0x7'));var config=require('../../config/environment');var attributes=require(_0xee1c('0x8'));module['exports']=function(_0x3fccc4,_0x52f16e){return _0x3fccc4['define'](_0xee1c('0x9'),attributes,{'tableName':_0xee1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64bb=['request-promise','path','rimraf','../../config/environment','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e7583,_0x3f020f){var _0x392a98=function(_0x5298fe){while(--_0x5298fe){_0x4e7583['push'](_0x4e7583['shift']());}};_0x392a98(++_0x3f020f);}(_0x64bb,0x173));var _0xb64b=function(_0x25bb88,_0x3bacd7){_0x25bb88=_0x25bb88-0x0;var _0x16b6cf=_0x64bb[_0x25bb88];return _0x16b6cf;};'use strict';var _=require(_0xb64b('0x0'));var util=require(_0xb64b('0x1'));var logger=require(_0xb64b('0x2'))(_0xb64b('0x3'));var moment=require(_0xb64b('0x4'));var BPromise=require(_0xb64b('0x5'));var rp=require(_0xb64b('0x6'));var fs=require('fs');var path=require(_0xb64b('0x7'));var rimraf=require(_0xb64b('0x8'));var config=require(_0xb64b('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0xb64b('0xa')]=function(_0x47a9a8,_0x1c1ccb){return _0x47a9a8[_0xb64b('0xb')]('ReportAgentPreview',attributes,{'tableName':_0xb64b('0xc'),'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 dc0f148..9782fa7 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 _0xecfb=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x4731bb,_0x1a560c){var _0x1bab17=function(_0x4f8bd8){while(--_0x4f8bd8){_0x4731bb['push'](_0x4731bb['shift']());}};_0x1bab17(++_0x1a560c);}(_0xecfb,0x139));var _0xbecf=function(_0x5d98e4,_0x377619){_0x5d98e4=_0x5d98e4-0x0;var _0x36157d=_0xecfb[_0x5d98e4];return _0x36157d;};'use strict';var _=require(_0xbecf('0x0'));var util=require(_0xbecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbecf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbecf('0x3'));var logger=require(_0xbecf('0x4'))(_0xbecf('0x5'));var config=require(_0xbecf('0x6'));var jayson=require(_0xbecf('0x7'));var client=jayson[_0xbecf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7b7ff,_0x26946c,_0x219838){return new BPromise(function(_0x3391cf,_0x1fc6e9){return client['request'](_0xb7b7ff,_0x219838)[_0xbecf('0x9')](function(_0x5ddec8){logger[_0xbecf('0xa')](_0xbecf('0xb'),_0x26946c,'request\x20sent');logger[_0xbecf('0xc')](_0xbecf('0xd'),_0x26946c,_0xbecf('0xe'),JSON[_0xbecf('0xf')](_0x5ddec8));if(_0x5ddec8[_0xbecf('0x10')]){if(_0x5ddec8[_0xbecf('0x10')]['code']===0x1f4){logger[_0xbecf('0x10')](_0xbecf('0xb'),_0x26946c,_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);return _0x1fc6e9(_0x5ddec8[_0xbecf('0x10')]['message']);}logger[_0xbecf('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x26946c,_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);return _0x3391cf(_0x5ddec8[_0xbecf('0x10')][_0xbecf('0x11')]);}else{logger[_0xbecf('0xa')](_0xbecf('0xb'),_0x26946c,_0xbecf('0xe'));_0x3391cf(_0x5ddec8[_0xbecf('0x12')]['message']);}})[_0xbecf('0x13')](function(_0x1b403d){logger[_0xbecf('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x26946c,_0x1b403d);_0x1fc6e9(_0x1b403d);});});}exports['CreateReportAgentPreview']=function(_0x54cae7){var _0x49bff1=this;return new Promise(function(_0x2a995a,_0x5bf997){return db[_0xbecf('0x14')][_0xbecf('0x15')](_0x54cae7[_0xbecf('0x16')],{'raw':_0x54cae7['options']?_0x54cae7[_0xbecf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbecf('0x9')](function(_0x197e34){logger[_0xbecf('0xa')](_0xbecf('0x18'),_0x54cae7);logger[_0xbecf('0xc')](_0xbecf('0x18'),_0x54cae7,JSON[_0xbecf('0xf')](_0x197e34));_0x2a995a(_0x197e34);})[_0xbecf('0x13')](function(_0x187ebc){logger['error'](_0xbecf('0x18'),_0x187ebc[_0xbecf('0x11')],_0x54cae7);_0x5bf997(_0x49bff1[_0xbecf('0x10')](0x1f4,_0x187ebc[_0xbecf('0x11')]));});});}; \ No newline at end of file +var _0x44c5=['catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3b6c59,_0x10c316){var _0x6d60c8=function(_0x4c38f9){while(--_0x4c38f9){_0x3b6c59['push'](_0x3b6c59['shift']());}};_0x6d60c8(++_0x10c316);}(_0x44c5,0xef));var _0x544c=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x44c5[_0x27a3cb];return _0x54ff38;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x544c('0x2'));var fs=require('fs');var Redis=require(_0x544c('0x3'));var db=require(_0x544c('0x4'))['db'];var utils=require(_0x544c('0x5'));var logger=require(_0x544c('0x6'))('rpc');var config=require(_0x544c('0x7'));var jayson=require(_0x544c('0x8'));var client=jayson[_0x544c('0x9')][_0x544c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d92c1,_0x182c7b,_0x223e9d){return new BPromise(function(_0x48b0a3,_0x56fd3d){return client[_0x544c('0xb')](_0x1d92c1,_0x223e9d)[_0x544c('0xc')](function(_0x39ead6){logger[_0x544c('0xd')](_0x544c('0xe'),_0x182c7b,_0x544c('0xf'));logger[_0x544c('0x10')](_0x544c('0x11'),_0x182c7b,_0x544c('0xf'),JSON['stringify'](_0x39ead6));if(_0x39ead6[_0x544c('0x12')]){if(_0x39ead6[_0x544c('0x12')][_0x544c('0x13')]===0x1f4){logger[_0x544c('0x12')](_0x544c('0xe'),_0x182c7b,_0x39ead6[_0x544c('0x12')][_0x544c('0x14')]);return _0x56fd3d(_0x39ead6[_0x544c('0x12')][_0x544c('0x14')]);}logger[_0x544c('0x12')](_0x544c('0xe'),_0x182c7b,_0x39ead6['error'][_0x544c('0x14')]);return _0x48b0a3(_0x39ead6[_0x544c('0x12')]['message']);}else{logger[_0x544c('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x182c7b,_0x544c('0xf'));_0x48b0a3(_0x39ead6[_0x544c('0x15')][_0x544c('0x14')]);}})[_0x544c('0x16')](function(_0x50ce73){logger[_0x544c('0x12')](_0x544c('0xe'),_0x182c7b,_0x50ce73);_0x56fd3d(_0x50ce73);});});}exports[_0x544c('0x17')]=function(_0x5da31e){var _0x57a746=this;return new Promise(function(_0x5d37ab,_0x32c2e5){return db[_0x544c('0x18')]['create'](_0x5da31e[_0x544c('0x19')],{'raw':_0x5da31e[_0x544c('0x1a')]?_0x5da31e[_0x544c('0x1a')][_0x544c('0x1b')]===undefined?!![]:![]:!![]})[_0x544c('0xc')](function(_0x499dd7){logger['info'](_0x544c('0x17'),_0x5da31e);logger[_0x544c('0x10')](_0x544c('0x17'),_0x5da31e,JSON[_0x544c('0x1c')](_0x499dd7));_0x5d37ab(_0x499dd7);})[_0x544c('0x16')](function(_0x1ff282){logger[_0x544c('0x12')](_0x544c('0x17'),_0x1ff282[_0x544c('0x14')],_0x5da31e);_0x32c2e5(_0x57a746[_0x544c('0x12')](0x1f4,_0x1ff282['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d7caf2d..696ae81 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 _0xa7d2=['sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xa7d2,0xa9));var _0x2a7d=function(_0x17ace6,_0x152f16){_0x17ace6=_0x17ace6-0x0;var _0x3e87fa=_0xa7d2[_0x17ace6];return _0x3e87fa;};'use strict';var multer=require(_0x2a7d('0x0'));var util=require(_0x2a7d('0x1'));var path=require(_0x2a7d('0x2'));var express=require(_0x2a7d('0x3'));var router=express[_0x2a7d('0x4')]();var auth=require(_0x2a7d('0x5'));var controller=require(_0x2a7d('0x6'));router[_0x2a7d('0x7')](_0x2a7d('0x8'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x2a7d('0x7')](_0x2a7d('0x9'),auth[_0x2a7d('0xa')](),controller['voiceChannelMixMonitor']);router[_0x2a7d('0x7')](_0x2a7d('0xb'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0xc')]);router[_0x2a7d('0x7')](_0x2a7d('0xd'),auth['isAuthenticated'](),controller[_0x2a7d('0xe')]);router[_0x2a7d('0x7')]('/chat/queues',auth['isAuthenticated'](),controller[_0x2a7d('0xf')]);router[_0x2a7d('0x7')](_0x2a7d('0x10'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x11')]);router['get']('/mail/accounts',auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x12')]);router[_0x2a7d('0x7')](_0x2a7d('0x13'),auth[_0x2a7d('0xa')](),controller['openchannelQueues']);router[_0x2a7d('0x7')](_0x2a7d('0x14'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x15')]);router[_0x2a7d('0x7')](_0x2a7d('0x16'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x17')]);router['get'](_0x2a7d('0x18'),auth['isAuthenticated'](),controller[_0x2a7d('0x19')]);router[_0x2a7d('0x7')](_0x2a7d('0x1a'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x1b')]);router['get'](_0x2a7d('0x1c'),auth['isAuthenticated'](),controller[_0x2a7d('0x1d')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x2a7d('0xa')](),controller['voiceQueuesChannel']);router[_0x2a7d('0x7')](_0x2a7d('0x1e'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x1f')]);router[_0x2a7d('0x7')](_0x2a7d('0x20'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x21')]);router['get'](_0x2a7d('0x22'),auth['isAuthenticated'](),controller[_0x2a7d('0x23')]);router[_0x2a7d('0x24')](_0x2a7d('0x22'),auth[_0x2a7d('0xa')](),controller['updateVoiceQueue']);router[_0x2a7d('0x7')](_0x2a7d('0x25'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x26')]);router[_0x2a7d('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x2a7d('0x27')]);router['get'](_0x2a7d('0x28'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x29')]);router[_0x2a7d('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x2a7d('0x2a')]);router['get'](_0x2a7d('0x2b'),auth['isAuthenticated'](),controller[_0x2a7d('0x2c')]);router[_0x2a7d('0x7')](_0x2a7d('0x2d'),auth['isAuthenticated'](),controller[_0x2a7d('0x2e')]);router[_0x2a7d('0x7')](_0x2a7d('0x2f'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x30')]);router[_0x2a7d('0x7')](_0x2a7d('0x31'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x32')]);router[_0x2a7d('0x7')](_0x2a7d('0x33'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x34')]);router[_0x2a7d('0x7')](_0x2a7d('0x35'),auth['isAuthenticated'](),controller[_0x2a7d('0x36')]);router['get'](_0x2a7d('0x37'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2a7d('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2a7d('0x7')](_0x2a7d('0x38'),auth[_0x2a7d('0xa')](),controller['smsQueuesWaitingInteractions']);router['get'](_0x2a7d('0x39'),auth[_0x2a7d('0xa')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth[_0x2a7d('0xa')](),controller['faxQueuesWaitingInteractions']);router[_0x2a7d('0x3a')](_0x2a7d('0x3b'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3c')]('mail'));router['get'](_0x2a7d('0x3d'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3e')]);router[_0x2a7d('0x3a')](_0x2a7d('0x3f'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')](_0x2a7d('0x40')));router[_0x2a7d('0x7')]('/chat/queues/:id',auth[_0x2a7d('0xa')](),controller['showChatQueues']);router[_0x2a7d('0x3a')](_0x2a7d('0x41'),auth[_0x2a7d('0xa')](),controller['queueNotify'](_0x2a7d('0x42')));router[_0x2a7d('0x7')](_0x2a7d('0x43'),auth['isAuthenticated'](),controller[_0x2a7d('0x44')]);router[_0x2a7d('0x3a')](_0x2a7d('0x45'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')](_0x2a7d('0x46')));router[_0x2a7d('0x7')](_0x2a7d('0x47'),auth['isAuthenticated'](),controller[_0x2a7d('0x48')]);router[_0x2a7d('0x3a')](_0x2a7d('0x49'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x3c')](_0x2a7d('0x4a')));router['post'](_0x2a7d('0x4b'),auth['isAuthenticated'](),controller[_0x2a7d('0x3c')]('whatsapp'));router[_0x2a7d('0x7')](_0x2a7d('0x4c'),auth[_0x2a7d('0xa')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x4d')]);router['post'](_0x2a7d('0x4e'),auth[_0x2a7d('0xa')](),controller[_0x2a7d('0x4f')]);module[_0x2a7d('0x50')]=router; \ No newline at end of file +var _0xd6af=['/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','agentNotify','exports','multer','util','Router','./rpc.controller','/voice/channels','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','isAuthenticated','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues'];(function(_0x2666ee,_0x11e5cf){var _0x8db61b=function(_0x4d7947){while(--_0x4d7947){_0x2666ee['push'](_0x2666ee['shift']());}};_0x8db61b(++_0x11e5cf);}(_0xd6af,0xb3));var _0xfd6a=function(_0x139d3a,_0x23931e){_0x139d3a=_0x139d3a-0x0;var _0x345d6b=_0xd6af[_0x139d3a];return _0x345d6b;};'use strict';var multer=require(_0xfd6a('0x0'));var util=require(_0xfd6a('0x1'));var path=require('path');var express=require('express');var router=express[_0xfd6a('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xfd6a('0x3'));router['get'](_0xfd6a('0x4'),auth['isAuthenticated'](),controller[_0xfd6a('0x5')]);router[_0xfd6a('0x6')](_0xfd6a('0x7'),auth['isAuthenticated'](),controller[_0xfd6a('0x8')]);router[_0xfd6a('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xfd6a('0x9')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xfd6a('0xa'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0xb')]);router[_0xfd6a('0x6')](_0xfd6a('0xc'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0xd')]);router['get'](_0xfd6a('0xe'),auth['isAuthenticated'](),controller[_0xfd6a('0xf')]);router[_0xfd6a('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xfd6a('0x10')]);router[_0xfd6a('0x6')](_0xfd6a('0x11'),auth[_0xfd6a('0x9')](),controller['openchannelQueues']);router[_0xfd6a('0x6')](_0xfd6a('0x12'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x13')]);router[_0xfd6a('0x6')](_0xfd6a('0x14'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x15')]);router[_0xfd6a('0x6')](_0xfd6a('0x16'),auth['isAuthenticated'](),controller[_0xfd6a('0x17')]);router[_0xfd6a('0x6')](_0xfd6a('0x18'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x19')]);router['get'](_0xfd6a('0x1a'),auth[_0xfd6a('0x9')](),controller['voiceQueuesChannels']);router[_0xfd6a('0x6')](_0xfd6a('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0xfd6a('0x1c'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x1d')]);router[_0xfd6a('0x6')](_0xfd6a('0x1e'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x1f')]);router[_0xfd6a('0x6')](_0xfd6a('0x20'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x21')]);router['put'](_0xfd6a('0x20'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xfd6a('0x22'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x23')]);router[_0xfd6a('0x6')](_0xfd6a('0x24'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x25')]);router[_0xfd6a('0x6')](_0xfd6a('0x26'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x27')]);router[_0xfd6a('0x28')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xfd6a('0x29')]);router['get'](_0xfd6a('0x2a'),auth[_0xfd6a('0x9')](),controller['telephones']);router['get']('/trunks',auth[_0xfd6a('0x9')](),controller['trunks']);router[_0xfd6a('0x6')](_0xfd6a('0x2b'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x2c')]);router['get']('/fax/accounts',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x2d')]);router[_0xfd6a('0x6')]('/chat/queues/waitinginteractions',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x2e')]);router[_0xfd6a('0x6')](_0xfd6a('0x2f'),auth['isAuthenticated'](),controller[_0xfd6a('0x30')]);router[_0xfd6a('0x6')](_0xfd6a('0x31'),auth[_0xfd6a('0x9')](),controller['openchannelQueuesWaitingInteractions']);router[_0xfd6a('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x32')]);router[_0xfd6a('0x6')]('/sms/queues/waitinginteractions',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x33')]);router[_0xfd6a('0x6')](_0xfd6a('0x34'),auth[_0xfd6a('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0xfd6a('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfd6a('0x35')]);router[_0xfd6a('0x36')](_0xfd6a('0x37'),auth['isAuthenticated'](),controller[_0xfd6a('0x38')](_0xfd6a('0x39')));router[_0xfd6a('0x6')](_0xfd6a('0x3a'),auth[_0xfd6a('0x9')](),controller['showMailQueues']);router[_0xfd6a('0x36')](_0xfd6a('0x3b'),auth[_0xfd6a('0x9')](),controller['queueNotify'](_0xfd6a('0x3c')));router[_0xfd6a('0x6')]('/chat/queues/:id',auth[_0xfd6a('0x9')](),controller['showChatQueues']);router[_0xfd6a('0x36')](_0xfd6a('0x3d'),auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x38')]('fax'));router[_0xfd6a('0x6')]('/fax/queues/:id',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x3e')]);router[_0xfd6a('0x36')]('/openchannel/queues/:id/notify',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x38')](_0xfd6a('0x3f')));router[_0xfd6a('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xfd6a('0x40')]);router[_0xfd6a('0x36')](_0xfd6a('0x41'),auth['isAuthenticated'](),controller[_0xfd6a('0x38')]('sms'));router[_0xfd6a('0x36')]('/whatsapp/queues/:id/notify',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x38')](_0xfd6a('0x42')));router[_0xfd6a('0x6')](_0xfd6a('0x43'),auth[_0xfd6a('0x9')](),controller['showSmsQueues']);router[_0xfd6a('0x6')](_0xfd6a('0x44'),auth[_0xfd6a('0x9')](),controller['showWhatsappQueues']);router[_0xfd6a('0x36')]('/agents/:id/notify',auth[_0xfd6a('0x9')](),controller[_0xfd6a('0x45')]);module[_0xfd6a('0x46')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0a303aa..76c4ac2 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x561ef0,_0x3488b0){var _0x3b60dc=function(_0x2dfcca){while(--_0x2dfcca){_0x561ef0['push'](_0x561ef0['shift']());}};_0x3b60dc(++_0x3488b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x11b0ae,_0x438090){var _0x305a92=function(_0x31c83a){while(--_0x31c83a){_0x11b0ae['push'](_0x11b0ae['shift']());}};_0x305a92(++_0x438090);}(_0xe706,0xa3));var _0x6e70=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xe706[_0x4c3ffe];return _0x28d3eb;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8750833..367f132 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 _0x9728=['post','create','put','update','delete','util','connect-timeout','express','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x30572e,_0x447a6a){var _0x4a7742=function(_0x1275b3){while(--_0x1275b3){_0x30572e['push'](_0x30572e['shift']());}};_0x4a7742(++_0x447a6a);}(_0x9728,0x104));var _0x8972=function(_0x476c7a,_0x20c6e8){_0x476c7a=_0x476c7a-0x0;var _0x181dc9=_0x9728[_0x476c7a];return _0x181dc9;};'use strict';var multer=require('multer');var util=require(_0x8972('0x0'));var path=require('path');var timeout=require(_0x8972('0x1'));var express=require(_0x8972('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8972('0x3'));var config=require('../../config/environment');var controller=require(_0x8972('0x4'));router[_0x8972('0x5')]('/',auth[_0x8972('0x6')](),controller[_0x8972('0x7')]);router[_0x8972('0x5')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller[_0x8972('0x9')]);router[_0x8972('0x5')](_0x8972('0xa'),auth[_0x8972('0x6')](),controller[_0x8972('0xb')]);router[_0x8972('0xc')]('/',auth['isAuthenticated'](),controller[_0x8972('0xd')]);router[_0x8972('0xe')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller[_0x8972('0xf')]);router[_0x8972('0x10')](_0x8972('0x8'),auth[_0x8972('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfbaf=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','update','delete','destroy','exports','multer','util'];(function(_0x188e95,_0x1468f3){var _0x1dbbdd=function(_0x244655){while(--_0x244655){_0x188e95['push'](_0x188e95['shift']());}};_0x1dbbdd(++_0x1468f3);}(_0xfbaf,0x116));var _0xffba=function(_0x25c759,_0x5c6ef6){_0x25c759=_0x25c759-0x0;var _0x18557c=_0xfbaf[_0x25c759];return _0x18557c;};'use strict';var multer=require(_0xffba('0x0'));var util=require(_0xffba('0x1'));var path=require('path');var timeout=require(_0xffba('0x2'));var express=require(_0xffba('0x3'));var router=express[_0xffba('0x4')]();var fs_extra=require(_0xffba('0x5'));var auth=require(_0xffba('0x6'));var interaction=require(_0xffba('0x7'));var config=require('../../config/environment');var controller=require(_0xffba('0x8'));router[_0xffba('0x9')]('/',auth['isAuthenticated'](),controller[_0xffba('0xa')]);router[_0xffba('0x9')](_0xffba('0xb'),auth[_0xffba('0xc')](),controller[_0xffba('0xd')]);router[_0xffba('0x9')](_0xffba('0xe'),auth[_0xffba('0xc')](),controller[_0xffba('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xffba('0xc')](),controller[_0xffba('0x10')]);router[_0xffba('0x11')](_0xffba('0xb'),auth[_0xffba('0xc')](),controller[_0xffba('0x12')]);module[_0xffba('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7abbdd4..040b4fb 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 _0x17a6=['weeks','days','minutes','csv','xlsx','default','custom','TEXT','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0xde42f3,_0x3bd1ed){var _0x1c0215=function(_0x43c02a){while(--_0x43c02a){_0xde42f3['push'](_0xde42f3['shift']());}};_0x1c0215(++_0x3bd1ed);}(_0x17a6,0x98));var _0x617a=function(_0xd60ff2,_0x1f31cd){_0xd60ff2=_0xd60ff2-0x0;var _0x5befdc=_0x17a6[_0xd60ff2];return _0x5befdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x617a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x617a('0x0')]},'active':{'type':Sequelize[_0x617a('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x617a('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x617a('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x617a('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x617a('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x617a('0x4')](_0x617a('0x5'),_0x617a('0x6'),_0x617a('0x7'),_0x617a('0x8'),_0x617a('0x9'),'hours',_0x617a('0xa')),'allowNull':![],'defaultValue':_0x617a('0x9')},'output':{'type':Sequelize[_0x617a('0x4')](_0x617a('0xb'),'pdf',_0x617a('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x617a('0x4')]('custom',_0x617a('0xd')),'allowNull':![],'defaultValue':_0x617a('0xe')},'sendMail':{'type':Sequelize[_0x617a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x617a('0x0')]},'cc':{'type':Sequelize[_0x617a('0xf')]},'bcc':{'type':Sequelize[_0x617a('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x41ec=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','default','custom','TEXT','sequelize','STRING'];(function(_0x4aecb1,_0x2e7609){var _0x32c646=function(_0x223ac0){while(--_0x223ac0){_0x4aecb1['push'](_0x4aecb1['shift']());}};_0x32c646(++_0x2e7609);}(_0x41ec,0xbc));var _0xc41e=function(_0x1f6ef3,_0x2b886a){_0x1f6ef3=_0x1f6ef3-0x0;var _0x1340a0=_0x41ec[_0x1f6ef3];return _0x1340a0;};'use strict';var Sequelize=require(_0xc41e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc41e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc41e('0x1')]},'active':{'type':Sequelize[_0xc41e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc41e('0x3')},'startAt':{'type':Sequelize[_0xc41e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc41e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc41e('0x6')](_0xc41e('0x7'),_0xc41e('0x8'),_0xc41e('0x9'),_0xc41e('0xa'),_0xc41e('0xb'),_0xc41e('0xc'),_0xc41e('0xd')),'allowNull':![],'defaultValue':_0xc41e('0xb')},'output':{'type':Sequelize[_0xc41e('0x6')](_0xc41e('0xe'),_0xc41e('0xf'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xc41e('0x6')]('custom',_0xc41e('0x10')),'allowNull':![],'defaultValue':_0xc41e('0x11')},'sendMail':{'type':Sequelize[_0xc41e('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc41e('0x12')]},'bcc':{'type':Sequelize[_0xc41e('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xc41e('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 495084a..b6a42bb 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 _0x5c5e=['UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4a2268,_0x2c6a30){var _0x57f41a=function(_0x19274e){while(--_0x19274e){_0x4a2268['push'](_0x4a2268['shift']());}};_0x57f41a(++_0x2c6a30);}(_0x5c5e,0xb4));var _0xe5c5=function(_0x47f1d4,_0x493e60){_0x47f1d4=_0x47f1d4-0x0;var _0x9cfd29=_0x5c5e[_0x47f1d4];return _0x9cfd29;};'use strict';var emlformat=require(_0xe5c5('0x0'));var rimraf=require(_0xe5c5('0x1'));var zipdir=require(_0xe5c5('0x2'));var jsonpatch=require(_0xe5c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5c5('0x4'));var Mustache=require(_0xe5c5('0x5'));var util=require(_0xe5c5('0x6'));var path=require(_0xe5c5('0x7'));var sox=require(_0xe5c5('0x8'));var csv=require(_0xe5c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5c5('0xa'));var _=require('lodash');var squel=require(_0xe5c5('0xb'));var crypto=require(_0xe5c5('0xc'));var jsforce=require(_0xe5c5('0xd'));var deskjs=require(_0xe5c5('0xe'));var toCsv=require(_0xe5c5('0x9'));var querystring=require(_0xe5c5('0xf'));var Papa=require(_0xe5c5('0x10'));var Redis=require(_0xe5c5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5c5('0x12'))(_0xe5c5('0x13'));var utils=require(_0xe5c5('0x14'));var config=require(_0xe5c5('0x15'));var licenseUtil=require(_0xe5c5('0x16'));var db=require(_0xe5c5('0x17'))['db'];function respondWithStatusCode(_0x2e04d9,_0x1d61aa){_0x1d61aa=_0x1d61aa||0xcc;return function(_0x287383){if(_0x287383){return _0x2e04d9['sendStatus'](_0x1d61aa);}return _0x2e04d9[_0xe5c5('0x18')](_0x1d61aa)[_0xe5c5('0x19')]();};}function respondWithResult(_0x23234a,_0x61f837){_0x61f837=_0x61f837||0xc8;return function(_0xe111a8){if(_0xe111a8){return _0x23234a[_0xe5c5('0x18')](_0x61f837)[_0xe5c5('0x1a')](_0xe111a8);}};}function respondWithFilteredResult(_0x3316a1,_0x451cc3){return function(_0x2e5037){if(_0x2e5037){var _0x2d1e2e=typeof _0x451cc3['offset']===_0xe5c5('0x1b')&&typeof _0x451cc3[_0xe5c5('0x1c')]===_0xe5c5('0x1b');var _0x3f0de8=_0x2e5037[_0xe5c5('0x1d')];var _0x11ba8c=_0x2d1e2e?0x0:_0x451cc3[_0xe5c5('0x1e')];var _0x4b314a=_0x2d1e2e?_0x2e5037[_0xe5c5('0x1d')]:_0x451cc3[_0xe5c5('0x1e')]+_0x451cc3[_0xe5c5('0x1c')];var _0x5d988c;if(_0x4b314a>=_0x3f0de8){_0x4b314a=_0x3f0de8;_0x5d988c=0xc8;}else{_0x5d988c=0xce;}_0x3316a1[_0xe5c5('0x18')](_0x5d988c);return _0x3316a1['set'](_0xe5c5('0x1f'),_0x11ba8c+'-'+_0x4b314a+'/'+_0x3f0de8)[_0xe5c5('0x1a')](_0x2e5037);}return null;};}function patchUpdates(_0x593b89){return function(_0x5de981){try{jsonpatch['apply'](_0x5de981,_0x593b89,!![]);}catch(_0x509316){return BPromise[_0xe5c5('0x20')](_0x509316);}return _0x5de981['save']();};}function saveUpdates(_0x31a177,_0x432212){return function(_0x1f24cb){if(_0x1f24cb){return _0x1f24cb[_0xe5c5('0x21')](_0x31a177)[_0xe5c5('0x22')](function(_0x33c20c){return _0x33c20c;});}return null;};}function removeEntity(_0x4b4333,_0x34be04){return function(_0x283062){if(_0x283062){return _0x283062[_0xe5c5('0x23')]()[_0xe5c5('0x22')](function(){var _0x46d680=_0x283062[_0xe5c5('0x24')]({'plain':!![]});var _0x53bb6f=_0xe5c5('0x25');return db[_0xe5c5('0x26')]['destroy']({'where':{'type':_0x53bb6f,'resourceId':_0x46d680['id']}})['then'](function(){return _0x283062;});})[_0xe5c5('0x22')](function(){_0x4b4333[_0xe5c5('0x18')](0xcc)[_0xe5c5('0x19')]();});}};}function handleEntityNotFound(_0x234ec7,_0x22bef){return function(_0x3567f4){if(!_0x3567f4){_0x234ec7[_0xe5c5('0x27')](0x194);}return _0x3567f4;};}function handleError(_0x5f3a5a,_0x44feab){_0x44feab=_0x44feab||0x1f4;return function(_0x23f84b){logger['error'](_0x23f84b['stack']);if(_0x23f84b['name']){delete _0x23f84b[_0xe5c5('0x28')];}_0x5f3a5a[_0xe5c5('0x18')](_0x44feab)[_0xe5c5('0x29')](_0x23f84b);};}exports[_0xe5c5('0x2a')]=function(_0x2fdeb9,_0x11cade){var _0x4e0095={},_0x4b754c={},_0x416b69={'count':0x0,'rows':[]};var _0x2cbde5=_[_0xe5c5('0x2b')](db[_0xe5c5('0x2c')][_0xe5c5('0x2d')],function(_0x4b0820){return{'name':_0x4b0820[_0xe5c5('0x2e')],'type':_0x4b0820[_0xe5c5('0x2f')][_0xe5c5('0x30')]};});_0x4b754c[_0xe5c5('0x31')]=_['map'](_0x2cbde5,_0xe5c5('0x28'));_0x4b754c[_0xe5c5('0x32')]=_[_0xe5c5('0x33')](_0x2fdeb9[_0xe5c5('0x32')]);_0x4b754c[_0xe5c5('0x34')]=_[_0xe5c5('0x35')](_0x4b754c['model'],_0x4b754c[_0xe5c5('0x32')]);_0x4e0095['attributes']=_[_0xe5c5('0x35')](_0x4b754c[_0xe5c5('0x31')],qs[_0xe5c5('0x36')](_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x36')]));_0x4e0095[_0xe5c5('0x37')]=_0x4e0095[_0xe5c5('0x37')][_0xe5c5('0x38')]?_0x4e0095['attributes']:_0x4b754c['model'];if(!_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x39')](_0xe5c5('0x3a'))){_0x4e0095[_0xe5c5('0x1c')]=qs[_0xe5c5('0x1c')](_0x2fdeb9[_0xe5c5('0x32')]['limit']);_0x4e0095['offset']=qs['offset'](_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x1e')]);}_0x4e0095[_0xe5c5('0x3b')]=qs[_0xe5c5('0x3c')](_0x2fdeb9['query'][_0xe5c5('0x3c')]);_0x4e0095[_0xe5c5('0x3d')]=qs[_0xe5c5('0x34')](_[_0xe5c5('0x3e')](_0x2fdeb9[_0xe5c5('0x32')],_0x4b754c[_0xe5c5('0x34')]),_0x2cbde5);if(_0x2fdeb9['query'][_0xe5c5('0x3f')]){_0x4e0095[_0xe5c5('0x3d')]=_[_0xe5c5('0x40')](_0x4e0095[_0xe5c5('0x3d')],{'$or':_[_0xe5c5('0x2b')](_0x2cbde5,function(_0x5056af){if(_0x5056af[_0xe5c5('0x2f')]!==_0xe5c5('0x41')){var _0x892e99={};_0x892e99[_0x5056af[_0xe5c5('0x28')]]={'$like':'%'+_0x2fdeb9[_0xe5c5('0x32')][_0xe5c5('0x3f')]+'%'};return _0x892e99;}})});}_0x4e0095=_['merge']({},_0x4e0095,_0x2fdeb9[_0xe5c5('0x42')]);var _0xebc5e3={'where':_0x4e0095[_0xe5c5('0x3d')]};return db[_0xe5c5('0x2c')]['count'](_0xebc5e3)[_0xe5c5('0x22')](function(_0x3c719a){_0x416b69['count']=_0x3c719a;if(_0x2fdeb9[_0xe5c5('0x32')]['includeAll']){_0x4e0095[_0xe5c5('0x43')]=[{'all':!![]}];}return db[_0xe5c5('0x2c')][_0xe5c5('0x44')](_0x4e0095);})['then'](function(_0x4f3aff){_0x416b69[_0xe5c5('0x45')]=_0x4f3aff;return _0x416b69;})[_0xe5c5('0x22')](respondWithFilteredResult(_0x11cade,_0x4e0095))[_0xe5c5('0x46')](handleError(_0x11cade,null));};exports[_0xe5c5('0x47')]=function(_0x10bd1c,_0x1050b0){var _0x57b818={'raw':![],'where':{'id':_0x10bd1c[_0xe5c5('0x48')]['id']}},_0x5de79d={};_0x5de79d[_0xe5c5('0x31')]=_[_0xe5c5('0x33')](db[_0xe5c5('0x2c')][_0xe5c5('0x2d')]);_0x5de79d[_0xe5c5('0x32')]=_[_0xe5c5('0x33')](_0x10bd1c[_0xe5c5('0x32')]);_0x5de79d['filters']=_[_0xe5c5('0x35')](_0x5de79d[_0xe5c5('0x31')],_0x5de79d[_0xe5c5('0x32')]);_0x57b818[_0xe5c5('0x37')]=_[_0xe5c5('0x35')](_0x5de79d['model'],qs[_0xe5c5('0x36')](_0x10bd1c[_0xe5c5('0x32')]['fields']));_0x57b818[_0xe5c5('0x37')]=_0x57b818[_0xe5c5('0x37')]['length']?_0x57b818['attributes']:_0x5de79d[_0xe5c5('0x31')];if(_0x10bd1c['query']['includeAll']){_0x57b818[_0xe5c5('0x43')]=[{'all':!![]}];}_0x57b818=_[_0xe5c5('0x40')]({},_0x57b818,_0x10bd1c['options']);return db[_0xe5c5('0x2c')]['find'](_0x57b818)[_0xe5c5('0x22')](handleEntityNotFound(_0x1050b0,null))['then'](respondWithResult(_0x1050b0,null))[_0xe5c5('0x46')](handleError(_0x1050b0,null));};exports[_0xe5c5('0x49')]=function(_0x3e7857,_0x14f309){return db[_0xe5c5('0x2c')][_0xe5c5('0x49')](_0x3e7857[_0xe5c5('0x4a')],{})[_0xe5c5('0x22')](function(_0x1565b4){var _0x5d91e2=_0x3e7857[_0xe5c5('0x4b')][_0xe5c5('0x24')]({'plain':!![]});if(!_0x5d91e2)throw new Error(_0xe5c5('0x4c'));if(_0x5d91e2[_0xe5c5('0x4d')]===_0xe5c5('0x4b')){var _0x27c7c3=_0x1565b4['get']({'plain':!![]});var _0x443d99='Scheduler';return db[_0xe5c5('0x4e')][_0xe5c5('0x4f')]({'where':{'name':_0x443d99,'userProfileId':_0x5d91e2[_0xe5c5('0x50')]},'raw':!![]})[_0xe5c5('0x22')](function(_0x3802c6){if(_0x3802c6&&_0x3802c6[_0xe5c5('0x51')]===0x0){return db[_0xe5c5('0x26')][_0xe5c5('0x49')]({'name':_0x27c7c3['name'],'resourceId':_0x27c7c3['id'],'type':_0x3802c6[_0xe5c5('0x28')],'sectionId':_0x3802c6['id']},{})[_0xe5c5('0x22')](function(){return _0x1565b4;});}else{return _0x1565b4;}})[_0xe5c5('0x46')](function(_0x297a86){logger[_0xe5c5('0x52')](_0xe5c5('0x53'),_0x297a86);throw _0x297a86;});}return _0x1565b4;})[_0xe5c5('0x22')](respondWithResult(_0x14f309,0xc9))[_0xe5c5('0x46')](handleError(_0x14f309,null));};exports[_0xe5c5('0x21')]=function(_0x2ff7cb,_0x1641cd){if(_0x2ff7cb['body']['id']){delete _0x2ff7cb[_0xe5c5('0x4a')]['id'];}return db[_0xe5c5('0x2c')][_0xe5c5('0x4f')]({'where':{'id':_0x2ff7cb['params']['id']}})[_0xe5c5('0x22')](handleEntityNotFound(_0x1641cd,null))['then'](saveUpdates(_0x2ff7cb[_0xe5c5('0x4a')],null))[_0xe5c5('0x22')](respondWithResult(_0x1641cd,null))[_0xe5c5('0x46')](handleError(_0x1641cd,null));};exports[_0xe5c5('0x23')]=function(_0x544015,_0x36a560){return db['Schedule'][_0xe5c5('0x4f')]({'where':{'id':_0x544015['params']['id']}})[_0xe5c5('0x22')](handleEntityNotFound(_0x36a560,null))[_0xe5c5('0x22')](removeEntity(_0x36a560,null))[_0xe5c5('0x46')](handleError(_0x36a560,null));};exports[_0xe5c5('0x54')]=function(_0x18cf53,_0x4fa760,_0x251b4e){var _0x31654d=require(_0xe5c5('0x55'));return db[_0xe5c5('0x2c')][_0xe5c5('0x4f')]({'where':{'id':_0x18cf53[_0xe5c5('0x48')]['id']},'raw':!![]})[_0xe5c5('0x22')](handleEntityNotFound(_0x4fa760,null))[_0xe5c5('0x22')](function(){_0x31654d[_0xe5c5('0x54')](_0x18cf53['params']['id']);})[_0xe5c5('0x22')](respondWithStatusCode(_0x4fa760,null))[_0xe5c5('0x46')](handleError(_0x4fa760,null));}; \ No newline at end of file +var _0xc68a=['fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','get','Scheduler','UserProfileResource','then','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','run','../../config/schedule','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc68a,0x149));var _0xac68=function(_0x4e0c67,_0x5bc8e3){_0x4e0c67=_0x4e0c67-0x0;var _0x3455e5=_0xc68a[_0x4e0c67];return _0x3455e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac68('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac68('0x1'));var rp=require(_0xac68('0x2'));var moment=require(_0xac68('0x3'));var BPromise=require(_0xac68('0x4'));var Mustache=require(_0xac68('0x5'));var util=require(_0xac68('0x6'));var path=require(_0xac68('0x7'));var sox=require(_0xac68('0x8'));var csv=require(_0xac68('0x9'));var ejs=require(_0xac68('0xa'));var fs=require('fs');var fs_extra=require(_0xac68('0xb'));var _=require(_0xac68('0xc'));var squel=require(_0xac68('0xd'));var crypto=require(_0xac68('0xe'));var jsforce=require(_0xac68('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xac68('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac68('0x10'));var authService=require(_0xac68('0x11'));var qs=require(_0xac68('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac68('0x13'));var logger=require(_0xac68('0x14'))(_0xac68('0x15'));var utils=require('../../config/utils');var config=require(_0xac68('0x16'));var licenseUtil=require(_0xac68('0x17'));var db=require(_0xac68('0x18'))['db'];function respondWithStatusCode(_0x5e71f6,_0x11dcfc){_0x11dcfc=_0x11dcfc||0xcc;return function(_0x37b424){if(_0x37b424){return _0x5e71f6['sendStatus'](_0x11dcfc);}return _0x5e71f6['status'](_0x11dcfc)[_0xac68('0x19')]();};}function respondWithResult(_0x45b25d,_0x573142){_0x573142=_0x573142||0xc8;return function(_0x197d31){if(_0x197d31){return _0x45b25d[_0xac68('0x1a')](_0x573142)[_0xac68('0x1b')](_0x197d31);}};}function respondWithFilteredResult(_0x175fdd,_0x523c55){return function(_0x4eae93){if(_0x4eae93){var _0x43effd=typeof _0x523c55['offset']===_0xac68('0x1c')&&typeof _0x523c55[_0xac68('0x1d')]==='undefined';var _0x5c0933=_0x4eae93[_0xac68('0x1e')];var _0x47ed17=_0x43effd?0x0:_0x523c55[_0xac68('0x1f')];var _0xff2dd1=_0x43effd?_0x4eae93[_0xac68('0x1e')]:_0x523c55[_0xac68('0x1f')]+_0x523c55[_0xac68('0x1d')];var _0x9e0f35;if(_0xff2dd1>=_0x5c0933){_0xff2dd1=_0x5c0933;_0x9e0f35=0xc8;}else{_0x9e0f35=0xce;}_0x175fdd[_0xac68('0x1a')](_0x9e0f35);return _0x175fdd['set'](_0xac68('0x20'),_0x47ed17+'-'+_0xff2dd1+'/'+_0x5c0933)[_0xac68('0x1b')](_0x4eae93);}return null;};}function patchUpdates(_0x241b21){return function(_0xa30ecb){try{jsonpatch[_0xac68('0x21')](_0xa30ecb,_0x241b21,!![]);}catch(_0x1a26cc){return BPromise[_0xac68('0x22')](_0x1a26cc);}return _0xa30ecb['save']();};}function saveUpdates(_0x3d6ad0,_0x2b1484){return function(_0x5e61a1){if(_0x5e61a1){return _0x5e61a1[_0xac68('0x23')](_0x3d6ad0)['then'](function(_0x1187bc){return _0x1187bc;});}return null;};}function removeEntity(_0x1a9607,_0x2dca0f){return function(_0x376e25){if(_0x376e25){return _0x376e25[_0xac68('0x24')]()['then'](function(){var _0x4c1a36=_0x376e25[_0xac68('0x25')]({'plain':!![]});var _0x30e580=_0xac68('0x26');return db[_0xac68('0x27')]['destroy']({'where':{'type':_0x30e580,'resourceId':_0x4c1a36['id']}})[_0xac68('0x28')](function(){return _0x376e25;});})[_0xac68('0x28')](function(){_0x1a9607[_0xac68('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e30c1,_0x8cbc4a){return function(_0x142342){if(!_0x142342){_0x5e30c1[_0xac68('0x29')](0x194);}return _0x142342;};}function handleError(_0x15011e,_0x5e08a2){_0x5e08a2=_0x5e08a2||0x1f4;return function(_0x4c3b9b){logger[_0xac68('0x2a')](_0x4c3b9b[_0xac68('0x2b')]);if(_0x4c3b9b[_0xac68('0x2c')]){delete _0x4c3b9b['name'];}_0x15011e['status'](_0x5e08a2)[_0xac68('0x2d')](_0x4c3b9b);};}exports[_0xac68('0x2e')]=function(_0x3b37ae,_0x1d94fe){var _0xd1174b={},_0x2dfda6={},_0x43a457={'count':0x0,'rows':[]};var _0x2051ec=_['map'](db[_0xac68('0x2f')][_0xac68('0x30')],function(_0x1de7b7){return{'name':_0x1de7b7['fieldName'],'type':_0x1de7b7[_0xac68('0x31')]['key']};});_0x2dfda6['model']=_[_0xac68('0x32')](_0x2051ec,_0xac68('0x2c'));_0x2dfda6[_0xac68('0x33')]=_[_0xac68('0x34')](_0x3b37ae[_0xac68('0x33')]);_0x2dfda6['filters']=_[_0xac68('0x35')](_0x2dfda6[_0xac68('0x36')],_0x2dfda6[_0xac68('0x33')]);_0xd1174b[_0xac68('0x37')]=_['intersection'](_0x2dfda6[_0xac68('0x36')],qs['fields'](_0x3b37ae['query'][_0xac68('0x38')]));_0xd1174b[_0xac68('0x37')]=_0xd1174b['attributes'][_0xac68('0x39')]?_0xd1174b[_0xac68('0x37')]:_0x2dfda6[_0xac68('0x36')];if(!_0x3b37ae[_0xac68('0x33')][_0xac68('0x3a')](_0xac68('0x3b'))){_0xd1174b['limit']=qs[_0xac68('0x1d')](_0x3b37ae[_0xac68('0x33')]['limit']);_0xd1174b[_0xac68('0x1f')]=qs[_0xac68('0x1f')](_0x3b37ae[_0xac68('0x33')][_0xac68('0x1f')]);}_0xd1174b[_0xac68('0x3c')]=qs[_0xac68('0x3d')](_0x3b37ae['query'][_0xac68('0x3d')]);_0xd1174b[_0xac68('0x3e')]=qs[_0xac68('0x3f')](_[_0xac68('0x40')](_0x3b37ae[_0xac68('0x33')],_0x2dfda6['filters']),_0x2051ec);if(_0x3b37ae[_0xac68('0x33')][_0xac68('0x41')]){_0xd1174b[_0xac68('0x3e')]=_['merge'](_0xd1174b[_0xac68('0x3e')],{'$or':_['map'](_0x2051ec,function(_0x36132b){if(_0x36132b[_0xac68('0x31')]!==_0xac68('0x42')){var _0x161967={};_0x161967[_0x36132b[_0xac68('0x2c')]]={'$like':'%'+_0x3b37ae[_0xac68('0x33')][_0xac68('0x41')]+'%'};return _0x161967;}})});}_0xd1174b=_['merge']({},_0xd1174b,_0x3b37ae[_0xac68('0x43')]);var _0x5b2d14={'where':_0xd1174b[_0xac68('0x3e')]};return db[_0xac68('0x2f')][_0xac68('0x1e')](_0x5b2d14)[_0xac68('0x28')](function(_0x2cde49){_0x43a457['count']=_0x2cde49;if(_0x3b37ae[_0xac68('0x33')][_0xac68('0x44')]){_0xd1174b[_0xac68('0x45')]=[{'all':!![]}];}return db[_0xac68('0x2f')][_0xac68('0x46')](_0xd1174b);})[_0xac68('0x28')](function(_0x460dd7){_0x43a457[_0xac68('0x47')]=_0x460dd7;return _0x43a457;})[_0xac68('0x28')](respondWithFilteredResult(_0x1d94fe,_0xd1174b))[_0xac68('0x48')](handleError(_0x1d94fe,null));};exports['show']=function(_0x237184,_0x85f4b1){var _0x25309c={'raw':![],'where':{'id':_0x237184['params']['id']}},_0x3c0111={};_0x3c0111[_0xac68('0x36')]=_[_0xac68('0x34')](db[_0xac68('0x2f')][_0xac68('0x30')]);_0x3c0111[_0xac68('0x33')]=_[_0xac68('0x34')](_0x237184[_0xac68('0x33')]);_0x3c0111[_0xac68('0x3f')]=_[_0xac68('0x35')](_0x3c0111[_0xac68('0x36')],_0x3c0111[_0xac68('0x33')]);_0x25309c['attributes']=_[_0xac68('0x35')](_0x3c0111['model'],qs[_0xac68('0x38')](_0x237184[_0xac68('0x33')][_0xac68('0x38')]));_0x25309c[_0xac68('0x37')]=_0x25309c[_0xac68('0x37')][_0xac68('0x39')]?_0x25309c['attributes']:_0x3c0111[_0xac68('0x36')];if(_0x237184[_0xac68('0x33')]['includeAll']){_0x25309c[_0xac68('0x45')]=[{'all':!![]}];}_0x25309c=_['merge']({},_0x25309c,_0x237184[_0xac68('0x43')]);return db[_0xac68('0x2f')]['find'](_0x25309c)['then'](handleEntityNotFound(_0x85f4b1,null))[_0xac68('0x28')](respondWithResult(_0x85f4b1,null))['catch'](handleError(_0x85f4b1,null));};exports['create']=function(_0x35dcab,_0x163c25){return db[_0xac68('0x2f')][_0xac68('0x49')](_0x35dcab[_0xac68('0x4a')],{})[_0xac68('0x28')](function(_0x578dd6){var _0x306e97=_0x35dcab[_0xac68('0x4b')][_0xac68('0x25')]({'plain':!![]});if(!_0x306e97)throw new Error(_0xac68('0x4c'));if(_0x306e97[_0xac68('0x4d')]===_0xac68('0x4b')){var _0x4a2009=_0x578dd6[_0xac68('0x25')]({'plain':!![]});var _0x157388=_0xac68('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x157388,'userProfileId':_0x306e97[_0xac68('0x4e')]},'raw':!![]})['then'](function(_0x197b4b){if(_0x197b4b&&_0x197b4b[_0xac68('0x4f')]===0x0){return db[_0xac68('0x27')][_0xac68('0x49')]({'name':_0x4a2009[_0xac68('0x2c')],'resourceId':_0x4a2009['id'],'type':_0x197b4b[_0xac68('0x2c')],'sectionId':_0x197b4b['id']},{})[_0xac68('0x28')](function(){return _0x578dd6;});}else{return _0x578dd6;}})[_0xac68('0x48')](function(_0x127676){logger['error'](_0xac68('0x50'),_0x127676);throw _0x127676;});}return _0x578dd6;})['then'](respondWithResult(_0x163c25,0xc9))[_0xac68('0x48')](handleError(_0x163c25,null));};exports[_0xac68('0x23')]=function(_0x24c7f3,_0x2b434e){if(_0x24c7f3[_0xac68('0x4a')]['id']){delete _0x24c7f3['body']['id'];}return db['Schedule'][_0xac68('0x51')]({'where':{'id':_0x24c7f3[_0xac68('0x52')]['id']}})[_0xac68('0x28')](handleEntityNotFound(_0x2b434e,null))[_0xac68('0x28')](saveUpdates(_0x24c7f3['body'],null))['then'](respondWithResult(_0x2b434e,null))[_0xac68('0x48')](handleError(_0x2b434e,null));};exports[_0xac68('0x24')]=function(_0x307683,_0x5134fe){return db['Schedule'][_0xac68('0x51')]({'where':{'id':_0x307683[_0xac68('0x52')]['id']}})[_0xac68('0x28')](handleEntityNotFound(_0x5134fe,null))[_0xac68('0x28')](removeEntity(_0x5134fe,null))['catch'](handleError(_0x5134fe,null));};exports[_0xac68('0x53')]=function(_0x2db4d5,_0x40f755,_0x551941){var _0x452a31=require(_0xac68('0x54'));return db[_0xac68('0x2f')][_0xac68('0x51')]({'where':{'id':_0x2db4d5[_0xac68('0x52')]['id']},'raw':!![]})[_0xac68('0x28')](handleEntityNotFound(_0x40f755,null))[_0xac68('0x28')](function(){_0x452a31[_0xac68('0x53')](_0x2db4d5[_0xac68('0x52')]['id']);})[_0xac68('0x28')](respondWithStatusCode(_0x40f755,null))['catch'](handleError(_0x40f755,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 74e7c89..e10fd6c 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 _0xe765=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x15c4df,_0x1e3d1f){var _0xe7cb8=function(_0x57203f){while(--_0x57203f){_0x15c4df['push'](_0x15c4df['shift']());}};_0xe7cb8(++_0x1e3d1f);}(_0xe765,0x17b));var _0x5e76=function(_0x3f44e8,_0x2157b2){_0x3f44e8=_0x3f44e8-0x0;var _0x388071=_0xe765[_0x3f44e8];return _0x388071;};'use strict';var _=require(_0x5e76('0x0'));var util=require(_0x5e76('0x1'));var logger=require(_0x5e76('0x2'))(_0x5e76('0x3'));var moment=require(_0x5e76('0x4'));var BPromise=require(_0x5e76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e76('0x6'));var rimraf=require(_0x5e76('0x7'));var config=require(_0x5e76('0x8'));var attributes=require('./schedule.attributes');module[_0x5e76('0x9')]=function(_0x5e6066,_0x11c0a6){return _0x5e6066[_0x5e76('0xa')](_0x5e76('0xb'),attributes,{'tableName':_0x5e76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6b=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','tools_schedules'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a6b,0x64));var _0xb3a6=function(_0x44b8d4,_0xd22cc1){_0x44b8d4=_0x44b8d4-0x0;var _0x10b755=_0x3a6b[_0x44b8d4];return _0x10b755;};'use strict';var _=require(_0xb3a6('0x0'));var util=require('util');var logger=require(_0xb3a6('0x1'))(_0xb3a6('0x2'));var moment=require('moment');var BPromise=require(_0xb3a6('0x3'));var rp=require(_0xb3a6('0x4'));var fs=require('fs');var path=require(_0xb3a6('0x5'));var rimraf=require(_0xb3a6('0x6'));var config=require('../../config/environment');var attributes=require(_0xb3a6('0x7'));module[_0xb3a6('0x8')]=function(_0x54f2e0,_0x490340){return _0x54f2e0['define']('Schedule',attributes,{'tableName':_0xb3a6('0x9'),'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 69f4a53..c56650c 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 _0x7fca=['../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x17485b,_0x26a84b){var _0x2532d3=function(_0x5a6629){while(--_0x5a6629){_0x17485b['push'](_0x17485b['shift']());}};_0x2532d3(++_0x26a84b);}(_0x7fca,0x91));var _0xa7fc=function(_0x34a176,_0x1714c8){_0x34a176=_0x34a176-0x0;var _0x442892=_0x7fca[_0x34a176];return _0x442892;};'use strict';var _=require(_0xa7fc('0x0'));var util=require(_0xa7fc('0x1'));var moment=require(_0xa7fc('0x2'));var BPromise=require(_0xa7fc('0x3'));var rs=require(_0xa7fc('0x4'));var fs=require('fs');var Redis=require(_0xa7fc('0x5'));var db=require(_0xa7fc('0x6'))['db'];var utils=require(_0xa7fc('0x7'));var logger=require('../../config/logger')(_0xa7fc('0x8'));var config=require(_0xa7fc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7fc('0xa')][_0xa7fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x540b23,_0x26ae63,_0x152ed1){return new BPromise(function(_0x14a859,_0x441883){return client[_0xa7fc('0xc')](_0x540b23,_0x152ed1)['then'](function(_0x1eb306){logger[_0xa7fc('0xd')](_0xa7fc('0xe'),_0x26ae63,'request\x20sent');logger['debug'](_0xa7fc('0xf'),_0x26ae63,'request\x20sent',JSON[_0xa7fc('0x10')](_0x1eb306));if(_0x1eb306[_0xa7fc('0x11')]){if(_0x1eb306['error']['code']===0x1f4){logger[_0xa7fc('0x11')](_0xa7fc('0xe'),_0x26ae63,_0x1eb306[_0xa7fc('0x11')][_0xa7fc('0x12')]);return _0x441883(_0x1eb306[_0xa7fc('0x11')][_0xa7fc('0x12')]);}logger[_0xa7fc('0x11')](_0xa7fc('0xe'),_0x26ae63,_0x1eb306['error']['message']);return _0x14a859(_0x1eb306[_0xa7fc('0x11')]['message']);}else{logger[_0xa7fc('0xd')]('Schedule,\x20%s,\x20%s',_0x26ae63,_0xa7fc('0x13'));_0x14a859(_0x1eb306[_0xa7fc('0x14')][_0xa7fc('0x12')]);}})[_0xa7fc('0x15')](function(_0x1d16df){logger['error']('Schedule,\x20%s,\x20%s',_0x26ae63,_0x1d16df);_0x441883(_0x1d16df);});});} \ No newline at end of file +var _0x8f0f=['info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','Schedule,\x20%s,\x20%s','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x46f2d2,_0x2e599a){var _0x565ab1=function(_0x5e7432){while(--_0x5e7432){_0x46f2d2['push'](_0x46f2d2['shift']());}};_0x565ab1(++_0x2e599a);}(_0x8f0f,0x1c1));var _0xf8f0=function(_0x4c476e,_0x2330ae){_0x4c476e=_0x4c476e-0x0;var _0xcc588c=_0x8f0f[_0x4c476e];return _0xcc588c;};'use strict';var _=require(_0xf8f0('0x0'));var util=require(_0xf8f0('0x1'));var moment=require('moment');var BPromise=require(_0xf8f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8f0('0x3'))['db'];var utils=require(_0xf8f0('0x4'));var logger=require(_0xf8f0('0x5'))(_0xf8f0('0x6'));var config=require(_0xf8f0('0x7'));var jayson=require(_0xf8f0('0x8'));var client=jayson[_0xf8f0('0x9')][_0xf8f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b5ee2,_0xb9b854,_0x5e20b8){return new BPromise(function(_0x378c7a,_0x4af84a){return client[_0xf8f0('0xb')](_0x5b5ee2,_0x5e20b8)[_0xf8f0('0xc')](function(_0x17878f){logger[_0xf8f0('0xd')]('Schedule,\x20%s,\x20%s',_0xb9b854,_0xf8f0('0xe'));logger[_0xf8f0('0xf')](_0xf8f0('0x10'),_0xb9b854,_0xf8f0('0xe'),JSON[_0xf8f0('0x11')](_0x17878f));if(_0x17878f[_0xf8f0('0x12')]){if(_0x17878f[_0xf8f0('0x12')]['code']===0x1f4){logger[_0xf8f0('0x12')]('Schedule,\x20%s,\x20%s',_0xb9b854,_0x17878f['error']['message']);return _0x4af84a(_0x17878f[_0xf8f0('0x12')][_0xf8f0('0x13')]);}logger[_0xf8f0('0x12')](_0xf8f0('0x14'),_0xb9b854,_0x17878f['error']['message']);return _0x378c7a(_0x17878f['error'][_0xf8f0('0x13')]);}else{logger[_0xf8f0('0xd')](_0xf8f0('0x14'),_0xb9b854,_0xf8f0('0xe'));_0x378c7a(_0x17878f['result'][_0xf8f0('0x13')]);}})['catch'](function(_0x4004a0){logger[_0xf8f0('0x12')]('Schedule,\x20%s,\x20%s',_0xb9b854,_0x4004a0);_0x4af84a(_0x4004a0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 786fd18..a083079 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 _0x827d=['isAuthenticated','/:id/download','post','create','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0xc3c3c3,_0x581f99){var _0x33ef9c=function(_0xd889c9){while(--_0xd889c9){_0xc3c3c3['push'](_0xc3c3c3['shift']());}};_0x33ef9c(++_0x581f99);}(_0x827d,0x194));var _0xd827=function(_0x368ba4,_0xcbf87e){_0x368ba4=_0x368ba4-0x0;var _0x1988a5=_0x827d[_0x368ba4];return _0x1988a5;};'use strict';var multer=require(_0xd827('0x0'));var util=require(_0xd827('0x1'));var path=require('path');var timeout=require(_0xd827('0x2'));var express=require(_0xd827('0x3'));var router=express[_0xd827('0x4')]();var fs_extra=require(_0xd827('0x5'));var auth=require(_0xd827('0x6'));var interaction=require(_0xd827('0x7'));var config=require('../../config/environment');var controller=require(_0xd827('0x8'));router[_0xd827('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd827('0x9')]('/describe',auth[_0xd827('0xa')](),controller['describe']);router['get']('/:id',auth[_0xd827('0xa')](),controller['show']);router[_0xd827('0x9')](_0xd827('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xd827('0xc')]('/',auth[_0xd827('0xa')](),controller[_0xd827('0xd')]);router['put']('/:id',auth[_0xd827('0xa')](),controller[_0xd827('0xe')]);router[_0xd827('0xf')](_0xd827('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xd827('0x11')]=router; \ No newline at end of file +var _0x1b72=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x50b4af,_0x19219a){var _0x449205=function(_0x3b3578){while(--_0x3b3578){_0x50b4af['push'](_0x50b4af['shift']());}};_0x449205(++_0x19219a);}(_0x1b72,0x7d));var _0x21b7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x1b72[_0x5f3f88];return _0xd08119;};'use strict';var multer=require('multer');var util=require(_0x21b7('0x0'));var path=require(_0x21b7('0x1'));var timeout=require(_0x21b7('0x2'));var express=require(_0x21b7('0x3'));var router=express[_0x21b7('0x4')]();var fs_extra=require(_0x21b7('0x5'));var auth=require(_0x21b7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21b7('0x7'));router[_0x21b7('0x8')]('/',auth[_0x21b7('0x9')](),controller['index']);router[_0x21b7('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x21b7('0xa'),auth[_0x21b7('0x9')](),controller[_0x21b7('0xb')]);router[_0x21b7('0x8')](_0x21b7('0xc'),auth[_0x21b7('0x9')](),controller[_0x21b7('0xd')]);router[_0x21b7('0xe')]('/',auth[_0x21b7('0x9')](),controller['create']);router[_0x21b7('0xf')](_0x21b7('0xa'),auth[_0x21b7('0x9')](),controller[_0x21b7('0x10')]);router[_0x21b7('0x11')](_0x21b7('0xa'),auth['isAuthenticated'](),controller[_0x21b7('0x12')]);module[_0x21b7('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 72e90e0..df3d641 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 _0x288a=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','path','../../config/environment','exports','value','getDataValue','STRING'];(function(_0x4c618f,_0x368d77){var _0x187f6e=function(_0x2db8af){while(--_0x2db8af){_0x4c618f['push'](_0x4c618f['shift']());}};_0x187f6e(++_0x368d77);}(_0x288a,0x188));var _0xa288=function(_0x5bd524,_0xdd612f){_0x5bd524=_0x5bd524-0x0;var _0x6bb45d=_0x288a[_0x5bd524];return _0x6bb45d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var config=require(_0xa288('0x2'));module[_0xa288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa288('0x4'))?path['extname'](this[_0xa288('0x5')](_0xa288('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xa288('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa288('0x6')],'set':function(_0xaee90c){var _0x156720=_0xaee90c['replace'](/\\/g,'/');this[_0xa288('0x7')](_0xa288('0x4'),_0x156720);}},'rating':{'type':Sequelize[_0xa288('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa288('0x8')],'set':function(_0x1a0c06){this[_0xa288('0x7')](_0xa288('0x9'),moment()[_0xa288('0xa')](_0x1a0c06,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xa288('0xb'),_0x1a0c06);}},'startedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this['getDataValue'](_0xa288('0x9')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'closedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x10')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'createdAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x11')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x12')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}}}; \ No newline at end of file +var _0x9582=['INTEGER','startedAt','setDataValue','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace'];(function(_0x414233,_0x5f1b4a){var _0x44daa2=function(_0x1c829a){while(--_0x1c829a){_0x414233['push'](_0x414233['shift']());}};_0x44daa2(++_0x5f1b4a);}(_0x9582,0x95));var _0x2958=function(_0x1ee5d7,_0x40309c){_0x1ee5d7=_0x1ee5d7-0x0;var _0x1ab5e1=_0x9582[_0x1ee5d7];return _0x1ab5e1;};'use strict';var Sequelize=require(_0x2958('0x0'));var moment=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var config=require(_0x2958('0x3'));module[_0x2958('0x4')]={'format':{'type':Sequelize[_0x2958('0x5')],'get':function(){return this['getDataValue'](_0x2958('0x6'))?path[_0x2958('0x7')](this[_0x2958('0x8')](_0x2958('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x2958('0x9')]},'channel':{'type':Sequelize[_0x2958('0x9')]},'value':{'type':Sequelize[_0x2958('0x9')],'set':function(_0x309525){var _0xa385ec=_0x309525[_0x2958('0xa')](/\\/g,'/');this['setDataValue']('value',_0xa385ec);}},'rating':{'type':Sequelize[_0x2958('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x10db1e){this['setDataValue'](_0x2958('0xc'),moment()['subtract'](_0x10db1e,'ms'));this[_0x2958('0xd')](_0x2958('0xe'),moment());this[_0x2958('0xd')](_0x2958('0xf'),_0x10db1e);}},'startedAt':{'type':Sequelize[_0x2958('0x10')],'get':function(){return moment(this['getDataValue'](_0x2958('0xc')))[_0x2958('0x11')](_0x2958('0x12'))[_0x2958('0x13')]();}},'closedAt':{'type':Sequelize[_0x2958('0x10')],'get':function(){return moment(this[_0x2958('0x8')](_0x2958('0xe')))[_0x2958('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x2958('0x13')]();}},'createdAt':{'type':Sequelize[_0x2958('0x10')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x2958('0x11')](_0x2958('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2958('0x10')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x2958('0x11')](_0x2958('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 177ad3f..76c8c32 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 _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x30c4e9,_0x58a3e5){var _0x36d534=function(_0x452b82){while(--_0x452b82){_0x30c4e9['push'](_0x30c4e9['shift']());}};_0x36d534(++_0x58a3e5);}(_0x5c12,0x188));var _0x25c1=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x5c12[_0x41b0a8];return _0x3a83d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file +var _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x15259c,_0x4410de){_0x15259c=_0x15259c-0x0;var _0x308baa=_0xdbf5[_0x15259c];return _0x308baa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3eddd66..1c2d485 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 _0x30b3=['path','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3a752b,_0x327c12){var _0x4976f0=function(_0xeef498){while(--_0xeef498){_0x3a752b['push'](_0x3a752b['shift']());}};_0x4976f0(++_0x327c12);}(_0x30b3,0x1ce));var _0x330b=function(_0x2fcd34,_0x3d237a){_0x2fcd34=_0x2fcd34-0x0;var _0x4f51c8=_0x30b3[_0x2fcd34];return _0x4f51c8;};'use strict';var _=require(_0x330b('0x0'));var util=require(_0x330b('0x1'));var logger=require(_0x330b('0x2'))(_0x330b('0x3'));var moment=require(_0x330b('0x4'));var BPromise=require('bluebird');var rp=require(_0x330b('0x5'));var fs=require('fs');var path=require(_0x330b('0x6'));var rimraf=require('rimraf');var config=require(_0x330b('0x7'));var attributes=require('./screenRecording.attributes');module[_0x330b('0x8')]=function(_0x7b4bb6,_0x34438e){return _0x7b4bb6[_0x330b('0x9')](_0x330b('0xa'),attributes,{'tableName':_0x330b('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x330b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x08e4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','api'];(function(_0x27b4c7,_0xd847e6){var _0x3000b9=function(_0x57ef4b){while(--_0x57ef4b){_0x27b4c7['push'](_0x27b4c7['shift']());}};_0x3000b9(++_0xd847e6);}(_0x08e4,0x1d1));var _0x408e=function(_0x22f0ec,_0x88225e){_0x22f0ec=_0x22f0ec-0x0;var _0x40cd33=_0x08e4[_0x22f0ec];return _0x40cd33;};'use strict';var _=require(_0x408e('0x0'));var util=require(_0x408e('0x1'));var logger=require('../../config/logger')(_0x408e('0x2'));var moment=require(_0x408e('0x3'));var BPromise=require(_0x408e('0x4'));var rp=require(_0x408e('0x5'));var fs=require('fs');var path=require(_0x408e('0x6'));var rimraf=require(_0x408e('0x7'));var config=require(_0x408e('0x8'));var attributes=require('./screenRecording.attributes');module[_0x408e('0x9')]=function(_0x3e184f,_0xce4091){return _0x3e184f['define'](_0x408e('0xa'),attributes,{'tableName':_0x408e('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x408e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 33f9940..775eace 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 _0xda06=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0xda06,0x186));var _0x6da0=function(_0x2e87e4,_0x591ef7){_0x2e87e4=_0x2e87e4-0x0;var _0x3c9855=_0xda06[_0x2e87e4];return _0x3c9855;};'use strict';var _=require(_0x6da0('0x0'));var util=require(_0x6da0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6da0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6da0('0x3'));var logger=require(_0x6da0('0x4'))(_0x6da0('0x5'));var config=require(_0x6da0('0x6'));var jayson=require(_0x6da0('0x7'));var client=jayson[_0x6da0('0x8')][_0x6da0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239134,_0x410bb7,_0x32bcb9){return new BPromise(function(_0x4f82da,_0x1c712d){return client[_0x6da0('0xa')](_0x239134,_0x32bcb9)[_0x6da0('0xb')](function(_0x35c06f){logger[_0x6da0('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x410bb7,_0x6da0('0xd'));logger[_0x6da0('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x410bb7,_0x6da0('0xd'),JSON[_0x6da0('0xf')](_0x35c06f));if(_0x35c06f[_0x6da0('0x10')]){if(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x11')]===0x1f4){logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x35c06f['error'][_0x6da0('0x13')]);return _0x1c712d(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x13')]);}logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x35c06f['error']['message']);return _0x4f82da(_0x35c06f[_0x6da0('0x10')][_0x6da0('0x13')]);}else{logger[_0x6da0('0xc')](_0x6da0('0x12'),_0x410bb7,'request\x20sent');_0x4f82da(_0x35c06f[_0x6da0('0x14')][_0x6da0('0x13')]);}})[_0x6da0('0x15')](function(_0x219b8a){logger[_0x6da0('0x10')](_0x6da0('0x12'),_0x410bb7,_0x219b8a);_0x1c712d(_0x219b8a);});});} \ No newline at end of file +var _0xb8a9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util'];(function(_0x34bab7,_0xedfc66){var _0x8319f7=function(_0x31e9e5){while(--_0x31e9e5){_0x34bab7['push'](_0x34bab7['shift']());}};_0x8319f7(++_0xedfc66);}(_0xb8a9,0x1e3));var _0x9b8a=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xb8a9[_0x1344d6];return _0xf45b24;};'use strict';var _=require('lodash');var util=require(_0x9b8a('0x0'));var moment=require(_0x9b8a('0x1'));var BPromise=require(_0x9b8a('0x2'));var rs=require(_0x9b8a('0x3'));var fs=require('fs');var Redis=require(_0x9b8a('0x4'));var db=require(_0x9b8a('0x5'))['db'];var utils=require(_0x9b8a('0x6'));var logger=require(_0x9b8a('0x7'))('rpc');var config=require(_0x9b8a('0x8'));var jayson=require(_0x9b8a('0x9'));var client=jayson[_0x9b8a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x82875d,_0x3f89bd,_0x5d3c03){return new BPromise(function(_0x1f1b3f,_0x3de609){return client['request'](_0x82875d,_0x5d3c03)[_0x9b8a('0xb')](function(_0x15d2cd){logger[_0x9b8a('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x3f89bd,'request\x20sent');logger[_0x9b8a('0xd')](_0x9b8a('0xe'),_0x3f89bd,_0x9b8a('0xf'),JSON['stringify'](_0x15d2cd));if(_0x15d2cd[_0x9b8a('0x10')]){if(_0x15d2cd['error'][_0x9b8a('0x11')]===0x1f4){logger[_0x9b8a('0x10')](_0x9b8a('0x12'),_0x3f89bd,_0x15d2cd[_0x9b8a('0x10')][_0x9b8a('0x13')]);return _0x3de609(_0x15d2cd['error'][_0x9b8a('0x13')]);}logger[_0x9b8a('0x10')](_0x9b8a('0x12'),_0x3f89bd,_0x15d2cd[_0x9b8a('0x10')][_0x9b8a('0x13')]);return _0x1f1b3f(_0x15d2cd[_0x9b8a('0x10')][_0x9b8a('0x13')]);}else{logger['info'](_0x9b8a('0x12'),_0x3f89bd,_0x9b8a('0xf'));_0x1f1b3f(_0x15d2cd[_0x9b8a('0x14')][_0x9b8a('0x13')]);}})[_0x9b8a('0x15')](function(_0x5bed79){logger[_0x9b8a('0x10')](_0x9b8a('0x12'),_0x3f89bd,_0x5bed79);_0x3de609(_0x5bed79);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6ded978..2ec855a 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 _0xd212=['/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','single','file','addLogo','logologin','addLogoLogin','preferred','post','/:id/preferred','addPreferred','put'];(function(_0x4472bf,_0x34a09e){var _0x4ef3f1=function(_0x135feb){while(--_0x135feb){_0x4472bf['push'](_0x4472bf['shift']());}};_0x4ef3f1(++_0x34a09e);}(_0xd212,0xda));var _0x2d21=function(_0x2a1e2d,_0x195473){_0x2a1e2d=_0x2a1e2d-0x0;var _0x32b8cc=_0xd212[_0x2a1e2d];return _0x32b8cc;};'use strict';var multer=require(_0x2d21('0x0'));var util=require(_0x2d21('0x1'));var path=require(_0x2d21('0x2'));var timeout=require(_0x2d21('0x3'));var express=require(_0x2d21('0x4'));var router=express[_0x2d21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d21('0x6'));var interaction=require(_0x2d21('0x7'));var config=require(_0x2d21('0x8'));var controller=require(_0x2d21('0x9'));router[_0x2d21('0xa')]('/',auth[_0x2d21('0xb')](),controller['index']);router[_0x2d21('0xa')](_0x2d21('0xc'),controller['getDate']);router[_0x2d21('0xa')]('/:id',controller[_0x2d21('0xd')]);router[_0x2d21('0xa')](_0x2d21('0xe'),controller['getLogo']);router['get'](_0x2d21('0xf'),controller[_0x2d21('0x10')]);router['get'](_0x2d21('0x11'),controller[_0x2d21('0x12')]);router[_0x2d21('0xa')]('/:id/preferred',controller[_0x2d21('0x13')]);router[_0x2d21('0xa')](_0x2d21('0x14'),controller[_0x2d21('0x15')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x30fdec,_0x337d55,_0x3224b2){_0x3224b2(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x15bf19,_0x3f20c8,_0x57252f){_0x57252f(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),'logo',path[_0x2d21('0x1c')](_0x3f20c8[_0x2d21('0x1d')])));}})});router['post'](_0x2d21('0xe'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller[_0x2d21('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3abf53,_0x236b1d,_0x4f1b01){_0x4f1b01(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x32cfe5,_0x1d6102,_0xdc2dd0){_0xdc2dd0(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),_0x2d21('0x21'),path[_0x2d21('0x1c')](_0x1d6102[_0x2d21('0x1d')])));}})});router['post'](_0x2d21('0xf'),upload[_0x2d21('0x1e')]('file'),controller[_0x2d21('0x22')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x3da4d8,_0x20ed8e,_0x18df33){_0x18df33(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x2a09e3,_0x340664,_0x51d7a1){_0x51d7a1(null,util[_0x2d21('0x1a')](_0x2d21('0x1b'),_0x2d21('0x23'),path[_0x2d21('0x1c')](_0x340664['originalname'])));}})});router[_0x2d21('0x24')](_0x2d21('0x25'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller[_0x2d21('0x26')]);var upload=multer({'storage':multer[_0x2d21('0x16')]({'destination':function(_0x1af208,_0x5da0d6,_0x20afea){_0x20afea(null,path[_0x2d21('0x17')](config[_0x2d21('0x18')],_0x2d21('0x19')));},'filename':function(_0x147be9,_0x2a6fec,_0x2e38be){_0x2e38be(null,util[_0x2d21('0x1a')]('%s%s','favicon',path['extname'](_0x2a6fec[_0x2d21('0x1d')])));}})});router[_0x2d21('0x24')](_0x2d21('0x14'),upload[_0x2d21('0x1e')](_0x2d21('0x1f')),controller['addFavicon']);router[_0x2d21('0x27')](_0x2d21('0x28'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x29')]);module[_0x2d21('0x2a')]=router; \ No newline at end of file +var _0x343f=['getFavicon','diskStorage','join','root','format','%s%s','extname','post','file','addLogo','server/files/images/logos/','logologin','originalname','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','/:id/favicon'];(function(_0x3c8812,_0x23dc9e){var _0xf92273=function(_0x5de6cf){while(--_0x5de6cf){_0x3c8812['push'](_0x3c8812['shift']());}};_0xf92273(++_0x23dc9e);}(_0x343f,0x1d8));var _0xf343=function(_0x265d1a,_0x3bb43a){_0x265d1a=_0x265d1a-0x0;var _0x4813ae=_0x343f[_0x265d1a];return _0x4813ae;};'use strict';var multer=require(_0xf343('0x0'));var util=require(_0xf343('0x1'));var path=require(_0xf343('0x2'));var timeout=require(_0xf343('0x3'));var express=require(_0xf343('0x4'));var router=express[_0xf343('0x5')]();var fs_extra=require(_0xf343('0x6'));var auth=require(_0xf343('0x7'));var interaction=require(_0xf343('0x8'));var config=require(_0xf343('0x9'));var controller=require(_0xf343('0xa'));router[_0xf343('0xb')]('/',auth[_0xf343('0xc')](),controller[_0xf343('0xd')]);router[_0xf343('0xb')](_0xf343('0xe'),controller['getDate']);router[_0xf343('0xb')](_0xf343('0xf'),controller[_0xf343('0x10')]);router[_0xf343('0xb')](_0xf343('0x11'),controller[_0xf343('0x12')]);router[_0xf343('0xb')](_0xf343('0x13'),controller[_0xf343('0x14')]);router[_0xf343('0xb')]('/:id/gdpr',controller['gdpr']);router['get'](_0xf343('0x15'),controller['getPreferred']);router[_0xf343('0xb')](_0xf343('0x16'),controller[_0xf343('0x17')]);var upload=multer({'storage':multer[_0xf343('0x18')]({'destination':function(_0x5d842f,_0x3b68cf,_0x221a58){_0x221a58(null,path[_0xf343('0x19')](config[_0xf343('0x1a')],'server/files/images/logos/'));},'filename':function(_0x1f041b,_0x5d718f,_0x6e1a87){_0x6e1a87(null,util[_0xf343('0x1b')](_0xf343('0x1c'),'logo',path[_0xf343('0x1d')](_0x5d718f['originalname'])));}})});router[_0xf343('0x1e')](_0xf343('0x11'),upload['single'](_0xf343('0x1f')),controller[_0xf343('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3395de,_0x2d545e,_0xbcc5f9){_0xbcc5f9(null,path[_0xf343('0x19')](config[_0xf343('0x1a')],_0xf343('0x21')));},'filename':function(_0x4b8fae,_0x5cbd48,_0x55dd0a){_0x55dd0a(null,util['format'](_0xf343('0x1c'),_0xf343('0x22'),path[_0xf343('0x1d')](_0x5cbd48[_0xf343('0x23')])));}})});router[_0xf343('0x1e')](_0xf343('0x13'),upload[_0xf343('0x24')]('file'),controller[_0xf343('0x25')]);var upload=multer({'storage':multer[_0xf343('0x18')]({'destination':function(_0x5a21ab,_0x5217db,_0x54f21f){_0x54f21f(null,path[_0xf343('0x19')](config[_0xf343('0x1a')],_0xf343('0x21')));},'filename':function(_0x1f7f19,_0x1adee3,_0x3045c8){_0x3045c8(null,util['format'](_0xf343('0x1c'),_0xf343('0x26'),path['extname'](_0x1adee3[_0xf343('0x23')])));}})});router[_0xf343('0x1e')](_0xf343('0x15'),upload['single']('file'),controller[_0xf343('0x27')]);var upload=multer({'storage':multer[_0xf343('0x18')]({'destination':function(_0x423bf0,_0x243df6,_0x13802a){_0x13802a(null,path[_0xf343('0x19')](config[_0xf343('0x1a')],_0xf343('0x21')));},'filename':function(_0x1d3cd8,_0x3c6bd1,_0x4c94c7){_0x4c94c7(null,util[_0xf343('0x1b')](_0xf343('0x1c'),_0xf343('0x28'),path[_0xf343('0x1d')](_0x3c6bd1[_0xf343('0x23')])));}})});router[_0xf343('0x1e')](_0xf343('0x16'),upload[_0xf343('0x24')](_0xf343('0x1f')),controller[_0xf343('0x29')]);router[_0xf343('0x2a')](_0xf343('0xf'),auth[_0xf343('0xc')](),controller[_0xf343('0x2b')]);module[_0xf343('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c28b83c..427d52a 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 _0xe0e5=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xe0e5,0x1ab));var _0x5e0e=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xe0e5[_0x2bbc07];return _0x6879e4;};'use strict';var Sequelize=require(_0x5e0e('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x5e0e('0x1')](0xb),'unique':_0x5e0e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5e0e('0x1')](0xb),'unique':_0x5e0e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5e0e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5e0e('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x5e0e('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x5e0e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5e0e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5e0e('0x4')],'defaultValue':_0x5e0e('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5e0e('0x7')},'chatTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5e0e('0x4')]},'defaultPreferred':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5e0e('0x1')]},'transcribeRegion':{'type':Sequelize[_0x5e0e('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5e0e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x5e0e('0x4')]},'language':{'type':Sequelize[_0x5e0e('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5e0e('0x1')](0x2)[_0x5e0e('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5e0e('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5e0e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdae7=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal'];(function(_0x8e620a,_0x3416af){var _0x2a913b=function(_0x2b1c7e){while(--_0x2b1c7e){_0x8e620a['push'](_0x8e620a['shift']());}};_0x2a913b(++_0x3416af);}(_0xdae7,0xed));var _0x7dae=function(_0x3d11be,_0x1b9a8c){_0x3d11be=_0x3d11be-0x0;var _0x4b657b=_0xdae7[_0x3d11be];return _0x4b657b;};'use strict';var Sequelize=require(_0x7dae('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x7dae('0x1')](0xb),'unique':_0x7dae('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7dae('0x1')](0xb),'unique':_0x7dae('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7dae('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7dae('0x4')],'defaultValue':_0x7dae('0x5')},'logo':{'type':Sequelize[_0x7dae('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7dae('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7dae('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7dae('0x4')]},'turnaddr':{'type':Sequelize[_0x7dae('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x7dae('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7dae('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7dae('0x4')],'defaultValue':_0x7dae('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7dae('0x4')],'defaultValue':_0x7dae('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7dae('0x4')]},'defaultPreferred':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7dae('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7dae('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7dae('0x1')]},'transcribeRegion':{'type':Sequelize[_0x7dae('0x4')]},'sentiment':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7dae('0x1')]},'sentimentRegion':{'type':Sequelize[_0x7dae('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7dae('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x7dae('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7dae('0x1')](0x2)[_0x7dae('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7dae('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x7dae('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7dae('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x7dae('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a233a1a..2bd8020 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 _0x2e0a=['show','params','body','addLogo','file','logo','filename','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','../../config/license/util','getLogoLogin','defaultPreferred','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','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','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','rows'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x19770a,_0x463fc6){_0x19770a=_0x19770a-0x0;var _0x22b295=_0x2e0a[_0x19770a];return _0x22b295;};'use strict';var emlformat=require(_0xa2e0('0x0'));var rimraf=require(_0xa2e0('0x1'));var zipdir=require(_0xa2e0('0x2'));var jsonpatch=require(_0xa2e0('0x3'));var rp=require(_0xa2e0('0x4'));var moment=require(_0xa2e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa2e0('0x6'));var util=require(_0xa2e0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa2e0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa2e0('0x9'));var crypto=require(_0xa2e0('0xa'));var jsforce=require(_0xa2e0('0xb'));var deskjs=require(_0xa2e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa2e0('0xd'));var Papa=require(_0xa2e0('0xe'));var Redis=require(_0xa2e0('0xf'));var authService=require(_0xa2e0('0x10'));var qs=require(_0xa2e0('0x11'));var as=require(_0xa2e0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2e0('0x13'))(_0xa2e0('0x14'));var utils=require(_0xa2e0('0x15'));var config=require(_0xa2e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2e0('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab239,_0x2d2b7e,_0x483cdd,_0x5cea98){return new BPromise(function(_0x1ed54f,_0x4bc6e6){var _0x5e8840=_0x5cea98||client;return _0x5e8840['request'](_0x2ab239,_0x483cdd)['then'](function(_0xae9f0c){logger['info'](_0xa2e0('0x18'),_0x2d2b7e,_0xa2e0('0x19'));logger[_0xa2e0('0x1a')]('Setting,\x20%s,\x20%s,\x20%s',_0x2d2b7e,_0xa2e0('0x19'),JSON[_0xa2e0('0x1b')](_0xae9f0c));if(_0xae9f0c[_0xa2e0('0x1c')]){if(_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1d')]===0x1f4){logger[_0xa2e0('0x1c')](_0xa2e0('0x18'),_0x2d2b7e,_0xae9f0c['error'][_0xa2e0('0x1e')]);return _0x4bc6e6(_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1e')]);}logger[_0xa2e0('0x1c')](_0xa2e0('0x18'),_0x2d2b7e,_0xae9f0c[_0xa2e0('0x1c')][_0xa2e0('0x1e')]);return _0x1ed54f(_0xae9f0c[_0xa2e0('0x1c')]['message']);}else{logger['info'](_0xa2e0('0x18'),_0x2d2b7e,_0xa2e0('0x19'));_0x1ed54f(_0xae9f0c['result'][_0xa2e0('0x1e')]);}})[_0xa2e0('0x1f')](function(_0x4b6ed8){logger['error'](_0xa2e0('0x18'),_0x2d2b7e,_0x4b6ed8);_0x4bc6e6(_0x4b6ed8);});});}function respondWithStatusCode(_0x373da3,_0x51eac9){_0x51eac9=_0x51eac9||0xcc;return function(_0x2f39c3){if(_0x2f39c3){return _0x373da3[_0xa2e0('0x20')](_0x51eac9);}return _0x373da3[_0xa2e0('0x21')](_0x51eac9)[_0xa2e0('0x22')]();};}function respondWithResult(_0x3e8415,_0x371e85){_0x371e85=_0x371e85||0xc8;return function(_0x102558){if(_0x102558){return _0x3e8415['status'](_0x371e85)[_0xa2e0('0x23')](_0x102558);}};}function respondWithFilteredResult(_0x558302,_0x35f44d){return function(_0x5b6d3b){if(_0x5b6d3b){var _0x16920f=typeof _0x35f44d['offset']===_0xa2e0('0x24')&&typeof _0x35f44d['limit']==='undefined';var _0x47cbf3=_0x5b6d3b[_0xa2e0('0x25')];var _0x292488=_0x16920f?0x0:_0x35f44d[_0xa2e0('0x26')];var _0x3dec41=_0x16920f?_0x5b6d3b['count']:_0x35f44d['offset']+_0x35f44d['limit'];var _0x1cd242;if(_0x3dec41>=_0x47cbf3){_0x3dec41=_0x47cbf3;_0x1cd242=0xc8;}else{_0x1cd242=0xce;}_0x558302[_0xa2e0('0x21')](_0x1cd242);return _0x558302[_0xa2e0('0x27')](_0xa2e0('0x28'),_0x292488+'-'+_0x3dec41+'/'+_0x47cbf3)['json'](_0x5b6d3b);}return null;};}function patchUpdates(_0x1927e9){return function(_0x40c007){try{jsonpatch[_0xa2e0('0x29')](_0x40c007,_0x1927e9,!![]);}catch(_0x2b2ca4){return BPromise['reject'](_0x2b2ca4);}return _0x40c007[_0xa2e0('0x2a')]();};}function saveUpdates(_0x549f80,_0x2957e2){return function(_0x1a94c0){if(_0x1a94c0){return _0x1a94c0[_0xa2e0('0x2b')](_0x549f80)[_0xa2e0('0x2c')](function(_0x7f1798){return _0x7f1798;});}return null;};}function removeEntity(_0x3f9c76,_0x1401a4){return function(_0x31c748){if(_0x31c748){return _0x31c748['destroy']()[_0xa2e0('0x2c')](function(){_0x3f9c76[_0xa2e0('0x21')](0xcc)[_0xa2e0('0x22')]();});}};}function handleEntityNotFound(_0x3cf812,_0x509194){return function(_0x15d4fc){if(!_0x15d4fc){_0x3cf812[_0xa2e0('0x20')](0x194);}return _0x15d4fc;};}function handleError(_0x3819ee,_0x486725){_0x486725=_0x486725||0x1f4;return function(_0x2fe4a2){logger['error'](_0x2fe4a2[_0xa2e0('0x2d')]);if(_0x2fe4a2[_0xa2e0('0x2e')]){delete _0x2fe4a2[_0xa2e0('0x2e')];}_0x3819ee[_0xa2e0('0x21')](_0x486725)[_0xa2e0('0x2f')](_0x2fe4a2);};}exports[_0xa2e0('0x30')]=function(_0x3eda29,_0x338ec7){var _0x274db3={},_0x59a21e={},_0x1caa7a={'count':0x0,'rows':[]};var _0x4f8ce5=_['map'](db[_0xa2e0('0x31')][_0xa2e0('0x32')],function(_0x5eb919){return{'name':_0x5eb919[_0xa2e0('0x33')],'type':_0x5eb919[_0xa2e0('0x34')][_0xa2e0('0x35')]};});_0x59a21e[_0xa2e0('0x36')]=_[_0xa2e0('0x37')](_0x4f8ce5,_0xa2e0('0x2e'));_0x59a21e[_0xa2e0('0x38')]=_['keys'](_0x3eda29[_0xa2e0('0x38')]);_0x59a21e[_0xa2e0('0x39')]=_[_0xa2e0('0x3a')](_0x59a21e[_0xa2e0('0x36')],_0x59a21e[_0xa2e0('0x38')]);_0x274db3[_0xa2e0('0x3b')]=_[_0xa2e0('0x3a')](_0x59a21e[_0xa2e0('0x36')],qs[_0xa2e0('0x3c')](_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x3c')]));_0x274db3['attributes']=_0x274db3[_0xa2e0('0x3b')][_0xa2e0('0x3d')]?_0x274db3['attributes']:_0x59a21e[_0xa2e0('0x36')];if(!_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x3e')]('nolimit')){_0x274db3[_0xa2e0('0x3f')]=qs[_0xa2e0('0x3f')](_0x3eda29['query'][_0xa2e0('0x3f')]);_0x274db3['offset']=qs[_0xa2e0('0x26')](_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x26')]);}_0x274db3[_0xa2e0('0x40')]=qs[_0xa2e0('0x41')](_0x3eda29['query'][_0xa2e0('0x41')]);_0x274db3['where']=qs[_0xa2e0('0x39')](_[_0xa2e0('0x42')](_0x3eda29['query'],_0x59a21e[_0xa2e0('0x39')]),_0x4f8ce5);if(_0x3eda29[_0xa2e0('0x38')][_0xa2e0('0x43')]){_0x274db3[_0xa2e0('0x44')]=_['merge'](_0x274db3[_0xa2e0('0x44')],{'$or':_['map'](_0x4f8ce5,function(_0x25eeeb){if(_0x25eeeb[_0xa2e0('0x34')]!=='VIRTUAL'){var _0x4a413c={};_0x4a413c[_0x25eeeb[_0xa2e0('0x2e')]]={'$like':'%'+_0x3eda29['query']['filter']+'%'};return _0x4a413c;}})});}_0x274db3=_[_0xa2e0('0x45')]({},_0x274db3,_0x3eda29[_0xa2e0('0x46')]);var _0x43dd83={'where':_0x274db3[_0xa2e0('0x44')]};return db[_0xa2e0('0x31')][_0xa2e0('0x25')](_0x43dd83)[_0xa2e0('0x2c')](function(_0x1260f4){_0x1caa7a[_0xa2e0('0x25')]=_0x1260f4;if(_0x3eda29['query'][_0xa2e0('0x47')]){_0x274db3['include']=[{'all':!![]}];}return db[_0xa2e0('0x31')]['findAll'](_0x274db3);})['then'](function(_0x540019){_0x1caa7a[_0xa2e0('0x48')]=_0x540019;return _0x1caa7a;})[_0xa2e0('0x2c')](respondWithFilteredResult(_0x338ec7,_0x274db3))['catch'](handleError(_0x338ec7,null));};exports[_0xa2e0('0x49')]=function(_0x13ef4c,_0x5ce143){var _0x5037f0={'raw':![],'where':{'id':_0x13ef4c[_0xa2e0('0x4a')]['id']}},_0x1bc048={};_0x1bc048[_0xa2e0('0x36')]=_['keys'](db[_0xa2e0('0x31')][_0xa2e0('0x32')]);_0x1bc048['query']=_['keys'](_0x13ef4c['query']);_0x1bc048[_0xa2e0('0x39')]=_['intersection'](_0x1bc048['model'],_0x1bc048[_0xa2e0('0x38')]);_0x5037f0[_0xa2e0('0x3b')]=_[_0xa2e0('0x3a')](_0x1bc048[_0xa2e0('0x36')],qs[_0xa2e0('0x3c')](_0x13ef4c[_0xa2e0('0x38')][_0xa2e0('0x3c')]));_0x5037f0['attributes']=_0x5037f0[_0xa2e0('0x3b')]['length']?_0x5037f0[_0xa2e0('0x3b')]:_0x1bc048[_0xa2e0('0x36')];if(_0x13ef4c[_0xa2e0('0x38')][_0xa2e0('0x47')]){_0x5037f0['include']=[{'all':!![]}];}_0x5037f0=_[_0xa2e0('0x45')]({},_0x5037f0,_0x13ef4c[_0xa2e0('0x46')]);return db['Setting']['find'](_0x5037f0)[_0xa2e0('0x2c')](handleEntityNotFound(_0x5ce143,null))['then'](respondWithResult(_0x5ce143,null))['catch'](handleError(_0x5ce143,null));};exports[_0xa2e0('0x2b')]=function(_0x52aa69,_0x3a4b75){if(_0x52aa69[_0xa2e0('0x4b')]['id']){delete _0x52aa69['body']['id'];}return db[_0xa2e0('0x31')]['find']({'where':{'id':_0x52aa69['params']['id']}})['then'](handleEntityNotFound(_0x3a4b75,null))[_0xa2e0('0x2c')](saveUpdates(_0x52aa69[_0xa2e0('0x4b')],null))[_0xa2e0('0x2c')](respondWithResult(_0x3a4b75,null))[_0xa2e0('0x1f')](handleError(_0x3a4b75,null));};exports[_0xa2e0('0x4c')]=function(_0x14d1e5,_0x10071b,_0x22d4a6){if(_0x14d1e5[_0xa2e0('0x4d')]&&_0x14d1e5[_0xa2e0('0x4d')]['filename']){_0x14d1e5['body'][_0xa2e0('0x4e')]=_0x14d1e5[_0xa2e0('0x4d')][_0xa2e0('0x4f')];}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x14d1e5[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x10071b,null))[_0xa2e0('0x2c')](saveUpdates(_0x14d1e5[_0xa2e0('0x4b')],null))['then'](respondWithResult(_0x10071b,null))[_0xa2e0('0x1f')](handleError(_0x10071b,null));};exports[_0xa2e0('0x51')]=function(_0x17aa9b,_0x1bd413,_0x22b593){if(_0x17aa9b[_0xa2e0('0x4d')]&&_0x17aa9b[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x17aa9b[_0xa2e0('0x4b')][_0xa2e0('0x52')]=_0x17aa9b[_0xa2e0('0x4d')][_0xa2e0('0x4f')];}return db['Setting']['find']({'where':{'id':_0x17aa9b[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x1bd413,null))[_0xa2e0('0x2c')](saveUpdates(_0x17aa9b['body'],null))[_0xa2e0('0x2c')](respondWithResult(_0x1bd413,null))[_0xa2e0('0x1f')](handleError(_0x1bd413,null));};var utilLicense=require('../../config/license/util');exports[_0xa2e0('0x53')]=function(_0x3b7579,_0x4d4be6,_0xf2d292){var _0x1d4b76=_0xa2e0('0x54');var _0x1b09c5={'custom':![]};return utilLicense[_0xa2e0('0x55')]()[_0xa2e0('0x2c')](function(_0xa47463){if(_0xa47463){_0x1b09c5=_0xa47463;}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x3b7579[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),_0xa2e0('0x56'),_0xa2e0('0x57'),_0xa2e0('0x58'),_0xa2e0('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x4d4be6,null))[_0xa2e0('0x2c')](function(_0x2f46c9){if(_0x2f46c9){var _0x343628=_0x2f46c9[_0xa2e0('0x4e')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1d4b76,_[_0xa2e0('0x5d')](_0x2f46c9[_0xa2e0('0x4e')])))?path['join'](config[_0xa2e0('0x5c')],_0x1d4b76,_[_0xa2e0('0x5d')](_0x2f46c9['logo'])):path[_0xa2e0('0x5b')](config['root'],_0x1d4b76,_['toLower']('default_logo.svg'));var _0x361497=_0xa2e0('0x5e')+_['upperFirst'](_0xa2e0('0x4e'));if(_0x2f46c9[_0x361497]||!_0x1b09c5[_0xa2e0('0x5f')]){_0x343628=path[_0xa2e0('0x5b')](config['root'],_0x1d4b76,_['toLower'](_0xa2e0('0x60')));}if(!fs[_0xa2e0('0x5a')](_0x343628)){throw new db[(_0xa2e0('0x61'))][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')](_0xa2e0('0x4e'))+_0xa2e0('0x64'));}return _0x4d4be6['download'](_0x343628);}})[_0xa2e0('0x1f')](handleError(_0x4d4be6,null));};var utilLicense=require(_0xa2e0('0x65'));exports[_0xa2e0('0x66')]=function(_0xbc5d8,_0x42a3b3,_0x5a7ef9){var _0x1bfc40=_0xa2e0('0x54');var _0x37fef2={'custom':![]};return utilLicense[_0xa2e0('0x55')]()['then'](function(_0x13ef52){if(_0x13ef52){_0x37fef2=_0x13ef52;}return db[_0xa2e0('0x31')]['find']({'where':{'id':_0xbc5d8[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),_0xa2e0('0x56'),'favicon',_0xa2e0('0x58'),'defaultLoginLogo',_0xa2e0('0x67'),'defaultFavicon'],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x42a3b3,null))[_0xa2e0('0x2c')](function(_0x474f29){if(_0x474f29){var _0x5a7d3a=_0x474f29[_0xa2e0('0x52')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0x474f29['loginLogo'])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_[_0xa2e0('0x5d')](_0x474f29[_0xa2e0('0x52')])):path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0xa2e0('0x68')));var _0x53bccf='default'+_[_0xa2e0('0x63')](_0xa2e0('0x52'));if(_0x474f29[_0x53bccf]||!_0x37fef2[_0xa2e0('0x5f')]){_0x5a7d3a=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x1bfc40,_['toLower'](_0xa2e0('0x68')));}if(!fs[_0xa2e0('0x5a')](_0x5a7d3a)){throw new db['Sequelize'][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')]('loginLogo')+'\x20not\x20found');}return _0x42a3b3[_0xa2e0('0x69')](_0x5a7d3a);}})[_0xa2e0('0x1f')](handleError(_0x42a3b3,null));};exports[_0xa2e0('0x6a')]=function(_0x296f03,_0x1f1d39){return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x296f03['params']['id']},'attributes':[_0xa2e0('0x6b')]})['then'](respondWithResult(_0x1f1d39,null))['catch'](handleError(_0x1f1d39,null));};exports[_0xa2e0('0x6c')]=function(_0x1b860c,_0x277993,_0x3c75dc){if(_0x1b860c['file']&&_0x1b860c[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x1b860c[_0xa2e0('0x4b')][_0xa2e0('0x56')]=_0x1b860c['file'][_0xa2e0('0x4f')];}return db[_0xa2e0('0x31')][_0xa2e0('0x50')]({'where':{'id':_0x1b860c[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x277993,null))[_0xa2e0('0x2c')](saveUpdates(_0x1b860c[_0xa2e0('0x4b')],null))[_0xa2e0('0x2c')](respondWithResult(_0x277993,null))[_0xa2e0('0x1f')](handleError(_0x277993,null));};var utilLicense=require(_0xa2e0('0x65'));exports[_0xa2e0('0x6d')]=function(_0x2521bd,_0x3968d9,_0x1d73a1){var _0xde2f76=_0xa2e0('0x54');var _0x25863f={'custom':![]};return utilLicense[_0xa2e0('0x55')]()['then'](function(_0x594108){if(_0x594108){_0x25863f=_0x594108;}return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x2521bd[_0xa2e0('0x4a')]['id']},'attributes':[_0xa2e0('0x4e'),_0xa2e0('0x52'),'preferred',_0xa2e0('0x57'),'defaultLogo',_0xa2e0('0x59'),_0xa2e0('0x67'),_0xa2e0('0x6e')],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0x3968d9,null))['then'](function(_0x4629f1){if(_0x4629f1){var _0x4bf10d=_0x4629f1[_0xa2e0('0x56')]&&fs['existsSync'](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0x4629f1[_0xa2e0('0x56')])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0x4629f1[_0xa2e0('0x56')])):path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')]('default_preferred.png'));var _0x11fefa='default'+_['upperFirst'](_0xa2e0('0x56'));if(_0x4629f1[_0x11fefa]||!_0x25863f[_0xa2e0('0x5f')]||!_0x25863f[_0xa2e0('0x56')]){_0x4bf10d=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0xde2f76,_[_0xa2e0('0x5d')](_0xa2e0('0x6f')));}if(!fs[_0xa2e0('0x5a')](_0x4bf10d)){throw new db[(_0xa2e0('0x61'))][(_0xa2e0('0x62'))](_[_0xa2e0('0x63')](_0xa2e0('0x56'))+_0xa2e0('0x64'));}return _0x3968d9[_0xa2e0('0x69')](_0x4bf10d);}})[_0xa2e0('0x1f')](handleError(_0x3968d9,null));};exports[_0xa2e0('0x70')]=function(_0x4fe81a,_0x24f23d,_0x41b624){if(_0x4fe81a[_0xa2e0('0x4d')]&&_0x4fe81a[_0xa2e0('0x4d')][_0xa2e0('0x4f')]){_0x4fe81a[_0xa2e0('0x4b')][_0xa2e0('0x57')]=_0x4fe81a['file'][_0xa2e0('0x4f')];}return db['Setting']['find']({'where':{'id':_0x4fe81a[_0xa2e0('0x4a')]['id']}})[_0xa2e0('0x2c')](handleEntityNotFound(_0x24f23d,null))[_0xa2e0('0x2c')](saveUpdates(_0x4fe81a[_0xa2e0('0x4b')],null))['then'](respondWithResult(_0x24f23d,null))['catch'](handleError(_0x24f23d,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x598746,_0xd6718f,_0x58f915){var _0x26fbce=_0xa2e0('0x54');var _0x2deb4d={'custom':![]};return utilLicense[_0xa2e0('0x55')]()[_0xa2e0('0x2c')](function(_0xf2d5d8){if(_0xf2d5d8){_0x2deb4d=_0xf2d5d8;}return db['Setting'][_0xa2e0('0x50')]({'where':{'id':_0x598746[_0xa2e0('0x4a')]['id']},'attributes':['logo',_0xa2e0('0x52'),_0xa2e0('0x56'),_0xa2e0('0x57'),'defaultLogo',_0xa2e0('0x59'),'defaultPreferred',_0xa2e0('0x6e')],'raw':!![]});})[_0xa2e0('0x2c')](handleEntityNotFound(_0xd6718f,null))['then'](function(_0x1d2483){if(_0x1d2483){var _0x3a9e5b=_0x1d2483[_0xa2e0('0x57')]&&fs[_0xa2e0('0x5a')](path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_['toLower'](_0x1d2483[_0xa2e0('0x57')])))?path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_['toLower'](_0x1d2483[_0xa2e0('0x57')])):path[_0xa2e0('0x5b')](config['root'],_0x26fbce,_[_0xa2e0('0x5d')](_0xa2e0('0x71')));var _0x2167ae='default'+_[_0xa2e0('0x63')](_0xa2e0('0x57'));if(_0x1d2483[_0x2167ae]||!_0x2deb4d[_0xa2e0('0x5f')]){_0x3a9e5b=path[_0xa2e0('0x5b')](config[_0xa2e0('0x5c')],_0x26fbce,_[_0xa2e0('0x5d')](_0xa2e0('0x71')));}if(!fs[_0xa2e0('0x5a')](_0x3a9e5b)){throw new db['Sequelize'][(_0xa2e0('0x62'))](_['upperFirst'](_0xa2e0('0x57'))+_0xa2e0('0x64'));}return _0xd6718f[_0xa2e0('0x69')](_0x3a9e5b);}})[_0xa2e0('0x1f')](handleError(_0xd6718f,null));};exports['getDate']=function(_0x3394c5,_0x4475ca){var _0x23d7f0={'offset':moment()[_0xa2e0('0x72')]()};_0x23d7f0[_0xa2e0('0x73')]=moment()[_0xa2e0('0x72')](_0x23d7f0[_0xa2e0('0x26')])[_0xa2e0('0x74')](_0xa2e0('0x75'));return _0x4475ca[_0xa2e0('0x21')](0xc8)[_0xa2e0('0x2f')](_0x23d7f0);}; \ No newline at end of file +var _0xa20e=['jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','Setting','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','findAll','rawAttributes','include','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','Sequelize','\x20not\x20found','download','preferred','defaultLoginLogo','default_loginLogo.svg','default','custom','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','ValidationError','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel'];(function(_0x85f77b,_0x3ded3a){var _0x42727d=function(_0x23328e){while(--_0x23328e){_0x85f77b['push'](_0x85f77b['shift']());}};_0x42727d(++_0x3ded3a);}(_0xa20e,0x1ca));var _0xea20=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0xa20e[_0x531cb8];return _0x5cf297;};'use strict';var emlformat=require(_0xea20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea20('0x1'));var jsonpatch=require(_0xea20('0x2'));var rp=require(_0xea20('0x3'));var moment=require(_0xea20('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea20('0x5'));var util=require(_0xea20('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xea20('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea20('0x8'));var squel=require(_0xea20('0x9'));var crypto=require('crypto');var jsforce=require(_0xea20('0xa'));var deskjs=require(_0xea20('0xb'));var toCsv=require(_0xea20('0xc'));var querystring=require(_0xea20('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea20('0xe'));var qs=require(_0xea20('0xf'));var as=require(_0xea20('0x10'));var hardwareService=require(_0xea20('0x11'));var logger=require('../../config/logger')(_0xea20('0x12'));var utils=require(_0xea20('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea20('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xea20('0x15'));var client=jayson['client'][_0xea20('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x44a1bc,_0x271dbc,_0x1ca82e,_0x2dbace){return new BPromise(function(_0x18357f,_0x5d7268){var _0x531dff=_0x2dbace||client;return _0x531dff[_0xea20('0x17')](_0x44a1bc,_0x1ca82e)[_0xea20('0x18')](function(_0x17ed8a){logger[_0xea20('0x19')](_0xea20('0x1a'),_0x271dbc,_0xea20('0x1b'));logger[_0xea20('0x1c')](_0xea20('0x1d'),_0x271dbc,_0xea20('0x1b'),JSON['stringify'](_0x17ed8a));if(_0x17ed8a[_0xea20('0x1e')]){if(_0x17ed8a['error'][_0xea20('0x1f')]===0x1f4){logger[_0xea20('0x1e')](_0xea20('0x1a'),_0x271dbc,_0x17ed8a['error'][_0xea20('0x20')]);return _0x5d7268(_0x17ed8a['error'][_0xea20('0x20')]);}logger[_0xea20('0x1e')](_0xea20('0x1a'),_0x271dbc,_0x17ed8a[_0xea20('0x1e')][_0xea20('0x20')]);return _0x18357f(_0x17ed8a[_0xea20('0x1e')][_0xea20('0x20')]);}else{logger[_0xea20('0x19')](_0xea20('0x1a'),_0x271dbc,_0xea20('0x1b'));_0x18357f(_0x17ed8a['result']['message']);}})[_0xea20('0x21')](function(_0x54b462){logger[_0xea20('0x1e')](_0xea20('0x1a'),_0x271dbc,_0x54b462);_0x5d7268(_0x54b462);});});}function respondWithStatusCode(_0x145feb,_0x11b9f2){_0x11b9f2=_0x11b9f2||0xcc;return function(_0x1e28d9){if(_0x1e28d9){return _0x145feb[_0xea20('0x22')](_0x11b9f2);}return _0x145feb['status'](_0x11b9f2)[_0xea20('0x23')]();};}function respondWithResult(_0x2a0897,_0x20023f){_0x20023f=_0x20023f||0xc8;return function(_0x199ea0){if(_0x199ea0){return _0x2a0897[_0xea20('0x24')](_0x20023f)[_0xea20('0x25')](_0x199ea0);}};}function respondWithFilteredResult(_0x2b72b7,_0x3c6bfc){return function(_0x3d0957){if(_0x3d0957){var _0x4c266d=typeof _0x3c6bfc['offset']===_0xea20('0x26')&&typeof _0x3c6bfc['limit']===_0xea20('0x26');var _0x2092f8=_0x3d0957['count'];var _0x43ab4e=_0x4c266d?0x0:_0x3c6bfc[_0xea20('0x27')];var _0x33d7b2=_0x4c266d?_0x3d0957['count']:_0x3c6bfc[_0xea20('0x27')]+_0x3c6bfc[_0xea20('0x28')];var _0x253158;if(_0x33d7b2>=_0x2092f8){_0x33d7b2=_0x2092f8;_0x253158=0xc8;}else{_0x253158=0xce;}_0x2b72b7[_0xea20('0x24')](_0x253158);return _0x2b72b7[_0xea20('0x29')](_0xea20('0x2a'),_0x43ab4e+'-'+_0x33d7b2+'/'+_0x2092f8)[_0xea20('0x25')](_0x3d0957);}return null;};}function patchUpdates(_0x7ae1f8){return function(_0x206c90){try{jsonpatch['apply'](_0x206c90,_0x7ae1f8,!![]);}catch(_0x430e0b){return BPromise[_0xea20('0x2b')](_0x430e0b);}return _0x206c90[_0xea20('0x2c')]();};}function saveUpdates(_0x39b7cc,_0x3103aa){return function(_0x2b81f3){if(_0x2b81f3){return _0x2b81f3['update'](_0x39b7cc)[_0xea20('0x18')](function(_0x201ab6){return _0x201ab6;});}return null;};}function removeEntity(_0x17dd84,_0x5cee16){return function(_0x4eaa7b){if(_0x4eaa7b){return _0x4eaa7b[_0xea20('0x2d')]()[_0xea20('0x18')](function(){_0x17dd84[_0xea20('0x24')](0xcc)[_0xea20('0x23')]();});}};}function handleEntityNotFound(_0x4f2890,_0x4fe88f){return function(_0x33343e){if(!_0x33343e){_0x4f2890[_0xea20('0x22')](0x194);}return _0x33343e;};}function handleError(_0x51fc6b,_0x198420){_0x198420=_0x198420||0x1f4;return function(_0x1d7d25){logger[_0xea20('0x1e')](_0x1d7d25[_0xea20('0x2e')]);if(_0x1d7d25['name']){delete _0x1d7d25[_0xea20('0x2f')];}_0x51fc6b[_0xea20('0x24')](_0x198420)[_0xea20('0x30')](_0x1d7d25);};}exports[_0xea20('0x31')]=function(_0x36e4b4,_0x172664){var _0x696296={},_0x189942={},_0x6faa39={'count':0x0,'rows':[]};var _0x42b7a0=_[_0xea20('0x32')](db[_0xea20('0x33')]['rawAttributes'],function(_0x44b4f3){return{'name':_0x44b4f3[_0xea20('0x34')],'type':_0x44b4f3[_0xea20('0x35')]['key']};});_0x189942['model']=_[_0xea20('0x32')](_0x42b7a0,_0xea20('0x2f'));_0x189942[_0xea20('0x36')]=_[_0xea20('0x37')](_0x36e4b4['query']);_0x189942[_0xea20('0x38')]=_[_0xea20('0x39')](_0x189942['model'],_0x189942[_0xea20('0x36')]);_0x696296['attributes']=_[_0xea20('0x39')](_0x189942[_0xea20('0x3a')],qs[_0xea20('0x3b')](_0x36e4b4[_0xea20('0x36')][_0xea20('0x3b')]));_0x696296[_0xea20('0x3c')]=_0x696296['attributes'][_0xea20('0x3d')]?_0x696296[_0xea20('0x3c')]:_0x189942[_0xea20('0x3a')];if(!_0x36e4b4[_0xea20('0x36')][_0xea20('0x3e')](_0xea20('0x3f'))){_0x696296[_0xea20('0x28')]=qs[_0xea20('0x28')](_0x36e4b4['query'][_0xea20('0x28')]);_0x696296[_0xea20('0x27')]=qs[_0xea20('0x27')](_0x36e4b4['query'][_0xea20('0x27')]);}_0x696296['order']=qs[_0xea20('0x40')](_0x36e4b4[_0xea20('0x36')][_0xea20('0x40')]);_0x696296[_0xea20('0x41')]=qs[_0xea20('0x38')](_[_0xea20('0x42')](_0x36e4b4[_0xea20('0x36')],_0x189942[_0xea20('0x38')]),_0x42b7a0);if(_0x36e4b4[_0xea20('0x36')][_0xea20('0x43')]){_0x696296['where']=_[_0xea20('0x44')](_0x696296[_0xea20('0x41')],{'$or':_[_0xea20('0x32')](_0x42b7a0,function(_0x513bb8){if(_0x513bb8['type']!=='VIRTUAL'){var _0x197961={};_0x197961[_0x513bb8[_0xea20('0x2f')]]={'$like':'%'+_0x36e4b4[_0xea20('0x36')][_0xea20('0x43')]+'%'};return _0x197961;}})});}_0x696296=_['merge']({},_0x696296,_0x36e4b4[_0xea20('0x45')]);var _0x4381de={'where':_0x696296['where']};return db[_0xea20('0x33')][_0xea20('0x46')](_0x4381de)[_0xea20('0x18')](function(_0x4fdbe1){_0x6faa39[_0xea20('0x46')]=_0x4fdbe1;if(_0x36e4b4[_0xea20('0x36')][_0xea20('0x47')]){_0x696296['include']=[{'all':!![]}];}return db[_0xea20('0x33')][_0xea20('0x48')](_0x696296);})[_0xea20('0x18')](function(_0xbff392){_0x6faa39['rows']=_0xbff392;return _0x6faa39;})['then'](respondWithFilteredResult(_0x172664,_0x696296))[_0xea20('0x21')](handleError(_0x172664,null));};exports['show']=function(_0x52a28c,_0x11de50){var _0x366c0e={'raw':![],'where':{'id':_0x52a28c['params']['id']}},_0x1ce7ee={};_0x1ce7ee['model']=_[_0xea20('0x37')](db[_0xea20('0x33')][_0xea20('0x49')]);_0x1ce7ee['query']=_[_0xea20('0x37')](_0x52a28c[_0xea20('0x36')]);_0x1ce7ee[_0xea20('0x38')]=_[_0xea20('0x39')](_0x1ce7ee[_0xea20('0x3a')],_0x1ce7ee[_0xea20('0x36')]);_0x366c0e['attributes']=_[_0xea20('0x39')](_0x1ce7ee[_0xea20('0x3a')],qs[_0xea20('0x3b')](_0x52a28c[_0xea20('0x36')][_0xea20('0x3b')]));_0x366c0e[_0xea20('0x3c')]=_0x366c0e[_0xea20('0x3c')][_0xea20('0x3d')]?_0x366c0e['attributes']:_0x1ce7ee[_0xea20('0x3a')];if(_0x52a28c['query'][_0xea20('0x47')]){_0x366c0e[_0xea20('0x4a')]=[{'all':!![]}];}_0x366c0e=_[_0xea20('0x44')]({},_0x366c0e,_0x52a28c['options']);return db[_0xea20('0x33')][_0xea20('0x4b')](_0x366c0e)[_0xea20('0x18')](handleEntityNotFound(_0x11de50,null))[_0xea20('0x18')](respondWithResult(_0x11de50,null))['catch'](handleError(_0x11de50,null));};exports['update']=function(_0x35ad21,_0x10c28f){if(_0x35ad21[_0xea20('0x4c')]['id']){delete _0x35ad21[_0xea20('0x4c')]['id'];}return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x35ad21[_0xea20('0x4d')]['id']}})[_0xea20('0x18')](handleEntityNotFound(_0x10c28f,null))[_0xea20('0x18')](saveUpdates(_0x35ad21[_0xea20('0x4c')],null))[_0xea20('0x18')](respondWithResult(_0x10c28f,null))[_0xea20('0x21')](handleError(_0x10c28f,null));};exports[_0xea20('0x4e')]=function(_0xd8c5d8,_0x15ab2a,_0x172d26){if(_0xd8c5d8[_0xea20('0x4f')]&&_0xd8c5d8[_0xea20('0x4f')][_0xea20('0x50')]){_0xd8c5d8[_0xea20('0x4c')][_0xea20('0x51')]=_0xd8c5d8[_0xea20('0x4f')][_0xea20('0x50')];}return db['Setting'][_0xea20('0x4b')]({'where':{'id':_0xd8c5d8['params']['id']}})[_0xea20('0x18')](handleEntityNotFound(_0x15ab2a,null))[_0xea20('0x18')](saveUpdates(_0xd8c5d8['body'],null))[_0xea20('0x18')](respondWithResult(_0x15ab2a,null))[_0xea20('0x21')](handleError(_0x15ab2a,null));};exports[_0xea20('0x52')]=function(_0x506b5b,_0x45ef6d,_0x4d0dda){if(_0x506b5b[_0xea20('0x4f')]&&_0x506b5b[_0xea20('0x4f')][_0xea20('0x50')]){_0x506b5b[_0xea20('0x4c')][_0xea20('0x53')]=_0x506b5b[_0xea20('0x4f')][_0xea20('0x50')];}return db['Setting'][_0xea20('0x4b')]({'where':{'id':_0x506b5b[_0xea20('0x4d')]['id']}})[_0xea20('0x18')](handleEntityNotFound(_0x45ef6d,null))[_0xea20('0x18')](saveUpdates(_0x506b5b['body'],null))['then'](respondWithResult(_0x45ef6d,null))[_0xea20('0x21')](handleError(_0x45ef6d,null));};var utilLicense=require(_0xea20('0x14'));exports[_0xea20('0x54')]=function(_0x24446c,_0x3dbad5,_0x464afa){var _0x3d1900=_0xea20('0x55');var _0x49f706={'custom':![]};return utilLicense[_0xea20('0x56')]()[_0xea20('0x18')](function(_0xe37471){if(_0xe37471){_0x49f706=_0xe37471;}return db[_0xea20('0x33')]['find']({'where':{'id':_0x24446c[_0xea20('0x4d')]['id']},'attributes':[_0xea20('0x51'),'loginLogo','preferred',_0xea20('0x57'),_0xea20('0x58'),'defaultLoginLogo',_0xea20('0x59'),_0xea20('0x5a')],'raw':!![]});})[_0xea20('0x18')](handleEntityNotFound(_0x3dbad5,null))['then'](function(_0x13a78c){if(_0x13a78c){var _0x41764c=_0x13a78c[_0xea20('0x51')]&&fs[_0xea20('0x5b')](path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x3d1900,_[_0xea20('0x5e')](_0x13a78c[_0xea20('0x51')])))?path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x3d1900,_[_0xea20('0x5e')](_0x13a78c[_0xea20('0x51')])):path[_0xea20('0x5c')](config['root'],_0x3d1900,_[_0xea20('0x5e')]('default_logo.svg'));var _0xba0f16='default'+_[_0xea20('0x5f')](_0xea20('0x51'));if(_0x13a78c[_0xba0f16]||!_0x49f706['custom']){_0x41764c=path[_0xea20('0x5c')](config['root'],_0x3d1900,_[_0xea20('0x5e')]('default_logo.svg'));}if(!fs[_0xea20('0x5b')](_0x41764c)){throw new db[(_0xea20('0x60'))]['ValidationError'](_[_0xea20('0x5f')]('logo')+_0xea20('0x61'));}return _0x3dbad5[_0xea20('0x62')](_0x41764c);}})[_0xea20('0x21')](handleError(_0x3dbad5,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x290823,_0x43faf7,_0x24bccc){var _0x5af0a8='server/files/images/logos';var _0x2d9026={'custom':![]};return utilLicense['getLicense']()[_0xea20('0x18')](function(_0x251659){if(_0x251659){_0x2d9026=_0x251659;}return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x290823[_0xea20('0x4d')]['id']},'attributes':[_0xea20('0x51'),_0xea20('0x53'),_0xea20('0x63'),'favicon',_0xea20('0x58'),_0xea20('0x64'),'defaultPreferred',_0xea20('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x43faf7,null))[_0xea20('0x18')](function(_0x4fc69e){if(_0x4fc69e){var _0x2c446c=_0x4fc69e['loginLogo']&&fs[_0xea20('0x5b')](path[_0xea20('0x5c')](config['root'],_0x5af0a8,_[_0xea20('0x5e')](_0x4fc69e[_0xea20('0x53')])))?path['join'](config['root'],_0x5af0a8,_[_0xea20('0x5e')](_0x4fc69e[_0xea20('0x53')])):path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x5af0a8,_['toLower'](_0xea20('0x65')));var _0x322aa7=_0xea20('0x66')+_[_0xea20('0x5f')](_0xea20('0x53'));if(_0x4fc69e[_0x322aa7]||!_0x2d9026[_0xea20('0x67')]){_0x2c446c=path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x5af0a8,_[_0xea20('0x5e')](_0xea20('0x65')));}if(!fs[_0xea20('0x5b')](_0x2c446c)){throw new db[(_0xea20('0x60'))]['ValidationError'](_[_0xea20('0x5f')](_0xea20('0x53'))+'\x20not\x20found');}return _0x43faf7[_0xea20('0x62')](_0x2c446c);}})[_0xea20('0x21')](handleError(_0x43faf7,null));};exports[_0xea20('0x68')]=function(_0x315724,_0x4ce6bb){return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x315724[_0xea20('0x4d')]['id']},'attributes':[_0xea20('0x69')]})[_0xea20('0x18')](respondWithResult(_0x4ce6bb,null))['catch'](handleError(_0x4ce6bb,null));};exports[_0xea20('0x6a')]=function(_0x3fdf9b,_0x92532c,_0x3e883e){if(_0x3fdf9b[_0xea20('0x4f')]&&_0x3fdf9b[_0xea20('0x4f')]['filename']){_0x3fdf9b[_0xea20('0x4c')][_0xea20('0x63')]=_0x3fdf9b[_0xea20('0x4f')][_0xea20('0x50')];}return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x3fdf9b[_0xea20('0x4d')]['id']}})[_0xea20('0x18')](handleEntityNotFound(_0x92532c,null))[_0xea20('0x18')](saveUpdates(_0x3fdf9b[_0xea20('0x4c')],null))[_0xea20('0x18')](respondWithResult(_0x92532c,null))[_0xea20('0x21')](handleError(_0x92532c,null));};var utilLicense=require(_0xea20('0x14'));exports['getPreferred']=function(_0x127ed9,_0x1ca116,_0x4b2120){var _0x54fe32=_0xea20('0x55');var _0x24bfb9={'custom':![]};return utilLicense[_0xea20('0x56')]()['then'](function(_0x4d7708){if(_0x4d7708){_0x24bfb9=_0x4d7708;}return db['Setting']['find']({'where':{'id':_0x127ed9[_0xea20('0x4d')]['id']},'attributes':[_0xea20('0x51'),_0xea20('0x53'),_0xea20('0x63'),_0xea20('0x57'),_0xea20('0x58'),_0xea20('0x64'),_0xea20('0x59'),_0xea20('0x5a')],'raw':!![]});})[_0xea20('0x18')](handleEntityNotFound(_0x1ca116,null))[_0xea20('0x18')](function(_0x6c84ef){if(_0x6c84ef){var _0x5ad619=_0x6c84ef['preferred']&&fs[_0xea20('0x5b')](path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x54fe32,_['toLower'](_0x6c84ef[_0xea20('0x63')])))?path[_0xea20('0x5c')](config['root'],_0x54fe32,_[_0xea20('0x5e')](_0x6c84ef['preferred'])):path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x54fe32,_['toLower'](_0xea20('0x6b')));var _0x2411d0=_0xea20('0x66')+_[_0xea20('0x5f')](_0xea20('0x63'));if(_0x6c84ef[_0x2411d0]||!_0x24bfb9[_0xea20('0x67')]||!_0x24bfb9['preferred']){_0x5ad619=path['join'](config['root'],_0x54fe32,_[_0xea20('0x5e')](_0xea20('0x6b')));}if(!fs[_0xea20('0x5b')](_0x5ad619)){throw new db['Sequelize']['ValidationError'](_['upperFirst']('preferred')+_0xea20('0x61'));}return _0x1ca116['download'](_0x5ad619);}})[_0xea20('0x21')](handleError(_0x1ca116,null));};exports[_0xea20('0x6c')]=function(_0x512f7b,_0x29978c,_0x567d50){if(_0x512f7b[_0xea20('0x4f')]&&_0x512f7b['file'][_0xea20('0x50')]){_0x512f7b['body'][_0xea20('0x57')]=_0x512f7b[_0xea20('0x4f')][_0xea20('0x50')];}return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x512f7b[_0xea20('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29978c,null))['then'](saveUpdates(_0x512f7b[_0xea20('0x4c')],null))[_0xea20('0x18')](respondWithResult(_0x29978c,null))[_0xea20('0x21')](handleError(_0x29978c,null));};var utilLicense=require(_0xea20('0x14'));exports[_0xea20('0x6d')]=function(_0x44c6e7,_0x28ef20,_0xb1b70c){var _0x1bc1a2=_0xea20('0x55');var _0x3dbb4c={'custom':![]};return utilLicense['getLicense']()[_0xea20('0x18')](function(_0x41ed19){if(_0x41ed19){_0x3dbb4c=_0x41ed19;}return db[_0xea20('0x33')][_0xea20('0x4b')]({'where':{'id':_0x44c6e7['params']['id']},'attributes':[_0xea20('0x51'),_0xea20('0x53'),_0xea20('0x63'),_0xea20('0x57'),_0xea20('0x58'),_0xea20('0x64'),_0xea20('0x59'),_0xea20('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x28ef20,null))['then'](function(_0x219b47){if(_0x219b47){var _0x592458=_0x219b47[_0xea20('0x57')]&&fs[_0xea20('0x5b')](path[_0xea20('0x5c')](config['root'],_0x1bc1a2,_[_0xea20('0x5e')](_0x219b47[_0xea20('0x57')])))?path[_0xea20('0x5c')](config[_0xea20('0x5d')],_0x1bc1a2,_[_0xea20('0x5e')](_0x219b47['favicon'])):path[_0xea20('0x5c')](config['root'],_0x1bc1a2,_[_0xea20('0x5e')](_0xea20('0x6e')));var _0x2abd40='default'+_[_0xea20('0x5f')](_0xea20('0x57'));if(_0x219b47[_0x2abd40]||!_0x3dbb4c['custom']){_0x592458=path['join'](config[_0xea20('0x5d')],_0x1bc1a2,_['toLower'](_0xea20('0x6e')));}if(!fs[_0xea20('0x5b')](_0x592458)){throw new db[(_0xea20('0x60'))][(_0xea20('0x6f'))](_['upperFirst'](_0xea20('0x57'))+_0xea20('0x61'));}return _0x28ef20[_0xea20('0x62')](_0x592458);}})[_0xea20('0x21')](handleError(_0x28ef20,null));};exports[_0xea20('0x70')]=function(_0x3e80e3,_0x44d6e5){var _0x16c48d={'offset':moment()[_0xea20('0x71')]()};_0x16c48d[_0xea20('0x72')]=moment()[_0xea20('0x71')](_0x16c48d[_0xea20('0x27')])[_0xea20('0x73')](_0xea20('0x74'));return _0x44d6e5[_0xea20('0x24')](0xc8)[_0xea20('0x30')](_0x16c48d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 796dd30..873f0c6 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1a1c9e,_0x45c857){var _0x1e4125=function(_0x4b9811){while(--_0x4b9811){_0x1a1c9e['push'](_0x1a1c9e['shift']());}};_0x1e4125(++_0x45c857);}(_0xe14b,0x93));var _0xbe14=function(_0x444562,_0x37a025){_0x444562=_0x444562-0x0;var _0x229872=_0xe14b[_0x444562];return _0x229872;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x10d6f5,_0x140245){var _0x484db4=function(_0x2f7ec4){while(--_0x2f7ec4){_0x10d6f5['push'](_0x10d6f5['shift']());}};_0x484db4(++_0x140245);}(_0x3e74,0x175));var _0x43e7=function(_0x15e5a9,_0x14408a){_0x15e5a9=_0x15e5a9-0x0;var _0x482dac=_0x3e74[_0x15e5a9];return _0x482dac;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 2b7a972..7252592 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 _0x4ada=['map','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','options','raw','where','attributes','include','model'];(function(_0x378841,_0x2998e6){var _0x192cce=function(_0xf62ce8){while(--_0xf62ce8){_0x378841['push'](_0x378841['shift']());}};_0x192cce(++_0x2998e6);}(_0x4ada,0xfb));var _0xa4ad=function(_0x2a08ad,_0xc2ee20){_0x2a08ad=_0x2a08ad-0x0;var _0x4050c1=_0x4ada[_0x2a08ad];return _0x4050c1;};'use strict';var _=require(_0xa4ad('0x0'));var util=require(_0xa4ad('0x1'));var moment=require(_0xa4ad('0x2'));var BPromise=require(_0xa4ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4ad('0x4'));var db=require(_0xa4ad('0x5'))['db'];var utils=require(_0xa4ad('0x6'));var logger=require(_0xa4ad('0x7'))(_0xa4ad('0x8'));var config=require(_0xa4ad('0x9'));var jayson=require(_0xa4ad('0xa'));var client=jayson['client'][_0xa4ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10885b,_0x980449,_0x484b16){return new BPromise(function(_0x356711,_0x4bcfcd){return client['request'](_0x10885b,_0x484b16)['then'](function(_0x39c9b3){logger[_0xa4ad('0xc')](_0xa4ad('0xd'),_0x980449,_0xa4ad('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x980449,_0xa4ad('0xe'),JSON[_0xa4ad('0xf')](_0x39c9b3));if(_0x39c9b3[_0xa4ad('0x10')]){if(_0x39c9b3['error'][_0xa4ad('0x11')]===0x1f4){logger['error'](_0xa4ad('0xd'),_0x980449,_0x39c9b3[_0xa4ad('0x10')][_0xa4ad('0x12')]);return _0x4bcfcd(_0x39c9b3[_0xa4ad('0x10')]['message']);}logger[_0xa4ad('0x10')](_0xa4ad('0xd'),_0x980449,_0x39c9b3[_0xa4ad('0x10')]['message']);return _0x356711(_0x39c9b3[_0xa4ad('0x10')][_0xa4ad('0x12')]);}else{logger[_0xa4ad('0xc')]('Setting,\x20%s,\x20%s',_0x980449,_0xa4ad('0xe'));_0x356711(_0x39c9b3[_0xa4ad('0x13')][_0xa4ad('0x12')]);}})[_0xa4ad('0x14')](function(_0x7273a7){logger[_0xa4ad('0x10')]('Setting,\x20%s,\x20%s',_0x980449,_0x7273a7);_0x4bcfcd(_0x7273a7);});});}exports[_0xa4ad('0x15')]=function(_0x32da3b){var _0x126fe3=this;return new Promise(function(_0x103373,_0xaaf7c6){return db['Setting']['find']({'raw':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x17')]===undefined?!![]:![]:!![],'where':_0x32da3b['options']?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x18')]||null:null,'attributes':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x19')]||null:null,'include':_0x32da3b[_0xa4ad('0x16')]?_0x32da3b[_0xa4ad('0x16')][_0xa4ad('0x1a')]?_['map'](_0x32da3b['options'][_0xa4ad('0x1a')],function(_0x4ac3ac){return{'model':db[_0x4ac3ac[_0xa4ad('0x1b')]],'as':_0x4ac3ac['as'],'attributes':_0x4ac3ac[_0xa4ad('0x19')],'include':_0x4ac3ac[_0xa4ad('0x1a')]?_[_0xa4ad('0x1c')](_0x4ac3ac[_0xa4ad('0x1a')],function(_0x5d59ae){return{'model':db[_0x5d59ae['model']],'as':_0x5d59ae['as'],'attributes':_0x5d59ae[_0xa4ad('0x19')],'include':_0x5d59ae['include']?_['map'](_0x5d59ae['include'],function(_0x169079){return{'model':db[_0x169079[_0xa4ad('0x1b')]],'as':_0x169079['as'],'attributes':_0x169079[_0xa4ad('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa4ad('0x1d')](function(_0x13565f){logger[_0xa4ad('0xc')]('ShowSetting',_0x32da3b);logger[_0xa4ad('0x1e')]('ShowSetting',_0x32da3b,JSON['stringify'](_0x13565f));_0x103373(_0x13565f);})['catch'](function(_0x4a74ce){logger[_0xa4ad('0x10')](_0xa4ad('0x15'),_0x4a74ce[_0xa4ad('0x12')],_0x32da3b);_0xaaf7c6(_0x126fe3[_0xa4ad('0x10')](0x1f4,_0x4a74ce['message']));});});}; \ No newline at end of file +var _0xfa0c=['Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x312b89,_0x3ed2c2){var _0x5c0d3e=function(_0x3fd0ae){while(--_0x3fd0ae){_0x312b89['push'](_0x312b89['shift']());}};_0x5c0d3e(++_0x3ed2c2);}(_0xfa0c,0x102));var _0xcfa0=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0xfa0c[_0x47e309];return _0x2e1900;};'use strict';var _=require(_0xcfa0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfa0('0x1'));var rs=require(_0xcfa0('0x2'));var fs=require('fs');var Redis=require(_0xcfa0('0x3'));var db=require(_0xcfa0('0x4'))['db'];var utils=require(_0xcfa0('0x5'));var logger=require(_0xcfa0('0x6'))('rpc');var config=require(_0xcfa0('0x7'));var jayson=require(_0xcfa0('0x8'));var client=jayson[_0xcfa0('0x9')][_0xcfa0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe781f4,_0x250250,_0x42f744){return new BPromise(function(_0x164712,_0x3b4a51){return client[_0xcfa0('0xb')](_0xe781f4,_0x42f744)[_0xcfa0('0xc')](function(_0x559cae){logger[_0xcfa0('0xd')](_0xcfa0('0xe'),_0x250250,'request\x20sent');logger['debug'](_0xcfa0('0xf'),_0x250250,_0xcfa0('0x10'),JSON['stringify'](_0x559cae));if(_0x559cae[_0xcfa0('0x11')]){if(_0x559cae[_0xcfa0('0x11')][_0xcfa0('0x12')]===0x1f4){logger[_0xcfa0('0x11')](_0xcfa0('0xe'),_0x250250,_0x559cae['error']['message']);return _0x3b4a51(_0x559cae[_0xcfa0('0x11')][_0xcfa0('0x13')]);}logger[_0xcfa0('0x11')](_0xcfa0('0xe'),_0x250250,_0x559cae[_0xcfa0('0x11')][_0xcfa0('0x13')]);return _0x164712(_0x559cae[_0xcfa0('0x11')][_0xcfa0('0x13')]);}else{logger[_0xcfa0('0xd')](_0xcfa0('0xe'),_0x250250,'request\x20sent');_0x164712(_0x559cae[_0xcfa0('0x14')][_0xcfa0('0x13')]);}})[_0xcfa0('0x15')](function(_0x41c82f){logger[_0xcfa0('0x11')]('Setting,\x20%s,\x20%s',_0x250250,_0x41c82f);_0x3b4a51(_0x41c82f);});});}exports[_0xcfa0('0x16')]=function(_0x262be7){var _0x4dd7be=this;return new Promise(function(_0x2000f2,_0x2fc0e0){return db[_0xcfa0('0x17')][_0xcfa0('0x18')]({'raw':_0x262be7[_0xcfa0('0x19')]?_0x262be7[_0xcfa0('0x19')][_0xcfa0('0x1a')]===undefined?!![]:![]:!![],'where':_0x262be7[_0xcfa0('0x19')]?_0x262be7[_0xcfa0('0x19')][_0xcfa0('0x1b')]||null:null,'attributes':_0x262be7[_0xcfa0('0x19')]?_0x262be7[_0xcfa0('0x19')][_0xcfa0('0x1c')]||null:null,'include':_0x262be7[_0xcfa0('0x19')]?_0x262be7[_0xcfa0('0x19')]['include']?_[_0xcfa0('0x1d')](_0x262be7[_0xcfa0('0x19')][_0xcfa0('0x1e')],function(_0x3c6c67){return{'model':db[_0x3c6c67[_0xcfa0('0x1f')]],'as':_0x3c6c67['as'],'attributes':_0x3c6c67[_0xcfa0('0x1c')],'include':_0x3c6c67[_0xcfa0('0x1e')]?_[_0xcfa0('0x1d')](_0x3c6c67[_0xcfa0('0x1e')],function(_0x481314){return{'model':db[_0x481314[_0xcfa0('0x1f')]],'as':_0x481314['as'],'attributes':_0x481314[_0xcfa0('0x1c')],'include':_0x481314[_0xcfa0('0x1e')]?_[_0xcfa0('0x1d')](_0x481314[_0xcfa0('0x1e')],function(_0x4723c1){return{'model':db[_0x4723c1['model']],'as':_0x4723c1['as'],'attributes':_0x4723c1[_0xcfa0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcfa0('0xc')](function(_0x59b4cf){logger['info']('ShowSetting',_0x262be7);logger[_0xcfa0('0x20')](_0xcfa0('0x16'),_0x262be7,JSON[_0xcfa0('0x21')](_0x59b4cf));_0x2000f2(_0x59b4cf);})[_0xcfa0('0x15')](function(_0x6a3b4f){logger[_0xcfa0('0x11')](_0xcfa0('0x16'),_0x6a3b4f[_0xcfa0('0x13')],_0x262be7);_0x2fc0e0(_0x4dd7be[_0xcfa0('0x11')](0x1f4,_0x6a3b4f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index cd82ec2..059e2eb 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x47c9d1,_0x2bb28c){var _0x5d54f3=function(_0x3352c6){while(--_0x3352c6){_0x47c9d1['push'](_0x47c9d1['shift']());}};_0x5d54f3(++_0x2bb28c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4ae58a,_0x72bd08){var _0x3c0445=function(_0x15c4cb){while(--_0x15c4cb){_0x4ae58a['push'](_0x4ae58a['shift']());}};_0x3c0445(++_0x72bd08);}(_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')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index d5c42c1..9eceec9 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 _0x5ebc=['STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports'];(function(_0x5b4716,_0x4b7a3b){var _0xd1fcf3=function(_0x2a8410){while(--_0x2a8410){_0x5b4716['push'](_0x5b4716['shift']());}};_0xd1fcf3(++_0x4b7a3b);}(_0x5ebc,0xe4));var _0xc5eb=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5ebc[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc5eb('0x0'));module[_0xc5eb('0x1')]={'name':{'type':Sequelize[_0xc5eb('0x2')],'unique':_0xc5eb('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc5eb('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc5eb('0x2')],'defaultValue':function(){return rs[_0xc5eb('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc5eb('0x5')](_0xc5eb('0x6'),'skebby',_0xc5eb('0x7'),_0xc5eb('0x8'),_0xc5eb('0x9'),_0xc5eb('0xa'),_0xc5eb('0xb'),_0xc5eb('0xc'),_0xc5eb('0xd'),_0xc5eb('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xc5eb('0x2')]},'authToken':{'type':Sequelize[_0xc5eb('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc5eb('0x2')]},'password':{'type':Sequelize[_0xc5eb('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xc5eb('0x2')]},'accountId':{'type':Sequelize[_0xc5eb('0x2')]},'senderString':{'type':Sequelize[_0xc5eb('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc5eb('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc5eb('0xf')],'defaultValue':function(){return _0xc5eb('0x10');}},'notificationSound':{'type':Sequelize[_0xc5eb('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc5eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc5eb('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc5eb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc5eb('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5eb('0x12')],'comment':_0xc5eb('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc5eb('0x14'),'set':function(_0x2a9f5e){if(!_0x2a9f5e)this[_0xc5eb('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xc5eb('0x16'),_0x2a9f5e);}}}; \ No newline at end of file +var _0x04f8=['generate','ENUM','twilio','skebby','connectel','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name'];(function(_0x12644c,_0x9f9637){var _0xf9b6f7=function(_0x3c55f1){while(--_0x3c55f1){_0x12644c['push'](_0x12644c['shift']());}};_0xf9b6f7(++_0x9f9637);}(_0x04f8,0x1c5));var _0x804f=function(_0x5190aa,_0x472b1a){_0x5190aa=_0x5190aa-0x0;var _0xea9954=_0x04f8[_0x5190aa];return _0xea9954;};'use strict';var Sequelize=require(_0x804f('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x804f('0x1')],'unique':_0x804f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x804f('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x804f('0x1')],'defaultValue':function(){return rs[_0x804f('0x3')]();}},'phone':{'type':Sequelize[_0x804f('0x1')]},'type':{'type':Sequelize[_0x804f('0x4')](_0x804f('0x5'),_0x804f('0x6'),_0x804f('0x7'),'clicksend','plivo','clickatell',_0x804f('0x8'),_0x804f('0x9'),'infobip',_0x804f('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x804f('0x1')]},'smsMethod':{'type':Sequelize[_0x804f('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x804f('0x1')]},'password':{'type':Sequelize[_0x804f('0x1')]},'apiKey':{'type':Sequelize[_0x804f('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x804f('0x1')]},'senderString':{'type':Sequelize[_0x804f('0x1')]},'deliveryReport':{'type':Sequelize[_0x804f('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x804f('0xc')],'defaultValue':function(){return _0x804f('0xd');}},'notificationSound':{'type':Sequelize[_0x804f('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x804f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x804f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x804f('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x804f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x804f('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x804f('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x804f('0xf'),'set':function(_0x3723e4){if(!_0x3723e4)this[_0x804f('0x10')](_0x804f('0x11'),null);this[_0x804f('0x10')](_0x804f('0x12'),_0x3723e4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5631326..985b46c 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 _0xe8c0=['rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','Pause','length','options','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','nolimit','map','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','orderBy','Applications','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','text','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','User','UserId','agent','waitForTheAssignedAgent','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','json','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','apply','save','update','destroy','get','SmsAccounts','name','index','mandatoryDispositionPause','SmsAccount'];(function(_0x1bafea,_0x1b5f28){var _0x2f65b7=function(_0x296ed5){while(--_0x296ed5){_0x1bafea['push'](_0x1bafea['shift']());}};_0x2f65b7(++_0x1b5f28);}(_0xe8c0,0xac));var _0x0e8c=function(_0x2eeb63,_0x5c5c09){_0x2eeb63=_0x2eeb63-0x0;var _0x2a251c=_0xe8c0[_0x2eeb63];return _0x2a251c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e8c('0x0'));var zipdir=require(_0x0e8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e8c('0x2'));var moment=require(_0x0e8c('0x3'));var BPromise=require(_0x0e8c('0x4'));var Mustache=require(_0x0e8c('0x5'));var util=require(_0x0e8c('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e8c('0x7'));var fs=require('fs');var fs_extra=require(_0x0e8c('0x8'));var _=require('lodash');var squel=require(_0x0e8c('0x9'));var crypto=require('crypto');var jsforce=require(_0x0e8c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e8c('0xb'));var Papa=require(_0x0e8c('0xc'));var Redis=require(_0x0e8c('0xd'));var authService=require(_0x0e8c('0xe'));var qs=require(_0x0e8c('0xf'));var as=require(_0x0e8c('0x10'));var hardwareService=require(_0x0e8c('0x11'));var logger=require('../../config/logger')(_0x0e8c('0x12'));var utils=require('../../config/utils');var config=require(_0x0e8c('0x13'));var licenseUtil=require(_0x0e8c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0e8c('0x15')](config[_0x0e8c('0x16')],{'host':_0x0e8c('0x17'),'port':0x18eb});var socket=require(_0x0e8c('0x18'))(new Redis(config[_0x0e8c('0x16')]));require('./smsAccount.socket')[_0x0e8c('0x19')](socket);var jayson=require(_0x0e8c('0x1a'));var client=jayson[_0x0e8c('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x45f648,_0x4796b1,_0x4bd7e6,_0x33c316){return new BPromise(function(_0x2e0f43,_0x3345a3){var _0x194a0f=_0x33c316||client;return _0x194a0f['request'](_0x45f648,_0x4bd7e6)[_0x0e8c('0x1c')](function(_0x1482dd){logger[_0x0e8c('0x1d')](_0x0e8c('0x1e'),_0x4796b1,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4796b1,_0x0e8c('0x1f'),JSON[_0x0e8c('0x20')](_0x1482dd));if(_0x1482dd[_0x0e8c('0x21')]){if(_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x22')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4796b1,_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);return _0x3345a3(_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);}logger[_0x0e8c('0x21')](_0x0e8c('0x1e'),_0x4796b1,_0x1482dd[_0x0e8c('0x21')][_0x0e8c('0x23')]);return _0x2e0f43(_0x1482dd['error']['message']);}else{logger[_0x0e8c('0x1d')](_0x0e8c('0x1e'),_0x4796b1,_0x0e8c('0x1f'));_0x2e0f43(_0x1482dd['result']['message']);}})[_0x0e8c('0x24')](function(_0x3c7fbb){logger[_0x0e8c('0x21')](_0x0e8c('0x1e'),_0x4796b1,_0x3c7fbb);_0x3345a3(_0x3c7fbb);});});}function respondWithStatusCode(_0x40f401,_0x3ef2a0){_0x3ef2a0=_0x3ef2a0||0xcc;return function(_0x430b59){if(_0x430b59){return _0x40f401[_0x0e8c('0x25')](_0x3ef2a0);}return _0x40f401[_0x0e8c('0x26')](_0x3ef2a0)[_0x0e8c('0x27')]();};}function respondWithResult(_0x389bf2,_0x29adc0){_0x29adc0=_0x29adc0||0xc8;return function(_0x41fe1b){if(_0x41fe1b){return _0x389bf2[_0x0e8c('0x26')](_0x29adc0)['json'](_0x41fe1b);}};}function respondWithFilteredResult(_0x2a1602,_0x4bd6ed){return function(_0x325631){if(_0x325631){var _0x2bb2b5=typeof _0x4bd6ed['offset']===_0x0e8c('0x28')&&typeof _0x4bd6ed[_0x0e8c('0x29')]===_0x0e8c('0x28');var _0x3c5a53=_0x325631[_0x0e8c('0x2a')];var _0x122838=_0x2bb2b5?0x0:_0x4bd6ed[_0x0e8c('0x2b')];var _0xfa3b89=_0x2bb2b5?_0x325631[_0x0e8c('0x2a')]:_0x4bd6ed[_0x0e8c('0x2b')]+_0x4bd6ed[_0x0e8c('0x29')];var _0x24b9a2;if(_0xfa3b89>=_0x3c5a53){_0xfa3b89=_0x3c5a53;_0x24b9a2=0xc8;}else{_0x24b9a2=0xce;}_0x2a1602[_0x0e8c('0x26')](_0x24b9a2);return _0x2a1602['set']('Content-Range',_0x122838+'-'+_0xfa3b89+'/'+_0x3c5a53)['json'](_0x325631);}return null;};}function patchUpdates(_0xd7007c){return function(_0x19c15c){try{jsonpatch[_0x0e8c('0x2c')](_0x19c15c,_0xd7007c,!![]);}catch(_0x3c497b){return BPromise['reject'](_0x3c497b);}return _0x19c15c[_0x0e8c('0x2d')]();};}function saveUpdates(_0x247c66,_0x1d4215){return function(_0x579049){if(_0x579049){return _0x579049[_0x0e8c('0x2e')](_0x247c66)['then'](function(_0x235312){return _0x235312;});}return null;};}function removeEntity(_0x1b3fac,_0x391bd1){return function(_0x313db3){if(_0x313db3){return _0x313db3[_0x0e8c('0x2f')]()[_0x0e8c('0x1c')](function(){var _0x14138c=_0x313db3[_0x0e8c('0x30')]({'plain':!![]});var _0x54d8f3=_0x0e8c('0x31');return db['UserProfileResource'][_0x0e8c('0x2f')]({'where':{'type':_0x54d8f3,'resourceId':_0x14138c['id']}})[_0x0e8c('0x1c')](function(){return _0x313db3;});})[_0x0e8c('0x1c')](function(){_0x1b3fac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1682f1,_0x3bd9ab){return function(_0x47eb36){if(!_0x47eb36){_0x1682f1['sendStatus'](0x194);}return _0x47eb36;};}function handleError(_0x4e9d9f,_0x19d7b5){_0x19d7b5=_0x19d7b5||0x1f4;return function(_0x1fd385){logger[_0x0e8c('0x21')](_0x1fd385['stack']);if(_0x1fd385[_0x0e8c('0x32')]){delete _0x1fd385[_0x0e8c('0x32')];}_0x4e9d9f[_0x0e8c('0x26')](_0x19d7b5)['send'](_0x1fd385);};}exports[_0x0e8c('0x33')]=function(_0x3a7b9e,_0x5d6cdd){var _0x5f161c={'include':[{'model':db['Pause'],'as':_0x0e8c('0x34')}]},_0x23370c={},_0x1fbfdf={'count':0x0,'rows':[]};var _0x2a97ad=_['map'](db[_0x0e8c('0x35')][_0x0e8c('0x36')],function(_0x2d8170){return{'name':_0x2d8170[_0x0e8c('0x37')],'type':_0x2d8170[_0x0e8c('0x38')][_0x0e8c('0x39')]};});_0x23370c[_0x0e8c('0x3a')]=_['map'](_0x2a97ad,_0x0e8c('0x32'));_0x23370c[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x3a7b9e['query']);_0x23370c['filters']=_['intersection'](_0x23370c[_0x0e8c('0x3a')],_0x23370c[_0x0e8c('0x3b')]);_0x5f161c[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x23370c[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x3a7b9e[_0x0e8c('0x3b')]['fields']));_0x5f161c[_0x0e8c('0x3d')]=_0x5f161c['attributes']['length']?_0x5f161c[_0x0e8c('0x3d')]:_0x23370c[_0x0e8c('0x3a')];if(!_0x3a7b9e['query']['hasOwnProperty']('nolimit')){_0x5f161c[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x3a7b9e[_0x0e8c('0x3b')]['limit']);_0x5f161c[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x5f161c[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x5f161c[_0x0e8c('0x42')]=qs['filters'](_[_0x0e8c('0x43')](_0x3a7b9e[_0x0e8c('0x3b')],_0x23370c[_0x0e8c('0x44')]),_0x2a97ad);if(_0x3a7b9e[_0x0e8c('0x3b')]['filter']){_0x5f161c[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x5f161c['where'],{'$or':_['map'](_0x2a97ad,function(_0x187f3e){if(_0x187f3e[_0x0e8c('0x38')]!==_0x0e8c('0x46')){var _0x2878fa={};_0x2878fa[_0x187f3e[_0x0e8c('0x32')]]={'$like':'%'+_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x2878fa;}})});}_0x5f161c=_[_0x0e8c('0x45')]({},_0x5f161c,_0x3a7b9e['options']);var _0x4015e6={'where':_0x5f161c[_0x0e8c('0x42')]};return db[_0x0e8c('0x35')][_0x0e8c('0x2a')](_0x4015e6)[_0x0e8c('0x1c')](function(_0x1ca70d){_0x1fbfdf[_0x0e8c('0x2a')]=_0x1ca70d;if(_0x3a7b9e[_0x0e8c('0x3b')][_0x0e8c('0x48')]){_0x5f161c[_0x0e8c('0x49')]=[{'all':!![]}];}return db[_0x0e8c('0x35')][_0x0e8c('0x4a')](_0x5f161c);})['then'](function(_0x417343){_0x1fbfdf['rows']=_0x417343;return _0x1fbfdf;})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x5d6cdd,_0x5f161c))[_0x0e8c('0x24')](handleError(_0x5d6cdd,null));};exports[_0x0e8c('0x4b')]=function(_0x234aed,_0x2d59c3){var _0x12e55a={'raw':![],'where':{'id':_0x234aed[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x4d')],'as':_0x0e8c('0x34')}]},_0x157963={};_0x157963[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x35')]['rawAttributes']);_0x157963['query']=_[_0x0e8c('0x3c')](_0x234aed[_0x0e8c('0x3b')]);_0x157963[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x157963['model'],_0x157963['query']);_0x12e55a[_0x0e8c('0x3d')]=_['intersection'](_0x157963['model'],qs[_0x0e8c('0x3f')](_0x234aed[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x12e55a['attributes']=_0x12e55a[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x12e55a[_0x0e8c('0x3d')]:_0x157963[_0x0e8c('0x3a')];if(_0x234aed[_0x0e8c('0x3b')]['includeAll']){_0x12e55a['include']=[{'all':!![]}];}_0x12e55a=_['merge']({},_0x12e55a,_0x234aed[_0x0e8c('0x4f')]);return db[_0x0e8c('0x35')][_0x0e8c('0x50')](_0x12e55a)[_0x0e8c('0x1c')](handleEntityNotFound(_0x2d59c3,null))[_0x0e8c('0x1c')](respondWithResult(_0x2d59c3,null))['catch'](handleError(_0x2d59c3,null));};exports[_0x0e8c('0x51')]=function(_0x2cb523,_0x3ba669){return db[_0x0e8c('0x35')][_0x0e8c('0x51')](_0x2cb523[_0x0e8c('0x52')],{})['then'](function(_0x576b8b){var _0x5a3eda=_0x2cb523[_0x0e8c('0x53')][_0x0e8c('0x30')]({'plain':!![]});if(!_0x5a3eda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a3eda[_0x0e8c('0x54')]===_0x0e8c('0x53')){var _0x3fd100=_0x576b8b[_0x0e8c('0x30')]({'plain':!![]});var _0x37cecf=_0x0e8c('0x31');return db[_0x0e8c('0x55')][_0x0e8c('0x50')]({'where':{'name':_0x37cecf,'userProfileId':_0x5a3eda[_0x0e8c('0x56')]},'raw':!![]})['then'](function(_0x525060){if(_0x525060&&_0x525060['autoAssociation']===0x0){return db[_0x0e8c('0x57')][_0x0e8c('0x51')]({'name':_0x3fd100[_0x0e8c('0x32')],'resourceId':_0x3fd100['id'],'type':_0x525060[_0x0e8c('0x32')],'sectionId':_0x525060['id']},{})[_0x0e8c('0x1c')](function(){return _0x576b8b;});}else{return _0x576b8b;}})['catch'](function(_0x1a89d2){logger[_0x0e8c('0x21')](_0x0e8c('0x58'),_0x1a89d2);throw _0x1a89d2;});}return _0x576b8b;})[_0x0e8c('0x1c')](respondWithResult(_0x3ba669,0xc9))[_0x0e8c('0x24')](handleError(_0x3ba669,null));};exports[_0x0e8c('0x2e')]=function(_0x166d8f,_0x17d4a8){if(_0x166d8f[_0x0e8c('0x52')]['id']){delete _0x166d8f[_0x0e8c('0x52')]['id'];}return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x166d8f[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x4d')],'as':_0x0e8c('0x34')}]})['then'](handleEntityNotFound(_0x17d4a8,null))[_0x0e8c('0x1c')](saveUpdates(_0x166d8f[_0x0e8c('0x52')],null))['then'](respondWithResult(_0x17d4a8,null))['catch'](handleError(_0x17d4a8,null));};exports[_0x0e8c('0x2f')]=function(_0x40001a,_0x13b1d6){return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x40001a['params']['id']}})['then'](handleEntityNotFound(_0x13b1d6,null))[_0x0e8c('0x1c')](removeEntity(_0x13b1d6,null))['catch'](handleError(_0x13b1d6,null));};exports[_0x0e8c('0x59')]=function(_0x3d6ea4,_0x4c5cfe){return db[_0x0e8c('0x35')][_0x0e8c('0x59')]()['then'](respondWithResult(_0x4c5cfe,null))[_0x0e8c('0x24')](handleError(_0x4c5cfe,null));};exports[_0x0e8c('0x5a')]=function(_0x34fb19,_0x102071,_0x129000){if(_0x34fb19[_0x0e8c('0x52')]['id']){delete _0x34fb19['body']['id'];}return db[_0x0e8c('0x35')]['find']({'where':{'id':_0x34fb19['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x102071,null))['then'](function(_0x226499){if(_0x226499){_0x34fb19[_0x0e8c('0x52')][_0x0e8c('0x5b')]=_0x226499['id'];return db[_0x0e8c('0x5c')][_0x0e8c('0x51')](_0x34fb19[_0x0e8c('0x52')]);}})['then'](respondWithResult(_0x102071,null))[_0x0e8c('0x24')](handleError(_0x102071,null));};exports['getDispositions']=function(_0xd41d9e,_0x278dab,_0x4b76d1){var _0xc912da={'raw':![],'where':{}};var _0x153023={};var _0x5ab76c={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')]['findOne']({'where':{'id':_0xd41d9e[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278dab,null))[_0x0e8c('0x1c')](function(_0x58c36e){if(_0x58c36e){_0x153023[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x5c')]['rawAttributes']);_0x153023[_0x0e8c('0x3b')]=_['keys'](_0xd41d9e['query']);_0x153023[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x153023[_0x0e8c('0x3a')],_0x153023[_0x0e8c('0x3b')]);_0xc912da[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x153023[_0x0e8c('0x3a')],qs['fields'](_0xd41d9e['query']['fields']));_0xc912da[_0x0e8c('0x3d')]=_0xc912da[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0xc912da[_0x0e8c('0x3d')]:_0x153023[_0x0e8c('0x3a')];if(!_0xd41d9e['query'][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0xc912da[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x29')]);_0xc912da[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0xc912da[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0xc912da[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0xd41d9e[_0x0e8c('0x3b')],_0x153023[_0x0e8c('0x44')]));_0xc912da[_0x0e8c('0x42')]['SmsAccountId']=_0x58c36e['id'];if(_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]){_0xc912da[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0xc912da[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0xc912da[_0x0e8c('0x3d')],function(_0x3ac5e0){var _0x553d18={};_0x553d18[_0x3ac5e0]={'$like':'%'+_0xd41d9e[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x553d18;})});}_0xc912da=_[_0x0e8c('0x45')]({},_0xc912da,_0xd41d9e[_0x0e8c('0x4f')]);return db[_0x0e8c('0x5c')][_0x0e8c('0x2a')]({'where':_0xc912da[_0x0e8c('0x42')]})[_0x0e8c('0x1c')](function(_0x4cebb6){_0x5ab76c[_0x0e8c('0x2a')]=_0x4cebb6;if(_0xd41d9e[_0x0e8c('0x3b')]['includeAll']){_0xc912da['include']=[{'all':!![]}];}return db['Disposition'][_0x0e8c('0x4a')](_0xc912da);})['then'](function(_0x411776){_0x5ab76c[_0x0e8c('0x60')]=_0x411776;return _0x5ab76c;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x278dab,_0xc912da))[_0x0e8c('0x24')](handleError(_0x278dab,null));};exports[_0x0e8c('0x61')]=function(_0x4616ee,_0xc22339,_0x34d242){return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x4616ee['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0xc22339,null))[_0x0e8c('0x1c')](function(_0x27339c){if(_0x27339c){return _0x27339c[_0x0e8c('0x61')](_0x4616ee[_0x0e8c('0x3b')]['ids']);}})[_0x0e8c('0x1c')](respondWithStatusCode(_0xc22339,null))['catch'](handleError(_0xc22339,null));};exports[_0x0e8c('0x62')]=function(_0x371052,_0x59ec2e,_0x76865c){if(_0x371052['body']['id']){delete _0x371052[_0x0e8c('0x52')]['id'];}return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x371052['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x59ec2e,null))['then'](function(_0x3a318f){if(_0x3a318f){_0x371052[_0x0e8c('0x52')][_0x0e8c('0x5b')]=_0x3a318f['id'];return db[_0x0e8c('0x63')][_0x0e8c('0x51')](_0x371052[_0x0e8c('0x52')]);}})[_0x0e8c('0x1c')](respondWithResult(_0x59ec2e,null))[_0x0e8c('0x24')](handleError(_0x59ec2e,null));};exports[_0x0e8c('0x64')]=function(_0x14d962,_0x1eb660,_0x41fd13){var _0x4a74ef={'raw':![],'where':{}};var _0x2c5683={};var _0x4f7171={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')]['findOne']({'where':{'id':_0x14d962[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1eb660,null))[_0x0e8c('0x1c')](function(_0x12b8fe){if(_0x12b8fe){_0x2c5683[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x63')]['rawAttributes']);_0x2c5683[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x14d962[_0x0e8c('0x3b')]);_0x2c5683[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x2c5683['model'],_0x2c5683[_0x0e8c('0x3b')]);_0x4a74ef['attributes']=_[_0x0e8c('0x3e')](_0x2c5683[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x4a74ef[_0x0e8c('0x3d')]=_0x4a74ef[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x4a74ef['attributes']:_0x2c5683[_0x0e8c('0x3a')];if(!_0x14d962['query'][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0x4a74ef[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x14d962['query'][_0x0e8c('0x29')]);_0x4a74ef[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x4a74ef[_0x0e8c('0x40')]=qs['sort'](_0x14d962[_0x0e8c('0x3b')]['sort']);_0x4a74ef['where']=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x14d962[_0x0e8c('0x3b')],_0x2c5683[_0x0e8c('0x44')]));_0x4a74ef[_0x0e8c('0x42')][_0x0e8c('0x5b')]=_0x12b8fe['id'];if(_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x47')]){_0x4a74ef[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x4a74ef[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0x4a74ef[_0x0e8c('0x3d')],function(_0x2e87b8){var _0x2b1fde={};_0x2b1fde[_0x2e87b8]={'$like':'%'+_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x2b1fde;})});}_0x4a74ef=_[_0x0e8c('0x45')]({},_0x4a74ef,_0x14d962[_0x0e8c('0x4f')]);return db[_0x0e8c('0x63')][_0x0e8c('0x2a')]({'where':_0x4a74ef[_0x0e8c('0x42')]})['then'](function(_0x319c8e){_0x4f7171[_0x0e8c('0x2a')]=_0x319c8e;if(_0x14d962[_0x0e8c('0x3b')][_0x0e8c('0x48')]){_0x4a74ef[_0x0e8c('0x49')]=[{'all':!![]}];}return db[_0x0e8c('0x63')][_0x0e8c('0x4a')](_0x4a74ef);})[_0x0e8c('0x1c')](function(_0x5c6d16){_0x4f7171[_0x0e8c('0x60')]=_0x5c6d16;return _0x4f7171;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x1eb660,_0x4a74ef))[_0x0e8c('0x24')](handleError(_0x1eb660,null));};exports[_0x0e8c('0x65')]=function(_0x52039e,_0x763606,_0x25e393){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x52039e['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x763606,null))[_0x0e8c('0x1c')](function(_0x30aea7){if(_0x30aea7){return _0x30aea7[_0x0e8c('0x65')](_0x52039e[_0x0e8c('0x3b')][_0x0e8c('0x66')]);}})[_0x0e8c('0x1c')](respondWithStatusCode(_0x763606,null))[_0x0e8c('0x24')](handleError(_0x763606,null));};exports[_0x0e8c('0x67')]=function(_0x4d7302,_0x40f583,_0x5de5d4){var _0x4c7e64={'channel':_0x0e8c('0x68')};var _0xc82e48=[];var _0x172c76=[];var _0x427e9c={};return db[_0x0e8c('0x35')]['find']({'where':{'id':_0x4d7302[_0x0e8c('0x4c')]['id']},'include':[{'model':db[_0x0e8c('0x69')],'as':'Applications'}]})[_0x0e8c('0x1c')](handleEntityNotFound(_0x40f583,null))[_0x0e8c('0x1c')](function(_0x3ab7ff){_0x4c7e64['account']=_0x3ab7ff;_0x4c7e64['applications']=_[_0x0e8c('0x6a')](_0x3ab7ff[_0x0e8c('0x6b')],[_0x0e8c('0x6c')],[_0x0e8c('0x6d')]);if(_0x4c7e64['account']['Applications']){delete _0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x6b')];}return db[_0x0e8c('0x6f')]['describe']();})[_0x0e8c('0x1c')](function(_0x251e44){if(!_0x251e44){throw new db[(_0x0e8c('0x70'))]['ValidationError'](_0x0e8c('0x71'));}_0xc82e48=_[_0x0e8c('0x72')](_[_0x0e8c('0x3c')](_0x251e44),['createdAt',_0x0e8c('0x73')]);_0x172c76=_[_0x0e8c('0x72')](_['keys'](_0x251e44),[_0x0e8c('0x74'),_0x0e8c('0x73'),_0x0e8c('0x75'),_0x0e8c('0x76')]);_0x4c7e64[_0x0e8c('0x52')]={'mapKey':_0x0e8c('0x77')};if(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x38')]){switch(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x38')]){case _0x0e8c('0x78'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7a')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7b')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7d')];break;case _0x0e8c('0x7e'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]='+'+_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x7f')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['text'];break;case _0x0e8c('0x80'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302['body']['from'];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x23')];break;case _0x0e8c('0x81'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302['body']['from'];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x52')];_0x4c7e64[_0x0e8c('0x52')]['messageId']=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x82')];break;case _0x0e8c('0x83'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')]['From'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['Text'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x84')];break;case _0x0e8c('0x85'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]='+'+_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0][_0x0e8c('0x79')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['results'][0x0][_0x0e8c('0x87')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0]['messageId'];break;case'csc':_0x4c7e64['body']['from']=_0x4d7302[_0x0e8c('0x52')]['originatingAddress'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')]['segmentedMessage'][_0x0e8c('0x23')];break;case _0x0e8c('0x88'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x89')];_0x4c7e64['body'][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x87')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x8a')];break;case _0x0e8c('0x8b'):_0x4c7e64[_0x0e8c('0x52')]['messageId']=_0x4d7302['body'][0x0][_0x0e8c('0x23')]['id'];_0x4c7e64[_0x0e8c('0x52')]['from']=_0x4d7302[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')][_0x0e8c('0x79')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')][_0x0e8c('0x87')];break;case _0x0e8c('0x8c'):_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')]=_0x4d7302[_0x0e8c('0x52')]['from'];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]=_0x4d7302[_0x0e8c('0x52')][_0x0e8c('0x23')];_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')]=_0x4d7302['body'][_0x0e8c('0x8d')];break;}}if(_0x4c7e64[_0x0e8c('0x52')]['id']){delete _0x4c7e64[_0x0e8c('0x52')]['id'];}if(_[_0x0e8c('0x8e')](_0x4c7e64[_0x0e8c('0x52')]['from'])){throw new db['Sequelize'][(_0x0e8c('0x8f'))](_0x0e8c('0x90'));}if(_[_0x0e8c('0x8e')](_0x4c7e64['body']['body'])||_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x52')]===''){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0e8c('0x8e')](_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))](_0x0e8c('0x92')+_0x172c76);}if(!_[_0x0e8c('0x93')](_0x172c76,_0x4c7e64[_0x0e8c('0x52')]['mapKey'])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))](_0x0e8c('0x94')+_0x172c76);}_0x427e9c[_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')]]=_0x4c7e64[_0x0e8c('0x52')]['from'];return db[_0x0e8c('0x95')][_0x0e8c('0x50')]({'where':{'id':_0x4c7e64['account']['ListId']},'include':[{'model':db[_0x0e8c('0x6f')],'as':_0x0e8c('0x96'),'where':_0x427e9c,'limit':0x1,'order':[[_0x0e8c('0x73'),_0x0e8c('0x97')]]}]});})[_0x0e8c('0x1c')](handleEntityNotFound(_0x40f583,null))['then'](function(_0x5e9840){if(_0x5e9840){_0x4c7e64[_0x0e8c('0x98')]=_[_0x0e8c('0x99')](_0x5e9840,['Contacts']);if(_0x5e9840[_0x0e8c('0x96')][_0x0e8c('0x4e')]){return _0x5e9840[_0x0e8c('0x96')][0x0];}var _0x5679f7=_[_0x0e8c('0x15')](_0x4c7e64[_0x0e8c('0x52')],{'firstName':_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')],'ListId':_0x5e9840['id']});_0x5679f7[_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x91')]]=_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x79')];return db[_0x0e8c('0x6f')][_0x0e8c('0x51')](_0x5679f7,{'fields':_0xc82e48,'raw':!![]});}})['then'](handleEntityNotFound(_0x40f583,null))['then'](function(_0x48f90e){if(_0x48f90e){_0x4c7e64[_0x0e8c('0x9a')]=_0x48f90e;var _0x2e8ede={'ContactId':_0x48f90e['id'],'phone':_0x4c7e64['body'][_0x0e8c('0x79')],'SmsAccountId':_0x4d7302[_0x0e8c('0x4c')]['id']};var _0x5be97a={'ContactId':_0x48f90e['id'],'SmsAccountId':_0x4d7302['params']['id'],'closed':![]};return db[_0x0e8c('0x9b')]['find']({'where':_0x5be97a})[_0x0e8c('0x1c')](function(_0x156d19){if(_0x156d19){return[_0x156d19,![]];}return db[_0x0e8c('0x9b')][_0x0e8c('0x51')](_0x2e8ede)[_0x0e8c('0x1c')](function(_0x5c9b03){return[_0x5c9b03,!![]];});});}})[_0x0e8c('0x9c')](function(_0x430ae4,_0x5ba27b){_0x4c7e64[_0x0e8c('0x9d')]=_0x430ae4[_0x0e8c('0x30')]({'plain':!![]});_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0x9e')]=![];if(_0x5ba27b){if(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0x9f')]){_0x4c7e64['applications']['push']({'id':0x0,'priority':_0x4c7e64[_0x0e8c('0xa0')]['length']+0x1,'app':_0x0e8c('0xa1'),'appdata':_0x0e8c('0xa2'),'interval':_0x0e8c('0xa3')});}_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0x9e')]=!![];}return db[_0x0e8c('0xa4')]['create']({'phone':_0x4c7e64[_0x0e8c('0x52')]['from'],'messageId':_0x4c7e64[_0x0e8c('0x52')][_0x0e8c('0x7c')],'body':_0x4c7e64[_0x0e8c('0x52')]['body'],'SmsAccountId':_0x4d7302[_0x0e8c('0x4c')]['id'],'SmsInteractionId':_0x430ae4['id'],'direction':'in','ContactId':_0x430ae4[_0x0e8c('0xa5')],'AttachmentId':_0x4c7e64[_0x0e8c('0x52')]['AttachmentId']});})[_0x0e8c('0x1c')](function(_0x42b682){_0x4c7e64[_0x0e8c('0x23')]=_0x42b682;if(!_0x4c7e64['interaction']['UserId'])return;return db[_0x0e8c('0xa6')][_0x0e8c('0x50')]({'attributes':['id',_0x0e8c('0x32')],'where':{'id':_0x4c7e64[_0x0e8c('0x9d')][_0x0e8c('0xa7')]}});})['then'](function(_0x21f1aa){if(_0x21f1aa){_0x4c7e64[_0x0e8c('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0e8c('0xa8'),'appdata':_0x21f1aa[_0x0e8c('0x32')]+','+(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0xa9')]||0xa),'interval':_0x0e8c('0xa3')});}if(!_0x4c7e64['interaction']['queueId'])return;return db[_0x0e8c('0xaa')][_0x0e8c('0x50')]({'attributes':['id',_0x0e8c('0x32')],'where':{'id':_0x4c7e64[_0x0e8c('0x9d')]['queueId']}});})['then'](function(_0xc2f879){if(_0xc2f879){_0x4c7e64[_0x0e8c('0xa0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0e8c('0xab'),'appdata':_0xc2f879['name']+','+(_0x4c7e64[_0x0e8c('0x6e')][_0x0e8c('0xac')]||0x12c),'interval':_0x0e8c('0xa3')});}return respondWithRpcPromise('Start',_0x0e8c('0xad'),_0x4c7e64);})['then'](function(_0x520b34){if(_0x520b34){var _0xf549e6=0xc8;var _0x39408f=_0x0e8c('0xae');logger[_0x0e8c('0x1d')](_0x0e8c('0xaf'),_0x39408f,_0xf549e6,_0x0e8c('0xb0'));logger[_0x0e8c('0xb1')](_0x0e8c('0xb2'),_0x39408f,_0xf549e6,_0x0e8c('0xb0'),JSON[_0x0e8c('0x20')](_0x520b34));if(_0x4c7e64[_0x0e8c('0x6e')]['type']===_0x0e8c('0x78')){return _0x40f583[_0x0e8c('0x26')](_0xf549e6)[_0x0e8c('0xb3')](_0x0e8c('0xb4'),_0x0e8c('0xb5'))[_0x0e8c('0xb6')]('\x0a');}else{return _0x40f583[_0x0e8c('0x26')](_0xf549e6)[_0x0e8c('0xb7')](_0x520b34);}}})[_0x0e8c('0x24')](handleError(_0x40f583,null));};exports[_0x0e8c('0xb8')]=function(_0x2c6dd4,_0x35a0e9){var _0x1ac446=_0x2c6dd4[_0x0e8c('0x4c')]['id'];var _0x13edac=_0x2c6dd4[_0x0e8c('0x52')];var _0x51c472=0xc8;var _0x47881b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0e8c('0xb9')][_0x0e8c('0xba')][_0x0e8c('0xbb')][_0x0e8c('0xbc')]},function(_0xd2f972){return db[_0x0e8c('0x35')][_0x0e8c('0xbd')]({'where':{'id':_0x1ac446},'transaction':_0xd2f972})[_0x0e8c('0x1c')](function(_0x4149b0){if(_0x4149b0){return db[_0x0e8c('0x69')][_0x0e8c('0x2f')]({'where':{'SmsAccountId':_0x1ac446},'transaction':_0xd2f972})[_0x0e8c('0x1c')](function(){var _0x42e896=_[_0x0e8c('0x5f')](_0x13edac,function(_0x271133){_0x271133[_0x0e8c('0x5b')]=_0x1ac446;return _0x271133;});return db[_0x0e8c('0x69')][_0x0e8c('0xbe')](_0x42e896,{'transaction':_0xd2f972});});}else{_0x51c472=0x194;_0x47881b=[];}});})[_0x0e8c('0x1c')](function(){if(_0x51c472!==0x194){return db[_0x0e8c('0x69')]['findAndCountAll']({'where':{'SmsAccountId':_0x1ac446},'order':_0x0e8c('0x6c')})[_0x0e8c('0x1c')](function(_0x82095d){_0x47881b=_0x82095d;});}})[_0x0e8c('0x24')](function(_0xd500a0){_0x51c472=0x1f4;logger[_0x0e8c('0x21')](_0xd500a0['stack']);if(_0xd500a0[_0x0e8c('0x32')]){delete _0xd500a0[_0x0e8c('0x32')];}_0x47881b=_0xd500a0;})[_0x0e8c('0xbf')](function(){if(_0x47881b===null){_0x35a0e9[_0x0e8c('0x25')](_0x51c472);}else{if(_0x51c472===0x1f4){_0x35a0e9[_0x0e8c('0x26')](_0x51c472)[_0x0e8c('0xb6')](_0x47881b);}else{_0x35a0e9[_0x0e8c('0x26')](_0x51c472)['json'](_0x47881b);}}});};exports[_0x0e8c('0xc0')]=function(_0x31cacf,_0x3fbcc8,_0x4393d2){var _0x151276={};var _0x248c5f={};var _0x2d96c2;var _0x4a9ac3;return db['SmsAccount'][_0x0e8c('0xbd')]({'where':{'id':_0x31cacf[_0x0e8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fbcc8,null))[_0x0e8c('0x1c')](function(_0x186baa){if(_0x186baa){_0x2d96c2=_0x186baa;_0x248c5f['model']=_['keys'](db[_0x0e8c('0x69')][_0x0e8c('0x36')]);_0x248c5f['query']=_['keys'](_0x31cacf['query']);_0x248c5f[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x248c5f[_0x0e8c('0x3a')],_0x248c5f['query']);_0x151276[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x248c5f[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x31cacf['query']['fields']));_0x151276[_0x0e8c('0x3d')]=_0x151276[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x151276['attributes']:_0x248c5f['model'];_0x151276[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x151276[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x31cacf[_0x0e8c('0x3b')],_0x248c5f[_0x0e8c('0x44')]));if(_0x31cacf[_0x0e8c('0x3b')]['filter']){_0x151276[_0x0e8c('0x42')]=_[_0x0e8c('0x45')](_0x151276[_0x0e8c('0x42')],{'$or':_['map'](_0x151276[_0x0e8c('0x3d')],function(_0x44ffac){var _0x164a79={};_0x164a79[_0x44ffac]={'$like':'%'+_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x164a79;})});}_0x151276=_[_0x0e8c('0x45')]({},_0x151276,_0x31cacf['options']);return _0x2d96c2[_0x0e8c('0xc0')](_0x151276);}})[_0x0e8c('0x1c')](function(_0x40bb17){if(_0x40bb17){_0x4a9ac3=_0x40bb17['length'];if(!_0x31cacf[_0x0e8c('0x3b')][_0x0e8c('0x5d')](_0x0e8c('0x5e'))){_0x151276[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x31cacf[_0x0e8c('0x3b')]['limit']);_0x151276[_0x0e8c('0x2b')]=qs['offset'](_0x31cacf[_0x0e8c('0x3b')]['offset']);}return _0x2d96c2[_0x0e8c('0xc0')](_0x151276);}})['then'](function(_0x139983){if(_0x139983){return _0x139983?{'count':_0x4a9ac3,'rows':_0x139983}:null;}})[_0x0e8c('0x1c')](respondWithResult(_0x3fbcc8,null))[_0x0e8c('0x24')](handleError(_0x3fbcc8,null));};exports[_0x0e8c('0xc1')]=function(_0x29d480,_0x1d5b8b,_0x54d516){var _0x377fda={'raw':![],'where':{}};var _0x4c70e5={};var _0x3a3374={'count':0x0,'rows':[]};return db[_0x0e8c('0x35')][_0x0e8c('0xbd')]({'where':{'id':_0x29d480[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1d5b8b,null))[_0x0e8c('0x1c')](function(_0xc527ac){if(_0xc527ac){_0x4c70e5[_0x0e8c('0x3a')]=_[_0x0e8c('0x3c')](db[_0x0e8c('0x9b')]['rawAttributes']);_0x4c70e5[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x29d480[_0x0e8c('0x3b')]);_0x4c70e5[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0x4c70e5['model'],_0x4c70e5[_0x0e8c('0x3b')]);_0x377fda[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0x4c70e5['model'],qs['fields'](_0x29d480['query'][_0x0e8c('0x3f')]));_0x377fda[_0x0e8c('0x3d')]=_0x377fda[_0x0e8c('0x3d')][_0x0e8c('0x4e')]?_0x377fda['attributes']:_0x4c70e5[_0x0e8c('0x3a')];if(!_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x5d')]('nolimit')){_0x377fda[_0x0e8c('0x29')]=qs[_0x0e8c('0x29')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x29')]);_0x377fda[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}_0x377fda[_0x0e8c('0x40')]=qs[_0x0e8c('0x41')](_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x377fda[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x29d480[_0x0e8c('0x3b')],_0x4c70e5['filters']));_0x377fda['where']['SmsAccountId']=_0xc527ac['id'];if(_0x29d480[_0x0e8c('0x3b')]['filter']){_0x377fda[_0x0e8c('0x42')]=_['merge'](_0x377fda[_0x0e8c('0x42')],{'$or':_['map'](_0x377fda['attributes'],function(_0x19a8e6){var _0x565f26={};_0x565f26[_0x19a8e6]={'$like':'%'+_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0x47')]+'%'};return _0x565f26;})});}_0x377fda=_[_0x0e8c('0x45')]({},_0x377fda,_0x29d480[_0x0e8c('0x4f')]);return db['SmsInteraction']['count']({'where':_0x377fda['where']})[_0x0e8c('0x1c')](function(_0x1518e4){_0x3a3374[_0x0e8c('0x2a')]=_0x1518e4;if(_0x29d480[_0x0e8c('0x3b')]['includeAll']){_0x377fda[_0x0e8c('0x49')]=[{'model':db[_0x0e8c('0x6f')],'as':'Contact','required':![]},{'model':db[_0x0e8c('0xa6')],'as':_0x0e8c('0xc2'),'attributes':['name',_0x0e8c('0xc3'),_0x0e8c('0xc4')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x0e8c('0xc5')],'where':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]?{'id':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]}:undefined,'required':_0x29d480[_0x0e8c('0x3b')][_0x0e8c('0xc6')]?!![]:![]}];}return db[_0x0e8c('0x9b')][_0x0e8c('0x4a')](_0x377fda);})[_0x0e8c('0x1c')](function(_0x2f28cf){_0x3a3374['rows']=_0x2f28cf;return _0x3a3374;});}})[_0x0e8c('0x1c')](respondWithFilteredResult(_0x1d5b8b,_0x377fda))['catch'](handleError(_0x1d5b8b,null));};exports['send']=function(_0x276c78,_0x278106,_0x531e9a){var _0x2a2cfa,_0x2fba83,_0x18c0d0;if(_[_0x0e8c('0x8e')](_0x276c78[_0x0e8c('0x52')]['body'])||_0x276c78['body'][_0x0e8c('0x52')]===''){throw new db[(_0x0e8c('0x70'))]['ValidationError'](_0x0e8c('0xc7'));}if(_[_0x0e8c('0x8e')](_0x276c78['body']['to'])){throw new db[(_0x0e8c('0x70'))][(_0x0e8c('0x8f'))]('to\x20is\x20mandatory');}_0x2a2cfa=_0x276c78[_0x0e8c('0x52')]['to'];return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x276c78['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0e8c('0x6f')],'as':_0x0e8c('0x96'),'where':{'mobile':_0x2a2cfa},'limit':0x1,'order':[[_0x0e8c('0x73'),_0x0e8c('0x97')]]}]}]})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278106,null))[_0x0e8c('0x1c')](function(_0xef926c){if(_0xef926c&&_0xef926c[_0x0e8c('0xc8')]){_0x2fba83=_0xef926c[_0x0e8c('0x30')]({'plain':!![]});if(_0x2fba83[_0x0e8c('0xc8')]&&_0x2fba83[_0x0e8c('0xc8')]['Contacts'][_0x0e8c('0x4e')]){return _0x2fba83['List']['Contacts'][0x0];}return db[_0x0e8c('0x6f')][_0x0e8c('0x51')](_[_0x0e8c('0x15')](_0x276c78['body'],{'firstName':_0x2a2cfa,'mobile':_0x2a2cfa,'phone':_0x2a2cfa,'ListId':_0x2fba83[_0x0e8c('0x76')]}));}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x278106,null))[_0x0e8c('0x1c')](function(_0x4861ea){if(_0x4861ea){_0x18c0d0=_0x4861ea;return db[_0x0e8c('0x9b')][_0x0e8c('0x50')]({'where':{'ContactId':_0x18c0d0['id'],'closed':![],'SmsAccountId':_0x2fba83['id']}})[_0x0e8c('0x1c')](function(_0x1f12f2){if(_0x1f12f2){return[_0x1f12f2,![]];}return db['SmsInteraction'][_0x0e8c('0x51')]({'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id'],'SmsAccountId':_0x2fba83['id'],'phone':_0x2a2cfa,'firstMsgDirection':'out','Messages':[_[_0x0e8c('0x45')](_0x276c78[_0x0e8c('0x52')],{'read':![],'body':_0x276c78[_0x0e8c('0x52')][_0x0e8c('0x52')],'phone':_0x2a2cfa,'SmsAccountId':_0x2fba83['id'],'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id']})]},{'include':[{'model':db[_0x0e8c('0xa4')],'as':_0x0e8c('0xc9')}]})[_0x0e8c('0x1c')](function(_0x390611){return[_0x390611,!![]];});});}})[_0x0e8c('0x9c')](function(_0x1ba45c,_0x9c1e59){if(_0x9c1e59){return _0x1ba45c;}return db[_0x0e8c('0xa4')]['create'](_[_0x0e8c('0x45')](_0x276c78['body'],{'read':![],'body':_0x276c78[_0x0e8c('0x52')]['body'],'phone':_0x2a2cfa,'SmsAccountId':_0x2fba83['id'],'SmsInteractionId':_0x1ba45c['id'],'UserId':_0x276c78[_0x0e8c('0x53')]['id'],'ContactId':_0x18c0d0['id']}))[_0x0e8c('0x1c')](function(_0x53f038){_0x1ba45c[_0x0e8c('0xca')][_0x0e8c('0xc9')]=[];_0x1ba45c[_0x0e8c('0xca')][_0x0e8c('0xc9')]['push'](_0x53f038[_0x0e8c('0xca')]);return _0x1ba45c;});})[_0x0e8c('0x1c')](respondWithResult(_0x278106,null))[_0x0e8c('0x24')](handleError(_0x278106,null));};exports[_0x0e8c('0x26')]=function(_0x2094d4,_0x41abea,_0x2b7adb){if(_0x2094d4[_0x0e8c('0x52')]['id']){delete _0x2094d4['body']['id'];}var _0x4d8b95,_0xd37f4f,_0x383c04;return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x2094d4[_0x0e8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41abea,null))[_0x0e8c('0x1c')](function(_0x471a9b){if(_0x471a9b){_0x383c04=_0x471a9b;logger[_0x0e8c('0xb1')](_0x0e8c('0xaf'),_0x0e8c('0x26'),'received\x20delivery\x20report\x20from',_0x471a9b['type'],util[_0x0e8c('0xcb')](_0x2094d4['body'],{'showHidden':![],'depth':null}));switch(_0x471a9b[_0x0e8c('0x38')]){case _0x0e8c('0x7e'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcc')]&&_0x2094d4[_0x0e8c('0x52')]['status']){_0xd37f4f=_0x2094d4['body'][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')]['skebby_dispatch_id']}});}break;case _0x0e8c('0x80'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcd')]&&_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xce')]){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xce')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xcd')]}});}break;case _0x0e8c('0x81'):if(_0x2094d4['body'][_0x0e8c('0x82')]&&_0x2094d4[_0x0e8c('0x52')]['status_code']){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')]['status_code'];return db['SmsMessage'][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x82')]}});}break;case _0x0e8c('0x85'):var _0x46dd6d=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0];if(_0x46dd6d['messageId']&&_0x46dd6d[_0x0e8c('0x26')][_0x0e8c('0xcf')]===_0x0e8c('0xd0')){_0xd37f4f=_0x46dd6d[_0x0e8c('0x26')][_0x0e8c('0xcf')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x46dd6d[_0x0e8c('0x7c')]}});}break;case _0x0e8c('0x88'):if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x7c')]&&_0x2094d4['body'][_0x0e8c('0x26')]){_0xd37f4f=_0x2094d4['body'][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')][_0x0e8c('0x50')]({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x7c')]}});}break;case _0x0e8c('0x8b'):if(_0x2094d4[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')]['id']){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][0x0]['type'];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][0x0][_0x0e8c('0x23')]['id']}});}break;case'intelepeer':if(_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd1')]&&_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x26')]){_0xd37f4f=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x26')];return db[_0x0e8c('0xa4')]['find']({'where':{'messageId':_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd1')]}});}break;}}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x41abea,null))[_0x0e8c('0x1c')](function(_0x41adc6){if(_0x41adc6){_0x4d8b95=_0x41adc6;switch(_0x383c04[_0x0e8c('0x38')]){case'skebby':if(_0xd37f4f===_0x0e8c('0xd0')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger['error'](_0x0e8c('0xaf'),'status',_0x0e8c('0x7e'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x80'):if(_0xd37f4f==='1'){return _0x4d8b95['update']({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),'status','skebby',util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x81'):if(!_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0xd2')]&&_0xd37f4f>=0xc8&&_0xd37f4f<=0xce){return _0x4d8b95['update']({'read':!![]});}else{logger[_0x0e8c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e8c('0x26'),'clicksend',util[_0x0e8c('0xcb')](_0x2094d4['body'],{'showHidden':![],'depth':null}));}break;case _0x0e8c('0x85'):var _0x362c1e=_0x2094d4[_0x0e8c('0x52')][_0x0e8c('0x86')][0x0];if(_0x362c1e[_0x0e8c('0x26')]['groupName']===_0x0e8c('0xd0')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),_0x0e8c('0x85'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xd37f4f==_0x0e8c('0xd3')||_0xd37f4f==_0x0e8c('0xd4')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),_0x0e8c('0x88'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xd37f4f=='message-delivered'){return _0x4d8b95['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0e8c('0x8b'),util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xd37f4f===_0x0e8c('0xd5')||_0xd37f4f===_0x0e8c('0xd6')){return _0x4d8b95[_0x0e8c('0x2e')]({'read':!![]});}else{logger[_0x0e8c('0x21')](_0x0e8c('0xaf'),_0x0e8c('0x26'),'intelepeer',util[_0x0e8c('0xcb')](_0x2094d4[_0x0e8c('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x4d8b95;}})[_0x0e8c('0x1c')](respondWithResult(_0x41abea,null))['catch'](handleError(_0x41abea,null));};exports[_0x0e8c('0xd7')]=function(_0x1bf31a,_0x3eb50f,_0xf1c716){var _0x3b6fe8,_0x2257d6,_0x5aa4af;return db[_0x0e8c('0x35')][_0x0e8c('0x50')]({'where':{'id':_0x1bf31a['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x3eb50f,null))['then'](function(_0x39858d){if(_0x39858d){_0x5aa4af=_0x39858d;logger[_0x0e8c('0xb1')](_0x0e8c('0xaf'),'status',_0x0e8c('0xd8'),_0x39858d[_0x0e8c('0x38')],util[_0x0e8c('0xcb')](_0x1bf31a[_0x0e8c('0x3b')],{'showHidden':![],'depth':null}));switch(_0x39858d['type']){case _0x0e8c('0xd9'):if(_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xda')]&&_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xdb')]){_0x2257d6=_0x1bf31a['query'][_0x0e8c('0xdb')];return db['SmsMessage']['find']({'where':{'messageId':_0x1bf31a[_0x0e8c('0x3b')][_0x0e8c('0xda')]}});}break;}}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x3eb50f,null))[_0x0e8c('0x1c')](function(_0x496e00){if(_0x496e00){_0x3b6fe8=_0x496e00;switch(_0x5aa4af[_0x0e8c('0x38')]){case _0x0e8c('0xd9'):if(_0x2257d6==='2'||_0x2257d6==='6'){return _0x3b6fe8['update']({'read':!![]});}else{logger[_0x0e8c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e8c('0x26'),'csc',util[_0x0e8c('0xcb')](_0x1bf31a['query'],{'showHidden':![],'depth':null}));};break;}return _0x3b6fe8;}})[_0x0e8c('0x1c')](respondWithResult(_0x3eb50f,null))['catch'](handleError(_0x3eb50f,null));};exports[_0x0e8c('0xdc')]=function(_0x458b9d,_0x1e5e81,_0x183e4d){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x458b9d['params']['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x1e5e81,null))['then'](function(_0x1a806){if(_0x1a806){return _0x1a806[_0x0e8c('0xdc')](_0x458b9d[_0x0e8c('0x52')][_0x0e8c('0x66')],_['omit'](_0x458b9d[_0x0e8c('0x52')],['ids','id'])||{})[_0x0e8c('0x9c')](function(_0x51b9df){for(var _0x48883d=0x0;_0x48883d<_0x458b9d[_0x0e8c('0x52')][_0x0e8c('0x66')][_0x0e8c('0x4e')];_0x48883d+=0x1){socket[_0x0e8c('0xdd')](_0x0e8c('0xde'),{'UserId':Number(_0x458b9d['body'][_0x0e8c('0x66')][_0x48883d]),'SmsAccountId':Number(_0x458b9d[_0x0e8c('0x4c')]['id'])});}return _0x51b9df;});}})[_0x0e8c('0x1c')](respondWithResult(_0x1e5e81,null))[_0x0e8c('0x24')](handleError(_0x1e5e81,null));};exports[_0x0e8c('0xdf')]=function(_0x2aefa3,_0x120296,_0x123a8a){return db['SmsAccount'][_0x0e8c('0x50')]({'where':{'id':_0x2aefa3[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x120296,null))['then'](function(_0x5e96ee){if(_0x5e96ee){return _0x5e96ee[_0x0e8c('0xdf')](_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')])[_0x0e8c('0x1c')](function(){if(_['isArray'](_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')])){for(var _0x49e21c=0x0;_0x49e21c<_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')][_0x0e8c('0x4e')];_0x49e21c+=0x1){socket[_0x0e8c('0xdd')](_0x0e8c('0xe0'),{'UserId':Number(_0x2aefa3['query'][_0x0e8c('0x66')][_0x49e21c]),'SmsAccountId':Number(_0x2aefa3[_0x0e8c('0x4c')]['id'])});}}else{socket[_0x0e8c('0xdd')](_0x0e8c('0xe0'),{'UserId':Number(_0x2aefa3[_0x0e8c('0x3b')][_0x0e8c('0x66')]),'SmsAccountId':Number(_0x2aefa3[_0x0e8c('0x4c')]['id'])});}});}})[_0x0e8c('0x1c')](respondWithStatusCode(_0x120296,null))['catch'](handleError(_0x120296,null));};exports[_0x0e8c('0xe1')]=function(_0x2f2bb0,_0x187547,_0x4dd8ab){var _0x3b5aab={};var _0xf3d419={};var _0x236b24;var _0x21dd1d;return db['SmsAccount'][_0x0e8c('0xbd')]({'where':{'id':_0x2f2bb0[_0x0e8c('0x4c')]['id']}})[_0x0e8c('0x1c')](handleEntityNotFound(_0x187547,null))[_0x0e8c('0x1c')](function(_0x280bc6){if(_0x280bc6){_0x236b24=_0x280bc6;_0xf3d419[_0x0e8c('0x3a')]=_['keys'](db[_0x0e8c('0xa6')]['rawAttributes']);_0xf3d419[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x2f2bb0[_0x0e8c('0x3b')]);_0xf3d419[_0x0e8c('0x44')]=_[_0x0e8c('0x3e')](_0xf3d419[_0x0e8c('0x3a')],_0xf3d419['query']);_0x3b5aab[_0x0e8c('0x3d')]=_[_0x0e8c('0x3e')](_0xf3d419[_0x0e8c('0x3a')],qs[_0x0e8c('0x3f')](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x3f')]));_0x3b5aab[_0x0e8c('0x3d')]=_0x3b5aab['attributes']['length']?_0x3b5aab[_0x0e8c('0x3d')]:_0xf3d419[_0x0e8c('0x3a')];_0x3b5aab[_0x0e8c('0x40')]=qs['sort'](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x41')]);_0x3b5aab[_0x0e8c('0x42')]=qs[_0x0e8c('0x44')](_[_0x0e8c('0x43')](_0x2f2bb0['query'],_0xf3d419[_0x0e8c('0x44')]));if(_0x2f2bb0[_0x0e8c('0x3b')]['filter']){_0x3b5aab['where']=_[_0x0e8c('0x45')](_0x3b5aab[_0x0e8c('0x42')],{'$or':_[_0x0e8c('0x5f')](_0x3b5aab[_0x0e8c('0x3d')],function(_0x4a5fba){var _0x1350aa={};_0x1350aa[_0x4a5fba]={'$like':'%'+_0x2f2bb0[_0x0e8c('0x3b')]['filter']+'%'};return _0x1350aa;})});}_0x3b5aab=_[_0x0e8c('0x45')]({},_0x3b5aab,_0x2f2bb0[_0x0e8c('0x4f')]);return _0x236b24['getAgents'](_0x3b5aab);}})['then'](function(_0x1133b6){if(_0x1133b6){_0x21dd1d=_0x1133b6['length'];if(!_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x5d')]('nolimit')){_0x3b5aab['limit']=qs[_0x0e8c('0x29')](_0x2f2bb0['query'][_0x0e8c('0x29')]);_0x3b5aab[_0x0e8c('0x2b')]=qs[_0x0e8c('0x2b')](_0x2f2bb0[_0x0e8c('0x3b')][_0x0e8c('0x2b')]);}return _0x236b24[_0x0e8c('0xe1')](_0x3b5aab);}})[_0x0e8c('0x1c')](function(_0x1f7456){if(_0x1f7456){return _0x1f7456?{'count':_0x21dd1d,'rows':_0x1f7456}:null;}})[_0x0e8c('0x1c')](respondWithResult(_0x187547,null))['catch'](handleError(_0x187547,null));}; \ No newline at end of file +var _0x9784=['localhost','./smsAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','SmsAccount','catch','create','body','role','user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','mobile','twilio','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','From','Text','MessageUUID','infobip','results','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','close','*,*,*,*','SmsMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','priority','finally','getApplications','Contact','Owner','internal','Tag','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','csc','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x47a3ce,_0x56c2e0){var _0x48b24c=function(_0x7dd070){while(--_0x7dd070){_0x47a3ce['push'](_0x47a3ce['shift']());}};_0x48b24c(++_0x56c2e0);}(_0x9784,0xca));var _0x4978=function(_0x3189dd,_0x18a79d){_0x3189dd=_0x3189dd-0x0;var _0x57f0c8=_0x9784[_0x3189dd];return _0x57f0c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4978('0x0'));var zipdir=require(_0x4978('0x1'));var jsonpatch=require(_0x4978('0x2'));var rp=require(_0x4978('0x3'));var moment=require('moment');var BPromise=require(_0x4978('0x4'));var Mustache=require(_0x4978('0x5'));var util=require('util');var path=require(_0x4978('0x6'));var sox=require('sox');var csv=require(_0x4978('0x7'));var ejs=require(_0x4978('0x8'));var fs=require('fs');var fs_extra=require(_0x4978('0x9'));var _=require(_0x4978('0xa'));var squel=require('squel');var crypto=require(_0x4978('0xb'));var jsforce=require(_0x4978('0xc'));var deskjs=require(_0x4978('0xd'));var toCsv=require(_0x4978('0x7'));var querystring=require('querystring');var Papa=require(_0x4978('0xe'));var Redis=require('ioredis');var authService=require(_0x4978('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4978('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4978('0x11'))(_0x4978('0x12'));var utils=require(_0x4978('0x13'));var config=require(_0x4978('0x14'));var licenseUtil=require(_0x4978('0x15'));var db=require(_0x4978('0x16'))['db'];config[_0x4978('0x17')]=_[_0x4978('0x18')](config['redis'],{'host':_0x4978('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4978('0x17')]));require(_0x4978('0x1a'))[_0x4978('0x1b')](socket);var jayson=require(_0x4978('0x1c'));var client=jayson[_0x4978('0x1d')][_0x4978('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2cb8c9,_0x4cc9e6,_0x7280eb,_0x3b74e4){return new BPromise(function(_0x1b704a,_0x4449e1){var _0x4f5b80=_0x3b74e4||client;return _0x4f5b80['request'](_0x2cb8c9,_0x7280eb)['then'](function(_0x2846a3){logger[_0x4978('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x4cc9e6,_0x4978('0x20'));logger[_0x4978('0x21')](_0x4978('0x22'),_0x4cc9e6,_0x4978('0x20'),JSON[_0x4978('0x23')](_0x2846a3));if(_0x2846a3[_0x4978('0x24')]){if(_0x2846a3[_0x4978('0x24')][_0x4978('0x25')]===0x1f4){logger[_0x4978('0x24')]('SmsAccount,\x20%s,\x20%s',_0x4cc9e6,_0x2846a3[_0x4978('0x24')][_0x4978('0x26')]);return _0x4449e1(_0x2846a3['error'][_0x4978('0x26')]);}logger['error'](_0x4978('0x27'),_0x4cc9e6,_0x2846a3[_0x4978('0x24')][_0x4978('0x26')]);return _0x1b704a(_0x2846a3['error'][_0x4978('0x26')]);}else{logger[_0x4978('0x1f')](_0x4978('0x27'),_0x4cc9e6,_0x4978('0x20'));_0x1b704a(_0x2846a3[_0x4978('0x28')]['message']);}})['catch'](function(_0x37b9ef){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4cc9e6,_0x37b9ef);_0x4449e1(_0x37b9ef);});});}function respondWithStatusCode(_0x160c61,_0x2b59be){_0x2b59be=_0x2b59be||0xcc;return function(_0x4f3053){if(_0x4f3053){return _0x160c61['sendStatus'](_0x2b59be);}return _0x160c61[_0x4978('0x29')](_0x2b59be)[_0x4978('0x2a')]();};}function respondWithResult(_0x4e3cb8,_0xb30865){_0xb30865=_0xb30865||0xc8;return function(_0x19ad21){if(_0x19ad21){return _0x4e3cb8[_0x4978('0x29')](_0xb30865)[_0x4978('0x2b')](_0x19ad21);}};}function respondWithFilteredResult(_0x3f2299,_0x2a8c80){return function(_0x50f1ad){if(_0x50f1ad){var _0x31e10b=typeof _0x2a8c80[_0x4978('0x2c')]===_0x4978('0x2d')&&typeof _0x2a8c80[_0x4978('0x2e')]===_0x4978('0x2d');var _0x4e08eb=_0x50f1ad[_0x4978('0x2f')];var _0x386a69=_0x31e10b?0x0:_0x2a8c80[_0x4978('0x2c')];var _0x1acdb9=_0x31e10b?_0x50f1ad['count']:_0x2a8c80[_0x4978('0x2c')]+_0x2a8c80[_0x4978('0x2e')];var _0x23ad32;if(_0x1acdb9>=_0x4e08eb){_0x1acdb9=_0x4e08eb;_0x23ad32=0xc8;}else{_0x23ad32=0xce;}_0x3f2299[_0x4978('0x29')](_0x23ad32);return _0x3f2299['set'](_0x4978('0x30'),_0x386a69+'-'+_0x1acdb9+'/'+_0x4e08eb)[_0x4978('0x2b')](_0x50f1ad);}return null;};}function patchUpdates(_0x24e56d){return function(_0x5b8b6b){try{jsonpatch[_0x4978('0x31')](_0x5b8b6b,_0x24e56d,!![]);}catch(_0x50429c){return BPromise[_0x4978('0x32')](_0x50429c);}return _0x5b8b6b[_0x4978('0x33')]();};}function saveUpdates(_0x55a3eb,_0x36cc68){return function(_0x506c8f){if(_0x506c8f){return _0x506c8f[_0x4978('0x34')](_0x55a3eb)[_0x4978('0x35')](function(_0x2ef5bc){return _0x2ef5bc;});}return null;};}function removeEntity(_0x4eb981,_0x3d5f09){return function(_0x5e262c){if(_0x5e262c){return _0x5e262c[_0x4978('0x36')]()[_0x4978('0x35')](function(){var _0x180315=_0x5e262c[_0x4978('0x37')]({'plain':!![]});var _0x39b626=_0x4978('0x38');return db[_0x4978('0x39')][_0x4978('0x36')]({'where':{'type':_0x39b626,'resourceId':_0x180315['id']}})['then'](function(){return _0x5e262c;});})[_0x4978('0x35')](function(){_0x4eb981['status'](0xcc)[_0x4978('0x2a')]();});}};}function handleEntityNotFound(_0x1799df,_0xd1a305){return function(_0x3a57c0){if(!_0x3a57c0){_0x1799df[_0x4978('0x3a')](0x194);}return _0x3a57c0;};}function handleError(_0x5e33ca,_0x4ba287){_0x4ba287=_0x4ba287||0x1f4;return function(_0x549d6b){logger[_0x4978('0x24')](_0x549d6b[_0x4978('0x3b')]);if(_0x549d6b[_0x4978('0x3c')]){delete _0x549d6b['name'];}_0x5e33ca[_0x4978('0x29')](_0x4ba287)[_0x4978('0x3d')](_0x549d6b);};}exports['index']=function(_0x468d8d,_0x413e45){var _0x20f840={'include':[{'model':db[_0x4978('0x3e')],'as':_0x4978('0x3f')}]},_0x4b0505={},_0x1d1242={'count':0x0,'rows':[]};var _0x11273d=_['map'](db['SmsAccount'][_0x4978('0x40')],function(_0x48be4a){return{'name':_0x48be4a['fieldName'],'type':_0x48be4a[_0x4978('0x41')][_0x4978('0x42')]};});_0x4b0505[_0x4978('0x43')]=_[_0x4978('0x44')](_0x11273d,_0x4978('0x3c'));_0x4b0505[_0x4978('0x45')]=_[_0x4978('0x46')](_0x468d8d[_0x4978('0x45')]);_0x4b0505[_0x4978('0x47')]=_['intersection'](_0x4b0505[_0x4978('0x43')],_0x4b0505[_0x4978('0x45')]);_0x20f840[_0x4978('0x48')]=_[_0x4978('0x49')](_0x4b0505[_0x4978('0x43')],qs[_0x4978('0x4a')](_0x468d8d[_0x4978('0x45')][_0x4978('0x4a')]));_0x20f840[_0x4978('0x48')]=_0x20f840['attributes'][_0x4978('0x4b')]?_0x20f840['attributes']:_0x4b0505[_0x4978('0x43')];if(!_0x468d8d[_0x4978('0x45')]['hasOwnProperty'](_0x4978('0x4c'))){_0x20f840[_0x4978('0x2e')]=qs[_0x4978('0x2e')](_0x468d8d['query'][_0x4978('0x2e')]);_0x20f840[_0x4978('0x2c')]=qs[_0x4978('0x2c')](_0x468d8d['query'][_0x4978('0x2c')]);}_0x20f840[_0x4978('0x4d')]=qs[_0x4978('0x4e')](_0x468d8d[_0x4978('0x45')]['sort']);_0x20f840[_0x4978('0x4f')]=qs[_0x4978('0x47')](_[_0x4978('0x50')](_0x468d8d[_0x4978('0x45')],_0x4b0505[_0x4978('0x47')]),_0x11273d);if(_0x468d8d[_0x4978('0x45')][_0x4978('0x51')]){_0x20f840[_0x4978('0x4f')]=_[_0x4978('0x52')](_0x20f840[_0x4978('0x4f')],{'$or':_[_0x4978('0x44')](_0x11273d,function(_0x17f5a8){if(_0x17f5a8[_0x4978('0x41')]!==_0x4978('0x53')){var _0x1025c4={};_0x1025c4[_0x17f5a8[_0x4978('0x3c')]]={'$like':'%'+_0x468d8d[_0x4978('0x45')][_0x4978('0x51')]+'%'};return _0x1025c4;}})});}_0x20f840=_[_0x4978('0x52')]({},_0x20f840,_0x468d8d[_0x4978('0x54')]);var _0x75101b={'where':_0x20f840[_0x4978('0x4f')]};return db['SmsAccount'][_0x4978('0x2f')](_0x75101b)['then'](function(_0x189c81){_0x1d1242[_0x4978('0x2f')]=_0x189c81;if(_0x468d8d[_0x4978('0x45')][_0x4978('0x55')]){_0x20f840[_0x4978('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0x4978('0x57')](_0x20f840);})[_0x4978('0x35')](function(_0x54e011){_0x1d1242[_0x4978('0x58')]=_0x54e011;return _0x1d1242;})[_0x4978('0x35')](respondWithFilteredResult(_0x413e45,_0x20f840))['catch'](handleError(_0x413e45,null));};exports[_0x4978('0x59')]=function(_0x100fe0,_0x35fcda){var _0x4fa27d={'raw':![],'where':{'id':_0x100fe0[_0x4978('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x4978('0x3f')}]},_0x773026={};_0x773026[_0x4978('0x43')]=_['keys'](db[_0x4978('0x5b')]['rawAttributes']);_0x773026[_0x4978('0x45')]=_[_0x4978('0x46')](_0x100fe0[_0x4978('0x45')]);_0x773026['filters']=_[_0x4978('0x49')](_0x773026['model'],_0x773026[_0x4978('0x45')]);_0x4fa27d[_0x4978('0x48')]=_[_0x4978('0x49')](_0x773026['model'],qs[_0x4978('0x4a')](_0x100fe0[_0x4978('0x45')][_0x4978('0x4a')]));_0x4fa27d[_0x4978('0x48')]=_0x4fa27d['attributes'][_0x4978('0x4b')]?_0x4fa27d['attributes']:_0x773026['model'];if(_0x100fe0['query'][_0x4978('0x55')]){_0x4fa27d['include']=[{'all':!![]}];}_0x4fa27d=_[_0x4978('0x52')]({},_0x4fa27d,_0x100fe0[_0x4978('0x54')]);return db[_0x4978('0x5b')]['find'](_0x4fa27d)[_0x4978('0x35')](handleEntityNotFound(_0x35fcda,null))['then'](respondWithResult(_0x35fcda,null))[_0x4978('0x5c')](handleError(_0x35fcda,null));};exports[_0x4978('0x5d')]=function(_0x5275da,_0x5b17e2){return db['SmsAccount'][_0x4978('0x5d')](_0x5275da[_0x4978('0x5e')],{})[_0x4978('0x35')](function(_0xdf4a10){var _0x2497f8=_0x5275da['user']['get']({'plain':!![]});if(!_0x2497f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2497f8[_0x4978('0x5f')]===_0x4978('0x60')){var _0x5ef3ed=_0xdf4a10[_0x4978('0x37')]({'plain':!![]});var _0x44950b=_0x4978('0x38');return db['UserProfileSection'][_0x4978('0x61')]({'where':{'name':_0x44950b,'userProfileId':_0x2497f8[_0x4978('0x62')]},'raw':!![]})[_0x4978('0x35')](function(_0x38ec6a){if(_0x38ec6a&&_0x38ec6a['autoAssociation']===0x0){return db[_0x4978('0x39')][_0x4978('0x5d')]({'name':_0x5ef3ed[_0x4978('0x3c')],'resourceId':_0x5ef3ed['id'],'type':_0x38ec6a[_0x4978('0x3c')],'sectionId':_0x38ec6a['id']},{})['then'](function(){return _0xdf4a10;});}else{return _0xdf4a10;}})[_0x4978('0x5c')](function(_0x114815){logger[_0x4978('0x24')](_0x4978('0x63'),_0x114815);throw _0x114815;});}return _0xdf4a10;})['then'](respondWithResult(_0x5b17e2,0xc9))['catch'](handleError(_0x5b17e2,null));};exports['update']=function(_0x4468cf,_0x1fddbe){if(_0x4468cf[_0x4978('0x5e')]['id']){delete _0x4468cf[_0x4978('0x5e')]['id'];}return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x4468cf[_0x4978('0x5a')]['id']},'include':[{'model':db[_0x4978('0x3e')],'as':_0x4978('0x3f')}]})[_0x4978('0x35')](handleEntityNotFound(_0x1fddbe,null))[_0x4978('0x35')](saveUpdates(_0x4468cf[_0x4978('0x5e')],null))[_0x4978('0x35')](respondWithResult(_0x1fddbe,null))[_0x4978('0x5c')](handleError(_0x1fddbe,null));};exports[_0x4978('0x36')]=function(_0x52a4c7,_0x58f448){return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x52a4c7[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x58f448,null))[_0x4978('0x35')](removeEntity(_0x58f448,null))[_0x4978('0x5c')](handleError(_0x58f448,null));};exports[_0x4978('0x64')]=function(_0x32f1cb,_0x2921a2){return db[_0x4978('0x5b')]['describe']()[_0x4978('0x35')](respondWithResult(_0x2921a2,null))[_0x4978('0x5c')](handleError(_0x2921a2,null));};exports[_0x4978('0x65')]=function(_0xad3eea,_0x2fa1af,_0x3d3999){if(_0xad3eea[_0x4978('0x5e')]['id']){delete _0xad3eea[_0x4978('0x5e')]['id'];}return db[_0x4978('0x5b')]['find']({'where':{'id':_0xad3eea[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x2fa1af,null))[_0x4978('0x35')](function(_0x2b2e7a){if(_0x2b2e7a){_0xad3eea[_0x4978('0x5e')]['SmsAccountId']=_0x2b2e7a['id'];return db['Disposition'][_0x4978('0x5d')](_0xad3eea[_0x4978('0x5e')]);}})['then'](respondWithResult(_0x2fa1af,null))['catch'](handleError(_0x2fa1af,null));};exports[_0x4978('0x66')]=function(_0x3554f1,_0x3b6c94,_0x59d894){var _0x3334d9={'raw':![],'where':{}};var _0x55d1fa={};var _0x3b0a32={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4978('0x67')]({'where':{'id':_0x3554f1[_0x4978('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3b6c94,null))['then'](function(_0x404a0c){if(_0x404a0c){_0x55d1fa[_0x4978('0x43')]=_[_0x4978('0x46')](db[_0x4978('0x68')][_0x4978('0x40')]);_0x55d1fa[_0x4978('0x45')]=_[_0x4978('0x46')](_0x3554f1['query']);_0x55d1fa[_0x4978('0x47')]=_['intersection'](_0x55d1fa[_0x4978('0x43')],_0x55d1fa[_0x4978('0x45')]);_0x3334d9[_0x4978('0x48')]=_[_0x4978('0x49')](_0x55d1fa[_0x4978('0x43')],qs[_0x4978('0x4a')](_0x3554f1['query']['fields']));_0x3334d9[_0x4978('0x48')]=_0x3334d9[_0x4978('0x48')]['length']?_0x3334d9['attributes']:_0x55d1fa[_0x4978('0x43')];if(!_0x3554f1[_0x4978('0x45')][_0x4978('0x69')](_0x4978('0x4c'))){_0x3334d9[_0x4978('0x2e')]=qs[_0x4978('0x2e')](_0x3554f1[_0x4978('0x45')][_0x4978('0x2e')]);_0x3334d9[_0x4978('0x2c')]=qs[_0x4978('0x2c')](_0x3554f1[_0x4978('0x45')][_0x4978('0x2c')]);}_0x3334d9[_0x4978('0x4d')]=qs['sort'](_0x3554f1[_0x4978('0x45')][_0x4978('0x4e')]);_0x3334d9['where']=qs[_0x4978('0x47')](_[_0x4978('0x50')](_0x3554f1[_0x4978('0x45')],_0x55d1fa['filters']));_0x3334d9[_0x4978('0x4f')][_0x4978('0x6a')]=_0x404a0c['id'];if(_0x3554f1[_0x4978('0x45')][_0x4978('0x51')]){_0x3334d9[_0x4978('0x4f')]=_[_0x4978('0x52')](_0x3334d9['where'],{'$or':_[_0x4978('0x44')](_0x3334d9['attributes'],function(_0x341238){var _0x21f788={};_0x21f788[_0x341238]={'$like':'%'+_0x3554f1[_0x4978('0x45')][_0x4978('0x51')]+'%'};return _0x21f788;})});}_0x3334d9=_[_0x4978('0x52')]({},_0x3334d9,_0x3554f1[_0x4978('0x54')]);return db[_0x4978('0x68')][_0x4978('0x2f')]({'where':_0x3334d9[_0x4978('0x4f')]})['then'](function(_0x30cc91){_0x3b0a32[_0x4978('0x2f')]=_0x30cc91;if(_0x3554f1[_0x4978('0x45')]['includeAll']){_0x3334d9[_0x4978('0x56')]=[{'all':!![]}];}return db[_0x4978('0x68')][_0x4978('0x57')](_0x3334d9);})[_0x4978('0x35')](function(_0x5fdfe9){_0x3b0a32[_0x4978('0x58')]=_0x5fdfe9;return _0x3b0a32;});}})[_0x4978('0x35')](respondWithFilteredResult(_0x3b6c94,_0x3334d9))[_0x4978('0x5c')](handleError(_0x3b6c94,null));};exports[_0x4978('0x6b')]=function(_0x1d96eb,_0x240a38,_0x4ad06b){return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x1d96eb[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x240a38,null))['then'](function(_0x6626a0){if(_0x6626a0){return _0x6626a0['removeDispositions'](_0x1d96eb[_0x4978('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x240a38,null))['catch'](handleError(_0x240a38,null));};exports[_0x4978('0x6c')]=function(_0x7ff44e,_0x4cda9e,_0x528625){if(_0x7ff44e[_0x4978('0x5e')]['id']){delete _0x7ff44e[_0x4978('0x5e')]['id'];}return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x7ff44e['params']['id']}})['then'](handleEntityNotFound(_0x4cda9e,null))[_0x4978('0x35')](function(_0x3580c1){if(_0x3580c1){_0x7ff44e[_0x4978('0x5e')][_0x4978('0x6a')]=_0x3580c1['id'];return db[_0x4978('0x6d')][_0x4978('0x5d')](_0x7ff44e[_0x4978('0x5e')]);}})['then'](respondWithResult(_0x4cda9e,null))['catch'](handleError(_0x4cda9e,null));};exports[_0x4978('0x6e')]=function(_0x205ac3,_0x1c19ef,_0x3c32b6){var _0x209b89={'raw':![],'where':{}};var _0x843482={};var _0x37fbd9={'count':0x0,'rows':[]};return db[_0x4978('0x5b')][_0x4978('0x67')]({'where':{'id':_0x205ac3['params']['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x1c19ef,null))['then'](function(_0x312439){if(_0x312439){_0x843482['model']=_['keys'](db[_0x4978('0x6d')][_0x4978('0x40')]);_0x843482[_0x4978('0x45')]=_[_0x4978('0x46')](_0x205ac3[_0x4978('0x45')]);_0x843482[_0x4978('0x47')]=_[_0x4978('0x49')](_0x843482[_0x4978('0x43')],_0x843482[_0x4978('0x45')]);_0x209b89[_0x4978('0x48')]=_['intersection'](_0x843482[_0x4978('0x43')],qs[_0x4978('0x4a')](_0x205ac3[_0x4978('0x45')][_0x4978('0x4a')]));_0x209b89[_0x4978('0x48')]=_0x209b89['attributes']['length']?_0x209b89[_0x4978('0x48')]:_0x843482[_0x4978('0x43')];if(!_0x205ac3[_0x4978('0x45')][_0x4978('0x69')](_0x4978('0x4c'))){_0x209b89[_0x4978('0x2e')]=qs['limit'](_0x205ac3[_0x4978('0x45')]['limit']);_0x209b89[_0x4978('0x2c')]=qs[_0x4978('0x2c')](_0x205ac3[_0x4978('0x45')]['offset']);}_0x209b89[_0x4978('0x4d')]=qs[_0x4978('0x4e')](_0x205ac3['query'][_0x4978('0x4e')]);_0x209b89[_0x4978('0x4f')]=qs['filters'](_['pick'](_0x205ac3[_0x4978('0x45')],_0x843482['filters']));_0x209b89[_0x4978('0x4f')]['SmsAccountId']=_0x312439['id'];if(_0x205ac3[_0x4978('0x45')][_0x4978('0x51')]){_0x209b89[_0x4978('0x4f')]=_[_0x4978('0x52')](_0x209b89[_0x4978('0x4f')],{'$or':_['map'](_0x209b89[_0x4978('0x48')],function(_0x4f630f){var _0x7fd2fd={};_0x7fd2fd[_0x4f630f]={'$like':'%'+_0x205ac3['query'][_0x4978('0x51')]+'%'};return _0x7fd2fd;})});}_0x209b89=_[_0x4978('0x52')]({},_0x209b89,_0x205ac3[_0x4978('0x54')]);return db[_0x4978('0x6d')][_0x4978('0x2f')]({'where':_0x209b89[_0x4978('0x4f')]})[_0x4978('0x35')](function(_0x1232a5){_0x37fbd9[_0x4978('0x2f')]=_0x1232a5;if(_0x205ac3[_0x4978('0x45')][_0x4978('0x55')]){_0x209b89[_0x4978('0x56')]=[{'all':!![]}];}return db[_0x4978('0x6d')][_0x4978('0x57')](_0x209b89);})['then'](function(_0x58d5a0){_0x37fbd9[_0x4978('0x58')]=_0x58d5a0;return _0x37fbd9;});}})[_0x4978('0x35')](respondWithFilteredResult(_0x1c19ef,_0x209b89))[_0x4978('0x5c')](handleError(_0x1c19ef,null));};exports['removeAnswers']=function(_0x38d97e,_0x2e9710,_0x817e7e){return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x38d97e[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x2e9710,null))[_0x4978('0x35')](function(_0x4ccdcd){if(_0x4ccdcd){return _0x4ccdcd['removeAnswers'](_0x38d97e[_0x4978('0x45')][_0x4978('0x6f')]);}})['then'](respondWithStatusCode(_0x2e9710,null))[_0x4978('0x5c')](handleError(_0x2e9710,null));};exports['notify']=function(_0x374ec4,_0x492a24,_0x30abae){var _0x4527a1={'channel':_0x4978('0x70')};var _0x39f220=[];var _0x8f336e=[];var _0x15ebb8={};return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x374ec4['params']['id']},'include':[{'model':db[_0x4978('0x71')],'as':_0x4978('0x72')}]})['then'](handleEntityNotFound(_0x492a24,null))[_0x4978('0x35')](function(_0xc2dfc6){_0x4527a1[_0x4978('0x73')]=_0xc2dfc6;_0x4527a1[_0x4978('0x74')]=_[_0x4978('0x75')](_0xc2dfc6['Applications'],['priority'],[_0x4978('0x76')]);if(_0x4527a1[_0x4978('0x73')]['Applications']){delete _0x4527a1[_0x4978('0x73')][_0x4978('0x72')];}return db[_0x4978('0x77')][_0x4978('0x64')]();})[_0x4978('0x35')](function(_0x1c79f2){if(!_0x1c79f2){throw new db[(_0x4978('0x78'))][(_0x4978('0x79'))](_0x4978('0x7a'));}_0x39f220=_['difference'](_[_0x4978('0x46')](_0x1c79f2),['createdAt',_0x4978('0x7b')]);_0x8f336e=_[_0x4978('0x7c')](_[_0x4978('0x46')](_0x1c79f2),['createdAt','updatedAt',_0x4978('0x7d'),'ListId']);_0x4527a1[_0x4978('0x5e')]={'mapKey':_0x4978('0x7e')};if(_0x4527a1[_0x4978('0x73')]['type']){switch(_0x4527a1[_0x4978('0x73')][_0x4978('0x41')]){case _0x4978('0x7f'):_0x4527a1[_0x4978('0x5e')]['from']=_0x374ec4[_0x4978('0x5e')]['From'];_0x4527a1['body'][_0x4978('0x5e')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x80')];_0x4527a1[_0x4978('0x5e')][_0x4978('0x81')]=_0x374ec4['body'][_0x4978('0x82')];break;case _0x4978('0x83'):_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')]='+'+_0x374ec4[_0x4978('0x5e')][_0x4978('0x85')];_0x4527a1[_0x4978('0x5e')]['body']=_0x374ec4[_0x4978('0x5e')][_0x4978('0x86')];break;case _0x4978('0x87'):_0x4527a1['body']['from']=_0x374ec4[_0x4978('0x5e')]['from'];_0x4527a1[_0x4978('0x5e')]['body']=_0x374ec4[_0x4978('0x5e')]['message'];break;case _0x4978('0x88'):_0x4527a1[_0x4978('0x5e')]['from']=_0x374ec4['body'][_0x4978('0x84')];_0x4527a1[_0x4978('0x5e')][_0x4978('0x5e')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x5e')];_0x4527a1[_0x4978('0x5e')][_0x4978('0x81')]=_0x374ec4['body'][_0x4978('0x89')];break;case'plivo':_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')]=_0x374ec4['body'][_0x4978('0x8a')];_0x4527a1[_0x4978('0x5e')][_0x4978('0x5e')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x8b')];_0x4527a1['body'][_0x4978('0x81')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x8c')];break;case _0x4978('0x8d'):_0x4527a1['body'][_0x4978('0x84')]='+'+_0x374ec4[_0x4978('0x5e')][_0x4978('0x8e')][0x0][_0x4978('0x84')];_0x4527a1['body'][_0x4978('0x5e')]=_0x374ec4['body'][_0x4978('0x8e')][0x0][_0x4978('0x86')];_0x4527a1['body'][_0x4978('0x81')]=_0x374ec4[_0x4978('0x5e')]['results'][0x0][_0x4978('0x81')];break;case'csc':_0x4527a1['body']['from']=_0x374ec4['body']['originatingAddress'];_0x4527a1[_0x4978('0x5e')][_0x4978('0x5e')]=_0x374ec4[_0x4978('0x5e')]['segmentedMessage'][_0x4978('0x26')];break;case _0x4978('0x8f'):_0x4527a1['body'][_0x4978('0x84')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x90')];_0x4527a1['body'][_0x4978('0x5e')]=_0x374ec4[_0x4978('0x5e')][_0x4978('0x86')];_0x4527a1[_0x4978('0x5e')][_0x4978('0x81')]=_0x374ec4['body']['replyMessageId'];break;case'bandwidth':_0x4527a1[_0x4978('0x5e')]['messageId']=_0x374ec4[_0x4978('0x5e')][0x0][_0x4978('0x26')]['id'];_0x4527a1[_0x4978('0x5e')]['from']=_0x374ec4[_0x4978('0x5e')][0x0]['message'][_0x4978('0x84')];_0x4527a1[_0x4978('0x5e')]['body']=_0x374ec4['body'][0x0][_0x4978('0x26')]['text'];break;case'intelepeer':_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')]=_0x374ec4[_0x4978('0x5e')]['from'];_0x4527a1[_0x4978('0x5e')]['body']=_0x374ec4[_0x4978('0x5e')]['message'];_0x4527a1[_0x4978('0x5e')]['messageId']=_0x374ec4['body'][_0x4978('0x91')];break;}}if(_0x4527a1[_0x4978('0x5e')]['id']){delete _0x4527a1['body']['id'];}if(_[_0x4978('0x92')](_0x4527a1['body'][_0x4978('0x84')])){throw new db[(_0x4978('0x78'))][(_0x4978('0x79'))](_0x4978('0x93'));}if(_[_0x4978('0x92')](_0x4527a1['body'][_0x4978('0x5e')])||_0x4527a1[_0x4978('0x5e')]['body']===''){throw new db[(_0x4978('0x78'))][(_0x4978('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4527a1[_0x4978('0x5e')]['mapKey'])){throw new db[(_0x4978('0x78'))]['ValidationError'](_0x4978('0x94')+_0x8f336e);}if(!_['includes'](_0x8f336e,_0x4527a1[_0x4978('0x5e')][_0x4978('0x95')])){throw new db['Sequelize']['ValidationError'](_0x4978('0x96')+_0x8f336e);}_0x15ebb8[_0x4527a1['body'][_0x4978('0x95')]]=_0x4527a1[_0x4978('0x5e')]['from'];return db[_0x4978('0x97')][_0x4978('0x61')]({'where':{'id':_0x4527a1[_0x4978('0x73')][_0x4978('0x98')]},'include':[{'model':db[_0x4978('0x77')],'as':_0x4978('0x99'),'where':_0x15ebb8,'limit':0x1,'order':[['updatedAt',_0x4978('0x9a')]]}]});})[_0x4978('0x35')](handleEntityNotFound(_0x492a24,null))['then'](function(_0x1caf39){if(_0x1caf39){_0x4527a1[_0x4978('0x9b')]=_['omit'](_0x1caf39,[_0x4978('0x99')]);if(_0x1caf39[_0x4978('0x99')][_0x4978('0x4b')]){return _0x1caf39[_0x4978('0x99')][0x0];}var _0x17edf2=_[_0x4978('0x18')](_0x4527a1[_0x4978('0x5e')],{'firstName':_0x4527a1[_0x4978('0x5e')]['from'],'ListId':_0x1caf39['id']});_0x17edf2[_0x4527a1[_0x4978('0x5e')][_0x4978('0x95')]]=_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')];return db[_0x4978('0x77')][_0x4978('0x5d')](_0x17edf2,{'fields':_0x39f220,'raw':!![]});}})[_0x4978('0x35')](handleEntityNotFound(_0x492a24,null))[_0x4978('0x35')](function(_0x38d5a7){if(_0x38d5a7){_0x4527a1[_0x4978('0x9c')]=_0x38d5a7;var _0x5eb52f={'ContactId':_0x38d5a7['id'],'phone':_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')],'SmsAccountId':_0x374ec4[_0x4978('0x5a')]['id']};var _0x43a565={'ContactId':_0x38d5a7['id'],'SmsAccountId':_0x374ec4[_0x4978('0x5a')]['id'],'closed':![]};return db['SmsInteraction'][_0x4978('0x61')]({'where':_0x43a565})['then'](function(_0x473541){if(_0x473541){return[_0x473541,![]];}return db[_0x4978('0x9d')][_0x4978('0x5d')](_0x5eb52f)[_0x4978('0x35')](function(_0x19e435){return[_0x19e435,!![]];});});}})[_0x4978('0x9e')](function(_0x330dce,_0x207835){_0x4527a1[_0x4978('0x9f')]=_0x330dce[_0x4978('0x37')]({'plain':!![]});_0x4527a1[_0x4978('0x9f')][_0x4978('0xa0')]=![];if(_0x207835){if(_0x4527a1[_0x4978('0x73')][_0x4978('0xa1')]){_0x4527a1[_0x4978('0x74')]['push']({'id':0x0,'priority':_0x4527a1[_0x4978('0x74')]['length']+0x1,'app':_0x4978('0xa2'),'appdata':'unmanaged','interval':_0x4978('0xa3')});}_0x4527a1[_0x4978('0x9f')][_0x4978('0xa0')]=!![];}return db[_0x4978('0xa4')][_0x4978('0x5d')]({'phone':_0x4527a1[_0x4978('0x5e')][_0x4978('0x84')],'messageId':_0x4527a1[_0x4978('0x5e')][_0x4978('0x81')],'body':_0x4527a1['body']['body'],'SmsAccountId':_0x374ec4['params']['id'],'SmsInteractionId':_0x330dce['id'],'direction':'in','ContactId':_0x330dce[_0x4978('0xa5')],'AttachmentId':_0x4527a1[_0x4978('0x5e')]['AttachmentId']});})[_0x4978('0x35')](function(_0x2ad54a){_0x4527a1[_0x4978('0x26')]=_0x2ad54a;if(!_0x4527a1[_0x4978('0x9f')][_0x4978('0xa6')])return;return db[_0x4978('0xa7')][_0x4978('0x61')]({'attributes':['id',_0x4978('0x3c')],'where':{'id':_0x4527a1[_0x4978('0x9f')][_0x4978('0xa6')]}});})[_0x4978('0x35')](function(_0x584d58){if(_0x584d58){_0x4527a1[_0x4978('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4978('0xa8'),'appdata':_0x584d58[_0x4978('0x3c')]+','+(_0x4527a1[_0x4978('0x73')][_0x4978('0xa9')]||0xa),'interval':_0x4978('0xa3')});}if(!_0x4527a1[_0x4978('0x9f')][_0x4978('0xaa')])return;return db[_0x4978('0xab')][_0x4978('0x61')]({'attributes':['id',_0x4978('0x3c')],'where':{'id':_0x4527a1['interaction'][_0x4978('0xaa')]}});})[_0x4978('0x35')](function(_0x4ec822){if(_0x4ec822){_0x4527a1['applications'][_0x4978('0xac')]({'id':0x0,'priority':0x1,'app':_0x4978('0xad'),'appdata':_0x4ec822['name']+','+(_0x4527a1[_0x4978('0x73')][_0x4978('0xae')]||0x12c),'interval':_0x4978('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x4527a1);})['then'](function(_0x320cde){if(_0x320cde){var _0x400299=0xc8;var _0x3f48c0=_0x4978('0xaf');logger[_0x4978('0x1f')](_0x4978('0x22'),_0x3f48c0,_0x400299,'entity\x20found');logger[_0x4978('0x21')](_0x4978('0xb0'),_0x3f48c0,_0x400299,_0x4978('0xb1'),JSON[_0x4978('0x23')](_0x320cde));if(_0x4527a1[_0x4978('0x73')][_0x4978('0x41')]===_0x4978('0x7f')){return _0x492a24['status'](_0x400299)['set'](_0x4978('0xb2'),_0x4978('0xb3'))[_0x4978('0x3d')](_0x4978('0xb4'));}else{return _0x492a24['status'](_0x400299)[_0x4978('0x2b')](_0x320cde);}}})[_0x4978('0x5c')](handleError(_0x492a24,null));};exports[_0x4978('0xb5')]=function(_0x3cbd94,_0x1790b1){var _0x5bb6fe=_0x3cbd94[_0x4978('0x5a')]['id'];var _0x25cd4b=_0x3cbd94[_0x4978('0x5e')];var _0x362aa3=0xc8;var _0x58bf01=null;return db[_0x4978('0xb6')][_0x4978('0xb7')]({'isolationLevel':db[_0x4978('0xb6')][_0x4978('0xb8')]['ISOLATION_LEVELS'][_0x4978('0xb9')]},function(_0x3c6825){return db[_0x4978('0x5b')][_0x4978('0x67')]({'where':{'id':_0x5bb6fe},'transaction':_0x3c6825})[_0x4978('0x35')](function(_0x5356ce){if(_0x5356ce){return db[_0x4978('0x71')]['destroy']({'where':{'SmsAccountId':_0x5bb6fe},'transaction':_0x3c6825})[_0x4978('0x35')](function(){var _0x1be46a=_['map'](_0x25cd4b,function(_0xb2aeec){_0xb2aeec[_0x4978('0x6a')]=_0x5bb6fe;return _0xb2aeec;});return db[_0x4978('0x71')][_0x4978('0xba')](_0x1be46a,{'transaction':_0x3c6825});});}else{_0x362aa3=0x194;_0x58bf01=[];}});})[_0x4978('0x35')](function(){if(_0x362aa3!==0x194){return db[_0x4978('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x5bb6fe},'order':_0x4978('0xbb')})[_0x4978('0x35')](function(_0x4bf1fd){_0x58bf01=_0x4bf1fd;});}})[_0x4978('0x5c')](function(_0x4094cc){_0x362aa3=0x1f4;logger[_0x4978('0x24')](_0x4094cc[_0x4978('0x3b')]);if(_0x4094cc['name']){delete _0x4094cc[_0x4978('0x3c')];}_0x58bf01=_0x4094cc;})[_0x4978('0xbc')](function(){if(_0x58bf01===null){_0x1790b1['sendStatus'](_0x362aa3);}else{if(_0x362aa3===0x1f4){_0x1790b1[_0x4978('0x29')](_0x362aa3)['send'](_0x58bf01);}else{_0x1790b1[_0x4978('0x29')](_0x362aa3)['json'](_0x58bf01);}}});};exports[_0x4978('0xbd')]=function(_0x45558f,_0x37fd32,_0x1636b8){var _0x3e6861={};var _0x6752a1={};var _0x4aaa50;var _0x2883cf;return db[_0x4978('0x5b')][_0x4978('0x67')]({'where':{'id':_0x45558f[_0x4978('0x5a')]['id']}})['then'](handleEntityNotFound(_0x37fd32,null))[_0x4978('0x35')](function(_0x826d94){if(_0x826d94){_0x4aaa50=_0x826d94;_0x6752a1[_0x4978('0x43')]=_[_0x4978('0x46')](db['SmsApplication']['rawAttributes']);_0x6752a1[_0x4978('0x45')]=_[_0x4978('0x46')](_0x45558f[_0x4978('0x45')]);_0x6752a1[_0x4978('0x47')]=_[_0x4978('0x49')](_0x6752a1[_0x4978('0x43')],_0x6752a1['query']);_0x3e6861[_0x4978('0x48')]=_[_0x4978('0x49')](_0x6752a1[_0x4978('0x43')],qs['fields'](_0x45558f[_0x4978('0x45')][_0x4978('0x4a')]));_0x3e6861['attributes']=_0x3e6861[_0x4978('0x48')][_0x4978('0x4b')]?_0x3e6861['attributes']:_0x6752a1['model'];_0x3e6861['order']=qs[_0x4978('0x4e')](_0x45558f['query'][_0x4978('0x4e')]);_0x3e6861[_0x4978('0x4f')]=qs[_0x4978('0x47')](_[_0x4978('0x50')](_0x45558f[_0x4978('0x45')],_0x6752a1[_0x4978('0x47')]));if(_0x45558f[_0x4978('0x45')][_0x4978('0x51')]){_0x3e6861[_0x4978('0x4f')]=_[_0x4978('0x52')](_0x3e6861['where'],{'$or':_[_0x4978('0x44')](_0x3e6861[_0x4978('0x48')],function(_0x55c158){var _0x4020b8={};_0x4020b8[_0x55c158]={'$like':'%'+_0x45558f['query'][_0x4978('0x51')]+'%'};return _0x4020b8;})});}_0x3e6861=_[_0x4978('0x52')]({},_0x3e6861,_0x45558f[_0x4978('0x54')]);return _0x4aaa50[_0x4978('0xbd')](_0x3e6861);}})['then'](function(_0x5026c3){if(_0x5026c3){_0x2883cf=_0x5026c3['length'];if(!_0x45558f[_0x4978('0x45')]['hasOwnProperty'](_0x4978('0x4c'))){_0x3e6861[_0x4978('0x2e')]=qs['limit'](_0x45558f['query']['limit']);_0x3e6861[_0x4978('0x2c')]=qs['offset'](_0x45558f['query'][_0x4978('0x2c')]);}return _0x4aaa50[_0x4978('0xbd')](_0x3e6861);}})['then'](function(_0x16f1c7){if(_0x16f1c7){return _0x16f1c7?{'count':_0x2883cf,'rows':_0x16f1c7}:null;}})[_0x4978('0x35')](respondWithResult(_0x37fd32,null))[_0x4978('0x5c')](handleError(_0x37fd32,null));};exports['getInteractions']=function(_0x1296df,_0x500da6,_0x4b3193){var _0x91b336={'raw':![],'where':{}};var _0x25c38={};var _0x255b8b={'count':0x0,'rows':[]};return db[_0x4978('0x5b')][_0x4978('0x67')]({'where':{'id':_0x1296df['params']['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x500da6,null))['then'](function(_0x12879a){if(_0x12879a){_0x25c38['model']=_[_0x4978('0x46')](db[_0x4978('0x9d')]['rawAttributes']);_0x25c38['query']=_[_0x4978('0x46')](_0x1296df[_0x4978('0x45')]);_0x25c38[_0x4978('0x47')]=_[_0x4978('0x49')](_0x25c38[_0x4978('0x43')],_0x25c38['query']);_0x91b336[_0x4978('0x48')]=_[_0x4978('0x49')](_0x25c38[_0x4978('0x43')],qs[_0x4978('0x4a')](_0x1296df[_0x4978('0x45')][_0x4978('0x4a')]));_0x91b336[_0x4978('0x48')]=_0x91b336['attributes'][_0x4978('0x4b')]?_0x91b336[_0x4978('0x48')]:_0x25c38[_0x4978('0x43')];if(!_0x1296df[_0x4978('0x45')]['hasOwnProperty']('nolimit')){_0x91b336['limit']=qs[_0x4978('0x2e')](_0x1296df[_0x4978('0x45')][_0x4978('0x2e')]);_0x91b336[_0x4978('0x2c')]=qs[_0x4978('0x2c')](_0x1296df[_0x4978('0x45')][_0x4978('0x2c')]);}_0x91b336[_0x4978('0x4d')]=qs['sort'](_0x1296df[_0x4978('0x45')][_0x4978('0x4e')]);_0x91b336[_0x4978('0x4f')]=qs['filters'](_[_0x4978('0x50')](_0x1296df[_0x4978('0x45')],_0x25c38[_0x4978('0x47')]));_0x91b336['where']['SmsAccountId']=_0x12879a['id'];if(_0x1296df['query'][_0x4978('0x51')]){_0x91b336[_0x4978('0x4f')]=_[_0x4978('0x52')](_0x91b336[_0x4978('0x4f')],{'$or':_['map'](_0x91b336[_0x4978('0x48')],function(_0x133a44){var _0x2c943a={};_0x2c943a[_0x133a44]={'$like':'%'+_0x1296df[_0x4978('0x45')]['filter']+'%'};return _0x2c943a;})});}_0x91b336=_['merge']({},_0x91b336,_0x1296df['options']);return db[_0x4978('0x9d')][_0x4978('0x2f')]({'where':_0x91b336[_0x4978('0x4f')]})[_0x4978('0x35')](function(_0x2f092f){_0x255b8b['count']=_0x2f092f;if(_0x1296df[_0x4978('0x45')][_0x4978('0x55')]){_0x91b336['include']=[{'model':db[_0x4978('0x77')],'as':_0x4978('0xbe'),'required':![]},{'model':db[_0x4978('0xa7')],'as':_0x4978('0xbf'),'attributes':[_0x4978('0x3c'),'fullname',_0x4978('0xc0')],'required':![]},{'model':db[_0x4978('0xc1')],'as':'Tags','attributes':['id',_0x4978('0x3c'),'color'],'where':_0x1296df[_0x4978('0x45')]['tag']?{'id':_0x1296df[_0x4978('0x45')][_0x4978('0xc2')]}:undefined,'required':_0x1296df[_0x4978('0x45')][_0x4978('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x4978('0x57')](_0x91b336);})[_0x4978('0x35')](function(_0x587787){_0x255b8b[_0x4978('0x58')]=_0x587787;return _0x255b8b;});}})[_0x4978('0x35')](respondWithFilteredResult(_0x500da6,_0x91b336))[_0x4978('0x5c')](handleError(_0x500da6,null));};exports['send']=function(_0x4b1570,_0x37cca8,_0x489a7a){var _0x29af56,_0x53de25,_0x307dbc;if(_[_0x4978('0x92')](_0x4b1570[_0x4978('0x5e')]['body'])||_0x4b1570['body'][_0x4978('0x5e')]===''){throw new db['Sequelize'][(_0x4978('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4b1570['body']['to'])){throw new db[(_0x4978('0x78'))][(_0x4978('0x79'))](_0x4978('0xc3'));}_0x29af56=_0x4b1570['body']['to'];return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x4b1570[_0x4978('0x5a')]['id']},'include':[{'model':db[_0x4978('0x97')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4978('0x99'),'where':{'mobile':_0x29af56},'limit':0x1,'order':[['updatedAt',_0x4978('0x9a')]]}]}]})[_0x4978('0x35')](handleEntityNotFound(_0x37cca8,null))[_0x4978('0x35')](function(_0x1401ce){if(_0x1401ce&&_0x1401ce['List']){_0x53de25=_0x1401ce[_0x4978('0x37')]({'plain':!![]});if(_0x53de25[_0x4978('0xc4')]&&_0x53de25['List']['Contacts'][_0x4978('0x4b')]){return _0x53de25[_0x4978('0xc4')][_0x4978('0x99')][0x0];}return db['CmContact'][_0x4978('0x5d')](_[_0x4978('0x18')](_0x4b1570[_0x4978('0x5e')],{'firstName':_0x29af56,'mobile':_0x29af56,'phone':_0x29af56,'ListId':_0x53de25['ListId']}));}})[_0x4978('0x35')](handleEntityNotFound(_0x37cca8,null))[_0x4978('0x35')](function(_0x19c1a4){if(_0x19c1a4){_0x307dbc=_0x19c1a4;return db[_0x4978('0x9d')][_0x4978('0x61')]({'where':{'ContactId':_0x307dbc['id'],'closed':![],'SmsAccountId':_0x53de25['id']}})[_0x4978('0x35')](function(_0x681ce3){if(_0x681ce3){return[_0x681ce3,![]];}return db['SmsInteraction'][_0x4978('0x5d')]({'UserId':_0x4b1570[_0x4978('0x60')]['id'],'ContactId':_0x307dbc['id'],'SmsAccountId':_0x53de25['id'],'phone':_0x29af56,'firstMsgDirection':_0x4978('0xc5'),'Messages':[_[_0x4978('0x52')](_0x4b1570[_0x4978('0x5e')],{'read':![],'body':_0x4b1570['body'][_0x4978('0x5e')],'phone':_0x29af56,'SmsAccountId':_0x53de25['id'],'UserId':_0x4b1570[_0x4978('0x60')]['id'],'ContactId':_0x307dbc['id']})]},{'include':[{'model':db[_0x4978('0xa4')],'as':_0x4978('0xc6')}]})['then'](function(_0x3ebae3){return[_0x3ebae3,!![]];});});}})[_0x4978('0x9e')](function(_0x542b36,_0x2a2630){if(_0x2a2630){return _0x542b36;}return db[_0x4978('0xa4')][_0x4978('0x5d')](_['merge'](_0x4b1570[_0x4978('0x5e')],{'read':![],'body':_0x4b1570[_0x4978('0x5e')][_0x4978('0x5e')],'phone':_0x29af56,'SmsAccountId':_0x53de25['id'],'SmsInteractionId':_0x542b36['id'],'UserId':_0x4b1570[_0x4978('0x60')]['id'],'ContactId':_0x307dbc['id']}))[_0x4978('0x35')](function(_0x523938){_0x542b36[_0x4978('0xc7')][_0x4978('0xc6')]=[];_0x542b36[_0x4978('0xc7')][_0x4978('0xc6')][_0x4978('0xc8')](_0x523938[_0x4978('0xc7')]);return _0x542b36;});})[_0x4978('0x35')](respondWithResult(_0x37cca8,null))[_0x4978('0x5c')](handleError(_0x37cca8,null));};exports['status']=function(_0x14f31a,_0x5ad1b7,_0x435f3e){if(_0x14f31a[_0x4978('0x5e')]['id']){delete _0x14f31a[_0x4978('0x5e')]['id'];}var _0x481355,_0x1598cc,_0x520daf;return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0x14f31a[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x5ad1b7,null))['then'](function(_0x1a031e){if(_0x1a031e){_0x520daf=_0x1a031e;logger[_0x4978('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4978('0xc9'),_0x1a031e[_0x4978('0x41')],util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));switch(_0x1a031e[_0x4978('0x41')]){case'skebby':if(_0x14f31a[_0x4978('0x5e')][_0x4978('0xcb')]&&_0x14f31a['body'][_0x4978('0x29')]){_0x1598cc=_0x14f31a[_0x4978('0x5e')][_0x4978('0x29')];return db['SmsMessage'][_0x4978('0x61')]({'where':{'messageId':_0x14f31a[_0x4978('0x5e')][_0x4978('0xcb')]}});}break;case _0x4978('0x87'):if(_0x14f31a[_0x4978('0x5e')][_0x4978('0xcc')]&&_0x14f31a['body'][_0x4978('0xcd')]){_0x1598cc=_0x14f31a['body'][_0x4978('0xcd')];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0x14f31a[_0x4978('0x5e')][_0x4978('0xcc')]}});}break;case'clicksend':if(_0x14f31a['body'][_0x4978('0x89')]&&_0x14f31a[_0x4978('0x5e')]['status_code']){_0x1598cc=_0x14f31a[_0x4978('0x5e')][_0x4978('0xce')];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0x14f31a['body'][_0x4978('0x89')]}});}break;case _0x4978('0x8d'):var _0x1e7190=_0x14f31a[_0x4978('0x5e')]['results'][0x0];if(_0x1e7190[_0x4978('0x81')]&&_0x1e7190['status'][_0x4978('0xcf')]===_0x4978('0xd0')){_0x1598cc=_0x1e7190['status'][_0x4978('0xcf')];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0x1e7190[_0x4978('0x81')]}});}break;case _0x4978('0x8f'):if(_0x14f31a[_0x4978('0x5e')][_0x4978('0x81')]&&_0x14f31a[_0x4978('0x5e')][_0x4978('0x29')]){_0x1598cc=_0x14f31a[_0x4978('0x5e')][_0x4978('0x29')];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0x14f31a[_0x4978('0x5e')][_0x4978('0x81')]}});}break;case'bandwidth':if(_0x14f31a[_0x4978('0x5e')][0x0][_0x4978('0x26')]['id']){_0x1598cc=_0x14f31a['body'][0x0][_0x4978('0x41')];return db['SmsMessage'][_0x4978('0x61')]({'where':{'messageId':_0x14f31a[_0x4978('0x5e')][0x0][_0x4978('0x26')]['id']}});}break;case _0x4978('0xd1'):if(_0x14f31a[_0x4978('0x5e')][_0x4978('0xd2')]&&_0x14f31a['body']['status']){_0x1598cc=_0x14f31a[_0x4978('0x5e')][_0x4978('0x29')];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0x14f31a['body'][_0x4978('0xd2')]}});}break;}}})[_0x4978('0x35')](handleEntityNotFound(_0x5ad1b7,null))[_0x4978('0x35')](function(_0x171ce5){if(_0x171ce5){_0x481355=_0x171ce5;switch(_0x520daf[_0x4978('0x41')]){case'skebby':if(_0x1598cc==='DELIVERED'){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')](_0x4978('0x22'),_0x4978('0x29'),'skebby',util['inspect'](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4978('0x87'):if(_0x1598cc==='1'){return _0x481355['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4978('0x29'),_0x4978('0x83'),util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4978('0x88'):if(!_0x14f31a[_0x4978('0x5e')][_0x4978('0xd3')]&&_0x1598cc>=0xc8&&_0x1598cc<=0xce){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')](_0x4978('0x22'),_0x4978('0x29'),_0x4978('0x88'),util[_0x4978('0xca')](_0x14f31a['body'],{'showHidden':![],'depth':null}));}break;case _0x4978('0x8d'):var _0x2e4968=_0x14f31a[_0x4978('0x5e')][_0x4978('0x8e')][0x0];if(_0x2e4968['status'][_0x4978('0xcf')]===_0x4978('0xd0')){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')](_0x4978('0x22'),_0x4978('0x29'),_0x4978('0x8d'),util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1598cc==_0x4978('0xd4')||_0x1598cc==_0x4978('0xd5')){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4978('0x29'),'clickatell',util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4978('0xd6'):if(_0x1598cc==_0x4978('0xd7')){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4978('0x29'),_0x4978('0xd6'),util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4978('0xd1'):if(_0x1598cc===_0x4978('0xd8')||_0x1598cc===_0x4978('0xd9')){return _0x481355[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')](_0x4978('0x22'),_0x4978('0x29'),_0x4978('0xd1'),util[_0x4978('0xca')](_0x14f31a[_0x4978('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x481355;}})[_0x4978('0x35')](respondWithResult(_0x5ad1b7,null))[_0x4978('0x5c')](handleError(_0x5ad1b7,null));};exports[_0x4978('0xda')]=function(_0xdeae4,_0x459034,_0x5eb24e){var _0x876e51,_0x12201e,_0x5a1d71;return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0xdeae4[_0x4978('0x5a')]['id']}})['then'](handleEntityNotFound(_0x459034,null))[_0x4978('0x35')](function(_0x36c321){if(_0x36c321){_0x5a1d71=_0x36c321;logger['debug'](_0x4978('0x22'),_0x4978('0x29'),'received\x20delivery\x20report\x20from',_0x36c321['type'],util['inspect'](_0xdeae4['query'],{'showHidden':![],'depth':null}));switch(_0x36c321[_0x4978('0x41')]){case'csc':if(_0xdeae4[_0x4978('0x45')]['message-id']&&_0xdeae4[_0x4978('0x45')]['state']){_0x12201e=_0xdeae4[_0x4978('0x45')]['state'];return db[_0x4978('0xa4')][_0x4978('0x61')]({'where':{'messageId':_0xdeae4[_0x4978('0x45')][_0x4978('0xdb')]}});}break;}}})[_0x4978('0x35')](handleEntityNotFound(_0x459034,null))[_0x4978('0x35')](function(_0x330df3){if(_0x330df3){_0x876e51=_0x330df3;switch(_0x5a1d71['type']){case _0x4978('0xdc'):if(_0x12201e==='2'||_0x12201e==='6'){return _0x876e51[_0x4978('0x34')]({'read':!![]});}else{logger[_0x4978('0x24')](_0x4978('0x22'),'status','csc',util[_0x4978('0xca')](_0xdeae4[_0x4978('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x876e51;}})[_0x4978('0x35')](respondWithResult(_0x459034,null))[_0x4978('0x5c')](handleError(_0x459034,null));};exports[_0x4978('0xdd')]=function(_0x504d5e,_0x2308c7,_0x577084){return db['SmsAccount'][_0x4978('0x61')]({'where':{'id':_0x504d5e['params']['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x2308c7,null))['then'](function(_0x209350){if(_0x209350){return _0x209350[_0x4978('0xdd')](_0x504d5e[_0x4978('0x5e')][_0x4978('0x6f')],_['omit'](_0x504d5e[_0x4978('0x5e')],[_0x4978('0x6f'),'id'])||{})[_0x4978('0x9e')](function(_0x4a8dd1){for(var _0x1d6fff=0x0;_0x1d6fff<_0x504d5e[_0x4978('0x5e')][_0x4978('0x6f')]['length'];_0x1d6fff+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x504d5e[_0x4978('0x5e')]['ids'][_0x1d6fff]),'SmsAccountId':Number(_0x504d5e[_0x4978('0x5a')]['id'])});}return _0x4a8dd1;});}})[_0x4978('0x35')](respondWithResult(_0x2308c7,null))['catch'](handleError(_0x2308c7,null));};exports[_0x4978('0xde')]=function(_0xd4954,_0x542d31,_0x53e9cd){return db[_0x4978('0x5b')][_0x4978('0x61')]({'where':{'id':_0xd4954[_0x4978('0x5a')]['id']}})[_0x4978('0x35')](handleEntityNotFound(_0x542d31,null))[_0x4978('0x35')](function(_0x547f1b){if(_0x547f1b){return _0x547f1b['removeAgents'](_0xd4954[_0x4978('0x45')][_0x4978('0x6f')])[_0x4978('0x35')](function(){if(_[_0x4978('0xdf')](_0xd4954[_0x4978('0x45')][_0x4978('0x6f')])){for(var _0xfa4756=0x0;_0xfa4756<_0xd4954['query'][_0x4978('0x6f')][_0x4978('0x4b')];_0xfa4756+=0x1){socket[_0x4978('0xe0')](_0x4978('0xe1'),{'UserId':Number(_0xd4954[_0x4978('0x45')][_0x4978('0x6f')][_0xfa4756]),'SmsAccountId':Number(_0xd4954[_0x4978('0x5a')]['id'])});}}else{socket[_0x4978('0xe0')](_0x4978('0xe1'),{'UserId':Number(_0xd4954[_0x4978('0x45')][_0x4978('0x6f')]),'SmsAccountId':Number(_0xd4954[_0x4978('0x5a')]['id'])});}});}})[_0x4978('0x35')](respondWithStatusCode(_0x542d31,null))[_0x4978('0x5c')](handleError(_0x542d31,null));};exports[_0x4978('0xe2')]=function(_0x2c1226,_0x1f1a69,_0x2b8ee4){var _0x2cde1c={};var _0x337873={};var _0x493917;var _0x42afdc;return db[_0x4978('0x5b')]['findOne']({'where':{'id':_0x2c1226[_0x4978('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f1a69,null))[_0x4978('0x35')](function(_0x19f6c3){if(_0x19f6c3){_0x493917=_0x19f6c3;_0x337873[_0x4978('0x43')]=_[_0x4978('0x46')](db[_0x4978('0xa7')][_0x4978('0x40')]);_0x337873['query']=_[_0x4978('0x46')](_0x2c1226[_0x4978('0x45')]);_0x337873[_0x4978('0x47')]=_[_0x4978('0x49')](_0x337873[_0x4978('0x43')],_0x337873[_0x4978('0x45')]);_0x2cde1c['attributes']=_[_0x4978('0x49')](_0x337873[_0x4978('0x43')],qs[_0x4978('0x4a')](_0x2c1226['query']['fields']));_0x2cde1c[_0x4978('0x48')]=_0x2cde1c['attributes'][_0x4978('0x4b')]?_0x2cde1c[_0x4978('0x48')]:_0x337873[_0x4978('0x43')];_0x2cde1c['order']=qs[_0x4978('0x4e')](_0x2c1226[_0x4978('0x45')][_0x4978('0x4e')]);_0x2cde1c[_0x4978('0x4f')]=qs['filters'](_[_0x4978('0x50')](_0x2c1226[_0x4978('0x45')],_0x337873[_0x4978('0x47')]));if(_0x2c1226['query'][_0x4978('0x51')]){_0x2cde1c['where']=_['merge'](_0x2cde1c[_0x4978('0x4f')],{'$or':_[_0x4978('0x44')](_0x2cde1c[_0x4978('0x48')],function(_0x162b11){var _0x1cfb75={};_0x1cfb75[_0x162b11]={'$like':'%'+_0x2c1226[_0x4978('0x45')][_0x4978('0x51')]+'%'};return _0x1cfb75;})});}_0x2cde1c=_[_0x4978('0x52')]({},_0x2cde1c,_0x2c1226[_0x4978('0x54')]);return _0x493917['getAgents'](_0x2cde1c);}})[_0x4978('0x35')](function(_0x109f47){if(_0x109f47){_0x42afdc=_0x109f47[_0x4978('0x4b')];if(!_0x2c1226[_0x4978('0x45')][_0x4978('0x69')](_0x4978('0x4c'))){_0x2cde1c[_0x4978('0x2e')]=qs[_0x4978('0x2e')](_0x2c1226[_0x4978('0x45')][_0x4978('0x2e')]);_0x2cde1c[_0x4978('0x2c')]=qs[_0x4978('0x2c')](_0x2c1226[_0x4978('0x45')]['offset']);}return _0x493917[_0x4978('0xe2')](_0x2cde1c);}})['then'](function(_0xc69480){if(_0xc69480){return _0xc69480?{'count':_0x42afdc,'rows':_0xc69480}:null;}})[_0x4978('0x35')](respondWithResult(_0x1f1a69,null))['catch'](handleError(_0x1f1a69,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b6fc56b..9984c08 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 _0x29a8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4d058e,_0x3949a3){var _0x8a4b55=function(_0x5a52dd){while(--_0x5a52dd){_0x4d058e['push'](_0x4d058e['shift']());}};_0x8a4b55(++_0x3949a3);}(_0x29a8,0x105));var _0x829a=function(_0x4f13f8,_0x5e13c5){_0x4f13f8=_0x4f13f8-0x0;var _0x1e6b83=_0x29a8[_0x4f13f8];return _0x1e6b83;};'use strict';var EventEmitter=require(_0x829a('0x0'));var SmsAccount=require(_0x829a('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x829a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x829a('0x3')};function emitEvent(_0x57e3ed){return function(_0x31c83b,_0xf26d59,_0x1e81b9){SmsAccountEvents[_0x829a('0x4')](_0x57e3ed+':'+_0x31c83b['id'],_0x31c83b);SmsAccountEvents[_0x829a('0x4')](_0x57e3ed,_0x31c83b);_0x1e81b9(null);};}for(var e in events){if(events[_0x829a('0x5')](e)){var event=events[e];SmsAccount[_0x829a('0x6')](e,emitEvent(event));}}module[_0x829a('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x1f09=['events','../../mysqldb','save','hasOwnProperty','hook','exports'];(function(_0x348fde,_0x399209){var _0x54f919=function(_0x151ad7){while(--_0x151ad7){_0x348fde['push'](_0x348fde['shift']());}};_0x54f919(++_0x399209);}(_0x1f09,0x186));var _0x91f0=function(_0x57577b,_0x7b28fc){_0x57577b=_0x57577b-0x0;var _0x23ae5b=_0x1f09[_0x57577b];return _0x23ae5b;};'use strict';var EventEmitter=require(_0x91f0('0x0'));var SmsAccount=require(_0x91f0('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x91f0('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x124cd9){return function(_0x473ac9,_0x57512c,_0x594ba0){SmsAccountEvents['emit'](_0x124cd9+':'+_0x473ac9['id'],_0x473ac9);SmsAccountEvents['emit'](_0x124cd9,_0x473ac9);_0x594ba0(null);};}for(var e in events){if(events[_0x91f0('0x3')](e)){var event=events[e];SmsAccount[_0x91f0('0x4')](e,emitEvent(event));}}module[_0x91f0('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f63e907..0cb53bd 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 _0xc2b3=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','lodash','util'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0xc2b3,0xf0));var _0x3c2b=function(_0x46abd9,_0x470c14){_0x46abd9=_0x46abd9-0x0;var _0x20e6ac=_0xc2b3[_0x46abd9];return _0x20e6ac;};'use strict';var _=require(_0x3c2b('0x0'));var util=require(_0x3c2b('0x1'));var logger=require('../../config/logger')(_0x3c2b('0x2'));var moment=require(_0x3c2b('0x3'));var BPromise=require(_0x3c2b('0x4'));var rp=require(_0x3c2b('0x5'));var fs=require('fs');var path=require(_0x3c2b('0x6'));var rimraf=require('rimraf');var config=require(_0x3c2b('0x7'));var attributes=require(_0x3c2b('0x8'));module['exports']=function(_0x10ddff,_0x18e153){return _0x10ddff[_0x3c2b('0x9')](_0x3c2b('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc24f=['path','./smsAccount.attributes','exports','SmsAccount','lodash','../../config/logger','api','moment'];(function(_0x2bee02,_0x41bb6e){var _0x56a9d3=function(_0x3b7dd1){while(--_0x3b7dd1){_0x2bee02['push'](_0x2bee02['shift']());}};_0x56a9d3(++_0x41bb6e);}(_0xc24f,0x184));var _0xfc24=function(_0x431406,_0x4e8184){_0x431406=_0x431406-0x0;var _0x2304db=_0xc24f[_0x431406];return _0x2304db;};'use strict';var _=require(_0xfc24('0x0'));var util=require('util');var logger=require(_0xfc24('0x1'))(_0xfc24('0x2'));var moment=require(_0xfc24('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc24('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc24('0x5'));module[_0xfc24('0x6')]=function(_0x594a2a,_0x2e2d40){return _0x594a2a['define'](_0xfc24('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 05e96c5..8be0852 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 _0x6fbd=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6fbd,0x16b));var _0xd6fb=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x6fbd[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require(_0xd6fb('0x0'));var util=require('util');var moment=require(_0xd6fb('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6fb('0x2'));var fs=require('fs');var Redis=require(_0xd6fb('0x3'));var db=require(_0xd6fb('0x4'))['db'];var utils=require(_0xd6fb('0x5'));var logger=require('../../config/logger')(_0xd6fb('0x6'));var config=require('../../config/environment');var jayson=require(_0xd6fb('0x7'));var client=jayson[_0xd6fb('0x8')][_0xd6fb('0x9')]({'port':0x232a});config[_0xd6fb('0xa')]=_[_0xd6fb('0xb')](config[_0xd6fb('0xa')],{'host':_0xd6fb('0xc'),'port':0x18eb});var socket=require(_0xd6fb('0xd'))(new Redis(config[_0xd6fb('0xa')]));require(_0xd6fb('0xe'))[_0xd6fb('0xf')](socket);function respondWithRpcPromise(_0x1782aa,_0x266672,_0x5c72c2){return new BPromise(function(_0x35a662,_0x1ac657){return client[_0xd6fb('0x10')](_0x1782aa,_0x5c72c2)[_0xd6fb('0x11')](function(_0x1fc8c7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x266672,_0xd6fb('0x12'));logger[_0xd6fb('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x266672,_0xd6fb('0x12'),JSON[_0xd6fb('0x14')](_0x1fc8c7));if(_0x1fc8c7[_0xd6fb('0x15')]){if(_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x16')]===0x1f4){logger[_0xd6fb('0x15')](_0xd6fb('0x17'),_0x266672,_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);return _0x1ac657(_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);}logger[_0xd6fb('0x15')](_0xd6fb('0x17'),_0x266672,_0x1fc8c7[_0xd6fb('0x15')][_0xd6fb('0x18')]);return _0x35a662(_0x1fc8c7['error'][_0xd6fb('0x18')]);}else{logger[_0xd6fb('0x19')](_0xd6fb('0x17'),_0x266672,_0xd6fb('0x12'));_0x35a662(_0x1fc8c7[_0xd6fb('0x1a')]['message']);}})[_0xd6fb('0x1b')](function(_0x404f22){logger['error'](_0xd6fb('0x17'),_0x266672,_0x404f22);_0x1ac657(_0x404f22);});});}exports[_0xd6fb('0x1c')]=function(_0x36d222){var _0x346609=this;return new Promise(function(_0x4e41b7,_0x549ec9){return db[_0xd6fb('0x1d')][_0xd6fb('0x1e')]({'raw':_0x36d222[_0xd6fb('0x1f')]?_0x36d222['options'][_0xd6fb('0x20')]===undefined?!![]:![]:!![],'where':_0x36d222[_0xd6fb('0x1f')]?_0x36d222[_0xd6fb('0x1f')]['where']||null:null,'attributes':_0x36d222[_0xd6fb('0x1f')]?_0x36d222['options'][_0xd6fb('0x21')]||null:null,'include':_0x36d222[_0xd6fb('0x1f')]?_0x36d222[_0xd6fb('0x1f')][_0xd6fb('0x22')]?_['map'](_0x36d222[_0xd6fb('0x1f')][_0xd6fb('0x22')],function(_0x4911fa){return{'model':db[_0x4911fa[_0xd6fb('0x23')]],'as':_0x4911fa['as'],'attributes':_0x4911fa[_0xd6fb('0x21')],'include':_0x4911fa['include']?_[_0xd6fb('0x24')](_0x4911fa['include'],function(_0x31a446){return{'model':db[_0x31a446['model']],'as':_0x31a446['as'],'attributes':_0x31a446[_0xd6fb('0x21')],'include':_0x31a446[_0xd6fb('0x22')]?_[_0xd6fb('0x24')](_0x31a446['include'],function(_0x2818ef){return{'model':db[_0x2818ef['model']],'as':_0x2818ef['as'],'attributes':_0x2818ef[_0xd6fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd6fb('0x11')](function(_0x4c7972){logger[_0xd6fb('0x19')]('ShowSmsAccount',_0x36d222);logger[_0xd6fb('0x13')](_0xd6fb('0x1c'),_0x36d222,JSON[_0xd6fb('0x14')](_0x4c7972));_0x4e41b7(_0x4c7972);})[_0xd6fb('0x1b')](function(_0x218c0b){logger['error'](_0xd6fb('0x1c'),_0x218c0b[_0xd6fb('0x18')],_0x36d222);_0x549ec9(_0x346609['error'](0x1f4,_0x218c0b['message']));});});}; \ No newline at end of file +var _0xc105=['find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount'];(function(_0x100e54,_0x4dcb56){var _0x1133da=function(_0x44a8af){while(--_0x44a8af){_0x100e54['push'](_0x100e54['shift']());}};_0x1133da(++_0x4dcb56);}(_0xc105,0x17a));var _0x5c10=function(_0x9a28d6,_0x5e2125){_0x9a28d6=_0x9a28d6-0x0;var _0x438c21=_0xc105[_0x9a28d6];return _0x438c21;};'use strict';var _=require(_0x5c10('0x0'));var util=require('util');var moment=require(_0x5c10('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c10('0x2'));var fs=require('fs');var Redis=require(_0x5c10('0x3'));var db=require(_0x5c10('0x4'))['db'];var utils=require(_0x5c10('0x5'));var logger=require(_0x5c10('0x6'))(_0x5c10('0x7'));var config=require(_0x5c10('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5c10('0x9')][_0x5c10('0xa')]({'port':0x232a});config['redis']=_[_0x5c10('0xb')](config[_0x5c10('0xc')],{'host':_0x5c10('0xd'),'port':0x18eb});var socket=require(_0x5c10('0xe'))(new Redis(config['redis']));require(_0x5c10('0xf'))[_0x5c10('0x10')](socket);function respondWithRpcPromise(_0x4414fc,_0x2b8c13,_0x22dd99){return new BPromise(function(_0x429611,_0x3b3308){return client[_0x5c10('0x11')](_0x4414fc,_0x22dd99)['then'](function(_0x1c6fb2){logger[_0x5c10('0x12')]('SmsAccount,\x20%s,\x20%s',_0x2b8c13,_0x5c10('0x13'));logger[_0x5c10('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2b8c13,'request\x20sent',JSON[_0x5c10('0x15')](_0x1c6fb2));if(_0x1c6fb2[_0x5c10('0x16')]){if(_0x1c6fb2[_0x5c10('0x16')][_0x5c10('0x17')]===0x1f4){logger[_0x5c10('0x16')](_0x5c10('0x18'),_0x2b8c13,_0x1c6fb2[_0x5c10('0x16')]['message']);return _0x3b3308(_0x1c6fb2[_0x5c10('0x16')][_0x5c10('0x19')]);}logger['error'](_0x5c10('0x18'),_0x2b8c13,_0x1c6fb2[_0x5c10('0x16')][_0x5c10('0x19')]);return _0x429611(_0x1c6fb2['error'][_0x5c10('0x19')]);}else{logger[_0x5c10('0x12')](_0x5c10('0x18'),_0x2b8c13,_0x5c10('0x13'));_0x429611(_0x1c6fb2['result'][_0x5c10('0x19')]);}})[_0x5c10('0x1a')](function(_0x5d7c68){logger[_0x5c10('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2b8c13,_0x5d7c68);_0x3b3308(_0x5d7c68);});});}exports[_0x5c10('0x1b')]=function(_0x24de4c){var _0x40703d=this;return new Promise(function(_0x314fab,_0x35c2c3){return db[_0x5c10('0x1c')][_0x5c10('0x1d')]({'raw':_0x24de4c['options']?_0x24de4c[_0x5c10('0x1e')][_0x5c10('0x1f')]===undefined?!![]:![]:!![],'where':_0x24de4c[_0x5c10('0x1e')]?_0x24de4c[_0x5c10('0x1e')][_0x5c10('0x20')]||null:null,'attributes':_0x24de4c['options']?_0x24de4c[_0x5c10('0x1e')][_0x5c10('0x21')]||null:null,'include':_0x24de4c[_0x5c10('0x1e')]?_0x24de4c[_0x5c10('0x1e')][_0x5c10('0x22')]?_[_0x5c10('0x23')](_0x24de4c[_0x5c10('0x1e')][_0x5c10('0x22')],function(_0x4cac86){return{'model':db[_0x4cac86['model']],'as':_0x4cac86['as'],'attributes':_0x4cac86['attributes'],'include':_0x4cac86[_0x5c10('0x22')]?_[_0x5c10('0x23')](_0x4cac86[_0x5c10('0x22')],function(_0x1ed232){return{'model':db[_0x1ed232[_0x5c10('0x24')]],'as':_0x1ed232['as'],'attributes':_0x1ed232['attributes'],'include':_0x1ed232['include']?_[_0x5c10('0x23')](_0x1ed232[_0x5c10('0x22')],function(_0x2c9c9b){return{'model':db[_0x2c9c9b['model']],'as':_0x2c9c9b['as'],'attributes':_0x2c9c9b[_0x5c10('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4783f4){logger['info']('ShowSmsAccount',_0x24de4c);logger[_0x5c10('0x14')](_0x5c10('0x1b'),_0x24de4c,JSON[_0x5c10('0x15')](_0x4783f4));_0x314fab(_0x4783f4);})['catch'](function(_0x5e216f){logger[_0x5c10('0x16')](_0x5c10('0x1b'),_0x5e216f[_0x5c10('0x19')],_0x24de4c);_0x35c2c3(_0x40703d[_0x5c10('0x16')](0x1f4,_0x5e216f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f5bd360..4343e88 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 56ad2e2..fb2be24 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x212668,_0x4bb833){var _0x11c9e1=function(_0x531c93){while(--_0x531c93){_0x212668['push'](_0x212668['shift']());}};_0x11c9e1(++_0x4bb833);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x28f115,_0x2ba029){var _0x578dd0=function(_0x5e554a){while(--_0x5e554a){_0x28f115['push'](_0x28f115['shift']());}};_0x578dd0(++_0x2ba029);}(_0x008c,0x188));var _0xc008=function(_0x18ac44,_0x5e525e){_0x18ac44=_0x18ac44-0x0;var _0x521d09=_0x008c[_0x18ac44];return _0x521d09;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 54f67bf..f4a3c69 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 _0x7457=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0xd0a7c4,_0x41dd01){var _0x23f1d2=function(_0x1a55f7){while(--_0x1a55f7){_0xd0a7c4['push'](_0xd0a7c4['shift']());}};_0x23f1d2(++_0x41dd01);}(_0x7457,0x159));var _0x7745=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x7457[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require(_0x7745('0x0'));module[_0x7745('0x1')]={'priority':{'type':Sequelize[_0x7745('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7745('0x3')},'appdata':{'type':Sequelize[_0x7745('0x4')]()},'description':{'type':Sequelize[_0x7745('0x5')]},'interval':{'type':Sequelize[_0x7745('0x5')],'defaultValue':_0x7745('0x6')}}; \ No newline at end of file +var _0xd615=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x566b46,_0x1b99f0){var _0x488f1a=function(_0x1698c3){while(--_0x1698c3){_0x566b46['push'](_0x566b46['shift']());}};_0x488f1a(++_0x1b99f0);}(_0xd615,0x1ef));var _0x5d61=function(_0x17ea61,_0x48eb80){_0x17ea61=_0x17ea61-0x0;var _0x1161ef=_0xd615[_0x17ea61];return _0x1161ef;};'use strict';var Sequelize=require('sequelize');module[_0x5d61('0x0')]={'priority':{'type':Sequelize[_0x5d61('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5d61('0x2')]()},'description':{'type':Sequelize[_0x5d61('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5d61('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 90a97ec..e00ca71 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 _0xe090=['limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','SmsApplication','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x1f9bf7,_0x559dcf){var _0x3fd8f5=function(_0x5c1c07){while(--_0x5c1c07){_0x1f9bf7['push'](_0x1f9bf7['shift']());}};_0x3fd8f5(++_0x559dcf);}(_0xe090,0x77));var _0x0e09=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xe090[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e09('0x0'));var zipdir=require(_0x0e09('0x1'));var jsonpatch=require(_0x0e09('0x2'));var rp=require(_0x0e09('0x3'));var moment=require(_0x0e09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e09('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0e09('0x6'));var csv=require(_0x0e09('0x7'));var ejs=require(_0x0e09('0x8'));var fs=require('fs');var fs_extra=require(_0x0e09('0x9'));var _=require(_0x0e09('0xa'));var squel=require(_0x0e09('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e09('0xc'));var deskjs=require(_0x0e09('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0e09('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e09('0xf'));var authService=require(_0x0e09('0x10'));var qs=require(_0x0e09('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e09('0x12'));var logger=require(_0x0e09('0x13'))(_0x0e09('0x14'));var utils=require('../../config/utils');var config=require(_0x0e09('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e09('0x16'))['db'];function respondWithStatusCode(_0x3933be,_0x850990){_0x850990=_0x850990||0xcc;return function(_0x2ce74b){if(_0x2ce74b){return _0x3933be[_0x0e09('0x17')](_0x850990);}return _0x3933be[_0x0e09('0x18')](_0x850990)[_0x0e09('0x19')]();};}function respondWithResult(_0x429d4d,_0x58ff94){_0x58ff94=_0x58ff94||0xc8;return function(_0x46d376){if(_0x46d376){return _0x429d4d[_0x0e09('0x18')](_0x58ff94)[_0x0e09('0x1a')](_0x46d376);}};}function respondWithFilteredResult(_0x25872c,_0x1568a3){return function(_0x38d108){if(_0x38d108){var _0x13b233=typeof _0x1568a3[_0x0e09('0x1b')]===_0x0e09('0x1c')&&typeof _0x1568a3[_0x0e09('0x1d')]===_0x0e09('0x1c');var _0x11ca7e=_0x38d108['count'];var _0x2fca4c=_0x13b233?0x0:_0x1568a3[_0x0e09('0x1b')];var _0x1f61ad=_0x13b233?_0x38d108[_0x0e09('0x1e')]:_0x1568a3[_0x0e09('0x1b')]+_0x1568a3['limit'];var _0x567cbe;if(_0x1f61ad>=_0x11ca7e){_0x1f61ad=_0x11ca7e;_0x567cbe=0xc8;}else{_0x567cbe=0xce;}_0x25872c[_0x0e09('0x18')](_0x567cbe);return _0x25872c[_0x0e09('0x1f')](_0x0e09('0x20'),_0x2fca4c+'-'+_0x1f61ad+'/'+_0x11ca7e)[_0x0e09('0x1a')](_0x38d108);}return null;};}function patchUpdates(_0x40fdcb){return function(_0x239841){try{jsonpatch[_0x0e09('0x21')](_0x239841,_0x40fdcb,!![]);}catch(_0x18d51b){return BPromise['reject'](_0x18d51b);}return _0x239841[_0x0e09('0x22')]();};}function saveUpdates(_0x97daab,_0x290010){return function(_0x63e868){if(_0x63e868){return _0x63e868['update'](_0x97daab)['then'](function(_0xe026fe){return _0xe026fe;});}return null;};}function removeEntity(_0x22ac59,_0x378feb){return function(_0xa752c4){if(_0xa752c4){return _0xa752c4[_0x0e09('0x23')]()[_0x0e09('0x24')](function(){_0x22ac59[_0x0e09('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa90b,_0x20fdfb){return function(_0x2347bb){if(!_0x2347bb){_0x2aa90b['sendStatus'](0x194);}return _0x2347bb;};}function handleError(_0xb34635,_0x5b2217){_0x5b2217=_0x5b2217||0x1f4;return function(_0x298049){logger[_0x0e09('0x25')](_0x298049[_0x0e09('0x26')]);if(_0x298049[_0x0e09('0x27')]){delete _0x298049[_0x0e09('0x27')];}_0xb34635[_0x0e09('0x18')](_0x5b2217)[_0x0e09('0x28')](_0x298049);};}exports[_0x0e09('0x29')]=function(_0x17f7cc,_0x21bc21){var _0x24ada1={},_0x220e05={},_0x2979e5={'count':0x0,'rows':[]};var _0x13c9cd=_['map'](db[_0x0e09('0x2a')]['rawAttributes'],function(_0x3e25a2){return{'name':_0x3e25a2[_0x0e09('0x2b')],'type':_0x3e25a2['type'][_0x0e09('0x2c')]};});_0x220e05[_0x0e09('0x2d')]=_['map'](_0x13c9cd,_0x0e09('0x27'));_0x220e05[_0x0e09('0x2e')]=_[_0x0e09('0x2f')](_0x17f7cc[_0x0e09('0x2e')]);_0x220e05[_0x0e09('0x30')]=_[_0x0e09('0x31')](_0x220e05[_0x0e09('0x2d')],_0x220e05[_0x0e09('0x2e')]);_0x24ada1[_0x0e09('0x32')]=_[_0x0e09('0x31')](_0x220e05[_0x0e09('0x2d')],qs[_0x0e09('0x33')](_0x17f7cc['query'][_0x0e09('0x33')]));_0x24ada1[_0x0e09('0x32')]=_0x24ada1[_0x0e09('0x32')]['length']?_0x24ada1[_0x0e09('0x32')]:_0x220e05[_0x0e09('0x2d')];if(!_0x17f7cc['query'][_0x0e09('0x34')](_0x0e09('0x35'))){_0x24ada1[_0x0e09('0x1d')]=qs['limit'](_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x1d')]);_0x24ada1[_0x0e09('0x1b')]=qs[_0x0e09('0x1b')](_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x1b')]);}_0x24ada1['order']=qs[_0x0e09('0x36')](_0x17f7cc['query']['sort']);_0x24ada1[_0x0e09('0x37')]=qs['filters'](_['pick'](_0x17f7cc[_0x0e09('0x2e')],_0x220e05[_0x0e09('0x30')]),_0x13c9cd);if(_0x17f7cc['query'][_0x0e09('0x38')]){_0x24ada1[_0x0e09('0x37')]=_[_0x0e09('0x39')](_0x24ada1[_0x0e09('0x37')],{'$or':_[_0x0e09('0x3a')](_0x13c9cd,function(_0x3b2f18){if(_0x3b2f18[_0x0e09('0x3b')]!==_0x0e09('0x3c')){var _0xc9e9ed={};_0xc9e9ed[_0x3b2f18['name']]={'$like':'%'+_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x38')]+'%'};return _0xc9e9ed;}})});}_0x24ada1=_[_0x0e09('0x39')]({},_0x24ada1,_0x17f7cc['options']);var _0x5061ca={'where':_0x24ada1['where']};return db['SmsApplication'][_0x0e09('0x1e')](_0x5061ca)['then'](function(_0x633354){_0x2979e5['count']=_0x633354;if(_0x17f7cc[_0x0e09('0x2e')][_0x0e09('0x3d')]){_0x24ada1[_0x0e09('0x3e')]=[{'all':!![]}];}return db[_0x0e09('0x2a')][_0x0e09('0x3f')](_0x24ada1);})[_0x0e09('0x24')](function(_0x4c05bd){_0x2979e5[_0x0e09('0x40')]=_0x4c05bd;return _0x2979e5;})['then'](respondWithFilteredResult(_0x21bc21,_0x24ada1))[_0x0e09('0x41')](handleError(_0x21bc21,null));};exports[_0x0e09('0x42')]=function(_0x29c51e,_0x1170cd){var _0xe5549c={'raw':!![],'where':{'id':_0x29c51e['params']['id']}},_0x172d3a={};_0x172d3a[_0x0e09('0x2d')]=_['keys'](db[_0x0e09('0x2a')]['rawAttributes']);_0x172d3a[_0x0e09('0x2e')]=_['keys'](_0x29c51e[_0x0e09('0x2e')]);_0x172d3a[_0x0e09('0x30')]=_[_0x0e09('0x31')](_0x172d3a['model'],_0x172d3a[_0x0e09('0x2e')]);_0xe5549c[_0x0e09('0x32')]=_[_0x0e09('0x31')](_0x172d3a[_0x0e09('0x2d')],qs[_0x0e09('0x33')](_0x29c51e[_0x0e09('0x2e')][_0x0e09('0x33')]));_0xe5549c['attributes']=_0xe5549c[_0x0e09('0x32')][_0x0e09('0x43')]?_0xe5549c[_0x0e09('0x32')]:_0x172d3a[_0x0e09('0x2d')];if(_0x29c51e[_0x0e09('0x2e')]['includeAll']){_0xe5549c['include']=[{'all':!![]}];}_0xe5549c=_['merge']({},_0xe5549c,_0x29c51e[_0x0e09('0x44')]);return db[_0x0e09('0x2a')][_0x0e09('0x45')](_0xe5549c)[_0x0e09('0x24')](handleEntityNotFound(_0x1170cd,null))[_0x0e09('0x24')](respondWithResult(_0x1170cd,null))['catch'](handleError(_0x1170cd,null));};exports[_0x0e09('0x46')]=function(_0x57ac90,_0x37dd3c){return db[_0x0e09('0x2a')][_0x0e09('0x46')](_0x57ac90['body'],{})[_0x0e09('0x24')](respondWithResult(_0x37dd3c,0xc9))[_0x0e09('0x41')](handleError(_0x37dd3c,null));};exports[_0x0e09('0x47')]=function(_0x11cae3,_0x229623){if(_0x11cae3[_0x0e09('0x48')]['id']){delete _0x11cae3[_0x0e09('0x48')]['id'];}return db[_0x0e09('0x2a')][_0x0e09('0x45')]({'where':{'id':_0x11cae3[_0x0e09('0x49')]['id']}})['then'](handleEntityNotFound(_0x229623,null))[_0x0e09('0x24')](saveUpdates(_0x11cae3[_0x0e09('0x48')],null))['then'](respondWithResult(_0x229623,null))[_0x0e09('0x41')](handleError(_0x229623,null));};exports[_0x0e09('0x23')]=function(_0x42c005,_0x4be11a){return db[_0x0e09('0x2a')][_0x0e09('0x45')]({'where':{'id':_0x42c005[_0x0e09('0x49')]['id']}})[_0x0e09('0x24')](handleEntityNotFound(_0x4be11a,null))[_0x0e09('0x24')](removeEntity(_0x4be11a,null))[_0x0e09('0x41')](handleError(_0x4be11a,null));}; \ No newline at end of file +var _0xd20d=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count'];(function(_0x8680ed,_0x497daf){var _0x51e9c4=function(_0x507859){while(--_0x507859){_0x8680ed['push'](_0x8680ed['shift']());}};_0x51e9c4(++_0x497daf);}(_0xd20d,0xba));var _0xdd20=function(_0x1b1472,_0x5aae0e){_0x1b1472=_0x1b1472-0x0;var _0x56add4=_0xd20d[_0x1b1472];return _0x56add4;};'use strict';var emlformat=require(_0xdd20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd20('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd20('0x2'));var moment=require(_0xdd20('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd20('0x4'));var util=require('util');var path=require(_0xdd20('0x5'));var sox=require(_0xdd20('0x6'));var csv=require(_0xdd20('0x7'));var ejs=require(_0xdd20('0x8'));var fs=require('fs');var fs_extra=require(_0xdd20('0x9'));var _=require(_0xdd20('0xa'));var squel=require('squel');var crypto=require(_0xdd20('0xb'));var jsforce=require(_0xdd20('0xc'));var deskjs=require(_0xdd20('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdd20('0xe'));var Papa=require(_0xdd20('0xf'));var Redis=require(_0xdd20('0x10'));var authService=require(_0xdd20('0x11'));var qs=require(_0xdd20('0x12'));var as=require(_0xdd20('0x13'));var hardwareService=require(_0xdd20('0x14'));var logger=require(_0xdd20('0x15'))('api');var utils=require(_0xdd20('0x16'));var config=require(_0xdd20('0x17'));var licenseUtil=require(_0xdd20('0x18'));var db=require(_0xdd20('0x19'))['db'];function respondWithStatusCode(_0x4a447b,_0xac2204){_0xac2204=_0xac2204||0xcc;return function(_0x463fe3){if(_0x463fe3){return _0x4a447b[_0xdd20('0x1a')](_0xac2204);}return _0x4a447b[_0xdd20('0x1b')](_0xac2204)[_0xdd20('0x1c')]();};}function respondWithResult(_0x35a157,_0x297484){_0x297484=_0x297484||0xc8;return function(_0x5c3d1d){if(_0x5c3d1d){return _0x35a157[_0xdd20('0x1b')](_0x297484)[_0xdd20('0x1d')](_0x5c3d1d);}};}function respondWithFilteredResult(_0x2ee92a,_0x4c8371){return function(_0x50de00){if(_0x50de00){var _0x28ae26=typeof _0x4c8371[_0xdd20('0x1e')]==='undefined'&&typeof _0x4c8371[_0xdd20('0x1f')]==='undefined';var _0x5d4431=_0x50de00[_0xdd20('0x20')];var _0x94fc0b=_0x28ae26?0x0:_0x4c8371[_0xdd20('0x1e')];var _0x1d08c0=_0x28ae26?_0x50de00[_0xdd20('0x20')]:_0x4c8371[_0xdd20('0x1e')]+_0x4c8371[_0xdd20('0x1f')];var _0x5aa1ed;if(_0x1d08c0>=_0x5d4431){_0x1d08c0=_0x5d4431;_0x5aa1ed=0xc8;}else{_0x5aa1ed=0xce;}_0x2ee92a[_0xdd20('0x1b')](_0x5aa1ed);return _0x2ee92a['set']('Content-Range',_0x94fc0b+'-'+_0x1d08c0+'/'+_0x5d4431)['json'](_0x50de00);}return null;};}function patchUpdates(_0x592c4f){return function(_0x12969f){try{jsonpatch[_0xdd20('0x21')](_0x12969f,_0x592c4f,!![]);}catch(_0x3282ac){return BPromise[_0xdd20('0x22')](_0x3282ac);}return _0x12969f[_0xdd20('0x23')]();};}function saveUpdates(_0x5b1aa5,_0x219e4d){return function(_0x2f4123){if(_0x2f4123){return _0x2f4123[_0xdd20('0x24')](_0x5b1aa5)[_0xdd20('0x25')](function(_0x2bac4c){return _0x2bac4c;});}return null;};}function removeEntity(_0x5418f8,_0x470fb5){return function(_0x3d62df){if(_0x3d62df){return _0x3d62df[_0xdd20('0x26')]()['then'](function(){_0x5418f8['status'](0xcc)[_0xdd20('0x1c')]();});}};}function handleEntityNotFound(_0xac182b,_0x1b3d4d){return function(_0x177a6e){if(!_0x177a6e){_0xac182b['sendStatus'](0x194);}return _0x177a6e;};}function handleError(_0x69f25a,_0x3ad592){_0x3ad592=_0x3ad592||0x1f4;return function(_0x10784f){logger[_0xdd20('0x27')](_0x10784f[_0xdd20('0x28')]);if(_0x10784f[_0xdd20('0x29')]){delete _0x10784f[_0xdd20('0x29')];}_0x69f25a['status'](_0x3ad592)[_0xdd20('0x2a')](_0x10784f);};}exports[_0xdd20('0x2b')]=function(_0x25f750,_0x48183d){var _0x28c5e5={},_0x439340={},_0x27711f={'count':0x0,'rows':[]};var _0x1d9a6e=_[_0xdd20('0x2c')](db[_0xdd20('0x2d')][_0xdd20('0x2e')],function(_0x5c0631){return{'name':_0x5c0631[_0xdd20('0x2f')],'type':_0x5c0631['type']['key']};});_0x439340[_0xdd20('0x30')]=_[_0xdd20('0x2c')](_0x1d9a6e,_0xdd20('0x29'));_0x439340['query']=_[_0xdd20('0x31')](_0x25f750['query']);_0x439340[_0xdd20('0x32')]=_[_0xdd20('0x33')](_0x439340[_0xdd20('0x30')],_0x439340[_0xdd20('0x34')]);_0x28c5e5[_0xdd20('0x35')]=_[_0xdd20('0x33')](_0x439340[_0xdd20('0x30')],qs[_0xdd20('0x36')](_0x25f750[_0xdd20('0x34')][_0xdd20('0x36')]));_0x28c5e5[_0xdd20('0x35')]=_0x28c5e5[_0xdd20('0x35')][_0xdd20('0x37')]?_0x28c5e5[_0xdd20('0x35')]:_0x439340['model'];if(!_0x25f750['query'][_0xdd20('0x38')](_0xdd20('0x39'))){_0x28c5e5[_0xdd20('0x1f')]=qs[_0xdd20('0x1f')](_0x25f750['query']['limit']);_0x28c5e5[_0xdd20('0x1e')]=qs[_0xdd20('0x1e')](_0x25f750[_0xdd20('0x34')][_0xdd20('0x1e')]);}_0x28c5e5['order']=qs[_0xdd20('0x3a')](_0x25f750['query'][_0xdd20('0x3a')]);_0x28c5e5['where']=qs[_0xdd20('0x32')](_['pick'](_0x25f750[_0xdd20('0x34')],_0x439340['filters']),_0x1d9a6e);if(_0x25f750[_0xdd20('0x34')]['filter']){_0x28c5e5['where']=_['merge'](_0x28c5e5[_0xdd20('0x3b')],{'$or':_[_0xdd20('0x2c')](_0x1d9a6e,function(_0x2a6728){if(_0x2a6728[_0xdd20('0x3c')]!==_0xdd20('0x3d')){var _0x2aebfa={};_0x2aebfa[_0x2a6728[_0xdd20('0x29')]]={'$like':'%'+_0x25f750['query']['filter']+'%'};return _0x2aebfa;}})});}_0x28c5e5=_[_0xdd20('0x3e')]({},_0x28c5e5,_0x25f750[_0xdd20('0x3f')]);var _0x2a12d2={'where':_0x28c5e5[_0xdd20('0x3b')]};return db[_0xdd20('0x2d')][_0xdd20('0x20')](_0x2a12d2)['then'](function(_0x32b5ae){_0x27711f['count']=_0x32b5ae;if(_0x25f750[_0xdd20('0x34')][_0xdd20('0x40')]){_0x28c5e5[_0xdd20('0x41')]=[{'all':!![]}];}return db[_0xdd20('0x2d')][_0xdd20('0x42')](_0x28c5e5);})[_0xdd20('0x25')](function(_0x26d40a){_0x27711f['rows']=_0x26d40a;return _0x27711f;})[_0xdd20('0x25')](respondWithFilteredResult(_0x48183d,_0x28c5e5))[_0xdd20('0x43')](handleError(_0x48183d,null));};exports[_0xdd20('0x44')]=function(_0x5a5af8,_0x1a3580){var _0x7f304={'raw':!![],'where':{'id':_0x5a5af8[_0xdd20('0x45')]['id']}},_0x571bf1={};_0x571bf1[_0xdd20('0x30')]=_['keys'](db[_0xdd20('0x2d')][_0xdd20('0x2e')]);_0x571bf1['query']=_[_0xdd20('0x31')](_0x5a5af8['query']);_0x571bf1[_0xdd20('0x32')]=_[_0xdd20('0x33')](_0x571bf1[_0xdd20('0x30')],_0x571bf1[_0xdd20('0x34')]);_0x7f304[_0xdd20('0x35')]=_[_0xdd20('0x33')](_0x571bf1[_0xdd20('0x30')],qs['fields'](_0x5a5af8[_0xdd20('0x34')][_0xdd20('0x36')]));_0x7f304[_0xdd20('0x35')]=_0x7f304[_0xdd20('0x35')]['length']?_0x7f304[_0xdd20('0x35')]:_0x571bf1[_0xdd20('0x30')];if(_0x5a5af8['query'][_0xdd20('0x40')]){_0x7f304[_0xdd20('0x41')]=[{'all':!![]}];}_0x7f304=_[_0xdd20('0x3e')]({},_0x7f304,_0x5a5af8[_0xdd20('0x3f')]);return db[_0xdd20('0x2d')]['find'](_0x7f304)[_0xdd20('0x25')](handleEntityNotFound(_0x1a3580,null))[_0xdd20('0x25')](respondWithResult(_0x1a3580,null))[_0xdd20('0x43')](handleError(_0x1a3580,null));};exports['create']=function(_0x5f87d8,_0x25ea00){return db[_0xdd20('0x2d')][_0xdd20('0x46')](_0x5f87d8[_0xdd20('0x47')],{})[_0xdd20('0x25')](respondWithResult(_0x25ea00,0xc9))[_0xdd20('0x43')](handleError(_0x25ea00,null));};exports[_0xdd20('0x24')]=function(_0x547b06,_0x23db66){if(_0x547b06['body']['id']){delete _0x547b06[_0xdd20('0x47')]['id'];}return db[_0xdd20('0x2d')][_0xdd20('0x48')]({'where':{'id':_0x547b06[_0xdd20('0x45')]['id']}})[_0xdd20('0x25')](handleEntityNotFound(_0x23db66,null))[_0xdd20('0x25')](saveUpdates(_0x547b06[_0xdd20('0x47')],null))[_0xdd20('0x25')](respondWithResult(_0x23db66,null))[_0xdd20('0x43')](handleError(_0x23db66,null));};exports[_0xdd20('0x26')]=function(_0x35dc14,_0x351ea3){return db[_0xdd20('0x2d')][_0xdd20('0x48')]({'where':{'id':_0x35dc14[_0xdd20('0x45')]['id']}})[_0xdd20('0x25')](handleEntityNotFound(_0x351ea3,null))[_0xdd20('0x25')](removeEntity(_0x351ea3,null))[_0xdd20('0x43')](handleError(_0x351ea3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 755d11d..cb628df 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 _0xb50e=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','sms_applications'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xb50e,0xc6));var _0xeb50=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0xb50e[_0x4c9cc4];return _0x4384fb;};'use strict';var _=require(_0xeb50('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb50('0x1'));var moment=require(_0xeb50('0x2'));var BPromise=require(_0xeb50('0x3'));var rp=require(_0xeb50('0x4'));var fs=require('fs');var path=require(_0xeb50('0x5'));var rimraf=require('rimraf');var config=require(_0xeb50('0x6'));var attributes=require('./smsApplication.attributes');module[_0xeb50('0x7')]=function(_0x4f254e,_0x5ed529){return _0x4f254e['define']('SmsApplication',attributes,{'tableName':_0xeb50('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x407d=['SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x407d,0x19d));var _0xd407=function(_0x521947,_0x567333){_0x521947=_0x521947-0x0;var _0x3d8fde=_0x407d[_0x521947];return _0x3d8fde;};'use strict';var _=require(_0xd407('0x0'));var util=require(_0xd407('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd407('0x2'));var BPromise=require(_0xd407('0x3'));var rp=require(_0xd407('0x4'));var fs=require('fs');var path=require(_0xd407('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xd407('0x6')]=function(_0x11be10,_0x4833a5){return _0x11be10['define'](_0xd407('0x7'),attributes,{'tableName':_0xd407('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd407('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3289d1f..08da3d7 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 _0x556a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x46a7b2,_0x3fb9ed){var _0x4ff6e6=function(_0x4ceba4){while(--_0x4ceba4){_0x46a7b2['push'](_0x46a7b2['shift']());}};_0x4ff6e6(++_0x3fb9ed);}(_0x556a,0x1dd));var _0xa556=function(_0x4f2aad,_0x46faac){_0x4f2aad=_0x4f2aad-0x0;var _0x296ac8=_0x556a[_0x4f2aad];return _0x296ac8;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rs=require(_0xa556('0x4'));var fs=require('fs');var Redis=require(_0xa556('0x5'));var db=require(_0xa556('0x6'))['db'];var utils=require(_0xa556('0x7'));var logger=require(_0xa556('0x8'))('rpc');var config=require(_0xa556('0x9'));var jayson=require(_0xa556('0xa'));var client=jayson[_0xa556('0xb')][_0xa556('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358b8c,_0x5a745c,_0x2c9a0c){return new BPromise(function(_0x644538,_0x17c2c2){return client[_0xa556('0xd')](_0x358b8c,_0x2c9a0c)['then'](function(_0x44ea8e){logger[_0xa556('0xe')](_0xa556('0xf'),_0x5a745c,_0xa556('0x10'));logger[_0xa556('0x11')](_0xa556('0x12'),_0x5a745c,_0xa556('0x10'),JSON[_0xa556('0x13')](_0x44ea8e));if(_0x44ea8e['error']){if(_0x44ea8e[_0xa556('0x14')]['code']===0x1f4){logger[_0xa556('0x14')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x44ea8e['error'][_0xa556('0x15')]);return _0x17c2c2(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}logger[_0xa556('0x14')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);return _0x644538(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}else{logger[_0xa556('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5a745c,'request\x20sent');_0x644538(_0x44ea8e[_0xa556('0x16')][_0xa556('0x15')]);}})['catch'](function(_0x3f8bd7){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5a745c,_0x3f8bd7);_0x17c2c2(_0x3f8bd7);});});} \ No newline at end of file +var _0x46c1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x1aae9e,_0x4d603c){var _0x45cae5=function(_0x2f2548){while(--_0x2f2548){_0x1aae9e['push'](_0x1aae9e['shift']());}};_0x45cae5(++_0x4d603c);}(_0x46c1,0x7c));var _0x146c=function(_0x2220f5,_0x304508){_0x2220f5=_0x2220f5-0x0;var _0x161423=_0x46c1[_0x2220f5];return _0x161423;};'use strict';var _=require('lodash');var util=require(_0x146c('0x0'));var moment=require(_0x146c('0x1'));var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require(_0x146c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e394f,_0x226480,_0x3bccd4){return new BPromise(function(_0x54f99b,_0x36a8c2){return client['request'](_0x2e394f,_0x3bccd4)[_0x146c('0xa')](function(_0x2c8c0a){logger['info'](_0x146c('0xb'),_0x226480,_0x146c('0xc'));logger[_0x146c('0xd')](_0x146c('0xe'),_0x226480,'request\x20sent',JSON[_0x146c('0xf')](_0x2c8c0a));if(_0x2c8c0a['error']){if(_0x2c8c0a[_0x146c('0x10')][_0x146c('0x11')]===0x1f4){logger[_0x146c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x226480,_0x2c8c0a[_0x146c('0x10')]['message']);return _0x36a8c2(_0x2c8c0a[_0x146c('0x10')]['message']);}logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x2c8c0a[_0x146c('0x10')][_0x146c('0x12')]);return _0x54f99b(_0x2c8c0a['error'][_0x146c('0x12')]);}else{logger[_0x146c('0x13')]('SmsApplication,\x20%s,\x20%s',_0x226480,_0x146c('0xc'));_0x54f99b(_0x2c8c0a['result']['message']);}})[_0x146c('0x14')](function(_0x512ac8){logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x512ac8);_0x36a8c2(_0x512ac8);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index bd1ea32..15567ec 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 _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x59178d,_0x43efe1){var _0x162c0c=function(_0x5b11d2){while(--_0x5b11d2){_0x59178d['push'](_0x59178d['shift']());}};_0x162c0c(++_0x43efe1);}(_0x6324,0x142));var _0x4632=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0x6324[_0x1a2ef3];return _0x34f4a4;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file +var _0xb688=['destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb688,0xcf));var _0x8b68=function(_0x37b426,_0x3463f5){_0x37b426=_0x37b426-0x0;var _0x14fcd8=_0xb688[_0x37b426];return _0x14fcd8;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x14')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x16')]);router[_0x8b68('0x14')]('/:id/tags',auth[_0x8b68('0xc')](),interaction['tracked']('sms',_0x8b68('0x17')),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x8b68('0x1a')]('sms',_0x8b68('0x1b')),controller[_0x8b68('0x1c')]);router[_0x8b68('0x1d')](_0x8b68('0xe'),auth['isAuthenticated'](),interaction[_0x8b68('0x1a')](_0x8b68('0x1e'),'smsinteraction:destroy'),controller[_0x8b68('0x1f')]);router[_0x8b68('0x1d')](_0x8b68('0x20'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6329f64..019a469 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 _0x1867=['moment','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x1867,0xb5));var _0x7186=function(_0x339876,_0x2abd00){_0x339876=_0x339876-0x0;var _0x374ffb=_0x1867[_0x339876];return _0x374ffb;};'use strict';var Sequelize=require(_0x7186('0x0'));var moment=require(_0x7186('0x1'));module['exports']={'closed':{'type':Sequelize[_0x7186('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7186('0x3')]},'secondDisposition':{'type':Sequelize[_0x7186('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7186('0x3')]},'note':{'type':Sequelize[_0x7186('0x3')]},'phone':{'type':Sequelize[_0x7186('0x3')]},'read1stAt':{'type':Sequelize[_0x7186('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7186('0x5')]('in',_0x7186('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7186('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7186('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7186('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3d45=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment'];(function(_0x33b178,_0x330503){var _0x6f4ced=function(_0x42153a){while(--_0x42153a){_0x33b178['push'](_0x33b178['shift']());}};_0x6f4ced(++_0x330503);}(_0x3d45,0x1d2));var _0x53d4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x3d45[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x53d4('0x0'));var moment=require(_0x53d4('0x1'));module[_0x53d4('0x2')]={'closed':{'type':Sequelize[_0x53d4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53d4('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x53d4('0x5')]},'thirdDisposition':{'type':Sequelize[_0x53d4('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x53d4('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x53d4('0x6')]('in',_0x53d4('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x53d4('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x53d4('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ad208e5..1b5270c 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 _0x09f3=['type','key','findAll','sms','user','show','keys','query','intersection','model','attributes','fields','include','merge','options','catch','create','update','body','params','SmsInteraction','find','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','pick','SmsInteractionId','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','server','files','transcript-%d-%s.zip','join','User','fullname','push','Contact','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','out','System','firstName','lastName','value','renderFile','root','views','transcript-','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','stack','name','send','map','rawAttributes'];(function(_0x2bcd42,_0x946248){var _0x34d7fd=function(_0x5e3413){while(--_0x5e3413){_0x2bcd42['push'](_0x2bcd42['shift']());}};_0x34d7fd(++_0x946248);}(_0x09f3,0x1c5));var _0x309f=function(_0x455555,_0x2147fd){_0x455555=_0x455555-0x0;var _0x3cb183=_0x09f3[_0x455555];return _0x3cb183;};'use strict';var rimraf=require(_0x309f('0x0'));var zipdir=require(_0x309f('0x1'));var moment=require(_0x309f('0x2'));var BPromise=require(_0x309f('0x3'));var util=require(_0x309f('0x4'));var path=require(_0x309f('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x309f('0x6'));var Redis=require('ioredis');var interaction=require(_0x309f('0x7'));var qs=require(_0x309f('0x8'));var pdf=require(_0x309f('0x9'));var logger=require(_0x309f('0xa'))(_0x309f('0xb'));var config=require(_0x309f('0xc'));var db=require(_0x309f('0xd'))['db'];config['redis']=_[_0x309f('0xe')](config[_0x309f('0xf')],{'host':_0x309f('0x10'),'port':0x18eb});var socket=require(_0x309f('0x11'))(new Redis(config[_0x309f('0xf')]));require('./smsInteraction.socket')[_0x309f('0x12')](socket);function respondWithStatusCode(_0x246e07,_0x1a5dcc){_0x1a5dcc=_0x1a5dcc||0xcc;return function(_0x4e3915){if(_0x4e3915){return _0x246e07['sendStatus'](_0x1a5dcc);}return _0x246e07[_0x309f('0x13')](_0x1a5dcc)['end']();};}function respondWithResult(_0x4b3d39,_0x2def3c){_0x2def3c=_0x2def3c||0xc8;return function(_0x23795a){if(_0x23795a){return _0x4b3d39[_0x309f('0x13')](_0x2def3c)[_0x309f('0x14')](_0x23795a);}};}function respondWithFilteredResult(_0x1c6c3b,_0xb58aa4){return function(_0x162274){if(_0x162274){var _0x3f01e6=typeof _0xb58aa4[_0x309f('0x15')]===_0x309f('0x16')&&typeof _0xb58aa4[_0x309f('0x17')]==='undefined';var _0x5a9ca4=_0x162274[_0x309f('0x18')];var _0x4ee5da=_0x3f01e6?0x0:_0xb58aa4[_0x309f('0x15')];var _0xe7817c=_0x3f01e6?_0x162274['count']:_0xb58aa4[_0x309f('0x15')]+_0xb58aa4[_0x309f('0x17')];var _0x4817c4;if(_0xe7817c>=_0x5a9ca4){_0xe7817c=_0x5a9ca4;_0x4817c4=0xc8;}else{_0x4817c4=0xce;}_0x1c6c3b[_0x309f('0x13')](_0x4817c4);return _0x1c6c3b[_0x309f('0x19')](_0x309f('0x1a'),_0x4ee5da+'-'+_0xe7817c+'/'+_0x5a9ca4)[_0x309f('0x14')](_0x162274);}return null;};}function saveUpdates(_0x1233b3){return function(_0x4676b3){if(_0x4676b3){return _0x4676b3['update'](_0x1233b3)['then'](function(_0x593e65){return _0x593e65;});}return null;};}function removeEntity(_0x5aa51c){return function(_0x30b551){if(_0x30b551){return _0x30b551[_0x309f('0x1b')]()[_0x309f('0x1c')](function(){_0x5aa51c[_0x309f('0x13')](0xcc)[_0x309f('0x1d')]();});}};}function handleEntityNotFound(_0x32de93){return function(_0x212e6e){if(!_0x212e6e){_0x32de93['sendStatus'](0x194);}return _0x212e6e;};}function handleError(_0x52cb35,_0x1049a4){_0x1049a4=_0x1049a4||0x1f4;return function(_0x57716f){logger['error'](_0x57716f[_0x309f('0x1e')]);if(_0x57716f[_0x309f('0x1f')]){delete _0x57716f[_0x309f('0x1f')];}_0x52cb35['status'](_0x1049a4)[_0x309f('0x20')](_0x57716f);};}exports['index']=function(_0x40d1aa,_0x2fc570){var _0xe8c0d0={};var _0x59bb84=_[_0x309f('0x21')](db['SmsInteraction'][_0x309f('0x22')],function(_0x5dd63f){return{'name':_0x5dd63f['fieldName'],'type':_0x5dd63f[_0x309f('0x23')][_0x309f('0x24')]};});_0xe8c0d0=qs['getOptions'](_0x59bb84,_0x40d1aa);return interaction[_0x309f('0x25')](_0x309f('0x26'),_0x40d1aa['query'],_0x40d1aa[_0x309f('0x27')],_0xe8c0d0,_0x59bb84)[_0x309f('0x1c')](respondWithFilteredResult(_0x2fc570,_0xe8c0d0))['catch'](handleError(_0x2fc570,null));};exports[_0x309f('0x28')]=function(_0x12806a,_0x1cd5de){var _0x56cd95={'raw':![],'where':{'id':_0x12806a['params']['id']}},_0x996029={};_0x996029['model']=_[_0x309f('0x29')](db['SmsInteraction'][_0x309f('0x22')]);_0x996029['query']=_[_0x309f('0x29')](_0x12806a[_0x309f('0x2a')]);_0x996029['filters']=_[_0x309f('0x2b')](_0x996029[_0x309f('0x2c')],_0x996029[_0x309f('0x2a')]);_0x56cd95[_0x309f('0x2d')]=_[_0x309f('0x2b')](_0x996029[_0x309f('0x2c')],qs[_0x309f('0x2e')](_0x12806a[_0x309f('0x2a')][_0x309f('0x2e')]));_0x56cd95[_0x309f('0x2d')]=_0x56cd95[_0x309f('0x2d')]['length']?_0x56cd95[_0x309f('0x2d')]:_0x996029[_0x309f('0x2c')];if(_0x12806a[_0x309f('0x2a')]['includeAll']){_0x56cd95[_0x309f('0x2f')]=[{'all':!![]}];}_0x56cd95=_[_0x309f('0x30')]({},_0x56cd95,_0x12806a[_0x309f('0x31')]);return db['SmsInteraction']['find'](_0x56cd95)[_0x309f('0x1c')](handleEntityNotFound(_0x1cd5de,null))[_0x309f('0x1c')](respondWithResult(_0x1cd5de,null))[_0x309f('0x32')](handleError(_0x1cd5de,null));};exports[_0x309f('0x33')]=function(_0x40d4bd,_0x554c53){return db['SmsInteraction'][_0x309f('0x33')](_0x40d4bd['body'],{})[_0x309f('0x1c')](respondWithResult(_0x554c53,0xc9))['catch'](handleError(_0x554c53,null));};exports[_0x309f('0x34')]=function(_0x59bfda,_0x42c391){if(_0x59bfda[_0x309f('0x35')]['id']){delete _0x59bfda[_0x309f('0x35')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x59bfda[_0x309f('0x36')]['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x42c391,null))['then'](saveUpdates(_0x59bfda[_0x309f('0x35')],null))[_0x309f('0x1c')](respondWithResult(_0x42c391,null))[_0x309f('0x32')](handleError(_0x42c391,null));};exports['destroy']=function(_0x1e8110,_0x20498a){return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x1e8110['params']['id']}})['then'](handleEntityNotFound(_0x20498a,null))[_0x309f('0x1c')](removeEntity(_0x20498a,null))['catch'](handleError(_0x20498a,null));};exports['describe']=function(_0x1ef63a,_0x5b14f7){return db[_0x309f('0x37')]['describe']()[_0x309f('0x1c')](respondWithResult(_0x5b14f7,null))['catch'](handleError(_0x5b14f7,null));};exports[_0x309f('0x39')]=function(_0x4aa6b7,_0x238d95){return db[_0x309f('0x3a')][_0x309f('0x38')]({'where':{'id':_0x4aa6b7['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x238d95,null))['then'](function(_0x26a3ee){if(_0x26a3ee){return _0x26a3ee[_0x309f('0x39')](_0x4aa6b7['body'][_0x309f('0x3b')],_[_0x309f('0x3c')](_0x4aa6b7[_0x309f('0x35')],[_0x309f('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x238d95,null))[_0x309f('0x32')](handleError(_0x238d95,null));};exports[_0x309f('0x3d')]=function(_0x1e8a9b,_0x41b598){var _0x51b006={'raw':![],'where':{}};var _0x2453af={};var _0x31f2ef={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x309f('0x3e')]({'where':{'id':_0x1e8a9b['params']['id']}})['then'](handleEntityNotFound(_0x41b598,null))[_0x309f('0x1c')](function(_0x2d3b11){if(_0x2d3b11){_0x2453af[_0x309f('0x2c')]=_[_0x309f('0x29')](db[_0x309f('0x3a')][_0x309f('0x22')]);_0x2453af['query']=_['keys'](_0x1e8a9b[_0x309f('0x2a')]);_0x2453af[_0x309f('0x3f')]=_['intersection'](_0x2453af[_0x309f('0x2c')],_0x2453af['query']);_0x51b006[_0x309f('0x2d')]=_['intersection'](_0x2453af[_0x309f('0x2c')],qs[_0x309f('0x2e')](_0x1e8a9b[_0x309f('0x2a')]['fields']));_0x51b006[_0x309f('0x2d')]=_0x51b006[_0x309f('0x2d')][_0x309f('0x40')]?_0x51b006['attributes']:_0x2453af['model'];if(!_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x41')](_0x309f('0x42'))){_0x51b006['limit']=qs[_0x309f('0x17')](_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x17')]);_0x51b006[_0x309f('0x15')]=qs[_0x309f('0x15')](_0x1e8a9b[_0x309f('0x2a')]['offset']);}_0x51b006[_0x309f('0x43')]=qs[_0x309f('0x44')](_0x1e8a9b['query'][_0x309f('0x44')]);_0x51b006['where']=qs[_0x309f('0x3f')](_[_0x309f('0x45')](_0x1e8a9b[_0x309f('0x2a')],_0x2453af[_0x309f('0x3f')]));_0x51b006['where'][_0x309f('0x46')]=_0x2d3b11['id'];if(_0x1e8a9b[_0x309f('0x2a')]['filter']){_0x51b006[_0x309f('0x47')]=_[_0x309f('0x30')](_0x51b006['where'],{'$or':_[_0x309f('0x21')](_0x51b006[_0x309f('0x2d')],function(_0x3a5e0a){var _0x11f529={};_0x11f529[_0x3a5e0a]={'$like':'%'+_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x48')]+'%'};return _0x11f529;})});}if(_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x49')]){var _0x1974c6=_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x49')][_0x309f('0x4a')](',');var _0x497e8c={};_0x497e8c[_0x1974c6[0x0]]={'$gte':moment(_0x1974c6[0x1])[_0x309f('0x4b')](_0x309f('0x4c'))};_0x51b006['where']=_[_0x309f('0x30')](_0x51b006[_0x309f('0x47')],_0x497e8c);}_0x51b006=_[_0x309f('0x30')]({},_0x51b006,_0x1e8a9b[_0x309f('0x31')]);return db['SmsMessage'][_0x309f('0x18')]({'where':_0x51b006[_0x309f('0x47')]})[_0x309f('0x1c')](function(_0x95f302){_0x31f2ef['count']=_0x95f302;if(_0x1e8a9b[_0x309f('0x2a')][_0x309f('0x4d')]){_0x51b006[_0x309f('0x2f')]=[{'all':!![]}];}return db['SmsMessage'][_0x309f('0x25')](_0x51b006);})[_0x309f('0x1c')](function(_0x1e84f6){_0x31f2ef['rows']=_0x1e84f6;return _0x31f2ef;});}})[_0x309f('0x1c')](respondWithFilteredResult(_0x41b598,_0x51b006))[_0x309f('0x32')](handleError(_0x41b598,null));};exports[_0x309f('0x4e')]=function(_0x190cfb,_0x418856){return db[_0x309f('0x37')]['find']({'where':{'id':_0x190cfb['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x418856,null))['then'](function(_0x6e2ec4){if(_0x6e2ec4){return _0x6e2ec4[_0x309f('0x4f')](_0x190cfb['body'][_0x309f('0x3b')],_[_0x309f('0x3c')](_0x190cfb[_0x309f('0x35')],['ids','id'])||{})['spread'](function(){return db[_0x309f('0x50')][_0x309f('0x25')]({'attributes':['id',_0x309f('0x1f'),_0x309f('0x51')],'where':{'id':_0x190cfb[_0x309f('0x35')]['ids']}});})[_0x309f('0x1c')](function(_0x50a565){socket['emit'](_0x309f('0x52'),{'id':Number(_0x190cfb['params']['id']),'tags':_0x50a565||[]});return{'id':Number(_0x190cfb[_0x309f('0x36')]['id']),'tags':_0x50a565||[]};});}})[_0x309f('0x1c')](respondWithResult(_0x418856,null))[_0x309f('0x32')](handleError(_0x418856,null));};exports[_0x309f('0x53')]=function(_0x4c24d2,_0x3d56ad){return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x4c24d2['params']['id']}})[_0x309f('0x1c')](handleEntityNotFound(_0x3d56ad,null))['then'](function(_0x1ad5a0){if(_0x1ad5a0){return _0x1ad5a0[_0x309f('0x53')](_0x4c24d2[_0x309f('0x2a')]['ids']);}})['then'](respondWithStatusCode(_0x3d56ad,null))[_0x309f('0x32')](handleError(_0x3d56ad,null));};exports[_0x309f('0x54')]=function(_0x5a1d93,_0x3273ae){var _0xb1c894=moment()[_0x309f('0x55')]()[_0x309f('0x56')]();var _0x44b4e2=path['join'](config['root'],_0x309f('0x57'),_0x309f('0x58'),'tmp');var _0x34b624=path['join'](_0x44b4e2,_0xb1c894);var _0x1543a8=util['format'](_0x309f('0x59'),_0x5a1d93['params']['id'],_0xb1c894);var _0x27142a=path[_0x309f('0x5a')](_0x44b4e2,_0x1543a8);var _0x5a519c=[];_0x5a519c['push']({'model':db[_0x309f('0x5b')],'as':_0x309f('0x5b'),'attributes':['id',_0x309f('0x5c')],'raw':!![]});_0x5a519c[_0x309f('0x5d')]({'model':db['CmContact'],'as':_0x309f('0x5e'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x4ea683=[{'model':db[_0x309f('0x3a')],'as':'Messages','attributes':['id',_0x309f('0x35'),_0x309f('0x5f'),_0x309f('0x60'),_0x309f('0x61'),_0x309f('0x62')],'include':_0x5a519c}];_0x4ea683[_0x309f('0x5d')]({'model':db[_0x309f('0x63')],'as':_0x309f('0x64'),'attributes':['id',_0x309f('0x1f')]});_0x4ea683[_0x309f('0x5d')]({'model':db[_0x309f('0x5b')],'as':_0x309f('0x65'),'attributes':['id',_0x309f('0x5c')]});return db[_0x309f('0x37')][_0x309f('0x38')]({'where':{'id':_0x5a1d93[_0x309f('0x36')]['id']},'include':_0x4ea683})[_0x309f('0x1c')](handleEntityNotFound(_0x3273ae,null))[_0x309f('0x1c')](function(_0x4ca847){if(_0x4ca847){var _0xbda934=_0x4ca847[_0x309f('0x66')]({'plain':!![]});fs[_0x309f('0x67')](_0x34b624);var _0x5b07b9={'channel':_0x309f('0x68'),'account':_0xbda934['Account'][_0x309f('0x1f')],'agent':_0xbda934['Owner']?_0xbda934['Owner'][_0x309f('0x5c')]:_0x309f('0x69'),'createdAt':moment(_0xbda934[_0x309f('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x309f('0x56')](),'closedAt':_0xbda934[_0x309f('0x6a')]?moment(_0xbda934[_0x309f('0x6b')])[_0x309f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x309f('0x56')]():'','disposition':_0xbda934[_0x309f('0x6c')],'messages':_(_0xbda934[_0x309f('0x6d')])[_0x309f('0x48')]({'secret':![]})[_0x309f('0x21')](function(_0x53af10){return{'date':moment(_0x53af10[_0x309f('0x5f')])['format'](_0x309f('0x4c'))[_0x309f('0x56')](),'sender':_0x53af10[_0x309f('0x60')]===_0x309f('0x6e')?_0x53af10[_0x309f('0x5b')]?_0x53af10[_0x309f('0x5b')][_0x309f('0x5c')]:_0x309f('0x6f'):_0x53af10['Contact'][_0x309f('0x70')]+(_0x53af10[_0x309f('0x5e')][_0x309f('0x71')]?'\x20'+_0x53af10[_0x309f('0x5e')][_0x309f('0x71')]:''),'body':_0x53af10[_0x309f('0x35')],'direction':_0x53af10['direction']==='out'?'A':'C','secret':_0x53af10[_0x309f('0x61')],'read':_0x53af10[_0x309f('0x62')]};})[_0x309f('0x72')]()};return ejs[_0x309f('0x73')](path[_0x309f('0x5a')](config[_0x309f('0x74')],'server',_0x309f('0x75'),'downloadInteraction.ejs'),{'interaction':_0x5b07b9})[_0x309f('0x1c')](function(_0x4f3558){var _0xfc2408=path['join'](_0x34b624,_0x309f('0x76')+_0xbda934['id']+'-'+_0xb1c894+'.pdf');var _0x5d623c={'path':_0xfc2408,'channel':_0x309f('0x68'),'interactionId':_0xbda934['id']};return pdf[_0x309f('0x77')](_0x4f3558,_0x5d623c);})['then'](function(){return new BPromise(function(_0x4c3472,_0x4fcc98){zipdir(_0x34b624,{'saveTo':_0x27142a},function(_0x2920d1,_0x53ed99){if(_0x2920d1)return _0x4fcc98(_0x2920d1);return _0x4c3472(_0x53ed99);});})[_0x309f('0x1c')](function(){return new BPromise(function(_0x1f2a2c,_0x22cca7){rimraf(_0x34b624,function(_0xc0a970){if(_0xc0a970)_0x22cca7(_0xc0a970);return _0x1f2a2c();});});})[_0x309f('0x1c')](function(){return _0x3273ae[_0x309f('0x54')](_0x27142a,_0x1543a8,function(_0x587b76){if(_0x587b76){console[_0x309f('0x78')]('err',_0x587b76);}else{fs[_0x309f('0x79')](_0x27142a);}});});});}else{return _0x3273ae['sendStatus'](0xc8);}})[_0x309f('0x32')](handleError(_0x3273ae,null));}; \ No newline at end of file +var _0xf3c0=['transcript-','.pdf','Sms','createPdfFromHTML','log','unlinkSync','rimraf','moment','bluebird','ejs','lodash','../../components/interaction/service','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','count','limit','then','error','stack','name','send','index','map','rawAttributes','type','getOptions','findAll','sms','user','catch','show','params','model','keys','SmsInteraction','query','intersection','attributes','length','includeAll','include','options','find','create','body','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','filters','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','merge','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','value','renderFile','root','server'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf3c0,0x77));var _0x0f3c=function(_0x244274,_0x3a1e43){_0x244274=_0x244274-0x0;var _0x1ba0d2=_0xf3c0[_0x244274];return _0x1ba0d2;};'use strict';var rimraf=require(_0x0f3c('0x0'));var zipdir=require('zip-dir');var moment=require(_0x0f3c('0x1'));var BPromise=require(_0x0f3c('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x0f3c('0x3'));var fs=require('fs');var _=require(_0x0f3c('0x4'));var Redis=require('ioredis');var interaction=require(_0x0f3c('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0f3c('0x6'));var logger=require('../../config/logger')(_0x0f3c('0x7'));var config=require('../../config/environment');var db=require(_0x0f3c('0x8'))['db'];config[_0x0f3c('0x9')]=_[_0x0f3c('0xa')](config[_0x0f3c('0x9')],{'host':_0x0f3c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f3c('0x9')]));require('./smsInteraction.socket')[_0x0f3c('0xc')](socket);function respondWithStatusCode(_0x54ee3a,_0x42f79){_0x42f79=_0x42f79||0xcc;return function(_0x486d4a){if(_0x486d4a){return _0x54ee3a[_0x0f3c('0xd')](_0x42f79);}return _0x54ee3a[_0x0f3c('0xe')](_0x42f79)['end']();};}function respondWithResult(_0x3cd101,_0x581e5f){_0x581e5f=_0x581e5f||0xc8;return function(_0xcbd351){if(_0xcbd351){return _0x3cd101[_0x0f3c('0xe')](_0x581e5f)[_0x0f3c('0xf')](_0xcbd351);}};}function respondWithFilteredResult(_0x50b4cc,_0x2d8907){return function(_0x30fd6e){if(_0x30fd6e){var _0x5292b4=typeof _0x2d8907[_0x0f3c('0x10')]===_0x0f3c('0x11')&&typeof _0x2d8907['limit']==='undefined';var _0x192b0e=_0x30fd6e['count'];var _0x23f1d1=_0x5292b4?0x0:_0x2d8907['offset'];var _0x299a1e=_0x5292b4?_0x30fd6e[_0x0f3c('0x12')]:_0x2d8907['offset']+_0x2d8907[_0x0f3c('0x13')];var _0x308816;if(_0x299a1e>=_0x192b0e){_0x299a1e=_0x192b0e;_0x308816=0xc8;}else{_0x308816=0xce;}_0x50b4cc[_0x0f3c('0xe')](_0x308816);return _0x50b4cc['set']('Content-Range',_0x23f1d1+'-'+_0x299a1e+'/'+_0x192b0e)[_0x0f3c('0xf')](_0x30fd6e);}return null;};}function saveUpdates(_0x1511ff){return function(_0x3214ad){if(_0x3214ad){return _0x3214ad['update'](_0x1511ff)['then'](function(_0x43e621){return _0x43e621;});}return null;};}function removeEntity(_0x410d88){return function(_0x5781df){if(_0x5781df){return _0x5781df['destroy']()[_0x0f3c('0x14')](function(){_0x410d88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x264866){return function(_0x56a987){if(!_0x56a987){_0x264866[_0x0f3c('0xd')](0x194);}return _0x56a987;};}function handleError(_0x1964e7,_0x4ea178){_0x4ea178=_0x4ea178||0x1f4;return function(_0x5859fb){logger[_0x0f3c('0x15')](_0x5859fb[_0x0f3c('0x16')]);if(_0x5859fb[_0x0f3c('0x17')]){delete _0x5859fb[_0x0f3c('0x17')];}_0x1964e7[_0x0f3c('0xe')](_0x4ea178)[_0x0f3c('0x18')](_0x5859fb);};}exports[_0x0f3c('0x19')]=function(_0x4aec59,_0x18f1af){var _0x43e81e={};var _0x140ce9=_[_0x0f3c('0x1a')](db['SmsInteraction'][_0x0f3c('0x1b')],function(_0x570ec8){return{'name':_0x570ec8['fieldName'],'type':_0x570ec8[_0x0f3c('0x1c')]['key']};});_0x43e81e=qs[_0x0f3c('0x1d')](_0x140ce9,_0x4aec59);return interaction[_0x0f3c('0x1e')](_0x0f3c('0x1f'),_0x4aec59['query'],_0x4aec59[_0x0f3c('0x20')],_0x43e81e,_0x140ce9)[_0x0f3c('0x14')](respondWithFilteredResult(_0x18f1af,_0x43e81e))[_0x0f3c('0x21')](handleError(_0x18f1af,null));};exports[_0x0f3c('0x22')]=function(_0x27aa34,_0x335a84){var _0xd26b15={'raw':![],'where':{'id':_0x27aa34[_0x0f3c('0x23')]['id']}},_0x2d9195={};_0x2d9195[_0x0f3c('0x24')]=_[_0x0f3c('0x25')](db[_0x0f3c('0x26')][_0x0f3c('0x1b')]);_0x2d9195[_0x0f3c('0x27')]=_[_0x0f3c('0x25')](_0x27aa34['query']);_0x2d9195['filters']=_[_0x0f3c('0x28')](_0x2d9195[_0x0f3c('0x24')],_0x2d9195['query']);_0xd26b15[_0x0f3c('0x29')]=_[_0x0f3c('0x28')](_0x2d9195[_0x0f3c('0x24')],qs['fields'](_0x27aa34[_0x0f3c('0x27')]['fields']));_0xd26b15[_0x0f3c('0x29')]=_0xd26b15[_0x0f3c('0x29')][_0x0f3c('0x2a')]?_0xd26b15['attributes']:_0x2d9195[_0x0f3c('0x24')];if(_0x27aa34[_0x0f3c('0x27')][_0x0f3c('0x2b')]){_0xd26b15[_0x0f3c('0x2c')]=[{'all':!![]}];}_0xd26b15=_['merge']({},_0xd26b15,_0x27aa34[_0x0f3c('0x2d')]);return db[_0x0f3c('0x26')][_0x0f3c('0x2e')](_0xd26b15)[_0x0f3c('0x14')](handleEntityNotFound(_0x335a84,null))[_0x0f3c('0x14')](respondWithResult(_0x335a84,null))['catch'](handleError(_0x335a84,null));};exports[_0x0f3c('0x2f')]=function(_0x3d9a7f,_0x3c5748){return db['SmsInteraction']['create'](_0x3d9a7f['body'],{})[_0x0f3c('0x14')](respondWithResult(_0x3c5748,0xc9))[_0x0f3c('0x21')](handleError(_0x3c5748,null));};exports['update']=function(_0x17a175,_0xff7b87){if(_0x17a175[_0x0f3c('0x30')]['id']){delete _0x17a175[_0x0f3c('0x30')]['id'];}return db[_0x0f3c('0x26')]['find']({'where':{'id':_0x17a175[_0x0f3c('0x23')]['id']}})[_0x0f3c('0x14')](handleEntityNotFound(_0xff7b87,null))[_0x0f3c('0x14')](saveUpdates(_0x17a175[_0x0f3c('0x30')],null))['then'](respondWithResult(_0xff7b87,null))[_0x0f3c('0x21')](handleError(_0xff7b87,null));};exports[_0x0f3c('0x31')]=function(_0x47642f,_0x1b6b64){return db['SmsInteraction'][_0x0f3c('0x2e')]({'where':{'id':_0x47642f[_0x0f3c('0x23')]['id']}})[_0x0f3c('0x14')](handleEntityNotFound(_0x1b6b64,null))[_0x0f3c('0x14')](removeEntity(_0x1b6b64,null))[_0x0f3c('0x21')](handleError(_0x1b6b64,null));};exports[_0x0f3c('0x32')]=function(_0x1ff6e4,_0xcbd746){return db['SmsInteraction'][_0x0f3c('0x32')]()[_0x0f3c('0x14')](respondWithResult(_0xcbd746,null))[_0x0f3c('0x21')](handleError(_0xcbd746,null));};exports[_0x0f3c('0x33')]=function(_0x2b840a,_0x44e216){return db[_0x0f3c('0x34')][_0x0f3c('0x2e')]({'where':{'id':_0x2b840a[_0x0f3c('0x23')]['id']}})[_0x0f3c('0x14')](handleEntityNotFound(_0x44e216,null))[_0x0f3c('0x14')](function(_0x2af20f){if(_0x2af20f){return _0x2af20f[_0x0f3c('0x33')](_0x2b840a[_0x0f3c('0x30')][_0x0f3c('0x35')],_[_0x0f3c('0x36')](_0x2b840a['body'],[_0x0f3c('0x35'),'id'])||{});}})[_0x0f3c('0x14')](respondWithResult(_0x44e216,null))['catch'](handleError(_0x44e216,null));};exports[_0x0f3c('0x37')]=function(_0x2f5ad4,_0x4ed038){var _0x2d304c={'raw':![],'where':{}};var _0x1c846a={};var _0x527d66={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x2f5ad4[_0x0f3c('0x23')]['id']}})[_0x0f3c('0x14')](handleEntityNotFound(_0x4ed038,null))[_0x0f3c('0x14')](function(_0x25e2b7){if(_0x25e2b7){_0x1c846a[_0x0f3c('0x24')]=_[_0x0f3c('0x25')](db[_0x0f3c('0x34')][_0x0f3c('0x1b')]);_0x1c846a[_0x0f3c('0x27')]=_['keys'](_0x2f5ad4['query']);_0x1c846a[_0x0f3c('0x38')]=_['intersection'](_0x1c846a[_0x0f3c('0x24')],_0x1c846a[_0x0f3c('0x27')]);_0x2d304c['attributes']=_[_0x0f3c('0x28')](_0x1c846a['model'],qs[_0x0f3c('0x39')](_0x2f5ad4['query'][_0x0f3c('0x39')]));_0x2d304c['attributes']=_0x2d304c[_0x0f3c('0x29')]['length']?_0x2d304c['attributes']:_0x1c846a[_0x0f3c('0x24')];if(!_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x3a')](_0x0f3c('0x3b'))){_0x2d304c[_0x0f3c('0x13')]=qs[_0x0f3c('0x13')](_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x13')]);_0x2d304c[_0x0f3c('0x10')]=qs[_0x0f3c('0x10')](_0x2f5ad4['query'][_0x0f3c('0x10')]);}_0x2d304c[_0x0f3c('0x3c')]=qs['sort'](_0x2f5ad4['query'][_0x0f3c('0x3d')]);_0x2d304c[_0x0f3c('0x3e')]=qs[_0x0f3c('0x38')](_[_0x0f3c('0x3f')](_0x2f5ad4['query'],_0x1c846a['filters']));_0x2d304c[_0x0f3c('0x3e')]['SmsInteractionId']=_0x25e2b7['id'];if(_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x40')]){_0x2d304c[_0x0f3c('0x3e')]=_['merge'](_0x2d304c[_0x0f3c('0x3e')],{'$or':_[_0x0f3c('0x1a')](_0x2d304c[_0x0f3c('0x29')],function(_0x4010f8){var _0x3b38ce={};_0x3b38ce[_0x4010f8]={'$like':'%'+_0x2f5ad4['query'][_0x0f3c('0x40')]+'%'};return _0x3b38ce;})});}if(_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x41')]){var _0x51a7ce=_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x41')]['split'](',');var _0x49e94e={};_0x49e94e[_0x51a7ce[0x0]]={'$gte':moment(_0x51a7ce[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2d304c[_0x0f3c('0x3e')]=_[_0x0f3c('0x42')](_0x2d304c['where'],_0x49e94e);}_0x2d304c=_[_0x0f3c('0x42')]({},_0x2d304c,_0x2f5ad4[_0x0f3c('0x2d')]);return db['SmsMessage'][_0x0f3c('0x12')]({'where':_0x2d304c[_0x0f3c('0x3e')]})[_0x0f3c('0x14')](function(_0x65a946){_0x527d66[_0x0f3c('0x12')]=_0x65a946;if(_0x2f5ad4[_0x0f3c('0x27')][_0x0f3c('0x2b')]){_0x2d304c[_0x0f3c('0x2c')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2d304c);})['then'](function(_0x35d636){_0x527d66['rows']=_0x35d636;return _0x527d66;});}})['then'](respondWithFilteredResult(_0x4ed038,_0x2d304c))['catch'](handleError(_0x4ed038,null));};exports[_0x0f3c('0x43')]=function(_0x4bf2ba,_0x4d9fa7){return db[_0x0f3c('0x26')][_0x0f3c('0x2e')]({'where':{'id':_0x4bf2ba[_0x0f3c('0x23')]['id']}})['then'](handleEntityNotFound(_0x4d9fa7,null))[_0x0f3c('0x14')](function(_0x34f285){if(_0x34f285){return _0x34f285[_0x0f3c('0x44')](_0x4bf2ba[_0x0f3c('0x30')][_0x0f3c('0x35')],_[_0x0f3c('0x36')](_0x4bf2ba[_0x0f3c('0x30')],[_0x0f3c('0x35'),'id'])||{})[_0x0f3c('0x45')](function(){return db[_0x0f3c('0x46')]['findAll']({'attributes':['id',_0x0f3c('0x17'),_0x0f3c('0x47')],'where':{'id':_0x4bf2ba[_0x0f3c('0x30')][_0x0f3c('0x35')]}});})[_0x0f3c('0x14')](function(_0x502f9b){socket[_0x0f3c('0x48')]('smsInteractionTags:save',{'id':Number(_0x4bf2ba[_0x0f3c('0x23')]['id']),'tags':_0x502f9b||[]});return{'id':Number(_0x4bf2ba[_0x0f3c('0x23')]['id']),'tags':_0x502f9b||[]};});}})['then'](respondWithResult(_0x4d9fa7,null))[_0x0f3c('0x21')](handleError(_0x4d9fa7,null));};exports[_0x0f3c('0x49')]=function(_0xe27cd3,_0x3d11e3){return db[_0x0f3c('0x26')][_0x0f3c('0x2e')]({'where':{'id':_0xe27cd3[_0x0f3c('0x23')]['id']}})[_0x0f3c('0x14')](handleEntityNotFound(_0x3d11e3,null))[_0x0f3c('0x14')](function(_0x46abf7){if(_0x46abf7){return _0x46abf7[_0x0f3c('0x49')](_0xe27cd3[_0x0f3c('0x27')][_0x0f3c('0x35')]);}})[_0x0f3c('0x14')](respondWithStatusCode(_0x3d11e3,null))[_0x0f3c('0x21')](handleError(_0x3d11e3,null));};exports[_0x0f3c('0x4a')]=function(_0x230cb1,_0x19fe54){var _0x244df0=moment()[_0x0f3c('0x4b')]()[_0x0f3c('0x4c')]();var _0x5aa5d0=path[_0x0f3c('0x4d')](config['root'],'server',_0x0f3c('0x4e'),_0x0f3c('0x4f'));var _0x31c78d=path[_0x0f3c('0x4d')](_0x5aa5d0,_0x244df0);var _0x30dcf1=util[_0x0f3c('0x50')](_0x0f3c('0x51'),_0x230cb1[_0x0f3c('0x23')]['id'],_0x244df0);var _0x1399d8=path[_0x0f3c('0x4d')](_0x5aa5d0,_0x30dcf1);var _0x8d172a=[];_0x8d172a[_0x0f3c('0x52')]({'model':db[_0x0f3c('0x53')],'as':_0x0f3c('0x53'),'attributes':['id',_0x0f3c('0x54')],'raw':!![]});_0x8d172a['push']({'model':db[_0x0f3c('0x55')],'as':_0x0f3c('0x56'),'attributes':['id',_0x0f3c('0x57'),_0x0f3c('0x58')],'raw':!![]});var _0x27073a=[{'model':db[_0x0f3c('0x34')],'as':'Messages','attributes':['id',_0x0f3c('0x30'),_0x0f3c('0x59'),_0x0f3c('0x5a'),'secret',_0x0f3c('0x5b')],'include':_0x8d172a}];_0x27073a[_0x0f3c('0x52')]({'model':db[_0x0f3c('0x5c')],'as':_0x0f3c('0x5d'),'attributes':['id',_0x0f3c('0x17')]});_0x27073a[_0x0f3c('0x52')]({'model':db[_0x0f3c('0x53')],'as':_0x0f3c('0x5e'),'attributes':['id',_0x0f3c('0x54')]});return db[_0x0f3c('0x26')][_0x0f3c('0x2e')]({'where':{'id':_0x230cb1['params']['id']},'include':_0x27073a})[_0x0f3c('0x14')](handleEntityNotFound(_0x19fe54,null))[_0x0f3c('0x14')](function(_0x550fac){if(_0x550fac){var _0x318475=_0x550fac[_0x0f3c('0x5f')]({'plain':!![]});fs[_0x0f3c('0x60')](_0x31c78d);var _0x418dcd={'channel':'Sms','account':_0x318475[_0x0f3c('0x5d')][_0x0f3c('0x17')],'agent':_0x318475[_0x0f3c('0x5e')]?_0x318475[_0x0f3c('0x5e')][_0x0f3c('0x54')]:'N.A.','createdAt':moment(_0x318475['createdAt'])[_0x0f3c('0x50')](_0x0f3c('0x61'))[_0x0f3c('0x4c')](),'closedAt':_0x318475['closed']?moment(_0x318475[_0x0f3c('0x62')])[_0x0f3c('0x50')](_0x0f3c('0x61'))[_0x0f3c('0x4c')]():'','disposition':_0x318475[_0x0f3c('0x63')],'messages':_(_0x318475[_0x0f3c('0x64')])[_0x0f3c('0x40')]({'secret':![]})[_0x0f3c('0x1a')](function(_0x4c2a20){return{'date':moment(_0x4c2a20[_0x0f3c('0x59')])['format'](_0x0f3c('0x61'))[_0x0f3c('0x4c')](),'sender':_0x4c2a20['direction']===_0x0f3c('0x65')?_0x4c2a20[_0x0f3c('0x53')]?_0x4c2a20[_0x0f3c('0x53')][_0x0f3c('0x54')]:_0x0f3c('0x66'):_0x4c2a20[_0x0f3c('0x56')][_0x0f3c('0x57')]+(_0x4c2a20['Contact'][_0x0f3c('0x58')]?'\x20'+_0x4c2a20[_0x0f3c('0x56')][_0x0f3c('0x58')]:''),'body':_0x4c2a20['body'],'direction':_0x4c2a20[_0x0f3c('0x5a')]===_0x0f3c('0x65')?'A':'C','secret':_0x4c2a20['secret'],'read':_0x4c2a20['read']};})[_0x0f3c('0x67')]()};return ejs[_0x0f3c('0x68')](path[_0x0f3c('0x4d')](config[_0x0f3c('0x69')],_0x0f3c('0x6a'),'views','downloadInteraction.ejs'),{'interaction':_0x418dcd})[_0x0f3c('0x14')](function(_0x59dd48){var _0xa9d1cf=path[_0x0f3c('0x4d')](_0x31c78d,_0x0f3c('0x6b')+_0x318475['id']+'-'+_0x244df0+_0x0f3c('0x6c'));var _0x30e4b5={'path':_0xa9d1cf,'channel':_0x0f3c('0x6d'),'interactionId':_0x318475['id']};return pdf[_0x0f3c('0x6e')](_0x59dd48,_0x30e4b5);})[_0x0f3c('0x14')](function(){return new BPromise(function(_0x2d2d5c,_0x47c538){zipdir(_0x31c78d,{'saveTo':_0x1399d8},function(_0x14bb1a,_0x44af73){if(_0x14bb1a)return _0x47c538(_0x14bb1a);return _0x2d2d5c(_0x44af73);});})['then'](function(){return new BPromise(function(_0x4db0a7,_0x1134df){rimraf(_0x31c78d,function(_0x21d27a){if(_0x21d27a)_0x1134df(_0x21d27a);return _0x4db0a7();});});})[_0x0f3c('0x14')](function(){return _0x19fe54['download'](_0x1399d8,_0x30dcf1,function(_0x1b1387){if(_0x1b1387){console[_0x0f3c('0x6f')]('err',_0x1b1387);}else{fs[_0x0f3c('0x70')](_0x1399d8);}});});});}else{return _0x19fe54[_0x0f3c('0xd')](0xc8);}})[_0x0f3c('0x21')](handleError(_0x19fe54,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1e646e9..c722310 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 _0x63a5=['hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4f3da5,_0x442069){var _0x259a2d=function(_0x15ecc0){while(--_0x15ecc0){_0x4f3da5['push'](_0x4f3da5['shift']());}};_0x259a2d(++_0x442069);}(_0x63a5,0x18e));var _0x563a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x63a5[_0xa148b7];return _0x51efd3;};'use strict';var EventEmitter=require(_0x563a('0x0'));var SmsInteraction=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x563a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x4'),'afterUpdate':_0x563a('0x5'),'afterDestroy':_0x563a('0x6')};function emitEvent(_0x37e617){return function(_0x5c2a8d,_0x4cc9e5,_0x1fdcb0){_0x5c2a8d['getUsers']({'attributes':['id'],'raw':!![]})[_0x563a('0x7')](function(_0x4f89b4){_0x5c2a8d['setDataValue']('Users',_0x4f89b4[_0x563a('0x8')](function(_0x32bf51){return{'id':_0x32bf51['id']};}));return SmsMessage[_0x563a('0x9')]({'where':{'SmsInteractionId':_0x5c2a8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x563a('0x7')](function(_0x255922){_0x5c2a8d[_0x563a('0xa')](_0x563a('0xb'),_0x255922[_0x563a('0xc')]);SmsInteractionEvents[_0x563a('0xd')](_0x37e617+':'+_0x5c2a8d['id'],_0x5c2a8d);SmsInteractionEvents[_0x563a('0xd')](_0x37e617,_0x5c2a8d);_0x1fdcb0(null);})[_0x563a('0xe')](_0x1fdcb0(null));};}for(var e in events){if(events[_0x563a('0xf')](e)){var event=events[e];SmsInteraction[_0x563a('0x10')](e,emitEvent(event));}}module[_0x563a('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x40488b,_0x25316a){var _0x1399b7=function(_0x5d3ee2){while(--_0x5d3ee2){_0x40488b['push'](_0x40488b['shift']());}};_0x1399b7(++_0x25316a);}(_0x236c,0x155));var _0xc236=function(_0x440466,_0x53aaa4){_0x440466=_0x440466-0x0;var _0x58d0a7=_0x236c[_0x440466];return _0x58d0a7;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5cc496f..dca180f 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 _0xee30=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x5b0216,_0x5622ba){var _0x4351cc=function(_0x4d26df){while(--_0x4d26df){_0x5b0216['push'](_0x5b0216['shift']());}};_0x4351cc(++_0x5622ba);}(_0xee30,0x158));var _0x0ee3=function(_0x4f7252,_0x57b66e){_0x4f7252=_0x4f7252-0x0;var _0x908b58=_0xee30[_0x4f7252];return _0x908b58;};'use strict';var _=require(_0x0ee3('0x0'));var util=require(_0x0ee3('0x1'));var logger=require(_0x0ee3('0x2'))(_0x0ee3('0x3'));var moment=require(_0x0ee3('0x4'));var BPromise=require(_0x0ee3('0x5'));var rp=require(_0x0ee3('0x6'));var fs=require('fs');var path=require(_0x0ee3('0x7'));var rimraf=require(_0x0ee3('0x8'));var config=require('../../config/environment');var attributes=require(_0x0ee3('0x9'));module[_0x0ee3('0xa')]=function(_0x348a9c,_0x51b376){return _0x348a9c[_0x0ee3('0xb')](_0x0ee3('0xc'),attributes,{'tableName':_0x0ee3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x200afe,_0x2672ca,_0x3a4138){if(_0x200afe[_0x0ee3('0xe')](_0x0ee3('0xf'))){_0x200afe[_0x0ee3('0x10')]=moment()[_0x0ee3('0x11')](_0x0ee3('0x12'));}_0x3a4138(null,_0x200afe);}}});}; \ No newline at end of file +var _0x9c7a=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x8e1130,_0x3cfa70){var _0xfefd17=function(_0x32e417){while(--_0x32e417){_0x8e1130['push'](_0x8e1130['shift']());}};_0xfefd17(++_0x3cfa70);}(_0x9c7a,0x84));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa9c7('0x0'));var logger=require(_0xa9c7('0x1'))(_0xa9c7('0x2'));var moment=require('moment');var BPromise=require(_0xa9c7('0x3'));var rp=require(_0xa9c7('0x4'));var fs=require('fs');var path=require(_0xa9c7('0x5'));var rimraf=require('rimraf');var config=require(_0xa9c7('0x6'));var attributes=require(_0xa9c7('0x7'));module[_0xa9c7('0x8')]=function(_0x44224e,_0x11641d){return _0x44224e[_0xa9c7('0x9')](_0xa9c7('0xa'),attributes,{'tableName':_0xa9c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5df112,_0x8112e6,_0x4718be){if(_0x5df112[_0xa9c7('0xc')](_0xa9c7('0xd'))){_0x5df112['closedAt']=moment()[_0xa9c7('0xe')](_0xa9c7('0xf'));}_0x4718be(null,_0x5df112);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5785ee2..e1bb756 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 _0x90a7=['./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2996e7,_0x560c2a){var _0x332248=function(_0x269994){while(--_0x269994){_0x2996e7['push'](_0x2996e7['shift']());}};_0x332248(++_0x560c2a);}(_0x90a7,0xff));var _0x790a=function(_0x252594,_0x2dec0c){_0x252594=_0x252594-0x0;var _0x1053b7=_0x90a7[_0x252594];return _0x1053b7;};'use strict';var _=require(_0x790a('0x0'));var util=require('util');var moment=require(_0x790a('0x1'));var BPromise=require(_0x790a('0x2'));var rs=require(_0x790a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x790a('0x4'))['db'];var utils=require(_0x790a('0x5'));var logger=require('../../config/logger')(_0x790a('0x6'));var config=require(_0x790a('0x7'));var jayson=require(_0x790a('0x8'));var client=jayson[_0x790a('0x9')][_0x790a('0xa')]({'port':0x232a});config[_0x790a('0xb')]=_[_0x790a('0xc')](config[_0x790a('0xb')],{'host':_0x790a('0xd'),'port':0x18eb});var socket=require(_0x790a('0xe'))(new Redis(config[_0x790a('0xb')]));require(_0x790a('0xf'))[_0x790a('0x10')](socket);function respondWithRpcPromise(_0x4e23a7,_0x183daa,_0x5b88ca){return new BPromise(function(_0x4166ff,_0xac7009){return client[_0x790a('0x11')](_0x4e23a7,_0x5b88ca)[_0x790a('0x12')](function(_0x38b255){logger[_0x790a('0x13')](_0x790a('0x14'),_0x183daa,_0x790a('0x15'));logger[_0x790a('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x183daa,_0x790a('0x15'),JSON[_0x790a('0x17')](_0x38b255));if(_0x38b255[_0x790a('0x18')]){if(_0x38b255['error'][_0x790a('0x19')]===0x1f4){logger['error'](_0x790a('0x14'),_0x183daa,_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);return _0xac7009(_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);}logger[_0x790a('0x18')](_0x790a('0x14'),_0x183daa,_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);return _0x4166ff(_0x38b255[_0x790a('0x18')][_0x790a('0x1a')]);}else{logger[_0x790a('0x13')](_0x790a('0x14'),_0x183daa,_0x790a('0x15'));_0x4166ff(_0x38b255[_0x790a('0x1b')][_0x790a('0x1a')]);}})[_0x790a('0x1c')](function(_0xd5eff0){logger[_0x790a('0x18')](_0x790a('0x14'),_0x183daa,_0xd5eff0);_0xac7009(_0xd5eff0);});});}exports[_0x790a('0x1d')]=function(_0x3c602f){var _0x2e08d5=this;return new Promise(function(_0x2f7a41,_0x4e9119){return db[_0x790a('0x1e')][_0x790a('0x1f')](_0x3c602f[_0x790a('0x20')],{'raw':_0x3c602f[_0x790a('0x21')]?_0x3c602f[_0x790a('0x21')][_0x790a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c602f[_0x790a('0x21')]?_0x3c602f[_0x790a('0x21')][_0x790a('0x23')]||null:null,'attributes':_0x3c602f['options']?_0x3c602f['options'][_0x790a('0x24')]||null:null,'limit':_0x3c602f[_0x790a('0x21')]?_0x3c602f['options'][_0x790a('0x25')]||null:null})[_0x790a('0x12')](function(_0x4d674b){logger[_0x790a('0x13')]('UpdateSmsInteraction',_0x3c602f);logger[_0x790a('0x16')](_0x790a('0x1d'),_0x3c602f,JSON['stringify'](_0x4d674b));_0x2f7a41(_0x4d674b);})[_0x790a('0x1c')](function(_0x5c7d8f){logger[_0x790a('0x18')]('UpdateSmsInteraction',_0x5c7d8f['message'],_0x3c602f);_0x4e9119(_0x2e08d5[_0x790a('0x18')](0x1f4,_0x5c7d8f[_0x790a('0x1a')]));});});};exports[_0x790a('0x26')]=function(_0x233416){return new Promise(function(_0x5c6bf7,_0xd5e141){return db[_0x790a('0x1e')][_0x790a('0x27')]({'where':_0x233416[_0x790a('0x21')]?_0x233416[_0x790a('0x21')][_0x790a('0x23')]||null:null})['then'](function(_0xe3a20){if(_0xe3a20){return _0xe3a20[_0x790a('0x28')](_0x233416[_0x790a('0x20')][_0x790a('0x29')],_[_0x790a('0x2a')](_0x233416['body'],[_0x790a('0x29'),'id'])||{});}})[_0x790a('0x2b')](function(_0x4aea9d){logger[_0x790a('0x13')](_0x790a('0x2c'),_0x233416);logger[_0x790a('0x16')](_0x790a('0x2c'),_0x233416,JSON[_0x790a('0x17')](_0x4aea9d));_0x5c6bf7(_0x4aea9d);})[_0x790a('0x1c')](function(_0x1bba9b){logger['error'](_0x790a('0x2c'),_0x1bba9b[_0x790a('0x1a')],_0x233416);_0xd5e141(_this[_0x790a('0x18')](0x1f4,_0x1bba9b['message']));});});}; \ No newline at end of file +var _0x088e=['limit','debug','catch','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsInteraction,\x20%s,\x20%s','info','result','UpdateSmsInteraction','update','body','options','where','attributes'];(function(_0x1a80f4,_0x1de53b){var _0x55e867=function(_0x4a4933){while(--_0x4a4933){_0x1a80f4['push'](_0x1a80f4['shift']());}};_0x55e867(++_0x1de53b);}(_0x088e,0xf9));var _0xe088=function(_0x361f4e,_0x3d0943){_0x361f4e=_0x361f4e-0x0;var _0x145fc4=_0x088e[_0x361f4e];return _0x145fc4;};'use strict';var _=require(_0xe088('0x0'));var util=require(_0xe088('0x1'));var moment=require(_0xe088('0x2'));var BPromise=require(_0xe088('0x3'));var rs=require(_0xe088('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe088('0x5'))('rpc');var config=require(_0xe088('0x6'));var jayson=require(_0xe088('0x7'));var client=jayson[_0xe088('0x8')]['http']({'port':0x232a});config[_0xe088('0x9')]=_[_0xe088('0xa')](config[_0xe088('0x9')],{'host':_0xe088('0xb'),'port':0x18eb});var socket=require(_0xe088('0xc'))(new Redis(config[_0xe088('0x9')]));require(_0xe088('0xd'))[_0xe088('0xe')](socket);function respondWithRpcPromise(_0x24cbec,_0x567d20,_0x2a8196){return new BPromise(function(_0x4e6f9e,_0x3d15f2){return client[_0xe088('0xf')](_0x24cbec,_0x2a8196)[_0xe088('0x10')](function(_0x37d8f4){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x567d20,_0xe088('0x11'));logger['debug'](_0xe088('0x12'),_0x567d20,_0xe088('0x11'),JSON[_0xe088('0x13')](_0x37d8f4));if(_0x37d8f4['error']){if(_0x37d8f4[_0xe088('0x14')]['code']===0x1f4){logger[_0xe088('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x567d20,_0x37d8f4['error'][_0xe088('0x15')]);return _0x3d15f2(_0x37d8f4['error'][_0xe088('0x15')]);}logger[_0xe088('0x14')](_0xe088('0x16'),_0x567d20,_0x37d8f4['error'][_0xe088('0x15')]);return _0x4e6f9e(_0x37d8f4[_0xe088('0x14')][_0xe088('0x15')]);}else{logger[_0xe088('0x17')](_0xe088('0x16'),_0x567d20,_0xe088('0x11'));_0x4e6f9e(_0x37d8f4[_0xe088('0x18')][_0xe088('0x15')]);}})['catch'](function(_0x146d58){logger[_0xe088('0x14')](_0xe088('0x16'),_0x567d20,_0x146d58);_0x3d15f2(_0x146d58);});});}exports[_0xe088('0x19')]=function(_0x43e33f){var _0x3dafcb=this;return new Promise(function(_0x437f68,_0x535a96){return db['SmsInteraction'][_0xe088('0x1a')](_0x43e33f[_0xe088('0x1b')],{'raw':_0x43e33f[_0xe088('0x1c')]?_0x43e33f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e33f[_0xe088('0x1c')]?_0x43e33f[_0xe088('0x1c')][_0xe088('0x1d')]||null:null,'attributes':_0x43e33f['options']?_0x43e33f['options'][_0xe088('0x1e')]||null:null,'limit':_0x43e33f[_0xe088('0x1c')]?_0x43e33f[_0xe088('0x1c')][_0xe088('0x1f')]||null:null})['then'](function(_0x208c39){logger[_0xe088('0x17')](_0xe088('0x19'),_0x43e33f);logger[_0xe088('0x20')]('UpdateSmsInteraction',_0x43e33f,JSON[_0xe088('0x13')](_0x208c39));_0x437f68(_0x208c39);})[_0xe088('0x21')](function(_0x3a72b6){logger[_0xe088('0x14')](_0xe088('0x19'),_0x3a72b6['message'],_0x43e33f);_0x535a96(_0x3dafcb[_0xe088('0x14')](0x1f4,_0x3a72b6[_0xe088('0x15')]));});});};exports[_0xe088('0x22')]=function(_0x47ab6d){return new Promise(function(_0x334fb3,_0x45f590){return db['SmsInteraction']['find']({'where':_0x47ab6d[_0xe088('0x1c')]?_0x47ab6d[_0xe088('0x1c')][_0xe088('0x1d')]||null:null})[_0xe088('0x10')](function(_0x4e211a){if(_0x4e211a){return _0x4e211a[_0xe088('0x23')](_0x47ab6d[_0xe088('0x1b')][_0xe088('0x24')],_[_0xe088('0x25')](_0x47ab6d['body'],[_0xe088('0x24'),'id'])||{});}})[_0xe088('0x26')](function(_0x5ec528){logger[_0xe088('0x17')](_0xe088('0x27'),_0x47ab6d);logger[_0xe088('0x20')]('AddTags',_0x47ab6d,JSON[_0xe088('0x13')](_0x5ec528));_0x334fb3(_0x5ec528);})['catch'](function(_0x2ccc44){logger[_0xe088('0x14')](_0xe088('0x27'),_0x2ccc44[_0xe088('0x15')],_0x47ab6d);_0x45f590(_this[_0xe088('0x14')](0x1f4,_0x2ccc44[_0xe088('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 16eed05..f2ae370 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 _0x5d21=['length','./smsInteraction.events','save','update','emit'];(function(_0x1cc779,_0xefcc6c){var _0x167bed=function(_0x41d8ba){while(--_0x41d8ba){_0x1cc779['push'](_0x1cc779['shift']());}};_0x167bed(++_0xefcc6c);}(_0x5d21,0x79));var _0x15d2=function(_0x4aa297,_0x2b21de){_0x4aa297=_0x4aa297-0x0;var _0x3f70a3=_0x5d21[_0x4aa297];return _0x3f70a3;};'use strict';var SmsInteractionEvents=require(_0x15d2('0x0'));var events=[_0x15d2('0x1'),'remove',_0x15d2('0x2')];function createListener(_0x5e4b0c,_0x36ca1b){return function(_0x8ff887){_0x36ca1b[_0x15d2('0x3')](_0x5e4b0c,_0x8ff887);};}function removeListener(_0x30eb05,_0x2afdcc){return function(){SmsInteractionEvents['removeListener'](_0x30eb05,_0x2afdcc);};}exports['register']=function(_0x4bdbea){for(var _0x48293c=0x0,_0x500086=events[_0x15d2('0x4')];_0x48293c<_0x500086;_0x48293c++){var _0x1cc6e9=events[_0x48293c];var _0x1b5039=createListener('smsInteraction:'+_0x1cc6e9,_0x4bdbea);SmsInteractionEvents['on'](_0x1cc6e9,_0x1b5039);}}; \ No newline at end of file +var _0x96ea=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x26dd9a,_0x28a8e1){var _0x32c5f8=function(_0x2c7f12){while(--_0x2c7f12){_0x26dd9a['push'](_0x26dd9a['shift']());}};_0x32c5f8(++_0x28a8e1);}(_0x96ea,0x85));var _0xa96e=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x96ea[_0x4a7631];return _0x1a5a6f;};'use strict';var SmsInteractionEvents=require(_0xa96e('0x0'));var events=[_0xa96e('0x1'),_0xa96e('0x2'),'update'];function createListener(_0x52bbdd,_0x361ccb){return function(_0x127deb){_0x361ccb[_0xa96e('0x3')](_0x52bbdd,_0x127deb);};}function removeListener(_0x57635c,_0x54dd8b){return function(){SmsInteractionEvents[_0xa96e('0x4')](_0x57635c,_0x54dd8b);};}exports[_0xa96e('0x5')]=function(_0xde512c){for(var _0x3766bf=0x0,_0x5bc567=events[_0xa96e('0x6')];_0x3766bf<_0x5bc567;_0x3766bf++){var _0x112b72=events[_0x3766bf];var _0x393d03=createListener(_0xa96e('0x7')+_0x112b72,_0xde512c);SmsInteractionEvents['on'](_0x112b72,_0x393d03);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4e21e94..b961fca 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 _0x3e22=['index','get','isAuthenticated','/:id','post','tracked','sms','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller'];(function(_0x347b25,_0x44fd7d){var _0x5002d4=function(_0x2c262d){while(--_0x2c262d){_0x347b25['push'](_0x347b25['shift']());}};_0x5002d4(++_0x44fd7d);}(_0x3e22,0xd7));var _0x23e2=function(_0x39681e,_0x3109ba){_0x39681e=_0x39681e-0x0;var _0x79eb6e=_0x3e22[_0x39681e];return _0x79eb6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23e2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23e2('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x23e2('0x2'));var interaction=require(_0x23e2('0x3'));var config=require('../../config/environment');var controller=require(_0x23e2('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x23e2('0x5')]);router[_0x23e2('0x6')]('/describe',auth[_0x23e2('0x7')](),controller['describe']);router[_0x23e2('0x6')](_0x23e2('0x8'),auth[_0x23e2('0x7')](),controller['show']);router[_0x23e2('0x9')]('/',auth[_0x23e2('0x7')](),interaction[_0x23e2('0xa')](_0x23e2('0xb'),'smsmessage:create'),controller['create']);router['post'](_0x23e2('0xc'),controller[_0x23e2('0xd')]);router[_0x23e2('0xe')]('/:id',auth[_0x23e2('0x7')](),controller[_0x23e2('0xf')]);router['put'](_0x23e2('0x10'),auth[_0x23e2('0x7')](),controller[_0x23e2('0x11')]);router[_0x23e2('0xe')](_0x23e2('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0x23e2('0x13')](_0x23e2('0x8'),auth[_0x23e2('0x7')](),controller[_0x23e2('0x14')]);module[_0x23e2('0x15')]=router; \ No newline at end of file +var _0xc27f=['index','/describe','/:id','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0xa30db1,_0x431b2f){var _0x19309c=function(_0x74cbb1){while(--_0x74cbb1){_0xa30db1['push'](_0xa30db1['shift']());}};_0x19309c(++_0x431b2f);}(_0xc27f,0x85));var _0xfc27=function(_0x1fe7a4,_0x2484c4){_0x1fe7a4=_0x1fe7a4-0x0;var _0x3572ec=_0xc27f[_0x1fe7a4];return _0x3572ec;};'use strict';var multer=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var path=require(_0xfc27('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc27('0x3'));var router=express[_0xfc27('0x4')]();var fs_extra=require(_0xfc27('0x5'));var auth=require(_0xfc27('0x6'));var interaction=require(_0xfc27('0x7'));var config=require(_0xfc27('0x8'));var controller=require(_0xfc27('0x9'));router[_0xfc27('0xa')]('/',auth[_0xfc27('0xb')](),controller[_0xfc27('0xc')]);router[_0xfc27('0xa')](_0xfc27('0xd'),auth[_0xfc27('0xb')](),controller['describe']);router[_0xfc27('0xa')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xfc27('0xf')](_0xfc27('0x10'),_0xfc27('0x11')),controller[_0xfc27('0x12')]);router[_0xfc27('0x13')](_0xfc27('0x14'),controller[_0xfc27('0x15')]);router[_0xfc27('0x16')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x17')]);router[_0xfc27('0x16')](_0xfc27('0x18'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x19')]);router[_0xfc27('0x16')](_0xfc27('0x1a'),auth['isAuthenticated'](),controller[_0xfc27('0x1b')]);router[_0xfc27('0x1c')](_0xfc27('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index c2a87f4..8e7f8da 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 _0xde64=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x105a3e,_0x47885a){var _0x5f30e0=function(_0x35a200){while(--_0x35a200){_0x105a3e['push'](_0x105a3e['shift']());}};_0x5f30e0(++_0x47885a);}(_0xde64,0x17c));var _0x4de6=function(_0x31050d,_0x21e6a2){_0x31050d=_0x31050d-0x0;var _0x3bb5b7=_0xde64[_0x31050d];return _0x3bb5b7;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'body':{'type':Sequelize[_0x4de6('0x2')](_0x4de6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4de6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4de6('0x5')]('in','out'),'defaultValue':_0x4de6('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4de6('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x4de6('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4de6('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x591d=['medium','BOOLEAN','ENUM','out','STRING','exports','TEXT'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x591d,0x171));var _0xd591=function(_0x4c0b53,_0x3a65f1){_0x4c0b53=_0x4c0b53-0x0;var _0x23c388=_0x591d[_0x4c0b53];return _0x23c388;};'use strict';var Sequelize=require('sequelize');module[_0xd591('0x0')]={'body':{'type':Sequelize[_0xd591('0x1')](_0xd591('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd591('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd591('0x4')]('in',_0xd591('0x5')),'defaultValue':_0xd591('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd591('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd591('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd591('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd591('0x6')]},'providerResponse':{'type':Sequelize[_0xd591('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 68caf4a..d070073 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 _0x363a=['plivo','MessageUUID','messageId','indexOf','sent','groupName','DELIVERED','infobip','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','stack','name','send','index','SmsMessage','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','params','length','create','body','update','find','describe','../../config/logger','accept','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5b6bcb,_0x833e11){var _0x36eea7=function(_0x4e13b3){while(--_0x4e13b3){_0x5b6bcb['push'](_0x5b6bcb['shift']());}};_0x36eea7(++_0x833e11);}(_0x363a,0x97));var _0xa363=function(_0x51276e,_0x28b616){_0x51276e=_0x51276e-0x0;var _0x1f5f30=_0x363a[_0x51276e];return _0x1f5f30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa363('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa363('0x1'));var rp=require('request-promise');var moment=require(_0xa363('0x2'));var BPromise=require(_0xa363('0x3'));var Mustache=require('mustache');var util=require(_0xa363('0x4'));var path=require(_0xa363('0x5'));var sox=require(_0xa363('0x6'));var csv=require('to-csv');var ejs=require(_0xa363('0x7'));var fs=require('fs');var fs_extra=require(_0xa363('0x8'));var _=require(_0xa363('0x9'));var squel=require(_0xa363('0xa'));var crypto=require(_0xa363('0xb'));var jsforce=require(_0xa363('0xc'));var deskjs=require(_0xa363('0xd'));var toCsv=require(_0xa363('0xe'));var querystring=require('querystring');var Papa=require(_0xa363('0xf'));var Redis=require(_0xa363('0x10'));var authService=require(_0xa363('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa363('0x12'));var logger=require('../../config/logger')(_0xa363('0x13'));var utils=require('../../config/utils');var config=require(_0xa363('0x14'));var licenseUtil=require(_0xa363('0x15'));var db=require('../../mysqldb')['db'];config[_0xa363('0x16')]=_[_0xa363('0x17')](config[_0xa363('0x16')],{'host':_0xa363('0x18'),'port':0x18eb});var socket=require(_0xa363('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xa363('0x1a')](socket);var jayson=require(_0xa363('0x1b'));var client=jayson[_0xa363('0x1c')][_0xa363('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d5ef9,_0x324e21,_0x2147a0,_0x12e61b){return new BPromise(function(_0x246d12,_0x4efbde){var _0x4e19ff=_0x12e61b||client;return _0x4e19ff[_0xa363('0x1e')](_0x1d5ef9,_0x2147a0)[_0xa363('0x1f')](function(_0x36e683){logger['info']('SmsMessage,\x20%s,\x20%s',_0x324e21,_0xa363('0x20'));logger[_0xa363('0x21')](_0xa363('0x22'),_0x324e21,_0xa363('0x20'),JSON[_0xa363('0x23')](_0x36e683));if(_0x36e683[_0xa363('0x24')]){if(_0x36e683[_0xa363('0x24')][_0xa363('0x25')]===0x1f4){logger['error'](_0xa363('0x26'),_0x324e21,_0x36e683[_0xa363('0x24')]['message']);return _0x4efbde(_0x36e683[_0xa363('0x24')]['message']);}logger['error'](_0xa363('0x26'),_0x324e21,_0x36e683['error']['message']);return _0x246d12(_0x36e683[_0xa363('0x24')][_0xa363('0x27')]);}else{logger['info'](_0xa363('0x26'),_0x324e21,_0xa363('0x20'));_0x246d12(_0x36e683['result'][_0xa363('0x27')]);}})[_0xa363('0x28')](function(_0x2146d8){logger[_0xa363('0x24')](_0xa363('0x26'),_0x324e21,_0x2146d8);_0x4efbde(_0x2146d8);});});}function respondWithStatusCode(_0x521d74,_0x487b79){_0x487b79=_0x487b79||0xcc;return function(_0x2bf989){if(_0x2bf989){return _0x521d74[_0xa363('0x29')](_0x487b79);}return _0x521d74[_0xa363('0x2a')](_0x487b79)[_0xa363('0x2b')]();};}function respondWithResult(_0x2bc213,_0x1d245b){_0x1d245b=_0x1d245b||0xc8;return function(_0x5ca224){if(_0x5ca224){return _0x2bc213[_0xa363('0x2a')](_0x1d245b)[_0xa363('0x2c')](_0x5ca224);}};}function respondWithFilteredResult(_0x3498d7,_0x27e61c){return function(_0x166403){if(_0x166403){var _0x262078=typeof _0x27e61c[_0xa363('0x2d')]===_0xa363('0x2e')&&typeof _0x27e61c[_0xa363('0x2f')]===_0xa363('0x2e');var _0x49edad=_0x166403[_0xa363('0x30')];var _0xdb778f=_0x262078?0x0:_0x27e61c[_0xa363('0x2d')];var _0x53bb7b=_0x262078?_0x166403['count']:_0x27e61c[_0xa363('0x2d')]+_0x27e61c[_0xa363('0x2f')];var _0x276294;if(_0x53bb7b>=_0x49edad){_0x53bb7b=_0x49edad;_0x276294=0xc8;}else{_0x276294=0xce;}_0x3498d7[_0xa363('0x2a')](_0x276294);return _0x3498d7[_0xa363('0x31')](_0xa363('0x32'),_0xdb778f+'-'+_0x53bb7b+'/'+_0x49edad)['json'](_0x166403);}return null;};}function patchUpdates(_0x1cbe00){return function(_0x4af171){try{jsonpatch[_0xa363('0x33')](_0x4af171,_0x1cbe00,!![]);}catch(_0x3e87ec){return BPromise['reject'](_0x3e87ec);}return _0x4af171['save']();};}function saveUpdates(_0x4605b3,_0x3c70fc){return function(_0x2772dd){if(_0x2772dd){return _0x2772dd['update'](_0x4605b3)[_0xa363('0x1f')](function(_0xb142e){return _0xb142e;});}return null;};}function removeEntity(_0x3a71b1,_0x3f0568){return function(_0x3d1aea){if(_0x3d1aea){return _0x3d1aea[_0xa363('0x34')]()[_0xa363('0x1f')](function(){_0x3a71b1[_0xa363('0x2a')](0xcc)[_0xa363('0x2b')]();});}};}function handleEntityNotFound(_0x242a44,_0x541443){return function(_0x232f72){if(!_0x232f72){_0x242a44[_0xa363('0x29')](0x194);}return _0x232f72;};}function handleError(_0x5d4bbd,_0x4a44e3){_0x4a44e3=_0x4a44e3||0x1f4;return function(_0x354e9c){logger['error'](_0x354e9c[_0xa363('0x35')]);if(_0x354e9c[_0xa363('0x36')]){delete _0x354e9c[_0xa363('0x36')];}_0x5d4bbd[_0xa363('0x2a')](_0x4a44e3)[_0xa363('0x37')](_0x354e9c);};}exports[_0xa363('0x38')]=function(_0x2f87ab,_0x1e97ba){var _0x3efe30={},_0x1430ab={},_0x8f7379={'count':0x0,'rows':[]};var _0x5cab45=_['map'](db[_0xa363('0x39')]['rawAttributes'],function(_0x49f51d){return{'name':_0x49f51d['fieldName'],'type':_0x49f51d[_0xa363('0x3a')][_0xa363('0x3b')]};});_0x1430ab[_0xa363('0x3c')]=_[_0xa363('0x3d')](_0x5cab45,_0xa363('0x36'));_0x1430ab[_0xa363('0x3e')]=_[_0xa363('0x3f')](_0x2f87ab[_0xa363('0x3e')]);_0x1430ab[_0xa363('0x40')]=_[_0xa363('0x41')](_0x1430ab[_0xa363('0x3c')],_0x1430ab[_0xa363('0x3e')]);_0x3efe30[_0xa363('0x42')]=_[_0xa363('0x41')](_0x1430ab['model'],qs[_0xa363('0x43')](_0x2f87ab[_0xa363('0x3e')]['fields']));_0x3efe30[_0xa363('0x42')]=_0x3efe30[_0xa363('0x42')]['length']?_0x3efe30[_0xa363('0x42')]:_0x1430ab[_0xa363('0x3c')];if(!_0x2f87ab[_0xa363('0x3e')][_0xa363('0x44')](_0xa363('0x45'))){_0x3efe30[_0xa363('0x2f')]=qs[_0xa363('0x2f')](_0x2f87ab[_0xa363('0x3e')]['limit']);_0x3efe30[_0xa363('0x2d')]=qs[_0xa363('0x2d')](_0x2f87ab['query'][_0xa363('0x2d')]);}_0x3efe30[_0xa363('0x46')]=qs[_0xa363('0x47')](_0x2f87ab[_0xa363('0x3e')][_0xa363('0x47')]);_0x3efe30['where']=qs[_0xa363('0x40')](_[_0xa363('0x48')](_0x2f87ab[_0xa363('0x3e')],_0x1430ab['filters']),_0x5cab45);if(_0x2f87ab[_0xa363('0x3e')][_0xa363('0x49')]){_0x3efe30[_0xa363('0x4a')]=_['merge'](_0x3efe30[_0xa363('0x4a')],{'$or':_[_0xa363('0x3d')](_0x5cab45,function(_0x3762b4){if(_0x3762b4[_0xa363('0x3a')]!==_0xa363('0x4b')){var _0x13bb1e={};_0x13bb1e[_0x3762b4[_0xa363('0x36')]]={'$like':'%'+_0x2f87ab[_0xa363('0x3e')][_0xa363('0x49')]+'%'};return _0x13bb1e;}})});}_0x3efe30=_['merge']({},_0x3efe30,_0x2f87ab[_0xa363('0x4c')]);var _0x29bd55={'where':_0x3efe30['where']};return db[_0xa363('0x39')]['count'](_0x29bd55)[_0xa363('0x1f')](function(_0x4d860e){_0x8f7379[_0xa363('0x30')]=_0x4d860e;if(_0x2f87ab[_0xa363('0x3e')][_0xa363('0x4d')]){_0x3efe30[_0xa363('0x4e')]=[{'all':!![]}];}return db[_0xa363('0x39')]['findAll'](_0x3efe30);})[_0xa363('0x1f')](function(_0x21cdaf){_0x8f7379['rows']=_0x21cdaf;return _0x8f7379;})[_0xa363('0x1f')](respondWithFilteredResult(_0x1e97ba,_0x3efe30))[_0xa363('0x28')](handleError(_0x1e97ba,null));};exports['show']=function(_0x37c0b4,_0xd701a4){var _0x5ebbee={'raw':!![],'where':{'id':_0x37c0b4[_0xa363('0x4f')]['id']}},_0x1b6ddd={};_0x1b6ddd['model']=_[_0xa363('0x3f')](db[_0xa363('0x39')]['rawAttributes']);_0x1b6ddd[_0xa363('0x3e')]=_[_0xa363('0x3f')](_0x37c0b4['query']);_0x1b6ddd['filters']=_[_0xa363('0x41')](_0x1b6ddd[_0xa363('0x3c')],_0x1b6ddd[_0xa363('0x3e')]);_0x5ebbee[_0xa363('0x42')]=_[_0xa363('0x41')](_0x1b6ddd['model'],qs[_0xa363('0x43')](_0x37c0b4[_0xa363('0x3e')][_0xa363('0x43')]));_0x5ebbee['attributes']=_0x5ebbee[_0xa363('0x42')][_0xa363('0x50')]?_0x5ebbee[_0xa363('0x42')]:_0x1b6ddd['model'];if(_0x37c0b4['query']['includeAll']){_0x5ebbee[_0xa363('0x4e')]=[{'all':!![]}];}_0x5ebbee=_['merge']({},_0x5ebbee,_0x37c0b4[_0xa363('0x4c')]);return db[_0xa363('0x39')]['find'](_0x5ebbee)[_0xa363('0x1f')](handleEntityNotFound(_0xd701a4,null))[_0xa363('0x1f')](respondWithResult(_0xd701a4,null))['catch'](handleError(_0xd701a4,null));};exports[_0xa363('0x51')]=function(_0x466026,_0x3e77f5){return db[_0xa363('0x39')][_0xa363('0x51')](_0x466026[_0xa363('0x52')],{})[_0xa363('0x1f')](respondWithResult(_0x3e77f5,0xc9))[_0xa363('0x28')](handleError(_0x3e77f5,null));};exports[_0xa363('0x53')]=function(_0x34c686,_0x1ce4e7){if(_0x34c686[_0xa363('0x52')]['id']){delete _0x34c686[_0xa363('0x52')]['id'];}return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x34c686[_0xa363('0x4f')]['id']}})[_0xa363('0x1f')](handleEntityNotFound(_0x1ce4e7,null))[_0xa363('0x1f')](saveUpdates(_0x34c686[_0xa363('0x52')],null))[_0xa363('0x1f')](respondWithResult(_0x1ce4e7,null))[_0xa363('0x28')](handleError(_0x1ce4e7,null));};exports[_0xa363('0x34')]=function(_0x205a95,_0x58a97e){return db['SmsMessage'][_0xa363('0x54')]({'where':{'id':_0x205a95[_0xa363('0x4f')]['id']}})[_0xa363('0x1f')](handleEntityNotFound(_0x58a97e,null))[_0xa363('0x1f')](removeEntity(_0x58a97e,null))['catch'](handleError(_0x58a97e,null));};exports[_0xa363('0x55')]=function(_0x3261e8,_0x72fe26){return db['SmsMessage'][_0xa363('0x55')]()[_0xa363('0x1f')](respondWithResult(_0x72fe26,null))[_0xa363('0x28')](handleError(_0x72fe26,null));};var interaction_log=require(_0xa363('0x56'))('sms-interactions');exports[_0xa363('0x57')]=function(_0x20de92,_0x29d36e,_0x40412b){var _0x24884a={'agent':{},'channel':'sms'};if(_0x20de92['body']['id']){delete _0x20de92['body']['id'];}_0x20de92[_0xa363('0x52')][_0xa363('0x58')]=!![];_0x20de92[_0xa363('0x52')][_0xa363('0x59')]=moment()[_0xa363('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x20de92[_0xa363('0x52')]['UserId']=_0x20de92[_0xa363('0x52')][_0xa363('0x5b')]||_0x20de92[_0xa363('0x5c')]['id'];_0x24884a[_0xa363('0x5d')]['id']=_0x20de92['body']['UserId'];return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x20de92[_0xa363('0x4f')]['id'],'UserId':null}})[_0xa363('0x1f')](handleEntityNotFound(_0x29d36e,null))['then'](saveUpdates(_0x20de92[_0xa363('0x52')],null))[_0xa363('0x1f')](function(_0x3fe520){if(_0x3fe520){_0x24884a[_0xa363('0x27')]=_0x3fe520[_0xa363('0x5e')]({'plain':!![]});return db[_0xa363('0x5f')][_0xa363('0x54')]({'where':{'id':_0x3fe520[_0xa363('0x60')]}});}return null;})[_0xa363('0x1f')](handleEntityNotFound(_0x29d36e,null))['then'](function(_0x54f77f){if(_0x54f77f){return _0x54f77f[_0xa363('0x53')]({'UserId':_0x20de92['body'][_0xa363('0x5b')],'read1stAt':_[_0xa363('0x61')](_0x54f77f[_0xa363('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1b28fa){if(_0x1b28fa){_0x24884a['interaction']=_0x1b28fa['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20de92['user']['id'],_0x20de92[_0xa363('0x5c')][_0xa363('0x36')],_0x20de92[_0xa363('0x5c')][_0xa363('0x63')],_0x24884a[_0xa363('0x64')]['id'],_0x20de92[_0xa363('0x52')]?JSON[_0xa363('0x23')](_0x20de92['body']):_0xa363('0x65'));return respondWithRpcPromise(_0xa363('0x66'),_0xa363('0x67'),_0x24884a);}return null;})[_0xa363('0x1f')](function(_0x42c877){var _0x50eee9=_0xa363('0x68')+_0x42c877[_0xa363('0x27')][_0xa363('0x69')];return db['sequelize'][_0xa363('0x3e')](_0x50eee9,{'type':db[_0xa363('0x6a')][_0xa363('0x6b')][_0xa363('0x6c')],'raw':!![]})[_0xa363('0x1f')](function(_0x40b711){return _0x40b711;});})[_0xa363('0x1f')](function(_0x119ef4){if(_0x119ef4){_0x24884a[_0xa363('0x27')][_0xa363('0x6d')]=_0x119ef4[0x0];if(!_0x20de92['body'][_0xa363('0x5b')])return;return db[_0xa363('0x6e')][_0xa363('0x54')]({'where':{'id':_0x20de92[_0xa363('0x52')][_0xa363('0x5b')],'role':_0xa363('0x5d')},'attributes':['id','name',_0xa363('0x6f'),_0xa363('0x70'),'internal'],'raw':!![]});}return null;})[_0xa363('0x1f')](function(_0x27a11f){if(!_0x27a11f)return null;_0x24884a[_0xa363('0x27')][_0xa363('0x5d')]=_0x27a11f;return _0x24884a;})[_0xa363('0x1f')](function(_0x5b2d6c){if(_0x5b2d6c){if(_0x20de92[_0xa363('0x52')][_0xa363('0x71')]){_0x24884a[_0xa363('0x27')][_0xa363('0x72')]=util[_0xa363('0x5a')](_0xa363('0x73'),_0x20de92[_0xa363('0x5c')]['name']);_0x24884a[_0xa363('0x27')][_0xa363('0x74')]=_0x24884a[_0xa363('0x74')];_0x24884a[_0xa363('0x27')][_0xa363('0x75')]=_0x24884a['channel'];_0x24884a[_0xa363('0x27')][_0xa363('0x76')]='accept';return respondWithRpcPromise(_0xa363('0x77'),_0xa363('0x77'),{'event':_0xa363('0x78'),'message':_0x24884a[_0xa363('0x27')]},client9002)[_0xa363('0x1f')](function(){return _0x24884a;});}return _0x24884a;}return null;})[_0xa363('0x1f')](respondWithResult(_0x29d36e,null))['catch'](handleError(_0x29d36e,null));};var interaction_log=require(_0xa363('0x56'))(_0xa363('0x79'));exports[_0xa363('0x7a')]=function(_0x69a1d6,_0x350957,_0x4f7de2){var _0x42c11e={'agent':{},'channel':_0xa363('0x7b')};if(_0x69a1d6[_0xa363('0x52')]['id']){delete _0x69a1d6[_0xa363('0x52')]['id'];}_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')]=_0x69a1d6[_0xa363('0x52')]['UserId']||_0x69a1d6['user']['id'];_0x42c11e[_0xa363('0x5d')]['id']=_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')];return db[_0xa363('0x39')]['find']({'where':{'id':_0x69a1d6[_0xa363('0x4f')]['id'],'UserId':null}})[_0xa363('0x1f')](handleEntityNotFound(_0x350957,null))[_0xa363('0x1f')](function(_0x38973b){if(_0x38973b){_0x42c11e[_0xa363('0x27')]=_0x38973b['get']({'plain':!![]});return db[_0xa363('0x5f')][_0xa363('0x54')]({'where':{'id':_0x38973b['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x350957,null))['then'](function(_0x57ecba){if(_0x57ecba){_0x42c11e[_0xa363('0x64')]=_0x57ecba['get']({'plain':!![]});interaction_log['info'](_0xa363('0x7c'),_0x69a1d6[_0xa363('0x5c')]['id'],_0x69a1d6[_0xa363('0x5c')][_0xa363('0x36')],_0x69a1d6[_0xa363('0x5c')][_0xa363('0x63')],_0x42c11e[_0xa363('0x64')]['id'],_0x69a1d6[_0xa363('0x52')]?JSON[_0xa363('0x23')](_0x69a1d6[_0xa363('0x52')]):_0xa363('0x65'));return respondWithRpcPromise(_0xa363('0x7d'),_0xa363('0x7e'),_0x42c11e);}return null;})[_0xa363('0x1f')](function(_0x50b4d0){var _0x449ae5=_0xa363('0x68')+_0x50b4d0[_0xa363('0x27')]['ContactId'];return db[_0xa363('0x7f')][_0xa363('0x3e')](_0x449ae5,{'type':db['Sequelize'][_0xa363('0x6b')]['SELECT'],'raw':!![]})[_0xa363('0x1f')](function(_0x309a0c){return _0x309a0c;});})[_0xa363('0x1f')](function(_0x15c407){if(_0x15c407){_0x42c11e[_0xa363('0x27')][_0xa363('0x6d')]=_0x15c407[0x0];if(!_0x69a1d6[_0xa363('0x52')]['UserId'])return;return db[_0xa363('0x6e')][_0xa363('0x54')]({'where':{'id':_0x69a1d6[_0xa363('0x52')][_0xa363('0x5b')],'role':_0xa363('0x5d')},'attributes':['id',_0xa363('0x36'),_0xa363('0x6f'),_0xa363('0x70'),_0xa363('0x80')],'raw':!![]});}return null;})[_0xa363('0x1f')](function(_0x35d23d){if(!_0x35d23d)return null;_0x42c11e[_0xa363('0x27')][_0xa363('0x5d')]=_0x35d23d;return _0x42c11e;})[_0xa363('0x1f')](function(_0x4f40c5){if(_0x4f40c5){_0x4f40c5[_0xa363('0x27')][_0xa363('0x72')]=util[_0xa363('0x5a')]('SIP/%s',_0x69a1d6['user'][_0xa363('0x36')]);_0x4f40c5[_0xa363('0x27')][_0xa363('0x74')]=_0x42c11e[_0xa363('0x74')];_0x4f40c5[_0xa363('0x27')]['motionChannel']=_0x42c11e[_0xa363('0x74')];_0x4f40c5[_0xa363('0x27')][_0xa363('0x76')]=_0xa363('0x7a');respondWithRpcPromise(_0xa363('0x77'),_0xa363('0x77'),{'event':'rejectmessage','message':_0x4f40c5[_0xa363('0x27')]},client9002);return _0x42c11e;}return null;})[_0xa363('0x1f')](respondWithResult(_0x350957,null))[_0xa363('0x28')](handleError(_0x350957,null));};exports[_0xa363('0x2a')]=function(_0x5c7dc4,_0x277176,_0x2005f9){if(_0x5c7dc4['body']['id']){delete _0x5c7dc4[_0xa363('0x52')]['id'];}var _0x52ddbf;return db[_0xa363('0x39')][_0xa363('0x54')]({'where':{'id':_0x5c7dc4[_0xa363('0x4f')]['id']}})['then'](handleEntityNotFound(_0x277176,null))[_0xa363('0x1f')](function(_0xa71e68){if(_0xa71e68){_0x52ddbf=_0xa71e68;return db[_0xa363('0x81')]['find']({'where':{'id':_0xa71e68['SmsAccountId']}});}})[_0xa363('0x1f')](handleEntityNotFound(_0x277176,null))[_0xa363('0x1f')](function(_0x350244){if(_0x350244){logger['debug'](_0xa363('0x22'),'status',_0xa363('0x82'),_0x350244[_0xa363('0x3a')],util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));switch(_0x350244[_0xa363('0x3a')]){case _0xa363('0x84'):if(_0x5c7dc4[_0xa363('0x52')]['MessageSid']&&_0x5c7dc4[_0xa363('0x52')][_0xa363('0x85')]===_0x52ddbf['messageId']){return _0x52ddbf['update']({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),'status','twilio',util['inspect'](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;case _0xa363('0x87'):if(_0x5c7dc4[_0xa363('0x52')][_0xa363('0x88')]&&_0x5c7dc4[_0xa363('0x52')][_0xa363('0x88')]===_0x52ddbf[_0xa363('0x89')]&&_[_0xa363('0x8a')]([_0xa363('0x8b'),'delivered'],_0x5c7dc4['body']['Status'])>=0x0){return _0x52ddbf[_0xa363('0x53')]({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),'status','plivio',util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1395a9=_0x5c7dc4[_0xa363('0x52')]['results'][0x0];if(_0x1395a9['status'][_0xa363('0x8c')]===_0xa363('0x8d')){return _0x52ddbf[_0xa363('0x53')]({'read':!![]});}else{logger[_0xa363('0x24')](_0xa363('0x86'),_0xa363('0x2a'),_0xa363('0x8e'),util[_0xa363('0x83')](_0x5c7dc4[_0xa363('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x52ddbf;}})[_0xa363('0x1f')](respondWithResult(_0x277176,null))[_0xa363('0x28')](handleError(_0x277176,null));}; \ No newline at end of file +var _0xb4e5=['client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','SmsMessage','rows','catch','params','rawAttributes','find','body','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xb4e5,0x104));var _0x5b4e=function(_0x4ab76d,_0x4828a){_0x4ab76d=_0x4ab76d-0x0;var _0x5aeffc=_0xb4e5[_0x4ab76d];return _0x5aeffc;};'use strict';var emlformat=require(_0x5b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b4e('0x1'));var jsonpatch=require(_0x5b4e('0x2'));var rp=require(_0x5b4e('0x3'));var moment=require(_0x5b4e('0x4'));var BPromise=require(_0x5b4e('0x5'));var Mustache=require(_0x5b4e('0x6'));var util=require(_0x5b4e('0x7'));var path=require(_0x5b4e('0x8'));var sox=require('sox');var csv=require(_0x5b4e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b4e('0xa'));var squel=require(_0x5b4e('0xb'));var crypto=require('crypto');var jsforce=require(_0x5b4e('0xc'));var deskjs=require(_0x5b4e('0xd'));var toCsv=require(_0x5b4e('0x9'));var querystring=require(_0x5b4e('0xe'));var Papa=require(_0x5b4e('0xf'));var Redis=require(_0x5b4e('0x10'));var authService=require(_0x5b4e('0x11'));var qs=require(_0x5b4e('0x12'));var as=require(_0x5b4e('0x13'));var hardwareService=require(_0x5b4e('0x14'));var logger=require(_0x5b4e('0x15'))('api');var utils=require(_0x5b4e('0x16'));var config=require(_0x5b4e('0x17'));var licenseUtil=require(_0x5b4e('0x18'));var db=require(_0x5b4e('0x19'))['db'];config[_0x5b4e('0x1a')]=_[_0x5b4e('0x1b')](config[_0x5b4e('0x1a')],{'host':_0x5b4e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b4e('0x1a')]));require('./smsMessage.socket')[_0x5b4e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b4e('0x1e')][_0x5b4e('0x1f')]({'port':0x232c});var client9002=jayson[_0x5b4e('0x1e')][_0x5b4e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x171698,_0x1ca334,_0x586a6b,_0x213cdd){return new BPromise(function(_0x31b9d1,_0x47ffa3){var _0xfbdccf=_0x213cdd||client;return _0xfbdccf[_0x5b4e('0x20')](_0x171698,_0x586a6b)[_0x5b4e('0x21')](function(_0x41356b){logger[_0x5b4e('0x22')](_0x5b4e('0x23'),_0x1ca334,_0x5b4e('0x24'));logger['debug'](_0x5b4e('0x25'),_0x1ca334,_0x5b4e('0x24'),JSON[_0x5b4e('0x26')](_0x41356b));if(_0x41356b[_0x5b4e('0x27')]){if(_0x41356b[_0x5b4e('0x27')]['code']===0x1f4){logger['error'](_0x5b4e('0x23'),_0x1ca334,_0x41356b['error'][_0x5b4e('0x28')]);return _0x47ffa3(_0x41356b[_0x5b4e('0x27')]['message']);}logger[_0x5b4e('0x27')]('SmsMessage,\x20%s,\x20%s',_0x1ca334,_0x41356b[_0x5b4e('0x27')][_0x5b4e('0x28')]);return _0x31b9d1(_0x41356b[_0x5b4e('0x27')]['message']);}else{logger[_0x5b4e('0x22')](_0x5b4e('0x23'),_0x1ca334,_0x5b4e('0x24'));_0x31b9d1(_0x41356b[_0x5b4e('0x29')]['message']);}})['catch'](function(_0x512e1c){logger[_0x5b4e('0x27')](_0x5b4e('0x23'),_0x1ca334,_0x512e1c);_0x47ffa3(_0x512e1c);});});}function respondWithStatusCode(_0x12822c,_0x460329){_0x460329=_0x460329||0xcc;return function(_0x3f78f4){if(_0x3f78f4){return _0x12822c[_0x5b4e('0x2a')](_0x460329);}return _0x12822c[_0x5b4e('0x2b')](_0x460329)[_0x5b4e('0x2c')]();};}function respondWithResult(_0x195658,_0xa2c07e){_0xa2c07e=_0xa2c07e||0xc8;return function(_0x4563c2){if(_0x4563c2){return _0x195658[_0x5b4e('0x2b')](_0xa2c07e)['json'](_0x4563c2);}};}function respondWithFilteredResult(_0x37e4fd,_0x476584){return function(_0x1cc5a9){if(_0x1cc5a9){var _0x37a9ab=typeof _0x476584[_0x5b4e('0x2d')]==='undefined'&&typeof _0x476584[_0x5b4e('0x2e')]==='undefined';var _0xd1c7cc=_0x1cc5a9['count'];var _0x50869e=_0x37a9ab?0x0:_0x476584[_0x5b4e('0x2d')];var _0x1eda4c=_0x37a9ab?_0x1cc5a9[_0x5b4e('0x2f')]:_0x476584[_0x5b4e('0x2d')]+_0x476584[_0x5b4e('0x2e')];var _0x131749;if(_0x1eda4c>=_0xd1c7cc){_0x1eda4c=_0xd1c7cc;_0x131749=0xc8;}else{_0x131749=0xce;}_0x37e4fd[_0x5b4e('0x2b')](_0x131749);return _0x37e4fd[_0x5b4e('0x30')](_0x5b4e('0x31'),_0x50869e+'-'+_0x1eda4c+'/'+_0xd1c7cc)[_0x5b4e('0x32')](_0x1cc5a9);}return null;};}function patchUpdates(_0x38c0d2){return function(_0x137f76){try{jsonpatch[_0x5b4e('0x33')](_0x137f76,_0x38c0d2,!![]);}catch(_0x45305c){return BPromise[_0x5b4e('0x34')](_0x45305c);}return _0x137f76[_0x5b4e('0x35')]();};}function saveUpdates(_0x53c0c1,_0xa62eb){return function(_0x1db3aa){if(_0x1db3aa){return _0x1db3aa[_0x5b4e('0x36')](_0x53c0c1)[_0x5b4e('0x21')](function(_0x114b8b){return _0x114b8b;});}return null;};}function removeEntity(_0x50222a,_0x5232a4){return function(_0x30d863){if(_0x30d863){return _0x30d863[_0x5b4e('0x37')]()[_0x5b4e('0x21')](function(){_0x50222a['status'](0xcc)[_0x5b4e('0x2c')]();});}};}function handleEntityNotFound(_0x45410d,_0x24aa7b){return function(_0x4aaa84){if(!_0x4aaa84){_0x45410d[_0x5b4e('0x2a')](0x194);}return _0x4aaa84;};}function handleError(_0x13e472,_0x4bff4d){_0x4bff4d=_0x4bff4d||0x1f4;return function(_0x552979){logger['error'](_0x552979[_0x5b4e('0x38')]);if(_0x552979[_0x5b4e('0x39')]){delete _0x552979[_0x5b4e('0x39')];}_0x13e472['status'](_0x4bff4d)['send'](_0x552979);};}exports[_0x5b4e('0x3a')]=function(_0x4a2eef,_0x200f78){var _0x2be6d6={},_0x1f05bd={},_0x476f9c={'count':0x0,'rows':[]};var _0x1ade60=_[_0x5b4e('0x3b')](db['SmsMessage']['rawAttributes'],function(_0x2a2c4d){return{'name':_0x2a2c4d[_0x5b4e('0x3c')],'type':_0x2a2c4d[_0x5b4e('0x3d')][_0x5b4e('0x3e')]};});_0x1f05bd[_0x5b4e('0x3f')]=_[_0x5b4e('0x3b')](_0x1ade60,'name');_0x1f05bd[_0x5b4e('0x40')]=_[_0x5b4e('0x41')](_0x4a2eef[_0x5b4e('0x40')]);_0x1f05bd['filters']=_[_0x5b4e('0x42')](_0x1f05bd['model'],_0x1f05bd[_0x5b4e('0x40')]);_0x2be6d6[_0x5b4e('0x43')]=_[_0x5b4e('0x42')](_0x1f05bd[_0x5b4e('0x3f')],qs['fields'](_0x4a2eef[_0x5b4e('0x40')][_0x5b4e('0x44')]));_0x2be6d6[_0x5b4e('0x43')]=_0x2be6d6[_0x5b4e('0x43')]['length']?_0x2be6d6[_0x5b4e('0x43')]:_0x1f05bd['model'];if(!_0x4a2eef[_0x5b4e('0x40')][_0x5b4e('0x45')](_0x5b4e('0x46'))){_0x2be6d6[_0x5b4e('0x2e')]=qs[_0x5b4e('0x2e')](_0x4a2eef['query'][_0x5b4e('0x2e')]);_0x2be6d6['offset']=qs[_0x5b4e('0x2d')](_0x4a2eef['query'][_0x5b4e('0x2d')]);}_0x2be6d6['order']=qs[_0x5b4e('0x47')](_0x4a2eef[_0x5b4e('0x40')][_0x5b4e('0x47')]);_0x2be6d6['where']=qs[_0x5b4e('0x48')](_['pick'](_0x4a2eef[_0x5b4e('0x40')],_0x1f05bd[_0x5b4e('0x48')]),_0x1ade60);if(_0x4a2eef[_0x5b4e('0x40')][_0x5b4e('0x49')]){_0x2be6d6['where']=_['merge'](_0x2be6d6[_0x5b4e('0x4a')],{'$or':_['map'](_0x1ade60,function(_0x375671){if(_0x375671[_0x5b4e('0x3d')]!==_0x5b4e('0x4b')){var _0x378daf={};_0x378daf[_0x375671['name']]={'$like':'%'+_0x4a2eef['query'][_0x5b4e('0x49')]+'%'};return _0x378daf;}})});}_0x2be6d6=_[_0x5b4e('0x4c')]({},_0x2be6d6,_0x4a2eef[_0x5b4e('0x4d')]);var _0x498dea={'where':_0x2be6d6[_0x5b4e('0x4a')]};return db['SmsMessage'][_0x5b4e('0x2f')](_0x498dea)[_0x5b4e('0x21')](function(_0x5d1953){_0x476f9c[_0x5b4e('0x2f')]=_0x5d1953;if(_0x4a2eef[_0x5b4e('0x40')][_0x5b4e('0x4e')]){_0x2be6d6[_0x5b4e('0x4f')]=[{'all':!![]}];}return db[_0x5b4e('0x50')]['findAll'](_0x2be6d6);})[_0x5b4e('0x21')](function(_0x36e8d1){_0x476f9c[_0x5b4e('0x51')]=_0x36e8d1;return _0x476f9c;})[_0x5b4e('0x21')](respondWithFilteredResult(_0x200f78,_0x2be6d6))[_0x5b4e('0x52')](handleError(_0x200f78,null));};exports['show']=function(_0x1b4b82,_0x22e4cf){var _0x504266={'raw':!![],'where':{'id':_0x1b4b82[_0x5b4e('0x53')]['id']}},_0x24c1dd={};_0x24c1dd['model']=_['keys'](db[_0x5b4e('0x50')][_0x5b4e('0x54')]);_0x24c1dd[_0x5b4e('0x40')]=_[_0x5b4e('0x41')](_0x1b4b82['query']);_0x24c1dd['filters']=_[_0x5b4e('0x42')](_0x24c1dd[_0x5b4e('0x3f')],_0x24c1dd[_0x5b4e('0x40')]);_0x504266['attributes']=_['intersection'](_0x24c1dd[_0x5b4e('0x3f')],qs['fields'](_0x1b4b82[_0x5b4e('0x40')][_0x5b4e('0x44')]));_0x504266[_0x5b4e('0x43')]=_0x504266[_0x5b4e('0x43')]['length']?_0x504266[_0x5b4e('0x43')]:_0x24c1dd[_0x5b4e('0x3f')];if(_0x1b4b82[_0x5b4e('0x40')][_0x5b4e('0x4e')]){_0x504266[_0x5b4e('0x4f')]=[{'all':!![]}];}_0x504266=_[_0x5b4e('0x4c')]({},_0x504266,_0x1b4b82[_0x5b4e('0x4d')]);return db['SmsMessage'][_0x5b4e('0x55')](_0x504266)[_0x5b4e('0x21')](handleEntityNotFound(_0x22e4cf,null))[_0x5b4e('0x21')](respondWithResult(_0x22e4cf,null))['catch'](handleError(_0x22e4cf,null));};exports['create']=function(_0x26da8d,_0x512a05){return db['SmsMessage']['create'](_0x26da8d[_0x5b4e('0x56')],{})[_0x5b4e('0x21')](respondWithResult(_0x512a05,0xc9))['catch'](handleError(_0x512a05,null));};exports[_0x5b4e('0x36')]=function(_0x382a54,_0x5e3f06){if(_0x382a54['body']['id']){delete _0x382a54[_0x5b4e('0x56')]['id'];}return db[_0x5b4e('0x50')][_0x5b4e('0x55')]({'where':{'id':_0x382a54['params']['id']}})[_0x5b4e('0x21')](handleEntityNotFound(_0x5e3f06,null))[_0x5b4e('0x21')](saveUpdates(_0x382a54[_0x5b4e('0x56')],null))[_0x5b4e('0x21')](respondWithResult(_0x5e3f06,null))[_0x5b4e('0x52')](handleError(_0x5e3f06,null));};exports['destroy']=function(_0x255ec0,_0x317edc){return db[_0x5b4e('0x50')]['find']({'where':{'id':_0x255ec0[_0x5b4e('0x53')]['id']}})[_0x5b4e('0x21')](handleEntityNotFound(_0x317edc,null))[_0x5b4e('0x21')](removeEntity(_0x317edc,null))[_0x5b4e('0x52')](handleError(_0x317edc,null));};exports[_0x5b4e('0x57')]=function(_0x7ed757,_0x4a261b){return db[_0x5b4e('0x50')][_0x5b4e('0x57')]()['then'](respondWithResult(_0x4a261b,null))[_0x5b4e('0x52')](handleError(_0x4a261b,null));};var interaction_log=require('../../config/logger')(_0x5b4e('0x58'));exports[_0x5b4e('0x59')]=function(_0x2f4581,_0x465bdd,_0xfda9fd){var _0xfa6bf0={'agent':{},'channel':_0x5b4e('0x5a')};if(_0x2f4581[_0x5b4e('0x56')]['id']){delete _0x2f4581[_0x5b4e('0x56')]['id'];}_0x2f4581[_0x5b4e('0x56')][_0x5b4e('0x5b')]=!![];_0x2f4581[_0x5b4e('0x56')]['readAt']=moment()['format'](_0x5b4e('0x5c'));_0x2f4581[_0x5b4e('0x56')]['UserId']=_0x2f4581[_0x5b4e('0x56')][_0x5b4e('0x5d')]||_0x2f4581['user']['id'];_0xfa6bf0[_0x5b4e('0x5e')]['id']=_0x2f4581[_0x5b4e('0x56')][_0x5b4e('0x5d')];return db[_0x5b4e('0x50')][_0x5b4e('0x55')]({'where':{'id':_0x2f4581[_0x5b4e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x465bdd,null))[_0x5b4e('0x21')](saveUpdates(_0x2f4581[_0x5b4e('0x56')],null))[_0x5b4e('0x21')](function(_0x2c9030){if(_0x2c9030){_0xfa6bf0[_0x5b4e('0x28')]=_0x2c9030[_0x5b4e('0x5f')]({'plain':!![]});return db[_0x5b4e('0x60')][_0x5b4e('0x55')]({'where':{'id':_0x2c9030[_0x5b4e('0x61')]}});}return null;})[_0x5b4e('0x21')](handleEntityNotFound(_0x465bdd,null))[_0x5b4e('0x21')](function(_0x583292){if(_0x583292){return _0x583292[_0x5b4e('0x36')]({'UserId':_0x2f4581['body']['UserId'],'read1stAt':_['isNil'](_0x583292[_0x5b4e('0x62')])?moment()[_0x5b4e('0x63')](_0x5b4e('0x5c')):undefined});}return null;})['then'](function(_0x5daf33){if(_0x5daf33){_0xfa6bf0['interaction']=_0x5daf33[_0x5b4e('0x5f')]({'plain':!![]});interaction_log['info'](_0x5b4e('0x64'),_0x2f4581[_0x5b4e('0x65')]['id'],_0x2f4581[_0x5b4e('0x65')][_0x5b4e('0x39')],_0x2f4581[_0x5b4e('0x65')][_0x5b4e('0x66')],_0xfa6bf0[_0x5b4e('0x67')]['id'],_0x2f4581['body']?JSON['stringify'](_0x2f4581[_0x5b4e('0x56')]):_0x5b4e('0x68'));return respondWithRpcPromise(_0x5b4e('0x69'),'acceptMessage',_0xfa6bf0);}return null;})['then'](function(_0x147484){var _0x2df0bf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x147484[_0x5b4e('0x28')][_0x5b4e('0x6a')];return db[_0x5b4e('0x6b')][_0x5b4e('0x40')](_0x2df0bf,{'type':db[_0x5b4e('0x6c')][_0x5b4e('0x6d')][_0x5b4e('0x6e')],'raw':!![]})[_0x5b4e('0x21')](function(_0xdc6f8d){return _0xdc6f8d;});})[_0x5b4e('0x21')](function(_0x3e2a89){if(_0x3e2a89){_0xfa6bf0[_0x5b4e('0x28')][_0x5b4e('0x6f')]=_0x3e2a89[0x0];if(!_0x2f4581[_0x5b4e('0x56')][_0x5b4e('0x5d')])return;return db[_0x5b4e('0x70')][_0x5b4e('0x55')]({'where':{'id':_0x2f4581[_0x5b4e('0x56')][_0x5b4e('0x5d')],'role':'agent'},'attributes':['id',_0x5b4e('0x39'),_0x5b4e('0x71'),_0x5b4e('0x72'),_0x5b4e('0x73')],'raw':!![]});}return null;})['then'](function(_0x414765){if(!_0x414765)return null;_0xfa6bf0['message'][_0x5b4e('0x5e')]=_0x414765;return _0xfa6bf0;})[_0x5b4e('0x21')](function(_0x44e72f){if(_0x44e72f){if(_0x2f4581['body'][_0x5b4e('0x74')]){_0xfa6bf0[_0x5b4e('0x28')][_0x5b4e('0x75')]=util[_0x5b4e('0x63')](_0x5b4e('0x76'),_0x2f4581['user'][_0x5b4e('0x39')]);_0xfa6bf0[_0x5b4e('0x28')][_0x5b4e('0x77')]=_0xfa6bf0['channel'];_0xfa6bf0[_0x5b4e('0x28')][_0x5b4e('0x78')]=_0xfa6bf0['channel'];_0xfa6bf0[_0x5b4e('0x28')]['event']=_0x5b4e('0x59');return respondWithRpcPromise(_0x5b4e('0x79'),_0x5b4e('0x79'),{'event':_0x5b4e('0x7a'),'message':_0xfa6bf0[_0x5b4e('0x28')]},client9002)[_0x5b4e('0x21')](function(){return _0xfa6bf0;});}return _0xfa6bf0;}return null;})[_0x5b4e('0x21')](respondWithResult(_0x465bdd,null))['catch'](handleError(_0x465bdd,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x5b4e('0x34')]=function(_0x44e25c,_0x1a1a0e,_0x1c06da){var _0x3bbf12={'agent':{},'channel':_0x5b4e('0x5a')};if(_0x44e25c[_0x5b4e('0x56')]['id']){delete _0x44e25c['body']['id'];}_0x44e25c[_0x5b4e('0x56')]['UserId']=_0x44e25c[_0x5b4e('0x56')][_0x5b4e('0x5d')]||_0x44e25c[_0x5b4e('0x65')]['id'];_0x3bbf12[_0x5b4e('0x5e')]['id']=_0x44e25c['body']['UserId'];return db['SmsMessage'][_0x5b4e('0x55')]({'where':{'id':_0x44e25c[_0x5b4e('0x53')]['id'],'UserId':null}})[_0x5b4e('0x21')](handleEntityNotFound(_0x1a1a0e,null))[_0x5b4e('0x21')](function(_0xdd7084){if(_0xdd7084){_0x3bbf12['message']=_0xdd7084[_0x5b4e('0x5f')]({'plain':!![]});return db[_0x5b4e('0x60')][_0x5b4e('0x55')]({'where':{'id':_0xdd7084[_0x5b4e('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x1a1a0e,null))[_0x5b4e('0x21')](function(_0x2d4bef){if(_0x2d4bef){_0x3bbf12['interaction']=_0x2d4bef[_0x5b4e('0x5f')]({'plain':!![]});interaction_log[_0x5b4e('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44e25c[_0x5b4e('0x65')]['id'],_0x44e25c[_0x5b4e('0x65')][_0x5b4e('0x39')],_0x44e25c[_0x5b4e('0x65')][_0x5b4e('0x66')],_0x3bbf12[_0x5b4e('0x67')]['id'],_0x44e25c[_0x5b4e('0x56')]?JSON[_0x5b4e('0x26')](_0x44e25c[_0x5b4e('0x56')]):_0x5b4e('0x68'));return respondWithRpcPromise(_0x5b4e('0x7b'),_0x5b4e('0x7c'),_0x3bbf12);}return null;})[_0x5b4e('0x21')](function(_0x502780){var _0x23fe6c=_0x5b4e('0x7d')+_0x502780[_0x5b4e('0x28')][_0x5b4e('0x6a')];return db[_0x5b4e('0x6b')][_0x5b4e('0x40')](_0x23fe6c,{'type':db[_0x5b4e('0x6c')]['QueryTypes'][_0x5b4e('0x6e')],'raw':!![]})[_0x5b4e('0x21')](function(_0x3ef6ee){return _0x3ef6ee;});})[_0x5b4e('0x21')](function(_0x21c540){if(_0x21c540){_0x3bbf12['message'][_0x5b4e('0x6f')]=_0x21c540[0x0];if(!_0x44e25c[_0x5b4e('0x56')][_0x5b4e('0x5d')])return;return db[_0x5b4e('0x70')][_0x5b4e('0x55')]({'where':{'id':_0x44e25c[_0x5b4e('0x56')][_0x5b4e('0x5d')],'role':_0x5b4e('0x5e')},'attributes':['id',_0x5b4e('0x39'),_0x5b4e('0x71'),_0x5b4e('0x72'),'internal'],'raw':!![]});}return null;})[_0x5b4e('0x21')](function(_0x2073ea){if(!_0x2073ea)return null;_0x3bbf12[_0x5b4e('0x28')][_0x5b4e('0x5e')]=_0x2073ea;return _0x3bbf12;})[_0x5b4e('0x21')](function(_0x3039b9){if(_0x3039b9){_0x3039b9[_0x5b4e('0x28')]['interface']=util['format']('SIP/%s',_0x44e25c['user'][_0x5b4e('0x39')]);_0x3039b9[_0x5b4e('0x28')][_0x5b4e('0x77')]=_0x3bbf12[_0x5b4e('0x77')];_0x3039b9[_0x5b4e('0x28')][_0x5b4e('0x78')]=_0x3bbf12[_0x5b4e('0x77')];_0x3039b9['message'][_0x5b4e('0x7e')]=_0x5b4e('0x34');respondWithRpcPromise(_0x5b4e('0x79'),_0x5b4e('0x79'),{'event':_0x5b4e('0x7f'),'message':_0x3039b9['message']},client9002);return _0x3bbf12;}return null;})[_0x5b4e('0x21')](respondWithResult(_0x1a1a0e,null))[_0x5b4e('0x52')](handleError(_0x1a1a0e,null));};exports[_0x5b4e('0x2b')]=function(_0x284ca2,_0x5cbf88,_0x90d088){if(_0x284ca2[_0x5b4e('0x56')]['id']){delete _0x284ca2['body']['id'];}var _0x14e689;return db['SmsMessage']['find']({'where':{'id':_0x284ca2[_0x5b4e('0x53')]['id']}})[_0x5b4e('0x21')](handleEntityNotFound(_0x5cbf88,null))['then'](function(_0x38705b){if(_0x38705b){_0x14e689=_0x38705b;return db[_0x5b4e('0x80')][_0x5b4e('0x55')]({'where':{'id':_0x38705b[_0x5b4e('0x81')]}});}})[_0x5b4e('0x21')](handleEntityNotFound(_0x5cbf88,null))['then'](function(_0x2167c9){if(_0x2167c9){logger[_0x5b4e('0x82')](_0x5b4e('0x25'),_0x5b4e('0x2b'),_0x5b4e('0x83'),_0x2167c9[_0x5b4e('0x3d')],util['inspect'](_0x284ca2[_0x5b4e('0x56')],{'showHidden':![],'depth':null}));switch(_0x2167c9[_0x5b4e('0x3d')]){case'twilio':if(_0x284ca2[_0x5b4e('0x56')][_0x5b4e('0x84')]&&_0x284ca2['body'][_0x5b4e('0x84')]===_0x14e689['messageId']){return _0x14e689[_0x5b4e('0x36')]({'read':!![]});}else{logger[_0x5b4e('0x27')](_0x5b4e('0x85'),_0x5b4e('0x2b'),_0x5b4e('0x86'),util[_0x5b4e('0x87')](_0x284ca2[_0x5b4e('0x56')],{'showHidden':![],'depth':null}));}break;case _0x5b4e('0x88'):if(_0x284ca2[_0x5b4e('0x56')][_0x5b4e('0x89')]&&_0x284ca2[_0x5b4e('0x56')][_0x5b4e('0x89')]===_0x14e689['messageId']&&_[_0x5b4e('0x8a')]([_0x5b4e('0x8b'),_0x5b4e('0x8c')],_0x284ca2[_0x5b4e('0x56')][_0x5b4e('0x8d')])>=0x0){return _0x14e689['update']({'read':!![]});}else{logger[_0x5b4e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5b4e('0x8e'),util[_0x5b4e('0x87')](_0x284ca2[_0x5b4e('0x56')],{'showHidden':![],'depth':null}));}break;case _0x5b4e('0x8f'):var _0x47dc6c=_0x284ca2['body']['results'][0x0];if(_0x47dc6c['status'][_0x5b4e('0x90')]==='DELIVERED'){return _0x14e689[_0x5b4e('0x36')]({'read':!![]});}else{logger[_0x5b4e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b4e('0x2b'),'infobip',util[_0x5b4e('0x87')](_0x284ca2[_0x5b4e('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x14e689;}})[_0x5b4e('0x21')](respondWithResult(_0x5cbf88,null))[_0x5b4e('0x52')](handleError(_0x5cbf88,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 3b4c6b8..542d59d 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 _0xff59=['hook','exports','events','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0xff59,0x122));var _0x9ff5=function(_0x2ca923,_0x2ee32d){_0x2ca923=_0x2ca923-0x0;var _0x47436b=_0xff59[_0x2ca923];return _0x47436b;};'use strict';var EventEmitter=require(_0x9ff5('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x9ff5('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9ff5('0x2')](0x0);var events={'afterCreate':_0x9ff5('0x3'),'afterUpdate':_0x9ff5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212feb){return function(_0x5188b4,_0x16c0e8,_0x1810ba){SmsMessageEvents[_0x9ff5('0x5')](_0x212feb+':'+_0x5188b4['id'],_0x5188b4);SmsMessageEvents[_0x9ff5('0x5')](_0x212feb,_0x5188b4);_0x1810ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x9ff5('0x6')](e,emitEvent(event));}}module[_0x9ff5('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x76fd=['hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x2b11bf,_0x526f96){var _0x237d4b=function(_0x18ad5a){while(--_0x18ad5a){_0x2b11bf['push'](_0x2b11bf['shift']());}};_0x237d4b(++_0x526f96);}(_0x76fd,0x143));var _0xd76f=function(_0x5ddb91,_0x50a3c6){_0x5ddb91=_0x5ddb91-0x0;var _0x222f31=_0x76fd[_0x5ddb91];return _0x222f31;};'use strict';var EventEmitter=require(_0xd76f('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd76f('0x1')](0x0);var events={'afterCreate':_0xd76f('0x2'),'afterUpdate':_0xd76f('0x3'),'afterDestroy':_0xd76f('0x4')};function emitEvent(_0x509f21){return function(_0x50c6eb,_0x4c6160,_0x145256){SmsMessageEvents[_0xd76f('0x5')](_0x509f21+':'+_0x50c6eb['id'],_0x50c6eb);SmsMessageEvents[_0xd76f('0x5')](_0x509f21,_0x50c6eb);_0x145256(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd76f('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f85e4f8..e1637fa 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 _0x4671=['https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','toString','base64','http_code','data','message_id','clickSend','plivo','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Bearer\x20','message','refid','status','intelepeer','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x4671,0x13f));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1467('0x0'));var util=require(_0x1467('0x1'));var logger=require(_0x1467('0x2'))('api');var moment=require(_0x1467('0x3'));var BPromise=require(_0x1467('0x4'));var rp=require(_0x1467('0x5'));var fs=require('fs');var path=require(_0x1467('0x6'));var rimraf=require(_0x1467('0x7'));var config=require(_0x1467('0x8'));var attributes=require(_0x1467('0x9'));module[_0x1467('0xa')]=function(_0x157186,_0xf405b5){return _0x157186[_0x1467('0xb')](_0x1467('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x1467('0xd'),'fields':['messageId']},{'name':_0x1467('0xe'),'fields':[_0x1467('0xf')],'type':_0x1467('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f06a2,_0x5bd4e7,_0x25ab31){var _0x53bea1=_0x157186[_0x1467('0x11')];var _0x8501b7=_0x1f06a2[_0x1467('0x12')]({'plain':!![]});if(_0x8501b7[_0x1467('0x13')]['toLowerCase']()==='in'||_0x8501b7[_0x1467('0x13')]['toLowerCase']()===_0x1467('0x14')&&!_0x8501b7[_0x1467('0x15')]&&!_[_0x1467('0x16')](_0x8501b7[_0x1467('0x17')])&&!_[_0x1467('0x16')](_0x8501b7['SmsInteractionId'])){_0x53bea1[_0x1467('0x18')]['findOne']({'where':{'id':_0x8501b7[_0x1467('0x19')]}})[_0x1467('0x1a')](function(_0x94bc9b){if(_0x94bc9b){_0x94bc9b['update']({'lastMsgAt':_0x8501b7[_0x1467('0x1b')],'lastMsgDirection':_0x8501b7['direction']['toLowerCase']()});}})[_0x1467('0x1c')](function(_0x163a96){console[_0x1467('0x1d')](_0x163a96);});}if(_0x8501b7[_0x1467('0x13')]==='out'&&!_0x8501b7['secret']){var _0x54f272;_0x53bea1['SmsAccount'][_0x1467('0x1e')]({'where':{'id':_0x8501b7[_0x1467('0x1f')]},'raw':!![]})['then'](function(_0x58639c){_0x54f272=_0x58639c;if(_0x54f272&&_0x54f272['type']){switch(_0x54f272[_0x1467('0x20')]){case _0x1467('0x21'):var _0x3bdc5f=require(_0x1467('0x21'));if(_0x54f272['accountSid']&&_0x54f272[_0x1467('0x22')]&&_0x54f272[_0x1467('0x23')]){var _0x542a7e=new _0x3bdc5f(_0x54f272[_0x1467('0x24')],_0x54f272[_0x1467('0x22')]);_0x542a7e[_0x1467('0x25')][_0x1467('0x26')]({'body':_0x8501b7[_0x1467('0xf')],'to':_0x8501b7['phone'],'from':_0x54f272['phone'],'statusCallback':_0x54f272['remote']+_0x1467('0x27')+_0x8501b7['id']+_0x1467('0x28')+_0x54f272[_0x1467('0x29')]})[_0x1467('0x1a')](function(_0xea0f0f){if(_0xea0f0f[_0x1467('0x2a')]){return _0x1f06a2[_0x1467('0x2b')]({'messageId':_0xea0f0f['sid']});}})[_0x1467('0x1c')](function(_0x2978ac){logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x21'),util[_0x1467('0x2e')](_0x2978ac,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x1a6e16=_0x1467('0x2f');if(_0x54f272[_0x1467('0x30')]&&_0x54f272[_0x1467('0x31')]){var _0x29a569={'recipient':[_0x8501b7[_0x1467('0x23')]],'message':_0x8501b7[_0x1467('0xf')],'message_type':_0x54f272['smsMethod']};if(_0x54f272[_0x1467('0x32')]&&_0x54f272['smsMethod']!=='SI'){_0x29a569['sender']=_0x54f272[_0x1467('0x23')];}var _0x427371={'url':_0x1a6e16+_0x1467('0x33')+_0x54f272[_0x1467('0x30')]+_0x1467('0x34')+_0x54f272[_0x1467('0x31')],'method':'GET'};rp(_0x427371)[_0x1467('0x1a')](function(_0x5d5b36){var _0xdf15b6=_0x5d5b36[_0x1467('0x35')](';');var _0x31f920={'user_key':_0xdf15b6[0x0],'session_key':_0xdf15b6[0x1]};_0x427371={'url':_0x1a6e16+_0x1467('0x36'),'method':_0x1467('0x37'),'headers':{'user_key':_0x31f920[_0x1467('0x38')],'Session_key':_0x31f920[_0x1467('0x39')]},'json':!![],'body':_0x29a569};return rp(_0x427371);})['then'](function(_0x85b324){if(_0x85b324['total_sent']>=0x1){var _0x4a0da3={'messageId':_0x85b324[_0x1467('0x3a')]};if(_0x54f272[_0x1467('0x32')]!=='GP'||!_0x54f272[_0x1467('0x3b')]){_0x4a0da3[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x4a0da3);}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate','skebby',util['inspect'](_0x85b324,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49b726){return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x3d'),util[_0x1467('0x2e')](_0x49b726,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),'afterCreate',_0x1467('0x3d'),_0x1467('0x3e'));}break;case _0x1467('0x3f'):if(_0x54f272[_0x1467('0x22')]){var _0x4b2163={'recipient':_0x8501b7[_0x1467('0x23')],'message':_0x8501b7[_0x1467('0xf')],'sender':_0x54f272[_0x1467('0x40')]||_0x54f272[_0x1467('0x23')],'authorization':_0x54f272['authToken']};var _0x5bd4e7={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4b2163,'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x21f43f){var _0x38c922={'messageId':_0x21f43f[_0x1467('0x41')]};if(!_0x54f272[_0x1467('0x3b')]){_0x38c922[_0x1467('0x3c')]=!![];}return _0x1f06a2['update'](_0x38c922);})[_0x1467('0x1c')](function(_0xa725dc){logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1467('0x3f'),util['inspect'](_0xa725dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),'afterCreate','connectel',_0x1467('0x42'));}break;case _0x1467('0x43'):if(_0x54f272[_0x1467('0x30')]&&_0x54f272[_0x1467('0x31')]){var _0x4b2163={'messages':[{'source':'xCALLY\x20Motion','to':_0x8501b7[_0x1467('0x23')],'body':_0x8501b7[_0x1467('0xf')],'from':_0x54f272[_0x1467('0x40')]||_0x54f272['phone']}]};var _0x134f4b=util[_0x1467('0x44')](_0x1467('0x45'),_0x54f272[_0x1467('0x30')],_0x54f272[_0x1467('0x31')]);var _0x5bd4e7={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4b2163,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x121cc7){if(_0x121cc7['http_code']>=0xc8&&_0x121cc7[_0x1467('0x48')]<=0xce){if(_0x121cc7[_0x1467('0x49')]&&_0x121cc7[_0x1467('0x49')]['queued_count']>0x0){var _0x142462=_['head'](_0x121cc7[_0x1467('0x49')][_0x1467('0x25')]);var _0x21d356={'messageId':_0x142462[_0x1467('0x4a')]};if(!_0x54f272[_0x1467('0x3b')]){_0x21d356[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x21d356);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x4b'),util[_0x1467('0x2e')](_0x121cc7,{'showHidden':![],'depth':null}));}}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4b'),util['inspect'](_0x121cc7,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x41dfc2){logger['error'](_0x1467('0x2c'),'afterCreate',_0x1467('0x4b'),util[_0x1467('0x2e')](_0x41dfc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4b'),_0x1467('0x3e'));}break;case _0x1467('0x4c'):if(_0x54f272['authId']&&_0x54f272[_0x1467('0x22')]){var _0x4b2163={'dst':_0x8501b7['phone'],'text':_0x8501b7['body'],'src':_0x54f272['senderString']||_0x54f272[_0x1467('0x23')],'url':_0x54f272[_0x1467('0x4d')]+_0x1467('0x27')+_0x8501b7['id']+'/status?token='+_0x54f272[_0x1467('0x29')]};var _0x134f4b=util[_0x1467('0x44')](_0x1467('0x45'),_0x54f272[_0x1467('0x4e')],_0x54f272[_0x1467('0x22')]);var _0x5bd4e7={'method':_0x1467('0x37'),'uri':util[_0x1467('0x44')](_0x1467('0x4f'),_0x54f272[_0x1467('0x4e')]),'body':_0x4b2163,'headers':{'Authorization':util[_0x1467('0x44')](_0x1467('0x50'),new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x561bde){var _0x2e6bc9={'messageId':_0x561bde[_0x1467('0x51')][0x0]};return _0x1f06a2[_0x1467('0x2b')](_0x2e6bc9);})[_0x1467('0x1c')](function(_0x5a55a1){logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),'plivo',util[_0x1467('0x2e')](_0x5a55a1,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x4c'),_0x1467('0x52'));}break;case _0x1467('0x53'):if(_0x54f272['username']&&_0x54f272['password']){if(_0x54f272['baseUrl']){var _0x4204bd={'method':_0x1467('0x37'),'uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x55'),'body':{'username':_0x54f272['username'],'password':_0x54f272[_0x1467('0x31')]},'json':!![]};return rp(_0x4204bd)[_0x1467('0x1a')](function(_0x5d74af){var _0x37312b={'method':'POST','uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x56'),'body':{'messages':[{'from':_0x54f272[_0x1467('0x23')],'destinations':[{'to':_0x8501b7[_0x1467('0x23')]}],'text':_0x8501b7[_0x1467('0xf')],'notifyUrl':_0x54f272[_0x1467('0x4d')]+'/api/sms/messages/'+_0x8501b7['id']+_0x1467('0x28')+_0x54f272[_0x1467('0x29')],'notifyContentType':_0x1467('0x57'),'callbackData':_0x54f272[_0x1467('0x23')]+';'+_0x8501b7[_0x1467('0xf')]}]},'headers':{'Authorization':_0x1467('0x58')+_0x5d74af[_0x1467('0x29')]},'json':!![]};return rp(_0x37312b)[_0x1467('0x1a')](function(_0x336c9a){if(_0x336c9a[_0x1467('0x25')]){var _0xa4c945={'messageId':_0x336c9a[_0x1467('0x25')][0x0][_0x1467('0xd')]};if(!_0x54f272[_0x1467('0x3b')]){_0xa4c945['read']=!![];}return _0x1f06a2[_0x1467('0x2b')](_0xa4c945);}else{return logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),util[_0x1467('0x2e')](_0x336c9a,{'showHidden':![],'depth':null}));}});})[_0x1467('0x1c')](function(_0x1cefe6){return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x53'),util[_0x1467('0x2e')](_0x1cefe6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),_0x1467('0x59'));}}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x53'),_0x1467('0x3e'));}break;case'csc':var _0x5c1f50=require(_0x1467('0x5a'));if(_0x54f272[_0x1467('0x5b')]){var _0x212673={};_0x212673[_0x1467('0x5c')]=_0x54f272['username'];_0x212673['phone']=_0x8501b7['phone'];_0x212673[_0x1467('0x5d')]=_0x54f272[_0x1467('0x23')];_0x212673['text']=_0x8501b7[_0x1467('0xf')];_0x212673[_0x1467('0x5e')]=+new Date();var _0x5e128f='';var _0x566cbe='';var _0x25255d=Object[_0x1467('0x5f')](_0x212673);_0x25255d[_0x1467('0x60')]();for(var _0x38c21a=0x0;_0x38c21a<_0x25255d[_0x1467('0x61')];_0x38c21a++){if(_0x5e128f!=''){_0x5e128f+='&';}_0x5e128f+=_0x25255d[_0x38c21a]+'='+encodeURIComponent(_0x212673[_0x25255d[_0x38c21a]]);_0x566cbe+=_0x212673[_0x25255d[_0x38c21a]];}_0x566cbe+=_0x54f272[_0x1467('0x5b')];_0x566cbe=_0x5c1f50[_0x1467('0x62')](_0x1467('0x63'))[_0x1467('0x2b')](_0x566cbe)[_0x1467('0x64')](_0x1467('0x65'));if(_0x5e128f!==''){_0x5e128f+='&';}_0x5e128f+=_0x1467('0x66')+_0x566cbe;var _0x427371={'method':'GET','uri':_0x54f272[_0x1467('0x54')]+_0x1467('0x67')+_0x5e128f,'json':!![]};return rp(_0x427371)[_0x1467('0x1a')](function(_0xcc1c2a){var _0x3cb56c=Object[_0x1467('0x5f')](_0xcc1c2a);if(_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x1d')]&&parseInt(_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x1d')])===0x0){var _0x1130a6={'messageId':_0xcc1c2a[_0x3cb56c[0x0]][_0x1467('0x68')]};if(!_0x54f272['deliveryReport']){_0x1130a6['read']=!![];}return _0x1f06a2['update'](_0x1130a6);}else{return logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x69'),util[_0x1467('0x2e')](_0xcc1c2a[_0x1467('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x3110df){return logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x69'),util[_0x1467('0x2e')](_0x3110df,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1467('0x2d'),_0x1467('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0x1467('0x6a'):if(_0x54f272[_0x1467('0x5b')]){var _0x29385f={'method':_0x1467('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x54f272[_0x1467('0x5b')]},'body':{'content':_0x8501b7[_0x1467('0xf')],'to':[_0x8501b7['phone']],'from':_0x54f272[_0x1467('0x23')],'binary':![],'clientMessageId':_0x1467('0x6b'),'charset':_0x1467('0x6c')},'json':!![]};rp(_0x29385f)['then'](function(_0x457863){if(!_0x457863[_0x1467('0x1d')]){var _0x1ae521={'messageId':_0x457863['messages'][0x0][_0x1467('0x6d')]};if(!_0x54f272[_0x1467('0x3b')]){_0x1ae521[_0x1467('0x3c')]=!![];}return _0x1f06a2[_0x1467('0x2b')](_0x1ae521);}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x6a'),util[_0x1467('0x2e')](_0x457863[_0x1467('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x366135){return logger[_0x1467('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x1467('0x2e')](_0x366135,{'showHidden':![],'depth':null}));});}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x6a'),_0x1467('0x6e'));}break;case _0x1467('0x6f'):if(_0x54f272['username']&&_0x54f272[_0x1467('0x31')]){var _0x134f4b=util[_0x1467('0x44')]('%s:%s',_0x54f272[_0x1467('0x30')],_0x54f272[_0x1467('0x31')]);var _0x5bd4e7={'method':_0x1467('0x37'),'uri':_0x1467('0x70')+_0x54f272[_0x1467('0x71')]+_0x1467('0x72'),'body':{'to':[_0x8501b7[_0x1467('0x23')]],'text':_0x8501b7['body'],'from':_0x54f272['phone'],'applicationId':_0x54f272[_0x1467('0x73')]},'headers':{'Authorization':util[_0x1467('0x44')](_0x1467('0x50'),new Buffer(_0x134f4b)[_0x1467('0x46')](_0x1467('0x47')))},'json':!![]};rp(_0x5bd4e7)[_0x1467('0x1a')](function(_0x524068){if(_0x524068['id']){var _0x80ee2a={'messageId':_0x524068['id']};return _0x1f06a2[_0x1467('0x2b')](_0x80ee2a);}else{logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x6f'),util[_0x1467('0x2e')](_0x524068,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x2afcfa){logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x6f'),util[_0x1467('0x2e')](_0x2afcfa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),'bandwidth',_0x1467('0x3e'));}break;case'intelepeer':if(_0x54f272['apiKey']){var _0x3f2ea7={};var _0x427371={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x1467('0x74')+_0x54f272['apiKey'],'Content-Type':_0x1467('0x57')},'body':{'from':_0x54f272['phone'],'to':_0x8501b7[_0x1467('0x23')],'text':_0x8501b7[_0x1467('0xf')]},'json':!![]};return rp(_0x427371)[_0x1467('0x1a')](function(_0x2572e9){if(_0x2572e9['code']==0xca){_0x3f2ea7[_0x1467('0x75')]=_0x2572e9;var _0x440b0c={'method':_0x1467('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1467('0x74')+_0x54f272[_0x1467('0x5b')],'Content-Type':_0x1467('0x57')},'body':{'refid':_0x3f2ea7[_0x1467('0x75')][_0x1467('0x76')]},'json':!![]};return rp(_0x440b0c)[_0x1467('0x1a')](function(_0x2e3f67){_0x3f2ea7[_0x1467('0x77')]=_0x2e3f67;var _0x18e2eb={'messageId':_0x3f2ea7['message'][_0x1467('0x76')],'read':!![]};return _0x1f06a2['update'](_0x18e2eb);});}else{return logger[_0x1467('0x1d')](_0x1467('0x2c'),'afterCreate',_0x1467('0x78'),util[_0x1467('0x2e')](_0x2572e9,{'showHidden':![],'depth':null}));}})[_0x1467('0x1c')](function(_0x4d9325){return logger[_0x1467('0x1d')](_0x1467('0x2c'),_0x1467('0x2d'),_0x1467('0x78'),util[_0x1467('0x2e')](_0x4d9325,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x1467('0x2c'),_0x1467('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x25ab31();});}else{_0x25ab31();}}},'charset':_0x1467('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6f17=['bluebird','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','models','get','direction','toLowerCase','out','isNil','UserId','findOne','SmsInteractionId','then','update','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','messages','message_id','clickSend','plivo','authId','/status?token=','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','crypto','apiKey','sender','text','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x36b0ab,_0x364bea){var _0x2d8532=function(_0x19308e){while(--_0x19308e){_0x36b0ab['push'](_0x36b0ab['shift']());}};_0x2d8532(++_0x364bea);}(_0x6f17,0x74));var _0x76f1=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x6f17[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x76f1('0x0'));var util=require(_0x76f1('0x1'));var logger=require('../../config/logger')(_0x76f1('0x2'));var moment=require(_0x76f1('0x3'));var BPromise=require(_0x76f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76f1('0x5'));var config=require(_0x76f1('0x6'));var attributes=require(_0x76f1('0x7'));module['exports']=function(_0x2cfd8a,_0x2c18f0){return _0x2cfd8a['define'](_0x76f1('0x8'),attributes,{'tableName':_0x76f1('0x9'),'paranoid':![],'indexes':[{'name':_0x76f1('0xa'),'fields':[_0x76f1('0xa')]},{'name':'fti_sms_messages','fields':[_0x76f1('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d7d2e,_0x24a425,_0x121afd){var _0xf38e36=_0x2cfd8a[_0x76f1('0xc')];var _0x142490=_0x5d7d2e[_0x76f1('0xd')]({'plain':!![]});if(_0x142490[_0x76f1('0xe')][_0x76f1('0xf')]()==='in'||_0x142490[_0x76f1('0xe')]['toLowerCase']()===_0x76f1('0x10')&&!_0x142490['secret']&&!_[_0x76f1('0x11')](_0x142490[_0x76f1('0x12')])&&!_[_0x76f1('0x11')](_0x142490['SmsInteractionId'])){_0xf38e36['SmsInteraction'][_0x76f1('0x13')]({'where':{'id':_0x142490[_0x76f1('0x14')]}})[_0x76f1('0x15')](function(_0x2b6895){if(_0x2b6895){_0x2b6895[_0x76f1('0x16')]({'lastMsgAt':_0x142490['createdAt'],'lastMsgDirection':_0x142490[_0x76f1('0xe')][_0x76f1('0xf')]()});}})[_0x76f1('0x17')](function(_0x5e32b6){console[_0x76f1('0x18')](_0x5e32b6);});}if(_0x142490[_0x76f1('0xe')]===_0x76f1('0x10')&&!_0x142490[_0x76f1('0x19')]){var _0x346135;_0xf38e36[_0x76f1('0x1a')][_0x76f1('0x1b')]({'where':{'id':_0x142490[_0x76f1('0x1c')]},'raw':!![]})['then'](function(_0x5a4a74){_0x346135=_0x5a4a74;if(_0x346135&&_0x346135[_0x76f1('0x1d')]){switch(_0x346135[_0x76f1('0x1d')]){case'twilio':var _0x1cdbb4=require(_0x76f1('0x1e'));if(_0x346135[_0x76f1('0x1f')]&&_0x346135[_0x76f1('0x20')]&&_0x346135['phone']){var _0x591d04=new _0x1cdbb4(_0x346135[_0x76f1('0x1f')],_0x346135[_0x76f1('0x20')]);_0x591d04['messages'][_0x76f1('0x21')]({'body':_0x142490['body'],'to':_0x142490[_0x76f1('0x22')],'from':_0x346135[_0x76f1('0x22')],'statusCallback':_0x346135[_0x76f1('0x23')]+_0x76f1('0x24')+_0x142490['id']+'/status?token='+_0x346135[_0x76f1('0x25')]})[_0x76f1('0x15')](function(_0x13c556){if(_0x13c556[_0x76f1('0x26')]){return _0x5d7d2e['update']({'messageId':_0x13c556['sid']});}})[_0x76f1('0x17')](function(_0x491f2f){logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x1e'),util[_0x76f1('0x28')](_0x491f2f,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),_0x76f1('0x1e'),_0x76f1('0x2a'));}break;case _0x76f1('0x2b'):var _0x1c03b7=_0x76f1('0x2c');if(_0x346135[_0x76f1('0x2d')]&&_0x346135[_0x76f1('0x2e')]){var _0x4ddcc8={'recipient':[_0x142490[_0x76f1('0x22')]],'message':_0x142490[_0x76f1('0xb')],'message_type':_0x346135[_0x76f1('0x2f')]};if(_0x346135[_0x76f1('0x2f')]&&_0x346135[_0x76f1('0x2f')]!=='SI'){_0x4ddcc8['sender']=_0x346135['phone'];}var _0x4eb609={'url':_0x1c03b7+_0x76f1('0x30')+_0x346135[_0x76f1('0x2d')]+_0x76f1('0x31')+_0x346135[_0x76f1('0x2e')],'method':_0x76f1('0x32')};rp(_0x4eb609)[_0x76f1('0x15')](function(_0x322587){var _0x18a778=_0x322587[_0x76f1('0x33')](';');var _0x5c3697={'user_key':_0x18a778[0x0],'session_key':_0x18a778[0x1]};_0x4eb609={'url':_0x1c03b7+_0x76f1('0x34'),'method':_0x76f1('0x35'),'headers':{'user_key':_0x5c3697['user_key'],'Session_key':_0x5c3697[_0x76f1('0x36')]},'json':!![],'body':_0x4ddcc8};return rp(_0x4eb609);})[_0x76f1('0x15')](function(_0x977d4d){if(_0x977d4d[_0x76f1('0x37')]>=0x1){var _0x36576b={'messageId':_0x977d4d[_0x76f1('0x38')]};if(_0x346135['smsMethod']!=='GP'||!_0x346135[_0x76f1('0x39')]){_0x36576b['read']=!![];}return _0x5d7d2e['update'](_0x36576b);}else{return logger['error'](_0x76f1('0x27'),'afterCreate',_0x76f1('0x2b'),util[_0x76f1('0x28')](_0x977d4d,{'showHidden':![],'depth':null}));}})[_0x76f1('0x17')](function(_0x3ffdd0){return logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x2b'),util['inspect'](_0x3ffdd0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x76f1('0x3a'):if(_0x346135[_0x76f1('0x20')]){var _0x431fb1={'recipient':_0x142490[_0x76f1('0x22')],'message':_0x142490[_0x76f1('0xb')],'sender':_0x346135[_0x76f1('0x3b')]||_0x346135[_0x76f1('0x22')],'authorization':_0x346135[_0x76f1('0x20')]};var _0x24a425={'method':_0x76f1('0x35'),'uri':_0x76f1('0x3c'),'body':_0x431fb1,'json':!![]};rp(_0x24a425)[_0x76f1('0x15')](function(_0x4b30d1){var _0x46babf={'messageId':_0x4b30d1['requestid']};if(!_0x346135[_0x76f1('0x39')]){_0x46babf[_0x76f1('0x3d')]=!![];}return _0x5d7d2e['update'](_0x46babf);})[_0x76f1('0x17')](function(_0x27beeb){logger['error'](_0x76f1('0x27'),_0x76f1('0x29'),'connectel',util[_0x76f1('0x28')](_0x27beeb,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),'connectel',_0x76f1('0x3e'));}break;case'clicksend':if(_0x346135[_0x76f1('0x2d')]&&_0x346135[_0x76f1('0x2e')]){var _0x431fb1={'messages':[{'source':_0x76f1('0x3f'),'to':_0x142490['phone'],'body':_0x142490['body'],'from':_0x346135[_0x76f1('0x3b')]||_0x346135[_0x76f1('0x22')]}]};var _0x2b53ff=util[_0x76f1('0x40')](_0x76f1('0x41'),_0x346135[_0x76f1('0x2d')],_0x346135[_0x76f1('0x2e')]);var _0x24a425={'method':_0x76f1('0x35'),'uri':_0x76f1('0x42'),'body':_0x431fb1,'headers':{'Authorization':util[_0x76f1('0x40')](_0x76f1('0x43'),new Buffer(_0x2b53ff)[_0x76f1('0x44')](_0x76f1('0x45')))},'json':!![]};rp(_0x24a425)[_0x76f1('0x15')](function(_0x1a1631){if(_0x1a1631[_0x76f1('0x46')]>=0xc8&&_0x1a1631[_0x76f1('0x46')]<=0xce){if(_0x1a1631[_0x76f1('0x47')]&&_0x1a1631['data']['queued_count']>0x0){var _0x54446b=_[_0x76f1('0x48')](_0x1a1631[_0x76f1('0x47')][_0x76f1('0x49')]);var _0x26f502={'messageId':_0x54446b[_0x76f1('0x4a')]};if(!_0x346135['deliveryReport']){_0x26f502[_0x76f1('0x3d')]=!![];}return _0x5d7d2e[_0x76f1('0x16')](_0x26f502);}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x4b'),util['inspect'](_0x1a1631,{'showHidden':![],'depth':null}));}}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x4b'),util[_0x76f1('0x28')](_0x1a1631,{'showHidden':![],'depth':null}));}})[_0x76f1('0x17')](function(_0x5a2ac0){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),_0x76f1('0x4b'),util[_0x76f1('0x28')](_0x5a2ac0,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x4b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x76f1('0x4c'):if(_0x346135[_0x76f1('0x4d')]&&_0x346135[_0x76f1('0x20')]){var _0x431fb1={'dst':_0x142490[_0x76f1('0x22')],'text':_0x142490['body'],'src':_0x346135[_0x76f1('0x3b')]||_0x346135['phone'],'url':_0x346135[_0x76f1('0x23')]+_0x76f1('0x24')+_0x142490['id']+_0x76f1('0x4e')+_0x346135[_0x76f1('0x25')]};var _0x2b53ff=util[_0x76f1('0x40')](_0x76f1('0x41'),_0x346135['authId'],_0x346135[_0x76f1('0x20')]);var _0x24a425={'method':_0x76f1('0x35'),'uri':util[_0x76f1('0x40')]('https://api.plivo.com/v1/Account/%s/Message/',_0x346135[_0x76f1('0x4d')]),'body':_0x431fb1,'headers':{'Authorization':util[_0x76f1('0x40')](_0x76f1('0x43'),new Buffer(_0x2b53ff)['toString']('base64'))},'json':!![]};rp(_0x24a425)[_0x76f1('0x15')](function(_0x5a3b0f){var _0xc7bec={'messageId':_0x5a3b0f['message_uuid'][0x0]};return _0x5d7d2e[_0x76f1('0x16')](_0xc7bec);})[_0x76f1('0x17')](function(_0x29860c){logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x4c'),util['inspect'](_0x29860c,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x4c'),_0x76f1('0x4f'));}break;case _0x76f1('0x50'):if(_0x346135[_0x76f1('0x2d')]&&_0x346135[_0x76f1('0x2e')]){if(_0x346135[_0x76f1('0x51')]){var _0x48e442={'method':_0x76f1('0x35'),'uri':_0x346135[_0x76f1('0x51')]+'/auth/1/session','body':{'username':_0x346135[_0x76f1('0x2d')],'password':_0x346135['password']},'json':!![]};return rp(_0x48e442)[_0x76f1('0x15')](function(_0x104ac5){var _0x480ef0={'method':_0x76f1('0x35'),'uri':_0x346135['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x346135[_0x76f1('0x22')],'destinations':[{'to':_0x142490[_0x76f1('0x22')]}],'text':_0x142490[_0x76f1('0xb')],'notifyUrl':_0x346135['remote']+'/api/sms/messages/'+_0x142490['id']+'/status?token='+_0x346135[_0x76f1('0x25')],'notifyContentType':_0x76f1('0x52'),'callbackData':_0x346135['phone']+';'+_0x142490['body']}]},'headers':{'Authorization':_0x76f1('0x53')+_0x104ac5[_0x76f1('0x25')]},'json':!![]};return rp(_0x480ef0)[_0x76f1('0x15')](function(_0x2ddc35){if(_0x2ddc35[_0x76f1('0x49')]){var _0x1a1520={'messageId':_0x2ddc35[_0x76f1('0x49')][0x0][_0x76f1('0xa')]};if(!_0x346135[_0x76f1('0x39')]){_0x1a1520[_0x76f1('0x3d')]=!![];}return _0x5d7d2e[_0x76f1('0x16')](_0x1a1520);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),'infobip',util[_0x76f1('0x28')](_0x2ddc35,{'showHidden':![],'depth':null}));}});})[_0x76f1('0x17')](function(_0x2feae6){return logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x50'),util[_0x76f1('0x28')](_0x2feae6,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x50'),_0x76f1('0x54'));}}else{logger[_0x76f1('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),'infobip',_0x76f1('0x55'));}break;case'csc':var _0x154fd8=require(_0x76f1('0x56'));if(_0x346135[_0x76f1('0x57')]){var _0x59cc09={};_0x59cc09['login']=_0x346135[_0x76f1('0x2d')];_0x59cc09[_0x76f1('0x22')]=_0x142490[_0x76f1('0x22')];_0x59cc09[_0x76f1('0x58')]=_0x346135['phone'];_0x59cc09[_0x76f1('0x59')]=_0x142490[_0x76f1('0xb')];_0x59cc09['timestamp']=+new Date();var _0xa879b='';var _0x54f170='';var _0x11356f=Object['keys'](_0x59cc09);_0x11356f[_0x76f1('0x5a')]();for(var _0x4880f9=0x0;_0x4880f9<_0x11356f[_0x76f1('0x5b')];_0x4880f9++){if(_0xa879b!=''){_0xa879b+='&';}_0xa879b+=_0x11356f[_0x4880f9]+'='+encodeURIComponent(_0x59cc09[_0x11356f[_0x4880f9]]);_0x54f170+=_0x59cc09[_0x11356f[_0x4880f9]];}_0x54f170+=_0x346135[_0x76f1('0x57')];_0x54f170=_0x154fd8[_0x76f1('0x5c')](_0x76f1('0x5d'))[_0x76f1('0x16')](_0x54f170)[_0x76f1('0x5e')](_0x76f1('0x5f'));if(_0xa879b!==''){_0xa879b+='&';}_0xa879b+=_0x76f1('0x60')+_0x54f170;var _0x4eb609={'method':_0x76f1('0x32'),'uri':_0x346135[_0x76f1('0x51')]+_0x76f1('0x61')+_0xa879b,'json':!![]};return rp(_0x4eb609)[_0x76f1('0x15')](function(_0x59de4d){var _0x13059e=Object[_0x76f1('0x62')](_0x59de4d);if(_0x59de4d[_0x13059e[0x0]][_0x76f1('0x18')]&&parseInt(_0x59de4d[_0x13059e[0x0]]['error'])===0x0){var _0x154c38={'messageId':_0x59de4d[_0x13059e[0x0]][_0x76f1('0x63')]};if(!_0x346135[_0x76f1('0x39')]){_0x154c38[_0x76f1('0x3d')]=!![];}return _0x5d7d2e['update'](_0x154c38);}else{return logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x64'),util[_0x76f1('0x28')](_0x59de4d[_0x76f1('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x38ccce){return logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x64'),util[_0x76f1('0x28')](_0x38ccce,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x76f1('0x65'):if(_0x346135[_0x76f1('0x57')]){var _0x51a46b={'method':_0x76f1('0x35'),'uri':_0x76f1('0x66'),'headers':{'Authorization':_0x346135[_0x76f1('0x57')]},'body':{'content':_0x142490[_0x76f1('0xb')],'to':[_0x142490[_0x76f1('0x22')]],'from':_0x346135[_0x76f1('0x22')],'binary':![],'clientMessageId':_0x76f1('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x51a46b)['then'](function(_0x43490a){if(!_0x43490a[_0x76f1('0x18')]){var _0x122d7b={'messageId':_0x43490a['messages'][0x0]['apiMessageId']};if(!_0x346135[_0x76f1('0x39')]){_0x122d7b[_0x76f1('0x3d')]=!![];}return _0x5d7d2e[_0x76f1('0x16')](_0x122d7b);}else{return logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x65'),util[_0x76f1('0x28')](_0x43490a['error'],{'showHidden':![],'depth':null}));}})[_0x76f1('0x17')](function(_0x1a168e){return logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x65'),util['inspect'](_0x1a168e,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x65'),_0x76f1('0x68'));}break;case _0x76f1('0x69'):if(_0x346135[_0x76f1('0x2d')]&&_0x346135['password']){var _0x2b53ff=util['format']('%s:%s',_0x346135[_0x76f1('0x2d')],_0x346135[_0x76f1('0x2e')]);var _0x24a425={'method':'POST','uri':_0x76f1('0x6a')+_0x346135[_0x76f1('0x6b')]+_0x76f1('0x6c'),'body':{'to':[_0x142490[_0x76f1('0x22')]],'text':_0x142490[_0x76f1('0xb')],'from':_0x346135[_0x76f1('0x22')],'applicationId':_0x346135[_0x76f1('0x6d')]},'headers':{'Authorization':util[_0x76f1('0x40')]('Basic\x20%s',new Buffer(_0x2b53ff)[_0x76f1('0x44')](_0x76f1('0x45')))},'json':!![]};rp(_0x24a425)[_0x76f1('0x15')](function(_0x22ae5e){if(_0x22ae5e['id']){var _0x3bc9bd={'messageId':_0x22ae5e['id']};return _0x5d7d2e[_0x76f1('0x16')](_0x3bc9bd);}else{logger[_0x76f1('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),'bandwidth',util[_0x76f1('0x28')](_0x22ae5e,{'showHidden':![],'depth':null}));}})[_0x76f1('0x17')](function(_0x14f89f){logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x69'),util[_0x76f1('0x28')](_0x14f89f,{'showHidden':![],'depth':null}));});}else{logger[_0x76f1('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76f1('0x29'),_0x76f1('0x69'),_0x76f1('0x55'));}break;case _0x76f1('0x6e'):if(_0x346135[_0x76f1('0x57')]){var _0xfdfb86={};var _0x4eb609={'method':'POST','uri':_0x76f1('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x346135[_0x76f1('0x57')],'Content-Type':_0x76f1('0x52')},'body':{'from':_0x346135[_0x76f1('0x22')],'to':_0x142490[_0x76f1('0x22')],'text':_0x142490['body']},'json':!![]};return rp(_0x4eb609)[_0x76f1('0x15')](function(_0x53cf2a){if(_0x53cf2a[_0x76f1('0x70')]==0xca){_0xfdfb86[_0x76f1('0x71')]=_0x53cf2a;var _0x2e9857={'method':_0x76f1('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x76f1('0x72')+_0x346135[_0x76f1('0x57')],'Content-Type':_0x76f1('0x52')},'body':{'refid':_0xfdfb86['message'][_0x76f1('0x73')]},'json':!![]};return rp(_0x2e9857)['then'](function(_0x5bd175){_0xfdfb86[_0x76f1('0x74')]=_0x5bd175;var _0xbd8a09={'messageId':_0xfdfb86['message'][_0x76f1('0x73')],'read':!![]};return _0x5d7d2e[_0x76f1('0x16')](_0xbd8a09);});}else{return logger['error'](_0x76f1('0x27'),'afterCreate',_0x76f1('0x6e'),util[_0x76f1('0x28')](_0x53cf2a,{'showHidden':![],'depth':null}));}})[_0x76f1('0x17')](function(_0x1a7073){return logger[_0x76f1('0x18')](_0x76f1('0x27'),_0x76f1('0x29'),_0x76f1('0x6e'),util[_0x76f1('0x28')](_0x1a7073,{'showHidden':![],'depth':null}));});}else{return logger[_0x76f1('0x18')](_0x76f1('0x27'),'afterCreate',_0x76f1('0x6e'),_0x76f1('0x75'));}break;}}})['finally'](function(){_0x121afd();});}else{_0x121afd();}}},'charset':_0x76f1('0x76'),'collate':_0x76f1('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index df4ed1e..8d33354 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 _0xa204=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','request\x20sent','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','create','raw','then','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xa204,0xa0));var _0x4a20=function(_0x55f3b2,_0x533f6d){_0x55f3b2=_0x55f3b2-0x0;var _0x35da7a=_0xa204[_0x55f3b2];return _0x35da7a;};'use strict';var _=require(_0x4a20('0x0'));var util=require(_0x4a20('0x1'));var moment=require(_0x4a20('0x2'));var BPromise=require(_0x4a20('0x3'));var rs=require(_0x4a20('0x4'));var fs=require('fs');var Redis=require(_0x4a20('0x5'));var db=require(_0x4a20('0x6'))['db'];var utils=require(_0x4a20('0x7'));var logger=require('../../config/logger')(_0x4a20('0x8'));var config=require(_0x4a20('0x9'));var jayson=require(_0x4a20('0xa'));var client=jayson[_0x4a20('0xb')][_0x4a20('0xc')]({'port':0x232a});config[_0x4a20('0xd')]=_[_0x4a20('0xe')](config['redis'],{'host':_0x4a20('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a20('0xd')]));require('./smsMessage.socket')[_0x4a20('0x10')](socket);function respondWithRpcPromise(_0x201260,_0x283a95,_0x2b1066){return new BPromise(function(_0xebf9dd,_0x1f629b){return client[_0x4a20('0x11')](_0x201260,_0x2b1066)['then'](function(_0x4e46b3){logger[_0x4a20('0x12')]('SmsMessage,\x20%s,\x20%s',_0x283a95,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x283a95,_0x4a20('0x13'),JSON['stringify'](_0x4e46b3));if(_0x4e46b3[_0x4a20('0x14')]){if(_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x15')]===0x1f4){logger[_0x4a20('0x14')]('SmsMessage,\x20%s,\x20%s',_0x283a95,_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);return _0x1f629b(_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);}logger[_0x4a20('0x14')]('SmsMessage,\x20%s,\x20%s',_0x283a95,_0x4e46b3[_0x4a20('0x14')][_0x4a20('0x16')]);return _0xebf9dd(_0x4e46b3['error'][_0x4a20('0x16')]);}else{logger[_0x4a20('0x12')](_0x4a20('0x17'),_0x283a95,_0x4a20('0x13'));_0xebf9dd(_0x4e46b3[_0x4a20('0x18')][_0x4a20('0x16')]);}})[_0x4a20('0x19')](function(_0xdcf79b){logger[_0x4a20('0x14')](_0x4a20('0x17'),_0x283a95,_0xdcf79b);_0x1f629b(_0xdcf79b);});});}exports[_0x4a20('0x1a')]=function(_0x605c6){var _0x299d7e=this;return new Promise(function(_0x8ab856,_0xb7870){return db[_0x4a20('0x1b')][_0x4a20('0x1c')](_0x605c6['body'],{'raw':_0x605c6['options']?_0x605c6['options'][_0x4a20('0x1d')]===undefined?!![]:![]:!![]})[_0x4a20('0x1e')](function(_0x270011){logger[_0x4a20('0x12')]('CreateSmsMessage',_0x605c6);logger[_0x4a20('0x1f')](_0x4a20('0x1a'),_0x605c6,JSON[_0x4a20('0x20')](_0x270011));_0x8ab856(_0x270011);})[_0x4a20('0x19')](function(_0x1b08d6){logger['error'](_0x4a20('0x1a'),_0x1b08d6[_0x4a20('0x16')],_0x605c6);_0xb7870(_0x299d7e['error'](0x1f4,_0x1b08d6[_0x4a20('0x16')]));});});}; \ No newline at end of file +var _0x8ff8=['localhost','socket.io-emitter','redis','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','defaults'];(function(_0x22193e,_0x2ae001){var _0x10c378=function(_0x411e3f){while(--_0x411e3f){_0x22193e['push'](_0x22193e['shift']());}};_0x10c378(++_0x2ae001);}(_0x8ff8,0x7b));var _0x88ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ff8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x88ff('0x0'));var moment=require(_0x88ff('0x1'));var BPromise=require(_0x88ff('0x2'));var rs=require(_0x88ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x88ff('0x5'));var jayson=require(_0x88ff('0x6'));var client=jayson[_0x88ff('0x7')]['http']({'port':0x232a});config['redis']=_[_0x88ff('0x8')](config['redis'],{'host':_0x88ff('0x9'),'port':0x18eb});var socket=require(_0x88ff('0xa'))(new Redis(config[_0x88ff('0xb')]));require(_0x88ff('0xc'))[_0x88ff('0xd')](socket);function respondWithRpcPromise(_0x4ef7d0,_0x2ecfb6,_0x3dd585){return new BPromise(function(_0x122c39,_0x5258c0){return client[_0x88ff('0xe')](_0x4ef7d0,_0x3dd585)[_0x88ff('0xf')](function(_0x1dd663){logger[_0x88ff('0x10')](_0x88ff('0x11'),_0x2ecfb6,_0x88ff('0x12'));logger[_0x88ff('0x13')](_0x88ff('0x14'),_0x2ecfb6,_0x88ff('0x12'),JSON[_0x88ff('0x15')](_0x1dd663));if(_0x1dd663[_0x88ff('0x16')]){if(_0x1dd663[_0x88ff('0x16')][_0x88ff('0x17')]===0x1f4){logger[_0x88ff('0x16')](_0x88ff('0x11'),_0x2ecfb6,_0x1dd663[_0x88ff('0x16')]['message']);return _0x5258c0(_0x1dd663['error']['message']);}logger['error'](_0x88ff('0x11'),_0x2ecfb6,_0x1dd663['error'][_0x88ff('0x18')]);return _0x122c39(_0x1dd663[_0x88ff('0x16')][_0x88ff('0x18')]);}else{logger['info'](_0x88ff('0x11'),_0x2ecfb6,_0x88ff('0x12'));_0x122c39(_0x1dd663[_0x88ff('0x19')][_0x88ff('0x18')]);}})['catch'](function(_0x5558a0){logger['error'](_0x88ff('0x11'),_0x2ecfb6,_0x5558a0);_0x5258c0(_0x5558a0);});});}exports[_0x88ff('0x1a')]=function(_0x2906a3){var _0x4a62b5=this;return new Promise(function(_0x41f2b6,_0x2e6b3b){return db[_0x88ff('0x1b')][_0x88ff('0x1c')](_0x2906a3[_0x88ff('0x1d')],{'raw':_0x2906a3[_0x88ff('0x1e')]?_0x2906a3['options'][_0x88ff('0x1f')]===undefined?!![]:![]:!![]})[_0x88ff('0xf')](function(_0x3e89ae){logger['info'](_0x88ff('0x1a'),_0x2906a3);logger['debug'](_0x88ff('0x1a'),_0x2906a3,JSON[_0x88ff('0x15')](_0x3e89ae));_0x41f2b6(_0x3e89ae);})[_0x88ff('0x20')](function(_0x62c562){logger[_0x88ff('0x16')]('CreateSmsMessage',_0x62c562[_0x88ff('0x18')],_0x2906a3);_0x2e6b3b(_0x4a62b5[_0x88ff('0x16')](0x1f4,_0x62c562[_0x88ff('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d42de93..ac68040 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 _0xcee8=['save','removeListener','length'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xcee8,0xcf));var _0x8cee=function(_0x4edf07,_0x145026){_0x4edf07=_0x4edf07-0x0;var _0x2a6c20=_0xcee8[_0x4edf07];return _0x2a6c20;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8cee('0x0'),'remove','update'];function createListener(_0x5cbd3f,_0x5701fd){return function(_0x104698){_0x5701fd['emit'](_0x5cbd3f,_0x104698);};}function removeListener(_0x39dff0,_0x359560){return function(){SmsMessageEvents[_0x8cee('0x1')](_0x39dff0,_0x359560);};}exports['register']=function(_0x5da31b){for(var _0x240ce2=0x0,_0x3d1569=events[_0x8cee('0x2')];_0x240ce2<_0x3d1569;_0x240ce2++){var _0x20ee70=events[_0x240ce2];var _0x54dbcb=createListener('smsMessage:'+_0x20ee70,_0x5da31b);SmsMessageEvents['on'](_0x20ee70,_0x54dbcb);}}; \ No newline at end of file +var _0x16f3=['remove','update','removeListener','register','length'];(function(_0x1c5d89,_0x2106f6){var _0x306662=function(_0x6c7fea){while(--_0x6c7fea){_0x1c5d89['push'](_0x1c5d89['shift']());}};_0x306662(++_0x2106f6);}(_0x16f3,0x1e0));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x316f('0x0'),_0x316f('0x1')];function createListener(_0x4d8682,_0x484ff2){return function(_0x4ba764){_0x484ff2['emit'](_0x4d8682,_0x4ba764);};}function removeListener(_0x50683b,_0x4aa21e){return function(){SmsMessageEvents[_0x316f('0x2')](_0x50683b,_0x4aa21e);};}exports[_0x316f('0x3')]=function(_0x35e694){for(var _0x2ae9f5=0x0,_0x2906dc=events[_0x316f('0x4')];_0x2ae9f5<_0x2906dc;_0x2ae9f5++){var _0xf82540=events[_0x2ae9f5];var _0x8c254e=createListener('smsMessage:'+_0xf82540,_0x35e694);SmsMessageEvents['on'](_0xf82540,_0x8c254e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f9d2857..fe634e1 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 _0x3e47=['addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','get','/:id','getMembers','/:id/teams','getAgents','post'];(function(_0xdb6969,_0x2eb0c1){var _0x59cf85=function(_0x504bf4){while(--_0x504bf4){_0xdb6969['push'](_0xdb6969['shift']());}};_0x59cf85(++_0x2eb0c1);}(_0x3e47,0x183));var _0x73e4=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0x3e47[_0x459963];return _0xbe84e3;};'use strict';var multer=require('multer');var util=require(_0x73e4('0x0'));var path=require(_0x73e4('0x1'));var timeout=require(_0x73e4('0x2'));var express=require(_0x73e4('0x3'));var router=express[_0x73e4('0x4')]();var fs_extra=require(_0x73e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73e4('0x6'));var config=require(_0x73e4('0x7'));var controller=require(_0x73e4('0x8'));router['get']('/',auth[_0x73e4('0x9')](),controller[_0x73e4('0xa')]);router['get'](_0x73e4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x73e4('0xc')](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller['show']);router[_0x73e4('0xc')]('/:id/members',auth[_0x73e4('0x9')](),controller[_0x73e4('0xe')]);router[_0x73e4('0xc')](_0x73e4('0xf'),auth[_0x73e4('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x73e4('0x9')](),controller[_0x73e4('0x10')]);router[_0x73e4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x73e4('0xf'),auth['isAuthenticated'](),controller[_0x73e4('0x12')]);router[_0x73e4('0x11')](_0x73e4('0x13'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x14')]);router['put'](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x15')]);router[_0x73e4('0x16')](_0x73e4('0xd'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x17')]);router[_0x73e4('0x16')](_0x73e4('0xf'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x18')]);router[_0x73e4('0x16')](_0x73e4('0x13'),auth[_0x73e4('0x9')](),controller[_0x73e4('0x19')]);module[_0x73e4('0x1a')]=router; \ No newline at end of file +var _0x6130=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put'];(function(_0x17466a,_0x4f17dc){var _0x1b4447=function(_0x5d73f9){while(--_0x5d73f9){_0x17466a['push'](_0x17466a['shift']());}};_0x1b4447(++_0x4f17dc);}(_0x6130,0x148));var _0x0613=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6130[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x0613('0x0'));var util=require(_0x0613('0x1'));var path=require(_0x0613('0x2'));var timeout=require('connect-timeout');var express=require(_0x0613('0x3'));var router=express[_0x0613('0x4')]();var fs_extra=require(_0x0613('0x5'));var auth=require(_0x0613('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0613('0x7'));var controller=require('./smsQueue.controller');router[_0x0613('0x8')]('/',auth[_0x0613('0x9')](),controller[_0x0613('0xa')]);router[_0x0613('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0613('0xb')]);router[_0x0613('0x8')](_0x0613('0xc'),auth[_0x0613('0x9')](),controller[_0x0613('0xd')]);router[_0x0613('0x8')](_0x0613('0xe'),auth[_0x0613('0x9')](),controller['getMembers']);router[_0x0613('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0613('0xf')]);router['get'](_0x0613('0x10'),auth['isAuthenticated'](),controller[_0x0613('0x11')]);router[_0x0613('0x12')]('/',auth[_0x0613('0x9')](),controller[_0x0613('0x13')]);router[_0x0613('0x12')](_0x0613('0x14'),auth[_0x0613('0x9')](),controller['addTeams']);router['post'](_0x0613('0x10'),auth['isAuthenticated'](),controller[_0x0613('0x15')]);router[_0x0613('0x16')]('/:id',auth[_0x0613('0x9')](),controller[_0x0613('0x17')]);router[_0x0613('0x18')](_0x0613('0xc'),auth['isAuthenticated'](),controller[_0x0613('0x19')]);router[_0x0613('0x18')](_0x0613('0x14'),auth[_0x0613('0x9')](),controller['removeTeams']);router['delete'](_0x0613('0x10'),auth[_0x0613('0x9')](),controller['removeAgents']);module[_0x0613('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 f981cff..f4470fd 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 _0x0912=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1d5a18,_0x585dc8){var _0x411450=function(_0x3f4ad8){while(--_0x3f4ad8){_0x1d5a18['push'](_0x1d5a18['shift']());}};_0x411450(++_0x585dc8);}(_0x0912,0x75));var _0x2091=function(_0x51556f,_0x297118){_0x51556f=_0x51556f-0x0;var _0x15140d=_0x0912[_0x51556f];return _0x15140d;};'use strict';var Sequelize=require(_0x2091('0x0'));module['exports']={'name':{'type':Sequelize[_0x2091('0x1')],'unique':_0x2091('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2091('0x1')]},'timeout':{'type':Sequelize[_0x2091('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2091('0x4'),_0x2091('0x5'),_0x2091('0x6'))}}; \ No newline at end of file +var _0x20ca=['beepall','sequelize','exports','name','STRING','ENUM'];(function(_0x50bc13,_0x19e2a1){var _0x33012e=function(_0x14c96e){while(--_0x14c96e){_0x50bc13['push'](_0x50bc13['shift']());}};_0x33012e(++_0x19e2a1);}(_0x20ca,0x8b));var _0xa20c=function(_0x4a5578,_0x52d7a1){_0x4a5578=_0x4a5578-0x0;var _0x688704=_0x20ca[_0x4a5578];return _0x688704;};'use strict';var Sequelize=require(_0xa20c('0x0'));module[_0xa20c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa20c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa20c('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa20c('0x4')]('rrmemory',_0xa20c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4ffc46b..e49a7f8 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x14462a,_0x4735b0){var _0x27e0ed=function(_0x14a1da){while(--_0x14a1da){_0x14462a['push'](_0x14462a['shift']());}};_0x27e0ed(++_0x4735b0);}(_0xdb28,0x106));var _0x8db2=function(_0x5732eb,_0xb2a38c){_0x5732eb=_0x5732eb-0x0;var _0x3ca5ce=_0xdb28[_0x5732eb];return _0x3ca5ce;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x4e5f6f,_0x462fbb){var _0x5b489b=function(_0xb9f160){while(--_0xb9f160){_0x4e5f6f['push'](_0x4e5f6f['shift']());}};_0x5b489b(++_0x462fbb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16fcfe,_0x26392e){_0x16fcfe=_0x16fcfe-0x0;var _0xa05f71=_0x5f2f[_0x16fcfe];return _0xa05f71;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 298df84..855a495 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 _0x252c=['exports','events','SmsQueue','setMaxListeners','update','emit','hook'];(function(_0x284173,_0x5714e2){var _0x4aa650=function(_0x15e485){while(--_0x15e485){_0x284173['push'](_0x284173['shift']());}};_0x4aa650(++_0x5714e2);}(_0x252c,0x151));var _0xc252=function(_0x404cfe,_0x519699){_0x404cfe=_0x404cfe-0x0;var _0x6b8223=_0x252c[_0x404cfe];return _0x6b8223;};'use strict';var EventEmitter=require(_0xc252('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc252('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc252('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc252('0x3'),'afterDestroy':'remove'};function emitEvent(_0x156fee){return function(_0x5787af,_0x3cfe3d,_0xdd6e06){SmsQueueEvents['emit'](_0x156fee+':'+_0x5787af['id'],_0x5787af);SmsQueueEvents[_0xc252('0x4')](_0x156fee,_0x5787af);_0xdd6e06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc252('0x5')](e,emitEvent(event));}}module[_0xc252('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x0ace=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x746432,_0x1639d1){var _0x40b63a=function(_0x5667cd){while(--_0x5667cd){_0x746432['push'](_0x746432['shift']());}};_0x40b63a(++_0x1639d1);}(_0x0ace,0x14f));var _0xe0ac=function(_0x24783a,_0x75041){_0x24783a=_0x24783a-0x0;var _0x227a77=_0x0ace[_0x24783a];return _0x227a77;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xe0ac('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe0ac('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe0ac('0x2')};function emitEvent(_0x5920b6){return function(_0x1052ea,_0x35fe9e,_0x4f8d47){SmsQueueEvents[_0xe0ac('0x3')](_0x5920b6+':'+_0x1052ea['id'],_0x1052ea);SmsQueueEvents[_0xe0ac('0x3')](_0x5920b6,_0x1052ea);_0x4f8d47(null);};}for(var e in events){if(events[_0xe0ac('0x4')](e)){var event=events[e];SmsQueue[_0xe0ac('0x5')](e,emitEvent(event));}}module[_0xe0ac('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6150991..6a8e945 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 _0x3320=['sms_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x3320,0x169));var _0x0332=function(_0x325052,_0x54d125){_0x325052=_0x325052-0x0;var _0x1add5b=_0x3320[_0x325052];return _0x1add5b;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require('../../config/logger')(_0x0332('0x2'));var moment=require(_0x0332('0x3'));var BPromise=require(_0x0332('0x4'));var rp=require(_0x0332('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x6'));var config=require(_0x0332('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x30a5ca,_0x3a1667){return _0x30a5ca[_0x0332('0x8')]('SmsQueue',attributes,{'tableName':_0x0332('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaed0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash'];(function(_0x94f760,_0x4f1b70){var _0x3aec01=function(_0x15c485){while(--_0x15c485){_0x94f760['push'](_0x94f760['shift']());}};_0x3aec01(++_0x4f1b70);}(_0xaed0,0x7d));var _0x0aed=function(_0x2e432b,_0x29cbed){_0x2e432b=_0x2e432b-0x0;var _0x57bb5a=_0xaed0[_0x2e432b];return _0x57bb5a;};'use strict';var _=require(_0x0aed('0x0'));var util=require(_0x0aed('0x1'));var logger=require(_0x0aed('0x2'))(_0x0aed('0x3'));var moment=require(_0x0aed('0x4'));var BPromise=require(_0x0aed('0x5'));var rp=require(_0x0aed('0x6'));var fs=require('fs');var path=require(_0x0aed('0x7'));var rimraf=require(_0x0aed('0x8'));var config=require(_0x0aed('0x9'));var attributes=require(_0x0aed('0xa'));module[_0x0aed('0xb')]=function(_0x3cd655,_0x469dce){return _0x3cd655[_0x0aed('0xc')]('SmsQueue',attributes,{'tableName':_0x0aed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 7728f0c..0e638e1 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 _0x65c3=['./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowSmsQueue','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x31fb8c,_0x35a04c){var _0x7e5090=function(_0x1d6c44){while(--_0x1d6c44){_0x31fb8c['push'](_0x31fb8c['shift']());}};_0x7e5090(++_0x35a04c);}(_0x65c3,0x88));var _0x365c=function(_0x1cf618,_0x489ef2){_0x1cf618=_0x1cf618-0x0;var _0x344c1b=_0x65c3[_0x1cf618];return _0x344c1b;};'use strict';var _=require(_0x365c('0x0'));var util=require(_0x365c('0x1'));var moment=require(_0x365c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x365c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x365c('0x4'))(_0x365c('0x5'));var config=require(_0x365c('0x6'));var jayson=require(_0x365c('0x7'));var client=jayson['client'][_0x365c('0x8')]({'port':0x232a});config[_0x365c('0x9')]=_[_0x365c('0xa')](config[_0x365c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x365c('0xb'))(new Redis(config[_0x365c('0x9')]));require(_0x365c('0xc'))[_0x365c('0xd')](socket);function respondWithRpcPromise(_0x36d5e3,_0xaac05f,_0x5c52a6){return new BPromise(function(_0xb9da70,_0x315c23){return client[_0x365c('0xe')](_0x36d5e3,_0x5c52a6)[_0x365c('0xf')](function(_0x4112b9){logger[_0x365c('0x10')]('SmsQueue,\x20%s,\x20%s',_0xaac05f,_0x365c('0x11'));logger[_0x365c('0x12')](_0x365c('0x13'),_0xaac05f,'request\x20sent',JSON[_0x365c('0x14')](_0x4112b9));if(_0x4112b9[_0x365c('0x15')]){if(_0x4112b9[_0x365c('0x15')]['code']===0x1f4){logger['error'](_0x365c('0x16'),_0xaac05f,_0x4112b9['error'][_0x365c('0x17')]);return _0x315c23(_0x4112b9[_0x365c('0x15')][_0x365c('0x17')]);}logger[_0x365c('0x15')](_0x365c('0x16'),_0xaac05f,_0x4112b9[_0x365c('0x15')][_0x365c('0x17')]);return _0xb9da70(_0x4112b9['error'][_0x365c('0x17')]);}else{logger[_0x365c('0x10')](_0x365c('0x16'),_0xaac05f,_0x365c('0x11'));_0xb9da70(_0x4112b9['result'][_0x365c('0x17')]);}})['catch'](function(_0x5e3781){logger['error']('SmsQueue,\x20%s,\x20%s',_0xaac05f,_0x5e3781);_0x315c23(_0x5e3781);});});}exports[_0x365c('0x18')]=function(_0x55a6e3){var _0xb6ddd9=this;return new Promise(function(_0x41b5bb,_0x4d1f50){return db[_0x365c('0x19')][_0x365c('0x1a')]({'raw':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1c')]===undefined?!![]:![]:!![],'where':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1d')]||null:null,'attributes':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')]['attributes']||null:null,'limit':_0x55a6e3[_0x365c('0x1b')]?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1e')]||null:null,'include':_0x55a6e3['options']?_0x55a6e3[_0x365c('0x1b')][_0x365c('0x1f')]?_[_0x365c('0x20')](_0x55a6e3['options'][_0x365c('0x1f')],function(_0x3e523b){return{'model':db[_0x3e523b[_0x365c('0x21')]],'as':_0x3e523b['as'],'attributes':_0x3e523b[_0x365c('0x22')],'include':_0x3e523b[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x3e523b[_0x365c('0x1f')],function(_0x1c3cd0){return{'model':db[_0x1c3cd0[_0x365c('0x21')]],'as':_0x1c3cd0['as'],'attributes':_0x1c3cd0[_0x365c('0x22')],'include':_0x1c3cd0[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x1c3cd0[_0x365c('0x1f')],function(_0x556cfe){return{'model':db[_0x556cfe['model']],'as':_0x556cfe['as'],'attributes':_0x556cfe[_0x365c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x365c('0xf')](function(_0x2c3837){logger[_0x365c('0x10')]('GetSmsQueue',_0x55a6e3);logger[_0x365c('0x12')]('GetSmsQueue',_0x55a6e3,JSON[_0x365c('0x14')](_0x2c3837));_0x41b5bb(_0x2c3837);})[_0x365c('0x23')](function(_0x3b8d49){logger[_0x365c('0x15')](_0x365c('0x18'),_0x3b8d49['message'],_0x55a6e3);_0x4d1f50(_0xb6ddd9[_0x365c('0x15')](0x1f4,_0x3b8d49['message']));});});};exports['ShowSmsQueue']=function(_0x2d86b7){var _0x376ec9=this;return new Promise(function(_0x156992,_0x34b169){return db[_0x365c('0x19')]['find']({'raw':_0x2d86b7['options']?_0x2d86b7[_0x365c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d86b7['options']?_0x2d86b7[_0x365c('0x1b')][_0x365c('0x1d')]||null:null,'attributes':_0x2d86b7[_0x365c('0x1b')]?_0x2d86b7[_0x365c('0x1b')]['attributes']||null:null,'include':_0x2d86b7[_0x365c('0x1b')]?_0x2d86b7[_0x365c('0x1b')]['include']?_['map'](_0x2d86b7[_0x365c('0x1b')][_0x365c('0x1f')],function(_0x327ad7){return{'model':db[_0x327ad7[_0x365c('0x21')]],'as':_0x327ad7['as'],'attributes':_0x327ad7['attributes'],'include':_0x327ad7[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x327ad7[_0x365c('0x1f')],function(_0x2b3fc0){return{'model':db[_0x2b3fc0[_0x365c('0x21')]],'as':_0x2b3fc0['as'],'attributes':_0x2b3fc0['attributes'],'include':_0x2b3fc0[_0x365c('0x1f')]?_[_0x365c('0x20')](_0x2b3fc0[_0x365c('0x1f')],function(_0x34f78c){return{'model':db[_0x34f78c[_0x365c('0x21')]],'as':_0x34f78c['as'],'attributes':_0x34f78c['attributes']};}):[]};}):[]};}):[]:[]})[_0x365c('0xf')](function(_0x434b62){logger[_0x365c('0x10')](_0x365c('0x24'),_0x2d86b7);logger['debug'](_0x365c('0x24'),_0x2d86b7,JSON[_0x365c('0x14')](_0x434b62));_0x156992(_0x434b62);})[_0x365c('0x23')](function(_0xcc0cf5){logger['error'](_0x365c('0x24'),_0xcc0cf5['message'],_0x2d86b7);_0x34b169(_0x376ec9['error'](0x1f4,_0xcc0cf5['message']));});});}; \ No newline at end of file +var _0x5a4a=['catch','findAll','options','raw','where','attributes','limit','include','model','map','GetSmsQueue','ShowSmsQueue','SmsQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5a4a,0x12d));var _0xa5a4=function(_0x265b32,_0x79253d){_0x265b32=_0x265b32-0x0;var _0x34d4b7=_0x5a4a[_0x265b32];return _0x34d4b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5a4('0x0'));var BPromise=require(_0xa5a4('0x1'));var rs=require(_0xa5a4('0x2'));var fs=require('fs');var Redis=require(_0xa5a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a4('0x4'));var logger=require(_0xa5a4('0x5'))('rpc');var config=require(_0xa5a4('0x6'));var jayson=require(_0xa5a4('0x7'));var client=jayson[_0xa5a4('0x8')][_0xa5a4('0x9')]({'port':0x232a});config[_0xa5a4('0xa')]=_[_0xa5a4('0xb')](config['redis'],{'host':_0xa5a4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5a4('0xa')]));require(_0xa5a4('0xd'))[_0xa5a4('0xe')](socket);function respondWithRpcPromise(_0x124e8c,_0x2fc8f1,_0x583b29){return new BPromise(function(_0x134416,_0x2677ba){return client[_0xa5a4('0xf')](_0x124e8c,_0x583b29)[_0xa5a4('0x10')](function(_0xee06f6){logger[_0xa5a4('0x11')](_0xa5a4('0x12'),_0x2fc8f1,'request\x20sent');logger[_0xa5a4('0x13')](_0xa5a4('0x14'),_0x2fc8f1,_0xa5a4('0x15'),JSON[_0xa5a4('0x16')](_0xee06f6));if(_0xee06f6[_0xa5a4('0x17')]){if(_0xee06f6['error'][_0xa5a4('0x18')]===0x1f4){logger['error'](_0xa5a4('0x12'),_0x2fc8f1,_0xee06f6[_0xa5a4('0x17')][_0xa5a4('0x19')]);return _0x2677ba(_0xee06f6[_0xa5a4('0x17')][_0xa5a4('0x19')]);}logger[_0xa5a4('0x17')]('SmsQueue,\x20%s,\x20%s',_0x2fc8f1,_0xee06f6[_0xa5a4('0x17')][_0xa5a4('0x19')]);return _0x134416(_0xee06f6[_0xa5a4('0x17')][_0xa5a4('0x19')]);}else{logger['info'](_0xa5a4('0x12'),_0x2fc8f1,'request\x20sent');_0x134416(_0xee06f6[_0xa5a4('0x1a')][_0xa5a4('0x19')]);}})[_0xa5a4('0x1b')](function(_0x24bd18){logger['error'](_0xa5a4('0x12'),_0x2fc8f1,_0x24bd18);_0x2677ba(_0x24bd18);});});}exports['GetSmsQueue']=function(_0x31c5db){var _0xfa7b80=this;return new Promise(function(_0x4cc729,_0x3c60fd){return db['SmsQueue'][_0xa5a4('0x1c')]({'raw':_0x31c5db[_0xa5a4('0x1d')]?_0x31c5db[_0xa5a4('0x1d')][_0xa5a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x31c5db['options']?_0x31c5db[_0xa5a4('0x1d')][_0xa5a4('0x1f')]||null:null,'attributes':_0x31c5db[_0xa5a4('0x1d')]?_0x31c5db[_0xa5a4('0x1d')][_0xa5a4('0x20')]||null:null,'limit':_0x31c5db[_0xa5a4('0x1d')]?_0x31c5db[_0xa5a4('0x1d')][_0xa5a4('0x21')]||null:null,'include':_0x31c5db[_0xa5a4('0x1d')]?_0x31c5db[_0xa5a4('0x1d')][_0xa5a4('0x22')]?_['map'](_0x31c5db[_0xa5a4('0x1d')]['include'],function(_0x348851){return{'model':db[_0x348851[_0xa5a4('0x23')]],'as':_0x348851['as'],'attributes':_0x348851[_0xa5a4('0x20')],'include':_0x348851[_0xa5a4('0x22')]?_['map'](_0x348851[_0xa5a4('0x22')],function(_0x45b22d){return{'model':db[_0x45b22d[_0xa5a4('0x23')]],'as':_0x45b22d['as'],'attributes':_0x45b22d[_0xa5a4('0x20')],'include':_0x45b22d['include']?_[_0xa5a4('0x24')](_0x45b22d[_0xa5a4('0x22')],function(_0x44eb6d){return{'model':db[_0x44eb6d[_0xa5a4('0x23')]],'as':_0x44eb6d['as'],'attributes':_0x44eb6d[_0xa5a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5a4('0x10')](function(_0x5b5144){logger[_0xa5a4('0x11')](_0xa5a4('0x25'),_0x31c5db);logger[_0xa5a4('0x13')]('GetSmsQueue',_0x31c5db,JSON['stringify'](_0x5b5144));_0x4cc729(_0x5b5144);})['catch'](function(_0x362c27){logger[_0xa5a4('0x17')]('GetSmsQueue',_0x362c27['message'],_0x31c5db);_0x3c60fd(_0xfa7b80[_0xa5a4('0x17')](0x1f4,_0x362c27[_0xa5a4('0x19')]));});});};exports[_0xa5a4('0x26')]=function(_0x39b613){var _0x2cdd32=this;return new Promise(function(_0xd05ec6,_0x466fed){return db[_0xa5a4('0x27')][_0xa5a4('0x28')]({'raw':_0x39b613[_0xa5a4('0x1d')]?_0x39b613[_0xa5a4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x39b613[_0xa5a4('0x1d')]?_0x39b613[_0xa5a4('0x1d')][_0xa5a4('0x1f')]||null:null,'attributes':_0x39b613['options']?_0x39b613[_0xa5a4('0x1d')][_0xa5a4('0x20')]||null:null,'include':_0x39b613[_0xa5a4('0x1d')]?_0x39b613[_0xa5a4('0x1d')]['include']?_[_0xa5a4('0x24')](_0x39b613[_0xa5a4('0x1d')][_0xa5a4('0x22')],function(_0x1238ee){return{'model':db[_0x1238ee['model']],'as':_0x1238ee['as'],'attributes':_0x1238ee['attributes'],'include':_0x1238ee[_0xa5a4('0x22')]?_['map'](_0x1238ee[_0xa5a4('0x22')],function(_0x1c3ad2){return{'model':db[_0x1c3ad2[_0xa5a4('0x23')]],'as':_0x1c3ad2['as'],'attributes':_0x1c3ad2[_0xa5a4('0x20')],'include':_0x1c3ad2[_0xa5a4('0x22')]?_['map'](_0x1c3ad2[_0xa5a4('0x22')],function(_0x3df14c){return{'model':db[_0x3df14c[_0xa5a4('0x23')]],'as':_0x3df14c['as'],'attributes':_0x3df14c[_0xa5a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5a4('0x10')](function(_0x6ab6b6){logger['info']('ShowSmsQueue',_0x39b613);logger[_0xa5a4('0x13')]('ShowSmsQueue',_0x39b613,JSON[_0xa5a4('0x16')](_0x6ab6b6));_0xd05ec6(_0x6ab6b6);})[_0xa5a4('0x1b')](function(_0x3d9082){logger[_0xa5a4('0x17')](_0xa5a4('0x26'),_0x3d9082[_0xa5a4('0x19')],_0x39b613);_0x466fed(_0x2cdd32[_0xa5a4('0x17')](0x1f4,_0x3d9082[_0xa5a4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 74a6a65..319e707 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 _0x20c8=['save','update','emit','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x20c8,0x16b));var _0x820c=function(_0x10a387,_0x4283b5){_0x10a387=_0x10a387-0x0;var _0x37749d=_0x20c8[_0x10a387];return _0x37749d;};'use strict';var SmsQueueEvents=require(_0x820c('0x0'));var events=[_0x820c('0x1'),'remove',_0x820c('0x2')];function createListener(_0x54e8e5,_0x2679d7){return function(_0x101697){_0x2679d7[_0x820c('0x3')](_0x54e8e5,_0x101697);};}function removeListener(_0x290339,_0x4ac9be){return function(){SmsQueueEvents[_0x820c('0x4')](_0x290339,_0x4ac9be);};}exports['register']=function(_0x2d3601){for(var _0x2e1d08=0x0,_0x2cbda0=events[_0x820c('0x5')];_0x2e1d08<_0x2cbda0;_0x2e1d08++){var _0x51085f=events[_0x2e1d08];var _0x1004e6=createListener(_0x820c('0x6')+_0x51085f,_0x2d3601);SmsQueueEvents['on'](_0x51085f,_0x1004e6);}}; \ No newline at end of file +var _0x885d=['removeListener','register','length','smsQueue:','./smsQueue.events','remove','emit'];(function(_0x3e4850,_0x2c8c56){var _0x17916f=function(_0x5cebeb){while(--_0x5cebeb){_0x3e4850['push'](_0x3e4850['shift']());}};_0x17916f(++_0x2c8c56);}(_0x885d,0x146));var _0xd885=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x885d[_0x23e6bb];return _0x1e3b4c;};'use strict';var SmsQueueEvents=require(_0xd885('0x0'));var events=['save',_0xd885('0x1'),'update'];function createListener(_0x2f4e1b,_0x49265c){return function(_0x35bac2){_0x49265c[_0xd885('0x2')](_0x2f4e1b,_0x35bac2);};}function removeListener(_0x4a10a4,_0x32481f){return function(){SmsQueueEvents[_0xd885('0x3')](_0x4a10a4,_0x32481f);};}exports[_0xd885('0x4')]=function(_0x56324e){for(var _0x438a57=0x0,_0x3ade11=events[_0xd885('0x5')];_0x438a57<_0x3ade11;_0x438a57++){var _0x2c6502=events[_0x438a57];var _0x3430af=createListener(_0xd885('0x6')+_0x2c6502,_0x56324e);SmsQueueEvents['on'](_0x2c6502,_0x3430af);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 083fbb9..fde4354 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 _0x806b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util'];(function(_0x11058d,_0x3e6bb1){var _0x26e7e4=function(_0x5c7650){while(--_0x5c7650){_0x11058d['push'](_0x11058d['shift']());}};_0x26e7e4(++_0x3e6bb1);}(_0x806b,0x163));var _0xb806=function(_0x19fa2a,_0x23ee0d){_0x19fa2a=_0x19fa2a-0x0;var _0x926ddf=_0x806b[_0x19fa2a];return _0x926ddf;};'use strict';var multer=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var path=require(_0xb806('0x2'));var timeout=require(_0xb806('0x3'));var express=require(_0xb806('0x4'));var router=express[_0xb806('0x5')]();var fs_extra=require(_0xb806('0x6'));var auth=require(_0xb806('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb806('0x8'));var controller=require(_0xb806('0x9'));router[_0xb806('0xa')]('/',auth[_0xb806('0xb')](),controller['index']);router[_0xb806('0xa')](_0xb806('0xc'),auth['isAuthenticated'](),controller[_0xb806('0xd')]);router[_0xb806('0xa')](_0xb806('0xe'),auth[_0xb806('0xb')](),controller['show']);router[_0xb806('0xf')]('/',auth['isAuthenticated'](),controller[_0xb806('0x10')]);router['put'](_0xb806('0xe'),auth['isAuthenticated'](),controller[_0xb806('0x11')]);router[_0xb806('0x12')](_0xb806('0xe'),auth['isAuthenticated'](),controller[_0xb806('0x13')]);module[_0xb806('0x14')]=router; \ No newline at end of file +var _0xdbd0=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x50c2de,_0xd27ab0){var _0x49c7b6=function(_0x3678e4){while(--_0x3678e4){_0x50c2de['push'](_0x50c2de['shift']());}};_0x49c7b6(++_0xd27ab0);}(_0xdbd0,0x88));var _0x0dbd=function(_0x16a652,_0x1854f4){_0x16a652=_0x16a652-0x0;var _0x1e04a7=_0xdbd0[_0x16a652];return _0x1e04a7;};'use strict';var multer=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var path=require(_0x0dbd('0x2'));var timeout=require(_0x0dbd('0x3'));var express=require(_0x0dbd('0x4'));var router=express['Router']();var fs_extra=require(_0x0dbd('0x5'));var auth=require(_0x0dbd('0x6'));var interaction=require(_0x0dbd('0x7'));var config=require('../../config/environment');var controller=require(_0x0dbd('0x8'));router[_0x0dbd('0x9')]('/',auth[_0x0dbd('0xa')](),controller[_0x0dbd('0xb')]);router['get']('/describe',auth[_0x0dbd('0xa')](),controller[_0x0dbd('0xc')]);router[_0x0dbd('0x9')](_0x0dbd('0xd'),auth[_0x0dbd('0xa')](),controller[_0x0dbd('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0dbd('0xf')]);router[_0x0dbd('0x10')](_0x0dbd('0xd'),auth[_0x0dbd('0xa')](),controller[_0x0dbd('0x11')]);router[_0x0dbd('0x12')](_0x0dbd('0xd'),auth[_0x0dbd('0xa')](),controller['destroy']);module[_0x0dbd('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a74f913..cffbed4 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 _0xd7a3=['DATE','moment','sequelize','exports','STRING'];(function(_0x545dd8,_0x404f75){var _0x44cd80=function(_0xec3ca3){while(--_0xec3ca3){_0x545dd8['push'](_0x545dd8['shift']());}};_0x44cd80(++_0x404f75);}(_0xd7a3,0x6a));var _0x3d7a=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd7a3[_0x33032e];return _0x13316b;};'use strict';var moment=require(_0x3d7a('0x0'));var Sequelize=require(_0x3d7a('0x1'));module[_0x3d7a('0x2')]={'uniqueid':{'type':Sequelize[_0x3d7a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3d7a('0x3')]},'joinAt':{'type':Sequelize[_0x3d7a('0x4')]},'leaveAt':{'type':Sequelize[_0x3d7a('0x4')]},'acceptAt':{'type':Sequelize[_0x3d7a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3d7a('0x3')]}}; \ No newline at end of file +var _0x2c6d=['moment','sequelize','exports','STRING','DATE'];(function(_0x1e5aa2,_0xa4cb4f){var _0x30abcb=function(_0x1b134f){while(--_0x1b134f){_0x1e5aa2['push'](_0x1e5aa2['shift']());}};_0x30abcb(++_0xa4cb4f);}(_0x2c6d,0x64));var _0xd2c6=function(_0x56aaed,_0x408e35){_0x56aaed=_0x56aaed-0x0;var _0x154eba=_0x2c6d[_0x56aaed];return _0x154eba;};'use strict';var moment=require(_0xd2c6('0x0'));var Sequelize=require(_0xd2c6('0x1'));module[_0xd2c6('0x2')]={'uniqueid':{'type':Sequelize[_0xd2c6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd2c6('0x3')]},'joinAt':{'type':Sequelize[_0xd2c6('0x4')]},'leaveAt':{'type':Sequelize[_0xd2c6('0x4')]},'acceptAt':{'type':Sequelize[_0xd2c6('0x4')]},'exitAt':{'type':Sequelize[_0xd2c6('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 3ed2e18..99d93c5 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 _0xbb08=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsQueueReport','include','findAll','rows','show','params','includeAll','find','catch','create','update','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x22ba1e,_0x4b25fd){var _0x3b42e4=function(_0x3e4a78){while(--_0x3e4a78){_0x22ba1e['push'](_0x22ba1e['shift']());}};_0x3b42e4(++_0x4b25fd);}(_0xbb08,0xd0));var _0x8bb0=function(_0x5bfd24,_0x553ba3){_0x5bfd24=_0x5bfd24-0x0;var _0x3b28f1=_0xbb08[_0x5bfd24];return _0x3b28f1;};'use strict';var emlformat=require(_0x8bb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bb0('0x1'));var jsonpatch=require(_0x8bb0('0x2'));var rp=require('request-promise');var moment=require(_0x8bb0('0x3'));var BPromise=require(_0x8bb0('0x4'));var Mustache=require(_0x8bb0('0x5'));var util=require('util');var path=require(_0x8bb0('0x6'));var sox=require(_0x8bb0('0x7'));var csv=require('to-csv');var ejs=require(_0x8bb0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bb0('0x9'));var squel=require(_0x8bb0('0xa'));var crypto=require(_0x8bb0('0xb'));var jsforce=require(_0x8bb0('0xc'));var deskjs=require(_0x8bb0('0xd'));var toCsv=require(_0x8bb0('0xe'));var querystring=require(_0x8bb0('0xf'));var Papa=require(_0x8bb0('0x10'));var Redis=require(_0x8bb0('0x11'));var authService=require(_0x8bb0('0x12'));var qs=require(_0x8bb0('0x13'));var as=require(_0x8bb0('0x14'));var hardwareService=require(_0x8bb0('0x15'));var logger=require('../../config/logger')(_0x8bb0('0x16'));var utils=require(_0x8bb0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8bb0('0x18'));var db=require(_0x8bb0('0x19'))['db'];function respondWithStatusCode(_0x3e2e87,_0x1422d){_0x1422d=_0x1422d||0xcc;return function(_0x990956){if(_0x990956){return _0x3e2e87[_0x8bb0('0x1a')](_0x1422d);}return _0x3e2e87[_0x8bb0('0x1b')](_0x1422d)[_0x8bb0('0x1c')]();};}function respondWithResult(_0x1eb2d4,_0x3d06cb){_0x3d06cb=_0x3d06cb||0xc8;return function(_0x309293){if(_0x309293){return _0x1eb2d4[_0x8bb0('0x1b')](_0x3d06cb)[_0x8bb0('0x1d')](_0x309293);}};}function respondWithFilteredResult(_0x34f244,_0x18f9ff){return function(_0x218d85){if(_0x218d85){var _0x48a36d=typeof _0x18f9ff['offset']===_0x8bb0('0x1e')&&typeof _0x18f9ff[_0x8bb0('0x1f')]===_0x8bb0('0x1e');var _0x304790=_0x218d85[_0x8bb0('0x20')];var _0x4531ac=_0x48a36d?0x0:_0x18f9ff[_0x8bb0('0x21')];var _0x4a6ffe=_0x48a36d?_0x218d85['count']:_0x18f9ff[_0x8bb0('0x21')]+_0x18f9ff['limit'];var _0x4e8272;if(_0x4a6ffe>=_0x304790){_0x4a6ffe=_0x304790;_0x4e8272=0xc8;}else{_0x4e8272=0xce;}_0x34f244[_0x8bb0('0x1b')](_0x4e8272);return _0x34f244[_0x8bb0('0x22')](_0x8bb0('0x23'),_0x4531ac+'-'+_0x4a6ffe+'/'+_0x304790)[_0x8bb0('0x1d')](_0x218d85);}return null;};}function patchUpdates(_0x5bcb16){return function(_0x49c504){try{jsonpatch[_0x8bb0('0x24')](_0x49c504,_0x5bcb16,!![]);}catch(_0x1c3f39){return BPromise[_0x8bb0('0x25')](_0x1c3f39);}return _0x49c504[_0x8bb0('0x26')]();};}function saveUpdates(_0x5f046e,_0x4f9735){return function(_0x32b0fb){if(_0x32b0fb){return _0x32b0fb['update'](_0x5f046e)[_0x8bb0('0x27')](function(_0x4ddb2e){return _0x4ddb2e;});}return null;};}function removeEntity(_0x2b7891,_0x5e4eb0){return function(_0x56c013){if(_0x56c013){return _0x56c013[_0x8bb0('0x28')]()[_0x8bb0('0x27')](function(){_0x2b7891[_0x8bb0('0x1b')](0xcc)[_0x8bb0('0x1c')]();});}};}function handleEntityNotFound(_0x397d5b,_0x3dd5c3){return function(_0x4e9fce){if(!_0x4e9fce){_0x397d5b[_0x8bb0('0x1a')](0x194);}return _0x4e9fce;};}function handleError(_0x1a95ff,_0x510ba0){_0x510ba0=_0x510ba0||0x1f4;return function(_0x25ee8f){logger['error'](_0x25ee8f[_0x8bb0('0x29')]);if(_0x25ee8f[_0x8bb0('0x2a')]){delete _0x25ee8f['name'];}_0x1a95ff[_0x8bb0('0x1b')](_0x510ba0)['send'](_0x25ee8f);};}exports[_0x8bb0('0x2b')]=function(_0x837265,_0x2e1d1c){var _0x3ed2de={},_0x659398={},_0x5bda87={'count':0x0,'rows':[]};var _0x131ca1=_[_0x8bb0('0x2c')](db['SmsQueueReport'][_0x8bb0('0x2d')],function(_0x4390e1){return{'name':_0x4390e1[_0x8bb0('0x2e')],'type':_0x4390e1[_0x8bb0('0x2f')]['key']};});_0x659398[_0x8bb0('0x30')]=_[_0x8bb0('0x2c')](_0x131ca1,_0x8bb0('0x2a'));_0x659398[_0x8bb0('0x31')]=_[_0x8bb0('0x32')](_0x837265[_0x8bb0('0x31')]);_0x659398['filters']=_[_0x8bb0('0x33')](_0x659398['model'],_0x659398[_0x8bb0('0x31')]);_0x3ed2de['attributes']=_['intersection'](_0x659398[_0x8bb0('0x30')],qs[_0x8bb0('0x34')](_0x837265[_0x8bb0('0x31')][_0x8bb0('0x34')]));_0x3ed2de[_0x8bb0('0x35')]=_0x3ed2de['attributes'][_0x8bb0('0x36')]?_0x3ed2de[_0x8bb0('0x35')]:_0x659398[_0x8bb0('0x30')];if(!_0x837265['query']['hasOwnProperty'](_0x8bb0('0x37'))){_0x3ed2de[_0x8bb0('0x1f')]=qs[_0x8bb0('0x1f')](_0x837265['query'][_0x8bb0('0x1f')]);_0x3ed2de[_0x8bb0('0x21')]=qs[_0x8bb0('0x21')](_0x837265[_0x8bb0('0x31')][_0x8bb0('0x21')]);}_0x3ed2de[_0x8bb0('0x38')]=qs[_0x8bb0('0x39')](_0x837265[_0x8bb0('0x31')]['sort']);_0x3ed2de[_0x8bb0('0x3a')]=qs[_0x8bb0('0x3b')](_['pick'](_0x837265[_0x8bb0('0x31')],_0x659398[_0x8bb0('0x3b')]),_0x131ca1);if(_0x837265[_0x8bb0('0x31')][_0x8bb0('0x3c')]){_0x3ed2de['where']=_[_0x8bb0('0x3d')](_0x3ed2de[_0x8bb0('0x3a')],{'$or':_['map'](_0x131ca1,function(_0x25f06e){if(_0x25f06e[_0x8bb0('0x2f')]!==_0x8bb0('0x3e')){var _0x28835f={};_0x28835f[_0x25f06e[_0x8bb0('0x2a')]]={'$like':'%'+_0x837265[_0x8bb0('0x31')][_0x8bb0('0x3c')]+'%'};return _0x28835f;}})});}_0x3ed2de=_[_0x8bb0('0x3d')]({},_0x3ed2de,_0x837265[_0x8bb0('0x3f')]);var _0xe7c51={'where':_0x3ed2de[_0x8bb0('0x3a')]};return db[_0x8bb0('0x40')][_0x8bb0('0x20')](_0xe7c51)[_0x8bb0('0x27')](function(_0x56df07){_0x5bda87[_0x8bb0('0x20')]=_0x56df07;if(_0x837265['query']['includeAll']){_0x3ed2de[_0x8bb0('0x41')]=[{'all':!![]}];}return db[_0x8bb0('0x40')][_0x8bb0('0x42')](_0x3ed2de);})[_0x8bb0('0x27')](function(_0x5392a1){_0x5bda87[_0x8bb0('0x43')]=_0x5392a1;return _0x5bda87;})[_0x8bb0('0x27')](respondWithFilteredResult(_0x2e1d1c,_0x3ed2de))['catch'](handleError(_0x2e1d1c,null));};exports[_0x8bb0('0x44')]=function(_0x4c7033,_0x448930){var _0x31e4c4={'raw':!![],'where':{'id':_0x4c7033[_0x8bb0('0x45')]['id']}},_0x3f8851={};_0x3f8851[_0x8bb0('0x30')]=_[_0x8bb0('0x32')](db['SmsQueueReport'][_0x8bb0('0x2d')]);_0x3f8851['query']=_[_0x8bb0('0x32')](_0x4c7033[_0x8bb0('0x31')]);_0x3f8851[_0x8bb0('0x3b')]=_['intersection'](_0x3f8851['model'],_0x3f8851[_0x8bb0('0x31')]);_0x31e4c4[_0x8bb0('0x35')]=_[_0x8bb0('0x33')](_0x3f8851[_0x8bb0('0x30')],qs[_0x8bb0('0x34')](_0x4c7033[_0x8bb0('0x31')][_0x8bb0('0x34')]));_0x31e4c4['attributes']=_0x31e4c4['attributes'][_0x8bb0('0x36')]?_0x31e4c4[_0x8bb0('0x35')]:_0x3f8851[_0x8bb0('0x30')];if(_0x4c7033[_0x8bb0('0x31')][_0x8bb0('0x46')]){_0x31e4c4[_0x8bb0('0x41')]=[{'all':!![]}];}_0x31e4c4=_[_0x8bb0('0x3d')]({},_0x31e4c4,_0x4c7033[_0x8bb0('0x3f')]);return db[_0x8bb0('0x40')][_0x8bb0('0x47')](_0x31e4c4)[_0x8bb0('0x27')](handleEntityNotFound(_0x448930,null))[_0x8bb0('0x27')](respondWithResult(_0x448930,null))[_0x8bb0('0x48')](handleError(_0x448930,null));};exports[_0x8bb0('0x49')]=function(_0x5cb048,_0x5828b1){return db['SmsQueueReport'][_0x8bb0('0x49')](_0x5cb048['body'],{})[_0x8bb0('0x27')](respondWithResult(_0x5828b1,0xc9))[_0x8bb0('0x48')](handleError(_0x5828b1,null));};exports[_0x8bb0('0x4a')]=function(_0x24996f,_0x56a161){if(_0x24996f[_0x8bb0('0x4b')]['id']){delete _0x24996f['body']['id'];}return db[_0x8bb0('0x40')][_0x8bb0('0x47')]({'where':{'id':_0x24996f[_0x8bb0('0x45')]['id']}})[_0x8bb0('0x27')](handleEntityNotFound(_0x56a161,null))[_0x8bb0('0x27')](saveUpdates(_0x24996f[_0x8bb0('0x4b')],null))[_0x8bb0('0x27')](respondWithResult(_0x56a161,null))[_0x8bb0('0x48')](handleError(_0x56a161,null));};exports['destroy']=function(_0x20d775,_0x6b2f2d){return db[_0x8bb0('0x40')][_0x8bb0('0x47')]({'where':{'id':_0x20d775[_0x8bb0('0x45')]['id']}})[_0x8bb0('0x27')](handleEntityNotFound(_0x6b2f2d,null))[_0x8bb0('0x27')](removeEntity(_0x6b2f2d,null))['catch'](handleError(_0x6b2f2d,null));};exports[_0x8bb0('0x4c')]=function(_0x4010db,_0x2a997b){return db[_0x8bb0('0x40')][_0x8bb0('0x4c')]()[_0x8bb0('0x27')](respondWithResult(_0x2a997b,null))[_0x8bb0('0x48')](handleError(_0x2a997b,null));}; \ No newline at end of file +var _0x1f41=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','name','send','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x1f41,0x1b4));var _0x11f4=function(_0x10cd61,_0x1194a2){_0x10cd61=_0x10cd61-0x0;var _0x231c8a=_0x1f41[_0x10cd61];return _0x231c8a;};'use strict';var emlformat=require(_0x11f4('0x0'));var rimraf=require(_0x11f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11f4('0x2'));var rp=require(_0x11f4('0x3'));var moment=require(_0x11f4('0x4'));var BPromise=require(_0x11f4('0x5'));var Mustache=require(_0x11f4('0x6'));var util=require(_0x11f4('0x7'));var path=require('path');var sox=require(_0x11f4('0x8'));var csv=require(_0x11f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11f4('0xa'));var _=require(_0x11f4('0xb'));var squel=require(_0x11f4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11f4('0xd'));var toCsv=require(_0x11f4('0x9'));var querystring=require(_0x11f4('0xe'));var Papa=require(_0x11f4('0xf'));var Redis=require('ioredis');var authService=require(_0x11f4('0x10'));var qs=require(_0x11f4('0x11'));var as=require(_0x11f4('0x12'));var hardwareService=require(_0x11f4('0x13'));var logger=require(_0x11f4('0x14'))('api');var utils=require(_0x11f4('0x15'));var config=require(_0x11f4('0x16'));var licenseUtil=require(_0x11f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e097,_0x1e47ae){_0x1e47ae=_0x1e47ae||0xcc;return function(_0x4b3be4){if(_0x4b3be4){return _0x35e097[_0x11f4('0x18')](_0x1e47ae);}return _0x35e097[_0x11f4('0x19')](_0x1e47ae)[_0x11f4('0x1a')]();};}function respondWithResult(_0x4a288a,_0x276f3f){_0x276f3f=_0x276f3f||0xc8;return function(_0xbe6010){if(_0xbe6010){return _0x4a288a[_0x11f4('0x19')](_0x276f3f)['json'](_0xbe6010);}};}function respondWithFilteredResult(_0x175e3f,_0x44c96a){return function(_0xa72d52){if(_0xa72d52){var _0x3d229b=typeof _0x44c96a['offset']===_0x11f4('0x1b')&&typeof _0x44c96a['limit']===_0x11f4('0x1b');var _0x17aeee=_0xa72d52[_0x11f4('0x1c')];var _0x5847b2=_0x3d229b?0x0:_0x44c96a[_0x11f4('0x1d')];var _0x495aa7=_0x3d229b?_0xa72d52[_0x11f4('0x1c')]:_0x44c96a[_0x11f4('0x1d')]+_0x44c96a[_0x11f4('0x1e')];var _0x38b177;if(_0x495aa7>=_0x17aeee){_0x495aa7=_0x17aeee;_0x38b177=0xc8;}else{_0x38b177=0xce;}_0x175e3f[_0x11f4('0x19')](_0x38b177);return _0x175e3f[_0x11f4('0x1f')](_0x11f4('0x20'),_0x5847b2+'-'+_0x495aa7+'/'+_0x17aeee)[_0x11f4('0x21')](_0xa72d52);}return null;};}function patchUpdates(_0x4d91b1){return function(_0x3eacec){try{jsonpatch[_0x11f4('0x22')](_0x3eacec,_0x4d91b1,!![]);}catch(_0x562b64){return BPromise[_0x11f4('0x23')](_0x562b64);}return _0x3eacec[_0x11f4('0x24')]();};}function saveUpdates(_0x286275,_0x47826f){return function(_0x10109c){if(_0x10109c){return _0x10109c[_0x11f4('0x25')](_0x286275)['then'](function(_0xf0f9ea){return _0xf0f9ea;});}return null;};}function removeEntity(_0x4970c4,_0x14f79b){return function(_0x3437f6){if(_0x3437f6){return _0x3437f6[_0x11f4('0x26')]()[_0x11f4('0x27')](function(){_0x4970c4[_0x11f4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b7fc,_0x3f2b24){return function(_0x23d31c){if(!_0x23d31c){_0x59b7fc['sendStatus'](0x194);}return _0x23d31c;};}function handleError(_0x1653d9,_0x8a1b43){_0x8a1b43=_0x8a1b43||0x1f4;return function(_0x355be3){logger['error'](_0x355be3['stack']);if(_0x355be3['name']){delete _0x355be3[_0x11f4('0x28')];}_0x1653d9[_0x11f4('0x19')](_0x8a1b43)[_0x11f4('0x29')](_0x355be3);};}exports['index']=function(_0x4f749e,_0x186721){var _0x112508={},_0x295110={},_0x1ccfc5={'count':0x0,'rows':[]};var _0x233005=_[_0x11f4('0x2a')](db['SmsQueueReport'][_0x11f4('0x2b')],function(_0x2f1677){return{'name':_0x2f1677[_0x11f4('0x2c')],'type':_0x2f1677[_0x11f4('0x2d')][_0x11f4('0x2e')]};});_0x295110['model']=_[_0x11f4('0x2a')](_0x233005,_0x11f4('0x28'));_0x295110['query']=_[_0x11f4('0x2f')](_0x4f749e[_0x11f4('0x30')]);_0x295110['filters']=_[_0x11f4('0x31')](_0x295110[_0x11f4('0x32')],_0x295110[_0x11f4('0x30')]);_0x112508[_0x11f4('0x33')]=_['intersection'](_0x295110['model'],qs[_0x11f4('0x34')](_0x4f749e[_0x11f4('0x30')][_0x11f4('0x34')]));_0x112508[_0x11f4('0x33')]=_0x112508[_0x11f4('0x33')][_0x11f4('0x35')]?_0x112508[_0x11f4('0x33')]:_0x295110[_0x11f4('0x32')];if(!_0x4f749e[_0x11f4('0x30')]['hasOwnProperty'](_0x11f4('0x36'))){_0x112508[_0x11f4('0x1e')]=qs['limit'](_0x4f749e['query'][_0x11f4('0x1e')]);_0x112508[_0x11f4('0x1d')]=qs['offset'](_0x4f749e[_0x11f4('0x30')][_0x11f4('0x1d')]);}_0x112508[_0x11f4('0x37')]=qs[_0x11f4('0x38')](_0x4f749e[_0x11f4('0x30')]['sort']);_0x112508[_0x11f4('0x39')]=qs[_0x11f4('0x3a')](_[_0x11f4('0x3b')](_0x4f749e[_0x11f4('0x30')],_0x295110[_0x11f4('0x3a')]),_0x233005);if(_0x4f749e[_0x11f4('0x30')][_0x11f4('0x3c')]){_0x112508[_0x11f4('0x39')]=_[_0x11f4('0x3d')](_0x112508['where'],{'$or':_[_0x11f4('0x2a')](_0x233005,function(_0x295f5b){if(_0x295f5b[_0x11f4('0x2d')]!==_0x11f4('0x3e')){var _0x40b8e1={};_0x40b8e1[_0x295f5b[_0x11f4('0x28')]]={'$like':'%'+_0x4f749e[_0x11f4('0x30')][_0x11f4('0x3c')]+'%'};return _0x40b8e1;}})});}_0x112508=_[_0x11f4('0x3d')]({},_0x112508,_0x4f749e[_0x11f4('0x3f')]);var _0x273eed={'where':_0x112508[_0x11f4('0x39')]};return db[_0x11f4('0x40')][_0x11f4('0x1c')](_0x273eed)[_0x11f4('0x27')](function(_0x380e8a){_0x1ccfc5[_0x11f4('0x1c')]=_0x380e8a;if(_0x4f749e[_0x11f4('0x30')][_0x11f4('0x41')]){_0x112508[_0x11f4('0x42')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x112508);})[_0x11f4('0x27')](function(_0xe1be8d){_0x1ccfc5[_0x11f4('0x43')]=_0xe1be8d;return _0x1ccfc5;})['then'](respondWithFilteredResult(_0x186721,_0x112508))[_0x11f4('0x44')](handleError(_0x186721,null));};exports[_0x11f4('0x45')]=function(_0x3520de,_0x2d7335){var _0x3b3003={'raw':!![],'where':{'id':_0x3520de[_0x11f4('0x46')]['id']}},_0x3267c6={};_0x3267c6['model']=_[_0x11f4('0x2f')](db[_0x11f4('0x40')][_0x11f4('0x2b')]);_0x3267c6['query']=_[_0x11f4('0x2f')](_0x3520de['query']);_0x3267c6[_0x11f4('0x3a')]=_['intersection'](_0x3267c6[_0x11f4('0x32')],_0x3267c6[_0x11f4('0x30')]);_0x3b3003[_0x11f4('0x33')]=_[_0x11f4('0x31')](_0x3267c6[_0x11f4('0x32')],qs['fields'](_0x3520de[_0x11f4('0x30')][_0x11f4('0x34')]));_0x3b3003[_0x11f4('0x33')]=_0x3b3003[_0x11f4('0x33')][_0x11f4('0x35')]?_0x3b3003[_0x11f4('0x33')]:_0x3267c6[_0x11f4('0x32')];if(_0x3520de[_0x11f4('0x30')][_0x11f4('0x41')]){_0x3b3003[_0x11f4('0x42')]=[{'all':!![]}];}_0x3b3003=_[_0x11f4('0x3d')]({},_0x3b3003,_0x3520de[_0x11f4('0x3f')]);return db[_0x11f4('0x40')][_0x11f4('0x47')](_0x3b3003)['then'](handleEntityNotFound(_0x2d7335,null))[_0x11f4('0x27')](respondWithResult(_0x2d7335,null))[_0x11f4('0x44')](handleError(_0x2d7335,null));};exports[_0x11f4('0x48')]=function(_0x5b633f,_0x584864){return db[_0x11f4('0x40')]['create'](_0x5b633f[_0x11f4('0x49')],{})[_0x11f4('0x27')](respondWithResult(_0x584864,0xc9))[_0x11f4('0x44')](handleError(_0x584864,null));};exports['update']=function(_0x61ff17,_0x5e69cd){if(_0x61ff17[_0x11f4('0x49')]['id']){delete _0x61ff17['body']['id'];}return db[_0x11f4('0x40')][_0x11f4('0x47')]({'where':{'id':_0x61ff17[_0x11f4('0x46')]['id']}})[_0x11f4('0x27')](handleEntityNotFound(_0x5e69cd,null))[_0x11f4('0x27')](saveUpdates(_0x61ff17['body'],null))[_0x11f4('0x27')](respondWithResult(_0x5e69cd,null))['catch'](handleError(_0x5e69cd,null));};exports[_0x11f4('0x26')]=function(_0xf25a0,_0x42d583){return db['SmsQueueReport']['find']({'where':{'id':_0xf25a0[_0x11f4('0x46')]['id']}})[_0x11f4('0x27')](handleEntityNotFound(_0x42d583,null))[_0x11f4('0x27')](removeEntity(_0x42d583,null))[_0x11f4('0x44')](handleError(_0x42d583,null));};exports[_0x11f4('0x4a')]=function(_0xf3c03,_0xe2166a){return db[_0x11f4('0x40')]['describe']()[_0x11f4('0x27')](respondWithResult(_0xe2166a,null))[_0x11f4('0x44')](handleError(_0xe2166a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index be7c515..f009f3a 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x565cea,_0x5aa812){var _0x42e271=function(_0x2ba44b){while(--_0x2ba44b){_0x565cea['push'](_0x565cea['shift']());}};_0x42e271(++_0x5aa812);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0xc67706,_0x1cb151){var _0x451245=function(_0x3989c5){while(--_0x3989c5){_0xc67706['push'](_0xc67706['shift']());}};_0x451245(++_0x1cb151);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 715b9d0..b861294 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 _0x9bf8=['result','catch','SmsQueueReport','create','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','message','SmsQueueReport,\x20%s,\x20%s'];(function(_0x12aa98,_0x39916d){var _0x42935f=function(_0x37d922){while(--_0x37d922){_0x12aa98['push'](_0x12aa98['shift']());}};_0x42935f(++_0x39916d);}(_0x9bf8,0x1e2));var _0x89bf=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9bf8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x89bf('0x0'));var util=require(_0x89bf('0x1'));var moment=require(_0x89bf('0x2'));var BPromise=require(_0x89bf('0x3'));var rs=require(_0x89bf('0x4'));var fs=require('fs');var Redis=require(_0x89bf('0x5'));var db=require(_0x89bf('0x6'))['db'];var utils=require(_0x89bf('0x7'));var logger=require(_0x89bf('0x8'))(_0x89bf('0x9'));var config=require(_0x89bf('0xa'));var jayson=require(_0x89bf('0xb'));var client=jayson[_0x89bf('0xc')][_0x89bf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52efe7,_0x320357,_0x2901da){return new BPromise(function(_0xad6bbb,_0x4290d1){return client[_0x89bf('0xe')](_0x52efe7,_0x2901da)['then'](function(_0x90241e){logger[_0x89bf('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x89bf('0x10'));logger[_0x89bf('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x320357,'request\x20sent',JSON[_0x89bf('0x12')](_0x90241e));if(_0x90241e['error']){if(_0x90241e[_0x89bf('0x13')]['code']===0x1f4){logger[_0x89bf('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x90241e[_0x89bf('0x13')]['message']);return _0x4290d1(_0x90241e[_0x89bf('0x13')][_0x89bf('0x14')]);}logger[_0x89bf('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x320357,_0x90241e['error'][_0x89bf('0x14')]);return _0xad6bbb(_0x90241e[_0x89bf('0x13')][_0x89bf('0x14')]);}else{logger['info'](_0x89bf('0x15'),_0x320357,_0x89bf('0x10'));_0xad6bbb(_0x90241e[_0x89bf('0x16')]['message']);}})[_0x89bf('0x17')](function(_0x29b253){logger[_0x89bf('0x13')](_0x89bf('0x15'),_0x320357,_0x29b253);_0x4290d1(_0x29b253);});});}exports['CreateSmsQueueReport']=function(_0x4973dd){var _0x419a71=this;return new Promise(function(_0x6986a8,_0x90f4d0){return db[_0x89bf('0x18')][_0x89bf('0x19')](_0x4973dd['body'],{'raw':_0x4973dd[_0x89bf('0x1a')]?_0x4973dd[_0x89bf('0x1a')][_0x89bf('0x1b')]===undefined?!![]:![]:!![]})[_0x89bf('0x1c')](function(_0x2eebd3){logger[_0x89bf('0xf')](_0x89bf('0x1d'),_0x4973dd);logger[_0x89bf('0x11')]('CreateSmsQueueReport',_0x4973dd,JSON[_0x89bf('0x12')](_0x2eebd3));_0x6986a8(_0x2eebd3);})['catch'](function(_0x4baeaf){logger[_0x89bf('0x13')](_0x89bf('0x1d'),_0x4baeaf[_0x89bf('0x14')],_0x4973dd);_0x90f4d0(_0x419a71[_0x89bf('0x13')](0x1f4,_0x4baeaf['message']));});});};exports[_0x89bf('0x1e')]=function(_0x4caff5){var _0x31710f=this;return new Promise(function(_0x54b2c5,_0x140418){return db[_0x89bf('0x18')][_0x89bf('0x1f')](_0x4caff5[_0x89bf('0x20')],{'raw':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x21')]||null:null,'attributes':_0x4caff5['options']?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x22')]||null:null,'limit':_0x4caff5[_0x89bf('0x1a')]?_0x4caff5[_0x89bf('0x1a')][_0x89bf('0x23')]||null:null})['then'](function(_0x5e608d){logger[_0x89bf('0xf')](_0x89bf('0x1e'),_0x4caff5);logger[_0x89bf('0x11')]('UpdateSmsQueueReport',_0x4caff5,JSON[_0x89bf('0x12')](_0x5e608d));_0x54b2c5(_0x5e608d);})[_0x89bf('0x17')](function(_0x321b83){logger[_0x89bf('0x13')](_0x89bf('0x1e'),_0x321b83[_0x89bf('0x14')],_0x4caff5);_0x140418(_0x31710f[_0x89bf('0x13')](0x1f4,_0x321b83[_0x89bf('0x14')]));});});}; \ No newline at end of file +var _0x4af9=['debug','UpdateSmsQueueReport','update','body','where','attributes','limit','stringify','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','SmsQueueReport','create','options','raw','CreateSmsQueueReport'];(function(_0x6cf2c7,_0x27a3a0){var _0x4d0752=function(_0x5c6161){while(--_0x5c6161){_0x6cf2c7['push'](_0x6cf2c7['shift']());}};_0x4d0752(++_0x27a3a0);}(_0x4af9,0x153));var _0x94af=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4af9[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x94af('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94af('0x1'));var db=require(_0x94af('0x2'))['db'];var utils=require(_0x94af('0x3'));var logger=require(_0x94af('0x4'))(_0x94af('0x5'));var config=require(_0x94af('0x6'));var jayson=require(_0x94af('0x7'));var client=jayson[_0x94af('0x8')][_0x94af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfff,_0x358841,_0x1bc9ef){return new BPromise(function(_0x27910d,_0x18b910){return client[_0x94af('0xa')](_0x55cfff,_0x1bc9ef)[_0x94af('0xb')](function(_0x102bc0){logger[_0x94af('0xc')](_0x94af('0xd'),_0x358841,_0x94af('0xe'));logger['debug'](_0x94af('0xf'),_0x358841,_0x94af('0xe'),JSON['stringify'](_0x102bc0));if(_0x102bc0[_0x94af('0x10')]){if(_0x102bc0['error']['code']===0x1f4){logger[_0x94af('0x10')](_0x94af('0xd'),_0x358841,_0x102bc0[_0x94af('0x10')][_0x94af('0x11')]);return _0x18b910(_0x102bc0['error']['message']);}logger[_0x94af('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x358841,_0x102bc0['error'][_0x94af('0x11')]);return _0x27910d(_0x102bc0[_0x94af('0x10')][_0x94af('0x11')]);}else{logger['info'](_0x94af('0xd'),_0x358841,_0x94af('0xe'));_0x27910d(_0x102bc0[_0x94af('0x12')]['message']);}})['catch'](function(_0x340f0b){logger[_0x94af('0x10')](_0x94af('0xd'),_0x358841,_0x340f0b);_0x18b910(_0x340f0b);});});}exports['CreateSmsQueueReport']=function(_0x4dad08){var _0x4e0368=this;return new Promise(function(_0x3a4302,_0x996c7){return db[_0x94af('0x13')][_0x94af('0x14')](_0x4dad08['body'],{'raw':_0x4dad08[_0x94af('0x15')]?_0x4dad08['options'][_0x94af('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1f3c7d){logger[_0x94af('0xc')](_0x94af('0x17'),_0x4dad08);logger[_0x94af('0x18')](_0x94af('0x17'),_0x4dad08,JSON['stringify'](_0x1f3c7d));_0x3a4302(_0x1f3c7d);})['catch'](function(_0x57c16f){logger[_0x94af('0x10')](_0x94af('0x17'),_0x57c16f[_0x94af('0x11')],_0x4dad08);_0x996c7(_0x4e0368[_0x94af('0x10')](0x1f4,_0x57c16f[_0x94af('0x11')]));});});};exports[_0x94af('0x19')]=function(_0x264200){var _0x265284=this;return new Promise(function(_0x480ff0,_0x1e0360){return db['SmsQueueReport'][_0x94af('0x1a')](_0x264200[_0x94af('0x1b')],{'raw':_0x264200[_0x94af('0x15')]?_0x264200[_0x94af('0x15')][_0x94af('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x264200[_0x94af('0x15')]?_0x264200['options'][_0x94af('0x1c')]||null:null,'attributes':_0x264200[_0x94af('0x15')]?_0x264200['options'][_0x94af('0x1d')]||null:null,'limit':_0x264200[_0x94af('0x15')]?_0x264200[_0x94af('0x15')][_0x94af('0x1e')]||null:null})[_0x94af('0xb')](function(_0xef65eb){logger[_0x94af('0xc')](_0x94af('0x19'),_0x264200);logger[_0x94af('0x18')](_0x94af('0x19'),_0x264200,JSON[_0x94af('0x1f')](_0xef65eb));_0x480ff0(_0xef65eb);})[_0x94af('0x20')](function(_0x3ef229){logger[_0x94af('0x10')](_0x94af('0x19'),_0x3ef229[_0x94af('0x11')],_0x264200);_0x1e0360(_0x265284[_0x94af('0x10')](0x1f4,_0x3ef229['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ccf51d4..63d4927 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 _0xcb81=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xcb81,0x154));var _0x1cb8=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xcb81[_0x4704dc];return _0x254d81;};'use strict';var multer=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var path=require('path');var timeout=require(_0x1cb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cb8('0x3'));var interaction=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var controller=require(_0x1cb8('0x6'));router[_0x1cb8('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb8('0x8')]);router[_0x1cb8('0x7')]('/describe',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xa')]);router[_0x1cb8('0x7')]('/:id',auth[_0x1cb8('0x9')](),controller['show']);router['post']('/',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xb')]);router[_0x1cb8('0xc')](_0x1cb8('0xd'),auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xe')]);router[_0x1cb8('0xf')](_0x1cb8('0xd'),auth['isAuthenticated'](),controller[_0x1cb8('0x10')]);module[_0x1cb8('0x11')]=router; \ No newline at end of file +var _0xe5d5=['describe','/:id','show','put','update','delete','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0xb62087,_0x31c30b){var _0x5f2b00=function(_0x3a5377){while(--_0x3a5377){_0xb62087['push'](_0xb62087['shift']());}};_0x5f2b00(++_0x31c30b);}(_0xe5d5,0x156));var _0x5e5d=function(_0x336627,_0x44b30c){_0x336627=_0x336627-0x0;var _0x292f20=_0xe5d5[_0x336627];return _0x292f20;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var fs_extra=require(_0x5e5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var controller=require(_0x5e5d('0x5'));router[_0x5e5d('0x6')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x8')]);router[_0x5e5d('0x6')](_0x5e5d('0x9'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xa')]);router[_0x5e5d('0x6')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xc')]);router['post']('/',auth[_0x5e5d('0x7')](),controller['create']);router[_0x5e5d('0xd')](_0x5e5d('0xb'),auth['isAuthenticated'](),controller[_0x5e5d('0xe')]);router[_0x5e5d('0xf')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f44f5c0..eae86a7 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1d9d12,_0x2c7d98){var _0x4f680e=function(_0x4e1bbb){while(--_0x4e1bbb){_0x1d9d12['push'](_0x1d9d12['shift']());}};_0x4f680e(++_0x2c7d98);}(_0x008c,0x188));var _0xc008=function(_0x5dbb3e,_0x4b494d){_0x5dbb3e=_0x5dbb3e-0x0;var _0x138d23=_0x008c[_0x5dbb3e];return _0x138d23;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5e980d,_0x316987){var _0x347477=function(_0x5566a8){while(--_0x5566a8){_0x5e980d['push'](_0x5e980d['shift']());}};_0x347477(++_0x316987);}(_0x54ef,0x112));var _0xf54e=function(_0x27079d,_0x2dfc18){_0x27079d=_0x27079d-0x0;var _0x482ee9=_0x54ef[_0x27079d];return _0x482ee9;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f3f7bb6..4bb8a47 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 _0x342f=['length','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','index','map','rawAttributes','type','name','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','SmsTransferReport','includeAll','include','rows','catch','show','params','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x342f,0xdd));var _0xf342=function(_0xcb0117,_0x169260){_0xcb0117=_0xcb0117-0x0;var _0x3c5e05=_0x342f[_0xcb0117];return _0x3c5e05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf342('0x0'));var zipdir=require(_0xf342('0x1'));var jsonpatch=require(_0xf342('0x2'));var rp=require('request-promise');var moment=require(_0xf342('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf342('0x4'));var util=require('util');var path=require(_0xf342('0x5'));var sox=require(_0xf342('0x6'));var csv=require(_0xf342('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf342('0x8'));var _=require('lodash');var squel=require(_0xf342('0x9'));var crypto=require(_0xf342('0xa'));var jsforce=require(_0xf342('0xb'));var deskjs=require(_0xf342('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf342('0xd'));var Papa=require(_0xf342('0xe'));var Redis=require(_0xf342('0xf'));var authService=require(_0xf342('0x10'));var qs=require(_0xf342('0x11'));var as=require(_0xf342('0x12'));var hardwareService=require(_0xf342('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf342('0x14'));var config=require(_0xf342('0x15'));var licenseUtil=require(_0xf342('0x16'));var db=require(_0xf342('0x17'))['db'];function respondWithStatusCode(_0x548869,_0x94446e){_0x94446e=_0x94446e||0xcc;return function(_0x2edb91){if(_0x2edb91){return _0x548869[_0xf342('0x18')](_0x94446e);}return _0x548869['status'](_0x94446e)['end']();};}function respondWithResult(_0x2c46aa,_0x12b44c){_0x12b44c=_0x12b44c||0xc8;return function(_0x3c30dd){if(_0x3c30dd){return _0x2c46aa['status'](_0x12b44c)[_0xf342('0x19')](_0x3c30dd);}};}function respondWithFilteredResult(_0x1dd8e9,_0x30551e){return function(_0x12f876){if(_0x12f876){var _0x285cce=typeof _0x30551e[_0xf342('0x1a')]===_0xf342('0x1b')&&typeof _0x30551e[_0xf342('0x1c')]===_0xf342('0x1b');var _0x349842=_0x12f876[_0xf342('0x1d')];var _0x53edc9=_0x285cce?0x0:_0x30551e[_0xf342('0x1a')];var _0x510036=_0x285cce?_0x12f876[_0xf342('0x1d')]:_0x30551e[_0xf342('0x1a')]+_0x30551e[_0xf342('0x1c')];var _0x4ea9ca;if(_0x510036>=_0x349842){_0x510036=_0x349842;_0x4ea9ca=0xc8;}else{_0x4ea9ca=0xce;}_0x1dd8e9[_0xf342('0x1e')](_0x4ea9ca);return _0x1dd8e9[_0xf342('0x1f')](_0xf342('0x20'),_0x53edc9+'-'+_0x510036+'/'+_0x349842)['json'](_0x12f876);}return null;};}function patchUpdates(_0x3e050d){return function(_0x6c828e){try{jsonpatch[_0xf342('0x21')](_0x6c828e,_0x3e050d,!![]);}catch(_0x5e82d9){return BPromise[_0xf342('0x22')](_0x5e82d9);}return _0x6c828e[_0xf342('0x23')]();};}function saveUpdates(_0x10645b,_0x3e2b9e){return function(_0x3c7965){if(_0x3c7965){return _0x3c7965[_0xf342('0x24')](_0x10645b)[_0xf342('0x25')](function(_0x1c6570){return _0x1c6570;});}return null;};}function removeEntity(_0x8a7a8,_0x24eb53){return function(_0x5d95a0){if(_0x5d95a0){return _0x5d95a0[_0xf342('0x26')]()[_0xf342('0x25')](function(){_0x8a7a8['status'](0xcc)[_0xf342('0x27')]();});}};}function handleEntityNotFound(_0x5642e0,_0x2c5296){return function(_0x2b2235){if(!_0x2b2235){_0x5642e0['sendStatus'](0x194);}return _0x2b2235;};}function handleError(_0x2d7950,_0x56d8ee){_0x56d8ee=_0x56d8ee||0x1f4;return function(_0x580fc0){logger[_0xf342('0x28')](_0x580fc0['stack']);if(_0x580fc0['name']){delete _0x580fc0['name'];}_0x2d7950[_0xf342('0x1e')](_0x56d8ee)['send'](_0x580fc0);};}exports[_0xf342('0x29')]=function(_0x57efbf,_0x5718a8){var _0x3eb691={},_0x5579d5={},_0x2f3d71={'count':0x0,'rows':[]};var _0x2c91a1=_[_0xf342('0x2a')](db['SmsTransferReport'][_0xf342('0x2b')],function(_0x10342a){return{'name':_0x10342a['fieldName'],'type':_0x10342a[_0xf342('0x2c')]['key']};});_0x5579d5['model']=_['map'](_0x2c91a1,_0xf342('0x2d'));_0x5579d5['query']=_['keys'](_0x57efbf[_0xf342('0x2e')]);_0x5579d5[_0xf342('0x2f')]=_[_0xf342('0x30')](_0x5579d5[_0xf342('0x31')],_0x5579d5[_0xf342('0x2e')]);_0x3eb691[_0xf342('0x32')]=_[_0xf342('0x30')](_0x5579d5[_0xf342('0x31')],qs[_0xf342('0x33')](_0x57efbf['query']['fields']));_0x3eb691[_0xf342('0x32')]=_0x3eb691['attributes']['length']?_0x3eb691['attributes']:_0x5579d5[_0xf342('0x31')];if(!_0x57efbf[_0xf342('0x2e')]['hasOwnProperty'](_0xf342('0x34'))){_0x3eb691[_0xf342('0x1c')]=qs[_0xf342('0x1c')](_0x57efbf[_0xf342('0x2e')][_0xf342('0x1c')]);_0x3eb691[_0xf342('0x1a')]=qs['offset'](_0x57efbf[_0xf342('0x2e')]['offset']);}_0x3eb691[_0xf342('0x35')]=qs[_0xf342('0x36')](_0x57efbf['query'][_0xf342('0x36')]);_0x3eb691[_0xf342('0x37')]=qs[_0xf342('0x2f')](_[_0xf342('0x38')](_0x57efbf[_0xf342('0x2e')],_0x5579d5[_0xf342('0x2f')]),_0x2c91a1);if(_0x57efbf[_0xf342('0x2e')][_0xf342('0x39')]){_0x3eb691[_0xf342('0x37')]=_[_0xf342('0x3a')](_0x3eb691[_0xf342('0x37')],{'$or':_[_0xf342('0x2a')](_0x2c91a1,function(_0x512143){if(_0x512143[_0xf342('0x2c')]!=='VIRTUAL'){var _0x2ba772={};_0x2ba772[_0x512143[_0xf342('0x2d')]]={'$like':'%'+_0x57efbf[_0xf342('0x2e')]['filter']+'%'};return _0x2ba772;}})});}_0x3eb691=_['merge']({},_0x3eb691,_0x57efbf['options']);var _0xf20bea={'where':_0x3eb691['where']};return db[_0xf342('0x3b')]['count'](_0xf20bea)[_0xf342('0x25')](function(_0x2d287d){_0x2f3d71[_0xf342('0x1d')]=_0x2d287d;if(_0x57efbf['query'][_0xf342('0x3c')]){_0x3eb691[_0xf342('0x3d')]=[{'all':!![]}];}return db[_0xf342('0x3b')]['findAll'](_0x3eb691);})[_0xf342('0x25')](function(_0xba2ac6){_0x2f3d71[_0xf342('0x3e')]=_0xba2ac6;return _0x2f3d71;})[_0xf342('0x25')](respondWithFilteredResult(_0x5718a8,_0x3eb691))[_0xf342('0x3f')](handleError(_0x5718a8,null));};exports[_0xf342('0x40')]=function(_0x259e7b,_0x3045bf){var _0x5fc95c={'raw':!![],'where':{'id':_0x259e7b[_0xf342('0x41')]['id']}},_0x58de07={};_0x58de07['model']=_[_0xf342('0x42')](db[_0xf342('0x3b')][_0xf342('0x2b')]);_0x58de07[_0xf342('0x2e')]=_[_0xf342('0x42')](_0x259e7b[_0xf342('0x2e')]);_0x58de07[_0xf342('0x2f')]=_[_0xf342('0x30')](_0x58de07[_0xf342('0x31')],_0x58de07['query']);_0x5fc95c[_0xf342('0x32')]=_['intersection'](_0x58de07[_0xf342('0x31')],qs[_0xf342('0x33')](_0x259e7b[_0xf342('0x2e')][_0xf342('0x33')]));_0x5fc95c[_0xf342('0x32')]=_0x5fc95c[_0xf342('0x32')][_0xf342('0x43')]?_0x5fc95c[_0xf342('0x32')]:_0x58de07['model'];if(_0x259e7b[_0xf342('0x2e')][_0xf342('0x3c')]){_0x5fc95c['include']=[{'all':!![]}];}_0x5fc95c=_[_0xf342('0x3a')]({},_0x5fc95c,_0x259e7b['options']);return db[_0xf342('0x3b')]['find'](_0x5fc95c)['then'](handleEntityNotFound(_0x3045bf,null))['then'](respondWithResult(_0x3045bf,null))['catch'](handleError(_0x3045bf,null));};exports['create']=function(_0x4b4be,_0x22e5dc){return db[_0xf342('0x3b')][_0xf342('0x44')](_0x4b4be[_0xf342('0x45')],{})[_0xf342('0x25')](respondWithResult(_0x22e5dc,0xc9))[_0xf342('0x3f')](handleError(_0x22e5dc,null));};exports[_0xf342('0x24')]=function(_0x56f633,_0x14af45){if(_0x56f633[_0xf342('0x45')]['id']){delete _0x56f633['body']['id'];}return db[_0xf342('0x3b')][_0xf342('0x46')]({'where':{'id':_0x56f633[_0xf342('0x41')]['id']}})['then'](handleEntityNotFound(_0x14af45,null))[_0xf342('0x25')](saveUpdates(_0x56f633[_0xf342('0x45')],null))[_0xf342('0x25')](respondWithResult(_0x14af45,null))[_0xf342('0x3f')](handleError(_0x14af45,null));};exports[_0xf342('0x26')]=function(_0x55d320,_0x4272ff){return db['SmsTransferReport'][_0xf342('0x46')]({'where':{'id':_0x55d320[_0xf342('0x41')]['id']}})['then'](handleEntityNotFound(_0x4272ff,null))['then'](removeEntity(_0x4272ff,null))[_0xf342('0x3f')](handleError(_0x4272ff,null));};exports[_0xf342('0x47')]=function(_0x11baa9,_0x42291f){return db[_0xf342('0x3b')]['describe']()['then'](respondWithResult(_0x42291f,null))[_0xf342('0x3f')](handleError(_0x42291f,null));}; \ No newline at end of file +var _0xbdf4=['rimraf','zip-dir','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','describe','eml-format'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbdf4,0x17b));var _0x4bdf=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xbdf4[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x4bdf('0x0'));var rimraf=require(_0x4bdf('0x1'));var zipdir=require(_0x4bdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4bdf('0x3'));var Mustache=require('mustache');var util=require(_0x4bdf('0x4'));var path=require(_0x4bdf('0x5'));var sox=require(_0x4bdf('0x6'));var csv=require('to-csv');var ejs=require(_0x4bdf('0x7'));var fs=require('fs');var fs_extra=require(_0x4bdf('0x8'));var _=require(_0x4bdf('0x9'));var squel=require(_0x4bdf('0xa'));var crypto=require(_0x4bdf('0xb'));var jsforce=require(_0x4bdf('0xc'));var deskjs=require(_0x4bdf('0xd'));var toCsv=require(_0x4bdf('0xe'));var querystring=require('querystring');var Papa=require(_0x4bdf('0xf'));var Redis=require(_0x4bdf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4bdf('0x11'));var as=require(_0x4bdf('0x12'));var hardwareService=require(_0x4bdf('0x13'));var logger=require(_0x4bdf('0x14'))(_0x4bdf('0x15'));var utils=require('../../config/utils');var config=require(_0x4bdf('0x16'));var licenseUtil=require(_0x4bdf('0x17'));var db=require(_0x4bdf('0x18'))['db'];function respondWithStatusCode(_0x512edf,_0x5358b1){_0x5358b1=_0x5358b1||0xcc;return function(_0x2c83b0){if(_0x2c83b0){return _0x512edf[_0x4bdf('0x19')](_0x5358b1);}return _0x512edf[_0x4bdf('0x1a')](_0x5358b1)[_0x4bdf('0x1b')]();};}function respondWithResult(_0x4902fa,_0x599bcc){_0x599bcc=_0x599bcc||0xc8;return function(_0x1e34c8){if(_0x1e34c8){return _0x4902fa[_0x4bdf('0x1a')](_0x599bcc)[_0x4bdf('0x1c')](_0x1e34c8);}};}function respondWithFilteredResult(_0x4219c7,_0x52a5a9){return function(_0x277cae){if(_0x277cae){var _0x5e55f5=typeof _0x52a5a9[_0x4bdf('0x1d')]===_0x4bdf('0x1e')&&typeof _0x52a5a9[_0x4bdf('0x1f')]===_0x4bdf('0x1e');var _0x194d10=_0x277cae['count'];var _0x34223a=_0x5e55f5?0x0:_0x52a5a9[_0x4bdf('0x1d')];var _0x5a7aa4=_0x5e55f5?_0x277cae[_0x4bdf('0x20')]:_0x52a5a9[_0x4bdf('0x1d')]+_0x52a5a9['limit'];var _0x220186;if(_0x5a7aa4>=_0x194d10){_0x5a7aa4=_0x194d10;_0x220186=0xc8;}else{_0x220186=0xce;}_0x4219c7[_0x4bdf('0x1a')](_0x220186);return _0x4219c7[_0x4bdf('0x21')]('Content-Range',_0x34223a+'-'+_0x5a7aa4+'/'+_0x194d10)[_0x4bdf('0x1c')](_0x277cae);}return null;};}function patchUpdates(_0xffb1d7){return function(_0x134d7d){try{jsonpatch[_0x4bdf('0x22')](_0x134d7d,_0xffb1d7,!![]);}catch(_0x4c4cf6){return BPromise['reject'](_0x4c4cf6);}return _0x134d7d['save']();};}function saveUpdates(_0x2a399e,_0x3fed85){return function(_0x3e410c){if(_0x3e410c){return _0x3e410c['update'](_0x2a399e)[_0x4bdf('0x23')](function(_0x4cd519){return _0x4cd519;});}return null;};}function removeEntity(_0xdfeb73,_0x4d40e4){return function(_0x414a1c){if(_0x414a1c){return _0x414a1c[_0x4bdf('0x24')]()['then'](function(){_0xdfeb73[_0x4bdf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ce4b5,_0x4c6f3f){return function(_0x39b335){if(!_0x39b335){_0x7ce4b5[_0x4bdf('0x19')](0x194);}return _0x39b335;};}function handleError(_0x130ed0,_0x50d10e){_0x50d10e=_0x50d10e||0x1f4;return function(_0x33ec04){logger['error'](_0x33ec04[_0x4bdf('0x25')]);if(_0x33ec04[_0x4bdf('0x26')]){delete _0x33ec04[_0x4bdf('0x26')];}_0x130ed0[_0x4bdf('0x1a')](_0x50d10e)['send'](_0x33ec04);};}exports[_0x4bdf('0x27')]=function(_0x454cc0,_0x4ea06a){var _0x3659e8={},_0x5ad80d={},_0x3bc1a7={'count':0x0,'rows':[]};var _0x2e7156=_[_0x4bdf('0x28')](db[_0x4bdf('0x29')][_0x4bdf('0x2a')],function(_0x51acb4){return{'name':_0x51acb4[_0x4bdf('0x2b')],'type':_0x51acb4[_0x4bdf('0x2c')][_0x4bdf('0x2d')]};});_0x5ad80d[_0x4bdf('0x2e')]=_[_0x4bdf('0x28')](_0x2e7156,_0x4bdf('0x26'));_0x5ad80d['query']=_[_0x4bdf('0x2f')](_0x454cc0[_0x4bdf('0x30')]);_0x5ad80d[_0x4bdf('0x31')]=_[_0x4bdf('0x32')](_0x5ad80d[_0x4bdf('0x2e')],_0x5ad80d[_0x4bdf('0x30')]);_0x3659e8['attributes']=_[_0x4bdf('0x32')](_0x5ad80d[_0x4bdf('0x2e')],qs[_0x4bdf('0x33')](_0x454cc0[_0x4bdf('0x30')][_0x4bdf('0x33')]));_0x3659e8[_0x4bdf('0x34')]=_0x3659e8['attributes'][_0x4bdf('0x35')]?_0x3659e8[_0x4bdf('0x34')]:_0x5ad80d[_0x4bdf('0x2e')];if(!_0x454cc0['query'][_0x4bdf('0x36')](_0x4bdf('0x37'))){_0x3659e8[_0x4bdf('0x1f')]=qs['limit'](_0x454cc0[_0x4bdf('0x30')][_0x4bdf('0x1f')]);_0x3659e8[_0x4bdf('0x1d')]=qs[_0x4bdf('0x1d')](_0x454cc0[_0x4bdf('0x30')][_0x4bdf('0x1d')]);}_0x3659e8[_0x4bdf('0x38')]=qs['sort'](_0x454cc0[_0x4bdf('0x30')][_0x4bdf('0x39')]);_0x3659e8[_0x4bdf('0x3a')]=qs[_0x4bdf('0x31')](_[_0x4bdf('0x3b')](_0x454cc0['query'],_0x5ad80d['filters']),_0x2e7156);if(_0x454cc0['query'][_0x4bdf('0x3c')]){_0x3659e8[_0x4bdf('0x3a')]=_['merge'](_0x3659e8[_0x4bdf('0x3a')],{'$or':_['map'](_0x2e7156,function(_0x1be10b){if(_0x1be10b['type']!==_0x4bdf('0x3d')){var _0x47a453={};_0x47a453[_0x1be10b[_0x4bdf('0x26')]]={'$like':'%'+_0x454cc0[_0x4bdf('0x30')]['filter']+'%'};return _0x47a453;}})});}_0x3659e8=_[_0x4bdf('0x3e')]({},_0x3659e8,_0x454cc0['options']);var _0x342e34={'where':_0x3659e8[_0x4bdf('0x3a')]};return db[_0x4bdf('0x29')][_0x4bdf('0x20')](_0x342e34)[_0x4bdf('0x23')](function(_0x4d462a){_0x3bc1a7[_0x4bdf('0x20')]=_0x4d462a;if(_0x454cc0[_0x4bdf('0x30')][_0x4bdf('0x3f')]){_0x3659e8[_0x4bdf('0x40')]=[{'all':!![]}];}return db[_0x4bdf('0x29')][_0x4bdf('0x41')](_0x3659e8);})[_0x4bdf('0x23')](function(_0x4e6aa9){_0x3bc1a7[_0x4bdf('0x42')]=_0x4e6aa9;return _0x3bc1a7;})[_0x4bdf('0x23')](respondWithFilteredResult(_0x4ea06a,_0x3659e8))[_0x4bdf('0x43')](handleError(_0x4ea06a,null));};exports[_0x4bdf('0x44')]=function(_0x48d275,_0x3efc39){var _0x17d036={'raw':!![],'where':{'id':_0x48d275['params']['id']}},_0x56d72b={};_0x56d72b['model']=_[_0x4bdf('0x2f')](db[_0x4bdf('0x29')][_0x4bdf('0x2a')]);_0x56d72b[_0x4bdf('0x30')]=_[_0x4bdf('0x2f')](_0x48d275['query']);_0x56d72b[_0x4bdf('0x31')]=_[_0x4bdf('0x32')](_0x56d72b[_0x4bdf('0x2e')],_0x56d72b[_0x4bdf('0x30')]);_0x17d036[_0x4bdf('0x34')]=_['intersection'](_0x56d72b[_0x4bdf('0x2e')],qs[_0x4bdf('0x33')](_0x48d275['query']['fields']));_0x17d036[_0x4bdf('0x34')]=_0x17d036[_0x4bdf('0x34')][_0x4bdf('0x35')]?_0x17d036['attributes']:_0x56d72b[_0x4bdf('0x2e')];if(_0x48d275['query'][_0x4bdf('0x3f')]){_0x17d036[_0x4bdf('0x40')]=[{'all':!![]}];}_0x17d036=_[_0x4bdf('0x3e')]({},_0x17d036,_0x48d275[_0x4bdf('0x45')]);return db['SmsTransferReport'][_0x4bdf('0x46')](_0x17d036)[_0x4bdf('0x23')](handleEntityNotFound(_0x3efc39,null))[_0x4bdf('0x23')](respondWithResult(_0x3efc39,null))['catch'](handleError(_0x3efc39,null));};exports[_0x4bdf('0x47')]=function(_0x54f7d1,_0x1659e7){return db[_0x4bdf('0x29')][_0x4bdf('0x47')](_0x54f7d1[_0x4bdf('0x48')],{})[_0x4bdf('0x23')](respondWithResult(_0x1659e7,0xc9))[_0x4bdf('0x43')](handleError(_0x1659e7,null));};exports[_0x4bdf('0x49')]=function(_0x2df79f,_0x531306){if(_0x2df79f[_0x4bdf('0x48')]['id']){delete _0x2df79f['body']['id'];}return db['SmsTransferReport'][_0x4bdf('0x46')]({'where':{'id':_0x2df79f[_0x4bdf('0x4a')]['id']}})[_0x4bdf('0x23')](handleEntityNotFound(_0x531306,null))[_0x4bdf('0x23')](saveUpdates(_0x2df79f['body'],null))[_0x4bdf('0x23')](respondWithResult(_0x531306,null))[_0x4bdf('0x43')](handleError(_0x531306,null));};exports[_0x4bdf('0x24')]=function(_0x3d5241,_0x4b8563){return db[_0x4bdf('0x29')]['find']({'where':{'id':_0x3d5241[_0x4bdf('0x4a')]['id']}})[_0x4bdf('0x23')](handleEntityNotFound(_0x4b8563,null))[_0x4bdf('0x23')](removeEntity(_0x4b8563,null))['catch'](handleError(_0x4b8563,null));};exports[_0x4bdf('0x4b')]=function(_0x7e637f,_0x516965){return db[_0x4bdf('0x29')]['describe']()[_0x4bdf('0x23')](respondWithResult(_0x516965,null))['catch'](handleError(_0x516965,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 53ab463..b1adeeb 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 _0xb78f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xb78f,0x134));var _0xfb78=function(_0x359956,_0x45292d){_0x359956=_0x359956-0x0;var _0x3921cf=_0xb78f[_0x359956];return _0x3921cf;};'use strict';var _=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var logger=require(_0xfb78('0x2'))(_0xfb78('0x3'));var moment=require(_0xfb78('0x4'));var BPromise=require(_0xfb78('0x5'));var rp=require(_0xfb78('0x6'));var fs=require('fs');var path=require(_0xfb78('0x7'));var rimraf=require('rimraf');var config=require(_0xfb78('0x8'));var attributes=require(_0xfb78('0x9'));module[_0xfb78('0xa')]=function(_0x5e965c,_0x77615d){return _0x5e965c[_0xfb78('0xb')](_0xfb78('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xfb78('0xd'),'fields':[_0xfb78('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x513932,_0x1c0927){var _0x3b6607=function(_0x5df0f7){while(--_0x5df0f7){_0x513932['push'](_0x513932['shift']());}};_0x3b6607(++_0x1c0927);}(_0x84ab,0x12f));var _0xb84a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x84ab[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb84a('0xb'),'fields':[_0xb84a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 9643cad..1f64a35 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x4ec9f9,_0x4751e8){var _0x13b41f=function(_0x43f635){while(--_0x43f635){_0x4ec9f9['push'](_0x4ec9f9['shift']());}};_0x13b41f(++_0x4751e8);}(_0x3e74,0x175));var _0x43e7=function(_0x51f047,_0x1dd144){_0x51f047=_0x51f047-0x0;var _0x1843ac=_0x3e74[_0x51f047];return _0x1843ac;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x956a=['message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x220649,_0x1c6ad6){var _0x18ceab=function(_0x4b13af){while(--_0x4b13af){_0x220649['push'](_0x220649['shift']());}};_0x18ceab(++_0x1c6ad6);}(_0x956a,0xb6));var _0xa956=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x956a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa956('0x0'));var moment=require(_0xa956('0x1'));var BPromise=require(_0xa956('0x2'));var rs=require(_0xa956('0x3'));var fs=require('fs');var Redis=require(_0xa956('0x4'));var db=require(_0xa956('0x5'))['db'];var utils=require(_0xa956('0x6'));var logger=require(_0xa956('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa956('0x8'));var client=jayson[_0xa956('0x9')][_0xa956('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1684,_0xdaa956,_0x1318ea){return new BPromise(function(_0x1265dd,_0x10f0e3){return client[_0xa956('0xb')](_0x5f1684,_0x1318ea)[_0xa956('0xc')](function(_0x380479){logger['info'](_0xa956('0xd'),_0xdaa956,_0xa956('0xe'));logger['debug'](_0xa956('0xf'),_0xdaa956,_0xa956('0xe'),JSON['stringify'](_0x380479));if(_0x380479['error']){if(_0x380479[_0xa956('0x10')][_0xa956('0x11')]===0x1f4){logger[_0xa956('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xdaa956,_0x380479[_0xa956('0x10')][_0xa956('0x12')]);return _0x10f0e3(_0x380479[_0xa956('0x10')]['message']);}logger['error'](_0xa956('0xd'),_0xdaa956,_0x380479['error']['message']);return _0x1265dd(_0x380479[_0xa956('0x10')][_0xa956('0x12')]);}else{logger[_0xa956('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0xdaa956,'request\x20sent');_0x1265dd(_0x380479['result'][_0xa956('0x12')]);}})['catch'](function(_0x36e181){logger[_0xa956('0x10')](_0xa956('0xd'),_0xdaa956,_0x36e181);_0x10f0e3(_0x36e181);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e2b2f03..cc7ee21 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 _0x6c00=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','delete','exports','multer','util','path'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0x6c00,0x102));var _0x06c0=function(_0x1c88f9,_0x211646){_0x1c88f9=_0x1c88f9-0x0;var _0x1779f7=_0x6c00[_0x1c88f9];return _0x1779f7;};'use strict';var multer=require(_0x06c0('0x0'));var util=require(_0x06c0('0x1'));var path=require(_0x06c0('0x2'));var timeout=require(_0x06c0('0x3'));var express=require(_0x06c0('0x4'));var router=express[_0x06c0('0x5')]();var fs_extra=require(_0x06c0('0x6'));var auth=require(_0x06c0('0x7'));var interaction=require(_0x06c0('0x8'));var config=require(_0x06c0('0x9'));var controller=require(_0x06c0('0xa'));router[_0x06c0('0xb')]('/',auth[_0x06c0('0xc')](),controller['index']);router['get'](_0x06c0('0xd'),auth['isAuthenticated'](),controller[_0x06c0('0xe')]);router[_0x06c0('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x06c0('0xf')]);var upload=multer({'storage':multer[_0x06c0('0x10')]({'destination':function(_0xf2d44f,_0x1ae37c,_0x275da3){_0x275da3(null,path['join'](config[_0x06c0('0x11')],'server/files/sounds/original/'));},'filename':function(_0x476889,_0x3e85cf,_0x42fe74){_0x3e85cf[_0x06c0('0x12')]=_0x3e85cf[_0x06c0('0x12')][_0x06c0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42fe74(null,util[_0x06c0('0x14')](_0x06c0('0x15'),path[_0x06c0('0x16')](_0x3e85cf[_0x06c0('0x12')],path[_0x06c0('0x17')](_0x3e85cf[_0x06c0('0x12')])),Date['now'](),path[_0x06c0('0x17')](_0x3e85cf[_0x06c0('0x12')])));}})});router[_0x06c0('0x18')]('/',upload[_0x06c0('0x19')](_0x06c0('0x1a')),controller['create']);router['put'](_0x06c0('0xd'),auth[_0x06c0('0xc')](),controller['update']);router[_0x06c0('0x1b')](_0x06c0('0xd'),auth[_0x06c0('0xc')](),controller[_0x06c0('0x1b')]);module[_0x06c0('0x1c')]=router; \ No newline at end of file +var _0xbf7b=['get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','put','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','./sound.controller'];(function(_0x4a9053,_0x1856fb){var _0x475a0a=function(_0x289340){while(--_0x289340){_0x4a9053['push'](_0x4a9053['shift']());}};_0x475a0a(++_0x1856fb);}(_0xbf7b,0x77));var _0xbbf7=function(_0x58c098,_0x501578){_0x58c098=_0x58c098-0x0;var _0x4643a0=_0xbf7b[_0x58c098];return _0x4643a0;};'use strict';var multer=require(_0xbbf7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbbf7('0x1'));var express=require(_0xbbf7('0x2'));var router=express[_0xbbf7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbbf7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbbf7('0x5'));router[_0xbbf7('0x6')]('/',auth[_0xbbf7('0x7')](),controller['index']);router[_0xbbf7('0x6')](_0xbbf7('0x8'),auth['isAuthenticated'](),controller[_0xbbf7('0x9')]);router[_0xbbf7('0x6')](_0xbbf7('0xa'),auth[_0xbbf7('0x7')](),controller[_0xbbf7('0xb')]);var upload=multer({'storage':multer[_0xbbf7('0xc')]({'destination':function(_0x582bc4,_0x2d8505,_0x404a91){_0x404a91(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x1d17bd,_0x1dc558,_0x383f5f){_0x1dc558[_0xbbf7('0xd')]=_0x1dc558[_0xbbf7('0xd')][_0xbbf7('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x383f5f(null,util[_0xbbf7('0xf')](_0xbbf7('0x10'),path[_0xbbf7('0x11')](_0x1dc558[_0xbbf7('0xd')],path[_0xbbf7('0x12')](_0x1dc558[_0xbbf7('0xd')])),Date[_0xbbf7('0x13')](),path[_0xbbf7('0x12')](_0x1dc558[_0xbbf7('0xd')])));}})});router[_0xbbf7('0x14')]('/',upload['single'](_0xbbf7('0x15')),controller['create']);router[_0xbbf7('0x16')](_0xbbf7('0x8'),auth[_0xbbf7('0x7')](),controller[_0xbbf7('0x17')]);router[_0xbbf7('0x18')]('/:id',auth[_0xbbf7('0x7')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5b92559..3bab8c8 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 _0xb7e1=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x48df90,_0x1c443e){var _0x29ed1f=function(_0x4f7728){while(--_0x4f7728){_0x48df90['push'](_0x48df90['shift']());}};_0x29ed1f(++_0x1c443e);}(_0xb7e1,0x96));var _0x1b7e=function(_0x4c6eb0,_0x3301b0){_0x4c6eb0=_0x4c6eb0-0x0;var _0x417e51=_0xb7e1[_0x4c6eb0];return _0x417e51;};'use strict';var Sequelize=require(_0x1b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b7e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x1b7e('0x1')]},'display_name':{'type':Sequelize[_0x1b7e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1b7e('0x1')]},'original_format':{'type':Sequelize[_0x1b7e('0x1')]},'original_duration':{'type':Sequelize[_0x1b7e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x1b7e('0x3')]},'original_channelCount':{'type':Sequelize[_0x1b7e('0x4')]},'original_bitRate':{'type':Sequelize[_0x1b7e('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x1b7e('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1b7e('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1b7e('0x4')]}}; \ No newline at end of file +var _0xcf66=['name','FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x3c403b,_0x2c38b3){var _0x42adb5=function(_0x2ccfc4){while(--_0x2ccfc4){_0x3c403b['push'](_0x3c403b['shift']());}};_0x42adb5(++_0x2c38b3);}(_0xcf66,0x185));var _0x6cf6=function(_0xdd8b9b,_0x527792){_0xdd8b9b=_0xdd8b9b-0x0;var _0x51105a=_0xcf66[_0xdd8b9b];return _0x51105a;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'unique':_0x6cf6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6cf6('0x2')]},'display_name':{'type':Sequelize[_0x6cf6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x6cf6('0x2')]},'original_format':{'type':Sequelize[_0x6cf6('0x2')]},'original_duration':{'type':Sequelize[_0x6cf6('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x6cf6('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x6cf6('0x5')]},'converted_format':{'type':Sequelize[_0x6cf6('0x2')]},'converted_duration':{'type':Sequelize[_0x6cf6('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x6cf6('0x6')]},'converted_channelCount':{'type':Sequelize[_0x6cf6('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6cf6('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x6cf6('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7068651..7283d67 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 _0x2e5f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','get','Sounds','UserProfileResource','then','error','name','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','eml-format'];(function(_0x1c4b30,_0x21d23b){var _0x536864=function(_0x5e7768){while(--_0x5e7768){_0x1c4b30['push'](_0x1c4b30['shift']());}};_0x536864(++_0x21d23b);}(_0x2e5f,0x107));var _0xf2e5=function(_0x296b65,_0x24b072){_0x296b65=_0x296b65-0x0;var _0x1e822b=_0x2e5f[_0x296b65];return _0x1e822b;};'use strict';var emlformat=require(_0xf2e5('0x0'));var rimraf=require(_0xf2e5('0x1'));var zipdir=require(_0xf2e5('0x2'));var jsonpatch=require(_0xf2e5('0x3'));var rp=require(_0xf2e5('0x4'));var moment=require(_0xf2e5('0x5'));var BPromise=require(_0xf2e5('0x6'));var Mustache=require(_0xf2e5('0x7'));var util=require(_0xf2e5('0x8'));var path=require(_0xf2e5('0x9'));var sox=require(_0xf2e5('0xa'));var csv=require('to-csv');var ejs=require(_0xf2e5('0xb'));var fs=require('fs');var fs_extra=require(_0xf2e5('0xc'));var _=require('lodash');var squel=require(_0xf2e5('0xd'));var crypto=require(_0xf2e5('0xe'));var jsforce=require(_0xf2e5('0xf'));var deskjs=require(_0xf2e5('0x10'));var toCsv=require(_0xf2e5('0x11'));var querystring=require(_0xf2e5('0x12'));var Papa=require(_0xf2e5('0x13'));var Redis=require(_0xf2e5('0x14'));var authService=require(_0xf2e5('0x15'));var qs=require(_0xf2e5('0x16'));var as=require(_0xf2e5('0x17'));var hardwareService=require(_0xf2e5('0x18'));var logger=require(_0xf2e5('0x19'))(_0xf2e5('0x1a'));var utils=require(_0xf2e5('0x1b'));var config=require(_0xf2e5('0x1c'));var licenseUtil=require(_0xf2e5('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28de90,_0x39d408){_0x39d408=_0x39d408||0xcc;return function(_0x182a72){if(_0x182a72){return _0x28de90[_0xf2e5('0x1e')](_0x39d408);}return _0x28de90[_0xf2e5('0x1f')](_0x39d408)[_0xf2e5('0x20')]();};}function respondWithResult(_0xff3192,_0x15905c){_0x15905c=_0x15905c||0xc8;return function(_0x4bc234){if(_0x4bc234){return _0xff3192[_0xf2e5('0x1f')](_0x15905c)['json'](_0x4bc234);}};}function respondWithFilteredResult(_0x4153a8,_0x1d7ee8){return function(_0x3cea7b){if(_0x3cea7b){var _0x2a330b=typeof _0x1d7ee8[_0xf2e5('0x21')]==='undefined'&&typeof _0x1d7ee8[_0xf2e5('0x22')]===_0xf2e5('0x23');var _0x47b73e=_0x3cea7b[_0xf2e5('0x24')];var _0x3c91b3=_0x2a330b?0x0:_0x1d7ee8[_0xf2e5('0x21')];var _0x4fcc05=_0x2a330b?_0x3cea7b[_0xf2e5('0x24')]:_0x1d7ee8['offset']+_0x1d7ee8[_0xf2e5('0x22')];var _0x4f7029;if(_0x4fcc05>=_0x47b73e){_0x4fcc05=_0x47b73e;_0x4f7029=0xc8;}else{_0x4f7029=0xce;}_0x4153a8['status'](_0x4f7029);return _0x4153a8['set'](_0xf2e5('0x25'),_0x3c91b3+'-'+_0x4fcc05+'/'+_0x47b73e)[_0xf2e5('0x26')](_0x3cea7b);}return null;};}function patchUpdates(_0x5e7955){return function(_0x4ebdc2){try{jsonpatch[_0xf2e5('0x27')](_0x4ebdc2,_0x5e7955,!![]);}catch(_0x1c524f){return BPromise[_0xf2e5('0x28')](_0x1c524f);}return _0x4ebdc2[_0xf2e5('0x29')]();};}function saveUpdates(_0x279773,_0x249329){return function(_0x1f5c96){if(_0x1f5c96){return _0x1f5c96[_0xf2e5('0x2a')](_0x279773)['then'](function(_0x37759e){return _0x37759e;});}return null;};}function removeEntity(_0x5becfd,_0x10d96d){return function(_0x12a02e){if(_0x12a02e){return _0x12a02e[_0xf2e5('0x2b')]()['then'](function(){var _0x4614d8=_0x12a02e[_0xf2e5('0x2c')]({'plain':!![]});var _0x2bb661=_0xf2e5('0x2d');return db[_0xf2e5('0x2e')][_0xf2e5('0x2b')]({'where':{'type':_0x2bb661,'resourceId':_0x4614d8['id']}})['then'](function(){return _0x12a02e;});})[_0xf2e5('0x2f')](function(){_0x5becfd['status'](0xcc)[_0xf2e5('0x20')]();});}};}function handleEntityNotFound(_0x4f375c,_0x25398b){return function(_0x3756cd){if(!_0x3756cd){_0x4f375c[_0xf2e5('0x1e')](0x194);}return _0x3756cd;};}function handleError(_0x297244,_0x5ebdc9){_0x5ebdc9=_0x5ebdc9||0x1f4;return function(_0x57107a){logger[_0xf2e5('0x30')](_0x57107a['stack']);if(_0x57107a['name']){delete _0x57107a[_0xf2e5('0x31')];}_0x297244[_0xf2e5('0x1f')](_0x5ebdc9)['send'](_0x57107a);};}exports['index']=function(_0x160594,_0x14bfe7){var _0x26e1fa={},_0x3aca67={},_0x41ff58={'count':0x0,'rows':[]};var _0xf5e80d=_[_0xf2e5('0x32')](db[_0xf2e5('0x33')]['rawAttributes'],function(_0x4a191f){return{'name':_0x4a191f[_0xf2e5('0x34')],'type':_0x4a191f[_0xf2e5('0x35')][_0xf2e5('0x36')]};});_0x3aca67[_0xf2e5('0x37')]=_[_0xf2e5('0x32')](_0xf5e80d,'name');_0x3aca67[_0xf2e5('0x38')]=_[_0xf2e5('0x39')](_0x160594[_0xf2e5('0x38')]);_0x3aca67[_0xf2e5('0x3a')]=_[_0xf2e5('0x3b')](_0x3aca67[_0xf2e5('0x37')],_0x3aca67[_0xf2e5('0x38')]);_0x26e1fa[_0xf2e5('0x3c')]=_[_0xf2e5('0x3b')](_0x3aca67[_0xf2e5('0x37')],qs[_0xf2e5('0x3d')](_0x160594['query'][_0xf2e5('0x3d')]));_0x26e1fa[_0xf2e5('0x3c')]=_0x26e1fa['attributes'][_0xf2e5('0x3e')]?_0x26e1fa[_0xf2e5('0x3c')]:_0x3aca67[_0xf2e5('0x37')];if(!_0x160594[_0xf2e5('0x38')][_0xf2e5('0x3f')](_0xf2e5('0x40'))){_0x26e1fa['limit']=qs[_0xf2e5('0x22')](_0x160594[_0xf2e5('0x38')][_0xf2e5('0x22')]);_0x26e1fa[_0xf2e5('0x21')]=qs[_0xf2e5('0x21')](_0x160594[_0xf2e5('0x38')]['offset']);}_0x26e1fa[_0xf2e5('0x41')]=qs[_0xf2e5('0x42')](_0x160594[_0xf2e5('0x38')][_0xf2e5('0x42')]);_0x26e1fa[_0xf2e5('0x43')]=qs[_0xf2e5('0x3a')](_[_0xf2e5('0x44')](_0x160594[_0xf2e5('0x38')],_0x3aca67[_0xf2e5('0x3a')]),_0xf5e80d);if(_0x160594[_0xf2e5('0x38')][_0xf2e5('0x45')]){_0x26e1fa[_0xf2e5('0x43')]=_[_0xf2e5('0x46')](_0x26e1fa[_0xf2e5('0x43')],{'$or':_[_0xf2e5('0x32')](_0xf5e80d,function(_0x287c56){if(_0x287c56['type']!==_0xf2e5('0x47')){var _0x487bfd={};_0x487bfd[_0x287c56[_0xf2e5('0x31')]]={'$like':'%'+_0x160594[_0xf2e5('0x38')][_0xf2e5('0x45')]+'%'};return _0x487bfd;}})});}_0x26e1fa=_[_0xf2e5('0x46')]({},_0x26e1fa,_0x160594['options']);var _0x4cc0ba={'where':_0x26e1fa[_0xf2e5('0x43')]};return db['Sound'][_0xf2e5('0x24')](_0x4cc0ba)[_0xf2e5('0x2f')](function(_0x594b69){_0x41ff58['count']=_0x594b69;if(_0x160594[_0xf2e5('0x38')][_0xf2e5('0x48')]){_0x26e1fa['include']=[{'all':!![]}];}return db[_0xf2e5('0x33')][_0xf2e5('0x49')](_0x26e1fa);})[_0xf2e5('0x2f')](function(_0x10c44a){_0x41ff58[_0xf2e5('0x4a')]=_0x10c44a;return _0x41ff58;})[_0xf2e5('0x2f')](respondWithFilteredResult(_0x14bfe7,_0x26e1fa))[_0xf2e5('0x4b')](handleError(_0x14bfe7,null));};exports[_0xf2e5('0x4c')]=function(_0x8e87d2,_0x38868d){var _0x4184f2={'raw':!![],'where':{'id':_0x8e87d2[_0xf2e5('0x4d')]['id']}},_0x302484={};_0x302484[_0xf2e5('0x37')]=_[_0xf2e5('0x39')](db[_0xf2e5('0x33')][_0xf2e5('0x4e')]);_0x302484[_0xf2e5('0x38')]=_[_0xf2e5('0x39')](_0x8e87d2[_0xf2e5('0x38')]);_0x302484[_0xf2e5('0x3a')]=_[_0xf2e5('0x3b')](_0x302484['model'],_0x302484[_0xf2e5('0x38')]);_0x4184f2[_0xf2e5('0x3c')]=_[_0xf2e5('0x3b')](_0x302484[_0xf2e5('0x37')],qs[_0xf2e5('0x3d')](_0x8e87d2[_0xf2e5('0x38')]['fields']));_0x4184f2[_0xf2e5('0x3c')]=_0x4184f2[_0xf2e5('0x3c')][_0xf2e5('0x3e')]?_0x4184f2[_0xf2e5('0x3c')]:_0x302484[_0xf2e5('0x37')];if(_0x8e87d2[_0xf2e5('0x38')]['includeAll']){_0x4184f2[_0xf2e5('0x4f')]=[{'all':!![]}];}_0x4184f2=_[_0xf2e5('0x46')]({},_0x4184f2,_0x8e87d2[_0xf2e5('0x50')]);return db[_0xf2e5('0x33')][_0xf2e5('0x51')](_0x4184f2)[_0xf2e5('0x2f')](handleEntityNotFound(_0x38868d,null))[_0xf2e5('0x2f')](respondWithResult(_0x38868d,null))['catch'](handleError(_0x38868d,null));};exports[_0xf2e5('0x52')]=function(_0x361a2d,_0x58cd93,_0x5232f6){return db[_0xf2e5('0x33')][_0xf2e5('0x51')]({'where':{'id':_0x361a2d['params']['id']},'attributes':[_0xf2e5('0x31'),_0xf2e5('0x53'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x58cd93,null))[_0xf2e5('0x2f')](function(_0x3f16b9){if(_0x3f16b9){if(!fs[_0xf2e5('0x54')](path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x57'),_0x3f16b9['save_name']+'.'+_0x3f16b9[_0xf2e5('0x58')]))){throw new db[(_0xf2e5('0x59'))][(_0xf2e5('0x5a'))](_0xf2e5('0x5b'));}return _0x58cd93[_0xf2e5('0x52')](path[_0xf2e5('0x55')](config['root'],_0xf2e5('0x57'),util['format'](_0xf2e5('0x5c'),_0x3f16b9[_0xf2e5('0x53')],_0x3f16b9[_0xf2e5('0x58')])),util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),_0x3f16b9[_0xf2e5('0x31')],_0x3f16b9[_0xf2e5('0x58')]));}return null;})['catch'](handleError(_0x58cd93,null));};exports[_0xf2e5('0x5e')]=function(_0x5ceb14,_0x56d5ff,_0x352edc){var _0x2c9ada={'name':path[_0xf2e5('0x5f')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x61')],path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x61')])),'save_name':path['basename'](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')],path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')])),'original_format':path[_0xf2e5('0x62')](_0x5ceb14[_0xf2e5('0x60')]['originalname'])['substring'](0x1),'converted_format':_0xf2e5('0x64')};var _0x3c6c7a=path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x65'),_0x5ceb14[_0xf2e5('0x60')]['filename']);var _0x45ac31=path[_0xf2e5('0x55')](config[_0xf2e5('0x56')],_0xf2e5('0x57'),util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),path[_0xf2e5('0x5f')](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')],path['extname'](_0x5ceb14[_0xf2e5('0x60')][_0xf2e5('0x63')])),_0x2c9ada[_0xf2e5('0x58')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x3c6c7a);logger[_0xf2e5('0x66')]('Sound\x20upload\x20destination:\x20%s',_0x45ac31);try{fs[_0xf2e5('0x67')](_0x3c6c7a,parseInt(_0xf2e5('0x68'),0x8));var _0x4351fb=sox[_0xf2e5('0x69')](_0x3c6c7a,_0x45ac31,{'sampleRate':0x1f40,'format':_0xf2e5('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4351fb['on']('error',function(_0x15b51b){fs[_0xf2e5('0x6a')](_0x3c6c7a);_0x56d5ff[_0xf2e5('0x1f')](0x1f4)['send'](_0x15b51b);});_0x4351fb['on']('src',function(_0x17b8cc){_0x2c9ada[_0xf2e5('0x6b')]=isNaN(_0x17b8cc[_0xf2e5('0x6c')])?null:_0x17b8cc[_0xf2e5('0x6c')]*0x3e8;_0x2c9ada[_0xf2e5('0x6d')]=isNaN(_0x17b8cc[_0xf2e5('0x6e')])?null:_0x17b8cc[_0xf2e5('0x6e')];_0x2c9ada[_0xf2e5('0x6f')]=isNaN(_0x17b8cc[_0xf2e5('0x70')])?null:_0x17b8cc[_0xf2e5('0x70')];_0x2c9ada[_0xf2e5('0x71')]=isNaN(_0x17b8cc['bitRate'])?null:_0x17b8cc[_0xf2e5('0x72')];_0x2c9ada[_0xf2e5('0x73')]=isNaN(_0x17b8cc[_0xf2e5('0x74')])?null:_0x17b8cc[_0xf2e5('0x74')];});_0x4351fb['on'](_0xf2e5('0x75'),function(_0x4f3227){_0x2c9ada[_0xf2e5('0x76')]=isNaN(_0x4f3227[_0xf2e5('0x6c')])?null:_0x4f3227[_0xf2e5('0x6c')]*0x3e8;_0x2c9ada[_0xf2e5('0x77')]=isNaN(_0x4f3227['sampleCount'])?null:_0x4f3227[_0xf2e5('0x6e')];_0x2c9ada['converted_channelCount']=isNaN(_0x4f3227[_0xf2e5('0x70')])?null:_0x4f3227['channelCount'];_0x2c9ada[_0xf2e5('0x78')]=isNaN(_0x4f3227[_0xf2e5('0x72')])?null:_0x4f3227['bitRate'];_0x2c9ada[_0xf2e5('0x79')]=isNaN(_0x4f3227[_0xf2e5('0x74')])?null:_0x4f3227[_0xf2e5('0x74')];});_0x4351fb['on'](_0xf2e5('0x20'),function(){fs[_0xf2e5('0x67')](_0x45ac31,parseInt(_0xf2e5('0x68'),0x8));return db[_0xf2e5('0x33')][_0xf2e5('0x5e')](_0x2c9ada)[_0xf2e5('0x2f')](function(_0x51764c){var _0x39bee6={'role':_0x5ceb14[_0xf2e5('0x7a')][_0xf2e5('0x7b')],'userProfileId':_0x5ceb14[_0xf2e5('0x7a')][_0xf2e5('0x7c')]};if(!_0x39bee6)throw new Error(_0xf2e5('0x7d'));if(_0x39bee6[_0xf2e5('0x7b')]==='user'){var _0x774133=_0x51764c[_0xf2e5('0x2c')]({'plain':!![]});return db[_0xf2e5('0x7e')][_0xf2e5('0x51')]({'where':{'name':_0xf2e5('0x2d'),'userProfileId':_0x39bee6['userProfileId']},'raw':!![]})[_0xf2e5('0x2f')](function(_0x1a29b4){if(_0x1a29b4&&_0x1a29b4[_0xf2e5('0x7f')]===0x0){return db['UserProfileResource'][_0xf2e5('0x5e')]({'name':_0x774133[_0xf2e5('0x31')],'resourceId':_0x774133['id'],'type':_0x1a29b4[_0xf2e5('0x31')],'sectionId':_0x1a29b4['id']},{})['then'](function(){return _0x51764c;});}else{return _0x51764c;}})[_0xf2e5('0x4b')](function(_0x197e2f){logger[_0xf2e5('0x30')](_0xf2e5('0x80'),_0x197e2f);throw _0x197e2f;});}return _0x51764c;})[_0xf2e5('0x2f')](respondWithResult(_0x56d5ff,null))['catch'](handleError(_0x56d5ff,null));});_0x4351fb[_0xf2e5('0x81')]();}catch(_0x223ba3){_0x56d5ff['status'](0x1f4)[_0xf2e5('0x82')](_0x223ba3);}};exports['update']=function(_0x43d2d8,_0x969384,_0x59036f){return db['Sound'][_0xf2e5('0x51')]({'where':{'id':_0x43d2d8[_0xf2e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x969384,null))[_0xf2e5('0x2f')](saveUpdates(_[_0xf2e5('0x44')](_0x43d2d8['body'],[_0xf2e5('0x31'),_0xf2e5('0x83')]),null))[_0xf2e5('0x2f')](respondWithResult(_0x969384,null))[_0xf2e5('0x4b')](handleError(_0x969384,null));};exports['delete']=function(_0x295033,_0x2f3b5a,_0x53230c){return db[_0xf2e5('0x33')]['find']({'where':{'id':_0x295033['params']['id']}})[_0xf2e5('0x2f')](function(_0x2d7a7e){if(_0x2d7a7e){return _0x2d7a7e[_0xf2e5('0x2b')]();}})[_0xf2e5('0x2f')](function(_0x20138f){var _0x17b295=path[_0xf2e5('0x55')](config['root'],'server/files/sounds/original',util[_0xf2e5('0x5d')](_0xf2e5('0x5c'),_0x20138f[_0xf2e5('0x53')],_0x20138f['original_format']));var _0x1151ba=path['join'](config[_0xf2e5('0x56')],'server/files/sounds/converted',util['format'](_0xf2e5('0x5c'),_0x20138f[_0xf2e5('0x53')],_0x20138f[_0xf2e5('0x58')]));fs['unlinkSync'](_0x17b295);fs[_0xf2e5('0x6a')](_0x1151ba);return _0x20138f;})['then'](function(_0x15a3de){if(_0x15a3de){return _0x2f3b5a[_0xf2e5('0x1f')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2f3b5a,null))[_0xf2e5('0x4b')](handleError(_0x2f3b5a,null));}; \ No newline at end of file +var _0x9da8=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','delete','original_format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','get','Sounds','destroy','error','stack','name','map','Sound','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','includeAll','include','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','create','file','originalname','extname','filename','substring','wav','server/files/sounds/original','format','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','src','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','end','userProfileId'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9da8,0x175));var _0x89da=function(_0x1d7b16,_0x168739){_0x1d7b16=_0x1d7b16-0x0;var _0x59d484=_0x9da8[_0x1d7b16];return _0x59d484;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89da('0x1'));var rp=require('request-promise');var moment=require(_0x89da('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x89da('0x3'));var util=require(_0x89da('0x4'));var path=require(_0x89da('0x5'));var sox=require('sox');var csv=require(_0x89da('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89da('0x7'));var squel=require('squel');var crypto=require(_0x89da('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89da('0x6'));var querystring=require(_0x89da('0x9'));var Papa=require('papaparse');var Redis=require(_0x89da('0xa'));var authService=require(_0x89da('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x89da('0xc'));var hardwareService=require(_0x89da('0xd'));var logger=require(_0x89da('0xe'))(_0x89da('0xf'));var utils=require(_0x89da('0x10'));var config=require(_0x89da('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x89da('0x12'))['db'];function respondWithStatusCode(_0x14c5cf,_0x51570e){_0x51570e=_0x51570e||0xcc;return function(_0x26f075){if(_0x26f075){return _0x14c5cf[_0x89da('0x13')](_0x51570e);}return _0x14c5cf[_0x89da('0x14')](_0x51570e)['end']();};}function respondWithResult(_0x2bcbd3,_0x457207){_0x457207=_0x457207||0xc8;return function(_0x44df2c){if(_0x44df2c){return _0x2bcbd3[_0x89da('0x14')](_0x457207)['json'](_0x44df2c);}};}function respondWithFilteredResult(_0x41e9c8,_0x2f384f){return function(_0x18bed1){if(_0x18bed1){var _0x426d33=typeof _0x2f384f[_0x89da('0x15')]===_0x89da('0x16')&&typeof _0x2f384f['limit']===_0x89da('0x16');var _0x58f6e3=_0x18bed1[_0x89da('0x17')];var _0x48a19b=_0x426d33?0x0:_0x2f384f[_0x89da('0x15')];var _0x2c6099=_0x426d33?_0x18bed1['count']:_0x2f384f[_0x89da('0x15')]+_0x2f384f['limit'];var _0x40643b;if(_0x2c6099>=_0x58f6e3){_0x2c6099=_0x58f6e3;_0x40643b=0xc8;}else{_0x40643b=0xce;}_0x41e9c8[_0x89da('0x14')](_0x40643b);return _0x41e9c8[_0x89da('0x18')](_0x89da('0x19'),_0x48a19b+'-'+_0x2c6099+'/'+_0x58f6e3)[_0x89da('0x1a')](_0x18bed1);}return null;};}function patchUpdates(_0x1b11eb){return function(_0x23bbea){try{jsonpatch[_0x89da('0x1b')](_0x23bbea,_0x1b11eb,!![]);}catch(_0x3294fd){return BPromise[_0x89da('0x1c')](_0x3294fd);}return _0x23bbea[_0x89da('0x1d')]();};}function saveUpdates(_0x1f8a64,_0xb10371){return function(_0x4b4e05){if(_0x4b4e05){return _0x4b4e05[_0x89da('0x1e')](_0x1f8a64)['then'](function(_0x39b2f7){return _0x39b2f7;});}return null;};}function removeEntity(_0x3493a8,_0x436246){return function(_0x43c71b){if(_0x43c71b){return _0x43c71b['destroy']()[_0x89da('0x1f')](function(){var _0x59fac9=_0x43c71b[_0x89da('0x20')]({'plain':!![]});var _0x1377df=_0x89da('0x21');return db['UserProfileResource'][_0x89da('0x22')]({'where':{'type':_0x1377df,'resourceId':_0x59fac9['id']}})['then'](function(){return _0x43c71b;});})[_0x89da('0x1f')](function(){_0x3493a8[_0x89da('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eed3e,_0x60d05e){return function(_0x431733){if(!_0x431733){_0x2eed3e['sendStatus'](0x194);}return _0x431733;};}function handleError(_0xa8b8ef,_0x32e523){_0x32e523=_0x32e523||0x1f4;return function(_0x2f4bba){logger[_0x89da('0x23')](_0x2f4bba[_0x89da('0x24')]);if(_0x2f4bba[_0x89da('0x25')]){delete _0x2f4bba['name'];}_0xa8b8ef['status'](_0x32e523)['send'](_0x2f4bba);};}exports['index']=function(_0x293467,_0x211ccd){var _0x117536={},_0x53fb9d={},_0x3cb627={'count':0x0,'rows':[]};var _0x12ca68=_[_0x89da('0x26')](db[_0x89da('0x27')][_0x89da('0x28')],function(_0x46dcc6){return{'name':_0x46dcc6['fieldName'],'type':_0x46dcc6['type'][_0x89da('0x29')]};});_0x53fb9d[_0x89da('0x2a')]=_[_0x89da('0x26')](_0x12ca68,_0x89da('0x25'));_0x53fb9d[_0x89da('0x2b')]=_['keys'](_0x293467['query']);_0x53fb9d[_0x89da('0x2c')]=_[_0x89da('0x2d')](_0x53fb9d[_0x89da('0x2a')],_0x53fb9d[_0x89da('0x2b')]);_0x117536['attributes']=_[_0x89da('0x2d')](_0x53fb9d[_0x89da('0x2a')],qs[_0x89da('0x2e')](_0x293467[_0x89da('0x2b')][_0x89da('0x2e')]));_0x117536[_0x89da('0x2f')]=_0x117536[_0x89da('0x2f')][_0x89da('0x30')]?_0x117536[_0x89da('0x2f')]:_0x53fb9d[_0x89da('0x2a')];if(!_0x293467[_0x89da('0x2b')][_0x89da('0x31')](_0x89da('0x32'))){_0x117536[_0x89da('0x33')]=qs[_0x89da('0x33')](_0x293467[_0x89da('0x2b')][_0x89da('0x33')]);_0x117536[_0x89da('0x15')]=qs[_0x89da('0x15')](_0x293467[_0x89da('0x2b')]['offset']);}_0x117536[_0x89da('0x34')]=qs['sort'](_0x293467[_0x89da('0x2b')][_0x89da('0x35')]);_0x117536[_0x89da('0x36')]=qs[_0x89da('0x2c')](_['pick'](_0x293467['query'],_0x53fb9d[_0x89da('0x2c')]),_0x12ca68);if(_0x293467[_0x89da('0x2b')][_0x89da('0x37')]){_0x117536[_0x89da('0x36')]=_['merge'](_0x117536[_0x89da('0x36')],{'$or':_[_0x89da('0x26')](_0x12ca68,function(_0x3451ca){if(_0x3451ca[_0x89da('0x38')]!==_0x89da('0x39')){var _0x4710c5={};_0x4710c5[_0x3451ca['name']]={'$like':'%'+_0x293467[_0x89da('0x2b')]['filter']+'%'};return _0x4710c5;}})});}_0x117536=_[_0x89da('0x3a')]({},_0x117536,_0x293467[_0x89da('0x3b')]);var _0x3d593d={'where':_0x117536[_0x89da('0x36')]};return db['Sound']['count'](_0x3d593d)[_0x89da('0x1f')](function(_0x18f321){_0x3cb627[_0x89da('0x17')]=_0x18f321;if(_0x293467[_0x89da('0x2b')]['includeAll']){_0x117536['include']=[{'all':!![]}];}return db['Sound'][_0x89da('0x3c')](_0x117536);})[_0x89da('0x1f')](function(_0x599dea){_0x3cb627[_0x89da('0x3d')]=_0x599dea;return _0x3cb627;})[_0x89da('0x1f')](respondWithFilteredResult(_0x211ccd,_0x117536))[_0x89da('0x3e')](handleError(_0x211ccd,null));};exports[_0x89da('0x3f')]=function(_0x4ee5d0,_0x2fe3ca){var _0x25b14e={'raw':!![],'where':{'id':_0x4ee5d0[_0x89da('0x40')]['id']}},_0x4d10ec={};_0x4d10ec[_0x89da('0x2a')]=_[_0x89da('0x41')](db[_0x89da('0x27')]['rawAttributes']);_0x4d10ec[_0x89da('0x2b')]=_[_0x89da('0x41')](_0x4ee5d0[_0x89da('0x2b')]);_0x4d10ec[_0x89da('0x2c')]=_['intersection'](_0x4d10ec[_0x89da('0x2a')],_0x4d10ec[_0x89da('0x2b')]);_0x25b14e[_0x89da('0x2f')]=_[_0x89da('0x2d')](_0x4d10ec[_0x89da('0x2a')],qs[_0x89da('0x2e')](_0x4ee5d0['query'][_0x89da('0x2e')]));_0x25b14e['attributes']=_0x25b14e[_0x89da('0x2f')][_0x89da('0x30')]?_0x25b14e[_0x89da('0x2f')]:_0x4d10ec[_0x89da('0x2a')];if(_0x4ee5d0[_0x89da('0x2b')][_0x89da('0x42')]){_0x25b14e[_0x89da('0x43')]=[{'all':!![]}];}_0x25b14e=_[_0x89da('0x3a')]({},_0x25b14e,_0x4ee5d0['options']);return db[_0x89da('0x27')][_0x89da('0x44')](_0x25b14e)['then'](handleEntityNotFound(_0x2fe3ca,null))[_0x89da('0x1f')](respondWithResult(_0x2fe3ca,null))['catch'](handleError(_0x2fe3ca,null));};exports[_0x89da('0x45')]=function(_0x138245,_0x288fd8,_0x3cde82){return db[_0x89da('0x27')][_0x89da('0x44')]({'where':{'id':_0x138245[_0x89da('0x40')]['id']},'attributes':[_0x89da('0x25'),'save_name',_0x89da('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x288fd8,null))[_0x89da('0x1f')](function(_0x5a3dcf){if(_0x5a3dcf){if(!fs[_0x89da('0x47')](path[_0x89da('0x48')](config[_0x89da('0x49')],_0x89da('0x4a'),_0x5a3dcf['save_name']+'.'+_0x5a3dcf[_0x89da('0x46')]))){throw new db[(_0x89da('0x4b'))][(_0x89da('0x4c'))]('Sound\x20not\x20found');}return _0x288fd8[_0x89da('0x45')](path[_0x89da('0x48')](config[_0x89da('0x49')],_0x89da('0x4a'),util['format'](_0x89da('0x4d'),_0x5a3dcf['save_name'],_0x5a3dcf['converted_format'])),util['format'](_0x89da('0x4d'),_0x5a3dcf[_0x89da('0x25')],_0x5a3dcf[_0x89da('0x46')]));}return null;})['catch'](handleError(_0x288fd8,null));};exports[_0x89da('0x4e')]=function(_0x2eb33d,_0x3a63fd,_0x340d74){var _0x3b5c9d={'name':path['basename'](_0x2eb33d[_0x89da('0x4f')][_0x89da('0x50')],path[_0x89da('0x51')](_0x2eb33d['file']['originalname'])),'save_name':path['basename'](_0x2eb33d[_0x89da('0x4f')][_0x89da('0x52')],path[_0x89da('0x51')](_0x2eb33d[_0x89da('0x4f')][_0x89da('0x52')])),'original_format':path['extname'](_0x2eb33d['file'][_0x89da('0x50')])[_0x89da('0x53')](0x1),'converted_format':_0x89da('0x54')};var _0x3cc093=path[_0x89da('0x48')](config['root'],_0x89da('0x55'),_0x2eb33d[_0x89da('0x4f')][_0x89da('0x52')]);var _0x45def0=path[_0x89da('0x48')](config[_0x89da('0x49')],_0x89da('0x4a'),util[_0x89da('0x56')]('%s.%s',path[_0x89da('0x57')](_0x2eb33d[_0x89da('0x4f')][_0x89da('0x52')],path['extname'](_0x2eb33d[_0x89da('0x4f')][_0x89da('0x52')])),_0x3b5c9d['converted_format']));logger[_0x89da('0x58')](_0x89da('0x59'),_0x3cc093);logger[_0x89da('0x58')](_0x89da('0x5a'),_0x45def0);try{fs[_0x89da('0x5b')](_0x3cc093,parseInt(_0x89da('0x5c'),0x8));var _0x30649a=sox['transcode'](_0x3cc093,_0x45def0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x30649a['on']('error',function(_0xbed449){fs[_0x89da('0x5d')](_0x3cc093);_0x3a63fd[_0x89da('0x14')](0x1f4)[_0x89da('0x5e')](_0xbed449);});_0x30649a['on'](_0x89da('0x5f'),function(_0x467ea4){_0x3b5c9d['original_duration']=isNaN(_0x467ea4[_0x89da('0x60')])?null:_0x467ea4[_0x89da('0x60')]*0x3e8;_0x3b5c9d['original_sampleCount']=isNaN(_0x467ea4[_0x89da('0x61')])?null:_0x467ea4[_0x89da('0x61')];_0x3b5c9d['original_channelCount']=isNaN(_0x467ea4[_0x89da('0x62')])?null:_0x467ea4[_0x89da('0x62')];_0x3b5c9d[_0x89da('0x63')]=isNaN(_0x467ea4[_0x89da('0x64')])?null:_0x467ea4[_0x89da('0x64')];_0x3b5c9d[_0x89da('0x65')]=isNaN(_0x467ea4['sampleRate'])?null:_0x467ea4['sampleRate'];});_0x30649a['on'](_0x89da('0x66'),function(_0x4c7f92){_0x3b5c9d[_0x89da('0x67')]=isNaN(_0x4c7f92[_0x89da('0x60')])?null:_0x4c7f92['duration']*0x3e8;_0x3b5c9d[_0x89da('0x68')]=isNaN(_0x4c7f92[_0x89da('0x61')])?null:_0x4c7f92['sampleCount'];_0x3b5c9d[_0x89da('0x69')]=isNaN(_0x4c7f92['channelCount'])?null:_0x4c7f92[_0x89da('0x62')];_0x3b5c9d[_0x89da('0x6a')]=isNaN(_0x4c7f92[_0x89da('0x64')])?null:_0x4c7f92[_0x89da('0x64')];_0x3b5c9d[_0x89da('0x6b')]=isNaN(_0x4c7f92[_0x89da('0x6c')])?null:_0x4c7f92[_0x89da('0x6c')];});_0x30649a['on'](_0x89da('0x6d'),function(){fs['chmodSync'](_0x45def0,parseInt(_0x89da('0x5c'),0x8));return db[_0x89da('0x27')][_0x89da('0x4e')](_0x3b5c9d)[_0x89da('0x1f')](function(_0x54559f){var _0x1ea4df={'role':_0x2eb33d['body']['role'],'userProfileId':_0x2eb33d['body'][_0x89da('0x6e')]};if(!_0x1ea4df)throw new Error(_0x89da('0x6f'));if(_0x1ea4df[_0x89da('0x70')]==='user'){var _0x1a1068=_0x54559f['get']({'plain':!![]});return db[_0x89da('0x71')][_0x89da('0x44')]({'where':{'name':_0x89da('0x21'),'userProfileId':_0x1ea4df[_0x89da('0x6e')]},'raw':!![]})[_0x89da('0x1f')](function(_0x1f9266){if(_0x1f9266&&_0x1f9266[_0x89da('0x72')]===0x0){return db[_0x89da('0x73')][_0x89da('0x4e')]({'name':_0x1a1068['name'],'resourceId':_0x1a1068['id'],'type':_0x1f9266[_0x89da('0x25')],'sectionId':_0x1f9266['id']},{})[_0x89da('0x1f')](function(){return _0x54559f;});}else{return _0x54559f;}})['catch'](function(_0x2a5c90){logger[_0x89da('0x23')](_0x89da('0x74'),_0x2a5c90);throw _0x2a5c90;});}return _0x54559f;})[_0x89da('0x1f')](respondWithResult(_0x3a63fd,null))['catch'](handleError(_0x3a63fd,null));});_0x30649a[_0x89da('0x75')]();}catch(_0x438d14){_0x3a63fd['status'](0x1f4)[_0x89da('0x5e')](_0x438d14);}};exports[_0x89da('0x1e')]=function(_0x135cdb,_0x18bb84,_0x4edf2b){return db['Sound']['find']({'where':{'id':_0x135cdb[_0x89da('0x40')]['id']}})[_0x89da('0x1f')](handleEntityNotFound(_0x18bb84,null))[_0x89da('0x1f')](saveUpdates(_['pick'](_0x135cdb[_0x89da('0x76')],['name','description']),null))['then'](respondWithResult(_0x18bb84,null))[_0x89da('0x3e')](handleError(_0x18bb84,null));};exports[_0x89da('0x77')]=function(_0x898066,_0x1ef7f4,_0x459502){return db[_0x89da('0x27')]['find']({'where':{'id':_0x898066[_0x89da('0x40')]['id']}})[_0x89da('0x1f')](function(_0x54133e){if(_0x54133e){return _0x54133e[_0x89da('0x22')]();}})[_0x89da('0x1f')](function(_0x267511){var _0x33838d=path[_0x89da('0x48')](config[_0x89da('0x49')],'server/files/sounds/original',util['format'](_0x89da('0x4d'),_0x267511['save_name'],_0x267511[_0x89da('0x78')]));var _0xf5897e=path['join'](config[_0x89da('0x49')],_0x89da('0x4a'),util[_0x89da('0x56')]('%s.%s',_0x267511['save_name'],_0x267511['converted_format']));fs[_0x89da('0x5d')](_0x33838d);fs['unlinkSync'](_0xf5897e);return _0x267511;})['then'](function(_0x1c93c0){if(_0x1c93c0){return _0x1ef7f4[_0x89da('0x14')](0xcc)[_0x89da('0x6d')]();}})['then'](handleEntityNotFound(_0x1ef7f4,null))[_0x89da('0x3e')](handleError(_0x1ef7f4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 94d89af..6ae8a68 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 _0x5950=['util','api','moment','bluebird','path','../../config/environment','./sound.attributes','exports','Sound','lodash'];(function(_0x50f63f,_0x3be855){var _0xa38248=function(_0x19061b){while(--_0x19061b){_0x50f63f['push'](_0x50f63f['shift']());}};_0xa38248(++_0x3be855);}(_0x5950,0x149));var _0x0595=function(_0x1bfdd6,_0x189a46){_0x1bfdd6=_0x1bfdd6-0x0;var _0x512f81=_0x5950[_0x1bfdd6];return _0x512f81;};'use strict';var _=require(_0x0595('0x0'));var util=require(_0x0595('0x1'));var logger=require('../../config/logger')(_0x0595('0x2'));var moment=require(_0x0595('0x3'));var BPromise=require(_0x0595('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0595('0x5'));var rimraf=require('rimraf');var config=require(_0x0595('0x6'));var attributes=require(_0x0595('0x7'));module[_0x0595('0x8')]=function(_0x422d26,_0x20acb7){return _0x422d26['define'](_0x0595('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e53=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','tools_sounds','lodash'];(function(_0x168f21,_0x70b14){var _0x66dba=function(_0x59e73e){while(--_0x59e73e){_0x168f21['push'](_0x168f21['shift']());}};_0x66dba(++_0x70b14);}(_0x4e53,0x83));var _0x34e5=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0x4e53[_0x3a723e];return _0x3e9c03;};'use strict';var _=require(_0x34e5('0x0'));var util=require(_0x34e5('0x1'));var logger=require(_0x34e5('0x2'))(_0x34e5('0x3'));var moment=require(_0x34e5('0x4'));var BPromise=require(_0x34e5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34e5('0x6'));var rimraf=require('rimraf');var config=require(_0x34e5('0x7'));var attributes=require('./sound.attributes');module[_0x34e5('0x8')]=function(_0x9215db,_0x18bc2e){return _0x9215db[_0x34e5('0x9')]('Sound',attributes,{'tableName':_0x34e5('0xa'),'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 0df4b0c..e92f888 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 _0x6712=['result','catch','find','options','raw','attributes','map','include','model','ShowSound','stringify','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x6712,0xa1));var _0x2671=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6712[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x2671('0x0'));var moment=require(_0x2671('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2671('0x2'))['db'];var utils=require(_0x2671('0x3'));var logger=require(_0x2671('0x4'))(_0x2671('0x5'));var config=require(_0x2671('0x6'));var jayson=require(_0x2671('0x7'));var client=jayson['client'][_0x2671('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54538c,_0x56165d,_0x47229a){return new BPromise(function(_0x5a53e0,_0x49dee1){return client[_0x2671('0x9')](_0x54538c,_0x47229a)[_0x2671('0xa')](function(_0x5ac42b){logger[_0x2671('0xb')](_0x2671('0xc'),_0x56165d,_0x2671('0xd'));logger[_0x2671('0xe')](_0x2671('0xf'),_0x56165d,_0x2671('0xd'),JSON['stringify'](_0x5ac42b));if(_0x5ac42b[_0x2671('0x10')]){if(_0x5ac42b['error'][_0x2671('0x11')]===0x1f4){logger[_0x2671('0x10')](_0x2671('0xc'),_0x56165d,_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);return _0x49dee1(_0x5ac42b[_0x2671('0x10')]['message']);}logger[_0x2671('0x10')](_0x2671('0xc'),_0x56165d,_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);return _0x5a53e0(_0x5ac42b[_0x2671('0x10')][_0x2671('0x12')]);}else{logger[_0x2671('0xb')](_0x2671('0xc'),_0x56165d,_0x2671('0xd'));_0x5a53e0(_0x5ac42b[_0x2671('0x13')][_0x2671('0x12')]);}})[_0x2671('0x14')](function(_0x4d5ca3){logger['error'](_0x2671('0xc'),_0x56165d,_0x4d5ca3);_0x49dee1(_0x4d5ca3);});});}exports['ShowSound']=function(_0x4142cf){var _0x23b5b7=this;return new Promise(function(_0x3bff52,_0x2f1c38){return db['Sound'][_0x2671('0x15')]({'raw':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')][_0x2671('0x17')]===undefined?!![]:![]:!![],'where':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')]['where']||null:null,'attributes':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')][_0x2671('0x18')]||null:null,'include':_0x4142cf[_0x2671('0x16')]?_0x4142cf[_0x2671('0x16')]['include']?_[_0x2671('0x19')](_0x4142cf[_0x2671('0x16')][_0x2671('0x1a')],function(_0x4fe7d1){return{'model':db[_0x4fe7d1['model']],'as':_0x4fe7d1['as'],'attributes':_0x4fe7d1[_0x2671('0x18')],'include':_0x4fe7d1[_0x2671('0x1a')]?_[_0x2671('0x19')](_0x4fe7d1['include'],function(_0x4018ec){return{'model':db[_0x4018ec[_0x2671('0x1b')]],'as':_0x4018ec['as'],'attributes':_0x4018ec['attributes'],'include':_0x4018ec[_0x2671('0x1a')]?_[_0x2671('0x19')](_0x4018ec['include'],function(_0x2e0208){return{'model':db[_0x2e0208['model']],'as':_0x2e0208['as'],'attributes':_0x2e0208[_0x2671('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2671('0xa')](function(_0x56dc43){logger[_0x2671('0xb')](_0x2671('0x1c'),_0x4142cf);logger[_0x2671('0xe')]('ShowSound',_0x4142cf,JSON[_0x2671('0x1d')](_0x56dc43));_0x3bff52(_0x56dc43);})[_0x2671('0x14')](function(_0x444e3e){logger['error'](_0x2671('0x1c'),_0x444e3e[_0x2671('0x12')],_0x4142cf);_0x2f1c38(_0x23b5b7[_0x2671('0x10')](0x1f4,_0x444e3e[_0x2671('0x12')]));});});}; \ No newline at end of file +var _0x956e=['ShowSound','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x956e,0x11a));var _0xe956=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x956e[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0xe956('0x0'));var util=require(_0xe956('0x1'));var moment=require(_0xe956('0x2'));var BPromise=require(_0xe956('0x3'));var rs=require(_0xe956('0x4'));var fs=require('fs');var Redis=require(_0xe956('0x5'));var db=require(_0xe956('0x6'))['db'];var utils=require(_0xe956('0x7'));var logger=require(_0xe956('0x8'))(_0xe956('0x9'));var config=require('../../config/environment');var jayson=require(_0xe956('0xa'));var client=jayson[_0xe956('0xb')][_0xe956('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ee679,_0x275de5,_0x2e9305){return new BPromise(function(_0x5c0a83,_0x2a3006){return client[_0xe956('0xd')](_0x4ee679,_0x2e9305)[_0xe956('0xe')](function(_0x209777){logger[_0xe956('0xf')](_0xe956('0x10'),_0x275de5,'request\x20sent');logger['debug'](_0xe956('0x11'),_0x275de5,_0xe956('0x12'),JSON['stringify'](_0x209777));if(_0x209777[_0xe956('0x13')]){if(_0x209777[_0xe956('0x13')][_0xe956('0x14')]===0x1f4){logger['error'](_0xe956('0x10'),_0x275de5,_0x209777[_0xe956('0x13')][_0xe956('0x15')]);return _0x2a3006(_0x209777[_0xe956('0x13')]['message']);}logger['error'](_0xe956('0x10'),_0x275de5,_0x209777[_0xe956('0x13')][_0xe956('0x15')]);return _0x5c0a83(_0x209777[_0xe956('0x13')]['message']);}else{logger[_0xe956('0xf')]('Sound,\x20%s,\x20%s',_0x275de5,_0xe956('0x12'));_0x5c0a83(_0x209777[_0xe956('0x16')][_0xe956('0x15')]);}})[_0xe956('0x17')](function(_0x1076d5){logger[_0xe956('0x13')]('Sound,\x20%s,\x20%s',_0x275de5,_0x1076d5);_0x2a3006(_0x1076d5);});});}exports[_0xe956('0x18')]=function(_0x252bfa){var _0x40ed0b=this;return new Promise(function(_0xdce9b8,_0x1e767e){return db['Sound'][_0xe956('0x19')]({'raw':_0x252bfa[_0xe956('0x1a')]?_0x252bfa['options'][_0xe956('0x1b')]===undefined?!![]:![]:!![],'where':_0x252bfa[_0xe956('0x1a')]?_0x252bfa[_0xe956('0x1a')][_0xe956('0x1c')]||null:null,'attributes':_0x252bfa['options']?_0x252bfa[_0xe956('0x1a')][_0xe956('0x1d')]||null:null,'include':_0x252bfa[_0xe956('0x1a')]?_0x252bfa[_0xe956('0x1a')][_0xe956('0x1e')]?_[_0xe956('0x1f')](_0x252bfa[_0xe956('0x1a')]['include'],function(_0x35deb5){return{'model':db[_0x35deb5[_0xe956('0x20')]],'as':_0x35deb5['as'],'attributes':_0x35deb5['attributes'],'include':_0x35deb5[_0xe956('0x1e')]?_[_0xe956('0x1f')](_0x35deb5['include'],function(_0x304e2c){return{'model':db[_0x304e2c[_0xe956('0x20')]],'as':_0x304e2c['as'],'attributes':_0x304e2c[_0xe956('0x1d')],'include':_0x304e2c['include']?_[_0xe956('0x1f')](_0x304e2c[_0xe956('0x1e')],function(_0x22f9f6){return{'model':db[_0x22f9f6[_0xe956('0x20')]],'as':_0x22f9f6['as'],'attributes':_0x22f9f6[_0xe956('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe956('0xe')](function(_0x53be03){logger[_0xe956('0xf')](_0xe956('0x18'),_0x252bfa);logger['debug'](_0xe956('0x18'),_0x252bfa,JSON[_0xe956('0x21')](_0x53be03));_0xdce9b8(_0x53be03);})[_0xe956('0x17')](function(_0x3bc641){logger['error'](_0xe956('0x18'),_0x3bc641['message'],_0x252bfa);_0x1e767e(_0x40ed0b[_0xe956('0x13')](0x1f4,_0x3bc641[_0xe956('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b4b2d8f..a1fb9b9 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 _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(_0x2c2dff,_0x302e28){var _0x1177a4=function(_0x2fa930){while(--_0x2fa930){_0x2c2dff['push'](_0x2c2dff['shift']());}};_0x1177a4(++_0x302e28);}(_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('./squareMessage.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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0xd8f7f8,_0x586816){var _0x13271e=function(_0xb258a2){while(--_0xb258a2){_0xd8f7f8['push'](_0xd8f7f8['shift']());}};_0x13271e(++_0x586816);}(_0x757a,0xde));var _0xa757=function(_0x2f03a4,_0x41a198){_0x2f03a4=_0x2f03a4-0x0;var _0x3bf510=_0x757a[_0x2f03a4];return _0x3bf510;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index aef5105..b193bb5 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 _0x767a=['out','STRING','TEXT','ENUM'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x767a,0x89));var _0xa767=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x767a[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa767('0x0')]},'body':{'type':Sequelize[_0xa767('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa767('0x2')]('in',_0xa767('0x3')),'defaultValue':_0xa767('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xa767('0x0')]},'providerResponse':{'type':Sequelize[_0xa767('0x1')]}}; \ No newline at end of file +var _0xb35a=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0xd97f9f,_0x4dae0a){var _0x4952f2=function(_0x5f079b){while(--_0x5f079b){_0xd97f9f['push'](_0xd97f9f['shift']());}};_0x4952f2(++_0x4dae0a);}(_0xb35a,0x13f));var _0xab35=function(_0x43b2fc,_0x2c3adf){_0x43b2fc=_0x43b2fc-0x0;var _0x635038=_0xb35a[_0x43b2fc];return _0x635038;};'use strict';var Sequelize=require(_0xab35('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xab35('0x1')]},'body':{'type':Sequelize[_0xab35('0x2')](_0xab35('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xab35('0x4')]('in','out'),'defaultValue':_0xab35('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xab35('0x1')]},'providerResponse':{'type':Sequelize[_0xab35('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 65af46d..5253acd 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 _0xa7b5=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','error','name','index','map','SquareMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x508bde,_0x979512){_0x508bde=_0x508bde-0x0;var _0x18bf9d=_0xa7b5[_0x508bde];return _0x18bf9d;};'use strict';var emlformat=require(_0x5a7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7b('0x2'));var moment=require(_0x5a7b('0x3'));var BPromise=require(_0x5a7b('0x4'));var Mustache=require(_0x5a7b('0x5'));var util=require(_0x5a7b('0x6'));var path=require(_0x5a7b('0x7'));var sox=require(_0x5a7b('0x8'));var csv=require(_0x5a7b('0x9'));var ejs=require(_0x5a7b('0xa'));var fs=require('fs');var fs_extra=require(_0x5a7b('0xb'));var _=require(_0x5a7b('0xc'));var squel=require(_0x5a7b('0xd'));var crypto=require(_0x5a7b('0xe'));var jsforce=require(_0x5a7b('0xf'));var deskjs=require(_0x5a7b('0x10'));var toCsv=require(_0x5a7b('0x9'));var querystring=require(_0x5a7b('0x11'));var Papa=require(_0x5a7b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a7b('0x14'));var logger=require(_0x5a7b('0x15'))(_0x5a7b('0x16'));var utils=require(_0x5a7b('0x17'));var config=require(_0x5a7b('0x18'));var licenseUtil=require(_0x5a7b('0x19'));var db=require(_0x5a7b('0x1a'))['db'];function respondWithStatusCode(_0x156031,_0x11ac57){_0x11ac57=_0x11ac57||0xcc;return function(_0x388176){if(_0x388176){return _0x156031[_0x5a7b('0x1b')](_0x11ac57);}return _0x156031['status'](_0x11ac57)[_0x5a7b('0x1c')]();};}function respondWithResult(_0x43f889,_0x1a217e){_0x1a217e=_0x1a217e||0xc8;return function(_0x292a44){if(_0x292a44){return _0x43f889['status'](_0x1a217e)[_0x5a7b('0x1d')](_0x292a44);}};}function respondWithFilteredResult(_0x2ca1d6,_0x599bb8){return function(_0x3e922e){if(_0x3e922e){var _0x4d2e57=typeof _0x599bb8[_0x5a7b('0x1e')]==='undefined'&&typeof _0x599bb8[_0x5a7b('0x1f')]===_0x5a7b('0x20');var _0x2fc1fa=_0x3e922e['count'];var _0x33b996=_0x4d2e57?0x0:_0x599bb8['offset'];var _0x192009=_0x4d2e57?_0x3e922e[_0x5a7b('0x21')]:_0x599bb8[_0x5a7b('0x1e')]+_0x599bb8[_0x5a7b('0x1f')];var _0x550b9a;if(_0x192009>=_0x2fc1fa){_0x192009=_0x2fc1fa;_0x550b9a=0xc8;}else{_0x550b9a=0xce;}_0x2ca1d6[_0x5a7b('0x22')](_0x550b9a);return _0x2ca1d6[_0x5a7b('0x23')](_0x5a7b('0x24'),_0x33b996+'-'+_0x192009+'/'+_0x2fc1fa)['json'](_0x3e922e);}return null;};}function patchUpdates(_0x4126a5){return function(_0x6695e1){try{jsonpatch['apply'](_0x6695e1,_0x4126a5,!![]);}catch(_0x49a892){return BPromise[_0x5a7b('0x25')](_0x49a892);}return _0x6695e1[_0x5a7b('0x26')]();};}function saveUpdates(_0x2ebf51,_0x8b05ef){return function(_0x285369){if(_0x285369){return _0x285369['update'](_0x2ebf51)['then'](function(_0x1ad9cc){return _0x1ad9cc;});}return null;};}function removeEntity(_0x342a23,_0x26442f){return function(_0x2a0550){if(_0x2a0550){return _0x2a0550['destroy']()['then'](function(){_0x342a23['status'](0xcc)[_0x5a7b('0x1c')]();});}};}function handleEntityNotFound(_0x3fbff6,_0x11223d){return function(_0x3e572a){if(!_0x3e572a){_0x3fbff6[_0x5a7b('0x1b')](0x194);}return _0x3e572a;};}function handleError(_0x5673b9,_0x2d8001){_0x2d8001=_0x2d8001||0x1f4;return function(_0x55724d){logger[_0x5a7b('0x27')](_0x55724d['stack']);if(_0x55724d[_0x5a7b('0x28')]){delete _0x55724d[_0x5a7b('0x28')];}_0x5673b9[_0x5a7b('0x22')](_0x2d8001)['send'](_0x55724d);};}exports[_0x5a7b('0x29')]=function(_0x449cc7,_0x169762){var _0x54f1c6={},_0x36b90e={},_0x3172a8={'count':0x0,'rows':[]};var _0x27b2cf=_[_0x5a7b('0x2a')](db[_0x5a7b('0x2b')]['rawAttributes'],function(_0x2032d3){return{'name':_0x2032d3[_0x5a7b('0x2c')],'type':_0x2032d3[_0x5a7b('0x2d')][_0x5a7b('0x2e')]};});_0x36b90e[_0x5a7b('0x2f')]=_[_0x5a7b('0x2a')](_0x27b2cf,'name');_0x36b90e[_0x5a7b('0x30')]=_['keys'](_0x449cc7[_0x5a7b('0x30')]);_0x36b90e['filters']=_[_0x5a7b('0x31')](_0x36b90e[_0x5a7b('0x2f')],_0x36b90e[_0x5a7b('0x30')]);_0x54f1c6[_0x5a7b('0x32')]=_[_0x5a7b('0x31')](_0x36b90e[_0x5a7b('0x2f')],qs[_0x5a7b('0x33')](_0x449cc7['query'][_0x5a7b('0x33')]));_0x54f1c6['attributes']=_0x54f1c6[_0x5a7b('0x32')][_0x5a7b('0x34')]?_0x54f1c6[_0x5a7b('0x32')]:_0x36b90e[_0x5a7b('0x2f')];if(!_0x449cc7['query'][_0x5a7b('0x35')](_0x5a7b('0x36'))){_0x54f1c6[_0x5a7b('0x1f')]=qs[_0x5a7b('0x1f')](_0x449cc7['query'][_0x5a7b('0x1f')]);_0x54f1c6[_0x5a7b('0x1e')]=qs[_0x5a7b('0x1e')](_0x449cc7['query'][_0x5a7b('0x1e')]);}_0x54f1c6[_0x5a7b('0x37')]=qs[_0x5a7b('0x38')](_0x449cc7[_0x5a7b('0x30')]['sort']);_0x54f1c6[_0x5a7b('0x39')]=qs['filters'](_[_0x5a7b('0x3a')](_0x449cc7[_0x5a7b('0x30')],_0x36b90e[_0x5a7b('0x3b')]),_0x27b2cf);if(_0x449cc7['query'][_0x5a7b('0x3c')]){_0x54f1c6[_0x5a7b('0x39')]=_[_0x5a7b('0x3d')](_0x54f1c6[_0x5a7b('0x39')],{'$or':_[_0x5a7b('0x2a')](_0x27b2cf,function(_0x3bc002){if(_0x3bc002[_0x5a7b('0x2d')]!==_0x5a7b('0x3e')){var _0x2d1ea0={};_0x2d1ea0[_0x3bc002[_0x5a7b('0x28')]]={'$like':'%'+_0x449cc7['query']['filter']+'%'};return _0x2d1ea0;}})});}_0x54f1c6=_['merge']({},_0x54f1c6,_0x449cc7[_0x5a7b('0x3f')]);var _0x4e2708={'where':_0x54f1c6[_0x5a7b('0x39')]};return db['SquareMessage'][_0x5a7b('0x21')](_0x4e2708)[_0x5a7b('0x40')](function(_0x16c186){_0x3172a8[_0x5a7b('0x21')]=_0x16c186;if(_0x449cc7[_0x5a7b('0x30')]['includeAll']){_0x54f1c6[_0x5a7b('0x41')]=[{'all':!![]}];}return db[_0x5a7b('0x2b')][_0x5a7b('0x42')](_0x54f1c6);})['then'](function(_0x959137){_0x3172a8[_0x5a7b('0x43')]=_0x959137;return _0x3172a8;})[_0x5a7b('0x40')](respondWithFilteredResult(_0x169762,_0x54f1c6))[_0x5a7b('0x44')](handleError(_0x169762,null));};exports[_0x5a7b('0x45')]=function(_0x170838,_0x52f808){var _0x2a7ea9={'raw':!![],'where':{'id':_0x170838[_0x5a7b('0x46')]['id']}},_0x56aeca={};_0x56aeca['model']=_[_0x5a7b('0x47')](db['SquareMessage'][_0x5a7b('0x48')]);_0x56aeca[_0x5a7b('0x30')]=_['keys'](_0x170838['query']);_0x56aeca[_0x5a7b('0x3b')]=_['intersection'](_0x56aeca[_0x5a7b('0x2f')],_0x56aeca['query']);_0x2a7ea9['attributes']=_['intersection'](_0x56aeca[_0x5a7b('0x2f')],qs[_0x5a7b('0x33')](_0x170838[_0x5a7b('0x30')]['fields']));_0x2a7ea9[_0x5a7b('0x32')]=_0x2a7ea9[_0x5a7b('0x32')]['length']?_0x2a7ea9[_0x5a7b('0x32')]:_0x56aeca['model'];if(_0x170838[_0x5a7b('0x30')]['includeAll']){_0x2a7ea9['include']=[{'all':!![]}];}_0x2a7ea9=_[_0x5a7b('0x3d')]({},_0x2a7ea9,_0x170838[_0x5a7b('0x3f')]);return db[_0x5a7b('0x2b')][_0x5a7b('0x49')](_0x2a7ea9)[_0x5a7b('0x40')](handleEntityNotFound(_0x52f808,null))['then'](respondWithResult(_0x52f808,null))[_0x5a7b('0x44')](handleError(_0x52f808,null));};exports[_0x5a7b('0x4a')]=function(_0x1d64a2,_0x256a08){return db['SquareMessage']['create'](_0x1d64a2[_0x5a7b('0x4b')],{})['then'](respondWithResult(_0x256a08,0xc9))[_0x5a7b('0x44')](handleError(_0x256a08,null));};exports[_0x5a7b('0x4c')]=function(_0x34bd82,_0x52759c){if(_0x34bd82['body']['id']){delete _0x34bd82[_0x5a7b('0x4b')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x34bd82[_0x5a7b('0x46')]['id']}})[_0x5a7b('0x40')](handleEntityNotFound(_0x52759c,null))['then'](saveUpdates(_0x34bd82['body'],null))['then'](respondWithResult(_0x52759c,null))[_0x5a7b('0x44')](handleError(_0x52759c,null));};exports[_0x5a7b('0x4d')]=function(_0x5968bb,_0x207e7d){return db[_0x5a7b('0x2b')]['find']({'where':{'id':_0x5968bb[_0x5a7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x207e7d,null))[_0x5a7b('0x40')](removeEntity(_0x207e7d,null))[_0x5a7b('0x44')](handleError(_0x207e7d,null));}; \ No newline at end of file +var _0xc19f=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x3f5e17,_0x16189c){var _0x3eb71b=function(_0x4682c2){while(--_0x4682c2){_0x3f5e17['push'](_0x3f5e17['shift']());}};_0x3eb71b(++_0x16189c);}(_0xc19f,0x164));var _0xfc19=function(_0x5e6ad6,_0x514915){_0x5e6ad6=_0x5e6ad6-0x0;var _0x3b7d0b=_0xc19f[_0x5e6ad6];return _0x3b7d0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc19('0x0'));var jsonpatch=require(_0xfc19('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc19('0x2'));var Mustache=require(_0xfc19('0x3'));var util=require(_0xfc19('0x4'));var path=require(_0xfc19('0x5'));var sox=require(_0xfc19('0x6'));var csv=require(_0xfc19('0x7'));var ejs=require(_0xfc19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc19('0x9'));var jsforce=require(_0xfc19('0xa'));var deskjs=require(_0xfc19('0xb'));var toCsv=require(_0xfc19('0x7'));var querystring=require(_0xfc19('0xc'));var Papa=require(_0xfc19('0xd'));var Redis=require(_0xfc19('0xe'));var authService=require(_0xfc19('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc19('0x10'));var logger=require(_0xfc19('0x11'))('api');var utils=require(_0xfc19('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfc19('0x13'));var db=require(_0xfc19('0x14'))['db'];function respondWithStatusCode(_0x5519e2,_0x1b740d){_0x1b740d=_0x1b740d||0xcc;return function(_0x2568cf){if(_0x2568cf){return _0x5519e2['sendStatus'](_0x1b740d);}return _0x5519e2[_0xfc19('0x15')](_0x1b740d)[_0xfc19('0x16')]();};}function respondWithResult(_0xfdb515,_0x3cc361){_0x3cc361=_0x3cc361||0xc8;return function(_0x158b36){if(_0x158b36){return _0xfdb515['status'](_0x3cc361)[_0xfc19('0x17')](_0x158b36);}};}function respondWithFilteredResult(_0x38cf1f,_0x2e7bab){return function(_0x319a34){if(_0x319a34){var _0x414011=typeof _0x2e7bab[_0xfc19('0x18')]===_0xfc19('0x19')&&typeof _0x2e7bab[_0xfc19('0x1a')]===_0xfc19('0x19');var _0x22e648=_0x319a34[_0xfc19('0x1b')];var _0x2f3143=_0x414011?0x0:_0x2e7bab[_0xfc19('0x18')];var _0x859e64=_0x414011?_0x319a34[_0xfc19('0x1b')]:_0x2e7bab[_0xfc19('0x18')]+_0x2e7bab[_0xfc19('0x1a')];var _0x4383a8;if(_0x859e64>=_0x22e648){_0x859e64=_0x22e648;_0x4383a8=0xc8;}else{_0x4383a8=0xce;}_0x38cf1f[_0xfc19('0x15')](_0x4383a8);return _0x38cf1f[_0xfc19('0x1c')](_0xfc19('0x1d'),_0x2f3143+'-'+_0x859e64+'/'+_0x22e648)[_0xfc19('0x17')](_0x319a34);}return null;};}function patchUpdates(_0x2a4d18){return function(_0x58b64e){try{jsonpatch[_0xfc19('0x1e')](_0x58b64e,_0x2a4d18,!![]);}catch(_0x538f19){return BPromise[_0xfc19('0x1f')](_0x538f19);}return _0x58b64e['save']();};}function saveUpdates(_0x2ea5cc,_0x1e31df){return function(_0x4f8fef){if(_0x4f8fef){return _0x4f8fef[_0xfc19('0x20')](_0x2ea5cc)[_0xfc19('0x21')](function(_0x4be83d){return _0x4be83d;});}return null;};}function removeEntity(_0x580329,_0x79393c){return function(_0x4e7c72){if(_0x4e7c72){return _0x4e7c72[_0xfc19('0x22')]()['then'](function(){_0x580329[_0xfc19('0x15')](0xcc)[_0xfc19('0x16')]();});}};}function handleEntityNotFound(_0x3a433a,_0x4883f1){return function(_0xe77f34){if(!_0xe77f34){_0x3a433a[_0xfc19('0x23')](0x194);}return _0xe77f34;};}function handleError(_0xfdb8ea,_0x3e6b53){_0x3e6b53=_0x3e6b53||0x1f4;return function(_0xbec1bc){logger[_0xfc19('0x24')](_0xbec1bc[_0xfc19('0x25')]);if(_0xbec1bc[_0xfc19('0x26')]){delete _0xbec1bc[_0xfc19('0x26')];}_0xfdb8ea['status'](_0x3e6b53)[_0xfc19('0x27')](_0xbec1bc);};}exports[_0xfc19('0x28')]=function(_0x55803d,_0x10f5d5){var _0x2bc6b4={},_0x39a706={},_0xe36510={'count':0x0,'rows':[]};var _0x4e6bdb=_[_0xfc19('0x29')](db[_0xfc19('0x2a')][_0xfc19('0x2b')],function(_0x548486){return{'name':_0x548486[_0xfc19('0x2c')],'type':_0x548486[_0xfc19('0x2d')]['key']};});_0x39a706[_0xfc19('0x2e')]=_['map'](_0x4e6bdb,_0xfc19('0x26'));_0x39a706['query']=_[_0xfc19('0x2f')](_0x55803d[_0xfc19('0x30')]);_0x39a706[_0xfc19('0x31')]=_[_0xfc19('0x32')](_0x39a706[_0xfc19('0x2e')],_0x39a706['query']);_0x2bc6b4['attributes']=_[_0xfc19('0x32')](_0x39a706['model'],qs[_0xfc19('0x33')](_0x55803d[_0xfc19('0x30')][_0xfc19('0x33')]));_0x2bc6b4[_0xfc19('0x34')]=_0x2bc6b4[_0xfc19('0x34')][_0xfc19('0x35')]?_0x2bc6b4[_0xfc19('0x34')]:_0x39a706[_0xfc19('0x2e')];if(!_0x55803d[_0xfc19('0x30')][_0xfc19('0x36')](_0xfc19('0x37'))){_0x2bc6b4[_0xfc19('0x1a')]=qs[_0xfc19('0x1a')](_0x55803d[_0xfc19('0x30')][_0xfc19('0x1a')]);_0x2bc6b4[_0xfc19('0x18')]=qs[_0xfc19('0x18')](_0x55803d[_0xfc19('0x30')][_0xfc19('0x18')]);}_0x2bc6b4[_0xfc19('0x38')]=qs['sort'](_0x55803d['query'][_0xfc19('0x39')]);_0x2bc6b4[_0xfc19('0x3a')]=qs[_0xfc19('0x31')](_[_0xfc19('0x3b')](_0x55803d['query'],_0x39a706[_0xfc19('0x31')]),_0x4e6bdb);if(_0x55803d[_0xfc19('0x30')][_0xfc19('0x3c')]){_0x2bc6b4[_0xfc19('0x3a')]=_['merge'](_0x2bc6b4[_0xfc19('0x3a')],{'$or':_[_0xfc19('0x29')](_0x4e6bdb,function(_0x3e25f0){if(_0x3e25f0[_0xfc19('0x2d')]!=='VIRTUAL'){var _0x5d39ef={};_0x5d39ef[_0x3e25f0['name']]={'$like':'%'+_0x55803d['query'][_0xfc19('0x3c')]+'%'};return _0x5d39ef;}})});}_0x2bc6b4=_[_0xfc19('0x3d')]({},_0x2bc6b4,_0x55803d[_0xfc19('0x3e')]);var _0x1484e1={'where':_0x2bc6b4[_0xfc19('0x3a')]};return db[_0xfc19('0x2a')][_0xfc19('0x1b')](_0x1484e1)[_0xfc19('0x21')](function(_0x21d27c){_0xe36510[_0xfc19('0x1b')]=_0x21d27c;if(_0x55803d[_0xfc19('0x30')][_0xfc19('0x3f')]){_0x2bc6b4[_0xfc19('0x40')]=[{'all':!![]}];}return db[_0xfc19('0x2a')]['findAll'](_0x2bc6b4);})[_0xfc19('0x21')](function(_0x2bd524){_0xe36510[_0xfc19('0x41')]=_0x2bd524;return _0xe36510;})[_0xfc19('0x21')](respondWithFilteredResult(_0x10f5d5,_0x2bc6b4))[_0xfc19('0x42')](handleError(_0x10f5d5,null));};exports[_0xfc19('0x43')]=function(_0x1d4b9b,_0x3bb022){var _0x27caad={'raw':!![],'where':{'id':_0x1d4b9b[_0xfc19('0x44')]['id']}},_0x2594c5={};_0x2594c5[_0xfc19('0x2e')]=_[_0xfc19('0x2f')](db['SquareMessage'][_0xfc19('0x2b')]);_0x2594c5['query']=_[_0xfc19('0x2f')](_0x1d4b9b[_0xfc19('0x30')]);_0x2594c5[_0xfc19('0x31')]=_[_0xfc19('0x32')](_0x2594c5[_0xfc19('0x2e')],_0x2594c5[_0xfc19('0x30')]);_0x27caad[_0xfc19('0x34')]=_[_0xfc19('0x32')](_0x2594c5[_0xfc19('0x2e')],qs['fields'](_0x1d4b9b[_0xfc19('0x30')][_0xfc19('0x33')]));_0x27caad['attributes']=_0x27caad[_0xfc19('0x34')]['length']?_0x27caad[_0xfc19('0x34')]:_0x2594c5[_0xfc19('0x2e')];if(_0x1d4b9b[_0xfc19('0x30')][_0xfc19('0x3f')]){_0x27caad[_0xfc19('0x40')]=[{'all':!![]}];}_0x27caad=_[_0xfc19('0x3d')]({},_0x27caad,_0x1d4b9b[_0xfc19('0x3e')]);return db[_0xfc19('0x2a')]['find'](_0x27caad)['then'](handleEntityNotFound(_0x3bb022,null))[_0xfc19('0x21')](respondWithResult(_0x3bb022,null))[_0xfc19('0x42')](handleError(_0x3bb022,null));};exports[_0xfc19('0x45')]=function(_0x2ee4d4,_0x411213){return db[_0xfc19('0x2a')][_0xfc19('0x45')](_0x2ee4d4['body'],{})[_0xfc19('0x21')](respondWithResult(_0x411213,0xc9))[_0xfc19('0x42')](handleError(_0x411213,null));};exports[_0xfc19('0x20')]=function(_0x5acfad,_0x585ec2){if(_0x5acfad[_0xfc19('0x46')]['id']){delete _0x5acfad[_0xfc19('0x46')]['id'];}return db[_0xfc19('0x2a')][_0xfc19('0x47')]({'where':{'id':_0x5acfad[_0xfc19('0x44')]['id']}})[_0xfc19('0x21')](handleEntityNotFound(_0x585ec2,null))[_0xfc19('0x21')](saveUpdates(_0x5acfad[_0xfc19('0x46')],null))['then'](respondWithResult(_0x585ec2,null))['catch'](handleError(_0x585ec2,null));};exports[_0xfc19('0x22')]=function(_0x4c8152,_0x2829ed){return db[_0xfc19('0x2a')]['find']({'where':{'id':_0x4c8152[_0xfc19('0x44')]['id']}})[_0xfc19('0x21')](handleEntityNotFound(_0x2829ed,null))[_0xfc19('0x21')](removeEntity(_0x2829ed,null))['catch'](handleError(_0x2829ed,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3735479..805628f 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 _0x8884=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','lodash','bluebird','request-promise','path','rimraf'];(function(_0x4fd95a,_0xec956c){var _0x290975=function(_0x5677ad){while(--_0x5677ad){_0x4fd95a['push'](_0x4fd95a['shift']());}};_0x290975(++_0xec956c);}(_0x8884,0x16c));var _0x4888=function(_0x2797a2,_0x18903c){_0x2797a2=_0x2797a2-0x0;var _0x4d1ea7=_0x8884[_0x2797a2];return _0x4d1ea7;};'use strict';var _=require(_0x4888('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4888('0x1'));var rp=require(_0x4888('0x2'));var fs=require('fs');var path=require(_0x4888('0x3'));var rimraf=require(_0x4888('0x4'));var config=require(_0x4888('0x5'));var attributes=require(_0x4888('0x6'));module[_0x4888('0x7')]=function(_0x3a8de7,_0x56ba77){return _0x3a8de7['define'](_0x4888('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x265c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x3ed733,_0x1374ad){var _0x27805b=function(_0x5a63ea){while(--_0x5a63ea){_0x3ed733['push'](_0x3ed733['shift']());}};_0x27805b(++_0x1374ad);}(_0x265c,0x1c2));var _0xc265=function(_0x5ed5ed,_0x547fad){_0x5ed5ed=_0x5ed5ed-0x0;var _0x14c378=_0x265c[_0x5ed5ed];return _0x14c378;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var logger=require(_0xc265('0x2'))(_0xc265('0x3'));var moment=require(_0xc265('0x4'));var BPromise=require(_0xc265('0x5'));var rp=require(_0xc265('0x6'));var fs=require('fs');var path=require(_0xc265('0x7'));var rimraf=require(_0xc265('0x8'));var config=require(_0xc265('0x9'));var attributes=require(_0xc265('0xa'));module[_0xc265('0xb')]=function(_0x13ddbb,_0x288a2b){return _0x13ddbb[_0xc265('0xc')](_0xc265('0xd'),attributes,{'tableName':_0xc265('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 89d7736..73ba9cf 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 _0xcaac=['rpc','../../config/environment','client','http','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4fba84,_0x25ac8f){var _0x25de57=function(_0x30c784){while(--_0x30c784){_0x4fba84['push'](_0x4fba84['shift']());}};_0x25de57(++_0x25ac8f);}(_0xcaac,0xfe));var _0xccaa=function(_0x4193fd,_0x240d67){_0x4193fd=_0x4193fd-0x0;var _0x1dd0de=_0xcaac[_0x4193fd];return _0x1dd0de;};'use strict';var _=require(_0xccaa('0x0'));var util=require(_0xccaa('0x1'));var moment=require(_0xccaa('0x2'));var BPromise=require(_0xccaa('0x3'));var rs=require(_0xccaa('0x4'));var fs=require('fs');var Redis=require(_0xccaa('0x5'));var db=require(_0xccaa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xccaa('0x7'));var config=require(_0xccaa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccaa('0x9')][_0xccaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4336,_0x5b65c5,_0x1389d6){return new BPromise(function(_0x5e44fe,_0x987f51){return client[_0xccaa('0xb')](_0x2e4336,_0x1389d6)['then'](function(_0x240c8c){logger['info'](_0xccaa('0xc'),_0x5b65c5,'request\x20sent');logger[_0xccaa('0xd')](_0xccaa('0xe'),_0x5b65c5,_0xccaa('0xf'),JSON[_0xccaa('0x10')](_0x240c8c));if(_0x240c8c[_0xccaa('0x11')]){if(_0x240c8c[_0xccaa('0x11')]['code']===0x1f4){logger[_0xccaa('0x11')](_0xccaa('0xc'),_0x5b65c5,_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);return _0x987f51(_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);}logger[_0xccaa('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5b65c5,_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);return _0x5e44fe(_0x240c8c[_0xccaa('0x11')][_0xccaa('0x12')]);}else{logger[_0xccaa('0x13')](_0xccaa('0xc'),_0x5b65c5,'request\x20sent');_0x5e44fe(_0x240c8c[_0xccaa('0x14')][_0xccaa('0x12')]);}})[_0xccaa('0x15')](function(_0x18153b){logger['error'](_0xccaa('0xc'),_0x5b65c5,_0x18153b);_0x987f51(_0x18153b);});});}exports[_0xccaa('0x16')]=function(_0x3fb3b3){var _0x2c7a66=this;return new Promise(function(_0x1b76be,_0x10580c){return db[_0xccaa('0x17')][_0xccaa('0x18')](_0x3fb3b3[_0xccaa('0x19')],{'raw':_0x3fb3b3['options']?_0x3fb3b3[_0xccaa('0x1a')][_0xccaa('0x1b')]===undefined?!![]:![]:!![]})[_0xccaa('0x1c')](function(_0x54556d){logger[_0xccaa('0x13')](_0xccaa('0x16'),_0x3fb3b3);logger[_0xccaa('0xd')](_0xccaa('0x16'),_0x3fb3b3,JSON[_0xccaa('0x10')](_0x54556d));_0x1b76be(_0x54556d);})[_0xccaa('0x15')](function(_0x3c279d){logger[_0xccaa('0x11')](_0xccaa('0x16'),_0x3c279d[_0xccaa('0x12')],_0x3fb3b3);_0x10580c(_0x2c7a66[_0xccaa('0x11')](0x1f4,_0x3c279d[_0xccaa('0x12')]));});});}; \ No newline at end of file +var _0x8298=['jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f6fa2,_0xc6b43){var _0xe59237=function(_0x79c07d){while(--_0x79c07d){_0x2f6fa2['push'](_0x2f6fa2['shift']());}};_0xe59237(++_0xc6b43);}(_0x8298,0x99));var _0x8829=function(_0x2564e6,_0x467065){_0x2564e6=_0x2564e6-0x0;var _0x39be09=_0x8298[_0x2564e6];return _0x39be09;};'use strict';var _=require(_0x8829('0x0'));var util=require('util');var moment=require(_0x8829('0x1'));var BPromise=require('bluebird');var rs=require(_0x8829('0x2'));var fs=require('fs');var Redis=require(_0x8829('0x3'));var db=require(_0x8829('0x4'))['db'];var utils=require(_0x8829('0x5'));var logger=require(_0x8829('0x6'))(_0x8829('0x7'));var config=require(_0x8829('0x8'));var jayson=require(_0x8829('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x507edd,_0x2ccfa8,_0x385331){return new BPromise(function(_0xd50171,_0x1c9ca6){return client[_0x8829('0xa')](_0x507edd,_0x385331)[_0x8829('0xb')](function(_0x44ec25){logger[_0x8829('0xc')](_0x8829('0xd'),_0x2ccfa8,_0x8829('0xe'));logger[_0x8829('0xf')](_0x8829('0x10'),_0x2ccfa8,_0x8829('0xe'),JSON['stringify'](_0x44ec25));if(_0x44ec25['error']){if(_0x44ec25[_0x8829('0x11')][_0x8829('0x12')]===0x1f4){logger[_0x8829('0x11')](_0x8829('0xd'),_0x2ccfa8,_0x44ec25[_0x8829('0x11')][_0x8829('0x13')]);return _0x1c9ca6(_0x44ec25['error'][_0x8829('0x13')]);}logger[_0x8829('0x11')](_0x8829('0xd'),_0x2ccfa8,_0x44ec25[_0x8829('0x11')][_0x8829('0x13')]);return _0xd50171(_0x44ec25[_0x8829('0x11')][_0x8829('0x13')]);}else{logger[_0x8829('0xc')](_0x8829('0xd'),_0x2ccfa8,_0x8829('0xe'));_0xd50171(_0x44ec25[_0x8829('0x14')][_0x8829('0x13')]);}})[_0x8829('0x15')](function(_0x5d5ad5){logger['error'](_0x8829('0xd'),_0x2ccfa8,_0x5d5ad5);_0x1c9ca6(_0x5d5ad5);});});}exports[_0x8829('0x16')]=function(_0x264073){var _0x131698=this;return new Promise(function(_0x26c6b4,_0x5cc83b){return db[_0x8829('0x17')][_0x8829('0x18')](_0x264073['body'],{'raw':_0x264073[_0x8829('0x19')]?_0x264073[_0x8829('0x19')][_0x8829('0x1a')]===undefined?!![]:![]:!![]})[_0x8829('0xb')](function(_0x97cc9f){logger['info'](_0x8829('0x16'),_0x264073);logger[_0x8829('0xf')](_0x8829('0x16'),_0x264073,JSON['stringify'](_0x97cc9f));_0x26c6b4(_0x97cc9f);})['catch'](function(_0x1b71d0){logger['error']('CreateSquareMessage',_0x1b71d0['message'],_0x264073);_0x5cc83b(_0x131698['error'](0x1f4,_0x1b71d0[_0x8829('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8b0005e..5f4a06d 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 _0x00d7=['fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','get','/:id/test','15s','test','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0x00d7,0x7f));var _0x700d=function(_0xa6be5f,_0x279bea){_0xa6be5f=_0xa6be5f-0x0;var _0x3f88e6=_0x00d7[_0xa6be5f];return _0x3f88e6;};'use strict';var multer=require(_0x700d('0x0'));var util=require(_0x700d('0x1'));var path=require(_0x700d('0x2'));var timeout=require(_0x700d('0x3'));var express=require('express');var router=express[_0x700d('0x4')]();var fs_extra=require(_0x700d('0x5'));var auth=require(_0x700d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x700d('0x7'));var controller=require(_0x700d('0x8'));router['get']('/',auth[_0x700d('0x9')](),controller[_0x700d('0xa')]);router['get'](_0x700d('0xb'),auth[_0x700d('0x9')](),controller['show']);router[_0x700d('0xc')](_0x700d('0xd'),auth[_0x700d('0x9')](),timeout(_0x700d('0xe')),controller[_0x700d('0xf')]);router[_0x700d('0x10')]('/',auth['isAuthenticated'](),controller[_0x700d('0x11')]);router[_0x700d('0x12')](_0x700d('0xb'),auth[_0x700d('0x9')](),controller['update']);router[_0x700d('0x13')](_0x700d('0xb'),auth[_0x700d('0x9')](),controller[_0x700d('0x14')]);module[_0x700d('0x15')]=router; \ No newline at end of file +var _0x9b3c=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x9b3c,0x89));var _0xc9b3=function(_0x16ffb2,_0x559bba){_0x16ffb2=_0x16ffb2-0x0;var _0x12a592=_0x9b3c[_0x16ffb2];return _0x12a592;};'use strict';var multer=require('multer');var util=require(_0xc9b3('0x0'));var path=require(_0xc9b3('0x1'));var timeout=require(_0xc9b3('0x2'));var express=require('express');var router=express[_0xc9b3('0x3')]();var fs_extra=require(_0xc9b3('0x4'));var auth=require(_0xc9b3('0x5'));var interaction=require(_0xc9b3('0x6'));var config=require(_0xc9b3('0x7'));var controller=require(_0xc9b3('0x8'));router[_0xc9b3('0x9')]('/',auth[_0xc9b3('0xa')](),controller[_0xc9b3('0xb')]);router[_0xc9b3('0x9')](_0xc9b3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc9b3('0x9')](_0xc9b3('0xd'),auth[_0xc9b3('0xa')](),timeout(_0xc9b3('0xe')),controller[_0xc9b3('0xf')]);router[_0xc9b3('0x10')]('/',auth[_0xc9b3('0xa')](),controller[_0xc9b3('0x11')]);router[_0xc9b3('0x12')]('/:id',auth[_0xc9b3('0xa')](),controller[_0xc9b3('0x13')]);router[_0xc9b3('0x14')](_0xc9b3('0xc'),auth[_0xc9b3('0xa')](),controller[_0xc9b3('0x15')]);module[_0xc9b3('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 356853f..7caec52 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 _0xf274=['exports','STRING','sequelize'];(function(_0x48c06c,_0x4a9cc7){var _0x3f6e36=function(_0x487a5f){while(--_0x487a5f){_0x48c06c['push'](_0x48c06c['shift']());}};_0x3f6e36(++_0x4a9cc7);}(_0xf274,0x1f4));var _0x4f27=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf274[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x4f27('0x0'));module[_0x4f27('0x1')]={'name':{'type':Sequelize[_0x4f27('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4f27('0x2')]},'description':{'type':Sequelize[_0x4f27('0x2')]}}; \ No newline at end of file +var _0x4171=['name','STRING'];(function(_0x3cb979,_0x21bbfd){var _0x3a5e5f=function(_0x53aae0){while(--_0x53aae0){_0x3cb979['push'](_0x3cb979['shift']());}};_0x3a5e5f(++_0x21bbfd);}(_0x4171,0xc9));var _0x1417=function(_0x529901,_0x652a93){_0x529901=_0x529901-0x0;var _0x3293fb=_0x4171[_0x529901];return _0x3293fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1417('0x0')],'unique':_0x1417('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1417('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 81b163f..1081c49 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 _0x3e44=['set','Content-Range','apply','update','then','destroy','get','ODBC','error','stack','name','send','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x2f0bed,_0x4911f1){var _0x31fa87=function(_0x1de2fc){while(--_0x1de2fc){_0x2f0bed['push'](_0x2f0bed['shift']());}};_0x31fa87(++_0x4911f1);}(_0x3e44,0x91));var _0x43e4=function(_0xbabd64,_0x141131){_0xbabd64=_0xbabd64-0x0;var _0xc95730=_0x3e44[_0xbabd64];return _0xc95730;};'use strict';var emlformat=require(_0x43e4('0x0'));var rimraf=require(_0x43e4('0x1'));var zipdir=require(_0x43e4('0x2'));var jsonpatch=require(_0x43e4('0x3'));var rp=require('request-promise');var moment=require(_0x43e4('0x4'));var BPromise=require(_0x43e4('0x5'));var Mustache=require(_0x43e4('0x6'));var util=require('util');var path=require(_0x43e4('0x7'));var sox=require(_0x43e4('0x8'));var csv=require(_0x43e4('0x9'));var ejs=require(_0x43e4('0xa'));var fs=require('fs');var fs_extra=require(_0x43e4('0xb'));var _=require('lodash');var squel=require(_0x43e4('0xc'));var crypto=require(_0x43e4('0xd'));var jsforce=require(_0x43e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x43e4('0x9'));var querystring=require(_0x43e4('0xf'));var Papa=require('papaparse');var Redis=require(_0x43e4('0x10'));var authService=require(_0x43e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43e4('0x12'));var hardwareService=require(_0x43e4('0x13'));var logger=require(_0x43e4('0x14'))(_0x43e4('0x15'));var utils=require(_0x43e4('0x16'));var config=require(_0x43e4('0x17'));var licenseUtil=require(_0x43e4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c33e,_0xbdcd3d){_0xbdcd3d=_0xbdcd3d||0xcc;return function(_0x526c67){if(_0x526c67){return _0x14c33e[_0x43e4('0x19')](_0xbdcd3d);}return _0x14c33e[_0x43e4('0x1a')](_0xbdcd3d)[_0x43e4('0x1b')]();};}function respondWithResult(_0x2622b4,_0x5073a9){_0x5073a9=_0x5073a9||0xc8;return function(_0x3ab2a9){if(_0x3ab2a9){return _0x2622b4[_0x43e4('0x1a')](_0x5073a9)[_0x43e4('0x1c')](_0x3ab2a9);}};}function respondWithFilteredResult(_0x4d4652,_0x15693f){return function(_0x2275c7){if(_0x2275c7){var _0x4eef31=typeof _0x15693f[_0x43e4('0x1d')]==='undefined'&&typeof _0x15693f[_0x43e4('0x1e')]===_0x43e4('0x1f');var _0x589ad5=_0x2275c7[_0x43e4('0x20')];var _0x1ecd74=_0x4eef31?0x0:_0x15693f['offset'];var _0xb6274b=_0x4eef31?_0x2275c7[_0x43e4('0x20')]:_0x15693f[_0x43e4('0x1d')]+_0x15693f[_0x43e4('0x1e')];var _0x44a51a;if(_0xb6274b>=_0x589ad5){_0xb6274b=_0x589ad5;_0x44a51a=0xc8;}else{_0x44a51a=0xce;}_0x4d4652['status'](_0x44a51a);return _0x4d4652[_0x43e4('0x21')](_0x43e4('0x22'),_0x1ecd74+'-'+_0xb6274b+'/'+_0x589ad5)[_0x43e4('0x1c')](_0x2275c7);}return null;};}function patchUpdates(_0x4daa9e){return function(_0x286914){try{jsonpatch[_0x43e4('0x23')](_0x286914,_0x4daa9e,!![]);}catch(_0x25676f){return BPromise['reject'](_0x25676f);}return _0x286914['save']();};}function saveUpdates(_0x4f6c33,_0x1639ae){return function(_0x54e065){if(_0x54e065){return _0x54e065[_0x43e4('0x24')](_0x4f6c33)[_0x43e4('0x25')](function(_0xdc2ca1){return _0xdc2ca1;});}return null;};}function removeEntity(_0x56d32a,_0x446c80){return function(_0x2b6356){if(_0x2b6356){return _0x2b6356[_0x43e4('0x26')]()[_0x43e4('0x25')](function(){var _0x4cca0c=_0x2b6356[_0x43e4('0x27')]({'plain':!![]});var _0x530b4=_0x43e4('0x28');return db['UserProfileResource'][_0x43e4('0x26')]({'where':{'type':_0x530b4,'resourceId':_0x4cca0c['id']}})[_0x43e4('0x25')](function(){return _0x2b6356;});})[_0x43e4('0x25')](function(){_0x56d32a[_0x43e4('0x1a')](0xcc)[_0x43e4('0x1b')]();});}};}function handleEntityNotFound(_0x58a24d,_0x17feb1){return function(_0x4aa945){if(!_0x4aa945){_0x58a24d[_0x43e4('0x19')](0x194);}return _0x4aa945;};}function handleError(_0xc05e95,_0x5a46f4){_0x5a46f4=_0x5a46f4||0x1f4;return function(_0x111014){logger[_0x43e4('0x29')](_0x111014[_0x43e4('0x2a')]);if(_0x111014[_0x43e4('0x2b')]){delete _0x111014[_0x43e4('0x2b')];}_0xc05e95[_0x43e4('0x1a')](_0x5a46f4)[_0x43e4('0x2c')](_0x111014);};}exports['index']=function(_0x56cee6,_0x2d9e5f){var _0x2177e4={},_0x12ae15={},_0x36cf42={'count':0x0,'rows':[]};var _0x5c0f31=_[_0x43e4('0x2d')](db['SquareOdbc']['rawAttributes'],function(_0x3eae9f){return{'name':_0x3eae9f[_0x43e4('0x2e')],'type':_0x3eae9f[_0x43e4('0x2f')][_0x43e4('0x30')]};});_0x12ae15[_0x43e4('0x31')]=_[_0x43e4('0x2d')](_0x5c0f31,'name');_0x12ae15['query']=_['keys'](_0x56cee6[_0x43e4('0x32')]);_0x12ae15['filters']=_[_0x43e4('0x33')](_0x12ae15[_0x43e4('0x31')],_0x12ae15[_0x43e4('0x32')]);_0x2177e4['attributes']=_[_0x43e4('0x33')](_0x12ae15['model'],qs[_0x43e4('0x34')](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x34')]));_0x2177e4['attributes']=_0x2177e4[_0x43e4('0x35')][_0x43e4('0x36')]?_0x2177e4[_0x43e4('0x35')]:_0x12ae15['model'];if(!_0x56cee6[_0x43e4('0x32')][_0x43e4('0x37')](_0x43e4('0x38'))){_0x2177e4[_0x43e4('0x1e')]=qs[_0x43e4('0x1e')](_0x56cee6['query'][_0x43e4('0x1e')]);_0x2177e4['offset']=qs['offset'](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x1d')]);}_0x2177e4[_0x43e4('0x39')]=qs['sort'](_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3a')]);_0x2177e4[_0x43e4('0x3b')]=qs[_0x43e4('0x3c')](_[_0x43e4('0x3d')](_0x56cee6['query'],_0x12ae15[_0x43e4('0x3c')]),_0x5c0f31);if(_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3e')]){_0x2177e4[_0x43e4('0x3b')]=_['merge'](_0x2177e4[_0x43e4('0x3b')],{'$or':_[_0x43e4('0x2d')](_0x5c0f31,function(_0x4cfb82){if(_0x4cfb82[_0x43e4('0x2f')]!==_0x43e4('0x3f')){var _0x552896={};_0x552896[_0x4cfb82[_0x43e4('0x2b')]]={'$like':'%'+_0x56cee6[_0x43e4('0x32')][_0x43e4('0x3e')]+'%'};return _0x552896;}})});}_0x2177e4=_[_0x43e4('0x40')]({},_0x2177e4,_0x56cee6[_0x43e4('0x41')]);var _0x543740={'where':_0x2177e4[_0x43e4('0x3b')]};return db[_0x43e4('0x42')][_0x43e4('0x20')](_0x543740)[_0x43e4('0x25')](function(_0x4b55b9){_0x36cf42[_0x43e4('0x20')]=_0x4b55b9;if(_0x56cee6['query'][_0x43e4('0x43')]){_0x2177e4[_0x43e4('0x44')]=[{'all':!![]}];}return db[_0x43e4('0x42')][_0x43e4('0x45')](_0x2177e4);})[_0x43e4('0x25')](function(_0x421ab5){_0x36cf42[_0x43e4('0x46')]=_0x421ab5;return _0x36cf42;})[_0x43e4('0x25')](respondWithFilteredResult(_0x2d9e5f,_0x2177e4))[_0x43e4('0x47')](handleError(_0x2d9e5f,null));};exports[_0x43e4('0x48')]=function(_0x105d26,_0x14eaab){var _0x190651={'raw':!![],'where':{'id':_0x105d26['params']['id']}},_0x59bb2e={};_0x59bb2e[_0x43e4('0x31')]=_[_0x43e4('0x49')](db['SquareOdbc']['rawAttributes']);_0x59bb2e[_0x43e4('0x32')]=_[_0x43e4('0x49')](_0x105d26[_0x43e4('0x32')]);_0x59bb2e['filters']=_['intersection'](_0x59bb2e[_0x43e4('0x31')],_0x59bb2e['query']);_0x190651[_0x43e4('0x35')]=_[_0x43e4('0x33')](_0x59bb2e[_0x43e4('0x31')],qs[_0x43e4('0x34')](_0x105d26[_0x43e4('0x32')][_0x43e4('0x34')]));_0x190651[_0x43e4('0x35')]=_0x190651['attributes'][_0x43e4('0x36')]?_0x190651['attributes']:_0x59bb2e[_0x43e4('0x31')];if(_0x105d26[_0x43e4('0x32')][_0x43e4('0x43')]){_0x190651['include']=[{'all':!![]}];}_0x190651=_[_0x43e4('0x40')]({},_0x190651,_0x105d26['options']);return db[_0x43e4('0x42')][_0x43e4('0x4a')](_0x190651)[_0x43e4('0x25')](handleEntityNotFound(_0x14eaab,null))['then'](respondWithResult(_0x14eaab,null))[_0x43e4('0x47')](handleError(_0x14eaab,null));};exports[_0x43e4('0x4b')]=function(_0x1937f3,_0x36b4c2){return db['SquareOdbc'][_0x43e4('0x4b')](_0x1937f3['body'],{})['then'](function(_0x47e548){var _0x33054b=_0x1937f3[_0x43e4('0x4c')]['get']({'plain':!![]});if(!_0x33054b)throw new Error(_0x43e4('0x4d'));if(_0x33054b['role']===_0x43e4('0x4c')){var _0x78dad5=_0x47e548['get']({'plain':!![]});var _0x4b4ab0=_0x43e4('0x28');return db['UserProfileSection'][_0x43e4('0x4a')]({'where':{'name':_0x4b4ab0,'userProfileId':_0x33054b[_0x43e4('0x4e')]},'raw':!![]})['then'](function(_0x5e491a){if(_0x5e491a&&_0x5e491a[_0x43e4('0x4f')]===0x0){return db[_0x43e4('0x50')][_0x43e4('0x4b')]({'name':_0x78dad5[_0x43e4('0x2b')],'resourceId':_0x78dad5['id'],'type':_0x5e491a['name'],'sectionId':_0x5e491a['id']},{})[_0x43e4('0x25')](function(){return _0x47e548;});}else{return _0x47e548;}})[_0x43e4('0x47')](function(_0x4024f9){logger[_0x43e4('0x29')](_0x43e4('0x51'),_0x4024f9);throw _0x4024f9;});}return _0x47e548;})[_0x43e4('0x25')](respondWithResult(_0x36b4c2,0xc9))[_0x43e4('0x47')](handleError(_0x36b4c2,null));};exports[_0x43e4('0x24')]=function(_0x49b66e,_0x2fd7bf){if(_0x49b66e['body']['id']){delete _0x49b66e[_0x43e4('0x52')]['id'];}return db[_0x43e4('0x42')]['find']({'where':{'id':_0x49b66e[_0x43e4('0x53')]['id']}})['then'](handleEntityNotFound(_0x2fd7bf,null))[_0x43e4('0x25')](saveUpdates(_0x49b66e[_0x43e4('0x52')],null))[_0x43e4('0x25')](respondWithResult(_0x2fd7bf,null))['catch'](handleError(_0x2fd7bf,null));};exports['destroy']=function(_0x5842bf,_0x5d7f9e){return db[_0x43e4('0x42')][_0x43e4('0x4a')]({'where':{'id':_0x5842bf[_0x43e4('0x53')]['id']}})[_0x43e4('0x25')](handleEntityNotFound(_0x5d7f9e,null))['then'](removeEntity(_0x5d7f9e,null))['catch'](handleError(_0x5d7f9e,null));};exports[_0x43e4('0x54')]=function(_0x46ade6,_0xe25861,_0x242cae){var _0x3b2eea;return db[_0x43e4('0x42')][_0x43e4('0x4a')]({'where':{'id':_0x46ade6[_0x43e4('0x53')]['id']},'attributes':['id','dsn']})[_0x43e4('0x25')](handleEntityNotFound(_0xe25861,null))[_0x43e4('0x25')](function(_0x18cfdb){if(_0x18cfdb){var _0x301073=require(_0x43e4('0x55'))();_0x301073[_0x43e4('0x56')](_0x18cfdb[_0x43e4('0x57')]);_0x301073[_0x43e4('0x58')]();return _0x18cfdb;}})[_0x43e4('0x25')](respondWithResult(_0xe25861,null))[_0x43e4('0x47')](handleError(_0xe25861,null));}; \ No newline at end of file +var _0xd3ab=['sendStatus','error','name','send','map','SquareOdbc','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','openSync','closeSync','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','ODBC','UserProfileResource'];(function(_0x2e5b7e,_0x4b6d42){var _0x52e89b=function(_0xd814f4){while(--_0xd814f4){_0x2e5b7e['push'](_0x2e5b7e['shift']());}};_0x52e89b(++_0x4b6d42);}(_0xd3ab,0x126));var _0xbd3a=function(_0x33e2e1,_0x1b8bc7){_0x33e2e1=_0x33e2e1-0x0;var _0x267598=_0xd3ab[_0x33e2e1];return _0x267598;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbd3a('0x0'));var rp=require(_0xbd3a('0x1'));var moment=require(_0xbd3a('0x2'));var BPromise=require(_0xbd3a('0x3'));var Mustache=require(_0xbd3a('0x4'));var util=require(_0xbd3a('0x5'));var path=require(_0xbd3a('0x6'));var sox=require(_0xbd3a('0x7'));var csv=require(_0xbd3a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd3a('0x9'));var _=require(_0xbd3a('0xa'));var squel=require('squel');var crypto=require(_0xbd3a('0xb'));var jsforce=require(_0xbd3a('0xc'));var deskjs=require(_0xbd3a('0xd'));var toCsv=require(_0xbd3a('0x8'));var querystring=require('querystring');var Papa=require(_0xbd3a('0xe'));var Redis=require(_0xbd3a('0xf'));var authService=require(_0xbd3a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbd3a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd3a('0x12'))('api');var utils=require(_0xbd3a('0x13'));var config=require(_0xbd3a('0x14'));var licenseUtil=require(_0xbd3a('0x15'));var db=require(_0xbd3a('0x16'))['db'];function respondWithStatusCode(_0x28b987,_0x2d0d99){_0x2d0d99=_0x2d0d99||0xcc;return function(_0x4cffcb){if(_0x4cffcb){return _0x28b987['sendStatus'](_0x2d0d99);}return _0x28b987[_0xbd3a('0x17')](_0x2d0d99)[_0xbd3a('0x18')]();};}function respondWithResult(_0x1dc25f,_0x2a3ae1){_0x2a3ae1=_0x2a3ae1||0xc8;return function(_0x2f7077){if(_0x2f7077){return _0x1dc25f[_0xbd3a('0x17')](_0x2a3ae1)[_0xbd3a('0x19')](_0x2f7077);}};}function respondWithFilteredResult(_0x5a501c,_0x52fee6){return function(_0x47c50e){if(_0x47c50e){var _0x415453=typeof _0x52fee6[_0xbd3a('0x1a')]===_0xbd3a('0x1b')&&typeof _0x52fee6[_0xbd3a('0x1c')]===_0xbd3a('0x1b');var _0x3197aa=_0x47c50e[_0xbd3a('0x1d')];var _0x6fa9bf=_0x415453?0x0:_0x52fee6['offset'];var _0x5a3bc6=_0x415453?_0x47c50e['count']:_0x52fee6[_0xbd3a('0x1a')]+_0x52fee6['limit'];var _0x3c0181;if(_0x5a3bc6>=_0x3197aa){_0x5a3bc6=_0x3197aa;_0x3c0181=0xc8;}else{_0x3c0181=0xce;}_0x5a501c[_0xbd3a('0x17')](_0x3c0181);return _0x5a501c['set'](_0xbd3a('0x1e'),_0x6fa9bf+'-'+_0x5a3bc6+'/'+_0x3197aa)[_0xbd3a('0x19')](_0x47c50e);}return null;};}function patchUpdates(_0x37650a){return function(_0x2cb04f){try{jsonpatch['apply'](_0x2cb04f,_0x37650a,!![]);}catch(_0x4bfd44){return BPromise[_0xbd3a('0x1f')](_0x4bfd44);}return _0x2cb04f[_0xbd3a('0x20')]();};}function saveUpdates(_0x1ef6c4,_0x1c0957){return function(_0x3a15c3){if(_0x3a15c3){return _0x3a15c3['update'](_0x1ef6c4)[_0xbd3a('0x21')](function(_0x107ff0){return _0x107ff0;});}return null;};}function removeEntity(_0x25f99d,_0x1588de){return function(_0x28afc4){if(_0x28afc4){return _0x28afc4[_0xbd3a('0x22')]()[_0xbd3a('0x21')](function(){var _0x36baae=_0x28afc4[_0xbd3a('0x23')]({'plain':!![]});var _0x1c0a86=_0xbd3a('0x24');return db[_0xbd3a('0x25')]['destroy']({'where':{'type':_0x1c0a86,'resourceId':_0x36baae['id']}})['then'](function(){return _0x28afc4;});})[_0xbd3a('0x21')](function(){_0x25f99d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x189a51,_0x50ead8){return function(_0x5690aa){if(!_0x5690aa){_0x189a51[_0xbd3a('0x26')](0x194);}return _0x5690aa;};}function handleError(_0x27cd2d,_0x3495bb){_0x3495bb=_0x3495bb||0x1f4;return function(_0x1a45a4){logger[_0xbd3a('0x27')](_0x1a45a4['stack']);if(_0x1a45a4[_0xbd3a('0x28')]){delete _0x1a45a4[_0xbd3a('0x28')];}_0x27cd2d[_0xbd3a('0x17')](_0x3495bb)[_0xbd3a('0x29')](_0x1a45a4);};}exports['index']=function(_0x4d24f6,_0x54cdd3){var _0x3d8d79={},_0x5cdf93={},_0x57b9fe={'count':0x0,'rows':[]};var _0x16f03d=_[_0xbd3a('0x2a')](db[_0xbd3a('0x2b')]['rawAttributes'],function(_0x309982){return{'name':_0x309982['fieldName'],'type':_0x309982['type'][_0xbd3a('0x2c')]};});_0x5cdf93[_0xbd3a('0x2d')]=_[_0xbd3a('0x2a')](_0x16f03d,_0xbd3a('0x28'));_0x5cdf93['query']=_[_0xbd3a('0x2e')](_0x4d24f6[_0xbd3a('0x2f')]);_0x5cdf93[_0xbd3a('0x30')]=_['intersection'](_0x5cdf93[_0xbd3a('0x2d')],_0x5cdf93[_0xbd3a('0x2f')]);_0x3d8d79[_0xbd3a('0x31')]=_['intersection'](_0x5cdf93[_0xbd3a('0x2d')],qs['fields'](_0x4d24f6[_0xbd3a('0x2f')][_0xbd3a('0x32')]));_0x3d8d79[_0xbd3a('0x31')]=_0x3d8d79['attributes']['length']?_0x3d8d79[_0xbd3a('0x31')]:_0x5cdf93[_0xbd3a('0x2d')];if(!_0x4d24f6[_0xbd3a('0x2f')][_0xbd3a('0x33')](_0xbd3a('0x34'))){_0x3d8d79['limit']=qs[_0xbd3a('0x1c')](_0x4d24f6['query'][_0xbd3a('0x1c')]);_0x3d8d79[_0xbd3a('0x1a')]=qs['offset'](_0x4d24f6['query'][_0xbd3a('0x1a')]);}_0x3d8d79[_0xbd3a('0x35')]=qs['sort'](_0x4d24f6[_0xbd3a('0x2f')][_0xbd3a('0x36')]);_0x3d8d79[_0xbd3a('0x37')]=qs[_0xbd3a('0x30')](_[_0xbd3a('0x38')](_0x4d24f6[_0xbd3a('0x2f')],_0x5cdf93['filters']),_0x16f03d);if(_0x4d24f6[_0xbd3a('0x2f')][_0xbd3a('0x39')]){_0x3d8d79[_0xbd3a('0x37')]=_[_0xbd3a('0x3a')](_0x3d8d79[_0xbd3a('0x37')],{'$or':_['map'](_0x16f03d,function(_0x166d98){if(_0x166d98[_0xbd3a('0x3b')]!==_0xbd3a('0x3c')){var _0x57d48f={};_0x57d48f[_0x166d98[_0xbd3a('0x28')]]={'$like':'%'+_0x4d24f6['query'][_0xbd3a('0x39')]+'%'};return _0x57d48f;}})});}_0x3d8d79=_[_0xbd3a('0x3a')]({},_0x3d8d79,_0x4d24f6[_0xbd3a('0x3d')]);var _0x1185d9={'where':_0x3d8d79['where']};return db[_0xbd3a('0x2b')][_0xbd3a('0x1d')](_0x1185d9)['then'](function(_0x5b7812){_0x57b9fe[_0xbd3a('0x1d')]=_0x5b7812;if(_0x4d24f6[_0xbd3a('0x2f')][_0xbd3a('0x3e')]){_0x3d8d79[_0xbd3a('0x3f')]=[{'all':!![]}];}return db[_0xbd3a('0x2b')][_0xbd3a('0x40')](_0x3d8d79);})[_0xbd3a('0x21')](function(_0x5eb051){_0x57b9fe[_0xbd3a('0x41')]=_0x5eb051;return _0x57b9fe;})[_0xbd3a('0x21')](respondWithFilteredResult(_0x54cdd3,_0x3d8d79))['catch'](handleError(_0x54cdd3,null));};exports[_0xbd3a('0x42')]=function(_0x3308d0,_0x513c19){var _0x46dc33={'raw':!![],'where':{'id':_0x3308d0['params']['id']}},_0xfec4f8={};_0xfec4f8['model']=_[_0xbd3a('0x2e')](db[_0xbd3a('0x2b')]['rawAttributes']);_0xfec4f8[_0xbd3a('0x2f')]=_['keys'](_0x3308d0['query']);_0xfec4f8['filters']=_[_0xbd3a('0x43')](_0xfec4f8['model'],_0xfec4f8[_0xbd3a('0x2f')]);_0x46dc33['attributes']=_[_0xbd3a('0x43')](_0xfec4f8[_0xbd3a('0x2d')],qs['fields'](_0x3308d0['query'][_0xbd3a('0x32')]));_0x46dc33[_0xbd3a('0x31')]=_0x46dc33['attributes']['length']?_0x46dc33[_0xbd3a('0x31')]:_0xfec4f8['model'];if(_0x3308d0['query'][_0xbd3a('0x3e')]){_0x46dc33['include']=[{'all':!![]}];}_0x46dc33=_['merge']({},_0x46dc33,_0x3308d0['options']);return db[_0xbd3a('0x2b')]['find'](_0x46dc33)['then'](handleEntityNotFound(_0x513c19,null))[_0xbd3a('0x21')](respondWithResult(_0x513c19,null))[_0xbd3a('0x44')](handleError(_0x513c19,null));};exports[_0xbd3a('0x45')]=function(_0x517ac9,_0x55b3af){return db[_0xbd3a('0x2b')][_0xbd3a('0x45')](_0x517ac9[_0xbd3a('0x46')],{})[_0xbd3a('0x21')](function(_0x20decc){var _0x30a274=_0x517ac9[_0xbd3a('0x47')][_0xbd3a('0x23')]({'plain':!![]});if(!_0x30a274)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30a274['role']==='user'){var _0x1918a5=_0x20decc[_0xbd3a('0x23')]({'plain':!![]});var _0x43560c=_0xbd3a('0x24');return db[_0xbd3a('0x48')][_0xbd3a('0x49')]({'where':{'name':_0x43560c,'userProfileId':_0x30a274[_0xbd3a('0x4a')]},'raw':!![]})[_0xbd3a('0x21')](function(_0x49062d){if(_0x49062d&&_0x49062d[_0xbd3a('0x4b')]===0x0){return db[_0xbd3a('0x25')][_0xbd3a('0x45')]({'name':_0x1918a5[_0xbd3a('0x28')],'resourceId':_0x1918a5['id'],'type':_0x49062d[_0xbd3a('0x28')],'sectionId':_0x49062d['id']},{})[_0xbd3a('0x21')](function(){return _0x20decc;});}else{return _0x20decc;}})['catch'](function(_0x2260d5){logger['error'](_0xbd3a('0x4c'),_0x2260d5);throw _0x2260d5;});}return _0x20decc;})[_0xbd3a('0x21')](respondWithResult(_0x55b3af,0xc9))[_0xbd3a('0x44')](handleError(_0x55b3af,null));};exports[_0xbd3a('0x4d')]=function(_0x205fe5,_0xf5ac77){if(_0x205fe5[_0xbd3a('0x46')]['id']){delete _0x205fe5[_0xbd3a('0x46')]['id'];}return db[_0xbd3a('0x2b')][_0xbd3a('0x49')]({'where':{'id':_0x205fe5[_0xbd3a('0x4e')]['id']}})[_0xbd3a('0x21')](handleEntityNotFound(_0xf5ac77,null))[_0xbd3a('0x21')](saveUpdates(_0x205fe5[_0xbd3a('0x46')],null))['then'](respondWithResult(_0xf5ac77,null))['catch'](handleError(_0xf5ac77,null));};exports[_0xbd3a('0x22')]=function(_0x42b161,_0x3aa2a6){return db['SquareOdbc'][_0xbd3a('0x49')]({'where':{'id':_0x42b161[_0xbd3a('0x4e')]['id']}})[_0xbd3a('0x21')](handleEntityNotFound(_0x3aa2a6,null))[_0xbd3a('0x21')](removeEntity(_0x3aa2a6,null))['catch'](handleError(_0x3aa2a6,null));};exports[_0xbd3a('0x4f')]=function(_0x44de9b,_0x552042,_0x4cd799){var _0x470132;return db[_0xbd3a('0x2b')]['find']({'where':{'id':_0x44de9b['params']['id']},'attributes':['id',_0xbd3a('0x50')]})[_0xbd3a('0x21')](handleEntityNotFound(_0x552042,null))[_0xbd3a('0x21')](function(_0x5cb8d0){if(_0x5cb8d0){var _0x3b266d=require('odbc')();_0x3b266d[_0xbd3a('0x51')](_0x5cb8d0[_0xbd3a('0x50')]);_0x3b266d[_0xbd3a('0x52')]();return _0x5cb8d0;}})[_0xbd3a('0x21')](respondWithResult(_0x552042,null))[_0xbd3a('0x44')](handleError(_0x552042,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2af1d09..003a4a7 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 _0x79cf=['api','bluebird','request-promise','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x1f6e13,_0x20443d){var _0x59955b=function(_0x1987ad){while(--_0x1987ad){_0x1f6e13['push'](_0x1f6e13['shift']());}};_0x59955b(++_0x20443d);}(_0x79cf,0x101));var _0xf79c=function(_0x3b3840,_0x438322){_0x3b3840=_0x3b3840-0x0;var _0x1f604c=_0x79cf[_0x3b3840];return _0x1f604c;};'use strict';var _=require(_0xf79c('0x0'));var util=require(_0xf79c('0x1'));var logger=require(_0xf79c('0x2'))(_0xf79c('0x3'));var moment=require('moment');var BPromise=require(_0xf79c('0x4'));var rp=require(_0xf79c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xf79c('0x6')]=function(_0x6e80de,_0x57a364){return _0x6e80de[_0xf79c('0x7')](_0xf79c('0x8'),attributes,{'tableName':_0xf79c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe774=['rimraf','../../config/environment','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x43d1dd,_0x59eb3f){var _0x1aae05=function(_0x28fa2a){while(--_0x28fa2a){_0x43d1dd['push'](_0x43d1dd['shift']());}};_0x1aae05(++_0x59eb3f);}(_0xe774,0x95));var _0x4e77=function(_0x55aa6c,_0x3ab846){_0x55aa6c=_0x55aa6c-0x0;var _0x46ddda=_0xe774[_0x55aa6c];return _0x46ddda;};'use strict';var _=require(_0x4e77('0x0'));var util=require('util');var logger=require(_0x4e77('0x1'))(_0x4e77('0x2'));var moment=require(_0x4e77('0x3'));var BPromise=require(_0x4e77('0x4'));var rp=require(_0x4e77('0x5'));var fs=require('fs');var path=require(_0x4e77('0x6'));var rimraf=require(_0x4e77('0x7'));var config=require(_0x4e77('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x4e77('0x9')]=function(_0x17874f,_0x4d6b7e){return _0x17874f['define'](_0x4e77('0xa'),attributes,{'tableName':_0x4e77('0xb'),'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 bd4440e..2cdfb78 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 _0xf4a1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','find','options','raw','include','map','attributes','model','ShowSquareOdbc','catch'];(function(_0x2c44fa,_0x115d44){var _0x503b36=function(_0x1bd31e){while(--_0x1bd31e){_0x2c44fa['push'](_0x2c44fa['shift']());}};_0x503b36(++_0x115d44);}(_0xf4a1,0xf8));var _0x1f4a=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xf4a1[_0x238671];return _0x474844;};'use strict';var _=require(_0x1f4a('0x0'));var util=require(_0x1f4a('0x1'));var moment=require(_0x1f4a('0x2'));var BPromise=require(_0x1f4a('0x3'));var rs=require(_0x1f4a('0x4'));var fs=require('fs');var Redis=require(_0x1f4a('0x5'));var db=require(_0x1f4a('0x6'))['db'];var utils=require(_0x1f4a('0x7'));var logger=require(_0x1f4a('0x8'))(_0x1f4a('0x9'));var config=require(_0x1f4a('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34efca,_0xa6eb14,_0x2b1f16){return new BPromise(function(_0x310970,_0x561f58){return client[_0x1f4a('0xc')](_0x34efca,_0x2b1f16)[_0x1f4a('0xd')](function(_0x130210){logger['info'](_0x1f4a('0xe'),_0xa6eb14,_0x1f4a('0xf'));logger[_0x1f4a('0x10')](_0x1f4a('0x11'),_0xa6eb14,'request\x20sent',JSON['stringify'](_0x130210));if(_0x130210[_0x1f4a('0x12')]){if(_0x130210['error'][_0x1f4a('0x13')]===0x1f4){logger['error'](_0x1f4a('0xe'),_0xa6eb14,_0x130210['error'][_0x1f4a('0x14')]);return _0x561f58(_0x130210['error'][_0x1f4a('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0xa6eb14,_0x130210['error']['message']);return _0x310970(_0x130210[_0x1f4a('0x12')]['message']);}else{logger[_0x1f4a('0x15')](_0x1f4a('0xe'),_0xa6eb14,_0x1f4a('0xf'));_0x310970(_0x130210['result'][_0x1f4a('0x14')]);}})['catch'](function(_0x44ae2b){logger['error'](_0x1f4a('0xe'),_0xa6eb14,_0x44ae2b);_0x561f58(_0x44ae2b);});});}exports['ShowSquareOdbc']=function(_0x143dc3){var _0x1b2ec5=this;return new Promise(function(_0x4b726e,_0x196739){return db['SquareOdbc'][_0x1f4a('0x16')]({'raw':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')]['where']||null:null,'attributes':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')]['attributes']||null:null,'include':_0x143dc3[_0x1f4a('0x17')]?_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x19')]?_[_0x1f4a('0x1a')](_0x143dc3[_0x1f4a('0x17')][_0x1f4a('0x19')],function(_0x147b79){return{'model':db[_0x147b79['model']],'as':_0x147b79['as'],'attributes':_0x147b79[_0x1f4a('0x1b')],'include':_0x147b79[_0x1f4a('0x19')]?_[_0x1f4a('0x1a')](_0x147b79[_0x1f4a('0x19')],function(_0x52ae35){return{'model':db[_0x52ae35[_0x1f4a('0x1c')]],'as':_0x52ae35['as'],'attributes':_0x52ae35[_0x1f4a('0x1b')],'include':_0x52ae35['include']?_[_0x1f4a('0x1a')](_0x52ae35['include'],function(_0x30659d){return{'model':db[_0x30659d['model']],'as':_0x30659d['as'],'attributes':_0x30659d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f4a('0xd')](function(_0x218c62){logger[_0x1f4a('0x15')](_0x1f4a('0x1d'),_0x143dc3);logger[_0x1f4a('0x10')]('ShowSquareOdbc',_0x143dc3,JSON['stringify'](_0x218c62));_0x4b726e(_0x218c62);})[_0x1f4a('0x1e')](function(_0x1cb6d6){logger[_0x1f4a('0x12')](_0x1f4a('0x1d'),_0x1cb6d6[_0x1f4a('0x14')],_0x143dc3);_0x196739(_0x1b2ec5['error'](0x1f4,_0x1cb6d6[_0x1f4a('0x14')]));});});}; \ No newline at end of file +var _0xfc11=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','SquareOdbc','options','where','attributes','model','map','include','then','stringify','ShowSquareOdbc','lodash','util','moment'];(function(_0x433972,_0x21f1b6){var _0x5db7b5=function(_0x522fcd){while(--_0x522fcd){_0x433972['push'](_0x433972['shift']());}};_0x5db7b5(++_0x21f1b6);}(_0xfc11,0xbd));var _0x1fc1=function(_0x53b672,_0x359e1e){_0x53b672=_0x53b672-0x0;var _0x172e44=_0xfc11[_0x53b672];return _0x172e44;};'use strict';var _=require(_0x1fc1('0x0'));var util=require(_0x1fc1('0x1'));var moment=require(_0x1fc1('0x2'));var BPromise=require(_0x1fc1('0x3'));var rs=require(_0x1fc1('0x4'));var fs=require('fs');var Redis=require(_0x1fc1('0x5'));var db=require(_0x1fc1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fc1('0x7'))(_0x1fc1('0x8'));var config=require(_0x1fc1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1fc1('0xa')][_0x1fc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d3709,_0xf4c2ed,_0x5679a7){return new BPromise(function(_0x2ea65e,_0x385fc1){return client[_0x1fc1('0xc')](_0x1d3709,_0x5679a7)['then'](function(_0x476d3d){logger['info'](_0x1fc1('0xd'),_0xf4c2ed,_0x1fc1('0xe'));logger[_0x1fc1('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0xf4c2ed,_0x1fc1('0xe'),JSON['stringify'](_0x476d3d));if(_0x476d3d['error']){if(_0x476d3d[_0x1fc1('0x10')][_0x1fc1('0x11')]===0x1f4){logger[_0x1fc1('0x10')](_0x1fc1('0xd'),_0xf4c2ed,_0x476d3d[_0x1fc1('0x10')][_0x1fc1('0x12')]);return _0x385fc1(_0x476d3d[_0x1fc1('0x10')]['message']);}logger[_0x1fc1('0x10')]('SquareOdbc,\x20%s,\x20%s',_0xf4c2ed,_0x476d3d['error'][_0x1fc1('0x12')]);return _0x2ea65e(_0x476d3d[_0x1fc1('0x10')][_0x1fc1('0x12')]);}else{logger[_0x1fc1('0x13')](_0x1fc1('0xd'),_0xf4c2ed,_0x1fc1('0xe'));_0x2ea65e(_0x476d3d[_0x1fc1('0x14')]['message']);}})[_0x1fc1('0x15')](function(_0x3c2bd2){logger['error'](_0x1fc1('0xd'),_0xf4c2ed,_0x3c2bd2);_0x385fc1(_0x3c2bd2);});});}exports['ShowSquareOdbc']=function(_0x230ab8){var _0x397d66=this;return new Promise(function(_0x725371,_0x19d6cf){return db[_0x1fc1('0x16')]['find']({'raw':_0x230ab8['options']?_0x230ab8[_0x1fc1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x230ab8[_0x1fc1('0x17')]?_0x230ab8[_0x1fc1('0x17')][_0x1fc1('0x18')]||null:null,'attributes':_0x230ab8[_0x1fc1('0x17')]?_0x230ab8['options'][_0x1fc1('0x19')]||null:null,'include':_0x230ab8[_0x1fc1('0x17')]?_0x230ab8[_0x1fc1('0x17')]['include']?_['map'](_0x230ab8[_0x1fc1('0x17')]['include'],function(_0x21c101){return{'model':db[_0x21c101[_0x1fc1('0x1a')]],'as':_0x21c101['as'],'attributes':_0x21c101[_0x1fc1('0x19')],'include':_0x21c101['include']?_[_0x1fc1('0x1b')](_0x21c101[_0x1fc1('0x1c')],function(_0x557ebb){return{'model':db[_0x557ebb['model']],'as':_0x557ebb['as'],'attributes':_0x557ebb[_0x1fc1('0x19')],'include':_0x557ebb['include']?_[_0x1fc1('0x1b')](_0x557ebb['include'],function(_0x4c1450){return{'model':db[_0x4c1450[_0x1fc1('0x1a')]],'as':_0x4c1450['as'],'attributes':_0x4c1450['attributes']};}):[]};}):[]};}):[]:[]})[_0x1fc1('0x1d')](function(_0x17e6db){logger[_0x1fc1('0x13')]('ShowSquareOdbc',_0x230ab8);logger[_0x1fc1('0xf')]('ShowSquareOdbc',_0x230ab8,JSON[_0x1fc1('0x1e')](_0x17e6db));_0x725371(_0x17e6db);})['catch'](function(_0x5b448c){logger['error'](_0x1fc1('0x1f'),_0x5b448c[_0x1fc1('0x12')],_0x230ab8);_0x19d6cf(_0x397d66['error'](0x1f4,_0x5b448c[_0x1fc1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2d73991..7e41e7d 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 _0x30e5=['./squareProject.controller','isAuthenticated','get','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e88c,_0x1e04f6){var _0x398929=function(_0x499e4c){while(--_0x499e4c){_0x2e88c['push'](_0x2e88c['shift']());}};_0x398929(++_0x1e04f6);}(_0x30e5,0xb6));var _0x530e=function(_0xd74a23,_0x78aeae){_0xd74a23=_0xd74a23-0x0;var _0x228d19=_0x30e5[_0xd74a23];return _0x228d19;};'use strict';var multer=require(_0x530e('0x0'));var util=require(_0x530e('0x1'));var path=require(_0x530e('0x2'));var timeout=require(_0x530e('0x3'));var express=require(_0x530e('0x4'));var router=express[_0x530e('0x5')]();var fs_extra=require(_0x530e('0x6'));var auth=require(_0x530e('0x7'));var interaction=require(_0x530e('0x8'));var config=require(_0x530e('0x9'));var controller=require(_0x530e('0xa'));router['get']('/',auth[_0x530e('0xb')](),controller['index']);router[_0x530e('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x530e('0xb')](),controller['create']);router['put'](_0x530e('0xd'),auth[_0x530e('0xb')](),controller[_0x530e('0xe')]);router['delete']('/:id',auth[_0x530e('0xb')](),controller[_0x530e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6570=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x3c9851,_0x456a06){var _0x13a106=function(_0x136163){while(--_0x136163){_0x3c9851['push'](_0x3c9851['shift']());}};_0x13a106(++_0x456a06);}(_0x6570,0x177));var _0x0657=function(_0x4d389f,_0x131a55){_0x4d389f=_0x4d389f-0x0;var _0x122cbc=_0x6570[_0x4d389f];return _0x122cbc;};'use strict';var multer=require(_0x0657('0x0'));var util=require(_0x0657('0x1'));var path=require('path');var timeout=require(_0x0657('0x2'));var express=require(_0x0657('0x3'));var router=express[_0x0657('0x4')]();var fs_extra=require(_0x0657('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0657('0x6'));var config=require(_0x0657('0x7'));var controller=require('./squareProject.controller');router[_0x0657('0x8')]('/',auth[_0x0657('0x9')](),controller[_0x0657('0xa')]);router['get']('/:id',auth[_0x0657('0x9')](),controller['show']);router[_0x0657('0xb')]('/',auth[_0x0657('0x9')](),controller[_0x0657('0xc')]);router[_0x0657('0xd')](_0x0657('0xe'),auth['isAuthenticated'](),controller[_0x0657('0xf')]);router['delete'](_0x0657('0xe'),auth['isAuthenticated'](),controller[_0x0657('0x10')]);module[_0x0657('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6a37c49..cd28004 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 _0xa8dd=['TEXT','long','preproduction','toString','utf8','BLOB','getDataValue','production','DATE','sequelize','name','STRING'];(function(_0x35a764,_0x3837da){var _0x18a9cd=function(_0x5a49c1){while(--_0x5a49c1){_0x35a764['push'](_0x35a764['shift']());}};_0x18a9cd(++_0x3837da);}(_0xa8dd,0x1dd));var _0xda8d=function(_0x52f1f9,_0x171046){_0x52f1f9=_0x52f1f9-0x0;var _0x178fc2=_0xa8dd[_0x52f1f9];return _0x178fc2;};'use strict';var Sequelize=require(_0xda8d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda8d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xda8d('0x2')]},'notes':{'type':Sequelize[_0xda8d('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xda8d('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0xda8d('0x5'))[_0xda8d('0x6')](_0xda8d('0x7'));}}},'production':{'type':Sequelize[_0xda8d('0x8')](_0xda8d('0x4')),'get':function(){if(this[_0xda8d('0x9')]('production')){return this[_0xda8d('0x9')](_0xda8d('0xa'))[_0xda8d('0x6')](_0xda8d('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xda8d('0xb')]}}; \ No newline at end of file +var _0xd811=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','exports','STRING'];(function(_0x34171c,_0x44382e){var _0x12d9c8=function(_0x46e135){while(--_0x46e135){_0x34171c['push'](_0x34171c['shift']());}};_0x12d9c8(++_0x44382e);}(_0xd811,0x165));var _0x1d81=function(_0x5e9c3a,_0x13acc2){_0x5e9c3a=_0x5e9c3a-0x0;var _0x12ccb4=_0xd811[_0x5e9c3a];return _0x12ccb4;};'use strict';var Sequelize=require(_0x1d81('0x0'));module[_0x1d81('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1d81('0x2')]},'notes':{'type':Sequelize[_0x1d81('0x3')]},'preproduction':{'type':Sequelize[_0x1d81('0x4')]('long'),'get':function(){if(this[_0x1d81('0x5')]('preproduction')){return this[_0x1d81('0x5')](_0x1d81('0x6'))[_0x1d81('0x7')](_0x1d81('0x8'));}}},'production':{'type':Sequelize[_0x1d81('0x4')](_0x1d81('0x9')),'get':function(){if(this[_0x1d81('0x5')](_0x1d81('0xa'))){return this[_0x1d81('0x5')](_0x1d81('0xa'))[_0x1d81('0x7')](_0x1d81('0x8'));}}},'savedAt':{'type':Sequelize[_0x1d81('0xb')]},'publishedAt':{'type':Sequelize[_0x1d81('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d4fe4ca..dd0f220 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 _0xb3a8=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','UserProfileResource','publish','agi','stringify','sendStatus','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','SquareProject','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','SquareProjects','UserProfileSection','userProfileId'];(function(_0x4ad4d7,_0x4e7bff){var _0x4000e0=function(_0x5405be){while(--_0x5405be){_0x4ad4d7['push'](_0x4ad4d7['shift']());}};_0x4000e0(++_0x4e7bff);}(_0xb3a8,0x89));var _0x8b3a=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xb3a8[_0x13137e];return _0x346261;};'use strict';var _=require(_0x8b3a('0x0'));var Redis=require(_0x8b3a('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x8b3a('0x2'));var db=require('../../mysqldb')['db'];config[_0x8b3a('0x3')]=_[_0x8b3a('0x4')](config['redis'],{'host':_0x8b3a('0x5'),'port':0x18eb});var socket=require(_0x8b3a('0x6'))(new Redis(config[_0x8b3a('0x3')]));require(_0x8b3a('0x7'))['register'](socket);function respondWithResult(_0x5a2227,_0x239939){_0x239939=_0x239939||0xc8;return function(_0x28599f){if(_0x28599f){return _0x5a2227[_0x8b3a('0x8')](_0x239939)[_0x8b3a('0x9')](_0x28599f);}};}function respondWithFilteredResult(_0x20a22f,_0x2820ab){return function(_0xe99a83){if(_0xe99a83){var _0x2cf38b=typeof _0x2820ab[_0x8b3a('0xa')]===_0x8b3a('0xb')&&typeof _0x2820ab[_0x8b3a('0xc')]==='undefined';var _0x1e5ce3=_0xe99a83['count'];var _0x258b00=_0x2cf38b?0x0:_0x2820ab[_0x8b3a('0xa')];var _0x30d8ab=_0x2cf38b?_0xe99a83[_0x8b3a('0xd')]:_0x2820ab[_0x8b3a('0xa')]+_0x2820ab[_0x8b3a('0xc')];var _0x1f357a;if(_0x30d8ab>=_0x1e5ce3){_0x30d8ab=_0x1e5ce3;_0x1f357a=0xc8;}else{_0x1f357a=0xce;}_0x20a22f['status'](_0x1f357a);return _0x20a22f[_0x8b3a('0xe')](_0x8b3a('0xf'),_0x258b00+'-'+_0x30d8ab+'/'+_0x1e5ce3)[_0x8b3a('0x9')](_0xe99a83);}return null;};}function saveUpdates(_0x5c4310){return function(_0x1ea76d){if(_0x1ea76d){return _0x1ea76d[_0x8b3a('0x10')](_0x5c4310)[_0x8b3a('0x11')](function(_0x3c0056){return _0x3c0056;});}return null;};}function removeEntity(_0x1b8eb7){return function(_0x3397bf){if(_0x3397bf){return _0x3397bf[_0x8b3a('0x12')]()[_0x8b3a('0x11')](function(){var _0x551975=_0x3397bf['get']({'plain':!![]});var _0xf54238='SquareProjects';return db[_0x8b3a('0x13')][_0x8b3a('0x12')]({'where':{'type':_0xf54238,'resourceId':_0x551975['id']}})[_0x8b3a('0x11')](function(){return _0x3397bf;});})['then'](function(){var _0x51298a=new Redis(config[_0x8b3a('0x3')]);_0x51298a[_0x8b3a('0x14')](_0x8b3a('0x15'),JSON[_0x8b3a('0x16')]({'id':_0x3397bf['id'],'deleted':!![]}));})[_0x8b3a('0x11')](function(){_0x1b8eb7[_0x8b3a('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574f27){return function(_0x175a00){if(!_0x175a00){_0x574f27[_0x8b3a('0x17')](0x194);}return _0x175a00;};}function handleError(_0x422da0,_0x3a24a3){_0x3a24a3=_0x3a24a3||0x1f4;return function(_0x3df6cf){logger['error'](_0x3df6cf['stack']);if(_0x3df6cf[_0x8b3a('0x18')]){delete _0x3df6cf[_0x8b3a('0x18')];}_0x422da0[_0x8b3a('0x8')](_0x3a24a3)[_0x8b3a('0x19')](_0x3df6cf);};}exports['index']=function(_0x20ebbb,_0x2e3ab8){var _0x21e3c1={},_0xbbc09e={},_0x29e17c={'count':0x0,'rows':[]};var _0x1ce78e=_[_0x8b3a('0x1a')](db['SquareProject'][_0x8b3a('0x1b')],function(_0x44608d){return{'name':_0x44608d['fieldName'],'type':_0x44608d[_0x8b3a('0x1c')][_0x8b3a('0x1d')]};});_0xbbc09e[_0x8b3a('0x1e')]=_[_0x8b3a('0x1a')](_0x1ce78e,_0x8b3a('0x18'));_0xbbc09e[_0x8b3a('0x1f')]=_[_0x8b3a('0x20')](_0x20ebbb[_0x8b3a('0x1f')]);_0xbbc09e['filters']=_['intersection'](_0xbbc09e[_0x8b3a('0x1e')],_0xbbc09e[_0x8b3a('0x1f')]);_0x21e3c1['attributes']=_[_0x8b3a('0x21')](_0xbbc09e[_0x8b3a('0x1e')],qs[_0x8b3a('0x22')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x22')]));_0x21e3c1[_0x8b3a('0x23')]=_0x21e3c1[_0x8b3a('0x23')][_0x8b3a('0x24')]?_0x21e3c1[_0x8b3a('0x23')]:_0xbbc09e[_0x8b3a('0x1e')];if(!_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x25')](_0x8b3a('0x26'))){_0x21e3c1['limit']=qs['limit'](_0x20ebbb['query']['limit']);_0x21e3c1[_0x8b3a('0xa')]=qs[_0x8b3a('0xa')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0xa')]);}_0x21e3c1[_0x8b3a('0x27')]=qs[_0x8b3a('0x28')](_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x28')]);_0x21e3c1[_0x8b3a('0x29')]=qs[_0x8b3a('0x2a')](_[_0x8b3a('0x2b')](_0x20ebbb[_0x8b3a('0x1f')],_0xbbc09e[_0x8b3a('0x2a')]),_0x1ce78e);if(_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x2c')]){_0x21e3c1[_0x8b3a('0x29')]=_[_0x8b3a('0x2d')](_0x21e3c1[_0x8b3a('0x29')],{'$or':_['map'](_0x1ce78e,function(_0x5e6ee1){if(_0x5e6ee1['type']!==_0x8b3a('0x2e')){var _0x52e918={};_0x52e918[_0x5e6ee1['name']]={'$like':'%'+_0x20ebbb[_0x8b3a('0x1f')]['filter']+'%'};return _0x52e918;}})});}_0x21e3c1=_[_0x8b3a('0x2d')]({},_0x21e3c1,_0x20ebbb[_0x8b3a('0x2f')]);var _0x2ccd02={'where':_0x21e3c1['where']};return db['SquareProject'][_0x8b3a('0xd')](_0x2ccd02)[_0x8b3a('0x11')](function(_0x20c0e7){_0x29e17c[_0x8b3a('0xd')]=_0x20c0e7;if(_0x20ebbb[_0x8b3a('0x1f')][_0x8b3a('0x30')]){_0x21e3c1[_0x8b3a('0x31')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x21e3c1);})[_0x8b3a('0x11')](function(_0x33c452){_0x29e17c[_0x8b3a('0x32')]=_0x33c452;return _0x29e17c;})[_0x8b3a('0x11')](respondWithFilteredResult(_0x2e3ab8,_0x21e3c1))[_0x8b3a('0x33')](handleError(_0x2e3ab8,null));};exports[_0x8b3a('0x34')]=function(_0x173da2,_0x3d8549){var _0x12bc3f={'raw':![],'where':{'id':_0x173da2[_0x8b3a('0x35')]['id']}},_0x527bfb={};_0x527bfb[_0x8b3a('0x1e')]=_[_0x8b3a('0x20')](db[_0x8b3a('0x36')]['rawAttributes']);_0x527bfb[_0x8b3a('0x1f')]=_['keys'](_0x173da2[_0x8b3a('0x1f')]);_0x527bfb[_0x8b3a('0x2a')]=_[_0x8b3a('0x21')](_0x527bfb[_0x8b3a('0x1e')],_0x527bfb[_0x8b3a('0x1f')]);_0x12bc3f[_0x8b3a('0x23')]=_[_0x8b3a('0x21')](_0x527bfb[_0x8b3a('0x1e')],qs[_0x8b3a('0x22')](_0x173da2[_0x8b3a('0x1f')][_0x8b3a('0x22')]));_0x12bc3f[_0x8b3a('0x23')]=_0x12bc3f[_0x8b3a('0x23')][_0x8b3a('0x24')]?_0x12bc3f[_0x8b3a('0x23')]:_0x527bfb[_0x8b3a('0x1e')];if(_0x173da2[_0x8b3a('0x1f')][_0x8b3a('0x30')]){_0x12bc3f['include']=[{'all':!![]}];}_0x12bc3f=_[_0x8b3a('0x2d')]({},_0x12bc3f,_0x173da2['options']);return db['SquareProject'][_0x8b3a('0x37')](_0x12bc3f)[_0x8b3a('0x11')](handleEntityNotFound(_0x3d8549,null))[_0x8b3a('0x11')](respondWithResult(_0x3d8549,null))[_0x8b3a('0x33')](handleError(_0x3d8549,null));};exports[_0x8b3a('0x38')]=function(_0x3f03b3,_0x18c7e1){return db[_0x8b3a('0x36')][_0x8b3a('0x38')](_0x3f03b3[_0x8b3a('0x39')],{})[_0x8b3a('0x11')](function(_0x2d9b4c){var _0xafa137=_0x3f03b3[_0x8b3a('0x3a')]['get']({'plain':!![]});if(!_0xafa137)throw new Error(_0x8b3a('0x3b'));if(_0xafa137['role']==='user'){var _0x1e9218=_0x2d9b4c[_0x8b3a('0x3c')]({'plain':!![]});var _0x482b80=_0x8b3a('0x3d');return db[_0x8b3a('0x3e')][_0x8b3a('0x37')]({'where':{'name':_0x482b80,'userProfileId':_0xafa137[_0x8b3a('0x3f')]},'raw':!![]})[_0x8b3a('0x11')](function(_0x3ee23a){if(_0x3ee23a&&_0x3ee23a[_0x8b3a('0x40')]===0x0){return db[_0x8b3a('0x13')][_0x8b3a('0x38')]({'name':_0x1e9218[_0x8b3a('0x18')],'resourceId':_0x1e9218['id'],'type':_0x3ee23a[_0x8b3a('0x18')],'sectionId':_0x3ee23a['id']},{})['then'](function(){return _0x2d9b4c;});}else{return _0x2d9b4c;}})[_0x8b3a('0x33')](function(_0x25d362){logger[_0x8b3a('0x41')](_0x8b3a('0x42'),_0x25d362);throw _0x25d362;});}return _0x2d9b4c;})[_0x8b3a('0x11')](respondWithResult(_0x18c7e1,0xc9))['catch'](handleError(_0x18c7e1,null));};exports[_0x8b3a('0x10')]=function(_0x1a7c93,_0x361ac5){if(_0x1a7c93[_0x8b3a('0x39')]['id']){delete _0x1a7c93[_0x8b3a('0x39')]['id'];}return db[_0x8b3a('0x36')][_0x8b3a('0x37')]({'where':{'id':_0x1a7c93['params']['id']}})['then'](handleEntityNotFound(_0x361ac5,null))[_0x8b3a('0x11')](saveUpdates(_0x1a7c93[_0x8b3a('0x39')],null))[_0x8b3a('0x11')](function(_0x555085){if(!_0x555085)return;var _0x1addf8=_0x555085[_0x8b3a('0x3c')]({'plain':!![]});return _0x1addf8;})[_0x8b3a('0x11')](function(_0x5e898d){var _0x4f8720=new Redis(config[_0x8b3a('0x3')]);_0x4f8720['publish'](_0x8b3a('0x15'),JSON[_0x8b3a('0x16')](_[_0x8b3a('0x2b')](_0x5e898d,['id',_0x8b3a('0x18'),'production'])));return _0x5e898d;})[_0x8b3a('0x11')](respondWithResult(_0x361ac5,null))[_0x8b3a('0x33')](handleError(_0x361ac5,null));};exports[_0x8b3a('0x12')]=function(_0x3a8342,_0x2f6829){return db['SquareProject'][_0x8b3a('0x37')]({'where':{'id':_0x3a8342[_0x8b3a('0x35')]['id']}})[_0x8b3a('0x11')](handleEntityNotFound(_0x2f6829,null))[_0x8b3a('0x11')](removeEntity(_0x2f6829,null))[_0x8b3a('0x33')](handleError(_0x2f6829,null));}; \ No newline at end of file +var _0x294e=['../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','SquareProjects','stringify','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','publish','agi','production','lodash','ioredis'];(function(_0x5ef496,_0x3e651a){var _0x26cd4a=function(_0x42a72a){while(--_0x42a72a){_0x5ef496['push'](_0x5ef496['shift']());}};_0x26cd4a(++_0x3e651a);}(_0x294e,0x8c));var _0xe294=function(_0x1a526b,_0x40f920){_0x1a526b=_0x1a526b-0x0;var _0x109c35=_0x294e[_0x1a526b];return _0x109c35;};'use strict';var _=require(_0xe294('0x0'));var Redis=require(_0xe294('0x1'));var qs=require(_0xe294('0x2'));var logger=require(_0xe294('0x3'))('api');var config=require(_0xe294('0x4'));var db=require(_0xe294('0x5'))['db'];config[_0xe294('0x6')]=_['defaults'](config['redis'],{'host':_0xe294('0x7'),'port':0x18eb});var socket=require(_0xe294('0x8'))(new Redis(config[_0xe294('0x6')]));require(_0xe294('0x9'))[_0xe294('0xa')](socket);function respondWithResult(_0x38739b,_0x419789){_0x419789=_0x419789||0xc8;return function(_0x56863d){if(_0x56863d){return _0x38739b[_0xe294('0xb')](_0x419789)[_0xe294('0xc')](_0x56863d);}};}function respondWithFilteredResult(_0x4bd4aa,_0x4387b2){return function(_0x13f42c){if(_0x13f42c){var _0x4eeea7=typeof _0x4387b2[_0xe294('0xd')]===_0xe294('0xe')&&typeof _0x4387b2[_0xe294('0xf')]==='undefined';var _0x42dac0=_0x13f42c[_0xe294('0x10')];var _0x55b816=_0x4eeea7?0x0:_0x4387b2[_0xe294('0xd')];var _0xd31a70=_0x4eeea7?_0x13f42c[_0xe294('0x10')]:_0x4387b2['offset']+_0x4387b2[_0xe294('0xf')];var _0x356f5e;if(_0xd31a70>=_0x42dac0){_0xd31a70=_0x42dac0;_0x356f5e=0xc8;}else{_0x356f5e=0xce;}_0x4bd4aa[_0xe294('0xb')](_0x356f5e);return _0x4bd4aa[_0xe294('0x11')](_0xe294('0x12'),_0x55b816+'-'+_0xd31a70+'/'+_0x42dac0)[_0xe294('0xc')](_0x13f42c);}return null;};}function saveUpdates(_0x272be2){return function(_0x267040){if(_0x267040){return _0x267040['update'](_0x272be2)[_0xe294('0x13')](function(_0x1f85cd){return _0x1f85cd;});}return null;};}function removeEntity(_0x158c2b){return function(_0x431c0c){if(_0x431c0c){return _0x431c0c[_0xe294('0x14')]()[_0xe294('0x13')](function(){var _0xfa1f0c=_0x431c0c[_0xe294('0x15')]({'plain':!![]});var _0x1a9d68=_0xe294('0x16');return db['UserProfileResource'][_0xe294('0x14')]({'where':{'type':_0x1a9d68,'resourceId':_0xfa1f0c['id']}})[_0xe294('0x13')](function(){return _0x431c0c;});})['then'](function(){var _0x502461=new Redis(config[_0xe294('0x6')]);_0x502461['publish']('agi',JSON[_0xe294('0x17')]({'id':_0x431c0c['id'],'deleted':!![]}));})[_0xe294('0x13')](function(){_0x158c2b[_0xe294('0xb')](0xcc)[_0xe294('0x18')]();});}};}function handleEntityNotFound(_0xe597d9){return function(_0xbd0e1a){if(!_0xbd0e1a){_0xe597d9[_0xe294('0x19')](0x194);}return _0xbd0e1a;};}function handleError(_0x32a6b3,_0x24c8b0){_0x24c8b0=_0x24c8b0||0x1f4;return function(_0x200fc7){logger[_0xe294('0x1a')](_0x200fc7[_0xe294('0x1b')]);if(_0x200fc7[_0xe294('0x1c')]){delete _0x200fc7['name'];}_0x32a6b3[_0xe294('0xb')](_0x24c8b0)[_0xe294('0x1d')](_0x200fc7);};}exports[_0xe294('0x1e')]=function(_0x154ad8,_0x9b1e33){var _0x2b35ea={},_0x583b88={},_0xc22ff9={'count':0x0,'rows':[]};var _0x3fe384=_['map'](db[_0xe294('0x1f')][_0xe294('0x20')],function(_0x4ea1a0){return{'name':_0x4ea1a0['fieldName'],'type':_0x4ea1a0[_0xe294('0x21')][_0xe294('0x22')]};});_0x583b88[_0xe294('0x23')]=_[_0xe294('0x24')](_0x3fe384,_0xe294('0x1c'));_0x583b88[_0xe294('0x25')]=_['keys'](_0x154ad8['query']);_0x583b88['filters']=_[_0xe294('0x26')](_0x583b88[_0xe294('0x23')],_0x583b88['query']);_0x2b35ea[_0xe294('0x27')]=_[_0xe294('0x26')](_0x583b88['model'],qs['fields'](_0x154ad8['query'][_0xe294('0x28')]));_0x2b35ea[_0xe294('0x27')]=_0x2b35ea[_0xe294('0x27')][_0xe294('0x29')]?_0x2b35ea[_0xe294('0x27')]:_0x583b88[_0xe294('0x23')];if(!_0x154ad8[_0xe294('0x25')][_0xe294('0x2a')](_0xe294('0x2b'))){_0x2b35ea[_0xe294('0xf')]=qs[_0xe294('0xf')](_0x154ad8[_0xe294('0x25')][_0xe294('0xf')]);_0x2b35ea[_0xe294('0xd')]=qs[_0xe294('0xd')](_0x154ad8['query']['offset']);}_0x2b35ea['order']=qs['sort'](_0x154ad8['query'][_0xe294('0x2c')]);_0x2b35ea[_0xe294('0x2d')]=qs[_0xe294('0x2e')](_[_0xe294('0x2f')](_0x154ad8['query'],_0x583b88[_0xe294('0x2e')]),_0x3fe384);if(_0x154ad8[_0xe294('0x25')][_0xe294('0x30')]){_0x2b35ea[_0xe294('0x2d')]=_[_0xe294('0x31')](_0x2b35ea[_0xe294('0x2d')],{'$or':_[_0xe294('0x24')](_0x3fe384,function(_0x2414a0){if(_0x2414a0[_0xe294('0x21')]!=='VIRTUAL'){var _0x511809={};_0x511809[_0x2414a0[_0xe294('0x1c')]]={'$like':'%'+_0x154ad8['query'][_0xe294('0x30')]+'%'};return _0x511809;}})});}_0x2b35ea=_[_0xe294('0x31')]({},_0x2b35ea,_0x154ad8[_0xe294('0x32')]);var _0xbd4124={'where':_0x2b35ea[_0xe294('0x2d')]};return db['SquareProject'][_0xe294('0x10')](_0xbd4124)[_0xe294('0x13')](function(_0x324052){_0xc22ff9['count']=_0x324052;if(_0x154ad8[_0xe294('0x25')][_0xe294('0x33')]){_0x2b35ea[_0xe294('0x34')]=[{'all':!![]}];}return db[_0xe294('0x1f')][_0xe294('0x35')](_0x2b35ea);})[_0xe294('0x13')](function(_0x78c22){_0xc22ff9[_0xe294('0x36')]=_0x78c22;return _0xc22ff9;})[_0xe294('0x13')](respondWithFilteredResult(_0x9b1e33,_0x2b35ea))['catch'](handleError(_0x9b1e33,null));};exports[_0xe294('0x37')]=function(_0x423f44,_0x5e0afb){var _0x56e1c2={'raw':![],'where':{'id':_0x423f44[_0xe294('0x38')]['id']}},_0x141e34={};_0x141e34[_0xe294('0x23')]=_['keys'](db['SquareProject'][_0xe294('0x20')]);_0x141e34[_0xe294('0x25')]=_['keys'](_0x423f44[_0xe294('0x25')]);_0x141e34[_0xe294('0x2e')]=_['intersection'](_0x141e34[_0xe294('0x23')],_0x141e34[_0xe294('0x25')]);_0x56e1c2['attributes']=_[_0xe294('0x26')](_0x141e34[_0xe294('0x23')],qs[_0xe294('0x28')](_0x423f44['query'][_0xe294('0x28')]));_0x56e1c2[_0xe294('0x27')]=_0x56e1c2[_0xe294('0x27')][_0xe294('0x29')]?_0x56e1c2[_0xe294('0x27')]:_0x141e34['model'];if(_0x423f44[_0xe294('0x25')][_0xe294('0x33')]){_0x56e1c2[_0xe294('0x34')]=[{'all':!![]}];}_0x56e1c2=_[_0xe294('0x31')]({},_0x56e1c2,_0x423f44[_0xe294('0x32')]);return db[_0xe294('0x1f')][_0xe294('0x39')](_0x56e1c2)[_0xe294('0x13')](handleEntityNotFound(_0x5e0afb,null))[_0xe294('0x13')](respondWithResult(_0x5e0afb,null))[_0xe294('0x3a')](handleError(_0x5e0afb,null));};exports[_0xe294('0x3b')]=function(_0x2d5aef,_0x524c4b){return db[_0xe294('0x1f')][_0xe294('0x3b')](_0x2d5aef[_0xe294('0x3c')],{})[_0xe294('0x13')](function(_0x445fe5){var _0xbac1d2=_0x2d5aef[_0xe294('0x3d')][_0xe294('0x15')]({'plain':!![]});if(!_0xbac1d2)throw new Error(_0xe294('0x3e'));if(_0xbac1d2[_0xe294('0x3f')]==='user'){var _0x17b973=_0x445fe5['get']({'plain':!![]});var _0x2ae7bd=_0xe294('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x2ae7bd,'userProfileId':_0xbac1d2[_0xe294('0x40')]},'raw':!![]})[_0xe294('0x13')](function(_0x483fa0){if(_0x483fa0&&_0x483fa0[_0xe294('0x41')]===0x0){return db['UserProfileResource'][_0xe294('0x3b')]({'name':_0x17b973[_0xe294('0x1c')],'resourceId':_0x17b973['id'],'type':_0x483fa0[_0xe294('0x1c')],'sectionId':_0x483fa0['id']},{})[_0xe294('0x13')](function(){return _0x445fe5;});}else{return _0x445fe5;}})[_0xe294('0x3a')](function(_0x4c6797){logger[_0xe294('0x1a')](_0xe294('0x42'),_0x4c6797);throw _0x4c6797;});}return _0x445fe5;})['then'](respondWithResult(_0x524c4b,0xc9))[_0xe294('0x3a')](handleError(_0x524c4b,null));};exports[_0xe294('0x43')]=function(_0x81c199,_0x57cf55){if(_0x81c199[_0xe294('0x3c')]['id']){delete _0x81c199[_0xe294('0x3c')]['id'];}return db[_0xe294('0x1f')][_0xe294('0x39')]({'where':{'id':_0x81c199[_0xe294('0x38')]['id']}})[_0xe294('0x13')](handleEntityNotFound(_0x57cf55,null))['then'](saveUpdates(_0x81c199[_0xe294('0x3c')],null))[_0xe294('0x13')](function(_0x3e0f0e){if(!_0x3e0f0e)return;var _0xd89344=_0x3e0f0e['get']({'plain':!![]});return _0xd89344;})[_0xe294('0x13')](function(_0x166c5d){var _0x3ca23f=new Redis(config[_0xe294('0x6')]);_0x3ca23f[_0xe294('0x44')](_0xe294('0x45'),JSON[_0xe294('0x17')](_[_0xe294('0x2f')](_0x166c5d,['id',_0xe294('0x1c'),_0xe294('0x46')])));return _0x166c5d;})[_0xe294('0x13')](respondWithResult(_0x57cf55,null))[_0xe294('0x3a')](handleError(_0x57cf55,null));};exports[_0xe294('0x14')]=function(_0x2eb108,_0x482dda){return db[_0xe294('0x1f')]['find']({'where':{'id':_0x2eb108[_0xe294('0x38')]['id']}})['then'](handleEntityNotFound(_0x482dda,null))['then'](removeEntity(_0x482dda,null))[_0xe294('0x3a')](handleError(_0x482dda,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 912197c..23faf0c 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 _0xed0d=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xed0d,0x7e));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xded0('0x0'));var SquareProject=require(_0xded0('0x1'))['db'][_0xded0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xded0('0x3')](0x0);var events={'afterCreate':_0xded0('0x4'),'afterUpdate':_0xded0('0x5'),'afterDestroy':_0xded0('0x6')};function emitEvent(_0x5c23ef){return function(_0x5ebd9d,_0x24581b,_0x553b0e){SquareProjectEvents['emit'](_0x5c23ef+':'+_0x5ebd9d['id'],_0x5ebd9d);SquareProjectEvents['emit'](_0x5c23ef,_0x5ebd9d);_0x553b0e(null);};}for(var e in events){if(events[_0xded0('0x7')](e)){var event=events[e];SquareProject[_0xded0('0x8')](e,emitEvent(event));}}module[_0xded0('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xcba3=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x38d67b,_0x324be9){var _0x2157f8=function(_0x138b65){while(--_0x138b65){_0x38d67b['push'](_0x38d67b['shift']());}};_0x2157f8(++_0x324be9);}(_0xcba3,0x9f));var _0x3cba=function(_0x532429,_0x57dc33){_0x532429=_0x532429-0x0;var _0x2248b9=_0xcba3[_0x532429];return _0x2248b9;};'use strict';var EventEmitter=require(_0x3cba('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x3cba('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3cba('0x2')](0x0);var events={'afterCreate':_0x3cba('0x3'),'afterUpdate':_0x3cba('0x4'),'afterDestroy':_0x3cba('0x5')};function emitEvent(_0x269df4){return function(_0x10b2e2,_0x18da2a,_0x432612){SquareProjectEvents[_0x3cba('0x6')](_0x269df4+':'+_0x10b2e2['id'],_0x10b2e2);SquareProjectEvents[_0x3cba('0x6')](_0x269df4,_0x10b2e2);_0x432612(null);};}for(var e in events){if(events[_0x3cba('0x7')](e)){var event=events[e];SquareProject[_0x3cba('0x8')](e,emitEvent(event));}}module[_0x3cba('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 579a53f..df701c9 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 _0xb7e8=['publishedAt','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x5e9eb2,_0x267063){var _0x3c9857=function(_0xcad365){while(--_0xcad365){_0x5e9eb2['push'](_0x5e9eb2['shift']());}};_0x3c9857(++_0x267063);}(_0xb7e8,0x155));var _0x8b7e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xb7e8[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x8b7e('0x0'));var util=require(_0x8b7e('0x1'));var logger=require(_0x8b7e('0x2'))(_0x8b7e('0x3'));var moment=require(_0x8b7e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b7e('0x5'));var fs=require('fs');var path=require(_0x8b7e('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7e('0x7'));var attributes=require('./squareProject.attributes');module[_0x8b7e('0x8')]=function(_0x3bc631,_0x436b57){return _0x3bc631[_0x8b7e('0x9')]('SquareProject',attributes,{'tableName':_0x8b7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b172,_0x4aa1a2,_0x5b00ba){if(_0x13b172[_0x8b7e('0xb')]('preproduction')){_0x13b172[_0x8b7e('0xc')]=moment()[_0x8b7e('0xd')](_0x8b7e('0xe'));}if(_0x13b172[_0x8b7e('0xb')](_0x8b7e('0xf'))){_0x13b172[_0x8b7e('0x10')]=moment()['format'](_0x8b7e('0xe'));}_0x5b00ba(null,_0x13b172);}}});}; \ No newline at end of file +var _0x6775=['format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareProject','square_projects','preproduction','savedAt'];(function(_0x4dd06e,_0x2ffaa5){var _0x185479=function(_0x3aa3e9){while(--_0x3aa3e9){_0x4dd06e['push'](_0x4dd06e['shift']());}};_0x185479(++_0x2ffaa5);}(_0x6775,0x134));var _0x5677=function(_0x3c7cbf,_0x176613){_0x3c7cbf=_0x3c7cbf-0x0;var _0x4a383f=_0x6775[_0x3c7cbf];return _0x4a383f;};'use strict';var _=require(_0x5677('0x0'));var util=require(_0x5677('0x1'));var logger=require(_0x5677('0x2'))(_0x5677('0x3'));var moment=require(_0x5677('0x4'));var BPromise=require(_0x5677('0x5'));var rp=require(_0x5677('0x6'));var fs=require('fs');var path=require(_0x5677('0x7'));var rimraf=require('rimraf');var config=require(_0x5677('0x8'));var attributes=require('./squareProject.attributes');module[_0x5677('0x9')]=function(_0x128c01,_0x60de23){return _0x128c01[_0x5677('0xa')](_0x5677('0xb'),attributes,{'tableName':_0x5677('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18c230,_0x436b6a,_0xb9911){if(_0x18c230['changed'](_0x5677('0xd'))){_0x18c230[_0x5677('0xe')]=moment()[_0x5677('0xf')](_0x5677('0x10'));}if(_0x18c230[_0x5677('0x11')]('production')){_0x18c230[_0x5677('0x12')]=moment()[_0x5677('0xf')](_0x5677('0x10'));}_0xb9911(null,_0x18c230);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 60cfd21..fb978ed 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 _0xae26=['GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','SquareProject','options','where','attributes','limit','include','model','map','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae26,0xe8));var _0x6ae2=function(_0x40ea18,_0x1b4b71){_0x40ea18=_0x40ea18-0x0;var _0x23af1a=_0xae26[_0x40ea18];return _0x23af1a;};'use strict';var _=require(_0x6ae2('0x0'));var Redis=require(_0x6ae2('0x1'));var db=require(_0x6ae2('0x2'))['db'];var logger=require(_0x6ae2('0x3'))(_0x6ae2('0x4'));var config=require(_0x6ae2('0x5'));config['redis']=_[_0x6ae2('0x6')](config[_0x6ae2('0x7')],{'host':_0x6ae2('0x8'),'port':0x18eb});var socket=require(_0x6ae2('0x9'))(new Redis(config[_0x6ae2('0x7')]));require('./squareProject.socket')[_0x6ae2('0xa')](socket);exports['GetSquareProjects']=function(_0xa6d87e){var _0x17f904=this;return new Promise(function(_0x19f895,_0x1b82fa){return db[_0x6ae2('0xb')]['findAll']({'raw':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xd')]||null:null,'attributes':_0xa6d87e['options']?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xe')]||null:null,'limit':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0xf')]||null:null,'include':_0xa6d87e[_0x6ae2('0xc')]?_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0x10')]?_['map'](_0xa6d87e[_0x6ae2('0xc')][_0x6ae2('0x10')],function(_0x426b5d){return{'model':db[_0x426b5d[_0x6ae2('0x11')]],'as':_0x426b5d['as'],'attributes':_0x426b5d['attributes'],'include':_0x426b5d[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x426b5d[_0x6ae2('0x10')],function(_0x5255fc){return{'model':db[_0x5255fc[_0x6ae2('0x11')]],'as':_0x5255fc['as'],'attributes':_0x5255fc[_0x6ae2('0xe')],'include':_0x5255fc[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x5255fc[_0x6ae2('0x10')],function(_0x73004f){return{'model':db[_0x73004f[_0x6ae2('0x11')]],'as':_0x73004f['as'],'attributes':_0x73004f[_0x6ae2('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f0fb5){logger[_0x6ae2('0x13')](_0x6ae2('0x14'),_0xa6d87e);logger[_0x6ae2('0x15')](_0x6ae2('0x14'),_0xa6d87e,JSON[_0x6ae2('0x16')](_0x1f0fb5));_0x19f895(_0x1f0fb5);})[_0x6ae2('0x17')](function(_0xe1d0e7){logger[_0x6ae2('0x18')]('GetSquareProjects',_0xe1d0e7[_0x6ae2('0x19')],_0xa6d87e);_0x1b82fa(_0x17f904[_0x6ae2('0x18')](0x1f4,_0xe1d0e7['message']));});});};exports[_0x6ae2('0x1a')]=function(_0x39402b){var _0x4619c2=this;return new Promise(function(_0x4b88f1,_0x4234c3){return db[_0x6ae2('0xb')]['find']({'raw':_0x39402b[_0x6ae2('0xc')]?_0x39402b['options'][_0x6ae2('0x1b')]===undefined?!![]:![]:!![],'where':_0x39402b[_0x6ae2('0xc')]?_0x39402b[_0x6ae2('0xc')]['where']||null:null,'attributes':_0x39402b[_0x6ae2('0xc')]?_0x39402b[_0x6ae2('0xc')][_0x6ae2('0xe')]||null:null,'include':_0x39402b['options']?_0x39402b[_0x6ae2('0xc')][_0x6ae2('0x10')]?_['map'](_0x39402b[_0x6ae2('0xc')][_0x6ae2('0x10')],function(_0x1396ae){return{'model':db[_0x1396ae[_0x6ae2('0x11')]],'as':_0x1396ae['as'],'attributes':_0x1396ae[_0x6ae2('0xe')],'include':_0x1396ae['include']?_[_0x6ae2('0x12')](_0x1396ae[_0x6ae2('0x10')],function(_0x4d1ec7){return{'model':db[_0x4d1ec7[_0x6ae2('0x11')]],'as':_0x4d1ec7['as'],'attributes':_0x4d1ec7['attributes'],'include':_0x4d1ec7[_0x6ae2('0x10')]?_[_0x6ae2('0x12')](_0x4d1ec7[_0x6ae2('0x10')],function(_0x164248){return{'model':db[_0x164248['model']],'as':_0x164248['as'],'attributes':_0x164248[_0x6ae2('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e191e){logger['info']('ShowSquareProject',_0x39402b);logger[_0x6ae2('0x15')]('ShowSquareProject',_0x39402b,JSON[_0x6ae2('0x16')](_0x3e191e));_0x4b88f1(_0x3e191e);})[_0x6ae2('0x17')](function(_0x112f0b){logger['error']('ShowSquareProject',_0x112f0b[_0x6ae2('0x19')],_0x39402b);_0x4234c3(_0x4619c2[_0x6ae2('0x18')](0x1f4,_0x112f0b[_0x6ae2('0x19')]));});});}; \ No newline at end of file +var _0x2aa7=['model','then','info','debug','catch','message','error','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x2aa7,0x183));var _0x72aa=function(_0x33dfa8,_0x4eb460){_0x33dfa8=_0x33dfa8-0x0;var _0x43c193=_0x2aa7[_0x33dfa8];return _0x43c193;};'use strict';var _=require(_0x72aa('0x0'));var Redis=require(_0x72aa('0x1'));var db=require(_0x72aa('0x2'))['db'];var logger=require(_0x72aa('0x3'))('rpc');var config=require(_0x72aa('0x4'));config[_0x72aa('0x5')]=_['defaults'](config[_0x72aa('0x5')],{'host':_0x72aa('0x6'),'port':0x18eb});var socket=require(_0x72aa('0x7'))(new Redis(config[_0x72aa('0x5')]));require('./squareProject.socket')[_0x72aa('0x8')](socket);exports[_0x72aa('0x9')]=function(_0x3f2735){var _0x1994c5=this;return new Promise(function(_0x8b79ed,_0x3cafdd){return db[_0x72aa('0xa')][_0x72aa('0xb')]({'raw':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xd')]===undefined?!![]:![]:!![],'where':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xe')]||null:null,'attributes':_0x3f2735['options']?_0x3f2735[_0x72aa('0xc')][_0x72aa('0xf')]||null:null,'limit':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0x10')]||null:null,'include':_0x3f2735[_0x72aa('0xc')]?_0x3f2735[_0x72aa('0xc')][_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x3f2735['options']['include'],function(_0xc9a2c8){return{'model':db[_0xc9a2c8[_0x72aa('0x13')]],'as':_0xc9a2c8['as'],'attributes':_0xc9a2c8['attributes'],'include':_0xc9a2c8[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0xc9a2c8[_0x72aa('0x11')],function(_0x13469b){return{'model':db[_0x13469b[_0x72aa('0x13')]],'as':_0x13469b['as'],'attributes':_0x13469b['attributes'],'include':_0x13469b[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x13469b[_0x72aa('0x11')],function(_0x359e23){return{'model':db[_0x359e23[_0x72aa('0x13')]],'as':_0x359e23['as'],'attributes':_0x359e23[_0x72aa('0xf')]};}):[]};}):[]};}):[]:[]})[_0x72aa('0x14')](function(_0x51b481){logger[_0x72aa('0x15')](_0x72aa('0x9'),_0x3f2735);logger[_0x72aa('0x16')](_0x72aa('0x9'),_0x3f2735,JSON['stringify'](_0x51b481));_0x8b79ed(_0x51b481);})[_0x72aa('0x17')](function(_0x41d240){logger['error'](_0x72aa('0x9'),_0x41d240[_0x72aa('0x18')],_0x3f2735);_0x3cafdd(_0x1994c5[_0x72aa('0x19')](0x1f4,_0x41d240[_0x72aa('0x18')]));});});};exports[_0x72aa('0x1a')]=function(_0x35ca70){var _0x116abb=this;return new Promise(function(_0x3a4d26,_0x22e4ea){return db[_0x72aa('0xa')][_0x72aa('0x1b')]({'raw':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')][_0x72aa('0xd')]===undefined?!![]:![]:!![],'where':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')]['where']||null:null,'attributes':_0x35ca70[_0x72aa('0xc')]?_0x35ca70['options'][_0x72aa('0xf')]||null:null,'include':_0x35ca70['options']?_0x35ca70[_0x72aa('0xc')][_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x35ca70['options'][_0x72aa('0x11')],function(_0x532abc){return{'model':db[_0x532abc[_0x72aa('0x13')]],'as':_0x532abc['as'],'attributes':_0x532abc[_0x72aa('0xf')],'include':_0x532abc[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x532abc['include'],function(_0x1dc710){return{'model':db[_0x1dc710['model']],'as':_0x1dc710['as'],'attributes':_0x1dc710[_0x72aa('0xf')],'include':_0x1dc710[_0x72aa('0x11')]?_[_0x72aa('0x12')](_0x1dc710[_0x72aa('0x11')],function(_0x3e5724){return{'model':db[_0x3e5724['model']],'as':_0x3e5724['as'],'attributes':_0x3e5724['attributes']};}):[]};}):[]};}):[]:[]})[_0x72aa('0x14')](function(_0x4fd445){logger[_0x72aa('0x15')](_0x72aa('0x1a'),_0x35ca70);logger['debug'](_0x72aa('0x1a'),_0x35ca70,JSON[_0x72aa('0x1c')](_0x4fd445));_0x3a4d26(_0x4fd445);})[_0x72aa('0x17')](function(_0x407f76){logger['error'](_0x72aa('0x1a'),_0x407f76[_0x72aa('0x18')],_0x35ca70);_0x22e4ea(_0x116abb[_0x72aa('0x19')](0x1f4,_0x407f76[_0x72aa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index db65801..e60b155 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 _0x1ebd=['update','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x129321,_0x3b4aaf){var _0x59ee6d=function(_0x57fbb4){while(--_0x57fbb4){_0x129321['push'](_0x129321['shift']());}};_0x59ee6d(++_0x3b4aaf);}(_0x1ebd,0x1a5));var _0xd1eb=function(_0x5c5793,_0x1290c0){_0x5c5793=_0x5c5793-0x0;var _0x5c1caa=_0x1ebd[_0x5c5793];return _0x5c1caa;};'use strict';var SquareProjectEvents=require(_0xd1eb('0x0'));var events=[_0xd1eb('0x1'),_0xd1eb('0x2'),_0xd1eb('0x3')];function createListener(_0x249181,_0x4f84e5){return function(_0x23e7a4){_0x4f84e5['emit'](_0x249181,_0x23e7a4);};}function removeListener(_0x5a8901,_0x4c1ea3){return function(){SquareProjectEvents[_0xd1eb('0x4')](_0x5a8901,_0x4c1ea3);};}exports[_0xd1eb('0x5')]=function(_0x4a7311){for(var _0x21cf33=0x0,_0x925b3f=events[_0xd1eb('0x6')];_0x21cf33<_0x925b3f;_0x21cf33++){var _0x3e4ae9=events[_0x21cf33];var _0x36126d=createListener(_0xd1eb('0x7')+_0x3e4ae9,_0x4a7311);SquareProjectEvents['on'](_0x3e4ae9,_0x36126d);}}; \ No newline at end of file +var _0xb409=['./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb409,0x90));var _0x9b40=function(_0x2bd602,_0x2bdd18){_0x2bd602=_0x2bd602-0x0;var _0x32fac9=_0xb409[_0x2bd602];return _0x32fac9;};'use strict';var SquareProjectEvents=require(_0x9b40('0x0'));var events=[_0x9b40('0x1'),_0x9b40('0x2'),_0x9b40('0x3')];function createListener(_0xaaf8ed,_0x370163){return function(_0x5ce079){_0x370163[_0x9b40('0x4')](_0xaaf8ed,_0x5ce079);};}function removeListener(_0x8299b,_0xee5c4d){return function(){SquareProjectEvents[_0x9b40('0x5')](_0x8299b,_0xee5c4d);};}exports[_0x9b40('0x6')]=function(_0x3c11db){for(var _0x53a53a=0x0,_0x468acd=events[_0x9b40('0x7')];_0x53a53a<_0x468acd;_0x53a53a++){var _0x340ae7=events[_0x53a53a];var _0x4d404c=createListener('squareProject:'+_0x340ae7,_0x3c11db);SquareProjectEvents['on'](_0x340ae7,_0x4d404c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a58f787..fad0662 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x4ce31b,_0x16f87f){var _0x8fa278=function(_0x2d019d){while(--_0x2d019d){_0x4ce31b['push'](_0x4ce31b['shift']());}};_0x8fa278(++_0x16f87f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'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['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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x3e3e50,_0x39e28c){var _0x5eb609=function(_0x22d896){while(--_0x22d896){_0x3e3e50['push'](_0x3e3e50['shift']());}};_0x5eb609(++_0x39e28c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x243314,_0x813807){_0x243314=_0x243314-0x0;var _0x2d73c6=_0x1cb9[_0x243314];return _0x2d73c6;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index e341920..86a923e 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 _0x1cb9=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x32ee6a,_0x37200b){var _0x36f59e=function(_0x478fed){while(--_0x478fed){_0x32ee6a['push'](_0x32ee6a['shift']());}};_0x36f59e(++_0x37200b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x78c2a3,_0x276927){_0x78c2a3=_0x78c2a3-0x0;var _0x990f71=_0x1cb9[_0x78c2a3];return _0x990f71;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'callerid':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x91cb('0x1')]},'saveName':{'type':Sequelize[_0x91cb('0x1')]},'filename':{'type':Sequelize[_0x91cb('0x1')]},'savePath':{'type':Sequelize[_0x91cb('0x1')]},'format':{'type':Sequelize[_0x91cb('0x2')],'get':function(){var _0x8f8a3b='';var _0x4c1f56=this[_0x91cb('0x3')]('savePath');if(_0x4c1f56){_0x8f8a3b=_0x4c1f56[_0x91cb('0x4')](_0x4c1f56['lastIndexOf']('.'));}return _0x8f8a3b;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x4360e3,_0x532f20){var _0x4003fc=function(_0x26454b){while(--_0x26454b){_0x4360e3['push'](_0x4360e3['shift']());}};_0x4003fc(++_0x532f20);}(_0x5fd1,0x155));var _0x15fd=function(_0x6bbb11,_0x44e6b5){_0x6bbb11=_0x6bbb11-0x0;var _0x4c4dc3=_0x5fd1[_0x6bbb11];return _0x4c4dc3;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 183bad4..afeede1 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 _0xbce5=['decryptFile','recording','existsSync','SquareRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','SquareRecording','type','model','map','query','intersection','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','length','find','create','body','download','uniqueid','savePath'];(function(_0x49c5a2,_0x4b170c){var _0x450efa=function(_0x94bdea){while(--_0x94bdea){_0x49c5a2['push'](_0x49c5a2['shift']());}};_0x450efa(++_0x4b170c);}(_0xbce5,0x116));var _0x5bce=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xbce5[_0x1306f3];return _0xc1c7bf;};'use strict';var emlformat=require(_0x5bce('0x0'));var rimraf=require(_0x5bce('0x1'));var zipdir=require(_0x5bce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5bce('0x4'));var util=require(_0x5bce('0x5'));var path=require(_0x5bce('0x6'));var sox=require(_0x5bce('0x7'));var csv=require('to-csv');var ejs=require(_0x5bce('0x8'));var fs=require('fs');var fs_extra=require(_0x5bce('0x9'));var _=require(_0x5bce('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5bce('0xb'));var deskjs=require(_0x5bce('0xc'));var toCsv=require(_0x5bce('0xd'));var querystring=require('querystring');var Papa=require(_0x5bce('0xe'));var Redis=require(_0x5bce('0xf'));var authService=require(_0x5bce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5bce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5bce('0x12'));var config=require(_0x5bce('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414ef4,_0x21896e){_0x21896e=_0x21896e||0xcc;return function(_0x54eebb){if(_0x54eebb){return _0x414ef4[_0x5bce('0x14')](_0x21896e);}return _0x414ef4[_0x5bce('0x15')](_0x21896e)[_0x5bce('0x16')]();};}function respondWithResult(_0x1f48ea,_0x3ed510){_0x3ed510=_0x3ed510||0xc8;return function(_0x516086){if(_0x516086){return _0x1f48ea[_0x5bce('0x15')](_0x3ed510)['json'](_0x516086);}};}function respondWithFilteredResult(_0x31bee8,_0x1cfc4d){return function(_0x1bb14a){if(_0x1bb14a){var _0x581de4=typeof _0x1cfc4d[_0x5bce('0x17')]===_0x5bce('0x18')&&typeof _0x1cfc4d[_0x5bce('0x19')]===_0x5bce('0x18');var _0x329180=_0x1bb14a[_0x5bce('0x1a')];var _0x590104=_0x581de4?0x0:_0x1cfc4d[_0x5bce('0x17')];var _0x3498ca=_0x581de4?_0x1bb14a['count']:_0x1cfc4d[_0x5bce('0x17')]+_0x1cfc4d[_0x5bce('0x19')];var _0xa74a62;if(_0x3498ca>=_0x329180){_0x3498ca=_0x329180;_0xa74a62=0xc8;}else{_0xa74a62=0xce;}_0x31bee8[_0x5bce('0x15')](_0xa74a62);return _0x31bee8['set'](_0x5bce('0x1b'),_0x590104+'-'+_0x3498ca+'/'+_0x329180)[_0x5bce('0x1c')](_0x1bb14a);}return null;};}function patchUpdates(_0x3a0397){return function(_0xb5202f){try{jsonpatch[_0x5bce('0x1d')](_0xb5202f,_0x3a0397,!![]);}catch(_0x58d9ab){return BPromise[_0x5bce('0x1e')](_0x58d9ab);}return _0xb5202f[_0x5bce('0x1f')]();};}function saveUpdates(_0x50099d,_0x705c29){return function(_0x458dac){if(_0x458dac){return _0x458dac[_0x5bce('0x20')](_0x50099d)[_0x5bce('0x21')](function(_0x24b697){return _0x24b697;});}return null;};}function removeEntity(_0x17b160,_0x588460){return function(_0x526fd1){if(_0x526fd1){return _0x526fd1[_0x5bce('0x22')]()[_0x5bce('0x21')](function(){_0x17b160['status'](0xcc)[_0x5bce('0x16')]();});}};}function handleEntityNotFound(_0x46e6df,_0x5a6eae){return function(_0x5641a2){if(!_0x5641a2){_0x46e6df[_0x5bce('0x14')](0x194);}return _0x5641a2;};}function handleError(_0xd3b6d4,_0x225b64){_0x225b64=_0x225b64||0x1f4;return function(_0x519f91){logger[_0x5bce('0x23')](_0x519f91[_0x5bce('0x24')]);if(_0x519f91[_0x5bce('0x25')]){delete _0x519f91[_0x5bce('0x25')];}_0xd3b6d4['status'](_0x225b64)['send'](_0x519f91);};}exports['index']=function(_0x42987f,_0x3c9a40){var _0x422538={},_0x52a860={},_0x5b8c99={'count':0x0,'rows':[]};var _0x540f5a=_['map'](db[_0x5bce('0x26')]['rawAttributes'],function(_0x2027eb){return{'name':_0x2027eb['fieldName'],'type':_0x2027eb[_0x5bce('0x27')]['key']};});_0x52a860[_0x5bce('0x28')]=_[_0x5bce('0x29')](_0x540f5a,_0x5bce('0x25'));_0x52a860[_0x5bce('0x2a')]=_['keys'](_0x42987f[_0x5bce('0x2a')]);_0x52a860['filters']=_[_0x5bce('0x2b')](_0x52a860['model'],_0x52a860[_0x5bce('0x2a')]);_0x422538['attributes']=_[_0x5bce('0x2b')](_0x52a860[_0x5bce('0x28')],qs['fields'](_0x42987f[_0x5bce('0x2a')]['fields']));_0x422538[_0x5bce('0x2c')]=_0x422538['attributes']['length']?_0x422538[_0x5bce('0x2c')]:_0x52a860['model'];if(!_0x42987f[_0x5bce('0x2a')]['hasOwnProperty'](_0x5bce('0x2d'))){_0x422538[_0x5bce('0x19')]=qs[_0x5bce('0x19')](_0x42987f['query'][_0x5bce('0x19')]);_0x422538[_0x5bce('0x17')]=qs[_0x5bce('0x17')](_0x42987f[_0x5bce('0x2a')][_0x5bce('0x17')]);}_0x422538[_0x5bce('0x2e')]=qs[_0x5bce('0x2f')](_0x42987f[_0x5bce('0x2a')][_0x5bce('0x2f')]);_0x422538[_0x5bce('0x30')]=qs[_0x5bce('0x31')](_[_0x5bce('0x32')](_0x42987f[_0x5bce('0x2a')],_0x52a860['filters']),_0x540f5a);if(_0x42987f[_0x5bce('0x2a')]['filter']){_0x422538[_0x5bce('0x30')]=_[_0x5bce('0x33')](_0x422538[_0x5bce('0x30')],{'$or':_['map'](_0x540f5a,function(_0xcd50df){if(_0xcd50df[_0x5bce('0x27')]!==_0x5bce('0x34')){var _0x31b8b2={};_0x31b8b2[_0xcd50df[_0x5bce('0x25')]]={'$like':'%'+_0x42987f[_0x5bce('0x2a')][_0x5bce('0x35')]+'%'};return _0x31b8b2;}})});}_0x422538=_['merge']({},_0x422538,_0x42987f[_0x5bce('0x36')]);var _0x57470c={'where':_0x422538[_0x5bce('0x30')]};return db['SquareRecording'][_0x5bce('0x1a')](_0x57470c)[_0x5bce('0x21')](function(_0x1702a2){_0x5b8c99[_0x5bce('0x1a')]=_0x1702a2;if(_0x42987f[_0x5bce('0x2a')][_0x5bce('0x37')]){_0x422538['include']=[{'all':!![]}];}return db[_0x5bce('0x26')][_0x5bce('0x38')](_0x422538);})[_0x5bce('0x21')](function(_0x52e078){_0x5b8c99[_0x5bce('0x39')]=_0x52e078;return _0x5b8c99;})['then'](respondWithFilteredResult(_0x3c9a40,_0x422538))[_0x5bce('0x3a')](handleError(_0x3c9a40,null));};exports['show']=function(_0xfec4c6,_0x21442c){var _0x34437a={'raw':!![],'where':{'id':_0xfec4c6[_0x5bce('0x3b')]['id']}},_0x59c2d3={};_0x59c2d3['model']=_[_0x5bce('0x3c')](db[_0x5bce('0x26')][_0x5bce('0x3d')]);_0x59c2d3[_0x5bce('0x2a')]=_[_0x5bce('0x3c')](_0xfec4c6[_0x5bce('0x2a')]);_0x59c2d3['filters']=_[_0x5bce('0x2b')](_0x59c2d3[_0x5bce('0x28')],_0x59c2d3[_0x5bce('0x2a')]);_0x34437a[_0x5bce('0x2c')]=_[_0x5bce('0x2b')](_0x59c2d3[_0x5bce('0x28')],qs[_0x5bce('0x3e')](_0xfec4c6[_0x5bce('0x2a')][_0x5bce('0x3e')]));_0x34437a[_0x5bce('0x2c')]=_0x34437a['attributes'][_0x5bce('0x3f')]?_0x34437a['attributes']:_0x59c2d3[_0x5bce('0x28')];if(_0xfec4c6['query']['includeAll']){_0x34437a['include']=[{'all':!![]}];}_0x34437a=_['merge']({},_0x34437a,_0xfec4c6[_0x5bce('0x36')]);return db[_0x5bce('0x26')][_0x5bce('0x40')](_0x34437a)['then'](handleEntityNotFound(_0x21442c,null))['then'](respondWithResult(_0x21442c,null))[_0x5bce('0x3a')](handleError(_0x21442c,null));};exports[_0x5bce('0x41')]=function(_0xda69e7,_0x1ac760){return db[_0x5bce('0x26')][_0x5bce('0x41')](_0xda69e7[_0x5bce('0x42')],{})[_0x5bce('0x21')](respondWithResult(_0x1ac760,0xc9))[_0x5bce('0x3a')](handleError(_0x1ac760,null));};exports[_0x5bce('0x20')]=function(_0x2f7fb7,_0x2e9e9f){if(_0x2f7fb7['body']['id']){delete _0x2f7fb7[_0x5bce('0x42')]['id'];}return db[_0x5bce('0x26')]['find']({'where':{'id':_0x2f7fb7[_0x5bce('0x3b')]['id']}})[_0x5bce('0x21')](handleEntityNotFound(_0x2e9e9f,null))[_0x5bce('0x21')](saveUpdates(_0x2f7fb7['body'],null))[_0x5bce('0x21')](respondWithResult(_0x2e9e9f,null))[_0x5bce('0x3a')](handleError(_0x2e9e9f,null));};exports[_0x5bce('0x43')]=function(_0x411f2f,_0x517e39,_0x547e21){var _0xbcc340=require('../../components/encryptor');var _0xecf90b=![];var _0x2c9d4f={};if(_0x411f2f['query'][_0x5bce('0x27')]&&_0x411f2f[_0x5bce('0x2a')]['type']==='uniqueid'){_0x2c9d4f[_0x5bce('0x44')]=_0x411f2f['params']['id'];}else{_0x2c9d4f['id']=_0x411f2f[_0x5bce('0x3b')]['id'];}return db[_0x5bce('0x26')]['find']({'where':_0x2c9d4f,'attributes':['id',_0x5bce('0x45'),'filename'],'raw':!![]})[_0x5bce('0x21')](handleEntityNotFound(_0x517e39,null))[_0x5bce('0x21')](function(_0x3fd4d1){if(_0x3fd4d1){var _0x31ca88=_0x3fd4d1[_0x5bce('0x45')];var _0x4dab52=util['format']('%s.cypher',_0x31ca88);if(fs['existsSync'](_0x4dab52)){_0xecf90b=!![];return _0xbcc340[_0x5bce('0x46')](_0x4dab52,_0x31ca88,config['secrets'][_0x5bce('0x47')])['then'](function(){return _0x3fd4d1;});}return _0x3fd4d1;}})[_0x5bce('0x21')](function(_0x585d6b){if(_0x585d6b){var _0x4e285b=_0x585d6b[_0x5bce('0x45')];if(!fs[_0x5bce('0x48')](_0x4e285b)){throw new db['Sequelize']['ValidationError'](_0x5bce('0x49'));}if(_0x585d6b[_0x5bce('0x4a')]){return _0x517e39['download'](_0x4e285b,_0x585d6b[_0x5bce('0x4a')]+path[_0x5bce('0x4b')](_0x4e285b),function(){if(_0xecf90b){fs[_0x5bce('0x4c')](_0x4e285b);}});}else{return _0x517e39[_0x5bce('0x43')](_0x4e285b,function(_0x3c16fc){if(_0xecf90b){fs[_0x5bce('0x4c')](_0x4e285b);}});}}})['catch'](function(_0x43ed7d){if(_0x43ed7d[_0x5bce('0x4d')]===_0x5bce('0x49')){_0x517e39['status'](0x194)[_0x5bce('0x4e')](_0x5bce('0x4f'));}else{return handleError(_0x517e39,null);}});};exports['destroy']=function(_0xde15db,_0x337a85){return db['SquareRecording'][_0x5bce('0x40')]({'where':{'id':_0xde15db[_0x5bce('0x3b')]['id']}})['then'](function(_0x3c7679){if(_[_0x5bce('0x50')](_0x3c7679)){throw new ReferenceError(_0x5bce('0x51'));}return _0x3c7679;})[_0x5bce('0x21')](function(_0x3a10ad){var _0xbe8ecd=_0x3a10ad[_0x5bce('0x45')];logger[_0x5bce('0x52')](_0x5bce('0x53'),_0xbe8ecd);if(!_[_0x5bce('0x50')](_0x3a10ad[_0x5bce('0x45')])&&fs[_0x5bce('0x48')](_0xbe8ecd)){logger[_0x5bce('0x52')]('File:\x20\x22'+_0xbe8ecd+_0x5bce('0x54'));fs['unlinkSync'](_0xbe8ecd);}_0xbe8ecd=_0xbe8ecd+'.cypher';if(!_[_0x5bce('0x50')](_0x3a10ad[_0x5bce('0x45')])&&fs['existsSync'](_0xbe8ecd)){logger[_0x5bce('0x52')](_0x5bce('0x55')+_0xbe8ecd+_0x5bce('0x54'));fs[_0x5bce('0x56')](_0xbe8ecd);}return _0x3a10ad;})[_0x5bce('0x21')](function(_0x44ceb6){if(!_0x44ceb6)throw new InternalError();return _0x44ceb6[_0x5bce('0x22')]();})[_0x5bce('0x21')](function(){_0x337a85['status'](0xcc)[_0x5bce('0x16')]();})[_0x5bce('0x3a')](handleError(_0x337a85,null));}; \ No newline at end of file +var _0x2a34=['params','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','update'];(function(_0x24a060,_0x16bb4f){var _0x35b266=function(_0x4e8695){while(--_0x4e8695){_0x24a060['push'](_0x24a060['shift']());}};_0x35b266(++_0x16bb4f);}(_0x2a34,0xd1));var _0x42a3=function(_0x20595d,_0x26e37a){_0x20595d=_0x20595d-0x0;var _0x512876=_0x2a34[_0x20595d];return _0x512876;};'use strict';var emlformat=require(_0x42a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42a3('0x1'));var jsonpatch=require(_0x42a3('0x2'));var rp=require(_0x42a3('0x3'));var moment=require(_0x42a3('0x4'));var BPromise=require(_0x42a3('0x5'));var Mustache=require(_0x42a3('0x6'));var util=require(_0x42a3('0x7'));var path=require(_0x42a3('0x8'));var sox=require(_0x42a3('0x9'));var csv=require(_0x42a3('0xa'));var ejs=require(_0x42a3('0xb'));var fs=require('fs');var fs_extra=require(_0x42a3('0xc'));var _=require('lodash');var squel=require(_0x42a3('0xd'));var crypto=require(_0x42a3('0xe'));var jsforce=require(_0x42a3('0xf'));var deskjs=require(_0x42a3('0x10'));var toCsv=require(_0x42a3('0xa'));var querystring=require(_0x42a3('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x42a3('0x12'));var hardwareService=require(_0x42a3('0x13'));var logger=require('../../config/logger')(_0x42a3('0x14'));var utils=require('../../config/utils');var config=require(_0x42a3('0x15'));var licenseUtil=require(_0x42a3('0x16'));var db=require(_0x42a3('0x17'))['db'];function respondWithStatusCode(_0x574a4e,_0x2863d2){_0x2863d2=_0x2863d2||0xcc;return function(_0x36f3b7){if(_0x36f3b7){return _0x574a4e['sendStatus'](_0x2863d2);}return _0x574a4e[_0x42a3('0x18')](_0x2863d2)[_0x42a3('0x19')]();};}function respondWithResult(_0x42750b,_0x42b430){_0x42b430=_0x42b430||0xc8;return function(_0x295e4d){if(_0x295e4d){return _0x42750b[_0x42a3('0x18')](_0x42b430)[_0x42a3('0x1a')](_0x295e4d);}};}function respondWithFilteredResult(_0x3eaef1,_0x4c9387){return function(_0xa71030){if(_0xa71030){var _0x3c3ca4=typeof _0x4c9387['offset']==='undefined'&&typeof _0x4c9387[_0x42a3('0x1b')]===_0x42a3('0x1c');var _0xb67187=_0xa71030[_0x42a3('0x1d')];var _0x254a1b=_0x3c3ca4?0x0:_0x4c9387[_0x42a3('0x1e')];var _0x2e5c34=_0x3c3ca4?_0xa71030[_0x42a3('0x1d')]:_0x4c9387['offset']+_0x4c9387['limit'];var _0x1f01a9;if(_0x2e5c34>=_0xb67187){_0x2e5c34=_0xb67187;_0x1f01a9=0xc8;}else{_0x1f01a9=0xce;}_0x3eaef1[_0x42a3('0x18')](_0x1f01a9);return _0x3eaef1[_0x42a3('0x1f')](_0x42a3('0x20'),_0x254a1b+'-'+_0x2e5c34+'/'+_0xb67187)[_0x42a3('0x1a')](_0xa71030);}return null;};}function patchUpdates(_0x11dfeb){return function(_0x19a901){try{jsonpatch[_0x42a3('0x21')](_0x19a901,_0x11dfeb,!![]);}catch(_0x22cdc0){return BPromise[_0x42a3('0x22')](_0x22cdc0);}return _0x19a901['save']();};}function saveUpdates(_0x5aa4c5,_0x5a3849){return function(_0x416892){if(_0x416892){return _0x416892['update'](_0x5aa4c5)[_0x42a3('0x23')](function(_0x5474b8){return _0x5474b8;});}return null;};}function removeEntity(_0x5da9b1,_0x1cb4a4){return function(_0x482fdb){if(_0x482fdb){return _0x482fdb[_0x42a3('0x24')]()[_0x42a3('0x23')](function(){_0x5da9b1['status'](0xcc)[_0x42a3('0x19')]();});}};}function handleEntityNotFound(_0x51537d,_0x1bd05c){return function(_0x1b6547){if(!_0x1b6547){_0x51537d[_0x42a3('0x25')](0x194);}return _0x1b6547;};}function handleError(_0x1839f0,_0x3bd168){_0x3bd168=_0x3bd168||0x1f4;return function(_0x3b8c1f){logger['error'](_0x3b8c1f[_0x42a3('0x26')]);if(_0x3b8c1f[_0x42a3('0x27')]){delete _0x3b8c1f[_0x42a3('0x27')];}_0x1839f0[_0x42a3('0x18')](_0x3bd168)[_0x42a3('0x28')](_0x3b8c1f);};}exports[_0x42a3('0x29')]=function(_0x5eea51,_0x1babfd){var _0x4ccda8={},_0x5d8cb0={},_0x43e3e0={'count':0x0,'rows':[]};var _0x3382a9=_['map'](db[_0x42a3('0x2a')][_0x42a3('0x2b')],function(_0x242c32){return{'name':_0x242c32[_0x42a3('0x2c')],'type':_0x242c32[_0x42a3('0x2d')][_0x42a3('0x2e')]};});_0x5d8cb0[_0x42a3('0x2f')]=_[_0x42a3('0x30')](_0x3382a9,_0x42a3('0x27'));_0x5d8cb0['query']=_[_0x42a3('0x31')](_0x5eea51[_0x42a3('0x32')]);_0x5d8cb0[_0x42a3('0x33')]=_[_0x42a3('0x34')](_0x5d8cb0[_0x42a3('0x2f')],_0x5d8cb0['query']);_0x4ccda8['attributes']=_[_0x42a3('0x34')](_0x5d8cb0[_0x42a3('0x2f')],qs['fields'](_0x5eea51[_0x42a3('0x32')][_0x42a3('0x35')]));_0x4ccda8['attributes']=_0x4ccda8[_0x42a3('0x36')]['length']?_0x4ccda8[_0x42a3('0x36')]:_0x5d8cb0[_0x42a3('0x2f')];if(!_0x5eea51['query']['hasOwnProperty'](_0x42a3('0x37'))){_0x4ccda8[_0x42a3('0x1b')]=qs[_0x42a3('0x1b')](_0x5eea51[_0x42a3('0x32')][_0x42a3('0x1b')]);_0x4ccda8[_0x42a3('0x1e')]=qs[_0x42a3('0x1e')](_0x5eea51[_0x42a3('0x32')][_0x42a3('0x1e')]);}_0x4ccda8[_0x42a3('0x38')]=qs['sort'](_0x5eea51[_0x42a3('0x32')][_0x42a3('0x39')]);_0x4ccda8[_0x42a3('0x3a')]=qs[_0x42a3('0x33')](_[_0x42a3('0x3b')](_0x5eea51[_0x42a3('0x32')],_0x5d8cb0['filters']),_0x3382a9);if(_0x5eea51[_0x42a3('0x32')][_0x42a3('0x3c')]){_0x4ccda8[_0x42a3('0x3a')]=_['merge'](_0x4ccda8['where'],{'$or':_['map'](_0x3382a9,function(_0x180426){if(_0x180426[_0x42a3('0x2d')]!==_0x42a3('0x3d')){var _0x5baa0f={};_0x5baa0f[_0x180426['name']]={'$like':'%'+_0x5eea51['query'][_0x42a3('0x3c')]+'%'};return _0x5baa0f;}})});}_0x4ccda8=_[_0x42a3('0x3e')]({},_0x4ccda8,_0x5eea51[_0x42a3('0x3f')]);var _0x2dbf89={'where':_0x4ccda8['where']};return db[_0x42a3('0x2a')][_0x42a3('0x1d')](_0x2dbf89)[_0x42a3('0x23')](function(_0x805ea1){_0x43e3e0[_0x42a3('0x1d')]=_0x805ea1;if(_0x5eea51[_0x42a3('0x32')][_0x42a3('0x40')]){_0x4ccda8[_0x42a3('0x41')]=[{'all':!![]}];}return db[_0x42a3('0x2a')][_0x42a3('0x42')](_0x4ccda8);})[_0x42a3('0x23')](function(_0x3c302b){_0x43e3e0['rows']=_0x3c302b;return _0x43e3e0;})[_0x42a3('0x23')](respondWithFilteredResult(_0x1babfd,_0x4ccda8))[_0x42a3('0x43')](handleError(_0x1babfd,null));};exports[_0x42a3('0x44')]=function(_0x4cc84d,_0x3e4165){var _0x2462fb={'raw':!![],'where':{'id':_0x4cc84d['params']['id']}},_0x534653={};_0x534653[_0x42a3('0x2f')]=_[_0x42a3('0x31')](db[_0x42a3('0x2a')]['rawAttributes']);_0x534653[_0x42a3('0x32')]=_['keys'](_0x4cc84d[_0x42a3('0x32')]);_0x534653[_0x42a3('0x33')]=_['intersection'](_0x534653[_0x42a3('0x2f')],_0x534653[_0x42a3('0x32')]);_0x2462fb[_0x42a3('0x36')]=_[_0x42a3('0x34')](_0x534653[_0x42a3('0x2f')],qs['fields'](_0x4cc84d['query'][_0x42a3('0x35')]));_0x2462fb[_0x42a3('0x36')]=_0x2462fb[_0x42a3('0x36')]['length']?_0x2462fb[_0x42a3('0x36')]:_0x534653[_0x42a3('0x2f')];if(_0x4cc84d[_0x42a3('0x32')][_0x42a3('0x40')]){_0x2462fb[_0x42a3('0x41')]=[{'all':!![]}];}_0x2462fb=_[_0x42a3('0x3e')]({},_0x2462fb,_0x4cc84d[_0x42a3('0x3f')]);return db[_0x42a3('0x2a')][_0x42a3('0x45')](_0x2462fb)[_0x42a3('0x23')](handleEntityNotFound(_0x3e4165,null))['then'](respondWithResult(_0x3e4165,null))['catch'](handleError(_0x3e4165,null));};exports[_0x42a3('0x46')]=function(_0x13677e,_0x414897){return db[_0x42a3('0x2a')][_0x42a3('0x46')](_0x13677e[_0x42a3('0x47')],{})['then'](respondWithResult(_0x414897,0xc9))['catch'](handleError(_0x414897,null));};exports[_0x42a3('0x48')]=function(_0x145b34,_0x101c56){if(_0x145b34[_0x42a3('0x47')]['id']){delete _0x145b34[_0x42a3('0x47')]['id'];}return db[_0x42a3('0x2a')][_0x42a3('0x45')]({'where':{'id':_0x145b34[_0x42a3('0x49')]['id']}})['then'](handleEntityNotFound(_0x101c56,null))['then'](saveUpdates(_0x145b34[_0x42a3('0x47')],null))[_0x42a3('0x23')](respondWithResult(_0x101c56,null))['catch'](handleError(_0x101c56,null));};exports[_0x42a3('0x4a')]=function(_0x40ad28,_0x166449,_0x1eabbc){var _0x9cae5a=require(_0x42a3('0x4b'));var _0x1060cd=![];var _0x830c2={};if(_0x40ad28['query'][_0x42a3('0x2d')]&&_0x40ad28['query'][_0x42a3('0x2d')]===_0x42a3('0x4c')){_0x830c2[_0x42a3('0x4c')]=_0x40ad28[_0x42a3('0x49')]['id'];}else{_0x830c2['id']=_0x40ad28[_0x42a3('0x49')]['id'];}return db[_0x42a3('0x2a')]['find']({'where':_0x830c2,'attributes':['id','savePath',_0x42a3('0x4d')],'raw':!![]})[_0x42a3('0x23')](handleEntityNotFound(_0x166449,null))[_0x42a3('0x23')](function(_0x17d5cc){if(_0x17d5cc){var _0x358602=_0x17d5cc[_0x42a3('0x4e')];var _0x32f96b=util[_0x42a3('0x4f')](_0x42a3('0x50'),_0x358602);if(fs[_0x42a3('0x51')](_0x32f96b)){_0x1060cd=!![];return _0x9cae5a['decryptFile'](_0x32f96b,_0x358602,config['secrets']['recording'])[_0x42a3('0x23')](function(){return _0x17d5cc;});}return _0x17d5cc;}})[_0x42a3('0x23')](function(_0x55962a){if(_0x55962a){var _0x241a21=_0x55962a[_0x42a3('0x4e')];if(!fs['existsSync'](_0x241a21)){throw new db['Sequelize'][(_0x42a3('0x52'))](_0x42a3('0x53'));}if(_0x55962a[_0x42a3('0x4d')]){return _0x166449[_0x42a3('0x4a')](_0x241a21,_0x55962a[_0x42a3('0x4d')]+path['extname'](_0x241a21),function(){if(_0x1060cd){fs[_0x42a3('0x54')](_0x241a21);}});}else{return _0x166449[_0x42a3('0x4a')](_0x241a21,function(_0x3da922){if(_0x1060cd){fs[_0x42a3('0x54')](_0x241a21);}});}}})[_0x42a3('0x43')](function(_0x524251){if(_0x524251[_0x42a3('0x55')]===_0x42a3('0x53')){_0x166449[_0x42a3('0x18')](0x194)['send'](_0x42a3('0x56'));}else{return handleError(_0x166449,null);}});};exports[_0x42a3('0x24')]=function(_0x365b59,_0x3d0555){return db[_0x42a3('0x2a')][_0x42a3('0x45')]({'where':{'id':_0x365b59['params']['id']}})[_0x42a3('0x23')](function(_0x33745c){if(_[_0x42a3('0x57')](_0x33745c)){throw new ReferenceError(_0x42a3('0x58'));}return _0x33745c;})[_0x42a3('0x23')](function(_0x2561d1){var _0x190a9f=_0x2561d1[_0x42a3('0x4e')];logger['info'](_0x42a3('0x59'),_0x190a9f);if(!_[_0x42a3('0x57')](_0x2561d1[_0x42a3('0x4e')])&&fs[_0x42a3('0x51')](_0x190a9f)){logger[_0x42a3('0x5a')](_0x42a3('0x5b')+_0x190a9f+_0x42a3('0x5c'));fs[_0x42a3('0x5d')](_0x190a9f);}_0x190a9f=_0x190a9f+'.cypher';if(!_[_0x42a3('0x57')](_0x2561d1[_0x42a3('0x4e')])&&fs[_0x42a3('0x51')](_0x190a9f)){logger[_0x42a3('0x5a')](_0x42a3('0x5b')+_0x190a9f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x42a3('0x5d')](_0x190a9f);}return _0x2561d1;})[_0x42a3('0x23')](function(_0x12cce6){if(!_0x12cce6)throw new InternalError();return _0x12cce6[_0x42a3('0x24')]();})[_0x42a3('0x23')](function(){_0x3d0555[_0x42a3('0x18')](0xcc)[_0x42a3('0x19')]();})[_0x42a3('0x43')](handleError(_0x3d0555,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6a37574..bd12016 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 _0x59ac=['path','../../config/environment','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x59ac,0x73));var _0xc59a=function(_0x2cdbdd,_0x518c1d){_0x2cdbdd=_0x2cdbdd-0x0;var _0x1e4c99=_0x59ac[_0x2cdbdd];return _0x1e4c99;};'use strict';var _=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var logger=require(_0xc59a('0x2'))(_0xc59a('0x3'));var moment=require(_0xc59a('0x4'));var BPromise=require('bluebird');var rp=require(_0xc59a('0x5'));var fs=require('fs');var path=require(_0xc59a('0x6'));var rimraf=require('rimraf');var config=require(_0xc59a('0x7'));var attributes=require(_0xc59a('0x8'));module[_0xc59a('0x9')]=function(_0x25cd8e,_0x204832){return _0x25cd8e['define'](_0xc59a('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['define','SquareRecording','util','../../config/logger','api','moment','bluebird','./squareRecording.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27a0,0xbf));var _0x027a=function(_0xcd6ce0,_0x72ca55){_0xcd6ce0=_0xcd6ce0-0x0;var _0x47276e=_0x27a0[_0xcd6ce0];return _0x47276e;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index fb1e56f..02f7f89 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 _0xfe01=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x14dca3,_0xf5b6bb){var _0x741f71=function(_0x33bbfb){while(--_0x33bbfb){_0x14dca3['push'](_0x14dca3['shift']());}};_0x741f71(++_0xf5b6bb);}(_0xfe01,0x92));var _0x1fe0=function(_0x1cdc07,_0x23dcbe){_0x1cdc07=_0x1cdc07-0x0;var _0xc00e00=_0xfe01[_0x1cdc07];return _0xc00e00;};'use strict';var _=require(_0x1fe0('0x0'));var util=require(_0x1fe0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1fe0('0x2'));var fs=require('fs');var Redis=require(_0x1fe0('0x3'));var db=require(_0x1fe0('0x4'))['db'];var utils=require(_0x1fe0('0x5'));var logger=require(_0x1fe0('0x6'))(_0x1fe0('0x7'));var config=require(_0x1fe0('0x8'));var jayson=require(_0x1fe0('0x9'));var client=jayson[_0x1fe0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9919,_0x55c63d,_0x1d68cf){return new BPromise(function(_0x42b069,_0x3ef066){return client[_0x1fe0('0xb')](_0x1f9919,_0x1d68cf)[_0x1fe0('0xc')](function(_0x1aafa1){logger[_0x1fe0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x55c63d,_0x1fe0('0xe'));logger[_0x1fe0('0xf')](_0x1fe0('0x10'),_0x55c63d,_0x1fe0('0xe'),JSON[_0x1fe0('0x11')](_0x1aafa1));if(_0x1aafa1[_0x1fe0('0x12')]){if(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x13')]===0x1f4){logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x1aafa1[_0x1fe0('0x12')]['message']);return _0x3ef066(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x15')]);}logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x1aafa1[_0x1fe0('0x12')]['message']);return _0x42b069(_0x1aafa1[_0x1fe0('0x12')][_0x1fe0('0x15')]);}else{logger[_0x1fe0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x55c63d,_0x1fe0('0xe'));_0x42b069(_0x1aafa1['result'][_0x1fe0('0x15')]);}})['catch'](function(_0x47c047){logger[_0x1fe0('0x12')](_0x1fe0('0x14'),_0x55c63d,_0x47c047);_0x3ef066(_0x47c047);});});}exports[_0x1fe0('0x16')]=function(_0x2fe014){var _0x1f4c8a=this;return new Promise(function(_0x16865b,_0x1697f5){return db[_0x1fe0('0x17')]['create'](_0x2fe014[_0x1fe0('0x18')],{'raw':_0x2fe014['options']?_0x2fe014[_0x1fe0('0x19')][_0x1fe0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5859c8){logger[_0x1fe0('0xd')](_0x1fe0('0x16'),_0x2fe014);logger[_0x1fe0('0xf')]('CreateSquareRecording',_0x2fe014,JSON[_0x1fe0('0x11')](_0x5859c8));_0x16865b(_0x5859c8);})['catch'](function(_0x23a04a){logger[_0x1fe0('0x12')](_0x1fe0('0x16'),_0x23a04a[_0x1fe0('0x15')],_0x2fe014);_0x1697f5(_0x1f4c8a[_0x1fe0('0x12')](0x1f4,_0x23a04a[_0x1fe0('0x15')]));});});}; \ No newline at end of file +var _0xf943=['then','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf943,0x150));var _0x3f94=function(_0x28341d,_0xcd4a6f){_0x28341d=_0x28341d-0x0;var _0xb67265=_0xf943[_0x28341d];return _0xb67265;};'use strict';var _=require(_0x3f94('0x0'));var util=require(_0x3f94('0x1'));var moment=require(_0x3f94('0x2'));var BPromise=require(_0x3f94('0x3'));var rs=require(_0x3f94('0x4'));var fs=require('fs');var Redis=require(_0x3f94('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f94('0x6'));var logger=require(_0x3f94('0x7'))('rpc');var config=require(_0x3f94('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f94('0x9')][_0x3f94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34d86d,_0x3b974e,_0x15247d){return new BPromise(function(_0x1f2967,_0x32a40d){return client[_0x3f94('0xb')](_0x34d86d,_0x15247d)[_0x3f94('0xc')](function(_0x46cfd8){logger['info'](_0x3f94('0xd'),_0x3b974e,'request\x20sent');logger['debug'](_0x3f94('0xe'),_0x3b974e,_0x3f94('0xf'),JSON['stringify'](_0x46cfd8));if(_0x46cfd8[_0x3f94('0x10')]){if(_0x46cfd8[_0x3f94('0x10')][_0x3f94('0x11')]===0x1f4){logger[_0x3f94('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3b974e,_0x46cfd8[_0x3f94('0x10')][_0x3f94('0x12')]);return _0x32a40d(_0x46cfd8[_0x3f94('0x10')][_0x3f94('0x12')]);}logger[_0x3f94('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3b974e,_0x46cfd8['error']['message']);return _0x1f2967(_0x46cfd8['error'][_0x3f94('0x12')]);}else{logger[_0x3f94('0x13')](_0x3f94('0xd'),_0x3b974e,_0x3f94('0xf'));_0x1f2967(_0x46cfd8['result'][_0x3f94('0x12')]);}})['catch'](function(_0x16f927){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3b974e,_0x16f927);_0x32a40d(_0x16f927);});});}exports[_0x3f94('0x14')]=function(_0x1b2d80){var _0x9b51be=this;return new Promise(function(_0x197a68,_0x337fa6){return db[_0x3f94('0x15')][_0x3f94('0x16')](_0x1b2d80[_0x3f94('0x17')],{'raw':_0x1b2d80[_0x3f94('0x18')]?_0x1b2d80[_0x3f94('0x18')][_0x3f94('0x19')]===undefined?!![]:![]:!![]})[_0x3f94('0xc')](function(_0x55b8cf){logger[_0x3f94('0x13')](_0x3f94('0x14'),_0x1b2d80);logger[_0x3f94('0x1a')](_0x3f94('0x14'),_0x1b2d80,JSON[_0x3f94('0x1b')](_0x55b8cf));_0x197a68(_0x55b8cf);})[_0x3f94('0x1c')](function(_0x169a60){logger[_0x3f94('0x10')](_0x3f94('0x14'),_0x169a60[_0x3f94('0x12')],_0x1b2d80);_0x337fa6(_0x9b51be['error'](0x1f4,_0x169a60['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 38db920..8e0770b 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x12263b,_0x5655fa){var _0x54d782=function(_0x452539){while(--_0x452539){_0x12263b['push'](_0x12263b['shift']());}};_0x54d782(++_0x5655fa);}(_0xe706,0xa3));var _0x6e70=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0xe706[_0x487f15];return _0x32c8a1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4eae728..0dd99cd 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 _0x56c7=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x5cc839,_0x2b177c){var _0x58a54a=function(_0x426390){while(--_0x426390){_0x5cc839['push'](_0x5cc839['shift']());}};_0x58a54a(++_0x2b177c);}(_0x56c7,0x169));var _0x756c=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x56c7[_0x888385];return _0x22d5c2;};'use strict';var Sequelize=require(_0x756c('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x756c('0x1')]},'request':{'type':Sequelize[_0x756c('0x1')]},'channel':{'type':Sequelize[_0x756c('0x1')]},'language':{'type':Sequelize[_0x756c('0x1')]},'type':{'type':Sequelize[_0x756c('0x1')]},'uniqueid':{'type':Sequelize[_0x756c('0x1')]},'version':{'type':Sequelize[_0x756c('0x1')]},'callerid':{'type':Sequelize[_0x756c('0x1')]},'calleridname':{'type':Sequelize[_0x756c('0x1')]},'callingpres':{'type':Sequelize[_0x756c('0x1')]},'callingani2':{'type':Sequelize[_0x756c('0x1')]},'callington':{'type':Sequelize[_0x756c('0x1')]},'callingtns':{'type':Sequelize[_0x756c('0x1')]},'dnid':{'type':Sequelize[_0x756c('0x1')]},'rdnis':{'type':Sequelize[_0x756c('0x1')]},'context':{'type':Sequelize[_0x756c('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x756c('0x1')]},'enhanced':{'type':Sequelize[_0x756c('0x1')]},'accountcode':{'type':Sequelize[_0x756c('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x756c('0x1')]},'joinAt':{'type':Sequelize[_0x756c('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x756c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5edb=['exports','STRING','BOOLEAN','sequelize'];(function(_0x477c1a,_0x4a0862){var _0x2a3982=function(_0x4f08e1){while(--_0x4f08e1){_0x477c1a['push'](_0x477c1a['shift']());}};_0x2a3982(++_0x4a0862);}(_0x5edb,0x187));var _0xb5ed=function(_0x41ba97,_0xa94e7c){_0x41ba97=_0x41ba97-0x0;var _0x81d623=_0x5edb[_0x41ba97];return _0x81d623;};'use strict';var Sequelize=require(_0xb5ed('0x0'));module[_0xb5ed('0x1')]={'network':{'type':Sequelize[_0xb5ed('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xb5ed('0x2')]},'channel':{'type':Sequelize[_0xb5ed('0x2')]},'language':{'type':Sequelize[_0xb5ed('0x2')]},'type':{'type':Sequelize[_0xb5ed('0x2')]},'uniqueid':{'type':Sequelize[_0xb5ed('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb5ed('0x2')]},'calleridname':{'type':Sequelize[_0xb5ed('0x2')]},'callingpres':{'type':Sequelize[_0xb5ed('0x2')]},'callingani2':{'type':Sequelize[_0xb5ed('0x2')]},'callington':{'type':Sequelize[_0xb5ed('0x2')]},'callingtns':{'type':Sequelize[_0xb5ed('0x2')]},'dnid':{'type':Sequelize[_0xb5ed('0x2')]},'rdnis':{'type':Sequelize[_0xb5ed('0x2')]},'context':{'type':Sequelize[_0xb5ed('0x2')]},'extension':{'type':Sequelize[_0xb5ed('0x2')]},'priority':{'type':Sequelize[_0xb5ed('0x2')]},'enhanced':{'type':Sequelize[_0xb5ed('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xb5ed('0x2')]},'project_name':{'type':Sequelize[_0xb5ed('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb5ed('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 979d6fb..e54947a 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 _0x8d6d=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x8d6d,0x8a));var _0xd8d6=function(_0x4b355b,_0x107149){_0x4b355b=_0x4b355b-0x0;var _0x225dc7=_0x8d6d[_0x4b355b];return _0x225dc7;};'use strict';var emlformat=require(_0xd8d6('0x0'));var rimraf=require(_0xd8d6('0x1'));var zipdir=require(_0xd8d6('0x2'));var jsonpatch=require(_0xd8d6('0x3'));var rp=require(_0xd8d6('0x4'));var moment=require(_0xd8d6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8d6('0x6'));var path=require(_0xd8d6('0x7'));var sox=require(_0xd8d6('0x8'));var csv=require(_0xd8d6('0x9'));var ejs=require(_0xd8d6('0xa'));var fs=require('fs');var fs_extra=require(_0xd8d6('0xb'));var _=require(_0xd8d6('0xc'));var squel=require(_0xd8d6('0xd'));var crypto=require(_0xd8d6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd8d6('0xf'));var toCsv=require(_0xd8d6('0x9'));var querystring=require(_0xd8d6('0x10'));var Papa=require(_0xd8d6('0x11'));var Redis=require(_0xd8d6('0x12'));var authService=require(_0xd8d6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd8d6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8d6('0x15'));var utils=require(_0xd8d6('0x16'));var config=require(_0xd8d6('0x17'));var licenseUtil=require(_0xd8d6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x156a85,_0x1adefc){_0x1adefc=_0x1adefc||0xcc;return function(_0x4f8649){if(_0x4f8649){return _0x156a85[_0xd8d6('0x19')](_0x1adefc);}return _0x156a85[_0xd8d6('0x1a')](_0x1adefc)[_0xd8d6('0x1b')]();};}function respondWithResult(_0x4cca65,_0x5374fd){_0x5374fd=_0x5374fd||0xc8;return function(_0x506be6){if(_0x506be6){return _0x4cca65[_0xd8d6('0x1a')](_0x5374fd)[_0xd8d6('0x1c')](_0x506be6);}};}function respondWithFilteredResult(_0x36720c,_0x448e4b){return function(_0x1b3383){if(_0x1b3383){var _0x585db7=typeof _0x448e4b[_0xd8d6('0x1d')]===_0xd8d6('0x1e')&&typeof _0x448e4b['limit']===_0xd8d6('0x1e');var _0x3f1f1d=_0x1b3383[_0xd8d6('0x1f')];var _0x4ebda8=_0x585db7?0x0:_0x448e4b[_0xd8d6('0x1d')];var _0xc30efc=_0x585db7?_0x1b3383['count']:_0x448e4b[_0xd8d6('0x1d')]+_0x448e4b[_0xd8d6('0x20')];var _0x4eacb3;if(_0xc30efc>=_0x3f1f1d){_0xc30efc=_0x3f1f1d;_0x4eacb3=0xc8;}else{_0x4eacb3=0xce;}_0x36720c['status'](_0x4eacb3);return _0x36720c[_0xd8d6('0x21')]('Content-Range',_0x4ebda8+'-'+_0xc30efc+'/'+_0x3f1f1d)[_0xd8d6('0x1c')](_0x1b3383);}return null;};}function patchUpdates(_0x27d8df){return function(_0x45169){try{jsonpatch['apply'](_0x45169,_0x27d8df,!![]);}catch(_0x5b1466){return BPromise[_0xd8d6('0x22')](_0x5b1466);}return _0x45169['save']();};}function saveUpdates(_0x100455,_0x4206f5){return function(_0x8ed902){if(_0x8ed902){return _0x8ed902['update'](_0x100455)[_0xd8d6('0x23')](function(_0x2a2262){return _0x2a2262;});}return null;};}function removeEntity(_0x143ed8,_0xe98937){return function(_0x49f484){if(_0x49f484){return _0x49f484[_0xd8d6('0x24')]()[_0xd8d6('0x23')](function(){_0x143ed8[_0xd8d6('0x1a')](0xcc)[_0xd8d6('0x1b')]();});}};}function handleEntityNotFound(_0x53f4f7,_0x1b4144){return function(_0x3a030c){if(!_0x3a030c){_0x53f4f7[_0xd8d6('0x19')](0x194);}return _0x3a030c;};}function handleError(_0x2e3986,_0x5aafe0){_0x5aafe0=_0x5aafe0||0x1f4;return function(_0x5908ff){logger[_0xd8d6('0x25')](_0x5908ff[_0xd8d6('0x26')]);if(_0x5908ff[_0xd8d6('0x27')]){delete _0x5908ff[_0xd8d6('0x27')];}_0x2e3986[_0xd8d6('0x1a')](_0x5aafe0)[_0xd8d6('0x28')](_0x5908ff);};}exports[_0xd8d6('0x29')]=function(_0xbf5d50,_0x1a161e){var _0x1fd6b5={},_0x4c8673={},_0x3dc371={'count':0x0,'rows':[]};var _0x1e747e=_['map'](db[_0xd8d6('0x2a')][_0xd8d6('0x2b')],function(_0x2d6183){return{'name':_0x2d6183[_0xd8d6('0x2c')],'type':_0x2d6183['type'][_0xd8d6('0x2d')]};});_0x4c8673[_0xd8d6('0x2e')]=_[_0xd8d6('0x2f')](_0x1e747e,'name');_0x4c8673[_0xd8d6('0x30')]=_['keys'](_0xbf5d50['query']);_0x4c8673['filters']=_['intersection'](_0x4c8673[_0xd8d6('0x2e')],_0x4c8673[_0xd8d6('0x30')]);_0x1fd6b5[_0xd8d6('0x31')]=_['intersection'](_0x4c8673[_0xd8d6('0x2e')],qs[_0xd8d6('0x32')](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x32')]));_0x1fd6b5[_0xd8d6('0x31')]=_0x1fd6b5[_0xd8d6('0x31')]['length']?_0x1fd6b5[_0xd8d6('0x31')]:_0x4c8673[_0xd8d6('0x2e')];if(!_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x33')](_0xd8d6('0x34'))){_0x1fd6b5[_0xd8d6('0x20')]=qs['limit'](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x20')]);_0x1fd6b5['offset']=qs[_0xd8d6('0x1d')](_0xbf5d50['query'][_0xd8d6('0x1d')]);}_0x1fd6b5[_0xd8d6('0x35')]=qs[_0xd8d6('0x36')](_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x36')]);_0x1fd6b5[_0xd8d6('0x37')]=qs[_0xd8d6('0x38')](_[_0xd8d6('0x39')](_0xbf5d50[_0xd8d6('0x30')],_0x4c8673[_0xd8d6('0x38')]),_0x1e747e);if(_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x3a')]){_0x1fd6b5[_0xd8d6('0x37')]=_[_0xd8d6('0x3b')](_0x1fd6b5[_0xd8d6('0x37')],{'$or':_[_0xd8d6('0x2f')](_0x1e747e,function(_0x4fb839){if(_0x4fb839[_0xd8d6('0x3c')]!==_0xd8d6('0x3d')){var _0x119e32={};_0x119e32[_0x4fb839[_0xd8d6('0x27')]]={'$like':'%'+_0xbf5d50['query'][_0xd8d6('0x3a')]+'%'};return _0x119e32;}})});}_0x1fd6b5=_['merge']({},_0x1fd6b5,_0xbf5d50[_0xd8d6('0x3e')]);var _0x38fe64={'where':_0x1fd6b5[_0xd8d6('0x37')]};return db[_0xd8d6('0x2a')]['count'](_0x38fe64)[_0xd8d6('0x23')](function(_0x5f0fdc){_0x3dc371['count']=_0x5f0fdc;if(_0xbf5d50[_0xd8d6('0x30')][_0xd8d6('0x3f')]){_0x1fd6b5[_0xd8d6('0x40')]=[{'all':!![]}];}return db[_0xd8d6('0x2a')][_0xd8d6('0x41')](_0x1fd6b5);})['then'](function(_0x365e4b){_0x3dc371[_0xd8d6('0x42')]=_0x365e4b;return _0x3dc371;})['then'](respondWithFilteredResult(_0x1a161e,_0x1fd6b5))[_0xd8d6('0x43')](handleError(_0x1a161e,null));};exports[_0xd8d6('0x44')]=function(_0x1352fc,_0x2f0317){var _0x25bfd6={'raw':!![],'where':{'id':_0x1352fc[_0xd8d6('0x45')]['id']}},_0xee18c3={};_0xee18c3[_0xd8d6('0x2e')]=_['keys'](db[_0xd8d6('0x2a')][_0xd8d6('0x2b')]);_0xee18c3[_0xd8d6('0x30')]=_[_0xd8d6('0x46')](_0x1352fc[_0xd8d6('0x30')]);_0xee18c3['filters']=_['intersection'](_0xee18c3[_0xd8d6('0x2e')],_0xee18c3['query']);_0x25bfd6[_0xd8d6('0x31')]=_['intersection'](_0xee18c3[_0xd8d6('0x2e')],qs[_0xd8d6('0x32')](_0x1352fc[_0xd8d6('0x30')][_0xd8d6('0x32')]));_0x25bfd6['attributes']=_0x25bfd6[_0xd8d6('0x31')][_0xd8d6('0x47')]?_0x25bfd6[_0xd8d6('0x31')]:_0xee18c3[_0xd8d6('0x2e')];if(_0x1352fc[_0xd8d6('0x30')][_0xd8d6('0x3f')]){_0x25bfd6[_0xd8d6('0x40')]=[{'all':!![]}];}_0x25bfd6=_[_0xd8d6('0x3b')]({},_0x25bfd6,_0x1352fc[_0xd8d6('0x3e')]);return db[_0xd8d6('0x2a')][_0xd8d6('0x48')](_0x25bfd6)[_0xd8d6('0x23')](handleEntityNotFound(_0x2f0317,null))['then'](respondWithResult(_0x2f0317,null))[_0xd8d6('0x43')](handleError(_0x2f0317,null));};exports[_0xd8d6('0x49')]=function(_0x30987e,_0x496b10){return db[_0xd8d6('0x2a')][_0xd8d6('0x49')](_0x30987e[_0xd8d6('0x4a')],{})[_0xd8d6('0x23')](respondWithResult(_0x496b10,0xc9))[_0xd8d6('0x43')](handleError(_0x496b10,null));};exports[_0xd8d6('0x4b')]=function(_0x343cfc,_0x34f0cf){if(_0x343cfc['body']['id']){delete _0x343cfc[_0xd8d6('0x4a')]['id'];}return db['SquareReport'][_0xd8d6('0x48')]({'where':{'id':_0x343cfc[_0xd8d6('0x45')]['id']}})[_0xd8d6('0x23')](handleEntityNotFound(_0x34f0cf,null))['then'](saveUpdates(_0x343cfc[_0xd8d6('0x4a')],null))['then'](respondWithResult(_0x34f0cf,null))[_0xd8d6('0x43')](handleError(_0x34f0cf,null));};exports[_0xd8d6('0x24')]=function(_0x918a01,_0x268191){return db[_0xd8d6('0x2a')][_0xd8d6('0x48')]({'where':{'id':_0x918a01[_0xd8d6('0x45')]['id']}})[_0xd8d6('0x23')](handleEntityNotFound(_0x268191,null))[_0xd8d6('0x23')](removeEntity(_0x268191,null))[_0xd8d6('0x43')](handleError(_0x268191,null));};exports[_0xd8d6('0x4c')]=function(_0x2526de,_0x224e14){return db[_0xd8d6('0x2a')]['describe']()[_0xd8d6('0x23')](respondWithResult(_0x224e14,null))[_0xd8d6('0x43')](handleError(_0x224e14,null));}; \ No newline at end of file +var _0x81e2=['Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','params','includeAll','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x425403,_0x171fdb){var _0x5d796f=function(_0x283955){while(--_0x283955){_0x425403['push'](_0x425403['shift']());}};_0x5d796f(++_0x171fdb);}(_0x81e2,0x158));var _0x281e=function(_0x4fe513,_0x44c127){_0x4fe513=_0x4fe513-0x0;var _0x5b4788=_0x81e2[_0x4fe513];return _0x5b4788;};'use strict';var emlformat=require(_0x281e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x281e('0x1'));var jsonpatch=require(_0x281e('0x2'));var rp=require(_0x281e('0x3'));var moment=require(_0x281e('0x4'));var BPromise=require(_0x281e('0x5'));var Mustache=require(_0x281e('0x6'));var util=require('util');var path=require(_0x281e('0x7'));var sox=require('sox');var csv=require(_0x281e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x281e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x281e('0xa'));var deskjs=require(_0x281e('0xb'));var toCsv=require(_0x281e('0x8'));var querystring=require(_0x281e('0xc'));var Papa=require(_0x281e('0xd'));var Redis=require(_0x281e('0xe'));var authService=require(_0x281e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x281e('0x10'));var logger=require('../../config/logger')(_0x281e('0x11'));var utils=require(_0x281e('0x12'));var config=require(_0x281e('0x13'));var licenseUtil=require(_0x281e('0x14'));var db=require(_0x281e('0x15'))['db'];function respondWithStatusCode(_0x2fc9e6,_0x1e15b1){_0x1e15b1=_0x1e15b1||0xcc;return function(_0x15cf18){if(_0x15cf18){return _0x2fc9e6[_0x281e('0x16')](_0x1e15b1);}return _0x2fc9e6[_0x281e('0x17')](_0x1e15b1)[_0x281e('0x18')]();};}function respondWithResult(_0x5094af,_0x22002e){_0x22002e=_0x22002e||0xc8;return function(_0x1ddd1b){if(_0x1ddd1b){return _0x5094af[_0x281e('0x17')](_0x22002e)[_0x281e('0x19')](_0x1ddd1b);}};}function respondWithFilteredResult(_0x561261,_0x420adb){return function(_0x4b2197){if(_0x4b2197){var _0x175f44=typeof _0x420adb[_0x281e('0x1a')]===_0x281e('0x1b')&&typeof _0x420adb[_0x281e('0x1c')]==='undefined';var _0x40750b=_0x4b2197[_0x281e('0x1d')];var _0xae179f=_0x175f44?0x0:_0x420adb[_0x281e('0x1a')];var _0x1fca6f=_0x175f44?_0x4b2197[_0x281e('0x1d')]:_0x420adb[_0x281e('0x1a')]+_0x420adb['limit'];var _0x1e4a01;if(_0x1fca6f>=_0x40750b){_0x1fca6f=_0x40750b;_0x1e4a01=0xc8;}else{_0x1e4a01=0xce;}_0x561261['status'](_0x1e4a01);return _0x561261[_0x281e('0x1e')](_0x281e('0x1f'),_0xae179f+'-'+_0x1fca6f+'/'+_0x40750b)[_0x281e('0x19')](_0x4b2197);}return null;};}function patchUpdates(_0x20cffc){return function(_0x19be9a){try{jsonpatch[_0x281e('0x20')](_0x19be9a,_0x20cffc,!![]);}catch(_0x3cd06c){return BPromise[_0x281e('0x21')](_0x3cd06c);}return _0x19be9a[_0x281e('0x22')]();};}function saveUpdates(_0x32aedb,_0x39721c){return function(_0x5c58fb){if(_0x5c58fb){return _0x5c58fb['update'](_0x32aedb)[_0x281e('0x23')](function(_0xe3c9ba){return _0xe3c9ba;});}return null;};}function removeEntity(_0x17a4cb,_0x636028){return function(_0x58ce81){if(_0x58ce81){return _0x58ce81[_0x281e('0x24')]()['then'](function(){_0x17a4cb['status'](0xcc)[_0x281e('0x18')]();});}};}function handleEntityNotFound(_0x52e8da,_0x274b3c){return function(_0x41eabf){if(!_0x41eabf){_0x52e8da[_0x281e('0x16')](0x194);}return _0x41eabf;};}function handleError(_0x52c6e3,_0x3246d3){_0x3246d3=_0x3246d3||0x1f4;return function(_0x1a982d){logger[_0x281e('0x25')](_0x1a982d['stack']);if(_0x1a982d[_0x281e('0x26')]){delete _0x1a982d['name'];}_0x52c6e3[_0x281e('0x17')](_0x3246d3)[_0x281e('0x27')](_0x1a982d);};}exports[_0x281e('0x28')]=function(_0x4f6101,_0x383e13){var _0x4edf03={},_0x2d0925={},_0x2605ba={'count':0x0,'rows':[]};var _0x45bd57=_[_0x281e('0x29')](db[_0x281e('0x2a')][_0x281e('0x2b')],function(_0xae801a){return{'name':_0xae801a[_0x281e('0x2c')],'type':_0xae801a['type'][_0x281e('0x2d')]};});_0x2d0925['model']=_[_0x281e('0x29')](_0x45bd57,_0x281e('0x26'));_0x2d0925[_0x281e('0x2e')]=_[_0x281e('0x2f')](_0x4f6101[_0x281e('0x2e')]);_0x2d0925[_0x281e('0x30')]=_[_0x281e('0x31')](_0x2d0925[_0x281e('0x32')],_0x2d0925[_0x281e('0x2e')]);_0x4edf03[_0x281e('0x33')]=_[_0x281e('0x31')](_0x2d0925[_0x281e('0x32')],qs[_0x281e('0x34')](_0x4f6101[_0x281e('0x2e')][_0x281e('0x34')]));_0x4edf03[_0x281e('0x33')]=_0x4edf03[_0x281e('0x33')][_0x281e('0x35')]?_0x4edf03[_0x281e('0x33')]:_0x2d0925[_0x281e('0x32')];if(!_0x4f6101['query'][_0x281e('0x36')](_0x281e('0x37'))){_0x4edf03[_0x281e('0x1c')]=qs[_0x281e('0x1c')](_0x4f6101[_0x281e('0x2e')][_0x281e('0x1c')]);_0x4edf03[_0x281e('0x1a')]=qs[_0x281e('0x1a')](_0x4f6101[_0x281e('0x2e')][_0x281e('0x1a')]);}_0x4edf03[_0x281e('0x38')]=qs['sort'](_0x4f6101['query'][_0x281e('0x39')]);_0x4edf03[_0x281e('0x3a')]=qs[_0x281e('0x30')](_[_0x281e('0x3b')](_0x4f6101['query'],_0x2d0925['filters']),_0x45bd57);if(_0x4f6101[_0x281e('0x2e')][_0x281e('0x3c')]){_0x4edf03[_0x281e('0x3a')]=_[_0x281e('0x3d')](_0x4edf03['where'],{'$or':_[_0x281e('0x29')](_0x45bd57,function(_0x26ab85){if(_0x26ab85[_0x281e('0x3e')]!==_0x281e('0x3f')){var _0x512024={};_0x512024[_0x26ab85[_0x281e('0x26')]]={'$like':'%'+_0x4f6101[_0x281e('0x2e')][_0x281e('0x3c')]+'%'};return _0x512024;}})});}_0x4edf03=_[_0x281e('0x3d')]({},_0x4edf03,_0x4f6101[_0x281e('0x40')]);var _0x3818fa={'where':_0x4edf03['where']};return db[_0x281e('0x2a')]['count'](_0x3818fa)[_0x281e('0x23')](function(_0x69b57f){_0x2605ba[_0x281e('0x1d')]=_0x69b57f;if(_0x4f6101[_0x281e('0x2e')]['includeAll']){_0x4edf03[_0x281e('0x41')]=[{'all':!![]}];}return db[_0x281e('0x2a')]['findAll'](_0x4edf03);})[_0x281e('0x23')](function(_0x3145a8){_0x2605ba[_0x281e('0x42')]=_0x3145a8;return _0x2605ba;})[_0x281e('0x23')](respondWithFilteredResult(_0x383e13,_0x4edf03))['catch'](handleError(_0x383e13,null));};exports['show']=function(_0x599eac,_0x582608){var _0x4c3a8b={'raw':!![],'where':{'id':_0x599eac[_0x281e('0x43')]['id']}},_0x2d7048={};_0x2d7048[_0x281e('0x32')]=_[_0x281e('0x2f')](db[_0x281e('0x2a')][_0x281e('0x2b')]);_0x2d7048['query']=_[_0x281e('0x2f')](_0x599eac[_0x281e('0x2e')]);_0x2d7048[_0x281e('0x30')]=_[_0x281e('0x31')](_0x2d7048[_0x281e('0x32')],_0x2d7048[_0x281e('0x2e')]);_0x4c3a8b[_0x281e('0x33')]=_[_0x281e('0x31')](_0x2d7048[_0x281e('0x32')],qs[_0x281e('0x34')](_0x599eac[_0x281e('0x2e')][_0x281e('0x34')]));_0x4c3a8b['attributes']=_0x4c3a8b[_0x281e('0x33')][_0x281e('0x35')]?_0x4c3a8b['attributes']:_0x2d7048[_0x281e('0x32')];if(_0x599eac[_0x281e('0x2e')][_0x281e('0x44')]){_0x4c3a8b[_0x281e('0x41')]=[{'all':!![]}];}_0x4c3a8b=_[_0x281e('0x3d')]({},_0x4c3a8b,_0x599eac[_0x281e('0x40')]);return db['SquareReport'][_0x281e('0x45')](_0x4c3a8b)[_0x281e('0x23')](handleEntityNotFound(_0x582608,null))['then'](respondWithResult(_0x582608,null))[_0x281e('0x46')](handleError(_0x582608,null));};exports[_0x281e('0x47')]=function(_0x44b57b,_0x2cb509){return db[_0x281e('0x2a')][_0x281e('0x47')](_0x44b57b[_0x281e('0x48')],{})['then'](respondWithResult(_0x2cb509,0xc9))[_0x281e('0x46')](handleError(_0x2cb509,null));};exports[_0x281e('0x49')]=function(_0x5963be,_0x18bee8){if(_0x5963be[_0x281e('0x48')]['id']){delete _0x5963be[_0x281e('0x48')]['id'];}return db['SquareReport'][_0x281e('0x45')]({'where':{'id':_0x5963be['params']['id']}})[_0x281e('0x23')](handleEntityNotFound(_0x18bee8,null))[_0x281e('0x23')](saveUpdates(_0x5963be['body'],null))[_0x281e('0x23')](respondWithResult(_0x18bee8,null))[_0x281e('0x46')](handleError(_0x18bee8,null));};exports[_0x281e('0x24')]=function(_0x54400d,_0x152cd3){return db[_0x281e('0x2a')]['find']({'where':{'id':_0x54400d['params']['id']}})['then'](handleEntityNotFound(_0x152cd3,null))[_0x281e('0x23')](removeEntity(_0x152cd3,null))[_0x281e('0x46')](handleError(_0x152cd3,null));};exports[_0x281e('0x4a')]=function(_0x3bfad7,_0x53269c){return db[_0x281e('0x2a')][_0x281e('0x4a')]()[_0x281e('0x23')](respondWithResult(_0x53269c,null))[_0x281e('0x46')](handleError(_0x53269c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4aa10a1..4847834 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 _0x337b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0xd76edb,_0x1583c4){var _0x528c9b=function(_0x2ef8c2){while(--_0x2ef8c2){_0xd76edb['push'](_0xd76edb['shift']());}};_0x528c9b(++_0x1583c4);}(_0x337b,0xd7));var _0xb337=function(_0x1b60cf,_0x1bce5f){_0x1b60cf=_0x1b60cf-0x0;var _0x43264f=_0x337b[_0x1b60cf];return _0x43264f;};'use strict';var _=require(_0xb337('0x0'));var util=require(_0xb337('0x1'));var logger=require(_0xb337('0x2'))('api');var moment=require(_0xb337('0x3'));var BPromise=require(_0xb337('0x4'));var rp=require(_0xb337('0x5'));var fs=require('fs');var path=require(_0xb337('0x6'));var rimraf=require(_0xb337('0x7'));var config=require(_0xb337('0x8'));var attributes=require(_0xb337('0x9'));module[_0xb337('0xa')]=function(_0xeb8507,_0x38518b){return _0xeb8507[_0xb337('0xb')](_0xb337('0xc'),attributes,{'tableName':_0xb337('0xd'),'paranoid':![],'indexes':[{'name':_0xb337('0xe'),'fields':[_0xb337('0xf'),_0xb337('0x10')]},{'name':_0xb337('0x11'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb003=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','leaveAt','lodash','util'];(function(_0xc1a010,_0x2b465f){var _0x3d9d5b=function(_0x232038){while(--_0x232038){_0xc1a010['push'](_0xc1a010['shift']());}};_0x3d9d5b(++_0x2b465f);}(_0xb003,0x129));var _0x3b00=function(_0x572ee8,_0x24ea07){_0x572ee8=_0x572ee8-0x0;var _0xb87b08=_0xb003[_0x572ee8];return _0xb87b08;};'use strict';var _=require(_0x3b00('0x0'));var util=require(_0x3b00('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b00('0x2'));var BPromise=require(_0x3b00('0x3'));var rp=require(_0x3b00('0x4'));var fs=require('fs');var path=require(_0x3b00('0x5'));var rimraf=require(_0x3b00('0x6'));var config=require(_0x3b00('0x7'));var attributes=require(_0x3b00('0x8'));module[_0x3b00('0x9')]=function(_0xda47b2,_0x158116){return _0xda47b2[_0x3b00('0xa')]('SquareReport',attributes,{'tableName':_0x3b00('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':_0x3b00('0xc'),'fields':[_0x3b00('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ea578ac..e7b4c06 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 _0xcc9d=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','options','raw','catch','UpdateSquareReport','body','where','attributes','limit','then','moment','bluebird','randomstring','../../mysqldb'];(function(_0x22a828,_0x4c2a81){var _0xe7dfbe=function(_0x56f36a){while(--_0x56f36a){_0x22a828['push'](_0x22a828['shift']());}};_0xe7dfbe(++_0x4c2a81);}(_0xcc9d,0x17c));var _0xdcc9=function(_0x45d23c,_0x5ddff2){_0x45d23c=_0x45d23c-0x0;var _0x5932a9=_0xcc9d[_0x45d23c];return _0x5932a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdcc9('0x0'));var BPromise=require(_0xdcc9('0x1'));var rs=require(_0xdcc9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcc9('0x3'))['db'];var utils=require(_0xdcc9('0x4'));var logger=require(_0xdcc9('0x5'))(_0xdcc9('0x6'));var config=require(_0xdcc9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcc9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x340f02,_0xaf3a40,_0x87f1e0){return new BPromise(function(_0x39e94d,_0xaacb74){return client[_0xdcc9('0x9')](_0x340f02,_0x87f1e0)['then'](function(_0x54535d){logger[_0xdcc9('0xa')](_0xdcc9('0xb'),_0xaf3a40,_0xdcc9('0xc'));logger[_0xdcc9('0xd')](_0xdcc9('0xe'),_0xaf3a40,_0xdcc9('0xc'),JSON[_0xdcc9('0xf')](_0x54535d));if(_0x54535d[_0xdcc9('0x10')]){if(_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x11')]===0x1f4){logger[_0xdcc9('0x10')](_0xdcc9('0xb'),_0xaf3a40,_0x54535d[_0xdcc9('0x10')]['message']);return _0xaacb74(_0x54535d[_0xdcc9('0x10')]['message']);}logger[_0xdcc9('0x10')](_0xdcc9('0xb'),_0xaf3a40,_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x12')]);return _0x39e94d(_0x54535d[_0xdcc9('0x10')][_0xdcc9('0x12')]);}else{logger[_0xdcc9('0xa')]('SquareReport,\x20%s,\x20%s',_0xaf3a40,'request\x20sent');_0x39e94d(_0x54535d[_0xdcc9('0x13')][_0xdcc9('0x12')]);}})['catch'](function(_0x1eae3f){logger['error'](_0xdcc9('0xb'),_0xaf3a40,_0x1eae3f);_0xaacb74(_0x1eae3f);});});}exports[_0xdcc9('0x14')]=function(_0x376d59){var _0x41201e=this;return new Promise(function(_0x1cc9b8,_0x3d4aad){return db[_0xdcc9('0x15')][_0xdcc9('0x16')](_0x376d59['body'],{'raw':_0x376d59[_0xdcc9('0x17')]?_0x376d59[_0xdcc9('0x17')][_0xdcc9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1d5d92){logger[_0xdcc9('0xa')](_0xdcc9('0x14'),_0x376d59);logger[_0xdcc9('0xd')]('CreateSquareReport',_0x376d59,JSON[_0xdcc9('0xf')](_0x1d5d92));_0x1cc9b8(_0x1d5d92);})[_0xdcc9('0x19')](function(_0x18df92){logger[_0xdcc9('0x10')](_0xdcc9('0x14'),_0x18df92[_0xdcc9('0x12')],_0x376d59);_0x3d4aad(_0x41201e[_0xdcc9('0x10')](0x1f4,_0x18df92['message']));});});};exports[_0xdcc9('0x1a')]=function(_0xecb0bb){var _0xb203cb=this;return new Promise(function(_0x12827d,_0x10e513){return db[_0xdcc9('0x15')]['update'](_0xecb0bb[_0xdcc9('0x1b')],{'raw':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1c')]||null:null,'attributes':_0xecb0bb[_0xdcc9('0x17')]?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1d')]||null:null,'limit':_0xecb0bb['options']?_0xecb0bb[_0xdcc9('0x17')][_0xdcc9('0x1e')]||null:null})[_0xdcc9('0x1f')](function(_0x42f259){logger[_0xdcc9('0xa')](_0xdcc9('0x1a'),_0xecb0bb);logger[_0xdcc9('0xd')]('UpdateSquareReport',_0xecb0bb,JSON[_0xdcc9('0xf')](_0x42f259));_0x12827d(_0x42f259);})[_0xdcc9('0x19')](function(_0x3e6d0a){logger[_0xdcc9('0x10')]('UpdateSquareReport',_0x3e6d0a[_0xdcc9('0x12')],_0xecb0bb);_0x10e513(_0xb203cb[_0xdcc9('0x10')](0x1f4,_0x3e6d0a[_0xdcc9('0x12')]));});});}; \ No newline at end of file +var _0xe6b0=['SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreateSquareReport','SquareReport','body','raw','stringify','update','options','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','debug'];(function(_0x2bba2c,_0x1e622e){var _0x1be093=function(_0x8a9f6b){while(--_0x8a9f6b){_0x2bba2c['push'](_0x2bba2c['shift']());}};_0x1be093(++_0x1e622e);}(_0xe6b0,0x195));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0e6b('0x0'));var util=require(_0x0e6b('0x1'));var moment=require(_0x0e6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e6b('0x3'));var db=require(_0x0e6b('0x4'))['db'];var utils=require(_0x0e6b('0x5'));var logger=require('../../config/logger')(_0x0e6b('0x6'));var config=require(_0x0e6b('0x7'));var jayson=require(_0x0e6b('0x8'));var client=jayson['client'][_0x0e6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7299,_0x1e1788,_0x39fa9d){return new BPromise(function(_0x23f968,_0x9b247b){return client[_0x0e6b('0xa')](_0x2a7299,_0x39fa9d)[_0x0e6b('0xb')](function(_0x1a8e0d){logger[_0x0e6b('0xc')](_0x0e6b('0xd'),_0x1e1788,'request\x20sent');logger[_0x0e6b('0xe')](_0x0e6b('0xf'),_0x1e1788,_0x0e6b('0x10'),JSON['stringify'](_0x1a8e0d));if(_0x1a8e0d['error']){if(_0x1a8e0d['error'][_0x0e6b('0x11')]===0x1f4){logger[_0x0e6b('0x12')]('SquareReport,\x20%s,\x20%s',_0x1e1788,_0x1a8e0d[_0x0e6b('0x12')][_0x0e6b('0x13')]);return _0x9b247b(_0x1a8e0d[_0x0e6b('0x12')][_0x0e6b('0x13')]);}logger[_0x0e6b('0x12')](_0x0e6b('0xd'),_0x1e1788,_0x1a8e0d[_0x0e6b('0x12')][_0x0e6b('0x13')]);return _0x23f968(_0x1a8e0d[_0x0e6b('0x12')][_0x0e6b('0x13')]);}else{logger['info'](_0x0e6b('0xd'),_0x1e1788,_0x0e6b('0x10'));_0x23f968(_0x1a8e0d[_0x0e6b('0x14')]['message']);}})[_0x0e6b('0x15')](function(_0x2c8229){logger[_0x0e6b('0x12')]('SquareReport,\x20%s,\x20%s',_0x1e1788,_0x2c8229);_0x9b247b(_0x2c8229);});});}exports[_0x0e6b('0x16')]=function(_0x441253){var _0x4cecae=this;return new Promise(function(_0x56d8ed,_0x2aea95){return db[_0x0e6b('0x17')]['create'](_0x441253[_0x0e6b('0x18')],{'raw':_0x441253['options']?_0x441253['options'][_0x0e6b('0x19')]===undefined?!![]:![]:!![]})[_0x0e6b('0xb')](function(_0xdea0d3){logger['info'](_0x0e6b('0x16'),_0x441253);logger[_0x0e6b('0xe')](_0x0e6b('0x16'),_0x441253,JSON[_0x0e6b('0x1a')](_0xdea0d3));_0x56d8ed(_0xdea0d3);})['catch'](function(_0x253066){logger[_0x0e6b('0x12')](_0x0e6b('0x16'),_0x253066[_0x0e6b('0x13')],_0x441253);_0x2aea95(_0x4cecae[_0x0e6b('0x12')](0x1f4,_0x253066[_0x0e6b('0x13')]));});});};exports['UpdateSquareReport']=function(_0x32f33a){var _0x7ff907=this;return new Promise(function(_0x3b7aba,_0x427ce4){return db['SquareReport'][_0x0e6b('0x1b')](_0x32f33a['body'],{'raw':_0x32f33a[_0x0e6b('0x1c')]?_0x32f33a[_0x0e6b('0x1c')][_0x0e6b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f33a[_0x0e6b('0x1c')]?_0x32f33a[_0x0e6b('0x1c')]['where']||null:null,'attributes':_0x32f33a['options']?_0x32f33a[_0x0e6b('0x1c')]['attributes']||null:null,'limit':_0x32f33a['options']?_0x32f33a['options'][_0x0e6b('0x1d')]||null:null})[_0x0e6b('0xb')](function(_0x4bfcb0){logger[_0x0e6b('0xc')]('UpdateSquareReport',_0x32f33a);logger[_0x0e6b('0xe')]('UpdateSquareReport',_0x32f33a,JSON[_0x0e6b('0x1a')](_0x4bfcb0));_0x3b7aba(_0x4bfcb0);})[_0x0e6b('0x15')](function(_0x4163e8){logger[_0x0e6b('0x12')]('UpdateSquareReport',_0x4163e8[_0x0e6b('0x13')],_0x32f33a);_0x427ce4(_0x7ff907[_0x0e6b('0x12')](0x1f4,_0x4163e8[_0x0e6b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0dbb9f1..4c3721b 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 _0xdabd=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports'];(function(_0x39e53c,_0x5df21f){var _0x17a3b1=function(_0x14b558){while(--_0x14b558){_0x39e53c['push'](_0x39e53c['shift']());}};_0x17a3b1(++_0x5df21f);}(_0xdabd,0x8c));var _0xddab=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xdabd[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require(_0xddab('0x0'));var util=require('util');var path=require(_0xddab('0x1'));var timeout=require('connect-timeout');var express=require(_0xddab('0x2'));var router=express[_0xddab('0x3')]();var fs_extra=require(_0xddab('0x4'));var auth=require(_0xddab('0x5'));var interaction=require(_0xddab('0x6'));var config=require('../../config/environment');var controller=require(_0xddab('0x7'));router[_0xddab('0x8')]('/',auth[_0xddab('0x9')](),controller[_0xddab('0xa')]);router[_0xddab('0x8')](_0xddab('0xb'),auth[_0xddab('0x9')](),controller[_0xddab('0xc')]);router['get']('/:id',auth[_0xddab('0x9')](),controller[_0xddab('0xd')]);router['post']('/',auth[_0xddab('0x9')](),controller[_0xddab('0xe')]);router[_0xddab('0xf')](_0xddab('0x10'),auth[_0xddab('0x9')](),controller[_0xddab('0x11')]);router['delete'](_0xddab('0x10'),auth[_0xddab('0x9')](),controller[_0xddab('0x12')]);module[_0xddab('0x13')]=router; \ No newline at end of file +var _0x7676=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x27bc9c,_0x2fdd47){var _0x389810=function(_0x272f2d){while(--_0x272f2d){_0x27bc9c['push'](_0x27bc9c['shift']());}};_0x389810(++_0x2fdd47);}(_0x7676,0xb0));var _0x6767=function(_0x59a9cb,_0x3a2730){_0x59a9cb=_0x59a9cb-0x0;var _0x39080c=_0x7676[_0x59a9cb];return _0x39080c;};'use strict';var multer=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var path=require(_0x6767('0x2'));var timeout=require(_0x6767('0x3'));var express=require(_0x6767('0x4'));var router=express[_0x6767('0x5')]();var fs_extra=require(_0x6767('0x6'));var auth=require(_0x6767('0x7'));var interaction=require(_0x6767('0x8'));var config=require(_0x6767('0x9'));var controller=require(_0x6767('0xa'));router[_0x6767('0xb')]('/',auth[_0x6767('0xc')](),controller[_0x6767('0xd')]);router[_0x6767('0xb')](_0x6767('0xe'),auth[_0x6767('0xc')](),controller[_0x6767('0xf')]);router[_0x6767('0xb')](_0x6767('0x10'),auth[_0x6767('0xc')](),controller[_0x6767('0x11')]);router[_0x6767('0x12')]('/',auth[_0x6767('0xc')](),controller[_0x6767('0x13')]);router[_0x6767('0x14')](_0x6767('0x10'),auth[_0x6767('0xc')](),controller['update']);router[_0x6767('0x15')](_0x6767('0x10'),auth[_0x6767('0xc')](),controller[_0x6767('0x16')]);module[_0x6767('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 78dc88f..310b020 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 _0x2361=['exports','STRING','sequelize'];(function(_0x487a08,_0x5b68d1){var _0x4ca795=function(_0x118602){while(--_0x118602){_0x487a08['push'](_0x487a08['shift']());}};_0x4ca795(++_0x5b68d1);}(_0x2361,0x1ca));var _0x1236=function(_0x46c297,_0x13d386){_0x46c297=_0x46c297-0x0;var _0x4274f3=_0x2361[_0x46c297];return _0x4274f3;};'use strict';var Sequelize=require(_0x1236('0x0'));module[_0x1236('0x1')]={'uniqueid':{'type':Sequelize[_0x1236('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1236('0x2')]},'callerid':{'type':Sequelize[_0x1236('0x2')]}}; \ No newline at end of file +var _0x9053=['exports','STRING'];(function(_0x157212,_0x111913){var _0x49add4=function(_0x3bedd8){while(--_0x3bedd8){_0x157212['push'](_0x157212['shift']());}};_0x49add4(++_0x111913);}(_0x9053,0x1e4));var _0x3905=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x9053[_0x26a906];return _0x495575;};'use strict';var Sequelize=require('sequelize');module[_0x3905('0x0')]={'uniqueid':{'type':Sequelize[_0x3905('0x1')]},'node':{'type':Sequelize[_0x3905('0x1')]},'application':{'type':Sequelize[_0x3905('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3905('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 15ec50b..33a4820 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 _0x8c12=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','lodash','crypto','desk.js','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','sendStatus','status','offset'];(function(_0x3bc83a,_0x163221){var _0x309771=function(_0x5eeb70){while(--_0x5eeb70){_0x3bc83a['push'](_0x3bc83a['shift']());}};_0x309771(++_0x163221);}(_0x8c12,0x1f2));var _0x28c1=function(_0x206ea7,_0x20772b){_0x206ea7=_0x206ea7-0x0;var _0xfe6504=_0x8c12[_0x206ea7];return _0xfe6504;};'use strict';var emlformat=require(_0x28c1('0x0'));var rimraf=require(_0x28c1('0x1'));var zipdir=require(_0x28c1('0x2'));var jsonpatch=require(_0x28c1('0x3'));var rp=require(_0x28c1('0x4'));var moment=require(_0x28c1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x28c1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28c1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28c1('0x8'));var squel=require('squel');var crypto=require(_0x28c1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x28c1('0xa'));var toCsv=require(_0x28c1('0xb'));var querystring=require(_0x28c1('0xc'));var Papa=require(_0x28c1('0xd'));var Redis=require(_0x28c1('0xe'));var authService=require(_0x28c1('0xf'));var qs=require(_0x28c1('0x10'));var as=require(_0x28c1('0x11'));var hardwareService=require(_0x28c1('0x12'));var logger=require(_0x28c1('0x13'))(_0x28c1('0x14'));var utils=require('../../config/utils');var config=require(_0x28c1('0x15'));var licenseUtil=require(_0x28c1('0x16'));var db=require(_0x28c1('0x17'))['db'];function respondWithStatusCode(_0x2cd1f1,_0x4e6317){_0x4e6317=_0x4e6317||0xcc;return function(_0x41cfb0){if(_0x41cfb0){return _0x2cd1f1[_0x28c1('0x18')](_0x4e6317);}return _0x2cd1f1['status'](_0x4e6317)['end']();};}function respondWithResult(_0x52cd54,_0x3a32c5){_0x3a32c5=_0x3a32c5||0xc8;return function(_0x125fa4){if(_0x125fa4){return _0x52cd54[_0x28c1('0x19')](_0x3a32c5)['json'](_0x125fa4);}};}function respondWithFilteredResult(_0x41fc4b,_0x5a959c){return function(_0x52dfc2){if(_0x52dfc2){var _0x22d9ec=typeof _0x5a959c[_0x28c1('0x1a')]===_0x28c1('0x1b')&&typeof _0x5a959c[_0x28c1('0x1c')]===_0x28c1('0x1b');var _0x26914c=_0x52dfc2[_0x28c1('0x1d')];var _0x323758=_0x22d9ec?0x0:_0x5a959c[_0x28c1('0x1a')];var _0x2891cd=_0x22d9ec?_0x52dfc2[_0x28c1('0x1d')]:_0x5a959c['offset']+_0x5a959c[_0x28c1('0x1c')];var _0x580162;if(_0x2891cd>=_0x26914c){_0x2891cd=_0x26914c;_0x580162=0xc8;}else{_0x580162=0xce;}_0x41fc4b[_0x28c1('0x19')](_0x580162);return _0x41fc4b[_0x28c1('0x1e')](_0x28c1('0x1f'),_0x323758+'-'+_0x2891cd+'/'+_0x26914c)[_0x28c1('0x20')](_0x52dfc2);}return null;};}function patchUpdates(_0x51a48f){return function(_0x477f8c){try{jsonpatch[_0x28c1('0x21')](_0x477f8c,_0x51a48f,!![]);}catch(_0x45ed80){return BPromise[_0x28c1('0x22')](_0x45ed80);}return _0x477f8c[_0x28c1('0x23')]();};}function saveUpdates(_0x4fc5e2,_0x11cbed){return function(_0x5a394b){if(_0x5a394b){return _0x5a394b[_0x28c1('0x24')](_0x4fc5e2)[_0x28c1('0x25')](function(_0x16dd60){return _0x16dd60;});}return null;};}function removeEntity(_0x1a8efc,_0x5e0834){return function(_0x4f3436){if(_0x4f3436){return _0x4f3436[_0x28c1('0x26')]()[_0x28c1('0x25')](function(){_0x1a8efc[_0x28c1('0x19')](0xcc)[_0x28c1('0x27')]();});}};}function handleEntityNotFound(_0x1a8ea3,_0x26c20a){return function(_0x264d83){if(!_0x264d83){_0x1a8ea3[_0x28c1('0x18')](0x194);}return _0x264d83;};}function handleError(_0x16eb77,_0x56adea){_0x56adea=_0x56adea||0x1f4;return function(_0x8a22e3){logger[_0x28c1('0x28')](_0x8a22e3['stack']);if(_0x8a22e3[_0x28c1('0x29')]){delete _0x8a22e3[_0x28c1('0x29')];}_0x16eb77[_0x28c1('0x19')](_0x56adea)[_0x28c1('0x2a')](_0x8a22e3);};}exports[_0x28c1('0x2b')]=function(_0x4e39dc,_0x542f00){var _0x741237={},_0x12a18c={},_0x3d6618={'count':0x0,'rows':[]};var _0x330792=_[_0x28c1('0x2c')](db[_0x28c1('0x2d')][_0x28c1('0x2e')],function(_0x2eccfd){return{'name':_0x2eccfd[_0x28c1('0x2f')],'type':_0x2eccfd['type']['key']};});_0x12a18c[_0x28c1('0x30')]=_['map'](_0x330792,_0x28c1('0x29'));_0x12a18c[_0x28c1('0x31')]=_[_0x28c1('0x32')](_0x4e39dc[_0x28c1('0x31')]);_0x12a18c[_0x28c1('0x33')]=_[_0x28c1('0x34')](_0x12a18c[_0x28c1('0x30')],_0x12a18c[_0x28c1('0x31')]);_0x741237[_0x28c1('0x35')]=_[_0x28c1('0x34')](_0x12a18c[_0x28c1('0x30')],qs[_0x28c1('0x36')](_0x4e39dc['query'][_0x28c1('0x36')]));_0x741237[_0x28c1('0x35')]=_0x741237['attributes']['length']?_0x741237[_0x28c1('0x35')]:_0x12a18c[_0x28c1('0x30')];if(!_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x37')]('nolimit')){_0x741237[_0x28c1('0x1c')]=qs['limit'](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x1c')]);_0x741237[_0x28c1('0x1a')]=qs['offset'](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x1a')]);}_0x741237[_0x28c1('0x38')]=qs[_0x28c1('0x39')](_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x39')]);_0x741237[_0x28c1('0x3a')]=qs['filters'](_[_0x28c1('0x3b')](_0x4e39dc[_0x28c1('0x31')],_0x12a18c['filters']),_0x330792);if(_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x3c')]){_0x741237['where']=_[_0x28c1('0x3d')](_0x741237[_0x28c1('0x3a')],{'$or':_[_0x28c1('0x2c')](_0x330792,function(_0x1eb064){if(_0x1eb064[_0x28c1('0x3e')]!=='VIRTUAL'){var _0x5d2bf5={};_0x5d2bf5[_0x1eb064[_0x28c1('0x29')]]={'$like':'%'+_0x4e39dc[_0x28c1('0x31')][_0x28c1('0x3c')]+'%'};return _0x5d2bf5;}})});}_0x741237=_[_0x28c1('0x3d')]({},_0x741237,_0x4e39dc[_0x28c1('0x3f')]);var _0x329143={'where':_0x741237[_0x28c1('0x3a')]};return db[_0x28c1('0x2d')][_0x28c1('0x1d')](_0x329143)[_0x28c1('0x25')](function(_0x4051a4){_0x3d6618[_0x28c1('0x1d')]=_0x4051a4;if(_0x4e39dc['query'][_0x28c1('0x40')]){_0x741237[_0x28c1('0x41')]=[{'all':!![]}];}return db[_0x28c1('0x2d')][_0x28c1('0x42')](_0x741237);})[_0x28c1('0x25')](function(_0xc1c298){_0x3d6618[_0x28c1('0x43')]=_0xc1c298;return _0x3d6618;})[_0x28c1('0x25')](respondWithFilteredResult(_0x542f00,_0x741237))[_0x28c1('0x44')](handleError(_0x542f00,null));};exports['show']=function(_0x333a7a,_0x4adbb2){var _0x140eeb={'raw':!![],'where':{'id':_0x333a7a[_0x28c1('0x45')]['id']}},_0x1221d1={};_0x1221d1[_0x28c1('0x30')]=_[_0x28c1('0x32')](db[_0x28c1('0x2d')]['rawAttributes']);_0x1221d1[_0x28c1('0x31')]=_['keys'](_0x333a7a[_0x28c1('0x31')]);_0x1221d1[_0x28c1('0x33')]=_[_0x28c1('0x34')](_0x1221d1['model'],_0x1221d1['query']);_0x140eeb[_0x28c1('0x35')]=_[_0x28c1('0x34')](_0x1221d1[_0x28c1('0x30')],qs['fields'](_0x333a7a[_0x28c1('0x31')][_0x28c1('0x36')]));_0x140eeb[_0x28c1('0x35')]=_0x140eeb[_0x28c1('0x35')][_0x28c1('0x46')]?_0x140eeb['attributes']:_0x1221d1['model'];if(_0x333a7a[_0x28c1('0x31')][_0x28c1('0x40')]){_0x140eeb[_0x28c1('0x41')]=[{'all':!![]}];}_0x140eeb=_[_0x28c1('0x3d')]({},_0x140eeb,_0x333a7a['options']);return db['SquareDetailsReport'][_0x28c1('0x47')](_0x140eeb)['then'](handleEntityNotFound(_0x4adbb2,null))['then'](respondWithResult(_0x4adbb2,null))['catch'](handleError(_0x4adbb2,null));};exports[_0x28c1('0x48')]=function(_0x3eecf2,_0x3ee7b1){return db[_0x28c1('0x2d')][_0x28c1('0x48')](_0x3eecf2[_0x28c1('0x49')],{})[_0x28c1('0x25')](respondWithResult(_0x3ee7b1,0xc9))[_0x28c1('0x44')](handleError(_0x3ee7b1,null));};exports[_0x28c1('0x24')]=function(_0xd8f098,_0x38f170){if(_0xd8f098[_0x28c1('0x49')]['id']){delete _0xd8f098[_0x28c1('0x49')]['id'];}return db[_0x28c1('0x2d')]['find']({'where':{'id':_0xd8f098[_0x28c1('0x45')]['id']}})[_0x28c1('0x25')](handleEntityNotFound(_0x38f170,null))[_0x28c1('0x25')](saveUpdates(_0xd8f098[_0x28c1('0x49')],null))[_0x28c1('0x25')](respondWithResult(_0x38f170,null))[_0x28c1('0x44')](handleError(_0x38f170,null));};exports['destroy']=function(_0x1412e6,_0x34b6bc){return db['SquareDetailsReport'][_0x28c1('0x47')]({'where':{'id':_0x1412e6[_0x28c1('0x45')]['id']}})[_0x28c1('0x25')](handleEntityNotFound(_0x34b6bc,null))['then'](removeEntity(_0x34b6bc,null))['catch'](handleError(_0x34b6bc,null));};exports[_0x28c1('0x4a')]=function(_0x3a8a32,_0x1b31d7){return db[_0x28c1('0x2d')][_0x28c1('0x4a')]()[_0x28c1('0x25')](respondWithResult(_0x1b31d7,null))[_0x28c1('0x44')](handleError(_0x1b31d7,null));}; \ No newline at end of file +var _0xc49e=['includeAll','include','findAll','catch','show','params','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','save','then','destroy','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc49e,0x1a8));var _0xec49=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xc49e[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0xec49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec49('0x1'));var jsonpatch=require(_0xec49('0x2'));var rp=require(_0xec49('0x3'));var moment=require(_0xec49('0x4'));var BPromise=require(_0xec49('0x5'));var Mustache=require(_0xec49('0x6'));var util=require('util');var path=require(_0xec49('0x7'));var sox=require(_0xec49('0x8'));var csv=require(_0xec49('0x9'));var ejs=require(_0xec49('0xa'));var fs=require('fs');var fs_extra=require(_0xec49('0xb'));var _=require(_0xec49('0xc'));var squel=require('squel');var crypto=require(_0xec49('0xd'));var jsforce=require(_0xec49('0xe'));var deskjs=require(_0xec49('0xf'));var toCsv=require(_0xec49('0x9'));var querystring=require(_0xec49('0x10'));var Papa=require(_0xec49('0x11'));var Redis=require(_0xec49('0x12'));var authService=require(_0xec49('0x13'));var qs=require(_0xec49('0x14'));var as=require(_0xec49('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xec49('0x16'));var config=require(_0xec49('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xec49('0x18'))['db'];function respondWithStatusCode(_0x506692,_0x115cb1){_0x115cb1=_0x115cb1||0xcc;return function(_0x51bcca){if(_0x51bcca){return _0x506692['sendStatus'](_0x115cb1);}return _0x506692[_0xec49('0x19')](_0x115cb1)[_0xec49('0x1a')]();};}function respondWithResult(_0x4e3f0e,_0xf850f1){_0xf850f1=_0xf850f1||0xc8;return function(_0x586155){if(_0x586155){return _0x4e3f0e['status'](_0xf850f1)[_0xec49('0x1b')](_0x586155);}};}function respondWithFilteredResult(_0x45922f,_0x440e8a){return function(_0x42171a){if(_0x42171a){var _0x27e1d2=typeof _0x440e8a[_0xec49('0x1c')]==='undefined'&&typeof _0x440e8a[_0xec49('0x1d')]===_0xec49('0x1e');var _0x3a6bc0=_0x42171a['count'];var _0x844d85=_0x27e1d2?0x0:_0x440e8a[_0xec49('0x1c')];var _0x513615=_0x27e1d2?_0x42171a[_0xec49('0x1f')]:_0x440e8a['offset']+_0x440e8a[_0xec49('0x1d')];var _0x103463;if(_0x513615>=_0x3a6bc0){_0x513615=_0x3a6bc0;_0x103463=0xc8;}else{_0x103463=0xce;}_0x45922f['status'](_0x103463);return _0x45922f[_0xec49('0x20')]('Content-Range',_0x844d85+'-'+_0x513615+'/'+_0x3a6bc0)[_0xec49('0x1b')](_0x42171a);}return null;};}function patchUpdates(_0x4e4fbe){return function(_0x50fc1d){try{jsonpatch['apply'](_0x50fc1d,_0x4e4fbe,!![]);}catch(_0x171616){return BPromise['reject'](_0x171616);}return _0x50fc1d[_0xec49('0x21')]();};}function saveUpdates(_0x4646ac,_0x22cec1){return function(_0x349ee4){if(_0x349ee4){return _0x349ee4['update'](_0x4646ac)[_0xec49('0x22')](function(_0x5cce60){return _0x5cce60;});}return null;};}function removeEntity(_0x1cc1c2,_0x4755d6){return function(_0x4cfde5){if(_0x4cfde5){return _0x4cfde5[_0xec49('0x23')]()[_0xec49('0x22')](function(){_0x1cc1c2['status'](0xcc)[_0xec49('0x1a')]();});}};}function handleEntityNotFound(_0x4a9145,_0x527e91){return function(_0x1f7162){if(!_0x1f7162){_0x4a9145['sendStatus'](0x194);}return _0x1f7162;};}function handleError(_0x5c36c8,_0x44987a){_0x44987a=_0x44987a||0x1f4;return function(_0x4ab449){logger['error'](_0x4ab449['stack']);if(_0x4ab449[_0xec49('0x24')]){delete _0x4ab449[_0xec49('0x24')];}_0x5c36c8[_0xec49('0x19')](_0x44987a)[_0xec49('0x25')](_0x4ab449);};}exports[_0xec49('0x26')]=function(_0x2db711,_0x5dce60){var _0xf79bfe={},_0x430380={},_0x1068de={'count':0x0,'rows':[]};var _0x5a915b=_[_0xec49('0x27')](db[_0xec49('0x28')][_0xec49('0x29')],function(_0x42d195){return{'name':_0x42d195[_0xec49('0x2a')],'type':_0x42d195[_0xec49('0x2b')]['key']};});_0x430380['model']=_[_0xec49('0x27')](_0x5a915b,_0xec49('0x24'));_0x430380[_0xec49('0x2c')]=_[_0xec49('0x2d')](_0x2db711[_0xec49('0x2c')]);_0x430380[_0xec49('0x2e')]=_['intersection'](_0x430380[_0xec49('0x2f')],_0x430380[_0xec49('0x2c')]);_0xf79bfe[_0xec49('0x30')]=_[_0xec49('0x31')](_0x430380[_0xec49('0x2f')],qs['fields'](_0x2db711[_0xec49('0x2c')][_0xec49('0x32')]));_0xf79bfe[_0xec49('0x30')]=_0xf79bfe[_0xec49('0x30')][_0xec49('0x33')]?_0xf79bfe[_0xec49('0x30')]:_0x430380[_0xec49('0x2f')];if(!_0x2db711[_0xec49('0x2c')][_0xec49('0x34')]('nolimit')){_0xf79bfe['limit']=qs[_0xec49('0x1d')](_0x2db711[_0xec49('0x2c')][_0xec49('0x1d')]);_0xf79bfe[_0xec49('0x1c')]=qs[_0xec49('0x1c')](_0x2db711[_0xec49('0x2c')][_0xec49('0x1c')]);}_0xf79bfe[_0xec49('0x35')]=qs[_0xec49('0x36')](_0x2db711[_0xec49('0x2c')]['sort']);_0xf79bfe[_0xec49('0x37')]=qs[_0xec49('0x2e')](_['pick'](_0x2db711[_0xec49('0x2c')],_0x430380[_0xec49('0x2e')]),_0x5a915b);if(_0x2db711[_0xec49('0x2c')]['filter']){_0xf79bfe[_0xec49('0x37')]=_[_0xec49('0x38')](_0xf79bfe[_0xec49('0x37')],{'$or':_[_0xec49('0x27')](_0x5a915b,function(_0x1cd6ea){if(_0x1cd6ea[_0xec49('0x2b')]!==_0xec49('0x39')){var _0x1f70d1={};_0x1f70d1[_0x1cd6ea[_0xec49('0x24')]]={'$like':'%'+_0x2db711[_0xec49('0x2c')]['filter']+'%'};return _0x1f70d1;}})});}_0xf79bfe=_[_0xec49('0x38')]({},_0xf79bfe,_0x2db711[_0xec49('0x3a')]);var _0x58ceb9={'where':_0xf79bfe['where']};return db[_0xec49('0x28')][_0xec49('0x1f')](_0x58ceb9)['then'](function(_0x19fd5e){_0x1068de[_0xec49('0x1f')]=_0x19fd5e;if(_0x2db711[_0xec49('0x2c')][_0xec49('0x3b')]){_0xf79bfe[_0xec49('0x3c')]=[{'all':!![]}];}return db[_0xec49('0x28')][_0xec49('0x3d')](_0xf79bfe);})[_0xec49('0x22')](function(_0x5458bc){_0x1068de['rows']=_0x5458bc;return _0x1068de;})[_0xec49('0x22')](respondWithFilteredResult(_0x5dce60,_0xf79bfe))[_0xec49('0x3e')](handleError(_0x5dce60,null));};exports[_0xec49('0x3f')]=function(_0x38d1c3,_0x42f9da){var _0x4c07e9={'raw':!![],'where':{'id':_0x38d1c3[_0xec49('0x40')]['id']}},_0x540f7f={};_0x540f7f[_0xec49('0x2f')]=_[_0xec49('0x2d')](db[_0xec49('0x28')][_0xec49('0x29')]);_0x540f7f[_0xec49('0x2c')]=_[_0xec49('0x2d')](_0x38d1c3['query']);_0x540f7f[_0xec49('0x2e')]=_['intersection'](_0x540f7f['model'],_0x540f7f[_0xec49('0x2c')]);_0x4c07e9['attributes']=_[_0xec49('0x31')](_0x540f7f[_0xec49('0x2f')],qs['fields'](_0x38d1c3[_0xec49('0x2c')][_0xec49('0x32')]));_0x4c07e9['attributes']=_0x4c07e9[_0xec49('0x30')][_0xec49('0x33')]?_0x4c07e9['attributes']:_0x540f7f[_0xec49('0x2f')];if(_0x38d1c3[_0xec49('0x2c')][_0xec49('0x3b')]){_0x4c07e9[_0xec49('0x3c')]=[{'all':!![]}];}_0x4c07e9=_['merge']({},_0x4c07e9,_0x38d1c3[_0xec49('0x3a')]);return db[_0xec49('0x28')][_0xec49('0x41')](_0x4c07e9)[_0xec49('0x22')](handleEntityNotFound(_0x42f9da,null))[_0xec49('0x22')](respondWithResult(_0x42f9da,null))[_0xec49('0x3e')](handleError(_0x42f9da,null));};exports[_0xec49('0x42')]=function(_0x1f56a1,_0x2dad63){return db[_0xec49('0x28')][_0xec49('0x42')](_0x1f56a1['body'],{})[_0xec49('0x22')](respondWithResult(_0x2dad63,0xc9))[_0xec49('0x3e')](handleError(_0x2dad63,null));};exports[_0xec49('0x43')]=function(_0xe7d5d1,_0x1b5310){if(_0xe7d5d1[_0xec49('0x44')]['id']){delete _0xe7d5d1[_0xec49('0x44')]['id'];}return db[_0xec49('0x28')][_0xec49('0x41')]({'where':{'id':_0xe7d5d1[_0xec49('0x40')]['id']}})[_0xec49('0x22')](handleEntityNotFound(_0x1b5310,null))[_0xec49('0x22')](saveUpdates(_0xe7d5d1[_0xec49('0x44')],null))[_0xec49('0x22')](respondWithResult(_0x1b5310,null))['catch'](handleError(_0x1b5310,null));};exports['destroy']=function(_0x13ce6a,_0x1c2585){return db[_0xec49('0x28')][_0xec49('0x41')]({'where':{'id':_0x13ce6a['params']['id']}})[_0xec49('0x22')](handleEntityNotFound(_0x1c2585,null))[_0xec49('0x22')](removeEntity(_0x1c2585,null))[_0xec49('0x3e')](handleError(_0x1c2585,null));};exports['describe']=function(_0x530e49,_0x53a70f){return db[_0xec49('0x28')]['describe']()[_0xec49('0x22')](respondWithResult(_0x53a70f,null))[_0xec49('0x3e')](handleError(_0x53a70f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2f28cb5..286ca03 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 _0x21c5=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0xa9de90,_0x3f2c76){var _0x452b90=function(_0x105298){while(--_0x105298){_0xa9de90['push'](_0xa9de90['shift']());}};_0x452b90(++_0x3f2c76);}(_0x21c5,0xed));var _0x521c=function(_0x5114ba,_0x2dc0a5){_0x5114ba=_0x5114ba-0x0;var _0x4cd233=_0x21c5[_0x5114ba];return _0x4cd233;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var logger=require(_0x521c('0x2'))(_0x521c('0x3'));var moment=require(_0x521c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x521c('0x5'));var rimraf=require(_0x521c('0x6'));var config=require(_0x521c('0x7'));var attributes=require(_0x521c('0x8'));module[_0x521c('0x9')]=function(_0x4357a1,_0xc0b919){return _0x4357a1['define']('SquareDetailsReport',attributes,{'tableName':_0x521c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf3=['moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','lodash','../../config/logger'];(function(_0x838730,_0x431d8e){var _0x16d8a2=function(_0x46ea00){while(--_0x46ea00){_0x838730['push'](_0x838730['shift']());}};_0x16d8a2(++_0x431d8e);}(_0x4bf3,0x142));var _0x34bf=function(_0x35396c,_0x5a93e0){_0x35396c=_0x35396c-0x0;var _0x166f4b=_0x4bf3[_0x35396c];return _0x166f4b;};'use strict';var _=require(_0x34bf('0x0'));var util=require('util');var logger=require(_0x34bf('0x1'))('api');var moment=require(_0x34bf('0x2'));var BPromise=require(_0x34bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bf('0x4'));var rimraf=require(_0x34bf('0x5'));var config=require(_0x34bf('0x6'));var attributes=require(_0x34bf('0x7'));module['exports']=function(_0x15a893,_0x1289dc){return _0x15a893[_0x34bf('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 6ef2f9e..b4a676e 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 _0xb9be=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x240d52,_0x5a5b55){var _0x2910e0=function(_0x34ed38){while(--_0x34ed38){_0x240d52['push'](_0x240d52['shift']());}};_0x2910e0(++_0x5a5b55);}(_0xb9be,0xc5));var _0xeb9b=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb9be[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')](_0x21aca6[_0xeb9b('0x1b')],{'raw':_0x21aca6[_0xeb9b('0x1c')]?_0x21aca6['options'][_0xeb9b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5d5f54){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x5d5f54));_0x3cbe3e(_0x5d5f54);})[_0xeb9b('0x17')](function(_0x37d7e0){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x37d7e0[_0xeb9b('0x16')],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x37d7e0[_0xeb9b('0x16')]));});});}; \ No newline at end of file +var _0xe605=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw'];(function(_0x37959c,_0x2137e2){var _0x22ebd4=function(_0x447e8c){while(--_0x447e8c){_0x37959c['push'](_0x37959c['shift']());}};_0x22ebd4(++_0x2137e2);}(_0xe605,0x92));var _0x5e60=function(_0x39769b,_0x3459d9){_0x39769b=_0x39769b-0x0;var _0x11b705=_0xe605[_0x39769b];return _0x11b705;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')](_0x5c485d[_0x5e60('0x19')],{'raw':_0x5c485d[_0x5e60('0x1a')]?_0x5c485d[_0x5e60('0x1a')][_0x5e60('0x1b')]===undefined?!![]:![]:!![]})[_0x5e60('0xd')](function(_0x524c93){logger[_0x5e60('0xe')](_0x5e60('0x16'),_0x5c485d);logger[_0x5e60('0x11')]('CreateSquareDetailsReport',_0x5c485d,JSON[_0x5e60('0x1c')](_0x524c93));_0x22d718(_0x524c93);})['catch'](function(_0x376069){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x376069[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x376069[_0x5e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1a7f5c6..f09cdc5 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 _0x1314=['./system.controller','get','isAuthenticated','index','exports','express'];(function(_0x2d67d,_0x540bef){var _0x1423cb=function(_0x188e7f){while(--_0x188e7f){_0x2d67d['push'](_0x2d67d['shift']());}};_0x1423cb(++_0x540bef);}(_0x1314,0x17f));var _0x4131=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x1314[_0xf55e73];return _0x116b99;};'use strict';var express=require(_0x4131('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4131('0x1'));router[_0x4131('0x2')]('/',auth[_0x4131('0x3')](),controller[_0x4131('0x4')]);router[_0x4131('0x2')]('/process/:pid/kill',auth[_0x4131('0x3')](),controller['killProcess']);module[_0x4131('0x5')]=router; \ No newline at end of file +var _0xa505=['/process/:pid/kill','isAuthenticated','killProcess','Router','../../components/auth/service','./system.controller','get','index'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0xa505,0x19b));var _0x5a50=function(_0x51822a,_0x253233){_0x51822a=_0x51822a-0x0;var _0x2a4856=_0xa505[_0x51822a];return _0x2a4856;};'use strict';var express=require('express');var router=express[_0x5a50('0x0')]();var auth=require(_0x5a50('0x1'));var controller=require(_0x5a50('0x2'));router[_0x5a50('0x3')]('/',auth['isAuthenticated'](),controller[_0x5a50('0x4')]);router[_0x5a50('0x3')](_0x5a50('0x5'),auth[_0x5a50('0x6')](),controller[_0x5a50('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index db921bb..57626dc 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 _0x8a41=['error','inspect','name','status','index','getAllData','json','killProcess','params','pid','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','../../config/logger','util','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8a41,0x1bd));var _0x18a4=function(_0x1f3fb0,_0x190378){_0x1f3fb0=_0x1f3fb0-0x0;var _0x252315=_0x8a41[_0x1f3fb0];return _0x252315;};'use strict';var info=require(_0x18a4('0x0'));var exec=require(_0x18a4('0x1'))['exec'];var logger=require(_0x18a4('0x2'))('api');var util=require(_0x18a4('0x3'));var BPromise=require('bluebird');var _=require(_0x18a4('0x4'));function handleError(_0x16b745,_0x2f29ee,_0x363551){_0x2f29ee=_0x2f29ee||0x1f4;return function(_0x10e3f6){logger[_0x18a4('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x363551,_0x2f29ee,util[_0x18a4('0x6')](_0x10e3f6,{'showHidden':![],'depth':null}));delete _0x10e3f6[_0x18a4('0x7')];_0x16b745[_0x18a4('0x8')](_0x2f29ee)['send'](_0x10e3f6);};}exports[_0x18a4('0x9')]=function(_0x597274,_0x2aff3c){return info[_0x18a4('0xa')]()['then'](function(_0x42f883){return _0x2aff3c[_0x18a4('0x8')](0xc8)[_0x18a4('0xb')](_0x42f883);})['catch'](function(_0x3a7f29){return _0x2aff3c[_0x18a4('0x8')](0x1f4)[_0x18a4('0xb')](_0x3a7f29);});};exports[_0x18a4('0xc')]=function(_0x2c839b,_0x38524c){var _0x246a7c=['components/import/cm'];return new BPromise(function(_0x41622b,_0x2b8ca6){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')]),function(_0x173a6e,_0x5e7173,_0x564292){if(_0x173a6e){return _0x2b8ca6(_0x173a6e);}return _0x41622b(_0x5e7173);});})[_0x18a4('0xf')](function(_0x28b175){var _0x580b0e=![];var _0x383be4=_0x28b175[_0x18a4('0x10')](/\n/);for(var _0x50fa12=0x0,_0x3f2629=_0x246a7c[_0x18a4('0x11')];_0x50fa12<_0x3f2629,_0x580b0e===![];_0x50fa12+=0x1){if(_0x28b175[_0x18a4('0x12')](_0x246a7c[_0x50fa12])>=0x0){_0x580b0e=!![];}}if(!_0x580b0e){throw new Error(util[_0x18a4('0x13')](_0x18a4('0x14'),_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')]));}process[_0x18a4('0x15')](_0x2c839b[_0x18a4('0xd')]['pid'],_0x18a4('0x16'));return _0x38524c[_0x18a4('0x8')](0xc8)[_0x18a4('0xb')]({'message':util[_0x18a4('0x13')](_0x18a4('0x17'),_0x2c839b[_0x18a4('0xd')][_0x18a4('0xe')])});})[_0x18a4('0x18')](handleError(_0x38524c,null,'killProcess'));}; \ No newline at end of file +var _0x96e5=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','kill','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash'];(function(_0x292ff2,_0x451743){var _0x50ba8f=function(_0x610ec8){while(--_0x610ec8){_0x292ff2['push'](_0x292ff2['shift']());}};_0x50ba8f(++_0x451743);}(_0x96e5,0xa7));var _0x596e=function(_0x2b9217,_0xd103d5){_0x2b9217=_0x2b9217-0x0;var _0x583193=_0x96e5[_0x2b9217];return _0x583193;};'use strict';var info=require(_0x596e('0x0'));var exec=require(_0x596e('0x1'))[_0x596e('0x2')];var logger=require(_0x596e('0x3'))(_0x596e('0x4'));var util=require(_0x596e('0x5'));var BPromise=require(_0x596e('0x6'));var _=require(_0x596e('0x7'));function handleError(_0x18b846,_0x435d75,_0x27a9c4){_0x435d75=_0x435d75||0x1f4;return function(_0x4fdc35){logger[_0x596e('0x8')](_0x596e('0x9'),_0x27a9c4,_0x435d75,util[_0x596e('0xa')](_0x4fdc35,{'showHidden':![],'depth':null}));delete _0x4fdc35['name'];_0x18b846[_0x596e('0xb')](_0x435d75)[_0x596e('0xc')](_0x4fdc35);};}exports['index']=function(_0x592e64,_0x1f0a61){return info['getAllData']()['then'](function(_0x33312d){return _0x1f0a61[_0x596e('0xb')](0xc8)[_0x596e('0xd')](_0x33312d);})[_0x596e('0xe')](function(_0x590974){return _0x1f0a61[_0x596e('0xb')](0x1f4)['json'](_0x590974);});};exports['killProcess']=function(_0x438327,_0x41b7c9){var _0xf5b449=[_0x596e('0xf')];return new BPromise(function(_0x1ff7d6,_0x4cdc2b){return exec(util[_0x596e('0x10')](_0x596e('0x11'),_0x438327[_0x596e('0x12')][_0x596e('0x13')]),function(_0xc19e1a,_0xe0889a,_0x39f6ef){if(_0xc19e1a){return _0x4cdc2b(_0xc19e1a);}return _0x1ff7d6(_0xe0889a);});})[_0x596e('0x14')](function(_0x2357bb){var _0x55ba05=![];var _0x2cf522=_0x2357bb[_0x596e('0x15')](/\n/);for(var _0x2a1f3f=0x0,_0x521923=_0xf5b449['length'];_0x2a1f3f<_0x521923,_0x55ba05===![];_0x2a1f3f+=0x1){if(_0x2357bb[_0x596e('0x16')](_0xf5b449[_0x2a1f3f])>=0x0){_0x55ba05=!![];}}if(!_0x55ba05){throw new Error(util[_0x596e('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x438327[_0x596e('0x12')][_0x596e('0x13')]));}process[_0x596e('0x17')](_0x438327[_0x596e('0x12')][_0x596e('0x13')],'SIGINT');return _0x41b7c9['status'](0xc8)['json']({'message':util[_0x596e('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x438327[_0x596e('0x12')][_0x596e('0x13')])});})['catch'](handleError(_0x41b7c9,null,_0x596e('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e42ad32..9b34e4c 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 _0xb43b=['../../components/interaction/service','../../config/environment','./tag.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x218830,_0x52ad5e){var _0x479d57=function(_0x383d89){while(--_0x383d89){_0x218830['push'](_0x218830['shift']());}};_0x479d57(++_0x52ad5e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30e93b,_0x314904){_0x30e93b=_0x30e93b-0x0;var _0x1d749c=_0xb43b[_0x30e93b];return _0x1d749c;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file +var _0x008c=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x008c,0x188));var _0xc008=function(_0xc0cbf,_0x22f493){_0xc0cbf=_0xc0cbf-0x0;var _0x24a0ac=_0x008c[_0xc0cbf];return _0x24a0ac;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 47cf09c..a5389f8 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 _0x2fee=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fee,0x11a));var _0xe2fe=function(_0x439f45,_0x542c73){_0x439f45=_0x439f45-0x0;var _0x6aa2e3=_0x2fee[_0x439f45];return _0x6aa2e3;};'use strict';var Sequelize=require(_0xe2fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2fe('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe2fe('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xe2fe('0x1')]}}; \ No newline at end of file +var _0xf6ed=['sequelize','STRING','name'];(function(_0x38ce78,_0xe76eab){var _0x2042a4=function(_0x4e3bb){while(--_0x4e3bb){_0x38ce78['push'](_0x38ce78['shift']());}};_0x2042a4(++_0xe76eab);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x3f8f90,_0x5ba6f8){_0x3f8f90=_0x3f8f90-0x0;var _0x556a10=_0xf6ed[_0x3f8f90];return _0x556a10;};'use strict';var Sequelize=require(_0xdf6e('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf6e('0x1')],'unique':_0xdf6e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdf6e('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6ad1fc9..760d8ca 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 _0x5d87=['stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','filter','where','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','update','then','destroy','get','Tags'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5d87,0x1b0));var _0x75d8=function(_0x53882e,_0x28f754){_0x53882e=_0x53882e-0x0;var _0x1f7edd=_0x5d87[_0x53882e];return _0x1f7edd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75d8('0x0'));var zipdir=require(_0x75d8('0x1'));var jsonpatch=require(_0x75d8('0x2'));var rp=require(_0x75d8('0x3'));var moment=require(_0x75d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d8('0x5'));var util=require(_0x75d8('0x6'));var path=require('path');var sox=require(_0x75d8('0x7'));var csv=require(_0x75d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d8('0x9'));var _=require(_0x75d8('0xa'));var squel=require(_0x75d8('0xb'));var crypto=require(_0x75d8('0xc'));var jsforce=require(_0x75d8('0xd'));var deskjs=require(_0x75d8('0xe'));var toCsv=require(_0x75d8('0x8'));var querystring=require(_0x75d8('0xf'));var Papa=require(_0x75d8('0x10'));var Redis=require(_0x75d8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x75d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d8('0x13'));var logger=require(_0x75d8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x75d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75d8('0x16'))['db'];function respondWithStatusCode(_0x4558c4,_0x4453cb){_0x4453cb=_0x4453cb||0xcc;return function(_0xa9764b){if(_0xa9764b){return _0x4558c4[_0x75d8('0x17')](_0x4453cb);}return _0x4558c4[_0x75d8('0x18')](_0x4453cb)[_0x75d8('0x19')]();};}function respondWithResult(_0x323960,_0x5027c4){_0x5027c4=_0x5027c4||0xc8;return function(_0x9d61a0){if(_0x9d61a0){return _0x323960['status'](_0x5027c4)[_0x75d8('0x1a')](_0x9d61a0);}};}function respondWithFilteredResult(_0x48f23e,_0xa82b5c){return function(_0xb269b1){if(_0xb269b1){var _0x12ba5a=typeof _0xa82b5c[_0x75d8('0x1b')]===_0x75d8('0x1c')&&typeof _0xa82b5c['limit']===_0x75d8('0x1c');var _0x4504d0=_0xb269b1[_0x75d8('0x1d')];var _0x320352=_0x12ba5a?0x0:_0xa82b5c['offset'];var _0x58e4ae=_0x12ba5a?_0xb269b1['count']:_0xa82b5c[_0x75d8('0x1b')]+_0xa82b5c['limit'];var _0x4eacf8;if(_0x58e4ae>=_0x4504d0){_0x58e4ae=_0x4504d0;_0x4eacf8=0xc8;}else{_0x4eacf8=0xce;}_0x48f23e['status'](_0x4eacf8);return _0x48f23e['set'](_0x75d8('0x1e'),_0x320352+'-'+_0x58e4ae+'/'+_0x4504d0)[_0x75d8('0x1a')](_0xb269b1);}return null;};}function patchUpdates(_0x421d1c){return function(_0x205b63){try{jsonpatch['apply'](_0x205b63,_0x421d1c,!![]);}catch(_0xb2bd8b){return BPromise['reject'](_0xb2bd8b);}return _0x205b63['save']();};}function saveUpdates(_0x309160,_0x5873ad){return function(_0xf5b0ca){if(_0xf5b0ca){return _0xf5b0ca[_0x75d8('0x1f')](_0x309160)[_0x75d8('0x20')](function(_0x9c1005){return _0x9c1005;});}return null;};}function removeEntity(_0x1c90af,_0x403fad){return function(_0x147a84){if(_0x147a84){return _0x147a84[_0x75d8('0x21')]()[_0x75d8('0x20')](function(){var _0x2f8a5a=_0x147a84[_0x75d8('0x22')]({'plain':!![]});var _0x259b7d=_0x75d8('0x23');return db['UserProfileResource'][_0x75d8('0x21')]({'where':{'type':_0x259b7d,'resourceId':_0x2f8a5a['id']}})['then'](function(){return _0x147a84;});})[_0x75d8('0x20')](function(){_0x1c90af['status'](0xcc)[_0x75d8('0x19')]();});}};}function handleEntityNotFound(_0x1d9b9d,_0x171c3c){return function(_0x48cb47){if(!_0x48cb47){_0x1d9b9d[_0x75d8('0x17')](0x194);}return _0x48cb47;};}function handleError(_0x29108e,_0x227904){_0x227904=_0x227904||0x1f4;return function(_0x9593ef){logger['error'](_0x9593ef[_0x75d8('0x24')]);if(_0x9593ef['name']){delete _0x9593ef[_0x75d8('0x25')];}_0x29108e[_0x75d8('0x18')](_0x227904)[_0x75d8('0x26')](_0x9593ef);};}exports[_0x75d8('0x27')]=function(_0x31c943,_0x2ee889){var _0x527641={},_0x122bfc={},_0xc4b7d8={'count':0x0,'rows':[]};var _0x47606b=_[_0x75d8('0x28')](db[_0x75d8('0x29')][_0x75d8('0x2a')],function(_0x3627f1){return{'name':_0x3627f1[_0x75d8('0x2b')],'type':_0x3627f1[_0x75d8('0x2c')][_0x75d8('0x2d')]};});_0x122bfc[_0x75d8('0x2e')]=_['map'](_0x47606b,_0x75d8('0x25'));_0x122bfc[_0x75d8('0x2f')]=_[_0x75d8('0x30')](_0x31c943[_0x75d8('0x2f')]);_0x122bfc['filters']=_['intersection'](_0x122bfc[_0x75d8('0x2e')],_0x122bfc['query']);_0x527641[_0x75d8('0x31')]=_[_0x75d8('0x32')](_0x122bfc[_0x75d8('0x2e')],qs[_0x75d8('0x33')](_0x31c943['query'][_0x75d8('0x33')]));_0x527641[_0x75d8('0x31')]=_0x527641[_0x75d8('0x31')][_0x75d8('0x34')]?_0x527641[_0x75d8('0x31')]:_0x122bfc[_0x75d8('0x2e')];if(!_0x31c943[_0x75d8('0x2f')]['hasOwnProperty'](_0x75d8('0x35'))){_0x527641['limit']=qs['limit'](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x36')]);_0x527641[_0x75d8('0x1b')]=qs[_0x75d8('0x1b')](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x1b')]);}_0x527641[_0x75d8('0x37')]=qs['sort'](_0x31c943[_0x75d8('0x2f')][_0x75d8('0x38')]);_0x527641['where']=qs['filters'](_['pick'](_0x31c943[_0x75d8('0x2f')],_0x122bfc[_0x75d8('0x39')]),_0x47606b);if(_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3a')]){_0x527641[_0x75d8('0x3b')]=_[_0x75d8('0x3c')](_0x527641['where'],{'$or':_['map'](_0x47606b,function(_0x52d595){if(_0x52d595[_0x75d8('0x2c')]!=='VIRTUAL'){var _0x40041c={};_0x40041c[_0x52d595[_0x75d8('0x25')]]={'$like':'%'+_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3a')]+'%'};return _0x40041c;}})});}_0x527641=_[_0x75d8('0x3c')]({},_0x527641,_0x31c943[_0x75d8('0x3d')]);var _0x5895e4={'where':_0x527641[_0x75d8('0x3b')]};return db[_0x75d8('0x29')][_0x75d8('0x1d')](_0x5895e4)[_0x75d8('0x20')](function(_0x321947){_0xc4b7d8[_0x75d8('0x1d')]=_0x321947;if(_0x31c943[_0x75d8('0x2f')][_0x75d8('0x3e')]){_0x527641[_0x75d8('0x3f')]=[{'all':!![]}];}return db[_0x75d8('0x29')]['findAll'](_0x527641);})[_0x75d8('0x20')](function(_0x42b542){_0xc4b7d8['rows']=_0x42b542;return _0xc4b7d8;})['then'](respondWithFilteredResult(_0x2ee889,_0x527641))[_0x75d8('0x40')](handleError(_0x2ee889,null));};exports[_0x75d8('0x41')]=function(_0x42bfee,_0x4e8ddd){var _0x5e28ad={'raw':!![],'where':{'id':_0x42bfee[_0x75d8('0x42')]['id']}},_0xc99cf2={};_0xc99cf2['model']=_['keys'](db[_0x75d8('0x29')][_0x75d8('0x2a')]);_0xc99cf2[_0x75d8('0x2f')]=_[_0x75d8('0x30')](_0x42bfee[_0x75d8('0x2f')]);_0xc99cf2[_0x75d8('0x39')]=_[_0x75d8('0x32')](_0xc99cf2[_0x75d8('0x2e')],_0xc99cf2['query']);_0x5e28ad[_0x75d8('0x31')]=_[_0x75d8('0x32')](_0xc99cf2[_0x75d8('0x2e')],qs[_0x75d8('0x33')](_0x42bfee[_0x75d8('0x2f')][_0x75d8('0x33')]));_0x5e28ad[_0x75d8('0x31')]=_0x5e28ad[_0x75d8('0x31')][_0x75d8('0x34')]?_0x5e28ad[_0x75d8('0x31')]:_0xc99cf2[_0x75d8('0x2e')];if(_0x42bfee[_0x75d8('0x2f')][_0x75d8('0x3e')]){_0x5e28ad[_0x75d8('0x3f')]=[{'all':!![]}];}_0x5e28ad=_[_0x75d8('0x3c')]({},_0x5e28ad,_0x42bfee['options']);return db[_0x75d8('0x29')][_0x75d8('0x43')](_0x5e28ad)[_0x75d8('0x20')](handleEntityNotFound(_0x4e8ddd,null))[_0x75d8('0x20')](respondWithResult(_0x4e8ddd,null))['catch'](handleError(_0x4e8ddd,null));};exports[_0x75d8('0x44')]=function(_0x1c4269,_0x436582){return db[_0x75d8('0x29')][_0x75d8('0x44')](_0x1c4269[_0x75d8('0x45')],{})[_0x75d8('0x20')](function(_0x16b485){var _0x2e7aec=_0x1c4269[_0x75d8('0x46')]['get']({'plain':!![]});if(!_0x2e7aec)throw new Error(_0x75d8('0x47'));if(_0x2e7aec[_0x75d8('0x48')]===_0x75d8('0x46')){var _0x5789a2=_0x16b485[_0x75d8('0x22')]({'plain':!![]});var _0x2c9c55=_0x75d8('0x23');return db[_0x75d8('0x49')][_0x75d8('0x43')]({'where':{'name':_0x2c9c55,'userProfileId':_0x2e7aec['userProfileId']},'raw':!![]})[_0x75d8('0x20')](function(_0x518f6c){if(_0x518f6c&&_0x518f6c[_0x75d8('0x4a')]===0x0){return db['UserProfileResource'][_0x75d8('0x44')]({'name':_0x5789a2['name'],'resourceId':_0x5789a2['id'],'type':_0x518f6c[_0x75d8('0x25')],'sectionId':_0x518f6c['id']},{})[_0x75d8('0x20')](function(){return _0x16b485;});}else{return _0x16b485;}})[_0x75d8('0x40')](function(_0x27a921){logger[_0x75d8('0x4b')](_0x75d8('0x4c'),_0x27a921);throw _0x27a921;});}return _0x16b485;})[_0x75d8('0x20')](respondWithResult(_0x436582,0xc9))[_0x75d8('0x40')](handleError(_0x436582,null));};exports[_0x75d8('0x1f')]=function(_0x1cef4a,_0x34f66e){if(_0x1cef4a[_0x75d8('0x45')]['id']){delete _0x1cef4a['body']['id'];}return db[_0x75d8('0x29')]['find']({'where':{'id':_0x1cef4a[_0x75d8('0x42')]['id']}})[_0x75d8('0x20')](handleEntityNotFound(_0x34f66e,null))[_0x75d8('0x20')](saveUpdates(_0x1cef4a[_0x75d8('0x45')],null))[_0x75d8('0x20')](respondWithResult(_0x34f66e,null))[_0x75d8('0x40')](handleError(_0x34f66e,null));};exports[_0x75d8('0x21')]=function(_0x2152c9,_0x4cea06){return db[_0x75d8('0x29')][_0x75d8('0x43')]({'where':{'id':_0x2152c9[_0x75d8('0x42')]['id']}})[_0x75d8('0x20')](handleEntityNotFound(_0x4cea06,null))['then'](removeEntity(_0x4cea06,null))[_0x75d8('0x40')](handleError(_0x4cea06,null));};exports[_0x75d8('0x4d')]=function(_0x43d147,_0x221e05){return db[_0x75d8('0x29')]['describe']()['then'](respondWithResult(_0x221e05,null))[_0x75d8('0x40')](handleError(_0x221e05,null));}; \ No newline at end of file +var _0x9230=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Tags','UserProfileResource','destroy','end','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','keys','length','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x2dc8cb,_0x4d2de0){var _0x139a75=function(_0x3810d6){while(--_0x3810d6){_0x2dc8cb['push'](_0x2dc8cb['shift']());}};_0x139a75(++_0x4d2de0);}(_0x9230,0xe6));var _0x0923=function(_0x1e54d1,_0x5b7dcf){_0x1e54d1=_0x1e54d1-0x0;var _0x417447=_0x9230[_0x1e54d1];return _0x417447;};'use strict';var emlformat=require(_0x0923('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0923('0x1'));var rp=require(_0x0923('0x2'));var moment=require(_0x0923('0x3'));var BPromise=require(_0x0923('0x4'));var Mustache=require(_0x0923('0x5'));var util=require(_0x0923('0x6'));var path=require('path');var sox=require(_0x0923('0x7'));var csv=require(_0x0923('0x8'));var ejs=require(_0x0923('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0923('0xa'));var crypto=require(_0x0923('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0923('0xc'));var toCsv=require(_0x0923('0x8'));var querystring=require(_0x0923('0xd'));var Papa=require('papaparse');var Redis=require(_0x0923('0xe'));var authService=require(_0x0923('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0923('0x10'));var hardwareService=require(_0x0923('0x11'));var logger=require(_0x0923('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0923('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x662deb,_0x18250a){_0x18250a=_0x18250a||0xcc;return function(_0x391696){if(_0x391696){return _0x662deb[_0x0923('0x14')](_0x18250a);}return _0x662deb['status'](_0x18250a)['end']();};}function respondWithResult(_0xa0b477,_0x2d3ff9){_0x2d3ff9=_0x2d3ff9||0xc8;return function(_0x59a9a7){if(_0x59a9a7){return _0xa0b477[_0x0923('0x15')](_0x2d3ff9)[_0x0923('0x16')](_0x59a9a7);}};}function respondWithFilteredResult(_0xa4ab96,_0x2b4466){return function(_0x207d11){if(_0x207d11){var _0x37df9a=typeof _0x2b4466[_0x0923('0x17')]===_0x0923('0x18')&&typeof _0x2b4466[_0x0923('0x19')]===_0x0923('0x18');var _0x55dd3e=_0x207d11['count'];var _0x39cdc4=_0x37df9a?0x0:_0x2b4466[_0x0923('0x17')];var _0x2f704d=_0x37df9a?_0x207d11[_0x0923('0x1a')]:_0x2b4466[_0x0923('0x17')]+_0x2b4466['limit'];var _0x30bf79;if(_0x2f704d>=_0x55dd3e){_0x2f704d=_0x55dd3e;_0x30bf79=0xc8;}else{_0x30bf79=0xce;}_0xa4ab96[_0x0923('0x15')](_0x30bf79);return _0xa4ab96['set'](_0x0923('0x1b'),_0x39cdc4+'-'+_0x2f704d+'/'+_0x55dd3e)[_0x0923('0x16')](_0x207d11);}return null;};}function patchUpdates(_0x56f241){return function(_0x7b5f8b){try{jsonpatch[_0x0923('0x1c')](_0x7b5f8b,_0x56f241,!![]);}catch(_0x440424){return BPromise[_0x0923('0x1d')](_0x440424);}return _0x7b5f8b['save']();};}function saveUpdates(_0x586d31,_0x45e24a){return function(_0x818d1f){if(_0x818d1f){return _0x818d1f[_0x0923('0x1e')](_0x586d31)[_0x0923('0x1f')](function(_0x4e94e3){return _0x4e94e3;});}return null;};}function removeEntity(_0x540b77,_0x1e70c7){return function(_0x14a877){if(_0x14a877){return _0x14a877['destroy']()[_0x0923('0x1f')](function(){var _0x18f1cb=_0x14a877[_0x0923('0x20')]({'plain':!![]});var _0x2c0cf4=_0x0923('0x21');return db[_0x0923('0x22')][_0x0923('0x23')]({'where':{'type':_0x2c0cf4,'resourceId':_0x18f1cb['id']}})[_0x0923('0x1f')](function(){return _0x14a877;});})[_0x0923('0x1f')](function(){_0x540b77['status'](0xcc)[_0x0923('0x24')]();});}};}function handleEntityNotFound(_0x3d74ed,_0x1ece08){return function(_0x129149){if(!_0x129149){_0x3d74ed[_0x0923('0x14')](0x194);}return _0x129149;};}function handleError(_0xbb32fd,_0x1a0030){_0x1a0030=_0x1a0030||0x1f4;return function(_0xda8f0d){logger[_0x0923('0x25')](_0xda8f0d[_0x0923('0x26')]);if(_0xda8f0d[_0x0923('0x27')]){delete _0xda8f0d[_0x0923('0x27')];}_0xbb32fd[_0x0923('0x15')](_0x1a0030)[_0x0923('0x28')](_0xda8f0d);};}exports[_0x0923('0x29')]=function(_0x1ac540,_0x8fad37){var _0x403824={},_0x2a3ebf={},_0x251b10={'count':0x0,'rows':[]};var _0x1dbd3b=_[_0x0923('0x2a')](db[_0x0923('0x2b')]['rawAttributes'],function(_0x500213){return{'name':_0x500213[_0x0923('0x2c')],'type':_0x500213[_0x0923('0x2d')][_0x0923('0x2e')]};});_0x2a3ebf[_0x0923('0x2f')]=_[_0x0923('0x2a')](_0x1dbd3b,_0x0923('0x27'));_0x2a3ebf[_0x0923('0x30')]=_['keys'](_0x1ac540['query']);_0x2a3ebf[_0x0923('0x31')]=_[_0x0923('0x32')](_0x2a3ebf[_0x0923('0x2f')],_0x2a3ebf['query']);_0x403824[_0x0923('0x33')]=_[_0x0923('0x32')](_0x2a3ebf[_0x0923('0x2f')],qs[_0x0923('0x34')](_0x1ac540['query'][_0x0923('0x34')]));_0x403824[_0x0923('0x33')]=_0x403824[_0x0923('0x33')]['length']?_0x403824[_0x0923('0x33')]:_0x2a3ebf[_0x0923('0x2f')];if(!_0x1ac540[_0x0923('0x30')]['hasOwnProperty'](_0x0923('0x35'))){_0x403824[_0x0923('0x19')]=qs[_0x0923('0x19')](_0x1ac540[_0x0923('0x30')]['limit']);_0x403824['offset']=qs['offset'](_0x1ac540[_0x0923('0x30')][_0x0923('0x17')]);}_0x403824[_0x0923('0x36')]=qs['sort'](_0x1ac540[_0x0923('0x30')][_0x0923('0x37')]);_0x403824[_0x0923('0x38')]=qs[_0x0923('0x31')](_['pick'](_0x1ac540['query'],_0x2a3ebf[_0x0923('0x31')]),_0x1dbd3b);if(_0x1ac540[_0x0923('0x30')][_0x0923('0x39')]){_0x403824[_0x0923('0x38')]=_['merge'](_0x403824[_0x0923('0x38')],{'$or':_[_0x0923('0x2a')](_0x1dbd3b,function(_0x515a66){if(_0x515a66[_0x0923('0x2d')]!==_0x0923('0x3a')){var _0x1d3487={};_0x1d3487[_0x515a66['name']]={'$like':'%'+_0x1ac540[_0x0923('0x30')]['filter']+'%'};return _0x1d3487;}})});}_0x403824=_[_0x0923('0x3b')]({},_0x403824,_0x1ac540[_0x0923('0x3c')]);var _0x1481d3={'where':_0x403824[_0x0923('0x38')]};return db[_0x0923('0x2b')][_0x0923('0x1a')](_0x1481d3)['then'](function(_0x3872a6){_0x251b10[_0x0923('0x1a')]=_0x3872a6;if(_0x1ac540[_0x0923('0x30')][_0x0923('0x3d')]){_0x403824['include']=[{'all':!![]}];}return db[_0x0923('0x2b')][_0x0923('0x3e')](_0x403824);})[_0x0923('0x1f')](function(_0x33977f){_0x251b10['rows']=_0x33977f;return _0x251b10;})[_0x0923('0x1f')](respondWithFilteredResult(_0x8fad37,_0x403824))[_0x0923('0x3f')](handleError(_0x8fad37,null));};exports[_0x0923('0x40')]=function(_0x5210ec,_0x577f13){var _0x1e57a9={'raw':!![],'where':{'id':_0x5210ec['params']['id']}},_0x3595bd={};_0x3595bd[_0x0923('0x2f')]=_[_0x0923('0x41')](db['Tag']['rawAttributes']);_0x3595bd[_0x0923('0x30')]=_[_0x0923('0x41')](_0x5210ec[_0x0923('0x30')]);_0x3595bd[_0x0923('0x31')]=_[_0x0923('0x32')](_0x3595bd['model'],_0x3595bd[_0x0923('0x30')]);_0x1e57a9[_0x0923('0x33')]=_[_0x0923('0x32')](_0x3595bd[_0x0923('0x2f')],qs[_0x0923('0x34')](_0x5210ec[_0x0923('0x30')]['fields']));_0x1e57a9[_0x0923('0x33')]=_0x1e57a9[_0x0923('0x33')][_0x0923('0x42')]?_0x1e57a9['attributes']:_0x3595bd[_0x0923('0x2f')];if(_0x5210ec[_0x0923('0x30')][_0x0923('0x3d')]){_0x1e57a9[_0x0923('0x43')]=[{'all':!![]}];}_0x1e57a9=_[_0x0923('0x3b')]({},_0x1e57a9,_0x5210ec[_0x0923('0x3c')]);return db[_0x0923('0x2b')][_0x0923('0x44')](_0x1e57a9)[_0x0923('0x1f')](handleEntityNotFound(_0x577f13,null))[_0x0923('0x1f')](respondWithResult(_0x577f13,null))[_0x0923('0x3f')](handleError(_0x577f13,null));};exports[_0x0923('0x45')]=function(_0x11bb63,_0x2e1ae7){return db[_0x0923('0x2b')][_0x0923('0x45')](_0x11bb63[_0x0923('0x46')],{})[_0x0923('0x1f')](function(_0x191d69){var _0x5dfaa5=_0x11bb63[_0x0923('0x47')]['get']({'plain':!![]});if(!_0x5dfaa5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dfaa5[_0x0923('0x48')]===_0x0923('0x47')){var _0x406033=_0x191d69[_0x0923('0x20')]({'plain':!![]});var _0x360c2a=_0x0923('0x21');return db[_0x0923('0x49')][_0x0923('0x44')]({'where':{'name':_0x360c2a,'userProfileId':_0x5dfaa5['userProfileId']},'raw':!![]})['then'](function(_0x3cca19){if(_0x3cca19&&_0x3cca19[_0x0923('0x4a')]===0x0){return db[_0x0923('0x22')][_0x0923('0x45')]({'name':_0x406033[_0x0923('0x27')],'resourceId':_0x406033['id'],'type':_0x3cca19[_0x0923('0x27')],'sectionId':_0x3cca19['id']},{})[_0x0923('0x1f')](function(){return _0x191d69;});}else{return _0x191d69;}})[_0x0923('0x3f')](function(_0x5c2ed2){logger[_0x0923('0x25')](_0x0923('0x4b'),_0x5c2ed2);throw _0x5c2ed2;});}return _0x191d69;})[_0x0923('0x1f')](respondWithResult(_0x2e1ae7,0xc9))['catch'](handleError(_0x2e1ae7,null));};exports[_0x0923('0x1e')]=function(_0x2370c2,_0x51840f){if(_0x2370c2[_0x0923('0x46')]['id']){delete _0x2370c2[_0x0923('0x46')]['id'];}return db[_0x0923('0x2b')][_0x0923('0x44')]({'where':{'id':_0x2370c2[_0x0923('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51840f,null))[_0x0923('0x1f')](saveUpdates(_0x2370c2[_0x0923('0x46')],null))['then'](respondWithResult(_0x51840f,null))[_0x0923('0x3f')](handleError(_0x51840f,null));};exports[_0x0923('0x23')]=function(_0x2946df,_0x4e38a5){return db['Tag'][_0x0923('0x44')]({'where':{'id':_0x2946df[_0x0923('0x4c')]['id']}})[_0x0923('0x1f')](handleEntityNotFound(_0x4e38a5,null))[_0x0923('0x1f')](removeEntity(_0x4e38a5,null))['catch'](handleError(_0x4e38a5,null));};exports['describe']=function(_0x9cad1a,_0x560aed){return db['Tag']['describe']()[_0x0923('0x1f')](respondWithResult(_0x560aed,null))[_0x0923('0x3f')](handleError(_0x560aed,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 11ecb1d..061b60b 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 _0xef75=['rimraf','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2469c5,_0x2e9dde){var _0x29deaa=function(_0x1c7bf7){while(--_0x1c7bf7){_0x2469c5['push'](_0x2469c5['shift']());}};_0x29deaa(++_0x2e9dde);}(_0xef75,0x125));var _0x5ef7=function(_0x30ab20,_0x4471d3){_0x30ab20=_0x30ab20-0x0;var _0x4a4aac=_0xef75[_0x30ab20];return _0x4a4aac;};'use strict';var _=require(_0x5ef7('0x0'));var util=require(_0x5ef7('0x1'));var logger=require(_0x5ef7('0x2'))(_0x5ef7('0x3'));var moment=require(_0x5ef7('0x4'));var BPromise=require(_0x5ef7('0x5'));var rp=require(_0x5ef7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ef7('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ef7('0x8'));module[_0x5ef7('0x9')]=function(_0x4dbe1c,_0x3ddc2e){return _0x4dbe1c[_0x5ef7('0xa')](_0x5ef7('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffb4=['../../config/logger','api','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','util'];(function(_0x1161da,_0x501e4f){var _0x5ac792=function(_0xd02cb6){while(--_0xd02cb6){_0x1161da['push'](_0x1161da['shift']());}};_0x5ac792(++_0x501e4f);}(_0xffb4,0x106));var _0x4ffb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xffb4[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x4ffb('0x0'));var util=require(_0x4ffb('0x1'));var logger=require(_0x4ffb('0x2'))(_0x4ffb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ffb('0x4'));var rimraf=require(_0x4ffb('0x5'));var config=require('../../config/environment');var attributes=require(_0x4ffb('0x6'));module[_0x4ffb('0x7')]=function(_0x1ddb7f,_0x272263){return _0x1ddb7f[_0x4ffb('0x8')](_0x4ffb('0x9'),attributes,{'tableName':_0x4ffb('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 e1b65d9..6dc66eb 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 _0x0fda=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x5b94c9,_0x5668e6){_0x5b94c9=_0x5b94c9-0x0;var _0x565928=_0x0fda[_0x5b94c9];return _0x565928;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x868183,_0x62b109,_0x1aab41){return new BPromise(function(_0x248cca,_0x5d996b){return client[_0xa0fd('0x9')](_0x868183,_0x1aab41)[_0xa0fd('0xa')](function(_0x231ca4){logger[_0xa0fd('0xb')]('Tag,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));logger[_0xa0fd('0xd')](_0xa0fd('0xe'),_0x62b109,'request\x20sent',JSON[_0xa0fd('0xf')](_0x231ca4));if(_0x231ca4[_0xa0fd('0x10')]){if(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x11')]===0x1f4){logger[_0xa0fd('0x10')]('Tag,\x20%s,\x20%s',_0x62b109,_0x231ca4['error'][_0xa0fd('0x12')]);return _0x5d996b(_0x231ca4[_0xa0fd('0x10')]['message']);}logger[_0xa0fd('0x10')](_0xa0fd('0x13'),_0x62b109,_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);return _0x248cca(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);}else{logger[_0xa0fd('0xb')]('Tag,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));_0x248cca(_0x231ca4[_0xa0fd('0x14')]['message']);}})['catch'](function(_0x205506){logger[_0xa0fd('0x10')]('Tag,\x20%s,\x20%s',_0x62b109,_0x205506);_0x5d996b(_0x205506);});});} \ No newline at end of file +var _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xc3fe,0xff));var _0xec3f=function(_0x15e978,_0x3d5027){_0x15e978=_0x15e978-0x0;var _0x1a010f=_0xc3fe[_0x15e978];return _0x1a010f;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('Tag,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('Tag,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index aa6a45f..e6eaba8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b4cc326..f9f336d 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x3f48e9,_0x42932b){var _0x1ad3aa=function(_0x1ceec8){while(--_0x1ceec8){_0x3f48e9['push'](_0x3f48e9['shift']());}};_0x1ad3aa(++_0x42932b);}(_0xb10b,0x12a));var _0xbb10=function(_0x77a933,_0x1cdd24){_0x77a933=_0x77a933-0x0;var _0x9df572=_0xb10b[_0x77a933];return _0x9df572;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x1c1797,_0xeeccfe){var _0xf555ac=function(_0x113453){while(--_0x113453){_0x1c1797['push'](_0x1c1797['shift']());}};_0xf555ac(++_0xeeccfe);}(_0x2032,0xd9));var _0x2203=function(_0x3eacc9,_0x47ceb8){_0x3eacc9=_0x3eacc9-0x0;var _0x58720e=_0x2032[_0x3eacc9];return _0x58720e;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b294f27..e3e57f9 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 _0x33fe=['WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','findOne','add','ids','removeQueues','Voice','Chat','Sms','Fax','Openchannel','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','voicePause','UserVoiceQueueRt','isNil','interface','TeamVoiceQueue','all','VoicePrefixId','addAgents','removeAgents','Mail','Whatsapp','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','error','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','role','Teams','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x7d4f1c,_0x5b633a){var _0x45f7d9=function(_0x493067){while(--_0x493067){_0x7d4f1c['push'](_0x7d4f1c['shift']());}};_0x45f7d9(++_0x5b633a);}(_0x33fe,0x14f));var _0xe33f=function(_0x1699c1,_0x170443){_0x1699c1=_0x1699c1-0x0;var _0x427a73=_0x33fe[_0x1699c1];return _0x427a73;};'use strict';var emlformat=require(_0xe33f('0x0'));var rimraf=require(_0xe33f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe33f('0x2'));var moment=require('moment');var BPromise=require(_0xe33f('0x3'));var Mustache=require(_0xe33f('0x4'));var util=require(_0xe33f('0x5'));var path=require('path');var sox=require(_0xe33f('0x6'));var csv=require(_0xe33f('0x7'));var ejs=require(_0xe33f('0x8'));var fs=require('fs');var fs_extra=require(_0xe33f('0x9'));var _=require(_0xe33f('0xa'));var squel=require(_0xe33f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe33f('0xc'));var deskjs=require(_0xe33f('0xd'));var toCsv=require(_0xe33f('0x7'));var querystring=require(_0xe33f('0xe'));var Papa=require(_0xe33f('0xf'));var Redis=require('ioredis');var authService=require(_0xe33f('0x10'));var qs=require(_0xe33f('0x11'));var as=require(_0xe33f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe33f('0x13'))(_0xe33f('0x14'));var utils=require('../../config/utils');var config=require(_0xe33f('0x15'));var licenseUtil=require(_0xe33f('0x16'));var db=require('../../mysqldb')['db'];config[_0xe33f('0x17')]=_[_0xe33f('0x18')](config['redis'],{'host':_0xe33f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe33f('0x17')]));require('./team.socket')[_0xe33f('0x1a')](socket);function respondWithStatusCode(_0x493d4d,_0x5c3608){_0x5c3608=_0x5c3608||0xcc;return function(_0x15a6f3){if(_0x15a6f3){return _0x493d4d[_0xe33f('0x1b')](_0x5c3608);}return _0x493d4d[_0xe33f('0x1c')](_0x5c3608)[_0xe33f('0x1d')]();};}function respondWithResult(_0x1dbe18,_0x5b2709){_0x5b2709=_0x5b2709||0xc8;return function(_0x3fbb9d){if(_0x3fbb9d){return _0x1dbe18[_0xe33f('0x1c')](_0x5b2709)[_0xe33f('0x1e')](_0x3fbb9d);}};}function respondWithFilteredResult(_0x1967dd,_0x352774){return function(_0x4aa834){if(_0x4aa834){var _0x133513=typeof _0x352774[_0xe33f('0x1f')]===_0xe33f('0x20')&&typeof _0x352774['limit']===_0xe33f('0x20');var _0x17935f=_0x4aa834[_0xe33f('0x21')];var _0xbd338=_0x133513?0x0:_0x352774[_0xe33f('0x1f')];var _0x321864=_0x133513?_0x4aa834['count']:_0x352774['offset']+_0x352774['limit'];var _0x54b39c;if(_0x321864>=_0x17935f){_0x321864=_0x17935f;_0x54b39c=0xc8;}else{_0x54b39c=0xce;}_0x1967dd[_0xe33f('0x1c')](_0x54b39c);return _0x1967dd[_0xe33f('0x22')](_0xe33f('0x23'),_0xbd338+'-'+_0x321864+'/'+_0x17935f)[_0xe33f('0x1e')](_0x4aa834);}return null;};}function patchUpdates(_0x1e8bc5){return function(_0x13d129){try{jsonpatch['apply'](_0x13d129,_0x1e8bc5,!![]);}catch(_0x2066e0){return BPromise[_0xe33f('0x24')](_0x2066e0);}return _0x13d129['save']();};}function saveUpdates(_0x584d8d,_0x29b8bd){return function(_0x314e02){if(_0x314e02){return _0x314e02[_0xe33f('0x25')](_0x584d8d)['then'](function(_0x5b4ce9){return _0x5b4ce9;});}return null;};}function handleEntityNotFound(_0x3a7198,_0x434dca){return function(_0x579b83){if(!_0x579b83){_0x3a7198['sendStatus'](0x194);}return _0x579b83;};}function handleError(_0x3e01d0,_0x38b980){_0x38b980=_0x38b980||0x1f4;return function(_0x38c583){logger[_0xe33f('0x26')](_0x38c583['stack']);if(_0x38c583['name']){delete _0x38c583[_0xe33f('0x27')];}_0x3e01d0[_0xe33f('0x1c')](_0x38b980)[_0xe33f('0x28')](_0x38c583);};}exports[_0xe33f('0x29')]=function(_0x21773a,_0x2bf4c3){var _0x2db16c={},_0xc99d1f={},_0x9d3515={'count':0x0,'rows':[]};var _0x406c24=_[_0xe33f('0x2a')](db[_0xe33f('0x2b')]['rawAttributes'],function(_0x4fa6ca){return{'name':_0x4fa6ca[_0xe33f('0x2c')],'type':_0x4fa6ca[_0xe33f('0x2d')][_0xe33f('0x2e')]};});_0xc99d1f[_0xe33f('0x2f')]=_[_0xe33f('0x2a')](_0x406c24,'name');_0xc99d1f[_0xe33f('0x30')]=_[_0xe33f('0x31')](_0x21773a[_0xe33f('0x30')]);_0xc99d1f[_0xe33f('0x32')]=_[_0xe33f('0x33')](_0xc99d1f['model'],_0xc99d1f['query']);_0x2db16c[_0xe33f('0x34')]=_[_0xe33f('0x33')](_0xc99d1f[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x21773a[_0xe33f('0x30')][_0xe33f('0x35')]));_0x2db16c[_0xe33f('0x34')]=_0x2db16c['attributes'][_0xe33f('0x36')]?_0x2db16c[_0xe33f('0x34')]:_0xc99d1f[_0xe33f('0x2f')];if(!_0x21773a[_0xe33f('0x30')]['hasOwnProperty']('nolimit')){_0x2db16c[_0xe33f('0x37')]=qs['limit'](_0x21773a[_0xe33f('0x30')][_0xe33f('0x37')]);_0x2db16c[_0xe33f('0x1f')]=qs[_0xe33f('0x1f')](_0x21773a[_0xe33f('0x30')][_0xe33f('0x1f')]);}_0x2db16c['order']=qs[_0xe33f('0x38')](_0x21773a['query'][_0xe33f('0x38')]);_0x2db16c[_0xe33f('0x39')]=qs[_0xe33f('0x32')](_[_0xe33f('0x3a')](_0x21773a[_0xe33f('0x30')],_0xc99d1f[_0xe33f('0x32')]),_0x406c24);if(_0x21773a[_0xe33f('0x30')][_0xe33f('0x3b')]){_0x2db16c[_0xe33f('0x39')]=_[_0xe33f('0x3c')](_0x2db16c[_0xe33f('0x39')],{'$or':_['map'](_0x406c24,function(_0x9d0ad2){if(_0x9d0ad2[_0xe33f('0x2d')]!==_0xe33f('0x3d')){var _0x4fcaa6={};_0x4fcaa6[_0x9d0ad2[_0xe33f('0x27')]]={'$like':'%'+_0x21773a[_0xe33f('0x30')][_0xe33f('0x3b')]+'%'};return _0x4fcaa6;}})});}_0x2db16c=_[_0xe33f('0x3c')]({},_0x2db16c,_0x21773a[_0xe33f('0x3e')]);var _0x32f257={'where':_0x2db16c['where']};return db['Team'][_0xe33f('0x21')](_0x32f257)[_0xe33f('0x3f')](function(_0x59b7d7){_0x9d3515[_0xe33f('0x21')]=_0x59b7d7;if(_0x21773a['query']['includeAll']){_0x2db16c['include']=[{'all':!![]}];}return db['Team'][_0xe33f('0x40')](_0x2db16c);})['then'](function(_0x1415d1){_0x9d3515[_0xe33f('0x41')]=_0x1415d1;return _0x9d3515;})[_0xe33f('0x3f')](respondWithFilteredResult(_0x2bf4c3,_0x2db16c))['catch'](handleError(_0x2bf4c3,null));};exports[_0xe33f('0x42')]=function(_0x240b13,_0x319135){var _0x358e80={'raw':![],'where':{'id':_0x240b13['params']['id']}},_0x26512c={};_0x26512c[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db[_0xe33f('0x2b')][_0xe33f('0x43')]);_0x26512c[_0xe33f('0x30')]=_['keys'](_0x240b13['query']);_0x26512c[_0xe33f('0x32')]=_['intersection'](_0x26512c[_0xe33f('0x2f')],_0x26512c['query']);_0x358e80[_0xe33f('0x34')]=_['intersection'](_0x26512c[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x240b13['query'][_0xe33f('0x35')]));_0x358e80[_0xe33f('0x34')]=_0x358e80[_0xe33f('0x34')]['length']?_0x358e80[_0xe33f('0x34')]:_0x26512c[_0xe33f('0x2f')];if(_0x240b13[_0xe33f('0x30')][_0xe33f('0x44')]){_0x358e80['include']=[{'all':!![]}];}_0x358e80=_[_0xe33f('0x3c')]({},_0x358e80,_0x240b13['options']);return db[_0xe33f('0x2b')]['find'](_0x358e80)[_0xe33f('0x3f')](handleEntityNotFound(_0x319135,null))['then'](respondWithResult(_0x319135,null))[_0xe33f('0x45')](handleError(_0x319135,null));};exports[_0xe33f('0x46')]=function(_0x433d78,_0x10f568){return db[_0xe33f('0x2b')]['create'](_0x433d78[_0xe33f('0x47')],{})[_0xe33f('0x3f')](function(_0x3b367c){var _0x306db3=_0x433d78[_0xe33f('0x48')][_0xe33f('0x49')]({'plain':!![]});if(!_0x306db3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x306db3[_0xe33f('0x4a')]==='user'){var _0x156d0c=_0x3b367c[_0xe33f('0x49')]({'plain':!![]});var _0x445ee9=_0xe33f('0x4b');return db[_0xe33f('0x4c')][_0xe33f('0x4d')]({'where':{'name':_0x445ee9,'userProfileId':_0x306db3[_0xe33f('0x4e')]},'raw':!![]})['then'](function(_0x6ea2ee){if(_0x6ea2ee&&_0x6ea2ee['autoAssociation']===0x0){return db[_0xe33f('0x4f')][_0xe33f('0x46')]({'name':_0x156d0c[_0xe33f('0x27')],'resourceId':_0x156d0c['id'],'type':_0x6ea2ee[_0xe33f('0x27')],'sectionId':_0x6ea2ee['id']},{})['then'](function(){return _0x3b367c;});}else{return _0x3b367c;}})[_0xe33f('0x45')](function(_0x4ae909){logger[_0xe33f('0x26')](_0xe33f('0x50'),_0x4ae909);throw _0x4ae909;});}return _0x3b367c;})[_0xe33f('0x3f')](respondWithResult(_0x10f568,0xc9))[_0xe33f('0x45')](handleError(_0x10f568,null));};exports['update']=function(_0x159012,_0x36f76a){if(_0x159012[_0xe33f('0x47')]['id']){delete _0x159012['body']['id'];}return db[_0xe33f('0x2b')][_0xe33f('0x4d')]({'where':{'id':_0x159012[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](handleEntityNotFound(_0x36f76a,null))[_0xe33f('0x3f')](saveUpdates(_0x159012[_0xe33f('0x47')],null))[_0xe33f('0x3f')](respondWithResult(_0x36f76a,null))[_0xe33f('0x45')](handleError(_0x36f76a,null));};exports[_0xe33f('0x52')]=function(_0x23c5e6,_0x1dc2f7){var _0x4394ac=_0x23c5e6[_0xe33f('0x51')]['id'];var _0x35f877=[];return db['sequelize'][_0xe33f('0x53')](function(_0xca12f8){var _0x16ae3c=_0xe33f('0x54')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x16ae3c,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8})[_0xe33f('0x3f')](function(_0x3e0cf8){_0x35f877=_[_0xe33f('0x2a')](_0x3e0cf8,function(_0x589eae){return Number(_0x589eae[_0xe33f('0x59')]);});})[_0xe33f('0x3f')](function(){var _0x37ab5a='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4394ac;return db['sequelize']['query'](_0x37ab5a,{'type':db[_0xe33f('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0x3c3474){var _0x42c9bd=_['map'](_0x3c3474,function(_0x1c6b42){return Number(_0x1c6b42[_0xe33f('0x5a')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x35f877},'VoiceQueueId':{'$in':_0x42c9bd}},'transaction':_0xca12f8});})['then'](function(){var _0x2f3a76=_0xe33f('0x5b')+_0x4394ac;return db['sequelize']['query'](_0x2f3a76,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')]['SELECT'],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0xe60690){var _0x188cdc=_[_0xe33f('0x2a')](_0xe60690,function(_0x29ac75){return Number(_0x29ac75[_0xe33f('0x5c')]);});return db[_0xe33f('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x35f877},'MailQueueId':{'$in':_0x188cdc}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x25f850=_0xe33f('0x5e')+_0x4394ac;return db['sequelize'][_0xe33f('0x30')](_0x25f850,{'type':db['Sequelize'][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x3cc728){var _0x5cc375=_[_0xe33f('0x2a')](_0x3cc728,function(_0x593583){return Number(_0x593583['SmsQueueId']);});return db[_0xe33f('0x5f')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'SmsQueueId':{'$in':_0x5cc375}},'transaction':_0xca12f8});})['then'](function(){var _0x51b5a2=_0xe33f('0x60')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x51b5a2,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})['then'](function(_0x180501){var _0x5943fc=_[_0xe33f('0x2a')](_0x180501,function(_0xb2552b){return Number(_0xb2552b[_0xe33f('0x61')]);});return db[_0xe33f('0x62')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'ChatQueueId':{'$in':_0x5943fc}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x56adf7=_0xe33f('0x63')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x56adf7,{'type':db[_0xe33f('0x56')]['QueryTypes'][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x932101){var _0x3abb55=_[_0xe33f('0x2a')](_0x932101,function(_0x201e79){return Number(_0x201e79[_0xe33f('0x64')]);});return db[_0xe33f('0x65')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'FaxQueueId':{'$in':_0x3abb55}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){var _0x248a05=_0xe33f('0x66')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x248a05,{'type':db[_0xe33f('0x56')]['QueryTypes'][_0xe33f('0x58')],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x123867){var _0xa8589f=_[_0xe33f('0x2a')](_0x123867,function(_0x511756){return Number(_0x511756[_0xe33f('0x67')]);});return db[_0xe33f('0x68')][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'OpenchannelQueueId':{'$in':_0xa8589f}},'transaction':_0xca12f8});})['then'](function(){var _0x6437cd=_0xe33f('0x69')+_0x4394ac;return db[_0xe33f('0x55')][_0xe33f('0x30')](_0x6437cd,{'type':db[_0xe33f('0x56')][_0xe33f('0x57')]['SELECT'],'raw':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x39ef87){var _0x251a34=_['map'](_0x39ef87,function(_0x1ec4c4){return Number(_0x1ec4c4[_0xe33f('0x6a')]);});return db['UserWhatsappQueue'][_0xe33f('0x52')]({'where':{'UserId':{'$in':_0x35f877},'WhatsappQueueId':{'$in':_0x251a34}},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x6b')]['find']({'where':{'TeamId':_0x4394ac}});})['then'](function(_0x2ea437){if(_0x2ea437===null){return;}return db[_0xe33f('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x35f877},'VoicePrefixId':_0x2ea437['VoicePrefixId']},'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x2b')]['destroy']({'where':{'id':_0x4394ac},'cascade':!![],'transaction':_0xca12f8});})[_0xe33f('0x3f')](function(_0x45c0f0){if(_0x45c0f0===0x0){_0x1dc2f7[_0xe33f('0x1b')](0x194);}else{return db[_0xe33f('0x4f')][_0xe33f('0x52')]({'where':{'type':'Teams','resourceId':_0x4394ac},'cascade':!![],'transaction':_0xca12f8})[_0xe33f('0x3f')](function(){_0x1dc2f7['status'](0xcc)[_0xe33f('0x1d')]();});}})['catch'](function(_0x3652ba){_0x1dc2f7[_0xe33f('0x1c')](0x1f4)[_0xe33f('0x28')](_0x3652ba);});});};exports['getQueues']=function(_0x393f40,_0x12fb8b,_0x5e5e77){return db['Team']['findOne']({'where':{'id':_0x393f40[_0xe33f('0x51')]['id']}})['then'](handleEntityNotFound(_0x12fb8b,null))[_0xe33f('0x3f')](function(_0x31a4e0){if(!_0x393f40[_0xe33f('0x30')]['channel']||!utils[_0xe33f('0x6d')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x6e')])){throw new db[(_0xe33f('0x56'))][(_0xe33f('0x6f'))](_0xe33f('0x70'));}var _0x15a435={};var _0x49a18b={};_0x49a18b[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db[_['capitalize'](_0x393f40[_0xe33f('0x30')]['channel'][_0xe33f('0x71')]())+'Queue'][_0xe33f('0x43')]);_0x49a18b['query']=_[_0xe33f('0x31')](_0x393f40['query']);_0x49a18b['filters']=_['intersection'](_0x49a18b[_0xe33f('0x2f')],_0x49a18b[_0xe33f('0x30')]);_0x15a435[_0xe33f('0x34')]=_[_0xe33f('0x33')](_0x49a18b[_0xe33f('0x2f')],qs['fields'](_0x393f40[_0xe33f('0x30')][_0xe33f('0x35')]));_0x15a435[_0xe33f('0x34')]=_0x15a435[_0xe33f('0x34')][_0xe33f('0x36')]?_0x15a435['attributes']:_0x49a18b[_0xe33f('0x2f')];_0x15a435[_0xe33f('0x37')]=qs['limit'](_0x393f40['query'][_0xe33f('0x37')]);_0x15a435[_0xe33f('0x1f')]=qs[_0xe33f('0x1f')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x1f')]);_0x15a435['order']=qs[_0xe33f('0x38')](_0x393f40[_0xe33f('0x30')][_0xe33f('0x38')]);_0x15a435['where']=qs['filters'](_[_0xe33f('0x3a')](_0x393f40[_0xe33f('0x30')],_0x49a18b[_0xe33f('0x32')]));_0x15a435=_[_0xe33f('0x3c')]({},_0x15a435,_0x393f40[_0xe33f('0x3e')]);return _0x31a4e0[_0xe33f('0x49')+_[_0xe33f('0x72')](_0x393f40[_0xe33f('0x30')]['channel'][_0xe33f('0x71')]())+_0xe33f('0x73')](_0x15a435);})['then'](respondWithResult(_0x12fb8b,null))[_0xe33f('0x45')](handleError(_0x12fb8b,null));};exports[_0xe33f('0x74')]=function(_0x5e515e,_0x270381,_0x373390){return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x5e515e[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](function(_0x1832f9){if(_0x1832f9){if(!_0x5e515e[_0xe33f('0x47')][_0xe33f('0x6e')]||!utils['isValidChannel'](_0x5e515e['body']['channel'])){throw new db['Sequelize'][(_0xe33f('0x6f'))](_0xe33f('0x70'));}return _0x1832f9[_0xe33f('0x76')+_['capitalize'](_0x5e515e['body'][_0xe33f('0x6e')][_0xe33f('0x71')]())+_0xe33f('0x73')](_0x5e515e[_0xe33f('0x47')][_0xe33f('0x77')]);}return null;})[_0xe33f('0x3f')](handleEntityNotFound(_0x270381,null))['then'](respondWithStatusCode(_0x270381,null))[_0xe33f('0x45')](handleError(_0x270381,null));};exports[_0xe33f('0x78')]=function(_0x8c94b7,_0x2f9f9a,_0x25bae3){return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x8c94b7['params']['id']}})[_0xe33f('0x3f')](function(_0x497b8e){if(_0x497b8e){if(!_0x8c94b7[_0xe33f('0x30')]['channel']||!utils[_0xe33f('0x6d')](_0x8c94b7[_0xe33f('0x30')][_0xe33f('0x6e')])){throw new db[(_0xe33f('0x56'))][(_0xe33f('0x6f'))]('Unknown\x20channel');}return _0x497b8e['remove'+_[_0xe33f('0x72')](_0x8c94b7[_0xe33f('0x30')][_0xe33f('0x6e')]['toLowerCase']())+'Queues'](_0x8c94b7['query'][_0xe33f('0x77')]);}return null;})[_0xe33f('0x3f')](handleEntityNotFound(_0x2f9f9a,null))['then'](respondWithStatusCode(_0x2f9f9a,null))[_0xe33f('0x45')](handleError(_0x2f9f9a,null));};exports['addAgents']=function(_0x2286dc,_0x4f2765){var _0x57ccb1=_['isArray'](_0x2286dc[_0xe33f('0x47')][_0xe33f('0x77')])?_0x2286dc['body'][_0xe33f('0x77')]:[_0x2286dc[_0xe33f('0x47')]['ids']];var _0x34fe92=_0x2286dc[_0xe33f('0x51')]['id'];return db[_0xe33f('0x2b')][_0xe33f('0x4d')]({'where':{'id':_0x34fe92}})['then'](handleEntityNotFound(_0x4f2765,null))[_0xe33f('0x3f')](function(_0x1a4f57){if(_0x1a4f57){var _0x1939ec=[_0xe33f('0x79'),_0xe33f('0x7a'),'Mail',_0xe33f('0x7b'),_0xe33f('0x7c'),_0xe33f('0x7d'),'Whatsapp'];return db[_0xe33f('0x55')][_0xe33f('0x53')](function(_0x206b71){var _0x32f3e3=_[_0xe33f('0x2a')](_0x1939ec,function(_0x4e1757){var _0x289068={'attributes':['id',_0xe33f('0x27')]};if(_0x4e1757===_0xe33f('0x79')){_0x289068[_0xe33f('0x7e')]={'attributes':['penalty']};}return _0x1a4f57['get'+_0x4e1757+'Queues'](_0x289068)[_0xe33f('0x3f')](function(_0x13f83f){var _0xdac234=_[_0xe33f('0x2a')](_0x13f83f,function(_0x550c80){var _0x3ee48c=_[_0xe33f('0x2a')](_0x57ccb1,function(_0x4076d0){var _0xb274a3={'where':{'UserId':_0x4076d0,[_0x4e1757+_0xe33f('0x7f')]:_0x550c80['id']},'transaction':_0x206b71};if(_0x4e1757===_0xe33f('0x79')){_0xb274a3['defaults']={'penalty':_0x550c80['TeamVoiceQueue'][_0xe33f('0x80')]};}return db[_0xe33f('0x81')+_0x4e1757+'Queue'][_0xe33f('0x82')](_0xb274a3)['then'](function(){socket[_0xe33f('0x83')](_0xe33f('0x48')+_0x4e1757+_0xe33f('0x84'),{'UserId':_0x4076d0,[_0x4e1757+_0xe33f('0x7f')]:_0x550c80['id']});if(_0x4e1757!==_0xe33f('0x79')){return;}return db[_0xe33f('0x81')][_0xe33f('0x40')]({'where':{'id':_0x57ccb1,'online':0x1},'attributes':['id',_0xe33f('0x27'),'online',_0xe33f('0x85'),'interface'],'raw':!![]})[_0xe33f('0x3f')](function(_0x4e5eaa){var _0x236a56=_[_0xe33f('0x2a')](_0x4e5eaa,function(_0x4d8efd){return db[_0xe33f('0x86')]['upsert']({'membername':_0x4d8efd[_0xe33f('0x27')],'UserId':_0x4d8efd['id'],'queue_name':_0x550c80[_0xe33f('0x27')],'VoiceQueueId':_0x550c80['id'],'interface':_[_0xe33f('0x87')](_0x4d8efd[_0xe33f('0x88')])?util['format']('SIP/%s',_0x4d8efd[_0xe33f('0x27')]):_0x4d8efd[_0xe33f('0x88')],'paused':_0x4d8efd['voicePause']||![],'penalty':_0x550c80[_0xe33f('0x89')][_0xe33f('0x80')]},{'transaction':_0x206b71});});return Promise[_0xe33f('0x8a')](_0x236a56);});});});return Promise['all'](_0x3ee48c);});return Promise['all'](_0xdac234);})['then'](function(){return db[_0xe33f('0x6b')][_0xe33f('0x75')]({'where':{'teamId':_0x34fe92}})[_0xe33f('0x3f')](function(_0x1cef3a){if(_0x1cef3a){var _0x2f5725=_['map'](_0x57ccb1,function(_0x18cb4d){db[_0xe33f('0x6c')]['upsert']({'UserId':_0x18cb4d,'VoicePrefixId':_0x1cef3a[_0xe33f('0x8b')]});});return Promise[_0xe33f('0x8a')](_0x2f5725);}});});});return Promise[_0xe33f('0x8a')](_0x32f3e3)[_0xe33f('0x3f')](function(){return _0x1a4f57[_0xe33f('0x8c')](_0x57ccb1,{'transaction':_0x206b71})['spread'](function(_0x13ab5e){return _0x13ab5e;});});});}})[_0xe33f('0x3f')](respondWithResult(_0x4f2765,null))[_0xe33f('0x45')](handleError(_0x4f2765,null));};exports[_0xe33f('0x8d')]=function(_0x108f0c,_0x5d041e){var _0x133ff0=_['isArray'](_0x108f0c['query'][_0xe33f('0x77')])?_0x108f0c[_0xe33f('0x30')]['ids']:[_0x108f0c[_0xe33f('0x30')][_0xe33f('0x77')]];var _0xab9512=_0x108f0c[_0xe33f('0x51')]['id'];return db[_0xe33f('0x2b')]['find']({'where':{'id':_0xab9512}})[_0xe33f('0x3f')](handleEntityNotFound(_0x5d041e,null))[_0xe33f('0x3f')](function(_0x319234){if(_0x319234){var _0x18c59b=[_0xe33f('0x79'),_0xe33f('0x7a'),_0xe33f('0x8e'),'Sms',_0xe33f('0x7c'),_0xe33f('0x7d'),_0xe33f('0x8f')];return db[_0xe33f('0x55')][_0xe33f('0x53')](function(_0x4795f1){var _0x21cba8=_[_0xe33f('0x2a')](_0x18c59b,function(_0x448352){var _0x39dc18={'attributes':['id',_0xe33f('0x27')]};return _0x319234[_0xe33f('0x49')+_0x448352+_0xe33f('0x73')](_0x39dc18)[_0xe33f('0x3f')](function(_0x1c1c76){var _0xaccf94=_[_0xe33f('0x2a')](_0x1c1c76,function(_0x46cfdc){return _0x46cfdc[_0xe33f('0x8d')](_0x133ff0,{'transaction':_0x4795f1})[_0xe33f('0x3f')](function(){var _0x3da5b8=_[_0xe33f('0x2a')](_0x133ff0,function(_0x2378de){socket[_0xe33f('0x83')]('user'+_0x448352+'Queue:remove',{'UserId':Number(_0x2378de),[_0x448352+_0xe33f('0x7f')]:_0x46cfdc['id']});if(_0x448352!=='Voice'){return;}return db[_0xe33f('0x86')]['destroy']({'where':{'VoiceQueueId':_0x46cfdc['id'],'UserId':_0x2378de},'transaction':_0x4795f1});});return Promise[_0xe33f('0x8a')](_0x3da5b8);});});return Promise[_0xe33f('0x8a')](_0xaccf94);});});return Promise[_0xe33f('0x8a')](_0x21cba8)[_0xe33f('0x3f')](function(){return _0x319234[_0xe33f('0x8d')](_0x133ff0,{'transaction':_0x4795f1});})[_0xe33f('0x3f')](function(){return db[_0xe33f('0x6b')][_0xe33f('0x75')]({'where':{'teamId':_0xab9512}})[_0xe33f('0x3f')](function(_0x1cd64e){if(_0x1cd64e){var _0x393349=_[_0xe33f('0x2a')](_0x133ff0,function(_0x4661a8){db[_0xe33f('0x6c')][_0xe33f('0x52')]({'where':{'UserId':_0x4661a8,'VoicePrefixId':_0x1cd64e[_0xe33f('0x8b')]}});});return Promise[_0xe33f('0x8a')](_0x393349);}});});});}})[_0xe33f('0x3f')](respondWithStatusCode(_0x5d041e,null))[_0xe33f('0x45')](handleError(_0x5d041e,null));};exports[_0xe33f('0x90')]=function(_0x56f57a,_0x2c32c4,_0x58b1a4){var _0x330cec={};var _0x259f4d={};var _0xa72571;var _0x5df74a;return db[_0xe33f('0x2b')][_0xe33f('0x75')]({'where':{'id':_0x56f57a[_0xe33f('0x51')]['id']}})[_0xe33f('0x3f')](handleEntityNotFound(_0x2c32c4,null))[_0xe33f('0x3f')](function(_0x26a8b8){if(_0x26a8b8){_0xa72571=_0x26a8b8;_0x259f4d[_0xe33f('0x2f')]=_[_0xe33f('0x31')](db['User'][_0xe33f('0x43')]);_0x259f4d[_0xe33f('0x30')]=_[_0xe33f('0x31')](_0x56f57a[_0xe33f('0x30')]);_0x259f4d[_0xe33f('0x32')]=_[_0xe33f('0x33')](_0x259f4d[_0xe33f('0x2f')],_0x259f4d[_0xe33f('0x30')]);_0x330cec['attributes']=_['intersection'](_0x259f4d[_0xe33f('0x2f')],qs[_0xe33f('0x35')](_0x56f57a[_0xe33f('0x30')][_0xe33f('0x35')]));_0x330cec['attributes']=_0x330cec[_0xe33f('0x34')][_0xe33f('0x36')]?_0x330cec[_0xe33f('0x34')]:_0x259f4d[_0xe33f('0x2f')];_0x330cec['order']=qs[_0xe33f('0x38')](_0x56f57a[_0xe33f('0x30')][_0xe33f('0x38')]);_0x330cec['where']=qs[_0xe33f('0x32')](_[_0xe33f('0x3a')](_0x56f57a['query'],_0x259f4d[_0xe33f('0x32')]));if(_0x56f57a['query'][_0xe33f('0x3b')]){_0x330cec[_0xe33f('0x39')]=_[_0xe33f('0x3c')](_0x330cec[_0xe33f('0x39')],{'$or':_[_0xe33f('0x2a')](_0x330cec[_0xe33f('0x34')],function(_0x29b417){var _0x370bc0={};_0x370bc0[_0x29b417]={'$like':'%'+_0x56f57a[_0xe33f('0x30')][_0xe33f('0x3b')]+'%'};return _0x370bc0;})});}_0x330cec=_[_0xe33f('0x3c')]({},_0x330cec,_0x56f57a['options']);return _0xa72571[_0xe33f('0x90')](_0x330cec);}})['then'](function(_0x3cd642){if(_0x3cd642){_0x5df74a=_0x3cd642[_0xe33f('0x36')];if(!_0x56f57a[_0xe33f('0x30')][_0xe33f('0x91')](_0xe33f('0x92'))){_0x330cec['limit']=qs[_0xe33f('0x37')](_0x56f57a[_0xe33f('0x30')]['limit']);_0x330cec[_0xe33f('0x1f')]=qs['offset'](_0x56f57a['query'][_0xe33f('0x1f')]);}return _0xa72571[_0xe33f('0x90')](_0x330cec);}})['then'](function(_0xe27065){if(_0xe27065){return _0xe27065?{'count':_0x5df74a,'rows':_0xe27065}:null;}})[_0xe33f('0x3f')](respondWithResult(_0x2c32c4,null))[_0xe33f('0x45')](handleError(_0x2c32c4,null));}; \ No newline at end of file +var _0xaf2f=['channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','Queues','addQueues','findOne','add','removeQueues','ValidationError','remove','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','interface','UserVoiceQueueRt','upsert','isNil','format','all','addAgents','spread','removeAgents','emit','Queue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Team','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','user','get','role','Teams','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','sendStatus','UserProfileResource'];(function(_0x412dbc,_0xa75c01){var _0x755a1e=function(_0x20031a){while(--_0x20031a){_0x412dbc['push'](_0x412dbc['shift']());}};_0x755a1e(++_0xa75c01);}(_0xaf2f,0x15a));var _0xfaf2=function(_0x112db8,_0xd3e0dc){_0x112db8=_0x112db8-0x0;var _0x2ca173=_0xaf2f[_0x112db8];return _0x2ca173;};'use strict';var emlformat=require(_0xfaf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfaf2('0x1'));var jsonpatch=require(_0xfaf2('0x2'));var rp=require(_0xfaf2('0x3'));var moment=require('moment');var BPromise=require(_0xfaf2('0x4'));var Mustache=require('mustache');var util=require(_0xfaf2('0x5'));var path=require(_0xfaf2('0x6'));var sox=require(_0xfaf2('0x7'));var csv=require(_0xfaf2('0x8'));var ejs=require(_0xfaf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfaf2('0xa'));var squel=require(_0xfaf2('0xb'));var crypto=require(_0xfaf2('0xc'));var jsforce=require(_0xfaf2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfaf2('0x8'));var querystring=require('querystring');var Papa=require(_0xfaf2('0xe'));var Redis=require(_0xfaf2('0xf'));var authService=require(_0xfaf2('0x10'));var qs=require(_0xfaf2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfaf2('0x12'));var config=require(_0xfaf2('0x13'));var licenseUtil=require(_0xfaf2('0x14'));var db=require(_0xfaf2('0x15'))['db'];config['redis']=_[_0xfaf2('0x16')](config[_0xfaf2('0x17')],{'host':_0xfaf2('0x18'),'port':0x18eb});var socket=require(_0xfaf2('0x19'))(new Redis(config['redis']));require('./team.socket')[_0xfaf2('0x1a')](socket);function respondWithStatusCode(_0x22b83f,_0x1f43e2){_0x1f43e2=_0x1f43e2||0xcc;return function(_0x58daa0){if(_0x58daa0){return _0x22b83f['sendStatus'](_0x1f43e2);}return _0x22b83f[_0xfaf2('0x1b')](_0x1f43e2)[_0xfaf2('0x1c')]();};}function respondWithResult(_0x238d00,_0x46fb38){_0x46fb38=_0x46fb38||0xc8;return function(_0x33e6e8){if(_0x33e6e8){return _0x238d00[_0xfaf2('0x1b')](_0x46fb38)[_0xfaf2('0x1d')](_0x33e6e8);}};}function respondWithFilteredResult(_0x10fe61,_0x3622b9){return function(_0x125bae){if(_0x125bae){var _0xa6a513=typeof _0x3622b9[_0xfaf2('0x1e')]===_0xfaf2('0x1f')&&typeof _0x3622b9[_0xfaf2('0x20')]==='undefined';var _0x4ac51e=_0x125bae[_0xfaf2('0x21')];var _0xaebc1b=_0xa6a513?0x0:_0x3622b9[_0xfaf2('0x1e')];var _0x4864da=_0xa6a513?_0x125bae[_0xfaf2('0x21')]:_0x3622b9[_0xfaf2('0x1e')]+_0x3622b9[_0xfaf2('0x20')];var _0x25cb3e;if(_0x4864da>=_0x4ac51e){_0x4864da=_0x4ac51e;_0x25cb3e=0xc8;}else{_0x25cb3e=0xce;}_0x10fe61[_0xfaf2('0x1b')](_0x25cb3e);return _0x10fe61[_0xfaf2('0x22')](_0xfaf2('0x23'),_0xaebc1b+'-'+_0x4864da+'/'+_0x4ac51e)[_0xfaf2('0x1d')](_0x125bae);}return null;};}function patchUpdates(_0x31089c){return function(_0x2cbc29){try{jsonpatch[_0xfaf2('0x24')](_0x2cbc29,_0x31089c,!![]);}catch(_0xbe161c){return BPromise[_0xfaf2('0x25')](_0xbe161c);}return _0x2cbc29['save']();};}function saveUpdates(_0x42d865,_0x3a6f7c){return function(_0x33d804){if(_0x33d804){return _0x33d804[_0xfaf2('0x26')](_0x42d865)[_0xfaf2('0x27')](function(_0x3802e4){return _0x3802e4;});}return null;};}function handleEntityNotFound(_0x193726,_0x26c4be){return function(_0x5f5617){if(!_0x5f5617){_0x193726['sendStatus'](0x194);}return _0x5f5617;};}function handleError(_0x3c72d9,_0x2504be){_0x2504be=_0x2504be||0x1f4;return function(_0x443feb){logger[_0xfaf2('0x28')](_0x443feb[_0xfaf2('0x29')]);if(_0x443feb[_0xfaf2('0x2a')]){delete _0x443feb['name'];}_0x3c72d9[_0xfaf2('0x1b')](_0x2504be)[_0xfaf2('0x2b')](_0x443feb);};}exports[_0xfaf2('0x2c')]=function(_0x365445,_0x16619a){var _0x21d973={},_0x1af57e={},_0x5a52be={'count':0x0,'rows':[]};var _0x388e2c=_[_0xfaf2('0x2d')](db[_0xfaf2('0x2e')]['rawAttributes'],function(_0x2d71f9){return{'name':_0x2d71f9[_0xfaf2('0x2f')],'type':_0x2d71f9['type']['key']};});_0x1af57e[_0xfaf2('0x30')]=_[_0xfaf2('0x2d')](_0x388e2c,_0xfaf2('0x2a'));_0x1af57e[_0xfaf2('0x31')]=_[_0xfaf2('0x32')](_0x365445[_0xfaf2('0x31')]);_0x1af57e[_0xfaf2('0x33')]=_[_0xfaf2('0x34')](_0x1af57e['model'],_0x1af57e[_0xfaf2('0x31')]);_0x21d973['attributes']=_[_0xfaf2('0x34')](_0x1af57e[_0xfaf2('0x30')],qs[_0xfaf2('0x35')](_0x365445[_0xfaf2('0x31')][_0xfaf2('0x35')]));_0x21d973['attributes']=_0x21d973[_0xfaf2('0x36')]['length']?_0x21d973[_0xfaf2('0x36')]:_0x1af57e[_0xfaf2('0x30')];if(!_0x365445[_0xfaf2('0x31')]['hasOwnProperty'](_0xfaf2('0x37'))){_0x21d973[_0xfaf2('0x20')]=qs['limit'](_0x365445[_0xfaf2('0x31')][_0xfaf2('0x20')]);_0x21d973[_0xfaf2('0x1e')]=qs[_0xfaf2('0x1e')](_0x365445['query']['offset']);}_0x21d973[_0xfaf2('0x38')]=qs['sort'](_0x365445[_0xfaf2('0x31')]['sort']);_0x21d973[_0xfaf2('0x39')]=qs[_0xfaf2('0x33')](_[_0xfaf2('0x3a')](_0x365445[_0xfaf2('0x31')],_0x1af57e[_0xfaf2('0x33')]),_0x388e2c);if(_0x365445[_0xfaf2('0x31')]['filter']){_0x21d973[_0xfaf2('0x39')]=_[_0xfaf2('0x3b')](_0x21d973[_0xfaf2('0x39')],{'$or':_[_0xfaf2('0x2d')](_0x388e2c,function(_0x1eaae3){if(_0x1eaae3[_0xfaf2('0x3c')]!==_0xfaf2('0x3d')){var _0x509413={};_0x509413[_0x1eaae3['name']]={'$like':'%'+_0x365445[_0xfaf2('0x31')][_0xfaf2('0x3e')]+'%'};return _0x509413;}})});}_0x21d973=_[_0xfaf2('0x3b')]({},_0x21d973,_0x365445[_0xfaf2('0x3f')]);var _0x5817a1={'where':_0x21d973[_0xfaf2('0x39')]};return db['Team']['count'](_0x5817a1)[_0xfaf2('0x27')](function(_0x416c9d){_0x5a52be[_0xfaf2('0x21')]=_0x416c9d;if(_0x365445['query'][_0xfaf2('0x40')]){_0x21d973[_0xfaf2('0x41')]=[{'all':!![]}];}return db[_0xfaf2('0x2e')][_0xfaf2('0x42')](_0x21d973);})['then'](function(_0x65a225){_0x5a52be[_0xfaf2('0x43')]=_0x65a225;return _0x5a52be;})[_0xfaf2('0x27')](respondWithFilteredResult(_0x16619a,_0x21d973))[_0xfaf2('0x44')](handleError(_0x16619a,null));};exports['show']=function(_0x58caba,_0x2bf084){var _0x4ab6be={'raw':![],'where':{'id':_0x58caba[_0xfaf2('0x45')]['id']}},_0x3a847f={};_0x3a847f[_0xfaf2('0x30')]=_[_0xfaf2('0x32')](db[_0xfaf2('0x2e')][_0xfaf2('0x46')]);_0x3a847f['query']=_['keys'](_0x58caba[_0xfaf2('0x31')]);_0x3a847f['filters']=_[_0xfaf2('0x34')](_0x3a847f[_0xfaf2('0x30')],_0x3a847f[_0xfaf2('0x31')]);_0x4ab6be[_0xfaf2('0x36')]=_[_0xfaf2('0x34')](_0x3a847f[_0xfaf2('0x30')],qs['fields'](_0x58caba[_0xfaf2('0x31')][_0xfaf2('0x35')]));_0x4ab6be[_0xfaf2('0x36')]=_0x4ab6be['attributes'][_0xfaf2('0x47')]?_0x4ab6be[_0xfaf2('0x36')]:_0x3a847f[_0xfaf2('0x30')];if(_0x58caba[_0xfaf2('0x31')][_0xfaf2('0x40')]){_0x4ab6be[_0xfaf2('0x41')]=[{'all':!![]}];}_0x4ab6be=_[_0xfaf2('0x3b')]({},_0x4ab6be,_0x58caba[_0xfaf2('0x3f')]);return db['Team'][_0xfaf2('0x48')](_0x4ab6be)[_0xfaf2('0x27')](handleEntityNotFound(_0x2bf084,null))[_0xfaf2('0x27')](respondWithResult(_0x2bf084,null))[_0xfaf2('0x44')](handleError(_0x2bf084,null));};exports[_0xfaf2('0x49')]=function(_0x299e68,_0x5bccd0){return db[_0xfaf2('0x2e')][_0xfaf2('0x49')](_0x299e68['body'],{})[_0xfaf2('0x27')](function(_0x315866){var _0x537eff=_0x299e68[_0xfaf2('0x4a')][_0xfaf2('0x4b')]({'plain':!![]});if(!_0x537eff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x537eff[_0xfaf2('0x4c')]===_0xfaf2('0x4a')){var _0x4bf12b=_0x315866[_0xfaf2('0x4b')]({'plain':!![]});var _0x544e12=_0xfaf2('0x4d');return db['UserProfileSection'][_0xfaf2('0x48')]({'where':{'name':_0x544e12,'userProfileId':_0x537eff[_0xfaf2('0x4e')]},'raw':!![]})[_0xfaf2('0x27')](function(_0x269407){if(_0x269407&&_0x269407['autoAssociation']===0x0){return db['UserProfileResource'][_0xfaf2('0x49')]({'name':_0x4bf12b[_0xfaf2('0x2a')],'resourceId':_0x4bf12b['id'],'type':_0x269407[_0xfaf2('0x2a')],'sectionId':_0x269407['id']},{})['then'](function(){return _0x315866;});}else{return _0x315866;}})['catch'](function(_0x3d87bf){logger[_0xfaf2('0x28')](_0xfaf2('0x4f'),_0x3d87bf);throw _0x3d87bf;});}return _0x315866;})['then'](respondWithResult(_0x5bccd0,0xc9))[_0xfaf2('0x44')](handleError(_0x5bccd0,null));};exports[_0xfaf2('0x26')]=function(_0x5c1f6c,_0x5795cc){if(_0x5c1f6c[_0xfaf2('0x50')]['id']){delete _0x5c1f6c[_0xfaf2('0x50')]['id'];}return db[_0xfaf2('0x2e')][_0xfaf2('0x48')]({'where':{'id':_0x5c1f6c[_0xfaf2('0x45')]['id']}})[_0xfaf2('0x27')](handleEntityNotFound(_0x5795cc,null))['then'](saveUpdates(_0x5c1f6c[_0xfaf2('0x50')],null))['then'](respondWithResult(_0x5795cc,null))['catch'](handleError(_0x5795cc,null));};exports[_0xfaf2('0x51')]=function(_0x3dcdb1,_0x43be89){var _0x259875=_0x3dcdb1[_0xfaf2('0x45')]['id'];var _0x5d6cf4=[];return db[_0xfaf2('0x52')][_0xfaf2('0x53')](function(_0x674ba7){var _0x335985=_0xfaf2('0x54')+_0x259875;return db[_0xfaf2('0x52')]['query'](_0x335985,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7})['then'](function(_0xd70c2){_0x5d6cf4=_[_0xfaf2('0x2d')](_0xd70c2,function(_0x320818){return Number(_0x320818[_0xfaf2('0x58')]);});})[_0xfaf2('0x27')](function(){var _0x13b519='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x259875;return db['sequelize']['query'](_0x13b519,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')]['SELECT'],'raw':!![],'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(_0x42ff5b){var _0x2d5e2a=_[_0xfaf2('0x2d')](_0x42ff5b,function(_0x413418){return Number(_0x413418[_0xfaf2('0x59')]);});return db[_0xfaf2('0x5a')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'VoiceQueueId':{'$in':_0x2d5e2a}},'transaction':_0x674ba7});})['then'](function(){var _0x3456e5=_0xfaf2('0x5b')+_0x259875;return db[_0xfaf2('0x52')][_0xfaf2('0x31')](_0x3456e5,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})['then'](function(_0x2a99c3){var _0x153253=_[_0xfaf2('0x2d')](_0x2a99c3,function(_0x23240f){return Number(_0x23240f[_0xfaf2('0x5c')]);});return db[_0xfaf2('0x5d')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'MailQueueId':{'$in':_0x153253}},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){var _0xcd71db=_0xfaf2('0x5e')+_0x259875;return db['sequelize'][_0xfaf2('0x31')](_0xcd71db,{'type':db[_0xfaf2('0x55')]['QueryTypes'][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(_0x25c267){var _0x38a618=_[_0xfaf2('0x2d')](_0x25c267,function(_0x5c2509){return Number(_0x5c2509['SmsQueueId']);});return db[_0xfaf2('0x5f')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'SmsQueueId':{'$in':_0x38a618}},'transaction':_0x674ba7});})['then'](function(){var _0x2dba19=_0xfaf2('0x60')+_0x259875;return db[_0xfaf2('0x52')][_0xfaf2('0x31')](_0x2dba19,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(_0xc07b12){var _0x4089a5=_[_0xfaf2('0x2d')](_0xc07b12,function(_0x4ae9d2){return Number(_0x4ae9d2[_0xfaf2('0x61')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x5d6cf4},'ChatQueueId':{'$in':_0x4089a5}},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){var _0x544d60='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x259875;return db[_0xfaf2('0x52')][_0xfaf2('0x31')](_0x544d60,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})['then'](function(_0x1ce8f4){var _0x54d180=_[_0xfaf2('0x2d')](_0x1ce8f4,function(_0x213cd3){return Number(_0x213cd3[_0xfaf2('0x62')]);});return db[_0xfaf2('0x63')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'FaxQueueId':{'$in':_0x54d180}},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){var _0x493fb1=_0xfaf2('0x64')+_0x259875;return db[_0xfaf2('0x52')][_0xfaf2('0x31')](_0x493fb1,{'type':db[_0xfaf2('0x55')]['QueryTypes'][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})['then'](function(_0x185489){var _0x2b4837=_[_0xfaf2('0x2d')](_0x185489,function(_0x438eb0){return Number(_0x438eb0[_0xfaf2('0x65')]);});return db[_0xfaf2('0x66')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'OpenchannelQueueId':{'$in':_0x2b4837}},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){var _0x2f50bb='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x259875;return db[_0xfaf2('0x52')][_0xfaf2('0x31')](_0x2f50bb,{'type':db[_0xfaf2('0x55')][_0xfaf2('0x56')][_0xfaf2('0x57')],'raw':!![],'transaction':_0x674ba7});})['then'](function(_0x565eb2){var _0x36cdb0=_[_0xfaf2('0x2d')](_0x565eb2,function(_0x4d777e){return Number(_0x4d777e[_0xfaf2('0x67')]);});return db[_0xfaf2('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5d6cf4},'WhatsappQueueId':{'$in':_0x36cdb0}},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){return db[_0xfaf2('0x69')][_0xfaf2('0x48')]({'where':{'TeamId':_0x259875}});})[_0xfaf2('0x27')](function(_0x27af2b){if(_0x27af2b===null){return;}return db[_0xfaf2('0x6a')][_0xfaf2('0x51')]({'where':{'UserId':{'$in':_0x5d6cf4},'VoicePrefixId':_0x27af2b[_0xfaf2('0x6b')]},'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(){return db[_0xfaf2('0x2e')]['destroy']({'where':{'id':_0x259875},'cascade':!![],'transaction':_0x674ba7});})[_0xfaf2('0x27')](function(_0x5b355a){if(_0x5b355a===0x0){_0x43be89[_0xfaf2('0x6c')](0x194);}else{return db[_0xfaf2('0x6d')][_0xfaf2('0x51')]({'where':{'type':'Teams','resourceId':_0x259875},'cascade':!![],'transaction':_0x674ba7})[_0xfaf2('0x27')](function(){_0x43be89[_0xfaf2('0x1b')](0xcc)[_0xfaf2('0x1c')]();});}})[_0xfaf2('0x44')](function(_0x8d885a){_0x43be89['status'](0x1f4)[_0xfaf2('0x2b')](_0x8d885a);});});};exports['getQueues']=function(_0x313b88,_0x5c80a8,_0x28876d){return db[_0xfaf2('0x2e')]['findOne']({'where':{'id':_0x313b88[_0xfaf2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c80a8,null))[_0xfaf2('0x27')](function(_0x25564a){if(!_0x313b88[_0xfaf2('0x31')][_0xfaf2('0x6e')]||!utils[_0xfaf2('0x6f')](_0x313b88[_0xfaf2('0x31')]['channel'])){throw new db[(_0xfaf2('0x55'))]['ValidationError'](_0xfaf2('0x70'));}var _0x32a74f={};var _0x410704={};_0x410704[_0xfaf2('0x30')]=_['keys'](db[_[_0xfaf2('0x71')](_0x313b88[_0xfaf2('0x31')][_0xfaf2('0x6e')][_0xfaf2('0x72')]())+_0xfaf2('0x73')][_0xfaf2('0x46')]);_0x410704[_0xfaf2('0x31')]=_['keys'](_0x313b88[_0xfaf2('0x31')]);_0x410704[_0xfaf2('0x33')]=_[_0xfaf2('0x34')](_0x410704[_0xfaf2('0x30')],_0x410704['query']);_0x32a74f['attributes']=_[_0xfaf2('0x34')](_0x410704[_0xfaf2('0x30')],qs[_0xfaf2('0x35')](_0x313b88[_0xfaf2('0x31')][_0xfaf2('0x35')]));_0x32a74f[_0xfaf2('0x36')]=_0x32a74f[_0xfaf2('0x36')][_0xfaf2('0x47')]?_0x32a74f[_0xfaf2('0x36')]:_0x410704[_0xfaf2('0x30')];_0x32a74f['limit']=qs[_0xfaf2('0x20')](_0x313b88[_0xfaf2('0x31')]['limit']);_0x32a74f[_0xfaf2('0x1e')]=qs[_0xfaf2('0x1e')](_0x313b88[_0xfaf2('0x31')][_0xfaf2('0x1e')]);_0x32a74f['order']=qs[_0xfaf2('0x74')](_0x313b88['query'][_0xfaf2('0x74')]);_0x32a74f[_0xfaf2('0x39')]=qs[_0xfaf2('0x33')](_['pick'](_0x313b88[_0xfaf2('0x31')],_0x410704['filters']));_0x32a74f=_[_0xfaf2('0x3b')]({},_0x32a74f,_0x313b88[_0xfaf2('0x3f')]);return _0x25564a['get'+_[_0xfaf2('0x71')](_0x313b88[_0xfaf2('0x31')][_0xfaf2('0x6e')]['toLowerCase']())+_0xfaf2('0x75')](_0x32a74f);})[_0xfaf2('0x27')](respondWithResult(_0x5c80a8,null))[_0xfaf2('0x44')](handleError(_0x5c80a8,null));};exports[_0xfaf2('0x76')]=function(_0x6a635e,_0x363766,_0x11b44a){return db[_0xfaf2('0x2e')][_0xfaf2('0x77')]({'where':{'id':_0x6a635e['params']['id']}})[_0xfaf2('0x27')](function(_0x55e465){if(_0x55e465){if(!_0x6a635e[_0xfaf2('0x50')][_0xfaf2('0x6e')]||!utils['isValidChannel'](_0x6a635e['body'][_0xfaf2('0x6e')])){throw new db[(_0xfaf2('0x55'))]['ValidationError']('Unknown\x20channel');}return _0x55e465[_0xfaf2('0x78')+_[_0xfaf2('0x71')](_0x6a635e['body'][_0xfaf2('0x6e')][_0xfaf2('0x72')]())+'Queues'](_0x6a635e[_0xfaf2('0x50')]['ids']);}return null;})[_0xfaf2('0x27')](handleEntityNotFound(_0x363766,null))[_0xfaf2('0x27')](respondWithStatusCode(_0x363766,null))[_0xfaf2('0x44')](handleError(_0x363766,null));};exports[_0xfaf2('0x79')]=function(_0x311f6f,_0x2da824,_0x1ca685){return db[_0xfaf2('0x2e')][_0xfaf2('0x77')]({'where':{'id':_0x311f6f['params']['id']}})[_0xfaf2('0x27')](function(_0x450f4a){if(_0x450f4a){if(!_0x311f6f['query'][_0xfaf2('0x6e')]||!utils[_0xfaf2('0x6f')](_0x311f6f[_0xfaf2('0x31')]['channel'])){throw new db[(_0xfaf2('0x55'))][(_0xfaf2('0x7a'))](_0xfaf2('0x70'));}return _0x450f4a[_0xfaf2('0x7b')+_['capitalize'](_0x311f6f[_0xfaf2('0x31')]['channel'][_0xfaf2('0x72')]())+_0xfaf2('0x75')](_0x311f6f[_0xfaf2('0x31')][_0xfaf2('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x2da824,null))[_0xfaf2('0x27')](respondWithStatusCode(_0x2da824,null))[_0xfaf2('0x44')](handleError(_0x2da824,null));};exports['addAgents']=function(_0x58fe03,_0x373066){var _0x2e3d50=_[_0xfaf2('0x7d')](_0x58fe03[_0xfaf2('0x50')][_0xfaf2('0x7c')])?_0x58fe03[_0xfaf2('0x50')][_0xfaf2('0x7c')]:[_0x58fe03['body'][_0xfaf2('0x7c')]];var _0x26d5cf=_0x58fe03[_0xfaf2('0x45')]['id'];return db['Team'][_0xfaf2('0x48')]({'where':{'id':_0x26d5cf}})[_0xfaf2('0x27')](handleEntityNotFound(_0x373066,null))[_0xfaf2('0x27')](function(_0x276172){if(_0x276172){var _0x4a35bf=[_0xfaf2('0x7e'),_0xfaf2('0x7f'),_0xfaf2('0x80'),_0xfaf2('0x81'),_0xfaf2('0x82'),_0xfaf2('0x83'),_0xfaf2('0x84')];return db['sequelize'][_0xfaf2('0x53')](function(_0x49ae28){var _0x340309=_['map'](_0x4a35bf,function(_0x3556e3){var _0x125eed={'attributes':['id',_0xfaf2('0x2a')]};if(_0x3556e3==='Voice'){_0x125eed[_0xfaf2('0x85')]={'attributes':['penalty']};}return _0x276172[_0xfaf2('0x4b')+_0x3556e3+_0xfaf2('0x75')](_0x125eed)[_0xfaf2('0x27')](function(_0x8fe92e){var _0x259ed1=_[_0xfaf2('0x2d')](_0x8fe92e,function(_0x505cc4){var _0x1e8151=_[_0xfaf2('0x2d')](_0x2e3d50,function(_0x1a70e2){var _0xc5dd18={'where':{'UserId':_0x1a70e2,[_0x3556e3+_0xfaf2('0x86')]:_0x505cc4['id']},'transaction':_0x49ae28};if(_0x3556e3===_0xfaf2('0x7e')){_0xc5dd18['defaults']={'penalty':_0x505cc4[_0xfaf2('0x87')][_0xfaf2('0x88')]};}return db[_0xfaf2('0x89')+_0x3556e3+_0xfaf2('0x73')][_0xfaf2('0x8a')](_0xc5dd18)[_0xfaf2('0x27')](function(){socket['emit'](_0xfaf2('0x4a')+_0x3556e3+'Queue:save',{'UserId':_0x1a70e2,[_0x3556e3+_0xfaf2('0x86')]:_0x505cc4['id']});if(_0x3556e3!==_0xfaf2('0x7e')){return;}return db[_0xfaf2('0x89')][_0xfaf2('0x42')]({'where':{'id':_0x2e3d50,'online':0x1},'attributes':['id',_0xfaf2('0x2a'),'online','voicePause',_0xfaf2('0x8b')],'raw':!![]})[_0xfaf2('0x27')](function(_0x3feeb9){var _0x483a77=_['map'](_0x3feeb9,function(_0xc0b0e8){return db[_0xfaf2('0x8c')][_0xfaf2('0x8d')]({'membername':_0xc0b0e8[_0xfaf2('0x2a')],'UserId':_0xc0b0e8['id'],'queue_name':_0x505cc4['name'],'VoiceQueueId':_0x505cc4['id'],'interface':_[_0xfaf2('0x8e')](_0xc0b0e8[_0xfaf2('0x8b')])?util[_0xfaf2('0x8f')]('SIP/%s',_0xc0b0e8[_0xfaf2('0x2a')]):_0xc0b0e8[_0xfaf2('0x8b')],'paused':_0xc0b0e8['voicePause']||![],'penalty':_0x505cc4['TeamVoiceQueue']['penalty']},{'transaction':_0x49ae28});});return Promise[_0xfaf2('0x90')](_0x483a77);});});});return Promise[_0xfaf2('0x90')](_0x1e8151);});return Promise[_0xfaf2('0x90')](_0x259ed1);})[_0xfaf2('0x27')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x26d5cf}})['then'](function(_0x221b2e){if(_0x221b2e){var _0x59712d=_[_0xfaf2('0x2d')](_0x2e3d50,function(_0x4aeb0b){db[_0xfaf2('0x6a')][_0xfaf2('0x8d')]({'UserId':_0x4aeb0b,'VoicePrefixId':_0x221b2e['VoicePrefixId']});});return Promise[_0xfaf2('0x90')](_0x59712d);}});});});return Promise[_0xfaf2('0x90')](_0x340309)[_0xfaf2('0x27')](function(){return _0x276172[_0xfaf2('0x91')](_0x2e3d50,{'transaction':_0x49ae28})[_0xfaf2('0x92')](function(_0x509aaf){return _0x509aaf;});});});}})[_0xfaf2('0x27')](respondWithResult(_0x373066,null))[_0xfaf2('0x44')](handleError(_0x373066,null));};exports['removeAgents']=function(_0x14fc92,_0x5b9090){var _0x1bacfc=_[_0xfaf2('0x7d')](_0x14fc92[_0xfaf2('0x31')]['ids'])?_0x14fc92[_0xfaf2('0x31')][_0xfaf2('0x7c')]:[_0x14fc92[_0xfaf2('0x31')][_0xfaf2('0x7c')]];var _0x2afc4d=_0x14fc92[_0xfaf2('0x45')]['id'];return db[_0xfaf2('0x2e')][_0xfaf2('0x48')]({'where':{'id':_0x2afc4d}})[_0xfaf2('0x27')](handleEntityNotFound(_0x5b9090,null))['then'](function(_0x1a6b5a){if(_0x1a6b5a){var _0x1b5440=[_0xfaf2('0x7e'),_0xfaf2('0x7f'),_0xfaf2('0x80'),'Sms','Fax',_0xfaf2('0x83'),_0xfaf2('0x84')];return db[_0xfaf2('0x52')][_0xfaf2('0x53')](function(_0x3b9758){var _0x3e4e2a=_['map'](_0x1b5440,function(_0x491daf){var _0x703985={'attributes':['id',_0xfaf2('0x2a')]};return _0x1a6b5a[_0xfaf2('0x4b')+_0x491daf+_0xfaf2('0x75')](_0x703985)['then'](function(_0x707c4e){var _0x154b54=_[_0xfaf2('0x2d')](_0x707c4e,function(_0x4e29c4){return _0x4e29c4[_0xfaf2('0x93')](_0x1bacfc,{'transaction':_0x3b9758})[_0xfaf2('0x27')](function(){var _0x5a2a1f=_[_0xfaf2('0x2d')](_0x1bacfc,function(_0x64614a){socket[_0xfaf2('0x94')]('user'+_0x491daf+_0xfaf2('0x95'),{'UserId':Number(_0x64614a),[_0x491daf+'QueueId']:_0x4e29c4['id']});if(_0x491daf!==_0xfaf2('0x7e')){return;}return db[_0xfaf2('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x4e29c4['id'],'UserId':_0x64614a},'transaction':_0x3b9758});});return Promise['all'](_0x5a2a1f);});});return Promise[_0xfaf2('0x90')](_0x154b54);});});return Promise['all'](_0x3e4e2a)[_0xfaf2('0x27')](function(){return _0x1a6b5a[_0xfaf2('0x93')](_0x1bacfc,{'transaction':_0x3b9758});})[_0xfaf2('0x27')](function(){return db['TeamVoicePrefix'][_0xfaf2('0x77')]({'where':{'teamId':_0x2afc4d}})['then'](function(_0x10906b){if(_0x10906b){var _0x12ce75=_[_0xfaf2('0x2d')](_0x1bacfc,function(_0x7da3fc){db[_0xfaf2('0x6a')][_0xfaf2('0x51')]({'where':{'UserId':_0x7da3fc,'VoicePrefixId':_0x10906b[_0xfaf2('0x6b')]}});});return Promise[_0xfaf2('0x90')](_0x12ce75);}});});});}})[_0xfaf2('0x27')](respondWithStatusCode(_0x5b9090,null))[_0xfaf2('0x44')](handleError(_0x5b9090,null));};exports['getAgents']=function(_0x140654,_0x4a3fb9,_0x15614c){var _0x919812={};var _0x540309={};var _0x36105e;var _0x3dba4d;return db[_0xfaf2('0x2e')][_0xfaf2('0x77')]({'where':{'id':_0x140654[_0xfaf2('0x45')]['id']}})[_0xfaf2('0x27')](handleEntityNotFound(_0x4a3fb9,null))['then'](function(_0x484c95){if(_0x484c95){_0x36105e=_0x484c95;_0x540309[_0xfaf2('0x30')]=_['keys'](db['User'][_0xfaf2('0x46')]);_0x540309[_0xfaf2('0x31')]=_['keys'](_0x140654[_0xfaf2('0x31')]);_0x540309[_0xfaf2('0x33')]=_['intersection'](_0x540309[_0xfaf2('0x30')],_0x540309[_0xfaf2('0x31')]);_0x919812['attributes']=_[_0xfaf2('0x34')](_0x540309['model'],qs['fields'](_0x140654['query'][_0xfaf2('0x35')]));_0x919812[_0xfaf2('0x36')]=_0x919812[_0xfaf2('0x36')][_0xfaf2('0x47')]?_0x919812[_0xfaf2('0x36')]:_0x540309[_0xfaf2('0x30')];_0x919812[_0xfaf2('0x38')]=qs['sort'](_0x140654[_0xfaf2('0x31')]['sort']);_0x919812[_0xfaf2('0x39')]=qs[_0xfaf2('0x33')](_['pick'](_0x140654[_0xfaf2('0x31')],_0x540309[_0xfaf2('0x33')]));if(_0x140654['query'][_0xfaf2('0x3e')]){_0x919812[_0xfaf2('0x39')]=_[_0xfaf2('0x3b')](_0x919812[_0xfaf2('0x39')],{'$or':_[_0xfaf2('0x2d')](_0x919812['attributes'],function(_0x1c99d6){var _0xee08fe={};_0xee08fe[_0x1c99d6]={'$like':'%'+_0x140654[_0xfaf2('0x31')]['filter']+'%'};return _0xee08fe;})});}_0x919812=_[_0xfaf2('0x3b')]({},_0x919812,_0x140654['options']);return _0x36105e[_0xfaf2('0x96')](_0x919812);}})[_0xfaf2('0x27')](function(_0x2985db){if(_0x2985db){_0x3dba4d=_0x2985db[_0xfaf2('0x47')];if(!_0x140654[_0xfaf2('0x31')][_0xfaf2('0x97')](_0xfaf2('0x37'))){_0x919812['limit']=qs[_0xfaf2('0x20')](_0x140654[_0xfaf2('0x31')][_0xfaf2('0x20')]);_0x919812[_0xfaf2('0x1e')]=qs[_0xfaf2('0x1e')](_0x140654[_0xfaf2('0x31')][_0xfaf2('0x1e')]);}return _0x36105e[_0xfaf2('0x96')](_0x919812);}})[_0xfaf2('0x27')](function(_0x31e0f0){if(_0x31e0f0){return _0x31e0f0?{'count':_0x3dba4d,'rows':_0x31e0f0}:null;}})['then'](respondWithResult(_0x4a3fb9,null))[_0xfaf2('0x44')](handleError(_0x4a3fb9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2faf7e1..b074be5 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 _0xd98b=['remove','emit','hasOwnProperty','exports','events','Team','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd98b,0x14c));var _0xbd98=function(_0x39b07e,_0x33b057){_0x39b07e=_0x39b07e-0x0;var _0x591dae=_0xd98b[_0x39b07e];return _0x591dae;};'use strict';var EventEmitter=require(_0xbd98('0x0'));var Team=require('../../mysqldb')['db'][_0xbd98('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd98('0x2'),'afterUpdate':_0xbd98('0x3'),'afterDestroy':_0xbd98('0x4')};function emitEvent(_0x2b532f){return function(_0x13a30d,_0xb2b2b7,_0x1de353){TeamEvents['emit'](_0x2b532f+':'+_0x13a30d['id'],_0x13a30d);TeamEvents[_0xbd98('0x5')](_0x2b532f,_0x13a30d);_0x1de353(null);};}for(var e in events){if(events[_0xbd98('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xbd98('0x7')]=TeamEvents; \ No newline at end of file +var _0xdb03=['emit','hook','exports','../../mysqldb','Team','save','remove'];(function(_0x2d3ff2,_0x2d937d){var _0x582ca6=function(_0x49f61d){while(--_0x49f61d){_0x2d3ff2['push'](_0x2d3ff2['shift']());}};_0x582ca6(++_0x2d937d);}(_0xdb03,0x1a7));var _0x3db0=function(_0xf6b693,_0x294b81){_0xf6b693=_0xf6b693-0x0;var _0x48a7f7=_0xdb03[_0xf6b693];return _0x48a7f7;};'use strict';var EventEmitter=require('events');var Team=require(_0x3db0('0x0'))['db'][_0x3db0('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3db0('0x2'),'afterUpdate':'update','afterDestroy':_0x3db0('0x3')};function emitEvent(_0x57d32c){return function(_0x1e2900,_0x11691b,_0xd88d70){TeamEvents[_0x3db0('0x4')](_0x57d32c+':'+_0x1e2900['id'],_0x1e2900);TeamEvents[_0x3db0('0x4')](_0x57d32c,_0x1e2900);_0xd88d70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3db0('0x5')](e,emitEvent(event));}}module[_0x3db0('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 43b610f..f2d6b5a 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 _0xccd4=['teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','./team.attributes','Queues','then','map','setDataValue','catch','exports','define'];(function(_0x5c683b,_0x2f913e){var _0x4da8f1=function(_0x1b130f){while(--_0x1b130f){_0x5c683b['push'](_0x5c683b['shift']());}};_0x4da8f1(++_0x2f913e);}(_0xccd4,0x119));var _0x4ccd=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xccd4[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var attributes=require(_0x4ccd('0x0'));function getQueuesByChannel(_0x47d25a,_0x593df2){var _0x5d7eac='get'+_0x593df2+_0x4ccd('0x1');return _0x47d25a[_0x5d7eac]()[_0x4ccd('0x2')](function(_0x4a7bae){return _[_0x4ccd('0x3')](_0x4a7bae,function(_0x40bdeb){_0x40bdeb[_0x4ccd('0x4')]('channel',_0x593df2);return _0x40bdeb;});})[_0x4ccd('0x5')](function(_0x16e899){throw _0x16e899;});}module[_0x4ccd('0x6')]=function(_0x594fe4){return _0x594fe4[_0x4ccd('0x7')]('Team',attributes,{'tableName':_0x4ccd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x54d1eb=this;var _0x4a6c2e=[_0x4ccd('0x9'),_0x4ccd('0xa'),_0x4ccd('0xb'),_0x4ccd('0xc'),_0x4ccd('0xd'),_0x4ccd('0xe'),'Whatsapp'];return Promise[_0x4ccd('0xf')]()[_0x4ccd('0x2')](function(){var _0x34a1e7=_['map'](_0x4a6c2e,function(_0x263705){return getQueuesByChannel(_0x54d1eb,_0x263705);});return Promise[_0x4ccd('0x10')](_0x34a1e7);})[_0x4ccd('0x5')](function(_0x5ddd71){throw _0x5ddd71;});}}});}; \ No newline at end of file +var _0x0337=['Team','teams','Chat','Openchannel','Sms','Voice','resolve','then','map','all','lodash','./team.attributes','get','Queues','setDataValue','catch','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0337,0x1b3));var _0x7033=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x0337[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x7033('0x0'));var attributes=require(_0x7033('0x1'));function getQueuesByChannel(_0x5b2881,_0x3c76c0){var _0x1099db=_0x7033('0x2')+_0x3c76c0+_0x7033('0x3');return _0x5b2881[_0x1099db]()['then'](function(_0x2d0026){return _['map'](_0x2d0026,function(_0x25044b){_0x25044b[_0x7033('0x4')]('channel',_0x3c76c0);return _0x25044b;});})[_0x7033('0x5')](function(_0x2833fa){throw _0x2833fa;});}module[_0x7033('0x6')]=function(_0x96006e){return _0x96006e['define'](_0x7033('0x7'),attributes,{'tableName':_0x7033('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x587707=this;var _0x432017=[_0x7033('0x9'),'Fax','Mail',_0x7033('0xa'),_0x7033('0xb'),_0x7033('0xc'),'Whatsapp'];return Promise[_0x7033('0xd')]()[_0x7033('0xe')](function(){var _0x1d161b=_[_0x7033('0xf')](_0x432017,function(_0x2eb672){return getQueuesByChannel(_0x587707,_0x2eb672);});return Promise[_0x7033('0x10')](_0x1d161b);})['catch'](function(_0x3594d1){throw _0x3594d1;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8d38059..156869a 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 _0xdc56=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdc56,0x18a));var _0x6dc5=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xdc56[_0x37cc52];return _0x2b4a90;};'use strict';var _=require('lodash');var util=require(_0x6dc5('0x0'));var moment=require(_0x6dc5('0x1'));var BPromise=require(_0x6dc5('0x2'));var rs=require(_0x6dc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dc5('0x5'))(_0x6dc5('0x6'));var config=require(_0x6dc5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6dc5('0x8')][_0x6dc5('0x9')]({'port':0x232a});config[_0x6dc5('0xa')]=_[_0x6dc5('0xb')](config[_0x6dc5('0xa')],{'host':_0x6dc5('0xc'),'port':0x18eb});var socket=require(_0x6dc5('0xd'))(new Redis(config[_0x6dc5('0xa')]));require('./team.socket')[_0x6dc5('0xe')](socket);function respondWithRpcPromise(_0x23ec10,_0x123bbb,_0x1ce619){return new BPromise(function(_0x102ac9,_0x32b829){return client[_0x6dc5('0xf')](_0x23ec10,_0x1ce619)[_0x6dc5('0x10')](function(_0x2a0c94){logger[_0x6dc5('0x11')](_0x6dc5('0x12'),_0x123bbb,_0x6dc5('0x13'));logger[_0x6dc5('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x123bbb,_0x6dc5('0x13'),JSON[_0x6dc5('0x15')](_0x2a0c94));if(_0x2a0c94[_0x6dc5('0x16')]){if(_0x2a0c94['error']['code']===0x1f4){logger['error'](_0x6dc5('0x12'),_0x123bbb,_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);return _0x32b829(_0x2a0c94['error']['message']);}logger[_0x6dc5('0x16')](_0x6dc5('0x12'),_0x123bbb,_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);return _0x102ac9(_0x2a0c94[_0x6dc5('0x16')][_0x6dc5('0x17')]);}else{logger[_0x6dc5('0x11')](_0x6dc5('0x12'),_0x123bbb,_0x6dc5('0x13'));_0x102ac9(_0x2a0c94[_0x6dc5('0x18')][_0x6dc5('0x17')]);}})['catch'](function(_0x57a2bc){logger[_0x6dc5('0x16')](_0x6dc5('0x12'),_0x123bbb,_0x57a2bc);_0x32b829(_0x57a2bc);});});} \ No newline at end of file +var _0x6601=['defaults','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x1b2489,_0x301953){var _0x1cc839=function(_0x496338){while(--_0x496338){_0x1b2489['push'](_0x1b2489['shift']());}};_0x1cc839(++_0x301953);}(_0x6601,0x12f));var _0x1660=function(_0xac5265,_0x3f2893){_0xac5265=_0xac5265-0x0;var _0x5a4d6a=_0x6601[_0xac5265];return _0x5a4d6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1660('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1660('0x1'));var db=require(_0x1660('0x2'))['db'];var utils=require(_0x1660('0x3'));var logger=require('../../config/logger')(_0x1660('0x4'));var config=require(_0x1660('0x5'));var jayson=require(_0x1660('0x6'));var client=jayson['client'][_0x1660('0x7')]({'port':0x232a});config[_0x1660('0x8')]=_[_0x1660('0x9')](config[_0x1660('0x8')],{'host':_0x1660('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1660('0x8')]));require(_0x1660('0xb'))[_0x1660('0xc')](socket);function respondWithRpcPromise(_0x3f04ff,_0x2d1cbf,_0xf3aa55){return new BPromise(function(_0x29049a,_0x41f0fa){return client[_0x1660('0xd')](_0x3f04ff,_0xf3aa55)[_0x1660('0xe')](function(_0x2c247f){logger[_0x1660('0xf')](_0x1660('0x10'),_0x2d1cbf,'request\x20sent');logger[_0x1660('0x11')](_0x1660('0x12'),_0x2d1cbf,_0x1660('0x13'),JSON[_0x1660('0x14')](_0x2c247f));if(_0x2c247f['error']){if(_0x2c247f[_0x1660('0x15')][_0x1660('0x16')]===0x1f4){logger['error'](_0x1660('0x10'),_0x2d1cbf,_0x2c247f['error']['message']);return _0x41f0fa(_0x2c247f['error'][_0x1660('0x17')]);}logger[_0x1660('0x15')](_0x1660('0x10'),_0x2d1cbf,_0x2c247f[_0x1660('0x15')][_0x1660('0x17')]);return _0x29049a(_0x2c247f['error']['message']);}else{logger[_0x1660('0xf')]('Team,\x20%s,\x20%s',_0x2d1cbf,_0x1660('0x13'));_0x29049a(_0x2c247f[_0x1660('0x18')][_0x1660('0x17')]);}})[_0x1660('0x19')](function(_0x2ec27e){logger[_0x1660('0x15')](_0x1660('0x10'),_0x2d1cbf,_0x2ec27e);_0x41f0fa(_0x2ec27e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5dd50d8..8df2f87 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 _0x4ba0=['remove','emit','length','team:','./team.events'];(function(_0x1e7bdd,_0x216b81){var _0xcd343d=function(_0x5203cd){while(--_0x5203cd){_0x1e7bdd['push'](_0x1e7bdd['shift']());}};_0xcd343d(++_0x216b81);}(_0x4ba0,0xe0));var _0x04ba=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4ba0[_0x1deb03];return _0x189fe7;};'use strict';var TeamEvents=require(_0x04ba('0x0'));var events=['save',_0x04ba('0x1'),'update'];function createListener(_0x2353a5,_0x1cf1e2){return function(_0x133126){_0x1cf1e2[_0x04ba('0x2')](_0x2353a5,_0x133126);};}function removeListener(_0x5c87c2,_0x438657){return function(){TeamEvents['removeListener'](_0x5c87c2,_0x438657);};}exports['register']=function(_0x17959f){for(var _0x5b7994=0x0,_0x1ae533=events[_0x04ba('0x3')];_0x5b7994<_0x1ae533;_0x5b7994++){var _0x1e9dc8=events[_0x5b7994];var _0x37821a=createListener(_0x04ba('0x4')+_0x1e9dc8,_0x17959f);TeamEvents['on'](_0x1e9dc8,_0x37821a);}}; \ No newline at end of file +var _0x5706=['./team.events','save','remove','emit','removeListener','register','length','team:'];(function(_0x494f83,_0x26e747){var _0x3823be=function(_0x413e59){while(--_0x413e59){_0x494f83['push'](_0x494f83['shift']());}};_0x3823be(++_0x26e747);}(_0x5706,0xb0));var _0x6570=function(_0x21d2e9,_0x3db553){_0x21d2e9=_0x21d2e9-0x0;var _0x9db6ac=_0x5706[_0x21d2e9];return _0x9db6ac;};'use strict';var TeamEvents=require(_0x6570('0x0'));var events=[_0x6570('0x1'),_0x6570('0x2'),'update'];function createListener(_0x3b5e28,_0x53f61a){return function(_0x180a98){_0x53f61a[_0x6570('0x3')](_0x3b5e28,_0x180a98);};}function removeListener(_0x95a926,_0x26e23c){return function(){TeamEvents[_0x6570('0x4')](_0x95a926,_0x26e23c);};}exports[_0x6570('0x5')]=function(_0x3ae2f1){for(var _0x3eb22a=0x0,_0x140ee2=events[_0x6570('0x6')];_0x3eb22a<_0x140ee2;_0x3eb22a++){var _0x528392=events[_0x3eb22a];var _0x594eef=createListener(_0x6570('0x7')+_0x528392,_0x3ae2f1);TeamEvents['on'](_0x528392,_0x594eef);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 39ecf5a..ff1b41d 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f37=['INTEGER','sequelize','exports'];(function(_0x156cfe,_0x26e5a4){var _0x58f776=function(_0x28950f){while(--_0x28950f){_0x156cfe['push'](_0x156cfe['shift']());}};_0x58f776(++_0x26e5a4);}(_0x8f37,0x190));var _0x78f3=function(_0xf4e004,_0x46b454){_0xf4e004=_0xf4e004-0x0;var _0x3b0b33=_0x8f37[_0xf4e004];return _0x3b0b33;};'use strict';var Sequelize=require(_0x78f3('0x0'));module[_0x78f3('0x1')]={'TeamId':{'type':Sequelize[_0x78f3('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc788=['INTEGER','sequelize','exports'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc788,0xc4));var _0x8c78=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0xc788[_0x33cf66];return _0x3a400b;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'TeamId':{'type':Sequelize[_0x8c78('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 81cb9fa..07f5c1f 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9861=['TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x9861,0x176));var _0x1986=function(_0x57d879,_0x244e47){_0x57d879=_0x57d879-0x0;var _0x5b686c=_0x9861[_0x57d879];return _0x5b686c;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88c3=['../../config/logger','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x5018ec,_0x1d43ee){var _0x15ec3d=function(_0x496ebd){while(--_0x496ebd){_0x5018ec['push'](_0x5018ec['shift']());}};_0x15ec3d(++_0x1d43ee);}(_0x88c3,0x1ee));var _0x388c=function(_0x21cb23,_0xd2fd69){_0x21cb23=_0x21cb23-0x0;var _0xa82ca7=_0x88c3[_0x21cb23];return _0xa82ca7;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6761a87..781b442 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3efa54,_0x1be78d){var _0x59407f=function(_0x2f15e4){while(--_0x2f15e4){_0x3efa54['push'](_0x3efa54['shift']());}};_0x59407f(++_0x1be78d);}(_0x70e0,0x17b));var _0x070e=function(_0xd22ddf,_0x3aceeb){_0xd22ddf=_0xd22ddf-0x0;var _0x20ec6d=_0x70e0[_0xd22ddf];return _0x20ec6d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x36b6e0,_0x1f0852){var _0x31d617=function(_0x384402){while(--_0x384402){_0x36b6e0['push'](_0x36b6e0['shift']());}};_0x31d617(++_0x1f0852);}(_0xedd9,0xfc));var _0x9edd=function(_0x81a15a,_0x29ad6b){_0x81a15a=_0x81a15a-0x0;var _0x5adacc=_0xedd9[_0x81a15a];return _0x5adacc;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 56689be..788ebc7 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 _0x54b4=['exports','INTEGER'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x54b4,0x132));var _0x454b=function(_0x54ac01,_0x1db85c){_0x54ac01=_0x54ac01-0x0;var _0x3784fd=_0x54b4[_0x54ac01];return _0x3784fd;};'use strict';var Sequelize=require('sequelize');module[_0x454b('0x0')]={'penalty':{'type':Sequelize[_0x454b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x369e=['sequelize','exports'];(function(_0x35eb94,_0x2e78a8){var _0x593add=function(_0x8d2e6d){while(--_0x8d2e6d){_0x35eb94['push'](_0x35eb94['shift']());}};_0x593add(++_0x2e78a8);}(_0x369e,0x174));var _0xe369=function(_0x3e44d0,_0x52fb2){_0x3e44d0=_0x3e44d0-0x0;var _0x47ba9a=_0x369e[_0x3e44d0];return _0x47ba9a;};'use strict';var Sequelize=require(_0xe369('0x0'));module[_0xe369('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 2724f1f..dddf6ee 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 _0x79d8=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5aaef7,_0x16da8d){var _0x57f857=function(_0x479ff1){while(--_0x479ff1){_0x5aaef7['push'](_0x5aaef7['shift']());}};_0x57f857(++_0x16da8d);}(_0x79d8,0x67));var _0x879d=function(_0x1a4537,_0x4d0be5){_0x1a4537=_0x1a4537-0x0;var _0x377e3c=_0x79d8[_0x1a4537];return _0x377e3c;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var logger=require(_0x879d('0x2'))(_0x879d('0x3'));var moment=require('moment');var BPromise=require(_0x879d('0x4'));var rp=require(_0x879d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879d('0x6'));var config=require(_0x879d('0x7'));var attributes=require(_0x879d('0x8'));module['exports']=function(_0x2d578e,_0x46ed21){return _0x2d578e[_0x879d('0x9')](_0x879d('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb8=['../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x5a62bb,_0x2dd3c5){var _0x2dea04=function(_0x3842b4){while(--_0x3842b4){_0x5a62bb['push'](_0x5a62bb['shift']());}};_0x2dea04(++_0x2dd3c5);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x447106,_0xe48ec8){_0x447106=_0x447106-0x0;var _0x2ea16b=_0xbbb8[_0x447106];return _0x2ea16b;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var logger=require('../../config/logger')(_0x8bbb('0x2'));var moment=require(_0x8bbb('0x3'));var BPromise=require('bluebird');var rp=require(_0x8bbb('0x4'));var fs=require('fs');var path=require(_0x8bbb('0x5'));var rimraf=require(_0x8bbb('0x6'));var config=require(_0x8bbb('0x7'));var attributes=require(_0x8bbb('0x8'));module[_0x8bbb('0x9')]=function(_0x2608b6,_0x3424eb){return _0x2608b6[_0x8bbb('0xa')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index d5ba883..1a7df0c 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 _0x5636=['code','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5636,0x102));var _0x6563=function(_0x1f3570,_0x1cf0a1){_0x1f3570=_0x1f3570-0x0;var _0x39d4cd=_0x5636[_0x1f3570];return _0x39d4cd;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file +var _0xa27b=['moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x34205f,_0x229d3c){var _0xc149d0=function(_0x2c44a7){while(--_0x2c44a7){_0x34205f['push'](_0x34205f['shift']());}};_0xc149d0(++_0x229d3c);}(_0xa27b,0x1b5));var _0xba27=function(_0x341877,_0xa3554c){_0x341877=_0x341877-0x0;var _0x274c5a=_0xa27b[_0x341877];return _0x274c5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba27('0x0'));var BPromise=require('bluebird');var rs=require(_0xba27('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba27('0x2'))['db'];var utils=require(_0xba27('0x3'));var logger=require('../../config/logger')(_0xba27('0x4'));var config=require('../../config/environment');var jayson=require(_0xba27('0x5'));var client=jayson[_0xba27('0x6')][_0xba27('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c92f0,_0x426c10,_0x2e9f8c){return new BPromise(function(_0xb61079,_0x410dda){return client[_0xba27('0x8')](_0x2c92f0,_0x2e9f8c)[_0xba27('0x9')](function(_0x5b36d4){logger[_0xba27('0xa')](_0xba27('0xb'),_0x426c10,'request\x20sent');logger[_0xba27('0xc')](_0xba27('0xd'),_0x426c10,'request\x20sent',JSON['stringify'](_0x5b36d4));if(_0x5b36d4[_0xba27('0xe')]){if(_0x5b36d4[_0xba27('0xe')][_0xba27('0xf')]===0x1f4){logger[_0xba27('0xe')](_0xba27('0xb'),_0x426c10,_0x5b36d4[_0xba27('0xe')]['message']);return _0x410dda(_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);}logger[_0xba27('0xe')](_0xba27('0xb'),_0x426c10,_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);return _0xb61079(_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);}else{logger[_0xba27('0xa')](_0xba27('0xb'),_0x426c10,_0xba27('0x11'));_0xb61079(_0x5b36d4['result'][_0xba27('0x10')]);}})[_0xba27('0x12')](function(_0x2c4c61){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x426c10,_0x2c4c61);_0x410dda(_0x2c4c61);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f1d5ca4..028f736 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 _0x24bb=['./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','path','express','Router','../../components/auth/service'];(function(_0x40f9dd,_0x2d92c1){var _0x34d3f0=function(_0x568948){while(--_0x568948){_0x40f9dd['push'](_0x40f9dd['shift']());}};_0x34d3f0(++_0x2d92c1);}(_0x24bb,0x19f));var _0xb24b=function(_0x2e084f,_0x1f542b){_0x2e084f=_0x2e084f-0x0;var _0x32116b=_0x24bb[_0x2e084f];return _0x32116b;};'use strict';var multer=require(_0xb24b('0x0'));var util=require('util');var path=require(_0xb24b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb24b('0x2'));var router=express[_0xb24b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb24b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb24b('0x5'));router[_0xb24b('0x6')]('/',auth[_0xb24b('0x7')](),controller['index']);router['get'](_0xb24b('0x8'),auth[_0xb24b('0x7')](),controller[_0xb24b('0x9')]);router[_0xb24b('0xa')]('/',auth[_0xb24b('0x7')](),controller[_0xb24b('0xb')]);router[_0xb24b('0xc')](_0xb24b('0x8'),auth['isAuthenticated'](),controller[_0xb24b('0xd')]);router[_0xb24b('0xe')](_0xb24b('0x8'),auth[_0xb24b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0309=['connect-timeout','express','fs-extra','../../components/auth/service','./template.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x46f2d4,_0x14bd47){var _0x3f0b92=function(_0x541bfe){while(--_0x541bfe){_0x46f2d4['push'](_0x46f2d4['shift']());}};_0x3f0b92(++_0x14bd47);}(_0x0309,0x8d));var _0x9030=function(_0x291347,_0x48305d){_0x291347=_0x291347-0x0;var _0x2c07a0=_0x0309[_0x291347];return _0x2c07a0;};'use strict';var multer=require(_0x9030('0x0'));var util=require(_0x9030('0x1'));var path=require(_0x9030('0x2'));var timeout=require(_0x9030('0x3'));var express=require(_0x9030('0x4'));var router=express['Router']();var fs_extra=require(_0x9030('0x5'));var auth=require(_0x9030('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9030('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9030('0x8')]('/:id',auth[_0x9030('0x9')](),controller[_0x9030('0xa')]);router[_0x9030('0xb')]('/',auth[_0x9030('0x9')](),controller[_0x9030('0xc')]);router[_0x9030('0xd')](_0x9030('0xe'),auth[_0x9030('0x9')](),controller[_0x9030('0xf')]);router['delete'](_0x9030('0xe'),auth['isAuthenticated'](),controller[_0x9030('0x10')]);module[_0x9030('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 97fb425..1a4264d 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 _0xd645=['TEXT','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd645,0x131));var _0x5d64=function(_0x4e41be,_0xe2d52c){_0x4e41be=_0x4e41be-0x0;var _0x214049=_0xd645[_0x4e41be];return _0x214049;};'use strict';var Sequelize=require(_0x5d64('0x0'));module[_0x5d64('0x1')]={'name':{'type':Sequelize[_0x5d64('0x2')]},'description':{'type':Sequelize[_0x5d64('0x2')]},'html':{'type':Sequelize[_0x5d64('0x3')]}}; \ No newline at end of file +var _0x1683=['sequelize','exports','STRING','TEXT'];(function(_0x2cd7b5,_0x1f8476){var _0x5598ca=function(_0xbf64e5){while(--_0xbf64e5){_0x2cd7b5['push'](_0x2cd7b5['shift']());}};_0x5598ca(++_0x1f8476);}(_0x1683,0x1e0));var _0x3168=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1683[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x3168('0x0'));module[_0x3168('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3168('0x2')]},'html':{'type':Sequelize[_0x3168('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 42d0054..0378ebd 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 _0x049d=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','sendStatus','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','pick','where','merge','map','options','count','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3638a6,_0xfd0fd4){var _0x16f9ea=function(_0x322c92){while(--_0x322c92){_0x3638a6['push'](_0x3638a6['shift']());}};_0x16f9ea(++_0xfd0fd4);}(_0x049d,0xa2));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd049('0x0'));var rimraf=require(_0xd049('0x1'));var zipdir=require(_0xd049('0x2'));var jsonpatch=require(_0xd049('0x3'));var rp=require(_0xd049('0x4'));var moment=require(_0xd049('0x5'));var BPromise=require(_0xd049('0x6'));var Mustache=require(_0xd049('0x7'));var util=require(_0xd049('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd049('0x9'));var ejs=require(_0xd049('0xa'));var fs=require('fs');var fs_extra=require(_0xd049('0xb'));var _=require(_0xd049('0xc'));var squel=require('squel');var crypto=require(_0xd049('0xd'));var jsforce=require(_0xd049('0xe'));var deskjs=require(_0xd049('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd049('0x10'));var Papa=require('papaparse');var Redis=require(_0xd049('0x11'));var authService=require(_0xd049('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd049('0x13'));var hardwareService=require(_0xd049('0x14'));var logger=require(_0xd049('0x15'))(_0xd049('0x16'));var utils=require(_0xd049('0x17'));var config=require(_0xd049('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd049('0x19'))['db'];function respondWithStatusCode(_0x52cbf3,_0x45f200){_0x45f200=_0x45f200||0xcc;return function(_0x185569){if(_0x185569){return _0x52cbf3['sendStatus'](_0x45f200);}return _0x52cbf3[_0xd049('0x1a')](_0x45f200)['end']();};}function respondWithResult(_0x4f6bbe,_0x50b0dd){_0x50b0dd=_0x50b0dd||0xc8;return function(_0x41d654){if(_0x41d654){return _0x4f6bbe['status'](_0x50b0dd)[_0xd049('0x1b')](_0x41d654);}};}function respondWithFilteredResult(_0x43e26f,_0x4de12b){return function(_0x595156){if(_0x595156){var _0x210745=typeof _0x4de12b[_0xd049('0x1c')]==='undefined'&&typeof _0x4de12b[_0xd049('0x1d')]===_0xd049('0x1e');var _0x27b9aa=_0x595156['count'];var _0x305fbb=_0x210745?0x0:_0x4de12b[_0xd049('0x1c')];var _0x28ce69=_0x210745?_0x595156['count']:_0x4de12b[_0xd049('0x1c')]+_0x4de12b['limit'];var _0x588924;if(_0x28ce69>=_0x27b9aa){_0x28ce69=_0x27b9aa;_0x588924=0xc8;}else{_0x588924=0xce;}_0x43e26f['status'](_0x588924);return _0x43e26f['set'](_0xd049('0x1f'),_0x305fbb+'-'+_0x28ce69+'/'+_0x27b9aa)[_0xd049('0x1b')](_0x595156);}return null;};}function patchUpdates(_0x3f0ea1){return function(_0x2773e1){try{jsonpatch[_0xd049('0x20')](_0x2773e1,_0x3f0ea1,!![]);}catch(_0x264437){return BPromise[_0xd049('0x21')](_0x264437);}return _0x2773e1[_0xd049('0x22')]();};}function saveUpdates(_0x221fbe,_0x24bfc0){return function(_0xa452b3){if(_0xa452b3){return _0xa452b3[_0xd049('0x23')](_0x221fbe)[_0xd049('0x24')](function(_0x3992dc){return _0x3992dc;});}return null;};}function removeEntity(_0x1b484f,_0x261a52){return function(_0x140b91){if(_0x140b91){return _0x140b91[_0xd049('0x25')]()[_0xd049('0x24')](function(){var _0x1586ab=_0x140b91[_0xd049('0x26')]({'plain':!![]});var _0x519db0=_0xd049('0x27');return db[_0xd049('0x28')][_0xd049('0x25')]({'where':{'type':_0x519db0,'resourceId':_0x1586ab['id']}})['then'](function(){return _0x140b91;});})[_0xd049('0x24')](function(){_0x1b484f[_0xd049('0x1a')](0xcc)[_0xd049('0x29')]();});}};}function handleEntityNotFound(_0x4ed973,_0x73e3b6){return function(_0x24cddc){if(!_0x24cddc){_0x4ed973[_0xd049('0x2a')](0x194);}return _0x24cddc;};}function handleError(_0x346bce,_0x48dd96){_0x48dd96=_0x48dd96||0x1f4;return function(_0xe2a912){logger[_0xd049('0x2b')](_0xe2a912[_0xd049('0x2c')]);if(_0xe2a912[_0xd049('0x2d')]){delete _0xe2a912[_0xd049('0x2d')];}_0x346bce[_0xd049('0x1a')](_0x48dd96)[_0xd049('0x2e')](_0xe2a912);};}exports[_0xd049('0x2f')]=function(_0x24c5a7,_0x1b00ae){var _0x2d1690={},_0x4ef190={},_0x20e964={'count':0x0,'rows':[]};var _0x2259b7=_['map'](db[_0xd049('0x30')][_0xd049('0x31')],function(_0x3b170c){return{'name':_0x3b170c[_0xd049('0x32')],'type':_0x3b170c[_0xd049('0x33')][_0xd049('0x34')]};});_0x4ef190[_0xd049('0x35')]=_['map'](_0x2259b7,_0xd049('0x2d'));_0x4ef190['query']=_[_0xd049('0x36')](_0x24c5a7['query']);_0x4ef190[_0xd049('0x37')]=_[_0xd049('0x38')](_0x4ef190[_0xd049('0x35')],_0x4ef190['query']);_0x2d1690[_0xd049('0x39')]=_[_0xd049('0x38')](_0x4ef190[_0xd049('0x35')],qs['fields'](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x3b')]));_0x2d1690[_0xd049('0x39')]=_0x2d1690[_0xd049('0x39')][_0xd049('0x3c')]?_0x2d1690['attributes']:_0x4ef190[_0xd049('0x35')];if(!_0x24c5a7['query']['hasOwnProperty'](_0xd049('0x3d'))){_0x2d1690[_0xd049('0x1d')]=qs[_0xd049('0x1d')](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x1d')]);_0x2d1690['offset']=qs[_0xd049('0x1c')](_0x24c5a7[_0xd049('0x3a')][_0xd049('0x1c')]);}_0x2d1690[_0xd049('0x3e')]=qs[_0xd049('0x3f')](_0x24c5a7[_0xd049('0x3a')]['sort']);_0x2d1690['where']=qs['filters'](_[_0xd049('0x40')](_0x24c5a7[_0xd049('0x3a')],_0x4ef190[_0xd049('0x37')]),_0x2259b7);if(_0x24c5a7[_0xd049('0x3a')]['filter']){_0x2d1690[_0xd049('0x41')]=_[_0xd049('0x42')](_0x2d1690[_0xd049('0x41')],{'$or':_[_0xd049('0x43')](_0x2259b7,function(_0x335c01){if(_0x335c01[_0xd049('0x33')]!=='VIRTUAL'){var _0x41bdcf={};_0x41bdcf[_0x335c01[_0xd049('0x2d')]]={'$like':'%'+_0x24c5a7[_0xd049('0x3a')]['filter']+'%'};return _0x41bdcf;}})});}_0x2d1690=_[_0xd049('0x42')]({},_0x2d1690,_0x24c5a7[_0xd049('0x44')]);var _0x26fa3c={'where':_0x2d1690[_0xd049('0x41')]};return db[_0xd049('0x30')][_0xd049('0x45')](_0x26fa3c)[_0xd049('0x24')](function(_0x45864a){_0x20e964[_0xd049('0x45')]=_0x45864a;if(_0x24c5a7['query'][_0xd049('0x46')]){_0x2d1690['include']=[{'all':!![]}];}return db['Template'][_0xd049('0x47')](_0x2d1690);})[_0xd049('0x24')](function(_0x4a1723){_0x20e964[_0xd049('0x48')]=_0x4a1723;return _0x20e964;})['then'](respondWithFilteredResult(_0x1b00ae,_0x2d1690))[_0xd049('0x49')](handleError(_0x1b00ae,null));};exports['show']=function(_0x4fdc20,_0x371c7d){var _0x311a0c={'raw':!![],'where':{'id':_0x4fdc20[_0xd049('0x4a')]['id']}},_0x2bc912={};_0x2bc912[_0xd049('0x35')]=_['keys'](db[_0xd049('0x30')]['rawAttributes']);_0x2bc912[_0xd049('0x3a')]=_['keys'](_0x4fdc20[_0xd049('0x3a')]);_0x2bc912[_0xd049('0x37')]=_[_0xd049('0x38')](_0x2bc912[_0xd049('0x35')],_0x2bc912[_0xd049('0x3a')]);_0x311a0c[_0xd049('0x39')]=_[_0xd049('0x38')](_0x2bc912['model'],qs[_0xd049('0x3b')](_0x4fdc20[_0xd049('0x3a')][_0xd049('0x3b')]));_0x311a0c[_0xd049('0x39')]=_0x311a0c[_0xd049('0x39')]['length']?_0x311a0c[_0xd049('0x39')]:_0x2bc912[_0xd049('0x35')];if(_0x4fdc20['query'][_0xd049('0x46')]){_0x311a0c[_0xd049('0x4b')]=[{'all':!![]}];}_0x311a0c=_[_0xd049('0x42')]({},_0x311a0c,_0x4fdc20[_0xd049('0x44')]);return db['Template'][_0xd049('0x4c')](_0x311a0c)[_0xd049('0x24')](handleEntityNotFound(_0x371c7d,null))[_0xd049('0x24')](respondWithResult(_0x371c7d,null))[_0xd049('0x49')](handleError(_0x371c7d,null));};exports[_0xd049('0x4d')]=function(_0x2f6a88,_0x4c6404){return db[_0xd049('0x30')][_0xd049('0x4d')](_0x2f6a88[_0xd049('0x4e')],{})[_0xd049('0x24')](function(_0x7ed624){var _0x249b5a=_0x2f6a88[_0xd049('0x4f')]['get']({'plain':!![]});if(!_0x249b5a)throw new Error(_0xd049('0x50'));if(_0x249b5a['role']===_0xd049('0x4f')){var _0x30be70=_0x7ed624['get']({'plain':!![]});var _0x44280c=_0xd049('0x27');return db['UserProfileSection'][_0xd049('0x4c')]({'where':{'name':_0x44280c,'userProfileId':_0x249b5a[_0xd049('0x51')]},'raw':!![]})['then'](function(_0xfd5510){if(_0xfd5510&&_0xfd5510[_0xd049('0x52')]===0x0){return db[_0xd049('0x28')]['create']({'name':_0x30be70[_0xd049('0x2d')],'resourceId':_0x30be70['id'],'type':_0xfd5510[_0xd049('0x2d')],'sectionId':_0xfd5510['id']},{})[_0xd049('0x24')](function(){return _0x7ed624;});}else{return _0x7ed624;}})[_0xd049('0x49')](function(_0x2ceabd){logger[_0xd049('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ceabd);throw _0x2ceabd;});}return _0x7ed624;})[_0xd049('0x24')](respondWithResult(_0x4c6404,0xc9))[_0xd049('0x49')](handleError(_0x4c6404,null));};exports[_0xd049('0x23')]=function(_0x5309f3,_0x5500a6){if(_0x5309f3[_0xd049('0x4e')]['id']){delete _0x5309f3[_0xd049('0x4e')]['id'];}return db[_0xd049('0x30')][_0xd049('0x4c')]({'where':{'id':_0x5309f3[_0xd049('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5500a6,null))['then'](saveUpdates(_0x5309f3[_0xd049('0x4e')],null))['then'](respondWithResult(_0x5500a6,null))[_0xd049('0x49')](handleError(_0x5500a6,null));};exports[_0xd049('0x25')]=function(_0x55b797,_0x405cd4){return db[_0xd049('0x30')][_0xd049('0x4c')]({'where':{'id':_0x55b797[_0xd049('0x4a')]['id']}})[_0xd049('0x24')](handleEntityNotFound(_0x405cd4,null))[_0xd049('0x24')](removeEntity(_0x405cd4,null))[_0xd049('0x49')](handleError(_0x405cd4,null));}; \ No newline at end of file +var _0xe56e=['limit','count','set','Content-Range','save','update','then','get','Templates','UserProfileResource','destroy','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x48e4a8,_0x33a1d1){var _0x59e7d2=function(_0x5b670b){while(--_0x5b670b){_0x48e4a8['push'](_0x48e4a8['shift']());}};_0x59e7d2(++_0x33a1d1);}(_0xe56e,0x11f));var _0xee56=function(_0x1e3c2a,_0x33acf3){_0x1e3c2a=_0x1e3c2a-0x0;var _0x10fa0c=_0xe56e[_0x1e3c2a];return _0x10fa0c;};'use strict';var emlformat=require(_0xee56('0x0'));var rimraf=require(_0xee56('0x1'));var zipdir=require(_0xee56('0x2'));var jsonpatch=require(_0xee56('0x3'));var rp=require(_0xee56('0x4'));var moment=require(_0xee56('0x5'));var BPromise=require(_0xee56('0x6'));var Mustache=require('mustache');var util=require(_0xee56('0x7'));var path=require(_0xee56('0x8'));var sox=require(_0xee56('0x9'));var csv=require(_0xee56('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee56('0xb'));var _=require(_0xee56('0xc'));var squel=require(_0xee56('0xd'));var crypto=require(_0xee56('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xee56('0xf'));var toCsv=require(_0xee56('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee56('0x10'));var qs=require(_0xee56('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee56('0x12'));var logger=require(_0xee56('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xee56('0x14'));var licenseUtil=require(_0xee56('0x15'));var db=require(_0xee56('0x16'))['db'];function respondWithStatusCode(_0x276626,_0x45f750){_0x45f750=_0x45f750||0xcc;return function(_0x360af0){if(_0x360af0){return _0x276626[_0xee56('0x17')](_0x45f750);}return _0x276626[_0xee56('0x18')](_0x45f750)[_0xee56('0x19')]();};}function respondWithResult(_0x33d485,_0xbab4f6){_0xbab4f6=_0xbab4f6||0xc8;return function(_0x28fd3a){if(_0x28fd3a){return _0x33d485[_0xee56('0x18')](_0xbab4f6)[_0xee56('0x1a')](_0x28fd3a);}};}function respondWithFilteredResult(_0x315290,_0x577b37){return function(_0x1bf88b){if(_0x1bf88b){var _0x55b535=typeof _0x577b37[_0xee56('0x1b')]===_0xee56('0x1c')&&typeof _0x577b37[_0xee56('0x1d')]==='undefined';var _0x4770ce=_0x1bf88b[_0xee56('0x1e')];var _0x5f2837=_0x55b535?0x0:_0x577b37[_0xee56('0x1b')];var _0x584d22=_0x55b535?_0x1bf88b[_0xee56('0x1e')]:_0x577b37['offset']+_0x577b37[_0xee56('0x1d')];var _0x225228;if(_0x584d22>=_0x4770ce){_0x584d22=_0x4770ce;_0x225228=0xc8;}else{_0x225228=0xce;}_0x315290[_0xee56('0x18')](_0x225228);return _0x315290[_0xee56('0x1f')](_0xee56('0x20'),_0x5f2837+'-'+_0x584d22+'/'+_0x4770ce)[_0xee56('0x1a')](_0x1bf88b);}return null;};}function patchUpdates(_0x29f2b8){return function(_0xa761e1){try{jsonpatch['apply'](_0xa761e1,_0x29f2b8,!![]);}catch(_0x4edc10){return BPromise['reject'](_0x4edc10);}return _0xa761e1[_0xee56('0x21')]();};}function saveUpdates(_0xde3f91,_0x562d9f){return function(_0x55687b){if(_0x55687b){return _0x55687b[_0xee56('0x22')](_0xde3f91)['then'](function(_0x5005e1){return _0x5005e1;});}return null;};}function removeEntity(_0x33ea37,_0x2bb843){return function(_0x9666d2){if(_0x9666d2){return _0x9666d2['destroy']()[_0xee56('0x23')](function(){var _0x27f8e7=_0x9666d2[_0xee56('0x24')]({'plain':!![]});var _0xb53ebb=_0xee56('0x25');return db[_0xee56('0x26')][_0xee56('0x27')]({'where':{'type':_0xb53ebb,'resourceId':_0x27f8e7['id']}})[_0xee56('0x23')](function(){return _0x9666d2;});})['then'](function(){_0x33ea37[_0xee56('0x18')](0xcc)[_0xee56('0x19')]();});}};}function handleEntityNotFound(_0x2868ea,_0x3f4ada){return function(_0x49d090){if(!_0x49d090){_0x2868ea[_0xee56('0x17')](0x194);}return _0x49d090;};}function handleError(_0x382ab7,_0x3f716e){_0x3f716e=_0x3f716e||0x1f4;return function(_0x44880a){logger['error'](_0x44880a[_0xee56('0x28')]);if(_0x44880a[_0xee56('0x29')]){delete _0x44880a[_0xee56('0x29')];}_0x382ab7[_0xee56('0x18')](_0x3f716e)[_0xee56('0x2a')](_0x44880a);};}exports[_0xee56('0x2b')]=function(_0x38cca1,_0x105e32){var _0x1dae58={},_0x179ed7={},_0x16605f={'count':0x0,'rows':[]};var _0x570031=_[_0xee56('0x2c')](db[_0xee56('0x2d')][_0xee56('0x2e')],function(_0x33d5f2){return{'name':_0x33d5f2[_0xee56('0x2f')],'type':_0x33d5f2[_0xee56('0x30')][_0xee56('0x31')]};});_0x179ed7['model']=_[_0xee56('0x2c')](_0x570031,_0xee56('0x29'));_0x179ed7[_0xee56('0x32')]=_[_0xee56('0x33')](_0x38cca1['query']);_0x179ed7[_0xee56('0x34')]=_[_0xee56('0x35')](_0x179ed7[_0xee56('0x36')],_0x179ed7[_0xee56('0x32')]);_0x1dae58['attributes']=_[_0xee56('0x35')](_0x179ed7[_0xee56('0x36')],qs[_0xee56('0x37')](_0x38cca1[_0xee56('0x32')][_0xee56('0x37')]));_0x1dae58[_0xee56('0x38')]=_0x1dae58['attributes'][_0xee56('0x39')]?_0x1dae58[_0xee56('0x38')]:_0x179ed7['model'];if(!_0x38cca1[_0xee56('0x32')][_0xee56('0x3a')](_0xee56('0x3b'))){_0x1dae58['limit']=qs[_0xee56('0x1d')](_0x38cca1['query'][_0xee56('0x1d')]);_0x1dae58[_0xee56('0x1b')]=qs[_0xee56('0x1b')](_0x38cca1[_0xee56('0x32')][_0xee56('0x1b')]);}_0x1dae58[_0xee56('0x3c')]=qs['sort'](_0x38cca1[_0xee56('0x32')][_0xee56('0x3d')]);_0x1dae58[_0xee56('0x3e')]=qs[_0xee56('0x34')](_[_0xee56('0x3f')](_0x38cca1[_0xee56('0x32')],_0x179ed7[_0xee56('0x34')]),_0x570031);if(_0x38cca1[_0xee56('0x32')][_0xee56('0x40')]){_0x1dae58[_0xee56('0x3e')]=_[_0xee56('0x41')](_0x1dae58[_0xee56('0x3e')],{'$or':_[_0xee56('0x2c')](_0x570031,function(_0x99ff5b){if(_0x99ff5b['type']!==_0xee56('0x42')){var _0x4add76={};_0x4add76[_0x99ff5b[_0xee56('0x29')]]={'$like':'%'+_0x38cca1[_0xee56('0x32')][_0xee56('0x40')]+'%'};return _0x4add76;}})});}_0x1dae58=_[_0xee56('0x41')]({},_0x1dae58,_0x38cca1[_0xee56('0x43')]);var _0x4bd20c={'where':_0x1dae58[_0xee56('0x3e')]};return db[_0xee56('0x2d')][_0xee56('0x1e')](_0x4bd20c)[_0xee56('0x23')](function(_0x4326db){_0x16605f[_0xee56('0x1e')]=_0x4326db;if(_0x38cca1[_0xee56('0x32')]['includeAll']){_0x1dae58['include']=[{'all':!![]}];}return db['Template']['findAll'](_0x1dae58);})[_0xee56('0x23')](function(_0xfcc904){_0x16605f[_0xee56('0x44')]=_0xfcc904;return _0x16605f;})[_0xee56('0x23')](respondWithFilteredResult(_0x105e32,_0x1dae58))['catch'](handleError(_0x105e32,null));};exports[_0xee56('0x45')]=function(_0x560d9a,_0x2bc654){var _0x12760c={'raw':!![],'where':{'id':_0x560d9a['params']['id']}},_0x89f963={};_0x89f963[_0xee56('0x36')]=_[_0xee56('0x33')](db[_0xee56('0x2d')][_0xee56('0x2e')]);_0x89f963['query']=_[_0xee56('0x33')](_0x560d9a[_0xee56('0x32')]);_0x89f963[_0xee56('0x34')]=_['intersection'](_0x89f963['model'],_0x89f963[_0xee56('0x32')]);_0x12760c[_0xee56('0x38')]=_[_0xee56('0x35')](_0x89f963[_0xee56('0x36')],qs['fields'](_0x560d9a['query'][_0xee56('0x37')]));_0x12760c[_0xee56('0x38')]=_0x12760c[_0xee56('0x38')][_0xee56('0x39')]?_0x12760c['attributes']:_0x89f963['model'];if(_0x560d9a[_0xee56('0x32')][_0xee56('0x46')]){_0x12760c['include']=[{'all':!![]}];}_0x12760c=_[_0xee56('0x41')]({},_0x12760c,_0x560d9a[_0xee56('0x43')]);return db[_0xee56('0x2d')][_0xee56('0x47')](_0x12760c)[_0xee56('0x23')](handleEntityNotFound(_0x2bc654,null))[_0xee56('0x23')](respondWithResult(_0x2bc654,null))[_0xee56('0x48')](handleError(_0x2bc654,null));};exports[_0xee56('0x49')]=function(_0x8d774c,_0x4b46ac){return db[_0xee56('0x2d')][_0xee56('0x49')](_0x8d774c[_0xee56('0x4a')],{})[_0xee56('0x23')](function(_0x2e55dc){var _0x430e05=_0x8d774c[_0xee56('0x4b')][_0xee56('0x24')]({'plain':!![]});if(!_0x430e05)throw new Error(_0xee56('0x4c'));if(_0x430e05[_0xee56('0x4d')]===_0xee56('0x4b')){var _0x1416c1=_0x2e55dc[_0xee56('0x24')]({'plain':!![]});var _0x38ddaa=_0xee56('0x25');return db['UserProfileSection'][_0xee56('0x47')]({'where':{'name':_0x38ddaa,'userProfileId':_0x430e05['userProfileId']},'raw':!![]})['then'](function(_0x2040a9){if(_0x2040a9&&_0x2040a9['autoAssociation']===0x0){return db[_0xee56('0x26')][_0xee56('0x49')]({'name':_0x1416c1[_0xee56('0x29')],'resourceId':_0x1416c1['id'],'type':_0x2040a9['name'],'sectionId':_0x2040a9['id']},{})[_0xee56('0x23')](function(){return _0x2e55dc;});}else{return _0x2e55dc;}})[_0xee56('0x48')](function(_0xeb88ac){logger[_0xee56('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeb88ac);throw _0xeb88ac;});}return _0x2e55dc;})[_0xee56('0x23')](respondWithResult(_0x4b46ac,0xc9))['catch'](handleError(_0x4b46ac,null));};exports[_0xee56('0x22')]=function(_0x594631,_0x2f134f){if(_0x594631['body']['id']){delete _0x594631[_0xee56('0x4a')]['id'];}return db['Template'][_0xee56('0x47')]({'where':{'id':_0x594631['params']['id']}})[_0xee56('0x23')](handleEntityNotFound(_0x2f134f,null))[_0xee56('0x23')](saveUpdates(_0x594631['body'],null))[_0xee56('0x23')](respondWithResult(_0x2f134f,null))['catch'](handleError(_0x2f134f,null));};exports['destroy']=function(_0x21f698,_0x8cbbb5){return db[_0xee56('0x2d')][_0xee56('0x47')]({'where':{'id':_0x21f698['params']['id']}})[_0xee56('0x23')](handleEntityNotFound(_0x8cbbb5,null))['then'](removeEntity(_0x8cbbb5,null))[_0xee56('0x48')](handleError(_0x8cbbb5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 38da56b..8c457cf 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 _0xcc47=['exports','define','Template','tools_templates','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2391cf,_0x2593e9){var _0x11f9e5=function(_0xed220d){while(--_0xed220d){_0x2391cf['push'](_0x2391cf['shift']());}};_0x11f9e5(++_0x2593e9);}(_0xcc47,0x64));var _0x7cc4=function(_0x5b5257,_0x446661){_0x5b5257=_0x5b5257-0x0;var _0x34e3fa=_0xcc47[_0x5b5257];return _0x34e3fa;};'use strict';var _=require(_0x7cc4('0x0'));var util=require(_0x7cc4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cc4('0x2'));var BPromise=require(_0x7cc4('0x3'));var rp=require(_0x7cc4('0x4'));var fs=require('fs');var path=require(_0x7cc4('0x5'));var rimraf=require(_0x7cc4('0x6'));var config=require(_0x7cc4('0x7'));var attributes=require('./template.attributes');module[_0x7cc4('0x8')]=function(_0x3461a4,_0x493e68){return _0x3461a4[_0x7cc4('0x9')](_0x7cc4('0xa'),attributes,{'tableName':_0x7cc4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79ad=['request-promise','rimraf','../../config/environment','./template.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x117e7e,_0x14f4a5){var _0x499c0d=function(_0x4b7b7c){while(--_0x4b7b7c){_0x117e7e['push'](_0x117e7e['shift']());}};_0x499c0d(++_0x14f4a5);}(_0x79ad,0x8a));var _0xd79a=function(_0x3be865,_0x261dcb){_0x3be865=_0x3be865-0x0;var _0x216dbe=_0x79ad[_0x3be865];return _0x216dbe;};'use strict';var _=require(_0xd79a('0x0'));var util=require(_0xd79a('0x1'));var logger=require(_0xd79a('0x2'))('api');var moment=require(_0xd79a('0x3'));var BPromise=require(_0xd79a('0x4'));var rp=require(_0xd79a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd79a('0x6'));var config=require(_0xd79a('0x7'));var attributes=require(_0xd79a('0x8'));module[_0xd79a('0x9')]=function(_0x3d0313,_0x15872f){return _0x3d0313[_0xd79a('0xa')]('Template',attributes,{'tableName':'tools_templates','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 43c09f9..7fa942a 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 _0x35c8=['Template','findAll','options','where','attributes','include','map','model','then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTemplate'];(function(_0x48d44a,_0x3f0003){var _0x4d4fe6=function(_0x33a7f5){while(--_0x33a7f5){_0x48d44a['push'](_0x48d44a['shift']());}};_0x4d4fe6(++_0x3f0003);}(_0x35c8,0xdc));var _0x835c=function(_0x2ed8f5,_0x233b9e){_0x2ed8f5=_0x2ed8f5-0x0;var _0x123bfe=_0x35c8[_0x2ed8f5];return _0x123bfe;};'use strict';var _=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var moment=require(_0x835c('0x2'));var BPromise=require(_0x835c('0x3'));var rs=require(_0x835c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x835c('0x5'))['db'];var utils=require(_0x835c('0x6'));var logger=require('../../config/logger')(_0x835c('0x7'));var config=require(_0x835c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x835c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44f63f,_0x1557c3,_0x4cdb33){return new BPromise(function(_0x4ab07b,_0x5873db){return client[_0x835c('0xa')](_0x44f63f,_0x4cdb33)['then'](function(_0x100f8b){logger[_0x835c('0xb')](_0x835c('0xc'),_0x1557c3,_0x835c('0xd'));logger[_0x835c('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x1557c3,_0x835c('0xd'),JSON[_0x835c('0xf')](_0x100f8b));if(_0x100f8b['error']){if(_0x100f8b[_0x835c('0x10')]['code']===0x1f4){logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x100f8b['error']['message']);return _0x5873db(_0x100f8b['error'][_0x835c('0x11')]);}logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x100f8b[_0x835c('0x10')][_0x835c('0x11')]);return _0x4ab07b(_0x100f8b[_0x835c('0x10')][_0x835c('0x11')]);}else{logger[_0x835c('0xb')]('Template,\x20%s,\x20%s',_0x1557c3,_0x835c('0xd'));_0x4ab07b(_0x100f8b[_0x835c('0x12')]['message']);}})['catch'](function(_0x356e77){logger[_0x835c('0x10')](_0x835c('0xc'),_0x1557c3,_0x356e77);_0x5873db(_0x356e77);});});}exports[_0x835c('0x13')]=function(_0xaa8951){var _0x4e3270=this;return new Promise(function(_0x3e718b,_0x6398e){return db[_0x835c('0x14')][_0x835c('0x15')]({'raw':_0xaa8951[_0x835c('0x16')]?_0xaa8951['options']['raw']===undefined?!![]:![]:!![],'where':_0xaa8951['options']?_0xaa8951['options'][_0x835c('0x17')]||null:null,'attributes':_0xaa8951[_0x835c('0x16')]?_0xaa8951[_0x835c('0x16')][_0x835c('0x18')]||null:null,'limit':_0xaa8951[_0x835c('0x16')]?_0xaa8951[_0x835c('0x16')]['limit']||null:null,'include':_0xaa8951['options']?_0xaa8951[_0x835c('0x16')][_0x835c('0x19')]?_[_0x835c('0x1a')](_0xaa8951['options'][_0x835c('0x19')],function(_0x5ba1de){return{'model':db[_0x5ba1de['model']],'as':_0x5ba1de['as'],'attributes':_0x5ba1de['attributes'],'include':_0x5ba1de[_0x835c('0x19')]?_[_0x835c('0x1a')](_0x5ba1de[_0x835c('0x19')],function(_0x6cf8b9){return{'model':db[_0x6cf8b9[_0x835c('0x1b')]],'as':_0x6cf8b9['as'],'attributes':_0x6cf8b9[_0x835c('0x18')],'include':_0x6cf8b9[_0x835c('0x19')]?_[_0x835c('0x1a')](_0x6cf8b9[_0x835c('0x19')],function(_0x2a6442){return{'model':db[_0x2a6442[_0x835c('0x1b')]],'as':_0x2a6442['as'],'attributes':_0x2a6442[_0x835c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x835c('0x1c')](function(_0x43d95b){logger[_0x835c('0xb')](_0x835c('0x13'),_0xaa8951);logger[_0x835c('0xe')](_0x835c('0x13'),_0xaa8951,JSON[_0x835c('0xf')](_0x43d95b));_0x3e718b(_0x43d95b);})[_0x835c('0x1d')](function(_0x4fedbd){logger[_0x835c('0x10')](_0x835c('0x13'),_0x4fedbd[_0x835c('0x11')],_0xaa8951);_0x6398e(_0x4e3270[_0x835c('0x10')](0x1f4,_0x4fedbd[_0x835c('0x11')]));});});}; \ No newline at end of file +var _0x5451=['message','info','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s'];(function(_0x11cd87,_0x52af13){var _0x2ef34e=function(_0x48b063){while(--_0x48b063){_0x11cd87['push'](_0x11cd87['shift']());}};_0x2ef34e(++_0x52af13);}(_0x5451,0x16f));var _0x1545=function(_0xcbf24d,_0x47715e){_0xcbf24d=_0xcbf24d-0x0;var _0x5419dc=_0x5451[_0xcbf24d];return _0x5419dc;};'use strict';var _=require('lodash');var util=require(_0x1545('0x0'));var moment=require(_0x1545('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1545('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1545('0x3'));var logger=require('../../config/logger')(_0x1545('0x4'));var config=require(_0x1545('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1545('0x6')][_0x1545('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6ebef7,_0x57d88f,_0x3ac32b){return new BPromise(function(_0x16bb08,_0x535158){return client[_0x1545('0x8')](_0x6ebef7,_0x3ac32b)[_0x1545('0x9')](function(_0x2e2b83){logger['info']('Template,\x20%s,\x20%s',_0x57d88f,_0x1545('0xa'));logger[_0x1545('0xb')](_0x1545('0xc'),_0x57d88f,_0x1545('0xa'),JSON[_0x1545('0xd')](_0x2e2b83));if(_0x2e2b83[_0x1545('0xe')]){if(_0x2e2b83[_0x1545('0xe')][_0x1545('0xf')]===0x1f4){logger[_0x1545('0xe')](_0x1545('0x10'),_0x57d88f,_0x2e2b83[_0x1545('0xe')][_0x1545('0x11')]);return _0x535158(_0x2e2b83[_0x1545('0xe')][_0x1545('0x11')]);}logger[_0x1545('0xe')](_0x1545('0x10'),_0x57d88f,_0x2e2b83[_0x1545('0xe')]['message']);return _0x16bb08(_0x2e2b83[_0x1545('0xe')][_0x1545('0x11')]);}else{logger[_0x1545('0x12')](_0x1545('0x10'),_0x57d88f,_0x1545('0xa'));_0x16bb08(_0x2e2b83[_0x1545('0x13')][_0x1545('0x11')]);}})[_0x1545('0x14')](function(_0x15b2c3){logger[_0x1545('0xe')](_0x1545('0x10'),_0x57d88f,_0x15b2c3);_0x535158(_0x15b2c3);});});}exports['GetTemplate']=function(_0x1ace5c){var _0x25cc31=this;return new Promise(function(_0x12ee29,_0x239802){return db[_0x1545('0x15')][_0x1545('0x16')]({'raw':_0x1ace5c[_0x1545('0x17')]?_0x1ace5c[_0x1545('0x17')][_0x1545('0x18')]===undefined?!![]:![]:!![],'where':_0x1ace5c[_0x1545('0x17')]?_0x1ace5c[_0x1545('0x17')][_0x1545('0x19')]||null:null,'attributes':_0x1ace5c['options']?_0x1ace5c[_0x1545('0x17')][_0x1545('0x1a')]||null:null,'limit':_0x1ace5c[_0x1545('0x17')]?_0x1ace5c[_0x1545('0x17')][_0x1545('0x1b')]||null:null,'include':_0x1ace5c[_0x1545('0x17')]?_0x1ace5c[_0x1545('0x17')][_0x1545('0x1c')]?_[_0x1545('0x1d')](_0x1ace5c[_0x1545('0x17')][_0x1545('0x1c')],function(_0x517d11){return{'model':db[_0x517d11[_0x1545('0x1e')]],'as':_0x517d11['as'],'attributes':_0x517d11['attributes'],'include':_0x517d11['include']?_[_0x1545('0x1d')](_0x517d11[_0x1545('0x1c')],function(_0x1701ce){return{'model':db[_0x1701ce[_0x1545('0x1e')]],'as':_0x1701ce['as'],'attributes':_0x1701ce[_0x1545('0x1a')],'include':_0x1701ce[_0x1545('0x1c')]?_[_0x1545('0x1d')](_0x1701ce[_0x1545('0x1c')],function(_0x133bb4){return{'model':db[_0x133bb4[_0x1545('0x1e')]],'as':_0x133bb4['as'],'attributes':_0x133bb4[_0x1545('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1545('0x9')](function(_0x1b916c){logger[_0x1545('0x12')](_0x1545('0x1f'),_0x1ace5c);logger[_0x1545('0xb')](_0x1545('0x1f'),_0x1ace5c,JSON[_0x1545('0xd')](_0x1b916c));_0x12ee29(_0x1b916c);})[_0x1545('0x14')](function(_0x53ea0a){logger[_0x1545('0xe')]('GetTemplate',_0x53ea0a['message'],_0x1ace5c);_0x239802(_0x25cc31[_0x1545('0xe')](0x1f4,_0x53ea0a[_0x1545('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8f75de7..c116f35 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 _0x8ae2=['getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','put','/:id','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ae2,0x143));var _0x28ae=function(_0x217b01,_0x487a10){_0x217b01=_0x217b01-0x0;var _0x3a570b=_0x8ae2[_0x217b01];return _0x3a570b;};'use strict';var multer=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var path=require('path');var timeout=require(_0x28ae('0x2'));var express=require('express');var router=express[_0x28ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28ae('0x4'));var interaction=require(_0x28ae('0x5'));var config=require(_0x28ae('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x28ae('0x7')](),controller[_0x28ae('0x8')]);router[_0x28ae('0x9')]('/:id',auth[_0x28ae('0x7')](),controller['show']);router[_0x28ae('0x9')](_0x28ae('0xa'),auth[_0x28ae('0x7')](),controller[_0x28ae('0xb')]);router[_0x28ae('0x9')](_0x28ae('0xc'),auth[_0x28ae('0x7')](),controller[_0x28ae('0xd')]);router['get'](_0x28ae('0xe'),auth[_0x28ae('0x7')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x28ae('0xf')]);router[_0x28ae('0x10')](_0x28ae('0xa'),auth['isAuthenticated'](),controller[_0x28ae('0x11')]);router[_0x28ae('0x10')]('/:id/any_conditions',auth[_0x28ae('0x7')](),controller[_0x28ae('0x12')]);router['post'](_0x28ae('0xe'),auth['isAuthenticated'](),controller[_0x28ae('0x13')]);router[_0x28ae('0x14')](_0x28ae('0x15'),auth[_0x28ae('0x7')](),controller['update']);router[_0x28ae('0x16')]('/:id',auth[_0x28ae('0x7')](),controller['destroy']);module[_0x28ae('0x17')]=router; \ No newline at end of file +var _0x7a23=['/:id','isAuthenticated','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get'];(function(_0x35afac,_0x321947){var _0x447b94=function(_0x196fc8){while(--_0x196fc8){_0x35afac['push'](_0x35afac['shift']());}};_0x447b94(++_0x321947);}(_0x7a23,0x170));var _0x37a2=function(_0x3a58e0,_0x1aab97){_0x3a58e0=_0x3a58e0-0x0;var _0x172ff2=_0x7a23[_0x3a58e0];return _0x172ff2;};'use strict';var multer=require(_0x37a2('0x0'));var util=require('util');var path=require(_0x37a2('0x1'));var timeout=require(_0x37a2('0x2'));var express=require(_0x37a2('0x3'));var router=express[_0x37a2('0x4')]();var fs_extra=require(_0x37a2('0x5'));var auth=require(_0x37a2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x37a2('0x7'));var controller=require(_0x37a2('0x8'));router[_0x37a2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37a2('0x9')](_0x37a2('0xa'),auth[_0x37a2('0xb')](),controller['show']);router['get'](_0x37a2('0xc'),auth['isAuthenticated'](),controller[_0x37a2('0xd')]);router[_0x37a2('0x9')]('/:id/any_conditions',auth[_0x37a2('0xb')](),controller[_0x37a2('0xe')]);router[_0x37a2('0x9')](_0x37a2('0xf'),auth['isAuthenticated'](),controller[_0x37a2('0x10')]);router[_0x37a2('0x11')]('/',auth['isAuthenticated'](),controller[_0x37a2('0x12')]);router['post'](_0x37a2('0xc'),auth[_0x37a2('0xb')](),controller[_0x37a2('0x13')]);router[_0x37a2('0x11')](_0x37a2('0x14'),auth[_0x37a2('0xb')](),controller[_0x37a2('0x15')]);router[_0x37a2('0x11')]('/:id/actions',auth[_0x37a2('0xb')](),controller[_0x37a2('0x16')]);router[_0x37a2('0x17')](_0x37a2('0xa'),auth[_0x37a2('0xb')](),controller['update']);router[_0x37a2('0x18')](_0x37a2('0xa'),auth[_0x37a2('0xb')](),controller[_0x37a2('0x19')]);module[_0x37a2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 862544a..6b2d0d2 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 _0x659c=['exports','STRING','BOOLEAN'];(function(_0x11821a,_0x16b4c7){var _0x180a11=function(_0x45690d){while(--_0x45690d){_0x11821a['push'](_0x11821a['shift']());}};_0x180a11(++_0x16b4c7);}(_0x659c,0x171));var _0xc659=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0x659c[_0x27973c];return _0x2ef123;};'use strict';var Sequelize=require('sequelize');module[_0xc659('0x0')]={'name':{'type':Sequelize[_0xc659('0x1')]},'channel':{'type':Sequelize[_0xc659('0x1')]},'description':{'type':Sequelize[_0xc659('0x1')]},'status':{'type':Sequelize[_0xc659('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xcd0c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcd0c,0xb9));var _0xccd0=function(_0x107132,_0x13f848){_0x107132=_0x107132-0x0;var _0xeb25b1=_0xcd0c[_0x107132];return _0xeb25b1;};'use strict';var Sequelize=require(_0xccd0('0x0'));module[_0xccd0('0x1')]={'name':{'type':Sequelize[_0xccd0('0x2')]},'channel':{'type':Sequelize[_0xccd0('0x2')]},'description':{'type':Sequelize[_0xccd0('0x2')]},'status':{'type':Sequelize[_0xccd0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d914973..504ecef 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 _0xe7be=['send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Triggers','end','error','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7be,0x1ae));var _0xee7b=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0xe7be[_0x5ec9db];return _0xfc7061;};'use strict';var emlformat=require(_0xee7b('0x0'));var rimraf=require(_0xee7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee7b('0x2'));var rp=require('request-promise');var moment=require(_0xee7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee7b('0x4'));var util=require('util');var path=require(_0xee7b('0x5'));var sox=require(_0xee7b('0x6'));var csv=require(_0xee7b('0x7'));var ejs=require(_0xee7b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee7b('0x9'));var crypto=require(_0xee7b('0xa'));var jsforce=require(_0xee7b('0xb'));var deskjs=require(_0xee7b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee7b('0xd'));var Redis=require('ioredis');var authService=require(_0xee7b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xee7b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7b('0x10'))(_0xee7b('0x11'));var utils=require(_0xee7b('0x12'));var config=require(_0xee7b('0x13'));var licenseUtil=require(_0xee7b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5676ec,_0x4c7048){_0x4c7048=_0x4c7048||0xcc;return function(_0x20a41c){if(_0x20a41c){return _0x5676ec[_0xee7b('0x15')](_0x4c7048);}return _0x5676ec[_0xee7b('0x16')](_0x4c7048)['end']();};}function respondWithResult(_0x5cc005,_0x70c9d6){_0x70c9d6=_0x70c9d6||0xc8;return function(_0x492131){if(_0x492131){return _0x5cc005[_0xee7b('0x16')](_0x70c9d6)['json'](_0x492131);}};}function respondWithFilteredResult(_0x2508db,_0x51a90e){return function(_0x57962e){if(_0x57962e){var _0x7e93cb=typeof _0x51a90e['offset']===_0xee7b('0x17')&&typeof _0x51a90e[_0xee7b('0x18')]===_0xee7b('0x17');var _0x1025cb=_0x57962e['count'];var _0x18c9c9=_0x7e93cb?0x0:_0x51a90e['offset'];var _0x37173f=_0x7e93cb?_0x57962e['count']:_0x51a90e[_0xee7b('0x19')]+_0x51a90e[_0xee7b('0x18')];var _0x22320e;if(_0x37173f>=_0x1025cb){_0x37173f=_0x1025cb;_0x22320e=0xc8;}else{_0x22320e=0xce;}_0x2508db[_0xee7b('0x16')](_0x22320e);return _0x2508db[_0xee7b('0x1a')](_0xee7b('0x1b'),_0x18c9c9+'-'+_0x37173f+'/'+_0x1025cb)[_0xee7b('0x1c')](_0x57962e);}return null;};}function patchUpdates(_0xea641b){return function(_0x54cfd8){try{jsonpatch[_0xee7b('0x1d')](_0x54cfd8,_0xea641b,!![]);}catch(_0x6f2df6){return BPromise['reject'](_0x6f2df6);}return _0x54cfd8[_0xee7b('0x1e')]();};}function saveUpdates(_0x120c57,_0x1c0b42){return function(_0x530b37){if(_0x530b37){return _0x530b37[_0xee7b('0x1f')](_0x120c57)[_0xee7b('0x20')](function(_0x2de2ea){return _0x2de2ea;});}return null;};}function removeEntity(_0x1b578c,_0xb2dff9){return function(_0x5ec0e7){if(_0x5ec0e7){return _0x5ec0e7[_0xee7b('0x21')]()[_0xee7b('0x20')](function(){var _0x37b83c=_0x5ec0e7[_0xee7b('0x22')]({'plain':!![]});var _0x2dce41=_0xee7b('0x23');return db['UserProfileResource'][_0xee7b('0x21')]({'where':{'type':_0x2dce41,'resourceId':_0x37b83c['id']}})['then'](function(){return _0x5ec0e7;});})[_0xee7b('0x20')](function(){_0x1b578c[_0xee7b('0x16')](0xcc)[_0xee7b('0x24')]();});}};}function handleEntityNotFound(_0x48f241,_0x33adb){return function(_0x5104fc){if(!_0x5104fc){_0x48f241[_0xee7b('0x15')](0x194);}return _0x5104fc;};}function handleError(_0x3add99,_0x21045c){_0x21045c=_0x21045c||0x1f4;return function(_0x30c6e0){logger[_0xee7b('0x25')](_0x30c6e0[_0xee7b('0x26')]);if(_0x30c6e0[_0xee7b('0x27')]){delete _0x30c6e0[_0xee7b('0x27')];}_0x3add99[_0xee7b('0x16')](_0x21045c)[_0xee7b('0x28')](_0x30c6e0);};}exports[_0xee7b('0x29')]=function(_0x4096f6,_0x4e12c2){var _0xc8f7be={},_0x455e1a={},_0x462fc7={'count':0x0,'rows':[]};var _0x5304b5=_['map'](db['Trigger']['rawAttributes'],function(_0x48fc11){return{'name':_0x48fc11[_0xee7b('0x2a')],'type':_0x48fc11[_0xee7b('0x2b')][_0xee7b('0x2c')]};});_0x455e1a[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](_0x5304b5,_0xee7b('0x27'));_0x455e1a[_0xee7b('0x2f')]=_[_0xee7b('0x30')](_0x4096f6[_0xee7b('0x2f')]);_0x455e1a[_0xee7b('0x31')]=_[_0xee7b('0x32')](_0x455e1a[_0xee7b('0x2d')],_0x455e1a[_0xee7b('0x2f')]);_0xc8f7be[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x455e1a['model'],qs[_0xee7b('0x34')](_0x4096f6[_0xee7b('0x2f')]['fields']));_0xc8f7be[_0xee7b('0x33')]=_0xc8f7be[_0xee7b('0x33')][_0xee7b('0x35')]?_0xc8f7be[_0xee7b('0x33')]:_0x455e1a[_0xee7b('0x2d')];if(!_0x4096f6['query'][_0xee7b('0x36')]('nolimit')){_0xc8f7be[_0xee7b('0x18')]=qs[_0xee7b('0x18')](_0x4096f6['query'][_0xee7b('0x18')]);_0xc8f7be[_0xee7b('0x19')]=qs['offset'](_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x19')]);}_0xc8f7be[_0xee7b('0x37')]=qs[_0xee7b('0x38')](_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x38')]);_0xc8f7be[_0xee7b('0x39')]=qs[_0xee7b('0x31')](_[_0xee7b('0x3a')](_0x4096f6[_0xee7b('0x2f')],_0x455e1a[_0xee7b('0x31')]),_0x5304b5);if(_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0xc8f7be['where']=_[_0xee7b('0x3c')](_0xc8f7be['where'],{'$or':_[_0xee7b('0x2e')](_0x5304b5,function(_0x4b7d27){if(_0x4b7d27[_0xee7b('0x2b')]!==_0xee7b('0x3d')){var _0x304d03={};_0x304d03[_0x4b7d27[_0xee7b('0x27')]]={'$like':'%'+_0x4096f6[_0xee7b('0x2f')][_0xee7b('0x3b')]+'%'};return _0x304d03;}})});}_0xc8f7be=_[_0xee7b('0x3c')]({},_0xc8f7be,_0x4096f6[_0xee7b('0x3e')]);var _0x48be9f={'where':_0xc8f7be[_0xee7b('0x39')]};return db[_0xee7b('0x3f')][_0xee7b('0x40')](_0x48be9f)[_0xee7b('0x20')](function(_0xa30ef2){_0x462fc7[_0xee7b('0x40')]=_0xa30ef2;if(_0x4096f6['query'][_0xee7b('0x41')]){_0xc8f7be[_0xee7b('0x42')]=[{'all':!![]}];}return db[_0xee7b('0x3f')][_0xee7b('0x43')](_0xc8f7be);})[_0xee7b('0x20')](function(_0x56ea61){_0x462fc7[_0xee7b('0x44')]=_0x56ea61;return _0x462fc7;})[_0xee7b('0x20')](respondWithFilteredResult(_0x4e12c2,_0xc8f7be))[_0xee7b('0x45')](handleError(_0x4e12c2,null));};exports[_0xee7b('0x46')]=function(_0x1cfb2c,_0x28fe65){var _0x5d66f1={'raw':![],'where':{'id':_0x1cfb2c[_0xee7b('0x47')]['id']}},_0x19933a={};_0x19933a['model']=_[_0xee7b('0x30')](db[_0xee7b('0x3f')][_0xee7b('0x48')]);_0x19933a[_0xee7b('0x2f')]=_['keys'](_0x1cfb2c['query']);_0x19933a['filters']=_['intersection'](_0x19933a['model'],_0x19933a[_0xee7b('0x2f')]);_0x5d66f1[_0xee7b('0x33')]=_['intersection'](_0x19933a[_0xee7b('0x2d')],qs[_0xee7b('0x34')](_0x1cfb2c[_0xee7b('0x2f')][_0xee7b('0x34')]));_0x5d66f1[_0xee7b('0x33')]=_0x5d66f1[_0xee7b('0x33')][_0xee7b('0x35')]?_0x5d66f1[_0xee7b('0x33')]:_0x19933a[_0xee7b('0x2d')];if(_0x1cfb2c[_0xee7b('0x2f')]['includeAll']){_0x5d66f1[_0xee7b('0x42')]=[{'all':!![]}];}_0x5d66f1=_[_0xee7b('0x3c')]({},_0x5d66f1,_0x1cfb2c['options']);return db[_0xee7b('0x3f')]['find'](_0x5d66f1)['then'](handleEntityNotFound(_0x28fe65,null))['then'](respondWithResult(_0x28fe65,null))[_0xee7b('0x45')](handleError(_0x28fe65,null));};exports[_0xee7b('0x49')]=function(_0x6956a,_0x4159ae){return db[_0xee7b('0x3f')][_0xee7b('0x49')](_0x6956a[_0xee7b('0x4a')],{})['then'](function(_0x184ba4){var _0x3c6287=_0x6956a[_0xee7b('0x4b')][_0xee7b('0x22')]({'plain':!![]});if(!_0x3c6287)throw new Error(_0xee7b('0x4c'));if(_0x3c6287[_0xee7b('0x4d')]===_0xee7b('0x4b')){var _0x174032=_0x184ba4[_0xee7b('0x22')]({'plain':!![]});var _0x4a6358=_0xee7b('0x23');return db[_0xee7b('0x4e')]['find']({'where':{'name':_0x4a6358,'userProfileId':_0x3c6287[_0xee7b('0x4f')]},'raw':!![]})['then'](function(_0x12a225){if(_0x12a225&&_0x12a225[_0xee7b('0x50')]===0x0){return db['UserProfileResource'][_0xee7b('0x49')]({'name':_0x174032[_0xee7b('0x27')],'resourceId':_0x174032['id'],'type':_0x12a225[_0xee7b('0x27')],'sectionId':_0x12a225['id']},{})[_0xee7b('0x20')](function(){return _0x184ba4;});}else{return _0x184ba4;}})[_0xee7b('0x45')](function(_0x474d4b){logger[_0xee7b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474d4b);throw _0x474d4b;});}return _0x184ba4;})[_0xee7b('0x20')](respondWithResult(_0x4159ae,0xc9))[_0xee7b('0x45')](handleError(_0x4159ae,null));};exports['update']=function(_0x3e1543,_0x18abb8){if(_0x3e1543[_0xee7b('0x4a')]['id']){delete _0x3e1543['body']['id'];}return db['Trigger'][_0xee7b('0x51')]({'where':{'id':_0x3e1543[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x18abb8,null))['then'](saveUpdates(_0x3e1543[_0xee7b('0x4a')],null))[_0xee7b('0x20')](respondWithResult(_0x18abb8,null))[_0xee7b('0x45')](handleError(_0x18abb8,null));};exports[_0xee7b('0x21')]=function(_0x23511c,_0xc78ca0){return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x23511c[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0xc78ca0,null))[_0xee7b('0x20')](removeEntity(_0xc78ca0,null))[_0xee7b('0x45')](handleError(_0xc78ca0,null));};exports[_0xee7b('0x52')]=function(_0x225f02,_0x4bd59d,_0x206598){if(_0x225f02[_0xee7b('0x4a')]['id']){delete _0x225f02[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x225f02[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bd59d,null))['then'](function(_0x107f29){if(_0x107f29){_0x225f02['body'][_0xee7b('0x53')]=_0x107f29['id'];return db[_0xee7b('0x54')][_0xee7b('0x49')](_0x225f02[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x4bd59d,null))[_0xee7b('0x45')](handleError(_0x4bd59d,null));};exports[_0xee7b('0x55')]=function(_0x5a428d,_0x27d2f8,_0x52236c){if(_0x5a428d['body']['id']){delete _0x5a428d[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x5a428d['params']['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x27d2f8,null))[_0xee7b('0x20')](function(_0x185f8f){if(_0x185f8f){_0x5a428d['body'][_0xee7b('0x56')]=_0x185f8f['id'];return db[_0xee7b('0x54')][_0xee7b('0x49')](_0x5a428d[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x27d2f8,null))[_0xee7b('0x45')](handleError(_0x27d2f8,null));};exports[_0xee7b('0x57')]=function(_0x2c4a17,_0x262398,_0x409728){var _0x2ab65e={};var _0x1cb825={};var _0x19e255;var _0x432d4c;return db[_0xee7b('0x3f')]['findOne']({'where':{'id':_0x2c4a17['params']['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x262398,null))['then'](function(_0x4244fe){if(_0x4244fe){_0x19e255=_0x4244fe;_0x1cb825[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db['Condition'][_0xee7b('0x48')]);_0x1cb825[_0xee7b('0x2f')]=_['keys'](_0x2c4a17['query']);_0x1cb825['filters']=_[_0xee7b('0x32')](_0x1cb825[_0xee7b('0x2d')],_0x1cb825['query']);_0x2ab65e[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x1cb825[_0xee7b('0x2d')],qs['fields'](_0x2c4a17['query'][_0xee7b('0x34')]));_0x2ab65e[_0xee7b('0x33')]=_0x2ab65e['attributes'][_0xee7b('0x35')]?_0x2ab65e['attributes']:_0x1cb825[_0xee7b('0x2d')];_0x2ab65e[_0xee7b('0x37')]=qs[_0xee7b('0x38')](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x38')]);_0x2ab65e[_0xee7b('0x39')]=qs[_0xee7b('0x31')](_[_0xee7b('0x3a')](_0x2c4a17['query'],_0x1cb825[_0xee7b('0x31')]));if(_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0x2ab65e[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x2ab65e[_0xee7b('0x39')],{'$or':_[_0xee7b('0x2e')](_0x2ab65e['attributes'],function(_0x512442){var _0x149b80={};_0x149b80[_0x512442]={'$like':'%'+_0x2c4a17['query'][_0xee7b('0x3b')]+'%'};return _0x149b80;})});}_0x2ab65e=_[_0xee7b('0x3c')]({},_0x2ab65e,_0x2c4a17[_0xee7b('0x3e')]);return _0x19e255[_0xee7b('0x57')](_0x2ab65e);}})[_0xee7b('0x20')](function(_0x2c2d74){if(_0x2c2d74){_0x432d4c=_0x2c2d74[_0xee7b('0x35')];if(!_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x36')]('nolimit')){_0x2ab65e[_0xee7b('0x18')]=qs['limit'](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x18')]);_0x2ab65e[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x2c4a17[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x19e255[_0xee7b('0x57')](_0x2ab65e);}})[_0xee7b('0x20')](function(_0x1e7a2d){if(_0x1e7a2d){return _0x1e7a2d?{'count':_0x432d4c,'rows':_0x1e7a2d}:null;}})[_0xee7b('0x20')](respondWithResult(_0x262398,null))[_0xee7b('0x45')](handleError(_0x262398,null));};exports['getAnyConditions']=function(_0x1e9390,_0x4db9b3,_0x468ae6){var _0x144193={};var _0x3bcb39={};var _0x2f75ed;var _0x38a835;return db['Trigger'][_0xee7b('0x58')]({'where':{'id':_0x1e9390[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4db9b3,null))[_0xee7b('0x20')](function(_0x26b156){if(_0x26b156){_0x2f75ed=_0x26b156;_0x3bcb39[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db[_0xee7b('0x54')][_0xee7b('0x48')]);_0x3bcb39['query']=_[_0xee7b('0x30')](_0x1e9390[_0xee7b('0x2f')]);_0x3bcb39['filters']=_['intersection'](_0x3bcb39['model'],_0x3bcb39[_0xee7b('0x2f')]);_0x144193[_0xee7b('0x33')]=_[_0xee7b('0x32')](_0x3bcb39[_0xee7b('0x2d')],qs['fields'](_0x1e9390['query']['fields']));_0x144193[_0xee7b('0x33')]=_0x144193[_0xee7b('0x33')][_0xee7b('0x35')]?_0x144193[_0xee7b('0x33')]:_0x3bcb39[_0xee7b('0x2d')];_0x144193[_0xee7b('0x37')]=qs['sort'](_0x1e9390['query'][_0xee7b('0x38')]);_0x144193[_0xee7b('0x39')]=qs['filters'](_[_0xee7b('0x3a')](_0x1e9390[_0xee7b('0x2f')],_0x3bcb39[_0xee7b('0x31')]));if(_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x3b')]){_0x144193[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x144193['where'],{'$or':_[_0xee7b('0x2e')](_0x144193[_0xee7b('0x33')],function(_0x35f97a){var _0x1fd164={};_0x1fd164[_0x35f97a]={'$like':'%'+_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x3b')]+'%'};return _0x1fd164;})});}_0x144193=_[_0xee7b('0x3c')]({},_0x144193,_0x1e9390[_0xee7b('0x3e')]);return _0x2f75ed['getAnyConditions'](_0x144193);}})[_0xee7b('0x20')](function(_0x5055c6){if(_0x5055c6){_0x38a835=_0x5055c6[_0xee7b('0x35')];if(!_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x36')](_0xee7b('0x59'))){_0x144193['limit']=qs['limit'](_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x18')]);_0x144193[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x1e9390[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x2f75ed['getAnyConditions'](_0x144193);}})[_0xee7b('0x20')](function(_0x23343e){if(_0x23343e){return _0x23343e?{'count':_0x38a835,'rows':_0x23343e}:null;}})[_0xee7b('0x20')](respondWithResult(_0x4db9b3,null))[_0xee7b('0x45')](handleError(_0x4db9b3,null));};exports[_0xee7b('0x5a')]=function(_0x2412a9,_0x4ec3b1,_0x2703bd){if(_0x2412a9[_0xee7b('0x4a')]['id']){delete _0x2412a9[_0xee7b('0x4a')]['id'];}return db[_0xee7b('0x3f')][_0xee7b('0x51')]({'where':{'id':_0x2412a9[_0xee7b('0x47')]['id']}})[_0xee7b('0x20')](handleEntityNotFound(_0x4ec3b1,null))[_0xee7b('0x20')](function(_0x49f8e1){if(_0x49f8e1){_0x2412a9[_0xee7b('0x4a')][_0xee7b('0x5b')]=_0x49f8e1['id'];return db[_0xee7b('0x5c')][_0xee7b('0x49')](_0x2412a9[_0xee7b('0x4a')]);}})[_0xee7b('0x20')](respondWithResult(_0x4ec3b1,null))['catch'](handleError(_0x4ec3b1,null));};exports[_0xee7b('0x5d')]=function(_0x30fa88,_0x38a615,_0x57a186){var _0x5464fc={};var _0x38bdaa={};var _0x2a2dea;var _0x4d086d;return db[_0xee7b('0x3f')][_0xee7b('0x58')]({'where':{'id':_0x30fa88[_0xee7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x38a615,null))[_0xee7b('0x20')](function(_0x2d1b5b){if(_0x2d1b5b){_0x2a2dea=_0x2d1b5b;_0x38bdaa[_0xee7b('0x2d')]=_[_0xee7b('0x30')](db[_0xee7b('0x5c')][_0xee7b('0x48')]);_0x38bdaa['query']=_[_0xee7b('0x30')](_0x30fa88[_0xee7b('0x2f')]);_0x38bdaa['filters']=_[_0xee7b('0x32')](_0x38bdaa[_0xee7b('0x2d')],_0x38bdaa[_0xee7b('0x2f')]);_0x5464fc[_0xee7b('0x33')]=_['intersection'](_0x38bdaa['model'],qs[_0xee7b('0x34')](_0x30fa88[_0xee7b('0x2f')][_0xee7b('0x34')]));_0x5464fc[_0xee7b('0x33')]=_0x5464fc[_0xee7b('0x33')][_0xee7b('0x35')]?_0x5464fc['attributes']:_0x38bdaa['model'];_0x5464fc[_0xee7b('0x37')]=qs['sort'](_0x30fa88['query'][_0xee7b('0x38')]);_0x5464fc[_0xee7b('0x39')]=qs['filters'](_[_0xee7b('0x3a')](_0x30fa88[_0xee7b('0x2f')],_0x38bdaa[_0xee7b('0x31')]));if(_0x30fa88[_0xee7b('0x2f')]['filter']){_0x5464fc[_0xee7b('0x39')]=_[_0xee7b('0x3c')](_0x5464fc[_0xee7b('0x39')],{'$or':_[_0xee7b('0x2e')](_0x5464fc[_0xee7b('0x33')],function(_0x97a3c6){var _0x1883f6={};_0x1883f6[_0x97a3c6]={'$like':'%'+_0x30fa88['query'][_0xee7b('0x3b')]+'%'};return _0x1883f6;})});}_0x5464fc=_[_0xee7b('0x3c')]({},_0x5464fc,_0x30fa88['options']);return _0x2a2dea[_0xee7b('0x5d')](_0x5464fc);}})[_0xee7b('0x20')](function(_0x34f7eb){if(_0x34f7eb){_0x4d086d=_0x34f7eb['length'];if(!_0x30fa88[_0xee7b('0x2f')]['hasOwnProperty'](_0xee7b('0x59'))){_0x5464fc[_0xee7b('0x18')]=qs[_0xee7b('0x18')](_0x30fa88['query'][_0xee7b('0x18')]);_0x5464fc[_0xee7b('0x19')]=qs[_0xee7b('0x19')](_0x30fa88[_0xee7b('0x2f')][_0xee7b('0x19')]);}return _0x2a2dea[_0xee7b('0x5d')](_0x5464fc);}})[_0xee7b('0x20')](function(_0x1cb422){if(_0x1cb422){return _0x1cb422?{'count':_0x4d086d,'rows':_0x1cb422}:null;}})[_0xee7b('0x20')](respondWithResult(_0x38a615,null))[_0xee7b('0x45')](handleError(_0x38a615,null));}; \ No newline at end of file +var _0x7f8e=['include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','pick','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','end','error','name','send','index','map','Trigger','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f8e,0x82));var _0xe7f8=function(_0x17a79b,_0x464363){_0x17a79b=_0x17a79b-0x0;var _0x572ff9=_0x7f8e[_0x17a79b];return _0x572ff9;};'use strict';var emlformat=require(_0xe7f8('0x0'));var rimraf=require(_0xe7f8('0x1'));var zipdir=require(_0xe7f8('0x2'));var jsonpatch=require(_0xe7f8('0x3'));var rp=require(_0xe7f8('0x4'));var moment=require(_0xe7f8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe7f8('0x6'));var util=require(_0xe7f8('0x7'));var path=require(_0xe7f8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7f8('0xa'));var squel=require(_0xe7f8('0xb'));var crypto=require('crypto');var jsforce=require(_0xe7f8('0xc'));var deskjs=require(_0xe7f8('0xd'));var toCsv=require(_0xe7f8('0xe'));var querystring=require(_0xe7f8('0xf'));var Papa=require(_0xe7f8('0x10'));var Redis=require(_0xe7f8('0x11'));var authService=require(_0xe7f8('0x12'));var qs=require(_0xe7f8('0x13'));var as=require(_0xe7f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7f8('0x15'));var utils=require(_0xe7f8('0x16'));var config=require(_0xe7f8('0x17'));var licenseUtil=require(_0xe7f8('0x18'));var db=require(_0xe7f8('0x19'))['db'];function respondWithStatusCode(_0x3a3b93,_0x5c0fc3){_0x5c0fc3=_0x5c0fc3||0xcc;return function(_0xb1bae5){if(_0xb1bae5){return _0x3a3b93[_0xe7f8('0x1a')](_0x5c0fc3);}return _0x3a3b93[_0xe7f8('0x1b')](_0x5c0fc3)['end']();};}function respondWithResult(_0x20571e,_0x4aa2dd){_0x4aa2dd=_0x4aa2dd||0xc8;return function(_0x5bd4ba){if(_0x5bd4ba){return _0x20571e['status'](_0x4aa2dd)[_0xe7f8('0x1c')](_0x5bd4ba);}};}function respondWithFilteredResult(_0x3eae09,_0x28d9d6){return function(_0x68a3e6){if(_0x68a3e6){var _0x2750e3=typeof _0x28d9d6[_0xe7f8('0x1d')]===_0xe7f8('0x1e')&&typeof _0x28d9d6['limit']===_0xe7f8('0x1e');var _0x3a4d60=_0x68a3e6[_0xe7f8('0x1f')];var _0x48a644=_0x2750e3?0x0:_0x28d9d6[_0xe7f8('0x1d')];var _0x38f9e8=_0x2750e3?_0x68a3e6[_0xe7f8('0x1f')]:_0x28d9d6[_0xe7f8('0x1d')]+_0x28d9d6['limit'];var _0x343e3b;if(_0x38f9e8>=_0x3a4d60){_0x38f9e8=_0x3a4d60;_0x343e3b=0xc8;}else{_0x343e3b=0xce;}_0x3eae09[_0xe7f8('0x1b')](_0x343e3b);return _0x3eae09['set'](_0xe7f8('0x20'),_0x48a644+'-'+_0x38f9e8+'/'+_0x3a4d60)[_0xe7f8('0x1c')](_0x68a3e6);}return null;};}function patchUpdates(_0x349ffc){return function(_0x54eb35){try{jsonpatch[_0xe7f8('0x21')](_0x54eb35,_0x349ffc,!![]);}catch(_0x597153){return BPromise[_0xe7f8('0x22')](_0x597153);}return _0x54eb35[_0xe7f8('0x23')]();};}function saveUpdates(_0x4309d9,_0x2679ec){return function(_0x1d6bd2){if(_0x1d6bd2){return _0x1d6bd2[_0xe7f8('0x24')](_0x4309d9)[_0xe7f8('0x25')](function(_0x2e035e){return _0x2e035e;});}return null;};}function removeEntity(_0x3e10dd,_0x4cf8c9){return function(_0x1670d0){if(_0x1670d0){return _0x1670d0[_0xe7f8('0x26')]()[_0xe7f8('0x25')](function(){var _0x4f45bb=_0x1670d0[_0xe7f8('0x27')]({'plain':!![]});var _0x579507=_0xe7f8('0x28');return db[_0xe7f8('0x29')][_0xe7f8('0x26')]({'where':{'type':_0x579507,'resourceId':_0x4f45bb['id']}})[_0xe7f8('0x25')](function(){return _0x1670d0;});})[_0xe7f8('0x25')](function(){_0x3e10dd[_0xe7f8('0x1b')](0xcc)[_0xe7f8('0x2a')]();});}};}function handleEntityNotFound(_0x3867da,_0x3b0a25){return function(_0x53c2cd){if(!_0x53c2cd){_0x3867da['sendStatus'](0x194);}return _0x53c2cd;};}function handleError(_0x1b4bfa,_0x6ebdee){_0x6ebdee=_0x6ebdee||0x1f4;return function(_0x4babb4){logger[_0xe7f8('0x2b')](_0x4babb4['stack']);if(_0x4babb4[_0xe7f8('0x2c')]){delete _0x4babb4[_0xe7f8('0x2c')];}_0x1b4bfa['status'](_0x6ebdee)[_0xe7f8('0x2d')](_0x4babb4);};}exports[_0xe7f8('0x2e')]=function(_0xc90e19,_0x1b5a68){var _0x3e85a7={},_0x5c7584={},_0x23ae24={'count':0x0,'rows':[]};var _0x14b8ab=_[_0xe7f8('0x2f')](db[_0xe7f8('0x30')]['rawAttributes'],function(_0x3f4ccd){return{'name':_0x3f4ccd[_0xe7f8('0x31')],'type':_0x3f4ccd[_0xe7f8('0x32')]['key']};});_0x5c7584['model']=_['map'](_0x14b8ab,'name');_0x5c7584[_0xe7f8('0x33')]=_[_0xe7f8('0x34')](_0xc90e19[_0xe7f8('0x33')]);_0x5c7584[_0xe7f8('0x35')]=_[_0xe7f8('0x36')](_0x5c7584[_0xe7f8('0x37')],_0x5c7584['query']);_0x3e85a7[_0xe7f8('0x38')]=_[_0xe7f8('0x36')](_0x5c7584[_0xe7f8('0x37')],qs[_0xe7f8('0x39')](_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x39')]));_0x3e85a7[_0xe7f8('0x38')]=_0x3e85a7[_0xe7f8('0x38')][_0xe7f8('0x3a')]?_0x3e85a7['attributes']:_0x5c7584['model'];if(!_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x3b')](_0xe7f8('0x3c'))){_0x3e85a7['limit']=qs[_0xe7f8('0x3d')](_0xc90e19['query'][_0xe7f8('0x3d')]);_0x3e85a7[_0xe7f8('0x1d')]=qs[_0xe7f8('0x1d')](_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x1d')]);}_0x3e85a7[_0xe7f8('0x3e')]=qs[_0xe7f8('0x3f')](_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x3f')]);_0x3e85a7[_0xe7f8('0x40')]=qs['filters'](_['pick'](_0xc90e19[_0xe7f8('0x33')],_0x5c7584['filters']),_0x14b8ab);if(_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x41')]){_0x3e85a7[_0xe7f8('0x40')]=_[_0xe7f8('0x42')](_0x3e85a7[_0xe7f8('0x40')],{'$or':_[_0xe7f8('0x2f')](_0x14b8ab,function(_0x38bc0f){if(_0x38bc0f[_0xe7f8('0x32')]!==_0xe7f8('0x43')){var _0x31832f={};_0x31832f[_0x38bc0f[_0xe7f8('0x2c')]]={'$like':'%'+_0xc90e19[_0xe7f8('0x33')][_0xe7f8('0x41')]+'%'};return _0x31832f;}})});}_0x3e85a7=_[_0xe7f8('0x42')]({},_0x3e85a7,_0xc90e19['options']);var _0x2296d5={'where':_0x3e85a7[_0xe7f8('0x40')]};return db[_0xe7f8('0x30')][_0xe7f8('0x1f')](_0x2296d5)[_0xe7f8('0x25')](function(_0x2849a2){_0x23ae24['count']=_0x2849a2;if(_0xc90e19[_0xe7f8('0x33')]['includeAll']){_0x3e85a7[_0xe7f8('0x44')]=[{'all':!![]}];}return db[_0xe7f8('0x30')][_0xe7f8('0x45')](_0x3e85a7);})[_0xe7f8('0x25')](function(_0x5971e8){_0x23ae24[_0xe7f8('0x46')]=_0x5971e8;return _0x23ae24;})[_0xe7f8('0x25')](respondWithFilteredResult(_0x1b5a68,_0x3e85a7))['catch'](handleError(_0x1b5a68,null));};exports[_0xe7f8('0x47')]=function(_0x4f623e,_0x454e09){var _0x3944ed={'raw':![],'where':{'id':_0x4f623e[_0xe7f8('0x48')]['id']}},_0x46ce0d={};_0x46ce0d[_0xe7f8('0x37')]=_['keys'](db[_0xe7f8('0x30')][_0xe7f8('0x49')]);_0x46ce0d[_0xe7f8('0x33')]=_['keys'](_0x4f623e[_0xe7f8('0x33')]);_0x46ce0d[_0xe7f8('0x35')]=_[_0xe7f8('0x36')](_0x46ce0d['model'],_0x46ce0d[_0xe7f8('0x33')]);_0x3944ed[_0xe7f8('0x38')]=_['intersection'](_0x46ce0d[_0xe7f8('0x37')],qs[_0xe7f8('0x39')](_0x4f623e['query']['fields']));_0x3944ed[_0xe7f8('0x38')]=_0x3944ed[_0xe7f8('0x38')]['length']?_0x3944ed[_0xe7f8('0x38')]:_0x46ce0d['model'];if(_0x4f623e[_0xe7f8('0x33')][_0xe7f8('0x4a')]){_0x3944ed[_0xe7f8('0x44')]=[{'all':!![]}];}_0x3944ed=_[_0xe7f8('0x42')]({},_0x3944ed,_0x4f623e[_0xe7f8('0x4b')]);return db['Trigger'][_0xe7f8('0x4c')](_0x3944ed)['then'](handleEntityNotFound(_0x454e09,null))['then'](respondWithResult(_0x454e09,null))[_0xe7f8('0x4d')](handleError(_0x454e09,null));};exports[_0xe7f8('0x4e')]=function(_0x533696,_0x2fc872){return db['Trigger'][_0xe7f8('0x4e')](_0x533696[_0xe7f8('0x4f')],{})[_0xe7f8('0x25')](function(_0x123884){var _0x3521ce=_0x533696[_0xe7f8('0x50')][_0xe7f8('0x27')]({'plain':!![]});if(!_0x3521ce)throw new Error(_0xe7f8('0x51'));if(_0x3521ce[_0xe7f8('0x52')]==='user'){var _0x31ba9e=_0x123884[_0xe7f8('0x27')]({'plain':!![]});var _0x33c014=_0xe7f8('0x28');return db[_0xe7f8('0x53')][_0xe7f8('0x4c')]({'where':{'name':_0x33c014,'userProfileId':_0x3521ce[_0xe7f8('0x54')]},'raw':!![]})[_0xe7f8('0x25')](function(_0x3a9944){if(_0x3a9944&&_0x3a9944[_0xe7f8('0x55')]===0x0){return db['UserProfileResource'][_0xe7f8('0x4e')]({'name':_0x31ba9e['name'],'resourceId':_0x31ba9e['id'],'type':_0x3a9944['name'],'sectionId':_0x3a9944['id']},{})[_0xe7f8('0x25')](function(){return _0x123884;});}else{return _0x123884;}})[_0xe7f8('0x4d')](function(_0x2a4731){logger[_0xe7f8('0x2b')](_0xe7f8('0x56'),_0x2a4731);throw _0x2a4731;});}return _0x123884;})[_0xe7f8('0x25')](respondWithResult(_0x2fc872,0xc9))[_0xe7f8('0x4d')](handleError(_0x2fc872,null));};exports[_0xe7f8('0x24')]=function(_0x4f8351,_0x151a58){if(_0x4f8351[_0xe7f8('0x4f')]['id']){delete _0x4f8351[_0xe7f8('0x4f')]['id'];}return db[_0xe7f8('0x30')][_0xe7f8('0x4c')]({'where':{'id':_0x4f8351[_0xe7f8('0x48')]['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x151a58,null))['then'](saveUpdates(_0x4f8351[_0xe7f8('0x4f')],null))['then'](respondWithResult(_0x151a58,null))['catch'](handleError(_0x151a58,null));};exports[_0xe7f8('0x26')]=function(_0x56d21d,_0x12acac){return db[_0xe7f8('0x30')][_0xe7f8('0x4c')]({'where':{'id':_0x56d21d[_0xe7f8('0x48')]['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x12acac,null))[_0xe7f8('0x25')](removeEntity(_0x12acac,null))[_0xe7f8('0x4d')](handleError(_0x12acac,null));};exports[_0xe7f8('0x57')]=function(_0x2d6a05,_0x3066e0,_0x495991){if(_0x2d6a05['body']['id']){delete _0x2d6a05[_0xe7f8('0x4f')]['id'];}return db[_0xe7f8('0x30')][_0xe7f8('0x4c')]({'where':{'id':_0x2d6a05['params']['id']}})['then'](handleEntityNotFound(_0x3066e0,null))[_0xe7f8('0x25')](function(_0x19d888){if(_0x19d888){_0x2d6a05[_0xe7f8('0x4f')][_0xe7f8('0x58')]=_0x19d888['id'];return db[_0xe7f8('0x59')]['create'](_0x2d6a05[_0xe7f8('0x4f')]);}})['then'](respondWithResult(_0x3066e0,null))['catch'](handleError(_0x3066e0,null));};exports[_0xe7f8('0x5a')]=function(_0x387b79,_0x32a384,_0x3b9e59){if(_0x387b79[_0xe7f8('0x4f')]['id']){delete _0x387b79['body']['id'];}return db[_0xe7f8('0x30')][_0xe7f8('0x4c')]({'where':{'id':_0x387b79['params']['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x32a384,null))[_0xe7f8('0x25')](function(_0x1dc48f){if(_0x1dc48f){_0x387b79[_0xe7f8('0x4f')][_0xe7f8('0x5b')]=_0x1dc48f['id'];return db[_0xe7f8('0x59')]['create'](_0x387b79[_0xe7f8('0x4f')]);}})[_0xe7f8('0x25')](respondWithResult(_0x32a384,null))[_0xe7f8('0x4d')](handleError(_0x32a384,null));};exports[_0xe7f8('0x5c')]=function(_0x34ec9f,_0x3baf7c,_0x4c6256){var _0x5d1ed2={};var _0x439bee={};var _0x34b671;var _0x10ff31;return db['Trigger'][_0xe7f8('0x5d')]({'where':{'id':_0x34ec9f['params']['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x3baf7c,null))[_0xe7f8('0x25')](function(_0x1733ce){if(_0x1733ce){_0x34b671=_0x1733ce;_0x439bee[_0xe7f8('0x37')]=_['keys'](db[_0xe7f8('0x59')]['rawAttributes']);_0x439bee[_0xe7f8('0x33')]=_[_0xe7f8('0x34')](_0x34ec9f[_0xe7f8('0x33')]);_0x439bee[_0xe7f8('0x35')]=_[_0xe7f8('0x36')](_0x439bee[_0xe7f8('0x37')],_0x439bee[_0xe7f8('0x33')]);_0x5d1ed2[_0xe7f8('0x38')]=_[_0xe7f8('0x36')](_0x439bee['model'],qs[_0xe7f8('0x39')](_0x34ec9f[_0xe7f8('0x33')][_0xe7f8('0x39')]));_0x5d1ed2[_0xe7f8('0x38')]=_0x5d1ed2[_0xe7f8('0x38')][_0xe7f8('0x3a')]?_0x5d1ed2['attributes']:_0x439bee[_0xe7f8('0x37')];_0x5d1ed2['order']=qs[_0xe7f8('0x3f')](_0x34ec9f[_0xe7f8('0x33')][_0xe7f8('0x3f')]);_0x5d1ed2[_0xe7f8('0x40')]=qs[_0xe7f8('0x35')](_['pick'](_0x34ec9f['query'],_0x439bee[_0xe7f8('0x35')]));if(_0x34ec9f[_0xe7f8('0x33')][_0xe7f8('0x41')]){_0x5d1ed2[_0xe7f8('0x40')]=_[_0xe7f8('0x42')](_0x5d1ed2[_0xe7f8('0x40')],{'$or':_[_0xe7f8('0x2f')](_0x5d1ed2[_0xe7f8('0x38')],function(_0x28f60b){var _0x514318={};_0x514318[_0x28f60b]={'$like':'%'+_0x34ec9f[_0xe7f8('0x33')][_0xe7f8('0x41')]+'%'};return _0x514318;})});}_0x5d1ed2=_[_0xe7f8('0x42')]({},_0x5d1ed2,_0x34ec9f[_0xe7f8('0x4b')]);return _0x34b671[_0xe7f8('0x5c')](_0x5d1ed2);}})[_0xe7f8('0x25')](function(_0x58a0d1){if(_0x58a0d1){_0x10ff31=_0x58a0d1[_0xe7f8('0x3a')];if(!_0x34ec9f[_0xe7f8('0x33')][_0xe7f8('0x3b')](_0xe7f8('0x3c'))){_0x5d1ed2['limit']=qs[_0xe7f8('0x3d')](_0x34ec9f[_0xe7f8('0x33')]['limit']);_0x5d1ed2[_0xe7f8('0x1d')]=qs[_0xe7f8('0x1d')](_0x34ec9f['query'][_0xe7f8('0x1d')]);}return _0x34b671[_0xe7f8('0x5c')](_0x5d1ed2);}})[_0xe7f8('0x25')](function(_0x2a28e0){if(_0x2a28e0){return _0x2a28e0?{'count':_0x10ff31,'rows':_0x2a28e0}:null;}})['then'](respondWithResult(_0x3baf7c,null))[_0xe7f8('0x4d')](handleError(_0x3baf7c,null));};exports[_0xe7f8('0x5e')]=function(_0xc4eb8a,_0x4af1ab,_0x1d8a17){var _0x59920c={};var _0x3a50c0={};var _0x1b5ac7;var _0x1d002e;return db[_0xe7f8('0x30')]['findOne']({'where':{'id':_0xc4eb8a['params']['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x4af1ab,null))['then'](function(_0x127d7b){if(_0x127d7b){_0x1b5ac7=_0x127d7b;_0x3a50c0[_0xe7f8('0x37')]=_[_0xe7f8('0x34')](db[_0xe7f8('0x59')][_0xe7f8('0x49')]);_0x3a50c0[_0xe7f8('0x33')]=_['keys'](_0xc4eb8a[_0xe7f8('0x33')]);_0x3a50c0[_0xe7f8('0x35')]=_[_0xe7f8('0x36')](_0x3a50c0['model'],_0x3a50c0[_0xe7f8('0x33')]);_0x59920c[_0xe7f8('0x38')]=_[_0xe7f8('0x36')](_0x3a50c0['model'],qs[_0xe7f8('0x39')](_0xc4eb8a[_0xe7f8('0x33')][_0xe7f8('0x39')]));_0x59920c['attributes']=_0x59920c[_0xe7f8('0x38')][_0xe7f8('0x3a')]?_0x59920c[_0xe7f8('0x38')]:_0x3a50c0['model'];_0x59920c['order']=qs[_0xe7f8('0x3f')](_0xc4eb8a[_0xe7f8('0x33')][_0xe7f8('0x3f')]);_0x59920c[_0xe7f8('0x40')]=qs[_0xe7f8('0x35')](_[_0xe7f8('0x5f')](_0xc4eb8a[_0xe7f8('0x33')],_0x3a50c0[_0xe7f8('0x35')]));if(_0xc4eb8a['query'][_0xe7f8('0x41')]){_0x59920c[_0xe7f8('0x40')]=_['merge'](_0x59920c[_0xe7f8('0x40')],{'$or':_['map'](_0x59920c[_0xe7f8('0x38')],function(_0xc5ea18){var _0xb5b0c3={};_0xb5b0c3[_0xc5ea18]={'$like':'%'+_0xc4eb8a[_0xe7f8('0x33')][_0xe7f8('0x41')]+'%'};return _0xb5b0c3;})});}_0x59920c=_[_0xe7f8('0x42')]({},_0x59920c,_0xc4eb8a[_0xe7f8('0x4b')]);return _0x1b5ac7[_0xe7f8('0x5e')](_0x59920c);}})[_0xe7f8('0x25')](function(_0x2e4f22){if(_0x2e4f22){_0x1d002e=_0x2e4f22[_0xe7f8('0x3a')];if(!_0xc4eb8a[_0xe7f8('0x33')]['hasOwnProperty'](_0xe7f8('0x3c'))){_0x59920c[_0xe7f8('0x3d')]=qs[_0xe7f8('0x3d')](_0xc4eb8a['query'][_0xe7f8('0x3d')]);_0x59920c['offset']=qs[_0xe7f8('0x1d')](_0xc4eb8a[_0xe7f8('0x33')][_0xe7f8('0x1d')]);}return _0x1b5ac7[_0xe7f8('0x5e')](_0x59920c);}})[_0xe7f8('0x25')](function(_0x2b7ed3){if(_0x2b7ed3){return _0x2b7ed3?{'count':_0x1d002e,'rows':_0x2b7ed3}:null;}})[_0xe7f8('0x25')](respondWithResult(_0x4af1ab,null))[_0xe7f8('0x4d')](handleError(_0x4af1ab,null));};exports['addAction']=function(_0x11a634,_0x241eaa,_0x52b6d0){if(_0x11a634[_0xe7f8('0x4f')]['id']){delete _0x11a634['body']['id'];}return db['Trigger'][_0xe7f8('0x4c')]({'where':{'id':_0x11a634[_0xe7f8('0x48')]['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x241eaa,null))[_0xe7f8('0x25')](function(_0x3fa8c8){if(_0x3fa8c8){_0x11a634[_0xe7f8('0x4f')][_0xe7f8('0x60')]=_0x3fa8c8['id'];return db['Action'][_0xe7f8('0x4e')](_0x11a634['body']);}})['then'](respondWithResult(_0x241eaa,null))[_0xe7f8('0x4d')](handleError(_0x241eaa,null));};exports[_0xe7f8('0x61')]=function(_0xc1153b,_0x2b8205,_0x34b4aa){var _0x5da906={};var _0x3bc8bf={};var _0x5cf810;var _0x45821c;return db[_0xe7f8('0x30')][_0xe7f8('0x5d')]({'where':{'id':_0xc1153b[_0xe7f8('0x48')]['id']}})[_0xe7f8('0x25')](handleEntityNotFound(_0x2b8205,null))[_0xe7f8('0x25')](function(_0x2281bf){if(_0x2281bf){_0x5cf810=_0x2281bf;_0x3bc8bf[_0xe7f8('0x37')]=_[_0xe7f8('0x34')](db[_0xe7f8('0x62')][_0xe7f8('0x49')]);_0x3bc8bf[_0xe7f8('0x33')]=_[_0xe7f8('0x34')](_0xc1153b[_0xe7f8('0x33')]);_0x3bc8bf['filters']=_[_0xe7f8('0x36')](_0x3bc8bf[_0xe7f8('0x37')],_0x3bc8bf[_0xe7f8('0x33')]);_0x5da906[_0xe7f8('0x38')]=_[_0xe7f8('0x36')](_0x3bc8bf[_0xe7f8('0x37')],qs['fields'](_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x39')]));_0x5da906[_0xe7f8('0x38')]=_0x5da906[_0xe7f8('0x38')][_0xe7f8('0x3a')]?_0x5da906[_0xe7f8('0x38')]:_0x3bc8bf['model'];_0x5da906[_0xe7f8('0x3e')]=qs[_0xe7f8('0x3f')](_0xc1153b[_0xe7f8('0x33')]['sort']);_0x5da906[_0xe7f8('0x40')]=qs[_0xe7f8('0x35')](_['pick'](_0xc1153b[_0xe7f8('0x33')],_0x3bc8bf[_0xe7f8('0x35')]));if(_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x41')]){_0x5da906[_0xe7f8('0x40')]=_[_0xe7f8('0x42')](_0x5da906[_0xe7f8('0x40')],{'$or':_[_0xe7f8('0x2f')](_0x5da906[_0xe7f8('0x38')],function(_0x330c9b){var _0x48227f={};_0x48227f[_0x330c9b]={'$like':'%'+_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x41')]+'%'};return _0x48227f;})});}_0x5da906=_['merge']({},_0x5da906,_0xc1153b[_0xe7f8('0x4b')]);return _0x5cf810[_0xe7f8('0x61')](_0x5da906);}})[_0xe7f8('0x25')](function(_0x36946c){if(_0x36946c){_0x45821c=_0x36946c[_0xe7f8('0x3a')];if(!_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x3b')]('nolimit')){_0x5da906['limit']=qs[_0xe7f8('0x3d')](_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x3d')]);_0x5da906[_0xe7f8('0x1d')]=qs[_0xe7f8('0x1d')](_0xc1153b[_0xe7f8('0x33')][_0xe7f8('0x1d')]);}return _0x5cf810['getActions'](_0x5da906);}})['then'](function(_0x438832){if(_0x438832){return _0x438832?{'count':_0x45821c,'rows':_0x438832}:null;}})[_0xe7f8('0x25')](respondWithResult(_0x2b8205,null))['catch'](handleError(_0x2b8205,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 3f8185a..0442d3d 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 _0xfa2b=['../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x58bc83,_0x20292c){_0x58bc83=_0x58bc83-0x0;var _0x15ca1c=_0xfa2b[_0x58bc83];return _0x15ca1c;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf021=['define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5cea80,_0x210f31){var _0x2e97d1=function(_0x11f0f5){while(--_0x11f0f5){_0x5cea80['push'](_0x5cea80['shift']());}};_0x2e97d1(++_0x210f31);}(_0xf021,0x18f));var _0x1f02=function(_0x4b006b,_0x3c1db3){_0x4b006b=_0x4b006b-0x0;var _0x362121=_0xf021[_0x4b006b];return _0x362121;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x84a8f0,_0x56b275){return _0x84a8f0[_0x1f02('0x8')](_0x1f02('0x9'),attributes,{'tableName':_0x1f02('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 a7b188f..ef085be 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 _0x8781=['options','raw','where','attributes','limit','map','include','model','then','ShowTrigger','find','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll'];(function(_0x2ae5f5,_0x43969f){var _0x49a40d=function(_0x255d17){while(--_0x255d17){_0x2ae5f5['push'](_0x2ae5f5['shift']());}};_0x49a40d(++_0x43969f);}(_0x8781,0xab));var _0x1878=function(_0x3f6d1a,_0x210c8a){_0x3f6d1a=_0x3f6d1a-0x0;var _0x2fb808=_0x8781[_0x3f6d1a];return _0x2fb808;};'use strict';var _=require('lodash');var util=require(_0x1878('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1878('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1878('0x2'))['db'];var utils=require(_0x1878('0x3'));var logger=require('../../config/logger')(_0x1878('0x4'));var config=require(_0x1878('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1878('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x176276,_0x1f5546,_0xc7a798){return new BPromise(function(_0x29ad65,_0x489b01){return client[_0x1878('0x7')](_0x176276,_0xc7a798)['then'](function(_0x2fd2cf){logger[_0x1878('0x8')](_0x1878('0x9'),_0x1f5546,_0x1878('0xa'));logger[_0x1878('0xb')](_0x1878('0xc'),_0x1f5546,_0x1878('0xa'),JSON[_0x1878('0xd')](_0x2fd2cf));if(_0x2fd2cf[_0x1878('0xe')]){if(_0x2fd2cf[_0x1878('0xe')][_0x1878('0xf')]===0x1f4){logger[_0x1878('0xe')](_0x1878('0x9'),_0x1f5546,_0x2fd2cf['error'][_0x1878('0x10')]);return _0x489b01(_0x2fd2cf[_0x1878('0xe')][_0x1878('0x10')]);}logger[_0x1878('0xe')](_0x1878('0x9'),_0x1f5546,_0x2fd2cf[_0x1878('0xe')][_0x1878('0x10')]);return _0x29ad65(_0x2fd2cf[_0x1878('0xe')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x1f5546,_0x1878('0xa'));_0x29ad65(_0x2fd2cf['result'][_0x1878('0x10')]);}})[_0x1878('0x11')](function(_0x53a63a){logger[_0x1878('0xe')]('Trigger,\x20%s,\x20%s',_0x1f5546,_0x53a63a);_0x489b01(_0x53a63a);});});}exports[_0x1878('0x12')]=function(_0x2068b5){var _0x2f5f14=this;return new Promise(function(_0x5004f2,_0x271705){return db[_0x1878('0x13')][_0x1878('0x14')]({'raw':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x16')]===undefined?!![]:![]:!![],'where':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x17')]||null:null,'attributes':_0x2068b5[_0x1878('0x15')]?_0x2068b5[_0x1878('0x15')][_0x1878('0x18')]||null:null,'limit':_0x2068b5[_0x1878('0x15')]?_0x2068b5['options'][_0x1878('0x19')]||null:null,'include':_0x2068b5['options']?_0x2068b5[_0x1878('0x15')]['include']?_[_0x1878('0x1a')](_0x2068b5[_0x1878('0x15')][_0x1878('0x1b')],function(_0x1fa9d9){return{'model':db[_0x1fa9d9['model']],'as':_0x1fa9d9['as'],'attributes':_0x1fa9d9[_0x1878('0x18')],'include':_0x1fa9d9[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x1fa9d9['include'],function(_0x2d5418){return{'model':db[_0x2d5418[_0x1878('0x1c')]],'as':_0x2d5418['as'],'attributes':_0x2d5418[_0x1878('0x18')],'include':_0x2d5418[_0x1878('0x1b')]?_['map'](_0x2d5418[_0x1878('0x1b')],function(_0x2403c2){return{'model':db[_0x2403c2[_0x1878('0x1c')]],'as':_0x2403c2['as'],'attributes':_0x2403c2[_0x1878('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1878('0x1d')](function(_0x16aace){logger['info'](_0x1878('0x12'),_0x2068b5);logger[_0x1878('0xb')](_0x1878('0x12'),_0x2068b5,JSON['stringify'](_0x16aace));_0x5004f2(_0x16aace);})[_0x1878('0x11')](function(_0xdfa9d0){logger['error']('GetTrigger',_0xdfa9d0[_0x1878('0x10')],_0x2068b5);_0x271705(_0x2f5f14[_0x1878('0xe')](0x1f4,_0xdfa9d0[_0x1878('0x10')]));});});};exports[_0x1878('0x1e')]=function(_0x4250db){var _0x2fc050=this;return new Promise(function(_0xc58ed,_0x356e58){return db[_0x1878('0x13')][_0x1878('0x1f')]({'raw':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')][_0x1878('0x17')]||null:null,'attributes':_0x4250db[_0x1878('0x15')]?_0x4250db['options'][_0x1878('0x18')]||null:null,'include':_0x4250db[_0x1878('0x15')]?_0x4250db[_0x1878('0x15')]['include']?_[_0x1878('0x1a')](_0x4250db[_0x1878('0x15')][_0x1878('0x1b')],function(_0x55fa76){return{'model':db[_0x55fa76[_0x1878('0x1c')]],'as':_0x55fa76['as'],'attributes':_0x55fa76[_0x1878('0x18')],'include':_0x55fa76[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x55fa76[_0x1878('0x1b')],function(_0x5c326e){return{'model':db[_0x5c326e['model']],'as':_0x5c326e['as'],'attributes':_0x5c326e['attributes'],'include':_0x5c326e[_0x1878('0x1b')]?_[_0x1878('0x1a')](_0x5c326e[_0x1878('0x1b')],function(_0x33b552){return{'model':db[_0x33b552[_0x1878('0x1c')]],'as':_0x33b552['as'],'attributes':_0x33b552['attributes']};}):[]};}):[]};}):[]:[]})[_0x1878('0x1d')](function(_0x29898d){logger[_0x1878('0x8')](_0x1878('0x1e'),_0x4250db);logger[_0x1878('0xb')](_0x1878('0x1e'),_0x4250db,JSON[_0x1878('0xd')](_0x29898d));_0xc58ed(_0x29898d);})[_0x1878('0x11')](function(_0x1dd88e){logger[_0x1878('0xe')]('ShowTrigger',_0x1dd88e[_0x1878('0x10')],_0x4250db);_0x356e58(_0x2fc050['error'](0x1f4,_0x1dd88e[_0x1878('0x10')]));});});}; \ No newline at end of file +var _0x6bb7=['attributes','limit','map','include','model','then','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6bb7,0x166));var _0x76bb=function(_0x240d52,_0x1437f8){_0x240d52=_0x240d52-0x0;var _0x4f43d9=_0x6bb7[_0x240d52];return _0x4f43d9;};'use strict';var _=require(_0x76bb('0x0'));var util=require(_0x76bb('0x1'));var moment=require(_0x76bb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76bb('0x3'));var db=require(_0x76bb('0x4'))['db'];var utils=require(_0x76bb('0x5'));var logger=require(_0x76bb('0x6'))(_0x76bb('0x7'));var config=require(_0x76bb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fee28,_0x4ebe9a,_0x434238){return new BPromise(function(_0x2a2189,_0xc25053){return client[_0x76bb('0xa')](_0x3fee28,_0x434238)['then'](function(_0x32bf91){logger[_0x76bb('0xb')](_0x76bb('0xc'),_0x4ebe9a,'request\x20sent');logger[_0x76bb('0xd')](_0x76bb('0xe'),_0x4ebe9a,_0x76bb('0xf'),JSON[_0x76bb('0x10')](_0x32bf91));if(_0x32bf91['error']){if(_0x32bf91[_0x76bb('0x11')][_0x76bb('0x12')]===0x1f4){logger[_0x76bb('0x11')](_0x76bb('0xc'),_0x4ebe9a,_0x32bf91[_0x76bb('0x11')][_0x76bb('0x13')]);return _0xc25053(_0x32bf91['error'][_0x76bb('0x13')]);}logger['error'](_0x76bb('0xc'),_0x4ebe9a,_0x32bf91['error'][_0x76bb('0x13')]);return _0x2a2189(_0x32bf91[_0x76bb('0x11')]['message']);}else{logger[_0x76bb('0xb')](_0x76bb('0xc'),_0x4ebe9a,_0x76bb('0xf'));_0x2a2189(_0x32bf91[_0x76bb('0x14')][_0x76bb('0x13')]);}})[_0x76bb('0x15')](function(_0x14e1cd){logger[_0x76bb('0x11')]('Trigger,\x20%s,\x20%s',_0x4ebe9a,_0x14e1cd);_0xc25053(_0x14e1cd);});});}exports[_0x76bb('0x16')]=function(_0x230648){var _0x52cc07=this;return new Promise(function(_0x50da07,_0x9add1a){return db[_0x76bb('0x17')]['findAll']({'raw':_0x230648['options']?_0x230648[_0x76bb('0x18')][_0x76bb('0x19')]===undefined?!![]:![]:!![],'where':_0x230648[_0x76bb('0x18')]?_0x230648[_0x76bb('0x18')][_0x76bb('0x1a')]||null:null,'attributes':_0x230648[_0x76bb('0x18')]?_0x230648[_0x76bb('0x18')][_0x76bb('0x1b')]||null:null,'limit':_0x230648[_0x76bb('0x18')]?_0x230648['options'][_0x76bb('0x1c')]||null:null,'include':_0x230648[_0x76bb('0x18')]?_0x230648['options']['include']?_[_0x76bb('0x1d')](_0x230648[_0x76bb('0x18')][_0x76bb('0x1e')],function(_0x3d3223){return{'model':db[_0x3d3223[_0x76bb('0x1f')]],'as':_0x3d3223['as'],'attributes':_0x3d3223[_0x76bb('0x1b')],'include':_0x3d3223[_0x76bb('0x1e')]?_[_0x76bb('0x1d')](_0x3d3223[_0x76bb('0x1e')],function(_0x67a6ac){return{'model':db[_0x67a6ac['model']],'as':_0x67a6ac['as'],'attributes':_0x67a6ac[_0x76bb('0x1b')],'include':_0x67a6ac['include']?_['map'](_0x67a6ac['include'],function(_0x1f7de4){return{'model':db[_0x1f7de4[_0x76bb('0x1f')]],'as':_0x1f7de4['as'],'attributes':_0x1f7de4[_0x76bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x76bb('0x20')](function(_0x47d787){logger[_0x76bb('0xb')]('GetTrigger',_0x230648);logger[_0x76bb('0xd')](_0x76bb('0x16'),_0x230648,JSON[_0x76bb('0x10')](_0x47d787));_0x50da07(_0x47d787);})[_0x76bb('0x15')](function(_0x40eed0){logger[_0x76bb('0x11')]('GetTrigger',_0x40eed0[_0x76bb('0x13')],_0x230648);_0x9add1a(_0x52cc07['error'](0x1f4,_0x40eed0[_0x76bb('0x13')]));});});};exports[_0x76bb('0x21')]=function(_0x5ee35e){var _0x539a54=this;return new Promise(function(_0x3186b8,_0x32452c){return db['Trigger'][_0x76bb('0x22')]({'raw':_0x5ee35e[_0x76bb('0x18')]?_0x5ee35e[_0x76bb('0x18')][_0x76bb('0x19')]===undefined?!![]:![]:!![],'where':_0x5ee35e[_0x76bb('0x18')]?_0x5ee35e[_0x76bb('0x18')][_0x76bb('0x1a')]||null:null,'attributes':_0x5ee35e[_0x76bb('0x18')]?_0x5ee35e[_0x76bb('0x18')][_0x76bb('0x1b')]||null:null,'include':_0x5ee35e[_0x76bb('0x18')]?_0x5ee35e[_0x76bb('0x18')][_0x76bb('0x1e')]?_[_0x76bb('0x1d')](_0x5ee35e[_0x76bb('0x18')][_0x76bb('0x1e')],function(_0xdd85a8){return{'model':db[_0xdd85a8[_0x76bb('0x1f')]],'as':_0xdd85a8['as'],'attributes':_0xdd85a8[_0x76bb('0x1b')],'include':_0xdd85a8[_0x76bb('0x1e')]?_[_0x76bb('0x1d')](_0xdd85a8[_0x76bb('0x1e')],function(_0x4aa668){return{'model':db[_0x4aa668['model']],'as':_0x4aa668['as'],'attributes':_0x4aa668[_0x76bb('0x1b')],'include':_0x4aa668[_0x76bb('0x1e')]?_[_0x76bb('0x1d')](_0x4aa668['include'],function(_0x51af62){return{'model':db[_0x51af62[_0x76bb('0x1f')]],'as':_0x51af62['as'],'attributes':_0x51af62['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32a25d){logger['info'](_0x76bb('0x21'),_0x5ee35e);logger[_0x76bb('0xd')]('ShowTrigger',_0x5ee35e,JSON[_0x76bb('0x10')](_0x32a25d));_0x3186b8(_0x32a25d);})['catch'](function(_0x4ad5bd){logger[_0x76bb('0x11')](_0x76bb('0x21'),_0x4ad5bd[_0x76bb('0x13')],_0x5ee35e);_0x32452c(_0x539a54[_0x76bb('0x11')](0x1f4,_0x4ad5bd[_0x76bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b46b6be..4027a2e 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 _0x5c3e=['fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','post','isAuthenticated','clone','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x41769b,_0x1b5cd3){var _0xfe6115=function(_0x207cf1){while(--_0x207cf1){_0x41769b['push'](_0x41769b['shift']());}};_0xfe6115(++_0x1b5cd3);}(_0x5c3e,0x1d8));var _0xe5c3=function(_0x5975d6,_0x36c521){_0x5975d6=_0x5975d6-0x0;var _0x16d3a2=_0x5c3e[_0x5975d6];return _0x16d3a2;};'use strict';var multer=require('multer');var util=require(_0xe5c3('0x0'));var path=require(_0xe5c3('0x1'));var timeout=require(_0xe5c3('0x2'));var express=require(_0xe5c3('0x3'));var router=express['Router']();var fs_extra=require(_0xe5c3('0x4'));var auth=require(_0xe5c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe5c3('0x6'));var controller=require('./trunk.controller');router[_0xe5c3('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5c3('0x8')]);router[_0xe5c3('0x7')](_0xe5c3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe5c3('0xa')]('/:id/clone',auth[_0xe5c3('0xb')](),controller[_0xe5c3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe5c3('0xd')](_0xe5c3('0x9'),auth[_0xe5c3('0xb')](),controller[_0xe5c3('0xe')]);router[_0xe5c3('0xf')](_0xe5c3('0x9'),auth[_0xe5c3('0xb')](),controller['destroy']);module[_0xe5c3('0x10')]=router; \ No newline at end of file +var _0x8390=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','delete','destroy','exports','util','path','express','Router'];(function(_0x552eab,_0xa830fb){var _0x4acc62=function(_0x26c498){while(--_0x26c498){_0x552eab['push'](_0x552eab['shift']());}};_0x4acc62(++_0xa830fb);}(_0x8390,0x1b5));var _0x0839=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x8390[_0x2a18b7];return _0x45e74e;};'use strict';var multer=require('multer');var util=require(_0x0839('0x0'));var path=require(_0x0839('0x1'));var timeout=require('connect-timeout');var express=require(_0x0839('0x2'));var router=express[_0x0839('0x3')]();var fs_extra=require(_0x0839('0x4'));var auth=require(_0x0839('0x5'));var interaction=require(_0x0839('0x6'));var config=require(_0x0839('0x7'));var controller=require(_0x0839('0x8'));router[_0x0839('0x9')]('/',auth[_0x0839('0xa')](),controller[_0x0839('0xb')]);router[_0x0839('0x9')](_0x0839('0xc'),auth[_0x0839('0xa')](),controller[_0x0839('0xd')]);router[_0x0839('0xe')](_0x0839('0xf'),auth[_0x0839('0xa')](),controller[_0x0839('0x10')]);router[_0x0839('0xe')]('/',auth[_0x0839('0xa')](),controller[_0x0839('0x11')]);router['put'](_0x0839('0xc'),auth[_0x0839('0xa')](),controller['update']);router[_0x0839('0x12')](_0x0839('0xc'),auth[_0x0839('0xa')](),controller[_0x0839('0x13')]);module[_0x0839('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2f0224c..ddcd38b 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 _0xd29d=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','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]','\x22\x22\x20<>','always','accept','originate','INTEGER','uac','uas','pai','certificate','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x260271,_0x4c19e2){var _0xd285c3=function(_0x1a32b6){while(--_0x1a32b6){_0x260271['push'](_0x260271['shift']());}};_0xd285c3(++_0x4c19e2);}(_0xd29d,0x16f));var _0xdd29=function(_0x20891f,_0xea64a0){_0x20891f=_0x20891f-0x0;var _0xf1b071=_0xd29d[_0x20891f];return _0xf1b071;};'use strict';var Sequelize=require(_0xdd29('0x0'));module[_0xdd29('0x1')]={'name':{'type':Sequelize[_0xdd29('0x2')],'allowNull':![],'unique':_0xdd29('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0xdd29('0x5')},'context':{'type':Sequelize[_0xdd29('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xdd29('0x6'),_0xdd29('0x7'),'ALLOWED_FAILED_SCREEN',_0xdd29('0x8'),_0xdd29('0x9'),_0xdd29('0xa'),_0xdd29('0xb'),_0xdd29('0xc'))},'deny':{'type':Sequelize[_0xdd29('0x2')]},'permit':{'type':Sequelize[_0xdd29('0x2')]},'secret':{'type':Sequelize[_0xdd29('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':'udp','set':function(_0xa578a){this['setDataValue'](_0xdd29('0xd'),_0xa578a?_0xa578a[_0xdd29('0xe')](','):null);},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0xd'))?this[_0xdd29('0xf')](_0xdd29('0xd'))[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x11')},'dtmfmode':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x12'),'info',_0xdd29('0x13'),'inband',_0xdd29('0x14')),'defaultValue':_0xdd29('0x12')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdd29('0x15'),_0xdd29('0x16'),_0xdd29('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdd29('0x2')]},'directmediadeny':{'type':Sequelize[_0xdd29('0x2')]},'nat':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x19'),'set':function(_0x5a9fe0){this[_0xdd29('0x1a')]('nat',_0x5a9fe0?_0x5a9fe0['join'](','):null);},'get':function(){return this[_0xdd29('0xf')]('nat')?this[_0xdd29('0xf')]('nat')[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdd29('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xdd29('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd29('0x1d'),'set':function(_0x40322d){this['setDataValue'](_0xdd29('0x1e'),_0x40322d?_0x40322d[_0xdd29('0xe')](';'):_0xdd29('0x1d'));},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0x1e'))?this[_0xdd29('0xf')](_0xdd29('0x1e'))[_0xdd29('0x10')](';'):null;},'comment':_0xdd29('0x1f')},'autoframing':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xdd29('0x20'),'set':function(_0x4c122a){this[_0xdd29('0x1a')](_0xdd29('0x21'),_0x4c122a?_0x4c122a[_0xdd29('0xe')](','):null);},'get':function(){return this[_0xdd29('0xf')](_0xdd29('0x21'))?this[_0xdd29('0xf')]('insecure')[_0xdd29('0x10')](','):null;},'comment':_0xdd29('0x22')},'trustrpid':{'type':Sequelize[_0xdd29('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xdd29('0x2')]},'callerid':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':_0xdd29('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xdd29('0x2')]},'videosupport':{'type':Sequelize[_0xdd29('0x4')]('yes','no',_0xdd29('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xdd29('0x25'),'refuse',_0xdd29('0x26'))},'session_expires':{'type':Sequelize[_0xdd29('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x28'),_0xdd29('0x29')),'defaultValue':_0xdd29('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xdd29('0x2')]},'fromdomain':{'type':Sequelize[_0xdd29('0x2')]},'fromuser':{'type':Sequelize[_0xdd29('0x2')]},'port':{'type':Sequelize[_0xdd29('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no'),'defaultValue':_0xdd29('0x18')},'keepalive':{'type':Sequelize[_0xdd29('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xdd29('0x2')]},'defaultuser':{'type':Sequelize[_0xdd29('0x2')]},'rtptimeout':{'type':Sequelize[_0xdd29('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdd29('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdd29('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no',_0xdd29('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xdd29('0x2')]},'timert1':{'type':Sequelize[_0xdd29('0x27')](0xb)},'timerb':{'type':Sequelize[_0xdd29('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdd29('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xdd29('0x2')]},'contactdeny':{'type':Sequelize[_0xdd29('0x2')]},'contactacl':{'type':Sequelize[_0xdd29('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xdd29('0x2')]},'use_q850_reason':{'type':Sequelize[_0xdd29('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'force_avp':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xdd29('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xdd29('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xdd29('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xdd29('0x2')]},'dtlscipher':{'type':Sequelize[_0xdd29('0x2')]},'dtlscafile':{'type':Sequelize[_0xdd29('0x2')]},'dtlscapath':{'type':Sequelize[_0xdd29('0x2')]},'dtlssetup':{'type':Sequelize[_0xdd29('0x4')]('active','passive',_0xdd29('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd29('0x2')]},'usereqphone':{'type':Sequelize[_0xdd29('0x4')](_0xdd29('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdd29('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xdd29('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xdd29('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xdd29('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdd29('0x2')]},'parkinglot':{'type':Sequelize[_0xdd29('0x2')]},'description':{'type':Sequelize[_0xdd29('0x2')]},'host':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':_0xdd29('0x2d')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xdd29('0x15'),_0xdd29('0x16'),_0xdd29('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdd29('0x2')]},'otherFields':{'type':Sequelize[_0xdd29('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdd29('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x82bc=['pai','fingerprint','certificate','active','passive','actpass','dynamic','update','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','uac','uas'];(function(_0x21cff,_0x2fe120){var _0x16a23a=function(_0x58adb1){while(--_0x58adb1){_0x21cff['push'](_0x21cff['shift']());}};_0x16a23a(++_0x2fe120);}(_0x82bc,0xfe));var _0xc82b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x82bc[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0xc82b('0x0')]={'name':{'type':Sequelize[_0xc82b('0x1')],'allowNull':![],'unique':_0xc82b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x4'),_0xc82b('0x5'),_0xc82b('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc82b('0x1')],'allowNull':![],'defaultValue':_0xc82b('0x7')},'callingpres':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x8'),'ALLOWED_PASSED_SCREEN',_0xc82b('0x9'),_0xc82b('0xa'),'PROHIB_NOT_SCREENED',_0xc82b('0xb'),'PROHIB_FAILED_SCREEN',_0xc82b('0xc'))},'deny':{'type':Sequelize[_0xc82b('0x1')]},'permit':{'type':Sequelize[_0xc82b('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc82b('0x1')]},'remotesecret':{'type':Sequelize[_0xc82b('0x1')]},'transport':{'type':Sequelize[_0xc82b('0x1')],'defaultValue':'udp','set':function(_0x2442f8){this['setDataValue'](_0xc82b('0xd'),_0x2442f8?_0x2442f8[_0xc82b('0xe')](','):null);},'get':function(){return this[_0xc82b('0xf')](_0xc82b('0xd'))?this[_0xc82b('0xf')](_0xc82b('0xd'))[_0xc82b('0x10')](','):null;},'comment':_0xc82b('0x11')},'dtmfmode':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x12'),'info',_0xc82b('0x13'),_0xc82b('0x14'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no','nonat','update',_0xc82b('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc82b('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xc82b('0x1')],'defaultValue':_0xc82b('0x17'),'set':function(_0x2da338){this[_0xc82b('0x18')]('nat',_0x2da338?_0x2da338['join'](','):null);},'get':function(){return this[_0xc82b('0xf')](_0xc82b('0x19'))?this[_0xc82b('0xf')](_0xc82b('0x19'))[_0xc82b('0x10')](','):null;},'comment':_0xc82b('0x1a')},'callgroup':{'type':Sequelize[_0xc82b('0x1')]},'namedcallgroup':{'type':Sequelize[_0xc82b('0x1')]},'pickupgroup':{'type':Sequelize[_0xc82b('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xc82b('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc82b('0x1')],'defaultValue':_0xc82b('0x1b')},'allow':{'type':Sequelize[_0xc82b('0x1')],'allowNull':![],'defaultValue':_0xc82b('0x1c'),'set':function(_0x4d06d8){this[_0xc82b('0x18')](_0xc82b('0x1d'),_0x4d06d8?_0x4d06d8[_0xc82b('0xe')](';'):_0xc82b('0x1c'));},'get':function(){return this[_0xc82b('0xf')](_0xc82b('0x1d'))?this[_0xc82b('0xf')](_0xc82b('0x1d'))[_0xc82b('0x10')](';'):null;},'comment':_0xc82b('0x1e')},'autoframing':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'insecure':{'type':Sequelize[_0xc82b('0x1')],'defaultValue':_0xc82b('0x1f'),'set':function(_0xe0548c){this[_0xc82b('0x18')]('insecure',_0xe0548c?_0xe0548c['join'](','):null);},'get':function(){return this[_0xc82b('0xf')](_0xc82b('0x20'))?this[_0xc82b('0xf')](_0xc82b('0x20'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no',_0xc82b('0x21'))},'promiscredir':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xc82b('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc82b('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no'),'defaultValue':_0xc82b('0x15')},'busylevel':{'type':Sequelize[_0xc82b('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xc82b('0x1')]},'template':{'type':Sequelize[_0xc82b('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no',_0xc82b('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'mailbox':{'type':Sequelize[_0xc82b('0x1')]},'session_timers':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x24'),_0xc82b('0x25'),'originate')},'session_expires':{'type':Sequelize[_0xc82b('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x26'),_0xc82b('0x27')),'defaultValue':_0xc82b('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xc82b('0x1')]},'regexten':{'type':Sequelize[_0xc82b('0x1')]},'fromdomain':{'type':Sequelize[_0xc82b('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc82b('0x22')](0x5)},'qualify':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc82b('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xc82b('0x1')]},'defaultuser':{'type':Sequelize[_0xc82b('0x1')]},'rtptimeout':{'type':Sequelize[_0xc82b('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc82b('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xc82b('0x3')]('yes','no',_0xc82b('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc82b('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xc82b('0x22')](0xb)},'timerb':{'type':Sequelize[_0xc82b('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc82b('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xc82b('0x1')]},'contactdeny':{'type':Sequelize[_0xc82b('0x1')]},'contactacl':{'type':Sequelize[_0xc82b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc82b('0x1')]},'use_q850_reason':{'type':Sequelize[_0xc82b('0x1')]},'maxforwards':{'type':Sequelize[_0xc82b('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'force_avp':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'icesupport':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xc82b('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no',_0xc82b('0x29'),_0xc82b('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xc82b('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc82b('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc82b('0x1')]},'dtlscipher':{'type':Sequelize[_0xc82b('0x1')]},'dtlscafile':{'type':Sequelize[_0xc82b('0x1')]},'dtlscapath':{'type':Sequelize[_0xc82b('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc82b('0x2b'),_0xc82b('0x2c'),_0xc82b('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc82b('0x1')]},'usereqphone':{'type':Sequelize[_0xc82b('0x3')](_0xc82b('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc82b('0x1')]},'recordofffeature':{'type':Sequelize[_0xc82b('0x1')]},'call_limit':{'type':Sequelize[_0xc82b('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no')},'vmexten':{'type':Sequelize[_0xc82b('0x1')]},'mohinterpret':{'type':Sequelize[_0xc82b('0x1')]},'mohsuggest':{'type':Sequelize[_0xc82b('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc82b('0x1')]},'host':{'type':Sequelize[_0xc82b('0x1')],'defaultValue':_0xc82b('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0xc82b('0x15'),'no','nonat',_0xc82b('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc82b('0x1')]},'otherFields':{'type':Sequelize[_0xc82b('0x1')]},'active':{'type':Sequelize[_0xc82b('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index c9345b8..769ee0a 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','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','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x28a26e,_0x4559aa){var _0xa77c6=function(_0xa90f0a){while(--_0xa90f0a){_0x28a26e['push'](_0x28a26e['shift']());}};_0xa77c6(++_0x4559aa);}(_0x6aa7,0x178));var _0x76aa=function(_0x36375c,_0x5f0384){_0x36375c=_0x36375c-0x0;var _0x1f5325=_0x6aa7[_0x36375c];return _0x1f5325;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x4c22bc,_0x1ee2f6){var _0x150783=function(_0xebfda6){while(--_0xebfda6){_0x4c22bc['push'](_0x4c22bc['shift']());}};_0x150783(++_0x1ee2f6);}(_0x54ef,0x112));var _0xf54e=function(_0x311c94,_0x346184){_0x311c94=_0x311c94-0x0;var _0x2a19dc=_0x54ef[_0x311c94];return _0x2a19dc;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3f93f50..3e3aa83 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 _0x3445=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x1c7d4b,_0xc5ec31){var _0x3bf611=function(_0x50f998){while(--_0x50f998){_0x1c7d4b['push'](_0x1c7d4b['shift']());}};_0x3bf611(++_0xc5ec31);}(_0x3445,0xcf));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require(_0x5344('0x6'));var fs=require('fs');var path=require(_0x5344('0x7'));var rimraf=require(_0x5344('0x8'));var config=require(_0x5344('0x9'));var attributes=require('./trunk.attributes');module[_0x5344('0xa')]=function(_0x4220a6,_0xd90dc1){return _0x4220a6[_0x5344('0xb')](_0x5344('0xc'),attributes,{'tableName':_0x5344('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa9d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xfa9d,0x124));var _0xdfa9=function(_0xd33437,_0x1325b3){_0xd33437=_0xd33437-0x0;var _0x4c4e80=_0xfa9d[_0xd33437];return _0x4c4e80;};'use strict';var _=require(_0xdfa9('0x0'));var util=require(_0xdfa9('0x1'));var logger=require(_0xdfa9('0x2'))(_0xdfa9('0x3'));var moment=require('moment');var BPromise=require(_0xdfa9('0x4'));var rp=require(_0xdfa9('0x5'));var fs=require('fs');var path=require(_0xdfa9('0x6'));var rimraf=require(_0xdfa9('0x7'));var config=require(_0xdfa9('0x8'));var attributes=require(_0xdfa9('0x9'));module[_0xdfa9('0xa')]=function(_0x327cac,_0x2193bf){return _0x327cac[_0xdfa9('0xb')](_0xdfa9('0xc'),attributes,{'tableName':_0xdfa9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 0cec7d9..35257bb 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 _0xfda8=['include','map','model','attributes','ShowTrunk','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit'];(function(_0x63054d,_0x2b4813){var _0x15c48d=function(_0x262b00){while(--_0x262b00){_0x63054d['push'](_0x63054d['shift']());}};_0x15c48d(++_0x2b4813);}(_0xfda8,0x185));var _0x8fda=function(_0x2ba918,_0x4cdeb1){_0x2ba918=_0x2ba918-0x0;var _0x508956=_0xfda8[_0x2ba918];return _0x508956;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fda('0x0'));var BPromise=require(_0x8fda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fda('0x2'));var db=require(_0x8fda('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8fda('0x4'));var jayson=require(_0x8fda('0x5'));var client=jayson[_0x8fda('0x6')][_0x8fda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3311dc,_0x20b57b,_0x60b0f8){return new BPromise(function(_0xf60cea,_0x4f058a){return client[_0x8fda('0x8')](_0x3311dc,_0x60b0f8)[_0x8fda('0x9')](function(_0x7f3f70){logger[_0x8fda('0xa')](_0x8fda('0xb'),_0x20b57b,_0x8fda('0xc'));logger[_0x8fda('0xd')](_0x8fda('0xe'),_0x20b57b,_0x8fda('0xc'),JSON[_0x8fda('0xf')](_0x7f3f70));if(_0x7f3f70[_0x8fda('0x10')]){if(_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x11')]===0x1f4){logger[_0x8fda('0x10')](_0x8fda('0xb'),_0x20b57b,_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x12')]);return _0x4f058a(_0x7f3f70[_0x8fda('0x10')][_0x8fda('0x12')]);}logger['error'](_0x8fda('0xb'),_0x20b57b,_0x7f3f70['error'][_0x8fda('0x12')]);return _0xf60cea(_0x7f3f70[_0x8fda('0x10')]['message']);}else{logger[_0x8fda('0xa')](_0x8fda('0xb'),_0x20b57b,'request\x20sent');_0xf60cea(_0x7f3f70[_0x8fda('0x13')]['message']);}})[_0x8fda('0x14')](function(_0x2e7e3b){logger[_0x8fda('0x10')](_0x8fda('0xb'),_0x20b57b,_0x2e7e3b);_0x4f058a(_0x2e7e3b);});});}exports[_0x8fda('0x15')]=function(_0x13ac83){var _0x43e9eb=this;return new Promise(function(_0x902db0,_0x5712e5){return db[_0x8fda('0x16')]['findAll']({'raw':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x18')]===undefined?!![]:![]:!![],'where':_0x13ac83['options']?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x19')]||null:null,'attributes':_0x13ac83['options']?_0x13ac83['options']['attributes']||null:null,'limit':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1a')]||null:null,'include':_0x13ac83[_0x8fda('0x17')]?_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1b')]?_[_0x8fda('0x1c')](_0x13ac83[_0x8fda('0x17')][_0x8fda('0x1b')],function(_0x2dc5ca){return{'model':db[_0x2dc5ca[_0x8fda('0x1d')]],'as':_0x2dc5ca['as'],'attributes':_0x2dc5ca[_0x8fda('0x1e')],'include':_0x2dc5ca[_0x8fda('0x1b')]?_['map'](_0x2dc5ca['include'],function(_0x42f847){return{'model':db[_0x42f847[_0x8fda('0x1d')]],'as':_0x42f847['as'],'attributes':_0x42f847['attributes'],'include':_0x42f847[_0x8fda('0x1b')]?_[_0x8fda('0x1c')](_0x42f847['include'],function(_0x3ea496){return{'model':db[_0x3ea496[_0x8fda('0x1d')]],'as':_0x3ea496['as'],'attributes':_0x3ea496[_0x8fda('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fda('0x9')](function(_0x1e76e1){logger['info'](_0x8fda('0x15'),_0x13ac83);logger[_0x8fda('0xd')](_0x8fda('0x15'),_0x13ac83,JSON[_0x8fda('0xf')](_0x1e76e1));_0x902db0(_0x1e76e1);})[_0x8fda('0x14')](function(_0x281041){logger[_0x8fda('0x10')]('GetTrunk',_0x281041['message'],_0x13ac83);_0x5712e5(_0x43e9eb[_0x8fda('0x10')](0x1f4,_0x281041['message']));});});};exports['ShowTrunk']=function(_0x355703){var _0x5f10a7=this;return new Promise(function(_0x11249c,_0x9dce4f){return db[_0x8fda('0x16')]['find']({'raw':_0x355703[_0x8fda('0x17')]?_0x355703[_0x8fda('0x17')][_0x8fda('0x18')]===undefined?!![]:![]:!![],'where':_0x355703['options']?_0x355703[_0x8fda('0x17')][_0x8fda('0x19')]||null:null,'attributes':_0x355703[_0x8fda('0x17')]?_0x355703['options']['attributes']||null:null,'include':_0x355703[_0x8fda('0x17')]?_0x355703['options'][_0x8fda('0x1b')]?_['map'](_0x355703['options'][_0x8fda('0x1b')],function(_0x19a2f5){return{'model':db[_0x19a2f5[_0x8fda('0x1d')]],'as':_0x19a2f5['as'],'attributes':_0x19a2f5[_0x8fda('0x1e')],'include':_0x19a2f5['include']?_['map'](_0x19a2f5[_0x8fda('0x1b')],function(_0x52e853){return{'model':db[_0x52e853['model']],'as':_0x52e853['as'],'attributes':_0x52e853['attributes'],'include':_0x52e853['include']?_[_0x8fda('0x1c')](_0x52e853['include'],function(_0x40c401){return{'model':db[_0x40c401[_0x8fda('0x1d')]],'as':_0x40c401['as'],'attributes':_0x40c401['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fda('0x9')](function(_0x5739d7){logger[_0x8fda('0xa')](_0x8fda('0x1f'),_0x355703);logger[_0x8fda('0xd')](_0x8fda('0x1f'),_0x355703,JSON['stringify'](_0x5739d7));_0x11249c(_0x5739d7);})[_0x8fda('0x14')](function(_0x470d34){logger['error'](_0x8fda('0x1f'),_0x470d34[_0x8fda('0x12')],_0x355703);_0x9dce4f(_0x5f10a7['error'](0x1f4,_0x470d34[_0x8fda('0x12')]));});});}; \ No newline at end of file +var _0x84e0=['result','catch','GetTrunk','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2a98e3,_0x488997){var _0x370a71=function(_0x3b71cb){while(--_0x3b71cb){_0x2a98e3['push'](_0x2a98e3['shift']());}};_0x370a71(++_0x488997);}(_0x84e0,0x104));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x084e('0x0'));var util=require(_0x084e('0x1'));var moment=require(_0x084e('0x2'));var BPromise=require(_0x084e('0x3'));var rs=require(_0x084e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x084e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x084e('0x6'))(_0x084e('0x7'));var config=require(_0x084e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x084e('0x9')][_0x084e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x433c71,_0x15ab6d,_0x681b79){return new BPromise(function(_0x285c1f,_0x32b544){return client['request'](_0x433c71,_0x681b79)[_0x084e('0xb')](function(_0x3006ea){logger[_0x084e('0xc')](_0x084e('0xd'),_0x15ab6d,_0x084e('0xe'));logger[_0x084e('0xf')](_0x084e('0x10'),_0x15ab6d,_0x084e('0xe'),JSON['stringify'](_0x3006ea));if(_0x3006ea[_0x084e('0x11')]){if(_0x3006ea[_0x084e('0x11')][_0x084e('0x12')]===0x1f4){logger[_0x084e('0x11')](_0x084e('0xd'),_0x15ab6d,_0x3006ea[_0x084e('0x11')][_0x084e('0x13')]);return _0x32b544(_0x3006ea['error'][_0x084e('0x13')]);}logger[_0x084e('0x11')](_0x084e('0xd'),_0x15ab6d,_0x3006ea[_0x084e('0x11')]['message']);return _0x285c1f(_0x3006ea[_0x084e('0x11')][_0x084e('0x13')]);}else{logger['info'](_0x084e('0xd'),_0x15ab6d,_0x084e('0xe'));_0x285c1f(_0x3006ea[_0x084e('0x14')][_0x084e('0x13')]);}})[_0x084e('0x15')](function(_0x5a08e6){logger[_0x084e('0x11')]('Trunk,\x20%s,\x20%s',_0x15ab6d,_0x5a08e6);_0x32b544(_0x5a08e6);});});}exports[_0x084e('0x16')]=function(_0x4988f5){var _0x1eeb60=this;return new Promise(function(_0x2128d6,_0x1be2af){return db['Trunk'][_0x084e('0x17')]({'raw':_0x4988f5['options']?_0x4988f5[_0x084e('0x18')][_0x084e('0x19')]===undefined?!![]:![]:!![],'where':_0x4988f5[_0x084e('0x18')]?_0x4988f5[_0x084e('0x18')]['where']||null:null,'attributes':_0x4988f5[_0x084e('0x18')]?_0x4988f5[_0x084e('0x18')][_0x084e('0x1a')]||null:null,'limit':_0x4988f5[_0x084e('0x18')]?_0x4988f5[_0x084e('0x18')][_0x084e('0x1b')]||null:null,'include':_0x4988f5[_0x084e('0x18')]?_0x4988f5['options']['include']?_['map'](_0x4988f5[_0x084e('0x18')][_0x084e('0x1c')],function(_0x204fe4){return{'model':db[_0x204fe4[_0x084e('0x1d')]],'as':_0x204fe4['as'],'attributes':_0x204fe4[_0x084e('0x1a')],'include':_0x204fe4[_0x084e('0x1c')]?_[_0x084e('0x1e')](_0x204fe4['include'],function(_0xef7df2){return{'model':db[_0xef7df2['model']],'as':_0xef7df2['as'],'attributes':_0xef7df2[_0x084e('0x1a')],'include':_0xef7df2['include']?_['map'](_0xef7df2[_0x084e('0x1c')],function(_0x445501){return{'model':db[_0x445501[_0x084e('0x1d')]],'as':_0x445501['as'],'attributes':_0x445501[_0x084e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fabbd){logger[_0x084e('0xc')]('GetTrunk',_0x4988f5);logger[_0x084e('0xf')]('GetTrunk',_0x4988f5,JSON[_0x084e('0x1f')](_0x3fabbd));_0x2128d6(_0x3fabbd);})[_0x084e('0x15')](function(_0x2607b6){logger[_0x084e('0x11')]('GetTrunk',_0x2607b6[_0x084e('0x13')],_0x4988f5);_0x1be2af(_0x1eeb60[_0x084e('0x11')](0x1f4,_0x2607b6[_0x084e('0x13')]));});});};exports[_0x084e('0x20')]=function(_0x84dec6){var _0x4277a1=this;return new Promise(function(_0x49cb8b,_0x4aed16){return db['Trunk'][_0x084e('0x21')]({'raw':_0x84dec6[_0x084e('0x18')]?_0x84dec6[_0x084e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x84dec6[_0x084e('0x18')]?_0x84dec6['options'][_0x084e('0x22')]||null:null,'attributes':_0x84dec6['options']?_0x84dec6['options'][_0x084e('0x1a')]||null:null,'include':_0x84dec6[_0x084e('0x18')]?_0x84dec6[_0x084e('0x18')][_0x084e('0x1c')]?_[_0x084e('0x1e')](_0x84dec6[_0x084e('0x18')][_0x084e('0x1c')],function(_0xbe0e6d){return{'model':db[_0xbe0e6d[_0x084e('0x1d')]],'as':_0xbe0e6d['as'],'attributes':_0xbe0e6d[_0x084e('0x1a')],'include':_0xbe0e6d['include']?_[_0x084e('0x1e')](_0xbe0e6d[_0x084e('0x1c')],function(_0x5b73e1){return{'model':db[_0x5b73e1[_0x084e('0x1d')]],'as':_0x5b73e1['as'],'attributes':_0x5b73e1[_0x084e('0x1a')],'include':_0x5b73e1[_0x084e('0x1c')]?_['map'](_0x5b73e1['include'],function(_0x35b1a2){return{'model':db[_0x35b1a2[_0x084e('0x1d')]],'as':_0x35b1a2['as'],'attributes':_0x35b1a2[_0x084e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x084e('0xb')](function(_0x561077){logger['info'](_0x084e('0x20'),_0x84dec6);logger[_0x084e('0xf')](_0x084e('0x20'),_0x84dec6,JSON[_0x084e('0x1f')](_0x561077));_0x49cb8b(_0x561077);})[_0x084e('0x15')](function(_0x4fc59a){logger[_0x084e('0x11')](_0x084e('0x20'),_0x4fc59a[_0x084e('0x13')],_0x84dec6);_0x4aed16(_0x4277a1[_0x084e('0x11')](0x1f4,_0x4fc59a['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index edf0b3c..2e7ad73 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50c9=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router'];(function(_0x4d2877,_0x311683){var _0xfe1bb2=function(_0x5f4183){while(--_0x5f4183){_0x4d2877['push'](_0x4d2877['shift']());}};_0xfe1bb2(++_0x311683);}(_0x50c9,0x83));var _0x950c=function(_0x540320,_0x55ac12){_0x540320=_0x540320-0x0;var _0x105bdb=_0x50c9[_0x540320];return _0x105bdb;};'use strict';var express=require(_0x950c('0x0'));var router=express[_0x950c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x950c('0x2'));router[_0x950c('0x3')]('/:id',auth[_0x950c('0x4')](),controller[_0x950c('0x5')]);module[_0x950c('0x6')]=router; \ No newline at end of file +var _0xb28e=['express','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update','exports'];(function(_0x3eb455,_0x312b59){var _0x106275=function(_0xa63437){while(--_0xa63437){_0x3eb455['push'](_0x3eb455['shift']());}};_0x106275(++_0x312b59);}(_0xb28e,0x12d));var _0xeb28=function(_0x3a9b74,_0x442c48){_0x3a9b74=_0x3a9b74-0x0;var _0x570a9d=_0xb28e[_0x3a9b74];return _0x570a9d;};'use strict';var express=require(_0xeb28('0x0'));var router=express['Router']();var auth=require(_0xeb28('0x1'));var controller=require(_0xeb28('0x2'));router['put'](_0xeb28('0x3'),auth[_0xeb28('0x4')](),controller[_0xeb28('0x5')]);module[_0xeb28('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index c41ef3b..9364d68 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b69=['INTEGER','warning','info','debug','ENUM','BOOLEAN','DATE'];(function(_0x36097f,_0x36e587){var _0x2d9106=function(_0x10d6c9){while(--_0x10d6c9){_0x36097f['push'](_0x36097f['shift']());}};_0x2d9106(++_0x36e587);}(_0x9b69,0x94));var _0x99b6=function(_0xce3849,_0x1ff4db){_0xce3849=_0xce3849-0x0;var _0x1c0fa2=_0x9b69[_0xce3849];return _0x1c0fa2;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x99b6('0x0'),_0x99b6('0x1'),_0x99b6('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x99b6('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x99b6('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x99b6('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x99b6('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x2028=['TEXT','DATE','INTEGER','UserId','sequelize','exports','ENUM','error','BOOLEAN'];(function(_0x3eb14f,_0x1e1bb0){var _0x25bbdd=function(_0x21f214){while(--_0x21f214){_0x3eb14f['push'](_0x3eb14f['shift']());}};_0x25bbdd(++_0x1e1bb0);}(_0x2028,0x187));var _0x8202=function(_0xc8e67,_0x4db006){_0xc8e67=_0xc8e67-0x0;var _0x98d9e=_0x2028[_0xc8e67];return _0x98d9e;};'use strict';var Sequelize=require(_0x8202('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning','info','debug'];module[_0x8202('0x1')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8202('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8202('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8202('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8202('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8202('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8202('0x7')],'unique':_0x8202('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 826c550..dd59a5b 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cd6=['redis','defaults','status','json','update','then','sendStatus','stack','name','send','user','admin','params','Invalid\x20user\x20setting\x20id','catch','lodash','ioredis','api','../../config/environment','socket.io-emitter'];(function(_0x4ebf6a,_0xfd0a40){var _0x1e7a72=function(_0x5978e8){while(--_0x5978e8){_0x4ebf6a['push'](_0x4ebf6a['shift']());}};_0x1e7a72(++_0xfd0a40);}(_0x0cd6,0x113));var _0x60cd=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x0cd6[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x60cd('0x0'));var Redis=require(_0x60cd('0x1'));var logger=require('../../config/logger')(_0x60cd('0x2'));var config=require(_0x60cd('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x60cd('0x4'))(new Redis(config[_0x60cd('0x5')]));require('./user-setting.socket')['register'](socket);config[_0x60cd('0x5')]=_[_0x60cd('0x6')](config[_0x60cd('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x381044,_0x4b66cd){_0x4b66cd=_0x4b66cd||0xc8;return function(_0x1249cb){if(_0x1249cb){return _0x381044[_0x60cd('0x7')](_0x4b66cd)[_0x60cd('0x8')](_0x1249cb);}};}function saveUpdates(_0xad38c6){return function(_0x260260){if(_0x260260){return _0x260260[_0x60cd('0x9')](_0xad38c6)[_0x60cd('0xa')](function(_0x316912){return _0x316912;});}return null;};}function handleEntityNotFound(_0x374baa){return function(_0x5d82b7){if(!_0x5d82b7){_0x374baa[_0x60cd('0xb')](0x194);}return _0x5d82b7;};}function handleError(_0x214e75,_0x516c6a){_0x516c6a=_0x516c6a||0x1f4;return function(_0xc240d8){logger['error'](_0xc240d8[_0x60cd('0xc')]);if(_0xc240d8[_0x60cd('0xd')]){delete _0xc240d8['name'];}_0x214e75[_0x60cd('0x7')](_0x516c6a)[_0x60cd('0xe')](_0xc240d8);};}exports[_0x60cd('0x9')]=function(_0x59810e,_0x14076c){if(_0x59810e[_0x60cd('0xf')]['role']!==_0x60cd('0x10'))throw new Error('Unauthorized');if(isNaN(Number(_0x59810e[_0x60cd('0x11')]['id'])))throw new Error(_0x60cd('0x12'));return db['UserSetting']['find']({'where':{'id':_0x59810e[_0x60cd('0x11')]['id']}})[_0x60cd('0xa')](handleEntityNotFound(_0x14076c,null))[_0x60cd('0xa')](saveUpdates(_0x59810e['body'],null))[_0x60cd('0xa')](respondWithResult(_0x14076c,null))[_0x60cd('0x13')](handleError(_0x14076c,null));}; \ No newline at end of file +var _0x984b=['user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','params','body','catch','api','../../config/environment','../../mysqldb','./user-setting.socket','register','redis','localhost','json','update','then','sendStatus','error','stack','name','send'];(function(_0x738bda,_0x1935d5){var _0x3f469d=function(_0x105da3){while(--_0x105da3){_0x738bda['push'](_0x738bda['shift']());}};_0x3f469d(++_0x1935d5);}(_0x984b,0xee));var _0xb984=function(_0xc9c131,_0x31cfc9){_0xc9c131=_0xc9c131-0x0;var _0x3c0c70=_0x984b[_0xc9c131];return _0x3c0c70;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require('../../config/logger')(_0xb984('0x0'));var config=require(_0xb984('0x1'));var db=require(_0xb984('0x2'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb984('0x3'))[_0xb984('0x4')](socket);config['redis']=_['defaults'](config[_0xb984('0x5')],{'host':_0xb984('0x6'),'port':0x18eb});function respondWithResult(_0x5a605a,_0x7405cd){_0x7405cd=_0x7405cd||0xc8;return function(_0x1a00d6){if(_0x1a00d6){return _0x5a605a['status'](_0x7405cd)[_0xb984('0x7')](_0x1a00d6);}};}function saveUpdates(_0x4e6b9a){return function(_0x7624a2){if(_0x7624a2){return _0x7624a2[_0xb984('0x8')](_0x4e6b9a)[_0xb984('0x9')](function(_0x2f4e77){return _0x2f4e77;});}return null;};}function handleEntityNotFound(_0xf66bad){return function(_0x382f2b){if(!_0x382f2b){_0xf66bad[_0xb984('0xa')](0x194);}return _0x382f2b;};}function handleError(_0xfca315,_0x16d46f){_0x16d46f=_0x16d46f||0x1f4;return function(_0x3c3e8a){logger[_0xb984('0xb')](_0x3c3e8a[_0xb984('0xc')]);if(_0x3c3e8a['name']){delete _0x3c3e8a[_0xb984('0xd')];}_0xfca315['status'](_0x16d46f)[_0xb984('0xe')](_0x3c3e8a);};}exports[_0xb984('0x8')]=function(_0x594a5e,_0x2caf88){if(_0x594a5e[_0xb984('0xf')]['role']!==_0xb984('0x10'))throw new Error(_0xb984('0x11'));if(isNaN(Number(_0x594a5e['params']['id'])))throw new Error(_0xb984('0x12'));return db[_0xb984('0x13')]['find']({'where':{'id':_0x594a5e[_0xb984('0x14')]['id']}})['then'](handleEntityNotFound(_0x2caf88,null))[_0xb984('0x9')](saveUpdates(_0x594a5e[_0xb984('0x15')],null))[_0xb984('0x9')](respondWithResult(_0x2caf88,null))[_0xb984('0x16')](handleError(_0x2caf88,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index aa9e69a..2213c4f 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc11=['hook','events','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x3c78f1,_0x352f1a){var _0x518acc=function(_0x3ca12f){while(--_0x3ca12f){_0x3c78f1['push'](_0x3c78f1['shift']());}};_0x518acc(++_0x352f1a);}(_0xdc11,0x191));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1dc1('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x1dc1('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1dc1('0x2')](0x0);var events={'afterCreate':_0x1dc1('0x3'),'afterUpdate':_0x1dc1('0x4'),'afterDestroy':_0x1dc1('0x5')};function emitEvent(_0x361520){return function(_0x17b094,_0x474d7b,_0x295d57){UserSettingEvents[_0x1dc1('0x6')](_0x361520+':'+_0x17b094['id'],_0x17b094);UserSettingEvents[_0x1dc1('0x6')](_0x361520,_0x17b094);_0x295d57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1dc1('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xd760=['remove','emit','events','../../mysqldb','save','update'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xd760,0x68));var _0x0d76=function(_0x2acdfe,_0x102248){_0x2acdfe=_0x2acdfe-0x0;var _0x4db243=_0xd760[_0x2acdfe];return _0x4db243;};'use strict';var EventEmitter=require(_0x0d76('0x0'));var UserSetting=require(_0x0d76('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d76('0x2'),'afterUpdate':_0x0d76('0x3'),'afterDestroy':_0x0d76('0x4')};function emitEvent(_0x58f115){return function(_0x202c30,_0x14239a,_0x392436){UserSettingEvents[_0x0d76('0x5')](_0x58f115+':'+_0x202c30['id'],_0x202c30);UserSettingEvents[_0x0d76('0x5')](_0x58f115,_0x202c30);_0x392436(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 90f33bb..f359122 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e81=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x2bf8f2,_0x27c758){var _0x1ba2fa=function(_0x1439f8){while(--_0x1439f8){_0x2bf8f2['push'](_0x2bf8f2['shift']());}};_0x1ba2fa(++_0x27c758);}(_0x4e81,0x1bc));var _0x14e8=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x4e81[_0x3a73bc];return _0x32891b;};'use strict';var attributes=require(_0x14e8('0x0'));module[_0x14e8('0x1')]=function(_0x354aac){return _0x354aac['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2184fc){if(!_0x2184fc[_0x14e8('0x2')])_0x2184fc[_0x14e8('0x3')]=null;else if(_0x2184fc[_0x14e8('0x3')]===null)_0x2184fc[_0x14e8('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x9c2c=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x465e1e,_0x302fc1){var _0x4f9b22=function(_0x3e9501){while(--_0x3e9501){_0x465e1e['push'](_0x465e1e['shift']());}};_0x4f9b22(++_0x302fc1);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xc9c2('0x0'));module[_0xc9c2('0x1')]=function(_0x4ac695){return _0x4ac695['define']('UserSetting',attributes,{'tableName':_0xc9c2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ac3bb){if(!_0x4ac3bb[_0xc9c2('0x3')])_0x4ac3bb[_0xc9c2('0x4')]=null;else if(_0x4ac3bb['clientSideLoggingEnabledSince']===null)_0x4ac3bb['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7b99ffc..c2f338b 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4628=['emit','register','length','user-setting:','save','user-setting:update'];(function(_0x491d44,_0x5918ea){var _0x157fb1=function(_0x546768){while(--_0x546768){_0x491d44['push'](_0x491d44['shift']());}};_0x157fb1(++_0x5918ea);}(_0x4628,0x70));var _0x8462=function(_0xc8c103,_0x285701){_0xc8c103=_0xc8c103-0x0;var _0x5c72ef=_0x4628[_0xc8c103];return _0x5c72ef;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x8462('0x0'),'remove','update'];function createListener(_0x46dc23,_0x4fbbfb){return function(_0x3c1852){_0x4fbbfb['emit'](_0x46dc23,_0x3c1852);if(_0x46dc23===_0x8462('0x1')){_0x4fbbfb[_0x8462('0x2')]('user-setting:update:user-'+_0x3c1852['UserId'],_0x3c1852);}};}exports[_0x8462('0x3')]=function(_0x1864b5){for(var _0xc4c73a=0x0,_0x36a09d=events[_0x8462('0x4')];_0xc4c73a<_0x36a09d;_0xc4c73a++){var _0x578718=events[_0xc4c73a];var _0x1d4de9=createListener(_0x8462('0x5')+_0x578718,_0x1864b5);UserSettingEvents['on'](_0x578718,_0x1d4de9);}}; \ No newline at end of file +var _0xc179=['UserId','register','length','user-setting:','save','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xc179,0x7c));var _0x9c17=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xc179[_0x2f5a22];return _0x326b70;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x9c17('0x0'),_0x9c17('0x1'),_0x9c17('0x2')];function createListener(_0x24fd83,_0x56d16c){return function(_0x32e64e){_0x56d16c[_0x9c17('0x3')](_0x24fd83,_0x32e64e);if(_0x24fd83===_0x9c17('0x4')){_0x56d16c['emit'](_0x9c17('0x5')+_0x32e64e[_0x9c17('0x6')],_0x32e64e);}};}exports[_0x9c17('0x7')]=function(_0x1a773d){for(var _0x2130d7=0x0,_0x30e404=events[_0x9c17('0x8')];_0x2130d7<_0x30e404;_0x2130d7++){var _0x918ff3=events[_0x2130d7];var _0x4ed841=createListener(_0x9c17('0x9')+_0x918ff3,_0x1a773d);UserSettingEvents['on'](_0x918ff3,_0x4ed841);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 02c9ce9..7741eae 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 _0xbc77=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','single','file','addAvatar','login','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','connect-timeout'];(function(_0x311a18,_0x267a78){var _0x209237=function(_0x1e14f1){while(--_0x1e14f1){_0x311a18['push'](_0x311a18['shift']());}};_0x209237(++_0x267a78);}(_0xbc77,0x15d));var _0x7bc7=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbc77[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x7bc7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7bc7('0x1'));var express=require('express');var router=express[_0x7bc7('0x2')]();var fs_extra=require(_0x7bc7('0x3'));var auth=require(_0x7bc7('0x4'));var interaction=require(_0x7bc7('0x5'));var config=require('../../config/environment');var controller=require(_0x7bc7('0x6'));router[_0x7bc7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bc7('0x7')](_0x7bc7('0x8'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xa')]);router[_0x7bc7('0x7')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xc')]);router['get'](_0x7bc7('0xd'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xe')]);router['get'](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x10')]);router[_0x7bc7('0x7')](_0x7bc7('0x11'),controller[_0x7bc7('0x12')]);router['get'](_0x7bc7('0x13'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x14')]);router[_0x7bc7('0x7')](_0x7bc7('0x15'),auth['isAuthenticated'](),controller[_0x7bc7('0x16')]);router[_0x7bc7('0x7')](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x18')]);router[_0x7bc7('0x7')](_0x7bc7('0x19'),auth['isAuthenticated'](),controller[_0x7bc7('0x1a')]);router[_0x7bc7('0x7')](_0x7bc7('0x1b'),auth['isAuthenticated'](),controller[_0x7bc7('0x1c')]);router[_0x7bc7('0x7')](_0x7bc7('0x1d'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x1e')]);router['get'](_0x7bc7('0x1f'),auth['isAuthenticated'](),controller[_0x7bc7('0x20')]);router[_0x7bc7('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x7bc7('0x21')]);router[_0x7bc7('0x7')](_0x7bc7('0x22'),auth[_0x7bc7('0x9')](),controller['getOpenchannelInteractions']);router[_0x7bc7('0x7')](_0x7bc7('0x23'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x24')]);router[_0x7bc7('0x7')](_0x7bc7('0x25'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x26')]);router[_0x7bc7('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x7bc7('0x27')]);router['get'](_0x7bc7('0x28'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x29')]);router['get'](_0x7bc7('0x2a'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2b')]);router[_0x7bc7('0x7')](_0x7bc7('0x2c'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2d')]);router[_0x7bc7('0x7')](_0x7bc7('0x2e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x2f')]);router[_0x7bc7('0x7')](_0x7bc7('0x30'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x31')]);router[_0x7bc7('0x7')](_0x7bc7('0x32'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x7bc7('0x7')](_0x7bc7('0x33'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x7bc7('0x7')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x35')]);router[_0x7bc7('0x7')]('/:id/sms_accounts',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x36')]);router[_0x7bc7('0x7')]('/:id/chat_websites',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x37')]);router['get'](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x39')]);router[_0x7bc7('0x7')](_0x7bc7('0x3a'),auth[_0x7bc7('0x9')](),controller['getScheduledCalls']);router[_0x7bc7('0x7')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x3c')]);router['post'](_0x7bc7('0x15'),auth['isAuthenticated'](),controller[_0x7bc7('0x3d')]);router['post']('/',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x3e')]);router[_0x7bc7('0x3f')](_0x7bc7('0x40'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x41')]);router[_0x7bc7('0x3f')](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x42')]);var upload=multer({'storage':multer[_0x7bc7('0x43')]({'destination':function(_0xf0b5b2,_0xba1d88,_0x18190a){_0x18190a(null,path[_0x7bc7('0x44')](config[_0x7bc7('0x45')],_0x7bc7('0x46')));},'filename':function(_0x52684f,_0x587627,_0x3a4862){_0x3a4862(null,util['format'](_0x7bc7('0x47'),Date[_0x7bc7('0x48')](),_0x587627['originalname']));}})});router[_0x7bc7('0x3f')](_0x7bc7('0x11'),upload[_0x7bc7('0x49')](_0x7bc7('0x4a')),controller[_0x7bc7('0x4b')]);router[_0x7bc7('0x3f')]('/:id/login',auth['isAuthenticated'](),controller[_0x7bc7('0x4c')]);router[_0x7bc7('0x3f')]('/:id/logout',auth[_0x7bc7('0x9')](),controller['logout']);router[_0x7bc7('0x3f')]('/:id/pause',auth['isAuthenticated'](),controller[_0x7bc7('0x4d')]);router[_0x7bc7('0x3f')](_0x7bc7('0x4e'),auth['isAuthenticated'](),controller[_0x7bc7('0x4f')]);router[_0x7bc7('0x3f')](_0x7bc7('0x2a'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x50')]);router[_0x7bc7('0x3f')]('/:id/chat_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x51')]);router[_0x7bc7('0x3f')](_0x7bc7('0x52'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x53')]);router[_0x7bc7('0x3f')](_0x7bc7('0x54'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x55')]);router[_0x7bc7('0x3f')](_0x7bc7('0x56'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x57')]);router[_0x7bc7('0x3f')](_0x7bc7('0x58'),auth[_0x7bc7('0x9')](),controller['addOpenchannelInteractions']);router[_0x7bc7('0x3f')]('/:id/whatsapp_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x59')]);router[_0x7bc7('0x3f')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7bc7('0x5a')]);router[_0x7bc7('0x3f')]('/:id/mail_accounts',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5b')]);router[_0x7bc7('0x3f')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5c')]);router['post'](_0x7bc7('0x5d'),auth[_0x7bc7('0x9')](),controller['addSmsAccounts']);router[_0x7bc7('0x3f')](_0x7bc7('0x5e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x5f')]);router[_0x7bc7('0x3f')](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x60')]);router[_0x7bc7('0x3f')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x61')]);router[_0x7bc7('0x62')](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x63')]);router[_0x7bc7('0x62')](_0x7bc7('0x64'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x65')]);router['delete'](_0x7bc7('0x17'),auth[_0x7bc7('0x9')](),controller['removeQueues']);router[_0x7bc7('0x66')]('/:id/teams',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x67')]);router[_0x7bc7('0x66')](_0x7bc7('0xf'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x68')]);router['delete'](_0x7bc7('0x69'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6a')]);router[_0x7bc7('0x66')](_0x7bc7('0x52'),auth[_0x7bc7('0x9')](),controller['removeMailInteractions']);router[_0x7bc7('0x66')](_0x7bc7('0x54'),auth[_0x7bc7('0x9')](),controller['removeFaxInteractions']);router[_0x7bc7('0x66')](_0x7bc7('0x56'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6b')]);router[_0x7bc7('0x66')](_0x7bc7('0x58'),auth[_0x7bc7('0x9')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6c')]);router[_0x7bc7('0x66')](_0x7bc7('0x32'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6d')]);router['delete'](_0x7bc7('0x33'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6e')]);router[_0x7bc7('0x66')](_0x7bc7('0x34'),auth[_0x7bc7('0x9')](),controller['removeOpenchannelAccounts']);router[_0x7bc7('0x66')](_0x7bc7('0x5d'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x6f')]);router[_0x7bc7('0x66')](_0x7bc7('0x5e'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x70')]);router[_0x7bc7('0x66')](_0x7bc7('0x38'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x71')]);router[_0x7bc7('0x66')](_0x7bc7('0x3b'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x72')]);router['post'](_0x7bc7('0x73'),auth['isAuthenticated'](),controller[_0x7bc7('0x74')]);module['exports']=router; \ No newline at end of file +var _0x1698=['removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','%s-%s','now','originalname','file','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','update','/:id/password'];(function(_0x35f832,_0x1cb0a1){var _0x2f98fe=function(_0x53427f){while(--_0x53427f){_0x35f832['push'](_0x35f832['shift']());}};_0x2f98fe(++_0x1cb0a1);}(_0x1698,0x1c4));var _0x8169=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x1698[_0x10791d];return _0x1b4f9c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8169('0x0'));var express=require(_0x8169('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8169('0x2'));var interaction=require(_0x8169('0x3'));var config=require('../../config/environment');var controller=require(_0x8169('0x4'));router['get']('/',auth[_0x8169('0x5')](),controller[_0x8169('0x6')]);router[_0x8169('0x7')](_0x8169('0x8'),auth[_0x8169('0x5')](),controller[_0x8169('0x9')]);router[_0x8169('0x7')]('/whoami',auth[_0x8169('0x5')](),controller['whoami']);router[_0x8169('0x7')](_0x8169('0xa'),auth['isAuthenticated'](),controller[_0x8169('0xb')]);router[_0x8169('0x7')](_0x8169('0xc'),auth['isAuthenticated'](),controller[_0x8169('0xd')]);router[_0x8169('0x7')](_0x8169('0xe'),controller[_0x8169('0xf')]);router['get'](_0x8169('0x10'),auth[_0x8169('0x5')](),controller['getOpenTabs']);router['get'](_0x8169('0x11'),auth['isAuthenticated'](),controller[_0x8169('0x12')]);router[_0x8169('0x7')](_0x8169('0x13'),auth[_0x8169('0x5')](),controller[_0x8169('0x14')]);router[_0x8169('0x7')](_0x8169('0x15'),auth[_0x8169('0x5')](),controller[_0x8169('0x16')]);router['get'](_0x8169('0x17'),auth[_0x8169('0x5')](),controller[_0x8169('0x18')]);router['get']('/:id/recordings',auth[_0x8169('0x5')](),controller[_0x8169('0x19')]);router[_0x8169('0x7')](_0x8169('0x1a'),auth[_0x8169('0x5')](),controller[_0x8169('0x1b')]);router[_0x8169('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x8169('0x7')](_0x8169('0x1c'),auth[_0x8169('0x5')](),controller[_0x8169('0x1d')]);router[_0x8169('0x7')](_0x8169('0x1e'),auth[_0x8169('0x5')](),controller[_0x8169('0x1f')]);router[_0x8169('0x7')](_0x8169('0x20'),auth[_0x8169('0x5')](),controller[_0x8169('0x21')]);router[_0x8169('0x7')](_0x8169('0x22'),auth['isAuthenticated'](),controller[_0x8169('0x23')]);router[_0x8169('0x7')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x8169('0x24')]);router[_0x8169('0x7')](_0x8169('0x25'),auth[_0x8169('0x5')](),controller['getTeams']);router[_0x8169('0x7')](_0x8169('0x26'),auth[_0x8169('0x5')](),controller[_0x8169('0x27')]);router['get']('/:id/agents',auth[_0x8169('0x5')](),controller['getAgents']);router[_0x8169('0x7')](_0x8169('0x28'),auth[_0x8169('0x5')](),controller[_0x8169('0x29')]);router[_0x8169('0x7')](_0x8169('0x2a'),auth[_0x8169('0x5')](),controller[_0x8169('0x2b')]);router[_0x8169('0x7')]('/:id/mail_accounts',auth[_0x8169('0x5')](),controller[_0x8169('0x2c')]);router[_0x8169('0x7')](_0x8169('0x2d'),auth[_0x8169('0x5')](),controller[_0x8169('0x2e')]);router['get'](_0x8169('0x2f'),auth[_0x8169('0x5')](),controller[_0x8169('0x30')]);router[_0x8169('0x7')](_0x8169('0x31'),auth[_0x8169('0x5')](),controller[_0x8169('0x32')]);router[_0x8169('0x7')]('/:id/whatsapp_accounts',auth[_0x8169('0x5')](),controller[_0x8169('0x33')]);router[_0x8169('0x7')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x8169('0x34')]);router[_0x8169('0x7')](_0x8169('0x35'),auth[_0x8169('0x5')](),controller[_0x8169('0x36')]);router[_0x8169('0x37')](_0x8169('0x11'),auth['isAuthenticated'](),controller['addContacts']);router[_0x8169('0x37')]('/',auth['isAuthenticated'](),controller[_0x8169('0x38')]);router[_0x8169('0x37')](_0x8169('0x39'),auth[_0x8169('0x5')](),controller[_0x8169('0x3a')]);router[_0x8169('0x37')](_0x8169('0x13'),auth[_0x8169('0x5')](),controller[_0x8169('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1569b1,_0x52396c,_0x1ecfac){_0x1ecfac(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x2bd7bd,_0x20b370,_0x321ec2){_0x321ec2(null,util['format'](_0x8169('0x3c'),Date[_0x8169('0x3d')](),_0x20b370[_0x8169('0x3e')]));}})});router['post'](_0x8169('0xe'),upload['single'](_0x8169('0x3f')),controller['addAvatar']);router['post']('/:id/login',auth[_0x8169('0x5')](),controller[_0x8169('0x40')]);router[_0x8169('0x37')](_0x8169('0x41'),auth[_0x8169('0x5')](),controller[_0x8169('0x42')]);router[_0x8169('0x37')](_0x8169('0x43'),auth[_0x8169('0x5')](),controller['pause']);router[_0x8169('0x37')](_0x8169('0x44'),auth['isAuthenticated'](),controller[_0x8169('0x45')]);router[_0x8169('0x37')]('/:id/teams',auth[_0x8169('0x5')](),controller['addTeams']);router[_0x8169('0x37')](_0x8169('0x46'),auth[_0x8169('0x5')](),controller[_0x8169('0x47')]);router[_0x8169('0x37')](_0x8169('0x48'),auth[_0x8169('0x5')](),controller[_0x8169('0x49')]);router[_0x8169('0x37')](_0x8169('0x4a'),auth[_0x8169('0x5')](),controller[_0x8169('0x4b')]);router[_0x8169('0x37')](_0x8169('0x4c'),auth['isAuthenticated'](),controller[_0x8169('0x4d')]);router[_0x8169('0x37')](_0x8169('0x4e'),auth[_0x8169('0x5')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x8169('0x5')](),controller['addWhatsappInteractions']);router[_0x8169('0x37')](_0x8169('0x2a'),auth[_0x8169('0x5')](),controller['addFaxAccounts']);router[_0x8169('0x37')]('/:id/mail_accounts',auth[_0x8169('0x5')](),controller[_0x8169('0x4f')]);router[_0x8169('0x37')](_0x8169('0x2d'),auth[_0x8169('0x5')](),controller[_0x8169('0x50')]);router[_0x8169('0x37')](_0x8169('0x2f'),auth[_0x8169('0x5')](),controller[_0x8169('0x51')]);router[_0x8169('0x37')](_0x8169('0x31'),auth[_0x8169('0x5')](),controller[_0x8169('0x52')]);router[_0x8169('0x37')](_0x8169('0x53'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x8169('0x37')](_0x8169('0x35'),auth[_0x8169('0x5')](),controller[_0x8169('0x54')]);router[_0x8169('0x55')](_0x8169('0xc'),auth[_0x8169('0x5')](),controller[_0x8169('0x56')]);router['put'](_0x8169('0x57'),auth[_0x8169('0x5')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x8169('0x5')](),controller[_0x8169('0x58')]);router[_0x8169('0x59')](_0x8169('0x25'),auth[_0x8169('0x5')](),controller[_0x8169('0x5a')]);router[_0x8169('0x59')](_0x8169('0xc'),auth['isAuthenticated'](),controller[_0x8169('0x5b')]);router[_0x8169('0x59')](_0x8169('0x46'),auth[_0x8169('0x5')](),controller[_0x8169('0x5c')]);router[_0x8169('0x59')](_0x8169('0x48'),auth[_0x8169('0x5')](),controller[_0x8169('0x5d')]);router[_0x8169('0x59')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x8169('0x5e')]);router[_0x8169('0x59')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x8169('0x5f')]);router[_0x8169('0x59')](_0x8169('0x4e'),auth[_0x8169('0x5')](),controller[_0x8169('0x60')]);router[_0x8169('0x59')](_0x8169('0x61'),auth['isAuthenticated'](),controller[_0x8169('0x62')]);router[_0x8169('0x59')]('/:id/fax_accounts',auth[_0x8169('0x5')](),controller[_0x8169('0x63')]);router[_0x8169('0x59')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x8169('0x59')](_0x8169('0x2d'),auth['isAuthenticated'](),controller[_0x8169('0x64')]);router[_0x8169('0x59')]('/:id/sms_accounts',auth[_0x8169('0x5')](),controller[_0x8169('0x65')]);router[_0x8169('0x59')]('/:id/chat_websites',auth[_0x8169('0x5')](),controller[_0x8169('0x66')]);router[_0x8169('0x59')](_0x8169('0x53'),auth['isAuthenticated'](),controller[_0x8169('0x67')]);router['delete']('/:id/api_key',auth[_0x8169('0x5')](),controller[_0x8169('0x68')]);router[_0x8169('0x37')](_0x8169('0x69'),auth[_0x8169('0x5')](),controller[_0x8169('0x6a')]);module[_0x8169('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6a6188d..95e4f2d 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 _0x8321=['\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','telephone','local','accountcode','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','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','always','accept','refuse','uac','uas','passive','DATE','get','isArray','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format'];(function(_0x4b2578,_0x2af6eb){var _0x48a117=function(_0x14b377){while(--_0x14b377){_0x4b2578['push'](_0x4b2578['shift']());}};_0x48a117(++_0x2af6eb);}(_0x8321,0xa1));var _0x1832=function(_0x1373cf,_0x281910){_0x1373cf=_0x1373cf-0x0;var _0x58f3f2=_0x8321[_0x1373cf];return _0x58f3f2;};'use strict';var Sequelize=require(_0x1832('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x1832('0x1'));module[_0x1832('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1832('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ca4bb){this['setDataValue'](_0x1832('0x3'),_0x4ca4bb);this[_0x1832('0x4')](_0x1832('0x5'),_0x4ca4bb);},'comment':_0x1832('0x6')},'fullname':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'set':function(_0x3633b1){this[_0x1832('0x4')](_0x1832('0x8'),_0x3633b1);this['setDataValue'](_0x1832('0x9'),util[_0x1832('0xa')](_0x1832('0xb'),_0x3633b1,this[_0x1832('0xc')](_0x1832('0xd'))));}},'alias':{'type':Sequelize[_0x1832('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1832('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3d3075){if(_0x3d3075){this[_0x1832('0x4')]('email',_0x3d3075['toLowerCase']());}}},'role':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x10'),_0x1832('0x11'),'agent',_0x1832('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1832('0x7')],'defaultValue':_0x1832('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x1832('0xd'),'set':function(_0x10acc6){this[_0x1832('0x4')](_0x1832('0xd'),_0x10acc6);this[_0x1832('0x4')](_0x1832('0x14'),_0x10acc6);this['setDataValue'](_0x1832('0x9'),util[_0x1832('0xa')](_0x1832('0xb'),this[_0x1832('0xc')](_0x1832('0x8')),_0x10acc6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1832('0x7')]},'mobile':{'type':Sequelize[_0x1832('0x7')]},'address':{'type':Sequelize[_0x1832('0x7')]},'zipcode':{'type':Sequelize[_0x1832('0x7')]},'userpic':{'type':Sequelize[_0x1832('0x7')]},'city':{'type':Sequelize[_0x1832('0x7')]},'country':{'type':Sequelize[_0x1832('0x7')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1832('0x7')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1832('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1832('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x17')},'ipaddr':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x1832('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x18'),_0x1832('0x11'),_0x1832('0x19')),'allowNull':!![],'defaultValue':_0x1832('0x18')},'context':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x1a')},'callingpres':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x1b'),'ALLOWED_PASSED_SCREEN',_0x1832('0x1c'),'ALLOWED','PROHIB_NOT_SCREENED',_0x1832('0x1d'),'PROHIB_FAILED_SCREEN',_0x1832('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1832('0x1f'),'set':function(_0x496ece){this[_0x1832('0x4')](_0x1832('0x20'),_0x496ece?_0x496ece[_0x1832('0x21')](','):null);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x20'))?this[_0x1832('0xc')](_0x1832('0x20'))[_0x1832('0x22')](','):null;},'comment':_0x1832('0x23')},'dtmfmode':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x24'),'info',_0x1832('0x25'),_0x1832('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x1832('0x24')},'directmedia':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no',_0x1832('0x28'),_0x1832('0x29'),_0x1832('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':_0x1832('0x2b'),'set':function(_0xf30f98){this[_0x1832('0x4')](_0x1832('0x2c'),_0xf30f98?_0xf30f98[_0x1832('0x21')](','):null);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x2c'))?this[_0x1832('0xc')]('nat')[_0x1832('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1832('0x7')]},'pickupgroup':{'type':Sequelize[_0x1832('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x1832('0x7')]},'language':{'type':Sequelize[_0x1832('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1832('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1832('0x2d')},'allow':{'type':Sequelize[_0x1832('0x7')],'allowNull':![],'defaultValue':_0x1832('0x2e'),'set':function(_0x314218){this[_0x1832('0x4')](_0x1832('0x2f'),_0x314218?_0x314218[_0x1832('0x21')](';'):_0x1832('0x2e'));},'get':function(){return this[_0x1832('0xc')]('allow')?this['getDataValue']('allow')[_0x1832('0x22')](';'):null;},'comment':_0x1832('0x30')},'autoframing':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x549e62){this[_0x1832('0x4')](_0x1832('0x31'),_0x549e62?_0x549e62[_0x1832('0x21')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x1832('0x22')](','):null;},'comment':_0x1832('0x32')},'trustrpid':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no',_0x1832('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1832('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no',_0x1832('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x35'),_0x1832('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x1832('0x37'),_0x1832('0x38')),'allowNull':!![],'defaultValue':_0x1832('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':_0x1832('0x27')},'keepalive':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1832('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1832('0xf')]('active',_0x1832('0x39'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1832('0xf')](_0x1832('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1832('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1832('0x27'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1832('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x1832('0x3a')]},'passwordResetAt':{'type':Sequelize[_0x1832('0x3a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0,'set':function(_0x5ddfc9){this[_0x1832('0x4')]('showWebBar',_0x5ddfc9);var _0x167806=this[_0x1832('0x3b')]({'plain':!![]});switch(_0x5ddfc9){case 0x0:case 0x1:var _0x12daa9=_0x167806[_0x1832('0x20')]?_[_0x1832('0x3c')](_0x167806['transport'])?_0x167806[_0x1832('0x20')]['join']():_0x167806['transport']:'udp';if(_0x12daa9==='wss'){_0x12daa9='udp';}this['setDataValue'](_0x1832('0x20'),_0x12daa9);this[_0x1832('0x4')]('encryption','no');this['setDataValue'](_0x1832('0x3d'),null);this[_0x1832('0x4')]('force_avp',null);this[_0x1832('0x4')](_0x1832('0x3e'),null);this[_0x1832('0x4')]('dtlsenable',null);this[_0x1832('0x4')](_0x1832('0x3f'),null);this['setDataValue'](_0x1832('0x40'),null);this[_0x1832('0x4')](_0x1832('0x41'),null);this[_0x1832('0x4')](_0x1832('0x42'),null);this[_0x1832('0x4')](_0x1832('0x43'),'no');break;case 0x2:this['setDataValue'](_0x1832('0x20'),_0x1832('0x44'));this[_0x1832('0x4')]('encryption',_0x1832('0x27'));this[_0x1832('0x4')]('avpf',_0x1832('0x27'));this[_0x1832('0x4')](_0x1832('0x45'),'yes');this[_0x1832('0x4')](_0x1832('0x3e'),'yes');this[_0x1832('0x4')](_0x1832('0x46'),_0x1832('0x27'));this[_0x1832('0x4')](_0x1832('0x3f'),'no');this[_0x1832('0x4')]('dtlssetup',_0x1832('0x47'));this[_0x1832('0x4')]('dtlscertfile',_0x167806[_0x1832('0x41')]||_0x1832('0x48'));this[_0x1832('0x4')]('dtlsprivatekey',_0x167806[_0x1832('0x42')]||_0x1832('0x49'));this['setDataValue'](_0x1832('0x43'),_0x1832('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x1832('0x4a')],'set':function(_0x2d70b3){this[_0x1832('0x4')](_0x1832('0x4b'),_0x2d70b3?_0x2d70b3[_0x1832('0x21')](','):[]);},'get':function(){return this[_0x1832('0xc')](_0x1832('0x4b'))?_[_0x1832('0x4c')](this[_0x1832('0xc')]('permissions')[_0x1832('0x22')](','),function(_0x4dbebd){return parseInt(_0x4dbebd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1832('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1832('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1832('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x1832('0xc')](_0x1832('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x1832('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1ce663){if(typeof _0x1ce663===_0x1832('0x4e')){var _0x1a839a=_0x1ce663==='1'?!![]:_0x1ce663==='0'?![]:_0x1ce663===_0x1832('0x4f')?!![]:_0x1ce663===_0x1832('0x50')?![]:![];this[_0x1832('0x4')](_0x1832('0x51'),_0x1a839a);}else{this[_0x1832('0x4')](_0x1832('0x51'),_0x1ce663);}}},'blocked':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![],'set':function(_0x327fd7){this[_0x1832('0x4')](_0x1832('0x52'),_0x327fd7);if(_0x327fd7===!![]){this[_0x1832('0x4')]('blockedAt',moment());this[_0x1832('0x4')](_0x1832('0x53'),0x0);}else{this[_0x1832('0x4')](_0x1832('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1832('0x3a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1832('0x16')](0x5)[_0x1832('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1832('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1832('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1832('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x88e0=['VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','local','INTEGER','internal','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','friend','peer','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','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\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','originate','uas','fingerprint','certificate','actpass','update','TEXT','showWebBar','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','encryption','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map'];(function(_0x563fcb,_0x4b3250){var _0x5cd6ba=function(_0x11d236){while(--_0x11d236){_0x563fcb['push'](_0x563fcb['shift']());}};_0x5cd6ba(++_0x4b3250);}(_0x88e0,0xb6));var _0x088e=function(_0x361d41,_0x7f99ef){_0x361d41=_0x361d41-0x0;var _0x18a7ab=_0x88e0[_0x361d41];return _0x18a7ab;};'use strict';var Sequelize=require(_0x088e('0x0'));var moment=require(_0x088e('0x1'));var util=require('util');var _=require(_0x088e('0x2'));module[_0x088e('0x3')]={'name':{'type':Sequelize[_0x088e('0x4')],'allowNull':![],'unique':_0x088e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x36d466){this[_0x088e('0x6')](_0x088e('0x5'),_0x36d466);this[_0x088e('0x6')]('defaultuser',_0x36d466);},'comment':_0x088e('0x7')},'fullname':{'type':Sequelize[_0x088e('0x4')],'allowNull':![],'set':function(_0x10b9c6){this[_0x088e('0x6')](_0x088e('0x8'),_0x10b9c6);this[_0x088e('0x6')](_0x088e('0x9'),util['format'](_0x088e('0xa'),_0x10b9c6,this[_0x088e('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x088e('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x088e('0xc'),'validate':{'isEmail':!![]},'set':function(_0x510381){if(_0x510381){this[_0x088e('0x6')](_0x088e('0xc'),_0x510381['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x088e('0xd'),_0x088e('0xe'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x088e('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x088e('0x4')],'defaultValue':_0x088e('0xf')},'internal':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':![],'unique':_0x088e('0x11'),'set':function(_0x569d7c){this[_0x088e('0x6')]('internal',_0x569d7c);this[_0x088e('0x6')]('accountcode',_0x569d7c);this['setDataValue'](_0x088e('0x9'),util[_0x088e('0x12')](_0x088e('0xa'),this[_0x088e('0xb')](_0x088e('0x8')),_0x569d7c));}},'salt':{'type':Sequelize[_0x088e('0x4')]},'phone':{'type':Sequelize[_0x088e('0x4')]},'mobile':{'type':Sequelize[_0x088e('0x4')]},'address':{'type':Sequelize[_0x088e('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x088e('0x4')]},'city':{'type':Sequelize[_0x088e('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x088e('0x14')]},'voicePause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x088e('0x4')],'defaultValue':_0x088e('0x15')},'lastPauseAt':{'type':Sequelize[_0x088e('0x14')]},'chatCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x088e('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x088e('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x088e('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x088e('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x17'),_0x088e('0xe'),_0x088e('0x18')),'allowNull':!![],'defaultValue':_0x088e('0x17')},'context':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x088e('0x19'),_0x088e('0x1a'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x088e('0x1b')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x088e('0x1c'),'set':function(_0x1d6f3e){this[_0x088e('0x6')]('transport',_0x1d6f3e?_0x1d6f3e[_0x088e('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x088e('0x1e'))?this[_0x088e('0xb')](_0x088e('0x1e'))[_0x088e('0x1f')](','):null;},'comment':_0x088e('0x20')},'dtmfmode':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x21'),_0x088e('0x22'),_0x088e('0x23'),_0x088e('0x24'),_0x088e('0x25')),'allowNull':!![],'defaultValue':_0x088e('0x21')},'directmedia':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no',_0x088e('0x27'),'update',_0x088e('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![],'defaultValue':_0x088e('0x29'),'set':function(_0xd294b0){this[_0x088e('0x6')](_0x088e('0x2a'),_0xd294b0?_0xd294b0[_0x088e('0x1d')](','):null);},'get':function(){return this[_0x088e('0xb')](_0x088e('0x2a'))?this[_0x088e('0xb')]('nat')[_0x088e('0x1f')](','):null;},'comment':_0x088e('0x2b')},'callgroup':{'type':Sequelize[_0x088e('0x4')]},'namedcallgroup':{'type':Sequelize[_0x088e('0x4')]},'pickupgroup':{'type':Sequelize[_0x088e('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x088e('0x4')]},'language':{'type':Sequelize[_0x088e('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x088e('0x4')]},'disallow':{'type':Sequelize[_0x088e('0x4')],'allowNull':![],'defaultValue':_0x088e('0x2c')},'allow':{'type':Sequelize[_0x088e('0x4')],'allowNull':![],'defaultValue':_0x088e('0x2d'),'set':function(_0x4e973a){this[_0x088e('0x6')](_0x088e('0x2e'),_0x4e973a?_0x4e973a['join'](';'):_0x088e('0x2d'));},'get':function(){return this[_0x088e('0xb')](_0x088e('0x2e'))?this[_0x088e('0xb')](_0x088e('0x2e'))[_0x088e('0x1f')](';'):null;},'comment':_0x088e('0x2f')},'autoframing':{'type':Sequelize['ENUM'](_0x088e('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![],'set':function(_0x1c45b3){this[_0x088e('0x6')](_0x088e('0x30'),_0x1c45b3?_0x1c45b3[_0x088e('0x1d')](','):null);},'get':function(){return this[_0x088e('0xb')](_0x088e('0x30'))?this[_0x088e('0xb')](_0x088e('0x30'))[_0x088e('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no',_0x088e('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![],'defaultValue':_0x088e('0x32')},'amaflags':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![],'defaultValue':_0x088e('0x26')},'busylevel':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x088e('0x16')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x33'),'refuse',_0x088e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x088e('0x16')]('uac',_0x088e('0x35')),'allowNull':!![],'defaultValue':_0x088e('0x35')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x088e('0x26'),'no'),'allowNull':!![],'defaultValue':_0x088e('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x088e('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x088e('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no',_0x088e('0x36'),_0x088e('0x37')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0x088e('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no',_0x088e('0x27'),_0x088e('0x39'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x088e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x088e('0x14')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x088e('0x3a')]},'showWebBar':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0,'set':function(_0x28b088){this[_0x088e('0x6')](_0x088e('0x3b'),_0x28b088);var _0x2f1048=this['get']({'plain':!![]});switch(_0x28b088){case 0x0:case 0x1:var _0x3ab022=_0x2f1048[_0x088e('0x1e')]?_[_0x088e('0x3c')](_0x2f1048[_0x088e('0x1e')])?_0x2f1048[_0x088e('0x1e')][_0x088e('0x1d')]():_0x2f1048[_0x088e('0x1e')]:_0x088e('0x1c');if(_0x3ab022===_0x088e('0x3d')){_0x3ab022=_0x088e('0x1c');}this['setDataValue'](_0x088e('0x1e'),_0x3ab022);this['setDataValue']('encryption','no');this[_0x088e('0x6')](_0x088e('0x3e'),null);this['setDataValue'](_0x088e('0x3f'),null);this[_0x088e('0x6')](_0x088e('0x40'),null);this[_0x088e('0x6')](_0x088e('0x41'),null);this[_0x088e('0x6')](_0x088e('0x42'),null);this['setDataValue']('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x088e('0x6')](_0x088e('0x43'),null);this[_0x088e('0x6')](_0x088e('0x44'),'no');break;case 0x2:this[_0x088e('0x6')](_0x088e('0x1e'),_0x088e('0x3d'));this[_0x088e('0x6')](_0x088e('0x45'),_0x088e('0x26'));this[_0x088e('0x6')]('avpf',_0x088e('0x26'));this[_0x088e('0x6')]('force_avp',_0x088e('0x26'));this[_0x088e('0x6')](_0x088e('0x40'),'yes');this[_0x088e('0x6')]('dtlsenable','yes');this[_0x088e('0x6')]('dtlsverify','no');this[_0x088e('0x6')](_0x088e('0x46'),_0x088e('0x38'));this['setDataValue'](_0x088e('0x47'),_0x2f1048[_0x088e('0x47')]||_0x088e('0x48'));this[_0x088e('0x6')](_0x088e('0x43'),_0x2f1048[_0x088e('0x43')]||_0x088e('0x49'));this[_0x088e('0x6')]('rtcp_mux',_0x088e('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x088e('0x3a')],'set':function(_0x48ba5e){this[_0x088e('0x6')](_0x088e('0x4a'),_0x48ba5e?_0x48ba5e['join'](','):[]);},'get':function(){return this['getDataValue'](_0x088e('0x4a'))?_[_0x088e('0x4b')](this[_0x088e('0xb')](_0x088e('0x4a'))[_0x088e('0x1f')](','),function(_0x5d55d1){return parseInt(_0x5d55d1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x088e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x088e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x088e('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x088e('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x088e('0x16')](_0x088e('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x088e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x088e('0x4c')],'get':function(){return this[_0x088e('0xb')](_0x088e('0x4d'))?this[_0x088e('0xb')](_0x088e('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x088e('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x088e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![],'set':function(_0x146790){if(typeof _0x146790===_0x088e('0x4e')){var _0x276c56=_0x146790==='1'?!![]:_0x146790==='0'?![]:_0x146790===_0x088e('0x4f')?!![]:_0x146790===_0x088e('0x50')?![]:![];this['setDataValue'](_0x088e('0x51'),_0x276c56);}else{this[_0x088e('0x6')](_0x088e('0x51'),_0x146790);}}},'blocked':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![],'set':function(_0x45e2bd){this[_0x088e('0x6')](_0x088e('0x52'),_0x45e2bd);if(_0x45e2bd===!![]){this[_0x088e('0x6')](_0x088e('0x53'),moment());this[_0x088e('0x6')](_0x088e('0x54'),0x0);}else{this[_0x088e('0x6')](_0x088e('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x088e('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x088e('0x10')](0x5)[_0x088e('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x088e('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x088e('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x088e('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x088e('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index cfe5a04..79fde3d 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 _0xdce9=['DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','TeamVoicePrefix','UserVoicePrefix','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Voice','VoicePrefixId','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','phone','CmContact','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','teams','queues','inbound','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','SELECT','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','moment','util','path','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIForbiddenrror','../../mysqldb','./user.socket','register','redis','defaults','localhost','client','http','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','message','result','update','emit','destroy','get','role','admin','Users','user','Agents','Telephones','telephone','filter','map','value','find','name','UserProfileResource','end','stack','send','User','rawAttributes','fieldName','type','key','password','resetPasswordToken','md5secret','index','getOptions','where','query','include','userSetting','true','includes','attributes','push','rows','openTabs','length','dataValues','sms','fax','mail','openchannel','whatsapp','all','params','includeAll','merge','options','chat','catch','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','VoiceMail','fullname','email','agent','permissions','101','102','103','113','110','105','106','107','109','111','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','findAll','isEmpty','autoAssociation','compact','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','Queues','penalty','spread','capitalize','toLowerCase','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','QueueId','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','hasOwnProperty','CmList','List','color','tag','getQueues','keys','Queue','filters','intersection','model','fields','sort','Unknown\x20role','nolimit','order','pick','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','MemberReport','pause','PAUSE'];(function(_0x218750,_0x149db4){var _0x3e0fa6=function(_0x21d7c6){while(--_0x21d7c6){_0x218750['push'](_0x218750['shift']());}};_0x3e0fa6(++_0x149db4);}(_0xdce9,0x8e));var _0x9dce=function(_0xc9723,_0x5f4967){_0xc9723=_0xc9723-0x0;var _0x1a83fb=_0xdce9[_0xc9723];return _0x1a83fb;};'use strict';var moment=require(_0x9dce('0x0'));var util=require(_0x9dce('0x1'));var path=require(_0x9dce('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9dce('0x3'));var Redis=require('ioredis');var jayson=require(_0x9dce('0x4'));var authService=require(_0x9dce('0x5'));var contacts=require(_0x9dce('0x6'));var qs=require('../../components/parsers/qs');var rta=require('../../components/realtime/agents');var logger=require(_0x9dce('0x7'))(_0x9dce('0x8'));var utils=require('../../config/utils');var config=require(_0x9dce('0x9'));var licenseUtil=require(_0x9dce('0xa'));var APIBadRequestError=require(_0x9dce('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0x9dce('0xb'))['APINotFoundError'];var APIForbiddenError=require(_0x9dce('0xb'))[_0x9dce('0xc')];var APIHandleError=require(_0x9dce('0xb'))['handleError'];var db=require(_0x9dce('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9dce('0xe'))[_0x9dce('0xf')](socket);config[_0x9dce('0x10')]=_[_0x9dce('0x11')](config[_0x9dce('0x10')],{'host':_0x9dce('0x12'),'port':0x18eb});var amiClient=jayson[_0x9dce('0x13')][_0x9dce('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x192b9e,_0x17fa23){_0x17fa23=_0x17fa23||0xcc;return function(_0x57b102){if(_0x57b102){return _0x192b9e[_0x9dce('0x15')](_0x17fa23);}return _0x192b9e['status'](_0x17fa23)['end']();};}function respondWithResult(_0x2758a0,_0x22ddcc){_0x22ddcc=_0x22ddcc||0xc8;return function(_0x518bb2){if(_0x518bb2){return _0x2758a0[_0x9dce('0x16')](_0x22ddcc)[_0x9dce('0x17')](_0x518bb2);}};}function respondWithFilteredResult(_0x320e57,_0x2795dd){return function(_0x332c92){if(_0x332c92){var _0x51305b=typeof _0x2795dd['offset']==='undefined'&&typeof _0x2795dd[_0x9dce('0x18')]===_0x9dce('0x19');var _0x548f69=_0x332c92[_0x9dce('0x1a')];var _0x18dd8c=_0x51305b?0x0:_0x2795dd[_0x9dce('0x1b')];var _0x50d578=_0x51305b?_0x332c92[_0x9dce('0x1a')]:_0x2795dd[_0x9dce('0x1b')]+_0x2795dd[_0x9dce('0x18')];var _0x56d13c;if(_0x50d578>=_0x548f69){_0x50d578=_0x548f69;_0x56d13c=0xc8;}else{_0x56d13c=0xce;}_0x320e57['status'](_0x56d13c);return _0x320e57[_0x9dce('0x1c')](_0x9dce('0x1d'),_0x18dd8c+'-'+_0x50d578+'/'+_0x548f69)[_0x9dce('0x17')](_0x332c92);}return null;};}function respondWithRpcPromise(_0x2db89e,_0x441b47,_0x37c97d,_0x3aedde){return new Promise(function(_0x36f1c8,_0x2061c3){var _0x5947de=_0x3aedde||amiClient;return _0x5947de[_0x9dce('0x1e')](_0x2db89e,_0x37c97d)[_0x9dce('0x1f')](function(_0x37372e){logger[_0x9dce('0x20')](_0x9dce('0x21'),_0x441b47,_0x9dce('0x22'));logger['debug'](_0x9dce('0x23'),_0x441b47,'request\x20sent',JSON['stringify'](_0x37372e));if(_0x37372e[_0x9dce('0x24')]){if(_0x37372e[_0x9dce('0x24')]['code']===0x1f4){logger[_0x9dce('0x24')]('User,\x20%s,\x20%s',_0x441b47,_0x37372e[_0x9dce('0x24')]['message']);return _0x2061c3(_0x37372e[_0x9dce('0x24')][_0x9dce('0x25')]);}logger[_0x9dce('0x24')](_0x9dce('0x21'),_0x441b47,_0x37372e[_0x9dce('0x24')][_0x9dce('0x25')]);return _0x36f1c8(_0x37372e['error'][_0x9dce('0x25')]);}else{logger[_0x9dce('0x20')]('User,\x20%s,\x20%s',_0x441b47,'request\x20sent');_0x36f1c8(_0x37372e[_0x9dce('0x26')][_0x9dce('0x25')]);}})['catch'](function(_0x13168a){logger['error'](_0x9dce('0x21'),_0x441b47,_0x13168a);_0x2061c3(_0x13168a);});});}function saveUpdates(_0xe17a06){return function(_0x356456){if(_0x356456){return _0x356456[_0x9dce('0x27')](_0xe17a06)[_0x9dce('0x1f')](function(_0x292336){if(_0x292336['role']==='agent'){socket[_0x9dce('0x28')]('userNotification:recalc:'+_0x292336['id'],_0x292336);}return _0x292336;});}return null;};}function removeEntity(_0x4e8bef,_0x796894){return function(_0x4eb64d){if(_0x4eb64d){return _0x4eb64d[_0x9dce('0x29')]({'transaction':_0x796894})['then'](function(){var _0x1343bb=_0x4eb64d[_0x9dce('0x2a')]({'plain':!![]});if(_0x1343bb[_0x9dce('0x2b')]===_0x9dce('0x2c'))return;var _0x35996d=[{'name':_0x9dce('0x2d'),'value':_0x9dce('0x2e'),'ignore':!![]},{'name':_0x9dce('0x2f'),'value':'agent','ignore':![]},{'name':_0x9dce('0x30'),'value':_0x9dce('0x31'),'ignore':![]}];var _0x22e589=_(_0x35996d)[_0x9dce('0x32')]('ignore')[_0x9dce('0x33')]('value')[_0x9dce('0x34')]();if(_['includes'](_0x22e589,_0x1343bb[_0x9dce('0x2b')])){return;}var _0x57ffc0=_[_0x9dce('0x35')](_0x35996d,[_0x9dce('0x34'),_0x1343bb[_0x9dce('0x2b')]])[_0x9dce('0x36')];return db[_0x9dce('0x37')][_0x9dce('0x29')]({'where':{'type':_0x57ffc0,'resourceId':_0x1343bb['id']},'transaction':_0x796894})['then'](function(){return _0x4eb64d;});})[_0x9dce('0x1f')](function(){_0x4e8bef['status'](0xcc)[_0x9dce('0x38')]();});}};}function handleEntityNotFound(_0x59aa35){return function(_0x3ea759){if(!_0x3ea759){_0x59aa35[_0x9dce('0x15')](0x194);}return _0x3ea759;};}function handleError(_0x1da0b3,_0x1d307e){_0x1d307e=_0x1d307e||0x1f4;return function(_0x5ee2be){logger[_0x9dce('0x24')](_0x5ee2be[_0x9dce('0x39')]);if(_0x5ee2be[_0x9dce('0x36')]){delete _0x5ee2be[_0x9dce('0x36')];}_0x1da0b3[_0x9dce('0x16')](_0x1d307e)[_0x9dce('0x3a')](_0x5ee2be);};}function getUserAttributes(){return _(db[_0x9dce('0x3b')][_0x9dce('0x3c')])['map'](function(_0x4cfdef){return{'name':_0x4cfdef[_0x9dce('0x3d')],'type':_0x4cfdef[_0x9dce('0x3e')][_0x9dce('0x3f')]};})[_0x9dce('0x32')](function(_0x1de442){return![_0x9dce('0x40'),'salt','previousPasswords',_0x9dce('0x41'),'resetPasswordExpires',_0x9dce('0x42')]['includes'](_0x1de442[_0x9dce('0x36')]);})[_0x9dce('0x34')]();}exports[_0x9dce('0x43')]=function(_0x272686,_0x364a72){var _0x2cabe5={},_0x114cc0={'count':0x0,'rows':[]};var _0x360ed7=getUserAttributes();_0x2cabe5=qs[_0x9dce('0x44')](_0x360ed7,_0x272686);var _0x65172e={'where':_0x2cabe5[_0x9dce('0x45')]};return db[_0x9dce('0x3b')][_0x9dce('0x1a')](_0x65172e)[_0x9dce('0x1f')](function(_0x38118f){_0x114cc0[_0x9dce('0x1a')]=_0x38118f;if(_0x272686[_0x9dce('0x46')]['includeAll']){_0x2cabe5[_0x9dce('0x47')]=[{'all':!![]}];}if(_0x272686[_0x9dce('0x46')][_0x9dce('0x48')]===_0x9dce('0x49')){_0x2cabe5[_0x9dce('0x47')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x9dce('0x4a')](_0x2cabe5[_0x9dce('0x4b')],'id')){_0x2cabe5[_0x9dce('0x4b')][_0x9dce('0x4c')]('id');}return db['User']['findAll'](_0x2cabe5);})['then'](function(_0x6a420b){_0x114cc0[_0x9dce('0x4d')]=_0x6a420b;if(_0x272686[_0x9dce('0x46')][_0x9dce('0x4e')]===_0x9dce('0x49')){var _0x523ed4=[];for(var _0x5431c6=0x0;_0x5431c6<_0x114cc0[_0x9dce('0x4d')][_0x9dce('0x4f')];_0x5431c6++){_0x523ed4[_0x9dce('0x4c')](get_open_tabs('chat',_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4['push'](get_open_tabs(_0x9dce('0x51'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6]['dataValues']));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x52'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x53'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x54'),_0x114cc0['rows'][_0x5431c6][_0x9dce('0x50')]));_0x523ed4[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x114cc0[_0x9dce('0x4d')][_0x5431c6][_0x9dce('0x50')]));}return Promise[_0x9dce('0x56')](_0x523ed4)['then'](function(){return _0x114cc0;});}else{return _0x114cc0;}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x364a72,_0x2cabe5))['catch'](handleError(_0x364a72,null));};exports['show']=function(_0x1d6941,_0x176121){var _0x2485a6=getUserAttributes();_0x1d6941[_0x9dce('0x46')]['id']=_0x1d6941[_0x9dce('0x57')]['id'];var _0x154301=qs[_0x9dce('0x44')](_0x2485a6,_0x1d6941);if(_0x1d6941[_0x9dce('0x46')][_0x9dce('0x58')]){_0x154301['include']=[{'all':!![]}];}if(_0x1d6941[_0x9dce('0x46')]['userSetting']===_0x9dce('0x49')){_0x154301[_0x9dce('0x47')]=[{'model':db['UserSetting'],'as':_0x9dce('0x48')}];}_0x154301=_[_0x9dce('0x59')]({},_0x154301,_0x1d6941[_0x9dce('0x5a')]);if(!_['includes'](_0x154301[_0x9dce('0x4b')],'id')){_0x154301['attributes']['push']('id');}return db[_0x9dce('0x3b')][_0x9dce('0x35')](_0x154301)[_0x9dce('0x1f')](handleEntityNotFound(_0x176121,null))[_0x9dce('0x1f')](function(_0x5acb35){var _0x1073b3=[];values=_0x5acb35;if(_0x1d6941[_0x9dce('0x46')]['openTabs']===_0x9dce('0x49')){_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x5b'),_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('sms',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('openchannel',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x5acb35['dataValues']));_0x1073b3[_0x9dce('0x4c')](get_open_tabs('fax',_0x5acb35[_0x9dce('0x50')]));_0x1073b3[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x53'),_0x5acb35['dataValues']));return Promise[_0x9dce('0x56')](_0x1073b3);}else{return values;}})[_0x9dce('0x1f')](function(){return values;})[_0x9dce('0x1f')](respondWithResult(_0x176121,null))[_0x9dce('0x5c')](handleError(_0x176121,null));};exports[_0x9dce('0x27')]=function(_0x6b2740,_0x52f232){if(_0x6b2740[_0x9dce('0x5d')]['id']){delete _0x6b2740[_0x9dce('0x5d')]['id'];}delete _0x6b2740[_0x9dce('0x5d')][_0x9dce('0x2b')];return db['User']['find']({'where':{'id':_0x6b2740[_0x9dce('0x57')]['id']}})['then'](handleEntityNotFound(_0x52f232,null))[_0x9dce('0x1f')](saveUpdates(_0x6b2740[_0x9dce('0x5d')],null))[_0x9dce('0x1f')](respondWithResult(_0x52f232,null))[_0x9dce('0x5c')](handleError(_0x52f232,null));};exports['describe']=function(_0x502841,_0x2dab6f){return db[_0x9dce('0x3b')][_0x9dce('0x5e')]()[_0x9dce('0x1f')](respondWithResult(_0x2dab6f,null))[_0x9dce('0x5c')](handleError(_0x2dab6f,null));};exports[_0x9dce('0x5f')]=function(_0x4b3940,_0x2fe126){return db[_0x9dce('0x3b')]['find']({'where':{'id':_0x4b3940['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2fe126,null))[_0x9dce('0x1f')](function(_0x5444d0){if(_0x5444d0){return _0x5444d0[_0x9dce('0x5f')](_0x4b3940[_0x9dce('0x5d')]['ids'],_['omit'](_0x4b3940[_0x9dce('0x5d')],[_0x9dce('0x60'),'id'])||{});}})[_0x9dce('0x1f')](respondWithResult(_0x2fe126,null))[_0x9dce('0x5c')](handleError(_0x2fe126,null));};function validateUser(_0xa58433){return new Promise(function(_0x5b8e30,_0x4694ec){if(_0xa58433[_0x9dce('0x61')])return _0x5b8e30(_0xa58433);return db[_0x9dce('0x62')][_0x9dce('0x63')](0x1)['then'](function(_0x330bc8){if(_0x330bc8[_0x9dce('0x64')])authService[_0x9dce('0x65')](_0xa58433[_0x9dce('0x40')]);db[_0x9dce('0x3b')][_0x9dce('0x66')](_0x9dce('0x61'))[_0x9dce('0x1f')](function(_0x1c8ed0){if(_[_0x9dce('0x67')](_0x1c8ed0)){_0xa58433['internal']=_0x330bc8[_0x9dce('0x68')]||0x1;return;}if(_['isNil'](_0x330bc8[_0x9dce('0x68')])||_0x330bc8[_0x9dce('0x68')]===_0x1c8ed0){_0xa58433['internal']=_0x1c8ed0+0x1;return;}if(_0x330bc8[_0x9dce('0x68')]>_0x1c8ed0){_0xa58433[_0x9dce('0x61')]=_0x330bc8[_0x9dce('0x68')];return;}return db[_0x9dce('0x69')][_0x9dce('0x46')](_0x9dce('0x6a'),{'type':db[_0x9dce('0x69')][_0x9dce('0x6b')]['SELECT']})[_0x9dce('0x1f')](function(_0x29eea3){if(_0x29eea3&&_0x29eea3[_0x9dce('0x4f')]){for(var _0x4f4a72=0x0,_0x34227f=_0x29eea3['length'];_0x4f4a72<_0x34227f&&_['isNil'](_0xa58433[_0x9dce('0x61')]);_0x4f4a72++){if(_0x330bc8[_0x9dce('0x68')]<=_0x29eea3[_0x4f4a72][_0x9dce('0x6c')]){_0xa58433[_0x9dce('0x61')]=_0x29eea3[_0x4f4a72]['from'];}else if(_0x330bc8['min_internal']>_0x29eea3[_0x4f4a72][_0x9dce('0x6c')]&&_0x330bc8[_0x9dce('0x68')]<=_0x29eea3[_0x4f4a72]['to']){_0xa58433[_0x9dce('0x61')]=_0x330bc8[_0x9dce('0x68')];}}}if(_['isNil'](_0xa58433[_0x9dce('0x61')])){_0xa58433[_0x9dce('0x61')]=_0x1c8ed0+0x1;}return _0x5b8e30(_0xa58433);});});})[_0x9dce('0x5c')](function(_0x2a3f2f){_0x4694ec(_0x2a3f2f);});});}function updateUser(_0x556452){return new Promise(function(_0x3ee9df,_0x313f77){try{if(_0x556452[_0x9dce('0x6d')]){_0x556452['mailbox']=_0x556452[_0x9dce('0x61')];_0x556452[_0x9dce('0x6e')]={'mailbox':_0x556452[_0x9dce('0x61')],'password':_0x556452[_0x9dce('0x40')],'fullname':_0x556452[_0x9dce('0x6f')],'email':_0x556452[_0x9dce('0x70')]};}if(_0x556452[_0x9dce('0x2b')]===_0x9dce('0x71')){if(!_0x556452[_0x9dce('0x72')])_0x556452[_0x9dce('0x72')]=[_0x9dce('0x73'),_0x9dce('0x74'),_0x9dce('0x75'),_0x9dce('0x76'),_0x9dce('0x77'),'104',_0x9dce('0x78'),_0x9dce('0x79'),_0x9dce('0x7a'),'108',_0x9dce('0x7b'),'100',_0x9dce('0x7c'),'114',_0x9dce('0x7d')];}_0x3ee9df(_0x556452);}catch(_0x3a7e19){_0x313f77(_0x3a7e19);}});}exports[_0x9dce('0x7e')]=function(_0x29b339,_0x50855d){if(_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]===_0x9dce('0x71'))throw new Error('Unauthorized');if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]===_0x9dce('0x2e')&&_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]===_0x9dce('0x2c')&&_0x29b339[_0x9dce('0x2e')][_0x9dce('0x2b')]!=='admin'){throw new Error(_0x9dce('0x7f'));}return licenseUtil[_0x9dce('0x80')]([_0x29b339['body']])['then'](function(){return validateUser(_0x29b339[_0x9dce('0x5d')]);})[_0x9dce('0x1f')](function(_0x34c8fc){return updateUser(_0x34c8fc)['then'](function(_0x4f4132){if(_0x4f4132['role']==='admin'){_0x4f4132[_0x9dce('0x81')]=_0x29b339['user'][_0x9dce('0x81')];delete _0x4f4132[_0x9dce('0x82')];}return _0x4f4132;});})[_0x9dce('0x1f')](function(_0x52fc9a){return db[_0x9dce('0x3b')]['create'](_0x52fc9a,{'include':[{'model':db[_0x9dce('0x6e')],'as':_0x9dce('0x6e')}]});})[_0x9dce('0x1f')](function(_0x50c756){if(_0x29b339[_0x9dce('0x5d')][_0x9dce('0x2b')]==='user')return _0x50c756;if(_0x29b339['user'][_0x9dce('0x2b')]!=='user')return _0x50c756;return db['UserProfileSection']['find']({'where':{'name':_0x50c756[_0x9dce('0x2b')]===_0x9dce('0x71')?'Agents':_0x9dce('0x30'),'userProfileId':_0x29b339[_0x9dce('0x2e')][_0x9dce('0x82')]},'raw':!![]})[_0x9dce('0x1f')](function(_0x405e49){if(!_0x405e49||_0x405e49['autoAssociation']!=0x0)return _0x50c756;return db[_0x9dce('0x37')]['create']({'name':_0x50c756[_0x9dce('0x36')],'resourceId':_0x50c756['id'],'type':_0x405e49[_0x9dce('0x36')],'sectionId':_0x405e49['id']},{})[_0x9dce('0x1f')](function(){return _0x50c756;});})[_0x9dce('0x5c')](function(_0x38c58c){logger[_0x9dce('0x24')](_0x9dce('0x83'),_0x38c58c);throw _0x38c58c;});})[_0x9dce('0x1f')](respondWithResult(_0x50855d,0xc9))[_0x9dce('0x5c')](handleError(_0x50855d,null));};exports['bulkCreate']=function(_0x46fea7,_0x19ae31){var _0x537399=_0x46fea7['body'];var _0x575cb3=[];if(_0x46fea7['user'][_0x9dce('0x2b')]===_0x9dce('0x71'))throw new Error('Unauthorized');if(_[_0x9dce('0x84')](_0x537399,[_0x9dce('0x2b'),_0x9dce('0x2e')])&&_0x46fea7[_0x9dce('0x2e')]['role']!==_0x9dce('0x2c')){throw new Error(_0x9dce('0x85'));}if(_[_0x9dce('0x84')](_0x537399,[_0x9dce('0x2b'),_0x9dce('0x2c')])&&_0x46fea7[_0x9dce('0x2e')][_0x9dce('0x2b')]!==_0x9dce('0x2c')){throw new Error(_0x9dce('0x86'));}return licenseUtil[_0x9dce('0x80')](_0x537399)[_0x9dce('0x1f')](function(){return validateUser(_0x537399[0x0]);})[_0x9dce('0x1f')](function(){for(var _0x3ed75f=0x1;_0x3ed75f<_0x537399[_0x9dce('0x4f')];_0x3ed75f++){var _0x31d27f=_0x537399[_0x3ed75f-0x1][_0x9dce('0x61')];if(!_0x537399[_0x3ed75f][_0x9dce('0x61')])_0x537399[_0x3ed75f]['internal']=_0x31d27f+0x1;_0x575cb3[_0x9dce('0x4c')](validateUser(_0x537399[_0x3ed75f]));}return Promise['all'](_0x575cb3);})[_0x9dce('0x1f')](function(){_0x575cb3=[];for(var _0x326442=0x0;_0x326442<_0x537399[_0x9dce('0x4f')];_0x326442++){_0x575cb3['push'](updateUser(_0x537399[_0x326442]));}return Promise[_0x9dce('0x56')](_0x575cb3);})[_0x9dce('0x1f')](function(){_0x575cb3=_0x537399[_0x9dce('0x33')](function(_0x518636){return db[_0x9dce('0x3b')][_0x9dce('0x7e')](_0x518636,{'include':[{'model':db[_0x9dce('0x6e')],'as':_0x9dce('0x6e')}]})[_0x9dce('0x1f')](function(_0x33600c){_0x518636['id']=_0x33600c['id'];return _0x518636;});});return Promise[_0x9dce('0x56')](_0x575cb3);})[_0x9dce('0x1f')](function(_0x139735){if(_0x46fea7[_0x9dce('0x5d')][_0x9dce('0x2b')]==='user')return _0x139735;if(_0x46fea7[_0x9dce('0x2e')]['role']!==_0x9dce('0x2e'))return _0x139735;var _0xa19c89=_['some'](_0x139735,function(_0x3e2438){return _0x3e2438['role']===_0x9dce('0x71')||_0x3e2438[_0x9dce('0x2b')]===_0x9dce('0x31');});if(!_0xa19c89)return _0x139735;return db[_0x9dce('0x87')][_0x9dce('0x88')]({'where':{'name':{'$or':[_0x9dce('0x2f'),_0x9dce('0x30')]},'userProfileId':_0x46fea7[_0x9dce('0x2e')][_0x9dce('0x82')]},'raw':!![]})[_0x9dce('0x1f')](function(_0x718f9b){if(_[_0x9dce('0x89')](_0x718f9b)||!_[_0x9dce('0x84')](_0x718f9b,[_0x9dce('0x8a'),0x0]))return _0x139735;_0x575cb3=[];var _0x19465b=_(_0x718f9b)[_0x9dce('0x33')](function(_0x42264d){if(_0x42264d['autoAssociation']===0x1)return;return _0x42264d[_0x9dce('0x36')]==='Agents'?_0x9dce('0x71'):_0x9dce('0x31');})[_0x9dce('0x8b')]()['value']();for(var _0xcd45d7=0x0;_0xcd45d7<_0x139735[_0x9dce('0x4f')];_0xcd45d7++){if(!_['includes'](_0x19465b,_0x139735[_0xcd45d7][_0x9dce('0x2b')]))return;var _0x38572d=_0x139735[_0xcd45d7][_0x9dce('0x2b')]==='agent'?_0x9dce('0x2f'):'Telephones';_0x575cb3[_0x9dce('0x4c')](db[_0x9dce('0x37')][_0x9dce('0x7e')]({'name':_0x139735[_0xcd45d7][_0x9dce('0x36')],'resourceId':_0x139735[_0xcd45d7]['id'],'type':_0x38572d,'sectionId':_[_0x9dce('0x35')](_0x718f9b,[_0x9dce('0x36'),_0x38572d])['id']},{}));}return Promise[_0x9dce('0x56')](_0x575cb3);});})[_0x9dce('0x1f')](respondWithResult(_0x19ae31,0xc9))[_0x9dce('0x5c')](handleError(_0x19ae31,null));};exports['changePassword']=function(_0x54df6b,_0x387538){if(_0x54df6b[_0x9dce('0x5d')]['id']){delete _0x54df6b['body']['id'];}return db['User'][_0x9dce('0x35')]({'where':{'id':_0x54df6b[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](function(_0x303747){if(!_0x303747)return null;if(_0x303747['id']===_0x54df6b[_0x9dce('0x2e')]['id']){if(!_0x54df6b['body'][_0x9dce('0x8c')]||!_0x54df6b['body'][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x303747[_0x9dce('0x90')](_0x54df6b['body']['oldPassword'])){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0x91'));}if(_0x54df6b['body'][_0x9dce('0x8c')]===_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x92'));}}else if(_0x54df6b[_0x9dce('0x2e')][_0x9dce('0x2b')]===_0x9dce('0x2c')){if(!_0x54df6b[_0x9dce('0x5d')]['newPassword']){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x93'));}}else if(_0x54df6b['user'][_0x9dce('0x2b')]==='user'){if(!_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0x93'));}if(_0x303747['role']!==_0x9dce('0x71')){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0x94'));}}else{throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))]('Unauthorized');}return _0x303747;})['then'](handleEntityNotFound(_0x387538,null))['then'](function(_0x3b5c2d){return db[_0x9dce('0x62')][_0x9dce('0x95')]({'attributes':['id',_0x9dce('0x64'),_0x9dce('0x96'),_0x9dce('0x97')]})['then'](function(_0x3d496c){if(_0x3d496c[_0x9dce('0x64')])authService['validatePasswordPattern'](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')]);if(!_0x3d496c[_0x9dce('0x96')]||!_0x3b5c2d[_0x9dce('0x98')])return _0x3b5c2d;authService[_0x9dce('0x99')](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],_0x3b5c2d['previousPasswords'],_0x3d496c[_0x9dce('0x97')]);return _0x3b5c2d;})['then'](saveUpdates({'password':_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],'passwordResetAt':_0x54df6b['user']['id']==_0x54df6b[_0x9dce('0x57')]['id']?moment():null,'previousPasswords':authService[_0x9dce('0x9a')](_0x54df6b[_0x9dce('0x5d')][_0x9dce('0x8d')],_0x3b5c2d['previousPasswords'])},null));})['then'](respondWithResult(_0x387538,null))[_0x9dce('0x5c')](handleError(_0x387538,null));};exports[_0x9dce('0x9b')]=function(_0x1a0abb,_0x17da07){var _0x118ace=_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0x9c')];return db[_0x9dce('0x3b')]['find']({'where':{'id':_0x1a0abb[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b'),_0x9dce('0x9d'),_0x9dce('0x9e'),_0x9dce('0x9f'),_0x9dce('0xa0')]})['then'](handleEntityNotFound(_0x17da07,null))[_0x9dce('0x1f')](function(_0x22a97b){if(_0x22a97b){if(!utils[_0x9dce('0xa1')](_0x118ace)){throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xa2'));}return _0x22a97b[_0x9dce('0xa3')+_['capitalize'](_0x118ace['toLowerCase']())+_0x9dce('0xa4')](_0x1a0abb[_0x9dce('0x5d')]['ids'],{'penalty':_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0xa5')]||0x0})[_0x9dce('0xa6')](function(_0x45d6e2){for(var _0x382a69=0x0;_0x382a69<_0x1a0abb['body'][_0x9dce('0x60')][_0x9dce('0x4f')];_0x382a69+=0x1){var _0xc7ffe9={'UserId':Number(_0x1a0abb[_0x9dce('0x57')]['id'])};_0xc7ffe9[_[_0x9dce('0xa7')](_0x118ace[_0x9dce('0xa8')]())+'QueueId']=Number(_0x1a0abb['body']['ids'][_0x382a69]);socket[_0x9dce('0x28')](_0x9dce('0x2e')+_[_0x9dce('0xa7')](_0x118ace[_0x9dce('0xa8')]())+_0x9dce('0xa9'),_0xc7ffe9);}return _0x45d6e2;})[_0x9dce('0x1f')](function(){if(_0x118ace===_0x9dce('0xaa')){return db[_0x9dce('0xab')][_0x9dce('0x88')]({'where':{'id':_0x1a0abb[_0x9dce('0x5d')]['ids']||[]},'raw':!![],'attributes':['id',_0x9dce('0x36')]});}})['then'](function(_0x4e8882){var _0x137a52=_0x22a97b[_0x9dce('0x2a')]({'plain':!![]});var _0x2c8fed=[];if(_0x118ace===_0x9dce('0xaa')&&_0x137a52[_0x9dce('0x2b')]===_0x9dce('0x71')&&_0x137a52[_0x9dce('0x9d')]){for(let _0x5221e9=0x0;_0x5221e9<_0x4e8882[_0x9dce('0x4f')];_0x5221e9+=0x1){_0x2c8fed['push']({'membername':_0x137a52['name'],'UserId':_0x137a52['id'],'queue_name':_0x4e8882[_0x5221e9][_0x9dce('0x36')],'VoiceQueueId':_0x4e8882[_0x5221e9]['id'],'interface':_[_0x9dce('0x67')](_0x137a52[_0x9dce('0xa0')])?util[_0x9dce('0xac')](_0x9dce('0xad'),_0x137a52[_0x9dce('0x36')]):_0x137a52[_0x9dce('0xa0')],'paused':_0x137a52[_0x9dce('0x9f')]||![],'penalty':_0x1a0abb[_0x9dce('0x5d')][_0x9dce('0xa5')]||0x0});}return Promise['all'](_0x2c8fed[_0x9dce('0x33')](function(_0x1ba007){return db[_0x9dce('0xae')][_0x9dce('0xaf')](_0x1ba007);}));}return _0x22a97b;});}})[_0x9dce('0x1f')](respondWithStatusCode(_0x17da07,null))[_0x9dce('0x5c')](handleError(_0x17da07,null));};exports[_0x9dce('0xb0')]=function(_0x1e82df,_0x5d5eee){var _0x5b01c2,_0x18c4da;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x1e82df[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0x5d5eee,null))[_0x9dce('0x1f')](function(_0x49bfe7){if(_0x49bfe7){_0x5b01c2=_0x49bfe7;if(!_0x1e82df['query'][_0x9dce('0x9c')]||!utils['isValidChannel'](_0x1e82df['query'][_0x9dce('0x9c')])){throw new db[(_0x9dce('0x8e'))]['ValidationError'](_0x9dce('0xa2'));}return _0x49bfe7[_0x9dce('0xb1')+_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')][_0x9dce('0xa8')]())+_0x9dce('0xa4')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')]);}})['then'](function(_0x1182c7){if(_[_0x9dce('0xb2')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')])){for(var _0x958002=0x0;_0x958002<_0x1e82df[_0x9dce('0x46')]['ids'][_0x9dce('0x4f')];_0x958002+=0x1){_0x18c4da={'UserId':Number(_0x1e82df[_0x9dce('0x57')]['id'])};_0x18c4da[_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')][_0x9dce('0xa8')]())+'QueueId']=Number(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')][_0x958002]);socket[_0x9dce('0x28')]('user'+_['capitalize'](_0x1e82df['query'][_0x9dce('0x9c')][_0x9dce('0xa8')]())+_0x9dce('0xb3'),_0x18c4da);}}else{_0x18c4da={'UserId':Number(_0x1e82df['params']['id'])};_0x18c4da[_[_0x9dce('0xa7')](_0x1e82df[_0x9dce('0x46')]['channel'][_0x9dce('0xa8')]())+_0x9dce('0xb4')]=Number(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x60')]);socket[_0x9dce('0x28')]('user'+_['capitalize'](_0x1e82df['query'][_0x9dce('0x9c')]['toLowerCase']())+'Queue:remove',_0x18c4da);}return _0x1182c7;})[_0x9dce('0x1f')](function(){if(_0x1e82df[_0x9dce('0x46')][_0x9dce('0x9c')]===_0x9dce('0xaa')){return db[_0x9dce('0xae')][_0x9dce('0x29')]({'where':{'UserId':_0x1e82df[_0x9dce('0x57')]['id'],'VoiceQueueId':_0x1e82df['query'][_0x9dce('0x60')]},'individualHooks':!![]})['then'](function(){return _0x5b01c2;});}return _0x5b01c2;})[_0x9dce('0x1f')](respondWithStatusCode(_0x5d5eee,null))[_0x9dce('0x5c')](handleError(_0x5d5eee,null));};exports['addAvatar']=function(_0x541592,_0x44a927){_0x541592[_0x9dce('0x5d')][_0x9dce('0xb5')]=_0x541592[_0x9dce('0xb6')][_0x9dce('0xb7')];return db['User'][_0x9dce('0x35')]({'where':{'id':_0x541592[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x44a927,null))[_0x9dce('0x1f')](saveUpdates(_0x541592['body'],null))['then'](respondWithResult(_0x44a927,null))[_0x9dce('0x5c')](handleError(_0x44a927,null));};exports[_0x9dce('0xb8')]=function(_0x8760b4,_0x4ac7c2){var _0x70b47d=path[_0x9dce('0xb9')](config[_0x9dce('0xba')],_0x9dce('0xbb'));return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x8760b4['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9dce('0x1f')](handleEntityNotFound(_0x4ac7c2,null))[_0x9dce('0x1f')](function(_0x458968){if(_0x458968){if(_['isNil'](_0x458968[_0x9dce('0xb5')])){return _0x4ac7c2[_0x9dce('0xbc')](_0x70b47d);}else{if(!fs[_0x9dce('0xbd')](path[_0x9dce('0xb9')](config[_0x9dce('0xba')],'server/files/images/',_0x458968['userpic']))){return _0x4ac7c2[_0x9dce('0xbc')](_0x70b47d);}return _0x4ac7c2[_0x9dce('0xbc')](path['join'](config['root'],'server/files/images/',_0x458968[_0x9dce('0xb5')]));}}})['catch'](handleError(_0x4ac7c2,null));};exports[_0x9dce('0xbe')]=function(_0x1045e7,_0x5eef82){return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x1045e7[_0x9dce('0x57')]['id']},'attributes':['id']})[_0x9dce('0x1f')](handleEntityNotFound(_0x5eef82,null))[_0x9dce('0x1f')](function(_0x4df965){var _0x14cdd9=[];values=_0x4df965['dataValues'];_0x14cdd9['push'](get_open_tabs('chat',_0x4df965['dataValues']));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x51'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x54'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9[_0x9dce('0x4c')](get_open_tabs(_0x9dce('0x55'),_0x4df965['dataValues']));_0x14cdd9['push'](get_open_tabs(_0x9dce('0x52'),_0x4df965[_0x9dce('0x50')]));_0x14cdd9['push'](get_open_tabs(_0x9dce('0x53'),_0x4df965['dataValues']));return Promise[_0x9dce('0x56')](_0x14cdd9);})[_0x9dce('0x1f')](function(_0x356288){if(_0x356288){var _0x3a13b3=_[_0x9dce('0x33')](values[_0x9dce('0xbf')],function(_0x1efcd1){return{'channel':_0x9dce('0xc0'),'id':_0x1efcd1['id'],'createdAt':_0x1efcd1[_0x9dce('0xc1')]};});var _0x1a1c25=_[_0x9dce('0x33')](values[_0x9dce('0xc2')],function(_0x12fde5){return{'channel':_0x9dce('0xc3'),'id':_0x12fde5['id'],'createdAt':_0x12fde5[_0x9dce('0xc1')]};});var _0x255a5f=_[_0x9dce('0x33')](values['OpenchannelOpenTabs'],function(_0x4a67a1){return{'channel':_0x9dce('0xc4'),'id':_0x4a67a1['id'],'createdAt':_0x4a67a1[_0x9dce('0xc1')]};});var _0x2a179c=_['map'](values[_0x9dce('0xc5')],function(_0x2104d){return{'channel':'MAIL','id':_0x2104d['id'],'createdAt':_0x2104d['createdAt']};});var _0x2f26a6=_[_0x9dce('0x33')](values['SmsOpenTabs'],function(_0x595bdc){return{'channel':_0x9dce('0xc6'),'id':_0x595bdc['id'],'createdAt':_0x595bdc[_0x9dce('0xc1')]};});var _0x21d40c=_[_0x9dce('0x33')](values[_0x9dce('0xc7')],function(_0xeb52cf){return{'channel':_0x9dce('0xc8'),'id':_0xeb52cf['id'],'createdAt':_0xeb52cf['createdAt']};});var _0xd3d3cf=_[_0x9dce('0xc9')](_0x3a13b3,_0x1a1c25,_0x255a5f,_0x2a179c,_0x2f26a6,_0x21d40c);var _0x34ffe6={'count':_0xd3d3cf[_0x9dce('0x4f')],'rows':_0xd3d3cf};return _0x34ffe6;}else return null;})['then'](respondWithResult(_0x5eef82,null))['catch'](handleError(_0x5eef82,null));};exports[_0x9dce('0xca')]=function(_0x5d5a4d,_0x20ab31){var _0x1377e5={};return db['User'][_0x9dce('0x95')]({'where':{'id':_0x5d5a4d['params']['id']}})[_0x9dce('0x1f')](function(_0x3be2b3){if(!_0x3be2b3){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5d5a4d[_0x9dce('0x57')]['id']));}return contacts['describe']();})[_0x9dce('0x1f')](function(_0x30272d){_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0x3b')]=_0x5d5a4d[_0x9dce('0x57')]['id'];_0x1377e5=qs[_0x9dce('0x44')](_0x30272d,_0x5d5a4d);if(_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0x58'))){_0x1377e5[_0x9dce('0x47')]=[{'model':db[_0x9dce('0xcc')],'as':_0x9dce('0xcd'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9dce('0x36'),_0x9dce('0xce')],'where':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]?{'id':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]}:undefined,'required':_0x5d5a4d[_0x9dce('0x46')][_0x9dce('0xcf')]?!![]:![]}];}return contacts[_0x9dce('0x88')](_0x5d5a4d[_0x9dce('0x46')],_0x5d5a4d[_0x9dce('0x2e')],_0x1377e5,_0x30272d);})[_0x9dce('0x1f')](respondWithFilteredResult(_0x20ab31,_0x1377e5))[_0x9dce('0x5c')](APIHandleError(_0x20ab31));};exports[_0x9dce('0xd0')]=function(_0x38aaa0,_0x59dc0c){var _0x5b6edd;var _0xcabb74={};var _0x568af1;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x38aaa0[_0x9dce('0x57')]['id']},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0x59dc0c,null))[_0x9dce('0x1f')](function(_0x4a3345){if(!utils[_0x9dce('0xa1')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])){throw new db['Sequelize']['ValidationError'](_0x9dce('0xa2'));}_0x5b6edd=_0x4a3345;var _0x1b2f50={};_0x1b2f50['model']=_[_0x9dce('0xd1')](db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')]['channel'])+_0x9dce('0xd2')][_0x9dce('0x3c')]);_0x1b2f50[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x38aaa0[_0x9dce('0x46')]);_0x1b2f50[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1b2f50[_0x9dce('0xd5')],_0x1b2f50[_0x9dce('0x46')]);_0xcabb74['attributes']=_[_0x9dce('0xd4')](_0x1b2f50[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0xd6')]));_0xcabb74[_0x9dce('0x4b')]=_0xcabb74[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0xcabb74['attributes']:_0x1b2f50['model'];_0xcabb74['order']=qs['sort'](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0xd7')]);_0xcabb74[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_['pick'](_0x38aaa0[_0x9dce('0x46')],_0x1b2f50[_0x9dce('0xd3')]));if(_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x32')]){_0xcabb74[_0x9dce('0x45')]=_['merge'](_0xcabb74[_0x9dce('0x45')],{'$or':_['map'](_0xcabb74['attributes'],function(_0x4156aa){var _0x12d077={};_0x12d077[_0x4156aa]={'$like':'%'+_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x12d077;})});}_0xcabb74=_[_0x9dce('0x59')]({},_0xcabb74,_0x38aaa0[_0x9dce('0x5a')]);switch(_0x5b6edd['role']){case _0x9dce('0x2c'):return db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queue'][_0x9dce('0x88')](_0xcabb74);case _0x9dce('0x2e'):case'agent':return _0x5b6edd[_0x9dce('0x2a')+_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queues'](_0xcabb74);default:throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xd8'));}})[_0x9dce('0x1f')](function(_0x410d7f){_0x568af1=_0x410d7f[_0x9dce('0x4f')];if(!_0x38aaa0[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0xcabb74[_0x9dce('0x18')]=qs['limit'](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x18')]);_0xcabb74[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x38aaa0[_0x9dce('0x46')]['offset']);}switch(_0x5b6edd[_0x9dce('0x2b')]){case _0x9dce('0x2c'):return db[_[_0x9dce('0xa7')](_0x38aaa0[_0x9dce('0x46')][_0x9dce('0x9c')])+'Queue'][_0x9dce('0x88')](_0xcabb74);case _0x9dce('0x2e'):case _0x9dce('0x71'):return _0x5b6edd[_0x9dce('0x2a')+_['capitalize'](_0x38aaa0[_0x9dce('0x46')]['channel'])+_0x9dce('0xa4')](_0xcabb74);}})[_0x9dce('0x1f')](function(_0x12ca96){return{'count':_0x568af1,'rows':_0x12ca96};})[_0x9dce('0x1f')](respondWithResult(_0x59dc0c,null))[_0x9dce('0x5c')](handleError(_0x59dc0c,null));};exports['getVoiceQueuesRt']=function(_0x4bb509,_0x1c539e){var _0x3ef603={};var _0xa28d44={};var _0x25d355;var _0x26f5fe;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x4bb509['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x1c539e,null))[_0x9dce('0x1f')](function(_0xd4c6ab){if(_0xd4c6ab){_0x25d355=_0xd4c6ab;_0xa28d44[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['UserVoiceQueueRt'][_0x9dce('0x3c')]);_0xa28d44[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4bb509[_0x9dce('0x46')]);_0xa28d44[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0xa28d44[_0x9dce('0xd5')],_0xa28d44[_0x9dce('0x46')]);_0x3ef603[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0xa28d44['model'],qs['fields'](_0x4bb509[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x3ef603[_0x9dce('0x4b')]=_0x3ef603[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x3ef603[_0x9dce('0x4b')]:_0xa28d44['model'];_0x3ef603[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x4bb509[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x3ef603[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4bb509[_0x9dce('0x46')],_0xa28d44[_0x9dce('0xd3')]));if(_0x4bb509[_0x9dce('0x46')]['filter']){_0x3ef603[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x3ef603[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x3ef603[_0x9dce('0x4b')],function(_0x236a5c){var _0x1d455e={};_0x1d455e[_0x236a5c]={'$like':'%'+_0x4bb509[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x1d455e;})});}_0x3ef603=_['merge']({},_0x3ef603,_0x4bb509[_0x9dce('0x5a')]);return _0x25d355[_0x9dce('0xdc')](_0x3ef603);}})[_0x9dce('0x1f')](function(_0x21c27e){if(_0x21c27e){_0x26f5fe=_0x21c27e[_0x9dce('0x4f')];if(!_0x4bb509[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x3ef603['limit']=qs[_0x9dce('0x18')](_0x4bb509['query'][_0x9dce('0x18')]);_0x3ef603['offset']=qs[_0x9dce('0x1b')](_0x4bb509[_0x9dce('0x46')]['offset']);}return _0x25d355['getVoiceQueuesRt'](_0x3ef603);}})['then'](function(_0x74c14b){if(_0x74c14b){return _0x74c14b?{'count':_0x26f5fe,'rows':_0x74c14b}:null;}})['then'](respondWithResult(_0x1c539e,null))[_0x9dce('0x5c')](handleError(_0x1c539e,null));};exports['getGroups']=function(_0x4d568b,_0xc1fbc8){var _0x28c350={};var _0x40aa86={};var _0x49fdfd;var _0x3494b3;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x4d568b[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0xc1fbc8,null))[_0x9dce('0x1f')](function(_0x22cc68){if(_0x22cc68){_0x49fdfd=_0x22cc68;_0x40aa86[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xdd')][_0x9dce('0x3c')]);_0x40aa86[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4d568b[_0x9dce('0x46')]);_0x40aa86['filters']=_[_0x9dce('0xd4')](_0x40aa86[_0x9dce('0xd5')],_0x40aa86[_0x9dce('0x46')]);_0x28c350['attributes']=_[_0x9dce('0xd4')](_0x40aa86[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x28c350[_0x9dce('0x4b')]=_0x28c350[_0x9dce('0x4b')]['length']?_0x28c350[_0x9dce('0x4b')]:_0x40aa86['model'];_0x28c350[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x28c350['where']=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4d568b[_0x9dce('0x46')],_0x40aa86[_0x9dce('0xd3')]));if(_0x4d568b['query'][_0x9dce('0x32')]){_0x28c350[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x28c350['where'],{'$or':_[_0x9dce('0x33')](_0x28c350[_0x9dce('0x4b')],function(_0x510a1f){var _0x3fbc82={};_0x3fbc82[_0x510a1f]={'$like':'%'+_0x4d568b[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x3fbc82;})});}_0x28c350=_[_0x9dce('0x59')]({},_0x28c350,_0x4d568b[_0x9dce('0x5a')]);return _0x49fdfd[_0x9dce('0xde')](_0x28c350);}})[_0x9dce('0x1f')](function(_0x36a6b1){if(_0x36a6b1){_0x3494b3=_0x36a6b1[_0x9dce('0x4f')];if(!_0x4d568b[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x28c350[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x4d568b[_0x9dce('0x46')][_0x9dce('0x18')]);_0x28c350['offset']=qs[_0x9dce('0x1b')](_0x4d568b['query'][_0x9dce('0x1b')]);}return _0x49fdfd['getGroups'](_0x28c350);}})[_0x9dce('0x1f')](function(_0xfddb81){if(_0xfddb81){return _0xfddb81?{'count':_0x3494b3,'rows':_0xfddb81}:null;}})[_0x9dce('0x1f')](respondWithResult(_0xc1fbc8,null))['catch'](handleError(_0xc1fbc8,null));};exports[_0x9dce('0xdf')]=function(_0x25691e,_0x2e1fe0){var _0x458f17={'raw':!![],'where':{}};var _0x1f1d9b={};var _0x3f243c={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x25691e['params']['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2e1fe0,null))[_0x9dce('0x1f')](function(_0x3e7b0f){if(_0x3e7b0f){_0x1f1d9b[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['VoiceRecording'][_0x9dce('0x3c')]);_0x1f1d9b['query']=_[_0x9dce('0xd1')](_0x25691e[_0x9dce('0x46')]);_0x1f1d9b[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1f1d9b[_0x9dce('0xd5')],_0x1f1d9b['query']);_0x458f17['attributes']=_[_0x9dce('0xd4')](_0x1f1d9b[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x25691e[_0x9dce('0x46')]['fields']));_0x458f17['attributes']=_0x458f17['attributes'][_0x9dce('0x4f')]?_0x458f17[_0x9dce('0x4b')]:_0x1f1d9b[_0x9dce('0xd5')];if(!_0x25691e[_0x9dce('0x46')][_0x9dce('0xcb')]('nolimit')){_0x458f17[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x25691e[_0x9dce('0x46')][_0x9dce('0x18')]);_0x458f17[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x25691e['query'][_0x9dce('0x1b')]);}_0x458f17[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x25691e[_0x9dce('0x46')]['sort']);_0x458f17['where']=qs['filters'](_[_0x9dce('0xdb')](_0x25691e['query'],_0x1f1d9b['filters']));_0x458f17['where'][_0x9dce('0xe0')]=_0x3e7b0f['id'];if(_0x25691e[_0x9dce('0x46')][_0x9dce('0x32')]){_0x458f17[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x458f17['where'],{'$or':_[_0x9dce('0x33')](_0x458f17[_0x9dce('0x4b')],function(_0x145b0e){var _0x3fe347={};_0x3fe347[_0x145b0e]={'$like':'%'+_0x25691e[_0x9dce('0x46')]['filter']+'%'};return _0x3fe347;})});}_0x458f17=_['merge']({},_0x458f17,_0x25691e['options']);return db[_0x9dce('0xe1')][_0x9dce('0x1a')]({'where':_0x458f17['where']})[_0x9dce('0x1f')](function(_0x2e8343){_0x3f243c[_0x9dce('0x1a')]=_0x2e8343;if(_0x25691e[_0x9dce('0x46')]['includeAll']){_0x458f17[_0x9dce('0x47')]=[{'all':!![]}];}return db[_0x9dce('0xe1')][_0x9dce('0x88')](_0x458f17);})[_0x9dce('0x1f')](function(_0x5001a5){_0x3f243c[_0x9dce('0x4d')]=_0x5001a5;return _0x3f243c;});}})['then'](respondWithFilteredResult(_0x2e1fe0,_0x458f17))['catch'](handleError(_0x2e1fe0,null));};exports['getScreenRecordings']=function(_0x4ae6bd,_0x23bf1b){var _0x5bcad5={'raw':!![],'where':{}};var _0x25d6a8={};var _0x517933={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x4ae6bd[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x23bf1b,null))['then'](function(_0x1ce1b2){if(_0x1ce1b2){_0x25d6a8['model']=_['keys'](db[_0x9dce('0xe2')][_0x9dce('0x3c')]);_0x25d6a8[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x4ae6bd[_0x9dce('0x46')]);_0x25d6a8[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x25d6a8[_0x9dce('0xd5')],_0x25d6a8[_0x9dce('0x46')]);_0x5bcad5['attributes']=_[_0x9dce('0xd4')](_0x25d6a8['model'],qs[_0x9dce('0xd6')](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x5bcad5[_0x9dce('0x4b')]=_0x5bcad5[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x5bcad5[_0x9dce('0x4b')]:_0x25d6a8[_0x9dce('0xd5')];if(!_0x4ae6bd['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x5bcad5['limit']=qs[_0x9dce('0x18')](_0x4ae6bd[_0x9dce('0x46')]['limit']);_0x5bcad5[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x1b')]);}_0x5bcad5['order']=qs['sort'](_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x5bcad5[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x4ae6bd['query'],_0x25d6a8[_0x9dce('0xd3')]));_0x5bcad5['where']['UserId']=_0x1ce1b2['id'];if(_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x32')]){_0x5bcad5[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x5bcad5['where'],{'$or':_[_0x9dce('0x33')](_0x5bcad5['attributes'],function(_0x45c68b){var _0x596a80={};_0x596a80[_0x45c68b]={'$like':'%'+_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x596a80;})});}_0x5bcad5=_[_0x9dce('0x59')]({},_0x5bcad5,_0x4ae6bd['options']);return db['ScreenRecording'][_0x9dce('0x1a')]({'where':_0x5bcad5[_0x9dce('0x45')]})[_0x9dce('0x1f')](function(_0x220586){_0x517933['count']=_0x220586;if(_0x4ae6bd[_0x9dce('0x46')][_0x9dce('0x58')]){_0x5bcad5[_0x9dce('0x47')]=[{'all':!![]}];}return db[_0x9dce('0xe2')]['findAll'](_0x5bcad5);})[_0x9dce('0x1f')](function(_0x31a5a7){_0x517933[_0x9dce('0x4d')]=_0x31a5a7;return _0x517933;});}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x23bf1b,_0x5bcad5))[_0x9dce('0x5c')](handleError(_0x23bf1b,null));};exports[_0x9dce('0xe3')]=function(_0x367799,_0x31880d){var _0x4c7d5e={};var _0x5dcbc2={};var _0x56d6b5;var _0x5bf349;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x367799[_0x9dce('0x57')]['id']}})['then'](handleEntityNotFound(_0x31880d,null))[_0x9dce('0x1f')](function(_0x36c501){if(_0x36c501){_0x56d6b5=_0x36c501;_0x5dcbc2[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xe4')][_0x9dce('0x3c')]);_0x5dcbc2['query']=_[_0x9dce('0xd1')](_0x367799[_0x9dce('0x46')]);_0x5dcbc2[_0x9dce('0xd3')]=_['intersection'](_0x5dcbc2[_0x9dce('0xd5')],_0x5dcbc2[_0x9dce('0x46')]);_0x4c7d5e[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x5dcbc2[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x367799[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x4c7d5e[_0x9dce('0x4b')]=_0x4c7d5e['attributes'][_0x9dce('0x4f')]?_0x4c7d5e[_0x9dce('0x4b')]:_0x5dcbc2[_0x9dce('0xd5')];_0x4c7d5e['order']=qs[_0x9dce('0xd7')](_0x367799['query'][_0x9dce('0xd7')]);_0x4c7d5e[_0x9dce('0x45')]=qs['filters'](_[_0x9dce('0xdb')](_0x367799[_0x9dce('0x46')],_0x5dcbc2[_0x9dce('0xd3')]));if(_0x367799['query'][_0x9dce('0x32')]){_0x4c7d5e[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x4c7d5e[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x4c7d5e[_0x9dce('0x4b')],function(_0x118e9e){var _0x188832={};_0x188832[_0x118e9e]={'$like':'%'+_0x367799[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x188832;})});}_0x4c7d5e=_[_0x9dce('0x59')]({},_0x4c7d5e,_0x367799['options']);return _0x56d6b5[_0x9dce('0xe3')](_0x4c7d5e);}})[_0x9dce('0x1f')](function(_0x5df411){if(_0x5df411){_0x5bf349=_0x5df411[_0x9dce('0x4f')];if(!_0x367799[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x4c7d5e[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x367799[_0x9dce('0x46')][_0x9dce('0x18')]);_0x4c7d5e[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x367799[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x56d6b5[_0x9dce('0xe3')](_0x4c7d5e);}})['then'](function(_0x3d02b4){if(_0x3d02b4){return _0x3d02b4?{'count':_0x5bf349,'rows':_0x3d02b4}:null;}})['then'](respondWithResult(_0x31880d,null))[_0x9dce('0x5c')](handleError(_0x31880d,null));};exports[_0x9dce('0xe5')]=function(_0x304dff,_0x27c27a){var _0x159aa7={};var _0x5436ac={};var _0x66f36a;var _0x5cf29c;return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x304dff[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x27c27a,null))[_0x9dce('0x1f')](function(_0x48582a){if(_0x48582a){_0x66f36a=_0x48582a;_0x5436ac[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['OpenchannelInteraction']['rawAttributes']);_0x5436ac[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x304dff[_0x9dce('0x46')]);_0x5436ac[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x5436ac[_0x9dce('0xd5')],_0x5436ac[_0x9dce('0x46')]);_0x159aa7['attributes']=_['intersection'](_0x5436ac[_0x9dce('0xd5')],qs['fields'](_0x304dff['query']['fields']));_0x159aa7[_0x9dce('0x4b')]=_0x159aa7[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x159aa7[_0x9dce('0x4b')]:_0x5436ac[_0x9dce('0xd5')];_0x159aa7[_0x9dce('0xda')]=qs['sort'](_0x304dff[_0x9dce('0x46')]['sort']);_0x159aa7[_0x9dce('0x45')]=qs['filters'](_['pick'](_0x304dff[_0x9dce('0x46')],_0x5436ac[_0x9dce('0xd3')]));if(_0x304dff['query'][_0x9dce('0x32')]){_0x159aa7[_0x9dce('0x45')]=_['merge'](_0x159aa7[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x159aa7['attributes'],function(_0x8252d9){var _0x4d2833={};_0x4d2833[_0x8252d9]={'$like':'%'+_0x304dff['query'][_0x9dce('0x32')]+'%'};return _0x4d2833;})});}_0x159aa7=_[_0x9dce('0x59')]({},_0x159aa7,_0x304dff[_0x9dce('0x5a')]);return _0x66f36a['getOpenchannelInteractions'](_0x159aa7);}})['then'](function(_0x5bb345){if(_0x5bb345){_0x5cf29c=_0x5bb345[_0x9dce('0x4f')];if(!_0x304dff['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x159aa7[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x304dff[_0x9dce('0x46')][_0x9dce('0x18')]);_0x159aa7['offset']=qs['offset'](_0x304dff[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x66f36a[_0x9dce('0xe5')](_0x159aa7);}})[_0x9dce('0x1f')](function(_0x4fb5f2){if(_0x4fb5f2){return _0x4fb5f2?{'count':_0x5cf29c,'rows':_0x4fb5f2}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x27c27a,null))[_0x9dce('0x5c')](handleError(_0x27c27a,null));};exports[_0x9dce('0xe6')]=function(_0x5585d6,_0x40a661){var _0x11a263={'raw':!![],'where':{}};var _0x5bf695={};var _0x362dde={'count':0x0,'rows':[]};return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x5585d6[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x40a661,null))['then'](function(_0x147d12){if(_0x147d12){_0x5bf695['model']=_[_0x9dce('0xd1')](db[_0x9dce('0xe7')]['rawAttributes']);_0x5bf695[_0x9dce('0x46')]=_['keys'](_0x5585d6['query']);_0x5bf695[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x5bf695[_0x9dce('0xd5')],_0x5bf695[_0x9dce('0x46')]);_0x11a263[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x5bf695[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x5585d6[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x11a263[_0x9dce('0x4b')]=_0x11a263['attributes'][_0x9dce('0x4f')]?_0x11a263[_0x9dce('0x4b')]:_0x5bf695[_0x9dce('0xd5')];if(!_0x5585d6['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x11a263[_0x9dce('0x18')]=qs['limit'](_0x5585d6[_0x9dce('0x46')][_0x9dce('0x18')]);_0x11a263[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x5585d6[_0x9dce('0x46')]['offset']);}_0x11a263[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x5585d6['query'][_0x9dce('0xd7')]);_0x11a263[_0x9dce('0x45')]=qs['filters'](_[_0x9dce('0xdb')](_0x5585d6[_0x9dce('0x46')],_0x5bf695[_0x9dce('0xd3')]));_0x11a263[_0x9dce('0x45')][_0x9dce('0xe0')]=_0x147d12['id'];if(_0x5585d6[_0x9dce('0x46')]['filter']){_0x11a263[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x11a263[_0x9dce('0x45')],{'$or':_['map'](_0x11a263[_0x9dce('0x4b')],function(_0x303efb){var _0x1a4daa={};_0x1a4daa[_0x303efb]={'$like':'%'+_0x5585d6['query'][_0x9dce('0x32')]+'%'};return _0x1a4daa;})});}_0x11a263=_[_0x9dce('0x59')]({},_0x11a263,_0x5585d6[_0x9dce('0x5a')]);return db[_0x9dce('0xe7')][_0x9dce('0x1a')]({'where':_0x11a263['where']})['then'](function(_0x3c4f43){_0x362dde[_0x9dce('0x1a')]=_0x3c4f43;if(_0x5585d6[_0x9dce('0x46')]['includeAll']){_0x11a263['include']=[{'all':!![]}];}return db[_0x9dce('0xe7')][_0x9dce('0x88')](_0x11a263);})[_0x9dce('0x1f')](function(_0x1185a9){_0x362dde[_0x9dce('0x4d')]=_0x1185a9;return _0x362dde;});}})[_0x9dce('0x1f')](respondWithFilteredResult(_0x40a661,_0x11a263))[_0x9dce('0x5c')](handleError(_0x40a661,null));};exports['getSmsInteractions']=function(_0x5e259e,_0x2ac8dd){var _0x40ba15={};var _0x1bacbd={};var _0x3ddef6;var _0x56227f;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x5e259e[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x2ac8dd,null))[_0x9dce('0x1f')](function(_0x38bf16){if(_0x38bf16){_0x3ddef6=_0x38bf16;_0x1bacbd[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db[_0x9dce('0xe8')][_0x9dce('0x3c')]);_0x1bacbd[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x5e259e['query']);_0x1bacbd[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x1bacbd[_0x9dce('0xd5')],_0x1bacbd[_0x9dce('0x46')]);_0x40ba15[_0x9dce('0x4b')]=_['intersection'](_0x1bacbd[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x40ba15[_0x9dce('0x4b')]=_0x40ba15[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x40ba15[_0x9dce('0x4b')]:_0x1bacbd['model'];_0x40ba15[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x40ba15[_0x9dce('0x45')]=qs['filters'](_['pick'](_0x5e259e[_0x9dce('0x46')],_0x1bacbd[_0x9dce('0xd3')]));if(_0x5e259e[_0x9dce('0x46')][_0x9dce('0x32')]){_0x40ba15[_0x9dce('0x45')]=_['merge'](_0x40ba15['where'],{'$or':_[_0x9dce('0x33')](_0x40ba15['attributes'],function(_0x49eb30){var _0x5431e7={};_0x5431e7[_0x49eb30]={'$like':'%'+_0x5e259e['query'][_0x9dce('0x32')]+'%'};return _0x5431e7;})});}_0x40ba15=_[_0x9dce('0x59')]({},_0x40ba15,_0x5e259e[_0x9dce('0x5a')]);return _0x3ddef6['getSmsInteractions'](_0x40ba15);}})['then'](function(_0x222d63){if(_0x222d63){_0x56227f=_0x222d63[_0x9dce('0x4f')];if(!_0x5e259e[_0x9dce('0x46')][_0x9dce('0xcb')]('nolimit')){_0x40ba15[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x5e259e['query']['limit']);_0x40ba15[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x5e259e[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x3ddef6[_0x9dce('0xe9')](_0x40ba15);}})[_0x9dce('0x1f')](function(_0x44a58c){if(_0x44a58c){return _0x44a58c?{'count':_0x56227f,'rows':_0x44a58c}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x2ac8dd,null))[_0x9dce('0x5c')](handleError(_0x2ac8dd,null));};exports[_0x9dce('0xea')]=function(_0x44c47a,_0x527f0c){var _0x439be8={};var _0x30853d={};var _0xc4500e;var _0x4a0569;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x44c47a[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x527f0c,null))['then'](function(_0x358102){if(_0x358102){_0xc4500e=_0x358102;_0x30853d['model']=_[_0x9dce('0xd1')](db[_0x9dce('0xeb')]['rawAttributes']);_0x30853d[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x44c47a[_0x9dce('0x46')]);_0x30853d['filters']=_[_0x9dce('0xd4')](_0x30853d[_0x9dce('0xd5')],_0x30853d[_0x9dce('0x46')]);_0x439be8[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x30853d[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x44c47a[_0x9dce('0x46')]['fields']));_0x439be8[_0x9dce('0x4b')]=_0x439be8['attributes'][_0x9dce('0x4f')]?_0x439be8[_0x9dce('0x4b')]:_0x30853d[_0x9dce('0xd5')];_0x439be8[_0x9dce('0xda')]=qs['sort'](_0x44c47a['query']['sort']);_0x439be8[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x44c47a['query'],_0x30853d[_0x9dce('0xd3')]));if(_0x44c47a[_0x9dce('0x46')][_0x9dce('0x32')]){_0x439be8[_0x9dce('0x45')]=_['merge'](_0x439be8[_0x9dce('0x45')],{'$or':_['map'](_0x439be8[_0x9dce('0x4b')],function(_0x3aca68){var _0x1451ca={};_0x1451ca[_0x3aca68]={'$like':'%'+_0x44c47a[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x1451ca;})});}_0x439be8=_[_0x9dce('0x59')]({},_0x439be8,_0x44c47a[_0x9dce('0x5a')]);return _0xc4500e[_0x9dce('0xea')](_0x439be8);}})[_0x9dce('0x1f')](function(_0x248895){if(_0x248895){_0x4a0569=_0x248895[_0x9dce('0x4f')];if(!_0x44c47a[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x439be8[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x44c47a['query'][_0x9dce('0x18')]);_0x439be8[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x44c47a['query'][_0x9dce('0x1b')]);}return _0xc4500e[_0x9dce('0xea')](_0x439be8);}})[_0x9dce('0x1f')](function(_0x55de21){if(_0x55de21){return _0x55de21?{'count':_0x4a0569,'rows':_0x55de21}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x527f0c,null))['catch'](handleError(_0x527f0c,null));};exports['getWhatsappInteractions']=function(_0x45d0a7,_0x463ef3){var _0x14f572={};var _0x3c6c40={};var _0x1982ab;var _0x161128;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x45d0a7[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x463ef3,null))[_0x9dce('0x1f')](function(_0x133a6a){if(_0x133a6a){_0x1982ab=_0x133a6a;_0x3c6c40['model']=_['keys'](db[_0x9dce('0xec')][_0x9dce('0x3c')]);_0x3c6c40[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x45d0a7[_0x9dce('0x46')]);_0x3c6c40[_0x9dce('0xd3')]=_['intersection'](_0x3c6c40[_0x9dce('0xd5')],_0x3c6c40[_0x9dce('0x46')]);_0x14f572[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x3c6c40[_0x9dce('0xd5')],qs[_0x9dce('0xd6')](_0x45d0a7[_0x9dce('0x46')]['fields']));_0x14f572['attributes']=_0x14f572[_0x9dce('0x4b')]['length']?_0x14f572[_0x9dce('0x4b')]:_0x3c6c40[_0x9dce('0xd5')];_0x14f572[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x45d0a7[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x14f572['where']=qs[_0x9dce('0xd3')](_['pick'](_0x45d0a7['query'],_0x3c6c40['filters']));if(_0x45d0a7[_0x9dce('0x46')][_0x9dce('0x32')]){_0x14f572[_0x9dce('0x45')]=_['merge'](_0x14f572[_0x9dce('0x45')],{'$or':_['map'](_0x14f572[_0x9dce('0x4b')],function(_0x116725){var _0x4a40f9={};_0x4a40f9[_0x116725]={'$like':'%'+_0x45d0a7[_0x9dce('0x46')]['filter']+'%'};return _0x4a40f9;})});}_0x14f572=_[_0x9dce('0x59')]({},_0x14f572,_0x45d0a7[_0x9dce('0x5a')]);return _0x1982ab['getWhatsappInteractions'](_0x14f572);}})[_0x9dce('0x1f')](function(_0x534e58){if(_0x534e58){_0x161128=_0x534e58[_0x9dce('0x4f')];if(!_0x45d0a7['query'][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x14f572[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x45d0a7[_0x9dce('0x46')][_0x9dce('0x18')]);_0x14f572[_0x9dce('0x1b')]=qs[_0x9dce('0x1b')](_0x45d0a7['query'][_0x9dce('0x1b')]);}return _0x1982ab[_0x9dce('0xed')](_0x14f572);}})['then'](function(_0x57c3e8){if(_0x57c3e8){return _0x57c3e8?{'count':_0x161128,'rows':_0x57c3e8}:null;}})[_0x9dce('0x1f')](respondWithResult(_0x463ef3,null))[_0x9dce('0x5c')](handleError(_0x463ef3,null));};exports['login']=function(_0x581f6e,_0x2f7d19,_0x58f112){var _0x49d361;var _0x18680f;var _0x4a73da;var _0x4c0cff=!_[_0x9dce('0x67')](_0x581f6e[_0x9dce('0x57')]['id'])?_0x581f6e['params']['id']:!_[_0x9dce('0x67')](_0x581f6e[_0x9dce('0x2e')]['id'])?_0x581f6e[_0x9dce('0x2e')]['id']:null;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x4c0cff,'role':{'$or':['admin','user',_0x9dce('0x71')]}},'attributes':['id','name','phone',_0x9dce('0xee'),_0x9dce('0x2b'),_0x9dce('0x61'),_0x9dce('0x9e')]})['then'](function(_0x140f7a){if(_0x140f7a){if(_0x140f7a[_0x9dce('0x2b')]===_0x9dce('0x71')){_0x49d361=_0x140f7a;if(_0x581f6e[_0x9dce('0x5d')]['interface']){_0x4a73da=util[_0x9dce('0xac')](_0x9dce('0xef'),_0x49d361[_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xa0')]]);}else if(_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xf0')]){_0x4a73da=util['format']('SIP/%s',_0x581f6e[_0x9dce('0x5d')][_0x9dce('0xf0')]);}else{_0x4a73da=util[_0x9dce('0xac')](_0x9dce('0xad'),_0x49d361[_0x9dce('0x36')]);}socket['to'](util[_0x9dce('0xac')]('user:%s',_0x49d361[_0x9dce('0x36')]))[_0x9dce('0x28')](_0x9dce('0xf1'),{'user':{'id':_0x49d361['id'],'name':_0x49d361['name']},'ip':_0x581f6e['headers'][_0x9dce('0xf2')]||_0x581f6e[_0x9dce('0xf3')]['remoteAddress']||_0x581f6e[_0x9dce('0xf4')][_0x9dce('0xf5')]||_0x581f6e['connection'][_0x9dce('0xf4')][_0x9dce('0xf5')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x49d361[_0x9dce('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x9dce('0x8e'))][(_0x9dce('0x8f'))](_0x9dce('0xf6'));}})[_0x9dce('0x1f')](function(){if(_0x49d361){return _0x49d361[_0x9dce('0xf7')]({'raw':!![]});}})[_0x9dce('0x1f')](function(_0x5437b2){if(_0x49d361){if(_0x5437b2){_0x18680f=_0x5437b2;if(_0x18680f[_0x9dce('0x4f')]){var _0x3c206d=_0x18680f[_0x9dce('0x33')](function(_0x482e19){var _0xc1ccf2={'membername':_0x49d361['name'],'UserId':_0x49d361['id'],'queue_name':_0x482e19[_0x9dce('0x36')],'VoiceQueueId':_0x482e19['id'],'interface':_0x4a73da,'paused':_0x49d361['loginInPause']||![],'penalty':_0x482e19[_0x9dce('0xf8')]||0x0};return db[_0x9dce('0xae')][_0x9dce('0xaf')](_0xc1ccf2);});return Promise['all'](_0x3c206d);}}}})[_0x9dce('0x1f')](function(){if(_0x49d361){return db['MemberReport'][_0x9dce('0x88')]({'where':{'membername':_0x49d361[_0x9dce('0x36')],'exitAt':null}});}})[_0x9dce('0x1f')](function(_0x5dcec4){if(_0x49d361){var _0x529766=[];_0x5dcec4[_0x9dce('0xf9')](function(_0x153df3){_0x529766[_0x9dce('0x4c')](_0x153df3[_0x9dce('0x27')]({'exitAt':moment()['format'](_0x9dce('0xfa'))}));});return Promise[_0x9dce('0x56')](_0x529766);}})[_0x9dce('0x1f')](function(){if(_0x49d361){var _0x6c7dcb=[];var _0x5f583d=[];var _0x4a2c6f=utils[_0x9dce('0xfb')]();var _0x58c740={'membername':_0x49d361['name'],'interface':_0x4a73da,'enterAt':moment()[_0x9dce('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x49d361[_0x9dce('0x2b')],'internal':_0x49d361[_0x9dce('0x61')]};_0x4a2c6f[_0x9dce('0xf9')](function(_0x317b01){_0x6c7dcb[_0x9dce('0x4c')](_[_0x9dce('0x59')]({'channel':_0x317b01,'type':_0x9dce('0xfc'),'data1':_0x581f6e['body'][_0x9dce('0xfd')],'data2':_0x4a73da},_0x58c740));if(_0x49d361['loginInPause']){_0x5f583d[_0x9dce('0x4c')](_[_0x9dce('0x59')]({'channel':_0x317b01,'type':'PAUSE','data1':_0x9dce('0xfe')},_0x58c740));}});return db['MemberReport']['bulkCreate'](_0x6c7dcb['concat'](_0x5f583d),{'individualHooks':!![]});}})[_0x9dce('0x1f')](function(){if(_0x49d361){return _0x49d361['update']({'online':!![],'lastLoginAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa')),'voicePause':_0x49d361[_0x9dce('0x9e')]||![],'mailPause':_0x49d361[_0x9dce('0x9e')]||![],'chatPause':_0x49d361[_0x9dce('0x9e')]||![],'faxPause':_0x49d361[_0x9dce('0x9e')]||![],'smsPause':_0x49d361[_0x9dce('0x9e')]||![],'openchannelPause':_0x49d361['loginInPause']||![],'whatsappPause':_0x49d361[_0x9dce('0x9e')]||![],'pauseType':_0x49d361['loginInPause']?'LOGININPAUSE':null,'interface':_0x4a73da,'lastPauseAt':moment()['format'](_0x9dce('0xfa'))});}})[_0x9dce('0x1f')](function(_0x5c3569){if(_0x581f6e[_0x9dce('0xff')]){return _0x58f112();}else{return Promise[_0x9dce('0x100')](_0x5c3569)[_0x9dce('0x1f')](respondWithResult(_0x2f7d19,null));}})['catch'](handleError(_0x2f7d19,null));};exports['logout']=function(_0x4ea020,_0xbcdabd){var _0x1a5f9e;return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x4ea020[_0x9dce('0x57')]['id'],'role':_0x9dce('0x71')},'attributes':['id',_0x9dce('0x36'),_0x9dce('0x2b')]})[_0x9dce('0x1f')](handleEntityNotFound(_0xbcdabd,null))[_0x9dce('0x1f')](function(_0x42234f){if(_0x42234f){_0x1a5f9e=_0x42234f;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1a5f9e[_0x9dce('0x36')]},'individualHooks':!![]});}})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x101')][_0x9dce('0x88')]({'where':{'membername':_0x1a5f9e[_0x9dce('0x36')],'exitAt':null}});})[_0x9dce('0x1f')](function(_0x30af86){var _0xb99f4f=[];_0x30af86[_0x9dce('0xf9')](function(_0x2e940d){_0xb99f4f[_0x9dce('0x4c')](_0x2e940d[_0x9dce('0x27')]({'exitAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa'))}));});return Promise[_0x9dce('0x56')](_0xb99f4f);})[_0x9dce('0x1f')](function(){return _0x1a5f9e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9dce('0x1f')](respondWithResult(_0xbcdabd,null))['catch'](handleError(_0xbcdabd,null));};exports['pause']=function(_0x55befb,_0x3d5986){var _0x304ba9;return db[_0x9dce('0xae')][_0x9dce('0x27')]({'paused':0x1},{'where':{'UserId':_0x55befb['params']['id']},'individualHooks':!![]})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x55befb[_0x9dce('0x57')]['id'],'role':'agent'},'attributes':['id',_0x9dce('0x36'),'role',_0x9dce('0x61'),_0x9dce('0xa0'),_0x9dce('0x9d')]});})[_0x9dce('0x1f')](handleEntityNotFound(_0x3d5986,null))[_0x9dce('0x1f')](function(_0x3b3549){if(_0x3b3549){_0x304ba9=_0x3b3549;return respondWithRpcPromise('QueuePause',_0x9dce('0x102'),{'id':_0x304ba9['id'],'name':_0x304ba9[_0x9dce('0x36')],'pause':!![]});}})[_0x9dce('0x1f')](function(){if(_0x304ba9){return db[_0x9dce('0x101')][_0x9dce('0x88')]({'where':{'membername':_0x304ba9[_0x9dce('0x36')],'type':_0x9dce('0x103'),'exitAt':null}});}})[_0x9dce('0x1f')](function(_0xab22){if(_0xab22[_0x9dce('0x4f')]){var _0x3606f1=moment()[_0x9dce('0xac')](_0x9dce('0xfa'));for(var _0x4439bf=0x0,_0xa61e73=_0xab22['length'];_0x4439bf<_0xa61e73;_0x4439bf++){_0xab22[_0x4439bf]['updateAttributes']({'exitAt':_0x3606f1});}}})[_0x9dce('0x1f')](function(){var _0x4d3042=[];var _0x588e7a=utils[_0x9dce('0xfb')]();_0x588e7a['forEach'](function(_0x5bedf2){_0x4d3042['push']({'channel':_0x5bedf2,'membername':_0x304ba9['name'],'interface':_[_0x9dce('0x67')](_0x304ba9[_0x9dce('0xa0')])?util['format'](_0x9dce('0xad'),_0x304ba9['name']):_0x304ba9[_0x9dce('0xa0')],'type':_0x9dce('0x103'),'enterAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa')),'data1':_0x55befb['body'][_0x9dce('0x3e')]||_0x9dce('0x104'),'role':_0x304ba9[_0x9dce('0x2b')],'internal':_0x304ba9[_0x9dce('0x61')]});});return db[_0x9dce('0x101')]['bulkCreate'](_0x4d3042,{'individualHooks':!![]});})[_0x9dce('0x1f')](function(){return _0x304ba9[_0x9dce('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x55befb[_0x9dce('0x5d')][_0x9dce('0x3e')]||_0x9dce('0x104'),'lastPauseAt':moment()[_0x9dce('0xac')](_0x9dce('0xfa'))});})[_0x9dce('0x1f')](respondWithResult(_0x3d5986,null))[_0x9dce('0x5c')](handleError(_0x3d5986,null));};exports[_0x9dce('0x105')]=function(_0x48df54,_0x42e173){if(_0x48df54[_0x9dce('0x5d')][_0x9dce('0x9c')]&&!utils[_0x9dce('0xa1')](_0x48df54['body'][_0x9dce('0x9c')])){throw new APIBadRequestError(util[_0x9dce('0xac')](_0x9dce('0x106'),_0x48df54[_0x9dce('0x5d')]['channel']));}return db[_0x9dce('0x3b')][_0x9dce('0x35')]({'where':{'id':_0x48df54['params']['id']},'attributes':['id',_0x9dce('0x36'),'role','internal',_0x9dce('0xa0'),_0x9dce('0x9d'),_0x9dce('0x9f'),_0x9dce('0x107'),_0x9dce('0x108'),_0x9dce('0x109'),'openchannelPause',_0x9dce('0x10a'),_0x9dce('0x10b'),_0x9dce('0x10c'),_0x9dce('0x10d')]})[_0x9dce('0x1f')](function(_0x240fa5){if(!_0x240fa5){throw new APINotFoundError(util[_0x9dce('0xac')](_0x9dce('0x10e'),_0x48df54[_0x9dce('0x57')]['id']));}return _0x240fa5[_0x9dce('0x105')](_0x48df54['body'][_0x9dce('0x9c')]);})['then'](respondWithResult(_0x42e173,null))[_0x9dce('0x5c')](APIHandleError(_0x42e173));};exports['getTeams']=function(_0x2e3db5,_0x151f93){var _0x345ea7={};var _0x3a7129={};var _0x466079;var _0x319699;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x2e3db5[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x151f93,null))['then'](function(_0x258f59){if(_0x258f59){_0x466079=_0x258f59;_0x3a7129['model']=_[_0x9dce('0xd1')](db[_0x9dce('0x10f')][_0x9dce('0x3c')]);_0x3a7129[_0x9dce('0x46')]=_[_0x9dce('0xd1')](_0x2e3db5['query']);_0x3a7129[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x3a7129['model'],_0x3a7129[_0x9dce('0x46')]);_0x345ea7[_0x9dce('0x4b')]=_[_0x9dce('0xd4')](_0x3a7129['model'],qs['fields'](_0x2e3db5[_0x9dce('0x46')]['fields']));_0x345ea7[_0x9dce('0x4b')]=_0x345ea7[_0x9dce('0x4b')]['length']?_0x345ea7[_0x9dce('0x4b')]:_0x3a7129[_0x9dce('0xd5')];_0x345ea7[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x2e3db5['query'][_0x9dce('0xd7')]);_0x345ea7['where']=qs[_0x9dce('0xd3')](_['pick'](_0x2e3db5['query'],_0x3a7129[_0x9dce('0xd3')]));if(_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x32')]){_0x345ea7[_0x9dce('0x45')]=_['merge'](_0x345ea7[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x345ea7[_0x9dce('0x4b')],function(_0x2ccceb){var _0x36a064={};_0x36a064[_0x2ccceb]={'$like':'%'+_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x36a064;})});}_0x345ea7=_[_0x9dce('0x59')]({},_0x345ea7,_0x2e3db5[_0x9dce('0x5a')]);return _0x466079[_0x9dce('0x110')](_0x345ea7);}})[_0x9dce('0x1f')](function(_0x39be1c){if(_0x39be1c){_0x319699=_0x39be1c[_0x9dce('0x4f')];if(!_0x2e3db5[_0x9dce('0x46')][_0x9dce('0xcb')](_0x9dce('0xd9'))){_0x345ea7[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x2e3db5['query']['limit']);_0x345ea7['offset']=qs[_0x9dce('0x1b')](_0x2e3db5[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0x466079[_0x9dce('0x110')](_0x345ea7);}})[_0x9dce('0x1f')](function(_0x1d6517){if(_0x1d6517){return _0x1d6517?{'count':_0x319699,'rows':_0x1d6517}:null;}})['then'](respondWithResult(_0x151f93,null))[_0x9dce('0x5c')](handleError(_0x151f93,null));};exports[_0x9dce('0x111')]=function(_0x489ddf,_0x971343){var _0x38e849=_0x489ddf['params']['id'];var _0x4a7501=_0x489ddf[_0x9dce('0x5d')]?_0x489ddf[_0x9dce('0x5d')][_0x9dce('0x60')]:null;var _0x444aa1=[];return Promise[_0x9dce('0x100')]()[_0x9dce('0x1f')](function(){if(!_0x4a7501)throw new APIBadRequestError(_0x9dce('0x112'));})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x38e849}});})[_0x9dce('0x1f')](function(_0x179e61){if(!_0x179e61)throw new APINotFoundError(util[_0x9dce('0xac')](_0x9dce('0x10e'),_0x489ddf[_0x9dce('0x57')]['id']));return db['sequelize'][_0x9dce('0x113')](function(_0x47abc3){return _0x179e61[_0x9dce('0x111')](_0x4a7501,{'transaction':_0x47abc3})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x10f')][_0x9dce('0x88')]({'where':{'id':{'$in':_0x4a7501}}});})[_0x9dce('0x1f')](function(_0x267066){var _0x54258d=_[_0x9dce('0x33')](_0x267066,function(_0x159229){return _0x159229[_0x9dce('0x114')]();});return Promise[_0x9dce('0x56')](_0x54258d);})[_0x9dce('0x1f')](function(_0x4a651b){_0x444aa1=_[_0x9dce('0x115')](_0x4a651b);var _0xd03036=_[_0x9dce('0x33')](_0x444aa1,function(_0x329543){return _0x329543['addAgent'](_0x179e61['id'],{'transaction':_0x47abc3});});return Promise['all'](_0xd03036);})[_0x9dce('0x1f')](function(){if(!_0x179e61[_0x9dce('0x9d')])return;var _0x39964d=_[_0x9dce('0x32')](_0x444aa1,function(_0x44bea2){return _0x44bea2['getDataValue'](_0x9dce('0x9c'))==='Voice';});var _0x1afdde=_[_0x9dce('0x33')](_0x39964d,function(_0x4aa3d4){return db[_0x9dce('0xae')][_0x9dce('0xaf')]({'membername':_0x179e61[_0x9dce('0x36')],'UserId':_0x179e61['id'],'queue_name':_0x4aa3d4['name'],'VoiceQueueId':_0x4aa3d4['id'],'interface':_['isNil'](_0x179e61[_0x9dce('0xa0')])?util[_0x9dce('0xac')](_0x9dce('0xad'),_0x179e61['name']):_0x179e61[_0x9dce('0xa0')],'paused':_0x179e61[_0x9dce('0x9f')]||![],'penalty':_0x179e61['penalty']},{'transaction':_0x47abc3});});return Promise[_0x9dce('0x56')](_0x1afdde);})['then'](function(){return db[_0x9dce('0x116')][_0x9dce('0x88')]({'where':{'teamId':{'$in':_0x4a7501}}});})[_0x9dce('0x1f')](function(_0x26ba22){var _0x4ed813=_[_0x9dce('0x33')](_0x26ba22,function(_0xebabad){return db[_0x9dce('0x117')]['create']({'UserId':_0x179e61['id'],'VoicePrefixId':_0xebabad['VoicePrefixId']},{'transaction':_0x47abc3});});return Promise[_0x9dce('0x56')](_0x4ed813);});});})[_0x9dce('0x1f')](function(){for(var _0x48720f=0x0;_0x48720f<_0x444aa1[_0x9dce('0x4f')];_0x48720f++){var _0x21673e=_0x444aa1[_0x48720f][_0x9dce('0x118')](_0x9dce('0x9c'));var _0x201ca4=_0x21673e+_0x9dce('0xb4');socket['emit'](_0x9dce('0x2e')+_0x21673e+'Queue:save',{'UserId':_0x38e849,['queueField']:_0x444aa1[_0x48720f]['id']});}})[_0x9dce('0x1f')](respondWithStatusCode(_0x971343,null))['catch'](APIHandleError(_0x971343));};exports[_0x9dce('0x119')]=function(_0x4ff852,_0x246fa){var _0x1da246=_0x4ff852[_0x9dce('0x57')]['id'];var _0x296a3f=null;if(_0x4ff852['query'][_0x9dce('0x60')]){_0x296a3f=_[_0x9dce('0xb2')](_0x4ff852[_0x9dce('0x46')][_0x9dce('0x60')])?_0x4ff852[_0x9dce('0x46')][_0x9dce('0x60')]:[_0x4ff852[_0x9dce('0x46')]['ids']];}var _0x3446c2=[];return Promise[_0x9dce('0x100')]()[_0x9dce('0x1f')](function(){if(!_0x296a3f)throw new APIBadRequestError(_0x9dce('0x11a'));})['then'](function(){return db[_0x9dce('0x3b')]['findOne']({'where':{'id':_0x1da246}});})[_0x9dce('0x1f')](function(_0x2cfdcb){if(!_0x2cfdcb)throw new APINotFoundError(util['format'](_0x9dce('0x10e'),_0x4ff852[_0x9dce('0x57')]['id']));return db[_0x9dce('0x69')][_0x9dce('0x113')](function(_0x11fb11){return _0x2cfdcb[_0x9dce('0x119')](_0x296a3f,{'transaction':_0x11fb11})[_0x9dce('0x1f')](function(){return db[_0x9dce('0x10f')][_0x9dce('0x88')]({'where':{'id':{'$in':_0x296a3f}}});})[_0x9dce('0x1f')](function(_0x2ba1dc){var _0x4ab995=_['map'](_0x2ba1dc,function(_0x4dceec){return _0x4dceec[_0x9dce('0x114')]();});return Promise[_0x9dce('0x56')](_0x4ab995);})[_0x9dce('0x1f')](function(_0x143ae8){_0x3446c2=_[_0x9dce('0x115')](_0x143ae8);var _0x200ab2=_[_0x9dce('0x33')](_0x3446c2,function(_0x535d45){return _0x535d45['removeAgent'](_0x2cfdcb['id'],{'transaction':_0x11fb11});});return Promise['all'](_0x200ab2);})[_0x9dce('0x1f')](function(){if(!_0x2cfdcb[_0x9dce('0x9d')])return;var _0x155e19=_[_0x9dce('0x32')](_0x3446c2,function(_0x40534a){return _0x40534a['getDataValue'](_0x9dce('0x9c'))===_0x9dce('0x11b');});var _0x104e9a=_[_0x9dce('0x33')](_0x155e19,function(_0x29e643){return db[_0x9dce('0xae')]['destroy']({'where':{'VoiceQueueId':_0x29e643['id'],'UserId':_0x2cfdcb['id']},'transaction':_0x11fb11});});return Promise[_0x9dce('0x56')](_0x104e9a);})['then'](function(){return db['TeamVoicePrefix'][_0x9dce('0x88')]({'where':{'teamId':{'$in':_0x296a3f}}});})[_0x9dce('0x1f')](function(_0x1b6c9b){var _0x23c5a0=_[_0x9dce('0x33')](_0x1b6c9b,function(_0x5eb926){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2cfdcb['id'],'VoicePrefixId':_0x5eb926[_0x9dce('0x11c')]}},{'transaction':_0x11fb11});});return Promise['all'](_0x23c5a0);});});})[_0x9dce('0x1f')](function(){for(var _0x54f008=0x0;_0x54f008<_0x3446c2[_0x9dce('0x4f')];_0x54f008++){var _0x5b8939=_0x3446c2[_0x54f008][_0x9dce('0x118')]('channel');var _0x3fed28=_0x5b8939+'QueueId';socket[_0x9dce('0x28')](_0x9dce('0x2e')+_0x5b8939+_0x9dce('0xb3'),{'UserId':_0x1da246,['queueField']:_0x3446c2[_0x54f008]['id']});}})['then'](respondWithStatusCode(_0x246fa,null))[_0x9dce('0x5c')](APIHandleError(_0x246fa));};exports[_0x9dce('0x11d')]=function(_0x2be563,_0xc5fd95){var _0x41f27b={};var _0x128414={};var _0xe46357;var _0x38408f;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x2be563[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0xc5fd95,null))[_0x9dce('0x1f')](function(_0x23feda){if(_0x23feda){_0xe46357=_0x23feda;_0x128414[_0x9dce('0xd5')]=_['keys'](db[_0x9dce('0xcc')]['rawAttributes']);_0x128414[_0x9dce('0x46')]=_['keys'](_0x2be563[_0x9dce('0x46')]);_0x128414[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x128414['model'],_0x128414[_0x9dce('0x46')]);_0x41f27b['attributes']=_[_0x9dce('0xd4')](_0x128414['model'],qs['fields'](_0x2be563[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x41f27b['attributes']=_0x41f27b[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x41f27b[_0x9dce('0x4b')]:_0x128414['model'];_0x41f27b['order']=qs[_0x9dce('0xd7')](_0x2be563[_0x9dce('0x46')][_0x9dce('0xd7')]);_0x41f27b[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x2be563[_0x9dce('0x46')],_0x128414[_0x9dce('0xd3')]));if(_0x2be563[_0x9dce('0x46')]['filter']){_0x41f27b[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x41f27b[_0x9dce('0x45')],{'$or':_['map'](_0x41f27b[_0x9dce('0x4b')],function(_0x73df50){var _0x540902={};_0x540902[_0x73df50]={'$like':'%'+_0x2be563[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x540902;})});}_0x41f27b=_['merge']({},_0x41f27b,_0x2be563['options']);return _0xe46357['getLists'](_0x41f27b);}})[_0x9dce('0x1f')](function(_0x26de41){if(_0x26de41){_0x38408f=_0x26de41[_0x9dce('0x4f')];if(!_0x2be563[_0x9dce('0x46')]['hasOwnProperty'](_0x9dce('0xd9'))){_0x41f27b[_0x9dce('0x18')]=qs[_0x9dce('0x18')](_0x2be563['query'][_0x9dce('0x18')]);_0x41f27b['offset']=qs['offset'](_0x2be563[_0x9dce('0x46')][_0x9dce('0x1b')]);}return _0xe46357[_0x9dce('0x11d')](_0x41f27b);}})[_0x9dce('0x1f')](function(_0x34c770){if(_0x34c770){return _0x34c770?{'count':_0x38408f,'rows':_0x34c770}:null;}})[_0x9dce('0x1f')](respondWithResult(_0xc5fd95,null))['catch'](handleError(_0xc5fd95,null));};exports[_0x9dce('0x11e')]=function(_0x528265,_0x3bcd5f){var _0x2f2e0a={};var _0x4c5bc5={};var _0x574835;return db[_0x9dce('0x3b')][_0x9dce('0x95')]({'where':{'id':_0x528265[_0x9dce('0x57')]['id']}})[_0x9dce('0x1f')](handleEntityNotFound(_0x3bcd5f,null))[_0x9dce('0x1f')](function(_0x2ccc03){if(_0x2ccc03){_0x574835=_0x2ccc03;_0x4c5bc5[_0x9dce('0xd5')]=_[_0x9dce('0xd1')](db['User'][_0x9dce('0x3c')]);_0x4c5bc5['query']=_['keys'](_0x528265[_0x9dce('0x46')]);_0x4c5bc5[_0x9dce('0xd3')]=_[_0x9dce('0xd4')](_0x4c5bc5[_0x9dce('0xd5')],_0x4c5bc5[_0x9dce('0x46')]);_0x2f2e0a['attributes']=_['intersection'](_0x4c5bc5['model'],qs[_0x9dce('0xd6')](_0x528265[_0x9dce('0x46')][_0x9dce('0xd6')]));_0x2f2e0a['attributes']=_0x2f2e0a[_0x9dce('0x4b')][_0x9dce('0x4f')]?_0x2f2e0a[_0x9dce('0x4b')]:_0x4c5bc5[_0x9dce('0xd5')];_0x2f2e0a[_0x9dce('0xda')]=qs[_0x9dce('0xd7')](_0x528265['query'][_0x9dce('0xd7')]);_0x2f2e0a[_0x9dce('0x45')]=qs[_0x9dce('0xd3')](_[_0x9dce('0xdb')](_0x528265[_0x9dce('0x46')],_0x4c5bc5[_0x9dce('0xd3')]));if(_0x528265[_0x9dce('0x46')][_0x9dce('0x32')]){_0x2f2e0a[_0x9dce('0x45')]=_[_0x9dce('0x59')](_0x2f2e0a[_0x9dce('0x45')],{'$or':_[_0x9dce('0x33')](_0x2f2e0a[_0x9dce('0x4b')],function(_0xcda9dc){var _0x3593e8={};_0x3593e8[_0xcda9dc]={'$like':'%'+_0x528265[_0x9dce('0x46')][_0x9dce('0x32')]+'%'};return _0x3593e8;})});}_0x2f2e0a['model']=db[_0x9dce('0x3b')];_0x2f2e0a['as']='Agents';_0x2f2e0a=_[_0x9dce('0x59')]({},_0x2f2e0a,_0x528265[_0x9dce('0x5a')]);return _0x574835[_0x9dce('0xf7')]({'include':[_0x2f2e0a]});}})[_0x9dce('0x1f')](function(_0x48e9d3){if(_0x48e9d3){var _0x559846={},_0x5f20da=[];for(var _0x1073a6=0x0;_0x1073a6<_0x48e9d3[_0x9dce('0x4f')];_0x1073a6+=0x1){for(var _0x2fe3eb=0x0,_0x184df7;_0x2fe3eb<_0x48e9d3[_0x1073a6][_0x9dce('0x2f')]['length'];_0x2fe3eb+=0x1){_0x184df7=_0x48e9d3[_0x1073a6]['Agents'][_0x2fe3eb]['get']({'plain':!![]});_0x559846[_0x184df7['id']]=_0x184df7;}}_0x559846=_[_0x9dce('0x11f')](_0x559846);for(var _0x2a7c80=qs[_0x9dce('0x1b')](_0x528265['query'][_0x9dce('0x1b')]);_0x2a7c80<_0x559846[_0x9dce('0x4f')]&&_0x5f20da[_0x9dce('0x4f')]=_0x2db5d){_0x3bb1a3=_0x2db5d;_0x1cf1aa=0xc8;}else{_0x1cf1aa=0xce;}_0x4822b7[_0x5c1a('0x19')](_0x1cf1aa);return _0x4822b7[_0x5c1a('0x1e')]('Content-Range',_0x5722dc+'-'+_0x3bb1a3+'/'+_0x2db5d)['json'](_0x26d518);}return null;};}function respondWithRpcPromise(_0x3fe102,_0x16055d,_0x3948ec,_0x5b9876){return new Promise(function(_0x1337dc,_0x55792d){var _0x42710d=_0x5b9876||amiClient;return _0x42710d[_0x5c1a('0x1f')](_0x3fe102,_0x3948ec)[_0x5c1a('0x20')](function(_0x182145){logger[_0x5c1a('0x21')]('User,\x20%s,\x20%s',_0x16055d,_0x5c1a('0x22'));logger[_0x5c1a('0x23')](_0x5c1a('0x24'),_0x16055d,'request\x20sent',JSON[_0x5c1a('0x25')](_0x182145));if(_0x182145[_0x5c1a('0x26')]){if(_0x182145['error'][_0x5c1a('0x27')]===0x1f4){logger[_0x5c1a('0x26')]('User,\x20%s,\x20%s',_0x16055d,_0x182145['error'][_0x5c1a('0x28')]);return _0x55792d(_0x182145[_0x5c1a('0x26')][_0x5c1a('0x28')]);}logger[_0x5c1a('0x26')]('User,\x20%s,\x20%s',_0x16055d,_0x182145[_0x5c1a('0x26')][_0x5c1a('0x28')]);return _0x1337dc(_0x182145[_0x5c1a('0x26')]['message']);}else{logger[_0x5c1a('0x21')]('User,\x20%s,\x20%s',_0x16055d,'request\x20sent');_0x1337dc(_0x182145[_0x5c1a('0x29')][_0x5c1a('0x28')]);}})[_0x5c1a('0x2a')](function(_0xd8b169){logger[_0x5c1a('0x26')]('User,\x20%s,\x20%s',_0x16055d,_0xd8b169);_0x55792d(_0xd8b169);});});}function saveUpdates(_0x4d198f){return function(_0xc80f64){if(_0xc80f64){return _0xc80f64[_0x5c1a('0x2b')](_0x4d198f)[_0x5c1a('0x20')](function(_0x568493){if(_0x568493[_0x5c1a('0x2c')]==='agent'){socket[_0x5c1a('0x2d')](_0x5c1a('0x2e')+_0x568493['id'],_0x568493);}return _0x568493;});}return null;};}function removeEntity(_0x48b4d1,_0x27681e){return function(_0x41383e){if(_0x41383e){return _0x41383e[_0x5c1a('0x2f')]({'transaction':_0x27681e})[_0x5c1a('0x20')](function(){var _0x1e9589=_0x41383e['get']({'plain':!![]});if(_0x1e9589[_0x5c1a('0x2c')]===_0x5c1a('0x30'))return;var _0x43ef84=[{'name':_0x5c1a('0x31'),'value':'user','ignore':!![]},{'name':_0x5c1a('0x32'),'value':_0x5c1a('0x33'),'ignore':![]},{'name':_0x5c1a('0x34'),'value':_0x5c1a('0x35'),'ignore':![]}];var _0x58606d=_(_0x43ef84)['filter'](_0x5c1a('0x36'))[_0x5c1a('0x37')](_0x5c1a('0x38'))[_0x5c1a('0x38')]();if(_[_0x5c1a('0x39')](_0x58606d,_0x1e9589[_0x5c1a('0x2c')])){return;}var _0x34c65b=_[_0x5c1a('0x3a')](_0x43ef84,['value',_0x1e9589[_0x5c1a('0x2c')]])[_0x5c1a('0x3b')];return db[_0x5c1a('0x3c')][_0x5c1a('0x2f')]({'where':{'type':_0x34c65b,'resourceId':_0x1e9589['id']},'transaction':_0x27681e})['then'](function(){return _0x41383e;});})[_0x5c1a('0x20')](function(){_0x48b4d1[_0x5c1a('0x19')](0xcc)[_0x5c1a('0x18')]();});}};}function handleEntityNotFound(_0x11609f){return function(_0x20e467){if(!_0x20e467){_0x11609f[_0x5c1a('0x17')](0x194);}return _0x20e467;};}function handleError(_0x1e63f5,_0x51bdbb){_0x51bdbb=_0x51bdbb||0x1f4;return function(_0x19c9ee){logger[_0x5c1a('0x26')](_0x19c9ee[_0x5c1a('0x3d')]);if(_0x19c9ee[_0x5c1a('0x3b')]){delete _0x19c9ee['name'];}_0x1e63f5[_0x5c1a('0x19')](_0x51bdbb)[_0x5c1a('0x3e')](_0x19c9ee);};}function getUserAttributes(){return _(db[_0x5c1a('0x3f')][_0x5c1a('0x40')])[_0x5c1a('0x37')](function(_0x3c6710){return{'name':_0x3c6710[_0x5c1a('0x41')],'type':_0x3c6710[_0x5c1a('0x42')][_0x5c1a('0x43')]};})[_0x5c1a('0x44')](function(_0x349848){return![_0x5c1a('0x45'),_0x5c1a('0x46'),'previousPasswords',_0x5c1a('0x47'),_0x5c1a('0x48'),_0x5c1a('0x49')][_0x5c1a('0x39')](_0x349848[_0x5c1a('0x3b')]);})[_0x5c1a('0x38')]();}exports['index']=function(_0x37c2c5,_0x3f89df){var _0x301803={},_0x3a18fb={'count':0x0,'rows':[]};var _0xca2c5d=getUserAttributes();_0x301803=qs[_0x5c1a('0x4a')](_0xca2c5d,_0x37c2c5);var _0xd78705={'where':_0x301803[_0x5c1a('0x4b')]};return db[_0x5c1a('0x3f')][_0x5c1a('0x4c')](_0xd78705)[_0x5c1a('0x20')](function(_0x2ee4df){_0x3a18fb[_0x5c1a('0x4c')]=_0x2ee4df;if(_0x37c2c5[_0x5c1a('0x4d')][_0x5c1a('0x4e')]){_0x301803[_0x5c1a('0x4f')]=[{'all':!![]}];}if(_0x37c2c5[_0x5c1a('0x4d')]['userSetting']==='true'){_0x301803[_0x5c1a('0x4f')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x5c1a('0x39')](_0x301803[_0x5c1a('0x50')],'id')){_0x301803['attributes']['push']('id');}return db[_0x5c1a('0x3f')][_0x5c1a('0x51')](_0x301803);})[_0x5c1a('0x20')](function(_0x33307a){_0x3a18fb[_0x5c1a('0x52')]=_0x33307a;if(_0x37c2c5[_0x5c1a('0x4d')][_0x5c1a('0x53')]===_0x5c1a('0x54')){var _0x280100=[];for(var _0x25c12b=0x0;_0x25c12b<_0x3a18fb[_0x5c1a('0x52')]['length'];_0x25c12b++){_0x280100[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x56'),_0x3a18fb['rows'][_0x25c12b][_0x5c1a('0x57')]));_0x280100[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x58'),_0x3a18fb['rows'][_0x25c12b]['dataValues']));_0x280100['push'](get_open_tabs(_0x5c1a('0x59'),_0x3a18fb[_0x5c1a('0x52')][_0x25c12b][_0x5c1a('0x57')]));_0x280100[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5a'),_0x3a18fb['rows'][_0x25c12b]['dataValues']));_0x280100['push'](get_open_tabs(_0x5c1a('0x5b'),_0x3a18fb[_0x5c1a('0x52')][_0x25c12b][_0x5c1a('0x57')]));_0x280100[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5c'),_0x3a18fb[_0x5c1a('0x52')][_0x25c12b][_0x5c1a('0x57')]));}return Promise['all'](_0x280100)['then'](function(){return _0x3a18fb;});}else{return _0x3a18fb;}})[_0x5c1a('0x20')](respondWithFilteredResult(_0x3f89df,_0x301803))[_0x5c1a('0x2a')](handleError(_0x3f89df,null));};exports['show']=function(_0x45e7b5,_0x5e8b48){var _0x220bee=getUserAttributes();_0x45e7b5[_0x5c1a('0x4d')]['id']=_0x45e7b5[_0x5c1a('0x5d')]['id'];var _0x443196=qs[_0x5c1a('0x4a')](_0x220bee,_0x45e7b5);if(_0x45e7b5['query']['includeAll']){_0x443196[_0x5c1a('0x4f')]=[{'all':!![]}];}if(_0x45e7b5['query'][_0x5c1a('0x5e')]===_0x5c1a('0x54')){_0x443196[_0x5c1a('0x4f')]=[{'model':db[_0x5c1a('0x5f')],'as':_0x5c1a('0x5e')}];}_0x443196=_[_0x5c1a('0x60')]({},_0x443196,_0x45e7b5['options']);if(!_[_0x5c1a('0x39')](_0x443196[_0x5c1a('0x50')],'id')){_0x443196[_0x5c1a('0x50')][_0x5c1a('0x55')]('id');}return db['User'][_0x5c1a('0x3a')](_0x443196)['then'](handleEntityNotFound(_0x5e8b48,null))[_0x5c1a('0x20')](function(_0x38d886){var _0x3df119=[];values=_0x38d886;if(_0x45e7b5['query'][_0x5c1a('0x53')]===_0x5c1a('0x54')){_0x3df119[_0x5c1a('0x55')](get_open_tabs('chat',_0x38d886[_0x5c1a('0x57')]));_0x3df119[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x58'),_0x38d886[_0x5c1a('0x57')]));_0x3df119[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5b'),_0x38d886['dataValues']));_0x3df119[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5c'),_0x38d886[_0x5c1a('0x57')]));_0x3df119['push'](get_open_tabs(_0x5c1a('0x59'),_0x38d886[_0x5c1a('0x57')]));_0x3df119['push'](get_open_tabs(_0x5c1a('0x5a'),_0x38d886[_0x5c1a('0x57')]));return Promise['all'](_0x3df119);}else{return values;}})['then'](function(){return values;})[_0x5c1a('0x20')](respondWithResult(_0x5e8b48,null))['catch'](handleError(_0x5e8b48,null));};exports[_0x5c1a('0x2b')]=function(_0x20dbb5,_0xae31a1){if(_0x20dbb5[_0x5c1a('0x61')]['id']){delete _0x20dbb5[_0x5c1a('0x61')]['id'];}delete _0x20dbb5[_0x5c1a('0x61')][_0x5c1a('0x2c')];return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x20dbb5[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0xae31a1,null))[_0x5c1a('0x20')](saveUpdates(_0x20dbb5[_0x5c1a('0x61')],null))[_0x5c1a('0x20')](respondWithResult(_0xae31a1,null))['catch'](handleError(_0xae31a1,null));};exports['describe']=function(_0x589d9b,_0x203c31){return db['User'][_0x5c1a('0x62')]()[_0x5c1a('0x20')](respondWithResult(_0x203c31,null))['catch'](handleError(_0x203c31,null));};exports[_0x5c1a('0x63')]=function(_0x481cf6,_0x6667a0){return db['User'][_0x5c1a('0x3a')]({'where':{'id':_0x481cf6[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x6667a0,null))[_0x5c1a('0x20')](function(_0x26ea30){if(_0x26ea30){return _0x26ea30[_0x5c1a('0x63')](_0x481cf6['body'][_0x5c1a('0x64')],_[_0x5c1a('0x65')](_0x481cf6[_0x5c1a('0x61')],['ids','id'])||{});}})[_0x5c1a('0x20')](respondWithResult(_0x6667a0,null))[_0x5c1a('0x2a')](handleError(_0x6667a0,null));};function validateUser(_0x3a730d){return new Promise(function(_0x2df1a0,_0x41c123){if(_0x3a730d[_0x5c1a('0x66')])return _0x2df1a0(_0x3a730d);return db['Setting']['findById'](0x1)[_0x5c1a('0x20')](function(_0x2942c0){if(_0x2942c0[_0x5c1a('0x67')])authService[_0x5c1a('0x68')](_0x3a730d[_0x5c1a('0x45')]);db['User'][_0x5c1a('0x69')](_0x5c1a('0x66'))['then'](function(_0x403f2e){if(_[_0x5c1a('0x6a')](_0x403f2e)){_0x3a730d[_0x5c1a('0x66')]=_0x2942c0['min_internal']||0x1;return;}if(_['isNil'](_0x2942c0[_0x5c1a('0x6b')])||_0x2942c0[_0x5c1a('0x6b')]===_0x403f2e){_0x3a730d[_0x5c1a('0x66')]=_0x403f2e+0x1;return;}if(_0x2942c0['min_internal']>_0x403f2e){_0x3a730d[_0x5c1a('0x66')]=_0x2942c0['min_internal'];return;}return db[_0x5c1a('0x6c')][_0x5c1a('0x4d')](_0x5c1a('0x6d'),{'type':db[_0x5c1a('0x6c')][_0x5c1a('0x6e')]['SELECT']})[_0x5c1a('0x20')](function(_0x26106e){if(_0x26106e&&_0x26106e[_0x5c1a('0x6f')]){for(var _0x2cf816=0x0,_0x2b5c26=_0x26106e[_0x5c1a('0x6f')];_0x2cf816<_0x2b5c26&&_['isNil'](_0x3a730d[_0x5c1a('0x66')]);_0x2cf816++){if(_0x2942c0[_0x5c1a('0x6b')]<=_0x26106e[_0x2cf816]['from']){_0x3a730d[_0x5c1a('0x66')]=_0x26106e[_0x2cf816][_0x5c1a('0x70')];}else if(_0x2942c0[_0x5c1a('0x6b')]>_0x26106e[_0x2cf816][_0x5c1a('0x70')]&&_0x2942c0[_0x5c1a('0x6b')]<=_0x26106e[_0x2cf816]['to']){_0x3a730d[_0x5c1a('0x66')]=_0x2942c0[_0x5c1a('0x6b')];}}}if(_[_0x5c1a('0x6a')](_0x3a730d['internal'])){_0x3a730d[_0x5c1a('0x66')]=_0x403f2e+0x1;}return _0x2df1a0(_0x3a730d);});});})['catch'](function(_0x570d0c){_0x41c123(_0x570d0c);});});}function updateUser(_0x2f262f){return new Promise(function(_0x213f2e,_0x453bcd){try{if(_0x2f262f[_0x5c1a('0x71')]){_0x2f262f[_0x5c1a('0x72')]=_0x2f262f[_0x5c1a('0x66')];_0x2f262f['VoiceMail']={'mailbox':_0x2f262f[_0x5c1a('0x66')],'password':_0x2f262f[_0x5c1a('0x45')],'fullname':_0x2f262f['fullname'],'email':_0x2f262f[_0x5c1a('0x73')]};}if(_0x2f262f[_0x5c1a('0x2c')]===_0x5c1a('0x33')){if(!_0x2f262f[_0x5c1a('0x74')])_0x2f262f[_0x5c1a('0x74')]=['101',_0x5c1a('0x75'),'103',_0x5c1a('0x76'),_0x5c1a('0x77'),_0x5c1a('0x78'),_0x5c1a('0x79'),_0x5c1a('0x7a'),_0x5c1a('0x7b'),'108',_0x5c1a('0x7c'),'100',_0x5c1a('0x7d'),_0x5c1a('0x7e'),'115'];}_0x213f2e(_0x2f262f);}catch(_0x102008){_0x453bcd(_0x102008);}});}exports['create']=function(_0x282c4f,_0x59bc7e){if(_0x282c4f[_0x5c1a('0x7f')][_0x5c1a('0x2c')]===_0x5c1a('0x33'))throw new Error('Unauthorized');if(_0x282c4f[_0x5c1a('0x61')][_0x5c1a('0x2c')]===_0x5c1a('0x7f')&&_0x282c4f['user'][_0x5c1a('0x2c')]!==_0x5c1a('0x30')){throw new Error(_0x5c1a('0x80'));}if(_0x282c4f[_0x5c1a('0x61')]['role']==='admin'&&_0x282c4f['user'][_0x5c1a('0x2c')]!==_0x5c1a('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x5c1a('0x81')]([_0x282c4f[_0x5c1a('0x61')]])['then'](function(){return validateUser(_0x282c4f[_0x5c1a('0x61')]);})[_0x5c1a('0x20')](function(_0x37216e){return updateUser(_0x37216e)['then'](function(_0x498832){if(_0x498832['role']===_0x5c1a('0x30')){_0x498832['settingsEnabled']=_0x282c4f[_0x5c1a('0x7f')][_0x5c1a('0x82')];delete _0x498832[_0x5c1a('0x83')];}return _0x498832;});})['then'](function(_0x104608){return db[_0x5c1a('0x3f')][_0x5c1a('0x84')](_0x104608,{'include':[{'model':db[_0x5c1a('0x85')],'as':_0x5c1a('0x85')}]});})[_0x5c1a('0x20')](function(_0x5d0772){if(_0x282c4f['body']['role']==='user')return _0x5d0772;if(_0x282c4f[_0x5c1a('0x7f')][_0x5c1a('0x2c')]!==_0x5c1a('0x7f'))return _0x5d0772;return db[_0x5c1a('0x86')][_0x5c1a('0x3a')]({'where':{'name':_0x5d0772['role']==='agent'?_0x5c1a('0x32'):_0x5c1a('0x34'),'userProfileId':_0x282c4f[_0x5c1a('0x7f')][_0x5c1a('0x83')]},'raw':!![]})[_0x5c1a('0x20')](function(_0x17a1f2){if(!_0x17a1f2||_0x17a1f2[_0x5c1a('0x87')]!=0x0)return _0x5d0772;return db[_0x5c1a('0x3c')]['create']({'name':_0x5d0772[_0x5c1a('0x3b')],'resourceId':_0x5d0772['id'],'type':_0x17a1f2[_0x5c1a('0x3b')],'sectionId':_0x17a1f2['id']},{})['then'](function(){return _0x5d0772;});})[_0x5c1a('0x2a')](function(_0x4445c9){logger[_0x5c1a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4445c9);throw _0x4445c9;});})[_0x5c1a('0x20')](respondWithResult(_0x59bc7e,0xc9))['catch'](handleError(_0x59bc7e,null));};exports[_0x5c1a('0x88')]=function(_0x3696f3,_0x3cdcff){var _0x2becf4=_0x3696f3[_0x5c1a('0x61')];var _0x337e69=[];if(_0x3696f3[_0x5c1a('0x7f')][_0x5c1a('0x2c')]==='agent')throw new Error(_0x5c1a('0x89'));if(_[_0x5c1a('0x8a')](_0x2becf4,['role',_0x5c1a('0x7f')])&&_0x3696f3[_0x5c1a('0x7f')][_0x5c1a('0x2c')]!==_0x5c1a('0x30')){throw new Error(_0x5c1a('0x80'));}if(_[_0x5c1a('0x8a')](_0x2becf4,[_0x5c1a('0x2c'),_0x5c1a('0x30')])&&_0x3696f3[_0x5c1a('0x7f')][_0x5c1a('0x2c')]!==_0x5c1a('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x5c1a('0x81')](_0x2becf4)[_0x5c1a('0x20')](function(){return validateUser(_0x2becf4[0x0]);})['then'](function(){for(var _0x2fc3b7=0x1;_0x2fc3b7<_0x2becf4[_0x5c1a('0x6f')];_0x2fc3b7++){var _0x2c3d6a=_0x2becf4[_0x2fc3b7-0x1][_0x5c1a('0x66')];if(!_0x2becf4[_0x2fc3b7][_0x5c1a('0x66')])_0x2becf4[_0x2fc3b7][_0x5c1a('0x66')]=_0x2c3d6a+0x1;_0x337e69['push'](validateUser(_0x2becf4[_0x2fc3b7]));}return Promise[_0x5c1a('0x8b')](_0x337e69);})[_0x5c1a('0x20')](function(){_0x337e69=[];for(var _0x1f1351=0x0;_0x1f1351<_0x2becf4[_0x5c1a('0x6f')];_0x1f1351++){_0x337e69[_0x5c1a('0x55')](updateUser(_0x2becf4[_0x1f1351]));}return Promise['all'](_0x337e69);})[_0x5c1a('0x20')](function(){_0x337e69=_0x2becf4[_0x5c1a('0x37')](function(_0x311827){return db['User'][_0x5c1a('0x84')](_0x311827,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x5c1a('0x20')](function(_0x277b22){_0x311827['id']=_0x277b22['id'];return _0x311827;});});return Promise['all'](_0x337e69);})[_0x5c1a('0x20')](function(_0x241655){if(_0x3696f3[_0x5c1a('0x61')][_0x5c1a('0x2c')]==='user')return _0x241655;if(_0x3696f3['user']['role']!==_0x5c1a('0x7f'))return _0x241655;var _0x2e9c6b=_[_0x5c1a('0x8a')](_0x241655,function(_0x37f042){return _0x37f042['role']===_0x5c1a('0x33')||_0x37f042['role']==='telephone';});if(!_0x2e9c6b)return _0x241655;return db['UserProfileSection'][_0x5c1a('0x51')]({'where':{'name':{'$or':[_0x5c1a('0x32'),'Telephones']},'userProfileId':_0x3696f3[_0x5c1a('0x7f')][_0x5c1a('0x83')]},'raw':!![]})[_0x5c1a('0x20')](function(_0x12f775){if(_[_0x5c1a('0x8c')](_0x12f775)||!_[_0x5c1a('0x8a')](_0x12f775,[_0x5c1a('0x87'),0x0]))return _0x241655;_0x337e69=[];var _0x327726=_(_0x12f775)[_0x5c1a('0x37')](function(_0x4d952d){if(_0x4d952d[_0x5c1a('0x87')]===0x1)return;return _0x4d952d[_0x5c1a('0x3b')]===_0x5c1a('0x32')?'agent':_0x5c1a('0x35');})[_0x5c1a('0x8d')]()[_0x5c1a('0x38')]();for(var _0x30d510=0x0;_0x30d510<_0x241655[_0x5c1a('0x6f')];_0x30d510++){if(!_[_0x5c1a('0x39')](_0x327726,_0x241655[_0x30d510][_0x5c1a('0x2c')]))return;var _0x5727a7=_0x241655[_0x30d510][_0x5c1a('0x2c')]===_0x5c1a('0x33')?'Agents':_0x5c1a('0x34');_0x337e69[_0x5c1a('0x55')](db[_0x5c1a('0x3c')][_0x5c1a('0x84')]({'name':_0x241655[_0x30d510][_0x5c1a('0x3b')],'resourceId':_0x241655[_0x30d510]['id'],'type':_0x5727a7,'sectionId':_[_0x5c1a('0x3a')](_0x12f775,[_0x5c1a('0x3b'),_0x5727a7])['id']},{}));}return Promise['all'](_0x337e69);});})['then'](respondWithResult(_0x3cdcff,0xc9))[_0x5c1a('0x2a')](handleError(_0x3cdcff,null));};exports[_0x5c1a('0x8e')]=function(_0x2d7cbe,_0x3d76fa){if(_0x2d7cbe[_0x5c1a('0x61')]['id']){delete _0x2d7cbe['body']['id'];}return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x2d7cbe[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](function(_0x2cd6d4){if(!_0x2cd6d4)return null;if(_0x2cd6d4['id']===_0x2d7cbe[_0x5c1a('0x7f')]['id']){if(!_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x8f')]||!_0x2d7cbe['body'][_0x5c1a('0x90')]){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2cd6d4[_0x5c1a('0x93')](_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x8f')])){throw new db[(_0x5c1a('0x91'))]['ValidationError'](_0x5c1a('0x94'));}if(_0x2d7cbe['body']['oldPassword']===_0x2d7cbe['body']['newPassword']){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2d7cbe[_0x5c1a('0x7f')]['role']===_0x5c1a('0x30')){if(!_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x90')]){throw new db[(_0x5c1a('0x91'))]['ValidationError'](_0x5c1a('0x95'));}}else if(_0x2d7cbe['user'][_0x5c1a('0x2c')]===_0x5c1a('0x7f')){if(!_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x90')]){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0x95'));}if(_0x2cd6d4[_0x5c1a('0x2c')]!==_0x5c1a('0x33')){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0x89'));}}else{throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0x89'));}return _0x2cd6d4;})[_0x5c1a('0x20')](handleEntityNotFound(_0x3d76fa,null))[_0x5c1a('0x20')](function(_0x11e6ba){return db['Setting'][_0x5c1a('0x96')]({'attributes':['id',_0x5c1a('0x67'),_0x5c1a('0x97'),_0x5c1a('0x98')]})[_0x5c1a('0x20')](function(_0x21db4c){if(_0x21db4c[_0x5c1a('0x67')])authService[_0x5c1a('0x68')](_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x90')]);if(!_0x21db4c[_0x5c1a('0x97')]||!_0x11e6ba[_0x5c1a('0x99')])return _0x11e6ba;authService[_0x5c1a('0x9a')](_0x2d7cbe['body'][_0x5c1a('0x90')],_0x11e6ba['previousPasswords'],_0x21db4c[_0x5c1a('0x98')]);return _0x11e6ba;})['then'](saveUpdates({'password':_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x90')],'passwordResetAt':_0x2d7cbe[_0x5c1a('0x7f')]['id']==_0x2d7cbe[_0x5c1a('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x5c1a('0x9b')](_0x2d7cbe[_0x5c1a('0x61')][_0x5c1a('0x90')],_0x11e6ba[_0x5c1a('0x99')])},null));})[_0x5c1a('0x20')](respondWithResult(_0x3d76fa,null))[_0x5c1a('0x2a')](handleError(_0x3d76fa,null));};exports[_0x5c1a('0x9c')]=function(_0x1bdeab,_0x584e7e){var _0x33c664=_0x1bdeab[_0x5c1a('0x61')][_0x5c1a('0x9d')];return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x1bdeab['params']['id']},'attributes':['id','name',_0x5c1a('0x2c'),_0x5c1a('0x9e'),_0x5c1a('0x9f'),_0x5c1a('0xa0'),_0x5c1a('0xa1')]})['then'](handleEntityNotFound(_0x584e7e,null))['then'](function(_0x1c4a22){if(_0x1c4a22){if(!utils['isValidChannel'](_0x33c664)){throw new db['Sequelize'][(_0x5c1a('0x92'))](_0x5c1a('0xa2'));}return _0x1c4a22[_0x5c1a('0xa3')+_[_0x5c1a('0xa4')](_0x33c664[_0x5c1a('0xa5')]())+'Queues'](_0x1bdeab['body'][_0x5c1a('0x64')],{'penalty':_0x1bdeab[_0x5c1a('0x61')][_0x5c1a('0xa6')]||0x0})['spread'](function(_0xa476ee){for(var _0x71fa53=0x0;_0x71fa53<_0x1bdeab[_0x5c1a('0x61')][_0x5c1a('0x64')][_0x5c1a('0x6f')];_0x71fa53+=0x1){var _0x232eb1={'UserId':Number(_0x1bdeab[_0x5c1a('0x5d')]['id'])};_0x232eb1[_['capitalize'](_0x33c664[_0x5c1a('0xa5')]())+_0x5c1a('0xa7')]=Number(_0x1bdeab['body']['ids'][_0x71fa53]);socket[_0x5c1a('0x2d')](_0x5c1a('0x7f')+_[_0x5c1a('0xa4')](_0x33c664[_0x5c1a('0xa5')]())+_0x5c1a('0xa8'),_0x232eb1);}return _0xa476ee;})[_0x5c1a('0x20')](function(){if(_0x33c664==='voice'){return db[_0x5c1a('0xa9')][_0x5c1a('0x51')]({'where':{'id':_0x1bdeab[_0x5c1a('0x61')][_0x5c1a('0x64')]||[]},'raw':!![],'attributes':['id',_0x5c1a('0x3b')]});}})[_0x5c1a('0x20')](function(_0x489d2b){var _0x401a34=_0x1c4a22['get']({'plain':!![]});var _0x59d04c=[];if(_0x33c664===_0x5c1a('0xaa')&&_0x401a34[_0x5c1a('0x2c')]===_0x5c1a('0x33')&&_0x401a34[_0x5c1a('0x9e')]){for(let _0x29190a=0x0;_0x29190a<_0x489d2b['length'];_0x29190a+=0x1){_0x59d04c[_0x5c1a('0x55')]({'membername':_0x401a34[_0x5c1a('0x3b')],'UserId':_0x401a34['id'],'queue_name':_0x489d2b[_0x29190a]['name'],'VoiceQueueId':_0x489d2b[_0x29190a]['id'],'interface':_[_0x5c1a('0x6a')](_0x401a34[_0x5c1a('0xa1')])?util[_0x5c1a('0xab')](_0x5c1a('0xac'),_0x401a34[_0x5c1a('0x3b')]):_0x401a34[_0x5c1a('0xa1')],'paused':_0x401a34[_0x5c1a('0xa0')]||![],'penalty':_0x1bdeab['body'][_0x5c1a('0xa6')]||0x0});}return Promise[_0x5c1a('0x8b')](_0x59d04c[_0x5c1a('0x37')](function(_0x509ff3){return db['UserVoiceQueueRt'][_0x5c1a('0xad')](_0x509ff3);}));}return _0x1c4a22;});}})['then'](respondWithStatusCode(_0x584e7e,null))['catch'](handleError(_0x584e7e,null));};exports[_0x5c1a('0xae')]=function(_0x21948b,_0x4ba745){var _0x53ef01,_0x196f63;return db[_0x5c1a('0x3f')]['find']({'where':{'id':_0x21948b[_0x5c1a('0x5d')]['id']},'attributes':['id',_0x5c1a('0x3b'),'role']})[_0x5c1a('0x20')](handleEntityNotFound(_0x4ba745,null))[_0x5c1a('0x20')](function(_0x1aaf1a){if(_0x1aaf1a){_0x53ef01=_0x1aaf1a;if(!_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')]||!utils[_0x5c1a('0xaf')](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')])){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0xa2'));}return _0x1aaf1a[_0x5c1a('0xb0')+_[_0x5c1a('0xa4')](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')][_0x5c1a('0xa5')]())+_0x5c1a('0xb1')](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x64')]);}})['then'](function(_0x1e1f83){if(_['isArray'](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x64')])){for(var _0x381faa=0x0;_0x381faa<_0x21948b['query'][_0x5c1a('0x64')][_0x5c1a('0x6f')];_0x381faa+=0x1){_0x196f63={'UserId':Number(_0x21948b[_0x5c1a('0x5d')]['id'])};_0x196f63[_[_0x5c1a('0xa4')](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')][_0x5c1a('0xa5')]())+_0x5c1a('0xa7')]=Number(_0x21948b['query'][_0x5c1a('0x64')][_0x381faa]);socket['emit'](_0x5c1a('0x7f')+_[_0x5c1a('0xa4')](_0x21948b['query'][_0x5c1a('0x9d')]['toLowerCase']())+_0x5c1a('0xb2'),_0x196f63);}}else{_0x196f63={'UserId':Number(_0x21948b['params']['id'])};_0x196f63[_[_0x5c1a('0xa4')](_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')][_0x5c1a('0xa5')]())+_0x5c1a('0xa7')]=Number(_0x21948b[_0x5c1a('0x4d')]['ids']);socket[_0x5c1a('0x2d')](_0x5c1a('0x7f')+_['capitalize'](_0x21948b['query'][_0x5c1a('0x9d')][_0x5c1a('0xa5')]())+'Queue:remove',_0x196f63);}return _0x1e1f83;})[_0x5c1a('0x20')](function(){if(_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x9d')]===_0x5c1a('0xaa')){return db[_0x5c1a('0xb3')]['destroy']({'where':{'UserId':_0x21948b[_0x5c1a('0x5d')]['id'],'VoiceQueueId':_0x21948b[_0x5c1a('0x4d')][_0x5c1a('0x64')]},'individualHooks':!![]})['then'](function(){return _0x53ef01;});}return _0x53ef01;})['then'](respondWithStatusCode(_0x4ba745,null))[_0x5c1a('0x2a')](handleError(_0x4ba745,null));};exports['addAvatar']=function(_0xbac1ac,_0x68e645){_0xbac1ac[_0x5c1a('0x61')][_0x5c1a('0xb4')]=_0xbac1ac[_0x5c1a('0xb5')][_0x5c1a('0xb6')];return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0xbac1ac['params']['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x68e645,null))[_0x5c1a('0x20')](saveUpdates(_0xbac1ac[_0x5c1a('0x61')],null))[_0x5c1a('0x20')](respondWithResult(_0x68e645,null))[_0x5c1a('0x2a')](handleError(_0x68e645,null));};exports[_0x5c1a('0xb7')]=function(_0x2b9ed7,_0x2820c1){var _0x36de68=path[_0x5c1a('0xb8')](config[_0x5c1a('0xb9')],_0x5c1a('0xba'));return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x2b9ed7['params']['id']},'attributes':['id',_0x5c1a('0xb4')],'raw':!![]})[_0x5c1a('0x20')](handleEntityNotFound(_0x2820c1,null))['then'](function(_0x43c0bd){if(_0x43c0bd){if(_[_0x5c1a('0x6a')](_0x43c0bd[_0x5c1a('0xb4')])){return _0x2820c1[_0x5c1a('0xbb')](_0x36de68);}else{if(!fs['existsSync'](path['join'](config['root'],_0x5c1a('0xbc'),_0x43c0bd[_0x5c1a('0xb4')]))){return _0x2820c1['download'](_0x36de68);}return _0x2820c1[_0x5c1a('0xbb')](path[_0x5c1a('0xb8')](config[_0x5c1a('0xb9')],_0x5c1a('0xbc'),_0x43c0bd['userpic']));}}})[_0x5c1a('0x2a')](handleError(_0x2820c1,null));};exports[_0x5c1a('0xbd')]=function(_0x41bf0c,_0x3365bf){return db['User'][_0x5c1a('0x3a')]({'where':{'id':_0x41bf0c[_0x5c1a('0x5d')]['id']},'attributes':['id']})[_0x5c1a('0x20')](handleEntityNotFound(_0x3365bf,null))['then'](function(_0xc858d7){var _0x5b3d80=[];values=_0xc858d7[_0x5c1a('0x57')];_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x56'),_0xc858d7[_0x5c1a('0x57')]));_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x58'),_0xc858d7[_0x5c1a('0x57')]));_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5b'),_0xc858d7[_0x5c1a('0x57')]));_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5c'),_0xc858d7[_0x5c1a('0x57')]));_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x59'),_0xc858d7['dataValues']));_0x5b3d80[_0x5c1a('0x55')](get_open_tabs(_0x5c1a('0x5a'),_0xc858d7['dataValues']));return Promise[_0x5c1a('0x8b')](_0x5b3d80);})[_0x5c1a('0x20')](function(_0x358301){if(_0x358301){var _0x1687a7=_[_0x5c1a('0x37')](values[_0x5c1a('0xbe')],function(_0x458a0a){return{'channel':_0x5c1a('0xbf'),'id':_0x458a0a['id'],'createdAt':_0x458a0a[_0x5c1a('0xc0')]};});var _0x55ff02=_['map'](values[_0x5c1a('0xc1')],function(_0x3750f5){return{'channel':_0x5c1a('0xc2'),'id':_0x3750f5['id'],'createdAt':_0x3750f5[_0x5c1a('0xc0')]};});var _0x22676b=_[_0x5c1a('0x37')](values['OpenchannelOpenTabs'],function(_0x3507cb){return{'channel':_0x5c1a('0xc3'),'id':_0x3507cb['id'],'createdAt':_0x3507cb[_0x5c1a('0xc0')]};});var _0x3713c1=_[_0x5c1a('0x37')](values['MailOpenTabs'],function(_0x521044){return{'channel':'MAIL','id':_0x521044['id'],'createdAt':_0x521044[_0x5c1a('0xc0')]};});var _0x26a16a=_[_0x5c1a('0x37')](values[_0x5c1a('0xc4')],function(_0x5d1203){return{'channel':_0x5c1a('0xc5'),'id':_0x5d1203['id'],'createdAt':_0x5d1203[_0x5c1a('0xc0')]};});var _0x4d438c=_[_0x5c1a('0x37')](values[_0x5c1a('0xc6')],function(_0x11c99e){return{'channel':_0x5c1a('0xc7'),'id':_0x11c99e['id'],'createdAt':_0x11c99e[_0x5c1a('0xc0')]};});var _0x1184fd=_[_0x5c1a('0xc8')](_0x1687a7,_0x55ff02,_0x22676b,_0x3713c1,_0x26a16a,_0x4d438c);var _0x15ab2b={'count':_0x1184fd[_0x5c1a('0x6f')],'rows':_0x1184fd};return _0x15ab2b;}else return null;})['then'](respondWithResult(_0x3365bf,null))['catch'](handleError(_0x3365bf,null));};exports[_0x5c1a('0xc9')]=function(_0x118c64,_0x53104d){var _0x10e365={};return db['User'][_0x5c1a('0x96')]({'where':{'id':_0x118c64[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](function(_0x4ac7a1){if(!_0x4ac7a1){throw new APINotFoundError(util[_0x5c1a('0xab')](_0x5c1a('0xca'),_0x118c64[_0x5c1a('0x5d')]['id']));}return contacts[_0x5c1a('0x62')]();})[_0x5c1a('0x20')](function(_0x488772){_0x118c64['query'][_0x5c1a('0x3f')]=_0x118c64[_0x5c1a('0x5d')]['id'];_0x10e365=qs['getOptions'](_0x488772,_0x118c64);if(_0x118c64['query'][_0x5c1a('0xcb')](_0x5c1a('0x4e'))){_0x10e365['include']=[{'model':db[_0x5c1a('0xcc')],'as':_0x5c1a('0xcd'),'required':![]},{'model':db[_0x5c1a('0xce')],'as':'Tags','attributes':['id',_0x5c1a('0x3b'),'color'],'where':_0x118c64[_0x5c1a('0x4d')][_0x5c1a('0xcf')]?{'id':_0x118c64[_0x5c1a('0x4d')][_0x5c1a('0xcf')]}:undefined,'required':_0x118c64['query'][_0x5c1a('0xcf')]?!![]:![]}];}return contacts[_0x5c1a('0x51')](_0x118c64['query'],_0x118c64[_0x5c1a('0x7f')],_0x10e365,_0x488772);})[_0x5c1a('0x20')](respondWithFilteredResult(_0x53104d,_0x10e365))[_0x5c1a('0x2a')](APIHandleError(_0x53104d));};exports['getQueues']=function(_0x3b8c71,_0xeb1365){var _0x414182;var _0x315a83={};var _0x3460e4;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x3b8c71[_0x5c1a('0x5d')]['id']},'attributes':['id',_0x5c1a('0x3b'),_0x5c1a('0x2c')]})[_0x5c1a('0x20')](handleEntityNotFound(_0xeb1365,null))[_0x5c1a('0x20')](function(_0x44e4ec){if(!utils[_0x5c1a('0xaf')](_0x3b8c71[_0x5c1a('0x4d')][_0x5c1a('0x9d')])){throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))]('Unknown\x20channel');}_0x414182=_0x44e4ec;var _0x3d40e8={};_0x3d40e8['model']=_[_0x5c1a('0xd0')](db[_['capitalize'](_0x3b8c71['query'][_0x5c1a('0x9d')])+_0x5c1a('0xd1')][_0x5c1a('0x40')]);_0x3d40e8[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x3b8c71[_0x5c1a('0x4d')]);_0x3d40e8['filters']=_[_0x5c1a('0xd2')](_0x3d40e8[_0x5c1a('0xd3')],_0x3d40e8[_0x5c1a('0x4d')]);_0x315a83[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x3d40e8[_0x5c1a('0xd3')],qs[_0x5c1a('0xd4')](_0x3b8c71[_0x5c1a('0x4d')][_0x5c1a('0xd4')]));_0x315a83[_0x5c1a('0x50')]=_0x315a83[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x315a83[_0x5c1a('0x50')]:_0x3d40e8[_0x5c1a('0xd3')];_0x315a83['order']=qs['sort'](_0x3b8c71[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x315a83['where']=qs['filters'](_[_0x5c1a('0xd6')](_0x3b8c71[_0x5c1a('0x4d')],_0x3d40e8[_0x5c1a('0xd7')]));if(_0x3b8c71[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x315a83[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x315a83[_0x5c1a('0x4b')],{'$or':_['map'](_0x315a83[_0x5c1a('0x50')],function(_0x18d462){var _0x579ade={};_0x579ade[_0x18d462]={'$like':'%'+_0x3b8c71['query'][_0x5c1a('0x44')]+'%'};return _0x579ade;})});}_0x315a83=_[_0x5c1a('0x60')]({},_0x315a83,_0x3b8c71[_0x5c1a('0xd8')]);switch(_0x414182[_0x5c1a('0x2c')]){case _0x5c1a('0x30'):return db[_['capitalize'](_0x3b8c71[_0x5c1a('0x4d')]['channel'])+_0x5c1a('0xd1')][_0x5c1a('0x51')](_0x315a83);case _0x5c1a('0x7f'):case'agent':return _0x414182[_0x5c1a('0xd9')+_[_0x5c1a('0xa4')](_0x3b8c71[_0x5c1a('0x4d')]['channel'])+'Queues'](_0x315a83);default:throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0xda'));}})[_0x5c1a('0x20')](function(_0x147e0f){_0x3460e4=_0x147e0f['length'];if(!_0x3b8c71[_0x5c1a('0x4d')]['hasOwnProperty'](_0x5c1a('0xdb'))){_0x315a83['limit']=qs[_0x5c1a('0x1c')](_0x3b8c71['query'][_0x5c1a('0x1c')]);_0x315a83['offset']=qs[_0x5c1a('0x1d')](_0x3b8c71[_0x5c1a('0x4d')]['offset']);}switch(_0x414182[_0x5c1a('0x2c')]){case _0x5c1a('0x30'):return db[_[_0x5c1a('0xa4')](_0x3b8c71[_0x5c1a('0x4d')][_0x5c1a('0x9d')])+_0x5c1a('0xd1')][_0x5c1a('0x51')](_0x315a83);case _0x5c1a('0x7f'):case _0x5c1a('0x33'):return _0x414182[_0x5c1a('0xd9')+_['capitalize'](_0x3b8c71[_0x5c1a('0x4d')]['channel'])+'Queues'](_0x315a83);}})[_0x5c1a('0x20')](function(_0x51924e){return{'count':_0x3460e4,'rows':_0x51924e};})[_0x5c1a('0x20')](respondWithResult(_0xeb1365,null))[_0x5c1a('0x2a')](handleError(_0xeb1365,null));};exports[_0x5c1a('0xdc')]=function(_0xc625cc,_0x5deb42){var _0x4cef9f={};var _0x1a8a82={};var _0x42f417;var _0x38ebe3;return db['User']['findOne']({'where':{'id':_0xc625cc[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x5deb42,null))['then'](function(_0x21e2f7){if(_0x21e2f7){_0x42f417=_0x21e2f7;_0x1a8a82[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xb3')]['rawAttributes']);_0x1a8a82['query']=_[_0x5c1a('0xd0')](_0xc625cc[_0x5c1a('0x4d')]);_0x1a8a82[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x1a8a82[_0x5c1a('0xd3')],_0x1a8a82[_0x5c1a('0x4d')]);_0x4cef9f[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x1a8a82[_0x5c1a('0xd3')],qs[_0x5c1a('0xd4')](_0xc625cc['query']['fields']));_0x4cef9f[_0x5c1a('0x50')]=_0x4cef9f[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x4cef9f[_0x5c1a('0x50')]:_0x1a8a82[_0x5c1a('0xd3')];_0x4cef9f[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0xc625cc['query'][_0x5c1a('0xd5')]);_0x4cef9f[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_['pick'](_0xc625cc['query'],_0x1a8a82['filters']));if(_0xc625cc[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x4cef9f[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x4cef9f[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x4cef9f[_0x5c1a('0x50')],function(_0x12c4b6){var _0x9e3174={};_0x9e3174[_0x12c4b6]={'$like':'%'+_0xc625cc[_0x5c1a('0x4d')]['filter']+'%'};return _0x9e3174;})});}_0x4cef9f=_[_0x5c1a('0x60')]({},_0x4cef9f,_0xc625cc[_0x5c1a('0xd8')]);return _0x42f417['getVoiceQueuesRt'](_0x4cef9f);}})[_0x5c1a('0x20')](function(_0x3e115b){if(_0x3e115b){_0x38ebe3=_0x3e115b[_0x5c1a('0x6f')];if(!_0xc625cc[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x4cef9f[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0xc625cc[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x4cef9f[_0x5c1a('0x1d')]=qs[_0x5c1a('0x1d')](_0xc625cc[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0x42f417[_0x5c1a('0xdc')](_0x4cef9f);}})[_0x5c1a('0x20')](function(_0x2b376a){if(_0x2b376a){return _0x2b376a?{'count':_0x38ebe3,'rows':_0x2b376a}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x5deb42,null))[_0x5c1a('0x2a')](handleError(_0x5deb42,null));};exports[_0x5c1a('0xde')]=function(_0x1c384b,_0x36b891){var _0x466725={};var _0x16deec={};var _0x5b45e8;var _0x2f7e39;return db[_0x5c1a('0x3f')]['findOne']({'where':{'id':_0x1c384b[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x36b891,null))[_0x5c1a('0x20')](function(_0xc54371){if(_0xc54371){_0x5b45e8=_0xc54371;_0x16deec[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xdf')][_0x5c1a('0x40')]);_0x16deec[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x1c384b[_0x5c1a('0x4d')]);_0x16deec[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x16deec[_0x5c1a('0xd3')],_0x16deec[_0x5c1a('0x4d')]);_0x466725[_0x5c1a('0x50')]=_['intersection'](_0x16deec[_0x5c1a('0xd3')],qs['fields'](_0x1c384b[_0x5c1a('0x4d')]['fields']));_0x466725[_0x5c1a('0x50')]=_0x466725['attributes'][_0x5c1a('0x6f')]?_0x466725[_0x5c1a('0x50')]:_0x16deec[_0x5c1a('0xd3')];_0x466725['order']=qs[_0x5c1a('0xd5')](_0x1c384b[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x466725['where']=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x1c384b[_0x5c1a('0x4d')],_0x16deec[_0x5c1a('0xd7')]));if(_0x1c384b[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x466725[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x466725[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x466725['attributes'],function(_0x1932fb){var _0x4267e7={};_0x4267e7[_0x1932fb]={'$like':'%'+_0x1c384b['query'][_0x5c1a('0x44')]+'%'};return _0x4267e7;})});}_0x466725=_[_0x5c1a('0x60')]({},_0x466725,_0x1c384b[_0x5c1a('0xd8')]);return _0x5b45e8[_0x5c1a('0xde')](_0x466725);}})[_0x5c1a('0x20')](function(_0x3f589f){if(_0x3f589f){_0x2f7e39=_0x3f589f['length'];if(!_0x1c384b[_0x5c1a('0x4d')][_0x5c1a('0xcb')]('nolimit')){_0x466725['limit']=qs['limit'](_0x1c384b['query'][_0x5c1a('0x1c')]);_0x466725['offset']=qs[_0x5c1a('0x1d')](_0x1c384b['query']['offset']);}return _0x5b45e8[_0x5c1a('0xde')](_0x466725);}})[_0x5c1a('0x20')](function(_0x16073e){if(_0x16073e){return _0x16073e?{'count':_0x2f7e39,'rows':_0x16073e}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x36b891,null))[_0x5c1a('0x2a')](handleError(_0x36b891,null));};exports['getRecordings']=function(_0x21b48b,_0x231815){var _0x5213b5={'raw':!![],'where':{}};var _0x508fab={};var _0x5cba13={'count':0x0,'rows':[]};return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x21b48b['params']['id']}})['then'](handleEntityNotFound(_0x231815,null))[_0x5c1a('0x20')](function(_0x486a32){if(_0x486a32){_0x508fab['model']=_[_0x5c1a('0xd0')](db['VoiceRecording'][_0x5c1a('0x40')]);_0x508fab[_0x5c1a('0x4d')]=_['keys'](_0x21b48b[_0x5c1a('0x4d')]);_0x508fab[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x508fab[_0x5c1a('0xd3')],_0x508fab[_0x5c1a('0x4d')]);_0x5213b5['attributes']=_['intersection'](_0x508fab[_0x5c1a('0xd3')],qs[_0x5c1a('0xd4')](_0x21b48b[_0x5c1a('0x4d')]['fields']));_0x5213b5[_0x5c1a('0x50')]=_0x5213b5[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x5213b5[_0x5c1a('0x50')]:_0x508fab[_0x5c1a('0xd3')];if(!_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x5213b5[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x5213b5[_0x5c1a('0x1d')]=qs['offset'](_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}_0x5213b5[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x5213b5['where']=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x21b48b[_0x5c1a('0x4d')],_0x508fab[_0x5c1a('0xd7')]));_0x5213b5[_0x5c1a('0x4b')][_0x5c1a('0xe0')]=_0x486a32['id'];if(_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x5213b5[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x5213b5[_0x5c1a('0x4b')],{'$or':_['map'](_0x5213b5[_0x5c1a('0x50')],function(_0x5a9d15){var _0x12c54f={};_0x12c54f[_0x5a9d15]={'$like':'%'+_0x21b48b[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x12c54f;})});}_0x5213b5=_[_0x5c1a('0x60')]({},_0x5213b5,_0x21b48b['options']);return db[_0x5c1a('0xe1')][_0x5c1a('0x4c')]({'where':_0x5213b5[_0x5c1a('0x4b')]})[_0x5c1a('0x20')](function(_0x42b3c4){_0x5cba13[_0x5c1a('0x4c')]=_0x42b3c4;if(_0x21b48b['query'][_0x5c1a('0x4e')]){_0x5213b5[_0x5c1a('0x4f')]=[{'all':!![]}];}return db[_0x5c1a('0xe1')][_0x5c1a('0x51')](_0x5213b5);})['then'](function(_0x52244f){_0x5cba13[_0x5c1a('0x52')]=_0x52244f;return _0x5cba13;});}})[_0x5c1a('0x20')](respondWithFilteredResult(_0x231815,_0x5213b5))[_0x5c1a('0x2a')](handleError(_0x231815,null));};exports[_0x5c1a('0xe2')]=function(_0x5d9ae6,_0x21442b){var _0x425583={'raw':!![],'where':{}};var _0x3602aa={};var _0x49e884={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x5d9ae6[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x21442b,null))[_0x5c1a('0x20')](function(_0x45de51){if(_0x45de51){_0x3602aa[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db['ScreenRecording'][_0x5c1a('0x40')]);_0x3602aa['query']=_['keys'](_0x5d9ae6[_0x5c1a('0x4d')]);_0x3602aa['filters']=_['intersection'](_0x3602aa['model'],_0x3602aa[_0x5c1a('0x4d')]);_0x425583[_0x5c1a('0x50')]=_['intersection'](_0x3602aa['model'],qs[_0x5c1a('0xd4')](_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0xd4')]));_0x425583['attributes']=_0x425583[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x425583[_0x5c1a('0x50')]:_0x3602aa[_0x5c1a('0xd3')];if(!_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x425583['limit']=qs[_0x5c1a('0x1c')](_0x5d9ae6[_0x5c1a('0x4d')]['limit']);_0x425583['offset']=qs[_0x5c1a('0x1d')](_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}_0x425583[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x425583[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x5d9ae6[_0x5c1a('0x4d')],_0x3602aa['filters']));_0x425583[_0x5c1a('0x4b')][_0x5c1a('0xe0')]=_0x45de51['id'];if(_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x425583[_0x5c1a('0x4b')]=_['merge'](_0x425583[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x425583['attributes'],function(_0x20bab0){var _0x27396f={};_0x27396f[_0x20bab0]={'$like':'%'+_0x5d9ae6['query'][_0x5c1a('0x44')]+'%'};return _0x27396f;})});}_0x425583=_[_0x5c1a('0x60')]({},_0x425583,_0x5d9ae6[_0x5c1a('0xd8')]);return db['ScreenRecording']['count']({'where':_0x425583[_0x5c1a('0x4b')]})[_0x5c1a('0x20')](function(_0x319e48){_0x49e884[_0x5c1a('0x4c')]=_0x319e48;if(_0x5d9ae6[_0x5c1a('0x4d')][_0x5c1a('0x4e')]){_0x425583[_0x5c1a('0x4f')]=[{'all':!![]}];}return db[_0x5c1a('0xe3')][_0x5c1a('0x51')](_0x425583);})['then'](function(_0x496579){_0x49e884[_0x5c1a('0x52')]=_0x496579;return _0x49e884;});}})[_0x5c1a('0x20')](respondWithFilteredResult(_0x21442b,_0x425583))[_0x5c1a('0x2a')](handleError(_0x21442b,null));};exports['getChatInteractions']=function(_0x1605ff,_0x509b00){var _0x617509={};var _0x28971c={};var _0x317174;var _0x41bb65;return db['User'][_0x5c1a('0x96')]({'where':{'id':_0x1605ff['params']['id']}})['then'](handleEntityNotFound(_0x509b00,null))[_0x5c1a('0x20')](function(_0x11db44){if(_0x11db44){_0x317174=_0x11db44;_0x28971c['model']=_['keys'](db['ChatInteraction']['rawAttributes']);_0x28971c[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x1605ff[_0x5c1a('0x4d')]);_0x28971c[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x28971c[_0x5c1a('0xd3')],_0x28971c[_0x5c1a('0x4d')]);_0x617509[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x28971c[_0x5c1a('0xd3')],qs['fields'](_0x1605ff['query'][_0x5c1a('0xd4')]));_0x617509[_0x5c1a('0x50')]=_0x617509[_0x5c1a('0x50')]['length']?_0x617509[_0x5c1a('0x50')]:_0x28971c[_0x5c1a('0xd3')];_0x617509['order']=qs[_0x5c1a('0xd5')](_0x1605ff[_0x5c1a('0x4d')]['sort']);_0x617509['where']=qs['filters'](_[_0x5c1a('0xd6')](_0x1605ff[_0x5c1a('0x4d')],_0x28971c[_0x5c1a('0xd7')]));if(_0x1605ff['query']['filter']){_0x617509[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x617509[_0x5c1a('0x4b')],{'$or':_['map'](_0x617509['attributes'],function(_0x417f9e){var _0x3015e5={};_0x3015e5[_0x417f9e]={'$like':'%'+_0x1605ff[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x3015e5;})});}_0x617509=_[_0x5c1a('0x60')]({},_0x617509,_0x1605ff[_0x5c1a('0xd8')]);return _0x317174[_0x5c1a('0xe4')](_0x617509);}})['then'](function(_0x17436f){if(_0x17436f){_0x41bb65=_0x17436f['length'];if(!_0x1605ff[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x617509[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x1605ff[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x617509[_0x5c1a('0x1d')]=qs[_0x5c1a('0x1d')](_0x1605ff[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0x317174[_0x5c1a('0xe4')](_0x617509);}})[_0x5c1a('0x20')](function(_0xf3783a){if(_0xf3783a){return _0xf3783a?{'count':_0x41bb65,'rows':_0xf3783a}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x509b00,null))['catch'](handleError(_0x509b00,null));};exports[_0x5c1a('0xe5')]=function(_0x413ec8,_0x3a52b6){var _0x5668ec={};var _0x1c0421={};var _0xe883ba;var _0x48c746;return db[_0x5c1a('0x3f')]['findOne']({'where':{'id':_0x413ec8[_0x5c1a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3a52b6,null))[_0x5c1a('0x20')](function(_0x24646a){if(_0x24646a){_0xe883ba=_0x24646a;_0x1c0421['model']=_['keys'](db[_0x5c1a('0xe6')]['rawAttributes']);_0x1c0421[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x413ec8[_0x5c1a('0x4d')]);_0x1c0421[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x1c0421[_0x5c1a('0xd3')],_0x1c0421[_0x5c1a('0x4d')]);_0x5668ec[_0x5c1a('0x50')]=_['intersection'](_0x1c0421['model'],qs[_0x5c1a('0xd4')](_0x413ec8[_0x5c1a('0x4d')]['fields']));_0x5668ec[_0x5c1a('0x50')]=_0x5668ec[_0x5c1a('0x50')]['length']?_0x5668ec[_0x5c1a('0x50')]:_0x1c0421[_0x5c1a('0xd3')];_0x5668ec[_0x5c1a('0xdd')]=qs['sort'](_0x413ec8[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x5668ec[_0x5c1a('0x4b')]=qs['filters'](_[_0x5c1a('0xd6')](_0x413ec8['query'],_0x1c0421['filters']));if(_0x413ec8[_0x5c1a('0x4d')]['filter']){_0x5668ec['where']=_[_0x5c1a('0x60')](_0x5668ec[_0x5c1a('0x4b')],{'$or':_['map'](_0x5668ec[_0x5c1a('0x50')],function(_0x418594){var _0x4258a0={};_0x4258a0[_0x418594]={'$like':'%'+_0x413ec8[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x4258a0;})});}_0x5668ec=_[_0x5c1a('0x60')]({},_0x5668ec,_0x413ec8[_0x5c1a('0xd8')]);return _0xe883ba[_0x5c1a('0xe5')](_0x5668ec);}})[_0x5c1a('0x20')](function(_0x452db9){if(_0x452db9){_0x48c746=_0x452db9[_0x5c1a('0x6f')];if(!_0x413ec8[_0x5c1a('0x4d')]['hasOwnProperty'](_0x5c1a('0xdb'))){_0x5668ec[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x413ec8[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x5668ec[_0x5c1a('0x1d')]=qs[_0x5c1a('0x1d')](_0x413ec8[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0xe883ba[_0x5c1a('0xe5')](_0x5668ec);}})['then'](function(_0x2a6ee0){if(_0x2a6ee0){return _0x2a6ee0?{'count':_0x48c746,'rows':_0x2a6ee0}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x3a52b6,null))[_0x5c1a('0x2a')](handleError(_0x3a52b6,null));};exports[_0x5c1a('0xe7')]=function(_0x50f1f4,_0xcea3a9){var _0x5daeb3={'raw':!![],'where':{}};var _0x19fde8={};var _0x20796c={'count':0x0,'rows':[]};return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x50f1f4[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0xcea3a9,null))[_0x5c1a('0x20')](function(_0xc5ae6b){if(_0xc5ae6b){_0x19fde8[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xe8')][_0x5c1a('0x40')]);_0x19fde8[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x50f1f4['query']);_0x19fde8['filters']=_['intersection'](_0x19fde8[_0x5c1a('0xd3')],_0x19fde8[_0x5c1a('0x4d')]);_0x5daeb3['attributes']=_[_0x5c1a('0xd2')](_0x19fde8['model'],qs[_0x5c1a('0xd4')](_0x50f1f4['query'][_0x5c1a('0xd4')]));_0x5daeb3['attributes']=_0x5daeb3['attributes'][_0x5c1a('0x6f')]?_0x5daeb3[_0x5c1a('0x50')]:_0x19fde8[_0x5c1a('0xd3')];if(!_0x50f1f4[_0x5c1a('0x4d')]['hasOwnProperty']('nolimit')){_0x5daeb3['limit']=qs[_0x5c1a('0x1c')](_0x50f1f4[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x5daeb3[_0x5c1a('0x1d')]=qs['offset'](_0x50f1f4[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}_0x5daeb3[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x50f1f4['query'][_0x5c1a('0xd5')]);_0x5daeb3[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x50f1f4[_0x5c1a('0x4d')],_0x19fde8[_0x5c1a('0xd7')]));_0x5daeb3[_0x5c1a('0x4b')][_0x5c1a('0xe0')]=_0xc5ae6b['id'];if(_0x50f1f4[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x5daeb3[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x5daeb3[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x5daeb3[_0x5c1a('0x50')],function(_0x4ba6c0){var _0x38524e={};_0x38524e[_0x4ba6c0]={'$like':'%'+_0x50f1f4[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x38524e;})});}_0x5daeb3=_[_0x5c1a('0x60')]({},_0x5daeb3,_0x50f1f4[_0x5c1a('0xd8')]);return db[_0x5c1a('0xe8')][_0x5c1a('0x4c')]({'where':_0x5daeb3[_0x5c1a('0x4b')]})[_0x5c1a('0x20')](function(_0x3119ab){_0x20796c['count']=_0x3119ab;if(_0x50f1f4[_0x5c1a('0x4d')][_0x5c1a('0x4e')]){_0x5daeb3[_0x5c1a('0x4f')]=[{'all':!![]}];}return db[_0x5c1a('0xe8')]['findAll'](_0x5daeb3);})[_0x5c1a('0x20')](function(_0x493509){_0x20796c['rows']=_0x493509;return _0x20796c;});}})[_0x5c1a('0x20')](respondWithFilteredResult(_0xcea3a9,_0x5daeb3))[_0x5c1a('0x2a')](handleError(_0xcea3a9,null));};exports[_0x5c1a('0xe9')]=function(_0x295591,_0xcfecd6){var _0x410e49={};var _0x1628e2={};var _0x422b33;var _0x57bea7;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x295591['params']['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0xcfecd6,null))[_0x5c1a('0x20')](function(_0x3d23c7){if(_0x3d23c7){_0x422b33=_0x3d23c7;_0x1628e2[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xea')][_0x5c1a('0x40')]);_0x1628e2[_0x5c1a('0x4d')]=_['keys'](_0x295591[_0x5c1a('0x4d')]);_0x1628e2[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x1628e2[_0x5c1a('0xd3')],_0x1628e2['query']);_0x410e49[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x1628e2[_0x5c1a('0xd3')],qs['fields'](_0x295591['query']['fields']));_0x410e49['attributes']=_0x410e49['attributes'][_0x5c1a('0x6f')]?_0x410e49[_0x5c1a('0x50')]:_0x1628e2[_0x5c1a('0xd3')];_0x410e49[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x295591[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x410e49[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x295591['query'],_0x1628e2['filters']));if(_0x295591[_0x5c1a('0x4d')]['filter']){_0x410e49[_0x5c1a('0x4b')]=_[_0x5c1a('0x60')](_0x410e49[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x410e49['attributes'],function(_0xbf9d11){var _0x3dfe36={};_0x3dfe36[_0xbf9d11]={'$like':'%'+_0x295591[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x3dfe36;})});}_0x410e49=_[_0x5c1a('0x60')]({},_0x410e49,_0x295591[_0x5c1a('0xd8')]);return _0x422b33[_0x5c1a('0xe9')](_0x410e49);}})[_0x5c1a('0x20')](function(_0x360bd6){if(_0x360bd6){_0x57bea7=_0x360bd6[_0x5c1a('0x6f')];if(!_0x295591[_0x5c1a('0x4d')]['hasOwnProperty'](_0x5c1a('0xdb'))){_0x410e49[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x295591['query'][_0x5c1a('0x1c')]);_0x410e49['offset']=qs[_0x5c1a('0x1d')](_0x295591['query'][_0x5c1a('0x1d')]);}return _0x422b33[_0x5c1a('0xe9')](_0x410e49);}})[_0x5c1a('0x20')](function(_0x1ccfa2){if(_0x1ccfa2){return _0x1ccfa2?{'count':_0x57bea7,'rows':_0x1ccfa2}:null;}})[_0x5c1a('0x20')](respondWithResult(_0xcfecd6,null))[_0x5c1a('0x2a')](handleError(_0xcfecd6,null));};exports['getFaxInteractions']=function(_0x560cc4,_0x12d50b){var _0x54348a={};var _0x231a73={};var _0x1a427d;var _0x2dc8cb;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x560cc4[_0x5c1a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x12d50b,null))[_0x5c1a('0x20')](function(_0x5c3b5a){if(_0x5c3b5a){_0x1a427d=_0x5c3b5a;_0x231a73[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xeb')][_0x5c1a('0x40')]);_0x231a73[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x560cc4[_0x5c1a('0x4d')]);_0x231a73[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x231a73[_0x5c1a('0xd3')],_0x231a73[_0x5c1a('0x4d')]);_0x54348a[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x231a73['model'],qs['fields'](_0x560cc4['query']['fields']));_0x54348a[_0x5c1a('0x50')]=_0x54348a[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x54348a[_0x5c1a('0x50')]:_0x231a73['model'];_0x54348a['order']=qs[_0x5c1a('0xd5')](_0x560cc4[_0x5c1a('0x4d')][_0x5c1a('0xd5')]);_0x54348a[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_['pick'](_0x560cc4[_0x5c1a('0x4d')],_0x231a73[_0x5c1a('0xd7')]));if(_0x560cc4[_0x5c1a('0x4d')]['filter']){_0x54348a[_0x5c1a('0x4b')]=_['merge'](_0x54348a[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x54348a[_0x5c1a('0x50')],function(_0x121e9a){var _0x504c4f={};_0x504c4f[_0x121e9a]={'$like':'%'+_0x560cc4[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x504c4f;})});}_0x54348a=_['merge']({},_0x54348a,_0x560cc4[_0x5c1a('0xd8')]);return _0x1a427d[_0x5c1a('0xec')](_0x54348a);}})[_0x5c1a('0x20')](function(_0x1650d1){if(_0x1650d1){_0x2dc8cb=_0x1650d1[_0x5c1a('0x6f')];if(!_0x560cc4[_0x5c1a('0x4d')][_0x5c1a('0xcb')]('nolimit')){_0x54348a[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x560cc4['query']['limit']);_0x54348a[_0x5c1a('0x1d')]=qs['offset'](_0x560cc4[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0x1a427d[_0x5c1a('0xec')](_0x54348a);}})['then'](function(_0xba056f){if(_0xba056f){return _0xba056f?{'count':_0x2dc8cb,'rows':_0xba056f}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x12d50b,null))[_0x5c1a('0x2a')](handleError(_0x12d50b,null));};exports['getWhatsappInteractions']=function(_0x3e10f6,_0x5a8d6f){var _0x40b2be={};var _0x547353={};var _0x119535;var _0x5339eb;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x3e10f6[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x5a8d6f,null))[_0x5c1a('0x20')](function(_0x597683){if(_0x597683){_0x119535=_0x597683;_0x547353[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0xed')][_0x5c1a('0x40')]);_0x547353[_0x5c1a('0x4d')]=_['keys'](_0x3e10f6[_0x5c1a('0x4d')]);_0x547353[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x547353[_0x5c1a('0xd3')],_0x547353[_0x5c1a('0x4d')]);_0x40b2be['attributes']=_[_0x5c1a('0xd2')](_0x547353[_0x5c1a('0xd3')],qs['fields'](_0x3e10f6['query'][_0x5c1a('0xd4')]));_0x40b2be[_0x5c1a('0x50')]=_0x40b2be[_0x5c1a('0x50')]['length']?_0x40b2be['attributes']:_0x547353[_0x5c1a('0xd3')];_0x40b2be['order']=qs[_0x5c1a('0xd5')](_0x3e10f6['query'][_0x5c1a('0xd5')]);_0x40b2be['where']=qs['filters'](_[_0x5c1a('0xd6')](_0x3e10f6[_0x5c1a('0x4d')],_0x547353['filters']));if(_0x3e10f6['query']['filter']){_0x40b2be[_0x5c1a('0x4b')]=_['merge'](_0x40b2be[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x40b2be[_0x5c1a('0x50')],function(_0x449fa0){var _0x315705={};_0x315705[_0x449fa0]={'$like':'%'+_0x3e10f6[_0x5c1a('0x4d')]['filter']+'%'};return _0x315705;})});}_0x40b2be=_[_0x5c1a('0x60')]({},_0x40b2be,_0x3e10f6[_0x5c1a('0xd8')]);return _0x119535[_0x5c1a('0xee')](_0x40b2be);}})[_0x5c1a('0x20')](function(_0x29aee6){if(_0x29aee6){_0x5339eb=_0x29aee6[_0x5c1a('0x6f')];if(!_0x3e10f6[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x40b2be['limit']=qs[_0x5c1a('0x1c')](_0x3e10f6[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x40b2be[_0x5c1a('0x1d')]=qs['offset'](_0x3e10f6[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0x119535[_0x5c1a('0xee')](_0x40b2be);}})['then'](function(_0x93f006){if(_0x93f006){return _0x93f006?{'count':_0x5339eb,'rows':_0x93f006}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x5a8d6f,null))[_0x5c1a('0x2a')](handleError(_0x5a8d6f,null));};exports[_0x5c1a('0xef')]=function(_0x55e74c,_0x36cccf,_0x18ef28){var _0x43fc0f;var _0x5bd826;var _0x3b14ab;var _0x3b2083=!_['isNil'](_0x55e74c[_0x5c1a('0x5d')]['id'])?_0x55e74c[_0x5c1a('0x5d')]['id']:!_[_0x5c1a('0x6a')](_0x55e74c['user']['id'])?_0x55e74c['user']['id']:null;return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x3b2083,'role':{'$or':[_0x5c1a('0x30'),_0x5c1a('0x7f'),_0x5c1a('0x33')]}},'attributes':['id',_0x5c1a('0x3b'),'phone',_0x5c1a('0xf0'),_0x5c1a('0x2c'),_0x5c1a('0x66'),_0x5c1a('0x9f')]})['then'](function(_0x548f08){if(_0x548f08){if(_0x548f08[_0x5c1a('0x2c')]===_0x5c1a('0x33')){_0x43fc0f=_0x548f08;if(_0x55e74c[_0x5c1a('0x61')][_0x5c1a('0xa1')]){_0x3b14ab=util[_0x5c1a('0xab')](_0x5c1a('0xf1'),_0x43fc0f[_0x55e74c[_0x5c1a('0x61')][_0x5c1a('0xa1')]]);}else if(_0x55e74c['body']['intrf']){_0x3b14ab=util[_0x5c1a('0xab')]('SIP/%s',_0x55e74c[_0x5c1a('0x61')][_0x5c1a('0xf2')]);}else{_0x3b14ab=util[_0x5c1a('0xab')](_0x5c1a('0xac'),_0x43fc0f[_0x5c1a('0x3b')]);}socket['to'](util['format']('user:%s',_0x43fc0f[_0x5c1a('0x3b')]))[_0x5c1a('0x2d')](_0x5c1a('0xf3'),{'user':{'id':_0x43fc0f['id'],'name':_0x43fc0f[_0x5c1a('0x3b')]},'ip':_0x55e74c['headers'][_0x5c1a('0xf4')]||_0x55e74c['connection'][_0x5c1a('0xf5')]||_0x55e74c[_0x5c1a('0xf6')][_0x5c1a('0xf5')]||_0x55e74c[_0x5c1a('0xf7')]['socket'][_0x5c1a('0xf5')]});return db[_0x5c1a('0xb3')]['destroy']({'where':{'membername':_0x43fc0f[_0x5c1a('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x5c1a('0x91'))][(_0x5c1a('0x92'))](_0x5c1a('0xf8'));}})[_0x5c1a('0x20')](function(){if(_0x43fc0f){return _0x43fc0f[_0x5c1a('0xf9')]({'raw':!![]});}})[_0x5c1a('0x20')](function(_0x5a2ebe){if(_0x43fc0f){if(_0x5a2ebe){_0x5bd826=_0x5a2ebe;if(_0x5bd826['length']){var _0x333b72=_0x5bd826['map'](function(_0x1f22f1){var _0x3120cf={'membername':_0x43fc0f[_0x5c1a('0x3b')],'UserId':_0x43fc0f['id'],'queue_name':_0x1f22f1['name'],'VoiceQueueId':_0x1f22f1['id'],'interface':_0x3b14ab,'paused':_0x43fc0f[_0x5c1a('0x9f')]||![],'penalty':_0x1f22f1[_0x5c1a('0xfa')]||0x0};return db[_0x5c1a('0xb3')][_0x5c1a('0xad')](_0x3120cf);});return Promise[_0x5c1a('0x8b')](_0x333b72);}}}})[_0x5c1a('0x20')](function(){if(_0x43fc0f){return db[_0x5c1a('0xfb')][_0x5c1a('0x51')]({'where':{'membername':_0x43fc0f[_0x5c1a('0x3b')],'exitAt':null}});}})['then'](function(_0x198c93){if(_0x43fc0f){var _0x3b8f13=[];_0x198c93['forEach'](function(_0x5a5784){_0x3b8f13['push'](_0x5a5784[_0x5c1a('0x2b')]({'exitAt':moment()[_0x5c1a('0xab')](_0x5c1a('0xfc'))}));});return Promise[_0x5c1a('0x8b')](_0x3b8f13);}})[_0x5c1a('0x20')](function(){if(_0x43fc0f){var _0x57d9e4=[];var _0x5c3856=[];var _0x11f1ed=utils[_0x5c1a('0xfd')]();var _0x51d418={'membername':_0x43fc0f[_0x5c1a('0x3b')],'interface':_0x3b14ab,'enterAt':moment()[_0x5c1a('0xab')](_0x5c1a('0xfc')),'role':_0x43fc0f[_0x5c1a('0x2c')],'internal':_0x43fc0f['internal']};_0x11f1ed['forEach'](function(_0xfa9398){_0x57d9e4['push'](_['merge']({'channel':_0xfa9398,'type':_0x5c1a('0xfe'),'data1':_0x55e74c['body']['device'],'data2':_0x3b14ab},_0x51d418));if(_0x43fc0f[_0x5c1a('0x9f')]){_0x5c3856[_0x5c1a('0x55')](_[_0x5c1a('0x60')]({'channel':_0xfa9398,'type':_0x5c1a('0xff'),'data1':_0x5c1a('0x100')},_0x51d418));}});return db[_0x5c1a('0xfb')][_0x5c1a('0x88')](_0x57d9e4['concat'](_0x5c3856),{'individualHooks':!![]});}})[_0x5c1a('0x20')](function(){if(_0x43fc0f){return _0x43fc0f[_0x5c1a('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0x5c1a('0xfc')),'voicePause':_0x43fc0f[_0x5c1a('0x9f')]||![],'mailPause':_0x43fc0f[_0x5c1a('0x9f')]||![],'chatPause':_0x43fc0f['loginInPause']||![],'faxPause':_0x43fc0f['loginInPause']||![],'smsPause':_0x43fc0f[_0x5c1a('0x9f')]||![],'openchannelPause':_0x43fc0f[_0x5c1a('0x9f')]||![],'whatsappPause':_0x43fc0f['loginInPause']||![],'pauseType':_0x43fc0f[_0x5c1a('0x9f')]?_0x5c1a('0x100'):null,'interface':_0x3b14ab,'lastPauseAt':moment()[_0x5c1a('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x5c1a('0x20')](function(_0x13dc18){if(_0x55e74c[_0x5c1a('0x101')]){return _0x18ef28();}else{return Promise['resolve'](_0x13dc18)['then'](respondWithResult(_0x36cccf,null));}})['catch'](handleError(_0x36cccf,null));};exports[_0x5c1a('0x102')]=function(_0xa0fe28,_0x26d7fb){var _0x36c8e2;return db[_0x5c1a('0x3f')]['find']({'where':{'id':_0xa0fe28[_0x5c1a('0x5d')]['id'],'role':'agent'},'attributes':['id','name',_0x5c1a('0x2c')]})['then'](handleEntityNotFound(_0x26d7fb,null))[_0x5c1a('0x20')](function(_0x25d209){if(_0x25d209){_0x36c8e2=_0x25d209;return db[_0x5c1a('0xb3')][_0x5c1a('0x2f')]({'where':{'membername':_0x36c8e2[_0x5c1a('0x3b')]},'individualHooks':!![]});}})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0xfb')][_0x5c1a('0x51')]({'where':{'membername':_0x36c8e2['name'],'exitAt':null}});})[_0x5c1a('0x20')](function(_0x235fcf){var _0x335b3f=[];_0x235fcf[_0x5c1a('0x103')](function(_0x4d1bb6){_0x335b3f[_0x5c1a('0x55')](_0x4d1bb6[_0x5c1a('0x2b')]({'exitAt':moment()['format'](_0x5c1a('0xfc'))}));});return Promise['all'](_0x335b3f);})[_0x5c1a('0x20')](function(){return _0x36c8e2[_0x5c1a('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x26d7fb,null))['catch'](handleError(_0x26d7fb,null));};exports['pause']=function(_0x4737e9,_0x2ac0f6){var _0x43dfc0;return db[_0x5c1a('0xb3')]['update']({'paused':0x1},{'where':{'UserId':_0x4737e9[_0x5c1a('0x5d')]['id']},'individualHooks':!![]})[_0x5c1a('0x20')](function(){return db['User'][_0x5c1a('0x3a')]({'where':{'id':_0x4737e9[_0x5c1a('0x5d')]['id'],'role':_0x5c1a('0x33')},'attributes':['id','name','role',_0x5c1a('0x66'),_0x5c1a('0xa1'),'online']});})['then'](handleEntityNotFound(_0x2ac0f6,null))[_0x5c1a('0x20')](function(_0x389539){if(_0x389539){_0x43dfc0=_0x389539;return respondWithRpcPromise(_0x5c1a('0x104'),_0x5c1a('0x105'),{'id':_0x43dfc0['id'],'name':_0x43dfc0['name'],'pause':!![]});}})[_0x5c1a('0x20')](function(){if(_0x43dfc0){return db[_0x5c1a('0xfb')][_0x5c1a('0x51')]({'where':{'membername':_0x43dfc0[_0x5c1a('0x3b')],'type':_0x5c1a('0xff'),'exitAt':null}});}})[_0x5c1a('0x20')](function(_0x5ab821){if(_0x5ab821[_0x5c1a('0x6f')]){var _0x1e980b=moment()[_0x5c1a('0xab')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x57907e=0x0,_0x4665b8=_0x5ab821['length'];_0x57907e<_0x4665b8;_0x57907e++){_0x5ab821[_0x57907e][_0x5c1a('0x106')]({'exitAt':_0x1e980b});}}})[_0x5c1a('0x20')](function(){var _0x5be255=[];var _0x374784=utils[_0x5c1a('0xfd')]();_0x374784['forEach'](function(_0x28d18e){_0x5be255[_0x5c1a('0x55')]({'channel':_0x28d18e,'membername':_0x43dfc0['name'],'interface':_[_0x5c1a('0x6a')](_0x43dfc0['interface'])?util[_0x5c1a('0xab')](_0x5c1a('0xac'),_0x43dfc0['name']):_0x43dfc0[_0x5c1a('0xa1')],'type':'PAUSE','enterAt':moment()['format'](_0x5c1a('0xfc')),'data1':_0x4737e9['body'][_0x5c1a('0x42')]||_0x5c1a('0x107'),'role':_0x43dfc0['role'],'internal':_0x43dfc0[_0x5c1a('0x66')]});});return db['MemberReport'][_0x5c1a('0x88')](_0x5be255,{'individualHooks':!![]});})['then'](function(){return _0x43dfc0[_0x5c1a('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4737e9[_0x5c1a('0x61')][_0x5c1a('0x42')]||_0x5c1a('0x107'),'lastPauseAt':moment()[_0x5c1a('0xab')](_0x5c1a('0xfc'))});})[_0x5c1a('0x20')](respondWithResult(_0x2ac0f6,null))[_0x5c1a('0x2a')](handleError(_0x2ac0f6,null));};exports[_0x5c1a('0x108')]=function(_0x5e5899,_0x1b18b1){if(_0x5e5899[_0x5c1a('0x61')][_0x5c1a('0x9d')]&&!utils[_0x5c1a('0xaf')](_0x5e5899['body'][_0x5c1a('0x9d')])){throw new APIBadRequestError(util[_0x5c1a('0xab')](_0x5c1a('0x109'),_0x5e5899[_0x5c1a('0x61')][_0x5c1a('0x9d')]));}return db[_0x5c1a('0x3f')][_0x5c1a('0x3a')]({'where':{'id':_0x5e5899[_0x5c1a('0x5d')]['id']},'attributes':['id',_0x5c1a('0x3b'),_0x5c1a('0x2c'),_0x5c1a('0x66'),_0x5c1a('0xa1'),_0x5c1a('0x9e'),_0x5c1a('0xa0'),'mailPause',_0x5c1a('0x10a'),_0x5c1a('0x10b'),_0x5c1a('0x10c'),_0x5c1a('0x10d'),_0x5c1a('0x10e'),_0x5c1a('0x10f'),_0x5c1a('0x110')]})['then'](function(_0x30aced){if(!_0x30aced){throw new APINotFoundError(util['format'](_0x5c1a('0xca'),_0x5e5899[_0x5c1a('0x5d')]['id']));}return _0x30aced['unpause'](_0x5e5899[_0x5c1a('0x61')][_0x5c1a('0x9d')]);})[_0x5c1a('0x20')](respondWithResult(_0x1b18b1,null))[_0x5c1a('0x2a')](APIHandleError(_0x1b18b1));};exports[_0x5c1a('0x111')]=function(_0xd1d17d,_0x3360f2){var _0x4dc41b={};var _0x3f4841={};var _0x2a284b;var _0xb1d786;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0xd1d17d[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x3360f2,null))[_0x5c1a('0x20')](function(_0x3fb1c6){if(_0x3fb1c6){_0x2a284b=_0x3fb1c6;_0x3f4841[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db[_0x5c1a('0x112')][_0x5c1a('0x40')]);_0x3f4841[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0xd1d17d['query']);_0x3f4841['filters']=_[_0x5c1a('0xd2')](_0x3f4841['model'],_0x3f4841[_0x5c1a('0x4d')]);_0x4dc41b[_0x5c1a('0x50')]=_['intersection'](_0x3f4841[_0x5c1a('0xd3')],qs[_0x5c1a('0xd4')](_0xd1d17d[_0x5c1a('0x4d')][_0x5c1a('0xd4')]));_0x4dc41b[_0x5c1a('0x50')]=_0x4dc41b['attributes']['length']?_0x4dc41b[_0x5c1a('0x50')]:_0x3f4841['model'];_0x4dc41b[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0xd1d17d['query']['sort']);_0x4dc41b[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0xd1d17d['query'],_0x3f4841['filters']));if(_0xd1d17d[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x4dc41b[_0x5c1a('0x4b')]=_['merge'](_0x4dc41b['where'],{'$or':_['map'](_0x4dc41b['attributes'],function(_0x13767f){var _0x467880={};_0x467880[_0x13767f]={'$like':'%'+_0xd1d17d['query']['filter']+'%'};return _0x467880;})});}_0x4dc41b=_[_0x5c1a('0x60')]({},_0x4dc41b,_0xd1d17d[_0x5c1a('0xd8')]);return _0x2a284b['getTeams'](_0x4dc41b);}})[_0x5c1a('0x20')](function(_0x1e7850){if(_0x1e7850){_0xb1d786=_0x1e7850[_0x5c1a('0x6f')];if(!_0xd1d17d[_0x5c1a('0x4d')][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x4dc41b[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0xd1d17d[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x4dc41b[_0x5c1a('0x1d')]=qs[_0x5c1a('0x1d')](_0xd1d17d[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);}return _0x2a284b[_0x5c1a('0x111')](_0x4dc41b);}})['then'](function(_0x330fa8){if(_0x330fa8){return _0x330fa8?{'count':_0xb1d786,'rows':_0x330fa8}:null;}})[_0x5c1a('0x20')](respondWithResult(_0x3360f2,null))[_0x5c1a('0x2a')](handleError(_0x3360f2,null));};exports[_0x5c1a('0x113')]=function(_0x1ac37b,_0x320a6b){var _0x2093b9=_0x1ac37b[_0x5c1a('0x5d')]['id'];var _0x18984a=_0x1ac37b[_0x5c1a('0x61')]?_0x1ac37b[_0x5c1a('0x61')][_0x5c1a('0x64')]:null;var _0x417c64=[];return Promise['resolve']()[_0x5c1a('0x20')](function(){if(!_0x18984a)throw new APIBadRequestError(_0x5c1a('0x114'));})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x2093b9}});})[_0x5c1a('0x20')](function(_0x3abba5){if(!_0x3abba5)throw new APINotFoundError(util['format'](_0x5c1a('0xca'),_0x1ac37b[_0x5c1a('0x5d')]['id']));return db[_0x5c1a('0x6c')][_0x5c1a('0x115')](function(_0x46506a){return _0x3abba5[_0x5c1a('0x113')](_0x18984a,{'transaction':_0x46506a})[_0x5c1a('0x20')](function(){return db['Team'][_0x5c1a('0x51')]({'where':{'id':{'$in':_0x18984a}}});})[_0x5c1a('0x20')](function(_0x122dc8){var _0x135fb8=_[_0x5c1a('0x37')](_0x122dc8,function(_0x26fb21){return _0x26fb21[_0x5c1a('0x116')]();});return Promise[_0x5c1a('0x8b')](_0x135fb8);})[_0x5c1a('0x20')](function(_0x51e31d){_0x417c64=_[_0x5c1a('0x117')](_0x51e31d);var _0x15893c=_[_0x5c1a('0x37')](_0x417c64,function(_0x383522){return _0x383522[_0x5c1a('0x118')](_0x3abba5['id'],{'transaction':_0x46506a});});return Promise[_0x5c1a('0x8b')](_0x15893c);})[_0x5c1a('0x20')](function(){if(!_0x3abba5['online'])return;var _0x278d41=_[_0x5c1a('0x44')](_0x417c64,function(_0xd3b755){return _0xd3b755[_0x5c1a('0x119')](_0x5c1a('0x9d'))===_0x5c1a('0x11a');});var _0x520d40=_[_0x5c1a('0x37')](_0x278d41,function(_0x1e2b7a){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3abba5['name'],'UserId':_0x3abba5['id'],'queue_name':_0x1e2b7a['name'],'VoiceQueueId':_0x1e2b7a['id'],'interface':_[_0x5c1a('0x6a')](_0x3abba5['interface'])?util[_0x5c1a('0xab')](_0x5c1a('0xac'),_0x3abba5[_0x5c1a('0x3b')]):_0x3abba5[_0x5c1a('0xa1')],'paused':_0x3abba5[_0x5c1a('0xa0')]||![],'penalty':_0x3abba5[_0x5c1a('0xa6')]},{'transaction':_0x46506a});});return Promise[_0x5c1a('0x8b')](_0x520d40);})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0x11b')][_0x5c1a('0x51')]({'where':{'teamId':{'$in':_0x18984a}}});})[_0x5c1a('0x20')](function(_0x31cdbf){var _0x5d888f=_[_0x5c1a('0x37')](_0x31cdbf,function(_0xdd558a){return db['UserVoicePrefix']['create']({'UserId':_0x3abba5['id'],'VoicePrefixId':_0xdd558a[_0x5c1a('0x11c')]},{'transaction':_0x46506a});});return Promise[_0x5c1a('0x8b')](_0x5d888f);});});})[_0x5c1a('0x20')](function(){for(var _0x1a518d=0x0;_0x1a518d<_0x417c64['length'];_0x1a518d++){var _0xc3dffd=_0x417c64[_0x1a518d]['getDataValue'](_0x5c1a('0x9d'));var _0x4aa48d=_0xc3dffd+'QueueId';socket[_0x5c1a('0x2d')](_0x5c1a('0x7f')+_0xc3dffd+_0x5c1a('0xa8'),{'UserId':_0x2093b9,['queueField']:_0x417c64[_0x1a518d]['id']});}})[_0x5c1a('0x20')](respondWithStatusCode(_0x320a6b,null))[_0x5c1a('0x2a')](APIHandleError(_0x320a6b));};exports[_0x5c1a('0x11d')]=function(_0x4f6011,_0x496ba4){var _0x10c776=_0x4f6011['params']['id'];var _0x4ac76d=null;if(_0x4f6011[_0x5c1a('0x4d')]['ids']){_0x4ac76d=_[_0x5c1a('0x11e')](_0x4f6011['query'][_0x5c1a('0x64')])?_0x4f6011['query'][_0x5c1a('0x64')]:[_0x4f6011['query'][_0x5c1a('0x64')]];}var _0x338689=[];return Promise[_0x5c1a('0x11f')]()[_0x5c1a('0x20')](function(){if(!_0x4ac76d)throw new APIBadRequestError(_0x5c1a('0x120'));})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x10c776}});})[_0x5c1a('0x20')](function(_0x583f64){if(!_0x583f64)throw new APINotFoundError(util[_0x5c1a('0xab')](_0x5c1a('0xca'),_0x4f6011['params']['id']));return db['sequelize']['transaction'](function(_0x1929f6){return _0x583f64[_0x5c1a('0x11d')](_0x4ac76d,{'transaction':_0x1929f6})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0x112')]['findAll']({'where':{'id':{'$in':_0x4ac76d}}});})[_0x5c1a('0x20')](function(_0x554ca6){var _0x2778a7=_[_0x5c1a('0x37')](_0x554ca6,function(_0x5004f3){return _0x5004f3[_0x5c1a('0x116')]();});return Promise[_0x5c1a('0x8b')](_0x2778a7);})[_0x5c1a('0x20')](function(_0x1854f8){_0x338689=_[_0x5c1a('0x117')](_0x1854f8);var _0xa83cea=_[_0x5c1a('0x37')](_0x338689,function(_0x439a8f){return _0x439a8f[_0x5c1a('0x121')](_0x583f64['id'],{'transaction':_0x1929f6});});return Promise['all'](_0xa83cea);})['then'](function(){if(!_0x583f64['online'])return;var _0x56f3cd=_['filter'](_0x338689,function(_0x124638){return _0x124638[_0x5c1a('0x119')](_0x5c1a('0x9d'))===_0x5c1a('0x11a');});var _0x555427=_['map'](_0x56f3cd,function(_0x3659b8){return db[_0x5c1a('0xb3')]['destroy']({'where':{'VoiceQueueId':_0x3659b8['id'],'UserId':_0x583f64['id']},'transaction':_0x1929f6});});return Promise[_0x5c1a('0x8b')](_0x555427);})[_0x5c1a('0x20')](function(){return db[_0x5c1a('0x11b')][_0x5c1a('0x51')]({'where':{'teamId':{'$in':_0x4ac76d}}});})[_0x5c1a('0x20')](function(_0x4ae3b0){var _0x31b7ed=_[_0x5c1a('0x37')](_0x4ae3b0,function(_0xbac377){return db[_0x5c1a('0x122')][_0x5c1a('0x2f')]({'where':{'UserId':_0x583f64['id'],'VoicePrefixId':_0xbac377['VoicePrefixId']}},{'transaction':_0x1929f6});});return Promise[_0x5c1a('0x8b')](_0x31b7ed);});});})['then'](function(){for(var _0x5876d8=0x0;_0x5876d8<_0x338689[_0x5c1a('0x6f')];_0x5876d8++){var _0x4e37ca=_0x338689[_0x5876d8][_0x5c1a('0x119')]('channel');var _0x3ebdeb=_0x4e37ca+_0x5c1a('0xa7');socket['emit'](_0x5c1a('0x7f')+_0x4e37ca+_0x5c1a('0xb2'),{'UserId':_0x10c776,['queueField']:_0x338689[_0x5876d8]['id']});}})[_0x5c1a('0x20')](respondWithStatusCode(_0x496ba4,null))[_0x5c1a('0x2a')](APIHandleError(_0x496ba4));};exports[_0x5c1a('0x123')]=function(_0x3fb47b,_0xb084fb){var _0x2d9066={};var _0x4064ab={};var _0x4e0c18;var _0x1aa87e;return db['User'][_0x5c1a('0x96')]({'where':{'id':_0x3fb47b[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0xb084fb,null))[_0x5c1a('0x20')](function(_0x42d25e){if(_0x42d25e){_0x4e0c18=_0x42d25e;_0x4064ab[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db['CmList'][_0x5c1a('0x40')]);_0x4064ab[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x3fb47b['query']);_0x4064ab[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x4064ab[_0x5c1a('0xd3')],_0x4064ab[_0x5c1a('0x4d')]);_0x2d9066['attributes']=_[_0x5c1a('0xd2')](_0x4064ab['model'],qs[_0x5c1a('0xd4')](_0x3fb47b[_0x5c1a('0x4d')][_0x5c1a('0xd4')]));_0x2d9066[_0x5c1a('0x50')]=_0x2d9066[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x2d9066[_0x5c1a('0x50')]:_0x4064ab['model'];_0x2d9066[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x3fb47b['query']['sort']);_0x2d9066['where']=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x3fb47b['query'],_0x4064ab['filters']));if(_0x3fb47b[_0x5c1a('0x4d')]['filter']){_0x2d9066['where']=_[_0x5c1a('0x60')](_0x2d9066[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x2d9066[_0x5c1a('0x50')],function(_0xa2b785){var _0x52c2f1={};_0x52c2f1[_0xa2b785]={'$like':'%'+_0x3fb47b[_0x5c1a('0x4d')][_0x5c1a('0x44')]+'%'};return _0x52c2f1;})});}_0x2d9066=_[_0x5c1a('0x60')]({},_0x2d9066,_0x3fb47b[_0x5c1a('0xd8')]);return _0x4e0c18[_0x5c1a('0x123')](_0x2d9066);}})[_0x5c1a('0x20')](function(_0x1a01ad){if(_0x1a01ad){_0x1aa87e=_0x1a01ad[_0x5c1a('0x6f')];if(!_0x3fb47b['query'][_0x5c1a('0xcb')](_0x5c1a('0xdb'))){_0x2d9066[_0x5c1a('0x1c')]=qs[_0x5c1a('0x1c')](_0x3fb47b[_0x5c1a('0x4d')][_0x5c1a('0x1c')]);_0x2d9066[_0x5c1a('0x1d')]=qs[_0x5c1a('0x1d')](_0x3fb47b['query']['offset']);}return _0x4e0c18[_0x5c1a('0x123')](_0x2d9066);}})[_0x5c1a('0x20')](function(_0x12a558){if(_0x12a558){return _0x12a558?{'count':_0x1aa87e,'rows':_0x12a558}:null;}})['then'](respondWithResult(_0xb084fb,null))[_0x5c1a('0x2a')](handleError(_0xb084fb,null));};exports['getAgents']=function(_0x302bc2,_0x424bfb){var _0x277bf2={};var _0x3a3bb7={};var _0x809045;return db[_0x5c1a('0x3f')][_0x5c1a('0x96')]({'where':{'id':_0x302bc2[_0x5c1a('0x5d')]['id']}})[_0x5c1a('0x20')](handleEntityNotFound(_0x424bfb,null))[_0x5c1a('0x20')](function(_0x16e3ce){if(_0x16e3ce){_0x809045=_0x16e3ce;_0x3a3bb7[_0x5c1a('0xd3')]=_[_0x5c1a('0xd0')](db['User'][_0x5c1a('0x40')]);_0x3a3bb7[_0x5c1a('0x4d')]=_[_0x5c1a('0xd0')](_0x302bc2[_0x5c1a('0x4d')]);_0x3a3bb7[_0x5c1a('0xd7')]=_[_0x5c1a('0xd2')](_0x3a3bb7[_0x5c1a('0xd3')],_0x3a3bb7[_0x5c1a('0x4d')]);_0x277bf2[_0x5c1a('0x50')]=_[_0x5c1a('0xd2')](_0x3a3bb7[_0x5c1a('0xd3')],qs[_0x5c1a('0xd4')](_0x302bc2['query'][_0x5c1a('0xd4')]));_0x277bf2[_0x5c1a('0x50')]=_0x277bf2[_0x5c1a('0x50')][_0x5c1a('0x6f')]?_0x277bf2[_0x5c1a('0x50')]:_0x3a3bb7[_0x5c1a('0xd3')];_0x277bf2[_0x5c1a('0xdd')]=qs[_0x5c1a('0xd5')](_0x302bc2['query']['sort']);_0x277bf2[_0x5c1a('0x4b')]=qs[_0x5c1a('0xd7')](_[_0x5c1a('0xd6')](_0x302bc2['query'],_0x3a3bb7[_0x5c1a('0xd7')]));if(_0x302bc2[_0x5c1a('0x4d')][_0x5c1a('0x44')]){_0x277bf2[_0x5c1a('0x4b')]=_['merge'](_0x277bf2[_0x5c1a('0x4b')],{'$or':_[_0x5c1a('0x37')](_0x277bf2[_0x5c1a('0x50')],function(_0x489743){var _0x3635be={};_0x3635be[_0x489743]={'$like':'%'+_0x302bc2['query'][_0x5c1a('0x44')]+'%'};return _0x3635be;})});}_0x277bf2[_0x5c1a('0xd3')]=db[_0x5c1a('0x3f')];_0x277bf2['as']=_0x5c1a('0x32');_0x277bf2=_['merge']({},_0x277bf2,_0x302bc2[_0x5c1a('0xd8')]);return _0x809045['getVoiceQueues']({'include':[_0x277bf2]});}})[_0x5c1a('0x20')](function(_0x396ba3){if(_0x396ba3){var _0x43bb4b={},_0x109554=[];for(var _0x25ce98=0x0;_0x25ce98<_0x396ba3[_0x5c1a('0x6f')];_0x25ce98+=0x1){for(var _0x30b3db=0x0,_0x16eb89;_0x30b3db<_0x396ba3[_0x25ce98]['Agents'][_0x5c1a('0x6f')];_0x30b3db+=0x1){_0x16eb89=_0x396ba3[_0x25ce98][_0x5c1a('0x32')][_0x30b3db][_0x5c1a('0xd9')]({'plain':!![]});_0x43bb4b[_0x16eb89['id']]=_0x16eb89;}}_0x43bb4b=_[_0x5c1a('0x124')](_0x43bb4b);for(var _0x1b1b5a=qs['offset'](_0x302bc2[_0x5c1a('0x4d')][_0x5c1a('0x1d')]);_0x1b1b5a<_0x43bb4b[_0x5c1a('0x6f')]&&_0x109554[_0x5c1a('0x6f')]=_0x243923[_0xe623('0x52')]){throw new Error(_0xe623('0x53'));}})[_0xe623('0x13')](function(){if(_0x3e07aa){return db[_0xe623('0x26')][_0xe623('0x49')]({'where':{'membername':_0x3e07aa[_0xe623('0x1f')]},'individualHooks':!![]});}})[_0xe623('0x13')](function(){if(_0x3e07aa){return _0x3e07aa[_0xe623('0x54')]({'raw':!![]});}})['then'](function(_0x2f305e){if(_0x3e07aa){if(_0x2f305e){var _0x437f4a=[];_0x3ca29c=_0x2f305e;if(_0x3ca29c[_0xe623('0x2b')]){for(var _0x366f2b=0x0;_0x366f2b<_0x3ca29c[_0xe623('0x2b')];_0x366f2b++){_0x437f4a[_0xe623('0x2f')](db[_0xe623('0x26')][_0xe623('0x55')]({'membername':_0x3e07aa[_0xe623('0x1f')],'UserId':_0x3e07aa['id'],'queue_name':_0x3ca29c[_0x366f2b][_0xe623('0x1f')],'VoiceQueueId':_0x3ca29c[_0x366f2b]['id'],'interface':_0xe93c9b,'paused':_0x3e07aa[_0xe623('0x56')]||![],'penalty':_0x3ca29c[_0x366f2b][_0xe623('0x57')]||0x0}));}return BPromise['all'](_0x437f4a);}}}})[_0xe623('0x13')](function(){if(_0x3e07aa){return db[_0xe623('0x28')][_0xe623('0xc')]({'where':{'membername':_0x3e07aa['name'],'exitAt':null}});}})[_0xe623('0x13')](function(_0x357054){if(_0x3e07aa){if(_0x357054&&_0x357054[_0xe623('0x2b')]){var _0x823450=[];_0x357054[_0xe623('0x2e')](function(_0x14093b){_0x823450[_0xe623('0x2f')](_0x14093b[_0xe623('0x27')]({'exitAt':moment()[_0xe623('0x23')](_0xe623('0x2a'))}));});return BPromise['all'](_0x823450);}}})[_0xe623('0x13')](function(){if(_0x3e07aa){var _0x572db6=[];var _0x521045=[];var _0x25d9fb=utils[_0xe623('0x2d')]();var _0x192608={'membername':_0x3e07aa[_0xe623('0x1f')],'interface':_0xe93c9b,'enterAt':moment()['format'](_0xe623('0x2a')),'role':_0x3e07aa[_0xe623('0x20')],'internal':_0x3e07aa[_0xe623('0x21')]};_0x25d9fb[_0xe623('0x2e')](function(_0x257625){_0x572db6[_0xe623('0x2f')](_['merge']({'channel':_0x257625,'type':_0xe623('0x58'),'data1':'callysquare','data2':_0xe93c9b},_0x192608));if(_0x3e07aa[_0xe623('0x56')]){_0x521045[_0xe623('0x2f')](_[_0xe623('0x59')]({'channel':_0x257625,'type':'PAUSE','data1':_0xe623('0x5a')},_0x192608));}});return db[_0xe623('0x28')][_0xe623('0x35')](_0x572db6[_0xe623('0x5b')](_0x521045),{'individualHooks':!![]});}})['then'](function(){if(_0x3e07aa){return _0x3e07aa['update']({'online':!![],'lastLoginAt':moment()[_0xe623('0x23')](_0xe623('0x2a')),'voicePause':_0x3e07aa[_0xe623('0x56')]||![],'mailPause':_0x3e07aa[_0xe623('0x56')]||![],'chatPause':_0x3e07aa['loginInPause']||![],'faxPause':_0x3e07aa[_0xe623('0x56')]||![],'smsPause':_0x3e07aa['loginInPause']||![],'openchannelPause':_0x3e07aa['loginInPause']||![],'pauseType':_0x3e07aa[_0xe623('0x56')]?_0xe623('0x5a'):null,'lastPauseAt':moment()[_0xe623('0x23')](_0xe623('0x2a')),'interface':_0xe93c9b});}})[_0xe623('0x13')](function(_0x4af2c1){_0x471d8f(_0x4af2c1);})[_0xe623('0x1c')](function(_0x5aded7){_0x2cd7f2(_0x418e20['error'](0x1f4,_0x5aded7[_0xe623('0x18')]));});});}; \ No newline at end of file +var _0x99c9=['UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','internal','online','mailPause','chatPause','smsPause','whatsappPause','lastPauseAt','params','unpause','LogoutUser','findOne','destroy','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','all','getChannels','merge','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','GetUser','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','ShowUser','User','find','catch','message','PauseUser','name','role','interface','format','UserVoiceQueueRt','update','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','forEach','push','PAUSE','body','DEFAULT\x20PAUSE','MemberReport','bulkCreate','type'];(function(_0x1db40e,_0x4d225b){var _0xf26384=function(_0x400b7b){while(--_0x400b7b){_0x1db40e['push'](_0x1db40e['shift']());}};_0xf26384(++_0x4d225b);}(_0x99c9,0x1d7));var _0x999c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x99c9[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var moment=require('moment');var BPromise=require(_0x999c('0x2'));var Redis=require(_0x999c('0x3'));var db=require(_0x999c('0x4'))['db'];var utils=require(_0x999c('0x5'));var logger=require(_0x999c('0x6'))(_0x999c('0x7'));var config=require(_0x999c('0x8'));config['redis']=_['defaults'](config[_0x999c('0x9')],{'host':_0x999c('0xa'),'port':0x18eb});var socket=require(_0x999c('0xb'))(new Redis(config['redis']));require(_0x999c('0xc'))['register'](socket);exports[_0x999c('0xd')]=function(_0x3eabde){var _0x5d8437=this;return new Promise(function(_0x286485,_0x585678){return db['User'][_0x999c('0xe')]({'raw':_0x3eabde[_0x999c('0xf')]?_0x3eabde[_0x999c('0xf')][_0x999c('0x10')]===undefined?!![]:![]:!![],'where':_0x3eabde[_0x999c('0xf')]?_0x3eabde[_0x999c('0xf')][_0x999c('0x11')]||null:null,'attributes':_0x3eabde[_0x999c('0xf')]?_0x3eabde[_0x999c('0xf')]['attributes']||null:null,'limit':_0x3eabde[_0x999c('0xf')]?_0x3eabde[_0x999c('0xf')][_0x999c('0x12')]||null:null,'include':_0x3eabde[_0x999c('0xf')]?_0x3eabde[_0x999c('0xf')][_0x999c('0x13')]?_[_0x999c('0x14')](_0x3eabde[_0x999c('0xf')][_0x999c('0x13')],function(_0x115d20){return{'model':db[_0x115d20[_0x999c('0x15')]],'as':_0x115d20['as'],'attributes':_0x115d20[_0x999c('0x16')],'include':_0x115d20[_0x999c('0x13')]?_[_0x999c('0x14')](_0x115d20[_0x999c('0x13')],function(_0x3b12f3){return{'model':db[_0x3b12f3[_0x999c('0x15')]],'as':_0x3b12f3['as'],'attributes':_0x3b12f3[_0x999c('0x16')],'include':_0x3b12f3[_0x999c('0x13')]?_[_0x999c('0x14')](_0x3b12f3['include'],function(_0x1c9659){return{'model':db[_0x1c9659[_0x999c('0x15')]],'as':_0x1c9659['as'],'attributes':_0x1c9659[_0x999c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x999c('0x17')](function(_0x1fd638){logger[_0x999c('0x18')](_0x999c('0xd'),_0x3eabde);logger[_0x999c('0x19')](_0x999c('0xd'),_0x3eabde,JSON[_0x999c('0x1a')](_0x1fd638));_0x286485(_0x1fd638);})['catch'](function(_0x18875d){logger['error'](_0x999c('0xd'),_0x18875d['message'],_0x3eabde);_0x585678(_0x5d8437[_0x999c('0x1b')](0x1f4,_0x18875d['message']));});});};exports[_0x999c('0x1c')]=function(_0x5bc567){var _0x2765b6=this;return new Promise(function(_0x3c38e1,_0x81c2a){return db[_0x999c('0x1d')][_0x999c('0x1e')]({'raw':_0x5bc567['options']?_0x5bc567[_0x999c('0xf')][_0x999c('0x10')]===undefined?!![]:![]:!![],'where':_0x5bc567[_0x999c('0xf')]?_0x5bc567['options'][_0x999c('0x11')]||null:null,'attributes':_0x5bc567['options']?_0x5bc567['options'][_0x999c('0x16')]||null:null,'include':_0x5bc567[_0x999c('0xf')]?_0x5bc567[_0x999c('0xf')]['include']?_[_0x999c('0x14')](_0x5bc567['options'][_0x999c('0x13')],function(_0x523657){return{'model':db[_0x523657[_0x999c('0x15')]],'as':_0x523657['as'],'attributes':_0x523657['attributes'],'include':_0x523657['include']?_['map'](_0x523657[_0x999c('0x13')],function(_0x54392a){return{'model':db[_0x54392a[_0x999c('0x15')]],'as':_0x54392a['as'],'attributes':_0x54392a[_0x999c('0x16')],'include':_0x54392a[_0x999c('0x13')]?_['map'](_0x54392a[_0x999c('0x13')],function(_0x2b477b){return{'model':db[_0x2b477b[_0x999c('0x15')]],'as':_0x2b477b['as'],'attributes':_0x2b477b[_0x999c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x999c('0x17')](function(_0x3f5416){logger[_0x999c('0x18')]('ShowUser',_0x5bc567);logger[_0x999c('0x19')](_0x999c('0x1c'),_0x5bc567,JSON[_0x999c('0x1a')](_0x3f5416));_0x3c38e1(_0x3f5416);})[_0x999c('0x1f')](function(_0x4e92e7){logger['error'](_0x999c('0x1c'),_0x4e92e7[_0x999c('0x20')],_0x5bc567);_0x81c2a(_0x2765b6['error'](0x1f4,_0x4e92e7[_0x999c('0x20')]));});});};exports[_0x999c('0x21')]=function(_0x3ee479){var _0x542be2;return db['User']['find']({'where':_0x3ee479[_0x999c('0xf')][_0x999c('0x11')]||{},'attributes':['id',_0x999c('0x22'),_0x999c('0x23'),'internal',_0x999c('0x24')]})['then'](function(_0x27ec7b){if(!_0x27ec7b){throw new Error(util[_0x999c('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3ee479['params']['id']));}_0x542be2=_0x27ec7b;return db[_0x999c('0x26')][_0x999c('0x27')]({'paused':0x1},{'where':{'UserId':_0x542be2['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x999c('0xe')]({'where':{'membername':_0x542be2[_0x999c('0x22')],'type':'PAUSE','exitAt':null}});})[_0x999c('0x17')](function(_0x1d9104){if(_0x1d9104&&_0x1d9104['length']){var _0x4a4394=moment()[_0x999c('0x25')](_0x999c('0x28'));for(var _0xde7373=0x0,_0x1d44b0=_0x1d9104[_0x999c('0x29')];_0xde7373<_0x1d44b0;_0xde7373++){_0x1d9104[_0xde7373][_0x999c('0x2a')]({'exitAt':_0x4a4394});}}})[_0x999c('0x17')](function(){var _0x1c71a7=[];var _0x4b07cc=utils['getChannels']();_0x4b07cc[_0x999c('0x2b')](function(_0x12d1dc){_0x1c71a7[_0x999c('0x2c')]({'channel':_0x12d1dc,'membername':_0x542be2[_0x999c('0x22')],'interface':_['isNil'](_0x542be2[_0x999c('0x24')])?util[_0x999c('0x25')]('SIP/%s',_0x542be2['name']):_0x542be2['interface'],'type':_0x999c('0x2d'),'enterAt':moment()[_0x999c('0x25')](_0x999c('0x28')),'data1':_0x3ee479[_0x999c('0x2e')]['type']||_0x999c('0x2f'),'role':_0x542be2['role'],'internal':_0x542be2['internal'],'uniqueid':_0x3ee479[_0x999c('0x2e')]['uniqueid']||null});});return db[_0x999c('0x30')][_0x999c('0x31')](_0x1c71a7,{'individualHooks':!![]});})[_0x999c('0x17')](function(){return _0x542be2[_0x999c('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3ee479[_0x999c('0x2e')][_0x999c('0x32')]||_0x999c('0x2f'),'lastPauseAt':moment()[_0x999c('0x25')](_0x999c('0x28'))});})[_0x999c('0x1f')](function(_0x3e3dcb){throw _0x3e3dcb;});};exports[_0x999c('0x33')]=function(_0x46dcb4){return Promise[_0x999c('0x34')]()[_0x999c('0x17')](function(){if(_0x46dcb4[_0x999c('0x2e')][_0x999c('0x35')]&&!utils[_0x999c('0x36')](_0x46dcb4[_0x999c('0x2e')]['channel'])){throw new Error(util[_0x999c('0x25')](_0x999c('0x37'),_0x46dcb4[_0x999c('0x2e')]['channel']));}return db['User']['findOne']({'where':_0x46dcb4['options'][_0x999c('0x11')]||{},'attributes':['id',_0x999c('0x22'),_0x999c('0x23'),_0x999c('0x38'),_0x999c('0x24'),_0x999c('0x39'),'voicePause',_0x999c('0x3a'),_0x999c('0x3b'),'faxPause','openchannelPause',_0x999c('0x3c'),_0x999c('0x3d'),'pauseType',_0x999c('0x3e')]});})['then'](function(_0x5cc0e9){if(!_0x5cc0e9){throw new Error(util[_0x999c('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x46dcb4[_0x999c('0x3f')]['id']));}return _0x5cc0e9[_0x999c('0x40')](_0x46dcb4[_0x999c('0x2e')][_0x999c('0x35')],'system');})[_0x999c('0x1f')](function(_0x18509e){throw _0x18509e;});};exports[_0x999c('0x41')]=function(_0x26b35d){var _0x310827=this;return new Promise(function(_0xc5e3c4,_0x3f6c6a){var _0x57b579;return db[_0x999c('0x1d')][_0x999c('0x42')]({'where':_0x26b35d[_0x999c('0xf')][_0x999c('0x11')]||{},'attributes':['id',_0x999c('0x22')]})[_0x999c('0x17')](function(_0xea889){if(_0xea889){_0x57b579=_0xea889;return db[_0x999c('0x26')][_0x999c('0x43')]({'where':{'membername':_0x57b579[_0x999c('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x57b579){return db[_0x999c('0x30')][_0x999c('0xe')]({'where':{'membername':_0x57b579[_0x999c('0x22')],'exitAt':null}});}})[_0x999c('0x17')](function(_0x194459){if(_0x57b579){if(_0x194459&&_0x194459[_0x999c('0x29')]){var _0x521ca7=[];_0x194459['forEach'](function(_0x3f191e){_0x521ca7[_0x999c('0x2c')](_0x3f191e['update']({'exitAt':moment()[_0x999c('0x25')](_0x999c('0x28'))}));});return BPromise['all'](_0x521ca7);}}})[_0x999c('0x17')](function(){if(_0x57b579){return _0x57b579[_0x999c('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x14d270){_0xc5e3c4(_0x14d270);})[_0x999c('0x1f')](function(_0xe02ce){_0x3f6c6a(_0x310827[_0x999c('0x1b')](0x1f4,_0xe02ce['message']));});});};exports[_0x999c('0x44')]=function(_0x55decd){var _0x32208d=this;return new Promise(function(_0xaf4df4,_0x521027){var _0x146317;var _0x215ba7;var _0x2236ed;var _0x5df3d8;return db['User'][_0x999c('0x42')]({'where':_0x55decd[_0x999c('0xf')][_0x999c('0x11')]||{},'attributes':['id',_0x999c('0x22'),_0x999c('0x23'),_0x999c('0x45'),_0x999c('0x46'),_0x999c('0x38'),_0x999c('0x47'),_0x999c('0x24')]})['then'](function(_0x464eec){if(_0x464eec){_0x146317=_0x464eec;_0x5df3d8=_0x55decd['body'][_0x999c('0x24')]?_0x55decd[_0x999c('0x2e')][_0x999c('0x24')]:util['format'](_0x999c('0x48'),_0x146317[_0x999c('0x22')]);return db[_0x999c('0x1d')][_0x999c('0x49')]({'where':{'role':_0x999c('0x4a'),'online':!![],'id':{'$ne':_0x146317['id']}}});}})[_0x999c('0x17')](function(_0x35c5f6){if(_0x35c5f6){_0x2236ed=_0x35c5f6;return require(_0x999c('0x4b'))[_0x999c('0x4c')]();}})[_0x999c('0x17')](function(_0x4a73b7){if(_0x4a73b7&&_0x4a73b7['agents']&&_0x2236ed>=_0x4a73b7[_0x999c('0x4d')]){throw new Error(_0x999c('0x4e'));}})[_0x999c('0x17')](function(){if(_0x146317){return db[_0x999c('0x26')][_0x999c('0x43')]({'where':{'membername':_0x146317[_0x999c('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x146317){return _0x146317['getVoiceQueues']({'raw':!![]});}})[_0x999c('0x17')](function(_0x502437){if(_0x146317){if(_0x502437){var _0x45894e=[];_0x215ba7=_0x502437;if(_0x215ba7[_0x999c('0x29')]){for(var _0x58a09e=0x0;_0x58a09e<_0x215ba7[_0x999c('0x29')];_0x58a09e++){_0x45894e['push'](db[_0x999c('0x26')][_0x999c('0x4f')]({'membername':_0x146317[_0x999c('0x22')],'UserId':_0x146317['id'],'queue_name':_0x215ba7[_0x58a09e][_0x999c('0x22')],'VoiceQueueId':_0x215ba7[_0x58a09e]['id'],'interface':_0x5df3d8,'paused':_0x146317[_0x999c('0x47')]||![],'penalty':_0x215ba7[_0x58a09e][_0x999c('0x50')]||0x0}));}return BPromise['all'](_0x45894e);}}}})[_0x999c('0x17')](function(){if(_0x146317){return db[_0x999c('0x30')][_0x999c('0xe')]({'where':{'membername':_0x146317[_0x999c('0x22')],'exitAt':null}});}})[_0x999c('0x17')](function(_0xc820d){if(_0x146317){if(_0xc820d&&_0xc820d[_0x999c('0x29')]){var _0x38a9f6=[];_0xc820d[_0x999c('0x2b')](function(_0x469ae4){_0x38a9f6[_0x999c('0x2c')](_0x469ae4[_0x999c('0x27')]({'exitAt':moment()[_0x999c('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x999c('0x51')](_0x38a9f6);}}})[_0x999c('0x17')](function(){if(_0x146317){var _0x59199b=[];var _0x37e014=[];var _0x40c76f=utils[_0x999c('0x52')]();var _0xb7a7dd={'membername':_0x146317['name'],'interface':_0x5df3d8,'enterAt':moment()['format'](_0x999c('0x28')),'role':_0x146317[_0x999c('0x23')],'internal':_0x146317[_0x999c('0x38')]};_0x40c76f['forEach'](function(_0x20b0a3){_0x59199b[_0x999c('0x2c')](_[_0x999c('0x53')]({'channel':_0x20b0a3,'type':'LOGIN','data1':_0x999c('0x54'),'data2':_0x5df3d8},_0xb7a7dd));if(_0x146317['loginInPause']){_0x37e014[_0x999c('0x2c')](_[_0x999c('0x53')]({'channel':_0x20b0a3,'type':_0x999c('0x2d'),'data1':_0x999c('0x55')},_0xb7a7dd));}});return db[_0x999c('0x30')]['bulkCreate'](_0x59199b[_0x999c('0x56')](_0x37e014),{'individualHooks':!![]});}})['then'](function(){if(_0x146317){return _0x146317['update']({'online':!![],'lastLoginAt':moment()[_0x999c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x146317[_0x999c('0x47')]||![],'mailPause':_0x146317['loginInPause']||![],'chatPause':_0x146317[_0x999c('0x47')]||![],'faxPause':_0x146317[_0x999c('0x47')]||![],'smsPause':_0x146317[_0x999c('0x47')]||![],'openchannelPause':_0x146317[_0x999c('0x47')]||![],'pauseType':_0x146317['loginInPause']?_0x999c('0x55'):null,'lastPauseAt':moment()['format'](_0x999c('0x28')),'interface':_0x5df3d8});}})['then'](function(_0xdcdea8){_0xaf4df4(_0xdcdea8);})['catch'](function(_0x213a71){_0x521027(_0x32208d['error'](0x1f4,_0x213a71['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a9d69a2..e9ed3a1 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 _0x07e9=['save','remove','update','removeListener','register','length','user:'];(function(_0x4e3397,_0x20951a){var _0x4398c6=function(_0x187045){while(--_0x187045){_0x4e3397['push'](_0x4e3397['shift']());}};_0x4398c6(++_0x20951a);}(_0x07e9,0xaf));var _0x907e=function(_0x5a318e,_0x5e22c1){_0x5a318e=_0x5a318e-0x0;var _0xfc8c84=_0x07e9[_0x5a318e];return _0xfc8c84;};'use strict';var UserEvents=require('./user.events');var events=[_0x907e('0x0'),_0x907e('0x1'),_0x907e('0x2')];function createListener(_0x423786,_0x5c99da){return function(_0xb55c9e){_0x5c99da['emit'](_0x423786,_0xb55c9e);};}function removeListener(_0x60fb9e,_0x577dd1){return function(){UserEvents[_0x907e('0x3')](_0x60fb9e,_0x577dd1);};}exports[_0x907e('0x4')]=function(_0x505a7c){for(var _0x55af45=0x0,_0x25ddcd=events[_0x907e('0x5')];_0x55af45<_0x25ddcd;_0x55af45++){var _0x1b73e6=events[_0x55af45];var _0x1a348f=createListener(_0x907e('0x6')+_0x1b73e6,_0x505a7c);UserEvents['on'](_0x1b73e6,_0x1a348f);}}; \ No newline at end of file +var _0x1dcf=['./user.events','save','remove','update','emit','register','user:'];(function(_0x2b1a38,_0x3e0dcc){var _0xbe2042=function(_0x5661d9){while(--_0x5661d9){_0x2b1a38['push'](_0x2b1a38['shift']());}};_0xbe2042(++_0x3e0dcc);}(_0x1dcf,0xcb));var _0xf1dc=function(_0x2b7d94,_0xaa50ab){_0x2b7d94=_0x2b7d94-0x0;var _0x34a28c=_0x1dcf[_0x2b7d94];return _0x34a28c;};'use strict';var UserEvents=require(_0xf1dc('0x0'));var events=[_0xf1dc('0x1'),_0xf1dc('0x2'),_0xf1dc('0x3')];function createListener(_0x2cab3f,_0x5ec060){return function(_0x3560e1){_0x5ec060[_0xf1dc('0x4')](_0x2cab3f,_0x3560e1);};}function removeListener(_0x58c12b,_0x1843f6){return function(){UserEvents['removeListener'](_0x58c12b,_0x1843f6);};}exports[_0xf1dc('0x5')]=function(_0x15f3de){for(var _0x571a05=0x0,_0x26fe5c=events['length'];_0x571a05<_0x26fe5c;_0x571a05++){var _0x4c7187=events[_0x571a05];var _0x60aa1f=createListener(_0xf1dc('0x6')+_0x4c7187,_0x15f3de);UserEvents['on'](_0x4c7187,_0x60aa1f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f6453d4..402e98d 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5adc68,_0x1a31b9){var _0x1b40f8=function(_0x4673c0){while(--_0x4673c0){_0x5adc68['push'](_0x5adc68['shift']());}};_0x1b40f8(++_0x1a31b9);}(_0x70e0,0x17b));var _0x070e=function(_0x55762b,_0x5d1748){_0x55762b=_0x55762b-0x0;var _0x566097=_0x70e0[_0x55762b];return _0x566097;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x144a7d,_0x2fa3ad){var _0x5d4147=function(_0x497e69){while(--_0x497e69){_0x144a7d['push'](_0x144a7d['shift']());}};_0x5d4147(++_0x2fa3ad);}(_0x70e0,0x17b));var _0x070e=function(_0x45a792,_0x2a20c4){_0x45a792=_0x45a792-0x0;var _0x4de944=_0x70e0[_0x45a792];return _0x4de944;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6a99949..b972fb3 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 _0x167b=['INTEGER','sequelize','exports'];(function(_0x52245c,_0x28e3a2){var _0x4ab58b=function(_0x3bfffe){while(--_0x3bfffe){_0x52245c['push'](_0x52245c['shift']());}};_0x4ab58b(++_0x28e3a2);}(_0x167b,0x163));var _0xb167=function(_0x3ee614,_0x5ed63e){_0x3ee614=_0x3ee614-0x0;var _0x17d484=_0x167b[_0x3ee614];return _0x17d484;};'use strict';var Sequelize=require(_0xb167('0x0'));module[_0xb167('0x1')]={'penalty':{'type':Sequelize[_0xb167('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6ee=['INTEGER','sequelize'];(function(_0x4f26a9,_0x5eeac3){var _0x52e79b=function(_0x2ef728){while(--_0x2ef728){_0x4f26a9['push'](_0x4f26a9['shift']());}};_0x52e79b(++_0x5eeac3);}(_0xa6ee,0xd3));var _0xea6e=function(_0x58dfcc,_0x1c7f38){_0x58dfcc=_0x58dfcc-0x0;var _0x5e395b=_0xa6ee[_0x58dfcc];return _0x5e395b;};'use strict';var Sequelize=require(_0xea6e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xea6e('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 a80577b..99725b8 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 _0xb363=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','../../config/environment','exports','define','UserChatQueue'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xb363,0x1cd));var _0x3b36=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb363[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x3b36('0x0'));var util=require(_0x3b36('0x1'));var logger=require(_0x3b36('0x2'))(_0x3b36('0x3'));var moment=require('moment');var BPromise=require(_0x3b36('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b36('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x3b36('0x6')]=function(_0x177d2,_0xa136cf){return _0x177d2[_0x3b36('0x7')](_0x3b36('0x8'),attributes,{'tableName':_0x3b36('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93f6=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues'];(function(_0x11dca7,_0x4cd733){var _0x4d7e12=function(_0x6beeac){while(--_0x6beeac){_0x11dca7['push'](_0x11dca7['shift']());}};_0x4d7e12(++_0x4cd733);}(_0x93f6,0x12c));var _0x693f=function(_0x5bd241,_0x5b0dd7){_0x5bd241=_0x5bd241-0x0;var _0x3512a8=_0x93f6[_0x5bd241];return _0x3512a8;};'use strict';var _=require(_0x693f('0x0'));var util=require(_0x693f('0x1'));var logger=require(_0x693f('0x2'))(_0x693f('0x3'));var moment=require('moment');var BPromise=require(_0x693f('0x4'));var rp=require(_0x693f('0x5'));var fs=require('fs');var path=require(_0x693f('0x6'));var rimraf=require(_0x693f('0x7'));var config=require('../../config/environment');var attributes=require(_0x693f('0x8'));module['exports']=function(_0x3d2cf4,_0x519004){return _0x3d2cf4[_0x693f('0x9')](_0x693f('0xa'),attributes,{'tableName':_0x693f('0xb'),'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 2609431..d41e9fd 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 _0xff67=['rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xff67,0xa1));var _0x7ff6=function(_0x27c3fe,_0x4bf81f){_0x27c3fe=_0x27c3fe-0x0;var _0x10020c=_0xff67[_0x27c3fe];return _0x10020c;};'use strict';var _=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var moment=require(_0x7ff6('0x2'));var BPromise=require(_0x7ff6('0x3'));var rs=require(_0x7ff6('0x4'));var fs=require('fs');var Redis=require(_0x7ff6('0x5'));var db=require(_0x7ff6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ff6('0x7'));var config=require(_0x7ff6('0x8'));var jayson=require(_0x7ff6('0x9'));var client=jayson[_0x7ff6('0xa')][_0x7ff6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x557b19,_0x4996c9,_0x69b0d1){return new BPromise(function(_0x2ed370,_0x2a52ee){return client['request'](_0x557b19,_0x69b0d1)[_0x7ff6('0xc')](function(_0x4c5ce0){logger[_0x7ff6('0xd')](_0x7ff6('0xe'),_0x4996c9,_0x7ff6('0xf'));logger[_0x7ff6('0x10')](_0x7ff6('0x11'),_0x4996c9,_0x7ff6('0xf'),JSON[_0x7ff6('0x12')](_0x4c5ce0));if(_0x4c5ce0['error']){if(_0x4c5ce0[_0x7ff6('0x13')][_0x7ff6('0x14')]===0x1f4){logger[_0x7ff6('0x13')](_0x7ff6('0xe'),_0x4996c9,_0x4c5ce0['error']['message']);return _0x2a52ee(_0x4c5ce0['error'][_0x7ff6('0x15')]);}logger[_0x7ff6('0x13')](_0x7ff6('0xe'),_0x4996c9,_0x4c5ce0[_0x7ff6('0x13')][_0x7ff6('0x15')]);return _0x2ed370(_0x4c5ce0[_0x7ff6('0x13')]['message']);}else{logger['info'](_0x7ff6('0xe'),_0x4996c9,_0x7ff6('0xf'));_0x2ed370(_0x4c5ce0[_0x7ff6('0x16')][_0x7ff6('0x15')]);}})[_0x7ff6('0x17')](function(_0x406525){logger['error'](_0x7ff6('0xe'),_0x4996c9,_0x406525);_0x2a52ee(_0x406525);});});} \ No newline at end of file +var _0x7ae9=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x248a82,_0x4fca3e){var _0x4bef56=function(_0x1d68f6){while(--_0x1d68f6){_0x248a82['push'](_0x248a82['shift']());}};_0x4bef56(++_0x4fca3e);}(_0x7ae9,0x1de));var _0x97ae=function(_0x3df63f,_0x20cd7b){_0x3df63f=_0x3df63f-0x0;var _0x4b54f0=_0x7ae9[_0x3df63f];return _0x4b54f0;};'use strict';var _=require(_0x97ae('0x0'));var util=require(_0x97ae('0x1'));var moment=require(_0x97ae('0x2'));var BPromise=require(_0x97ae('0x3'));var rs=require(_0x97ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97ae('0x5'))['db'];var utils=require(_0x97ae('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x97ae('0x7'));var jayson=require(_0x97ae('0x8'));var client=jayson[_0x97ae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d39e8,_0x5d604c,_0x2ee43a){return new BPromise(function(_0x3eb35b,_0x5a93ba){return client[_0x97ae('0xa')](_0x2d39e8,_0x2ee43a)[_0x97ae('0xb')](function(_0x20cf3c){logger[_0x97ae('0xc')](_0x97ae('0xd'),_0x5d604c,_0x97ae('0xe'));logger[_0x97ae('0xf')](_0x97ae('0x10'),_0x5d604c,_0x97ae('0xe'),JSON[_0x97ae('0x11')](_0x20cf3c));if(_0x20cf3c[_0x97ae('0x12')]){if(_0x20cf3c['error'][_0x97ae('0x13')]===0x1f4){logger[_0x97ae('0x12')](_0x97ae('0xd'),_0x5d604c,_0x20cf3c[_0x97ae('0x12')][_0x97ae('0x14')]);return _0x5a93ba(_0x20cf3c[_0x97ae('0x12')]['message']);}logger[_0x97ae('0x12')](_0x97ae('0xd'),_0x5d604c,_0x20cf3c['error'][_0x97ae('0x14')]);return _0x3eb35b(_0x20cf3c[_0x97ae('0x12')][_0x97ae('0x14')]);}else{logger[_0x97ae('0xc')](_0x97ae('0xd'),_0x5d604c,_0x97ae('0xe'));_0x3eb35b(_0x20cf3c['result']['message']);}})[_0x97ae('0x15')](function(_0x1c025){logger[_0x97ae('0x12')](_0x97ae('0xd'),_0x5d604c,_0x1c025);_0x5a93ba(_0x1c025);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 49ace53..1d00ef8 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13a104,_0x184d79){var _0x51f3dc=function(_0x1c252c){while(--_0x1c252c){_0x13a104['push'](_0x13a104['shift']());}};_0x51f3dc(++_0x184d79);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1af19c,_0x513aa2){var _0x5b94be=function(_0x35b00b){while(--_0x35b00b){_0x1af19c['push'](_0x1af19c['shift']());}};_0x5b94be(++_0x513aa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index adc28d4..39505e4 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 _0x44f9=['STRING','sequelize','exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44f9,0xf9));var _0x944f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x44f9[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x944f('0x0'));module[_0x944f('0x1')]={'penalty':{'type':Sequelize[_0x944f('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x944f('0x3')]}}; \ No newline at end of file +var _0x4c7f=['exports','INTEGER','STRING','sequelize'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x4c7f,0x73));var _0xf4c7=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x4c7f[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0xf4c7('0x0'));module[_0xf4c7('0x1')]={'penalty':{'type':Sequelize[_0xf4c7('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf4c7('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf4c7('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 141f3c3..83e144a 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 _0x5b64=['user_has_fax_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5b64,0x90));var _0x45b6=function(_0x4744df,_0x4b1aa3){_0x4744df=_0x4744df-0x0;var _0x5d195f=_0x5b64[_0x4744df];return _0x5d195f;};'use strict';var _=require(_0x45b6('0x0'));var util=require('util');var logger=require(_0x45b6('0x1'))(_0x45b6('0x2'));var moment=require(_0x45b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x45b6('0x4'));var fs=require('fs');var path=require(_0x45b6('0x5'));var rimraf=require(_0x45b6('0x6'));var config=require(_0x45b6('0x7'));var attributes=require(_0x45b6('0x8'));module[_0x45b6('0x9')]=function(_0x1f5dde,_0x43234d){return _0x1f5dde[_0x45b6('0xa')](_0x45b6('0xb'),attributes,{'tableName':_0x45b6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1968=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x104719,_0x502ef1){var _0x5120b8=function(_0xbfacd3){while(--_0xbfacd3){_0x104719['push'](_0x104719['shift']());}};_0x5120b8(++_0x502ef1);}(_0x1968,0xf6));var _0x8196=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x1968[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x8196('0x0'));var util=require(_0x8196('0x1'));var logger=require(_0x8196('0x2'))(_0x8196('0x3'));var moment=require(_0x8196('0x4'));var BPromise=require(_0x8196('0x5'));var rp=require(_0x8196('0x6'));var fs=require('fs');var path=require(_0x8196('0x7'));var rimraf=require(_0x8196('0x8'));var config=require(_0x8196('0x9'));var attributes=require(_0x8196('0xa'));module['exports']=function(_0x58f2e9,_0x277e44){return _0x58f2e9[_0x8196('0xb')](_0x8196('0xc'),attributes,{'tableName':_0x8196('0xd'),'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 eb7d146..aadb91e 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 _0x7bba=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x34cde3,_0xf23917){var _0x3143b1=function(_0x191690){while(--_0x191690){_0x34cde3['push'](_0x34cde3['shift']());}};_0x3143b1(++_0xf23917);}(_0x7bba,0xa1));var _0xa7bb=function(_0x4b3d10,_0x3da823){_0x4b3d10=_0x4b3d10-0x0;var _0x3f62cc=_0x7bba[_0x4b3d10];return _0x3f62cc;};'use strict';var _=require(_0xa7bb('0x0'));var util=require(_0xa7bb('0x1'));var moment=require(_0xa7bb('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7bb('0x5'));var jayson=require(_0xa7bb('0x6'));var client=jayson[_0xa7bb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d0f7a,_0x1d0ab0,_0x27a446){return new BPromise(function(_0x55b5d5,_0x34c7b1){return client[_0xa7bb('0x8')](_0x5d0f7a,_0x27a446)[_0xa7bb('0x9')](function(_0x2cee3c){logger[_0xa7bb('0xa')](_0xa7bb('0xb'),_0x1d0ab0,_0xa7bb('0xc'));logger[_0xa7bb('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1d0ab0,_0xa7bb('0xc'),JSON[_0xa7bb('0xe')](_0x2cee3c));if(_0x2cee3c[_0xa7bb('0xf')]){if(_0x2cee3c['error'][_0xa7bb('0x10')]===0x1f4){logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0x2cee3c[_0xa7bb('0xf')]['message']);return _0x34c7b1(_0x2cee3c[_0xa7bb('0xf')][_0xa7bb('0x11')]);}logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0x2cee3c[_0xa7bb('0xf')][_0xa7bb('0x11')]);return _0x55b5d5(_0x2cee3c['error'][_0xa7bb('0x11')]);}else{logger[_0xa7bb('0xa')](_0xa7bb('0xb'),_0x1d0ab0,_0xa7bb('0xc'));_0x55b5d5(_0x2cee3c[_0xa7bb('0x12')][_0xa7bb('0x11')]);}})[_0xa7bb('0x13')](function(_0xfcb6a1){logger[_0xa7bb('0xf')](_0xa7bb('0xb'),_0x1d0ab0,_0xfcb6a1);_0x34c7b1(_0xfcb6a1);});});} \ No newline at end of file +var _0xc164=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53d110,_0x127a95){var _0x4b0e6c=function(_0x2041a7){while(--_0x2041a7){_0x53d110['push'](_0x53d110['shift']());}};_0x4b0e6c(++_0x127a95);}(_0xc164,0xc0));var _0x4c16=function(_0x1054cd,_0xfb1cdd){_0x1054cd=_0x1054cd-0x0;var _0x26d9f7=_0xc164[_0x1054cd];return _0x26d9f7;};'use strict';var _=require(_0x4c16('0x0'));var util=require('util');var moment=require(_0x4c16('0x1'));var BPromise=require(_0x4c16('0x2'));var rs=require(_0x4c16('0x3'));var fs=require('fs');var Redis=require(_0x4c16('0x4'));var db=require(_0x4c16('0x5'))['db'];var utils=require(_0x4c16('0x6'));var logger=require('../../config/logger')(_0x4c16('0x7'));var config=require(_0x4c16('0x8'));var jayson=require(_0x4c16('0x9'));var client=jayson[_0x4c16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41bfae,_0x2e7db3,_0x3d59e7){return new BPromise(function(_0x447fa3,_0x40c4ce){return client[_0x4c16('0xb')](_0x41bfae,_0x3d59e7)['then'](function(_0x46d483){logger['info'](_0x4c16('0xc'),_0x2e7db3,_0x4c16('0xd'));logger[_0x4c16('0xe')](_0x4c16('0xf'),_0x2e7db3,_0x4c16('0xd'),JSON[_0x4c16('0x10')](_0x46d483));if(_0x46d483[_0x4c16('0x11')]){if(_0x46d483[_0x4c16('0x11')][_0x4c16('0x12')]===0x1f4){logger[_0x4c16('0x11')](_0x4c16('0xc'),_0x2e7db3,_0x46d483[_0x4c16('0x11')][_0x4c16('0x13')]);return _0x40c4ce(_0x46d483[_0x4c16('0x11')][_0x4c16('0x13')]);}logger[_0x4c16('0x11')](_0x4c16('0xc'),_0x2e7db3,_0x46d483['error']['message']);return _0x447fa3(_0x46d483[_0x4c16('0x11')][_0x4c16('0x13')]);}else{logger[_0x4c16('0x14')](_0x4c16('0xc'),_0x2e7db3,_0x4c16('0xd'));_0x447fa3(_0x46d483[_0x4c16('0x15')][_0x4c16('0x13')]);}})[_0x4c16('0x16')](function(_0x5f51db){logger[_0x4c16('0x11')](_0x4c16('0xc'),_0x2e7db3,_0x5f51db);_0x40c4ce(_0x5f51db);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dba2e70..8088088 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a73ee,_0x1c1b2a){var _0x42f95a=function(_0x161bab){while(--_0x161bab){_0x2a73ee['push'](_0x2a73ee['shift']());}};_0x42f95a(++_0x1c1b2a);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x104b24,_0x43bd25){var _0x23fb5b=function(_0x2dbfef){while(--_0x2dbfef){_0x104b24['push'](_0x104b24['shift']());}};_0x23fb5b(++_0x43bd25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ee87abb..5e1dd2e 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 _0x2aca=['INTEGER','sequelize','exports'];(function(_0x9b149f,_0x3d1b4d){var _0x3195a4=function(_0x31a1a7){while(--_0x31a1a7){_0x9b149f['push'](_0x9b149f['shift']());}};_0x3195a4(++_0x3d1b4d);}(_0x2aca,0x166));var _0xa2ac=function(_0x119015,_0x350f09){_0x119015=_0x119015-0x0;var _0x568988=_0x2aca[_0x119015];return _0x568988;};'use strict';var Sequelize=require(_0xa2ac('0x0'));module[_0xa2ac('0x1')]={'penalty':{'type':Sequelize[_0xa2ac('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcab7=['exports','sequelize'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0xcab7,0x163));var _0x7cab=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xcab7[_0x2d3ab3];return _0x321f9e;};'use strict';var Sequelize=require(_0x7cab('0x0'));module[_0x7cab('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 828827c..08e882e 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 _0x7e56=['../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x182603,_0x41180e){var _0x3a93e7=function(_0x4150c6){while(--_0x4150c6){_0x182603['push'](_0x182603['shift']());}};_0x3a93e7(++_0x41180e);}(_0x7e56,0x19b));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x67e5('0x0'));var util=require('util');var logger=require(_0x67e5('0x1'))(_0x67e5('0x2'));var moment=require(_0x67e5('0x3'));var BPromise=require(_0x67e5('0x4'));var rp=require(_0x67e5('0x5'));var fs=require('fs');var path=require(_0x67e5('0x6'));var rimraf=require('rimraf');var config=require(_0x67e5('0x7'));var attributes=require(_0x67e5('0x8'));module['exports']=function(_0x5cf0f3,_0x24c041){return _0x5cf0f3[_0x67e5('0x9')]('UserMailQueue',attributes,{'tableName':_0x67e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe83f=['exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2fa771,_0x511aec){var _0x8f89c2=function(_0x376db1){while(--_0x376db1){_0x2fa771['push'](_0x2fa771['shift']());}};_0x8f89c2(++_0x511aec);}(_0xe83f,0x1a8));var _0xfe83=function(_0x90e597,_0x5e2cb2){_0x90e597=_0x90e597-0x0;var _0x530763=_0xe83f[_0x90e597];return _0x530763;};'use strict';var _=require(_0xfe83('0x0'));var util=require(_0xfe83('0x1'));var logger=require('../../config/logger')(_0xfe83('0x2'));var moment=require(_0xfe83('0x3'));var BPromise=require(_0xfe83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe83('0x5'));var rimraf=require(_0xfe83('0x6'));var config=require(_0xfe83('0x7'));var attributes=require('./userMailQueue.attributes');module[_0xfe83('0x8')]=function(_0x5444d4,_0x31301a){return _0x5444d4[_0xfe83('0x9')](_0xfe83('0xa'),attributes,{'tableName':_0xfe83('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 e33ec3a..dd884a9 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47b622,_0x207a7b){var _0x290b4d=function(_0x100769){while(--_0x100769){_0x47b622['push'](_0x47b622['shift']());}};_0x290b4d(++_0x207a7b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41eb89,_0x4efc2a){_0x41eb89=_0x41eb89-0x0;var _0x5c08c7=_0x8ef6[_0x41eb89];return _0x5c08c7;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7217,0x19e));var _0x7721=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7217[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 87f979d..6e85f5e 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 _0x38dc=['./userNotification.controller','isAuthenticated','exports','multer','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x2207a0,_0x56f0d2){var _0x3f5e42=function(_0x30bb4d){while(--_0x30bb4d){_0x2207a0['push'](_0x2207a0['shift']());}};_0x3f5e42(++_0x56f0d2);}(_0x38dc,0x1cb));var _0xc38d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x38dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc38d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc38d('0x1'));var express=require(_0xc38d('0x2'));var router=express['Router']();var fs_extra=require(_0xc38d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc38d('0x4'));var controller=require(_0xc38d('0x5'));router['post']('/',auth[_0xc38d('0x6')](),controller['sendUserNotification']);module[_0xc38d('0x7')]=router; \ No newline at end of file +var _0x4a1c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','multer','util','connect-timeout','express'];(function(_0xfcf48a,_0x408411){var _0x1522d0=function(_0x334ba2){while(--_0x334ba2){_0xfcf48a['push'](_0xfcf48a['shift']());}};_0x1522d0(++_0x408411);}(_0x4a1c,0x10f));var _0xc4a1=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x4a1c[_0x786e9];return _0x1f891b;};'use strict';var multer=require(_0xc4a1('0x0'));var util=require(_0xc4a1('0x1'));var path=require('path');var timeout=require(_0xc4a1('0x2'));var express=require(_0xc4a1('0x3'));var router=express[_0xc4a1('0x4')]();var fs_extra=require(_0xc4a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4a1('0x6'));var config=require(_0xc4a1('0x7'));var controller=require(_0xc4a1('0x8'));router['post']('/',auth[_0xc4a1('0x9')](),controller[_0xc4a1('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 1b41a4e..42f7705 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 _0xdb36=['STRING','exports','TEXT'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xdb36,0xbe));var _0x6db3=function(_0xaa6fcb,_0x5b998){_0xaa6fcb=_0xaa6fcb-0x0;var _0x2e3029=_0xdb36[_0xaa6fcb];return _0x2e3029;};'use strict';var Sequelize=require('sequelize');module[_0x6db3('0x0')]={'body':{'type':Sequelize[_0x6db3('0x1')]},'senderName':{'type':Sequelize[_0x6db3('0x2')]},'recipientsId':{'type':Sequelize[_0x6db3('0x1')]},'recipientsDescription':{'type':Sequelize[_0x6db3('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x59d7=['BOOLEAN','exports','TEXT','STRING'];(function(_0x265edb,_0x1b1b6f){var _0x8c69bb=function(_0x40188d){while(--_0x40188d){_0x265edb['push'](_0x265edb['shift']());}};_0x8c69bb(++_0x1b1b6f);}(_0x59d7,0x129));var _0x759d=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x59d7[_0x2b9e8a];return _0x520e67;};'use strict';var Sequelize=require('sequelize');module[_0x759d('0x0')]={'body':{'type':Sequelize[_0x759d('0x1')]},'senderName':{'type':Sequelize[_0x759d('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x759d('0x2')]},'beep':{'type':Sequelize[_0x759d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 445251f..bfad5d4 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 _0xa67b=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','sequelize','UserNotification','forEach','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','model','User','union','ids','queue','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2ab47e,_0x2d89ea){var _0x4664e7=function(_0x12a435){while(--_0x12a435){_0x2ab47e['push'](_0x2ab47e['shift']());}};_0x4664e7(++_0x2d89ea);}(_0xa67b,0xb0));var _0xba67=function(_0x20b37f,_0x1f2dad){_0x20b37f=_0x20b37f-0x0;var _0x3edef1=_0xa67b[_0x20b37f];return _0x3edef1;};'use strict';var emlformat=require(_0xba67('0x0'));var rimraf=require(_0xba67('0x1'));var zipdir=require(_0xba67('0x2'));var jsonpatch=require(_0xba67('0x3'));var rp=require('request-promise');var moment=require(_0xba67('0x4'));var BPromise=require(_0xba67('0x5'));var Mustache=require(_0xba67('0x6'));var util=require(_0xba67('0x7'));var path=require(_0xba67('0x8'));var sox=require(_0xba67('0x9'));var csv=require(_0xba67('0xa'));var ejs=require(_0xba67('0xb'));var fs=require('fs');var fs_extra=require(_0xba67('0xc'));var _=require(_0xba67('0xd'));var squel=require(_0xba67('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba67('0xf'));var toCsv=require(_0xba67('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xba67('0x11'));var as=require(_0xba67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xba67('0x13'));var utils=require(_0xba67('0x14'));var config=require(_0xba67('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xba67('0x16')](config[_0xba67('0x17')],{'host':_0xba67('0x18'),'port':0x18eb});var socket=require(_0xba67('0x19'))(new Redis(config[_0xba67('0x17')]));require(_0xba67('0x1a'))[_0xba67('0x1b')](socket);function respondWithStatusCode(_0x397b09,_0x56393e){_0x56393e=_0x56393e||0xcc;return function(_0x3064ec){if(_0x3064ec){return _0x397b09[_0xba67('0x1c')](_0x56393e);}return _0x397b09[_0xba67('0x1d')](_0x56393e)[_0xba67('0x1e')]();};}function respondWithResult(_0x503391,_0x455ba5){_0x455ba5=_0x455ba5||0xc8;return function(_0x4af939){if(_0x4af939){return _0x503391[_0xba67('0x1d')](_0x455ba5)[_0xba67('0x1f')](_0x4af939);}};}function respondWithFilteredResult(_0x3dea84,_0x2517e9){return function(_0x172408){if(_0x172408){var _0x19530f=typeof _0x2517e9[_0xba67('0x20')]===_0xba67('0x21')&&typeof _0x2517e9[_0xba67('0x22')]===_0xba67('0x21');var _0x2bae5e=_0x172408[_0xba67('0x23')];var _0x3db530=_0x19530f?0x0:_0x2517e9['offset'];var _0x24d1da=_0x19530f?_0x172408[_0xba67('0x23')]:_0x2517e9[_0xba67('0x20')]+_0x2517e9[_0xba67('0x22')];var _0x5f4401;if(_0x24d1da>=_0x2bae5e){_0x24d1da=_0x2bae5e;_0x5f4401=0xc8;}else{_0x5f4401=0xce;}_0x3dea84[_0xba67('0x1d')](_0x5f4401);return _0x3dea84[_0xba67('0x24')](_0xba67('0x25'),_0x3db530+'-'+_0x24d1da+'/'+_0x2bae5e)[_0xba67('0x1f')](_0x172408);}return null;};}function patchUpdates(_0x4013b2){return function(_0x3430a4){try{jsonpatch[_0xba67('0x26')](_0x3430a4,_0x4013b2,!![]);}catch(_0x3284a1){return BPromise[_0xba67('0x27')](_0x3284a1);}return _0x3430a4[_0xba67('0x28')]();};}function saveUpdates(_0x51c67e,_0x394eea){return function(_0x550dc0){if(_0x550dc0){return _0x550dc0[_0xba67('0x29')](_0x51c67e)[_0xba67('0x2a')](function(_0x42ebd7){return _0x42ebd7;});}return null;};}function removeEntity(_0x5eb0ff,_0x77d448){return function(_0x9d05fb){if(_0x9d05fb){return _0x9d05fb['destroy']()[_0xba67('0x2a')](function(){_0x5eb0ff['status'](0xcc)[_0xba67('0x1e')]();});}};}function handleEntityNotFound(_0x391af7,_0x5cc0f8){return function(_0x5934d8){if(!_0x5934d8){_0x391af7[_0xba67('0x1c')](0x194);}return _0x5934d8;};}function handleError(_0x1ae8b4,_0xf344f3){_0xf344f3=_0xf344f3||0x1f4;return function(_0x36f2ac){logger[_0xba67('0x2b')](_0x36f2ac[_0xba67('0x2c')]);if(_0x36f2ac['name']){delete _0x36f2ac[_0xba67('0x2d')];}_0x1ae8b4[_0xba67('0x1d')](_0xf344f3)['send'](_0x36f2ac);};}exports[_0xba67('0x2e')]=function(_0x1df5e6,_0xc136e7,_0x243d65){if(!_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')](_0xba67('0x31'))&&!_0x1df5e6['body'][_0xba67('0x30')](_0xba67('0x32'))){throw new db['Sequelize'][(_0xba67('0x33'))](_0xba67('0x34'));}else{if(_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')](_0xba67('0x32'))&&!_0x1df5e6['body'][_0xba67('0x30')]('view')){throw new db[(_0xba67('0x35'))][(_0xba67('0x33'))](_0xba67('0x36'));}if(!_0x1df5e6[_0xba67('0x2f')][_0xba67('0x30')]('recipients')){throw new db['Sequelize']['ValidationError'](_0xba67('0x37'));}else{try{var _0x1d77b2=JSON['parse'](_0x1df5e6[_0xba67('0x2f')]['recipients']);}catch(_0x25efc3){logger[_0xba67('0x2b')](_0x25efc3);throw new db['Sequelize'][(_0xba67('0x33'))](_0xba67('0x38'));}var _0x394529=[_0xba67('0x39'),'faxqueue',_0xba67('0x3a'),'openchannelqueue',_0xba67('0x3b'),'voicequeue','whatsappqueue',_0xba67('0x3c'),_0xba67('0x3d')];if(_[_0xba67('0x3e')](_0x1d77b2,function(_0x4af102){return!_[_0xba67('0x3f')](_0x394529,_0x4af102['model'][_0xba67('0x40')]());})){throw new db['Sequelize']['ValidationError'](_0xba67('0x41'));}}}var _0x1b90f0={};_0x1b90f0[_0xba67('0x42')]=_0x1df5e6[_0xba67('0x2f')]['hasOwnProperty'](_0xba67('0x42'))?_0x1df5e6[_0xba67('0x2f')]['senderName']:_0x1df5e6[_0xba67('0x3d')][_0xba67('0x43')];_0x1b90f0[_0xba67('0x44')]=_['isEmpty'](_0x1df5e6[_0xba67('0x2f')][_0xba67('0x44')])?null:_0x1df5e6[_0xba67('0x2f')][_0xba67('0x44')];_0x1b90f0[_0xba67('0x45')]=_0x1df5e6[_0xba67('0x2f')][_0xba67('0x45')]||![];_0x1b90f0[_0xba67('0x46')]=_0x1df5e6['user']['id'];return getContent(_0x1df5e6['body'])['then'](function(_0x4b1a12){_0x1b90f0[_0xba67('0x2f')]=_0x4b1a12;return getRecipients(_0x1d77b2);})[_0xba67('0x2a')](function(_0x32dfbc){_0x1b90f0['recipientsId']=_['sortBy'](_0x32dfbc)['join'](',');return db[_0xba67('0x47')]['transaction'](function(_0xc5ef66){return db[_0xba67('0x48')]['create'](_0x1b90f0,{'raw':!![],'transaction':_0xc5ef66})[_0xba67('0x2a')](function(_0x70ded7){var _0x75f165={'sender':_0x1b90f0[_0xba67('0x42')],'description':_0x1b90f0[_0xba67('0x44')],'content':_0x1b90f0['body'],'beep':_0x1b90f0['beep']};_0x32dfbc[_0xba67('0x49')](function(_0x2454f0){_0x75f165['recipient']=_0x2454f0;socket[_0xba67('0x4a')]('userNotification:send',_0x75f165);});return _0x70ded7;});});})[_0xba67('0x2a')](respondWithResult(_0xc136e7,0xc9))[_0xba67('0x4b')](handleError(_0xc136e7,null));};function getContent(_0x1a6dc4){return new BPromise(function(_0x2d0b6e,_0x585f5b){if(_0x1a6dc4[_0xba67('0x31')]){_0x2d0b6e(_0x1a6dc4[_0xba67('0x31')]);return;}return db[_0xba67('0x4c')][_0xba67('0x4d')]({'attributes':[_0xba67('0x4e')],'where':{'id':_0x1a6dc4[_0xba67('0x32')]},'raw':!![]})['then'](function(_0x5466de){if(!_0x5466de)throw new db[(_0xba67('0x35'))][(_0xba67('0x33'))](_0xba67('0x4f'));var _0x267fe7=Mustache['render'](_0x5466de[_0xba67('0x4e')],_0x1a6dc4[_0xba67('0x50')]);_0x2d0b6e(_0x267fe7);})[_0xba67('0x4b')](function(_0x38c4c0){_0x585f5b(_0x38c4c0);});});}function getRecipients(_0x55decf){return new BPromise(function(_0x215b80,_0x36a36d){var _0x1c1de2=[];var _0x26bc9f=[];_0x55decf[_0xba67('0x49')](function(_0x54daa8){var _0x356c17=_[_0xba67('0x51')](_0x54daa8[_0xba67('0x52')][_0xba67('0x40')]());if(_0x356c17===_0xba67('0x53')){_0x1c1de2=_[_0xba67('0x54')](_0x1c1de2,_0x54daa8[_0xba67('0x55')]);}else{if(_['includes'](_0x356c17,_0xba67('0x56')))_0x356c17=_0x356c17['replace'](_0xba67('0x56'),'Queue');_0x54daa8['ids']['forEach'](function(_0x5ee28d){_0x26bc9f['push'](getAgents(_0x356c17,_0x5ee28d));});}});return BPromise[_0xba67('0x57')](_0x26bc9f)[_0xba67('0x2a')](function(_0x2ad546){_0x1c1de2=_[_0xba67('0x54')](_0x1c1de2,_[_0xba67('0x58')](_0x2ad546));_0x215b80(_0x1c1de2);})[_0xba67('0x4b')](function(_0x5bbc52){_0x36a36d(_0x5bbc52);});});}function getAgents(_0x48be48,_0x166b65){return new BPromise(function(_0x21d1e4,_0x4835c7){return db[_0x48be48][_0xba67('0x4d')]({'where':{'id':_0x166b65}})['then'](function(_0x33e4cc){return _0x33e4cc[_0xba67('0x59')]({'attributes':['id'],'raw':!![]})[_0xba67('0x2a')](function(_0x3c78b8){var _0x15e082=_[_0xba67('0x5a')](_0x3c78b8,'id');_0x21d1e4(_0x15e082);});})[_0xba67('0x4b')](function(_0x531ef9){_0x4835c7(_0x531ef9);});});} \ No newline at end of file +var _0xc593=['Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','transaction','UserNotification','create','forEach','recipient','emit','catch','findOne','html','render','view','union','ids','queue','replace','Queue','all','flatten','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','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','redis','localhost','./userNotification.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients'];(function(_0x3b2395,_0x1cf2c1){var _0x2e6751=function(_0x4ea274){while(--_0x4ea274){_0x3b2395['push'](_0x3b2395['shift']());}};_0x2e6751(++_0x1cf2c1);}(_0xc593,0x19b));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c59('0x0'));var zipdir=require(_0x3c59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c59('0x2'));var moment=require(_0x3c59('0x3'));var BPromise=require(_0x3c59('0x4'));var Mustache=require(_0x3c59('0x5'));var util=require('util');var path=require(_0x3c59('0x6'));var sox=require(_0x3c59('0x7'));var csv=require(_0x3c59('0x8'));var ejs=require(_0x3c59('0x9'));var fs=require('fs');var fs_extra=require(_0x3c59('0xa'));var _=require(_0x3c59('0xb'));var squel=require(_0x3c59('0xc'));var crypto=require(_0x3c59('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c59('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c59('0xf'));var Papa=require('papaparse');var Redis=require(_0x3c59('0x10'));var authService=require(_0x3c59('0x11'));var qs=require(_0x3c59('0x12'));var as=require(_0x3c59('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3c59('0x14'));var config=require(_0x3c59('0x15'));var licenseUtil=require(_0x3c59('0x16'));var db=require('../../mysqldb')['db'];config[_0x3c59('0x17')]=_['defaults'](config[_0x3c59('0x17')],{'host':_0x3c59('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c59('0x17')]));require(_0x3c59('0x19'))[_0x3c59('0x1a')](socket);function respondWithStatusCode(_0x32231f,_0x12457b){_0x12457b=_0x12457b||0xcc;return function(_0x13444c){if(_0x13444c){return _0x32231f[_0x3c59('0x1b')](_0x12457b);}return _0x32231f[_0x3c59('0x1c')](_0x12457b)[_0x3c59('0x1d')]();};}function respondWithResult(_0x2ba51d,_0x5710cc){_0x5710cc=_0x5710cc||0xc8;return function(_0x43c977){if(_0x43c977){return _0x2ba51d[_0x3c59('0x1c')](_0x5710cc)['json'](_0x43c977);}};}function respondWithFilteredResult(_0x495051,_0x104ab7){return function(_0x321408){if(_0x321408){var _0x349a4d=typeof _0x104ab7[_0x3c59('0x1e')]==='undefined'&&typeof _0x104ab7['limit']===_0x3c59('0x1f');var _0x313f59=_0x321408['count'];var _0x3b3ee3=_0x349a4d?0x0:_0x104ab7['offset'];var _0x2e33e8=_0x349a4d?_0x321408[_0x3c59('0x20')]:_0x104ab7[_0x3c59('0x1e')]+_0x104ab7[_0x3c59('0x21')];var _0x365299;if(_0x2e33e8>=_0x313f59){_0x2e33e8=_0x313f59;_0x365299=0xc8;}else{_0x365299=0xce;}_0x495051[_0x3c59('0x1c')](_0x365299);return _0x495051[_0x3c59('0x22')]('Content-Range',_0x3b3ee3+'-'+_0x2e33e8+'/'+_0x313f59)[_0x3c59('0x23')](_0x321408);}return null;};}function patchUpdates(_0x1a8768){return function(_0x38b498){try{jsonpatch[_0x3c59('0x24')](_0x38b498,_0x1a8768,!![]);}catch(_0x2d9998){return BPromise['reject'](_0x2d9998);}return _0x38b498[_0x3c59('0x25')]();};}function saveUpdates(_0xab61ef,_0x416351){return function(_0x4416d0){if(_0x4416d0){return _0x4416d0[_0x3c59('0x26')](_0xab61ef)[_0x3c59('0x27')](function(_0x37bdb3){return _0x37bdb3;});}return null;};}function removeEntity(_0x3e975f,_0xfa4009){return function(_0x24e37b){if(_0x24e37b){return _0x24e37b[_0x3c59('0x28')]()[_0x3c59('0x27')](function(){_0x3e975f[_0x3c59('0x1c')](0xcc)[_0x3c59('0x1d')]();});}};}function handleEntityNotFound(_0x5594d3,_0x4113d7){return function(_0xbe95d2){if(!_0xbe95d2){_0x5594d3[_0x3c59('0x1b')](0x194);}return _0xbe95d2;};}function handleError(_0x1bb2f5,_0x2b0d15){_0x2b0d15=_0x2b0d15||0x1f4;return function(_0x49052a){logger[_0x3c59('0x29')](_0x49052a[_0x3c59('0x2a')]);if(_0x49052a['name']){delete _0x49052a['name'];}_0x1bb2f5[_0x3c59('0x1c')](_0x2b0d15)[_0x3c59('0x2b')](_0x49052a);};}exports[_0x3c59('0x2c')]=function(_0x50f4ac,_0xebd36d,_0x2965cf){if(!_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')](_0x3c59('0x2f'))&&!_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')](_0x3c59('0x30'))){throw new db[(_0x3c59('0x31'))][(_0x3c59('0x32'))](_0x3c59('0x33'));}else{if(_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')](_0x3c59('0x30'))&&!_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')]('view')){throw new db[(_0x3c59('0x31'))][(_0x3c59('0x32'))](_0x3c59('0x34'));}if(!_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')](_0x3c59('0x35'))){throw new db[(_0x3c59('0x31'))][(_0x3c59('0x32'))](_0x3c59('0x36'));}else{try{var _0xd030cb=JSON[_0x3c59('0x37')](_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x35')]);}catch(_0x36024b){logger[_0x3c59('0x29')](_0x36024b);throw new db[(_0x3c59('0x31'))]['ValidationError'](_0x3c59('0x38'));}var _0x2ce968=['chatqueue',_0x3c59('0x39'),'mailqueue',_0x3c59('0x3a'),_0x3c59('0x3b'),_0x3c59('0x3c'),'whatsappqueue','team',_0x3c59('0x3d')];if(_[_0x3c59('0x3e')](_0xd030cb,function(_0x5e4461){return!_[_0x3c59('0x3f')](_0x2ce968,_0x5e4461[_0x3c59('0x40')][_0x3c59('0x41')]());})){throw new db[(_0x3c59('0x31'))]['ValidationError'](_0x3c59('0x42'));}}}var _0x303d4a={};_0x303d4a[_0x3c59('0x43')]=_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x2e')](_0x3c59('0x43'))?_0x50f4ac[_0x3c59('0x2d')]['senderName']:_0x50f4ac[_0x3c59('0x3d')][_0x3c59('0x44')];_0x303d4a[_0x3c59('0x45')]=_[_0x3c59('0x46')](_0x50f4ac[_0x3c59('0x2d')]['recipientsDescription'])?null:_0x50f4ac[_0x3c59('0x2d')][_0x3c59('0x45')];_0x303d4a[_0x3c59('0x47')]=_0x50f4ac[_0x3c59('0x2d')]['beep']||![];_0x303d4a['SenderId']=_0x50f4ac[_0x3c59('0x3d')]['id'];return getContent(_0x50f4ac[_0x3c59('0x2d')])['then'](function(_0x32598d){_0x303d4a[_0x3c59('0x2d')]=_0x32598d;return getRecipients(_0xd030cb);})[_0x3c59('0x27')](function(_0x5ae96e){_0x303d4a[_0x3c59('0x48')]=_[_0x3c59('0x49')](_0x5ae96e)['join'](',');return db['sequelize'][_0x3c59('0x4a')](function(_0x1327ea){return db[_0x3c59('0x4b')][_0x3c59('0x4c')](_0x303d4a,{'raw':!![],'transaction':_0x1327ea})[_0x3c59('0x27')](function(_0x52df91){var _0x3e5a51={'sender':_0x303d4a['senderName'],'description':_0x303d4a['recipientsDescription'],'content':_0x303d4a[_0x3c59('0x2d')],'beep':_0x303d4a[_0x3c59('0x47')]};_0x5ae96e[_0x3c59('0x4d')](function(_0x20b3ab){_0x3e5a51[_0x3c59('0x4e')]=_0x20b3ab;socket[_0x3c59('0x4f')]('userNotification:send',_0x3e5a51);});return _0x52df91;});});})['then'](respondWithResult(_0xebd36d,0xc9))[_0x3c59('0x50')](handleError(_0xebd36d,null));};function getContent(_0x151a07){return new BPromise(function(_0x31f7cf,_0x5f4d70){if(_0x151a07[_0x3c59('0x2f')]){_0x31f7cf(_0x151a07[_0x3c59('0x2f')]);return;}return db['Template'][_0x3c59('0x51')]({'attributes':[_0x3c59('0x52')],'where':{'id':_0x151a07['TemplateId']},'raw':!![]})['then'](function(_0x8fe575){if(!_0x8fe575)throw new db['Sequelize'][(_0x3c59('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3c82ad=Mustache[_0x3c59('0x53')](_0x8fe575['html'],_0x151a07[_0x3c59('0x54')]);_0x31f7cf(_0x3c82ad);})[_0x3c59('0x50')](function(_0x4f49c4){_0x5f4d70(_0x4f49c4);});});}function getRecipients(_0x3d4ab9){return new BPromise(function(_0x1b8e1d,_0x16a062){var _0x18414b=[];var _0x3f78cb=[];_0x3d4ab9['forEach'](function(_0x33c650){var _0x7dd408=_['startCase'](_0x33c650['model']['toLowerCase']());if(_0x7dd408==='User'){_0x18414b=_[_0x3c59('0x55')](_0x18414b,_0x33c650[_0x3c59('0x56')]);}else{if(_[_0x3c59('0x3f')](_0x7dd408,_0x3c59('0x57')))_0x7dd408=_0x7dd408[_0x3c59('0x58')](_0x3c59('0x57'),_0x3c59('0x59'));_0x33c650[_0x3c59('0x56')][_0x3c59('0x4d')](function(_0x26ccb7){_0x3f78cb['push'](getAgents(_0x7dd408,_0x26ccb7));});}});return BPromise[_0x3c59('0x5a')](_0x3f78cb)[_0x3c59('0x27')](function(_0x261906){_0x18414b=_[_0x3c59('0x55')](_0x18414b,_[_0x3c59('0x5b')](_0x261906));_0x1b8e1d(_0x18414b);})[_0x3c59('0x50')](function(_0x4bfea7){_0x16a062(_0x4bfea7);});});}function getAgents(_0x5ba0c2,_0x19b051){return new BPromise(function(_0x607727,_0x110a59){return db[_0x5ba0c2][_0x3c59('0x51')]({'where':{'id':_0x19b051}})['then'](function(_0x37c916){return _0x37c916[_0x3c59('0x5c')]({'attributes':['id'],'raw':!![]})[_0x3c59('0x27')](function(_0x12aa84){var _0x3258d0=_['map'](_0x12aa84,'id');_0x607727(_0x3258d0);});})['catch'](function(_0x5001f9){_0x110a59(_0x5001f9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 044e630..57a5e59 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 _0x8782=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x5061ef,_0x38e3fd){var _0xab183a=function(_0x140464){while(--_0x140464){_0x5061ef['push'](_0x5061ef['shift']());}};_0xab183a(++_0x38e3fd);}(_0x8782,0x7e));var _0x2878=function(_0x97d7b9,_0x5a7f02){_0x97d7b9=_0x97d7b9-0x0;var _0x1284d1=_0x8782[_0x97d7b9];return _0x1284d1;};'use strict';var EventEmitter=require(_0x2878('0x0'));var UserNotification=require(_0x2878('0x1'))['db'][_0x2878('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2878('0x3')](0x0);var events={'afterCreate':_0x2878('0x4'),'afterUpdate':_0x2878('0x5'),'afterDestroy':_0x2878('0x6')};function emitEvent(_0x3c11bd){return function(_0x127675,_0x4a3e81,_0x198c40){UserNotificationEvents[_0x2878('0x7')](_0x3c11bd+':'+_0x127675['id'],_0x127675);UserNotificationEvents[_0x2878('0x7')](_0x3c11bd,_0x127675);_0x198c40(null);};}for(var e in events){if(events[_0x2878('0x8')](e)){var event=events[e];UserNotification[_0x2878('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xafd2=['exports','events','../../mysqldb','UserNotification','save','update','emit','hasOwnProperty','hook'];(function(_0x1a4fc7,_0x11dcff){var _0x5d90e2=function(_0xaea939){while(--_0xaea939){_0x1a4fc7['push'](_0x1a4fc7['shift']());}};_0x5d90e2(++_0x11dcff);}(_0xafd2,0x1cc));var _0x2afd=function(_0x246601,_0x20ac12){_0x246601=_0x246601-0x0;var _0x15b86f=_0xafd2[_0x246601];return _0x15b86f;};'use strict';var EventEmitter=require(_0x2afd('0x0'));var UserNotification=require(_0x2afd('0x1'))['db'][_0x2afd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2afd('0x3'),'afterUpdate':_0x2afd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a1971){return function(_0x1590ad,_0x233615,_0x2d30e4){UserNotificationEvents[_0x2afd('0x5')](_0x2a1971+':'+_0x1590ad['id'],_0x1590ad);UserNotificationEvents[_0x2afd('0x5')](_0x2a1971,_0x1590ad);_0x2d30e4(null);};}for(var e in events){if(events[_0x2afd('0x6')](e)){var event=events[e];UserNotification[_0x2afd('0x7')](e,emitEvent(event));}}module[_0x2afd('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index e994e6a..a7b01f6 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 _0x6cf5=['moment','bluebird','request-promise','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x198af0,_0x592ba9){var _0x7732f9=function(_0x3a3895){while(--_0x3a3895){_0x198af0['push'](_0x198af0['shift']());}};_0x7732f9(++_0x592ba9);}(_0x6cf5,0x72));var _0x56cf=function(_0x437116,_0x3e15d8){_0x437116=_0x437116-0x0;var _0x172892=_0x6cf5[_0x437116];return _0x172892;};'use strict';var _=require(_0x56cf('0x0'));var util=require('util');var logger=require(_0x56cf('0x1'))(_0x56cf('0x2'));var moment=require(_0x56cf('0x3'));var BPromise=require(_0x56cf('0x4'));var rp=require(_0x56cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56cf('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x56cf('0x7')]=function(_0xa1abb1,_0x52623b){return _0xa1abb1[_0x56cf('0x8')](_0x56cf('0x9'),attributes,{'tableName':_0x56cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x56cf('0xb'),'collate':_0x56cf('0xc')});}; \ No newline at end of file +var _0xabf1=['../../config/logger','moment','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabf1,0x96));var _0x1abf=function(_0x281d6b,_0xcdc3cf){_0x281d6b=_0x281d6b-0x0;var _0x5942ed=_0xabf1[_0x281d6b];return _0x5942ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1abf('0x0'))('api');var moment=require(_0x1abf('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1abf('0x2'));var rimraf=require(_0x1abf('0x3'));var config=require(_0x1abf('0x4'));var attributes=require(_0x1abf('0x5'));module[_0x1abf('0x6')]=function(_0x4b6057,_0x5814ad){return _0x4b6057[_0x1abf('0x7')](_0x1abf('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1abf('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index de27091..a6ec72b 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 _0xb09e=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent'];(function(_0x2ef643,_0x3bca06){var _0x22e230=function(_0x3193c2){while(--_0x3193c2){_0x2ef643['push'](_0x2ef643['shift']());}};_0x22e230(++_0x3bca06);}(_0xb09e,0x11b));var _0xeb09=function(_0x5757e8,_0x232eef){_0x5757e8=_0x5757e8-0x0;var _0x42d6af=_0xb09e[_0x5757e8];return _0x42d6af;};'use strict';var _=require(_0xeb09('0x0'));var util=require(_0xeb09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb09('0x2'));var fs=require('fs');var Redis=require(_0xeb09('0x3'));var db=require(_0xeb09('0x4'))['db'];var utils=require(_0xeb09('0x5'));var logger=require(_0xeb09('0x6'))(_0xeb09('0x7'));var config=require(_0xeb09('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeb09('0x9')]=_[_0xeb09('0xa')](config[_0xeb09('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb09('0xb'))(new Redis(config[_0xeb09('0x9')]));require(_0xeb09('0xc'))[_0xeb09('0xd')](socket);function respondWithRpcPromise(_0x5ecb96,_0x5821f6,_0x2710bc){return new BPromise(function(_0xd5ec11,_0x4c899d){return client[_0xeb09('0xe')](_0x5ecb96,_0x2710bc)['then'](function(_0xedc730){logger[_0xeb09('0xf')]('UserNotification,\x20%s,\x20%s',_0x5821f6,_0xeb09('0x10'));logger['debug'](_0xeb09('0x11'),_0x5821f6,'request\x20sent',JSON[_0xeb09('0x12')](_0xedc730));if(_0xedc730[_0xeb09('0x13')]){if(_0xedc730[_0xeb09('0x13')][_0xeb09('0x14')]===0x1f4){logger[_0xeb09('0x13')](_0xeb09('0x15'),_0x5821f6,_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);return _0x4c899d(_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);}logger[_0xeb09('0x13')]('UserNotification,\x20%s,\x20%s',_0x5821f6,_0xedc730['error'][_0xeb09('0x16')]);return _0xd5ec11(_0xedc730[_0xeb09('0x13')][_0xeb09('0x16')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5821f6,'request\x20sent');_0xd5ec11(_0xedc730[_0xeb09('0x17')][_0xeb09('0x16')]);}})[_0xeb09('0x18')](function(_0x4d33fe){logger[_0xeb09('0x13')](_0xeb09('0x15'),_0x5821f6,_0x4d33fe);_0x4c899d(_0x4d33fe);});});} \ No newline at end of file +var _0xa52b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa52b,0x13e));var _0xba52=function(_0x5a8dd9,_0x941b52){_0x5a8dd9=_0x5a8dd9-0x0;var _0x3fa001=_0xa52b[_0x5a8dd9];return _0x3fa001;};'use strict';var _=require(_0xba52('0x0'));var util=require(_0xba52('0x1'));var moment=require(_0xba52('0x2'));var BPromise=require(_0xba52('0x3'));var rs=require(_0xba52('0x4'));var fs=require('fs');var Redis=require(_0xba52('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba52('0x6'))(_0xba52('0x7'));var config=require(_0xba52('0x8'));var jayson=require(_0xba52('0x9'));var client=jayson[_0xba52('0xa')]['http']({'port':0x232a});config[_0xba52('0xb')]=_['defaults'](config['redis'],{'host':_0xba52('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xba52('0xd'))[_0xba52('0xe')](socket);function respondWithRpcPromise(_0x50e62d,_0x515a0a,_0x4db4c7){return new BPromise(function(_0x3c741e,_0xbce56a){return client[_0xba52('0xf')](_0x50e62d,_0x4db4c7)['then'](function(_0x3e25da){logger['info'](_0xba52('0x10'),_0x515a0a,'request\x20sent');logger[_0xba52('0x11')](_0xba52('0x12'),_0x515a0a,_0xba52('0x13'),JSON[_0xba52('0x14')](_0x3e25da));if(_0x3e25da[_0xba52('0x15')]){if(_0x3e25da[_0xba52('0x15')][_0xba52('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x515a0a,_0x3e25da['error'][_0xba52('0x17')]);return _0xbce56a(_0x3e25da[_0xba52('0x15')]['message']);}logger[_0xba52('0x15')](_0xba52('0x10'),_0x515a0a,_0x3e25da[_0xba52('0x15')][_0xba52('0x17')]);return _0x3c741e(_0x3e25da[_0xba52('0x15')][_0xba52('0x17')]);}else{logger[_0xba52('0x18')](_0xba52('0x10'),_0x515a0a,_0xba52('0x13'));_0x3c741e(_0x3e25da[_0xba52('0x19')][_0xba52('0x17')]);}})[_0xba52('0x1a')](function(_0x238e06){logger[_0xba52('0x15')](_0xba52('0x10'),_0x515a0a,_0x238e06);_0xbce56a(_0x238e06);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0cdc754..7eeda8e 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 _0x4410=['length','userNotification:','update','emit','removeListener','register'];(function(_0x3773b6,_0x879b5e){var _0x4240d4=function(_0x3eb1dd){while(--_0x3eb1dd){_0x3773b6['push'](_0x3773b6['shift']());}};_0x4240d4(++_0x879b5e);}(_0x4410,0x194));var _0x0441=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4410[_0xc4001c];return _0x49f7bc;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x0441('0x0')];function createListener(_0x29e653,_0x2c5f68){return function(_0x37460e){_0x2c5f68[_0x0441('0x1')](_0x29e653,_0x37460e);};}function removeListener(_0x375e9b,_0x4d1c15){return function(){UserNotificationEvents[_0x0441('0x2')](_0x375e9b,_0x4d1c15);};}exports[_0x0441('0x3')]=function(_0x1b76b6){for(var _0x9cb7d2=0x0,_0x1b891a=events[_0x0441('0x4')];_0x9cb7d2<_0x1b891a;_0x9cb7d2++){var _0x43a217=events[_0x9cb7d2];var _0x21bf7a=createListener(_0x0441('0x5')+_0x43a217,_0x1b76b6);UserNotificationEvents['on'](_0x43a217,_0x21bf7a);}}; \ No newline at end of file +var _0x986a=['userNotification:','save','remove','update','emit','removeListener'];(function(_0x58ede6,_0x2190a4){var _0x45579e=function(_0x6f79fa){while(--_0x6f79fa){_0x58ede6['push'](_0x58ede6['shift']());}};_0x45579e(++_0x2190a4);}(_0x986a,0x175));var _0xa986=function(_0x4357c2,_0x529d24){_0x4357c2=_0x4357c2-0x0;var _0x34cfc7=_0x986a[_0x4357c2];return _0x34cfc7;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa986('0x0'),_0xa986('0x1'),_0xa986('0x2')];function createListener(_0xfd4b50,_0xb9698c){return function(_0x4ce2dc){_0xb9698c[_0xa986('0x3')](_0xfd4b50,_0x4ce2dc);};}function removeListener(_0x555a63,_0x2c2b11){return function(){UserNotificationEvents[_0xa986('0x4')](_0x555a63,_0x2c2b11);};}exports['register']=function(_0x2deb80){for(var _0x3b8f90=0x0,_0x28d62f=events['length'];_0x3b8f90<_0x28d62f;_0x3b8f90++){var _0x685c99=events[_0x3b8f90];var _0x492506=createListener(_0xa986('0x5')+_0x685c99,_0x2deb80);UserNotificationEvents['on'](_0x685c99,_0x492506);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d418b5d..b49160a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4060ae,_0x2a6015){var _0x18a7c1=function(_0x114213){while(--_0x114213){_0x4060ae['push'](_0x4060ae['shift']());}};_0x18a7c1(++_0x2a6015);}(_0xe706,0xa3));var _0x6e70=function(_0x24ffa5,_0x119b94){_0x24ffa5=_0x24ffa5-0x0;var _0x1f0a5f=_0xe706[_0x24ffa5];return _0x1f0a5f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 793976e..606f9bc 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 _0x49d7=['sequelize','exports'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0x49d7,0x78));var _0x749d=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x49d7[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0x749d('0x0'));module[_0x749d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdc8=['exports'];(function(_0x3b4dc6,_0x401c98){var _0x25f344=function(_0x8738b7){while(--_0x8738b7){_0x3b4dc6['push'](_0x3b4dc6['shift']());}};_0x25f344(++_0x401c98);}(_0xcdc8,0x1a9));var _0x8cdc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xcdc8[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x8cdc('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 18b90a7..bc1f477 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 _0x5888=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4cc32c,_0x2f3921){var _0x23ef2c=function(_0x578a27){while(--_0x578a27){_0x4cc32c['push'](_0x4cc32c['shift']());}};_0x23ef2c(++_0x2f3921);}(_0x5888,0xbe));var _0x8588=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x5888[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x8588('0x0'));var util=require(_0x8588('0x1'));var logger=require(_0x8588('0x2'))('api');var moment=require(_0x8588('0x3'));var BPromise=require(_0x8588('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8588('0x5'));var rimraf=require(_0x8588('0x6'));var config=require(_0x8588('0x7'));var attributes=require(_0x8588('0x8'));module[_0x8588('0x9')]=function(_0x2df316,_0x1dd9a9){return _0x2df316[_0x8588('0xa')](_0x8588('0xb'),attributes,{'tableName':_0x8588('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0256=['api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x22f5c9,_0x29f501){var _0x20f444=function(_0x47372b){while(--_0x47372b){_0x22f5c9['push'](_0x22f5c9['shift']());}};_0x20f444(++_0x29f501);}(_0x0256,0x12a));var _0x6025=function(_0x4b5b86,_0x23c37a){_0x4b5b86=_0x4b5b86-0x0;var _0xd965ac=_0x0256[_0x4b5b86];return _0xd965ac;};'use strict';var _=require(_0x6025('0x0'));var util=require(_0x6025('0x1'));var logger=require('../../config/logger')(_0x6025('0x2'));var moment=require('moment');var BPromise=require(_0x6025('0x3'));var rp=require(_0x6025('0x4'));var fs=require('fs');var path=require(_0x6025('0x5'));var rimraf=require(_0x6025('0x6'));var config=require('../../config/environment');var attributes=require(_0x6025('0x7'));module[_0x6025('0x8')]=function(_0x2a8c8b,_0x3eb8ba){return _0x2a8c8b[_0x6025('0x9')](_0x6025('0xa'),attributes,{'tableName':_0x6025('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index e59b9e8..eecae90 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 _0x3e64=['code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcd26a9,_0x512e77){var _0x3afcbc=function(_0x40e770){while(--_0x40e770){_0xcd26a9['push'](_0xcd26a9['shift']());}};_0x3afcbc(++_0x512e77);}(_0x3e64,0x1df));var _0x43e6=function(_0x370157,_0x11077f){_0x370157=_0x370157-0x0;var _0x5495c6=_0x3e64[_0x370157];return _0x5495c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43e6('0x0'));var BPromise=require(_0x43e6('0x1'));var rs=require(_0x43e6('0x2'));var fs=require('fs');var Redis=require(_0x43e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x43e6('0x5'));var client=jayson[_0x43e6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512bf,_0x3b92f3,_0x4c1f11){return new BPromise(function(_0x34da6b,_0x280722){return client[_0x43e6('0x7')](_0x4512bf,_0x4c1f11)[_0x43e6('0x8')](function(_0x5b54a3){logger[_0x43e6('0x9')](_0x43e6('0xa'),_0x3b92f3,'request\x20sent');logger[_0x43e6('0xb')](_0x43e6('0xc'),_0x3b92f3,'request\x20sent',JSON[_0x43e6('0xd')](_0x5b54a3));if(_0x5b54a3[_0x43e6('0xe')]){if(_0x5b54a3[_0x43e6('0xe')][_0x43e6('0xf')]===0x1f4){logger[_0x43e6('0xe')](_0x43e6('0xa'),_0x3b92f3,_0x5b54a3['error'][_0x43e6('0x10')]);return _0x280722(_0x5b54a3[_0x43e6('0xe')]['message']);}logger['error'](_0x43e6('0xa'),_0x3b92f3,_0x5b54a3['error'][_0x43e6('0x10')]);return _0x34da6b(_0x5b54a3['error'][_0x43e6('0x10')]);}else{logger[_0x43e6('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3b92f3,_0x43e6('0x11'));_0x34da6b(_0x5b54a3[_0x43e6('0x12')][_0x43e6('0x10')]);}})['catch'](function(_0x3e276d){logger['error'](_0x43e6('0xa'),_0x3b92f3,_0x3e276d);_0x280722(_0x3e276d);});});} \ No newline at end of file +var _0xef2d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x4f6599,_0x3fa51e){var _0x1b487a=function(_0x2564b5){while(--_0x2564b5){_0x4f6599['push'](_0x4f6599['shift']());}};_0x1b487a(++_0x3fa51e);}(_0xef2d,0x11a));var _0xdef2=function(_0x34803b,_0x2c7909){_0x34803b=_0x34803b-0x0;var _0x272c71=_0xef2d[_0x34803b];return _0x272c71;};'use strict';var _=require(_0xdef2('0x0'));var util=require(_0xdef2('0x1'));var moment=require('moment');var BPromise=require(_0xdef2('0x2'));var rs=require(_0xdef2('0x3'));var fs=require('fs');var Redis=require(_0xdef2('0x4'));var db=require(_0xdef2('0x5'))['db'];var utils=require(_0xdef2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdef2('0x7'));var jayson=require(_0xdef2('0x8'));var client=jayson['client'][_0xdef2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x74209c,_0x5c8c1a,_0x378609){return new BPromise(function(_0x4a9d5c,_0x1d0229){return client['request'](_0x74209c,_0x378609)['then'](function(_0x551ae2){logger[_0xdef2('0xa')](_0xdef2('0xb'),_0x5c8c1a,_0xdef2('0xc'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5c8c1a,_0xdef2('0xc'),JSON[_0xdef2('0xd')](_0x551ae2));if(_0x551ae2['error']){if(_0x551ae2[_0xdef2('0xe')][_0xdef2('0xf')]===0x1f4){logger[_0xdef2('0xe')](_0xdef2('0xb'),_0x5c8c1a,_0x551ae2['error'][_0xdef2('0x10')]);return _0x1d0229(_0x551ae2[_0xdef2('0xe')][_0xdef2('0x10')]);}logger[_0xdef2('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c8c1a,_0x551ae2['error'][_0xdef2('0x10')]);return _0x4a9d5c(_0x551ae2['error'][_0xdef2('0x10')]);}else{logger[_0xdef2('0xa')](_0xdef2('0xb'),_0x5c8c1a,_0xdef2('0xc'));_0x4a9d5c(_0x551ae2[_0xdef2('0x11')][_0xdef2('0x10')]);}})[_0xdef2('0x12')](function(_0x23a0f7){logger[_0xdef2('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c8c1a,_0x23a0f7);_0x1d0229(_0x23a0f7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bcebdbb..f034f40 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 _0xb63f=['/:id/resources','getResources','create','post','clone','/:id/sections','addSections','addResources','put','update','delete','removeSections','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections'];(function(_0x1c45bb,_0x48f37e){var _0x10060c=function(_0x501e15){while(--_0x501e15){_0x1c45bb['push'](_0x1c45bb['shift']());}};_0x10060c(++_0x48f37e);}(_0xb63f,0x193));var _0xfb63=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xb63f[_0x580b15];return _0x1adb1b;};'use strict';var multer=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var path=require('path');var timeout=require(_0xfb63('0x2'));var express=require(_0xfb63('0x3'));var router=express[_0xfb63('0x4')]();var fs_extra=require(_0xfb63('0x5'));var auth=require(_0xfb63('0x6'));var interaction=require(_0xfb63('0x7'));var config=require('../../config/environment');var controller=require(_0xfb63('0x8'));router[_0xfb63('0x9')]('/',auth[_0xfb63('0xa')](),controller[_0xfb63('0xb')]);router[_0xfb63('0x9')](_0xfb63('0xc'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xd')]);router[_0xfb63('0x9')](_0xfb63('0xe'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xf')]);router[_0xfb63('0x9')]('/:id/sections',auth[_0xfb63('0xa')](),controller[_0xfb63('0x10')]);router['get'](_0xfb63('0x11'),auth['isAuthenticated'](),controller[_0xfb63('0x12')]);router['post']('/',auth[_0xfb63('0xa')](),controller[_0xfb63('0x13')]);router[_0xfb63('0x14')]('/:id/clone',auth[_0xfb63('0xa')](),controller[_0xfb63('0x15')]);router[_0xfb63('0x14')](_0xfb63('0x16'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x17')]);router['post'](_0xfb63('0x11'),auth['isAuthenticated'](),controller[_0xfb63('0x18')]);router[_0xfb63('0x19')](_0xfb63('0xe'),auth['isAuthenticated'](),controller[_0xfb63('0x1a')]);router[_0xfb63('0x1b')]('/:id',auth[_0xfb63('0xa')](),controller['destroy']);router[_0xfb63('0x1b')](_0xfb63('0x16'),auth['isAuthenticated'](),controller[_0xfb63('0x1c')]);router[_0xfb63('0x1b')]('/:id/resources',auth[_0xfb63('0xa')](),controller['removeResources']);module[_0xfb63('0x1d')]=router; \ No newline at end of file +var _0xe096=['delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','getSections','/:id/clone','clone','/:id/sections','/:id/resources','/:id'];(function(_0xc55dc,_0x4f5438){var _0xcbf713=function(_0x3744b3){while(--_0x3744b3){_0xc55dc['push'](_0xc55dc['shift']());}};_0xcbf713(++_0x4f5438);}(_0xe096,0x13c));var _0x6e09=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xe096[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0x6e09('0x0'));var util=require(_0x6e09('0x1'));var path=require(_0x6e09('0x2'));var timeout=require(_0x6e09('0x3'));var express=require(_0x6e09('0x4'));var router=express[_0x6e09('0x5')]();var fs_extra=require(_0x6e09('0x6'));var auth=require(_0x6e09('0x7'));var interaction=require(_0x6e09('0x8'));var config=require(_0x6e09('0x9'));var controller=require(_0x6e09('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6e09('0xb')]('/describe',auth[_0x6e09('0xc')](),controller[_0x6e09('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6e09('0xb')]('/:id/sections',auth[_0x6e09('0xc')](),controller[_0x6e09('0xe')]);router['get']('/:id/resources',auth[_0x6e09('0xc')](),controller['getResources']);router['post']('/',auth[_0x6e09('0xc')](),controller['create']);router['post'](_0x6e09('0xf'),auth[_0x6e09('0xc')](),controller[_0x6e09('0x10')]);router['post'](_0x6e09('0x11'),auth[_0x6e09('0xc')](),controller['addSections']);router['post'](_0x6e09('0x12'),auth['isAuthenticated'](),controller['addResources']);router['put'](_0x6e09('0x13'),auth[_0x6e09('0xc')](),controller['update']);router[_0x6e09('0x14')](_0x6e09('0x13'),auth[_0x6e09('0xc')](),controller[_0x6e09('0x15')]);router['delete'](_0x6e09('0x11'),auth[_0x6e09('0xc')](),controller[_0x6e09('0x16')]);router[_0x6e09('0x14')](_0x6e09('0x12'),auth[_0x6e09('0xc')](),controller[_0x6e09('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6e4291f..734bcb1 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 _0x988d=['sequelize','exports','name','STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x392358,_0x351ac6){var _0xee612f=function(_0x42bd93){while(--_0x42bd93){_0x392358['push'](_0x392358['shift']());}};_0xee612f(++_0x351ac6);}(_0x988d,0xc6));var _0xd988=function(_0x174718,_0x2c3e7b){_0x174718=_0x174718-0x0;var _0x54fe3b=_0x988d[_0x174718];return _0x54fe3b;};'use strict';var Sequelize=require(_0xd988('0x0'));module[_0xd988('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd988('0x2')},'crudPermissions':{'type':Sequelize[_0xd988('0x3')],'set':function(_0x3a293a){this[_0xd988('0x4')](_0xd988('0x5'),_0x3a293a?_0x3a293a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xd988('0x6')](_0xd988('0x5'))[_0xd988('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd988('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd988('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd988('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd01c=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x5a58af,_0x2fd0e0){var _0x40b593=function(_0x354331){while(--_0x354331){_0x5a58af['push'](_0x5a58af['shift']());}};_0x40b593(++_0x2fd0e0);}(_0xd01c,0x1ce));var _0xcd01=function(_0x19da3b,_0xa8d3da){_0x19da3b=_0x19da3b-0x0;var _0x51e669=_0xd01c[_0x19da3b];return _0x51e669;};'use strict';var Sequelize=require(_0xcd01('0x0'));module[_0xcd01('0x1')]={'name':{'type':Sequelize[_0xcd01('0x2')],'allowNull':![],'unique':_0xcd01('0x3')},'crudPermissions':{'type':Sequelize[_0xcd01('0x2')],'set':function(_0x3405ad){this[_0xcd01('0x4')](_0xcd01('0x5'),_0x3405ad?_0x3405ad[_0xcd01('0x6')](''):[]);},'get':function(){return this[_0xcd01('0x7')](_0xcd01('0x5'))?this[_0xcd01('0x7')](_0xcd01('0x5'))[_0xcd01('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcd01('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 55278f6..a3f2fba 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 _0x695b=['mustache','util','path','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfile','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','length','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x695b,0x13d));var _0xb695=function(_0x300705,_0x2b4e90){_0x300705=_0x300705-0x0;var _0x5e27e6=_0x695b[_0x300705];return _0x5e27e6;};'use strict';var emlformat=require(_0xb695('0x0'));var rimraf=require(_0xb695('0x1'));var zipdir=require(_0xb695('0x2'));var jsonpatch=require(_0xb695('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb695('0x4'));var util=require(_0xb695('0x5'));var path=require(_0xb695('0x6'));var sox=require('sox');var csv=require(_0xb695('0x7'));var ejs=require(_0xb695('0x8'));var fs=require('fs');var fs_extra=require(_0xb695('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb695('0x7'));var querystring=require(_0xb695('0xa'));var Papa=require(_0xb695('0xb'));var Redis=require(_0xb695('0xc'));var authService=require(_0xb695('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb695('0xe'));var hardwareService=require(_0xb695('0xf'));var logger=require(_0xb695('0x10'))(_0xb695('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb695('0x12'));var db=require(_0xb695('0x13'))['db'];config[_0xb695('0x14')]=_[_0xb695('0x15')](config[_0xb695('0x14')],{'host':_0xb695('0x16'),'port':0x18eb});var socket=require(_0xb695('0x17'))(new Redis(config[_0xb695('0x14')]));require(_0xb695('0x18'))['register'](socket);function respondWithStatusCode(_0x27d6dc,_0x1e1f6a){_0x1e1f6a=_0x1e1f6a||0xcc;return function(_0xc9596c){if(_0xc9596c){return _0x27d6dc[_0xb695('0x19')](_0x1e1f6a);}return _0x27d6dc[_0xb695('0x1a')](_0x1e1f6a)[_0xb695('0x1b')]();};}function respondWithResult(_0x4e60f1,_0x1024e9){_0x1024e9=_0x1024e9||0xc8;return function(_0x171604){if(_0x171604){return _0x4e60f1[_0xb695('0x1a')](_0x1024e9)[_0xb695('0x1c')](_0x171604);}};}function respondWithFilteredResult(_0x47b198,_0x34e34a){return function(_0x4ed7dd){if(_0x4ed7dd){var _0xd92972=typeof _0x34e34a[_0xb695('0x1d')]===_0xb695('0x1e')&&typeof _0x34e34a['limit']===_0xb695('0x1e');var _0x48ce81=_0x4ed7dd[_0xb695('0x1f')];var _0x3258d7=_0xd92972?0x0:_0x34e34a[_0xb695('0x1d')];var _0x23d8a2=_0xd92972?_0x4ed7dd[_0xb695('0x1f')]:_0x34e34a[_0xb695('0x1d')]+_0x34e34a['limit'];var _0x13515a;if(_0x23d8a2>=_0x48ce81){_0x23d8a2=_0x48ce81;_0x13515a=0xc8;}else{_0x13515a=0xce;}_0x47b198['status'](_0x13515a);return _0x47b198[_0xb695('0x20')]('Content-Range',_0x3258d7+'-'+_0x23d8a2+'/'+_0x48ce81)[_0xb695('0x1c')](_0x4ed7dd);}return null;};}function patchUpdates(_0x4e4bdc){return function(_0x36f378){try{jsonpatch[_0xb695('0x21')](_0x36f378,_0x4e4bdc,!![]);}catch(_0x5eabb9){return BPromise[_0xb695('0x22')](_0x5eabb9);}return _0x36f378[_0xb695('0x23')]();};}function saveUpdates(_0x1a8332,_0x21a2f8){return function(_0x5aa96d){if(_0x5aa96d){return _0x5aa96d[_0xb695('0x24')](_0x1a8332)['then'](function(_0x53d10c){return _0x53d10c;});}return null;};}function removeEntity(_0x2e19ef,_0x370961){return function(_0x17f61a){if(_0x17f61a){return _0x17f61a[_0xb695('0x25')]()['then'](function(){_0x2e19ef[_0xb695('0x1a')](0xcc)[_0xb695('0x1b')]();});}};}function handleEntityNotFound(_0x543770,_0x27f8ef){return function(_0x47b9dc){if(!_0x47b9dc){_0x543770[_0xb695('0x19')](0x194);}return _0x47b9dc;};}function handleError(_0x469b6d,_0x394a9e){_0x394a9e=_0x394a9e||0x1f4;return function(_0x498714){logger[_0xb695('0x26')](_0x498714[_0xb695('0x27')]);if(_0x498714[_0xb695('0x28')]){delete _0x498714['name'];}_0x469b6d[_0xb695('0x1a')](_0x394a9e)['send'](_0x498714);};}exports[_0xb695('0x29')]=function(_0x8349bb,_0x5c0c53){var _0x1a9887={},_0x266688={},_0x18dfb8={'count':0x0,'rows':[]};var _0xf62fdc=_[_0xb695('0x2a')](db[_0xb695('0x2b')]['rawAttributes'],function(_0x10a2ee){return{'name':_0x10a2ee[_0xb695('0x2c')],'type':_0x10a2ee['type']['key']};});_0x266688[_0xb695('0x2d')]=_[_0xb695('0x2a')](_0xf62fdc,_0xb695('0x28'));_0x266688[_0xb695('0x2e')]=_[_0xb695('0x2f')](_0x8349bb[_0xb695('0x2e')]);_0x266688[_0xb695('0x30')]=_[_0xb695('0x31')](_0x266688[_0xb695('0x2d')],_0x266688[_0xb695('0x2e')]);_0x1a9887['attributes']=_[_0xb695('0x31')](_0x266688[_0xb695('0x2d')],qs[_0xb695('0x32')](_0x8349bb['query'][_0xb695('0x32')]));_0x1a9887[_0xb695('0x33')]=_0x1a9887[_0xb695('0x33')]['length']?_0x1a9887['attributes']:_0x266688[_0xb695('0x2d')];if(!_0x8349bb['query'][_0xb695('0x34')](_0xb695('0x35'))){_0x1a9887[_0xb695('0x36')]=qs[_0xb695('0x36')](_0x8349bb[_0xb695('0x2e')][_0xb695('0x36')]);_0x1a9887['offset']=qs['offset'](_0x8349bb[_0xb695('0x2e')][_0xb695('0x1d')]);}_0x1a9887[_0xb695('0x37')]=qs[_0xb695('0x38')](_0x8349bb[_0xb695('0x2e')]['sort']);_0x1a9887[_0xb695('0x39')]=qs[_0xb695('0x30')](_['pick'](_0x8349bb['query'],_0x266688[_0xb695('0x30')]),_0xf62fdc);if(_0x8349bb[_0xb695('0x2e')][_0xb695('0x3a')]){_0x1a9887['where']=_[_0xb695('0x3b')](_0x1a9887[_0xb695('0x39')],{'$or':_[_0xb695('0x2a')](_0xf62fdc,function(_0x6d1f37){if(_0x6d1f37['type']!==_0xb695('0x3c')){var _0x295fd8={};_0x295fd8[_0x6d1f37[_0xb695('0x28')]]={'$like':'%'+_0x8349bb[_0xb695('0x2e')][_0xb695('0x3a')]+'%'};return _0x295fd8;}})});}_0x1a9887=_[_0xb695('0x3b')]({},_0x1a9887,_0x8349bb['options']);var _0x592f90={'where':_0x1a9887[_0xb695('0x39')]};return db[_0xb695('0x2b')][_0xb695('0x1f')](_0x592f90)[_0xb695('0x3d')](function(_0x14e30f){_0x18dfb8[_0xb695('0x1f')]=_0x14e30f;if(_0x8349bb['query'][_0xb695('0x3e')]){_0x1a9887[_0xb695('0x3f')]=[{'all':!![]}];}return db[_0xb695('0x2b')][_0xb695('0x40')](_0x1a9887);})[_0xb695('0x3d')](function(_0x47ecac){_0x18dfb8['rows']=_0x47ecac;return _0x18dfb8;})['then'](respondWithFilteredResult(_0x5c0c53,_0x1a9887))[_0xb695('0x41')](handleError(_0x5c0c53,null));};exports['show']=function(_0x35f420,_0x43766e){var _0x1de9ab={'raw':![],'where':{'id':_0x35f420[_0xb695('0x42')]['id']}},_0x37ef22={};_0x37ef22['model']=_[_0xb695('0x2f')](db['UserProfile'][_0xb695('0x43')]);_0x37ef22[_0xb695('0x2e')]=_[_0xb695('0x2f')](_0x35f420[_0xb695('0x2e')]);_0x37ef22[_0xb695('0x30')]=_[_0xb695('0x31')](_0x37ef22['model'],_0x37ef22['query']);_0x1de9ab[_0xb695('0x33')]=_[_0xb695('0x31')](_0x37ef22[_0xb695('0x2d')],qs[_0xb695('0x32')](_0x35f420[_0xb695('0x2e')]['fields']));_0x1de9ab[_0xb695('0x33')]=_0x1de9ab[_0xb695('0x33')]['length']?_0x1de9ab['attributes']:_0x37ef22[_0xb695('0x2d')];if(_0x35f420[_0xb695('0x2e')][_0xb695('0x3e')]){_0x1de9ab['include']=[{'all':!![]}];}_0x1de9ab=_[_0xb695('0x3b')]({},_0x1de9ab,_0x35f420[_0xb695('0x44')]);return db[_0xb695('0x2b')]['find'](_0x1de9ab)['then'](handleEntityNotFound(_0x43766e,null))[_0xb695('0x3d')](respondWithResult(_0x43766e,null))[_0xb695('0x41')](handleError(_0x43766e,null));};exports[_0xb695('0x45')]=function(_0x3afdf3,_0x546420){return db[_0xb695('0x2b')][_0xb695('0x45')](_0x3afdf3[_0xb695('0x46')],{})[_0xb695('0x3d')](respondWithResult(_0x546420,0xc9))[_0xb695('0x41')](handleError(_0x546420,null));};exports['clone']=function(_0x154c87,_0x3b9b6a){var _0x41ec81={'where':{'id':_0x154c87[_0xb695('0x42')]['id']}},_0x487903={};_0x487903[_0xb695('0x2d')]=_['keys'](db['UserProfile'][_0xb695('0x43')]);_0x41ec81['attributes']=_['intersection'](_0x487903['model'],qs[_0xb695('0x32')](_0x154c87['query']['fields']));_0x41ec81['attributes']=_0x41ec81[_0xb695('0x33')][_0xb695('0x47')]?_0x41ec81[_0xb695('0x33')]:_0x487903[_0xb695('0x2d')];if(_0x154c87[_0xb695('0x2e')]['includeAll']){_0x41ec81[_0xb695('0x3f')]=[{'all':!![]}];}_0x41ec81=_[_0xb695('0x3b')]({},_0x41ec81,_0x154c87['options']);return db['UserProfile'][_0xb695('0x48')](_0x41ec81)[_0xb695('0x3d')](handleEntityNotFound(_0x3b9b6a,null))[_0xb695('0x3d')](function(_0x158075){if(_0x158075){var _0x3c7cdb=_0x158075[_0xb695('0x49')]({'plain':!![]});_0x3c7cdb=qs[_0xb695('0x4a')](_0x3c7cdb,['id',_0xb695('0x4b'),_0xb695('0x4c'),_0xb695('0x4d')]);_0x154c87[_0xb695('0x46')]=_[_0xb695('0x4a')](_0x154c87[_0xb695('0x46')],['id','createdAt',_0xb695('0x4c')]);return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x5a2c8c){return db['UserProfile'][_0xb695('0x45')](_[_0xb695('0x3b')](_0x3c7cdb,_0x154c87[_0xb695('0x46')]),{'include':_0x154c87[_0xb695('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5a2c8c})[_0xb695('0x3d')](function(_0x43d93b){var _0x2991a5=_0x43d93b['get']({'plain':!![]});return db['UserProfileSection'][_0xb695('0x40')]({'where':{'userProfileId':_0x154c87[_0xb695('0x42')]['id']},'raw':!![]})[_0xb695('0x3d')](function(_0xa1707){if(_0xa1707){return BPromise[_0xb695('0x50')](_0xa1707,function(_0x4a10fa){return new BPromise(function(_0x15dfb7,_0x41ae72){if(_0x4a10fa[_0xb695('0x51')]===null||_0x4a10fa[_0xb695('0x51')]===0x1)_0x15dfb7(null);return db[_0xb695('0x52')][_0xb695('0x40')]({'where':{'sectionId':_0x4a10fa['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x4147c6){var _0x45ce01=_[_0xb695('0x2a')](_0x4147c6,function(_0x13dfcc){return qs['omit'](_0x13dfcc,['id',_0xb695('0x4b'),_0xb695('0x4c'),_0xb695('0x53')]);});_0x15dfb7(_0x45ce01);})['catch'](function(_0xf180a9){_0x41ae72(_0xf180a9);});})[_0xb695('0x3d')](function(_0x1b9351){var _0xb7ffc1=qs[_0xb695('0x4a')](_0x4a10fa,['id',_0xb695('0x4b'),_0xb695('0x4c')]);_0xb7ffc1[_0xb695('0x54')]=_0x2991a5['id'];if(_0x1b9351)_0xb7ffc1['Resources']=_0x1b9351;return _0xb7ffc1;})['then'](function(_0x59dd4f){return db[_0xb695('0x55')][_0xb695('0x45')](_0x59dd4f,{'include':[{'model':db[_0xb695('0x52')],'as':_0xb695('0x56')}],'raw':!![],'transaction':_0x5a2c8c});});})[_0xb695('0x3d')](function(){return _0x2991a5;});}});});});}})[_0xb695('0x3d')](respondWithResult(_0x3b9b6a,0xc9))[_0xb695('0x41')](handleError(_0x3b9b6a,null));};exports[_0xb695('0x24')]=function(_0x549193,_0x5560e5){if(_0x549193[_0xb695('0x46')]['id']){delete _0x549193['body']['id'];}return db[_0xb695('0x2b')]['find']({'where':{'id':_0x549193[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x5560e5,null))[_0xb695('0x3d')](saveUpdates(_0x549193[_0xb695('0x46')],null))[_0xb695('0x3d')](respondWithResult(_0x5560e5,null))[_0xb695('0x41')](handleError(_0x5560e5,null));};exports['destroy']=function(_0x16881d,_0x154253){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x16881d[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x154253,null))[_0xb695('0x3d')](removeEntity(_0x154253,null))[_0xb695('0x41')](handleError(_0x154253,null));};exports[_0xb695('0x57')]=function(_0x928f1f,_0xc9dd37){return db[_0xb695('0x2b')][_0xb695('0x57')]()['then'](respondWithResult(_0xc9dd37,null))[_0xb695('0x41')](handleError(_0xc9dd37,null));};exports['addSections']=function(_0x4c0576,_0x377403){var _0x1db5ee=_0x4c0576[_0xb695('0x46')];return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x4c0576['params']['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x377403,null))['then'](function(_0x3634de){if(_0x3634de){return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x5af0a7){return db[_0xb695('0x55')][_0xb695('0x25')]({'where':{'userProfileId':_0x4c0576[_0xb695('0x42')]['id'],'sectionId':_[_0xb695('0x2a')](_0x1db5ee,function(_0x2dffa2){return _0x2dffa2['sectionId'];})},'transaction':_0x5af0a7})['then'](function(){var _0x1706a4=_[_0xb695('0x2a')](_0x1db5ee,function(_0x1363b6){_0x1363b6[_0xb695('0x54')]=_0x4c0576[_0xb695('0x42')]['id'];return _0x1363b6;});var _0x3c8114=[];return BPromise[_0xb695('0x50')](_0x1706a4,function(_0x5e4cdb){return db['UserProfileSection'][_0xb695('0x45')](_0x5e4cdb,{'include':[{'model':db[_0xb695('0x52')],'as':_0xb695('0x56')}],'raw':!![],'transaction':_0x5af0a7})[_0xb695('0x3d')](function(_0x45da9e){_0x3c8114[_0xb695('0x58')](_0x45da9e['get']({'plain':!![]}));});})[_0xb695('0x3d')](function(){return _0x3c8114;});});});}})[_0xb695('0x3d')](function(_0x1efd65){return _0x1efd65;})[_0xb695('0x3d')](respondWithResult(_0x377403,null))[_0xb695('0x41')](handleError(_0x377403,null));};exports[_0xb695('0x59')]=function(_0xe0c793,_0x19c81d){var _0x9a38e0;return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0xe0c793[_0xb695('0x42')]['id']},'attributes':['id',_0xb695('0x28')]})[_0xb695('0x3d')](handleEntityNotFound(_0x19c81d,null))[_0xb695('0x3d')](function(_0x6319ea){if(_0x6319ea){_0x9a38e0=_0x6319ea;return db['UserProfileSection'][_0xb695('0x25')]({'where':{'userProfileId':_0xe0c793[_0xb695('0x42')]['id'],'sectionId':_0xe0c793[_0xb695('0x2e')][_0xb695('0x5a')]}});}})[_0xb695('0x3d')](function(){return _0x9a38e0;})[_0xb695('0x3d')](respondWithStatusCode(_0x19c81d,null))[_0xb695('0x41')](handleError(_0x19c81d,null));};exports[_0xb695('0x5b')]=function(_0x4c84c2,_0x4f6fef){var _0x48448e=[];var _0x2e7182=[];return db[_0xb695('0x55')]['findAll']({'where':{'userProfileId':_0x4c84c2[_0xb695('0x42')]['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x176aae){_0x48448e=_[_0xb695('0x3a')](_0x176aae,function(_0x2ada10){return _0x2ada10[_0xb695('0x5c')]===0x1||_[_0xb695('0x5d')]([0x3eb,0x709],_0x2ada10[_0xb695('0x53')]);});if(!_[_0xb695('0x5e')](_0x48448e)){return _[_0xb695('0x2a')](_0x48448e,function(_0x27c282){return _0x27c282[_0xb695('0x53')];});}else{return;}})['then'](function(_0x1e5c78){if(_0x1e5c78)_0x2e7182=_0x1e5c78;if(_[_0xb695('0x5d')](_0x2e7182,0x64)){var _0x4574c8=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x64});return hasDefaultDashboard(_0x4574c8)['then'](function(_0x4fbdbc){return _[_0xb695('0x2a')](_0x48448e,function(_0x973087){if(_0x973087[_0xb695('0x53')]===0x64){_0x973087[_0xb695('0x5f')]=_0x4fbdbc;}return _0x973087;});});}else{return;}})[_0xb695('0x3d')](function(_0x4a74c1){if(_0x4a74c1)_0x48448e=_0x4a74c1;if(_[_0xb695('0x5d')](_0x2e7182,0x3eb)){var _0xbb6e8b=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x3eb});return getCustomDashboards(_0xbb6e8b)[_0xb695('0x3d')](function(_0x4eef27){return _[_0xb695('0x2a')](_0x48448e,function(_0x1d350){if(_0xbb6e8b[_0xb695('0x5c')]){if(_0x1d350['sectionId']===0x3eb){_0x1d350[_0xb695('0x5f')]=_0x4eef27;}}else{if(_0x1d350[_0xb695('0x53')]===0x64){if(!_0x1d350[_0xb695('0x5f')]){_0x1d350[_0xb695('0x5f')]=[];}_0x1d350[_0xb695('0x5f')]=_0x1d350[_0xb695('0x5f')][_0xb695('0x60')](_0x4eef27);}}return _0x1d350;});});}else{return;}})[_0xb695('0x3d')](function(_0x4573d0){if(_0x4573d0)_0x48448e=_0x4573d0;if(_[_0xb695('0x5d')](_0x2e7182,0x709)){var _0x445b0d=_[_0xb695('0x48')](_0x48448e,{'sectionId':0x709});return getPlugins(_0x445b0d)[_0xb695('0x3d')](function(_0x268429){if(_0x445b0d[_0xb695('0x5c')]){return _[_0xb695('0x2a')](_0x48448e,function(_0x1633cf){if(_0x1633cf[_0xb695('0x53')]===0x709){_0x1633cf['subsections']=_0x268429;}return _0x1633cf;});}else{var _0x510293={'sectionId':0x76c,'enabled':0x1,'subsections':_0x268429};var _0x4eef11=_[_0xb695('0x2a')](_0x48448e);_0x4eef11[_0xb695('0x58')](_0x510293);return _0x4eef11;}});}else{return;}})[_0xb695('0x3d')](function(_0x4cd9ad){if(_0x4cd9ad)_0x48448e=_0x4cd9ad;return _[_0xb695('0x3a')](_0x48448e,['enabled',0x1]);})[_0xb695('0x3d')](respondWithResult(_0x4f6fef,null))['catch'](handleError(_0x4f6fef,null));};function hasDefaultDashboard(_0x4f57f8){var _0x215713=[0x65];return new BPromise(function(_0x4dfb9c,_0x3e39ba){try{if(_0x4f57f8['autoAssociation']){_0x4dfb9c(_0x215713);}else{return db[_0xb695('0x52')][_0xb695('0x61')]({'where':{'sectionId':_0x4f57f8['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x2d2ddc){_0x2d2ddc?_0x4dfb9c(_0x215713):_0x4dfb9c();});}}catch(_0x58d904){_0x3e39ba(_0x58d904);}});}function getCustomDashboards(_0x4c45d6){var _0x2d9844=[];return new BPromise(function(_0x805888,_0x357099){try{if(_0x4c45d6[_0xb695('0x51')]){return db[_0xb695('0x62')][_0xb695('0x40')]({'raw':!![]})[_0xb695('0x3d')](function(_0x4a80f1){_0x4a80f1['forEach'](function(_0x2a0695){_0x2d9844[_0xb695('0x58')](_0x2a0695['id']+0x1869f);});_0x805888(_0x2d9844);});}else{return db['UserProfileResource'][_0xb695('0x40')]({'where':{'sectionId':_0x4c45d6['id']},'raw':!![]})['then'](function(_0x5567c4){_0x5567c4[_0xb695('0x63')](function(_0x3f96bb){_0x2d9844[_0xb695('0x58')](_0x3f96bb[_0xb695('0x64')]+0x1869f);});_0x805888(_0x2d9844);});}}catch(_0x3d8c44){_0x357099(_0x3d8c44);}});}function getPlugins(_0x38874b){var _0x5164d3=[];return new BPromise(function(_0x188484,_0x34e606){try{if(_0x38874b['autoAssociation']){return db['Plugin'][_0xb695('0x40')]({'raw':!![]})[_0xb695('0x3d')](function(_0x221c65){_0x221c65[_0xb695('0x63')](function(_0x1bf5d3){_0x5164d3['push'](_0x1bf5d3['id']+0x15b38);});_0x188484(_0x5164d3);});}else{return db['UserProfileResource'][_0xb695('0x40')]({'where':{'sectionId':_0x38874b['id']},'raw':!![]})[_0xb695('0x3d')](function(_0x2c2980){_0x2c2980[_0xb695('0x63')](function(_0x1c45a2){_0x5164d3['push'](_0x1c45a2[_0xb695('0x64')]+0x15b38);});_0x188484(_0x5164d3);});}}catch(_0x1d570f){_0x34e606(_0x1d570f);}});}exports[_0xb695('0x65')]=function(_0x514c0f,_0x203bc7){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x514c0f['params']['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x203bc7,null))[_0xb695('0x3d')](function(_0x451f3e){if(_0x451f3e){return db[_0xb695('0x4e')][_0xb695('0x4f')](function(_0x4165f7){return db[_0xb695('0x55')][_0xb695('0x40')]({'where':{'userProfileId':_0x514c0f[_0xb695('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0xb695('0x3d')](function(_0x542517){if(_0x542517){return db[_0xb695('0x55')]['destroy']({'where':{'userProfileId':_0x514c0f['params']['id'],'id':_[_0xb695('0x2a')](_0x542517,function(_0x57c8a4){return _0x57c8a4['id'];})},'transaction':_0x4165f7});}})[_0xb695('0x3d')](function(_0x55b8e8){var _0x5b8fa2=_[_0xb695('0x2a')](_0x514c0f[_0xb695('0x46')],function(_0x3d809d){_0x3d809d[_0xb695('0x54')]=_0x514c0f[_0xb695('0x42')]['id'];return _0x3d809d;});return db[_0xb695('0x55')][_0xb695('0x66')](_0x5b8fa2,{'raw':!![],'transaction':_0x4165f7});})[_0xb695('0x3d')](function(_0x93ecf1){var _0x48d593=_['filter'](_['map'](_0x93ecf1,function(_0x3f0791){return _0x3f0791[_0xb695('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x48d593){return db[_0xb695('0x55')][_0xb695('0x40')]({'where':{'userProfileId':_0x514c0f[_0xb695('0x42')]['id'],'sectionId':_['map'](_0x48d593,function(_0x19d8b8){return _0x19d8b8[_0xb695('0x53')];})},'attributes':['id',_0xb695('0x53')],'raw':!![]})[_0xb695('0x3d')](function(_0x2ce8d0){var _0x1dcd71=_['map'](_0x514c0f[_0xb695('0x46')],function(_0xe0b54c){_0xe0b54c['userProfileId']=_0x514c0f[_0xb695('0x42')]['id'];return _0xe0b54c;});return db[_0xb695('0x52')][_0xb695('0x66')](_0x1dcd71,{'raw':!![],'transaction':_0x4165f7});});}})[_0xb695('0x41')](handleError(_0x203bc7,null));});}})['then'](function(_0x414183){var _0x5ab081=_[_0xb695('0x2a')](_0x414183,function(_0x4f552b){return _0x4f552b[_0xb695('0x49')]({'plain':!![]});});})['then'](respondWithResult(_0x203bc7,null))[_0xb695('0x41')](handleError(_0x203bc7,null));};exports['removeResources']=function(_0x599d95,_0x1b6a3e,_0x4d7b02){return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0x599d95[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](handleEntityNotFound(_0x1b6a3e,null))[_0xb695('0x3d')](function(_0x54fc1b){if(_0x54fc1b){return _0x54fc1b[_0xb695('0x67')](_0x599d95[_0xb695('0x2e')][_0xb695('0x5a')]);}})[_0xb695('0x3d')](respondWithStatusCode(_0x1b6a3e,null))[_0xb695('0x41')](handleError(_0x1b6a3e,null));};exports[_0xb695('0x68')]=function(_0x5b219b,_0x3fb2c9){var _0x2ace66={};if(!_0x5b219b[_0xb695('0x2e')][_0xb695('0x69')])throw new Error(_0xb695('0x6a'));if(!_0x5b219b[_0xb695('0x2e')][_0xb695('0x34')](_0xb695('0x35'))){_0x2ace66['limit']=qs[_0xb695('0x36')](_0x5b219b['query']['limit']);_0x2ace66[_0xb695('0x1d')]=qs['offset'](_0x5b219b[_0xb695('0x2e')]['offset']);}return db[_0xb695('0x2b')]['find']({'where':{'id':_0x5b219b[_0xb695('0x42')]['id']}})[_0xb695('0x3d')](function(_0x5d5b9e){if(!_0x5d5b9e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5b219b['params']['id']);return db[_0xb695('0x2b')][_0xb695('0x68')](_0x5b219b);})['then'](respondWithFilteredResult(_0x3fb2c9,_0x2ace66))[_0xb695('0x41')](handleError(_0x3fb2c9,null));}; \ No newline at end of file +var _0x2559=['destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','filters','pick','where','merge','VIRTUAL','filter','options','UserProfile','include','rows','show','includeAll','find','create','body','catch','clone','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','findAll','params','each','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','subsections','concat','includes','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x2559,0xbc));var _0x9255=function(_0x57b132,_0xa35b80){_0x57b132=_0x57b132-0x0;var _0x22dda5=_0x2559[_0x57b132];return _0x22dda5;};'use strict';var emlformat=require(_0x9255('0x0'));var rimraf=require(_0x9255('0x1'));var zipdir=require(_0x9255('0x2'));var jsonpatch=require(_0x9255('0x3'));var rp=require('request-promise');var moment=require(_0x9255('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9255('0x5'));var util=require(_0x9255('0x6'));var path=require('path');var sox=require(_0x9255('0x7'));var csv=require('to-csv');var ejs=require(_0x9255('0x8'));var fs=require('fs');var fs_extra=require(_0x9255('0x9'));var _=require(_0x9255('0xa'));var squel=require('squel');var crypto=require(_0x9255('0xb'));var jsforce=require(_0x9255('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9255('0xd'));var Papa=require('papaparse');var Redis=require(_0x9255('0xe'));var authService=require(_0x9255('0xf'));var qs=require(_0x9255('0x10'));var as=require(_0x9255('0x11'));var hardwareService=require(_0x9255('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9255('0x13'));var licenseUtil=require(_0x9255('0x14'));var db=require(_0x9255('0x15'))['db'];config[_0x9255('0x16')]=_[_0x9255('0x17')](config[_0x9255('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')[_0x9255('0x18')](socket);function respondWithStatusCode(_0x10349c,_0x50134a){_0x50134a=_0x50134a||0xcc;return function(_0x2cd063){if(_0x2cd063){return _0x10349c[_0x9255('0x19')](_0x50134a);}return _0x10349c['status'](_0x50134a)[_0x9255('0x1a')]();};}function respondWithResult(_0x2e78d5,_0x298d7f){_0x298d7f=_0x298d7f||0xc8;return function(_0x26bd78){if(_0x26bd78){return _0x2e78d5[_0x9255('0x1b')](_0x298d7f)[_0x9255('0x1c')](_0x26bd78);}};}function respondWithFilteredResult(_0x1d09f4,_0xe8374f){return function(_0x290264){if(_0x290264){var _0x5b831e=typeof _0xe8374f['offset']===_0x9255('0x1d')&&typeof _0xe8374f[_0x9255('0x1e')]===_0x9255('0x1d');var _0x48aebc=_0x290264[_0x9255('0x1f')];var _0x221125=_0x5b831e?0x0:_0xe8374f['offset'];var _0x5203a1=_0x5b831e?_0x290264[_0x9255('0x1f')]:_0xe8374f[_0x9255('0x20')]+_0xe8374f[_0x9255('0x1e')];var _0x3298ce;if(_0x5203a1>=_0x48aebc){_0x5203a1=_0x48aebc;_0x3298ce=0xc8;}else{_0x3298ce=0xce;}_0x1d09f4['status'](_0x3298ce);return _0x1d09f4[_0x9255('0x21')](_0x9255('0x22'),_0x221125+'-'+_0x5203a1+'/'+_0x48aebc)[_0x9255('0x1c')](_0x290264);}return null;};}function patchUpdates(_0x1adebe){return function(_0x1c1346){try{jsonpatch[_0x9255('0x23')](_0x1c1346,_0x1adebe,!![]);}catch(_0x2ebc2a){return BPromise[_0x9255('0x24')](_0x2ebc2a);}return _0x1c1346[_0x9255('0x25')]();};}function saveUpdates(_0x12c8da,_0x10da2f){return function(_0x167ee6){if(_0x167ee6){return _0x167ee6[_0x9255('0x26')](_0x12c8da)[_0x9255('0x27')](function(_0x4ffc24){return _0x4ffc24;});}return null;};}function removeEntity(_0x2d225d,_0x170498){return function(_0x556b2f){if(_0x556b2f){return _0x556b2f[_0x9255('0x28')]()['then'](function(){_0x2d225d[_0x9255('0x1b')](0xcc)[_0x9255('0x1a')]();});}};}function handleEntityNotFound(_0x5b247c,_0x3febb3){return function(_0x19cee2){if(!_0x19cee2){_0x5b247c[_0x9255('0x19')](0x194);}return _0x19cee2;};}function handleError(_0x10b8ce,_0x3a1b7e){_0x3a1b7e=_0x3a1b7e||0x1f4;return function(_0x49160f){logger[_0x9255('0x29')](_0x49160f[_0x9255('0x2a')]);if(_0x49160f[_0x9255('0x2b')]){delete _0x49160f[_0x9255('0x2b')];}_0x10b8ce[_0x9255('0x1b')](_0x3a1b7e)['send'](_0x49160f);};}exports[_0x9255('0x2c')]=function(_0x1c9183,_0x40be3c){var _0x5b1511={},_0x169e28={},_0x51334c={'count':0x0,'rows':[]};var _0x5a21c5=_[_0x9255('0x2d')](db['UserProfile'][_0x9255('0x2e')],function(_0x215126){return{'name':_0x215126[_0x9255('0x2f')],'type':_0x215126[_0x9255('0x30')][_0x9255('0x31')]};});_0x169e28[_0x9255('0x32')]=_[_0x9255('0x2d')](_0x5a21c5,_0x9255('0x2b'));_0x169e28['query']=_[_0x9255('0x33')](_0x1c9183[_0x9255('0x34')]);_0x169e28['filters']=_[_0x9255('0x35')](_0x169e28[_0x9255('0x32')],_0x169e28[_0x9255('0x34')]);_0x5b1511[_0x9255('0x36')]=_[_0x9255('0x35')](_0x169e28[_0x9255('0x32')],qs[_0x9255('0x37')](_0x1c9183[_0x9255('0x34')][_0x9255('0x37')]));_0x5b1511[_0x9255('0x36')]=_0x5b1511[_0x9255('0x36')][_0x9255('0x38')]?_0x5b1511[_0x9255('0x36')]:_0x169e28[_0x9255('0x32')];if(!_0x1c9183[_0x9255('0x34')][_0x9255('0x39')]('nolimit')){_0x5b1511[_0x9255('0x1e')]=qs[_0x9255('0x1e')](_0x1c9183['query'][_0x9255('0x1e')]);_0x5b1511['offset']=qs[_0x9255('0x20')](_0x1c9183['query'][_0x9255('0x20')]);}_0x5b1511[_0x9255('0x3a')]=qs['sort'](_0x1c9183['query']['sort']);_0x5b1511['where']=qs[_0x9255('0x3b')](_[_0x9255('0x3c')](_0x1c9183[_0x9255('0x34')],_0x169e28['filters']),_0x5a21c5);if(_0x1c9183[_0x9255('0x34')]['filter']){_0x5b1511[_0x9255('0x3d')]=_[_0x9255('0x3e')](_0x5b1511[_0x9255('0x3d')],{'$or':_[_0x9255('0x2d')](_0x5a21c5,function(_0x4e6d80){if(_0x4e6d80[_0x9255('0x30')]!==_0x9255('0x3f')){var _0x55acb7={};_0x55acb7[_0x4e6d80[_0x9255('0x2b')]]={'$like':'%'+_0x1c9183[_0x9255('0x34')][_0x9255('0x40')]+'%'};return _0x55acb7;}})});}_0x5b1511=_[_0x9255('0x3e')]({},_0x5b1511,_0x1c9183[_0x9255('0x41')]);var _0x5b395e={'where':_0x5b1511[_0x9255('0x3d')]};return db[_0x9255('0x42')][_0x9255('0x1f')](_0x5b395e)['then'](function(_0x5c514e){_0x51334c['count']=_0x5c514e;if(_0x1c9183[_0x9255('0x34')]['includeAll']){_0x5b1511[_0x9255('0x43')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x5b1511);})[_0x9255('0x27')](function(_0x21f25b){_0x51334c[_0x9255('0x44')]=_0x21f25b;return _0x51334c;})[_0x9255('0x27')](respondWithFilteredResult(_0x40be3c,_0x5b1511))['catch'](handleError(_0x40be3c,null));};exports[_0x9255('0x45')]=function(_0x4919ba,_0x7d058f){var _0x14ffd8={'raw':![],'where':{'id':_0x4919ba['params']['id']}},_0x1acab5={};_0x1acab5['model']=_[_0x9255('0x33')](db[_0x9255('0x42')][_0x9255('0x2e')]);_0x1acab5[_0x9255('0x34')]=_[_0x9255('0x33')](_0x4919ba[_0x9255('0x34')]);_0x1acab5[_0x9255('0x3b')]=_[_0x9255('0x35')](_0x1acab5[_0x9255('0x32')],_0x1acab5[_0x9255('0x34')]);_0x14ffd8[_0x9255('0x36')]=_[_0x9255('0x35')](_0x1acab5[_0x9255('0x32')],qs[_0x9255('0x37')](_0x4919ba[_0x9255('0x34')]['fields']));_0x14ffd8[_0x9255('0x36')]=_0x14ffd8[_0x9255('0x36')][_0x9255('0x38')]?_0x14ffd8[_0x9255('0x36')]:_0x1acab5[_0x9255('0x32')];if(_0x4919ba[_0x9255('0x34')][_0x9255('0x46')]){_0x14ffd8[_0x9255('0x43')]=[{'all':!![]}];}_0x14ffd8=_['merge']({},_0x14ffd8,_0x4919ba['options']);return db[_0x9255('0x42')][_0x9255('0x47')](_0x14ffd8)['then'](handleEntityNotFound(_0x7d058f,null))['then'](respondWithResult(_0x7d058f,null))['catch'](handleError(_0x7d058f,null));};exports[_0x9255('0x48')]=function(_0x296318,_0x239c28){return db[_0x9255('0x42')][_0x9255('0x48')](_0x296318[_0x9255('0x49')],{})[_0x9255('0x27')](respondWithResult(_0x239c28,0xc9))[_0x9255('0x4a')](handleError(_0x239c28,null));};exports[_0x9255('0x4b')]=function(_0x35c2a0,_0xf2790c){var _0x5aaa41={'where':{'id':_0x35c2a0['params']['id']}},_0x3d32f8={};_0x3d32f8[_0x9255('0x32')]=_[_0x9255('0x33')](db[_0x9255('0x42')][_0x9255('0x2e')]);_0x5aaa41[_0x9255('0x36')]=_[_0x9255('0x35')](_0x3d32f8['model'],qs[_0x9255('0x37')](_0x35c2a0['query'][_0x9255('0x37')]));_0x5aaa41[_0x9255('0x36')]=_0x5aaa41[_0x9255('0x36')][_0x9255('0x38')]?_0x5aaa41[_0x9255('0x36')]:_0x3d32f8['model'];if(_0x35c2a0[_0x9255('0x34')]['includeAll']){_0x5aaa41['include']=[{'all':!![]}];}_0x5aaa41=_[_0x9255('0x3e')]({},_0x5aaa41,_0x35c2a0['options']);return db[_0x9255('0x42')]['find'](_0x5aaa41)[_0x9255('0x27')](handleEntityNotFound(_0xf2790c,null))[_0x9255('0x27')](function(_0x6dd675){if(_0x6dd675){var _0x2e1675=_0x6dd675[_0x9255('0x4c')]({'plain':!![]});_0x2e1675=qs[_0x9255('0x4d')](_0x2e1675,['id',_0x9255('0x4e'),'updatedAt',_0x9255('0x4f')]);_0x35c2a0[_0x9255('0x49')]=_['omit'](_0x35c2a0[_0x9255('0x49')],['id','createdAt','updatedAt']);return db[_0x9255('0x50')][_0x9255('0x51')](function(_0x42e7ce){return db[_0x9255('0x42')][_0x9255('0x48')](_[_0x9255('0x3e')](_0x2e1675,_0x35c2a0['body']),{'include':_0x35c2a0[_0x9255('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x42e7ce})[_0x9255('0x27')](function(_0x1a6ea8){var _0x2045c1=_0x1a6ea8[_0x9255('0x4c')]({'plain':!![]});return db[_0x9255('0x52')][_0x9255('0x53')]({'where':{'userProfileId':_0x35c2a0[_0x9255('0x54')]['id']},'raw':!![]})[_0x9255('0x27')](function(_0x20cda3){if(_0x20cda3){return BPromise[_0x9255('0x55')](_0x20cda3,function(_0x538c42){return new BPromise(function(_0x4a60d0,_0x15ede9){if(_0x538c42[_0x9255('0x56')]===null||_0x538c42[_0x9255('0x56')]===0x1)_0x4a60d0(null);return db[_0x9255('0x57')][_0x9255('0x53')]({'where':{'sectionId':_0x538c42['id']},'raw':!![]})[_0x9255('0x27')](function(_0x2762d0){var _0x2de46b=_[_0x9255('0x2d')](_0x2762d0,function(_0x408eae){return qs[_0x9255('0x4d')](_0x408eae,['id','createdAt',_0x9255('0x58'),_0x9255('0x59')]);});_0x4a60d0(_0x2de46b);})[_0x9255('0x4a')](function(_0x50477c){_0x15ede9(_0x50477c);});})[_0x9255('0x27')](function(_0x4144f9){var _0x529d6a=qs[_0x9255('0x4d')](_0x538c42,['id',_0x9255('0x4e'),_0x9255('0x58')]);_0x529d6a[_0x9255('0x5a')]=_0x2045c1['id'];if(_0x4144f9)_0x529d6a['Resources']=_0x4144f9;return _0x529d6a;})['then'](function(_0x393648){return db[_0x9255('0x52')][_0x9255('0x48')](_0x393648,{'include':[{'model':db[_0x9255('0x57')],'as':_0x9255('0x5b')}],'raw':!![],'transaction':_0x42e7ce});});})[_0x9255('0x27')](function(){return _0x2045c1;});}});});});}})['then'](respondWithResult(_0xf2790c,0xc9))[_0x9255('0x4a')](handleError(_0xf2790c,null));};exports[_0x9255('0x26')]=function(_0x334cd3,_0x4375cb){if(_0x334cd3[_0x9255('0x49')]['id']){delete _0x334cd3[_0x9255('0x49')]['id'];}return db[_0x9255('0x42')][_0x9255('0x47')]({'where':{'id':_0x334cd3[_0x9255('0x54')]['id']}})[_0x9255('0x27')](handleEntityNotFound(_0x4375cb,null))[_0x9255('0x27')](saveUpdates(_0x334cd3[_0x9255('0x49')],null))[_0x9255('0x27')](respondWithResult(_0x4375cb,null))['catch'](handleError(_0x4375cb,null));};exports[_0x9255('0x28')]=function(_0x1aefbe,_0x136045){return db[_0x9255('0x42')][_0x9255('0x47')]({'where':{'id':_0x1aefbe['params']['id']}})[_0x9255('0x27')](handleEntityNotFound(_0x136045,null))[_0x9255('0x27')](removeEntity(_0x136045,null))[_0x9255('0x4a')](handleError(_0x136045,null));};exports[_0x9255('0x5c')]=function(_0x5647de,_0x342154){return db[_0x9255('0x42')][_0x9255('0x5c')]()['then'](respondWithResult(_0x342154,null))[_0x9255('0x4a')](handleError(_0x342154,null));};exports[_0x9255('0x5d')]=function(_0x2aa92b,_0x12e9b8){var _0x10c919=_0x2aa92b['body'];return db[_0x9255('0x42')][_0x9255('0x47')]({'where':{'id':_0x2aa92b[_0x9255('0x54')]['id']}})[_0x9255('0x27')](handleEntityNotFound(_0x12e9b8,null))[_0x9255('0x27')](function(_0x1d2d9a){if(_0x1d2d9a){return db[_0x9255('0x50')]['transaction'](function(_0x1251f){return db['UserProfileSection'][_0x9255('0x28')]({'where':{'userProfileId':_0x2aa92b[_0x9255('0x54')]['id'],'sectionId':_[_0x9255('0x2d')](_0x10c919,function(_0x337660){return _0x337660[_0x9255('0x59')];})},'transaction':_0x1251f})['then'](function(){var _0x31824a=_[_0x9255('0x2d')](_0x10c919,function(_0x584e2b){_0x584e2b['userProfileId']=_0x2aa92b[_0x9255('0x54')]['id'];return _0x584e2b;});var _0x58c20c=[];return BPromise['each'](_0x31824a,function(_0x5c904e){return db[_0x9255('0x52')][_0x9255('0x48')](_0x5c904e,{'include':[{'model':db[_0x9255('0x57')],'as':_0x9255('0x5b')}],'raw':!![],'transaction':_0x1251f})[_0x9255('0x27')](function(_0x42aaa2){_0x58c20c[_0x9255('0x5e')](_0x42aaa2['get']({'plain':!![]}));});})[_0x9255('0x27')](function(){return _0x58c20c;});});});}})[_0x9255('0x27')](function(_0x8ee212){return _0x8ee212;})[_0x9255('0x27')](respondWithResult(_0x12e9b8,null))[_0x9255('0x4a')](handleError(_0x12e9b8,null));};exports[_0x9255('0x5f')]=function(_0x205460,_0x1e4fcd){var _0x4930cd;return db[_0x9255('0x42')]['find']({'where':{'id':_0x205460['params']['id']},'attributes':['id','name']})[_0x9255('0x27')](handleEntityNotFound(_0x1e4fcd,null))[_0x9255('0x27')](function(_0x411255){if(_0x411255){_0x4930cd=_0x411255;return db[_0x9255('0x52')][_0x9255('0x28')]({'where':{'userProfileId':_0x205460['params']['id'],'sectionId':_0x205460[_0x9255('0x34')][_0x9255('0x60')]}});}})[_0x9255('0x27')](function(){return _0x4930cd;})['then'](respondWithStatusCode(_0x1e4fcd,null))[_0x9255('0x4a')](handleError(_0x1e4fcd,null));};exports[_0x9255('0x61')]=function(_0x401d78,_0x39f3d8){var _0x442428=[];var _0x299b0f=[];return db['UserProfileSection'][_0x9255('0x53')]({'where':{'userProfileId':_0x401d78['params']['id']},'raw':!![]})['then'](function(_0xd1497e){_0x442428=_['filter'](_0xd1497e,function(_0x5ec825){return _0x5ec825[_0x9255('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x5ec825[_0x9255('0x59')]);});if(!_[_0x9255('0x63')](_0x442428)){return _[_0x9255('0x2d')](_0x442428,function(_0x3607c7){return _0x3607c7[_0x9255('0x59')];});}else{return;}})[_0x9255('0x27')](function(_0x2d8553){if(_0x2d8553)_0x299b0f=_0x2d8553;if(_['includes'](_0x299b0f,0x64)){var _0x299e7c=_[_0x9255('0x47')](_0x442428,{'sectionId':0x64});return hasDefaultDashboard(_0x299e7c)[_0x9255('0x27')](function(_0x3e80ec){return _['map'](_0x442428,function(_0x326a8f){if(_0x326a8f[_0x9255('0x59')]===0x64){_0x326a8f[_0x9255('0x64')]=_0x3e80ec;}return _0x326a8f;});});}else{return;}})[_0x9255('0x27')](function(_0x44c973){if(_0x44c973)_0x442428=_0x44c973;if(_['includes'](_0x299b0f,0x3eb)){var _0x13cf0e=_['find'](_0x442428,{'sectionId':0x3eb});return getCustomDashboards(_0x13cf0e)['then'](function(_0x54b456){return _[_0x9255('0x2d')](_0x442428,function(_0x1e284b){if(_0x13cf0e[_0x9255('0x62')]){if(_0x1e284b[_0x9255('0x59')]===0x3eb){_0x1e284b[_0x9255('0x64')]=_0x54b456;}}else{if(_0x1e284b['sectionId']===0x64){if(!_0x1e284b[_0x9255('0x64')]){_0x1e284b[_0x9255('0x64')]=[];}_0x1e284b[_0x9255('0x64')]=_0x1e284b['subsections'][_0x9255('0x65')](_0x54b456);}}return _0x1e284b;});});}else{return;}})[_0x9255('0x27')](function(_0x55f6ee){if(_0x55f6ee)_0x442428=_0x55f6ee;if(_[_0x9255('0x66')](_0x299b0f,0x709)){var _0x5105cd=_[_0x9255('0x47')](_0x442428,{'sectionId':0x709});return getPlugins(_0x5105cd)[_0x9255('0x27')](function(_0x14f5b0){if(_0x5105cd[_0x9255('0x62')]){return _[_0x9255('0x2d')](_0x442428,function(_0x42927e){if(_0x42927e[_0x9255('0x59')]===0x709){_0x42927e[_0x9255('0x64')]=_0x14f5b0;}return _0x42927e;});}else{var _0x498f49={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14f5b0};var _0x46b035=_[_0x9255('0x2d')](_0x442428);_0x46b035[_0x9255('0x5e')](_0x498f49);return _0x46b035;}});}else{return;}})[_0x9255('0x27')](function(_0x698292){if(_0x698292)_0x442428=_0x698292;return _[_0x9255('0x40')](_0x442428,[_0x9255('0x62'),0x1]);})[_0x9255('0x27')](respondWithResult(_0x39f3d8,null))[_0x9255('0x4a')](handleError(_0x39f3d8,null));};function hasDefaultDashboard(_0x1319cf){var _0x32eaa7=[0x65];return new BPromise(function(_0x55b9b0,_0x319452){try{if(_0x1319cf[_0x9255('0x56')]){_0x55b9b0(_0x32eaa7);}else{return db[_0x9255('0x57')][_0x9255('0x67')]({'where':{'sectionId':_0x1319cf['id']},'raw':!![]})[_0x9255('0x27')](function(_0x20dcf1){_0x20dcf1?_0x55b9b0(_0x32eaa7):_0x55b9b0();});}}catch(_0x4d4d02){_0x319452(_0x4d4d02);}});}function getCustomDashboards(_0xb58f18){var _0x5f2075=[];return new BPromise(function(_0x201de6,_0x1a180f){try{if(_0xb58f18[_0x9255('0x56')]){return db[_0x9255('0x68')][_0x9255('0x53')]({'raw':!![]})['then'](function(_0x31d3b8){_0x31d3b8[_0x9255('0x69')](function(_0x88227a){_0x5f2075[_0x9255('0x5e')](_0x88227a['id']+0x1869f);});_0x201de6(_0x5f2075);});}else{return db['UserProfileResource'][_0x9255('0x53')]({'where':{'sectionId':_0xb58f18['id']},'raw':!![]})['then'](function(_0xbab82d){_0xbab82d['forEach'](function(_0xc317e9){_0x5f2075[_0x9255('0x5e')](_0xc317e9['resourceId']+0x1869f);});_0x201de6(_0x5f2075);});}}catch(_0x3bcfbc){_0x1a180f(_0x3bcfbc);}});}function getPlugins(_0x2a0ecd){var _0x29c65f=[];return new BPromise(function(_0x53cf04,_0x4ecbb8){try{if(_0x2a0ecd[_0x9255('0x56')]){return db[_0x9255('0x6a')][_0x9255('0x53')]({'raw':!![]})[_0x9255('0x27')](function(_0x22767d){_0x22767d[_0x9255('0x69')](function(_0xf3f05a){_0x29c65f[_0x9255('0x5e')](_0xf3f05a['id']+0x15b38);});_0x53cf04(_0x29c65f);});}else{return db[_0x9255('0x57')][_0x9255('0x53')]({'where':{'sectionId':_0x2a0ecd['id']},'raw':!![]})[_0x9255('0x27')](function(_0x3c057c){_0x3c057c[_0x9255('0x69')](function(_0x9501b3){_0x29c65f[_0x9255('0x5e')](_0x9501b3[_0x9255('0x6b')]+0x15b38);});_0x53cf04(_0x29c65f);});}}catch(_0x56dd76){_0x4ecbb8(_0x56dd76);}});}exports[_0x9255('0x6c')]=function(_0x41418e,_0x3d249b){return db[_0x9255('0x42')]['find']({'where':{'id':_0x41418e['params']['id']}})[_0x9255('0x27')](handleEntityNotFound(_0x3d249b,null))[_0x9255('0x27')](function(_0x354c3c){if(_0x354c3c){return db['sequelize']['transaction'](function(_0x2d6af3){return db[_0x9255('0x52')][_0x9255('0x53')]({'where':{'userProfileId':_0x41418e['params']['id']},'attributes':['id'],'raw':!![]})[_0x9255('0x27')](function(_0x47084a){if(_0x47084a){return db['UserProfileSection'][_0x9255('0x28')]({'where':{'userProfileId':_0x41418e[_0x9255('0x54')]['id'],'id':_[_0x9255('0x2d')](_0x47084a,function(_0x288ed6){return _0x288ed6['id'];})},'transaction':_0x2d6af3});}})['then'](function(_0xe8392){var _0x1e17ae=_['map'](_0x41418e[_0x9255('0x49')],function(_0x4dc919){_0x4dc919['userProfileId']=_0x41418e[_0x9255('0x54')]['id'];return _0x4dc919;});return db[_0x9255('0x52')]['bulkCreate'](_0x1e17ae,{'raw':!![],'transaction':_0x2d6af3});})['then'](function(_0x203256){var _0x3674cd=_['filter'](_[_0x9255('0x2d')](_0x203256,function(_0x277433){return _0x277433[_0x9255('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x3674cd){return db[_0x9255('0x52')][_0x9255('0x53')]({'where':{'userProfileId':_0x41418e[_0x9255('0x54')]['id'],'sectionId':_[_0x9255('0x2d')](_0x3674cd,function(_0x8f1987){return _0x8f1987[_0x9255('0x59')];})},'attributes':['id',_0x9255('0x59')],'raw':!![]})['then'](function(_0x2edaf8){var _0x32b58b=_[_0x9255('0x2d')](_0x41418e['body'],function(_0x3173a5){_0x3173a5[_0x9255('0x5a')]=_0x41418e[_0x9255('0x54')]['id'];return _0x3173a5;});return db['UserProfileResource'][_0x9255('0x6d')](_0x32b58b,{'raw':!![],'transaction':_0x2d6af3});});}})[_0x9255('0x4a')](handleError(_0x3d249b,null));});}})['then'](function(_0x67cb6e){var _0x1c8ca0=_[_0x9255('0x2d')](_0x67cb6e,function(_0x526a14){return _0x526a14[_0x9255('0x4c')]({'plain':!![]});});})[_0x9255('0x27')](respondWithResult(_0x3d249b,null))[_0x9255('0x4a')](handleError(_0x3d249b,null));};exports[_0x9255('0x6e')]=function(_0x11f5b9,_0x48743f,_0x5dc444){return db[_0x9255('0x42')]['find']({'where':{'id':_0x11f5b9[_0x9255('0x54')]['id']}})[_0x9255('0x27')](handleEntityNotFound(_0x48743f,null))[_0x9255('0x27')](function(_0x3c6eee){if(_0x3c6eee){return _0x3c6eee['removeResources'](_0x11f5b9['query'][_0x9255('0x60')]);}})[_0x9255('0x27')](respondWithStatusCode(_0x48743f,null))['catch'](handleError(_0x48743f,null));};exports[_0x9255('0x6f')]=function(_0x157bf1,_0x2d1183){var _0x41237c={};if(!_0x157bf1[_0x9255('0x34')]['section'])throw new Error(_0x9255('0x70'));if(!_0x157bf1[_0x9255('0x34')]['hasOwnProperty'](_0x9255('0x71'))){_0x41237c[_0x9255('0x1e')]=qs[_0x9255('0x1e')](_0x157bf1[_0x9255('0x34')]['limit']);_0x41237c['offset']=qs[_0x9255('0x20')](_0x157bf1['query'][_0x9255('0x20')]);}return db[_0x9255('0x42')][_0x9255('0x47')]({'where':{'id':_0x157bf1[_0x9255('0x54')]['id']}})['then'](function(_0x31071d){if(!_0x31071d)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x157bf1[_0x9255('0x54')]['id']);return db[_0x9255('0x42')][_0x9255('0x6f')](_0x157bf1);})[_0x9255('0x27')](respondWithFilteredResult(_0x2d1183,_0x41237c))[_0x9255('0x4a')](handleError(_0x2d1183,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9b6bfbc..355d31d 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 _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x26982c,_0x599755){var _0x19ed79=function(_0x1a3bda){while(--_0x1a3bda){_0x26982c['push'](_0x26982c['shift']());}};_0x19ed79(++_0x599755);}(_0x2525,0x1f0));var _0x5252=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2525[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x3588=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x50dec2,_0x4379aa){var _0x54a1fa=function(_0xc8d3b1){while(--_0xc8d3b1){_0x50dec2['push'](_0x50dec2['shift']());}};_0x54a1fa(++_0x4379aa);}(_0x3588,0x82));var _0x8358=function(_0x233f43,_0x600ccb){_0x233f43=_0x233f43-0x0;var _0x3059d4=_0x3588[_0x233f43];return _0x3059d4;};'use strict';var EventEmitter=require(_0x8358('0x0'));var UserProfile=require(_0x8358('0x1'))['db'][_0x8358('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8358('0x3')](0x0);var events={'afterCreate':_0x8358('0x4'),'afterUpdate':_0x8358('0x5'),'afterDestroy':_0x8358('0x6')};function emitEvent(_0x586dd2){return function(_0x3fd803,_0xa7a3d4,_0x146ed6){UserProfileEvents[_0x8358('0x7')](_0x586dd2+':'+_0x3fd803['id'],_0x3fd803);UserProfileEvents['emit'](_0x586dd2,_0x3fd803);_0x146ed6(null);};}for(var e in events){if(events[_0x8358('0x8')](e)){var event=events[e];UserProfile[_0x8358('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0e2f9aa..61ef8cb 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 _0xd71b=['where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','all','ignore','isEmpty','union','find','rawAttributes','keys','intersection','fields','attributes','limit','offset','sort','pick','filters','merge','key','foreignKey','options','autoAssociation','includeAll','include','forEach','reportType','default','reportId','DefaultReports','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','findAll','map','catch','value','model','then','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','name','projectName','projects','JscriptyProject','parentSections','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','agent','membername','telephone','VoiceQueue','inbound','QueueCampaigns','queue','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailAccount','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','pauses','Pause','Schedule','sounds','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions'];(function(_0x4e175a,_0x2bae34){var _0x2ff2c4=function(_0x2849eb){while(--_0x2849eb){_0x4e175a['push'](_0x4e175a['shift']());}};_0x2ff2c4(++_0x2bae34);}(_0xd71b,0xfc));var _0xbd71=function(_0x2e9ac1,_0xdc520b){_0x2e9ac1=_0x2e9ac1-0x0;var _0x4befae=_0xd71b[_0x2e9ac1];return _0x4befae;};'use strict';var _=require(_0xbd71('0x0'));var attributes=require(_0xbd71('0x1'));var squel=require(_0xbd71('0x2'));module[_0xbd71('0x3')]=function(_0x276f98){var _0xcdf2d7=_0x276f98[_0xbd71('0x4')];function _0x321279(_0x357ac7,_0xb67a7f){return new Promise(function(_0x15b257,_0x3e362d){if(!_0xb67a7f)return _0x15b257(null);var _0x326e16=_0xb67a7f[_0xbd71('0x5')]?{[_0xb67a7f[_0xbd71('0x5')][_0xbd71('0x6')]]:_0xb67a7f[_0xbd71('0x5')]['value']}:undefined;return _0xcdf2d7[_0x357ac7][_0xbd71('0x7')]({'where':_0x326e16,'raw':!![]})['then'](function(_0x5de7ae){_0xb67a7f['associatedResources']=_[_0xbd71('0x8')](_0x5de7ae,'id');_0x15b257(_0xb67a7f);})[_0xbd71('0x9')](function(_0x490312){_0x3e362d(_0x490312);});});}function _0x31a87f(_0x5afe90,_0x524f9e){return new Promise(function(_0x34c8fe,_0x595366){var _0x5e13fb=_0x5afe90[_0xbd71('0x5')]?{[_0x5afe90[_0xbd71('0x5')]['field']]:_0x5afe90[_0xbd71('0x5')][_0xbd71('0xa')]}:undefined;return _0xcdf2d7[_0x5afe90[_0xbd71('0xb')]]['findAll']({'where':_0x5e13fb,'raw':!![]})[_0xbd71('0xc')](function(_0x2f7117){_0x524f9e[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x2f7117,function(_0x17d162){return _0x17d162['name'];});_0x34c8fe(_0x524f9e);})[_0xbd71('0x9')](function(_0x4e66f1){_0x595366(_0x4e66f1);});});}function _0x15fb32(_0x546b46,_0x48b58f,_0x3cfca3){if(!_0x48b58f)return Promise[_0xbd71('0xe')](null);return new Promise(function(_0x51527c,_0x1b1f86){return _0xcdf2d7[_0xbd71('0xf')][_0xbd71('0x7')]({'where':{'sectionId':_0x48b58f['id']},'raw':!![]})[_0xbd71('0xc')](function(_0x5da662){if(_0x546b46['field']&&_0x546b46[_0xbd71('0x6')]!=='id'){_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x15336a){return _0x15336a[_0x546b46[_0xbd71('0x6')]];});}else{if(_0x3cfca3===_0xbd71('0x10')){_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x144e15){return{'id':_0x144e15[_0xbd71('0x11')],'type':_0x144e15[_0xbd71('0x12')]};});}else{_0x48b58f[_0xbd71('0xd')]=_[_0xbd71('0x8')](_0x5da662,function(_0x2746c){return _0x2746c['resourceId'];});}}_0x51527c(_0x48b58f);})[_0xbd71('0x9')](function(_0x3c2de8){_0x1b1f86(_0x3c2de8);});});}function _0x1ff7c0(_0x4ff041,_0x46fdd5){var _0x10b49f={'parentSections':[]};switch(_0x4ff041['toLowerCase']()){case'squareprojects':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x14');break;case _0xbd71('0x15'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x16');break;case'squarerecordings':_0x10b49f['childModel']=_0xbd71('0x17');_0x10b49f['parentSections']=[{'name':_0xbd71('0x18'),'field':_0xbd71('0x19'),'foreignKey':_0xbd71('0x1a')}];break;case _0xbd71('0x1b'):_0x10b49f['childModel']=_0xbd71('0x1c');break;case'contacts':_0x10b49f['childModel']='CmContact';_0x10b49f[_0xbd71('0x1d')]=[{'name':_0xbd71('0x1e'),'field':'id','foreignKey':_0xbd71('0x1f')}];break;case'lists':_0x10b49f['childModel']=_0xbd71('0x20');break;case'companies':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x21');break;case _0xbd71('0x22'):_0x10b49f['childModel']=_0xbd71('0x23');break;case _0xbd71('0x24'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x25');break;case'chatwebsites':_0x10b49f[_0xbd71('0x13')]='ChatWebsite';break;case _0xbd71('0x26'):_0x10b49f[_0xbd71('0x13')]='FaxQueue';break;case _0xbd71('0x27'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x28');break;case _0xbd71('0x29'):case _0xbd71('0x2a'):case'outboundroutes':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x2b');break;case _0xbd71('0x2c'):_0x10b49f['childModel']=_0xbd71('0x2d');break;case _0xbd71('0x2e'):_0x10b49f[_0xbd71('0x13')]='VoiceMail';break;case _0xbd71('0x2f'):_0x10b49f[_0xbd71('0x13')]='VoiceRecording';_0x10b49f['parentSections']=[{'name':_0xbd71('0x30'),'field':_0xbd71('0x19'),'foreignKey':'membername','model':_0xbd71('0x31'),'filter':{'field':_0xbd71('0x32'),'value':[_0xbd71('0x33')]}},{'name':'Telephones','field':_0xbd71('0x19'),'foreignKey':_0xbd71('0x34'),'model':'User','filter':{'field':'role','value':[_0xbd71('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':'queue','model':_0xbd71('0x36'),'filter':{'field':'type','value':[_0xbd71('0x37')]}},{'name':_0xbd71('0x38'),'field':'name','foreignKey':_0xbd71('0x39'),'model':_0xbd71('0x36'),'filter':{'field':_0xbd71('0x12'),'value':['outbound']}}];break;case'musiconholds':_0x10b49f['childModel']=_0xbd71('0x3a');break;case _0xbd71('0x3b'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x3c');break;case _0xbd71('0x3d'):_0x10b49f['childModel']=_0xbd71('0x3e');break;case'ivrcampaigns':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x3f');break;case _0xbd71('0x40'):_0x10b49f[_0xbd71('0x13')]='MailQueue';break;case'mailaccounts':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x41');break;case'mailsubstatuses':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x42');break;case'openchannelqueues':_0x10b49f['childModel']=_0xbd71('0x43');break;case'openchannelaccounts':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x44');break;case _0xbd71('0x45'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x46');break;case _0xbd71('0x47'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x48');break;case _0xbd71('0x49'):_0x10b49f['childModel']=_0xbd71('0x4a');break;case _0xbd71('0x4b'):_0x10b49f['childModel']=_0xbd71('0x4c');break;case _0xbd71('0x4d'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x4e');break;case'voicequeues':case _0xbd71('0x4f'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x36');if(_0x46fdd5){_0x10b49f[_0xbd71('0x1d')]=[{'name':_0xbd71('0x50')},{'name':'QueueCampaigns'}];}break;case _0xbd71('0x51'):case'agents':case _0xbd71('0x52'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x31');if(_0x46fdd5){_0x10b49f['parentSections']=[{'name':_0xbd71('0x53'),'filter':{'field':_0xbd71('0x32'),'value':[_0xbd71('0x54'),_0xbd71('0x55')]},'ignore':!![]},{'name':_0xbd71('0x30')},{'name':_0xbd71('0x56')}];}break;case _0xbd71('0x57'):_0x10b49f['childModel']=_0xbd71('0x58');break;case _0xbd71('0x59'):_0x10b49f[_0xbd71('0x13')]='SalesforceAccount';break;case _0xbd71('0x5a'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x5b');break;case _0xbd71('0x5c'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x5d');break;case _0xbd71('0x5e'):_0x10b49f[_0xbd71('0x13')]='DeskAccount';break;case _0xbd71('0x5f'):_0x10b49f[_0xbd71('0x13')]='ZohoAccount';break;case _0xbd71('0x60'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x31');break;case _0xbd71('0x61'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x62');break;case _0xbd71('0x63'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x64');break;case'customdashboards':_0x10b49f['childModel']=_0xbd71('0x65');break;case _0xbd71('0x66'):_0x10b49f[_0xbd71('0x13')]='Interval';break;case _0xbd71('0x67'):_0x10b49f['childModel']=_0xbd71('0x68');break;case'scheduler':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x69');break;case _0xbd71('0x6a'):_0x10b49f[_0xbd71('0x13')]='Sound';break;case'tags':_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x6b');break;case _0xbd71('0x6c'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x6d');break;case _0xbd71('0x6e'):_0x10b49f['childModel']=_0xbd71('0x6f');break;case _0xbd71('0x70'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x71');break;case _0xbd71('0x72'):_0x10b49f['childModel']=_0xbd71('0x73');break;case _0xbd71('0x74'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x75');break;case _0xbd71('0x76'):_0x10b49f[_0xbd71('0x13')]=_0xbd71('0x10');_0x10b49f[_0xbd71('0x1d')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xbd71('0x77'):_0x10b49f['childModel']=_0xbd71('0x78');break;}return _0x10b49f;}function _0x292c1a(_0x20ea13,_0x4fc67b){var _0x499e48=_0x20ea13['charAt'](0x0)['toUpperCase']()+_0x20ea13[_0xbd71('0x79')](0x1);var _0x12f958={'type':_0xcdf2d7[_0xbd71('0x7a')][_0xbd71('0x7b')][_0xbd71('0x7c')],'raw':!![]};return new Promise(function(_0x5b6760,_0x30892f){var _0x180a79=squel['select']()[_0xbd71('0x6')]('ui.'+_0x499e48+_0xbd71('0x7d'),'id')[_0xbd71('0x6')](_0xbd71('0x7e'))[_0xbd71('0x7f')](_0xbd71('0x80')+_0x20ea13+_0xbd71('0x81'),'ui')[_0xbd71('0x82')](_0xbd71('0x83'),_0x4fc67b['id']);return _0xcdf2d7[_0xbd71('0x84')][_0xbd71('0x85')](_0x180a79[_0xbd71('0x86')](),_0x12f958)[_0xbd71('0xc')](function(_0x2f7f71){_0x4fc67b[_0x499e48+_0xbd71('0x87')]=_0x2f7f71;_0x5b6760(_0x2f7f71);})['catch'](function(_0x376917){_0x30892f(_0x376917);});});}return _0x276f98[_0xbd71('0x88')](_0xbd71('0x89'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4b7358){var _0x2b434d=require(_0xbd71('0x8a'));var _0x45fdbd={'raw':_0x4b7358['query'][_0xbd71('0x8b')],'where':{}};var _0xc4d161={};var _0x1eb95a={'count':0x0,'rows':[]};var _0xa03d44=_0x4b7358[_0xbd71('0x85')][_0xbd71('0x8c')];var _0x1f74db=_0x4b7358[_0xbd71('0x85')][_0xbd71('0x8d')]||![];var _0x42db86=_0x1ff7c0(_0xa03d44,_0x1f74db);if(!_0x42db86[_0xbd71('0x13')])throw new Error(_0xbd71('0x8e')+_0xa03d44+'\x27');var _0x341099=[{'name':_0xa03d44}];if(!_['isEmpty'](_0x42db86[_0xbd71('0x1d')]))_0x341099=_0x42db86[_0xbd71('0x1d')];var _0x400767=[];for(var _0x36f2ec=0x0;_0x36f2ec<_0x341099[_0xbd71('0x8f')];_0x36f2ec++){_0x400767[_0xbd71('0x90')](_0xcdf2d7['UserProfileSection']['find']({'where':{'userProfileId':_0x4b7358['params']['id'],'name':_0x341099[_0x36f2ec][_0xbd71('0x19')]},'raw':!![]}));}return Promise[_0xbd71('0x91')](_0x400767)['then'](function(_0x261a31){var _0x54444f=_[_0xbd71('0x5')](_0x261a31,function(_0x3727ae){return _0x3727ae?_0x3727ae:undefined;});var _0x1307b3=_[_0xbd71('0x5')](_0x341099,[_0xbd71('0x92'),!![]]);var _0x4f4356=_[_0xbd71('0x93')](_0x54444f)&&_[_0xbd71('0x93')](_0x1307b3)?null:_[_0xbd71('0x94')](_0x1307b3,_0x54444f);if(!_0x4f4356)return null;var _0x399d29=[];for(var _0x1771a9=0x0;_0x1771a9<_0x4f4356[_0xbd71('0x8f')];_0x1771a9++){var _0xaca57f=_[_0xbd71('0x95')](_0x341099,function(_0x1682fa){return _0x4f4356[_0x1771a9]?_0x1682fa[_0xbd71('0x19')]===_0x4f4356[_0x1771a9][_0xbd71('0x19')]:null;});if(_0xaca57f){if(_0x4f4356[_0x1771a9][_0xbd71('0x92')]){_0x399d29[_0xbd71('0x90')](_0x321279(_0x42db86[_0xbd71('0x13')],_0x4f4356[_0x1771a9]));}else{if(!_0x4f4356[_0x1771a9]['autoAssociation']){_0x399d29['push'](_0x15fb32(_0xaca57f,_0x4f4356[_0x1771a9],_0x42db86[_0xbd71('0x13')]));}else{if(_0xaca57f[_0xbd71('0xb')]){_0x399d29[_0xbd71('0x90')](_0x31a87f(_0xaca57f,_0x4f4356[_0x1771a9]));}}}}}return Promise[_0xbd71('0x91')](_0x399d29);})[_0xbd71('0xc')](function(_0x564117){var _0x6c859e=_0x564117;var _0xeff7dd=null;if(_0x6c859e){_0xeff7dd=_0x6c859e[_0xbd71('0x8f')]===0x1?_0x6c859e[0x0]:null;}if(!_0xeff7dd&&!_0x6c859e)return _0x1eb95a;var _0x12d6a1=_0xcdf2d7[_0x42db86[_0xbd71('0x13')]][_0xbd71('0x96')];_0xc4d161[_0xbd71('0xb')]=_[_0xbd71('0x97')](_0x12d6a1);_0xc4d161[_0xbd71('0x85')]=_['keys'](_0x4b7358[_0xbd71('0x85')]);_0xc4d161['filters']=_['intersection'](_0xc4d161[_0xbd71('0xb')],_0xc4d161['query']);_0x45fdbd['attributes']=_[_0xbd71('0x98')](_0xc4d161[_0xbd71('0xb')],_0x2b434d[_0xbd71('0x99')](_0x4b7358['query']['fields']));_0x45fdbd[_0xbd71('0x9a')]=_0x45fdbd[_0xbd71('0x9a')][_0xbd71('0x8f')]?_0x45fdbd[_0xbd71('0x9a')]:_0xc4d161[_0xbd71('0xb')];if(!_0x4b7358[_0xbd71('0x85')]['hasOwnProperty']('nolimit')){_0x45fdbd['limit']=_0x2b434d[_0xbd71('0x9b')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0x9b')]);_0x45fdbd[_0xbd71('0x9c')]=_0x2b434d[_0xbd71('0x9c')](_0x4b7358['query'][_0xbd71('0x9c')]);}_0x45fdbd['order']=_0x2b434d[_0xbd71('0x9d')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0x9d')]);_0x45fdbd[_0xbd71('0x82')]=_0x2b434d['filters'](_[_0xbd71('0x9e')](_0x4b7358[_0xbd71('0x85')],_0xc4d161[_0xbd71('0x9f')]));if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0x5')]){_0x45fdbd[_0xbd71('0x82')]=_[_0xbd71('0xa0')](_0x45fdbd[_0xbd71('0x82')],{'$or':_[_0xbd71('0x8')](_0x12d6a1,function(_0x325707){if(_0x325707[_0xbd71('0x12')][_0xbd71('0xa1')]!=='VIRTUAL'){var _0x4a507b={};_0x4a507b[_0x325707['field']]={'$like':'%'+_0x4b7358[_0xbd71('0x85')][_0xbd71('0x5')]+'%'};return _0x4a507b;}})});}var _0x539c63=[];var _0x510bcf=null;var _0x46d4b={};if(_0xeff7dd){_0x510bcf=_[_0xbd71('0x95')](_0x341099,['name',_0xeff7dd[_0xbd71('0x19')]]);if(_0x510bcf['field']){_0x46d4b={};if(_0x42db86[_0xbd71('0x13')]===_0xbd71('0x10')){_0x46d4b[_0x510bcf[_0xbd71('0xa2')]]=_[_0xbd71('0x8')](_0xeff7dd['associatedResources'],'id');}else{_0x46d4b[_0x510bcf['foreignKey']]=_0xeff7dd['associatedResources'];}_0x539c63[_0xbd71('0x90')](_0x46d4b);}else{_0x45fdbd[_0xbd71('0x82')]['id']=_0xeff7dd[_0xbd71('0xd')];}}else{for(var _0x522d70=0x0;_0x522d70<_0x6c859e[_0xbd71('0x8f')];_0x522d70++){_0x510bcf=_[_0xbd71('0x95')](_0x341099,[_0xbd71('0x19'),_0x6c859e[_0x522d70][_0xbd71('0x19')]]);if(_0x510bcf[_0xbd71('0x6')]){_0x46d4b={};_0x46d4b[_0x510bcf[_0xbd71('0xa2')]]=_0x6c859e[_0x522d70][_0xbd71('0xd')];_0x539c63[_0xbd71('0x90')](_0x46d4b);}else{if(!_0x45fdbd[_0xbd71('0x82')]['id'])_0x45fdbd[_0xbd71('0x82')]['id']=[];_0x6c859e[_0x522d70]['associatedResources']['forEach'](function(_0x1b2a2b){_0x45fdbd['where']['id'][_0xbd71('0x90')](_0x1b2a2b);});}}}if(!_['isEmpty'](_0x539c63)){_0x45fdbd[_0xbd71('0x82')]=_[_0xbd71('0xa0')](_0x45fdbd[_0xbd71('0x82')],{'$and':{'$or':_0x539c63}});}_0x45fdbd=_[_0xbd71('0xa0')]({},_0x45fdbd,_0x4b7358[_0xbd71('0xa3')]);if(_0xeff7dd&&!_0xeff7dd[_0xbd71('0xa4')]&&_0x42db86[_0xbd71('0x13')]===_0xbd71('0x10')){if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xa5')]){_0x45fdbd[_0xbd71('0xa6')]=[{'all':!![]}];}return _0xcdf2d7[_0x42db86[_0xbd71('0x13')]][_0xbd71('0x7')](_0x45fdbd)['then'](function(_0x5d369c){var _0x21dda5=[];_0x5d369c[_0xbd71('0xa7')](function(_0x4480a9){var _0x49fb7f;switch(_0x4480a9[_0xbd71('0xa8')]){case _0xbd71('0xa9'):_0x49fb7f=_[_0xbd71('0x95')](_0xeff7dd['associatedResources'],function(_0x22b5be){return _0x22b5be['id']===_0x4480a9[_0xbd71('0xaa')]&&_0x22b5be[_0xbd71('0x12')]===_0xbd71('0xab');});break;case'custom':_0x49fb7f=_[_0xbd71('0x95')](_0xeff7dd[_0xbd71('0xd')],function(_0x591641){return _0x591641['id']===_0x4480a9[_0xbd71('0xaa')]&&_0x591641[_0xbd71('0x12')]===_0xbd71('0xac');});break;}if(_0x49fb7f)_0x21dda5[_0xbd71('0x90')](_0x4480a9);});_0x1eb95a[_0xbd71('0xad')]=_0x21dda5[_0xbd71('0x8f')];_0x1eb95a[_0xbd71('0xae')]=_0x21dda5;return _0x1eb95a;});}else{if(!_[_0xbd71('0x93')](_0x4b7358[_0xbd71('0x85')][_0xbd71('0xaf')])){_0x45fdbd[_0xbd71('0x82')]['id']=_0x45fdbd[_0xbd71('0x82')]['id']?_[_0xbd71('0x98')](_0x45fdbd[_0xbd71('0x82')]['id'],_0x4b7358['query'][_0xbd71('0xaf')]):_0x4b7358[_0xbd71('0x85')][_0xbd71('0xaf')];if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb0')]){_0x45fdbd[_0xbd71('0xb1')]=_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb0')];}}if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb2')]){_0x45fdbd[_0xbd71('0x82')]=_['merge'](_0x45fdbd['where'],{'$and':_0x4b7358[_0xbd71('0x85')]['extraQueryConditions']});}return _0xcdf2d7[_0x42db86['childModel']][_0xbd71('0xad')]({'where':_0x45fdbd[_0xbd71('0x82')]})['then'](function(_0x23276d){_0x1eb95a[_0xbd71('0xad')]=_0x23276d;if(_0x4b7358[_0xbd71('0x85')][_0xbd71('0xa5')]){if(_0x42db86[_0xbd71('0x13')]===_0xbd71('0xb3')){_0x45fdbd[_0xbd71('0xa6')]=[{'model':_0xcdf2d7['Tag'],'as':_0xbd71('0xb4'),'attributes':['id',_0xbd71('0x19'),'color'],'required':_0x4b7358['query']['tag']?!![]:![]},{'model':_0xcdf2d7[_0xbd71('0x6b')],'as':'ThroughTags','attributes':['id',_0xbd71('0x19'),_0xbd71('0xb5')],'through':_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb6')]?{'attributes':[],'where':{'TagId':_0x4b7358['query'][_0xbd71('0xb6')]||undefined}}:{},'required':_0x4b7358[_0xbd71('0x85')]['tag']?!![]:![]}];}else{_0x45fdbd[_0xbd71('0xa6')]=[{'all':!![]}];}}return _0xcdf2d7[_0x42db86[_0xbd71('0x13')]]['findAll'](_0x45fdbd);})[_0xbd71('0xc')](function(_0x486bf8){_0x1eb95a[_0xbd71('0xae')]=_0x486bf8;if(_0xa03d44===_0xbd71('0x30')&&_0x4b7358[_0xbd71('0x85')][_0xbd71('0xb7')]==='true'){var _0x5818dd=[];for(var _0x29ef90=0x0;_0x29ef90<_0x1eb95a['rows'][_0xbd71('0x8f')];_0x29ef90++){_0x5818dd['push'](_0x292c1a(_0xbd71('0xb8'),_0x1eb95a['rows'][_0x29ef90]['dataValues']));_0x5818dd['push'](_0x292c1a(_0xbd71('0xb9'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbb'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90]['dataValues']));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbc'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd[_0xbd71('0x90')](_0x292c1a(_0xbd71('0xbd'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90][_0xbd71('0xba')]));_0x5818dd['push'](_0x292c1a(_0xbd71('0xbe'),_0x1eb95a[_0xbd71('0xae')][_0x29ef90]['dataValues']));}return Promise[_0xbd71('0x91')](_0x5818dd)[_0xbd71('0xc')](function(){return _0x1eb95a;});}return _0x1eb95a;});}});}}});}; \ No newline at end of file +var _0xf0f1=['childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','role','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','Telephones','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','length','push','find','params','isEmpty','union','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','includeAll','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tag','Tags','ThroughTags','color','tag','true','chat','dataValues','sms','fax','mail','openchannel','all','lodash','squel','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','resourceId','type','SquareProject','odbc'];(function(_0x137def,_0x4c6937){var _0x2b52b9=function(_0x429b40){while(--_0x429b40){_0x137def['push'](_0x137def['shift']());}};_0x2b52b9(++_0x4c6937);}(_0xf0f1,0xad));var _0x1f0f=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xf0f1[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require(_0x1f0f('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x1f0f('0x1'));module['exports']=function(_0x1d5da8){var _0x5a70c7=_0x1d5da8['models'];function _0x2be8a1(_0x4c6ea1,_0x36f7e8){return new Promise(function(_0x40280e,_0x41e785){if(!_0x36f7e8)return _0x40280e(null);var _0x4c297e=_0x36f7e8['filter']?{[_0x36f7e8[_0x1f0f('0x2')][_0x1f0f('0x3')]]:_0x36f7e8[_0x1f0f('0x2')][_0x1f0f('0x4')]}:undefined;return _0x5a70c7[_0x4c6ea1][_0x1f0f('0x5')]({'where':_0x4c297e,'raw':!![]})[_0x1f0f('0x6')](function(_0x251d65){_0x36f7e8[_0x1f0f('0x7')]=_[_0x1f0f('0x8')](_0x251d65,'id');_0x40280e(_0x36f7e8);})['catch'](function(_0x10943d){_0x41e785(_0x10943d);});});}function _0x5308b3(_0x1db956,_0x50a1fb){return new Promise(function(_0x4cbc68,_0x2870b5){var _0x37135b=_0x1db956[_0x1f0f('0x2')]?{[_0x1db956['filter']['field']]:_0x1db956['filter'][_0x1f0f('0x4')]}:undefined;return _0x5a70c7[_0x1db956['model']]['findAll']({'where':_0x37135b,'raw':!![]})[_0x1f0f('0x6')](function(_0x3fe353){_0x50a1fb[_0x1f0f('0x7')]=_['map'](_0x3fe353,function(_0x470a2a){return _0x470a2a[_0x1f0f('0x9')];});_0x4cbc68(_0x50a1fb);})[_0x1f0f('0xa')](function(_0x5bb410){_0x2870b5(_0x5bb410);});});}function _0x27fbff(_0x510674,_0x1f31b3,_0x12e33d){if(!_0x1f31b3)return Promise[_0x1f0f('0xb')](null);return new Promise(function(_0x249ccf,_0x18c98c){return _0x5a70c7[_0x1f0f('0xc')][_0x1f0f('0x5')]({'where':{'sectionId':_0x1f31b3['id']},'raw':!![]})[_0x1f0f('0x6')](function(_0x90cc66){if(_0x510674[_0x1f0f('0x3')]&&_0x510674[_0x1f0f('0x3')]!=='id'){_0x1f31b3[_0x1f0f('0x7')]=_[_0x1f0f('0x8')](_0x90cc66,function(_0x1c925b){return _0x1c925b[_0x510674['field']];});}else{if(_0x12e33d==='AnalyticExtractedReport'){_0x1f31b3[_0x1f0f('0x7')]=_[_0x1f0f('0x8')](_0x90cc66,function(_0x5bd710){return{'id':_0x5bd710[_0x1f0f('0xd')],'type':_0x5bd710[_0x1f0f('0xe')]};});}else{_0x1f31b3[_0x1f0f('0x7')]=_[_0x1f0f('0x8')](_0x90cc66,function(_0xc5cf1e){return _0xc5cf1e['resourceId'];});}}_0x249ccf(_0x1f31b3);})[_0x1f0f('0xa')](function(_0x30829a){_0x18c98c(_0x30829a);});});}function _0x46f589(_0x153522,_0x1a6d29){var _0x30f239={'parentSections':[]};switch(_0x153522['toLowerCase']()){case'squareprojects':_0x30f239['childModel']=_0x1f0f('0xf');break;case _0x1f0f('0x10'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x12');break;case _0x1f0f('0x13'):_0x30f239[_0x1f0f('0x11')]='SquareRecording';_0x30f239[_0x1f0f('0x14')]=[{'name':_0x1f0f('0x15'),'field':'name','foreignKey':'projectName'}];break;case _0x1f0f('0x16'):_0x30f239[_0x1f0f('0x11')]='JscriptyProject';break;case'contacts':_0x30f239['childModel']=_0x1f0f('0x17');_0x30f239[_0x1f0f('0x14')]=[{'name':_0x1f0f('0x18'),'field':'id','foreignKey':_0x1f0f('0x19')}];break;case'lists':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x1a');break;case'companies':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x1b');break;case _0x1f0f('0x1c'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x1d');break;case'chatqueues':_0x30f239[_0x1f0f('0x11')]='ChatQueue';break;case _0x1f0f('0x1e'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x1f');break;case _0x1f0f('0x20'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x21');break;case _0x1f0f('0x22'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x23');break;case _0x1f0f('0x24'):case _0x1f0f('0x25'):case'outboundroutes':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x26');break;case'contexts':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x27');break;case'voicemails':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x28');break;case _0x1f0f('0x29'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x2a');_0x30f239[_0x1f0f('0x14')]=[{'name':_0x1f0f('0x2b'),'field':_0x1f0f('0x9'),'foreignKey':_0x1f0f('0x2c'),'model':_0x1f0f('0x2d'),'filter':{'field':'role','value':[_0x1f0f('0x2e')]}},{'name':'Telephones','field':_0x1f0f('0x9'),'foreignKey':'membername','model':_0x1f0f('0x2d'),'filter':{'field':_0x1f0f('0x2f'),'value':[_0x1f0f('0x30')]}},{'name':_0x1f0f('0x31'),'field':_0x1f0f('0x9'),'foreignKey':'queue','model':_0x1f0f('0x32'),'filter':{'field':'type','value':['inbound']}},{'name':_0x1f0f('0x33'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x1f0f('0x34')]}}];break;case _0x1f0f('0x35'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x36');break;case _0x1f0f('0x37'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x38');break;case _0x1f0f('0x39'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x3a');break;case _0x1f0f('0x3b'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x3c');break;case _0x1f0f('0x3d'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x3e');break;case _0x1f0f('0x3f'):_0x30f239['childModel']=_0x1f0f('0x40');break;case _0x1f0f('0x41'):_0x30f239['childModel']=_0x1f0f('0x42');break;case'openchannelqueues':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x43');break;case _0x1f0f('0x44'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x45');break;case _0x1f0f('0x46'):_0x30f239['childModel']=_0x1f0f('0x47');break;case'smsaccounts':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x48');break;case _0x1f0f('0x49'):_0x30f239[_0x1f0f('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x30f239['childModel']=_0x1f0f('0x4a');break;case _0x1f0f('0x4b'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x4c');break;case _0x1f0f('0x4d'):case _0x1f0f('0x4e'):_0x30f239['childModel']=_0x1f0f('0x32');if(_0x1a6d29){_0x30f239['parentSections']=[{'name':_0x1f0f('0x31')},{'name':'QueueCampaigns'}];}break;case _0x1f0f('0x4f'):case _0x1f0f('0x50'):case'telephones':_0x30f239[_0x1f0f('0x11')]='User';if(_0x1a6d29){_0x30f239[_0x1f0f('0x14')]=[{'name':_0x1f0f('0x51'),'filter':{'field':_0x1f0f('0x2f'),'value':[_0x1f0f('0x52'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x1f0f('0x53')}];}break;case'zendeskaccounts':_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x54');break;case _0x1f0f('0x55'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x56');break;case _0x1f0f('0x57'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x58');break;case _0x1f0f('0x59'):_0x30f239[_0x1f0f('0x11')]='SugarcrmAccount';break;case _0x1f0f('0x5a'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x5b');break;case _0x1f0f('0x5c'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x5d');break;case _0x1f0f('0x5e'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x2d');break;case _0x1f0f('0x5f'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x60');break;case _0x1f0f('0x61'):_0x30f239['childModel']=_0x1f0f('0x62');break;case'customdashboards':_0x30f239[_0x1f0f('0x11')]='Dashboard';break;case _0x1f0f('0x63'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x64');break;case _0x1f0f('0x65'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x66');break;case _0x1f0f('0x67'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x68');break;case _0x1f0f('0x69'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x6a');break;case _0x1f0f('0x6b'):_0x30f239[_0x1f0f('0x11')]='Tag';break;case _0x1f0f('0x6c'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x6d');break;case _0x1f0f('0x6e'):_0x30f239[_0x1f0f('0x11')]='Trigger';break;case _0x1f0f('0x6f'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x70');break;case'variables':_0x30f239['childModel']=_0x1f0f('0x71');break;case _0x1f0f('0x72'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x73');break;case _0x1f0f('0x74'):_0x30f239[_0x1f0f('0x11')]=_0x1f0f('0x75');_0x30f239['parentSections']=[{'name':_0x1f0f('0x76'),'field':'id','foreignKey':_0x1f0f('0x77')}];break;case _0x1f0f('0x78'):_0x30f239['childModel']=_0x1f0f('0x79');break;}return _0x30f239;}function _0x1b5260(_0x18dfe4,_0x1dde69){var _0x5e2cf9=_0x18dfe4[_0x1f0f('0x7a')](0x0)[_0x1f0f('0x7b')]()+_0x18dfe4['slice'](0x1);var _0x4a5d30={'type':_0x5a70c7['Sequelize'][_0x1f0f('0x7c')][_0x1f0f('0x7d')],'raw':!![]};return new Promise(function(_0x3dda6a,_0x2d7e4a){var _0x14f954=squel[_0x1f0f('0x7e')]()['field']('ui.'+_0x5e2cf9+_0x1f0f('0x7f'),'id')[_0x1f0f('0x3')](_0x1f0f('0x80'))[_0x1f0f('0x81')](_0x1f0f('0x82')+_0x18dfe4+_0x1f0f('0x83'),'ui')[_0x1f0f('0x84')](_0x1f0f('0x85'),_0x1dde69['id']);return _0x5a70c7[_0x1f0f('0x86')][_0x1f0f('0x87')](_0x14f954[_0x1f0f('0x88')](),_0x4a5d30)['then'](function(_0x189175){_0x1dde69[_0x5e2cf9+_0x1f0f('0x89')]=_0x189175;_0x3dda6a(_0x189175);})[_0x1f0f('0xa')](function(_0x3016f7){_0x2d7e4a(_0x3016f7);});});}return _0x1d5da8[_0x1f0f('0x8a')](_0x1f0f('0x8b'),attributes,{'tableName':_0x1f0f('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x13d425){var _0x2a64b3=require('../../components/parsers/qs');var _0x22d365={'raw':_0x13d425[_0x1f0f('0x87')][_0x1f0f('0x8d')],'where':{}};var _0x5c6140={};var _0x242edc={'count':0x0,'rows':[]};var _0x3cea32=_0x13d425[_0x1f0f('0x87')][_0x1f0f('0x8e')];var _0xc118ce=_0x13d425[_0x1f0f('0x87')][_0x1f0f('0x8f')]||![];var _0x1cc9a2=_0x46f589(_0x3cea32,_0xc118ce);if(!_0x1cc9a2[_0x1f0f('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x3cea32+'\x27');var _0x468658=[{'name':_0x3cea32}];if(!_['isEmpty'](_0x1cc9a2[_0x1f0f('0x14')]))_0x468658=_0x1cc9a2[_0x1f0f('0x14')];var _0x58a55a=[];for(var _0x4aaeb7=0x0;_0x4aaeb7<_0x468658[_0x1f0f('0x90')];_0x4aaeb7++){_0x58a55a[_0x1f0f('0x91')](_0x5a70c7['UserProfileSection'][_0x1f0f('0x92')]({'where':{'userProfileId':_0x13d425[_0x1f0f('0x93')]['id'],'name':_0x468658[_0x4aaeb7][_0x1f0f('0x9')]},'raw':!![]}));}return Promise['all'](_0x58a55a)[_0x1f0f('0x6')](function(_0x231a6c){var _0x36ef56=_[_0x1f0f('0x2')](_0x231a6c,function(_0x26b219){return _0x26b219?_0x26b219:undefined;});var _0x4f5ea6=_[_0x1f0f('0x2')](_0x468658,['ignore',!![]]);var _0x3aafc0=_['isEmpty'](_0x36ef56)&&_[_0x1f0f('0x94')](_0x4f5ea6)?null:_[_0x1f0f('0x95')](_0x4f5ea6,_0x36ef56);if(!_0x3aafc0)return null;var _0x15cce3=[];for(var _0x48c616=0x0;_0x48c616<_0x3aafc0[_0x1f0f('0x90')];_0x48c616++){var _0x1ca59c=_['find'](_0x468658,function(_0x176425){return _0x3aafc0[_0x48c616]?_0x176425['name']===_0x3aafc0[_0x48c616][_0x1f0f('0x9')]:null;});if(_0x1ca59c){if(_0x3aafc0[_0x48c616]['ignore']){_0x15cce3[_0x1f0f('0x91')](_0x2be8a1(_0x1cc9a2[_0x1f0f('0x11')],_0x3aafc0[_0x48c616]));}else{if(!_0x3aafc0[_0x48c616][_0x1f0f('0x96')]){_0x15cce3[_0x1f0f('0x91')](_0x27fbff(_0x1ca59c,_0x3aafc0[_0x48c616],_0x1cc9a2['childModel']));}else{if(_0x1ca59c[_0x1f0f('0x97')]){_0x15cce3[_0x1f0f('0x91')](_0x5308b3(_0x1ca59c,_0x3aafc0[_0x48c616]));}}}}}return Promise['all'](_0x15cce3);})['then'](function(_0x5e0510){var _0xb71802=_0x5e0510;var _0x112c02=null;if(_0xb71802){_0x112c02=_0xb71802[_0x1f0f('0x90')]===0x1?_0xb71802[0x0]:null;}if(!_0x112c02&&!_0xb71802)return _0x242edc;var _0x552ed3=_0x5a70c7[_0x1cc9a2['childModel']][_0x1f0f('0x98')];_0x5c6140['model']=_[_0x1f0f('0x99')](_0x552ed3);_0x5c6140['query']=_[_0x1f0f('0x99')](_0x13d425[_0x1f0f('0x87')]);_0x5c6140[_0x1f0f('0x9a')]=_[_0x1f0f('0x9b')](_0x5c6140[_0x1f0f('0x97')],_0x5c6140[_0x1f0f('0x87')]);_0x22d365[_0x1f0f('0x9c')]=_[_0x1f0f('0x9b')](_0x5c6140['model'],_0x2a64b3[_0x1f0f('0x9d')](_0x13d425[_0x1f0f('0x87')]['fields']));_0x22d365[_0x1f0f('0x9c')]=_0x22d365[_0x1f0f('0x9c')]['length']?_0x22d365[_0x1f0f('0x9c')]:_0x5c6140[_0x1f0f('0x97')];if(!_0x13d425[_0x1f0f('0x87')]['hasOwnProperty']('nolimit')){_0x22d365[_0x1f0f('0x9e')]=_0x2a64b3['limit'](_0x13d425['query'][_0x1f0f('0x9e')]);_0x22d365[_0x1f0f('0x9f')]=_0x2a64b3[_0x1f0f('0x9f')](_0x13d425[_0x1f0f('0x87')][_0x1f0f('0x9f')]);}_0x22d365[_0x1f0f('0xa0')]=_0x2a64b3[_0x1f0f('0xa1')](_0x13d425['query']['sort']);_0x22d365[_0x1f0f('0x84')]=_0x2a64b3[_0x1f0f('0x9a')](_[_0x1f0f('0xa2')](_0x13d425[_0x1f0f('0x87')],_0x5c6140[_0x1f0f('0x9a')]));if(_0x13d425['query'][_0x1f0f('0x2')]){_0x22d365[_0x1f0f('0x84')]=_[_0x1f0f('0xa3')](_0x22d365[_0x1f0f('0x84')],{'$or':_['map'](_0x552ed3,function(_0x474f25){if(_0x474f25['type']['key']!==_0x1f0f('0xa4')){var _0x380e9f={};_0x380e9f[_0x474f25['field']]={'$like':'%'+_0x13d425[_0x1f0f('0x87')][_0x1f0f('0x2')]+'%'};return _0x380e9f;}})});}var _0x2d846b=[];var _0x309fbf=null;var _0x1d1456={};if(_0x112c02){_0x309fbf=_[_0x1f0f('0x92')](_0x468658,[_0x1f0f('0x9'),_0x112c02[_0x1f0f('0x9')]]);if(_0x309fbf[_0x1f0f('0x3')]){_0x1d1456={};if(_0x1cc9a2[_0x1f0f('0x11')]===_0x1f0f('0x75')){_0x1d1456[_0x309fbf[_0x1f0f('0xa5')]]=_['map'](_0x112c02[_0x1f0f('0x7')],'id');}else{_0x1d1456[_0x309fbf[_0x1f0f('0xa5')]]=_0x112c02[_0x1f0f('0x7')];}_0x2d846b[_0x1f0f('0x91')](_0x1d1456);}else{_0x22d365[_0x1f0f('0x84')]['id']=_0x112c02[_0x1f0f('0x7')];}}else{for(var _0x5bb746=0x0;_0x5bb746<_0xb71802[_0x1f0f('0x90')];_0x5bb746++){_0x309fbf=_[_0x1f0f('0x92')](_0x468658,[_0x1f0f('0x9'),_0xb71802[_0x5bb746]['name']]);if(_0x309fbf[_0x1f0f('0x3')]){_0x1d1456={};_0x1d1456[_0x309fbf[_0x1f0f('0xa5')]]=_0xb71802[_0x5bb746]['associatedResources'];_0x2d846b[_0x1f0f('0x91')](_0x1d1456);}else{if(!_0x22d365['where']['id'])_0x22d365[_0x1f0f('0x84')]['id']=[];_0xb71802[_0x5bb746][_0x1f0f('0x7')][_0x1f0f('0xa6')](function(_0xfb6f5){_0x22d365['where']['id'][_0x1f0f('0x91')](_0xfb6f5);});}}}if(!_[_0x1f0f('0x94')](_0x2d846b)){_0x22d365['where']=_[_0x1f0f('0xa3')](_0x22d365['where'],{'$and':{'$or':_0x2d846b}});}_0x22d365=_[_0x1f0f('0xa3')]({},_0x22d365,_0x13d425['options']);if(_0x112c02&&!_0x112c02['autoAssociation']&&_0x1cc9a2[_0x1f0f('0x11')]==='AnalyticExtractedReport'){if(_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xa7')]){_0x22d365['include']=[{'all':!![]}];}return _0x5a70c7[_0x1cc9a2[_0x1f0f('0x11')]]['findAll'](_0x22d365)[_0x1f0f('0x6')](function(_0x4851f3){var _0x296824=[];_0x4851f3['forEach'](function(_0x1f9ab2){var _0x1e78cb;switch(_0x1f9ab2['reportType']){case _0x1f0f('0xa8'):_0x1e78cb=_[_0x1f0f('0x92')](_0x112c02[_0x1f0f('0x7')],function(_0x97649a){return _0x97649a['id']===_0x1f9ab2['reportId']&&_0x97649a[_0x1f0f('0xe')]===_0x1f0f('0xa9');});break;case _0x1f0f('0xaa'):_0x1e78cb=_['find'](_0x112c02[_0x1f0f('0x7')],function(_0x196275){return _0x196275['id']===_0x1f9ab2['reportId']&&_0x196275[_0x1f0f('0xe')]===_0x1f0f('0xab');});break;}if(_0x1e78cb)_0x296824[_0x1f0f('0x91')](_0x1f9ab2);});_0x242edc['count']=_0x296824[_0x1f0f('0x90')];_0x242edc[_0x1f0f('0xac')]=_0x296824;return _0x242edc;});}else{if(!_['isEmpty'](_0x13d425[_0x1f0f('0x87')]['ids'])){_0x22d365[_0x1f0f('0x84')]['id']=_0x22d365[_0x1f0f('0x84')]['id']?_[_0x1f0f('0x9b')](_0x22d365[_0x1f0f('0x84')]['id'],_0x13d425['query']['ids']):_0x13d425['query'][_0x1f0f('0xad')];if(_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xae')]){_0x22d365[_0x1f0f('0xa0')]=_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xae')];}}if(_0x13d425['query'][_0x1f0f('0xaf')]){_0x22d365[_0x1f0f('0x84')]=_[_0x1f0f('0xa3')](_0x22d365[_0x1f0f('0x84')],{'$and':_0x13d425[_0x1f0f('0x87')]['extraQueryConditions']});}return _0x5a70c7[_0x1cc9a2['childModel']]['count']({'where':_0x22d365[_0x1f0f('0x84')]})[_0x1f0f('0x6')](function(_0x37d1d6){_0x242edc[_0x1f0f('0xb0')]=_0x37d1d6;if(_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xa7')]){if(_0x1cc9a2[_0x1f0f('0x11')]===_0x1f0f('0x17')){_0x22d365['include']=[{'model':_0x5a70c7[_0x1f0f('0xb1')],'as':_0x1f0f('0xb2'),'attributes':['id','name','color'],'required':_0x13d425[_0x1f0f('0x87')]['tag']?!![]:![]},{'model':_0x5a70c7[_0x1f0f('0xb1')],'as':_0x1f0f('0xb3'),'attributes':['id',_0x1f0f('0x9'),_0x1f0f('0xb4')],'through':_0x13d425['query']['tag']?{'attributes':[],'where':{'TagId':_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xb5')]||undefined}}:{},'required':_0x13d425[_0x1f0f('0x87')][_0x1f0f('0xb5')]?!![]:![]}];}else{_0x22d365['include']=[{'all':!![]}];}}return _0x5a70c7[_0x1cc9a2[_0x1f0f('0x11')]][_0x1f0f('0x5')](_0x22d365);})[_0x1f0f('0x6')](function(_0x507814){_0x242edc[_0x1f0f('0xac')]=_0x507814;if(_0x3cea32===_0x1f0f('0x2b')&&_0x13d425[_0x1f0f('0x87')]['openTabs']===_0x1f0f('0xb6')){var _0x1aedc9=[];for(var _0x5b5e60=0x0;_0x5b5e60<_0x242edc['rows']['length'];_0x5b5e60++){_0x1aedc9[_0x1f0f('0x91')](_0x1b5260(_0x1f0f('0xb7'),_0x242edc['rows'][_0x5b5e60][_0x1f0f('0xb8')]));_0x1aedc9[_0x1f0f('0x91')](_0x1b5260(_0x1f0f('0xb9'),_0x242edc[_0x1f0f('0xac')][_0x5b5e60][_0x1f0f('0xb8')]));_0x1aedc9[_0x1f0f('0x91')](_0x1b5260(_0x1f0f('0xba'),_0x242edc[_0x1f0f('0xac')][_0x5b5e60][_0x1f0f('0xb8')]));_0x1aedc9[_0x1f0f('0x91')](_0x1b5260(_0x1f0f('0xbb'),_0x242edc[_0x1f0f('0xac')][_0x5b5e60]['dataValues']));_0x1aedc9[_0x1f0f('0x91')](_0x1b5260(_0x1f0f('0xbc'),_0x242edc[_0x1f0f('0xac')][_0x5b5e60][_0x1f0f('0xb8')]));_0x1aedc9[_0x1f0f('0x91')](_0x1b5260('whatsapp',_0x242edc['rows'][_0x5b5e60][_0x1f0f('0xb8')]));}return Promise[_0x1f0f('0xbd')](_0x1aedc9)['then'](function(){return _0x242edc;});}return _0x242edc;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 078beca..d177c2c 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 _0x1a38=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1a38,0xb0));var _0x81a3=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x1a38[_0x2caaef];return _0xd011f8;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a3('0x3'))['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var jayson=require(_0x81a3('0x8'));var client=jayson[_0x81a3('0x9')][_0x81a3('0xa')]({'port':0x232a});config[_0x81a3('0xb')]=_[_0x81a3('0xc')](config[_0x81a3('0xb')],{'host':_0x81a3('0xd'),'port':0x18eb});var socket=require(_0x81a3('0xe'))(new Redis(config['redis']));require(_0x81a3('0xf'))[_0x81a3('0x10')](socket);function respondWithRpcPromise(_0x3ece9a,_0x10f4c5,_0x3fd4fe){return new BPromise(function(_0x4a7f3a,_0xeef25e){return client[_0x81a3('0x11')](_0x3ece9a,_0x3fd4fe)[_0x81a3('0x12')](function(_0x516492){logger['info'](_0x81a3('0x13'),_0x10f4c5,_0x81a3('0x14'));logger[_0x81a3('0x15')](_0x81a3('0x16'),_0x10f4c5,_0x81a3('0x14'),JSON[_0x81a3('0x17')](_0x516492));if(_0x516492[_0x81a3('0x18')]){if(_0x516492[_0x81a3('0x18')][_0x81a3('0x19')]===0x1f4){logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x516492[_0x81a3('0x18')]['message']);return _0xeef25e(_0x516492[_0x81a3('0x18')][_0x81a3('0x1a')]);}logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x516492['error'][_0x81a3('0x1a')]);return _0x4a7f3a(_0x516492[_0x81a3('0x18')]['message']);}else{logger[_0x81a3('0x1b')]('UserProfile,\x20%s,\x20%s',_0x10f4c5,'request\x20sent');_0x4a7f3a(_0x516492[_0x81a3('0x1c')][_0x81a3('0x1a')]);}})[_0x81a3('0x1d')](function(_0x18c316){logger[_0x81a3('0x18')](_0x81a3('0x13'),_0x10f4c5,_0x18c316);_0xeef25e(_0x18c316);});});} \ No newline at end of file +var _0x3f96=['defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x3f96,0x1d3));var _0x63f9=function(_0x4830ec,_0x2c7ead){_0x4830ec=_0x4830ec-0x0;var _0x297615=_0x3f96[_0x4830ec];return _0x297615;};'use strict';var _=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var moment=require(_0x63f9('0x2'));var BPromise=require(_0x63f9('0x3'));var rs=require(_0x63f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63f9('0x5'))['db'];var utils=require(_0x63f9('0x6'));var logger=require(_0x63f9('0x7'))(_0x63f9('0x8'));var config=require(_0x63f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x63f9('0xa')][_0x63f9('0xb')]({'port':0x232a});config[_0x63f9('0xc')]=_[_0x63f9('0xd')](config['redis'],{'host':_0x63f9('0xe'),'port':0x18eb});var socket=require(_0x63f9('0xf'))(new Redis(config[_0x63f9('0xc')]));require(_0x63f9('0x10'))[_0x63f9('0x11')](socket);function respondWithRpcPromise(_0x9e3738,_0x26ffde,_0x338a52){return new BPromise(function(_0x584e7c,_0x3e038d){return client[_0x63f9('0x12')](_0x9e3738,_0x338a52)['then'](function(_0x409957){logger[_0x63f9('0x13')](_0x63f9('0x14'),_0x26ffde,'request\x20sent');logger[_0x63f9('0x15')](_0x63f9('0x16'),_0x26ffde,_0x63f9('0x17'),JSON[_0x63f9('0x18')](_0x409957));if(_0x409957[_0x63f9('0x19')]){if(_0x409957[_0x63f9('0x19')][_0x63f9('0x1a')]===0x1f4){logger['error'](_0x63f9('0x14'),_0x26ffde,_0x409957['error'][_0x63f9('0x1b')]);return _0x3e038d(_0x409957['error'][_0x63f9('0x1b')]);}logger[_0x63f9('0x19')](_0x63f9('0x14'),_0x26ffde,_0x409957[_0x63f9('0x19')][_0x63f9('0x1b')]);return _0x584e7c(_0x409957[_0x63f9('0x19')][_0x63f9('0x1b')]);}else{logger['info'](_0x63f9('0x14'),_0x26ffde,_0x63f9('0x17'));_0x584e7c(_0x409957[_0x63f9('0x1c')][_0x63f9('0x1b')]);}})[_0x63f9('0x1d')](function(_0x4bf06f){logger[_0x63f9('0x19')](_0x63f9('0x14'),_0x26ffde,_0x4bf06f);_0x3e038d(_0x4bf06f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5e26307..b75475f 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 _0xdeac=['length','./userProfile.events','save','remove','removeListener','register'];(function(_0x20fcec,_0x33eb9b){var _0x346870=function(_0x378099){while(--_0x378099){_0x20fcec['push'](_0x20fcec['shift']());}};_0x346870(++_0x33eb9b);}(_0xdeac,0x1d5));var _0xcdea=function(_0x36cf60,_0x581c08){_0x36cf60=_0x36cf60-0x0;var _0x253cff=_0xdeac[_0x36cf60];return _0x253cff;};'use strict';var UserProfileEvents=require(_0xcdea('0x0'));var events=[_0xcdea('0x1'),_0xcdea('0x2'),'update'];function createListener(_0x213bf1,_0x8897f4){return function(_0x5e3f7d){_0x8897f4['emit'](_0x213bf1,_0x5e3f7d);};}function removeListener(_0x2a13f3,_0x2d8f29){return function(){UserProfileEvents[_0xcdea('0x3')](_0x2a13f3,_0x2d8f29);};}exports[_0xcdea('0x4')]=function(_0x547f41){for(var _0x28048a=0x0,_0xde8fb=events[_0xcdea('0x5')];_0x28048a<_0xde8fb;_0x28048a++){var _0xd523b=events[_0x28048a];var _0x80d3af=createListener('userProfile:'+_0xd523b,_0x547f41);UserProfileEvents['on'](_0xd523b,_0x80d3af);}}; \ No newline at end of file +var _0xf572=['register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0xe99543,_0xaa4682){var _0x35b03e=function(_0x5daa43){while(--_0x5daa43){_0xe99543['push'](_0xe99543['shift']());}};_0x35b03e(++_0xaa4682);}(_0xf572,0x103));var _0x2f57=function(_0x51c481,_0x24e7b2){_0x51c481=_0x51c481-0x0;var _0x5bb400=_0xf572[_0x51c481];return _0x5bb400;};'use strict';var UserProfileEvents=require(_0x2f57('0x0'));var events=[_0x2f57('0x1'),_0x2f57('0x2'),_0x2f57('0x3')];function createListener(_0x3e626e,_0x584cc7){return function(_0x3783bd){_0x584cc7[_0x2f57('0x4')](_0x3e626e,_0x3783bd);};}function removeListener(_0x434c62,_0x489f11){return function(){UserProfileEvents['removeListener'](_0x434c62,_0x489f11);};}exports[_0x2f57('0x5')]=function(_0x19d387){for(var _0x521d88=0x0,_0x4c4756=events[_0x2f57('0x6')];_0x521d88<_0x4c4756;_0x521d88++){var _0x25eb6d=events[_0x521d88];var _0xdce332=createListener(_0x2f57('0x7')+_0x25eb6d,_0x19d387);UserProfileEvents['on'](_0x25eb6d,_0xdce332);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c154acc..e1907b7 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 _0xfd74=['update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x2682d9,_0x2c716d){var _0x35e49f=function(_0x1f9456){while(--_0x1f9456){_0x2682d9['push'](_0x2682d9['shift']());}};_0x35e49f(++_0x2c716d);}(_0xfd74,0x81));var _0x4fd7=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xfd74[_0x21de89];return _0x290b7e;};'use strict';var multer=require('multer');var util=require(_0x4fd7('0x0'));var path=require(_0x4fd7('0x1'));var timeout=require(_0x4fd7('0x2'));var express=require(_0x4fd7('0x3'));var router=express['Router']();var fs_extra=require(_0x4fd7('0x4'));var auth=require(_0x4fd7('0x5'));var interaction=require(_0x4fd7('0x6'));var config=require(_0x4fd7('0x7'));var controller=require(_0x4fd7('0x8'));router[_0x4fd7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fd7('0x9')](_0x4fd7('0xa'),auth['isAuthenticated'](),controller[_0x4fd7('0xb')]);router[_0x4fd7('0x9')]('/:id',auth[_0x4fd7('0xc')](),controller[_0x4fd7('0xd')]);router[_0x4fd7('0xe')]('/',auth[_0x4fd7('0xc')](),controller[_0x4fd7('0xf')]);router[_0x4fd7('0x10')](_0x4fd7('0x11'),auth[_0x4fd7('0xc')](),controller[_0x4fd7('0x12')]);router['delete'](_0x4fd7('0x11'),auth[_0x4fd7('0xc')](),controller[_0x4fd7('0x13')]);module[_0x4fd7('0x14')]=router; \ No newline at end of file +var _0xbfcc=['/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbfcc,0x9b));var _0xcbfc=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xbfcc[_0x5ecadc];return _0x565037;};'use strict';var multer=require(_0xcbfc('0x0'));var util=require(_0xcbfc('0x1'));var path=require(_0xcbfc('0x2'));var timeout=require(_0xcbfc('0x3'));var express=require(_0xcbfc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbfc('0x5'));var config=require(_0xcbfc('0x6'));var controller=require('./userProfileResource.controller');router[_0xcbfc('0x7')]('/',auth[_0xcbfc('0x8')](),controller[_0xcbfc('0x9')]);router[_0xcbfc('0x7')](_0xcbfc('0xa'),auth['isAuthenticated'](),controller[_0xcbfc('0xb')]);router[_0xcbfc('0x7')]('/:id',auth[_0xcbfc('0x8')](),controller[_0xcbfc('0xc')]);router[_0xcbfc('0xd')]('/',auth[_0xcbfc('0x8')](),controller[_0xcbfc('0xe')]);router[_0xcbfc('0xf')](_0xcbfc('0x10'),auth[_0xcbfc('0x8')](),controller['update']);router['delete'](_0xcbfc('0x10'),auth[_0xcbfc('0x8')](),controller[_0xcbfc('0x11')]);module[_0xcbfc('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 29ad7fb..9c8ff2e 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 _0xbf72=['STRING','INTEGER','sequelize','exports'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xbf72,0x1de));var _0x2bf7=function(_0x187d57,_0x15dcf2){_0x187d57=_0x187d57-0x0;var _0x4d92e3=_0xbf72[_0x187d57];return _0x4d92e3;};'use strict';var Sequelize=require(_0x2bf7('0x0'));module[_0x2bf7('0x1')]={'name':{'type':Sequelize[_0x2bf7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2bf7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2bf7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x12f9=['INTEGER','STRING','sequelize','exports'];(function(_0x590a42,_0x16f88f){var _0x429e13=function(_0x1aaeb2){while(--_0x1aaeb2){_0x590a42['push'](_0x590a42['shift']());}};_0x429e13(++_0x16f88f);}(_0x12f9,0xae));var _0x912f=function(_0xcef705,_0x3d5377){_0xcef705=_0xcef705-0x0;var _0x260917=_0x12f9[_0xcef705];return _0x260917;};'use strict';var Sequelize=require(_0x912f('0x0'));module[_0x912f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x912f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x912f('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 10c6c1f..8def59d 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x48fc39,_0x387dc6){var _0x16b2f7=function(_0x39b6a7){while(--_0x39b6a7){_0x48fc39['push'](_0x48fc39['shift']());}};_0x16b2f7(++_0x387dc6);}(_0x9582,0x95));var _0x2958=function(_0x14e7f7,_0xc433d8){_0x14e7f7=_0x14e7f7-0x0;var _0x467ebc=_0x9582[_0x14e7f7];return _0x467ebc;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0x9f0e=['../../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','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x14054a,_0x5184c1){_0x14054a=_0x14054a-0x0;var _0x54b4c5=_0x9f0e[_0x14054a];return _0x54b4c5;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3ab568f..ed766ae 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 _0xa7f2=['bluebird','request-promise','path','../../config/environment','exports','define','resourceId','lodash','util','api','moment'];(function(_0x6b3f9c,_0x433d66){var _0x4178e3=function(_0x13136f){while(--_0x13136f){_0x6b3f9c['push'](_0x6b3f9c['shift']());}};_0x4178e3(++_0x433d66);}(_0xa7f2,0x10f));var _0x2a7f=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0xa7f2[_0x2cd1e4];return _0x167374;};'use strict';var _=require(_0x2a7f('0x0'));var util=require(_0x2a7f('0x1'));var logger=require('../../config/logger')(_0x2a7f('0x2'));var moment=require(_0x2a7f('0x3'));var BPromise=require(_0x2a7f('0x4'));var rp=require(_0x2a7f('0x5'));var fs=require('fs');var path=require(_0x2a7f('0x6'));var rimraf=require('rimraf');var config=require(_0x2a7f('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x2a7f('0x8')]=function(_0x4bc1cb,_0xa85cdc){return _0x4bc1cb[_0x2a7f('0x9')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2a7f('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xee0e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','util'];(function(_0x5ac5b9,_0x2c05f7){var _0x98534c=function(_0x5487f6){while(--_0x5487f6){_0x5ac5b9['push'](_0x5ac5b9['shift']());}};_0x98534c(++_0x2c05f7);}(_0xee0e,0x8b));var _0xeee0=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xee0e[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require('lodash');var util=require(_0xeee0('0x0'));var logger=require(_0xeee0('0x1'))('api');var moment=require(_0xeee0('0x2'));var BPromise=require(_0xeee0('0x3'));var rp=require(_0xeee0('0x4'));var fs=require('fs');var path=require(_0xeee0('0x5'));var rimraf=require(_0xeee0('0x6'));var config=require(_0xeee0('0x7'));var attributes=require(_0xeee0('0x8'));module[_0xeee0('0x9')]=function(_0x2faad,_0x188f09){return _0x2faad['define'](_0xeee0('0xa'),attributes,{'tableName':_0xeee0('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xeee0('0xc'),_0xeee0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 538d1b1..411d25e 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 _0x786e=['jayson/promise','client','http','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52faff,_0x2b0983){var _0x359b95=function(_0x191e08){while(--_0x191e08){_0x52faff['push'](_0x52faff['shift']());}};_0x359b95(++_0x2b0983);}(_0x786e,0x14f));var _0xe786=function(_0x578a78,_0xfdd763){_0x578a78=_0x578a78-0x0;var _0x5b517b=_0x786e[_0x578a78];return _0x5b517b;};'use strict';var _=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var moment=require('moment');var BPromise=require(_0xe786('0x2'));var rs=require(_0xe786('0x3'));var fs=require('fs');var Redis=require(_0xe786('0x4'));var db=require(_0xe786('0x5'))['db'];var utils=require(_0xe786('0x6'));var logger=require(_0xe786('0x7'))(_0xe786('0x8'));var config=require(_0xe786('0x9'));var jayson=require(_0xe786('0xa'));var client=jayson[_0xe786('0xb')][_0xe786('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x173713,_0x5af29e,_0x48d846){return new BPromise(function(_0x2b777f,_0x94f7ce){return client['request'](_0x173713,_0x48d846)['then'](function(_0x14bfa4){logger[_0xe786('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x5af29e,_0xe786('0xe'));logger[_0xe786('0xf')](_0xe786('0x10'),_0x5af29e,_0xe786('0xe'),JSON['stringify'](_0x14bfa4));if(_0x14bfa4['error']){if(_0x14bfa4[_0xe786('0x11')][_0xe786('0x12')]===0x1f4){logger['error'](_0xe786('0x13'),_0x5af29e,_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);return _0x94f7ce(_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);}logger[_0xe786('0x11')](_0xe786('0x13'),_0x5af29e,_0x14bfa4[_0xe786('0x11')]['message']);return _0x2b777f(_0x14bfa4[_0xe786('0x11')][_0xe786('0x14')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5af29e,'request\x20sent');_0x2b777f(_0x14bfa4[_0xe786('0x15')][_0xe786('0x14')]);}})[_0xe786('0x16')](function(_0x39b127){logger[_0xe786('0x11')](_0xe786('0x13'),_0x5af29e,_0x39b127);_0x94f7ce(_0x39b127);});});} \ No newline at end of file +var _0x009d=['message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4d275c,_0x522396){var _0x55b75f=function(_0x47e6d3){while(--_0x47e6d3){_0x4d275c['push'](_0x4d275c['shift']());}};_0x55b75f(++_0x522396);}(_0x009d,0x193));var _0xd009=function(_0x31081c,_0x40d602){_0x31081c=_0x31081c-0x0;var _0x489471=_0x009d[_0x31081c];return _0x489471;};'use strict';var _=require(_0xd009('0x0'));var util=require('util');var moment=require(_0xd009('0x1'));var BPromise=require(_0xd009('0x2'));var rs=require(_0xd009('0x3'));var fs=require('fs');var Redis=require(_0xd009('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd009('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd009('0x6'));var jayson=require(_0xd009('0x7'));var client=jayson['client'][_0xd009('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa9fb43,_0x135618,_0x1ad229){return new BPromise(function(_0x54b5fc,_0x537fb4){return client[_0xd009('0x9')](_0xa9fb43,_0x1ad229)[_0xd009('0xa')](function(_0x39ecd2){logger['info'](_0xd009('0xb'),_0x135618,'request\x20sent');logger[_0xd009('0xc')](_0xd009('0xd'),_0x135618,_0xd009('0xe'),JSON['stringify'](_0x39ecd2));if(_0x39ecd2[_0xd009('0xf')]){if(_0x39ecd2['error'][_0xd009('0x10')]===0x1f4){logger['error'](_0xd009('0xb'),_0x135618,_0x39ecd2[_0xd009('0xf')]['message']);return _0x537fb4(_0x39ecd2[_0xd009('0xf')][_0xd009('0x11')]);}logger[_0xd009('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x135618,_0x39ecd2[_0xd009('0xf')]['message']);return _0x54b5fc(_0x39ecd2[_0xd009('0xf')][_0xd009('0x11')]);}else{logger[_0xd009('0x12')](_0xd009('0xb'),_0x135618,'request\x20sent');_0x54b5fc(_0x39ecd2['result'][_0xd009('0x11')]);}})[_0xd009('0x13')](function(_0x5b4335){logger['error'](_0xd009('0xb'),_0x135618,_0x5b4335);_0x537fb4(_0x5b4335);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7c2d7ac..30f2825 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 _0x6501=['connect-timeout','express','Router','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x28326c,_0x4ce18d){var _0x5b7724=function(_0x2c794f){while(--_0x2c794f){_0x28326c['push'](_0x28326c['shift']());}};_0x5b7724(++_0x4ce18d);}(_0x6501,0xdc));var _0x1650=function(_0x3de68c,_0x1904c0){_0x3de68c=_0x3de68c-0x0;var _0x7cf988=_0x6501[_0x3de68c];return _0x7cf988;};'use strict';var multer=require(_0x1650('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1650('0x1'));var express=require(_0x1650('0x2'));var router=express[_0x1650('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1650('0x4'));var controller=require(_0x1650('0x5'));router[_0x1650('0x6')]('/',auth[_0x1650('0x7')](),controller[_0x1650('0x8')]);router[_0x1650('0x6')](_0x1650('0x9'),auth[_0x1650('0x7')](),controller['describe']);router[_0x1650('0x6')](_0x1650('0xa'),auth[_0x1650('0x7')](),controller[_0x1650('0xb')]);router[_0x1650('0xc')]('/',auth['isAuthenticated'](),controller[_0x1650('0xd')]);router['put'](_0x1650('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1650('0xe')](_0x1650('0xa'),auth['isAuthenticated'](),controller[_0x1650('0xf')]);module[_0x1650('0x10')]=router; \ No newline at end of file +var _0xf304=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','create','/:id','update'];(function(_0x242b45,_0x28f0b8){var _0x21b76c=function(_0x16dacb){while(--_0x16dacb){_0x242b45['push'](_0x242b45['shift']());}};_0x21b76c(++_0x28f0b8);}(_0xf304,0xc8));var _0x4f30=function(_0x4819e1,_0x44d88e){_0x4819e1=_0x4819e1-0x0;var _0xca4f58=_0xf304[_0x4819e1];return _0xca4f58;};'use strict';var multer=require('multer');var util=require(_0x4f30('0x0'));var path=require(_0x4f30('0x1'));var timeout=require(_0x4f30('0x2'));var express=require(_0x4f30('0x3'));var router=express[_0x4f30('0x4')]();var fs_extra=require(_0x4f30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4f30('0x6'));var config=require(_0x4f30('0x7'));var controller=require('./userProfileSection.controller');router[_0x4f30('0x8')]('/',auth[_0x4f30('0x9')](),controller[_0x4f30('0xa')]);router['get']('/describe',auth[_0x4f30('0x9')](),controller[_0x4f30('0xb')]);router[_0x4f30('0x8')]('/:id',auth[_0x4f30('0x9')](),controller[_0x4f30('0xc')]);router['post']('/',auth[_0x4f30('0x9')](),controller[_0x4f30('0xd')]);router['put'](_0x4f30('0xe'),auth[_0x4f30('0x9')](),controller[_0x4f30('0xf')]);router[_0x4f30('0x10')](_0x4f30('0xe'),auth[_0x4f30('0x9')](),controller[_0x4f30('0x11')]);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 81107d6..78f93f9 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 _0x9354=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9354,0x96));var _0x4935=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9354[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4935('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4935('0x1')],'set':function(_0x5327fc){this[_0x4935('0x4')](_0x4935('0x5'),_0x5327fc?_0x5327fc[_0x4935('0x6')](''):[]);},'get':function(){return this[_0x4935('0x7')](_0x4935('0x5'))?this[_0x4935('0x7')](_0x4935('0x5'))[_0x4935('0x8')](''):[];}}}; \ No newline at end of file +var _0x0102=['exports','STRING','INTEGER','crudPermissions','join','getDataValue'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x0102,0x186));var _0x2010=function(_0x56fed5,_0x181cd1){_0x56fed5=_0x56fed5-0x0;var _0x5685fe=_0x0102[_0x56fed5];return _0x5685fe;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'name':{'type':Sequelize[_0x2010('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2010('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2010('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4e30b3){this['setDataValue'](_0x2010('0x3'),_0x4e30b3?_0x4e30b3[_0x2010('0x4')](''):[]);},'get':function(){return this[_0x2010('0x5')](_0x2010('0x3'))?this['getDataValue'](_0x2010('0x3'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b8eecc9..3f3977d 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 _0xea70=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','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','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','filter','UserProfileSection','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x427105,_0x5b5d30){var _0x550f4a=function(_0x59682a){while(--_0x59682a){_0x427105['push'](_0x427105['shift']());}};_0x550f4a(++_0x5b5d30);}(_0xea70,0xec));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x0ea7('0x0'));var rimraf=require(_0x0ea7('0x1'));var zipdir=require(_0x0ea7('0x2'));var jsonpatch=require(_0x0ea7('0x3'));var rp=require(_0x0ea7('0x4'));var moment=require(_0x0ea7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ea7('0x6'));var util=require(_0x0ea7('0x7'));var path=require(_0x0ea7('0x8'));var sox=require(_0x0ea7('0x9'));var csv=require(_0x0ea7('0xa'));var ejs=require(_0x0ea7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ea7('0xc'));var squel=require('squel');var crypto=require(_0x0ea7('0xd'));var jsforce=require(_0x0ea7('0xe'));var deskjs=require(_0x0ea7('0xf'));var toCsv=require(_0x0ea7('0xa'));var querystring=require(_0x0ea7('0x10'));var Papa=require(_0x0ea7('0x11'));var Redis=require(_0x0ea7('0x12'));var authService=require(_0x0ea7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ea7('0x14'));var hardwareService=require(_0x0ea7('0x15'));var logger=require(_0x0ea7('0x16'))('api');var utils=require(_0x0ea7('0x17'));var config=require(_0x0ea7('0x18'));var licenseUtil=require(_0x0ea7('0x19'));var db=require(_0x0ea7('0x1a'))['db'];function respondWithStatusCode(_0x2efd3b,_0x4be1ce){_0x4be1ce=_0x4be1ce||0xcc;return function(_0x50a80c){if(_0x50a80c){return _0x2efd3b['sendStatus'](_0x4be1ce);}return _0x2efd3b[_0x0ea7('0x1b')](_0x4be1ce)[_0x0ea7('0x1c')]();};}function respondWithResult(_0x1275d8,_0x29016c){_0x29016c=_0x29016c||0xc8;return function(_0x2ef04d){if(_0x2ef04d){return _0x1275d8[_0x0ea7('0x1b')](_0x29016c)[_0x0ea7('0x1d')](_0x2ef04d);}};}function respondWithFilteredResult(_0xa5cbb2,_0x1abda6){return function(_0x5e419a){if(_0x5e419a){var _0x234a66=typeof _0x1abda6[_0x0ea7('0x1e')]===_0x0ea7('0x1f')&&typeof _0x1abda6['limit']==='undefined';var _0x421ccc=_0x5e419a[_0x0ea7('0x20')];var _0x122c73=_0x234a66?0x0:_0x1abda6[_0x0ea7('0x1e')];var _0x218820=_0x234a66?_0x5e419a[_0x0ea7('0x20')]:_0x1abda6[_0x0ea7('0x1e')]+_0x1abda6['limit'];var _0x4ae912;if(_0x218820>=_0x421ccc){_0x218820=_0x421ccc;_0x4ae912=0xc8;}else{_0x4ae912=0xce;}_0xa5cbb2['status'](_0x4ae912);return _0xa5cbb2[_0x0ea7('0x21')](_0x0ea7('0x22'),_0x122c73+'-'+_0x218820+'/'+_0x421ccc)['json'](_0x5e419a);}return null;};}function patchUpdates(_0x483567){return function(_0x5c0299){try{jsonpatch[_0x0ea7('0x23')](_0x5c0299,_0x483567,!![]);}catch(_0x384789){return BPromise[_0x0ea7('0x24')](_0x384789);}return _0x5c0299[_0x0ea7('0x25')]();};}function saveUpdates(_0xf21d87,_0x3298b2){return function(_0x202535){if(_0x202535){return _0x202535[_0x0ea7('0x26')](_0xf21d87)[_0x0ea7('0x27')](function(_0x48289b){return _0x48289b;});}return null;};}function removeEntity(_0x22965d,_0x32b0fe){return function(_0x4ce424){if(_0x4ce424){return _0x4ce424[_0x0ea7('0x28')]()[_0x0ea7('0x27')](function(){_0x22965d[_0x0ea7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5268b4,_0x2323d6){return function(_0x4ca4f0){if(!_0x4ca4f0){_0x5268b4['sendStatus'](0x194);}return _0x4ca4f0;};}function handleError(_0xf15560,_0x378634){_0x378634=_0x378634||0x1f4;return function(_0x51f210){logger[_0x0ea7('0x29')](_0x51f210[_0x0ea7('0x2a')]);if(_0x51f210['name']){delete _0x51f210['name'];}_0xf15560[_0x0ea7('0x1b')](_0x378634)[_0x0ea7('0x2b')](_0x51f210);};}exports[_0x0ea7('0x2c')]=function(_0xf32e8b,_0x26d531){var _0x483c75={},_0x215ff3={},_0x8ebc0b={'count':0x0,'rows':[]};var _0x476e09=_['map'](db['UserProfileSection'][_0x0ea7('0x2d')],function(_0x49208f){return{'name':_0x49208f[_0x0ea7('0x2e')],'type':_0x49208f['type'][_0x0ea7('0x2f')]};});_0x215ff3[_0x0ea7('0x30')]=_[_0x0ea7('0x31')](_0x476e09,_0x0ea7('0x32'));_0x215ff3['query']=_[_0x0ea7('0x33')](_0xf32e8b[_0x0ea7('0x34')]);_0x215ff3[_0x0ea7('0x35')]=_[_0x0ea7('0x36')](_0x215ff3['model'],_0x215ff3['query']);_0x483c75[_0x0ea7('0x37')]=_[_0x0ea7('0x36')](_0x215ff3['model'],qs['fields'](_0xf32e8b['query'][_0x0ea7('0x38')]));_0x483c75[_0x0ea7('0x37')]=_0x483c75[_0x0ea7('0x37')][_0x0ea7('0x39')]?_0x483c75['attributes']:_0x215ff3[_0x0ea7('0x30')];if(!_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3a')](_0x0ea7('0x3b'))){_0x483c75[_0x0ea7('0x3c')]=qs[_0x0ea7('0x3c')](_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3c')]);_0x483c75[_0x0ea7('0x1e')]=qs[_0x0ea7('0x1e')](_0xf32e8b[_0x0ea7('0x34')]['offset']);}_0x483c75[_0x0ea7('0x3d')]=qs[_0x0ea7('0x3e')](_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x3e')]);_0x483c75['where']=qs[_0x0ea7('0x35')](_[_0x0ea7('0x3f')](_0xf32e8b['query'],_0x215ff3['filters']),_0x476e09);if(_0xf32e8b['query']['filter']){_0x483c75[_0x0ea7('0x40')]=_[_0x0ea7('0x41')](_0x483c75[_0x0ea7('0x40')],{'$or':_[_0x0ea7('0x31')](_0x476e09,function(_0x4340db){if(_0x4340db[_0x0ea7('0x42')]!=='VIRTUAL'){var _0x18fb24={};_0x18fb24[_0x4340db[_0x0ea7('0x32')]]={'$like':'%'+_0xf32e8b[_0x0ea7('0x34')][_0x0ea7('0x43')]+'%'};return _0x18fb24;}})});}_0x483c75=_[_0x0ea7('0x41')]({},_0x483c75,_0xf32e8b['options']);var _0x15f8f6={'where':_0x483c75[_0x0ea7('0x40')]};return db[_0x0ea7('0x44')][_0x0ea7('0x20')](_0x15f8f6)[_0x0ea7('0x27')](function(_0x18e1e0){_0x8ebc0b[_0x0ea7('0x20')]=_0x18e1e0;if(_0xf32e8b['query'][_0x0ea7('0x45')]){_0x483c75[_0x0ea7('0x46')]=[{'all':!![]}];}return db[_0x0ea7('0x44')]['findAll'](_0x483c75);})[_0x0ea7('0x27')](function(_0x3b3a5d){_0x8ebc0b[_0x0ea7('0x47')]=_0x3b3a5d;return _0x8ebc0b;})[_0x0ea7('0x27')](respondWithFilteredResult(_0x26d531,_0x483c75))[_0x0ea7('0x48')](handleError(_0x26d531,null));};exports[_0x0ea7('0x49')]=function(_0x5a26f3,_0x2b2fd6){var _0x13fff1={'raw':![],'where':{'id':_0x5a26f3[_0x0ea7('0x4a')]['id']}},_0x20c7f2={};_0x20c7f2[_0x0ea7('0x30')]=_[_0x0ea7('0x33')](db['UserProfileSection']['rawAttributes']);_0x20c7f2['query']=_[_0x0ea7('0x33')](_0x5a26f3['query']);_0x20c7f2[_0x0ea7('0x35')]=_[_0x0ea7('0x36')](_0x20c7f2[_0x0ea7('0x30')],_0x20c7f2[_0x0ea7('0x34')]);_0x13fff1[_0x0ea7('0x37')]=_['intersection'](_0x20c7f2[_0x0ea7('0x30')],qs[_0x0ea7('0x38')](_0x5a26f3[_0x0ea7('0x34')][_0x0ea7('0x38')]));_0x13fff1[_0x0ea7('0x37')]=_0x13fff1[_0x0ea7('0x37')][_0x0ea7('0x39')]?_0x13fff1[_0x0ea7('0x37')]:_0x20c7f2[_0x0ea7('0x30')];if(_0x5a26f3['query'][_0x0ea7('0x45')]){_0x13fff1[_0x0ea7('0x46')]=[{'all':!![]}];}_0x13fff1=_[_0x0ea7('0x41')]({},_0x13fff1,_0x5a26f3[_0x0ea7('0x4b')]);return db[_0x0ea7('0x44')][_0x0ea7('0x4c')](_0x13fff1)[_0x0ea7('0x27')](handleEntityNotFound(_0x2b2fd6,null))[_0x0ea7('0x27')](respondWithResult(_0x2b2fd6,null))[_0x0ea7('0x48')](handleError(_0x2b2fd6,null));};exports[_0x0ea7('0x4d')]=function(_0xa11fed,_0x4eed88){return db[_0x0ea7('0x44')][_0x0ea7('0x4d')](_0xa11fed[_0x0ea7('0x4e')],{})[_0x0ea7('0x27')](respondWithResult(_0x4eed88,0xc9))[_0x0ea7('0x48')](handleError(_0x4eed88,null));};exports[_0x0ea7('0x26')]=function(_0x56e758,_0x3920be){if(_0x56e758[_0x0ea7('0x4e')]['id']){delete _0x56e758['body']['id'];}return db['UserProfileSection'][_0x0ea7('0x4c')]({'where':{'id':_0x56e758[_0x0ea7('0x4a')]['id']}})[_0x0ea7('0x27')](handleEntityNotFound(_0x3920be,null))[_0x0ea7('0x27')](saveUpdates(_0x56e758['body'],null))[_0x0ea7('0x27')](respondWithResult(_0x3920be,null))['catch'](handleError(_0x3920be,null));};exports[_0x0ea7('0x28')]=function(_0x5afd71,_0x5a8cef){return db['UserProfileSection'][_0x0ea7('0x4c')]({'where':{'id':_0x5afd71[_0x0ea7('0x4a')]['id']}})[_0x0ea7('0x27')](handleEntityNotFound(_0x5a8cef,null))[_0x0ea7('0x27')](removeEntity(_0x5a8cef,null))['catch'](handleError(_0x5a8cef,null));};exports[_0x0ea7('0x4f')]=function(_0x24a5ab,_0x176b6f){return db[_0x0ea7('0x44')][_0x0ea7('0x4f')]()[_0x0ea7('0x27')](respondWithResult(_0x176b6f,null))['catch'](handleError(_0x176b6f,null));}; \ No newline at end of file +var _0x3d82=['offset','Content-Range','apply','reject','update','destroy','then','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','findAll','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x1bd985,_0x4e3b7d){var _0x52df6a=function(_0x178ad0){while(--_0x178ad0){_0x1bd985['push'](_0x1bd985['shift']());}};_0x52df6a(++_0x4e3b7d);}(_0x3d82,0x6a));var _0x23d8=function(_0x5b8f71,_0x4495f6){_0x5b8f71=_0x5b8f71-0x0;var _0x36fc41=_0x3d82[_0x5b8f71];return _0x36fc41;};'use strict';var emlformat=require(_0x23d8('0x0'));var rimraf=require(_0x23d8('0x1'));var zipdir=require(_0x23d8('0x2'));var jsonpatch=require(_0x23d8('0x3'));var rp=require('request-promise');var moment=require(_0x23d8('0x4'));var BPromise=require(_0x23d8('0x5'));var Mustache=require(_0x23d8('0x6'));var util=require(_0x23d8('0x7'));var path=require(_0x23d8('0x8'));var sox=require('sox');var csv=require(_0x23d8('0x9'));var ejs=require(_0x23d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23d8('0xb'));var squel=require(_0x23d8('0xc'));var crypto=require(_0x23d8('0xd'));var jsforce=require(_0x23d8('0xe'));var deskjs=require(_0x23d8('0xf'));var toCsv=require(_0x23d8('0x9'));var querystring=require(_0x23d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x23d8('0x11'));var as=require(_0x23d8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x23d8('0x13'));var utils=require(_0x23d8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x23d8('0x15'));var db=require(_0x23d8('0x16'))['db'];function respondWithStatusCode(_0x1981ca,_0x43f7ff){_0x43f7ff=_0x43f7ff||0xcc;return function(_0x5b5d69){if(_0x5b5d69){return _0x1981ca[_0x23d8('0x17')](_0x43f7ff);}return _0x1981ca[_0x23d8('0x18')](_0x43f7ff)[_0x23d8('0x19')]();};}function respondWithResult(_0x1a0bfe,_0x1b1dd1){_0x1b1dd1=_0x1b1dd1||0xc8;return function(_0x2839c2){if(_0x2839c2){return _0x1a0bfe[_0x23d8('0x18')](_0x1b1dd1)[_0x23d8('0x1a')](_0x2839c2);}};}function respondWithFilteredResult(_0x55de22,_0x2dcb3d){return function(_0x569678){if(_0x569678){var _0x5d75c2=typeof _0x2dcb3d['offset']===_0x23d8('0x1b')&&typeof _0x2dcb3d[_0x23d8('0x1c')]===_0x23d8('0x1b');var _0x4a73d2=_0x569678[_0x23d8('0x1d')];var _0x24b744=_0x5d75c2?0x0:_0x2dcb3d[_0x23d8('0x1e')];var _0x560144=_0x5d75c2?_0x569678[_0x23d8('0x1d')]:_0x2dcb3d[_0x23d8('0x1e')]+_0x2dcb3d['limit'];var _0x71a62d;if(_0x560144>=_0x4a73d2){_0x560144=_0x4a73d2;_0x71a62d=0xc8;}else{_0x71a62d=0xce;}_0x55de22['status'](_0x71a62d);return _0x55de22['set'](_0x23d8('0x1f'),_0x24b744+'-'+_0x560144+'/'+_0x4a73d2)['json'](_0x569678);}return null;};}function patchUpdates(_0x349589){return function(_0x33bec1){try{jsonpatch[_0x23d8('0x20')](_0x33bec1,_0x349589,!![]);}catch(_0x408811){return BPromise[_0x23d8('0x21')](_0x408811);}return _0x33bec1['save']();};}function saveUpdates(_0x451a48,_0x25efde){return function(_0x598afd){if(_0x598afd){return _0x598afd[_0x23d8('0x22')](_0x451a48)['then'](function(_0x5e3991){return _0x5e3991;});}return null;};}function removeEntity(_0x5b9af3,_0xf6c1b4){return function(_0x443819){if(_0x443819){return _0x443819[_0x23d8('0x23')]()[_0x23d8('0x24')](function(){_0x5b9af3[_0x23d8('0x18')](0xcc)[_0x23d8('0x19')]();});}};}function handleEntityNotFound(_0x2fd790,_0x263187){return function(_0x56d660){if(!_0x56d660){_0x2fd790[_0x23d8('0x17')](0x194);}return _0x56d660;};}function handleError(_0x1abaed,_0x140e10){_0x140e10=_0x140e10||0x1f4;return function(_0x5c99bd){logger['error'](_0x5c99bd['stack']);if(_0x5c99bd[_0x23d8('0x25')]){delete _0x5c99bd[_0x23d8('0x25')];}_0x1abaed[_0x23d8('0x18')](_0x140e10)[_0x23d8('0x26')](_0x5c99bd);};}exports['index']=function(_0x43a103,_0x5b99bf){var _0x1d7ddd={},_0x2b469d={},_0x82cbb={'count':0x0,'rows':[]};var _0x25c44c=_[_0x23d8('0x27')](db[_0x23d8('0x28')][_0x23d8('0x29')],function(_0x5e2765){return{'name':_0x5e2765[_0x23d8('0x2a')],'type':_0x5e2765[_0x23d8('0x2b')][_0x23d8('0x2c')]};});_0x2b469d[_0x23d8('0x2d')]=_['map'](_0x25c44c,_0x23d8('0x25'));_0x2b469d[_0x23d8('0x2e')]=_['keys'](_0x43a103[_0x23d8('0x2e')]);_0x2b469d[_0x23d8('0x2f')]=_['intersection'](_0x2b469d[_0x23d8('0x2d')],_0x2b469d[_0x23d8('0x2e')]);_0x1d7ddd[_0x23d8('0x30')]=_[_0x23d8('0x31')](_0x2b469d[_0x23d8('0x2d')],qs['fields'](_0x43a103['query'][_0x23d8('0x32')]));_0x1d7ddd[_0x23d8('0x30')]=_0x1d7ddd[_0x23d8('0x30')][_0x23d8('0x33')]?_0x1d7ddd[_0x23d8('0x30')]:_0x2b469d[_0x23d8('0x2d')];if(!_0x43a103[_0x23d8('0x2e')][_0x23d8('0x34')](_0x23d8('0x35'))){_0x1d7ddd[_0x23d8('0x1c')]=qs[_0x23d8('0x1c')](_0x43a103[_0x23d8('0x2e')][_0x23d8('0x1c')]);_0x1d7ddd[_0x23d8('0x1e')]=qs[_0x23d8('0x1e')](_0x43a103[_0x23d8('0x2e')]['offset']);}_0x1d7ddd['order']=qs['sort'](_0x43a103['query'][_0x23d8('0x36')]);_0x1d7ddd[_0x23d8('0x37')]=qs[_0x23d8('0x2f')](_['pick'](_0x43a103['query'],_0x2b469d[_0x23d8('0x2f')]),_0x25c44c);if(_0x43a103[_0x23d8('0x2e')][_0x23d8('0x38')]){_0x1d7ddd[_0x23d8('0x37')]=_[_0x23d8('0x39')](_0x1d7ddd[_0x23d8('0x37')],{'$or':_[_0x23d8('0x27')](_0x25c44c,function(_0xacca9f){if(_0xacca9f[_0x23d8('0x2b')]!=='VIRTUAL'){var _0x89f0a7={};_0x89f0a7[_0xacca9f[_0x23d8('0x25')]]={'$like':'%'+_0x43a103[_0x23d8('0x2e')][_0x23d8('0x38')]+'%'};return _0x89f0a7;}})});}_0x1d7ddd=_[_0x23d8('0x39')]({},_0x1d7ddd,_0x43a103[_0x23d8('0x3a')]);var _0x533493={'where':_0x1d7ddd[_0x23d8('0x37')]};return db[_0x23d8('0x28')][_0x23d8('0x1d')](_0x533493)[_0x23d8('0x24')](function(_0x553903){_0x82cbb[_0x23d8('0x1d')]=_0x553903;if(_0x43a103[_0x23d8('0x2e')]['includeAll']){_0x1d7ddd['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x23d8('0x3b')](_0x1d7ddd);})[_0x23d8('0x24')](function(_0x3cbb7c){_0x82cbb['rows']=_0x3cbb7c;return _0x82cbb;})[_0x23d8('0x24')](respondWithFilteredResult(_0x5b99bf,_0x1d7ddd))[_0x23d8('0x3c')](handleError(_0x5b99bf,null));};exports[_0x23d8('0x3d')]=function(_0x5d34af,_0xa3b16c){var _0x2a20a0={'raw':![],'where':{'id':_0x5d34af[_0x23d8('0x3e')]['id']}},_0x8b7e18={};_0x8b7e18[_0x23d8('0x2d')]=_[_0x23d8('0x3f')](db[_0x23d8('0x28')][_0x23d8('0x29')]);_0x8b7e18[_0x23d8('0x2e')]=_[_0x23d8('0x3f')](_0x5d34af['query']);_0x8b7e18[_0x23d8('0x2f')]=_['intersection'](_0x8b7e18['model'],_0x8b7e18[_0x23d8('0x2e')]);_0x2a20a0['attributes']=_[_0x23d8('0x31')](_0x8b7e18[_0x23d8('0x2d')],qs[_0x23d8('0x32')](_0x5d34af['query']['fields']));_0x2a20a0['attributes']=_0x2a20a0[_0x23d8('0x30')][_0x23d8('0x33')]?_0x2a20a0[_0x23d8('0x30')]:_0x8b7e18['model'];if(_0x5d34af['query']['includeAll']){_0x2a20a0[_0x23d8('0x40')]=[{'all':!![]}];}_0x2a20a0=_['merge']({},_0x2a20a0,_0x5d34af[_0x23d8('0x3a')]);return db[_0x23d8('0x28')][_0x23d8('0x41')](_0x2a20a0)['then'](handleEntityNotFound(_0xa3b16c,null))[_0x23d8('0x24')](respondWithResult(_0xa3b16c,null))[_0x23d8('0x3c')](handleError(_0xa3b16c,null));};exports[_0x23d8('0x42')]=function(_0xca170c,_0x503ff4){return db['UserProfileSection'][_0x23d8('0x42')](_0xca170c[_0x23d8('0x43')],{})[_0x23d8('0x24')](respondWithResult(_0x503ff4,0xc9))[_0x23d8('0x3c')](handleError(_0x503ff4,null));};exports[_0x23d8('0x22')]=function(_0x3f1987,_0x2ae118){if(_0x3f1987[_0x23d8('0x43')]['id']){delete _0x3f1987['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x3f1987[_0x23d8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2ae118,null))[_0x23d8('0x24')](saveUpdates(_0x3f1987[_0x23d8('0x43')],null))[_0x23d8('0x24')](respondWithResult(_0x2ae118,null))[_0x23d8('0x3c')](handleError(_0x2ae118,null));};exports['destroy']=function(_0xa0198c,_0x2317b4){return db[_0x23d8('0x28')][_0x23d8('0x41')]({'where':{'id':_0xa0198c['params']['id']}})[_0x23d8('0x24')](handleEntityNotFound(_0x2317b4,null))[_0x23d8('0x24')](removeEntity(_0x2317b4,null))[_0x23d8('0x3c')](handleError(_0x2317b4,null));};exports['describe']=function(_0x12e944,_0x44ed62){return db[_0x23d8('0x28')]['describe']()[_0x23d8('0x24')](respondWithResult(_0x44ed62,null))['catch'](handleError(_0x44ed62,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0c4c0d6..d77df43 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 _0xfdb4=['path','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xfdb4,0x133));var _0x4fdb=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xfdb4[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x4fdb('0x0'));var util=require('util');var logger=require(_0x4fdb('0x1'))('api');var moment=require(_0x4fdb('0x2'));var BPromise=require(_0x4fdb('0x3'));var rp=require(_0x4fdb('0x4'));var fs=require('fs');var path=require(_0x4fdb('0x5'));var rimraf=require('rimraf');var config=require(_0x4fdb('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x4fdb('0x7')]=function(_0x468520,_0x3d0815){return _0x468520[_0x4fdb('0x8')](_0x4fdb('0x9'),attributes,{'tableName':_0x4fdb('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x4fdb('0xb'),_0x4fdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfdd=['../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x309b10,_0x46fca9){var _0x47ac21=function(_0x2ecb81){while(--_0x2ecb81){_0x309b10['push'](_0x309b10['shift']());}};_0x47ac21(++_0x46fca9);}(_0xdfdd,0x104));var _0xddfd=function(_0x4747f7,_0x421c28){_0x4747f7=_0x4747f7-0x0;var _0x3e0711=_0xdfdd[_0x4747f7];return _0x3e0711;};'use strict';var _=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var logger=require(_0xddfd('0x2'))(_0xddfd('0x3'));var moment=require('moment');var BPromise=require(_0xddfd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddfd('0x5'));var rimraf=require('rimraf');var config=require(_0xddfd('0x6'));var attributes=require(_0xddfd('0x7'));module[_0xddfd('0x8')]=function(_0x2c0d38,_0x48546c){return _0x2c0d38[_0xddfd('0x9')]('UserProfileSection',attributes,{'tableName':_0xddfd('0xa'),'paranoid':![],'indexes':[{'name':_0xddfd('0xb'),'fields':[_0xddfd('0xc'),_0xddfd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 2212bfb..f900c7a 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 _0xd8fb=['info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x119e4a,_0x1c87aa){var _0xe18cb0=function(_0x4685f9){while(--_0x4685f9){_0x119e4a['push'](_0x119e4a['shift']());}};_0xe18cb0(++_0x1c87aa);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4ea7bf,_0x30a8f9){_0x4ea7bf=_0x4ea7bf-0x0;var _0x3f5afc=_0xd8fb[_0x4ea7bf];return _0x3f5afc;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file +var _0xc1b0=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1be6b2,_0x86c762){var _0x63fedd=function(_0x1adccd){while(--_0x1adccd){_0x1be6b2['push'](_0x1be6b2['shift']());}};_0x63fedd(++_0x86c762);}(_0xc1b0,0x178));var _0x0c1b=function(_0x51bc84,_0x519320){_0x51bc84=_0x51bc84-0x0;var _0x3a953e=_0xc1b0[_0x51bc84];return _0x3a953e;};'use strict';var _=require('lodash');var util=require(_0x0c1b('0x0'));var moment=require(_0x0c1b('0x1'));var BPromise=require(_0x0c1b('0x2'));var rs=require(_0x0c1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c1b('0x4'))['db'];var utils=require(_0x0c1b('0x5'));var logger=require(_0x0c1b('0x6'))('rpc');var config=require(_0x0c1b('0x7'));var jayson=require(_0x0c1b('0x8'));var client=jayson[_0x0c1b('0x9')][_0x0c1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc804c,_0x3eaa77,_0x5c530a){return new BPromise(function(_0x45e93f,_0x16aa38){return client['request'](_0xfc804c,_0x5c530a)[_0x0c1b('0xb')](function(_0x52aad4){logger[_0x0c1b('0xc')](_0x0c1b('0xd'),_0x3eaa77,_0x0c1b('0xe'));logger['debug'](_0x0c1b('0xf'),_0x3eaa77,_0x0c1b('0xe'),JSON[_0x0c1b('0x10')](_0x52aad4));if(_0x52aad4['error']){if(_0x52aad4['error'][_0x0c1b('0x11')]===0x1f4){logger[_0x0c1b('0x12')](_0x0c1b('0xd'),_0x3eaa77,_0x52aad4[_0x0c1b('0x12')]['message']);return _0x16aa38(_0x52aad4['error'][_0x0c1b('0x13')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x3eaa77,_0x52aad4['error'][_0x0c1b('0x13')]);return _0x45e93f(_0x52aad4[_0x0c1b('0x12')][_0x0c1b('0x13')]);}else{logger['info'](_0x0c1b('0xd'),_0x3eaa77,_0x0c1b('0xe'));_0x45e93f(_0x52aad4[_0x0c1b('0x14')][_0x0c1b('0x13')]);}})[_0x0c1b('0x15')](function(_0xb03fed){logger['error'](_0x0c1b('0xd'),_0x3eaa77,_0xb03fed);_0x16aa38(_0xb03fed);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 37f16e2..820b728 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b662d,_0x5b8058){var _0x3b9fd4=function(_0x326ed9){while(--_0x326ed9){_0x4b662d['push'](_0x4b662d['shift']());}};_0x3b9fd4(++_0x5b8058);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2b12a8,_0x52f321){var _0xd38ecc=function(_0x185d87){while(--_0x185d87){_0x2b12a8['push'](_0x2b12a8['shift']());}};_0xd38ecc(++_0x52f321);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e6dd2c0..c27864a 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 _0xcf05=['sequelize'];(function(_0x586c3d,_0x2cc7bf){var _0x2243c4=function(_0x1aed6c){while(--_0x1aed6c){_0x586c3d['push'](_0x586c3d['shift']());}};_0x2243c4(++_0x2cc7bf);}(_0xcf05,0xf6));var _0x5cf0=function(_0x313fbb,_0x2baf87){_0x313fbb=_0x313fbb-0x0;var _0x58cfbf=_0xcf05[_0x313fbb];return _0x58cfbf;};'use strict';var Sequelize=require(_0x5cf0('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb879=['INTEGER'];(function(_0x44c742,_0x5d69a4){var _0x40fcf0=function(_0x453d3c){while(--_0x453d3c){_0x44c742['push'](_0x44c742['shift']());}};_0x40fcf0(++_0x5d69a4);}(_0xb879,0x15d));var _0x9b87=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb879[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9b87('0x0')],'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 5807d47..31a17d3 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 _0x6c45=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird'];(function(_0x309ee3,_0x26c85f){var _0x2268e0=function(_0x330f5c){while(--_0x330f5c){_0x309ee3['push'](_0x309ee3['shift']());}};_0x2268e0(++_0x26c85f);}(_0x6c45,0xb1));var _0x56c4=function(_0x3e560b,_0x3933a9){_0x3e560b=_0x3e560b-0x0;var _0x448238=_0x6c45[_0x3e560b];return _0x448238;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var logger=require('../../config/logger')(_0x56c4('0x2'));var moment=require(_0x56c4('0x3'));var BPromise=require(_0x56c4('0x4'));var rp=require(_0x56c4('0x5'));var fs=require('fs');var path=require(_0x56c4('0x6'));var rimraf=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var attributes=require(_0x56c4('0x9'));module[_0x56c4('0xa')]=function(_0x3cc49e,_0x1fcb9e){return _0x3cc49e[_0x56c4('0xb')](_0x56c4('0xc'),attributes,{'tableName':_0x56c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xafc4,0x69));var _0x4afc=function(_0x1291cf,_0x765ae8){_0x1291cf=_0x1291cf-0x0;var _0x4dcf87=_0xafc4[_0x1291cf];return _0x4dcf87;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('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 f4a2fd4..7d1e20e 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 _0x51e6=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x12fb86,_0x86a352){var _0x533854=function(_0x416e79){while(--_0x416e79){_0x12fb86['push'](_0x12fb86['shift']());}};_0x533854(++_0x86a352);}(_0x51e6,0x1eb));var _0x651e=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x51e6[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require(_0x651e('0x0'));var moment=require(_0x651e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x651e('0x2'));var db=require(_0x651e('0x3'))['db'];var utils=require(_0x651e('0x4'));var logger=require(_0x651e('0x5'))(_0x651e('0x6'));var config=require(_0x651e('0x7'));var jayson=require(_0x651e('0x8'));var client=jayson[_0x651e('0x9')][_0x651e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c15a3,_0x1d8520,_0x1032a3){return new BPromise(function(_0x167b5d,_0x56eff0){return client['request'](_0x1c15a3,_0x1032a3)[_0x651e('0xb')](function(_0x3a6cc4){logger[_0x651e('0xc')](_0x651e('0xd'),_0x1d8520,_0x651e('0xe'));logger[_0x651e('0xf')](_0x651e('0x10'),_0x1d8520,_0x651e('0xe'),JSON[_0x651e('0x11')](_0x3a6cc4));if(_0x3a6cc4[_0x651e('0x12')]){if(_0x3a6cc4[_0x651e('0x12')][_0x651e('0x13')]===0x1f4){logger[_0x651e('0x12')](_0x651e('0xd'),_0x1d8520,_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);return _0x56eff0(_0x3a6cc4[_0x651e('0x12')]['message']);}logger[_0x651e('0x12')](_0x651e('0xd'),_0x1d8520,_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);return _0x167b5d(_0x3a6cc4[_0x651e('0x12')][_0x651e('0x14')]);}else{logger[_0x651e('0xc')](_0x651e('0xd'),_0x1d8520,_0x651e('0xe'));_0x167b5d(_0x3a6cc4['result'][_0x651e('0x14')]);}})[_0x651e('0x15')](function(_0x29dd14){logger[_0x651e('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x1d8520,_0x29dd14);_0x56eff0(_0x29dd14);});});} \ No newline at end of file +var _0x87c0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x311774,_0x2ea56b){var _0x4582a4=function(_0x175cb6){while(--_0x175cb6){_0x311774['push'](_0x311774['shift']());}};_0x4582a4(++_0x2ea56b);}(_0x87c0,0x147));var _0x087c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x87c0[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x087c('0x0'));var util=require('util');var moment=require(_0x087c('0x1'));var BPromise=require(_0x087c('0x2'));var rs=require(_0x087c('0x3'));var fs=require('fs');var Redis=require(_0x087c('0x4'));var db=require(_0x087c('0x5'))['db'];var utils=require(_0x087c('0x6'));var logger=require(_0x087c('0x7'))(_0x087c('0x8'));var config=require(_0x087c('0x9'));var jayson=require(_0x087c('0xa'));var client=jayson[_0x087c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b330d,_0x3eadfa,_0x293d31){return new BPromise(function(_0x34bd5d,_0x3a6d3b){return client['request'](_0x2b330d,_0x293d31)[_0x087c('0xc')](function(_0x276db0){logger[_0x087c('0xd')](_0x087c('0xe'),_0x3eadfa,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3eadfa,_0x087c('0xf'),JSON[_0x087c('0x10')](_0x276db0));if(_0x276db0[_0x087c('0x11')]){if(_0x276db0[_0x087c('0x11')][_0x087c('0x12')]===0x1f4){logger[_0x087c('0x11')](_0x087c('0xe'),_0x3eadfa,_0x276db0[_0x087c('0x11')][_0x087c('0x13')]);return _0x3a6d3b(_0x276db0[_0x087c('0x11')]['message']);}logger[_0x087c('0x11')](_0x087c('0xe'),_0x3eadfa,_0x276db0[_0x087c('0x11')][_0x087c('0x13')]);return _0x34bd5d(_0x276db0[_0x087c('0x11')][_0x087c('0x13')]);}else{logger[_0x087c('0xd')](_0x087c('0xe'),_0x3eadfa,_0x087c('0xf'));_0x34bd5d(_0x276db0[_0x087c('0x14')][_0x087c('0x13')]);}})[_0x087c('0x15')](function(_0x572568){logger[_0x087c('0x11')](_0x087c('0xe'),_0x3eadfa,_0x572568);_0x3a6d3b(_0x572568);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index adfc9ed..563208c 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1447=['INTEGER','sequelize','exports'];(function(_0x105a68,_0x5bc4d8){var _0x4544e4=function(_0x58a1c4){while(--_0x58a1c4){_0x105a68['push'](_0x105a68['shift']());}};_0x4544e4(++_0x5bc4d8);}(_0x1447,0x175));var _0x7144=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1447[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7144('0x0'));module[_0x7144('0x1')]={'UserId':{'type':Sequelize[_0x7144('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc71e=['sequelize','exports','INTEGER'];(function(_0x3802f3,_0x4364e7){var _0x212c72=function(_0x1190bf){while(--_0x1190bf){_0x3802f3['push'](_0x3802f3['shift']());}};_0x212c72(++_0x4364e7);}(_0xc71e,0xdb));var _0xec71=function(_0x22ac16,_0x1481f7){_0x22ac16=_0x22ac16-0x0;var _0x204bce=_0xc71e[_0x22ac16];return _0x204bce;};'use strict';var Sequelize=require(_0xec71('0x0'));module[_0xec71('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xec71('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1141f5e..585204d 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x6a8802,_0xd63283){var _0x502fd0=function(_0x3cb8a){while(--_0x3cb8a){_0x6a8802['push'](_0x6a8802['shift']());}};_0x502fd0(++_0xd63283);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1985d5,_0x460dca){var _0x4d70c0=function(_0x5f55d8){while(--_0x5f55d8){_0x1985d5['push'](_0x1985d5['shift']());}};_0x4d70c0(++_0x460dca);}(_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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 4445866..e2e664c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56d303,_0x4eb93c){var _0x1f9659=function(_0x3b8c66){while(--_0x3b8c66){_0x56d303['push'](_0x56d303['shift']());}};_0x1f9659(++_0x4eb93c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x36a10c,_0x54e21e){var _0x3dd35a=function(_0x552ba5){while(--_0x552ba5){_0x36a10c['push'](_0x36a10c['shift']());}};_0x3dd35a(++_0x54e21e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a9a16e1..7225dba 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 _0x2bae=['exports','INTEGER','sequelize'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));module[_0xe2ba('0x1')]={'penalty':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d01=['INTEGER','sequelize'];(function(_0x5c125b,_0x31b620){var _0x5e57eb=function(_0x5e6b6e){while(--_0x5e6b6e){_0x5c125b['push'](_0x5c125b['shift']());}};_0x5e57eb(++_0x31b620);}(_0x5d01,0xe5));var _0x15d0=function(_0x442307,_0x17da06){_0x442307=_0x442307-0x0;var _0x496248=_0x5d01[_0x442307];return _0x496248;};'use strict';var Sequelize=require(_0x15d0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x15d0('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 93ccb5a..17d4574 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 _0x58b6=['path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x58b6,0x14b));var _0x658b=function(_0x351644,_0x180b36){_0x351644=_0x351644-0x0;var _0x5409f6=_0x58b6[_0x351644];return _0x5409f6;};'use strict';var _=require(_0x658b('0x0'));var util=require(_0x658b('0x1'));var logger=require(_0x658b('0x2'))(_0x658b('0x3'));var moment=require(_0x658b('0x4'));var BPromise=require(_0x658b('0x5'));var rp=require(_0x658b('0x6'));var fs=require('fs');var path=require(_0x658b('0x7'));var rimraf=require('rimraf');var config=require(_0x658b('0x8'));var attributes=require(_0x658b('0x9'));module[_0x658b('0xa')]=function(_0x358902,_0x462e40){return _0x358902['define'](_0x658b('0xb'),attributes,{'tableName':_0x658b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ab=['define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./userVoiceQueue.attributes','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc6ab,0x14c));var _0xbc6a=function(_0x4d2bb8,_0x41c106){_0x4d2bb8=_0x4d2bb8-0x0;var _0x105516=_0xc6ab[_0x4d2bb8];return _0x105516;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var logger=require(_0xbc6a('0x2'))(_0xbc6a('0x3'));var moment=require(_0xbc6a('0x4'));var BPromise=require(_0xbc6a('0x5'));var rp=require(_0xbc6a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc6a('0x7'));module[_0xbc6a('0x8')]=function(_0x40b520,_0x2c5825){return _0x40b520[_0xbc6a('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xbc6a('0xa'),'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 26e8f88..505029c 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 _0x004c=['code','message','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x20ba04,_0x4ebf92){var _0x1434d3=function(_0x21f8dd){while(--_0x21f8dd){_0x20ba04['push'](_0x20ba04['shift']());}};_0x1434d3(++_0x4ebf92);}(_0x004c,0x159));var _0xc004=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x004c[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xc004('0x0'));var util=require('util');var moment=require(_0xc004('0x1'));var BPromise=require(_0xc004('0x2'));var rs=require(_0xc004('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc004('0x4'))(_0xc004('0x5'));var config=require(_0xc004('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc004('0x7')][_0xc004('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44eba6,_0x2dc31f,_0x11bebc){return new BPromise(function(_0x255481,_0x484afe){return client[_0xc004('0x9')](_0x44eba6,_0x11bebc)[_0xc004('0xa')](function(_0x4e0c88){logger[_0xc004('0xb')](_0xc004('0xc'),_0x2dc31f,_0xc004('0xd'));logger['debug'](_0xc004('0xe'),_0x2dc31f,_0xc004('0xd'),JSON['stringify'](_0x4e0c88));if(_0x4e0c88[_0xc004('0xf')]){if(_0x4e0c88['error'][_0xc004('0x10')]===0x1f4){logger['error'](_0xc004('0xc'),_0x2dc31f,_0x4e0c88['error'][_0xc004('0x11')]);return _0x484afe(_0x4e0c88['error'][_0xc004('0x11')]);}logger[_0xc004('0xf')](_0xc004('0xc'),_0x2dc31f,_0x4e0c88['error'][_0xc004('0x11')]);return _0x255481(_0x4e0c88[_0xc004('0xf')][_0xc004('0x11')]);}else{logger[_0xc004('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x2dc31f,_0xc004('0xd'));_0x255481(_0x4e0c88['result'][_0xc004('0x11')]);}})[_0xc004('0x12')](function(_0xa21608){logger[_0xc004('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2dc31f,_0xa21608);_0x484afe(_0xa21608);});});} \ No newline at end of file +var _0x32aa=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','UserVoiceQueue,\x20%s,\x20%s','util','moment'];(function(_0x2b5b57,_0x2bc778){var _0x4cefbd=function(_0x19374a){while(--_0x19374a){_0x2b5b57['push'](_0x2b5b57['shift']());}};_0x4cefbd(++_0x2bc778);}(_0x32aa,0x166));var _0xa32a=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0x32aa[_0x1b00d0];return _0x31446c;};'use strict';var _=require('lodash');var util=require(_0xa32a('0x0'));var moment=require(_0xa32a('0x1'));var BPromise=require(_0xa32a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa32a('0x3'));var db=require(_0xa32a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa32a('0x5'))(_0xa32a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa32a('0x7'));var client=jayson[_0xa32a('0x8')][_0xa32a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31695d,_0x2b17a0,_0x2581a1){return new BPromise(function(_0x963534,_0x115869){return client[_0xa32a('0xa')](_0x31695d,_0x2581a1)[_0xa32a('0xb')](function(_0x4a5aa7){logger[_0xa32a('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2b17a0,_0xa32a('0xd'));logger['debug'](_0xa32a('0xe'),_0x2b17a0,'request\x20sent',JSON['stringify'](_0x4a5aa7));if(_0x4a5aa7['error']){if(_0x4a5aa7[_0xa32a('0xf')][_0xa32a('0x10')]===0x1f4){logger[_0xa32a('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2b17a0,_0x4a5aa7['error'][_0xa32a('0x11')]);return _0x115869(_0x4a5aa7['error'][_0xa32a('0x11')]);}logger[_0xa32a('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2b17a0,_0x4a5aa7[_0xa32a('0xf')][_0xa32a('0x11')]);return _0x963534(_0x4a5aa7[_0xa32a('0xf')][_0xa32a('0x11')]);}else{logger[_0xa32a('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2b17a0,_0xa32a('0xd'));_0x963534(_0x4a5aa7[_0xa32a('0x12')][_0xa32a('0x11')]);}})['catch'](function(_0x2ae256){logger['error'](_0xa32a('0x13'),_0x2b17a0,_0x2ae256);_0x115869(_0x2ae256);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 32fb400..11cb750 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b2770,_0x48510b){var _0x5a8af7=function(_0x510856){while(--_0x510856){_0x4b2770['push'](_0x4b2770['shift']());}};_0x5a8af7(++_0x48510b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x22d7b8,_0x37a86f){var _0x49eba7=function(_0x76aeb2){while(--_0x76aeb2){_0x22d7b8['push'](_0x22d7b8['shift']());}};_0x49eba7(++_0x37a86f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c96fe52..70146ec 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 _0xea13=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xea13,0x188));var _0x3ea1=function(_0x3828de,_0x2efd3a){_0x3828de=_0x3828de-0x0;var _0x54da0d=_0xea13[_0x3828de];return _0x54da0d;};'use strict';var Sequelize=require(_0x3ea1('0x0'));module[_0x3ea1('0x1')]={'uniqueid':{'type':Sequelize[_0x3ea1('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3ea1('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3ea1('0x3')},'UserId':{'type':Sequelize[_0x3ea1('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3ea1('0x4')],'allowNull':![],'unique':_0x3ea1('0x5'),'comment':_0x3ea1('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3ea1('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3ea1('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x3ea1('0x3')},'penalty':{'type':Sequelize[_0x3ea1('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3ea1('0x2')](0xb),'defaultValue':0x0,'comment':_0x3ea1('0x3')}}; \ No newline at end of file +var _0x448a=['exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk'];(function(_0x1a20df,_0x440104){var _0x217738=function(_0x45c0b5){while(--_0x45c0b5){_0x1a20df['push'](_0x1a20df['shift']());}};_0x217738(++_0x440104);}(_0x448a,0x1ef));var _0xa448=function(_0x4ee241,_0x4ffc4f){_0x4ee241=_0x4ee241-0x0;var _0x1f1e63=_0x448a[_0x4ee241];return _0x1f1e63;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'uniqueid':{'type':Sequelize[_0xa448('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xa448('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa448('0x2')],'allowNull':![],'unique':_0xa448('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xa448('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xa448('0x2')],'allowNull':![],'unique':_0xa448('0x3'),'comment':_0xa448('0x4')},'penalty':{'type':Sequelize[_0xa448('0x1')](0xb),'defaultValue':0x0,'comment':_0xa448('0x4')},'paused':{'type':Sequelize[_0xa448('0x1')](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 a729098..3ee1786 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 _0xde69=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde69,0x92));var _0x9de6=function(_0x17ff84,_0x513e44){_0x17ff84=_0x17ff84-0x0;var _0x4d6138=_0xde69[_0x17ff84];return _0x4d6138;};'use strict';var EventEmitter=require(_0x9de6('0x0'));var UserVoiceQueueRt=require(_0x9de6('0x1'))['db'][_0x9de6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9de6('0x3')](0x0);var events={'afterCreate':_0x9de6('0x4'),'afterUpdate':_0x9de6('0x5'),'afterDestroy':_0x9de6('0x6')};function emitEvent(_0x57a5ca){return function(_0x5f08d5,_0x4a5517,_0x4f56a8){UserVoiceQueueRtEvents['emit'](_0x57a5ca+':'+_0x5f08d5['id'],_0x5f08d5);UserVoiceQueueRtEvents[_0x9de6('0x7')](_0x57a5ca,_0x5f08d5);_0x4f56a8(null);};}for(var e in events){if(events[_0x9de6('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9de6('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc1b5=['remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1b5,0xfe));var _0x5c1b=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xc1b5[_0x25c326];return _0x762452;};'use strict';var EventEmitter=require(_0x5c1b('0x0'));var UserVoiceQueueRt=require(_0x5c1b('0x1'))['db'][_0x5c1b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5c1b('0x3')](0x0);var events={'afterCreate':_0x5c1b('0x4'),'afterUpdate':_0x5c1b('0x5'),'afterDestroy':_0x5c1b('0x6')};function emitEvent(_0x4d02f6){return function(_0x537bb1,_0x505958,_0x4faf40){UserVoiceQueueRtEvents[_0x5c1b('0x7')](_0x4d02f6+':'+_0x537bb1['id'],_0x537bb1);UserVoiceQueueRtEvents[_0x5c1b('0x7')](_0x4d02f6,_0x537bb1);_0x4faf40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5c1b('0x8')](e,emitEvent(event));}}module[_0x5c1b('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 94067d2..3e96fce 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 _0x25c5=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x4874e3,_0x1d9c94){var _0x437719=function(_0x186acb){while(--_0x186acb){_0x4874e3['push'](_0x4874e3['shift']());}};_0x437719(++_0x1d9c94);}(_0x25c5,0x1af));var _0x525c=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x25c5[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0x525c('0x0'));var util=require(_0x525c('0x1'));var logger=require('../../config/logger')(_0x525c('0x2'));var moment=require(_0x525c('0x3'));var BPromise=require(_0x525c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x525c('0x5'));var rimraf=require(_0x525c('0x6'));var config=require(_0x525c('0x7'));var attributes=require(_0x525c('0x8'));module[_0x525c('0x9')]=function(_0x1c20a8,_0x285126){return _0x1c20a8[_0x525c('0xa')](_0x525c('0xb'),attributes,{'tableName':_0x525c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37ad=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x256c83,_0x4a5e23){var _0x3b8f3c=function(_0x509b15){while(--_0x509b15){_0x256c83['push'](_0x256c83['shift']());}};_0x3b8f3c(++_0x4a5e23);}(_0x37ad,0x117));var _0xd37a=function(_0x4177f9,_0x284554){_0x4177f9=_0x4177f9-0x0;var _0x3488cd=_0x37ad[_0x4177f9];return _0x3488cd;};'use strict';var _=require(_0xd37a('0x0'));var util=require('util');var logger=require(_0xd37a('0x1'))('api');var moment=require(_0xd37a('0x2'));var BPromise=require(_0xd37a('0x3'));var rp=require(_0xd37a('0x4'));var fs=require('fs');var path=require(_0xd37a('0x5'));var rimraf=require(_0xd37a('0x6'));var config=require(_0xd37a('0x7'));var attributes=require(_0xd37a('0x8'));module[_0xd37a('0x9')]=function(_0x10d385,_0x57c67e){return _0x10d385[_0xd37a('0xa')]('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 a609867..e6fb0c4 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 _0x8f2d=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../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','stringify','error','message','GetVoiceQueueRtPauses','findAll','options','raw','COUNT','sequelize','outboundQueuePauses','catch'];(function(_0x1aadba,_0x1b407){var _0x4e78da=function(_0x4eddce){while(--_0x4eddce){_0x1aadba['push'](_0x1aadba['shift']());}};_0x4e78da(++_0x1b407);}(_0x8f2d,0x174));var _0xd8f2=function(_0x655437,_0x338dbc){_0x655437=_0x655437-0x0;var _0x55d24f=_0x8f2d[_0x655437];return _0x55d24f;};'use strict';var _=require(_0xd8f2('0x0'));var util=require('util');var moment=require(_0xd8f2('0x1'));var BPromise=require(_0xd8f2('0x2'));var rs=require(_0xd8f2('0x3'));var fs=require('fs');var Redis=require(_0xd8f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8f2('0x5'))('rpc');var config=require(_0xd8f2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd8f2('0x7')][_0xd8f2('0x8')]({'port':0x232a});config[_0xd8f2('0x9')]=_[_0xd8f2('0xa')](config[_0xd8f2('0x9')],{'host':_0xd8f2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8f2('0x9')]));require('./userVoiceQueueRt.socket')[_0xd8f2('0xc')](socket);function respondWithRpcPromise(_0x42a866,_0x339e7b,_0x53a809){return new BPromise(function(_0x1bb223,_0x12e621){return client[_0xd8f2('0xd')](_0x42a866,_0x53a809)[_0xd8f2('0xe')](function(_0x9ab22a){logger[_0xd8f2('0xf')](_0xd8f2('0x10'),_0x339e7b,_0xd8f2('0x11'));logger[_0xd8f2('0x12')](_0xd8f2('0x13'),_0x339e7b,_0xd8f2('0x11'),JSON[_0xd8f2('0x14')](_0x9ab22a));if(_0x9ab22a[_0xd8f2('0x15')]){if(_0x9ab22a[_0xd8f2('0x15')]['code']===0x1f4){logger[_0xd8f2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x339e7b,_0x9ab22a[_0xd8f2('0x15')]['message']);return _0x12e621(_0x9ab22a['error'][_0xd8f2('0x16')]);}logger[_0xd8f2('0x15')](_0xd8f2('0x10'),_0x339e7b,_0x9ab22a[_0xd8f2('0x15')][_0xd8f2('0x16')]);return _0x1bb223(_0x9ab22a[_0xd8f2('0x15')][_0xd8f2('0x16')]);}else{logger[_0xd8f2('0xf')](_0xd8f2('0x10'),_0x339e7b,_0xd8f2('0x11'));_0x1bb223(_0x9ab22a['result'][_0xd8f2('0x16')]);}})['catch'](function(_0x43d599){logger['error'](_0xd8f2('0x10'),_0x339e7b,_0x43d599);_0x12e621(_0x43d599);});});}exports[_0xd8f2('0x17')]=function(_0x18be53){var _0x265d59=this;return new Promise(function(_0x59f0a3,_0x4076ee){return db['UserVoiceQueueRt'][_0xd8f2('0x18')]({'raw':_0x18be53[_0xd8f2('0x19')]?_0x18be53[_0xd8f2('0x19')][_0xd8f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x18be53['options']?_0x18be53[_0xd8f2('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xd8f2('0x1b'),db[_0xd8f2('0x1c')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xd8f2('0x1d')]]})['then'](function(_0x55e608){logger[_0xd8f2('0xf')](_0xd8f2('0x17'),_0x18be53);logger[_0xd8f2('0x12')]('GetVoiceQueueRtPauses',_0x18be53,JSON['stringify'](_0x55e608));_0x59f0a3(_0x55e608);})[_0xd8f2('0x1e')](function(_0x59ab45){logger['error'](_0xd8f2('0x17'),_0x59ab45[_0xd8f2('0x16')],_0x18be53);_0x4076ee(_0x265d59[_0xd8f2('0x15')](0x1f4,_0x59ab45['message']));});});}; \ No newline at end of file +var _0xa29f=['../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa29f,0x1e4));var _0xfa29=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0xa29f[_0x9c6c1c];return _0x594c42;};'use strict';var _=require(_0xfa29('0x0'));var util=require(_0xfa29('0x1'));var moment=require('moment');var BPromise=require(_0xfa29('0x2'));var rs=require(_0xfa29('0x3'));var fs=require('fs');var Redis=require(_0xfa29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa29('0x5'));var logger=require(_0xfa29('0x6'))('rpc');var config=require(_0xfa29('0x7'));var jayson=require(_0xfa29('0x8'));var client=jayson[_0xfa29('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfa29('0xa')](config[_0xfa29('0xb')],{'host':_0xfa29('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xfa29('0xd')](socket);function respondWithRpcPromise(_0x4603d4,_0x3c8df7,_0x553d1b){return new BPromise(function(_0x231be8,_0xfb5d8){return client['request'](_0x4603d4,_0x553d1b)[_0xfa29('0xe')](function(_0x1a3ec1){logger['info'](_0xfa29('0xf'),_0x3c8df7,_0xfa29('0x10'));logger[_0xfa29('0x11')](_0xfa29('0x12'),_0x3c8df7,_0xfa29('0x10'),JSON[_0xfa29('0x13')](_0x1a3ec1));if(_0x1a3ec1[_0xfa29('0x14')]){if(_0x1a3ec1[_0xfa29('0x14')]['code']===0x1f4){logger[_0xfa29('0x14')](_0xfa29('0xf'),_0x3c8df7,_0x1a3ec1[_0xfa29('0x14')]['message']);return _0xfb5d8(_0x1a3ec1[_0xfa29('0x14')][_0xfa29('0x15')]);}logger[_0xfa29('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3c8df7,_0x1a3ec1[_0xfa29('0x14')]['message']);return _0x231be8(_0x1a3ec1['error'][_0xfa29('0x15')]);}else{logger[_0xfa29('0x16')](_0xfa29('0xf'),_0x3c8df7,_0xfa29('0x10'));_0x231be8(_0x1a3ec1[_0xfa29('0x17')][_0xfa29('0x15')]);}})[_0xfa29('0x18')](function(_0x5ae33c){logger[_0xfa29('0x14')](_0xfa29('0xf'),_0x3c8df7,_0x5ae33c);_0xfb5d8(_0x5ae33c);});});}exports[_0xfa29('0x19')]=function(_0x4a18d0){var _0x33d662=this;return new Promise(function(_0x58d628,_0x23e2d0){return db['UserVoiceQueueRt'][_0xfa29('0x1a')]({'raw':_0x4a18d0[_0xfa29('0x1b')]?_0x4a18d0['options'][_0xfa29('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a18d0[_0xfa29('0x1b')]?_0x4a18d0[_0xfa29('0x1b')][_0xfa29('0x1d')]||null:null,'attributes':[[db[_0xfa29('0x1e')]['fn'](_0xfa29('0x1f'),db[_0xfa29('0x1e')]['fn']('IF',db[_0xfa29('0x1e')][_0xfa29('0x20')](_0xfa29('0x21')))),_0xfa29('0x22')]]})[_0xfa29('0xe')](function(_0x2c0f59){logger['info'](_0xfa29('0x19'),_0x4a18d0);logger[_0xfa29('0x11')](_0xfa29('0x19'),_0x4a18d0,JSON[_0xfa29('0x13')](_0x2c0f59));_0x58d628(_0x2c0f59);})['catch'](function(_0x5cdbf6){logger[_0xfa29('0x14')]('GetVoiceQueueRtPauses',_0x5cdbf6[_0xfa29('0x15')],_0x4a18d0);_0x23e2d0(_0x33d662[_0xfa29('0x14')](0x1f4,_0x5cdbf6[_0xfa29('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index dbd856b..a0a2fba 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 _0xcfef=['update','removeListener','register','userVoiceQueueRt:','save','remove'];(function(_0x42bf94,_0x12e0a0){var _0x351b7f=function(_0x5bb77b){while(--_0x5bb77b){_0x42bf94['push'](_0x42bf94['shift']());}};_0x351b7f(++_0x12e0a0);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x964376,_0x4b6c36){_0x964376=_0x964376-0x0;var _0x222512=_0xcfef[_0x964376];return _0x222512;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xfcfe('0x0'),_0xfcfe('0x1'),_0xfcfe('0x2')];function createListener(_0x4c14ff,_0x5d6de0){return function(_0x4a029d){_0x5d6de0['emit'](_0x4c14ff,_0x4a029d);};}function removeListener(_0x1bee79,_0x21c122){return function(){UserVoiceQueueRtEvents[_0xfcfe('0x3')](_0x1bee79,_0x21c122);};}exports[_0xfcfe('0x4')]=function(_0x518bcd){for(var _0x531494=0x0,_0x2aecec=events['length'];_0x531494<_0x2aecec;_0x531494++){var _0x28fe66=events[_0x531494];var _0x1d7307=createListener(_0xfcfe('0x5')+_0x28fe66,_0x518bcd);UserVoiceQueueRtEvents['on'](_0x28fe66,_0x1d7307);}}; \ No newline at end of file +var _0x39d9=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x187da0,_0x40f93d){var _0xbcc808=function(_0x1ded15){while(--_0x1ded15){_0x187da0['push'](_0x187da0['shift']());}};_0xbcc808(++_0x40f93d);}(_0x39d9,0x17f));var _0x939d=function(_0x231edd,_0x2d704b){_0x231edd=_0x231edd-0x0;var _0x1f4388=_0x39d9[_0x231edd];return _0x1f4388;};'use strict';var UserVoiceQueueRtEvents=require(_0x939d('0x0'));var events=[_0x939d('0x1'),_0x939d('0x2'),_0x939d('0x3')];function createListener(_0x3834f0,_0x201b6a){return function(_0x367c79){_0x201b6a[_0x939d('0x4')](_0x3834f0,_0x367c79);};}function removeListener(_0x57ab6c,_0x2a9e29){return function(){UserVoiceQueueRtEvents[_0x939d('0x5')](_0x57ab6c,_0x2a9e29);};}exports[_0x939d('0x6')]=function(_0x48b22f){for(var _0x41c89f=0x0,_0x537fd2=events[_0x939d('0x7')];_0x41c89f<_0x537fd2;_0x41c89f++){var _0x1bac28=events[_0x41c89f];var _0x20546a=createListener(_0x939d('0x8')+_0x1bac28,_0x48b22f);UserVoiceQueueRtEvents['on'](_0x1bac28,_0x20546a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d9e31dd..2f6ea46 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x520407,_0x24a4ce){var _0x45f7a1=function(_0x57ea00){while(--_0x57ea00){_0x520407['push'](_0x520407['shift']());}};_0x45f7a1(++_0x24a4ce);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x43b88c,_0x46fb04){var _0x407299=function(_0x16dcd3){while(--_0x16dcd3){_0x43b88c['push'](_0x43b88c['shift']());}};_0x407299(++_0x46fb04);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3b7aa28..c3a00fb 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 _0x836f=['INTEGER','sequelize'];(function(_0x1cd2ac,_0x718d01){var _0x50164a=function(_0x7218ba){while(--_0x7218ba){_0x1cd2ac['push'](_0x1cd2ac['shift']());}};_0x50164a(++_0x718d01);}(_0x836f,0x165));var _0xf836=function(_0x9be589,_0x3b7521){_0x9be589=_0x9be589-0x0;var _0x5f41a0=_0x836f[_0x9be589];return _0x5f41a0;};'use strict';var Sequelize=require(_0xf836('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf836('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b2e=['INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b2e,0xcb));var _0xe4b2=function(_0x283573,_0x8656d1){_0x283573=_0x283573-0x0;var _0x225419=_0x4b2e[_0x283573];return _0x225419;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe4b2('0x0')],'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 2e3a049..4d8511a 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 _0x3756=['rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','path'];(function(_0x52c3e8,_0x31bc4f){var _0x36ee0a=function(_0x3485e8){while(--_0x3485e8){_0x52c3e8['push'](_0x52c3e8['shift']());}};_0x36ee0a(++_0x31bc4f);}(_0x3756,0x11c));var _0x6375=function(_0xba033e,_0x3eecce){_0xba033e=_0xba033e-0x0;var _0x1d105c=_0x3756[_0xba033e];return _0x1d105c;};'use strict';var _=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var logger=require(_0x6375('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6375('0x3'));var rimraf=require(_0x6375('0x4'));var config=require('../../config/environment');var attributes=require(_0x6375('0x5'));module[_0x6375('0x6')]=function(_0x578c,_0x44620f){return _0x578c[_0x6375('0x7')](_0x6375('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd1c=['moment','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x2cd521,_0x29e396){var _0x559996=function(_0x5ab34c){while(--_0x5ab34c){_0x2cd521['push'](_0x2cd521['shift']());}};_0x559996(++_0x29e396);}(_0xbd1c,0x1c8));var _0xcbd1=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xbd1c[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var logger=require(_0xcbd1('0x2'))(_0xcbd1('0x3'));var moment=require(_0xcbd1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbd1('0x5'));var config=require(_0xcbd1('0x6'));var attributes=require(_0xcbd1('0x7'));module[_0xcbd1('0x8')]=function(_0x5a9010,_0xa6a5c8){return _0x5a9010[_0xcbd1('0x9')]('UserWhatsappQueue',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 c1d379c..f78e5b9 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 _0xa5a8=['code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa5a8,0x8f));var _0x8a5a=function(_0x3ad1ed,_0x14b441){_0x3ad1ed=_0x3ad1ed-0x0;var _0x2a4e6f=_0xa5a8[_0x3ad1ed];return _0x2a4e6f;};'use strict';var _=require(_0x8a5a('0x0'));var util=require(_0x8a5a('0x1'));var moment=require('moment');var BPromise=require(_0x8a5a('0x2'));var rs=require(_0x8a5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a5a('0x4'));var logger=require(_0x8a5a('0x5'))(_0x8a5a('0x6'));var config=require(_0x8a5a('0x7'));var jayson=require(_0x8a5a('0x8'));var client=jayson[_0x8a5a('0x9')][_0x8a5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c59f,_0x3ffa8a,_0x424b8d){return new BPromise(function(_0x5c73f5,_0x5ae6ae){return client['request'](_0x47c59f,_0x424b8d)[_0x8a5a('0xb')](function(_0x407178){logger[_0x8a5a('0xc')](_0x8a5a('0xd'),_0x3ffa8a,_0x8a5a('0xe'));logger[_0x8a5a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3ffa8a,_0x8a5a('0xe'),JSON['stringify'](_0x407178));if(_0x407178['error']){if(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x11')]===0x1f4){logger[_0x8a5a('0x10')](_0x8a5a('0xd'),_0x3ffa8a,_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);return _0x5ae6ae(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);}logger[_0x8a5a('0x10')](_0x8a5a('0xd'),_0x3ffa8a,_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);return _0x5c73f5(_0x407178[_0x8a5a('0x10')][_0x8a5a('0x12')]);}else{logger[_0x8a5a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3ffa8a,_0x8a5a('0xe'));_0x5c73f5(_0x407178[_0x8a5a('0x13')][_0x8a5a('0x12')]);}})['catch'](function(_0x38e2ff){logger['error'](_0x8a5a('0xd'),_0x3ffa8a,_0x38e2ff);_0x5ae6ae(_0x38e2ff);});});} \ No newline at end of file +var _0x005f=['lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x39cb5c,_0x2c063b){var _0x33aeab=function(_0x23ec1b){while(--_0x23ec1b){_0x39cb5c['push'](_0x39cb5c['shift']());}};_0x33aeab(++_0x2c063b);}(_0x005f,0x69));var _0xf005=function(_0x2bbbff,_0x3ee398){_0x2bbbff=_0x2bbbff-0x0;var _0x377b3b=_0x005f[_0x2bbbff];return _0x377b3b;};'use strict';var _=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf005('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf005('0x3'));var logger=require(_0xf005('0x4'))(_0xf005('0x5'));var config=require(_0xf005('0x6'));var jayson=require(_0xf005('0x7'));var client=jayson[_0xf005('0x8')][_0xf005('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f484,_0x9a72c9,_0x2c5146){return new BPromise(function(_0x2d5b49,_0x57c97e){return client[_0xf005('0xa')](_0x33f484,_0x2c5146)[_0xf005('0xb')](function(_0x261978){logger['info'](_0xf005('0xc'),_0x9a72c9,_0xf005('0xd'));logger['debug'](_0xf005('0xe'),_0x9a72c9,_0xf005('0xd'),JSON[_0xf005('0xf')](_0x261978));if(_0x261978['error']){if(_0x261978[_0xf005('0x10')][_0xf005('0x11')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x9a72c9,_0x261978[_0xf005('0x10')][_0xf005('0x12')]);return _0x57c97e(_0x261978[_0xf005('0x10')][_0xf005('0x12')]);}logger[_0xf005('0x10')](_0xf005('0xc'),_0x9a72c9,_0x261978[_0xf005('0x10')][_0xf005('0x12')]);return _0x2d5b49(_0x261978['error'][_0xf005('0x12')]);}else{logger[_0xf005('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x9a72c9,'request\x20sent');_0x2d5b49(_0x261978['result'][_0xf005('0x12')]);}})[_0xf005('0x14')](function(_0x555f97){logger[_0xf005('0x10')](_0xf005('0xc'),_0x9a72c9,_0x555f97);_0x57c97e(_0x555f97);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f2e6674..c129d84 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 _0xf296=['../../config/environment','./variable.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0xf296,0x94));var _0x6f29=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0xf296[_0x1d5714];return _0x1b620e;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require('path');var timeout=require(_0x6f29('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f29('0x3'));var auth=require(_0x6f29('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f29('0x5'));var controller=require(_0x6f29('0x6'));router[_0x6f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f29('0x8')]);router[_0x6f29('0x7')]('/:id',auth[_0x6f29('0x9')](),controller[_0x6f29('0xa')]);router[_0x6f29('0xb')]('/',auth[_0x6f29('0x9')](),controller[_0x6f29('0xc')]);router[_0x6f29('0xd')](_0x6f29('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6f29('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6f29('0x10')]);module['exports']=router; \ No newline at end of file +var _0xafa5=['./variable.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x30755e,_0x4d06f8){var _0x3ef4b1=function(_0x6c9409){while(--_0x6c9409){_0x30755e['push'](_0x30755e['shift']());}};_0x3ef4b1(++_0x4d06f8);}(_0xafa5,0x1af));var _0x5afa=function(_0x192a85,_0x2ea080){_0x192a85=_0x192a85-0x0;var _0x545a04=_0xafa5[_0x192a85];return _0x545a04;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xf')]('/',auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router[_0x5afa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5afa('0x12')]);router[_0x5afa('0x13')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x14')]);module[_0x5afa('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 55ce023..8110b85 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 _0xabfc=['STRING','name','exports'];(function(_0x12f1e1,_0x565cd0){var _0x254085=function(_0x4b3e61){while(--_0x4b3e61){_0x12f1e1['push'](_0x12f1e1['shift']());}};_0x254085(++_0x565cd0);}(_0xabfc,0x1d9));var _0xcabf=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xabfc[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require('sequelize');module[_0xcabf('0x0')]={'name':{'type':Sequelize[_0xcabf('0x1')],'unique':_0xcabf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcabf('0x1')]}}; \ No newline at end of file +var _0xadff=['STRING','name','exports'];(function(_0x1f3897,_0x1237a3){var _0x42b90d=function(_0x4fe5c1){while(--_0x4fe5c1){_0x1f3897['push'](_0x1f3897['shift']());}};_0x42b90d(++_0x1237a3);}(_0xadff,0xf8));var _0xfadf=function(_0x24e7d3,_0x46f920){_0x24e7d3=_0x24e7d3-0x0;var _0x3db220=_0xadff[_0x24e7d3];return _0x3db220;};'use strict';var Sequelize=require('sequelize');module[_0xfadf('0x0')]={'name':{'type':Sequelize[_0xfadf('0x1')],'unique':_0xfadf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfadf('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4163121..0ee6ddf 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 _0x79a8=['save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','name','send','index','Variable','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x115ebe,_0x3f8784){var _0x1a8218=function(_0x3cb15b){while(--_0x3cb15b){_0x115ebe['push'](_0x115ebe['shift']());}};_0x1a8218(++_0x3f8784);}(_0x79a8,0x129));var _0x879a=function(_0x4af43b,_0x46ddfc){_0x4af43b=_0x4af43b-0x0;var _0xb20e01=_0x79a8[_0x4af43b];return _0xb20e01;};'use strict';var emlformat=require(_0x879a('0x0'));var rimraf=require(_0x879a('0x1'));var zipdir=require(_0x879a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x879a('0x3'));var moment=require(_0x879a('0x4'));var BPromise=require(_0x879a('0x5'));var Mustache=require(_0x879a('0x6'));var util=require(_0x879a('0x7'));var path=require(_0x879a('0x8'));var sox=require(_0x879a('0x9'));var csv=require(_0x879a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x879a('0xb'));var squel=require(_0x879a('0xc'));var crypto=require(_0x879a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x879a('0xe'));var toCsv=require(_0x879a('0xa'));var querystring=require(_0x879a('0xf'));var Papa=require(_0x879a('0x10'));var Redis=require(_0x879a('0x11'));var authService=require(_0x879a('0x12'));var qs=require(_0x879a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x879a('0x14'));var logger=require(_0x879a('0x15'))(_0x879a('0x16'));var utils=require(_0x879a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x879a('0x18'));var db=require(_0x879a('0x19'))['db'];function respondWithStatusCode(_0x34e18a,_0x5b63ba){_0x5b63ba=_0x5b63ba||0xcc;return function(_0x23542a){if(_0x23542a){return _0x34e18a['sendStatus'](_0x5b63ba);}return _0x34e18a[_0x879a('0x1a')](_0x5b63ba)[_0x879a('0x1b')]();};}function respondWithResult(_0xe61b9d,_0x2c1914){_0x2c1914=_0x2c1914||0xc8;return function(_0x39be6b){if(_0x39be6b){return _0xe61b9d[_0x879a('0x1a')](_0x2c1914)['json'](_0x39be6b);}};}function respondWithFilteredResult(_0x565ec7,_0x12a2a6){return function(_0x5358ce){if(_0x5358ce){var _0x290238=typeof _0x12a2a6['offset']==='undefined'&&typeof _0x12a2a6['limit']===_0x879a('0x1c');var _0x437c23=_0x5358ce[_0x879a('0x1d')];var _0x10675f=_0x290238?0x0:_0x12a2a6[_0x879a('0x1e')];var _0x50547d=_0x290238?_0x5358ce[_0x879a('0x1d')]:_0x12a2a6['offset']+_0x12a2a6['limit'];var _0x4ff1bd;if(_0x50547d>=_0x437c23){_0x50547d=_0x437c23;_0x4ff1bd=0xc8;}else{_0x4ff1bd=0xce;}_0x565ec7[_0x879a('0x1a')](_0x4ff1bd);return _0x565ec7[_0x879a('0x1f')](_0x879a('0x20'),_0x10675f+'-'+_0x50547d+'/'+_0x437c23)['json'](_0x5358ce);}return null;};}function patchUpdates(_0x105091){return function(_0x24282b){try{jsonpatch[_0x879a('0x21')](_0x24282b,_0x105091,!![]);}catch(_0x4c7458){return BPromise[_0x879a('0x22')](_0x4c7458);}return _0x24282b[_0x879a('0x23')]();};}function saveUpdates(_0x3df989,_0x5c42b4){return function(_0x488fb7){if(_0x488fb7){return _0x488fb7[_0x879a('0x24')](_0x3df989)['then'](function(_0x3c0b2a){return _0x3c0b2a;});}return null;};}function removeEntity(_0x1005b9,_0x2f0f87){return function(_0x5b8e51){if(_0x5b8e51){return _0x5b8e51['destroy']()[_0x879a('0x25')](function(){var _0x3c8181=_0x5b8e51[_0x879a('0x26')]({'plain':!![]});var _0x517225=_0x879a('0x27');return db[_0x879a('0x28')][_0x879a('0x29')]({'where':{'type':_0x517225,'resourceId':_0x3c8181['id']}})[_0x879a('0x25')](function(){return _0x5b8e51;});})['then'](function(){_0x1005b9[_0x879a('0x1a')](0xcc)[_0x879a('0x1b')]();});}};}function handleEntityNotFound(_0x3cdbc8,_0x5acfb9){return function(_0x46808e){if(!_0x46808e){_0x3cdbc8[_0x879a('0x2a')](0x194);}return _0x46808e;};}function handleError(_0x40fb7b,_0x888244){_0x888244=_0x888244||0x1f4;return function(_0x3baf49){logger[_0x879a('0x2b')](_0x3baf49['stack']);if(_0x3baf49[_0x879a('0x2c')]){delete _0x3baf49[_0x879a('0x2c')];}_0x40fb7b[_0x879a('0x1a')](_0x888244)[_0x879a('0x2d')](_0x3baf49);};}exports[_0x879a('0x2e')]=function(_0x770885,_0x10e761){var _0xe08c10={},_0x55dffe={},_0x14ad2d={'count':0x0,'rows':[]};var _0x23e7a1=_['map'](db[_0x879a('0x2f')][_0x879a('0x30')],function(_0x39a277){return{'name':_0x39a277['fieldName'],'type':_0x39a277[_0x879a('0x31')][_0x879a('0x32')]};});_0x55dffe[_0x879a('0x33')]=_[_0x879a('0x34')](_0x23e7a1,_0x879a('0x2c'));_0x55dffe[_0x879a('0x35')]=_[_0x879a('0x36')](_0x770885[_0x879a('0x35')]);_0x55dffe[_0x879a('0x37')]=_['intersection'](_0x55dffe[_0x879a('0x33')],_0x55dffe[_0x879a('0x35')]);_0xe08c10['attributes']=_[_0x879a('0x38')](_0x55dffe[_0x879a('0x33')],qs['fields'](_0x770885[_0x879a('0x35')][_0x879a('0x39')]));_0xe08c10[_0x879a('0x3a')]=_0xe08c10[_0x879a('0x3a')][_0x879a('0x3b')]?_0xe08c10[_0x879a('0x3a')]:_0x55dffe['model'];if(!_0x770885['query']['hasOwnProperty'](_0x879a('0x3c'))){_0xe08c10['limit']=qs[_0x879a('0x3d')](_0x770885['query']['limit']);_0xe08c10['offset']=qs[_0x879a('0x1e')](_0x770885['query'][_0x879a('0x1e')]);}_0xe08c10[_0x879a('0x3e')]=qs['sort'](_0x770885['query'][_0x879a('0x3f')]);_0xe08c10['where']=qs[_0x879a('0x37')](_[_0x879a('0x40')](_0x770885['query'],_0x55dffe[_0x879a('0x37')]),_0x23e7a1);if(_0x770885[_0x879a('0x35')][_0x879a('0x41')]){_0xe08c10[_0x879a('0x42')]=_[_0x879a('0x43')](_0xe08c10['where'],{'$or':_['map'](_0x23e7a1,function(_0x353414){if(_0x353414[_0x879a('0x31')]!=='VIRTUAL'){var _0x5d28f6={};_0x5d28f6[_0x353414['name']]={'$like':'%'+_0x770885[_0x879a('0x35')][_0x879a('0x41')]+'%'};return _0x5d28f6;}})});}_0xe08c10=_[_0x879a('0x43')]({},_0xe08c10,_0x770885[_0x879a('0x44')]);var _0x6cb1fd={'where':_0xe08c10[_0x879a('0x42')]};return db[_0x879a('0x2f')][_0x879a('0x1d')](_0x6cb1fd)['then'](function(_0x42e42c){_0x14ad2d['count']=_0x42e42c;if(_0x770885[_0x879a('0x35')][_0x879a('0x45')]){_0xe08c10[_0x879a('0x46')]=[{'all':!![]}];}return db[_0x879a('0x2f')]['findAll'](_0xe08c10);})[_0x879a('0x25')](function(_0x33d0ed){_0x14ad2d[_0x879a('0x47')]=_0x33d0ed;return _0x14ad2d;})['then'](respondWithFilteredResult(_0x10e761,_0xe08c10))['catch'](handleError(_0x10e761,null));};exports['show']=function(_0x4ff3b0,_0x14b299){var _0x3eb6bc={'raw':!![],'where':{'id':_0x4ff3b0[_0x879a('0x48')]['id']}},_0x5c3234={};_0x5c3234[_0x879a('0x33')]=_[_0x879a('0x36')](db['Variable'][_0x879a('0x30')]);_0x5c3234[_0x879a('0x35')]=_[_0x879a('0x36')](_0x4ff3b0['query']);_0x5c3234['filters']=_[_0x879a('0x38')](_0x5c3234['model'],_0x5c3234[_0x879a('0x35')]);_0x3eb6bc[_0x879a('0x3a')]=_[_0x879a('0x38')](_0x5c3234[_0x879a('0x33')],qs[_0x879a('0x39')](_0x4ff3b0[_0x879a('0x35')][_0x879a('0x39')]));_0x3eb6bc[_0x879a('0x3a')]=_0x3eb6bc[_0x879a('0x3a')][_0x879a('0x3b')]?_0x3eb6bc[_0x879a('0x3a')]:_0x5c3234['model'];if(_0x4ff3b0[_0x879a('0x35')]['includeAll']){_0x3eb6bc[_0x879a('0x46')]=[{'all':!![]}];}_0x3eb6bc=_[_0x879a('0x43')]({},_0x3eb6bc,_0x4ff3b0['options']);return db['Variable'][_0x879a('0x49')](_0x3eb6bc)[_0x879a('0x25')](handleEntityNotFound(_0x14b299,null))[_0x879a('0x25')](respondWithResult(_0x14b299,null))[_0x879a('0x4a')](handleError(_0x14b299,null));};exports[_0x879a('0x4b')]=function(_0x270448,_0x296cfa){return db[_0x879a('0x2f')][_0x879a('0x4b')](_0x270448[_0x879a('0x4c')],{})['then'](function(_0x3a1292){var _0x2a9b37=_0x270448[_0x879a('0x4d')][_0x879a('0x26')]({'plain':!![]});if(!_0x2a9b37)throw new Error(_0x879a('0x4e'));if(_0x2a9b37[_0x879a('0x4f')]===_0x879a('0x4d')){var _0x3b5b98=_0x3a1292[_0x879a('0x26')]({'plain':!![]});var _0x1c5659='Variables';return db[_0x879a('0x50')][_0x879a('0x49')]({'where':{'name':_0x1c5659,'userProfileId':_0x2a9b37['userProfileId']},'raw':!![]})[_0x879a('0x25')](function(_0x43eb05){if(_0x43eb05&&_0x43eb05[_0x879a('0x51')]===0x0){return db[_0x879a('0x28')][_0x879a('0x4b')]({'name':_0x3b5b98['name'],'resourceId':_0x3b5b98['id'],'type':_0x43eb05[_0x879a('0x2c')],'sectionId':_0x43eb05['id']},{})[_0x879a('0x25')](function(){return _0x3a1292;});}else{return _0x3a1292;}})[_0x879a('0x4a')](function(_0x309417){logger[_0x879a('0x2b')](_0x879a('0x52'),_0x309417);throw _0x309417;});}return _0x3a1292;})[_0x879a('0x25')](respondWithResult(_0x296cfa,0xc9))['catch'](handleError(_0x296cfa,null));};exports[_0x879a('0x24')]=function(_0x307df7,_0xafff){if(_0x307df7['body']['id']){delete _0x307df7['body']['id'];}return db[_0x879a('0x2f')][_0x879a('0x49')]({'where':{'id':_0x307df7['params']['id']}})[_0x879a('0x25')](handleEntityNotFound(_0xafff,null))[_0x879a('0x25')](saveUpdates(_0x307df7[_0x879a('0x4c')],null))[_0x879a('0x25')](respondWithResult(_0xafff,null))[_0x879a('0x4a')](handleError(_0xafff,null));};exports[_0x879a('0x29')]=function(_0x1e7eb8,_0x1bad63){return db[_0x879a('0x2f')]['find']({'where':{'id':_0x1e7eb8[_0x879a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bad63,null))[_0x879a('0x25')](removeEntity(_0x1bad63,null))[_0x879a('0x4a')](handleError(_0x1bad63,null));}; \ No newline at end of file +var _0x5db7=['options','Variable','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','role','UserProfileSection','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','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','Variables','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x2bae44,_0x33f37a){var _0x1e111b=function(_0x4f4cfa){while(--_0x4f4cfa){_0x2bae44['push'](_0x2bae44['shift']());}};_0x1e111b(++_0x33f37a);}(_0x5db7,0x116));var _0x75db=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x5db7[_0x19115e];return _0x45bbd4;};'use strict';var emlformat=require(_0x75db('0x0'));var rimraf=require(_0x75db('0x1'));var zipdir=require(_0x75db('0x2'));var jsonpatch=require(_0x75db('0x3'));var rp=require(_0x75db('0x4'));var moment=require(_0x75db('0x5'));var BPromise=require(_0x75db('0x6'));var Mustache=require('mustache');var util=require(_0x75db('0x7'));var path=require(_0x75db('0x8'));var sox=require(_0x75db('0x9'));var csv=require('to-csv');var ejs=require(_0x75db('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x75db('0xb'));var crypto=require(_0x75db('0xc'));var jsforce=require(_0x75db('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x75db('0xe'));var querystring=require(_0x75db('0xf'));var Papa=require(_0x75db('0x10'));var Redis=require(_0x75db('0x11'));var authService=require(_0x75db('0x12'));var qs=require(_0x75db('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75db('0x14'));var logger=require(_0x75db('0x15'))('api');var utils=require(_0x75db('0x16'));var config=require(_0x75db('0x17'));var licenseUtil=require(_0x75db('0x18'));var db=require(_0x75db('0x19'))['db'];function respondWithStatusCode(_0x2a3608,_0x563cbc){_0x563cbc=_0x563cbc||0xcc;return function(_0x38993a){if(_0x38993a){return _0x2a3608[_0x75db('0x1a')](_0x563cbc);}return _0x2a3608[_0x75db('0x1b')](_0x563cbc)[_0x75db('0x1c')]();};}function respondWithResult(_0x17a5c7,_0x34c307){_0x34c307=_0x34c307||0xc8;return function(_0x336a11){if(_0x336a11){return _0x17a5c7['status'](_0x34c307)[_0x75db('0x1d')](_0x336a11);}};}function respondWithFilteredResult(_0x2cf00e,_0x44d0ae){return function(_0x2b0ad1){if(_0x2b0ad1){var _0x129d3f=typeof _0x44d0ae['offset']==='undefined'&&typeof _0x44d0ae[_0x75db('0x1e')]===_0x75db('0x1f');var _0x1d5dfe=_0x2b0ad1[_0x75db('0x20')];var _0x1e1cd0=_0x129d3f?0x0:_0x44d0ae['offset'];var _0x5acad3=_0x129d3f?_0x2b0ad1[_0x75db('0x20')]:_0x44d0ae['offset']+_0x44d0ae[_0x75db('0x1e')];var _0x8a55f8;if(_0x5acad3>=_0x1d5dfe){_0x5acad3=_0x1d5dfe;_0x8a55f8=0xc8;}else{_0x8a55f8=0xce;}_0x2cf00e[_0x75db('0x1b')](_0x8a55f8);return _0x2cf00e[_0x75db('0x21')](_0x75db('0x22'),_0x1e1cd0+'-'+_0x5acad3+'/'+_0x1d5dfe)[_0x75db('0x1d')](_0x2b0ad1);}return null;};}function patchUpdates(_0x4fcd64){return function(_0x3d93b0){try{jsonpatch['apply'](_0x3d93b0,_0x4fcd64,!![]);}catch(_0x2cfbf1){return BPromise[_0x75db('0x23')](_0x2cfbf1);}return _0x3d93b0[_0x75db('0x24')]();};}function saveUpdates(_0x45d466,_0x2f1ea0){return function(_0x370138){if(_0x370138){return _0x370138['update'](_0x45d466)[_0x75db('0x25')](function(_0x4dde07){return _0x4dde07;});}return null;};}function removeEntity(_0x4aa14f,_0x399176){return function(_0x25d66b){if(_0x25d66b){return _0x25d66b[_0x75db('0x26')]()['then'](function(){var _0x340697=_0x25d66b['get']({'plain':!![]});var _0x4cee74=_0x75db('0x27');return db[_0x75db('0x28')][_0x75db('0x26')]({'where':{'type':_0x4cee74,'resourceId':_0x340697['id']}})[_0x75db('0x25')](function(){return _0x25d66b;});})[_0x75db('0x25')](function(){_0x4aa14f[_0x75db('0x1b')](0xcc)[_0x75db('0x1c')]();});}};}function handleEntityNotFound(_0x58dbb5,_0x2edfd1){return function(_0x10608e){if(!_0x10608e){_0x58dbb5['sendStatus'](0x194);}return _0x10608e;};}function handleError(_0x4b59a7,_0x5d5332){_0x5d5332=_0x5d5332||0x1f4;return function(_0x45dbd3){logger[_0x75db('0x29')](_0x45dbd3['stack']);if(_0x45dbd3[_0x75db('0x2a')]){delete _0x45dbd3['name'];}_0x4b59a7['status'](_0x5d5332)[_0x75db('0x2b')](_0x45dbd3);};}exports[_0x75db('0x2c')]=function(_0x5d0528,_0x383f2c){var _0x1240aa={},_0x424f42={},_0x48b423={'count':0x0,'rows':[]};var _0x233878=_['map'](db['Variable'][_0x75db('0x2d')],function(_0x3a542b){return{'name':_0x3a542b[_0x75db('0x2e')],'type':_0x3a542b[_0x75db('0x2f')][_0x75db('0x30')]};});_0x424f42[_0x75db('0x31')]=_[_0x75db('0x32')](_0x233878,_0x75db('0x2a'));_0x424f42[_0x75db('0x33')]=_['keys'](_0x5d0528['query']);_0x424f42[_0x75db('0x34')]=_[_0x75db('0x35')](_0x424f42[_0x75db('0x31')],_0x424f42['query']);_0x1240aa[_0x75db('0x36')]=_[_0x75db('0x35')](_0x424f42[_0x75db('0x31')],qs[_0x75db('0x37')](_0x5d0528[_0x75db('0x33')][_0x75db('0x37')]));_0x1240aa[_0x75db('0x36')]=_0x1240aa[_0x75db('0x36')][_0x75db('0x38')]?_0x1240aa[_0x75db('0x36')]:_0x424f42['model'];if(!_0x5d0528[_0x75db('0x33')][_0x75db('0x39')](_0x75db('0x3a'))){_0x1240aa[_0x75db('0x1e')]=qs[_0x75db('0x1e')](_0x5d0528[_0x75db('0x33')][_0x75db('0x1e')]);_0x1240aa[_0x75db('0x3b')]=qs[_0x75db('0x3b')](_0x5d0528[_0x75db('0x33')]['offset']);}_0x1240aa['order']=qs[_0x75db('0x3c')](_0x5d0528[_0x75db('0x33')][_0x75db('0x3c')]);_0x1240aa[_0x75db('0x3d')]=qs[_0x75db('0x34')](_[_0x75db('0x3e')](_0x5d0528['query'],_0x424f42[_0x75db('0x34')]),_0x233878);if(_0x5d0528[_0x75db('0x33')]['filter']){_0x1240aa['where']=_[_0x75db('0x3f')](_0x1240aa[_0x75db('0x3d')],{'$or':_[_0x75db('0x32')](_0x233878,function(_0x13b5ec){if(_0x13b5ec[_0x75db('0x2f')]!==_0x75db('0x40')){var _0x4baaeb={};_0x4baaeb[_0x13b5ec['name']]={'$like':'%'+_0x5d0528['query'][_0x75db('0x41')]+'%'};return _0x4baaeb;}})});}_0x1240aa=_[_0x75db('0x3f')]({},_0x1240aa,_0x5d0528[_0x75db('0x42')]);var _0x54c764={'where':_0x1240aa[_0x75db('0x3d')]};return db[_0x75db('0x43')]['count'](_0x54c764)[_0x75db('0x25')](function(_0x3af66d){_0x48b423['count']=_0x3af66d;if(_0x5d0528[_0x75db('0x33')][_0x75db('0x44')]){_0x1240aa[_0x75db('0x45')]=[{'all':!![]}];}return db[_0x75db('0x43')][_0x75db('0x46')](_0x1240aa);})[_0x75db('0x25')](function(_0x2b7ec5){_0x48b423[_0x75db('0x47')]=_0x2b7ec5;return _0x48b423;})[_0x75db('0x25')](respondWithFilteredResult(_0x383f2c,_0x1240aa))[_0x75db('0x48')](handleError(_0x383f2c,null));};exports[_0x75db('0x49')]=function(_0x28bbc0,_0x40f7df){var _0x39cc2e={'raw':!![],'where':{'id':_0x28bbc0[_0x75db('0x4a')]['id']}},_0x4a5b39={};_0x4a5b39['model']=_[_0x75db('0x4b')](db[_0x75db('0x43')][_0x75db('0x2d')]);_0x4a5b39[_0x75db('0x33')]=_['keys'](_0x28bbc0[_0x75db('0x33')]);_0x4a5b39[_0x75db('0x34')]=_[_0x75db('0x35')](_0x4a5b39[_0x75db('0x31')],_0x4a5b39['query']);_0x39cc2e[_0x75db('0x36')]=_['intersection'](_0x4a5b39[_0x75db('0x31')],qs[_0x75db('0x37')](_0x28bbc0[_0x75db('0x33')][_0x75db('0x37')]));_0x39cc2e[_0x75db('0x36')]=_0x39cc2e[_0x75db('0x36')]['length']?_0x39cc2e[_0x75db('0x36')]:_0x4a5b39[_0x75db('0x31')];if(_0x28bbc0[_0x75db('0x33')][_0x75db('0x44')]){_0x39cc2e[_0x75db('0x45')]=[{'all':!![]}];}_0x39cc2e=_[_0x75db('0x3f')]({},_0x39cc2e,_0x28bbc0[_0x75db('0x42')]);return db[_0x75db('0x43')][_0x75db('0x4c')](_0x39cc2e)[_0x75db('0x25')](handleEntityNotFound(_0x40f7df,null))[_0x75db('0x25')](respondWithResult(_0x40f7df,null))[_0x75db('0x48')](handleError(_0x40f7df,null));};exports[_0x75db('0x4d')]=function(_0xa5abb6,_0x595283){return db[_0x75db('0x43')][_0x75db('0x4d')](_0xa5abb6['body'],{})['then'](function(_0x80aa80){var _0x15d1f6=_0xa5abb6[_0x75db('0x4e')][_0x75db('0x4f')]({'plain':!![]});if(!_0x15d1f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15d1f6[_0x75db('0x50')]==='user'){var _0x2377d2=_0x80aa80[_0x75db('0x4f')]({'plain':!![]});var _0x5536cb='Variables';return db[_0x75db('0x51')][_0x75db('0x4c')]({'where':{'name':_0x5536cb,'userProfileId':_0x15d1f6['userProfileId']},'raw':!![]})[_0x75db('0x25')](function(_0x40e47b){if(_0x40e47b&&_0x40e47b[_0x75db('0x52')]===0x0){return db[_0x75db('0x28')][_0x75db('0x4d')]({'name':_0x2377d2[_0x75db('0x2a')],'resourceId':_0x2377d2['id'],'type':_0x40e47b[_0x75db('0x2a')],'sectionId':_0x40e47b['id']},{})[_0x75db('0x25')](function(){return _0x80aa80;});}else{return _0x80aa80;}})[_0x75db('0x48')](function(_0x211912){logger[_0x75db('0x29')](_0x75db('0x53'),_0x211912);throw _0x211912;});}return _0x80aa80;})['then'](respondWithResult(_0x595283,0xc9))[_0x75db('0x48')](handleError(_0x595283,null));};exports[_0x75db('0x54')]=function(_0x45d4ed,_0x4cc0fd){if(_0x45d4ed[_0x75db('0x55')]['id']){delete _0x45d4ed[_0x75db('0x55')]['id'];}return db['Variable'][_0x75db('0x4c')]({'where':{'id':_0x45d4ed[_0x75db('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cc0fd,null))[_0x75db('0x25')](saveUpdates(_0x45d4ed[_0x75db('0x55')],null))[_0x75db('0x25')](respondWithResult(_0x4cc0fd,null))[_0x75db('0x48')](handleError(_0x4cc0fd,null));};exports[_0x75db('0x26')]=function(_0x45fb07,_0x5d6299){return db['Variable'][_0x75db('0x4c')]({'where':{'id':_0x45fb07[_0x75db('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d6299,null))[_0x75db('0x25')](removeEntity(_0x5d6299,null))['catch'](handleError(_0x5d6299,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index df2c9e2..feba180 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 _0xaf2f=['../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x1bb0ab,_0x4ed620){var _0x13336d=function(_0x5e1ba8){while(--_0x5e1ba8){_0x1bb0ab['push'](_0x1bb0ab['shift']());}};_0x13336d(++_0x4ed620);}(_0xaf2f,0x125));var _0xfaf2=function(_0x5b09bf,_0xa6f27c){_0x5b09bf=_0x5b09bf-0x0;var _0x13d26b=_0xaf2f[_0x5b09bf];return _0x13d26b;};'use strict';var _=require(_0xfaf2('0x0'));var util=require(_0xfaf2('0x1'));var logger=require('../../config/logger')(_0xfaf2('0x2'));var moment=require(_0xfaf2('0x3'));var BPromise=require(_0xfaf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaf2('0x5'));var rimraf=require(_0xfaf2('0x6'));var config=require(_0xfaf2('0x7'));var attributes=require(_0xfaf2('0x8'));module['exports']=function(_0x50a423,_0x40f6fe){return _0x50a423[_0xfaf2('0x9')](_0xfaf2('0xa'),attributes,{'tableName':_0xfaf2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf34=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash'];(function(_0x5246be,_0xee72a2){var _0x5ad94e=function(_0x55d27e){while(--_0x55d27e){_0x5246be['push'](_0x5246be['shift']());}};_0x5ad94e(++_0xee72a2);}(_0xcf34,0x15d));var _0x4cf3=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0xcf34[_0x284807];return _0x50c774;};'use strict';var _=require(_0x4cf3('0x0'));var util=require(_0x4cf3('0x1'));var logger=require(_0x4cf3('0x2'))(_0x4cf3('0x3'));var moment=require(_0x4cf3('0x4'));var BPromise=require(_0x4cf3('0x5'));var rp=require(_0x4cf3('0x6'));var fs=require('fs');var path=require(_0x4cf3('0x7'));var rimraf=require(_0x4cf3('0x8'));var config=require(_0x4cf3('0x9'));var attributes=require('./variable.attributes');module[_0x4cf3('0xa')]=function(_0x4cffd1,_0x4679b2){return _0x4cffd1[_0x4cf3('0xb')](_0x4cf3('0xc'),attributes,{'tableName':_0x4cf3('0xd'),'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 f40bc0b..e5a47cb 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x55b890,_0x25ebcd){var _0x145a3b=function(_0x38b805){while(--_0x38b805){_0x55b890['push'](_0x55b890['shift']());}};_0x145a3b(++_0x25ebcd);}(_0x6aa7,0x178));var _0x76aa=function(_0x1d2a74,_0x5ec11c){_0x1d2a74=_0x1d2a74-0x0;var _0x2c937a=_0x6aa7[_0x1d2a74];return _0x2c937a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x17ef56,_0x374f14){var _0xf75b6f=function(_0x625b91){while(--_0x625b91){_0x17ef56['push'](_0x17ef56['shift']());}};_0xf75b6f(++_0x374f14);}(_0xe14b,0x93));var _0xbe14=function(_0x3c7e04,_0xb41daf){_0x3c7e04=_0x3c7e04-0x0;var _0xa700fa=_0xe14b[_0x3c7e04];return _0xa700fa;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 3aca254..c04dc14 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 _0x946e=['index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x946e,0x183));var _0xe946=function(_0x4dcb70,_0x1befe7){_0x4dcb70=_0x4dcb70-0x0;var _0x2941d5=_0x946e[_0x4dcb70];return _0x2941d5;};'use strict';var express=require(_0xe946('0x0'));var router=express[_0xe946('0x1')]();var auth=require(_0xe946('0x2'));var controller=require('./version.controller');router[_0xe946('0x3')]('/',controller[_0xe946('0x4')]);router[_0xe946('0x3')](_0xe946('0x5'),auth[_0xe946('0x6')](),auth[_0xe946('0x7')](),controller['fetch']);router[_0xe946('0x3')](_0xe946('0x8'),auth[_0xe946('0x6')](),auth[_0xe946('0x7')](),controller[_0xe946('0x9')]);router[_0xe946('0x3')](_0xe946('0xa'),auth[_0xe946('0x6')](),auth['canUpdate'](),controller[_0xe946('0xb')]);router[_0xe946('0x3')](_0xe946('0xc'),auth[_0xe946('0x6')](),controller[_0xe946('0xd')]);router[_0xe946('0x3')](_0xe946('0xe'),controller[_0xe946('0xf')]);module[_0xe946('0x10')]=router; \ No newline at end of file +var _0x3b0a=['isAuthenticated','/restart','restart','/migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','reset','/pull'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3b0a,0x1e5));var _0xa3b0=function(_0x3e6399,_0x3cb124){_0x3e6399=_0x3e6399-0x0;var _0x4ec2f8=_0x3b0a[_0x3e6399];return _0x4ec2f8;};'use strict';var express=require(_0xa3b0('0x0'));var router=express['Router']();var auth=require(_0xa3b0('0x1'));var controller=require(_0xa3b0('0x2'));router[_0xa3b0('0x3')]('/',controller[_0xa3b0('0x4')]);router[_0xa3b0('0x3')](_0xa3b0('0x5'),auth['isAuthenticated'](),auth[_0xa3b0('0x6')](),controller[_0xa3b0('0x7')]);router['get'](_0xa3b0('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa3b0('0x9')]);router[_0xa3b0('0x3')](_0xa3b0('0xa'),auth[_0xa3b0('0xb')](),auth[_0xa3b0('0x6')](),controller['pull']);router['get'](_0xa3b0('0xc'),auth[_0xa3b0('0xb')](),controller[_0xa3b0('0xd')]);router[_0xa3b0('0x3')](_0xa3b0('0xe'),controller['migrations']);module[_0xa3b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a37492f..88a9a6f 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 _0x2878=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','index','version','query','fetch','latest','exports','status','json','origin','master'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2878,0x89));var _0x8287=function(_0x47f852,_0x106cdb){_0x47f852=_0x47f852-0x0;var _0xead19e=_0x2878[_0x47f852];return _0xead19e;};'use strict';var Umzug=require(_0x8287('0x0'));var path=require(_0x8287('0x1'));var fs=require('fs');var _=require(_0x8287('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x8287('0x3'));var exec=require('child_process')[_0x8287('0x4')];var db=require(_0x8287('0x5'))['db'];var config=require(_0x8287('0x6'));var pm2=require(_0x8287('0x7'));var logger=require(_0x8287('0x8'))('update');var git=require('simple-git')(config['root']);exports[_0x8287('0x9')]=function(_0x15f613,_0x23ba65){var _0x5f4f90={'current':module['exports'][_0x8287('0xa')],'phonebar':0x2};if(_0x15f613[_0x8287('0xb')]&&_0x15f613[_0x8287('0xb')]['latest']){return git[_0x8287('0xc')]()['tags'](function(_0x2bbdfe,_0x773672){_0x5f4f90[_0x8287('0xd')]=(_0x2bbdfe?module[_0x8287('0xe')]['version']:_0x773672[_0x8287('0xd')])||'2.0.0';return _0x23ba65[_0x8287('0xf')](0xc8)[_0x8287('0x10')](_0x5f4f90);});}else{return _0x23ba65[_0x8287('0xf')](0xc8)[_0x8287('0x10')](_0x5f4f90);}};exports[_0x8287('0xc')]=function(_0x54ae3d,_0x33e157){return git['fetch']([_0x8287('0x11'),_0x8287('0x12')],function(_0x1114a5){if(_0x1114a5){logger[_0x8287('0x13')](_0x1114a5);return _0x33e157['status'](0x1f4)[_0x8287('0x10')](_0x1114a5);}logger[_0x8287('0x14')](_0x8287('0x15'));return _0x33e157[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x16')});});};exports[_0x8287('0x17')]=function(_0x534ef1,_0x25e36c){return git[_0x8287('0x17')]([_0x8287('0x18'),_0x8287('0x19')],function(_0x7d52df){if(_0x7d52df){logger[_0x8287('0x13')](_0x7d52df);return _0x25e36c[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x7d52df);}logger[_0x8287('0x14')](_0x8287('0x1a'));return _0x25e36c['status'](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x1b')});});};exports[_0x8287('0x1c')]=function(_0x58dc7b,_0x1e0c1e){exec(_0x8287('0x1d'),function(_0x53c991,_0x44d993,_0x30fbff){logger[_0x8287('0x14')](_0x44d993);logger[_0x8287('0x14')](_0x30fbff);if(_0x53c991){logger[_0x8287('0x13')](_0x53c991);return _0x1e0c1e[_0x8287('0xf')](0x1f4)['json'](_0x53c991);}return _0x1e0c1e[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x44d993});});};exports['restart']=function(_0x249964,_0x3f0996){return pm2[_0x8287('0x1e')]('motion2')[_0x8287('0x1f')](function(_0xd0b9a0){logger[_0x8287('0x14')](_0x8287('0x20'),_0xd0b9a0);return _0x3f0996['status'](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x21')});})[_0x8287('0x22')](function(_0x3274ee){logger['error'](_0x3274ee);return _0x3f0996[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x3274ee);});};exports[_0x8287('0x23')]=function(_0x36a1af,_0xf21265){var _0x1ac6db=fs[_0x8287('0x24')](path[_0x8287('0x25')](config['root'],_0x8287('0x26'),_0x8287('0x23')));var _0x529cc0=[];for(var _0x1a7473=0x0;_0x1a7473<_0x1ac6db[_0x8287('0x27')];_0x1a7473++){var _0x3b197c=_0x1ac6db[_0x1a7473]['replace'](_0x8287('0x28'),'');if(compareVersions(module[_0x8287('0xe')][_0x8287('0xa')],_0x3b197c)===-0x1){_0x529cc0[_0x8287('0x29')](_0x3b197c);}}if(_0x529cc0[_0x8287('0x27')]){var _0x228390=_0x529cc0[_0x8287('0x2a')](compareVersions);var _0x21bccd=new Umzug({'storage':_0x8287('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x8287('0x2c'),'columnName':_0x8287('0xa')},'migrations':{'params':[db[_0x8287('0x2b')][_0x8287('0x2d')](),db[_0x8287('0x2b')][_0x8287('0x2e')],function(){throw new Error(_0x8287('0x2f'));}],'path':path[_0x8287('0x25')](config[_0x8287('0x30')],'server',_0x8287('0x23')),'pattern':/\.js$/}});_0x21bccd['up']({'migrations':_[_0x8287('0x31')](_0x228390,function(_0x14ef82){return _0x14ef82+_0x8287('0x28');})})[_0x8287('0x1f')](function(){return _0xf21265['status'](0xc8)[_0x8287('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x8287('0xa')]+_0x8287('0x32')+_['last'](_0x228390),'migrations':_[_0x8287('0x25')](_0x228390)});})[_0x8287('0x22')](function(_0x3b1ae4){if(_0x3b1ae4 instanceof db[_0x8287('0x2b')]['UniqueConstraintError']){return _0xf21265[_0x8287('0xf')](0xc8)['json']({'output':_0x8287('0x33')});}else{return _0xf21265[_0x8287('0xf')](0x1f4)[_0x8287('0x10')](_0x3b1ae4);}});}else{return _0xf21265[_0x8287('0xf')](0xc8)[_0x8287('0x10')]({'output':_0x8287('0x33')});}}; \ No newline at end of file +var _0x1910=['root','index','query','latest','fetch','tags','2.0.0','json','status','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','length','replace','.js','exports','push','sort','Migration','sequelize','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0x1910,0x1d6));var _0x0191=function(_0x1d3750,_0x271ae1){_0x1d3750=_0x1d3750-0x0;var _0x218de3=_0x1910[_0x1d3750];return _0x218de3;};'use strict';var Umzug=require(_0x0191('0x0'));var path=require(_0x0191('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x0191('0x2'));var compareVersions=require(_0x0191('0x3'));var exec=require('child_process')[_0x0191('0x4')];var db=require(_0x0191('0x5'))['db'];var config=require(_0x0191('0x6'));var pm2=require(_0x0191('0x7'));var logger=require('../../config/logger')(_0x0191('0x8'));var git=require(_0x0191('0x9'))(config[_0x0191('0xa')]);exports[_0x0191('0xb')]=function(_0x2ed827,_0x46f791){var _0x539819={'current':module['exports'][_0x0191('0x2')],'phonebar':0x2};if(_0x2ed827[_0x0191('0xc')]&&_0x2ed827[_0x0191('0xc')][_0x0191('0xd')]){return git[_0x0191('0xe')]()[_0x0191('0xf')](function(_0x45be59,_0x2faa8f){_0x539819[_0x0191('0xd')]=(_0x45be59?module['exports'][_0x0191('0x2')]:_0x2faa8f[_0x0191('0xd')])||_0x0191('0x10');return _0x46f791['status'](0xc8)[_0x0191('0x11')](_0x539819);});}else{return _0x46f791[_0x0191('0x12')](0xc8)['json'](_0x539819);}};exports[_0x0191('0xe')]=function(_0x1cd0b1,_0x5592e7){return git['fetch'](['origin',_0x0191('0x13')],function(_0x2b6be4){if(_0x2b6be4){logger[_0x0191('0x14')](_0x2b6be4);return _0x5592e7['status'](0x1f4)[_0x0191('0x11')](_0x2b6be4);}logger[_0x0191('0x15')]('git\x20fetch');return _0x5592e7[_0x0191('0x12')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x0191('0x16')]=function(_0x2be731,_0x2c26de){return git[_0x0191('0x16')]([_0x0191('0x17'),_0x0191('0x18')],function(_0x5080d9){if(_0x5080d9){logger['error'](_0x5080d9);return _0x2c26de['status'](0x1f4)[_0x0191('0x11')](_0x5080d9);}logger['info'](_0x0191('0x19'));return _0x2c26de[_0x0191('0x12')](0xc8)[_0x0191('0x11')]({'output':_0x0191('0x1a')});});};exports['pull']=function(_0x164da8,_0x4e94b5){exec(_0x0191('0x1b'),function(_0x41d281,_0x35e4ed,_0x3efcb0){logger[_0x0191('0x15')](_0x35e4ed);logger[_0x0191('0x15')](_0x3efcb0);if(_0x41d281){logger[_0x0191('0x14')](_0x41d281);return _0x4e94b5[_0x0191('0x12')](0x1f4)[_0x0191('0x11')](_0x41d281);}return _0x4e94b5[_0x0191('0x12')](0xc8)['json']({'output':_0x35e4ed});});};exports['restart']=function(_0x1d4d59,_0x4b720a){return pm2[_0x0191('0x1c')]('motion2')[_0x0191('0x1d')](function(_0x42667b){logger['info'](_0x0191('0x1e'),_0x42667b);return _0x4b720a[_0x0191('0x12')](0xc8)[_0x0191('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x41671d){logger['error'](_0x41671d);return _0x4b720a[_0x0191('0x12')](0x1f4)[_0x0191('0x11')](_0x41671d);});};exports[_0x0191('0x1f')]=function(_0x53e03b,_0x542241){var _0x9392e2=fs[_0x0191('0x20')](path[_0x0191('0x21')](config[_0x0191('0xa')],'server',_0x0191('0x1f')));var _0x15569b=[];for(var _0x34cb5d=0x0;_0x34cb5d<_0x9392e2[_0x0191('0x22')];_0x34cb5d++){var _0x3f87a7=_0x9392e2[_0x34cb5d][_0x0191('0x23')](_0x0191('0x24'),'');if(compareVersions(module[_0x0191('0x25')][_0x0191('0x2')],_0x3f87a7)===-0x1){_0x15569b[_0x0191('0x26')](_0x3f87a7);}}if(_0x15569b[_0x0191('0x22')]){var _0xb0a598=_0x15569b[_0x0191('0x27')](compareVersions);var _0x46aa2c=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x0191('0x28')],'modelName':_0x0191('0x28'),'columnName':_0x0191('0x2')},'migrations':{'params':[db[_0x0191('0x29')]['getQueryInterface'](),db[_0x0191('0x29')]['constructor'],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['join'](config[_0x0191('0xa')],'server',_0x0191('0x1f')),'pattern':/\.js$/}});_0x46aa2c['up']({'migrations':_[_0x0191('0x2a')](_0xb0a598,function(_0xb9c9a9){return _0xb9c9a9+_0x0191('0x24');})})[_0x0191('0x1d')](function(){return _0x542241['status'](0xc8)['json']({'output':_0x0191('0x2b')+module[_0x0191('0x25')][_0x0191('0x2')]+_0x0191('0x2c')+_[_0x0191('0x2d')](_0xb0a598),'migrations':_['join'](_0xb0a598)});})['catch'](function(_0x9cad99){if(_0x9cad99 instanceof db['sequelize'][_0x0191('0x2e')]){return _0x542241[_0x0191('0x12')](0xc8)[_0x0191('0x11')]({'output':_0x0191('0x2f')});}else{return _0x542241[_0x0191('0x12')](0x1f4)['json'](_0x9cad99);}});}else{return _0x542241[_0x0191('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b45ab30..0b40886 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 _0x4d5e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x155a36,_0x4bf39){var _0x3c99d0=function(_0x2ff601){while(--_0x2ff601){_0x155a36['push'](_0x155a36['shift']());}};_0x3c99d0(++_0x4bf39);}(_0x4d5e,0x15e));var _0xe4d5=function(_0x573365,_0x1538c8){_0x573365=_0x573365-0x0;var _0x232050=_0x4d5e[_0x573365];return _0x232050;};'use strict';var multer=require(_0xe4d5('0x0'));var util=require(_0xe4d5('0x1'));var path=require('path');var timeout=require(_0xe4d5('0x2'));var express=require(_0xe4d5('0x3'));var router=express[_0xe4d5('0x4')]();var fs_extra=require(_0xe4d5('0x5'));var auth=require(_0xe4d5('0x6'));var interaction=require(_0xe4d5('0x7'));var config=require(_0xe4d5('0x8'));var controller=require('./voiceAgentReport.controller');router[_0xe4d5('0x9')]('/',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xb')]);router[_0xe4d5('0x9')]('/describe',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xc')]);router[_0xe4d5('0x9')](_0xe4d5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4d5('0xe')]('/',auth[_0xe4d5('0xa')](),controller[_0xe4d5('0xf')]);router[_0xe4d5('0x10')](_0xe4d5('0xd'),auth['isAuthenticated'](),controller[_0xe4d5('0x11')]);router[_0xe4d5('0x12')](_0xe4d5('0xd'),auth[_0xe4d5('0xa')](),controller[_0xe4d5('0x13')]);module[_0xe4d5('0x14')]=router; \ No newline at end of file +var _0x0629=['./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48dd9c,_0x48f8b2){var _0x383bbb=function(_0x5a1bd5){while(--_0x5a1bd5){_0x48dd9c['push'](_0x48dd9c['shift']());}};_0x383bbb(++_0x48f8b2);}(_0x0629,0xdc));var _0x9062=function(_0x3fa419,_0x56e33c){_0x3fa419=_0x3fa419-0x0;var _0x3b32ac=_0x0629[_0x3fa419];return _0x3b32ac;};'use strict';var multer=require(_0x9062('0x0'));var util=require(_0x9062('0x1'));var path=require(_0x9062('0x2'));var timeout=require(_0x9062('0x3'));var express=require(_0x9062('0x4'));var router=express[_0x9062('0x5')]();var fs_extra=require(_0x9062('0x6'));var auth=require(_0x9062('0x7'));var interaction=require(_0x9062('0x8'));var config=require(_0x9062('0x9'));var controller=require(_0x9062('0xa'));router['get']('/',auth[_0x9062('0xb')](),controller[_0x9062('0xc')]);router[_0x9062('0xd')](_0x9062('0xe'),auth[_0x9062('0xb')](),controller[_0x9062('0xf')]);router['get']('/:id',auth[_0x9062('0xb')](),controller[_0x9062('0x10')]);router[_0x9062('0x11')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0x12')]);router[_0x9062('0x13')](_0x9062('0x14'),auth[_0x9062('0xb')](),controller['update']);router[_0x9062('0x15')](_0x9062('0x14'),auth[_0x9062('0xb')](),controller[_0x9062('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1a93fc6..dbadb2a 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 _0xc6a2=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x179b80,_0x440291){var _0x1e8d03=function(_0x466a71){while(--_0x466a71){_0x179b80['push'](_0x179b80['shift']());}};_0x1e8d03(++_0x440291);}(_0xc6a2,0x69));var _0x2c6a=function(_0xc32101,_0xf70d3){_0xc32101=_0xc32101-0x0;var _0x562c60=_0xc6a2[_0xc32101];return _0x562c60;};'use strict';var Sequelize=require(_0x2c6a('0x0'));module[_0x2c6a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'calleridnum':{'type':Sequelize[_0x2c6a('0x2')]},'calleridname':{'type':Sequelize[_0x2c6a('0x2')]},'queue':{'type':Sequelize[_0x2c6a('0x2')]},'interface':{'type':Sequelize[_0x2c6a('0x2')]},'membername':{'type':Sequelize[_0x2c6a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2c6a('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2c6a('0x3')]},'holdtime':{'type':Sequelize[_0x2c6a('0x4')]},'agentcomplete':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2c6a('0x4')]},'agentacw':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c6a('0x4')]},'reason':{'type':Sequelize[_0x2c6a('0x2')]},'lastevent':{'type':Sequelize[_0x2c6a('0x2')]},'channel':{'type':Sequelize[_0x2c6a('0x2')]},'channelstate':{'type':Sequelize[_0x2c6a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2c6a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2c6a('0x2')]},'accountcode':{'type':Sequelize[_0x2c6a('0x2')]},'context':{'type':Sequelize[_0x2c6a('0x2')]},'exten':{'type':Sequelize[_0x2c6a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2c6a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2c6a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2c6a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2c6a('0x2')]},'destaccountcode':{'type':Sequelize[_0x2c6a('0x2')]},'destcontext':{'type':Sequelize[_0x2c6a('0x2')]},'destexten':{'type':Sequelize[_0x2c6a('0x2')]},'destpriority':{'type':Sequelize[_0x2c6a('0x2')]},'destuniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2c6a('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2c6a('0x2')]},'transfer':{'type':Sequelize[_0x2c6a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2c6a('0x6')},'transferexten':{'type':Sequelize[_0x2c6a('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x2c6a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x1b25a3,_0x104c5b){var _0x3080fa=function(_0x36a09c){while(--_0x36a09c){_0x1b25a3['push'](_0x1b25a3['shift']());}};_0x3080fa(++_0x104c5b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'type':{'type':Sequelize[_0x0baf('0x1')]},'uniqueid':{'type':Sequelize[_0x0baf('0x1')]},'calleridnum':{'type':Sequelize[_0x0baf('0x1')]},'calleridname':{'type':Sequelize[_0x0baf('0x1')]},'queue':{'type':Sequelize[_0x0baf('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0baf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x0baf('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0baf('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x0baf('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x0baf('0x2')]},'agentdumpAt':{'type':Sequelize[_0x0baf('0x2')]},'holdtime':{'type':Sequelize[_0x0baf('0x3')]},'agentcomplete':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0baf('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0baf('0x3')]},'reason':{'type':Sequelize[_0x0baf('0x1')]},'lastevent':{'type':Sequelize[_0x0baf('0x1')]},'channel':{'type':Sequelize[_0x0baf('0x1')]},'channelstate':{'type':Sequelize[_0x0baf('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0baf('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0baf('0x1')]},'connectedlinename':{'type':Sequelize[_0x0baf('0x1')]},'language':{'type':Sequelize[_0x0baf('0x1')]},'accountcode':{'type':Sequelize[_0x0baf('0x1')]},'context':{'type':Sequelize[_0x0baf('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0baf('0x1')]},'destchannelstate':{'type':Sequelize[_0x0baf('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x0baf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0baf('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0baf('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0baf('0x1')]},'destaccountcode':{'type':Sequelize[_0x0baf('0x1')]},'destcontext':{'type':Sequelize[_0x0baf('0x1')]},'destexten':{'type':Sequelize[_0x0baf('0x1')]},'destpriority':{'type':Sequelize[_0x0baf('0x1')]},'destuniqueid':{'type':Sequelize[_0x0baf('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0baf('0x1')],'comment':_0x0baf('0x5')},'transferexten':{'type':Sequelize[_0x0baf('0x1')]},'transferuniqueid':{'type':Sequelize[_0x0baf('0x1')]},'agententerreason':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 213b73f..27bfb4e 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index beb49e3..188be1a 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 _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','destuniqueid'];(function(_0x22b202,_0x4006c8){var _0x3bc1a5=function(_0x6461c){while(--_0x6461c){_0x22b202['push'](_0x22b202['shift']());}};_0x3bc1a5(++_0x4006c8);}(_0x008c,0x188));var _0xc008=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0x008c[_0x458848];return _0x20469e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceAgentReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc008('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d25=['exports','define','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1d25,0xba));var _0x51d2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x1d25[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x51d2('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x51d2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b83ebf3..ccbb449 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 _0xa057=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','limit','util'];(function(_0xb303a0,_0x4b75ae){var _0x5e8e40=function(_0x3aa03b){while(--_0x3aa03b){_0xb303a0['push'](_0xb303a0['shift']());}};_0x5e8e40(++_0x4b75ae);}(_0xa057,0x116));var _0x7a05=function(_0x3cfcf4,_0x51a565){_0x3cfcf4=_0x3cfcf4-0x0;var _0x36924e=_0xa057[_0x3cfcf4];return _0x36924e;};'use strict';var _=require('lodash');var util=require(_0x7a05('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7a05('0x1'));var fs=require('fs');var Redis=require(_0x7a05('0x2'));var db=require(_0x7a05('0x3'))['db'];var utils=require(_0x7a05('0x4'));var logger=require(_0x7a05('0x5'))(_0x7a05('0x6'));var config=require(_0x7a05('0x7'));var jayson=require(_0x7a05('0x8'));var client=jayson[_0x7a05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e66c6,_0x128f98,_0x36c975){return new BPromise(function(_0x483327,_0x25e35d){return client[_0x7a05('0xa')](_0x1e66c6,_0x36c975)[_0x7a05('0xb')](function(_0x3b329d){logger[_0x7a05('0xc')](_0x7a05('0xd'),_0x128f98,_0x7a05('0xe'));logger[_0x7a05('0xf')](_0x7a05('0x10'),_0x128f98,_0x7a05('0xe'),JSON[_0x7a05('0x11')](_0x3b329d));if(_0x3b329d[_0x7a05('0x12')]){if(_0x3b329d[_0x7a05('0x12')][_0x7a05('0x13')]===0x1f4){logger[_0x7a05('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x128f98,_0x3b329d[_0x7a05('0x12')][_0x7a05('0x14')]);return _0x25e35d(_0x3b329d[_0x7a05('0x12')][_0x7a05('0x14')]);}logger[_0x7a05('0x12')](_0x7a05('0xd'),_0x128f98,_0x3b329d['error']['message']);return _0x483327(_0x3b329d[_0x7a05('0x12')]['message']);}else{logger[_0x7a05('0xc')](_0x7a05('0xd'),_0x128f98,_0x7a05('0xe'));_0x483327(_0x3b329d['result'][_0x7a05('0x14')]);}})[_0x7a05('0x15')](function(_0x4b0ff6){logger[_0x7a05('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x128f98,_0x4b0ff6);_0x25e35d(_0x4b0ff6);});});}exports['CreateVoiceAgentReport']=function(_0x53510f){var _0x3f4eb8=this;return new Promise(function(_0x241bf,_0x3e9626){return db[_0x7a05('0x16')][_0x7a05('0x17')](_0x53510f['body'],{'raw':_0x53510f[_0x7a05('0x18')]?_0x53510f[_0x7a05('0x18')][_0x7a05('0x19')]===undefined?!![]:![]:!![]})[_0x7a05('0xb')](function(_0x424ad0){logger[_0x7a05('0xc')](_0x7a05('0x1a'),_0x53510f);logger[_0x7a05('0xf')](_0x7a05('0x1a'),_0x53510f,JSON[_0x7a05('0x11')](_0x424ad0));_0x241bf(_0x424ad0);})['catch'](function(_0x676898){logger[_0x7a05('0x12')](_0x7a05('0x1a'),_0x676898[_0x7a05('0x14')],_0x53510f);_0x3e9626(_0x3f4eb8[_0x7a05('0x12')](0x1f4,_0x676898[_0x7a05('0x14')]));});});};exports[_0x7a05('0x1b')]=function(_0x52d2e4){var _0x5dbe5f=this;return new Promise(function(_0x3e02cf,_0x143782){return db['VoiceAgentReport'][_0x7a05('0x1c')](_0x52d2e4['body'],{'raw':_0x52d2e4['options']?_0x52d2e4[_0x7a05('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')]['where']||null:null,'attributes':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')][_0x7a05('0x1d')]||null:null,'limit':_0x52d2e4[_0x7a05('0x18')]?_0x52d2e4[_0x7a05('0x18')][_0x7a05('0x1e')]||null:null})[_0x7a05('0xb')](function(_0x5986dd){logger['info'](_0x7a05('0x1b'),_0x52d2e4);logger['debug'](_0x7a05('0x1b'),_0x52d2e4,JSON[_0x7a05('0x11')](_0x5986dd));_0x3e02cf(_0x5986dd);})['catch'](function(_0x390801){logger['error'](_0x7a05('0x1b'),_0x390801[_0x7a05('0x14')],_0x52d2e4);_0x143782(_0x5dbe5f[_0x7a05('0x12')](0x1f4,_0x390801['message']));});});}; \ No newline at end of file +var _0x5205=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5205,0xfc));var _0x5520=function(_0xb9b8b4,_0x3e8504){_0xb9b8b4=_0xb9b8b4-0x0;var _0xd5b630=_0x5205[_0xb9b8b4];return _0xd5b630;};'use strict';var _=require(_0x5520('0x0'));var util=require('util');var moment=require(_0x5520('0x1'));var BPromise=require(_0x5520('0x2'));var rs=require(_0x5520('0x3'));var fs=require('fs');var Redis=require(_0x5520('0x4'));var db=require(_0x5520('0x5'))['db'];var utils=require(_0x5520('0x6'));var logger=require(_0x5520('0x7'))(_0x5520('0x8'));var config=require(_0x5520('0x9'));var jayson=require(_0x5520('0xa'));var client=jayson[_0x5520('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe038,_0x1d0f43,_0x12e098){return new BPromise(function(_0x36a22e,_0x2f89c0){return client[_0x5520('0xc')](_0x2fe038,_0x12e098)['then'](function(_0x557429){logger[_0x5520('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d0f43,'request\x20sent');logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1d0f43,_0x5520('0xe'),JSON[_0x5520('0xf')](_0x557429));if(_0x557429[_0x5520('0x10')]){if(_0x557429[_0x5520('0x10')][_0x5520('0x11')]===0x1f4){logger[_0x5520('0x10')](_0x5520('0x12'),_0x1d0f43,_0x557429['error'][_0x5520('0x13')]);return _0x2f89c0(_0x557429[_0x5520('0x10')][_0x5520('0x13')]);}logger[_0x5520('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d0f43,_0x557429['error'][_0x5520('0x13')]);return _0x36a22e(_0x557429['error'][_0x5520('0x13')]);}else{logger['info'](_0x5520('0x12'),_0x1d0f43,_0x5520('0xe'));_0x36a22e(_0x557429[_0x5520('0x14')][_0x5520('0x13')]);}})[_0x5520('0x15')](function(_0x530c40){logger['error'](_0x5520('0x12'),_0x1d0f43,_0x530c40);_0x2f89c0(_0x530c40);});});}exports[_0x5520('0x16')]=function(_0x3aef61){var _0x5c4383=this;return new Promise(function(_0x982c3,_0x487fd2){return db[_0x5520('0x17')]['create'](_0x3aef61['body'],{'raw':_0x3aef61[_0x5520('0x18')]?_0x3aef61[_0x5520('0x18')][_0x5520('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x429c1e){logger[_0x5520('0xd')](_0x5520('0x16'),_0x3aef61);logger['debug'](_0x5520('0x16'),_0x3aef61,JSON[_0x5520('0xf')](_0x429c1e));_0x982c3(_0x429c1e);})[_0x5520('0x15')](function(_0x32fbe6){logger[_0x5520('0x10')](_0x5520('0x16'),_0x32fbe6[_0x5520('0x13')],_0x3aef61);_0x487fd2(_0x5c4383['error'](0x1f4,_0x32fbe6['message']));});});};exports[_0x5520('0x1a')]=function(_0x533e8b){var _0x161e08=this;return new Promise(function(_0x56565e,_0x531674){return db[_0x5520('0x17')][_0x5520('0x1b')](_0x533e8b[_0x5520('0x1c')],{'raw':_0x533e8b[_0x5520('0x18')]?_0x533e8b[_0x5520('0x18')][_0x5520('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x533e8b[_0x5520('0x18')]?_0x533e8b[_0x5520('0x18')][_0x5520('0x1d')]||null:null,'attributes':_0x533e8b[_0x5520('0x18')]?_0x533e8b[_0x5520('0x18')][_0x5520('0x1e')]||null:null,'limit':_0x533e8b[_0x5520('0x18')]?_0x533e8b['options'][_0x5520('0x1f')]||null:null})[_0x5520('0x20')](function(_0x191f5f){logger[_0x5520('0xd')](_0x5520('0x1a'),_0x533e8b);logger[_0x5520('0x21')](_0x5520('0x1a'),_0x533e8b,JSON[_0x5520('0xf')](_0x191f5f));_0x56565e(_0x191f5f);})[_0x5520('0x15')](function(_0x2d34f3){logger[_0x5520('0x10')](_0x5520('0x1a'),_0x2d34f3['message'],_0x533e8b);_0x531674(_0x161e08[_0x5520('0x10')](0x1f4,_0x2d34f3[_0x5520('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3ab1793..e81a2dd 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 _0x303a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','multer','path'];(function(_0x2f46f8,_0x197276){var _0x36f656=function(_0x4e46a7){while(--_0x4e46a7){_0x2f46f8['push'](_0x2f46f8['shift']());}};_0x36f656(++_0x197276);}(_0x303a,0x1a0));var _0xa303=function(_0x5ec21d,_0x5d0772){_0x5ec21d=_0x5ec21d-0x0;var _0x43bde8=_0x303a[_0x5ec21d];return _0x43bde8;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['show']);router[_0xa303('0xe')]('/',auth['isAuthenticated'](),controller[_0xa303('0xf')]);router['put'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller[_0xa303('0x10')]);router[_0xa303('0x11')]('/:id',auth[_0xa303('0xa')](),controller['destroy']);module[_0xa303('0x12')]=router; \ No newline at end of file +var _0x04de=['describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','/describe','isAuthenticated'];(function(_0x510a84,_0x2e9685){var _0x46dc68=function(_0x32a567){while(--_0x32a567){_0x510a84['push'](_0x510a84['shift']());}};_0x46dc68(++_0x2e9685);}(_0x04de,0x107));var _0xe04d=function(_0x4cc1ee,_0x1d08b7){_0x4cc1ee=_0x4cc1ee-0x0;var _0x14f5be=_0x04de[_0x4cc1ee];return _0x14f5be;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0xd')]);router[_0xe04d('0xe')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x10')]);router[_0xe04d('0x11')]('/',auth['isAuthenticated'](),controller[_0xe04d('0x12')]);router[_0xe04d('0x13')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x14')]);router[_0xe04d('0x15')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ade0c01..c989de6 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 _0xe9b4=['outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x42f0b9,_0x410ade){_0x42f0b9=_0x42f0b9-0x0;var _0x29dc58=_0xe9b4[_0x42f0b9];return _0x29dc58;};'use strict';var Sequelize=require('sequelize');module[_0x4e9b('0x0')]={'uniqueid':{'type':Sequelize[_0x4e9b('0x1')]},'type':{'type':Sequelize[_0x4e9b('0x2')](_0x4e9b('0x3'),_0x4e9b('0x4'),_0x4e9b('0x5'),_0x4e9b('0x6'),_0x4e9b('0x7'),_0x4e9b('0x8'))},'tag':{'type':Sequelize[_0x4e9b('0x1')]},'accountcode':{'type':Sequelize[_0x4e9b('0x1')]},'source':{'type':Sequelize[_0x4e9b('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4e9b('0x1')]},'channel':{'type':Sequelize[_0x4e9b('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4e9b('0x1')]},'lastdata':{'type':Sequelize[_0x4e9b('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4e9b('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4e9b('0xa')]},'duration':{'type':Sequelize[_0x4e9b('0xb')]},'billableseconds':{'type':Sequelize[_0x4e9b('0xb')]},'mohtime':{'type':Sequelize[_0x4e9b('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4e9b('0x1')]},'amaflags':{'type':Sequelize[_0x4e9b('0x1')]},'userfield':{'type':Sequelize[_0x4e9b('0x1')]},'userDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4e9b('0x1')]},'note':{'type':Sequelize[_0x4e9b('0x1')]},'prefix':{'type':Sequelize[_0x4e9b('0x1')]},'routeid':{'type':Sequelize[_0x4e9b('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1792=['inbound','internal','outbound','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x41cfe0,_0x1846ac){var _0x276abb=function(_0x561a2c){while(--_0x561a2c){_0x41cfe0['push'](_0x41cfe0['shift']());}};_0x276abb(++_0x1846ac);}(_0x1792,0x111));var _0x2179=function(_0xe97e4c,_0x486a93){_0xe97e4c=_0xe97e4c-0x0;var _0x2a2f09=_0x1792[_0xe97e4c];return _0x2a2f09;};'use strict';var Sequelize=require(_0x2179('0x0'));module[_0x2179('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2179('0x2')](_0x2179('0x3'),_0x2179('0x4'),_0x2179('0x5'),'inbound-fax',_0x2179('0x6'),_0x2179('0x7'))},'tag':{'type':Sequelize[_0x2179('0x8')]},'accountcode':{'type':Sequelize[_0x2179('0x8')]},'source':{'type':Sequelize[_0x2179('0x8')]},'destination':{'type':Sequelize[_0x2179('0x8')]},'destinationcontext':{'type':Sequelize[_0x2179('0x8')]},'callerid':{'type':Sequelize[_0x2179('0x8')]},'channel':{'type':Sequelize[_0x2179('0x8')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2179('0x8')]},'lastdata':{'type':Sequelize[_0x2179('0x9')]},'starttime':{'type':Sequelize[_0x2179('0xa')]},'systemanswertime':{'type':Sequelize[_0x2179('0xa')]},'answertime':{'type':Sequelize[_0x2179('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x2179('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2179('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2179('0x8')]},'amaflags':{'type':Sequelize[_0x2179('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2179('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x2179('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x2179('0x8')]},'note':{'type':Sequelize[_0x2179('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x2179('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c3cff79..03594c1 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xadb5,0xad));var _0x5adb=function(_0x4bcc07,_0x5ce2b0){_0x4bcc07=_0x4bcc07-0x0;var _0x1766f6=_0xadb5[_0x4bcc07];return _0x1766f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b9126,_0x472a5a){_0x3b9126=_0x3b9126-0x0;var _0x477365=_0x5f2f[_0x3b9126];return _0x477365;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 8d591d6..3424553 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 _0x372d=['uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x1c4d99,_0x1f4246){var _0xffb0c9=function(_0x4e82b2){while(--_0x4e82b2){_0x1c4d99['push'](_0x1c4d99['shift']());}};_0xffb0c9(++_0x1f4246);}(_0x372d,0x182));var _0xd372=function(_0x370704,_0x3b111b){_0x370704=_0x370704-0x0;var _0x193d59=_0x372d[_0x370704];return _0x193d59;};'use strict';var _=require(_0xd372('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd372('0x1'));var moment=require(_0xd372('0x2'));var BPromise=require('bluebird');var rp=require(_0xd372('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd372('0x4'));var config=require(_0xd372('0x5'));var attributes=require(_0xd372('0x6'));module[_0xd372('0x7')]=function(_0x261e4a,_0x123838){return _0x261e4a['define'](_0xd372('0x8'),attributes,{'tableName':_0xd372('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd372('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed5a=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x491bfd,_0x1ad7e8){var _0x4a90f1=function(_0x85483a){while(--_0x85483a){_0x491bfd['push'](_0x491bfd['shift']());}};_0x4a90f1(++_0x1ad7e8);}(_0xed5a,0xdc));var _0xaed5=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xed5a[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0xaed5('0x0'));var util=require(_0xaed5('0x1'));var logger=require(_0xaed5('0x2'))(_0xaed5('0x3'));var moment=require(_0xaed5('0x4'));var BPromise=require(_0xaed5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaed5('0x6'));var rimraf=require(_0xaed5('0x7'));var config=require(_0xaed5('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0xaed5('0x9')]=function(_0x5e466c,_0x4131e0){return _0x5e466c['define'](_0xaed5('0xa'),attributes,{'tableName':_0xaed5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xaed5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ad3309a..574db4e 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 _0xfa81=['VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetVoiceCallReport'];(function(_0x41805e,_0x3e14a0){var _0x17c141=function(_0x11a6a7){while(--_0x11a6a7){_0x41805e['push'](_0x41805e['shift']());}};_0x17c141(++_0x3e14a0);}(_0xfa81,0x112));var _0x1fa8=function(_0x2c6b4b,_0x260e7a){_0x2c6b4b=_0x2c6b4b-0x0;var _0x569863=_0xfa81[_0x2c6b4b];return _0x569863;};'use strict';var _=require(_0x1fa8('0x0'));var util=require(_0x1fa8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fa8('0x2'));var db=require(_0x1fa8('0x3'))['db'];var utils=require(_0x1fa8('0x4'));var logger=require(_0x1fa8('0x5'))(_0x1fa8('0x6'));var config=require(_0x1fa8('0x7'));var jayson=require(_0x1fa8('0x8'));var client=jayson[_0x1fa8('0x9')][_0x1fa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c719,_0x19ffdc,_0x11dca1){return new BPromise(function(_0x122750,_0x374a05){return client[_0x1fa8('0xb')](_0x58c719,_0x11dca1)[_0x1fa8('0xc')](function(_0x38407a){logger['info'](_0x1fa8('0xd'),_0x19ffdc,_0x1fa8('0xe'));logger[_0x1fa8('0xf')](_0x1fa8('0x10'),_0x19ffdc,_0x1fa8('0xe'),JSON['stringify'](_0x38407a));if(_0x38407a['error']){if(_0x38407a[_0x1fa8('0x11')]['code']===0x1f4){logger[_0x1fa8('0x11')](_0x1fa8('0xd'),_0x19ffdc,_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);return _0x374a05(_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);}logger['error'](_0x1fa8('0xd'),_0x19ffdc,_0x38407a[_0x1fa8('0x11')][_0x1fa8('0x12')]);return _0x122750(_0x38407a[_0x1fa8('0x11')]['message']);}else{logger[_0x1fa8('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x19ffdc,_0x1fa8('0xe'));_0x122750(_0x38407a['result'][_0x1fa8('0x12')]);}})[_0x1fa8('0x14')](function(_0x594df7){logger[_0x1fa8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x19ffdc,_0x594df7);_0x374a05(_0x594df7);});});}exports[_0x1fa8('0x15')]=function(_0x3957fa){var _0x1e9bb5=this;return new Promise(function(_0x12e531,_0x27d260){return db[_0x1fa8('0x16')][_0x1fa8('0x17')]({'raw':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3957fa['options']?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x19')]||null:null,'attributes':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1a')]||null:null,'limit':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1b')]||null:null,'include':_0x3957fa[_0x1fa8('0x18')]?_0x3957fa[_0x1fa8('0x18')][_0x1fa8('0x1c')]?_[_0x1fa8('0x1d')](_0x3957fa['options'][_0x1fa8('0x1c')],function(_0x34cd87){return{'model':db[_0x34cd87[_0x1fa8('0x1e')]],'as':_0x34cd87['as'],'attributes':_0x34cd87[_0x1fa8('0x1a')],'include':_0x34cd87[_0x1fa8('0x1c')]?_[_0x1fa8('0x1d')](_0x34cd87[_0x1fa8('0x1c')],function(_0x2b21db){return{'model':db[_0x2b21db[_0x1fa8('0x1e')]],'as':_0x2b21db['as'],'attributes':_0x2b21db[_0x1fa8('0x1a')],'include':_0x2b21db['include']?_[_0x1fa8('0x1d')](_0x2b21db[_0x1fa8('0x1c')],function(_0x49be73){return{'model':db[_0x49be73[_0x1fa8('0x1e')]],'as':_0x49be73['as'],'attributes':_0x49be73[_0x1fa8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0xc')](function(_0x53768b){logger[_0x1fa8('0x13')](_0x1fa8('0x15'),_0x3957fa);logger['debug'](_0x1fa8('0x15'),_0x3957fa,JSON[_0x1fa8('0x1f')](_0x53768b));_0x12e531(_0x53768b);})[_0x1fa8('0x14')](function(_0x50e6d1){logger[_0x1fa8('0x11')]('GetVoiceCallReport',_0x50e6d1[_0x1fa8('0x12')],_0x3957fa);_0x27d260(_0x1e9bb5['error'](0x1f4,_0x50e6d1[_0x1fa8('0x12')]));});});};exports[_0x1fa8('0x20')]=function(_0x3c0b2f){var _0x2014aa=this;return new Promise(function(_0x68a692,_0x52187e){return db['VoiceCallReport'][_0x1fa8('0x21')](_0x3c0b2f[_0x1fa8('0x22')],{'raw':_0x3c0b2f['options']?_0x3c0b2f[_0x1fa8('0x18')][_0x1fa8('0x23')]===undefined?!![]:![]:!![]})[_0x1fa8('0xc')](function(_0x1e1686){logger[_0x1fa8('0x13')](_0x1fa8('0x20'),_0x3c0b2f);logger[_0x1fa8('0xf')](_0x1fa8('0x20'),_0x3c0b2f,JSON[_0x1fa8('0x1f')](_0x1e1686));_0x68a692(_0x1e1686);})[_0x1fa8('0x14')](function(_0x2ec91d){logger[_0x1fa8('0x11')]('CreateVoiceCallReport',_0x2ec91d['message'],_0x3c0b2f);_0x52187e(_0x2014aa[_0x1fa8('0x11')](0x1f4,_0x2ec91d[_0x1fa8('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x95e447){var _0x17345f=this;return new Promise(function(_0x1d6805,_0x26cddc){return db[_0x1fa8('0x16')]['update'](_0x95e447['body'],{'raw':_0x95e447[_0x1fa8('0x18')]?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95e447[_0x1fa8('0x18')]?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x19')]||null:null,'attributes':_0x95e447['options']?_0x95e447[_0x1fa8('0x18')][_0x1fa8('0x1a')]||null:null,'limit':_0x95e447[_0x1fa8('0x18')]?_0x95e447['options'][_0x1fa8('0x1b')]||null:null})[_0x1fa8('0xc')](function(_0x4b122f){logger['info']('UpdateVoiceCallReport',_0x95e447);logger[_0x1fa8('0xf')]('UpdateVoiceCallReport',_0x95e447,JSON[_0x1fa8('0x1f')](_0x4b122f));_0x1d6805(_0x4b122f);})['catch'](function(_0x3d750f){logger[_0x1fa8('0x11')](_0x1fa8('0x24'),_0x3d750f[_0x1fa8('0x12')],_0x95e447);_0x26cddc(_0x17345f[_0x1fa8('0x11')](0x1f4,_0x3d750f[_0x1fa8('0x12')]));});});}; \ No newline at end of file +var _0xc6e7=['client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','create','CreateVoiceCallReport','update','body','where','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x58b698,_0x4b2135){var _0x4f57c0=function(_0x337a36){while(--_0x337a36){_0x58b698['push'](_0x58b698['shift']());}};_0x4f57c0(++_0x4b2135);}(_0xc6e7,0x1a4));var _0x7c6e=function(_0x343abe,_0x5c0a70){_0x343abe=_0x343abe-0x0;var _0x1917e7=_0xc6e7[_0x343abe];return _0x1917e7;};'use strict';var _=require(_0x7c6e('0x0'));var util=require(_0x7c6e('0x1'));var moment=require('moment');var BPromise=require(_0x7c6e('0x2'));var rs=require(_0x7c6e('0x3'));var fs=require('fs');var Redis=require(_0x7c6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c6e('0x5'));var logger=require(_0x7c6e('0x6'))(_0x7c6e('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c6e('0x8'));var client=jayson[_0x7c6e('0x9')][_0x7c6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0ea99,_0x591fbd,_0x407400){return new BPromise(function(_0x21b582,_0x51ef25){return client[_0x7c6e('0xb')](_0xe0ea99,_0x407400)[_0x7c6e('0xc')](function(_0x4f27f5){logger[_0x7c6e('0xd')](_0x7c6e('0xe'),_0x591fbd,_0x7c6e('0xf'));logger[_0x7c6e('0x10')](_0x7c6e('0x11'),_0x591fbd,_0x7c6e('0xf'),JSON[_0x7c6e('0x12')](_0x4f27f5));if(_0x4f27f5['error']){if(_0x4f27f5[_0x7c6e('0x13')]['code']===0x1f4){logger[_0x7c6e('0x13')](_0x7c6e('0xe'),_0x591fbd,_0x4f27f5['error']['message']);return _0x51ef25(_0x4f27f5[_0x7c6e('0x13')][_0x7c6e('0x14')]);}logger['error'](_0x7c6e('0xe'),_0x591fbd,_0x4f27f5[_0x7c6e('0x13')][_0x7c6e('0x14')]);return _0x21b582(_0x4f27f5[_0x7c6e('0x13')][_0x7c6e('0x14')]);}else{logger['info'](_0x7c6e('0xe'),_0x591fbd,_0x7c6e('0xf'));_0x21b582(_0x4f27f5[_0x7c6e('0x15')][_0x7c6e('0x14')]);}})[_0x7c6e('0x16')](function(_0x774c93){logger[_0x7c6e('0x13')](_0x7c6e('0xe'),_0x591fbd,_0x774c93);_0x51ef25(_0x774c93);});});}exports[_0x7c6e('0x17')]=function(_0x48499d){var _0x4745b2=this;return new Promise(function(_0xf6462c,_0x122a59){return db[_0x7c6e('0x18')][_0x7c6e('0x19')]({'raw':_0x48499d[_0x7c6e('0x1a')]?_0x48499d[_0x7c6e('0x1a')][_0x7c6e('0x1b')]===undefined?!![]:![]:!![],'where':_0x48499d[_0x7c6e('0x1a')]?_0x48499d[_0x7c6e('0x1a')]['where']||null:null,'attributes':_0x48499d['options']?_0x48499d[_0x7c6e('0x1a')][_0x7c6e('0x1c')]||null:null,'limit':_0x48499d[_0x7c6e('0x1a')]?_0x48499d[_0x7c6e('0x1a')][_0x7c6e('0x1d')]||null:null,'include':_0x48499d[_0x7c6e('0x1a')]?_0x48499d['options'][_0x7c6e('0x1e')]?_[_0x7c6e('0x1f')](_0x48499d[_0x7c6e('0x1a')][_0x7c6e('0x1e')],function(_0x401a4e){return{'model':db[_0x401a4e[_0x7c6e('0x20')]],'as':_0x401a4e['as'],'attributes':_0x401a4e[_0x7c6e('0x1c')],'include':_0x401a4e[_0x7c6e('0x1e')]?_[_0x7c6e('0x1f')](_0x401a4e[_0x7c6e('0x1e')],function(_0x1a43f2){return{'model':db[_0x1a43f2[_0x7c6e('0x20')]],'as':_0x1a43f2['as'],'attributes':_0x1a43f2[_0x7c6e('0x1c')],'include':_0x1a43f2[_0x7c6e('0x1e')]?_[_0x7c6e('0x1f')](_0x1a43f2[_0x7c6e('0x1e')],function(_0x41cb72){return{'model':db[_0x41cb72[_0x7c6e('0x20')]],'as':_0x41cb72['as'],'attributes':_0x41cb72[_0x7c6e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c6e('0xc')](function(_0xd6ee1a){logger['info'](_0x7c6e('0x17'),_0x48499d);logger[_0x7c6e('0x10')](_0x7c6e('0x17'),_0x48499d,JSON['stringify'](_0xd6ee1a));_0xf6462c(_0xd6ee1a);})[_0x7c6e('0x16')](function(_0x3351c9){logger[_0x7c6e('0x13')]('GetVoiceCallReport',_0x3351c9['message'],_0x48499d);_0x122a59(_0x4745b2[_0x7c6e('0x13')](0x1f4,_0x3351c9[_0x7c6e('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x1d67be){var _0x5059ee=this;return new Promise(function(_0x35ce18,_0x322f79){return db[_0x7c6e('0x18')][_0x7c6e('0x21')](_0x1d67be['body'],{'raw':_0x1d67be[_0x7c6e('0x1a')]?_0x1d67be[_0x7c6e('0x1a')][_0x7c6e('0x1b')]===undefined?!![]:![]:!![]})[_0x7c6e('0xc')](function(_0x487d02){logger[_0x7c6e('0xd')](_0x7c6e('0x22'),_0x1d67be);logger['debug'](_0x7c6e('0x22'),_0x1d67be,JSON[_0x7c6e('0x12')](_0x487d02));_0x35ce18(_0x487d02);})[_0x7c6e('0x16')](function(_0x3f7931){logger['error'](_0x7c6e('0x22'),_0x3f7931[_0x7c6e('0x14')],_0x1d67be);_0x322f79(_0x5059ee[_0x7c6e('0x13')](0x1f4,_0x3f7931['message']));});});};exports['UpdateVoiceCallReport']=function(_0x17165c){var _0x1b45fc=this;return new Promise(function(_0x3878f1,_0x43e1d7){return db[_0x7c6e('0x18')][_0x7c6e('0x23')](_0x17165c[_0x7c6e('0x24')],{'raw':_0x17165c[_0x7c6e('0x1a')]?_0x17165c['options'][_0x7c6e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17165c[_0x7c6e('0x1a')]?_0x17165c['options'][_0x7c6e('0x25')]||null:null,'attributes':_0x17165c[_0x7c6e('0x1a')]?_0x17165c[_0x7c6e('0x1a')][_0x7c6e('0x1c')]||null:null,'limit':_0x17165c['options']?_0x17165c[_0x7c6e('0x1a')]['limit']||null:null})[_0x7c6e('0xc')](function(_0x134361){logger[_0x7c6e('0xd')](_0x7c6e('0x26'),_0x17165c);logger[_0x7c6e('0x10')](_0x7c6e('0x26'),_0x17165c,JSON['stringify'](_0x134361));_0x3878f1(_0x134361);})['catch'](function(_0x5bccf4){logger['error'](_0x7c6e('0x26'),_0x5bccf4[_0x7c6e('0x14')],_0x17165c);_0x43e1d7(_0x1b45fc[_0x7c6e('0x13')](0x1f4,_0x5bccf4[_0x7c6e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f7627e2..54e9343 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 _0xe281=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xe281,0xfd));var _0x1e28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe281[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1e28('0x0'));var util=require(_0x1e28('0x1'));var path=require(_0x1e28('0x2'));var timeout=require(_0x1e28('0x3'));var express=require(_0x1e28('0x4'));var router=express[_0x1e28('0x5')]();var fs_extra=require(_0x1e28('0x6'));var auth=require(_0x1e28('0x7'));var interaction=require(_0x1e28('0x8'));var config=require('../../config/environment');var controller=require(_0x1e28('0x9'));router[_0x1e28('0xa')]('/',auth['isAuthenticated'](),controller[_0x1e28('0xb')]);router['get']('/:id',auth[_0x1e28('0xc')](),controller[_0x1e28('0xd')]);router[_0x1e28('0xe')]('/',auth[_0x1e28('0xc')](),controller['create']);router[_0x1e28('0xf')](_0x1e28('0x10'),auth['isAuthenticated'](),controller[_0x1e28('0x11')]);router[_0x1e28('0x12')](_0x1e28('0x10'),auth['isAuthenticated'](),controller[_0x1e28('0x13')]);module[_0x1e28('0x14')]=router; \ No newline at end of file +var _0xa576=['../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa576,0xd8));var _0x6a57=function(_0x499fa2,_0x49ea4a){_0x499fa2=_0x499fa2-0x0;var _0x599ae8=_0xa576[_0x499fa2];return _0x599ae8;};'use strict';var multer=require('multer');var util=require(_0x6a57('0x0'));var path=require(_0x6a57('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a57('0x2')]();var fs_extra=require(_0x6a57('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6a57('0x4'));var config=require(_0x6a57('0x5'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x6a57('0x6')](),controller[_0x6a57('0x7')]);router[_0x6a57('0x8')](_0x6a57('0x9'),auth[_0x6a57('0x6')](),controller[_0x6a57('0xa')]);router[_0x6a57('0xb')]('/',auth[_0x6a57('0x6')](),controller[_0x6a57('0xc')]);router[_0x6a57('0xd')]('/:id',auth[_0x6a57('0x6')](),controller['update']);router[_0x6a57('0xe')](_0x6a57('0x9'),auth[_0x6a57('0x6')](),controller[_0x6a57('0xf')]);module[_0x6a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b39c5bf..ed00784 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 _0x1ffe=['exports','name','STRING','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x1ffe,0x1af));var _0xe1ff=function(_0x5c0e88,_0x33ed62){_0x5c0e88=_0x5c0e88-0x0;var _0x2b8713=_0x1ffe[_0x5c0e88];return _0x2b8713;};'use strict';var Sequelize=require(_0xe1ff('0x0'));module[_0xe1ff('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xe1ff('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xe1ff('0x3')],'set':function(_0xb7c499){this[_0xe1ff('0x4')](_0xe1ff('0x5'),_0xb7c499?_0xb7c499[_0xe1ff('0x6')](''):[]);},'get':function(){return this[_0xe1ff('0x7')]('options')?this[_0xe1ff('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xe1ff('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe1ff('0x3')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe1ff('0x3')]},'description':{'type':Sequelize[_0xe1ff('0x3')]}}; \ No newline at end of file +var _0x8d32=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xf0339b,_0x21a8ca){var _0x14d27f=function(_0x5a0408){while(--_0x5a0408){_0xf0339b['push'](_0xf0339b['shift']());}};_0x14d27f(++_0x21a8ca);}(_0x8d32,0x118));var _0x28d3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8d32[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x28d3('0x0'));module[_0x28d3('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x28d3('0x2')],'unique':_0x28d3('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x28d3('0x2')],'set':function(_0x402fc4){this[_0x28d3('0x4')](_0x28d3('0x5'),_0x402fc4?_0x402fc4[_0x28d3('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x28d3('0x5'))?this[_0x28d3('0x7')](_0x28d3('0x5'))[_0x28d3('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x28d3('0x2')]},'record':{'type':Sequelize[_0x28d3('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x28d3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 04df9a1..3bf252d 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 _0xda65=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xda65,0x1d0));var _0x5da6=function(_0x181f34,_0x4c7f0f){_0x181f34=_0x181f34-0x0;var _0x2e1921=_0xda65[_0x181f34];return _0x2e1921;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require(_0x5da6('0x1'));var zipdir=require(_0x5da6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5da6('0x3'));var moment=require(_0x5da6('0x4'));var BPromise=require(_0x5da6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5da6('0x6'));var sox=require(_0x5da6('0x7'));var csv=require(_0x5da6('0x8'));var ejs=require(_0x5da6('0x9'));var fs=require('fs');var fs_extra=require(_0x5da6('0xa'));var _=require('lodash');var squel=require(_0x5da6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5da6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5da6('0xd'));var Papa=require(_0x5da6('0xe'));var Redis=require(_0x5da6('0xf'));var authService=require(_0x5da6('0x10'));var qs=require(_0x5da6('0x11'));var as=require(_0x5da6('0x12'));var hardwareService=require(_0x5da6('0x13'));var logger=require(_0x5da6('0x14'))('api');var utils=require(_0x5da6('0x15'));var config=require(_0x5da6('0x16'));var licenseUtil=require(_0x5da6('0x17'));var db=require(_0x5da6('0x18'))['db'];function respondWithStatusCode(_0x3500c6,_0x40ace1){_0x40ace1=_0x40ace1||0xcc;return function(_0x351340){if(_0x351340){return _0x3500c6[_0x5da6('0x19')](_0x40ace1);}return _0x3500c6[_0x5da6('0x1a')](_0x40ace1)['end']();};}function respondWithResult(_0x423665,_0x3e4dd6){_0x3e4dd6=_0x3e4dd6||0xc8;return function(_0xdb1066){if(_0xdb1066){return _0x423665[_0x5da6('0x1a')](_0x3e4dd6)[_0x5da6('0x1b')](_0xdb1066);}};}function respondWithFilteredResult(_0x47798b,_0x32a16a){return function(_0x1c28b7){if(_0x1c28b7){var _0x4f594e=typeof _0x32a16a[_0x5da6('0x1c')]==='undefined'&&typeof _0x32a16a['limit']===_0x5da6('0x1d');var _0x31b743=_0x1c28b7[_0x5da6('0x1e')];var _0x4c3b2d=_0x4f594e?0x0:_0x32a16a[_0x5da6('0x1c')];var _0x4b42e4=_0x4f594e?_0x1c28b7[_0x5da6('0x1e')]:_0x32a16a[_0x5da6('0x1c')]+_0x32a16a[_0x5da6('0x1f')];var _0x3c93e2;if(_0x4b42e4>=_0x31b743){_0x4b42e4=_0x31b743;_0x3c93e2=0xc8;}else{_0x3c93e2=0xce;}_0x47798b['status'](_0x3c93e2);return _0x47798b[_0x5da6('0x20')](_0x5da6('0x21'),_0x4c3b2d+'-'+_0x4b42e4+'/'+_0x31b743)[_0x5da6('0x1b')](_0x1c28b7);}return null;};}function patchUpdates(_0x24500d){return function(_0x747f9f){try{jsonpatch[_0x5da6('0x22')](_0x747f9f,_0x24500d,!![]);}catch(_0x163f8a){return BPromise[_0x5da6('0x23')](_0x163f8a);}return _0x747f9f['save']();};}function saveUpdates(_0x317cdb,_0x5ad81b){return function(_0x92171e){if(_0x92171e){return _0x92171e[_0x5da6('0x24')](_0x317cdb)[_0x5da6('0x25')](function(_0xdbaece){return _0xdbaece;});}return null;};}function removeEntity(_0x115098,_0x22b261){return function(_0x1d394e){if(_0x1d394e){return _0x1d394e[_0x5da6('0x26')]()['then'](function(){var _0x51a428=_0x1d394e[_0x5da6('0x27')]({'plain':!![]});var _0x256073='ChanSpies';return db['UserProfileResource'][_0x5da6('0x26')]({'where':{'type':_0x256073,'resourceId':_0x51a428['id']}})[_0x5da6('0x25')](function(){return _0x1d394e;});})[_0x5da6('0x25')](function(){_0x115098[_0x5da6('0x1a')](0xcc)[_0x5da6('0x28')]();});}};}function handleEntityNotFound(_0x495138,_0x471873){return function(_0x1bc214){if(!_0x1bc214){_0x495138[_0x5da6('0x19')](0x194);}return _0x1bc214;};}function handleError(_0x573b0c,_0x41dab8){_0x41dab8=_0x41dab8||0x1f4;return function(_0x2b3be1){logger['error'](_0x2b3be1[_0x5da6('0x29')]);if(_0x2b3be1[_0x5da6('0x2a')]){delete _0x2b3be1[_0x5da6('0x2a')];}_0x573b0c[_0x5da6('0x1a')](_0x41dab8)[_0x5da6('0x2b')](_0x2b3be1);};}exports[_0x5da6('0x2c')]=function(_0x26cb1a,_0x25e8ae){var _0x46541d={},_0x46ed01={},_0x24149d={'count':0x0,'rows':[]};var _0x19dc67=_[_0x5da6('0x2d')](db[_0x5da6('0x2e')]['rawAttributes'],function(_0x42af0d){return{'name':_0x42af0d[_0x5da6('0x2f')],'type':_0x42af0d[_0x5da6('0x30')]['key']};});_0x46ed01[_0x5da6('0x31')]=_[_0x5da6('0x2d')](_0x19dc67,_0x5da6('0x2a'));_0x46ed01[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x26cb1a[_0x5da6('0x32')]);_0x46ed01[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x46ed01[_0x5da6('0x31')],_0x46ed01['query']);_0x46541d['attributes']=_[_0x5da6('0x35')](_0x46ed01['model'],qs['fields'](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x36')]));_0x46541d['attributes']=_0x46541d['attributes'][_0x5da6('0x37')]?_0x46541d['attributes']:_0x46ed01['model'];if(!_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x38')]('nolimit')){_0x46541d[_0x5da6('0x1f')]=qs[_0x5da6('0x1f')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1f')]);_0x46541d['offset']=qs[_0x5da6('0x1c')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1c')]);}_0x46541d['order']=qs[_0x5da6('0x39')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x39')]);_0x46541d[_0x5da6('0x3a')]=qs[_0x5da6('0x34')](_[_0x5da6('0x3b')](_0x26cb1a['query'],_0x46ed01[_0x5da6('0x34')]),_0x19dc67);if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]){_0x46541d['where']=_['merge'](_0x46541d['where'],{'$or':_[_0x5da6('0x2d')](_0x19dc67,function(_0x4ffe15){if(_0x4ffe15[_0x5da6('0x30')]!=='VIRTUAL'){var _0x2afd1e={};_0x2afd1e[_0x4ffe15['name']]={'$like':'%'+_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]+'%'};return _0x2afd1e;}})});}_0x46541d=_['merge']({},_0x46541d,_0x26cb1a[_0x5da6('0x3d')]);var _0x4255ae={'where':_0x46541d[_0x5da6('0x3a')]};return db[_0x5da6('0x2e')][_0x5da6('0x1e')](_0x4255ae)[_0x5da6('0x25')](function(_0x2de3e7){_0x24149d[_0x5da6('0x1e')]=_0x2de3e7;if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x46541d[_0x5da6('0x3f')]=[{'all':!![]}];}return db[_0x5da6('0x2e')][_0x5da6('0x40')](_0x46541d);})[_0x5da6('0x25')](function(_0x9d38b0){_0x24149d[_0x5da6('0x41')]=_0x9d38b0;return _0x24149d;})[_0x5da6('0x25')](respondWithFilteredResult(_0x25e8ae,_0x46541d))['catch'](handleError(_0x25e8ae,null));};exports[_0x5da6('0x42')]=function(_0x313a24,_0xf9cfa5){var _0x3cac43={'raw':![],'where':{'id':_0x313a24[_0x5da6('0x43')]['id']}},_0x5e01d2={};_0x5e01d2[_0x5da6('0x31')]=_[_0x5da6('0x33')](db[_0x5da6('0x2e')]['rawAttributes']);_0x5e01d2[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x313a24[_0x5da6('0x32')]);_0x5e01d2[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x5e01d2[_0x5da6('0x31')],_0x5e01d2[_0x5da6('0x32')]);_0x3cac43[_0x5da6('0x44')]=_[_0x5da6('0x35')](_0x5e01d2['model'],qs[_0x5da6('0x36')](_0x313a24[_0x5da6('0x32')][_0x5da6('0x36')]));_0x3cac43['attributes']=_0x3cac43['attributes'][_0x5da6('0x37')]?_0x3cac43[_0x5da6('0x44')]:_0x5e01d2[_0x5da6('0x31')];if(_0x313a24[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x3cac43['include']=[{'all':!![]}];}_0x3cac43=_['merge']({},_0x3cac43,_0x313a24['options']);return db[_0x5da6('0x2e')][_0x5da6('0x45')](_0x3cac43)[_0x5da6('0x25')](handleEntityNotFound(_0xf9cfa5,null))[_0x5da6('0x25')](respondWithResult(_0xf9cfa5,null))[_0x5da6('0x46')](handleError(_0xf9cfa5,null));};exports[_0x5da6('0x47')]=function(_0x4a8da1,_0xce1fdc){return db[_0x5da6('0x2e')][_0x5da6('0x47')](_0x4a8da1['body'],{})['then'](function(_0xf77d73){var _0x375ea8=_0x4a8da1['user'][_0x5da6('0x27')]({'plain':!![]});if(!_0x375ea8)throw new Error(_0x5da6('0x48'));if(_0x375ea8[_0x5da6('0x49')]==='user'){var _0x2c90e2=_0xf77d73['get']({'plain':!![]});var _0xabf041=_0x5da6('0x4a');return db[_0x5da6('0x4b')][_0x5da6('0x45')]({'where':{'name':_0xabf041,'userProfileId':_0x375ea8[_0x5da6('0x4c')]},'raw':!![]})[_0x5da6('0x25')](function(_0x3e936a){if(_0x3e936a&&_0x3e936a[_0x5da6('0x4d')]===0x0){return db[_0x5da6('0x4e')][_0x5da6('0x47')]({'name':_0x2c90e2[_0x5da6('0x2a')],'resourceId':_0x2c90e2['id'],'type':_0x3e936a[_0x5da6('0x2a')],'sectionId':_0x3e936a['id']},{})['then'](function(){return _0xf77d73;});}else{return _0xf77d73;}})[_0x5da6('0x46')](function(_0x467b0e){logger['error'](_0x5da6('0x4f'),_0x467b0e);throw _0x467b0e;});}return _0xf77d73;})[_0x5da6('0x25')](respondWithResult(_0xce1fdc,0xc9))[_0x5da6('0x46')](handleError(_0xce1fdc,null));};exports[_0x5da6('0x24')]=function(_0x4d3141,_0x4bea76){if(_0x4d3141['body']['id']){delete _0x4d3141[_0x5da6('0x50')]['id'];}return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4d3141['params']['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x4bea76,null))[_0x5da6('0x25')](saveUpdates(_0x4d3141[_0x5da6('0x50')],null))[_0x5da6('0x25')](respondWithResult(_0x4bea76,null))[_0x5da6('0x46')](handleError(_0x4bea76,null));};exports[_0x5da6('0x26')]=function(_0x4bc620,_0x23fe40){return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4bc620[_0x5da6('0x43')]['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x23fe40,null))[_0x5da6('0x25')](removeEntity(_0x23fe40,null))[_0x5da6('0x46')](handleError(_0x23fe40,null));}; \ No newline at end of file +var _0x9e0d=['path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','end','sendStatus','error','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','findAll','rows','catch','show','params','length','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3d0ca1,_0x1d9553){var _0x115de0=function(_0x214aea){while(--_0x214aea){_0x3d0ca1['push'](_0x3d0ca1['shift']());}};_0x115de0(++_0x1d9553);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x4f7718,_0x3cadd5){_0x4f7718=_0x4f7718-0x0;var _0x28a88f=_0x9e0d[_0x4f7718];return _0x28a88f;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require('request-promise');var moment=require(_0xd9e0('0x4'));var BPromise=require(_0xd9e0('0x5'));var Mustache=require(_0xd9e0('0x6'));var util=require(_0xd9e0('0x7'));var path=require(_0xd9e0('0x8'));var sox=require(_0xd9e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=typeof _0x3e4c5d['offset']===_0xd9e0('0x1d')&&typeof _0x3e4c5d[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x1cdcb6=_0x4da900['count'];var _0x209c04=_0x58d44c?0x0:_0x3e4c5d['offset'];var _0x483b74=_0x58d44c?_0x4da900[_0xd9e0('0x1f')]:_0x3e4c5d[_0xd9e0('0x20')]+_0x3e4c5d['limit'];var _0x5ac8f5;if(_0x483b74>=_0x1cdcb6){_0x483b74=_0x1cdcb6;_0x5ac8f5=0xc8;}else{_0x5ac8f5=0xce;}_0x18301b[_0xd9e0('0x1b')](_0x5ac8f5);return _0x18301b[_0xd9e0('0x21')]('Content-Range',_0x209c04+'-'+_0x483b74+'/'+_0x1cdcb6)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x4cc3c9){return function(_0xd3d455){try{jsonpatch[_0xd9e0('0x22')](_0xd3d455,_0x4cc3c9,!![]);}catch(_0x67f69f){return BPromise[_0xd9e0('0x23')](_0x67f69f);}return _0xd3d455[_0xd9e0('0x24')]();};}function saveUpdates(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['update'](_0x5711a1)[_0xd9e0('0x25')](function(_0x124ca7){return _0x124ca7;});}return null;};}function removeEntity(_0x5d4549,_0x357bd9){return function(_0x5e17d4){if(_0x5e17d4){return _0x5e17d4[_0xd9e0('0x26')]()[_0xd9e0('0x25')](function(){var _0x48dbf9=_0x5e17d4[_0xd9e0('0x27')]({'plain':!![]});var _0x53cf67='ChanSpies';return db['UserProfileResource'][_0xd9e0('0x26')]({'where':{'type':_0x53cf67,'resourceId':_0x48dbf9['id']}})[_0xd9e0('0x25')](function(){return _0x5e17d4;});})[_0xd9e0('0x25')](function(){_0x5d4549[_0xd9e0('0x1b')](0xcc)[_0xd9e0('0x28')]();});}};}function handleEntityNotFound(_0x4c99d3,_0x237dfe){return function(_0x5d56ba){if(!_0x5d56ba){_0x4c99d3[_0xd9e0('0x29')](0x194);}return _0x5d56ba;};}function handleError(_0x4bd349,_0x3bfd06){_0x3bfd06=_0x3bfd06||0x1f4;return function(_0x17a899){logger[_0xd9e0('0x2a')](_0x17a899['stack']);if(_0x17a899['name']){delete _0x17a899['name'];}_0x4bd349[_0xd9e0('0x1b')](_0x3bfd06)[_0xd9e0('0x2b')](_0x17a899);};}exports['index']=function(_0x31afb5,_0x183a79){var _0x2dcf47={},_0x25710f={},_0x42b01b={'count':0x0,'rows':[]};var _0x38af34=_[_0xd9e0('0x2c')](db['VoiceChanSpy'][_0xd9e0('0x2d')],function(_0x2dfedd){return{'name':_0x2dfedd[_0xd9e0('0x2e')],'type':_0x2dfedd[_0xd9e0('0x2f')][_0xd9e0('0x30')]};});_0x25710f[_0xd9e0('0x31')]=_[_0xd9e0('0x2c')](_0x38af34,_0xd9e0('0x32'));_0x25710f[_0xd9e0('0x33')]=_[_0xd9e0('0x34')](_0x31afb5[_0xd9e0('0x33')]);_0x25710f[_0xd9e0('0x35')]=_['intersection'](_0x25710f[_0xd9e0('0x31')],_0x25710f[_0xd9e0('0x33')]);_0x2dcf47[_0xd9e0('0x36')]=_[_0xd9e0('0x37')](_0x25710f[_0xd9e0('0x31')],qs['fields'](_0x31afb5[_0xd9e0('0x33')][_0xd9e0('0x38')]));_0x2dcf47[_0xd9e0('0x36')]=_0x2dcf47[_0xd9e0('0x36')]['length']?_0x2dcf47[_0xd9e0('0x36')]:_0x25710f['model'];if(!_0x31afb5[_0xd9e0('0x33')][_0xd9e0('0x39')](_0xd9e0('0x3a'))){_0x2dcf47[_0xd9e0('0x1e')]=qs[_0xd9e0('0x1e')](_0x31afb5[_0xd9e0('0x33')][_0xd9e0('0x1e')]);_0x2dcf47[_0xd9e0('0x20')]=qs[_0xd9e0('0x20')](_0x31afb5['query'][_0xd9e0('0x20')]);}_0x2dcf47[_0xd9e0('0x3b')]=qs[_0xd9e0('0x3c')](_0x31afb5[_0xd9e0('0x33')]['sort']);_0x2dcf47[_0xd9e0('0x3d')]=qs[_0xd9e0('0x35')](_[_0xd9e0('0x3e')](_0x31afb5[_0xd9e0('0x33')],_0x25710f[_0xd9e0('0x35')]),_0x38af34);if(_0x31afb5[_0xd9e0('0x33')][_0xd9e0('0x3f')]){_0x2dcf47[_0xd9e0('0x3d')]=_[_0xd9e0('0x40')](_0x2dcf47[_0xd9e0('0x3d')],{'$or':_[_0xd9e0('0x2c')](_0x38af34,function(_0x249934){if(_0x249934[_0xd9e0('0x2f')]!==_0xd9e0('0x41')){var _0x1a59a7={};_0x1a59a7[_0x249934[_0xd9e0('0x32')]]={'$like':'%'+_0x31afb5['query'][_0xd9e0('0x3f')]+'%'};return _0x1a59a7;}})});}_0x2dcf47=_[_0xd9e0('0x40')]({},_0x2dcf47,_0x31afb5['options']);var _0x14a914={'where':_0x2dcf47['where']};return db[_0xd9e0('0x42')][_0xd9e0('0x1f')](_0x14a914)[_0xd9e0('0x25')](function(_0x34a00f){_0x42b01b[_0xd9e0('0x1f')]=_0x34a00f;if(_0x31afb5[_0xd9e0('0x33')]['includeAll']){_0x2dcf47['include']=[{'all':!![]}];}return db[_0xd9e0('0x42')][_0xd9e0('0x43')](_0x2dcf47);})[_0xd9e0('0x25')](function(_0x3fa8cb){_0x42b01b[_0xd9e0('0x44')]=_0x3fa8cb;return _0x42b01b;})['then'](respondWithFilteredResult(_0x183a79,_0x2dcf47))[_0xd9e0('0x45')](handleError(_0x183a79,null));};exports[_0xd9e0('0x46')]=function(_0xc06d90,_0x3184c5){var _0x4c2167={'raw':![],'where':{'id':_0xc06d90[_0xd9e0('0x47')]['id']}},_0x3bfe73={};_0x3bfe73[_0xd9e0('0x31')]=_['keys'](db['VoiceChanSpy'][_0xd9e0('0x2d')]);_0x3bfe73[_0xd9e0('0x33')]=_['keys'](_0xc06d90['query']);_0x3bfe73[_0xd9e0('0x35')]=_[_0xd9e0('0x37')](_0x3bfe73[_0xd9e0('0x31')],_0x3bfe73[_0xd9e0('0x33')]);_0x4c2167[_0xd9e0('0x36')]=_[_0xd9e0('0x37')](_0x3bfe73[_0xd9e0('0x31')],qs[_0xd9e0('0x38')](_0xc06d90['query'][_0xd9e0('0x38')]));_0x4c2167[_0xd9e0('0x36')]=_0x4c2167['attributes'][_0xd9e0('0x48')]?_0x4c2167[_0xd9e0('0x36')]:_0x3bfe73[_0xd9e0('0x31')];if(_0xc06d90[_0xd9e0('0x33')][_0xd9e0('0x49')]){_0x4c2167[_0xd9e0('0x4a')]=[{'all':!![]}];}_0x4c2167=_[_0xd9e0('0x40')]({},_0x4c2167,_0xc06d90[_0xd9e0('0x4b')]);return db[_0xd9e0('0x42')][_0xd9e0('0x4c')](_0x4c2167)[_0xd9e0('0x25')](handleEntityNotFound(_0x3184c5,null))[_0xd9e0('0x25')](respondWithResult(_0x3184c5,null))['catch'](handleError(_0x3184c5,null));};exports[_0xd9e0('0x4d')]=function(_0x23d7fb,_0x4e3e1c){return db[_0xd9e0('0x42')]['create'](_0x23d7fb[_0xd9e0('0x4e')],{})[_0xd9e0('0x25')](function(_0x43a821){var _0x2a4b6f=_0x23d7fb[_0xd9e0('0x4f')][_0xd9e0('0x27')]({'plain':!![]});if(!_0x2a4b6f)throw new Error(_0xd9e0('0x50'));if(_0x2a4b6f['role']===_0xd9e0('0x4f')){var _0xc2b731=_0x43a821[_0xd9e0('0x27')]({'plain':!![]});var _0x2c9efa=_0xd9e0('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x2c9efa,'userProfileId':_0x2a4b6f[_0xd9e0('0x52')]},'raw':!![]})['then'](function(_0x231d43){if(_0x231d43&&_0x231d43[_0xd9e0('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xc2b731[_0xd9e0('0x32')],'resourceId':_0xc2b731['id'],'type':_0x231d43[_0xd9e0('0x32')],'sectionId':_0x231d43['id']},{})[_0xd9e0('0x25')](function(){return _0x43a821;});}else{return _0x43a821;}})['catch'](function(_0x328d1a){logger['error'](_0xd9e0('0x54'),_0x328d1a);throw _0x328d1a;});}return _0x43a821;})[_0xd9e0('0x25')](respondWithResult(_0x4e3e1c,0xc9))[_0xd9e0('0x45')](handleError(_0x4e3e1c,null));};exports['update']=function(_0x45824f,_0x57d39d){if(_0x45824f[_0xd9e0('0x4e')]['id']){delete _0x45824f[_0xd9e0('0x4e')]['id'];}return db['VoiceChanSpy'][_0xd9e0('0x4c')]({'where':{'id':_0x45824f[_0xd9e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x57d39d,null))[_0xd9e0('0x25')](saveUpdates(_0x45824f[_0xd9e0('0x4e')],null))['then'](respondWithResult(_0x57d39d,null))[_0xd9e0('0x45')](handleError(_0x57d39d,null));};exports[_0xd9e0('0x26')]=function(_0x5b52d9,_0x1e3fee){return db[_0xd9e0('0x42')]['find']({'where':{'id':_0x5b52d9[_0xd9e0('0x47')]['id']}})[_0xd9e0('0x25')](handleEntityNotFound(_0x1e3fee,null))[_0xd9e0('0x25')](removeEntity(_0x1e3fee,null))[_0xd9e0('0x45')](handleError(_0x1e3fee,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d00d311..8c35043 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 _0x7820=['models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','User','findAll','agent','then','catch','exports'];(function(_0x55d6ef,_0xaa2303){var _0x4968e9=function(_0x586fc9){while(--_0x586fc9){_0x55d6ef['push'](_0x55d6ef['shift']());}};_0x4968e9(++_0xaa2303);}(_0x7820,0xd5));var _0x0782=function(_0x2f3cb4,_0x206261){_0x2f3cb4=_0x2f3cb4-0x0;var _0x2e37fd=_0x7820[_0x2f3cb4];return _0x2e37fd;};'use strict';var _=require(_0x0782('0x0'));var util=require(_0x0782('0x1'));var BPromise=require(_0x0782('0x2'));var attributes=require(_0x0782('0x3'));var getUserApplications=function(_0x578bee,_0x16bbb2,_0x2a8388){var _0x2f43ec=0x1;var _0x40ba06=[];var _0x4a50b0={'context':_0x16bbb2[_0x0782('0x4')]||'from-sip','exten':util[_0x0782('0x5')](_0x0782('0x6'),_0x578bee[_0x0782('0x7')],_0x2a8388),'type':'system','isApp':![],'ChanSpyId':_0x578bee['id'],'UserId':_0x16bbb2['id']};_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0xa'),'appdata':util[_0x0782('0x5')]('CDR(type)=%s',_0x0782('0xb')),'priority':_0x2f43ec++},_0x4a50b0));if(_0x578bee[_0x0782('0xc')]){_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0xd'),'appdata':util[_0x0782('0x5')](_0x0782('0xe'),_0x578bee[_0x0782('0xf')]),'priority':_0x2f43ec++},_0x4a50b0));}if(_0x578bee[_0x0782('0x10')]){_0x40ba06['push'](_[_0x0782('0x9')]({'app':_0x0782('0x11'),'appdata':_0x578bee[_0x0782('0x12')],'priority':_0x2f43ec++},_0x4a50b0));}_0x40ba06[_0x0782('0x8')](_[_0x0782('0x9')]({'app':_0x0782('0x13'),'appdata':util[_0x0782('0x5')](_0x0782('0x14'),_0x16bbb2[_0x0782('0x15')],_0x578bee[_0x0782('0x16')]?_0x578bee[_0x0782('0x16')][_0x0782('0x17')](''):''),'priority':_0x2f43ec++},_0x4a50b0));if(_0x578bee[_0x0782('0xc')]){_0x40ba06[_0x0782('0x8')](_['merge']({'app':_0x0782('0x18'),'priority':_0x2f43ec++},_0x4a50b0));}return _0x40ba06;};var getChanSpyApplications=function(_0x4d3245,_0x1a47c5){var _0xbbae06=[];for(var _0x34c109=0x0,_0x5d8eb5=0x1;_0x34c109<_0x1a47c5['length'];_0x34c109++,_0x5d8eb5=0x1){_0xbbae06=_0xbbae06['concat'](getUserApplications(_0x4d3245,_0x1a47c5[_0x34c109],_0x1a47c5[_0x34c109][_0x0782('0x19')]));if(_0x1a47c5[_0x34c109][_0x0782('0x19')]!=_0x1a47c5[_0x34c109][_0x0782('0x15')]){_0xbbae06=_0xbbae06[_0x0782('0x1a')](getUserApplications(_0x4d3245,_0x1a47c5[_0x34c109],_0x1a47c5[_0x34c109][_0x0782('0x15')]));}}return _0xbbae06;};var getChanSpyPromise=function(_0x1c582f,_0x114c4b){return new BPromise(function(_0x3c8e07,_0x58b400){return _0x1c582f[_0x0782('0x1b')][_0x0782('0x1c')]({'attributes':['id',_0x0782('0x15'),_0x0782('0x19')],'where':{'role':_0x0782('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0782('0x1e')](function(_0x376435){if(_0x376435){return _0x3c8e07(getChanSpyApplications(_0x114c4b,_0x376435));}return _0x3c8e07([]);})[_0x0782('0x1f')](function(_0x4c0d34){_0x58b400(_0x4c0d34);});});};module[_0x0782('0x20')]=function(_0x468c70,_0x5acddb){var _0x1d6fec=_0x468c70[_0x0782('0x21')];return _0x468c70[_0x0782('0x22')](_0x0782('0x23'),attributes,{'tableName':_0x0782('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x382bc9,_0xb684f5,_0x43508e){return getChanSpyPromise(_0x1d6fec,_0x382bc9)['then'](function(_0x10b175){if(_0x10b175&&_0x10b175[_0x0782('0x25')]){return _0x1d6fec[_0x0782('0x26')][_0x0782('0x27')](_0x10b175);}})[_0x0782('0x1e')](function(){_0x43508e();})[_0x0782('0x1f')](function(_0x3231e3){_0x43508e(_0x3231e3);});},'afterUpdate':function(_0xcaa62c,_0x19f57c,_0x5c9806){return _0x1d6fec[_0x0782('0x26')][_0x0782('0x28')]({'where':{'ChanSpyId':_0xcaa62c['id']}})[_0x0782('0x1e')](function(){return getChanSpyPromise(_0x1d6fec,_0xcaa62c);})[_0x0782('0x1e')](function(_0x260ccf){if(_0x260ccf&&_0x260ccf[_0x0782('0x25')]){return _0x1d6fec[_0x0782('0x26')]['bulkCreate'](_0x260ccf);}})['then'](function(){_0x5c9806();})[_0x0782('0x1f')](function(_0x5ab76b){_0x5c9806(_0x5ab76b);});},'afterDestroy':function(_0x63138e,_0x3d9275,_0x1fdecd){return _0x1d6fec['VoiceExtension'][_0x0782('0x28')]({'where':{'ChanSpyId':_0x63138e['id']}})[_0x0782('0x1e')](function(){_0x1fdecd();})[_0x0782('0x1f')](function(_0x21d287){_0x1fdecd(_0x21d287);});}}});}; \ No newline at end of file +var _0x9650=['MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','models','define','VoiceChanSpy','then','length','bulkCreate','VoiceExtension','destroy','lodash','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record'];(function(_0x33bf8e,_0x5ae43c){var _0x5aa137=function(_0x25e8c7){while(--_0x25e8c7){_0x33bf8e['push'](_0x33bf8e['shift']());}};_0x5aa137(++_0x5ae43c);}(_0x9650,0xc6));var _0x0965=function(_0x4aa97f,_0x1cf32d){_0x4aa97f=_0x4aa97f-0x0;var _0x18cff1=_0x9650[_0x4aa97f];return _0x18cff1;};'use strict';var _=require(_0x0965('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4f75b5,_0x450906,_0x5d6252){var _0x1cf0d4=0x1;var _0x3c9897=[];var _0x2d52ce={'context':_0x450906[_0x0965('0x1')]||_0x0965('0x2'),'exten':util[_0x0965('0x3')](_0x0965('0x4'),_0x4f75b5['prefix'],_0x5d6252),'type':_0x0965('0x5'),'isApp':![],'ChanSpyId':_0x4f75b5['id'],'UserId':_0x450906['id']};_0x3c9897[_0x0965('0x6')](_[_0x0965('0x7')]({'app':_0x0965('0x8'),'appdata':util['format'](_0x0965('0x9'),_0x0965('0xa')),'priority':_0x1cf0d4++},_0x2d52ce));if(_0x4f75b5[_0x0965('0xb')]){_0x3c9897[_0x0965('0x6')](_[_0x0965('0x7')]({'app':_0x0965('0xc'),'appdata':util[_0x0965('0x3')](_0x0965('0xd'),_0x4f75b5['recordingFormat']),'priority':_0x1cf0d4++},_0x2d52ce));}if(_0x4f75b5[_0x0965('0xe')]){_0x3c9897[_0x0965('0x6')](_['merge']({'app':_0x0965('0xf'),'appdata':_0x4f75b5['password'],'priority':_0x1cf0d4++},_0x2d52ce));}_0x3c9897['push'](_[_0x0965('0x7')]({'app':'ChanSpy','appdata':util[_0x0965('0x3')](_0x0965('0x10'),_0x450906[_0x0965('0x11')],_0x4f75b5['options']?_0x4f75b5[_0x0965('0x12')][_0x0965('0x13')](''):''),'priority':_0x1cf0d4++},_0x2d52ce));if(_0x4f75b5[_0x0965('0xb')]){_0x3c9897[_0x0965('0x6')](_['merge']({'app':_0x0965('0x14'),'priority':_0x1cf0d4++},_0x2d52ce));}return _0x3c9897;};var getChanSpyApplications=function(_0x289ace,_0xb83d1b){var _0x1f2a3=[];for(var _0xb6f9fd=0x0,_0x453787=0x1;_0xb6f9fd<_0xb83d1b['length'];_0xb6f9fd++,_0x453787=0x1){_0x1f2a3=_0x1f2a3[_0x0965('0x15')](getUserApplications(_0x289ace,_0xb83d1b[_0xb6f9fd],_0xb83d1b[_0xb6f9fd][_0x0965('0x16')]));if(_0xb83d1b[_0xb6f9fd][_0x0965('0x16')]!=_0xb83d1b[_0xb6f9fd]['name']){_0x1f2a3=_0x1f2a3[_0x0965('0x15')](getUserApplications(_0x289ace,_0xb83d1b[_0xb6f9fd],_0xb83d1b[_0xb6f9fd][_0x0965('0x11')]));}}return _0x1f2a3;};var getChanSpyPromise=function(_0x8bd7d8,_0xe347e6){return new BPromise(function(_0x3075f1,_0x3f8df2){return _0x8bd7d8[_0x0965('0x17')][_0x0965('0x18')]({'attributes':['id',_0x0965('0x11'),_0x0965('0x16')],'where':{'role':_0x0965('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5645ae){if(_0x5645ae){return _0x3075f1(getChanSpyApplications(_0xe347e6,_0x5645ae));}return _0x3075f1([]);})[_0x0965('0x1a')](function(_0x279658){_0x3f8df2(_0x279658);});});};module['exports']=function(_0x14b3bb,_0x8babf4){var _0x28318f=_0x14b3bb[_0x0965('0x1b')];return _0x14b3bb[_0x0965('0x1c')](_0x0965('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x467555,_0x54bc3b,_0x2f253d){return getChanSpyPromise(_0x28318f,_0x467555)[_0x0965('0x1e')](function(_0x5d2060){if(_0x5d2060&&_0x5d2060[_0x0965('0x1f')]){return _0x28318f['VoiceExtension'][_0x0965('0x20')](_0x5d2060);}})['then'](function(){_0x2f253d();})[_0x0965('0x1a')](function(_0x184e3e){_0x2f253d(_0x184e3e);});},'afterUpdate':function(_0x35cb57,_0x2c363,_0x298c1c){return _0x28318f[_0x0965('0x21')][_0x0965('0x22')]({'where':{'ChanSpyId':_0x35cb57['id']}})[_0x0965('0x1e')](function(){return getChanSpyPromise(_0x28318f,_0x35cb57);})['then'](function(_0x47013b){if(_0x47013b&&_0x47013b[_0x0965('0x1f')]){return _0x28318f[_0x0965('0x21')][_0x0965('0x20')](_0x47013b);}})[_0x0965('0x1e')](function(){_0x298c1c();})[_0x0965('0x1a')](function(_0x4e6e64){_0x298c1c(_0x4e6e64);});},'afterDestroy':function(_0x33dc3b,_0x244a04,_0x36781b){return _0x28318f['VoiceExtension'][_0x0965('0x22')]({'where':{'ChanSpyId':_0x33dc3b['id']}})['then'](function(){_0x36781b();})[_0x0965('0x1a')](function(_0x40c898){_0x36781b(_0x40c898);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b8f9278..f85b85a 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 _0x7794=['randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x7794,0x7b));var _0x4779=function(_0x3f81ad,_0x3c6a39){_0x3f81ad=_0x3f81ad-0x0;var _0x546350=_0x7794[_0x3f81ad];return _0x546350;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});} \ No newline at end of file +var _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x0fd9[_0x54defc];return _0x1955d3;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 33a252e..4374a07 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 _0x0378=['../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','fs-extra'];(function(_0x54673c,_0x51ec11){var _0x1ca15b=function(_0x52ed71){while(--_0x52ed71){_0x54673c['push'](_0x54673c['shift']());}};_0x1ca15b(++_0x51ec11);}(_0x0378,0x19c));var _0x8037=function(_0x4ed48f,_0x47d140){_0x4ed48f=_0x4ed48f-0x0;var _0x438e51=_0x0378[_0x4ed48f];return _0x438e51;};'use strict';var multer=require(_0x8037('0x0'));var util=require('util');var path=require(_0x8037('0x1'));var timeout=require(_0x8037('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8037('0x3'));var auth=require(_0x8037('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8037('0x5'));var controller=require(_0x8037('0x6'));router[_0x8037('0x7')]('/',auth[_0x8037('0x8')](),controller['index']);router[_0x8037('0x7')](_0x8037('0x9'),auth[_0x8037('0x8')](),controller[_0x8037('0xa')]);router[_0x8037('0xb')]('/',auth[_0x8037('0x8')](),controller[_0x8037('0xc')]);router[_0x8037('0xd')](_0x8037('0x9'),auth['isAuthenticated'](),controller[_0x8037('0xe')]);router['delete'](_0x8037('0x9'),auth[_0x8037('0x8')](),controller['destroy']);module[_0x8037('0xf')]=router; \ No newline at end of file +var _0x530b=['/:id','show','post','create','update','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x530b,0x150));var _0xb530=function(_0x218ca4,_0x41cc40){_0x218ca4=_0x218ca4-0x0;var _0x1b3ff9=_0x530b[_0x218ca4];return _0x1b3ff9;};'use strict';var multer=require(_0xb530('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb530('0x1'));var express=require(_0xb530('0x2'));var router=express[_0xb530('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb530('0x4'));var config=require('../../config/environment');var controller=require(_0xb530('0x5'));router['get']('/',auth[_0xb530('0x6')](),controller[_0xb530('0x7')]);router[_0xb530('0x8')](_0xb530('0x9'),auth[_0xb530('0x6')](),controller[_0xb530('0xa')]);router[_0xb530('0xb')]('/',auth[_0xb530('0x6')](),controller[_0xb530('0xc')]);router['put'](_0xb530('0x9'),auth[_0xb530('0x6')](),controller[_0xb530('0xd')]);router['delete'](_0xb530('0x9'),auth[_0xb530('0x6')](),controller['destroy']);module[_0xb530('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7e3efae..506b8d4 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 _0x2726=['sequelize','STRING','name','BOOLEAN'];(function(_0x1974c7,_0x45212a){var _0xe6c23c=function(_0x2144f7){while(--_0x2144f7){_0x1974c7['push'](_0x1974c7['shift']());}};_0xe6c23c(++_0x45212a);}(_0x2726,0x110));var _0x6272=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x2726[_0x14e9f0];return _0xa63f7e;};'use strict';var Sequelize=require(_0x6272('0x0'));module['exports']={'name':{'type':Sequelize[_0x6272('0x1')],'unique':_0x6272('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6272('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x39d2=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x570722,_0xc0227a){var _0x428cb7=function(_0x5e496a){while(--_0x5e496a){_0x570722['push'](_0x570722['shift']());}};_0x428cb7(++_0xc0227a);}(_0x39d2,0x10e));var _0x239d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x39d2[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'name':{'type':Sequelize[_0x239d('0x2')],'unique':_0x239d('0x3')},'description':{'type':Sequelize[_0x239d('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x239d('0x4')],'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 13780a5..420475f 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 _0x19a0=['../../config/utils','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','readFileSync','join','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','utf8','render','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x258aa2,_0x5ba123){var _0x3a7d14=function(_0x23518d){while(--_0x23518d){_0x258aa2['push'](_0x258aa2['shift']());}};_0x3a7d14(++_0x5ba123);}(_0x19a0,0x118));var _0x019a=function(_0x493dec,_0x5a6c69){_0x493dec=_0x493dec-0x0;var _0xf39d01=_0x19a0[_0x493dec];return _0xf39d01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x019a('0x0'));var zipdir=require(_0x019a('0x1'));var jsonpatch=require(_0x019a('0x2'));var rp=require(_0x019a('0x3'));var moment=require(_0x019a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x019a('0x5'));var util=require(_0x019a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x019a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x019a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x019a('0x9'));var jsforce=require(_0x019a('0xa'));var deskjs=require(_0x019a('0xb'));var toCsv=require(_0x019a('0x7'));var querystring=require(_0x019a('0xc'));var Papa=require('papaparse');var Redis=require(_0x019a('0xd'));var authService=require(_0x019a('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x019a('0xf'));var logger=require(_0x019a('0x10'))('api');var utils=require(_0x019a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x019a('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x019a('0x13'));var client=jayson[_0x019a('0x14')][_0x019a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2d31ed,_0x51327d,_0x2d6bc9,_0x5b1885){return new BPromise(function(_0x5ef9b6,_0x4172bf){var _0x573502=_0x5b1885||client;return _0x573502['request'](_0x2d31ed,_0x2d6bc9)[_0x019a('0x16')](function(_0x19fa6a){logger[_0x019a('0x17')](_0x019a('0x18'),_0x51327d,_0x019a('0x19'));logger['debug'](_0x019a('0x1a'),_0x51327d,'request\x20sent',JSON[_0x019a('0x1b')](_0x19fa6a));if(_0x19fa6a[_0x019a('0x1c')]){if(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1d')]===0x1f4){logger['error'](_0x019a('0x18'),_0x51327d,_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);return _0x4172bf(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x51327d,_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);return _0x5ef9b6(_0x19fa6a[_0x019a('0x1c')][_0x019a('0x1e')]);}else{logger[_0x019a('0x17')](_0x019a('0x18'),_0x51327d,_0x019a('0x19'));_0x5ef9b6(_0x19fa6a[_0x019a('0x1f')][_0x019a('0x1e')]);}})['catch'](function(_0x95ea4d){logger[_0x019a('0x1c')](_0x019a('0x18'),_0x51327d,_0x95ea4d);_0x4172bf(_0x95ea4d);});});}function respondWithStatusCode(_0x261448,_0x1ba8ae){_0x1ba8ae=_0x1ba8ae||0xcc;return function(_0x263266){if(_0x263266){return _0x261448[_0x019a('0x20')](_0x1ba8ae);}return _0x261448[_0x019a('0x21')](_0x1ba8ae)[_0x019a('0x22')]();};}function respondWithResult(_0x2a92b9,_0x393f1a){_0x393f1a=_0x393f1a||0xc8;return function(_0x397b0f){if(_0x397b0f){return _0x2a92b9['status'](_0x393f1a)[_0x019a('0x23')](_0x397b0f);}};}function respondWithFilteredResult(_0x49029d,_0x3f8c5a){return function(_0x453ff5){if(_0x453ff5){var _0x29cae8=typeof _0x3f8c5a['offset']===_0x019a('0x24')&&typeof _0x3f8c5a['limit']===_0x019a('0x24');var _0x3ef36c=_0x453ff5['count'];var _0x58492d=_0x29cae8?0x0:_0x3f8c5a[_0x019a('0x25')];var _0x5557cf=_0x29cae8?_0x453ff5[_0x019a('0x26')]:_0x3f8c5a[_0x019a('0x25')]+_0x3f8c5a[_0x019a('0x27')];var _0x424849;if(_0x5557cf>=_0x3ef36c){_0x5557cf=_0x3ef36c;_0x424849=0xc8;}else{_0x424849=0xce;}_0x49029d[_0x019a('0x21')](_0x424849);return _0x49029d[_0x019a('0x28')](_0x019a('0x29'),_0x58492d+'-'+_0x5557cf+'/'+_0x3ef36c)[_0x019a('0x23')](_0x453ff5);}return null;};}function patchUpdates(_0x443729){return function(_0x1fe7a8){try{jsonpatch[_0x019a('0x2a')](_0x1fe7a8,_0x443729,!![]);}catch(_0x5e2e40){return BPromise[_0x019a('0x2b')](_0x5e2e40);}return _0x1fe7a8['save']();};}function saveUpdates(_0x3a4f5b,_0x44a647){return function(_0x794f44){if(_0x794f44){return _0x794f44['update'](_0x3a4f5b)[_0x019a('0x16')](function(_0x3257c6){return _0x3257c6;});}return null;};}function removeEntity(_0x4e79be,_0x34d043){return function(_0x5ff6a8){if(_0x5ff6a8){return _0x5ff6a8[_0x019a('0x2c')]()[_0x019a('0x16')](function(){var _0x3c7512=_0x5ff6a8[_0x019a('0x2d')]({'plain':!![]});var _0x2c96d6=_0x019a('0x2e');return db[_0x019a('0x2f')][_0x019a('0x2c')]({'where':{'type':_0x2c96d6,'resourceId':_0x3c7512['id']}})['then'](function(){return _0x5ff6a8;});})[_0x019a('0x16')](function(){_0x4e79be[_0x019a('0x21')](0xcc)[_0x019a('0x22')]();});}};}function handleEntityNotFound(_0xdefe6,_0x103084){return function(_0x2212cc){if(!_0x2212cc){_0xdefe6['sendStatus'](0x194);}return _0x2212cc;};}function handleError(_0x27ed4e,_0x4b9a80){_0x4b9a80=_0x4b9a80||0x1f4;return function(_0xfe89ed){logger[_0x019a('0x1c')](_0xfe89ed[_0x019a('0x30')]);if(_0xfe89ed[_0x019a('0x31')]){delete _0xfe89ed[_0x019a('0x31')];}_0x27ed4e['status'](_0x4b9a80)[_0x019a('0x32')](_0xfe89ed);};}exports[_0x019a('0x33')]=function(_0x325729,_0x42342a){var _0x138da0={},_0x5457d3={},_0x567bf9={'count':0x0,'rows':[]};var _0x55c5d5=_[_0x019a('0x34')](db[_0x019a('0x35')][_0x019a('0x36')],function(_0x1dfd21){return{'name':_0x1dfd21[_0x019a('0x37')],'type':_0x1dfd21[_0x019a('0x38')][_0x019a('0x39')]};});_0x5457d3[_0x019a('0x3a')]=_['map'](_0x55c5d5,_0x019a('0x31'));_0x5457d3[_0x019a('0x3b')]=_[_0x019a('0x3c')](_0x325729['query']);_0x5457d3[_0x019a('0x3d')]=_[_0x019a('0x3e')](_0x5457d3[_0x019a('0x3a')],_0x5457d3[_0x019a('0x3b')]);_0x138da0[_0x019a('0x3f')]=_['intersection'](_0x5457d3[_0x019a('0x3a')],qs[_0x019a('0x40')](_0x325729['query'][_0x019a('0x40')]));_0x138da0['attributes']=_0x138da0[_0x019a('0x3f')]['length']?_0x138da0[_0x019a('0x3f')]:_0x5457d3[_0x019a('0x3a')];if(!_0x325729['query']['hasOwnProperty']('nolimit')){_0x138da0['limit']=qs['limit'](_0x325729[_0x019a('0x3b')]['limit']);_0x138da0[_0x019a('0x25')]=qs[_0x019a('0x25')](_0x325729['query'][_0x019a('0x25')]);}_0x138da0[_0x019a('0x41')]=qs[_0x019a('0x42')](_0x325729[_0x019a('0x3b')]['sort']);_0x138da0[_0x019a('0x43')]=qs[_0x019a('0x3d')](_[_0x019a('0x44')](_0x325729['query'],_0x5457d3['filters']),_0x55c5d5);if(_0x325729['query'][_0x019a('0x45')]){_0x138da0[_0x019a('0x43')]=_['merge'](_0x138da0['where'],{'$or':_[_0x019a('0x34')](_0x55c5d5,function(_0x17446d){if(_0x17446d['type']!==_0x019a('0x46')){var _0x8506bd={};_0x8506bd[_0x17446d['name']]={'$like':'%'+_0x325729[_0x019a('0x3b')]['filter']+'%'};return _0x8506bd;}})});}_0x138da0=_['merge']({},_0x138da0,_0x325729[_0x019a('0x47')]);var _0x362f31={'where':_0x138da0[_0x019a('0x43')]};return db[_0x019a('0x35')][_0x019a('0x26')](_0x362f31)[_0x019a('0x16')](function(_0x399e51){_0x567bf9['count']=_0x399e51;if(_0x325729['query'][_0x019a('0x48')]){_0x138da0[_0x019a('0x49')]=[{'all':!![]}];}return db[_0x019a('0x35')][_0x019a('0x4a')](_0x138da0);})[_0x019a('0x16')](function(_0x35a901){_0x567bf9[_0x019a('0x4b')]=_0x35a901;return _0x567bf9;})[_0x019a('0x16')](respondWithFilteredResult(_0x42342a,_0x138da0))[_0x019a('0x4c')](handleError(_0x42342a,null));};exports[_0x019a('0x4d')]=function(_0x5961fb,_0x348295){var _0x4fc9d9={'raw':![],'where':{'id':_0x5961fb[_0x019a('0x4e')]['id']}},_0x5f2250={};_0x5f2250[_0x019a('0x3a')]=_['keys'](db[_0x019a('0x35')]['rawAttributes']);_0x5f2250['query']=_[_0x019a('0x3c')](_0x5961fb['query']);_0x5f2250[_0x019a('0x3d')]=_[_0x019a('0x3e')](_0x5f2250[_0x019a('0x3a')],_0x5f2250[_0x019a('0x3b')]);_0x4fc9d9[_0x019a('0x3f')]=_['intersection'](_0x5f2250[_0x019a('0x3a')],qs['fields'](_0x5961fb[_0x019a('0x3b')][_0x019a('0x40')]));_0x4fc9d9['attributes']=_0x4fc9d9[_0x019a('0x3f')][_0x019a('0x4f')]?_0x4fc9d9['attributes']:_0x5f2250[_0x019a('0x3a')];if(_0x5961fb['query']['includeAll']){_0x4fc9d9[_0x019a('0x49')]=[{'all':!![]}];}_0x4fc9d9=_[_0x019a('0x50')]({},_0x4fc9d9,_0x5961fb[_0x019a('0x47')]);return db[_0x019a('0x35')][_0x019a('0x51')](_0x4fc9d9)[_0x019a('0x16')](handleEntityNotFound(_0x348295,null))[_0x019a('0x16')](respondWithResult(_0x348295,null))[_0x019a('0x4c')](handleError(_0x348295,null));};exports[_0x019a('0x52')]=function(_0x18a75a,_0x19fb50,_0x289b70){var _0x31c0cd;return db['VoiceContext'][_0x019a('0x52')](_0x18a75a[_0x019a('0x53')],{'raw':!![]})[_0x019a('0x16')](function(_0x3715d8){_0x31c0cd=_0x3715d8;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x4a4eb7){var _0x229ae2=fs[_0x019a('0x54')](path[_0x019a('0x55')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x542b98=ejs['render'](_0x229ae2,{'contexts':_0x4a4eb7||[]});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x542b98);})['then'](function(){return respondWithRpcPromise(_0x019a('0x57'),_0x019a('0x52'),{'module':_0x019a('0x58')});})['then'](function(){var _0x3fa90d=_0x18a75a['user'][_0x019a('0x2d')]({'plain':!![]});if(!_0x3fa90d)throw new Error(_0x019a('0x59'));if(_0x3fa90d[_0x019a('0x5a')]===_0x019a('0x5b')){var _0x265c38=_0x31c0cd[_0x019a('0x2d')]({'plain':!![]});return db[_0x019a('0x5c')][_0x019a('0x51')]({'where':{'name':_0x019a('0x2e'),'userProfileId':_0x3fa90d['userProfileId']},'raw':!![]})[_0x019a('0x16')](function(_0x26e925){if(_0x26e925&&_0x26e925[_0x019a('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x265c38[_0x019a('0x31')],'resourceId':_0x265c38['id'],'type':_0x26e925['name'],'sectionId':_0x26e925['id']},{})['then'](function(){return _0x31c0cd;});}else{return _0x31c0cd;}})[_0x019a('0x4c')](function(_0x2dbfb6){logger[_0x019a('0x1c')](_0x019a('0x5e'),_0x2dbfb6);throw _0x2dbfb6;});}return _0x31c0cd;})['then'](respondWithResult(_0x19fb50,0xc9))[_0x019a('0x4c')](handleError(_0x19fb50,null));};exports[_0x019a('0x5f')]=function(_0x1cf363,_0x15a71a,_0x49cdab){var _0x1ab3a5;return db[_0x019a('0x35')]['find']({'where':{'id':_0x1cf363[_0x019a('0x4e')]['id']}})[_0x019a('0x16')](handleEntityNotFound(_0x15a71a,null))[_0x019a('0x16')](saveUpdates(_0x1cf363[_0x019a('0x53')],null))[_0x019a('0x16')](function(_0x25d3a8){if(_0x25d3a8){_0x1ab3a5=_0x25d3a8;return db['VoiceContext'][_0x019a('0x4a')]({'raw':!![]});}})[_0x019a('0x16')](function(_0x4eaa6d){var _0x2fc5af=fs[_0x019a('0x54')](path[_0x019a('0x55')](config['root'],_0x019a('0x60')),'utf8');var _0x3ab648=ejs['render'](_0x2fc5af,{'contexts':_0x4eaa6d||[]});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ab648);})[_0x019a('0x16')](function(){return respondWithRpcPromise(_0x019a('0x57'),_0x019a('0x5f'),{'module':'chan_sip.so'});})[_0x019a('0x16')](function(){return _0x1ab3a5;})[_0x019a('0x16')](respondWithResult(_0x15a71a,null))[_0x019a('0x4c')](handleError(_0x15a71a,null));};exports[_0x019a('0x2c')]=function(_0x2f79a0,_0x14500c,_0x12a7ff){var _0x3e1989;return db[_0x019a('0x35')][_0x019a('0x51')]({'where':{'id':_0x2f79a0[_0x019a('0x4e')]['id']}})[_0x019a('0x16')](handleEntityNotFound(_0x14500c,null))['then'](removeEntity(_0x14500c,null))[_0x019a('0x16')](function(){return db[_0x019a('0x35')]['findAll']({'raw':!![]});})['then'](function(_0x2ad7c9){var _0x4adead=fs['readFileSync'](path['join'](config['root'],_0x019a('0x60')),_0x019a('0x61'));var _0xe38c0b=ejs[_0x019a('0x62')](_0x4adead,{'contexts':_0x2ad7c9});fs[_0x019a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xe38c0b);return respondWithRpcPromise(_0x019a('0x57'),'destroy',{'module':_0x019a('0x58')});})[_0x019a('0x4c')](handleError(_0x14500c,null));}; \ No newline at end of file +var _0x6c66=['index','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','filter','options','VoiceContext','rows','show','params','keys','includeAll','create','body','readFileSync','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findAll','join','root','utf8','Reload','render','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceContext,\x20%s,\x20%s','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6c66,0x161));var _0x66c6=function(_0x39a90e,_0x3bb1b3){_0x39a90e=_0x39a90e-0x0;var _0x262a71=_0x6c66[_0x39a90e];return _0x262a71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c6('0x1'));var rp=require(_0x66c6('0x2'));var moment=require(_0x66c6('0x3'));var BPromise=require(_0x66c6('0x4'));var Mustache=require(_0x66c6('0x5'));var util=require(_0x66c6('0x6'));var path=require('path');var sox=require(_0x66c6('0x7'));var csv=require(_0x66c6('0x8'));var ejs=require(_0x66c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x66c6('0xa'));var jsforce=require(_0x66c6('0xb'));var deskjs=require(_0x66c6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x66c6('0xd'));var Papa=require(_0x66c6('0xe'));var Redis=require(_0x66c6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x66c6('0x10'));var as=require(_0x66c6('0x11'));var hardwareService=require(_0x66c6('0x12'));var logger=require(_0x66c6('0x13'))(_0x66c6('0x14'));var utils=require('../../config/utils');var config=require(_0x66c6('0x15'));var licenseUtil=require(_0x66c6('0x16'));var db=require(_0x66c6('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x66c6('0x18')][_0x66c6('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x162716,_0xa6fc7d,_0x492fe6,_0x2ef451){return new BPromise(function(_0x50b249,_0x5ecbea){var _0x3fb515=_0x2ef451||client;return _0x3fb515[_0x66c6('0x1a')](_0x162716,_0x492fe6)['then'](function(_0x2c7085){logger[_0x66c6('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xa6fc7d,_0x66c6('0x1c'));logger[_0x66c6('0x1d')](_0x66c6('0x1e'),_0xa6fc7d,_0x66c6('0x1c'),JSON[_0x66c6('0x1f')](_0x2c7085));if(_0x2c7085['error']){if(_0x2c7085[_0x66c6('0x20')][_0x66c6('0x21')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0xa6fc7d,_0x2c7085['error'][_0x66c6('0x22')]);return _0x5ecbea(_0x2c7085[_0x66c6('0x20')]['message']);}logger[_0x66c6('0x20')]('VoiceContext,\x20%s,\x20%s',_0xa6fc7d,_0x2c7085['error'][_0x66c6('0x22')]);return _0x50b249(_0x2c7085['error']['message']);}else{logger[_0x66c6('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xa6fc7d,'request\x20sent');_0x50b249(_0x2c7085[_0x66c6('0x23')]['message']);}})[_0x66c6('0x24')](function(_0x4312dd){logger['error'](_0x66c6('0x25'),_0xa6fc7d,_0x4312dd);_0x5ecbea(_0x4312dd);});});}function respondWithStatusCode(_0x27ea3c,_0x4a074f){_0x4a074f=_0x4a074f||0xcc;return function(_0x55cd26){if(_0x55cd26){return _0x27ea3c[_0x66c6('0x26')](_0x4a074f);}return _0x27ea3c[_0x66c6('0x27')](_0x4a074f)[_0x66c6('0x28')]();};}function respondWithResult(_0x94c7f3,_0x47a0f9){_0x47a0f9=_0x47a0f9||0xc8;return function(_0x12ee49){if(_0x12ee49){return _0x94c7f3[_0x66c6('0x27')](_0x47a0f9)[_0x66c6('0x29')](_0x12ee49);}};}function respondWithFilteredResult(_0x1049e6,_0x41b45d){return function(_0x2514c7){if(_0x2514c7){var _0x101d5d=typeof _0x41b45d['offset']===_0x66c6('0x2a')&&typeof _0x41b45d[_0x66c6('0x2b')]===_0x66c6('0x2a');var _0x200cc4=_0x2514c7[_0x66c6('0x2c')];var _0x27f278=_0x101d5d?0x0:_0x41b45d[_0x66c6('0x2d')];var _0x4c0331=_0x101d5d?_0x2514c7[_0x66c6('0x2c')]:_0x41b45d[_0x66c6('0x2d')]+_0x41b45d[_0x66c6('0x2b')];var _0x25eb05;if(_0x4c0331>=_0x200cc4){_0x4c0331=_0x200cc4;_0x25eb05=0xc8;}else{_0x25eb05=0xce;}_0x1049e6[_0x66c6('0x27')](_0x25eb05);return _0x1049e6[_0x66c6('0x2e')](_0x66c6('0x2f'),_0x27f278+'-'+_0x4c0331+'/'+_0x200cc4)[_0x66c6('0x29')](_0x2514c7);}return null;};}function patchUpdates(_0x462450){return function(_0x5b4f07){try{jsonpatch['apply'](_0x5b4f07,_0x462450,!![]);}catch(_0x7a1018){return BPromise[_0x66c6('0x30')](_0x7a1018);}return _0x5b4f07[_0x66c6('0x31')]();};}function saveUpdates(_0x257223,_0x4179d6){return function(_0x272e58){if(_0x272e58){return _0x272e58['update'](_0x257223)['then'](function(_0x33d7d8){return _0x33d7d8;});}return null;};}function removeEntity(_0x15d26a,_0x1beab6){return function(_0x6aa71c){if(_0x6aa71c){return _0x6aa71c[_0x66c6('0x32')]()[_0x66c6('0x33')](function(){var _0x3a77a4=_0x6aa71c[_0x66c6('0x34')]({'plain':!![]});var _0x34e9ed='Contexts';return db[_0x66c6('0x35')]['destroy']({'where':{'type':_0x34e9ed,'resourceId':_0x3a77a4['id']}})[_0x66c6('0x33')](function(){return _0x6aa71c;});})[_0x66c6('0x33')](function(){_0x15d26a['status'](0xcc)[_0x66c6('0x28')]();});}};}function handleEntityNotFound(_0x170d69,_0x3a1621){return function(_0xb6dfc2){if(!_0xb6dfc2){_0x170d69[_0x66c6('0x26')](0x194);}return _0xb6dfc2;};}function handleError(_0x4f4df3,_0x411123){_0x411123=_0x411123||0x1f4;return function(_0x39fbee){logger[_0x66c6('0x20')](_0x39fbee['stack']);if(_0x39fbee[_0x66c6('0x36')]){delete _0x39fbee['name'];}_0x4f4df3['status'](_0x411123)['send'](_0x39fbee);};}exports[_0x66c6('0x37')]=function(_0x2396d7,_0x5b3d8d){var _0x14891e={},_0x713270={},_0x369524={'count':0x0,'rows':[]};var _0x138784=_['map'](db['VoiceContext']['rawAttributes'],function(_0xa3f515){return{'name':_0xa3f515[_0x66c6('0x38')],'type':_0xa3f515[_0x66c6('0x39')][_0x66c6('0x3a')]};});_0x713270[_0x66c6('0x3b')]=_[_0x66c6('0x3c')](_0x138784,_0x66c6('0x36'));_0x713270[_0x66c6('0x3d')]=_['keys'](_0x2396d7[_0x66c6('0x3d')]);_0x713270['filters']=_[_0x66c6('0x3e')](_0x713270[_0x66c6('0x3b')],_0x713270[_0x66c6('0x3d')]);_0x14891e[_0x66c6('0x3f')]=_['intersection'](_0x713270[_0x66c6('0x3b')],qs['fields'](_0x2396d7[_0x66c6('0x3d')][_0x66c6('0x40')]));_0x14891e[_0x66c6('0x3f')]=_0x14891e['attributes'][_0x66c6('0x41')]?_0x14891e[_0x66c6('0x3f')]:_0x713270[_0x66c6('0x3b')];if(!_0x2396d7[_0x66c6('0x3d')]['hasOwnProperty'](_0x66c6('0x42'))){_0x14891e[_0x66c6('0x2b')]=qs[_0x66c6('0x2b')](_0x2396d7['query'][_0x66c6('0x2b')]);_0x14891e[_0x66c6('0x2d')]=qs['offset'](_0x2396d7['query'][_0x66c6('0x2d')]);}_0x14891e[_0x66c6('0x43')]=qs[_0x66c6('0x44')](_0x2396d7[_0x66c6('0x3d')]['sort']);_0x14891e[_0x66c6('0x45')]=qs['filters'](_[_0x66c6('0x46')](_0x2396d7[_0x66c6('0x3d')],_0x713270[_0x66c6('0x47')]),_0x138784);if(_0x2396d7[_0x66c6('0x3d')]['filter']){_0x14891e[_0x66c6('0x45')]=_[_0x66c6('0x48')](_0x14891e['where'],{'$or':_['map'](_0x138784,function(_0x4418e1){if(_0x4418e1[_0x66c6('0x39')]!=='VIRTUAL'){var _0x3de3db={};_0x3de3db[_0x4418e1[_0x66c6('0x36')]]={'$like':'%'+_0x2396d7[_0x66c6('0x3d')][_0x66c6('0x49')]+'%'};return _0x3de3db;}})});}_0x14891e=_[_0x66c6('0x48')]({},_0x14891e,_0x2396d7[_0x66c6('0x4a')]);var _0x5e1a2a={'where':_0x14891e[_0x66c6('0x45')]};return db[_0x66c6('0x4b')][_0x66c6('0x2c')](_0x5e1a2a)[_0x66c6('0x33')](function(_0x3455a2){_0x369524[_0x66c6('0x2c')]=_0x3455a2;if(_0x2396d7[_0x66c6('0x3d')]['includeAll']){_0x14891e['include']=[{'all':!![]}];}return db[_0x66c6('0x4b')]['findAll'](_0x14891e);})['then'](function(_0x117aed){_0x369524[_0x66c6('0x4c')]=_0x117aed;return _0x369524;})['then'](respondWithFilteredResult(_0x5b3d8d,_0x14891e))[_0x66c6('0x24')](handleError(_0x5b3d8d,null));};exports[_0x66c6('0x4d')]=function(_0x2d0509,_0x35c449){var _0x165dc7={'raw':![],'where':{'id':_0x2d0509[_0x66c6('0x4e')]['id']}},_0x2ed281={};_0x2ed281['model']=_['keys'](db[_0x66c6('0x4b')]['rawAttributes']);_0x2ed281['query']=_[_0x66c6('0x4f')](_0x2d0509[_0x66c6('0x3d')]);_0x2ed281[_0x66c6('0x47')]=_['intersection'](_0x2ed281[_0x66c6('0x3b')],_0x2ed281[_0x66c6('0x3d')]);_0x165dc7[_0x66c6('0x3f')]=_[_0x66c6('0x3e')](_0x2ed281[_0x66c6('0x3b')],qs[_0x66c6('0x40')](_0x2d0509[_0x66c6('0x3d')][_0x66c6('0x40')]));_0x165dc7['attributes']=_0x165dc7['attributes']['length']?_0x165dc7['attributes']:_0x2ed281[_0x66c6('0x3b')];if(_0x2d0509['query'][_0x66c6('0x50')]){_0x165dc7['include']=[{'all':!![]}];}_0x165dc7=_[_0x66c6('0x48')]({},_0x165dc7,_0x2d0509['options']);return db['VoiceContext']['find'](_0x165dc7)[_0x66c6('0x33')](handleEntityNotFound(_0x35c449,null))['then'](respondWithResult(_0x35c449,null))[_0x66c6('0x24')](handleError(_0x35c449,null));};exports['create']=function(_0x101e4e,_0x58a443,_0x4e0c3d){var _0x290487;return db['VoiceContext'][_0x66c6('0x51')](_0x101e4e[_0x66c6('0x52')],{'raw':!![]})[_0x66c6('0x33')](function(_0x432ed9){_0x290487=_0x432ed9;return db[_0x66c6('0x4b')]['findAll']({'raw':!![]});})[_0x66c6('0x33')](function(_0x418d60){var _0x179327=fs[_0x66c6('0x53')](path['join'](config['root'],_0x66c6('0x54')),'utf8');var _0x59e5cd=ejs['render'](_0x179327,{'contexts':_0x418d60||[]});fs[_0x66c6('0x55')](_0x66c6('0x56'),_0x59e5cd);})['then'](function(){return respondWithRpcPromise('Reload',_0x66c6('0x51'),{'module':_0x66c6('0x57')});})['then'](function(){var _0x406ca0=_0x101e4e[_0x66c6('0x58')]['get']({'plain':!![]});if(!_0x406ca0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x406ca0[_0x66c6('0x59')]===_0x66c6('0x58')){var _0x401528=_0x290487[_0x66c6('0x34')]({'plain':!![]});return db['UserProfileSection'][_0x66c6('0x5a')]({'where':{'name':_0x66c6('0x5b'),'userProfileId':_0x406ca0[_0x66c6('0x5c')]},'raw':!![]})[_0x66c6('0x33')](function(_0x316c3a){if(_0x316c3a&&_0x316c3a[_0x66c6('0x5d')]===0x0){return db[_0x66c6('0x35')][_0x66c6('0x51')]({'name':_0x401528[_0x66c6('0x36')],'resourceId':_0x401528['id'],'type':_0x316c3a['name'],'sectionId':_0x316c3a['id']},{})[_0x66c6('0x33')](function(){return _0x290487;});}else{return _0x290487;}})['catch'](function(_0x2f6e62){logger[_0x66c6('0x20')](_0x66c6('0x5e'),_0x2f6e62);throw _0x2f6e62;});}return _0x290487;})[_0x66c6('0x33')](respondWithResult(_0x58a443,0xc9))[_0x66c6('0x24')](handleError(_0x58a443,null));};exports[_0x66c6('0x5f')]=function(_0x53e5f4,_0x356ebb,_0x3fcc25){var _0x475e1c;return db[_0x66c6('0x4b')][_0x66c6('0x5a')]({'where':{'id':_0x53e5f4[_0x66c6('0x4e')]['id']}})[_0x66c6('0x33')](handleEntityNotFound(_0x356ebb,null))[_0x66c6('0x33')](saveUpdates(_0x53e5f4[_0x66c6('0x52')],null))[_0x66c6('0x33')](function(_0x36294e){if(_0x36294e){_0x475e1c=_0x36294e;return db['VoiceContext'][_0x66c6('0x60')]({'raw':!![]});}})['then'](function(_0x534645){var _0x44ba81=fs[_0x66c6('0x53')](path[_0x66c6('0x61')](config[_0x66c6('0x62')],_0x66c6('0x54')),_0x66c6('0x63'));var _0x166017=ejs['render'](_0x44ba81,{'contexts':_0x534645||[]});fs[_0x66c6('0x55')](_0x66c6('0x56'),_0x166017);})[_0x66c6('0x33')](function(){return respondWithRpcPromise(_0x66c6('0x64'),_0x66c6('0x5f'),{'module':_0x66c6('0x57')});})[_0x66c6('0x33')](function(){return _0x475e1c;})[_0x66c6('0x33')](respondWithResult(_0x356ebb,null))[_0x66c6('0x24')](handleError(_0x356ebb,null));};exports[_0x66c6('0x32')]=function(_0x5a3b25,_0x48056e,_0x440522){var _0x5a475f;return db[_0x66c6('0x4b')][_0x66c6('0x5a')]({'where':{'id':_0x5a3b25['params']['id']}})[_0x66c6('0x33')](handleEntityNotFound(_0x48056e,null))['then'](removeEntity(_0x48056e,null))[_0x66c6('0x33')](function(){return db['VoiceContext'][_0x66c6('0x60')]({'raw':!![]});})[_0x66c6('0x33')](function(_0x4af1ca){var _0x32ad3d=fs[_0x66c6('0x53')](path[_0x66c6('0x61')](config[_0x66c6('0x62')],'server/files/templates/context.ejs'),_0x66c6('0x63'));var _0xade38f=ejs[_0x66c6('0x65')](_0x32ad3d,{'contexts':_0x4af1ca});fs['writeFileSync'](_0x66c6('0x56'),_0xade38f);return respondWithRpcPromise(_0x66c6('0x64'),'destroy',{'module':_0x66c6('0x57')});})[_0x66c6('0x24')](handleError(_0x48056e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f95f0b6..698caf7 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 _0xaca0=['VoiceContext','voice_contexts','util','../../config/logger','path','../../config/environment','./voiceContext.attributes','exports'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0xaca0,0xd2));var _0x0aca=function(_0xd94a00,_0x3170b5){_0xd94a00=_0xd94a00-0x0;var _0x2d7678=_0xaca0[_0xd94a00];return _0x2d7678;};'use strict';var _=require('lodash');var util=require(_0x0aca('0x0'));var logger=require(_0x0aca('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aca('0x2'));var rimraf=require('rimraf');var config=require(_0x0aca('0x3'));var attributes=require(_0x0aca('0x4'));module[_0x0aca('0x5')]=function(_0x3447d9,_0x460470){return _0x3447d9['define'](_0x0aca('0x6'),attributes,{'tableName':_0x0aca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cdc=['exports','define','VoiceContext','voice_contexts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2788fc,_0xeb8369){var _0xd69217=function(_0x25d103){while(--_0x25d103){_0x2788fc['push'](_0x2788fc['shift']());}};_0xd69217(++_0xeb8369);}(_0x7cdc,0x190));var _0xc7cd=function(_0x28e638,_0x84bcc4){_0x28e638=_0x28e638-0x0;var _0x16d504=_0x7cdc[_0x28e638];return _0x16d504;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))('api');var moment=require(_0xc7cd('0x2'));var BPromise=require(_0xc7cd('0x3'));var rp=require(_0xc7cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cd('0x5'));var config=require(_0xc7cd('0x6'));var attributes=require('./voiceContext.attributes');module[_0xc7cd('0x7')]=function(_0x26603f,_0x18bb1b){return _0x26603f[_0xc7cd('0x8')](_0xc7cd('0x9'),attributes,{'tableName':_0xc7cd('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 ea30503..f3db5ed 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 _0xeb3e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x88ae6c,_0x368fab){var _0x489e13=function(_0x3c85fb){while(--_0x3c85fb){_0x88ae6c['push'](_0x88ae6c['shift']());}};_0x489e13(++_0x368fab);}(_0xeb3e,0x106));var _0xeeb3=function(_0x329a33,_0x585897){_0x329a33=_0x329a33-0x0;var _0x2bef80=_0xeb3e[_0x329a33];return _0x2bef80;};'use strict';var _=require('lodash');var util=require(_0xeeb3('0x0'));var moment=require(_0xeeb3('0x1'));var BPromise=require(_0xeeb3('0x2'));var rs=require(_0xeeb3('0x3'));var fs=require('fs');var Redis=require(_0xeeb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeb3('0x5'));var logger=require(_0xeeb3('0x6'))(_0xeeb3('0x7'));var config=require('../../config/environment');var jayson=require(_0xeeb3('0x8'));var client=jayson['client'][_0xeeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93c82b,_0x2d1912,_0x435925){return new BPromise(function(_0x12be76,_0x959ad3){return client[_0xeeb3('0xa')](_0x93c82b,_0x435925)['then'](function(_0x5b751a){logger[_0xeeb3('0xb')](_0xeeb3('0xc'),_0x2d1912,_0xeeb3('0xd'));logger['debug'](_0xeeb3('0xe'),_0x2d1912,'request\x20sent',JSON['stringify'](_0x5b751a));if(_0x5b751a[_0xeeb3('0xf')]){if(_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x10')]===0x1f4){logger['error'](_0xeeb3('0xc'),_0x2d1912,_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);return _0x959ad3(_0x5b751a[_0xeeb3('0xf')]['message']);}logger['error'](_0xeeb3('0xc'),_0x2d1912,_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);return _0x12be76(_0x5b751a[_0xeeb3('0xf')][_0xeeb3('0x11')]);}else{logger[_0xeeb3('0xb')](_0xeeb3('0xc'),_0x2d1912,_0xeeb3('0xd'));_0x12be76(_0x5b751a[_0xeeb3('0x12')][_0xeeb3('0x11')]);}})[_0xeeb3('0x13')](function(_0x4f4f8b){logger[_0xeeb3('0xf')](_0xeeb3('0xc'),_0x2d1912,_0x4f4f8b);_0x959ad3(_0x4f4f8b);});});} \ No newline at end of file +var _0xaf4a=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6373ae,_0x58b42e){var _0x1ba442=function(_0x412261){while(--_0x412261){_0x6373ae['push'](_0x6373ae['shift']());}};_0x1ba442(++_0x58b42e);}(_0xaf4a,0x101));var _0xaaf4=function(_0x4836a7,_0xbf1219){_0x4836a7=_0x4836a7-0x0;var _0x1dd110=_0xaf4a[_0x4836a7];return _0x1dd110;};'use strict';var _=require('lodash');var util=require(_0xaaf4('0x0'));var moment=require(_0xaaf4('0x1'));var BPromise=require(_0xaaf4('0x2'));var rs=require(_0xaaf4('0x3'));var fs=require('fs');var Redis=require(_0xaaf4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaaf4('0x5'));var logger=require(_0xaaf4('0x6'))(_0xaaf4('0x7'));var config=require(_0xaaf4('0x8'));var jayson=require(_0xaaf4('0x9'));var client=jayson[_0xaaf4('0xa')][_0xaaf4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df037,_0x2e0a8f,_0x4c1e05){return new BPromise(function(_0x291c21,_0x30023a){return client['request'](_0x4df037,_0x4c1e05)[_0xaaf4('0xc')](function(_0x3f08e3){logger[_0xaaf4('0xd')](_0xaaf4('0xe'),_0x2e0a8f,_0xaaf4('0xf'));logger[_0xaaf4('0x10')](_0xaaf4('0x11'),_0x2e0a8f,_0xaaf4('0xf'),JSON[_0xaaf4('0x12')](_0x3f08e3));if(_0x3f08e3[_0xaaf4('0x13')]){if(_0x3f08e3[_0xaaf4('0x13')][_0xaaf4('0x14')]===0x1f4){logger[_0xaaf4('0x13')](_0xaaf4('0xe'),_0x2e0a8f,_0x3f08e3[_0xaaf4('0x13')][_0xaaf4('0x15')]);return _0x30023a(_0x3f08e3[_0xaaf4('0x13')][_0xaaf4('0x15')]);}logger[_0xaaf4('0x13')](_0xaaf4('0xe'),_0x2e0a8f,_0x3f08e3[_0xaaf4('0x13')]['message']);return _0x291c21(_0x3f08e3[_0xaaf4('0x13')]['message']);}else{logger[_0xaaf4('0xd')](_0xaaf4('0xe'),_0x2e0a8f,_0xaaf4('0xf'));_0x291c21(_0x3f08e3['result'][_0xaaf4('0x15')]);}})[_0xaaf4('0x16')](function(_0x1021fd){logger['error'](_0xaaf4('0xe'),_0x2e0a8f,_0x1021fd);_0x30023a(_0x1021fd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0f44670..c1f36bc 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 _0x4c95=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4c95,0x180));var _0x54c9=function(_0xac2868,_0x553923){_0xac2868=_0xac2868-0x0;var _0x43ed0d=_0x4c95[_0xac2868];return _0x43ed0d;};'use strict';var multer=require(_0x54c9('0x0'));var util=require(_0x54c9('0x1'));var path=require(_0x54c9('0x2'));var timeout=require(_0x54c9('0x3'));var express=require(_0x54c9('0x4'));var router=express[_0x54c9('0x5')]();var fs_extra=require(_0x54c9('0x6'));var auth=require(_0x54c9('0x7'));var interaction=require(_0x54c9('0x8'));var config=require(_0x54c9('0x9'));var controller=require('./voiceDialReport.controller');router[_0x54c9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x54c9('0xa')](_0x54c9('0xb'),auth[_0x54c9('0xc')](),controller[_0x54c9('0xd')]);router[_0x54c9('0xa')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller['show']);router['post']('/',auth[_0x54c9('0xc')](),controller[_0x54c9('0xf')]);router[_0x54c9('0x10')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller['update']);router[_0x54c9('0x11')](_0x54c9('0xe'),auth[_0x54c9('0xc')](),controller[_0x54c9('0x12')]);module[_0x54c9('0x13')]=router; \ No newline at end of file +var _0x732c=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x732c,0x151));var _0xc732=function(_0x137d08,_0x52e454){_0x137d08=_0x137d08-0x0;var _0x5457c5=_0x732c[_0x137d08];return _0x5457c5;};'use strict';var multer=require(_0xc732('0x0'));var util=require('util');var path=require(_0xc732('0x1'));var timeout=require('connect-timeout');var express=require(_0xc732('0x2'));var router=express['Router']();var fs_extra=require(_0xc732('0x3'));var auth=require(_0xc732('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc732('0x5'));var controller=require(_0xc732('0x6'));router[_0xc732('0x7')]('/',auth[_0xc732('0x8')](),controller[_0xc732('0x9')]);router[_0xc732('0x7')]('/describe',auth[_0xc732('0x8')](),controller['describe']);router[_0xc732('0x7')](_0xc732('0xa'),auth[_0xc732('0x8')](),controller[_0xc732('0xb')]);router[_0xc732('0xc')]('/',auth[_0xc732('0x8')](),controller[_0xc732('0xd')]);router[_0xc732('0xe')](_0xc732('0xa'),auth[_0xc732('0x8')](),controller[_0xc732('0xf')]);router[_0xc732('0x10')](_0xc732('0xa'),auth[_0xc732('0x8')](),controller[_0xc732('0x11')]);module[_0xc732('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 e3b8748..b57001c 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x32405a,_0x2d7ff){var _0xd56cbe=function(_0x96f490){while(--_0x96f490){_0x32405a['push'](_0x32405a['shift']());}};_0xd56cbe(++_0x2d7ff);}(_0x55ca,0x126));var _0xa55c=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0x55ca[_0x1c6efd];return _0x53a918;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x3e74,0x175));var _0x43e7=function(_0x41ca22,_0x35ec8f){_0x41ca22=_0x41ca22-0x0;var _0x43634c=_0x3e74[_0x41ca22];return _0x43634c;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'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 b87c326..359c006 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 _0x66db=['moment','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','map','VoiceDialReport','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66db,0xc9));var _0xb66d=function(_0x31cd63,_0x40d133){_0x31cd63=_0x31cd63-0x0;var _0x5a0f97=_0x66db[_0x31cd63];return _0x5a0f97;};'use strict';var emlformat=require(_0xb66d('0x0'));var rimraf=require(_0xb66d('0x1'));var zipdir=require(_0xb66d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb66d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb66d('0x4'));var sox=require(_0xb66d('0x5'));var csv=require(_0xb66d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb66d('0x7'));var _=require('lodash');var squel=require(_0xb66d('0x8'));var crypto=require(_0xb66d('0x9'));var jsforce=require(_0xb66d('0xa'));var deskjs=require(_0xb66d('0xb'));var toCsv=require(_0xb66d('0x6'));var querystring=require(_0xb66d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb66d('0xd'));var qs=require(_0xb66d('0xe'));var as=require(_0xb66d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb66d('0x10'));var utils=require('../../config/utils');var config=require(_0xb66d('0x11'));var licenseUtil=require(_0xb66d('0x12'));var db=require(_0xb66d('0x13'))['db'];function respondWithStatusCode(_0x188f93,_0x1b346f){_0x1b346f=_0x1b346f||0xcc;return function(_0x2f945f){if(_0x2f945f){return _0x188f93[_0xb66d('0x14')](_0x1b346f);}return _0x188f93[_0xb66d('0x15')](_0x1b346f)['end']();};}function respondWithResult(_0xe8b100,_0x4ecc0c){_0x4ecc0c=_0x4ecc0c||0xc8;return function(_0x3f38a7){if(_0x3f38a7){return _0xe8b100[_0xb66d('0x15')](_0x4ecc0c)[_0xb66d('0x16')](_0x3f38a7);}};}function respondWithFilteredResult(_0x2fa729,_0x179253){return function(_0xfd7678){if(_0xfd7678){var _0x3481c3=typeof _0x179253[_0xb66d('0x17')]===_0xb66d('0x18')&&typeof _0x179253[_0xb66d('0x19')]===_0xb66d('0x18');var _0x252b21=_0xfd7678[_0xb66d('0x1a')];var _0x38d51d=_0x3481c3?0x0:_0x179253[_0xb66d('0x17')];var _0x317ed9=_0x3481c3?_0xfd7678[_0xb66d('0x1a')]:_0x179253['offset']+_0x179253[_0xb66d('0x19')];var _0x5fb37a;if(_0x317ed9>=_0x252b21){_0x317ed9=_0x252b21;_0x5fb37a=0xc8;}else{_0x5fb37a=0xce;}_0x2fa729[_0xb66d('0x15')](_0x5fb37a);return _0x2fa729[_0xb66d('0x1b')](_0xb66d('0x1c'),_0x38d51d+'-'+_0x317ed9+'/'+_0x252b21)[_0xb66d('0x16')](_0xfd7678);}return null;};}function patchUpdates(_0x48b7e5){return function(_0x30563c){try{jsonpatch[_0xb66d('0x1d')](_0x30563c,_0x48b7e5,!![]);}catch(_0x47daed){return BPromise[_0xb66d('0x1e')](_0x47daed);}return _0x30563c[_0xb66d('0x1f')]();};}function saveUpdates(_0x15a99d,_0x218246){return function(_0x276d24){if(_0x276d24){return _0x276d24[_0xb66d('0x20')](_0x15a99d)[_0xb66d('0x21')](function(_0x2e4a87){return _0x2e4a87;});}return null;};}function removeEntity(_0xa2422f,_0x4f3d57){return function(_0x444487){if(_0x444487){return _0x444487['destroy']()[_0xb66d('0x21')](function(){_0xa2422f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176525,_0x54da98){return function(_0x35997c){if(!_0x35997c){_0x176525[_0xb66d('0x14')](0x194);}return _0x35997c;};}function handleError(_0x68bd61,_0x3cf5d9){_0x3cf5d9=_0x3cf5d9||0x1f4;return function(_0x10555a){logger[_0xb66d('0x22')](_0x10555a['stack']);if(_0x10555a[_0xb66d('0x23')]){delete _0x10555a[_0xb66d('0x23')];}_0x68bd61['status'](_0x3cf5d9)['send'](_0x10555a);};}exports['index']=function(_0x1f0479,_0x143003){var _0x31efab={},_0x3c43f2={},_0x10df42={'count':0x0,'rows':[]};var _0x58e6fe=_[_0xb66d('0x24')](db[_0xb66d('0x25')]['rawAttributes'],function(_0x26b63e){return{'name':_0x26b63e[_0xb66d('0x26')],'type':_0x26b63e[_0xb66d('0x27')]['key']};});_0x3c43f2['model']=_[_0xb66d('0x24')](_0x58e6fe,_0xb66d('0x23'));_0x3c43f2[_0xb66d('0x28')]=_['keys'](_0x1f0479[_0xb66d('0x28')]);_0x3c43f2[_0xb66d('0x29')]=_['intersection'](_0x3c43f2[_0xb66d('0x2a')],_0x3c43f2['query']);_0x31efab[_0xb66d('0x2b')]=_[_0xb66d('0x2c')](_0x3c43f2[_0xb66d('0x2a')],qs[_0xb66d('0x2d')](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x2d')]));_0x31efab['attributes']=_0x31efab[_0xb66d('0x2b')][_0xb66d('0x2e')]?_0x31efab[_0xb66d('0x2b')]:_0x3c43f2['model'];if(!_0x1f0479[_0xb66d('0x28')][_0xb66d('0x2f')]('nolimit')){_0x31efab[_0xb66d('0x19')]=qs[_0xb66d('0x19')](_0x1f0479[_0xb66d('0x28')]['limit']);_0x31efab[_0xb66d('0x17')]=qs['offset'](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x17')]);}_0x31efab['order']=qs['sort'](_0x1f0479[_0xb66d('0x28')][_0xb66d('0x30')]);_0x31efab[_0xb66d('0x31')]=qs[_0xb66d('0x29')](_[_0xb66d('0x32')](_0x1f0479[_0xb66d('0x28')],_0x3c43f2['filters']),_0x58e6fe);if(_0x1f0479[_0xb66d('0x28')][_0xb66d('0x33')]){_0x31efab[_0xb66d('0x31')]=_[_0xb66d('0x34')](_0x31efab['where'],{'$or':_[_0xb66d('0x24')](_0x58e6fe,function(_0x3d9f05){if(_0x3d9f05[_0xb66d('0x27')]!==_0xb66d('0x35')){var _0x291131={};_0x291131[_0x3d9f05[_0xb66d('0x23')]]={'$like':'%'+_0x1f0479[_0xb66d('0x28')][_0xb66d('0x33')]+'%'};return _0x291131;}})});}_0x31efab=_[_0xb66d('0x34')]({},_0x31efab,_0x1f0479[_0xb66d('0x36')]);var _0x2e45eb={'where':_0x31efab['where']};return db[_0xb66d('0x25')][_0xb66d('0x1a')](_0x2e45eb)[_0xb66d('0x21')](function(_0x51c3f8){_0x10df42[_0xb66d('0x1a')]=_0x51c3f8;if(_0x1f0479[_0xb66d('0x28')][_0xb66d('0x37')]){_0x31efab[_0xb66d('0x38')]=[{'all':!![]}];}return db[_0xb66d('0x25')][_0xb66d('0x39')](_0x31efab);})[_0xb66d('0x21')](function(_0x458e8e){_0x10df42['rows']=_0x458e8e;return _0x10df42;})[_0xb66d('0x21')](respondWithFilteredResult(_0x143003,_0x31efab))[_0xb66d('0x3a')](handleError(_0x143003,null));};exports[_0xb66d('0x3b')]=function(_0x5b920c,_0x26584f){var _0x375fcc={'raw':!![],'where':{'id':_0x5b920c['params']['id']}},_0x38b5ff={};_0x38b5ff['model']=_[_0xb66d('0x3c')](db['VoiceDialReport'][_0xb66d('0x3d')]);_0x38b5ff['query']=_[_0xb66d('0x3c')](_0x5b920c[_0xb66d('0x28')]);_0x38b5ff['filters']=_[_0xb66d('0x2c')](_0x38b5ff[_0xb66d('0x2a')],_0x38b5ff[_0xb66d('0x28')]);_0x375fcc[_0xb66d('0x2b')]=_['intersection'](_0x38b5ff[_0xb66d('0x2a')],qs[_0xb66d('0x2d')](_0x5b920c[_0xb66d('0x28')][_0xb66d('0x2d')]));_0x375fcc[_0xb66d('0x2b')]=_0x375fcc[_0xb66d('0x2b')][_0xb66d('0x2e')]?_0x375fcc[_0xb66d('0x2b')]:_0x38b5ff[_0xb66d('0x2a')];if(_0x5b920c[_0xb66d('0x28')][_0xb66d('0x37')]){_0x375fcc[_0xb66d('0x38')]=[{'all':!![]}];}_0x375fcc=_[_0xb66d('0x34')]({},_0x375fcc,_0x5b920c[_0xb66d('0x36')]);return db[_0xb66d('0x25')][_0xb66d('0x3e')](_0x375fcc)['then'](handleEntityNotFound(_0x26584f,null))['then'](respondWithResult(_0x26584f,null))['catch'](handleError(_0x26584f,null));};exports[_0xb66d('0x3f')]=function(_0x428dad,_0x3eaa37){return db[_0xb66d('0x25')]['create'](_0x428dad['body'],{})[_0xb66d('0x21')](respondWithResult(_0x3eaa37,0xc9))[_0xb66d('0x3a')](handleError(_0x3eaa37,null));};exports[_0xb66d('0x20')]=function(_0x3d1d17,_0x5015f2){if(_0x3d1d17[_0xb66d('0x40')]['id']){delete _0x3d1d17['body']['id'];}return db[_0xb66d('0x25')][_0xb66d('0x3e')]({'where':{'id':_0x3d1d17[_0xb66d('0x41')]['id']}})[_0xb66d('0x21')](handleEntityNotFound(_0x5015f2,null))[_0xb66d('0x21')](saveUpdates(_0x3d1d17['body'],null))[_0xb66d('0x21')](respondWithResult(_0x5015f2,null))['catch'](handleError(_0x5015f2,null));};exports[_0xb66d('0x42')]=function(_0x3b5dd6,_0xcfde93){return db[_0xb66d('0x25')]['find']({'where':{'id':_0x3b5dd6['params']['id']}})['then'](handleEntityNotFound(_0xcfde93,null))[_0xb66d('0x21')](removeEntity(_0xcfde93,null))['catch'](handleError(_0xcfde93,null));};exports[_0xb66d('0x43')]=function(_0x527528,_0x26179e){return db[_0xb66d('0x25')]['describe']()[_0xb66d('0x21')](respondWithResult(_0x26179e,null))[_0xb66d('0x3a')](handleError(_0x26179e,null));}; \ No newline at end of file +var _0xfa21=['catch','include','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','findAll','rows'];(function(_0x440a0d,_0x4db8ff){var _0x438f67=function(_0x4a88d0){while(--_0x4a88d0){_0x440a0d['push'](_0x440a0d['shift']());}};_0x438f67(++_0x4db8ff);}(_0xfa21,0x193));var _0x1fa2=function(_0x2f9aca,_0x98ecde){_0x2f9aca=_0x2f9aca-0x0;var _0x2fa5f7=_0xfa21[_0x2f9aca];return _0x2fa5f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fa2('0x0'));var zipdir=require(_0x1fa2('0x1'));var jsonpatch=require(_0x1fa2('0x2'));var rp=require(_0x1fa2('0x3'));var moment=require(_0x1fa2('0x4'));var BPromise=require(_0x1fa2('0x5'));var Mustache=require(_0x1fa2('0x6'));var util=require(_0x1fa2('0x7'));var path=require(_0x1fa2('0x8'));var sox=require(_0x1fa2('0x9'));var csv=require('to-csv');var ejs=require(_0x1fa2('0xa'));var fs=require('fs');var fs_extra=require(_0x1fa2('0xb'));var _=require(_0x1fa2('0xc'));var squel=require(_0x1fa2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1fa2('0xe'));var toCsv=require(_0x1fa2('0xf'));var querystring=require(_0x1fa2('0x10'));var Papa=require(_0x1fa2('0x11'));var Redis=require(_0x1fa2('0x12'));var authService=require(_0x1fa2('0x13'));var qs=require(_0x1fa2('0x14'));var as=require(_0x1fa2('0x15'));var hardwareService=require(_0x1fa2('0x16'));var logger=require(_0x1fa2('0x17'))(_0x1fa2('0x18'));var utils=require(_0x1fa2('0x19'));var config=require(_0x1fa2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fa2('0x1b'))['db'];function respondWithStatusCode(_0x528450,_0x568e9c){_0x568e9c=_0x568e9c||0xcc;return function(_0x30400d){if(_0x30400d){return _0x528450[_0x1fa2('0x1c')](_0x568e9c);}return _0x528450[_0x1fa2('0x1d')](_0x568e9c)['end']();};}function respondWithResult(_0x1d10c1,_0x2dabdc){_0x2dabdc=_0x2dabdc||0xc8;return function(_0x3e7611){if(_0x3e7611){return _0x1d10c1[_0x1fa2('0x1d')](_0x2dabdc)['json'](_0x3e7611);}};}function respondWithFilteredResult(_0x3815d2,_0x5e89df){return function(_0x2c11a6){if(_0x2c11a6){var _0x2301bd=typeof _0x5e89df['offset']===_0x1fa2('0x1e')&&typeof _0x5e89df[_0x1fa2('0x1f')]===_0x1fa2('0x1e');var _0x5d0816=_0x2c11a6[_0x1fa2('0x20')];var _0x420037=_0x2301bd?0x0:_0x5e89df[_0x1fa2('0x21')];var _0x1a05c7=_0x2301bd?_0x2c11a6['count']:_0x5e89df[_0x1fa2('0x21')]+_0x5e89df[_0x1fa2('0x1f')];var _0x2da92a;if(_0x1a05c7>=_0x5d0816){_0x1a05c7=_0x5d0816;_0x2da92a=0xc8;}else{_0x2da92a=0xce;}_0x3815d2[_0x1fa2('0x1d')](_0x2da92a);return _0x3815d2[_0x1fa2('0x22')](_0x1fa2('0x23'),_0x420037+'-'+_0x1a05c7+'/'+_0x5d0816)['json'](_0x2c11a6);}return null;};}function patchUpdates(_0x4a303e){return function(_0x448a87){try{jsonpatch[_0x1fa2('0x24')](_0x448a87,_0x4a303e,!![]);}catch(_0x27066b){return BPromise[_0x1fa2('0x25')](_0x27066b);}return _0x448a87['save']();};}function saveUpdates(_0xcdd2cd,_0x578afa){return function(_0x347116){if(_0x347116){return _0x347116[_0x1fa2('0x26')](_0xcdd2cd)[_0x1fa2('0x27')](function(_0x6451c3){return _0x6451c3;});}return null;};}function removeEntity(_0x64e592,_0x370d4f){return function(_0x3201d8){if(_0x3201d8){return _0x3201d8[_0x1fa2('0x28')]()['then'](function(){_0x64e592['status'](0xcc)[_0x1fa2('0x29')]();});}};}function handleEntityNotFound(_0x437c6b,_0x44bb8e){return function(_0x4ddb9f){if(!_0x4ddb9f){_0x437c6b[_0x1fa2('0x1c')](0x194);}return _0x4ddb9f;};}function handleError(_0x9ea39e,_0x36e67e){_0x36e67e=_0x36e67e||0x1f4;return function(_0x327631){logger[_0x1fa2('0x2a')](_0x327631[_0x1fa2('0x2b')]);if(_0x327631[_0x1fa2('0x2c')]){delete _0x327631[_0x1fa2('0x2c')];}_0x9ea39e[_0x1fa2('0x1d')](_0x36e67e)['send'](_0x327631);};}exports[_0x1fa2('0x2d')]=function(_0xaa9728,_0x48a367){var _0x546ad7={},_0x157108={},_0x7c06b0={'count':0x0,'rows':[]};var _0x2c435d=_[_0x1fa2('0x2e')](db[_0x1fa2('0x2f')][_0x1fa2('0x30')],function(_0x2bd7a1){return{'name':_0x2bd7a1['fieldName'],'type':_0x2bd7a1[_0x1fa2('0x31')][_0x1fa2('0x32')]};});_0x157108[_0x1fa2('0x33')]=_[_0x1fa2('0x2e')](_0x2c435d,_0x1fa2('0x2c'));_0x157108['query']=_[_0x1fa2('0x34')](_0xaa9728['query']);_0x157108['filters']=_[_0x1fa2('0x35')](_0x157108[_0x1fa2('0x33')],_0x157108[_0x1fa2('0x36')]);_0x546ad7['attributes']=_[_0x1fa2('0x35')](_0x157108[_0x1fa2('0x33')],qs[_0x1fa2('0x37')](_0xaa9728['query'][_0x1fa2('0x37')]));_0x546ad7['attributes']=_0x546ad7[_0x1fa2('0x38')][_0x1fa2('0x39')]?_0x546ad7[_0x1fa2('0x38')]:_0x157108[_0x1fa2('0x33')];if(!_0xaa9728[_0x1fa2('0x36')][_0x1fa2('0x3a')](_0x1fa2('0x3b'))){_0x546ad7['limit']=qs[_0x1fa2('0x1f')](_0xaa9728[_0x1fa2('0x36')][_0x1fa2('0x1f')]);_0x546ad7[_0x1fa2('0x21')]=qs[_0x1fa2('0x21')](_0xaa9728[_0x1fa2('0x36')][_0x1fa2('0x21')]);}_0x546ad7[_0x1fa2('0x3c')]=qs[_0x1fa2('0x3d')](_0xaa9728[_0x1fa2('0x36')][_0x1fa2('0x3d')]);_0x546ad7[_0x1fa2('0x3e')]=qs[_0x1fa2('0x3f')](_[_0x1fa2('0x40')](_0xaa9728[_0x1fa2('0x36')],_0x157108['filters']),_0x2c435d);if(_0xaa9728[_0x1fa2('0x36')]['filter']){_0x546ad7[_0x1fa2('0x3e')]=_[_0x1fa2('0x41')](_0x546ad7[_0x1fa2('0x3e')],{'$or':_[_0x1fa2('0x2e')](_0x2c435d,function(_0xa003cd){if(_0xa003cd[_0x1fa2('0x31')]!==_0x1fa2('0x42')){var _0x368dd3={};_0x368dd3[_0xa003cd[_0x1fa2('0x2c')]]={'$like':'%'+_0xaa9728[_0x1fa2('0x36')][_0x1fa2('0x43')]+'%'};return _0x368dd3;}})});}_0x546ad7=_[_0x1fa2('0x41')]({},_0x546ad7,_0xaa9728['options']);var _0x38bafe={'where':_0x546ad7[_0x1fa2('0x3e')]};return db[_0x1fa2('0x2f')]['count'](_0x38bafe)[_0x1fa2('0x27')](function(_0x59ec9e){_0x7c06b0[_0x1fa2('0x20')]=_0x59ec9e;if(_0xaa9728['query'][_0x1fa2('0x44')]){_0x546ad7['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x1fa2('0x45')](_0x546ad7);})[_0x1fa2('0x27')](function(_0x23cdd9){_0x7c06b0[_0x1fa2('0x46')]=_0x23cdd9;return _0x7c06b0;})[_0x1fa2('0x27')](respondWithFilteredResult(_0x48a367,_0x546ad7))[_0x1fa2('0x47')](handleError(_0x48a367,null));};exports['show']=function(_0x37f84c,_0x13307e){var _0x555ee4={'raw':!![],'where':{'id':_0x37f84c['params']['id']}},_0x2fbfe7={};_0x2fbfe7[_0x1fa2('0x33')]=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x2fbfe7['query']=_['keys'](_0x37f84c[_0x1fa2('0x36')]);_0x2fbfe7['filters']=_[_0x1fa2('0x35')](_0x2fbfe7[_0x1fa2('0x33')],_0x2fbfe7[_0x1fa2('0x36')]);_0x555ee4[_0x1fa2('0x38')]=_['intersection'](_0x2fbfe7[_0x1fa2('0x33')],qs['fields'](_0x37f84c[_0x1fa2('0x36')][_0x1fa2('0x37')]));_0x555ee4[_0x1fa2('0x38')]=_0x555ee4[_0x1fa2('0x38')][_0x1fa2('0x39')]?_0x555ee4[_0x1fa2('0x38')]:_0x2fbfe7[_0x1fa2('0x33')];if(_0x37f84c[_0x1fa2('0x36')]['includeAll']){_0x555ee4[_0x1fa2('0x48')]=[{'all':!![]}];}_0x555ee4=_[_0x1fa2('0x41')]({},_0x555ee4,_0x37f84c[_0x1fa2('0x49')]);return db['VoiceDialReport'][_0x1fa2('0x4a')](_0x555ee4)['then'](handleEntityNotFound(_0x13307e,null))['then'](respondWithResult(_0x13307e,null))[_0x1fa2('0x47')](handleError(_0x13307e,null));};exports[_0x1fa2('0x4b')]=function(_0x1fed1c,_0x364965){return db[_0x1fa2('0x2f')][_0x1fa2('0x4b')](_0x1fed1c[_0x1fa2('0x4c')],{})[_0x1fa2('0x27')](respondWithResult(_0x364965,0xc9))[_0x1fa2('0x47')](handleError(_0x364965,null));};exports[_0x1fa2('0x26')]=function(_0x580e11,_0x1942f8){if(_0x580e11[_0x1fa2('0x4c')]['id']){delete _0x580e11[_0x1fa2('0x4c')]['id'];}return db[_0x1fa2('0x2f')][_0x1fa2('0x4a')]({'where':{'id':_0x580e11[_0x1fa2('0x4d')]['id']}})[_0x1fa2('0x27')](handleEntityNotFound(_0x1942f8,null))[_0x1fa2('0x27')](saveUpdates(_0x580e11[_0x1fa2('0x4c')],null))[_0x1fa2('0x27')](respondWithResult(_0x1942f8,null))[_0x1fa2('0x47')](handleError(_0x1942f8,null));};exports[_0x1fa2('0x28')]=function(_0x1d697d,_0x17b398){return db[_0x1fa2('0x2f')][_0x1fa2('0x4a')]({'where':{'id':_0x1d697d['params']['id']}})['then'](handleEntityNotFound(_0x17b398,null))[_0x1fa2('0x27')](removeEntity(_0x17b398,null))[_0x1fa2('0x47')](handleError(_0x17b398,null));};exports[_0x1fa2('0x4e')]=function(_0x1dec6c,_0x2bb16d){return db[_0x1fa2('0x2f')][_0x1fa2('0x4e')]()[_0x1fa2('0x27')](respondWithResult(_0x2bb16d,null))[_0x1fa2('0x47')](handleError(_0x2bb16d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d42d9e4..43ca051 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 _0x1404=['exports','define','report_dial','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x42da61,_0x3e4fc2){var _0x40f5fa=function(_0x10cf63){while(--_0x10cf63){_0x42da61['push'](_0x42da61['shift']());}};_0x40f5fa(++_0x3e4fc2);}(_0x1404,0x1e3));var _0x4140=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1404[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x4140('0x0'));var util=require(_0x4140('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4140('0x2'));var BPromise=require(_0x4140('0x3'));var rp=require(_0x4140('0x4'));var fs=require('fs');var path=require(_0x4140('0x5'));var rimraf=require(_0x4140('0x6'));var config=require(_0x4140('0x7'));var attributes=require(_0x4140('0x8'));module[_0x4140('0x9')]=function(_0x378389,_0x145ee4){return _0x378389[_0x4140('0xa')]('VoiceDialReport',attributes,{'tableName':_0x4140('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['define','VoiceDialReport','report_dial','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xe49211,_0x25d19c){var _0x5d1e5c=function(_0x176319){while(--_0x176319){_0xe49211['push'](_0xe49211['shift']());}};_0x5d1e5c(++_0x25d19c);}(_0x430c,0x177));var _0xc430=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x430c[_0x127c7b];return _0x1708eb;};'use strict';var _=require('lodash');var util=require(_0xc430('0x0'));var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require(_0xc430('0x4'));var fs=require('fs');var path=require(_0xc430('0x5'));var rimraf=require(_0xc430('0x6'));var config=require(_0xc430('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xc430('0x8')]=function(_0x4e56cb,_0x3f4f89){return _0x4e56cb[_0xc430('0x9')](_0xc430('0xa'),attributes,{'tableName':_0xc430('0xb'),'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 0f82d3a..19d6daa 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 _0x8de4=['jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VoiceDialReport','create','options','raw','then','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','body','where','attributes','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8de4,0x1ca));var _0x48de=function(_0x454434,_0x19d14f){_0x454434=_0x454434-0x0;var _0x4601f8=_0x8de4[_0x454434];return _0x4601f8;};'use strict';var _=require('lodash');var util=require(_0x48de('0x0'));var moment=require(_0x48de('0x1'));var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require(_0x48de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48de('0x4'))(_0x48de('0x5'));var config=require(_0x48de('0x6'));var jayson=require(_0x48de('0x7'));var client=jayson[_0x48de('0x8')][_0x48de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384388,_0x31e670,_0x1ec6ce){return new BPromise(function(_0x38bb79,_0xab5557){return client[_0x48de('0xa')](_0x384388,_0x1ec6ce)['then'](function(_0x30f6d5){logger['info'](_0x48de('0xb'),_0x31e670,_0x48de('0xc'));logger[_0x48de('0xd')](_0x48de('0xe'),_0x31e670,_0x48de('0xc'),JSON['stringify'](_0x30f6d5));if(_0x30f6d5[_0x48de('0xf')]){if(_0x30f6d5[_0x48de('0xf')]['code']===0x1f4){logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x30f6d5[_0x48de('0xf')][_0x48de('0x10')]);return _0xab5557(_0x30f6d5[_0x48de('0xf')][_0x48de('0x10')]);}logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x30f6d5['error'][_0x48de('0x10')]);return _0x38bb79(_0x30f6d5[_0x48de('0xf')]['message']);}else{logger[_0x48de('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x31e670,_0x48de('0xc'));_0x38bb79(_0x30f6d5[_0x48de('0x12')][_0x48de('0x10')]);}})[_0x48de('0x13')](function(_0x9f5d81){logger[_0x48de('0xf')](_0x48de('0xb'),_0x31e670,_0x9f5d81);_0xab5557(_0x9f5d81);});});}exports['CreateVoiceDialReport']=function(_0x12d80d){var _0x1a8352=this;return new Promise(function(_0x1d1453,_0x5b9021){return db[_0x48de('0x14')][_0x48de('0x15')](_0x12d80d['body'],{'raw':_0x12d80d[_0x48de('0x16')]?_0x12d80d[_0x48de('0x16')][_0x48de('0x17')]===undefined?!![]:![]:!![]})[_0x48de('0x18')](function(_0x57bd25){logger[_0x48de('0x11')](_0x48de('0x19'),_0x12d80d);logger[_0x48de('0xd')]('CreateVoiceDialReport',_0x12d80d,JSON[_0x48de('0x1a')](_0x57bd25));_0x1d1453(_0x57bd25);})[_0x48de('0x13')](function(_0x49dc56){logger[_0x48de('0xf')](_0x48de('0x19'),_0x49dc56[_0x48de('0x10')],_0x12d80d);_0x5b9021(_0x1a8352[_0x48de('0xf')](0x1f4,_0x49dc56['message']));});});};exports[_0x48de('0x1b')]=function(_0x39804e){var _0x466198=this;return new Promise(function(_0x1137e8,_0x58de02){return db['VoiceDialReport']['update'](_0x39804e[_0x48de('0x1c')],{'raw':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')][_0x48de('0x1d')]||null:null,'attributes':_0x39804e[_0x48de('0x16')]?_0x39804e[_0x48de('0x16')][_0x48de('0x1e')]||null:null,'limit':_0x39804e[_0x48de('0x16')]?_0x39804e['options']['limit']||null:null})[_0x48de('0x18')](function(_0x219720){logger[_0x48de('0x11')](_0x48de('0x1b'),_0x39804e);logger[_0x48de('0xd')](_0x48de('0x1b'),_0x39804e,JSON[_0x48de('0x1a')](_0x219720));_0x1137e8(_0x219720);})['catch'](function(_0x287b0c){logger[_0x48de('0xf')](_0x48de('0x1b'),_0x287b0c[_0x48de('0x10')],_0x39804e);_0x58de02(_0x466198[_0x48de('0xf')](0x1f4,_0x287b0c[_0x48de('0x10')]));});});}; \ No newline at end of file +var _0xa907=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0xa907,0x152));var _0x7a90=function(_0x5c399e,_0x220678){_0x5c399e=_0x5c399e-0x0;var _0x16219c=_0xa907[_0x5c399e];return _0x16219c;};'use strict';var _=require(_0x7a90('0x0'));var util=require(_0x7a90('0x1'));var moment=require(_0x7a90('0x2'));var BPromise=require(_0x7a90('0x3'));var rs=require(_0x7a90('0x4'));var fs=require('fs');var Redis=require(_0x7a90('0x5'));var db=require(_0x7a90('0x6'))['db'];var utils=require(_0x7a90('0x7'));var logger=require('../../config/logger')(_0x7a90('0x8'));var config=require(_0x7a90('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7a90('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21d2f2,_0xd7bf02,_0x18e4fd){return new BPromise(function(_0x15b6c1,_0x12b302){return client[_0x7a90('0xb')](_0x21d2f2,_0x18e4fd)['then'](function(_0x56df73){logger[_0x7a90('0xc')](_0x7a90('0xd'),_0xd7bf02,_0x7a90('0xe'));logger[_0x7a90('0xf')](_0x7a90('0x10'),_0xd7bf02,'request\x20sent',JSON[_0x7a90('0x11')](_0x56df73));if(_0x56df73[_0x7a90('0x12')]){if(_0x56df73[_0x7a90('0x12')][_0x7a90('0x13')]===0x1f4){logger[_0x7a90('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xd7bf02,_0x56df73['error'][_0x7a90('0x14')]);return _0x12b302(_0x56df73[_0x7a90('0x12')]['message']);}logger[_0x7a90('0x12')](_0x7a90('0xd'),_0xd7bf02,_0x56df73['error'][_0x7a90('0x14')]);return _0x15b6c1(_0x56df73[_0x7a90('0x12')][_0x7a90('0x14')]);}else{logger[_0x7a90('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0xd7bf02,'request\x20sent');_0x15b6c1(_0x56df73[_0x7a90('0x15')][_0x7a90('0x14')]);}})[_0x7a90('0x16')](function(_0x3ce2c0){logger[_0x7a90('0x12')](_0x7a90('0xd'),_0xd7bf02,_0x3ce2c0);_0x12b302(_0x3ce2c0);});});}exports['CreateVoiceDialReport']=function(_0xe00e4d){var _0x3bc0ad=this;return new Promise(function(_0x1b79fd,_0x40a6ef){return db[_0x7a90('0x17')][_0x7a90('0x18')](_0xe00e4d[_0x7a90('0x19')],{'raw':_0xe00e4d[_0x7a90('0x1a')]?_0xe00e4d['options']['raw']===undefined?!![]:![]:!![]})[_0x7a90('0x1b')](function(_0x58eb7e){logger['info'](_0x7a90('0x1c'),_0xe00e4d);logger['debug'](_0x7a90('0x1c'),_0xe00e4d,JSON['stringify'](_0x58eb7e));_0x1b79fd(_0x58eb7e);})[_0x7a90('0x16')](function(_0x499078){logger[_0x7a90('0x12')]('CreateVoiceDialReport',_0x499078[_0x7a90('0x14')],_0xe00e4d);_0x40a6ef(_0x3bc0ad[_0x7a90('0x12')](0x1f4,_0x499078[_0x7a90('0x14')]));});});};exports[_0x7a90('0x1d')]=function(_0x5b208b){var _0x1d7241=this;return new Promise(function(_0x35da54,_0x2bb9c5){return db[_0x7a90('0x17')][_0x7a90('0x1e')](_0x5b208b[_0x7a90('0x19')],{'raw':_0x5b208b[_0x7a90('0x1a')]?_0x5b208b[_0x7a90('0x1a')][_0x7a90('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b208b[_0x7a90('0x1a')]?_0x5b208b[_0x7a90('0x1a')][_0x7a90('0x20')]||null:null,'attributes':_0x5b208b[_0x7a90('0x1a')]?_0x5b208b['options'][_0x7a90('0x21')]||null:null,'limit':_0x5b208b[_0x7a90('0x1a')]?_0x5b208b['options'][_0x7a90('0x22')]||null:null})['then'](function(_0x35acbe){logger[_0x7a90('0xc')](_0x7a90('0x1d'),_0x5b208b);logger[_0x7a90('0xf')](_0x7a90('0x1d'),_0x5b208b,JSON[_0x7a90('0x11')](_0x35acbe));_0x35da54(_0x35acbe);})[_0x7a90('0x16')](function(_0x274b0b){logger[_0x7a90('0x12')](_0x7a90('0x1d'),_0x274b0b[_0x7a90('0x14')],_0x5b208b);_0x2bb9c5(_0x1d7241[_0x7a90('0x12')](0x1f4,_0x274b0b[_0x7a90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7b363ca..6e55049 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 _0xa458=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','destroy','exports'];(function(_0x14e9bf,_0x4ae6af){var _0x3506fc=function(_0x44d6a5){while(--_0x44d6a5){_0x14e9bf['push'](_0x14e9bf['shift']());}};_0x3506fc(++_0x4ae6af);}(_0xa458,0x1c8));var _0x8a45=function(_0xabf37c,_0xef5053){_0xabf37c=_0xabf37c-0x0;var _0x547f02=_0xa458[_0xabf37c];return _0x547f02;};'use strict';var multer=require(_0x8a45('0x0'));var util=require(_0x8a45('0x1'));var path=require(_0x8a45('0x2'));var timeout=require(_0x8a45('0x3'));var express=require(_0x8a45('0x4'));var router=express[_0x8a45('0x5')]();var fs_extra=require(_0x8a45('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a45('0x7'));var controller=require(_0x8a45('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8a45('0x9')](_0x8a45('0xa'),auth[_0x8a45('0xb')](),controller[_0x8a45('0xc')]);router[_0x8a45('0xd')]('/',auth[_0x8a45('0xb')](),controller[_0x8a45('0xe')]);router['post'](_0x8a45('0xf'),auth[_0x8a45('0xb')](),controller[_0x8a45('0x10')]);router['put']('/:id',auth[_0x8a45('0xb')](),controller['update']);router['delete']('/:id',auth[_0x8a45('0xb')](),controller[_0x8a45('0x11')]);module[_0x8a45('0x12')]=router; \ No newline at end of file +var _0xed66=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path'];(function(_0x3039f4,_0x8b7c9e){var _0x16b957=function(_0x436fb9){while(--_0x436fb9){_0x3039f4['push'](_0x3039f4['shift']());}};_0x16b957(++_0x8b7c9e);}(_0xed66,0x138));var _0x6ed6=function(_0x11a05f,_0x38a6af){_0x11a05f=_0x11a05f-0x0;var _0xdfea63=_0xed66[_0x11a05f];return _0xdfea63;};'use strict';var multer=require(_0x6ed6('0x0'));var util=require(_0x6ed6('0x1'));var path=require(_0x6ed6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ed6('0x3'));var router=express[_0x6ed6('0x4')]();var fs_extra=require(_0x6ed6('0x5'));var auth=require(_0x6ed6('0x6'));var interaction=require(_0x6ed6('0x7'));var config=require(_0x6ed6('0x8'));var controller=require('./voiceExtension.controller');router[_0x6ed6('0x9')]('/',auth[_0x6ed6('0xa')](),controller['index']);router[_0x6ed6('0x9')](_0x6ed6('0xb'),auth[_0x6ed6('0xa')](),controller[_0x6ed6('0xc')]);router[_0x6ed6('0xd')]('/',auth[_0x6ed6('0xa')](),controller[_0x6ed6('0xe')]);router[_0x6ed6('0xd')](_0x6ed6('0xf'),auth[_0x6ed6('0xa')](),controller[_0x6ed6('0x10')]);router[_0x6ed6('0x11')](_0x6ed6('0xb'),auth[_0x6ed6('0xa')](),controller['update']);router[_0x6ed6('0x12')](_0x6ed6('0xb'),auth[_0x6ed6('0xa')](),controller[_0x6ed6('0x13')]);module[_0x6ed6('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7746e2b..8bc5660 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 _0xf826=['ENUM','inbound','outbound','internal','outbound-fax','system','any','INTEGER','BOOLEAN','wav','getDataValue','exports','STRING','compositeIndex','NoOp'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0xf826,0xdd));var _0x6f82=function(_0x4e44f6,_0x17c136){_0x4e44f6=_0x4e44f6-0x0;var _0x461044=_0xf826[_0x4e44f6];return _0x461044;};'use strict';var Sequelize=require('sequelize');module[_0x6f82('0x0')]={'context':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'unique':_0x6f82('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x6f82('0x2')},'tag':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6f82('0x1')],'allowNull':![],'defaultValue':_0x6f82('0x3')},'appdata':{'type':Sequelize[_0x6f82('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6f82('0x4')](_0x6f82('0x5'),_0x6f82('0x6'),_0x6f82('0x7'),'inbound-fax',_0x6f82('0x8'),_0x6f82('0x9'),_0x6f82('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x6f82('0xb')]},'isApp':{'type':Sequelize[_0x6f82('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x6f82('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x6f82('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6f82('0xb')]},'recordingFormat':{'type':Sequelize[_0x6f82('0x1')],'defaultValue':_0x6f82('0xd')},'answer':{'type':Sequelize[_0x6f82('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45418a){return this[_0x6f82('0xe')]('exten');}},'alias':{'type':Sequelize[_0x6f82('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x940f=['wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','internal','inbound-fax','outbound-fax','any','BOOLEAN','INTEGER'];(function(_0x409f06,_0x178cac){var _0x174813=function(_0x5a3dd1){while(--_0x5a3dd1){_0x409f06['push'](_0x409f06['shift']());}};_0x174813(++_0x178cac);}(_0x940f,0x1d8));var _0xf940=function(_0x37cca4,_0x1c7937){_0x37cca4=_0x37cca4-0x0;var _0x4bd8b1=_0x940f[_0x37cca4];return _0x4bd8b1;};'use strict';var Sequelize=require('sequelize');module[_0xf940('0x0')]={'context':{'type':Sequelize[_0xf940('0x1')],'allowNull':![],'unique':_0xf940('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf940('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xf940('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xf940('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound','outbound',_0xf940('0x3'),_0xf940('0x4'),_0xf940('0x5'),'system',_0xf940('0x6')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf940('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xf940('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf940('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xf940('0x7')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf940('0x8')]},'recordingFormat':{'type':Sequelize[_0xf940('0x1')],'defaultValue':_0xf940('0x9')},'answer':{'type':Sequelize[_0xf940('0x7')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf940('0xa')],'get':function(_0x5db85b){return this[_0xf940('0xb')](_0xf940('0xc'));}},'alias':{'type':Sequelize[_0xf940('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 52dc312..bbc7451 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 _0x739a=['count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','UserProfileResource','stack','send','VoiceExtension','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','findAll','catch','show','params','rawAttributes','includeAll','include','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x739a,0x10c));var _0xa739=function(_0x2484be,_0x12368d){_0x2484be=_0x2484be-0x0;var _0x2953f1=_0x739a[_0x2484be];return _0x2953f1;};'use strict';var _=require('lodash');var Redis=require(_0xa739('0x0'));var qs=require(_0xa739('0x1'));var logger=require(_0xa739('0x2'))(_0xa739('0x3'));var config=require(_0xa739('0x4'));var db=require('../../mysqldb')['db'];config[_0xa739('0x5')]=_[_0xa739('0x6')](config[_0xa739('0x5')],{'host':_0xa739('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa739('0x5')]));require(_0xa739('0x8'))[_0xa739('0x9')](socket);function respondWithStatusCode(_0x14b961,_0x545c5a){_0x545c5a=_0x545c5a||0xcc;return function(_0x46b212){if(_0x46b212){return _0x14b961[_0xa739('0xa')](_0x545c5a);}return _0x14b961[_0xa739('0xb')](_0x545c5a)[_0xa739('0xc')]();};}function respondWithResult(_0x1e24df,_0x11011c){_0x11011c=_0x11011c||0xc8;return function(_0x14d764){if(_0x14d764){return _0x1e24df[_0xa739('0xb')](_0x11011c)[_0xa739('0xd')](_0x14d764);}};}function respondWithFilteredResult(_0x992be6,_0x3d49ce){return function(_0x2909d1){if(_0x2909d1){var _0x37ea9a=typeof _0x3d49ce[_0xa739('0xe')]===_0xa739('0xf')&&typeof _0x3d49ce[_0xa739('0x10')]===_0xa739('0xf');var _0x1be258=_0x2909d1[_0xa739('0x11')];var _0x5c1caf=_0x37ea9a?0x0:_0x3d49ce[_0xa739('0xe')];var _0x11ead4=_0x37ea9a?_0x2909d1[_0xa739('0x11')]:_0x3d49ce[_0xa739('0xe')]+_0x3d49ce[_0xa739('0x10')];var _0x767866;if(_0x11ead4>=_0x1be258){_0x11ead4=_0x1be258;_0x767866=0xc8;}else{_0x767866=0xce;}_0x992be6['status'](_0x767866);return _0x992be6[_0xa739('0x12')]('Content-Range',_0x5c1caf+'-'+_0x11ead4+'/'+_0x1be258)[_0xa739('0xd')](_0x2909d1);}return null;};}function removeEntity(_0x90277f){return function(_0xdd053a){if(_0xdd053a){return _0xdd053a[_0xa739('0x13')]()[_0xa739('0x14')](function(){var _0x3c5bbe=_0xdd053a[_0xa739('0x15')]({'plain':!![]});var _0x5e58bf=[{'name':_0xa739('0x16'),'value':_0xa739('0x17'),'ignore':![]},{'name':_0xa739('0x18'),'value':_0xa739('0x19'),'ignore':![]},{'name':_0xa739('0x1a'),'value':_0xa739('0x1b'),'ignore':![]}];var _0x1989f7=_(_0x5e58bf)[_0xa739('0x1c')](_0xa739('0x1d'))[_0xa739('0x1e')]('value')[_0xa739('0x1f')]();if(_['includes'](_0x1989f7,_0x3c5bbe['type'])){return;}var _0x18a201=_[_0xa739('0x20')](_0x5e58bf,['value',_0x3c5bbe[_0xa739('0x21')]])[_0xa739('0x22')];return db[_0xa739('0x23')][_0xa739('0x13')]({'where':{'type':_0x18a201,'resourceId':_0x3c5bbe['id']}})[_0xa739('0x14')](function(){return _0xdd053a;});})[_0xa739('0x14')](function(){_0x90277f[_0xa739('0xb')](0xcc)[_0xa739('0xc')]();});}};}function handleEntityNotFound(_0x46f994){return function(_0x5117c7){if(!_0x5117c7){_0x46f994[_0xa739('0xa')](0x194);}return _0x5117c7;};}function handleError(_0x43f65c,_0x1b3a0b){_0x1b3a0b=_0x1b3a0b||0x1f4;return function(_0x10960a){logger['error'](_0x10960a[_0xa739('0x24')]);if(_0x10960a[_0xa739('0x22')]){delete _0x10960a[_0xa739('0x22')];}_0x43f65c[_0xa739('0xb')](_0x1b3a0b)[_0xa739('0x25')](_0x10960a);};}exports['index']=function(_0x56dbf1,_0x1f7e26){var _0x27750e={},_0x257771={},_0x5e5346={'count':0x0,'rows':[]};var _0x37c014=_[_0xa739('0x1e')](db[_0xa739('0x26')]['rawAttributes'],function(_0x3e6708){return{'name':_0x3e6708[_0xa739('0x27')],'type':_0x3e6708[_0xa739('0x21')]['key']};});_0x257771['model']=_[_0xa739('0x1e')](_0x37c014,_0xa739('0x22'));_0x257771[_0xa739('0x28')]=_[_0xa739('0x29')](_0x56dbf1['query']);_0x257771[_0xa739('0x2a')]=_['intersection'](_0x257771[_0xa739('0x2b')],_0x257771[_0xa739('0x28')]);_0x27750e[_0xa739('0x2c')]=_[_0xa739('0x2d')](_0x257771[_0xa739('0x2b')],qs[_0xa739('0x2e')](_0x56dbf1['query'][_0xa739('0x2e')]));_0x27750e['attributes']=_0x27750e['attributes'][_0xa739('0x2f')]?_0x27750e[_0xa739('0x2c')]:_0x257771[_0xa739('0x2b')];if(!_0x56dbf1[_0xa739('0x28')][_0xa739('0x30')](_0xa739('0x31'))){_0x27750e['limit']=qs[_0xa739('0x10')](_0x56dbf1[_0xa739('0x28')][_0xa739('0x10')]);_0x27750e['offset']=qs[_0xa739('0xe')](_0x56dbf1[_0xa739('0x28')][_0xa739('0xe')]);}_0x27750e[_0xa739('0x32')]=qs[_0xa739('0x33')](_0x56dbf1[_0xa739('0x28')][_0xa739('0x33')]);_0x27750e[_0xa739('0x34')]=qs[_0xa739('0x2a')](_[_0xa739('0x35')](_0x56dbf1[_0xa739('0x28')],_0x257771[_0xa739('0x2a')]),_0x37c014);if(_0x56dbf1['query']['filter']){_0x27750e[_0xa739('0x34')]=_['merge'](_0x27750e[_0xa739('0x34')],{'$or':_[_0xa739('0x1e')](_0x37c014,function(_0x1280d4){if(_0x1280d4[_0xa739('0x21')]!==_0xa739('0x36')){var _0x4d3938={};_0x4d3938[_0x1280d4['name']]={'$like':'%'+_0x56dbf1['query'][_0xa739('0x1c')]+'%'};return _0x4d3938;}})});}_0x27750e=_[_0xa739('0x37')]({},_0x27750e,_0x56dbf1[_0xa739('0x38')]);var _0x248911={'where':_0x27750e[_0xa739('0x34')]};return db[_0xa739('0x26')]['count'](_0x248911)[_0xa739('0x14')](function(_0x4d9afc){_0x5e5346[_0xa739('0x11')]=_0x4d9afc;if(_0x56dbf1[_0xa739('0x28')]['includeAll']){_0x27750e['include']=[{'all':!![]}];}return db[_0xa739('0x26')][_0xa739('0x39')](_0x27750e);})[_0xa739('0x14')](function(_0x244a98){_0x5e5346['rows']=_0x244a98;return _0x5e5346;})[_0xa739('0x14')](respondWithFilteredResult(_0x1f7e26,_0x27750e))[_0xa739('0x3a')](handleError(_0x1f7e26,null));};exports[_0xa739('0x3b')]=function(_0x54b836,_0x519f5f){var _0x50de78={'raw':![],'where':{'id':_0x54b836[_0xa739('0x3c')]['id']}},_0x4bed31={};_0x4bed31['model']=_['keys'](db[_0xa739('0x26')][_0xa739('0x3d')]);_0x4bed31[_0xa739('0x28')]=_[_0xa739('0x29')](_0x54b836[_0xa739('0x28')]);_0x4bed31[_0xa739('0x2a')]=_[_0xa739('0x2d')](_0x4bed31['model'],_0x4bed31[_0xa739('0x28')]);_0x50de78['attributes']=_[_0xa739('0x2d')](_0x4bed31['model'],qs[_0xa739('0x2e')](_0x54b836[_0xa739('0x28')][_0xa739('0x2e')]));_0x50de78[_0xa739('0x2c')]=_0x50de78[_0xa739('0x2c')][_0xa739('0x2f')]?_0x50de78[_0xa739('0x2c')]:_0x4bed31[_0xa739('0x2b')];if(_0x54b836[_0xa739('0x28')][_0xa739('0x3e')]){_0x50de78[_0xa739('0x3f')]=[{'all':!![]}];}_0x50de78=_[_0xa739('0x37')]({},_0x50de78,_0x54b836[_0xa739('0x38')]);return db['VoiceExtension']['find'](_0x50de78)[_0xa739('0x14')](handleEntityNotFound(_0x519f5f,null))['then'](respondWithResult(_0x519f5f,null))[_0xa739('0x3a')](handleError(_0x519f5f,null));};exports['destroy']=function(_0x2496ab,_0x49e4c0){return db['VoiceExtension']['find']({'where':{'id':_0x2496ab['params']['id']}})[_0xa739('0x14')](handleEntityNotFound(_0x49e4c0,null))[_0xa739('0x14')](removeEntity(_0x49e4c0,null))[_0xa739('0x3a')](handleError(_0x49e4c0,null));};exports[_0xa739('0x40')]=function(_0x4dc8cd,_0x6ee5b0){if(_0x4dc8cd[_0xa739('0x41')][_0xa739('0x21')]===_0xa739('0x19')&&!_[_0xa739('0x42')](_0x4dc8cd[_0xa739('0x41')][_0xa739('0x43')],'_')){_0x4dc8cd[_0xa739('0x41')]['exten']='_'['concat'](_0x4dc8cd['body']['exten']);}return db[_0xa739('0x26')][_0xa739('0x40')](_0x4dc8cd[_0xa739('0x41')],{'raw':![]})['then'](function(_0x2a253a){var _0x14da47=_0x4dc8cd['user']['get']({'plain':!![]});if(!_0x14da47)throw new Error(_0xa739('0x44'));if(_0x14da47[_0xa739('0x45')]===_0xa739('0x46')){var _0x205f87=_0x2a253a[_0xa739('0x15')]({'plain':!![]});var _0x5b5a99=[{'name':_0xa739('0x16'),'value':_0xa739('0x17')},{'name':_0xa739('0x18'),'value':'outbound'},{'name':_0xa739('0x1a'),'value':'internal'}];var _0x36348d=_[_0xa739('0x20')](_0x5b5a99,[_0xa739('0x1f'),_0x205f87['type']])['name'];return db[_0xa739('0x47')][_0xa739('0x20')]({'where':{'name':_0x36348d,'userProfileId':_0x14da47[_0xa739('0x48')]},'raw':!![]})['then'](function(_0x28f265){if(_0x28f265&&_0x28f265[_0xa739('0x49')]===0x0){return db[_0xa739('0x23')][_0xa739('0x40')]({'name':_0x205f87[_0xa739('0x22')],'resourceId':_0x205f87['id'],'type':_0x28f265[_0xa739('0x22')],'sectionId':_0x28f265['id']},{})[_0xa739('0x14')](function(){return _0x2a253a;});}else{return _0x2a253a;}})['catch'](function(_0x4cc082){logger[_0xa739('0x4a')](_0xa739('0x4b'),_0x4cc082);throw _0x4cc082;});}return _0x2a253a;})['then'](respondWithResult(_0x6ee5b0,0xc9))[_0xa739('0x3a')](handleError(_0x6ee5b0,null));};exports[_0xa739('0x4c')]=function(_0x4e5a1e,_0x45af1b){if(_0x4e5a1e[_0xa739('0x41')]['id']){delete _0x4e5a1e['body']['id'];}return db[_0xa739('0x26')][_0xa739('0x20')]({'where':{'id':_0x4e5a1e[_0xa739('0x3c')]['id']}})['then'](handleEntityNotFound(_0x45af1b,null))[_0xa739('0x14')](function(_0x59b8e4){if(_0x59b8e4){return db[_0xa739('0x26')]['update'](_[_0xa739('0x35')](_0x4e5a1e['body'],[_0xa739('0x43'),_0xa739('0x4d'),_0xa739('0x4e'),_0xa739('0x4f'),_0xa739('0x50'),_0xa739('0x51'),_0xa739('0x52')]),{'where':{'context':_0x59b8e4['context'],'exten':_0x59b8e4[_0xa739('0x43')]},'individualHooks':!![]})[_0xa739('0x14')](function(_0x440766){return _0x440766;});}return null;})[_0xa739('0x14')](respondWithStatusCode(_0x45af1b,null))[_0xa739('0x3a')](handleError(_0x45af1b,null));};exports[_0xa739('0x53')]=function(_0x1ef5ab,_0x24406c){var _0x38a2c3=_0x1ef5ab[_0xa739('0x3c')]['id'];var _0x2a7db7=_0x1ef5ab[_0xa739('0x41')];var _0x395583=0xc8;var _0x2d1e00=null;return db[_0xa739('0x54')][_0xa739('0x55')]({'isolationLevel':db[_0xa739('0x54')][_0xa739('0x56')][_0xa739('0x57')][_0xa739('0x58')]},function(_0x28b8d5){return db['VoiceExtension']['findOne']({'where':{'id':_0x38a2c3},'transaction':_0x28b8d5})[_0xa739('0x14')](function(_0x4f3a5d){if(_0x4f3a5d){return db[_0xa739('0x26')][_0xa739('0x13')]({'where':{'VoiceExtensionId':_0x38a2c3},'transaction':_0x28b8d5})[_0xa739('0x14')](function(){var _0x45f16d=_[_0xa739('0x1e')](_0x2a7db7,function(_0x5af110){_0x5af110[_0xa739('0x59')]=_0x38a2c3;_0x5af110[_0xa739('0x5a')]=!![];return _0x5af110;});return _0x4f3a5d[_0xa739('0x5b')](_0x45f16d);})[_0xa739('0x14')](function(_0x216535){return db[_0xa739('0x26')]['bulkCreate'](_0x216535,{'transaction':_0x28b8d5});});}else{_0x395583=0x194;_0x2d1e00=[];}});})[_0xa739('0x14')](function(){if(_0x395583!==0x194){return db['VoiceExtension'][_0xa739('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x38a2c3},'order':_0xa739('0x5d')})[_0xa739('0x14')](function(_0x49b2cb){_0x2d1e00=_0x49b2cb;});}})[_0xa739('0x3a')](function(_0x4f1da){_0x395583=0x1f4;logger['error'](_0x4f1da[_0xa739('0x24')]);if(_0x4f1da[_0xa739('0x22')]){delete _0x4f1da[_0xa739('0x22')];}_0x2d1e00=_0x4f1da;})[_0xa739('0x5e')](function(){if(_0x2d1e00===null){_0x24406c['sendStatus'](_0x395583);}else{if(_0x395583===0x1f4){_0x24406c[_0xa739('0xb')](_0x395583)[_0xa739('0x25')](_0x2d1e00);}else{_0x24406c['status'](_0x395583)[_0xa739('0xd')](_0x2d1e00);}}});}; \ No newline at end of file +var _0xa81f=['nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','outbound','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','then','sendStatus','stack','send','VoiceExtension','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x5443c9,_0x5a57d2){var _0x29ba76=function(_0x246284){while(--_0x246284){_0x5443c9['push'](_0x5443c9['shift']());}};_0x29ba76(++_0x5a57d2);}(_0xa81f,0x1b5));var _0xfa81=function(_0x1ca7ed,_0x2cccb4){_0x1ca7ed=_0x1ca7ed-0x0;var _0x5d706a=_0xa81f[_0x1ca7ed];return _0x5d706a;};'use strict';var _=require(_0xfa81('0x0'));var Redis=require(_0xfa81('0x1'));var qs=require(_0xfa81('0x2'));var logger=require(_0xfa81('0x3'))(_0xfa81('0x4'));var config=require(_0xfa81('0x5'));var db=require('../../mysqldb')['db'];config[_0xfa81('0x6')]=_[_0xfa81('0x7')](config['redis'],{'host':_0xfa81('0x8'),'port':0x18eb});var socket=require(_0xfa81('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x13747a,_0x4b6d9b){_0x4b6d9b=_0x4b6d9b||0xcc;return function(_0x307295){if(_0x307295){return _0x13747a['sendStatus'](_0x4b6d9b);}return _0x13747a[_0xfa81('0xa')](_0x4b6d9b)[_0xfa81('0xb')]();};}function respondWithResult(_0x3765ac,_0x2bfca8){_0x2bfca8=_0x2bfca8||0xc8;return function(_0x9259c0){if(_0x9259c0){return _0x3765ac[_0xfa81('0xa')](_0x2bfca8)[_0xfa81('0xc')](_0x9259c0);}};}function respondWithFilteredResult(_0x3689b0,_0x44e897){return function(_0x4ae07d){if(_0x4ae07d){var _0x284015=typeof _0x44e897[_0xfa81('0xd')]===_0xfa81('0xe')&&typeof _0x44e897[_0xfa81('0xf')]===_0xfa81('0xe');var _0x1f7c76=_0x4ae07d[_0xfa81('0x10')];var _0x1d060f=_0x284015?0x0:_0x44e897[_0xfa81('0xd')];var _0x45a27c=_0x284015?_0x4ae07d[_0xfa81('0x10')]:_0x44e897['offset']+_0x44e897[_0xfa81('0xf')];var _0x52b71b;if(_0x45a27c>=_0x1f7c76){_0x45a27c=_0x1f7c76;_0x52b71b=0xc8;}else{_0x52b71b=0xce;}_0x3689b0['status'](_0x52b71b);return _0x3689b0[_0xfa81('0x11')](_0xfa81('0x12'),_0x1d060f+'-'+_0x45a27c+'/'+_0x1f7c76)['json'](_0x4ae07d);}return null;};}function removeEntity(_0x60ccd4){return function(_0x57437a){if(_0x57437a){return _0x57437a[_0xfa81('0x13')]()['then'](function(){var _0x48621c=_0x57437a[_0xfa81('0x14')]({'plain':!![]});var _0x376355=[{'name':_0xfa81('0x15'),'value':_0xfa81('0x16'),'ignore':![]},{'name':_0xfa81('0x17'),'value':'outbound','ignore':![]},{'name':_0xfa81('0x18'),'value':_0xfa81('0x19'),'ignore':![]}];var _0x265ff3=_(_0x376355)[_0xfa81('0x1a')](_0xfa81('0x1b'))[_0xfa81('0x1c')](_0xfa81('0x1d'))[_0xfa81('0x1d')]();if(_[_0xfa81('0x1e')](_0x265ff3,_0x48621c[_0xfa81('0x1f')])){return;}var _0x1fe544=_['find'](_0x376355,['value',_0x48621c[_0xfa81('0x1f')]])[_0xfa81('0x20')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1fe544,'resourceId':_0x48621c['id']}})[_0xfa81('0x21')](function(){return _0x57437a;});})[_0xfa81('0x21')](function(){_0x60ccd4['status'](0xcc)[_0xfa81('0xb')]();});}};}function handleEntityNotFound(_0xf04039){return function(_0x51cac4){if(!_0x51cac4){_0xf04039[_0xfa81('0x22')](0x194);}return _0x51cac4;};}function handleError(_0x16db05,_0x236c07){_0x236c07=_0x236c07||0x1f4;return function(_0x4972a7){logger['error'](_0x4972a7[_0xfa81('0x23')]);if(_0x4972a7['name']){delete _0x4972a7[_0xfa81('0x20')];}_0x16db05[_0xfa81('0xa')](_0x236c07)[_0xfa81('0x24')](_0x4972a7);};}exports['index']=function(_0x26e0c5,_0x447bd9){var _0x3c2db7={},_0x39d07d={},_0x3acbec={'count':0x0,'rows':[]};var _0x552bc7=_['map'](db[_0xfa81('0x25')][_0xfa81('0x26')],function(_0xbae08b){return{'name':_0xbae08b[_0xfa81('0x27')],'type':_0xbae08b[_0xfa81('0x1f')]['key']};});_0x39d07d[_0xfa81('0x28')]=_['map'](_0x552bc7,_0xfa81('0x20'));_0x39d07d[_0xfa81('0x29')]=_[_0xfa81('0x2a')](_0x26e0c5['query']);_0x39d07d['filters']=_[_0xfa81('0x2b')](_0x39d07d[_0xfa81('0x28')],_0x39d07d[_0xfa81('0x29')]);_0x3c2db7[_0xfa81('0x2c')]=_[_0xfa81('0x2b')](_0x39d07d['model'],qs[_0xfa81('0x2d')](_0x26e0c5[_0xfa81('0x29')]['fields']));_0x3c2db7[_0xfa81('0x2c')]=_0x3c2db7[_0xfa81('0x2c')][_0xfa81('0x2e')]?_0x3c2db7['attributes']:_0x39d07d['model'];if(!_0x26e0c5[_0xfa81('0x29')][_0xfa81('0x2f')](_0xfa81('0x30'))){_0x3c2db7[_0xfa81('0xf')]=qs['limit'](_0x26e0c5[_0xfa81('0x29')][_0xfa81('0xf')]);_0x3c2db7[_0xfa81('0xd')]=qs[_0xfa81('0xd')](_0x26e0c5[_0xfa81('0x29')]['offset']);}_0x3c2db7[_0xfa81('0x31')]=qs[_0xfa81('0x32')](_0x26e0c5['query'][_0xfa81('0x32')]);_0x3c2db7[_0xfa81('0x33')]=qs[_0xfa81('0x34')](_[_0xfa81('0x35')](_0x26e0c5[_0xfa81('0x29')],_0x39d07d[_0xfa81('0x34')]),_0x552bc7);if(_0x26e0c5[_0xfa81('0x29')][_0xfa81('0x1a')]){_0x3c2db7[_0xfa81('0x33')]=_[_0xfa81('0x36')](_0x3c2db7['where'],{'$or':_['map'](_0x552bc7,function(_0x1c5d42){if(_0x1c5d42[_0xfa81('0x1f')]!==_0xfa81('0x37')){var _0x452b0b={};_0x452b0b[_0x1c5d42[_0xfa81('0x20')]]={'$like':'%'+_0x26e0c5[_0xfa81('0x29')][_0xfa81('0x1a')]+'%'};return _0x452b0b;}})});}_0x3c2db7=_[_0xfa81('0x36')]({},_0x3c2db7,_0x26e0c5[_0xfa81('0x38')]);var _0x43d712={'where':_0x3c2db7['where']};return db[_0xfa81('0x25')][_0xfa81('0x10')](_0x43d712)[_0xfa81('0x21')](function(_0x4255b2){_0x3acbec[_0xfa81('0x10')]=_0x4255b2;if(_0x26e0c5['query'][_0xfa81('0x39')]){_0x3c2db7[_0xfa81('0x3a')]=[{'all':!![]}];}return db[_0xfa81('0x25')][_0xfa81('0x3b')](_0x3c2db7);})[_0xfa81('0x21')](function(_0xafcb31){_0x3acbec[_0xfa81('0x3c')]=_0xafcb31;return _0x3acbec;})[_0xfa81('0x21')](respondWithFilteredResult(_0x447bd9,_0x3c2db7))[_0xfa81('0x3d')](handleError(_0x447bd9,null));};exports['show']=function(_0x2a6b8c,_0x4ba124){var _0x514e50={'raw':![],'where':{'id':_0x2a6b8c[_0xfa81('0x3e')]['id']}},_0x41be91={};_0x41be91[_0xfa81('0x28')]=_[_0xfa81('0x2a')](db[_0xfa81('0x25')][_0xfa81('0x26')]);_0x41be91['query']=_[_0xfa81('0x2a')](_0x2a6b8c[_0xfa81('0x29')]);_0x41be91[_0xfa81('0x34')]=_['intersection'](_0x41be91[_0xfa81('0x28')],_0x41be91[_0xfa81('0x29')]);_0x514e50['attributes']=_[_0xfa81('0x2b')](_0x41be91[_0xfa81('0x28')],qs['fields'](_0x2a6b8c[_0xfa81('0x29')][_0xfa81('0x2d')]));_0x514e50[_0xfa81('0x2c')]=_0x514e50['attributes']['length']?_0x514e50[_0xfa81('0x2c')]:_0x41be91[_0xfa81('0x28')];if(_0x2a6b8c[_0xfa81('0x29')][_0xfa81('0x39')]){_0x514e50[_0xfa81('0x3a')]=[{'all':!![]}];}_0x514e50=_[_0xfa81('0x36')]({},_0x514e50,_0x2a6b8c[_0xfa81('0x38')]);return db[_0xfa81('0x25')]['find'](_0x514e50)[_0xfa81('0x21')](handleEntityNotFound(_0x4ba124,null))['then'](respondWithResult(_0x4ba124,null))[_0xfa81('0x3d')](handleError(_0x4ba124,null));};exports['destroy']=function(_0x4afd1e,_0x4f0538){return db['VoiceExtension'][_0xfa81('0x3f')]({'where':{'id':_0x4afd1e[_0xfa81('0x3e')]['id']}})[_0xfa81('0x21')](handleEntityNotFound(_0x4f0538,null))[_0xfa81('0x21')](removeEntity(_0x4f0538,null))[_0xfa81('0x3d')](handleError(_0x4f0538,null));};exports[_0xfa81('0x40')]=function(_0x322412,_0x3e327a){if(_0x322412['body']['type']===_0xfa81('0x41')&&!_[_0xfa81('0x42')](_0x322412[_0xfa81('0x43')]['exten'],'_')){_0x322412['body'][_0xfa81('0x44')]='_'[_0xfa81('0x45')](_0x322412[_0xfa81('0x43')][_0xfa81('0x44')]);}return db['VoiceExtension'][_0xfa81('0x40')](_0x322412[_0xfa81('0x43')],{'raw':![]})[_0xfa81('0x21')](function(_0x226a25){var _0x369c2b=_0x322412[_0xfa81('0x46')][_0xfa81('0x14')]({'plain':!![]});if(!_0x369c2b)throw new Error(_0xfa81('0x47'));if(_0x369c2b[_0xfa81('0x48')]===_0xfa81('0x46')){var _0x4381be=_0x226a25['get']({'plain':!![]});var _0x467ed0=[{'name':_0xfa81('0x15'),'value':_0xfa81('0x16')},{'name':'OutboundRoutes','value':_0xfa81('0x41')},{'name':_0xfa81('0x18'),'value':'internal'}];var _0x385abd=_[_0xfa81('0x3f')](_0x467ed0,[_0xfa81('0x1d'),_0x4381be[_0xfa81('0x1f')]])[_0xfa81('0x20')];return db[_0xfa81('0x49')][_0xfa81('0x3f')]({'where':{'name':_0x385abd,'userProfileId':_0x369c2b[_0xfa81('0x4a')]},'raw':!![]})[_0xfa81('0x21')](function(_0x17d266){if(_0x17d266&&_0x17d266[_0xfa81('0x4b')]===0x0){return db[_0xfa81('0x4c')][_0xfa81('0x40')]({'name':_0x4381be[_0xfa81('0x20')],'resourceId':_0x4381be['id'],'type':_0x17d266[_0xfa81('0x20')],'sectionId':_0x17d266['id']},{})['then'](function(){return _0x226a25;});}else{return _0x226a25;}})[_0xfa81('0x3d')](function(_0x522ae8){logger[_0xfa81('0x4d')](_0xfa81('0x4e'),_0x522ae8);throw _0x522ae8;});}return _0x226a25;})[_0xfa81('0x21')](respondWithResult(_0x3e327a,0xc9))[_0xfa81('0x3d')](handleError(_0x3e327a,null));};exports['update']=function(_0x28d22f,_0xf849d7){if(_0x28d22f['body']['id']){delete _0x28d22f[_0xfa81('0x43')]['id'];}return db[_0xfa81('0x25')]['find']({'where':{'id':_0x28d22f[_0xfa81('0x3e')]['id']}})['then'](handleEntityNotFound(_0xf849d7,null))[_0xfa81('0x21')](function(_0x16eba5){if(_0x16eba5){return db[_0xfa81('0x25')][_0xfa81('0x4f')](_[_0xfa81('0x35')](_0x28d22f[_0xfa81('0x43')],[_0xfa81('0x44'),'context',_0xfa81('0x50'),_0xfa81('0x51'),_0xfa81('0x52'),_0xfa81('0x53'),'alias']),{'where':{'context':_0x16eba5[_0xfa81('0x54')],'exten':_0x16eba5[_0xfa81('0x44')]},'individualHooks':!![]})[_0xfa81('0x21')](function(_0x23817a){return _0x23817a;});}return null;})[_0xfa81('0x21')](respondWithStatusCode(_0xf849d7,null))[_0xfa81('0x3d')](handleError(_0xf849d7,null));};exports[_0xfa81('0x55')]=function(_0x118ed9,_0xc74ca2){var _0x3c9dd0=_0x118ed9[_0xfa81('0x3e')]['id'];var _0x24c562=_0x118ed9[_0xfa81('0x43')];var _0x2ccede=0xc8;var _0x49d93a=null;return db[_0xfa81('0x56')][_0xfa81('0x57')]({'isolationLevel':db['sequelize'][_0xfa81('0x58')][_0xfa81('0x59')][_0xfa81('0x5a')]},function(_0x305628){return db[_0xfa81('0x25')][_0xfa81('0x5b')]({'where':{'id':_0x3c9dd0},'transaction':_0x305628})['then'](function(_0xf34ef0){if(_0xf34ef0){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x3c9dd0},'transaction':_0x305628})[_0xfa81('0x21')](function(){var _0x45b289=_[_0xfa81('0x1c')](_0x24c562,function(_0x1f252f){_0x1f252f['VoiceExtensionId']=_0x3c9dd0;_0x1f252f[_0xfa81('0x5c')]=!![];return _0x1f252f;});return _0xf34ef0['createRouting'](_0x45b289);})[_0xfa81('0x21')](function(_0x247bad){return db[_0xfa81('0x25')][_0xfa81('0x5d')](_0x247bad,{'transaction':_0x305628});});}else{_0x2ccede=0x194;_0x49d93a=[];}});})[_0xfa81('0x21')](function(){if(_0x2ccede!==0x194){return db[_0xfa81('0x25')][_0xfa81('0x5e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3c9dd0},'order':_0xfa81('0x5f')})['then'](function(_0x312792){_0x49d93a=_0x312792;});}})[_0xfa81('0x3d')](function(_0x18f509){_0x2ccede=0x1f4;logger[_0xfa81('0x4d')](_0x18f509['stack']);if(_0x18f509[_0xfa81('0x20')]){delete _0x18f509[_0xfa81('0x20')];}_0x49d93a=_0x18f509;})[_0xfa81('0x60')](function(){if(_0x49d93a===null){_0xc74ca2[_0xfa81('0x22')](_0x2ccede);}else{if(_0x2ccede===0x1f4){_0xc74ca2[_0xfa81('0xa')](_0x2ccede)[_0xfa81('0x24')](_0x49d93a);}else{_0xc74ca2[_0xfa81('0xa')](_0x2ccede)[_0xfa81('0xc')](_0x49d93a);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e4cd2c8..59f8531 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 _0x88a8=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hook','exports'];(function(_0x52512f,_0x23c006){var _0x18ce1c=function(_0xb5fd6f){while(--_0xb5fd6f){_0x52512f['push'](_0x52512f['shift']());}};_0x18ce1c(++_0x23c006);}(_0x88a8,0x1b8));var _0x888a=function(_0x1e421d,_0x27b576){_0x1e421d=_0x1e421d-0x0;var _0x1538c4=_0x88a8[_0x1e421d];return _0x1538c4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x888a('0x0'))['db'][_0x888a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x888a('0x2')](0x0);var events={'afterCreate':_0x888a('0x3'),'afterUpdate':_0x888a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f72dd){return function(_0x33bbc8,_0x4634cb,_0x41ad47){VoiceExtensionEvents[_0x888a('0x5')](_0x3f72dd+':'+_0x33bbc8['id'],_0x33bbc8);VoiceExtensionEvents[_0x888a('0x5')](_0x3f72dd,_0x33bbc8);_0x41ad47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x888a('0x6')](e,emitEvent(event));}}module[_0x888a('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x06ec=['save','update','remove','emit','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x06ec,0x72));var _0xc06e=function(_0x18a85c,_0x10b478){_0x18a85c=_0x18a85c-0x0;var _0x51cbb9=_0x06ec[_0x18a85c];return _0x51cbb9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc06e('0x0'))['db'][_0xc06e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc06e('0x2')](0x0);var events={'afterCreate':_0xc06e('0x3'),'afterUpdate':_0xc06e('0x4'),'afterDestroy':_0xc06e('0x5')};function emitEvent(_0x590453){return function(_0x4b973b,_0x14cdae,_0x32e909){VoiceExtensionEvents[_0xc06e('0x6')](_0x590453+':'+_0x4b973b['id'],_0x4b973b);VoiceExtensionEvents[_0xc06e('0x6')](_0x590453,_0x4b973b);_0x32e909(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc06e('0x7')](e,emitEvent(event));}}module[_0xc06e('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 a23a24d..d89c80b 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 _0x5489=['callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','length','name','split','phone','param','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','then','interval','intervals','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x38ca0e,_0x212524){var _0x587b5e=function(_0x3fd84d){while(--_0x3fd84d){_0x38ca0e['push'](_0x38ca0e['shift']());}};_0x587b5e(++_0x212524);}(_0x5489,0x10a));var _0x9548=function(_0x3a99da,_0x19ecb5){_0x3a99da=_0x3a99da-0x0;var _0x100c13=_0x5489[_0x3a99da];return _0x100c13;};'use strict';var _=require(_0x9548('0x0'));var attributes=require(_0x9548('0x1'));module[_0x9548('0x2')]=function(_0x46c56c){var _0x164d0d=_0x46c56c[_0x9548('0x3')];function _0x155746(_0x59072c){var _0xb06c04=0x2;var _0x1969dc=[{'type':_0x59072c[_0x9548('0x4')],'app':_0x9548('0x5'),'appdata':_0x9548('0x6')+_0x59072c[_0x9548('0x4')],'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c['exten'],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c['type'],'app':_0x59072c[_0x9548('0x8')]?'Set':'NoOp','appdata':_0x59072c['alias']?_0x9548('0x9')+_0x59072c[_0x9548('0x8')]:_0x9548('0xa'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']}];if(_0x59072c[_0x9548('0x4')]===_0x9548('0xc')){_0x1969dc['push']({'type':_0x9548('0xc'),'app':_0x9548('0x5'),'appdata':'CDR(routeid)='+_0x59072c['id'],'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']});}_0x1969dc[_0x9548('0xd')]({'type':_0x59072c['type'],'app':_0x9548('0x5'),'appdata':_0x9548('0xe'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c[_0x9548('0x4')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c['exten'],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']},{'type':_0x59072c[_0x9548('0x4')],'app':_0x9548('0x5'),'appdata':_0x9548('0xf'),'context':_0x59072c[_0x9548('0x7')],'exten':_0x59072c[_0x9548('0xb')],'priority':_0xb06c04++,'VoiceExtensionId':_0x59072c['id']});return _0x1969dc;}function _0x4148ef(_0x2a4c6c){var _0x1cf037=0x2;var _0x2d8d27=[{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x11'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':'outbound','app':_0x2a4c6c[_0x9548('0x8')]?_0x9548('0x5'):_0x9548('0x12'),'appdata':_0x2a4c6c[_0x9548('0x8')]?'CDR(routeAlias)='+_0x2a4c6c['alias']:_0x9548('0xa'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'CDR(destination)='+(_0x2a4c6c[_0x9548('0x13')]?_0x9548('0x14')+_0x2a4c6c['cutdigits']+'}':_0x9548('0x15')),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':'outbound','app':_0x9548('0x5'),'appdata':_0x9548('0x16')+_0x2a4c6c['id'],'context':_0x2a4c6c['context'],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x17'),'appdata':_0x9548('0x18')+(_0x1cf037+0x2)+_0x9548('0x19')+(_0x1cf037+0x1)+')','context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x2a4c6c[_0x9548('0x13')]?_0x9548('0x1a')+_0x2a4c6c[_0x9548('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x2a4c6c['context'],'exten':_0x2a4c6c['exten'],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c['exten'],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2a4c6c['context'],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0xf'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x1b')+_0x2a4c6c['id'],'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']}];if(_0x2a4c6c[_0x9548('0x1c')](_0x9548('0x1d'))&&_0x2a4c6c[_0x9548('0x1d')]!==_0x9548('0x1e')){_0x2d8d27[_0x9548('0xd')]({'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x1f'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']},{'type':_0x9548('0x10'),'app':_0x9548('0x5'),'appdata':_0x9548('0x20')+_0x2a4c6c[_0x9548('0x1d')]||_0x9548('0x21'),'context':_0x2a4c6c[_0x9548('0x7')],'exten':_0x2a4c6c[_0x9548('0xb')],'priority':_0x1cf037++,'VoiceExtensionId':_0x2a4c6c['id']});}return _0x2d8d27;}function _0x5d9ab6(_0x4e9e19,_0x5a6d00){var _0x49faf0=[{'name':_0x9548('0x22'),'param':0x0},{'name':_0x9548('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x355dab={};var _0x449fad=_0x5a6d00['split'](',');var _0x595eb2=[];for(var _0x2a7007=0x0;_0x2a7007<_0x49faf0[_0x9548('0x24')];_0x2a7007++){switch(_0x49faf0[_0x2a7007][_0x9548('0x25')]){case _0x9548('0x22'):_0x355dab[_0x9548('0x22')]=_0x449fad[_0x49faf0[_0x2a7007]['param']][_0x9548('0x26')]('/')[0x1];_0x355dab[_0x9548('0x27')]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]][_0x9548('0x26')]('/')[0x2];_0x355dab['prefix']=_0x355dab[_0x9548('0x27')]?_0x355dab['phone']['split']('$')[0x0]:undefined;_0x355dab['phone']=_0x4e9e19[_0x9548('0x13')]?(_0x355dab[_0x9548('0x29')]||'')+_0x9548('0x14')+_0x4e9e19['cutdigits']+'}':(_0x355dab['prefix']||'')+'${EXTEN}';_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=[_0x9548('0x2a'),_0x355dab[_0x9548('0x22')],_0x355dab[_0x9548('0x27')]][_0x9548('0x2b')]('/');break;case _0x9548('0x2c'):_0x355dab[_0x9548('0x2c')]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]];if(_0x4e9e19[_0x9548('0x1d')]!=='none'){if(_0x355dab[_0x9548('0x2c')][_0x9548('0x2d')](_0x9548('0x2e'))<0x0){_0x355dab[_0x9548('0x2c')]+='U(xcally-mixmonitor-context)';}}else{_0x355dab[_0x9548('0x2c')]=_0x355dab[_0x9548('0x2c')]['replace'](_0x9548('0x2e'),'');}_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=_0x355dab[_0x9548('0x2c')];break;default:_0x595eb2[_0x49faf0[_0x2a7007][_0x9548('0x28')]]=_0x449fad[_0x49faf0[_0x2a7007][_0x9548('0x28')]];}}return _0x595eb2[_0x9548('0x2b')](',');}function _0x30fcfc(_0x5800f1,_0x3f8930,_0x5c2a0b){return new Promise(function(_0x4c0ee2,_0x19c6e1){var _0x34c3d3=[];if(_[_0x9548('0x2f')](_0x3f8930))return _0x4c0ee2(_0x34c3d3);_0x164d0d[_0x9548('0x30')][_0x9548('0x31')]({'attributes':['id','interval',_0x9548('0x32')],'raw':!![]})[_0x9548('0x33')](function(_0xf99999){for(var _0x16bf0b=0x0,_0x5dbd5b=0x0;_0x16bf0b<_0x3f8930[_0x9548('0x24')];_0x16bf0b++,_0x5dbd5b=0x0){var _0x31e5ec=_0x3f8930[_0x16bf0b];var _0x573eca=[];var _0x350633=[];delete _0x31e5ec['id'];if(_0x31e5ec[_0x9548('0x34')]!=='*,*,*,*'){_0x31e5ec['intervals']=[_0x31e5ec[_0x9548('0x34')]];}else{_0x31e5ec[_0x9548('0x35')]=_0x31e5ec['IntervalId']?_['map'](_['filter'](_0xf99999,{'IntervalId':_0x31e5ec[_0x9548('0x32')]}),_0x9548('0x34')):[];}_0x31e5ec[_0x9548('0x7')]=_0x5800f1[_0x9548('0x7')];_0x31e5ec[_0x9548('0xb')]=_0x5800f1[_0x9548('0xb')];if(_0x31e5ec['type'])_0x31e5ec[_0x9548('0x4')]=_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')]();if(_0x5800f1[_0x9548('0x4')]===_0x9548('0x10')){if(_0x31e5ec['hasOwnProperty'](_0x9548('0x37'))&&_0x31e5ec[_0x9548('0x37')]&&_0x31e5ec[_0x9548('0x37')]!=='--'){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':_0x9548('0x38')+_0x31e5ec[_0x9548('0x37')],'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}_0x573eca['push']({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x17'),'appdata':_0x9548('0x39')+(_0x31e5ec[_0x9548('0x3a')]?_0x9548('0x3b')+_0x31e5ec[_0x9548('0x3a')]+')':_0x9548('0x3c')),'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1['exten'],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}else{if(_0x31e5ec[_0x9548('0x1c')](_0x9548('0x3d'))){if([_0x9548('0x3e'),'playback']['includes'](_0x31e5ec[_0x9548('0x3f')][_0x9548('0x36')]())&&_0x31e5ec['appType']!=='custom'){if(_0x31e5ec[_0x9548('0x3d')]){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':_0x9548('0x17'),'appdata':_0x9548('0x40'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec['intervals'][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}else{_0x573eca['push']({'type':_0x31e5ec[_0x9548('0x4')][_0x9548('0x36')](),'app':'ExecIf','appdata':_0x9548('0x41'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')]['length']+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':'Set','appdata':_0x9548('0x42'),'context':_0x5800f1['context'],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')]['length']+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}}}}for(var _0x55e8b3=0x0;_0x55e8b3<_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')];_0x55e8b3++){var _0x253906=_0x5c2a0b+_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')];var _0x3d72e6=_0x55e8b3===_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]-0x1?_0x5c2a0b+_0x573eca[_0x9548('0x24')]+_0x350633[_0x9548('0x24')]+0x2:_0x5c2a0b+_0x55e8b3+0x1;_0x573eca[_0x9548('0x43')](_0x55e8b3,0x0,{'type':_0x5800f1['type'],'app':'GotoIfTime','appdata':_0x31e5ec[_0x9548('0x35')][_0x55e8b3]+'?'+_0x5800f1['context']+_0x9548('0x44')+_0x253906+':'+_0x5800f1[_0x9548('0x7')]+_0x9548('0x44')+_0x3d72e6,'exten':_0x5800f1[_0x9548('0xb')],'context':_0x5800f1['context'],'priority':_0x5c2a0b+_0x55e8b3,'VoiceExtensionId':_0x5800f1['id']});}if(_0x31e5ec[_0x9548('0x45')]===_0x9548('0x46')){_0x31e5ec[_0x9548('0x47')]=_0x5d9ab6(_0x5800f1,_0x31e5ec[_0x9548('0x47')]);}if(_0x31e5ec[_0x9548('0x45')]===_0x9548('0x48')){_0x573eca[_0x9548('0xd')]({'type':_0x31e5ec['type'][_0x9548('0x36')](),'app':_0x9548('0x5'),'appdata':_0x9548('0x49'),'context':_0x5800f1[_0x9548('0x7')],'exten':_0x5800f1[_0x9548('0xb')],'priority':_0x31e5ec[_0x9548('0x35')][_0x9548('0x24')]+_0x5c2a0b+_0x5dbd5b++,'VoiceExtensionId':_0x5800f1['id']});}_0x31e5ec['priority']=_0x573eca[_0x9548('0x24')]?_['last'](_0x573eca)[_0x9548('0x4a')]+0x1:_0x5c2a0b;_0x34c3d3=_['concat'](_0x34c3d3,_0x573eca,[_0x31e5ec],_0x350633);_0x5c2a0b=_[_0x9548('0x4b')](_0x34c3d3)[_0x9548('0x4a')]+0x1;}return _0x4c0ee2(_0x34c3d3);})[_0x9548('0x4c')](function(_0x22e611){_0x19c6e1(_0x22e611);});});}return _0x46c56c[_0x9548('0x4d')](_0x9548('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4667ac){var _0x1e4b94=this[_0x9548('0x4f')]({'plain':!![]});var _0x2deeb7=_0x1e4b94[_0x9548('0x4')]===_0x9548('0x10')?_0x4148ef(_0x1e4b94):_0x155746(_0x1e4b94);return _0x30fcfc(_0x1e4b94,_0x4667ac,_[_0x9548('0x4b')](_0x2deeb7)[_0x9548('0x4a')]+0x1)['then'](function(_0x49f4d1){var _0x498a07=_['concat'](_0x2deeb7,_0x49f4d1);_0x498a07[_0x9548('0xd')]({'type':_0x1e4b94[_0x9548('0x4')],'app':_0x9548('0x50'),'exten':_0x1e4b94['exten'],'context':_0x1e4b94['context'],'priority':_[_0x9548('0x4b')](_0x498a07)[_0x9548('0x4a')]+0x1,'VoiceExtensionId':_0x1e4b94['id']});return _0x498a07;});}}});}; \ No newline at end of file +var _0xf265=['param','split','phone','prefix','${EXTEN:','${EXTEN}','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','priority','catch','define','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','NoOp','CDR(routeAlias)=','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name'];(function(_0x336c0f,_0x29c61e){var _0x596ba3=function(_0x321281){while(--_0x321281){_0x336c0f['push'](_0x336c0f['shift']());}};_0x596ba3(++_0x29c61e);}(_0xf265,0xda));var _0x5f26=function(_0x9a57d3,_0xc6453c){_0x9a57d3=_0x9a57d3-0x0;var _0x45ec2d=_0xf265[_0x9a57d3];return _0x45ec2d;};'use strict';var _=require('lodash');var attributes=require(_0x5f26('0x0'));module[_0x5f26('0x1')]=function(_0x31c342){var _0x584062=_0x31c342[_0x5f26('0x2')];function _0x2f773d(_0x3e1ab3){var _0x158385=0x2;var _0x70158b=[{'type':_0x3e1ab3[_0x5f26('0x3')],'app':_0x5f26('0x4'),'appdata':'CDR(type)='+_0x3e1ab3['type'],'context':_0x3e1ab3[_0x5f26('0x5')],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']},{'type':_0x3e1ab3[_0x5f26('0x3')],'app':_0x3e1ab3[_0x5f26('0x7')]?_0x5f26('0x4'):'NoOp','appdata':_0x3e1ab3['alias']?'CDR(routeAlias)='+_0x3e1ab3['alias']:'No\x20alias\x20set','context':_0x3e1ab3[_0x5f26('0x5')],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']}];if(_0x3e1ab3[_0x5f26('0x3')]===_0x5f26('0x8')){_0x70158b[_0x5f26('0x9')]({'type':_0x5f26('0x8'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0xa')+_0x3e1ab3['id'],'context':_0x3e1ab3[_0x5f26('0x5')],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']});}_0x70158b['push']({'type':_0x3e1ab3['type'],'app':_0x5f26('0x4'),'appdata':_0x5f26('0xb'),'context':_0x3e1ab3[_0x5f26('0x5')],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']},{'type':_0x3e1ab3[_0x5f26('0x3')],'app':_0x5f26('0x4'),'appdata':_0x5f26('0xc'),'context':_0x3e1ab3['context'],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']},{'type':_0x3e1ab3[_0x5f26('0x3')],'app':'Set','appdata':_0x5f26('0xd'),'context':_0x3e1ab3[_0x5f26('0x5')],'exten':_0x3e1ab3[_0x5f26('0x6')],'priority':_0x158385++,'VoiceExtensionId':_0x3e1ab3['id']});return _0x70158b;}function _0x210308(_0x2e887f){var _0x3f2a5c=0x2;var _0x556a20=[{'type':'outbound','app':_0x5f26('0x4'),'appdata':_0x5f26('0xe'),'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x2e887f[_0x5f26('0x7')]?_0x5f26('0x4'):_0x5f26('0x10'),'appdata':_0x2e887f[_0x5f26('0x7')]?_0x5f26('0x11')+_0x2e887f[_0x5f26('0x7')]:'No\x20alias\x20set','context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x12')+(_0x2e887f['cutdigits']?'${EXTEN:'+_0x2e887f[_0x5f26('0x13')]+'}':'${EXTEN}'),'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0xa')+_0x2e887f['id'],'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x14'),'appdata':_0x5f26('0x15')+(_0x3f2a5c+0x2)+_0x5f26('0x16')+(_0x3f2a5c+0x1)+')','context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':'Set','appdata':_0x2e887f[_0x5f26('0x13')]?_0x5f26('0x17')+_0x2e887f[_0x5f26('0x13')]+'}':_0x5f26('0x18'),'context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':'Set','appdata':_0x5f26('0xc'),'context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0xd'),'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':'outboundrouteid='+_0x2e887f['id'],'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']}];if(_0x2e887f[_0x5f26('0x19')](_0x5f26('0x1a'))&&_0x2e887f[_0x5f26('0x1a')]!==_0x5f26('0x1b')){_0x556a20[_0x5f26('0x9')]({'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x1c'),'context':_0x2e887f[_0x5f26('0x5')],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']},{'type':_0x5f26('0xf'),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x1d')+_0x2e887f[_0x5f26('0x1a')]||_0x5f26('0x1e'),'context':_0x2e887f['context'],'exten':_0x2e887f[_0x5f26('0x6')],'priority':_0x3f2a5c++,'VoiceExtensionId':_0x2e887f['id']});}return _0x556a20;}function _0x27188c(_0x527b01,_0x4bc950){var _0xbbb743=[{'name':_0x5f26('0x1f'),'param':0x0},{'name':_0x5f26('0x20'),'param':0x1},{'name':_0x5f26('0x21'),'param':0x2},{'name':_0x5f26('0x22'),'param':0x3}];var _0x1e4640={};var _0x474844=_0x4bc950['split'](',');var _0x5812dd=[];for(var _0x40808e=0x0;_0x40808e<_0xbbb743[_0x5f26('0x23')];_0x40808e++){switch(_0xbbb743[_0x40808e][_0x5f26('0x24')]){case _0x5f26('0x1f'):_0x1e4640['trunk']=_0x474844[_0xbbb743[_0x40808e][_0x5f26('0x25')]][_0x5f26('0x26')]('/')[0x1];_0x1e4640[_0x5f26('0x27')]=_0x474844[_0xbbb743[_0x40808e][_0x5f26('0x25')]]['split']('/')[0x2];_0x1e4640[_0x5f26('0x28')]=_0x1e4640[_0x5f26('0x27')]?_0x1e4640['phone'][_0x5f26('0x26')]('$')[0x0]:undefined;_0x1e4640['phone']=_0x527b01['cutdigits']?(_0x1e4640[_0x5f26('0x28')]||'')+_0x5f26('0x29')+_0x527b01['cutdigits']+'}':(_0x1e4640[_0x5f26('0x28')]||'')+_0x5f26('0x2a');_0x5812dd[_0xbbb743[_0x40808e][_0x5f26('0x25')]]=[_0x5f26('0x2b'),_0x1e4640[_0x5f26('0x1f')],_0x1e4640[_0x5f26('0x27')]][_0x5f26('0x2c')]('/');break;case _0x5f26('0x21'):_0x1e4640[_0x5f26('0x21')]=_0x474844[_0xbbb743[_0x40808e][_0x5f26('0x25')]];if(_0x527b01[_0x5f26('0x1a')]!==_0x5f26('0x1b')){if(_0x1e4640[_0x5f26('0x21')]['indexOf'](_0x5f26('0x2d'))<0x0){_0x1e4640[_0x5f26('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x1e4640[_0x5f26('0x21')]=_0x1e4640[_0x5f26('0x21')][_0x5f26('0x2e')]('U(xcally-mixmonitor-context)','');}_0x5812dd[_0xbbb743[_0x40808e][_0x5f26('0x25')]]=_0x1e4640['options'];break;default:_0x5812dd[_0xbbb743[_0x40808e]['param']]=_0x474844[_0xbbb743[_0x40808e][_0x5f26('0x25')]];}}return _0x5812dd[_0x5f26('0x2c')](',');}function _0xa88083(_0x29206b,_0x3b61a9,_0x192a7c){return new Promise(function(_0x30d3a9,_0x4a877b){var _0x432c22=[];if(_[_0x5f26('0x2f')](_0x3b61a9))return _0x30d3a9(_0x432c22);_0x584062[_0x5f26('0x30')][_0x5f26('0x31')]({'attributes':['id',_0x5f26('0x32'),'IntervalId'],'raw':!![]})[_0x5f26('0x33')](function(_0x5c28d3){for(var _0x5ab3ae=0x0,_0x4ab439=0x0;_0x5ab3ae<_0x3b61a9[_0x5f26('0x23')];_0x5ab3ae++,_0x4ab439=0x0){var _0x429f0c=_0x3b61a9[_0x5ab3ae];var _0x4a80e6=[];var _0x200dc0=[];delete _0x429f0c['id'];if(_0x429f0c['interval']!==_0x5f26('0x34')){_0x429f0c[_0x5f26('0x35')]=[_0x429f0c[_0x5f26('0x32')]];}else{_0x429f0c[_0x5f26('0x35')]=_0x429f0c[_0x5f26('0x36')]?_[_0x5f26('0x37')](_['filter'](_0x5c28d3,{'IntervalId':_0x429f0c[_0x5f26('0x36')]}),'interval'):[];}_0x429f0c[_0x5f26('0x5')]=_0x29206b[_0x5f26('0x5')];_0x429f0c['exten']=_0x29206b[_0x5f26('0x6')];if(_0x429f0c[_0x5f26('0x3')])_0x429f0c[_0x5f26('0x3')]=_0x429f0c[_0x5f26('0x3')][_0x5f26('0x38')]();if(_0x29206b['type']===_0x5f26('0xf')){if(_0x429f0c['hasOwnProperty']('tag')&&_0x429f0c[_0x5f26('0x39')]&&_0x429f0c[_0x5f26('0x39')]!=='--'){_0x4a80e6[_0x5f26('0x9')]({'type':_0x429f0c['type'][_0x5f26('0x38')](),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x3a')+_0x429f0c['tag'],'context':_0x29206b[_0x5f26('0x5')],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});}_0x4a80e6[_0x5f26('0x9')]({'type':_0x429f0c[_0x5f26('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0x5f26('0x3b')+(_0x429f0c['callerID']?'Set(CALLERID(all)='+_0x429f0c[_0x5f26('0x3c')]+')':_0x5f26('0x3d')),'context':_0x29206b['context'],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')]['length']+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});}else{if(_0x429f0c[_0x5f26('0x19')](_0x5f26('0x3e'))){if([_0x5f26('0x3f'),_0x5f26('0x40')]['includes'](_0x429f0c[_0x5f26('0x41')][_0x5f26('0x38')]())&&_0x429f0c[_0x5f26('0x42')]!=='custom'){if(_0x429f0c['answer']){_0x4a80e6[_0x5f26('0x9')]({'type':_0x429f0c[_0x5f26('0x3')]['toLowerCase'](),'app':_0x5f26('0x14'),'appdata':_0x5f26('0x43'),'context':_0x29206b[_0x5f26('0x5')],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});_0x4a80e6['push']({'type':_0x429f0c[_0x5f26('0x3')][_0x5f26('0x38')](),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x44'),'context':_0x29206b['context'],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});}else{_0x4a80e6[_0x5f26('0x9')]({'type':_0x429f0c['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x5f26('0x45'),'context':_0x29206b[_0x5f26('0x5')],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')]['length']+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});_0x4a80e6['push']({'type':_0x429f0c['type']['toLowerCase'](),'app':_0x5f26('0x4'),'appdata':_0x5f26('0x46'),'context':_0x29206b['context'],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});}}}}for(var _0xe32d92=0x0;_0xe32d92<_0x429f0c[_0x5f26('0x35')]['length'];_0xe32d92++){var _0x4710a3=_0x192a7c+_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')];var _0x13b16b=_0xe32d92===_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]-0x1?_0x192a7c+_0x4a80e6[_0x5f26('0x23')]+_0x200dc0['length']+0x2:_0x192a7c+_0xe32d92+0x1;_0x4a80e6['splice'](_0xe32d92,0x0,{'type':_0x29206b[_0x5f26('0x3')],'app':_0x5f26('0x47'),'appdata':_0x429f0c['intervals'][_0xe32d92]+'?'+_0x29206b[_0x5f26('0x5')]+',${EXTEN},'+_0x4710a3+':'+_0x29206b[_0x5f26('0x5')]+_0x5f26('0x48')+_0x13b16b,'exten':_0x29206b[_0x5f26('0x6')],'context':_0x29206b[_0x5f26('0x5')],'priority':_0x192a7c+_0xe32d92,'VoiceExtensionId':_0x29206b['id']});}if(_0x429f0c[_0x5f26('0x42')]===_0x5f26('0x49')){_0x429f0c[_0x5f26('0x4a')]=_0x27188c(_0x29206b,_0x429f0c[_0x5f26('0x4a')]);}if(_0x429f0c[_0x5f26('0x42')]===_0x5f26('0x4b')){_0x4a80e6['push']({'type':_0x429f0c['type'][_0x5f26('0x38')](),'app':'Set','appdata':_0x5f26('0x4c'),'context':_0x29206b[_0x5f26('0x5')],'exten':_0x29206b[_0x5f26('0x6')],'priority':_0x429f0c[_0x5f26('0x35')][_0x5f26('0x23')]+_0x192a7c+_0x4ab439++,'VoiceExtensionId':_0x29206b['id']});}_0x429f0c['priority']=_0x4a80e6['length']?_[_0x5f26('0x4d')](_0x4a80e6)['priority']+0x1:_0x192a7c;_0x432c22=_[_0x5f26('0x4e')](_0x432c22,_0x4a80e6,[_0x429f0c],_0x200dc0);_0x192a7c=_[_0x5f26('0x4d')](_0x432c22)[_0x5f26('0x4f')]+0x1;}return _0x30d3a9(_0x432c22);})[_0x5f26('0x50')](function(_0x23cd2e){_0x4a877b(_0x23cd2e);});});}return _0x31c342[_0x5f26('0x51')](_0x5f26('0x52'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2d7c7a){var _0x2ca4cc=this[_0x5f26('0x53')]({'plain':!![]});var _0x754fef=_0x2ca4cc[_0x5f26('0x3')]===_0x5f26('0xf')?_0x210308(_0x2ca4cc):_0x2f773d(_0x2ca4cc);return _0xa88083(_0x2ca4cc,_0x2d7c7a,_['last'](_0x754fef)[_0x5f26('0x4f')]+0x1)[_0x5f26('0x33')](function(_0x3b3b1d){var _0x478c61=_[_0x5f26('0x4e')](_0x754fef,_0x3b3b1d);_0x478c61[_0x5f26('0x9')]({'type':_0x2ca4cc[_0x5f26('0x3')],'app':_0x5f26('0x54'),'exten':_0x2ca4cc[_0x5f26('0x6')],'context':_0x2ca4cc[_0x5f26('0x5')],'priority':_[_0x5f26('0x4d')](_0x478c61)[_0x5f26('0x4f')]+0x1,'VoiceExtensionId':_0x2ca4cc['id']});return _0x478c61;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 31942b9..11d4cdd 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 _0x1766=['then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x1f7c90,_0x23a49e){var _0x145a29=function(_0x3a49d7){while(--_0x3a49d7){_0x1f7c90['push'](_0x1f7c90['shift']());}};_0x145a29(++_0x23a49e);}(_0x1766,0x17d));var _0x6176=function(_0x16f5a3,_0x479984){_0x16f5a3=_0x16f5a3-0x0;var _0x3269af=_0x1766[_0x16f5a3];return _0x3269af;};'use strict';var _=require(_0x6176('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6176('0x1'));var rs=require(_0x6176('0x2'));var fs=require('fs');var Redis=require(_0x6176('0x3'));var db=require(_0x6176('0x4'))['db'];var utils=require(_0x6176('0x5'));var logger=require(_0x6176('0x6'))('rpc');var config=require(_0x6176('0x7'));var jayson=require(_0x6176('0x8'));var client=jayson['client'][_0x6176('0x9')]({'port':0x232a});config[_0x6176('0xa')]=_[_0x6176('0xb')](config[_0x6176('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6176('0xc'))(new Redis(config[_0x6176('0xa')]));require(_0x6176('0xd'))[_0x6176('0xe')](socket);function respondWithRpcPromise(_0x18e00d,_0x4eb9e0,_0x29570a){return new BPromise(function(_0x18a20b,_0x3da3c8){return client['request'](_0x18e00d,_0x29570a)[_0x6176('0xf')](function(_0x4ae0aa){logger[_0x6176('0x10')](_0x6176('0x11'),_0x4eb9e0,_0x6176('0x12'));logger[_0x6176('0x13')](_0x6176('0x14'),_0x4eb9e0,'request\x20sent',JSON[_0x6176('0x15')](_0x4ae0aa));if(_0x4ae0aa[_0x6176('0x16')]){if(_0x4ae0aa[_0x6176('0x16')][_0x6176('0x17')]===0x1f4){logger[_0x6176('0x16')](_0x6176('0x11'),_0x4eb9e0,_0x4ae0aa[_0x6176('0x16')]['message']);return _0x3da3c8(_0x4ae0aa[_0x6176('0x16')][_0x6176('0x18')]);}logger[_0x6176('0x16')](_0x6176('0x11'),_0x4eb9e0,_0x4ae0aa['error']['message']);return _0x18a20b(_0x4ae0aa['error'][_0x6176('0x18')]);}else{logger[_0x6176('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x4eb9e0,'request\x20sent');_0x18a20b(_0x4ae0aa[_0x6176('0x19')]['message']);}})['catch'](function(_0x3b97f9){logger[_0x6176('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x4eb9e0,_0x3b97f9);_0x3da3c8(_0x3b97f9);});});}exports[_0x6176('0x1a')]=function(_0x5a2c4f){var _0x3b44e2=this;return new Promise(function(_0x83f3e5,_0x540adf){return db['VoiceExtension'][_0x6176('0x1b')]({'raw':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a2c4f['options']?_0x5a2c4f[_0x6176('0x1c')]['where']||null:null,'attributes':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1e')]||null:null,'limit':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x1f')]||null:null,'include':_0x5a2c4f[_0x6176('0x1c')]?_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x20')]?_[_0x6176('0x21')](_0x5a2c4f[_0x6176('0x1c')][_0x6176('0x20')],function(_0x4d9be6){return{'model':db[_0x4d9be6[_0x6176('0x22')]],'as':_0x4d9be6['as'],'attributes':_0x4d9be6[_0x6176('0x1e')],'include':_0x4d9be6[_0x6176('0x20')]?_[_0x6176('0x21')](_0x4d9be6[_0x6176('0x20')],function(_0x20efab){return{'model':db[_0x20efab[_0x6176('0x22')]],'as':_0x20efab['as'],'attributes':_0x20efab[_0x6176('0x1e')],'include':_0x20efab[_0x6176('0x20')]?_[_0x6176('0x21')](_0x20efab[_0x6176('0x20')],function(_0x301a0d){return{'model':db[_0x301a0d[_0x6176('0x22')]],'as':_0x301a0d['as'],'attributes':_0x301a0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6176('0xf')](function(_0x256583){logger[_0x6176('0x10')](_0x6176('0x1a'),_0x5a2c4f);logger['debug'](_0x6176('0x1a'),_0x5a2c4f,JSON[_0x6176('0x15')](_0x256583));_0x83f3e5(_0x256583);})[_0x6176('0x23')](function(_0x53618c){logger[_0x6176('0x16')]('GetVoiceExtension',_0x53618c[_0x6176('0x18')],_0x5a2c4f);_0x540adf(_0x3b44e2['error'](0x1f4,_0x53618c[_0x6176('0x18')]));});});}; \ No newline at end of file +var _0x78d3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0x38cafe,_0xffb7af){var _0x3bb88a=function(_0x5afa2e){while(--_0x5afa2e){_0x38cafe['push'](_0x38cafe['shift']());}};_0x3bb88a(++_0xffb7af);}(_0x78d3,0x73));var _0x378d=function(_0x3ff816,_0x11f14a){_0x3ff816=_0x3ff816-0x0;var _0x358174=_0x78d3[_0x3ff816];return _0x358174;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x378d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x378d('0xf'))(new Redis(config[_0x378d('0xe')]));require(_0x378d('0x10'))[_0x378d('0x11')](socket);function respondWithRpcPromise(_0x43da5f,_0x12d960,_0x53a4b6){return new BPromise(function(_0x1c4d11,_0x21bf21){return client[_0x378d('0x12')](_0x43da5f,_0x53a4b6)['then'](function(_0x378254){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'));logger[_0x378d('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'),JSON[_0x378d('0x15')](_0x378254));if(_0x378254[_0x378d('0x16')]){if(_0x378254['error'][_0x378d('0x17')]===0x1f4){logger['error'](_0x378d('0x18'),_0x12d960,_0x378254[_0x378d('0x16')][_0x378d('0x19')]);return _0x21bf21(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}logger['error'](_0x378d('0x18'),_0x12d960,_0x378254['error'][_0x378d('0x19')]);return _0x1c4d11(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}else{logger[_0x378d('0x1a')](_0x378d('0x18'),_0x12d960,'request\x20sent');_0x1c4d11(_0x378254[_0x378d('0x1b')]['message']);}})[_0x378d('0x1c')](function(_0x4067d9){logger[_0x378d('0x16')](_0x378d('0x18'),_0x12d960,_0x4067d9);_0x21bf21(_0x4067d9);});});}exports[_0x378d('0x1d')]=function(_0x11584b){var _0x1c9244=this;return new Promise(function(_0x521d40,_0x5a936c){return db[_0x378d('0x1e')][_0x378d('0x1f')]({'raw':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x21')]===undefined?!![]:![]:!![],'where':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x22')]||null:null,'attributes':_0x11584b['options']?_0x11584b[_0x378d('0x20')]['attributes']||null:null,'limit':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x23')]||null:null,'include':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x24')]?_[_0x378d('0x25')](_0x11584b['options'][_0x378d('0x24')],function(_0x22fee7){return{'model':db[_0x22fee7[_0x378d('0x26')]],'as':_0x22fee7['as'],'attributes':_0x22fee7[_0x378d('0x27')],'include':_0x22fee7[_0x378d('0x24')]?_[_0x378d('0x25')](_0x22fee7[_0x378d('0x24')],function(_0x34ffa7){return{'model':db[_0x34ffa7['model']],'as':_0x34ffa7['as'],'attributes':_0x34ffa7['attributes'],'include':_0x34ffa7[_0x378d('0x24')]?_['map'](_0x34ffa7[_0x378d('0x24')],function(_0x292b73){return{'model':db[_0x292b73[_0x378d('0x26')]],'as':_0x292b73['as'],'attributes':_0x292b73[_0x378d('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59945b){logger[_0x378d('0x1a')]('GetVoiceExtension',_0x11584b);logger['debug']('GetVoiceExtension',_0x11584b,JSON[_0x378d('0x15')](_0x59945b));_0x521d40(_0x59945b);})['catch'](function(_0x4d1de5){logger[_0x378d('0x16')]('GetVoiceExtension',_0x4d1de5[_0x378d('0x19')],_0x11584b);_0x5a936c(_0x1c9244[_0x378d('0x16')](0x1f4,_0x4d1de5[_0x378d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ed340c0..02e97be 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x358502,_0x5a5a95){var _0x1915ab=function(_0x38192e){while(--_0x38192e){_0x358502['push'](_0x358502['shift']());}};_0x1915ab(++_0x5a5a95);}(_0x1261,0x144));var _0x1126=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x1261[_0x3a7e01];return _0x5b8398;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x3df9c8,_0x5c034e){var _0x2b0f57=function(_0x403fe6){while(--_0x403fe6){_0x3df9c8['push'](_0x3df9c8['shift']());}};_0x2b0f57(++_0x5c034e);}(_0xe14b,0x93));var _0xbe14=function(_0x6b6b99,_0x254b9d){_0x6b6b99=_0x6b6b99-0x0;var _0x15fb7e=_0xe14b[_0x6b6b99];return _0x15fb7e;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9a20a05..6cf395a 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update'];(function(_0x7611ce,_0x4a4441){var _0x67d3ab=function(_0x1456d8){while(--_0x1456d8){_0x7611ce['push'](_0x7611ce['shift']());}};_0x67d3ab(++_0x4a4441);}(_0xadb5,0xad));var _0x5adb=function(_0x3be815,_0xe6932f){_0x3be815=_0x3be815-0x0;var _0xbc01f2=_0xadb5[_0x3be815];return _0xbc01f2;};'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('./voiceMail.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('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','/:id','show','getMessages','post','create','delete','destroy','exports','multer','express'];(function(_0xfd82bb,_0x50eb8a){var _0x23957c=function(_0x28b15b){while(--_0x28b15b){_0xfd82bb['push'](_0xfd82bb['shift']());}};_0x23957c(++_0x50eb8a);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x596ae9,_0xa90b36){_0x596ae9=_0x596ae9-0x0;var _0x367eef=_0x0a6b[_0x596ae9];return _0x367eef;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xc')]);router['put'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 5f520b0..c9a921c 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 _0xa424=['trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0xe2ea05,_0x2e5d44){var _0x3ae10a=function(_0x1775a6){while(--_0x1775a6){_0xe2ea05['push'](_0xe2ea05['shift']());}};_0x3ae10a(++_0x2e5d44);}(_0xa424,0x14c));var _0x4a42=function(_0x4c8758,_0x1a42b6){_0x4c8758=_0x4c8758-0x0;var _0x2e6804=_0xa424[_0x4c8758];return _0x2e6804;};'use strict';var Sequelize=require(_0x4a42('0x0'));module[_0x4a42('0x1')]={'customer_id':{'type':Sequelize[_0x4a42('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4a42('0x3'),'unique':_0x4a42('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4a42('0x4')},'password':{'type':Sequelize[_0x4a42('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4a42('0x2')],'validate':{'isEmail':!![]},'set':function(_0xb9eb55){this[_0x4a42('0x5')](_0x4a42('0x6'),typeof _0xb9eb55===_0x4a42('0x7')&&_0xb9eb55[_0x4a42('0x8')]()?_0xb9eb55[_0x4a42('0x8')]():null);}},'pager':{'type':Sequelize[_0x4a42('0x2')]},'tz':{'type':Sequelize[_0x4a42('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':_0x4a42('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x4a42('0x2')]},'review':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4a42('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4a42('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x4a42('0xa'),'no'),'defaultValue':_0x4a42('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4a42('0x9')](_0x4a42('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4a42('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4a42('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4a42('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4a42('0xd')],'get':function(){return this[_0x4a42('0xe')](_0x4a42('0xf'))+_0x4a42('0x10')+this[_0x4a42('0xe')]('mailbox');}}}; \ No newline at end of file +var _0xb9e1=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','from-voicemail','STRING','email','string','trim','central'];(function(_0x40232b,_0x31d8f3){var _0x78579d=function(_0x3096d5){while(--_0x3096d5){_0x40232b['push'](_0x40232b['shift']());}};_0x78579d(++_0x31d8f3);}(_0xb9e1,0xa2));var _0x1b9e=function(_0x49adfe,_0x2fd329){_0x49adfe=_0x49adfe-0x0;var _0x1d53da=_0xb9e1[_0x49adfe];return _0x1d53da;};'use strict';var Sequelize=require(_0x1b9e('0x0'));module[_0x1b9e('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1b9e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x1b9e('0x3')]},'fullname':{'type':Sequelize[_0x1b9e('0x3')]},'email':{'type':Sequelize[_0x1b9e('0x3')],'validate':{'isEmail':!![]},'set':function(_0x451900){this['setDataValue'](_0x1b9e('0x4'),typeof _0x451900===_0x1b9e('0x5')&&_0x451900['trim']()?_0x451900[_0x1b9e('0x6')]():null);}},'pager':{'type':Sequelize[_0x1b9e('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x1b9e('0x7')},'attach':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':_0x1b9e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x1b9e('0x3')]},'review':{'type':Sequelize['ENUM'](_0x1b9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1b9e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1b9e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1b9e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':_0x1b9e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1b9e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1b9e('0x8')](_0x1b9e('0x9'),'no'),'defaultValue':_0x1b9e('0x9'),'allowNull':![]},'stamp':{'type':_0x1b9e('0xb')},'emailsubject':{'type':Sequelize[_0x1b9e('0x3')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1b9e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1b9e('0xd')](_0x1b9e('0xe'))+_0x1b9e('0xf')+this['getDataValue'](_0x1b9e('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 973ccd1..6d20d9b 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 _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xf4eb,0xec));var _0xbf4e=function(_0x50c79a,_0x4c9f8a){_0x50c79a=_0x50c79a-0x0;var _0x27eb34=_0xf4eb[_0x50c79a];return _0x27eb34;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file +var _0x4483=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Voicemails','UserProfileResource','error','name','index','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','find','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x34620e,_0x582015){var _0x3d33cd=function(_0x19dc7f){while(--_0x19dc7f){_0x34620e['push'](_0x34620e['shift']());}};_0x3d33cd(++_0x582015);}(_0x4483,0x1a3));var _0x3448=function(_0x13caec,_0x2eadc2){_0x13caec=_0x13caec-0x0;var _0x48f0ff=_0x4483[_0x13caec];return _0x48f0ff;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){var _0x566ff5=_0x22ad5c[_0x3448('0x29')]({'plain':!![]});var _0x1b5c49=_0x3448('0x2a');return db[_0x3448('0x2b')][_0x3448('0x27')]({'where':{'type':_0x1b5c49,'resourceId':_0x566ff5['id']}})['then'](function(){return _0x22ad5c;});})[_0x3448('0x28')](function(){_0x2dcd40[_0x3448('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a479,_0x12c22d){return function(_0x310912){if(!_0x310912){_0x19a479[_0x3448('0x1b')](0x194);}return _0x310912;};}function handleError(_0x38fab2,_0x35f026){_0x35f026=_0x35f026||0x1f4;return function(_0x31be64){logger[_0x3448('0x2c')](_0x31be64['stack']);if(_0x31be64[_0x3448('0x2d')]){delete _0x31be64[_0x3448('0x2d')];}_0x38fab2[_0x3448('0x1c')](_0x35f026)['send'](_0x31be64);};}exports[_0x3448('0x2e')]=function(_0x5dfdf7,_0x486f2c){var _0x493898={},_0x52fb48={},_0xff6513={'count':0x0,'rows':[]};var _0x5e96f0=_['map'](db[_0x3448('0x2f')][_0x3448('0x30')],function(_0x32121c){return{'name':_0x32121c[_0x3448('0x31')],'type':_0x32121c['type'][_0x3448('0x32')]};});_0x52fb48[_0x3448('0x33')]=_[_0x3448('0x34')](_0x5e96f0,'name');_0x52fb48[_0x3448('0x35')]=_[_0x3448('0x36')](_0x5dfdf7['query']);_0x52fb48['filters']=_[_0x3448('0x37')](_0x52fb48[_0x3448('0x33')],_0x52fb48[_0x3448('0x35')]);_0x493898[_0x3448('0x38')]=_['intersection'](_0x52fb48[_0x3448('0x33')],qs[_0x3448('0x39')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x39')]));_0x493898['attributes']=_0x493898[_0x3448('0x38')][_0x3448('0x3a')]?_0x493898['attributes']:_0x52fb48[_0x3448('0x33')];if(!_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3b')](_0x3448('0x3c'))){_0x493898[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x21')]);_0x493898[_0x3448('0x1f')]=qs['offset'](_0x5dfdf7['query'][_0x3448('0x1f')]);}_0x493898['order']=qs[_0x3448('0x3d')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3d')]);_0x493898[_0x3448('0x3e')]=qs['filters'](_[_0x3448('0x3f')](_0x5dfdf7[_0x3448('0x35')],_0x52fb48[_0x3448('0x40')]),_0x5e96f0);if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x41')]){_0x493898[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x493898[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x5e96f0,function(_0x5a58c5){if(_0x5a58c5[_0x3448('0x43')]!==_0x3448('0x44')){var _0x322b46={};_0x322b46[_0x5a58c5[_0x3448('0x2d')]]={'$like':'%'+_0x5dfdf7[_0x3448('0x35')]['filter']+'%'};return _0x322b46;}})});}_0x493898=_[_0x3448('0x42')]({},_0x493898,_0x5dfdf7[_0x3448('0x45')]);var _0x4a6e5={'where':_0x493898[_0x3448('0x3e')]};return db[_0x3448('0x2f')][_0x3448('0x22')](_0x4a6e5)[_0x3448('0x28')](function(_0x3db5f1){_0xff6513['count']=_0x3db5f1;if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x46')]){_0x493898[_0x3448('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x3448('0x48')](_0x493898);})[_0x3448('0x28')](function(_0x21f989){_0xff6513[_0x3448('0x49')]=_0x21f989;return _0xff6513;})[_0x3448('0x28')](respondWithFilteredResult(_0x486f2c,_0x493898))[_0x3448('0x4a')](handleError(_0x486f2c,null));};exports[_0x3448('0x4b')]=function(_0x4f54e7,_0x2165c7){var _0x46b172={'raw':!![],'where':{'id':_0x4f54e7[_0x3448('0x4c')]['id']}},_0x1e7fb7={};_0x1e7fb7[_0x3448('0x33')]=_[_0x3448('0x36')](db['VoiceMail'][_0x3448('0x30')]);_0x1e7fb7['query']=_['keys'](_0x4f54e7[_0x3448('0x35')]);_0x1e7fb7[_0x3448('0x40')]=_['intersection'](_0x1e7fb7[_0x3448('0x33')],_0x1e7fb7[_0x3448('0x35')]);_0x46b172['attributes']=_[_0x3448('0x37')](_0x1e7fb7[_0x3448('0x33')],qs['fields'](_0x4f54e7[_0x3448('0x35')][_0x3448('0x39')]));_0x46b172[_0x3448('0x38')]=_0x46b172[_0x3448('0x38')][_0x3448('0x3a')]?_0x46b172[_0x3448('0x38')]:_0x1e7fb7[_0x3448('0x33')];if(_0x4f54e7['query']['includeAll']){_0x46b172[_0x3448('0x47')]=[{'all':!![]}];}_0x46b172=_[_0x3448('0x42')]({},_0x46b172,_0x4f54e7[_0x3448('0x45')]);return db[_0x3448('0x2f')]['find'](_0x46b172)[_0x3448('0x28')](handleEntityNotFound(_0x2165c7,null))[_0x3448('0x28')](respondWithResult(_0x2165c7,null))[_0x3448('0x4a')](handleError(_0x2165c7,null));};exports[_0x3448('0x4d')]=function(_0x363374,_0x5d942b){return db[_0x3448('0x2f')]['create'](_0x363374[_0x3448('0x4e')],{})[_0x3448('0x28')](function(_0x5c8e42){var _0x479b79=_0x363374[_0x3448('0x4f')][_0x3448('0x29')]({'plain':!![]});if(!_0x479b79)throw new Error(_0x3448('0x50'));if(_0x479b79[_0x3448('0x51')]===_0x3448('0x4f')){var _0xc769e1=_0x5c8e42['get']({'plain':!![]});var _0x23dbda=_0x3448('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x23dbda,'userProfileId':_0x479b79[_0x3448('0x52')]},'raw':!![]})[_0x3448('0x28')](function(_0x4d20ba){if(_0x4d20ba&&_0x4d20ba['autoAssociation']===0x0){return db[_0x3448('0x2b')][_0x3448('0x4d')]({'name':_0xc769e1[_0x3448('0x2d')],'resourceId':_0xc769e1['id'],'type':_0x4d20ba[_0x3448('0x2d')],'sectionId':_0x4d20ba['id']},{})[_0x3448('0x28')](function(){return _0x5c8e42;});}else{return _0x5c8e42;}})[_0x3448('0x4a')](function(_0x2aea70){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aea70);throw _0x2aea70;});}return _0x5c8e42;})['then'](respondWithResult(_0x5d942b,0xc9))[_0x3448('0x4a')](handleError(_0x5d942b,null));};exports[_0x3448('0x26')]=function(_0x5cf3fe,_0x35ce1d){if(_0x5cf3fe[_0x3448('0x4e')]['id']){delete _0x5cf3fe['body']['id'];}return db[_0x3448('0x2f')][_0x3448('0x53')]({'where':{'id':_0x5cf3fe['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x35ce1d,null))[_0x3448('0x28')](saveUpdates(_0x5cf3fe[_0x3448('0x4e')],null))[_0x3448('0x28')](respondWithResult(_0x35ce1d,null))[_0x3448('0x4a')](handleError(_0x35ce1d,null));};exports[_0x3448('0x27')]=function(_0xeda861,_0x1b7d87){return db[_0x3448('0x2f')]['find']({'where':{'id':_0xeda861[_0x3448('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b7d87,null))[_0x3448('0x28')](removeEntity(_0x1b7d87,null))[_0x3448('0x4a')](handleError(_0x1b7d87,null));};exports[_0x3448('0x54')]=function(_0x58422,_0x1cbeae,_0x332e02){return db['VoiceMail'][_0x3448('0x55')]({'where':{'id':_0x58422['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x1cbeae,null))[_0x3448('0x28')](function(_0x3bf4d2){var _0x5c9320;var _0x3ead11={},_0x4e381f={};_0x4e381f['model']=_[_0x3448('0x36')](db[_0x3448('0x56')][_0x3448('0x30')]);_0x4e381f['query']=_[_0x3448('0x36')](_0x58422[_0x3448('0x35')]);_0x4e381f[_0x3448('0x40')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],_0x4e381f[_0x3448('0x35')]);_0x3ead11[_0x3448('0x38')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],qs[_0x3448('0x39')](_0x58422[_0x3448('0x35')][_0x3448('0x39')]));_0x3ead11[_0x3448('0x38')]=_0x3ead11[_0x3448('0x38')][_0x3448('0x3a')]?_0x3ead11[_0x3448('0x38')]:_0x4e381f[_0x3448('0x33')];if(!_0x58422[_0x3448('0x35')]['hasOwnProperty'](_0x3448('0x3c'))){_0x3ead11['limit']=qs[_0x3448('0x21')](_0x58422['query'][_0x3448('0x21')]);_0x3ead11[_0x3448('0x1f')]=qs['offset'](_0x58422[_0x3448('0x35')][_0x3448('0x1f')]);}_0x3ead11['order']=qs['sort'](_0x58422[_0x3448('0x35')]['sort']);_0x3ead11['where']=qs[_0x3448('0x40')](_[_0x3448('0x3f')](_0x58422['query'],_0x4e381f['filters']));if(_0x58422[_0x3448('0x35')][_0x3448('0x41')]){_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x3ead11[_0x3448('0x38')],function(_0x10749d){var _0x2cf3ef={};_0x2cf3ef[_0x10749d]={'$like':'%'+_0x58422[_0x3448('0x35')][_0x3448('0x41')]+'%'};return _0x2cf3ef;})});}_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'mailboxuser':_0x3bf4d2['mailbox']});_0x3ead11=_[_0x3448('0x42')]({},_0x3ead11,_0x58422[_0x3448('0x45')]);return db['VoiceMailMessage'][_0x3448('0x57')](_0x3ead11)[_0x3448('0x28')](respondWithFilteredResult(_0x1cbeae,_0x3ead11));})['catch'](handleError(_0x1cbeae,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5372589..d28bd7f 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 _0xd91a=['../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3b17ae,_0x54073e){var _0x4f6538=function(_0x1d20ce){while(--_0x1d20ce){_0x3b17ae['push'](_0x3b17ae['shift']());}};_0x4f6538(++_0x54073e);}(_0xd91a,0x133));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xad91('0x0'));var logger=require(_0xad91('0x1'))('api');var moment=require('moment');var BPromise=require(_0xad91('0x2'));var rp=require(_0xad91('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad91('0x4'));var config=require(_0xad91('0x5'));var attributes=require(_0xad91('0x6'));module[_0xad91('0x7')]=function(_0x333851,_0x351924){return _0x333851['define'](_0xad91('0x8'),attributes,{'tableName':_0xad91('0x9'),'paranoid':![],'indexes':[{'name':_0xad91('0xa'),'fields':[_0xad91('0xb'),_0xad91('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0cf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x3fd971,_0xf12fe3){var _0x4eb76d=function(_0x36db7d){while(--_0x36db7d){_0x3fd971['push'](_0x3fd971['shift']());}};_0x4eb76d(++_0xf12fe3);}(_0xc0cf,0xa9));var _0xfc0c=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0xc0cf[_0x3e690a];return _0x435ca0;};'use strict';var _=require(_0xfc0c('0x0'));var util=require(_0xfc0c('0x1'));var logger=require(_0xfc0c('0x2'))(_0xfc0c('0x3'));var moment=require(_0xfc0c('0x4'));var BPromise=require(_0xfc0c('0x5'));var rp=require(_0xfc0c('0x6'));var fs=require('fs');var path=require(_0xfc0c('0x7'));var rimraf=require('rimraf');var config=require(_0xfc0c('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x3083b2,_0x9e7a9b){return _0x3083b2[_0xfc0c('0x9')]('VoiceMail',attributes,{'tableName':_0xfc0c('0xa'),'paranoid':![],'indexes':[{'name':_0xfc0c('0xb'),'fields':[_0xfc0c('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 643bd64..bbf55fc 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 _0x75c2=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x312428,_0x458f28){var _0x583514=function(_0x305d1d){while(--_0x305d1d){_0x312428['push'](_0x312428['shift']());}};_0x583514(++_0x458f28);}(_0x75c2,0x85));var _0x275c=function(_0x557e95,_0x3d9496){_0x557e95=_0x557e95-0x0;var _0x3e6b70=_0x75c2[_0x557e95];return _0x3e6b70;};'use strict';var _=require('lodash');var util=require(_0x275c('0x0'));var moment=require('moment');var BPromise=require(_0x275c('0x1'));var rs=require(_0x275c('0x2'));var fs=require('fs');var Redis=require(_0x275c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x275c('0x4'));var logger=require(_0x275c('0x5'))('rpc');var config=require(_0x275c('0x6'));var jayson=require(_0x275c('0x7'));var client=jayson[_0x275c('0x8')][_0x275c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5adb43,_0x9565a2,_0xd743fa){return new BPromise(function(_0x56f552,_0xb2a8e3){return client[_0x275c('0xa')](_0x5adb43,_0xd743fa)['then'](function(_0x5b4f9e){logger['info'](_0x275c('0xb'),_0x9565a2,_0x275c('0xc'));logger[_0x275c('0xd')](_0x275c('0xe'),_0x9565a2,_0x275c('0xc'),JSON[_0x275c('0xf')](_0x5b4f9e));if(_0x5b4f9e[_0x275c('0x10')]){if(_0x5b4f9e[_0x275c('0x10')][_0x275c('0x11')]===0x1f4){logger['error'](_0x275c('0xb'),_0x9565a2,_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);return _0xb2a8e3(_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);}logger[_0x275c('0x10')]('VoiceMail,\x20%s,\x20%s',_0x9565a2,_0x5b4f9e[_0x275c('0x10')][_0x275c('0x12')]);return _0x56f552(_0x5b4f9e['error'][_0x275c('0x12')]);}else{logger['info'](_0x275c('0xb'),_0x9565a2,'request\x20sent');_0x56f552(_0x5b4f9e[_0x275c('0x13')][_0x275c('0x12')]);}})[_0x275c('0x14')](function(_0x189756){logger['error']('VoiceMail,\x20%s,\x20%s',_0x9565a2,_0x189756);_0xb2a8e3(_0x189756);});});} \ No newline at end of file +var _0xfe98=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfe98,0x153));var _0x8fe9=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xfe98[_0x5c768b];return _0x335af8;};'use strict';var _=require(_0x8fe9('0x0'));var util=require(_0x8fe9('0x1'));var moment=require(_0x8fe9('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fe9('0x3'));var fs=require('fs');var Redis=require(_0x8fe9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fe9('0x5'));var logger=require(_0x8fe9('0x6'))('rpc');var config=require(_0x8fe9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ae6f,_0x5a469a,_0x198158){return new BPromise(function(_0xf81378,_0x277cc6){return client[_0x8fe9('0x8')](_0x15ae6f,_0x198158)[_0x8fe9('0x9')](function(_0x476b06){logger[_0x8fe9('0xa')](_0x8fe9('0xb'),_0x5a469a,_0x8fe9('0xc'));logger[_0x8fe9('0xd')](_0x8fe9('0xe'),_0x5a469a,_0x8fe9('0xc'),JSON[_0x8fe9('0xf')](_0x476b06));if(_0x476b06[_0x8fe9('0x10')]){if(_0x476b06[_0x8fe9('0x10')][_0x8fe9('0x11')]===0x1f4){logger['error'](_0x8fe9('0xb'),_0x5a469a,_0x476b06[_0x8fe9('0x10')][_0x8fe9('0x12')]);return _0x277cc6(_0x476b06[_0x8fe9('0x10')][_0x8fe9('0x12')]);}logger[_0x8fe9('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5a469a,_0x476b06['error'][_0x8fe9('0x12')]);return _0xf81378(_0x476b06[_0x8fe9('0x10')][_0x8fe9('0x12')]);}else{logger[_0x8fe9('0xa')](_0x8fe9('0xb'),_0x5a469a,_0x8fe9('0xc'));_0xf81378(_0x476b06[_0x8fe9('0x13')][_0x8fe9('0x12')]);}})[_0x8fe9('0x14')](function(_0x2e0066){logger[_0x8fe9('0x10')](_0x8fe9('0xb'),_0x5a469a,_0x2e0066);_0x277cc6(_0x2e0066);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f373a04..949a810 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 _0x75ed=['show','post','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id'];(function(_0x30df5a,_0x4af839){var _0x28127c=function(_0x27d13a){while(--_0x27d13a){_0x30df5a['push'](_0x30df5a['shift']());}};_0x28127c(++_0x4af839);}(_0x75ed,0x176));var _0xd75e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x75ed[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xd75e('0x0'));var path=require('path');var timeout=require(_0xd75e('0x1'));var express=require(_0xd75e('0x2'));var router=express[_0xd75e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd75e('0x4'));var interaction=require(_0xd75e('0x5'));var config=require('../../config/environment');var controller=require(_0xd75e('0x6'));router[_0xd75e('0x7')]('/',auth[_0xd75e('0x8')](),controller['index']);router['get'](_0xd75e('0x9'),auth[_0xd75e('0x8')](),controller[_0xd75e('0xa')]);router['get']('/:id/download',auth[_0xd75e('0x8')](),controller['download']);router[_0xd75e('0xb')]('/',auth[_0xd75e('0x8')](),controller[_0xd75e('0xc')]);router['put'](_0xd75e('0x9'),auth[_0xd75e('0x8')](),controller[_0xd75e('0xd')]);router['delete']('/:id',auth[_0xd75e('0x8')](),controller[_0xd75e('0xe')]);module[_0xd75e('0xf')]=router; \ No newline at end of file +var _0xe193=['../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/download','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ac5a8,_0x36c9ec){var _0x32ef92=function(_0x2acd91){while(--_0x2acd91){_0x5ac5a8['push'](_0x5ac5a8['shift']());}};_0x32ef92(++_0x36c9ec);}(_0xe193,0x19d));var _0x3e19=function(_0x302772,_0xcd79ec){_0x302772=_0x302772-0x0;var _0x2450ec=_0xe193[_0x302772];return _0x2450ec;};'use strict';var multer=require(_0x3e19('0x0'));var util=require(_0x3e19('0x1'));var path=require(_0x3e19('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e19('0x3'));var router=express[_0x3e19('0x4')]();var fs_extra=require(_0x3e19('0x5'));var auth=require(_0x3e19('0x6'));var interaction=require(_0x3e19('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x3e19('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e19('0x9')]);router[_0x3e19('0x8')](_0x3e19('0xa'),auth[_0x3e19('0xb')](),controller[_0x3e19('0xc')]);router[_0x3e19('0x8')](_0x3e19('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x3e19('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3e19('0xf')](_0x3e19('0xa'),auth[_0x3e19('0xb')](),controller[_0x3e19('0x10')]);router[_0x3e19('0x11')](_0x3e19('0xa'),auth['isAuthenticated'](),controller[_0x3e19('0x12')]);module[_0x3e19('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index fef9a58..724cd7c 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 _0xbb1d=['sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xbb1d,0x156));var _0xdbb1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb1d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdbb1('0x0'));module[_0xdbb1('0x1')]={'name':{'type':Sequelize[_0xdbb1('0x2')],'get':function(_0x4202ee){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xdbb1('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xdbb1('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdbb1('0x4')],'defaultValue':''},'stamp':{'type':_0xdbb1('0x6'),'defaultValue':Sequelize[_0xdbb1('0x7')](_0xdbb1('0x8'))}}; \ No newline at end of file +var _0xac5a=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5a,0x8a));var _0xaac5=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xac5a[_0x48e1ec];return _0x3b33eb;};'use strict';var Sequelize=require(_0xaac5('0x0'));module[_0xaac5('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36a733){return this[_0xaac5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xaac5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xaac5('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xaac5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xaac5('0x6'),'defaultValue':Sequelize['literal'](_0xaac5('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2f9990c..77e9852 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 _0x4a8d=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceMailMessage','includeAll','include','rows','catch','find','create','body','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5923bd,_0x5b7a57){var _0x38aa20=function(_0x202a3d){while(--_0x202a3d){_0x5923bd['push'](_0x5923bd['shift']());}};_0x38aa20(++_0x5b7a57);}(_0x4a8d,0x9c));var _0xd4a8=function(_0x3a0deb,_0x2f868d){_0x3a0deb=_0x3a0deb-0x0;var _0xd1f46a=_0x4a8d[_0x3a0deb];return _0xd1f46a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd4a8('0x0'));var rp=require(_0xd4a8('0x1'));var moment=require(_0xd4a8('0x2'));var BPromise=require(_0xd4a8('0x3'));var Mustache=require(_0xd4a8('0x4'));var util=require(_0xd4a8('0x5'));var path=require(_0xd4a8('0x6'));var sox=require(_0xd4a8('0x7'));var csv=require(_0xd4a8('0x8'));var ejs=require(_0xd4a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd4a8('0xa'));var _=require('lodash');var squel=require(_0xd4a8('0xb'));var crypto=require(_0xd4a8('0xc'));var jsforce=require(_0xd4a8('0xd'));var deskjs=require(_0xd4a8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4a8('0xf'));var Papa=require(_0xd4a8('0x10'));var Redis=require(_0xd4a8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd4a8('0x12'));var hardwareService=require(_0xd4a8('0x13'));var logger=require(_0xd4a8('0x14'))(_0xd4a8('0x15'));var utils=require(_0xd4a8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18d0f1,_0xecc59a){_0xecc59a=_0xecc59a||0xcc;return function(_0x5e0ef3){if(_0x5e0ef3){return _0x18d0f1[_0xd4a8('0x17')](_0xecc59a);}return _0x18d0f1[_0xd4a8('0x18')](_0xecc59a)['end']();};}function respondWithResult(_0x159fb3,_0x312f1a){_0x312f1a=_0x312f1a||0xc8;return function(_0x140571){if(_0x140571){return _0x159fb3[_0xd4a8('0x18')](_0x312f1a)[_0xd4a8('0x19')](_0x140571);}};}function respondWithFilteredResult(_0x3c6af5,_0x1afe57){return function(_0xa33291){if(_0xa33291){var _0x3606f7=typeof _0x1afe57[_0xd4a8('0x1a')]==='undefined'&&typeof _0x1afe57[_0xd4a8('0x1b')]===_0xd4a8('0x1c');var _0x544967=_0xa33291[_0xd4a8('0x1d')];var _0xb9edba=_0x3606f7?0x0:_0x1afe57[_0xd4a8('0x1a')];var _0x4cd9b4=_0x3606f7?_0xa33291[_0xd4a8('0x1d')]:_0x1afe57['offset']+_0x1afe57['limit'];var _0x41d01b;if(_0x4cd9b4>=_0x544967){_0x4cd9b4=_0x544967;_0x41d01b=0xc8;}else{_0x41d01b=0xce;}_0x3c6af5[_0xd4a8('0x18')](_0x41d01b);return _0x3c6af5[_0xd4a8('0x1e')](_0xd4a8('0x1f'),_0xb9edba+'-'+_0x4cd9b4+'/'+_0x544967)[_0xd4a8('0x19')](_0xa33291);}return null;};}function patchUpdates(_0x1bc8be){return function(_0x4db09b){try{jsonpatch[_0xd4a8('0x20')](_0x4db09b,_0x1bc8be,!![]);}catch(_0x3b82da){return BPromise[_0xd4a8('0x21')](_0x3b82da);}return _0x4db09b['save']();};}function saveUpdates(_0x18f5bd,_0xd98fa){return function(_0x2e894c){if(_0x2e894c){return _0x2e894c[_0xd4a8('0x22')](_0x18f5bd)['then'](function(_0x4b6c33){return _0x4b6c33;});}return null;};}function removeEntity(_0x2de7e4,_0x395fc2){return function(_0x338965){if(_0x338965){return _0x338965['destroy']()[_0xd4a8('0x23')](function(){_0x2de7e4[_0xd4a8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d2fb,_0x3ac85c){return function(_0x386523){if(!_0x386523){_0x26d2fb[_0xd4a8('0x17')](0x194);}return _0x386523;};}function handleError(_0xb68d1b,_0x9e65d5){_0x9e65d5=_0x9e65d5||0x1f4;return function(_0x4abcd3){logger[_0xd4a8('0x24')](_0x4abcd3[_0xd4a8('0x25')]);if(_0x4abcd3[_0xd4a8('0x26')]){delete _0x4abcd3[_0xd4a8('0x26')];}_0xb68d1b[_0xd4a8('0x18')](_0x9e65d5)[_0xd4a8('0x27')](_0x4abcd3);};}exports[_0xd4a8('0x28')]=function(_0x1fc7a3,_0x314b6e){var _0x261acc={},_0x4153ce={},_0x3b1918={'count':0x0,'rows':[]};var _0x2561d9=_['map'](db['VoiceMailMessage'][_0xd4a8('0x29')],function(_0x37eac8){return{'name':_0x37eac8[_0xd4a8('0x2a')],'type':_0x37eac8[_0xd4a8('0x2b')]['key']};});_0x4153ce[_0xd4a8('0x2c')]=_['differenceBy'](_[_0xd4a8('0x2d')](_0x2561d9,_0xd4a8('0x26')),[_0xd4a8('0x26')]);_0x4153ce[_0xd4a8('0x2e')]=_[_0xd4a8('0x2f')](_0x1fc7a3[_0xd4a8('0x2e')]);_0x4153ce[_0xd4a8('0x30')]=_[_0xd4a8('0x31')](_0x4153ce[_0xd4a8('0x2c')],_0x4153ce['query']);_0x261acc[_0xd4a8('0x32')]=_['intersection'](_0x4153ce['model'],qs['fields'](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x33')]));_0x261acc[_0xd4a8('0x32')]=_0x261acc[_0xd4a8('0x32')][_0xd4a8('0x34')]?_0x261acc[_0xd4a8('0x32')]:_0x4153ce[_0xd4a8('0x2c')];if(!_0x1fc7a3[_0xd4a8('0x2e')]['hasOwnProperty'](_0xd4a8('0x35'))){_0x261acc[_0xd4a8('0x1b')]=qs[_0xd4a8('0x1b')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x1b')]);_0x261acc[_0xd4a8('0x1a')]=qs[_0xd4a8('0x1a')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x1a')]);}_0x261acc[_0xd4a8('0x36')]=qs[_0xd4a8('0x37')](_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x37')]);_0x261acc[_0xd4a8('0x38')]=qs[_0xd4a8('0x30')](_[_0xd4a8('0x39')](_0x1fc7a3[_0xd4a8('0x2e')],_0x4153ce[_0xd4a8('0x30')]),_0x2561d9);if(_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3a')]){_0x261acc[_0xd4a8('0x38')]=_[_0xd4a8('0x3b')](_0x261acc['where'],{'$or':_['map'](_0x2561d9,function(_0x37d637){if(_0x37d637['type']!=='VIRTUAL'){var _0x17986b={};_0x17986b[_0x37d637['name']]={'$like':'%'+_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3a')]+'%'};return _0x17986b;}})});}_0x261acc=_['merge']({},_0x261acc,_0x1fc7a3[_0xd4a8('0x3c')]);var _0x3fef52={'where':_0x261acc[_0xd4a8('0x38')]};return db[_0xd4a8('0x3d')][_0xd4a8('0x1d')](_0x3fef52)['then'](function(_0x35c794){_0x3b1918['count']=_0x35c794;if(_0x1fc7a3[_0xd4a8('0x2e')][_0xd4a8('0x3e')]){_0x261acc[_0xd4a8('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x261acc);})[_0xd4a8('0x23')](function(_0x38855c){_0x3b1918[_0xd4a8('0x40')]=_0x38855c;return _0x3b1918;})[_0xd4a8('0x23')](respondWithFilteredResult(_0x314b6e,_0x261acc))[_0xd4a8('0x41')](handleError(_0x314b6e,null));};exports['show']=function(_0x3ee637,_0x11a0c3){var _0x46b6e2={'raw':!![],'where':{'id':_0x3ee637['params']['id']}},_0x4a7d43={};_0x4a7d43[_0xd4a8('0x2c')]=_[_0xd4a8('0x2f')](db[_0xd4a8('0x3d')][_0xd4a8('0x29')]);_0x4a7d43['query']=_[_0xd4a8('0x2f')](_0x3ee637['query']);_0x4a7d43[_0xd4a8('0x30')]=_[_0xd4a8('0x31')](_0x4a7d43[_0xd4a8('0x2c')],_0x4a7d43[_0xd4a8('0x2e')]);_0x46b6e2['attributes']=_[_0xd4a8('0x31')](_0x4a7d43['model'],qs[_0xd4a8('0x33')](_0x3ee637[_0xd4a8('0x2e')]['fields']));_0x46b6e2[_0xd4a8('0x32')]=_0x46b6e2[_0xd4a8('0x32')][_0xd4a8('0x34')]?_0x46b6e2[_0xd4a8('0x32')]:_0x4a7d43['model'];if(_0x3ee637[_0xd4a8('0x2e')]['includeAll']){_0x46b6e2[_0xd4a8('0x3f')]=[{'all':!![]}];}_0x46b6e2=_['merge']({},_0x46b6e2,_0x3ee637[_0xd4a8('0x3c')]);return db[_0xd4a8('0x3d')][_0xd4a8('0x42')](_0x46b6e2)['then'](handleEntityNotFound(_0x11a0c3,null))[_0xd4a8('0x23')](respondWithResult(_0x11a0c3,null))[_0xd4a8('0x41')](handleError(_0x11a0c3,null));};exports['create']=function(_0x2bf78e,_0x3be91d){return db[_0xd4a8('0x3d')][_0xd4a8('0x43')](_0x2bf78e['body'],{})[_0xd4a8('0x23')](respondWithResult(_0x3be91d,0xc9))['catch'](handleError(_0x3be91d,null));};exports[_0xd4a8('0x22')]=function(_0x545d43,_0x246b48){if(_0x545d43['body']['id']){delete _0x545d43[_0xd4a8('0x44')]['id'];}return db['VoiceMailMessage'][_0xd4a8('0x42')]({'where':{'id':_0x545d43[_0xd4a8('0x45')]['id']}})[_0xd4a8('0x23')](handleEntityNotFound(_0x246b48,null))[_0xd4a8('0x23')](saveUpdates(_0x545d43['body'],null))[_0xd4a8('0x23')](respondWithResult(_0x246b48,null))['catch'](handleError(_0x246b48,null));};exports['destroy']=function(_0x188d68,_0x5fdfb8){return db[_0xd4a8('0x3d')]['find']({'where':{'id':_0x188d68[_0xd4a8('0x45')]['id']}})[_0xd4a8('0x23')](handleEntityNotFound(_0x5fdfb8,null))['then'](removeEntity(_0x5fdfb8,null))[_0xd4a8('0x41')](handleError(_0x5fdfb8,null));};exports[_0xd4a8('0x46')]=function(_0x3cc94c,_0x3234b3,_0x5877b6){return db[_0xd4a8('0x3d')]['find']({'where':{'id':_0x3cc94c[_0xd4a8('0x45')]['id']},'attributes':['id','recording',_0xd4a8('0x47')]})[_0xd4a8('0x23')](handleEntityNotFound(_0x3234b3,null))[_0xd4a8('0x23')](function(_0x4013d0){if(_0x4013d0){if(!_0x4013d0[_0xd4a8('0x48')]){throw new db[(_0xd4a8('0x49'))][(_0xd4a8('0x4a'))](_0xd4a8('0x4b'));}var _0x34a8f4={'Content-Type':_0xd4a8('0x4c'),'Content-Disposition':_0xd4a8('0x4d')};if(_0x4013d0['msg_id']){_0x34a8f4[_0xd4a8('0x4e')]=_0xd4a8('0x4f')+_0x4013d0['msg_id']+_0xd4a8('0x50');}_0x3234b3[_0xd4a8('0x1e')](_0x34a8f4);return _0x3234b3[_0xd4a8('0x27')](new Buffer(_0x4013d0[_0xd4a8('0x48')]));}})[_0xd4a8('0x41')](handleError(_0x3234b3,null));}; \ No newline at end of file +var _0x9ff3=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','options','VoiceMailMessage','include','findAll','show','params','rawAttributes','find','create','catch','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x77df1,_0x291f5d){var _0x19e186=function(_0xaa8af2){while(--_0xaa8af2){_0x77df1['push'](_0x77df1['shift']());}};_0x19e186(++_0x291f5d);}(_0x9ff3,0x13b));var _0x39ff=function(_0x3c179b,_0x2d343c){_0x3c179b=_0x3c179b-0x0;var _0x494231=_0x9ff3[_0x3c179b];return _0x494231;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39ff('0x1'));var moment=require(_0x39ff('0x2'));var BPromise=require(_0x39ff('0x3'));var Mustache=require(_0x39ff('0x4'));var util=require(_0x39ff('0x5'));var path=require('path');var sox=require(_0x39ff('0x6'));var csv=require('to-csv');var ejs=require(_0x39ff('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x39ff('0x8'));var jsforce=require(_0x39ff('0x9'));var deskjs=require(_0x39ff('0xa'));var toCsv=require('to-csv');var querystring=require(_0x39ff('0xb'));var Papa=require(_0x39ff('0xc'));var Redis=require(_0x39ff('0xd'));var authService=require(_0x39ff('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x39ff('0xf'));var hardwareService=require(_0x39ff('0x10'));var logger=require(_0x39ff('0x11'))('api');var utils=require(_0x39ff('0x12'));var config=require(_0x39ff('0x13'));var licenseUtil=require(_0x39ff('0x14'));var db=require(_0x39ff('0x15'))['db'];function respondWithStatusCode(_0xf66e2f,_0x3373f6){_0x3373f6=_0x3373f6||0xcc;return function(_0x13ac16){if(_0x13ac16){return _0xf66e2f[_0x39ff('0x16')](_0x3373f6);}return _0xf66e2f['status'](_0x3373f6)[_0x39ff('0x17')]();};}function respondWithResult(_0x1220dd,_0x23e439){_0x23e439=_0x23e439||0xc8;return function(_0x20d13e){if(_0x20d13e){return _0x1220dd['status'](_0x23e439)[_0x39ff('0x18')](_0x20d13e);}};}function respondWithFilteredResult(_0x5638e6,_0x51fa83){return function(_0x370e08){if(_0x370e08){var _0x196972=typeof _0x51fa83['offset']==='undefined'&&typeof _0x51fa83['limit']===_0x39ff('0x19');var _0x1b017f=_0x370e08[_0x39ff('0x1a')];var _0x5c7e9d=_0x196972?0x0:_0x51fa83[_0x39ff('0x1b')];var _0x145ce8=_0x196972?_0x370e08[_0x39ff('0x1a')]:_0x51fa83[_0x39ff('0x1b')]+_0x51fa83[_0x39ff('0x1c')];var _0x2657e9;if(_0x145ce8>=_0x1b017f){_0x145ce8=_0x1b017f;_0x2657e9=0xc8;}else{_0x2657e9=0xce;}_0x5638e6[_0x39ff('0x1d')](_0x2657e9);return _0x5638e6[_0x39ff('0x1e')]('Content-Range',_0x5c7e9d+'-'+_0x145ce8+'/'+_0x1b017f)['json'](_0x370e08);}return null;};}function patchUpdates(_0x30db71){return function(_0x35e582){try{jsonpatch[_0x39ff('0x1f')](_0x35e582,_0x30db71,!![]);}catch(_0x26a74a){return BPromise[_0x39ff('0x20')](_0x26a74a);}return _0x35e582[_0x39ff('0x21')]();};}function saveUpdates(_0x414b37,_0x2fd951){return function(_0x4487ae){if(_0x4487ae){return _0x4487ae[_0x39ff('0x22')](_0x414b37)[_0x39ff('0x23')](function(_0x38b69a){return _0x38b69a;});}return null;};}function removeEntity(_0x42a801,_0x2be22a){return function(_0x415642){if(_0x415642){return _0x415642[_0x39ff('0x24')]()[_0x39ff('0x23')](function(){_0x42a801[_0x39ff('0x1d')](0xcc)[_0x39ff('0x17')]();});}};}function handleEntityNotFound(_0x36e654,_0xb403e7){return function(_0x359285){if(!_0x359285){_0x36e654[_0x39ff('0x16')](0x194);}return _0x359285;};}function handleError(_0x4d0321,_0x116359){_0x116359=_0x116359||0x1f4;return function(_0x75ea7b){logger[_0x39ff('0x25')](_0x75ea7b[_0x39ff('0x26')]);if(_0x75ea7b[_0x39ff('0x27')]){delete _0x75ea7b[_0x39ff('0x27')];}_0x4d0321[_0x39ff('0x1d')](_0x116359)[_0x39ff('0x28')](_0x75ea7b);};}exports[_0x39ff('0x29')]=function(_0x59ef87,_0x59d70a){var _0x3f6c11={},_0x1b8815={},_0x2aa1f1={'count':0x0,'rows':[]};var _0x4a1f98=_[_0x39ff('0x2a')](db['VoiceMailMessage']['rawAttributes'],function(_0x30d585){return{'name':_0x30d585[_0x39ff('0x2b')],'type':_0x30d585['type'][_0x39ff('0x2c')]};});_0x1b8815[_0x39ff('0x2d')]=_[_0x39ff('0x2e')](_[_0x39ff('0x2a')](_0x4a1f98,'name'),[_0x39ff('0x27')]);_0x1b8815['query']=_[_0x39ff('0x2f')](_0x59ef87['query']);_0x1b8815[_0x39ff('0x30')]=_[_0x39ff('0x31')](_0x1b8815['model'],_0x1b8815[_0x39ff('0x32')]);_0x3f6c11[_0x39ff('0x33')]=_[_0x39ff('0x31')](_0x1b8815['model'],qs['fields'](_0x59ef87['query'][_0x39ff('0x34')]));_0x3f6c11['attributes']=_0x3f6c11[_0x39ff('0x33')][_0x39ff('0x35')]?_0x3f6c11['attributes']:_0x1b8815[_0x39ff('0x2d')];if(!_0x59ef87[_0x39ff('0x32')][_0x39ff('0x36')](_0x39ff('0x37'))){_0x3f6c11[_0x39ff('0x1c')]=qs[_0x39ff('0x1c')](_0x59ef87[_0x39ff('0x32')][_0x39ff('0x1c')]);_0x3f6c11['offset']=qs['offset'](_0x59ef87['query'][_0x39ff('0x1b')]);}_0x3f6c11[_0x39ff('0x38')]=qs['sort'](_0x59ef87[_0x39ff('0x32')]['sort']);_0x3f6c11['where']=qs[_0x39ff('0x30')](_[_0x39ff('0x39')](_0x59ef87[_0x39ff('0x32')],_0x1b8815[_0x39ff('0x30')]),_0x4a1f98);if(_0x59ef87[_0x39ff('0x32')][_0x39ff('0x3a')]){_0x3f6c11[_0x39ff('0x3b')]=_[_0x39ff('0x3c')](_0x3f6c11['where'],{'$or':_['map'](_0x4a1f98,function(_0x4a7a84){if(_0x4a7a84[_0x39ff('0x3d')]!=='VIRTUAL'){var _0x4463ff={};_0x4463ff[_0x4a7a84[_0x39ff('0x27')]]={'$like':'%'+_0x59ef87[_0x39ff('0x32')][_0x39ff('0x3a')]+'%'};return _0x4463ff;}})});}_0x3f6c11=_[_0x39ff('0x3c')]({},_0x3f6c11,_0x59ef87[_0x39ff('0x3e')]);var _0x1763c6={'where':_0x3f6c11[_0x39ff('0x3b')]};return db[_0x39ff('0x3f')][_0x39ff('0x1a')](_0x1763c6)[_0x39ff('0x23')](function(_0x1d7ead){_0x2aa1f1[_0x39ff('0x1a')]=_0x1d7ead;if(_0x59ef87[_0x39ff('0x32')]['includeAll']){_0x3f6c11[_0x39ff('0x40')]=[{'all':!![]}];}return db[_0x39ff('0x3f')][_0x39ff('0x41')](_0x3f6c11);})['then'](function(_0x248012){_0x2aa1f1['rows']=_0x248012;return _0x2aa1f1;})['then'](respondWithFilteredResult(_0x59d70a,_0x3f6c11))['catch'](handleError(_0x59d70a,null));};exports[_0x39ff('0x42')]=function(_0x405926,_0x5c0685){var _0x1a8ace={'raw':!![],'where':{'id':_0x405926[_0x39ff('0x43')]['id']}},_0x3ab640={};_0x3ab640[_0x39ff('0x2d')]=_[_0x39ff('0x2f')](db[_0x39ff('0x3f')][_0x39ff('0x44')]);_0x3ab640[_0x39ff('0x32')]=_[_0x39ff('0x2f')](_0x405926[_0x39ff('0x32')]);_0x3ab640[_0x39ff('0x30')]=_['intersection'](_0x3ab640[_0x39ff('0x2d')],_0x3ab640[_0x39ff('0x32')]);_0x1a8ace[_0x39ff('0x33')]=_[_0x39ff('0x31')](_0x3ab640[_0x39ff('0x2d')],qs['fields'](_0x405926[_0x39ff('0x32')][_0x39ff('0x34')]));_0x1a8ace[_0x39ff('0x33')]=_0x1a8ace[_0x39ff('0x33')][_0x39ff('0x35')]?_0x1a8ace[_0x39ff('0x33')]:_0x3ab640['model'];if(_0x405926[_0x39ff('0x32')]['includeAll']){_0x1a8ace[_0x39ff('0x40')]=[{'all':!![]}];}_0x1a8ace=_[_0x39ff('0x3c')]({},_0x1a8ace,_0x405926[_0x39ff('0x3e')]);return db[_0x39ff('0x3f')][_0x39ff('0x45')](_0x1a8ace)['then'](handleEntityNotFound(_0x5c0685,null))[_0x39ff('0x23')](respondWithResult(_0x5c0685,null))['catch'](handleError(_0x5c0685,null));};exports['create']=function(_0x32db09,_0x1fd567){return db[_0x39ff('0x3f')][_0x39ff('0x46')](_0x32db09['body'],{})[_0x39ff('0x23')](respondWithResult(_0x1fd567,0xc9))[_0x39ff('0x47')](handleError(_0x1fd567,null));};exports[_0x39ff('0x22')]=function(_0x4df82f,_0x37a071){if(_0x4df82f[_0x39ff('0x48')]['id']){delete _0x4df82f[_0x39ff('0x48')]['id'];}return db[_0x39ff('0x3f')][_0x39ff('0x45')]({'where':{'id':_0x4df82f[_0x39ff('0x43')]['id']}})[_0x39ff('0x23')](handleEntityNotFound(_0x37a071,null))['then'](saveUpdates(_0x4df82f[_0x39ff('0x48')],null))[_0x39ff('0x23')](respondWithResult(_0x37a071,null))['catch'](handleError(_0x37a071,null));};exports[_0x39ff('0x24')]=function(_0x456f1d,_0x5a9040){return db[_0x39ff('0x3f')][_0x39ff('0x45')]({'where':{'id':_0x456f1d[_0x39ff('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a9040,null))[_0x39ff('0x23')](removeEntity(_0x5a9040,null))[_0x39ff('0x47')](handleError(_0x5a9040,null));};exports[_0x39ff('0x49')]=function(_0x19250f,_0x3c5b7c,_0x35e8e8){return db[_0x39ff('0x3f')][_0x39ff('0x45')]({'where':{'id':_0x19250f[_0x39ff('0x43')]['id']},'attributes':['id',_0x39ff('0x4a'),_0x39ff('0x4b')]})['then'](handleEntityNotFound(_0x3c5b7c,null))[_0x39ff('0x23')](function(_0x111d0d){if(_0x111d0d){if(!_0x111d0d[_0x39ff('0x4a')]){throw new db[(_0x39ff('0x4c'))][(_0x39ff('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x532bad={'Content-Type':_0x39ff('0x4e'),'Content-Disposition':_0x39ff('0x4f')};if(_0x111d0d['msg_id']){_0x532bad[_0x39ff('0x50')]='attachment;\x20filename=\x22'+_0x111d0d[_0x39ff('0x4b')]+_0x39ff('0x51');}_0x3c5b7c[_0x39ff('0x1e')](_0x532bad);return _0x3c5b7c[_0x39ff('0x28')](new Buffer(_0x111d0d[_0x39ff('0x4a')]));}})['catch'](handleError(_0x3c5b7c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 559da48..2664154 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 _0xe270=['api','moment','bluebird','path','define','VoiceMailMessage','dir'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe270,0x165));var _0x0e27=function(_0x3d3e41,_0x225a72){_0x3d3e41=_0x3d3e41-0x0;var _0x1ad548=_0xe270[_0x3d3e41];return _0x1ad548;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e27('0x0'));var moment=require(_0x0e27('0x1'));var BPromise=require(_0x0e27('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e27('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x572375,_0x1423bb){return _0x572375[_0x0e27('0x4')](_0x0e27('0x5'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0e27('0x6'),'fields':[_0x0e27('0x6')]}],'timestamps':![]});}; \ No newline at end of file +var _0x942a=['VoiceMailMessage','dir','lodash','../../config/logger','path','rimraf','./voiceMailMessage.attributes','define'];(function(_0x558356,_0x952831){var _0x539de7=function(_0x2c6f5b){while(--_0x2c6f5b){_0x558356['push'](_0x558356['shift']());}};_0x539de7(++_0x952831);}(_0x942a,0x142));var _0xa942=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x942a[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0xa942('0x0'));var util=require('util');var logger=require(_0xa942('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa942('0x2'));var rimraf=require(_0xa942('0x3'));var config=require('../../config/environment');var attributes=require(_0xa942('0x4'));module['exports']=function(_0x227269,_0x1ace28){return _0x227269[_0xa942('0x5')](_0xa942('0x6'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xa942('0x7'),'fields':[_0xa942('0x7')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 19ce9f2..308f727 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 _0x5bfe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMailMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5bfe,0x72));var _0xe5bf=function(_0x28f2b9,_0x8a242b){_0x28f2b9=_0x28f2b9-0x0;var _0x3f7323=_0x5bfe[_0x28f2b9];return _0x3f7323;};'use strict';var _=require(_0xe5bf('0x0'));var util=require(_0xe5bf('0x1'));var moment=require(_0xe5bf('0x2'));var BPromise=require(_0xe5bf('0x3'));var rs=require(_0xe5bf('0x4'));var fs=require('fs');var Redis=require(_0xe5bf('0x5'));var db=require(_0xe5bf('0x6'))['db'];var utils=require(_0xe5bf('0x7'));var logger=require(_0xe5bf('0x8'))(_0xe5bf('0x9'));var config=require(_0xe5bf('0xa'));var jayson=require(_0xe5bf('0xb'));var client=jayson[_0xe5bf('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7d91,_0x29e018,_0x37e933){return new BPromise(function(_0x36e633,_0x441e53){return client[_0xe5bf('0xd')](_0x2f7d91,_0x37e933)[_0xe5bf('0xe')](function(_0xecef37){logger[_0xe5bf('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xe5bf('0x10'));logger[_0xe5bf('0x11')](_0xe5bf('0x12'),_0x29e018,_0xe5bf('0x10'),JSON[_0xe5bf('0x13')](_0xecef37));if(_0xecef37[_0xe5bf('0x14')]){if(_0xecef37[_0xe5bf('0x14')]['code']===0x1f4){logger[_0xe5bf('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xecef37['error'][_0xe5bf('0x15')]);return _0x441e53(_0xecef37['error'][_0xe5bf('0x15')]);}logger['error'](_0xe5bf('0x16'),_0x29e018,_0xecef37[_0xe5bf('0x14')][_0xe5bf('0x15')]);return _0x36e633(_0xecef37['error'][_0xe5bf('0x15')]);}else{logger[_0xe5bf('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x29e018,_0xe5bf('0x10'));_0x36e633(_0xecef37[_0xe5bf('0x17')][_0xe5bf('0x15')]);}})['catch'](function(_0xea7745){logger[_0xe5bf('0x14')](_0xe5bf('0x16'),_0x29e018,_0xea7745);_0x441e53(_0xea7745);});});} \ No newline at end of file +var _0x1af3=['client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1af3,0x1ec));var _0x31af=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x1af3[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x31af('0x0'));var util=require('util');var moment=require(_0x31af('0x1'));var BPromise=require(_0x31af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x31af('0x4'));var logger=require('../../config/logger')(_0x31af('0x5'));var config=require(_0x31af('0x6'));var jayson=require(_0x31af('0x7'));var client=jayson[_0x31af('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be771,_0x3f4007,_0x49ed00){return new BPromise(function(_0x1c172b,_0x5a6c11){return client[_0x31af('0x9')](_0x1be771,_0x49ed00)[_0x31af('0xa')](function(_0x25fc7c){logger[_0x31af('0xb')](_0x31af('0xc'),_0x3f4007,_0x31af('0xd'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3f4007,_0x31af('0xd'),JSON[_0x31af('0xe')](_0x25fc7c));if(_0x25fc7c[_0x31af('0xf')]){if(_0x25fc7c[_0x31af('0xf')][_0x31af('0x10')]===0x1f4){logger['error'](_0x31af('0xc'),_0x3f4007,_0x25fc7c[_0x31af('0xf')][_0x31af('0x11')]);return _0x5a6c11(_0x25fc7c[_0x31af('0xf')][_0x31af('0x11')]);}logger[_0x31af('0xf')](_0x31af('0xc'),_0x3f4007,_0x25fc7c[_0x31af('0xf')][_0x31af('0x11')]);return _0x1c172b(_0x25fc7c[_0x31af('0xf')][_0x31af('0x11')]);}else{logger['info'](_0x31af('0xc'),_0x3f4007,_0x31af('0xd'));_0x1c172b(_0x25fc7c[_0x31af('0x12')]['message']);}})[_0x31af('0x13')](function(_0x29d1ad){logger[_0x31af('0xf')](_0x31af('0xc'),_0x3f4007,_0x29d1ad);_0x5a6c11(_0x29d1ad);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 510c7cc..9d8ea89 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 _0x012f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','put','update','destroy','delete','/:id/sounds/:id2','exports','multer','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x012f,0x17d));var _0xf012=function(_0x1f800f,_0x359dd7){_0x1f800f=_0x1f800f-0x0;var _0x28e9cc=_0x012f[_0x1f800f];return _0x28e9cc;};'use strict';var multer=require(_0xf012('0x0'));var util=require('util');var path=require(_0xf012('0x1'));var timeout=require(_0xf012('0x2'));var express=require(_0xf012('0x3'));var router=express[_0xf012('0x4')]();var fs_extra=require(_0xf012('0x5'));var auth=require(_0xf012('0x6'));var interaction=require(_0xf012('0x7'));var config=require(_0xf012('0x8'));var controller=require(_0xf012('0x9'));router[_0xf012('0xa')]('/',auth[_0xf012('0xb')](),controller[_0xf012('0xc')]);router[_0xf012('0xa')](_0xf012('0xd'),auth[_0xf012('0xb')](),controller['show']);router[_0xf012('0xa')](_0xf012('0xe'),auth[_0xf012('0xb')](),controller[_0xf012('0xf')]);router[_0xf012('0x10')]('/',auth['isAuthenticated'](),controller[_0xf012('0x11')]);router['post'](_0xf012('0xe'),auth[_0xf012('0xb')](),controller['addSound']);router[_0xf012('0x12')](_0xf012('0xd'),auth['isAuthenticated'](),controller[_0xf012('0x13')]);router['delete'](_0xf012('0xd'),auth[_0xf012('0xb')](),controller[_0xf012('0x14')]);router[_0xf012('0x15')](_0xf012('0x16'),auth[_0xf012('0xb')](),controller['removeSound']);module[_0xf012('0x17')]=router; \ No newline at end of file +var _0xc329=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/sounds','getSounds','create','post','addSound','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','multer'];(function(_0x70146c,_0x1aab14){var _0x26a036=function(_0x2b0832){while(--_0x2b0832){_0x70146c['push'](_0x70146c['shift']());}};_0x26a036(++_0x1aab14);}(_0xc329,0x1cb));var _0x9c32=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xc329[_0x5948dd];return _0xb1f8be;};'use strict';var multer=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var path=require(_0x9c32('0x2'));var timeout=require(_0x9c32('0x3'));var express=require(_0x9c32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c32('0x5'));var interaction=require(_0x9c32('0x6'));var config=require(_0x9c32('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x9c32('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c32('0x9')]);router['get']('/:id',auth[_0x9c32('0xa')](),controller[_0x9c32('0xb')]);router['get'](_0x9c32('0xc'),auth['isAuthenticated'](),controller[_0x9c32('0xd')]);router['post']('/',auth[_0x9c32('0xa')](),controller[_0x9c32('0xe')]);router[_0x9c32('0xf')]('/:id/sounds',auth[_0x9c32('0xa')](),controller[_0x9c32('0x10')]);router['put'](_0x9c32('0x11'),auth[_0x9c32('0xa')](),controller[_0x9c32('0x12')]);router[_0x9c32('0x13')](_0x9c32('0x11'),auth[_0x9c32('0xa')](),controller[_0x9c32('0x14')]);router[_0x9c32('0x13')](_0x9c32('0x15'),auth[_0x9c32('0xa')](),controller[_0x9c32('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 56ec34d..dcc35a4 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 _0x7096=['BOOLEAN','sequelize','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP'];(function(_0x21d6b4,_0x38eb36){var _0x1a1496=function(_0x2b14cf){while(--_0x2b14cf){_0x21d6b4['push'](_0x21d6b4['shift']());}};_0x1a1496(++_0x38eb36);}(_0x7096,0x83));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x6709('0x0'));module['exports']={'name':{'type':Sequelize[_0x6709('0x1')],'allowNull':![],'unique':_0x6709('0x2')},'mode':{'type':Sequelize['ENUM'](_0x6709('0x3'),_0x6709('0x4'),_0x6709('0x5'),_0x6709('0x6'),_0x6709('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x6709('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x6709('0x1')],'allowNull':!![]},'stamp':{'type':_0x6709('0x8')},'defaultEntry':{'type':Sequelize[_0x6709('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3968=['mp3nb','quietmp3nb','STRING','alpha','TIMESTAMP','sequelize','ENUM','files'];(function(_0x5e6fe1,_0x3081b0){var _0x287548=function(_0x1a4809){while(--_0x1a4809){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x287548(++_0x3081b0);}(_0x3968,0xd5));var _0x8396=function(_0x1ffafe,_0x580f1f){_0x1ffafe=_0x1ffafe-0x0;var _0x58fb75=_0x3968[_0x1ffafe];return _0x58fb75;};'use strict';var Sequelize=require(_0x8396('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x8396('0x1')]('custom',_0x8396('0x2'),_0x8396('0x3'),_0x8396('0x4'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x8396('0x2')},'directory':{'type':Sequelize[_0x8396('0x5')],'allowNull':!![]},'application':{'type':Sequelize[_0x8396('0x5')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x8396('0x5')],'allowNull':!![],'defaultValue':_0x8396('0x6')},'format':{'type':Sequelize[_0x8396('0x5')],'allowNull':!![]},'stamp':{'type':_0x8396('0x7')},'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 1a1fdd8..0beed45 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 _0x135a=['update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','body','create','transaction','files','join','root','server/files/moh','mode','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','Sequelize','ValidationError','message','addSound','Sound','findOne','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','converted_format','symlinkSync','removeSound','id2','createdAt','unlinkSync','getSounds','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','save'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x135a,0xc0));var _0xa135=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x135a[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xa135('0x0'));var rimraf=require(_0xa135('0x1'));var zipdir=require(_0xa135('0x2'));var jsonpatch=require(_0xa135('0x3'));var rp=require(_0xa135('0x4'));var moment=require('moment');var BPromise=require(_0xa135('0x5'));var Mustache=require(_0xa135('0x6'));var util=require(_0xa135('0x7'));var path=require(_0xa135('0x8'));var sox=require(_0xa135('0x9'));var csv=require('to-csv');var ejs=require(_0xa135('0xa'));var fs=require('fs');var fs_extra=require(_0xa135('0xb'));var _=require(_0xa135('0xc'));var squel=require(_0xa135('0xd'));var crypto=require(_0xa135('0xe'));var jsforce=require(_0xa135('0xf'));var deskjs=require(_0xa135('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa135('0x11'));var Papa=require(_0xa135('0x12'));var Redis=require(_0xa135('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa135('0x14'));var as=require(_0xa135('0x15'));var hardwareService=require(_0xa135('0x16'));var logger=require('../../config/logger')(_0xa135('0x17'));var utils=require('../../config/utils');var config=require(_0xa135('0x18'));var licenseUtil=require(_0xa135('0x19'));var db=require(_0xa135('0x1a'))['db'];function respondWithStatusCode(_0x4038d7,_0xa97407){_0xa97407=_0xa97407||0xcc;return function(_0x37cd14){if(_0x37cd14){return _0x4038d7[_0xa135('0x1b')](_0xa97407);}return _0x4038d7[_0xa135('0x1c')](_0xa97407)['end']();};}function respondWithResult(_0x1863ff,_0x308916){_0x308916=_0x308916||0xc8;return function(_0xea613b){if(_0xea613b){return _0x1863ff[_0xa135('0x1c')](_0x308916)[_0xa135('0x1d')](_0xea613b);}};}function respondWithFilteredResult(_0x12e49d,_0x482260){return function(_0x1e1893){if(_0x1e1893){var _0xd30d88=typeof _0x482260['offset']===_0xa135('0x1e')&&typeof _0x482260[_0xa135('0x1f')]===_0xa135('0x1e');var _0x3ffc54=_0x1e1893[_0xa135('0x20')];var _0x30a83c=_0xd30d88?0x0:_0x482260['offset'];var _0x366d68=_0xd30d88?_0x1e1893[_0xa135('0x20')]:_0x482260['offset']+_0x482260['limit'];var _0x4e8de0;if(_0x366d68>=_0x3ffc54){_0x366d68=_0x3ffc54;_0x4e8de0=0xc8;}else{_0x4e8de0=0xce;}_0x12e49d[_0xa135('0x1c')](_0x4e8de0);return _0x12e49d[_0xa135('0x21')]('Content-Range',_0x30a83c+'-'+_0x366d68+'/'+_0x3ffc54)[_0xa135('0x1d')](_0x1e1893);}return null;};}function patchUpdates(_0x1d81d1){return function(_0x394d0d){try{jsonpatch[_0xa135('0x22')](_0x394d0d,_0x1d81d1,!![]);}catch(_0x5a0b7b){return BPromise['reject'](_0x5a0b7b);}return _0x394d0d[_0xa135('0x23')]();};}function saveUpdates(_0x18e5a9,_0x5699d3){return function(_0x3a0998){if(_0x3a0998){return _0x3a0998[_0xa135('0x24')](_0x18e5a9)[_0xa135('0x25')](function(_0x2dcd8c){return _0x2dcd8c;});}return null;};}function removeEntity(_0x2b756b,_0xd7edd5){return function(_0x14ddec){if(_0x14ddec){return _0x14ddec[_0xa135('0x26')]()[_0xa135('0x25')](function(){var _0x3ba22d=_0x14ddec[_0xa135('0x27')]({'plain':!![]});var _0x3bf494=_0xa135('0x28');return db[_0xa135('0x29')][_0xa135('0x26')]({'where':{'type':_0x3bf494,'resourceId':_0x3ba22d['id']}})[_0xa135('0x25')](function(){return _0x14ddec;});})['then'](function(){_0x2b756b['status'](0xcc)[_0xa135('0x2a')]();});}};}function handleEntityNotFound(_0x3e5f4d,_0x1c262a){return function(_0x2a7187){if(!_0x2a7187){_0x3e5f4d[_0xa135('0x1b')](0x194);}return _0x2a7187;};}function handleError(_0x1d9e10,_0x566710){_0x566710=_0x566710||0x1f4;return function(_0x5a073c){logger[_0xa135('0x2b')](_0x5a073c[_0xa135('0x2c')]);if(_0x5a073c[_0xa135('0x2d')]){delete _0x5a073c[_0xa135('0x2d')];}_0x1d9e10[_0xa135('0x1c')](_0x566710)[_0xa135('0x2e')](_0x5a073c);};}exports['index']=function(_0x174d03,_0x2eb6a5){var _0x2337ad={},_0x1afc81={},_0x4d3b6f={'count':0x0,'rows':[]};var _0x5ee68b=_[_0xa135('0x2f')](db[_0xa135('0x30')]['rawAttributes'],function(_0xee47aa){return{'name':_0xee47aa[_0xa135('0x31')],'type':_0xee47aa[_0xa135('0x32')][_0xa135('0x33')]};});_0x1afc81[_0xa135('0x34')]=_[_0xa135('0x2f')](_0x5ee68b,_0xa135('0x2d'));_0x1afc81[_0xa135('0x35')]=_[_0xa135('0x36')](_0x174d03[_0xa135('0x35')]);_0x1afc81['filters']=_[_0xa135('0x37')](_0x1afc81['model'],_0x1afc81[_0xa135('0x35')]);_0x2337ad[_0xa135('0x38')]=_[_0xa135('0x37')](_0x1afc81[_0xa135('0x34')],qs[_0xa135('0x39')](_0x174d03['query']['fields']));_0x2337ad[_0xa135('0x38')]=_0x2337ad['attributes']['length']?_0x2337ad[_0xa135('0x38')]:_0x1afc81[_0xa135('0x34')];if(!_0x174d03[_0xa135('0x35')][_0xa135('0x3a')](_0xa135('0x3b'))){_0x2337ad[_0xa135('0x1f')]=qs['limit'](_0x174d03[_0xa135('0x35')][_0xa135('0x1f')]);_0x2337ad[_0xa135('0x3c')]=qs[_0xa135('0x3c')](_0x174d03[_0xa135('0x35')][_0xa135('0x3c')]);}_0x2337ad[_0xa135('0x3d')]=qs['sort'](_0x174d03[_0xa135('0x35')][_0xa135('0x3e')]);delete _0x174d03[_0xa135('0x35')]['sort'];_0x2337ad[_0xa135('0x3f')]=qs['filters'](_[_0xa135('0x40')](_0x174d03[_0xa135('0x35')],_0x1afc81[_0xa135('0x41')]),_0x5ee68b);if(_0x174d03['query'][_0xa135('0x42')]){_0x2337ad['where']=_[_0xa135('0x43')](_0x2337ad['where'],{'$or':_['map'](_0x5ee68b,function(_0x367cae){if(_0x367cae[_0xa135('0x32')]!==_0xa135('0x44')){var _0x2cbf73={};_0x2cbf73[_0x367cae['name']]={'$like':'%'+_0x174d03[_0xa135('0x35')]['filter']+'%'};return _0x2cbf73;}})});}_0x2337ad=_[_0xa135('0x43')]({},_0x2337ad,_0x174d03['options']);var _0x4de64b={'where':_0x2337ad[_0xa135('0x3f')]};return db[_0xa135('0x30')][_0xa135('0x20')](_0x4de64b)['then'](function(_0x348f16){_0x4d3b6f[_0xa135('0x20')]=_0x348f16;if(_0x174d03['query'][_0xa135('0x45')]){_0x2337ad[_0xa135('0x46')]=[{'all':!![]}];}return db[_0xa135('0x30')][_0xa135('0x47')](_0x2337ad);})[_0xa135('0x25')](function(_0x3af3f){_0x4d3b6f['rows']=_0x3af3f;return _0x4d3b6f;})[_0xa135('0x25')](respondWithFilteredResult(_0x2eb6a5,_0x2337ad))[_0xa135('0x48')](handleError(_0x2eb6a5,null));};exports[_0xa135('0x49')]=function(_0x44de15,_0x32c8e7){var _0x2c6bab={'raw':![],'where':{'id':_0x44de15[_0xa135('0x4a')]['id']}},_0x7b2aad={};_0x7b2aad[_0xa135('0x34')]=_[_0xa135('0x36')](db[_0xa135('0x30')]['rawAttributes']);_0x7b2aad[_0xa135('0x35')]=_['keys'](_0x44de15['query']);_0x7b2aad[_0xa135('0x41')]=_['intersection'](_0x7b2aad[_0xa135('0x34')],_0x7b2aad['query']);_0x2c6bab[_0xa135('0x38')]=_[_0xa135('0x37')](_0x7b2aad[_0xa135('0x34')],qs['fields'](_0x44de15[_0xa135('0x35')]['fields']));_0x2c6bab[_0xa135('0x38')]=_0x2c6bab['attributes'][_0xa135('0x4b')]?_0x2c6bab[_0xa135('0x38')]:_0x7b2aad['model'];if(_0x44de15[_0xa135('0x35')]['includeAll']){_0x2c6bab[_0xa135('0x46')]=[{'all':!![]}];}_0x2c6bab=_[_0xa135('0x43')]({},_0x2c6bab,_0x44de15['options']);return db[_0xa135('0x30')][_0xa135('0x4c')](_0x2c6bab)[_0xa135('0x25')](handleEntityNotFound(_0x32c8e7,null))['then'](respondWithResult(_0x32c8e7,null))[_0xa135('0x48')](handleError(_0x32c8e7,null));};exports[_0xa135('0x24')]=function(_0x13dba0,_0x20fb08){if(_0x13dba0[_0xa135('0x4d')]['id']){delete _0x13dba0['body']['id'];}return db[_0xa135('0x30')][_0xa135('0x4c')]({'where':{'id':_0x13dba0[_0xa135('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20fb08,null))[_0xa135('0x25')](saveUpdates(_0x13dba0[_0xa135('0x4d')],null))[_0xa135('0x25')](respondWithResult(_0x20fb08,null))[_0xa135('0x48')](handleError(_0x20fb08,null));};exports[_0xa135('0x4e')]=function(_0x2d83d0,_0xc123dc,_0x473a7c){return db['sequelize'][_0xa135('0x4f')](function(_0x2729a2){if(_0x2d83d0[_0xa135('0x4d')]['mode']===_0xa135('0x50')){_0x2d83d0[_0xa135('0x4d')]['directory']=path[_0xa135('0x51')](config[_0xa135('0x52')],_0xa135('0x53'),_0x2d83d0['body'][_0xa135('0x2d')]);}return db['VoiceMusicOnHold'][_0xa135('0x4e')](_0x2d83d0[_0xa135('0x4d')],{'transaction':_0x2729a2})[_0xa135('0x25')](function(_0x5f5c11){if(_0x2d83d0[_0xa135('0x4d')][_0xa135('0x54')]===_0xa135('0x50')){fs['mkdirSync'](_0x5f5c11[_0xa135('0x55')],parseInt(_0xa135('0x56'),0x8));}var _0x37cc18=_0x2d83d0['user'][_0xa135('0x27')]({'plain':!![]});if(!_0x37cc18)throw new Error(_0xa135('0x57'));if(_0x37cc18['role']===_0xa135('0x58')){var _0x4d88c0=_0x5f5c11['get']({'plain':!![]});return db['UserProfileSection'][_0xa135('0x4c')]({'where':{'name':_0xa135('0x28'),'userProfileId':_0x37cc18[_0xa135('0x59')]},'raw':!![]})['then'](function(_0x3063fb){if(_0x3063fb&&_0x3063fb[_0xa135('0x5a')]===0x0){return db[_0xa135('0x29')][_0xa135('0x4e')]({'name':_0x4d88c0[_0xa135('0x2d')],'resourceId':_0x4d88c0['id'],'type':_0x3063fb['name'],'sectionId':_0x3063fb['id']},{})[_0xa135('0x25')](function(){return _0x5f5c11;});}else{return _0x5f5c11;}})[_0xa135('0x48')](function(_0x110efb){logger[_0xa135('0x2b')](_0xa135('0x5b'),_0x110efb);});}return _0x5f5c11;});})['then'](respondWithResult(_0xc123dc,0xc9))['catch'](handleError(_0xc123dc,null));};exports[_0xa135('0x26')]=function(_0x598a80,_0x552f27,_0x233ad4){var _0x2b8758;return db[_0xa135('0x30')][_0xa135('0x4c')]({'where':{'id':_0x598a80[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](function(_0x240f41){if(_0x240f41){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x117602){return _0x240f41[_0xa135('0x26')]({'transaction':_0x117602,'raw':!![]})[_0xa135('0x25')](function(_0x13db70){if(_0x13db70[_0xa135('0x55')]){fs['readdirSync'](_0x13db70[_0xa135('0x55')])[_0xa135('0x5d')](function(_0x4df359){fs['unlinkSync'](path['join'](_0x13db70['directory'],_0x4df359));});fs['rmdirSync'](_0x13db70[_0xa135('0x55')]);}return _0x13db70;});})[_0xa135('0x48')](function(_0x36a5ba){throw new db[(_0xa135('0x5e'))][(_0xa135('0x5f'))](_0x36a5ba[_0xa135('0x60')]);});}})[_0xa135('0x25')](handleEntityNotFound(_0x552f27,null))['then'](removeEntity(_0x552f27,null))[_0xa135('0x48')](handleError(_0x552f27,null));};exports[_0xa135('0x61')]=function(_0x145cca,_0x12dcac,_0x29d207){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x126ad4){var _0x2e8b8c;return db['VoiceMusicOnHold'][_0xa135('0x4c')]({'where':{'id':_0x145cca[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](function(_0x499b44){if(_0x499b44){_0x2e8b8c=_0x499b44;return _0x499b44[_0xa135('0x61')](_0x145cca['body']['id'],{'transaction':_0x126ad4});}})[_0xa135('0x25')](function(_0x70a8ab){if(_0x70a8ab){return db[_0xa135('0x62')][_0xa135('0x63')]({'where':{'id':_0x145cca[_0xa135('0x4d')]['id']},'attributes':['id',_0xa135('0x2d'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0xa135('0x25')](function(_0x573dcb){if(_0x573dcb){var _0x35f80d=path[_0xa135('0x51')](config[_0xa135('0x52')],_0xa135('0x64'),util[_0xa135('0x65')](_0xa135('0x66'),path[_0xa135('0x67')](_0x573dcb[_0xa135('0x68')],path[_0xa135('0x69')](_0x573dcb[_0xa135('0x68')])),_0x573dcb['converted_format']));var _0x43af15=path['join'](config[_0xa135('0x52')],_0xa135('0x53'),_0x2e8b8c['name'],util[_0xa135('0x65')](_0xa135('0x66'),_0x573dcb['name'],_0x573dcb[_0xa135('0x6a')]));fs[_0xa135('0x6b')](_0x35f80d,_0x43af15);return _0x573dcb;}})[_0xa135('0x48')](function(_0x270185){throw new db['Sequelize'][(_0xa135('0x5f'))](_0x270185[_0xa135('0x60')]);});})['then'](handleEntityNotFound(_0x12dcac,null))[_0xa135('0x25')](respondWithResult(_0x12dcac,0xc9))[_0xa135('0x48')](handleError(_0x12dcac,null));};exports['removeSound']=function(_0x4a0271,_0x4581e4,_0x1e86e2){return db[_0xa135('0x5c')][_0xa135('0x4f')](function(_0x5274a2){var _0x4161a3;return db[_0xa135('0x30')]['findOne']({'where':{'id':_0x4a0271[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](handleEntityNotFound(_0x4581e4,null))[_0xa135('0x25')](function(_0x42ca6d){if(_0x42ca6d){_0x4161a3=_0x42ca6d;return _0x42ca6d[_0xa135('0x6c')](_0x4a0271['params'][_0xa135('0x6d')]);}})[_0xa135('0x25')](function(_0x2eb3b9){if(_0x2eb3b9){return db[_0xa135('0x62')][_0xa135('0x63')]({'where':{'id':_0x4a0271[_0xa135('0x4a')][_0xa135('0x6d')]},'attributes':['id',_0xa135('0x2d'),_0xa135('0x68'),_0xa135('0x6a'),_0xa135('0x6e')],'raw':!![]});}})[_0xa135('0x25')](function(_0x2947e0){if(_0x2947e0){fs[_0xa135('0x6f')](path[_0xa135('0x51')](_0x4161a3[_0xa135('0x55')],util[_0xa135('0x65')](_0xa135('0x66'),_0x2947e0[_0xa135('0x2d')],_0x2947e0[_0xa135('0x6a')])));return _0x2947e0;}})[_0xa135('0x48')](function(_0x57e4d9){throw new db[(_0xa135('0x5e'))][(_0xa135('0x5f'))](_0x57e4d9[_0xa135('0x60')]);});})[_0xa135('0x25')](handleEntityNotFound(_0x4581e4,null))['then'](respondWithStatusCode(_0x4581e4,0xcc))[_0xa135('0x48')](handleError(_0x4581e4,null));};exports[_0xa135('0x70')]=function(_0x29c3f7,_0x2bab66,_0x1c41f2){var _0x5b0598={};var _0x34eb04={};var _0xc94492;var _0x507bcc;return db[_0xa135('0x30')][_0xa135('0x63')]({'where':{'id':_0x29c3f7[_0xa135('0x4a')]['id']}})[_0xa135('0x25')](handleEntityNotFound(_0x2bab66,null))['then'](function(_0x230ca8){if(_0x230ca8){_0xc94492=_0x230ca8;_0x34eb04[_0xa135('0x34')]=_[_0xa135('0x36')](db[_0xa135('0x62')][_0xa135('0x71')]);_0x34eb04[_0xa135('0x35')]=_[_0xa135('0x36')](_0x29c3f7[_0xa135('0x35')]);_0x34eb04[_0xa135('0x41')]=_[_0xa135('0x37')](_0x34eb04['model'],_0x34eb04[_0xa135('0x35')]);_0x5b0598[_0xa135('0x38')]=_['intersection'](_0x34eb04[_0xa135('0x34')],qs[_0xa135('0x39')](_0x29c3f7[_0xa135('0x35')]['fields']));_0x5b0598[_0xa135('0x38')]=_0x5b0598[_0xa135('0x38')][_0xa135('0x4b')]?_0x5b0598[_0xa135('0x38')]:_0x34eb04[_0xa135('0x34')];_0x5b0598[_0xa135('0x3d')]=qs[_0xa135('0x3e')](_0x29c3f7[_0xa135('0x35')][_0xa135('0x3e')]);_0x5b0598[_0xa135('0x3f')]=qs[_0xa135('0x41')](_['pick'](_0x29c3f7[_0xa135('0x35')],_0x34eb04[_0xa135('0x41')]));if(_0x29c3f7[_0xa135('0x35')][_0xa135('0x42')]){_0x5b0598['where']=_['merge'](_0x5b0598[_0xa135('0x3f')],{'$or':_[_0xa135('0x2f')](_0x5b0598[_0xa135('0x38')],function(_0x3b387a){var _0x52852a={};_0x52852a[_0x3b387a]={'$like':'%'+_0x29c3f7[_0xa135('0x35')][_0xa135('0x42')]+'%'};return _0x52852a;})});}_0x5b0598=_['merge']({},_0x5b0598,_0x29c3f7['options']);return _0xc94492[_0xa135('0x70')](_0x5b0598);}})[_0xa135('0x25')](function(_0x416d69){if(_0x416d69){_0x507bcc=_0x416d69[_0xa135('0x4b')];if(!_0x29c3f7[_0xa135('0x35')][_0xa135('0x3a')]('nolimit')){_0x5b0598[_0xa135('0x1f')]=qs['limit'](_0x29c3f7[_0xa135('0x35')][_0xa135('0x1f')]);_0x5b0598[_0xa135('0x3c')]=qs['offset'](_0x29c3f7[_0xa135('0x35')][_0xa135('0x3c')]);}return _0xc94492[_0xa135('0x70')](_0x5b0598);}})['then'](function(_0x2fe22e){if(_0x2fe22e){return _0x2fe22e?{'count':_0x507bcc,'rows':_0x2fe22e}:null;}})[_0xa135('0x25')](respondWithResult(_0x2bab66,null))[_0xa135('0x48')](handleError(_0x2bab66,null));}; \ No newline at end of file +var _0xc334=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','type','model','keys','query','intersection','attributes','fields','length','sort','filters','filter','where','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','catch','update','body','find','sequelize','mode','files','directory','join','root','create','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','transaction','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','Sound','rawAttributes','order','pick','merge','hasOwnProperty','nolimit','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x28da79,_0x54d56b){var _0x477817=function(_0x3ca4f7){while(--_0x3ca4f7){_0x28da79['push'](_0x28da79['shift']());}};_0x477817(++_0x54d56b);}(_0xc334,0xd7));var _0x4c33=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0xc334[_0x108db1];return _0x16848d;};'use strict';var emlformat=require(_0x4c33('0x0'));var rimraf=require(_0x4c33('0x1'));var zipdir=require(_0x4c33('0x2'));var jsonpatch=require(_0x4c33('0x3'));var rp=require(_0x4c33('0x4'));var moment=require('moment');var BPromise=require(_0x4c33('0x5'));var Mustache=require(_0x4c33('0x6'));var util=require(_0x4c33('0x7'));var path=require(_0x4c33('0x8'));var sox=require(_0x4c33('0x9'));var csv=require(_0x4c33('0xa'));var ejs=require(_0x4c33('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c33('0xc'));var squel=require(_0x4c33('0xd'));var crypto=require('crypto');var jsforce=require(_0x4c33('0xe'));var deskjs=require(_0x4c33('0xf'));var toCsv=require(_0x4c33('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c33('0x10'));var authService=require(_0x4c33('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c33('0x12'));var hardwareService=require(_0x4c33('0x13'));var logger=require('../../config/logger')(_0x4c33('0x14'));var utils=require(_0x4c33('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cbdd,_0x2125ab){_0x2125ab=_0x2125ab||0xcc;return function(_0x3dc341){if(_0x3dc341){return _0x31cbdd[_0x4c33('0x16')](_0x2125ab);}return _0x31cbdd[_0x4c33('0x17')](_0x2125ab)['end']();};}function respondWithResult(_0x5615ad,_0x63401c){_0x63401c=_0x63401c||0xc8;return function(_0x568040){if(_0x568040){return _0x5615ad['status'](_0x63401c)[_0x4c33('0x18')](_0x568040);}};}function respondWithFilteredResult(_0x2c2f77,_0x1e6439){return function(_0x25e09e){if(_0x25e09e){var _0x481a4e=typeof _0x1e6439[_0x4c33('0x19')]===_0x4c33('0x1a')&&typeof _0x1e6439[_0x4c33('0x1b')]===_0x4c33('0x1a');var _0x11a88f=_0x25e09e['count'];var _0x1bea88=_0x481a4e?0x0:_0x1e6439[_0x4c33('0x19')];var _0x583a3b=_0x481a4e?_0x25e09e[_0x4c33('0x1c')]:_0x1e6439['offset']+_0x1e6439[_0x4c33('0x1b')];var _0x25ce54;if(_0x583a3b>=_0x11a88f){_0x583a3b=_0x11a88f;_0x25ce54=0xc8;}else{_0x25ce54=0xce;}_0x2c2f77['status'](_0x25ce54);return _0x2c2f77[_0x4c33('0x1d')]('Content-Range',_0x1bea88+'-'+_0x583a3b+'/'+_0x11a88f)[_0x4c33('0x18')](_0x25e09e);}return null;};}function patchUpdates(_0x32c0d3){return function(_0x468775){try{jsonpatch['apply'](_0x468775,_0x32c0d3,!![]);}catch(_0x1aac6c){return BPromise['reject'](_0x1aac6c);}return _0x468775[_0x4c33('0x1e')]();};}function saveUpdates(_0x45d64f,_0x24f23c){return function(_0x381eea){if(_0x381eea){return _0x381eea['update'](_0x45d64f)['then'](function(_0x14ab36){return _0x14ab36;});}return null;};}function removeEntity(_0x481dce,_0x31a79d){return function(_0x28b41d){if(_0x28b41d){return _0x28b41d[_0x4c33('0x1f')]()[_0x4c33('0x20')](function(){var _0x18ae15=_0x28b41d[_0x4c33('0x21')]({'plain':!![]});var _0x22e568=_0x4c33('0x22');return db[_0x4c33('0x23')][_0x4c33('0x1f')]({'where':{'type':_0x22e568,'resourceId':_0x18ae15['id']}})[_0x4c33('0x20')](function(){return _0x28b41d;});})[_0x4c33('0x20')](function(){_0x481dce[_0x4c33('0x17')](0xcc)[_0x4c33('0x24')]();});}};}function handleEntityNotFound(_0x4b6219,_0x23c7e5){return function(_0x5bf3ed){if(!_0x5bf3ed){_0x4b6219[_0x4c33('0x16')](0x194);}return _0x5bf3ed;};}function handleError(_0x115aeb,_0x5f1fc9){_0x5f1fc9=_0x5f1fc9||0x1f4;return function(_0x49d67c){logger[_0x4c33('0x25')](_0x49d67c[_0x4c33('0x26')]);if(_0x49d67c[_0x4c33('0x27')]){delete _0x49d67c[_0x4c33('0x27')];}_0x115aeb[_0x4c33('0x17')](_0x5f1fc9)[_0x4c33('0x28')](_0x49d67c);};}exports[_0x4c33('0x29')]=function(_0x14693e,_0x27d077){var _0x269227={},_0x4e03c2={},_0x2f2a1b={'count':0x0,'rows':[]};var _0x2cb108=_[_0x4c33('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x139ad6){return{'name':_0x139ad6['fieldName'],'type':_0x139ad6[_0x4c33('0x2b')]['key']};});_0x4e03c2[_0x4c33('0x2c')]=_['map'](_0x2cb108,_0x4c33('0x27'));_0x4e03c2['query']=_[_0x4c33('0x2d')](_0x14693e[_0x4c33('0x2e')]);_0x4e03c2['filters']=_[_0x4c33('0x2f')](_0x4e03c2[_0x4c33('0x2c')],_0x4e03c2[_0x4c33('0x2e')]);_0x269227[_0x4c33('0x30')]=_[_0x4c33('0x2f')](_0x4e03c2['model'],qs[_0x4c33('0x31')](_0x14693e[_0x4c33('0x2e')][_0x4c33('0x31')]));_0x269227['attributes']=_0x269227[_0x4c33('0x30')][_0x4c33('0x32')]?_0x269227[_0x4c33('0x30')]:_0x4e03c2[_0x4c33('0x2c')];if(!_0x14693e[_0x4c33('0x2e')]['hasOwnProperty']('nolimit')){_0x269227[_0x4c33('0x1b')]=qs[_0x4c33('0x1b')](_0x14693e[_0x4c33('0x2e')][_0x4c33('0x1b')]);_0x269227[_0x4c33('0x19')]=qs[_0x4c33('0x19')](_0x14693e[_0x4c33('0x2e')]['offset']);}_0x269227['order']=qs['sort'](_0x14693e[_0x4c33('0x2e')][_0x4c33('0x33')]);delete _0x14693e['query'][_0x4c33('0x33')];_0x269227['where']=qs['filters'](_['pick'](_0x14693e['query'],_0x4e03c2[_0x4c33('0x34')]),_0x2cb108);if(_0x14693e['query'][_0x4c33('0x35')]){_0x269227[_0x4c33('0x36')]=_['merge'](_0x269227['where'],{'$or':_[_0x4c33('0x2a')](_0x2cb108,function(_0x1c53d0){if(_0x1c53d0['type']!==_0x4c33('0x37')){var _0x9200c6={};_0x9200c6[_0x1c53d0[_0x4c33('0x27')]]={'$like':'%'+_0x14693e[_0x4c33('0x2e')]['filter']+'%'};return _0x9200c6;}})});}_0x269227=_['merge']({},_0x269227,_0x14693e[_0x4c33('0x38')]);var _0x5900a5={'where':_0x269227[_0x4c33('0x36')]};return db[_0x4c33('0x39')][_0x4c33('0x1c')](_0x5900a5)[_0x4c33('0x20')](function(_0x591ec2){_0x2f2a1b['count']=_0x591ec2;if(_0x14693e[_0x4c33('0x2e')][_0x4c33('0x3a')]){_0x269227[_0x4c33('0x3b')]=[{'all':!![]}];}return db[_0x4c33('0x39')][_0x4c33('0x3c')](_0x269227);})[_0x4c33('0x20')](function(_0x32963d){_0x2f2a1b[_0x4c33('0x3d')]=_0x32963d;return _0x2f2a1b;})['then'](respondWithFilteredResult(_0x27d077,_0x269227))['catch'](handleError(_0x27d077,null));};exports[_0x4c33('0x3e')]=function(_0x4030b1,_0x199dae){var _0xff31c5={'raw':![],'where':{'id':_0x4030b1[_0x4c33('0x3f')]['id']}},_0x2738d4={};_0x2738d4[_0x4c33('0x2c')]=_[_0x4c33('0x2d')](db['VoiceMusicOnHold']['rawAttributes']);_0x2738d4[_0x4c33('0x2e')]=_[_0x4c33('0x2d')](_0x4030b1['query']);_0x2738d4[_0x4c33('0x34')]=_[_0x4c33('0x2f')](_0x2738d4[_0x4c33('0x2c')],_0x2738d4[_0x4c33('0x2e')]);_0xff31c5[_0x4c33('0x30')]=_['intersection'](_0x2738d4[_0x4c33('0x2c')],qs['fields'](_0x4030b1[_0x4c33('0x2e')][_0x4c33('0x31')]));_0xff31c5[_0x4c33('0x30')]=_0xff31c5[_0x4c33('0x30')][_0x4c33('0x32')]?_0xff31c5[_0x4c33('0x30')]:_0x2738d4[_0x4c33('0x2c')];if(_0x4030b1[_0x4c33('0x2e')]['includeAll']){_0xff31c5['include']=[{'all':!![]}];}_0xff31c5=_['merge']({},_0xff31c5,_0x4030b1[_0x4c33('0x38')]);return db[_0x4c33('0x39')]['find'](_0xff31c5)[_0x4c33('0x20')](handleEntityNotFound(_0x199dae,null))[_0x4c33('0x20')](respondWithResult(_0x199dae,null))[_0x4c33('0x40')](handleError(_0x199dae,null));};exports[_0x4c33('0x41')]=function(_0x1ec536,_0x143687){if(_0x1ec536[_0x4c33('0x42')]['id']){delete _0x1ec536[_0x4c33('0x42')]['id'];}return db[_0x4c33('0x39')][_0x4c33('0x43')]({'where':{'id':_0x1ec536['params']['id']}})[_0x4c33('0x20')](handleEntityNotFound(_0x143687,null))['then'](saveUpdates(_0x1ec536['body'],null))[_0x4c33('0x20')](respondWithResult(_0x143687,null))[_0x4c33('0x40')](handleError(_0x143687,null));};exports['create']=function(_0x5794a9,_0x28e639,_0x3d5bbc){return db[_0x4c33('0x44')]['transaction'](function(_0x5dafab){if(_0x5794a9[_0x4c33('0x42')][_0x4c33('0x45')]===_0x4c33('0x46')){_0x5794a9['body'][_0x4c33('0x47')]=path[_0x4c33('0x48')](config[_0x4c33('0x49')],'server/files/moh',_0x5794a9['body']['name']);}return db[_0x4c33('0x39')][_0x4c33('0x4a')](_0x5794a9[_0x4c33('0x42')],{'transaction':_0x5dafab})[_0x4c33('0x20')](function(_0x528dce){if(_0x5794a9[_0x4c33('0x42')][_0x4c33('0x45')]===_0x4c33('0x46')){fs['mkdirSync'](_0x528dce['directory'],parseInt(_0x4c33('0x4b'),0x8));}var _0x2dec1a=_0x5794a9[_0x4c33('0x4c')]['get']({'plain':!![]});if(!_0x2dec1a)throw new Error(_0x4c33('0x4d'));if(_0x2dec1a[_0x4c33('0x4e')]===_0x4c33('0x4c')){var _0x90375c=_0x528dce['get']({'plain':!![]});return db[_0x4c33('0x4f')][_0x4c33('0x43')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2dec1a[_0x4c33('0x50')]},'raw':!![]})['then'](function(_0x48745b){if(_0x48745b&&_0x48745b[_0x4c33('0x51')]===0x0){return db[_0x4c33('0x23')]['create']({'name':_0x90375c[_0x4c33('0x27')],'resourceId':_0x90375c['id'],'type':_0x48745b[_0x4c33('0x27')],'sectionId':_0x48745b['id']},{})[_0x4c33('0x20')](function(){return _0x528dce;});}else{return _0x528dce;}})[_0x4c33('0x40')](function(_0x721a8e){logger[_0x4c33('0x25')](_0x4c33('0x52'),_0x721a8e);});}return _0x528dce;});})[_0x4c33('0x20')](respondWithResult(_0x28e639,0xc9))[_0x4c33('0x40')](handleError(_0x28e639,null));};exports[_0x4c33('0x1f')]=function(_0x53cf62,_0x4b41b7,_0x205fea){var _0x43a574;return db[_0x4c33('0x39')][_0x4c33('0x43')]({'where':{'id':_0x53cf62['params']['id']}})[_0x4c33('0x20')](function(_0x244f65){if(_0x244f65){return db[_0x4c33('0x44')]['transaction'](function(_0x276c62){return _0x244f65[_0x4c33('0x1f')]({'transaction':_0x276c62,'raw':!![]})[_0x4c33('0x20')](function(_0x23f97d){if(_0x23f97d['directory']){fs[_0x4c33('0x53')](_0x23f97d[_0x4c33('0x47')])[_0x4c33('0x54')](function(_0x10bd3e){fs[_0x4c33('0x55')](path[_0x4c33('0x48')](_0x23f97d['directory'],_0x10bd3e));});fs['rmdirSync'](_0x23f97d[_0x4c33('0x47')]);}return _0x23f97d;});})[_0x4c33('0x40')](function(_0x406720){throw new db[(_0x4c33('0x56'))][(_0x4c33('0x57'))](_0x406720[_0x4c33('0x58')]);});}})['then'](handleEntityNotFound(_0x4b41b7,null))[_0x4c33('0x20')](removeEntity(_0x4b41b7,null))[_0x4c33('0x40')](handleError(_0x4b41b7,null));};exports[_0x4c33('0x59')]=function(_0x5d3aac,_0xdc3f65,_0x539923){return db[_0x4c33('0x44')][_0x4c33('0x5a')](function(_0x3ecf65){var _0x4df1db;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5d3aac[_0x4c33('0x3f')]['id']}})[_0x4c33('0x20')](function(_0x14a164){if(_0x14a164){_0x4df1db=_0x14a164;return _0x14a164['addSound'](_0x5d3aac[_0x4c33('0x42')]['id'],{'transaction':_0x3ecf65});}})[_0x4c33('0x20')](function(_0x297be8){if(_0x297be8){return db['Sound'][_0x4c33('0x5b')]({'where':{'id':_0x5d3aac[_0x4c33('0x42')]['id']},'attributes':['id','name',_0x4c33('0x5c'),_0x4c33('0x5d'),_0x4c33('0x5e')],'raw':!![]});}})[_0x4c33('0x20')](function(_0x150ede){if(_0x150ede){var _0x42324b=path[_0x4c33('0x48')](config[_0x4c33('0x49')],_0x4c33('0x5f'),util[_0x4c33('0x60')](_0x4c33('0x61'),path[_0x4c33('0x62')](_0x150ede[_0x4c33('0x5c')],path[_0x4c33('0x63')](_0x150ede[_0x4c33('0x5c')])),_0x150ede[_0x4c33('0x5d')]));var _0x25e5e7=path['join'](config[_0x4c33('0x49')],'server/files/moh',_0x4df1db[_0x4c33('0x27')],util[_0x4c33('0x60')]('%s.%s',_0x150ede[_0x4c33('0x27')],_0x150ede[_0x4c33('0x5d')]));fs[_0x4c33('0x64')](_0x42324b,_0x25e5e7);return _0x150ede;}})[_0x4c33('0x40')](function(_0xb70eaf){throw new db['Sequelize']['ValidationError'](_0xb70eaf[_0x4c33('0x58')]);});})[_0x4c33('0x20')](handleEntityNotFound(_0xdc3f65,null))['then'](respondWithResult(_0xdc3f65,0xc9))['catch'](handleError(_0xdc3f65,null));};exports[_0x4c33('0x65')]=function(_0x378f1a,_0xf89aa,_0x1df024){return db['sequelize'][_0x4c33('0x5a')](function(_0x4ba5d5){var _0xa90969;return db['VoiceMusicOnHold'][_0x4c33('0x5b')]({'where':{'id':_0x378f1a['params']['id']}})['then'](handleEntityNotFound(_0xf89aa,null))[_0x4c33('0x20')](function(_0x8d878b){if(_0x8d878b){_0xa90969=_0x8d878b;return _0x8d878b[_0x4c33('0x65')](_0x378f1a['params'][_0x4c33('0x66')]);}})[_0x4c33('0x20')](function(_0x13f40e){if(_0x13f40e){return db[_0x4c33('0x67')][_0x4c33('0x5b')]({'where':{'id':_0x378f1a[_0x4c33('0x3f')][_0x4c33('0x66')]},'attributes':['id',_0x4c33('0x27'),_0x4c33('0x5c'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x4c6cbc){if(_0x4c6cbc){fs['unlinkSync'](path[_0x4c33('0x48')](_0xa90969[_0x4c33('0x47')],util[_0x4c33('0x60')](_0x4c33('0x61'),_0x4c6cbc[_0x4c33('0x27')],_0x4c6cbc[_0x4c33('0x5d')])));return _0x4c6cbc;}})['catch'](function(_0x5efada){throw new db['Sequelize'][(_0x4c33('0x57'))](_0x5efada[_0x4c33('0x58')]);});})[_0x4c33('0x20')](handleEntityNotFound(_0xf89aa,null))[_0x4c33('0x20')](respondWithStatusCode(_0xf89aa,0xcc))[_0x4c33('0x40')](handleError(_0xf89aa,null));};exports['getSounds']=function(_0x2f037a,_0x25dea3,_0x466be7){var _0x17a6b9={};var _0x8bd617={};var _0xc47232;var _0x43020b;return db[_0x4c33('0x39')]['findOne']({'where':{'id':_0x2f037a['params']['id']}})[_0x4c33('0x20')](handleEntityNotFound(_0x25dea3,null))['then'](function(_0x533095){if(_0x533095){_0xc47232=_0x533095;_0x8bd617[_0x4c33('0x2c')]=_['keys'](db[_0x4c33('0x67')][_0x4c33('0x68')]);_0x8bd617[_0x4c33('0x2e')]=_[_0x4c33('0x2d')](_0x2f037a['query']);_0x8bd617[_0x4c33('0x34')]=_['intersection'](_0x8bd617['model'],_0x8bd617[_0x4c33('0x2e')]);_0x17a6b9[_0x4c33('0x30')]=_[_0x4c33('0x2f')](_0x8bd617[_0x4c33('0x2c')],qs[_0x4c33('0x31')](_0x2f037a[_0x4c33('0x2e')][_0x4c33('0x31')]));_0x17a6b9[_0x4c33('0x30')]=_0x17a6b9['attributes']['length']?_0x17a6b9[_0x4c33('0x30')]:_0x8bd617['model'];_0x17a6b9[_0x4c33('0x69')]=qs['sort'](_0x2f037a[_0x4c33('0x2e')][_0x4c33('0x33')]);_0x17a6b9[_0x4c33('0x36')]=qs['filters'](_[_0x4c33('0x6a')](_0x2f037a[_0x4c33('0x2e')],_0x8bd617[_0x4c33('0x34')]));if(_0x2f037a['query'][_0x4c33('0x35')]){_0x17a6b9[_0x4c33('0x36')]=_[_0x4c33('0x6b')](_0x17a6b9['where'],{'$or':_[_0x4c33('0x2a')](_0x17a6b9[_0x4c33('0x30')],function(_0x627211){var _0x337b47={};_0x337b47[_0x627211]={'$like':'%'+_0x2f037a['query'][_0x4c33('0x35')]+'%'};return _0x337b47;})});}_0x17a6b9=_[_0x4c33('0x6b')]({},_0x17a6b9,_0x2f037a[_0x4c33('0x38')]);return _0xc47232['getSounds'](_0x17a6b9);}})[_0x4c33('0x20')](function(_0x5c21a5){if(_0x5c21a5){_0x43020b=_0x5c21a5['length'];if(!_0x2f037a['query'][_0x4c33('0x6c')](_0x4c33('0x6d'))){_0x17a6b9[_0x4c33('0x1b')]=qs[_0x4c33('0x1b')](_0x2f037a['query'][_0x4c33('0x1b')]);_0x17a6b9['offset']=qs[_0x4c33('0x19')](_0x2f037a[_0x4c33('0x2e')]['offset']);}return _0xc47232[_0x4c33('0x6e')](_0x17a6b9);}})[_0x4c33('0x20')](function(_0x42f93e){if(_0x42f93e){return _0x42f93e?{'count':_0x43020b,'rows':_0x42f93e}:null;}})['then'](respondWithResult(_0x25dea3,null))['catch'](handleError(_0x25dea3,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 836e62b..47bf847 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 _0x1aa4=['VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x372c7f,_0xa064de){var _0x3b7370=function(_0x1ec118){while(--_0x1ec118){_0x372c7f['push'](_0x372c7f['shift']());}};_0x3b7370(++_0xa064de);}(_0x1aa4,0xaa));var _0x41aa=function(_0x3a8055,_0xdb678b){_0x3a8055=_0x3a8055-0x0;var _0x1c3fe4=_0x1aa4[_0x3a8055];return _0x1c3fe4;};'use strict';var _=require(_0x41aa('0x0'));var util=require(_0x41aa('0x1'));var logger=require('../../config/logger')(_0x41aa('0x2'));var moment=require(_0x41aa('0x3'));var BPromise=require(_0x41aa('0x4'));var rp=require(_0x41aa('0x5'));var fs=require('fs');var path=require(_0x41aa('0x6'));var rimraf=require(_0x41aa('0x7'));var config=require(_0x41aa('0x8'));var attributes=require(_0x41aa('0x9'));module[_0x41aa('0xa')]=function(_0x24f1ee,_0x56df6c){return _0x24f1ee[_0x41aa('0xb')](_0x41aa('0xc'),attributes,{'tableName':_0x41aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bd=['VoiceMusicOnHold','voice_musiconhold','../../config/logger','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x534547,_0x2ff79a){var _0x505117=function(_0x2a7bdf){while(--_0x2a7bdf){_0x534547['push'](_0x534547['shift']());}};_0x505117(++_0x2ff79a);}(_0x44bd,0x89));var _0xd44b=function(_0x5a6f62,_0x15d15e){_0x5a6f62=_0x5a6f62-0x0;var _0x270441=_0x44bd[_0x5a6f62];return _0x270441;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd44b('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd44b('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd44b('0x2'));var config=require(_0xd44b('0x3'));var attributes=require(_0xd44b('0x4'));module[_0xd44b('0x5')]=function(_0x201738,_0x513b36){return _0x201738[_0xd44b('0x6')](_0xd44b('0x7'),attributes,{'tableName':_0xd44b('0x8'),'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 0d32d2f..9f1a22d 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1b777e,_0x4b2526){var _0x3f3011=function(_0x12a0e4){while(--_0x12a0e4){_0x1b777e['push'](_0x1b777e['shift']());}};_0x3f3011(++_0x4b2526);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x3ced0e,_0xd5882f){var _0x17dcd3=function(_0xbf45f3){while(--_0xbf45f3){_0x3ced0e['push'](_0x3ced0e['shift']());}};_0x17dcd3(++_0xd5882f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xcb91[_0x56e0e8];return _0x2dab50;};'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')]('VoiceMusicOnHold,\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/voicePrefix/index.js b/server/api/voicePrefix/index.js index cd7414b..d98bf15 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 _0x8832=['./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','/:id/teams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x49739d,_0x388796){var _0x5a4f98=function(_0x45b17d){while(--_0x45b17d){_0x49739d['push'](_0x49739d['shift']());}};_0x5a4f98(++_0x388796);}(_0x8832,0x1f4));var _0x2883=function(_0xdc7bb5,_0x5bbb57){_0xdc7bb5=_0xdc7bb5-0x0;var _0x27565d=_0x8832[_0xdc7bb5];return _0x27565d;};'use strict';var multer=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2883('0x2'));var router=express[_0x2883('0x3')]();var fs_extra=require(_0x2883('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2883('0x5'));var config=require('../../config/environment');var controller=require(_0x2883('0x6'));router[_0x2883('0x7')]('/',auth[_0x2883('0x8')](),controller['index']);router[_0x2883('0x7')]('/describe',auth[_0x2883('0x8')](),controller[_0x2883('0x9')]);router['get']('/:id',auth[_0x2883('0x8')](),controller[_0x2883('0xa')]);router[_0x2883('0x7')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller['getAgents']);router['get'](_0x2883('0xc'),auth['isAuthenticated'](),controller['getTeams']);router['post']('/',auth[_0x2883('0x8')](),controller['create']);router[_0x2883('0xd')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller[_0x2883('0xe')]);router[_0x2883('0xd')](_0x2883('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0x2883('0xf')](_0x2883('0x10'),auth['isAuthenticated'](),controller[_0x2883('0x11')]);router[_0x2883('0x12')](_0x2883('0x10'),auth[_0x2883('0x8')](),controller[_0x2883('0x13')]);router[_0x2883('0x12')](_0x2883('0xb'),auth[_0x2883('0x8')](),controller['removeAgents']);router[_0x2883('0x12')](_0x2883('0xc'),auth[_0x2883('0x8')](),controller[_0x2883('0x14')]);module[_0x2883('0x15')]=router; \ No newline at end of file +var _0x3c2a=['show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','/:id','update','delete','destroy','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x341ca2,_0x62cd5){var _0x3b347f=function(_0x87028f){while(--_0x87028f){_0x341ca2['push'](_0x341ca2['shift']());}};_0x3b347f(++_0x62cd5);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x1ee0c6,_0x22b827){_0x1ee0c6=_0x1ee0c6-0x0;var _0x5ee39f=_0x3c2a[_0x1ee0c6];return _0x5ee39f;};'use strict';var multer=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var path=require('path');var timeout=require(_0xa3c2('0x2'));var express=require('express');var router=express[_0xa3c2('0x3')]();var fs_extra=require(_0xa3c2('0x4'));var auth=require(_0xa3c2('0x5'));var interaction=require(_0xa3c2('0x6'));var config=require(_0xa3c2('0x7'));var controller=require(_0xa3c2('0x8'));router[_0xa3c2('0x9')]('/',auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xb')]);router[_0xa3c2('0x9')](_0xa3c2('0xc'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xd')]);router[_0xa3c2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa3c2('0xe')]);router[_0xa3c2('0x9')](_0xa3c2('0xf'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x10')]);router['get'](_0xa3c2('0x11'),auth['isAuthenticated'](),controller[_0xa3c2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa3c2('0x13')]);router[_0xa3c2('0x14')]('/:id/users',auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x15')]);router[_0xa3c2('0x14')](_0xa3c2('0x11'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x16')]);router['put'](_0xa3c2('0x17'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x18')]);router[_0xa3c2('0x19')](_0xa3c2('0x17'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x1a')]);router[_0xa3c2('0x19')](_0xa3c2('0xf'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x1b')]);router[_0xa3c2('0x19')](_0xa3c2('0x11'),auth['isAuthenticated'](),controller['removeTeams']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a4d40a1..13d2817 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 _0x0e83=['system-','STRING','sequelize','exports','name'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x0e83,0xe8));var _0x30e8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0e83[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x30e8('0x0'));module[_0x30e8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x30e8('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x16050c){return _0x30e8('0x3')+this['getDataValue'](_0x30e8('0x2'))+'-';}},'description':{'type':Sequelize[_0x30e8('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xca43=['INTEGER','exports','name','system-','getDataValue','STRING'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0xca43,0x151));var _0x3ca4=function(_0xd0698c,_0x214d84){_0xd0698c=_0xd0698c-0x0;var _0xfbd42a=_0xca43[_0xd0698c];return _0xfbd42a;};'use strict';var Sequelize=require('sequelize');module[_0x3ca4('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ca4('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b1104){return _0x3ca4('0x2')+this[_0x3ca4('0x3')](_0x3ca4('0x1'))+'-';}},'description':{'type':Sequelize[_0x3ca4('0x4')]},'callerIdAll':{'type':Sequelize[_0x3ca4('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x3ca4('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3ffa620..57bc75e 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 _0xab40=['PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','omit','body','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','error','stack','name','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','params','length','find','describe','create','sequelize','transaction','get','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','description','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll'];(function(_0x2f9005,_0x2a4281){var _0x1ef28a=function(_0x51bfdb){while(--_0x51bfdb){_0x2f9005['push'](_0x2f9005['shift']());}};_0x1ef28a(++_0x2a4281);}(_0xab40,0xcd));var _0x0ab4=function(_0x2f74aa,_0x102479){_0x2f74aa=_0x2f74aa-0x0;var _0xe303dd=_0xab40[_0x2f74aa];return _0xe303dd;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ab4('0x15')]=_[_0x0ab4('0x16')](config[_0x0ab4('0x15')],{'host':_0x0ab4('0x17'),'port':0x18eb});var socket=require(_0x0ab4('0x18'))(new Redis(config[_0x0ab4('0x15')]));require(_0x0ab4('0x19'))[_0x0ab4('0x1a')](socket);function respondWithStatusCode(_0x3cb1df,_0x2033c8){_0x2033c8=_0x2033c8||0xcc;return function(_0x216a17){if(_0x216a17){return _0x3cb1df[_0x0ab4('0x1b')](_0x2033c8);}return _0x3cb1df[_0x0ab4('0x1c')](_0x2033c8)[_0x0ab4('0x1d')]();};}function respondWithResult(_0x2a83a8,_0x2403db){_0x2403db=_0x2403db||0xc8;return function(_0x283b15){if(_0x283b15){return _0x2a83a8[_0x0ab4('0x1c')](_0x2403db)['json'](_0x283b15);}};}function respondWithFilteredResult(_0x5000d4,_0x49634f){return function(_0x17422f){if(_0x17422f){var _0x30d5df=typeof _0x49634f[_0x0ab4('0x1e')]==='undefined'&&typeof _0x49634f[_0x0ab4('0x1f')]===_0x0ab4('0x20');var _0x212ebd=_0x17422f[_0x0ab4('0x21')];var _0x4e7852=_0x30d5df?0x0:_0x49634f['offset'];var _0xdb0797=_0x30d5df?_0x17422f['count']:_0x49634f[_0x0ab4('0x1e')]+_0x49634f[_0x0ab4('0x1f')];var _0x5bb1d0;if(_0xdb0797>=_0x212ebd){_0xdb0797=_0x212ebd;_0x5bb1d0=0xc8;}else{_0x5bb1d0=0xce;}_0x5000d4[_0x0ab4('0x1c')](_0x5bb1d0);return _0x5000d4[_0x0ab4('0x22')](_0x0ab4('0x23'),_0x4e7852+'-'+_0xdb0797+'/'+_0x212ebd)[_0x0ab4('0x24')](_0x17422f);}return null;};}function patchUpdates(_0x12d06d){return function(_0x52d7d3){try{jsonpatch['apply'](_0x52d7d3,_0x12d06d,!![]);}catch(_0x24b929){return BPromise[_0x0ab4('0x25')](_0x24b929);}return _0x52d7d3[_0x0ab4('0x26')]();};}function saveUpdates(_0x13c882,_0x4e4b80){return function(_0x42d2dd){if(_0x42d2dd){return _0x42d2dd[_0x0ab4('0x27')](_0x13c882)[_0x0ab4('0x28')](function(_0x4ea9aa){return _0x4ea9aa;});}return null;};}function removeEntity(_0x4c5caf,_0x176ff1){return function(_0x1c132c){if(_0x1c132c){return _0x1c132c[_0x0ab4('0x29')]()['then'](function(){var _0x519b23=_0x1c132c['get']({'plain':!![]});var _0x19ecc6='VoicePrefixes';return db[_0x0ab4('0x2a')][_0x0ab4('0x29')]({'where':{'type':_0x19ecc6,'resourceId':_0x519b23['id']}})['then'](function(){return _0x1c132c;});})['then'](function(){_0x4c5caf['status'](0xcc)[_0x0ab4('0x1d')]();});}};}function handleEntityNotFound(_0x183bac,_0x1cfdad){return function(_0x3f61cb){if(!_0x3f61cb){_0x183bac[_0x0ab4('0x1b')](0x194);}return _0x3f61cb;};}function handleError(_0x588e0d,_0x5b55c1){_0x5b55c1=_0x5b55c1||0x1f4;return function(_0x580d56){logger[_0x0ab4('0x2b')](_0x580d56[_0x0ab4('0x2c')]);if(_0x580d56[_0x0ab4('0x2d')]){delete _0x580d56[_0x0ab4('0x2d')];}_0x588e0d[_0x0ab4('0x1c')](_0x5b55c1)['send'](_0x580d56);};}exports['index']=function(_0x285a29,_0xe6682){var _0x361f7c={},_0x4819be={},_0x48e430={'count':0x0,'rows':[]};var _0x1b19db=_['map'](db[_0x0ab4('0x2e')][_0x0ab4('0x2f')],function(_0x263e5a){return{'name':_0x263e5a[_0x0ab4('0x30')],'type':_0x263e5a[_0x0ab4('0x31')][_0x0ab4('0x32')]};});_0x4819be['model']=_[_0x0ab4('0x33')](_0x1b19db,_0x0ab4('0x2d'));_0x4819be[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x285a29['query']);_0x4819be['filters']=_[_0x0ab4('0x36')](_0x4819be[_0x0ab4('0x37')],_0x4819be[_0x0ab4('0x34')]);_0x361f7c['attributes']=_['intersection'](_0x4819be['model'],qs[_0x0ab4('0x38')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x361f7c['attributes']=_0x361f7c['attributes']['length']?_0x361f7c[_0x0ab4('0x39')]:_0x4819be[_0x0ab4('0x37')];if(!_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x361f7c[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x361f7c[_0x0ab4('0x1e')]=qs['offset'](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}_0x361f7c[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x361f7c[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x285a29[_0x0ab4('0x34')],_0x4819be[_0x0ab4('0x3f')]),_0x1b19db);if(_0x285a29[_0x0ab4('0x34')]['filter']){_0x361f7c[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x361f7c[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x1b19db,function(_0x589b46){if(_0x589b46[_0x0ab4('0x31')]!=='VIRTUAL'){var _0x43e5ba={};_0x43e5ba[_0x589b46[_0x0ab4('0x2d')]]={'$like':'%'+_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x42')]+'%'};return _0x43e5ba;}})});}_0x361f7c=_[_0x0ab4('0x41')]({},_0x361f7c,_0x285a29[_0x0ab4('0x43')]);var _0x5815d1={'where':_0x361f7c[_0x0ab4('0x3e')]};return db[_0x0ab4('0x2e')][_0x0ab4('0x21')](_0x5815d1)['then'](function(_0x395e0b){_0x48e430[_0x0ab4('0x21')]=_0x395e0b;if(_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x44')]){_0x361f7c[_0x0ab4('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x361f7c);})['then'](function(_0x2f54dd){_0x48e430[_0x0ab4('0x46')]=_0x2f54dd;return _0x48e430;})['then'](respondWithFilteredResult(_0xe6682,_0x361f7c))[_0x0ab4('0x47')](handleError(_0xe6682,null));};exports['show']=function(_0x2d1d87,_0x562262){var _0x365be1={'raw':![],'where':{'id':_0x2d1d87[_0x0ab4('0x48')]['id']}},_0x300fd8={};_0x300fd8[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x2e')]['rawAttributes']);_0x300fd8[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x2d1d87[_0x0ab4('0x34')]);_0x300fd8[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x300fd8[_0x0ab4('0x37')],_0x300fd8['query']);_0x365be1[_0x0ab4('0x39')]=_['intersection'](_0x300fd8[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x2d1d87[_0x0ab4('0x34')]['fields']));_0x365be1[_0x0ab4('0x39')]=_0x365be1[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x365be1[_0x0ab4('0x39')]:_0x300fd8[_0x0ab4('0x37')];if(_0x2d1d87[_0x0ab4('0x34')]['includeAll']){_0x365be1[_0x0ab4('0x45')]=[{'all':!![]}];}_0x365be1=_[_0x0ab4('0x41')]({},_0x365be1,_0x2d1d87[_0x0ab4('0x43')]);return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')](_0x365be1)[_0x0ab4('0x28')](handleEntityNotFound(_0x562262,null))[_0x0ab4('0x28')](respondWithResult(_0x562262,null))[_0x0ab4('0x47')](handleError(_0x562262,null));};exports[_0x0ab4('0x29')]=function(_0x24bb13,_0x1a9675){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x24bb13['params']['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0x1a9675,null))[_0x0ab4('0x28')](removeEntity(_0x1a9675,null))['catch'](handleError(_0x1a9675,null));};exports[_0x0ab4('0x4b')]=function(_0x48efa4,_0x53d66f){return db[_0x0ab4('0x2e')][_0x0ab4('0x4b')]()[_0x0ab4('0x28')](respondWithResult(_0x53d66f,null))['catch'](handleError(_0x53d66f,null));};exports[_0x0ab4('0x4c')]=function(_0xb3bd1e,_0xeddaa1){var _0xaed2d;return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1eea3b){return db['VoicePrefix'][_0x0ab4('0x4c')](_0xb3bd1e['body'],{'transaction':_0x1eea3b})[_0x0ab4('0x28')](function(_0x55c073){_0xaed2d=_0x55c073[_0x0ab4('0x4f')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xaed2d[_0x0ab4('0x50')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x433346){return createVoicePrefixExtensions(_0xaed2d,_0x433346,_0x1eea3b);});});})[_0x0ab4('0x28')](function(){var _0x4e2db5=_0xb3bd1e[_0x0ab4('0x51')][_0x0ab4('0x4f')]({'plain':!![]});if(!_0x4e2db5)throw new Error(_0x0ab4('0x52'));if(_0x4e2db5[_0x0ab4('0x53')]===_0x0ab4('0x51')){var _0x2354fa=_0xaed2d;return db[_0x0ab4('0x54')][_0x0ab4('0x4a')]({'where':{'name':_0x0ab4('0x55'),'userProfileId':_0x4e2db5[_0x0ab4('0x56')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x355ba8){if(_0x355ba8&&_0x355ba8[_0x0ab4('0x57')]===0x0){return db[_0x0ab4('0x2a')][_0x0ab4('0x4c')]({'name':_0x2354fa[_0x0ab4('0x2d')],'resourceId':_0x2354fa['id'],'type':_0x355ba8[_0x0ab4('0x2d')],'sectionId':_0x355ba8['id']},{})[_0x0ab4('0x28')](function(){return _0xaed2d;});}else{return _0xaed2d;}})[_0x0ab4('0x47')](function(_0x59705f){logger[_0x0ab4('0x2b')](_0x0ab4('0x58'),_0x59705f);throw _0x59705f;});}return _0xaed2d;})[_0x0ab4('0x28')](respondWithResult(_0xeddaa1,null))[_0x0ab4('0x47')](handleError(_0xeddaa1,null));};function Extension(_0x32e38c,_0x3bcb90,_0x387619,_0x251e4d){this['context']=_0x0ab4('0x59');this[_0x0ab4('0x5a')]=_0x32e38c;this['app']=_0x387619;this['type']=_0x0ab4('0x5b');this[_0x0ab4('0x5c')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3bcb90;this[_0x0ab4('0x5d')]=_0x251e4d;}function createVoicePrefixExtensions(_0x5b4bbe,_0x597d26,_0x427b51){return new BPromise(function(_0x3cdedf,_0x12dccd){var _0x42cbcb=new Extension(formatPrefixName(_0x5b4bbe[_0x0ab4('0x5e')]),0x1,_0x0ab4('0x5f'),_0x0ab4('0x60'));_0x42cbcb['VoicePrefixId']=_0x5b4bbe['id'];return db[_0x0ab4('0x61')][_0x0ab4('0x4c')](_0x42cbcb,{'transaction':_0x427b51})[_0x0ab4('0x28')](function(_0x406df2){var _0x194733=_0x406df2[_0x0ab4('0x4f')]({'plain':!![]});var _0x4f1847=_[_0x0ab4('0x33')](addVoicePrefixExtensions(_0x5b4bbe,_0x597d26),function(_0x1b7925){_0x1b7925['VoiceExtensionId']=_0x194733['id'];_0x1b7925[_0x0ab4('0x62')]=_0x5b4bbe['id'];return _0x1b7925;});return db['VoiceExtension'][_0x0ab4('0x63')](_0x4f1847,{'transaction':_0x427b51})['then'](function(_0x268b23){if(!_0x268b23){return _0x12dccd(_0x0ab4('0x64'));}else{return _0x3cdedf(_0x268b23);}})[_0x0ab4('0x47')](function(_0x2e728f){return _0x12dccd(_0x2e728f);});});;});};function addVoicePrefixExtensions(_0x509611,_0x581547){var _0x10dd5b=[];var _0x4477ba=formatPrefixName(_0x509611['prefix']);_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x2,_0x0ab4('0x66'),_0x0ab4('0x67')+_0x509611['name']));if(_0x509611[_0x0ab4('0x68')]){_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x66'),_0x0ab4('0x69')+_0x509611[_0x0ab4('0x68')]));}else{_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x5f'),_0x0ab4('0x6a')));}_0x10dd5b['push'](new Extension(_0x4477ba,0x4,'goto',_0x581547[_0x0ab4('0x6b')]+','+_0x0ab4('0x6c')+(0x8+_0x509611[_0x0ab4('0x2d')][_0x0ab4('0x49')])+'}'+','+0x1));return _0x10dd5b;}function formatPrefixName(_0x58c611){var _0x417926='_';for(var _0x5256d4=0x0;_0x5256d4<_0x58c611[_0x0ab4('0x49')];_0x5256d4++){if(_0x58c611[_0x0ab4('0x6d')](_0x5256d4)=='-'){_0x417926+=_0x58c611[_0x0ab4('0x6d')](_0x5256d4);}else{_0x417926+='['+_0x58c611[_0x0ab4('0x6d')](_0x5256d4)+']';}}_0x417926+='.';return _0x417926;}exports[_0x0ab4('0x27')]=function(_0x41b65f,_0x46a008,_0xf42b98){var _0x29cf79=_0x41b65f['body'];_0x29cf79[_0x0ab4('0x5e')]='system-'+_0x29cf79[_0x0ab4('0x2d')]+'-';return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1481b2){return db[_0x0ab4('0x2e')][_0x0ab4('0x27')](_0x29cf79,{'where':{'id':_0x29cf79['id']},'transaction':_0x1481b2})[_0x0ab4('0x28')](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x29')]({'where':{'VoicePrefixId':_0x29cf79['id']},'transaction':_0x1481b2})['then'](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x4a')]({'where':{'id':_0x29cf79['VoiceExtensionId']},'raw':!![]})[_0x0ab4('0x28')](function(_0x2d4921){return createVoicePrefixExtensions(_0x29cf79,_0x2d4921,_0x1481b2);});});});})[_0x0ab4('0x28')](function(){return db['VoicePrefix'][_0x0ab4('0x6e')](_0x29cf79['id']);})[_0x0ab4('0x28')](respondWithResult(_0x46a008,null))[_0x0ab4('0x47')](handleError(_0x46a008,null));};exports[_0x0ab4('0x6f')]=function(_0x531a07,_0x5bf57e,_0x398b3e){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x531a07[_0x0ab4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bf57e,null))[_0x0ab4('0x28')](function(_0xa0f095){if(_0xa0f095){return _0xa0f095[_0x0ab4('0x6f')](_0x531a07['body']['ids'],_[_0x0ab4('0x70')](_0x531a07[_0x0ab4('0x71')],[_0x0ab4('0x72'),'id'])||{})[_0x0ab4('0x73')](function(_0x46f69a){for(var _0x1c8965=0x0;_0x1c8965<_0x531a07[_0x0ab4('0x71')]['ids'][_0x0ab4('0x49')];_0x1c8965+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x531a07[_0x0ab4('0x71')]['ids'][_0x1c8965]),'VoicePrefixId':Number(_0x531a07[_0x0ab4('0x48')]['id'])});}return _0x46f69a;});}})[_0x0ab4('0x28')](respondWithResult(_0x5bf57e,null))[_0x0ab4('0x47')](handleError(_0x5bf57e,null));};exports[_0x0ab4('0x74')]=function(_0x1eec8e,_0x4bffd4,_0x586bd6){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x1eec8e['params']['id']}})['then'](handleEntityNotFound(_0x4bffd4,null))[_0x0ab4('0x28')](function(_0x3e3ded){if(_0x3e3ded){return _0x3e3ded['removeAgents'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])[_0x0ab4('0x28')](function(){if(_['isArray'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])){for(var _0x2033fc=0x0;_0x2033fc<_0x1eec8e[_0x0ab4('0x34')]['ids'][_0x0ab4('0x49')];_0x2033fc+=0x1){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')][_0x2033fc]),'VoicePrefixId':Number(_0x1eec8e[_0x0ab4('0x48')]['id'])});}}else{socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')]),'VoicePrefixId':Number(_0x1eec8e['params']['id'])});}});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x4bffd4,null))[_0x0ab4('0x47')](handleError(_0x4bffd4,null));};exports[_0x0ab4('0x77')]=function(_0x78c98e,_0xb803f2,_0x5adfaa){var _0x448fcb={};var _0x88676f={};var _0xd916e0;var _0x28a722;return db[_0x0ab4('0x2e')][_0x0ab4('0x78')]({'where':{'id':_0x78c98e[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0xb803f2,null))[_0x0ab4('0x28')](function(_0x23968d){if(_0x23968d){_0xd916e0=_0x23968d;_0x88676f[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x79')][_0x0ab4('0x2f')]);_0x88676f['query']=_[_0x0ab4('0x35')](_0x78c98e[_0x0ab4('0x34')]);_0x88676f[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x88676f['model'],_0x88676f['query']);_0x448fcb[_0x0ab4('0x39')]=_[_0x0ab4('0x36')](_0x88676f['model'],qs[_0x0ab4('0x38')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x448fcb[_0x0ab4('0x39')]=_0x448fcb[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x448fcb[_0x0ab4('0x39')]:_0x88676f['model'];_0x448fcb[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x448fcb[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x78c98e[_0x0ab4('0x34')],_0x88676f[_0x0ab4('0x3f')]));if(_0x78c98e['query'][_0x0ab4('0x42')]){_0x448fcb['where']=_[_0x0ab4('0x41')](_0x448fcb[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x448fcb[_0x0ab4('0x39')],function(_0x12ee59){var _0x76fa2={};_0x76fa2[_0x12ee59]={'$like':'%'+_0x78c98e['query']['filter']+'%'};return _0x76fa2;})});}_0x448fcb=_[_0x0ab4('0x41')]({},_0x448fcb,_0x78c98e[_0x0ab4('0x43')]);return _0xd916e0['getAgents'](_0x448fcb);}})['then'](function(_0x21f0a2){if(_0x21f0a2){_0x28a722=_0x21f0a2[_0x0ab4('0x49')];if(!_0x78c98e['query'][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x448fcb[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x78c98e['query'][_0x0ab4('0x1f')]);_0x448fcb['offset']=qs['offset'](_0x78c98e[_0x0ab4('0x34')]['offset']);}return _0xd916e0[_0x0ab4('0x77')](_0x448fcb);}})[_0x0ab4('0x28')](function(_0xb1cac2){if(_0xb1cac2){return _0xb1cac2?{'count':_0x28a722,'rows':_0xb1cac2}:null;}})['then'](respondWithResult(_0xb803f2,null))[_0x0ab4('0x47')](handleError(_0xb803f2,null));};exports[_0x0ab4('0x7a')]=function(_0x840fc2,_0x2282d7,_0x2bf00c){var _0x37a592={};var _0x171969={};var _0x51f02a;var _0x2a25d5;return db['VoicePrefix'][_0x0ab4('0x78')]({'where':{'id':_0x840fc2['params']['id']}})['then'](handleEntityNotFound(_0x2282d7,null))[_0x0ab4('0x28')](function(_0x7ae8b2){if(_0x7ae8b2){_0x51f02a=_0x7ae8b2;_0x171969[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x7b')]['rawAttributes']);_0x171969['query']=_[_0x0ab4('0x35')](_0x840fc2[_0x0ab4('0x34')]);_0x171969['filters']=_[_0x0ab4('0x36')](_0x171969['model'],_0x171969[_0x0ab4('0x34')]);_0x37a592[_0x0ab4('0x39')]=_['intersection'](_0x171969[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x37a592['attributes']=_0x37a592['attributes'][_0x0ab4('0x49')]?_0x37a592[_0x0ab4('0x39')]:_0x171969[_0x0ab4('0x37')];_0x37a592['order']=qs[_0x0ab4('0x3d')](_0x840fc2['query'][_0x0ab4('0x3d')]);_0x37a592[_0x0ab4('0x3e')]=qs['filters'](_['pick'](_0x840fc2['query'],_0x171969[_0x0ab4('0x3f')]));if(_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x42')]){_0x37a592[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x37a592['where'],{'$or':_[_0x0ab4('0x33')](_0x37a592[_0x0ab4('0x39')],function(_0x5e43fe){var _0xde4e2c={};_0xde4e2c[_0x5e43fe]={'$like':'%'+_0x840fc2[_0x0ab4('0x34')]['filter']+'%'};return _0xde4e2c;})});}_0x37a592=_[_0x0ab4('0x41')]({},_0x37a592,_0x840fc2[_0x0ab4('0x43')]);return _0x51f02a['getTeams'](_0x37a592);}})[_0x0ab4('0x28')](function(_0x213828){if(_0x213828){_0x2a25d5=_0x213828[_0x0ab4('0x49')];if(!_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x37a592[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x37a592['offset']=qs[_0x0ab4('0x1e')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}return _0x51f02a[_0x0ab4('0x7a')](_0x37a592);}})[_0x0ab4('0x28')](function(_0x4a9e47){if(_0x4a9e47){return _0x4a9e47?{'count':_0x2a25d5,'rows':_0x4a9e47}:null;}})['then'](respondWithResult(_0x2282d7,null))[_0x0ab4('0x47')](handleError(_0x2282d7,null));};exports['addTeams']=function(_0x15e2f6,_0x3da0c1,_0x415e42){var _0x1effa7=_0x15e2f6['body'][_0x0ab4('0x72')];var _0x33c31a;return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x1effa7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ab4('0x7d'),'attributes':['id',_0x0ab4('0x2d'),_0x0ab4('0x7e'),_0x0ab4('0x7f'),'interface'],'raw':!![]}]})['then'](function(_0x2c6284){if(_0x2c6284){_0x33c31a=_0x2c6284;var _0x272680=_[_0x0ab4('0x80')](_0x2c6284,function(_0x4e064a){var _0x29f715=_0x4e064a['get']({'plain':!![]});return _0x29f715[_0x0ab4('0x7d')];});return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x15e2f6['params']['id']}})['then'](function(_0x1d9644){return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0xa094f5){return _0x1d9644['addTeams'](_0x1effa7,{'transaction':_0xa094f5})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x33c31a,function(_0x45d3fa){return db[_0x0ab4('0x82')][_0x0ab4('0x83')]({'TeamId':_0x45d3fa['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},{'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x272680,function(_0x1d74f9){return db[_0x0ab4('0x84')][_0x0ab4('0x85')]({'where':{'UserId':_0x1d74f9['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){_0x272680['forEach'](function(_0x3984a2){socket[_0x0ab4('0x75')](_0x0ab4('0x86'),{'UserId':_0x3984a2['id'],'VoicePrefixId':_0x1d9644['id']});});});});});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x3da0c1,null))[_0x0ab4('0x47')](handleError(_0x3da0c1,null));};exports[_0x0ab4('0x87')]=function(_0x2ad3a9,_0x29f866,_0x182dfa){return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x2ad3a9['query'][_0x0ab4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0ab4('0x79')],'as':_0x0ab4('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x0ab4('0x28')](handleEntityNotFound(_0x29f866,null))[_0x0ab4('0x28')](function(_0x50b719){var _0x2fbbec=_['map'](_0x50b719,'id');var _0x4379f1=[];var _0x175a2a=[];var _0x332b1c=squel[_0x0ab4('0x88')]();_0x332b1c[_0x0ab4('0x89')]('tq.TeamId')[_0x0ab4('0x8a')](_0x0ab4('0x8b'),'tq')[_0x0ab4('0x8c')](_0x0ab4('0x8d'),'ut',_0x0ab4('0x8e'))['where'](_0x0ab4('0x8f'),_0x2ad3a9[_0x0ab4('0x48')]['id']);for(var _0x3acf39=0x0;_0x3acf39<_0x50b719[_0x0ab4('0x49')];_0x3acf39+=0x1){let _0x28bc17=_0x50b719[_0x3acf39];for(var _0x927d5=0x0;_0x927d5<_0x28bc17[_0x0ab4('0x7d')][_0x0ab4('0x49')];_0x927d5+=0x1){let _0x43fde8=_0x28bc17[_0x0ab4('0x7d')][_0x927d5];var _0x3791e6=_0x332b1c[_0x0ab4('0x90')]();_0x3791e6[_0x0ab4('0x3e')](_0x0ab4('0x91'),_0x43fde8['id']);_0x175a2a['push'](db['sequelize']['query'](_0x3791e6['toString'](),{'type':db[_0x0ab4('0x4d')][_0x0ab4('0x92')]['SELECT']})[_0x0ab4('0x28')](function(_0x19e3f9){if(_0x19e3f9['length']===0x1){return _0x43fde8['id'];}else{var _0x58e215=_[_0x0ab4('0x93')](_['map'](_0x19e3f9,_0x0ab4('0x94')),function(_0x22fb42){return _['includes'](_0x2fbbec,_0x22fb42);});if(_0x58e215){return _0x43fde8['id'];}}}));}}return BPromise[_0x0ab4('0x95')](_0x175a2a)[_0x0ab4('0x28')](function(_0x17fed9){_0x4379f1=_(_0x4379f1)[_0x0ab4('0x96')](_0x17fed9)[_0x0ab4('0x97')]()[_0x0ab4('0x98')]();return db['VoicePrefix'][_0x0ab4('0x4a')]({'where':{'id':_0x2ad3a9[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](function(_0x4148dd){return db[_0x0ab4('0x4d')]['transaction'](function(_0x1a8f36){return _0x4148dd[_0x0ab4('0x87')](_0x2ad3a9['query'][_0x0ab4('0x72')],{'transaction':_0x1a8f36})[_0x0ab4('0x28')](function(){if(!_[_0x0ab4('0x99')](_0x4379f1)){return _0x4148dd[_0x0ab4('0x74')](_0x4379f1,{'transaction':_0x1a8f36});}})[_0x0ab4('0x28')](function(){_0x4379f1[_0x0ab4('0x9a')](function(_0x4bc8ff){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':_0x4bc8ff,'VoicePrefixId':_0x4148dd['id']});});});});});});})[_0x0ab4('0x28')](respondWithStatusCode(_0x29f866,null))[_0x0ab4('0x47')](handleError(_0x29f866,null));}; \ No newline at end of file +var _0xbaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x5a6dee,_0x76255a){var _0x634de8=function(_0x3337eb){while(--_0x3337eb){_0x5a6dee['push'](_0x5a6dee['shift']());}};_0x634de8(++_0x76255a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7f54ca7..6a51d24 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 _0xc719=['exports','events','../../mysqldb','VoicePrefix','update','emit','hook'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0xc719,0x1eb));var _0x9c71=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc719[_0x2ca9d4];return _0x258956;};'use strict';var EventEmitter=require(_0x9c71('0x0'));var VoicePrefix=require(_0x9c71('0x1'))['db'][_0x9c71('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c71('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4392d8){return function(_0x37c5bd,_0x626cce,_0x5a30f6){VoicePrefixEvents[_0x9c71('0x4')](_0x4392d8+':'+_0x37c5bd['id'],_0x37c5bd);VoicePrefixEvents[_0x9c71('0x4')](_0x4392d8,_0x37c5bd);_0x5a30f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x9c71('0x5')](e,emitEvent(event));}}module[_0x9c71('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xeab6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xeab6,0x96));var _0x6eab=function(_0x2daea7,_0x41e7da){_0x2daea7=_0x2daea7-0x0;var _0x1f01bd=_0xeab6[_0x2daea7];return _0x1f01bd;};'use strict';var EventEmitter=require(_0x6eab('0x0'));var VoicePrefix=require(_0x6eab('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6eab('0x2')](0x0);var events={'afterCreate':_0x6eab('0x3'),'afterUpdate':_0x6eab('0x4'),'afterDestroy':_0x6eab('0x5')};function emitEvent(_0x54e458){return function(_0x475198,_0x3de7da,_0x3d2b63){VoicePrefixEvents[_0x6eab('0x6')](_0x54e458+':'+_0x475198['id'],_0x475198);VoicePrefixEvents[_0x6eab('0x6')](_0x54e458,_0x475198);_0x3d2b63(null);};}for(var e in events){if(events[_0x6eab('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b53c8d7..8a93297 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 _0x0e4e=['path','../../config/environment','exports','define','VoicePrefix','util','api','bluebird','request-promise'];(function(_0x14f902,_0x458963){var _0x1610a4=function(_0x3155d1){while(--_0x3155d1){_0x14f902['push'](_0x14f902['shift']());}};_0x1610a4(++_0x458963);}(_0x0e4e,0xcb));var _0xe0e4=function(_0x1f9179,_0x598964){_0x1f9179=_0x1f9179-0x0;var _0x2974c9=_0x0e4e[_0x1f9179];return _0x2974c9;};'use strict';var _=require('lodash');var util=require(_0xe0e4('0x0'));var logger=require('../../config/logger')(_0xe0e4('0x1'));var moment=require('moment');var BPromise=require(_0xe0e4('0x2'));var rp=require(_0xe0e4('0x3'));var fs=require('fs');var path=require(_0xe0e4('0x4'));var rimraf=require('rimraf');var config=require(_0xe0e4('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xe0e4('0x6')]=function(_0x709535,_0x486bcd){return _0x709535[_0xe0e4('0x7')](_0xe0e4('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33bc=['./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x33bc,0x197));var _0xc33b=function(_0x23019f,_0x57f3ef){_0x23019f=_0x23019f-0x0;var _0x302ca5=_0x33bc[_0x23019f];return _0x302ca5;};'use strict';var _=require(_0xc33b('0x0'));var util=require(_0xc33b('0x1'));var logger=require(_0xc33b('0x2'))(_0xc33b('0x3'));var moment=require(_0xc33b('0x4'));var BPromise=require('bluebird');var rp=require(_0xc33b('0x5'));var fs=require('fs');var path=require(_0xc33b('0x6'));var rimraf=require(_0xc33b('0x7'));var config=require(_0xc33b('0x8'));var attributes=require(_0xc33b('0x9'));module[_0xc33b('0xa')]=function(_0x47930e,_0x4017ca){return _0x47930e['define'](_0xc33b('0xb'),attributes,{'tableName':_0xc33b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 048030c..45a199d 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 _0x21b7=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register'];(function(_0x4f4f76,_0x2ed157){var _0x5899c2=function(_0x54f1a2){while(--_0x54f1a2){_0x4f4f76['push'](_0x4f4f76['shift']());}};_0x5899c2(++_0x2ed157);}(_0x21b7,0xef));var _0x721b=function(_0x407f48,_0x46893e){_0x407f48=_0x407f48-0x0;var _0x483228=_0x21b7[_0x407f48];return _0x483228;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x721b('0x0'));var rs=require(_0x721b('0x1'));var fs=require('fs');var Redis=require(_0x721b('0x2'));var db=require(_0x721b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x721b('0x4'));var config=require(_0x721b('0x5'));var jayson=require(_0x721b('0x6'));var client=jayson[_0x721b('0x7')][_0x721b('0x8')]({'port':0x232a});config[_0x721b('0x9')]=_['defaults'](config[_0x721b('0x9')],{'host':_0x721b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x721b('0xb'))[_0x721b('0xc')](socket);function respondWithRpcPromise(_0xe13699,_0x35f524,_0xfcc6d7){return new BPromise(function(_0x5e11e3,_0x302bfd){return client[_0x721b('0xd')](_0xe13699,_0xfcc6d7)[_0x721b('0xe')](function(_0x2c6f5a){logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x35f524,_0x721b('0x11'),JSON['stringify'](_0x2c6f5a));if(_0x2c6f5a[_0x721b('0x12')]){if(_0x2c6f5a[_0x721b('0x12')]['code']===0x1f4){logger['error'](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x302bfd(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x5e11e3(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}else{logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));_0x5e11e3(_0x2c6f5a['result'][_0x721b('0x13')]);}})[_0x721b('0x14')](function(_0x821d77){logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x821d77);_0x302bfd(_0x821d77);});});} \ No newline at end of file +var _0x78f4=['debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x478f('0x0'));var moment=require(_0x478f('0x1'));var BPromise=require(_0x478f('0x2'));var rs=require(_0x478f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x478f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x478f('0x5'))(_0x478f('0x6'));var config=require(_0x478f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x478f('0x8')][_0x478f('0x9')]({'port':0x232a});config['redis']=_[_0x478f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x478f('0xb'))(new Redis(config['redis']));require(_0x478f('0xc'))[_0x478f('0xd')](socket);function respondWithRpcPromise(_0xec2f39,_0x469c69,_0x5a724b){return new BPromise(function(_0x5e6a27,_0x32ea1a){return client[_0x478f('0xe')](_0xec2f39,_0x5a724b)[_0x478f('0xf')](function(_0x45e1dd){logger[_0x478f('0x10')](_0x478f('0x11'),_0x469c69,_0x478f('0x12'));logger[_0x478f('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'),JSON[_0x478f('0x14')](_0x45e1dd));if(_0x45e1dd[_0x478f('0x15')]){if(_0x45e1dd[_0x478f('0x15')][_0x478f('0x16')]===0x1f4){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd[_0x478f('0x15')]['message']);return _0x32ea1a(_0x45e1dd[_0x478f('0x15')][_0x478f('0x17')]);}logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd['error'][_0x478f('0x17')]);return _0x5e6a27(_0x45e1dd['error'][_0x478f('0x17')]);}else{logger[_0x478f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'));_0x5e6a27(_0x45e1dd['result'][_0x478f('0x17')]);}})[_0x478f('0x18')](function(_0x181d9d){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x181d9d);_0x32ea1a(_0x181d9d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 2ba5264..0a75b65 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 _0x1df5=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1baf4e,_0x2afd1c){var _0x4bd817=function(_0x29de52){while(--_0x29de52){_0x1baf4e['push'](_0x1baf4e['shift']());}};_0x4bd817(++_0x2afd1c);}(_0x1df5,0xfd));var _0x51df=function(_0x255536,_0x325896){_0x255536=_0x255536-0x0;var _0x1c17a4=_0x1df5[_0x255536];return _0x1c17a4;};'use strict';var VoicePrefixEvents=require(_0x51df('0x0'));var events=[_0x51df('0x1'),_0x51df('0x2'),_0x51df('0x3')];function createListener(_0x2d898c,_0x557d22){return function(_0x3439b4){_0x557d22[_0x51df('0x4')](_0x2d898c,_0x3439b4);};}function removeListener(_0x1c491f,_0x34fedd){return function(){VoicePrefixEvents[_0x51df('0x5')](_0x1c491f,_0x34fedd);};}exports[_0x51df('0x6')]=function(_0x15de76){for(var _0x239dbb=0x0,_0x50961e=events[_0x51df('0x7')];_0x239dbb<_0x50961e;_0x239dbb++){var _0x53b879=events[_0x239dbb];var _0x42a74a=createListener(_0x51df('0x8')+_0x53b879,_0x15de76);VoicePrefixEvents['on'](_0x53b879,_0x42a74a);}}; \ No newline at end of file +var _0xb04a=['save','remove','update','emit','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0xab04('0x0'));var events=[_0xab04('0x1'),_0xab04('0x2'),_0xab04('0x3')];function createListener(_0x565575,_0x28963e){return function(_0x4657c4){_0x28963e[_0xab04('0x4')](_0x565575,_0x4657c4);};}function removeListener(_0x4b8c0f,_0x2b5b06){return function(){VoicePrefixEvents[_0xab04('0x5')](_0x4b8c0f,_0x2b5b06);};}exports[_0xab04('0x6')]=function(_0x488ced){for(var _0x3b68e3=0x0,_0x46d9b2=events['length'];_0x3b68e3<_0x46d9b2;_0x3b68e3++){var _0x53a969=events[_0x3b68e3];var _0x4d47f5=createListener(_0xab04('0x7')+_0x53a969,_0x488ced);VoicePrefixEvents['on'](_0x53a969,_0x4d47f5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fd31d3f..5208e22 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0xb10b[_0x32be74];return _0x59407f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x61975a,_0x36b46c){var _0x5075b4=function(_0x14867d){while(--_0x14867d){_0x61975a['push'](_0x61975a['shift']());}};_0x5075b4(++_0x36b46c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0633a45..e51ec17 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 _0x7dd8=['wrapuptime','progressive','power','Dial\x20Method.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','dialMethod','preview','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x7dd8,0x78));var _0x87dd=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7dd8[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x87dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x87dd('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x3'),_0x87dd('0x4')),'allowNull':![],'defaultValue':_0x87dd('0x3')},'musiconhold':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x5')},'announce':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x87dd('0x2')]('rr',_0x87dd('0x6'),_0x87dd('0x7'),_0x87dd('0x8'),_0x87dd('0x9'),'rrmemory','linear',_0x87dd('0xa'),_0x87dd('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x159e76){this[_0x87dd('0xc')](_0x87dd('0xd'),_0x159e76?_0x159e76:_0x87dd('0xe'));},'get':function(){var _0x74794f=this[_0x87dd('0xf')]('type');var _0x36b287=this[_0x87dd('0xf')](_0x87dd('0x10'));var _0x51b80a=this[_0x87dd('0xf')]('strategy');if(_0x74794f===_0x87dd('0x4')){if(_0x36b287===_0x87dd('0x11')){return null;}if(_0x36b287===_0x87dd('0x12')&&!['rrmemory','roundrobin'][_0x87dd('0x13')](_0x51b80a)){this[_0x87dd('0xc')](_0x87dd('0xd'),_0x87dd('0xe'));}}return _0x51b80a;}},'servicelevel':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x87dd('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x87dd('0x1')]},'weight':{'type':Sequelize[_0x87dd('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x87dd('0x2')]('yes','no'),'defaultValue':_0x87dd('0x15')},'autopause':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no',_0x87dd('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x87dd('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x87dd('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x87dd('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x87dd('0x15'),'no'),'defaultValue':_0x87dd('0x15')},'announce_holdtime':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no',_0x87dd('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x87dd('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x87dd('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x87dd('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x87dd('0x1')]},'queue_quantity2':{'type':Sequelize[_0x87dd('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x87dd('0x1')]},'periodic_announce':{'type':Sequelize[_0x87dd('0x18')],'set':function(_0x443276){this[_0x87dd('0xc')]('periodic_announce',_0x443276?_0x443276['join'](','):[]);},'get':function(){return this[_0x87dd('0xf')](_0x87dd('0x19'))?this[_0x87dd('0xf')](_0x87dd('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x15'),'set':function(_0x2b45d5){this[_0x87dd('0xc')](_0x87dd('0x1a'),_0x2b45d5?_0x2b45d5[_0x87dd('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x87dd('0x1a'))?this[_0x87dd('0xf')]('joinempty')[_0x87dd('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':'no','set':function(_0x596d19){this[_0x87dd('0xc')](_0x87dd('0x1d'),_0x596d19?_0x596d19[_0x87dd('0x1b')](','):undefined);},'get':function(){return this[_0x87dd('0xf')](_0x87dd('0x1d'))?this[_0x87dd('0xf')](_0x87dd('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x87dd('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x87dd('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'set':function(_0xf86e15){this[_0x87dd('0xc')](_0x87dd('0x1f'),_0xf86e15);if(_0xf86e15){if(this[_0x87dd('0xf')]('wrapuptime')<0x2){this[_0x87dd('0xc')](_0x87dd('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x87dd('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x11'),_0x87dd('0x21'),_0x87dd('0x22'),'predictive','booked'),'defaultValue':'progressive','comment':_0x87dd('0x23')},'dialLimitChannel':{'type':Sequelize[_0x87dd('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x87dd('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x87dd('0x24')},'dialPowerLevel':{'type':Sequelize[_0x87dd('0x25')](0x2)[_0x87dd('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x87dd('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x28'),_0x87dd('0x29')),'defaultValue':_0x87dd('0x29'),'comment':_0x87dd('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x87dd('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x87dd('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x87dd('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x87dd('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x87dd('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x2e')},'dialQueueProject':{'type':Sequelize[_0x87dd('0x1')],'comment':_0x87dd('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'comment':_0x87dd('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':_0x87dd('0x34')},'dialPrefix':{'type':Sequelize[_0x87dd('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x87dd('0x2')](_0x87dd('0x35'),_0x87dd('0x36'),'onlyIfOpen'),'defaultValue':_0x87dd('0x35')},'dialAMDActive':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':_0x87dd('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x87dd('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x87dd('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x87dd('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x87dd('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x87dd('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x87dd('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x87dd('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x87dd('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x87dd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x87dd('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x87dd('0x14')](0x9)[_0x87dd('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x87dd('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x87dd('0x3e')),'defaultValue':_0x87dd('0x3f')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x87dd('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x87dd('0x40')},'dialCutDigit':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x87dd('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x87dd('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x87dd('0x14')](0x5)[_0x87dd('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x87dd('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87dd('0x14')],'allowNull':!![],'comment':_0x87dd('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5bd574){if(!_0x5bd574)this[_0x87dd('0xc')](_0x87dd('0x4a'),null);this[_0x87dd('0xc')](_0x87dd('0x4b'),_0x5bd574);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x87dd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x87dd('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x87dd('0x14')](0x3)[_0x87dd('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x87dd('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x6624=['mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','linear','rrordered','getDataValue','type','dialMethod','strategy','preview','booked','rrmemory','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xf3e6d5,_0x5f3d0b){var _0x42cb94=function(_0x5c76a6){while(--_0x5c76a6){_0xf3e6d5['push'](_0xf3e6d5['shift']());}};_0x42cb94(++_0x5f3d0b);}(_0x6624,0x155));var _0x4662=function(_0x5ab9ab,_0x3b153f){_0x5ab9ab=_0x5ab9ab-0x0;var _0xa49088=_0x6624[_0x5ab9ab];return _0xa49088;};'use strict';var Sequelize=require(_0x4662('0x0'));module[_0x4662('0x1')]={'name':{'type':Sequelize[_0x4662('0x2')],'allowNull':![],'unique':_0x4662('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4662('0x4')]('inbound',_0x4662('0x5')),'allowNull':![],'defaultValue':_0x4662('0x6')},'musiconhold':{'type':Sequelize[_0x4662('0x2')],'defaultValue':_0x4662('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x4662('0x4')]('rr',_0x4662('0x8'),_0x4662('0x9'),_0x4662('0xa'),_0x4662('0xb'),'rrmemory',_0x4662('0xc'),'wrandom',_0x4662('0xd')),'allowNull':![],'defaultValue':_0x4662('0x8'),'set':function(_0x1c0ee9){this['setDataValue']('strategy',_0x1c0ee9?_0x1c0ee9:'rrmemory');},'get':function(){var _0x3ad012=this[_0x4662('0xe')](_0x4662('0xf'));var _0x139542=this[_0x4662('0xe')](_0x4662('0x10'));var _0x9ae283=this[_0x4662('0xe')](_0x4662('0x11'));if(_0x3ad012===_0x4662('0x5')){if(_0x139542===_0x4662('0x12')){return null;}if(_0x139542===_0x4662('0x13')&&![_0x4662('0x14'),_0x4662('0x15')][_0x4662('0x16')](_0x9ae283)){this[_0x4662('0x17')](_0x4662('0x11'),_0x4662('0x14'));}}return _0x9ae283;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4662('0x18')](0xb)},'timeout':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4662('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':_0x4662('0x19')},'autopause':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no',_0x4662('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4662('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x4662('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4662('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x4662('0x4')]('yes','no',_0x4662('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x4662('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4662('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4662('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4662('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4662('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x4662('0x2')]},'queue_quantity2':{'type':Sequelize[_0x4662('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x4662('0x2')]},'queue_less_than':{'type':Sequelize[_0x4662('0x2')]},'periodic_announce':{'type':Sequelize[_0x4662('0x1c')],'set':function(_0x355e43){this[_0x4662('0x17')](_0x4662('0x1d'),_0x355e43?_0x355e43[_0x4662('0x1e')](','):[]);},'get':function(){return this[_0x4662('0xe')](_0x4662('0x1d'))?this['getDataValue'](_0x4662('0x1d'))[_0x4662('0x1f')](','):[];}},'joinempty':{'type':Sequelize[_0x4662('0x2')],'defaultValue':_0x4662('0x19'),'set':function(_0x19a76b){this[_0x4662('0x17')](_0x4662('0x20'),_0x19a76b?_0x19a76b[_0x4662('0x1e')](','):undefined);},'get':function(){return this[_0x4662('0xe')](_0x4662('0x20'))?this[_0x4662('0xe')](_0x4662('0x20'))[_0x4662('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4662('0x2')],'defaultValue':'no','set':function(_0x2a3f0b){this[_0x4662('0x17')](_0x4662('0x21'),_0x2a3f0b?_0x2a3f0b[_0x4662('0x1e')](','):undefined);},'get':function(){return this[_0x4662('0xe')]('leavewhenempty')?this[_0x4662('0xe')](_0x4662('0x21'))[_0x4662('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4662('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x4662('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4662('0x2')]},'description':{'type':Sequelize[_0x4662('0x2')]},'acw':{'type':Sequelize[_0x4662('0x22')],'defaultValue':0x0,'set':function(_0x4cda6f){this['setDataValue'](_0x4662('0x23'),_0x4cda6f);if(_0x4cda6f){if(this[_0x4662('0xe')](_0x4662('0x24'))<0x2){this[_0x4662('0x17')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4662('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4662('0x25')},'dialMethod':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x12'),_0x4662('0x26'),_0x4662('0x27'),_0x4662('0x28'),_0x4662('0x13')),'defaultValue':'progressive','comment':_0x4662('0x29')},'dialLimitChannel':{'type':Sequelize[_0x4662('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4662('0x2a')},'dialLimitQueue':{'type':Sequelize[_0x4662('0x18')](0x4)[_0x4662('0x2b')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4662('0x2c')},'dialPowerLevel':{'type':Sequelize[_0x4662('0x2d')](0x2)[_0x4662('0x2b')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x2e'),'dropRate'),'defaultValue':_0x4662('0x2f'),'comment':_0x4662('0x30')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x4662('0x2b')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4662('0x31')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4662('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4662('0x18')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x32')},'dialQueueOptions':{'type':Sequelize[_0x4662('0x2')],'defaultValue':_0x4662('0x33'),'comment':_0x4662('0x34')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x35')},'dialQueueProject':{'type':Sequelize[_0x4662('0x2')],'comment':_0x4662('0x36')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x37')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x38')},'dialBusyMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x39')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'comment':_0x4662('0x3a')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x3b')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4662('0x3c')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4662('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x4662('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x3d'),_0x4662('0x3e'),'onlyIfOpen'),'defaultValue':_0x4662('0x3d')},'dialAMDActive':{'type':Sequelize[_0x4662('0x22')],'defaultValue':0x0,'comment':_0x4662('0x3f')},'dialAMDInitialSilence':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4662('0x40')},'dialAMDGreeting':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4662('0x41')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4662('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4662('0x42')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4662('0x43')},'dialAMDMinWordLength':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4662('0x44')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4662('0x45')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4662('0x18')](0x9)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4662('0x46')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4662('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4662('0x47')},'dialRecallInQueue':{'type':Sequelize[_0x4662('0x22')],'defaultValue':0x0,'comment':_0x4662('0x48')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4662('0x4')](_0x4662('0x49'),'ASC'),'defaultValue':_0x4662('0x49')},'dialQueueProject2':{'type':Sequelize[_0x4662('0x2')],'comment':_0x4662('0x36')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4662('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4662('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4662('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4662('0x4a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4662('0x2b')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4662('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x4e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x50')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4662('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4662('0x18')](0x5)[_0x4662('0x2b')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4662('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4662('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4662('0x22')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c3e8c){if(!_0x4c3e8c)this[_0x4662('0x17')](_0x4662('0x54'),null);this['setDataValue']('mandatoryDisposition',_0x4c3e8c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4662('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4662('0x18')](0x3)[_0x4662('0x2b')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4662('0x22')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6faa39b..d4290d1 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 _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x235376,_0x9552cf){var _0x412e00=function(_0x55be7c){while(--_0x55be7c){_0x235376['push'](_0x235376['shift']());}};_0x412e00(++_0x9552cf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file +var _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x3cb7e8,_0xb8f77){var _0x72798f=function(_0x114662){while(--_0x114662){_0x3cb7e8['push'](_0x3cb7e8['shift']());}};_0x72798f(++_0xb8f77);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x7fbe[_0x242a98];return _0x580999;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ed6572b..1e86c79 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 _0x4f71=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit'];(function(_0x5098b8,_0x26aa52){var _0x536d73=function(_0x261ff3){while(--_0x261ff3){_0x5098b8['push'](_0x5098b8['shift']());}};_0x536d73(++_0x26aa52);}(_0x4f71,0x175));var _0x14f7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f71[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x14f7('0x0'));var VoiceQueue=require(_0x14f7('0x1'))['db'][_0x14f7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x14f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x14f7('0x4'),'afterDestroy':_0x14f7('0x5')};function emitEvent(_0x445aac){return function(_0x4b60db,_0x485eb3,_0x55f761){VoiceQueueEvents[_0x14f7('0x6')](_0x445aac+':'+_0x4b60db['id'],_0x4b60db);VoiceQueueEvents[_0x14f7('0x6')](_0x445aac,_0x4b60db);_0x55f761(null);};}for(var e in events){if(events[_0x14f7('0x7')](e)){var event=events[e];VoiceQueue[_0x14f7('0x8')](e,emitEvent(event));}}module[_0x14f7('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xe243=['emit','hasOwnProperty','exports','events','VoiceQueue','update','remove'];(function(_0x463f47,_0x36bd6c){var _0x59efb6=function(_0x5a1645){while(--_0x5a1645){_0x463f47['push'](_0x463f47['shift']());}};_0x59efb6(++_0x36bd6c);}(_0xe243,0x114));var _0x3e24=function(_0xfa2f68,_0x23836e){_0xfa2f68=_0xfa2f68-0x0;var _0x252d9a=_0xe243[_0xfa2f68];return _0x252d9a;};'use strict';var EventEmitter=require(_0x3e24('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x3e24('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e24('0x2'),'afterDestroy':_0x3e24('0x3')};function emitEvent(_0x36678b){return function(_0x21ccf3,_0x31838f,_0x53b6bb){VoiceQueueEvents[_0x3e24('0x4')](_0x36678b+':'+_0x21ccf3['id'],_0x21ccf3);VoiceQueueEvents['emit'](_0x36678b,_0x21ccf3);_0x53b6bb(null);};}for(var e in events){if(events[_0x3e24('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3e24('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 59cf814..11fd8e1 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x008c,0x188));var _0xc008=function(_0x4e52b9,_0x3b39b2){_0x4e52b9=_0x4e52b9-0x0;var _0xca4e2a=_0x008c[_0x4e52b9];return _0xca4e2a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x170682,_0x1fe7b7){var _0x2d9f0e=function(_0x1912d7){while(--_0x1912d7){_0x170682['push'](_0x170682['shift']());}};_0x2d9f0e(++_0x1fe7b7);}(_0x70e0,0x17b));var _0x070e=function(_0x5221ea,_0x514711){_0x5221ea=_0x5221ea-0x0;var _0x41660b=_0x70e0[_0x5221ea];return _0x41660b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 79b69fd..3a86c43 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 _0x7896=['include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','VoiceQueue','options','raw','attributes','limit'];(function(_0x109767,_0x151aa9){var _0x515859=function(_0x3ddbc1){while(--_0x3ddbc1){_0x109767['push'](_0x109767['shift']());}};_0x515859(++_0x151aa9);}(_0x7896,0x111));var _0x6789=function(_0x1551ed,_0x5cc3ce){_0x1551ed=_0x1551ed-0x0;var _0x499928=_0x7896[_0x1551ed];return _0x499928;};'use strict';var _=require(_0x6789('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6789('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6789('0x2'));var db=require(_0x6789('0x3'))['db'];var utils=require(_0x6789('0x4'));var logger=require(_0x6789('0x5'))('rpc');var config=require(_0x6789('0x6'));var jayson=require(_0x6789('0x7'));var client=jayson[_0x6789('0x8')][_0x6789('0x9')]({'port':0x232a});config['redis']=_[_0x6789('0xa')](config['redis'],{'host':_0x6789('0xb'),'port':0x18eb});var socket=require(_0x6789('0xc'))(new Redis(config[_0x6789('0xd')]));require(_0x6789('0xe'))[_0x6789('0xf')](socket);function respondWithRpcPromise(_0x1bbc64,_0x59caaa,_0x505d73){return new BPromise(function(_0x1106ef,_0x3a54d8){return client[_0x6789('0x10')](_0x1bbc64,_0x505d73)[_0x6789('0x11')](function(_0x4a56db){logger[_0x6789('0x12')](_0x6789('0x13'),_0x59caaa,'request\x20sent');logger[_0x6789('0x14')](_0x6789('0x15'),_0x59caaa,_0x6789('0x16'),JSON['stringify'](_0x4a56db));if(_0x4a56db[_0x6789('0x17')]){if(_0x4a56db[_0x6789('0x17')]['code']===0x1f4){logger[_0x6789('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x59caaa,_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);return _0x3a54d8(_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);}logger[_0x6789('0x17')](_0x6789('0x13'),_0x59caaa,_0x4a56db[_0x6789('0x17')][_0x6789('0x18')]);return _0x1106ef(_0x4a56db[_0x6789('0x17')]['message']);}else{logger['info'](_0x6789('0x13'),_0x59caaa,_0x6789('0x16'));_0x1106ef(_0x4a56db['result'][_0x6789('0x18')]);}})[_0x6789('0x19')](function(_0x1ca0f5){logger[_0x6789('0x17')](_0x6789('0x13'),_0x59caaa,_0x1ca0f5);_0x3a54d8(_0x1ca0f5);});});}exports['GetVoiceQueue']=function(_0x2ae8df){var _0x43fbf2=this;return new Promise(function(_0x4930a6,_0x4db029){return db[_0x6789('0x1a')]['findAll']({'raw':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df['options'][_0x6789('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')]['where']||null:null,'attributes':_0x2ae8df['options']?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1d')]||null:null,'limit':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1e')]||null:null,'include':_0x2ae8df[_0x6789('0x1b')]?_0x2ae8df[_0x6789('0x1b')][_0x6789('0x1f')]?_[_0x6789('0x20')](_0x2ae8df[_0x6789('0x1b')]['include'],function(_0x5c2d74){return{'model':db[_0x5c2d74[_0x6789('0x21')]],'as':_0x5c2d74['as'],'attributes':_0x5c2d74['attributes'],'include':_0x5c2d74[_0x6789('0x1f')]?_[_0x6789('0x20')](_0x5c2d74['include'],function(_0x14f7c6){return{'model':db[_0x14f7c6['model']],'as':_0x14f7c6['as'],'attributes':_0x14f7c6[_0x6789('0x1d')],'include':_0x14f7c6['include']?_[_0x6789('0x20')](_0x14f7c6['include'],function(_0x407372){return{'model':db[_0x407372[_0x6789('0x21')]],'as':_0x407372['as'],'attributes':_0x407372['attributes']};}):[]};}):[]};}):[]:[]})[_0x6789('0x11')](function(_0x2000e2){logger[_0x6789('0x12')](_0x6789('0x22'),_0x2ae8df);logger[_0x6789('0x14')]('GetVoiceQueue',_0x2ae8df,JSON[_0x6789('0x23')](_0x2000e2));_0x4930a6(_0x2000e2);})['catch'](function(_0x1dac1a){logger[_0x6789('0x17')](_0x6789('0x22'),_0x1dac1a[_0x6789('0x18')],_0x2ae8df);_0x4db029(_0x43fbf2['error'](0x1f4,_0x1dac1a['message']));});});};exports[_0x6789('0x24')]=function(_0x48e203){var _0x31a684=this;return new Promise(function(_0x927aa6,_0x533c21){return db[_0x6789('0x1a')][_0x6789('0x25')]({'raw':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')][_0x6789('0x1c')]===undefined?!![]:![]:!![],'where':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['where']||null:null,'attributes':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['attributes']||null:null,'include':_0x48e203[_0x6789('0x1b')]?_0x48e203[_0x6789('0x1b')]['include']?_[_0x6789('0x20')](_0x48e203['options'][_0x6789('0x1f')],function(_0x284fe3){return{'model':db[_0x284fe3[_0x6789('0x21')]],'as':_0x284fe3['as'],'attributes':_0x284fe3[_0x6789('0x1d')],'include':_0x284fe3['include']?_[_0x6789('0x20')](_0x284fe3[_0x6789('0x1f')],function(_0x319fd0){return{'model':db[_0x319fd0[_0x6789('0x21')]],'as':_0x319fd0['as'],'attributes':_0x319fd0[_0x6789('0x1d')],'include':_0x319fd0['include']?_[_0x6789('0x20')](_0x319fd0[_0x6789('0x1f')],function(_0x130288){return{'model':db[_0x130288[_0x6789('0x21')]],'as':_0x130288['as'],'attributes':_0x130288[_0x6789('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5abf86){logger[_0x6789('0x12')](_0x6789('0x24'),_0x48e203);logger[_0x6789('0x14')]('ShowVoiceQueue',_0x48e203,JSON[_0x6789('0x23')](_0x5abf86));_0x927aa6(_0x5abf86);})[_0x6789('0x19')](function(_0x42b1db){logger[_0x6789('0x17')](_0x6789('0x24'),_0x42b1db['message'],_0x48e203);_0x533c21(_0x31a684[_0x6789('0x17')](0x1f4,_0x42b1db['message']));});});}; \ No newline at end of file +var _0x72cb=['catch','GetVoiceQueue','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36ae06,_0x57da2d){var _0x25ffc7=function(_0x38be3a){while(--_0x38be3a){_0x36ae06['push'](_0x36ae06['shift']());}};_0x25ffc7(++_0x57da2d);}(_0x72cb,0x11e));var _0xb72c=function(_0x29c2f7,_0x1ffb8b){_0x29c2f7=_0x29c2f7-0x0;var _0x3582e6=_0x72cb[_0x29c2f7];return _0x3582e6;};'use strict';var _=require(_0xb72c('0x0'));var util=require(_0xb72c('0x1'));var moment=require(_0xb72c('0x2'));var BPromise=require(_0xb72c('0x3'));var rs=require(_0xb72c('0x4'));var fs=require('fs');var Redis=require(_0xb72c('0x5'));var db=require(_0xb72c('0x6'))['db'];var utils=require(_0xb72c('0x7'));var logger=require('../../config/logger')(_0xb72c('0x8'));var config=require(_0xb72c('0x9'));var jayson=require(_0xb72c('0xa'));var client=jayson[_0xb72c('0xb')]['http']({'port':0x232a});config[_0xb72c('0xc')]=_[_0xb72c('0xd')](config[_0xb72c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb72c('0xe'))(new Redis(config['redis']));require(_0xb72c('0xf'))[_0xb72c('0x10')](socket);function respondWithRpcPromise(_0x1c2bf0,_0xdd8786,_0x2a7da5){return new BPromise(function(_0x111b3c,_0x243568){return client['request'](_0x1c2bf0,_0x2a7da5)['then'](function(_0x4f83ad){logger[_0xb72c('0x11')](_0xb72c('0x12'),_0xdd8786,_0xb72c('0x13'));logger[_0xb72c('0x14')](_0xb72c('0x15'),_0xdd8786,_0xb72c('0x13'),JSON[_0xb72c('0x16')](_0x4f83ad));if(_0x4f83ad[_0xb72c('0x17')]){if(_0x4f83ad['error'][_0xb72c('0x18')]===0x1f4){logger['error'](_0xb72c('0x12'),_0xdd8786,_0x4f83ad[_0xb72c('0x17')][_0xb72c('0x19')]);return _0x243568(_0x4f83ad[_0xb72c('0x17')][_0xb72c('0x19')]);}logger[_0xb72c('0x17')](_0xb72c('0x12'),_0xdd8786,_0x4f83ad[_0xb72c('0x17')][_0xb72c('0x19')]);return _0x111b3c(_0x4f83ad[_0xb72c('0x17')][_0xb72c('0x19')]);}else{logger[_0xb72c('0x11')](_0xb72c('0x12'),_0xdd8786,'request\x20sent');_0x111b3c(_0x4f83ad['result'][_0xb72c('0x19')]);}})[_0xb72c('0x1a')](function(_0x3347f3){logger[_0xb72c('0x17')]('VoiceQueue,\x20%s,\x20%s',_0xdd8786,_0x3347f3);_0x243568(_0x3347f3);});});}exports[_0xb72c('0x1b')]=function(_0x545aab){var _0x5e268f=this;return new Promise(function(_0x49c146,_0x2d79fa){return db['VoiceQueue']['findAll']({'raw':_0x545aab[_0xb72c('0x1c')]?_0x545aab[_0xb72c('0x1c')][_0xb72c('0x1d')]===undefined?!![]:![]:!![],'where':_0x545aab[_0xb72c('0x1c')]?_0x545aab[_0xb72c('0x1c')][_0xb72c('0x1e')]||null:null,'attributes':_0x545aab[_0xb72c('0x1c')]?_0x545aab[_0xb72c('0x1c')][_0xb72c('0x1f')]||null:null,'limit':_0x545aab[_0xb72c('0x1c')]?_0x545aab[_0xb72c('0x1c')][_0xb72c('0x20')]||null:null,'include':_0x545aab[_0xb72c('0x1c')]?_0x545aab[_0xb72c('0x1c')][_0xb72c('0x21')]?_[_0xb72c('0x22')](_0x545aab[_0xb72c('0x1c')][_0xb72c('0x21')],function(_0x4175ec){return{'model':db[_0x4175ec['model']],'as':_0x4175ec['as'],'attributes':_0x4175ec[_0xb72c('0x1f')],'include':_0x4175ec['include']?_[_0xb72c('0x22')](_0x4175ec[_0xb72c('0x21')],function(_0x3fb23c){return{'model':db[_0x3fb23c[_0xb72c('0x23')]],'as':_0x3fb23c['as'],'attributes':_0x3fb23c[_0xb72c('0x1f')],'include':_0x3fb23c[_0xb72c('0x21')]?_[_0xb72c('0x22')](_0x3fb23c[_0xb72c('0x21')],function(_0x1adaa2){return{'model':db[_0x1adaa2[_0xb72c('0x23')]],'as':_0x1adaa2['as'],'attributes':_0x1adaa2[_0xb72c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb72c('0x24')](function(_0x390158){logger[_0xb72c('0x11')](_0xb72c('0x1b'),_0x545aab);logger['debug'](_0xb72c('0x1b'),_0x545aab,JSON[_0xb72c('0x16')](_0x390158));_0x49c146(_0x390158);})[_0xb72c('0x1a')](function(_0x4a83ec){logger[_0xb72c('0x17')](_0xb72c('0x1b'),_0x4a83ec[_0xb72c('0x19')],_0x545aab);_0x2d79fa(_0x5e268f[_0xb72c('0x17')](0x1f4,_0x4a83ec[_0xb72c('0x19')]));});});};exports[_0xb72c('0x25')]=function(_0x5443b1){var _0x3d056a=this;return new Promise(function(_0x2f1fbb,_0xdaec4){return db[_0xb72c('0x26')]['find']({'raw':_0x5443b1[_0xb72c('0x1c')]?_0x5443b1['options'][_0xb72c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5443b1['options']?_0x5443b1['options'][_0xb72c('0x1e')]||null:null,'attributes':_0x5443b1[_0xb72c('0x1c')]?_0x5443b1[_0xb72c('0x1c')]['attributes']||null:null,'include':_0x5443b1[_0xb72c('0x1c')]?_0x5443b1[_0xb72c('0x1c')][_0xb72c('0x21')]?_[_0xb72c('0x22')](_0x5443b1[_0xb72c('0x1c')][_0xb72c('0x21')],function(_0x3d676b){return{'model':db[_0x3d676b[_0xb72c('0x23')]],'as':_0x3d676b['as'],'attributes':_0x3d676b[_0xb72c('0x1f')],'include':_0x3d676b['include']?_[_0xb72c('0x22')](_0x3d676b[_0xb72c('0x21')],function(_0x3b63b0){return{'model':db[_0x3b63b0['model']],'as':_0x3b63b0['as'],'attributes':_0x3b63b0[_0xb72c('0x1f')],'include':_0x3b63b0['include']?_[_0xb72c('0x22')](_0x3b63b0[_0xb72c('0x21')],function(_0x35ad37){return{'model':db[_0x35ad37[_0xb72c('0x23')]],'as':_0x35ad37['as'],'attributes':_0x35ad37['attributes']};}):[]};}):[]};}):[]:[]})[_0xb72c('0x24')](function(_0x2183c7){logger['info'](_0xb72c('0x25'),_0x5443b1);logger[_0xb72c('0x14')](_0xb72c('0x25'),_0x5443b1,JSON[_0xb72c('0x16')](_0x2183c7));_0x2f1fbb(_0x2183c7);})[_0xb72c('0x1a')](function(_0x3f3f09){logger[_0xb72c('0x17')]('ShowVoiceQueue',_0x3f3f09['message'],_0x5443b1);_0xdaec4(_0x3d056a[_0xb72c('0x17')](0x1f4,_0x3f3f09[_0xb72c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bf8d4c9..52ce081 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 _0xb6c4=['length','voiceQueue:','./voiceQueue.events','save','removeListener'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xb6c4,0x12e));var _0x4b6c=function(_0x4c6bd4,_0x303e38){_0x4c6bd4=_0x4c6bd4-0x0;var _0x2df3f2=_0xb6c4[_0x4c6bd4];return _0x2df3f2;};'use strict';var VoiceQueueEvents=require(_0x4b6c('0x0'));var events=[_0x4b6c('0x1'),'remove','update'];function createListener(_0x1ba12b,_0x591265){return function(_0x4945d9){_0x591265['emit'](_0x1ba12b,_0x4945d9);};}function removeListener(_0x4a92bd,_0x3277f2){return function(){VoiceQueueEvents[_0x4b6c('0x2')](_0x4a92bd,_0x3277f2);};}exports['register']=function(_0x4130f5){for(var _0x414e1a=0x0,_0x3d978e=events[_0x4b6c('0x3')];_0x414e1a<_0x3d978e;_0x414e1a++){var _0x312088=events[_0x414e1a];var _0x4bf2a8=createListener(_0x4b6c('0x4')+_0x312088,_0x4130f5);VoiceQueueEvents['on'](_0x312088,_0x4bf2a8);}}; \ No newline at end of file +var _0x7a46=['remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x4af05f,_0xd139b1){var _0x50d66e=function(_0x3e58a3){while(--_0x3e58a3){_0x4af05f['push'](_0x4af05f['shift']());}};_0x50d66e(++_0xd139b1);}(_0x7a46,0xee));var _0x67a4=function(_0x56fca0,_0x445632){_0x56fca0=_0x56fca0-0x0;var _0x397085=_0x7a46[_0x56fca0];return _0x397085;};'use strict';var VoiceQueueEvents=require(_0x67a4('0x0'));var events=[_0x67a4('0x1'),_0x67a4('0x2'),'update'];function createListener(_0x32e3e9,_0xcde2af){return function(_0x385fdf){_0xcde2af[_0x67a4('0x3')](_0x32e3e9,_0x385fdf);};}function removeListener(_0x2afb0a,_0x56074f){return function(){VoiceQueueEvents[_0x67a4('0x4')](_0x2afb0a,_0x56074f);};}exports[_0x67a4('0x5')]=function(_0x3c9896){for(var _0x14b64b=0x0,_0x5a338e=events[_0x67a4('0x6')];_0x14b64b<_0x5a338e;_0x14b64b++){var _0x50bf98=events[_0x14b64b];var _0x111c2f=createListener(_0x67a4('0x7')+_0x50bf98,_0x3c9896);VoiceQueueEvents['on'](_0x50bf98,_0x111c2f);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1746144..75805b1 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 _0xc664=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','exports','util','connect-timeout','Router','fs-extra'];(function(_0x4bce45,_0x306789){var _0x7424c6=function(_0x55a980){while(--_0x55a980){_0x4bce45['push'](_0x4bce45['shift']());}};_0x7424c6(++_0x306789);}(_0xc664,0x164));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4c66('0x0'));var path=require('path');var timeout=require(_0x4c66('0x1'));var express=require('express');var router=express[_0x4c66('0x2')]();var fs_extra=require(_0x4c66('0x3'));var auth=require(_0x4c66('0x4'));var interaction=require(_0x4c66('0x5'));var config=require(_0x4c66('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4c66('0x7')]);router[_0x4c66('0x8')](_0x4c66('0x9'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xb')]);router[_0x4c66('0x8')](_0x4c66('0xc'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xd')]);router[_0x4c66('0x8')](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xf')]);router[_0x4c66('0x10')]('/',auth[_0x4c66('0xa')](),controller[_0x4c66('0x11')]);router[_0x4c66('0x12')](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller['update']);router['delete'](_0x4c66('0xe'),auth[_0x4c66('0xa')](),controller['destroy']);module[_0x4c66('0x13')]=router; \ No newline at end of file +var _0x595e=['./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59963f,_0x2f9020){var _0xd94acb=function(_0x369b3f){while(--_0x369b3f){_0x59963f['push'](_0x59963f['shift']());}};_0xd94acb(++_0x2f9020);}(_0x595e,0x132));var _0xe595=function(_0x202267,_0x32d01c){_0x202267=_0x202267-0x0;var _0x50017d=_0x595e[_0x202267];return _0x50017d;};'use strict';var multer=require(_0xe595('0x0'));var util=require('util');var path=require(_0xe595('0x1'));var timeout=require(_0xe595('0x2'));var express=require(_0xe595('0x3'));var router=express[_0xe595('0x4')]();var fs_extra=require(_0xe595('0x5'));var auth=require(_0xe595('0x6'));var interaction=require(_0xe595('0x7'));var config=require(_0xe595('0x8'));var controller=require(_0xe595('0x9'));router[_0xe595('0xa')]('/',auth[_0xe595('0xb')](),controller[_0xe595('0xc')]);router[_0xe595('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xe595('0xd'),auth[_0xe595('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xe595('0xe'),auth[_0xe595('0xb')](),controller[_0xe595('0xf')]);router['post']('/',auth[_0xe595('0xb')](),controller['create']);router[_0xe595('0x10')]('/:id',auth[_0xe595('0xb')](),controller[_0xe595('0x11')]);router[_0xe595('0x12')](_0xe595('0xe'),auth[_0xe595('0xb')](),controller[_0xe595('0x13')]);module[_0xe595('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b5de226..580b8dd 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 _0xe67f=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0xbbe263,_0x245e1b){var _0x573d3f=function(_0x23a165){while(--_0x23a165){_0xbbe263['push'](_0xbbe263['shift']());}};_0x573d3f(++_0x245e1b);}(_0xe67f,0xa0));var _0xfe67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe67f[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfe67('0x0'));module[_0xfe67('0x1')]={'type':{'type':Sequelize[_0xfe67('0x2')]},'uniqueid':{'type':Sequelize[_0xfe67('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfe67('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xfe67('0x3')],'set':function(_0x51cef1){var _0x23ee80=moment(_0x51cef1);var _0x291670=moment(this[_0xfe67('0x4')](_0xfe67('0x5')))[_0xfe67('0x6')](_0xfe67('0x7'));var _0x3166bb=_0x23ee80[_0xfe67('0x8')](_0x291670,_0xfe67('0x9'));this[_0xfe67('0xa')](_0xfe67('0xb'),_0x51cef1);this[_0xfe67('0xa')](_0xfe67('0xc'),_0x3166bb||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xfe67('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xfe67('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xfe67('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xfe67('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfe67('0x2')]},'connectedlinename':{'type':Sequelize[_0xfe67('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfe67('0x2')]},'exten':{'type':Sequelize[_0xfe67('0x2')]},'priority':{'type':Sequelize[_0xfe67('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xfe67('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xfe67('0x2')]},'transfer':{'type':Sequelize[_0xfe67('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfe67('0x2')],'comment':_0xfe67('0x10')},'transferexten':{'type':Sequelize[_0xfe67('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xfe67('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xfe67('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d0c=['DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x9d0c,0x7f));var _0xc9d0=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x9d0c[_0xe5b349];return _0x26b0ad;};'use strict';var Sequelize=require(_0xc9d0('0x0'));var moment=require(_0xc9d0('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc9d0('0x2')]},'calleridnum':{'type':Sequelize[_0xc9d0('0x2')]},'calleridname':{'type':Sequelize[_0xc9d0('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xc9d0('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x348d6b){var _0x1551bd=moment(_0x348d6b);var _0x31f186=moment(this['getDataValue'](_0xc9d0('0x4')))[_0xc9d0('0x5')](_0xc9d0('0x6'));var _0x4c0cfb=_0x1551bd['diff'](_0x31f186,'seconds');this[_0xc9d0('0x7')](_0xc9d0('0x8'),_0x348d6b);this['setDataValue'](_0xc9d0('0x9'),_0x4c0cfb||null);}},'position':{'type':Sequelize[_0xc9d0('0xa')]},'count':{'type':Sequelize[_0xc9d0('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xc9d0('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc9d0('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc9d0('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xc9d0('0x2')],'comment':_0xc9d0('0xc')},'originalposition':{'type':Sequelize[_0xc9d0('0xa')]},'channel':{'type':Sequelize[_0xc9d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc9d0('0x2')]},'connectedlinename':{'type':Sequelize[_0xc9d0('0x2')]},'accountcode':{'type':Sequelize[_0xc9d0('0x2')]},'context':{'type':Sequelize[_0xc9d0('0x2')]},'exten':{'type':Sequelize[_0xc9d0('0x2')]},'priority':{'type':Sequelize[_0xc9d0('0x2')]},'holdtime':{'type':Sequelize[_0xc9d0('0xa')]},'mohtime':{'type':Sequelize[_0xc9d0('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc9d0('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc9d0('0x2')]},'transfer':{'type':Sequelize[_0xc9d0('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc9d0('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc9d0('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc9d0('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 14aa1ee..f7bd7a8 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 _0x932d=['body','catch','update','describe','getVoiceQueuesReport','hasOwnProperty','order','includeAll','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','squel','desk.js','to-csv','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','save','then','destroy','error','name','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','params','length','find','create'];(function(_0x41cba1,_0xd72d19){var _0x576aee=function(_0x414504){while(--_0x414504){_0x41cba1['push'](_0x41cba1['shift']());}};_0x576aee(++_0xd72d19);}(_0x932d,0x9a));var _0xd932=function(_0x3c73b9,_0x493d67){_0x3c73b9=_0x3c73b9-0x0;var _0x2782ab=_0x932d[_0x3c73b9];return _0x2782ab;};'use strict';var emlformat=require(_0xd932('0x0'));var rimraf=require(_0xd932('0x1'));var zipdir=require(_0xd932('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd932('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd932('0x4'));var util=require('util');var path=require(_0xd932('0x5'));var sox=require(_0xd932('0x6'));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(_0xd932('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd932('0x8'));var toCsv=require(_0xd932('0x9'));var querystring=require(_0xd932('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd932('0xb'));var logger=require(_0xd932('0xc'))(_0xd932('0xd'));var utils=require(_0xd932('0xe'));var config=require(_0xd932('0xf'));var licenseUtil=require(_0xd932('0x10'));var db=require(_0xd932('0x11'))['db'];config['redis']=_['defaults'](config[_0xd932('0x12')],{'host':_0xd932('0x13'),'port':0x18eb});var socket=require(_0xd932('0x14'))(new Redis(config['redis']));require(_0xd932('0x15'))[_0xd932('0x16')](socket);function respondWithStatusCode(_0x4790cb,_0x358d4c){_0x358d4c=_0x358d4c||0xcc;return function(_0x11cbd0){if(_0x11cbd0){return _0x4790cb[_0xd932('0x17')](_0x358d4c);}return _0x4790cb[_0xd932('0x18')](_0x358d4c)[_0xd932('0x19')]();};}function respondWithResult(_0x1b1cf4,_0x2d6d6e){_0x2d6d6e=_0x2d6d6e||0xc8;return function(_0x7dcdc9){if(_0x7dcdc9){return _0x1b1cf4[_0xd932('0x18')](_0x2d6d6e)[_0xd932('0x1a')](_0x7dcdc9);}};}function respondWithFilteredResult(_0x404b0d,_0x48bb8f){return function(_0x28c331){if(_0x28c331){var _0x3e1a5a=typeof _0x48bb8f['offset']===_0xd932('0x1b')&&typeof _0x48bb8f[_0xd932('0x1c')]===_0xd932('0x1b');var _0x36cf62=_0x28c331['count'];var _0x54f0f7=_0x3e1a5a?0x0:_0x48bb8f['offset'];var _0x1955fd=_0x3e1a5a?_0x28c331[_0xd932('0x1d')]:_0x48bb8f[_0xd932('0x1e')]+_0x48bb8f[_0xd932('0x1c')];var _0x51bbe7;if(_0x1955fd>=_0x36cf62){_0x1955fd=_0x36cf62;_0x51bbe7=0xc8;}else{_0x51bbe7=0xce;}_0x404b0d[_0xd932('0x18')](_0x51bbe7);return _0x404b0d['set']('Content-Range',_0x54f0f7+'-'+_0x1955fd+'/'+_0x36cf62)['json'](_0x28c331);}return null;};}function patchUpdates(_0x2aeb16){return function(_0x397942){try{jsonpatch['apply'](_0x397942,_0x2aeb16,!![]);}catch(_0x5cb3d4){return BPromise['reject'](_0x5cb3d4);}return _0x397942[_0xd932('0x1f')]();};}function saveUpdates(_0x3300e2,_0x576a91){return function(_0x38f2bb){if(_0x38f2bb){return _0x38f2bb['update'](_0x3300e2)[_0xd932('0x20')](function(_0x30953e){return _0x30953e;});}return null;};}function removeEntity(_0x2bd22e,_0xa41bed){return function(_0x1050a2){if(_0x1050a2){return _0x1050a2[_0xd932('0x21')]()[_0xd932('0x20')](function(){_0x2bd22e[_0xd932('0x18')](0xcc)[_0xd932('0x19')]();});}};}function handleEntityNotFound(_0x337319,_0x15af61){return function(_0x87324e){if(!_0x87324e){_0x337319[_0xd932('0x17')](0x194);}return _0x87324e;};}function handleError(_0x45c7c6,_0x394cc3){_0x394cc3=_0x394cc3||0x1f4;return function(_0x1d370a){logger[_0xd932('0x22')](_0x1d370a['stack']);if(_0x1d370a[_0xd932('0x23')]){delete _0x1d370a['name'];}_0x45c7c6['status'](_0x394cc3)['send'](_0x1d370a);};}exports[_0xd932('0x24')]=function(_0x27f2a3,_0x37b57a){var _0x4ccfc2={},_0x10cf11={},_0x44be3f={'count':0x0,'rows':[]};var _0x48cf33=_[_0xd932('0x25')](db[_0xd932('0x26')][_0xd932('0x27')],function(_0x129bf3){return{'name':_0x129bf3[_0xd932('0x28')],'type':_0x129bf3['type'][_0xd932('0x29')]};});_0x10cf11[_0xd932('0x2a')]=_[_0xd932('0x25')](_0x48cf33,_0xd932('0x23'));_0x10cf11[_0xd932('0x2b')]=_[_0xd932('0x2c')](_0x27f2a3['query']);_0x10cf11['filters']=_['intersection'](_0x10cf11[_0xd932('0x2a')],_0x10cf11['query']);_0x4ccfc2[_0xd932('0x2d')]=_[_0xd932('0x2e')](_0x10cf11[_0xd932('0x2a')],qs[_0xd932('0x2f')](_0x27f2a3[_0xd932('0x2b')][_0xd932('0x2f')]));_0x4ccfc2['attributes']=_0x4ccfc2['attributes']['length']?_0x4ccfc2[_0xd932('0x2d')]:_0x10cf11['model'];if(!_0x27f2a3['query']['hasOwnProperty'](_0xd932('0x30'))){_0x4ccfc2[_0xd932('0x1c')]=qs['limit'](_0x27f2a3[_0xd932('0x2b')][_0xd932('0x1c')]);_0x4ccfc2[_0xd932('0x1e')]=qs[_0xd932('0x1e')](_0x27f2a3['query'][_0xd932('0x1e')]);}_0x4ccfc2['order']=qs[_0xd932('0x31')](_0x27f2a3[_0xd932('0x2b')]['sort']);_0x4ccfc2['where']=qs['filters'](_[_0xd932('0x32')](_0x27f2a3[_0xd932('0x2b')],_0x10cf11[_0xd932('0x33')]),_0x48cf33);if(_0x27f2a3[_0xd932('0x2b')][_0xd932('0x34')]){_0x4ccfc2[_0xd932('0x35')]=_[_0xd932('0x36')](_0x4ccfc2['where'],{'$or':_[_0xd932('0x25')](_0x48cf33,function(_0xf4e7a){if(_0xf4e7a[_0xd932('0x37')]!==_0xd932('0x38')){var _0x1e05ff={};_0x1e05ff[_0xf4e7a['name']]={'$like':'%'+_0x27f2a3['query']['filter']+'%'};return _0x1e05ff;}})});}_0x4ccfc2=_['merge']({},_0x4ccfc2,_0x27f2a3[_0xd932('0x39')]);var _0x4d9c44={'where':_0x4ccfc2['where']};return db[_0xd932('0x26')][_0xd932('0x1d')](_0x4d9c44)['then'](function(_0x1f9d31){_0x44be3f[_0xd932('0x1d')]=_0x1f9d31;if(_0x27f2a3[_0xd932('0x2b')]['includeAll']){_0x4ccfc2[_0xd932('0x3a')]=[{'all':!![]}];}return db[_0xd932('0x26')][_0xd932('0x3b')](_0x4ccfc2);})[_0xd932('0x20')](function(_0x3f53c0){_0x44be3f[_0xd932('0x3c')]=_0x3f53c0;return _0x44be3f;})[_0xd932('0x20')](respondWithFilteredResult(_0x37b57a,_0x4ccfc2))['catch'](handleError(_0x37b57a,null));};exports['show']=function(_0x364efe,_0x2b2e3b){var _0x9de9a2={'raw':![],'where':{'id':_0x364efe[_0xd932('0x3d')]['id']}},_0x2323b1={};_0x2323b1[_0xd932('0x2a')]=_['keys'](db[_0xd932('0x26')][_0xd932('0x27')]);_0x2323b1[_0xd932('0x2b')]=_['keys'](_0x364efe[_0xd932('0x2b')]);_0x2323b1['filters']=_[_0xd932('0x2e')](_0x2323b1[_0xd932('0x2a')],_0x2323b1[_0xd932('0x2b')]);_0x9de9a2['attributes']=_[_0xd932('0x2e')](_0x2323b1['model'],qs['fields'](_0x364efe[_0xd932('0x2b')][_0xd932('0x2f')]));_0x9de9a2[_0xd932('0x2d')]=_0x9de9a2['attributes'][_0xd932('0x3e')]?_0x9de9a2[_0xd932('0x2d')]:_0x2323b1['model'];if(_0x364efe[_0xd932('0x2b')]['includeAll']){_0x9de9a2[_0xd932('0x3a')]=[{'all':!![]}];}_0x9de9a2=_[_0xd932('0x36')]({},_0x9de9a2,_0x364efe[_0xd932('0x39')]);return db[_0xd932('0x26')][_0xd932('0x3f')](_0x9de9a2)[_0xd932('0x20')](handleEntityNotFound(_0x2b2e3b,null))[_0xd932('0x20')](respondWithResult(_0x2b2e3b,null))['catch'](handleError(_0x2b2e3b,null));};exports['create']=function(_0x3388ff,_0x5d6814){return db[_0xd932('0x26')][_0xd932('0x40')](_0x3388ff[_0xd932('0x41')],{})[_0xd932('0x20')](respondWithResult(_0x5d6814,0xc9))[_0xd932('0x42')](handleError(_0x5d6814,null));};exports[_0xd932('0x43')]=function(_0x438b17,_0x44bd3f){if(_0x438b17['body']['id']){delete _0x438b17[_0xd932('0x41')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x438b17[_0xd932('0x3d')]['id']}})[_0xd932('0x20')](handleEntityNotFound(_0x44bd3f,null))['then'](saveUpdates(_0x438b17[_0xd932('0x41')],null))['then'](respondWithResult(_0x44bd3f,null))[_0xd932('0x42')](handleError(_0x44bd3f,null));};exports[_0xd932('0x21')]=function(_0x2347a5,_0x1fa982){return db[_0xd932('0x26')][_0xd932('0x3f')]({'where':{'id':_0x2347a5['params']['id']}})[_0xd932('0x20')](handleEntityNotFound(_0x1fa982,null))[_0xd932('0x20')](removeEntity(_0x1fa982,null))['catch'](handleError(_0x1fa982,null));};exports[_0xd932('0x44')]=function(_0x455213,_0x4fc5bc){return db[_0xd932('0x26')][_0xd932('0x44')]()['then'](respondWithResult(_0x4fc5bc,null))[_0xd932('0x42')](handleError(_0x4fc5bc,null));};exports[_0xd932('0x45')]=function(_0x2f0af0,_0x4e79aa){var _0x33b570={},_0x3c79eb={},_0x5d630d={'count':0x0,'rows':[]};_0x3c79eb[_0xd932('0x2a')]=_['keys'](db[_0xd932('0x26')]['rawAttributes']);_0x3c79eb[_0xd932('0x2b')]=_[_0xd932('0x2c')](_0x2f0af0[_0xd932('0x2b')]);_0x3c79eb[_0xd932('0x33')]=_[_0xd932('0x2e')](_0x3c79eb[_0xd932('0x2a')],_0x3c79eb[_0xd932('0x2b')]);_0x33b570[_0xd932('0x2d')]=_['intersection'](_0x3c79eb[_0xd932('0x2a')],qs['fields'](_0x2f0af0[_0xd932('0x2b')]['fields']));_0x33b570[_0xd932('0x2d')]=_0x33b570[_0xd932('0x2d')]['length']?_0x33b570['attributes']:_0x3c79eb[_0xd932('0x2a')];if(!_0x2f0af0[_0xd932('0x2b')][_0xd932('0x46')](_0xd932('0x30'))){_0x33b570[_0xd932('0x1c')]=qs[_0xd932('0x1c')](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x1c')]);_0x33b570[_0xd932('0x1e')]=qs[_0xd932('0x1e')](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x1e')]);}_0x33b570[_0xd932('0x47')]=qs['sort'](_0x2f0af0[_0xd932('0x2b')][_0xd932('0x31')]);_0x33b570['where']=qs[_0xd932('0x33')](_[_0xd932('0x32')](_0x2f0af0[_0xd932('0x2b')],_0x3c79eb[_0xd932('0x33')]));if(_0x2f0af0[_0xd932('0x2b')]['filter']){_0x33b570[_0xd932('0x35')]=_[_0xd932('0x36')](_0x33b570[_0xd932('0x35')],{'$or':_[_0xd932('0x25')](_0x33b570[_0xd932('0x2d')],function(_0x9a6171){var _0x3cd224={};_0x3cd224[_0x9a6171]={'$like':'%'+_0x2f0af0[_0xd932('0x2b')][_0xd932('0x34')]+'%'};return _0x3cd224;})});}_0x33b570=_[_0xd932('0x36')]({},_0x33b570,_0x2f0af0[_0xd932('0x39')]);var _0x58632e={'where':_0x33b570['where']};return db[_0xd932('0x26')][_0xd932('0x1d')](_0x58632e)[_0xd932('0x20')](function(_0x3c5fb3){_0x5d630d['count']=_0x3c5fb3;if(_0x2f0af0[_0xd932('0x2b')][_0xd932('0x48')]){_0x33b570['include']=[{'all':!![]}];}return db[_0xd932('0x26')][_0xd932('0x3b')](_0x33b570);})['then'](function(_0x1efcde){_0x5d630d[_0xd932('0x3c')]=_0x1efcde;return _0x5d630d;})['then'](respondWithFilteredResult(_0x4e79aa,_0x33b570,'getVoiceQueuesReport'))[_0xd932('0x42')](handleError(_0x4e79aa,null,_0xd932('0x45')));}; \ No newline at end of file +var _0x24f8=['Content-Range','apply','reject','save','then','destroy','end','error','stack','name','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find','describe','getVoiceQueuesReport','pick','include','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','undefined','count','offset','set'];(function(_0x1baf17,_0x23b224){var _0x11194c=function(_0x5439de){while(--_0x5439de){_0x1baf17['push'](_0x1baf17['shift']());}};_0x11194c(++_0x23b224);}(_0x24f8,0x1d3));var _0x824f=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x24f8[_0x53f0db];return _0xae0a5c;};'use strict';var emlformat=require(_0x824f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x824f('0x1'));var jsonpatch=require(_0x824f('0x2'));var rp=require(_0x824f('0x3'));var moment=require(_0x824f('0x4'));var BPromise=require(_0x824f('0x5'));var Mustache=require(_0x824f('0x6'));var util=require(_0x824f('0x7'));var path=require('path');var sox=require(_0x824f('0x8'));var csv=require(_0x824f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x824f('0xa'));var _=require('lodash');var squel=require(_0x824f('0xb'));var crypto=require(_0x824f('0xc'));var jsforce=require(_0x824f('0xd'));var deskjs=require(_0x824f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x824f('0xf'));var Papa=require(_0x824f('0x10'));var Redis=require(_0x824f('0x11'));var authService=require(_0x824f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x824f('0x13'));var hardwareService=require(_0x824f('0x14'));var logger=require(_0x824f('0x15'))(_0x824f('0x16'));var utils=require('../../config/utils');var config=require(_0x824f('0x17'));var licenseUtil=require(_0x824f('0x18'));var db=require('../../mysqldb')['db'];config[_0x824f('0x19')]=_[_0x824f('0x1a')](config[_0x824f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x824f('0x1b'))(new Redis(config[_0x824f('0x19')]));require(_0x824f('0x1c'))[_0x824f('0x1d')](socket);function respondWithStatusCode(_0x39094d,_0x43c1da){_0x43c1da=_0x43c1da||0xcc;return function(_0x2ce99f){if(_0x2ce99f){return _0x39094d[_0x824f('0x1e')](_0x43c1da);}return _0x39094d[_0x824f('0x1f')](_0x43c1da)['end']();};}function respondWithResult(_0x5b7882,_0x35ff28){_0x35ff28=_0x35ff28||0xc8;return function(_0x46290e){if(_0x46290e){return _0x5b7882[_0x824f('0x1f')](_0x35ff28)[_0x824f('0x20')](_0x46290e);}};}function respondWithFilteredResult(_0x3ed291,_0x320476){return function(_0x157a83){if(_0x157a83){var _0x431f4b=typeof _0x320476['offset']==='undefined'&&typeof _0x320476['limit']===_0x824f('0x21');var _0x30193c=_0x157a83[_0x824f('0x22')];var _0x820b14=_0x431f4b?0x0:_0x320476['offset'];var _0x227348=_0x431f4b?_0x157a83['count']:_0x320476[_0x824f('0x23')]+_0x320476['limit'];var _0x543b8f;if(_0x227348>=_0x30193c){_0x227348=_0x30193c;_0x543b8f=0xc8;}else{_0x543b8f=0xce;}_0x3ed291[_0x824f('0x1f')](_0x543b8f);return _0x3ed291[_0x824f('0x24')](_0x824f('0x25'),_0x820b14+'-'+_0x227348+'/'+_0x30193c)[_0x824f('0x20')](_0x157a83);}return null;};}function patchUpdates(_0x1768b3){return function(_0x1f4985){try{jsonpatch[_0x824f('0x26')](_0x1f4985,_0x1768b3,!![]);}catch(_0x9903c8){return BPromise[_0x824f('0x27')](_0x9903c8);}return _0x1f4985[_0x824f('0x28')]();};}function saveUpdates(_0x185f4c,_0x43eb10){return function(_0x17ebcb){if(_0x17ebcb){return _0x17ebcb['update'](_0x185f4c)[_0x824f('0x29')](function(_0x1410b4){return _0x1410b4;});}return null;};}function removeEntity(_0x4a65fe,_0x4d2399){return function(_0x5a7cc0){if(_0x5a7cc0){return _0x5a7cc0[_0x824f('0x2a')]()[_0x824f('0x29')](function(){_0x4a65fe[_0x824f('0x1f')](0xcc)[_0x824f('0x2b')]();});}};}function handleEntityNotFound(_0x455f1a,_0x58a5dd){return function(_0x2f171f){if(!_0x2f171f){_0x455f1a[_0x824f('0x1e')](0x194);}return _0x2f171f;};}function handleError(_0x2dd884,_0x27e76b){_0x27e76b=_0x27e76b||0x1f4;return function(_0x5058ce){logger[_0x824f('0x2c')](_0x5058ce[_0x824f('0x2d')]);if(_0x5058ce[_0x824f('0x2e')]){delete _0x5058ce[_0x824f('0x2e')];}_0x2dd884[_0x824f('0x1f')](_0x27e76b)['send'](_0x5058ce);};}exports['index']=function(_0x5951f0,_0x266084){var _0x242eb2={},_0x5205e8={},_0x28130c={'count':0x0,'rows':[]};var _0xf709a7=_[_0x824f('0x2f')](db[_0x824f('0x30')][_0x824f('0x31')],function(_0x317c4b){return{'name':_0x317c4b[_0x824f('0x32')],'type':_0x317c4b[_0x824f('0x33')][_0x824f('0x34')]};});_0x5205e8['model']=_[_0x824f('0x2f')](_0xf709a7,_0x824f('0x2e'));_0x5205e8['query']=_[_0x824f('0x35')](_0x5951f0[_0x824f('0x36')]);_0x5205e8[_0x824f('0x37')]=_[_0x824f('0x38')](_0x5205e8[_0x824f('0x39')],_0x5205e8['query']);_0x242eb2[_0x824f('0x3a')]=_[_0x824f('0x38')](_0x5205e8[_0x824f('0x39')],qs['fields'](_0x5951f0[_0x824f('0x36')][_0x824f('0x3b')]));_0x242eb2['attributes']=_0x242eb2[_0x824f('0x3a')][_0x824f('0x3c')]?_0x242eb2[_0x824f('0x3a')]:_0x5205e8['model'];if(!_0x5951f0['query'][_0x824f('0x3d')](_0x824f('0x3e'))){_0x242eb2[_0x824f('0x3f')]=qs['limit'](_0x5951f0[_0x824f('0x36')][_0x824f('0x3f')]);_0x242eb2[_0x824f('0x23')]=qs['offset'](_0x5951f0[_0x824f('0x36')][_0x824f('0x23')]);}_0x242eb2[_0x824f('0x40')]=qs[_0x824f('0x41')](_0x5951f0[_0x824f('0x36')][_0x824f('0x41')]);_0x242eb2[_0x824f('0x42')]=qs[_0x824f('0x37')](_['pick'](_0x5951f0['query'],_0x5205e8['filters']),_0xf709a7);if(_0x5951f0[_0x824f('0x36')][_0x824f('0x43')]){_0x242eb2[_0x824f('0x42')]=_[_0x824f('0x44')](_0x242eb2[_0x824f('0x42')],{'$or':_[_0x824f('0x2f')](_0xf709a7,function(_0x151d3d){if(_0x151d3d[_0x824f('0x33')]!==_0x824f('0x45')){var _0x3f47e0={};_0x3f47e0[_0x151d3d[_0x824f('0x2e')]]={'$like':'%'+_0x5951f0[_0x824f('0x36')]['filter']+'%'};return _0x3f47e0;}})});}_0x242eb2=_['merge']({},_0x242eb2,_0x5951f0[_0x824f('0x46')]);var _0x415ea8={'where':_0x242eb2[_0x824f('0x42')]};return db[_0x824f('0x30')][_0x824f('0x22')](_0x415ea8)[_0x824f('0x29')](function(_0x3d1d61){_0x28130c[_0x824f('0x22')]=_0x3d1d61;if(_0x5951f0[_0x824f('0x36')][_0x824f('0x47')]){_0x242eb2['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x824f('0x48')](_0x242eb2);})['then'](function(_0x8be45){_0x28130c['rows']=_0x8be45;return _0x28130c;})[_0x824f('0x29')](respondWithFilteredResult(_0x266084,_0x242eb2))[_0x824f('0x49')](handleError(_0x266084,null));};exports[_0x824f('0x4a')]=function(_0x37c10e,_0xb6e09a){var _0xf9b3fe={'raw':![],'where':{'id':_0x37c10e[_0x824f('0x4b')]['id']}},_0x59cc9f={};_0x59cc9f[_0x824f('0x39')]=_[_0x824f('0x35')](db[_0x824f('0x30')][_0x824f('0x31')]);_0x59cc9f[_0x824f('0x36')]=_[_0x824f('0x35')](_0x37c10e['query']);_0x59cc9f[_0x824f('0x37')]=_[_0x824f('0x38')](_0x59cc9f[_0x824f('0x39')],_0x59cc9f[_0x824f('0x36')]);_0xf9b3fe[_0x824f('0x3a')]=_['intersection'](_0x59cc9f[_0x824f('0x39')],qs[_0x824f('0x3b')](_0x37c10e['query'][_0x824f('0x3b')]));_0xf9b3fe[_0x824f('0x3a')]=_0xf9b3fe[_0x824f('0x3a')][_0x824f('0x3c')]?_0xf9b3fe[_0x824f('0x3a')]:_0x59cc9f['model'];if(_0x37c10e['query']['includeAll']){_0xf9b3fe['include']=[{'all':!![]}];}_0xf9b3fe=_['merge']({},_0xf9b3fe,_0x37c10e[_0x824f('0x46')]);return db[_0x824f('0x30')]['find'](_0xf9b3fe)['then'](handleEntityNotFound(_0xb6e09a,null))[_0x824f('0x29')](respondWithResult(_0xb6e09a,null))[_0x824f('0x49')](handleError(_0xb6e09a,null));};exports[_0x824f('0x4c')]=function(_0x38a802,_0x47944f){return db[_0x824f('0x30')][_0x824f('0x4c')](_0x38a802[_0x824f('0x4d')],{})[_0x824f('0x29')](respondWithResult(_0x47944f,0xc9))['catch'](handleError(_0x47944f,null));};exports['update']=function(_0x5b7830,_0x3494e8){if(_0x5b7830['body']['id']){delete _0x5b7830[_0x824f('0x4d')]['id'];}return db['VoiceQueueReport'][_0x824f('0x4e')]({'where':{'id':_0x5b7830[_0x824f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3494e8,null))['then'](saveUpdates(_0x5b7830['body'],null))[_0x824f('0x29')](respondWithResult(_0x3494e8,null))[_0x824f('0x49')](handleError(_0x3494e8,null));};exports[_0x824f('0x2a')]=function(_0x5037a6,_0x48f776){return db[_0x824f('0x30')][_0x824f('0x4e')]({'where':{'id':_0x5037a6[_0x824f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48f776,null))['then'](removeEntity(_0x48f776,null))[_0x824f('0x49')](handleError(_0x48f776,null));};exports[_0x824f('0x4f')]=function(_0x24590d,_0x45df28){return db[_0x824f('0x30')][_0x824f('0x4f')]()['then'](respondWithResult(_0x45df28,null))[_0x824f('0x49')](handleError(_0x45df28,null));};exports[_0x824f('0x50')]=function(_0x1130ec,_0x593d67){var _0x1c94d6={},_0x9f29b8={},_0x43b701={'count':0x0,'rows':[]};_0x9f29b8['model']=_[_0x824f('0x35')](db[_0x824f('0x30')][_0x824f('0x31')]);_0x9f29b8[_0x824f('0x36')]=_['keys'](_0x1130ec[_0x824f('0x36')]);_0x9f29b8[_0x824f('0x37')]=_[_0x824f('0x38')](_0x9f29b8['model'],_0x9f29b8[_0x824f('0x36')]);_0x1c94d6['attributes']=_[_0x824f('0x38')](_0x9f29b8[_0x824f('0x39')],qs['fields'](_0x1130ec['query']['fields']));_0x1c94d6['attributes']=_0x1c94d6['attributes'][_0x824f('0x3c')]?_0x1c94d6['attributes']:_0x9f29b8[_0x824f('0x39')];if(!_0x1130ec[_0x824f('0x36')][_0x824f('0x3d')]('nolimit')){_0x1c94d6[_0x824f('0x3f')]=qs['limit'](_0x1130ec[_0x824f('0x36')]['limit']);_0x1c94d6[_0x824f('0x23')]=qs[_0x824f('0x23')](_0x1130ec['query']['offset']);}_0x1c94d6[_0x824f('0x40')]=qs[_0x824f('0x41')](_0x1130ec[_0x824f('0x36')][_0x824f('0x41')]);_0x1c94d6[_0x824f('0x42')]=qs[_0x824f('0x37')](_[_0x824f('0x51')](_0x1130ec['query'],_0x9f29b8['filters']));if(_0x1130ec['query']['filter']){_0x1c94d6[_0x824f('0x42')]=_['merge'](_0x1c94d6[_0x824f('0x42')],{'$or':_['map'](_0x1c94d6[_0x824f('0x3a')],function(_0x5831db){var _0x31c882={};_0x31c882[_0x5831db]={'$like':'%'+_0x1130ec[_0x824f('0x36')][_0x824f('0x43')]+'%'};return _0x31c882;})});}_0x1c94d6=_['merge']({},_0x1c94d6,_0x1130ec[_0x824f('0x46')]);var _0x2b2e88={'where':_0x1c94d6[_0x824f('0x42')]};return db[_0x824f('0x30')][_0x824f('0x22')](_0x2b2e88)[_0x824f('0x29')](function(_0xd0d4f3){_0x43b701['count']=_0xd0d4f3;if(_0x1130ec['query'][_0x824f('0x47')]){_0x1c94d6[_0x824f('0x52')]=[{'all':!![]}];}return db[_0x824f('0x30')][_0x824f('0x48')](_0x1c94d6);})[_0x824f('0x29')](function(_0x5d49aa){_0x43b701[_0x824f('0x53')]=_0x5d49aa;return _0x43b701;})['then'](respondWithFilteredResult(_0x593d67,_0x1c94d6,_0x824f('0x50')))[_0x824f('0x49')](handleError(_0x593d67,null,_0x824f('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 11d9a05..d25b1e5 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 _0xa50e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa50e,0x114));var _0xea50=function(_0x495b13,_0x552f7f){_0x495b13=_0x495b13-0x0;var _0xaabe33=_0xa50e[_0x495b13];return _0xaabe33;};'use strict';var EventEmitter=require(_0xea50('0x0'));var VoiceQueueReport=require(_0xea50('0x1'))['db'][_0xea50('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xea50('0x3')};function emitEvent(_0x4086d4){return function(_0x3d7aaf,_0x7df20c,_0x5124af){VoiceQueueReportEvents['emit'](_0x4086d4+':'+_0x3d7aaf['id'],_0x3d7aaf);VoiceQueueReportEvents[_0xea50('0x4')](_0x4086d4,_0x3d7aaf);_0x5124af(null);};}for(var e in events){if(events[_0xea50('0x5')](e)){var event=events[e];VoiceQueueReport[_0xea50('0x6')](e,emitEvent(event));}}module[_0xea50('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb552=['VoiceQueueReport','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb552,0xa6));var _0x2b55=function(_0x46b64f,_0x409b00){_0x46b64f=_0x46b64f-0x0;var _0x6b993=_0xb552[_0x46b64f];return _0x6b993;};'use strict';var EventEmitter=require(_0x2b55('0x0'));var VoiceQueueReport=require(_0x2b55('0x1'))['db'][_0x2b55('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2b55('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b55('0x4'),'afterDestroy':_0x2b55('0x5')};function emitEvent(_0x4346d2){return function(_0x2c059a,_0x53f647,_0x3633c3){VoiceQueueReportEvents[_0x2b55('0x6')](_0x4346d2+':'+_0x2c059a['id'],_0x2c059a);VoiceQueueReportEvents['emit'](_0x4346d2,_0x2c059a);_0x3633c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x2b55('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index cd7137a..9549231 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 _0x6bf2=['request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x5c9f5d,_0x283367){var _0x33be48=function(_0x314c1d){while(--_0x314c1d){_0x5c9f5d['push'](_0x5c9f5d['shift']());}};_0x33be48(++_0x283367);}(_0x6bf2,0x1e6));var _0x26bf=function(_0x4a176c,_0x373ec1){_0x4a176c=_0x4a176c-0x0;var _0x27ab25=_0x6bf2[_0x4a176c];return _0x27ab25;};'use strict';var _=require(_0x26bf('0x0'));var util=require('util');var logger=require(_0x26bf('0x1'))(_0x26bf('0x2'));var moment=require(_0x26bf('0x3'));var BPromise=require('bluebird');var rp=require(_0x26bf('0x4'));var fs=require('fs');var path=require(_0x26bf('0x5'));var rimraf=require(_0x26bf('0x6'));var config=require(_0x26bf('0x7'));var attributes=require(_0x26bf('0x8'));module[_0x26bf('0x9')]=function(_0x4b3d06,_0x1f792d){return _0x4b3d06[_0x26bf('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x26bf('0xb'),'paranoid':![],'indexes':[{'fields':[_0x26bf('0xc')]},{'fields':[_0x26bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7fb=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x52ee36,_0xc17525){var _0x1b2267=function(_0x2f821e){while(--_0x2f821e){_0x52ee36['push'](_0x52ee36['shift']());}};_0x1b2267(++_0xc17525);}(_0xf7fb,0x88));var _0xbf7f=function(_0x3056ca,_0x566e0b){_0x3056ca=_0x3056ca-0x0;var _0x9b3701=_0xf7fb[_0x3056ca];return _0x9b3701;};'use strict';var _=require(_0xbf7f('0x0'));var util=require(_0xbf7f('0x1'));var logger=require(_0xbf7f('0x2'))('api');var moment=require(_0xbf7f('0x3'));var BPromise=require(_0xbf7f('0x4'));var rp=require(_0xbf7f('0x5'));var fs=require('fs');var path=require(_0xbf7f('0x6'));var rimraf=require(_0xbf7f('0x7'));var config=require(_0xbf7f('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xbf7f('0x9')]=function(_0x3d8772,_0x3ca4f8){return _0x3d8772[_0xbf7f('0xa')](_0xbf7f('0xb'),attributes,{'tableName':_0xbf7f('0xc'),'paranoid':![],'indexes':[{'fields':[_0xbf7f('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d9394bd..b346fa3 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 _0x9c34=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','stringify','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','where','UpdateVoiceQueueReport','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9c34,0xb0));var _0x49c3=function(_0x4595fd,_0x4aa9b2){_0x4595fd=_0x4595fd-0x0;var _0x1d41fe=_0x9c34[_0x4595fd];return _0x1d41fe;};'use strict';var _=require('lodash');var util=require(_0x49c3('0x0'));var moment=require('moment');var BPromise=require(_0x49c3('0x1'));var rs=require(_0x49c3('0x2'));var fs=require('fs');var Redis=require(_0x49c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x49c3('0x4'));var config=require(_0x49c3('0x5'));var jayson=require(_0x49c3('0x6'));var client=jayson['client'][_0x49c3('0x7')]({'port':0x232a});config[_0x49c3('0x8')]=_[_0x49c3('0x9')](config[_0x49c3('0x8')],{'host':_0x49c3('0xa'),'port':0x18eb});var socket=require(_0x49c3('0xb'))(new Redis(config['redis']));require(_0x49c3('0xc'))[_0x49c3('0xd')](socket);function respondWithRpcPromise(_0x566f4d,_0x32a7e5,_0x39760b){return new BPromise(function(_0x5d5bfc,_0x1f6670){return client[_0x49c3('0xe')](_0x566f4d,_0x39760b)[_0x49c3('0xf')](function(_0x49af72){logger[_0x49c3('0x10')](_0x49c3('0x11'),_0x32a7e5,'request\x20sent');logger[_0x49c3('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x32a7e5,'request\x20sent',JSON[_0x49c3('0x13')](_0x49af72));if(_0x49af72[_0x49c3('0x14')]){if(_0x49af72[_0x49c3('0x14')]['code']===0x1f4){logger[_0x49c3('0x14')](_0x49c3('0x11'),_0x32a7e5,_0x49af72[_0x49c3('0x14')]['message']);return _0x1f6670(_0x49af72[_0x49c3('0x14')][_0x49c3('0x15')]);}logger['error'](_0x49c3('0x11'),_0x32a7e5,_0x49af72['error'][_0x49c3('0x15')]);return _0x5d5bfc(_0x49af72[_0x49c3('0x14')][_0x49c3('0x15')]);}else{logger[_0x49c3('0x10')](_0x49c3('0x11'),_0x32a7e5,'request\x20sent');_0x5d5bfc(_0x49af72['result'][_0x49c3('0x15')]);}})[_0x49c3('0x16')](function(_0x1e45fc){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x32a7e5,_0x1e45fc);_0x1f6670(_0x1e45fc);});});}exports[_0x49c3('0x17')]=function(_0xab9b82){var _0x484ddb=this;return new Promise(function(_0x12d2cf,_0x2e851b){return db[_0x49c3('0x18')][_0x49c3('0x19')]({'raw':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1b')]===undefined?!![]:![]:!![],'where':_0xab9b82['options']?_0xab9b82[_0x49c3('0x1a')]['where']||null:null,'attributes':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1c')]||null:null,'limit':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1d')]||null:null,'include':_0xab9b82[_0x49c3('0x1a')]?_0xab9b82[_0x49c3('0x1a')][_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0xab9b82['options'][_0x49c3('0x1e')],function(_0x2c3de4){return{'model':db[_0x2c3de4[_0x49c3('0x20')]],'as':_0x2c3de4['as'],'attributes':_0x2c3de4[_0x49c3('0x1c')],'include':_0x2c3de4[_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0x2c3de4['include'],function(_0x1bc27d){return{'model':db[_0x1bc27d[_0x49c3('0x20')]],'as':_0x1bc27d['as'],'attributes':_0x1bc27d[_0x49c3('0x1c')],'include':_0x1bc27d[_0x49c3('0x1e')]?_[_0x49c3('0x1f')](_0x1bc27d[_0x49c3('0x1e')],function(_0x4e1817){return{'model':db[_0x4e1817[_0x49c3('0x20')]],'as':_0x4e1817['as'],'attributes':_0x4e1817[_0x49c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x49c3('0xf')](function(_0xdc088a){logger[_0x49c3('0x10')](_0x49c3('0x17'),_0xab9b82);logger[_0x49c3('0x12')](_0x49c3('0x17'),_0xab9b82,JSON[_0x49c3('0x13')](_0xdc088a));_0x12d2cf(_0xdc088a);})['catch'](function(_0x458c4a){logger[_0x49c3('0x14')](_0x49c3('0x17'),_0x458c4a[_0x49c3('0x15')],_0xab9b82);_0x2e851b(_0x484ddb[_0x49c3('0x14')](0x1f4,_0x458c4a[_0x49c3('0x15')]));});});};exports[_0x49c3('0x21')]=function(_0x21ebfb){var _0x55b0d4=this;return new Promise(function(_0x31d1ee,_0x3f0c3d){return db[_0x49c3('0x18')][_0x49c3('0x22')](_0x21ebfb['body'],{'raw':_0x21ebfb[_0x49c3('0x1a')]?_0x21ebfb[_0x49c3('0x1a')][_0x49c3('0x1b')]===undefined?!![]:![]:!![]})[_0x49c3('0xf')](function(_0x39019e){logger[_0x49c3('0x10')]('CreateVoiceQueueReport',_0x21ebfb);logger['debug'](_0x49c3('0x21'),_0x21ebfb,JSON['stringify'](_0x39019e));_0x31d1ee(_0x39019e);})[_0x49c3('0x16')](function(_0xc81e5e){logger[_0x49c3('0x14')](_0x49c3('0x21'),_0xc81e5e['message'],_0x21ebfb);_0x3f0c3d(_0x55b0d4['error'](0x1f4,_0xc81e5e[_0x49c3('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x53926b){var _0x2557fd=this;return new Promise(function(_0x3e295c,_0x459254){return db[_0x49c3('0x18')]['update'](_0x53926b[_0x49c3('0x23')],{'raw':_0x53926b['options']?_0x53926b['options'][_0x49c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53926b['options']?_0x53926b[_0x49c3('0x1a')][_0x49c3('0x24')]||null:null,'attributes':_0x53926b['options']?_0x53926b['options']['attributes']||null:null,'limit':_0x53926b[_0x49c3('0x1a')]?_0x53926b[_0x49c3('0x1a')][_0x49c3('0x1d')]||null:null})[_0x49c3('0xf')](function(_0x326c55){logger[_0x49c3('0x10')](_0x49c3('0x25'),_0x53926b);logger[_0x49c3('0x12')]('UpdateVoiceQueueReport',_0x53926b,JSON[_0x49c3('0x13')](_0x326c55));_0x3e295c(_0x326c55);})['catch'](function(_0x54c4de){logger[_0x49c3('0x14')](_0x49c3('0x25'),_0x54c4de[_0x49c3('0x15')],_0x53926b);_0x459254(_0x2557fd[_0x49c3('0x14')](0x1f4,_0x54c4de[_0x49c3('0x15')]));});});}; \ No newline at end of file +var _0x2ac0=['UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','debug','CreateVoiceQueueReport','body','raw','stringify','catch'];(function(_0x8a41f4,_0x2a9e6c){var _0x591afe=function(_0x1ee183){while(--_0x1ee183){_0x8a41f4['push'](_0x8a41f4['shift']());}};_0x591afe(++_0x2a9e6c);}(_0x2ac0,0x7e));var _0x02ac=function(_0x36d574,_0x3578c3){_0x36d574=_0x36d574-0x0;var _0x12ab7d=_0x2ac0[_0x36d574];return _0x12ab7d;};'use strict';var _=require(_0x02ac('0x0'));var util=require(_0x02ac('0x1'));var moment=require(_0x02ac('0x2'));var BPromise=require(_0x02ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02ac('0x4'));var logger=require('../../config/logger')(_0x02ac('0x5'));var config=require(_0x02ac('0x6'));var jayson=require(_0x02ac('0x7'));var client=jayson['client'][_0x02ac('0x8')]({'port':0x232a});config[_0x02ac('0x9')]=_['defaults'](config['redis'],{'host':_0x02ac('0xa'),'port':0x18eb});var socket=require(_0x02ac('0xb'))(new Redis(config[_0x02ac('0x9')]));require(_0x02ac('0xc'))[_0x02ac('0xd')](socket);function respondWithRpcPromise(_0x2e026e,_0x382e8b,_0xf67ab3){return new BPromise(function(_0x4dc51f,_0x2b6581){return client[_0x02ac('0xe')](_0x2e026e,_0xf67ab3)[_0x02ac('0xf')](function(_0x295877){logger[_0x02ac('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x382e8b,_0x02ac('0x11'));logger['debug'](_0x02ac('0x12'),_0x382e8b,'request\x20sent',JSON['stringify'](_0x295877));if(_0x295877[_0x02ac('0x13')]){if(_0x295877[_0x02ac('0x13')]['code']===0x1f4){logger['error'](_0x02ac('0x14'),_0x382e8b,_0x295877[_0x02ac('0x13')]['message']);return _0x2b6581(_0x295877[_0x02ac('0x13')][_0x02ac('0x15')]);}logger[_0x02ac('0x13')](_0x02ac('0x14'),_0x382e8b,_0x295877[_0x02ac('0x13')]['message']);return _0x4dc51f(_0x295877[_0x02ac('0x13')][_0x02ac('0x15')]);}else{logger[_0x02ac('0x10')](_0x02ac('0x14'),_0x382e8b,_0x02ac('0x11'));_0x4dc51f(_0x295877[_0x02ac('0x16')][_0x02ac('0x15')]);}})['catch'](function(_0x2f2e67){logger[_0x02ac('0x13')](_0x02ac('0x14'),_0x382e8b,_0x2f2e67);_0x2b6581(_0x2f2e67);});});}exports[_0x02ac('0x17')]=function(_0x160777){var _0x25c4b0=this;return new Promise(function(_0xeacba1,_0x8d13f9){return db[_0x02ac('0x18')][_0x02ac('0x19')]({'raw':_0x160777['options']?_0x160777['options']['raw']===undefined?!![]:![]:!![],'where':_0x160777[_0x02ac('0x1a')]?_0x160777[_0x02ac('0x1a')][_0x02ac('0x1b')]||null:null,'attributes':_0x160777['options']?_0x160777[_0x02ac('0x1a')][_0x02ac('0x1c')]||null:null,'limit':_0x160777['options']?_0x160777['options']['limit']||null:null,'include':_0x160777[_0x02ac('0x1a')]?_0x160777[_0x02ac('0x1a')][_0x02ac('0x1d')]?_[_0x02ac('0x1e')](_0x160777['options'][_0x02ac('0x1d')],function(_0x3615d1){return{'model':db[_0x3615d1[_0x02ac('0x1f')]],'as':_0x3615d1['as'],'attributes':_0x3615d1[_0x02ac('0x1c')],'include':_0x3615d1[_0x02ac('0x1d')]?_['map'](_0x3615d1[_0x02ac('0x1d')],function(_0x1a65d4){return{'model':db[_0x1a65d4['model']],'as':_0x1a65d4['as'],'attributes':_0x1a65d4[_0x02ac('0x1c')],'include':_0x1a65d4['include']?_[_0x02ac('0x1e')](_0x1a65d4[_0x02ac('0x1d')],function(_0x483ac8){return{'model':db[_0x483ac8[_0x02ac('0x1f')]],'as':_0x483ac8['as'],'attributes':_0x483ac8['attributes']};}):[]};}):[]};}):[]:[]})[_0x02ac('0xf')](function(_0xeafdd2){logger['info'](_0x02ac('0x17'),_0x160777);logger[_0x02ac('0x20')](_0x02ac('0x17'),_0x160777,JSON['stringify'](_0xeafdd2));_0xeacba1(_0xeafdd2);})['catch'](function(_0x5f471c){logger[_0x02ac('0x13')](_0x02ac('0x17'),_0x5f471c[_0x02ac('0x15')],_0x160777);_0x8d13f9(_0x25c4b0[_0x02ac('0x13')](0x1f4,_0x5f471c[_0x02ac('0x15')]));});});};exports[_0x02ac('0x21')]=function(_0x395547){var _0x499583=this;return new Promise(function(_0xe6608b,_0x403e8f){return db[_0x02ac('0x18')]['create'](_0x395547[_0x02ac('0x22')],{'raw':_0x395547[_0x02ac('0x1a')]?_0x395547[_0x02ac('0x1a')][_0x02ac('0x23')]===undefined?!![]:![]:!![]})[_0x02ac('0xf')](function(_0x2da155){logger['info']('CreateVoiceQueueReport',_0x395547);logger[_0x02ac('0x20')](_0x02ac('0x21'),_0x395547,JSON[_0x02ac('0x24')](_0x2da155));_0xe6608b(_0x2da155);})[_0x02ac('0x25')](function(_0x1cc58d){logger[_0x02ac('0x13')](_0x02ac('0x21'),_0x1cc58d[_0x02ac('0x15')],_0x395547);_0x403e8f(_0x499583['error'](0x1f4,_0x1cc58d[_0x02ac('0x15')]));});});};exports[_0x02ac('0x26')]=function(_0x35c614){var _0x9580c3=this;return new Promise(function(_0x4c7fe1,_0x152dfc){return db['VoiceQueueReport'][_0x02ac('0x27')](_0x35c614[_0x02ac('0x22')],{'raw':_0x35c614[_0x02ac('0x1a')]?_0x35c614[_0x02ac('0x1a')][_0x02ac('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c614['options']?_0x35c614[_0x02ac('0x1a')][_0x02ac('0x1b')]||null:null,'attributes':_0x35c614[_0x02ac('0x1a')]?_0x35c614['options'][_0x02ac('0x1c')]||null:null,'limit':_0x35c614[_0x02ac('0x1a')]?_0x35c614[_0x02ac('0x1a')][_0x02ac('0x28')]||null:null})[_0x02ac('0xf')](function(_0x3784e8){logger[_0x02ac('0x10')](_0x02ac('0x26'),_0x35c614);logger[_0x02ac('0x20')](_0x02ac('0x26'),_0x35c614,JSON[_0x02ac('0x24')](_0x3784e8));_0x4c7fe1(_0x3784e8);})[_0x02ac('0x25')](function(_0x510ecf){logger['error'](_0x02ac('0x26'),_0x510ecf['message'],_0x35c614);_0x152dfc(_0x9580c3[_0x02ac('0x13')](0x1f4,_0x510ecf[_0x02ac('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 13e5603..8a2b8a7 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ab2=['length','voiceQueueReport:','remove','removeListener'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0ab2,0x92));var _0x20ab=function(_0x546f5c,_0x2fc6f5){_0x546f5c=_0x546f5c-0x0;var _0x1c75d9=_0x0ab2[_0x546f5c];return _0x1c75d9;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x20ab('0x0'),'update'];function createListener(_0x226a0c,_0x1d5bee){return function(_0x4bdd70){_0x1d5bee['emit'](_0x226a0c,_0x4bdd70);};}function removeListener(_0x2aa2b9,_0x58f8d6){return function(){VoiceQueueReportEvents[_0x20ab('0x1')](_0x2aa2b9,_0x58f8d6);};}exports['register']=function(_0x44fdb2){for(var _0x259548=0x0,_0x30e71e=events[_0x20ab('0x2')];_0x259548<_0x30e71e;_0x259548++){var _0xf14695=events[_0x259548];var _0x11d689=createListener(_0x20ab('0x3')+_0xf14695,_0x44fdb2);VoiceQueueReportEvents['on'](_0xf14695,_0x11d689);}}; \ No newline at end of file +var _0x7d9f=['./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x47bad0,_0x585da3){var _0xff2814=function(_0x535cf3){while(--_0x535cf3){_0x47bad0['push'](_0x47bad0['shift']());}};_0xff2814(++_0x585da3);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3241f3,_0x537340){_0x3241f3=_0x3241f3-0x0;var _0x29ac16=_0x7d9f[_0x3241f3];return _0x29ac16;};'use strict';var VoiceQueueReportEvents=require(_0xf7d9('0x0'));var events=[_0xf7d9('0x1'),_0xf7d9('0x2'),_0xf7d9('0x3')];function createListener(_0x265b56,_0x538e69){return function(_0x15a23b){_0x538e69[_0xf7d9('0x4')](_0x265b56,_0x15a23b);};}function removeListener(_0xd43b74,_0x159e95){return function(){VoiceQueueReportEvents[_0xf7d9('0x5')](_0xd43b74,_0x159e95);};}exports['register']=function(_0x4b50c7){for(var _0x2eb0f1=0x0,_0x250675=events['length'];_0x2eb0f1<_0x250675;_0x2eb0f1++){var _0x21c654=events[_0x2eb0f1];var _0x1685a6=createListener('voiceQueueReport:'+_0x21c654,_0x4b50c7);VoiceQueueReportEvents['on'](_0x21c654,_0x1685a6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7f00bd9..0d90c7e 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 _0xbae2=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x3e4667,_0x159f55){var _0x89df4e=function(_0x49fdf8){while(--_0x49fdf8){_0x3e4667['push'](_0x3e4667['shift']());}};_0x89df4e(++_0x159f55);}(_0xbae2,0x1da));var _0x2bae=function(_0x1bbc72,_0x103c1c){_0x1bbc72=_0x1bbc72-0x0;var _0x275b7a=_0xbae2[_0x1bbc72];return _0x275b7a;};'use strict';var multer=require('multer');var util=require(_0x2bae('0x0'));var path=require(_0x2bae('0x1'));var timeout=require(_0x2bae('0x2'));var express=require(_0x2bae('0x3'));var router=express['Router']();var fs_extra=require(_0x2bae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2bae('0x5'));var config=require(_0x2bae('0x6'));var controller=require(_0x2bae('0x7'));router[_0x2bae('0x8')]('/',auth[_0x2bae('0x9')](),controller['index']);router[_0x2bae('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2bae('0x9')](),controller[_0x2bae('0xa')]);router['put'](_0x2bae('0xb'),auth[_0x2bae('0x9')](),controller[_0x2bae('0xc')]);router[_0x2bae('0xd')](_0x2bae('0xb'),auth[_0x2bae('0x9')](),controller[_0x2bae('0xe')]);module[_0x2bae('0xf')]=router; \ No newline at end of file +var _0x1ca3=['/:id','show','post','put','isAuthenticated','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get'];(function(_0x270f8a,_0x244465){var _0x47b51e=function(_0x5200a2){while(--_0x5200a2){_0x270f8a['push'](_0x270f8a['shift']());}};_0x47b51e(++_0x244465);}(_0x1ca3,0x6e));var _0x31ca=function(_0x59fb38,_0x2535f9){_0x59fb38=_0x59fb38-0x0;var _0x12f35f=_0x1ca3[_0x59fb38];return _0x12f35f;};'use strict';var multer=require(_0x31ca('0x0'));var util=require(_0x31ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31ca('0x2'));var router=express[_0x31ca('0x3')]();var fs_extra=require(_0x31ca('0x4'));var auth=require(_0x31ca('0x5'));var interaction=require(_0x31ca('0x6'));var config=require('../../config/environment');var controller=require(_0x31ca('0x7'));router[_0x31ca('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x31ca('0x8')](_0x31ca('0x9'),auth['isAuthenticated'](),controller[_0x31ca('0xa')]);router[_0x31ca('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x31ca('0xc')](_0x31ca('0x9'),auth[_0x31ca('0xd')](),controller[_0x31ca('0xe')]);router['delete'](_0x31ca('0x9'),auth[_0x31ca('0xd')](),controller[_0x31ca('0xf')]);module[_0x31ca('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ea51957..52c56e3 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 _0x1986=['sequelize','moment','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x5abb9c,_0x32f2eb){var _0x33916e=function(_0x1f45ef){while(--_0x1f45ef){_0x5abb9c['push'](_0x5abb9c['shift']());}};_0x33916e(++_0x32f2eb);}(_0x1986,0x177));var _0x6198=function(_0x308404,_0x5dbabc){_0x308404=_0x308404-0x0;var _0x183539=_0x1986[_0x308404];return _0x183539;};'use strict';var Sequelize=require(_0x6198('0x0'));var moment=require(_0x6198('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6198('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6198('0x3')](_0x6198('0x4'))}}; \ No newline at end of file +var _0x3285=['sequelize','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3285,0x195));var _0x5328=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x3285[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x5328('0x0'));var moment=require('moment');module[_0x5328('0x1')]={'time':{'type':Sequelize[_0x5328('0x2')]},'callid':{'type':Sequelize[_0x5328('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5328('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5328('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5328('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5328('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5328('0x3')](_0x5328('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4353556..f38daae 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 _0xc3f4=['../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','VoiceQueuesLog','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','update','find','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc3f4,0x7c));var _0x4c3f=function(_0x379960,_0x5dc1ba){_0x379960=_0x379960-0x0;var _0x23abec=_0xc3f4[_0x379960];return _0x23abec;};'use strict';var emlformat=require(_0x4c3f('0x0'));var rimraf=require(_0x4c3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c3f('0x2'));var moment=require('moment');var BPromise=require(_0x4c3f('0x3'));var Mustache=require(_0x4c3f('0x4'));var util=require('util');var path=require(_0x4c3f('0x5'));var sox=require('sox');var csv=require(_0x4c3f('0x6'));var ejs=require(_0x4c3f('0x7'));var fs=require('fs');var fs_extra=require(_0x4c3f('0x8'));var _=require(_0x4c3f('0x9'));var squel=require('squel');var crypto=require(_0x4c3f('0xa'));var jsforce=require(_0x4c3f('0xb'));var deskjs=require(_0x4c3f('0xc'));var toCsv=require(_0x4c3f('0x6'));var querystring=require(_0x4c3f('0xd'));var Papa=require('papaparse');var Redis=require(_0x4c3f('0xe'));var authService=require(_0x4c3f('0xf'));var qs=require(_0x4c3f('0x10'));var as=require(_0x4c3f('0x11'));var hardwareService=require(_0x4c3f('0x12'));var logger=require('../../config/logger')(_0x4c3f('0x13'));var utils=require('../../config/utils');var config=require(_0x4c3f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d2b1,_0x2289f1){_0x2289f1=_0x2289f1||0xcc;return function(_0x3becc7){if(_0x3becc7){return _0x38d2b1['sendStatus'](_0x2289f1);}return _0x38d2b1[_0x4c3f('0x15')](_0x2289f1)[_0x4c3f('0x16')]();};}function respondWithResult(_0x5618fd,_0x2da6ff){_0x2da6ff=_0x2da6ff||0xc8;return function(_0x3fc455){if(_0x3fc455){return _0x5618fd[_0x4c3f('0x15')](_0x2da6ff)[_0x4c3f('0x17')](_0x3fc455);}};}function respondWithFilteredResult(_0x5e062f,_0x464a62){return function(_0x42c349){if(_0x42c349){var _0x1e852c=typeof _0x464a62[_0x4c3f('0x18')]===_0x4c3f('0x19')&&typeof _0x464a62[_0x4c3f('0x1a')]===_0x4c3f('0x19');var _0x5e8b43=_0x42c349[_0x4c3f('0x1b')];var _0x4a0ae4=_0x1e852c?0x0:_0x464a62['offset'];var _0xdd89a1=_0x1e852c?_0x42c349[_0x4c3f('0x1b')]:_0x464a62['offset']+_0x464a62['limit'];var _0x34913a;if(_0xdd89a1>=_0x5e8b43){_0xdd89a1=_0x5e8b43;_0x34913a=0xc8;}else{_0x34913a=0xce;}_0x5e062f[_0x4c3f('0x15')](_0x34913a);return _0x5e062f[_0x4c3f('0x1c')](_0x4c3f('0x1d'),_0x4a0ae4+'-'+_0xdd89a1+'/'+_0x5e8b43)['json'](_0x42c349);}return null;};}function patchUpdates(_0x3024b1){return function(_0x2db1bf){try{jsonpatch[_0x4c3f('0x1e')](_0x2db1bf,_0x3024b1,!![]);}catch(_0x2de669){return BPromise[_0x4c3f('0x1f')](_0x2de669);}return _0x2db1bf[_0x4c3f('0x20')]();};}function saveUpdates(_0x44970c,_0x2d2da5){return function(_0x4570db){if(_0x4570db){return _0x4570db['update'](_0x44970c)[_0x4c3f('0x21')](function(_0xd6f406){return _0xd6f406;});}return null;};}function removeEntity(_0x5d3a34,_0x28c6c4){return function(_0x51939e){if(_0x51939e){return _0x51939e[_0x4c3f('0x22')]()[_0x4c3f('0x21')](function(){_0x5d3a34[_0x4c3f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491f2c,_0x28ae59){return function(_0x5f49b9){if(!_0x5f49b9){_0x491f2c[_0x4c3f('0x23')](0x194);}return _0x5f49b9;};}function handleError(_0x39d36d,_0x1a6d5e){_0x1a6d5e=_0x1a6d5e||0x1f4;return function(_0x510c69){logger['error'](_0x510c69[_0x4c3f('0x24')]);if(_0x510c69[_0x4c3f('0x25')]){delete _0x510c69[_0x4c3f('0x25')];}_0x39d36d[_0x4c3f('0x15')](_0x1a6d5e)[_0x4c3f('0x26')](_0x510c69);};}exports[_0x4c3f('0x27')]=function(_0x4dcad6,_0x5ae9f){var _0x3a8b3d={},_0x419ce0={},_0x438fbb={'count':0x0,'rows':[]};var _0x2f9ef1=_[_0x4c3f('0x28')](db[_0x4c3f('0x29')]['rawAttributes'],function(_0x2ac87b){return{'name':_0x2ac87b['fieldName'],'type':_0x2ac87b['type'][_0x4c3f('0x2a')]};});_0x419ce0['model']=_[_0x4c3f('0x28')](_0x2f9ef1,_0x4c3f('0x25'));_0x419ce0[_0x4c3f('0x2b')]=_[_0x4c3f('0x2c')](_0x4dcad6['query']);_0x419ce0['filters']=_[_0x4c3f('0x2d')](_0x419ce0[_0x4c3f('0x2e')],_0x419ce0[_0x4c3f('0x2b')]);_0x3a8b3d[_0x4c3f('0x2f')]=_[_0x4c3f('0x2d')](_0x419ce0[_0x4c3f('0x2e')],qs[_0x4c3f('0x30')](_0x4dcad6['query']['fields']));_0x3a8b3d[_0x4c3f('0x2f')]=_0x3a8b3d[_0x4c3f('0x2f')][_0x4c3f('0x31')]?_0x3a8b3d[_0x4c3f('0x2f')]:_0x419ce0[_0x4c3f('0x2e')];if(!_0x4dcad6['query'][_0x4c3f('0x32')](_0x4c3f('0x33'))){_0x3a8b3d[_0x4c3f('0x1a')]=qs[_0x4c3f('0x1a')](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x1a')]);_0x3a8b3d[_0x4c3f('0x18')]=qs[_0x4c3f('0x18')](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x18')]);}_0x3a8b3d[_0x4c3f('0x34')]=qs['sort'](_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x35')]);_0x3a8b3d[_0x4c3f('0x36')]=qs['filters'](_[_0x4c3f('0x37')](_0x4dcad6[_0x4c3f('0x2b')],_0x419ce0[_0x4c3f('0x38')]),_0x2f9ef1);if(_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x39')]){_0x3a8b3d[_0x4c3f('0x36')]=_[_0x4c3f('0x3a')](_0x3a8b3d[_0x4c3f('0x36')],{'$or':_[_0x4c3f('0x28')](_0x2f9ef1,function(_0xa26e96){if(_0xa26e96[_0x4c3f('0x3b')]!==_0x4c3f('0x3c')){var _0x1c1261={};_0x1c1261[_0xa26e96[_0x4c3f('0x25')]]={'$like':'%'+_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x39')]+'%'};return _0x1c1261;}})});}_0x3a8b3d=_[_0x4c3f('0x3a')]({},_0x3a8b3d,_0x4dcad6[_0x4c3f('0x3d')]);var _0x120d08={'where':_0x3a8b3d[_0x4c3f('0x36')]};return db[_0x4c3f('0x29')][_0x4c3f('0x1b')](_0x120d08)[_0x4c3f('0x21')](function(_0x43a09e){_0x438fbb[_0x4c3f('0x1b')]=_0x43a09e;if(_0x4dcad6[_0x4c3f('0x2b')][_0x4c3f('0x3e')]){_0x3a8b3d[_0x4c3f('0x3f')]=[{'all':!![]}];}return db[_0x4c3f('0x29')][_0x4c3f('0x40')](_0x3a8b3d);})[_0x4c3f('0x21')](function(_0x25e1d5){_0x438fbb['rows']=_0x25e1d5;return _0x438fbb;})['then'](respondWithFilteredResult(_0x5ae9f,_0x3a8b3d))[_0x4c3f('0x41')](handleError(_0x5ae9f,null));};exports[_0x4c3f('0x42')]=function(_0x45b249,_0x30c100){var _0x485561={'raw':!![],'where':{'id':_0x45b249[_0x4c3f('0x43')]['id']}},_0x19aa62={};_0x19aa62[_0x4c3f('0x2e')]=_[_0x4c3f('0x2c')](db['VoiceQueuesLog']['rawAttributes']);_0x19aa62[_0x4c3f('0x2b')]=_[_0x4c3f('0x2c')](_0x45b249['query']);_0x19aa62[_0x4c3f('0x38')]=_['intersection'](_0x19aa62[_0x4c3f('0x2e')],_0x19aa62[_0x4c3f('0x2b')]);_0x485561[_0x4c3f('0x2f')]=_[_0x4c3f('0x2d')](_0x19aa62[_0x4c3f('0x2e')],qs[_0x4c3f('0x30')](_0x45b249['query'][_0x4c3f('0x30')]));_0x485561[_0x4c3f('0x2f')]=_0x485561['attributes'][_0x4c3f('0x31')]?_0x485561[_0x4c3f('0x2f')]:_0x19aa62[_0x4c3f('0x2e')];if(_0x45b249[_0x4c3f('0x2b')][_0x4c3f('0x3e')]){_0x485561[_0x4c3f('0x3f')]=[{'all':!![]}];}_0x485561=_[_0x4c3f('0x3a')]({},_0x485561,_0x45b249[_0x4c3f('0x3d')]);return db[_0x4c3f('0x29')]['find'](_0x485561)[_0x4c3f('0x21')](handleEntityNotFound(_0x30c100,null))['then'](respondWithResult(_0x30c100,null))[_0x4c3f('0x41')](handleError(_0x30c100,null));};exports[_0x4c3f('0x44')]=function(_0x405a25,_0x2436eb){return db['VoiceQueuesLog']['create'](_0x405a25[_0x4c3f('0x45')],{})[_0x4c3f('0x21')](respondWithResult(_0x2436eb,0xc9))['catch'](handleError(_0x2436eb,null));};exports[_0x4c3f('0x46')]=function(_0x55d1af,_0x36e857){if(_0x55d1af[_0x4c3f('0x45')]['id']){delete _0x55d1af[_0x4c3f('0x45')]['id'];}return db[_0x4c3f('0x29')][_0x4c3f('0x47')]({'where':{'id':_0x55d1af[_0x4c3f('0x43')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x36e857,null))[_0x4c3f('0x21')](saveUpdates(_0x55d1af['body'],null))['then'](respondWithResult(_0x36e857,null))[_0x4c3f('0x41')](handleError(_0x36e857,null));};exports[_0x4c3f('0x22')]=function(_0x437a2d,_0x131936){return db[_0x4c3f('0x29')][_0x4c3f('0x47')]({'where':{'id':_0x437a2d[_0x4c3f('0x43')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x131936,null))[_0x4c3f('0x21')](removeEntity(_0x131936,null))[_0x4c3f('0x41')](handleError(_0x131936,null));}; \ No newline at end of file +var _0x396c=['findAll','rows','catch','show','params','find','create','body','destroy','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','apply','update','then','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','pick','filter','where','VIRTUAL','merge','options','VoiceQueuesLog','includeAll','include'];(function(_0x3d336c,_0x1f2de5){var _0x59878e=function(_0x437029){while(--_0x437029){_0x3d336c['push'](_0x3d336c['shift']());}};_0x59878e(++_0x1f2de5);}(_0x396c,0xde));var _0xc396=function(_0x1f1978,_0x1a8fd8){_0x1f1978=_0x1f1978-0x0;var _0x130fa5=_0x396c[_0x1f1978];return _0x130fa5;};'use strict';var emlformat=require(_0xc396('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc396('0x1'));var rp=require(_0xc396('0x2'));var moment=require('moment');var BPromise=require(_0xc396('0x3'));var Mustache=require(_0xc396('0x4'));var util=require(_0xc396('0x5'));var path=require(_0xc396('0x6'));var sox=require(_0xc396('0x7'));var csv=require(_0xc396('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc396('0x9'));var _=require(_0xc396('0xa'));var squel=require(_0xc396('0xb'));var crypto=require(_0xc396('0xc'));var jsforce=require(_0xc396('0xd'));var deskjs=require(_0xc396('0xe'));var toCsv=require(_0xc396('0x8'));var querystring=require(_0xc396('0xf'));var Papa=require('papaparse');var Redis=require(_0xc396('0x10'));var authService=require(_0xc396('0x11'));var qs=require(_0xc396('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc396('0x13'));var logger=require(_0xc396('0x14'))(_0xc396('0x15'));var utils=require(_0xc396('0x16'));var config=require(_0xc396('0x17'));var licenseUtil=require(_0xc396('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c0b4,_0x119783){_0x119783=_0x119783||0xcc;return function(_0x52ee06){if(_0x52ee06){return _0x24c0b4[_0xc396('0x19')](_0x119783);}return _0x24c0b4['status'](_0x119783)[_0xc396('0x1a')]();};}function respondWithResult(_0x17cc5b,_0x10d4fc){_0x10d4fc=_0x10d4fc||0xc8;return function(_0x5551e9){if(_0x5551e9){return _0x17cc5b[_0xc396('0x1b')](_0x10d4fc)[_0xc396('0x1c')](_0x5551e9);}};}function respondWithFilteredResult(_0x3ed473,_0x52871b){return function(_0x151027){if(_0x151027){var _0xc73d50=typeof _0x52871b['offset']===_0xc396('0x1d')&&typeof _0x52871b[_0xc396('0x1e')]===_0xc396('0x1d');var _0x3afcf3=_0x151027[_0xc396('0x1f')];var _0x394043=_0xc73d50?0x0:_0x52871b['offset'];var _0x586d54=_0xc73d50?_0x151027[_0xc396('0x1f')]:_0x52871b[_0xc396('0x20')]+_0x52871b[_0xc396('0x1e')];var _0x3b5091;if(_0x586d54>=_0x3afcf3){_0x586d54=_0x3afcf3;_0x3b5091=0xc8;}else{_0x3b5091=0xce;}_0x3ed473[_0xc396('0x1b')](_0x3b5091);return _0x3ed473['set']('Content-Range',_0x394043+'-'+_0x586d54+'/'+_0x3afcf3)[_0xc396('0x1c')](_0x151027);}return null;};}function patchUpdates(_0x1730ee){return function(_0x4d9da9){try{jsonpatch[_0xc396('0x21')](_0x4d9da9,_0x1730ee,!![]);}catch(_0x5bc18c){return BPromise['reject'](_0x5bc18c);}return _0x4d9da9['save']();};}function saveUpdates(_0x2fd247,_0x2b9514){return function(_0x489929){if(_0x489929){return _0x489929[_0xc396('0x22')](_0x2fd247)[_0xc396('0x23')](function(_0x246fc9){return _0x246fc9;});}return null;};}function removeEntity(_0x52fdf0,_0x3fb517){return function(_0x3448d1){if(_0x3448d1){return _0x3448d1['destroy']()['then'](function(){_0x52fdf0[_0xc396('0x1b')](0xcc)[_0xc396('0x1a')]();});}};}function handleEntityNotFound(_0x5d06f1,_0x58b701){return function(_0x3287cb){if(!_0x3287cb){_0x5d06f1[_0xc396('0x19')](0x194);}return _0x3287cb;};}function handleError(_0x431ec7,_0x358f4b){_0x358f4b=_0x358f4b||0x1f4;return function(_0x16b82e){logger['error'](_0x16b82e[_0xc396('0x24')]);if(_0x16b82e[_0xc396('0x25')]){delete _0x16b82e[_0xc396('0x25')];}_0x431ec7[_0xc396('0x1b')](_0x358f4b)['send'](_0x16b82e);};}exports[_0xc396('0x26')]=function(_0xed4093,_0x49bc5d){var _0x28afd8={},_0x4c8c4f={},_0x2b1b02={'count':0x0,'rows':[]};var _0xc621a5=_['map'](db['VoiceQueuesLog'][_0xc396('0x27')],function(_0x477be3){return{'name':_0x477be3[_0xc396('0x28')],'type':_0x477be3[_0xc396('0x29')][_0xc396('0x2a')]};});_0x4c8c4f[_0xc396('0x2b')]=_[_0xc396('0x2c')](_0xc621a5,_0xc396('0x25'));_0x4c8c4f[_0xc396('0x2d')]=_[_0xc396('0x2e')](_0xed4093[_0xc396('0x2d')]);_0x4c8c4f[_0xc396('0x2f')]=_['intersection'](_0x4c8c4f['model'],_0x4c8c4f[_0xc396('0x2d')]);_0x28afd8[_0xc396('0x30')]=_[_0xc396('0x31')](_0x4c8c4f[_0xc396('0x2b')],qs[_0xc396('0x32')](_0xed4093[_0xc396('0x2d')][_0xc396('0x32')]));_0x28afd8['attributes']=_0x28afd8[_0xc396('0x30')][_0xc396('0x33')]?_0x28afd8['attributes']:_0x4c8c4f[_0xc396('0x2b')];if(!_0xed4093[_0xc396('0x2d')]['hasOwnProperty']('nolimit')){_0x28afd8[_0xc396('0x1e')]=qs[_0xc396('0x1e')](_0xed4093['query'][_0xc396('0x1e')]);_0x28afd8[_0xc396('0x20')]=qs[_0xc396('0x20')](_0xed4093[_0xc396('0x2d')][_0xc396('0x20')]);}_0x28afd8[_0xc396('0x34')]=qs['sort'](_0xed4093['query']['sort']);_0x28afd8['where']=qs[_0xc396('0x2f')](_[_0xc396('0x35')](_0xed4093['query'],_0x4c8c4f['filters']),_0xc621a5);if(_0xed4093[_0xc396('0x2d')][_0xc396('0x36')]){_0x28afd8['where']=_['merge'](_0x28afd8[_0xc396('0x37')],{'$or':_[_0xc396('0x2c')](_0xc621a5,function(_0x31cdde){if(_0x31cdde[_0xc396('0x29')]!==_0xc396('0x38')){var _0x6a63dd={};_0x6a63dd[_0x31cdde[_0xc396('0x25')]]={'$like':'%'+_0xed4093[_0xc396('0x2d')][_0xc396('0x36')]+'%'};return _0x6a63dd;}})});}_0x28afd8=_[_0xc396('0x39')]({},_0x28afd8,_0xed4093[_0xc396('0x3a')]);var _0x364c3b={'where':_0x28afd8['where']};return db[_0xc396('0x3b')][_0xc396('0x1f')](_0x364c3b)[_0xc396('0x23')](function(_0x40059d){_0x2b1b02[_0xc396('0x1f')]=_0x40059d;if(_0xed4093['query'][_0xc396('0x3c')]){_0x28afd8[_0xc396('0x3d')]=[{'all':!![]}];}return db[_0xc396('0x3b')][_0xc396('0x3e')](_0x28afd8);})[_0xc396('0x23')](function(_0x3a45a0){_0x2b1b02[_0xc396('0x3f')]=_0x3a45a0;return _0x2b1b02;})[_0xc396('0x23')](respondWithFilteredResult(_0x49bc5d,_0x28afd8))[_0xc396('0x40')](handleError(_0x49bc5d,null));};exports[_0xc396('0x41')]=function(_0x40a386,_0x492094){var _0x55b35a={'raw':!![],'where':{'id':_0x40a386[_0xc396('0x42')]['id']}},_0x1b7522={};_0x1b7522[_0xc396('0x2b')]=_[_0xc396('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x1b7522[_0xc396('0x2d')]=_[_0xc396('0x2e')](_0x40a386[_0xc396('0x2d')]);_0x1b7522[_0xc396('0x2f')]=_[_0xc396('0x31')](_0x1b7522[_0xc396('0x2b')],_0x1b7522['query']);_0x55b35a[_0xc396('0x30')]=_[_0xc396('0x31')](_0x1b7522[_0xc396('0x2b')],qs[_0xc396('0x32')](_0x40a386[_0xc396('0x2d')]['fields']));_0x55b35a[_0xc396('0x30')]=_0x55b35a[_0xc396('0x30')][_0xc396('0x33')]?_0x55b35a['attributes']:_0x1b7522[_0xc396('0x2b')];if(_0x40a386[_0xc396('0x2d')]['includeAll']){_0x55b35a[_0xc396('0x3d')]=[{'all':!![]}];}_0x55b35a=_['merge']({},_0x55b35a,_0x40a386[_0xc396('0x3a')]);return db[_0xc396('0x3b')][_0xc396('0x43')](_0x55b35a)[_0xc396('0x23')](handleEntityNotFound(_0x492094,null))[_0xc396('0x23')](respondWithResult(_0x492094,null))[_0xc396('0x40')](handleError(_0x492094,null));};exports[_0xc396('0x44')]=function(_0x547393,_0x568d60){return db[_0xc396('0x3b')][_0xc396('0x44')](_0x547393[_0xc396('0x45')],{})[_0xc396('0x23')](respondWithResult(_0x568d60,0xc9))[_0xc396('0x40')](handleError(_0x568d60,null));};exports[_0xc396('0x22')]=function(_0x4b4356,_0x37af52){if(_0x4b4356[_0xc396('0x45')]['id']){delete _0x4b4356[_0xc396('0x45')]['id'];}return db[_0xc396('0x3b')][_0xc396('0x43')]({'where':{'id':_0x4b4356[_0xc396('0x42')]['id']}})[_0xc396('0x23')](handleEntityNotFound(_0x37af52,null))['then'](saveUpdates(_0x4b4356[_0xc396('0x45')],null))[_0xc396('0x23')](respondWithResult(_0x37af52,null))[_0xc396('0x40')](handleError(_0x37af52,null));};exports[_0xc396('0x46')]=function(_0x19e468,_0x2acb67){return db['VoiceQueuesLog'][_0xc396('0x43')]({'where':{'id':_0x19e468['params']['id']}})[_0xc396('0x23')](handleEntityNotFound(_0x2acb67,null))[_0xc396('0x23')](removeEntity(_0x2acb67,null))[_0xc396('0x40')](handleError(_0x2acb67,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6a03b3c..baaa4c8 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 _0xaa2b=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm','util','../../config/logger','api','moment','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa2b,0x1e7));var _0xbaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbaa2('0x0'));var logger=require(_0xbaa2('0x1'))(_0xbaa2('0x2'));var moment=require(_0xbaa2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaa2('0x4'));var rimraf=require('rimraf');var config=require(_0xbaa2('0x5'));var attributes=require(_0xbaa2('0x6'));module[_0xbaa2('0x7')]=function(_0x455ec7,_0x176d37){return _0x455ec7[_0xbaa2('0x8')](_0xbaa2('0x9'),attributes,{'tableName':_0xbaa2('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xbaa2('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1fa8=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','moment'];(function(_0x522d87,_0x526b31){var _0x579d58=function(_0xd660f8){while(--_0xd660f8){_0x522d87['push'](_0x522d87['shift']());}};_0x579d58(++_0x526b31);}(_0x1fa8,0x1cc));var _0x81fa=function(_0x2c8308,_0x16c911){_0x2c8308=_0x2c8308-0x0;var _0x657855=_0x1fa8[_0x2c8308];return _0x657855;};'use strict';var _=require(_0x81fa('0x0'));var util=require(_0x81fa('0x1'));var logger=require(_0x81fa('0x2'))('api');var moment=require(_0x81fa('0x3'));var BPromise=require(_0x81fa('0x4'));var rp=require(_0x81fa('0x5'));var fs=require('fs');var path=require(_0x81fa('0x6'));var rimraf=require(_0x81fa('0x7'));var config=require(_0x81fa('0x8'));var attributes=require(_0x81fa('0x9'));module[_0x81fa('0xa')]=function(_0x194cc6,_0x3acb95){return _0x194cc6[_0x81fa('0xb')](_0x81fa('0xc'),attributes,{'tableName':_0x81fa('0xd'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x81fa('0xe'),_0x81fa('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8431bab..85e7dc3 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 _0xefdd=['http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x21dab8,_0x55c06d){var _0x4daa24=function(_0x280a67){while(--_0x280a67){_0x21dab8['push'](_0x21dab8['shift']());}};_0x4daa24(++_0x55c06d);}(_0xefdd,0x75));var _0xdefd=function(_0x4fd64a,_0x1740f4){_0x4fd64a=_0x4fd64a-0x0;var _0x54525d=_0xefdd[_0x4fd64a];return _0x54525d;};'use strict';var _=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var moment=require('moment');var BPromise=require(_0xdefd('0x2'));var rs=require(_0xdefd('0x3'));var fs=require('fs');var Redis=require(_0xdefd('0x4'));var db=require(_0xdefd('0x5'))['db'];var utils=require(_0xdefd('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdefd('0x7'));var client=jayson[_0xdefd('0x8')][_0xdefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x525fc9,_0x4a32db,_0x1d2823){return new BPromise(function(_0x522843,_0x83c14e){return client[_0xdefd('0xa')](_0x525fc9,_0x1d2823)['then'](function(_0x452a78){logger[_0xdefd('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a32db,_0xdefd('0xc'));logger[_0xdefd('0xd')](_0xdefd('0xe'),_0x4a32db,_0xdefd('0xc'),JSON[_0xdefd('0xf')](_0x452a78));if(_0x452a78[_0xdefd('0x10')]){if(_0x452a78['error']['code']===0x1f4){logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x452a78['error'][_0xdefd('0x12')]);return _0x83c14e(_0x452a78['error'][_0xdefd('0x12')]);}logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x452a78[_0xdefd('0x10')][_0xdefd('0x12')]);return _0x522843(_0x452a78[_0xdefd('0x10')]['message']);}else{logger[_0xdefd('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a32db,_0xdefd('0xc'));_0x522843(_0x452a78[_0xdefd('0x13')][_0xdefd('0x12')]);}})[_0xdefd('0x14')](function(_0x3dbdff){logger[_0xdefd('0x10')](_0xdefd('0x11'),_0x4a32db,_0x3dbdff);_0x83c14e(_0x3dbdff);});});} \ No newline at end of file +var _0x56e5=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x417aa6,_0x401f42){var _0x46e3bc=function(_0x361de5){while(--_0x361de5){_0x417aa6['push'](_0x417aa6['shift']());}};_0x46e3bc(++_0x401f42);}(_0x56e5,0x18f));var _0x556e=function(_0x1166b0,_0x1dd81b){_0x1166b0=_0x1166b0-0x0;var _0x13b4f8=_0x56e5[_0x1166b0];return _0x13b4f8;};'use strict';var _=require(_0x556e('0x0'));var util=require(_0x556e('0x1'));var moment=require(_0x556e('0x2'));var BPromise=require(_0x556e('0x3'));var rs=require(_0x556e('0x4'));var fs=require('fs');var Redis=require(_0x556e('0x5'));var db=require(_0x556e('0x6'))['db'];var utils=require(_0x556e('0x7'));var logger=require(_0x556e('0x8'))('rpc');var config=require(_0x556e('0x9'));var jayson=require(_0x556e('0xa'));var client=jayson[_0x556e('0xb')][_0x556e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a387b,_0x59bb72,_0x2b93bb){return new BPromise(function(_0x236500,_0x2691fd){return client['request'](_0x5a387b,_0x2b93bb)[_0x556e('0xd')](function(_0x121721){logger[_0x556e('0xe')](_0x556e('0xf'),_0x59bb72,_0x556e('0x10'));logger[_0x556e('0x11')](_0x556e('0x12'),_0x59bb72,_0x556e('0x10'),JSON['stringify'](_0x121721));if(_0x121721[_0x556e('0x13')]){if(_0x121721[_0x556e('0x13')]['code']===0x1f4){logger[_0x556e('0x13')](_0x556e('0xf'),_0x59bb72,_0x121721[_0x556e('0x13')][_0x556e('0x14')]);return _0x2691fd(_0x121721[_0x556e('0x13')][_0x556e('0x14')]);}logger[_0x556e('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x59bb72,_0x121721[_0x556e('0x13')][_0x556e('0x14')]);return _0x236500(_0x121721[_0x556e('0x13')][_0x556e('0x14')]);}else{logger[_0x556e('0xe')](_0x556e('0xf'),_0x59bb72,_0x556e('0x10'));_0x236500(_0x121721['result'][_0x556e('0x14')]);}})[_0x556e('0x15')](function(_0x366b9b){logger[_0x556e('0x13')](_0x556e('0xf'),_0x59bb72,_0x366b9b);_0x2691fd(_0x366b9b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index adf43ff..8752625 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 _0xe6d1=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','multer'];(function(_0x378192,_0x35c4b2){var _0x1419e5=function(_0x249ce9){while(--_0x249ce9){_0x378192['push'](_0x378192['shift']());}};_0x1419e5(++_0x35c4b2);}(_0xe6d1,0x1c7));var _0x1e6d=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xe6d1[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0x1e6d('0x0'));var util=require('util');var path=require(_0x1e6d('0x1'));var timeout=require(_0x1e6d('0x2'));var express=require('express');var router=express[_0x1e6d('0x3')]();var fs_extra=require(_0x1e6d('0x4'));var auth=require(_0x1e6d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1e6d('0x6'));var controller=require(_0x1e6d('0x7'));router[_0x1e6d('0x8')]('/',auth[_0x1e6d('0x9')](),controller['index']);router[_0x1e6d('0x8')](_0x1e6d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1e6d('0x8')](_0x1e6d('0xb'),auth[_0x1e6d('0x9')](),controller['show']);router[_0x1e6d('0x8')](_0x1e6d('0xc'),auth['isAuthenticated'](),controller[_0x1e6d('0xd')]);router[_0x1e6d('0x8')](_0x1e6d('0xe'),controller[_0x1e6d('0xf')]);router[_0x1e6d('0x8')]('/:id/transcribe',auth[_0x1e6d('0x9')](),controller[_0x1e6d('0x10')]);router[_0x1e6d('0x11')]('/',auth['isAuthenticated'](),controller[_0x1e6d('0x12')]);router[_0x1e6d('0x11')]('/:id/transcribe',auth[_0x1e6d('0x9')](),controller[_0x1e6d('0x13')]);router[_0x1e6d('0x14')]('/:id',auth[_0x1e6d('0x9')](),controller['update']);router[_0x1e6d('0x15')](_0x1e6d('0xb'),auth['isAuthenticated'](),controller[_0x1e6d('0x16')]);module[_0x1e6d('0x17')]=router; \ No newline at end of file +var _0xa642=['create','runTranscribe','/:id','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post'];(function(_0x152e12,_0x3f712f){var _0x1a6118=function(_0x2b816d){while(--_0x2b816d){_0x152e12['push'](_0x152e12['shift']());}};_0x1a6118(++_0x3f712f);}(_0xa642,0x9d));var _0x2a64=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0xa642[_0x26d9b3];return _0x15c226;};'use strict';var multer=require(_0x2a64('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2a64('0x1'));var router=express['Router']();var fs_extra=require(_0x2a64('0x2'));var auth=require(_0x2a64('0x3'));var interaction=require(_0x2a64('0x4'));var config=require(_0x2a64('0x5'));var controller=require(_0x2a64('0x6'));router['get']('/',auth[_0x2a64('0x7')](),controller[_0x2a64('0x8')]);router[_0x2a64('0x9')](_0x2a64('0xa'),auth[_0x2a64('0x7')](),controller[_0x2a64('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2a64('0x9')](_0x2a64('0xc'),auth['isAuthenticated'](),controller[_0x2a64('0xd')]);router[_0x2a64('0x9')]('/:id/downloads',controller[_0x2a64('0xe')]);router[_0x2a64('0x9')](_0x2a64('0xf'),auth[_0x2a64('0x7')](),controller[_0x2a64('0x10')]);router[_0x2a64('0x11')]('/',auth[_0x2a64('0x7')](),controller[_0x2a64('0x12')]);router[_0x2a64('0x11')](_0x2a64('0xf'),auth[_0x2a64('0x7')](),controller[_0x2a64('0x13')]);router['put'](_0x2a64('0x14'),auth[_0x2a64('0x7')](),controller[_0x2a64('0x15')]);router[_0x2a64('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x2a64('0x17')]);module[_0x2a64('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 302feef..244a83e 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index bf33a88..9a61dc7 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 _0x1400=['Setting','findOne','transcribe','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','include','catch','show','params','keys','includeAll','options','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','send','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','decryptFile','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found'];(function(_0x504575,_0x1ad9e0){var _0x4484cc=function(_0xc4c2ea){while(--_0xc4c2ea){_0x504575['push'](_0x504575['shift']());}};_0x4484cc(++_0x1ad9e0);}(_0x1400,0xab));var _0x0140=function(_0x4de820,_0x488481){_0x4de820=_0x4de820-0x0;var _0xec2bcd=_0x1400[_0x4de820];return _0xec2bcd;};'use strict';var emlformat=require(_0x0140('0x0'));var rimraf=require(_0x0140('0x1'));var zipdir=require(_0x0140('0x2'));var jsonpatch=require(_0x0140('0x3'));var rp=require(_0x0140('0x4'));var moment=require(_0x0140('0x5'));var BPromise=require(_0x0140('0x6'));var Mustache=require('mustache');var util=require(_0x0140('0x7'));var path=require(_0x0140('0x8'));var sox=require(_0x0140('0x9'));var csv=require(_0x0140('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0140('0xb'));var _=require('lodash');var squel=require(_0x0140('0xc'));var crypto=require(_0x0140('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0140('0xa'));var querystring=require(_0x0140('0xe'));var Papa=require(_0x0140('0xf'));var AWS=require(_0x0140('0x10'));var uuidv4=require(_0x0140('0x11'));var Redis=require(_0x0140('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0140('0x13'));var hardwareService=require(_0x0140('0x14'));var logger=require(_0x0140('0x15'))(_0x0140('0x16'));var utils=require(_0x0140('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0140('0x18'));var db=require(_0x0140('0x19'))['db'];function respondWithStatusCode(_0x124573,_0x5afa8b){_0x5afa8b=_0x5afa8b||0xcc;return function(_0x143b36){if(_0x143b36){return _0x124573[_0x0140('0x1a')](_0x5afa8b);}return _0x124573[_0x0140('0x1b')](_0x5afa8b)['end']();};}function respondWithResult(_0x247225,_0x2d0312){_0x2d0312=_0x2d0312||0xc8;return function(_0x2fbc33){if(_0x2fbc33){return _0x247225['status'](_0x2d0312)[_0x0140('0x1c')](_0x2fbc33);}};}function respondWithFilteredResult(_0x472c53,_0x2edd4e){return function(_0x521204){if(_0x521204){var _0x4334e2=typeof _0x2edd4e[_0x0140('0x1d')]===_0x0140('0x1e')&&typeof _0x2edd4e['limit']==='undefined';var _0x3e2b88=_0x521204[_0x0140('0x1f')];var _0x2b8d76=_0x4334e2?0x0:_0x2edd4e[_0x0140('0x1d')];var _0x2a29bc=_0x4334e2?_0x521204[_0x0140('0x1f')]:_0x2edd4e[_0x0140('0x1d')]+_0x2edd4e[_0x0140('0x20')];var _0x5e8844;if(_0x2a29bc>=_0x3e2b88){_0x2a29bc=_0x3e2b88;_0x5e8844=0xc8;}else{_0x5e8844=0xce;}_0x472c53['status'](_0x5e8844);return _0x472c53[_0x0140('0x21')](_0x0140('0x22'),_0x2b8d76+'-'+_0x2a29bc+'/'+_0x3e2b88)['json'](_0x521204);}return null;};}function patchUpdates(_0x379767){return function(_0x52124f){try{jsonpatch[_0x0140('0x23')](_0x52124f,_0x379767,!![]);}catch(_0x242d81){return BPromise[_0x0140('0x24')](_0x242d81);}return _0x52124f['save']();};}function saveUpdates(_0x171a21,_0x263a0c){return function(_0x2fee94){if(_0x2fee94){return _0x2fee94[_0x0140('0x25')](_0x171a21)[_0x0140('0x26')](function(_0x570c08){return _0x570c08;});}return null;};}function removeEntity(_0x5b3f7f,_0x5d4777){return function(_0x29dda2){if(_0x29dda2){return _0x29dda2[_0x0140('0x27')]()['then'](function(){_0x5b3f7f[_0x0140('0x1b')](0xcc)[_0x0140('0x28')]();});}};}function handleEntityNotFound(_0x3636bb,_0xf93552){return function(_0x313729){if(!_0x313729){_0x3636bb['sendStatus'](0x194);}return _0x313729;};}function handleError(_0x5b5dfb,_0x36e136){_0x36e136=_0x36e136||0x1f4;return function(_0x1228fe){logger[_0x0140('0x29')](_0x1228fe[_0x0140('0x2a')]);if(_0x1228fe[_0x0140('0x2b')]){delete _0x1228fe[_0x0140('0x2b')];}_0x5b5dfb['status'](_0x36e136)['send'](_0x1228fe);};}exports['index']=function(_0x35d0fd,_0x4ad629){var _0x2e1def={},_0x146e48={},_0xebeeb1={'count':0x0,'rows':[]};var _0x1cc58b=_[_0x0140('0x2c')](db[_0x0140('0x2d')][_0x0140('0x2e')],function(_0x121d86){return{'name':_0x121d86[_0x0140('0x2f')],'type':_0x121d86[_0x0140('0x30')][_0x0140('0x31')]};});_0x146e48[_0x0140('0x32')]=_[_0x0140('0x33')](_[_0x0140('0x2c')](_0x1cc58b,_0x0140('0x2b')),[_0x0140('0x34')]);_0x146e48[_0x0140('0x35')]=_['keys'](_0x35d0fd['query']);_0x146e48[_0x0140('0x36')]=_[_0x0140('0x37')](_0x146e48['model'],_0x146e48[_0x0140('0x35')]);_0x2e1def['attributes']=_['intersection'](_0x146e48['model'],qs[_0x0140('0x38')](_0x35d0fd[_0x0140('0x35')][_0x0140('0x38')]));_0x2e1def[_0x0140('0x39')]=_0x2e1def['attributes'][_0x0140('0x3a')]?_0x2e1def[_0x0140('0x39')]:_0x146e48[_0x0140('0x32')];if(!_0x35d0fd[_0x0140('0x35')]['hasOwnProperty'](_0x0140('0x3b'))){_0x2e1def[_0x0140('0x20')]=qs['limit'](_0x35d0fd[_0x0140('0x35')]['limit']);_0x2e1def[_0x0140('0x1d')]=qs[_0x0140('0x1d')](_0x35d0fd[_0x0140('0x35')]['offset']);}_0x2e1def['order']=qs['sort'](_0x35d0fd[_0x0140('0x35')][_0x0140('0x3c')]);_0x2e1def['where']=qs[_0x0140('0x36')](_[_0x0140('0x3d')](_0x35d0fd['query'],_0x146e48[_0x0140('0x36')]),_0x1cc58b);if(_0x35d0fd['query'][_0x0140('0x3e')]){_0x2e1def['where']=_[_0x0140('0x3f')](_0x2e1def[_0x0140('0x40')],{'$or':_[_0x0140('0x2c')](_0x1cc58b,function(_0x59ed5c){if(_0x59ed5c[_0x0140('0x30')]!==_0x0140('0x41')){var _0x4ab75c={};_0x4ab75c[_0x59ed5c[_0x0140('0x2b')]]={'$like':'%'+_0x35d0fd[_0x0140('0x35')][_0x0140('0x3e')]+'%'};return _0x4ab75c;}})});}_0x2e1def=_[_0x0140('0x3f')]({},_0x2e1def,_0x35d0fd['options']);var _0x253fb5={'where':_0x2e1def[_0x0140('0x40')]};return db['VoiceRecording']['count'](_0x253fb5)[_0x0140('0x26')](function(_0x17591a){_0xebeeb1[_0x0140('0x1f')]=_0x17591a;if(_0x35d0fd[_0x0140('0x35')]['includeAll']){_0x2e1def[_0x0140('0x42')]=[{'all':!![]}];}return db[_0x0140('0x2d')]['findAll'](_0x2e1def);})[_0x0140('0x26')](function(_0x18359c){_0xebeeb1['rows']=_0x18359c;return _0xebeeb1;})['then'](respondWithFilteredResult(_0x4ad629,_0x2e1def))[_0x0140('0x43')](handleError(_0x4ad629,null));};exports[_0x0140('0x44')]=function(_0x3fb6d5,_0x5ba0a3){var _0x5182ba={'raw':![],'where':{'id':_0x3fb6d5[_0x0140('0x45')]['id']}},_0x197ea2={};_0x197ea2['model']=_[_0x0140('0x46')](db[_0x0140('0x2d')][_0x0140('0x2e')]);_0x197ea2['query']=_[_0x0140('0x46')](_0x3fb6d5[_0x0140('0x35')]);_0x197ea2[_0x0140('0x36')]=_['intersection'](_0x197ea2[_0x0140('0x32')],_0x197ea2['query']);_0x5182ba[_0x0140('0x39')]=_[_0x0140('0x37')](_0x197ea2[_0x0140('0x32')],qs[_0x0140('0x38')](_0x3fb6d5[_0x0140('0x35')][_0x0140('0x38')]));_0x5182ba[_0x0140('0x39')]=_0x5182ba[_0x0140('0x39')][_0x0140('0x3a')]?_0x5182ba[_0x0140('0x39')]:_0x197ea2['model'];if(_0x3fb6d5[_0x0140('0x35')][_0x0140('0x47')]){_0x5182ba[_0x0140('0x42')]=[{'all':!![]}];}_0x5182ba=_[_0x0140('0x3f')]({},_0x5182ba,_0x3fb6d5[_0x0140('0x48')]);return db['VoiceRecording']['find'](_0x5182ba)[_0x0140('0x26')](handleEntityNotFound(_0x5ba0a3,null))['then'](respondWithResult(_0x5ba0a3,null))[_0x0140('0x43')](handleError(_0x5ba0a3,null));};exports['create']=function(_0x1eb408,_0xeb7dbd){return db[_0x0140('0x2d')][_0x0140('0x49')](_0x1eb408[_0x0140('0x4a')],{})[_0x0140('0x26')](respondWithResult(_0xeb7dbd,0xc9))['catch'](handleError(_0xeb7dbd,null));};exports['update']=function(_0x5bbd30,_0x374049){if(_0x5bbd30[_0x0140('0x4a')]['id']){delete _0x5bbd30['body']['id'];}return db['VoiceRecording'][_0x0140('0x4b')]({'where':{'id':_0x5bbd30[_0x0140('0x45')]['id']}})[_0x0140('0x26')](handleEntityNotFound(_0x374049,null))['then'](saveUpdates(_0x5bbd30['body'],null))[_0x0140('0x26')](respondWithResult(_0x374049,null))[_0x0140('0x43')](handleError(_0x374049,null));};exports['describe']=function(_0x1cc8cb,_0x31fabb){return db[_0x0140('0x2d')][_0x0140('0x4c')]()[_0x0140('0x26')](respondWithResult(_0x31fabb,null))[_0x0140('0x43')](handleError(_0x31fabb,null));};exports['download']=function(_0x373aaa,_0x562fa7,_0x348084){var _0x376e24=require(_0x0140('0x4d'));var _0x4977dc=![];var _0x75053={};if(_0x373aaa[_0x0140('0x35')][_0x0140('0x30')]&&_0x373aaa[_0x0140('0x35')][_0x0140('0x30')]==='uniqueid'){_0x75053[_0x0140('0x4e')]=_0x373aaa[_0x0140('0x45')]['id'];}else{_0x75053['id']=_0x373aaa[_0x0140('0x45')]['id'];}return db[_0x0140('0x2d')]['find']({'where':_0x75053,'attributes':['id',_0x0140('0x4f')],'raw':!![]})[_0x0140('0x26')](handleEntityNotFound(_0x562fa7,null))[_0x0140('0x26')](function(_0x1d966a){if(_0x1d966a){var _0x27c835=_0x1d966a['value'];var _0x1e79c5=util[_0x0140('0x34')](_0x0140('0x50'),_0x27c835);if(fs[_0x0140('0x51')](_0x1e79c5)){_0x4977dc=!![];return _0x376e24['decryptFile'](_0x1e79c5,_0x27c835,config[_0x0140('0x52')][_0x0140('0x53')])[_0x0140('0x26')](function(){return _0x1d966a;});}return _0x1d966a;}})[_0x0140('0x26')](function(_0xc7aa1e){if(_0xc7aa1e){var _0x3a3c0b=_0xc7aa1e['value'];if(!fs[_0x0140('0x51')](_0x3a3c0b)){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))](_0x0140('0x56'));}if(_0xc7aa1e[_0x0140('0x57')]){return _0x562fa7[_0x0140('0x58')](_0x3a3c0b,_0xc7aa1e[_0x0140('0x57')]+path[_0x0140('0x59')](_0x3a3c0b),function(){if(_0x4977dc){fs[_0x0140('0x5a')](_0x3a3c0b);}});}else{return _0x562fa7[_0x0140('0x58')](_0x3a3c0b,function(_0x47404c){if(_0x4977dc){fs[_0x0140('0x5a')](_0x3a3c0b);}});}}})[_0x0140('0x43')](function(_0x5820e8){if(_0x5820e8['message']==='VoiceRecording\x20not\x20found'){_0x562fa7[_0x0140('0x1b')](0x194)[_0x0140('0x5b')](_0x0140('0x5c'));}else{return handleError(_0x562fa7,null);}});};exports[_0x0140('0x5d')]=function(_0x4545cc,_0x4466a2,_0x417eec){var _0x563066=require(_0x0140('0x4d'));var _0x2fc3ee=![];var _0xd0a145={'$and':[db[_0x0140('0x5e')]['where'](db['sequelize']['fn'](_0x0140('0x5f'),db[_0x0140('0x5e')][_0x0140('0x60')](_0x0140('0x4e'))),_0x4545cc[_0x0140('0x35')][_0x0140('0x61')])]};if(_0x4545cc[_0x0140('0x35')]['type']&&_0x4545cc[_0x0140('0x35')][_0x0140('0x30')]==='uniqueid'){_0xd0a145['$and'][_0x0140('0x62')]({'uniqueid':_0x4545cc[_0x0140('0x45')]['id']});}else{_0xd0a145[_0x0140('0x63')][_0x0140('0x62')]({'id':_0x4545cc[_0x0140('0x45')]['id']});}return db['VoiceRecording'][_0x0140('0x4b')]({'where':_0xd0a145,'attributes':['id',_0x0140('0x4f')],'raw':!![]})[_0x0140('0x26')](handleEntityNotFound(_0x4466a2,null))[_0x0140('0x26')](function(_0x2cc452){if(_0x2cc452){var _0xb8fe98=util[_0x0140('0x34')](_0x0140('0x50'),_0x2cc452[_0x0140('0x4f')]);if(fs[_0x0140('0x51')](_0xb8fe98)){_0x2fc3ee=!![];return _0x563066[_0x0140('0x64')](_0xb8fe98,_0x2cc452['value'],config[_0x0140('0x52')]['recording'])['then'](function(){return _0x2cc452;});}return _0x2cc452;}})['then'](function(_0x1611c0){if(_0x1611c0){if(!fs['existsSync'](_0x1611c0['value'])){throw new db['Sequelize']['ValidationError'](_0x0140('0x56'));}if(_0x1611c0[_0x0140('0x57')]){return _0x4466a2[_0x0140('0x58')](_0x1611c0[_0x0140('0x4f')],_0x1611c0[_0x0140('0x57')]+path[_0x0140('0x59')](_0x1611c0[_0x0140('0x4f')]),function(){if(_0x2fc3ee){fs[_0x0140('0x5a')](_0x1611c0[_0x0140('0x4f')]);}});}else{return _0x4466a2[_0x0140('0x58')](_0x1611c0[_0x0140('0x4f')],function(_0x4645ba){if(_0x2fc3ee){fs[_0x0140('0x5a')](_0x1611c0[_0x0140('0x4f')]);}});}}})[_0x0140('0x43')](handleError(_0x4466a2,null));};exports[_0x0140('0x27')]=function(_0x27c0fb,_0x2f5ccd){return db[_0x0140('0x2d')]['find']({'where':{'id':_0x27c0fb[_0x0140('0x45')]['id']}})[_0x0140('0x26')](function(_0x58f9fa){if(_[_0x0140('0x65')](_0x58f9fa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f9fa;})[_0x0140('0x26')](function(_0x475d83){var _0x2c4e11=_0x475d83[_0x0140('0x4f')];logger[_0x0140('0x66')](_0x0140('0x67'),_0x2c4e11);if(!_[_0x0140('0x65')](_0x475d83['value'])&&fs[_0x0140('0x51')](_0x2c4e11)){logger[_0x0140('0x66')](_0x0140('0x68')+_0x2c4e11+_0x0140('0x69'));fs[_0x0140('0x6a')](_0x2c4e11);}_0x2c4e11=_0x2c4e11+_0x0140('0x6b');if(!_['isNil'](_0x475d83['value'])&&fs[_0x0140('0x51')](_0x2c4e11)){logger[_0x0140('0x66')]('File:\x20\x22'+_0x2c4e11+_0x0140('0x69'));fs[_0x0140('0x6a')](_0x2c4e11);}return _0x475d83;})['then'](function(_0x4cd40e){if(!_0x4cd40e)throw new InternalError();return _0x4cd40e['destroy']();})[_0x0140('0x26')](function(){_0x2f5ccd[_0x0140('0x1b')](0xcc)['end']();})['catch'](handleError(_0x2f5ccd,null));};function getBucketslist(_0x3e7a78,_0x4cde0c,_0x10c428){return new Promise(function(_0x2d6b7b,_0x284fc8){var _0xbdd885=new AWS['S3']({'accessKeyId':_0x4cde0c,'secretAccessKey':_0x3e7a78,'region':_0x10c428});_0xbdd885['listBuckets']({},function(_0x1fb6f9,_0x47a598){if(_0x1fb6f9){return _0x284fc8(_0x1fb6f9);}else{return _0x2d6b7b(_0x47a598);}});});}function createBucket(_0x49c63e,_0x575749,_0x41f3db,_0x4aea5f){return new Promise(function(_0x163cda,_0x726f4f){var _0x128b74=new AWS['S3']({'accessKeyId':_0x575749,'secretAccessKey':_0x49c63e,'region':_0x41f3db});_0x128b74[_0x0140('0x6c')]({'Bucket':_0x4aea5f},function(_0x184898,_0xa62f38){if(_0x184898){return _0x726f4f(_0x184898);}else{return _0x163cda(_0xa62f38);}});});}function uploadFile(_0x270f7f,_0x4acd53,_0x41297e,_0x55833a,_0x50de96,_0x9ca06e){return new Promise(function(_0x57c85e,_0x40c461){var _0x5111e6=new AWS['S3']({'accessKeyId':_0x4acd53,'secretAccessKey':_0x270f7f,'region':_0x41297e});_0x5111e6['upload']({'Bucket':_0x55833a,'Key':_0x50de96,'Body':_0x9ca06e},function(_0xca2fde,_0x4f1d1d){if(_0xca2fde){return _0x40c461(_0xca2fde);}else{return _0x57c85e(_0x4f1d1d);}});});}function startTranscribe(_0x49be2e,_0x41a615,_0x4533d5,_0x5b8490,_0x28fe16,_0x44cbe1){return new Promise(function(_0x3154d9,_0x393694){var _0x64996d=new AWS[(_0x0140('0x6d'))]({'accessKeyId':_0x41a615,'secretAccessKey':_0x49be2e,'region':_0x4533d5});_0x64996d['startTranscriptionJob']({'TranscriptionJobName':_0x5b8490,'LanguageCode':_0x28fe16,'Media':{'MediaFileUri':_0x44cbe1}},function(_0x23e1bb,_0x58478f){if(_0x23e1bb){return _0x393694(_0x23e1bb);}else{return _0x3154d9(_0x58478f);}});});}function transcribe(_0xc45398,_0x357fd1,_0x243fdc,_0x4c1020,_0x1a44be,_0x54d414,_0x3374d1){return new Promise(function(_0x52b77f,_0x16a185){var _0x4ae671={};logger[_0x0140('0x66')](util['format'](_0x0140('0x6e'),_0xc45398,_0x1a44be));return uploadFile(_0x357fd1,_0x243fdc,_0x4c1020,_0x1a44be,path[_0x0140('0x6f')](_0x54d414),fs['readFileSync'](_0x54d414))['then'](function(_0x24e479){logger[_0x0140('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xc45398,_0x1a44be,_0x24e479[_0x0140('0x70')]));_0x4ae671['bucket']=_0x24e479[_0x0140('0x71')];_0x4ae671[_0x0140('0x72')]=_0x24e479[_0x0140('0x70')];logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xc45398));return startTranscribe(_0x357fd1,_0x243fdc,_0x4c1020,uuidv4(),_0x3374d1,_0x24e479[_0x0140('0x70')]);})['then'](function(_0x7c7cbe){logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xc45398,_0x7c7cbe[_0x0140('0x73')]['TranscriptionJobName']));_0x4ae671[_0x0140('0x74')]=_0x7c7cbe[_0x0140('0x73')][_0x0140('0x75')];_0x4ae671[_0x0140('0x76')]=_0x7c7cbe[_0x0140('0x73')][_0x0140('0x77')];return _0x52b77f(_0x4ae671);})[_0x0140('0x43')](function(_0x3230b9){return _0x16a185(_0x3230b9);});});}exports['runTranscribe']=function(_0x24334a,_0x2f29b8,_0x33f42d){var _0x5431bf;var _0x356f5e;var _0x4d2ad5;var _0x3273f4=require(_0x0140('0x4d'));return db[_0x0140('0x2d')]['findOne']({'where':{'id':_0x24334a[_0x0140('0x45')]['id']}})[_0x0140('0x26')](function(_0x306bf9){if(_0x306bf9){var _0x3abfae=util[_0x0140('0x34')](_0x0140('0x50'),_0x306bf9[_0x0140('0x4f')]);if(fs['existsSync'](_0x3abfae)){cypher=!![];return _0x3273f4[_0x0140('0x64')](_0x3abfae,_0x306bf9[_0x0140('0x4f')],config[_0x0140('0x52')][_0x0140('0x53')])[_0x0140('0x26')](function(){return _0x306bf9;});}return _0x306bf9;}})[_0x0140('0x26')](function(_0x5569fb){if(!_0x5569fb){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))](_0x0140('0x78'));}_0x356f5e=_0x5569fb;return db[_0x0140('0x79')][_0x0140('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2f29b8,null))[_0x0140('0x26')](function(_0x3a9121){if(_0x3a9121){_0x5431bf=_0x3a9121;if(!_0x5431bf[_0x0140('0x7b')]||!_0x5431bf['transcribeAccountId']||!_0x5431bf['transcribeRegion']||!_0x5431bf[_0x0140('0x7c')]||!_0x5431bf[_0x0140('0x7d')]){throw new db['Sequelize'][(_0x0140('0x55'))](_0x0140('0x7e'));}if(_0x24334a[_0x0140('0x4a')][_0x0140('0x7f')]&&(!_0x5431bf['sentiment']||!_0x5431bf[_0x0140('0x80')]||!_0x5431bf[_0x0140('0x81')]||!_0x5431bf[_0x0140('0x7c')]||!_0x5431bf[_0x0140('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x0140('0x82'));}return db[_0x0140('0x83')][_0x0140('0x7a')]({'where':{'id':_0x5431bf['transcribeAccountId']}});}})[_0x0140('0x26')](function(_0x4f497d){if(!_0x4f497d){throw new db['Sequelize'][(_0x0140('0x55'))](_0x0140('0x84'));}if(!_0x4f497d['data1']||!_0x4f497d[_0x0140('0x85')]){throw new db[(_0x0140('0x54'))][(_0x0140('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x4d2ad5=_0x4f497d;return getBucketslist(_0x4d2ad5[_0x0140('0x86')],_0x4d2ad5[_0x0140('0x85')],_0x5431bf[_0x0140('0x87')]);})[_0x0140('0x26')](function(_0x29a11e){if(_0x29a11e&&_0x29a11e[_0x0140('0x88')]){var _0x2d56c9=_[_0x0140('0x4b')](_0x29a11e[_0x0140('0x88')],function(_0x58c2b7){return _0x58c2b7[_0x0140('0x89')]===_0x5431bf[_0x0140('0x7d')];});if(!_0x2d56c9){logger[_0x0140('0x66')](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x24334a['params']['id'],_0x5431bf[_0x0140('0x7d')]));return createBucket(_0x4d2ad5[_0x0140('0x86')],_0x4d2ad5['data2'],_0x5431bf[_0x0140('0x87')],_0x5431bf[_0x0140('0x7d')]);}logger['info'](util[_0x0140('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x24334a['params']['id'],_0x5431bf[_0x0140('0x7d')]));return;}})[_0x0140('0x26')](function(_0x3fd6bb){if(_0x356f5e[_0x0140('0x76')]===_0x0140('0x8a')){return transcribe(_0x24334a[_0x0140('0x45')]['id'],_0x4d2ad5['data1'],_0x4d2ad5[_0x0140('0x85')],_0x5431bf[_0x0140('0x87')],_0x5431bf[_0x0140('0x7d')],_0x356f5e['value'],_0x5431bf['language']);}else{logger[_0x0140('0x66')](util['format'](_0x0140('0x8b'),_0x24334a['params']['id']));return{'transcribeStatus':_0x0140('0x8c')};}})[_0x0140('0x26')](function(_0x2d79a6){if(_0x2d79a6){_0x2d79a6['tempSentiment']=_0x24334a[_0x0140('0x4a')]['runSentiment'];return _0x356f5e[_0x0140('0x8d')](_0x2d79a6);}})['then'](respondWithResult(_0x2f29b8,null))[_0x0140('0x43')](handleError(_0x2f29b8,null));};function writeFile(_0x54de81,_0x6874a5){return new Promise(function(_0x490739,_0x31c0e2){fs[_0x0140('0x8e')](_0x6874a5,_0x54de81,function(_0x4d1286,_0x5375a0){if(_0x4d1286){return _0x31c0e2(_0x4d1286);}else{return _0x490739(_0x5375a0);}});});}exports['downloadTranscribe']=function(_0x222c37,_0x1f8103,_0x36902d){return db[_0x0140('0x2d')][_0x0140('0x7a')]({'where':{'id':_0x222c37['params']['id']}})[_0x0140('0x26')](handleEntityNotFound(_0x1f8103))[_0x0140('0x26')](function(_0x1c255d){if(_0x1c255d&&_0x1c255d[_0x0140('0x8f')]){var _0x57b79b=_0x1c255d[_0x0140('0x8f')];var _0x2b6cd7=config['root']+_0x0140('0x90')+_0x1c255d['id']+'.txt';if(fs['existsSync'](_0x2b6cd7)){return _0x2b6cd7;}return writeFile(_0x57b79b,_0x2b6cd7)[_0x0140('0x26')](function(){return _0x2b6cd7;});}else{throw new db[(_0x0140('0x54'))]['ValidationError'](_0x0140('0x91'));}})['then'](function(_0x12e60c){return _0x1f8103[_0x0140('0x58')](_0x12e60c);})[_0x0140('0x43')](handleError(_0x1f8103));}; \ No newline at end of file +var _0x4b37=['show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','token','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Sequelize','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','transcribeRegion','IN_PROGRESS','runSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../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','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','catch'];(function(_0x147565,_0x1ca82c){var _0x46be9a=function(_0x3d3ffd){while(--_0x3d3ffd){_0x147565['push'](_0x147565['shift']());}};_0x46be9a(++_0x1ca82c);}(_0x4b37,0xda));var _0x74b3=function(_0x574b08,_0x327679){_0x574b08=_0x574b08-0x0;var _0x4a555b=_0x4b37[_0x574b08];return _0x4a555b;};'use strict';var emlformat=require(_0x74b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b3('0x2'));var moment=require(_0x74b3('0x3'));var BPromise=require(_0x74b3('0x4'));var Mustache=require(_0x74b3('0x5'));var util=require(_0x74b3('0x6'));var path=require(_0x74b3('0x7'));var sox=require(_0x74b3('0x8'));var csv=require('to-csv');var ejs=require(_0x74b3('0x9'));var fs=require('fs');var fs_extra=require(_0x74b3('0xa'));var _=require('lodash');var squel=require(_0x74b3('0xb'));var crypto=require(_0x74b3('0xc'));var jsforce=require(_0x74b3('0xd'));var deskjs=require(_0x74b3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x74b3('0xf'));var Papa=require(_0x74b3('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x74b3('0x11'));var Redis=require(_0x74b3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x74b3('0x13'));var hardwareService=require(_0x74b3('0x14'));var logger=require('../../config/logger')(_0x74b3('0x15'));var utils=require(_0x74b3('0x16'));var config=require(_0x74b3('0x17'));var licenseUtil=require(_0x74b3('0x18'));var db=require(_0x74b3('0x19'))['db'];function respondWithStatusCode(_0x3ed262,_0x77edd3){_0x77edd3=_0x77edd3||0xcc;return function(_0x5bb59a){if(_0x5bb59a){return _0x3ed262['sendStatus'](_0x77edd3);}return _0x3ed262[_0x74b3('0x1a')](_0x77edd3)[_0x74b3('0x1b')]();};}function respondWithResult(_0x5ccded,_0x504c5d){_0x504c5d=_0x504c5d||0xc8;return function(_0x557e5c){if(_0x557e5c){return _0x5ccded[_0x74b3('0x1a')](_0x504c5d)[_0x74b3('0x1c')](_0x557e5c);}};}function respondWithFilteredResult(_0x36fb4d,_0x21b0f5){return function(_0x2e9fb5){if(_0x2e9fb5){var _0x2b68b2=typeof _0x21b0f5['offset']===_0x74b3('0x1d')&&typeof _0x21b0f5[_0x74b3('0x1e')]==='undefined';var _0x403ad7=_0x2e9fb5[_0x74b3('0x1f')];var _0x5ac7aa=_0x2b68b2?0x0:_0x21b0f5[_0x74b3('0x20')];var _0x3fc801=_0x2b68b2?_0x2e9fb5['count']:_0x21b0f5[_0x74b3('0x20')]+_0x21b0f5[_0x74b3('0x1e')];var _0x47be2f;if(_0x3fc801>=_0x403ad7){_0x3fc801=_0x403ad7;_0x47be2f=0xc8;}else{_0x47be2f=0xce;}_0x36fb4d['status'](_0x47be2f);return _0x36fb4d[_0x74b3('0x21')](_0x74b3('0x22'),_0x5ac7aa+'-'+_0x3fc801+'/'+_0x403ad7)[_0x74b3('0x1c')](_0x2e9fb5);}return null;};}function patchUpdates(_0x35206a){return function(_0x4631c5){try{jsonpatch[_0x74b3('0x23')](_0x4631c5,_0x35206a,!![]);}catch(_0x2886c6){return BPromise['reject'](_0x2886c6);}return _0x4631c5[_0x74b3('0x24')]();};}function saveUpdates(_0x3db95c,_0x54779b){return function(_0x214049){if(_0x214049){return _0x214049['update'](_0x3db95c)[_0x74b3('0x25')](function(_0x57257d){return _0x57257d;});}return null;};}function removeEntity(_0x22031c,_0x3f122c){return function(_0x5ad950){if(_0x5ad950){return _0x5ad950[_0x74b3('0x26')]()[_0x74b3('0x25')](function(){_0x22031c['status'](0xcc)[_0x74b3('0x1b')]();});}};}function handleEntityNotFound(_0x418809,_0x2ef20f){return function(_0x16e8f1){if(!_0x16e8f1){_0x418809[_0x74b3('0x27')](0x194);}return _0x16e8f1;};}function handleError(_0x2974dc,_0x57d9bd){_0x57d9bd=_0x57d9bd||0x1f4;return function(_0x327c1c){logger['error'](_0x327c1c[_0x74b3('0x28')]);if(_0x327c1c[_0x74b3('0x29')]){delete _0x327c1c[_0x74b3('0x29')];}_0x2974dc[_0x74b3('0x1a')](_0x57d9bd)[_0x74b3('0x2a')](_0x327c1c);};}exports[_0x74b3('0x2b')]=function(_0x5258a4,_0x43e0a6){var _0x4e9445={},_0x3c4b9b={},_0x4f9066={'count':0x0,'rows':[]};var _0x1bc97a=_[_0x74b3('0x2c')](db['VoiceRecording'][_0x74b3('0x2d')],function(_0x4eb4ac){return{'name':_0x4eb4ac[_0x74b3('0x2e')],'type':_0x4eb4ac[_0x74b3('0x2f')]['key']};});_0x3c4b9b[_0x74b3('0x30')]=_[_0x74b3('0x31')](_[_0x74b3('0x2c')](_0x1bc97a,_0x74b3('0x29')),[_0x74b3('0x32')]);_0x3c4b9b[_0x74b3('0x33')]=_[_0x74b3('0x34')](_0x5258a4[_0x74b3('0x33')]);_0x3c4b9b[_0x74b3('0x35')]=_['intersection'](_0x3c4b9b[_0x74b3('0x30')],_0x3c4b9b[_0x74b3('0x33')]);_0x4e9445[_0x74b3('0x36')]=_[_0x74b3('0x37')](_0x3c4b9b[_0x74b3('0x30')],qs['fields'](_0x5258a4['query'][_0x74b3('0x38')]));_0x4e9445['attributes']=_0x4e9445[_0x74b3('0x36')][_0x74b3('0x39')]?_0x4e9445[_0x74b3('0x36')]:_0x3c4b9b[_0x74b3('0x30')];if(!_0x5258a4[_0x74b3('0x33')]['hasOwnProperty'](_0x74b3('0x3a'))){_0x4e9445[_0x74b3('0x1e')]=qs[_0x74b3('0x1e')](_0x5258a4['query'][_0x74b3('0x1e')]);_0x4e9445[_0x74b3('0x20')]=qs['offset'](_0x5258a4[_0x74b3('0x33')][_0x74b3('0x20')]);}_0x4e9445['order']=qs[_0x74b3('0x3b')](_0x5258a4[_0x74b3('0x33')][_0x74b3('0x3b')]);_0x4e9445[_0x74b3('0x3c')]=qs[_0x74b3('0x35')](_['pick'](_0x5258a4['query'],_0x3c4b9b[_0x74b3('0x35')]),_0x1bc97a);if(_0x5258a4[_0x74b3('0x33')][_0x74b3('0x3d')]){_0x4e9445[_0x74b3('0x3c')]=_[_0x74b3('0x3e')](_0x4e9445['where'],{'$or':_['map'](_0x1bc97a,function(_0x4b3520){if(_0x4b3520['type']!==_0x74b3('0x3f')){var _0x209fb4={};_0x209fb4[_0x4b3520['name']]={'$like':'%'+_0x5258a4[_0x74b3('0x33')][_0x74b3('0x3d')]+'%'};return _0x209fb4;}})});}_0x4e9445=_[_0x74b3('0x3e')]({},_0x4e9445,_0x5258a4[_0x74b3('0x40')]);var _0xee1b9c={'where':_0x4e9445[_0x74b3('0x3c')]};return db[_0x74b3('0x41')][_0x74b3('0x1f')](_0xee1b9c)[_0x74b3('0x25')](function(_0x10ca26){_0x4f9066[_0x74b3('0x1f')]=_0x10ca26;if(_0x5258a4[_0x74b3('0x33')]['includeAll']){_0x4e9445[_0x74b3('0x42')]=[{'all':!![]}];}return db[_0x74b3('0x41')][_0x74b3('0x43')](_0x4e9445);})['then'](function(_0x27b9a8){_0x4f9066[_0x74b3('0x44')]=_0x27b9a8;return _0x4f9066;})[_0x74b3('0x25')](respondWithFilteredResult(_0x43e0a6,_0x4e9445))[_0x74b3('0x45')](handleError(_0x43e0a6,null));};exports[_0x74b3('0x46')]=function(_0x25941c,_0x2d377e){var _0x385488={'raw':![],'where':{'id':_0x25941c[_0x74b3('0x47')]['id']}},_0x263232={};_0x263232['model']=_[_0x74b3('0x34')](db['VoiceRecording'][_0x74b3('0x2d')]);_0x263232[_0x74b3('0x33')]=_[_0x74b3('0x34')](_0x25941c[_0x74b3('0x33')]);_0x263232['filters']=_['intersection'](_0x263232[_0x74b3('0x30')],_0x263232['query']);_0x385488[_0x74b3('0x36')]=_[_0x74b3('0x37')](_0x263232[_0x74b3('0x30')],qs[_0x74b3('0x38')](_0x25941c[_0x74b3('0x33')]['fields']));_0x385488[_0x74b3('0x36')]=_0x385488['attributes'][_0x74b3('0x39')]?_0x385488[_0x74b3('0x36')]:_0x263232['model'];if(_0x25941c[_0x74b3('0x33')]['includeAll']){_0x385488[_0x74b3('0x42')]=[{'all':!![]}];}_0x385488=_[_0x74b3('0x3e')]({},_0x385488,_0x25941c[_0x74b3('0x40')]);return db[_0x74b3('0x41')][_0x74b3('0x48')](_0x385488)['then'](handleEntityNotFound(_0x2d377e,null))['then'](respondWithResult(_0x2d377e,null))[_0x74b3('0x45')](handleError(_0x2d377e,null));};exports[_0x74b3('0x49')]=function(_0x3d8305,_0x727922){return db[_0x74b3('0x41')][_0x74b3('0x49')](_0x3d8305[_0x74b3('0x4a')],{})[_0x74b3('0x25')](respondWithResult(_0x727922,0xc9))[_0x74b3('0x45')](handleError(_0x727922,null));};exports['update']=function(_0x13a088,_0x28914e){if(_0x13a088[_0x74b3('0x4a')]['id']){delete _0x13a088[_0x74b3('0x4a')]['id'];}return db[_0x74b3('0x41')]['find']({'where':{'id':_0x13a088[_0x74b3('0x47')]['id']}})[_0x74b3('0x25')](handleEntityNotFound(_0x28914e,null))[_0x74b3('0x25')](saveUpdates(_0x13a088[_0x74b3('0x4a')],null))[_0x74b3('0x25')](respondWithResult(_0x28914e,null))[_0x74b3('0x45')](handleError(_0x28914e,null));};exports['describe']=function(_0x304a0a,_0x55b38a){return db['VoiceRecording'][_0x74b3('0x4b')]()['then'](respondWithResult(_0x55b38a,null))[_0x74b3('0x45')](handleError(_0x55b38a,null));};exports[_0x74b3('0x4c')]=function(_0xa16b41,_0x5eedac,_0x39f7c5){var _0x5f816a=require(_0x74b3('0x4d'));var _0x30f538=![];var _0x394420={};if(_0xa16b41[_0x74b3('0x33')][_0x74b3('0x2f')]&&_0xa16b41[_0x74b3('0x33')]['type']===_0x74b3('0x4e')){_0x394420['uniqueid']=_0xa16b41[_0x74b3('0x47')]['id'];}else{_0x394420['id']=_0xa16b41[_0x74b3('0x47')]['id'];}return db[_0x74b3('0x41')][_0x74b3('0x48')]({'where':_0x394420,'attributes':['id',_0x74b3('0x4f')],'raw':!![]})[_0x74b3('0x25')](handleEntityNotFound(_0x5eedac,null))['then'](function(_0x592fd0){if(_0x592fd0){var _0x27fa5c=_0x592fd0[_0x74b3('0x4f')];var _0x391bc3=util[_0x74b3('0x32')](_0x74b3('0x50'),_0x27fa5c);if(fs[_0x74b3('0x51')](_0x391bc3)){_0x30f538=!![];return _0x5f816a['decryptFile'](_0x391bc3,_0x27fa5c,config[_0x74b3('0x52')][_0x74b3('0x53')])[_0x74b3('0x25')](function(){return _0x592fd0;});}return _0x592fd0;}})[_0x74b3('0x25')](function(_0x254a46){if(_0x254a46){var _0x1d9ecb=_0x254a46['value'];if(!fs[_0x74b3('0x51')](_0x1d9ecb)){throw new db['Sequelize'][(_0x74b3('0x54'))](_0x74b3('0x55'));}if(_0x254a46[_0x74b3('0x56')]){return _0x5eedac['download'](_0x1d9ecb,_0x254a46['filename']+path[_0x74b3('0x57')](_0x1d9ecb),function(){if(_0x30f538){fs['unlink'](_0x1d9ecb);}});}else{return _0x5eedac[_0x74b3('0x4c')](_0x1d9ecb,function(_0x2ef61e){if(_0x30f538){fs[_0x74b3('0x58')](_0x1d9ecb);}});}}})[_0x74b3('0x45')](function(_0x2f699f){if(_0x2f699f[_0x74b3('0x59')]===_0x74b3('0x55')){_0x5eedac['status'](0x194)[_0x74b3('0x2a')]('Not\x20found');}else{return handleError(_0x5eedac,null);}});};exports['downloads']=function(_0x43d204,_0x29a11c,_0x57d207){var _0x48b76f=require(_0x74b3('0x4d'));var _0x57114a=![];var _0x29fd66={'$and':[db[_0x74b3('0x5a')][_0x74b3('0x3c')](db[_0x74b3('0x5a')]['fn']('MD5',db[_0x74b3('0x5a')]['col']('uniqueid')),_0x43d204[_0x74b3('0x33')][_0x74b3('0x5b')])]};if(_0x43d204[_0x74b3('0x33')]['type']&&_0x43d204['query'][_0x74b3('0x2f')]===_0x74b3('0x4e')){_0x29fd66['$and'][_0x74b3('0x5c')]({'uniqueid':_0x43d204[_0x74b3('0x47')]['id']});}else{_0x29fd66['$and'][_0x74b3('0x5c')]({'id':_0x43d204[_0x74b3('0x47')]['id']});}return db[_0x74b3('0x41')][_0x74b3('0x48')]({'where':_0x29fd66,'attributes':['id',_0x74b3('0x4f')],'raw':!![]})[_0x74b3('0x25')](handleEntityNotFound(_0x29a11c,null))['then'](function(_0x3d8def){if(_0x3d8def){var _0x1d6a54=util['format']('%s.cypher',_0x3d8def['value']);if(fs[_0x74b3('0x51')](_0x1d6a54)){_0x57114a=!![];return _0x48b76f['decryptFile'](_0x1d6a54,_0x3d8def['value'],config['secrets']['recording'])[_0x74b3('0x25')](function(){return _0x3d8def;});}return _0x3d8def;}})[_0x74b3('0x25')](function(_0x4f5279){if(_0x4f5279){if(!fs[_0x74b3('0x51')](_0x4f5279['value'])){throw new db['Sequelize'][(_0x74b3('0x54'))](_0x74b3('0x55'));}if(_0x4f5279[_0x74b3('0x56')]){return _0x29a11c[_0x74b3('0x4c')](_0x4f5279[_0x74b3('0x4f')],_0x4f5279[_0x74b3('0x56')]+path['extname'](_0x4f5279['value']),function(){if(_0x57114a){fs['unlink'](_0x4f5279[_0x74b3('0x4f')]);}});}else{return _0x29a11c[_0x74b3('0x4c')](_0x4f5279['value'],function(_0x51e2e9){if(_0x57114a){fs['unlink'](_0x4f5279['value']);}});}}})[_0x74b3('0x45')](handleError(_0x29a11c,null));};exports[_0x74b3('0x26')]=function(_0x4fc0d8,_0x486bf6){return db[_0x74b3('0x41')][_0x74b3('0x48')]({'where':{'id':_0x4fc0d8[_0x74b3('0x47')]['id']}})['then'](function(_0xed7604){if(_[_0x74b3('0x5d')](_0xed7604)){throw new ReferenceError(_0x74b3('0x5e'));}return _0xed7604;})['then'](function(_0x3b17bd){var _0x3c58db=_0x3b17bd['value'];logger[_0x74b3('0x5f')](_0x74b3('0x60'),_0x3c58db);if(!_['isNil'](_0x3b17bd[_0x74b3('0x4f')])&&fs[_0x74b3('0x51')](_0x3c58db)){logger[_0x74b3('0x5f')](_0x74b3('0x61')+_0x3c58db+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x74b3('0x62')](_0x3c58db);}_0x3c58db=_0x3c58db+_0x74b3('0x63');if(!_['isNil'](_0x3b17bd[_0x74b3('0x4f')])&&fs['existsSync'](_0x3c58db)){logger[_0x74b3('0x5f')]('File:\x20\x22'+_0x3c58db+_0x74b3('0x64'));fs[_0x74b3('0x62')](_0x3c58db);}return _0x3b17bd;})[_0x74b3('0x25')](function(_0x270cc7){if(!_0x270cc7)throw new InternalError();return _0x270cc7[_0x74b3('0x26')]();})[_0x74b3('0x25')](function(){_0x486bf6[_0x74b3('0x1a')](0xcc)[_0x74b3('0x1b')]();})[_0x74b3('0x45')](handleError(_0x486bf6,null));};function getBucketslist(_0x4a7ac0,_0x31b984,_0x36724f){return new Promise(function(_0x4a321e,_0xbd6380){var _0x5af0be=new AWS['S3']({'accessKeyId':_0x31b984,'secretAccessKey':_0x4a7ac0,'region':_0x36724f});_0x5af0be[_0x74b3('0x65')]({},function(_0x155778,_0x1c09cc){if(_0x155778){return _0xbd6380(_0x155778);}else{return _0x4a321e(_0x1c09cc);}});});}function createBucket(_0x10ea40,_0x3e10cc,_0x22350a,_0x21c6ea){return new Promise(function(_0x5aff0b,_0x5db11a){var _0x40bfda=new AWS['S3']({'accessKeyId':_0x3e10cc,'secretAccessKey':_0x10ea40,'region':_0x22350a});_0x40bfda['createBucket']({'Bucket':_0x21c6ea},function(_0x31529a,_0x4b4501){if(_0x31529a){return _0x5db11a(_0x31529a);}else{return _0x5aff0b(_0x4b4501);}});});}function uploadFile(_0xbf4461,_0x407d1a,_0x4a6346,_0x18bb9b,_0x1b6f2a,_0xb44b3f){return new Promise(function(_0x3ad94b,_0x5984de){var _0x6b3f4b=new AWS['S3']({'accessKeyId':_0x407d1a,'secretAccessKey':_0xbf4461,'region':_0x4a6346});_0x6b3f4b['upload']({'Bucket':_0x18bb9b,'Key':_0x1b6f2a,'Body':_0xb44b3f},function(_0x2c634f,_0x2954b1){if(_0x2c634f){return _0x5984de(_0x2c634f);}else{return _0x3ad94b(_0x2954b1);}});});}function startTranscribe(_0xb60fdc,_0x2f91db,_0x644c6c,_0x71032,_0x18752d,_0x4d20dd){return new Promise(function(_0x189f8e,_0xdb2a8f){var _0x4b6a48=new AWS['TranscribeService']({'accessKeyId':_0x2f91db,'secretAccessKey':_0xb60fdc,'region':_0x644c6c});_0x4b6a48[_0x74b3('0x66')]({'TranscriptionJobName':_0x71032,'LanguageCode':_0x18752d,'Media':{'MediaFileUri':_0x4d20dd}},function(_0x51ee99,_0x4cd5e6){if(_0x51ee99){return _0xdb2a8f(_0x51ee99);}else{return _0x189f8e(_0x4cd5e6);}});});}function transcribe(_0x5823ef,_0x1f71fd,_0x410c1f,_0x544292,_0x3a4ecf,_0x2bad9a,_0x5984a8){return new Promise(function(_0x2acf86,_0xe7a66){var _0x3c188b={};logger[_0x74b3('0x5f')](util[_0x74b3('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5823ef,_0x3a4ecf));return uploadFile(_0x1f71fd,_0x410c1f,_0x544292,_0x3a4ecf,path[_0x74b3('0x67')](_0x2bad9a),fs['readFileSync'](_0x2bad9a))[_0x74b3('0x25')](function(_0x290dd8){logger[_0x74b3('0x5f')](util[_0x74b3('0x32')](_0x74b3('0x68'),_0x5823ef,_0x3a4ecf,_0x290dd8[_0x74b3('0x69')]));_0x3c188b['bucket']=_0x290dd8[_0x74b3('0x6a')];_0x3c188b[_0x74b3('0x6b')]=_0x290dd8[_0x74b3('0x69')];logger[_0x74b3('0x5f')](util[_0x74b3('0x32')](_0x74b3('0x6c'),_0x5823ef));return startTranscribe(_0x1f71fd,_0x410c1f,_0x544292,uuidv4(),_0x5984a8,_0x290dd8[_0x74b3('0x69')]);})[_0x74b3('0x25')](function(_0x62bc5a){logger[_0x74b3('0x5f')](util[_0x74b3('0x32')](_0x74b3('0x6d'),_0x5823ef,_0x62bc5a['TranscriptionJob'][_0x74b3('0x6e')]));_0x3c188b['transcribeName']=_0x62bc5a[_0x74b3('0x6f')]['TranscriptionJobName'];_0x3c188b[_0x74b3('0x70')]=_0x62bc5a[_0x74b3('0x6f')][_0x74b3('0x71')];return _0x2acf86(_0x3c188b);})[_0x74b3('0x45')](function(_0x562bbc){return _0xe7a66(_0x562bbc);});});}exports[_0x74b3('0x72')]=function(_0x5ae5b1,_0x27b4bc,_0x1456fd){var _0xe79679;var _0x491e8f;var _0x2a6ae3;var _0x218270=require(_0x74b3('0x4d'));return db[_0x74b3('0x41')]['findOne']({'where':{'id':_0x5ae5b1['params']['id']}})[_0x74b3('0x25')](function(_0x5ba398){if(_0x5ba398){var _0x63d14f=util[_0x74b3('0x32')](_0x74b3('0x50'),_0x5ba398['value']);if(fs[_0x74b3('0x51')](_0x63d14f)){cypher=!![];return _0x218270['decryptFile'](_0x63d14f,_0x5ba398['value'],config['secrets']['recording'])['then'](function(){return _0x5ba398;});}return _0x5ba398;}})[_0x74b3('0x25')](function(_0x3945ae){if(!_0x3945ae){throw new db[(_0x74b3('0x73'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x491e8f=_0x3945ae;return db[_0x74b3('0x74')][_0x74b3('0x75')]({'where':{'id':0x1}});})[_0x74b3('0x25')](handleEntityNotFound(_0x27b4bc,null))[_0x74b3('0x25')](function(_0x2f9993){if(_0x2f9993){_0xe79679=_0x2f9993;if(!_0xe79679[_0x74b3('0x76')]||!_0xe79679[_0x74b3('0x77')]||!_0xe79679['transcribeRegion']||!_0xe79679[_0x74b3('0x78')]||!_0xe79679['bucket']){throw new db[(_0x74b3('0x73'))][(_0x74b3('0x54'))](_0x74b3('0x79'));}if(_0x5ae5b1[_0x74b3('0x4a')]['runSentiment']&&(!_0xe79679[_0x74b3('0x7a')]||!_0xe79679['sentimentAccountId']||!_0xe79679[_0x74b3('0x7b')]||!_0xe79679[_0x74b3('0x78')]||!_0xe79679[_0x74b3('0x7c')])){throw new db[(_0x74b3('0x73'))][(_0x74b3('0x54'))](_0x74b3('0x7d'));}return db[_0x74b3('0x7e')][_0x74b3('0x75')]({'where':{'id':_0xe79679[_0x74b3('0x77')]}});}})[_0x74b3('0x25')](function(_0x86f505){if(!_0x86f505){throw new db[(_0x74b3('0x73'))][(_0x74b3('0x54'))](_0x74b3('0x7f'));}if(!_0x86f505[_0x74b3('0x80')]||!_0x86f505[_0x74b3('0x81')]){throw new db[(_0x74b3('0x73'))]['ValidationError'](_0x74b3('0x82'));}_0x2a6ae3=_0x86f505;return getBucketslist(_0x2a6ae3['data1'],_0x2a6ae3['data2'],_0xe79679['transcribeRegion']);})[_0x74b3('0x25')](function(_0x37528a){if(_0x37528a&&_0x37528a[_0x74b3('0x83')]){var _0x5ede96=_['find'](_0x37528a['Buckets'],function(_0x2a7b6b){return _0x2a7b6b[_0x74b3('0x84')]===_0xe79679[_0x74b3('0x7c')];});if(!_0x5ede96){logger[_0x74b3('0x5f')](util[_0x74b3('0x32')](_0x74b3('0x85'),_0x5ae5b1[_0x74b3('0x47')]['id'],_0xe79679[_0x74b3('0x7c')]));return createBucket(_0x2a6ae3['data1'],_0x2a6ae3[_0x74b3('0x81')],_0xe79679['transcribeRegion'],_0xe79679[_0x74b3('0x7c')]);}logger[_0x74b3('0x5f')](util[_0x74b3('0x32')](_0x74b3('0x86'),_0x5ae5b1[_0x74b3('0x47')]['id'],_0xe79679[_0x74b3('0x7c')]));return;}})[_0x74b3('0x25')](function(_0x1d8e29){if(_0x491e8f[_0x74b3('0x70')]===_0x74b3('0x87')){return transcribe(_0x5ae5b1[_0x74b3('0x47')]['id'],_0x2a6ae3[_0x74b3('0x80')],_0x2a6ae3['data2'],_0xe79679[_0x74b3('0x88')],_0xe79679[_0x74b3('0x7c')],_0x491e8f[_0x74b3('0x4f')],_0xe79679[_0x74b3('0x78')]);}else{logger[_0x74b3('0x5f')](util[_0x74b3('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5ae5b1[_0x74b3('0x47')]['id']));return{'transcribeStatus':_0x74b3('0x89')};}})[_0x74b3('0x25')](function(_0x38d13a){if(_0x38d13a){_0x38d13a['tempSentiment']=_0x5ae5b1['body'][_0x74b3('0x8a')];return _0x491e8f[_0x74b3('0x8b')](_0x38d13a);}})[_0x74b3('0x25')](respondWithResult(_0x27b4bc,null))[_0x74b3('0x45')](handleError(_0x27b4bc,null));};function writeFile(_0x4ffd6c,_0x2366a6){return new Promise(function(_0x41f8f2,_0x578d40){fs['writeFile'](_0x2366a6,_0x4ffd6c,function(_0x3e75f6,_0xfae9db){if(_0x3e75f6){return _0x578d40(_0x3e75f6);}else{return _0x41f8f2(_0xfae9db);}});});}exports['downloadTranscribe']=function(_0x23dee8,_0x48a4f2,_0x1b0011){return db['VoiceRecording']['findOne']({'where':{'id':_0x23dee8[_0x74b3('0x47')]['id']}})[_0x74b3('0x25')](handleEntityNotFound(_0x48a4f2))[_0x74b3('0x25')](function(_0x5cc1fb){if(_0x5cc1fb&&_0x5cc1fb[_0x74b3('0x8c')]){var _0x3094a0=_0x5cc1fb[_0x74b3('0x8c')];var _0x4afb8e=config[_0x74b3('0x8d')]+_0x74b3('0x8e')+_0x5cc1fb['id']+'.txt';if(fs[_0x74b3('0x51')](_0x4afb8e)){return _0x4afb8e;}return writeFile(_0x3094a0,_0x4afb8e)[_0x74b3('0x25')](function(){return _0x4afb8e;});}else{throw new db[(_0x74b3('0x73'))][(_0x74b3('0x54'))](_0x74b3('0x8f'));}})['then'](function(_0x80a840){return _0x48a4f2[_0x74b3('0x4c')](_0x80a840);})[_0x74b3('0x45')](handleError(_0x48a4f2));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 906a80a..d1b8649 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 _0x0328=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x11879c,_0x804353){var _0x4964c3=function(_0x2e8e43){while(--_0x2e8e43){_0x11879c['push'](_0x11879c['shift']());}};_0x4964c3(++_0x804353);}(_0x0328,0x172));var _0x8032=function(_0xe967ef,_0x444e7b){_0xe967ef=_0xe967ef-0x0;var _0x3e63d8=_0x0328[_0xe967ef];return _0x3e63d8;};'use strict';var attributes=require(_0x8032('0x0'));module[_0x8032('0x1')]=function(_0x2bdc4f,_0x3be376){return _0x2bdc4f[_0x8032('0x2')](_0x8032('0x3'),attributes,{'tableName':_0x8032('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8032('0x5')]},{'name':_0x8032('0x6'),'fields':[_0x8032('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43b1=['exports','define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x4418d6,_0x2a3b34){var _0x765d86=function(_0x386738){while(--_0x386738){_0x4418d6['push'](_0x4418d6['shift']());}};_0x765d86(++_0x2a3b34);}(_0x43b1,0x7d));var _0x143b=function(_0x133926,_0x45f4c9){_0x133926=_0x133926-0x0;var _0x3080f4=_0x43b1[_0x133926];return _0x3080f4;};'use strict';var attributes=require(_0x143b('0x0'));module[_0x143b('0x1')]=function(_0x426f2c,_0x4c0b11){return _0x426f2c[_0x143b('0x2')]('VoiceRecording',attributes,{'tableName':_0x143b('0x3'),'paranoid':![],'indexes':[{'name':_0x143b('0x4'),'fields':[_0x143b('0x4')]},{'name':_0x143b('0x5'),'fields':[_0x143b('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c98b793..8eccd40 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x3cb712,_0x5ab0cd){var _0x549c2a=function(_0x16a400){while(--_0x16a400){_0x3cb712['push'](_0x3cb712['shift']());}};_0x549c2a(++_0x5ab0cd);}(_0x66fa,0x117));var _0xa66f=function(_0x27d6ec,_0x3aa33c){_0x27d6ec=_0x27d6ec-0x0;var _0x4954da=_0x66fa[_0x27d6ec];return _0x4954da;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x47c5=['secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','UpdateVoiceRecording','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher'];(function(_0x5d1e62,_0x287135){var _0x1d80aa=function(_0x242379){while(--_0x242379){_0x5d1e62['push'](_0x5d1e62['shift']());}};_0x1d80aa(++_0x287135);}(_0x47c5,0x165));var _0x547c=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x47c5[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['UpdateVoiceRecording']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fa9e['options']?_0x23fa9e['options'][_0x547c('0x1d')]||null:null,'attributes':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1e')]||null:null,'limit':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1f')]||null:null})[_0x547c('0xc')](function(_0x436e67){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x436e67));_0xeb059e(_0x436e67);})[_0x547c('0x17')](function(_0x2663bc){logger[_0x547c('0x13')](_0x547c('0x20'),_0x2663bc['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2663bc['message']));});});};exports['CreateVoiceRecording']=function(_0x4855fd){var _0x478f04=this;return new Promise(function(_0x2c725d,_0x4c5256){var _0x93985c=require('../../components/encryptor');var _0x3ea493;return db['Setting'][_0x547c('0x21')]({'attributes':['id',_0x547c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x547c('0xc')](function(_0x30a96c){_0x3ea493=_0x30a96c;return db[_0x547c('0x18')]['create'](_0x4855fd['body']);})[_0x547c('0xc')](function(_0x54de6f){if(_0x3ea493[_0x547c('0x22')]&&fs[_0x547c('0x23')](_0x54de6f[_0x547c('0x24')])){var _0x1695be=util[_0x547c('0x25')](_0x547c('0x26'),_0x54de6f[_0x547c('0x24')]);return _0x93985c['encryptFile'](_0x54de6f['value'],_0x1695be,config[_0x547c('0x27')][_0x547c('0x28')])[_0x547c('0xc')](function(){fs[_0x547c('0x29')](_0x54de6f[_0x547c('0x24')]);logger[_0x547c('0xd')](_0x547c('0x2a'));return _0x54de6f;});}return _0x54de6f;})[_0x547c('0xc')](function(_0x378bac){logger[_0x547c('0xd')](_0x547c('0x2b'),_0x4855fd);logger[_0x547c('0x10')](_0x547c('0x2b'),_0x4855fd,JSON[_0x547c('0x12')](_0x378bac));_0x2c725d(_0x378bac);})['catch'](function(_0x3afc28){logger['error']('CreateVoiceRecording',_0x3afc28['message'],_0x4855fd);_0x4c5256(_0x478f04[_0x547c('0x13')](0x1f4,_0x3afc28[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 85d58c2..fbcb5d0 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 _0xfed7=['/:id','show','post','isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index'];(function(_0x4183ce,_0x200d5f){var _0x156fb3=function(_0x54e706){while(--_0x54e706){_0x4183ce['push'](_0x4183ce['shift']());}};_0x156fb3(++_0x200d5f);}(_0xfed7,0xc6));var _0x7fed=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0xfed7[_0x16ecad];return _0x313ff7;};'use strict';var multer=require(_0x7fed('0x0'));var util=require(_0x7fed('0x1'));var path=require(_0x7fed('0x2'));var timeout=require(_0x7fed('0x3'));var express=require(_0x7fed('0x4'));var router=express[_0x7fed('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7fed('0x6'));var interaction=require(_0x7fed('0x7'));var config=require('../../config/environment');var controller=require(_0x7fed('0x8'));router[_0x7fed('0x9')]('/',auth['isAuthenticated'](),controller[_0x7fed('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7fed('0x9')](_0x7fed('0xb'),auth['isAuthenticated'](),controller[_0x7fed('0xc')]);router[_0x7fed('0xd')]('/',auth[_0x7fed('0xe')](),controller[_0x7fed('0xf')]);router[_0x7fed('0x10')](_0x7fed('0xb'),auth[_0x7fed('0xe')](),controller['update']);router['delete'](_0x7fed('0xb'),auth[_0x7fed('0xe')](),controller[_0x7fed('0x11')]);module[_0x7fed('0x12')]=router; \ No newline at end of file +var _0x45c9=['describe','show','create','put','delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x38f81d,_0x33a99c){var _0x5ba0c4=function(_0x518a71){while(--_0x518a71){_0x38f81d['push'](_0x38f81d['shift']());}};_0x5ba0c4(++_0x33a99c);}(_0x45c9,0x146));var _0x945c=function(_0x4b5cc0,_0x1c6d9d){_0x4b5cc0=_0x4b5cc0-0x0;var _0x1336b9=_0x45c9[_0x4b5cc0];return _0x1336b9;};'use strict';var multer=require(_0x945c('0x0'));var util=require(_0x945c('0x1'));var path=require(_0x945c('0x2'));var timeout=require(_0x945c('0x3'));var express=require(_0x945c('0x4'));var router=express[_0x945c('0x5')]();var fs_extra=require(_0x945c('0x6'));var auth=require(_0x945c('0x7'));var interaction=require(_0x945c('0x8'));var config=require('../../config/environment');var controller=require(_0x945c('0x9'));router[_0x945c('0xa')]('/',auth['isAuthenticated'](),controller[_0x945c('0xb')]);router[_0x945c('0xa')](_0x945c('0xc'),auth[_0x945c('0xd')](),controller[_0x945c('0xe')]);router[_0x945c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x945c('0xf')]);router['post']('/',auth[_0x945c('0xd')](),controller[_0x945c('0x10')]);router[_0x945c('0x11')]('/:id',auth[_0x945c('0xd')](),controller['update']);router[_0x945c('0x12')](_0x945c('0x13'),auth[_0x945c('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e98a1ea..bfc54cf 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 _0xa575=['STRING','moment','exports','ENUM','blind','attended'];(function(_0x38b2cf,_0xd295cd){var _0x4db861=function(_0x28ddad){while(--_0x28ddad){_0x38b2cf['push'](_0x38b2cf['shift']());}};_0x4db861(++_0xd295cd);}(_0xa575,0x14b));var _0x5a57=function(_0x3c4e2f,_0x58fb74){_0x3c4e2f=_0x3c4e2f-0x0;var _0x598678=_0xa575[_0x3c4e2f];return _0x598678;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5a57('0x0'));module[_0x5a57('0x1')]={'type':{'type':Sequelize[_0x5a57('0x2')](_0x5a57('0x3'),_0x5a57('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5a57('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x5a57('0x5')]},'transferercalleridname':{'type':Sequelize[_0x5a57('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5a57('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5a57('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5a57('0x5')]},'transferercontext':{'type':Sequelize[_0x5a57('0x5')]},'transfererexten':{'type':Sequelize[_0x5a57('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5a57('0x5')]},'transfereechannel':{'type':Sequelize[_0x5a57('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5a57('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5a57('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x5a57('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5a57('0x5')]},'transfereecontext':{'type':Sequelize[_0x5a57('0x5')]},'transfereeexten':{'type':Sequelize[_0x5a57('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x5a57('0x5')]},'isexternal':{'type':Sequelize[_0x5a57('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x5a57('0x5')]},'extension':{'type':Sequelize[_0x5a57('0x5')]}}; \ No newline at end of file +var _0x85d9=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x252f27,_0x5d0ef4){var _0x23d38f=function(_0x5107e6){while(--_0x5107e6){_0x252f27['push'](_0x252f27['shift']());}};_0x23d38f(++_0x5d0ef4);}(_0x85d9,0x14b));var _0x985d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x85d9[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x985d('0x0'));module['exports']={'type':{'type':Sequelize[_0x985d('0x1')](_0x985d('0x2'),_0x985d('0x3'))},'result':{'type':Sequelize[_0x985d('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x985d('0x4')]},'transferercalleridname':{'type':Sequelize[_0x985d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x985d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x985d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x985d('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x985d('0x4')]},'transfereechannel':{'type':Sequelize[_0x985d('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x985d('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x985d('0x4')]},'transfereecontext':{'type':Sequelize[_0x985d('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x985d('0x4')]},'isexternal':{'type':Sequelize[_0x985d('0x1')](_0x985d('0x5'),'No')},'context':{'type':Sequelize[_0x985d('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ae8d203..897e5d7 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 _0xe1fb=['destroy','sendStatus','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','then','rows','catch','show','params','rawAttributes','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset','set','apply','reject','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe1fb,0x188));var _0xbe1f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe1fb[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xbe1f('0x0'));var rimraf=require(_0xbe1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe1f('0x2'));var rp=require(_0xbe1f('0x3'));var moment=require(_0xbe1f('0x4'));var BPromise=require(_0xbe1f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe1f('0x6'));var sox=require(_0xbe1f('0x7'));var csv=require(_0xbe1f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe1f('0x9'));var squel=require(_0xbe1f('0xa'));var crypto=require('crypto');var jsforce=require(_0xbe1f('0xb'));var deskjs=require(_0xbe1f('0xc'));var toCsv=require(_0xbe1f('0x8'));var querystring=require('querystring');var Papa=require(_0xbe1f('0xd'));var Redis=require(_0xbe1f('0xe'));var authService=require(_0xbe1f('0xf'));var qs=require(_0xbe1f('0x10'));var as=require(_0xbe1f('0x11'));var hardwareService=require(_0xbe1f('0x12'));var logger=require(_0xbe1f('0x13'))(_0xbe1f('0x14'));var utils=require('../../config/utils');var config=require(_0xbe1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe1f('0x16'))['db'];function respondWithStatusCode(_0x348bb5,_0x3ee519){_0x3ee519=_0x3ee519||0xcc;return function(_0x90f4d7){if(_0x90f4d7){return _0x348bb5['sendStatus'](_0x3ee519);}return _0x348bb5['status'](_0x3ee519)[_0xbe1f('0x17')]();};}function respondWithResult(_0x450aeb,_0x5d315a){_0x5d315a=_0x5d315a||0xc8;return function(_0x153146){if(_0x153146){return _0x450aeb[_0xbe1f('0x18')](_0x5d315a)[_0xbe1f('0x19')](_0x153146);}};}function respondWithFilteredResult(_0x33be35,_0x409e6e){return function(_0x392c4d){if(_0x392c4d){var _0x7cd1f0=typeof _0x409e6e['offset']==='undefined'&&typeof _0x409e6e[_0xbe1f('0x1a')]===_0xbe1f('0x1b');var _0x50cb61=_0x392c4d[_0xbe1f('0x1c')];var _0x394ac2=_0x7cd1f0?0x0:_0x409e6e['offset'];var _0xac2de5=_0x7cd1f0?_0x392c4d[_0xbe1f('0x1c')]:_0x409e6e[_0xbe1f('0x1d')]+_0x409e6e[_0xbe1f('0x1a')];var _0x224543;if(_0xac2de5>=_0x50cb61){_0xac2de5=_0x50cb61;_0x224543=0xc8;}else{_0x224543=0xce;}_0x33be35[_0xbe1f('0x18')](_0x224543);return _0x33be35[_0xbe1f('0x1e')]('Content-Range',_0x394ac2+'-'+_0xac2de5+'/'+_0x50cb61)[_0xbe1f('0x19')](_0x392c4d);}return null;};}function patchUpdates(_0x30a323){return function(_0x6887da){try{jsonpatch[_0xbe1f('0x1f')](_0x6887da,_0x30a323,!![]);}catch(_0x5e8ec5){return BPromise[_0xbe1f('0x20')](_0x5e8ec5);}return _0x6887da['save']();};}function saveUpdates(_0x1c3fbf,_0x222d83){return function(_0x1a14c7){if(_0x1a14c7){return _0x1a14c7[_0xbe1f('0x21')](_0x1c3fbf)['then'](function(_0x1d3317){return _0x1d3317;});}return null;};}function removeEntity(_0x114da1,_0x22d284){return function(_0x574d6b){if(_0x574d6b){return _0x574d6b[_0xbe1f('0x22')]()['then'](function(){_0x114da1[_0xbe1f('0x18')](0xcc)[_0xbe1f('0x17')]();});}};}function handleEntityNotFound(_0x2253e9,_0x23a662){return function(_0x59efc0){if(!_0x59efc0){_0x2253e9[_0xbe1f('0x23')](0x194);}return _0x59efc0;};}function handleError(_0xe64d7a,_0x398f95){_0x398f95=_0x398f95||0x1f4;return function(_0x55a6cb){logger[_0xbe1f('0x24')](_0x55a6cb[_0xbe1f('0x25')]);if(_0x55a6cb[_0xbe1f('0x26')]){delete _0x55a6cb['name'];}_0xe64d7a[_0xbe1f('0x18')](_0x398f95)[_0xbe1f('0x27')](_0x55a6cb);};}exports[_0xbe1f('0x28')]=function(_0x1c7c34,_0x435e52){var _0x3e0966={},_0x1a4ff3={},_0x4d1502={'count':0x0,'rows':[]};var _0x5b2839=_['map'](db[_0xbe1f('0x29')]['rawAttributes'],function(_0x24dffa){return{'name':_0x24dffa[_0xbe1f('0x2a')],'type':_0x24dffa[_0xbe1f('0x2b')]['key']};});_0x1a4ff3[_0xbe1f('0x2c')]=_[_0xbe1f('0x2d')](_0x5b2839,_0xbe1f('0x26'));_0x1a4ff3[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x1c7c34[_0xbe1f('0x2e')]);_0x1a4ff3['filters']=_[_0xbe1f('0x30')](_0x1a4ff3[_0xbe1f('0x2c')],_0x1a4ff3[_0xbe1f('0x2e')]);_0x3e0966[_0xbe1f('0x31')]=_[_0xbe1f('0x30')](_0x1a4ff3[_0xbe1f('0x2c')],qs[_0xbe1f('0x32')](_0x1c7c34[_0xbe1f('0x2e')]['fields']));_0x3e0966[_0xbe1f('0x31')]=_0x3e0966[_0xbe1f('0x31')][_0xbe1f('0x33')]?_0x3e0966['attributes']:_0x1a4ff3[_0xbe1f('0x2c')];if(!_0x1c7c34[_0xbe1f('0x2e')]['hasOwnProperty']('nolimit')){_0x3e0966[_0xbe1f('0x1a')]=qs[_0xbe1f('0x1a')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x1a')]);_0x3e0966['offset']=qs[_0xbe1f('0x1d')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x1d')]);}_0x3e0966[_0xbe1f('0x34')]=qs[_0xbe1f('0x35')](_0x1c7c34[_0xbe1f('0x2e')][_0xbe1f('0x35')]);_0x3e0966['where']=qs[_0xbe1f('0x36')](_[_0xbe1f('0x37')](_0x1c7c34[_0xbe1f('0x2e')],_0x1a4ff3[_0xbe1f('0x36')]),_0x5b2839);if(_0x1c7c34['query'][_0xbe1f('0x38')]){_0x3e0966[_0xbe1f('0x39')]=_[_0xbe1f('0x3a')](_0x3e0966[_0xbe1f('0x39')],{'$or':_[_0xbe1f('0x2d')](_0x5b2839,function(_0x561cc9){if(_0x561cc9[_0xbe1f('0x2b')]!==_0xbe1f('0x3b')){var _0x4a2459={};_0x4a2459[_0x561cc9[_0xbe1f('0x26')]]={'$like':'%'+_0x1c7c34[_0xbe1f('0x2e')]['filter']+'%'};return _0x4a2459;}})});}_0x3e0966=_[_0xbe1f('0x3a')]({},_0x3e0966,_0x1c7c34[_0xbe1f('0x3c')]);var _0x16efcb={'where':_0x3e0966['where']};return db[_0xbe1f('0x29')][_0xbe1f('0x1c')](_0x16efcb)['then'](function(_0x238d7a){_0x4d1502['count']=_0x238d7a;if(_0x1c7c34[_0xbe1f('0x2e')]['includeAll']){_0x3e0966[_0xbe1f('0x3d')]=[{'all':!![]}];}return db[_0xbe1f('0x29')]['findAll'](_0x3e0966);})[_0xbe1f('0x3e')](function(_0x5f8416){_0x4d1502[_0xbe1f('0x3f')]=_0x5f8416;return _0x4d1502;})[_0xbe1f('0x3e')](respondWithFilteredResult(_0x435e52,_0x3e0966))[_0xbe1f('0x40')](handleError(_0x435e52,null));};exports[_0xbe1f('0x41')]=function(_0x8b4506,_0x1924d9){var _0x3123d8={'raw':!![],'where':{'id':_0x8b4506[_0xbe1f('0x42')]['id']}},_0x1d178a={};_0x1d178a[_0xbe1f('0x2c')]=_[_0xbe1f('0x2f')](db[_0xbe1f('0x29')][_0xbe1f('0x43')]);_0x1d178a[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x8b4506[_0xbe1f('0x2e')]);_0x1d178a[_0xbe1f('0x36')]=_[_0xbe1f('0x30')](_0x1d178a['model'],_0x1d178a[_0xbe1f('0x2e')]);_0x3123d8['attributes']=_[_0xbe1f('0x30')](_0x1d178a['model'],qs[_0xbe1f('0x32')](_0x8b4506[_0xbe1f('0x2e')][_0xbe1f('0x32')]));_0x3123d8['attributes']=_0x3123d8[_0xbe1f('0x31')]['length']?_0x3123d8['attributes']:_0x1d178a[_0xbe1f('0x2c')];if(_0x8b4506[_0xbe1f('0x2e')]['includeAll']){_0x3123d8['include']=[{'all':!![]}];}_0x3123d8=_[_0xbe1f('0x3a')]({},_0x3123d8,_0x8b4506['options']);return db['VoiceTransferReport'][_0xbe1f('0x44')](_0x3123d8)[_0xbe1f('0x3e')](handleEntityNotFound(_0x1924d9,null))[_0xbe1f('0x3e')](respondWithResult(_0x1924d9,null))[_0xbe1f('0x40')](handleError(_0x1924d9,null));};exports['create']=function(_0x20c3ee,_0x1f9538){return db[_0xbe1f('0x29')]['create'](_0x20c3ee[_0xbe1f('0x45')],{})[_0xbe1f('0x3e')](respondWithResult(_0x1f9538,0xc9))['catch'](handleError(_0x1f9538,null));};exports[_0xbe1f('0x21')]=function(_0x21c74f,_0x1a9e13){if(_0x21c74f['body']['id']){delete _0x21c74f[_0xbe1f('0x45')]['id'];}return db[_0xbe1f('0x29')][_0xbe1f('0x44')]({'where':{'id':_0x21c74f[_0xbe1f('0x42')]['id']}})[_0xbe1f('0x3e')](handleEntityNotFound(_0x1a9e13,null))[_0xbe1f('0x3e')](saveUpdates(_0x21c74f[_0xbe1f('0x45')],null))[_0xbe1f('0x3e')](respondWithResult(_0x1a9e13,null))[_0xbe1f('0x40')](handleError(_0x1a9e13,null));};exports[_0xbe1f('0x22')]=function(_0x141308,_0x512072){return db[_0xbe1f('0x29')][_0xbe1f('0x44')]({'where':{'id':_0x141308[_0xbe1f('0x42')]['id']}})[_0xbe1f('0x3e')](handleEntityNotFound(_0x512072,null))['then'](removeEntity(_0x512072,null))[_0xbe1f('0x40')](handleError(_0x512072,null));};exports['describe']=function(_0x6d1f3c,_0x2c6dac){return db['VoiceTransferReport'][_0xbe1f('0x46')]()[_0xbe1f('0x3e')](respondWithResult(_0x2c6dac,null))[_0xbe1f('0x40')](handleError(_0x2c6dac,null));}; \ No newline at end of file +var _0xf0e7=['options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','json','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter'];(function(_0x2e8a70,_0x43d2b0){var _0x1ffcdf=function(_0x479f4e){while(--_0x479f4e){_0x2e8a70['push'](_0x2e8a70['shift']());}};_0x1ffcdf(++_0x43d2b0);}(_0xf0e7,0x1c3));var _0x7f0e=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0xf0e7[_0x3e0dc4];return _0x586111;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f0e('0x1'));var rp=require(_0x7f0e('0x2'));var moment=require(_0x7f0e('0x3'));var BPromise=require(_0x7f0e('0x4'));var Mustache=require('mustache');var util=require(_0x7f0e('0x5'));var path=require('path');var sox=require(_0x7f0e('0x6'));var csv=require(_0x7f0e('0x7'));var ejs=require(_0x7f0e('0x8'));var fs=require('fs');var fs_extra=require(_0x7f0e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f0e('0xa'));var jsforce=require(_0x7f0e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f0e('0xc'));var Redis=require(_0x7f0e('0xd'));var authService=require(_0x7f0e('0xe'));var qs=require(_0x7f0e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f0e('0x10'));var logger=require(_0x7f0e('0x11'))(_0x7f0e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f0e('0x13'));var db=require(_0x7f0e('0x14'))['db'];function respondWithStatusCode(_0x44a496,_0x46012b){_0x46012b=_0x46012b||0xcc;return function(_0x4083ef){if(_0x4083ef){return _0x44a496[_0x7f0e('0x15')](_0x46012b);}return _0x44a496[_0x7f0e('0x16')](_0x46012b)[_0x7f0e('0x17')]();};}function respondWithResult(_0x5f5248,_0x32e55b){_0x32e55b=_0x32e55b||0xc8;return function(_0x4d74e9){if(_0x4d74e9){return _0x5f5248[_0x7f0e('0x16')](_0x32e55b)['json'](_0x4d74e9);}};}function respondWithFilteredResult(_0x59678b,_0x53c4f3){return function(_0x3665db){if(_0x3665db){var _0x451336=typeof _0x53c4f3[_0x7f0e('0x18')]==='undefined'&&typeof _0x53c4f3['limit']===_0x7f0e('0x19');var _0x25ae07=_0x3665db['count'];var _0x5b4f44=_0x451336?0x0:_0x53c4f3[_0x7f0e('0x18')];var _0x1e5ff2=_0x451336?_0x3665db['count']:_0x53c4f3['offset']+_0x53c4f3[_0x7f0e('0x1a')];var _0x3aabe9;if(_0x1e5ff2>=_0x25ae07){_0x1e5ff2=_0x25ae07;_0x3aabe9=0xc8;}else{_0x3aabe9=0xce;}_0x59678b[_0x7f0e('0x16')](_0x3aabe9);return _0x59678b['set']('Content-Range',_0x5b4f44+'-'+_0x1e5ff2+'/'+_0x25ae07)[_0x7f0e('0x1b')](_0x3665db);}return null;};}function patchUpdates(_0x34ce14){return function(_0xae40b7){try{jsonpatch[_0x7f0e('0x1c')](_0xae40b7,_0x34ce14,!![]);}catch(_0x59daf9){return BPromise['reject'](_0x59daf9);}return _0xae40b7[_0x7f0e('0x1d')]();};}function saveUpdates(_0x32e015,_0x57755e){return function(_0x2ce397){if(_0x2ce397){return _0x2ce397[_0x7f0e('0x1e')](_0x32e015)[_0x7f0e('0x1f')](function(_0x2f8c67){return _0x2f8c67;});}return null;};}function removeEntity(_0x5dc2ca,_0x728b30){return function(_0x451f51){if(_0x451f51){return _0x451f51[_0x7f0e('0x20')]()['then'](function(){_0x5dc2ca[_0x7f0e('0x16')](0xcc)[_0x7f0e('0x17')]();});}};}function handleEntityNotFound(_0x43fda6,_0x2a1c63){return function(_0x5bebff){if(!_0x5bebff){_0x43fda6[_0x7f0e('0x15')](0x194);}return _0x5bebff;};}function handleError(_0x2380ec,_0x1c9b9d){_0x1c9b9d=_0x1c9b9d||0x1f4;return function(_0x1d82e2){logger[_0x7f0e('0x21')](_0x1d82e2[_0x7f0e('0x22')]);if(_0x1d82e2[_0x7f0e('0x23')]){delete _0x1d82e2[_0x7f0e('0x23')];}_0x2380ec[_0x7f0e('0x16')](_0x1c9b9d)[_0x7f0e('0x24')](_0x1d82e2);};}exports[_0x7f0e('0x25')]=function(_0x4868f2,_0x4e7373){var _0x1421e1={},_0x538c10={},_0x54872a={'count':0x0,'rows':[]};var _0x43a4fb=_[_0x7f0e('0x26')](db[_0x7f0e('0x27')][_0x7f0e('0x28')],function(_0xeefba6){return{'name':_0xeefba6[_0x7f0e('0x29')],'type':_0xeefba6[_0x7f0e('0x2a')][_0x7f0e('0x2b')]};});_0x538c10[_0x7f0e('0x2c')]=_['map'](_0x43a4fb,_0x7f0e('0x23'));_0x538c10[_0x7f0e('0x2d')]=_[_0x7f0e('0x2e')](_0x4868f2[_0x7f0e('0x2d')]);_0x538c10[_0x7f0e('0x2f')]=_['intersection'](_0x538c10[_0x7f0e('0x2c')],_0x538c10['query']);_0x1421e1[_0x7f0e('0x30')]=_[_0x7f0e('0x31')](_0x538c10[_0x7f0e('0x2c')],qs[_0x7f0e('0x32')](_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x32')]));_0x1421e1['attributes']=_0x1421e1[_0x7f0e('0x30')][_0x7f0e('0x33')]?_0x1421e1[_0x7f0e('0x30')]:_0x538c10[_0x7f0e('0x2c')];if(!_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x34')]('nolimit')){_0x1421e1[_0x7f0e('0x1a')]=qs[_0x7f0e('0x1a')](_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x1a')]);_0x1421e1['offset']=qs[_0x7f0e('0x18')](_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x18')]);}_0x1421e1[_0x7f0e('0x35')]=qs[_0x7f0e('0x36')](_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x36')]);_0x1421e1['where']=qs['filters'](_[_0x7f0e('0x37')](_0x4868f2[_0x7f0e('0x2d')],_0x538c10[_0x7f0e('0x2f')]),_0x43a4fb);if(_0x4868f2['query']['filter']){_0x1421e1[_0x7f0e('0x38')]=_[_0x7f0e('0x39')](_0x1421e1['where'],{'$or':_[_0x7f0e('0x26')](_0x43a4fb,function(_0x195407){if(_0x195407['type']!==_0x7f0e('0x3a')){var _0x47b1ee={};_0x47b1ee[_0x195407[_0x7f0e('0x23')]]={'$like':'%'+_0x4868f2['query'][_0x7f0e('0x3b')]+'%'};return _0x47b1ee;}})});}_0x1421e1=_[_0x7f0e('0x39')]({},_0x1421e1,_0x4868f2[_0x7f0e('0x3c')]);var _0x2266cc={'where':_0x1421e1[_0x7f0e('0x38')]};return db[_0x7f0e('0x27')][_0x7f0e('0x3d')](_0x2266cc)[_0x7f0e('0x1f')](function(_0xc32236){_0x54872a[_0x7f0e('0x3d')]=_0xc32236;if(_0x4868f2[_0x7f0e('0x2d')][_0x7f0e('0x3e')]){_0x1421e1[_0x7f0e('0x3f')]=[{'all':!![]}];}return db[_0x7f0e('0x27')][_0x7f0e('0x40')](_0x1421e1);})['then'](function(_0x39fb35){_0x54872a[_0x7f0e('0x41')]=_0x39fb35;return _0x54872a;})[_0x7f0e('0x1f')](respondWithFilteredResult(_0x4e7373,_0x1421e1))[_0x7f0e('0x42')](handleError(_0x4e7373,null));};exports[_0x7f0e('0x43')]=function(_0x4ccab6,_0xfb0001){var _0x2a76db={'raw':!![],'where':{'id':_0x4ccab6[_0x7f0e('0x44')]['id']}},_0x9fb860={};_0x9fb860[_0x7f0e('0x2c')]=_[_0x7f0e('0x2e')](db[_0x7f0e('0x27')][_0x7f0e('0x28')]);_0x9fb860[_0x7f0e('0x2d')]=_['keys'](_0x4ccab6['query']);_0x9fb860['filters']=_[_0x7f0e('0x31')](_0x9fb860[_0x7f0e('0x2c')],_0x9fb860[_0x7f0e('0x2d')]);_0x2a76db[_0x7f0e('0x30')]=_[_0x7f0e('0x31')](_0x9fb860[_0x7f0e('0x2c')],qs[_0x7f0e('0x32')](_0x4ccab6[_0x7f0e('0x2d')][_0x7f0e('0x32')]));_0x2a76db[_0x7f0e('0x30')]=_0x2a76db['attributes'][_0x7f0e('0x33')]?_0x2a76db['attributes']:_0x9fb860[_0x7f0e('0x2c')];if(_0x4ccab6[_0x7f0e('0x2d')][_0x7f0e('0x3e')]){_0x2a76db['include']=[{'all':!![]}];}_0x2a76db=_['merge']({},_0x2a76db,_0x4ccab6[_0x7f0e('0x3c')]);return db[_0x7f0e('0x27')]['find'](_0x2a76db)[_0x7f0e('0x1f')](handleEntityNotFound(_0xfb0001,null))['then'](respondWithResult(_0xfb0001,null))[_0x7f0e('0x42')](handleError(_0xfb0001,null));};exports[_0x7f0e('0x45')]=function(_0x4e063d,_0x2f21e8){return db[_0x7f0e('0x27')][_0x7f0e('0x45')](_0x4e063d[_0x7f0e('0x46')],{})[_0x7f0e('0x1f')](respondWithResult(_0x2f21e8,0xc9))['catch'](handleError(_0x2f21e8,null));};exports[_0x7f0e('0x1e')]=function(_0x276211,_0x385a65){if(_0x276211['body']['id']){delete _0x276211[_0x7f0e('0x46')]['id'];}return db['VoiceTransferReport'][_0x7f0e('0x47')]({'where':{'id':_0x276211[_0x7f0e('0x44')]['id']}})[_0x7f0e('0x1f')](handleEntityNotFound(_0x385a65,null))[_0x7f0e('0x1f')](saveUpdates(_0x276211[_0x7f0e('0x46')],null))['then'](respondWithResult(_0x385a65,null))[_0x7f0e('0x42')](handleError(_0x385a65,null));};exports['destroy']=function(_0x10e8a2,_0x42f1f1){return db['VoiceTransferReport'][_0x7f0e('0x47')]({'where':{'id':_0x10e8a2['params']['id']}})[_0x7f0e('0x1f')](handleEntityNotFound(_0x42f1f1,null))[_0x7f0e('0x1f')](removeEntity(_0x42f1f1,null))[_0x7f0e('0x42')](handleError(_0x42f1f1,null));};exports['describe']=function(_0x30c4e9,_0xd3b418){return db[_0x7f0e('0x27')][_0x7f0e('0x48')]()[_0x7f0e('0x1f')](respondWithResult(_0xd3b418,null))[_0x7f0e('0x42')](handleError(_0xd3b418,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1ee0f01..cbd8f50 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 _0xac69=['VoiceTransferReport','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x18971b,_0x2dfc23){var _0xb2c9e2=function(_0x331f58){while(--_0x331f58){_0x18971b['push'](_0x18971b['shift']());}};_0xb2c9e2(++_0x2dfc23);}(_0xac69,0x79));var _0x9ac6=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xac69[_0x2160a9];return _0xa88cf7;};'use strict';var _=require('lodash');var util=require(_0x9ac6('0x0'));var logger=require(_0x9ac6('0x1'))(_0x9ac6('0x2'));var moment=require(_0x9ac6('0x3'));var BPromise=require(_0x9ac6('0x4'));var rp=require(_0x9ac6('0x5'));var fs=require('fs');var path=require(_0x9ac6('0x6'));var rimraf=require('rimraf');var config=require(_0x9ac6('0x7'));var attributes=require(_0x9ac6('0x8'));module[_0x9ac6('0x9')]=function(_0xba0a7,_0x1d31d6){return _0xba0a7[_0x9ac6('0xa')](_0x9ac6('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7355=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','moment','request-promise','path'];(function(_0x525dd8,_0x14a9fd){var _0xce78b0=function(_0x4e8d78){while(--_0x4e8d78){_0x525dd8['push'](_0x525dd8['shift']());}};_0xce78b0(++_0x14a9fd);}(_0x7355,0x95));var _0x5735=function(_0x1accb1,_0xbec705){_0x1accb1=_0x1accb1-0x0;var _0x5513da=_0x7355[_0x1accb1];return _0x5513da;};'use strict';var _=require(_0x5735('0x0'));var util=require(_0x5735('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5735('0x2'));var BPromise=require('bluebird');var rp=require(_0x5735('0x3'));var fs=require('fs');var path=require(_0x5735('0x4'));var rimraf=require(_0x5735('0x5'));var config=require(_0x5735('0x6'));var attributes=require(_0x5735('0x7'));module[_0x5735('0x8')]=function(_0x5f0b18,_0x37e610){return _0x5f0b18['define'](_0x5735('0x9'),attributes,{'tableName':_0x5735('0xa'),'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 7b2ae83..1627de1 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 _0xe2a2=['../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','util','moment','../../config/logger','rpc'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xe2a2,0xab));var _0x2e2a=function(_0x5d8488,_0x440326){_0x5d8488=_0x5d8488-0x0;var _0x52309a=_0xe2a2[_0x5d8488];return _0x52309a;};'use strict';var _=require('lodash');var util=require(_0x2e2a('0x0'));var moment=require(_0x2e2a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e2a('0x2'))(_0x2e2a('0x3'));var config=require(_0x2e2a('0x4'));var jayson=require(_0x2e2a('0x5'));var client=jayson[_0x2e2a('0x6')][_0x2e2a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a34fa,_0xc57e26,_0x3d8e60){return new BPromise(function(_0x923a3b,_0x5a3d04){return client['request'](_0x4a34fa,_0x3d8e60)[_0x2e2a('0x8')](function(_0x1aa03a){logger[_0x2e2a('0x9')](_0x2e2a('0xa'),_0xc57e26,_0x2e2a('0xb'));logger[_0x2e2a('0xc')](_0x2e2a('0xd'),_0xc57e26,_0x2e2a('0xb'),JSON['stringify'](_0x1aa03a));if(_0x1aa03a[_0x2e2a('0xe')]){if(_0x1aa03a['error'][_0x2e2a('0xf')]===0x1f4){logger[_0x2e2a('0xe')](_0x2e2a('0xa'),_0xc57e26,_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);return _0x5a3d04(_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);}logger[_0x2e2a('0xe')](_0x2e2a('0xa'),_0xc57e26,_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);return _0x923a3b(_0x1aa03a[_0x2e2a('0xe')][_0x2e2a('0x10')]);}else{logger[_0x2e2a('0x9')](_0x2e2a('0xa'),_0xc57e26,'request\x20sent');_0x923a3b(_0x1aa03a[_0x2e2a('0x11')]['message']);}})[_0x2e2a('0x12')](function(_0x2a8b1b){logger['error'](_0x2e2a('0xa'),_0xc57e26,_0x2a8b1b);_0x5a3d04(_0x2a8b1b);});});}exports[_0x2e2a('0x13')]=function(_0x512868){var _0x4fdd7e=this;return new Promise(function(_0x35fde6,_0xcf97e2){return db[_0x2e2a('0x14')][_0x2e2a('0x15')](_0x512868[_0x2e2a('0x16')],{'raw':_0x512868[_0x2e2a('0x17')]?_0x512868[_0x2e2a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2e2a('0x8')](function(_0x9f1088){logger['info'](_0x2e2a('0x13'),_0x512868);logger[_0x2e2a('0xc')](_0x2e2a('0x13'),_0x512868,JSON[_0x2e2a('0x18')](_0x9f1088));_0x35fde6(_0x9f1088);})[_0x2e2a('0x12')](function(_0x5cabc0){logger[_0x2e2a('0xe')]('CreateVoiceTransferReport',_0x5cabc0['message'],_0x512868);_0xcf97e2(_0x4fdd7e[_0x2e2a('0xe')](0x1f4,_0x5cabc0[_0x2e2a('0x10')]));});});}; \ No newline at end of file +var _0xed64=['VoiceTransferReport','create','body','options','raw','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x31bf5d,_0x4b3dc1){var _0x3e36f8=function(_0x51083c){while(--_0x51083c){_0x31bf5d['push'](_0x31bf5d['shift']());}};_0x3e36f8(++_0x4b3dc1);}(_0xed64,0x114));var _0x4ed6=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xed64[_0xa30766];return _0x24e780;};'use strict';var _=require(_0x4ed6('0x0'));var util=require(_0x4ed6('0x1'));var moment=require(_0x4ed6('0x2'));var BPromise=require(_0x4ed6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ed6('0x4'))['db'];var utils=require(_0x4ed6('0x5'));var logger=require(_0x4ed6('0x6'))(_0x4ed6('0x7'));var config=require(_0x4ed6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ed6('0x9')][_0x4ed6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f1355,_0x39077d,_0x5df058){return new BPromise(function(_0x2594b7,_0x5b35b8){return client[_0x4ed6('0xb')](_0x1f1355,_0x5df058)[_0x4ed6('0xc')](function(_0x32c990){logger[_0x4ed6('0xd')](_0x4ed6('0xe'),_0x39077d,_0x4ed6('0xf'));logger['debug'](_0x4ed6('0x10'),_0x39077d,_0x4ed6('0xf'),JSON[_0x4ed6('0x11')](_0x32c990));if(_0x32c990[_0x4ed6('0x12')]){if(_0x32c990[_0x4ed6('0x12')][_0x4ed6('0x13')]===0x1f4){logger[_0x4ed6('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x39077d,_0x32c990['error'][_0x4ed6('0x14')]);return _0x5b35b8(_0x32c990[_0x4ed6('0x12')][_0x4ed6('0x14')]);}logger[_0x4ed6('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x39077d,_0x32c990[_0x4ed6('0x12')][_0x4ed6('0x14')]);return _0x2594b7(_0x32c990[_0x4ed6('0x12')][_0x4ed6('0x14')]);}else{logger[_0x4ed6('0xd')](_0x4ed6('0xe'),_0x39077d,'request\x20sent');_0x2594b7(_0x32c990[_0x4ed6('0x15')][_0x4ed6('0x14')]);}})[_0x4ed6('0x16')](function(_0x1d056d){logger['error'](_0x4ed6('0xe'),_0x39077d,_0x1d056d);_0x5b35b8(_0x1d056d);});});}exports[_0x4ed6('0x17')]=function(_0x15c309){var _0x1d9558=this;return new Promise(function(_0x1abf5e,_0x465774){return db[_0x4ed6('0x18')][_0x4ed6('0x19')](_0x15c309[_0x4ed6('0x1a')],{'raw':_0x15c309[_0x4ed6('0x1b')]?_0x15c309[_0x4ed6('0x1b')][_0x4ed6('0x1c')]===undefined?!![]:![]:!![]})[_0x4ed6('0xc')](function(_0x594de1){logger[_0x4ed6('0xd')](_0x4ed6('0x17'),_0x15c309);logger[_0x4ed6('0x1d')](_0x4ed6('0x17'),_0x15c309,JSON[_0x4ed6('0x11')](_0x594de1));_0x1abf5e(_0x594de1);})['catch'](function(_0x3b75d5){logger[_0x4ed6('0x12')]('CreateVoiceTransferReport',_0x3b75d5[_0x4ed6('0x14')],_0x15c309);_0x465774(_0x1d9558[_0x4ed6('0x12')](0x1f4,_0x3b75d5['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0104f84..0d4ab2b 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x2fcc10,_0x137917){var _0x3ca41c=function(_0x4293d1){while(--_0x4293d1){_0x2fcc10['push'](_0x2fcc10['shift']());}};_0x3ca41c(++_0x137917);}(_0x9f62,0x154));var _0x29f6=function(_0x5cfd2f,_0x2f5926){_0x5cfd2f=_0x5cfd2f-0x0;var _0x50c032=_0x9f62[_0x5cfd2f];return _0x50c032;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x5286ca,_0x3550a3){var _0x468846=function(_0xba872c){while(--_0xba872c){_0x5286ca['push'](_0x5286ca['shift']());}};_0x468846(++_0x3550a3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e81a5,_0x9ba84c){_0x5e81a5=_0x5e81a5-0x0;var _0x4ebeaf=_0xedd9[_0x5e81a5];return _0x4ebeaf;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 30fc5cf..c0c8545 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 _0xa25c=['unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','callNumber','callbackUrl','entityFound:','user:%s','originate\x20executed!','catch','hangup\x20fired:','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','answer\x20executed!','hold','webbar:hold','hold\x20executed!'];(function(_0xaa99fe,_0x358171){var _0x4bdc46=function(_0x591926){while(--_0x591926){_0xaa99fe['push'](_0xaa99fe['shift']());}};_0x4bdc46(++_0x358171);}(_0xa25c,0x13f));var _0xca25=function(_0xa57c50,_0x1c6754){_0xa57c50=_0xa57c50-0x0;var _0x2c55b4=_0xa25c[_0xa57c50];return _0x2c55b4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xca25('0x0'));var db=require(_0xca25('0x1'))['db'];var config=require(_0xca25('0x2'));var util=require(_0xca25('0x3'));var BPromise=require(_0xca25('0x4'));var jayson=require(_0xca25('0x5'));var amiClient=jayson[_0xca25('0x6')][_0xca25('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xca25('0x8'));var Redis=require('ioredis');config['redis']=_[_0xca25('0x9')](config['redis'],{'host':_0xca25('0xa'),'port':0x18eb});var io=require(_0xca25('0xb'))(new Redis(config[_0xca25('0xc')]));var Schema=require(_0xca25('0xd'));var originateValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xca25('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xca25('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xca25('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]},'sessionId':{'type':_0xca25('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xca25('0xe'),'required':[!![],_0xca25('0x11')]}});function emit(_0x2b5cef,_0x587403,_0x3616c3){logger[_0xca25('0x12')](_0x2b5cef,_0x587403,JSON['stringify'](_0x3616c3));io['to'](_0x2b5cef)[_0xca25('0x13')](_0x587403,_0x3616c3);}function handleError(_0x2add52){return function(_0x3705a0){console[_0xca25('0x14')](_0xca25('0x15'),_0x3705a0,_0x3705a0 instanceof RangeError);logger['error'](_0x3705a0[_0xca25('0x16')]);if(_0x3705a0 instanceof RangeError){if(_0x3705a0[_0xca25('0x17')]){delete _0x3705a0[_0xca25('0x17')];}_0x2add52[_0xca25('0x18')](0x194)[_0xca25('0x19')](_0x3705a0);}else{if(_0x3705a0['name']){delete _0x3705a0[_0xca25('0x17')];}_0x2add52[_0xca25('0x18')](0x1f4)[_0xca25('0x19')](_0x3705a0);}};}function checkError(){return function(_0x1f69c6){if(!_0x1f69c6){throw new RangeError(_0xca25('0x1a'));}return _0x1f69c6;};}function respondWithRpcPromise(_0x38d6e6,_0x292c88){return new BPromise(function(_0x54c91a,_0x48fdf5){var _0x23f69a=amiClient;return _0x23f69a[_0xca25('0x1b')](_0x38d6e6,_0x292c88)[_0xca25('0x1c')](function(_0x1596dd){if(_0x1596dd[_0xca25('0x1d')]){if(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1e')]===0x1f4){return _0x48fdf5(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1f')]);}return _0x54c91a(_0x1596dd[_0xca25('0x1d')][_0xca25('0x1f')]);}else{_0x54c91a(_0x1596dd[_0xca25('0x20')]);}})['catch'](function(_0x1aa848){_0x48fdf5(_0x1aa848);});});}function getAgent(_0x359369){return db[_0xca25('0x21')][_0xca25('0x22')]({'where':{'id':_0x359369,'role':_0xca25('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x274de1,_0x41eb3a){return new BPromise(function(_0x3d7414,_0xd61524){var _0x2ae0e3=respondWithRpcPromise(_0xca25('0x24'));var _0xfd888c=getAgent(_0x274de1);Promise[_0xca25('0x25')]([_0x2ae0e3,_0xfd888c])[_0xca25('0x1c')](function(_0x7b67f4){var _0x190f27=_0x7b67f4[0x0];var _0x315f76=_0x7b67f4[0x1];var _0x5078e4=_[_0xca25('0x26')](_0x190f27[_0xca25('0x27')],function(_0x2433bb){return _0x2433bb[_0xca25('0x28')]==_0x315f76['id']&&_0x2433bb[_0xca25('0x29')]==_0x41eb3a;});if(_0x5078e4['length']==0x1){_0x3d7414(_0x315f76);}else{_0xd61524(new RangeError(_0xca25('0x2a')+_0x41eb3a+_0xca25('0x2b')));}});});}exports[_0xca25('0x2c')]=function(_0x566090,_0xe86982){logger[_0xca25('0x12')](_0xca25('0x2d'),_0x566090[_0xca25('0x2e')]);var _0x2c863b=originateValidation[_0xca25('0xd')](_0x566090['body']);if(_0x2c863b[_0xca25('0x2f')]>0x0){return _0xe86982['status'](0x190)[_0xca25('0x30')](_0x2c863b);}var _0xe41c26=_0x566090[_0xca25('0x2e')]['userId'];var _0xc3f6d0=_0x566090[_0xca25('0x2e')][_0xca25('0x31')];var _0x20cdd4=_0x566090[_0xca25('0x2e')]['callerId'];var _0x86a223=_0x566090[_0xca25('0x2e')][_0xca25('0x32')];return getAgent(_0xe41c26)[_0xca25('0x1c')](function(_0x29d1a0){logger[_0xca25('0x12')](_0xca25('0x33'),_0x29d1a0['name']);emit(util['format'](_0xca25('0x34'),_0x29d1a0[_0xca25('0x17')]),'webbar:originate',{'callNumber':_0xc3f6d0,'callerId':_0x20cdd4,'callbackUrl':_0x86a223});return _0xe86982['status'](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x35')});})[_0xca25('0x36')](handleError(_0xe86982));};exports['hangup']=function(_0x9c1ce3,_0x46c72f){logger[_0xca25('0x12')](_0xca25('0x37'),_0x9c1ce3[_0xca25('0x2e')]);var _0xd1d480=hangupValidation['validate'](_0x9c1ce3[_0xca25('0x2e')]);if(_0xd1d480['length']>0x0){return _0x46c72f[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0xd1d480);}var _0x391beb=_0x9c1ce3[_0xca25('0x2e')][_0xca25('0x38')];var _0xe41645=_0x9c1ce3[_0xca25('0x2e')][_0xca25('0x29')];return getAgent(_0x391beb)[_0xca25('0x1c')](function(_0x513995){logger[_0xca25('0x12')]('entityFound:',_0x513995[_0xca25('0x17')]);emit(util['format'](_0xca25('0x34'),_0x513995[_0xca25('0x17')]),_0xca25('0x39'),{'sessionId':_0xe41645});return _0x46c72f[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x3a')});})['catch'](handleError(_0x46c72f));};exports[_0xca25('0x3b')]=function(_0x3c2d2b,_0x4bbbe5){logger[_0xca25('0x12')](_0xca25('0x3c'),_0x3c2d2b[_0xca25('0x2e')]);var _0x2ff9c2=answerValidation[_0xca25('0xd')](_0x3c2d2b[_0xca25('0x2e')]);if(_0x2ff9c2[_0xca25('0x2f')]>0x0){return _0x4bbbe5['status'](0x190)[_0xca25('0x30')](_0x2ff9c2);}var _0x300e20=_0x3c2d2b['body']['userId'];var _0x487710=_0x3c2d2b['body'][_0xca25('0x29')];return getAgent(_0x300e20)[_0xca25('0x1c')](function(_0x17d964){logger[_0xca25('0x12')]('entityFound:',_0x17d964[_0xca25('0x17')]);emit(util[_0xca25('0x3d')](_0xca25('0x34'),_0x17d964[_0xca25('0x17')]),'webbar:answer',{'sessionId':_0x487710});return _0x4bbbe5[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x3e')});})[_0xca25('0x36')](handleError(_0x4bbbe5));};exports[_0xca25('0x3f')]=function(_0x17748d,_0x47855b){logger[_0xca25('0x12')]('hold\x20fired:',_0x17748d[_0xca25('0x2e')]);var _0x25406a=holdValidation[_0xca25('0xd')](_0x17748d[_0xca25('0x2e')]);if(_0x25406a[_0xca25('0x2f')]>0x0){return _0x47855b[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0x25406a);}var _0x352a17=_0x17748d[_0xca25('0x2e')][_0xca25('0x38')];var _0x2b393e=_0x17748d[_0xca25('0x2e')][_0xca25('0x29')];return getAgent(_0x352a17)[_0xca25('0x1c')](function(_0x3279e0){logger[_0xca25('0x12')](_0xca25('0x33'),_0x3279e0[_0xca25('0x17')]);emit(util['format'](_0xca25('0x34'),_0x3279e0[_0xca25('0x17')]),_0xca25('0x40'),{'sessionId':_0x2b393e});return _0x47855b[_0xca25('0x18')](0xc8)['json']({'error':![],'message':_0xca25('0x41')});})[_0xca25('0x36')](handleError(_0x47855b));};exports['unhold']=function(_0x2bc528,_0x10692f){logger[_0xca25('0x12')](_0xca25('0x42'),_0x2bc528['body']);var _0x42458c=unholdValidation['validate'](_0x2bc528[_0xca25('0x2e')]);if(_0x42458c['length']>0x0){return _0x10692f['status'](0x190)[_0xca25('0x30')](_0x42458c);}var _0x1523d5=_0x2bc528[_0xca25('0x2e')][_0xca25('0x38')];var _0x4f2545=_0x2bc528['body'][_0xca25('0x29')];return getAgent(_0x1523d5)['then'](function(_0x1a2104){logger[_0xca25('0x12')](_0xca25('0x33'),_0x1a2104[_0xca25('0x17')]);emit(util[_0xca25('0x3d')]('user:%s',_0x1a2104['name']),_0xca25('0x43'),{'sessionId':_0x4f2545});return _0x10692f[_0xca25('0x18')](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x44')});})[_0xca25('0x36')](handleError(_0x10692f));};exports[_0xca25('0x45')]=function(_0x57a0ec,_0x25ba04){logger[_0xca25('0x12')](_0xca25('0x46'),_0x25ba04[_0xca25('0x2e')]);var _0x86fc48=callsValidation[_0xca25('0xd')](_0x57a0ec[_0xca25('0x2e')]);if(_0x86fc48[_0xca25('0x2f')]>0x0){return _0x25ba04[_0xca25('0x18')](0x190)['json'](_0x86fc48);}var _0x25c761=_0x57a0ec[_0xca25('0x2e')][_0xca25('0x38')];var _0x229d10=respondWithRpcPromise(_0xca25('0x24'));var _0x12e593=getAgent(_0x25c761);return Promise[_0xca25('0x25')]([_0x229d10,_0x12e593])[_0xca25('0x1c')](function(_0x5e01e3){var _0x8f8666=_0x5e01e3[0x0];var _0x539e9d=_0x5e01e3[0x1];var _0x30ff33=_[_0xca25('0x26')](_0x8f8666[_0xca25('0x27')],function(_0x55ad12){return _0x55ad12['UserId']==_0x539e9d['id'];});return _0x25ba04['status'](0xc8)[_0xca25('0x30')]({'count':_0x30ff33[_0xca25('0x2f')],'rows':_0x30ff33});})[_0xca25('0x36')](handleError(_0x25ba04));};exports[_0xca25('0x47')]=function(_0x5a39f9,_0x3d1bed){logger[_0xca25('0x12')](_0xca25('0x48'),_0x5a39f9['body']);var _0x414209=conferenceValidation['validate'](_0x5a39f9['body']);if(_0x414209['length']>0x0){return _0x3d1bed[_0xca25('0x18')](0x190)[_0xca25('0x30')](_0x414209);}var _0x42e898=_0x5a39f9[_0xca25('0x2e')][_0xca25('0x38')];return getAgent(_0x42e898)[_0xca25('0x1c')](function(_0x4f3ef4){logger[_0xca25('0x12')](_0xca25('0x33'),_0x4f3ef4['name']);emit(util[_0xca25('0x3d')]('user:%s',_0x4f3ef4[_0xca25('0x17')]),'webbar:conference');return _0x3d1bed['status'](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x49')});})['catch'](handleError(_0x3d1bed));};exports['transfer']=function(_0x53e34b,_0x50b57e){logger['info'](_0xca25('0x4a'),_0x53e34b[_0xca25('0x2e')]);var _0x4b3af2=transferValidation['validate'](_0x53e34b['body']);if(_0x4b3af2['length']>0x0){return _0x50b57e[_0xca25('0x18')](0x190)['json'](_0x4b3af2);}var _0x4cc0b3=_0x53e34b[_0xca25('0x2e')][_0xca25('0x38')];var _0x29f7c3=_0x53e34b[_0xca25('0x2e')]['sessionId'];var _0x486f42=_0x53e34b[_0xca25('0x2e')]['transferNumber'];return getAgent(_0x4cc0b3)[_0xca25('0x1c')](function(_0x2c2ce7){logger['info'](_0xca25('0x33'),_0x2c2ce7[_0xca25('0x17')]);emit(util[_0xca25('0x3d')](_0xca25('0x34'),_0x2c2ce7[_0xca25('0x17')]),_0xca25('0x4b'),{'sessionId':_0x29f7c3,'transferNumber':_0x486f42});return _0x50b57e[_0xca25('0x18')](0xc8)[_0xca25('0x30')]({'error':![],'message':_0xca25('0x4c')});})['catch'](handleError(_0x50b57e));}; \ No newline at end of file +var _0xe644=['rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','callerId','callbackUrl','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','sessionId','format','user:%s','webbar:hangup','answer','answer\x20fired:','entityFound:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','send','status','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter'];(function(_0x212d22,_0x2309d2){var _0x48f2b1=function(_0x43cc92){while(--_0x43cc92){_0x212d22['push'](_0x212d22['shift']());}};_0x48f2b1(++_0x2309d2);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x4e64('0x0'));var fs=require('fs');var _=require(_0x4e64('0x1'));var db=require(_0x4e64('0x2'))['db'];var config=require(_0x4e64('0x3'));var util=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x4e64('0x6')][_0x4e64('0x7')]({'port':0x232a});var logger=require(_0x4e64('0x8'))(_0x4e64('0x9'));var Redis=require(_0x4e64('0xa'));config[_0x4e64('0xb')]=_['defaults'](config[_0x4e64('0xb')],{'host':_0x4e64('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x4e64('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x4e64('0xe'),'required':[!![],_0x4e64('0xf')]},'callerId':{'type':_0x4e64('0xe')},'callbackUrl':{'type':_0x4e64('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],_0x4e64('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],_0x4e64('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x4e64('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x4e64('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],_0x4e64('0x11')]},'sessionId':{'type':_0x4e64('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],_0x4e64('0x11')]},'sessionId':{'type':_0x4e64('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4e64('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4e64('0x10'),'required':[!![],_0x4e64('0x11')]}});function emit(_0x5b35b0,_0x3b885a,_0x3677f9){logger[_0x4e64('0x14')](_0x5b35b0,_0x3b885a,JSON[_0x4e64('0x15')](_0x3677f9));io['to'](_0x5b35b0)[_0x4e64('0x16')](_0x3b885a,_0x3677f9);}function handleError(_0x2a60ad){return function(_0x135ffb){console[_0x4e64('0x17')](_0x4e64('0x18'),_0x135ffb,_0x135ffb instanceof RangeError);logger[_0x4e64('0x19')](_0x135ffb['stack']);if(_0x135ffb instanceof RangeError){if(_0x135ffb[_0x4e64('0x1a')]){delete _0x135ffb[_0x4e64('0x1a')];}_0x2a60ad['status'](0x194)[_0x4e64('0x1b')](_0x135ffb);}else{if(_0x135ffb['name']){delete _0x135ffb['name'];}_0x2a60ad[_0x4e64('0x1c')](0x1f4)[_0x4e64('0x1b')](_0x135ffb);}};}function checkError(){return function(_0x227d64){if(!_0x227d64){throw new RangeError('NotFound');}return _0x227d64;};}function respondWithRpcPromise(_0x4a5c6d,_0x4a9957){return new BPromise(function(_0x30e356,_0x336c53){var _0x2df7a0=amiClient;return _0x2df7a0['request'](_0x4a5c6d,_0x4a9957)[_0x4e64('0x1d')](function(_0x58ea85){if(_0x58ea85[_0x4e64('0x19')]){if(_0x58ea85[_0x4e64('0x19')][_0x4e64('0x1e')]===0x1f4){return _0x336c53(_0x58ea85[_0x4e64('0x19')][_0x4e64('0x1f')]);}return _0x30e356(_0x58ea85['error'][_0x4e64('0x1f')]);}else{_0x30e356(_0x58ea85[_0x4e64('0x20')]);}})[_0x4e64('0x21')](function(_0x4afb9c){_0x336c53(_0x4afb9c);});});}function getAgent(_0x786ba9){return db[_0x4e64('0x22')][_0x4e64('0x23')]({'where':{'id':_0x786ba9,'role':_0x4e64('0x24')}})[_0x4e64('0x1d')](checkError());}function getAgentCheckSession(_0x5f0d42,_0x3185ba){return new BPromise(function(_0x2b1f2b,_0x45953f){var _0x194f33=respondWithRpcPromise(_0x4e64('0x25'));var _0x1057d0=getAgent(_0x5f0d42);Promise[_0x4e64('0x26')]([_0x194f33,_0x1057d0])[_0x4e64('0x1d')](function(_0x5467a5){var _0x371035=_0x5467a5[0x0];var _0xb17ca7=_0x5467a5[0x1];var _0x45ef44=_[_0x4e64('0x27')](_0x371035[_0x4e64('0x28')],function(_0x3b1f16){return _0x3b1f16[_0x4e64('0x29')]==_0xb17ca7['id']&&_0x3b1f16['sessionId']==_0x3185ba;});if(_0x45ef44[_0x4e64('0x2a')]==0x1){_0x2b1f2b(_0xb17ca7);}else{_0x45953f(new RangeError(_0x4e64('0x2b')+_0x3185ba+_0x4e64('0x2c')));}});});}exports[_0x4e64('0x2d')]=function(_0x3d8042,_0x3d6cec){logger[_0x4e64('0x14')]('originate\x20fired:',_0x3d8042[_0x4e64('0x2e')]);var _0x317c07=originateValidation[_0x4e64('0xd')](_0x3d8042['body']);if(_0x317c07[_0x4e64('0x2a')]>0x0){return _0x3d6cec['status'](0x190)[_0x4e64('0x2f')](_0x317c07);}var _0x37cde0=_0x3d8042['body']['userId'];var _0x5417ad=_0x3d8042[_0x4e64('0x2e')]['callNumber'];var _0x2c2397=_0x3d8042[_0x4e64('0x2e')][_0x4e64('0x30')];var _0x18ca6c=_0x3d8042[_0x4e64('0x2e')][_0x4e64('0x31')];return getAgent(_0x37cde0)[_0x4e64('0x1d')](function(_0x50b8d5){logger[_0x4e64('0x14')]('entityFound:',_0x50b8d5[_0x4e64('0x1a')]);emit(util['format']('user:%s',_0x50b8d5['name']),_0x4e64('0x32'),{'callNumber':_0x5417ad,'callerId':_0x2c2397,'callbackUrl':_0x18ca6c});return _0x3d6cec['status'](0xc8)['json']({'error':![],'message':_0x4e64('0x33')});})[_0x4e64('0x21')](handleError(_0x3d6cec));};exports[_0x4e64('0x34')]=function(_0x189769,_0x1757a2){logger[_0x4e64('0x14')](_0x4e64('0x35'),_0x189769['body']);var _0x5a03a8=hangupValidation['validate'](_0x189769[_0x4e64('0x2e')]);if(_0x5a03a8[_0x4e64('0x2a')]>0x0){return _0x1757a2[_0x4e64('0x1c')](0x190)[_0x4e64('0x2f')](_0x5a03a8);}var _0x5bf847=_0x189769[_0x4e64('0x2e')][_0x4e64('0x36')];var _0x11c373=_0x189769[_0x4e64('0x2e')][_0x4e64('0x37')];return getAgent(_0x5bf847)['then'](function(_0x4faf59){logger[_0x4e64('0x14')]('entityFound:',_0x4faf59[_0x4e64('0x1a')]);emit(util[_0x4e64('0x38')](_0x4e64('0x39'),_0x4faf59[_0x4e64('0x1a')]),_0x4e64('0x3a'),{'sessionId':_0x11c373});return _0x1757a2[_0x4e64('0x1c')](0xc8)[_0x4e64('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0x4e64('0x21')](handleError(_0x1757a2));};exports[_0x4e64('0x3b')]=function(_0x460d66,_0x2e6684){logger[_0x4e64('0x14')](_0x4e64('0x3c'),_0x460d66[_0x4e64('0x2e')]);var _0x21e835=answerValidation['validate'](_0x460d66[_0x4e64('0x2e')]);if(_0x21e835[_0x4e64('0x2a')]>0x0){return _0x2e6684['status'](0x190)[_0x4e64('0x2f')](_0x21e835);}var _0x306b4d=_0x460d66['body'][_0x4e64('0x36')];var _0x1ddcf2=_0x460d66[_0x4e64('0x2e')][_0x4e64('0x37')];return getAgent(_0x306b4d)[_0x4e64('0x1d')](function(_0x5bc523){logger[_0x4e64('0x14')](_0x4e64('0x3d'),_0x5bc523[_0x4e64('0x1a')]);emit(util[_0x4e64('0x38')](_0x4e64('0x39'),_0x5bc523[_0x4e64('0x1a')]),_0x4e64('0x3e'),{'sessionId':_0x1ddcf2});return _0x2e6684[_0x4e64('0x1c')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x4e64('0x21')](handleError(_0x2e6684));};exports[_0x4e64('0x3f')]=function(_0x3cf687,_0x5861d7){logger[_0x4e64('0x14')](_0x4e64('0x40'),_0x3cf687[_0x4e64('0x2e')]);var _0x19a71b=holdValidation[_0x4e64('0xd')](_0x3cf687['body']);if(_0x19a71b[_0x4e64('0x2a')]>0x0){return _0x5861d7['status'](0x190)[_0x4e64('0x2f')](_0x19a71b);}var _0x3a5fad=_0x3cf687[_0x4e64('0x2e')][_0x4e64('0x36')];var _0x4cfac3=_0x3cf687[_0x4e64('0x2e')][_0x4e64('0x37')];return getAgent(_0x3a5fad)[_0x4e64('0x1d')](function(_0x38a885){logger[_0x4e64('0x14')]('entityFound:',_0x38a885[_0x4e64('0x1a')]);emit(util[_0x4e64('0x38')](_0x4e64('0x39'),_0x38a885[_0x4e64('0x1a')]),_0x4e64('0x41'),{'sessionId':_0x4cfac3});return _0x5861d7[_0x4e64('0x1c')](0xc8)['json']({'error':![],'message':_0x4e64('0x42')});})[_0x4e64('0x21')](handleError(_0x5861d7));};exports[_0x4e64('0x43')]=function(_0x4c2948,_0x44946b){logger[_0x4e64('0x14')]('unhold\x20fired:',_0x4c2948[_0x4e64('0x2e')]);var _0x5cedc6=unholdValidation[_0x4e64('0xd')](_0x4c2948['body']);if(_0x5cedc6[_0x4e64('0x2a')]>0x0){return _0x44946b['status'](0x190)[_0x4e64('0x2f')](_0x5cedc6);}var _0xb2c2c7=_0x4c2948[_0x4e64('0x2e')][_0x4e64('0x36')];var _0x33933a=_0x4c2948[_0x4e64('0x2e')][_0x4e64('0x37')];return getAgent(_0xb2c2c7)['then'](function(_0x471be1){logger[_0x4e64('0x14')](_0x4e64('0x3d'),_0x471be1['name']);emit(util['format'](_0x4e64('0x39'),_0x471be1['name']),_0x4e64('0x44'),{'sessionId':_0x33933a});return _0x44946b[_0x4e64('0x1c')](0xc8)[_0x4e64('0x2f')]({'error':![],'message':_0x4e64('0x45')});})[_0x4e64('0x21')](handleError(_0x44946b));};exports['calls']=function(_0x562f53,_0x339e39){logger[_0x4e64('0x14')](_0x4e64('0x46'),_0x339e39[_0x4e64('0x2e')]);var _0x3def87=callsValidation[_0x4e64('0xd')](_0x562f53[_0x4e64('0x2e')]);if(_0x3def87[_0x4e64('0x2a')]>0x0){return _0x339e39['status'](0x190)[_0x4e64('0x2f')](_0x3def87);}var _0x3251a3=_0x562f53[_0x4e64('0x2e')]['userId'];var _0xa277da=respondWithRpcPromise(_0x4e64('0x25'));var _0x502640=getAgent(_0x3251a3);return Promise[_0x4e64('0x26')]([_0xa277da,_0x502640])[_0x4e64('0x1d')](function(_0xb1ef5f){var _0x377da8=_0xb1ef5f[0x0];var _0x82dcde=_0xb1ef5f[0x1];var _0x10d2ac=_['filter'](_0x377da8[_0x4e64('0x28')],function(_0x12bf29){return _0x12bf29[_0x4e64('0x29')]==_0x82dcde['id'];});return _0x339e39['status'](0xc8)[_0x4e64('0x2f')]({'count':_0x10d2ac[_0x4e64('0x2a')],'rows':_0x10d2ac});})[_0x4e64('0x21')](handleError(_0x339e39));};exports[_0x4e64('0x47')]=function(_0x5d3789,_0x1914bf){logger[_0x4e64('0x14')]('conference\x20fired:',_0x5d3789[_0x4e64('0x2e')]);var _0xafc845=conferenceValidation[_0x4e64('0xd')](_0x5d3789[_0x4e64('0x2e')]);if(_0xafc845[_0x4e64('0x2a')]>0x0){return _0x1914bf[_0x4e64('0x1c')](0x190)[_0x4e64('0x2f')](_0xafc845);}var _0x40873c=_0x5d3789['body'][_0x4e64('0x36')];return getAgent(_0x40873c)[_0x4e64('0x1d')](function(_0x489a34){logger[_0x4e64('0x14')](_0x4e64('0x3d'),_0x489a34[_0x4e64('0x1a')]);emit(util[_0x4e64('0x38')](_0x4e64('0x39'),_0x489a34['name']),_0x4e64('0x48'));return _0x1914bf[_0x4e64('0x1c')](0xc8)['json']({'error':![],'message':_0x4e64('0x49')});})[_0x4e64('0x21')](handleError(_0x1914bf));};exports[_0x4e64('0x4a')]=function(_0x44c368,_0xf9c4e0){logger[_0x4e64('0x14')]('transfer\x20fired:',_0x44c368[_0x4e64('0x2e')]);var _0x291fe8=transferValidation[_0x4e64('0xd')](_0x44c368['body']);if(_0x291fe8[_0x4e64('0x2a')]>0x0){return _0xf9c4e0[_0x4e64('0x1c')](0x190)[_0x4e64('0x2f')](_0x291fe8);}var _0x5ed23f=_0x44c368[_0x4e64('0x2e')][_0x4e64('0x36')];var _0x5761c9=_0x44c368['body']['sessionId'];var _0x3f2a81=_0x44c368[_0x4e64('0x2e')][_0x4e64('0x4b')];return getAgent(_0x5ed23f)[_0x4e64('0x1d')](function(_0x27db3f){logger[_0x4e64('0x14')](_0x4e64('0x3d'),_0x27db3f[_0x4e64('0x1a')]);emit(util[_0x4e64('0x38')](_0x4e64('0x39'),_0x27db3f[_0x4e64('0x1a')]),_0x4e64('0x4c'),{'sessionId':_0x5761c9,'transferNumber':_0x3f2a81});return _0xf9c4e0[_0x4e64('0x1c')](0xc8)[_0x4e64('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xf9c4e0));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 506f9e1..dbfbbe5 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 _0x5d38=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','send','put','update','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x3848ab,_0x910615){var _0x92433d=function(_0x273574){while(--_0x273574){_0x3848ab['push'](_0x3848ab['shift']());}};_0x92433d(++_0x910615);}(_0x5d38,0x7e));var _0x85d3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5d38[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require(_0x85d3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d3('0x1')]();var fs_extra=require(_0x85d3('0x2'));var auth=require(_0x85d3('0x3'));var interaction=require(_0x85d3('0x4'));var config=require(_0x85d3('0x5'));var controller=require(_0x85d3('0x6'));router[_0x85d3('0x7')]('/',auth[_0x85d3('0x8')](),controller[_0x85d3('0x9')]);router[_0x85d3('0x7')](_0x85d3('0xa'),auth['isAuthenticated'](),controller[_0x85d3('0xb')]);router[_0x85d3('0x7')](_0x85d3('0xc'),auth[_0x85d3('0x8')](),controller[_0x85d3('0xd')]);router[_0x85d3('0x7')](_0x85d3('0xe'),auth[_0x85d3('0x8')](),controller[_0x85d3('0xf')]);router[_0x85d3('0x7')](_0x85d3('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/users',auth[_0x85d3('0x8')](),controller[_0x85d3('0x11')]);router['get'](_0x85d3('0x12'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x13')]);router[_0x85d3('0x14')]('/',auth[_0x85d3('0x8')](),controller[_0x85d3('0x15')]);router[_0x85d3('0x14')](_0x85d3('0xe'),auth['isAuthenticated'](),controller[_0x85d3('0x16')]);router['post'](_0x85d3('0x10'),auth['isAuthenticated'](),controller[_0x85d3('0x17')]);router[_0x85d3('0x14')]('/:id/users',auth[_0x85d3('0x8')](),controller[_0x85d3('0x18')]);router[_0x85d3('0x14')](_0x85d3('0x12'),auth['isAuthenticated'](),controller['addApplications']);router[_0x85d3('0x14')]('/:id/notify',controller['notify']);router[_0x85d3('0x14')]('/:id/send',auth['isAuthenticated'](),controller[_0x85d3('0x19')]);router[_0x85d3('0x1a')](_0x85d3('0xc'),auth['isAuthenticated'](),controller[_0x85d3('0x1b')]);router['delete']('/:id',auth[_0x85d3('0x8')](),controller[_0x85d3('0x1c')]);router['delete'](_0x85d3('0xe'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x1d')]);router['delete'](_0x85d3('0x10'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x1e')]);router['delete'](_0x85d3('0x1f'),auth[_0x85d3('0x8')](),controller[_0x85d3('0x20')]);module[_0x85d3('0x21')]=router; \ No newline at end of file +var _0x1843=['addDisposition','addAgents','/:id/applications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','create','post'];(function(_0x4799f9,_0x2c37df){var _0x420ba2=function(_0x2a0b94){while(--_0x2a0b94){_0x4799f9['push'](_0x4799f9['shift']());}};_0x420ba2(++_0x2c37df);}(_0x1843,0xf4));var _0x3184=function(_0x1f944c,_0x3d01d0){_0x1f944c=_0x1f944c-0x0;var _0x1855df=_0x1843[_0x1f944c];return _0x1855df;};'use strict';var multer=require(_0x3184('0x0'));var util=require(_0x3184('0x1'));var path=require(_0x3184('0x2'));var timeout=require('connect-timeout');var express=require(_0x3184('0x3'));var router=express['Router']();var fs_extra=require(_0x3184('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3184('0x5'));var config=require(_0x3184('0x6'));var controller=require(_0x3184('0x7'));router[_0x3184('0x8')]('/',auth[_0x3184('0x9')](),controller['index']);router[_0x3184('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3184('0xa')]);router['get'](_0x3184('0xb'),auth[_0x3184('0x9')](),controller['show']);router['get'](_0x3184('0xc'),auth[_0x3184('0x9')](),controller[_0x3184('0xd')]);router[_0x3184('0x8')](_0x3184('0xe'),auth['isAuthenticated'](),controller[_0x3184('0xf')]);router['get'](_0x3184('0x10'),auth[_0x3184('0x9')](),controller[_0x3184('0x11')]);router[_0x3184('0x8')]('/:id/applications',auth[_0x3184('0x9')](),controller['getApplications']);router['post']('/',auth[_0x3184('0x9')](),controller[_0x3184('0x12')]);router[_0x3184('0x13')](_0x3184('0xc'),auth['isAuthenticated'](),controller[_0x3184('0x14')]);router['post'](_0x3184('0xe'),auth[_0x3184('0x9')](),controller['addAnswer']);router[_0x3184('0x13')](_0x3184('0x10'),auth['isAuthenticated'](),controller[_0x3184('0x15')]);router[_0x3184('0x13')](_0x3184('0x16'),auth[_0x3184('0x9')](),controller['addApplications']);router[_0x3184('0x13')](_0x3184('0x17'),controller[_0x3184('0x18')]);router[_0x3184('0x13')](_0x3184('0x19'),auth[_0x3184('0x9')](),controller[_0x3184('0x1a')]);router[_0x3184('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x3184('0x1c')]);router[_0x3184('0x1d')](_0x3184('0xb'),auth[_0x3184('0x9')](),controller[_0x3184('0x1e')]);router[_0x3184('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x3184('0x1d')](_0x3184('0xe'),auth['isAuthenticated'](),controller[_0x3184('0x1f')]);router[_0x3184('0x1d')]('/:id/users',auth[_0x3184('0x9')](),controller[_0x3184('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 31932ce..bb8f5a0 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 _0xd8ed=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','twilio','sinch','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(_0x2de5a1,_0x5b9802){var _0x2edfe0=function(_0x1e1083){while(--_0x1e1083){_0x2de5a1['push'](_0x2de5a1['shift']());}};_0x2edfe0(++_0x5b9802);}(_0xd8ed,0xe4));var _0xdd8e=function(_0x2d3a65,_0x57fe15){_0x2d3a65=_0x2d3a65-0x0;var _0x47065b=_0xd8ed[_0x2d3a65];return _0x47065b;};'use strict';var Sequelize=require(_0xdd8e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xdd8e('0x1')],'unique':_0xdd8e('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdd8e('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xdd8e('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xdd8e('0x1')]},'type':{'type':Sequelize[_0xdd8e('0x3')](_0xdd8e('0x4'),_0xdd8e('0x5'))},'accountSid':{'type':Sequelize[_0xdd8e('0x1')]},'baseUrl':{'type':Sequelize[_0xdd8e('0x1')]},'authToken':{'type':Sequelize[_0xdd8e('0x1')]},'notificationTemplate':{'type':Sequelize[_0xdd8e('0x6')],'defaultValue':function(){return _0xdd8e('0x7');}},'notificationSound':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd8e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdd8e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd8e('0x9')],'comment':_0xdd8e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xdd8e('0x8')],'defaultValue':![],'comment':_0xdd8e('0xb'),'set':function(_0x28554a){if(!_0x28554a){this[_0xdd8e('0xc')](_0xdd8e('0xd'),null);}this['setDataValue'](_0xdd8e('0xe'),_0x28554a);}},'description':{'type':Sequelize[_0xdd8e('0x1')]}}; \ No newline at end of file +var _0xd837=['generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','STRING','name'];(function(_0x4ea375,_0x19a515){var _0x24cbad=function(_0x1397ea){while(--_0x1397ea){_0x4ea375['push'](_0x4ea375['shift']());}};_0x24cbad(++_0x19a515);}(_0xd837,0x1a1));var _0x7d83=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0xd837[_0x366e99];return _0x180bbe;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7d83('0x0'));module['exports']={'name':{'type':Sequelize[_0x7d83('0x1')],'unique':_0x7d83('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7d83('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7d83('0x3')]();}},'phone':{'type':Sequelize[_0x7d83('0x1')]},'type':{'type':Sequelize[_0x7d83('0x4')](_0x7d83('0x5'),_0x7d83('0x6'))},'accountSid':{'type':Sequelize[_0x7d83('0x1')]},'baseUrl':{'type':Sequelize[_0x7d83('0x1')]},'authToken':{'type':Sequelize[_0x7d83('0x1')]},'notificationTemplate':{'type':Sequelize[_0x7d83('0x7')],'defaultValue':function(){return _0x7d83('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7d83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7d83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d83('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7d83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d83('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7d83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7d83('0x9')],'comment':_0x7d83('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7d83('0xc'),'set':function(_0x2bfb44){if(!_0x2bfb44){this[_0x7d83('0xd')](_0x7d83('0xe'),null);}this[_0x7d83('0xd')]('mandatoryDisposition',_0x2bfb44);}},'description':{'type':Sequelize[_0x7d83('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 035b11c..5ac5c3e 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 _0x5e17=['*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','WhatsappQueue','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','count','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','hasOwnProperty','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','contact','WhatsappInteraction','interaction','created','push','unmanaged'];(function(_0x3b77a5,_0x374322){var _0x7d2226=function(_0x351c28){while(--_0x351c28){_0x3b77a5['push'](_0x3b77a5['shift']());}};_0x7d2226(++_0x374322);}(_0x5e17,0x1a0));var _0x75e1=function(_0x1339e6,_0x3a8a60){_0x1339e6=_0x1339e6-0x0;var _0x2c6767=_0x5e17[_0x1339e6];return _0x2c6767;};'use strict';var emlformat=require(_0x75e1('0x0'));var rimraf=require(_0x75e1('0x1'));var zipdir=require(_0x75e1('0x2'));var jsonpatch=require(_0x75e1('0x3'));var rp=require(_0x75e1('0x4'));var moment=require('moment');var BPromise=require(_0x75e1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x75e1('0x6'));var sox=require('sox');var csv=require(_0x75e1('0x7'));var ejs=require(_0x75e1('0x8'));var fs=require('fs');var fs_extra=require(_0x75e1('0x9'));var _=require(_0x75e1('0xa'));var squel=require(_0x75e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x75e1('0xc'));var deskjs=require(_0x75e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x75e1('0xe'));var Papa=require(_0x75e1('0xf'));var Redis=require(_0x75e1('0x10'));var authService=require(_0x75e1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x75e1('0x12'));var hardwareService=require(_0x75e1('0x13'));var logger=require(_0x75e1('0x14'))(_0x75e1('0x15'));var utils=require(_0x75e1('0x16'));var config=require(_0x75e1('0x17'));var licenseUtil=require(_0x75e1('0x18'));var db=require(_0x75e1('0x19'))['db'];config[_0x75e1('0x1a')]=_[_0x75e1('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x75e1('0x1c'))(new Redis(config[_0x75e1('0x1a')]));require(_0x75e1('0x1d'))[_0x75e1('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x75e1('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x7e83a4,_0x5d2e41,_0x1e2ab0,_0x4959dc){return new BPromise(function(_0x305a83,_0x3a9b37){var _0x12ac7c=_0x4959dc||client;return _0x12ac7c[_0x75e1('0x20')](_0x7e83a4,_0x1e2ab0)[_0x75e1('0x21')](function(_0x53b5fc){logger[_0x75e1('0x22')](_0x75e1('0x23'),_0x5d2e41,'request\x20sent');logger['debug'](_0x75e1('0x24'),_0x5d2e41,_0x75e1('0x25'),JSON[_0x75e1('0x26')](_0x53b5fc));if(_0x53b5fc[_0x75e1('0x27')]){if(_0x53b5fc[_0x75e1('0x27')]['code']===0x1f4){logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);return _0x3a9b37(_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);}logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x53b5fc[_0x75e1('0x27')]['message']);return _0x305a83(_0x53b5fc[_0x75e1('0x27')][_0x75e1('0x28')]);}else{logger[_0x75e1('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x5d2e41,_0x75e1('0x25'));_0x305a83(_0x53b5fc['result'][_0x75e1('0x28')]);}})['catch'](function(_0x152b0c){logger[_0x75e1('0x27')](_0x75e1('0x23'),_0x5d2e41,_0x152b0c);_0x3a9b37(_0x152b0c);});});}function respondWithStatusCode(_0x4d3937,_0x40ae8a){_0x40ae8a=_0x40ae8a||0xcc;return function(_0x25a960){if(_0x25a960){return _0x4d3937[_0x75e1('0x29')](_0x40ae8a);}return _0x4d3937[_0x75e1('0x2a')](_0x40ae8a)[_0x75e1('0x2b')]();};}function respondWithResult(_0x36be1d,_0x343484){_0x343484=_0x343484||0xc8;return function(_0x5094dd){if(_0x5094dd){return _0x36be1d[_0x75e1('0x2a')](_0x343484)[_0x75e1('0x2c')](_0x5094dd);}};}function respondWithFilteredResult(_0x5667e0,_0x46d4e2){return function(_0x5375d7){if(_0x5375d7){var _0x16d836=typeof _0x46d4e2[_0x75e1('0x2d')]===_0x75e1('0x2e')&&typeof _0x46d4e2[_0x75e1('0x2f')]===_0x75e1('0x2e');var _0x478eca=_0x5375d7['count'];var _0x206dc9=_0x16d836?0x0:_0x46d4e2[_0x75e1('0x2d')];var _0x3dda64=_0x16d836?_0x5375d7['count']:_0x46d4e2['offset']+_0x46d4e2[_0x75e1('0x2f')];var _0x14a799;if(_0x3dda64>=_0x478eca){_0x3dda64=_0x478eca;_0x14a799=0xc8;}else{_0x14a799=0xce;}_0x5667e0[_0x75e1('0x2a')](_0x14a799);return _0x5667e0['set'](_0x75e1('0x30'),_0x206dc9+'-'+_0x3dda64+'/'+_0x478eca)[_0x75e1('0x2c')](_0x5375d7);}return null;};}function patchUpdates(_0x22b6f9){return function(_0x228195){try{jsonpatch[_0x75e1('0x31')](_0x228195,_0x22b6f9,!![]);}catch(_0xe32b7a){return BPromise[_0x75e1('0x32')](_0xe32b7a);}return _0x228195[_0x75e1('0x33')]();};}function saveUpdates(_0x5091de,_0x31c648){return function(_0x575069){if(_0x575069){return _0x575069['update'](_0x5091de)[_0x75e1('0x21')](function(_0x5e7dc2){return _0x5e7dc2;});}return null;};}function removeEntity(_0x5ad40a,_0x517a1d){return function(_0x53c829){if(_0x53c829){return _0x53c829[_0x75e1('0x34')]()[_0x75e1('0x21')](function(){var _0x3c717d=_0x53c829[_0x75e1('0x35')]({'plain':!![]});var _0x4cca43=_0x75e1('0x36');return db[_0x75e1('0x37')]['destroy']({'where':{'type':_0x4cca43,'resourceId':_0x3c717d['id']}})['then'](function(){return _0x53c829;});})['then'](function(){_0x5ad40a[_0x75e1('0x2a')](0xcc)[_0x75e1('0x2b')]();});}};}function handleEntityNotFound(_0x2d6fbf,_0x38ea0d){return function(_0x223f5b){if(!_0x223f5b){_0x2d6fbf['sendStatus'](0x194);}return _0x223f5b;};}function handleError(_0x141123,_0x41e27c){_0x41e27c=_0x41e27c||0x1f4;return function(_0x7d68bf){logger['error'](_0x7d68bf[_0x75e1('0x38')]);if(_0x7d68bf[_0x75e1('0x39')]){delete _0x7d68bf[_0x75e1('0x39')];}_0x141123[_0x75e1('0x2a')](_0x41e27c)[_0x75e1('0x3a')](_0x7d68bf);};}exports['index']=function(_0x32b705,_0x244909){var _0x3edf36={'include':[{'model':db[_0x75e1('0x3b')],'as':_0x75e1('0x3c')}]},_0x27b92d={},_0x4203d1={'count':0x0,'rows':[]};var _0x493b27=_[_0x75e1('0x3d')](db[_0x75e1('0x3e')][_0x75e1('0x3f')],function(_0x2cbbc3){return{'name':_0x2cbbc3[_0x75e1('0x40')],'type':_0x2cbbc3['type'][_0x75e1('0x41')]};});_0x27b92d[_0x75e1('0x42')]=_['map'](_0x493b27,_0x75e1('0x39'));_0x27b92d[_0x75e1('0x43')]=_['keys'](_0x32b705[_0x75e1('0x43')]);_0x27b92d[_0x75e1('0x44')]=_[_0x75e1('0x45')](_0x27b92d[_0x75e1('0x42')],_0x27b92d[_0x75e1('0x43')]);_0x3edf36['attributes']=_[_0x75e1('0x45')](_0x27b92d['model'],qs[_0x75e1('0x46')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x46')]));_0x3edf36[_0x75e1('0x47')]=_0x3edf36[_0x75e1('0x47')][_0x75e1('0x48')]?_0x3edf36['attributes']:_0x27b92d[_0x75e1('0x42')];if(!_0x32b705[_0x75e1('0x43')]['hasOwnProperty'](_0x75e1('0x49'))){_0x3edf36[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x3edf36[_0x75e1('0x2d')]=qs[_0x75e1('0x2d')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x2d')]);}_0x3edf36[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x32b705[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x3edf36[_0x75e1('0x4c')]=qs['filters'](_[_0x75e1('0x4d')](_0x32b705[_0x75e1('0x43')],_0x27b92d[_0x75e1('0x44')]),_0x493b27);if(_0x32b705['query']['filter']){_0x3edf36[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x3edf36[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x493b27,function(_0x55888b){if(_0x55888b[_0x75e1('0x4f')]!==_0x75e1('0x50')){var _0x40d672={};_0x40d672[_0x55888b[_0x75e1('0x39')]]={'$like':'%'+_0x32b705[_0x75e1('0x43')]['filter']+'%'};return _0x40d672;}})});}_0x3edf36=_[_0x75e1('0x4e')]({},_0x3edf36,_0x32b705[_0x75e1('0x51')]);var _0x8b534e={'where':_0x3edf36[_0x75e1('0x4c')]};return db[_0x75e1('0x3e')][_0x75e1('0x52')](_0x8b534e)[_0x75e1('0x21')](function(_0xfbbb07){_0x4203d1['count']=_0xfbbb07;if(_0x32b705[_0x75e1('0x43')]['includeAll']){_0x3edf36[_0x75e1('0x53')]=[{'all':!![]}];}return db[_0x75e1('0x3e')][_0x75e1('0x54')](_0x3edf36);})[_0x75e1('0x21')](function(_0x2f2f9c){_0x4203d1['rows']=_0x2f2f9c;return _0x4203d1;})[_0x75e1('0x21')](respondWithFilteredResult(_0x244909,_0x3edf36))[_0x75e1('0x55')](handleError(_0x244909,null));};exports[_0x75e1('0x56')]=function(_0x47eabc,_0x1224b2){var _0x2e8a47={'raw':![],'where':{'id':_0x47eabc[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x3b')],'as':'mandatoryDispositionPause'}]},_0x24ee2c={};_0x24ee2c[_0x75e1('0x42')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x24ee2c[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x47eabc['query']);_0x24ee2c[_0x75e1('0x44')]=_['intersection'](_0x24ee2c[_0x75e1('0x42')],_0x24ee2c['query']);_0x2e8a47[_0x75e1('0x47')]=_[_0x75e1('0x45')](_0x24ee2c[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x47eabc[_0x75e1('0x43')][_0x75e1('0x46')]));_0x2e8a47[_0x75e1('0x47')]=_0x2e8a47[_0x75e1('0x47')]['length']?_0x2e8a47[_0x75e1('0x47')]:_0x24ee2c[_0x75e1('0x42')];if(_0x47eabc[_0x75e1('0x43')][_0x75e1('0x59')]){_0x2e8a47[_0x75e1('0x53')]=[{'all':!![]}];}_0x2e8a47=_['merge']({},_0x2e8a47,_0x47eabc['options']);return db[_0x75e1('0x3e')][_0x75e1('0x5a')](_0x2e8a47)['then'](handleEntityNotFound(_0x1224b2,null))[_0x75e1('0x21')](respondWithResult(_0x1224b2,null))[_0x75e1('0x55')](handleError(_0x1224b2,null));};exports[_0x75e1('0x5b')]=function(_0x4a8dda,_0x4ba27b){return db[_0x75e1('0x3e')][_0x75e1('0x5b')](_0x4a8dda[_0x75e1('0x5c')],{})['then'](function(_0x3783e7){var _0x1b420b=_0x4a8dda[_0x75e1('0x5d')][_0x75e1('0x35')]({'plain':!![]});if(!_0x1b420b)throw new Error(_0x75e1('0x5e'));if(_0x1b420b[_0x75e1('0x5f')]==='user'){var _0x44067a=_0x3783e7[_0x75e1('0x35')]({'plain':!![]});var _0x17e6d5=_0x75e1('0x36');return db['UserProfileSection'][_0x75e1('0x5a')]({'where':{'name':_0x17e6d5,'userProfileId':_0x1b420b['userProfileId']},'raw':!![]})[_0x75e1('0x21')](function(_0x1bbe25){if(_0x1bbe25&&_0x1bbe25[_0x75e1('0x60')]===0x0){return db[_0x75e1('0x37')][_0x75e1('0x5b')]({'name':_0x44067a[_0x75e1('0x39')],'resourceId':_0x44067a['id'],'type':_0x1bbe25[_0x75e1('0x39')],'sectionId':_0x1bbe25['id']},{})[_0x75e1('0x21')](function(){return _0x3783e7;});}else{return _0x3783e7;}})[_0x75e1('0x55')](function(_0x3d27bd){logger[_0x75e1('0x27')](_0x75e1('0x61'),_0x3d27bd);throw _0x3d27bd;});}return _0x3783e7;})[_0x75e1('0x21')](respondWithResult(_0x4ba27b,0xc9))[_0x75e1('0x55')](handleError(_0x4ba27b,null));};exports[_0x75e1('0x62')]=function(_0x104439,_0x1d0006){if(_0x104439[_0x75e1('0x5c')]['id']){delete _0x104439[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')]['find']({'where':{'id':_0x104439[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x3b')],'as':_0x75e1('0x3c')}]})['then'](handleEntityNotFound(_0x1d0006,null))['then'](saveUpdates(_0x104439['body'],null))[_0x75e1('0x21')](respondWithResult(_0x1d0006,null))[_0x75e1('0x55')](handleError(_0x1d0006,null));};exports[_0x75e1('0x34')]=function(_0x2de1fd,_0x8facca){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x2de1fd['params']['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x8facca,null))[_0x75e1('0x21')](removeEntity(_0x8facca,null))['catch'](handleError(_0x8facca,null));};exports[_0x75e1('0x63')]=function(_0x25957a,_0x3868d9){return db[_0x75e1('0x3e')]['describe']()[_0x75e1('0x21')](respondWithResult(_0x3868d9,null))[_0x75e1('0x55')](handleError(_0x3868d9,null));};exports[_0x75e1('0x64')]=function(_0x4ff018,_0xe7313a,_0x578b97){if(_0x4ff018[_0x75e1('0x5c')]['id']){delete _0x4ff018[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x4ff018[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0xe7313a,null))[_0x75e1('0x21')](function(_0x118b65){if(_0x118b65){_0x4ff018[_0x75e1('0x5c')][_0x75e1('0x65')]=_0x118b65['id'];return db['Disposition'][_0x75e1('0x5b')](_0x4ff018['body']);}})[_0x75e1('0x21')](respondWithResult(_0xe7313a,null))[_0x75e1('0x55')](handleError(_0xe7313a,null));};exports['getDispositions']=function(_0x5952a6,_0x2ece33,_0x2178b6){var _0x4ee298={'raw':![],'where':{}};var _0x5e7985={};var _0x300dfd={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5952a6[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x2ece33,null))[_0x75e1('0x21')](function(_0x3c992b){if(_0x3c992b){_0x5e7985[_0x75e1('0x42')]=_['keys'](db['Disposition'][_0x75e1('0x3f')]);_0x5e7985[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x5952a6[_0x75e1('0x43')]);_0x5e7985[_0x75e1('0x44')]=_[_0x75e1('0x45')](_0x5e7985['model'],_0x5e7985['query']);_0x4ee298['attributes']=_[_0x75e1('0x45')](_0x5e7985[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x5952a6['query'][_0x75e1('0x46')]));_0x4ee298['attributes']=_0x4ee298['attributes'][_0x75e1('0x48')]?_0x4ee298[_0x75e1('0x47')]:_0x5e7985[_0x75e1('0x42')];if(!_0x5952a6['query'][_0x75e1('0x66')](_0x75e1('0x49'))){_0x4ee298[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x5952a6[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x4ee298['offset']=qs[_0x75e1('0x2d')](_0x5952a6['query'][_0x75e1('0x2d')]);}_0x4ee298[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x5952a6[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x4ee298[_0x75e1('0x4c')]=qs[_0x75e1('0x44')](_[_0x75e1('0x4d')](_0x5952a6[_0x75e1('0x43')],_0x5e7985[_0x75e1('0x44')]));_0x4ee298[_0x75e1('0x4c')][_0x75e1('0x65')]=_0x3c992b['id'];if(_0x5952a6[_0x75e1('0x43')]['filter']){_0x4ee298[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x4ee298[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x4ee298[_0x75e1('0x47')],function(_0x197ce1){var _0x4c11d1={};_0x4c11d1[_0x197ce1]={'$like':'%'+_0x5952a6['query'][_0x75e1('0x67')]+'%'};return _0x4c11d1;})});}_0x4ee298=_['merge']({},_0x4ee298,_0x5952a6[_0x75e1('0x51')]);return db['Disposition']['count']({'where':_0x4ee298['where']})['then'](function(_0x9ef896){_0x300dfd[_0x75e1('0x52')]=_0x9ef896;if(_0x5952a6[_0x75e1('0x43')][_0x75e1('0x59')]){_0x4ee298[_0x75e1('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x75e1('0x54')](_0x4ee298);})[_0x75e1('0x21')](function(_0x3175b5){_0x300dfd[_0x75e1('0x68')]=_0x3175b5;return _0x300dfd;});}})['then'](respondWithFilteredResult(_0x2ece33,_0x4ee298))['catch'](handleError(_0x2ece33,null));};exports[_0x75e1('0x69')]=function(_0x2a6417,_0x30bb9c,_0x391a7b){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x2a6417['params']['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x30bb9c,null))[_0x75e1('0x21')](function(_0x3f9f98){if(_0x3f9f98){return _0x3f9f98[_0x75e1('0x69')](_0x2a6417[_0x75e1('0x43')][_0x75e1('0x6a')]);}})[_0x75e1('0x21')](respondWithStatusCode(_0x30bb9c,null))[_0x75e1('0x55')](handleError(_0x30bb9c,null));};exports[_0x75e1('0x6b')]=function(_0x5c54ad,_0x3e4901,_0x60e47){if(_0x5c54ad[_0x75e1('0x5c')]['id']){delete _0x5c54ad[_0x75e1('0x5c')]['id'];}return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x5c54ad[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4901,null))['then'](function(_0x4bfe31){if(_0x4bfe31){_0x5c54ad[_0x75e1('0x5c')][_0x75e1('0x65')]=_0x4bfe31['id'];return db[_0x75e1('0x6c')]['create'](_0x5c54ad['body']);}})[_0x75e1('0x21')](respondWithResult(_0x3e4901,null))[_0x75e1('0x55')](handleError(_0x3e4901,null));};exports[_0x75e1('0x6d')]=function(_0x3b5707,_0x2c8c26,_0x119ede){var _0x1a5887={'raw':![],'where':{}};var _0x295ed5={};var _0x314582={'count':0x0,'rows':[]};return db[_0x75e1('0x3e')][_0x75e1('0x6e')]({'where':{'id':_0x3b5707[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x2c8c26,null))[_0x75e1('0x21')](function(_0x149b32){if(_0x149b32){_0x295ed5[_0x75e1('0x42')]=_[_0x75e1('0x58')](db[_0x75e1('0x6c')][_0x75e1('0x3f')]);_0x295ed5['query']=_[_0x75e1('0x58')](_0x3b5707[_0x75e1('0x43')]);_0x295ed5[_0x75e1('0x44')]=_['intersection'](_0x295ed5['model'],_0x295ed5[_0x75e1('0x43')]);_0x1a5887[_0x75e1('0x47')]=_['intersection'](_0x295ed5[_0x75e1('0x42')],qs[_0x75e1('0x46')](_0x3b5707['query']['fields']));_0x1a5887['attributes']=_0x1a5887['attributes'][_0x75e1('0x48')]?_0x1a5887[_0x75e1('0x47')]:_0x295ed5[_0x75e1('0x42')];if(!_0x3b5707['query'][_0x75e1('0x66')]('nolimit')){_0x1a5887[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x3b5707[_0x75e1('0x43')]['limit']);_0x1a5887['offset']=qs[_0x75e1('0x2d')](_0x3b5707['query']['offset']);}_0x1a5887[_0x75e1('0x4a')]=qs['sort'](_0x3b5707[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x1a5887['where']=qs['filters'](_[_0x75e1('0x4d')](_0x3b5707[_0x75e1('0x43')],_0x295ed5['filters']));_0x1a5887[_0x75e1('0x4c')]['WhatsappAccountId']=_0x149b32['id'];if(_0x3b5707[_0x75e1('0x43')][_0x75e1('0x67')]){_0x1a5887[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x1a5887[_0x75e1('0x4c')],{'$or':_['map'](_0x1a5887[_0x75e1('0x47')],function(_0x38e374){var _0x50f094={};_0x50f094[_0x38e374]={'$like':'%'+_0x3b5707['query'][_0x75e1('0x67')]+'%'};return _0x50f094;})});}_0x1a5887=_['merge']({},_0x1a5887,_0x3b5707[_0x75e1('0x51')]);return db['CannedAnswer']['count']({'where':_0x1a5887['where']})[_0x75e1('0x21')](function(_0x271b0d){_0x314582[_0x75e1('0x52')]=_0x271b0d;if(_0x3b5707['query'][_0x75e1('0x59')]){_0x1a5887[_0x75e1('0x53')]=[{'all':!![]}];}return db[_0x75e1('0x6c')][_0x75e1('0x54')](_0x1a5887);})['then'](function(_0x482886){_0x314582[_0x75e1('0x68')]=_0x482886;return _0x314582;});}})[_0x75e1('0x21')](respondWithFilteredResult(_0x2c8c26,_0x1a5887))[_0x75e1('0x55')](handleError(_0x2c8c26,null));};exports[_0x75e1('0x6f')]=function(_0x3d6f72,_0x1a706d,_0x173bcd){return db['WhatsappAccount'][_0x75e1('0x5a')]({'where':{'id':_0x3d6f72[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x1a706d,null))[_0x75e1('0x21')](function(_0xc7ca20){if(_0xc7ca20){return _0xc7ca20[_0x75e1('0x6f')](_0x3d6f72[_0x75e1('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1a706d,null))[_0x75e1('0x55')](handleError(_0x1a706d,null));};exports[_0x75e1('0x70')]=function(_0x176c06,_0xdd2306,_0x52827b){return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x176c06[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0xdd2306,null))['then'](function(_0x8660a){if(_0x8660a){return _0x8660a[_0x75e1('0x70')](_0x176c06['body']['ids'],_[_0x75e1('0x71')](_0x176c06[_0x75e1('0x5c')],[_0x75e1('0x6a'),'id'])||{})[_0x75e1('0x72')](function(_0x35cda7){for(var _0x19bee9=0x0;_0x19bee9<_0x176c06['body']['ids'][_0x75e1('0x48')];_0x19bee9+=0x1){socket[_0x75e1('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x176c06['body'][_0x75e1('0x6a')][_0x19bee9]),'WhatsappAccountId':Number(_0x176c06['params']['id'])});}return _0x35cda7;});}})[_0x75e1('0x21')](respondWithResult(_0xdd2306,null))[_0x75e1('0x55')](handleError(_0xdd2306,null));};exports[_0x75e1('0x74')]=function(_0x3979e4,_0x40a7fb,_0x46d31e){return db[_0x75e1('0x3e')]['find']({'where':{'id':_0x3979e4[_0x75e1('0x57')]['id']}})['then'](handleEntityNotFound(_0x40a7fb,null))[_0x75e1('0x21')](function(_0x9e9b35){if(_0x9e9b35){return _0x9e9b35[_0x75e1('0x74')](_0x3979e4['query'][_0x75e1('0x6a')])[_0x75e1('0x21')](function(){if(_['isArray'](_0x3979e4[_0x75e1('0x43')][_0x75e1('0x6a')])){for(var _0x7c8725=0x0;_0x7c8725<_0x3979e4['query'][_0x75e1('0x6a')][_0x75e1('0x48')];_0x7c8725+=0x1){socket[_0x75e1('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x3979e4['query'][_0x75e1('0x6a')][_0x7c8725]),'WhatsappAccountId':Number(_0x3979e4['params']['id'])});}}else{socket['emit'](_0x75e1('0x75'),{'UserId':Number(_0x3979e4['query'][_0x75e1('0x6a')]),'WhatsappAccountId':Number(_0x3979e4[_0x75e1('0x57')]['id'])});}});}})[_0x75e1('0x21')](respondWithStatusCode(_0x40a7fb,null))[_0x75e1('0x55')](handleError(_0x40a7fb,null));};exports['getAgents']=function(_0x138e7b,_0x459227,_0x2d6bb9){var _0x13ade3={};var _0x17bd5b={};var _0x5361a0;var _0x433adb;return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x138e7b[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x459227,null))[_0x75e1('0x21')](function(_0x3fb39a){if(_0x3fb39a){_0x5361a0=_0x3fb39a;_0x17bd5b['model']=_['keys'](db[_0x75e1('0x76')][_0x75e1('0x3f')]);_0x17bd5b['query']=_['keys'](_0x138e7b[_0x75e1('0x43')]);_0x17bd5b[_0x75e1('0x44')]=_['intersection'](_0x17bd5b[_0x75e1('0x42')],_0x17bd5b['query']);_0x13ade3['attributes']=_['intersection'](_0x17bd5b['model'],qs[_0x75e1('0x46')](_0x138e7b['query'][_0x75e1('0x46')]));_0x13ade3[_0x75e1('0x47')]=_0x13ade3['attributes'][_0x75e1('0x48')]?_0x13ade3['attributes']:_0x17bd5b[_0x75e1('0x42')];_0x13ade3[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x138e7b[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x13ade3[_0x75e1('0x4c')]=qs[_0x75e1('0x44')](_[_0x75e1('0x4d')](_0x138e7b['query'],_0x17bd5b[_0x75e1('0x44')]));if(_0x138e7b[_0x75e1('0x43')][_0x75e1('0x67')]){_0x13ade3[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x13ade3[_0x75e1('0x4c')],{'$or':_[_0x75e1('0x3d')](_0x13ade3['attributes'],function(_0x3494c2){var _0x1fb3d2={};_0x1fb3d2[_0x3494c2]={'$like':'%'+_0x138e7b[_0x75e1('0x43')][_0x75e1('0x67')]+'%'};return _0x1fb3d2;})});}_0x13ade3=_[_0x75e1('0x4e')]({},_0x13ade3,_0x138e7b['options']);return _0x5361a0[_0x75e1('0x77')](_0x13ade3);}})[_0x75e1('0x21')](function(_0x119be2){if(_0x119be2){_0x433adb=_0x119be2[_0x75e1('0x48')];if(!_0x138e7b[_0x75e1('0x43')][_0x75e1('0x66')](_0x75e1('0x49'))){_0x13ade3['limit']=qs[_0x75e1('0x2f')](_0x138e7b['query'][_0x75e1('0x2f')]);_0x13ade3['offset']=qs[_0x75e1('0x2d')](_0x138e7b[_0x75e1('0x43')][_0x75e1('0x2d')]);}return _0x5361a0[_0x75e1('0x77')](_0x13ade3);}})['then'](function(_0x57e5d4){if(_0x57e5d4){return _0x57e5d4?{'count':_0x433adb,'rows':_0x57e5d4}:null;}})['then'](respondWithResult(_0x459227,null))[_0x75e1('0x55')](handleError(_0x459227,null));};exports[_0x75e1('0x78')]=function(_0x7213be,_0x25fe9d){var _0x3bb7d4=_0x7213be[_0x75e1('0x57')]['id'];var _0x1e4755=_0x7213be['body'];var _0x3d617d=0xc8;var _0x2131f7=null;return db[_0x75e1('0x79')][_0x75e1('0x7a')]({'isolationLevel':db[_0x75e1('0x79')][_0x75e1('0x7b')]['ISOLATION_LEVELS'][_0x75e1('0x7c')]},function(_0x1eca9b){return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x3bb7d4},'transaction':_0x1eca9b})[_0x75e1('0x21')](function(_0x241d81){if(_0x241d81){return db[_0x75e1('0x7d')][_0x75e1('0x34')]({'where':{'WhatsappAccountId':_0x3bb7d4},'transaction':_0x1eca9b})[_0x75e1('0x21')](function(){var _0x4f2015=_[_0x75e1('0x3d')](_0x1e4755,function(_0x5222e0){_0x5222e0[_0x75e1('0x65')]=_0x3bb7d4;return _0x5222e0;});return db[_0x75e1('0x7d')][_0x75e1('0x7e')](_0x4f2015,{'transaction':_0x1eca9b});});}else{_0x3d617d=0x194;_0x2131f7=[];}});})['then'](function(){if(_0x3d617d!==0x194){return db[_0x75e1('0x7d')][_0x75e1('0x7f')]({'where':{'WhatsappAccountId':_0x3bb7d4},'order':'priority'})[_0x75e1('0x21')](function(_0x714686){_0x2131f7=_0x714686;});}})[_0x75e1('0x55')](function(_0x40abd9){_0x3d617d=0x1f4;logger['error'](_0x40abd9['stack']);if(_0x40abd9[_0x75e1('0x39')]){delete _0x40abd9[_0x75e1('0x39')];}_0x2131f7=_0x40abd9;})['finally'](function(){if(_0x2131f7===null){_0x25fe9d[_0x75e1('0x29')](_0x3d617d);}else{if(_0x3d617d===0x1f4){_0x25fe9d['status'](_0x3d617d)[_0x75e1('0x3a')](_0x2131f7);}else{_0x25fe9d['status'](_0x3d617d)[_0x75e1('0x2c')](_0x2131f7);}}});};exports[_0x75e1('0x80')]=function(_0x191d7b,_0x1e241d,_0x17c506){var _0x14bea7={};var _0x208cb1={};var _0x1dda82;var _0x23c592;return db['WhatsappAccount'][_0x75e1('0x6e')]({'where':{'id':_0x191d7b[_0x75e1('0x57')]['id']}})[_0x75e1('0x21')](handleEntityNotFound(_0x1e241d,null))['then'](function(_0x47ff46){if(_0x47ff46){_0x1dda82=_0x47ff46;_0x208cb1[_0x75e1('0x42')]=_['keys'](db[_0x75e1('0x7d')][_0x75e1('0x3f')]);_0x208cb1[_0x75e1('0x43')]=_[_0x75e1('0x58')](_0x191d7b[_0x75e1('0x43')]);_0x208cb1[_0x75e1('0x44')]=_['intersection'](_0x208cb1['model'],_0x208cb1['query']);_0x14bea7[_0x75e1('0x47')]=_[_0x75e1('0x45')](_0x208cb1[_0x75e1('0x42')],qs['fields'](_0x191d7b[_0x75e1('0x43')]['fields']));_0x14bea7['attributes']=_0x14bea7['attributes'][_0x75e1('0x48')]?_0x14bea7[_0x75e1('0x47')]:_0x208cb1[_0x75e1('0x42')];_0x14bea7[_0x75e1('0x4a')]=qs[_0x75e1('0x4b')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x4b')]);_0x14bea7['where']=qs[_0x75e1('0x44')](_['pick'](_0x191d7b[_0x75e1('0x43')],_0x208cb1[_0x75e1('0x44')]));if(_0x191d7b['query'][_0x75e1('0x67')]){_0x14bea7[_0x75e1('0x4c')]=_[_0x75e1('0x4e')](_0x14bea7['where'],{'$or':_[_0x75e1('0x3d')](_0x14bea7['attributes'],function(_0x55cf26){var _0x15b76e={};_0x15b76e[_0x55cf26]={'$like':'%'+_0x191d7b[_0x75e1('0x43')][_0x75e1('0x67')]+'%'};return _0x15b76e;})});}_0x14bea7=_[_0x75e1('0x4e')]({},_0x14bea7,_0x191d7b[_0x75e1('0x51')]);return _0x1dda82[_0x75e1('0x80')](_0x14bea7);}})[_0x75e1('0x21')](function(_0x45436c){if(_0x45436c){_0x23c592=_0x45436c[_0x75e1('0x48')];if(!_0x191d7b[_0x75e1('0x43')][_0x75e1('0x66')](_0x75e1('0x49'))){_0x14bea7[_0x75e1('0x2f')]=qs[_0x75e1('0x2f')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x2f')]);_0x14bea7['offset']=qs[_0x75e1('0x2d')](_0x191d7b[_0x75e1('0x43')][_0x75e1('0x2d')]);}return _0x1dda82[_0x75e1('0x80')](_0x14bea7);}})[_0x75e1('0x21')](function(_0x3521fb){if(_0x3521fb){return _0x3521fb?{'count':_0x23c592,'rows':_0x3521fb}:null;}})['then'](respondWithResult(_0x1e241d,null))[_0x75e1('0x55')](handleError(_0x1e241d,null));};exports[_0x75e1('0x81')]=function(_0x3eacb9,_0x399e7d,_0x6bbce7){var _0xd7ef8={'channel':_0x75e1('0x82')};var _0x654f86=[];var _0x13e91d=[];var _0x2dd11f={};return db['WhatsappAccount'][_0x75e1('0x5a')]({'where':{'id':_0x3eacb9[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0x7d')],'as':_0x75e1('0x83')}]})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))['then'](function(_0x36bf66){_0xd7ef8[_0x75e1('0x84')]=_0x36bf66;if(_0xd7ef8['account']&&_0xd7ef8[_0x75e1('0x84')][_0x75e1('0x4f')]==='sinch'&&_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')]){if(_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][_0x75e1('0x48')]===0x0)return;if(_0x3eacb9['body'][_0x75e1('0x85')][0x0][_0x75e1('0x86')]!==_0x75e1('0x87'))return;return db[_0x75e1('0x88')]['update']({'read':!![],'readAt':_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][0x0][_0x75e1('0x89')]},{'where':{'messageId':_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x85')][0x0][_0x75e1('0x8a')]},'individualHooks':!![]})[_0x75e1('0x21')](function(_0x81f89c){return _0x399e7d[_0x75e1('0x2a')](0xc8)[_0x75e1('0x2c')](_0x81f89c);});}_0xd7ef8[_0x75e1('0x8b')]=_[_0x75e1('0x8c')](_0x36bf66[_0x75e1('0x83')],[_0x75e1('0x8d')],[_0x75e1('0x8e')]);if(_0xd7ef8[_0x75e1('0x84')]['Applications']){delete _0xd7ef8['account'][_0x75e1('0x83')];}return db['CmContact'][_0x75e1('0x63')]()['then'](function(_0x1e485f){if(!_0x1e485f){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0x91'));}_0x654f86=_[_0x75e1('0x92')](_[_0x75e1('0x58')](_0x1e485f),[_0x75e1('0x93'),_0x75e1('0x94')]);_0x13e91d=_['difference'](_[_0x75e1('0x58')](_0x1e485f),['createdAt',_0x75e1('0x94'),'CompanyId',_0x75e1('0x95')]);_0xd7ef8[_0x75e1('0x5c')]={'mapKey':_0x75e1('0x96')};if(_0xd7ef8['account']&&_0xd7ef8['account'][_0x75e1('0x4f')]===_0x75e1('0x97')){_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')]=_0x3eacb9[_0x75e1('0x5c')]['From'][_0x75e1('0x99')](_0x75e1('0x9a'),'');_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9b')];_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x9c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9d')];}if(_0xd7ef8[_0x75e1('0x84')]&&_0xd7ef8[_0x75e1('0x84')]['type']==='sinch'){_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')]=_0x3eacb9['body'][_0x75e1('0x9e')][0x0][_0x75e1('0x98')];_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9e')][0x0][_0x75e1('0x28')]['body'];_0xd7ef8['body'][_0x75e1('0x9c')]=_0x3eacb9[_0x75e1('0x5c')][_0x75e1('0x9e')][0x0][_0x75e1('0x8a')];}if(_0xd7ef8[_0x75e1('0x5c')]['id']){delete _0xd7ef8[_0x75e1('0x5c')]['id'];}if(_[_0x75e1('0x9f')](_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')])){throw new db['Sequelize'][(_0x75e1('0x90'))](_0x75e1('0xa0'));}if(_[_0x75e1('0x9f')](_0xd7ef8['body'][_0x75e1('0x5c')])||_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')]===''){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa1'));}if(_[_0x75e1('0x9f')](_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13e91d);}if(!_[_0x75e1('0xa3')](_0x13e91d,_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa4')+_0x13e91d);}_0x2dd11f[_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0xa2')]]=_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')];return db[_0x75e1('0xa5')][_0x75e1('0x5a')]({'where':{'id':_0xd7ef8[_0x75e1('0x84')]['ListId']},'include':[{'model':db[_0x75e1('0xa6')],'as':_0x75e1('0xa7'),'where':_0x2dd11f,'limit':0x1,'order':[[_0x75e1('0x94'),_0x75e1('0xa8')]]}]});})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))['then'](function(_0x19891d){if(_0x19891d){_0xd7ef8['list']=_[_0x75e1('0x71')](_0x19891d,[_0x75e1('0xa7')]);if(_0x19891d[_0x75e1('0xa7')][_0x75e1('0x48')]){return _0x19891d[_0x75e1('0xa7')][0x0];}var _0x155981=_[_0x75e1('0x1b')](_0xd7ef8[_0x75e1('0x5c')],{'firstName':_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')],'ListId':_0x19891d['id']});_0x155981[_0xd7ef8['body'][_0x75e1('0xa2')]]=_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x98')];return db[_0x75e1('0xa6')][_0x75e1('0x5b')](_0x155981,{'fields':_0x654f86,'raw':!![]});}})[_0x75e1('0x21')](handleEntityNotFound(_0x399e7d,null))[_0x75e1('0x21')](function(_0x4a838c){if(_0x4a838c){_0xd7ef8[_0x75e1('0xa9')]=_0x4a838c;var _0x46eb3e={'ContactId':_0x4a838c['id'],'phone':_0xd7ef8['body'][_0x75e1('0x98')],'WhatsappAccountId':_0x3eacb9[_0x75e1('0x57')]['id']};var _0x5d80b7={'ContactId':_0x4a838c['id'],'WhatsappAccountId':_0x3eacb9['params']['id'],'closed':![]};return db[_0x75e1('0xaa')]['find']({'where':_0x5d80b7})[_0x75e1('0x21')](function(_0x3f30af){if(_0x3f30af){return[_0x3f30af,![]];}return db['WhatsappInteraction']['create'](_0x46eb3e)[_0x75e1('0x21')](function(_0x3171d3){return[_0x3171d3,!![]];});});}})[_0x75e1('0x72')](function(_0x1dea8c,_0x88ee7b){_0xd7ef8[_0x75e1('0xab')]=_0x1dea8c[_0x75e1('0x35')]({'plain':!![]});_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xac')]=![];if(_0x88ee7b){if(_0xd7ef8[_0x75e1('0x84')]['autoclose']){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xad')]({'id':0x0,'priority':_0xd7ef8[_0x75e1('0x8b')]['length']+0x1,'app':'close','appdata':_0x75e1('0xae'),'interval':_0x75e1('0xaf')});}_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xac')]=!![];}return db[_0x75e1('0x88')][_0x75e1('0x5b')]({'phone':_0xd7ef8['body'][_0x75e1('0x98')],'messageId':_0xd7ef8['body'][_0x75e1('0x9c')],'body':_0xd7ef8[_0x75e1('0x5c')][_0x75e1('0x5c')],'WhatsappAccountId':_0x3eacb9['params']['id'],'WhatsappInteractionId':_0x1dea8c['id'],'direction':'in','ContactId':_0x1dea8c[_0x75e1('0xb0')],'AttachmentId':_0xd7ef8[_0x75e1('0x5c')]['AttachmentId']});})['then'](function(_0x5bca4f){_0xd7ef8[_0x75e1('0x28')]=_0x5bca4f;if(!_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb1')])return;return db[_0x75e1('0x76')][_0x75e1('0x5a')]({'attributes':['id',_0x75e1('0x39')],'where':{'id':_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb1')]}});})[_0x75e1('0x21')](function(_0x334a6a){if(_0x334a6a){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x334a6a['name']+','+(_0xd7ef8['account'][_0x75e1('0xb3')]||0xa),'interval':_0x75e1('0xaf')});}if(!_0xd7ef8[_0x75e1('0xab')]['queueId'])return;return db[_0x75e1('0xb4')]['find']({'attributes':['id',_0x75e1('0x39')],'where':{'id':_0xd7ef8[_0x75e1('0xab')][_0x75e1('0xb5')]}});})[_0x75e1('0x21')](function(_0x5e6d7e){if(_0x5e6d7e){_0xd7ef8[_0x75e1('0x8b')][_0x75e1('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5e6d7e[_0x75e1('0x39')]+','+(_0xd7ef8[_0x75e1('0x84')][_0x75e1('0xb6')]||0x12c),'interval':_0x75e1('0xaf')});}return respondWithRpcPromise(_0x75e1('0xb7'),_0x75e1('0xb8'),_0xd7ef8);})[_0x75e1('0x21')](function(_0x75460e){if(_0x75460e){var _0x478797=0xc8;var _0x5d8610=_0x75e1('0xb9');logger[_0x75e1('0x22')](_0x75e1('0x24'),_0x5d8610,_0x478797,_0x75e1('0xba'));logger[_0x75e1('0xbb')](_0x75e1('0xbc'),_0x5d8610,_0x478797,'entity\x20found',JSON[_0x75e1('0x26')](_0x75460e));if(_0xd7ef8[_0x75e1('0x84')]['type']===_0x75e1('0x97')){return _0x399e7d['status'](_0x478797)['set'](_0x75e1('0xbd'),_0x75e1('0xbe'))['send'](_0x75e1('0xbf'));}else{return _0x399e7d['status'](_0x478797)[_0x75e1('0x2c')](_0x75460e);}}});})[_0x75e1('0x55')](handleError(_0x399e7d,null));};exports[_0x75e1('0x3a')]=function(_0x287387,_0x1222cd,_0xe162e1){var _0x49eb29,_0x3656f2,_0x494587;if(_[_0x75e1('0x9f')](_0x287387[_0x75e1('0x5c')]['body'])||_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')]===''){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xa1'));}if(_['isNil'](_0x287387[_0x75e1('0x5c')]['to'])){throw new db[(_0x75e1('0x8f'))][(_0x75e1('0x90'))](_0x75e1('0xc0'));}_0x49eb29=_0x287387['body']['to'];return db[_0x75e1('0x3e')][_0x75e1('0x5a')]({'where':{'id':_0x287387[_0x75e1('0x57')]['id']},'include':[{'model':db[_0x75e1('0xa5')],'as':'List','include':[{'model':db[_0x75e1('0xa6')],'as':_0x75e1('0xa7'),'where':{'mobile':_0x49eb29},'limit':0x1,'order':[[_0x75e1('0x94'),_0x75e1('0xa8')]]}]}]})[_0x75e1('0x21')](handleEntityNotFound(_0x1222cd,null))[_0x75e1('0x21')](function(_0x486daa){if(_0x486daa&&_0x486daa[_0x75e1('0xc1')]){_0x3656f2=_0x486daa['get']({'plain':!![]});if(_0x3656f2[_0x75e1('0xc1')]&&_0x3656f2['List'][_0x75e1('0xa7')][_0x75e1('0x48')]){return _0x3656f2[_0x75e1('0xc1')][_0x75e1('0xa7')][0x0];}return db['CmContact'][_0x75e1('0x5b')](_[_0x75e1('0x1b')](_0x287387[_0x75e1('0x5c')],{'firstName':_0x49eb29,'mobile':_0x49eb29,'phone':_0x49eb29,'ListId':_0x3656f2[_0x75e1('0x95')]}));}})['then'](handleEntityNotFound(_0x1222cd,null))['then'](function(_0x59fc6e){if(_0x59fc6e){_0x494587=_0x59fc6e;return db[_0x75e1('0xaa')][_0x75e1('0x5a')]({'where':{'ContactId':_0x494587['id'],'closed':![],'WhatsappAccountId':_0x3656f2['id']}})[_0x75e1('0x21')](function(_0x23d4f7){if(_0x23d4f7){return[_0x23d4f7,![]];}return db[_0x75e1('0xaa')][_0x75e1('0x5b')]({'UserId':_0x287387['user']['id'],'ContactId':_0x494587['id'],'WhatsappAccountId':_0x3656f2['id'],'phone':_0x49eb29,'firstMsgDirection':_0x75e1('0xc2'),'Messages':[_['merge'](_0x287387[_0x75e1('0x5c')],{'read':![],'body':_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')],'phone':_0x49eb29,'WhatsappAccountId':_0x3656f2['id'],'UserId':_0x287387[_0x75e1('0x5d')]['id'],'ContactId':_0x494587['id']})]},{'include':[{'model':db[_0x75e1('0x88')],'as':_0x75e1('0xc3')}]})[_0x75e1('0x21')](function(_0x2ed333){return[_0x2ed333,!![]];});});}})['spread'](function(_0x5355f7,_0x394113){if(_0x394113){return _0x5355f7;}return db['WhatsappMessage']['create'](_['merge'](_0x287387[_0x75e1('0x5c')],{'read':![],'body':_0x287387[_0x75e1('0x5c')][_0x75e1('0x5c')],'phone':_0x49eb29,'WhatsappAccountId':_0x3656f2['id'],'WhatsappInteractionId':_0x5355f7['id'],'UserId':_0x287387[_0x75e1('0x5d')]['id'],'ContactId':_0x494587['id']}))['then'](function(_0x56a38e){_0x5355f7[_0x75e1('0xc4')][_0x75e1('0xc3')]=[];_0x5355f7[_0x75e1('0xc4')][_0x75e1('0xc3')][_0x75e1('0xad')](_0x56a38e[_0x75e1('0xc4')]);return _0x5355f7;});})[_0x75e1('0x21')](respondWithResult(_0x1222cd,null))[_0x75e1('0x55')](handleError(_0x1222cd,null));}; \ No newline at end of file +var _0x36f9=['query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','mandatoryDispositionPause','describe','WhatsappAccountId','Disposition','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','includeAll','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','WhatsappMessage','timestamp','applications','orderBy','priority','asc','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from','replace','Body','messageId','MessageSid','sinch','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','contact','WhatsappInteraction','interaction','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36f9,0x7f));var _0x936f=function(_0x5f213c,_0x2f4f56){_0x5f213c=_0x5f213c-0x0;var _0x32114d=_0x36f9[_0x5f213c];return _0x32114d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x936f('0x0'));var zipdir=require(_0x936f('0x1'));var jsonpatch=require(_0x936f('0x2'));var rp=require(_0x936f('0x3'));var moment=require(_0x936f('0x4'));var BPromise=require(_0x936f('0x5'));var Mustache=require(_0x936f('0x6'));var util=require(_0x936f('0x7'));var path=require(_0x936f('0x8'));var sox=require(_0x936f('0x9'));var csv=require(_0x936f('0xa'));var ejs=require(_0x936f('0xb'));var fs=require('fs');var fs_extra=require(_0x936f('0xc'));var _=require(_0x936f('0xd'));var squel=require(_0x936f('0xe'));var crypto=require(_0x936f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x936f('0x10'));var toCsv=require(_0x936f('0xa'));var querystring=require(_0x936f('0x11'));var Papa=require(_0x936f('0x12'));var Redis=require(_0x936f('0x13'));var authService=require(_0x936f('0x14'));var qs=require(_0x936f('0x15'));var as=require(_0x936f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x936f('0x17'))('api');var utils=require(_0x936f('0x18'));var config=require(_0x936f('0x19'));var licenseUtil=require(_0x936f('0x1a'));var db=require(_0x936f('0x1b'))['db'];config[_0x936f('0x1c')]=_[_0x936f('0x1d')](config['redis'],{'host':_0x936f('0x1e'),'port':0x18eb});var socket=require(_0x936f('0x1f'))(new Redis(config[_0x936f('0x1c')]));require(_0x936f('0x20'))[_0x936f('0x21')](socket);var jayson=require(_0x936f('0x22'));var client=jayson[_0x936f('0x23')][_0x936f('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x929784,_0x3a1e7d,_0x1d59b3,_0x47ef4a){return new BPromise(function(_0x2df123,_0x40566a){var _0x3b48b6=_0x47ef4a||client;return _0x3b48b6['request'](_0x929784,_0x1d59b3)[_0x936f('0x25')](function(_0x3ccb5e){logger[_0x936f('0x26')](_0x936f('0x27'),_0x3a1e7d,_0x936f('0x28'));logger[_0x936f('0x29')](_0x936f('0x2a'),_0x3a1e7d,'request\x20sent',JSON[_0x936f('0x2b')](_0x3ccb5e));if(_0x3ccb5e[_0x936f('0x2c')]){if(_0x3ccb5e['error'][_0x936f('0x2d')]===0x1f4){logger[_0x936f('0x2c')](_0x936f('0x27'),_0x3a1e7d,_0x3ccb5e[_0x936f('0x2c')]['message']);return _0x40566a(_0x3ccb5e[_0x936f('0x2c')]['message']);}logger[_0x936f('0x2c')](_0x936f('0x27'),_0x3a1e7d,_0x3ccb5e[_0x936f('0x2c')][_0x936f('0x2e')]);return _0x2df123(_0x3ccb5e['error'][_0x936f('0x2e')]);}else{logger['info'](_0x936f('0x27'),_0x3a1e7d,_0x936f('0x28'));_0x2df123(_0x3ccb5e[_0x936f('0x2f')]['message']);}})[_0x936f('0x30')](function(_0x2528b4){logger[_0x936f('0x2c')](_0x936f('0x27'),_0x3a1e7d,_0x2528b4);_0x40566a(_0x2528b4);});});}function respondWithStatusCode(_0x36e07e,_0x248fe6){_0x248fe6=_0x248fe6||0xcc;return function(_0x1b5144){if(_0x1b5144){return _0x36e07e[_0x936f('0x31')](_0x248fe6);}return _0x36e07e[_0x936f('0x32')](_0x248fe6)['end']();};}function respondWithResult(_0x980f81,_0x1c676c){_0x1c676c=_0x1c676c||0xc8;return function(_0x25719e){if(_0x25719e){return _0x980f81[_0x936f('0x32')](_0x1c676c)[_0x936f('0x33')](_0x25719e);}};}function respondWithFilteredResult(_0x4214c4,_0x40c573){return function(_0x54f32d){if(_0x54f32d){var _0x87606d=typeof _0x40c573[_0x936f('0x34')]===_0x936f('0x35')&&typeof _0x40c573[_0x936f('0x36')]===_0x936f('0x35');var _0x548163=_0x54f32d[_0x936f('0x37')];var _0x318e45=_0x87606d?0x0:_0x40c573[_0x936f('0x34')];var _0x24159a=_0x87606d?_0x54f32d[_0x936f('0x37')]:_0x40c573[_0x936f('0x34')]+_0x40c573[_0x936f('0x36')];var _0x37fb18;if(_0x24159a>=_0x548163){_0x24159a=_0x548163;_0x37fb18=0xc8;}else{_0x37fb18=0xce;}_0x4214c4[_0x936f('0x32')](_0x37fb18);return _0x4214c4[_0x936f('0x38')](_0x936f('0x39'),_0x318e45+'-'+_0x24159a+'/'+_0x548163)[_0x936f('0x33')](_0x54f32d);}return null;};}function patchUpdates(_0x503c5f){return function(_0x565e1d){try{jsonpatch[_0x936f('0x3a')](_0x565e1d,_0x503c5f,!![]);}catch(_0x4ebfff){return BPromise['reject'](_0x4ebfff);}return _0x565e1d[_0x936f('0x3b')]();};}function saveUpdates(_0x59ac1b,_0x1e575c){return function(_0x370675){if(_0x370675){return _0x370675[_0x936f('0x3c')](_0x59ac1b)[_0x936f('0x25')](function(_0x5490e5){return _0x5490e5;});}return null;};}function removeEntity(_0x579084,_0x19e00f){return function(_0x1199c8){if(_0x1199c8){return _0x1199c8[_0x936f('0x3d')]()[_0x936f('0x25')](function(){var _0x5aa808=_0x1199c8[_0x936f('0x3e')]({'plain':!![]});var _0x39aa01=_0x936f('0x3f');return db[_0x936f('0x40')][_0x936f('0x3d')]({'where':{'type':_0x39aa01,'resourceId':_0x5aa808['id']}})['then'](function(){return _0x1199c8;});})['then'](function(){_0x579084[_0x936f('0x32')](0xcc)[_0x936f('0x41')]();});}};}function handleEntityNotFound(_0x473adb,_0x40ebc4){return function(_0x2ae4fa){if(!_0x2ae4fa){_0x473adb[_0x936f('0x31')](0x194);}return _0x2ae4fa;};}function handleError(_0x173302,_0x2db1bc){_0x2db1bc=_0x2db1bc||0x1f4;return function(_0x517181){logger[_0x936f('0x2c')](_0x517181['stack']);if(_0x517181[_0x936f('0x42')]){delete _0x517181[_0x936f('0x42')];}_0x173302[_0x936f('0x32')](_0x2db1bc)[_0x936f('0x43')](_0x517181);};}exports[_0x936f('0x44')]=function(_0x41fd9d,_0x11568e){var _0x5b15db={'include':[{'model':db[_0x936f('0x45')],'as':'mandatoryDispositionPause'}]},_0x2f1275={},_0x30e66d={'count':0x0,'rows':[]};var _0x28f866=_[_0x936f('0x46')](db[_0x936f('0x47')][_0x936f('0x48')],function(_0x4a4818){return{'name':_0x4a4818[_0x936f('0x49')],'type':_0x4a4818[_0x936f('0x4a')][_0x936f('0x4b')]};});_0x2f1275['model']=_[_0x936f('0x46')](_0x28f866,_0x936f('0x42'));_0x2f1275[_0x936f('0x4c')]=_[_0x936f('0x4d')](_0x41fd9d[_0x936f('0x4c')]);_0x2f1275['filters']=_[_0x936f('0x4e')](_0x2f1275[_0x936f('0x4f')],_0x2f1275['query']);_0x5b15db['attributes']=_[_0x936f('0x4e')](_0x2f1275[_0x936f('0x4f')],qs['fields'](_0x41fd9d[_0x936f('0x4c')][_0x936f('0x50')]));_0x5b15db[_0x936f('0x51')]=_0x5b15db['attributes'][_0x936f('0x52')]?_0x5b15db[_0x936f('0x51')]:_0x2f1275[_0x936f('0x4f')];if(!_0x41fd9d[_0x936f('0x4c')]['hasOwnProperty'](_0x936f('0x53'))){_0x5b15db[_0x936f('0x36')]=qs[_0x936f('0x36')](_0x41fd9d[_0x936f('0x4c')]['limit']);_0x5b15db['offset']=qs[_0x936f('0x34')](_0x41fd9d[_0x936f('0x4c')][_0x936f('0x34')]);}_0x5b15db[_0x936f('0x54')]=qs[_0x936f('0x55')](_0x41fd9d[_0x936f('0x4c')][_0x936f('0x55')]);_0x5b15db[_0x936f('0x56')]=qs[_0x936f('0x57')](_['pick'](_0x41fd9d['query'],_0x2f1275['filters']),_0x28f866);if(_0x41fd9d[_0x936f('0x4c')][_0x936f('0x58')]){_0x5b15db['where']=_['merge'](_0x5b15db[_0x936f('0x56')],{'$or':_[_0x936f('0x46')](_0x28f866,function(_0x2e4931){if(_0x2e4931[_0x936f('0x4a')]!=='VIRTUAL'){var _0x2a7870={};_0x2a7870[_0x2e4931['name']]={'$like':'%'+_0x41fd9d[_0x936f('0x4c')][_0x936f('0x58')]+'%'};return _0x2a7870;}})});}_0x5b15db=_[_0x936f('0x59')]({},_0x5b15db,_0x41fd9d[_0x936f('0x5a')]);var _0x46d474={'where':_0x5b15db[_0x936f('0x56')]};return db[_0x936f('0x47')][_0x936f('0x37')](_0x46d474)[_0x936f('0x25')](function(_0x430075){_0x30e66d[_0x936f('0x37')]=_0x430075;if(_0x41fd9d[_0x936f('0x4c')]['includeAll']){_0x5b15db[_0x936f('0x5b')]=[{'all':!![]}];}return db[_0x936f('0x47')][_0x936f('0x5c')](_0x5b15db);})[_0x936f('0x25')](function(_0x569743){_0x30e66d[_0x936f('0x5d')]=_0x569743;return _0x30e66d;})[_0x936f('0x25')](respondWithFilteredResult(_0x11568e,_0x5b15db))['catch'](handleError(_0x11568e,null));};exports[_0x936f('0x5e')]=function(_0x1e2cc6,_0x1fb937){var _0x2958b5={'raw':![],'where':{'id':_0x1e2cc6[_0x936f('0x5f')]['id']},'include':[{'model':db[_0x936f('0x45')],'as':'mandatoryDispositionPause'}]},_0x2eaab4={};_0x2eaab4[_0x936f('0x4f')]=_['keys'](db[_0x936f('0x47')][_0x936f('0x48')]);_0x2eaab4[_0x936f('0x4c')]=_[_0x936f('0x4d')](_0x1e2cc6['query']);_0x2eaab4['filters']=_[_0x936f('0x4e')](_0x2eaab4[_0x936f('0x4f')],_0x2eaab4['query']);_0x2958b5[_0x936f('0x51')]=_[_0x936f('0x4e')](_0x2eaab4[_0x936f('0x4f')],qs[_0x936f('0x50')](_0x1e2cc6[_0x936f('0x4c')][_0x936f('0x50')]));_0x2958b5[_0x936f('0x51')]=_0x2958b5[_0x936f('0x51')][_0x936f('0x52')]?_0x2958b5[_0x936f('0x51')]:_0x2eaab4[_0x936f('0x4f')];if(_0x1e2cc6[_0x936f('0x4c')]['includeAll']){_0x2958b5[_0x936f('0x5b')]=[{'all':!![]}];}_0x2958b5=_[_0x936f('0x59')]({},_0x2958b5,_0x1e2cc6[_0x936f('0x5a')]);return db[_0x936f('0x47')][_0x936f('0x60')](_0x2958b5)['then'](handleEntityNotFound(_0x1fb937,null))[_0x936f('0x25')](respondWithResult(_0x1fb937,null))[_0x936f('0x30')](handleError(_0x1fb937,null));};exports[_0x936f('0x61')]=function(_0x4bc3fc,_0x239dd1){return db[_0x936f('0x47')][_0x936f('0x61')](_0x4bc3fc[_0x936f('0x62')],{})[_0x936f('0x25')](function(_0x2504b6){var _0x414e27=_0x4bc3fc[_0x936f('0x63')]['get']({'plain':!![]});if(!_0x414e27)throw new Error(_0x936f('0x64'));if(_0x414e27[_0x936f('0x65')]==='user'){var _0x571a36=_0x2504b6[_0x936f('0x3e')]({'plain':!![]});var _0x128eb6=_0x936f('0x3f');return db['UserProfileSection'][_0x936f('0x60')]({'where':{'name':_0x128eb6,'userProfileId':_0x414e27[_0x936f('0x66')]},'raw':!![]})[_0x936f('0x25')](function(_0x2861f0){if(_0x2861f0&&_0x2861f0[_0x936f('0x67')]===0x0){return db[_0x936f('0x40')][_0x936f('0x61')]({'name':_0x571a36['name'],'resourceId':_0x571a36['id'],'type':_0x2861f0['name'],'sectionId':_0x2861f0['id']},{})['then'](function(){return _0x2504b6;});}else{return _0x2504b6;}})['catch'](function(_0x55f795){logger[_0x936f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55f795);throw _0x55f795;});}return _0x2504b6;})[_0x936f('0x25')](respondWithResult(_0x239dd1,0xc9))[_0x936f('0x30')](handleError(_0x239dd1,null));};exports[_0x936f('0x3c')]=function(_0x4c0c77,_0x217411){if(_0x4c0c77['body']['id']){delete _0x4c0c77[_0x936f('0x62')]['id'];}return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x4c0c77[_0x936f('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x936f('0x68')}]})[_0x936f('0x25')](handleEntityNotFound(_0x217411,null))[_0x936f('0x25')](saveUpdates(_0x4c0c77['body'],null))[_0x936f('0x25')](respondWithResult(_0x217411,null))[_0x936f('0x30')](handleError(_0x217411,null));};exports['destroy']=function(_0x2a3879,_0x18538b){return db['WhatsappAccount'][_0x936f('0x60')]({'where':{'id':_0x2a3879[_0x936f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x18538b,null))[_0x936f('0x25')](removeEntity(_0x18538b,null))[_0x936f('0x30')](handleError(_0x18538b,null));};exports[_0x936f('0x69')]=function(_0x3116b8,_0x4acd3e){return db[_0x936f('0x47')][_0x936f('0x69')]()[_0x936f('0x25')](respondWithResult(_0x4acd3e,null))[_0x936f('0x30')](handleError(_0x4acd3e,null));};exports['addDisposition']=function(_0x4c85f9,_0x5d024b,_0x2f7af8){if(_0x4c85f9[_0x936f('0x62')]['id']){delete _0x4c85f9[_0x936f('0x62')]['id'];}return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x4c85f9[_0x936f('0x5f')]['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x5d024b,null))[_0x936f('0x25')](function(_0x40ae69){if(_0x40ae69){_0x4c85f9['body'][_0x936f('0x6a')]=_0x40ae69['id'];return db[_0x936f('0x6b')][_0x936f('0x61')](_0x4c85f9['body']);}})[_0x936f('0x25')](respondWithResult(_0x5d024b,null))[_0x936f('0x30')](handleError(_0x5d024b,null));};exports['getDispositions']=function(_0xf28b2c,_0xcafb63,_0x1133d9){var _0x16f285={'raw':![],'where':{}};var _0x16b831={};var _0x4dc872={'count':0x0,'rows':[]};return db[_0x936f('0x47')][_0x936f('0x6c')]({'where':{'id':_0xf28b2c['params']['id']}})[_0x936f('0x25')](handleEntityNotFound(_0xcafb63,null))[_0x936f('0x25')](function(_0x519287){if(_0x519287){_0x16b831[_0x936f('0x4f')]=_[_0x936f('0x4d')](db[_0x936f('0x6b')][_0x936f('0x48')]);_0x16b831[_0x936f('0x4c')]=_[_0x936f('0x4d')](_0xf28b2c['query']);_0x16b831[_0x936f('0x57')]=_[_0x936f('0x4e')](_0x16b831[_0x936f('0x4f')],_0x16b831['query']);_0x16f285[_0x936f('0x51')]=_[_0x936f('0x4e')](_0x16b831[_0x936f('0x4f')],qs['fields'](_0xf28b2c[_0x936f('0x4c')][_0x936f('0x50')]));_0x16f285[_0x936f('0x51')]=_0x16f285[_0x936f('0x51')][_0x936f('0x52')]?_0x16f285[_0x936f('0x51')]:_0x16b831[_0x936f('0x4f')];if(!_0xf28b2c[_0x936f('0x4c')][_0x936f('0x6d')]('nolimit')){_0x16f285[_0x936f('0x36')]=qs[_0x936f('0x36')](_0xf28b2c[_0x936f('0x4c')][_0x936f('0x36')]);_0x16f285[_0x936f('0x34')]=qs[_0x936f('0x34')](_0xf28b2c[_0x936f('0x4c')][_0x936f('0x34')]);}_0x16f285['order']=qs[_0x936f('0x55')](_0xf28b2c['query'][_0x936f('0x55')]);_0x16f285[_0x936f('0x56')]=qs['filters'](_[_0x936f('0x6e')](_0xf28b2c[_0x936f('0x4c')],_0x16b831[_0x936f('0x57')]));_0x16f285['where'][_0x936f('0x6a')]=_0x519287['id'];if(_0xf28b2c[_0x936f('0x4c')][_0x936f('0x58')]){_0x16f285[_0x936f('0x56')]=_[_0x936f('0x59')](_0x16f285['where'],{'$or':_['map'](_0x16f285[_0x936f('0x51')],function(_0x3dbc36){var _0xd708af={};_0xd708af[_0x3dbc36]={'$like':'%'+_0xf28b2c['query']['filter']+'%'};return _0xd708af;})});}_0x16f285=_[_0x936f('0x59')]({},_0x16f285,_0xf28b2c[_0x936f('0x5a')]);return db[_0x936f('0x6b')][_0x936f('0x37')]({'where':_0x16f285[_0x936f('0x56')]})[_0x936f('0x25')](function(_0x1c5867){_0x4dc872[_0x936f('0x37')]=_0x1c5867;if(_0xf28b2c['query']['includeAll']){_0x16f285['include']=[{'all':!![]}];}return db[_0x936f('0x6b')][_0x936f('0x5c')](_0x16f285);})[_0x936f('0x25')](function(_0x348b3d){_0x4dc872[_0x936f('0x5d')]=_0x348b3d;return _0x4dc872;});}})['then'](respondWithFilteredResult(_0xcafb63,_0x16f285))[_0x936f('0x30')](handleError(_0xcafb63,null));};exports[_0x936f('0x6f')]=function(_0x208b8b,_0x405a2f,_0xeb0b3b){return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x208b8b[_0x936f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x405a2f,null))[_0x936f('0x25')](function(_0x4ab834){if(_0x4ab834){return _0x4ab834[_0x936f('0x6f')](_0x208b8b[_0x936f('0x4c')][_0x936f('0x70')]);}})[_0x936f('0x25')](respondWithStatusCode(_0x405a2f,null))[_0x936f('0x30')](handleError(_0x405a2f,null));};exports[_0x936f('0x71')]=function(_0x26f5ea,_0x4756c8,_0x253ef8){if(_0x26f5ea[_0x936f('0x62')]['id']){delete _0x26f5ea[_0x936f('0x62')]['id'];}return db[_0x936f('0x47')]['find']({'where':{'id':_0x26f5ea['params']['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x4756c8,null))[_0x936f('0x25')](function(_0x50f8db){if(_0x50f8db){_0x26f5ea[_0x936f('0x62')]['WhatsappAccountId']=_0x50f8db['id'];return db[_0x936f('0x72')]['create'](_0x26f5ea[_0x936f('0x62')]);}})[_0x936f('0x25')](respondWithResult(_0x4756c8,null))[_0x936f('0x30')](handleError(_0x4756c8,null));};exports[_0x936f('0x73')]=function(_0x2a7eca,_0x2d14e3,_0x114985){var _0x43af43={'raw':![],'where':{}};var _0x53b321={};var _0x58a005={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x936f('0x6c')]({'where':{'id':_0x2a7eca[_0x936f('0x5f')]['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x2d14e3,null))[_0x936f('0x25')](function(_0x2932d0){if(_0x2932d0){_0x53b321[_0x936f('0x4f')]=_[_0x936f('0x4d')](db[_0x936f('0x72')][_0x936f('0x48')]);_0x53b321[_0x936f('0x4c')]=_[_0x936f('0x4d')](_0x2a7eca[_0x936f('0x4c')]);_0x53b321[_0x936f('0x57')]=_[_0x936f('0x4e')](_0x53b321[_0x936f('0x4f')],_0x53b321['query']);_0x43af43['attributes']=_[_0x936f('0x4e')](_0x53b321[_0x936f('0x4f')],qs[_0x936f('0x50')](_0x2a7eca[_0x936f('0x4c')][_0x936f('0x50')]));_0x43af43[_0x936f('0x51')]=_0x43af43[_0x936f('0x51')][_0x936f('0x52')]?_0x43af43[_0x936f('0x51')]:_0x53b321[_0x936f('0x4f')];if(!_0x2a7eca[_0x936f('0x4c')][_0x936f('0x6d')](_0x936f('0x53'))){_0x43af43[_0x936f('0x36')]=qs[_0x936f('0x36')](_0x2a7eca[_0x936f('0x4c')][_0x936f('0x36')]);_0x43af43[_0x936f('0x34')]=qs[_0x936f('0x34')](_0x2a7eca[_0x936f('0x4c')][_0x936f('0x34')]);}_0x43af43[_0x936f('0x54')]=qs['sort'](_0x2a7eca['query'][_0x936f('0x55')]);_0x43af43[_0x936f('0x56')]=qs[_0x936f('0x57')](_[_0x936f('0x6e')](_0x2a7eca[_0x936f('0x4c')],_0x53b321['filters']));_0x43af43[_0x936f('0x56')][_0x936f('0x6a')]=_0x2932d0['id'];if(_0x2a7eca['query']['filter']){_0x43af43[_0x936f('0x56')]=_[_0x936f('0x59')](_0x43af43['where'],{'$or':_[_0x936f('0x46')](_0x43af43[_0x936f('0x51')],function(_0x85c740){var _0x19ea3d={};_0x19ea3d[_0x85c740]={'$like':'%'+_0x2a7eca[_0x936f('0x4c')][_0x936f('0x58')]+'%'};return _0x19ea3d;})});}_0x43af43=_['merge']({},_0x43af43,_0x2a7eca[_0x936f('0x5a')]);return db[_0x936f('0x72')][_0x936f('0x37')]({'where':_0x43af43[_0x936f('0x56')]})['then'](function(_0x32a87a){_0x58a005[_0x936f('0x37')]=_0x32a87a;if(_0x2a7eca[_0x936f('0x4c')][_0x936f('0x74')]){_0x43af43[_0x936f('0x5b')]=[{'all':!![]}];}return db[_0x936f('0x72')][_0x936f('0x5c')](_0x43af43);})['then'](function(_0x1e18a5){_0x58a005[_0x936f('0x5d')]=_0x1e18a5;return _0x58a005;});}})['then'](respondWithFilteredResult(_0x2d14e3,_0x43af43))['catch'](handleError(_0x2d14e3,null));};exports[_0x936f('0x75')]=function(_0x1254fd,_0x4cd040,_0x32961d){return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x1254fd['params']['id']}})['then'](handleEntityNotFound(_0x4cd040,null))[_0x936f('0x25')](function(_0x13848e){if(_0x13848e){return _0x13848e[_0x936f('0x75')](_0x1254fd[_0x936f('0x4c')][_0x936f('0x70')]);}})[_0x936f('0x25')](respondWithStatusCode(_0x4cd040,null))[_0x936f('0x30')](handleError(_0x4cd040,null));};exports[_0x936f('0x76')]=function(_0x38abc4,_0x362c46,_0x12e53){return db['WhatsappAccount']['find']({'where':{'id':_0x38abc4[_0x936f('0x5f')]['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x362c46,null))[_0x936f('0x25')](function(_0x533ea8){if(_0x533ea8){return _0x533ea8[_0x936f('0x76')](_0x38abc4[_0x936f('0x62')][_0x936f('0x70')],_[_0x936f('0x77')](_0x38abc4[_0x936f('0x62')],[_0x936f('0x70'),'id'])||{})[_0x936f('0x78')](function(_0x27d3e2){for(var _0x1f533c=0x0;_0x1f533c<_0x38abc4[_0x936f('0x62')]['ids'][_0x936f('0x52')];_0x1f533c+=0x1){socket[_0x936f('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x38abc4[_0x936f('0x62')][_0x936f('0x70')][_0x1f533c]),'WhatsappAccountId':Number(_0x38abc4[_0x936f('0x5f')]['id'])});}return _0x27d3e2;});}})[_0x936f('0x25')](respondWithResult(_0x362c46,null))[_0x936f('0x30')](handleError(_0x362c46,null));};exports[_0x936f('0x7a')]=function(_0x29d9ae,_0x356f8b,_0x456320){return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x29d9ae[_0x936f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x356f8b,null))['then'](function(_0x44a9d1){if(_0x44a9d1){return _0x44a9d1[_0x936f('0x7a')](_0x29d9ae[_0x936f('0x4c')][_0x936f('0x70')])['then'](function(){if(_[_0x936f('0x7b')](_0x29d9ae['query'][_0x936f('0x70')])){for(var _0x4564ac=0x0;_0x4564ac<_0x29d9ae['query']['ids'][_0x936f('0x52')];_0x4564ac+=0x1){socket[_0x936f('0x79')](_0x936f('0x7c'),{'UserId':Number(_0x29d9ae[_0x936f('0x4c')][_0x936f('0x70')][_0x4564ac]),'WhatsappAccountId':Number(_0x29d9ae[_0x936f('0x5f')]['id'])});}}else{socket[_0x936f('0x79')](_0x936f('0x7c'),{'UserId':Number(_0x29d9ae[_0x936f('0x4c')][_0x936f('0x70')]),'WhatsappAccountId':Number(_0x29d9ae[_0x936f('0x5f')]['id'])});}});}})[_0x936f('0x25')](respondWithStatusCode(_0x356f8b,null))[_0x936f('0x30')](handleError(_0x356f8b,null));};exports[_0x936f('0x7d')]=function(_0xa7e99b,_0x476fe8,_0x193a58){var _0x44bbe3={};var _0x5b313f={};var _0x6ed7f6;var _0x107e07;return db[_0x936f('0x47')]['findOne']({'where':{'id':_0xa7e99b['params']['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x476fe8,null))[_0x936f('0x25')](function(_0x37ae67){if(_0x37ae67){_0x6ed7f6=_0x37ae67;_0x5b313f[_0x936f('0x4f')]=_[_0x936f('0x4d')](db['User'][_0x936f('0x48')]);_0x5b313f[_0x936f('0x4c')]=_[_0x936f('0x4d')](_0xa7e99b[_0x936f('0x4c')]);_0x5b313f[_0x936f('0x57')]=_['intersection'](_0x5b313f[_0x936f('0x4f')],_0x5b313f[_0x936f('0x4c')]);_0x44bbe3[_0x936f('0x51')]=_[_0x936f('0x4e')](_0x5b313f['model'],qs[_0x936f('0x50')](_0xa7e99b[_0x936f('0x4c')][_0x936f('0x50')]));_0x44bbe3[_0x936f('0x51')]=_0x44bbe3['attributes'][_0x936f('0x52')]?_0x44bbe3['attributes']:_0x5b313f['model'];_0x44bbe3[_0x936f('0x54')]=qs[_0x936f('0x55')](_0xa7e99b['query'][_0x936f('0x55')]);_0x44bbe3[_0x936f('0x56')]=qs[_0x936f('0x57')](_['pick'](_0xa7e99b['query'],_0x5b313f[_0x936f('0x57')]));if(_0xa7e99b['query'][_0x936f('0x58')]){_0x44bbe3[_0x936f('0x56')]=_[_0x936f('0x59')](_0x44bbe3[_0x936f('0x56')],{'$or':_[_0x936f('0x46')](_0x44bbe3[_0x936f('0x51')],function(_0xe8bac3){var _0x3e0e7a={};_0x3e0e7a[_0xe8bac3]={'$like':'%'+_0xa7e99b['query'][_0x936f('0x58')]+'%'};return _0x3e0e7a;})});}_0x44bbe3=_['merge']({},_0x44bbe3,_0xa7e99b[_0x936f('0x5a')]);return _0x6ed7f6[_0x936f('0x7d')](_0x44bbe3);}})[_0x936f('0x25')](function(_0x5d2580){if(_0x5d2580){_0x107e07=_0x5d2580['length'];if(!_0xa7e99b[_0x936f('0x4c')]['hasOwnProperty'](_0x936f('0x53'))){_0x44bbe3[_0x936f('0x36')]=qs[_0x936f('0x36')](_0xa7e99b['query']['limit']);_0x44bbe3[_0x936f('0x34')]=qs[_0x936f('0x34')](_0xa7e99b[_0x936f('0x4c')]['offset']);}return _0x6ed7f6[_0x936f('0x7d')](_0x44bbe3);}})[_0x936f('0x25')](function(_0x15e2ec){if(_0x15e2ec){return _0x15e2ec?{'count':_0x107e07,'rows':_0x15e2ec}:null;}})[_0x936f('0x25')](respondWithResult(_0x476fe8,null))[_0x936f('0x30')](handleError(_0x476fe8,null));};exports[_0x936f('0x7e')]=function(_0x482ba3,_0x3d018d){var _0x3b3fa8=_0x482ba3['params']['id'];var _0x447796=_0x482ba3[_0x936f('0x62')];var _0x433e1d=0xc8;var _0x5624be=null;return db['sequelize'][_0x936f('0x7f')]({'isolationLevel':db[_0x936f('0x80')]['Transaction'][_0x936f('0x81')]['READ_COMMITTED']},function(_0xe2f08c){return db[_0x936f('0x47')][_0x936f('0x6c')]({'where':{'id':_0x3b3fa8},'transaction':_0xe2f08c})[_0x936f('0x25')](function(_0x1e21d1){if(_0x1e21d1){return db[_0x936f('0x82')][_0x936f('0x3d')]({'where':{'WhatsappAccountId':_0x3b3fa8},'transaction':_0xe2f08c})['then'](function(){var _0x53f50b=_[_0x936f('0x46')](_0x447796,function(_0x2b5208){_0x2b5208[_0x936f('0x6a')]=_0x3b3fa8;return _0x2b5208;});return db[_0x936f('0x82')][_0x936f('0x83')](_0x53f50b,{'transaction':_0xe2f08c});});}else{_0x433e1d=0x194;_0x5624be=[];}});})[_0x936f('0x25')](function(){if(_0x433e1d!==0x194){return db[_0x936f('0x82')][_0x936f('0x84')]({'where':{'WhatsappAccountId':_0x3b3fa8},'order':'priority'})['then'](function(_0x46f4c5){_0x5624be=_0x46f4c5;});}})[_0x936f('0x30')](function(_0x340d44){_0x433e1d=0x1f4;logger[_0x936f('0x2c')](_0x340d44['stack']);if(_0x340d44['name']){delete _0x340d44['name'];}_0x5624be=_0x340d44;})[_0x936f('0x85')](function(){if(_0x5624be===null){_0x3d018d[_0x936f('0x31')](_0x433e1d);}else{if(_0x433e1d===0x1f4){_0x3d018d[_0x936f('0x32')](_0x433e1d)[_0x936f('0x43')](_0x5624be);}else{_0x3d018d[_0x936f('0x32')](_0x433e1d)[_0x936f('0x33')](_0x5624be);}}});};exports['getApplications']=function(_0x172ac3,_0x4e527f,_0x5a06d4){var _0x47e8a4={};var _0x3eb562={};var _0x180ba9;var _0x4b7108;return db[_0x936f('0x47')]['findOne']({'where':{'id':_0x172ac3[_0x936f('0x5f')]['id']}})[_0x936f('0x25')](handleEntityNotFound(_0x4e527f,null))[_0x936f('0x25')](function(_0x35a3d2){if(_0x35a3d2){_0x180ba9=_0x35a3d2;_0x3eb562[_0x936f('0x4f')]=_[_0x936f('0x4d')](db['WhatsappApplication'][_0x936f('0x48')]);_0x3eb562['query']=_[_0x936f('0x4d')](_0x172ac3['query']);_0x3eb562[_0x936f('0x57')]=_[_0x936f('0x4e')](_0x3eb562['model'],_0x3eb562['query']);_0x47e8a4['attributes']=_[_0x936f('0x4e')](_0x3eb562[_0x936f('0x4f')],qs[_0x936f('0x50')](_0x172ac3[_0x936f('0x4c')][_0x936f('0x50')]));_0x47e8a4[_0x936f('0x51')]=_0x47e8a4['attributes'][_0x936f('0x52')]?_0x47e8a4[_0x936f('0x51')]:_0x3eb562[_0x936f('0x4f')];_0x47e8a4[_0x936f('0x54')]=qs[_0x936f('0x55')](_0x172ac3['query'][_0x936f('0x55')]);_0x47e8a4[_0x936f('0x56')]=qs[_0x936f('0x57')](_['pick'](_0x172ac3['query'],_0x3eb562[_0x936f('0x57')]));if(_0x172ac3[_0x936f('0x4c')][_0x936f('0x58')]){_0x47e8a4[_0x936f('0x56')]=_['merge'](_0x47e8a4['where'],{'$or':_['map'](_0x47e8a4['attributes'],function(_0x148dbe){var _0x19296={};_0x19296[_0x148dbe]={'$like':'%'+_0x172ac3[_0x936f('0x4c')][_0x936f('0x58')]+'%'};return _0x19296;})});}_0x47e8a4=_[_0x936f('0x59')]({},_0x47e8a4,_0x172ac3[_0x936f('0x5a')]);return _0x180ba9[_0x936f('0x86')](_0x47e8a4);}})['then'](function(_0x127632){if(_0x127632){_0x4b7108=_0x127632[_0x936f('0x52')];if(!_0x172ac3['query'][_0x936f('0x6d')]('nolimit')){_0x47e8a4[_0x936f('0x36')]=qs[_0x936f('0x36')](_0x172ac3['query'][_0x936f('0x36')]);_0x47e8a4['offset']=qs[_0x936f('0x34')](_0x172ac3[_0x936f('0x4c')]['offset']);}return _0x180ba9[_0x936f('0x86')](_0x47e8a4);}})[_0x936f('0x25')](function(_0xb82a0b){if(_0xb82a0b){return _0xb82a0b?{'count':_0x4b7108,'rows':_0xb82a0b}:null;}})[_0x936f('0x25')](respondWithResult(_0x4e527f,null))[_0x936f('0x30')](handleError(_0x4e527f,null));};exports[_0x936f('0x87')]=function(_0x2d9025,_0x47bffd,_0x2d653f){var _0x4fd90d={'channel':_0x936f('0x88')};var _0x55cb52=[];var _0x145717=[];var _0x52deb7={};return db[_0x936f('0x47')][_0x936f('0x60')]({'where':{'id':_0x2d9025[_0x936f('0x5f')]['id']},'include':[{'model':db[_0x936f('0x82')],'as':_0x936f('0x89')}]})[_0x936f('0x25')](handleEntityNotFound(_0x47bffd,null))[_0x936f('0x25')](function(_0x16cac8){_0x4fd90d[_0x936f('0x8a')]=_0x16cac8;if(_0x4fd90d['account']&&_0x4fd90d[_0x936f('0x8a')][_0x936f('0x4a')]==='sinch'&&_0x2d9025[_0x936f('0x62')][_0x936f('0x8b')]){if(_0x2d9025['body'][_0x936f('0x8b')][_0x936f('0x52')]===0x0)return;if(_0x2d9025[_0x936f('0x62')][_0x936f('0x8b')][0x0][_0x936f('0x8c')]!=='read')return;return db[_0x936f('0x8d')]['update']({'read':!![],'readAt':_0x2d9025[_0x936f('0x62')][_0x936f('0x8b')][0x0][_0x936f('0x8e')]},{'where':{'messageId':_0x2d9025[_0x936f('0x62')][_0x936f('0x8b')][0x0]['message_id']},'individualHooks':!![]})[_0x936f('0x25')](function(_0x3ab466){return _0x47bffd[_0x936f('0x32')](0xc8)['json'](_0x3ab466);});}_0x4fd90d[_0x936f('0x8f')]=_[_0x936f('0x90')](_0x16cac8[_0x936f('0x89')],[_0x936f('0x91')],[_0x936f('0x92')]);if(_0x4fd90d[_0x936f('0x8a')][_0x936f('0x89')]){delete _0x4fd90d['account'][_0x936f('0x89')];}return db['CmContact'][_0x936f('0x69')]()[_0x936f('0x25')](function(_0x1d8030){if(!_0x1d8030){throw new db[(_0x936f('0x93'))][(_0x936f('0x94'))]('no\x20available\x20attributes');}_0x55cb52=_['difference'](_[_0x936f('0x4d')](_0x1d8030),[_0x936f('0x95'),_0x936f('0x96')]);_0x145717=_[_0x936f('0x97')](_['keys'](_0x1d8030),[_0x936f('0x95'),_0x936f('0x96'),_0x936f('0x98'),_0x936f('0x99')]);_0x4fd90d['body']={'mapKey':'mobile'};if(_0x4fd90d[_0x936f('0x8a')]&&_0x4fd90d[_0x936f('0x8a')]['type']==='twilio'){_0x4fd90d['body'][_0x936f('0x9a')]=_0x2d9025[_0x936f('0x62')]['From'][_0x936f('0x9b')]('whatsapp:','');_0x4fd90d[_0x936f('0x62')][_0x936f('0x62')]=_0x2d9025[_0x936f('0x62')][_0x936f('0x9c')];_0x4fd90d[_0x936f('0x62')][_0x936f('0x9d')]=_0x2d9025[_0x936f('0x62')][_0x936f('0x9e')];}if(_0x4fd90d[_0x936f('0x8a')]&&_0x4fd90d['account']['type']===_0x936f('0x9f')){_0x4fd90d[_0x936f('0x62')][_0x936f('0x9a')]=_0x2d9025[_0x936f('0x62')][_0x936f('0xa0')][0x0]['from'];_0x4fd90d['body'][_0x936f('0x62')]=_0x2d9025[_0x936f('0x62')][_0x936f('0xa0')][0x0][_0x936f('0x2e')][_0x936f('0x62')];_0x4fd90d['body'][_0x936f('0x9d')]=_0x2d9025[_0x936f('0x62')][_0x936f('0xa0')][0x0][_0x936f('0xa1')];}if(_0x4fd90d[_0x936f('0x62')]['id']){delete _0x4fd90d[_0x936f('0x62')]['id'];}if(_[_0x936f('0xa2')](_0x4fd90d['body'][_0x936f('0x9a')])){throw new db['Sequelize'][(_0x936f('0x94'))](_0x936f('0xa3'));}if(_[_0x936f('0xa2')](_0x4fd90d[_0x936f('0x62')][_0x936f('0x62')])||_0x4fd90d['body'][_0x936f('0x62')]===''){throw new db[(_0x936f('0x93'))][(_0x936f('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x936f('0xa2')](_0x4fd90d[_0x936f('0x62')]['mapKey'])){throw new db[(_0x936f('0x93'))][(_0x936f('0x94'))](_0x936f('0xa4')+_0x145717);}if(!_[_0x936f('0xa5')](_0x145717,_0x4fd90d[_0x936f('0x62')][_0x936f('0xa6')])){throw new db[(_0x936f('0x93'))][(_0x936f('0x94'))](_0x936f('0xa7')+_0x145717);}_0x52deb7[_0x4fd90d[_0x936f('0x62')][_0x936f('0xa6')]]=_0x4fd90d[_0x936f('0x62')][_0x936f('0x9a')];return db[_0x936f('0xa8')][_0x936f('0x60')]({'where':{'id':_0x4fd90d[_0x936f('0x8a')][_0x936f('0x99')]},'include':[{'model':db[_0x936f('0xa9')],'as':_0x936f('0xaa'),'where':_0x52deb7,'limit':0x1,'order':[[_0x936f('0x96'),_0x936f('0xab')]]}]});})[_0x936f('0x25')](handleEntityNotFound(_0x47bffd,null))['then'](function(_0x13bab9){if(_0x13bab9){_0x4fd90d['list']=_['omit'](_0x13bab9,['Contacts']);if(_0x13bab9['Contacts'][_0x936f('0x52')]){return _0x13bab9[_0x936f('0xaa')][0x0];}var _0x15803c=_[_0x936f('0x1d')](_0x4fd90d[_0x936f('0x62')],{'firstName':_0x4fd90d[_0x936f('0x62')]['from'],'ListId':_0x13bab9['id']});_0x15803c[_0x4fd90d[_0x936f('0x62')][_0x936f('0xa6')]]=_0x4fd90d[_0x936f('0x62')][_0x936f('0x9a')];return db['CmContact'][_0x936f('0x61')](_0x15803c,{'fields':_0x55cb52,'raw':!![]});}})[_0x936f('0x25')](handleEntityNotFound(_0x47bffd,null))['then'](function(_0x3c1dd8){if(_0x3c1dd8){_0x4fd90d[_0x936f('0xac')]=_0x3c1dd8;var _0x379b87={'ContactId':_0x3c1dd8['id'],'phone':_0x4fd90d['body']['from'],'WhatsappAccountId':_0x2d9025[_0x936f('0x5f')]['id']};var _0x3bc52c={'ContactId':_0x3c1dd8['id'],'WhatsappAccountId':_0x2d9025[_0x936f('0x5f')]['id'],'closed':![]};return db[_0x936f('0xad')][_0x936f('0x60')]({'where':_0x3bc52c})['then'](function(_0x336969){if(_0x336969){return[_0x336969,![]];}return db[_0x936f('0xad')][_0x936f('0x61')](_0x379b87)['then'](function(_0x2ece55){return[_0x2ece55,!![]];});});}})['spread'](function(_0x515282,_0x1ef1bf){_0x4fd90d[_0x936f('0xae')]=_0x515282[_0x936f('0x3e')]({'plain':!![]});_0x4fd90d[_0x936f('0xae')]['created']=![];if(_0x1ef1bf){if(_0x4fd90d['account']['autoclose']){_0x4fd90d[_0x936f('0x8f')][_0x936f('0xaf')]({'id':0x0,'priority':_0x4fd90d['applications'][_0x936f('0x52')]+0x1,'app':_0x936f('0xb0'),'appdata':_0x936f('0xb1'),'interval':_0x936f('0xb2')});}_0x4fd90d[_0x936f('0xae')]['created']=!![];}return db[_0x936f('0x8d')][_0x936f('0x61')]({'phone':_0x4fd90d[_0x936f('0x62')]['from'],'messageId':_0x4fd90d[_0x936f('0x62')][_0x936f('0x9d')],'body':_0x4fd90d[_0x936f('0x62')]['body'],'WhatsappAccountId':_0x2d9025[_0x936f('0x5f')]['id'],'WhatsappInteractionId':_0x515282['id'],'direction':'in','ContactId':_0x515282[_0x936f('0xb3')],'AttachmentId':_0x4fd90d['body'][_0x936f('0xb4')]});})['then'](function(_0x218b22){_0x4fd90d[_0x936f('0x2e')]=_0x218b22;if(!_0x4fd90d[_0x936f('0xae')][_0x936f('0xb5')])return;return db[_0x936f('0xb6')]['find']({'attributes':['id','name'],'where':{'id':_0x4fd90d[_0x936f('0xae')][_0x936f('0xb5')]}});})['then'](function(_0x50381f){if(_0x50381f){_0x4fd90d[_0x936f('0x8f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x936f('0xb7'),'appdata':_0x50381f['name']+','+(_0x4fd90d[_0x936f('0x8a')][_0x936f('0xb8')]||0xa),'interval':_0x936f('0xb2')});}if(!_0x4fd90d[_0x936f('0xae')][_0x936f('0xb9')])return;return db[_0x936f('0xba')][_0x936f('0x60')]({'attributes':['id',_0x936f('0x42')],'where':{'id':_0x4fd90d[_0x936f('0xae')][_0x936f('0xb9')]}});})[_0x936f('0x25')](function(_0x140c99){if(_0x140c99){_0x4fd90d['applications'][_0x936f('0xbb')]({'id':0x0,'priority':0x1,'app':_0x936f('0xbc'),'appdata':_0x140c99[_0x936f('0x42')]+','+(_0x4fd90d[_0x936f('0x8a')][_0x936f('0xbd')]||0x12c),'interval':_0x936f('0xb2')});}return respondWithRpcPromise(_0x936f('0xbe'),_0x936f('0xbf'),_0x4fd90d);})['then'](function(_0x44581d){if(_0x44581d){var _0x4bb89d=0xc8;var _0x3b1945=_0x936f('0xc0');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3b1945,_0x4bb89d,_0x936f('0xc1'));logger[_0x936f('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3b1945,_0x4bb89d,_0x936f('0xc1'),JSON[_0x936f('0x2b')](_0x44581d));if(_0x4fd90d[_0x936f('0x8a')]['type']===_0x936f('0xc2')){return _0x47bffd[_0x936f('0x32')](_0x4bb89d)[_0x936f('0x38')](_0x936f('0xc3'),'text/xml')[_0x936f('0x43')](_0x936f('0xc4'));}else{return _0x47bffd['status'](_0x4bb89d)[_0x936f('0x33')](_0x44581d);}}});})['catch'](handleError(_0x47bffd,null));};exports['send']=function(_0x4bf321,_0x59834c,_0xaa022){var _0x5198f4,_0x4a723a,_0x1a2290;if(_['isNil'](_0x4bf321[_0x936f('0x62')][_0x936f('0x62')])||_0x4bf321[_0x936f('0x62')][_0x936f('0x62')]===''){throw new db['Sequelize'][(_0x936f('0x94'))](_0x936f('0xc5'));}if(_[_0x936f('0xa2')](_0x4bf321[_0x936f('0x62')]['to'])){throw new db[(_0x936f('0x93'))]['ValidationError'](_0x936f('0xc6'));}_0x5198f4=_0x4bf321[_0x936f('0x62')]['to'];return db['WhatsappAccount'][_0x936f('0x60')]({'where':{'id':_0x4bf321[_0x936f('0x5f')]['id']},'include':[{'model':db[_0x936f('0xa8')],'as':_0x936f('0xc7'),'include':[{'model':db[_0x936f('0xa9')],'as':_0x936f('0xaa'),'where':{'mobile':_0x5198f4},'limit':0x1,'order':[[_0x936f('0x96'),_0x936f('0xab')]]}]}]})['then'](handleEntityNotFound(_0x59834c,null))[_0x936f('0x25')](function(_0x6d2d49){if(_0x6d2d49&&_0x6d2d49[_0x936f('0xc7')]){_0x4a723a=_0x6d2d49[_0x936f('0x3e')]({'plain':!![]});if(_0x4a723a['List']&&_0x4a723a['List']['Contacts'][_0x936f('0x52')]){return _0x4a723a[_0x936f('0xc7')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x936f('0x1d')](_0x4bf321['body'],{'firstName':_0x5198f4,'mobile':_0x5198f4,'phone':_0x5198f4,'ListId':_0x4a723a['ListId']}));}})[_0x936f('0x25')](handleEntityNotFound(_0x59834c,null))[_0x936f('0x25')](function(_0x13e081){if(_0x13e081){_0x1a2290=_0x13e081;return db[_0x936f('0xad')][_0x936f('0x60')]({'where':{'ContactId':_0x1a2290['id'],'closed':![],'WhatsappAccountId':_0x4a723a['id']}})[_0x936f('0x25')](function(_0x2beb47){if(_0x2beb47){return[_0x2beb47,![]];}return db[_0x936f('0xad')][_0x936f('0x61')]({'UserId':_0x4bf321[_0x936f('0x63')]['id'],'ContactId':_0x1a2290['id'],'WhatsappAccountId':_0x4a723a['id'],'phone':_0x5198f4,'firstMsgDirection':_0x936f('0xc8'),'Messages':[_[_0x936f('0x59')](_0x4bf321[_0x936f('0x62')],{'read':![],'body':_0x4bf321[_0x936f('0x62')][_0x936f('0x62')],'phone':_0x5198f4,'WhatsappAccountId':_0x4a723a['id'],'UserId':_0x4bf321['user']['id'],'ContactId':_0x1a2290['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x936f('0x25')](function(_0x57cb75){return[_0x57cb75,!![]];});});}})['spread'](function(_0x39d291,_0x573935){if(_0x573935){return _0x39d291;}return db[_0x936f('0x8d')][_0x936f('0x61')](_['merge'](_0x4bf321['body'],{'read':![],'body':_0x4bf321[_0x936f('0x62')][_0x936f('0x62')],'phone':_0x5198f4,'WhatsappAccountId':_0x4a723a['id'],'WhatsappInteractionId':_0x39d291['id'],'UserId':_0x4bf321[_0x936f('0x63')]['id'],'ContactId':_0x1a2290['id']}))[_0x936f('0x25')](function(_0x43fed6){_0x39d291[_0x936f('0xc9')][_0x936f('0xca')]=[];_0x39d291[_0x936f('0xc9')]['Messages'][_0x936f('0xaf')](_0x43fed6[_0x936f('0xc9')]);return _0x39d291;});})[_0x936f('0x25')](respondWithResult(_0x59834c,null))[_0x936f('0x30')](handleError(_0x59834c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c623008..aff0885 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 _0x7d16=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save'];(function(_0x244f5d,_0x3c98c6){var _0x1a3886=function(_0x2bf049){while(--_0x2bf049){_0x244f5d['push'](_0x244f5d['shift']());}};_0x1a3886(++_0x3c98c6);}(_0x7d16,0x101));var _0x67d1=function(_0x100a33,_0x377f36){_0x100a33=_0x100a33-0x0;var _0x19172d=_0x7d16[_0x100a33];return _0x19172d;};'use strict';var EventEmitter=require(_0x67d1('0x0'));var WhatsappAccount=require(_0x67d1('0x1'))['db'][_0x67d1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x67d1('0x3'),'afterUpdate':'update','afterDestroy':_0x67d1('0x4')};function emitEvent(_0x23b403){return function(_0x5e293c,_0x59cfd4,_0x5afdee){WhatsappAccountEvents['emit'](_0x23b403+':'+_0x5e293c['id'],_0x5e293c);WhatsappAccountEvents[_0x67d1('0x5')](_0x23b403,_0x5e293c);_0x5afdee(null);};}for(var e in events){if(events[_0x67d1('0x6')](e)){var event=events[e];WhatsappAccount[_0x67d1('0x7')](e,emitEvent(event));}}module[_0x67d1('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0381=['exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0381,0x106));var _0x1038=function(_0x1f99f5,_0x1bb5d7){_0x1f99f5=_0x1f99f5-0x0;var _0x5009b5=_0x0381[_0x1f99f5];return _0x5009b5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x1038('0x0'))['db'][_0x1038('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1038('0x2')](0x0);var events={'afterCreate':_0x1038('0x3'),'afterUpdate':'update','afterDestroy':_0x1038('0x4')};function emitEvent(_0x3e9d0e){return function(_0x1e419d,_0xac4224,_0x1a87d9){WhatsappAccountEvents['emit'](_0x3e9d0e+':'+_0x1e419d['id'],_0x1e419d);WhatsappAccountEvents[_0x1038('0x5')](_0x3e9d0e,_0x1e419d);_0x1a87d9(null);};}for(var e in events){if(events[_0x1038('0x6')](e)){var event=events[e];WhatsappAccount[_0x1038('0x7')](e,emitEvent(event));}}module[_0x1038('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2eed95e..39faef3 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 _0x3d3e=['define','WhatsappAccount','whatsapp_accounts','lodash','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x2876a0,_0x5a09e3){var _0x5c4aae=function(_0x499cd2){while(--_0x499cd2){_0x2876a0['push'](_0x2876a0['shift']());}};_0x5c4aae(++_0x5a09e3);}(_0x3d3e,0x8a));var _0xe3d3=function(_0x24d45f,_0xf890c1){_0x24d45f=_0x24d45f-0x0;var _0x43bb07=_0x3d3e[_0x24d45f];return _0x43bb07;};'use strict';var _=require(_0xe3d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe3d3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3d3('0x2'));var rimraf=require(_0xe3d3('0x3'));var config=require('../../config/environment');var attributes=require(_0xe3d3('0x4'));module[_0xe3d3('0x5')]=function(_0xdd7218,_0x1f4282){return _0xdd7218[_0xe3d3('0x6')](_0xe3d3('0x7'),attributes,{'tableName':_0xe3d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x485d=['request-promise','path','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird'];(function(_0x323d5c,_0x2cd18f){var _0x38e83b=function(_0x95f35e){while(--_0x95f35e){_0x323d5c['push'](_0x323d5c['shift']());}};_0x38e83b(++_0x2cd18f);}(_0x485d,0x112));var _0xd485=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x485d[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xd485('0x0'));var util=require(_0xd485('0x1'));var logger=require('../../config/logger')(_0xd485('0x2'));var moment=require(_0xd485('0x3'));var BPromise=require(_0xd485('0x4'));var rp=require(_0xd485('0x5'));var fs=require('fs');var path=require(_0xd485('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x3eb1ae,_0x1d0fc6){return _0x3eb1ae['define'](_0xd485('0x7'),attributes,{'tableName':_0xd485('0x8'),'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 2a67bdd..baa457c 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 _0x5bc9=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request'];(function(_0x155e04,_0x28cd61){var _0x4590d0=function(_0x3f685b){while(--_0x3f685b){_0x155e04['push'](_0x155e04['shift']());}};_0x4590d0(++_0x28cd61);}(_0x5bc9,0x1ac));var _0x95bc=function(_0x591bfb,_0x4b3895){_0x591bfb=_0x591bfb-0x0;var _0xf8811c=_0x5bc9[_0x591bfb];return _0xf8811c;};'use strict';var _=require('lodash');var util=require(_0x95bc('0x0'));var moment=require(_0x95bc('0x1'));var BPromise=require(_0x95bc('0x2'));var rs=require(_0x95bc('0x3'));var fs=require('fs');var Redis=require(_0x95bc('0x4'));var db=require(_0x95bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95bc('0x6'))(_0x95bc('0x7'));var config=require(_0x95bc('0x8'));var jayson=require(_0x95bc('0x9'));var client=jayson[_0x95bc('0xa')]['http']({'port':0x232a});config[_0x95bc('0xb')]=_['defaults'](config['redis'],{'host':_0x95bc('0xc'),'port':0x18eb});var socket=require(_0x95bc('0xd'))(new Redis(config['redis']));require(_0x95bc('0xe'))['register'](socket);function respondWithRpcPromise(_0x562df7,_0x4d2a1d,_0x521425){return new BPromise(function(_0x407785,_0x2e5660){return client[_0x95bc('0xf')](_0x562df7,_0x521425)['then'](function(_0x15e990){logger[_0x95bc('0x10')](_0x95bc('0x11'),_0x4d2a1d,_0x95bc('0x12'));logger[_0x95bc('0x13')](_0x95bc('0x14'),_0x4d2a1d,_0x95bc('0x12'),JSON[_0x95bc('0x15')](_0x15e990));if(_0x15e990[_0x95bc('0x16')]){if(_0x15e990['error'][_0x95bc('0x17')]===0x1f4){logger[_0x95bc('0x16')](_0x95bc('0x11'),_0x4d2a1d,_0x15e990[_0x95bc('0x16')][_0x95bc('0x18')]);return _0x2e5660(_0x15e990[_0x95bc('0x16')]['message']);}logger[_0x95bc('0x16')](_0x95bc('0x11'),_0x4d2a1d,_0x15e990[_0x95bc('0x16')]['message']);return _0x407785(_0x15e990[_0x95bc('0x16')][_0x95bc('0x18')]);}else{logger['info'](_0x95bc('0x11'),_0x4d2a1d,_0x95bc('0x12'));_0x407785(_0x15e990[_0x95bc('0x19')][_0x95bc('0x18')]);}})[_0x95bc('0x1a')](function(_0x213fe5){logger['error'](_0x95bc('0x11'),_0x4d2a1d,_0x213fe5);_0x2e5660(_0x213fe5);});});}exports[_0x95bc('0x1b')]=function(_0x37d219){var _0x3e9648=this;return new Promise(function(_0x18a681,_0x477af1){return db[_0x95bc('0x1c')][_0x95bc('0x1d')]({'raw':_0x37d219[_0x95bc('0x1e')]?_0x37d219[_0x95bc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x37d219['options']?_0x37d219['options'][_0x95bc('0x1f')]||null:null,'attributes':_0x37d219['options']?_0x37d219[_0x95bc('0x1e')][_0x95bc('0x20')]||null:null,'include':_0x37d219['options']?_0x37d219['options'][_0x95bc('0x21')]?_[_0x95bc('0x22')](_0x37d219[_0x95bc('0x1e')][_0x95bc('0x21')],function(_0x11e415){return{'model':db[_0x11e415[_0x95bc('0x23')]],'as':_0x11e415['as'],'attributes':_0x11e415[_0x95bc('0x20')],'include':_0x11e415[_0x95bc('0x21')]?_[_0x95bc('0x22')](_0x11e415[_0x95bc('0x21')],function(_0x584d7b){return{'model':db[_0x584d7b[_0x95bc('0x23')]],'as':_0x584d7b['as'],'attributes':_0x584d7b[_0x95bc('0x20')],'include':_0x584d7b[_0x95bc('0x21')]?_['map'](_0x584d7b['include'],function(_0x368536){return{'model':db[_0x368536[_0x95bc('0x23')]],'as':_0x368536['as'],'attributes':_0x368536[_0x95bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95bc('0x24')](function(_0x5e9779){logger[_0x95bc('0x10')](_0x95bc('0x1b'),_0x37d219);logger[_0x95bc('0x13')]('ShowWhatsappAccount',_0x37d219,JSON[_0x95bc('0x15')](_0x5e9779));_0x18a681(_0x5e9779);})[_0x95bc('0x1a')](function(_0x4af91f){logger[_0x95bc('0x16')](_0x95bc('0x1b'),_0x4af91f[_0x95bc('0x18')],_0x37d219);_0x477af1(_0x3e9648[_0x95bc('0x16')](0x1f4,_0x4af91f['message']));});});}; \ No newline at end of file +var _0x1011=['./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappAccount,\x20%s,\x20%s','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0xe5e858,_0x343d4a){var _0xe60dcf=function(_0x37cc80){while(--_0x37cc80){_0xe5e858['push'](_0xe5e858['shift']());}};_0xe60dcf(++_0x343d4a);}(_0x1011,0x64));var _0x1101=function(_0x22c08b,_0x5ef5f0){_0x22c08b=_0x22c08b-0x0;var _0x439d18=_0x1011[_0x22c08b];return _0x439d18;};'use strict';var _=require(_0x1101('0x0'));var util=require(_0x1101('0x1'));var moment=require(_0x1101('0x2'));var BPromise=require(_0x1101('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1101('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1101('0x5'));var logger=require(_0x1101('0x6'))('rpc');var config=require(_0x1101('0x7'));var jayson=require(_0x1101('0x8'));var client=jayson[_0x1101('0x9')][_0x1101('0xa')]({'port':0x232a});config['redis']=_[_0x1101('0xb')](config[_0x1101('0xc')],{'host':_0x1101('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1101('0xc')]));require(_0x1101('0xe'))[_0x1101('0xf')](socket);function respondWithRpcPromise(_0x529f34,_0x2a026d,_0x23b651){return new BPromise(function(_0x10cc0b,_0x91ea7a){return client[_0x1101('0x10')](_0x529f34,_0x23b651)[_0x1101('0x11')](function(_0x32ffba){logger[_0x1101('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2a026d,_0x1101('0x13'));logger[_0x1101('0x14')](_0x1101('0x15'),_0x2a026d,_0x1101('0x13'),JSON[_0x1101('0x16')](_0x32ffba));if(_0x32ffba['error']){if(_0x32ffba[_0x1101('0x17')][_0x1101('0x18')]===0x1f4){logger[_0x1101('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2a026d,_0x32ffba[_0x1101('0x17')][_0x1101('0x19')]);return _0x91ea7a(_0x32ffba[_0x1101('0x17')][_0x1101('0x19')]);}logger[_0x1101('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2a026d,_0x32ffba[_0x1101('0x17')][_0x1101('0x19')]);return _0x10cc0b(_0x32ffba['error'][_0x1101('0x19')]);}else{logger[_0x1101('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2a026d,_0x1101('0x13'));_0x10cc0b(_0x32ffba[_0x1101('0x1a')][_0x1101('0x19')]);}})['catch'](function(_0x1b36ee){logger[_0x1101('0x17')](_0x1101('0x1b'),_0x2a026d,_0x1b36ee);_0x91ea7a(_0x1b36ee);});});}exports[_0x1101('0x1c')]=function(_0x1d2ae8){var _0x5d3d67=this;return new Promise(function(_0x3fc9dc,_0x2696d2){return db[_0x1101('0x1d')][_0x1101('0x1e')]({'raw':_0x1d2ae8[_0x1101('0x1f')]?_0x1d2ae8['options'][_0x1101('0x20')]===undefined?!![]:![]:!![],'where':_0x1d2ae8[_0x1101('0x1f')]?_0x1d2ae8[_0x1101('0x1f')][_0x1101('0x21')]||null:null,'attributes':_0x1d2ae8[_0x1101('0x1f')]?_0x1d2ae8['options'][_0x1101('0x22')]||null:null,'include':_0x1d2ae8[_0x1101('0x1f')]?_0x1d2ae8[_0x1101('0x1f')]['include']?_['map'](_0x1d2ae8['options'][_0x1101('0x23')],function(_0xb37fc0){return{'model':db[_0xb37fc0[_0x1101('0x24')]],'as':_0xb37fc0['as'],'attributes':_0xb37fc0[_0x1101('0x22')],'include':_0xb37fc0[_0x1101('0x23')]?_[_0x1101('0x25')](_0xb37fc0[_0x1101('0x23')],function(_0x52c73d){return{'model':db[_0x52c73d[_0x1101('0x24')]],'as':_0x52c73d['as'],'attributes':_0x52c73d['attributes'],'include':_0x52c73d[_0x1101('0x23')]?_[_0x1101('0x25')](_0x52c73d[_0x1101('0x23')],function(_0xb8130d){return{'model':db[_0xb8130d['model']],'as':_0xb8130d['as'],'attributes':_0xb8130d[_0x1101('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1101('0x11')](function(_0x3ea3d0){logger['info'](_0x1101('0x1c'),_0x1d2ae8);logger[_0x1101('0x14')]('ShowWhatsappAccount',_0x1d2ae8,JSON[_0x1101('0x16')](_0x3ea3d0));_0x3fc9dc(_0x3ea3d0);})['catch'](function(_0x12f3a5){logger['error'](_0x1101('0x1c'),_0x12f3a5[_0x1101('0x19')],_0x1d2ae8);_0x2696d2(_0x5d3d67[_0x1101('0x17')](0x1f4,_0x12f3a5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 94723fd..c2d0c43 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 _0xf4ee=['length','whatsappAccount:','./whatsappAccount.events','save','update','emit'];(function(_0x47543d,_0xcd7c7d){var _0x392bd4=function(_0x233d4c){while(--_0x233d4c){_0x47543d['push'](_0x47543d['shift']());}};_0x392bd4(++_0xcd7c7d);}(_0xf4ee,0x158));var _0xef4e=function(_0x34fa9f,_0x4e95b8){_0x34fa9f=_0x34fa9f-0x0;var _0x1720c5=_0xf4ee[_0x34fa9f];return _0x1720c5;};'use strict';var WhatsappAccountEvents=require(_0xef4e('0x0'));var events=[_0xef4e('0x1'),'remove',_0xef4e('0x2')];function createListener(_0x58f8a5,_0x29236c){return function(_0x1eddc5){_0x29236c[_0xef4e('0x3')](_0x58f8a5,_0x1eddc5);};}function removeListener(_0x1b6200,_0x27d6e3){return function(){WhatsappAccountEvents['removeListener'](_0x1b6200,_0x27d6e3);};}exports['register']=function(_0x1e7f48){for(var _0x2c8e87=0x0,_0x26541a=events[_0xef4e('0x4')];_0x2c8e87<_0x26541a;_0x2c8e87++){var _0x352bf1=events[_0x2c8e87];var _0x48f028=createListener(_0xef4e('0x5')+_0x352bf1,_0x1e7f48);WhatsappAccountEvents['on'](_0x352bf1,_0x48f028);}}; \ No newline at end of file +var _0xbc52=['remove','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0xbc52,0x76));var _0x2bc5=function(_0x182af1,_0x5b1731){_0x182af1=_0x182af1-0x0;var _0x385957=_0xbc52[_0x182af1];return _0x385957;};'use strict';var WhatsappAccountEvents=require(_0x2bc5('0x0'));var events=['save',_0x2bc5('0x1'),'update'];function createListener(_0x2d819c,_0x3f57d1){return function(_0x9eb888){_0x3f57d1[_0x2bc5('0x2')](_0x2d819c,_0x9eb888);};}function removeListener(_0x3cc189,_0x55e02c){return function(){WhatsappAccountEvents[_0x2bc5('0x3')](_0x3cc189,_0x55e02c);};}exports[_0x2bc5('0x4')]=function(_0x50a2de){for(var _0x384159=0x0,_0x39a31c=events[_0x2bc5('0x5')];_0x384159<_0x39a31c;_0x384159++){var _0x3c9162=events[_0x384159];var _0x2b11eb=createListener(_0x2bc5('0x6')+_0x3c9162,_0x50a2de);WhatsappAccountEvents['on'](_0x3c9162,_0x2b11eb);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cecf0a7..a10bf3d 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 _0x35ba=['create','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x4bf3ef,_0x1f4737){var _0x10b82c=function(_0xbee6c8){while(--_0xbee6c8){_0x4bf3ef['push'](_0x4bf3ef['shift']());}};_0x10b82c(++_0x1f4737);}(_0x35ba,0xcf));var _0xa35b=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x35ba[_0x359377];return _0x8be18a;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require('path');var timeout=require(_0xa35b('0x2'));var express=require(_0xa35b('0x3'));var router=express[_0xa35b('0x4')]();var fs_extra=require(_0xa35b('0x5'));var auth=require(_0xa35b('0x6'));var interaction=require(_0xa35b('0x7'));var config=require(_0xa35b('0x8'));var controller=require('./whatsappApplication.controller');router[_0xa35b('0x9')]('/',auth[_0xa35b('0xa')](),controller[_0xa35b('0xb')]);router['get'](_0xa35b('0xc'),auth[_0xa35b('0xa')](),controller['show']);router[_0xa35b('0xd')]('/',auth['isAuthenticated'](),controller[_0xa35b('0xe')]);router[_0xa35b('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa35b('0xc'),auth[_0xa35b('0xa')](),controller['destroy']);module[_0xa35b('0x10')]=router; \ No newline at end of file +var _0x2d7d=['../../components/auth/service','../../config/environment','./whatsappApplication.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x10b19c,_0x52843f){var _0x436828=function(_0x58caba){while(--_0x58caba){_0x10b19c['push'](_0x10b19c['shift']());}};_0x436828(++_0x52843f);}(_0x2d7d,0x1d6));var _0xd2d7=function(_0x5d9e79,_0x31ba07){_0x5d9e79=_0x5d9e79-0x0;var _0x370e2f=_0x2d7d[_0x5d9e79];return _0x370e2f;};'use strict';var multer=require(_0xd2d7('0x0'));var util=require(_0xd2d7('0x1'));var path=require(_0xd2d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd2d7('0x3')]();var fs_extra=require(_0xd2d7('0x4'));var auth=require(_0xd2d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd2d7('0x6'));var controller=require(_0xd2d7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2d7('0x8')]);router[_0xd2d7('0x9')](_0xd2d7('0xa'),auth[_0xd2d7('0xb')](),controller[_0xd2d7('0xc')]);router['post']('/',auth[_0xd2d7('0xb')](),controller[_0xd2d7('0xd')]);router[_0xd2d7('0xe')](_0xd2d7('0xa'),auth[_0xd2d7('0xb')](),controller[_0xd2d7('0xf')]);router[_0xd2d7('0x10')](_0xd2d7('0xa'),auth['isAuthenticated'](),controller[_0xd2d7('0x11')]);module[_0xd2d7('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 a9c7a71..0a2738a 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 _0x2eac=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x311a67,_0x1956c1){var _0x107631=function(_0x15edd9){while(--_0x15edd9){_0x311a67['push'](_0x311a67['shift']());}};_0x107631(++_0x1956c1);}(_0x2eac,0x19f));var _0xc2ea=function(_0x177151,_0x432d3a){_0x177151=_0x177151-0x0;var _0x2bbf15=_0x2eac[_0x177151];return _0x2bbf15;};'use strict';var Sequelize=require('sequelize');module[_0xc2ea('0x0')]={'priority':{'type':Sequelize[_0xc2ea('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc2ea('0x2')],'allowNull':![],'defaultValue':_0xc2ea('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc2ea('0x2')]},'interval':{'type':Sequelize[_0xc2ea('0x2')],'defaultValue':_0xc2ea('0x4')}}; \ No newline at end of file +var _0xad51=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3f5d29,_0x75817d){var _0x5e98cc=function(_0x740ed4){while(--_0x740ed4){_0x3f5d29['push'](_0x3f5d29['shift']());}};_0x5e98cc(++_0x75817d);}(_0xad51,0x141));var _0x1ad5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xad51[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x1ad5('0x0'));module[_0x1ad5('0x1')]={'priority':{'type':Sequelize[_0x1ad5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1ad5('0x3')],'allowNull':![],'defaultValue':_0x1ad5('0x4')},'appdata':{'type':Sequelize[_0x1ad5('0x5')]()},'description':{'type':Sequelize[_0x1ad5('0x3')]},'interval':{'type':Sequelize[_0x1ad5('0x3')],'defaultValue':_0x1ad5('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 66ff2e3..13eaf57 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 _0x9ab8=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0x9ab8,0x81));var _0x89ab=function(_0x28f1f5,_0x1f5c46){_0x28f1f5=_0x28f1f5-0x0;var _0xe2f863=_0x9ab8[_0x28f1f5];return _0xe2f863;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x89ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89ab('0x4'));var util=require(_0x89ab('0x5'));var path=require('path');var sox=require(_0x89ab('0x6'));var csv=require(_0x89ab('0x7'));var ejs=require(_0x89ab('0x8'));var fs=require('fs');var fs_extra=require(_0x89ab('0x9'));var _=require(_0x89ab('0xa'));var squel=require(_0x89ab('0xb'));var crypto=require(_0x89ab('0xc'));var jsforce=require(_0x89ab('0xd'));var deskjs=require(_0x89ab('0xe'));var toCsv=require(_0x89ab('0x7'));var querystring=require(_0x89ab('0xf'));var Papa=require(_0x89ab('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x89ab('0x11'))(_0x89ab('0x12'));var utils=require(_0x89ab('0x13'));var config=require(_0x89ab('0x14'));var licenseUtil=require(_0x89ab('0x15'));var db=require(_0x89ab('0x16'))['db'];function respondWithStatusCode(_0x9f2616,_0x55a2eb){_0x55a2eb=_0x55a2eb||0xcc;return function(_0x15e7bc){if(_0x15e7bc){return _0x9f2616[_0x89ab('0x17')](_0x55a2eb);}return _0x9f2616[_0x89ab('0x18')](_0x55a2eb)[_0x89ab('0x19')]();};}function respondWithResult(_0x6ac355,_0x5c8310){_0x5c8310=_0x5c8310||0xc8;return function(_0x2bcab1){if(_0x2bcab1){return _0x6ac355[_0x89ab('0x18')](_0x5c8310)['json'](_0x2bcab1);}};}function respondWithFilteredResult(_0x585cf8,_0x5d70d9){return function(_0x57037f){if(_0x57037f){var _0x4fd002=typeof _0x5d70d9['offset']===_0x89ab('0x1a')&&typeof _0x5d70d9[_0x89ab('0x1b')]===_0x89ab('0x1a');var _0xd486ae=_0x57037f[_0x89ab('0x1c')];var _0x141b86=_0x4fd002?0x0:_0x5d70d9[_0x89ab('0x1d')];var _0x2af38f=_0x4fd002?_0x57037f[_0x89ab('0x1c')]:_0x5d70d9['offset']+_0x5d70d9[_0x89ab('0x1b')];var _0x23395e;if(_0x2af38f>=_0xd486ae){_0x2af38f=_0xd486ae;_0x23395e=0xc8;}else{_0x23395e=0xce;}_0x585cf8['status'](_0x23395e);return _0x585cf8['set'](_0x89ab('0x1e'),_0x141b86+'-'+_0x2af38f+'/'+_0xd486ae)[_0x89ab('0x1f')](_0x57037f);}return null;};}function patchUpdates(_0x58a14c){return function(_0x96817){try{jsonpatch[_0x89ab('0x20')](_0x96817,_0x58a14c,!![]);}catch(_0x2a5b01){return BPromise[_0x89ab('0x21')](_0x2a5b01);}return _0x96817[_0x89ab('0x22')]();};}function saveUpdates(_0x419363,_0x1be6d9){return function(_0x251a70){if(_0x251a70){return _0x251a70[_0x89ab('0x23')](_0x419363)[_0x89ab('0x24')](function(_0x1a361b){return _0x1a361b;});}return null;};}function removeEntity(_0x418aa7,_0x257aec){return function(_0x1b9e75){if(_0x1b9e75){return _0x1b9e75[_0x89ab('0x25')]()[_0x89ab('0x24')](function(){_0x418aa7['status'](0xcc)[_0x89ab('0x19')]();});}};}function handleEntityNotFound(_0x548430,_0x13359b){return function(_0x599422){if(!_0x599422){_0x548430['sendStatus'](0x194);}return _0x599422;};}function handleError(_0xd22b9c,_0x539709){_0x539709=_0x539709||0x1f4;return function(_0x5c2c79){logger[_0x89ab('0x26')](_0x5c2c79[_0x89ab('0x27')]);if(_0x5c2c79[_0x89ab('0x28')]){delete _0x5c2c79[_0x89ab('0x28')];}_0xd22b9c['status'](_0x539709)[_0x89ab('0x29')](_0x5c2c79);};}exports[_0x89ab('0x2a')]=function(_0x1919ee,_0xf8a71){var _0x5246d7={},_0x407018={},_0x3dbd1b={'count':0x0,'rows':[]};var _0x772758=_[_0x89ab('0x2b')](db[_0x89ab('0x2c')][_0x89ab('0x2d')],function(_0x25c6d1){return{'name':_0x25c6d1[_0x89ab('0x2e')],'type':_0x25c6d1[_0x89ab('0x2f')][_0x89ab('0x30')]};});_0x407018[_0x89ab('0x31')]=_[_0x89ab('0x2b')](_0x772758,'name');_0x407018[_0x89ab('0x32')]=_[_0x89ab('0x33')](_0x1919ee['query']);_0x407018[_0x89ab('0x34')]=_['intersection'](_0x407018[_0x89ab('0x31')],_0x407018['query']);_0x5246d7[_0x89ab('0x35')]=_[_0x89ab('0x36')](_0x407018[_0x89ab('0x31')],qs[_0x89ab('0x37')](_0x1919ee['query'][_0x89ab('0x37')]));_0x5246d7[_0x89ab('0x35')]=_0x5246d7['attributes'][_0x89ab('0x38')]?_0x5246d7[_0x89ab('0x35')]:_0x407018['model'];if(!_0x1919ee[_0x89ab('0x32')][_0x89ab('0x39')](_0x89ab('0x3a'))){_0x5246d7[_0x89ab('0x1b')]=qs['limit'](_0x1919ee['query'][_0x89ab('0x1b')]);_0x5246d7[_0x89ab('0x1d')]=qs[_0x89ab('0x1d')](_0x1919ee['query'][_0x89ab('0x1d')]);}_0x5246d7['order']=qs[_0x89ab('0x3b')](_0x1919ee[_0x89ab('0x32')][_0x89ab('0x3b')]);_0x5246d7['where']=qs[_0x89ab('0x34')](_[_0x89ab('0x3c')](_0x1919ee[_0x89ab('0x32')],_0x407018[_0x89ab('0x34')]),_0x772758);if(_0x1919ee['query'][_0x89ab('0x3d')]){_0x5246d7[_0x89ab('0x3e')]=_[_0x89ab('0x3f')](_0x5246d7['where'],{'$or':_['map'](_0x772758,function(_0x537c92){if(_0x537c92['type']!==_0x89ab('0x40')){var _0x7df9ae={};_0x7df9ae[_0x537c92[_0x89ab('0x28')]]={'$like':'%'+_0x1919ee['query'][_0x89ab('0x3d')]+'%'};return _0x7df9ae;}})});}_0x5246d7=_[_0x89ab('0x3f')]({},_0x5246d7,_0x1919ee['options']);var _0x16b71c={'where':_0x5246d7[_0x89ab('0x3e')]};return db[_0x89ab('0x2c')][_0x89ab('0x1c')](_0x16b71c)[_0x89ab('0x24')](function(_0x2cca97){_0x3dbd1b[_0x89ab('0x1c')]=_0x2cca97;if(_0x1919ee[_0x89ab('0x32')]['includeAll']){_0x5246d7['include']=[{'all':!![]}];}return db[_0x89ab('0x2c')][_0x89ab('0x41')](_0x5246d7);})[_0x89ab('0x24')](function(_0x90fba7){_0x3dbd1b[_0x89ab('0x42')]=_0x90fba7;return _0x3dbd1b;})['then'](respondWithFilteredResult(_0xf8a71,_0x5246d7))[_0x89ab('0x43')](handleError(_0xf8a71,null));};exports[_0x89ab('0x44')]=function(_0x503af0,_0x1ce148){var _0x295834={'raw':!![],'where':{'id':_0x503af0[_0x89ab('0x45')]['id']}},_0x15b0c2={};_0x15b0c2[_0x89ab('0x31')]=_['keys'](db[_0x89ab('0x2c')]['rawAttributes']);_0x15b0c2[_0x89ab('0x32')]=_[_0x89ab('0x33')](_0x503af0[_0x89ab('0x32')]);_0x15b0c2[_0x89ab('0x34')]=_[_0x89ab('0x36')](_0x15b0c2[_0x89ab('0x31')],_0x15b0c2[_0x89ab('0x32')]);_0x295834[_0x89ab('0x35')]=_[_0x89ab('0x36')](_0x15b0c2[_0x89ab('0x31')],qs[_0x89ab('0x37')](_0x503af0[_0x89ab('0x32')][_0x89ab('0x37')]));_0x295834[_0x89ab('0x35')]=_0x295834[_0x89ab('0x35')][_0x89ab('0x38')]?_0x295834[_0x89ab('0x35')]:_0x15b0c2[_0x89ab('0x31')];if(_0x503af0[_0x89ab('0x32')]['includeAll']){_0x295834[_0x89ab('0x46')]=[{'all':!![]}];}_0x295834=_[_0x89ab('0x3f')]({},_0x295834,_0x503af0[_0x89ab('0x47')]);return db[_0x89ab('0x2c')][_0x89ab('0x48')](_0x295834)[_0x89ab('0x24')](handleEntityNotFound(_0x1ce148,null))[_0x89ab('0x24')](respondWithResult(_0x1ce148,null))[_0x89ab('0x43')](handleError(_0x1ce148,null));};exports['create']=function(_0xf99ce6,_0x37e163){return db['WhatsappApplication'][_0x89ab('0x49')](_0xf99ce6[_0x89ab('0x4a')],{})[_0x89ab('0x24')](respondWithResult(_0x37e163,0xc9))[_0x89ab('0x43')](handleError(_0x37e163,null));};exports['update']=function(_0x57bbff,_0x11bace){if(_0x57bbff[_0x89ab('0x4a')]['id']){delete _0x57bbff[_0x89ab('0x4a')]['id'];}return db[_0x89ab('0x2c')]['find']({'where':{'id':_0x57bbff[_0x89ab('0x45')]['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x11bace,null))[_0x89ab('0x24')](saveUpdates(_0x57bbff[_0x89ab('0x4a')],null))['then'](respondWithResult(_0x11bace,null))['catch'](handleError(_0x11bace,null));};exports[_0x89ab('0x25')]=function(_0x29862e,_0x464d6b){return db[_0x89ab('0x2c')][_0x89ab('0x48')]({'where':{'id':_0x29862e['params']['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x464d6b,null))[_0x89ab('0x24')](removeEntity(_0x464d6b,null))['catch'](handleError(_0x464d6b,null));}; \ No newline at end of file +var _0x82d8=['json','apply','reject','save','update','then','destroy','sendStatus','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range'];(function(_0x41fb93,_0x206117){var _0x217d7f=function(_0x3a80ea){while(--_0x3a80ea){_0x41fb93['push'](_0x41fb93['shift']());}};_0x217d7f(++_0x206117);}(_0x82d8,0xff));var _0x882d=function(_0x398b9b,_0xba41f3){_0x398b9b=_0x398b9b-0x0;var _0x5a1365=_0x82d8[_0x398b9b];return _0x5a1365;};'use strict';var emlformat=require(_0x882d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x882d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x882d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x882d('0x3'));var util=require('util');var path=require('path');var sox=require(_0x882d('0x4'));var csv=require(_0x882d('0x5'));var ejs=require(_0x882d('0x6'));var fs=require('fs');var fs_extra=require(_0x882d('0x7'));var _=require(_0x882d('0x8'));var squel=require(_0x882d('0x9'));var crypto=require(_0x882d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x882d('0xb'));var toCsv=require(_0x882d('0x5'));var querystring=require(_0x882d('0xc'));var Papa=require('papaparse');var Redis=require(_0x882d('0xd'));var authService=require(_0x882d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x882d('0xf'));var hardwareService=require(_0x882d('0x10'));var logger=require(_0x882d('0x11'))('api');var utils=require(_0x882d('0x12'));var config=require(_0x882d('0x13'));var licenseUtil=require(_0x882d('0x14'));var db=require(_0x882d('0x15'))['db'];function respondWithStatusCode(_0x3bd4d9,_0xdf4dff){_0xdf4dff=_0xdf4dff||0xcc;return function(_0x1db57a){if(_0x1db57a){return _0x3bd4d9['sendStatus'](_0xdf4dff);}return _0x3bd4d9['status'](_0xdf4dff)[_0x882d('0x16')]();};}function respondWithResult(_0x314420,_0x28170b){_0x28170b=_0x28170b||0xc8;return function(_0x24a26b){if(_0x24a26b){return _0x314420[_0x882d('0x17')](_0x28170b)['json'](_0x24a26b);}};}function respondWithFilteredResult(_0x3ce2b0,_0x2d88e5){return function(_0x1536df){if(_0x1536df){var _0x37037a=typeof _0x2d88e5[_0x882d('0x18')]===_0x882d('0x19')&&typeof _0x2d88e5[_0x882d('0x1a')]===_0x882d('0x19');var _0x4828b1=_0x1536df['count'];var _0x556b9b=_0x37037a?0x0:_0x2d88e5[_0x882d('0x18')];var _0x59aaec=_0x37037a?_0x1536df[_0x882d('0x1b')]:_0x2d88e5['offset']+_0x2d88e5[_0x882d('0x1a')];var _0x19c67f;if(_0x59aaec>=_0x4828b1){_0x59aaec=_0x4828b1;_0x19c67f=0xc8;}else{_0x19c67f=0xce;}_0x3ce2b0[_0x882d('0x17')](_0x19c67f);return _0x3ce2b0['set'](_0x882d('0x1c'),_0x556b9b+'-'+_0x59aaec+'/'+_0x4828b1)[_0x882d('0x1d')](_0x1536df);}return null;};}function patchUpdates(_0x14d709){return function(_0x53fe6d){try{jsonpatch[_0x882d('0x1e')](_0x53fe6d,_0x14d709,!![]);}catch(_0x347396){return BPromise[_0x882d('0x1f')](_0x347396);}return _0x53fe6d[_0x882d('0x20')]();};}function saveUpdates(_0x3c5ca5,_0x1a4a84){return function(_0x13e2e5){if(_0x13e2e5){return _0x13e2e5[_0x882d('0x21')](_0x3c5ca5)[_0x882d('0x22')](function(_0x57f1d4){return _0x57f1d4;});}return null;};}function removeEntity(_0x37e6fa,_0x4d27fc){return function(_0x17ce48){if(_0x17ce48){return _0x17ce48[_0x882d('0x23')]()[_0x882d('0x22')](function(){_0x37e6fa[_0x882d('0x17')](0xcc)[_0x882d('0x16')]();});}};}function handleEntityNotFound(_0x4865e9,_0xbc291){return function(_0x58ddb2){if(!_0x58ddb2){_0x4865e9[_0x882d('0x24')](0x194);}return _0x58ddb2;};}function handleError(_0x3cb1e2,_0x5f182d){_0x5f182d=_0x5f182d||0x1f4;return function(_0x4e68af){logger['error'](_0x4e68af['stack']);if(_0x4e68af[_0x882d('0x25')]){delete _0x4e68af[_0x882d('0x25')];}_0x3cb1e2[_0x882d('0x17')](_0x5f182d)[_0x882d('0x26')](_0x4e68af);};}exports['index']=function(_0x287251,_0x18ece4){var _0x3590b0={},_0x269845={},_0xe040d8={'count':0x0,'rows':[]};var _0x47dd97=_['map'](db['WhatsappApplication'][_0x882d('0x27')],function(_0x36c74f){return{'name':_0x36c74f[_0x882d('0x28')],'type':_0x36c74f['type'][_0x882d('0x29')]};});_0x269845[_0x882d('0x2a')]=_[_0x882d('0x2b')](_0x47dd97,_0x882d('0x25'));_0x269845[_0x882d('0x2c')]=_[_0x882d('0x2d')](_0x287251['query']);_0x269845[_0x882d('0x2e')]=_['intersection'](_0x269845[_0x882d('0x2a')],_0x269845['query']);_0x3590b0[_0x882d('0x2f')]=_['intersection'](_0x269845[_0x882d('0x2a')],qs[_0x882d('0x30')](_0x287251[_0x882d('0x2c')][_0x882d('0x30')]));_0x3590b0[_0x882d('0x2f')]=_0x3590b0['attributes'][_0x882d('0x31')]?_0x3590b0['attributes']:_0x269845[_0x882d('0x2a')];if(!_0x287251[_0x882d('0x2c')][_0x882d('0x32')](_0x882d('0x33'))){_0x3590b0[_0x882d('0x1a')]=qs[_0x882d('0x1a')](_0x287251['query']['limit']);_0x3590b0['offset']=qs[_0x882d('0x18')](_0x287251[_0x882d('0x2c')][_0x882d('0x18')]);}_0x3590b0[_0x882d('0x34')]=qs[_0x882d('0x35')](_0x287251['query'][_0x882d('0x35')]);_0x3590b0[_0x882d('0x36')]=qs[_0x882d('0x2e')](_[_0x882d('0x37')](_0x287251[_0x882d('0x2c')],_0x269845[_0x882d('0x2e')]),_0x47dd97);if(_0x287251[_0x882d('0x2c')][_0x882d('0x38')]){_0x3590b0[_0x882d('0x36')]=_['merge'](_0x3590b0['where'],{'$or':_['map'](_0x47dd97,function(_0x25a05b){if(_0x25a05b[_0x882d('0x39')]!==_0x882d('0x3a')){var _0x6d04f={};_0x6d04f[_0x25a05b['name']]={'$like':'%'+_0x287251['query'][_0x882d('0x38')]+'%'};return _0x6d04f;}})});}_0x3590b0=_[_0x882d('0x3b')]({},_0x3590b0,_0x287251[_0x882d('0x3c')]);var _0x5d1da9={'where':_0x3590b0[_0x882d('0x36')]};return db[_0x882d('0x3d')]['count'](_0x5d1da9)[_0x882d('0x22')](function(_0x30661c){_0xe040d8['count']=_0x30661c;if(_0x287251[_0x882d('0x2c')][_0x882d('0x3e')]){_0x3590b0[_0x882d('0x3f')]=[{'all':!![]}];}return db[_0x882d('0x3d')][_0x882d('0x40')](_0x3590b0);})[_0x882d('0x22')](function(_0x2c6159){_0xe040d8['rows']=_0x2c6159;return _0xe040d8;})[_0x882d('0x22')](respondWithFilteredResult(_0x18ece4,_0x3590b0))[_0x882d('0x41')](handleError(_0x18ece4,null));};exports[_0x882d('0x42')]=function(_0x3c2e1a,_0x21a83d){var _0x587a6e={'raw':!![],'where':{'id':_0x3c2e1a[_0x882d('0x43')]['id']}},_0x3054f7={};_0x3054f7[_0x882d('0x2a')]=_[_0x882d('0x2d')](db[_0x882d('0x3d')][_0x882d('0x27')]);_0x3054f7[_0x882d('0x2c')]=_[_0x882d('0x2d')](_0x3c2e1a[_0x882d('0x2c')]);_0x3054f7['filters']=_['intersection'](_0x3054f7[_0x882d('0x2a')],_0x3054f7[_0x882d('0x2c')]);_0x587a6e[_0x882d('0x2f')]=_['intersection'](_0x3054f7[_0x882d('0x2a')],qs['fields'](_0x3c2e1a[_0x882d('0x2c')][_0x882d('0x30')]));_0x587a6e[_0x882d('0x2f')]=_0x587a6e[_0x882d('0x2f')]['length']?_0x587a6e[_0x882d('0x2f')]:_0x3054f7[_0x882d('0x2a')];if(_0x3c2e1a['query']['includeAll']){_0x587a6e[_0x882d('0x3f')]=[{'all':!![]}];}_0x587a6e=_[_0x882d('0x3b')]({},_0x587a6e,_0x3c2e1a[_0x882d('0x3c')]);return db[_0x882d('0x3d')]['find'](_0x587a6e)['then'](handleEntityNotFound(_0x21a83d,null))['then'](respondWithResult(_0x21a83d,null))[_0x882d('0x41')](handleError(_0x21a83d,null));};exports[_0x882d('0x44')]=function(_0x240cae,_0x36ea20){return db[_0x882d('0x3d')][_0x882d('0x44')](_0x240cae['body'],{})[_0x882d('0x22')](respondWithResult(_0x36ea20,0xc9))[_0x882d('0x41')](handleError(_0x36ea20,null));};exports[_0x882d('0x21')]=function(_0x167e98,_0x4c4d6a){if(_0x167e98[_0x882d('0x45')]['id']){delete _0x167e98[_0x882d('0x45')]['id'];}return db[_0x882d('0x3d')][_0x882d('0x46')]({'where':{'id':_0x167e98['params']['id']}})[_0x882d('0x22')](handleEntityNotFound(_0x4c4d6a,null))['then'](saveUpdates(_0x167e98[_0x882d('0x45')],null))[_0x882d('0x22')](respondWithResult(_0x4c4d6a,null))[_0x882d('0x41')](handleError(_0x4c4d6a,null));};exports['destroy']=function(_0x740007,_0x207331){return db[_0x882d('0x3d')][_0x882d('0x46')]({'where':{'id':_0x740007[_0x882d('0x43')]['id']}})[_0x882d('0x22')](handleEntityNotFound(_0x207331,null))['then'](removeEntity(_0x207331,null))[_0x882d('0x41')](handleError(_0x207331,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9a41af7..9fb5f02 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 _0x975f=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4'];(function(_0x42e7d0,_0x1fc27a){var _0x4a0d18=function(_0x141c30){while(--_0x141c30){_0x42e7d0['push'](_0x42e7d0['shift']());}};_0x4a0d18(++_0x1fc27a);}(_0x975f,0x109));var _0xf975=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x975f[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf975('0xa'),'collate':_0xf975('0xb')});}; \ No newline at end of file +var _0xfc76=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','define','whatsapp_applications','utf8mb4'];(function(_0x51fe50,_0x907b54){var _0x14a23c=function(_0x86bb78){while(--_0x86bb78){_0x51fe50['push'](_0x51fe50['shift']());}};_0x14a23c(++_0x907b54);}(_0xfc76,0xb5));var _0x6fc7=function(_0x100a6a,_0x8c7ed){_0x100a6a=_0x100a6a-0x0;var _0x497b8d=_0xfc76[_0x100a6a];return _0x497b8d;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var logger=require(_0x6fc7('0x1'))(_0x6fc7('0x2'));var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fc7('0x5'));var rimraf=require(_0x6fc7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fc7('0x7'));module['exports']=function(_0xe8177b,_0x82a35a){return _0xe8177b[_0x6fc7('0x8')]('WhatsappApplication',attributes,{'tableName':_0x6fc7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6fc7('0xa'),'collate':_0x6fc7('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 352c94f..3a1d66a 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x42bc42,_0x116efe){var _0x5e5af2=function(_0x318a37){while(--_0x318a37){_0x42bc42['push'](_0x42bc42['shift']());}};_0x5e5af2(++_0x116efe);}(_0x668b,0x140));var _0xb668=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x668b[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x17a4dd,_0x786006){var _0x1fdac7=function(_0x27d4c9){while(--_0x27d4c9){_0x17a4dd['push'](_0x17a4dd['shift']());}};_0x1fdac7(++_0x786006);}(_0x5fd1,0x155));var _0x15fd=function(_0x56bb03,_0xaa09a3){_0x56bb03=_0x56bb03-0x0;var _0x544de0=_0x5fd1[_0x56bb03];return _0x544de0;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 67ffd5b..265db8e 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 _0x446c=['describe','get','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xa17e1f,_0x441b80){var _0x2e117b=function(_0x44c69d){while(--_0x44c69d){_0xa17e1f['push'](_0xa17e1f['shift']());}};_0x2e117b(++_0x441b80);}(_0x446c,0x156));var _0xc446=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x446c[_0xb5fc3e];return _0x2efc3c;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/describe',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['show']);router[_0xc446('0xb')](_0xc446('0xd'),auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router['get'](_0xc446('0xf'),auth[_0xc446('0x8')](),controller[_0xc446('0x10')]);router[_0xc446('0x11')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0x12')]);router[_0xc446('0x11')](_0xc446('0xd'),auth[_0xc446('0x8')](),controller[_0xc446('0x13')]);router[_0xc446('0x11')](_0xc446('0x14'),auth[_0xc446('0x8')](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x17')),controller[_0xc446('0x18')]);router[_0xc446('0x19')](_0xc446('0xc'),auth['isAuthenticated'](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x1a')),controller[_0xc446('0x1b')]);router[_0xc446('0x1c')](_0xc446('0xc'),auth[_0xc446('0x8')](),interaction[_0xc446('0x15')](_0xc446('0x16'),_0xc446('0x1d')),controller['destroy']);router[_0xc446('0x1c')](_0xc446('0x14'),auth['isAuthenticated'](),controller[_0xc446('0x1e')]);module[_0xc446('0x1f')]=router; \ No newline at end of file +var _0xc359=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/messages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express'];(function(_0x33b9de,_0x41b392){var _0x39722b=function(_0x40d5f4){while(--_0x40d5f4){_0x33b9de['push'](_0x33b9de['shift']());}};_0x39722b(++_0x41b392);}(_0xc359,0x1d9));var _0x9c35=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0xc359[_0x25f805];return _0xf6628f;};'use strict';var multer=require('multer');var util=require(_0x9c35('0x0'));var path=require('path');var timeout=require(_0x9c35('0x1'));var express=require(_0x9c35('0x2'));var router=express[_0x9c35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c35('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x9c35('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9c35('0x7')](),controller[_0x9c35('0x8')]);router[_0x9c35('0x6')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xa')]);router['get'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller['getMessages']);router['get']('/:id/download',auth[_0x9c35('0x7')](),controller['download']);router[_0x9c35('0xc')]('/',auth[_0x9c35('0x7')](),controller[_0x9c35('0xd')]);router['post'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xe')]);router[_0x9c35('0xc')](_0x9c35('0xf'),auth['isAuthenticated'](),interaction[_0x9c35('0x10')](_0x9c35('0x11'),_0x9c35('0x12')),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),interaction[_0x9c35('0x10')](_0x9c35('0x11'),_0x9c35('0x15')),controller[_0x9c35('0x16')]);router[_0x9c35('0x17')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),interaction[_0x9c35('0x10')]('whatsapp',_0x9c35('0x18')),controller[_0x9c35('0x19')]);router[_0x9c35('0x17')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x1a')]);module[_0x9c35('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3b18370..1ca7c8e 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 _0x8af6=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3c98c1,_0x524e3c){var _0x45c21b=function(_0x1f8dd0){while(--_0x1f8dd0){_0x3c98c1['push'](_0x3c98c1['shift']());}};_0x45c21b(++_0x524e3c);}(_0x8af6,0x76));var _0x68af=function(_0x4b3dec,_0xaea2fd){_0x4b3dec=_0x4b3dec-0x0;var _0x5119c6=_0x8af6[_0x4b3dec];return _0x5119c6;};'use strict';var Sequelize=require(_0x68af('0x0'));var moment=require(_0x68af('0x1'));module[_0x68af('0x2')]={'closed':{'type':Sequelize[_0x68af('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x68af('0x4')]},'disposition':{'type':Sequelize[_0x68af('0x5')]},'secondDisposition':{'type':Sequelize[_0x68af('0x5')]},'thirdDisposition':{'type':Sequelize[_0x68af('0x5')]},'note':{'type':Sequelize[_0x68af('0x5')]},'phone':{'type':Sequelize[_0x68af('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x68af('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x68af('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x68af('0x6')]('in',_0x68af('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x68af('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x68af('0x8')]}}; \ No newline at end of file +var _0x2515=['out','INTEGER','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x46b4a8,_0x1544fe){var _0x50f6f2=function(_0x52f5f8){while(--_0x52f5f8){_0x46b4a8['push'](_0x46b4a8['shift']());}};_0x50f6f2(++_0x1544fe);}(_0x2515,0x1c2));var _0x5251=function(_0xb4b200,_0x2ab262){_0xb4b200=_0xb4b200-0x0;var _0x21fe42=_0x2515[_0xb4b200];return _0x21fe42;};'use strict';var Sequelize=require(_0x5251('0x0'));var moment=require(_0x5251('0x1'));module['exports']={'closed':{'type':Sequelize[_0x5251('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5251('0x3')]},'disposition':{'type':Sequelize[_0x5251('0x4')]},'secondDisposition':{'type':Sequelize[_0x5251('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5251('0x4')]},'phone':{'type':Sequelize[_0x5251('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5251('0x5')]('in',_0x5251('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5251('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5251('0x5')]('in',_0x5251('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5251('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5251('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e7d253b..02b7a36 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 _0xbb8d=['whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','where','pick','WhatsappInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','files','root','server','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','closed','closedAt','disposition','Messages','basename','existsSync','createWriteStream','System','out','read','value','views','Whatsapp','createPdfFromHTML','log','err','rimraf','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','error','name','index','map','WhatsappInteraction','rawAttributes','key'];(function(_0x692b08,_0x4ac401){var _0x501639=function(_0xbe2d7a){while(--_0xbe2d7a){_0x692b08['push'](_0x692b08['shift']());}};_0x501639(++_0x4ac401);}(_0xbb8d,0x146));var _0xdbb8=function(_0x5d44f7,_0x4aea33){_0x5d44f7=_0x5d44f7-0x0;var _0x569770=_0xbb8d[_0x5d44f7];return _0x569770;};'use strict';var rimraf=require(_0xdbb8('0x0'));var zipdir=require('zip-dir');var moment=require(_0xdbb8('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require(_0xdbb8('0x2'));var fs=require('fs');var _=require(_0xdbb8('0x3'));var Redis=require(_0xdbb8('0x4'));var interaction=require(_0xdbb8('0x5'));var qs=require(_0xdbb8('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0xdbb8('0x7'))(_0xdbb8('0x8'));var config=require(_0xdbb8('0x9'));var db=require(_0xdbb8('0xa'))['db'];config['redis']=_[_0xdbb8('0xb')](config['redis'],{'host':_0xdbb8('0xc'),'port':0x18eb});var socket=require(_0xdbb8('0xd'))(new Redis(config['redis']));require(_0xdbb8('0xe'))[_0xdbb8('0xf')](socket);function respondWithStatusCode(_0x45c7af,_0x3113b8){_0x3113b8=_0x3113b8||0xcc;return function(_0x2eb417){if(_0x2eb417){return _0x45c7af[_0xdbb8('0x10')](_0x3113b8);}return _0x45c7af[_0xdbb8('0x11')](_0x3113b8)[_0xdbb8('0x12')]();};}function respondWithResult(_0x183187,_0x46e2fc){_0x46e2fc=_0x46e2fc||0xc8;return function(_0x51580d){if(_0x51580d){return _0x183187[_0xdbb8('0x11')](_0x46e2fc)[_0xdbb8('0x13')](_0x51580d);}};}function respondWithFilteredResult(_0x22596c,_0x20ade1){return function(_0x155480){if(_0x155480){var _0x3f5c48=typeof _0x20ade1[_0xdbb8('0x14')]===_0xdbb8('0x15')&&typeof _0x20ade1['limit']===_0xdbb8('0x15');var _0x510965=_0x155480[_0xdbb8('0x16')];var _0x2723c7=_0x3f5c48?0x0:_0x20ade1[_0xdbb8('0x14')];var _0x3180a7=_0x3f5c48?_0x155480[_0xdbb8('0x16')]:_0x20ade1['offset']+_0x20ade1[_0xdbb8('0x17')];var _0x5455c2;if(_0x3180a7>=_0x510965){_0x3180a7=_0x510965;_0x5455c2=0xc8;}else{_0x5455c2=0xce;}_0x22596c['status'](_0x5455c2);return _0x22596c[_0xdbb8('0x18')]('Content-Range',_0x2723c7+'-'+_0x3180a7+'/'+_0x510965)[_0xdbb8('0x13')](_0x155480);}return null;};}function saveUpdates(_0x1e6803){return function(_0x47253a){if(_0x47253a){return _0x47253a[_0xdbb8('0x19')](_0x1e6803)[_0xdbb8('0x1a')](function(_0x229277){return _0x229277;});}return null;};}function removeEntity(_0x2225b1){return function(_0x172786){if(_0x172786){return _0x172786['destroy']()['then'](function(){_0x2225b1[_0xdbb8('0x11')](0xcc)[_0xdbb8('0x12')]();});}};}function handleEntityNotFound(_0x36cfe6){return function(_0x1634b5){if(!_0x1634b5){_0x36cfe6[_0xdbb8('0x10')](0x194);}return _0x1634b5;};}function handleError(_0x1e6db4,_0x42dcf4){_0x42dcf4=_0x42dcf4||0x1f4;return function(_0x423ffb){logger[_0xdbb8('0x1b')](_0x423ffb['stack']);if(_0x423ffb[_0xdbb8('0x1c')]){delete _0x423ffb[_0xdbb8('0x1c')];}_0x1e6db4[_0xdbb8('0x11')](_0x42dcf4)['send'](_0x423ffb);};}exports[_0xdbb8('0x1d')]=function(_0x29ea69,_0x5411a5){var _0x124573={};var _0x4c3c14=_[_0xdbb8('0x1e')](db[_0xdbb8('0x1f')][_0xdbb8('0x20')],function(_0x365da0){return{'name':_0x365da0['fieldName'],'type':_0x365da0['type'][_0xdbb8('0x21')]};});_0x124573=qs['getOptions'](_0x4c3c14,_0x29ea69);return interaction['findAll'](_0xdbb8('0x22'),_0x29ea69[_0xdbb8('0x23')],_0x29ea69['user'],_0x124573,_0x4c3c14)['then'](respondWithFilteredResult(_0x5411a5,_0x124573))[_0xdbb8('0x24')](handleError(_0x5411a5,null));};exports[_0xdbb8('0x25')]=function(_0x4f2276,_0x2331e2){var _0xf7e4ee={'raw':![],'where':{'id':_0x4f2276[_0xdbb8('0x26')]['id']}},_0x43064d={};_0x43064d[_0xdbb8('0x27')]=_[_0xdbb8('0x28')](db[_0xdbb8('0x1f')][_0xdbb8('0x20')]);_0x43064d[_0xdbb8('0x23')]=_[_0xdbb8('0x28')](_0x4f2276[_0xdbb8('0x23')]);_0x43064d[_0xdbb8('0x29')]=_[_0xdbb8('0x2a')](_0x43064d[_0xdbb8('0x27')],_0x43064d['query']);_0xf7e4ee[_0xdbb8('0x2b')]=_[_0xdbb8('0x2a')](_0x43064d[_0xdbb8('0x27')],qs[_0xdbb8('0x2c')](_0x4f2276['query'][_0xdbb8('0x2c')]));_0xf7e4ee[_0xdbb8('0x2b')]=_0xf7e4ee[_0xdbb8('0x2b')][_0xdbb8('0x2d')]?_0xf7e4ee[_0xdbb8('0x2b')]:_0x43064d[_0xdbb8('0x27')];if(_0x4f2276[_0xdbb8('0x23')][_0xdbb8('0x2e')]){_0xf7e4ee[_0xdbb8('0x2f')]=[{'all':!![]}];}_0xf7e4ee=_['merge']({},_0xf7e4ee,_0x4f2276['options']);return db['WhatsappInteraction'][_0xdbb8('0x30')](_0xf7e4ee)[_0xdbb8('0x1a')](handleEntityNotFound(_0x2331e2,null))[_0xdbb8('0x1a')](respondWithResult(_0x2331e2,null))['catch'](handleError(_0x2331e2,null));};exports[_0xdbb8('0x31')]=function(_0x2c1947,_0x26659f){return db['WhatsappInteraction'][_0xdbb8('0x31')](_0x2c1947[_0xdbb8('0x32')],{})[_0xdbb8('0x1a')](respondWithResult(_0x26659f,0xc9))[_0xdbb8('0x24')](handleError(_0x26659f,null));};exports['update']=function(_0x2487f0,_0xd8e1ec){if(_0x2487f0[_0xdbb8('0x32')]['id']){delete _0x2487f0[_0xdbb8('0x32')]['id'];}return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x2487f0['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0xd8e1ec,null))[_0xdbb8('0x1a')](saveUpdates(_0x2487f0[_0xdbb8('0x32')],null))[_0xdbb8('0x1a')](respondWithResult(_0xd8e1ec,null))[_0xdbb8('0x24')](handleError(_0xd8e1ec,null));};exports[_0xdbb8('0x33')]=function(_0x5ba008,_0x58f05d){return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x5ba008['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x58f05d,null))[_0xdbb8('0x1a')](removeEntity(_0x58f05d,null))['catch'](handleError(_0x58f05d,null));};exports[_0xdbb8('0x34')]=function(_0x20d400,_0x675d00){return db['WhatsappInteraction'][_0xdbb8('0x34')]()[_0xdbb8('0x1a')](respondWithResult(_0x675d00,null))[_0xdbb8('0x24')](handleError(_0x675d00,null));};exports['addMessage']=function(_0x18ac07,_0x43caf1){return db[_0xdbb8('0x35')][_0xdbb8('0x30')]({'where':{'id':_0x18ac07[_0xdbb8('0x26')]['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x43caf1,null))[_0xdbb8('0x1a')](function(_0x448a54){if(_0x448a54){return _0x448a54[_0xdbb8('0x36')](_0x18ac07[_0xdbb8('0x32')][_0xdbb8('0x37')],_[_0xdbb8('0x38')](_0x18ac07['body'],[_0xdbb8('0x37'),'id'])||{});}})[_0xdbb8('0x1a')](respondWithResult(_0x43caf1,null))['catch'](handleError(_0x43caf1,null));};exports[_0xdbb8('0x39')]=function(_0x17f3d3,_0x50a2b4){var _0x167e72={'raw':![],'where':{}};var _0x192ffc={};var _0x3cac09={'count':0x0,'rows':[]};return db[_0xdbb8('0x1f')][_0xdbb8('0x3a')]({'where':{'id':_0x17f3d3[_0xdbb8('0x26')]['id']}})['then'](handleEntityNotFound(_0x50a2b4,null))[_0xdbb8('0x1a')](function(_0x19fea0){if(_0x19fea0){_0x192ffc[_0xdbb8('0x27')]=_[_0xdbb8('0x28')](db['WhatsappMessage'][_0xdbb8('0x20')]);_0x192ffc[_0xdbb8('0x23')]=_[_0xdbb8('0x28')](_0x17f3d3['query']);_0x192ffc['filters']=_[_0xdbb8('0x2a')](_0x192ffc[_0xdbb8('0x27')],_0x192ffc[_0xdbb8('0x23')]);_0x167e72[_0xdbb8('0x2b')]=_[_0xdbb8('0x2a')](_0x192ffc['model'],qs[_0xdbb8('0x2c')](_0x17f3d3[_0xdbb8('0x23')]['fields']));_0x167e72[_0xdbb8('0x2b')]=_0x167e72[_0xdbb8('0x2b')]['length']?_0x167e72[_0xdbb8('0x2b')]:_0x192ffc[_0xdbb8('0x27')];if(!_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x3b')]('nolimit')){_0x167e72['limit']=qs[_0xdbb8('0x17')](_0x17f3d3['query'][_0xdbb8('0x17')]);_0x167e72['offset']=qs['offset'](_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x14')]);}_0x167e72[_0xdbb8('0x3c')]=qs['sort'](_0x17f3d3[_0xdbb8('0x23')]['sort']);_0x167e72[_0xdbb8('0x3d')]=qs[_0xdbb8('0x29')](_[_0xdbb8('0x3e')](_0x17f3d3[_0xdbb8('0x23')],_0x192ffc['filters']));_0x167e72[_0xdbb8('0x3d')][_0xdbb8('0x3f')]=_0x19fea0['id'];if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x40')]){_0x167e72[_0xdbb8('0x3d')]=_[_0xdbb8('0x41')](_0x167e72[_0xdbb8('0x3d')],{'$or':_[_0xdbb8('0x1e')](_0x167e72[_0xdbb8('0x2b')],function(_0x589925){var _0x352ae3={};_0x352ae3[_0x589925]={'$like':'%'+_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x40')]+'%'};return _0x352ae3;})});}if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x42')]){var _0x400ae0=_0x17f3d3['query'][_0xdbb8('0x42')][_0xdbb8('0x43')](',');var _0x598dcc={};_0x598dcc[_0x400ae0[0x0]]={'$gte':moment(_0x400ae0[0x1])['format'](_0xdbb8('0x44'))};_0x167e72[_0xdbb8('0x3d')]=_[_0xdbb8('0x41')](_0x167e72[_0xdbb8('0x3d')],_0x598dcc);}_0x167e72=_[_0xdbb8('0x41')]({},_0x167e72,_0x17f3d3[_0xdbb8('0x45')]);return db[_0xdbb8('0x35')]['count']({'where':_0x167e72[_0xdbb8('0x3d')]})[_0xdbb8('0x1a')](function(_0x2180d9){_0x3cac09[_0xdbb8('0x16')]=_0x2180d9;if(_0x17f3d3[_0xdbb8('0x23')][_0xdbb8('0x2e')]){_0x167e72[_0xdbb8('0x2f')]=[{'all':!![]}];}return db[_0xdbb8('0x35')][_0xdbb8('0x46')](_0x167e72);})[_0xdbb8('0x1a')](function(_0xc8f514){_0x3cac09[_0xdbb8('0x47')]=_0xc8f514;return _0x3cac09;});}})[_0xdbb8('0x1a')](respondWithFilteredResult(_0x50a2b4,_0x167e72))[_0xdbb8('0x24')](handleError(_0x50a2b4,null));};exports[_0xdbb8('0x48')]=function(_0x4ef493,_0x32e5a1){return db[_0xdbb8('0x1f')][_0xdbb8('0x30')]({'where':{'id':_0x4ef493['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x32e5a1,null))['then'](function(_0xc47949){if(_0xc47949){return _0xc47949[_0xdbb8('0x49')](_0x4ef493[_0xdbb8('0x32')][_0xdbb8('0x37')],_['omit'](_0x4ef493[_0xdbb8('0x32')],[_0xdbb8('0x37'),'id'])||{})[_0xdbb8('0x4a')](function(){return db[_0xdbb8('0x4b')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4ef493[_0xdbb8('0x32')][_0xdbb8('0x37')]}});})[_0xdbb8('0x1a')](function(_0x2d7642){socket[_0xdbb8('0x4c')](_0xdbb8('0x4d'),{'id':Number(_0x4ef493[_0xdbb8('0x26')]['id']),'tags':_0x2d7642||[]});return{'id':Number(_0x4ef493[_0xdbb8('0x26')]['id']),'tags':_0x2d7642||[]};});}})['then'](respondWithResult(_0x32e5a1,null))[_0xdbb8('0x24')](handleError(_0x32e5a1,null));};exports[_0xdbb8('0x4e')]=function(_0x294c3f,_0x3ef9a0){return db[_0xdbb8('0x1f')]['find']({'where':{'id':_0x294c3f['params']['id']}})[_0xdbb8('0x1a')](handleEntityNotFound(_0x3ef9a0,null))[_0xdbb8('0x1a')](function(_0x2e1e0b){if(_0x2e1e0b){return _0x2e1e0b[_0xdbb8('0x4e')](_0x294c3f['query'][_0xdbb8('0x37')]);}})[_0xdbb8('0x1a')](respondWithStatusCode(_0x3ef9a0,null))['catch'](handleError(_0x3ef9a0,null));};exports[_0xdbb8('0x4f')]=function(_0x4c85c0,_0x3f0a46){var _0x1c1718=moment()[_0xdbb8('0x50')]()[_0xdbb8('0x51')]();var _0xd54db6=path[_0xdbb8('0x52')](config['root'],'server',_0xdbb8('0x53'),'tmp');var _0x1462a9=path[_0xdbb8('0x52')](config[_0xdbb8('0x54')],_0xdbb8('0x55'),'files','attachments');var _0x44451b=path[_0xdbb8('0x52')](_0xd54db6,_0x1c1718);var _0x5e04c8=util[_0xdbb8('0x56')](_0xdbb8('0x57'),_0x4c85c0[_0xdbb8('0x26')]['id'],_0x1c1718);var _0x316de4=path['join'](_0xd54db6,_0x5e04c8);var _0xcd9df8=[];_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x59')],'as':_0xdbb8('0x59'),'attributes':['id',_0xdbb8('0x5a')],'raw':!![]});_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x5b')],'as':_0xdbb8('0x5c'),'attributes':['id',_0xdbb8('0x5d'),_0xdbb8('0x5e')],'raw':!![]});if(_0x4c85c0['query'][_0xdbb8('0x5f')]){_0xcd9df8[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x60')],'as':_0xdbb8('0x60'),'raw':!![]});}var _0x5ead4a=[{'model':db[_0xdbb8('0x35')],'as':'Messages','attributes':['id',_0xdbb8('0x32'),_0xdbb8('0x61'),_0xdbb8('0x62'),_0xdbb8('0x63'),'read'],'include':_0xcd9df8}];_0x5ead4a[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x64')],'as':_0xdbb8('0x65'),'attributes':['id',_0xdbb8('0x1c')]});_0x5ead4a[_0xdbb8('0x58')]({'model':db[_0xdbb8('0x59')],'as':_0xdbb8('0x66'),'attributes':['id','fullname']});return db[_0xdbb8('0x1f')]['find']({'where':{'id':_0x4c85c0[_0xdbb8('0x26')]['id']},'include':_0x5ead4a})[_0xdbb8('0x1a')](handleEntityNotFound(_0x3f0a46,null))[_0xdbb8('0x1a')](function(_0x5195c8){if(_0x5195c8){var _0x3aaa44=_0x5195c8[_0xdbb8('0x67')]({'plain':!![]});fs['mkdirSync'](_0x44451b);var _0x3f7ede={'channel':'Whatsapp','account':_0x3aaa44[_0xdbb8('0x65')][_0xdbb8('0x1c')],'agent':_0x3aaa44['Owner']?_0x3aaa44[_0xdbb8('0x66')][_0xdbb8('0x5a')]:'N.A.','createdAt':moment(_0x3aaa44[_0xdbb8('0x61')])[_0xdbb8('0x56')](_0xdbb8('0x44'))[_0xdbb8('0x51')](),'closedAt':_0x3aaa44[_0xdbb8('0x68')]?moment(_0x3aaa44[_0xdbb8('0x69')])[_0xdbb8('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbb8('0x51')]():'','disposition':_0x3aaa44[_0xdbb8('0x6a')],'messages':_(_0x3aaa44[_0xdbb8('0x6b')])[_0xdbb8('0x40')]({'secret':![]})['map'](function(_0x58dea5){if(_0x58dea5[_0xdbb8('0x60')]){var _0x1abd15=path[_0xdbb8('0x52')](_0x1462a9,_0x58dea5['Attachment'][_0xdbb8('0x6c')]);if(fs[_0xdbb8('0x6d')](_0x1abd15)){fs['createReadStream'](_0x1abd15)['pipe'](fs[_0xdbb8('0x6e')](path['join'](_0x44451b,_0x58dea5[_0xdbb8('0x60')][_0xdbb8('0x6c')])));}}return{'date':moment(_0x58dea5['createdAt'])[_0xdbb8('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbb8('0x51')](),'sender':_0x58dea5[_0xdbb8('0x62')]==='out'?_0x58dea5[_0xdbb8('0x59')]?_0x58dea5[_0xdbb8('0x59')]['fullname']:_0xdbb8('0x6f'):_0x58dea5['Contact'][_0xdbb8('0x5d')]+(_0x58dea5[_0xdbb8('0x5c')]['lastName']?'\x20'+_0x58dea5['Contact'][_0xdbb8('0x5e')]:''),'body':_0x58dea5[_0xdbb8('0x60')]?_0x58dea5['Attachment'][_0xdbb8('0x6c')]:_0x58dea5['body'],'direction':_0x58dea5[_0xdbb8('0x62')]===_0xdbb8('0x70')?'A':'C','secret':_0x58dea5[_0xdbb8('0x63')],'read':_0x58dea5[_0xdbb8('0x71')],'attachment':_0x58dea5[_0xdbb8('0x60')]};})[_0xdbb8('0x72')]()};return ejs['renderFile'](path[_0xdbb8('0x52')](config[_0xdbb8('0x54')],_0xdbb8('0x55'),_0xdbb8('0x73'),'downloadInteraction.ejs'),{'interaction':_0x3f7ede})[_0xdbb8('0x1a')](function(_0x50e473){var _0x17d1f6=path[_0xdbb8('0x52')](_0x44451b,'transcript-'+_0x3aaa44['id']+'-'+_0x1c1718+'.pdf');var _0x417cee={'path':_0x17d1f6,'channel':_0xdbb8('0x74'),'interactionId':_0x3aaa44['id']};return pdf[_0xdbb8('0x75')](_0x50e473,_0x417cee);})[_0xdbb8('0x1a')](function(){return new BPromise(function(_0x3b9fc9,_0x373271){zipdir(_0x44451b,{'saveTo':_0x316de4},function(_0x48eaf7,_0x2cfd31){if(_0x48eaf7)return _0x373271(_0x48eaf7);return _0x3b9fc9(_0x2cfd31);});})[_0xdbb8('0x1a')](function(){return new BPromise(function(_0x5c99cd,_0x205f38){rimraf(_0x44451b,function(_0x24a7f1){if(_0x24a7f1)_0x205f38(_0x24a7f1);return _0x5c99cd();});});})[_0xdbb8('0x1a')](function(){return _0x3f0a46[_0xdbb8('0x4f')](_0x316de4,_0x5e04c8,function(_0x4d6d81){if(_0x4d6d81){console[_0xdbb8('0x76')](_0xdbb8('0x77'),_0x4d6d81);}else{fs['unlinkSync'](_0x316de4);}});});});}else{return _0x3f0a46['sendStatus'](0xc8);}})[_0xdbb8('0x24')](handleError(_0x3f0a46,null));}; \ No newline at end of file +var _0x199d=['getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','WhatsappAccount','User','Owner','Whatsapp','Account','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','direction','out','System','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','sendStatus','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','set','update','then','destroy','error','name','index','map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','include','create','body','find','describe','addMessage','WhatsappMessage','ids','omit'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0x199d,0x13d));var _0xd199=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x199d[_0x430459];return _0x3a2439;};'use strict';var rimraf=require(_0xd199('0x0'));var zipdir=require(_0xd199('0x1'));var moment=require(_0xd199('0x2'));var BPromise=require(_0xd199('0x3'));var util=require(_0xd199('0x4'));var path=require('path');var ejs=require(_0xd199('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd199('0x6'));var interaction=require(_0xd199('0x7'));var qs=require(_0xd199('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xd199('0x9'))(_0xd199('0xa'));var config=require('../../config/environment');var db=require(_0xd199('0xb'))['db'];config[_0xd199('0xc')]=_[_0xd199('0xd')](config['redis'],{'host':_0xd199('0xe'),'port':0x18eb});var socket=require(_0xd199('0xf'))(new Redis(config[_0xd199('0xc')]));require('./whatsappInteraction.socket')[_0xd199('0x10')](socket);function respondWithStatusCode(_0x1da08e,_0x49c25e){_0x49c25e=_0x49c25e||0xcc;return function(_0x32c5bc){if(_0x32c5bc){return _0x1da08e['sendStatus'](_0x49c25e);}return _0x1da08e[_0xd199('0x11')](_0x49c25e)[_0xd199('0x12')]();};}function respondWithResult(_0x176590,_0x16d95b){_0x16d95b=_0x16d95b||0xc8;return function(_0x376305){if(_0x376305){return _0x176590[_0xd199('0x11')](_0x16d95b)[_0xd199('0x13')](_0x376305);}};}function respondWithFilteredResult(_0x413cf0,_0x2104d2){return function(_0x13d636){if(_0x13d636){var _0xe50ec5=typeof _0x2104d2['offset']===_0xd199('0x14')&&typeof _0x2104d2['limit']===_0xd199('0x14');var _0x15273b=_0x13d636[_0xd199('0x15')];var _0x2dacb0=_0xe50ec5?0x0:_0x2104d2['offset'];var _0x1e8132=_0xe50ec5?_0x13d636[_0xd199('0x15')]:_0x2104d2[_0xd199('0x16')]+_0x2104d2[_0xd199('0x17')];var _0x4354d1;if(_0x1e8132>=_0x15273b){_0x1e8132=_0x15273b;_0x4354d1=0xc8;}else{_0x4354d1=0xce;}_0x413cf0['status'](_0x4354d1);return _0x413cf0[_0xd199('0x18')]('Content-Range',_0x2dacb0+'-'+_0x1e8132+'/'+_0x15273b)[_0xd199('0x13')](_0x13d636);}return null;};}function saveUpdates(_0xd01c21){return function(_0x3d7fff){if(_0x3d7fff){return _0x3d7fff[_0xd199('0x19')](_0xd01c21)[_0xd199('0x1a')](function(_0x3c997b){return _0x3c997b;});}return null;};}function removeEntity(_0x2c7fa6){return function(_0x4e3d64){if(_0x4e3d64){return _0x4e3d64[_0xd199('0x1b')]()[_0xd199('0x1a')](function(){_0x2c7fa6[_0xd199('0x11')](0xcc)[_0xd199('0x12')]();});}};}function handleEntityNotFound(_0x487ace){return function(_0x236962){if(!_0x236962){_0x487ace['sendStatus'](0x194);}return _0x236962;};}function handleError(_0x558744,_0x217cc1){_0x217cc1=_0x217cc1||0x1f4;return function(_0x19e6b1){logger[_0xd199('0x1c')](_0x19e6b1['stack']);if(_0x19e6b1['name']){delete _0x19e6b1[_0xd199('0x1d')];}_0x558744[_0xd199('0x11')](_0x217cc1)['send'](_0x19e6b1);};}exports[_0xd199('0x1e')]=function(_0x429a37,_0x2d5beb){var _0x11a57f={};var _0x360753=_[_0xd199('0x1f')](db[_0xd199('0x20')][_0xd199('0x21')],function(_0x59408c){return{'name':_0x59408c['fieldName'],'type':_0x59408c['type'][_0xd199('0x22')]};});_0x11a57f=qs[_0xd199('0x23')](_0x360753,_0x429a37);return interaction[_0xd199('0x24')]('whatsapp',_0x429a37['query'],_0x429a37[_0xd199('0x25')],_0x11a57f,_0x360753)[_0xd199('0x1a')](respondWithFilteredResult(_0x2d5beb,_0x11a57f))[_0xd199('0x26')](handleError(_0x2d5beb,null));};exports[_0xd199('0x27')]=function(_0x232b5d,_0x18f61d){var _0x3c1269={'raw':![],'where':{'id':_0x232b5d[_0xd199('0x28')]['id']}},_0x1bcbe1={};_0x1bcbe1[_0xd199('0x29')]=_['keys'](db[_0xd199('0x20')]['rawAttributes']);_0x1bcbe1['query']=_[_0xd199('0x2a')](_0x232b5d[_0xd199('0x2b')]);_0x1bcbe1[_0xd199('0x2c')]=_[_0xd199('0x2d')](_0x1bcbe1[_0xd199('0x29')],_0x1bcbe1[_0xd199('0x2b')]);_0x3c1269['attributes']=_[_0xd199('0x2d')](_0x1bcbe1[_0xd199('0x29')],qs[_0xd199('0x2e')](_0x232b5d[_0xd199('0x2b')]['fields']));_0x3c1269[_0xd199('0x2f')]=_0x3c1269[_0xd199('0x2f')]['length']?_0x3c1269['attributes']:_0x1bcbe1['model'];if(_0x232b5d[_0xd199('0x2b')][_0xd199('0x30')]){_0x3c1269[_0xd199('0x31')]=[{'all':!![]}];}_0x3c1269=_['merge']({},_0x3c1269,_0x232b5d['options']);return db[_0xd199('0x20')]['find'](_0x3c1269)[_0xd199('0x1a')](handleEntityNotFound(_0x18f61d,null))[_0xd199('0x1a')](respondWithResult(_0x18f61d,null))[_0xd199('0x26')](handleError(_0x18f61d,null));};exports[_0xd199('0x32')]=function(_0x52dac9,_0x2ea308){return db[_0xd199('0x20')][_0xd199('0x32')](_0x52dac9[_0xd199('0x33')],{})[_0xd199('0x1a')](respondWithResult(_0x2ea308,0xc9))[_0xd199('0x26')](handleError(_0x2ea308,null));};exports[_0xd199('0x19')]=function(_0x59f04f,_0x4c5dda){if(_0x59f04f['body']['id']){delete _0x59f04f[_0xd199('0x33')]['id'];}return db['WhatsappInteraction'][_0xd199('0x34')]({'where':{'id':_0x59f04f[_0xd199('0x28')]['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0x4c5dda,null))[_0xd199('0x1a')](saveUpdates(_0x59f04f['body'],null))['then'](respondWithResult(_0x4c5dda,null))[_0xd199('0x26')](handleError(_0x4c5dda,null));};exports[_0xd199('0x1b')]=function(_0x3fbc75,_0x1b690f){return db['WhatsappInteraction'][_0xd199('0x34')]({'where':{'id':_0x3fbc75[_0xd199('0x28')]['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0x1b690f,null))[_0xd199('0x1a')](removeEntity(_0x1b690f,null))[_0xd199('0x26')](handleError(_0x1b690f,null));};exports[_0xd199('0x35')]=function(_0x2c0fec,_0x261832){return db[_0xd199('0x20')]['describe']()['then'](respondWithResult(_0x261832,null))[_0xd199('0x26')](handleError(_0x261832,null));};exports[_0xd199('0x36')]=function(_0x19324f,_0x40a035){return db[_0xd199('0x37')][_0xd199('0x34')]({'where':{'id':_0x19324f[_0xd199('0x28')]['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0x40a035,null))[_0xd199('0x1a')](function(_0x7bc29b){if(_0x7bc29b){return _0x7bc29b[_0xd199('0x36')](_0x19324f[_0xd199('0x33')][_0xd199('0x38')],_[_0xd199('0x39')](_0x19324f[_0xd199('0x33')],['ids','id'])||{});}})[_0xd199('0x1a')](respondWithResult(_0x40a035,null))[_0xd199('0x26')](handleError(_0x40a035,null));};exports[_0xd199('0x3a')]=function(_0x2c9fbd,_0x1b0e35){var _0xe3adb={'raw':![],'where':{}};var _0x51f6b6={};var _0x5380dd={'count':0x0,'rows':[]};return db[_0xd199('0x20')][_0xd199('0x3b')]({'where':{'id':_0x2c9fbd[_0xd199('0x28')]['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0x1b0e35,null))['then'](function(_0x1c1702){if(_0x1c1702){_0x51f6b6[_0xd199('0x29')]=_[_0xd199('0x2a')](db[_0xd199('0x37')][_0xd199('0x21')]);_0x51f6b6[_0xd199('0x2b')]=_[_0xd199('0x2a')](_0x2c9fbd['query']);_0x51f6b6[_0xd199('0x2c')]=_['intersection'](_0x51f6b6['model'],_0x51f6b6[_0xd199('0x2b')]);_0xe3adb[_0xd199('0x2f')]=_[_0xd199('0x2d')](_0x51f6b6[_0xd199('0x29')],qs[_0xd199('0x2e')](_0x2c9fbd['query'][_0xd199('0x2e')]));_0xe3adb[_0xd199('0x2f')]=_0xe3adb['attributes'][_0xd199('0x3c')]?_0xe3adb[_0xd199('0x2f')]:_0x51f6b6['model'];if(!_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x3d')](_0xd199('0x3e'))){_0xe3adb[_0xd199('0x17')]=qs[_0xd199('0x17')](_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x17')]);_0xe3adb[_0xd199('0x16')]=qs[_0xd199('0x16')](_0x2c9fbd[_0xd199('0x2b')]['offset']);}_0xe3adb[_0xd199('0x3f')]=qs[_0xd199('0x40')](_0x2c9fbd[_0xd199('0x2b')]['sort']);_0xe3adb[_0xd199('0x41')]=qs['filters'](_[_0xd199('0x42')](_0x2c9fbd[_0xd199('0x2b')],_0x51f6b6['filters']));_0xe3adb[_0xd199('0x41')][_0xd199('0x43')]=_0x1c1702['id'];if(_0x2c9fbd[_0xd199('0x2b')]['filter']){_0xe3adb[_0xd199('0x41')]=_[_0xd199('0x44')](_0xe3adb[_0xd199('0x41')],{'$or':_[_0xd199('0x1f')](_0xe3adb[_0xd199('0x2f')],function(_0x240004){var _0x16d4fb={};_0x16d4fb[_0x240004]={'$like':'%'+_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x45')]+'%'};return _0x16d4fb;})});}if(_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x46')]){var _0x18ad45=_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x46')][_0xd199('0x47')](',');var _0x21ceeb={};_0x21ceeb[_0x18ad45[0x0]]={'$gte':moment(_0x18ad45[0x1])[_0xd199('0x48')](_0xd199('0x49'))};_0xe3adb[_0xd199('0x41')]=_[_0xd199('0x44')](_0xe3adb[_0xd199('0x41')],_0x21ceeb);}_0xe3adb=_['merge']({},_0xe3adb,_0x2c9fbd[_0xd199('0x4a')]);return db[_0xd199('0x37')][_0xd199('0x15')]({'where':_0xe3adb['where']})[_0xd199('0x1a')](function(_0x5627e9){_0x5380dd['count']=_0x5627e9;if(_0x2c9fbd[_0xd199('0x2b')][_0xd199('0x30')]){_0xe3adb[_0xd199('0x31')]=[{'all':!![]}];}return db[_0xd199('0x37')][_0xd199('0x24')](_0xe3adb);})[_0xd199('0x1a')](function(_0x110623){_0x5380dd['rows']=_0x110623;return _0x5380dd;});}})[_0xd199('0x1a')](respondWithFilteredResult(_0x1b0e35,_0xe3adb))[_0xd199('0x26')](handleError(_0x1b0e35,null));};exports[_0xd199('0x4b')]=function(_0x18225d,_0xfda6e0){return db[_0xd199('0x20')]['find']({'where':{'id':_0x18225d[_0xd199('0x28')]['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0xfda6e0,null))[_0xd199('0x1a')](function(_0x21c644){if(_0x21c644){return _0x21c644['setTags'](_0x18225d[_0xd199('0x33')][_0xd199('0x38')],_[_0xd199('0x39')](_0x18225d[_0xd199('0x33')],[_0xd199('0x38'),'id'])||{})[_0xd199('0x4c')](function(){return db[_0xd199('0x4d')][_0xd199('0x24')]({'attributes':['id',_0xd199('0x1d'),_0xd199('0x4e')],'where':{'id':_0x18225d[_0xd199('0x33')][_0xd199('0x38')]}});})[_0xd199('0x1a')](function(_0x12e452){socket['emit'](_0xd199('0x4f'),{'id':Number(_0x18225d['params']['id']),'tags':_0x12e452||[]});return{'id':Number(_0x18225d[_0xd199('0x28')]['id']),'tags':_0x12e452||[]};});}})[_0xd199('0x1a')](respondWithResult(_0xfda6e0,null))[_0xd199('0x26')](handleError(_0xfda6e0,null));};exports[_0xd199('0x50')]=function(_0x3d99a9,_0x284396){return db[_0xd199('0x20')]['find']({'where':{'id':_0x3d99a9['params']['id']}})[_0xd199('0x1a')](handleEntityNotFound(_0x284396,null))[_0xd199('0x1a')](function(_0x5f2035){if(_0x5f2035){return _0x5f2035[_0xd199('0x50')](_0x3d99a9[_0xd199('0x2b')]['ids']);}})['then'](respondWithStatusCode(_0x284396,null))[_0xd199('0x26')](handleError(_0x284396,null));};exports['download']=function(_0x5b789b,_0x65317a){var _0x39a59f=moment()[_0xd199('0x51')]()[_0xd199('0x52')]();var _0x2ab61e=path[_0xd199('0x53')](config[_0xd199('0x54')],_0xd199('0x55'),'files','tmp');var _0x20e8a7=path['join'](config[_0xd199('0x54')],_0xd199('0x55'),_0xd199('0x56'),_0xd199('0x57'));var _0x3036b7=path['join'](_0x2ab61e,_0x39a59f);var _0x3d47fc=util[_0xd199('0x48')](_0xd199('0x58'),_0x5b789b['params']['id'],_0x39a59f);var _0x2d842a=path[_0xd199('0x53')](_0x2ab61e,_0x3d47fc);var _0x120305=[];_0x120305[_0xd199('0x59')]({'model':db['User'],'as':'User','attributes':['id',_0xd199('0x5a')],'raw':!![]});_0x120305[_0xd199('0x59')]({'model':db[_0xd199('0x5b')],'as':_0xd199('0x5c'),'attributes':['id',_0xd199('0x5d'),_0xd199('0x5e')],'raw':!![]});if(_0x5b789b[_0xd199('0x2b')][_0xd199('0x57')]){_0x120305[_0xd199('0x59')]({'model':db[_0xd199('0x5f')],'as':_0xd199('0x5f'),'raw':!![]});}var _0x1dfd9c=[{'model':db[_0xd199('0x37')],'as':_0xd199('0x60'),'attributes':['id','body',_0xd199('0x61'),'direction',_0xd199('0x62'),'read'],'include':_0x120305}];_0x1dfd9c['push']({'model':db[_0xd199('0x63')],'as':'Account','attributes':['id',_0xd199('0x1d')]});_0x1dfd9c['push']({'model':db[_0xd199('0x64')],'as':_0xd199('0x65'),'attributes':['id','fullname']});return db[_0xd199('0x20')][_0xd199('0x34')]({'where':{'id':_0x5b789b[_0xd199('0x28')]['id']},'include':_0x1dfd9c})[_0xd199('0x1a')](handleEntityNotFound(_0x65317a,null))[_0xd199('0x1a')](function(_0x5b1d37){if(_0x5b1d37){var _0x263f3f=_0x5b1d37['get']({'plain':!![]});fs['mkdirSync'](_0x3036b7);var _0x4cf1e6={'channel':_0xd199('0x66'),'account':_0x263f3f[_0xd199('0x67')][_0xd199('0x1d')],'agent':_0x263f3f['Owner']?_0x263f3f['Owner'][_0xd199('0x5a')]:_0xd199('0x68'),'createdAt':moment(_0x263f3f[_0xd199('0x61')])[_0xd199('0x48')](_0xd199('0x49'))[_0xd199('0x52')](),'closedAt':_0x263f3f[_0xd199('0x69')]?moment(_0x263f3f[_0xd199('0x6a')])[_0xd199('0x48')](_0xd199('0x49'))[_0xd199('0x52')]():'','disposition':_0x263f3f[_0xd199('0x6b')],'messages':_(_0x263f3f[_0xd199('0x60')])[_0xd199('0x45')]({'secret':![]})[_0xd199('0x1f')](function(_0xc0eaf9){if(_0xc0eaf9[_0xd199('0x5f')]){var _0x5af5fc=path[_0xd199('0x53')](_0x20e8a7,_0xc0eaf9[_0xd199('0x5f')][_0xd199('0x6c')]);if(fs[_0xd199('0x6d')](_0x5af5fc)){fs[_0xd199('0x6e')](_0x5af5fc)[_0xd199('0x6f')](fs['createWriteStream'](path[_0xd199('0x53')](_0x3036b7,_0xc0eaf9[_0xd199('0x5f')][_0xd199('0x6c')])));}}return{'date':moment(_0xc0eaf9[_0xd199('0x61')])['format'](_0xd199('0x49'))[_0xd199('0x52')](),'sender':_0xc0eaf9[_0xd199('0x70')]===_0xd199('0x71')?_0xc0eaf9['User']?_0xc0eaf9[_0xd199('0x64')]['fullname']:_0xd199('0x72'):_0xc0eaf9['Contact'][_0xd199('0x5d')]+(_0xc0eaf9[_0xd199('0x5c')][_0xd199('0x5e')]?'\x20'+_0xc0eaf9['Contact'][_0xd199('0x5e')]:''),'body':_0xc0eaf9[_0xd199('0x5f')]?_0xc0eaf9[_0xd199('0x5f')][_0xd199('0x6c')]:_0xc0eaf9[_0xd199('0x33')],'direction':_0xc0eaf9[_0xd199('0x70')]==='out'?'A':'C','secret':_0xc0eaf9[_0xd199('0x62')],'read':_0xc0eaf9[_0xd199('0x73')],'attachment':_0xc0eaf9[_0xd199('0x5f')]};})[_0xd199('0x74')]()};return ejs[_0xd199('0x75')](path[_0xd199('0x53')](config['root'],'server',_0xd199('0x76'),_0xd199('0x77')),{'interaction':_0x4cf1e6})[_0xd199('0x1a')](function(_0x4a2d74){var _0x24534f=path['join'](_0x3036b7,'transcript-'+_0x263f3f['id']+'-'+_0x39a59f+_0xd199('0x78'));var _0x15fa39={'path':_0x24534f,'channel':_0xd199('0x66'),'interactionId':_0x263f3f['id']};return pdf[_0xd199('0x79')](_0x4a2d74,_0x15fa39);})[_0xd199('0x1a')](function(){return new BPromise(function(_0x197b40,_0x2d9624){zipdir(_0x3036b7,{'saveTo':_0x2d842a},function(_0x45a92d,_0x433985){if(_0x45a92d)return _0x2d9624(_0x45a92d);return _0x197b40(_0x433985);});})['then'](function(){return new BPromise(function(_0x28af56,_0x4e49fa){rimraf(_0x3036b7,function(_0x28a7fe){if(_0x28a7fe)_0x4e49fa(_0x28a7fe);return _0x28af56();});});})[_0xd199('0x1a')](function(){return _0x65317a[_0xd199('0x7a')](_0x2d842a,_0x3d47fc,function(_0x2540c5){if(_0x2540c5){console[_0xd199('0x7b')]('err',_0x2540c5);}else{fs['unlinkSync'](_0x2d842a);}});});});}else{return _0x65317a[_0xd199('0x7c')](0xc8);}})[_0xd199('0x26')](handleError(_0x65317a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5067c9a..6ad18a2 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 _0x41bb=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','setDataValue','Users','findAll','then','unreadMessages'];(function(_0x29bca5,_0x1ca891){var _0x2ffa57=function(_0xbf6602){while(--_0xbf6602){_0x29bca5['push'](_0x29bca5['shift']());}};_0x2ffa57(++_0x1ca891);}(_0x41bb,0xc5));var _0xb41b=function(_0x566189,_0x209c19){_0x566189=_0x566189-0x0;var _0x10c866=_0x41bb[_0x566189];return _0x10c866;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var WhatsappInteraction=require(_0xb41b('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb41b('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':_0xb41b('0x3'),'afterUpdate':_0xb41b('0x4'),'afterDestroy':_0xb41b('0x5')};function emitEvent(_0x4ee21b){return function(_0x12cea3,_0x2c9f9e,_0x2dbaa3){_0x12cea3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x497242){_0x12cea3[_0xb41b('0x6')](_0xb41b('0x7'),_0x497242['map'](function(_0x13d44e){return{'id':_0x13d44e['id']};}));return WhatsappMessage[_0xb41b('0x8')]({'where':{'WhatsappInteractionId':_0x12cea3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb41b('0x9')](function(_0xa2aa66){_0x12cea3[_0xb41b('0x6')](_0xb41b('0xa'),_0xa2aa66[_0xb41b('0xb')]);WhatsappInteractionEvents['emit'](_0x4ee21b+':'+_0x12cea3['id'],_0x12cea3);WhatsappInteractionEvents[_0xb41b('0xc')](_0x4ee21b,_0x12cea3);_0x2dbaa3(null);})['catch'](_0x2dbaa3(null));};}for(var e in events){if(events[_0xb41b('0xd')](e)){var event=events[e];WhatsappInteraction[_0xb41b('0xe')](e,emitEvent(event));}}module[_0xb41b('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0901=['setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','remove','getUsers'];(function(_0x2697f3,_0x44084c){var _0x558909=function(_0x573e2a){while(--_0x573e2a){_0x2697f3['push'](_0x2697f3['shift']());}};_0x558909(++_0x44084c);}(_0x0901,0x134));var _0x1090=function(_0x128676,_0x30bc6e){_0x128676=_0x128676-0x0;var _0xf7512d=_0x0901[_0x128676];return _0xf7512d;};'use strict';var EventEmitter=require(_0x1090('0x0'));var WhatsappInteraction=require(_0x1090('0x1'))['db'][_0x1090('0x2')];var WhatsappMessage=require(_0x1090('0x1'))['db'][_0x1090('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1090('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1090('0x5')};function emitEvent(_0xf8da8c){return function(_0x3ead6b,_0xf21ed0,_0x9a1121){_0x3ead6b[_0x1090('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f569b){_0x3ead6b[_0x1090('0x7')]('Users',_0x3f569b[_0x1090('0x8')](function(_0x160356){return{'id':_0x160356['id']};}));return WhatsappMessage[_0x1090('0x9')]({'where':{'WhatsappInteractionId':_0x3ead6b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x49bba9){_0x3ead6b['setDataValue'](_0x1090('0xa'),_0x49bba9[_0x1090('0xb')]);WhatsappInteractionEvents[_0x1090('0xc')](_0xf8da8c+':'+_0x3ead6b['id'],_0x3ead6b);WhatsappInteractionEvents['emit'](_0xf8da8c,_0x3ead6b);_0x9a1121(null);})[_0x1090('0xd')](_0x9a1121(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x1090('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ca78443..6a79223 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 _0xd296=['define','WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','./whatsappInteraction.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd296,0xa2));var _0x6d29=function(_0x348734,_0x142eec){_0x348734=_0x348734-0x0;var _0x5a7dfe=_0xd296[_0x348734];return _0x5a7dfe;};'use strict';var _=require('lodash');var util=require(_0x6d29('0x0'));var logger=require('../../config/logger')(_0x6d29('0x1'));var moment=require(_0x6d29('0x2'));var BPromise=require(_0x6d29('0x3'));var rp=require(_0x6d29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d29('0x5'));module[_0x6d29('0x6')]=function(_0x29c34a,_0x1bc73a){return _0x29c34a[_0x6d29('0x7')](_0x6d29('0x8'),attributes,{'tableName':_0x6d29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x205f9d,_0x2e225b,_0xac4946){if(_0x205f9d[_0x6d29('0xa')]('closed')){_0x205f9d['closedAt']=moment()[_0x6d29('0xb')](_0x6d29('0xc'));}_0xac4946(null,_0x205f9d);}}});}; \ No newline at end of file +var _0xf2e9=['path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xf2e9,0x146));var _0x9f2e=function(_0x47337a,_0x4ba7b0){_0x47337a=_0x47337a-0x0;var _0x429492=_0xf2e9[_0x47337a];return _0x429492;};'use strict';var _=require(_0x9f2e('0x0'));var util=require(_0x9f2e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9f2e('0x2'));var BPromise=require(_0x9f2e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f2e('0x4'));var rimraf=require('rimraf');var config=require(_0x9f2e('0x5'));var attributes=require(_0x9f2e('0x6'));module['exports']=function(_0x47fde2,_0x42e9da){return _0x47fde2[_0x9f2e('0x7')](_0x9f2e('0x8'),attributes,{'tableName':_0x9f2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31ccae,_0x23106a,_0x41e264){if(_0x31ccae[_0x9f2e('0xa')](_0x9f2e('0xb'))){_0x31ccae[_0x9f2e('0xc')]=moment()[_0x9f2e('0xd')](_0x9f2e('0xe'));}_0x41e264(null,_0x31ccae);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5a3a3ca..8ee7394 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 _0xaea0=['error','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','update','options','where','stringify','catch','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x2eeb0e,_0x32bb55){var _0x727f68=function(_0x2192fc){while(--_0x2192fc){_0x2eeb0e['push'](_0x2eeb0e['shift']());}};_0x727f68(++_0x32bb55);}(_0xaea0,0x114));var _0x0aea=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xaea0[_0x215dc8];return _0x583ea3;};'use strict';var _=require(_0x0aea('0x0'));var util=require('util');var moment=require(_0x0aea('0x1'));var BPromise=require(_0x0aea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aea('0x3'));var db=require(_0x0aea('0x4'))['db'];var utils=require(_0x0aea('0x5'));var logger=require(_0x0aea('0x6'))(_0x0aea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0aea('0x8')][_0x0aea('0x9')]({'port':0x232a});config[_0x0aea('0xa')]=_[_0x0aea('0xb')](config[_0x0aea('0xa')],{'host':_0x0aea('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0aea('0xa')]));require(_0x0aea('0xd'))[_0x0aea('0xe')](socket);function respondWithRpcPromise(_0x1be048,_0x435710,_0x580cfd){return new BPromise(function(_0x523ff3,_0x52074f){return client[_0x0aea('0xf')](_0x1be048,_0x580cfd)[_0x0aea('0x10')](function(_0xc416e6){logger[_0x0aea('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x435710,_0x0aea('0x12'));logger[_0x0aea('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x435710,_0x0aea('0x12'),JSON['stringify'](_0xc416e6));if(_0xc416e6[_0x0aea('0x14')]){if(_0xc416e6[_0x0aea('0x14')]['code']===0x1f4){logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0xc416e6[_0x0aea('0x14')]['message']);return _0x52074f(_0xc416e6['error'][_0x0aea('0x16')]);}logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0xc416e6[_0x0aea('0x14')]['message']);return _0x523ff3(_0xc416e6[_0x0aea('0x14')][_0x0aea('0x16')]);}else{logger[_0x0aea('0x11')](_0x0aea('0x15'),_0x435710,_0x0aea('0x12'));_0x523ff3(_0xc416e6[_0x0aea('0x17')][_0x0aea('0x16')]);}})['catch'](function(_0x54e83f){logger[_0x0aea('0x14')](_0x0aea('0x15'),_0x435710,_0x54e83f);_0x52074f(_0x54e83f);});});}exports[_0x0aea('0x18')]=function(_0x3294cb){var _0x41b9d5=this;return new Promise(function(_0x5cddf3,_0x5c378e){return db['WhatsappInteraction'][_0x0aea('0x19')](_0x3294cb['body'],{'raw':_0x3294cb[_0x0aea('0x1a')]?_0x3294cb[_0x0aea('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3294cb['options']?_0x3294cb[_0x0aea('0x1a')][_0x0aea('0x1b')]||null:null,'attributes':_0x3294cb['options']?_0x3294cb[_0x0aea('0x1a')]['attributes']||null:null,'limit':_0x3294cb[_0x0aea('0x1a')]?_0x3294cb[_0x0aea('0x1a')]['limit']||null:null})[_0x0aea('0x10')](function(_0x38b944){logger[_0x0aea('0x11')](_0x0aea('0x18'),_0x3294cb);logger[_0x0aea('0x13')]('UpdateWhatsappInteraction',_0x3294cb,JSON[_0x0aea('0x1c')](_0x38b944));_0x5cddf3(_0x38b944);})[_0x0aea('0x1d')](function(_0xf51a42){logger[_0x0aea('0x14')](_0x0aea('0x18'),_0xf51a42['message'],_0x3294cb);_0x5c378e(_0x41b9d5[_0x0aea('0x14')](0x1f4,_0xf51a42[_0x0aea('0x16')]));});});};exports[_0x0aea('0x1e')]=function(_0x1df7f1){return new Promise(function(_0x1f9b02,_0x285529){return db['WhatsappInteraction'][_0x0aea('0x1f')]({'where':_0x1df7f1[_0x0aea('0x1a')]?_0x1df7f1[_0x0aea('0x1a')][_0x0aea('0x1b')]||null:null})[_0x0aea('0x10')](function(_0x5b6445){if(_0x5b6445){return _0x5b6445['addTags'](_0x1df7f1[_0x0aea('0x20')][_0x0aea('0x21')],_[_0x0aea('0x22')](_0x1df7f1[_0x0aea('0x20')],['ids','id'])||{});}})[_0x0aea('0x23')](function(_0x3ac6e1){logger[_0x0aea('0x11')](_0x0aea('0x24'),_0x1df7f1);logger[_0x0aea('0x13')]('AddTags',_0x1df7f1,JSON[_0x0aea('0x1c')](_0x3ac6e1));_0x1f9b02(_0x3ac6e1);})['catch'](function(_0x490816){logger['error'](_0x0aea('0x24'),_0x490816[_0x0aea('0x16')],_0x1df7f1);_0x285529(_this[_0x0aea('0x14')](0x1f4,_0x490816[_0x0aea('0x16')]));});});}; \ No newline at end of file +var _0x7ef9=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','WhatsappInteraction','update','body','options','raw','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','where','addTags','ids','AddTags','debug','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7ef9,0x93));var _0x97ef=function(_0x432739,_0x2c2ab2){_0x432739=_0x432739-0x0;var _0x281ec1=_0x7ef9[_0x432739];return _0x281ec1;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var moment=require(_0x97ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x97ef('0x3'));var fs=require('fs');var Redis=require(_0x97ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ef('0x5'));var logger=require(_0x97ef('0x6'))(_0x97ef('0x7'));var config=require(_0x97ef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x97ef('0x9')]['http']({'port':0x232a});config[_0x97ef('0xa')]=_[_0x97ef('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x97ef('0xc'))[_0x97ef('0xd')](socket);function respondWithRpcPromise(_0x392049,_0x5f95c9,_0x4574e6){return new BPromise(function(_0x59261e,_0x472b97){return client['request'](_0x392049,_0x4574e6)[_0x97ef('0xe')](function(_0xfaa425){logger[_0x97ef('0xf')](_0x97ef('0x10'),_0x5f95c9,_0x97ef('0x11'));logger['debug'](_0x97ef('0x12'),_0x5f95c9,'request\x20sent',JSON[_0x97ef('0x13')](_0xfaa425));if(_0xfaa425[_0x97ef('0x14')]){if(_0xfaa425[_0x97ef('0x14')]['code']===0x1f4){logger[_0x97ef('0x14')](_0x97ef('0x10'),_0x5f95c9,_0xfaa425[_0x97ef('0x14')][_0x97ef('0x15')]);return _0x472b97(_0xfaa425['error'][_0x97ef('0x15')]);}logger[_0x97ef('0x14')](_0x97ef('0x10'),_0x5f95c9,_0xfaa425[_0x97ef('0x14')][_0x97ef('0x15')]);return _0x59261e(_0xfaa425[_0x97ef('0x14')][_0x97ef('0x15')]);}else{logger[_0x97ef('0xf')](_0x97ef('0x10'),_0x5f95c9,_0x97ef('0x11'));_0x59261e(_0xfaa425['result']['message']);}})[_0x97ef('0x16')](function(_0x2f45f6){logger[_0x97ef('0x14')](_0x97ef('0x10'),_0x5f95c9,_0x2f45f6);_0x472b97(_0x2f45f6);});});}exports['UpdateWhatsappInteraction']=function(_0x19a2ea){var _0x1cd673=this;return new Promise(function(_0x2b5409,_0x42ff04){return db[_0x97ef('0x17')][_0x97ef('0x18')](_0x19a2ea[_0x97ef('0x19')],{'raw':_0x19a2ea[_0x97ef('0x1a')]?_0x19a2ea['options'][_0x97ef('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19a2ea[_0x97ef('0x1a')]?_0x19a2ea[_0x97ef('0x1a')]['where']||null:null,'attributes':_0x19a2ea[_0x97ef('0x1a')]?_0x19a2ea[_0x97ef('0x1a')][_0x97ef('0x1c')]||null:null,'limit':_0x19a2ea[_0x97ef('0x1a')]?_0x19a2ea[_0x97ef('0x1a')]['limit']||null:null})['then'](function(_0x4dade4){logger[_0x97ef('0xf')](_0x97ef('0x1d'),_0x19a2ea);logger['debug'](_0x97ef('0x1d'),_0x19a2ea,JSON[_0x97ef('0x13')](_0x4dade4));_0x2b5409(_0x4dade4);})[_0x97ef('0x16')](function(_0x5b908d){logger[_0x97ef('0x14')](_0x97ef('0x1d'),_0x5b908d[_0x97ef('0x15')],_0x19a2ea);_0x42ff04(_0x1cd673[_0x97ef('0x14')](0x1f4,_0x5b908d[_0x97ef('0x15')]));});});};exports[_0x97ef('0x1e')]=function(_0x275532){return new Promise(function(_0x108333,_0x4bdfe9){return db[_0x97ef('0x17')][_0x97ef('0x1f')]({'where':_0x275532[_0x97ef('0x1a')]?_0x275532[_0x97ef('0x1a')][_0x97ef('0x20')]||null:null})[_0x97ef('0xe')](function(_0xaaab77){if(_0xaaab77){return _0xaaab77[_0x97ef('0x21')](_0x275532['body']['ids'],_['omit'](_0x275532[_0x97ef('0x19')],[_0x97ef('0x22'),'id'])||{});}})['spread'](function(_0x108f0){logger['info'](_0x97ef('0x23'),_0x275532);logger[_0x97ef('0x24')](_0x97ef('0x23'),_0x275532,JSON[_0x97ef('0x13')](_0x108f0));_0x108333(_0x108f0);})[_0x97ef('0x16')](function(_0x4da04c){logger[_0x97ef('0x14')]('AddTags',_0x4da04c[_0x97ef('0x15')],_0x275532);_0x4bdfe9(_this[_0x97ef('0x14')](0x1f4,_0x4da04c[_0x97ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 11c3a91..7e7d820 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 _0xa574=['remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x1b1d9e,_0x25dcb4){var _0x395d32=function(_0x4939d1){while(--_0x4939d1){_0x1b1d9e['push'](_0x1b1d9e['shift']());}};_0x395d32(++_0x25dcb4);}(_0xa574,0x1c6));var _0x4a57=function(_0x15204a,_0x25770e){_0x15204a=_0x15204a-0x0;var _0x24aa08=_0xa574[_0x15204a];return _0x24aa08;};'use strict';var WhatsappInteractionEvents=require(_0x4a57('0x0'));var events=[_0x4a57('0x1'),_0x4a57('0x2'),_0x4a57('0x3')];function createListener(_0xc4ac45,_0x98d2dd){return function(_0x1411a5){_0x98d2dd['emit'](_0xc4ac45,_0x1411a5);};}function removeListener(_0x11c0d1,_0x38a429){return function(){WhatsappInteractionEvents[_0x4a57('0x4')](_0x11c0d1,_0x38a429);};}exports[_0x4a57('0x5')]=function(_0x207dd8){for(var _0x1f7012=0x0,_0x47cb38=events[_0x4a57('0x6')];_0x1f7012<_0x47cb38;_0x1f7012++){var _0x5f2c16=events[_0x1f7012];var _0x5cdc1e=createListener(_0x4a57('0x7')+_0x5f2c16,_0x207dd8);WhatsappInteractionEvents['on'](_0x5f2c16,_0x5cdc1e);}}; \ No newline at end of file +var _0x646c=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','length'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0x646c,0x7f));var _0xc646=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x646c[_0x237546];return _0x233e29;};'use strict';var WhatsappInteractionEvents=require(_0xc646('0x0'));var events=['save',_0xc646('0x1'),_0xc646('0x2')];function createListener(_0x27faac,_0x377515){return function(_0x4b42c1){_0x377515[_0xc646('0x3')](_0x27faac,_0x4b42c1);};}function removeListener(_0xb61141,_0x3e8d44){return function(){WhatsappInteractionEvents[_0xc646('0x4')](_0xb61141,_0x3e8d44);};}exports['register']=function(_0x2e6d9f){for(var _0x4b0379=0x0,_0x33886f=events[_0xc646('0x5')];_0x4b0379<_0x33886f;_0x4b0379++){var _0x5e7284=events[_0x4b0379];var _0x2f5d86=createListener(_0xc646('0x6')+_0x5e7284,_0x2e6d9f);WhatsappInteractionEvents['on'](_0x5e7284,_0x2f5d86);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a5d128a..bb981b6 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 _0x965e=['./whatsappMessage.controller','get','isAuthenticated','index','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','/:id/reject','reject','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x965e,0x103));var _0xe965=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0x965e[_0x331298];return _0x3824bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe965('0x0'));var timeout=require(_0xe965('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe965('0x2'));var auth=require(_0xe965('0x3'));var interaction=require(_0xe965('0x4'));var config=require('../../config/environment');var controller=require(_0xe965('0x5'));router[_0xe965('0x6')]('/',auth[_0xe965('0x7')](),controller[_0xe965('0x8')]);router[_0xe965('0x6')]('/describe',auth[_0xe965('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe965('0x7')](),controller[_0xe965('0x9')]);router[_0xe965('0xa')]('/',auth[_0xe965('0x7')](),interaction[_0xe965('0xb')](_0xe965('0xc'),_0xe965('0xd')),controller[_0xe965('0xe')]);router['post'](_0xe965('0xf'),controller['status']);router[_0xe965('0x10')](_0xe965('0x11'),auth[_0xe965('0x7')](),controller['update']);router[_0xe965('0x10')]('/:id/accept',auth[_0xe965('0x7')](),controller['accept']);router['put'](_0xe965('0x12'),auth[_0xe965('0x7')](),controller[_0xe965('0x13')]);router[_0xe965('0x14')](_0xe965('0x11'),auth[_0xe965('0x7')](),controller['destroy']);module[_0xe965('0x15')]=router; \ No newline at end of file +var _0x2bbd=['post','whatsapp','whatsappmessage:create','create','put','/:id','update','/:id/accept','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x55966d,_0x56ea9a){var _0xe7c454=function(_0x6b9585){while(--_0x6b9585){_0x55966d['push'](_0x55966d['shift']());}};_0xe7c454(++_0x56ea9a);}(_0x2bbd,0x11d));var _0xd2bb=function(_0x418228,_0x36e8d5){_0x418228=_0x418228-0x0;var _0x284e16=_0x2bbd[_0x418228];return _0x284e16;};'use strict';var multer=require('multer');var util=require(_0xd2bb('0x0'));var path=require(_0xd2bb('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2bb('0x2'));var router=express[_0xd2bb('0x3')]();var fs_extra=require(_0xd2bb('0x4'));var auth=require(_0xd2bb('0x5'));var interaction=require(_0xd2bb('0x6'));var config=require(_0xd2bb('0x7'));var controller=require(_0xd2bb('0x8'));router[_0xd2bb('0x9')]('/',auth['isAuthenticated'](),controller[_0xd2bb('0xa')]);router['get'](_0xd2bb('0xb'),auth[_0xd2bb('0xc')](),controller[_0xd2bb('0xd')]);router[_0xd2bb('0x9')]('/:id',auth[_0xd2bb('0xc')](),controller[_0xd2bb('0xe')]);router[_0xd2bb('0xf')]('/',auth[_0xd2bb('0xc')](),interaction['tracked'](_0xd2bb('0x10'),_0xd2bb('0x11')),controller[_0xd2bb('0x12')]);router['post']('/:id/status',controller['status']);router[_0xd2bb('0x13')](_0xd2bb('0x14'),auth[_0xd2bb('0xc')](),controller[_0xd2bb('0x15')]);router['put'](_0xd2bb('0x16'),auth[_0xd2bb('0xc')](),controller['accept']);router[_0xd2bb('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xd2bb('0x17')](_0xd2bb('0x14'),auth[_0xd2bb('0xc')](),controller[_0xd2bb('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fe3f54d..2d68ee2 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 _0x057f=['STRING','exports','TEXT','BOOLEAN','out','DATE'];(function(_0x5292d6,_0x3540b8){var _0x538cf3=function(_0xe4cb6d){while(--_0xe4cb6d){_0x5292d6['push'](_0x5292d6['shift']());}};_0x538cf3(++_0x3540b8);}(_0x057f,0x85));var _0xf057=function(_0x3ce140,_0x98f34b){_0x3ce140=_0x3ce140-0x0;var _0x37f098=_0x057f[_0x3ce140];return _0x37f098;};'use strict';var Sequelize=require('sequelize');module[_0xf057('0x0')]={'body':{'type':Sequelize[_0xf057('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf057('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf057('0x3')),'defaultValue':_0xf057('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf057('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf057('0x5')]},'providerResponse':{'type':Sequelize[_0xf057('0x1')]}}; \ No newline at end of file +var _0x3c17=['ENUM','out','STRING','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3209d4,_0x4104df){var _0x3c7d1a=function(_0x591133){while(--_0x591133){_0x3209d4['push'](_0x3209d4['shift']());}};_0x3c7d1a(++_0x4104df);}(_0x3c17,0x1a1));var _0x73c1=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3c17[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x73c1('0x0'));module['exports']={'body':{'type':Sequelize[_0x73c1('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x73c1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x73c1('0x3')]('in',_0x73c1('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x73c1('0x5')](0xbe)},'phone':{'type':Sequelize[_0x73c1('0x5')]},'readAt':{'type':Sequelize[_0x73c1('0x6')]},'secret':{'type':Sequelize[_0x73c1('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x73c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1a31ee7..a7d18be 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 _0x2573=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','Sequelize','SELECT','contact','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x42ddc1,_0x3c05e4){var _0x12187f=function(_0x103844){while(--_0x103844){_0x42ddc1['push'](_0x42ddc1['shift']());}};_0x12187f(++_0x3c05e4);}(_0x2573,0x109));var _0x3257=function(_0x1f1c04,_0x2dcdef){_0x1f1c04=_0x1f1c04-0x0;var _0x252d80=_0x2573[_0x1f1c04];return _0x252d80;};'use strict';var emlformat=require(_0x3257('0x0'));var rimraf=require(_0x3257('0x1'));var zipdir=require(_0x3257('0x2'));var jsonpatch=require(_0x3257('0x3'));var rp=require(_0x3257('0x4'));var moment=require(_0x3257('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3257('0x6'));var util=require(_0x3257('0x7'));var path=require(_0x3257('0x8'));var sox=require(_0x3257('0x9'));var csv=require(_0x3257('0xa'));var ejs=require(_0x3257('0xb'));var fs=require('fs');var fs_extra=require(_0x3257('0xc'));var _=require(_0x3257('0xd'));var squel=require('squel');var crypto=require(_0x3257('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3257('0xf'));var toCsv=require(_0x3257('0xa'));var querystring=require(_0x3257('0x10'));var Papa=require('papaparse');var Redis=require(_0x3257('0x11'));var authService=require(_0x3257('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3257('0x13'));var hardwareService=require(_0x3257('0x14'));var logger=require(_0x3257('0x15'))(_0x3257('0x16'));var utils=require(_0x3257('0x17'));var config=require(_0x3257('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3257('0x19'))['db'];config[_0x3257('0x1a')]=_[_0x3257('0x1b')](config[_0x3257('0x1a')],{'host':_0x3257('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3257('0x1a')]));require('./whatsappMessage.socket')[_0x3257('0x1d')](socket);var jayson=require(_0x3257('0x1e'));var client=jayson['client'][_0x3257('0x1f')]({'port':0x232c});var client9002=jayson[_0x3257('0x20')][_0x3257('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x391c5d,_0x3d2442,_0x5d4fa7,_0x22ae54){return new BPromise(function(_0x2cc861,_0xbea351){var _0x2617da=_0x22ae54||client;return _0x2617da[_0x3257('0x21')](_0x391c5d,_0x5d4fa7)[_0x3257('0x22')](function(_0x401042){logger[_0x3257('0x23')](_0x3257('0x24'),_0x3d2442,'request\x20sent');logger[_0x3257('0x25')](_0x3257('0x26'),_0x3d2442,_0x3257('0x27'),JSON[_0x3257('0x28')](_0x401042));if(_0x401042[_0x3257('0x29')]){if(_0x401042[_0x3257('0x29')]['code']===0x1f4){logger[_0x3257('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x401042[_0x3257('0x29')]['message']);return _0xbea351(_0x401042['error'][_0x3257('0x2a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x401042[_0x3257('0x29')][_0x3257('0x2a')]);return _0x2cc861(_0x401042[_0x3257('0x29')][_0x3257('0x2a')]);}else{logger['info'](_0x3257('0x24'),_0x3d2442,_0x3257('0x27'));_0x2cc861(_0x401042[_0x3257('0x2b')][_0x3257('0x2a')]);}})[_0x3257('0x2c')](function(_0x5edbf5){logger[_0x3257('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x3d2442,_0x5edbf5);_0xbea351(_0x5edbf5);});});}function respondWithStatusCode(_0x4d2def,_0x1f961c){_0x1f961c=_0x1f961c||0xcc;return function(_0x2f541f){if(_0x2f541f){return _0x4d2def['sendStatus'](_0x1f961c);}return _0x4d2def[_0x3257('0x2d')](_0x1f961c)[_0x3257('0x2e')]();};}function respondWithResult(_0x15b6e0,_0x21833b){_0x21833b=_0x21833b||0xc8;return function(_0x3f9718){if(_0x3f9718){return _0x15b6e0[_0x3257('0x2d')](_0x21833b)[_0x3257('0x2f')](_0x3f9718);}};}function respondWithFilteredResult(_0x5e6f24,_0x1e99d8){return function(_0x102f13){if(_0x102f13){var _0x75d6ef=typeof _0x1e99d8[_0x3257('0x30')]===_0x3257('0x31')&&typeof _0x1e99d8[_0x3257('0x32')]===_0x3257('0x31');var _0x127bc3=_0x102f13[_0x3257('0x33')];var _0x27967a=_0x75d6ef?0x0:_0x1e99d8['offset'];var _0x5510f5=_0x75d6ef?_0x102f13[_0x3257('0x33')]:_0x1e99d8[_0x3257('0x30')]+_0x1e99d8[_0x3257('0x32')];var _0x744f64;if(_0x5510f5>=_0x127bc3){_0x5510f5=_0x127bc3;_0x744f64=0xc8;}else{_0x744f64=0xce;}_0x5e6f24[_0x3257('0x2d')](_0x744f64);return _0x5e6f24['set'](_0x3257('0x34'),_0x27967a+'-'+_0x5510f5+'/'+_0x127bc3)[_0x3257('0x2f')](_0x102f13);}return null;};}function patchUpdates(_0x33e7c9){return function(_0x1605cb){try{jsonpatch[_0x3257('0x35')](_0x1605cb,_0x33e7c9,!![]);}catch(_0x494d67){return BPromise[_0x3257('0x36')](_0x494d67);}return _0x1605cb[_0x3257('0x37')]();};}function saveUpdates(_0x37cb63,_0x50b1f8){return function(_0x33d876){if(_0x33d876){return _0x33d876[_0x3257('0x38')](_0x37cb63)[_0x3257('0x22')](function(_0x42a8fc){return _0x42a8fc;});}return null;};}function removeEntity(_0x4090fa,_0x2ad17c){return function(_0xf2a9cc){if(_0xf2a9cc){return _0xf2a9cc[_0x3257('0x39')]()[_0x3257('0x22')](function(){_0x4090fa[_0x3257('0x2d')](0xcc)[_0x3257('0x2e')]();});}};}function handleEntityNotFound(_0x48f40b,_0x5be1a4){return function(_0xf267ad){if(!_0xf267ad){_0x48f40b['sendStatus'](0x194);}return _0xf267ad;};}function handleError(_0x52a124,_0x15f3b1){_0x15f3b1=_0x15f3b1||0x1f4;return function(_0x2bb6a7){logger[_0x3257('0x29')](_0x2bb6a7[_0x3257('0x3a')]);if(_0x2bb6a7[_0x3257('0x3b')]){delete _0x2bb6a7[_0x3257('0x3b')];}_0x52a124[_0x3257('0x2d')](_0x15f3b1)[_0x3257('0x3c')](_0x2bb6a7);};}exports[_0x3257('0x3d')]=function(_0x23493d,_0x21d9a5){var _0x26fc5c={},_0x22c529={},_0x2ccfee={'count':0x0,'rows':[]};var _0x116246=_[_0x3257('0x3e')](db['WhatsappMessage'][_0x3257('0x3f')],function(_0x530ca0){return{'name':_0x530ca0[_0x3257('0x40')],'type':_0x530ca0[_0x3257('0x41')][_0x3257('0x42')]};});_0x22c529['model']=_[_0x3257('0x3e')](_0x116246,_0x3257('0x3b'));_0x22c529[_0x3257('0x43')]=_[_0x3257('0x44')](_0x23493d['query']);_0x22c529['filters']=_[_0x3257('0x45')](_0x22c529[_0x3257('0x46')],_0x22c529['query']);_0x26fc5c['attributes']=_['intersection'](_0x22c529['model'],qs[_0x3257('0x47')](_0x23493d[_0x3257('0x43')][_0x3257('0x47')]));_0x26fc5c[_0x3257('0x48')]=_0x26fc5c['attributes'][_0x3257('0x49')]?_0x26fc5c[_0x3257('0x48')]:_0x22c529[_0x3257('0x46')];if(!_0x23493d[_0x3257('0x43')][_0x3257('0x4a')](_0x3257('0x4b'))){_0x26fc5c['limit']=qs[_0x3257('0x32')](_0x23493d[_0x3257('0x43')][_0x3257('0x32')]);_0x26fc5c[_0x3257('0x30')]=qs[_0x3257('0x30')](_0x23493d[_0x3257('0x43')][_0x3257('0x30')]);}_0x26fc5c[_0x3257('0x4c')]=qs['sort'](_0x23493d[_0x3257('0x43')][_0x3257('0x4d')]);_0x26fc5c['where']=qs[_0x3257('0x4e')](_[_0x3257('0x4f')](_0x23493d['query'],_0x22c529[_0x3257('0x4e')]),_0x116246);if(_0x23493d['query'][_0x3257('0x50')]){_0x26fc5c[_0x3257('0x51')]=_[_0x3257('0x52')](_0x26fc5c[_0x3257('0x51')],{'$or':_[_0x3257('0x3e')](_0x116246,function(_0xf66146){if(_0xf66146['type']!=='VIRTUAL'){var _0xa4a499={};_0xa4a499[_0xf66146['name']]={'$like':'%'+_0x23493d['query']['filter']+'%'};return _0xa4a499;}})});}_0x26fc5c=_[_0x3257('0x52')]({},_0x26fc5c,_0x23493d[_0x3257('0x53')]);var _0xc80848={'where':_0x26fc5c[_0x3257('0x51')]};return db[_0x3257('0x54')][_0x3257('0x33')](_0xc80848)[_0x3257('0x22')](function(_0x1f4554){_0x2ccfee['count']=_0x1f4554;if(_0x23493d['query'][_0x3257('0x55')]){_0x26fc5c[_0x3257('0x56')]=[{'all':!![]}];}return db[_0x3257('0x54')][_0x3257('0x57')](_0x26fc5c);})[_0x3257('0x22')](function(_0xf9cacf){_0x2ccfee[_0x3257('0x58')]=_0xf9cacf;return _0x2ccfee;})[_0x3257('0x22')](respondWithFilteredResult(_0x21d9a5,_0x26fc5c))[_0x3257('0x2c')](handleError(_0x21d9a5,null));};exports[_0x3257('0x59')]=function(_0x2473b,_0x1cb61b){var _0x291819={'raw':!![],'where':{'id':_0x2473b[_0x3257('0x5a')]['id']}},_0x3a4683={};_0x3a4683['model']=_[_0x3257('0x44')](db[_0x3257('0x54')]['rawAttributes']);_0x3a4683['query']=_[_0x3257('0x44')](_0x2473b[_0x3257('0x43')]);_0x3a4683[_0x3257('0x4e')]=_[_0x3257('0x45')](_0x3a4683[_0x3257('0x46')],_0x3a4683[_0x3257('0x43')]);_0x291819[_0x3257('0x48')]=_[_0x3257('0x45')](_0x3a4683['model'],qs[_0x3257('0x47')](_0x2473b[_0x3257('0x43')][_0x3257('0x47')]));_0x291819[_0x3257('0x48')]=_0x291819['attributes']['length']?_0x291819['attributes']:_0x3a4683[_0x3257('0x46')];if(_0x2473b['query'][_0x3257('0x55')]){_0x291819[_0x3257('0x56')]=[{'all':!![]}];}_0x291819=_[_0x3257('0x52')]({},_0x291819,_0x2473b[_0x3257('0x53')]);return db['WhatsappMessage'][_0x3257('0x5b')](_0x291819)[_0x3257('0x22')](handleEntityNotFound(_0x1cb61b,null))['then'](respondWithResult(_0x1cb61b,null))[_0x3257('0x2c')](handleError(_0x1cb61b,null));};exports[_0x3257('0x5c')]=function(_0x238465,_0x3e33b4){return db[_0x3257('0x54')]['create'](_0x238465[_0x3257('0x5d')],{})[_0x3257('0x22')](respondWithResult(_0x3e33b4,0xc9))[_0x3257('0x2c')](handleError(_0x3e33b4,null));};exports[_0x3257('0x38')]=function(_0x15f0d8,_0x2d99f0){if(_0x15f0d8[_0x3257('0x5d')]['id']){delete _0x15f0d8[_0x3257('0x5d')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x15f0d8['params']['id']}})[_0x3257('0x22')](handleEntityNotFound(_0x2d99f0,null))[_0x3257('0x22')](saveUpdates(_0x15f0d8[_0x3257('0x5d')],null))[_0x3257('0x22')](respondWithResult(_0x2d99f0,null))[_0x3257('0x2c')](handleError(_0x2d99f0,null));};exports[_0x3257('0x39')]=function(_0x18ebdd,_0x497449){return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x18ebdd[_0x3257('0x5a')]['id']}})[_0x3257('0x22')](handleEntityNotFound(_0x497449,null))[_0x3257('0x22')](removeEntity(_0x497449,null))[_0x3257('0x2c')](handleError(_0x497449,null));};exports[_0x3257('0x5e')]=function(_0x5a91d2,_0x531794){return db[_0x3257('0x54')][_0x3257('0x5e')]()[_0x3257('0x22')](respondWithResult(_0x531794,null))[_0x3257('0x2c')](handleError(_0x531794,null));};var interaction_log=require(_0x3257('0x15'))(_0x3257('0x5f'));exports['accept']=function(_0xd56603,_0x51535a,_0xd1d13d){var _0x3be870={'agent':{},'channel':_0x3257('0x60')};if(_0xd56603[_0x3257('0x5d')]['id']){delete _0xd56603[_0x3257('0x5d')]['id'];}_0xd56603['body'][_0x3257('0x61')]=!![];_0xd56603[_0x3257('0x5d')][_0x3257('0x62')]=moment()[_0x3257('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0xd56603[_0x3257('0x5d')]['UserId']=_0xd56603[_0x3257('0x5d')][_0x3257('0x64')]||_0xd56603[_0x3257('0x65')]['id'];_0x3be870[_0x3257('0x66')]['id']=_0xd56603[_0x3257('0x5d')]['UserId'];return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0xd56603['params']['id'],'UserId':null}})[_0x3257('0x22')](handleEntityNotFound(_0x51535a,null))[_0x3257('0x22')](saveUpdates(_0xd56603[_0x3257('0x5d')],null))[_0x3257('0x22')](function(_0x1eb0c2){if(_0x1eb0c2){_0x3be870['message']=_0x1eb0c2[_0x3257('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1eb0c2[_0x3257('0x68')]}});}return null;})[_0x3257('0x22')](handleEntityNotFound(_0x51535a,null))['then'](function(_0x204e7b){if(_0x204e7b){return _0x204e7b['update']({'UserId':_0xd56603[_0x3257('0x5d')]['UserId'],'read1stAt':_[_0x3257('0x69')](_0x204e7b[_0x3257('0x6a')])?moment()[_0x3257('0x63')](_0x3257('0x6b')):undefined});}return null;})[_0x3257('0x22')](function(_0x176c98){if(_0x176c98){_0x3be870[_0x3257('0x6c')]=_0x176c98[_0x3257('0x67')]({'plain':!![]});interaction_log['info'](_0x3257('0x6d'),_0xd56603[_0x3257('0x65')]['id'],_0xd56603[_0x3257('0x65')][_0x3257('0x3b')],_0xd56603[_0x3257('0x65')]['role'],_0x3be870[_0x3257('0x6c')]['id'],_0xd56603[_0x3257('0x5d')]?JSON[_0x3257('0x28')](_0xd56603[_0x3257('0x5d')]):'null');return respondWithRpcPromise(_0x3257('0x6e'),_0x3257('0x6f'),_0x3be870);}return null;})[_0x3257('0x22')](function(_0x73e99d){var _0x1f8874='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x73e99d[_0x3257('0x2a')][_0x3257('0x70')];return db[_0x3257('0x71')][_0x3257('0x43')](_0x1f8874,{'type':db['Sequelize'][_0x3257('0x72')]['SELECT'],'raw':!![]})[_0x3257('0x22')](function(_0x120152){return _0x120152;});})[_0x3257('0x22')](function(_0x56cf99){if(_0x56cf99){_0x3be870[_0x3257('0x2a')]['contact']=_0x56cf99[0x0];if(!_0xd56603[_0x3257('0x5d')][_0x3257('0x64')])return;return db[_0x3257('0x73')][_0x3257('0x5b')]({'where':{'id':_0xd56603[_0x3257('0x5d')][_0x3257('0x64')],'role':_0x3257('0x66')},'attributes':['id',_0x3257('0x3b'),_0x3257('0x74'),_0x3257('0x75'),_0x3257('0x76')],'raw':!![]});}return null;})['then'](function(_0x5a2186){if(!_0x5a2186)return null;_0x3be870[_0x3257('0x2a')]['agent']=_0x5a2186;return _0x3be870;})[_0x3257('0x22')](function(_0x43fc3c){if(_0x43fc3c){if(_0xd56603[_0x3257('0x5d')][_0x3257('0x77')]){_0x3be870[_0x3257('0x2a')][_0x3257('0x78')]=util[_0x3257('0x63')]('SIP/%s',_0xd56603[_0x3257('0x65')][_0x3257('0x3b')]);_0x3be870[_0x3257('0x2a')][_0x3257('0x79')]=_0x3be870['channel'];_0x3be870['message']['motionChannel']=_0x3be870[_0x3257('0x79')];_0x3be870['message']['event']='accept';return respondWithRpcPromise(_0x3257('0x7a'),_0x3257('0x7a'),{'event':_0x3257('0x7b'),'message':_0x3be870[_0x3257('0x2a')]},client9002)[_0x3257('0x22')](function(){return _0x3be870;});}return _0x3be870;}return null;})['then'](respondWithResult(_0x51535a,null))[_0x3257('0x2c')](handleError(_0x51535a,null));};var interaction_log=require(_0x3257('0x15'))('whatsapp-interactions');exports[_0x3257('0x36')]=function(_0x10a360,_0x1f08eb,_0x229c7d){var _0x54f655={'agent':{},'channel':'whatsapp'};if(_0x10a360['body']['id']){delete _0x10a360['body']['id'];}_0x10a360['body'][_0x3257('0x64')]=_0x10a360[_0x3257('0x5d')][_0x3257('0x64')]||_0x10a360[_0x3257('0x65')]['id'];_0x54f655[_0x3257('0x66')]['id']=_0x10a360[_0x3257('0x5d')][_0x3257('0x64')];return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x10a360[_0x3257('0x5a')]['id'],'UserId':null}})[_0x3257('0x22')](handleEntityNotFound(_0x1f08eb,null))[_0x3257('0x22')](function(_0x38fca8){if(_0x38fca8){_0x54f655[_0x3257('0x2a')]=_0x38fca8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3257('0x5b')]({'where':{'id':_0x38fca8[_0x3257('0x68')]}});}return null;})[_0x3257('0x22')](handleEntityNotFound(_0x1f08eb,null))[_0x3257('0x22')](function(_0x585c2c){if(_0x585c2c){_0x54f655[_0x3257('0x6c')]=_0x585c2c[_0x3257('0x67')]({'plain':!![]});interaction_log[_0x3257('0x23')](_0x3257('0x7c'),_0x10a360[_0x3257('0x65')]['id'],_0x10a360[_0x3257('0x65')][_0x3257('0x3b')],_0x10a360[_0x3257('0x65')][_0x3257('0x7d')],_0x54f655[_0x3257('0x6c')]['id'],_0x10a360[_0x3257('0x5d')]?JSON['stringify'](_0x10a360[_0x3257('0x5d')]):_0x3257('0x7e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x54f655);}return null;})[_0x3257('0x22')](function(_0x5ba756){var _0x4c0fc8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ba756[_0x3257('0x2a')]['ContactId'];return db[_0x3257('0x71')]['query'](_0x4c0fc8,{'type':db[_0x3257('0x7f')][_0x3257('0x72')][_0x3257('0x80')],'raw':!![]})['then'](function(_0x429205){return _0x429205;});})['then'](function(_0x2cdc82){if(_0x2cdc82){_0x54f655[_0x3257('0x2a')][_0x3257('0x81')]=_0x2cdc82[0x0];if(!_0x10a360[_0x3257('0x5d')][_0x3257('0x64')])return;return db['User']['find']({'where':{'id':_0x10a360[_0x3257('0x5d')]['UserId'],'role':_0x3257('0x66')},'attributes':['id',_0x3257('0x3b'),_0x3257('0x74'),_0x3257('0x75'),_0x3257('0x76')],'raw':!![]});}return null;})[_0x3257('0x22')](function(_0x429b1e){if(!_0x429b1e)return null;_0x54f655[_0x3257('0x2a')][_0x3257('0x66')]=_0x429b1e;return _0x54f655;})[_0x3257('0x22')](function(_0x48b94){if(_0x48b94){_0x48b94['message'][_0x3257('0x78')]=util['format'](_0x3257('0x82'),_0x10a360[_0x3257('0x65')][_0x3257('0x3b')]);_0x48b94[_0x3257('0x2a')][_0x3257('0x79')]=_0x54f655[_0x3257('0x79')];_0x48b94['message']['motionChannel']=_0x54f655[_0x3257('0x79')];_0x48b94[_0x3257('0x2a')]['event']=_0x3257('0x36');respondWithRpcPromise(_0x3257('0x7a'),_0x3257('0x7a'),{'event':_0x3257('0x83'),'message':_0x48b94[_0x3257('0x2a')]},client9002);return _0x54f655;}return null;})[_0x3257('0x22')](respondWithResult(_0x1f08eb,null))['catch'](handleError(_0x1f08eb,null));};exports[_0x3257('0x2d')]=function(_0x3f5cd4,_0x4642a5,_0x4a4ba9){if(_0x3f5cd4[_0x3257('0x5d')]['id']){delete _0x3f5cd4[_0x3257('0x5d')]['id'];}var _0x1fbd01;return db[_0x3257('0x54')][_0x3257('0x5b')]({'where':{'id':_0x3f5cd4[_0x3257('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4642a5,null))[_0x3257('0x22')](function(_0x105103){if(_0x105103){_0x1fbd01=_0x105103;return db[_0x3257('0x84')][_0x3257('0x5b')]({'where':{'id':_0x105103['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x4642a5,null))[_0x3257('0x22')](function(_0x376b49){if(_0x376b49){logger['debug'](_0x3257('0x85'),'status','received\x20delivery\x20report\x20from',_0x376b49['type'],util[_0x3257('0x86')](_0x3f5cd4[_0x3257('0x5d')],{'showHidden':![],'depth':null}));switch(_0x376b49['type']){case _0x3257('0x87'):if(_0x3f5cd4['body'][_0x3257('0x88')]&&_0x3f5cd4['body'][_0x3257('0x88')]===_0x1fbd01[_0x3257('0x89')]&&_0x3f5cd4[_0x3257('0x5d')][_0x3257('0x8a')]&&_0x3f5cd4['body']['MessageStatus']==='read'){return _0x1fbd01['update']({'read':!![]});}else{logger[_0x3257('0x29')](_0x3257('0x8b'),_0x3257('0x2d'),_0x3257('0x87'),util['inspect'](_0x3f5cd4[_0x3257('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1fbd01;}})['then'](respondWithResult(_0x4642a5,null))[_0x3257('0x2c')](handleError(_0x4642a5,null));}; \ No newline at end of file +var _0x647a=['null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','localhost','redis','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','WhatsappMessage','fieldName','type','model','map','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','intersection','create','update','body','find','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','read1stAt','interaction'];(function(_0x52fcdd,_0x1d6c9b){var _0x1a437d=function(_0x46c611){while(--_0x46c611){_0x52fcdd['push'](_0x52fcdd['shift']());}};_0x1a437d(++_0x1d6c9b);}(_0x647a,0xac));var _0xa647=function(_0x1f02bc,_0x4cdada){_0x1f02bc=_0x1f02bc-0x0;var _0x378387=_0x647a[_0x1f02bc];return _0x378387;};'use strict';var emlformat=require(_0xa647('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa647('0x1'));var jsonpatch=require(_0xa647('0x2'));var rp=require(_0xa647('0x3'));var moment=require('moment');var BPromise=require(_0xa647('0x4'));var Mustache=require('mustache');var util=require(_0xa647('0x5'));var path=require(_0xa647('0x6'));var sox=require(_0xa647('0x7'));var csv=require(_0xa647('0x8'));var ejs=require(_0xa647('0x9'));var fs=require('fs');var fs_extra=require(_0xa647('0xa'));var _=require('lodash');var squel=require(_0xa647('0xb'));var crypto=require(_0xa647('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa647('0x8'));var querystring=require('querystring');var Papa=require(_0xa647('0xd'));var Redis=require(_0xa647('0xe'));var authService=require(_0xa647('0xf'));var qs=require(_0xa647('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa647('0x11'));var logger=require(_0xa647('0x12'))(_0xa647('0x13'));var utils=require(_0xa647('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa647('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa647('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa647('0x17')]));require('./whatsappMessage.socket')[_0xa647('0x18')](socket);var jayson=require(_0xa647('0x19'));var client=jayson[_0xa647('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0xa647('0x1a')][_0xa647('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x254212,_0x51c151,_0x4e604c,_0x7f4182){return new BPromise(function(_0x5414a6,_0x3db7d7){var _0x404730=_0x7f4182||client;return _0x404730[_0xa647('0x1c')](_0x254212,_0x4e604c)['then'](function(_0x4b306b){logger[_0xa647('0x1d')](_0xa647('0x1e'),_0x51c151,_0xa647('0x1f'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x51c151,_0xa647('0x1f'),JSON[_0xa647('0x20')](_0x4b306b));if(_0x4b306b[_0xa647('0x21')]){if(_0x4b306b[_0xa647('0x21')][_0xa647('0x22')]===0x1f4){logger[_0xa647('0x21')](_0xa647('0x1e'),_0x51c151,_0x4b306b[_0xa647('0x21')][_0xa647('0x23')]);return _0x3db7d7(_0x4b306b['error'][_0xa647('0x23')]);}logger[_0xa647('0x21')](_0xa647('0x1e'),_0x51c151,_0x4b306b[_0xa647('0x21')][_0xa647('0x23')]);return _0x5414a6(_0x4b306b[_0xa647('0x21')][_0xa647('0x23')]);}else{logger[_0xa647('0x1d')](_0xa647('0x1e'),_0x51c151,'request\x20sent');_0x5414a6(_0x4b306b['result'][_0xa647('0x23')]);}})[_0xa647('0x24')](function(_0x1ab30e){logger[_0xa647('0x21')](_0xa647('0x1e'),_0x51c151,_0x1ab30e);_0x3db7d7(_0x1ab30e);});});}function respondWithStatusCode(_0x298b72,_0x1e0160){_0x1e0160=_0x1e0160||0xcc;return function(_0x58f4cf){if(_0x58f4cf){return _0x298b72['sendStatus'](_0x1e0160);}return _0x298b72[_0xa647('0x25')](_0x1e0160)[_0xa647('0x26')]();};}function respondWithResult(_0x462979,_0x1178aa){_0x1178aa=_0x1178aa||0xc8;return function(_0x5537f4){if(_0x5537f4){return _0x462979[_0xa647('0x25')](_0x1178aa)[_0xa647('0x27')](_0x5537f4);}};}function respondWithFilteredResult(_0xf6138c,_0x23aeca){return function(_0xe1173f){if(_0xe1173f){var _0x2c8cb2=typeof _0x23aeca[_0xa647('0x28')]===_0xa647('0x29')&&typeof _0x23aeca[_0xa647('0x2a')]===_0xa647('0x29');var _0x20a99d=_0xe1173f['count'];var _0x36a392=_0x2c8cb2?0x0:_0x23aeca[_0xa647('0x28')];var _0x1027a5=_0x2c8cb2?_0xe1173f['count']:_0x23aeca[_0xa647('0x28')]+_0x23aeca['limit'];var _0x224704;if(_0x1027a5>=_0x20a99d){_0x1027a5=_0x20a99d;_0x224704=0xc8;}else{_0x224704=0xce;}_0xf6138c[_0xa647('0x25')](_0x224704);return _0xf6138c[_0xa647('0x2b')](_0xa647('0x2c'),_0x36a392+'-'+_0x1027a5+'/'+_0x20a99d)[_0xa647('0x27')](_0xe1173f);}return null;};}function patchUpdates(_0x28e48b){return function(_0x51aaa8){try{jsonpatch[_0xa647('0x2d')](_0x51aaa8,_0x28e48b,!![]);}catch(_0x4ccc31){return BPromise[_0xa647('0x2e')](_0x4ccc31);}return _0x51aaa8[_0xa647('0x2f')]();};}function saveUpdates(_0x400902,_0x3b9a68){return function(_0x3869dd){if(_0x3869dd){return _0x3869dd['update'](_0x400902)[_0xa647('0x30')](function(_0x423d94){return _0x423d94;});}return null;};}function removeEntity(_0x196675,_0x238813){return function(_0x1b2e9d){if(_0x1b2e9d){return _0x1b2e9d[_0xa647('0x31')]()[_0xa647('0x30')](function(){_0x196675['status'](0xcc)[_0xa647('0x26')]();});}};}function handleEntityNotFound(_0x2ed3ba,_0x4a84e9){return function(_0x45036f){if(!_0x45036f){_0x2ed3ba[_0xa647('0x32')](0x194);}return _0x45036f;};}function handleError(_0x50f3af,_0x2c6651){_0x2c6651=_0x2c6651||0x1f4;return function(_0xc7a497){logger['error'](_0xc7a497[_0xa647('0x33')]);if(_0xc7a497[_0xa647('0x34')]){delete _0xc7a497['name'];}_0x50f3af[_0xa647('0x25')](_0x2c6651)[_0xa647('0x35')](_0xc7a497);};}exports[_0xa647('0x36')]=function(_0x4f7f21,_0x50458f){var _0xb09a20={},_0x217483={},_0x46d327={'count':0x0,'rows':[]};var _0x4e26df=_['map'](db[_0xa647('0x37')]['rawAttributes'],function(_0xb687cc){return{'name':_0xb687cc[_0xa647('0x38')],'type':_0xb687cc[_0xa647('0x39')]['key']};});_0x217483[_0xa647('0x3a')]=_[_0xa647('0x3b')](_0x4e26df,'name');_0x217483['query']=_[_0xa647('0x3c')](_0x4f7f21['query']);_0x217483[_0xa647('0x3d')]=_['intersection'](_0x217483['model'],_0x217483[_0xa647('0x3e')]);_0xb09a20['attributes']=_['intersection'](_0x217483['model'],qs[_0xa647('0x3f')](_0x4f7f21[_0xa647('0x3e')][_0xa647('0x3f')]));_0xb09a20[_0xa647('0x40')]=_0xb09a20[_0xa647('0x40')][_0xa647('0x41')]?_0xb09a20[_0xa647('0x40')]:_0x217483[_0xa647('0x3a')];if(!_0x4f7f21[_0xa647('0x3e')][_0xa647('0x42')](_0xa647('0x43'))){_0xb09a20[_0xa647('0x2a')]=qs[_0xa647('0x2a')](_0x4f7f21['query'][_0xa647('0x2a')]);_0xb09a20[_0xa647('0x28')]=qs['offset'](_0x4f7f21['query']['offset']);}_0xb09a20[_0xa647('0x44')]=qs[_0xa647('0x45')](_0x4f7f21[_0xa647('0x3e')][_0xa647('0x45')]);_0xb09a20[_0xa647('0x46')]=qs['filters'](_['pick'](_0x4f7f21[_0xa647('0x3e')],_0x217483[_0xa647('0x3d')]),_0x4e26df);if(_0x4f7f21[_0xa647('0x3e')][_0xa647('0x47')]){_0xb09a20[_0xa647('0x46')]=_[_0xa647('0x48')](_0xb09a20[_0xa647('0x46')],{'$or':_['map'](_0x4e26df,function(_0x198b4f){if(_0x198b4f[_0xa647('0x39')]!==_0xa647('0x49')){var _0x4e0150={};_0x4e0150[_0x198b4f[_0xa647('0x34')]]={'$like':'%'+_0x4f7f21[_0xa647('0x3e')][_0xa647('0x47')]+'%'};return _0x4e0150;}})});}_0xb09a20=_['merge']({},_0xb09a20,_0x4f7f21[_0xa647('0x4a')]);var _0x29aba0={'where':_0xb09a20['where']};return db[_0xa647('0x37')]['count'](_0x29aba0)[_0xa647('0x30')](function(_0xb4b6bf){_0x46d327['count']=_0xb4b6bf;if(_0x4f7f21[_0xa647('0x3e')][_0xa647('0x4b')]){_0xb09a20[_0xa647('0x4c')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0xb09a20);})[_0xa647('0x30')](function(_0x3003cc){_0x46d327[_0xa647('0x4d')]=_0x3003cc;return _0x46d327;})['then'](respondWithFilteredResult(_0x50458f,_0xb09a20))[_0xa647('0x24')](handleError(_0x50458f,null));};exports[_0xa647('0x4e')]=function(_0x28af4a,_0x49475f){var _0x19f3c5={'raw':!![],'where':{'id':_0x28af4a[_0xa647('0x4f')]['id']}},_0x43b06a={};_0x43b06a[_0xa647('0x3a')]=_[_0xa647('0x3c')](db[_0xa647('0x37')][_0xa647('0x50')]);_0x43b06a[_0xa647('0x3e')]=_[_0xa647('0x3c')](_0x28af4a[_0xa647('0x3e')]);_0x43b06a[_0xa647('0x3d')]=_[_0xa647('0x51')](_0x43b06a[_0xa647('0x3a')],_0x43b06a[_0xa647('0x3e')]);_0x19f3c5[_0xa647('0x40')]=_['intersection'](_0x43b06a[_0xa647('0x3a')],qs[_0xa647('0x3f')](_0x28af4a['query'][_0xa647('0x3f')]));_0x19f3c5[_0xa647('0x40')]=_0x19f3c5['attributes'][_0xa647('0x41')]?_0x19f3c5[_0xa647('0x40')]:_0x43b06a[_0xa647('0x3a')];if(_0x28af4a['query']['includeAll']){_0x19f3c5[_0xa647('0x4c')]=[{'all':!![]}];}_0x19f3c5=_[_0xa647('0x48')]({},_0x19f3c5,_0x28af4a[_0xa647('0x4a')]);return db[_0xa647('0x37')]['find'](_0x19f3c5)[_0xa647('0x30')](handleEntityNotFound(_0x49475f,null))[_0xa647('0x30')](respondWithResult(_0x49475f,null))[_0xa647('0x24')](handleError(_0x49475f,null));};exports[_0xa647('0x52')]=function(_0xcaf2f4,_0x239c78){return db['WhatsappMessage']['create'](_0xcaf2f4['body'],{})[_0xa647('0x30')](respondWithResult(_0x239c78,0xc9))[_0xa647('0x24')](handleError(_0x239c78,null));};exports[_0xa647('0x53')]=function(_0x254502,_0x575dd4){if(_0x254502[_0xa647('0x54')]['id']){delete _0x254502[_0xa647('0x54')]['id'];}return db['WhatsappMessage'][_0xa647('0x55')]({'where':{'id':_0x254502[_0xa647('0x4f')]['id']}})[_0xa647('0x30')](handleEntityNotFound(_0x575dd4,null))['then'](saveUpdates(_0x254502['body'],null))[_0xa647('0x30')](respondWithResult(_0x575dd4,null))[_0xa647('0x24')](handleError(_0x575dd4,null));};exports[_0xa647('0x31')]=function(_0x5211cc,_0x1ecf6a){return db['WhatsappMessage'][_0xa647('0x55')]({'where':{'id':_0x5211cc[_0xa647('0x4f')]['id']}})[_0xa647('0x30')](handleEntityNotFound(_0x1ecf6a,null))[_0xa647('0x30')](removeEntity(_0x1ecf6a,null))[_0xa647('0x24')](handleError(_0x1ecf6a,null));};exports[_0xa647('0x56')]=function(_0x672b,_0x3c08d8){return db['WhatsappMessage'][_0xa647('0x56')]()[_0xa647('0x30')](respondWithResult(_0x3c08d8,null))[_0xa647('0x24')](handleError(_0x3c08d8,null));};var interaction_log=require(_0xa647('0x12'))(_0xa647('0x57'));exports[_0xa647('0x58')]=function(_0x417fe8,_0x4d50fd,_0x4814cd){var _0x163609={'agent':{},'channel':_0xa647('0x59')};if(_0x417fe8[_0xa647('0x54')]['id']){delete _0x417fe8[_0xa647('0x54')]['id'];}_0x417fe8[_0xa647('0x54')][_0xa647('0x5a')]=!![];_0x417fe8[_0xa647('0x54')]['readAt']=moment()[_0xa647('0x5b')](_0xa647('0x5c'));_0x417fe8['body']['UserId']=_0x417fe8[_0xa647('0x54')][_0xa647('0x5d')]||_0x417fe8[_0xa647('0x5e')]['id'];_0x163609[_0xa647('0x5f')]['id']=_0x417fe8[_0xa647('0x54')][_0xa647('0x5d')];return db['WhatsappMessage'][_0xa647('0x55')]({'where':{'id':_0x417fe8[_0xa647('0x4f')]['id'],'UserId':null}})[_0xa647('0x30')](handleEntityNotFound(_0x4d50fd,null))['then'](saveUpdates(_0x417fe8[_0xa647('0x54')],null))[_0xa647('0x30')](function(_0x5d9bee){if(_0x5d9bee){_0x163609[_0xa647('0x23')]=_0x5d9bee[_0xa647('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xa647('0x55')]({'where':{'id':_0x5d9bee[_0xa647('0x61')]}});}return null;})[_0xa647('0x30')](handleEntityNotFound(_0x4d50fd,null))['then'](function(_0x5eb3f0){if(_0x5eb3f0){return _0x5eb3f0[_0xa647('0x53')]({'UserId':_0x417fe8[_0xa647('0x54')][_0xa647('0x5d')],'read1stAt':_['isNil'](_0x5eb3f0[_0xa647('0x62')])?moment()[_0xa647('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x71a526){if(_0x71a526){_0x163609[_0xa647('0x63')]=_0x71a526[_0xa647('0x60')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x417fe8[_0xa647('0x5e')]['id'],_0x417fe8['user'][_0xa647('0x34')],_0x417fe8[_0xa647('0x5e')]['role'],_0x163609[_0xa647('0x63')]['id'],_0x417fe8[_0xa647('0x54')]?JSON[_0xa647('0x20')](_0x417fe8[_0xa647('0x54')]):_0xa647('0x64'));return respondWithRpcPromise(_0xa647('0x65'),_0xa647('0x66'),_0x163609);}return null;})['then'](function(_0x3dcd51){var _0x81cba4=_0xa647('0x67')+_0x3dcd51[_0xa647('0x23')][_0xa647('0x68')];return db[_0xa647('0x69')]['query'](_0x81cba4,{'type':db[_0xa647('0x6a')][_0xa647('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x1d1e27){return _0x1d1e27;});})[_0xa647('0x30')](function(_0x206335){if(_0x206335){_0x163609[_0xa647('0x23')][_0xa647('0x6c')]=_0x206335[0x0];if(!_0x417fe8[_0xa647('0x54')][_0xa647('0x5d')])return;return db[_0xa647('0x6d')][_0xa647('0x55')]({'where':{'id':_0x417fe8[_0xa647('0x54')][_0xa647('0x5d')],'role':'agent'},'attributes':['id',_0xa647('0x34'),_0xa647('0x6e'),_0xa647('0x6f'),_0xa647('0x70')],'raw':!![]});}return null;})['then'](function(_0xd7a9e6){if(!_0xd7a9e6)return null;_0x163609[_0xa647('0x23')][_0xa647('0x5f')]=_0xd7a9e6;return _0x163609;})[_0xa647('0x30')](function(_0x55c697){if(_0x55c697){if(_0x417fe8[_0xa647('0x54')][_0xa647('0x71')]){_0x163609['message']['interface']=util[_0xa647('0x5b')](_0xa647('0x72'),_0x417fe8[_0xa647('0x5e')][_0xa647('0x34')]);_0x163609[_0xa647('0x23')]['channel']=_0x163609['channel'];_0x163609[_0xa647('0x23')][_0xa647('0x73')]=_0x163609[_0xa647('0x74')];_0x163609[_0xa647('0x23')][_0xa647('0x75')]=_0xa647('0x58');return respondWithRpcPromise(_0xa647('0x76'),_0xa647('0x76'),{'event':_0xa647('0x77'),'message':_0x163609[_0xa647('0x23')]},client9002)[_0xa647('0x30')](function(){return _0x163609;});}return _0x163609;}return null;})['then'](respondWithResult(_0x4d50fd,null))[_0xa647('0x24')](handleError(_0x4d50fd,null));};var interaction_log=require(_0xa647('0x12'))(_0xa647('0x57'));exports[_0xa647('0x2e')]=function(_0xc536d9,_0x126253,_0x2366f1){var _0x553e56={'agent':{},'channel':'whatsapp'};if(_0xc536d9[_0xa647('0x54')]['id']){delete _0xc536d9['body']['id'];}_0xc536d9[_0xa647('0x54')]['UserId']=_0xc536d9['body']['UserId']||_0xc536d9[_0xa647('0x5e')]['id'];_0x553e56[_0xa647('0x5f')]['id']=_0xc536d9[_0xa647('0x54')]['UserId'];return db[_0xa647('0x37')][_0xa647('0x55')]({'where':{'id':_0xc536d9['params']['id'],'UserId':null}})[_0xa647('0x30')](handleEntityNotFound(_0x126253,null))[_0xa647('0x30')](function(_0x1c0cc2){if(_0x1c0cc2){_0x553e56[_0xa647('0x23')]=_0x1c0cc2['get']({'plain':!![]});return db[_0xa647('0x78')][_0xa647('0x55')]({'where':{'id':_0x1c0cc2[_0xa647('0x61')]}});}return null;})[_0xa647('0x30')](handleEntityNotFound(_0x126253,null))[_0xa647('0x30')](function(_0x1f2e46){if(_0x1f2e46){_0x553e56[_0xa647('0x63')]=_0x1f2e46[_0xa647('0x60')]({'plain':!![]});interaction_log[_0xa647('0x1d')](_0xa647('0x79'),_0xc536d9[_0xa647('0x5e')]['id'],_0xc536d9[_0xa647('0x5e')]['name'],_0xc536d9[_0xa647('0x5e')]['role'],_0x553e56['interaction']['id'],_0xc536d9[_0xa647('0x54')]?JSON[_0xa647('0x20')](_0xc536d9['body']):'null');return respondWithRpcPromise(_0xa647('0x7a'),_0xa647('0x7b'),_0x553e56);}return null;})[_0xa647('0x30')](function(_0x137297){var _0x472522=_0xa647('0x67')+_0x137297[_0xa647('0x23')][_0xa647('0x68')];return db['sequelize'][_0xa647('0x3e')](_0x472522,{'type':db[_0xa647('0x6a')][_0xa647('0x6b')][_0xa647('0x7c')],'raw':!![]})[_0xa647('0x30')](function(_0x523a24){return _0x523a24;});})[_0xa647('0x30')](function(_0x806a37){if(_0x806a37){_0x553e56[_0xa647('0x23')][_0xa647('0x6c')]=_0x806a37[0x0];if(!_0xc536d9['body']['UserId'])return;return db[_0xa647('0x6d')]['find']({'where':{'id':_0xc536d9['body'][_0xa647('0x5d')],'role':_0xa647('0x5f')},'attributes':['id',_0xa647('0x34'),_0xa647('0x6e'),_0xa647('0x6f'),'internal'],'raw':!![]});}return null;})[_0xa647('0x30')](function(_0x36dbd7){if(!_0x36dbd7)return null;_0x553e56[_0xa647('0x23')][_0xa647('0x5f')]=_0x36dbd7;return _0x553e56;})[_0xa647('0x30')](function(_0xbde2b9){if(_0xbde2b9){_0xbde2b9[_0xa647('0x23')][_0xa647('0x7d')]=util[_0xa647('0x5b')]('SIP/%s',_0xc536d9[_0xa647('0x5e')][_0xa647('0x34')]);_0xbde2b9[_0xa647('0x23')][_0xa647('0x74')]=_0x553e56[_0xa647('0x74')];_0xbde2b9['message']['motionChannel']=_0x553e56[_0xa647('0x74')];_0xbde2b9['message'][_0xa647('0x75')]=_0xa647('0x2e');respondWithRpcPromise(_0xa647('0x76'),_0xa647('0x76'),{'event':_0xa647('0x7e'),'message':_0xbde2b9[_0xa647('0x23')]},client9002);return _0x553e56;}return null;})['then'](respondWithResult(_0x126253,null))['catch'](handleError(_0x126253,null));};exports['status']=function(_0x3bf128,_0x51cf2c,_0x3b2719){if(_0x3bf128['body']['id']){delete _0x3bf128[_0xa647('0x54')]['id'];}var _0x157c18;return db[_0xa647('0x37')][_0xa647('0x55')]({'where':{'id':_0x3bf128[_0xa647('0x4f')]['id']}})[_0xa647('0x30')](handleEntityNotFound(_0x51cf2c,null))[_0xa647('0x30')](function(_0xb71351){if(_0xb71351){_0x157c18=_0xb71351;return db[_0xa647('0x7f')][_0xa647('0x55')]({'where':{'id':_0xb71351[_0xa647('0x80')]}});}})[_0xa647('0x30')](handleEntityNotFound(_0x51cf2c,null))[_0xa647('0x30')](function(_0x19d9ad){if(_0x19d9ad){logger[_0xa647('0x81')](_0xa647('0x82'),'status',_0xa647('0x83'),_0x19d9ad[_0xa647('0x39')],util['inspect'](_0x3bf128[_0xa647('0x54')],{'showHidden':![],'depth':null}));switch(_0x19d9ad['type']){case _0xa647('0x84'):if(_0x3bf128[_0xa647('0x54')][_0xa647('0x85')]&&_0x3bf128[_0xa647('0x54')][_0xa647('0x85')]===_0x157c18[_0xa647('0x86')]&&_0x3bf128[_0xa647('0x54')]['MessageStatus']&&_0x3bf128[_0xa647('0x54')][_0xa647('0x87')]===_0xa647('0x5a')){return _0x157c18[_0xa647('0x53')]({'read':!![]});}else{logger[_0xa647('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa647('0x25'),_0xa647('0x84'),util['inspect'](_0x3bf128[_0xa647('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x157c18;}})[_0xa647('0x30')](respondWithResult(_0x51cf2c,null))[_0xa647('0x24')](handleError(_0x51cf2c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 7ca7b5d..270e423 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['remove','emit','hook','exports','events','WhatsappMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x4e5d57,_0x742e0f){_0x4e5d57=_0x4e5d57-0x0;var _0x160d0a=_0x96cc[_0x4e5d57];return _0x160d0a;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc96c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){WhatsappMessageEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);WhatsappMessageEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4ded=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x1342e2,_0x30a769){var _0x5f3af2=function(_0x41fba9){while(--_0x41fba9){_0x1342e2['push'](_0x1342e2['shift']());}};_0x5f3af2(++_0x30a769);}(_0x4ded,0x116));var _0xd4de=function(_0x88cf42,_0x32db6b){_0x88cf42=_0x88cf42-0x0;var _0x3516f8=_0x4ded[_0x88cf42];return _0x3516f8;};'use strict';var EventEmitter=require(_0xd4de('0x0'));var WhatsappMessage=require(_0xd4de('0x1'))['db'][_0xd4de('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd4de('0x3')](0x0);var events={'afterCreate':_0xd4de('0x4'),'afterUpdate':_0xd4de('0x5'),'afterDestroy':_0xd4de('0x6')};function emitEvent(_0x42f90f){return function(_0x20930f,_0x36d4dd,_0x2e8d86){WhatsappMessageEvents[_0xd4de('0x7')](_0x42f90f+':'+_0x20930f['id'],_0x20930f);WhatsappMessageEvents['emit'](_0x42f90f,_0x20930f);_0x2e8d86(null);};}for(var e in events){if(events[_0xd4de('0x8')](e)){var event=events[e];WhatsappMessage[_0xd4de('0x9')](e,emitEvent(event));}}module[_0xd4de('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 307935c..43be30a 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x503c=['whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','secret','WhatsappAccount','find','type','twilio','authToken','accountSid','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','message_id','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','define','WhatsappMessage'];(function(_0x136466,_0x8f2309){var _0x1b0aea=function(_0x14283c){while(--_0x14283c){_0x136466['push'](_0x136466['shift']());}};_0x1b0aea(++_0x8f2309);}(_0x503c,0x146));var _0xc503=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x503c[_0x44124b];return _0xafe8bf;};'use strict';var _=require('lodash');var util=require(_0xc503('0x0'));var logger=require('../../config/logger')(_0xc503('0x1'));var moment=require(_0xc503('0x2'));var BPromise=require(_0xc503('0x3'));var rp=require(_0xc503('0x4'));var fetch=require(_0xc503('0x5'));var fs=require('fs');var path=require(_0xc503('0x6'));var rimraf=require(_0xc503('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x254429,_0x539ed8){return _0x254429[_0xc503('0x8')](_0xc503('0x9'),attributes,{'tableName':_0xc503('0xa'),'paranoid':![],'indexes':[{'name':_0xc503('0xb'),'fields':[_0xc503('0xb')]},{'name':_0xc503('0xc'),'fields':[_0xc503('0xd')],'type':_0xc503('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x332f87,_0x59f15a,_0x166e7a){var _0x50af0a=_0x254429[_0xc503('0xf')];var _0x473e9a=_0x332f87[_0xc503('0x10')]({'plain':!![]});if(_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()==='in'||_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()==='out'&&!_0x473e9a['secret']&&!_[_0xc503('0x13')](_0x473e9a[_0xc503('0x14')])){_0x50af0a[_0xc503('0x15')][_0xc503('0x16')]({'where':{'id':_0x473e9a[_0xc503('0x17')]}})[_0xc503('0x18')](function(_0x4a11fe){if(_0x4a11fe){_0x4a11fe[_0xc503('0x19')]({'lastMsgAt':_0x473e9a[_0xc503('0x1a')],'lastMsgDirection':_0x473e9a[_0xc503('0x11')][_0xc503('0x12')]()});}})[_0xc503('0x1b')](function(_0x1750df){console['error'](_0x1750df);});}if(_0x473e9a[_0xc503('0x11')]==='out'&&!_0x473e9a[_0xc503('0x1c')]){var _0x31ca52;_0x50af0a[_0xc503('0x1d')][_0xc503('0x1e')]({'where':{'id':_0x473e9a['WhatsappAccountId']},'raw':!![]})[_0xc503('0x18')](function(_0x3f46bb){_0x31ca52=_0x3f46bb;if(_0x31ca52&&_0x31ca52[_0xc503('0x1f')]){switch(_0x31ca52['type']){case _0xc503('0x20'):var _0x1cbda1=require(_0xc503('0x20'));if(_0x31ca52['accountSid']&&_0x31ca52[_0xc503('0x21')]&&_0x31ca52['phone']){var _0x49e6f3=new _0x1cbda1(_0x31ca52[_0xc503('0x22')],_0x31ca52['authToken']);_0x49e6f3['messages'][_0xc503('0x23')]({'body':_0x473e9a['body'],'to':_0xc503('0x24')+_0x473e9a[_0xc503('0x25')],'from':_0xc503('0x24')+_0x31ca52[_0xc503('0x25')],'statusCallback':_0x31ca52[_0xc503('0x26')]+_0xc503('0x27')+_0x473e9a['id']+_0xc503('0x28')+_0x31ca52[_0xc503('0x29')]})['then'](function(_0x5d312e){if(_0x5d312e[_0xc503('0x2a')]){return _0x332f87[_0xc503('0x19')]({'messageId':_0x5d312e[_0xc503('0x2a')]});}})[_0xc503('0x1b')](function(_0x3273bb){logger['error'](_0xc503('0x2b'),_0xc503('0x2c'),_0xc503('0x20'),util['inspect'](_0x3273bb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc503('0x2b'),_0xc503('0x2c'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc503('0x2d'):var _0x309dfa=_0x31ca52['accountSid'];var _0x3b2082=_0x31ca52['authToken'];var _0x5c9aa7=_0x31ca52[_0xc503('0x2e')]+_0xc503('0x2f')+_0x309dfa+_0xc503('0x30');var _0x3f7146={'to':[_0x473e9a['phone']],'message':{'type':_0xc503('0x31'),'text':_0x473e9a[_0xc503('0xd')]}};var _0x253177={'method':_0xc503('0x32'),'uri':_0x5c9aa7,'headers':{'Authorization':'Bearer\x20'+_0x3b2082,'Content-Type':_0xc503('0x33')},'body':_0x3f7146,'json':!![]};rp(_0x253177)[_0xc503('0x18')](function(_0x5e1a70){if(_0x5e1a70['statuses'][0x0][_0xc503('0x34')]){return _0x332f87[_0xc503('0x19')]({'messageId':_0x5e1a70['statuses'][0x0]['message_id']});}})[_0xc503('0x1b')](function(_0x534439){logger['err'](_0xc503('0x35'),_0x534439);});break;}}})[_0xc503('0x36')](function(){_0x166e7a();});}else{_0x166e7a();}}},'charset':'utf8mb4','collate':_0xc503('0x37')});}; \ No newline at end of file +var _0xf212=['text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','get','direction','toLowerCase','out','secret','findOne','WhatsappInteractionId','then','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','afterCreate','sinch','/whatsapp/v1/','/messages/'];(function(_0x1c8547,_0x59acc0){var _0x2cbd1e=function(_0x58459f){while(--_0x58459f){_0x1c8547['push'](_0x1c8547['shift']());}};_0x2cbd1e(++_0x59acc0);}(_0xf212,0xf2));var _0x2f21=function(_0x186b5d,_0x49bc4b){_0x186b5d=_0x186b5d-0x0;var _0x1462dc=_0xf212[_0x186b5d];return _0x1462dc;};'use strict';var _=require('lodash');var util=require(_0x2f21('0x0'));var logger=require(_0x2f21('0x1'))(_0x2f21('0x2'));var moment=require(_0x2f21('0x3'));var BPromise=require(_0x2f21('0x4'));var rp=require(_0x2f21('0x5'));var fetch=require(_0x2f21('0x6'));var fs=require('fs');var path=require(_0x2f21('0x7'));var rimraf=require(_0x2f21('0x8'));var config=require(_0x2f21('0x9'));var attributes=require(_0x2f21('0xa'));module[_0x2f21('0xb')]=function(_0x555f79,_0x11d455){return _0x555f79[_0x2f21('0xc')](_0x2f21('0xd'),attributes,{'tableName':_0x2f21('0xe'),'paranoid':![],'indexes':[{'name':_0x2f21('0xf'),'fields':[_0x2f21('0xf')]},{'name':_0x2f21('0x10'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aaf57,_0x32edbd,_0xc49633){var _0x329935=_0x555f79['models'];var _0x36cf24=_0x3aaf57[_0x2f21('0x11')]({'plain':!![]});if(_0x36cf24[_0x2f21('0x12')][_0x2f21('0x13')]()==='in'||_0x36cf24[_0x2f21('0x12')]['toLowerCase']()===_0x2f21('0x14')&&!_0x36cf24[_0x2f21('0x15')]&&!_['isNil'](_0x36cf24['UserId'])){_0x329935['WhatsappInteraction'][_0x2f21('0x16')]({'where':{'id':_0x36cf24[_0x2f21('0x17')]}})[_0x2f21('0x18')](function(_0x50908d){if(_0x50908d){_0x50908d['update']({'lastMsgAt':_0x36cf24['createdAt'],'lastMsgDirection':_0x36cf24['direction']['toLowerCase']()});}})['catch'](function(_0x506f69){console['error'](_0x506f69);});}if(_0x36cf24['direction']===_0x2f21('0x14')&&!_0x36cf24[_0x2f21('0x15')]){var _0x392a2f;_0x329935[_0x2f21('0x19')][_0x2f21('0x1a')]({'where':{'id':_0x36cf24['WhatsappAccountId']},'raw':!![]})[_0x2f21('0x18')](function(_0x306b45){_0x392a2f=_0x306b45;if(_0x392a2f&&_0x392a2f[_0x2f21('0x1b')]){switch(_0x392a2f[_0x2f21('0x1b')]){case'twilio':var _0x22ad20=require(_0x2f21('0x1c'));if(_0x392a2f[_0x2f21('0x1d')]&&_0x392a2f[_0x2f21('0x1e')]&&_0x392a2f[_0x2f21('0x1f')]){var _0x274b12=new _0x22ad20(_0x392a2f['accountSid'],_0x392a2f[_0x2f21('0x1e')]);_0x274b12[_0x2f21('0x20')][_0x2f21('0x21')]({'body':_0x36cf24[_0x2f21('0x22')],'to':_0x2f21('0x23')+_0x36cf24[_0x2f21('0x1f')],'from':_0x2f21('0x23')+_0x392a2f[_0x2f21('0x1f')],'statusCallback':_0x392a2f[_0x2f21('0x24')]+_0x2f21('0x25')+_0x36cf24['id']+_0x2f21('0x26')+_0x392a2f[_0x2f21('0x27')]})[_0x2f21('0x18')](function(_0x6061dc){if(_0x6061dc[_0x2f21('0x28')]){return _0x3aaf57[_0x2f21('0x29')]({'messageId':_0x6061dc[_0x2f21('0x28')]});}})['catch'](function(_0x3b2f0b){logger['error'](_0x2f21('0x2a'),'afterCreate',_0x2f21('0x1c'),util['inspect'](_0x3b2f0b,{'showHidden':![],'depth':null}));});}else{logger[_0x2f21('0x2b')](_0x2f21('0x2a'),_0x2f21('0x2c'),_0x2f21('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2f21('0x2d'):var _0x3054bc=_0x392a2f['accountSid'];var _0x379246=_0x392a2f[_0x2f21('0x1e')];var _0x12483e=_0x392a2f['baseUrl']+_0x2f21('0x2e')+_0x3054bc+_0x2f21('0x2f');var _0x1c932e={'to':[_0x36cf24['phone']],'message':{'type':_0x2f21('0x30'),'text':_0x36cf24[_0x2f21('0x22')]}};var _0x46a1b0={'method':_0x2f21('0x31'),'uri':_0x12483e,'headers':{'Authorization':_0x2f21('0x32')+_0x379246,'Content-Type':_0x2f21('0x33')},'body':_0x1c932e,'json':!![]};rp(_0x46a1b0)[_0x2f21('0x18')](function(_0x36fc34){if(_0x36fc34[_0x2f21('0x34')][0x0][_0x2f21('0x35')]){return _0x3aaf57['update']({'messageId':_0x36fc34[_0x2f21('0x34')][0x0]['message_id']});}})['catch'](function(_0x516c13){logger[_0x2f21('0x36')]('WhatsappMessage,\x20%s',_0x516c13);});break;}}})[_0x2f21('0x37')](function(){_0xc49633();});}else{_0xc49633();}}},'charset':_0x2f21('0x38'),'collate':_0x2f21('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 212d929..5203c6f 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd864=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','catch','body','options','raw','CreateWhatsappMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2966de,_0xc756d5){var _0x4e75a2=function(_0x15b554){while(--_0x15b554){_0x2966de['push'](_0x2966de['shift']());}};_0x4e75a2(++_0xc756d5);}(_0xd864,0x162));var _0x4d86=function(_0x259c64,_0x1630fc){_0x259c64=_0x259c64-0x0;var _0x784745=_0xd864[_0x259c64];return _0x784745;};'use strict';var _=require(_0x4d86('0x0'));var util=require(_0x4d86('0x1'));var moment=require(_0x4d86('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d86('0x3'));var fs=require('fs');var Redis=require(_0x4d86('0x4'));var db=require(_0x4d86('0x5'))['db'];var utils=require(_0x4d86('0x6'));var logger=require(_0x4d86('0x7'))(_0x4d86('0x8'));var config=require(_0x4d86('0x9'));var jayson=require(_0x4d86('0xa'));var client=jayson['client'][_0x4d86('0xb')]({'port':0x232a});config[_0x4d86('0xc')]=_[_0x4d86('0xd')](config[_0x4d86('0xc')],{'host':_0x4d86('0xe'),'port':0x18eb});var socket=require(_0x4d86('0xf'))(new Redis(config[_0x4d86('0xc')]));require(_0x4d86('0x10'))[_0x4d86('0x11')](socket);function respondWithRpcPromise(_0x42f349,_0x20ae72,_0x1bb4ad){return new BPromise(function(_0x41e889,_0x15fb64){return client[_0x4d86('0x12')](_0x42f349,_0x1bb4ad)['then'](function(_0x51c64b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x4d86('0x13'));logger[_0x4d86('0x14')](_0x4d86('0x15'),_0x20ae72,_0x4d86('0x13'),JSON[_0x4d86('0x16')](_0x51c64b));if(_0x51c64b[_0x4d86('0x17')]){if(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x18')]===0x1f4){logger[_0x4d86('0x17')](_0x4d86('0x19'),_0x20ae72,_0x51c64b['error']['message']);return _0x15fb64(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);return _0x41e889(_0x51c64b[_0x4d86('0x17')][_0x4d86('0x1a')]);}else{logger[_0x4d86('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x4d86('0x13'));_0x41e889(_0x51c64b['result'][_0x4d86('0x1a')]);}})[_0x4d86('0x1c')](function(_0x27f15c){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20ae72,_0x27f15c);_0x15fb64(_0x27f15c);});});}exports['CreateWhatsappMessage']=function(_0x351dbc){var _0x1db32c=this;return new Promise(function(_0x314f62,_0x5dfa41){return db['WhatsappMessage']['create'](_0x351dbc[_0x4d86('0x1d')],{'raw':_0x351dbc['options']?_0x351dbc[_0x4d86('0x1e')][_0x4d86('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x395391){logger[_0x4d86('0x1b')](_0x4d86('0x20'),_0x351dbc);logger['debug']('CreateWhatsappMessage',_0x351dbc,JSON[_0x4d86('0x16')](_0x395391));_0x314f62(_0x395391);})[_0x4d86('0x1c')](function(_0x3454d3){logger['error'](_0x4d86('0x20'),_0x3454d3[_0x4d86('0x1a')],_0x351dbc);_0x5dfa41(_0x1db32c[_0x4d86('0x17')](0x1f4,_0x3454d3['message']));});});}; \ No newline at end of file +var _0x2b63=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x2b63,0xaa));var _0x32b6=function(_0x773f28,_0x574a34){_0x773f28=_0x773f28-0x0;var _0x12e98d=_0x2b63[_0x773f28];return _0x12e98d;};'use strict';var _=require(_0x32b6('0x0'));var util=require(_0x32b6('0x1'));var moment=require(_0x32b6('0x2'));var BPromise=require(_0x32b6('0x3'));var rs=require(_0x32b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32b6('0x5'))['db'];var utils=require(_0x32b6('0x6'));var logger=require('../../config/logger')(_0x32b6('0x7'));var config=require(_0x32b6('0x8'));var jayson=require(_0x32b6('0x9'));var client=jayson['client'][_0x32b6('0xa')]({'port':0x232a});config[_0x32b6('0xb')]=_[_0x32b6('0xc')](config[_0x32b6('0xb')],{'host':_0x32b6('0xd'),'port':0x18eb});var socket=require(_0x32b6('0xe'))(new Redis(config[_0x32b6('0xb')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x32031a,_0x5000d2,_0xb3dd06){return new BPromise(function(_0x3c10d2,_0x4086e1){return client[_0x32b6('0xf')](_0x32031a,_0xb3dd06)[_0x32b6('0x10')](function(_0x32692f){logger[_0x32b6('0x11')](_0x32b6('0x12'),_0x5000d2,'request\x20sent');logger[_0x32b6('0x13')](_0x32b6('0x14'),_0x5000d2,_0x32b6('0x15'),JSON[_0x32b6('0x16')](_0x32692f));if(_0x32692f['error']){if(_0x32692f[_0x32b6('0x17')][_0x32b6('0x18')]===0x1f4){logger[_0x32b6('0x17')](_0x32b6('0x12'),_0x5000d2,_0x32692f[_0x32b6('0x17')]['message']);return _0x4086e1(_0x32692f[_0x32b6('0x17')][_0x32b6('0x19')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5000d2,_0x32692f['error'][_0x32b6('0x19')]);return _0x3c10d2(_0x32692f[_0x32b6('0x17')][_0x32b6('0x19')]);}else{logger[_0x32b6('0x11')](_0x32b6('0x12'),_0x5000d2,_0x32b6('0x15'));_0x3c10d2(_0x32692f[_0x32b6('0x1a')][_0x32b6('0x19')]);}})[_0x32b6('0x1b')](function(_0x406d36){logger[_0x32b6('0x17')](_0x32b6('0x12'),_0x5000d2,_0x406d36);_0x4086e1(_0x406d36);});});}exports[_0x32b6('0x1c')]=function(_0x4399cb){var _0x2de182=this;return new Promise(function(_0x4c719a,_0x8c6978){return db[_0x32b6('0x1d')][_0x32b6('0x1e')](_0x4399cb[_0x32b6('0x1f')],{'raw':_0x4399cb[_0x32b6('0x20')]?_0x4399cb[_0x32b6('0x20')][_0x32b6('0x21')]===undefined?!![]:![]:!![]})[_0x32b6('0x10')](function(_0x1c38d4){logger[_0x32b6('0x11')](_0x32b6('0x1c'),_0x4399cb);logger[_0x32b6('0x13')](_0x32b6('0x1c'),_0x4399cb,JSON['stringify'](_0x1c38d4));_0x4c719a(_0x1c38d4);})['catch'](function(_0xbddd9f){logger[_0x32b6('0x17')](_0x32b6('0x1c'),_0xbddd9f[_0x32b6('0x19')],_0x4399cb);_0x8c6978(_0x2de182[_0x32b6('0x17')](0x1f4,_0xbddd9f[_0x32b6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5747542..8ffe04d 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01ea=['save','update','emit','removeListener','whatsappMessage:'];(function(_0x1055ca,_0x3b213b){var _0x422554=function(_0x65673e){while(--_0x65673e){_0x1055ca['push'](_0x1055ca['shift']());}};_0x422554(++_0x3b213b);}(_0x01ea,0x14a));var _0xa01e=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x01ea[_0x4bb66f];return _0xf2772f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa01e('0x0'),'remove',_0xa01e('0x1')];function createListener(_0x1f3ac1,_0xf2a95d){return function(_0x5a8521){_0xf2a95d[_0xa01e('0x2')](_0x1f3ac1,_0x5a8521);};}function removeListener(_0xecbbd0,_0x146d5c){return function(){WhatsappMessageEvents[_0xa01e('0x3')](_0xecbbd0,_0x146d5c);};}exports['register']=function(_0x21bd55){for(var _0x19fde7=0x0,_0x856377=events['length'];_0x19fde7<_0x856377;_0x19fde7++){var _0x3d634b=events[_0x19fde7];var _0x1eca6b=createListener(_0xa01e('0x4')+_0x3d634b,_0x21bd55);WhatsappMessageEvents['on'](_0x3d634b,_0x1eca6b);}}; \ No newline at end of file +var _0xbcf4=['whatsappMessage:','./whatsappMessage.events','remove','emit','register','length'];(function(_0x30afed,_0x5eaca7){var _0x3715c7=function(_0x351a61){while(--_0x351a61){_0x30afed['push'](_0x30afed['shift']());}};_0x3715c7(++_0x5eaca7);}(_0xbcf4,0x1e1));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x4bcf('0x0'));var events=['save',_0x4bcf('0x1'),'update'];function createListener(_0x3f50cf,_0x118cc8){return function(_0x1aa552){_0x118cc8[_0x4bcf('0x2')](_0x3f50cf,_0x1aa552);};}function removeListener(_0x2edc9e,_0x161e75){return function(){WhatsappMessageEvents['removeListener'](_0x2edc9e,_0x161e75);};}exports[_0x4bcf('0x3')]=function(_0x2d9d2a){for(var _0x518c86=0x0,_0x52dd89=events[_0x4bcf('0x4')];_0x518c86<_0x52dd89;_0x518c86++){var _0x54eb1b=events[_0x518c86];var _0x390dc5=createListener(_0x4bcf('0x5')+_0x54eb1b,_0x2d9d2a);WhatsappMessageEvents['on'](_0x54eb1b,_0x390dc5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 88ae66b..8146a4a 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2295=['index','get','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x57db01,_0xeacf14){var _0x32b855=function(_0x415783){while(--_0x415783){_0x57db01['push'](_0x57db01['shift']());}};_0x32b855(++_0xeacf14);}(_0x2295,0x16e));var _0x5229=function(_0x2755ae,_0x553183){_0x2755ae=_0x2755ae-0x0;var _0x3e3a6c=_0x2295[_0x2755ae];return _0x3e3a6c;};'use strict';var multer=require(_0x5229('0x0'));var util=require(_0x5229('0x1'));var path=require('path');var timeout=require(_0x5229('0x2'));var express=require(_0x5229('0x3'));var router=express[_0x5229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5229('0x5'));var interaction=require(_0x5229('0x6'));var config=require(_0x5229('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x5229('0x8')](),controller[_0x5229('0x9')]);router['get']('/describe',auth[_0x5229('0x8')](),controller['describe']);router[_0x5229('0xa')](_0x5229('0xb'),auth[_0x5229('0x8')](),controller['show']);router['get'](_0x5229('0xc'),auth['isAuthenticated'](),controller[_0x5229('0xd')]);router[_0x5229('0xa')](_0x5229('0xe'),auth['isAuthenticated'](),controller[_0x5229('0xf')]);router['get'](_0x5229('0x10'),auth['isAuthenticated'](),controller[_0x5229('0x11')]);router[_0x5229('0x12')]('/',auth[_0x5229('0x8')](),controller[_0x5229('0x13')]);router['post'](_0x5229('0xe'),auth[_0x5229('0x8')](),controller[_0x5229('0x14')]);router[_0x5229('0x12')](_0x5229('0x10'),auth[_0x5229('0x8')](),controller[_0x5229('0x15')]);router['put'](_0x5229('0xb'),auth[_0x5229('0x8')](),controller[_0x5229('0x16')]);router[_0x5229('0x17')](_0x5229('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x5229('0xe'),auth[_0x5229('0x8')](),controller[_0x5229('0x18')]);router['delete']('/:id/users',auth[_0x5229('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4c6e=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0x2ba00c,_0x182642){var _0x21712b=function(_0x1bcf8e){while(--_0x1bcf8e){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x21712b(++_0x182642);}(_0x4c6e,0x189));var _0xe4c6=function(_0x2c8ef6,_0x3059cc){_0x2c8ef6=_0x2c8ef6-0x0;var _0x40f8af=_0x4c6e[_0x2c8ef6];return _0x40f8af;};'use strict';var multer=require('multer');var util=require(_0xe4c6('0x0'));var path=require('path');var timeout=require(_0xe4c6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe4c6('0x2'));var config=require(_0xe4c6('0x3'));var controller=require(_0xe4c6('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe4c6('0x5')](_0xe4c6('0x6'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0x8')]);router[_0xe4c6('0x5')](_0xe4c6('0x9'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0xa')]);router[_0xe4c6('0x5')](_0xe4c6('0xb'),auth['isAuthenticated'](),controller[_0xe4c6('0xc')]);router[_0xe4c6('0x5')](_0xe4c6('0xd'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0xe')]);router[_0xe4c6('0x5')]('/:id/users',auth[_0xe4c6('0x7')](),controller[_0xe4c6('0xf')]);router[_0xe4c6('0x10')]('/',auth['isAuthenticated'](),controller[_0xe4c6('0x11')]);router['post'](_0xe4c6('0xd'),auth['isAuthenticated'](),controller[_0xe4c6('0x12')]);router[_0xe4c6('0x10')](_0xe4c6('0x13'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0x14')]);router[_0xe4c6('0x15')](_0xe4c6('0x9'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0x16')]);router[_0xe4c6('0x17')](_0xe4c6('0x9'),auth['isAuthenticated'](),controller[_0xe4c6('0x18')]);router[_0xe4c6('0x17')](_0xe4c6('0xd'),auth[_0xe4c6('0x7')](),controller['removeTeams']);router[_0xe4c6('0x17')](_0xe4c6('0x13'),auth[_0xe4c6('0x7')](),controller[_0xe4c6('0x19')]);module[_0xe4c6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0601a45..1d46766 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc112=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xc112,0xec));var _0x2c11=function(_0xf730e3,_0x58a6c9){_0xf730e3=_0xf730e3-0x0;var _0x5dec7a=_0xc112[_0xf730e3];return _0x5dec7a;};'use strict';var Sequelize=require(_0x2c11('0x0'));module[_0x2c11('0x1')]={'name':{'type':Sequelize[_0x2c11('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2c11('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2c11('0x4')](_0x2c11('0x5'),_0x2c11('0x6'),_0x2c11('0x7'))},'description':{'type':Sequelize[_0x2c11('0x2')]}}; \ No newline at end of file +var _0xc423=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x2e8d04,_0x59f84b){var _0x39597b=function(_0x239fe3){while(--_0x239fe3){_0x2e8d04['push'](_0x2e8d04['shift']());}};_0x39597b(++_0x59f84b);}(_0xc423,0x159));var _0x3c42=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc423[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x3c42('0x0'));module[_0x3c42('0x1')]={'name':{'type':Sequelize[_0x3c42('0x2')],'unique':_0x3c42('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3c42('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3c42('0x5'),_0x3c42('0x6'),_0x3c42('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f509a12..8e415eb 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd99=['api','../../config/environment','../../mysqldb','defaults','redis','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','intersection','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','filters','fields','hasOwnProperty','nolimit','sort','WhatsappQueueId','filter','options','User','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','order','pick','addTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','includes','all','union','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs'];(function(_0x3fd7f4,_0x5ddc3b){var _0x14ed1b=function(_0x349d18){while(--_0x349d18){_0x3fd7f4['push'](_0x3fd7f4['shift']());}};_0x14ed1b(++_0x5ddc3b);}(_0xcd99,0xed));var _0x9cd9=function(_0x234614,_0x4d8038){_0x234614=_0x234614-0x0;var _0x39fed1=_0xcd99[_0x234614];return _0x39fed1;};'use strict';var BPromise=require('bluebird');var util=require(_0x9cd9('0x0'));var _=require(_0x9cd9('0x1'));var squel=require(_0x9cd9('0x2'));var Redis=require(_0x9cd9('0x3'));var qs=require(_0x9cd9('0x4'));var logger=require('../../config/logger')(_0x9cd9('0x5'));var config=require(_0x9cd9('0x6'));var db=require(_0x9cd9('0x7'))['db'];config['redis']=_[_0x9cd9('0x8')](config[_0x9cd9('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cd9('0x9')]));require(_0x9cd9('0xa'))[_0x9cd9('0xb')](socket);function respondWithStatusCode(_0x5896e9,_0x31f2e5){_0x31f2e5=_0x31f2e5||0xcc;return function(_0x1e9205){if(_0x1e9205){return _0x5896e9[_0x9cd9('0xc')](_0x31f2e5);}return _0x5896e9[_0x9cd9('0xd')](_0x31f2e5)[_0x9cd9('0xe')]();};}function respondWithResult(_0x416d44,_0x1b8223){_0x1b8223=_0x1b8223||0xc8;return function(_0x2986e2){if(_0x2986e2){return _0x416d44[_0x9cd9('0xd')](_0x1b8223)['json'](_0x2986e2);}};}function respondWithFilteredResult(_0x154350,_0x2581b0){return function(_0x4e3320){if(_0x4e3320){var _0x5a45a1=typeof _0x2581b0[_0x9cd9('0xf')]===_0x9cd9('0x10')&&typeof _0x2581b0[_0x9cd9('0x11')]===_0x9cd9('0x10');var _0x50ebc9=_0x4e3320[_0x9cd9('0x12')];var _0x2d5d1c=_0x5a45a1?0x0:_0x2581b0[_0x9cd9('0xf')];var _0xd42744=_0x5a45a1?_0x4e3320[_0x9cd9('0x12')]:_0x2581b0[_0x9cd9('0xf')]+_0x2581b0[_0x9cd9('0x11')];var _0x2d91ee;if(_0xd42744>=_0x50ebc9){_0xd42744=_0x50ebc9;_0x2d91ee=0xc8;}else{_0x2d91ee=0xce;}_0x154350[_0x9cd9('0xd')](_0x2d91ee);return _0x154350[_0x9cd9('0x13')]('Content-Range',_0x2d5d1c+'-'+_0xd42744+'/'+_0x50ebc9)[_0x9cd9('0x14')](_0x4e3320);}return null;};}function saveUpdates(_0x1afa9d){return function(_0x24fb9){if(_0x24fb9){return _0x24fb9['update'](_0x1afa9d)[_0x9cd9('0x15')](function(_0x2cea2f){return _0x2cea2f;});}return null;};}function removeEntity(_0x4d7f62){return function(_0x106a0c){if(_0x106a0c){return _0x106a0c['destroy']()['then'](function(){var _0x2728a9=_0x106a0c[_0x9cd9('0x16')]({'plain':!![]});var _0x1002f2=_0x9cd9('0x17');return db[_0x9cd9('0x18')][_0x9cd9('0x19')]({'where':{'type':_0x1002f2,'resourceId':_0x2728a9['id']}})[_0x9cd9('0x15')](function(){return _0x106a0c;});})[_0x9cd9('0x15')](function(){_0x4d7f62[_0x9cd9('0xd')](0xcc)[_0x9cd9('0xe')]();});}};}function handleEntityNotFound(_0x2844e8){return function(_0x2fc576){if(!_0x2fc576){_0x2844e8[_0x9cd9('0xc')](0x194);}return _0x2fc576;};}function handleError(_0x48cd2d,_0x42be00){_0x42be00=_0x42be00||0x1f4;return function(_0x2e8d95){logger[_0x9cd9('0x1a')](_0x2e8d95[_0x9cd9('0x1b')]);if(_0x2e8d95['name']){delete _0x2e8d95['name'];}_0x48cd2d[_0x9cd9('0xd')](_0x42be00)[_0x9cd9('0x1c')](_0x2e8d95);};}exports[_0x9cd9('0x1d')]=function(_0x17c91d,_0x2e3223){var _0x1c11cc={};var _0x340c80={'count':0x0,'rows':[]};var _0x380b21=_[_0x9cd9('0x1e')](db[_0x9cd9('0x1f')][_0x9cd9('0x20')],function(_0x3077c2){return{'name':_0x3077c2[_0x9cd9('0x21')],'type':_0x3077c2[_0x9cd9('0x22')][_0x9cd9('0x23')]};});_0x1c11cc=qs[_0x9cd9('0x24')](_0x380b21,_0x17c91d);var _0x2aa438={'where':_0x1c11cc[_0x9cd9('0x25')]};return db['WhatsappQueue'][_0x9cd9('0x12')](_0x2aa438)['then'](function(_0x10d6be){_0x340c80[_0x9cd9('0x12')]=_0x10d6be;_0x1c11cc[_0x9cd9('0x26')]=qs['include'](_0x17c91d[_0x9cd9('0x27')]);return db['WhatsappQueue'][_0x9cd9('0x28')](_0x1c11cc);})['then'](function(_0x2db647){_0x340c80[_0x9cd9('0x29')]=_0x2db647;return _0x340c80;})[_0x9cd9('0x15')](respondWithFilteredResult(_0x2e3223,_0x1c11cc))[_0x9cd9('0x2a')](handleError(_0x2e3223,null));};exports['show']=function(_0x449440,_0x1587c1){var _0x5c7578={'raw':!![],'where':{'id':_0x449440[_0x9cd9('0x2b')]['id']}},_0xb4e448={};_0xb4e448[_0x9cd9('0x2c')]=_['keys'](db[_0x9cd9('0x1f')][_0x9cd9('0x20')]);_0xb4e448[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x449440['query']);_0xb4e448['filters']=_[_0x9cd9('0x2e')](_0xb4e448[_0x9cd9('0x2c')],_0xb4e448['query']);_0x5c7578[_0x9cd9('0x2f')]=_['intersection'](_0xb4e448[_0x9cd9('0x2c')],qs['fields'](_0x449440[_0x9cd9('0x27')]['fields']));_0x5c7578[_0x9cd9('0x2f')]=_0x5c7578[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x5c7578[_0x9cd9('0x2f')]:_0xb4e448[_0x9cd9('0x2c')];if(_0x449440[_0x9cd9('0x27')][_0x9cd9('0x31')]){_0x5c7578[_0x9cd9('0x26')]=[{'all':!![]}];}_0x5c7578=_[_0x9cd9('0x32')]({},_0x5c7578,_0x449440['options']);return db[_0x9cd9('0x1f')][_0x9cd9('0x33')](_0x5c7578)[_0x9cd9('0x15')](handleEntityNotFound(_0x1587c1,null))['then'](respondWithResult(_0x1587c1,null))[_0x9cd9('0x2a')](handleError(_0x1587c1,null));};exports[_0x9cd9('0x34')]=function(_0x261d53,_0x371e75){return db[_0x9cd9('0x1f')][_0x9cd9('0x34')](_0x261d53[_0x9cd9('0x35')],{})[_0x9cd9('0x15')](function(_0x8cafd9){var _0x397a89=_0x261d53[_0x9cd9('0x36')][_0x9cd9('0x16')]({'plain':!![]});if(!_0x397a89)throw new Error(_0x9cd9('0x37'));if(_0x397a89['role']==='user'){var _0x394284=_0x8cafd9[_0x9cd9('0x16')]({'plain':!![]});var _0x150bc0='WhatsappQueues';return db[_0x9cd9('0x38')][_0x9cd9('0x33')]({'where':{'name':_0x150bc0,'userProfileId':_0x397a89['userProfileId']},'raw':!![]})['then'](function(_0x35f7d3){if(_0x35f7d3&&_0x35f7d3[_0x9cd9('0x39')]===0x0){return db[_0x9cd9('0x18')][_0x9cd9('0x34')]({'name':_0x394284[_0x9cd9('0x3a')],'resourceId':_0x394284['id'],'type':_0x35f7d3[_0x9cd9('0x3a')],'sectionId':_0x35f7d3['id']},{})[_0x9cd9('0x15')](function(){return _0x8cafd9;});}else{return _0x8cafd9;}})[_0x9cd9('0x2a')](function(_0x28994e){logger[_0x9cd9('0x1a')](_0x9cd9('0x3b'),_0x28994e);throw _0x28994e;});}return _0x8cafd9;})[_0x9cd9('0x15')](respondWithResult(_0x371e75,0xc9))['catch'](handleError(_0x371e75,null));};exports['update']=function(_0x138284,_0x19c587){if(_0x138284[_0x9cd9('0x35')]['id']){delete _0x138284[_0x9cd9('0x35')]['id'];}return db['WhatsappQueue'][_0x9cd9('0x33')]({'where':{'id':_0x138284['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x19c587,null))[_0x9cd9('0x15')](saveUpdates(_0x138284[_0x9cd9('0x35')],null))[_0x9cd9('0x15')](respondWithResult(_0x19c587,null))[_0x9cd9('0x2a')](handleError(_0x19c587,null));};exports[_0x9cd9('0x19')]=function(_0x2412b2,_0x45dc48){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x2412b2['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x45dc48,null))[_0x9cd9('0x15')](removeEntity(_0x45dc48,null))[_0x9cd9('0x2a')](handleError(_0x45dc48,null));};exports[_0x9cd9('0x3c')]=function(_0x7bbdbb,_0x1b31d6){return db[_0x9cd9('0x1f')]['describe']()[_0x9cd9('0x15')](respondWithResult(_0x1b31d6,null))[_0x9cd9('0x2a')](handleError(_0x1b31d6,null));};exports[_0x9cd9('0x3d')]=function(_0x5485b6,_0x5950de){var _0x21dc40={'raw':!![],'where':{}},_0x215013={},_0x1d264d;return db['WhatsappQueue'][_0x9cd9('0x3e')]({'where':{'id':_0x5485b6[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x5950de,null))[_0x9cd9('0x15')](function(_0x26f736){if(_0x26f736){_0x1d264d=_0x26f736[_0x9cd9('0x16')]({'plain':!![]});_0x215013[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db[_0x9cd9('0x3f')][_0x9cd9('0x20')]);_0x215013[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x5485b6['query']);_0x215013[_0x9cd9('0x40')]=_['intersection'](_0x215013['model'],_0x215013[_0x9cd9('0x27')]);_0x21dc40[_0x9cd9('0x2f')]=_[_0x9cd9('0x2e')](_0x215013[_0x9cd9('0x2c')],qs[_0x9cd9('0x41')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x21dc40[_0x9cd9('0x2f')]=_0x21dc40[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x21dc40[_0x9cd9('0x2f')]:_0x215013['model'];if(!_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x42')](_0x9cd9('0x43'))){_0x21dc40[_0x9cd9('0x11')]=qs[_0x9cd9('0x11')](_0x5485b6['query'][_0x9cd9('0x11')]);_0x21dc40['offset']=qs[_0x9cd9('0xf')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0xf')]);}_0x21dc40['order']=qs[_0x9cd9('0x44')](_0x5485b6[_0x9cd9('0x27')][_0x9cd9('0x44')]);_0x21dc40[_0x9cd9('0x25')]=qs['filters'](_['pick'](_0x5485b6['query'],_0x215013['filters']));_0x21dc40['where'][_0x9cd9('0x45')]=_0x26f736['id'];if(_0x5485b6[_0x9cd9('0x27')]['filter']){_0x21dc40[_0x9cd9('0x25')]=_['merge'](_0x21dc40[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x21dc40[_0x9cd9('0x2f')],function(_0x1227b1){var _0x24dd24={};_0x24dd24[_0x1227b1]={'$like':'%'+_0x5485b6['query'][_0x9cd9('0x46')]+'%'};return _0x24dd24;})});}_0x21dc40=_[_0x9cd9('0x32')]({},_0x21dc40,_0x5485b6[_0x9cd9('0x47')]);return db[_0x9cd9('0x3f')][_0x9cd9('0x28')](_0x21dc40);}})['then'](function(_0x3b7219){if(_0x3b7219){return db[_0x9cd9('0x48')]['findAndCountAll']({'where':{'id':_[_0x9cd9('0x1e')](_0x3b7219,'UserId'),'role':_0x9cd9('0x49')},'attributes':['id',_0x9cd9('0x3a'),_0x9cd9('0x4a'),_0x9cd9('0x4b'),'createdAt']});}})[_0x9cd9('0x15')](function(_0x393b0a){if(_0x393b0a){return{'count':_0x393b0a[_0x9cd9('0x12')],'rows':_[_0x9cd9('0x1e')](_0x393b0a[_0x9cd9('0x29')],function(_0x5162ee){return{'membername':_0x5162ee[_0x9cd9('0x3a')],'UserId':_0x5162ee['id'],'queue_name':_0x1d264d['name'],'WhatsappQueueId':_0x1d264d['id'],'interface':util[_0x9cd9('0x4c')](_0x9cd9('0x4d'),_0x9cd9('0x4e'),_0x5162ee['name']),'penalty':0x0,'paused':_0x5162ee[_0x9cd9('0x4a')],'createdAt':_0x5162ee[_0x9cd9('0x4f')],'updatedAt':_0x5162ee['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9cd9('0x15')](respondWithFilteredResult(_0x5950de,_0x21dc40))['catch'](handleError(_0x5950de,null));};exports[_0x9cd9('0x50')]=function(_0x58dfbb,_0x9eadfa){var _0x532a5a={};var _0x37c286={};var _0x108930;var _0x48666f;return db[_0x9cd9('0x1f')][_0x9cd9('0x3e')]({'where':{'id':_0x58dfbb['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x9eadfa,null))[_0x9cd9('0x15')](function(_0x56bac3){if(_0x56bac3){_0x108930=_0x56bac3;_0x37c286[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db['Team'][_0x9cd9('0x20')]);_0x37c286[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x58dfbb[_0x9cd9('0x27')]);_0x37c286[_0x9cd9('0x40')]=_[_0x9cd9('0x2e')](_0x37c286[_0x9cd9('0x2c')],_0x37c286[_0x9cd9('0x27')]);_0x532a5a[_0x9cd9('0x2f')]=_['intersection'](_0x37c286[_0x9cd9('0x2c')],qs[_0x9cd9('0x41')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x532a5a[_0x9cd9('0x2f')]=_0x532a5a[_0x9cd9('0x2f')][_0x9cd9('0x30')]?_0x532a5a['attributes']:_0x37c286['model'];_0x532a5a[_0x9cd9('0x51')]=qs[_0x9cd9('0x44')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x44')]);_0x532a5a[_0x9cd9('0x25')]=qs[_0x9cd9('0x40')](_[_0x9cd9('0x52')](_0x58dfbb[_0x9cd9('0x27')],_0x37c286[_0x9cd9('0x40')]));if(_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x46')]){_0x532a5a[_0x9cd9('0x25')]=_[_0x9cd9('0x32')](_0x532a5a[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x532a5a[_0x9cd9('0x2f')],function(_0x4b59de){var _0x66df5a={};_0x66df5a[_0x4b59de]={'$like':'%'+_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x46')]+'%'};return _0x66df5a;})});}_0x532a5a=_[_0x9cd9('0x32')]({},_0x532a5a,_0x58dfbb[_0x9cd9('0x47')]);return _0x108930['getTeams'](_0x532a5a);}})['then'](function(_0x42172f){if(_0x42172f){_0x48666f=_0x42172f[_0x9cd9('0x30')];if(!_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0x42')](_0x9cd9('0x43'))){_0x532a5a['limit']=qs['limit'](_0x58dfbb['query'][_0x9cd9('0x11')]);_0x532a5a[_0x9cd9('0xf')]=qs[_0x9cd9('0xf')](_0x58dfbb[_0x9cd9('0x27')][_0x9cd9('0xf')]);}return _0x108930['getTeams'](_0x532a5a);}})['then'](function(_0x85714f){if(_0x85714f){return _0x85714f?{'count':_0x48666f,'rows':_0x85714f}:null;}})[_0x9cd9('0x15')](respondWithResult(_0x9eadfa,null))['catch'](handleError(_0x9eadfa,null));};exports[_0x9cd9('0x53')]=function(_0x125120,_0xa92722){var _0x4bba9e=_0x125120[_0x9cd9('0x35')][_0x9cd9('0x54')];return db[_0x9cd9('0x55')][_0x9cd9('0x28')]({'where':{'id':_0x4bba9e},'attributes':['id'],'include':[{'model':db[_0x9cd9('0x48')],'as':_0x9cd9('0x56'),'attributes':['id',_0x9cd9('0x3a'),'online',_0x9cd9('0x57'),_0x9cd9('0x58')],'raw':!![]}]})[_0x9cd9('0x15')](function(_0x1b63ca){if(_0x1b63ca){var _0x279e9f=_[_0x9cd9('0x59')](_0x1b63ca,function(_0x1e4039){var _0x4a6243=_0x1e4039[_0x9cd9('0x16')]({'plain':!![]});return _0x4a6243['Agents'];});return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x125120[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](function(_0x2225fc){return db['sequelize'][_0x9cd9('0x5a')](function(_0x451eda){return _0x2225fc[_0x9cd9('0x53')](_0x4bba9e,{'transaction':_0x451eda})[_0x9cd9('0x15')](function(){return BPromise[_0x9cd9('0x5b')](_0x279e9f,function(_0x2167cc){return db['UserWhatsappQueue'][_0x9cd9('0x5c')]({'where':{'UserId':_0x2167cc['id'],'WhatsappQueueId':_0x125120[_0x9cd9('0x2b')]['id']},'transaction':_0x451eda});});})[_0x9cd9('0x15')](function(){_0x279e9f['forEach'](function(_0x261744){socket['emit'](_0x9cd9('0x5d'),{'UserId':_0x261744['id'],'WhatsappQueueId':_0x2225fc['id']});});});});});}})[_0x9cd9('0x15')](respondWithStatusCode(_0xa92722,null))[_0x9cd9('0x2a')](handleError(_0xa92722,null));};exports[_0x9cd9('0x5e')]=function(_0x5b763e,_0x1729e3){return db[_0x9cd9('0x55')]['findAll']({'where':{'id':_0x5b763e[_0x9cd9('0x27')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9cd9('0x56'),'attributes':['id'],'raw':!![]}]})[_0x9cd9('0x15')](handleEntityNotFound(_0x1729e3,null))[_0x9cd9('0x15')](function(_0x3d2c84){var _0x36b8d5=_['map'](_0x3d2c84,'id');var _0x2246fc=[];var _0x48d8e5=[];var _0x1dc91c=squel[_0x9cd9('0x5f')]();_0x1dc91c[_0x9cd9('0x60')](_0x9cd9('0x61'))[_0x9cd9('0x62')]('team_has_whatsapp_queues','tq')[_0x9cd9('0x63')](_0x9cd9('0x64'),'ut',_0x9cd9('0x65'))[_0x9cd9('0x25')](_0x9cd9('0x66'),_0x5b763e[_0x9cd9('0x2b')]['id']);for(var _0x45510b=0x0;_0x45510b<_0x3d2c84[_0x9cd9('0x30')];_0x45510b+=0x1){let _0x2f4814=_0x3d2c84[_0x45510b];for(var _0x33ddfd=0x0;_0x33ddfd<_0x2f4814[_0x9cd9('0x56')][_0x9cd9('0x30')];_0x33ddfd+=0x1){let _0x317190=_0x2f4814[_0x9cd9('0x56')][_0x33ddfd];var _0x284ceb=_0x1dc91c[_0x9cd9('0x67')]();_0x284ceb['where'](_0x9cd9('0x68'),_0x317190['id']);_0x48d8e5['push'](db[_0x9cd9('0x69')]['query'](_0x284ceb[_0x9cd9('0x6a')](),{'type':db['sequelize']['QueryTypes'][_0x9cd9('0x6b')]})[_0x9cd9('0x15')](function(_0x1609ce){if(_0x1609ce[_0x9cd9('0x30')]===0x1){return _0x317190['id'];}else{var _0x250802=_['every'](_['map'](_0x1609ce,'TeamId'),function(_0x469f09){return _[_0x9cd9('0x6c')](_0x36b8d5,_0x469f09);});if(_0x250802){return _0x317190['id'];}}}));}}return BPromise[_0x9cd9('0x6d')](_0x48d8e5)[_0x9cd9('0x15')](function(_0x2edf1f){_0x2246fc=_(_0x2246fc)[_0x9cd9('0x6e')](_0x2edf1f)['compact']()['value']();return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x5b763e[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](function(_0x182ff6){return db[_0x9cd9('0x69')][_0x9cd9('0x5a')](function(_0x58ab9b){return _0x182ff6['removeTeams'](_0x5b763e[_0x9cd9('0x27')][_0x9cd9('0x54')],{'transaction':_0x58ab9b})[_0x9cd9('0x15')](function(){if(!_[_0x9cd9('0x6f')](_0x2246fc)){return _0x182ff6[_0x9cd9('0x70')](_0x2246fc,{'transaction':_0x58ab9b});}})[_0x9cd9('0x15')](function(){_0x2246fc[_0x9cd9('0x71')](function(_0x3a0996){socket[_0x9cd9('0x72')](_0x9cd9('0x73'),{'UserId':_0x3a0996,'WhatsappQueueId':_0x182ff6['id']});});});});});});})[_0x9cd9('0x15')](respondWithStatusCode(_0x1729e3,null))['catch'](handleError(_0x1729e3,null));};exports[_0x9cd9('0x74')]=function(_0x55843b,_0xe211d7){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x55843b[_0x9cd9('0x2b')]['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0xe211d7,null))[_0x9cd9('0x15')](function(_0x256b07){if(_0x256b07){return _0x256b07[_0x9cd9('0x74')](_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')],_[_0x9cd9('0x75')](_0x55843b[_0x9cd9('0x35')],[_0x9cd9('0x54'),'id'])||{})[_0x9cd9('0x76')](function(_0x18ee96){for(var _0x472fa5=0x0;_0x472fa5<_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')][_0x9cd9('0x30')];_0x472fa5+=0x1){socket[_0x9cd9('0x72')](_0x9cd9('0x5d'),{'UserId':Number(_0x55843b[_0x9cd9('0x35')][_0x9cd9('0x54')][_0x472fa5]),'WhatsappQueueId':Number(_0x55843b['params']['id'])});}return _0x18ee96;});}})[_0x9cd9('0x15')](respondWithResult(_0xe211d7,null))['catch'](handleError(_0xe211d7,null));};exports[_0x9cd9('0x70')]=function(_0x5b1d7a,_0x4c4bd2){return db[_0x9cd9('0x1f')][_0x9cd9('0x33')]({'where':{'id':_0x5b1d7a['params']['id']}})[_0x9cd9('0x15')](handleEntityNotFound(_0x4c4bd2,null))[_0x9cd9('0x15')](function(_0x3f05a2){if(_0x3f05a2){return _0x3f05a2['removeAgents'](_0x5b1d7a['query'][_0x9cd9('0x54')])[_0x9cd9('0x15')](function(){if(_[_0x9cd9('0x77')](_0x5b1d7a['query'][_0x9cd9('0x54')])){for(var _0xf4d2=0x0;_0xf4d2<_0x5b1d7a[_0x9cd9('0x27')][_0x9cd9('0x54')]['length'];_0xf4d2+=0x1){socket[_0x9cd9('0x72')](_0x9cd9('0x73'),{'UserId':Number(_0x5b1d7a['query'][_0x9cd9('0x54')][_0xf4d2]),'WhatsappQueueId':Number(_0x5b1d7a[_0x9cd9('0x2b')]['id'])});}}else{socket[_0x9cd9('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x5b1d7a[_0x9cd9('0x27')]['ids']),'WhatsappQueueId':Number(_0x5b1d7a[_0x9cd9('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c4bd2,null))[_0x9cd9('0x2a')](handleError(_0x4c4bd2,null));};exports[_0x9cd9('0x78')]=function(_0x33c04d,_0x4010cc){var _0x38fa83={};var _0x1e171e={};var _0x2b9089;var _0xde71ee;return db[_0x9cd9('0x1f')][_0x9cd9('0x3e')]({'where':{'id':_0x33c04d[_0x9cd9('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4010cc,null))['then'](function(_0x3242c5){if(_0x3242c5){_0x2b9089=_0x3242c5;_0x1e171e[_0x9cd9('0x2c')]=_[_0x9cd9('0x2d')](db[_0x9cd9('0x48')][_0x9cd9('0x20')]);_0x1e171e[_0x9cd9('0x27')]=_[_0x9cd9('0x2d')](_0x33c04d[_0x9cd9('0x27')]);_0x1e171e[_0x9cd9('0x40')]=_[_0x9cd9('0x2e')](_0x1e171e[_0x9cd9('0x2c')],_0x1e171e[_0x9cd9('0x27')]);_0x38fa83[_0x9cd9('0x2f')]=_[_0x9cd9('0x2e')](_0x1e171e['model'],qs[_0x9cd9('0x41')](_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x41')]));_0x38fa83[_0x9cd9('0x2f')]=_0x38fa83['attributes'][_0x9cd9('0x30')]?_0x38fa83['attributes']:_0x1e171e[_0x9cd9('0x2c')];_0x38fa83['order']=qs['sort'](_0x33c04d[_0x9cd9('0x27')]['sort']);_0x38fa83['where']=qs['filters'](_[_0x9cd9('0x52')](_0x33c04d['query'],_0x1e171e[_0x9cd9('0x40')]));if(_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x46')]){_0x38fa83[_0x9cd9('0x25')]=_[_0x9cd9('0x32')](_0x38fa83[_0x9cd9('0x25')],{'$or':_[_0x9cd9('0x1e')](_0x38fa83[_0x9cd9('0x2f')],function(_0x2c8fc8){var _0x3b8d89={};_0x3b8d89[_0x2c8fc8]={'$like':'%'+_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x46')]+'%'};return _0x3b8d89;})});}_0x38fa83=_[_0x9cd9('0x32')]({},_0x38fa83,_0x33c04d[_0x9cd9('0x47')]);return _0x2b9089[_0x9cd9('0x78')](_0x38fa83);}})[_0x9cd9('0x15')](function(_0x531d92){if(_0x531d92){_0xde71ee=_0x531d92[_0x9cd9('0x30')];if(!_0x33c04d[_0x9cd9('0x27')]['hasOwnProperty'](_0x9cd9('0x43'))){_0x38fa83[_0x9cd9('0x11')]=qs[_0x9cd9('0x11')](_0x33c04d[_0x9cd9('0x27')][_0x9cd9('0x11')]);_0x38fa83[_0x9cd9('0xf')]=qs[_0x9cd9('0xf')](_0x33c04d['query'][_0x9cd9('0xf')]);}return _0x2b9089['getAgents'](_0x38fa83);}})['then'](function(_0x55f720){if(_0x55f720){return _0x55f720?{'count':_0xde71ee,'rows':_0x55f720}:null;}})[_0x9cd9('0x15')](respondWithResult(_0x4010cc,null))[_0x9cd9('0x2a')](handleError(_0x4010cc,null));}; \ No newline at end of file +var _0x7f94=['include','query','findAll','rows','catch','show','params','model','keys','attributes','intersection','fields','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappQueueId','filter','merge','UserWhatsappQueue','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','options','getTeams','ids','User','Agents','interface','flatMap','sequelize','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','addAgents','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','limit','undefined','count','set','update','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key'];(function(_0x45b829,_0x38277d){var _0x18d649=function(_0x414180){while(--_0x414180){_0x45b829['push'](_0x45b829['shift']());}};_0x18d649(++_0x38277d);}(_0x7f94,0xc1));var _0x47f9=function(_0x4f0195,_0x34ddcc){_0x4f0195=_0x4f0195-0x0;var _0x4e65d6=_0x7f94[_0x4f0195];return _0x4e65d6;};'use strict';var BPromise=require(_0x47f9('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x47f9('0x1'));var Redis=require(_0x47f9('0x2'));var qs=require(_0x47f9('0x3'));var logger=require(_0x47f9('0x4'))('api');var config=require(_0x47f9('0x5'));var db=require('../../mysqldb')['db'];config[_0x47f9('0x6')]=_['defaults'](config[_0x47f9('0x6')],{'host':_0x47f9('0x7'),'port':0x18eb});var socket=require(_0x47f9('0x8'))(new Redis(config['redis']));require(_0x47f9('0x9'))[_0x47f9('0xa')](socket);function respondWithStatusCode(_0x4f0f30,_0x4a9f17){_0x4a9f17=_0x4a9f17||0xcc;return function(_0x5a55c5){if(_0x5a55c5){return _0x4f0f30['sendStatus'](_0x4a9f17);}return _0x4f0f30[_0x47f9('0xb')](_0x4a9f17)[_0x47f9('0xc')]();};}function respondWithResult(_0xd9b07d,_0x1810db){_0x1810db=_0x1810db||0xc8;return function(_0x11ba58){if(_0x11ba58){return _0xd9b07d[_0x47f9('0xb')](_0x1810db)[_0x47f9('0xd')](_0x11ba58);}};}function respondWithFilteredResult(_0x1dee38,_0x591d2e){return function(_0x258d19){if(_0x258d19){var _0x2b54c7=typeof _0x591d2e[_0x47f9('0xe')]==='undefined'&&typeof _0x591d2e[_0x47f9('0xf')]===_0x47f9('0x10');var _0x26eb74=_0x258d19[_0x47f9('0x11')];var _0x10431e=_0x2b54c7?0x0:_0x591d2e['offset'];var _0x9a683=_0x2b54c7?_0x258d19[_0x47f9('0x11')]:_0x591d2e['offset']+_0x591d2e[_0x47f9('0xf')];var _0x3fec77;if(_0x9a683>=_0x26eb74){_0x9a683=_0x26eb74;_0x3fec77=0xc8;}else{_0x3fec77=0xce;}_0x1dee38[_0x47f9('0xb')](_0x3fec77);return _0x1dee38[_0x47f9('0x12')]('Content-Range',_0x10431e+'-'+_0x9a683+'/'+_0x26eb74)[_0x47f9('0xd')](_0x258d19);}return null;};}function saveUpdates(_0x42dd91){return function(_0x57c8ab){if(_0x57c8ab){return _0x57c8ab[_0x47f9('0x13')](_0x42dd91)[_0x47f9('0x14')](function(_0x50ef5b){return _0x50ef5b;});}return null;};}function removeEntity(_0x631901){return function(_0x10bf8d){if(_0x10bf8d){return _0x10bf8d['destroy']()[_0x47f9('0x14')](function(){var _0x42dc09=_0x10bf8d['get']({'plain':!![]});var _0x3008c7=_0x47f9('0x15');return db[_0x47f9('0x16')][_0x47f9('0x17')]({'where':{'type':_0x3008c7,'resourceId':_0x42dc09['id']}})[_0x47f9('0x14')](function(){return _0x10bf8d;});})[_0x47f9('0x14')](function(){_0x631901[_0x47f9('0xb')](0xcc)[_0x47f9('0xc')]();});}};}function handleEntityNotFound(_0x179965){return function(_0x37840a){if(!_0x37840a){_0x179965[_0x47f9('0x18')](0x194);}return _0x37840a;};}function handleError(_0x446608,_0x4416e4){_0x4416e4=_0x4416e4||0x1f4;return function(_0x357790){logger['error'](_0x357790[_0x47f9('0x19')]);if(_0x357790[_0x47f9('0x1a')]){delete _0x357790[_0x47f9('0x1a')];}_0x446608[_0x47f9('0xb')](_0x4416e4)[_0x47f9('0x1b')](_0x357790);};}exports[_0x47f9('0x1c')]=function(_0x412814,_0x4743a9){var _0x53af0a={};var _0x580f08={'count':0x0,'rows':[]};var _0x10325d=_[_0x47f9('0x1d')](db[_0x47f9('0x1e')][_0x47f9('0x1f')],function(_0x4f654d){return{'name':_0x4f654d[_0x47f9('0x20')],'type':_0x4f654d[_0x47f9('0x21')][_0x47f9('0x22')]};});_0x53af0a=qs['getOptions'](_0x10325d,_0x412814);var _0x2dc86a={'where':_0x53af0a['where']};return db[_0x47f9('0x1e')][_0x47f9('0x11')](_0x2dc86a)[_0x47f9('0x14')](function(_0x55ee7b){_0x580f08[_0x47f9('0x11')]=_0x55ee7b;_0x53af0a[_0x47f9('0x23')]=qs['include'](_0x412814[_0x47f9('0x24')]);return db['WhatsappQueue'][_0x47f9('0x25')](_0x53af0a);})[_0x47f9('0x14')](function(_0x1392c7){_0x580f08[_0x47f9('0x26')]=_0x1392c7;return _0x580f08;})['then'](respondWithFilteredResult(_0x4743a9,_0x53af0a))[_0x47f9('0x27')](handleError(_0x4743a9,null));};exports[_0x47f9('0x28')]=function(_0x19f3c7,_0x4006a0){var _0x13c442={'raw':!![],'where':{'id':_0x19f3c7[_0x47f9('0x29')]['id']}},_0x4d01e9={};_0x4d01e9[_0x47f9('0x2a')]=_[_0x47f9('0x2b')](db[_0x47f9('0x1e')][_0x47f9('0x1f')]);_0x4d01e9['query']=_[_0x47f9('0x2b')](_0x19f3c7['query']);_0x4d01e9['filters']=_['intersection'](_0x4d01e9['model'],_0x4d01e9[_0x47f9('0x24')]);_0x13c442[_0x47f9('0x2c')]=_[_0x47f9('0x2d')](_0x4d01e9[_0x47f9('0x2a')],qs[_0x47f9('0x2e')](_0x19f3c7[_0x47f9('0x24')]['fields']));_0x13c442[_0x47f9('0x2c')]=_0x13c442['attributes'][_0x47f9('0x2f')]?_0x13c442['attributes']:_0x4d01e9['model'];if(_0x19f3c7[_0x47f9('0x24')]['includeAll']){_0x13c442['include']=[{'all':!![]}];}_0x13c442=_['merge']({},_0x13c442,_0x19f3c7['options']);return db['WhatsappQueue']['find'](_0x13c442)[_0x47f9('0x14')](handleEntityNotFound(_0x4006a0,null))[_0x47f9('0x14')](respondWithResult(_0x4006a0,null))[_0x47f9('0x27')](handleError(_0x4006a0,null));};exports[_0x47f9('0x30')]=function(_0x4a5e7c,_0x133671){return db['WhatsappQueue'][_0x47f9('0x30')](_0x4a5e7c[_0x47f9('0x31')],{})[_0x47f9('0x14')](function(_0x4e98f6){var _0x44f109=_0x4a5e7c[_0x47f9('0x32')][_0x47f9('0x33')]({'plain':!![]});if(!_0x44f109)throw new Error(_0x47f9('0x34'));if(_0x44f109['role']===_0x47f9('0x32')){var _0x178649=_0x4e98f6['get']({'plain':!![]});var _0x3cb70b=_0x47f9('0x15');return db['UserProfileSection'][_0x47f9('0x35')]({'where':{'name':_0x3cb70b,'userProfileId':_0x44f109[_0x47f9('0x36')]},'raw':!![]})[_0x47f9('0x14')](function(_0x4e8071){if(_0x4e8071&&_0x4e8071[_0x47f9('0x37')]===0x0){return db[_0x47f9('0x16')][_0x47f9('0x30')]({'name':_0x178649[_0x47f9('0x1a')],'resourceId':_0x178649['id'],'type':_0x4e8071[_0x47f9('0x1a')],'sectionId':_0x4e8071['id']},{})['then'](function(){return _0x4e98f6;});}else{return _0x4e98f6;}})['catch'](function(_0x2b93bb){logger['error'](_0x47f9('0x38'),_0x2b93bb);throw _0x2b93bb;});}return _0x4e98f6;})['then'](respondWithResult(_0x133671,0xc9))[_0x47f9('0x27')](handleError(_0x133671,null));};exports[_0x47f9('0x13')]=function(_0xa4a0ab,_0x1b2410){if(_0xa4a0ab['body']['id']){delete _0xa4a0ab[_0x47f9('0x31')]['id'];}return db[_0x47f9('0x1e')][_0x47f9('0x35')]({'where':{'id':_0xa4a0ab[_0x47f9('0x29')]['id']}})[_0x47f9('0x14')](handleEntityNotFound(_0x1b2410,null))['then'](saveUpdates(_0xa4a0ab[_0x47f9('0x31')],null))[_0x47f9('0x14')](respondWithResult(_0x1b2410,null))[_0x47f9('0x27')](handleError(_0x1b2410,null));};exports[_0x47f9('0x17')]=function(_0x3e6ed3,_0x443b45){return db[_0x47f9('0x1e')][_0x47f9('0x35')]({'where':{'id':_0x3e6ed3[_0x47f9('0x29')]['id']}})['then'](handleEntityNotFound(_0x443b45,null))[_0x47f9('0x14')](removeEntity(_0x443b45,null))[_0x47f9('0x27')](handleError(_0x443b45,null));};exports[_0x47f9('0x39')]=function(_0x3dffb1,_0x3d962c){return db[_0x47f9('0x1e')]['describe']()['then'](respondWithResult(_0x3d962c,null))[_0x47f9('0x27')](handleError(_0x3d962c,null));};exports[_0x47f9('0x3a')]=function(_0x2072d4,_0x280c05){var _0x2d3566={'raw':!![],'where':{}},_0xe76643={},_0x30d628;return db[_0x47f9('0x1e')][_0x47f9('0x3b')]({'where':{'id':_0x2072d4[_0x47f9('0x29')]['id']}})['then'](handleEntityNotFound(_0x280c05,null))[_0x47f9('0x14')](function(_0x1c4b79){if(_0x1c4b79){_0x30d628=_0x1c4b79['get']({'plain':!![]});_0xe76643[_0x47f9('0x2a')]=_['keys'](db['UserWhatsappQueue'][_0x47f9('0x1f')]);_0xe76643[_0x47f9('0x24')]=_[_0x47f9('0x2b')](_0x2072d4['query']);_0xe76643[_0x47f9('0x3c')]=_[_0x47f9('0x2d')](_0xe76643[_0x47f9('0x2a')],_0xe76643[_0x47f9('0x24')]);_0x2d3566['attributes']=_['intersection'](_0xe76643[_0x47f9('0x2a')],qs[_0x47f9('0x2e')](_0x2072d4['query'][_0x47f9('0x2e')]));_0x2d3566['attributes']=_0x2d3566[_0x47f9('0x2c')][_0x47f9('0x2f')]?_0x2d3566[_0x47f9('0x2c')]:_0xe76643[_0x47f9('0x2a')];if(!_0x2072d4[_0x47f9('0x24')][_0x47f9('0x3d')](_0x47f9('0x3e'))){_0x2d3566[_0x47f9('0xf')]=qs[_0x47f9('0xf')](_0x2072d4['query']['limit']);_0x2d3566['offset']=qs[_0x47f9('0xe')](_0x2072d4[_0x47f9('0x24')][_0x47f9('0xe')]);}_0x2d3566['order']=qs['sort'](_0x2072d4[_0x47f9('0x24')][_0x47f9('0x3f')]);_0x2d3566[_0x47f9('0x40')]=qs[_0x47f9('0x3c')](_[_0x47f9('0x41')](_0x2072d4[_0x47f9('0x24')],_0xe76643[_0x47f9('0x3c')]));_0x2d3566['where'][_0x47f9('0x42')]=_0x1c4b79['id'];if(_0x2072d4[_0x47f9('0x24')][_0x47f9('0x43')]){_0x2d3566['where']=_[_0x47f9('0x44')](_0x2d3566[_0x47f9('0x40')],{'$or':_[_0x47f9('0x1d')](_0x2d3566[_0x47f9('0x2c')],function(_0x352a18){var _0x4c6c8a={};_0x4c6c8a[_0x352a18]={'$like':'%'+_0x2072d4[_0x47f9('0x24')][_0x47f9('0x43')]+'%'};return _0x4c6c8a;})});}_0x2d3566=_[_0x47f9('0x44')]({},_0x2d3566,_0x2072d4['options']);return db[_0x47f9('0x45')][_0x47f9('0x25')](_0x2d3566);}})['then'](function(_0x1c3e6f){if(_0x1c3e6f){return db['User']['findAndCountAll']({'where':{'id':_[_0x47f9('0x1d')](_0x1c3e6f,_0x47f9('0x46')),'role':'agent'},'attributes':['id','name',_0x47f9('0x47'),_0x47f9('0x48'),_0x47f9('0x49')]});}})[_0x47f9('0x14')](function(_0x2a5ecd){if(_0x2a5ecd){return{'count':_0x2a5ecd[_0x47f9('0x11')],'rows':_[_0x47f9('0x1d')](_0x2a5ecd[_0x47f9('0x26')],function(_0x3f7cff){return{'membername':_0x3f7cff[_0x47f9('0x1a')],'UserId':_0x3f7cff['id'],'queue_name':_0x30d628[_0x47f9('0x1a')],'WhatsappQueueId':_0x30d628['id'],'interface':util['format'](_0x47f9('0x4a'),_0x47f9('0x4b'),_0x3f7cff[_0x47f9('0x1a')]),'penalty':0x0,'paused':_0x3f7cff['whatsappPause'],'createdAt':_0x3f7cff[_0x47f9('0x49')],'updatedAt':_0x3f7cff[_0x47f9('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x280c05,_0x2d3566))['catch'](handleError(_0x280c05,null));};exports['getTeams']=function(_0x412334,_0x25e0ef){var _0x5aed0a={};var _0x20314e={};var _0x474c60;var _0x1b4386;return db[_0x47f9('0x1e')][_0x47f9('0x3b')]({'where':{'id':_0x412334['params']['id']}})[_0x47f9('0x14')](handleEntityNotFound(_0x25e0ef,null))[_0x47f9('0x14')](function(_0x53a37f){if(_0x53a37f){_0x474c60=_0x53a37f;_0x20314e[_0x47f9('0x2a')]=_[_0x47f9('0x2b')](db[_0x47f9('0x4c')][_0x47f9('0x1f')]);_0x20314e[_0x47f9('0x24')]=_[_0x47f9('0x2b')](_0x412334[_0x47f9('0x24')]);_0x20314e[_0x47f9('0x3c')]=_[_0x47f9('0x2d')](_0x20314e[_0x47f9('0x2a')],_0x20314e[_0x47f9('0x24')]);_0x5aed0a[_0x47f9('0x2c')]=_[_0x47f9('0x2d')](_0x20314e[_0x47f9('0x2a')],qs[_0x47f9('0x2e')](_0x412334[_0x47f9('0x24')][_0x47f9('0x2e')]));_0x5aed0a[_0x47f9('0x2c')]=_0x5aed0a['attributes'][_0x47f9('0x2f')]?_0x5aed0a[_0x47f9('0x2c')]:_0x20314e[_0x47f9('0x2a')];_0x5aed0a['order']=qs['sort'](_0x412334['query'][_0x47f9('0x3f')]);_0x5aed0a[_0x47f9('0x40')]=qs[_0x47f9('0x3c')](_[_0x47f9('0x41')](_0x412334[_0x47f9('0x24')],_0x20314e['filters']));if(_0x412334[_0x47f9('0x24')][_0x47f9('0x43')]){_0x5aed0a['where']=_[_0x47f9('0x44')](_0x5aed0a['where'],{'$or':_['map'](_0x5aed0a[_0x47f9('0x2c')],function(_0x5821ff){var _0x3f30a0={};_0x3f30a0[_0x5821ff]={'$like':'%'+_0x412334[_0x47f9('0x24')][_0x47f9('0x43')]+'%'};return _0x3f30a0;})});}_0x5aed0a=_[_0x47f9('0x44')]({},_0x5aed0a,_0x412334[_0x47f9('0x4d')]);return _0x474c60[_0x47f9('0x4e')](_0x5aed0a);}})['then'](function(_0x494eeb){if(_0x494eeb){_0x1b4386=_0x494eeb[_0x47f9('0x2f')];if(!_0x412334[_0x47f9('0x24')][_0x47f9('0x3d')](_0x47f9('0x3e'))){_0x5aed0a[_0x47f9('0xf')]=qs[_0x47f9('0xf')](_0x412334['query']['limit']);_0x5aed0a[_0x47f9('0xe')]=qs[_0x47f9('0xe')](_0x412334['query'][_0x47f9('0xe')]);}return _0x474c60[_0x47f9('0x4e')](_0x5aed0a);}})[_0x47f9('0x14')](function(_0xcc3523){if(_0xcc3523){return _0xcc3523?{'count':_0x1b4386,'rows':_0xcc3523}:null;}})[_0x47f9('0x14')](respondWithResult(_0x25e0ef,null))[_0x47f9('0x27')](handleError(_0x25e0ef,null));};exports['addTeams']=function(_0x51b5c4,_0x44028c){var _0x32209f=_0x51b5c4[_0x47f9('0x31')][_0x47f9('0x4f')];return db[_0x47f9('0x4c')][_0x47f9('0x25')]({'where':{'id':_0x32209f},'attributes':['id'],'include':[{'model':db[_0x47f9('0x50')],'as':_0x47f9('0x51'),'attributes':['id',_0x47f9('0x1a'),'online','voicePause',_0x47f9('0x52')],'raw':!![]}]})['then'](function(_0x89088f){if(_0x89088f){var _0xa46ea0=_[_0x47f9('0x53')](_0x89088f,function(_0x334c2e){var _0x44d0d1=_0x334c2e['get']({'plain':!![]});return _0x44d0d1[_0x47f9('0x51')];});return db[_0x47f9('0x1e')]['find']({'where':{'id':_0x51b5c4[_0x47f9('0x29')]['id']}})['then'](function(_0x2fcc8b){return db[_0x47f9('0x54')]['transaction'](function(_0x3d7d09){return _0x2fcc8b['addTeams'](_0x32209f,{'transaction':_0x3d7d09})[_0x47f9('0x14')](function(){return BPromise['each'](_0xa46ea0,function(_0x572669){return db[_0x47f9('0x45')][_0x47f9('0x55')]({'where':{'UserId':_0x572669['id'],'WhatsappQueueId':_0x51b5c4[_0x47f9('0x29')]['id']},'transaction':_0x3d7d09});});})[_0x47f9('0x14')](function(){_0xa46ea0[_0x47f9('0x56')](function(_0x43da41){socket[_0x47f9('0x57')]('userWhatsappQueue:save',{'UserId':_0x43da41['id'],'WhatsappQueueId':_0x2fcc8b['id']});});});});});}})[_0x47f9('0x14')](respondWithStatusCode(_0x44028c,null))['catch'](handleError(_0x44028c,null));};exports[_0x47f9('0x58')]=function(_0x5e86e1,_0x4a512e){return db[_0x47f9('0x4c')][_0x47f9('0x25')]({'where':{'id':_0x5e86e1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x47f9('0x50')],'as':_0x47f9('0x51'),'attributes':['id'],'raw':!![]}]})[_0x47f9('0x14')](handleEntityNotFound(_0x4a512e,null))[_0x47f9('0x14')](function(_0x631530){var _0x3d8f33=_[_0x47f9('0x1d')](_0x631530,'id');var _0xe92b84=[];var _0x42fee8=[];var _0x2e4b5a=squel['select']();_0x2e4b5a['field'](_0x47f9('0x59'))[_0x47f9('0x5a')](_0x47f9('0x5b'),'tq')[_0x47f9('0x5c')](_0x47f9('0x5d'),'ut',_0x47f9('0x5e'))['where']('WhatsappQueueId\x20=\x20?',_0x5e86e1['params']['id']);for(var _0x1cf9d5=0x0;_0x1cf9d5<_0x631530[_0x47f9('0x2f')];_0x1cf9d5+=0x1){let _0xf5a15d=_0x631530[_0x1cf9d5];for(var _0x49ba75=0x0;_0x49ba75<_0xf5a15d[_0x47f9('0x51')][_0x47f9('0x2f')];_0x49ba75+=0x1){let _0x5a2ff0=_0xf5a15d[_0x47f9('0x51')][_0x49ba75];var _0x165018=_0x2e4b5a[_0x47f9('0x5f')]();_0x165018['where'](_0x47f9('0x60'),_0x5a2ff0['id']);_0x42fee8[_0x47f9('0x61')](db[_0x47f9('0x54')][_0x47f9('0x24')](_0x165018[_0x47f9('0x62')](),{'type':db[_0x47f9('0x54')][_0x47f9('0x63')][_0x47f9('0x64')]})[_0x47f9('0x14')](function(_0x4438f1){if(_0x4438f1[_0x47f9('0x2f')]===0x1){return _0x5a2ff0['id'];}else{var _0x42c904=_[_0x47f9('0x65')](_['map'](_0x4438f1,'TeamId'),function(_0x21bb43){return _[_0x47f9('0x66')](_0x3d8f33,_0x21bb43);});if(_0x42c904){return _0x5a2ff0['id'];}}}));}}return BPromise[_0x47f9('0x67')](_0x42fee8)['then'](function(_0x230b47){_0xe92b84=_(_0xe92b84)['union'](_0x230b47)[_0x47f9('0x68')]()[_0x47f9('0x69')]();return db[_0x47f9('0x1e')][_0x47f9('0x35')]({'where':{'id':_0x5e86e1[_0x47f9('0x29')]['id']}})[_0x47f9('0x14')](function(_0x22df85){return db[_0x47f9('0x54')]['transaction'](function(_0x107eee){return _0x22df85[_0x47f9('0x58')](_0x5e86e1[_0x47f9('0x24')][_0x47f9('0x4f')],{'transaction':_0x107eee})[_0x47f9('0x14')](function(){if(!_[_0x47f9('0x6a')](_0xe92b84)){return _0x22df85[_0x47f9('0x6b')](_0xe92b84,{'transaction':_0x107eee});}})[_0x47f9('0x14')](function(){_0xe92b84['forEach'](function(_0x1e805d){socket[_0x47f9('0x57')]('userWhatsappQueue:remove',{'UserId':_0x1e805d,'WhatsappQueueId':_0x22df85['id']});});});});});});})[_0x47f9('0x14')](respondWithStatusCode(_0x4a512e,null))[_0x47f9('0x27')](handleError(_0x4a512e,null));};exports[_0x47f9('0x6c')]=function(_0x4a7181,_0x4efde6){return db[_0x47f9('0x1e')]['find']({'where':{'id':_0x4a7181['params']['id']}})[_0x47f9('0x14')](handleEntityNotFound(_0x4efde6,null))[_0x47f9('0x14')](function(_0x4ddd17){if(_0x4ddd17){return _0x4ddd17[_0x47f9('0x6c')](_0x4a7181[_0x47f9('0x31')][_0x47f9('0x4f')],_['omit'](_0x4a7181[_0x47f9('0x31')],[_0x47f9('0x4f'),'id'])||{})[_0x47f9('0x6d')](function(_0x4b991){for(var _0x14119f=0x0;_0x14119f<_0x4a7181['body'][_0x47f9('0x4f')][_0x47f9('0x2f')];_0x14119f+=0x1){socket[_0x47f9('0x57')](_0x47f9('0x6e'),{'UserId':Number(_0x4a7181['body'][_0x47f9('0x4f')][_0x14119f]),'WhatsappQueueId':Number(_0x4a7181[_0x47f9('0x29')]['id'])});}return _0x4b991;});}})['then'](respondWithResult(_0x4efde6,null))[_0x47f9('0x27')](handleError(_0x4efde6,null));};exports[_0x47f9('0x6b')]=function(_0x4637f9,_0xe98652){return db[_0x47f9('0x1e')][_0x47f9('0x35')]({'where':{'id':_0x4637f9[_0x47f9('0x29')]['id']}})['then'](handleEntityNotFound(_0xe98652,null))[_0x47f9('0x14')](function(_0x1e20f6){if(_0x1e20f6){return _0x1e20f6[_0x47f9('0x6b')](_0x4637f9[_0x47f9('0x24')][_0x47f9('0x4f')])['then'](function(){if(_[_0x47f9('0x6f')](_0x4637f9[_0x47f9('0x24')][_0x47f9('0x4f')])){for(var _0x45e8c2=0x0;_0x45e8c2<_0x4637f9[_0x47f9('0x24')][_0x47f9('0x4f')][_0x47f9('0x2f')];_0x45e8c2+=0x1){socket[_0x47f9('0x57')](_0x47f9('0x70'),{'UserId':Number(_0x4637f9['query'][_0x47f9('0x4f')][_0x45e8c2]),'WhatsappQueueId':Number(_0x4637f9[_0x47f9('0x29')]['id'])});}}else{socket[_0x47f9('0x57')]('userWhatsappQueue:remove',{'UserId':Number(_0x4637f9[_0x47f9('0x24')][_0x47f9('0x4f')]),'WhatsappQueueId':Number(_0x4637f9['params']['id'])});}});}})[_0x47f9('0x14')](respondWithStatusCode(_0xe98652,null))[_0x47f9('0x27')](handleError(_0xe98652,null));};exports[_0x47f9('0x71')]=function(_0x4bba45,_0x3a9ac0){var _0x64a627={};var _0x5ee9a1={};var _0x19fced;var _0x526989;return db[_0x47f9('0x1e')][_0x47f9('0x3b')]({'where':{'id':_0x4bba45[_0x47f9('0x29')]['id']}})[_0x47f9('0x14')](handleEntityNotFound(_0x3a9ac0,null))[_0x47f9('0x14')](function(_0x33cc12){if(_0x33cc12){_0x19fced=_0x33cc12;_0x5ee9a1[_0x47f9('0x2a')]=_[_0x47f9('0x2b')](db[_0x47f9('0x50')]['rawAttributes']);_0x5ee9a1[_0x47f9('0x24')]=_[_0x47f9('0x2b')](_0x4bba45['query']);_0x5ee9a1[_0x47f9('0x3c')]=_[_0x47f9('0x2d')](_0x5ee9a1[_0x47f9('0x2a')],_0x5ee9a1[_0x47f9('0x24')]);_0x64a627[_0x47f9('0x2c')]=_[_0x47f9('0x2d')](_0x5ee9a1[_0x47f9('0x2a')],qs[_0x47f9('0x2e')](_0x4bba45['query'][_0x47f9('0x2e')]));_0x64a627[_0x47f9('0x2c')]=_0x64a627[_0x47f9('0x2c')][_0x47f9('0x2f')]?_0x64a627[_0x47f9('0x2c')]:_0x5ee9a1[_0x47f9('0x2a')];_0x64a627['order']=qs[_0x47f9('0x3f')](_0x4bba45[_0x47f9('0x24')][_0x47f9('0x3f')]);_0x64a627[_0x47f9('0x40')]=qs[_0x47f9('0x3c')](_[_0x47f9('0x41')](_0x4bba45[_0x47f9('0x24')],_0x5ee9a1['filters']));if(_0x4bba45[_0x47f9('0x24')]['filter']){_0x64a627[_0x47f9('0x40')]=_[_0x47f9('0x44')](_0x64a627[_0x47f9('0x40')],{'$or':_['map'](_0x64a627[_0x47f9('0x2c')],function(_0x520938){var _0x4e0db0={};_0x4e0db0[_0x520938]={'$like':'%'+_0x4bba45[_0x47f9('0x24')][_0x47f9('0x43')]+'%'};return _0x4e0db0;})});}_0x64a627=_['merge']({},_0x64a627,_0x4bba45[_0x47f9('0x4d')]);return _0x19fced[_0x47f9('0x71')](_0x64a627);}})[_0x47f9('0x14')](function(_0x1be077){if(_0x1be077){_0x526989=_0x1be077[_0x47f9('0x2f')];if(!_0x4bba45[_0x47f9('0x24')]['hasOwnProperty'](_0x47f9('0x3e'))){_0x64a627['limit']=qs[_0x47f9('0xf')](_0x4bba45[_0x47f9('0x24')]['limit']);_0x64a627[_0x47f9('0xe')]=qs[_0x47f9('0xe')](_0x4bba45[_0x47f9('0x24')][_0x47f9('0xe')]);}return _0x19fced[_0x47f9('0x71')](_0x64a627);}})[_0x47f9('0x14')](function(_0x44c941){if(_0x44c941){return _0x44c941?{'count':_0x526989,'rows':_0x44c941}:null;}})['then'](respondWithResult(_0x3a9ac0,null))[_0x47f9('0x27')](handleError(_0x3a9ac0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b972652..f9e0cbb 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 _0x9624=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x5563ae,_0x50bf6e){var _0x240e37=function(_0x5ce628){while(--_0x5ce628){_0x5563ae['push'](_0x5563ae['shift']());}};_0x240e37(++_0x50bf6e);}(_0x9624,0x19b));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4962('0x0'));var WhatsappQueue=require(_0x4962('0x1'))['db'][_0x4962('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4962('0x3')](0x0);var events={'afterCreate':_0x4962('0x4'),'afterUpdate':_0x4962('0x5'),'afterDestroy':_0x4962('0x6')};function emitEvent(_0x3b39ed){return function(_0x1966cb,_0x2264d7,_0xf0306){WhatsappQueueEvents[_0x4962('0x7')](_0x3b39ed+':'+_0x1966cb['id'],_0x1966cb);WhatsappQueueEvents[_0x4962('0x7')](_0x3b39ed,_0x1966cb);_0xf0306(null);};}for(var e in events){if(events[_0x4962('0x8')](e)){var event=events[e];WhatsappQueue[_0x4962('0x9')](e,emitEvent(event));}}module[_0x4962('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9701=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x59db0f,_0x466ec8){var _0x2d3a0c=function(_0x5a1a4d){while(--_0x5a1a4d){_0x59db0f['push'](_0x59db0f['shift']());}};_0x2d3a0c(++_0x466ec8);}(_0x9701,0x7b));var _0x1970=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9701[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x1970('0x0'));var WhatsappQueue=require(_0x1970('0x1'))['db'][_0x1970('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1970('0x3')](0x0);var events={'afterCreate':_0x1970('0x4'),'afterUpdate':'update','afterDestroy':_0x1970('0x5')};function emitEvent(_0x55e8e7){return function(_0x4b2f88,_0x24d286,_0x5555ed){WhatsappQueueEvents[_0x1970('0x6')](_0x55e8e7+':'+_0x4b2f88['id'],_0x4b2f88);WhatsappQueueEvents['emit'](_0x55e8e7,_0x4b2f88);_0x5555ed(null);};}for(var e in events){if(events[_0x1970('0x7')](e)){var event=events[e];WhatsappQueue[_0x1970('0x8')](e,emitEvent(event));}}module[_0x1970('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 8547a85..e44bac7 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 _0x9174=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','util','moment','bluebird'];(function(_0x3b17e0,_0x49ad47){var _0x399b36=function(_0x801169){while(--_0x801169){_0x3b17e0['push'](_0x3b17e0['shift']());}};_0x399b36(++_0x49ad47);}(_0x9174,0x1b4));var _0x4917=function(_0x43b35e,_0x9cc873){_0x43b35e=_0x43b35e-0x0;var _0x4295e1=_0x9174[_0x43b35e];return _0x4295e1;};'use strict';var _=require(_0x4917('0x0'));var util=require(_0x4917('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4917('0x2'));var BPromise=require(_0x4917('0x3'));var rp=require(_0x4917('0x4'));var fs=require('fs');var path=require(_0x4917('0x5'));var rimraf=require(_0x4917('0x6'));var config=require(_0x4917('0x7'));var attributes=require(_0x4917('0x8'));module['exports']=function(_0x413714,_0x12d191){return _0x413714[_0x4917('0x9')](_0x4917('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d2=['whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x3c0232,_0x4ad683){var _0x48aecf=function(_0x545a4c){while(--_0x545a4c){_0x3c0232['push'](_0x3c0232['shift']());}};_0x48aecf(++_0x4ad683);}(_0xd3d2,0x1e5));var _0x2d3d=function(_0x538c57,_0xecfe62){_0x538c57=_0x538c57-0x0;var _0x199d04=_0xd3d2[_0x538c57];return _0x199d04;};'use strict';var _=require(_0x2d3d('0x0'));var util=require('util');var logger=require(_0x2d3d('0x1'))(_0x2d3d('0x2'));var moment=require(_0x2d3d('0x3'));var BPromise=require(_0x2d3d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d3d('0x5'));var rimraf=require('rimraf');var config=require(_0x2d3d('0x6'));var attributes=require(_0x2d3d('0x7'));module[_0x2d3d('0x8')]=function(_0xfbc51e,_0x173719){return _0xfbc51e['define'](_0x2d3d('0x9'),attributes,{'tableName':_0x2d3d('0xa'),'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 2480200..7633cb0 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 _0x3204=['code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x595d94,_0x42d49e){var _0x4784f4=function(_0x1c5f27){while(--_0x1c5f27){_0x595d94['push'](_0x595d94['shift']());}};_0x4784f4(++_0x42d49e);}(_0x3204,0x1de));var _0x4320=function(_0x9c438c,_0x4de904){_0x9c438c=_0x9c438c-0x0;var _0x49ed42=_0x3204[_0x9c438c];return _0x49ed42;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require(_0x4320('0x4'));var fs=require('fs');var Redis=require(_0x4320('0x5'));var db=require(_0x4320('0x6'))['db'];var utils=require(_0x4320('0x7'));var logger=require(_0x4320('0x8'))(_0x4320('0x9'));var config=require(_0x4320('0xa'));var jayson=require(_0x4320('0xb'));var client=jayson['client'][_0x4320('0xc')]({'port':0x232a});config[_0x4320('0xd')]=_['defaults'](config['redis'],{'host':_0x4320('0xe'),'port':0x18eb});var socket=require(_0x4320('0xf'))(new Redis(config['redis']));require(_0x4320('0x10'))[_0x4320('0x11')](socket);function respondWithRpcPromise(_0x52e60e,_0x3599b8,_0x1b5cec){return new BPromise(function(_0x442d4c,_0xf21e5f){return client[_0x4320('0x12')](_0x52e60e,_0x1b5cec)[_0x4320('0x13')](function(_0x4d69c2){logger[_0x4320('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3599b8,_0x4320('0x15'));logger[_0x4320('0x16')](_0x4320('0x17'),_0x3599b8,_0x4320('0x15'),JSON[_0x4320('0x18')](_0x4d69c2));if(_0x4d69c2[_0x4320('0x19')]){if(_0x4d69c2['error'][_0x4320('0x1a')]===0x1f4){logger[_0x4320('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x3599b8,_0x4d69c2['error'][_0x4320('0x1b')]);return _0xf21e5f(_0x4d69c2[_0x4320('0x19')]['message']);}logger[_0x4320('0x19')](_0x4320('0x1c'),_0x3599b8,_0x4d69c2['error'][_0x4320('0x1b')]);return _0x442d4c(_0x4d69c2[_0x4320('0x19')][_0x4320('0x1b')]);}else{logger[_0x4320('0x14')](_0x4320('0x1c'),_0x3599b8,_0x4320('0x15'));_0x442d4c(_0x4d69c2[_0x4320('0x1d')][_0x4320('0x1b')]);}})[_0x4320('0x1e')](function(_0x556229){logger['error'](_0x4320('0x1c'),_0x3599b8,_0x556229);_0xf21e5f(_0x556229);});});}exports[_0x4320('0x1f')]=function(_0x19c6e1){var _0x204ecd=this;return new Promise(function(_0xaa449c,_0x5d523f){return db[_0x4320('0x20')][_0x4320('0x21')]({'raw':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x23')]===undefined?!![]:![]:!![],'where':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')]['where']||null:null,'attributes':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x24')]||null:null,'limit':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x25')]||null:null,'include':_0x19c6e1[_0x4320('0x22')]?_0x19c6e1[_0x4320('0x22')][_0x4320('0x26')]?_['map'](_0x19c6e1[_0x4320('0x22')][_0x4320('0x26')],function(_0x5e3765){return{'model':db[_0x5e3765['model']],'as':_0x5e3765['as'],'attributes':_0x5e3765[_0x4320('0x24')],'include':_0x5e3765['include']?_[_0x4320('0x27')](_0x5e3765['include'],function(_0xdb867){return{'model':db[_0xdb867[_0x4320('0x28')]],'as':_0xdb867['as'],'attributes':_0xdb867[_0x4320('0x24')],'include':_0xdb867[_0x4320('0x26')]?_[_0x4320('0x27')](_0xdb867[_0x4320('0x26')],function(_0x403b03){return{'model':db[_0x403b03['model']],'as':_0x403b03['as'],'attributes':_0x403b03[_0x4320('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4320('0x13')](function(_0x97aec0){logger[_0x4320('0x14')](_0x4320('0x1f'),_0x19c6e1);logger['debug'](_0x4320('0x1f'),_0x19c6e1,JSON['stringify'](_0x97aec0));_0xaa449c(_0x97aec0);})['catch'](function(_0x20ceb0){logger[_0x4320('0x19')](_0x4320('0x1f'),_0x20ceb0[_0x4320('0x1b')],_0x19c6e1);_0x5d523f(_0x204ecd[_0x4320('0x19')](0x1f4,_0x20ceb0[_0x4320('0x1b')]));});});};exports[_0x4320('0x29')]=function(_0x319ad4){var _0x1d6976=this;return new Promise(function(_0xaf02ec,_0x489d04){return db['WhatsappQueue']['find']({'raw':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')][_0x4320('0x23')]===undefined?!![]:![]:!![],'where':_0x319ad4['options']?_0x319ad4['options']['where']||null:null,'attributes':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')]['attributes']||null:null,'include':_0x319ad4[_0x4320('0x22')]?_0x319ad4[_0x4320('0x22')][_0x4320('0x26')]?_[_0x4320('0x27')](_0x319ad4[_0x4320('0x22')][_0x4320('0x26')],function(_0x1e4056){return{'model':db[_0x1e4056[_0x4320('0x28')]],'as':_0x1e4056['as'],'attributes':_0x1e4056[_0x4320('0x24')],'include':_0x1e4056[_0x4320('0x26')]?_[_0x4320('0x27')](_0x1e4056[_0x4320('0x26')],function(_0x529d2a){return{'model':db[_0x529d2a['model']],'as':_0x529d2a['as'],'attributes':_0x529d2a[_0x4320('0x24')],'include':_0x529d2a[_0x4320('0x26')]?_[_0x4320('0x27')](_0x529d2a['include'],function(_0x3ad9be){return{'model':db[_0x3ad9be[_0x4320('0x28')]],'as':_0x3ad9be['as'],'attributes':_0x3ad9be[_0x4320('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4320('0x13')](function(_0x57423d){logger['info'](_0x4320('0x29'),_0x319ad4);logger['debug'](_0x4320('0x29'),_0x319ad4,JSON[_0x4320('0x18')](_0x57423d));_0xaf02ec(_0x57423d);})['catch'](function(_0x52ef21){logger['error']('ShowWhatsappQueue',_0x52ef21[_0x4320('0x1b')],_0x319ad4);_0x489d04(_0x1d6976[_0x4320('0x19')](0x1f4,_0x52ef21['message']));});});}; \ No newline at end of file +var _0x830d=['./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x830d,0x149));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd830('0x0'));var util=require('util');var moment=require(_0xd830('0x1'));var BPromise=require(_0xd830('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd830('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd830('0x4'));var logger=require(_0xd830('0x5'))(_0xd830('0x6'));var config=require('../../config/environment');var jayson=require(_0xd830('0x7'));var client=jayson[_0xd830('0x8')][_0xd830('0x9')]({'port':0x232a});config[_0xd830('0xa')]=_[_0xd830('0xb')](config[_0xd830('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd830('0xc'))(new Redis(config[_0xd830('0xa')]));require(_0xd830('0xd'))['register'](socket);function respondWithRpcPromise(_0x3a2f7b,_0x92bb19,_0x41929b){return new BPromise(function(_0x64605f,_0x1d5c8a){return client[_0xd830('0xe')](_0x3a2f7b,_0x41929b)[_0xd830('0xf')](function(_0x1d9bc9){logger[_0xd830('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x92bb19,'request\x20sent');logger['debug'](_0xd830('0x11'),_0x92bb19,_0xd830('0x12'),JSON[_0xd830('0x13')](_0x1d9bc9));if(_0x1d9bc9['error']){if(_0x1d9bc9[_0xd830('0x14')][_0xd830('0x15')]===0x1f4){logger[_0xd830('0x14')](_0xd830('0x16'),_0x92bb19,_0x1d9bc9[_0xd830('0x14')][_0xd830('0x17')]);return _0x1d5c8a(_0x1d9bc9[_0xd830('0x14')][_0xd830('0x17')]);}logger[_0xd830('0x14')](_0xd830('0x16'),_0x92bb19,_0x1d9bc9['error'][_0xd830('0x17')]);return _0x64605f(_0x1d9bc9[_0xd830('0x14')][_0xd830('0x17')]);}else{logger[_0xd830('0x10')](_0xd830('0x16'),_0x92bb19,_0xd830('0x12'));_0x64605f(_0x1d9bc9[_0xd830('0x18')][_0xd830('0x17')]);}})[_0xd830('0x19')](function(_0x2751a4){logger['error'](_0xd830('0x16'),_0x92bb19,_0x2751a4);_0x1d5c8a(_0x2751a4);});});}exports[_0xd830('0x1a')]=function(_0x3cb20b){var _0x413636=this;return new Promise(function(_0x194f7b,_0x122558){return db[_0xd830('0x1b')][_0xd830('0x1c')]({'raw':_0x3cb20b[_0xd830('0x1d')]?_0x3cb20b[_0xd830('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3cb20b['options']?_0x3cb20b[_0xd830('0x1d')][_0xd830('0x1e')]||null:null,'attributes':_0x3cb20b[_0xd830('0x1d')]?_0x3cb20b['options'][_0xd830('0x1f')]||null:null,'limit':_0x3cb20b['options']?_0x3cb20b[_0xd830('0x1d')][_0xd830('0x20')]||null:null,'include':_0x3cb20b[_0xd830('0x1d')]?_0x3cb20b[_0xd830('0x1d')][_0xd830('0x21')]?_[_0xd830('0x22')](_0x3cb20b[_0xd830('0x1d')][_0xd830('0x21')],function(_0xa403e3){return{'model':db[_0xa403e3[_0xd830('0x23')]],'as':_0xa403e3['as'],'attributes':_0xa403e3[_0xd830('0x1f')],'include':_0xa403e3['include']?_[_0xd830('0x22')](_0xa403e3[_0xd830('0x21')],function(_0xc9e733){return{'model':db[_0xc9e733[_0xd830('0x23')]],'as':_0xc9e733['as'],'attributes':_0xc9e733[_0xd830('0x1f')],'include':_0xc9e733[_0xd830('0x21')]?_['map'](_0xc9e733['include'],function(_0x5579ba){return{'model':db[_0x5579ba[_0xd830('0x23')]],'as':_0x5579ba['as'],'attributes':_0x5579ba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd830('0xf')](function(_0x9a7a36){logger[_0xd830('0x10')]('GetWhatsappQueue',_0x3cb20b);logger['debug'](_0xd830('0x1a'),_0x3cb20b,JSON[_0xd830('0x13')](_0x9a7a36));_0x194f7b(_0x9a7a36);})[_0xd830('0x19')](function(_0x24e11a){logger[_0xd830('0x14')]('GetWhatsappQueue',_0x24e11a[_0xd830('0x17')],_0x3cb20b);_0x122558(_0x413636[_0xd830('0x14')](0x1f4,_0x24e11a['message']));});});};exports[_0xd830('0x24')]=function(_0x4f476c){var _0x4ee825=this;return new Promise(function(_0x418ccb,_0x123c14){return db[_0xd830('0x1b')]['find']({'raw':_0x4f476c['options']?_0x4f476c[_0xd830('0x1d')][_0xd830('0x25')]===undefined?!![]:![]:!![],'where':_0x4f476c[_0xd830('0x1d')]?_0x4f476c[_0xd830('0x1d')]['where']||null:null,'attributes':_0x4f476c[_0xd830('0x1d')]?_0x4f476c['options'][_0xd830('0x1f')]||null:null,'include':_0x4f476c[_0xd830('0x1d')]?_0x4f476c[_0xd830('0x1d')][_0xd830('0x21')]?_[_0xd830('0x22')](_0x4f476c['options']['include'],function(_0x321ce9){return{'model':db[_0x321ce9['model']],'as':_0x321ce9['as'],'attributes':_0x321ce9['attributes'],'include':_0x321ce9[_0xd830('0x21')]?_[_0xd830('0x22')](_0x321ce9[_0xd830('0x21')],function(_0x1c9fca){return{'model':db[_0x1c9fca[_0xd830('0x23')]],'as':_0x1c9fca['as'],'attributes':_0x1c9fca[_0xd830('0x1f')],'include':_0x1c9fca[_0xd830('0x21')]?_['map'](_0x1c9fca[_0xd830('0x21')],function(_0x176b4a){return{'model':db[_0x176b4a[_0xd830('0x23')]],'as':_0x176b4a['as'],'attributes':_0x176b4a[_0xd830('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd830('0xf')](function(_0x9cb712){logger[_0xd830('0x10')](_0xd830('0x24'),_0x4f476c);logger['debug'](_0xd830('0x24'),_0x4f476c,JSON[_0xd830('0x13')](_0x9cb712));_0x418ccb(_0x9cb712);})['catch'](function(_0x22b9be){logger[_0xd830('0x14')](_0xd830('0x24'),_0x22b9be[_0xd830('0x17')],_0x4f476c);_0x123c14(_0x4ee825[_0xd830('0x14')](0x1f4,_0x22b9be[_0xd830('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8789a7e..ad664e9 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 _0x94e0=['remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x47207c,_0x542b00){var _0x1fed32=function(_0x4dacb9){while(--_0x4dacb9){_0x47207c['push'](_0x47207c['shift']());}};_0x1fed32(++_0x542b00);}(_0x94e0,0x1e6));var _0x094e=function(_0x408fa7,_0x303486){_0x408fa7=_0x408fa7-0x0;var _0x1bceea=_0x94e0[_0x408fa7];return _0x1bceea;};'use strict';var WhatsappQueueEvents=require(_0x094e('0x0'));var events=[_0x094e('0x1'),_0x094e('0x2'),_0x094e('0x3')];function createListener(_0x3a2197,_0x20f30d){return function(_0x4401b9){_0x20f30d['emit'](_0x3a2197,_0x4401b9);};}function removeListener(_0x28e493,_0x3c1bcf){return function(){WhatsappQueueEvents[_0x094e('0x4')](_0x28e493,_0x3c1bcf);};}exports[_0x094e('0x5')]=function(_0x3f7e8a){for(var _0x1da557=0x0,_0x134568=events[_0x094e('0x6')];_0x1da557<_0x134568;_0x1da557++){var _0x5c1fb1=events[_0x1da557];var _0x9fa110=createListener(_0x094e('0x7')+_0x5c1fb1,_0x3f7e8a);WhatsappQueueEvents['on'](_0x5c1fb1,_0x9fa110);}}; \ No newline at end of file +var _0xb7c3=['emit','removeListener','register','length','whatsappQueue:','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7c3,0xec));var _0x3b7c=function(_0x54169f,_0x234960){_0x54169f=_0x54169f-0x0;var _0x45f08b=_0xb7c3[_0x54169f];return _0x45f08b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x3b7c('0x0'),_0x3b7c('0x1'),'update'];function createListener(_0x7e19a7,_0x436453){return function(_0x3ae405){_0x436453[_0x3b7c('0x2')](_0x7e19a7,_0x3ae405);};}function removeListener(_0x185894,_0x4b21ca){return function(){WhatsappQueueEvents[_0x3b7c('0x3')](_0x185894,_0x4b21ca);};}exports[_0x3b7c('0x4')]=function(_0x56db97){for(var _0x19b093=0x0,_0x2b56e0=events[_0x3b7c('0x5')];_0x19b093<_0x2b56e0;_0x19b093++){var _0xaee7df=events[_0x19b093];var _0x4652cf=createListener(_0x3b7c('0x6')+_0xaee7df,_0x56db97);WhatsappQueueEvents['on'](_0xaee7df,_0x4652cf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6de6b7c..ee9668f 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 _0xdf96=['create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x2ada6a,_0x49cece){var _0x42b8fa=function(_0x503f4f){while(--_0x503f4f){_0x2ada6a['push'](_0x2ada6a['shift']());}};_0x42b8fa(++_0x49cece);}(_0xdf96,0xfc));var _0x6df9=function(_0x100e6f,_0x268d1d){_0x100e6f=_0x100e6f-0x0;var _0x240425=_0xdf96[_0x100e6f];return _0x240425;};'use strict';var multer=require(_0x6df9('0x0'));var util=require(_0x6df9('0x1'));var path=require('path');var timeout=require(_0x6df9('0x2'));var express=require(_0x6df9('0x3'));var router=express['Router']();var fs_extra=require(_0x6df9('0x4'));var auth=require(_0x6df9('0x5'));var interaction=require(_0x6df9('0x6'));var config=require('../../config/environment');var controller=require(_0x6df9('0x7'));router[_0x6df9('0x8')]('/',auth[_0x6df9('0x9')](),controller[_0x6df9('0xa')]);router['get'](_0x6df9('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6df9('0x8')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller['show']);router[_0x6df9('0xd')]('/',auth['isAuthenticated'](),controller[_0x6df9('0xe')]);router[_0x6df9('0xf')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x10')]);router[_0x6df9('0x11')](_0x6df9('0xc'),auth[_0x6df9('0x9')](),controller[_0x6df9('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7553=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update'];(function(_0x54430c,_0x59b3d5){var _0x5ca43b=function(_0xbff27c){while(--_0xbff27c){_0x54430c['push'](_0x54430c['shift']());}};_0x5ca43b(++_0x59b3d5);}(_0x7553,0x8f));var _0x3755=function(_0x149ad5,_0x12b417){_0x149ad5=_0x149ad5-0x0;var _0x2566b7=_0x7553[_0x149ad5];return _0x2566b7;};'use strict';var multer=require('multer');var util=require(_0x3755('0x0'));var path=require(_0x3755('0x1'));var timeout=require(_0x3755('0x2'));var express=require(_0x3755('0x3'));var router=express[_0x3755('0x4')]();var fs_extra=require(_0x3755('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3755('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x3755('0x7')](),controller[_0x3755('0x8')]);router[_0x3755('0x9')](_0x3755('0xa'),auth[_0x3755('0x7')](),controller[_0x3755('0xb')]);router[_0x3755('0x9')](_0x3755('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3755('0xd')]('/',auth[_0x3755('0x7')](),controller[_0x3755('0xe')]);router[_0x3755('0xf')]('/:id',auth[_0x3755('0x7')](),controller[_0x3755('0x10')]);router[_0x3755('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3755('0x12')]);module[_0x3755('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 010d0e5..7dcdfd2 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xb7915c,_0x50cce1){var _0x1f340b=function(_0x1538c6){while(--_0x1538c6){_0xb7915c['push'](_0xb7915c['shift']());}};_0x1f340b(++_0x50cce1);}(_0x7a54,0x106));var _0x47a5=function(_0xa359fb,_0x4b726e){_0xa359fb=_0xa359fb-0x0;var _0x5e1a40=_0x7a54[_0xa359fb];return _0x5e1a40;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x39bf1b,_0x5b0b75){var _0x31968a=function(_0x373ce7){while(--_0x373ce7){_0x39bf1b['push'](_0x39bf1b['shift']());}};_0x31968a(++_0x5b0b75);}(_0x7a54,0x106));var _0x47a5=function(_0x28abf9,_0x33e8b5){_0x28abf9=_0x28abf9-0x0;var _0x5845f6=_0x7a54[_0x28abf9];return _0x5845f6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 7d7b271..10e0e54 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 _0x282b=['intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x21e544,_0x4e547a){var _0x185c00=function(_0x19210c){while(--_0x19210c){_0x21e544['push'](_0x21e544['shift']());}};_0x185c00(++_0x4e547a);}(_0x282b,0xec));var _0xb282=function(_0x25b185,_0x48ce87){_0x25b185=_0x25b185-0x0;var _0xed7eee=_0x282b[_0x25b185];return _0xed7eee;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['WhatsappQueueReport'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['WhatsappQueueReport'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));};exports[_0xb282('0x46')]=function(_0x22d129,_0x308aa8){return db[_0xb282('0x3d')]['describe']()[_0xb282('0x23')](respondWithResult(_0x308aa8,null))['catch'](handleError(_0x308aa8,null));}; \ No newline at end of file +var _0xb9be=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','WhatsappQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','options','includeAll','include','show','params','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xb9be,0xc5));var _0xeb9b=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xb9be[_0x1147ab];return _0x55cb5a;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];function respondWithStatusCode(_0x3df18a,_0x2a01df){_0x2a01df=_0x2a01df||0xcc;return function(_0x51598f){if(_0x51598f){return _0x3df18a['sendStatus'](_0x2a01df);}return _0x3df18a['status'](_0x2a01df)[_0xeb9b('0x19')]();};}function respondWithResult(_0x1ef03f,_0x2674e6){_0x2674e6=_0x2674e6||0xc8;return function(_0x4ec46d){if(_0x4ec46d){return _0x1ef03f['status'](_0x2674e6)['json'](_0x4ec46d);}};}function respondWithFilteredResult(_0x32538b,_0x1a5f27){return function(_0x406afd){if(_0x406afd){var _0x3fa308=typeof _0x1a5f27[_0xeb9b('0x1a')]===_0xeb9b('0x1b')&&typeof _0x1a5f27[_0xeb9b('0x1c')]==='undefined';var _0x2e8645=_0x406afd[_0xeb9b('0x1d')];var _0x21aca6=_0x3fa308?0x0:_0x1a5f27[_0xeb9b('0x1a')];var _0x3cbe3e=_0x3fa308?_0x406afd[_0xeb9b('0x1d')]:_0x1a5f27[_0xeb9b('0x1a')]+_0x1a5f27[_0xeb9b('0x1c')];var _0x2c199f;if(_0x3cbe3e>=_0x2e8645){_0x3cbe3e=_0x2e8645;_0x2c199f=0xc8;}else{_0x2c199f=0xce;}_0x32538b[_0xeb9b('0x1e')](_0x2c199f);return _0x32538b['set'](_0xeb9b('0x1f'),_0x21aca6+'-'+_0x3cbe3e+'/'+_0x2e8645)['json'](_0x406afd);}return null;};}function patchUpdates(_0x5d5f54){return function(_0x580498){try{jsonpatch[_0xeb9b('0x20')](_0x580498,_0x5d5f54,!![]);}catch(_0x4ab4b8){return BPromise[_0xeb9b('0x21')](_0x4ab4b8);}return _0x580498[_0xeb9b('0x22')]();};}function saveUpdates(_0x37935c,_0x37d7e0){return function(_0x3c8be7){if(_0x3c8be7){return _0x3c8be7[_0xeb9b('0x23')](_0x37935c)[_0xeb9b('0x24')](function(_0x15e5b8){return _0x15e5b8;});}return null;};}function removeEntity(_0x142d1c,_0x46df93){return function(_0x61c86d){if(_0x61c86d){return _0x61c86d[_0xeb9b('0x25')]()[_0xeb9b('0x24')](function(){_0x142d1c[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x19')]();});}};}function handleEntityNotFound(_0x434461,_0x4c997e){return function(_0xd57390){if(!_0xd57390){_0x434461['sendStatus'](0x194);}return _0xd57390;};}function handleError(_0x66a567,_0x5d6846){_0x5d6846=_0x5d6846||0x1f4;return function(_0x347ec1){logger[_0xeb9b('0x26')](_0x347ec1[_0xeb9b('0x27')]);if(_0x347ec1[_0xeb9b('0x28')]){delete _0x347ec1['name'];}_0x66a567[_0xeb9b('0x1e')](_0x5d6846)[_0xeb9b('0x29')](_0x347ec1);};}exports['index']=function(_0x35ff07,_0x33bb1d){var _0x5ce745={},_0x2a4b51={},_0x2ea20f={'count':0x0,'rows':[]};var _0x4188d5=_['map'](db[_0xeb9b('0x2a')]['rawAttributes'],function(_0x6bb66){return{'name':_0x6bb66['fieldName'],'type':_0x6bb66[_0xeb9b('0x2b')]['key']};});_0x2a4b51[_0xeb9b('0x2c')]=_['map'](_0x4188d5,_0xeb9b('0x28'));_0x2a4b51['query']=_[_0xeb9b('0x2d')](_0x35ff07[_0xeb9b('0x2e')]);_0x2a4b51[_0xeb9b('0x2f')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],_0x2a4b51[_0xeb9b('0x2e')]);_0x5ce745[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],qs[_0xeb9b('0x32')](_0x35ff07['query'][_0xeb9b('0x32')]));_0x5ce745[_0xeb9b('0x31')]=_0x5ce745[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x5ce745[_0xeb9b('0x31')]:_0x2a4b51[_0xeb9b('0x2c')];if(!_0x35ff07[_0xeb9b('0x2e')]['hasOwnProperty'](_0xeb9b('0x34'))){_0x5ce745[_0xeb9b('0x1c')]=qs[_0xeb9b('0x1c')](_0x35ff07['query'][_0xeb9b('0x1c')]);_0x5ce745[_0xeb9b('0x1a')]=qs[_0xeb9b('0x1a')](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x1a')]);}_0x5ce745[_0xeb9b('0x35')]=qs['sort'](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x36')]);_0x5ce745['where']=qs[_0xeb9b('0x2f')](_[_0xeb9b('0x37')](_0x35ff07[_0xeb9b('0x2e')],_0x2a4b51[_0xeb9b('0x2f')]),_0x4188d5);if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]){_0x5ce745[_0xeb9b('0x39')]=_['merge'](_0x5ce745[_0xeb9b('0x39')],{'$or':_[_0xeb9b('0x3a')](_0x4188d5,function(_0x3b5472){if(_0x3b5472['type']!=='VIRTUAL'){var _0x4eacc3={};_0x4eacc3[_0x3b5472[_0xeb9b('0x28')]]={'$like':'%'+_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]+'%'};return _0x4eacc3;}})});}_0x5ce745=_['merge']({},_0x5ce745,_0x35ff07[_0xeb9b('0x3b')]);var _0x9b36ae={'where':_0x5ce745[_0xeb9b('0x39')]};return db[_0xeb9b('0x2a')][_0xeb9b('0x1d')](_0x9b36ae)[_0xeb9b('0x24')](function(_0x377c9d){_0x2ea20f['count']=_0x377c9d;if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x5ce745[_0xeb9b('0x3d')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x5ce745);})[_0xeb9b('0x24')](function(_0x110122){_0x2ea20f['rows']=_0x110122;return _0x2ea20f;})[_0xeb9b('0x24')](respondWithFilteredResult(_0x33bb1d,_0x5ce745))['catch'](handleError(_0x33bb1d,null));};exports[_0xeb9b('0x3e')]=function(_0xcce4da,_0x28b075){var _0x300565={'raw':!![],'where':{'id':_0xcce4da[_0xeb9b('0x3f')]['id']}},_0xbee63e={};_0xbee63e[_0xeb9b('0x2c')]=_[_0xeb9b('0x2d')](db[_0xeb9b('0x2a')][_0xeb9b('0x40')]);_0xbee63e[_0xeb9b('0x2e')]=_[_0xeb9b('0x2d')](_0xcce4da['query']);_0xbee63e['filters']=_[_0xeb9b('0x30')](_0xbee63e['model'],_0xbee63e[_0xeb9b('0x2e')]);_0x300565[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0xbee63e['model'],qs[_0xeb9b('0x32')](_0xcce4da[_0xeb9b('0x2e')]['fields']));_0x300565[_0xeb9b('0x31')]=_0x300565[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x300565[_0xeb9b('0x31')]:_0xbee63e[_0xeb9b('0x2c')];if(_0xcce4da[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x300565[_0xeb9b('0x3d')]=[{'all':!![]}];}_0x300565=_['merge']({},_0x300565,_0xcce4da['options']);return db[_0xeb9b('0x2a')]['find'](_0x300565)['then'](handleEntityNotFound(_0x28b075,null))[_0xeb9b('0x24')](respondWithResult(_0x28b075,null))[_0xeb9b('0x41')](handleError(_0x28b075,null));};exports[_0xeb9b('0x42')]=function(_0x195f5a,_0x45bc74){return db[_0xeb9b('0x2a')]['create'](_0x195f5a['body'],{})['then'](respondWithResult(_0x45bc74,0xc9))[_0xeb9b('0x41')](handleError(_0x45bc74,null));};exports['update']=function(_0x4901b0,_0x2ee59c){if(_0x4901b0[_0xeb9b('0x43')]['id']){delete _0x4901b0[_0xeb9b('0x43')]['id'];}return db[_0xeb9b('0x2a')][_0xeb9b('0x44')]({'where':{'id':_0x4901b0[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x2ee59c,null))[_0xeb9b('0x24')](saveUpdates(_0x4901b0[_0xeb9b('0x43')],null))['then'](respondWithResult(_0x2ee59c,null))['catch'](handleError(_0x2ee59c,null));};exports[_0xeb9b('0x25')]=function(_0x21c93a,_0x542ef4){return db[_0xeb9b('0x2a')]['find']({'where':{'id':_0x21c93a[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x542ef4,null))['then'](removeEntity(_0x542ef4,null))['catch'](handleError(_0x542ef4,null));};exports['describe']=function(_0x211238,_0x32d8cd){return db[_0xeb9b('0x2a')]['describe']()['then'](respondWithResult(_0x32d8cd,null))[_0xeb9b('0x41')](handleError(_0x32d8cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4b73d56..9ca76f2 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 _0xa5ad=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x4d8c6b,_0x480bd5){var _0x5ed0a1=function(_0x52d8f3){while(--_0x52d8f3){_0x4d8c6b['push'](_0x4d8c6b['shift']());}};_0x5ed0a1(++_0x480bd5);}(_0xa5ad,0x154));var _0xda5a=function(_0x2184cc,_0x196b48){_0x2184cc=_0x2184cc-0x0;var _0x4e7946=_0xa5ad[_0x2184cc];return _0x4e7946;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda5a('0x0'))('api');var moment=require(_0xda5a('0x1'));var BPromise=require('bluebird');var rp=require(_0xda5a('0x2'));var fs=require('fs');var path=require(_0xda5a('0x3'));var rimraf=require(_0xda5a('0x4'));var config=require(_0xda5a('0x5'));var attributes=require(_0xda5a('0x6'));module[_0xda5a('0x7')]=function(_0x30b42d,_0x31528f){return _0x30b42d[_0xda5a('0x8')](_0xda5a('0x9'),attributes,{'tableName':_0xda5a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xda5a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3544=['./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x581d5e,_0x40f853){var _0xd94d13=function(_0x25907f){while(--_0x25907f){_0x581d5e['push'](_0x581d5e['shift']());}};_0xd94d13(++_0x40f853);}(_0x3544,0x176));var _0x4354=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x3544[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require('lodash');var util=require(_0x4354('0x0'));var logger=require(_0x4354('0x1'))('api');var moment=require(_0x4354('0x2'));var BPromise=require('bluebird');var rp=require(_0x4354('0x3'));var fs=require('fs');var path=require(_0x4354('0x4'));var rimraf=require(_0x4354('0x5'));var config=require('../../config/environment');var attributes=require(_0x4354('0x6'));module['exports']=function(_0x5369ca,_0x54dd41){return _0x5369ca['define'](_0x4354('0x7'),attributes,{'tableName':_0x4354('0x8'),'paranoid':![],'indexes':[{'name':_0x4354('0x9'),'fields':[_0x4354('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 50a43f6..2d95e77 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 _0x2de6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateWhatsappQueueReport','create','body','options','raw','then','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','limit','stringify','lodash','util'];(function(_0x562d6a,_0xab7601){var _0x5220f6=function(_0x367d10){while(--_0x367d10){_0x562d6a['push'](_0x562d6a['shift']());}};_0x5220f6(++_0xab7601);}(_0x2de6,0x15c));var _0x62de=function(_0x2c2b72,_0x2d442b){_0x2c2b72=_0x2c2b72-0x0;var _0x2cc253=_0x2de6[_0x2c2b72];return _0x2cc253;};'use strict';var _=require(_0x62de('0x0'));var util=require(_0x62de('0x1'));var moment=require(_0x62de('0x2'));var BPromise=require(_0x62de('0x3'));var rs=require(_0x62de('0x4'));var fs=require('fs');var Redis=require(_0x62de('0x5'));var db=require(_0x62de('0x6'))['db'];var utils=require(_0x62de('0x7'));var logger=require(_0x62de('0x8'))(_0x62de('0x9'));var config=require(_0x62de('0xa'));var jayson=require(_0x62de('0xb'));var client=jayson[_0x62de('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2da5f,_0x51f98f,_0x20d01d){return new BPromise(function(_0x139619,_0x2526b3){return client[_0x62de('0xd')](_0xd2da5f,_0x20d01d)['then'](function(_0x33bf23){logger[_0x62de('0xe')](_0x62de('0xf'),_0x51f98f,_0x62de('0x10'));logger[_0x62de('0x11')](_0x62de('0x12'),_0x51f98f,'request\x20sent',JSON['stringify'](_0x33bf23));if(_0x33bf23[_0x62de('0x13')]){if(_0x33bf23[_0x62de('0x13')]['code']===0x1f4){logger[_0x62de('0x13')](_0x62de('0xf'),_0x51f98f,_0x33bf23[_0x62de('0x13')][_0x62de('0x14')]);return _0x2526b3(_0x33bf23[_0x62de('0x13')]['message']);}logger['error'](_0x62de('0xf'),_0x51f98f,_0x33bf23['error']['message']);return _0x139619(_0x33bf23[_0x62de('0x13')][_0x62de('0x14')]);}else{logger[_0x62de('0xe')](_0x62de('0xf'),_0x51f98f,_0x62de('0x10'));_0x139619(_0x33bf23[_0x62de('0x15')][_0x62de('0x14')]);}})['catch'](function(_0xbeaaf){logger[_0x62de('0x13')](_0x62de('0xf'),_0x51f98f,_0xbeaaf);_0x2526b3(_0xbeaaf);});});}exports[_0x62de('0x16')]=function(_0x4a3b21){var _0x4068a1=this;return new Promise(function(_0x139387,_0x2c0fd3){return db['WhatsappQueueReport'][_0x62de('0x17')](_0x4a3b21[_0x62de('0x18')],{'raw':_0x4a3b21[_0x62de('0x19')]?_0x4a3b21[_0x62de('0x19')][_0x62de('0x1a')]===undefined?!![]:![]:!![]})[_0x62de('0x1b')](function(_0x16b4d6){logger['info']('CreateWhatsappQueueReport',_0x4a3b21);logger[_0x62de('0x11')](_0x62de('0x16'),_0x4a3b21,JSON['stringify'](_0x16b4d6));_0x139387(_0x16b4d6);})[_0x62de('0x1c')](function(_0x41f780){logger[_0x62de('0x13')](_0x62de('0x16'),_0x41f780[_0x62de('0x14')],_0x4a3b21);_0x2c0fd3(_0x4068a1[_0x62de('0x13')](0x1f4,_0x41f780[_0x62de('0x14')]));});});};exports[_0x62de('0x1d')]=function(_0x9d5e7e){var _0x4f06a0=this;return new Promise(function(_0x2b95c7,_0x535d58){return db[_0x62de('0x1e')]['update'](_0x9d5e7e[_0x62de('0x18')],{'raw':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x1f')]||null:null,'attributes':_0x9d5e7e[_0x62de('0x19')]?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x20')]||null:null,'limit':_0x9d5e7e['options']?_0x9d5e7e[_0x62de('0x19')][_0x62de('0x21')]||null:null})[_0x62de('0x1b')](function(_0x5a47a6){logger[_0x62de('0xe')](_0x62de('0x1d'),_0x9d5e7e);logger[_0x62de('0x11')]('UpdateWhatsappQueueReport',_0x9d5e7e,JSON[_0x62de('0x22')](_0x5a47a6));_0x2b95c7(_0x5a47a6);})[_0x62de('0x1c')](function(_0x317a8b){logger[_0x62de('0x13')](_0x62de('0x1d'),_0x317a8b[_0x62de('0x14')],_0x9d5e7e);_0x535d58(_0x4f06a0[_0x62de('0x13')](0x1f4,_0x317a8b[_0x62de('0x14')]));});});}; \ No newline at end of file +var _0xe921=['client','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4b3444,_0x223723){var _0x333126=function(_0x3b59b1){while(--_0x3b59b1){_0x4b3444['push'](_0x4b3444['shift']());}};_0x333126(++_0x223723);}(_0xe921,0x1e6));var _0x1e92=function(_0x265571,_0x574a52){_0x265571=_0x265571-0x0;var _0x437f95=_0xe921[_0x265571];return _0x437f95;};'use strict';var _=require(_0x1e92('0x0'));var util=require(_0x1e92('0x1'));var moment=require('moment');var BPromise=require(_0x1e92('0x2'));var rs=require(_0x1e92('0x3'));var fs=require('fs');var Redis=require(_0x1e92('0x4'));var db=require(_0x1e92('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e92('0x6'));var config=require(_0x1e92('0x7'));var jayson=require(_0x1e92('0x8'));var client=jayson[_0x1e92('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5aae,_0x3a39c3,_0x565be6){return new BPromise(function(_0x4c4580,_0x21d471){return client[_0x1e92('0xa')](_0x2b5aae,_0x565be6)['then'](function(_0x2a1bdf){logger['info'](_0x1e92('0xb'),_0x3a39c3,_0x1e92('0xc'));logger[_0x1e92('0xd')](_0x1e92('0xe'),_0x3a39c3,_0x1e92('0xc'),JSON[_0x1e92('0xf')](_0x2a1bdf));if(_0x2a1bdf['error']){if(_0x2a1bdf['error'][_0x1e92('0x10')]===0x1f4){logger['error'](_0x1e92('0xb'),_0x3a39c3,_0x2a1bdf[_0x1e92('0x11')][_0x1e92('0x12')]);return _0x21d471(_0x2a1bdf[_0x1e92('0x11')][_0x1e92('0x12')]);}logger[_0x1e92('0x11')](_0x1e92('0xb'),_0x3a39c3,_0x2a1bdf[_0x1e92('0x11')][_0x1e92('0x12')]);return _0x4c4580(_0x2a1bdf['error'][_0x1e92('0x12')]);}else{logger[_0x1e92('0x13')](_0x1e92('0xb'),_0x3a39c3,_0x1e92('0xc'));_0x4c4580(_0x2a1bdf[_0x1e92('0x14')][_0x1e92('0x12')]);}})[_0x1e92('0x15')](function(_0x3f92c6){logger[_0x1e92('0x11')](_0x1e92('0xb'),_0x3a39c3,_0x3f92c6);_0x21d471(_0x3f92c6);});});}exports[_0x1e92('0x16')]=function(_0x6cc7e8){var _0x43868e=this;return new Promise(function(_0xe618a4,_0x4ce0db){return db[_0x1e92('0x17')][_0x1e92('0x18')](_0x6cc7e8[_0x1e92('0x19')],{'raw':_0x6cc7e8[_0x1e92('0x1a')]?_0x6cc7e8[_0x1e92('0x1a')][_0x1e92('0x1b')]===undefined?!![]:![]:!![]})[_0x1e92('0x1c')](function(_0x5591fb){logger['info']('CreateWhatsappQueueReport',_0x6cc7e8);logger['debug'](_0x1e92('0x16'),_0x6cc7e8,JSON['stringify'](_0x5591fb));_0xe618a4(_0x5591fb);})[_0x1e92('0x15')](function(_0x101ee5){logger['error'](_0x1e92('0x16'),_0x101ee5[_0x1e92('0x12')],_0x6cc7e8);_0x4ce0db(_0x43868e[_0x1e92('0x11')](0x1f4,_0x101ee5[_0x1e92('0x12')]));});});};exports[_0x1e92('0x1d')]=function(_0x2a8ae9){var _0xf01077=this;return new Promise(function(_0x3f740f,_0x56a68e){return db[_0x1e92('0x17')][_0x1e92('0x1e')](_0x2a8ae9[_0x1e92('0x19')],{'raw':_0x2a8ae9[_0x1e92('0x1a')]?_0x2a8ae9[_0x1e92('0x1a')][_0x1e92('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8ae9['options']?_0x2a8ae9[_0x1e92('0x1a')][_0x1e92('0x1f')]||null:null,'attributes':_0x2a8ae9[_0x1e92('0x1a')]?_0x2a8ae9[_0x1e92('0x1a')]['attributes']||null:null,'limit':_0x2a8ae9[_0x1e92('0x1a')]?_0x2a8ae9[_0x1e92('0x1a')][_0x1e92('0x20')]||null:null})['then'](function(_0x34277b){logger[_0x1e92('0x13')](_0x1e92('0x1d'),_0x2a8ae9);logger[_0x1e92('0xd')](_0x1e92('0x1d'),_0x2a8ae9,JSON['stringify'](_0x34277b));_0x3f740f(_0x34277b);})[_0x1e92('0x15')](function(_0x402973){logger[_0x1e92('0x11')](_0x1e92('0x1d'),_0x402973[_0x1e92('0x12')],_0x2a8ae9);_0x56a68e(_0xf01077[_0x1e92('0x11')](0x1f4,_0x402973['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8f1f816..1aef0a3 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 _0xfa6a=['show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x4e7334,_0x30576c){var _0x43c5af=function(_0x492d06){while(--_0x492d06){_0x4e7334['push'](_0x4e7334['shift']());}};_0x43c5af(++_0x30576c);}(_0xfa6a,0x1a5));var _0xafa6=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xfa6a[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xafa6('0x0'));var util=require('util');var path=require(_0xafa6('0x1'));var timeout=require(_0xafa6('0x2'));var express=require(_0xafa6('0x3'));var router=express[_0xafa6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xafa6('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xafa6('0x7')]('/',auth[_0xafa6('0x8')](),controller['index']);router['get']('/describe',auth[_0xafa6('0x8')](),controller[_0xafa6('0x9')]);router[_0xafa6('0x7')](_0xafa6('0xa'),auth['isAuthenticated'](),controller[_0xafa6('0xb')]);router[_0xafa6('0xc')]('/',auth[_0xafa6('0x8')](),controller[_0xafa6('0xd')]);router[_0xafa6('0xe')](_0xafa6('0xa'),auth[_0xafa6('0x8')](),controller[_0xafa6('0xf')]);router[_0xafa6('0x10')](_0xafa6('0xa'),auth[_0xafa6('0x8')](),controller['destroy']);module[_0xafa6('0x11')]=router; \ No newline at end of file +var _0xaf1a=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','delete','exports','multer'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xaf1a,0x186));var _0xaaf1=function(_0x1b91ea,_0x54e450){_0x1b91ea=_0x1b91ea-0x0;var _0x1f71b8=_0xaf1a[_0x1b91ea];return _0x1f71b8;};'use strict';var multer=require(_0xaaf1('0x0'));var util=require(_0xaaf1('0x1'));var path=require(_0xaaf1('0x2'));var timeout=require(_0xaaf1('0x3'));var express=require('express');var router=express[_0xaaf1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaaf1('0x5'));var interaction=require(_0xaaf1('0x6'));var config=require('../../config/environment');var controller=require(_0xaaf1('0x7'));router[_0xaaf1('0x8')]('/',auth[_0xaaf1('0x9')](),controller['index']);router[_0xaaf1('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xaaf1('0xa')]);router[_0xaaf1('0x8')](_0xaaf1('0xb'),auth[_0xaaf1('0x9')](),controller[_0xaaf1('0xc')]);router['post']('/',auth[_0xaaf1('0x9')](),controller[_0xaaf1('0xd')]);router[_0xaaf1('0xe')](_0xaaf1('0xb'),auth[_0xaaf1('0x9')](),controller['update']);router[_0xaaf1('0xf')](_0xaaf1('0xb'),auth[_0xaaf1('0x9')](),controller['destroy']);module[_0xaaf1('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6700482..466fe66 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 _0xab40=['sequelize','exports','agent','queue','DATE'];(function(_0x4a212b,_0x49b345){var _0x3a4cfc=function(_0x4ebdeb){while(--_0x4ebdeb){_0x4a212b['push'](_0x4a212b['shift']());}};_0x3a4cfc(++_0x49b345);}(_0xab40,0xcd));var _0x0ab4=function(_0x293d78,_0x479abd){_0x293d78=_0x293d78-0x0;var _0x15bd7b=_0xab40[_0x293d78];return _0x15bd7b;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x0ab4('0x2'),_0x0ab4('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0ab4('0x4')]}}; \ No newline at end of file +var _0x6000=['agent','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x29b90d,_0x4835e8){var _0x146441=function(_0x568336){while(--_0x568336){_0x29b90d['push'](_0x29b90d['shift']());}};_0x146441(++_0x4835e8);}(_0x6000,0x17c));var _0x0600=function(_0x26d160,_0x2aeb17){_0x26d160=_0x26d160-0x0;var _0x3451c8=_0x6000[_0x26d160];return _0x3451c8;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'uniqueid':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0600('0x3')](_0x0600('0x4'),_0x0600('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0600('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index efb14ee..a87c812 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 _0x1409=['offset','limit','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','send','index','map','WhatsappTransferReport','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','include','findAll','show','params','fields','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1409,0x79));var _0x9140=function(_0x1c37bc,_0x4e75f6){_0x1c37bc=_0x1c37bc-0x0;var _0x121630=_0x1409[_0x1c37bc];return _0x121630;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9140('0x0'));var zipdir=require(_0x9140('0x1'));var jsonpatch=require(_0x9140('0x2'));var rp=require(_0x9140('0x3'));var moment=require(_0x9140('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9140('0x5'));var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require(_0x9140('0x8'));var csv=require(_0x9140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require('squel');var crypto=require(_0x9140('0xc'));var jsforce=require(_0x9140('0xd'));var deskjs=require(_0x9140('0xe'));var toCsv=require(_0x9140('0x9'));var querystring=require('querystring');var Papa=require(_0x9140('0xf'));var Redis=require(_0x9140('0x10'));var authService=require(_0x9140('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9140('0x12'));var hardwareService=require(_0x9140('0x13'));var logger=require(_0x9140('0x14'))(_0x9140('0x15'));var utils=require(_0x9140('0x16'));var config=require(_0x9140('0x17'));var licenseUtil=require(_0x9140('0x18'));var db=require(_0x9140('0x19'))['db'];function respondWithStatusCode(_0x149bc3,_0x4a125c){_0x4a125c=_0x4a125c||0xcc;return function(_0x4d6996){if(_0x4d6996){return _0x149bc3['sendStatus'](_0x4a125c);}return _0x149bc3['status'](_0x4a125c)[_0x9140('0x1a')]();};}function respondWithResult(_0x371912,_0x4dcd3a){_0x4dcd3a=_0x4dcd3a||0xc8;return function(_0xe3e26){if(_0xe3e26){return _0x371912[_0x9140('0x1b')](_0x4dcd3a)[_0x9140('0x1c')](_0xe3e26);}};}function respondWithFilteredResult(_0x4746d9,_0x1d45c0){return function(_0x56bea4){if(_0x56bea4){var _0x56e5b2=typeof _0x1d45c0[_0x9140('0x1d')]==='undefined'&&typeof _0x1d45c0[_0x9140('0x1e')]===_0x9140('0x1f');var _0x21e9c2=_0x56bea4[_0x9140('0x20')];var _0x4102f5=_0x56e5b2?0x0:_0x1d45c0[_0x9140('0x1d')];var _0x628bc8=_0x56e5b2?_0x56bea4[_0x9140('0x20')]:_0x1d45c0['offset']+_0x1d45c0[_0x9140('0x1e')];var _0x54f915;if(_0x628bc8>=_0x21e9c2){_0x628bc8=_0x21e9c2;_0x54f915=0xc8;}else{_0x54f915=0xce;}_0x4746d9[_0x9140('0x1b')](_0x54f915);return _0x4746d9[_0x9140('0x21')](_0x9140('0x22'),_0x4102f5+'-'+_0x628bc8+'/'+_0x21e9c2)['json'](_0x56bea4);}return null;};}function patchUpdates(_0x2b6c76){return function(_0x1cdfb0){try{jsonpatch['apply'](_0x1cdfb0,_0x2b6c76,!![]);}catch(_0x4b5c03){return BPromise['reject'](_0x4b5c03);}return _0x1cdfb0[_0x9140('0x23')]();};}function saveUpdates(_0x10a815,_0x20ce47){return function(_0x2f36f3){if(_0x2f36f3){return _0x2f36f3[_0x9140('0x24')](_0x10a815)['then'](function(_0x3afc3b){return _0x3afc3b;});}return null;};}function removeEntity(_0x10dc94,_0x283e5c){return function(_0x436851){if(_0x436851){return _0x436851[_0x9140('0x25')]()[_0x9140('0x26')](function(){_0x10dc94[_0x9140('0x1b')](0xcc)[_0x9140('0x1a')]();});}};}function handleEntityNotFound(_0x5e7c5e,_0xc589fe){return function(_0x26d5b9){if(!_0x26d5b9){_0x5e7c5e[_0x9140('0x27')](0x194);}return _0x26d5b9;};}function handleError(_0x39ae5d,_0x39455a){_0x39455a=_0x39455a||0x1f4;return function(_0x3a0645){logger[_0x9140('0x28')](_0x3a0645[_0x9140('0x29')]);if(_0x3a0645['name']){delete _0x3a0645['name'];}_0x39ae5d[_0x9140('0x1b')](_0x39455a)[_0x9140('0x2a')](_0x3a0645);};}exports[_0x9140('0x2b')]=function(_0x312748,_0x58b483){var _0x2c255d={},_0xb3ea29={},_0x1cd721={'count':0x0,'rows':[]};var _0x271bd4=_[_0x9140('0x2c')](db[_0x9140('0x2d')][_0x9140('0x2e')],function(_0x425735){return{'name':_0x425735['fieldName'],'type':_0x425735[_0x9140('0x2f')][_0x9140('0x30')]};});_0xb3ea29['model']=_[_0x9140('0x2c')](_0x271bd4,_0x9140('0x31'));_0xb3ea29[_0x9140('0x32')]=_[_0x9140('0x33')](_0x312748['query']);_0xb3ea29[_0x9140('0x34')]=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],_0xb3ea29[_0x9140('0x32')]);_0x2c255d['attributes']=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],qs['fields'](_0x312748['query']['fields']));_0x2c255d['attributes']=_0x2c255d[_0x9140('0x37')][_0x9140('0x38')]?_0x2c255d[_0x9140('0x37')]:_0xb3ea29[_0x9140('0x36')];if(!_0x312748[_0x9140('0x32')][_0x9140('0x39')](_0x9140('0x3a'))){_0x2c255d['limit']=qs[_0x9140('0x1e')](_0x312748[_0x9140('0x32')][_0x9140('0x1e')]);_0x2c255d['offset']=qs[_0x9140('0x1d')](_0x312748[_0x9140('0x32')][_0x9140('0x1d')]);}_0x2c255d['order']=qs[_0x9140('0x3b')](_0x312748[_0x9140('0x32')][_0x9140('0x3b')]);_0x2c255d[_0x9140('0x3c')]=qs[_0x9140('0x34')](_['pick'](_0x312748[_0x9140('0x32')],_0xb3ea29[_0x9140('0x34')]),_0x271bd4);if(_0x312748['query']['filter']){_0x2c255d[_0x9140('0x3c')]=_[_0x9140('0x3d')](_0x2c255d[_0x9140('0x3c')],{'$or':_[_0x9140('0x2c')](_0x271bd4,function(_0x598e4a){if(_0x598e4a[_0x9140('0x2f')]!=='VIRTUAL'){var _0x4bb777={};_0x4bb777[_0x598e4a[_0x9140('0x31')]]={'$like':'%'+_0x312748[_0x9140('0x32')][_0x9140('0x3e')]+'%'};return _0x4bb777;}})});}_0x2c255d=_['merge']({},_0x2c255d,_0x312748['options']);var _0x1f3a87={'where':_0x2c255d[_0x9140('0x3c')]};return db['WhatsappTransferReport']['count'](_0x1f3a87)['then'](function(_0x5f08b5){_0x1cd721[_0x9140('0x20')]=_0x5f08b5;if(_0x312748[_0x9140('0x32')]['includeAll']){_0x2c255d[_0x9140('0x3f')]=[{'all':!![]}];}return db[_0x9140('0x2d')][_0x9140('0x40')](_0x2c255d);})[_0x9140('0x26')](function(_0x292fd2){_0x1cd721['rows']=_0x292fd2;return _0x1cd721;})[_0x9140('0x26')](respondWithFilteredResult(_0x58b483,_0x2c255d))['catch'](handleError(_0x58b483,null));};exports[_0x9140('0x41')]=function(_0x2c7f31,_0x5e648b){var _0x572fcb={'raw':!![],'where':{'id':_0x2c7f31[_0x9140('0x42')]['id']}},_0xc13fad={};_0xc13fad[_0x9140('0x36')]=_[_0x9140('0x33')](db['WhatsappTransferReport'][_0x9140('0x2e')]);_0xc13fad['query']=_[_0x9140('0x33')](_0x2c7f31['query']);_0xc13fad[_0x9140('0x34')]=_[_0x9140('0x35')](_0xc13fad[_0x9140('0x36')],_0xc13fad[_0x9140('0x32')]);_0x572fcb[_0x9140('0x37')]=_['intersection'](_0xc13fad[_0x9140('0x36')],qs[_0x9140('0x43')](_0x2c7f31[_0x9140('0x32')][_0x9140('0x43')]));_0x572fcb['attributes']=_0x572fcb[_0x9140('0x37')][_0x9140('0x38')]?_0x572fcb[_0x9140('0x37')]:_0xc13fad[_0x9140('0x36')];if(_0x2c7f31[_0x9140('0x32')][_0x9140('0x44')]){_0x572fcb['include']=[{'all':!![]}];}_0x572fcb=_['merge']({},_0x572fcb,_0x2c7f31[_0x9140('0x45')]);return db[_0x9140('0x2d')][_0x9140('0x46')](_0x572fcb)[_0x9140('0x26')](handleEntityNotFound(_0x5e648b,null))[_0x9140('0x26')](respondWithResult(_0x5e648b,null))[_0x9140('0x47')](handleError(_0x5e648b,null));};exports['create']=function(_0x343b23,_0x5c116a){return db[_0x9140('0x2d')][_0x9140('0x48')](_0x343b23[_0x9140('0x49')],{})['then'](respondWithResult(_0x5c116a,0xc9))[_0x9140('0x47')](handleError(_0x5c116a,null));};exports[_0x9140('0x24')]=function(_0x32f6e8,_0x59ec8a){if(_0x32f6e8[_0x9140('0x49')]['id']){delete _0x32f6e8[_0x9140('0x49')]['id'];}return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x32f6e8['params']['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x59ec8a,null))[_0x9140('0x26')](saveUpdates(_0x32f6e8['body'],null))[_0x9140('0x26')](respondWithResult(_0x59ec8a,null))[_0x9140('0x47')](handleError(_0x59ec8a,null));};exports[_0x9140('0x25')]=function(_0x58793b,_0x334319){return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x58793b[_0x9140('0x42')]['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x334319,null))[_0x9140('0x26')](removeEntity(_0x334319,null))[_0x9140('0x47')](handleError(_0x334319,null));};exports[_0x9140('0x4a')]=function(_0x3724cc,_0x3bad42){return db['WhatsappTransferReport']['describe']()[_0x9140('0x26')](respondWithResult(_0x3bad42,null))['catch'](handleError(_0x3bad42,null));}; \ No newline at end of file +var _0xa01c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','WhatsappTransferReport','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe'];(function(_0x52a104,_0xed6f5f){var _0x21cdd5=function(_0x4eb1cf){while(--_0x4eb1cf){_0x52a104['push'](_0x52a104['shift']());}};_0x21cdd5(++_0xed6f5f);}(_0xa01c,0x1c8));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca01('0x0'));var zipdir=require(_0xca01('0x1'));var jsonpatch=require(_0xca01('0x2'));var rp=require(_0xca01('0x3'));var moment=require(_0xca01('0x4'));var BPromise=require(_0xca01('0x5'));var Mustache=require(_0xca01('0x6'));var util=require(_0xca01('0x7'));var path=require(_0xca01('0x8'));var sox=require(_0xca01('0x9'));var csv=require(_0xca01('0xa'));var ejs=require(_0xca01('0xb'));var fs=require('fs');var fs_extra=require(_0xca01('0xc'));var _=require(_0xca01('0xd'));var squel=require('squel');var crypto=require(_0xca01('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xca01('0xf'));var toCsv=require(_0xca01('0xa'));var querystring=require('querystring');var Papa=require(_0xca01('0x10'));var Redis=require(_0xca01('0x11'));var authService=require(_0xca01('0x12'));var qs=require(_0xca01('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca01('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xca01('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xca01('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a989,_0x522c96){_0x522c96=_0x522c96||0xcc;return function(_0x4e1cdc){if(_0x4e1cdc){return _0x42a989['sendStatus'](_0x522c96);}return _0x42a989[_0xca01('0x17')](_0x522c96)['end']();};}function respondWithResult(_0x3dd0c2,_0x31f671){_0x31f671=_0x31f671||0xc8;return function(_0x1573c0){if(_0x1573c0){return _0x3dd0c2['status'](_0x31f671)[_0xca01('0x18')](_0x1573c0);}};}function respondWithFilteredResult(_0x39e922,_0x2417b0){return function(_0x1f000a){if(_0x1f000a){var _0x59bfc8=typeof _0x2417b0['offset']===_0xca01('0x19')&&typeof _0x2417b0['limit']==='undefined';var _0x4d7147=_0x1f000a[_0xca01('0x1a')];var _0x854b4=_0x59bfc8?0x0:_0x2417b0[_0xca01('0x1b')];var _0x13c4d1=_0x59bfc8?_0x1f000a[_0xca01('0x1a')]:_0x2417b0[_0xca01('0x1b')]+_0x2417b0[_0xca01('0x1c')];var _0xb73249;if(_0x13c4d1>=_0x4d7147){_0x13c4d1=_0x4d7147;_0xb73249=0xc8;}else{_0xb73249=0xce;}_0x39e922[_0xca01('0x17')](_0xb73249);return _0x39e922[_0xca01('0x1d')](_0xca01('0x1e'),_0x854b4+'-'+_0x13c4d1+'/'+_0x4d7147)[_0xca01('0x18')](_0x1f000a);}return null;};}function patchUpdates(_0x133fb7){return function(_0x5e84bf){try{jsonpatch[_0xca01('0x1f')](_0x5e84bf,_0x133fb7,!![]);}catch(_0x374e0d){return BPromise[_0xca01('0x20')](_0x374e0d);}return _0x5e84bf[_0xca01('0x21')]();};}function saveUpdates(_0x2d62cd,_0x2bbbd8){return function(_0x5ea6cd){if(_0x5ea6cd){return _0x5ea6cd[_0xca01('0x22')](_0x2d62cd)['then'](function(_0x1ea9ac){return _0x1ea9ac;});}return null;};}function removeEntity(_0x2cc46d,_0x14df84){return function(_0x3cda24){if(_0x3cda24){return _0x3cda24[_0xca01('0x23')]()['then'](function(){_0x2cc46d['status'](0xcc)[_0xca01('0x24')]();});}};}function handleEntityNotFound(_0x4f3bf6,_0x2f502f){return function(_0xf3081e){if(!_0xf3081e){_0x4f3bf6[_0xca01('0x25')](0x194);}return _0xf3081e;};}function handleError(_0x389e3e,_0xbbc6ec){_0xbbc6ec=_0xbbc6ec||0x1f4;return function(_0x2e7309){logger[_0xca01('0x26')](_0x2e7309[_0xca01('0x27')]);if(_0x2e7309[_0xca01('0x28')]){delete _0x2e7309[_0xca01('0x28')];}_0x389e3e[_0xca01('0x17')](_0xbbc6ec)['send'](_0x2e7309);};}exports[_0xca01('0x29')]=function(_0x308f3e,_0x125164){var _0xf437aa={},_0x3a6cab={},_0x390301={'count':0x0,'rows':[]};var _0x2d2d9f=_['map'](db[_0xca01('0x2a')]['rawAttributes'],function(_0x33e804){return{'name':_0x33e804[_0xca01('0x2b')],'type':_0x33e804[_0xca01('0x2c')][_0xca01('0x2d')]};});_0x3a6cab[_0xca01('0x2e')]=_[_0xca01('0x2f')](_0x2d2d9f,_0xca01('0x28'));_0x3a6cab['query']=_[_0xca01('0x30')](_0x308f3e[_0xca01('0x31')]);_0x3a6cab[_0xca01('0x32')]=_['intersection'](_0x3a6cab[_0xca01('0x2e')],_0x3a6cab[_0xca01('0x31')]);_0xf437aa[_0xca01('0x33')]=_[_0xca01('0x34')](_0x3a6cab[_0xca01('0x2e')],qs[_0xca01('0x35')](_0x308f3e['query'][_0xca01('0x35')]));_0xf437aa[_0xca01('0x33')]=_0xf437aa['attributes'][_0xca01('0x36')]?_0xf437aa[_0xca01('0x33')]:_0x3a6cab[_0xca01('0x2e')];if(!_0x308f3e[_0xca01('0x31')][_0xca01('0x37')]('nolimit')){_0xf437aa[_0xca01('0x1c')]=qs[_0xca01('0x1c')](_0x308f3e['query'][_0xca01('0x1c')]);_0xf437aa[_0xca01('0x1b')]=qs[_0xca01('0x1b')](_0x308f3e[_0xca01('0x31')][_0xca01('0x1b')]);}_0xf437aa['order']=qs['sort'](_0x308f3e[_0xca01('0x31')][_0xca01('0x38')]);_0xf437aa[_0xca01('0x39')]=qs[_0xca01('0x32')](_[_0xca01('0x3a')](_0x308f3e[_0xca01('0x31')],_0x3a6cab[_0xca01('0x32')]),_0x2d2d9f);if(_0x308f3e[_0xca01('0x31')][_0xca01('0x3b')]){_0xf437aa[_0xca01('0x39')]=_[_0xca01('0x3c')](_0xf437aa[_0xca01('0x39')],{'$or':_['map'](_0x2d2d9f,function(_0x44f4e0){if(_0x44f4e0[_0xca01('0x2c')]!==_0xca01('0x3d')){var _0x113396={};_0x113396[_0x44f4e0[_0xca01('0x28')]]={'$like':'%'+_0x308f3e[_0xca01('0x31')][_0xca01('0x3b')]+'%'};return _0x113396;}})});}_0xf437aa=_[_0xca01('0x3c')]({},_0xf437aa,_0x308f3e['options']);var _0x52d126={'where':_0xf437aa[_0xca01('0x39')]};return db[_0xca01('0x2a')][_0xca01('0x1a')](_0x52d126)[_0xca01('0x3e')](function(_0x43b99f){_0x390301[_0xca01('0x1a')]=_0x43b99f;if(_0x308f3e['query'][_0xca01('0x3f')]){_0xf437aa[_0xca01('0x40')]=[{'all':!![]}];}return db[_0xca01('0x2a')][_0xca01('0x41')](_0xf437aa);})[_0xca01('0x3e')](function(_0x42bca2){_0x390301[_0xca01('0x42')]=_0x42bca2;return _0x390301;})[_0xca01('0x3e')](respondWithFilteredResult(_0x125164,_0xf437aa))[_0xca01('0x43')](handleError(_0x125164,null));};exports[_0xca01('0x44')]=function(_0x486885,_0x616f06){var _0x3ae2c4={'raw':!![],'where':{'id':_0x486885[_0xca01('0x45')]['id']}},_0xa4adb2={};_0xa4adb2[_0xca01('0x2e')]=_[_0xca01('0x30')](db['WhatsappTransferReport'][_0xca01('0x46')]);_0xa4adb2[_0xca01('0x31')]=_[_0xca01('0x30')](_0x486885[_0xca01('0x31')]);_0xa4adb2[_0xca01('0x32')]=_[_0xca01('0x34')](_0xa4adb2[_0xca01('0x2e')],_0xa4adb2[_0xca01('0x31')]);_0x3ae2c4[_0xca01('0x33')]=_[_0xca01('0x34')](_0xa4adb2[_0xca01('0x2e')],qs[_0xca01('0x35')](_0x486885[_0xca01('0x31')][_0xca01('0x35')]));_0x3ae2c4['attributes']=_0x3ae2c4[_0xca01('0x33')][_0xca01('0x36')]?_0x3ae2c4[_0xca01('0x33')]:_0xa4adb2[_0xca01('0x2e')];if(_0x486885[_0xca01('0x31')][_0xca01('0x3f')]){_0x3ae2c4[_0xca01('0x40')]=[{'all':!![]}];}_0x3ae2c4=_[_0xca01('0x3c')]({},_0x3ae2c4,_0x486885[_0xca01('0x47')]);return db[_0xca01('0x2a')][_0xca01('0x48')](_0x3ae2c4)[_0xca01('0x3e')](handleEntityNotFound(_0x616f06,null))[_0xca01('0x3e')](respondWithResult(_0x616f06,null))[_0xca01('0x43')](handleError(_0x616f06,null));};exports[_0xca01('0x49')]=function(_0x239846,_0x3da1d8){return db[_0xca01('0x2a')]['create'](_0x239846[_0xca01('0x4a')],{})[_0xca01('0x3e')](respondWithResult(_0x3da1d8,0xc9))[_0xca01('0x43')](handleError(_0x3da1d8,null));};exports[_0xca01('0x22')]=function(_0x39abcb,_0x754793){if(_0x39abcb['body']['id']){delete _0x39abcb['body']['id'];}return db[_0xca01('0x2a')][_0xca01('0x48')]({'where':{'id':_0x39abcb[_0xca01('0x45')]['id']}})[_0xca01('0x3e')](handleEntityNotFound(_0x754793,null))[_0xca01('0x3e')](saveUpdates(_0x39abcb[_0xca01('0x4a')],null))['then'](respondWithResult(_0x754793,null))[_0xca01('0x43')](handleError(_0x754793,null));};exports[_0xca01('0x23')]=function(_0x13e828,_0x2c0b61){return db[_0xca01('0x2a')][_0xca01('0x48')]({'where':{'id':_0x13e828[_0xca01('0x45')]['id']}})[_0xca01('0x3e')](handleEntityNotFound(_0x2c0b61,null))['then'](removeEntity(_0x2c0b61,null))[_0xca01('0x43')](handleError(_0x2c0b61,null));};exports[_0xca01('0x4b')]=function(_0x2a084e,_0x13e7be){return db[_0xca01('0x2a')][_0xca01('0x4b')]()[_0xca01('0x3e')](respondWithResult(_0x13e7be,null))['catch'](handleError(_0x13e7be,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d123703..88f1a90 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 _0x6ba7=['report_whatsapp_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport'];(function(_0x8b953b,_0x132acf){var _0x1943d5=function(_0xc250b9){while(--_0xc250b9){_0x8b953b['push'](_0x8b953b['shift']());}};_0x1943d5(++_0x132acf);}(_0x6ba7,0xc8));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x76ba('0x0'));var logger=require(_0x76ba('0x1'))('api');var moment=require(_0x76ba('0x2'));var BPromise=require(_0x76ba('0x3'));var rp=require(_0x76ba('0x4'));var fs=require('fs');var path=require(_0x76ba('0x5'));var rimraf=require('rimraf');var config=require(_0x76ba('0x6'));var attributes=require(_0x76ba('0x7'));module['exports']=function(_0x2c327f,_0x1d2e48){return _0x2c327f['define'](_0x76ba('0x8'),attributes,{'tableName':_0x76ba('0x9'),'paranoid':![],'indexes':[{'name':_0x76ba('0xa'),'fields':[_0x76ba('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbdf=['rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbdf,0x149));var _0xfcbd=function(_0x258606,_0x9bb523){_0x258606=_0x258606-0x0;var _0x47f504=_0xcbdf[_0x258606];return _0x47f504;};'use strict';var _=require(_0xfcbd('0x0'));var util=require(_0xfcbd('0x1'));var logger=require(_0xfcbd('0x2'))(_0xfcbd('0x3'));var moment=require(_0xfcbd('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcbd('0x5'));var fs=require('fs');var path=require(_0xfcbd('0x6'));var rimraf=require(_0xfcbd('0x7'));var config=require(_0xfcbd('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0xfcbd('0x9')]=function(_0x439597,_0x3c783f){return _0x439597[_0xfcbd('0xa')](_0xfcbd('0xb'),attributes,{'tableName':_0xfcbd('0xc'),'paranoid':![],'indexes':[{'name':_0xfcbd('0xd'),'fields':[_0xfcbd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ebcc842..f0a517f 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 _0xb8fe=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x21820c,_0x5c0d13){var _0x5ddc95=function(_0x4d394c){while(--_0x4d394c){_0x21820c['push'](_0x21820c['shift']());}};_0x5ddc95(++_0x5c0d13);}(_0xb8fe,0x163));var _0xeb8f=function(_0x370c11,_0x32427f){_0x370c11=_0x370c11-0x0;var _0x42737d=_0xb8fe[_0x370c11];return _0x42737d;};'use strict';var _=require(_0xeb8f('0x0'));var util=require(_0xeb8f('0x1'));var moment=require(_0xeb8f('0x2'));var BPromise=require(_0xeb8f('0x3'));var rs=require(_0xeb8f('0x4'));var fs=require('fs');var Redis=require(_0xeb8f('0x5'));var db=require(_0xeb8f('0x6'))['db'];var utils=require(_0xeb8f('0x7'));var logger=require('../../config/logger')(_0xeb8f('0x8'));var config=require(_0xeb8f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb8f('0xa')][_0xeb8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25fe6d,_0x1086f8,_0x212a79){return new BPromise(function(_0x3cd963,_0x3cc4ba){return client[_0xeb8f('0xc')](_0x25fe6d,_0x212a79)[_0xeb8f('0xd')](function(_0x39be81){logger[_0xeb8f('0xe')](_0xeb8f('0xf'),_0x1086f8,'request\x20sent');logger['debug'](_0xeb8f('0x10'),_0x1086f8,_0xeb8f('0x11'),JSON[_0xeb8f('0x12')](_0x39be81));if(_0x39be81[_0xeb8f('0x13')]){if(_0x39be81[_0xeb8f('0x13')]['code']===0x1f4){logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x39be81['error'][_0xeb8f('0x14')]);return _0x3cc4ba(_0x39be81['error'][_0xeb8f('0x14')]);}logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x39be81[_0xeb8f('0x13')][_0xeb8f('0x14')]);return _0x3cd963(_0x39be81['error'][_0xeb8f('0x14')]);}else{logger['info'](_0xeb8f('0xf'),_0x1086f8,'request\x20sent');_0x3cd963(_0x39be81[_0xeb8f('0x15')][_0xeb8f('0x14')]);}})['catch'](function(_0x33e2e3){logger[_0xeb8f('0x13')](_0xeb8f('0xf'),_0x1086f8,_0x33e2e3);_0x3cc4ba(_0x33e2e3);});});} \ No newline at end of file +var _0x68de=['request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x450d4f,_0x24f2c0){var _0x12fabb=function(_0x44b7b0){while(--_0x44b7b0){_0x450d4f['push'](_0x450d4f['shift']());}};_0x12fabb(++_0x24f2c0);}(_0x68de,0x17b));var _0xe68d=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x68de[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xe68d('0x0'));var util=require('util');var moment=require(_0xe68d('0x1'));var BPromise=require(_0xe68d('0x2'));var rs=require(_0xe68d('0x3'));var fs=require('fs');var Redis=require(_0xe68d('0x4'));var db=require(_0xe68d('0x5'))['db'];var utils=require(_0xe68d('0x6'));var logger=require(_0xe68d('0x7'))(_0xe68d('0x8'));var config=require('../../config/environment');var jayson=require(_0xe68d('0x9'));var client=jayson[_0xe68d('0xa')][_0xe68d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27874c,_0x5f4e5d,_0x3d2c4a){return new BPromise(function(_0x16dfb3,_0x4d5f8f){return client[_0xe68d('0xc')](_0x27874c,_0x3d2c4a)[_0xe68d('0xd')](function(_0x58fba9){logger[_0xe68d('0xe')](_0xe68d('0xf'),_0x5f4e5d,_0xe68d('0x10'));logger[_0xe68d('0x11')](_0xe68d('0x12'),_0x5f4e5d,_0xe68d('0x10'),JSON['stringify'](_0x58fba9));if(_0x58fba9[_0xe68d('0x13')]){if(_0x58fba9['error']['code']===0x1f4){logger['error'](_0xe68d('0xf'),_0x5f4e5d,_0x58fba9[_0xe68d('0x13')]['message']);return _0x4d5f8f(_0x58fba9[_0xe68d('0x13')]['message']);}logger['error'](_0xe68d('0xf'),_0x5f4e5d,_0x58fba9[_0xe68d('0x13')][_0xe68d('0x14')]);return _0x16dfb3(_0x58fba9['error'][_0xe68d('0x14')]);}else{logger[_0xe68d('0xe')](_0xe68d('0xf'),_0x5f4e5d,_0xe68d('0x10'));_0x16dfb3(_0x58fba9[_0xe68d('0x15')][_0xe68d('0x14')]);}})[_0xe68d('0x16')](function(_0x1acec3){logger['error'](_0xe68d('0xf'),_0x5f4e5d,_0x1acec3);_0x4d5f8f(_0x1acec3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index cb2316c..1856ec8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39d9=['./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','join','status','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb'];(function(_0x58d198,_0x41bd05){var _0x2101c0=function(_0x14e51c){while(--_0x14e51c){_0x58d198['push'](_0x58d198['shift']());}};_0x2101c0(++_0x41bd05);}(_0x39d9,0x17f));var _0x939d=function(_0x36a08,_0x1fe46a){_0x36a08=_0x36a08-0x0;var _0x38c6bc=_0x39d9[_0x36a08];return _0x38c6bc;};'use strict';var _=require(_0x939d('0x0'));var db=require(_0x939d('0x1'))['db'];var seedDb=require(_0x939d('0x2'));var checkLicense=require(_0x939d('0x3'));var rpc=require(_0x939d('0x4'));var config=require(_0x939d('0x5'));var logger=require(_0x939d('0x6'))(_0x939d('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0x939d('0x8'));var schedule=require(_0x939d('0x9'));var chat=require(_0x939d('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x939d('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x939d('0xc')][_0x939d('0xd')]()[_0x939d('0xe')](function(){if(config[_0x939d('0xf')]){return seedDb[_0x939d('0x10')]();}})[_0x939d('0xe')](function(){return checkLicense[_0x939d('0x10')]();})['then'](function(){return rpc['listen']();})[_0x939d('0xe')](function(_0x2efa9e){logger[_0x939d('0x11')](_0x2efa9e);return chat[_0x939d('0x12')]();})[_0x939d('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x939d('0xe')](function(){return transcribe[_0x939d('0x12')]();})[_0x939d('0xe')](function(){return provider['start']();})[_0x939d('0xe')](function(_0x474de8){logger[_0x939d('0x11')](_0x474de8);return pm2[_0x939d('0x12')](pm2Config);})[_0x939d('0xe')](function(_0x2406aa){var _0x3d7db2=_0x2406aa[_0x939d('0x13')](function(_0x1b9d52){return typeof _0x1b9d52['exitCode']==='number'&&_0x1b9d52[_0x939d('0x14')]>=0x0;});if(_0x3d7db2['length']>0x0){throw new Error(_0x3d7db2[_0x939d('0x15')]+_0x939d('0x16')+_['map'](_0x3d7db2,function(_0x6bea18){return'\x22'+_0x6bea18[_0x939d('0x17')][_0x939d('0x18')]+'\x22';}));}logger['info'](_0x939d('0x19'),_[_0x939d('0x1a')](_[_0x939d('0x13')](_0x2406aa,{'status':_0x939d('0x1b')}),_0x939d('0x18'))[_0x939d('0x1c')]());logger['info']('Offline\x20apps:',_[_0x939d('0x1a')](_['filter'](_0x2406aa,function(_0x1034ad){return _0x1034ad[_0x939d('0x1d')]!==_0x939d('0x1b');}),'name')['join']()||_0x939d('0x1e'));console['log']('App\x20Ready!');})['catch'](function(_0x39ce7a){console[_0x939d('0x1f')](_0x939d('0x20'),_0x39ce7a);logger[_0x939d('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x39ce7a);process[_0x939d('0x22')](0x1);});}main(); \ No newline at end of file +var _0x0dec=['filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start'];(function(_0x357978,_0x5d2ca9){var _0x3fc094=function(_0x4f4ea3){while(--_0x4f4ea3){_0x357978['push'](_0x357978['shift']());}};_0x3fc094(++_0x5d2ca9);}(_0x0dec,0x11c));var _0xc0de=function(_0xad5776,_0x4dc513){_0xad5776=_0xad5776-0x0;var _0x133b3a=_0x0dec[_0xad5776];return _0x133b3a;};'use strict';var _=require(_0xc0de('0x0'));var db=require(_0xc0de('0x1'))['db'];var seedDb=require(_0xc0de('0x2'));var checkLicense=require(_0xc0de('0x3'));var rpc=require('./rpc');var config=require(_0xc0de('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xc0de('0x5'));var pm2Config=require(_0xc0de('0x6'));var schedule=require(_0xc0de('0x7'));var chat=require(_0xc0de('0x8'));var whatsapp=require(_0xc0de('0x9'));var transcribe=require(_0xc0de('0xa'));var provider=require(_0xc0de('0xb'));function main(){return db[_0xc0de('0xc')][_0xc0de('0xd')]()[_0xc0de('0xe')](function(){if(config[_0xc0de('0xf')]){return seedDb[_0xc0de('0x10')]();}})[_0xc0de('0xe')](function(){return checkLicense[_0xc0de('0x10')]();})[_0xc0de('0xe')](function(){return rpc[_0xc0de('0x11')]();})[_0xc0de('0xe')](function(_0x285146){logger[_0xc0de('0x12')](_0x285146);return chat[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return whatsapp[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return schedule[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return transcribe['start']();})[_0xc0de('0xe')](function(){return provider[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(_0x258c5a){logger[_0xc0de('0x12')](_0x258c5a);return pm2[_0xc0de('0x13')](pm2Config);})[_0xc0de('0xe')](function(_0x3330e0){var _0x3546f4=_0x3330e0[_0xc0de('0x14')](function(_0x11abc2){return typeof _0x11abc2[_0xc0de('0x15')]==='number'&&_0x11abc2[_0xc0de('0x15')]>=0x0;});if(_0x3546f4[_0xc0de('0x16')]>0x0){throw new Error(_0x3546f4['length']+_0xc0de('0x17')+_[_0xc0de('0x18')](_0x3546f4,function(_0x21db23){return'\x22'+_0x21db23['pm2_env'][_0xc0de('0x19')]+'\x22';}));}logger['info'](_0xc0de('0x1a'),_['map'](_[_0xc0de('0x14')](_0x3330e0,{'status':_0xc0de('0x1b')}),'name')[_0xc0de('0x1c')]());logger[_0xc0de('0x12')](_0xc0de('0x1d'),_[_0xc0de('0x18')](_[_0xc0de('0x14')](_0x3330e0,function(_0x8aee7c){return _0x8aee7c[_0xc0de('0x1e')]!==_0xc0de('0x1b');}),'name')[_0xc0de('0x1c')]()||_0xc0de('0x1f'));console[_0xc0de('0x20')](_0xc0de('0x21'));})[_0xc0de('0x22')](function(_0x4b2c66){console[_0xc0de('0x20')](_0xc0de('0x23'),_0x4b2c66);logger[_0xc0de('0x24')](_0xc0de('0x25'),_0x4b2c66);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5df75b3..a2fee9f 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 _0xe309=['isMiddleware','setTokenCookie','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','query','disposition','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','json','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','Forbidden','getLicense','webrtc'];(function(_0x1dd13a,_0x438646){var _0x42fdc6=function(_0x50b254){while(--_0x50b254){_0x1dd13a['push'](_0x1dd13a['shift']());}};_0x42fdc6(++_0x438646);}(_0xe309,0x133));var _0x9e30=function(_0x5af0cb,_0x3bebc7){_0x5af0cb=_0x5af0cb-0x0;var _0x3367ba=_0xe309[_0x5af0cb];return _0x3367ba;};'use strict';var db=require(_0x9e30('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9e30('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x9e30('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x9e30('0x3'));var compose=require(_0x9e30('0x4'));var basicAuth=require(_0x9e30('0x5'));var crypto=require(_0x9e30('0x6'));var BPromise=require('bluebird');var util=require(_0x9e30('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x9e30('0x8')][_0x9e30('0x9')]});var userAttributes=['id',_0x9e30('0xa'),_0x9e30('0xb'),_0x9e30('0xc'),_0x9e30('0xd'),'email',_0x9e30('0xe'),_0x9e30('0xf'),_0x9e30('0x10'),_0x9e30('0x11'),'chatPause','mailPause',_0x9e30('0x12'),_0x9e30('0x13'),_0x9e30('0x14'),_0x9e30('0x15'),_0x9e30('0x16'),'lastLoginAt',_0x9e30('0x17'),_0x9e30('0x18'),_0x9e30('0x19'),_0x9e30('0x1a'),_0x9e30('0x1b'),_0x9e30('0x1c'),_0x9e30('0x1d'),_0x9e30('0x1e'),_0x9e30('0x1f'),_0x9e30('0x20'),_0x9e30('0x21'),_0x9e30('0x22'),_0x9e30('0x23'),_0x9e30('0x24'),_0x9e30('0x25'),'hotdesk',_0x9e30('0x26'),_0x9e30('0x27'),'privacyEnabled','settingsEnabled',_0x9e30('0x28'),_0x9e30('0x29'),_0x9e30('0x2a'),_0x9e30('0x2b'),_0x9e30('0x2c'),'selectRecallMeCampaign',_0x9e30('0x2d'),'chatAutoanswerDelay','emailAutoanswer',_0x9e30('0x2e'),_0x9e30('0x2f'),_0x9e30('0x30'),_0x9e30('0x31'),_0x9e30('0x32'),'faxAutoanswer','faxAutoanswerDelay',_0x9e30('0x33'),_0x9e30('0x34'),'messengerSoundNotification'];exports[_0x9e30('0x35')]=function(){return this[_0x9e30('0x36')](!![])[_0x9e30('0x37')](function(_0x59eb0b,_0x5d7530,_0x56cf3f){if(_0x59eb0b['user']){_0x56cf3f();}else{return db[_0x9e30('0x38')][_0x9e30('0x39')]({'where':{'id':_0x59eb0b[_0x9e30('0x3a')]['id']},'attributes':['id',_0x9e30('0x3b'),'disposition'],'raw':!![]})['then'](function(_0x3a94d7){if(_0x3a94d7&&_0x3a94d7[_0x9e30('0x3b')]&&!_0x59eb0b[_0x9e30('0x3c')]['forceDownload']){return _0x5d7530['status'](_0x3a94d7[_0x9e30('0x3d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x3a94d7[_0x9e30('0x3d')]==='unmanaged'?_0x9e30('0x3e'):_0x9e30('0x3f')});}else{_0x56cf3f();}})[_0x9e30('0x40')](function(_0x5a14ce){_0x56cf3f(_0x5a14ce);});}});};exports[_0x9e30('0x36')]=function isAuthenticated(_0xc0ad13){return compose()['use'](function(_0x3e4fbe,_0xc55305,_0x267b9a){var _0x5c924c;if(_0x3e4fbe['headers'][_0x9e30('0x41')]){if(_[_0x9e30('0x42')](_0x3e4fbe[_0x9e30('0x43')]['authorization'],_0x9e30('0x44'))){var _0x15d498=basicAuth(_0x3e4fbe);db[_0x9e30('0x45')][_0x9e30('0x46')]({'where':{'name':_0x15d498['name']}})['then'](function(_0x3a4c0d){if(!_0x3a4c0d||!_0x3a4c0d[_0x9e30('0x47')](_0x15d498[_0x9e30('0x48')])){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x4b')});}_0x3e4fbe[_0x9e30('0x4c')]={'id':_0x3a4c0d['id']};_0x267b9a();})[_0x9e30('0x40')](function(_0x388c01){_0x267b9a(_0x388c01);});}else if(_[_0x9e30('0x42')](_0x3e4fbe[_0x9e30('0x43')][_0x9e30('0x41')],_0x9e30('0x4d'))){validateJwt(_0x3e4fbe,_0xc55305,_0x267b9a);}else{if(_0xc0ad13){_0x267b9a();}else{return _0xc55305['status'](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x4e')});}}}else if(_0x3e4fbe[_0x9e30('0x3c')][_0x9e30('0x4f')]){try{var _0x3066b8={'audience':hardwareConf[_0x9e30('0x50')](),'issuer':hardwareConf[_0x9e30('0x50')]()};verifyJwt(_0x3e4fbe[_0x9e30('0x3c')][_0x9e30('0x4f')],_0x3066b8)[_0x9e30('0x51')](function(_0x4b448f){return db['User'][_0x9e30('0x46')]({'where':{'id':_0x4b448f[_0x9e30('0x52')]}})[_0x9e30('0x51')](function(_0x5b8e76){_0x5c924c=_0x5b8e76;return db[_0x9e30('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x9e30('0x54'),_0x9e30('0x55')],'raw':!![]});})[_0x9e30('0x51')](function(_0xe8edaf){if(!_0x5c924c||!_[_0x9e30('0x56')](_0x5c924c[_0x9e30('0x57')],_0x4b448f[_0x9e30('0x58')])){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x59')});}if(_0x5c924c['disabled']){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});}if(_0x5c924c[_0x9e30('0x5b')]){if(_0xe8edaf[_0x9e30('0x55')]>0x0){if(moment(_0x5c924c[_0x9e30('0x5c')])[_0x9e30('0x5d')](_0xe8edaf[_0x9e30('0x55')],_0x9e30('0x5e'))>moment()){return _0xc55305[_0x9e30('0x49')](0x191)['json']({'message':_0x9e30('0x5a')});}}else{return _0xc55305['status'](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});}}_0x3e4fbe[_0x9e30('0x4c')]={'id':_0x5c924c['id']};_0x267b9a();});})[_0x9e30('0x40')](function(){return _0xc55305[_0x9e30('0x49')](0x191)[_0x9e30('0x4a')]({'message':_0x9e30('0x5a')});});}catch(_0x379684){_0x267b9a(_0x379684);}}else if(_0xc0ad13){_0x267b9a();}else{return _0xc55305[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':'Unknown\x20authorization\x20format'});}})[_0x9e30('0x37')](function(_0x16614c,_0x4bd5aa,_0x509153){if(_0x16614c[_0x9e30('0x4c')]){db[_0x9e30('0x45')]['find']({'where':{'id':_0x16614c[_0x9e30('0x4c')]['id']},'attributes':userAttributes})[_0x9e30('0x51')](function(_0x2cdde2){if(!_0x2cdde2){return _0x4bd5aa[_0x9e30('0x49')](0x194)[_0x9e30('0x4a')]({'message':_0x9e30('0x5f')});}_0x16614c[_0x9e30('0x4c')]=_0x2cdde2;_0x509153();})[_0x9e30('0x40')](function(_0x355bea){_0x509153(_0x355bea);});}else if(_0xc0ad13){_0x509153();}else{return _0x4bd5aa[_0x9e30('0x49')](0x194)['json']({'message':_0x9e30('0x60')});}});};exports[_0x9e30('0x61')]=function canUpdate(){return compose()[_0x9e30('0x37')](function(_0x5be67c,_0x416607,_0x24e126){return licenseUtil['getLicense']()[_0x9e30('0x51')](function(_0x39eef0){if(_0x39eef0['update']){_0x24e126();}else{return _0x416607[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x62')});}})[_0x9e30('0x40')](function(_0x497782){_0x24e126(_0x497782);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x9e30('0x37')](function(_0x57130b,_0x377d2e,_0x54c61a){return licenseUtil[_0x9e30('0x63')]()['then'](function(_0x193076){if(_0x193076[_0x9e30('0x64')]){_0x54c61a();}else{return _0x377d2e[_0x9e30('0x49')](0x193)[_0x9e30('0x4a')]({'message':_0x9e30('0x62')});}})[_0x9e30('0x40')](function(_0x3a95ee){_0x54c61a(_0x3a95ee);});});};exports[_0x9e30('0x65')]=function(_0x57aebb,_0x486678,_0x268c94){_0x57aebb[_0x9e30('0x65')]=!![];return _0x268c94();};exports['signToken']=function signToken(_0x412faf){return signJwt(_0x412faf);};exports[_0x9e30('0x66')]=function(_0x1d9cc4,_0x41d523){if(!_0x1d9cc4[_0x9e30('0x4c')]){return _0x41d523['status'](0x194)[_0x9e30('0x4a')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x462f6b={'payload':{'id':_0x1d9cc4[_0x9e30('0x4c')]['id'],'role':_0x1d9cc4['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x462f6b)['then'](function(_0x105f19){_0x41d523[_0x9e30('0x67')](_0x9e30('0x68'),_0x105f19);_0x41d523[_0x9e30('0x69')]('/dashboards/general');})['catch'](function(_0x192a6b){return _0x41d523[_0x9e30('0x49')](0x1f4)[_0x9e30('0x6a')](_0x192a6b);});};exports['retrieveApiKey']=function(_0x307870){if(_[_0x9e30('0x6b')](_0x307870['apiKeyNonce'])||_[_0x9e30('0x6b')](_0x307870[_0x9e30('0x6c')])){return null;}else{return createJwt(_0x307870);}};exports[_0x9e30('0x6d')]=function(_0x24a792){_0x24a792[_0x9e30('0x57')]=generateNonce();_0x24a792[_0x9e30('0x6c')]=generateIssuedAt();return createJwt(_0x24a792);};exports[_0x9e30('0x6e')]=function(_0xf5c3dc,_0x31ce60){var _0x5a9a40=_0xf5c3dc[_0x9e30('0x3c')][_0x9e30('0x4f')];if(_0x5a9a40){var _0x34caf7={'nonce':_0x31ce60[_0x9e30('0x57')],'iat':_0x31ce60['apiKeyIat'],'audience':hardwareConf[_0x9e30('0x50')](),'issuer':hardwareConf[_0x9e30('0x50')]()};return verifyJwt(_0x5a9a40,_0x34caf7)[_0x9e30('0x51')](function(){return generateApiKey(_0x31ce60);});}else{throw{'message':_0x9e30('0x6f')};}};exports[_0x9e30('0x70')]=function(_0x561842){var _0x33a45d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33a45d['test'](_0x561842))throw new db[(_0x9e30('0x71'))][(_0x9e30('0x72'))]('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[_0x9e30('0x73')]=function(_0x158c2e,_0x5de3d3,_0x2ca09f){var _0x39b90e=encryptor[_0x9e30('0x74')](_0x5de3d3)[_0x9e30('0x75')](',');for(var _0x53b38a=0x0;_0x53b38a<_0x2ca09f;_0x53b38a++){if(!_0x39b90e[_0x53b38a])break;if(_0x158c2e['toLowerCase']()===_0x39b90e[_0x53b38a]['toLowerCase']()){var _0x5eece0=util[_0x9e30('0x76')](_0x9e30('0x77'),_0x2ca09f);if(_0x2ca09f===0x1){_0x5eece0=_0x9e30('0x78');}throw new db['Sequelize'][(_0x9e30('0x72'))](_0x5eece0);}}return;};exports[_0x9e30('0x79')]=function(_0x1cff76,_0x135779){var _0x1355e7=_0x135779?encryptor[_0x9e30('0x74')](_0x135779)[_0x9e30('0x75')](','):[];if(_0x1355e7[_0x9e30('0x7a')]===0x5){_0x1355e7[_0x9e30('0x7b')](-0x1,0x1);}_0x1355e7[_0x9e30('0x7c')](_0x1cff76);return encryptor['encryptString'](_0x1355e7[_0x9e30('0x7d')](','));};function signJwt(_0x3f2449){var _0x4d0de8=BPromise[_0x9e30('0x7e')](jwt[_0x9e30('0x7f')],{'context':jwt});var _0x281d1d=_0x3f2449[_0x9e30('0x80')]||config[_0x9e30('0x8')]['session'];return new BPromise(function(_0x56e611,_0x79c914){_0x4d0de8(_0x3f2449[_0x9e30('0x81')],_0x281d1d,_0x3f2449[_0x9e30('0x82')])[_0x9e30('0x51')](function(_0x3e71bf){_0x56e611(_0x3e71bf);})['catch'](function(_0x45d3a7){_0x79c914(_0x45d3a7);});});}function verifyJwt(_0x44295f,_0x4340aa,_0x4f0e5c){var _0x46914a=BPromise[_0x9e30('0x7e')](jwt['verify'],{'context':jwt});var _0x4a2239=_0x4f0e5c||config[_0x9e30('0x8')][_0x9e30('0x9')];return new BPromise(function(_0x3ad7b1,_0x1462e3){_0x46914a(_0x44295f,_0x4a2239,_0x4340aa)['then'](function(_0x5ba911){_0x3ad7b1(_0x5ba911);})['catch'](function(_0x1fc2cd){_0x1462e3(_0x1fc2cd);});});}function generateNonce(){return crypto[_0x9e30('0x83')](0x10)[_0x9e30('0x84')](_0x9e30('0x85'));}function generateIssuedAt(){return Math[_0x9e30('0x86')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x4845cc){var _0x5bf88e={'payload':{'iat':_0x4845cc['apiKeyIat'],'nonce':_0x4845cc['apiKeyNonce']},'options':{'algorithm':_0x9e30('0x87'),'subject':_0x4845cc['id'][_0x9e30('0x84')](),'issuer':hardwareConf[_0x9e30('0x50')](),'audience':hardwareConf[_0x9e30('0x50')]()}};return signJwt(_0x5bf88e)[_0x9e30('0x51')](function(_0x668100){return{'iat':_0x4845cc['apiKeyIat'],'nonce':_0x4845cc[_0x9e30('0x57')],'token':_0x668100};});} \ No newline at end of file +var _0x6ae2=['downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','then','query','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','startsWith','User','find','authenticate','user','authorization','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','Forbidden','isMiddleware','signToken','cookie','motion.token','send','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','length','unshift','join','promisify','sign','secret','secrets','session','options','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','name','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions'];(function(_0x2ca4f7,_0x46b5be){var _0x20ce3a=function(_0x4ba490){while(--_0x4ba490){_0x2ca4f7['push'](_0x2ca4f7['shift']());}};_0x20ce3a(++_0x46b5be);}(_0x6ae2,0x1e7));var _0x26ae=function(_0x137a5b,_0x3ee5b6){_0x137a5b=_0x137a5b-0x0;var _0x36c8d2=_0x6ae2[_0x137a5b];return _0x36c8d2;};'use strict';var db=require(_0x26ae('0x0'))['db'];var config=require(_0x26ae('0x1'));var hardwareConf=require(_0x26ae('0x2'));var licenseUtil=require(_0x26ae('0x3'));var encryptor=require(_0x26ae('0x4'));var _=require('lodash');var jwt=require(_0x26ae('0x5'));var expressJwt=require(_0x26ae('0x6'));var compose=require(_0x26ae('0x7'));var basicAuth=require(_0x26ae('0x8'));var crypto=require(_0x26ae('0x9'));var BPromise=require('bluebird');var util=require(_0x26ae('0xa'));var moment=require(_0x26ae('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x26ae('0xc'),'fullname',_0x26ae('0xd'),'internal',_0x26ae('0xe'),_0x26ae('0xf'),_0x26ae('0x10'),'md5secret',_0x26ae('0x11'),_0x26ae('0x12'),_0x26ae('0x13'),_0x26ae('0x14'),_0x26ae('0x15'),_0x26ae('0x16'),_0x26ae('0x17'),_0x26ae('0x18'),_0x26ae('0x19'),'lastPauseAt','crudPermissions','allowmessenger',_0x26ae('0x1a'),_0x26ae('0x1b'),_0x26ae('0x1c'),_0x26ae('0x1d'),_0x26ae('0x1e'),_0x26ae('0x1f'),_0x26ae('0x20'),'phoneBarEnableSettings',_0x26ae('0x21'),_0x26ae('0x22'),_0x26ae('0x23'),_0x26ae('0x24'),_0x26ae('0x25'),_0x26ae('0x26'),_0x26ae('0x27'),_0x26ae('0x28'),_0x26ae('0x29'),_0x26ae('0x2a'),_0x26ae('0x2b'),_0x26ae('0x2c'),_0x26ae('0x2d'),_0x26ae('0x2e'),_0x26ae('0x2f'),_0x26ae('0x30'),_0x26ae('0x31'),'emailAutoanswer',_0x26ae('0x32'),_0x26ae('0x33'),'smsAutoanswerDelay',_0x26ae('0x34'),_0x26ae('0x35'),'faxAutoanswer',_0x26ae('0x36'),_0x26ae('0x37'),_0x26ae('0x38'),'messengerSoundNotification'];exports[_0x26ae('0x39')]=function(){return this[_0x26ae('0x3a')](!![])['use'](function(_0x32bdc4,_0x1a9b04,_0x36ea40){if(_0x32bdc4['user']){_0x36ea40();}else{return db[_0x26ae('0x3b')][_0x26ae('0x3c')]({'where':{'id':_0x32bdc4[_0x26ae('0x3d')]['id']},'attributes':['id',_0x26ae('0x3e'),_0x26ae('0x3f')],'raw':!![]})[_0x26ae('0x40')](function(_0x2ce3f9){if(_0x2ce3f9&&_0x2ce3f9[_0x26ae('0x3e')]&&!_0x32bdc4[_0x26ae('0x41')]['forceDownload']){return _0x1a9b04[_0x26ae('0x42')](_0x2ce3f9[_0x26ae('0x3f')]===_0x26ae('0x43')?0x195:0x193)[_0x26ae('0x44')]({'message':_0x2ce3f9[_0x26ae('0x3f')]===_0x26ae('0x43')?_0x26ae('0x45'):_0x26ae('0x46')});}else{_0x36ea40();}})[_0x26ae('0x47')](function(_0x4f32cf){_0x36ea40(_0x4f32cf);});}});};exports[_0x26ae('0x3a')]=function isAuthenticated(_0x2c66db){return compose()[_0x26ae('0x48')](function(_0x107b48,_0x41e443,_0xec9ad8){var _0x44b234;if(_0x107b48[_0x26ae('0x49')]['authorization']){if(_[_0x26ae('0x4a')](_0x107b48['headers']['authorization'],'Basic')){var _0x535872=basicAuth(_0x107b48);db[_0x26ae('0x4b')][_0x26ae('0x4c')]({'where':{'name':_0x535872[_0x26ae('0xd')]}})[_0x26ae('0x40')](function(_0x493361){if(!_0x493361||!_0x493361[_0x26ae('0x4d')](_0x535872['pass'])){return _0x41e443[_0x26ae('0x42')](0x191)[_0x26ae('0x44')]({'message':'Wrong\x20credentials.'});}_0x107b48[_0x26ae('0x4e')]={'id':_0x493361['id']};_0xec9ad8();})[_0x26ae('0x47')](function(_0x3a510e){_0xec9ad8(_0x3a510e);});}else if(_[_0x26ae('0x4a')](_0x107b48['headers'][_0x26ae('0x4f')],_0x26ae('0x50'))){validateJwt(_0x107b48,_0x41e443,_0xec9ad8);}else{if(_0x2c66db){_0xec9ad8();}else{return _0x41e443[_0x26ae('0x42')](0x193)[_0x26ae('0x44')]({'message':_0x26ae('0x51')});}}}else if(_0x107b48[_0x26ae('0x41')][_0x26ae('0x52')]){try{var _0x50e9d3={'audience':hardwareConf[_0x26ae('0x53')](),'issuer':hardwareConf[_0x26ae('0x53')]()};verifyJwt(_0x107b48[_0x26ae('0x41')][_0x26ae('0x52')],_0x50e9d3)[_0x26ae('0x40')](function(_0xa339dd){return db['User'][_0x26ae('0x4c')]({'where':{'id':_0xa339dd['sub']}})[_0x26ae('0x40')](function(_0x566ea0){_0x44b234=_0x566ea0;return db[_0x26ae('0x54')]['findOne']({'where':{'id':0x1},'attributes':[_0x26ae('0x55'),_0x26ae('0x56')],'raw':!![]});})['then'](function(_0x1ae413){if(!_0x44b234||!_[_0x26ae('0x57')](_0x44b234[_0x26ae('0x58')],_0xa339dd['nonce'])){return _0x41e443['status'](0x191)[_0x26ae('0x44')]({'message':_0x26ae('0x59')});}if(_0x44b234[_0x26ae('0x5a')]){return _0x41e443['status'](0x191)[_0x26ae('0x44')]({'message':_0x26ae('0x5b')});}if(_0x44b234['blocked']){if(_0x1ae413[_0x26ae('0x56')]>0x0){if(moment(_0x44b234[_0x26ae('0x5c')])[_0x26ae('0x5d')](_0x1ae413[_0x26ae('0x56')],'minutes')>moment()){return _0x41e443['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x41e443[_0x26ae('0x42')](0x191)['json']({'message':_0x26ae('0x5b')});}}_0x107b48['user']={'id':_0x44b234['id']};_0xec9ad8();});})['catch'](function(){return _0x41e443[_0x26ae('0x42')](0x191)[_0x26ae('0x44')]({'message':_0x26ae('0x5b')});});}catch(_0x39655d){_0xec9ad8(_0x39655d);}}else if(_0x2c66db){_0xec9ad8();}else{return _0x41e443['status'](0x193)['json']({'message':_0x26ae('0x51')});}})[_0x26ae('0x48')](function(_0x58e537,_0x12bbd0,_0x3e7d42){if(_0x58e537[_0x26ae('0x4e')]){db[_0x26ae('0x4b')][_0x26ae('0x4c')]({'where':{'id':_0x58e537[_0x26ae('0x4e')]['id']},'attributes':userAttributes})['then'](function(_0x1d49ce){if(!_0x1d49ce){return _0x12bbd0[_0x26ae('0x42')](0x194)[_0x26ae('0x44')]({'message':_0x26ae('0x5e')});}_0x58e537[_0x26ae('0x4e')]=_0x1d49ce;_0x3e7d42();})[_0x26ae('0x47')](function(_0xb6ccf7){_0x3e7d42(_0xb6ccf7);});}else if(_0x2c66db){_0x3e7d42();}else{return _0x12bbd0[_0x26ae('0x42')](0x194)[_0x26ae('0x44')]({'message':_0x26ae('0x5f')});}});};exports[_0x26ae('0x60')]=function canUpdate(){return compose()['use'](function(_0x24ecdd,_0x5ddd4b,_0x20b9ea){return licenseUtil[_0x26ae('0x61')]()[_0x26ae('0x40')](function(_0xaf300d){if(_0xaf300d['update']){_0x20b9ea();}else{return _0x5ddd4b[_0x26ae('0x42')](0x193)[_0x26ae('0x44')]({'message':'Forbidden'});}})['catch'](function(_0x57d5a7){_0x20b9ea(_0x57d5a7);});});};exports[_0x26ae('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x4345f7,_0x1c1202,_0x1cb0dd){return licenseUtil['getLicense']()[_0x26ae('0x40')](function(_0x33aa02){if(_0x33aa02['webrtc']){_0x1cb0dd();}else{return _0x1c1202[_0x26ae('0x42')](0x193)[_0x26ae('0x44')]({'message':_0x26ae('0x63')});}})['catch'](function(_0x36d266){_0x1cb0dd(_0x36d266);});});};exports[_0x26ae('0x64')]=function(_0x5e0919,_0xb654b5,_0x456445){_0x5e0919[_0x26ae('0x64')]=!![];return _0x456445();};exports[_0x26ae('0x65')]=function signToken(_0x2979c5){return signJwt(_0x2979c5);};exports['setTokenCookie']=function(_0x53597b,_0x375d3d){if(!_0x53597b[_0x26ae('0x4e')]){return _0x375d3d['status'](0x194)[_0x26ae('0x44')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x55017e={'payload':{'id':_0x53597b['user']['id'],'role':_0x53597b['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x55017e)[_0x26ae('0x40')](function(_0xea3bcb){_0x375d3d[_0x26ae('0x66')](_0x26ae('0x67'),_0xea3bcb);_0x375d3d['redirect']('/dashboards/general');})[_0x26ae('0x47')](function(_0x3a875b){return _0x375d3d[_0x26ae('0x42')](0x1f4)[_0x26ae('0x68')](_0x3a875b);});};exports['retrieveApiKey']=function(_0x43f6d9){if(_['isNil'](_0x43f6d9['apiKeyNonce'])||_['isNil'](_0x43f6d9[_0x26ae('0x69')])){return null;}else{return createJwt(_0x43f6d9);}};exports[_0x26ae('0x6a')]=function(_0x547597){_0x547597[_0x26ae('0x58')]=generateNonce();_0x547597[_0x26ae('0x69')]=generateIssuedAt();return createJwt(_0x547597);};exports[_0x26ae('0x6b')]=function(_0x116443,_0x24f650){var _0x4fd35a=_0x116443[_0x26ae('0x41')]['apikey'];if(_0x4fd35a){var _0x4883b7={'nonce':_0x24f650['apiKeyNonce'],'iat':_0x24f650[_0x26ae('0x69')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4fd35a,_0x4883b7)[_0x26ae('0x40')](function(){return generateApiKey(_0x24f650);});}else{throw{'message':_0x26ae('0x6c')};}};exports['validatePasswordPattern']=function(_0x3b84b1){var _0x1069f9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1069f9['test'](_0x3b84b1))throw new db['Sequelize'][(_0x26ae('0x6d'))](_0x26ae('0x6e'));return;};exports[_0x26ae('0x6f')]=function(_0x3d5b93,_0x305ba0,_0x71bbe0){var _0x2b9de7=encryptor[_0x26ae('0x70')](_0x305ba0)[_0x26ae('0x71')](',');for(var _0x502eac=0x0;_0x502eac<_0x71bbe0;_0x502eac++){if(!_0x2b9de7[_0x502eac])break;if(_0x3d5b93[_0x26ae('0x72')]()===_0x2b9de7[_0x502eac][_0x26ae('0x72')]()){var _0x48faf1=util[_0x26ae('0x73')](_0x26ae('0x74'),_0x71bbe0);if(_0x71bbe0===0x1){_0x48faf1=_0x26ae('0x75');}throw new db[(_0x26ae('0x76'))][(_0x26ae('0x6d'))](_0x48faf1);}}return;};exports['updatePasswordsHistory']=function(_0x2c9391,_0x291393){var _0x2bd9ef=_0x291393?encryptor[_0x26ae('0x70')](_0x291393)[_0x26ae('0x71')](','):[];if(_0x2bd9ef[_0x26ae('0x77')]===0x5){_0x2bd9ef['splice'](-0x1,0x1);}_0x2bd9ef[_0x26ae('0x78')](_0x2c9391);return encryptor['encryptString'](_0x2bd9ef[_0x26ae('0x79')](','));};function signJwt(_0xf08deb){var _0x4e143b=BPromise[_0x26ae('0x7a')](jwt[_0x26ae('0x7b')],{'context':jwt});var _0x59a1f3=_0xf08deb[_0x26ae('0x7c')]||config[_0x26ae('0x7d')][_0x26ae('0x7e')];return new BPromise(function(_0x1d1c55,_0x1b83a3){_0x4e143b(_0xf08deb['payload'],_0x59a1f3,_0xf08deb[_0x26ae('0x7f')])['then'](function(_0x42e587){_0x1d1c55(_0x42e587);})[_0x26ae('0x47')](function(_0x67ca97){_0x1b83a3(_0x67ca97);});});}function verifyJwt(_0xd13c4e,_0x4aee4d,_0x2447d8){var _0x153e97=BPromise[_0x26ae('0x7a')](jwt['verify'],{'context':jwt});var _0x227a6f=_0x2447d8||config[_0x26ae('0x7d')]['session'];return new BPromise(function(_0x11f3d1,_0x2a9dab){_0x153e97(_0xd13c4e,_0x227a6f,_0x4aee4d)[_0x26ae('0x40')](function(_0x32e3a8){_0x11f3d1(_0x32e3a8);})[_0x26ae('0x47')](function(_0x8939c1){_0x2a9dab(_0x8939c1);});});}function generateNonce(){return crypto[_0x26ae('0x80')](0x10)[_0x26ae('0x81')](_0x26ae('0x82'));}function generateIssuedAt(){return Math['floor'](Date[_0x26ae('0x83')]()/0x3e8)[_0x26ae('0x81')]();}function createJwt(_0x10ff42){var _0x15f70a={'payload':{'iat':_0x10ff42[_0x26ae('0x69')],'nonce':_0x10ff42[_0x26ae('0x58')]},'options':{'algorithm':_0x26ae('0x84'),'subject':_0x10ff42['id'][_0x26ae('0x81')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x15f70a)[_0x26ae('0x40')](function(_0x55188e){return{'iat':_0x10ff42[_0x26ae('0x69')],'nonce':_0x10ff42[_0x26ae('0x58')],'token':_0x55188e};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4033067..b05b3eb 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1df4=['all','fieldType','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','User','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1df4,0x1bc));var _0x41df=function(_0x18352c,_0x602c26){_0x18352c=_0x18352c-0x0;var _0x1cf925=_0x1df4[_0x18352c];return _0x1cf925;};'use strict';var _=require('lodash');var sqlUtils=require(_0x41df('0x0'));var db=require(_0x41df('0x1'))['db'];exports[_0x41df('0x2')]=function(_0x3c46f6,_0x4a6b86,_0xe22617,_0x30d8b6){var _0x22249e={'count':0x0,'rows':[]};var _0x597b09=sqlUtils['skipContactsQuery'](_0x4a6b86,_0x3c46f6);if(_0x597b09){return Promise[_0x41df('0x3')](_0x22249e);}var _0x4afd5b=sqlUtils[_0x41df('0x4')]();var _0x373d35={};var _0x13669d=![];var _0x4d3817=![];return Promise[_0x41df('0x3')]()['then'](function(){if(_0x3c46f6[_0x41df('0x5')]){return sqlUtils[_0x41df('0x6')](_0x3c46f6[_0x41df('0x5')],_0x30d8b6);}else{return sqlUtils[_0x41df('0x7')](_0x3c46f6,_0x30d8b6);}})[_0x41df('0x8')](function(_0x254e5b){_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xa')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xb')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xc')]);_0x4afd5b[_0x41df('0x9')](_0x254e5b[_0x41df('0xd')][_0x41df('0xe')]);_0x373d35=_0x254e5b[_0x41df('0xf')];_0x4d3817=_0x254e5b[_0x41df('0xd')][_0x41df('0x10')];return sqlUtils[_0x41df('0x11')](_0x4a6b86,_0x3c46f6,_0x4d3817);})[_0x41df('0x8')](function(_0x2095a4){_0x4afd5b[_0x41df('0x9')](_0x2095a4);var _0x26eb91=_0x3c46f6['search']?_0x373d35['ids']:_0x3c46f6[_0x41df('0x12')];_0x13669d=_0x26eb91?!![]:![];return sqlUtils[_0x41df('0x13')](_0x4afd5b,_0x26eb91);})[_0x41df('0x8')](function(_0x2f9ebd){_0x22249e['count']=_0x2f9ebd;if(_0x22249e['count']===0x0){return;}if(_0x3c46f6[_0x41df('0x14')]){_0x4d3817=!![];}return sqlUtils['buildContactsQuery'](_0x4afd5b,_0x3c46f6[_0x41df('0xb')],_0xe22617,_0x13669d,_0x373d35[_0x41df('0xe')],_0x4d3817);})['then'](function(_0x1ccb55){if(!_0x1ccb55){return[];}return sqlUtils[_0x41df('0x15')](_0x1ccb55,_0x3c46f6,_0xe22617);})[_0x41df('0x8')](function(_0x6c9773){_0x22249e[_0x41df('0x16')]=_0x6c9773;return _0x22249e;})[_0x41df('0x17')](function(_0xfb7ac3){throw _0xfb7ac3;});};exports[_0x41df('0x18')]=function(){var _0x4f6018={};var _0x466a0b=[];return db[_0x41df('0x19')][_0x41df('0x18')]()[_0x41df('0x8')](function(_0x3fca95){_0x4f6018=_0x3fca95;var _0x5e369f=Object[_0x41df('0x1a')](_0x4f6018)[_0x41df('0xc')](function(_0x145779){return _[_0x41df('0x1b')](_0x145779,_0x41df('0x1c'))?_0x145779:undefined;});var _0x161b24=_0x5e369f[_0x41df('0x1d')](function(_0x49e8dc){return db[_0x41df('0x1e')][_0x41df('0x1f')]({'where':{'id':_0x49e8dc['slice'](0x3)},'raw':!![]});});return Promise[_0x41df('0x20')](_0x161b24);})[_0x41df('0x8')](function(_0x38395e){for(var _0xffc529=0x0;_0xffc529<_0x38395e['length'];_0xffc529++){if(_0x38395e[_0xffc529]){var _0x247320=_0x41df('0x1c')+_0x38395e[_0xffc529]['id'];_0x4f6018[_0x247320][_0x41df('0x21')]=_0x38395e[_0xffc529]['type'];}}_0x466a0b=_[_0x41df('0x1d')](Object[_0x41df('0x1a')](_0x4f6018),function(_0x57a59f){return{'name':_0x57a59f,'type':_0x4f6018[_0x57a59f]['type']};});return _0x466a0b;})[_0x41df('0x17')](function(_0x482ff8){throw _0x482ff8;});}; \ No newline at end of file +var _0x141b=['slice','all','fieldType','type','keys','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search','default','where','fields','filter','clause','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','cf_','map','CmCustomField'];(function(_0xa33a71,_0x3efd37){var _0x2b01e6=function(_0x3eb810){while(--_0x3eb810){_0xa33a71['push'](_0xa33a71['shift']());}};_0x2b01e6(++_0x3efd37);}(_0x141b,0x91));var _0xb141=function(_0x4c0fab,_0x198bb1){_0x4c0fab=_0x4c0fab-0x0;var _0x1a08ef=_0x141b[_0x4c0fab];return _0x1a08ef;};'use strict';var _=require(_0xb141('0x0'));var sqlUtils=require(_0xb141('0x1'));var db=require(_0xb141('0x2'))['db'];exports['findAll']=function(_0x317c83,_0x59cd4a,_0x4d6c42,_0x49318c){var _0x59b6e5={'count':0x0,'rows':[]};var _0x168dea=sqlUtils[_0xb141('0x3')](_0x59cd4a,_0x317c83);if(_0x168dea){return Promise[_0xb141('0x4')](_0x59b6e5);}var _0x45910a=sqlUtils['getContactsSubquery']();var _0x46a16a={};var _0x2f844b=![];var _0x16680b=![];return Promise[_0xb141('0x4')]()[_0xb141('0x5')](function(){if(_0x317c83[_0xb141('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x317c83[_0xb141('0x6')],_0x49318c);}else{return sqlUtils['parseQueryParameters'](_0x317c83,_0x49318c);}})[_0xb141('0x5')](function(_0x37438f){_0x45910a['where'](_0x37438f[_0xb141('0x7')]);_0x45910a[_0xb141('0x8')](_0x37438f[_0xb141('0x9')]);_0x45910a[_0xb141('0x8')](_0x37438f[_0xb141('0xa')]);_0x45910a['where'](_0x37438f['user'][_0xb141('0xb')]);_0x46a16a=_0x37438f[_0xb141('0xc')];_0x16680b=_0x37438f[_0xb141('0xd')][_0xb141('0xe')];return sqlUtils[_0xb141('0xf')](_0x59cd4a,_0x317c83,_0x16680b);})[_0xb141('0x5')](function(_0x7ae89e){_0x45910a['where'](_0x7ae89e);var _0x14a8e2=_0x317c83[_0xb141('0x6')]?_0x46a16a[_0xb141('0x10')]:_0x317c83[_0xb141('0x11')];_0x2f844b=_0x14a8e2?!![]:![];return sqlUtils[_0xb141('0x12')](_0x45910a,_0x14a8e2);})[_0xb141('0x5')](function(_0x1f2722){_0x59b6e5[_0xb141('0x13')]=_0x1f2722;if(_0x59b6e5[_0xb141('0x13')]===0x0){return;}if(_0x317c83[_0xb141('0x14')]){_0x16680b=!![];}return sqlUtils[_0xb141('0x15')](_0x45910a,_0x317c83[_0xb141('0x9')],_0x4d6c42,_0x2f844b,_0x46a16a[_0xb141('0xb')],_0x16680b);})[_0xb141('0x5')](function(_0x1399fe){if(!_0x1399fe){return[];}return sqlUtils[_0xb141('0x16')](_0x1399fe,_0x317c83,_0x4d6c42);})[_0xb141('0x5')](function(_0x41b7fd){_0x59b6e5[_0xb141('0x17')]=_0x41b7fd;return _0x59b6e5;})[_0xb141('0x18')](function(_0x235aed){throw _0x235aed;});};exports[_0xb141('0x19')]=function(){var _0x38cea0={};var _0x48a756=[];return db[_0xb141('0x1a')][_0xb141('0x19')]()[_0xb141('0x5')](function(_0x55d00e){_0x38cea0=_0x55d00e;var _0x40fb77=Object['keys'](_0x38cea0)[_0xb141('0xa')](function(_0xaa1d8d){return _['startsWith'](_0xaa1d8d,_0xb141('0x1b'))?_0xaa1d8d:undefined;});var _0x430d6c=_0x40fb77[_0xb141('0x1c')](function(_0x1e8780){return db[_0xb141('0x1d')]['findOne']({'where':{'id':_0x1e8780[_0xb141('0x1e')](0x3)},'raw':!![]});});return Promise[_0xb141('0x1f')](_0x430d6c);})[_0xb141('0x5')](function(_0x372edb){for(var _0x289455=0x0;_0x289455<_0x372edb['length'];_0x289455++){if(_0x372edb[_0x289455]){var _0x546b52=_0xb141('0x1b')+_0x372edb[_0x289455]['id'];_0x38cea0[_0x546b52][_0xb141('0x20')]=_0x372edb[_0x289455][_0xb141('0x21')];}}_0x48a756=_[_0xb141('0x1c')](Object[_0xb141('0x22')](_0x38cea0),function(_0x407cb7){return{'name':_0x407cb7,'type':_0x38cea0[_0x407cb7][_0xb141('0x21')]};});return _0x48a756;})[_0xb141('0x18')](function(_0x41770e){throw _0x41770e;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ea72ffe..e53b60e 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0824=['find','dateOfBirth','fieldType','datetime','DATE','type','text','value','end','Tag','map','tags','and','ids','User','user','clause','uc.UserId\x20=\x20?','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','name','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','TagIds','Tags','isEmpty','t.id\x20IN\x20?','SELECT','exports','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','ListId','CompanyId','createdAt','updatedAt','deletedAt','includes','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions'];(function(_0x5d0004,_0x4bcb9a){var _0x4be732=function(_0x30e2f4){while(--_0x30e2f4){_0x5d0004['push'](_0x5d0004['shift']());}};_0x4be732(++_0x4bcb9a);}(_0x0824,0xab));var _0x4082=function(_0x5a7e2b,_0x14a856){_0x5a7e2b=_0x5a7e2b-0x0;var _0xe0ddc0=_0x0824[_0x5a7e2b];return _0xe0ddc0;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x4082('0x0'));var utils=require(_0x4082('0x1'));var db=require(_0x4082('0x2'))['db'];function skipContactsQuery(_0x5c9f2d,_0x15e9f4){var _0x53e0b3=![];if(_0x5c9f2d[_0x4082('0x3')]===_0x4082('0x4')&&!_0x15e9f4['search']&&!_0x15e9f4['ListId']&&_0x15e9f4[_0x4082('0x5')]!==_0x4082('0x6')){_0x53e0b3=!![];}return _0x53e0b3;}function getContactsSubquery(){return squel[_0x4082('0x7')]()[_0x4082('0x8')](_0x4082('0x9'),'c')[_0x4082('0xa')](_0x4082('0xb'));}function applyJoinClauses(_0x14088b,_0x324aa8){var _0x30f8c8=_0x324aa8?'c':_0x4082('0xc');_0x14088b[_0x4082('0xd')](_0x4082('0xe'),'uc',_0x4082('0xf')+_0x30f8c8+_0x4082('0x10'))[_0x4082('0xd')](_0x4082('0x11'),'ct',_0x4082('0x12')+_0x30f8c8+_0x4082('0x10'))[_0x4082('0xd')](_0x4082('0x13'),'t',_0x4082('0x14'));return _0x14088b;}function addFieldsToQuery(_0x21278f,_0x16de78,_0x5e26bf,_0x241ac1,_0x46d3aa){var _0xfdbaeb=_0x46d3aa?'c':'subqry';if(!_0x16de78){_0x16de78=['id',_0x4082('0x15'),'lastName',_0x4082('0x16'),_0x4082('0x17'),_0x4082('0x18'),'email',_0x4082('0x19'),_0x4082('0x1a'),_0x4082('0x1b'),_0x4082('0x1c'),_0x4082('0x1d'),'TagIds'];}else if(!_0x16de78[_0x4082('0x1e')]('id')){_0x16de78['push']('id');}var _0x4a237e=_0x5e26bf&&_0x46d3aa||!_0x5e26bf&&!_0x46d3aa;if(_0x241ac1){_0x4a237e=_0x241ac1&&_0x46d3aa||!_0x241ac1&&!_0x46d3aa;}_0x16de78['forEach'](function(_0x248f95){if(_0x248f95==='TagIds'){if(_0x4a237e){_0x21278f['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x248f95);}else if(_0x5e26bf||_0x241ac1){_0x21278f[_0x4082('0x1f')](_0xfdbaeb+'.'+_0x248f95);}}else{_0x21278f['field'](_0xfdbaeb+'.'+_0x248f95);}});return _0x21278f;}function getSqlClauses(){var _0x1dfe65={'default':squel[_0x4082('0x20')](),'fields':squel[_0x4082('0x20')](),'filter':squel[_0x4082('0x20')](),'tags':{'clause':squel[_0x4082('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1dfe65;}function parseTagParameter(_0x4fa448){var _0x345176=squel[_0x4082('0x20')]();if(_0x4fa448){var _0x9fbc21=utils[_0x4082('0x21')](_0x4fa448);_0x9fbc21[_0x4082('0x22')](function(_0x2d07ea){_0x345176['or'](_0x4082('0x23'),'%,'+_0x2d07ea+',%');});}return _0x345176;}function parseSearchFilter(_0x704352){var _0x387486=squel['expr']();if(_0x704352){var _0x7aa984=_0x704352['replace']('\x5c','\x5c\x5c')[_0x4082('0x24')](/'/g,'\x27\x27');if(_0x7aa984[_0x4082('0x25')]('\x20')[_0x4082('0x26')]>0x1){_0x387486['or'](_0x4082('0x27'),qs[_0x4082('0x28')](_0x7aa984,!![]),null);}else{if(qs[_0x4082('0x29')](_0x7aa984)){_0x387486['or'](_0x4082('0x2a'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2b'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2c'),_0x7aa984+'%');_0x387486['or'](_0x4082('0x2d'),_0x7aa984+'%');}else if(qs[_0x4082('0x2e')](_0x7aa984)){_0x387486['or'](_0x4082('0x2f'),_0x7aa984+'%');}else{_0x387486['or'](_0x4082('0x30'),'%'+_0x7aa984+'%');_0x387486['or'](_0x4082('0x31'),'%'+_0x7aa984+'%');_0x387486['or'](_0x4082('0x2f'),'%'+_0x7aa984+'%');}}}return _0x387486;}function parseAdvancedSearchFilter(_0x2493fc,_0x1940a7){var _0x300a45=getSqlClauses();var _0x217802=as[_0x4082('0x32')](_0x2493fc);var _0xf92029=_0x217802[_0x4082('0x33')];for(var _0x36a5ee=0x0;_0x36a5ee<_0x217802[_0x4082('0x34')][_0x4082('0x26')];_0x36a5ee++){var _0x4e57be=_0x217802[_0x4082('0x34')][_0x36a5ee];var _0x3da9eb='c';var _0x330916=_[_0x4082('0x35')](_0x1940a7,['name',_0x4e57be[_0x4082('0x1f')]]);if(_0x330916){if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x36')||_0x330916[_0x4082('0x37')]===_0x4082('0x38')){_0x4e57be['castTo']=_0x4082('0x39');}var _0x449814=as['buildExpression'](_0x3da9eb,_0x330916[_0x4082('0x3a')],_0x4e57be);_0x300a45['default'][_0xf92029](_0x449814[_0x4082('0x3b')],_0x449814[_0x4082('0x3c')]['start'],_0x449814[_0x4082('0x3c')][_0x4082('0x3d')]);}else{if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x3e')){var _0x442deb=_0x4e57be[_0x4082('0x3c')][_0x4082('0x25')](',')[_0x4082('0x3f')](function(_0x574641){return Number(_0x574641);});var _0x43f7a3=parseTagParameter(_0x442deb);_0x300a45[_0x4082('0x40')]['clause'][_0x4082('0x41')](_0x43f7a3);_0x300a45[_0x4082('0x40')][_0x4082('0x42')]=_0x442deb;}else if(_0x4e57be[_0x4082('0x1f')]===_0x4082('0x43')){_0x300a45[_0x4082('0x44')][_0x4082('0x45')]['and'](_0x4082('0x46'),_0x4e57be[_0x4082('0x3c')]);_0x300a45[_0x4082('0x44')]['skip']=!![];}}}return _0x300a45;}function parseModelFields(_0x4e211c,_0x57a861){var _0x18d660=squel[_0x4082('0x20')]();var _0xca1a76=_(_0x4e211c)[_0x4082('0x47')]()[_0x4082('0x3f')](function(_0x536162){return _[_0x4082('0x48')](_0x57a861,['name',_0x536162])?_0x536162:undefined;})['compact']()['value']();if(_0x4e211c[_0x4082('0x49')]){_0xca1a76[_0x4082('0x4a')](_0x4082('0x49'));}if(_0x4e211c[_0x4082('0x43')]){_0xca1a76[_0x4082('0x4a')](_0x4082('0x43'));}if(_0xca1a76[_0x4082('0x26')]>0x0){_0xca1a76['forEach'](function(_0x4b07ca){if(_0x4b07ca===_0x4082('0x19')){_0x18d660[_0x4082('0x41')](_0x4082('0x4b'),[][_0x4082('0x4c')](_0x4e211c[_0x4b07ca]));}else if(_0x4b07ca===_0x4082('0x49')){var _0x2f6d72='%'+_0x4e211c[_0x4b07ca]+'%';_0x18d660[_0x4082('0x41')](_0x4082('0x4d'),_0x2f6d72);}else if(_0x4b07ca===_0x4082('0x43')){_0x18d660['and'](_0x4082('0x46'),_0x4e211c[_0x4b07ca]);}else{_0x18d660[_0x4082('0x41')]('c.'+_0x4b07ca+_0x4082('0x4e'),_0x4e211c[_0x4b07ca]);}});}return _0x18d660;}function parseQueryParameters(_0x423f98,_0x3876dc){var _0x159e7f=getSqlClauses();return Promise[_0x4082('0x4f')]()[_0x4082('0x50')](function(){return parseModelFields(_0x423f98,_0x3876dc);})[_0x4082('0x50')](function(_0x321dc1){_0x159e7f[_0x4082('0x51')][_0x4082('0x41')](_0x321dc1);return parseTagParameter(_0x423f98[_0x4082('0x52')]);})['then'](function(_0x532bc7){_0x159e7f['tags'][_0x4082('0x45')][_0x4082('0x41')](_0x532bc7);return parseSearchFilter(_0x423f98[_0x4082('0x53')]);})['then'](function(_0x260353){_0x159e7f['filter']=_0x260353;return _0x159e7f;});}function checkListsRestrictions(_0x1540e5,_0x310d6c,_0x368976){var _0x452ecf=squel[_0x4082('0x20')]();return Promise[_0x4082('0x4f')]()[_0x4082('0x50')](function(){if(_0x310d6c[_0x4082('0x54')]&&_0x1540e5[_0x4082('0x3')]===_0x4082('0x4')&&!_0x368976){return _0x1540e5['getLists']({'attributes':['id'],'raw':!![]});}})[_0x4082('0x50')](function(_0x289632){if(_0x289632){if(_0x289632[_0x4082('0x26')]===0x0){_0x452ecf[_0x4082('0x41')](_0x4082('0x55'));}else{_0x452ecf[_0x4082('0x41')](_0x4082('0x4b'),_[_0x4082('0x3f')](_0x289632,'id'));}}})[_0x4082('0x50')](function(){return _0x452ecf;});}function buildContactsQuery(_0x152d22,_0x54b2e0,_0x565804,_0x2e593d,_0x56b51d,_0x3bd8c5){if(_0x54b2e0){_0x54b2e0=_0x565804[_0x4082('0x56')];}_0x152d22=addFieldsToQuery(_0x152d22,_0x54b2e0,_0x2e593d,_0x3bd8c5,!![]);var _0xe73601=squel[_0x4082('0x7')]();_0xe73601=addFieldsToQuery(_0xe73601,_0x54b2e0,_0x2e593d,_0x3bd8c5,![]);if(_0x2e593d||_0x3bd8c5){_0x152d22=applyJoinClauses(_0x152d22,!![]);_0x152d22[_0x4082('0x57')](_0x4082('0x58'));if(_0x565804['limit']){_0xe73601[_0x4082('0x59')](_0x565804['limit']);}if(_0x565804['offset']){_0xe73601[_0x4082('0x5a')](_0x565804[_0x4082('0x5a')]);}}else{_0xe73601=applyJoinClauses(_0xe73601,![]);_0xe73601[_0x4082('0x57')](_0x4082('0x5b'));if(_0x565804[_0x4082('0x59')]){_0x152d22[_0x4082('0x59')](_0x565804['limit']);}if(_0x565804[_0x4082('0x5a')]){_0x152d22['offset'](_0x565804[_0x4082('0x5a')]);}}_0xe73601[_0x4082('0x5c')](_0x56b51d);if(_0x565804[_0x4082('0x5d')]){_0x565804[_0x4082('0x5d')][_0x4082('0x22')](function(_0x558d09){_0x152d22[_0x4082('0x5d')]('c.'+_0x558d09[0x0],_0x558d09[0x1]===_0x4082('0x5e')?![]:!![]);_0xe73601['order'](_0x4082('0x5f')+_0x558d09[0x0],_0x558d09[0x1]===_0x4082('0x5e')?![]:!![]);});}_0xe73601[_0x4082('0x8')](_0x152d22,_0x4082('0xc'));return _0xe73601;}function getFilteredContacts(_0x43424b){var _0x2e60bb=[];return db['Tag'][_0x4082('0x60')]({'attributes':['id',_0x4082('0x61'),_0x4082('0x62')],'raw':!![]})[_0x4082('0x50')](function(_0x45cb00){_0x2e60bb=_[_0x4082('0x63')](_0x45cb00,'id');var _0x420de1={'type':db[_0x4082('0x64')][_0x4082('0x65')]['SELECT'],'model':db[_0x4082('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4082('0x67')][_0x4082('0x68')](_0x43424b[_0x4082('0x69')](),_0x420de1);})['then'](function(_0x7f0405){_0x7f0405[_0x4082('0x22')](function(_0x4ac274){if(_0x4ac274[_0x4082('0x6a')]){_0x4ac274[_0x4082('0x6b')]=[];_0x4ac274[_0x4082('0x6a')]['split'](',')['forEach'](function(_0x329f83){_0x4ac274[_0x4082('0x6b')][_0x4082('0x4a')](_0x2e60bb[_0x329f83]);});}delete _0x4ac274[_0x4082('0x6a')];});return _0x7f0405;});}function countFilteredContacts(_0x1b3956,_0x357c31){var _0x7a13fc=_0x1b3956['clone']();_0x7a13fc[_0x4082('0x1f')]('COUNT(*)');_0x7a13fc=applyJoinClauses(_0x7a13fc,!![]);_0x1b3956[_0x4082('0x57')](_0x4082('0x58'));var _0x3fa2db=utils['getSelectedTags'](_0x357c31);if(!_[_0x4082('0x6c')](_0x3fa2db)){_0x7a13fc['where'](_0x4082('0x6d'),_0x3fa2db);}var _0x3245be={'type':db[_0x4082('0x64')]['QueryTypes'][_0x4082('0x6e')],'raw':!![]};return db['sequelize'][_0x4082('0x68')](_0x7a13fc[_0x4082('0x69')](),_0x3245be)[_0x4082('0x50')](function(_0x23aed8){return _0x23aed8[0x0]['COUNT(*)'];});}module[_0x4082('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x6e23=['search','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','ListId','CompanyId','updatedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','and','tags','ids','User','user','clause','uc.UserId\x20=\x20?','skip','keys','some','name','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','getLists','c.ListId\x20IS\x20NULL','group','limit','offset','subqry.id','order','subqry.','DESC','findAll','Sequelize','SELECT','CmContact','sequelize','split','Tags','clone','c.id','t.id\x20IN\x20?','QueryTypes','query','toString','COUNT(*)','lodash','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent'];(function(_0x49b869,_0x26445b){var _0x1e4dcb=function(_0x4c7852){while(--_0x4c7852){_0x49b869['push'](_0x49b869['shift']());}};_0x1e4dcb(++_0x26445b);}(_0x6e23,0x1a6));var _0x36e2=function(_0x3216b7,_0x503ad8){_0x3216b7=_0x3216b7-0x0;var _0x7f1e89=_0x6e23[_0x3216b7];return _0x7f1e89;};'use strict';var _=require(_0x36e2('0x0'));var squel=require('squel');var as=require(_0x36e2('0x1'));var qs=require('../parsers/qs');var utils=require(_0x36e2('0x2'));var db=require(_0x36e2('0x3'))['db'];function skipContactsQuery(_0x2ccc97,_0x2a03c2){var _0x1c987d=![];if(_0x2ccc97[_0x36e2('0x4')]===_0x36e2('0x5')&&!_0x2a03c2[_0x36e2('0x6')]&&!_0x2a03c2['ListId']&&_0x2a03c2[_0x36e2('0x7')]!==_0x36e2('0x8')){_0x1c987d=!![];}return _0x1c987d;}function getContactsSubquery(){return squel[_0x36e2('0x9')]()['from'](_0x36e2('0xa'),'c')[_0x36e2('0xb')](_0x36e2('0xc'));}function applyJoinClauses(_0x525f8d,_0x55d1f3){var _0x1f2228=_0x55d1f3?'c':_0x36e2('0xd');_0x525f8d[_0x36e2('0xe')](_0x36e2('0xf'),'uc',_0x36e2('0x10')+_0x1f2228+_0x36e2('0x11'))['left_join']('cm_contact_has_tags','ct',_0x36e2('0x12')+_0x1f2228+_0x36e2('0x11'))[_0x36e2('0xe')](_0x36e2('0x13'),'t',_0x36e2('0x14'));return _0x525f8d;}function addFieldsToQuery(_0x5e8eeb,_0x411bb7,_0x3bb651,_0x41f7aa,_0x56f353){var _0xe9ee8a=_0x56f353?'c':_0x36e2('0xd');if(!_0x411bb7){_0x411bb7=['id',_0x36e2('0x15'),_0x36e2('0x16'),_0x36e2('0x17'),_0x36e2('0x18'),'fax',_0x36e2('0x19'),_0x36e2('0x1a'),_0x36e2('0x1b'),'createdAt',_0x36e2('0x1c'),'deletedAt',_0x36e2('0x1d')];}else if(!_0x411bb7[_0x36e2('0x1e')]('id')){_0x411bb7[_0x36e2('0x1f')]('id');}var _0x4c5733=_0x3bb651&&_0x56f353||!_0x3bb651&&!_0x56f353;if(_0x41f7aa){_0x4c5733=_0x41f7aa&&_0x56f353||!_0x41f7aa&&!_0x56f353;}_0x411bb7['forEach'](function(_0x2ce7a8){if(_0x2ce7a8===_0x36e2('0x1d')){if(_0x4c5733){_0x5e8eeb[_0x36e2('0x20')](_0x36e2('0x21'),_0x2ce7a8);}else if(_0x3bb651||_0x41f7aa){_0x5e8eeb[_0x36e2('0x20')](_0xe9ee8a+'.'+_0x2ce7a8);}}else{_0x5e8eeb[_0x36e2('0x20')](_0xe9ee8a+'.'+_0x2ce7a8);}});return _0x5e8eeb;}function getSqlClauses(){var _0x3d8565={'default':squel[_0x36e2('0x22')](),'fields':squel['expr'](),'filter':squel[_0x36e2('0x22')](),'tags':{'clause':squel[_0x36e2('0x22')](),'ids':null},'user':{'clause':squel[_0x36e2('0x22')](),'skip':![]}};return _0x3d8565;}function parseTagParameter(_0x45632e){var _0x591b07=squel[_0x36e2('0x22')]();if(_0x45632e){var _0x3b2267=utils[_0x36e2('0x23')](_0x45632e);_0x3b2267[_0x36e2('0x24')](function(_0x2db65f){_0x591b07['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2db65f+',%');});}return _0x591b07;}function parseSearchFilter(_0x59bd07){var _0x2f4233=squel[_0x36e2('0x22')]();if(_0x59bd07){var _0x27a45c=_0x59bd07['replace']('\x5c','\x5c\x5c')[_0x36e2('0x25')](/'/g,'\x27\x27');if(_0x27a45c['split']('\x20')[_0x36e2('0x26')]>0x1){_0x2f4233['or'](_0x36e2('0x27'),qs[_0x36e2('0x28')](_0x27a45c,!![]),null);}else{if(qs[_0x36e2('0x29')](_0x27a45c)){_0x2f4233['or'](_0x36e2('0x2a'),_0x27a45c+'%');_0x2f4233['or'](_0x36e2('0x2b'),_0x27a45c+'%');_0x2f4233['or']('c.mobile\x20LIKE\x20?',_0x27a45c+'%');_0x2f4233['or'](_0x36e2('0x2c'),_0x27a45c+'%');}else if(qs['isEmail'](_0x27a45c)){_0x2f4233['or'](_0x36e2('0x2d'),_0x27a45c+'%');}else{_0x2f4233['or'](_0x36e2('0x2e'),'%'+_0x27a45c+'%');_0x2f4233['or'](_0x36e2('0x2f'),'%'+_0x27a45c+'%');_0x2f4233['or'](_0x36e2('0x2d'),'%'+_0x27a45c+'%');}}}return _0x2f4233;}function parseAdvancedSearchFilter(_0x32ee7d,_0x2c832b){var _0x183661=getSqlClauses();var _0x192d05=as['parseSearch'](_0x32ee7d);var _0x6c7ffa=_0x192d05[_0x36e2('0x30')];for(var _0xb66937=0x0;_0xb66937<_0x192d05[_0x36e2('0x31')]['length'];_0xb66937++){var _0x4a1790=_0x192d05[_0x36e2('0x31')][_0xb66937];var _0x5e7a79='c';var _0x1dce74=_[_0x36e2('0x32')](_0x2c832b,['name',_0x4a1790[_0x36e2('0x20')]]);if(_0x1dce74){if(_0x4a1790[_0x36e2('0x20')]===_0x36e2('0x33')||_0x1dce74[_0x36e2('0x34')]===_0x36e2('0x35')){_0x4a1790[_0x36e2('0x36')]=_0x36e2('0x37');}var _0x5e56f8=as[_0x36e2('0x38')](_0x5e7a79,_0x1dce74[_0x36e2('0x39')],_0x4a1790);_0x183661[_0x36e2('0x3a')][_0x6c7ffa](_0x5e56f8[_0x36e2('0x3b')],_0x5e56f8[_0x36e2('0x3c')][_0x36e2('0x3d')],_0x5e56f8[_0x36e2('0x3c')][_0x36e2('0x3e')]);}else{if(_0x4a1790[_0x36e2('0x20')]===_0x36e2('0x3f')){var _0x56be83=_0x4a1790[_0x36e2('0x3c')]['split'](',')[_0x36e2('0x40')](function(_0x3dd93d){return Number(_0x3dd93d);});var _0x299763=parseTagParameter(_0x56be83);_0x183661['tags']['clause'][_0x36e2('0x41')](_0x299763);_0x183661[_0x36e2('0x42')][_0x36e2('0x43')]=_0x56be83;}else if(_0x4a1790['field']===_0x36e2('0x44')){_0x183661[_0x36e2('0x45')][_0x36e2('0x46')]['and'](_0x36e2('0x47'),_0x4a1790[_0x36e2('0x3c')]);_0x183661[_0x36e2('0x45')][_0x36e2('0x48')]=!![];}}}return _0x183661;}function parseModelFields(_0x79695a,_0x284d56){var _0x43e48a=squel[_0x36e2('0x22')]();var _0x4c91b0=_(_0x79695a)[_0x36e2('0x49')]()['map'](function(_0x718cd6){return _[_0x36e2('0x4a')](_0x284d56,[_0x36e2('0x4b'),_0x718cd6])?_0x718cd6:undefined;})['compact']()[_0x36e2('0x3c')]();if(_0x79695a['Contact']){_0x4c91b0[_0x36e2('0x1f')](_0x36e2('0x4c'));}if(_0x79695a['User']){_0x4c91b0['push'](_0x36e2('0x44'));}if(_0x4c91b0[_0x36e2('0x26')]>0x0){_0x4c91b0[_0x36e2('0x24')](function(_0x5d5689){if(_0x5d5689===_0x36e2('0x1a')){_0x43e48a[_0x36e2('0x41')](_0x36e2('0x4d'),[]['concat'](_0x79695a[_0x5d5689]));}else if(_0x5d5689===_0x36e2('0x4c')){var _0x1bbdc2='%'+_0x79695a[_0x5d5689]+'%';_0x43e48a[_0x36e2('0x41')](_0x36e2('0x4e'),_0x1bbdc2);}else if(_0x5d5689===_0x36e2('0x44')){_0x43e48a['and'](_0x36e2('0x47'),_0x79695a[_0x5d5689]);}else{_0x43e48a[_0x36e2('0x41')]('c.'+_0x5d5689+_0x36e2('0x4f'),_0x79695a[_0x5d5689]);}});}return _0x43e48a;}function parseQueryParameters(_0x507a17,_0x5affe6){var _0x16dc51=getSqlClauses();return Promise[_0x36e2('0x50')]()[_0x36e2('0x51')](function(){return parseModelFields(_0x507a17,_0x5affe6);})[_0x36e2('0x51')](function(_0x5b3e74){_0x16dc51['fields'][_0x36e2('0x41')](_0x5b3e74);return parseTagParameter(_0x507a17[_0x36e2('0x52')]);})[_0x36e2('0x51')](function(_0x53cc82){_0x16dc51[_0x36e2('0x42')]['clause']['and'](_0x53cc82);return parseSearchFilter(_0x507a17[_0x36e2('0x53')]);})[_0x36e2('0x51')](function(_0x4ec17f){_0x16dc51[_0x36e2('0x53')]=_0x4ec17f;return _0x16dc51;});}function checkListsRestrictions(_0x56168e,_0x48ada6,_0x33fab6){var _0x2aba43=squel['expr']();return Promise['resolve']()[_0x36e2('0x51')](function(){if(_0x48ada6['search']&&_0x56168e[_0x36e2('0x4')]===_0x36e2('0x5')&&!_0x33fab6){return _0x56168e[_0x36e2('0x54')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3e950a){if(_0x3e950a){if(_0x3e950a[_0x36e2('0x26')]===0x0){_0x2aba43[_0x36e2('0x41')](_0x36e2('0x55'));}else{_0x2aba43[_0x36e2('0x41')](_0x36e2('0x4d'),_[_0x36e2('0x40')](_0x3e950a,'id'));}}})[_0x36e2('0x51')](function(){return _0x2aba43;});}function buildContactsQuery(_0x2aaad6,_0x5518e4,_0x70d92,_0x324e39,_0x23a7bb,_0x1142b8){if(_0x5518e4){_0x5518e4=_0x70d92['attributes'];}_0x2aaad6=addFieldsToQuery(_0x2aaad6,_0x5518e4,_0x324e39,_0x1142b8,!![]);var _0x406e88=squel[_0x36e2('0x9')]();_0x406e88=addFieldsToQuery(_0x406e88,_0x5518e4,_0x324e39,_0x1142b8,![]);if(_0x324e39||_0x1142b8){_0x2aaad6=applyJoinClauses(_0x2aaad6,!![]);_0x2aaad6[_0x36e2('0x56')]('c.id');if(_0x70d92[_0x36e2('0x57')]){_0x406e88[_0x36e2('0x57')](_0x70d92['limit']);}if(_0x70d92[_0x36e2('0x58')]){_0x406e88['offset'](_0x70d92[_0x36e2('0x58')]);}}else{_0x406e88=applyJoinClauses(_0x406e88,![]);_0x406e88['group'](_0x36e2('0x59'));if(_0x70d92[_0x36e2('0x57')]){_0x2aaad6[_0x36e2('0x57')](_0x70d92[_0x36e2('0x57')]);}if(_0x70d92['offset']){_0x2aaad6[_0x36e2('0x58')](_0x70d92[_0x36e2('0x58')]);}}_0x406e88['having'](_0x23a7bb);if(_0x70d92['order']){_0x70d92[_0x36e2('0x5a')][_0x36e2('0x24')](function(_0x1add0f){_0x2aaad6['order']('c.'+_0x1add0f[0x0],_0x1add0f[0x1]==='DESC'?![]:!![]);_0x406e88[_0x36e2('0x5a')](_0x36e2('0x5b')+_0x1add0f[0x0],_0x1add0f[0x1]===_0x36e2('0x5c')?![]:!![]);});}_0x406e88['from'](_0x2aaad6,_0x36e2('0xd'));return _0x406e88;}function getFilteredContacts(_0x10b6eb){var _0x1e4eed=[];return db['Tag'][_0x36e2('0x5d')]({'attributes':['id','name','color'],'raw':!![]})['then'](function(_0x2a6191){_0x1e4eed=_['keyBy'](_0x2a6191,'id');var _0x24067f={'type':db[_0x36e2('0x5e')]['QueryTypes'][_0x36e2('0x5f')],'model':db[_0x36e2('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x36e2('0x61')]['query'](_0x10b6eb['toString'](),_0x24067f);})['then'](function(_0x50a7e0){_0x50a7e0['forEach'](function(_0x29d861){if(_0x29d861[_0x36e2('0x1d')]){_0x29d861['Tags']=[];_0x29d861['TagIds'][_0x36e2('0x62')](',')[_0x36e2('0x24')](function(_0x4015d3){_0x29d861[_0x36e2('0x63')][_0x36e2('0x1f')](_0x1e4eed[_0x4015d3]);});}delete _0x29d861[_0x36e2('0x1d')];});return _0x50a7e0;});}function countFilteredContacts(_0x4e160b,_0xca26ec){var _0x1e35bb=_0x4e160b[_0x36e2('0x64')]();_0x1e35bb[_0x36e2('0x20')]('COUNT(*)');_0x1e35bb=applyJoinClauses(_0x1e35bb,!![]);_0x4e160b[_0x36e2('0x56')](_0x36e2('0x65'));var _0x2ce8a7=utils['getSelectedTags'](_0xca26ec);if(!_['isEmpty'](_0x2ce8a7)){_0x1e35bb[_0x36e2('0xb')](_0x36e2('0x66'),_0x2ce8a7);}var _0x19619e={'type':db[_0x36e2('0x5e')][_0x36e2('0x67')]['SELECT'],'raw':!![]};return db[_0x36e2('0x61')][_0x36e2('0x68')](_0x1e35bb[_0x36e2('0x69')](),_0x19619e)[_0x36e2('0x51')](function(_0x1a541a){return _0x1a541a[0x0][_0x36e2('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index fe34021..3fe650a 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 _0x7978=['update','close','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/logger','app','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','binary','write','end','final','unlink','decryptFile','createReadStream','createDecipher','data'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7978,0x1db));var _0x8797=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7978[_0x12f688];return _0x59c3de;};'use strict';var crypto=require(_0x8797('0x0'));var fs=require('fs');var BPromise=require(_0x8797('0x1'));var _=require(_0x8797('0x2'));var config=require('../../config/environment');var logger=require(_0x8797('0x3'))(_0x8797('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8797('0x5')],'algorithm':_0x8797('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x8797('0x7')]&&config['encrypt'][_0x8797('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8797('0x7')]['algorithm']);if(isSupported){fileOptions[_0x8797('0x8')]=config['encrypt'][_0x8797('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8797('0x9')](',\x20');logger[_0x8797('0xa')](config[_0x8797('0x7')]['algorithm'],_0x8797('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x3b35ca){return AES_SUPPORTED_RX[_0x8797('0xc')](_0x3b35ca);}function getSupportedCiphers(){return crypto[_0x8797('0xd')]()[_0x8797('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x240464){return getSupportedCiphers()[_0x8797('0xf')](_0x240464)>-0x1;}function combineOptions(_0x20a247){var _0x344370={};for(var _0x4cbcbc in fileOptions){if(fileOptions[_0x8797('0x10')](_0x4cbcbc)){_0x344370[_0x4cbcbc]=fileOptions[_0x4cbcbc];}}if(_0x20a247){for(var _0x3dee83 in _0x20a247){if(_0x20a247[_0x8797('0x10')](_0x3dee83)){_0x344370[_0x3dee83]=_0x20a247[_0x3dee83];}}}return _0x344370;}exports[_0x8797('0x11')]=function(_0x42b24a,_0x457925,_0x4b6b5a,_0x406a30){return new BPromise(function(_0x54bb08,_0x4c95ac){_0x406a30=combineOptions(_0x406a30);var _0x1417b4=new Buffer(_0x4b6b5a);var _0x1c558a=fs['createReadStream'](_0x42b24a);var _0x2f7904=fs[_0x8797('0x12')](_0x457925);var _0x13732b=crypto[_0x8797('0x13')](_0x406a30['algorithm'],_0x1417b4);_0x1c558a['on']('data',function(_0x2315a6){var _0x1df193=new Buffer(_0x13732b['update'](_0x2315a6),_0x8797('0x14'));_0x2f7904[_0x8797('0x15')](_0x1df193);});_0x1c558a['on'](_0x8797('0x16'),function(){try{var _0x2e0843=new Buffer(_0x13732b[_0x8797('0x17')](_0x8797('0x14')),_0x8797('0x14'));_0x2f7904['write'](_0x2e0843);_0x2f7904[_0x8797('0x16')]();_0x2f7904['on']('close',function(){return _0x54bb08(_0x457925);});}catch(_0x3fac8f){fs[_0x8797('0x18')](_0x457925);return _0x4c95ac(_0x3fac8f);}});});};exports[_0x8797('0x19')]=function(_0x4c0700,_0x15f22a,_0x467dab,_0x43a62d){return new BPromise(function(_0x476582,_0x5eda44){_0x43a62d=combineOptions(_0x43a62d);var _0x1abad0=new Buffer(_0x467dab);var _0x11f1ae=fs[_0x8797('0x1a')](_0x4c0700);var _0x2a91aa=fs[_0x8797('0x12')](_0x15f22a);var _0x2e0ac4=crypto[_0x8797('0x1b')](_0x43a62d[_0x8797('0x8')],_0x1abad0);_0x11f1ae['on'](_0x8797('0x1c'),function(_0xdf1576){var _0x4ecb69=new Buffer(_0x2e0ac4[_0x8797('0x1d')](_0xdf1576),_0x8797('0x14'));_0x2a91aa[_0x8797('0x15')](_0x4ecb69);});_0x11f1ae['on'](_0x8797('0x16'),function(){try{var _0x3b0ac7=new Buffer(_0x2e0ac4[_0x8797('0x17')](_0x8797('0x14')),_0x8797('0x14'));_0x2a91aa[_0x8797('0x15')](_0x3b0ac7);_0x2a91aa[_0x8797('0x16')]();_0x2a91aa['on'](_0x8797('0x1e'),function(){return _0x476582(_0x15f22a);});}catch(_0x337fa1){fs['unlink'](_0x15f22a);return _0x5eda44(_0x337fa1);}});});};exports[_0x8797('0x1f')]=function(_0x45b035,_0x58fec7,_0x3adc1f){var _0x5ca3a5=_0x3adc1f||stringOptions[_0x8797('0x8')];var _0xa001bf=_0x58fec7||stringOptions[_0x8797('0x20')];var _0x56ccc2=crypto[_0x8797('0x13')](_0x5ca3a5,_0xa001bf);var _0x166355=_0x56ccc2['update'](_0x45b035,'utf8',_0x8797('0x21'));_0x166355+=_0x56ccc2[_0x8797('0x17')](_0x8797('0x21'));return _0x166355;};exports[_0x8797('0x22')]=function(_0x2f58b1,_0xd1a5d4,_0x1840a8){var _0x4a42b9=_0x1840a8||stringOptions['algorithm'];var _0x3c62ec=_0xd1a5d4||stringOptions[_0x8797('0x20')];var _0x2caeea=crypto['createDecipher'](_0x4a42b9,_0x3c62ec);var _0x38739c=_0x2caeea[_0x8797('0x1d')](_0x2f58b1,'base64',_0x8797('0x23'));_0x38739c+=_0x2caeea[_0x8797('0x17')](_0x8797('0x23'));return _0x38739c;}; \ No newline at end of file +var _0x7263=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','write','end','close','unlink','decryptFile','createDecipher','data','final','encryptString','utf8','secret','base64','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x1325fe,_0x112a57){var _0x8791ef=function(_0x458ee9){while(--_0x458ee9){_0x1325fe['push'](_0x1325fe['shift']());}};_0x8791ef(++_0x112a57);}(_0x7263,0x18a));var _0x3726=function(_0x37f09c,_0x31b66b){_0x37f09c=_0x37f09c-0x0;var _0x19e7e8=_0x7263[_0x37f09c];return _0x19e7e8;};'use strict';var crypto=require(_0x3726('0x0'));var fs=require('fs');var BPromise=require(_0x3726('0x1'));var _=require(_0x3726('0x2'));var config=require(_0x3726('0x3'));var logger=require('../../config/logger')(_0x3726('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3726('0x5')][_0x3726('0x6')],'algorithm':_0x3726('0x7')};const fileOptions={'algorithm':_0x3726('0x8')};if(config[_0x3726('0x9')]&&config[_0x3726('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x3726('0x9')][_0x3726('0xa')]);if(isSupported){fileOptions[_0x3726('0xa')]=config[_0x3726('0x9')][_0x3726('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3726('0xb')](',\x20');logger[_0x3726('0xc')](config[_0x3726('0x9')][_0x3726('0xa')],_0x3726('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x33ec32){return AES_SUPPORTED_RX[_0x3726('0xe')](_0x33ec32);}function getSupportedCiphers(){return crypto[_0x3726('0xf')]()[_0x3726('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x5eb450){return getSupportedCiphers()[_0x3726('0x11')](_0x5eb450)>-0x1;}function combineOptions(_0x3fc9ba){var _0x16b3ca={};for(var _0x36ef2f in fileOptions){if(fileOptions['hasOwnProperty'](_0x36ef2f)){_0x16b3ca[_0x36ef2f]=fileOptions[_0x36ef2f];}}if(_0x3fc9ba){for(var _0x4552ab in _0x3fc9ba){if(_0x3fc9ba[_0x3726('0x12')](_0x4552ab)){_0x16b3ca[_0x4552ab]=_0x3fc9ba[_0x4552ab];}}}return _0x16b3ca;}exports[_0x3726('0x13')]=function(_0x220d37,_0x4dbba8,_0x3f3151,_0x118894){return new BPromise(function(_0x24f3a4,_0x214e7e){_0x118894=combineOptions(_0x118894);var _0x5446dc=new Buffer(_0x3f3151);var _0x249345=fs[_0x3726('0x14')](_0x220d37);var _0x27cf23=fs[_0x3726('0x15')](_0x4dbba8);var _0x563609=crypto[_0x3726('0x16')](_0x118894['algorithm'],_0x5446dc);_0x249345['on']('data',function(_0x12e09d){var _0x55b464=new Buffer(_0x563609[_0x3726('0x17')](_0x12e09d),_0x3726('0x18'));_0x27cf23[_0x3726('0x19')](_0x55b464);});_0x249345['on'](_0x3726('0x1a'),function(){try{var _0x20168e=new Buffer(_0x563609['final']('binary'),_0x3726('0x18'));_0x27cf23[_0x3726('0x19')](_0x20168e);_0x27cf23[_0x3726('0x1a')]();_0x27cf23['on'](_0x3726('0x1b'),function(){return _0x24f3a4(_0x4dbba8);});}catch(_0x553709){fs[_0x3726('0x1c')](_0x4dbba8);return _0x214e7e(_0x553709);}});});};exports[_0x3726('0x1d')]=function(_0x956325,_0x2c6500,_0x22f36b,_0x199625){return new BPromise(function(_0x86b5a8,_0x149d98){_0x199625=combineOptions(_0x199625);var _0x145ef9=new Buffer(_0x22f36b);var _0x8ff659=fs[_0x3726('0x14')](_0x956325);var _0x453d88=fs['createWriteStream'](_0x2c6500);var _0x31401a=crypto[_0x3726('0x1e')](_0x199625[_0x3726('0xa')],_0x145ef9);_0x8ff659['on'](_0x3726('0x1f'),function(_0x290e87){var _0x1bf4ad=new Buffer(_0x31401a[_0x3726('0x17')](_0x290e87),'binary');_0x453d88[_0x3726('0x19')](_0x1bf4ad);});_0x8ff659['on']('end',function(){try{var _0x4fa234=new Buffer(_0x31401a[_0x3726('0x20')](_0x3726('0x18')),_0x3726('0x18'));_0x453d88[_0x3726('0x19')](_0x4fa234);_0x453d88[_0x3726('0x1a')]();_0x453d88['on'](_0x3726('0x1b'),function(){return _0x86b5a8(_0x2c6500);});}catch(_0x2ca9e4){fs[_0x3726('0x1c')](_0x2c6500);return _0x149d98(_0x2ca9e4);}});});};exports[_0x3726('0x21')]=function(_0x4e6868,_0x59d923,_0x51ca32){var _0x5df9eb=_0x51ca32||stringOptions['algorithm'];var _0x2cc857=_0x59d923||stringOptions['secret'];var _0x3e6948=crypto[_0x3726('0x16')](_0x5df9eb,_0x2cc857);var _0x39905b=_0x3e6948[_0x3726('0x17')](_0x4e6868,_0x3726('0x22'),'base64');_0x39905b+=_0x3e6948['final']('base64');return _0x39905b;};exports['decryptString']=function(_0x94722a,_0x13f19f,_0x1d16aa){var _0x2eb927=_0x1d16aa||stringOptions[_0x3726('0xa')];var _0x2bf642=_0x13f19f||stringOptions[_0x3726('0x23')];var _0x20b958=crypto[_0x3726('0x1e')](_0x2eb927,_0x2bf642);var _0x1b5fca=_0x20b958[_0x3726('0x17')](_0x94722a,_0x3726('0x24'),'utf8');_0x1b5fca+=_0x20b958[_0x3726('0x20')](_0x3726('0x22'));return _0x1b5fca;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 90cdeb5..080a228 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 _0x18ac=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','forEach'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x18ac,0x135));var _0xc18a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18ac[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var path=require(_0xc18a('0x0'));var _=require('lodash');var csv=require(_0xc18a('0x1'));var fs=require('fs');var BPromise=require(_0xc18a('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xc18a('0x3'));var db=require(_0xc18a('0x4'))['db'];var dbH=require(_0xc18a('0x4'))[_0xc18a('0x5')];var logger=require(_0xc18a('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc18a('0x7')][0x2]);var QUERY=process[_0xc18a('0x7')][0x3];var PATH=process[_0xc18a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c6383,_0xe59456){var _0x1097d6={'status':_0x2c6383};var _0x2b5151={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe59456){_0x1097d6['savename']=_0xe59456;}return db[_0xc18a('0x8')][_0xc18a('0x9')](_0x1097d6,_0x2b5151);}function main(){var _0x2c3402=0x1388;var _0x1336f7;logger[_0xc18a('0xa')](util[_0xc18a('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc18a('0xc')));return db[_0xc18a('0xd')][_0xc18a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc18a('0xf'),_0xc18a('0x10')]})[_0xc18a('0x11')](function(_0x2089eb){if(_0x2089eb){_0x1336f7=_0x2089eb;_0x2c3402=_0x1336f7[_0xc18a('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x13'),QUERY),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]});})[_0xc18a('0x11')](function(_0x52e441){if(!_0x52e441[0x0][_0xc18a('0x17')]){return analyticExtractedReport(_0xc18a('0x18'));}var _0x181092=[];var _0xc1c8fe=0x0;if(_0x1336f7[_0xc18a('0xf')]){if(_0x52e441&&_0x52e441[_0xc18a('0x19')]){var _0x14b8e9=_['range'](_0x52e441[0x0]['num']/_0x2c3402);var _0x3b85dd=Number['isInteger'](_0x52e441[0x0][_0xc18a('0x17')]/_0x2c3402)?_0x52e441[0x0]['num']%_0x2c3402:0x0;_0x14b8e9[_0xc18a('0x1a')](function(_0x4681b6){if(_0x4681b6>0x0){_0xc1c8fe+=_0x2c3402;}_0x181092['push'](dbH[_0xc18a('0x14')][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x1b'),QUERY,_0x2c3402,_0xc1c8fe),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]}));});if(_0x3b85dd>0x0){_0xc1c8fe+=_0x2c3402;_0x181092[_0xc18a('0x1c')](dbH[_0xc18a('0x14')][_0xc18a('0x12')](util[_0xc18a('0xb')](_0xc18a('0x1b'),QUERY,_0x3b85dd,_0xc1c8fe),{'type':dbH[_0xc18a('0x14')][_0xc18a('0x15')][_0xc18a('0x16')]}));}}}else{_0x181092[_0xc18a('0x1c')](dbH[_0xc18a('0x14')]['query'](QUERY,{'type':dbH[_0xc18a('0x14')]['QueryTypes'][_0xc18a('0x16')]}));}var _0x349ed1=path['dirname'](PATH);var _0x2940cb=path[_0xc18a('0x1d')](PATH,_0xc18a('0x1e'));var _0x1ccffd=_0x1336f7[_0xc18a('0xf')]&&_0x181092[_0xc18a('0x19')]>0x1;var _0x571863=[];if(!fs[_0xc18a('0x1f')](path[_0xc18a('0x20')](_0x349ed1,_0x2940cb))&&_0x1ccffd){fs[_0xc18a('0x21')](path[_0xc18a('0x20')](_0x349ed1,_0x2940cb));}return BPromise[_0xc18a('0x22')](_0x181092,function(_0x5add7e){_0x571863['push'](_0x5add7e);})[_0xc18a('0x11')](function(){for(var _0x2e04e1=0x0;_0x2e04e1<_0x571863[_0xc18a('0x19')];_0x2e04e1+=0x1){var _0x3bdd66;var _0x2268e7=_0x571863[_0x2e04e1];if(_0x1ccffd){_0x3bdd66=path[_0xc18a('0x20')](_0x349ed1,_0x2940cb,util[_0xc18a('0xb')](_0xc18a('0x23'),_0x2940cb,_0x2e04e1,_0xc18a('0x24')));}else{_0x3bdd66=path[_0xc18a('0x20')](_0x349ed1,util[_0xc18a('0xb')](_0xc18a('0x25'),_0x2940cb,_0xc18a('0x24')));}fs['writeFileSync'](_0x3bdd66,csv(_0x2268e7));}})[_0xc18a('0x11')](function(){if(_0x1ccffd){return new Promise(function(_0x256ce2){zipdir(path['join'](_0x349ed1,_0x2940cb),{'saveTo':path[_0xc18a('0x20')](_0x349ed1,util[_0xc18a('0xb')](_0xc18a('0x25'),_0x2940cb,'zip'))},function(_0x12b998,_0x1cf295){rimraf(path[_0xc18a('0x20')](_0x349ed1,_0x2940cb),function(){});_0x256ce2(_0xc18a('0x26'));});});}})[_0xc18a('0x11')](function(){logger[_0xc18a('0xa')](util[_0xc18a('0xb')](_0xc18a('0x27'),EXTRACTED_REPORT_ID,_0xc18a('0xc')));return analyticExtractedReport(_0xc18a('0x28'),_0x1ccffd?util['format']('%s.%s',_0x2940cb,_0x1ccffd?_0xc18a('0x29'):_0xc18a('0x24')):null);});})[_0xc18a('0x2a')](function(_0x441370){logger[_0xc18a('0xa')](util[_0xc18a('0xb')](_0xc18a('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xc18a('0x2c')](_0x441370,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc18a('0x2d'));})[_0xc18a('0x2e')](function(){process[_0xc18a('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf1f6=['Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','range','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x1c2352,_0x4bc8c3){var _0x49186a=function(_0x6018f2){while(--_0x6018f2){_0x1c2352['push'](_0x1c2352['shift']());}};_0x49186a(++_0x4bc8c3);}(_0xf1f6,0x82));var _0x6f1f=function(_0xa7ccce,_0x2d502b){_0xa7ccce=_0xa7ccce-0x0;var _0x2babcd=_0xf1f6[_0xa7ccce];return _0x2babcd;};'use strict';var util=require(_0x6f1f('0x0'));var path=require(_0x6f1f('0x1'));var _=require(_0x6f1f('0x2'));var csv=require(_0x6f1f('0x3'));var fs=require('fs');var BPromise=require(_0x6f1f('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x6f1f('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x6f1f('0x6'))(_0x6f1f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6f1f('0x8')][0x2]);var QUERY=process[_0x6f1f('0x8')][0x3];var PATH=process[_0x6f1f('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x24cb33,_0x217cbd){var _0x4cd6ed={'status':_0x24cb33};var _0x290963={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x217cbd){_0x4cd6ed[_0x6f1f('0x9')]=_0x217cbd;}return db[_0x6f1f('0xa')][_0x6f1f('0xb')](_0x4cd6ed,_0x290963);}function main(){var _0x5b056d=0x1388;var _0x4b40e6;logger[_0x6f1f('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6f1f('0xd')));return db[_0x6f1f('0xe')][_0x6f1f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6f1f('0x10')]})[_0x6f1f('0x11')](function(_0x4397ab){if(_0x4397ab){_0x4b40e6=_0x4397ab;_0x5b056d=_0x4b40e6[_0x6f1f('0x10')]||0x1388;}})['then'](function(){return dbH[_0x6f1f('0x12')][_0x6f1f('0x13')](util[_0x6f1f('0x14')](_0x6f1f('0x15'),QUERY),{'type':dbH[_0x6f1f('0x12')][_0x6f1f('0x16')]['SELECT']});})[_0x6f1f('0x11')](function(_0x208e89){if(!_0x208e89[0x0][_0x6f1f('0x17')]){return analyticExtractedReport(_0x6f1f('0x18'));}var _0x1ceec0=[];var _0x16c80c=0x0;if(_0x4b40e6[_0x6f1f('0x19')]){if(_0x208e89&&_0x208e89['length']){var _0xb93cf5=_[_0x6f1f('0x1a')](_0x208e89[0x0]['num']/_0x5b056d);var _0x3be4b3=Number['isInteger'](_0x208e89[0x0][_0x6f1f('0x17')]/_0x5b056d)?_0x208e89[0x0][_0x6f1f('0x17')]%_0x5b056d:0x0;_0xb93cf5['forEach'](function(_0x31fee3){if(_0x31fee3>0x0){_0x16c80c+=_0x5b056d;}_0x1ceec0[_0x6f1f('0x1b')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b056d,_0x16c80c),{'type':dbH['sequelize'][_0x6f1f('0x16')][_0x6f1f('0x1c')]}));});if(_0x3be4b3>0x0){_0x16c80c+=_0x5b056d;_0x1ceec0['push'](dbH[_0x6f1f('0x12')][_0x6f1f('0x13')](util[_0x6f1f('0x14')](_0x6f1f('0x1d'),QUERY,_0x3be4b3,_0x16c80c),{'type':dbH['sequelize']['QueryTypes'][_0x6f1f('0x1c')]}));}}}else{_0x1ceec0[_0x6f1f('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x6f1f('0x12')][_0x6f1f('0x16')][_0x6f1f('0x1c')]}));}var _0x170997=path['dirname'](PATH);var _0x5f0381=path[_0x6f1f('0x1e')](PATH,'.csv');var _0x9d0fde=_0x4b40e6[_0x6f1f('0x19')]&&_0x1ceec0[_0x6f1f('0x1f')]>0x1;var _0x31789a=[];if(!fs[_0x6f1f('0x20')](path[_0x6f1f('0x21')](_0x170997,_0x5f0381))&&_0x9d0fde){fs[_0x6f1f('0x22')](path[_0x6f1f('0x21')](_0x170997,_0x5f0381));}return BPromise[_0x6f1f('0x23')](_0x1ceec0,function(_0x4fae97){_0x31789a[_0x6f1f('0x1b')](_0x4fae97);})['then'](function(){for(var _0x3e9bfa=0x0;_0x3e9bfa<_0x31789a[_0x6f1f('0x1f')];_0x3e9bfa+=0x1){var _0x1f49bb;var _0x26d1c8=_0x31789a[_0x3e9bfa];if(_0x9d0fde){_0x1f49bb=path[_0x6f1f('0x21')](_0x170997,_0x5f0381,util[_0x6f1f('0x14')](_0x6f1f('0x24'),_0x5f0381,_0x3e9bfa,_0x6f1f('0x25')));}else{_0x1f49bb=path['join'](_0x170997,util[_0x6f1f('0x14')](_0x6f1f('0x26'),_0x5f0381,'csv'));}fs[_0x6f1f('0x27')](_0x1f49bb,csv(_0x26d1c8));}})[_0x6f1f('0x11')](function(){if(_0x9d0fde){return new Promise(function(_0xbbf949){zipdir(path[_0x6f1f('0x21')](_0x170997,_0x5f0381),{'saveTo':path[_0x6f1f('0x21')](_0x170997,util['format']('%s.%s',_0x5f0381,_0x6f1f('0x28')))},function(_0x3b22b2,_0x1713d0){rimraf(path[_0x6f1f('0x21')](_0x170997,_0x5f0381),function(){});_0xbbf949(_0x6f1f('0x29'));});});}})[_0x6f1f('0x11')](function(){logger[_0x6f1f('0xc')](util['format'](_0x6f1f('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6f1f('0x2b'),_0x9d0fde?util['format'](_0x6f1f('0x26'),_0x5f0381,_0x9d0fde?_0x6f1f('0x28'):_0x6f1f('0x25')):null);});})['catch'](function(_0xaaa465){logger['info'](util[_0x6f1f('0x14')](_0x6f1f('0x2c'),EXTRACTED_REPORT_ID,_0x6f1f('0xd')),util[_0x6f1f('0x2d')](_0xaaa465,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f1f('0x2e'));})[_0x6f1f('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0927171..697aca5 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 _0x0d36=['pdfmake/src/printer','JSDOM','bluebird','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','value','fill','length','auto','body','push','concat','keys','format','name','startDate','endDate','header','before','\x20/\x20','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','forEach','sequelize','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.pdf','join','mkdirSync','each','pdf','%s.%s','all','zip','PDF','info','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','/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','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfKitDocument','lodash','util','path','moment'];(function(_0x250d2a,_0x2983be){var _0x5738fa=function(_0x3cbde0){while(--_0x3cbde0){_0x250d2a['push'](_0x250d2a['shift']());}};_0x5738fa(++_0x2983be);}(_0x0d36,0xa4));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x60d3('0x0'));var fs=require('fs');var util=require(_0x60d3('0x1'));var path=require(_0x60d3('0x2'));var moment=require(_0x60d3('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x60d3('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x60d3('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x60d3('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x60d3('0x7'))(_0x60d3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x60d3('0x9')][0x2]);var QUERY=process[_0x60d3('0x9')][0x3];var PATH=process[_0x60d3('0x9')][0x4];var NAME=process[_0x60d3('0x9')][0x5];var FORMAT=_0x60d3('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x12c50c,_0x4226e9){var _0xbc3e37={'status':_0x12c50c};var _0x352b67={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4226e9){_0xbc3e37[_0x60d3('0xb')]=_0x4226e9;}return db[_0x60d3('0xc')][_0x60d3('0xd')](_0xbc3e37,_0x352b67);}function getHeaders(_0x26cafb){return _[_0x60d3('0xe')](_0x26cafb,function(_0x1be861){return{'text':_0x1be861,'style':'tableHeader'};});}function getRows(_0x53e162,_0xb75962){return _[_0x60d3('0xe')](_0xb75962,function(_0x4357ed){return _(_0x4357ed)['pick'](_0x53e162)[_0x60d3('0xe')](function(_0xf3eeed){return _0xf3eeed?_['toString'](_0xf3eeed):'';})[_0x60d3('0xf')]();});}function createTable(_0x15760c,_0x12b9c0){var _0x19e4e1={'widths':_[_0x60d3('0x10')](Array(_0x15760c[_0x60d3('0x11')]),0x91),'heights':function(_0x864e92){return _0x864e92===0x0?_0x60d3('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x46d52a=getHeaders(_0x15760c);_0x19e4e1[_0x60d3('0x13')][_0x60d3('0x14')](_0x46d52a);var _0x40e0e1=getRows(_0x15760c,_0x12b9c0);_0x19e4e1[_0x60d3('0x13')]=_0x19e4e1[_0x60d3('0x13')][_0x60d3('0x15')](_0x40e0e1);return _0x19e4e1;}function createTables(_0x8ebf21){var _0x429238=[];var _0x54381f=_['chunk'](Object[_0x60d3('0x16')](_0x8ebf21[0x0]),0x5);_0x54381f['forEach'](function(_0x28e999){_0x429238['push'](createTable(_0x28e999,_0x8ebf21));});return _0x429238;}function getPDFDocDefinition(_0x4050da){var _0xbcb1bc=util[_0x60d3('0x17')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x60d3('0x18')],moment(EXTRACTED_REPORT[_0x60d3('0x19')])[_0x60d3('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0x60d3('0x1a')])['format'](FORMAT));var _0x18e0ee=[];for(var _0x4b1776=0x0;_0x4b1776<_0x4050da[_0x60d3('0x11')];_0x4b1776++){var _0x811154=[];if(_0x4b1776===0x0){_0x811154[_0x60d3('0x14')]({'text':_0xbcb1bc,'style':_0x60d3('0x1b')});}var _0x4ebfd5={'table':_0x4050da[_0x4b1776]};if(_0x4b1776>0x0){_0x4ebfd5['pageBreak']=_0x60d3('0x1c');_0x4ebfd5['margin']=[0x0,0x46,0x0,0x0];}_0x811154[_0x60d3('0x14')](_0x4ebfd5);_0x18e0ee[_0x60d3('0x14')](_0x811154);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x18e0ee,'footer':function(_0x6f1447,_0x42c732){return{'text':_0x6f1447['toString']()+_0x60d3('0x1d')+_0x42c732,'style':'footer'};},'defaultStyle':{'font':_0x60d3('0x1e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x60d3('0x1f')},'footer':{'alignment':_0x60d3('0x20'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3e6dfe){var _0x54fdf0=0x1388;var _0x29c092;if(!_0x3e6dfe[0x0][_0x60d3('0x21')]){return analyticExtractedReport(_0x60d3('0x22'));}return db[_0x60d3('0x23')][_0x60d3('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x60d3('0x25')]})[_0x60d3('0x26')](function(_0x468303){if(_0x468303){_0x29c092=_0x468303;_0x54fdf0=_0x29c092[_0x60d3('0x25')]||0x3e8;}})[_0x60d3('0x26')](function(){var _0x18efb5=[];var _0x230434=0x0;if(_0x29c092[_0x60d3('0x27')]){if(_0x3e6dfe&&_0x3e6dfe[_0x60d3('0x11')]){var _0x509a02=_['range'](_0x3e6dfe[0x0][_0x60d3('0x21')]/_0x54fdf0);var _0x3f2b85=Number[_0x60d3('0x28')](_0x3e6dfe[0x0][_0x60d3('0x21')]/_0x54fdf0)?_0x3e6dfe[0x0][_0x60d3('0x21')]%_0x54fdf0:0x0;_0x509a02[_0x60d3('0x29')](function(_0x5779e1){if(_0x5779e1>0x0){_0x230434+=_0x54fdf0;}_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')]['query'](util[_0x60d3('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x54fdf0,_0x230434),{'type':dbH[_0x60d3('0x2a')]['QueryTypes'][_0x60d3('0x2b')]}));});if(_0x3f2b85>0x0){_0x230434+=_0x54fdf0;_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')][_0x60d3('0x2c')](util[_0x60d3('0x17')](_0x60d3('0x2d'),QUERY,_0x3f2b85,_0x230434),{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')][_0x60d3('0x2b')]}));}}}else{_0x18efb5[_0x60d3('0x14')](dbH[_0x60d3('0x2a')]['query'](QUERY,{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')]['SELECT']}));}var _0x575dc6=path[_0x60d3('0x2f')](PATH);var _0x100d80=path[_0x60d3('0x30')](PATH,_0x60d3('0x31'));var _0x36fda9=_0x29c092[_0x60d3('0x27')]&&_0x18efb5['length']>0x1;var _0x44446a=[];if(!fs['existsSync'](path[_0x60d3('0x32')](_0x575dc6,_0x100d80))&&_0x36fda9){fs[_0x60d3('0x33')](path[_0x60d3('0x32')](_0x575dc6,_0x100d80));}return BPromise[_0x60d3('0x34')](_0x18efb5,function(_0x504a06){_0x44446a[_0x60d3('0x14')](_0x504a06);})[_0x60d3('0x26')](function(){var _0x2121e4=[];for(var _0x4d8fd2=0x0;_0x4d8fd2<_0x44446a['length'];_0x4d8fd2+=0x1){var _0x226862=_0x44446a[_0x4d8fd2];var _0x573682=createTables(_['flatten'](_0x226862));var _0x3bef95;var _0x3ffb02=getPDFDocDefinition(_0x573682);var _0x3a0231=getPDFPrinter();var _0x3a7b3f=_0x3a0231['createPdfKitDocument'](_0x3ffb02);if(_0x36fda9){_0x3bef95=path['join'](_0x575dc6,_0x100d80,util['format']('%s%d.%s',_0x100d80,_0x4d8fd2,_0x60d3('0x35')));}else{_0x3bef95=path[_0x60d3('0x32')](_0x575dc6,util[_0x60d3('0x17')](_0x60d3('0x36'),_0x100d80,'pdf'));}_0x2121e4[_0x60d3('0x14')](writePDFDocument(_0x3a7b3f,_0x3bef95));}return Promise[_0x60d3('0x37')](_0x2121e4);})[_0x60d3('0x26')](function(){if(_0x36fda9){return new Promise(function(_0x15fc7c){zipdir(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),{'saveTo':path[_0x60d3('0x32')](_0x575dc6,util[_0x60d3('0x17')](_0x60d3('0x36'),_0x100d80,_0x60d3('0x38')))},function(){rimraf(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),function(){});_0x15fc7c('zip\x20finished');});});}})[_0x60d3('0x26')](function(){if(!_0x36fda9)return;rimraf(path[_0x60d3('0x32')](_0x575dc6,_0x100d80),function(){});})[_0x60d3('0x26')](function(){logger['info'](util[_0x60d3('0x17')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x60d3('0x39')));return analyticExtractedReport('Completed',_0x36fda9?util[_0x60d3('0x17')]('%s.%s',_0x100d80,_0x36fda9?_0x60d3('0x38'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x60d3('0x3a')](util[_0x60d3('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x60d3('0x39')));return db[_0x60d3('0xc')][_0x60d3('0x3b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x60d3('0x26')](function(_0x5dbd8d){EXTRACTED_REPORT=_0x5dbd8d;return dbH[_0x60d3('0x2a')][_0x60d3('0x2c')](util[_0x60d3('0x17')](_0x60d3('0x3c'),QUERY),{'type':dbH[_0x60d3('0x2a')][_0x60d3('0x2e')][_0x60d3('0x2b')]});})[_0x60d3('0x26')](extractReport)[_0x60d3('0x3d')](function(_0x3a2575){logger[_0x60d3('0x3a')](util['format'](_0x60d3('0x3e'),EXTRACTED_REPORT_ID,_0x60d3('0x39')),util[_0x60d3('0x3f')](_0x3a2575,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x60d3('0x40'));})[_0x60d3('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x28ffdc=new PdfPrinter({'Arial':{'normal':__dirname+_0x60d3('0x42'),'bold':__dirname+_0x60d3('0x43'),'italics':__dirname+_0x60d3('0x44'),'bolditalics':__dirname+_0x60d3('0x45')}});return _0x28ffdc;}function getPDFDocDefinitionFromHTML(_0x27a694,_0x59175d){var _0x4093e4=util['format'](_0x60d3('0x46'),_0x59175d[_0x60d3('0x47')],_0x59175d[_0x60d3('0x48')]);var _0x4f0165=moment()[_0x60d3('0x17')](_0x60d3('0x49'))[_0x60d3('0x4a')]();var _0xc41171=htmlToPdfmake(_0x27a694,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc41171],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x60d3('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x60d3('0x4b')}},'header':function(){return[{'text':_0x60d3('0x4c'),'style':_0x60d3('0x1b')}];},'footer':function(_0xb06bc6,_0x4ae17f){return[{'text':util['format'](_0x60d3('0x4d'),_0x4093e4,_0xb06bc6,_0x4ae17f,_0x4f0165),'style':'footer'}];}};}function writePDFDocument(_0x44155c,_0x9761d9){return new Promise(function(_0x329a84,_0x85a19f){var _0x2226d5=_0x44155c[_0x60d3('0x4e')](fs[_0x60d3('0x4f')](_0x9761d9));_0x2226d5['on'](_0x60d3('0x50'),function(){_0x329a84(_0x60d3('0x50'));});_0x2226d5['on'](_0x60d3('0x51'),function(_0x4c06a8){_0x85a19f(_0x4c06a8);});_0x44155c[_0x60d3('0x52')]();});}exports['createPdfFromHTML']=function(_0x1564ff,_0x138a16){var _0x560283=getPDFPrinter();var _0x44ad1d=getPDFDocDefinitionFromHTML(_0x1564ff,_0x138a16);var _0xe3780c=_0x560283[_0x60d3('0x53')](_0x44ad1d);return writePDFDocument(_0xe3780c,_0x138a16['path'])['catch'](function(_0x2fa05e){throw _0x2fa05e;});}; \ No newline at end of file +var _0xad9d=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','tableHeader','map','value','fill','auto','push','body','concat','chunk','forEach','format','startDate','endDate','length','header','pageBreak','toString','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','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'];(function(_0x29ca76,_0x113fc5){var _0xc58453=function(_0x98c6b7){while(--_0x98c6b7){_0x29ca76['push'](_0x29ca76['shift']());}};_0xc58453(++_0x113fc5);}(_0xad9d,0x116));var _0xdad9=function(_0x860102,_0x159948){_0x860102=_0x860102-0x0;var _0x4a223a=_0xad9d[_0x860102];return _0x4a223a;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xdad9('0x0'));var path=require(_0xdad9('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xdad9('0x2'));var PdfPrinter=require(_0xdad9('0x3'));var zipdir=require(_0xdad9('0x4'));var rimraf=require(_0xdad9('0x5'));var JSDOM=require(_0xdad9('0x6'))[_0xdad9('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xdad9('0x8'));var db=require(_0xdad9('0x9'))['db'];var dbH=require(_0xdad9('0x9'))[_0xdad9('0xa')];var logger=require(_0xdad9('0xb'))(_0xdad9('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdad9('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xdad9('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe539db,_0xed2d99){var _0x4f9586={'status':_0xe539db};var _0x3bd962={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xed2d99){_0x4f9586['savename']=_0xed2d99;}return db['AnalyticExtractedReport'][_0xdad9('0xf')](_0x4f9586,_0x3bd962);}function getHeaders(_0x34e3d8){return _['map'](_0x34e3d8,function(_0xd676d9){return{'text':_0xd676d9,'style':_0xdad9('0x10')};});}function getRows(_0x278db0,_0xf64bb1){return _[_0xdad9('0x11')](_0xf64bb1,function(_0x3c448e){return _(_0x3c448e)['pick'](_0x278db0)[_0xdad9('0x11')](function(_0x34471b){return _0x34471b?_['toString'](_0x34471b):'';})[_0xdad9('0x12')]();});}function createTable(_0x1413cc,_0x5356a4){var _0x10fb6a={'widths':_[_0xdad9('0x13')](Array(_0x1413cc['length']),0x91),'heights':function(_0x47f376){return _0x47f376===0x0?_0xdad9('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4bf9ad=getHeaders(_0x1413cc);_0x10fb6a['body'][_0xdad9('0x15')](_0x4bf9ad);var _0x58c395=getRows(_0x1413cc,_0x5356a4);_0x10fb6a[_0xdad9('0x16')]=_0x10fb6a[_0xdad9('0x16')][_0xdad9('0x17')](_0x58c395);return _0x10fb6a;}function createTables(_0x2ea209){var _0x4510c6=[];var _0x3831f5=_[_0xdad9('0x18')](Object['keys'](_0x2ea209[0x0]),0x5);_0x3831f5[_0xdad9('0x19')](function(_0x3a2831){_0x4510c6['push'](createTable(_0x3a2831,_0x2ea209));});return _0x4510c6;}function getPDFDocDefinition(_0x5023c0){var _0x1a70e6=util[_0xdad9('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xdad9('0x1b')])[_0xdad9('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xdad9('0x1c')])[_0xdad9('0x1a')](FORMAT));var _0x3dcc26=[];for(var _0x58b247=0x0;_0x58b247<_0x5023c0[_0xdad9('0x1d')];_0x58b247++){var _0x17616a=[];if(_0x58b247===0x0){_0x17616a[_0xdad9('0x15')]({'text':_0x1a70e6,'style':_0xdad9('0x1e')});}var _0x1958ed={'table':_0x5023c0[_0x58b247]};if(_0x58b247>0x0){_0x1958ed[_0xdad9('0x1f')]='before';_0x1958ed['margin']=[0x0,0x46,0x0,0x0];}_0x17616a['push'](_0x1958ed);_0x3dcc26[_0xdad9('0x15')](_0x17616a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3dcc26,'footer':function(_0x5560fc,_0xa03636){return{'text':_0x5560fc[_0xdad9('0x20')]()+_0xdad9('0x21')+_0xa03636,'style':_0xdad9('0x22')};},'defaultStyle':{'font':_0xdad9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xdad9('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5cd0cc){var _0x5ec2ed=0x1388;var _0x13346f;if(!_0x5cd0cc[0x0][_0xdad9('0x25')]){return analyticExtractedReport(_0xdad9('0x26'));}return db[_0xdad9('0x27')][_0xdad9('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdad9('0x29'),'splitSizePdf']})['then'](function(_0x5c426a){if(_0x5c426a){_0x13346f=_0x5c426a;_0x5ec2ed=_0x13346f[_0xdad9('0x2a')]||0x3e8;}})[_0xdad9('0x2b')](function(){var _0x1f22a0=[];var _0x7a4e35=0x0;if(_0x13346f[_0xdad9('0x29')]){if(_0x5cd0cc&&_0x5cd0cc[_0xdad9('0x1d')]){var _0x25e411=_[_0xdad9('0x2c')](_0x5cd0cc[0x0][_0xdad9('0x25')]/_0x5ec2ed);var _0x1b35b7=Number[_0xdad9('0x2d')](_0x5cd0cc[0x0]['num']/_0x5ec2ed)?_0x5cd0cc[0x0][_0xdad9('0x25')]%_0x5ec2ed:0x0;_0x25e411[_0xdad9('0x19')](function(_0x4820db){if(_0x4820db>0x0){_0x7a4e35+=_0x5ec2ed;}_0x1f22a0[_0xdad9('0x15')](dbH[_0xdad9('0x2e')][_0xdad9('0x2f')](util['format'](_0xdad9('0x30'),QUERY,_0x5ec2ed,_0x7a4e35),{'type':dbH[_0xdad9('0x2e')]['QueryTypes'][_0xdad9('0x31')]}));});if(_0x1b35b7>0x0){_0x7a4e35+=_0x5ec2ed;_0x1f22a0[_0xdad9('0x15')](dbH[_0xdad9('0x2e')][_0xdad9('0x2f')](util[_0xdad9('0x1a')](_0xdad9('0x30'),QUERY,_0x1b35b7,_0x7a4e35),{'type':dbH[_0xdad9('0x2e')][_0xdad9('0x32')][_0xdad9('0x31')]}));}}}else{_0x1f22a0[_0xdad9('0x15')](dbH[_0xdad9('0x2e')][_0xdad9('0x2f')](QUERY,{'type':dbH[_0xdad9('0x2e')]['QueryTypes'][_0xdad9('0x31')]}));}var _0x50217b=path[_0xdad9('0x33')](PATH);var _0xf47e47=path['basename'](PATH,'.pdf');var _0x2b0407=_0x13346f['split']&&_0x1f22a0[_0xdad9('0x1d')]>0x1;var _0x3b72be=[];if(!fs[_0xdad9('0x34')](path[_0xdad9('0x35')](_0x50217b,_0xf47e47))&&_0x2b0407){fs[_0xdad9('0x36')](path[_0xdad9('0x35')](_0x50217b,_0xf47e47));}return BPromise[_0xdad9('0x37')](_0x1f22a0,function(_0x16ae05){_0x3b72be[_0xdad9('0x15')](_0x16ae05);})[_0xdad9('0x2b')](function(){var _0x363646=[];for(var _0x3b4777=0x0;_0x3b4777<_0x3b72be['length'];_0x3b4777+=0x1){var _0x28fe4c=_0x3b72be[_0x3b4777];var _0x2ae1db=createTables(_[_0xdad9('0x38')](_0x28fe4c));var _0x314149;var _0x3338f8=getPDFDocDefinition(_0x2ae1db);var _0x538e85=getPDFPrinter();var _0xb31a32=_0x538e85['createPdfKitDocument'](_0x3338f8);if(_0x2b0407){_0x314149=path[_0xdad9('0x35')](_0x50217b,_0xf47e47,util[_0xdad9('0x1a')](_0xdad9('0x39'),_0xf47e47,_0x3b4777,_0xdad9('0x3a')));}else{_0x314149=path[_0xdad9('0x35')](_0x50217b,util['format']('%s.%s',_0xf47e47,_0xdad9('0x3a')));}_0x363646['push'](writePDFDocument(_0xb31a32,_0x314149));}return Promise[_0xdad9('0x3b')](_0x363646);})[_0xdad9('0x2b')](function(){if(_0x2b0407){return new Promise(function(_0x5075a1){zipdir(path[_0xdad9('0x35')](_0x50217b,_0xf47e47),{'saveTo':path[_0xdad9('0x35')](_0x50217b,util[_0xdad9('0x1a')](_0xdad9('0x3c'),_0xf47e47,_0xdad9('0x3d')))},function(){rimraf(path[_0xdad9('0x35')](_0x50217b,_0xf47e47),function(){});_0x5075a1('zip\x20finished');});});}})['then'](function(){if(!_0x2b0407)return;rimraf(path[_0xdad9('0x35')](_0x50217b,_0xf47e47),function(){});})[_0xdad9('0x2b')](function(){logger[_0xdad9('0x3e')](util['format'](_0xdad9('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xdad9('0x40'),_0x2b0407?util[_0xdad9('0x1a')]('%s.%s',_0xf47e47,_0x2b0407?_0xdad9('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdad9('0x3e')](util[_0xdad9('0x1a')](_0xdad9('0x41'),EXTRACTED_REPORT_ID,_0xdad9('0x42')));return db[_0xdad9('0x43')][_0xdad9('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdad9('0x2b')](function(_0x43b9b0){EXTRACTED_REPORT=_0x43b9b0;return dbH['sequelize']['query'](util[_0xdad9('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdad9('0x2e')][_0xdad9('0x32')][_0xdad9('0x31')]});})[_0xdad9('0x2b')](extractReport)[_0xdad9('0x45')](function(_0x433d8e){logger[_0xdad9('0x3e')](util[_0xdad9('0x1a')](_0xdad9('0x46'),EXTRACTED_REPORT_ID,_0xdad9('0x42')),util[_0xdad9('0x47')](_0x433d8e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xdad9('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4f7406=new PdfPrinter({'Arial':{'normal':__dirname+_0xdad9('0x49'),'bold':__dirname+_0xdad9('0x4a'),'italics':__dirname+_0xdad9('0x4b'),'bolditalics':__dirname+_0xdad9('0x4c')}});return _0x4f7406;}function getPDFDocDefinitionFromHTML(_0x4a1fb2,_0x2df1a0){var _0x3b0127=util[_0xdad9('0x1a')](_0xdad9('0x4d'),_0x2df1a0[_0xdad9('0x4e')],_0x2df1a0[_0xdad9('0x4f')]);var _0x5b5095=moment()[_0xdad9('0x1a')](_0xdad9('0x50'))[_0xdad9('0x20')]();var _0x46a12e=htmlToPdfmake(_0x4a1fb2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46a12e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdad9('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xdad9('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xdad9('0x51')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xdad9('0x1e')}];},'footer':function(_0x3d0574,_0x5cacdb){return[{'text':util[_0xdad9('0x1a')](_0xdad9('0x52'),_0x3b0127,_0x3d0574,_0x5cacdb,_0x5b5095),'style':_0xdad9('0x22')}];}};}function writePDFDocument(_0x2113a9,_0x328b0c){return new Promise(function(_0x46f25e,_0xa7971){var _0x33a6cd=_0x2113a9[_0xdad9('0x53')](fs[_0xdad9('0x54')](_0x328b0c));_0x33a6cd['on'](_0xdad9('0x55'),function(){_0x46f25e(_0xdad9('0x55'));});_0x33a6cd['on'](_0xdad9('0x56'),function(_0x5c549c){_0xa7971(_0x5c549c);});_0x2113a9[_0xdad9('0x57')]();});}exports[_0xdad9('0x58')]=function(_0x4cb757,_0x328ea8){var _0x24efa1=getPDFPrinter();var _0x4e62c1=getPDFDocDefinitionFromHTML(_0x4cb757,_0x328ea8);var _0x439fa1=_0x24efa1[_0xdad9('0x59')](_0x4e62c1);return writePDFDocument(_0x439fa1,_0x328ea8[_0xdad9('0x1')])[_0xdad9('0x45')](function(_0x20307e){throw _0x20307e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 460860f..a7c57a3 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 _0xce6b=['range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty'];(function(_0x25fa80,_0x84a1b0){var _0x4e59b9=function(_0x58dc60){while(--_0x58dc60){_0x25fa80['push'](_0x25fa80['shift']());}};_0x4e59b9(++_0x84a1b0);}(_0xce6b,0x1d9));var _0xbce6=function(_0x505e28,_0x29391c){_0x505e28=_0x505e28-0x0;var _0x23aaa5=_0xce6b[_0x505e28];return _0x23aaa5;};'use strict';var util=require(_0xbce6('0x0'));var path=require('path');var _=require(_0xbce6('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xbce6('0x2'));var rimraf=require(_0xbce6('0x3'));var db=require(_0xbce6('0x4'))['db'];var dbH=require(_0xbce6('0x4'))[_0xbce6('0x5')];var logger=require('../../config/logger')(_0xbce6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbce6('0x7')][0x2]);var QUERY=process[_0xbce6('0x7')][0x3];var PATH=process[_0xbce6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d37f9,_0xa45808){var _0x157f2d={'status':_0x5d37f9};var _0x482b3c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa45808){_0x157f2d[_0xbce6('0x8')]=_0xa45808;}return db[_0xbce6('0x9')][_0xbce6('0xa')](_0x157f2d,_0x482b3c);}function main(){var _0x5f2b7b=0x1388;var _0x5a826b;logger[_0xbce6('0xb')](util[_0xbce6('0xc')](_0xbce6('0xd'),EXTRACTED_REPORT_ID,_0xbce6('0xe')));return db[_0xbce6('0xf')][_0xbce6('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbce6('0x11'),_0xbce6('0x12')]})['then'](function(_0x1f1e94){if(_0x1f1e94){_0x5a826b=_0x1f1e94;_0x5f2b7b=_0x5a826b['splitSizeXlsx']||0x1388;}})[_0xbce6('0x13')](function(){return dbH[_0xbce6('0x14')][_0xbce6('0x15')](util['format'](_0xbce6('0x16'),QUERY),{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]});})[_0xbce6('0x13')](function(_0x4e2d03){if(!_0x4e2d03[0x0][_0xbce6('0x19')]){return analyticExtractedReport(_0xbce6('0x1a'));}var _0x372150=[];var _0x1e276f=0x0;if(_0x5a826b['split']){if(_0x4e2d03&&_0x4e2d03['length']){var _0x485fd0=_[_0xbce6('0x1b')](_0x4e2d03[0x0]['num']/_0x5f2b7b);var _0x383595=Number[_0xbce6('0x1c')](_0x4e2d03[0x0]['num']/_0x5f2b7b)?_0x4e2d03[0x0][_0xbce6('0x19')]%_0x5f2b7b:0x0;_0x485fd0['forEach'](function(_0x1bc7f2){if(_0x1bc7f2>0x0){_0x1e276f+=_0x5f2b7b;}_0x372150['push'](dbH[_0xbce6('0x14')][_0xbce6('0x15')](util[_0xbce6('0xc')](_0xbce6('0x1d'),QUERY,_0x5f2b7b,_0x1e276f),{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]}));});if(_0x383595>0x0){_0x1e276f+=_0x5f2b7b;_0x372150[_0xbce6('0x1e')](dbH[_0xbce6('0x14')]['query'](util[_0xbce6('0xc')](_0xbce6('0x1d'),QUERY,_0x383595,_0x1e276f),{'type':dbH[_0xbce6('0x14')][_0xbce6('0x17')]['SELECT']}));}}}else{_0x372150[_0xbce6('0x1e')](dbH[_0xbce6('0x14')][_0xbce6('0x15')](QUERY,{'type':dbH['sequelize'][_0xbce6('0x17')][_0xbce6('0x18')]}));}var _0x4c7c87=path[_0xbce6('0x1f')](PATH);var _0x3eeeac=path['basename'](PATH,'.xlsx');var _0x200411=_0x5a826b[_0xbce6('0x11')]&&_0x372150[_0xbce6('0x20')]>0x1;var _0xc56a7=[];if(!fs[_0xbce6('0x21')](path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac))&&_0x200411){fs[_0xbce6('0x23')](path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac));}return BPromise['each'](_0x372150,function(_0x242a25){_0xc56a7[_0xbce6('0x1e')](_0x242a25);})[_0xbce6('0x13')](function(){for(var _0x566b45=0x0;_0x566b45<_0xc56a7[_0xbce6('0x20')];_0x566b45+=0x1){var _0x49d6df;var _0x5a1173=_0xc56a7[_0x566b45];if(_0x200411){_0x49d6df=path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac,util[_0xbce6('0xc')](_0xbce6('0x24'),_0x3eeeac,_0x566b45,_0xbce6('0x25')));}else{_0x49d6df=path[_0xbce6('0x22')](_0x4c7c87,util[_0xbce6('0xc')]('%s.%s',_0x3eeeac,_0xbce6('0x25')));}fs[_0xbce6('0x26')](_0x49d6df,json2xls(_0x5a1173),_0xbce6('0x27'));}})['then'](function(){if(_0x200411){return new Promise(function(_0x1e7bf1){zipdir(path['join'](_0x4c7c87,_0x3eeeac),{'saveTo':path[_0xbce6('0x22')](_0x4c7c87,util[_0xbce6('0xc')](_0xbce6('0x28'),_0x3eeeac,_0xbce6('0x29')))},function(_0x407454,_0x484d22){rimraf(path[_0xbce6('0x22')](_0x4c7c87,_0x3eeeac),function(){});_0x1e7bf1(_0xbce6('0x2a'));});});}})[_0xbce6('0x13')](function(){logger['info'](util[_0xbce6('0xc')](_0xbce6('0x2b'),EXTRACTED_REPORT_ID,_0xbce6('0xe')));return analyticExtractedReport(_0xbce6('0x2c'),_0x200411?util[_0xbce6('0xc')](_0xbce6('0x28'),_0x3eeeac,_0x200411?_0xbce6('0x29'):_0xbce6('0x25')):null);});})[_0xbce6('0x2d')](function(_0x11dcf4){logger['info'](util[_0xbce6('0xc')](_0xbce6('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x11dcf4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbce6('0x2f'));})[_0xbce6('0x30')](function(){process[_0xbce6('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa503=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','isInteger','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','XLSX','Completed','catch'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xa503,0x143));var _0x3a50=function(_0x45ccae,_0x1864c6){_0x45ccae=_0x45ccae-0x0;var _0x315286=_0xa503[_0x45ccae];return _0x315286;};'use strict';var util=require(_0x3a50('0x0'));var path=require(_0x3a50('0x1'));var _=require(_0x3a50('0x2'));var fs=require('fs');var json2xls=require(_0x3a50('0x3'));var BPromise=require(_0x3a50('0x4'));var zipdir=require(_0x3a50('0x5'));var rimraf=require(_0x3a50('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x3a50('0x7')];var logger=require(_0x3a50('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3a50('0x9')][0x3];var PATH=process[_0x3a50('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44bd93,_0x307280){var _0x3ffb2f={'status':_0x44bd93};var _0x1cd114={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x307280){_0x3ffb2f['savename']=_0x307280;}return db[_0x3a50('0xa')][_0x3a50('0xb')](_0x3ffb2f,_0x1cd114);}function main(){var _0x43491b=0x1388;var _0xae7b4b;logger[_0x3a50('0xc')](util[_0x3a50('0xd')](_0x3a50('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x3a50('0xf')][_0x3a50('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3a50('0x11'),'splitSizeXlsx']})[_0x3a50('0x12')](function(_0x4e9a5a){if(_0x4e9a5a){_0xae7b4b=_0x4e9a5a;_0x43491b=_0xae7b4b[_0x3a50('0x13')]||0x1388;}})[_0x3a50('0x12')](function(){return dbH[_0x3a50('0x14')][_0x3a50('0x15')](util['format'](_0x3a50('0x16'),QUERY),{'type':dbH['sequelize'][_0x3a50('0x17')][_0x3a50('0x18')]});})[_0x3a50('0x12')](function(_0x260374){if(!_0x260374[0x0]['num']){return analyticExtractedReport(_0x3a50('0x19'));}var _0x4b8971=[];var _0x410081=0x0;if(_0xae7b4b[_0x3a50('0x11')]){if(_0x260374&&_0x260374['length']){var _0x549b70=_[_0x3a50('0x1a')](_0x260374[0x0]['num']/_0x43491b);var _0x176e85=Number[_0x3a50('0x1b')](_0x260374[0x0][_0x3a50('0x1c')]/_0x43491b)?_0x260374[0x0][_0x3a50('0x1c')]%_0x43491b:0x0;_0x549b70['forEach'](function(_0x4012d8){if(_0x4012d8>0x0){_0x410081+=_0x43491b;}_0x4b8971['push'](dbH[_0x3a50('0x14')][_0x3a50('0x15')](util[_0x3a50('0xd')](_0x3a50('0x1d'),QUERY,_0x43491b,_0x410081),{'type':dbH[_0x3a50('0x14')][_0x3a50('0x17')][_0x3a50('0x18')]}));});if(_0x176e85>0x0){_0x410081+=_0x43491b;_0x4b8971[_0x3a50('0x1e')](dbH[_0x3a50('0x14')][_0x3a50('0x15')](util[_0x3a50('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x176e85,_0x410081),{'type':dbH[_0x3a50('0x14')][_0x3a50('0x17')]['SELECT']}));}}}else{_0x4b8971[_0x3a50('0x1e')](dbH[_0x3a50('0x14')]['query'](QUERY,{'type':dbH[_0x3a50('0x14')][_0x3a50('0x17')][_0x3a50('0x18')]}));}var _0xbd8b18=path[_0x3a50('0x1f')](PATH);var _0xc4adc7=path[_0x3a50('0x20')](PATH,_0x3a50('0x21'));var _0x25c5ef=_0xae7b4b[_0x3a50('0x11')]&&_0x4b8971[_0x3a50('0x22')]>0x1;var _0x3a7597=[];if(!fs[_0x3a50('0x23')](path[_0x3a50('0x24')](_0xbd8b18,_0xc4adc7))&&_0x25c5ef){fs[_0x3a50('0x25')](path[_0x3a50('0x24')](_0xbd8b18,_0xc4adc7));}return BPromise[_0x3a50('0x26')](_0x4b8971,function(_0x253b13){_0x3a7597[_0x3a50('0x1e')](_0x253b13);})['then'](function(){for(var _0x5d2dd6=0x0;_0x5d2dd6<_0x3a7597[_0x3a50('0x22')];_0x5d2dd6+=0x1){var _0x18336e;var _0x1a7ceb=_0x3a7597[_0x5d2dd6];if(_0x25c5ef){_0x18336e=path['join'](_0xbd8b18,_0xc4adc7,util['format'](_0x3a50('0x27'),_0xc4adc7,_0x5d2dd6,_0x3a50('0x28')));}else{_0x18336e=path[_0x3a50('0x24')](_0xbd8b18,util['format'](_0x3a50('0x29'),_0xc4adc7,_0x3a50('0x28')));}fs['writeFileSync'](_0x18336e,json2xls(_0x1a7ceb),_0x3a50('0x2a'));}})[_0x3a50('0x12')](function(){if(_0x25c5ef){return new Promise(function(_0x5a96aa){zipdir(path[_0x3a50('0x24')](_0xbd8b18,_0xc4adc7),{'saveTo':path[_0x3a50('0x24')](_0xbd8b18,util['format'](_0x3a50('0x29'),_0xc4adc7,_0x3a50('0x2b')))},function(_0x54f03c,_0x5c2055){rimraf(path[_0x3a50('0x24')](_0xbd8b18,_0xc4adc7),function(){});_0x5a96aa(_0x3a50('0x2c'));});});}})[_0x3a50('0x12')](function(){logger[_0x3a50('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3a50('0x2d')));return analyticExtractedReport(_0x3a50('0x2e'),_0x25c5ef?util[_0x3a50('0xd')](_0x3a50('0x29'),_0xc4adc7,_0x25c5ef?'zip':_0x3a50('0x28')):null);});})[_0x3a50('0x2f')](function(_0x1f1a35){logger[_0x3a50('0xc')](util[_0x3a50('0xd')](_0x3a50('0x30'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x3a50('0x31')](_0x1f1a35,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3a50('0x32'));})[_0x3a50('0x33')](function(){process[_0x3a50('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3d62571..6e7e1bd 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 _0x26b6=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','bulkCreate','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom'];(function(_0x26eae1,_0x210fc9){var _0x459286=function(_0x47220c){while(--_0x47220c){_0x26eae1['push'](_0x26eae1['shift']());}};_0x459286(++_0x210fc9);}(_0x26b6,0x128));var _0x626b=function(_0x39ac05,_0x41ade5){_0x39ac05=_0x39ac05-0x0;var _0x3426f8=_0x26b6[_0x39ac05];return _0x3426f8;};'use strict';var _=require(_0x626b('0x0'));var util=require(_0x626b('0x1'));function rewrite(_0x1aa958,_0x273ed5){var _0x49512c=this;return _0x1aa958[_0x626b('0x2')][_0x626b('0x3')][_0x626b('0x4')]({'raw':!![]})[_0x626b('0x5')](function(_0x561e56){_0x49512c[_0x626b('0x6')]=_0x561e56;return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')]['findAll']({'where':{'IntervalId':_0x273ed5[_0x626b('0x8')]},'raw':!![]});})[_0x626b('0x5')](function(_0xd4e0b3){return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')][_0x626b('0x4')]({'where':{'exten':{'$in':_[_0x626b('0x9')](_[_0x626b('0xa')](_0xd4e0b3,_0x626b('0xb')))}},'order':[{'raw':_0x626b('0xc')}],'raw':!![]});})[_0x626b('0x5')](function(_0x2f4438){var _0x25dbd0=_[_0x626b('0xd')](_0x2f4438,{'priority':'1'});var _0x38f294=_[_0x626b('0xd')](_0x2f4438,{'isApp':0x1});var _0x39d11d=_['groupBy'](_0x38f294,_0x626b('0xb'));var _0x65752f=['queue',_0x626b('0xe')];var _0x41467e=[];var _0x32533c=[];for(var _0x151214 in _0x39d11d){if(_0x39d11d[_0x626b('0xf')](_0x151214)){_0x49512c[_0x626b('0x10')]=0x2;_0x49512c[_0x626b('0x11')]=[];_0x49512c[_0x626b('0x12')]=_[_0x626b('0x13')](_0x25dbd0,{'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':util[_0x626b('0x17')]('CDR(type)=%s',_0x39d11d[_0x151214][0x0][_0x626b('0x15')]),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x39d11d[_0x151214][0x0][_0x626b('0x15')]===_0x626b('0x1a')){_0x49512c['extensions'][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':'CDR(routeid)='+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}else if(_0x39d11d[_0x151214][0x0]['type']===_0x626b('0x1b')){if(_0x49512c[_0x626b('0x12')]){_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x1c')+(_0x49512c[_0x626b('0x12')]['cutdigits']?_0x626b('0x1d')+_0x49512c[_0x626b('0x12')]['cutdigits']+'}':_0x626b('0x1e')),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x1f')+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0]['VoiceExtensionId']});var _0x1445e0=_0x49512c[_0x626b('0x10')]++;_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':_0x626b('0x21')+(_0x1445e0+0x2)+_0x626b('0x22')+(_0x1445e0+0x1)+')','context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x1445e0,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x49512c['extension']){_0x49512c['extensions'][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x49512c[_0x626b('0x12')][_0x626b('0x23')]?_0x626b('0x24')+_0x49512c['extension'][_0x626b('0x23')]+'}':_0x626b('0x25'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x26')+_0x39d11d[_0x151214][0x0][_0x626b('0x19')],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});if(_0x49512c[_0x626b('0x12')]&&_0x49512c['extension']['hasOwnProperty']('recordingFormat')&&_0x49512c[_0x626b('0x12')][_0x626b('0x27')]!==_0x626b('0x28')){_0x49512c[_0x626b('0x11')]['push']({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x29'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c['priority']++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')]['push']({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x49512c[_0x626b('0x12')][_0x626b('0x27')]||_0x626b('0x2a'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x2b'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c['priority']++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x2c'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0]['exten'],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0]['type'],'app':_0x626b('0x16'),'appdata':_0x626b('0x2d'),'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'exten':_0x39d11d[_0x151214][0x0][_0x626b('0xb')],'priority':_0x49512c[_0x626b('0x10')]++,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});for(var _0x85d0f9=0x0,_0x1669e5=0x0;_0x85d0f9<_0x39d11d[_0x151214]['length'];_0x85d0f9+=0x1,_0x1669e5=0x0){var _0x2412e4=_0x39d11d[_0x151214][_0x85d0f9];if(_0x2412e4['type']){_0x2412e4[_0x626b('0x15')]=_0x2412e4[_0x626b('0x15')]['toLowerCase']();}var _0xf64f38=[];var _0x2840c2=[];delete _0x2412e4['id'];delete _0x2412e4[_0x626b('0x2e')];delete _0x2412e4[_0x626b('0x2f')];var _0x1f3795=_0x2412e4[_0x626b('0x30')]!==_0x626b('0x31')?[_0x2412e4['interval']]:_0x2412e4[_0x626b('0x8')]?_[_0x626b('0xa')](_[_0x626b('0xd')](_0x49512c[_0x626b('0x6')],{'IntervalId':_0x2412e4['IntervalId']}),_0x626b('0x30')):[];if(_0x2412e4[_0x626b('0xf')](_0x626b('0x32'))){if(_0x2412e4[_0x626b('0x32')]&&_0x2412e4[_0x626b('0x32')]!=='--'){_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x2412e4[_0x626b('0x32')],'context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c['priority']+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}if(_0x2412e4[_0x626b('0x15')]===_0x626b('0x1b')&&_0x2412e4['hasOwnProperty'](_0x626b('0x34'))){if(_0x2412e4[_0x626b('0x34')]){_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2412e4[_0x626b('0x34')]+')','context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}else{_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x20'),'appdata':_0x626b('0x35'),'context':_0x2412e4['context'],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}if(_0x2412e4['hasOwnProperty'](_0x626b('0x36'))){if(_0x65752f[_0x626b('0x37')](_0x2412e4[_0x626b('0x38')]['toLowerCase']())>=0x0&&_0x2412e4[_0x626b('0x39')]!==_0x626b('0x3a')){if(_0x2412e4[_0x626b('0x36')]){_0xf64f38['push']({'type':_0x2412e4[_0x626b('0x15')],'app':'ExecIf','appdata':_0x626b('0x3b'),'context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4['exten'],'priority':_0x1f3795[_0x626b('0x33')]+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x16'),'appdata':_0x626b('0x3c'),'context':_0x2412e4['context'],'exten':_0x2412e4['exten'],'priority':_0x1f3795['length']+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4['VoiceExtensionId']});}else{_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4['type'],'app':_0x626b('0x20'),'appdata':_0x626b('0x3d'),'context':_0x2412e4['context'],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795['length']+_0x49512c[_0x626b('0x10')]+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});_0xf64f38[_0x626b('0x14')]({'type':_0x2412e4[_0x626b('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2412e4[_0x626b('0x18')],'exten':_0x2412e4[_0x626b('0xb')],'priority':_0x1f3795['length']+_0x49512c['priority']+_0x1669e5++,'VoiceExtensionId':_0x2412e4[_0x626b('0x19')]});}}}for(var _0x23512b=0x0;_0x23512b<_0x1f3795[_0x626b('0x33')];_0x23512b+=0x1){var _0x25bc62=_0x49512c[_0x626b('0x10')]+_0x1f3795[_0x626b('0x33')];var _0x5c1d08=_0x23512b===_0x1f3795['length']-0x1?_0x49512c[_0x626b('0x10')]+_0xf64f38[_0x626b('0x33')]+_0x2840c2[_0x626b('0x33')]+0x2:_0x49512c[_0x626b('0x10')]+_0x23512b+0x1;_0xf64f38[_0x626b('0x3e')](_0x23512b,0x0,{'type':_0x2412e4[_0x626b('0x15')],'app':_0x626b('0x3f'),'appdata':_0x1f3795[_0x23512b]+'?'+_0x2412e4[_0x626b('0x18')]+',${EXTEN},'+_0x25bc62+':'+_0x2412e4[_0x626b('0x18')]+_0x626b('0x40')+_0x5c1d08,'exten':_0x2412e4[_0x626b('0xb')],'context':_0x2412e4[_0x626b('0x18')],'priority':_0x49512c[_0x626b('0x10')]+_0x23512b,'VoiceExtensionId':_0x39d11d[_0x151214][0x0][_0x626b('0x19')]});}_0x2412e4[_0x626b('0x10')]=_0xf64f38[_0x626b('0x33')]?_['last'](_0xf64f38)[_0x626b('0x10')]+0x1:_0x49512c[_0x626b('0x10')];_0x49512c[_0x626b('0x10')]=(_0x2840c2['length']?_[_0x626b('0x41')](_0x2840c2)[_0x626b('0x10')]:_0x2412e4['priority'])+0x1;_0x49512c[_0x626b('0x11')]=_['concat'](_0x49512c[_0x626b('0x11')],_0xf64f38,[_0x2412e4],_0x2840c2);}_0x49512c[_0x626b('0x11')][_0x626b('0x14')]({'type':_0x39d11d[_0x151214][0x0][_0x626b('0x15')],'app':_0x626b('0x42'),'exten':_0x39d11d[_0x151214][0x0]['exten'],'context':_0x39d11d[_0x151214][0x0][_0x626b('0x18')],'priority':_0x49512c['priority'],'VoiceExtensionId':_0x39d11d[_0x151214][0x0]['VoiceExtensionId']});_0x41467e[_0x626b('0x14')](_0x39d11d[_0x151214][0x0][_0x626b('0x19')]);_0x32533c=_['concat'](_0x32533c,_0x49512c[_0x626b('0x11')]);}}return _0x1aa958[_0x626b('0x43')](function(_0x2bc10f){return _0x1aa958[_0x626b('0x2')][_0x626b('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x41467e}},'transaction':_0x2bc10f})[_0x626b('0x5')](function(_0x5ec5e7){return _0x1aa958[_0x626b('0x2')]['VoiceExtension'][_0x626b('0x44')](_['sortBy'](_0x32533c,'priority'),{'transaction':_0x2bc10f});});});})[_0x626b('0x45')](function(_0x5b46c0){console['error'](_0x5b46c0);});}exports[_0x626b('0x46')]=rewrite; \ No newline at end of file +var _0x07c4=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x07c4,0x9b));var _0x407c=function(_0x22e11d,_0x13199c){_0x22e11d=_0x22e11d-0x0;var _0xb38615=_0x07c4[_0x22e11d];return _0xb38615;};'use strict';var _=require(_0x407c('0x0'));var util=require(_0x407c('0x1'));function rewrite(_0x22c575,_0x3021ff){var _0x5ac3d0=this;return _0x22c575[_0x407c('0x2')][_0x407c('0x3')][_0x407c('0x4')]({'raw':!![]})[_0x407c('0x5')](function(_0x1bd723){_0x5ac3d0[_0x407c('0x6')]=_0x1bd723;return _0x22c575[_0x407c('0x2')][_0x407c('0x7')][_0x407c('0x4')]({'where':{'IntervalId':_0x3021ff[_0x407c('0x8')]},'raw':!![]});})['then'](function(_0x283766){return _0x22c575[_0x407c('0x2')][_0x407c('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x407c('0x9')](_[_0x407c('0xa')](_0x283766,_0x407c('0xb')))}},'order':[{'raw':_0x407c('0xc')}],'raw':!![]});})[_0x407c('0x5')](function(_0x4f62d6){var _0x3237c8=_[_0x407c('0xd')](_0x4f62d6,{'priority':'1'});var _0x1856e6=_[_0x407c('0xd')](_0x4f62d6,{'isApp':0x1});var _0x594ba6=_[_0x407c('0xe')](_0x1856e6,_0x407c('0xb'));var _0xc50d26=[_0x407c('0xf'),_0x407c('0x10')];var _0x119bc9=[];var _0x3a0875=[];for(var _0x5e089f in _0x594ba6){if(_0x594ba6[_0x407c('0x11')](_0x5e089f)){_0x5ac3d0[_0x407c('0x12')]=0x2;_0x5ac3d0['extensions']=[];_0x5ac3d0['extension']=_[_0x407c('0x13')](_0x3237c8,{'exten':_0x594ba6[_0x5e089f][0x0]['exten']});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':util[_0x407c('0x18')](_0x407c('0x19'),_0x594ba6[_0x5e089f][0x0]['type']),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});if(_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')]==='inbound'){_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'CDR(routeid)='+_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId'],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}else if(_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')]===_0x407c('0x1c')){if(_0x5ac3d0['extension']){_0x5ac3d0[_0x407c('0x14')]['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':'Set','appdata':_0x407c('0x1d')+(_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]?_0x407c('0x20')+_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]+'}':_0x407c('0x21')),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0['priority']++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x22')+_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});var _0x21e565=_0x5ac3d0[_0x407c('0x12')]++;_0x5ac3d0['extensions'][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x21e565+0x2)+_0x407c('0x23')+(_0x21e565+0x1)+')','context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x21e565,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});if(_0x5ac3d0[_0x407c('0x1e')]){_0x5ac3d0['extensions']['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x24')+_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId'],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0['priority']++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']});if(_0x5ac3d0[_0x407c('0x1e')]&&_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x11')]('recordingFormat')&&_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x25')]!==_0x407c('0x26')){_0x5ac3d0[_0x407c('0x14')]['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x27'),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5ac3d0['extension']['recordingFormat']||_0x407c('0x28'),'context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x29'),'context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0['extensions']['push']({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x2a'),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});for(var _0xbfef8d=0x0,_0x45156a=0x0;_0xbfef8d<_0x594ba6[_0x5e089f][_0x407c('0x2b')];_0xbfef8d+=0x1,_0x45156a=0x0){var _0x417385=_0x594ba6[_0x5e089f][_0xbfef8d];if(_0x417385[_0x407c('0x16')]){_0x417385[_0x407c('0x16')]=_0x417385['type'][_0x407c('0x2c')]();}var _0x3a66ac=[];var _0x58f562=[];delete _0x417385['id'];delete _0x417385['createdAt'];delete _0x417385['updatedAt'];var _0x18045e=_0x417385[_0x407c('0x2d')]!=='*,*,*,*'?[_0x417385[_0x407c('0x2d')]]:_0x417385[_0x407c('0x8')]?_[_0x407c('0xa')](_['filter'](_0x5ac3d0['intervals'],{'IntervalId':_0x417385['IntervalId']}),_0x407c('0x2d')):[];if(_0x417385[_0x407c('0x11')](_0x407c('0x2e'))){if(_0x417385[_0x407c('0x2e')]&&_0x417385[_0x407c('0x2e')]!=='--'){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x2f')+_0x417385[_0x407c('0x2e')],'context':_0x417385['context'],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}}if(_0x417385[_0x407c('0x16')]===_0x407c('0x1c')&&_0x417385['hasOwnProperty']('callerID')){if(_0x417385['callerID']){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x30'),'appdata':_0x407c('0x31')+_0x417385[_0x407c('0x32')]+')','context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0['priority']+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}else{_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':'ExecIf','appdata':_0x407c('0x33'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e['length']+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}}if(_0x417385[_0x407c('0x11')](_0x407c('0x34'))){if(_0xc50d26[_0x407c('0x35')](_0x417385[_0x407c('0x36')][_0x407c('0x2c')]())>=0x0&&_0x417385['appType']!==_0x407c('0x37')){if(_0x417385[_0x407c('0x34')]){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':'ExecIf','appdata':_0x407c('0x38'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x39'),'context':_0x417385['context'],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}else{_0x3a66ac[_0x407c('0x15')]({'type':_0x417385['type'],'app':_0x407c('0x30'),'appdata':_0x407c('0x3a'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385['VoiceExtensionId']});_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x3b'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385['exten'],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385['VoiceExtensionId']});}}}for(var _0x1b5aac=0x0;_0x1b5aac<_0x18045e[_0x407c('0x2b')];_0x1b5aac+=0x1){var _0x51cacf=_0x5ac3d0[_0x407c('0x12')]+_0x18045e[_0x407c('0x2b')];var _0x167f48=_0x1b5aac===_0x18045e[_0x407c('0x2b')]-0x1?_0x5ac3d0[_0x407c('0x12')]+_0x3a66ac[_0x407c('0x2b')]+_0x58f562[_0x407c('0x2b')]+0x2:_0x5ac3d0[_0x407c('0x12')]+_0x1b5aac+0x1;_0x3a66ac[_0x407c('0x3c')](_0x1b5aac,0x0,{'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x3d'),'appdata':_0x18045e[_0x1b5aac]+'?'+_0x417385['context']+_0x407c('0x3e')+_0x51cacf+':'+_0x417385[_0x407c('0x1a')]+_0x407c('0x3e')+_0x167f48,'exten':_0x417385[_0x407c('0xb')],'context':_0x417385[_0x407c('0x1a')],'priority':_0x5ac3d0[_0x407c('0x12')]+_0x1b5aac,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x417385['priority']=_0x3a66ac[_0x407c('0x2b')]?_[_0x407c('0x3f')](_0x3a66ac)[_0x407c('0x12')]+0x1:_0x5ac3d0[_0x407c('0x12')];_0x5ac3d0[_0x407c('0x12')]=(_0x58f562[_0x407c('0x2b')]?_[_0x407c('0x3f')](_0x58f562)[_0x407c('0x12')]:_0x417385[_0x407c('0x12')])+0x1;_0x5ac3d0['extensions']=_['concat'](_0x5ac3d0[_0x407c('0x14')],_0x3a66ac,[_0x417385],_0x58f562);}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x40'),'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'priority':_0x5ac3d0[_0x407c('0x12')],'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']});_0x119bc9[_0x407c('0x15')](_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']);_0x3a0875=_[_0x407c('0x41')](_0x3a0875,_0x5ac3d0[_0x407c('0x14')]);}}return _0x22c575[_0x407c('0x42')](function(_0x50ebee){return _0x22c575['models'][_0x407c('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x119bc9}},'transaction':_0x50ebee})[_0x407c('0x5')](function(_0x325173){return _0x22c575[_0x407c('0x2')]['VoiceExtension'][_0x407c('0x43')](_[_0x407c('0x44')](_0x3a0875,_0x407c('0x12')),{'transaction':_0x50ebee});});});})[_0x407c('0x45')](function(_0x3df6c6){console['error'](_0x3df6c6);});}exports[_0x407c('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3bb83ed..6699311 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 _0xd01e=['exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','split','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','checkHopper','into','fromQuery','scheduledAt','createdAt','updatedAt','field','NOW()','ContactId','from','cm_contacts','where','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','insert','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','then','get','sequelize','query','VoiceQueueId','all','outbound','Campaign','always','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0xd01e,0x1c1));var _0xed01=function(_0xbf5811,_0x497785){_0xbf5811=_0xbf5811-0x0;var _0x42d92c=_0xd01e[_0xbf5811];return _0x42d92c;};'use strict';var BPromise=require('bluebird');var util=require(_0xed01('0x0'));var _=require(_0xed01('0x1'));var fs=require('fs');var squel=require(_0xed01('0x2'));var Papa=require(_0xed01('0x3'));var Redis=require(_0xed01('0x4'));var db=require(_0xed01('0x5'))['db'];var config=require(_0xed01('0x6'));var logger=require('../../../config/logger')(_0xed01('0x7'));config[_0xed01('0x8')]=_['defaults'](config[_0xed01('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xed01('0x9'))(new Redis(config[_0xed01('0x8')]));require(_0xed01('0xa'))[_0xed01('0xb')](socket);try{if(!process[_0xed01('0xc')][0x2]||process['argv'][0x2]===_0xed01('0xd')||process['argv'][0x2]===_0xed01('0xe')){throw new Error(_0xed01('0xf'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xed01('0xd')||process[_0xed01('0xc')][0x3]==='null'||!process['argv'][0x4]||process[_0xed01('0xc')][0x4]===_0xed01('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xed01('0x10'));}var FIELDS=_[_0xed01('0x11')](process[_0xed01('0xc')][0x3]['split'](','),process[_0xed01('0xc')][0x4]['split'](','));if(!process[_0xed01('0xc')][0x5]||process[_0xed01('0xc')][0x5]==='undefined'||process[_0xed01('0xc')][0x5]===_0xed01('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xed01('0xc')][0x5];var COMPANYID=process[_0xed01('0xc')][0x6]&&process['argv'][0x6]!==_0xed01('0xd')&&process[_0xed01('0xc')][0x6]!=='null'?process[_0xed01('0xc')][0x6]:null;var DUPLICATES=process[_0xed01('0xc')][0x7]&&process[_0xed01('0xc')][0x7]!=='undefined'&&process[_0xed01('0xc')][0x7]!==_0xed01('0xe')?process[_0xed01('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xed01('0xd')||process[_0xed01('0xc')][0x8]==='null'){throw new Error(_0xed01('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x12786e){logger[_0xed01('0x13')](_0x12786e);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(_0x56b868,_0x13ee88,_0x345140,_0x3010ad){var _0x3de009={'message':_0x13ee88};_0x3de009[_0x56b868]=!![];if(_0x345140){_0x3de009['contact']=_0x345140;}if(_0x3010ad){_0x3de009['index']=_0x3010ad;}return _0x3de009;}function isEmail(_0x58d800){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'](_0x58d800);}function checkRow(_0x1db380,_0x2bfc92,_0x569b85){return new BPromise(function(_0x46a603,_0x389a6c){if(_[_0xed01('0x14')](_0x1db380)){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x15'),null,_0x569b85));}if(_0x1db380['errors']&&_0x1db380[_0xed01('0x16')][_0xed01('0x17')]){var _0x331630=_[_0xed01('0x18')](_0x1db380['errors'],'message')[_0xed01('0x19')](';');return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0x331630,null,_0x569b85));}var _0x4cbcff={};for(var _0x4689fe in FIELDS){if(FIELDS['hasOwnProperty'](_0x4689fe)&&FIELDS[_0x4689fe]){_0x4cbcff[_0x4689fe]=_0x1db380[_0xed01('0x1a')][0x0][FIELDS[_0x4689fe]]||_0x1db380[_0xed01('0x1a')][0x0]['\ufeff'+FIELDS[_0x4689fe]];}}if(!_0x4cbcff[_0xed01('0x1b')]){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x1c'),null,_0x569b85));}if(!_0x4cbcff[_0xed01('0x1d')]){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x1e'),null,_0x569b85));}if(_0x4cbcff[_0xed01('0x1f')]){var _0x3fe920=moment(_0x4cbcff[_0xed01('0x1f')],_0xed01('0x20'));if(!_0x3fe920['isValid']()){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x21'),null,_0x569b85));}}if(_0x4cbcff[_0xed01('0x22')]){if(!isEmail(_0x4cbcff[_0xed01('0x22')])){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x23'),null,_0x569b85));}}_0x4cbcff[_0xed01('0x24')]=LISTID;_0x4cbcff['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xed01('0x17')]&&_0x2bfc92){var _0x549be8={};for(var _0x17d930=0x0,_0x935a5e=DUPLICATES[_0xed01('0x17')];_0x17d930<_0x935a5e;_0x17d930+=0x1){_0x549be8[DUPLICATES[_0x17d930]]=_0x4cbcff[DUPLICATES[_0x17d930]];}var _0x47e64c=_['find'](_0x2bfc92,_0x549be8);if(_0x47e64c){return _0x389a6c(handleCheckRowError(_0xed01('0x25'),_0xed01('0x26'),_0x47e64c,_0x569b85));}}return db['CmContact'][_0xed01('0x27')](_0x4cbcff,{'raw':!![],'hooks':![],'fields':_[_0xed01('0x28')](_0x4cbcff)})['then'](function(_0x15207){if(DUPLICATES&&DUPLICATES[_0xed01('0x17')]&&_0x2bfc92){_0x2bfc92[_0xed01('0x29')](_[_0xed01('0x2a')](_0x4cbcff,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15207['id'];return _0x46a603();})[_0xed01('0x2b')](function(_0x3fe63e){return _0x389a6c(handleCheckRowError(_0xed01('0x13'),_0xed01('0x2c')+(_0x3fe63e[_0xed01('0x2d')]||JSON['stringify'](_0x3fe63e)),null,_0x569b85));});});}function checkHopper(){function _0x3cfbf1(){return function(_0x5b690e){logger[_0xed01('0x13')]('cmContact',_0xed01('0x2e'),util['inspect'](_0x5b690e,{'showHidden':![],'depth':null}));};}var _0x18d5df=function(_0x2f79d7,_0x1d65de){var _0x368b6c=squel['insert']()[_0xed01('0x2f')]('cm_hopper')[_0xed01('0x30')]([_0xed01('0x1d'),_0xed01('0x31'),'ContactId',_0xed01('0x24'),_0x1d65de,_0xed01('0x32'),_0xed01('0x33')],squel['select']()[_0xed01('0x34')](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')](_0xed01('0x35'),_0xed01('0x31'))[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID['toString'](),_0xed01('0x24'))[_0xed01('0x34')](_0x2f79d7['id']['toString'](),_0x1d65de)['field']('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),'updatedAt')[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')]('deletedAt\x20IS\x20NULL')[_0xed01('0x39')]('ListId\x20=\x20?',LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x3b'))[_0xed01('0x39')](_0xed01('0x3c'),squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'))[_0xed01('0x37')]('cm_hopper')[_0xed01('0x39')](_0x1d65de+'\x20=\x20?',_0x2f79d7['id'][_0xed01('0x3a')]())))[_0xed01('0x3a')]();return _0x368b6c;};var _0x25964f=function(_0x483b16,_0x12d97d){var _0x12af2c=squel[_0xed01('0x3e')]()['into'](_0xed01('0x3f'))[_0xed01('0x30')](['phone',_0xed01('0x31'),_0xed01('0x36'),'ListId',_0x12d97d,_0xed01('0x32'),'updatedAt'],squel['select']()[_0xed01('0x34')](_0xed01('0x1d'),'phone')['field'](_0xed01('0x35'),'scheduledAt')['field']('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID[_0xed01('0x3a')](),_0xed01('0x24'))[_0xed01('0x34')](_0x483b16['id'][_0xed01('0x3a')](),_0x12d97d)[_0xed01('0x34')]('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),_0xed01('0x33'))[_0xed01('0x37')]('cm_contacts')[_0xed01('0x39')](_0xed01('0x40'))[_0xed01('0x39')](_0xed01('0x41'),LISTID['toString']())[_0xed01('0x39')](_0xed01('0x42'),squel[_0xed01('0x43')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xed01('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x44'))[_0xed01('0x37')](_0xed01('0x45'))[_0xed01('0x39')](_0x12d97d+_0xed01('0x46'),_0x483b16['id'][_0xed01('0x3a')]()))['where'](_0xed01('0x3c'),squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'))['from'](_0xed01('0x3f'))['where'](_0x12d97d+_0xed01('0x46'),_0x483b16['id'][_0xed01('0x3a')]())))[_0xed01('0x3a')]();return _0x12af2c;};function _0x3e01e6(_0x5ca582,_0x3be42b){var _0x28d0ff=squel[_0xed01('0x3e')]()[_0xed01('0x2f')](_0xed01('0x3f'))['fromQuery']([_0xed01('0x1d'),_0xed01('0x31'),_0xed01('0x36'),_0xed01('0x24'),_0x3be42b,_0xed01('0x32'),_0xed01('0x33')],squel[_0xed01('0x3d')]()['field'](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')](_0xed01('0x35'),'scheduledAt')[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID[_0xed01('0x3a')](),_0xed01('0x24'))[_0xed01('0x34')](_0x5ca582['id'][_0xed01('0x3a')](),_0x3be42b)[_0xed01('0x34')](_0xed01('0x35'),_0xed01('0x32'))[_0xed01('0x34')](_0xed01('0x35'),'updatedAt')[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')](_0xed01('0x40'))[_0xed01('0x39')](_0xed01('0x41'),LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x42'),squel['str'](hopperContacts))['where'](_0xed01('0x3b')))['toString']();return _0x28d0ff;}function _0x1f45bc(_0x1ba812,_0x57f49c){var _0x4fb495=squel['insert']()[_0xed01('0x2f')](_0xed01('0x47'))['fromQuery']([_0xed01('0x1d'),_0xed01('0x36'),_0xed01('0x24'),_0x57f49c,'createdAt','updatedAt'],squel[_0xed01('0x3d')]()[_0xed01('0x34')](_0xed01('0x1d'),_0xed01('0x1d'))[_0xed01('0x34')]('id',_0xed01('0x36'))[_0xed01('0x34')](LISTID['toString'](),'ListId')['field'](_0x1ba812['id']['toString'](),_0x57f49c)[_0xed01('0x34')]('NOW()',_0xed01('0x32'))['field'](_0xed01('0x35'),_0xed01('0x33'))[_0xed01('0x37')](_0xed01('0x38'))[_0xed01('0x39')](_0xed01('0x40'))['where']('ListId\x20=\x20?',LISTID[_0xed01('0x3a')]())[_0xed01('0x39')](_0xed01('0x42'),squel[_0xed01('0x43')](hopperContacts))[_0xed01('0x39')](_0xed01('0x3b')))[_0xed01('0x3a')]();return _0x4fb495;}return db[_0xed01('0x48')][_0xed01('0x49')]({'where':{'type':'outbound'},'attributes':['id',_0xed01('0x4a')],'include':[{'model':db[_0xed01('0x4b')],'as':_0xed01('0x4c'),'where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x2da0c3){var _0x459e7e=[];if(_0x2da0c3){var _0x4c445e;for(var _0xcf7600=0x0,_0x231cc4;_0xcf7600<_0x2da0c3[_0xed01('0x17')];_0xcf7600+=0x1){_0x231cc4=_0x2da0c3[_0xcf7600][_0xed01('0x4e')]({'plain':!![]});switch(_0x231cc4[_0xed01('0x4a')]){case'always':_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x25964f(_0x231cc4,_0xed01('0x51')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;case'onlyIfOpen':_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')]['query'](_0x18d5df(_0x231cc4,_0xed01('0x51')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;default:_0x459e7e[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x3e01e6(_0x231cc4,_0xed01('0x51')))['then'](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}}return _0x459e7e;})[_0xed01('0x52')]()[_0xed01('0x4d')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xed01('0x53')},'attributes':['id'],'include':[{'model':db[_0xed01('0x4b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x1d9f8f){var _0x43d976=[];if(_0x1d9f8f){var _0x570e50;for(var _0x4f33a7=0x0,_0x372499;_0x4f33a7<_0x1d9f8f[_0xed01('0x17')];_0x4f33a7+=0x1){_0x372499=_0x1d9f8f[_0x4f33a7][_0xed01('0x4e')]({'plain':!![]});_0x43d976['push'](db[_0xed01('0x4f')][_0xed01('0x50')](_0x1f45bc(_0x372499,_0xed01('0x51')))['then'](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}return _0x43d976;})[_0xed01('0x52')]();})[_0xed01('0x4d')](function(){return db[_0xed01('0x54')][_0xed01('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xed01('0x4b')],'as':'Lists','where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x4610b3){var _0xcd45a9=[];if(_0x4610b3){for(var _0x1eb81c=0x0,_0x3691b5;_0x1eb81c<_0x4610b3[_0xed01('0x17')];_0x1eb81c+=0x1){_0x3691b5=_0x4610b3[_0x1eb81c]['get']({'plain':!![]});switch(_0x3691b5[_0xed01('0x4a')]){case _0xed01('0x55'):_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x25964f(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;case'onlyIfOpen':_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x18d5df(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));break;default:_0xcd45a9[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x3e01e6(_0x3691b5,_0xed01('0x56')))[_0xed01('0x4d')](function(){})[_0xed01('0x2b')](_0x3cfbf1()));}}}return _0xcd45a9;})['all']();})[_0xed01('0x4d')](function(){return db[_0xed01('0x54')][_0xed01('0x49')]({'attributes':['id'],'include':[{'model':db[_0xed01('0x4b')],'as':_0xed01('0x57'),'where':{'id':LISTID}}]})[_0xed01('0x4d')](function(_0x6d58fc){var _0x104f41=[];if(_0x6d58fc){for(var _0x3000b1=0x0,_0x281116;_0x3000b1<_0x6d58fc[_0xed01('0x17')];_0x3000b1+=0x1){_0x281116=_0x6d58fc[_0x3000b1][_0xed01('0x4e')]({'plain':!![]});_0x104f41[_0xed01('0x29')](db[_0xed01('0x4f')][_0xed01('0x50')](_0x1f45bc(_0x281116,_0xed01('0x56')))['then'](function(){})['catch'](_0x3cfbf1()));}}return _0x104f41;})['all']();})[_0xed01('0x2b')](function(_0x5a8014){logger['error']('cmContact,\x20%s,\x20%s',_0xed01('0x58'),_0x5a8014[_0xed01('0x2d')]);});}var processPromises=function(_0x2851e2){return BPromise[_0xed01('0x52')](promises)['then'](function(_0x8ae19a){})[_0xed01('0x2b')](function(_0x402bb7){logger['error'](_0xed01('0x59'),JSON[_0xed01('0x5a')](_0x402bb7));})[_0xed01('0x5b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2851e2){return _0x2851e2['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0xed01('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0xed01('0x4d')](function(){socket[_0xed01('0x5c')](_0xed01('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xed01('0x5e')](FILEPATH);}catch(_0x2a7513){logger[_0xed01('0x13')](_0xed01('0x5f'),JSON['stringify'](_0x2a7513));}finally{process[_0xed01('0x60')](0x0);}});};process['on'](_0xed01('0x61'),function(){logger[_0xed01('0x62')](_0xed01('0x63'));endCsv();});function main(){return BPromise[_0xed01('0x64')]()[_0xed01('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xed01('0x65')](',');return db[_0xed01('0x66')][_0xed01('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xed01('0x4d')](function(_0x106550){var _0x432019=fs[_0xed01('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xed01('0x68')](_0x432019,{'header':!![],'skipEmptyLines':!![],'step':function(_0x13e420,_0x48a731){total+=0x1;var _0x519607=total;promises['push'](checkRow(_0x13e420,_0x106550,_0x519607)[_0xed01('0x4d')](function(){success+=0x1;})[_0xed01('0x2b')](function(_0x167f60){if(_0x167f60[_0xed01('0x13')]){errors+=0x1;delete _0x167f60['error'];}else if(_0x167f60[_0xed01('0x25')]){duplicates+=0x1;delete _0x167f60[_0xed01('0x25')];}rows['push'](_0x167f60);}));if(total%0xc8===0x0){_0x48a731[_0xed01('0x69')]();return processPromises(_0x48a731);}},'complete':function(){return processPromises()[_0xed01('0x4d')](function(){logger[_0xed01('0x62')](_0xed01('0x6a'));endCsv();});},'error':function(_0x3e2992,_0x430bca){logger[_0xed01('0x62')](_0xed01('0x6b'),JSON['stringify'](_0x3e2992));endCsv();}});})[_0xed01('0x2b')](function(_0x301a07){logger['error'](_0xed01('0x6c'),JSON[_0xed01('0x5a')](_0x301a07));});}main(); \ No newline at end of file +var _0x9fb3=['onlyIfOpen','all','VoiceQueue','findAll','outbound','BlackLists','Campaign','Lists','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','pick','catch','message','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_black','dialCheckDuplicateType','CmList','then','get','always','push','sequelize','query','VoiceQueueId'];(function(_0x178067,_0x4cfe55){var _0x16d727=function(_0x43c631){while(--_0x43c631){_0x178067['push'](_0x178067['shift']());}};_0x16d727(++_0x4cfe55);}(_0x9fb3,0x83));var _0x39fb=function(_0x42efe3,_0x234406){_0x42efe3=_0x42efe3-0x0;var _0x2927bf=_0x9fb3[_0x42efe3];return _0x2927bf;};'use strict';var BPromise=require(_0x39fb('0x0'));var util=require('util');var _=require(_0x39fb('0x1'));var fs=require('fs');var squel=require(_0x39fb('0x2'));var Papa=require('papaparse');var Redis=require(_0x39fb('0x3'));var db=require(_0x39fb('0x4'))['db'];var config=require(_0x39fb('0x5'));var logger=require('../../../config/logger')(_0x39fb('0x6'));config[_0x39fb('0x7')]=_[_0x39fb('0x8')](config[_0x39fb('0x7')],{'host':_0x39fb('0x9'),'port':0x18eb});var socket=require(_0x39fb('0xa'))(new Redis(config[_0x39fb('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process['argv'][0x2]||process[_0x39fb('0xb')][0x2]===_0x39fb('0xc')||process[_0x39fb('0xb')][0x2]===_0x39fb('0xd')){throw new Error(_0x39fb('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x39fb('0xb')][0x3]||process[_0x39fb('0xb')][0x3]===_0x39fb('0xc')||process[_0x39fb('0xb')][0x3]===_0x39fb('0xd')||!process[_0x39fb('0xb')][0x4]||process[_0x39fb('0xb')][0x4]===_0x39fb('0xc')||process[_0x39fb('0xb')][0x4]==='null'){throw new Error(_0x39fb('0xf'));}var FIELDS=_[_0x39fb('0x10')](process[_0x39fb('0xb')][0x3][_0x39fb('0x11')](','),process[_0x39fb('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x39fb('0xc')||process[_0x39fb('0xb')][0x5]===_0x39fb('0xd')){throw new Error(_0x39fb('0x12'));}var LISTID=process[_0x39fb('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x39fb('0xb')][0x6]!==_0x39fb('0xc')&&process[_0x39fb('0xb')][0x6]!=='null'?process[_0x39fb('0xb')][0x6]:null;var DUPLICATES=process[_0x39fb('0xb')][0x7]&&process[_0x39fb('0xb')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x39fb('0xd')?process[_0x39fb('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x39fb('0xb')][0x8]===_0x39fb('0xd')){throw new Error(_0x39fb('0x13'));}var SOCKET_TIMESTAMP=process[_0x39fb('0xb')][0x8];}catch(_0x461d6a){logger[_0x39fb('0x14')](_0x461d6a);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(_0x12bf31,_0xd0bfd8,_0x554c3c,_0x1cfd91){var _0x2058a={'message':_0xd0bfd8};_0x2058a[_0x12bf31]=!![];if(_0x554c3c){_0x2058a[_0x39fb('0x15')]=_0x554c3c;}if(_0x1cfd91){_0x2058a[_0x39fb('0x16')]=_0x1cfd91;}return _0x2058a;}function isEmail(_0x1ba15f){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))*$/[_0x39fb('0x17')](_0x1ba15f);}function checkRow(_0x5d4b9f,_0x5191f0,_0x18b0cb){return new BPromise(function(_0x4f68ba,_0x2307af){if(_[_0x39fb('0x18')](_0x5d4b9f)){return _0x2307af(handleCheckRowError(_0x39fb('0x14'),_0x39fb('0x19'),null,_0x18b0cb));}if(_0x5d4b9f[_0x39fb('0x1a')]&&_0x5d4b9f[_0x39fb('0x1a')][_0x39fb('0x1b')]){var _0x2a90ee=_['map'](_0x5d4b9f['errors'],'message')[_0x39fb('0x1c')](';');return _0x2307af(handleCheckRowError(_0x39fb('0x14'),_0x2a90ee,null,_0x18b0cb));}var _0x6eeef7={};for(var _0x3c47da in FIELDS){if(FIELDS[_0x39fb('0x1d')](_0x3c47da)&&FIELDS[_0x3c47da]){_0x6eeef7[_0x3c47da]=_0x5d4b9f[_0x39fb('0x1e')][0x0][FIELDS[_0x3c47da]]||_0x5d4b9f['data'][0x0]['\ufeff'+FIELDS[_0x3c47da]];}}if(!_0x6eeef7['firstName']){return _0x2307af(handleCheckRowError('error',_0x39fb('0x1f'),null,_0x18b0cb));}if(!_0x6eeef7[_0x39fb('0x20')]){return _0x2307af(handleCheckRowError(_0x39fb('0x14'),_0x39fb('0x21'),null,_0x18b0cb));}if(_0x6eeef7[_0x39fb('0x22')]){var _0x5437ba=moment(_0x6eeef7['birthDate'],_0x39fb('0x23'));if(!_0x5437ba['isValid']()){return _0x2307af(handleCheckRowError(_0x39fb('0x14'),_0x39fb('0x24'),null,_0x18b0cb));}}if(_0x6eeef7[_0x39fb('0x25')]){if(!isEmail(_0x6eeef7[_0x39fb('0x25')])){return _0x2307af(handleCheckRowError(_0x39fb('0x14'),_0x39fb('0x26'),null,_0x18b0cb));}}_0x6eeef7['ListId']=LISTID;_0x6eeef7[_0x39fb('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5191f0){var _0x29540b={};for(var _0x4b491d=0x0,_0x380dd7=DUPLICATES[_0x39fb('0x1b')];_0x4b491d<_0x380dd7;_0x4b491d+=0x1){_0x29540b[DUPLICATES[_0x4b491d]]=_0x6eeef7[DUPLICATES[_0x4b491d]];}var _0x590683=_[_0x39fb('0x28')](_0x5191f0,_0x29540b);if(_0x590683){return _0x2307af(handleCheckRowError(_0x39fb('0x29'),_0x39fb('0x2a'),_0x590683,_0x18b0cb));}}return db[_0x39fb('0x2b')][_0x39fb('0x2c')](_0x6eeef7,{'raw':!![],'hooks':![],'fields':_['keys'](_0x6eeef7)})['then'](function(_0x3fde18){if(DUPLICATES&&DUPLICATES[_0x39fb('0x1b')]&&_0x5191f0){_0x5191f0['push'](_[_0x39fb('0x2d')](_0x6eeef7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3fde18['id'];return _0x4f68ba();})[_0x39fb('0x2e')](function(_0x1dee18){return _0x2307af(handleCheckRowError(_0x39fb('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1dee18[_0x39fb('0x2f')]||JSON[_0x39fb('0x30')](_0x1dee18)),null,_0x18b0cb));});});}function checkHopper(){function _0x33c016(){return function(_0x107a96){logger[_0x39fb('0x14')](_0x39fb('0x31'),'checkHopper',util[_0x39fb('0x32')](_0x107a96,{'showHidden':![],'depth':null}));};}var _0xb73091=function(_0x5f58fc,_0x2f3ff7){var _0x4fdb38=squel[_0x39fb('0x33')]()[_0x39fb('0x34')](_0x39fb('0x35'))[_0x39fb('0x36')]([_0x39fb('0x20'),_0x39fb('0x37'),'ContactId',_0x39fb('0x38'),_0x2f3ff7,_0x39fb('0x39'),_0x39fb('0x3a')],squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')]('phone','phone')[_0x39fb('0x3c')]('NOW()',_0x39fb('0x37'))[_0x39fb('0x3c')]('id',_0x39fb('0x3d'))[_0x39fb('0x3c')](LISTID[_0x39fb('0x3e')](),_0x39fb('0x38'))[_0x39fb('0x3c')](_0x5f58fc['id']['toString'](),_0x2f3ff7)['field'](_0x39fb('0x3f'),'createdAt')['field']('NOW()',_0x39fb('0x3a'))[_0x39fb('0x40')](_0x39fb('0x41'))[_0x39fb('0x42')](_0x39fb('0x43'))[_0x39fb('0x42')](_0x39fb('0x44'),LISTID[_0x39fb('0x3e')]())['where'](_0x39fb('0x45'))[_0x39fb('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')](_0x39fb('0x20'))[_0x39fb('0x40')](_0x39fb('0x35'))[_0x39fb('0x42')](_0x2f3ff7+_0x39fb('0x46'),_0x5f58fc['id'][_0x39fb('0x3e')]())))['toString']();return _0x4fdb38;};var _0x3bce5a=function(_0x3ca840,_0x2d6fe3){var _0x40996b=squel[_0x39fb('0x33')]()[_0x39fb('0x34')](_0x39fb('0x35'))['fromQuery'](['phone',_0x39fb('0x37'),'ContactId',_0x39fb('0x38'),_0x2d6fe3,_0x39fb('0x39'),_0x39fb('0x3a')],squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')](_0x39fb('0x20'),_0x39fb('0x20'))[_0x39fb('0x3c')](_0x39fb('0x3f'),'scheduledAt')['field']('id',_0x39fb('0x3d'))[_0x39fb('0x3c')](LISTID[_0x39fb('0x3e')](),_0x39fb('0x38'))[_0x39fb('0x3c')](_0x3ca840['id'][_0x39fb('0x3e')](),_0x2d6fe3)[_0x39fb('0x3c')](_0x39fb('0x3f'),'createdAt')[_0x39fb('0x3c')]('NOW()','updatedAt')[_0x39fb('0x40')](_0x39fb('0x41'))[_0x39fb('0x42')](_0x39fb('0x43'))[_0x39fb('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x39fb('0x42')](_0x39fb('0x47'),squel[_0x39fb('0x48')](hopperContacts))[_0x39fb('0x42')](_0x39fb('0x45'))[_0x39fb('0x42')](_0x39fb('0x49'),squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')](_0x39fb('0x4a'))['from']('cm_hopper_final')[_0x39fb('0x42')](_0x2d6fe3+_0x39fb('0x46'),_0x3ca840['id']['toString']()))['where'](_0x39fb('0x49'),squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')](_0x39fb('0x20'))[_0x39fb('0x40')](_0x39fb('0x35'))['where'](_0x2d6fe3+'\x20=\x20?',_0x3ca840['id'][_0x39fb('0x3e')]())))[_0x39fb('0x3e')]();return _0x40996b;};function _0x2b1514(_0x1b5dd6,_0x53ad43){var _0x3143ee=squel[_0x39fb('0x33')]()[_0x39fb('0x34')](_0x39fb('0x35'))['fromQuery'](['phone','scheduledAt',_0x39fb('0x3d'),'ListId',_0x53ad43,_0x39fb('0x39'),'updatedAt'],squel[_0x39fb('0x3b')]()[_0x39fb('0x3c')]('phone','phone')[_0x39fb('0x3c')](_0x39fb('0x3f'),_0x39fb('0x37'))[_0x39fb('0x3c')]('id','ContactId')['field'](LISTID[_0x39fb('0x3e')](),'ListId')['field'](_0x1b5dd6['id']['toString'](),_0x53ad43)[_0x39fb('0x3c')](_0x39fb('0x3f'),_0x39fb('0x39'))[_0x39fb('0x3c')](_0x39fb('0x3f'),_0x39fb('0x3a'))[_0x39fb('0x40')](_0x39fb('0x41'))[_0x39fb('0x42')]('deletedAt\x20IS\x20NULL')[_0x39fb('0x42')](_0x39fb('0x44'),LISTID[_0x39fb('0x3e')]())[_0x39fb('0x42')]('id\x20IN\x20?',squel[_0x39fb('0x48')](hopperContacts))[_0x39fb('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x39fb('0x3e')]();return _0x3143ee;}function _0x552cc6(_0x467f36,_0x5c6b47){var _0x6899b6=squel[_0x39fb('0x33')]()[_0x39fb('0x34')](_0x39fb('0x4b'))[_0x39fb('0x36')]([_0x39fb('0x20'),_0x39fb('0x3d'),_0x39fb('0x38'),_0x5c6b47,_0x39fb('0x39'),_0x39fb('0x3a')],squel['select']()[_0x39fb('0x3c')](_0x39fb('0x20'),_0x39fb('0x20'))[_0x39fb('0x3c')]('id',_0x39fb('0x3d'))[_0x39fb('0x3c')](LISTID[_0x39fb('0x3e')](),_0x39fb('0x38'))['field'](_0x467f36['id'][_0x39fb('0x3e')](),_0x5c6b47)[_0x39fb('0x3c')](_0x39fb('0x3f'),'createdAt')[_0x39fb('0x3c')]('NOW()','updatedAt')['from'](_0x39fb('0x41'))[_0x39fb('0x42')](_0x39fb('0x43'))['where'](_0x39fb('0x44'),LISTID[_0x39fb('0x3e')]())[_0x39fb('0x42')](_0x39fb('0x47'),squel[_0x39fb('0x48')](hopperContacts))['where'](_0x39fb('0x45')))[_0x39fb('0x3e')]();return _0x6899b6;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x39fb('0x4c')],'include':[{'model':db[_0x39fb('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0x39fb('0x4e')](function(_0x189a81){var _0x13c507=[];if(_0x189a81){var _0x251a4a;for(var _0x554ef0=0x0,_0x2ae015;_0x554ef0<_0x189a81['length'];_0x554ef0+=0x1){_0x2ae015=_0x189a81[_0x554ef0][_0x39fb('0x4f')]({'plain':!![]});switch(_0x2ae015['dialCheckDuplicateType']){case _0x39fb('0x50'):_0x13c507[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0x3bce5a(_0x2ae015,_0x39fb('0x54')))['then'](function(){})[_0x39fb('0x2e')](_0x33c016()));break;case _0x39fb('0x55'):_0x13c507[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0xb73091(_0x2ae015,_0x39fb('0x54')))['then'](function(){})[_0x39fb('0x2e')](_0x33c016()));break;default:_0x13c507[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0x2b1514(_0x2ae015,_0x39fb('0x54')))[_0x39fb('0x4e')](function(){})[_0x39fb('0x2e')](_0x33c016()));}}}return _0x13c507;})[_0x39fb('0x56')]()[_0x39fb('0x4e')](function(){return db[_0x39fb('0x57')][_0x39fb('0x58')]({'where':{'type':_0x39fb('0x59')},'attributes':['id'],'include':[{'model':db[_0x39fb('0x4d')],'as':_0x39fb('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x356473){var _0x5579d5=[];if(_0x356473){var _0x4e38d9;for(var _0x1f3a88=0x0,_0x2d3b9f;_0x1f3a88<_0x356473[_0x39fb('0x1b')];_0x1f3a88+=0x1){_0x2d3b9f=_0x356473[_0x1f3a88][_0x39fb('0x4f')]({'plain':!![]});_0x5579d5[_0x39fb('0x51')](db[_0x39fb('0x52')]['query'](_0x552cc6(_0x2d3b9f,_0x39fb('0x54')))[_0x39fb('0x4e')](function(){})[_0x39fb('0x2e')](_0x33c016()));}}return _0x5579d5;})[_0x39fb('0x56')]();})[_0x39fb('0x4e')](function(){return db[_0x39fb('0x5b')][_0x39fb('0x58')]({'attributes':['id',_0x39fb('0x4c')],'include':[{'model':db[_0x39fb('0x4d')],'as':_0x39fb('0x5c'),'where':{'id':LISTID}}]})[_0x39fb('0x4e')](function(_0x43fa6e){var _0x51f601=[];if(_0x43fa6e){for(var _0x34c6b8=0x0,_0x4033a1;_0x34c6b8<_0x43fa6e[_0x39fb('0x1b')];_0x34c6b8+=0x1){_0x4033a1=_0x43fa6e[_0x34c6b8][_0x39fb('0x4f')]({'plain':!![]});switch(_0x4033a1[_0x39fb('0x4c')]){case _0x39fb('0x50'):_0x51f601[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0x3bce5a(_0x4033a1,_0x39fb('0x5d')))[_0x39fb('0x4e')](function(){})[_0x39fb('0x2e')](_0x33c016()));break;case _0x39fb('0x55'):_0x51f601[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0xb73091(_0x4033a1,_0x39fb('0x5d')))[_0x39fb('0x4e')](function(){})[_0x39fb('0x2e')](_0x33c016()));break;default:_0x51f601['push'](db[_0x39fb('0x52')][_0x39fb('0x53')](_0x2b1514(_0x4033a1,'CampaignId'))[_0x39fb('0x4e')](function(){})[_0x39fb('0x2e')](_0x33c016()));}}}return _0x51f601;})[_0x39fb('0x56')]();})['then'](function(){return db['Campaign'][_0x39fb('0x58')]({'attributes':['id'],'include':[{'model':db[_0x39fb('0x4d')],'as':_0x39fb('0x5a'),'where':{'id':LISTID}}]})[_0x39fb('0x4e')](function(_0x351cb8){var _0x3f77f1=[];if(_0x351cb8){for(var _0x523a81=0x0,_0x3ff05a;_0x523a81<_0x351cb8[_0x39fb('0x1b')];_0x523a81+=0x1){_0x3ff05a=_0x351cb8[_0x523a81][_0x39fb('0x4f')]({'plain':!![]});_0x3f77f1[_0x39fb('0x51')](db[_0x39fb('0x52')][_0x39fb('0x53')](_0x552cc6(_0x3ff05a,_0x39fb('0x5d')))[_0x39fb('0x4e')](function(){})['catch'](_0x33c016()));}}return _0x3f77f1;})[_0x39fb('0x56')]();})['catch'](function(_0x10d8fd){logger[_0x39fb('0x14')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x10d8fd[_0x39fb('0x2f')]);});}var processPromises=function(_0x242696){return BPromise['all'](promises)['then'](function(_0x13c63e){})[_0x39fb('0x2e')](function(_0x1501ff){logger[_0x39fb('0x14')](_0x39fb('0x5e'),JSON[_0x39fb('0x30')](_0x1501ff));})[_0x39fb('0x5f')](function(){socket[_0x39fb('0x60')](_0x39fb('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x242696){return _0x242696[_0x39fb('0x62')]();}});};var endCsv=function(){return BPromise[_0x39fb('0x63')]()[_0x39fb('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0x39fb('0x4e')](function(){socket['emit'](_0x39fb('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x39fb('0x64')](FILEPATH);}catch(_0x492cd6){logger['error'](_0x39fb('0x65'),JSON[_0x39fb('0x30')](_0x492cd6));}finally{process[_0x39fb('0x66')](0x0);}});};process['on'](_0x39fb('0x67'),function(){logger[_0x39fb('0x68')](_0x39fb('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0x39fb('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x39fb('0x11')](',');return db[_0x39fb('0x2b')][_0x39fb('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x39fb('0x4e')](function(_0x6f78de){var _0x3d634f=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3d634f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x149741,_0x348016){total+=0x1;var _0x3360be=total;promises[_0x39fb('0x51')](checkRow(_0x149741,_0x6f78de,_0x3360be)[_0x39fb('0x4e')](function(){success+=0x1;})['catch'](function(_0x44d510){if(_0x44d510[_0x39fb('0x14')]){errors+=0x1;delete _0x44d510[_0x39fb('0x14')];}else if(_0x44d510[_0x39fb('0x29')]){duplicates+=0x1;delete _0x44d510['duplicate'];}rows[_0x39fb('0x51')](_0x44d510);}));if(total%0xc8===0x0){_0x348016[_0x39fb('0x6a')]();return processPromises(_0x348016);}},'complete':function(){return processPromises()[_0x39fb('0x4e')](function(){logger[_0x39fb('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x5e5b79,_0xf66e65){logger[_0x39fb('0x68')]('CSV\x20parse\x20error',JSON[_0x39fb('0x30')](_0x5e5b79));endCsv();}});})['catch'](function(_0x3fad69){logger[_0x39fb('0x14')](_0x39fb('0x6b'),JSON[_0x39fb('0x30')](_0x3fad69));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4faec37..060082b 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 _0xc217=[')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','errors','sequelize','query','spread','catch','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactTypeId','orderBy','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','affectedRows','unlink','exit','complete','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','argv','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','length','push','then','split','all','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','insert','cm_hopper','scheduledat','priority','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt'];(function(_0x230594,_0x3c2e64){var _0x3173b9=function(_0x44554a){while(--_0x44554a){_0x230594['push'](_0x230594['shift']());}};_0x3173b9(++_0x3c2e64);}(_0xc217,0x69));var _0x7c21=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xc217[_0x470f24];return _0x2c6fc8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x7c21('0x0'));var BPromise=require(_0x7c21('0x1'));var moment=require(_0x7c21('0x2'));var squel=require(_0x7c21('0x3'));var Redis=require(_0x7c21('0x4'));var db=require(_0x7c21('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x7c21('0x6'));var logger=require(_0x7c21('0x7'))(_0x7c21('0x8'));config[_0x7c21('0x9')]=_[_0x7c21('0xa')](config['redis'],{'host':_0x7c21('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c21('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7c21('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7c21('0xc')](_0x7c21('0xd'));function isEmail(_0xf273a8){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))*$/[_0x7c21('0xe')](_0xf273a8);}function selectNotIn(_0x1daefc,_0x5efebc,_0x3cfeee,_0x3e6abf,_0x2eb87e){return squel[_0x7c21('0xf')]()[_0x7c21('0x10')](_0x7c21('0x11'))['from'](_0x3e6abf)[_0x7c21('0x12')](_0x5efebc,null,_0x5efebc+_0x7c21('0x13')+_0x3e6abf+'.'+_0x3cfeee)[_0x7c21('0x14')](_0x3e6abf+'.'+_0x3cfeee+_0x7c21('0x15')+_0x1daefc+'.'+_0x3cfeee)[_0x7c21('0x14')](_0x5efebc+'.dialCheckDuplicateType\x20IN\x20('+_0x2eb87e[_0x7c21('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5c107c,_0x2f7625){promisesAdditionalPhones=[];return db['CmContact'][_0x7c21('0x16')]({'raw':!![],'attributes':['id',_0x7c21('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x24ce1b){if(_0x24ce1b!==null){var _0x2926ab=[];for(var _0x3844e3=0x0;_0x3844e3<_0x24ce1b[_0x7c21('0x18')];_0x3844e3++){var _0x415b3d=_0x24ce1b[_0x3844e3];_0x2926ab[_0x7c21('0x19')](insertAdditionalPhones(_0x415b3d));}}Promise['all'](_0x2926ab)[_0x7c21('0x1a')](function(){_0x5c107c({'val':0x1});});});});}function insertAdditionalPhones(_0x2d78e9){return new Promise(function(_0x24e0cc,_0x3e6462){var _0x308019=_0x2d78e9[_0x7c21('0x17')];var _0xc54c3d=_0x308019[_0x7c21('0x1b')](';');var _0x1abaed=[];orderBy=0x0;for(var _0xabe387=0x0;_0xabe387<_0xc54c3d['length'];_0xabe387++){_0x1abaed[_0x7c21('0x19')](splitAdditionalPhone(_0x2d78e9['id'],_0xc54c3d[_0xabe387]));}Promise[_0x7c21('0x1c')](_0x1abaed)[_0x7c21('0x1a')](function(){_0x24e0cc({'val':_0xc54c3d['length']});});});}function splitAdditionalPhone(_0xb430a4,_0x408dd2){return new Promise(function(_0x569382,_0x2e4d20){var _0x11c5e2=_0x408dd2['split'](':');var _0x457b7c=_0x11c5e2[0x0];var _0x30b140=_0x11c5e2[0x1];if(!_[_0x7c21('0x1d')](_0x30b140)){var _0x31a96e=_0x30b140[_0x7c21('0x1b')]('|');var _0x3c79b4=[];for(var _0x5aaf3b=0x0;_0x5aaf3b<_0x31a96e['length'];_0x5aaf3b++){if(_0x31a96e[_0x5aaf3b]!==''){var _0x5dbfcc=_[_0x7c21('0x1e')](promisesAdditionalPhones,{'contactId':_0xb430a4,'phone':_0x31a96e[_0x5aaf3b]});if(_0x5dbfcc[_0x7c21('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x7c21('0x19')]({'contactId':_0xb430a4,'contactTypeId':_0x457b7c,'phone':_0x31a96e[_0x5aaf3b],'orderBy':orderBy});}}}_0x569382({'ok':0x1});}else _0x569382({'res':0x0});});}function createAdditionalPhone(_0x2aebcb,_0x1f158d,_0x3f587f,_0x3b819c){var _0x4c5d2b='';var _0x243f9a='';var _0x1ecf38=_0x3f587f[_0x7c21('0x1b')]('§');_0x4c5d2b=_0x1ecf38[0x0];if(_0x1ecf38[_0x7c21('0x18')]==0x2)_0x243f9a=_0x1ecf38[0x1];return new Promise(function(_0x567cf1,_0x32ec8f){return db[_0x7c21('0x1f')]['findOne']({'where':{'CmContactId':_0x2aebcb,'item':_0x4c5d2b}})[_0x7c21('0x1a')](function(_0x562c6e){if(_0x562c6e){return db[_0x7c21('0x1f')][_0x7c21('0x20')]({'ItemTypeId':_0x1f158d,'description':_0x243f9a,'OrderBy':_0x3b819c},{'where':{'CmContactId':_0x2aebcb,'item':_0x4c5d2b}})[_0x7c21('0x1a')](function(_0x7bd91a){_0x567cf1({'res':_0x7c21('0x21')});});}else{return db[_0x7c21('0x1f')][_0x7c21('0x22')]({'CmContactId':_0x2aebcb,'item':_0x4c5d2b,'description':_0x243f9a,'ItemTypeId':_0x1f158d,'OrderBy':_0x3b819c,'ItemClass':_0x7c21('0x23')})[_0x7c21('0x1a')](function(_0x36cb16){_0x567cf1({'res':_0x7c21('0x24')});});}});});}function insertCmHopper(_0x4a93e1,_0x21b3ff,_0x2d7323,_0xb759a1,_0x4ce559){var _0x32f124=[_0x7c21('0x25'),'cm_contacts.scheduledat',_0x7c21('0x26'),_0x7c21('0x27'),_0x21b3ff+'.'+_0xb759a1,_0x7c21('0x28'),_0x7c21('0x29'),_0x7c21('0x2a'),'cm_contacts.UserId','\x22'+_0x4ce559+'\x22'];return squel['insert']()[_0x7c21('0x2b')]('cm_hopper')[_0x7c21('0x2c')]([_0x7c21('0x11'),'scheduledat',_0x7c21('0x2d'),_0x7c21('0x2e'),_0xb759a1,_0x7c21('0x2f'),_0x7c21('0x30'),'priority',_0x7c21('0x31'),_0x7c21('0x32')],squel[_0x7c21('0xf')]()[_0x7c21('0x33')](_0x32f124)[_0x7c21('0x34')](_0x21b3ff)[_0x7c21('0x12')](_0x7c21('0x35'),null,_0x7c21('0x36')+_0x21b3ff+_0x7c21('0x37'))[_0x7c21('0x12')](_0x2d7323,null,_0x2d7323+_0x7c21('0x13')+_0x21b3ff+'.'+_0xb759a1)[_0x7c21('0x14')](_0x21b3ff+_0x7c21('0x38'),_0x4a93e1)[_0x7c21('0x14')](_0x7c21('0x39'),NOW)[_0x7c21('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x21b3ff,_0x2d7323,_0xb759a1,'cm_hopper',['\x22always\x22',_0x7c21('0x3a')]))['where'](_0x7c21('0x3b'),selectNotIn(_0x21b3ff,_0x2d7323,_0xb759a1,'cm_hopper',[_0x7c21('0x3c')])))[_0x7c21('0x3d')]();}function insertCmHopperBlack(_0x31e81b,_0x3e48c6,_0x7ab8b7,_0x43bfa4){var _0x4852f7=[_0x7c21('0x25'),_0x7c21('0x26'),_0x7c21('0x27'),_0x3e48c6+'.'+_0x43bfa4,_0x7c21('0x28'),_0x7c21('0x29')];return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x3e'))[_0x7c21('0x2c')]([_0x7c21('0x11'),'ContactId',_0x7c21('0x2e'),_0x43bfa4,_0x7c21('0x2f'),'updatedAt'],squel[_0x7c21('0xf')]()['fields'](_0x4852f7)['from'](_0x3e48c6)[_0x7c21('0x12')](_0x7c21('0x35'),null,_0x7c21('0x36')+_0x3e48c6+'.CmListId')[_0x7c21('0x12')](_0x7ab8b7,null,_0x7ab8b7+'.id\x20=\x20'+_0x3e48c6+'.'+_0x43bfa4)['where'](_0x3e48c6+_0x7c21('0x38'),_0x31e81b)[_0x7c21('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7c21('0x14')](_0x7c21('0x3b'),squel[_0x7c21('0xf')]()[_0x7c21('0x10')](_0x7c21('0x11'))[_0x7c21('0x34')]('cm_hopper_black')[_0x7c21('0x14')]('ListId\x20=\x20?',_0x31e81b)[_0x7c21('0x14')](_0x43bfa4+'\x20=\x20'+_0x3e48c6+'.'+_0x43bfa4)))['toString']();}function insertTzCmHopper(_0x825afc,_0x2d249d,_0x5d2a71,_0x18dae7,_0x35d50c,_0x1ca4ba){var _0x508ac8=[_0x7c21('0x25'),_0x7c21('0x3f')+_0x1ca4ba+_0x7c21('0x40'),_0x7c21('0x26'),_0x7c21('0x27'),_0x2d249d+'.'+_0x18dae7,'cm_contacts.createdAt',_0x7c21('0x29'),_0x7c21('0x2a'),_0x7c21('0x41'),'\x22'+_0x35d50c+'\x22'];var _0x333377=squel[_0x7c21('0x42')]()['into'](_0x7c21('0x43'))[_0x7c21('0x2c')]([_0x7c21('0x11'),_0x7c21('0x44'),_0x7c21('0x2d'),_0x7c21('0x2e'),_0x18dae7,_0x7c21('0x2f'),_0x7c21('0x30'),_0x7c21('0x45'),'UserId',_0x7c21('0x32')],squel[_0x7c21('0xf')]()[_0x7c21('0x33')](_0x508ac8)[_0x7c21('0x34')](_0x2d249d)[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x2d249d+'.CmListId')[_0x7c21('0x12')](_0x5d2a71,null,_0x5d2a71+_0x7c21('0x13')+_0x2d249d+'.'+_0x18dae7)[_0x7c21('0x12')](_0x1ca4ba,null,_0x1ca4ba+_0x7c21('0x13')+_0x2d249d+'.'+_0x18dae7)[_0x7c21('0x14')](_0x2d249d+'.CmListId\x20=\x20?',_0x825afc)[_0x7c21('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7c21('0x3b'),selectNotIn(_0x2d249d,_0x5d2a71,_0x18dae7,_0x7c21('0x43'),[_0x7c21('0x3c'),_0x7c21('0x3a')]))['where'](_0x7c21('0x3b'),selectNotIn(_0x2d249d,_0x5d2a71,_0x18dae7,_0x7c21('0x43'),[_0x7c21('0x3c')])))[_0x7c21('0x3d')]();return _0x333377;}function insertTzCmHopperBlack(_0x505d5e,_0x201750,_0x651e6b,_0x391fde){var _0x1d77d6=[_0x7c21('0x25'),_0x7c21('0x26'),_0x7c21('0x27'),_0x201750+'.'+_0x391fde,_0x7c21('0x28'),_0x7c21('0x29')];return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x3e'))['fromQuery'](['phone',_0x7c21('0x2d'),_0x7c21('0x2e'),_0x391fde,'createdAt',_0x7c21('0x30')],squel[_0x7c21('0xf')]()['fields'](_0x1d77d6)[_0x7c21('0x34')](_0x201750)[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x201750+_0x7c21('0x37'))[_0x7c21('0x12')](_0x651e6b,null,_0x651e6b+_0x7c21('0x13')+_0x201750+'.'+_0x391fde)[_0x7c21('0x14')](_0x201750+_0x7c21('0x38'),_0x505d5e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7c21('0xf')]()[_0x7c21('0x10')]('phone')[_0x7c21('0x34')](_0x7c21('0x3e'))[_0x7c21('0x14')](_0x7c21('0x46'),_0x505d5e)[_0x7c21('0x14')](_0x391fde+_0x7c21('0x15')+_0x201750+'.'+_0x391fde)))[_0x7c21('0x3d')]();}function insertCmHopperAdditionalPhones(_0xce667c){var _0x2eec19=[_0x7c21('0x47'),_0x7c21('0x48'),_0x7c21('0x49'),_0x7c21('0x4a'),_0x7c21('0x4b')];return squel[_0x7c21('0x42')]()[_0x7c21('0x2b')](_0x7c21('0x4c'))[_0x7c21('0x2c')]([_0x7c21('0x4d'),'phone',_0x7c21('0x4e'),'createdAt',_0x7c21('0x30')],squel['select']()['fields'](_0x2eec19)[_0x7c21('0x34')](_0x7c21('0x43'))[_0x7c21('0x12')](_0x7c21('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x7c21('0x12')](_0x7c21('0x4f'),null,_0x7c21('0x50'))[_0x7c21('0x14')](_0x7c21('0x51'),_0xce667c)[_0x7c21('0x14')](_0x7c21('0x39'),NOW))['toString']();}function insertCmContact(_0x390294,_0x1fac90,_0x220e0f,_0x30675b){var _0x4cd355=_[_0x7c21('0x52')](_[_0x7c21('0x53')](_0x30675b),['ListId',_0x7c21('0x54'),_0x7c21('0x2f'),'updatedAt',_0x7c21('0x55')]);return squel['insert']()[_0x7c21('0x2b')](_0x7c21('0x35'))['fromQuery'](_0x4cd355,squel[_0x7c21('0xf')]()['fields'](_0x4cd355)[_0x7c21('0x34')](_0x1fac90)['where']('('+_0x220e0f['join'](',')+_0x7c21('0x56'),squel[_0x7c21('0xf')]()['fields'](_0x220e0f)['from'](_0x7c21('0x35'))['where'](_0x7c21('0x46'),_0x390294)[_0x7c21('0x14')](_0x7c21('0x57')))[_0x7c21('0x14')](_0x7c21('0x58'),squel[_0x7c21('0xf')]()[_0x7c21('0x10')]('MIN(id)',_0x7c21('0x59'))[_0x7c21('0x34')](_0x1fac90)[_0x7c21('0x5a')](_0x220e0f[_0x7c21('0x12')](','))))[_0x7c21('0x3d')]();}function handleStop(){logger[_0x7c21('0x5b')](_0x7c21('0x5c'));stopped=!![];}function handleUncaughtException(_0x13a847){logger[_0x7c21('0x5d')](_0x13a847[_0x7c21('0x5e')]);process['exit'](0x1);}function handleError(_0x9879b4,_0x4ecb3c){stats[_0x7c21('0x5f')][_0x7c21('0x19')]({'name':_0x4ecb3c['code'],'message':_0x4ecb3c[_0x7c21('0x5e')],'row':_0x9879b4});}function handleQuery(_0x444acd){logger[_0x7c21('0x5b')](_0x444acd);return db[_0x7c21('0x60')][_0x7c21('0x61')](_0x444acd)[_0x7c21('0x62')](function(_0x2f149f){results['push'](_0x2f149f);})[_0x7c21('0x63')](function(_0x514a47){logger[_0x7c21('0x5d')](_0x514a47[_0x7c21('0x5e')]);});}function updateTzCampaigns(_0x28d0a8){return new Promise(function(_0x4d38f7,_0x72b75d){var _0x5d03f5=squel['select']()['fields'](['campaigns.id','campaigns.dialTimezone'])[_0x7c21('0x34')](_0x7c21('0x64'))[_0x7c21('0x12')]('campaigns_has_cm_lists',null,_0x7c21('0x65'))[_0x7c21('0x14')](_0x7c21('0x66')+_0x28d0a8);db[_0x7c21('0x60')][_0x7c21('0x61')](_0x5d03f5[_0x7c21('0x3d')]())[_0x7c21('0x62')](function(_0x49bc97){var _0x3355db=[];for(var _0x26af11=0x0;_0x26af11<_0x49bc97[_0x7c21('0x18')];_0x26af11++){_0x3355db[_0x7c21('0x19')](getTimezoneData(_0x49bc97[_0x26af11],tmp_campaigns));}BPromise[_0x7c21('0x1c')](_0x3355db)['then'](function(){_0x4d38f7({'val':0x1});});})[_0x7c21('0x63')](function(_0x4464d8){logger[_0x7c21('0x5d')](_0x4464d8[_0x7c21('0x5e')]);_0x4d38f7({'val':0x0});});});}function updateTzVoiceQueues(_0x271c36){return new Promise(function(_0x3a780f,_0x3835f7){var _0x4f76b7=squel[_0x7c21('0xf')]()['fields']([_0x7c21('0x67'),_0x7c21('0x68')])[_0x7c21('0x34')]('voice_queues')[_0x7c21('0x12')](_0x7c21('0x69'),null,_0x7c21('0x6a'))[_0x7c21('0x14')](_0x7c21('0x6b')+_0x271c36);db[_0x7c21('0x60')]['query'](_0x4f76b7[_0x7c21('0x3d')]())[_0x7c21('0x62')](function(_0x26f563){var _0x289fea=[];for(var _0x198508=0x0;_0x198508<_0x26f563[_0x7c21('0x18')];_0x198508++){_0x289fea['push'](getTimezoneData(_0x26f563[_0x198508],tmp_voice_queues));}BPromise['all'](_0x289fea)['then'](function(){_0x3a780f({'val':0x1});});})[_0x7c21('0x63')](function(_0x7beb65){logger[_0x7c21('0x5d')](_0x7beb65['message']);_0x3a780f({'val':0x0});});});}function getTimezoneData(_0x4a6a0a,_0x12471a){return new Promise(function(_0x3b33a3,_0x21bc06){var _0x36fdd1=shared[_0x7c21('0x6c')];var _0x36bc9d=_0x36fdd1[_0x4a6a0a[_0x7c21('0x6d')]];if(_[_0x7c21('0x1d')](_0x36bc9d)){_0x3b33a3({'ret':0x1});}else{var _0x5b6331=_0x36bc9d['utcOffset'];var _0x553dce=squel['insert']()[_0x7c21('0x2b')](_0x12471a)[_0x7c21('0x6e')]('id',_0x4a6a0a['id'])['set'](_0x7c21('0x6f'),_0x5b6331)[_0x7c21('0x6e')](_0x7c21('0x6d'),_0x4a6a0a[_0x7c21('0x6d')])['toString']();return db['sequelize']['query'](_0x553dce)['spread'](function(_0x8999ba){_0x3b33a3({'ret':0x1});})[_0x7c21('0x63')](function(_0x5b562e){logger[_0x7c21('0x5d')](_0x5b562e[_0x7c21('0x5e')]);_0x21bc06({'ret':0x1});});}});}function handleTZQuery(_0x496c00){logger['info'](_0x496c00);return db['sequelize'][_0x7c21('0x61')](_0x496c00)[_0x7c21('0x62')](function(_0xf71cad){})[_0x7c21('0x63')](function(_0x472ec2){logger[_0x7c21('0x5d')](_0x472ec2[_0x7c21('0x5e')]);});}function main(_0x3221dd,_0x13cb43,_0x2326fe,_0x27d6cd){logger['info'](_0x7c21('0x70'),_0x3221dd,JSON[_0x7c21('0x71')](_0x13cb43));process[_0x7c21('0x72')](_0x7c21('0x73'));var _0x20d57c=_0x13cb43[_0x7c21('0x74')];var _0x203df7=_[_0x7c21('0x75')](_0x20d57c);var _0x4f365c=_0x13cb43[_0x7c21('0x76')];var _0x3ea25a=path[_0x7c21('0x12')](config['root'],_0x7c21('0x77'),_0x4f365c+_0x7c21('0x78'));hasTZ=_[_0x7c21('0x53')](_0x20d57c)[_0x7c21('0x79')](_0x7c21('0x6d'));var _0x4984b7=_[_0x7c21('0x53')](_0x20d57c)[_0x7c21('0x12')]();logger[_0x7c21('0x5b')](_0x7c21('0x7a'),_0x4984b7);db[_0x7c21('0x7b')][_0x7c21('0x16')]({'raw':!![],'attributes':['id',_0x7c21('0x7c')]})[_0x7c21('0x1a')](function(_0x4c64ed){for(var _0x85f973=0x0;_0x85f973<_0x4c64ed[_0x7c21('0x18')];_0x85f973++){if(_0x4c64ed[_0x85f973][_0x7c21('0x7c')]in _0x20d57c){contactItemTypes[_0x7c21('0x19')](_0x4c64ed[_0x85f973]);delete _0x203df7[_0x4c64ed[_0x85f973]['name']];hasAdditionalPhones=!![];}for(var _0xcdc28b in _0x20d57c){if(_0x4c64ed[_0x85f973][_0x7c21('0x7c')]+_0x7c21('0x7d')===_0xcdc28b){phoneDescriptions[_0x7c21('0x19')]({'itemTypeId':_0x4c64ed[_0x85f973]['id'],'description':_0xcdc28b});delete _0x203df7[_0xcdc28b];}}}if(hasAdditionalPhones)_0x203df7[_0x7c21('0x17')]='';var _0x2c79ff=_['keys'](_0x203df7)[_0x7c21('0x12')]();logger[_0x7c21('0x5b')](_0x7c21('0x7a'),_0x2c79ff);fs['writeFileSync'](_0x3ea25a,_0x2c79ff+'\x0a');Papa[_0x7c21('0x7e')](fs['createReadStream'](_0x3221dd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x270870,_0xe16d7d){try{for(var _0x584d15=0x0,_0x441d5c=[];_0x584d15<_0x270870[_0x7c21('0x7f')][_0x7c21('0x18')];_0x584d15++){stats[_0x7c21('0x80')]+=0x1;if(_0x270870[_0x7c21('0x5f')][_0x584d15]){handleError(_0x270870['data'][_0x584d15],_0x270870[_0x7c21('0x5f')][_0x584d15]);}else{var _0x5dab01=[];var _0x46b4b0=[];var _0x4ee4b4={};for(var _0x3bb400 in _0x20d57c){let _0x523a33=contactItemTypes[_0x7c21('0x81')](_0x258041=>_0x258041[_0x7c21('0x7c')]===_0x3bb400);let _0x3f187f=contactItemTypes[_0x7c21('0x81')](_0x4e4ceb=>_0x4e4ceb[_0x7c21('0x7c')]+_0x7c21('0x7d')===_0x3bb400);if(_[_0x7c21('0x1d')](_0x523a33)&&_['isNil'](_0x3f187f)){if(_0x20d57c['hasOwnProperty'](_0x3bb400)){if(_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]]){var _0x74deff=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]]['replace'](/"/g,'\x27'));switch(_0x3bb400){case _0x7c21('0x44'):var _0x5485a2=moment(_0x74deff,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5485a2[_0x7c21('0x83')]()){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x84'));}break;case _0x7c21('0x45'):var _0x35c1b4=parseInt(_0x74deff);_0x74deff=_[_0x7c21('0x85')](_0x35c1b4)||_0x35c1b4<0x0||_0x35c1b4>0x4?_0x27d6cd?0x3:0x2:_0x35c1b4;_0x441d5c['push']('\x22'+_0x74deff+'\x22');break;case _0x7c21('0x31'):var _0x22552c=parseInt(_0x74deff);if(_[_0x7c21('0x86')](_0x22552c)&&_[_0x7c21('0x79')](_0x2326fe,_0x22552c)){_0x441d5c['push']('\x22'+_0x22552c+'\x22');}else{_0x5dab01['push'](_0x7c21('0x87'));}break;case _0x7c21('0x88'):if(isEmail(_0x74deff)){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x89'));}break;case _0x7c21('0x8a'):var _0x3d8122=moment(_0x74deff,'YYYY-MM-DD',!![]);if(_0x3d8122['isValid']()){_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}else{_0x5dab01[_0x7c21('0x19')](_0x7c21('0x8b'));}break;case _0x7c21('0x6d'):var _0x5eec84=shared[_0x7c21('0x6c')];var _0x511034=_0x5eec84[_0x74deff];if(!_['isNil'](_0x511034)){var _0x317bb9=_0x511034[_0x7c21('0x8c')];_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');_0x441d5c[_0x7c21('0x19')]('\x22'+_0x317bb9+'\x22');}break;default:_0x441d5c[_0x7c21('0x19')]('\x22'+_0x74deff+'\x22');}}else{switch(_0x3bb400){case _0x7c21('0x8d'):case _0x7c21('0x11'):_0x5dab01[_0x7c21('0x19')](_0x3bb400+_0x7c21('0x8e'));break;default:_0x441d5c[_0x7c21('0x19')]('\x22\x22');}}}}else{var _0x4196e9='';if(!_[_0x7c21('0x1d')](_0x523a33)){if(!_0x4ee4b4[_0x7c21('0x8f')](_0x523a33['id'])){if(!_[_0x7c21('0x1d')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]])){var _0x74deff=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x3bb400]][_0x7c21('0x90')](/"/g,'\x27'));var _0x2dc05f=phoneDescriptions[_0x7c21('0x81')](_0x1d0279=>_0x1d0279[_0x7c21('0x91')]===_0x523a33['id']);if(!_[_0x7c21('0x1d')](_0x2dc05f)){var _0x417449=_[_0x7c21('0x82')](_0x270870[_0x7c21('0x7f')][_0x584d15][_0x20d57c[_0x2dc05f[_0x7c21('0x92')]]][_0x7c21('0x90')](/"/g,'\x27'));if(!_['isNil'](_0x417449))_0x74deff=_0x74deff+'§'+_0x417449;}if(_0x4196e9=='')_0x4196e9=_0x74deff;else _0x4196e9+='|'+_0x74deff;}_0x46b4b0[_0x7c21('0x19')](_0x523a33['id']+':'+_0x4196e9);_0x4ee4b4[_0x523a33['id']]=0x1;}}}}if(hasAdditionalPhones){_0x441d5c['push']('\x22'+_0x46b4b0['join'](';')+'\x22');}if(_0x5dab01[_0x7c21('0x18')]){handleError(_0x270870[_0x7c21('0x7f')][_0x584d15],{'code':_0x7c21('0x93'),'message':_0x5dab01[_0x7c21('0x12')]()});}else{fs['appendFileSync'](_0x3ea25a,_0x441d5c[_0x7c21('0x12')]()+'\x0a');}_0x441d5c=[];}if(!(stats[_0x7c21('0x80')]%0xc8)){socket[_0x7c21('0x94')](_0x7c21('0x95')+_0x4f365c,stats);stats[_0x7c21('0x5f')]=[];}}if(stopped){logger[_0x7c21('0x5b')](_0x7c21('0x96'));_0xe16d7d[_0x7c21('0x97')]();}}catch(_0x43ff88){handleError(_0x270870[_0x7c21('0x7f')][_0x584d15],{'code':_0x7c21('0x98'),'message':_0x43ff88[_0x7c21('0x5e')]});logger[_0x7c21('0x5d')](_0x7c21('0x99'),_0x43ff88[_0x7c21('0x5e')]);}},'complete':function(){try{var _0x1dc2a8=[];var _0x55bcb5=[];var _0x49496d=_0x7c21('0x35');if(_0x13cb43[_0x7c21('0x9a')]&&_0x13cb43[_0x7c21('0x9a')][_0x7c21('0x18')]){_0x49496d=_0x7c21('0x9b')+_0x4f365c;_0x1dc2a8[_0x7c21('0x19')](_0x7c21('0x9c')+_0x49496d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7c21('0x9d')+_0x4f365c;tmp_voice_queues=_0x7c21('0x9e')+_0x4f365c;_0x55bcb5[_0x7c21('0x19')](_0x7c21('0x9c')+tmp_campaigns+_0x7c21('0x9f'));_0x55bcb5[_0x7c21('0x19')](_0x7c21('0x9c')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x55bcb5,handleTZQuery)[_0x7c21('0x1a')](function(_0x2d5270){updateTzCampaigns(_0x13cb43[_0x7c21('0x2e')])['then'](function(_0x5c0430){updateTzVoiceQueues(_0x13cb43[_0x7c21('0x2e')])[_0x7c21('0x1a')](function(_0x1a3487){if(hasTZ)_0x2c79ff=_0x2c79ff[_0x7c21('0x90')](_0x7c21('0x6d'),_0x7c21('0xa0'));var _0xfa57de=util['format'](_0x7c21('0xa1'),_0x3ea25a,_0x49496d,_0x2c79ff,_0x13cb43[_0x7c21('0x2e')],_0x13cb43['CompanyId']||null,NOW,NOW);if(_[_0x7c21('0x1d')](_0x20d57c[_0x7c21('0x44')])){_0xfa57de+=_0x7c21('0xa2');}_0x1dc2a8[_0x7c21('0x19')](_0xfa57de);if(_0x13cb43[_0x7c21('0x9a')]&&_0x13cb43[_0x7c21('0x9a')][_0x7c21('0x18')]){_0x1dc2a8[_0x7c21('0x19')](insertCmContact(_0x13cb43[_0x7c21('0x2e')],_0x49496d,_0x13cb43[_0x7c21('0x9a')],_0x20d57c));_0x1dc2a8[_0x7c21('0x19')](_0x7c21('0xa3')+_0x49496d+';');}BPromise[_0x7c21('0xa4')](_0x1dc2a8,handleQuery)['then'](function(_0x2abb60){BPromise[_0x7c21('0x1c')]([handleAdditionalPhones()])[_0x7c21('0x1a')](function(){_0x1dc2a8=[];for(var _0x2ebd31=0x0;_0x2ebd31\x20\x20','server/files/tmp','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available'];(function(_0x8379ca,_0x5095bd){var _0x5f3952=function(_0x4832ff){while(--_0x4832ff){_0x8379ca['push'](_0x8379ca['shift']());}};_0x5f3952(++_0x5095bd);}(_0xc863,0xb6));var _0x3c86=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xc863[_0x349367];return _0x14179b;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x3c86('0x0'));var util=require(_0x3c86('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x3c86('0x2'));var Redis=require('ioredis');var db=require(_0x3c86('0x3'))['db'];var config=require(_0x3c86('0x4'));var shared=require(_0x3c86('0x5'));var logger=require(_0x3c86('0x6'))(_0x3c86('0x7'));config[_0x3c86('0x8')]=_['defaults'](config[_0x3c86('0x8')],{'host':_0x3c86('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c86('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x3c86('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x3c86('0xa')](_0x3c86('0xb'));function isEmail(_0x1d9c9d){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))*$/[_0x3c86('0xc')](_0x1d9c9d);}function selectNotIn(_0x1af37a,_0x3b6da2,_0x4fd2fb,_0x4aa944,_0x5e00b3){return squel[_0x3c86('0xd')]()[_0x3c86('0xe')](_0x3c86('0xf'))[_0x3c86('0x10')](_0x4aa944)[_0x3c86('0x11')](_0x3b6da2,null,_0x3b6da2+_0x3c86('0x12')+_0x4aa944+'.'+_0x4fd2fb)['where'](_0x4aa944+'.'+_0x4fd2fb+_0x3c86('0x13')+_0x1af37a+'.'+_0x4fd2fb)[_0x3c86('0x14')](_0x3b6da2+_0x3c86('0x15')+_0x5e00b3['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x23a7e5,_0x2b644e){promisesAdditionalPhones=[];return db['CmContact'][_0x3c86('0x16')]({'raw':!![],'attributes':['id',_0x3c86('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x3c86('0x18')](function(_0xe03b3b){if(_0xe03b3b!==null){var _0x57d8f5=[];for(var _0x2ce84c=0x0;_0x2ce84c<_0xe03b3b[_0x3c86('0x19')];_0x2ce84c++){var _0x42af41=_0xe03b3b[_0x2ce84c];_0x57d8f5[_0x3c86('0x1a')](insertAdditionalPhones(_0x42af41));}}Promise[_0x3c86('0x1b')](_0x57d8f5)[_0x3c86('0x18')](function(){_0x23a7e5({'val':0x1});});});});}function insertAdditionalPhones(_0x4292e4){return new Promise(function(_0x5f386e,_0xa7008e){var _0x52f3fb=_0x4292e4[_0x3c86('0x17')];var _0xfc1305=_0x52f3fb['split'](';');var _0x1cea64=[];orderBy=0x0;for(var _0x2c9eeb=0x0;_0x2c9eeb<_0xfc1305[_0x3c86('0x19')];_0x2c9eeb++){_0x1cea64[_0x3c86('0x1a')](splitAdditionalPhone(_0x4292e4['id'],_0xfc1305[_0x2c9eeb]));}Promise['all'](_0x1cea64)['then'](function(){_0x5f386e({'val':_0xfc1305[_0x3c86('0x19')]});});});}function splitAdditionalPhone(_0x39a05d,_0x13f62d){return new Promise(function(_0x4df2bb,_0x388939){var _0x35303c=_0x13f62d[_0x3c86('0x1c')](':');var _0x2043b2=_0x35303c[0x0];var _0x46cb0a=_0x35303c[0x1];if(!_[_0x3c86('0x1d')](_0x46cb0a)){var _0xf2ae06=_0x46cb0a['split']('|');var _0x5a5696=[];for(var _0x2567f8=0x0;_0x2567f8<_0xf2ae06['length'];_0x2567f8++){if(_0xf2ae06[_0x2567f8]!==''){var _0x13f385=_[_0x3c86('0x1e')](promisesAdditionalPhones,{'contactId':_0x39a05d,'phone':_0xf2ae06[_0x2567f8]});if(_0x13f385[_0x3c86('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x3c86('0x1a')]({'contactId':_0x39a05d,'contactTypeId':_0x2043b2,'phone':_0xf2ae06[_0x2567f8],'orderBy':orderBy});}}}_0x4df2bb({'ok':0x1});}else _0x4df2bb({'res':0x0});});}function createAdditionalPhone(_0x568274,_0x40e4e5,_0x149060,_0x205729){var _0x2e2a07='';var _0x17b185='';var _0x55d2c8=_0x149060[_0x3c86('0x1c')]('§');_0x2e2a07=_0x55d2c8[0x0];if(_0x55d2c8[_0x3c86('0x19')]==0x2)_0x17b185=_0x55d2c8[0x1];return new Promise(function(_0x33c6f2,_0x858fd0){return db['CmContactHasItem'][_0x3c86('0x1f')]({'where':{'CmContactId':_0x568274,'item':_0x2e2a07}})['then'](function(_0x5145f8){if(_0x5145f8){return db[_0x3c86('0x20')][_0x3c86('0x21')]({'ItemTypeId':_0x40e4e5,'description':_0x17b185,'OrderBy':_0x205729},{'where':{'CmContactId':_0x568274,'item':_0x2e2a07}})[_0x3c86('0x18')](function(_0x375b67){_0x33c6f2({'res':_0x3c86('0x22')});});}else{return db[_0x3c86('0x20')]['create']({'CmContactId':_0x568274,'item':_0x2e2a07,'description':_0x17b185,'ItemTypeId':_0x40e4e5,'OrderBy':_0x205729,'ItemClass':_0x3c86('0x23')})['then'](function(_0x108e61){_0x33c6f2({'res':'inserted'});});}});});}function insertCmHopper(_0x5d5bcd,_0x2d8cf4,_0x22d3c3,_0x370343,_0x116ca0){var _0x16136e=[_0x3c86('0x24'),_0x3c86('0x25'),_0x3c86('0x26'),'cm_contacts.ListId',_0x2d8cf4+'.'+_0x370343,_0x3c86('0x27'),_0x3c86('0x28'),_0x3c86('0x29'),'cm_contacts.UserId','\x22'+_0x116ca0+'\x22'];return squel[_0x3c86('0x2a')]()[_0x3c86('0x2b')](_0x3c86('0x2c'))['fromQuery']([_0x3c86('0xf'),_0x3c86('0x2d'),'ContactId',_0x3c86('0x2e'),_0x370343,_0x3c86('0x2f'),'updatedAt',_0x3c86('0x30'),_0x3c86('0x31'),_0x3c86('0x32')],squel[_0x3c86('0xd')]()['fields'](_0x16136e)[_0x3c86('0x10')](_0x2d8cf4)[_0x3c86('0x11')](_0x3c86('0x33'),null,_0x3c86('0x34')+_0x2d8cf4+_0x3c86('0x35'))[_0x3c86('0x11')](_0x22d3c3,null,_0x22d3c3+'.id\x20=\x20'+_0x2d8cf4+'.'+_0x370343)[_0x3c86('0x14')](_0x2d8cf4+_0x3c86('0x36'),_0x5d5bcd)[_0x3c86('0x14')](_0x3c86('0x37'),NOW)[_0x3c86('0x14')](_0x3c86('0x38'),selectNotIn(_0x2d8cf4,_0x22d3c3,_0x370343,_0x3c86('0x2c'),[_0x3c86('0x39'),_0x3c86('0x3a')]))[_0x3c86('0x14')](_0x3c86('0x38'),selectNotIn(_0x2d8cf4,_0x22d3c3,_0x370343,_0x3c86('0x2c'),[_0x3c86('0x39')])))[_0x3c86('0x3b')]();}function insertCmHopperBlack(_0x4336cb,_0x22d69c,_0x4665e6,_0x5a02aa){var _0x15bac7=[_0x3c86('0x24'),'cm_contacts.id',_0x3c86('0x3c'),_0x22d69c+'.'+_0x5a02aa,_0x3c86('0x27'),_0x3c86('0x28')];return squel['insert']()['into']('cm_hopper_black')[_0x3c86('0x3d')]([_0x3c86('0xf'),_0x3c86('0x3e'),_0x3c86('0x2e'),_0x5a02aa,_0x3c86('0x2f'),_0x3c86('0x3f')],squel[_0x3c86('0xd')]()[_0x3c86('0x40')](_0x15bac7)[_0x3c86('0x10')](_0x22d69c)['join'](_0x3c86('0x33'),null,_0x3c86('0x34')+_0x22d69c+_0x3c86('0x35'))[_0x3c86('0x11')](_0x4665e6,null,_0x4665e6+'.id\x20=\x20'+_0x22d69c+'.'+_0x5a02aa)[_0x3c86('0x14')](_0x22d69c+_0x3c86('0x36'),_0x4336cb)['where'](_0x3c86('0x37'),NOW)[_0x3c86('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3c86('0xd')]()['field'](_0x3c86('0xf'))[_0x3c86('0x10')](_0x3c86('0x41'))[_0x3c86('0x14')](_0x3c86('0x42'),_0x4336cb)['where'](_0x5a02aa+'\x20=\x20'+_0x22d69c+'.'+_0x5a02aa)))['toString']();}function insertTzCmHopper(_0x68d8fb,_0xca3ef9,_0x12f5ac,_0x2f0124,_0x5754a5,_0x387fdc){var _0x1f5430=['cm_contacts.phone',_0x3c86('0x43')+_0x387fdc+'.offset-cm_contacts.utcOffset\x20minute)',_0x3c86('0x26'),_0x3c86('0x3c'),_0xca3ef9+'.'+_0x2f0124,'cm_contacts.createdAt',_0x3c86('0x28'),_0x3c86('0x29'),_0x3c86('0x44'),'\x22'+_0x5754a5+'\x22'];var _0x210962=squel['insert']()['into'](_0x3c86('0x2c'))[_0x3c86('0x3d')]([_0x3c86('0xf'),_0x3c86('0x2d'),_0x3c86('0x3e'),'ListId',_0x2f0124,_0x3c86('0x2f'),_0x3c86('0x3f'),_0x3c86('0x30'),_0x3c86('0x31'),_0x3c86('0x32')],squel[_0x3c86('0xd')]()[_0x3c86('0x40')](_0x1f5430)[_0x3c86('0x10')](_0xca3ef9)[_0x3c86('0x11')](_0x3c86('0x33'),null,_0x3c86('0x34')+_0xca3ef9+_0x3c86('0x35'))['join'](_0x12f5ac,null,_0x12f5ac+_0x3c86('0x12')+_0xca3ef9+'.'+_0x2f0124)['join'](_0x387fdc,null,_0x387fdc+_0x3c86('0x12')+_0xca3ef9+'.'+_0x2f0124)[_0x3c86('0x14')](_0xca3ef9+_0x3c86('0x36'),_0x68d8fb)[_0x3c86('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3c86('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xca3ef9,_0x12f5ac,_0x2f0124,_0x3c86('0x2c'),[_0x3c86('0x39'),_0x3c86('0x3a')]))['where'](_0x3c86('0x38'),selectNotIn(_0xca3ef9,_0x12f5ac,_0x2f0124,_0x3c86('0x2c'),[_0x3c86('0x39')])))['toString']();return _0x210962;}function insertTzCmHopperBlack(_0x852012,_0x1abfe8,_0x372475,_0x7d0183){var _0x1b17ef=[_0x3c86('0x24'),_0x3c86('0x26'),'cm_contacts.ListId',_0x1abfe8+'.'+_0x7d0183,'cm_contacts.createdAt',_0x3c86('0x28')];return squel[_0x3c86('0x2a')]()[_0x3c86('0x2b')](_0x3c86('0x41'))[_0x3c86('0x3d')]([_0x3c86('0xf'),_0x3c86('0x3e'),_0x3c86('0x2e'),_0x7d0183,_0x3c86('0x2f'),_0x3c86('0x3f')],squel['select']()[_0x3c86('0x40')](_0x1b17ef)['from'](_0x1abfe8)[_0x3c86('0x11')](_0x3c86('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x1abfe8+_0x3c86('0x35'))[_0x3c86('0x11')](_0x372475,null,_0x372475+_0x3c86('0x12')+_0x1abfe8+'.'+_0x7d0183)['where'](_0x1abfe8+_0x3c86('0x36'),_0x852012)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3c86('0x38'),squel[_0x3c86('0xd')]()['field'](_0x3c86('0xf'))[_0x3c86('0x10')](_0x3c86('0x41'))[_0x3c86('0x14')](_0x3c86('0x42'),_0x852012)[_0x3c86('0x14')](_0x7d0183+_0x3c86('0x13')+_0x1abfe8+'.'+_0x7d0183)))[_0x3c86('0x3b')]();}function insertCmHopperAdditionalPhones(_0x184a87){var _0x284747=['cm_hopper.id',_0x3c86('0x45'),'cm_contact_has_items.OrderBy',_0x3c86('0x46'),_0x3c86('0x47')];return squel[_0x3c86('0x2a')]()[_0x3c86('0x2b')]('cm_hopper_additional_phones')[_0x3c86('0x3d')]([_0x3c86('0x48'),_0x3c86('0xf'),_0x3c86('0x49'),_0x3c86('0x2f'),_0x3c86('0x3f')],squel[_0x3c86('0xd')]()[_0x3c86('0x40')](_0x284747)[_0x3c86('0x10')](_0x3c86('0x2c'))[_0x3c86('0x11')]('cm_contacts',null,_0x3c86('0x4a'))[_0x3c86('0x11')](_0x3c86('0x4b'),null,_0x3c86('0x4c'))[_0x3c86('0x14')]('cm_hopper.ListId\x20=\x20?',_0x184a87)[_0x3c86('0x14')](_0x3c86('0x37'),NOW))[_0x3c86('0x3b')]();}function insertCmContact(_0x395d68,_0x4f9dc0,_0x18d5f0,_0x3970a8){var _0xe72201=_[_0x3c86('0x4d')](_[_0x3c86('0x4e')](_0x3970a8),['ListId','CompanyId',_0x3c86('0x2f'),_0x3c86('0x3f'),_0x3c86('0x4f')]);return squel[_0x3c86('0x2a')]()[_0x3c86('0x2b')](_0x3c86('0x33'))[_0x3c86('0x3d')](_0xe72201,squel[_0x3c86('0xd')]()['fields'](_0xe72201)[_0x3c86('0x10')](_0x4f9dc0)['where']('('+_0x18d5f0[_0x3c86('0x11')](',')+_0x3c86('0x50'),squel[_0x3c86('0xd')]()[_0x3c86('0x40')](_0x18d5f0)['from'](_0x3c86('0x33'))[_0x3c86('0x14')](_0x3c86('0x42'),_0x395d68)[_0x3c86('0x14')]('deletedAt\x20IS\x20NULL'))[_0x3c86('0x14')](_0x3c86('0x51'),squel[_0x3c86('0xd')]()[_0x3c86('0xe')]('MIN(id)',_0x3c86('0x52'))[_0x3c86('0x10')](_0x4f9dc0)[_0x3c86('0x53')](_0x18d5f0[_0x3c86('0x11')](','))))[_0x3c86('0x3b')]();}function handleStop(){logger[_0x3c86('0x54')](_0x3c86('0x55'));stopped=!![];}function handleUncaughtException(_0x505eb5){logger[_0x3c86('0x56')](_0x505eb5['message']);process[_0x3c86('0x57')](0x1);}function handleError(_0x58872c,_0x4046f0){stats['errors']['push']({'name':_0x4046f0[_0x3c86('0x58')],'message':_0x4046f0[_0x3c86('0x59')],'row':_0x58872c});}function handleQuery(_0x6a6614){logger['info'](_0x6a6614);return db[_0x3c86('0x5a')]['query'](_0x6a6614)[_0x3c86('0x5b')](function(_0x3d917d){results[_0x3c86('0x1a')](_0x3d917d);})[_0x3c86('0x5c')](function(_0x43acd3){logger[_0x3c86('0x56')](_0x43acd3[_0x3c86('0x59')]);});}function updateTzCampaigns(_0x6ee4fb){return new Promise(function(_0x3e0bec,_0x4195fc){var _0x7c6ddd=squel['select']()['fields']([_0x3c86('0x5d'),_0x3c86('0x5e')])[_0x3c86('0x10')](_0x3c86('0x5f'))[_0x3c86('0x11')](_0x3c86('0x60'),null,_0x3c86('0x61'))[_0x3c86('0x14')]('campaigns_has_cm_lists.CmListId='+_0x6ee4fb);db[_0x3c86('0x5a')][_0x3c86('0x62')](_0x7c6ddd[_0x3c86('0x3b')]())['spread'](function(_0x2ab753){var _0x29c6c4=[];for(var _0x2fec20=0x0;_0x2fec20<_0x2ab753[_0x3c86('0x19')];_0x2fec20++){_0x29c6c4[_0x3c86('0x1a')](getTimezoneData(_0x2ab753[_0x2fec20],tmp_campaigns));}BPromise[_0x3c86('0x1b')](_0x29c6c4)[_0x3c86('0x18')](function(){_0x3e0bec({'val':0x1});});})[_0x3c86('0x5c')](function(_0x4f5074){logger[_0x3c86('0x56')](_0x4f5074[_0x3c86('0x59')]);_0x3e0bec({'val':0x0});});});}function updateTzVoiceQueues(_0x51b067){return new Promise(function(_0x17fc6f,_0x54cdc3){var _0x40ae99=squel[_0x3c86('0xd')]()[_0x3c86('0x40')]([_0x3c86('0x63'),_0x3c86('0x64')])[_0x3c86('0x10')](_0x3c86('0x65'))[_0x3c86('0x11')]('voice_queues_has_cm_lists',null,_0x3c86('0x66'))[_0x3c86('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x51b067);db[_0x3c86('0x5a')]['query'](_0x40ae99[_0x3c86('0x3b')]())[_0x3c86('0x5b')](function(_0x2ecbdc){var _0x50e221=[];for(var _0x3ee373=0x0;_0x3ee373<_0x2ecbdc[_0x3c86('0x19')];_0x3ee373++){_0x50e221[_0x3c86('0x1a')](getTimezoneData(_0x2ecbdc[_0x3ee373],tmp_voice_queues));}BPromise['all'](_0x50e221)[_0x3c86('0x18')](function(){_0x17fc6f({'val':0x1});});})['catch'](function(_0xe6cdb0){logger[_0x3c86('0x56')](_0xe6cdb0[_0x3c86('0x59')]);_0x17fc6f({'val':0x0});});});}function getTimezoneData(_0x45bf5a,_0x5b8c88){return new Promise(function(_0x4c6465,_0x4dfc25){var _0x58b791=shared[_0x3c86('0x67')];var _0x29080f=_0x58b791[_0x45bf5a[_0x3c86('0x68')]];if(_[_0x3c86('0x1d')](_0x29080f)){_0x4c6465({'ret':0x1});}else{var _0xae75c2=_0x29080f[_0x3c86('0x69')];var _0x227f1e=squel['insert']()[_0x3c86('0x2b')](_0x5b8c88)['set']('id',_0x45bf5a['id'])[_0x3c86('0x6a')](_0x3c86('0x6b'),_0xae75c2)['set'](_0x3c86('0x68'),_0x45bf5a[_0x3c86('0x68')])['toString']();return db[_0x3c86('0x5a')]['query'](_0x227f1e)['spread'](function(_0x3848a5){_0x4c6465({'ret':0x1});})['catch'](function(_0x2e9256){logger[_0x3c86('0x56')](_0x2e9256[_0x3c86('0x59')]);_0x4dfc25({'ret':0x1});});}});}function handleTZQuery(_0x1db0ee){logger['info'](_0x1db0ee);return db[_0x3c86('0x5a')][_0x3c86('0x62')](_0x1db0ee)[_0x3c86('0x5b')](function(_0x438070){})['catch'](function(_0x4fd037){logger['error'](_0x4fd037['message']);});}function main(_0x32b292,_0x5e6505,_0x18c11,_0x5e67a0){logger[_0x3c86('0x54')](_0x3c86('0x6c'),_0x32b292,JSON['stringify'](_0x5e6505));process[_0x3c86('0x6d')]('start');var _0x538e2d=_0x5e6505[_0x3c86('0x6e')];var _0x556dfa=_[_0x3c86('0x6f')](_0x538e2d);var _0x8c7f30=_0x5e6505[_0x3c86('0x70')];var _0x369cc5=path[_0x3c86('0x11')](config[_0x3c86('0x71')],'server/files/tmp',_0x8c7f30+_0x3c86('0x72'));hasTZ=_[_0x3c86('0x4e')](_0x538e2d)[_0x3c86('0x73')](_0x3c86('0x68'));var _0x11b55b=_[_0x3c86('0x4e')](_0x538e2d)[_0x3c86('0x11')]();logger['info'](_0x3c86('0x74'),_0x11b55b);db[_0x3c86('0x75')][_0x3c86('0x16')]({'raw':!![],'attributes':['id',_0x3c86('0x76')]})[_0x3c86('0x18')](function(_0x42acfa){for(var _0x2cc15d=0x0;_0x2cc15d<_0x42acfa[_0x3c86('0x19')];_0x2cc15d++){if(_0x42acfa[_0x2cc15d]['name']in _0x538e2d){contactItemTypes[_0x3c86('0x1a')](_0x42acfa[_0x2cc15d]);delete _0x556dfa[_0x42acfa[_0x2cc15d][_0x3c86('0x76')]];hasAdditionalPhones=!![];}for(var _0x5e665f in _0x538e2d){if(_0x42acfa[_0x2cc15d][_0x3c86('0x76')]+'_description'===_0x5e665f){phoneDescriptions[_0x3c86('0x1a')]({'itemTypeId':_0x42acfa[_0x2cc15d]['id'],'description':_0x5e665f});delete _0x556dfa[_0x5e665f];}}}if(hasAdditionalPhones)_0x556dfa[_0x3c86('0x17')]='';var _0x425235=_['keys'](_0x556dfa)[_0x3c86('0x11')]();logger[_0x3c86('0x54')]('header',_0x425235);fs[_0x3c86('0x77')](_0x369cc5,_0x425235+'\x0a');Papa['parse'](fs[_0x3c86('0x78')](_0x32b292),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e0d99,_0x4d80a2){try{for(var _0x59b781=0x0,_0x379d0b=[];_0x59b781<_0x3e0d99[_0x3c86('0x79')][_0x3c86('0x19')];_0x59b781++){stats[_0x3c86('0x7a')]+=0x1;if(_0x3e0d99['errors'][_0x59b781]){handleError(_0x3e0d99[_0x3c86('0x79')][_0x59b781],_0x3e0d99['errors'][_0x59b781]);}else{var _0xab1b56=[];var _0x2c9489=[];var _0x5c04aa={};for(var _0x43ba45 in _0x538e2d){let _0x3f0973=contactItemTypes[_0x3c86('0x7b')](_0x4c34ec=>_0x4c34ec['name']===_0x43ba45);let _0x59f29d=contactItemTypes[_0x3c86('0x7b')](_0x3882bf=>_0x3882bf[_0x3c86('0x76')]+_0x3c86('0x7c')===_0x43ba45);if(_[_0x3c86('0x1d')](_0x3f0973)&&_[_0x3c86('0x1d')](_0x59f29d)){if(_0x538e2d[_0x3c86('0x7d')](_0x43ba45)){if(_0x3e0d99[_0x3c86('0x79')][_0x59b781][_0x538e2d[_0x43ba45]]){var _0x386552=_['trim'](_0x3e0d99[_0x3c86('0x79')][_0x59b781][_0x538e2d[_0x43ba45]][_0x3c86('0x7e')](/"/g,'\x27'));switch(_0x43ba45){case'scheduledat':var _0x2ccc7a=moment(_0x386552,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2ccc7a[_0x3c86('0x7f')]()){_0x379d0b['push']('\x22'+_0x386552+'\x22');}else{_0xab1b56[_0x3c86('0x1a')](_0x3c86('0x80'));}break;case _0x3c86('0x30'):var _0x253e3e=parseInt(_0x386552);_0x386552=_['isNaN'](_0x253e3e)||_0x253e3e<0x0||_0x253e3e>0x4?_0x5e67a0?0x3:0x2:_0x253e3e;_0x379d0b[_0x3c86('0x1a')]('\x22'+_0x386552+'\x22');break;case'UserId':var _0x4cdf05=parseInt(_0x386552);if(_[_0x3c86('0x81')](_0x4cdf05)&&_[_0x3c86('0x73')](_0x18c11,_0x4cdf05)){_0x379d0b[_0x3c86('0x1a')]('\x22'+_0x4cdf05+'\x22');}else{_0xab1b56['push'](_0x3c86('0x82'));}break;case _0x3c86('0x83'):if(isEmail(_0x386552)){_0x379d0b['push']('\x22'+_0x386552+'\x22');}else{_0xab1b56[_0x3c86('0x1a')](_0x3c86('0x84'));}break;case'dateOfBirth':var _0x8afae8=moment(_0x386552,'YYYY-MM-DD',!![]);if(_0x8afae8['isValid']()){_0x379d0b[_0x3c86('0x1a')]('\x22'+_0x386552+'\x22');}else{_0xab1b56['push'](_0x3c86('0x85'));}break;case _0x3c86('0x68'):var _0x2ddcea=shared[_0x3c86('0x67')];var _0xbc5d11=_0x2ddcea[_0x386552];if(!_['isNil'](_0xbc5d11)){var _0x27f106=_0xbc5d11['utcOffset'];_0x379d0b[_0x3c86('0x1a')]('\x22'+_0x386552+'\x22');_0x379d0b['push']('\x22'+_0x27f106+'\x22');}break;default:_0x379d0b[_0x3c86('0x1a')]('\x22'+_0x386552+'\x22');}}else{switch(_0x43ba45){case _0x3c86('0x86'):case _0x3c86('0xf'):_0xab1b56['push'](_0x43ba45+_0x3c86('0x87'));break;default:_0x379d0b[_0x3c86('0x1a')]('\x22\x22');}}}}else{var _0x2ec548='';if(!_[_0x3c86('0x1d')](_0x3f0973)){if(!_0x5c04aa[_0x3c86('0x7d')](_0x3f0973['id'])){if(!_[_0x3c86('0x1d')](_0x3e0d99[_0x3c86('0x79')][_0x59b781][_0x538e2d[_0x43ba45]])){var _0x386552=_['trim'](_0x3e0d99[_0x3c86('0x79')][_0x59b781][_0x538e2d[_0x43ba45]][_0x3c86('0x7e')](/"/g,'\x27'));var _0x198934=phoneDescriptions[_0x3c86('0x7b')](_0x134bf1=>_0x134bf1[_0x3c86('0x88')]===_0x3f0973['id']);if(!_[_0x3c86('0x1d')](_0x198934)){var _0x5eed58=_[_0x3c86('0x89')](_0x3e0d99[_0x3c86('0x79')][_0x59b781][_0x538e2d[_0x198934[_0x3c86('0x8a')]]][_0x3c86('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x5eed58))_0x386552=_0x386552+'§'+_0x5eed58;}if(_0x2ec548=='')_0x2ec548=_0x386552;else _0x2ec548+='|'+_0x386552;}_0x2c9489[_0x3c86('0x1a')](_0x3f0973['id']+':'+_0x2ec548);_0x5c04aa[_0x3f0973['id']]=0x1;}}}}if(hasAdditionalPhones){_0x379d0b['push']('\x22'+_0x2c9489[_0x3c86('0x11')](';')+'\x22');}if(_0xab1b56[_0x3c86('0x19')]){handleError(_0x3e0d99[_0x3c86('0x79')][_0x59b781],{'code':_0x3c86('0x8b'),'message':_0xab1b56[_0x3c86('0x11')]()});}else{fs[_0x3c86('0x8c')](_0x369cc5,_0x379d0b['join']()+'\x0a');}_0x379d0b=[];}if(!(stats[_0x3c86('0x7a')]%0xc8)){socket['emit'](_0x3c86('0x8d')+_0x8c7f30,stats);stats[_0x3c86('0x8e')]=[];}}if(stopped){logger['info'](_0x3c86('0x8f'));_0x4d80a2['abort']();}}catch(_0x5694a2){handleError(_0x3e0d99[_0x3c86('0x79')][_0x59b781],{'code':'SystemError','message':_0x5694a2['message']});logger['error'](_0x3c86('0x90'),_0x5694a2[_0x3c86('0x59')]);}},'complete':function(){try{var _0x9b5abc=[];var _0x11b78b=[];var _0x49bec9='cm_contacts';if(_0x5e6505[_0x3c86('0x91')]&&_0x5e6505[_0x3c86('0x91')][_0x3c86('0x19')]){_0x49bec9=_0x3c86('0x92')+_0x8c7f30;_0x9b5abc[_0x3c86('0x1a')](_0x3c86('0x93')+_0x49bec9+_0x3c86('0x94'));}tmp_campaigns=_0x3c86('0x95')+_0x8c7f30;tmp_voice_queues=_0x3c86('0x96')+_0x8c7f30;_0x11b78b[_0x3c86('0x1a')](_0x3c86('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x11b78b[_0x3c86('0x1a')](_0x3c86('0x93')+tmp_voice_queues+_0x3c86('0x97'));BPromise[_0x3c86('0x98')](_0x11b78b,handleTZQuery)[_0x3c86('0x18')](function(_0x1f4958){updateTzCampaigns(_0x5e6505[_0x3c86('0x2e')])[_0x3c86('0x18')](function(_0x204e3d){updateTzVoiceQueues(_0x5e6505[_0x3c86('0x2e')])[_0x3c86('0x18')](function(_0x2d82ab){if(hasTZ)_0x425235=_0x425235[_0x3c86('0x7e')](_0x3c86('0x68'),_0x3c86('0x99'));var _0x1dcd64=util[_0x3c86('0xa')](_0x3c86('0x9a'),_0x369cc5,_0x49bec9,_0x425235,_0x5e6505[_0x3c86('0x2e')],_0x5e6505[_0x3c86('0x9b')]||null,NOW,NOW);if(_['isNil'](_0x538e2d[_0x3c86('0x2d')])){_0x1dcd64+=_0x3c86('0x9c');}_0x9b5abc[_0x3c86('0x1a')](_0x1dcd64);if(_0x5e6505['duplicates']&&_0x5e6505[_0x3c86('0x91')][_0x3c86('0x19')]){_0x9b5abc[_0x3c86('0x1a')](insertCmContact(_0x5e6505[_0x3c86('0x2e')],_0x49bec9,_0x5e6505[_0x3c86('0x91')],_0x538e2d));_0x9b5abc[_0x3c86('0x1a')]('DROP\x20TABLE\x20'+_0x49bec9+';');}BPromise[_0x3c86('0x98')](_0x9b5abc,handleQuery)[_0x3c86('0x18')](function(_0x45a5f5){BPromise['all']([handleAdditionalPhones()])[_0x3c86('0x18')](function(){_0x9b5abc=[];for(var _0xffe098=0x0;_0xffe098_0x5678b6[_0xd52e('0x6d')]===_0x4227d9);let _0x552f12=contactItemTypes[_0xd52e('0x76')](_0x56ce2b=>_0x56ce2b[_0xd52e('0x6d')]+'_description'===_0x4227d9);if(_[_0xd52e('0x1f')](_0x41ead1)&&_[_0xd52e('0x1f')](_0x552f12)){if(_0x301c73['hasOwnProperty'](_0x4227d9)){if(_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9]]){var _0x25c16c=_[_0xd52e('0x77')](_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9]][_0xd52e('0x78')](/"/g,'\x27'));switch(_0x4227d9){case'scheduledat':var _0x417311=moment(_0x25c16c,_0xd52e('0xd'),!![]);if(_0x417311[_0xd52e('0x79')]()){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2[_0xd52e('0x26')](_0xd52e('0x7a'));}break;case _0xd52e('0x41'):var _0x2e9bff=parseInt(_0x25c16c);_0x25c16c=_['isNaN'](_0x2e9bff)||_0x2e9bff<0x0||_0x2e9bff>0x4?_0x7be33d?0x3:0x2:_0x2e9bff;_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');break;case'UserId':var _0x19860e=parseInt(_0x25c16c);if(_[_0xd52e('0x7b')](_0x19860e)&&_[_0xd52e('0x7c')](_0x30b4fc,_0x19860e)){_0x56407c[_0xd52e('0x26')]('\x22'+_0x19860e+'\x22');}else{_0x3f3ce2['push'](_0xd52e('0x7d'));}break;case _0xd52e('0x7e'):if(isEmail(_0x25c16c)){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2[_0xd52e('0x26')](_0xd52e('0x7f'));}break;case _0xd52e('0x80'):var _0x3a0612=moment(_0x25c16c,_0xd52e('0x81'),!![]);if(_0x3a0612[_0xd52e('0x79')]()){_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}else{_0x3f3ce2['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x56407c[_0xd52e('0x26')]('\x22'+_0x25c16c+'\x22');}}else{switch(_0x4227d9){case _0xd52e('0x82'):case _0xd52e('0x14'):_0x3f3ce2[_0xd52e('0x26')](_0x4227d9+_0xd52e('0x83'));break;default:_0x56407c['push']('\x22\x22');}}}}else{var _0x1c137a='';if(!_[_0xd52e('0x1f')](_0x41ead1)){if(!_0x3b0458[_0xd52e('0x84')](_0x41ead1['id'])){for(var _0x145d06=0x0;_0x145d06<_0x301c73[_0x4227d9]['length'];_0x145d06++){var _0x25c16c=_[_0xd52e('0x77')](_0x595c41[_0xd52e('0x74')][_0x12b4c1][_0x301c73[_0x4227d9][_0x145d06]]['replace'](/"/g,'\x27'));var _0x10987d=phoneDescriptions['find'](_0x5b633c=>_0x5b633c[_0xd52e('0x85')]===_0x41ead1['id']);if(!_[_0xd52e('0x1f')](_0x10987d)){var _0x4b17c4=_[_0xd52e('0x77')](_0x595c41['data'][_0x12b4c1][_0x301c73[_0x10987d[_0xd52e('0x86')]][0x0]][_0xd52e('0x78')](/"/g,'\x27'));if(!_['isNil'](_0x4b17c4))_0x25c16c=_0x25c16c+'§'+_0x4b17c4;}if(_0x1c137a=='')_0x1c137a=_0x25c16c;else _0x1c137a+='|'+_0x25c16c;}_0x395ae9[_0xd52e('0x26')](_0x41ead1['id']+':'+_0x1c137a);_0x3b0458[_0x41ead1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56407c['push']('\x22'+_0x395ae9[_0xd52e('0x19')](';')+'\x22');}if(_0x3f3ce2[_0xd52e('0x1e')]){handleError(_0x595c41[_0xd52e('0x74')][_0x12b4c1],{'code':_0xd52e('0x87'),'message':_0x3f3ce2[_0xd52e('0x19')]()});}else{fs['appendFileSync'](_0x9c66d3,_0x56407c[_0xd52e('0x19')]()+'\x0a');}_0x56407c=[];}if(!(stats[_0xd52e('0x75')]%0xc8)){socket[_0xd52e('0x88')](_0xd52e('0x89')+_0x46eb89,stats);stats[_0xd52e('0x62')]=[];}}if(stopped){logger[_0xd52e('0x5f')]('Abort\x20parser');_0x5ed614[_0xd52e('0x8a')]();}}catch(_0x4fa72e){handleError(_0x595c41[_0xd52e('0x74')][_0x12b4c1],{'code':_0xd52e('0x8b'),'message':_0x4fa72e[_0xd52e('0x24')]});logger['error'](_0xd52e('0x8c'),_0x4fa72e[_0xd52e('0x24')]);}},'complete':function(){try{var _0x27e53d=[];var _0x4d091a=tempTableName;_0x27e53d[_0xd52e('0x26')]('CREATE\x20TABLE\x20'+_0x4d091a+'\x20LIKE\x20cm_contacts;');logger['info'](_0xd52e('0x8d'),contactItemTypes[_0xd52e('0x1e')]);var _0x59cff3=util['format'](_0xd52e('0x8e'),_0x9c66d3,_0x4d091a,_0x5da9df,_0x4d39d8[_0xd52e('0x3f')],_0x4d39d8[_0xd52e('0x5a')]||null,NOW,NOW);if(_['isNil'](_0x301c73['scheduledat'])){_0x59cff3+=_0xd52e('0x8f');}_0x27e53d[_0xd52e('0x26')](_0x59cff3);BPromise['each'](_0x27e53d,handleQuery)[_0xd52e('0x21')](function(_0x2b815c){BPromise[_0xd52e('0x27')]([handleAdditionalPhones()])[_0xd52e('0x21')](function(){_0x27e53d=[];for(var _0x19c889=0x0;_0x19c889\x20\x20');}var _0x589339=path[_0xd52e('0x19')](config[_0xd52e('0x6a')],_0xd52e('0x98'),process[_0xd52e('0x97')][0x2]);if(!fs['existsSync'](_0x589339)){throw new Error(_0xd52e('0x99'));}var _0xea828f={};try{_0xea828f=JSON[_0xd52e('0x72')](process['argv'][0x3]);if(!_0xea828f[_0xd52e('0x9a')]){throw new Error(_0xd52e('0x9b'));}var _0x293a8a=0x0;if(_0xea828f[_0xd52e('0x9a')][_0xd52e('0x42')]){_0x293a8a=0x1;}if(!_0xea828f[_0xd52e('0x3f')]){throw new Error(_0xd52e('0x9c'));}}catch(_0x515d9e){throw new Error(_0xd52e('0x9d'));}var _0x357c07=[];try{_0x357c07=_[_0xd52e('0x9e')](JSON[_0xd52e('0x72')](process[_0xd52e('0x97')][0x4]),'id');}catch(_0x1b9ecb){logger[_0xd52e('0x5f')]('No\x20agent\x20available');}main(_0x589339,_0xea828f,_0x357c07,_0x293a8a);}validate();process['on'](_0xd52e('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x1053=['keys','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','isValid','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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','scheduledat',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','finish','affectedRows','emit','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','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','select','field','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','message','split','filter','CmContactHasItem','findOne','update','updated','create','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','insert','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','into','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','CompanyId','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','code','error','main','send','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','_description'];(function(_0x232006,_0x3d75e3){var _0x2d483c=function(_0x319c55){while(--_0x319c55){_0x232006['push'](_0x232006['shift']());}};_0x2d483c(++_0x3d75e3);}(_0x1053,0xd5));var _0x3105=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x1053[_0x4bb2b9];return _0x40e2a2;};'use strict';var fs=require('fs');var path=require(_0x3105('0x0'));var _=require(_0x3105('0x1'));var Papa=require(_0x3105('0x2'));var util=require(_0x3105('0x3'));var BPromise=require(_0x3105('0x4'));var moment=require(_0x3105('0x5'));var squel=require(_0x3105('0x6'));var Redis=require(_0x3105('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x3105('0x8'))(_0x3105('0x9'));config[_0x3105('0xa')]=_[_0x3105('0xb')](config['redis'],{'host':_0x3105('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x3105('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x3105('0xe')](_0x3105('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x254b89){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'](_0x254b89);}function selectNotIn(_0x4a7216,_0x4b7f8f,_0x26f663,_0x49b5d6,_0x191df9){return squel[_0x3105('0x10')]()[_0x3105('0x11')](_0x3105('0x12'))[_0x3105('0x13')](_0x49b5d6)[_0x3105('0x14')](_0x4b7f8f,null,_0x4b7f8f+'.id\x20=\x20'+_0x49b5d6+'.'+_0x26f663)['where'](_0x49b5d6+'.'+_0x26f663+_0x3105('0x15')+_0x4a7216+'.'+_0x26f663)[_0x3105('0x16')](_0x4b7f8f+_0x3105('0x17')+_0x191df9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x58e7a6,_0x238026){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3105('0x18')][_0x3105('0x19')](_0x3105('0x1a')+tempTableName)[_0x3105('0x1b')](function(_0x3f4dba){if(_0x3f4dba!==null){var _0x51ef4e=[];for(var _0x35f8a3=0x0;_0x35f8a3<_0x3f4dba[_0x3105('0x1c')];_0x35f8a3++){var _0x334afe=_0x3f4dba[_0x35f8a3];if(!_[_0x3105('0x1d')](_0x334afe['phone'])){if(!_[_0x3105('0x1d')](_0x334afe[_0x3105('0x1e')]))_0x51ef4e[_0x3105('0x1f')](insertAdditionalPhones(_0x334afe));promisesContact[_0x3105('0x1f')]({'contact':_0x334afe});}}}Promise[_0x3105('0x20')](_0x51ef4e)[_0x3105('0x21')](function(){_0x58e7a6({'val':0x1});});})[_0x3105('0x22')](function(_0x4eb676){logger['error'](_0x4eb676[_0x3105('0x23')]);});});}function insertAdditionalPhones(_0x276074){return new Promise(function(_0x47b22b,_0x530005){var _0x29809e=_0x276074['AdditionalPhones'];if(_[_0x3105('0x1d')](_0x29809e))_0x530005({'val':0x0});else{var _0x206184=_0x29809e[_0x3105('0x24')](';');var _0x11780d=[];orderBy=0x0;for(var _0x3e654a=0x0;_0x3e654a<_0x206184['length'];_0x3e654a++){_0x11780d[_0x3105('0x1f')](splitAdditionalPhone(_0x276074['id'],_0x206184[_0x3e654a]));}Promise[_0x3105('0x20')](_0x11780d)[_0x3105('0x21')](function(){_0x47b22b({'val':_0x206184[_0x3105('0x1c')]});});}});}function splitAdditionalPhone(_0x5e0f07,_0x27ad20){return new Promise(function(_0xd2df17,_0x3b568b){var _0x58524b=_0x27ad20[_0x3105('0x24')](':');var _0x31cab5=_0x58524b[0x0];var _0x45d2ad=_0x58524b[0x1];if(_0x45d2ad!==''){var _0x4740cd=_0x45d2ad[_0x3105('0x24')]('|');var _0x438438=[];for(var _0x1d434c=0x0;_0x1d434c<_0x4740cd[_0x3105('0x1c')];_0x1d434c++){if(_0x4740cd[_0x1d434c]!==''){var _0x245398=_[_0x3105('0x25')](promisesAdditionalPhones,{'contactId':_0x5e0f07,'phone':_0x4740cd[_0x1d434c]});if(_0x245398['length']==0x0){orderBy++;promisesAdditionalPhones[_0x3105('0x1f')]({'contactId':_0x5e0f07,'contactTypeId':_0x31cab5,'phone':_0x4740cd[_0x1d434c],'orderBy':orderBy});}}}_0xd2df17({'ok':0x1});}else _0xd2df17({'res':0x0});});}function createAdditionalPhone(_0x5aba88,_0x4ae747,_0x3d9391,_0x7f0b9c){var _0x27ac88='';var _0x408359='';var _0xbf6fe3=_0x3d9391[_0x3105('0x24')]('§');_0x27ac88=_0xbf6fe3[0x0];if(_0xbf6fe3['length']==0x2)_0x408359=_0xbf6fe3[0x1];return new Promise(function(_0x4b6a92,_0x111430){return db[_0x3105('0x26')][_0x3105('0x27')]({'where':{'CmContactId':_0x5aba88,'item':_0x27ac88}})['then'](function(_0xfd8465){if(_0xfd8465){return db[_0x3105('0x26')][_0x3105('0x28')]({'ItemTypeId':_0x4ae747,'description':_0x408359,'OrderBy':_0x7f0b9c},{'where':{'CmContactId':_0x5aba88,'item':_0x27ac88}})[_0x3105('0x21')](function(_0x4d2e14){_0x4b6a92({'res':_0x3105('0x29')});});}else{return db[_0x3105('0x26')][_0x3105('0x2a')]({'CmContactId':_0x5aba88,'item':_0x27ac88,'ItemTypeId':_0x4ae747,'description':_0x408359,'OrderBy':_0x7f0b9c,'ItemClass':_0x3105('0x2b')})[_0x3105('0x21')](function(_0x230479){_0x4b6a92({'res':_0x3105('0x2c')});});}});});}function updateContact(_0x4c3824){return new Promise(function(_0x1cadfe,_0x1f4fbd){var _0x3380ba=_0x4c3824['id'];delete _0x4c3824['id'];return db[_0x3105('0x2d')][_0x3105('0x28')](_0x4c3824,{'where':{'id':_0x3380ba}})['then'](function(_0x34493f){updatedRows+=0x1;return db[_0x3105('0x2e')][_0x3105('0x28')]({'phone':_0x4c3824[_0x3105('0x12')]},{'where':{'ContactId':_0x3380ba}})[_0x3105('0x21')](function(_0x435345){_0x1cadfe({'ret':'OK'});});});});}function insertCmHopper(_0x5a41eb,_0x10b7b3,_0x2b7af7,_0x5a554d,_0x2ed8ae){var _0x4eb7fc=[_0x3105('0x2f'),_0x3105('0x30'),_0x3105('0x31'),_0x3105('0x32'),_0x10b7b3+'.'+_0x5a554d,_0x3105('0x33'),_0x3105('0x34'),_0x3105('0x35'),'cm_contacts.UserId','\x22'+_0x2ed8ae+'\x22'];return squel[_0x3105('0x36')]()['into'](_0x3105('0x37'))[_0x3105('0x38')]([_0x3105('0x12'),'scheduledat','ContactId',_0x3105('0x39'),_0x5a554d,_0x3105('0x3a'),_0x3105('0x3b'),_0x3105('0x3c'),_0x3105('0x3d'),'recallme'],squel['select']()[_0x3105('0x3e')](_0x4eb7fc)[_0x3105('0x13')](_0x10b7b3)[_0x3105('0x14')]('cm_contacts',null,_0x3105('0x3f')+_0x10b7b3+_0x3105('0x40'))[_0x3105('0x14')](_0x2b7af7,null,_0x2b7af7+_0x3105('0x41')+_0x10b7b3+'.'+_0x5a554d)[_0x3105('0x16')](_0x10b7b3+_0x3105('0x42'),_0x5a41eb)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3105('0x16')](_0x3105('0x43'),selectNotIn(_0x10b7b3,_0x2b7af7,_0x5a554d,_0x3105('0x37'),[_0x3105('0x44'),_0x3105('0x45')]))[_0x3105('0x16')](_0x3105('0x43'),selectNotIn(_0x10b7b3,_0x2b7af7,_0x5a554d,_0x3105('0x37'),['\x22always\x22'])))[_0x3105('0x46')]();}function insertCmHopperBlack(_0x46056d,_0x4bdece,_0xdbe2b2,_0x2e3492){var _0x1035ec=['cm_contacts.phone','cm_contacts.id',_0x3105('0x32'),_0x4bdece+'.'+_0x2e3492,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x3105('0x36')]()['into'](_0x3105('0x47'))['fromQuery']([_0x3105('0x12'),_0x3105('0x48'),_0x3105('0x39'),_0x2e3492,_0x3105('0x3a'),'updatedAt'],squel[_0x3105('0x10')]()[_0x3105('0x3e')](_0x1035ec)['from'](_0x4bdece)[_0x3105('0x14')](_0x3105('0x49'),null,'cm_contacts.ListId\x20=\x20'+_0x4bdece+_0x3105('0x40'))[_0x3105('0x14')](_0xdbe2b2,null,_0xdbe2b2+'.id\x20=\x20'+_0x4bdece+'.'+_0x2e3492)[_0x3105('0x16')](_0x4bdece+_0x3105('0x42'),_0x46056d)['where'](_0x3105('0x4a'),NOW)[_0x3105('0x16')](_0x3105('0x43'),squel[_0x3105('0x10')]()[_0x3105('0x11')]('phone')[_0x3105('0x13')](_0x3105('0x47'))[_0x3105('0x16')](_0x3105('0x4b'),_0x46056d)[_0x3105('0x16')](_0x2e3492+_0x3105('0x4c'),_0x4bdece+'.'+_0x2e3492)))[_0x3105('0x46')]();}function insertCmHopperAdditionalPhones(_0x5f3c46){var _0x223943=[_0x3105('0x4d'),'cm_contact_has_items.item',_0x3105('0x4e'),_0x3105('0x4f'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x3105('0x50')]('cm_hopper_additional_phones')[_0x3105('0x38')]([_0x3105('0x51'),_0x3105('0x12'),_0x3105('0x52'),_0x3105('0x3a'),_0x3105('0x3b')],squel[_0x3105('0x10')]()[_0x3105('0x3e')](_0x223943)[_0x3105('0x13')](_0x3105('0x37'))[_0x3105('0x14')](_0x3105('0x49'),null,_0x3105('0x53'))[_0x3105('0x14')](_0x3105('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x3105('0x16')]('cm_hopper.ListId\x20=\x20?',_0x5f3c46)['where'](_0x3105('0x4a'),NOW))[_0x3105('0x46')]();}function insertCmContact(_0x2670ed,_0xf33f4e,_0x1ea1df,_0x37e871){var _0xcbad58=_[_0x3105('0x55')](_['keys'](_0x37e871),[_0x3105('0x39'),_0x3105('0x56'),_0x3105('0x3a'),_0x3105('0x3b')]);return squel[_0x3105('0x36')]()[_0x3105('0x50')](_0x3105('0x49'))['fromQuery'](_0xcbad58,squel[_0x3105('0x10')]()[_0x3105('0x3e')](_0xcbad58)[_0x3105('0x13')](_0xf33f4e)[_0x3105('0x16')]('('+_0x1ea1df['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x3105('0x10')]()['fields'](_0x1ea1df)[_0x3105('0x13')](_0x3105('0x49'))[_0x3105('0x16')](_0x3105('0x4b'),_0x2670ed))[_0x3105('0x16')](_0x3105('0x57'),squel[_0x3105('0x10')]()[_0x3105('0x11')](_0x3105('0x58'),_0x3105('0x59'))[_0x3105('0x13')](_0xf33f4e)['group'](_0x1ea1df[_0x3105('0x14')](','))))['toString']();}function handleStop(){logger[_0x3105('0x5a')](_0x3105('0x5b'));stopped=!![];}function handleUncaughtException(_0xf89293){logger['error'](_0xf89293[_0x3105('0x23')]);process[_0x3105('0x5c')](0x1);}function handleError(_0x51e7ec,_0xe25b65){stats[_0x3105('0x5d')]['push']({'name':_0xe25b65[_0x3105('0x5e')],'message':_0xe25b65[_0x3105('0x23')],'row':_0x51e7ec});}function handleQuery(_0x4dca59){logger[_0x3105('0x5a')](_0x4dca59);return db[_0x3105('0x18')][_0x3105('0x19')](_0x4dca59)[_0x3105('0x1b')](function(_0x5724ce){results['push'](_0x5724ce);})[_0x3105('0x22')](function(_0x5ca1d0){logger[_0x3105('0x5f')](_0x5ca1d0[_0x3105('0x23')]);});}function main(_0x18272b,_0x6a714c,_0x972251,_0x250e12){logger[_0x3105('0x5a')](_0x3105('0x60'),_0x18272b,JSON['stringify'](_0x6a714c));process[_0x3105('0x61')]('start');var _0x32cdc3=_0x6a714c['binding'];var _0x53f274=_[_0x3105('0x62')](_0x32cdc3);var _0xb15e1e=_0x6a714c[_0x3105('0x63')];var _0x50df91=path[_0x3105('0x14')](config[_0x3105('0x64')],_0x3105('0x65'),_0xb15e1e+'.csv');logger[_0x3105('0x5a')](_0x3105('0x66'),_0x6a714c);db[_0x3105('0x67')][_0x3105('0x68')]({'raw':!![],'attributes':['id',_0x3105('0x69')]})[_0x3105('0x21')](function(_0x49a364){for(var _0x1e72e9=0x0;_0x1e72e9<_0x49a364['length'];_0x1e72e9++){if(_0x49a364[_0x1e72e9][_0x3105('0x69')]in _0x32cdc3){contactItemTypes[_0x3105('0x1f')](_0x49a364[_0x1e72e9]);delete _0x53f274[_0x49a364[_0x1e72e9][_0x3105('0x69')]];hasAdditionalPhones=!![];}for(var _0x144f51 in _0x32cdc3){if(_0x49a364[_0x1e72e9]['name']+_0x3105('0x6a')===_0x144f51){phoneDescriptions[_0x3105('0x1f')]({'itemTypeId':_0x49a364[_0x1e72e9]['id'],'description':_0x144f51});delete _0x53f274[_0x144f51];}}}if(hasAdditionalPhones)_0x53f274[_0x3105('0x1e')]='';var _0x30215d=_[_0x3105('0x6b')](_0x53f274)['join']();logger[_0x3105('0x5a')]('header',_0x30215d);fs[_0x3105('0x6c')](_0x50df91,_0x30215d+'\x0a');Papa[_0x3105('0x6d')](fs[_0x3105('0x6e')](_0x18272b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e5e92,_0x5890bc){try{for(var _0x5a8fd9=0x0,_0x4054f5=[];_0x5a8fd9<_0x3e5e92[_0x3105('0x6f')][_0x3105('0x1c')];_0x5a8fd9++){stats[_0x3105('0x70')]+=0x1;if(_0x3e5e92['errors'][_0x5a8fd9]){handleError(_0x3e5e92[_0x3105('0x6f')][_0x5a8fd9],_0x3e5e92[_0x3105('0x5d')][_0x5a8fd9]);}else{var _0x6e535f=[];var _0x5e17db=[];var _0x4001be={};for(var _0x1dc7be in _0x32cdc3){let _0x2cf0b7=contactItemTypes[_0x3105('0x71')](_0x7a56b5=>_0x7a56b5[_0x3105('0x69')]===_0x1dc7be);let _0x52e94c=contactItemTypes['find'](_0x5f2478=>_0x5f2478[_0x3105('0x69')]+_0x3105('0x6a')===_0x1dc7be);if(_['isNil'](_0x2cf0b7)&&_[_0x3105('0x1d')](_0x52e94c)){if(_0x32cdc3[_0x3105('0x72')](_0x1dc7be)){if(_0x3e5e92[_0x3105('0x6f')][_0x5a8fd9][_0x32cdc3[_0x1dc7be]]){var _0x43fec6=_['trim'](_0x3e5e92['data'][_0x5a8fd9][_0x32cdc3[_0x1dc7be]]['replace'](/"/g,'\x27'));switch(_0x1dc7be){case'scheduledat':var _0x1734f0=moment(_0x43fec6,_0x3105('0xd'),!![]);if(_0x1734f0[_0x3105('0x73')]()){_0x4054f5[_0x3105('0x1f')]('\x22'+_0x43fec6+'\x22');}else{_0x6e535f[_0x3105('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x3105('0x3c'):var _0x53124b=parseInt(_0x43fec6);_0x43fec6=_['isNaN'](_0x53124b)||_0x53124b<0x0||_0x53124b>0x4?_0x250e12?0x3:0x2:_0x53124b;_0x4054f5[_0x3105('0x1f')]('\x22'+_0x43fec6+'\x22');break;case _0x3105('0x3d'):var _0x3ce4d7=parseInt(_0x43fec6);if(_[_0x3105('0x74')](_0x3ce4d7)&&_[_0x3105('0x75')](_0x972251,_0x3ce4d7)){_0x4054f5['push']('\x22'+_0x3ce4d7+'\x22');}else{_0x6e535f[_0x3105('0x1f')](_0x3105('0x76'));}break;case _0x3105('0x77'):if(isEmail(_0x43fec6)){_0x4054f5[_0x3105('0x1f')]('\x22'+_0x43fec6+'\x22');}else{_0x6e535f[_0x3105('0x1f')](_0x3105('0x78'));}break;case _0x3105('0x79'):var _0x299dfb=moment(_0x43fec6,_0x3105('0x7a'),!![]);if(_0x299dfb['isValid']()){_0x4054f5[_0x3105('0x1f')]('\x22'+_0x43fec6+'\x22');}else{_0x6e535f['push'](_0x3105('0x7b'));}break;default:_0x4054f5['push']('\x22'+_0x43fec6+'\x22');}}else{switch(_0x1dc7be){case _0x3105('0x7c'):case _0x3105('0x12'):_0x6e535f[_0x3105('0x1f')](_0x1dc7be+_0x3105('0x7d'));break;default:_0x4054f5[_0x3105('0x1f')]('\x22\x22');}}}}else{var _0x446209='';if(!_[_0x3105('0x1d')](_0x2cf0b7)){if(!_0x4001be[_0x3105('0x72')](_0x2cf0b7['id'])){for(var _0x436a61=0x0;_0x436a61<_0x32cdc3[_0x1dc7be]['length'];_0x436a61++){var _0x43fec6=_['trim'](_0x3e5e92['data'][_0x5a8fd9][_0x32cdc3[_0x1dc7be][_0x436a61]][_0x3105('0x7e')](/"/g,'\x27'));var _0x153608=phoneDescriptions[_0x3105('0x71')](_0x5adb70=>_0x5adb70[_0x3105('0x7f')]===_0x2cf0b7['id']);if(!_[_0x3105('0x1d')](_0x153608)){var _0x42d4d3=_['trim'](_0x3e5e92['data'][_0x5a8fd9][_0x32cdc3[_0x153608[_0x3105('0x80')]][0x0]][_0x3105('0x7e')](/"/g,'\x27'));if(!_[_0x3105('0x1d')](_0x42d4d3))_0x43fec6=_0x43fec6+'§'+_0x42d4d3;}if(_0x446209=='')_0x446209=_0x43fec6;else _0x446209+='|'+_0x43fec6;}_0x5e17db['push'](_0x2cf0b7['id']+':'+_0x446209);_0x4001be[_0x2cf0b7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4054f5['push']('\x22'+_0x5e17db[_0x3105('0x14')](';')+'\x22');}if(_0x6e535f[_0x3105('0x1c')]){handleError(_0x3e5e92[_0x3105('0x6f')][_0x5a8fd9],{'code':_0x3105('0x81'),'message':_0x6e535f[_0x3105('0x14')]()});}else{fs[_0x3105('0x82')](_0x50df91,_0x4054f5['join']()+'\x0a');}_0x4054f5=[];}if(!(stats[_0x3105('0x70')]%0xc8)){socket['emit'](_0x3105('0x83')+_0xb15e1e,stats);stats[_0x3105('0x5d')]=[];}}if(stopped){logger[_0x3105('0x5a')](_0x3105('0x84'));_0x5890bc[_0x3105('0x85')]();}}catch(_0x5f5892){handleError(_0x3e5e92[_0x3105('0x6f')][_0x5a8fd9],{'code':'SystemError','message':_0x5f5892[_0x3105('0x23')]});logger[_0x3105('0x5f')](_0x3105('0x86'),_0x5f5892[_0x3105('0x23')]);}},'complete':function(){try{var _0x29af13=[];var _0x386935=tempTableName;_0x29af13[_0x3105('0x1f')](_0x3105('0x87')+_0x386935+_0x3105('0x88'));logger[_0x3105('0x5a')](_0x3105('0x89'),contactItemTypes[_0x3105('0x1c')]);var _0x11b2e5=util[_0x3105('0xe')](_0x3105('0x8a'),_0x50df91,_0x386935,_0x30215d,_0x6a714c[_0x3105('0x39')],_0x6a714c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x32cdc3[_0x3105('0x8b')])){_0x11b2e5+=_0x3105('0x8c');}_0x29af13[_0x3105('0x1f')](_0x11b2e5);BPromise[_0x3105('0x8d')](_0x29af13,handleQuery)[_0x3105('0x21')](function(_0x184452){BPromise['all']([handleAdditionalPhones()])[_0x3105('0x21')](function(){_0x29af13=[];for(var _0x490c5d=0x0;_0x490c5d\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.to','i.ContactId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','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.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','clone','getSelectedTags','isEmpty','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','getInteractionFK','user_has_','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x2ac3,0x10f));var _0x32ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2ac3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x32ac('0x0'));var squel=require(_0x32ac('0x1'));var as=require(_0x32ac('0x2'));var qs=require(_0x32ac('0x3'));var updateInteraction=require('./update-interaction')[_0x32ac('0x4')];var utils=require(_0x32ac('0x5'));var db=require(_0x32ac('0x6'))['db'];function skipInteractionsQuery(_0x539146,_0x5de216,_0x38160a){var _0x416cf0=![];var _0x2f3714=utils[_0x32ac('0x7')](_0x539146);if(_0x5de216['role']===_0x32ac('0x8')&&!_0x38160a[_0x32ac('0x9')]&&!_0x38160a[_0x2f3714]){_0x416cf0=!![];}return _0x416cf0;}function getTagsQuery(){return squel[_0x32ac('0xa')]()[_0x32ac('0xb')]('id')[_0x32ac('0xb')](_0x32ac('0xc'))['field'](_0x32ac('0xd'))[_0x32ac('0xe')]('tools_tags');}function getUsersQuery(_0x4dce9d,_0xbd0b49){var _0x5b2e33=utils[_0x32ac('0xf')](_0x4dce9d);var _0x5a2d31=_0x32ac('0x10')+_0x4dce9d+'_interactions';var _0x1f2c5d=squel['select']()['field'](_0x32ac('0x11'))[_0x32ac('0xb')](_0x32ac('0x12'))[_0x32ac('0xb')](_0x32ac('0x13')+_0x5b2e33)['from'](_0x5a2d31,'ui')['left_join'](_0x32ac('0x14'),'u',_0x32ac('0x15'));if(_0xbd0b49[_0x32ac('0x16')]>0x0){_0x1f2c5d[_0x32ac('0x17')]('ui.'+_0x5b2e33+_0x32ac('0x18'),_[_0x32ac('0x19')](_0xbd0b49,'id'));}return _0x1f2c5d;}function getInteractionsQuery(_0x3ecc51){var _0x5f3ea8=utils['getInteractionsTables'](_0x3ecc51);var _0x380455=utils[_0x32ac('0x7')](_0x3ecc51);var _0x34bdb2=utils['getInteractionFK'](_0x3ecc51);return squel['select']()['from'](_0x5f3ea8[_0x32ac('0x1a')],'i')[_0x32ac('0x1b')](_0x32ac('0x1c'),'c',_0x32ac('0x1d'))['left_join'](_0x32ac('0x14'),'o',_0x32ac('0x1e'))['left_join'](_0x5f3ea8[_0x32ac('0x1f')],'a',_0x32ac('0x20')+_0x380455)[_0x32ac('0x1b')](_0x5f3ea8['messages'],'me',_0x32ac('0x21')+_0x34bdb2+_0x32ac('0x22'))[_0x32ac('0x1b')](_0x5f3ea8[_0x32ac('0x23')],'it',_0x32ac('0x24')+_0x34bdb2+_0x32ac('0x22'))[_0x32ac('0x1b')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0xb38631={'body':squel[_0x32ac('0x25')](),'contact':squel[_0x32ac('0x25')](),'default':squel[_0x32ac('0x25')](),'fields':squel[_0x32ac('0x25')](),'filter':squel[_0x32ac('0x25')](),'read':squel[_0x32ac('0x25')](),'tags':{'clause':squel[_0x32ac('0x25')](),'ids':null},'user':squel[_0x32ac('0x25')]()};return _0xb38631;}function parseTagParameter(_0x43e081){var _0x4d633a=squel[_0x32ac('0x25')]();if(_0x43e081){var _0x27ba85=utils['getSelectedTags'](_0x43e081);_0x27ba85[_0x32ac('0x26')](function(_0x1babb8){_0x4d633a['or'](_0x32ac('0x27'),'%,'+_0x1babb8+',%');});}return _0x4d633a;}function parseReadParameter(_0xab7d8c){var _0x4bb54c='';if(_0xab7d8c){_0x4bb54c=_0x32ac('0x28');if(_0xab7d8c==='1'){_0x4bb54c=_0x4bb54c[_0x32ac('0x29')](_0x32ac('0x2a'),'=');}else{_0x4bb54c=_0x4bb54c[_0x32ac('0x29')](_0x32ac('0x2a'),'>');}}return _0x4bb54c;}function parseSearchFilter(_0x495589,_0x9df2f1){var _0x5daef3=squel[_0x32ac('0x25')]();if(_0x9df2f1){var _0x18af96=_0x9df2f1[_0x32ac('0x29')]('\x5c','\x5c\x5c')[_0x32ac('0x29')](/'/g,'\x27\x27');if(qs[_0x32ac('0x2b')](_0x18af96)){_0x5daef3['or'](_0x32ac('0x2c'),_0x18af96+'%');if([_0x32ac('0x2d'),_0x32ac('0x2e')]['includes'](_0x495589)){_0x5daef3['or'](_0x32ac('0x2f'),_0x18af96+'%');}else if(_0x495589===_0x32ac('0x30')){_0x5daef3['or'](_0x32ac('0x31'),_0x18af96+'%');}else if(_0x495589==='openchannel'){_0x5daef3['or']('i.from\x20LIKE\x20?',_0x18af96+'%');}}else if(_0x495589===_0x32ac('0x32')&&qs['isEmail'](_0x18af96)){_0x5daef3['or']('c.email\x20LIKE\x20?',_0x18af96+'%');}else{if(_0x495589===_0x32ac('0x32')){_0x5daef3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18af96,!![]))['or'](_0x32ac('0x33'),qs[_0x32ac('0x34')](_0x18af96));}else if(_0x495589!==_0x32ac('0x30')){_0x5daef3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18af96));}_0x5daef3['or'](_0x32ac('0x35'),qs[_0x32ac('0x34')](_0x18af96,!![]),null);}}return _0x5daef3;}function parseAdvancedSearchFilter(_0x40b8e7,_0x2aa52c){var _0x27fa23=getSqlClauses();var _0x55e263=as[_0x32ac('0x36')](_0x40b8e7);var _0x2282c6=_0x55e263[_0x32ac('0x37')];for(var _0x57ec0b=0x0;_0x57ec0b<_0x55e263[_0x32ac('0x38')]['length'];_0x57ec0b++){var _0x4b4fc2=_0x55e263[_0x32ac('0x38')][_0x57ec0b];var _0x2c9980='i';var _0x5761ac=_[_0x32ac('0x39')](_0x2aa52c,[_0x32ac('0xc'),_0x4b4fc2['field']]);if(_0x5761ac){var _0x1ac90d=as[_0x32ac('0x3a')](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23[_0x32ac('0x3c')][_0x2282c6](_0x1ac90d['text'],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);}else{switch(_0x4b4fc2[_0x32ac('0xb')]){case _0x32ac('0x40'):var _0x88c06=parseReadParameter(_0x4b4fc2[_0x32ac('0x3d')]);_0x27fa23[_0x32ac('0x41')]['and'](_0x88c06);break;case _0x32ac('0x42'):if(_0x4b4fc2[_0x32ac('0x43')]==='$substring'){if(_0x4b4fc2[_0x32ac('0x3d')][_0x32ac('0x44')]('\x20')[_0x32ac('0x16')]>0x1){_0x27fa23[_0x32ac('0x45')][_0x2282c6](_0x32ac('0x35'),qs[_0x32ac('0x34')](_0x4b4fc2[_0x32ac('0x3d')],!![]),null);}else{var _0x365122='%'+_0x4b4fc2[_0x32ac('0x3d')]+'%';_0x27fa23[_0x32ac('0x45')][_0x2282c6](_0x32ac('0x46'),_0x365122,_0x365122,_0x365122);}}else{_0x5761ac=_[_0x32ac('0x39')](_0x2aa52c,[_0x32ac('0xc'),'ContactId']);_0x4b4fc2[_0x32ac('0xb')]=_0x32ac('0x47');_0x1ac90d=as[_0x32ac('0x3a')](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23['contact'][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d['value'][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);}break;case _0x32ac('0x49'):var _0x80435=_0x4b4fc2[_0x32ac('0x3d')]['split'](',')['map'](function(_0x558c26){return Number(_0x558c26);});var _0x2fcf03=parseTagParameter(_0x80435);_0x27fa23[_0x32ac('0x4a')][_0x32ac('0x4b')][_0x32ac('0x4c')](_0x2fcf03);_0x27fa23[_0x32ac('0x4a')][_0x32ac('0x4d')]=_0x80435;break;case _0x32ac('0x4e'):if(_0x4b4fc2['operator']===_0x32ac('0x4f')){_0x27fa23[_0x32ac('0x50')][_0x2282c6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4b4fc2[_0x32ac('0x3d')]+'%',null);}else{_0x5761ac=_['find'](_0x2aa52c,[_0x32ac('0xc'),_0x32ac('0x51')]);_0x4b4fc2[_0x32ac('0xb')]=_0x32ac('0x51');_0x1ac90d=as['buildExpression'](_0x2c9980,_0x5761ac[_0x32ac('0x3b')],_0x4b4fc2);_0x27fa23[_0x32ac('0x50')][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')]['end']);}break;case'body':case _0x32ac('0x52'):_0x1ac90d=as[_0x32ac('0x3a')]('me',null,_0x4b4fc2);_0x27fa23[_0x32ac('0x53')][_0x2282c6](_0x1ac90d[_0x32ac('0x48')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3e')],_0x1ac90d[_0x32ac('0x3d')][_0x32ac('0x3f')]);break;}}}return _0x27fa23;}function parseModelFields(_0x22ed85,_0x38ae53,_0x251d31){var _0xdc6008=utils[_0x32ac('0x7')](_0x22ed85);var _0x1eb93d=squel['expr']();var _0x352002=_(_0x38ae53)['keys']()[_0x32ac('0x19')](function(_0x4216c8){return _[_0x32ac('0x54')](_0x251d31,[_0x32ac('0xc'),_0x4216c8])?_0x4216c8:undefined;})[_0x32ac('0x55')]()['value']();if(_0x352002[_0x32ac('0x16')]>0x0){_0x352002[_0x32ac('0x26')](function(_0x58d2eb){if(_0x58d2eb===_0xdc6008){_0x1eb93d['and']('i.'+_0xdc6008+_0x32ac('0x18'),[][_0x32ac('0x56')](_0x38ae53[_0x58d2eb]));}else if(_0x58d2eb==='createdAt'){var _0x1e2d1e=JSON[_0x32ac('0x57')](_0x38ae53[_0x58d2eb])[_0x32ac('0x58')];var _0x4abda5=JSON[_0x32ac('0x57')](_0x38ae53[_0x58d2eb])[_0x32ac('0x59')];_0x1eb93d[_0x32ac('0x4c')](_0x32ac('0x5a'),_0x1e2d1e,_0x4abda5);}else{if(_0x38ae53[_0x58d2eb]===_0x32ac('0x5b')){_0x1eb93d['and']('i.'+_0x58d2eb+_0x32ac('0x5c'));}else{_0x1eb93d['and']('i.'+_0x58d2eb+'\x20=\x20?',_0x38ae53[_0x58d2eb]);}}});}return _0x1eb93d;}function parseQueryParameters(_0x5a2ef4,_0x5b6516,_0x5154a5){var _0x323fa1=getSqlClauses();return Promise[_0x32ac('0x5d')]()[_0x32ac('0x5e')](function(){return parseModelFields(_0x5a2ef4,_0x5b6516,_0x5154a5);})[_0x32ac('0x5e')](function(_0x5497dd){_0x323fa1['fields']['and'](_0x5497dd);return parseReadParameter(_0x5b6516[_0x32ac('0x41')]);})[_0x32ac('0x5e')](function(_0x1fe1ad){_0x323fa1[_0x32ac('0x41')][_0x32ac('0x4c')](_0x1fe1ad);return parseTagParameter(_0x5b6516[_0x32ac('0x5f')]);})[_0x32ac('0x5e')](function(_0x2f24df){_0x323fa1[_0x32ac('0x4a')][_0x32ac('0x4b')]['and'](_0x2f24df);return parseSearchFilter(_0x5a2ef4,_0x5b6516[_0x32ac('0x60')]);})[_0x32ac('0x5e')](function(_0x12f516){_0x323fa1[_0x32ac('0x60')]=_0x12f516;return _0x323fa1;});}function checkAccountsRestrictions(_0xfc5479,_0x1d89fa,_0x57ddb2){var _0x479c3b=utils['getAccountFK'](_0xfc5479);var _0x5aec53='get'+_['capitalize'](_0xfc5479)+(_0xfc5479===_0x32ac('0x61')?_0x32ac('0x62'):_0x32ac('0x63'));var _0x5f4c3b=squel[_0x32ac('0x25')]();return Promise['resolve']()[_0x32ac('0x5e')](function(){if(_0x57ddb2[_0x32ac('0x9')]&&_0x1d89fa[_0x32ac('0x64')]===_0x32ac('0x8')){return _0x1d89fa[_0x5aec53]({'attributes':['id'],'raw':!![]});}})[_0x32ac('0x5e')](function(_0x40439e){if(_0x40439e){if(_0x40439e[_0x32ac('0x16')]===0x0){_0x5f4c3b[_0x32ac('0x4c')]('i.'+_0x479c3b+'\x20IS\x20NULL');}else{_0x5f4c3b[_0x32ac('0x4c')]('i.'+_0x479c3b+_0x32ac('0x18'),_['map'](_0x40439e,'id'));}}else if(!_0x57ddb2[_0x479c3b]){_0x5f4c3b['and']('i.'+_0x479c3b+_0x32ac('0x65'));}})[_0x32ac('0x5e')](function(){return _0x5f4c3b;});}function getClosedOrderClause(_0x5cb63e,_0x17bae6){var _0x2f1f50='';var _0x57892d=[_0x32ac('0x66'),_0x32ac('0x67'),_0x32ac('0x68')];if(_0x5cb63e==='mail'){_0x57892d['unshift'](_0x32ac('0x69'));}if(_0x17bae6[_0x32ac('0x6a')]==='0'&&_0x5cb63e==='mail'){_0x2f1f50=_0x32ac('0x69');}else{if(_0x17bae6[_0x32ac('0x6a')]==='1'){_0x57892d[_0x32ac('0x6b')]();}_0x2f1f50=_0x32ac('0x6c')+_0x57892d[_0x32ac('0x6d')](',\x20')+')';}return _0x2f1f50;}function getFilteredInteractions(_0x4a12be,_0x585d21,_0x4c5a32,_0x5c4dd3){var _0x41e2d4=utils[_0x32ac('0xf')](_0x4a12be);var _0x123e8e=_['capitalize'](_0x4a12be)+_0x32ac('0x6e');var _0x518513=[];var _0x39f543=getTagsQuery();var _0x60985b={'type':db['Sequelize'][_0x32ac('0x6f')][_0x32ac('0x70')],'raw':!![]};var _0x3b6b08=[];var _0x3d5a45=[];return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x39f543['toString'](),_0x60985b)[_0x32ac('0x5e')](function(_0x33554d){_0x518513=_[_0x32ac('0x73')](_0x33554d,'id');_0x60985b=_['merge'](_0x60985b,{'model':db[_0x123e8e],'mapToModel':!![],'nest':!![]});if(_0x4c5a32[_0x32ac('0x74')]){_0x5c4dd3[_0x32ac('0x75')][_0x32ac('0x26')](function(_0x4fd4a1){_0x585d21[_0x32ac('0xb')]('i.'+_0x4fd4a1);});}else{_0x585d21[_0x32ac('0xb')](_0x32ac('0x76'),_0x32ac('0x40'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x77'),'Account.key');_0x585d21['field'](_0x32ac('0x78'),'Account.mandatoryDisposition');if(_0x4a12be===_0x32ac('0x32')){_0x585d21[_0x32ac('0xb')](_0x32ac('0x79'),_0x32ac('0x7a'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x7b'),'contactName');_0x585d21['field'](_0x32ac('0x7c'));_0x585d21[_0x32ac('0xb')]('i.createdAt');_0x585d21['field'](_0x32ac('0x7d'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x7e'));_0x585d21['field']('i.closedAt');_0x585d21['field'](_0x32ac('0x7f'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x80'));_0x585d21['field']('i.lastMsgDirection');_0x585d21[_0x32ac('0xb')](_0x32ac('0x81'));_0x585d21['field']('i.disposition');_0x585d21[_0x32ac('0xb')](_0x32ac('0x67'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x66'));_0x585d21[_0x32ac('0xb')]('i.substatus');_0x585d21[_0x32ac('0xb')](_0x32ac('0x82'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x83'));_0x585d21[_0x32ac('0xb')]('i.MailAccountId');_0x585d21['field'](_0x32ac('0x84'));}else if(_0x4a12be===_0x32ac('0x85')){_0x585d21[_0x32ac('0xb')](_0x32ac('0x86'),_0x32ac('0x87'));}else{_0x585d21['field'](_0x32ac('0x88'),_0x32ac('0x87'));}if(_0x4a12be!=='mail'){_0x585d21[_0x32ac('0xb')](_0x32ac('0x89'));}_0x585d21[_0x32ac('0xb')](_0x32ac('0x8a'),_0x32ac('0x8b'));_0x585d21[_0x32ac('0xb')]('c.lastName',_0x32ac('0x8c'));_0x585d21['field']('c.email','Contact.email');_0x585d21[_0x32ac('0xb')](_0x32ac('0x8d'),'Contact.phone');_0x585d21[_0x32ac('0xb')]('c.mobile',_0x32ac('0x8e'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x8f'),_0x32ac('0x90'));_0x585d21[_0x32ac('0xb')](_0x32ac('0x91'),'Owner.fullname');_0x585d21['field'](_0x32ac('0x92'),_0x32ac('0x93'));_0x585d21[_0x32ac('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x32ac('0x94'));}if(_0x5c4dd3['limit']){_0x585d21['limit'](_0x5c4dd3[_0x32ac('0x95')]);}if(_0x5c4dd3[_0x32ac('0x96')]){_0x585d21[_0x32ac('0x96')](_0x5c4dd3['offset']);}return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x585d21[_0x32ac('0x97')](),_0x60985b);})[_0x32ac('0x5e')](function(_0x110282){_0x3b6b08=_0x110282;var _0x70a45e=getUsersQuery(_0x4a12be,_0x3b6b08);return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x70a45e[_0x32ac('0x97')](),_0x60985b);})['then'](function(_0x472ddb){_0x3d5a45=_[_0x32ac('0x98')](_0x472ddb,_0x41e2d4);if(_0x4a12be===_0x32ac('0x32')){return db[_0x32ac('0x99')]['findOne']({'attributes':[_0x32ac('0x9a')],'raw':!![]});}})[_0x32ac('0x5e')](function(_0xa57526){var _0x5cf8cd=_0xa57526?_0xa57526[_0x32ac('0x9a')]:undefined;var _0xc31554=_0x3b6b08['map'](function(_0x12640a){return updateInteraction(_0x12640a,_0x518513,_0x3d5a45,_0x5cf8cd);});return Promise[_0x32ac('0x9b')](_0xc31554);});}function countFilteredInteractions(_0x44ca72,_0x5d3b67){var _0x157d51=_0x44ca72[_0x32ac('0x9c')]();_0x157d51['field']('COUNT(*)');_0x157d51['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32ac('0x40'));var _0x3160e9=utils[_0x32ac('0x9d')](_0x5d3b67);if(!_[_0x32ac('0x9e')](_0x3160e9)){_0x157d51[_0x32ac('0x17')]('t.id\x20IN\x20?',_0x3160e9);}var _0x37971c={'type':db[_0x32ac('0x9f')]['QueryTypes'][_0x32ac('0x70')],'raw':!![]};return db[_0x32ac('0x71')][_0x32ac('0x72')](_0x157d51['toString'](),_0x37971c);}module[_0x32ac('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x553f=['tags','filter','get','capitalize','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Sequelize','QueryTypes','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','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','offset','query','toString','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','role','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','getAccountFK','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','value','start','end','read','Contact','operator','$substring','split','contact','ContactId','Tag','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','map','some','and','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag'];(function(_0x1cc9c9,_0x9c9690){var _0x2eefba=function(_0x4ba4b4){while(--_0x4ba4b4){_0x1cc9c9['push'](_0x1cc9c9['shift']());}};_0x2eefba(++_0x9c9690);}(_0x553f,0x18b));var _0xf553=function(_0x141c4f,_0x5c02eb){_0x141c4f=_0x141c4f-0x0;var _0xe55b7f=_0x553f[_0x141c4f];return _0xe55b7f;};'use strict';var _=require(_0xf553('0x0'));var squel=require(_0xf553('0x1'));var as=require(_0xf553('0x2'));var qs=require(_0xf553('0x3'));var updateInteraction=require('./update-interaction')[_0xf553('0x4')];var utils=require(_0xf553('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x45bd7a,_0x5a03b4,_0x33f731){var _0x3def59=![];var _0xbd119e=utils['getAccountFK'](_0x45bd7a);if(_0x5a03b4[_0xf553('0x6')]==='agent'&&!_0x33f731[_0xf553('0x7')]&&!_0x33f731[_0xbd119e]){_0x3def59=!![];}return _0x3def59;}function getTagsQuery(){return squel[_0xf553('0x8')]()[_0xf553('0x9')]('id')['field'](_0xf553('0xa'))[_0xf553('0x9')]('color')[_0xf553('0xb')](_0xf553('0xc'));}function getUsersQuery(_0x15195a,_0x239358){var _0x592b76=utils[_0xf553('0xd')](_0x15195a);var _0x1d43b3=_0xf553('0xe')+_0x15195a+_0xf553('0xf');var _0x1eaa79=squel[_0xf553('0x8')]()[_0xf553('0x9')](_0xf553('0x10'))[_0xf553('0x9')](_0xf553('0x11'))[_0xf553('0x9')](_0xf553('0x12')+_0x592b76)[_0xf553('0xb')](_0x1d43b3,'ui')['left_join']('users','u',_0xf553('0x13'));if(_0x239358[_0xf553('0x14')]>0x0){_0x1eaa79[_0xf553('0x15')](_0xf553('0x12')+_0x592b76+_0xf553('0x16'),_['map'](_0x239358,'id'));}return _0x1eaa79;}function getInteractionsQuery(_0x28fe25){var _0x543bd7=utils[_0xf553('0x17')](_0x28fe25);var _0x382ff0=utils[_0xf553('0x18')](_0x28fe25);var _0x289d59=utils[_0xf553('0xd')](_0x28fe25);return squel['select']()['from'](_0x543bd7['interactions'],'i')[_0xf553('0x19')](_0xf553('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf553('0x19')](_0xf553('0x1b'),'o',_0xf553('0x1c'))[_0xf553('0x19')](_0x543bd7['accounts'],'a',_0xf553('0x1d')+_0x382ff0)[_0xf553('0x19')](_0x543bd7['messages'],'me',_0xf553('0x1e')+_0x289d59+'\x20=\x20i.id')[_0xf553('0x19')](_0x543bd7['interactionsTags'],'it',_0xf553('0x1f')+_0x289d59+_0xf553('0x20'))[_0xf553('0x19')](_0xf553('0xc'),'t',_0xf553('0x21'));}function getSqlClauses(){var _0x4ffcda={'body':squel[_0xf553('0x22')](),'contact':squel[_0xf553('0x22')](),'default':squel[_0xf553('0x22')](),'fields':squel[_0xf553('0x22')](),'filter':squel[_0xf553('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0xf553('0x22')](),'ids':null},'user':squel[_0xf553('0x22')]()};return _0x4ffcda;}function parseTagParameter(_0x556761){var _0x34bec8=squel[_0xf553('0x22')]();if(_0x556761){var _0x42ee3d=utils[_0xf553('0x23')](_0x556761);_0x42ee3d[_0xf553('0x24')](function(_0x1eee41){_0x34bec8['or'](_0xf553('0x25'),'%,'+_0x1eee41+',%');});}return _0x34bec8;}function parseReadParameter(_0x151eb2){var _0xf1aefd='';if(_0x151eb2){_0xf1aefd=_0xf553('0x26');if(_0x151eb2==='1'){_0xf1aefd=_0xf1aefd[_0xf553('0x27')]('{OPERATOR}','=');}else{_0xf1aefd=_0xf1aefd['replace'](_0xf553('0x28'),'>');}}return _0xf1aefd;}function parseSearchFilter(_0x58b1a4,_0x560e91){var _0x1953d0=squel['expr']();if(_0x560e91){var _0x5b4a13=_0x560e91[_0xf553('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf553('0x29')](_0x5b4a13)){_0x1953d0['or']('i.id\x20LIKE\x20?',_0x5b4a13+'%');if([_0xf553('0x2a'),_0xf553('0x2b')]['includes'](_0x58b1a4)){_0x1953d0['or']('i.phone\x20LIKE\x20?',_0x5b4a13+'%');}else if(_0x58b1a4==='fax'){_0x1953d0['or']('i.fax\x20LIKE\x20?',_0x5b4a13+'%');}else if(_0x58b1a4===_0xf553('0x2c')){_0x1953d0['or']('i.from\x20LIKE\x20?',_0x5b4a13+'%');}}else if(_0x58b1a4===_0xf553('0x2d')&&qs[_0xf553('0x2e')](_0x5b4a13)){_0x1953d0['or'](_0xf553('0x2f'),_0x5b4a13+'%');}else{if(_0x58b1a4==='mail'){_0x1953d0['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5b4a13,!![]))['or'](_0xf553('0x30'),qs[_0xf553('0x31')](_0x5b4a13));}else if(_0x58b1a4!=='fax'){_0x1953d0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5b4a13));}_0x1953d0['or'](_0xf553('0x32'),qs[_0xf553('0x31')](_0x5b4a13,!![]),null);}}return _0x1953d0;}function parseAdvancedSearchFilter(_0x36f099,_0x372b0d){var _0x574d28=getSqlClauses();var _0x3a0a51=as[_0xf553('0x33')](_0x36f099);var _0x407147=_0x3a0a51[_0xf553('0x34')];for(var _0x4b9002=0x0;_0x4b9002<_0x3a0a51[_0xf553('0x35')][_0xf553('0x14')];_0x4b9002++){var _0x1fb419=_0x3a0a51[_0xf553('0x35')][_0x4b9002];var _0x8d3473='i';var _0x208312=_[_0xf553('0x36')](_0x372b0d,[_0xf553('0xa'),_0x1fb419[_0xf553('0x9')]]);if(_0x208312){var _0x392902=as[_0xf553('0x37')](_0x8d3473,_0x208312[_0xf553('0x38')],_0x1fb419);_0x574d28['default'][_0x407147](_0x392902[_0xf553('0x39')],_0x392902[_0xf553('0x3a')][_0xf553('0x3b')],_0x392902['value'][_0xf553('0x3c')]);}else{switch(_0x1fb419[_0xf553('0x9')]){case'unreadMessages':var _0x292ad9=parseReadParameter(_0x1fb419['value']);_0x574d28[_0xf553('0x3d')]['and'](_0x292ad9);break;case _0xf553('0x3e'):if(_0x1fb419[_0xf553('0x3f')]===_0xf553('0x40')){if(_0x1fb419['value'][_0xf553('0x41')]('\x20')[_0xf553('0x14')]>0x1){_0x574d28['contact'][_0x407147](_0xf553('0x32'),qs[_0xf553('0x31')](_0x1fb419[_0xf553('0x3a')],!![]),null);}else{var _0x301a60='%'+_0x1fb419[_0xf553('0x3a')]+'%';_0x574d28[_0xf553('0x42')][_0x407147]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x301a60,_0x301a60,_0x301a60);}}else{_0x208312=_[_0xf553('0x36')](_0x372b0d,[_0xf553('0xa'),'ContactId']);_0x1fb419[_0xf553('0x9')]=_0xf553('0x43');_0x392902=as[_0xf553('0x37')](_0x8d3473,_0x208312[_0xf553('0x38')],_0x1fb419);_0x574d28[_0xf553('0x42')][_0x407147](_0x392902['text'],_0x392902[_0xf553('0x3a')][_0xf553('0x3b')],_0x392902['value'][_0xf553('0x3c')]);}break;case _0xf553('0x44'):var _0x409a68=_0x1fb419[_0xf553('0x3a')][_0xf553('0x41')](',')['map'](function(_0x67085d){return Number(_0x67085d);});var _0x113357=parseTagParameter(_0x409a68);_0x574d28['tags'][_0xf553('0x45')]['and'](_0x113357);_0x574d28['tags'][_0xf553('0x46')]=_0x409a68;break;case _0xf553('0x47'):if(_0x1fb419[_0xf553('0x3f')]===_0xf553('0x40')){_0x574d28[_0xf553('0x48')][_0x407147](_0xf553('0x49'),'%'+_0x1fb419['value']+'%',null);}else{_0x208312=_['find'](_0x372b0d,[_0xf553('0xa'),'UserId']);_0x1fb419[_0xf553('0x9')]=_0xf553('0x4a');_0x392902=as['buildExpression'](_0x8d3473,_0x208312[_0xf553('0x38')],_0x1fb419);_0x574d28[_0xf553('0x48')][_0x407147](_0x392902[_0xf553('0x39')],_0x392902[_0xf553('0x3a')][_0xf553('0x3b')],_0x392902[_0xf553('0x3a')][_0xf553('0x3c')]);}break;case _0xf553('0x4b'):case _0xf553('0x4c'):_0x392902=as['buildExpression']('me',null,_0x1fb419);_0x574d28['body'][_0x407147](_0x392902['text'],_0x392902[_0xf553('0x3a')][_0xf553('0x3b')],_0x392902[_0xf553('0x3a')]['end']);break;}}}return _0x574d28;}function parseModelFields(_0x150a68,_0x3cd79b,_0x12e829){var _0x334fec=utils['getAccountFK'](_0x150a68);var _0x401ec3=squel[_0xf553('0x22')]();var _0x4b3a8c=_(_0x3cd79b)[_0xf553('0x4d')]()[_0xf553('0x4e')](function(_0x9d9d38){return _[_0xf553('0x4f')](_0x12e829,[_0xf553('0xa'),_0x9d9d38])?_0x9d9d38:undefined;})['compact']()[_0xf553('0x3a')]();if(_0x4b3a8c[_0xf553('0x14')]>0x0){_0x4b3a8c[_0xf553('0x24')](function(_0x421990){if(_0x421990===_0x334fec){_0x401ec3[_0xf553('0x50')]('i.'+_0x334fec+_0xf553('0x16'),[][_0xf553('0x51')](_0x3cd79b[_0x421990]));}else if(_0x421990===_0xf553('0x52')){var _0x48cea8=JSON[_0xf553('0x53')](_0x3cd79b[_0x421990])[_0xf553('0x54')];var _0x17fb89=JSON[_0xf553('0x53')](_0x3cd79b[_0x421990])['$lte'];_0x401ec3[_0xf553('0x50')](_0xf553('0x55'),_0x48cea8,_0x17fb89);}else{if(_0x3cd79b[_0x421990]==='null'){_0x401ec3['and']('i.'+_0x421990+_0xf553('0x56'));}else{_0x401ec3[_0xf553('0x50')]('i.'+_0x421990+_0xf553('0x57'),_0x3cd79b[_0x421990]);}}});}return _0x401ec3;}function parseQueryParameters(_0x2fd762,_0x860d6e,_0x2965c0){var _0x547d7e=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x2fd762,_0x860d6e,_0x2965c0);})[_0xf553('0x58')](function(_0x2effe8){_0x547d7e[_0xf553('0x59')][_0xf553('0x50')](_0x2effe8);return parseReadParameter(_0x860d6e[_0xf553('0x3d')]);})[_0xf553('0x58')](function(_0x30c421){_0x547d7e[_0xf553('0x3d')][_0xf553('0x50')](_0x30c421);return parseTagParameter(_0x860d6e[_0xf553('0x5a')]);})[_0xf553('0x58')](function(_0x5b8565){_0x547d7e[_0xf553('0x5b')][_0xf553('0x45')][_0xf553('0x50')](_0x5b8565);return parseSearchFilter(_0x2fd762,_0x860d6e['filter']);})[_0xf553('0x58')](function(_0x1c1e0f){_0x547d7e[_0xf553('0x5c')]=_0x1c1e0f;return _0x547d7e;});}function checkAccountsRestrictions(_0x1aca87,_0x1d4fc3,_0x3d49ca){var _0x31a490=utils[_0xf553('0x18')](_0x1aca87);var _0x4ade2d=_0xf553('0x5d')+_[_0xf553('0x5e')](_0x1aca87)+(_0x1aca87===_0xf553('0x5f')?_0xf553('0x60'):_0xf553('0x61'));var _0x74eacc=squel['expr']();return Promise[_0xf553('0x62')]()['then'](function(){if(_0x3d49ca[_0xf553('0x7')]&&_0x1d4fc3['role']==='agent'){return _0x1d4fc3[_0x4ade2d]({'attributes':['id'],'raw':!![]});}})[_0xf553('0x58')](function(_0x14ec61){if(_0x14ec61){if(_0x14ec61[_0xf553('0x14')]===0x0){_0x74eacc[_0xf553('0x50')]('i.'+_0x31a490+_0xf553('0x56'));}else{_0x74eacc[_0xf553('0x50')]('i.'+_0x31a490+'\x20IN\x20?',_[_0xf553('0x4e')](_0x14ec61,'id'));}}else if(!_0x3d49ca[_0x31a490]){_0x74eacc[_0xf553('0x50')]('i.'+_0x31a490+_0xf553('0x63'));}})['then'](function(){return _0x74eacc;});}function getClosedOrderClause(_0x2777b5,_0x29ea7b){var _0x1aae08='';var _0x132f85=[_0xf553('0x64'),'i.secondDisposition',_0xf553('0x65')];if(_0x2777b5==='mail'){_0x132f85[_0xf553('0x66')](_0xf553('0x67'));}if(_0x29ea7b[_0xf553('0x68')]==='0'&&_0x2777b5===_0xf553('0x2d')){_0x1aae08=_0xf553('0x67');}else{if(_0x29ea7b[_0xf553('0x68')]==='1'){_0x132f85[_0xf553('0x69')]();}_0x1aae08='CONCAT_WS(\x27\x27,\x20'+_0x132f85[_0xf553('0x6a')](',\x20')+')';}return _0x1aae08;}function getFilteredInteractions(_0x250b11,_0x479906,_0x22fab8,_0x2a702f){var _0x4214ce=utils[_0xf553('0xd')](_0x250b11);var _0x41e02f=_['capitalize'](_0x250b11)+'Interaction';var _0x20f0e0=[];var _0x42f927=getTagsQuery();var _0x31ff53={'type':db[_0xf553('0x6b')][_0xf553('0x6c')]['SELECT'],'raw':!![]};var _0x283dcf=[];var _0x48fe65=[];return db[_0xf553('0x6d')]['query'](_0x42f927['toString'](),_0x31ff53)[_0xf553('0x58')](function(_0x53e7d5){_0x20f0e0=_['keyBy'](_0x53e7d5,'id');_0x31ff53=_[_0xf553('0x6e')](_0x31ff53,{'model':db[_0x41e02f],'mapToModel':!![],'nest':!![]});if(_0x22fab8[_0xf553('0x59')]){_0x2a702f['attributes'][_0xf553('0x24')](function(_0xddd05d){_0x479906['field']('i.'+_0xddd05d);});}else{_0x479906[_0xf553('0x9')](_0xf553('0x6f'),_0xf553('0x70'));_0x479906['field'](_0xf553('0x71'),'Account.key');_0x479906[_0xf553('0x9')](_0xf553('0x72'),_0xf553('0x73'));if(_0x250b11===_0xf553('0x2d')){_0x479906[_0xf553('0x9')](_0xf553('0x74'),_0xf553('0x75'));_0x479906[_0xf553('0x9')](_0xf553('0x76'),_0xf553('0x77'));_0x479906[_0xf553('0x9')](_0xf553('0x78'));_0x479906[_0xf553('0x9')](_0xf553('0x79'));_0x479906['field']('i.updatedAt');_0x479906['field']('i.closed');_0x479906[_0xf553('0x9')](_0xf553('0x7a'));_0x479906[_0xf553('0x9')](_0xf553('0x7b'));_0x479906[_0xf553('0x9')]('i.lastMsgAt');_0x479906[_0xf553('0x9')](_0xf553('0x7c'));_0x479906[_0xf553('0x9')](_0xf553('0x7d'));_0x479906[_0xf553('0x9')](_0xf553('0x65'));_0x479906[_0xf553('0x9')](_0xf553('0x7e'));_0x479906[_0xf553('0x9')](_0xf553('0x64'));_0x479906[_0xf553('0x9')](_0xf553('0x67'));_0x479906[_0xf553('0x9')](_0xf553('0x7f'));_0x479906[_0xf553('0x9')](_0xf553('0x80'));_0x479906[_0xf553('0x9')](_0xf553('0x81'));_0x479906[_0xf553('0x9')](_0xf553('0x82'));}else if(_0x250b11==='openchannel'){_0x479906[_0xf553('0x9')](_0xf553('0x83'),_0xf553('0x77'));}else{_0x479906[_0xf553('0x9')](_0xf553('0x84'),_0xf553('0x77'));}if(_0x250b11!=='mail'){_0x479906['field'](_0xf553('0x85'));}_0x479906[_0xf553('0x9')](_0xf553('0x86'),_0xf553('0x87'));_0x479906[_0xf553('0x9')]('c.lastName',_0xf553('0x88'));_0x479906[_0xf553('0x9')](_0xf553('0x89'),_0xf553('0x8a'));_0x479906['field'](_0xf553('0x8b'),_0xf553('0x8c'));_0x479906[_0xf553('0x9')](_0xf553('0x8d'),'Contact.mobile');_0x479906[_0xf553('0x9')](_0xf553('0x8e'),_0xf553('0x8f'));_0x479906[_0xf553('0x9')](_0xf553('0x90'),_0xf553('0x91'));_0x479906['field'](_0xf553('0x92'),_0xf553('0x93'));_0x479906['field'](_0xf553('0x94'),'TagIds');}if(_0x2a702f['limit']){_0x479906[_0xf553('0x95')](_0x2a702f[_0xf553('0x95')]);}if(_0x2a702f[_0xf553('0x96')]){_0x479906[_0xf553('0x96')](_0x2a702f[_0xf553('0x96')]);}return db[_0xf553('0x6d')][_0xf553('0x97')](_0x479906[_0xf553('0x98')](),_0x31ff53);})[_0xf553('0x58')](function(_0x27a971){_0x283dcf=_0x27a971;var _0x229e00=getUsersQuery(_0x250b11,_0x283dcf);return db[_0xf553('0x6d')][_0xf553('0x97')](_0x229e00['toString'](),_0x31ff53);})[_0xf553('0x58')](function(_0x5019ea){_0x48fe65=_[_0xf553('0x99')](_0x5019ea,_0x4214ce);if(_0x250b11===_0xf553('0x2d')){return db[_0xf553('0x9a')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xf553('0x58')](function(_0x57f347){var _0x25f135=_0x57f347?_0x57f347[_0xf553('0x9b')]:undefined;var _0x456814=_0x283dcf[_0xf553('0x4e')](function(_0x5814b1){return updateInteraction(_0x5814b1,_0x20f0e0,_0x48fe65,_0x25f135);});return Promise[_0xf553('0x9c')](_0x456814);});}function countFilteredInteractions(_0x3b0d30,_0x4df1fd){var _0x10c946=_0x3b0d30[_0xf553('0x9d')]();_0x10c946[_0xf553('0x9')](_0xf553('0x9e'));_0x10c946['field'](_0xf553('0x6f'),_0xf553('0x70'));var _0x1d47b3=utils[_0xf553('0x23')](_0x4df1fd);if(!_[_0xf553('0x9f')](_0x1d47b3)){_0x10c946[_0xf553('0x15')](_0xf553('0xa0'),_0x1d47b3);}var _0x170596={'type':db[_0xf553('0x6b')][_0xf553('0x6c')]['SELECT'],'raw':!![]};return db[_0xf553('0x6d')][_0xf553('0x97')](_0x10c946[_0xf553('0x98')](),_0x170596);}module[_0xf553('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index bce6442..8ad20d9 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9fe=['catch','updateInteraction','TagIds','map','forEach','push','waiting','talking','answered','abandoned','closed','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x9ca556,_0xeb5ee){var _0x1c90f5=function(_0x3af5d4){while(--_0x3af5d4){_0x9ca556['push'](_0x9ca556['shift']());}};_0x1c90f5(++_0xeb5ee);}(_0xf9fe,0x179));var _0xef9f=function(_0x1c6294,_0x168adc){_0x1c6294=_0x1c6294-0x0;var _0x3e079b=_0xf9fe[_0x1c6294];return _0x3e079b;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2c17f7,_0x4c35fd){return new Promise(function(_0x534527,_0x5da239){try{var _0x382959=[];if(_0x4c35fd[_0x2c17f7]){_0x382959=_0x4c35fd[_0x2c17f7][_0xef9f('0x0')](function(_0x1a08d4){return{'id':_0x1a08d4['id'],'fullname':_0x1a08d4['fullname']};});}return _0x534527(_0x382959);}catch(_0xcab4af){_0x5da239(_0xcab4af);}});}function getInteractionTags(_0x28c849,_0x461022){var _0xa3895=[];if(_0x28c849){_0x28c849['split'](',')[_0xef9f('0x1')](function(_0x3ad8f9){_0xa3895[_0xef9f('0x2')](_0x461022[_0x3ad8f9]);});}return _0xa3895;}function updateWaitingCounter(_0x43d2ce){if(_0x43d2ce[_0xef9f('0x3')]){_0x43d2ce['waiting']-=0x1;}}function updateInteractionCounters(_0x5b4b8f){_0x5b4b8f[_0xef9f('0x3')]=0x0;_0x5b4b8f[_0xef9f('0x4')]=0x0;_0x5b4b8f[_0xef9f('0x5')]=0x0;_0x5b4b8f['unmanaged']=0x0;_0x5b4b8f[_0xef9f('0x6')]=0x0;_0x5b4b8f['total']=0x0;if(_0x5b4b8f[_0xef9f('0x7')]){if(_0x5b4b8f[_0xef9f('0x8')]===_0xef9f('0x6')){_0x5b4b8f[_0xef9f('0x6')]+=0x1;updateWaitingCounter(_0x5b4b8f);}if(_0x5b4b8f[_0xef9f('0x9')]){_0x5b4b8f['answered']+=0x1;if(_0x5b4b8f[_0xef9f('0x4')]){_0x5b4b8f['talking']-=0x1;}}else{if(_0x5b4b8f[_0xef9f('0x8')]){_0x5b4b8f[_0xef9f('0xa')]+=0x1;updateWaitingCounter(_0x5b4b8f);}}}else{if(!_0x5b4b8f[_0xef9f('0x9')]){_0x5b4b8f[_0xef9f('0x3')]+=0x1;}if(_0x5b4b8f['UserId']){_0x5b4b8f[_0xef9f('0x4')]+=0x1;updateWaitingCounter(_0x5b4b8f);}}_0x5b4b8f['total']+=0x1;return _0x5b4b8f;}function getLastMessageText(_0x153de2){return db[_0xef9f('0xb')][_0xef9f('0xc')]({'where':{'$and':[{'MailInteractionId':_0x153de2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xef9f('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xef9f('0xe')],'order':_0xef9f('0xf'),'raw':!![]})[_0xef9f('0x10')](function(_0x3c0370){if(_0x3c0370&&_0x3c0370[_0xef9f('0xe')]){_0x153de2[_0xef9f('0x11')]=_[_0xef9f('0x12')](_0x3c0370['plainBody']);}return _0x153de2;})[_0xef9f('0x13')](function(_0x535cf5){throw _0x535cf5;});}exports[_0xef9f('0x14')]=function(_0xb5451b,_0x21b9f1,_0xaa8e3e,_0x14c5ab){return new Promise(function(_0x1ec0f4,_0x1b404a){return getInteractionUsers(_0xb5451b['id'],_0xaa8e3e)['then'](function(_0x49c5b7){_0xb5451b['Users']=_0x49c5b7;return getInteractionTags(_0xb5451b[_0xef9f('0x15')],_0x21b9f1);})['then'](function(_0x318b6f){_0xb5451b['Tags']=_0x318b6f;delete _0xb5451b[_0xef9f('0x15')];return updateInteractionCounters(_0xb5451b);})['then'](function(_0x3f5f51){if(_0x14c5ab){return getLastMessageText(_0x3f5f51);}else{return _0x3f5f51;}})['then'](function(_0x106689){_0x1ec0f4(_0x106689);})[_0xef9f('0x13')](function(_0xb12e78){_0x1b404a(_0xb12e78);});});}; \ No newline at end of file +var _0x066f=['closed','disposition','UserId','total','MailMessage','findOne','-id','then','plainBody','lastMsgText','trimStart','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','unmanaged','abandoned'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x066f,0x19f));var _0xf066=function(_0x369ce0,_0x584c10){_0x369ce0=_0x369ce0-0x0;var _0x1ac9d3=_0x066f[_0x369ce0];return _0x1ac9d3;};'use strict';var _=require(_0xf066('0x0'));var db=require(_0xf066('0x1'))['db'];function getInteractionUsers(_0x32304a,_0x270432){return new Promise(function(_0x534f46,_0x927212){try{var _0x473426=[];if(_0x270432[_0x32304a]){_0x473426=_0x270432[_0x32304a][_0xf066('0x2')](function(_0x57b3ae){return{'id':_0x57b3ae['id'],'fullname':_0x57b3ae['fullname']};});}return _0x534f46(_0x473426);}catch(_0x1cc72b){_0x927212(_0x1cc72b);}});}function getInteractionTags(_0x3caa8d,_0x5259db){var _0x157231=[];if(_0x3caa8d){_0x3caa8d[_0xf066('0x3')](',')[_0xf066('0x4')](function(_0x5478eb){_0x157231[_0xf066('0x5')](_0x5259db[_0x5478eb]);});}return _0x157231;}function updateWaitingCounter(_0xdb4792){if(_0xdb4792[_0xf066('0x6')]){_0xdb4792[_0xf066('0x6')]-=0x1;}}function updateInteractionCounters(_0x2f768d){_0x2f768d[_0xf066('0x6')]=0x0;_0x2f768d[_0xf066('0x7')]=0x0;_0x2f768d['answered']=0x0;_0x2f768d[_0xf066('0x8')]=0x0;_0x2f768d[_0xf066('0x9')]=0x0;_0x2f768d['total']=0x0;if(_0x2f768d[_0xf066('0xa')]){if(_0x2f768d[_0xf066('0xb')]==='abandoned'){_0x2f768d[_0xf066('0x9')]+=0x1;updateWaitingCounter(_0x2f768d);}if(_0x2f768d[_0xf066('0xc')]){_0x2f768d['answered']+=0x1;if(_0x2f768d[_0xf066('0x7')]){_0x2f768d[_0xf066('0x7')]-=0x1;}}else{if(_0x2f768d[_0xf066('0xb')]){_0x2f768d[_0xf066('0x8')]+=0x1;updateWaitingCounter(_0x2f768d);}}}else{if(!_0x2f768d[_0xf066('0xc')]){_0x2f768d['waiting']+=0x1;}if(_0x2f768d[_0xf066('0xc')]){_0x2f768d[_0xf066('0x7')]+=0x1;updateWaitingCounter(_0x2f768d);}}_0x2f768d[_0xf066('0xd')]+=0x1;return _0x2f768d;}function getLastMessageText(_0x40e89f){return db[_0xf066('0xe')][_0xf066('0xf')]({'where':{'$and':[{'MailInteractionId':_0x40e89f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xf066('0x10'),'raw':!![]})[_0xf066('0x11')](function(_0x5509be){if(_0x5509be&&_0x5509be[_0xf066('0x12')]){_0x40e89f[_0xf066('0x13')]=_[_0xf066('0x14')](_0x5509be[_0xf066('0x12')]);}return _0x40e89f;})['catch'](function(_0x4594a2){throw _0x4594a2;});}exports['updateInteraction']=function(_0xfed8e5,_0x189a10,_0x5e7b4d,_0x384d40){return new Promise(function(_0x17283d,_0x77ee38){return getInteractionUsers(_0xfed8e5['id'],_0x5e7b4d)[_0xf066('0x11')](function(_0x2c6215){_0xfed8e5[_0xf066('0x15')]=_0x2c6215;return getInteractionTags(_0xfed8e5[_0xf066('0x16')],_0x189a10);})['then'](function(_0xd6084e){_0xfed8e5[_0xf066('0x17')]=_0xd6084e;delete _0xfed8e5['TagIds'];return updateInteractionCounters(_0xfed8e5);})['then'](function(_0x565941){if(_0x384d40){return getLastMessageText(_0x565941);}else{return _0x565941;}})[_0xf066('0x11')](function(_0x4900c3){_0x17283d(_0x4900c3);})[_0xf066('0x18')](function(_0x554fb9){_0x77ee38(_0x554fb9);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 3485304..5c506a9 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fa5=['then','update','info','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','accounts','_interactions','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','findOne'];(function(_0x37fb1c,_0x32c6cd){var _0x5483ac=function(_0x194ac6){while(--_0x194ac6){_0x37fb1c['push'](_0x37fb1c['shift']());}};_0x5483ac(++_0x32c6cd);}(_0x3fa5,0x113));var _0x53fa=function(_0x545a0b,_0x4d99aa){_0x545a0b=_0x545a0b-0x0;var _0xca241=_0x3fa5[_0x545a0b];return _0xca241;};'use strict';var _=require(_0x53fa('0x0'));var db=require(_0x53fa('0x1'))['db'];var loggers={'openchannel':require(_0x53fa('0x2'))(_0x53fa('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x53fa('0x4')),'sms':require(_0x53fa('0x2'))(_0x53fa('0x5')),'chat':require('../../config/logger')(_0x53fa('0x6')),'whatsapp':require(_0x53fa('0x2'))(_0x53fa('0x7'))};function getAccountFK(_0x3d1120){return _['capitalize'](_0x3d1120)+(_0x3d1120===_0x53fa('0x8')?_0x53fa('0x9'):_0x53fa('0xa'))+'Id';}function getInteractionFK(_0xba377b){return _[_0x53fa('0xb')](_0xba377b)+_0x53fa('0xc');}function getInteractionId(_0x2598fa,_0x5f3043,_0x12567a){if(_0x2598fa&&_0x2598fa[_[_0x53fa('0xd')](_0x12567a)+'InteractionId']){return _0x2598fa[_['upperFirst'](_0x12567a)+'InteractionId'];}else if(_0x2598fa&&_0x2598fa['id']){return _0x2598fa['id'];}else if(_0x5f3043&&_0x5f3043['id']){return _0x5f3043['id'];}else{return'unknown';}}function getInteractionsTables(_0x59833e){return{'accounts':_0x59833e+'_'+(_0x59833e===_0x53fa('0x8')?'websites':_0x53fa('0xe')),'interactions':_0x59833e+_0x53fa('0xf'),'interactionsTags':_0x59833e+_0x53fa('0x10'),'messages':_0x59833e+'_messages','userInteractions':'user_has_'+_0x59833e+_0x53fa('0xf')};}function getSelectedTags(_0x310cd1){var _0x57d631=[];if(_0x310cd1){_0x57d631=Array[_0x53fa('0x11')](_0x310cd1)?_0x310cd1:[_0x310cd1];}return _0x57d631;}function log(_0x424598,_0x33eebd,_0x363c6f,_0x28a746,_0x5e21d7,_0x1b0edc){loggers[_0x5e21d7[_0x53fa('0x12')]()][_0x424598](_0x53fa('0x13'),_0x1b0edc[_0x53fa('0x14')](),_0x33eebd?_0x33eebd['id']:null,_0x33eebd?_0x33eebd[_0x53fa('0x15')]:null,_0x33eebd?_0x33eebd[_0x53fa('0x16')]:null,getInteractionId(_0x363c6f,_0x28a746,_0x5e21d7),_0x363c6f?JSON[_0x53fa('0x17')](_0x363c6f):'null');}function updateUser(_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906){db[_[_0x53fa('0xd')](_0x184e75)+'Interaction'][_0x53fa('0x18')]({'where':{'id':getInteractionId(_0x461921,_0x101e7e,_0x184e75)}})[_0x53fa('0x19')](function(_0x828fd6){if(_0x828fd6){return _0x828fd6[_0x53fa('0x1a')]({'UserId':_0x6e82b3?_0x6e82b3['id']:null});}})[_0x53fa('0x19')](function(_0x5ee699){if(_0x5ee699){log(_0x53fa('0x1b'),_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906);}})[_0x53fa('0x1c')](function(){log('error',_0x6e82b3,_0x461921,_0x101e7e,_0x184e75,_0x529906);});}module[_0x53fa('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x168d=['chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','findOne','then','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize'];(function(_0xf8eff0,_0x33f2e9){var _0x2cc7b4=function(_0x579604){while(--_0x579604){_0xf8eff0['push'](_0xf8eff0['shift']());}};_0x2cc7b4(++_0x33f2e9);}(_0x168d,0xa7));var _0xd168=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x168d[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var db=require(_0xd168('0x0'))['db'];var loggers={'openchannel':require(_0xd168('0x1'))(_0xd168('0x2')),'mail':require(_0xd168('0x1'))('mail-interactions'),'fax':require(_0xd168('0x1'))('fax-interactions'),'sms':require(_0xd168('0x1'))(_0xd168('0x3')),'chat':require(_0xd168('0x1'))(_0xd168('0x4')),'whatsapp':require(_0xd168('0x1'))(_0xd168('0x5'))};function getAccountFK(_0x3789fe){return _[_0xd168('0x6')](_0x3789fe)+(_0x3789fe===_0xd168('0x7')?_0xd168('0x8'):_0xd168('0x9'))+'Id';}function getInteractionFK(_0x4572b5){return _[_0xd168('0x6')](_0x4572b5)+_0xd168('0xa');}function getInteractionId(_0x3eecf1,_0x486dc9,_0x48b998){if(_0x3eecf1&&_0x3eecf1[_['upperFirst'](_0x48b998)+_0xd168('0xa')]){return _0x3eecf1[_[_0xd168('0xb')](_0x48b998)+'InteractionId'];}else if(_0x3eecf1&&_0x3eecf1['id']){return _0x3eecf1['id'];}else if(_0x486dc9&&_0x486dc9['id']){return _0x486dc9['id'];}else{return _0xd168('0xc');}}function getInteractionsTables(_0x5af796){return{'accounts':_0x5af796+'_'+(_0x5af796===_0xd168('0x7')?_0xd168('0xd'):_0xd168('0xe')),'interactions':_0x5af796+_0xd168('0xf'),'interactionsTags':_0x5af796+_0xd168('0x10'),'messages':_0x5af796+_0xd168('0x11'),'userInteractions':_0xd168('0x12')+_0x5af796+_0xd168('0xf')};}function getSelectedTags(_0x13082d){var _0x31296d=[];if(_0x13082d){_0x31296d=Array['isArray'](_0x13082d)?_0x13082d:[_0x13082d];}return _0x31296d;}function log(_0x54d0d2,_0x2d498e,_0x26617b,_0x59eec7,_0x59e00f,_0x346a34){loggers[_0x59e00f['toLowerCase']()][_0x54d0d2](_0xd168('0x13'),_0x346a34['toUpperCase'](),_0x2d498e?_0x2d498e['id']:null,_0x2d498e?_0x2d498e[_0xd168('0x14')]:null,_0x2d498e?_0x2d498e[_0xd168('0x15')]:null,getInteractionId(_0x26617b,_0x59eec7,_0x59e00f),_0x26617b?JSON[_0xd168('0x16')](_0x26617b):'null');}function updateUser(_0x59974c,_0x52a7e7,_0x75d670,_0x23d1b1,_0xf02dde){db[_[_0xd168('0xb')](_0x23d1b1)+_0xd168('0x17')][_0xd168('0x18')]({'where':{'id':getInteractionId(_0x52a7e7,_0x75d670,_0x23d1b1)}})[_0xd168('0x19')](function(_0x532998){if(_0x532998){return _0x532998['update']({'UserId':_0x59974c?_0x59974c['id']:null});}})[_0xd168('0x19')](function(_0xd8c672){if(_0xd8c672){log('info',_0x59974c,_0x52a7e7,_0x75d670,_0x23d1b1,_0xf02dde);}})[_0xd168('0x1a')](function(){log(_0xd168('0x1b'),_0x59974c,_0x52a7e7,_0x75d670,_0x23d1b1,_0xf02dde);});}module[_0xd168('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3ab1e28..4268d0c 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73c5=['%s:%s:%s','base64','final','hasOwnProperty','use','License','findOne','then','count','status','format','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr'];(function(_0x4dafe8,_0x21a07a){var _0x3371b7=function(_0x183697){while(--_0x183697){_0x4dafe8['push'](_0x4dafe8['shift']());}};_0x3371b7(++_0x21a07a);}(_0x73c5,0x177));var _0x573c=function(_0x48a735,_0x41ed28){_0x48a735=_0x48a735-0x0;var _0x512ad5=_0x73c5[_0x48a735];return _0x512ad5;};'use strict';var crypto=require(_0x573c('0x0'));var util=require(_0x573c('0x1'));var compose=require(_0x573c('0x2'));var db=require(_0x573c('0x3'))['db'];var config=require(_0x573c('0x4'));function getValueFromLicense(_0xf3a467,_0x120319){if(_0xf3a467&&_0x120319){if(_0x120319['data1']&&_0x120319[_0x573c('0x5')]){var _0x2d719c=_0x120319['data1'];var _0x21cdde=_0x120319[_0x573c('0x5')];var _0x3d8d94=_0x2d719c[_0x573c('0x6')]('-')[0x4];var _0x800ca6=_0x2d719c[_0x573c('0x6')]('-')[0x0];var _0x5d474b=crypto[_0x573c('0x7')](_0x573c('0x8'),util['format'](_0x573c('0x9'),_0x3d8d94,_0x2d719c,_0x800ca6));var _0x456832=_0x5d474b['update'](_0x21cdde,_0x573c('0xa'),'utf8');_0x456832+=_0x5d474b[_0x573c('0xb')]('utf8');var _0x5067dc=JSON['parse'](_0x456832);return _0x5067dc[_0x573c('0xc')](_0xf3a467)?_0x5067dc[_0xf3a467]:null;}}return null;}function isLimit(_0x206c71,_0xcf7bf0,_0x2f78b4,_0x5ea932){var _0x1797a1=_0xcf7bf0;return compose()[_0x573c('0xd')](function(_0x1f1f08,_0x415975,_0x5eea06){return db[_0x573c('0xe')][_0x573c('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3fb6ec){var _0x1d465e=getValueFromLicense(_0x206c71,_0x3fb6ec);return _0x1d465e?_0x1d465e:_0x1797a1;})[_0x573c('0x10')](function(_0x5c0181){_0x1797a1=_0x5c0181;return _0x2f78b4[_0x573c('0x11')](_0x5ea932);})[_0x573c('0x10')](function(_0x4e74a4){if(_0x4e74a4>=_0x1797a1){return _0x415975[_0x573c('0x12')](0x193)['json']({'message':util[_0x573c('0x13')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x206c71)});}_0x5eea06();})['catch'](function(_0x143be6){_0x5eea06(_0x143be6);});});}function isUserLimit(){return isLimit(_0x573c('0x14'),0x1,db[_0x573c('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x573c('0x16')}]}});}exports[_0x573c('0x17')]=isUserLimit; \ No newline at end of file +var _0x8aee=['base64','utf8','final','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','update'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x8aee,0xe0));var _0xe8ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aee[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xe8ae('0x0'));var util=require(_0xe8ae('0x1'));var compose=require('composable-middleware');var db=require(_0xe8ae('0x2'))['db'];var config=require(_0xe8ae('0x3'));function getValueFromLicense(_0x12dd0c,_0x414dd6){if(_0x12dd0c&&_0x414dd6){if(_0x414dd6['data1']&&_0x414dd6[_0xe8ae('0x4')]){var _0x39914d=_0x414dd6[_0xe8ae('0x5')];var _0xefff83=_0x414dd6[_0xe8ae('0x4')];var _0x2753f7=_0x39914d[_0xe8ae('0x6')]('-')[0x4];var _0x451a4e=_0x39914d[_0xe8ae('0x6')]('-')[0x0];var _0x843784=crypto[_0xe8ae('0x7')](_0xe8ae('0x8'),util['format']('%s:%s:%s',_0x2753f7,_0x39914d,_0x451a4e));var _0x23a480=_0x843784[_0xe8ae('0x9')](_0xefff83,_0xe8ae('0xa'),_0xe8ae('0xb'));_0x23a480+=_0x843784[_0xe8ae('0xc')]('utf8');var _0xefac12=JSON['parse'](_0x23a480);return _0xefac12['hasOwnProperty'](_0x12dd0c)?_0xefac12[_0x12dd0c]:null;}}return null;}function isLimit(_0x11c79c,_0x1dadb7,_0x89b555,_0x15887e){var _0x35eecb=_0x1dadb7;return compose()['use'](function(_0xbfbf9c,_0x2a9f85,_0x582e77){return db[_0xe8ae('0xd')][_0xe8ae('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xe8ae('0xf')](function(_0x35d8ff){var _0xeabe6c=getValueFromLicense(_0x11c79c,_0x35d8ff);return _0xeabe6c?_0xeabe6c:_0x35eecb;})[_0xe8ae('0xf')](function(_0x53300e){_0x35eecb=_0x53300e;return _0x89b555[_0xe8ae('0x10')](_0x15887e);})['then'](function(_0x3470c5){if(_0x3470c5>=_0x35eecb){return _0x2a9f85[_0xe8ae('0x11')](0x193)[_0xe8ae('0x12')]({'message':util['format'](_0xe8ae('0x13'),_0x11c79c)});}_0x582e77();})[_0xe8ae('0x14')](function(_0x4a7c8b){_0x582e77(_0x4a7c8b);});});}function isUserLimit(){return isLimit(_0xe8ae('0x15'),0x1,db[_0xe8ae('0x16')],{'where':{'$or':[{'role':_0xe8ae('0x17')},{'role':_0xe8ae('0x18')}]}});}exports[_0xe8ae('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4e57f76..089c020 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 _0xa93e=['$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$and]','replace','length','split','slice','forEach','shift','indexOf','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa93e,0x6e));var _0xea93=function(_0x4f9fce,_0x3d6c38){_0x4f9fce=_0x4f9fce-0x0;var _0x4591f6=_0xa93e[_0x4f9fce];return _0x4591f6;};'use strict';var _=require(_0xea93('0x0'));var moment=require(_0xea93('0x1'));exports[_0xea93('0x2')]=function(_0x3b540e){var _0x321317={'conditions':[]};_0x321317[_0xea93('0x3')]=_['startsWith'](_0x3b540e,'[$or]')?'or':'and';var _0x3d213a=_0x3b540e['replace'](_0xea93('0x4'),'')[_0xea93('0x5')]('[$or]','')['split']('||');for(var _0x1a697d=0x0;_0x1a697d<_0x3d213a[_0xea93('0x6')];_0x1a697d++){var _0x46b6aa=_0x3d213a[_0x1a697d][_0xea93('0x7')](':=');var _0x529578=_0x46b6aa[0x0];var _0x8132f2=_0x46b6aa[_0xea93('0x8')](0x1);_0x8132f2[_0xea93('0x9')](function(_0x2eb99f){var _0x591e09=_0x2eb99f[_0xea93('0x7')]('[')[_0xea93('0xa')]();var _0x3d67b8=_0x2eb99f['match'](/\[(.*?)\]/g);_0x3d67b8[_0xea93('0x9')](function(_0x5a315b){var _0x1590cd=_0x5a315b[_0xea93('0x7')]('[')['filter'](function(_0x3b9846){return _0x3b9846[_0xea93('0xb')](']')>-0x1;})['map'](function(_0x1f5e0a){return _0x1f5e0a[_0xea93('0x7')](']')[0x0];})[0x0];_0x321317['conditions']['push']({'field':_0x529578,'operator':_0x591e09,'value':_0x1590cd});});});}return _0x321317;};exports[_0xea93('0xc')]=function(_0x5b9d6d,_0x210afc,_0x74b9e){var _0x536097={};if(_0x210afc===_0xea93('0xd')){if(_0x74b9e[_0xea93('0xe')]==='$eq'){_0x74b9e['operator']=_0xea93('0xf');_0x74b9e[_0xea93('0x10')]+=','+_0x74b9e[_0xea93('0x10')];}else if(_[_0xea93('0x11')]([_0xea93('0x12'),_0xea93('0x13')],_0x74b9e[_0xea93('0xe')])){_0x74b9e['value']=moment(_0x74b9e[_0xea93('0x10')])[_0xea93('0x14')](0x1,_0xea93('0x15'))[_0xea93('0x16')](_0xea93('0x17'));}}if(_0x74b9e[_0xea93('0x18')]){_0x210afc=_0x74b9e[_0xea93('0x18')];_0x536097['text']=_0xea93('0x19')+_0x5b9d6d+'.'+_0x74b9e['field']+_0xea93('0x1a')+_0x74b9e[_0xea93('0x18')]+')\x20'+parseOperator(_0x74b9e['operator']);}else{_0x536097[_0xea93('0x1b')]=_0x5b9d6d+'.'+_0x74b9e[_0xea93('0x1c')]+'\x20'+parseOperator(_0x74b9e['operator']);}if(_[_0xea93('0x11')]([_0xea93('0x1d'),_0xea93('0x1e')],_0x74b9e['operator']))_0x536097[_0xea93('0x1b')]='('+_0x536097[_0xea93('0x1b')]+_0xea93('0x1f')+_0x5b9d6d+'.'+_0x74b9e['field']+_0xea93('0x20');_0x536097['value']=parseValue(_0x210afc,_0x74b9e[_0xea93('0xe')],_0x74b9e[_0xea93('0x10')]);return _0x536097;};function parseOperator(_0x596a34){var _0x1db467;switch(_0x596a34){case _0xea93('0x21'):_0x1db467=_0xea93('0x22');break;case _0xea93('0x1e'):_0x1db467='NOT\x20IN\x20?';break;case'$eq':_0x1db467=_0xea93('0x23');break;case'$ne':_0x1db467=_0xea93('0x24');break;case _0xea93('0x25'):case _0xea93('0x26'):case _0xea93('0x27'):_0x1db467=_0xea93('0x28');break;case _0xea93('0x29'):_0x1db467='<\x20?';break;case'$gt':_0x1db467=_0xea93('0x2a');break;case'$lte':_0x1db467='<=\x20?';break;case _0xea93('0x2b'):_0x1db467=_0xea93('0x2c');break;case'$between':_0x1db467=_0xea93('0x2d');break;}return _0x1db467;}function parseValue(_0x1e123e,_0x29bf4d,_0x3bccd9){var _0x56aab7={'start':undefined,'end':undefined};switch(_0x29bf4d){case _0xea93('0x21'):case _0xea93('0x1e'):_0x56aab7[_0xea93('0x2e')]=_0x3bccd9[_0xea93('0x7')](',');break;case _0xea93('0x25'):_0x56aab7[_0xea93('0x2e')]='%'+_0x3bccd9+'%';break;case _0xea93('0x26'):_0x56aab7[_0xea93('0x2e')]=_0x3bccd9+'%';break;case'$endsWith':_0x56aab7['start']='%'+_0x3bccd9;break;case _0xea93('0xf'):var _0x2c8e5c=_0x3bccd9['split'](',');var _0x3bccd9=_0x2c8e5c[_0xea93('0xa')]();var _0x17205d=_0x2c8e5c['pop']();if(_0x1e123e==='DATE'){_0x3bccd9=moment(_0x3bccd9)['utcOffset'](0x0,!![])[_0xea93('0x16')]();_0x17205d=moment(_0x17205d)[_0xea93('0x2f')](0x0,!![])[_0xea93('0x14')](0x17,_0xea93('0x30'))[_0xea93('0x14')](0x3b,_0xea93('0x31'))[_0xea93('0x14')](0x3b,_0xea93('0x32'))[_0xea93('0x16')]();}_0x56aab7={'start':_0x3bccd9,'end':_0x17205d};break;default:_0x56aab7[_0xea93('0x2e')]=_0x3bccd9;break;}return _0x56aab7;} \ No newline at end of file +var _0x6eb8=['length','slice','forEach','shift','match','filter','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','$gt','>\x20?','$lte','>=\x20?','start','$substring','utcOffset','hours','minutes','seconds','moment','parseSearch','startsWith','[$or]','replace','[$and]','split'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x6eb8,0x191));var _0x86eb=function(_0x546d39,_0x436507){_0x546d39=_0x546d39-0x0;var _0x24b39c=_0x6eb8[_0x546d39];return _0x24b39c;};'use strict';var _=require('lodash');var moment=require(_0x86eb('0x0'));exports[_0x86eb('0x1')]=function(_0x545e9a){var _0xda1216={'conditions':[]};_0xda1216['sqlOperator']=_[_0x86eb('0x2')](_0x545e9a,_0x86eb('0x3'))?'or':'and';var _0x3f6fa3=_0x545e9a[_0x86eb('0x4')](_0x86eb('0x5'),'')[_0x86eb('0x4')](_0x86eb('0x3'),'')[_0x86eb('0x6')]('||');for(var _0xade83a=0x0;_0xade83a<_0x3f6fa3[_0x86eb('0x7')];_0xade83a++){var _0x372d34=_0x3f6fa3[_0xade83a][_0x86eb('0x6')](':=');var _0x254e49=_0x372d34[0x0];var _0x1a0330=_0x372d34[_0x86eb('0x8')](0x1);_0x1a0330[_0x86eb('0x9')](function(_0x3f055d){var _0x8b374b=_0x3f055d['split']('[')[_0x86eb('0xa')]();var _0x42d792=_0x3f055d[_0x86eb('0xb')](/\[(.*?)\]/g);_0x42d792['forEach'](function(_0x5b9ff2){var _0x5db95c=_0x5b9ff2[_0x86eb('0x6')]('[')[_0x86eb('0xc')](function(_0x4049c2){return _0x4049c2['indexOf'](']')>-0x1;})[_0x86eb('0xd')](function(_0x4600a4){return _0x4600a4['split'](']')[0x0];})[0x0];_0xda1216[_0x86eb('0xe')]['push']({'field':_0x254e49,'operator':_0x8b374b,'value':_0x5db95c});});});}return _0xda1216;};exports[_0x86eb('0xf')]=function(_0x5187bc,_0x362449,_0x55150f){var _0x4acbdf={};if(_0x362449===_0x86eb('0x10')){if(_0x55150f[_0x86eb('0x11')]===_0x86eb('0x12')){_0x55150f[_0x86eb('0x11')]=_0x86eb('0x13');_0x55150f[_0x86eb('0x14')]+=','+_0x55150f[_0x86eb('0x14')];}else if(_[_0x86eb('0x15')](['$gt','$lte'],_0x55150f[_0x86eb('0x11')])){_0x55150f[_0x86eb('0x14')]=moment(_0x55150f[_0x86eb('0x14')])[_0x86eb('0x16')](0x1,_0x86eb('0x17'))[_0x86eb('0x18')](_0x86eb('0x19'));}}if(_0x55150f[_0x86eb('0x1a')]){_0x362449=_0x55150f[_0x86eb('0x1a')];_0x4acbdf[_0x86eb('0x1b')]=_0x86eb('0x1c')+_0x5187bc+'.'+_0x55150f[_0x86eb('0x1d')]+_0x86eb('0x1e')+_0x55150f[_0x86eb('0x1a')]+')\x20'+parseOperator(_0x55150f[_0x86eb('0x11')]);}else{_0x4acbdf[_0x86eb('0x1b')]=_0x5187bc+'.'+_0x55150f[_0x86eb('0x1d')]+'\x20'+parseOperator(_0x55150f[_0x86eb('0x11')]);}if(_[_0x86eb('0x15')](['$ne',_0x86eb('0x1f')],_0x55150f[_0x86eb('0x11')]))_0x4acbdf[_0x86eb('0x1b')]='('+_0x4acbdf['text']+_0x86eb('0x20')+_0x5187bc+'.'+_0x55150f['field']+_0x86eb('0x21');_0x4acbdf['value']=parseValue(_0x362449,_0x55150f[_0x86eb('0x11')],_0x55150f[_0x86eb('0x14')]);return _0x4acbdf;};function parseOperator(_0x173489){var _0x55d5c0;switch(_0x173489){case _0x86eb('0x22'):_0x55d5c0=_0x86eb('0x23');break;case'$notIn':_0x55d5c0='NOT\x20IN\x20?';break;case _0x86eb('0x12'):_0x55d5c0='=\x20?';break;case'$ne':_0x55d5c0=_0x86eb('0x24');break;case'$substring':case _0x86eb('0x25'):case _0x86eb('0x26'):_0x55d5c0='LIKE\x20?';break;case _0x86eb('0x27'):_0x55d5c0=_0x86eb('0x28');break;case _0x86eb('0x29'):_0x55d5c0=_0x86eb('0x2a');break;case _0x86eb('0x2b'):_0x55d5c0='<=\x20?';break;case'$gte':_0x55d5c0=_0x86eb('0x2c');break;case'$between':_0x55d5c0='BETWEEN\x20?\x20AND\x20?';break;}return _0x55d5c0;}function parseValue(_0x3a2843,_0x2b8e57,_0x298ba4){var _0x320906={'start':undefined,'end':undefined};switch(_0x2b8e57){case _0x86eb('0x22'):case _0x86eb('0x1f'):_0x320906[_0x86eb('0x2d')]=_0x298ba4[_0x86eb('0x6')](',');break;case _0x86eb('0x2e'):_0x320906[_0x86eb('0x2d')]='%'+_0x298ba4+'%';break;case _0x86eb('0x25'):_0x320906[_0x86eb('0x2d')]=_0x298ba4+'%';break;case _0x86eb('0x26'):_0x320906[_0x86eb('0x2d')]='%'+_0x298ba4;break;case'$between':var _0x59a838=_0x298ba4[_0x86eb('0x6')](',');var _0x298ba4=_0x59a838['shift']();var _0x49f720=_0x59a838['pop']();if(_0x3a2843===_0x86eb('0x10')){_0x298ba4=moment(_0x298ba4)[_0x86eb('0x2f')](0x0,!![])[_0x86eb('0x18')]();_0x49f720=moment(_0x49f720)[_0x86eb('0x2f')](0x0,!![])['add'](0x17,_0x86eb('0x30'))[_0x86eb('0x16')](0x3b,_0x86eb('0x31'))[_0x86eb('0x16')](0x3b,_0x86eb('0x32'))[_0x86eb('0x18')]();}_0x320906={'start':_0x298ba4,'end':_0x49f720};break;default:_0x320906[_0x86eb('0x2d')]=_0x298ba4;break;}return _0x320906;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c131d17..ab10e39 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 _0x2a77=['alias','fields','split','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','cast','col','DESC','priority','unsigned','ASC','omit','isEmpty','isString','length','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','replace','{EXPR}','join','query','$id','map','filters','intersection','attributes','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','type','where','lower','options','include','includeAll','push','lodash','moment','../../mysqldb','parse','keys','includes','model'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x2a77,0x1d1));var _0x72a7=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0x2a77[_0x42a5e4];return _0xd56657;};'use strict';var _=require(_0x72a7('0x0'));var sequelize=require('sequelize');var moment=require(_0x72a7('0x1'));var db=require(_0x72a7('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x31202f){var _0x18e27d=['ne'];try{var _0x297296=JSON[_0x72a7('0x3')](_0x31202f);var _0x355521=Object[_0x72a7('0x4')](_0x297296)[0x0];return _0x18e27d[_0x72a7('0x5')](_0x355521);}catch(_0x26decf){return![];}}function getOperatorValue(_0x192e41){var _0x4d6961=JSON['parse'](_0x192e41);var _0x4dde3e=Object[_0x72a7('0x4')](_0x4d6961)[0x0];var _0x325018=_0x4d6961[_0x4dde3e];return{['$'+_0x4dde3e]:_0x325018};}function parseIncludeModel(_0x508a8b){var _0x5bbd70=JSON[_0x72a7('0x3')](_0x508a8b);return{'model':db[_0x5bbd70[_0x72a7('0x6')]],'as':_0x5bbd70[_0x72a7('0x7')],'attributes':_0x5bbd70[_0x72a7('0x8')],'raw':_0x5bbd70['raw']};}exports[_0x72a7('0x8')]=function(_0xbd6671){var _0x24db99=null;if(_0xbd6671){_0x24db99=_0xbd6671[_0x72a7('0x9')](',');}return _0x24db99;};exports['filters']=function(_0x214992,_0x446479){var _0x1df9f8={};if(!_['isEmpty'](_0x214992)){_['forOwn'](_0x214992,function(_0x4f4be8,_0x5248ab){try{if(_0x446479){var _0x229d6c=_['find'](_0x446479,{'name':_0x5248ab})||{};if(hasSequelizeOperator(_0x4f4be8)){_0x1df9f8[_0x5248ab]=getOperatorValue(_0x4f4be8);}else if(_0x229d6c['type']==='DATE'&&_[_0x72a7('0xa')](_0x4f4be8)){var _0xcdba8c=JSON[_0x72a7('0x3')](_0x4f4be8);var _0x1869ad={'$gte':moment(moment(_0xcdba8c[_0x72a7('0xb')])[_0x72a7('0xc')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0xcdba8c[_0x72a7('0xd')])[_0x72a7('0xc')](_0x72a7('0xe')))[_0x72a7('0xf')]()['subtract'](0x1,'s')[_0x72a7('0xc')]()};_0x1df9f8[_0x5248ab]=_0x1869ad;}else if(_0x229d6c[_0x72a7('0x10')]===_0x72a7('0x11')){_0x1df9f8[_0x5248ab]=_0x4f4be8;}else{_0x1df9f8[_0x5248ab]=_['isArray'](_0x4f4be8)?_0x4f4be8:JSON['parse'](_0x4f4be8);}}else{_0x1df9f8[_0x5248ab]=_[_0x72a7('0x12')](_0x4f4be8)?_0x4f4be8:JSON[_0x72a7('0x3')](_0x4f4be8);}}catch(_0x171ed6){_0x1df9f8[_0x5248ab]=_0x4f4be8[_0x72a7('0x9')](',');}});}return _0x1df9f8;};exports[_0x72a7('0x13')]=function(_0x3e9d9a){_0x3e9d9a=parseInt(_0x3e9d9a,0xa);if(!_0x3e9d9a||_0x3e9d9a<0x0){_0x3e9d9a=LIMIT_VALUE;}return _0x3e9d9a;};exports['offset']=function(_0x48fe0b){_0x48fe0b=parseInt(_0x48fe0b,0xa);if(!_0x48fe0b||_0x48fe0b<0x0){_0x48fe0b=0x0;}return _0x48fe0b;};exports['sort']=function(_0x3c8257){var _0x474962,_0x29838b=null;if(_0x3c8257){_0x474962=_0x3c8257[_0x72a7('0x9')](',');_0x29838b=_['map'](_0x474962,function(_0x345c77){if(_0x345c77['indexOf']('-')===0x0){return[_0x345c77==='priority'?sequelize[_0x72a7('0x14')](sequelize[_0x72a7('0x15')]('priority'),'unsigned'):_0x345c77['substr'](0x1),_0x72a7('0x16')];}else{return[_0x345c77===_0x72a7('0x17')?sequelize[_0x72a7('0x14')](sequelize['col'](_0x72a7('0x17')),_0x72a7('0x18')):_0x345c77,_0x72a7('0x19')];}});}return _0x29838b;};exports[_0x72a7('0x1a')]=function(_0x14b17a,_0x4a2bae){if(_[_0x72a7('0x1b')](_0x14b17a)){return _0x14b17a;}if(_[_0x72a7('0x12')](_0x14b17a)){for(var _0x37905a=0x0;_0x37905a<_0x14b17a['length'];_0x37905a+=0x1){_0x14b17a[_0x37905a]=this[_0x72a7('0x1a')](_0x14b17a[_0x37905a],_0x4a2bae);}return _0x14b17a;}if(!_['isObject'](_0x14b17a)){return _0x14b17a;}if(_[_0x72a7('0x1c')](_0x4a2bae)){_0x4a2bae=[_0x4a2bae];}if(!_[_0x72a7('0x12')](_0x4a2bae)){return _0x14b17a;}for(var _0x25987e=0x0;_0x25987e<_0x4a2bae[_0x72a7('0x1d')];_0x25987e+=0x1){_['unset'](_0x14b17a,_0x4a2bae[_0x25987e]);}for(var _0x13f1a7 in _0x14b17a){if(_0x14b17a['hasOwnProperty'](_0x13f1a7)){_0x14b17a[_0x13f1a7]=this[_0x72a7('0x1a')](_0x14b17a[_0x13f1a7],_0x4a2bae);}}return _0x14b17a;};exports['isNumeric']=function(_0x1e5281){return _0x1e5281['match'](RegExp(_0x72a7('0x1e')))?!![]:![];};exports[_0x72a7('0x1f')]=function(_0x3dd33b){return _0x3dd33b[_0x72a7('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x72a7('0x21')]=function(_0x5855ab,_0x56693f){var _0xd0de2f=[];var _0x367321=/[ `!@#$%^&*()_\-?~]/;var _0x526f5c=_0x56693f?_0x72a7('0x22'):'{EXPR}';_0x5855ab[_0x72a7('0x9')](/[ ,]+/)[_0x72a7('0x23')](function(_0x55306f){_0x55306f=_0x55306f[_0x72a7('0x24')](/([^:]")"+/g,'$1');_0x55306f='+'+_0x55306f+'*';var _0x385d47=_0x55306f[_0x72a7('0x20')](_0x367321);if(_0x385d47){_0x55306f='\x22'+_0x55306f+'\x22';}_0xd0de2f['push'](_0x55306f);});_0x526f5c=_0x526f5c[_0x72a7('0x24')](_0x72a7('0x25'),_0xd0de2f[_0x72a7('0x26')]('\x20'));return _0x526f5c;};exports['getOptions']=function(_0x411c5a,_0x36a551,_0x469475){var _0x39991d={},_0x236ec1={};if(_0x36a551[_0x72a7('0x27')][_0x72a7('0x28')]){_0x36a551[_0x72a7('0x27')]['id']=_0x36a551[_0x72a7('0x27')][_0x72a7('0x28')];delete _0x36a551[_0x72a7('0x27')][_0x72a7('0x28')];}_0x39991d['model']=_[_0x72a7('0x29')](_0x411c5a,_0x72a7('0x10'));_0x39991d[_0x72a7('0x27')]=_['keys'](_0x36a551[_0x72a7('0x27')]);_0x39991d[_0x72a7('0x2a')]=_[_0x72a7('0x2b')](_0x39991d[_0x72a7('0x6')],_0x39991d[_0x72a7('0x27')]);_0x236ec1[_0x72a7('0x2c')]=_[_0x72a7('0x2b')](_0x39991d['model'],this[_0x72a7('0x8')](_0x36a551[_0x72a7('0x27')][_0x72a7('0x8')]));_0x236ec1['attributes']=_0x236ec1['attributes'][_0x72a7('0x1d')]?_0x236ec1['attributes']:_0x39991d[_0x72a7('0x6')];if(!_0x36a551[_0x72a7('0x27')][_0x72a7('0x2d')](_0x72a7('0x2e'))){_0x236ec1[_0x72a7('0x13')]=this[_0x72a7('0x13')](_0x36a551[_0x72a7('0x27')][_0x72a7('0x13')]);_0x236ec1[_0x72a7('0x2f')]=this['offset'](_0x36a551['query'][_0x72a7('0x2f')]);}_0x236ec1['order']=this[_0x72a7('0x30')](_0x36a551[_0x72a7('0x27')]['sort']);_0x236ec1['where']=this[_0x72a7('0x2a')](_[_0x72a7('0x31')](_0x36a551[_0x72a7('0x27')],_0x39991d[_0x72a7('0x2a')]),_0x411c5a);if(_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')]){var _0x58949d=_0x411c5a;var _0x12ced6=_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')];if(typeof _0x12ced6==='object'){_0x58949d=_[_0x72a7('0x32')](_0x411c5a,function(_0x1e75e3){return _[_0x72a7('0x5')](_0x12ced6['columns'],_0x1e75e3[_0x72a7('0x10')]);});_0x12ced6=_0x12ced6['value'];}_0x236ec1['where']=_[_0x72a7('0x33')](_0x236ec1['where'],{'$or':_[_0x72a7('0x29')](_0x58949d,function(_0x3411fc){if(_0x3411fc[_0x72a7('0x34')]!=='VIRTUAL'){if(_0x469475){return sequelize[_0x72a7('0x35')](sequelize['fn']('lower',sequelize[_0x72a7('0x15')](_0x3411fc[_0x72a7('0x10')])),{'$like':sequelize['fn'](_0x72a7('0x36'),'%'+_0x36a551[_0x72a7('0x27')][_0x72a7('0x32')]+'%')});}else{var _0x5699bc={};_0x5699bc[_0x3411fc[_0x72a7('0x10')]]={'$like':'%'+_0x36a551['query'][_0x72a7('0x32')]+'%'};return _0x5699bc;}}})});}_0x236ec1=_['merge']({},_0x236ec1,_0x36a551[_0x72a7('0x37')]);return _0x236ec1;};exports[_0x72a7('0x38')]=function(_0x281f85){var _0x304af3=[];if(_0x281f85[_0x72a7('0x39')]){_0x304af3[_0x72a7('0x3a')]({'all':!![]});}else if(_0x281f85['include']){if(Array[_0x72a7('0x12')](_0x281f85[_0x72a7('0x38')])){_0x304af3=Object[_0x72a7('0x4')](_0x281f85[_0x72a7('0x38')])[_0x72a7('0x29')](function(_0x43e74b){return parseIncludeModel(_0x281f85[_0x72a7('0x38')][_0x43e74b]);});}else{var _0x1b2fa7=parseIncludeModel(_0x281f85['include']);_0x304af3[_0x72a7('0x3a')](_0x1b2fa7);}}return _0x304af3;}; \ No newline at end of file +var _0x9c49=['parse','keys','includes','model','raw','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','DESC','ASC','omit','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','forEach','replace','getOptions','query','$id','intersection','attributes','fields','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','include','push','lodash','sequelize','../../mysqldb'];(function(_0x59c3e7,_0x53ce5e){var _0x520b04=function(_0x54aaa6){while(--_0x54aaa6){_0x59c3e7['push'](_0x59c3e7['shift']());}};_0x520b04(++_0x53ce5e);}(_0x9c49,0x189));var _0x99c4=function(_0x2c8efa,_0x3abcb1){_0x2c8efa=_0x2c8efa-0x0;var _0x230edf=_0x9c49[_0x2c8efa];return _0x230edf;};'use strict';var _=require(_0x99c4('0x0'));var sequelize=require(_0x99c4('0x1'));var moment=require('moment');var db=require(_0x99c4('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x7e8f6c){var _0x518bfb=['ne'];try{var _0x531281=JSON[_0x99c4('0x3')](_0x7e8f6c);var _0xd7a0e1=Object[_0x99c4('0x4')](_0x531281)[0x0];return _0x518bfb[_0x99c4('0x5')](_0xd7a0e1);}catch(_0x41ff3f){return![];}}function getOperatorValue(_0x11ed4e){var _0xb77a34=JSON[_0x99c4('0x3')](_0x11ed4e);var _0x3304e0=Object[_0x99c4('0x4')](_0xb77a34)[0x0];var _0x4040fb=_0xb77a34[_0x3304e0];return{['$'+_0x3304e0]:_0x4040fb};}function parseIncludeModel(_0x152989){var _0x322013=JSON['parse'](_0x152989);return{'model':db[_0x322013[_0x99c4('0x6')]],'as':_0x322013['alias'],'attributes':_0x322013['fields'],'raw':_0x322013[_0x99c4('0x7')]};}exports['fields']=function(_0x41f91b){var _0x313173=null;if(_0x41f91b){_0x313173=_0x41f91b[_0x99c4('0x8')](',');}return _0x313173;};exports[_0x99c4('0x9')]=function(_0x4587cc,_0x71b0e5){var _0x57bd25={};if(!_[_0x99c4('0xa')](_0x4587cc)){_['forOwn'](_0x4587cc,function(_0x4eb3c6,_0x4bd67f){try{if(_0x71b0e5){var _0xf06984=_[_0x99c4('0xb')](_0x71b0e5,{'name':_0x4bd67f})||{};if(hasSequelizeOperator(_0x4eb3c6)){_0x57bd25[_0x4bd67f]=getOperatorValue(_0x4eb3c6);}else if(_0xf06984[_0x99c4('0xc')]===_0x99c4('0xd')&&_[_0x99c4('0xe')](_0x4eb3c6)){var _0x453578=JSON[_0x99c4('0x3')](_0x4eb3c6);var _0x3fce74={'$gte':moment(moment(_0x453578[_0x99c4('0xf')])[_0x99c4('0x10')]('YYYY-MM-DD'))[_0x99c4('0x11')]()['format'](),'$lte':moment(moment(_0x453578[_0x99c4('0x12')])[_0x99c4('0x10')](_0x99c4('0x13')))['utc']()[_0x99c4('0x14')](0x1,'s')[_0x99c4('0x10')]()};_0x57bd25[_0x4bd67f]=_0x3fce74;}else if(_0xf06984[_0x99c4('0x15')]===_0x99c4('0x16')){_0x57bd25[_0x4bd67f]=_0x4eb3c6;}else{_0x57bd25[_0x4bd67f]=_[_0x99c4('0x17')](_0x4eb3c6)?_0x4eb3c6:JSON[_0x99c4('0x3')](_0x4eb3c6);}}else{_0x57bd25[_0x4bd67f]=_[_0x99c4('0x17')](_0x4eb3c6)?_0x4eb3c6:JSON[_0x99c4('0x3')](_0x4eb3c6);}}catch(_0x1b5084){_0x57bd25[_0x4bd67f]=_0x4eb3c6['split'](',');}});}return _0x57bd25;};exports[_0x99c4('0x18')]=function(_0x1f2fc0){_0x1f2fc0=parseInt(_0x1f2fc0,0xa);if(!_0x1f2fc0||_0x1f2fc0<0x0){_0x1f2fc0=LIMIT_VALUE;}return _0x1f2fc0;};exports[_0x99c4('0x19')]=function(_0x1f6fe4){_0x1f6fe4=parseInt(_0x1f6fe4,0xa);if(!_0x1f6fe4||_0x1f6fe4<0x0){_0x1f6fe4=0x0;}return _0x1f6fe4;};exports[_0x99c4('0x1a')]=function(_0x4a7190){var _0xe915b9,_0x9d0106=null;if(_0x4a7190){_0xe915b9=_0x4a7190[_0x99c4('0x8')](',');_0x9d0106=_[_0x99c4('0x1b')](_0xe915b9,function(_0x3c2e0c){if(_0x3c2e0c[_0x99c4('0x1c')]('-')===0x0){return[_0x3c2e0c===_0x99c4('0x1d')?sequelize[_0x99c4('0x1e')](sequelize[_0x99c4('0x1f')](_0x99c4('0x1d')),'unsigned'):_0x3c2e0c[_0x99c4('0x20')](0x1),_0x99c4('0x21')];}else{return[_0x3c2e0c==='priority'?sequelize[_0x99c4('0x1e')](sequelize[_0x99c4('0x1f')]('priority'),'unsigned'):_0x3c2e0c,_0x99c4('0x22')];}});}return _0x9d0106;};exports[_0x99c4('0x23')]=function(_0x4be3fa,_0x464f4f){if(_[_0x99c4('0xa')](_0x4be3fa)){return _0x4be3fa;}if(_[_0x99c4('0x17')](_0x4be3fa)){for(var _0xed9666=0x0;_0xed9666<_0x4be3fa['length'];_0xed9666+=0x1){_0x4be3fa[_0xed9666]=this[_0x99c4('0x23')](_0x4be3fa[_0xed9666],_0x464f4f);}return _0x4be3fa;}if(!_[_0x99c4('0x24')](_0x4be3fa)){return _0x4be3fa;}if(_[_0x99c4('0x25')](_0x464f4f)){_0x464f4f=[_0x464f4f];}if(!_[_0x99c4('0x17')](_0x464f4f)){return _0x4be3fa;}for(var _0x59688c=0x0;_0x59688c<_0x464f4f['length'];_0x59688c+=0x1){_[_0x99c4('0x26')](_0x4be3fa,_0x464f4f[_0x59688c]);}for(var _0x14c794 in _0x4be3fa){if(_0x4be3fa[_0x99c4('0x27')](_0x14c794)){_0x4be3fa[_0x14c794]=this[_0x99c4('0x23')](_0x4be3fa[_0x14c794],_0x464f4f);}}return _0x4be3fa;};exports[_0x99c4('0x28')]=function(_0x310e24){return _0x310e24['match'](RegExp(_0x99c4('0x29')))?!![]:![];};exports[_0x99c4('0x2a')]=function(_0x2a1dcd){return _0x2a1dcd[_0x99c4('0x2b')](/^\S+@\S+$/)?!![]:![];};exports[_0x99c4('0x2c')]=function(_0x6f4592,_0x2ec69c){var _0x4c427f=[];var _0x2ebf69=/[ `!@#$%^&*()_\-?~]/;var _0x21944c=_0x2ec69c?'\x22{EXPR}\x22':_0x99c4('0x2d');_0x6f4592['split'](/[ ,]+/)[_0x99c4('0x2e')](function(_0x2ed75d){_0x2ed75d=_0x2ed75d[_0x99c4('0x2f')](/([^:]")"+/g,'$1');_0x2ed75d='+'+_0x2ed75d+'*';var _0x42256c=_0x2ed75d['match'](_0x2ebf69);if(_0x42256c){_0x2ed75d='\x22'+_0x2ed75d+'\x22';}_0x4c427f['push'](_0x2ed75d);});_0x21944c=_0x21944c[_0x99c4('0x2f')]('{EXPR}',_0x4c427f['join']('\x20'));return _0x21944c;};exports[_0x99c4('0x30')]=function(_0x55684a,_0x350c57,_0x56e1b6){var _0x4cc8b5={},_0x19fbb3={};if(_0x350c57['query']['$id']){_0x350c57[_0x99c4('0x31')]['id']=_0x350c57['query'][_0x99c4('0x32')];delete _0x350c57['query']['$id'];}_0x4cc8b5[_0x99c4('0x6')]=_[_0x99c4('0x1b')](_0x55684a,_0x99c4('0x15'));_0x4cc8b5['query']=_[_0x99c4('0x4')](_0x350c57['query']);_0x4cc8b5[_0x99c4('0x9')]=_[_0x99c4('0x33')](_0x4cc8b5[_0x99c4('0x6')],_0x4cc8b5[_0x99c4('0x31')]);_0x19fbb3[_0x99c4('0x34')]=_['intersection'](_0x4cc8b5[_0x99c4('0x6')],this[_0x99c4('0x35')](_0x350c57[_0x99c4('0x31')]['fields']));_0x19fbb3[_0x99c4('0x34')]=_0x19fbb3[_0x99c4('0x34')]['length']?_0x19fbb3['attributes']:_0x4cc8b5[_0x99c4('0x6')];if(!_0x350c57[_0x99c4('0x31')][_0x99c4('0x27')](_0x99c4('0x36'))){_0x19fbb3['limit']=this[_0x99c4('0x18')](_0x350c57[_0x99c4('0x31')][_0x99c4('0x18')]);_0x19fbb3[_0x99c4('0x19')]=this[_0x99c4('0x19')](_0x350c57['query'][_0x99c4('0x19')]);}_0x19fbb3['order']=this[_0x99c4('0x1a')](_0x350c57[_0x99c4('0x31')]['sort']);_0x19fbb3[_0x99c4('0x37')]=this[_0x99c4('0x9')](_[_0x99c4('0x38')](_0x350c57[_0x99c4('0x31')],_0x4cc8b5[_0x99c4('0x9')]),_0x55684a);if(_0x350c57[_0x99c4('0x31')][_0x99c4('0x39')]){var _0x2d65e9=_0x55684a;var _0xad1a53=_0x350c57[_0x99c4('0x31')][_0x99c4('0x39')];if(typeof _0xad1a53===_0x99c4('0x3a')){_0x2d65e9=_[_0x99c4('0x39')](_0x55684a,function(_0x5ededb){return _[_0x99c4('0x5')](_0xad1a53[_0x99c4('0x3b')],_0x5ededb['name']);});_0xad1a53=_0xad1a53[_0x99c4('0x3c')];}_0x19fbb3['where']=_[_0x99c4('0x3d')](_0x19fbb3[_0x99c4('0x37')],{'$or':_['map'](_0x2d65e9,function(_0x14c0ee){if(_0x14c0ee[_0x99c4('0xc')]!==_0x99c4('0x3e')){if(_0x56e1b6){return sequelize[_0x99c4('0x37')](sequelize['fn'](_0x99c4('0x3f'),sequelize[_0x99c4('0x1f')](_0x14c0ee['name'])),{'$like':sequelize['fn']('lower','%'+_0x350c57[_0x99c4('0x31')][_0x99c4('0x39')]+'%')});}else{var _0xf34876={};_0xf34876[_0x14c0ee['name']]={'$like':'%'+_0x350c57[_0x99c4('0x31')][_0x99c4('0x39')]+'%'};return _0xf34876;}}})});}_0x19fbb3=_[_0x99c4('0x3d')]({},_0x19fbb3,_0x350c57['options']);return _0x19fbb3;};exports[_0x99c4('0x40')]=function(_0x5a3e58){var _0xbf2585=[];if(_0x5a3e58['includeAll']){_0xbf2585[_0x99c4('0x41')]({'all':!![]});}else if(_0x5a3e58['include']){if(Array[_0x99c4('0x17')](_0x5a3e58['include'])){_0xbf2585=Object[_0x99c4('0x4')](_0x5a3e58[_0x99c4('0x40')])['map'](function(_0x3d87c3){return parseIncludeModel(_0x5a3e58[_0x99c4('0x40')][_0x3d87c3]);});}else{var _0x305998=parseIncludeModel(_0x5a3e58[_0x99c4('0x40')]);_0xbf2585[_0x99c4('0x41')](_0x305998);}}return _0xbf2585;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 0f1f976..a66307a 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0x58390b,_0x185845){var _0x5947f9=function(_0x540753){while(--_0x540753){_0x58390b['push'](_0x58390b['shift']());}};_0x5947f9(++_0x185845);}(_0xf494,0x1c6));var _0x4f49=function(_0x49171b,_0x572be3){_0x49171b=_0x49171b-0x0;var _0x48daab=_0xf494[_0x49171b];return _0x48daab;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0xfa75d0,_0x445867){var _0x4931a3=function(_0xf15c72){while(--_0xf15c72){_0xfa75d0['push'](_0xfa75d0['shift']());}};_0x4931a3(++_0x445867);}(_0xf494,0x1c6));var _0x4f49=function(_0x84c2aa,_0x2063d0){_0x84c2aa=_0x84c2aa-0x0;var _0x7acb70=_0xf494[_0x84c2aa];return _0x7acb70;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 44bd632..9dbdadb 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaecb=['map','find','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unavailable','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound'];(function(_0x51c2a6,_0x3cbca9){var _0xddfb6e=function(_0x5738b5){while(--_0x5738b5){_0x51c2a6['push'](_0x51c2a6['shift']());}};_0xddfb6e(++_0x3cbca9);}(_0xaecb,0x1d0));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var jayson=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var amiClient=jayson[_0xbaec('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xbaec('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xbaec('0x4'),_0xbaec('0x5'),_0xbaec('0x6'),_0xbaec('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xbaec('0x8'),_0xbaec('0x9'),_0xbaec('0xa'),_0xbaec('0xb'),_0xbaec('0xc'),_0xbaec('0xd'),_0xbaec('0xe'),'ringInUse',_0xbaec('0xf'),_0xbaec('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbaec('0x11'),_0xbaec('0x12'),'message',_0xbaec('0x13'),_0xbaec('0x14'),_0xbaec('0x15'),_0xbaec('0x16'),'startPredictive','startProgressive',_0xbaec('0x17'),'erlangCallToSecond',_0xbaec('0x18'),_0xbaec('0x19'),_0xbaec('0x1a'),_0xbaec('0x1b'),_0xbaec('0x1c'),_0xbaec('0x1d'),_0xbaec('0x1e'),_0xbaec('0x1f'),_0xbaec('0x20'),_0xbaec('0x21'),_0xbaec('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x9156d8,_0x45c87e){var _0x425ef5=_0x45c87e===_0xbaec('0x23')?amiClient:routingClient;return _0x425ef5['request'](_['startCase'](_0x45c87e)+_0xbaec('0x24'),_0x9156d8)[_0xbaec('0x25')](function(_0x38469e){if(_0x38469e['error'])throw new Error(util[_0xbaec('0x26')](_0xbaec('0x27'),_0x45c87e));return _0x38469e[_0xbaec('0x28')];})[_0xbaec('0x29')](function(_0x446809){throw _0x446809;});}exports[_0xbaec('0x2a')]=getRealtimeQueues;function initializeQueues(_0x26dc80,_0xaa3ec,_0x2abdd1,_0x2c1658){var _0x16cfc4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2abdd1===_0xbaec('0x23')){if(_0x2c1658===_0xbaec('0x2b')){_0x16cfc4=_0x16cfc4[_0xbaec('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2c1658===_0xbaec('0x2d')){_0x16cfc4=_0x16cfc4[_0xbaec('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26dc80[_0xbaec('0x2e')](function(_0x331e11){var _0x533a31=_0x331e11['get']({'plain':!![]});_0x533a31[_0xbaec('0x6')]=0x0;_0x533a31[_0xbaec('0xb')]=0x0;_0x533a31['loggedIn']=0x0;_0x533a31[_0xbaec('0x4')]=0x0;_0x533a31['waiting']=0x0;if(_0x2abdd1==='voice'){_0x533a31[_0xbaec('0xf')]=0x0;_0x533a31['busy']=0x0;if(_0x2c1658==='outbound'){_0x533a31[_0xbaec('0x11')]=0x0;_0x533a31[_0xbaec('0x12')]=0x0;}}var _0x42f35c=_[_0xbaec('0x2f')](_0xaa3ec,['id',_0x533a31['id']]);if(_0x42f35c){_[_0xbaec('0x30')](_0x533a31,_[_0xbaec('0x31')](_0x42f35c,_0x16cfc4));}return _0x533a31;});}exports[_0xbaec('0x32')]=initializeQueues; \ No newline at end of file +var _0xf2ef=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','inbound','concat','outbound','map','get','loggedIn','available','busy','find','pick','initializeQueues','lodash','jayson/promise','util','http','client','paused','waiting','loggedInDb','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0xe55f99,_0x5a0172){var _0x17befc=function(_0x2bb0f1){while(--_0x2bb0f1){_0xe55f99['push'](_0xe55f99['shift']());}};_0x17befc(++_0x5a0172);}(_0xf2ef,0x134));var _0xff2e=function(_0x5e2ddd,_0x8bb9a1){_0x5e2ddd=_0x5e2ddd-0x0;var _0x19d942=_0xf2ef[_0x5e2ddd];return _0x19d942;};'use strict';var _=require(_0xff2e('0x0'));var jayson=require(_0xff2e('0x1'));var util=require(_0xff2e('0x2'));var amiClient=jayson['client'][_0xff2e('0x3')]({'port':0x232a});var routingClient=jayson[_0xff2e('0x4')][_0xff2e('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0xff2e('0x5'),_0xff2e('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse','invalid',_0xff2e('0x7'),'notInUse',_0xff2e('0x8'),_0xff2e('0x9'),_0xff2e('0xa'),'talking',_0xff2e('0xb'),_0xff2e('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xff2e('0xd'),_0xff2e('0xe'),'message',_0xff2e('0xf'),_0xff2e('0x10'),'dialMethod',_0xff2e('0x11'),_0xff2e('0x12'),_0xff2e('0x13'),_0xff2e('0x14'),_0xff2e('0x15'),'erlangAbandonmentRate',_0xff2e('0x16'),'dialPredictiveInterval',_0xff2e('0x17'),_0xff2e('0x18'),_0xff2e('0x19'),'predictiveIntervalTotalCalls',_0xff2e('0x1a'),_0xff2e('0x1b'),_0xff2e('0x1c'),_0xff2e('0x1d'),_0xff2e('0x1e')];function getRealtimeQueues(_0x175b21,_0x52717a){var _0x2a8af4=_0x52717a===_0xff2e('0x1f')?amiClient:routingClient;return _0x2a8af4['request'](_[_0xff2e('0x20')](_0x52717a)+'Queues',_0x175b21)['then'](function(_0x126b3e){if(_0x126b3e[_0xff2e('0x21')])throw new Error(util[_0xff2e('0x22')](_0xff2e('0x23'),_0x52717a));return _0x126b3e[_0xff2e('0x24')];})['catch'](function(_0x43778a){throw _0x43778a;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x501f96,_0x57a1c7,_0x40eb33,_0x242d15){var _0x3572b5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x40eb33===_0xff2e('0x1f')){if(_0x242d15===_0xff2e('0x25')){_0x3572b5=_0x3572b5[_0xff2e('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x242d15===_0xff2e('0x27')){_0x3572b5=_0x3572b5[_0xff2e('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x501f96[_0xff2e('0x28')](function(_0x4e5da0){var _0x1ef8dc=_0x4e5da0[_0xff2e('0x29')]({'plain':!![]});_0x1ef8dc[_0xff2e('0x5')]=0x0;_0x1ef8dc['loggedInDb']=0x0;_0x1ef8dc[_0xff2e('0x2a')]=0x0;_0x1ef8dc[_0xff2e('0x2b')]=0x0;_0x1ef8dc[_0xff2e('0x6')]=0x0;if(_0x40eb33==='voice'){_0x1ef8dc['talking']=0x0;_0x1ef8dc[_0xff2e('0x2c')]=0x0;if(_0x242d15===_0xff2e('0x27')){_0x1ef8dc[_0xff2e('0xd')]=0x0;_0x1ef8dc['originated']=0x0;}}var _0xdf4d7c=_[_0xff2e('0x2d')](_0x57a1c7,['id',_0x1ef8dc['id']]);if(_0xdf4d7c){_['merge'](_0x1ef8dc,_[_0xff2e('0x2e')](_0xdf4d7c,_0x3572b5));}return _0x1ef8dc;});}exports[_0xff2e('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e10af5b..858d62d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f2fe4ab..5157ef7 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 _0xd69c=['keys','length','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy'];(function(_0x293d81,_0x49fde4){var _0x450e85=function(_0x5241c6){while(--_0x5241c6){_0x293d81['push'](_0x293d81['shift']());}};_0x450e85(++_0x49fde4);}(_0xd69c,0x14f));var _0xcd69=function(_0x5171c5,_0x3f93dd){_0x5171c5=_0x5171c5-0x0;var _0x42affa=_0xd69c[_0x5171c5];return _0x42affa;};'use strict';var _=require(_0xcd69('0x0'));var os=require('os');var crypto=require(_0xcd69('0x1'));var machine=require(_0xcd69('0x2'));var exec=require(_0xcd69('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x1f6fa9=[];var _0xa3b499=os[_0xcd69('0x4')]();var _0x574a96=_[_0xcd69('0x5')](_[_0xcd69('0x6')](_0xa3b499));for(var _0x28b6c0=0x0;_0x28b6c0<_0x574a96[_0xcd69('0x7')];_0x28b6c0++){var _0x3590bf=_0xa3b499[_0x574a96[_0x28b6c0]]['filter'](function(_0x5483dc){return _0x5483dc[_0xcd69('0x8')]===_0xcd69('0x9')&&_0x5483dc[_0xcd69('0xa')]===![];});_0x1f6fa9=_0x1f6fa9[_0xcd69('0xb')](_0x3590bf);}return _0x1f6fa9;}function getFirstInterface(){var _0x25734a=_['head'](getInterfaces());return{'macAddress':_0x25734a&&_0x25734a[_0xcd69('0xc')]?_0x25734a[_0xcd69('0xc')]:_0xcd69('0xd'),'ipAddress':_0x25734a&&_0x25734a[_0xcd69('0xe')]?_0x25734a[_0xcd69('0xe')]:_0xcd69('0xf')};}exports[_0xcd69('0x10')]=getFirstInterface;function getCPUhash(){var _0x3af961=_[_0xcd69('0x5')](os[_0xcd69('0x11')]()['map'](function(_0x333c11){return _0x333c11[_0xcd69('0x12')];}))['join'](':');return crypto[_0xcd69('0x13')]('md5')[_0xcd69('0x14')](_0x3af961)[_0xcd69('0x15')](_0xcd69('0x16'));}exports[_0xcd69('0x17')]=function(){var _0x3380b6=os['platform']();var _0x209067=/[0-9a-f-]{36}/;if(config[_0xcd69('0x18')]&&_0x209067[_0xcd69('0x19')](config[_0xcd69('0x18')])){return config[_0xcd69('0x18')];}else if(_0x3380b6==='win32'){return exec(_0xcd69('0x1a'),{'encoding':_0xcd69('0x1b')})['replace']('\x0d\x0a','');}else{var _0x46e41b=getFirstInterface();var _0x40b4db=getCPUhash();var _0x417afc=_0x40b4db+'|'+os['hostname']()+'|'+_0x46e41b[_0xcd69('0x1c')]+'|'+_0x46e41b[_0xcd69('0x1d')];var _0x267c53=crypto['createHash']('md5')[_0xcd69('0x14')](_0x417afc)['digest']('hex');return _0x267c53[_0xcd69('0x1e')](0x0,0x8)+'-'+_0x267c53[_0xcd69('0x1e')](0x8,0xc)+'-'+_0x267c53[_0xcd69('0x1e')](0xc,0x10)+'-'+_0x267c53[_0xcd69('0x1e')](0x10,0x14)+'-'+_0x267c53[_0xcd69('0x1e')](0x14);}}; \ No newline at end of file +var _0x7b34=['hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','join','createHash','md5','update'];(function(_0x177cc1,_0x139553){var _0x2fef0f=function(_0x91e8ad){while(--_0x91e8ad){_0x177cc1['push'](_0x177cc1['shift']());}};_0x2fef0f(++_0x139553);}(_0x7b34,0xb2));var _0x47b3=function(_0x1af5cb,_0x472f65){_0x1af5cb=_0x1af5cb-0x0;var _0x12ca3f=_0x7b34[_0x1af5cb];return _0x12ca3f;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x47b3('0x0'))[_0x47b3('0x1')];var config=require(_0x47b3('0x2'));function getInterfaces(){var _0x559c34=[];var _0x424eb5=os[_0x47b3('0x3')]();var _0x3a7793=_[_0x47b3('0x4')](_[_0x47b3('0x5')](_0x424eb5));for(var _0x44fc5b=0x0;_0x44fc5b<_0x3a7793[_0x47b3('0x6')];_0x44fc5b++){var _0x4a3a0f=_0x424eb5[_0x3a7793[_0x44fc5b]][_0x47b3('0x7')](function(_0x13a767){return _0x13a767[_0x47b3('0x8')]==='IPv4'&&_0x13a767['internal']===![];});_0x559c34=_0x559c34[_0x47b3('0x9')](_0x4a3a0f);}return _0x559c34;}function getFirstInterface(){var _0x40c3ce=_[_0x47b3('0xa')](getInterfaces());return{'macAddress':_0x40c3ce&&_0x40c3ce[_0x47b3('0xb')]?_0x40c3ce[_0x47b3('0xb')]:'00:00:00:00:00:00','ipAddress':_0x40c3ce&&_0x40c3ce[_0x47b3('0xc')]?_0x40c3ce[_0x47b3('0xc')]:_0x47b3('0xd')};}exports[_0x47b3('0xe')]=getFirstInterface;function getCPUhash(){var _0x37583b=_[_0x47b3('0x4')](os[_0x47b3('0xf')]()['map'](function(_0x6d6818){return _0x6d6818['model'];}))[_0x47b3('0x10')](':');return crypto[_0x47b3('0x11')](_0x47b3('0x12'))[_0x47b3('0x13')](_0x37583b)['digest'](_0x47b3('0x14'));}exports[_0x47b3('0x15')]=function(){var _0x39c2bb=os[_0x47b3('0x16')]();var _0x6e6fec=/[0-9a-f-]{36}/;if(config[_0x47b3('0x17')]&&_0x6e6fec[_0x47b3('0x18')](config['licenseToken'])){return config[_0x47b3('0x17')];}else if(_0x39c2bb==='win32'){return exec(_0x47b3('0x19'),{'encoding':_0x47b3('0x1a')})[_0x47b3('0x1b')]('\x0d\x0a','');}else{var _0x9241cb=getFirstInterface();var _0x277d20=getCPUhash();var _0xe472f3=_0x277d20+'|'+os[_0x47b3('0x1c')]()+'|'+_0x9241cb[_0x47b3('0x1d')]+'|'+_0x9241cb[_0x47b3('0x1e')];var _0x2bf0f0=crypto['createHash'](_0x47b3('0x12'))[_0x47b3('0x13')](_0xe472f3)[_0x47b3('0x1f')](_0x47b3('0x14'));return _0x2bf0f0[_0x47b3('0x20')](0x0,0x8)+'-'+_0x2bf0f0[_0x47b3('0x20')](0x8,0xc)+'-'+_0x2bf0f0[_0x47b3('0x20')](0xc,0x10)+'-'+_0x2bf0f0['substring'](0x10,0x14)+'-'+_0x2bf0f0[_0x47b3('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index af876cf..6e9ee84 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 _0x7df8=['get','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','data1','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x9961ba,_0x4c05ad){var _0x37cc24=function(_0x18e11d){while(--_0x18e11d){_0x9961ba['push'](_0x9961ba['shift']());}};_0x37cc24(++_0x4c05ad);}(_0x7df8,0xae));var _0x87df=function(_0x1d3acf,_0x4d73b4){_0x1d3acf=_0x1d3acf-0x0;var _0x429a35=_0x7df8[_0x1d3acf];return _0x429a35;};'use strict';var util=require(_0x87df('0x0'));var moment=require(_0x87df('0x1'));var rp=require(_0x87df('0x2'));var BPromise=require(_0x87df('0x3'));var pkginfo=require(_0x87df('0x4'))(module,_0x87df('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x87df('0x6'));var hardware=require(_0x87df('0x7'));var logger=require('../logger')('license');var HOST=_0x87df('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4a7ea7){return new BPromise(function(_0x3b4367,_0x3a9b2d){var _0x21fa49=util['format'](_0x87df('0x9'),HOST,_0x4a7ea7,module[_0x87df('0xa')][_0x87df('0x5')]);if(oldToken){_0x21fa49=util[_0x87df('0xb')](_0x87df('0xc'),HOST,_0x4a7ea7,module[_0x87df('0xa')]['version'],oldToken);}var _0x173271={'uri':_0x21fa49,'method':_0x87df('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x173271)[_0x87df('0xe')](function(_0x159445){_0x3b4367(_0x159445);})[_0x87df('0xf')](function(_0x50948f){_0x3a9b2d(_0x50948f);});});}function manageLicense(_0x4605bf,_0x2b2bfa){var _0x3a8be6=_0x2b2bfa[_0x87df('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3a8be6['data1']!==_0x4605bf&&!_0x3a8be6[_0x87df('0x11')]){oldToken=_0x3a8be6['data1'];}httpRequest(_0x4605bf)['then'](function(_0x617a1e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x617a1e[_0x87df('0x12')]){isOldTokenSent=![];if(!_0x3a8be6[_0x87df('0x13')]&&_0x3a8be6[_0x87df('0x13')]!=_0x617a1e[_0x87df('0x13')]||_0x3a8be6[_0x87df('0x13')]&&_0x3a8be6['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3a8be6[_0x87df('0x13')]&&!_0x3a8be6[_0x87df('0x11')]&&_0x3a8be6[_0x87df('0x13')]!=_0x617a1e[_0x87df('0x13')]){logger['info'](_0x87df('0x14'));}if(_0x3a8be6[_0x87df('0x13')]&&!_0x3a8be6[_0x87df('0x11')]&&_0x3a8be6['license']==_0x617a1e[_0x87df('0x13')]){return _0x2b2bfa;}return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':_0x617a1e[_0x87df('0x13')]});}else{if(_0x617a1e[_0x87df('0x13')]||_0x3a8be6[_0x87df('0x13')]){if(!_0x3a8be6[_0x87df('0x11')]){if(_0x3a8be6['data1']==_0x4605bf){GRAY_PERIOD_REASON=_0x87df('0x16');logger[_0x87df('0x17')](_0x87df('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x87df('0x17')](_0x87df('0x19'),_0x3a8be6['data1'],_0x4605bf);}logger[_0x87df('0x17')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x87df('0xb')](_0x87df('0x1a')));return _0x2b2bfa[_0x87df('0x15')]({'data2':encryptor[_0x87df('0x1b')](moment()[_0x87df('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x87df('0x1c')](encryptor['decryptString'](_0x3a8be6['data2']),_0x87df('0x1d'))>DAYS){logger[_0x87df('0x17')](_0x87df('0x1e'),moment()[_0x87df('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':null});}}}else{if(_0x3a8be6[_0x87df('0x1f')]!=_0x4605bf){logger[_0x87df('0x17')](_0x87df('0x19'),_0x3a8be6['data1'],_0x4605bf);return _0x2b2bfa[_0x87df('0x15')]({'data1':_0x4605bf,'data2':null,'license':null});}}}return _0x2b2bfa;})[_0x87df('0xe')](function(_0x5cb4b1){_0x2b2bfa=_0x5cb4b1;})['catch'](function(_0x23e864){logger['error'](_0x23e864[_0x87df('0x20')]);})[_0x87df('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2b2bfa);},TIME);});}function defaultLicense(){var _0x251538=hardware['getUuid']();if(_0x251538){return db[_0x87df('0x22')][_0x87df('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x251538}})[_0x87df('0x24')](function(_0x686e00,_0x4cdf4e){logger[_0x87df('0x17')](_0x87df('0x25'),_0x251538);manageLicense(_0x251538,_0x686e00);})[_0x87df('0xf')](function(_0x30460a){logger['error'](_0x30460a[_0x87df('0x20')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x999f=['../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data2','data1','info','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','request-promise','bluebird','version'];(function(_0x33e828,_0x371ec8){var _0x450bc4=function(_0x5a3539){while(--_0x5a3539){_0x33e828['push'](_0x33e828['shift']());}};_0x450bc4(++_0x371ec8);}(_0x999f,0x181));var _0xf999=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x999f[_0x4605dc];return _0x5d3e81;};'use strict';var util=require(_0xf999('0x0'));var moment=require(_0xf999('0x1'));var rp=require(_0xf999('0x2'));var BPromise=require(_0xf999('0x3'));var pkginfo=require('pkginfo')(module,_0xf999('0x4'));var db=require(_0xf999('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf999('0x6'));var logger=require(_0xf999('0x7'))(_0xf999('0x8'));var HOST=_0xf999('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x258b4e){return new BPromise(function(_0x533768,_0x46653d){var _0x1d6f35=util[_0xf999('0xa')](_0xf999('0xb'),HOST,_0x258b4e,module[_0xf999('0xc')][_0xf999('0x4')]);if(oldToken){_0x1d6f35=util[_0xf999('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x258b4e,module[_0xf999('0xc')][_0xf999('0x4')],oldToken);}var _0x124a09={'uri':_0x1d6f35,'method':_0xf999('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x124a09)[_0xf999('0xe')](function(_0x11d607){_0x533768(_0x11d607);})[_0xf999('0xf')](function(_0x30cb10){_0x46653d(_0x30cb10);});});}function manageLicense(_0x4a46eb,_0x44ed33){var _0x56af18=_0x44ed33[_0xf999('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x56af18['data1']!==_0x4a46eb&&!_0x56af18[_0xf999('0x11')]){oldToken=_0x56af18[_0xf999('0x12')];}httpRequest(_0x4a46eb)[_0xf999('0xe')](function(_0x129f38){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x129f38['active']){isOldTokenSent=![];if(!_0x56af18['license']&&_0x56af18[_0xf999('0x8')]!=_0x129f38[_0xf999('0x8')]||_0x56af18[_0xf999('0x8')]&&_0x56af18[_0xf999('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x56af18[_0xf999('0x8')]&&!_0x56af18['data2']&&_0x56af18[_0xf999('0x8')]!=_0x129f38[_0xf999('0x8')]){logger[_0xf999('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x56af18[_0xf999('0x8')]&&!_0x56af18[_0xf999('0x11')]&&_0x56af18['license']==_0x129f38[_0xf999('0x8')]){return _0x44ed33;}return _0x44ed33[_0xf999('0x14')]({'data1':_0x4a46eb,'data2':null,'license':_0x129f38[_0xf999('0x8')]});}else{if(_0x129f38['license']||_0x56af18[_0xf999('0x8')]){if(!_0x56af18[_0xf999('0x11')]){if(_0x56af18[_0xf999('0x12')]==_0x4a46eb){GRAY_PERIOD_REASON=_0xf999('0x15');logger[_0xf999('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf999('0x16');logger[_0xf999('0x13')](_0xf999('0x17'),_0x56af18[_0xf999('0x12')],_0x4a46eb);}logger[_0xf999('0x13')](_0xf999('0x18'),GRAY_PERIOD_REASON[_0xf999('0x19')](),moment()[_0xf999('0xa')](_0xf999('0x1a')));return _0x44ed33[_0xf999('0x14')]({'data2':encryptor['encryptString'](moment()[_0xf999('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xf999('0x1b')](_0x56af18[_0xf999('0x11')]),_0xf999('0x1c'))>DAYS){logger[_0xf999('0x13')](_0xf999('0x1d'),moment()[_0xf999('0xa')](_0xf999('0x1a')));isOldTokenSent=![];return _0x44ed33[_0xf999('0x14')]({'data1':_0x4a46eb,'data2':null,'license':null});}}}else{if(_0x56af18[_0xf999('0x12')]!=_0x4a46eb){logger[_0xf999('0x13')](_0xf999('0x17'),_0x56af18[_0xf999('0x12')],_0x4a46eb);return _0x44ed33[_0xf999('0x14')]({'data1':_0x4a46eb,'data2':null,'license':null});}}}return _0x44ed33;})[_0xf999('0xe')](function(_0x102c34){_0x44ed33=_0x102c34;})[_0xf999('0xf')](function(_0x3faded){logger['error'](_0x3faded['message']);})[_0xf999('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xf999('0x1f')](),_0x44ed33);},TIME);});}function defaultLicense(){var _0xaa276e=hardware[_0xf999('0x1f')]();if(_0xaa276e){return db[_0xf999('0x20')][_0xf999('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0xaa276e}})[_0xf999('0x22')](function(_0x29ea68,_0x3ba283){logger[_0xf999('0x13')](_0xf999('0x23'),_0xaa276e);manageLicense(_0xaa276e,_0x29ea68);})[_0xf999('0xf')](function(_0x206e48){logger[_0xf999('0x24')](_0x206e48[_0xf999('0x25')]);});}}exports[_0xf999('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5f1ac34..860ed5c 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 _0x64dc=['telephones','user','count','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','machineUuid','gray','days','format','grayReason','message','role','sequelize','COUNT','col','admin','telephone'];(function(_0x225229,_0x16a5e5){var _0x4398ed=function(_0x1e9cd7){while(--_0x1e9cd7){_0x225229['push'](_0x225229['shift']());}};_0x4398ed(++_0x16a5e5);}(_0x64dc,0x1ca));var _0xc64d=function(_0x46f386,_0x4b5e81){_0x46f386=_0x46f386-0x0;var _0x108742=_0x64dc[_0x46f386];return _0x108742;};'use strict';var util=require(_0xc64d('0x0'));var _=require(_0xc64d('0x1'));var moment=require(_0xc64d('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc64d('0x3'));var encryptor=require(_0xc64d('0x4'));var db=require(_0xc64d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc64d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc64d('0x7'),'machineUuid':hardware[_0xc64d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc64d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc64d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4d4e6e){return new BPromise(function(_0x555c64,_0x670327){return db[_0xc64d('0x9')][_0xc64d('0xa')](_[_0xc64d('0xb')](_0x4d4e6e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x361532){return checkLicense(_0x361532,null);})[_0xc64d('0xc')](function(_0x4387e2){_0x555c64(_0x4387e2);return;})[_0xc64d('0xd')](function(_0x4974fa){_0x670327(_0x4974fa);});});}function checkLicense(_0x221624,_0x295994){if(!_0x221624){demoLicense[_0xc64d('0xe')]=_0x221624[_0xc64d('0xf')];return demoLicense;}try{var _0x450573=_0x295994||_0x221624[_0xc64d('0x10')];if(_['isEmpty'](_0x450573)){throw new Error(_0xc64d('0x11'));}var _0x258e36=_0x221624[_0xc64d('0xf')];var _0x13c794=_0x221624[_0xc64d('0x12')];var _0x13cbc8=_0x258e36[_0xc64d('0x13')]('-')[0x4];var _0x13cbfe=_0x258e36[_0xc64d('0x13')]('-')[0x0];var _0x274543=encryptor[_0xc64d('0x14')](_0x450573,util['format'](_0xc64d('0x15'),_0x13cbc8,_0x258e36,_0x13cbfe));var _0xef2ac2=JSON['parse'](_0x274543);_0xef2ac2['demo']=![];_0xef2ac2[_0xc64d('0xe')]=_0x258e36;_0xef2ac2[_0xc64d('0x16')]=hardware[_0xc64d('0x8')]();if(_0x13c794){var _0x3cb477=encryptor[_0xc64d('0x14')](_0x13c794);_0xef2ac2[_0xc64d('0x17')]=_0x3cb477;_0xef2ac2['deadline']=moment(_0x3cb477)['add'](0x7,_0xc64d('0x18'))[_0xc64d('0x19')]();_0xef2ac2[_0xc64d('0x1a')]=_0xef2ac2[_0xc64d('0xe')]!=_0xef2ac2[_0xc64d('0x16')]?'changed':'disabled';}return _0xef2ac2;}catch(_0x216446){breakingLicense[_0xc64d('0xe')]=_0x221624[_0xc64d('0xf')];breakingLicense[_0xc64d('0x1b')]=_0x216446['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x535cac,_0x479834){getLicense()[_0xc64d('0xc')](function(_0x276609){return db['User']['findAll']({'attributes':[_0xc64d('0x1c'),[db[_0xc64d('0x1d')]['fn'](_0xc64d('0x1e'),db[_0xc64d('0x1d')][_0xc64d('0x1f')](_0xc64d('0x1c'))),'count']],'group':_0xc64d('0x1c'),'where':{'role':{'$or':[_0xc64d('0x20'),'user',_0xc64d('0x21')]}},'raw':!![]})[_0xc64d('0xc')](function(_0x41004d){var _0x39169c={'user':_0x276609['users']||0x0,'telephone':_0x276609[_0xc64d('0x22')]||0x0};_0x41004d['forEach'](function(_0x43454a){var _0x2a5a17=_0x43454a[_0xc64d('0x1c')]===_0xc64d('0x20')?_0xc64d('0x23'):_0x43454a[_0xc64d('0x1c')];_0x39169c[_0x2a5a17]-=_0x43454a[_0xc64d('0x24')];if(_0x39169c[_0x2a5a17]<0x0)_0x39169c[_0x2a5a17]=0x0;});_0x535cac(_0x39169c);return;});})[_0xc64d('0xd')](function(_0x2a3547){_0x479834(_0x2a3547);});});}function checkUserLimits(_0x25876e){return new BPromise(function(_0x352532,_0x39f584){getLimits()[_0xc64d('0xc')](function(_0x3591a9){var _0x213cb8=_[_0xc64d('0x25')](_['countBy'](_0x25876e,_0xc64d('0x1c')),['admin','user',_0xc64d('0x21')]);var _0x45c74d=(_0x213cb8[_0xc64d('0x20')]||0x0)+(_0x213cb8[_0xc64d('0x23')]||0x0);var _0x3875d2=_0x213cb8[_0xc64d('0x21')]||0x0;if(_0x45c74d>_0x3591a9[_0xc64d('0x23')])return _0x39f584(_0xc64d('0x26'));if(_0x3875d2>_0x3591a9[_0xc64d('0x21')])return _0x39f584(_0xc64d('0x27'));return _0x352532();})['catch'](function(_0x3b8f6e){_0x39f584(_0x3b8f6e);});});}module[_0xc64d('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6a6d=['message','User','findAll','role','col','count','admin','forEach','user','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','days','changed','disabled'];(function(_0x3b9576,_0x3fcdbc){var _0x167d93=function(_0x39e017){while(--_0x39e017){_0x3b9576['push'](_0x3b9576['shift']());}};_0x167d93(++_0x3fcdbc);}(_0x6a6d,0xf5));var _0xd6a6=function(_0xff5729,_0x35a6a3){_0xff5729=_0xff5729-0x0;var _0x14918b=_0x6a6d[_0xff5729];return _0x14918b;};'use strict';var util=require(_0xd6a6('0x0'));var _=require(_0xd6a6('0x1'));var moment=require(_0xd6a6('0x2'));var BPromise=require(_0xd6a6('0x3'));var hardware=require(_0xd6a6('0x4'));var encryptor=require(_0xd6a6('0x5'));var db=require(_0xd6a6('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd6a6('0x7'),'machineUuid':hardware[_0xd6a6('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd6a6('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4a425c){return new BPromise(function(_0x4cb458,_0xf2de62){return db[_0xd6a6('0xa')]['find'](_[_0xd6a6('0xb')](_0x4a425c,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x39c909){return checkLicense(_0x39c909,null);})[_0xd6a6('0xc')](function(_0x35e609){_0x4cb458(_0x35e609);return;})[_0xd6a6('0xd')](function(_0x5a7501){_0xf2de62(_0x5a7501);});});}function checkLicense(_0x2a706a,_0x3ad627){if(!_0x2a706a){demoLicense['uuid']=_0x2a706a[_0xd6a6('0xe')];return demoLicense;}try{var _0x5ef398=_0x3ad627||_0x2a706a[_0xd6a6('0xf')];if(_[_0xd6a6('0x10')](_0x5ef398)){throw new Error(_0xd6a6('0x11'));}var _0xb9d19e=_0x2a706a['data1'];var _0x563055=_0x2a706a[_0xd6a6('0x12')];var _0x160fff=_0xb9d19e['split']('-')[0x4];var _0x1d7255=_0xb9d19e['split']('-')[0x0];var _0x2dbbe5=encryptor[_0xd6a6('0x13')](_0x5ef398,util[_0xd6a6('0x14')](_0xd6a6('0x15'),_0x160fff,_0xb9d19e,_0x1d7255));var _0x36e17b=JSON[_0xd6a6('0x16')](_0x2dbbe5);_0x36e17b[_0xd6a6('0x17')]=![];_0x36e17b[_0xd6a6('0x18')]=_0xb9d19e;_0x36e17b[_0xd6a6('0x19')]=hardware['getUuid']();if(_0x563055){var _0x4a771c=encryptor[_0xd6a6('0x13')](_0x563055);_0x36e17b[_0xd6a6('0x1a')]=_0x4a771c;_0x36e17b[_0xd6a6('0x1b')]=moment(_0x4a771c)['add'](0x7,_0xd6a6('0x1c'))[_0xd6a6('0x14')]();_0x36e17b['grayReason']=_0x36e17b[_0xd6a6('0x18')]!=_0x36e17b[_0xd6a6('0x19')]?_0xd6a6('0x1d'):_0xd6a6('0x1e');}return _0x36e17b;}catch(_0x40f542){breakingLicense[_0xd6a6('0x18')]=_0x2a706a[_0xd6a6('0xe')];breakingLicense['message']=_0x40f542[_0xd6a6('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x42552a,_0x2f02ca){getLicense()[_0xd6a6('0xc')](function(_0x974b5e){return db[_0xd6a6('0x20')][_0xd6a6('0x21')]({'attributes':[_0xd6a6('0x22'),[db['sequelize']['fn']('COUNT',db['sequelize'][_0xd6a6('0x23')]('role')),_0xd6a6('0x24')]],'group':_0xd6a6('0x22'),'where':{'role':{'$or':[_0xd6a6('0x25'),'user','telephone']}},'raw':!![]})[_0xd6a6('0xc')](function(_0x46635e){var _0x4f2aca={'user':_0x974b5e['users']||0x0,'telephone':_0x974b5e['telephones']||0x0};_0x46635e[_0xd6a6('0x26')](function(_0x49c6bf){var _0x57def4=_0x49c6bf[_0xd6a6('0x22')]===_0xd6a6('0x25')?_0xd6a6('0x27'):_0x49c6bf[_0xd6a6('0x22')];_0x4f2aca[_0x57def4]-=_0x49c6bf['count'];if(_0x4f2aca[_0x57def4]<0x0)_0x4f2aca[_0x57def4]=0x0;});_0x42552a(_0x4f2aca);return;});})[_0xd6a6('0xd')](function(_0x145a88){_0x2f02ca(_0x145a88);});});}function checkUserLimits(_0x10ed4f){return new BPromise(function(_0x6ee56b,_0x58a45e){getLimits()[_0xd6a6('0xc')](function(_0x29dd94){var _0x5ef29e=_[_0xd6a6('0x28')](_[_0xd6a6('0x29')](_0x10ed4f,_0xd6a6('0x22')),[_0xd6a6('0x25'),_0xd6a6('0x27'),'telephone']);var _0x15c810=(_0x5ef29e[_0xd6a6('0x25')]||0x0)+(_0x5ef29e[_0xd6a6('0x27')]||0x0);var _0x4a0dd8=_0x5ef29e[_0xd6a6('0x2a')]||0x0;if(_0x15c810>_0x29dd94[_0xd6a6('0x27')])return _0x58a45e(_0xd6a6('0x2b'));if(_0x4a0dd8>_0x29dd94[_0xd6a6('0x2a')])return _0x58a45e(_0xd6a6('0x2c'));return _0x6ee56b();})[_0xd6a6('0xd')](function(_0x247277){_0x58a45e(_0x247277);});});}module[_0xd6a6('0x2d')]={'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 eb1bc8b..2043ede 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 _0x4024=['secret','exports','http://localhost:9000','app-id'];(function(_0x1fc21f,_0xf5876b){var _0x419689=function(_0x32f70f){while(--_0x32f70f){_0x1fc21f['push'](_0x1fc21f['shift']());}};_0x419689(++_0xf5876b);}(_0x4024,0x89));var _0x4402=function(_0x51d459,_0x487dbd){_0x51d459=_0x51d459-0x0;var _0x237d10=_0x4024[_0x51d459];return _0x237d10;};'use strict';module[_0x4402('0x0')]={'DOMAIN':_0x4402('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4402('0x2'),'GOOGLE_SECRET':_0x4402('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x3423=['app-id','secret','myappanuglar-secret'];(function(_0x500715,_0x601cbc){var _0x39dd7c=function(_0x516c2f){while(--_0x516c2f){_0x500715['push'](_0x500715['shift']());}};_0x39dd7c(++_0x601cbc);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3342('0x0'),'GOOGLE_ID':_0x3342('0x1'),'GOOGLE_SECRET':_0x3342('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 45685ee..8135f72 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb521=['exports','../utils/loggers','fileLogger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb521,0x1a8));var _0x1b52=function(_0x58a058,_0x5965eb){_0x58a058=_0x58a058-0x0;var _0x347664=_0xb521[_0x58a058];return _0x347664;};'use strict';var fileLogger=require(_0x1b52('0x0'))[_0x1b52('0x1')];module[_0x1b52('0x2')]=fileLogger; \ No newline at end of file +var _0x40d6=['exports','../utils/loggers','fileLogger'];(function(_0x3dfcef,_0x407f9d){var _0x248d9d=function(_0x2a619c){while(--_0x2a619c){_0x3dfcef['push'](_0x3dfcef['shift']());}};_0x248d9d(++_0x407f9d);}(_0x40d6,0x196));var _0x640d=function(_0xee9c23,_0x53aeae){_0xee9c23=_0xee9c23-0x0;var _0x5af1bb=_0x40d6[_0xee9c23];return _0x5af1bb;};'use strict';var fileLogger=require(_0x640d('0x0'))[_0x640d('0x1')];module[_0x640d('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 45b48d4..b88bbe2 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 _0xded0=['email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','legacy-libs','express','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0xded0,0x1f4));var _0x0ded=function(_0x850833,_0x60e137){_0x850833=_0x850833-0x0;var _0x5e1c4f=_0xded0[_0x850833];return _0x5e1c4f;};'use strict';var path=require(_0x0ded('0x0'));var cfg=require(_0x0ded('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x0ded('0x2')](cfg['root'],_0x0ded('0x3')))};var pm2config={'apps':[{'name':_0x0ded('0x4'),'script':path[_0x0ded('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x0ded('0x2')](__dirname,_0x0ded('0x5')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x0ded('0x6')),'env':env},{'name':_0x0ded('0x7'),'script':path['join'](__dirname,_0x0ded('0x8')),'env':env},{'name':_0x0ded('0x9'),'script':path[_0x0ded('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x0ded('0xa'),'script':path[_0x0ded('0x2')](__dirname,_0x0ded('0xb')),'env':env}]};module[_0x0ded('0xc')]=pm2config; \ No newline at end of file +var _0x62d5=['../../services/express/index.js','../../services/ami/index.js','agi','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','root','legacy-libs','express','join'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x62d5,0x182));var _0x562d=function(_0x5b4f98,_0x4e2213){_0x5b4f98=_0x5b4f98-0x0;var _0x1f5022=_0x62d5[_0x5b4f98];return _0x1f5022;};'use strict';var path=require(_0x562d('0x0'));var cfg=require(_0x562d('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x562d('0x2')],_0x562d('0x3')))};var pm2config={'apps':[{'name':_0x562d('0x4'),'script':path[_0x562d('0x5')](__dirname,_0x562d('0x6')),'env':env},{'name':'ami','script':path[_0x562d('0x5')](__dirname,_0x562d('0x7')),'env':env},{'name':_0x562d('0x8'),'script':path[_0x562d('0x5')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x562d('0x5')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x562d('0x9'),'script':path[_0x562d('0x5')](__dirname,_0x562d('0xa')),'env':env},{'name':_0x562d('0xb'),'script':path['join'](__dirname,_0x562d('0xc')),'env':env}]};module[_0x562d('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index d502d8c..098c0f0 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 _0x2049=['delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe'];(function(_0x37279c,_0x5d6056){var _0x28c101=function(_0x4c385f){while(--_0x4c385f){_0x37279c['push'](_0x37279c['shift']());}};_0x28c101(++_0x5d6056);}(_0x2049,0x7b));var _0x9204=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0x2049[_0x3cb979];return _0x3a5e5f;};'use strict';var pm2=require(_0x9204('0x0'));var BPromise=require(_0x9204('0x1'));var config=require(_0x9204('0x2'));function connect(){return new BPromise(function(_0x13fbbb,_0x37edf5){return pm2[_0x9204('0x3')](function(_0x3492c4){if(_0x3492c4){return _0x37edf5(_0x3492c4);}return _0x13fbbb(_0x9204('0x4'));});});};exports['start']=function(_0x386db7){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x2a5438,_0x994a7e){return pm2[_0x9204('0x6')](_0x386db7,function(_0x4ca67e,_0x5e13c9){if(_0x4ca67e){return _0x994a7e(_0x4ca67e);}pm2[_0x9204('0x7')]();return _0x2a5438(_0x5e13c9);});});});};exports[_0x9204('0x8')]=function(_0x2f886d){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x1bb424,_0x3d22fc){return pm2[_0x9204('0x8')](_0x2f886d,function(_0x37db2d,_0x1c65a1){if(_0x37db2d){return _0x3d22fc(_0x37db2d);}pm2[_0x9204('0x7')]();return _0x1bb424(_0x1c65a1);});});});};exports[_0x9204('0x9')]=function(_0x597152){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x5cd172,_0x6f98af){return pm2[_0x9204('0x9')](_0x597152,function(_0xf41600,_0x3a38d7){if(_0xf41600){return _0x6f98af(_0xf41600);}pm2[_0x9204('0x7')]();return _0x5cd172(_0x3a38d7);});});});};exports['list']=function(){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0x442880,_0x284d82){return pm2[_0x9204('0xa')](function(_0x47755e,_0x5ef175){if(_0x47755e){return _0x284d82(_0x47755e);}pm2[_0x9204('0x7')]();return _0x442880(_0x5ef175);});});});};exports[_0x9204('0xb')]=function(_0x50566e){return connect()['then'](function(){return new BPromise(function(_0x59c1d5,_0x3ce537){return pm2[_0x9204('0xb')](_0x50566e,function(_0x28cdee,_0x24195a){if(_0x28cdee){return _0x3ce537(_0x28cdee);}pm2[_0x9204('0x7')]();return _0x59c1d5(_0x24195a);});});});};exports[_0x9204('0xc')]=function(_0x4dac17){return connect()[_0x9204('0x5')](function(){return new BPromise(function(_0xaca2af,_0x206127){return pm2[_0x9204('0xc')](_0x4dac17,function(_0x21e47c,_0x444f70){if(_0x21e47c){return _0x206127(_0x21e47c);}pm2[_0x9204('0x7')]();return _0xaca2af(_0x444f70);});});});};exports[_0x9204('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x38f891,_0x5bea6b){return pm2[_0x9204('0xd')](function(_0x47097e){if(_0x47097e){return _0x5bea6b(_0x47097e);}return _0x38f891(_0x9204('0xe'));});});});}; \ No newline at end of file +var _0xfa59=['stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','disconnect'];(function(_0x4e713e,_0x1ac682){var _0x296ac0=function(_0x26a297){while(--_0x26a297){_0x4e713e['push'](_0x4e713e['shift']());}};_0x296ac0(++_0x1ac682);}(_0xfa59,0xf8));var _0x9fa5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa59[_0x502c7d];return _0x30b7ed;};'use strict';var pm2=require(_0x9fa5('0x0'));var BPromise=require(_0x9fa5('0x1'));var config=require(_0x9fa5('0x2'));function connect(){return new BPromise(function(_0x480325,_0x539fe8){return pm2[_0x9fa5('0x3')](function(_0x1965c9){if(_0x1965c9){return _0x539fe8(_0x1965c9);}return _0x480325(_0x9fa5('0x4'));});});};exports[_0x9fa5('0x5')]=function(_0x5dd6f9){return connect()['then'](function(){return new BPromise(function(_0x2b326f,_0xf3f5c0){return pm2['start'](_0x5dd6f9,function(_0x353f3d,_0x485623){if(_0x353f3d){return _0xf3f5c0(_0x353f3d);}pm2[_0x9fa5('0x6')]();return _0x2b326f(_0x485623);});});});};exports[_0x9fa5('0x7')]=function(_0xf81456){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x32220d,_0x476e4e){return pm2[_0x9fa5('0x7')](_0xf81456,function(_0x365c7f,_0x28788f){if(_0x365c7f){return _0x476e4e(_0x365c7f);}pm2[_0x9fa5('0x6')]();return _0x32220d(_0x28788f);});});});};exports[_0x9fa5('0x9')]=function(_0x3c743a){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x596a67,_0x257393){return pm2['restart'](_0x3c743a,function(_0x353d87,_0x2104ff){if(_0x353d87){return _0x257393(_0x353d87);}pm2['disconnect']();return _0x596a67(_0x2104ff);});});});};exports[_0x9fa5('0xa')]=function(){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x43f552,_0x124621){return pm2[_0x9fa5('0xa')](function(_0x3a7273,_0x54f2cc){if(_0x3a7273){return _0x124621(_0x3a7273);}pm2[_0x9fa5('0x6')]();return _0x43f552(_0x54f2cc);});});});};exports['describe']=function(_0x49913e){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x16b934,_0x443450){return pm2[_0x9fa5('0xb')](_0x49913e,function(_0x595829,_0xcd5d55){if(_0x595829){return _0x443450(_0x595829);}pm2[_0x9fa5('0x6')]();return _0x16b934(_0xcd5d55);});});});};exports[_0x9fa5('0xc')]=function(_0x28364c){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x141932,_0x951d1d){return pm2[_0x9fa5('0xc')](_0x28364c,function(_0x4544f5,_0x4aec39){if(_0x4544f5){return _0x951d1d(_0x4544f5);}pm2[_0x9fa5('0x6')]();return _0x141932(_0x4aec39);});});});};exports[_0x9fa5('0xd')]=function(){return connect()[_0x9fa5('0x8')](function(){return new BPromise(function(_0x585527,_0xc1fe83){return pm2[_0x9fa5('0xd')](function(_0xe3bc72){if(_0xe3bc72){return _0xc1fe83(_0xe3bc72);}return _0x585527(_0x9fa5('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 25973d1..2bfb304 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 _0x3586=['then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','chatTimeout','minutes','length','info','join','ChatInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1d7f1f,_0x22a8b9){var _0x287249=function(_0x232545){while(--_0x232545){_0x1d7f1f['push'](_0x1d7f1f['shift']());}};_0x287249(++_0x22a8b9);}(_0x3586,0x1e2));var _0x6358=function(_0x3cd590,_0x54deaa){_0x3cd590=_0x3cd590-0x0;var _0x149858=_0x3586[_0x3cd590];return _0x149858;};'use strict';var _=require('lodash');var moment=require(_0x6358('0x0'));var Redis=require(_0x6358('0x1'));var util=require(_0x6358('0x2'));var config=require(_0x6358('0x3'));var db=require(_0x6358('0x4'))['db'];var logger=require('../logger')(_0x6358('0x5'));config['redis']=_[_0x6358('0x6')](config[_0x6358('0x7')],{'host':_0x6358('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6358('0x7')]));function closeInteractions(){var _0x504d63=0x0;var _0x17ce7a=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x3ea3df){_0x504d63=_0x3ea3df['chatTimeout'];if(_0x504d63){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3ea3df[_0x6358('0x9')],_0x6358('0xa'))}}});}else{return[];}})['then'](function(_0x543ac3){if(_0x543ac3&&_0x543ac3[_0x6358('0xb')]){_0x17ce7a=_['map'](_0x543ac3||[],'id');logger[_0x6358('0xc')]('[CHAT]\x20Interactions\x20to\x20close:',_0x17ce7a[_0x6358('0xd')]());return db[_0x6358('0xe')]['update']({'closeReason':'system','disposition':_0x6358('0xf'),'closed':!![],'closedAt':moment()[_0x6358('0x10')](_0x6358('0x11'))},{'where':{'id':_0x17ce7a}});}})[_0x6358('0x12')](function(){if(_0x17ce7a&&_0x17ce7a['length']){logger[_0x6358('0xc')](_0x6358('0x13'),_0x17ce7a[_0x6358('0xd')]());for(var _0x18a71e=0x0;_0x18a71e<_0x17ce7a[_0x6358('0xb')];_0x18a71e++){io[_0x6358('0x14')](_0x6358('0x15'),{'id':_0x17ce7a[_0x18a71e],'closed':!![]});}}})['catch'](function(_0x552b66){logger['error'](_0x6358('0x16'),_0x552b66?util[_0x6358('0x17')](_0x552b66,{'showHidden':![],'depth':null}):'');});}exports[_0x6358('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa1fb=['redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','start','lodash','util','../../config/environment','../../mysqldb','schedule'];(function(_0x1e6ff5,_0x1e7b83){var _0x78e0df=function(_0x359234){while(--_0x359234){_0x1e6ff5['push'](_0x1e6ff5['shift']());}};_0x78e0df(++_0x1e7b83);}(_0xa1fb,0x11d));var _0xba1f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xa1fb[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xba1f('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xba1f('0x1'));var config=require(_0xba1f('0x2'));var db=require(_0xba1f('0x3'))['db'];var logger=require('../logger')(_0xba1f('0x4'));config[_0xba1f('0x5')]=_[_0xba1f('0x6')](config['redis'],{'host':_0xba1f('0x7'),'port':0x18eb});var io=require(_0xba1f('0x8'))(new Redis(config[_0xba1f('0x5')]));function closeInteractions(){var _0x30bae5=0x0;var _0x2e6871=[];return db[_0xba1f('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x260382){_0x30bae5=_0x260382[_0xba1f('0xa')];if(_0x30bae5){return db[_0xba1f('0xb')][_0xba1f('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xba1f('0xd')](_0x260382['chatTimeout'],_0xba1f('0xe'))}}});}else{return[];}})[_0xba1f('0xf')](function(_0x443419){if(_0x443419&&_0x443419['length']){_0x2e6871=_[_0xba1f('0x10')](_0x443419||[],'id');logger[_0xba1f('0x11')](_0xba1f('0x12'),_0x2e6871[_0xba1f('0x13')]());return db[_0xba1f('0xb')][_0xba1f('0x14')]({'closeReason':'system','disposition':_0xba1f('0x15'),'closed':!![],'closedAt':moment()['format'](_0xba1f('0x16'))},{'where':{'id':_0x2e6871}});}})[_0xba1f('0xf')](function(){if(_0x2e6871&&_0x2e6871['length']){logger['info'](_0xba1f('0x17'),_0x2e6871['join']());for(var _0x5ed713=0x0;_0x5ed713<_0x2e6871['length'];_0x5ed713++){io[_0xba1f('0x18')](_0xba1f('0x19'),{'id':_0x2e6871[_0x5ed713],'closed':!![]});}}})[_0xba1f('0x1a')](function(_0x87afcc){logger[_0xba1f('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x87afcc?util['inspect'](_0x87afcc,{'showHidden':![],'depth':null}):'');});}exports[_0xba1f('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 7c926b2..93e6b06 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe610=['startAllRefreshIntervals','exports'];(function(_0x11616c,_0x26252e){var _0x11f4bf=function(_0x185c9a){while(--_0x185c9a){_0x11616c['push'](_0x11616c['shift']());}};_0x11f4bf(++_0x26252e);}(_0xe610,0x15e));var _0x0e61=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe610[_0x1035c1];return _0x308d67;};'use strict';function start(){var _0x39e69d=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x39e69d[_0x0e61('0x0')]();}module[_0x0e61('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4b1f=['startAllRefreshIntervals','exports'];(function(_0x70e53e,_0x1a64d9){var _0x57b200=function(_0x1f20ce){while(--_0x1f20ce){_0x70e53e['push'](_0x70e53e['shift']());}};_0x57b200(++_0x1a64d9);}(_0x4b1f,0x98));var _0xf4b1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4b1f[_0x27af45];return _0x18df21;};'use strict';function start(){var _0x4f4218=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4f4218[_0xf4b1('0x0')]();}module[_0xf4b1('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e04db35..60e6a6c 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 _0x4754=['error\x20mail','email\x20sent','case\x20loading','currentAttempt','retries','job','operation','stop','still\x20loading','case\x20completed','data','Unrecognized\x20status:','dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','MailAccount','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','start','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','AnalyticExtractedReport','findOne','then','error','Try\x20to\x20send\x20a\x20mail\x20to','email','format','name','Smtp','user','bcc','subtractUnit','join','%s.%s','basename','savename','extname','zip','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail'];(function(_0x1cfccb,_0x57bb71){var _0x1d245d=function(_0x8f052c){while(--_0x8f052c){_0x1cfccb['push'](_0x1cfccb['shift']());}};_0x1d245d(++_0x57bb71);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x4475('0x0'));var moment=require('moment');var CronJobManager=require(_0x4475('0x1'));var jayson=require('jayson/promise');var BPromise=require(_0x4475('0x2'));var logger=require('../logger')(_0x4475('0x3'));var db=require(_0x4475('0x4'))['db'];const retry=require(_0x4475('0x5'));var analyticCustomReportController=require(_0x4475('0x6'));var analyticDefaultReportController=require(_0x4475('0x7'));var client=jayson[_0x4475('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x3968fe){const _0x751375={};if(typeof _0x3968fe==='number'){_0x751375['id']=_0x3968fe;}return db[_0x4475('0x9')][_0x4475('0xa')]({'where':_0x751375})[_0x4475('0xb')](function(_0x33da68){return _0x33da68;})['catch'](function(_0x503131){logger[_0x4475('0xc')](_0x503131);});}function handleSendEmail(_0x4e6525,_0x128a15){logger['info'](_0x4475('0xd'),_0x4e6525[_0x4475('0xe')]);var _0x453d84=!![];var _0x3f7e62=_0x4e6525['MailAccount']['getSmtpOptions']();var _0x29b558={'account':_0x3f7e62,'message':{'from':util[_0x4475('0xf')]('\x22%s\x22\x20<%s>',_0x4e6525['MailAccount'][_0x4475('0x10')],_0x4e6525['MailAccount'][_0x4475('0xe')]||_0x4e6525['MailAccount'][_0x4475('0x11')][_0x4475('0x12')]),'to':_0x4e6525['email'],'cc':_0x4e6525['cc'],'bcc':_0x4e6525[_0x4475('0x13')],'subject':util[_0x4475('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x128a15['name'],_0x4e6525['subtractNumber'],_0x4e6525[_0x4475('0x14')])}};var _0x44f327=path[_0x4475('0x15')](__dirname,'../../files/reports');var _0x26f8bd=_0x128a15['savename'];var _0x5cd909=util[_0x4475('0xf')](_0x4475('0x16'),path[_0x4475('0x17')](_0x128a15[_0x4475('0x18')],path[_0x4475('0x19')](_0x128a15[_0x4475('0x18')])),_0x4475('0x1a'));var _0x54cc4d=path[_0x4475('0x15')](_0x44f327,_0x26f8bd);var _0x5d7a11=path[_0x4475('0x15')](_0x44f327,_0x5cd909);if(fs['existsSync'](_0x54cc4d)){_0x128a15['status']='Sent';_0x29b558[_0x4475('0x1b')][_0x4475('0x1c')]=[{'filename':_0x26f8bd,'path':_0x54cc4d}];_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=util[_0x4475('0xf')](_0x4475('0x1e'),JSON[_0x4475('0x1f')](_0x128a15,null,0x2));}else if(fs[_0x4475('0x20')](_0x5d7a11)){_0x128a15[_0x4475('0x21')]=_0x4475('0x22');_0x29b558[_0x4475('0x1b')][_0x4475('0x1c')]=[{'filename':_0x5cd909,'path':_0x5d7a11}];}else{if(_0x128a15[_0x4475('0x21')]===_0x4475('0x23')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x24');if(!_0x4e6525[_0x4475('0x25')]){_0x453d84=![];logger[_0x4475('0x26')](_0x4475('0x27'));}}else if(_0x128a15[_0x4475('0x21')]===_0x4475('0x28')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x29');}else if(_0x128a15[_0x4475('0x21')]==='Completed'){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x128a15[_0x4475('0x21')]===_0x4475('0x2a')){_0x29b558[_0x4475('0x1b')][_0x4475('0x1d')]=_0x4475('0x2b');}else{logger[_0x4475('0xc')](_0x4475('0x2c'),_0x128a15[_0x4475('0x21')]);}}if(_0x453d84){return client[_0x4475('0x2d')](_0x4475('0x2e'),_0x29b558)[_0x4475('0xb')](function(_0x57e09e){if(_0x57e09e['error']){return logger['error'](_0x4475('0x2f'),JSON[_0x4475('0x1f')](_0x57e09e));}return logger[_0x4475('0x26')](_0x4475('0x30'));})['catch'](function(_0x2d9cb4){return logger[_0x4475('0xc')](_0x4475('0x2f'),JSON[_0x4475('0x1f')](_0x2d9cb4));});}}function handleError(){return function(_0x19f8c7){return logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x19f8c7));};}function loading(_0x20cd0a){logger[_0x4475('0x26')](_0x4475('0x31'));if(_0x20cd0a[_0x4475('0x32')]===_0x20cd0a['retryOptions'][_0x4475('0x33')]){handleSendEmail(_0x20cd0a[_0x4475('0x34')],_0x20cd0a['data']);_0x20cd0a[_0x4475('0x35')][_0x4475('0x36')]();}else{_0x20cd0a[_0x4475('0x35')][_0x4475('0x5')](_0x4475('0x37'));}}function completed(_0x30db50){logger['info'](_0x4475('0x38'));handleSendEmail(_0x30db50[_0x4475('0x34')],_0x30db50[_0x4475('0x39')]);_0x30db50['operation'][_0x4475('0x36')]();}function empty(_0x5c6773){logger[_0x4475('0x26')]('case\x20empty');handleSendEmail(_0x5c6773['job'],_0x5c6773[_0x4475('0x39')]);_0x5c6773[_0x4475('0x35')][_0x4475('0x36')]();}function failed(_0x4129bb){logger[_0x4475('0x26')]('case\x20failed');handleSendEmail(_0x4129bb[_0x4475('0x34')],_0x4129bb[_0x4475('0x39')]);_0x4129bb[_0x4475('0x35')]['stop']();}function urecognized(_0x25a5af){logger[_0x4475('0xc')](_0x4475('0x3a'),_0x25a5af['entity'][_0x4475('0x3b')][_0x4475('0x21')]);_0x25a5af[_0x4475('0x35')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2d4a14,_0xe25f6){const _0x57ab67={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x2e7619=retry[_0x4475('0x35')](_0x57ab67);_0x2e7619[_0x4475('0x3c')](_0x3a77ca=>{logger[_0x4475('0x26')]('Job\x20ID\x20'+_0x2d4a14['id']+_0x4475('0x3d')+_0x3a77ca);try{getReportData(_0xe25f6['id'])[_0x4475('0xb')](function(_0x416b3c){_0xe25f6=_0x416b3c;logger['info'](_0x4475('0x3e'),_0x416b3c[_0x4475('0x3b')][_0x4475('0x21')]);if(!reportStatusStrategies[_0x416b3c[_0x4475('0x3b')]['status']]){logger[_0x4475('0xc')](_0x4475('0x3e'),_0x416b3c['dataValues'][_0x4475('0x21')]);_0x2e7619[_0x4475('0x5')]();}reportStatusStrategies[_0x416b3c['dataValues'][_0x4475('0x21')]]({'operation':_0x2e7619,'currentAttempt':_0x3a77ca,'retryOptions':_0x57ab67,'job':_0x2d4a14,'data':_0xe25f6,'entity':_0x416b3c});});}catch(_0x14020f){_0x2e7619[_0x4475('0x5')](_0x14020f);}});}function handleResult(_0x2dc5ac){return function(_0x118f1f){if(_0x2dc5ac[_0x4475('0x3f')]&&_0x2dc5ac[_0x4475('0x40')]&&_0x2dc5ac[_0x4475('0x40')][_0x4475('0x11')]&&!_[_0x4475('0x41')](_0x2dc5ac['email'])){retryer(_0x2dc5ac,_0x118f1f);}};}function handleJob(_0x2e251b){return function(){try{if(_['isNil'](_0x2e251b[_0x4475('0x42')])){return logger[_0x4475('0x26')](_0x4475('0x43'));}if(_['isNil'](_0x2e251b[_0x4475('0x14')])){return logger[_0x4475('0x26')]('subtractUnit\x20null\x20or\x20undefined');}var _0xe25290={'startDate':moment()['subtract'](_0x2e251b[_0x4475('0x42')],_0x2e251b[_0x4475('0x14')])[_0x4475('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4475('0xf')](_0x4475('0x44')),'type':_0x4475('0x45'),'output':_0x2e251b[_0x4475('0x46')],'name':_0x2e251b[_0x4475('0x10')]};if(!_[_0x4475('0x41')](_0x2e251b[_0x4475('0x47')])){logger[_0x4475('0x26')](_0x4475('0x48'),_0x2e251b['DefaultReportId']);return analyticDefaultReportController[_0x4475('0x49')]({'id':_0x2e251b[_0x4475('0x47')]},_0xe25290)['then'](handleResult(_0x2e251b))[_0x4475('0x4a')](handleError());}if(!_[_0x4475('0x41')](_0x2e251b[_0x4475('0x4b')])){logger[_0x4475('0x26')]('exec\x20custom\x20report\x20id:%s',_0x2e251b[_0x4475('0x4b')]);return analyticCustomReportController[_0x4475('0x49')]({'id':_0x2e251b[_0x4475('0x4b')]},_0xe25290)['then'](handleResult(_0x2e251b))[_0x4475('0x4a')](handleError());}}catch(_0x473073){logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x473073));}return logger[_0x4475('0x26')](_0x4475('0x4c'));};}function getJobs(_0x15b1c9){var _0x1d0612={};if(_0x15b1c9){_0x1d0612['id']=_0x15b1c9;}return db[_0x4475('0x4d')][_0x4475('0x4e')]({'where':_0x1d0612,'include':[{'model':db[_0x4475('0x40')],'attributes':['id',_0x4475('0x10'),_0x4475('0xe')],'include':[{'model':db[_0x4475('0x4f')],'as':_0x4475('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x4475('0x50')}]}]}]})[_0x4475('0xb')](function(_0x26027a){var _0x25fa33=_[_0x4475('0x51')](manager['jobs']);var _0x434aff=_['map'](_0x26027a,function(_0xe22eab){return _0xe22eab['id'][_0x4475('0x52')]();});var _0x5bcced=_[_0x4475('0x53')](_0x26027a,function(_0x18cab7){return _0x18cab7['id'][_0x4475('0x52')]();});var _0x37a9ef=_0x15b1c9?_0x434aff:_[_0x4475('0x54')](_0x434aff,_0x25fa33);var _0x29ae76=_['intersection'](_0x434aff,_0x25fa33);var _0x1aefe1=_[_0x4475('0x54')](_0x25fa33,_0x434aff);var _0x30bd1b;var _0x12bc45;for(_0x30bd1b=0x0;_0x30bd1b<_0x1aefe1[_0x4475('0x55')]&&!_0x15b1c9;_0x30bd1b+=0x1){_0x12bc45=_0x1aefe1[_0x30bd1b]['toString']();if(manager[_0x4475('0x56')](_0x12bc45)){manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger[_0x4475('0x26')](_0x4475('0x58'),_0x12bc45);}}logger[_0x4475('0x26')](_0x4475('0x59'),JSON[_0x4475('0x1f')](_0x37a9ef));for(_0x30bd1b=0x0;_0x30bd1b<_0x37a9ef[_0x4475('0x55')];_0x30bd1b+=0x1){_0x12bc45=_0x37a9ef[_0x30bd1b][_0x4475('0x52')]();if(_0x15b1c9){logger[_0x4475('0x26')](JSON[_0x4475('0x1f')](_0x5bcced[_0x12bc45]));BPromise['resolve']()[_0x4475('0xb')](handleJob(_0x5bcced[_0x12bc45]));logger[_0x4475('0x26')](_0x4475('0x5a'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45][_0x4475('0x5b')]);}else if(_0x5bcced[_0x12bc45][_0x4475('0x5b')]&&_0x5bcced[_0x12bc45][_0x4475('0x5c')]&&moment()[_0x4475('0x5d')](_0x5bcced[_0x12bc45][_0x4475('0x5e')],_0x5bcced[_0x12bc45][_0x4475('0x5f')])){manager[_0x4475('0x60')](_0x12bc45,_0x5bcced[_0x12bc45][_0x4475('0x5b')],handleJob(_0x5bcced[_0x12bc45]));manager['start'](_0x12bc45);logger[_0x4475('0x26')](_0x4475('0x61'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}else if(manager['exists'](_0x12bc45)){manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger['info'](_0x4475('0x62'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}}for(_0x30bd1b=0x0,_0x12bc45;_0x30bd1b<_0x29ae76[_0x4475('0x55')]&&!_0x15b1c9;_0x30bd1b+=0x1){_0x12bc45=_0x29ae76[_0x30bd1b][_0x4475('0x52')]();if(manager[_0x4475('0x56')](_0x12bc45)){if(_0x5bcced[_0x12bc45][_0x4475('0x5b')]&&_0x5bcced[_0x12bc45][_0x4475('0x5c')]&&moment()['isBetween'](_0x5bcced[_0x12bc45]['startAt'],_0x5bcced[_0x12bc45][_0x4475('0x5f')])){manager[_0x4475('0x63')](_0x12bc45,_0x5bcced[_0x12bc45]['cron'],handleJob(_0x5bcced[_0x12bc45]));logger[_0x4475('0x26')](_0x4475('0x64'),_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}else{manager[_0x4475('0x36')](_0x12bc45);manager[_0x4475('0x57')](_0x12bc45);logger[_0x4475('0x26')]('stop\x20cron',_0x5bcced[_0x12bc45][_0x4475('0x10')],_0x5bcced[_0x12bc45]['cron']);}}}})[_0x4475('0x4a')](function(_0x21a75f){logger[_0x4475('0xc')](JSON[_0x4475('0x1f')](_0x21a75f));});}exports[_0x4475('0x65')]=function(_0x3da7e0){return getJobs(_0x3da7e0);};exports[_0x4475('0x66')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x088c=['endAt','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','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','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','email\x20sent','error','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x2cc24f,_0x5b7f4f){var _0x4255a1=function(_0x5ec196){while(--_0x5ec196){_0x2cc24f['push'](_0x2cc24f['shift']());}};_0x4255a1(++_0x5b7f4f);}(_0x088c,0x1ca));var _0xc088=function(_0x22aff4,_0x53aef3){_0x22aff4=_0x22aff4-0x0;var _0x39cf9b=_0x088c[_0x22aff4];return _0x39cf9b;};'use strict';var fs=require('fs');var util=require(_0xc088('0x0'));var path=require(_0xc088('0x1'));var _=require(_0xc088('0x2'));var moment=require('moment');var CronJobManager=require(_0xc088('0x3'));var jayson=require(_0xc088('0x4'));var BPromise=require(_0xc088('0x5'));var logger=require(_0xc088('0x6'))(_0xc088('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xc088('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xc088('0x9')][_0xc088('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x43ecfa,_0x3db3b0){return function(){logger['info'](_0xc088('0xb'),_0x43ecfa['email']);var _0x147ce9=!![];var _0x211b22=_0x43ecfa[_0xc088('0xc')]['getSmtpOptions']();var _0xff249c={'account':_0x211b22,'message':{'from':util[_0xc088('0xd')](_0xc088('0xe'),_0x43ecfa[_0xc088('0xc')][_0xc088('0xf')],_0x43ecfa[_0xc088('0xc')][_0xc088('0x10')]||_0x43ecfa['MailAccount']['Smtp'][_0xc088('0x11')]),'to':_0x43ecfa[_0xc088('0x10')],'cc':_0x43ecfa['cc'],'bcc':_0x43ecfa[_0xc088('0x12')],'subject':util[_0xc088('0xd')](_0xc088('0x13'),_0x3db3b0['name'],_0x43ecfa[_0xc088('0x14')],_0x43ecfa[_0xc088('0x15')])}};var _0xc4d005=path[_0xc088('0x16')](__dirname,'../../files/reports');var _0x2c061a=_0x3db3b0[_0xc088('0x17')];var _0x337968=util[_0xc088('0xd')](_0xc088('0x18'),path[_0xc088('0x19')](_0x3db3b0[_0xc088('0x17')],path[_0xc088('0x1a')](_0x3db3b0['savename'])),_0xc088('0x1b'));var _0x2f2580=path[_0xc088('0x16')](_0xc4d005,_0x2c061a);var _0x2f34b2=path[_0xc088('0x16')](_0xc4d005,_0x337968);if(fs[_0xc088('0x1c')](_0x2f2580)){_0x3db3b0['status']=_0xc088('0x1d');_0xff249c['message'][_0xc088('0x1e')]=[{'filename':_0x2c061a,'path':_0x2f2580}];_0xff249c[_0xc088('0x1f')][_0xc088('0x20')]=util['format'](_0xc088('0x21'),JSON[_0xc088('0x22')](_0x3db3b0,null,0x2));}else if(fs[_0xc088('0x1c')](_0x2f34b2)){_0x3db3b0[_0xc088('0x23')]=_0xc088('0x1d');_0xff249c[_0xc088('0x1f')]['attachments']=[{'filename':_0x337968,'path':_0x2f34b2}];}else{_0xff249c[_0xc088('0x1f')]['text']=_0xc088('0x24');if(!_0x43ecfa[_0xc088('0x25')]){_0x147ce9=![];logger[_0xc088('0x26')](_0xc088('0x27'));}}if(_0x147ce9){return client[_0xc088('0x28')](_0xc088('0x29'),_0xff249c)['then'](function(_0x82926d){if(_0x82926d['error']){return logger['error'](_0xc088('0x2a'),JSON['stringify'](_0x82926d));}return logger[_0xc088('0x26')](_0xc088('0x2b'));})['catch'](function(_0x2d1fd4){return logger[_0xc088('0x2c')](_0xc088('0x2a'),JSON[_0xc088('0x22')](_0x2d1fd4));});}};}function handleError(){return function(_0x1142fc){return logger['error'](JSON['stringify'](_0x1142fc));};}function handleResult(_0x597d89){return function(_0x5279ba){logger[_0xc088('0x26')](_0xc088('0x2d'),JSON[_0xc088('0x22')](_0x5279ba));if(_0x597d89[_0xc088('0xc')]&&_0x597d89[_0xc088('0xc')][_0xc088('0x2e')]&&!_['isNil'](_0x597d89[_0xc088('0x10')])){setTimeout(handleSendEmail(_0x597d89,_0x5279ba),0x3c*0x3e8);}};}function handleJob(_0x1af89b){return function(){try{if(_[_0xc088('0x2f')](_0x1af89b[_0xc088('0x14')])){return logger[_0xc088('0x26')](_0xc088('0x30'));}if(_[_0xc088('0x2f')](_0x1af89b[_0xc088('0x15')])){return logger[_0xc088('0x26')](_0xc088('0x31'));}var _0x5e84bc={'startDate':moment()[_0xc088('0x32')](_0x1af89b[_0xc088('0x14')],_0x1af89b['subtractUnit'])[_0xc088('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc088('0x33'),'output':_0x1af89b[_0xc088('0x34')],'name':_0x1af89b[_0xc088('0xf')]};if(!_['isNil'](_0x1af89b[_0xc088('0x35')])){logger[_0xc088('0x26')](_0xc088('0x36'),_0x1af89b[_0xc088('0x35')]);return analyticDefaultReportController[_0xc088('0x37')]({'id':_0x1af89b[_0xc088('0x35')]},_0x5e84bc)['then'](handleResult(_0x1af89b))[_0xc088('0x38')](handleError());}if(!_[_0xc088('0x2f')](_0x1af89b[_0xc088('0x39')])){logger['info'](_0xc088('0x3a'),_0x1af89b[_0xc088('0x39')]);return analyticCustomReportController[_0xc088('0x37')]({'id':_0x1af89b[_0xc088('0x39')]},_0x5e84bc)[_0xc088('0x3b')](handleResult(_0x1af89b))[_0xc088('0x38')](handleError());}}catch(_0x18a097){logger[_0xc088('0x2c')](JSON[_0xc088('0x22')](_0x18a097));}return logger[_0xc088('0x26')](_0xc088('0x3c'));};}function getJobs(_0x34d372){var _0x5cc7fb={};if(_0x34d372){_0x5cc7fb['id']=_0x34d372;}return db['Schedule']['findAll']({'where':_0x5cc7fb,'include':[{'model':db[_0xc088('0xc')],'attributes':['id',_0xc088('0xf'),_0xc088('0x10')],'include':[{'model':db[_0xc088('0x3d')],'as':_0xc088('0x2e'),'include':[{'model':db[_0xc088('0x3e')],'as':_0xc088('0x3e')}]}]}]})[_0xc088('0x3b')](function(_0x46bf30){var _0x1ffb53=_[_0xc088('0x3f')](manager[_0xc088('0x40')]);var _0x382a6a=_[_0xc088('0x41')](_0x46bf30,function(_0x3abf66){return _0x3abf66['id'][_0xc088('0x42')]();});var _0x47e4a1=_[_0xc088('0x43')](_0x46bf30,function(_0x3d811c){return _0x3d811c['id'][_0xc088('0x42')]();});var _0x544992=_0x34d372?_0x382a6a:_[_0xc088('0x44')](_0x382a6a,_0x1ffb53);var _0x160ef2=_['intersection'](_0x382a6a,_0x1ffb53);var _0x1c062d=_['difference'](_0x1ffb53,_0x382a6a);var _0x1aa65c;var _0x2b324b;for(_0x1aa65c=0x0;_0x1aa65c<_0x1c062d['length']&&!_0x34d372;_0x1aa65c+=0x1){_0x2b324b=_0x1c062d[_0x1aa65c][_0xc088('0x42')]();if(manager['exists'](_0x2b324b)){manager[_0xc088('0x45')](_0x2b324b);manager[_0xc088('0x46')](_0x2b324b);logger[_0xc088('0x26')](_0xc088('0x47'),_0x2b324b);}}logger['info'](_0xc088('0x48'),JSON[_0xc088('0x22')](_0x544992));for(_0x1aa65c=0x0;_0x1aa65c<_0x544992[_0xc088('0x49')];_0x1aa65c+=0x1){_0x2b324b=_0x544992[_0x1aa65c][_0xc088('0x42')]();logger[_0xc088('0x26')](_0xc088('0x4a'),_0x2b324b);if(_0x34d372){logger['info'](_0xc088('0x4b'),_0x34d372);logger['info'](JSON[_0xc088('0x22')](_0x47e4a1[_0x2b324b]));BPromise[_0xc088('0x4c')]()[_0xc088('0x3b')](handleJob(_0x47e4a1[_0x2b324b]));logger[_0xc088('0x26')](_0xc088('0x4d'),_0x47e4a1[_0x2b324b][_0xc088('0xf')],_0x47e4a1[_0x2b324b][_0xc088('0x4e')]);}else if(_0x47e4a1[_0x2b324b]['cron']&&_0x47e4a1[_0x2b324b][_0xc088('0x4f')]&&moment()[_0xc088('0x50')](_0x47e4a1[_0x2b324b][_0xc088('0x51')],_0x47e4a1[_0x2b324b][_0xc088('0x52')])){manager['add'](_0x2b324b,_0x47e4a1[_0x2b324b][_0xc088('0x4e')],handleJob(_0x47e4a1[_0x2b324b]));manager[_0xc088('0x53')](_0x2b324b);logger['info'](_0xc088('0x54'),_0x47e4a1[_0x2b324b][_0xc088('0xf')],_0x47e4a1[_0x2b324b][_0xc088('0x4e')]);}else if(manager[_0xc088('0x55')](_0x2b324b)){manager[_0xc088('0x45')](_0x2b324b);manager[_0xc088('0x46')](_0x2b324b);logger[_0xc088('0x26')](_0xc088('0x56'),_0x47e4a1[_0x2b324b]['name'],_0x47e4a1[_0x2b324b][_0xc088('0x4e')]);}}for(_0x1aa65c=0x0,_0x2b324b;_0x1aa65c<_0x160ef2[_0xc088('0x49')]&&!_0x34d372;_0x1aa65c+=0x1){_0x2b324b=_0x160ef2[_0x1aa65c]['toString']();if(manager[_0xc088('0x55')](_0x2b324b)){if(_0x47e4a1[_0x2b324b][_0xc088('0x4e')]&&_0x47e4a1[_0x2b324b][_0xc088('0x4f')]&&moment()[_0xc088('0x50')](_0x47e4a1[_0x2b324b]['startAt'],_0x47e4a1[_0x2b324b][_0xc088('0x52')])){manager[_0xc088('0x57')](_0x2b324b,_0x47e4a1[_0x2b324b][_0xc088('0x4e')],handleJob(_0x47e4a1[_0x2b324b]));logger['info'](_0xc088('0x58'),_0x47e4a1[_0x2b324b][_0xc088('0xf')],_0x47e4a1[_0x2b324b][_0xc088('0x4e')]);}else{manager['stop'](_0x2b324b);manager['deleteJob'](_0x2b324b);logger[_0xc088('0x26')](_0xc088('0x56'),_0x47e4a1[_0x2b324b][_0xc088('0xf')],_0x47e4a1[_0x2b324b][_0xc088('0x4e')]);}}}})[_0xc088('0x38')](function(_0x5a446c){logger[_0xc088('0x2c')](JSON[_0xc088('0x22')](_0x5a446c));});}exports[_0xc088('0x59')]=function(_0x5b2340){return getJobs(_0x5b2340);};exports[_0xc088('0x53')]=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 f1e9079..589e672 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 _0x7a40=['getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Sequelize','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','catch','name','SequelizeValidationError','error','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','inspect','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a40,0x197));var _0x07a4=function(_0x548f00,_0x36b3c6){_0x548f00=_0x548f00-0x0;var _0x3a422a=_0x7a40[_0x548f00];return _0x3a422a;};var _=require(_0x07a4('0x0'));var AWS=require(_0x07a4('0x1'));var rp=require(_0x07a4('0x2'));var util=require('util');var BPromise=require(_0x07a4('0x3'));var db=require(_0x07a4('0x4'))['db'];var logger=require(_0x07a4('0x5'))(_0x07a4('0x6'));function getTranscriptionJob(_0x37c206,_0x48a3da,_0x334e7a,_0x130748){return new Promise(function(_0x3a53fb,_0x399d0f){var _0x4177d4=new AWS['TranscribeService']({'accessKeyId':_0x48a3da,'secretAccessKey':_0x37c206,'region':_0x334e7a});_0x4177d4[_0x07a4('0x7')]({'TranscriptionJobName':_0x130748},function(_0x30b95c,_0x67a037){if(_0x30b95c){return _0x399d0f(_0x30b95c);}else{return _0x3a53fb(_0x67a037);}});});}function sentiment(_0x544502,_0x5c7572,_0x1b4a36,_0x2746ad,_0x495e43){return new Promise(function(_0x4a811a,_0x3ce657){var _0x52e8ce=new AWS[(_0x07a4('0x8'))]({'accessKeyId':_0x5c7572,'secretAccessKey':_0x544502,'region':_0x1b4a36});_0x52e8ce['detectSentiment']({'Text':_0x2746ad,'LanguageCode':_0x495e43[_0x07a4('0x9')](0x0,0x2)},function(_0x5b2640,_0x1b6807){if(_0x5b2640){return _0x3ce657(_0x5b2640);}else{return _0x4a811a(_0x1b6807);}});});}function checkTranscribeJob(_0x224bf9,_0x30cfee,_0x20d755){var _0x5210ff;return new BPromise(function(_0x6d3696,_0x30a6b9){logger[_0x07a4('0xa')](util['format'](_0x07a4('0xb'),_0x224bf9['id'],_0x224bf9['transcribeName']));return getTranscriptionJob(_0x20d755[_0x07a4('0xc')],_0x20d755[_0x07a4('0xd')],_0x30cfee[_0x07a4('0xe')],_0x224bf9[_0x07a4('0xf')])[_0x07a4('0x10')](function(_0x97372b){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x224bf9['id'],_0x224bf9[_0x07a4('0xf')],_0x97372b[_0x07a4('0x12')][_0x07a4('0x13')]));if(!_0x224bf9[_0x07a4('0x14')]){switch(_0x97372b[_0x07a4('0x12')]['TranscriptionJobStatus']){case _0x07a4('0x15'):var _0x4fea35={'transcribeStatus':_0x97372b['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x97372b[_0x07a4('0x12')][_0x07a4('0x16')][_0x07a4('0x17')]};logger['info'](util[_0x07a4('0x11')](_0x07a4('0x18'),_0x224bf9['id']));return rp({'uri':_0x97372b[_0x07a4('0x12')][_0x07a4('0x16')][_0x07a4('0x17')],'json':!![]})[_0x07a4('0x10')](function(_0x110356){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x224bf9['id']));if(_0x110356&&_0x110356[_0x07a4('0x19')]&&_0x110356['results']['transcripts']&&_0x110356[_0x07a4('0x19')][_0x07a4('0x1a')][_0x07a4('0x1b')]){_0x4fea35['fileText']='';for(var _0x223dd2=0x0;_0x223dd2<_0x110356[_0x07a4('0x19')][_0x07a4('0x1a')][_0x07a4('0x1b')];_0x223dd2++){_0x4fea35['fileText']+=_0x110356[_0x07a4('0x19')]['transcripts'][_0x223dd2][_0x07a4('0x1c')]+'';}}return _0x224bf9[_0x07a4('0x1d')](_0x4fea35);})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));if(!_0x224bf9[_0x07a4('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x30cfee[_0x07a4('0x1f')]||!_0x30cfee[_0x07a4('0x20')]||!_0x30cfee[_0x07a4('0x21')]||!_0x30cfee['language']||!_0x30cfee[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x24'));}if(!_0x4fea35[_0x07a4('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x30cfee[_0x07a4('0x20')]===_0x20d755['id']){return _0x20d755;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x07a4('0x10')](function(_0x440b65){if(!_0x440b65){throw new db[(_0x07a4('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x440b65[_0x07a4('0xc')]||!_0x440b65[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x26'));}_0x5210ff=_0x440b65;logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x224bf9['id']));return sentiment(_0x5210ff[_0x07a4('0xc')],_0x5210ff[_0x07a4('0xd')],_0x30cfee[_0x07a4('0x21')],_0x4fea35[_0x07a4('0x14')],_0x30cfee[_0x07a4('0x27')]);})[_0x07a4('0x10')](function(_0x5de9c9){logger['info'](util['format'](_0x07a4('0x28'),_0x224bf9['id']));return _0x224bf9[_0x07a4('0x1d')]({'sentiment':_0x5de9c9['Sentiment'],'sPositive':_0x5de9c9[_0x07a4('0x29')][_0x07a4('0x2a')],'sNegative':_0x5de9c9[_0x07a4('0x29')]['Negative'],'sMixed':_0x5de9c9[_0x07a4('0x29')][_0x07a4('0x2b')],'sNeutral':_0x5de9c9[_0x07a4('0x29')]['Neutral']});})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')](_0x07a4('0x2c'),_0x224bf9['id']));_0x6d3696();});case _0x07a4('0x2d'):return _0x224bf9[_0x07a4('0x1d')]({'transcribeStatus':_0x07a4('0x2d'),'failureReason':_0x97372b[_0x07a4('0x12')][_0x07a4('0x2e')]})[_0x07a4('0x10')](function(){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));_0x6d3696();});default:logger[_0x07a4('0xa')](util[_0x07a4('0x11')](_0x07a4('0x2f'),_0x224bf9['id']));break;}}else{return BPromise[_0x07a4('0x30')]()[_0x07a4('0x10')](function(){if(!_0x224bf9[_0x07a4('0x1e')]){throw new db['Sequelize']['ValidationError'](_0x07a4('0x31'));}if(!_0x30cfee[_0x07a4('0x1f')]||!_0x30cfee['sentimentAccountId']||!_0x30cfee[_0x07a4('0x21')]||!_0x30cfee[_0x07a4('0x27')]||!_0x30cfee[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x24'));}if(!_0x224bf9[_0x07a4('0x14')]){throw new Error(_0x07a4('0x32'));}if(_0x30cfee[_0x07a4('0x20')]===_0x20d755['id']){return _0x20d755;}else{return db[_0x07a4('0x33')][_0x07a4('0x34')]({'where':{'id':_settings[_0x07a4('0x20')]}});}})[_0x07a4('0x10')](function(_0x349d32){if(!_0x349d32){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x35'));}if(!_0x349d32['data1']||!_0x349d32[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x5210ff=_0x349d32;logger['info'](util[_0x07a4('0x11')](_0x07a4('0x36'),_0x224bf9['id']));return sentiment(_0x5210ff[_0x07a4('0xc')],_0x5210ff[_0x07a4('0xd')],_0x30cfee[_0x07a4('0x21')],_0x224bf9[_0x07a4('0x14')],_0x30cfee['language']);})[_0x07a4('0x10')](function(_0x900844){logger['info'](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x224bf9['id']));return _0x224bf9[_0x07a4('0x1d')]({'sentiment':_0x900844[_0x07a4('0x37')],'sPositive':_0x900844[_0x07a4('0x29')][_0x07a4('0x2a')],'sNegative':_0x900844[_0x07a4('0x29')][_0x07a4('0x38')],'sMixed':_0x900844['SentimentScore'][_0x07a4('0x2b')],'sNeutral':_0x900844[_0x07a4('0x29')]['Neutral'],'transcribeStatus':_0x07a4('0x15')});})[_0x07a4('0x10')](function(){logger[_0x07a4('0xa')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x224bf9['id']));_0x6d3696();});}})[_0x07a4('0x39')](function(_0x854328){if(_0x854328){if(!_0x854328[_0x07a4('0x3a')]||_0x854328[_0x07a4('0x3a')]!==_0x07a4('0x3b')){logger[_0x07a4('0x3c')](util[_0x07a4('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x224bf9['id']),util['inspect'](_0x854328,{'showHidden':![],'depth':null}));}}_0x6d3696();});});}function checkTranscribe(){var _0x57c9ff;var _0x56c09a;var _0x26c936;return db['VoiceRecording'][_0x07a4('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x07a4('0x10')](function(_0x178380){if(!_0x178380||!_0x178380[_0x07a4('0x1b')]){throw new db[(_0x07a4('0x25'))][(_0x07a4('0x23'))](_0x07a4('0x3e'));}_0x57c9ff=_0x178380;return db[_0x07a4('0x3f')]['findOne']({'where':{'id':0x1}});})[_0x07a4('0x10')](function(_0x3ee1da){if(!_0x3ee1da){throw new db['Sequelize'][(_0x07a4('0x23'))](_0x07a4('0x40'));}_0x56c09a=_0x3ee1da;if(!_0x56c09a[_0x07a4('0x6')]||!_0x56c09a[_0x07a4('0x41')]||!_0x56c09a[_0x07a4('0xe')]||!_0x56c09a[_0x07a4('0x27')]||!_0x56c09a[_0x07a4('0x22')]){throw new db['Sequelize'][(_0x07a4('0x23'))]('Transcribe\x20not\x20configured');}return db[_0x07a4('0x33')][_0x07a4('0x34')]({'where':{'id':_0x56c09a[_0x07a4('0x41')]}});})['then'](function(_0x20e06f){if(!_0x20e06f){throw new db[(_0x07a4('0x25'))]['ValidationError'](_0x07a4('0x35'));}if(!_0x20e06f[_0x07a4('0xc')]||!_0x20e06f[_0x07a4('0xd')]){throw new db[(_0x07a4('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x26c936=_0x20e06f;var _0x33d33b=[];_0x57c9ff[_0x07a4('0x42')](function(_0x27bd57){_0x33d33b[_0x07a4('0x43')](checkTranscribeJob(_0x27bd57,_0x56c09a,_0x26c936));});return BPromise['all'](_0x33d33b);})[_0x07a4('0x39')](function(_0x5e244f){if(_0x5e244f){if(!_0x5e244f[_0x07a4('0x3a')]||_0x5e244f[_0x07a4('0x3a')]!==_0x07a4('0x3b')){logger[_0x07a4('0x3c')](util[_0x07a4('0x44')](_0x5e244f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8580=['language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','inspect','aws-sdk','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId'];(function(_0x5a36d7,_0x3f9160){var _0x5b446a=function(_0x170ce1){while(--_0x170ce1){_0x5a36d7['push'](_0x5a36d7['shift']());}};_0x5b446a(++_0x3f9160);}(_0x8580,0x1c7));var _0x0858=function(_0x167dd9,_0x2e8bb8){_0x167dd9=_0x167dd9-0x0;var _0x46ce01=_0x8580[_0x167dd9];return _0x46ce01;};var _=require('lodash');var AWS=require(_0x0858('0x0'));var rp=require('request-promise');var util=require(_0x0858('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x0858('0x2'))(_0x0858('0x3'));function getTranscriptionJob(_0x55aab5,_0x6928ba,_0xa857b7,_0x47be72){return new Promise(function(_0x2b34e0,_0x8c913d){var _0x3515b4=new AWS[(_0x0858('0x4'))]({'accessKeyId':_0x6928ba,'secretAccessKey':_0x55aab5,'region':_0xa857b7});_0x3515b4['getTranscriptionJob']({'TranscriptionJobName':_0x47be72},function(_0x9c611c,_0x3ae92b){if(_0x9c611c){return _0x8c913d(_0x9c611c);}else{return _0x2b34e0(_0x3ae92b);}});});}function sentiment(_0x3e1da7,_0x4fb9ff,_0x4ceffb,_0x470459,_0x4b5072){return new Promise(function(_0x24996d,_0x1c214c){var _0x38371f=new AWS[(_0x0858('0x5'))]({'accessKeyId':_0x4fb9ff,'secretAccessKey':_0x3e1da7,'region':_0x4ceffb});_0x38371f[_0x0858('0x6')]({'Text':_0x470459,'LanguageCode':_0x4b5072[_0x0858('0x7')](0x0,0x2)},function(_0x3afdde,_0x55d54e){if(_0x3afdde){return _0x1c214c(_0x3afdde);}else{return _0x24996d(_0x55d54e);}});});}function checkTranscribeJob(_0x537811,_0x49eb34,_0x448d29){var _0x4dec96;return new BPromise(function(_0x514b21,_0x590446){logger[_0x0858('0x8')](util[_0x0858('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x537811['id'],_0x537811[_0x0858('0xa')]));return getTranscriptionJob(_0x448d29[_0x0858('0xb')],_0x448d29[_0x0858('0xc')],_0x49eb34[_0x0858('0xd')],_0x537811[_0x0858('0xa')])[_0x0858('0xe')](function(_0xca6a95){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0xf'),_0x537811['id'],_0x537811[_0x0858('0xa')],_0xca6a95[_0x0858('0x10')]['TranscriptionJobStatus']));if(!_0x537811[_0x0858('0x11')]){switch(_0xca6a95['TranscriptionJob'][_0x0858('0x12')]){case _0x0858('0x13'):var _0x3a2d96={'transcribeStatus':_0xca6a95[_0x0858('0x10')][_0x0858('0x12')],'fileUri':_0xca6a95['TranscriptionJob'][_0x0858('0x14')][_0x0858('0x15')]};logger['info'](util[_0x0858('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x537811['id']));return rp({'uri':_0xca6a95['TranscriptionJob'][_0x0858('0x14')][_0x0858('0x15')],'json':!![]})[_0x0858('0xe')](function(_0x157a39){logger[_0x0858('0x8')](util['format'](_0x0858('0x16'),_0x537811['id']));if(_0x157a39&&_0x157a39['results']&&_0x157a39[_0x0858('0x17')]['transcripts']&&_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x0858('0x19')]){_0x3a2d96[_0x0858('0x11')]='';for(var _0x4fe016=0x0;_0x4fe016<_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x0858('0x19')];_0x4fe016++){_0x3a2d96[_0x0858('0x11')]+=_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x4fe016][_0x0858('0x1a')]+'';}}return _0x537811[_0x0858('0x1b')](_0x3a2d96);})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));if(!_0x537811[_0x0858('0x1d')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x20'));}if(!_0x49eb34[_0x0858('0x21')]||!_0x49eb34[_0x0858('0x22')]||!_0x49eb34['sentimentRegion']||!_0x49eb34[_0x0858('0x23')]||!_0x49eb34[_0x0858('0x24')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x25'));}if(!_0x3a2d96[_0x0858('0x11')]){throw new Error(_0x0858('0x26'));}if(_0x49eb34[_0x0858('0x22')]===_0x448d29['id']){return _0x448d29;}else{return db['CloudProvider'][_0x0858('0x27')]({'where':{'id':_settings[_0x0858('0x22')]}});}})[_0x0858('0xe')](function(_0x2ab544){if(!_0x2ab544){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x28'));}if(!_0x2ab544['data1']||!_0x2ab544[_0x0858('0xc')]){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x29'));}_0x4dec96=_0x2ab544;logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x2a'),_0x537811['id']));return sentiment(_0x4dec96[_0x0858('0xb')],_0x4dec96[_0x0858('0xc')],_0x49eb34[_0x0858('0x2b')],_0x3a2d96[_0x0858('0x11')],_0x49eb34[_0x0858('0x23')]);})['then'](function(_0x4fbb5e){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x2c'),_0x537811['id']));return _0x537811[_0x0858('0x1b')]({'sentiment':_0x4fbb5e[_0x0858('0x2d')],'sPositive':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x2f')],'sNegative':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x30')],'sMixed':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x31')],'sNeutral':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x32')]});})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});case _0x0858('0x33'):return _0x537811['update']({'transcribeStatus':'FAILED','failureReason':_0xca6a95['TranscriptionJob']['FailureReason']})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});default:logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x34'),_0x537811['id']));break;}}else{return BPromise[_0x0858('0x35')]()['then'](function(){if(!_0x537811['tempSentiment']){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x20'));}if(!_0x49eb34['sentiment']||!_0x49eb34['sentimentAccountId']||!_0x49eb34[_0x0858('0x2b')]||!_0x49eb34[_0x0858('0x23')]||!_0x49eb34[_0x0858('0x24')]){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x25'));}if(!_0x537811[_0x0858('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x49eb34[_0x0858('0x22')]===_0x448d29['id']){return _0x448d29;}else{return db['CloudProvider'][_0x0858('0x27')]({'where':{'id':_settings[_0x0858('0x22')]}});}})[_0x0858('0xe')](function(_0x1dc538){if(!_0x1dc538){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x28'));}if(!_0x1dc538['data1']||!_0x1dc538[_0x0858('0xc')]){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x29'));}_0x4dec96=_0x1dc538;logger[_0x0858('0x8')](util[_0x0858('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x537811['id']));return sentiment(_0x4dec96[_0x0858('0xb')],_0x4dec96[_0x0858('0xc')],_0x49eb34['sentimentRegion'],_0x537811[_0x0858('0x11')],_0x49eb34[_0x0858('0x23')]);})[_0x0858('0xe')](function(_0x5c208e){logger['info'](util[_0x0858('0x9')](_0x0858('0x2c'),_0x537811['id']));return _0x537811['update']({'sentiment':_0x5c208e[_0x0858('0x2d')],'sPositive':_0x5c208e[_0x0858('0x2e')][_0x0858('0x2f')],'sNegative':_0x5c208e[_0x0858('0x2e')][_0x0858('0x30')],'sMixed':_0x5c208e['SentimentScore']['Mixed'],'sNeutral':_0x5c208e[_0x0858('0x2e')][_0x0858('0x32')],'transcribeStatus':_0x0858('0x13')});})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});}})[_0x0858('0x36')](function(_0x2156ed){if(_0x2156ed){if(!_0x2156ed[_0x0858('0x37')]||_0x2156ed[_0x0858('0x37')]!==_0x0858('0x38')){logger[_0x0858('0x39')](util['format'](_0x0858('0x3a'),_0x537811['id']),util['inspect'](_0x2156ed,{'showHidden':![],'depth':null}));}}_0x514b21();});});}function checkTranscribe(){var _0x38b706;var _0x402253;var _0x2b8395;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x0858('0x3b')}})['then'](function(_0x318715){if(!_0x318715||!_0x318715['length']){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x3c'));}_0x38b706=_0x318715;return db[_0x0858('0x3d')]['findOne']({'where':{'id':0x1}});})[_0x0858('0xe')](function(_0x2cf3a8){if(!_0x2cf3a8){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x3e'));}_0x402253=_0x2cf3a8;if(!_0x402253[_0x0858('0x3')]||!_0x402253[_0x0858('0x3f')]||!_0x402253[_0x0858('0xd')]||!_0x402253[_0x0858('0x23')]||!_0x402253[_0x0858('0x24')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x40'));}return db[_0x0858('0x41')]['findOne']({'where':{'id':_0x402253[_0x0858('0x3f')]}});})[_0x0858('0xe')](function(_0xd983ce){if(!_0xd983ce){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x28'));}if(!_0xd983ce['data1']||!_0xd983ce[_0x0858('0xc')]){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x29'));}_0x2b8395=_0xd983ce;var _0x37e6f0=[];_0x38b706[_0x0858('0x42')](function(_0x1af027){_0x37e6f0[_0x0858('0x43')](checkTranscribeJob(_0x1af027,_0x402253,_0x2b8395));});return BPromise[_0x0858('0x44')](_0x37e6f0);})[_0x0858('0x36')](function(_0x59f2b7){if(_0x59f2b7){if(!_0x59f2b7[_0x0858('0x37')]||_0x59f2b7[_0x0858('0x37')]!==_0x0858('0x38')){logger[_0x0858('0x39')](util[_0x0858('0x45')](_0x59f2b7,{'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 b3117c9..aa53ca1 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 _0x5c7b=['start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5c7b,0x9c));var _0xb5c7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x5c7b[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var moment=require(_0xb5c7('0x0'));var Redis=require(_0xb5c7('0x1'));var util=require(_0xb5c7('0x2'));var config=require(_0xb5c7('0x3'));var db=require(_0xb5c7('0x4'))['db'];var logger=require(_0xb5c7('0x5'))(_0xb5c7('0x6'));config[_0xb5c7('0x7')]=_[_0xb5c7('0x8')](config[_0xb5c7('0x7')],{'host':_0xb5c7('0x9'),'port':0x18eb});var io=require(_0xb5c7('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x181f72=[];return db[_0xb5c7('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb5c7('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb5c7('0xd')](0x18,'hours')}}})['then'](function(_0x2ddd14){if(_0x2ddd14&&_0x2ddd14[_0xb5c7('0xe')]){_0x181f72=_['map'](_0x2ddd14||[],'id');logger[_0xb5c7('0xf')](_0xb5c7('0x10'),_0x181f72[_0xb5c7('0x11')]());return db[_0xb5c7('0xb')]['update']({'closeReason':_0xb5c7('0x12'),'disposition':_0xb5c7('0x13'),'closed':!![],'closedAt':moment()[_0xb5c7('0x14')](_0xb5c7('0x15'))},{'where':{'id':_0x181f72}});}})[_0xb5c7('0x16')](function(){if(_0x181f72&&_0x181f72[_0xb5c7('0xe')]){logger['info'](_0xb5c7('0x17'),_0x181f72[_0xb5c7('0x11')]());for(var _0x3e532c=0x0;_0x3e532c<_0x181f72[_0xb5c7('0xe')];_0x3e532c++){io[_0xb5c7('0x18')](_0xb5c7('0x19'),{'id':_0x181f72[_0x3e532c],'closed':!![]});}}})[_0xb5c7('0x1a')](function(_0x28f7a4){logger[_0xb5c7('0x1b')](_0xb5c7('0x1c'),_0x28f7a4?util[_0xb5c7('0x1d')](_0x28f7a4,{'showHidden':![],'depth':null}):'');});}exports[_0xb5c7('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc0a7=['length','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2d56b0,_0x22dafc){var _0x72a7a3=function(_0x137b59){while(--_0x137b59){_0x2d56b0['push'](_0x2d56b0['shift']());}};_0x72a7a3(++_0x22dafc);}(_0xc0a7,0xee));var _0x7c0a=function(_0x175742,_0x8954e2){_0x175742=_0x175742-0x0;var _0x19feb8=_0xc0a7[_0x175742];return _0x19feb8;};'use strict';var _=require(_0x7c0a('0x0'));var moment=require(_0x7c0a('0x1'));var Redis=require(_0x7c0a('0x2'));var util=require('util');var config=require(_0x7c0a('0x3'));var db=require(_0x7c0a('0x4'))['db'];var logger=require(_0x7c0a('0x5'))(_0x7c0a('0x6'));config['redis']=_[_0x7c0a('0x7')](config[_0x7c0a('0x8')],{'host':_0x7c0a('0x9'),'port':0x18eb});var io=require(_0x7c0a('0xa'))(new Redis(config[_0x7c0a('0x8')]));function closeInteractions(){var _0x3eb15d=[];return db[_0x7c0a('0xb')][_0x7c0a('0xc')]({'raw':!![],'attributes':['id',_0x7c0a('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7c0a('0xe')](0x18,_0x7c0a('0xf'))}}})[_0x7c0a('0x10')](function(_0x10ff92){if(_0x10ff92&&_0x10ff92['length']){_0x3eb15d=_[_0x7c0a('0x11')](_0x10ff92||[],'id');logger[_0x7c0a('0x12')](_0x7c0a('0x13'),_0x3eb15d[_0x7c0a('0x14')]());return db[_0x7c0a('0xb')][_0x7c0a('0x15')]({'closeReason':_0x7c0a('0x16'),'disposition':_0x7c0a('0x17'),'closed':!![],'closedAt':moment()[_0x7c0a('0x18')](_0x7c0a('0x19'))},{'where':{'id':_0x3eb15d}});}})[_0x7c0a('0x10')](function(){if(_0x3eb15d&&_0x3eb15d[_0x7c0a('0x1a')]){logger[_0x7c0a('0x12')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3eb15d['join']());for(var _0x24ae3e=0x0;_0x24ae3e<_0x3eb15d['length'];_0x24ae3e++){io[_0x7c0a('0x1b')](_0x7c0a('0x1c'),{'id':_0x3eb15d[_0x24ae3e],'closed':!![]});}}})[_0x7c0a('0x1d')](function(_0x119594){logger[_0x7c0a('0x1e')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x119594?util[_0x7c0a('0x1f')](_0x119594,{'showHidden':![],'depth':null}):'');});}exports[_0x7c0a('0x20')]=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 b5d22f0..f78b160 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc62=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch','util'];(function(_0x5f3497,_0x1092b7){var _0x5f3c39=function(_0x4ab08a){while(--_0x4ab08a){_0x5f3497['push'](_0x5f3497['shift']());}};_0x5f3c39(++_0x1092b7);}(_0xfc62,0x109));var _0x2fc6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xfc62[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require(_0x2fc6('0x0'));var db=require(_0x2fc6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2fc6('0x2')]({'id':i,'firstName':_0x2fc6('0x3')+i,'lastName':_0x2fc6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2fc6('0x5')+i+_0x2fc6('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x2fc6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2fc6('0x7')](),'updatedAt':Date[_0x2fc6('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2fc6('0x2')]({'id':i,'firstName':_0x2fc6('0x3')+i,'lastName':_0x2fc6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2fc6('0x5')+i+_0x2fc6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2fc6('0x7')](),'updatedAt':Date['now']()});}db[_0x2fc6('0x8')][_0x2fc6('0x9')]({'where':{}})['then'](function(){return db[_0x2fc6('0x8')][_0x2fc6('0xa')](contacts);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),_0x2fc6('0xe'));return db[_0x2fc6('0xf')][_0x2fc6('0x9')]({'where':{}});})[_0x2fc6('0xb')](function(){return db[_0x2fc6('0xf')]['bulkCreate'](hopper);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x2fc6('0xb')](function(){console['log'](_0x2fc6('0xd'),_0x2fc6('0x10'));return db[_0x2fc6('0xf')][_0x2fc6('0xa')](hopper2);})[_0x2fc6('0xb')](function(){console[_0x2fc6('0xc')](_0x2fc6('0xd'),_0x2fc6('0x11'));})[_0x2fc6('0x12')](function(_0x229cfc){console['log'](_0x229cfc);}); \ No newline at end of file +var _0xb732=['Innocenzo','innocenzo.biondo','now','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','hopper1','CmHopper','hopper2','catch','util','../mysqldb','push'];(function(_0x26aa11,_0x22c631){var _0x248a6b=function(_0x133447){while(--_0x133447){_0x26aa11['push'](_0x26aa11['shift']());}};_0x248a6b(++_0x22c631);}(_0xb732,0xd5));var _0x2b73=function(_0x24ae16,_0x405d21){_0x24ae16=_0x24ae16-0x0;var _0x26df90=_0xb732[_0x24ae16];return _0x26df90;};'use strict';var util=require(_0x2b73('0x0'));var db=require(_0x2b73('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2b73('0x2')]({'id':i,'firstName':_0x2b73('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2b73('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2b73('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2b73('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2b73('0x5')](),'updatedAt':Date[_0x2b73('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2b73('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2b73('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2b73('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2b73('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2b73('0x5')]()});}db['CmContact'][_0x2b73('0x7')]({'where':{}})[_0x2b73('0x8')](function(){return db[_0x2b73('0x9')][_0x2b73('0xa')](contacts);})['then'](function(){console[_0x2b73('0xb')](_0x2b73('0xc'),_0x2b73('0xd'));return db['CmHopper'][_0x2b73('0x7')]({'where':{}});})[_0x2b73('0x8')](function(){return db['CmHopper'][_0x2b73('0xa')](hopper);})['then'](function(){console['log'](_0x2b73('0xc'),_0x2b73('0xe'));return db['CmContact'][_0x2b73('0xa')](contacts2);})[_0x2b73('0x8')](function(){console[_0x2b73('0xb')](_0x2b73('0xc'),'contacts2');return db[_0x2b73('0xf')][_0x2b73('0xa')](hopper2);})['then'](function(){console[_0x2b73('0xb')](_0x2b73('0xc'),_0x2b73('0x10'));})[_0x2b73('0x11')](function(_0x1e5fca){console[_0x2b73('0xb')](_0x1e5fca);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 02bc591..ecba67c 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80eb=['format','%s%s','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','agent'];(function(_0x519395,_0x302146){var _0x46302c=function(_0x22fca4){while(--_0x22fca4){_0x519395['push'](_0x519395['shift']());}};_0x46302c(++_0x302146);}(_0x80eb,0xe0));var _0xb80e=function(_0xef8900,_0x1db131){_0xef8900=_0xef8900-0x0;var _0x261ea6=_0x80eb[_0xef8900];return _0x261ea6;};'use strict';var util=require(_0xb80e('0x0'));var db=require(_0xb80e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb80e('0x2')]({'name':util['format']('%s%s',_0xb80e('0x3'),i),'fullname':util[_0xb80e('0x4')](_0xb80e('0x5'),_0xb80e('0x3'),i),'email':util[_0xb80e('0x4')](_0xb80e('0x6'),_0xb80e('0x3'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xb80e('0x7'),'transport':[_0xb80e('0x8'),'ws',_0xb80e('0x9')],'disallow':['all'],'allow':[_0xb80e('0xa')],'defaultuser':util['format'](_0xb80e('0x5'),'agent',i),'encryption':_0xb80e('0xb'),'avpf':_0xb80e('0xb'),'force_avp':_0xb80e('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb80e('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xb80e('0x4')]('\x22%s\x22\x20<%s>',util['format'](_0xb80e('0x5'),_0xb80e('0x3'),i),0xfa0+i)});}db[_0xb80e('0xd')][_0xb80e('0xe')](users)[_0xb80e('0xf')](function(){console['log'](_0xb80e('0x10'));})[_0xb80e('0x11')](function(_0x366b12){console[_0xb80e('0x12')](_0x366b12);}); \ No newline at end of file +var _0x31ea=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','%s%s','agent','format','%s%s@xcally.com','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x31ea,0x1e4));var _0xa31e=function(_0x181a3b,_0x3734db){_0x181a3b=_0x181a3b-0x0;var _0x1b645d=_0x31ea[_0x181a3b];return _0x1b645d;};'use strict';var util=require('util');var db=require(_0xa31e('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xa31e('0x1'),_0xa31e('0x2'),i),'fullname':util[_0xa31e('0x3')]('%s%s',_0xa31e('0x2'),i),'email':util['format'](_0xa31e('0x4'),'agent',i),'role':_0xa31e('0x2'),'password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0xa31e('0x5')],'defaultuser':util[_0xa31e('0x3')](_0xa31e('0x1'),_0xa31e('0x2'),i),'encryption':'yes','avpf':_0xa31e('0x6'),'force_avp':_0xa31e('0x6'),'icesupport':'yes','dtlsenable':_0xa31e('0x6'),'dtlsverify':'no','dtlscertfile':_0xa31e('0x7'),'dtlsprivatekey':_0xa31e('0x8'),'dtlssetup':_0xa31e('0x9'),'callerid':util[_0xa31e('0x3')](_0xa31e('0xa'),util[_0xa31e('0x3')](_0xa31e('0x1'),_0xa31e('0x2'),i),0xfa0+i)});}db[_0xa31e('0xb')][_0xa31e('0xc')](users)[_0xa31e('0xd')](function(){console[_0xa31e('0xe')](_0xa31e('0xf'));})[_0xa31e('0x10')](function(_0x15202f){console[_0xa31e('0xe')](_0x15202f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d21c665..88501f9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e4f=['userProfileId','ChatInteraction','MailInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','type','format','length','user:%s','handshake','query'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x8e4f,0xa9));var _0xf8e4=function(_0x53a864,_0x46f773){_0x53a864=_0x53a864-0x0;var _0x5432d1=_0x8e4f[_0x53a864];return _0x5432d1;};'use strict';var _=require(_0xf8e4('0x0'));var util=require(_0xf8e4('0x1'));var BPromise=require(_0xf8e4('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xf8e4('0x3'));var queryQueues={'attributes':['id',_0xf8e4('0x4')],'include':[{'as':_0xf8e4('0x5'),'model':db[_0xf8e4('0x6')],'attributes':['id','name',_0xf8e4('0x7')],'raw':!![],'where':{'role':_0xf8e4('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf8e4('0x4')],'where':{'role':_0xf8e4('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf8e4('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xf8e4('0x4')],'where':{'role':_0xf8e4('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf8e4('0x4'),'type'],'where':{'type':_0xf8e4('0xa')}};function getAssociatedResources(_0xa4cbc9,_0x27697f,_0x133ea6){return db['UserProfileSection'][_0xf8e4('0xb')]({'where':{'name':_0xa4cbc9,'userProfileId':_0x27697f},'raw':!![]})[_0xf8e4('0xc')](function(_0x7fbfb){if(_0x7fbfb){if(_0x7fbfb[_0xf8e4('0xd')]){switch(_0xa4cbc9){case _0xf8e4('0xe'):case _0xf8e4('0xf'):case'FaxQueues':case _0xf8e4('0x10'):case _0xf8e4('0x11'):case'OpenchannelQueues':case _0xf8e4('0x12'):return db[_0x133ea6][_0xf8e4('0x13')](queryQueues);case _0xf8e4('0x14'):return db[_0x133ea6][_0xf8e4('0x13')](queryTelephones);case _0xf8e4('0x15'):return db[_0x133ea6][_0xf8e4('0x13')](queryTrunks);case _0xf8e4('0x16'):return db[_0x133ea6][_0xf8e4('0x13')](queryCampaigns);}}else{return db[_0xf8e4('0x17')][_0xf8e4('0x13')]({'attributes':[_0xf8e4('0x18')],'where':{'sectionId':_0x7fbfb['id']},'raw':!![]})[_0xf8e4('0xc')](function(_0x39848a){if(_0x39848a){var _0x490aa8={'where':{'id':_['map'](_0x39848a,'resourceId')},'raw':!![]};switch(_0x133ea6){case _0xf8e4('0x6'):_0x490aa8[_0xf8e4('0x19')][_0xf8e4('0x7')]='telephone';break;case _0xf8e4('0x1a'):_0x490aa8[_0xf8e4('0x19')][_0xf8e4('0x1b')]='ivr';break;}return db[_0x133ea6][_0xf8e4('0x13')](_0x490aa8);}else{return[];}});}}else{return[];}})['then'](function(_0x36b4f2){return _0x36b4f2;});}function joinOrLeaveQueues(_0x3713fb,_0x2f9ca4,_0x363bcd,_0x26436a){_0x3713fb[_0x2f9ca4](util[_0xf8e4('0x1c')]('%s:queue:%s',_0x363bcd,_0x26436a[_0xf8e4('0x4')]));if(_0x26436a[_0xf8e4('0x5')]){for(var _0x5e04df=0x0;_0x5e04df<_0x26436a[_0xf8e4('0x5')][_0xf8e4('0x1d')];_0x5e04df+=0x1){_0x3713fb[_0x2f9ca4](util[_0xf8e4('0x1c')](_0xf8e4('0x1e'),_0x26436a[_0xf8e4('0x5')][_0x5e04df][_0xf8e4('0x4')]));}}}function joinOrLeave(_0x212825,_0x3bea4f,_0x25c6bc){var _0x3be778;if(_0x212825[_0xf8e4('0x1f')][_0xf8e4('0x20')]['id']){db[_0xf8e4('0x6')]['find']({'attributes':['id','name',_0xf8e4('0x7'),_0xf8e4('0x21')],'where':{'id':_0x212825['handshake']['query']['id']},'include':[{'model':db[_0xf8e4('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x24')],'as':_0xf8e4('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x26')],'as':_0xf8e4('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8e4('0x28')],'as':_0xf8e4('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf8e4('0xc')](function(_0x425c09){if(_0x425c09){_0x3be778=_0x425c09;_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x1e'),_0x425c09['name']));var _0x5d6994=[];switch(_0x425c09[_0xf8e4('0x7')]){case _0xf8e4('0x2a'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f]('voice:outbound');if(queryQueues[_0xf8e4('0x2c')](_0xf8e4('0x2d'))){delete queryQueues['include'];}_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x2f')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x30')]['findAll'](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x31')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x32')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x33')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x34')][_0xf8e4('0x13')](queryQueues));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x35')][_0xf8e4('0x13')](queryQueues));_0x5d6994['push'](db[_0xf8e4('0x6')][_0xf8e4('0x13')](queryTelephones));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x36')][_0xf8e4('0x13')](queryTrunks));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x1a')][_0xf8e4('0x13')](queryCampaigns));_0x5d6994[_0xf8e4('0x2e')](db[_0xf8e4('0x6')]['findAll'](queryAgents));break;case _0xf8e4('0x37'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f](_0xf8e4('0x38'));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0xe'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x2f')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0xf'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x30')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x39'),_0x425c09[_0xf8e4('0x21')],'FaxQueue'));_0x5d6994['push'](getAssociatedResources('SmsQueues',_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x32')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x11'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x33')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x3a'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x34')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x12'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x35')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources('Telephones',_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x6')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x15'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x36')));_0x5d6994[_0xf8e4('0x2e')](getAssociatedResources(_0xf8e4('0x16'),_0x425c09[_0xf8e4('0x21')],_0xf8e4('0x1a')));_0x5d6994['push'](db[_0xf8e4('0x6')][_0xf8e4('0x13')](queryAgents));break;case _0xf8e4('0x8'):_0x212825[_0x3bea4f](_0xf8e4('0x2b'));_0x212825[_0x3bea4f](_0xf8e4('0x38'));_0x5d6994['push'](_0x425c09[_0xf8e4('0x3b')]({'attributes':['id','name']}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09[_0xf8e4('0x3c')]({'attributes':['id','name']}));_0x5d6994['push'](_0x425c09['getFaxQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994['push'](_0x425c09['getSmsQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994['push'](_0x425c09[_0xf8e4('0x3d')]({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09['getOpenchannelQueues']({'attributes':['id',_0xf8e4('0x4')]}));_0x5d6994[_0xf8e4('0x2e')](_0x425c09[_0xf8e4('0x3e')]({'attributes':['id',_0xf8e4('0x4')]}));break;}return BPromise[_0xf8e4('0x3f')](_0x5d6994);}})[_0xf8e4('0xc')](function(_0x270489){if(_0x270489&&_0x270489[_0xf8e4('0x1d')]){for(var _0x4f785b=0x0;_0x4f785b<_0x270489[_0xf8e4('0x1d')];_0x4f785b+=0x1){for(var _0x28b00d=0x0;_0x28b00d<_0x270489[_0x4f785b][_0xf8e4('0x1d')];_0x28b00d+=0x1){switch(_0x4f785b){case 0x0:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x40'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x1:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x41'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x2:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x42'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x3:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x43'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x4:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x44'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x5:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x45'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x6:joinOrLeaveQueues(_0x212825,_0x3bea4f,_0xf8e4('0x46'),_0x270489[_0x4f785b][_0x28b00d]);break;case 0x7:if(_0x3be778['role']!==_0xf8e4('0x8'))_0x212825[_0x3bea4f](util[_0xf8e4('0x1c')](_0xf8e4('0x47'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0x8:if(_0x3be778[_0xf8e4('0x7')]!=='agent')_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x48'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0x9:if(_0x3be778[_0xf8e4('0x7')]!==_0xf8e4('0x8'))_0x212825[_0x3bea4f](util['format'](_0xf8e4('0x49'),_0x270489[_0x4f785b][_0x28b00d]['type'],_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;case 0xa:_0x212825[_0x3bea4f](util[_0xf8e4('0x1c')](_0xf8e4('0x1e'),_0x270489[_0x4f785b][_0x28b00d][_0xf8e4('0x4')]));break;}}}}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x5b59bb=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x4c')],'id');return _0x3be778[_0xf8e4('0x4d')](_0x5b59bb)[_0xf8e4('0xc')](function(){for(var _0x3a1b5a=0x0;_0x3a1b5a<_0x5b59bb[_0xf8e4('0x1d')];_0x3a1b5a+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x4f'),{'ChatInteractionId':Number(_0x5b59bb[_0x3a1b5a]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x591af3=_[_0xf8e4('0x4b')](_0x3be778['MailInteractions'],'id');return _0x3be778[_0xf8e4('0x50')](_0x591af3)[_0xf8e4('0xc')](function(){for(var _0x27bcf5=0x0;_0x27bcf5<_0x591af3[_0xf8e4('0x1d')];_0x27bcf5+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x51'),{'MailInteractionId':Number(_0x591af3[_0x27bcf5]),'UserId':Number(_0x3be778['id'])});}});}})['then'](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x2848d2=_[_0xf8e4('0x4b')](_0x3be778['FaxInteractions'],'id');return _0x3be778[_0xf8e4('0x52')](_0x2848d2)[_0xf8e4('0xc')](function(){for(var _0x34f84d=0x0;_0x34f84d<_0x2848d2['length'];_0x34f84d+=0x1){_0x25c6bc['emit'](_0xf8e4('0x53'),{'FaxInteractionId':Number(_0x2848d2[_0x34f84d]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f==='leave'){var _0x330c63=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x25')],'id');return _0x3be778[_0xf8e4('0x54')](_0x330c63)[_0xf8e4('0xc')](function(){for(var _0x3c1fba=0x0;_0x3c1fba<_0x330c63[_0xf8e4('0x1d')];_0x3c1fba+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x55'),{'SmsInteractionId':Number(_0x330c63[_0x3c1fba]),'UserId':Number(_0x3be778['id'])});}});}})['then'](function(){if(_0x3bea4f==='leave'){var _0x3174ac=_[_0xf8e4('0x4b')](_0x3be778[_0xf8e4('0x27')],'id');return _0x3be778['removeOpenchannelInteractions'](_0x3174ac)[_0xf8e4('0xc')](function(){for(var _0x10605d=0x0;_0x10605d<_0x3174ac[_0xf8e4('0x1d')];_0x10605d+=0x1){_0x25c6bc[_0xf8e4('0x4e')](_0xf8e4('0x56'),{'OpenchannelInteractionId':Number(_0x3174ac[_0x10605d]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0xc')](function(){if(_0x3bea4f===_0xf8e4('0x4a')){var _0x41a6c3=_['map'](_0x3be778['WhatsappInteractions'],'id');return _0x3be778[_0xf8e4('0x57')](_0x41a6c3)[_0xf8e4('0xc')](function(){for(var _0x426607=0x0;_0x426607<_0x41a6c3['length'];_0x426607+=0x1){_0x25c6bc[_0xf8e4('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x41a6c3[_0x426607]),'UserId':Number(_0x3be778['id'])});}});}})[_0xf8e4('0x58')](function(_0x2f1ef9){_0x212825['log'](_0x2f1ef9);});}}function onDisconnect(_0x2c5a93,_0x1bab7a){joinOrLeave(_0x2c5a93,_0xf8e4('0x4a'),_0x1bab7a);}function onConnect(_0x31d615){joinOrLeave(_0x31d615,'join');}exports[_0xf8e4('0x59')]=function(_0x37706f){_0x37706f['on'](_0xf8e4('0x5a'),function(_0x2b0cea){_0x2b0cea[_0xf8e4('0x5b')](0x0);_0x2b0cea[_0xf8e4('0x5c')]=_0x2b0cea[_0xf8e4('0x5d')][_0xf8e4('0x5a')][_0xf8e4('0x5e')]+':'+_0x2b0cea[_0xf8e4('0x5d')][_0xf8e4('0x5a')]['remotePort'];_0x2b0cea[_0xf8e4('0x5f')]=new Date();_0x2b0cea[_0xf8e4('0x60')]=function(_0x5872d5){console[_0xf8e4('0x60')]('SocketIO\x20'+_0x2b0cea[_0xf8e4('0x61')][_0xf8e4('0x4')]+'['+_0x2b0cea[_0xf8e4('0x5c')]+']',_0x5872d5);};_0x2b0cea['on'](_0xf8e4('0x62'),function(){onDisconnect(_0x2b0cea,_0x37706f);_0x2b0cea['log'](_0xf8e4('0x63'));});onConnect(_0x2b0cea);_0x2b0cea['log'](_0xf8e4('0x64'));});}; \ No newline at end of file +var _0x7add=['removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','User','role','agent','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','telephone','Campaign','type','then','%s:queue:%s','Agents','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','MailQueues','OpenchannelQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','openchannel','whatsapp','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','leave'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7add,0x72));var _0xd7ad=function(_0x37a0b8,_0x246932){_0x37a0b8=_0x37a0b8-0x0;var _0x3962f0=_0x7add[_0x37a0b8];return _0x3962f0;};'use strict';var _=require(_0xd7ad('0x0'));var util=require(_0xd7ad('0x1'));var BPromise=require(_0xd7ad('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xd7ad('0x3'));var queryQueues={'attributes':['id',_0xd7ad('0x4')],'include':[{'as':'Agents','model':db[_0xd7ad('0x5')],'attributes':['id','name',_0xd7ad('0x6')],'raw':!![],'where':{'role':_0xd7ad('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xd7ad('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd7ad('0x4'),'type'],'where':{'type':_0xd7ad('0x8')}};function getAssociatedResources(_0x23ab6e,_0x273ad0,_0x4a140b){return db[_0xd7ad('0x9')][_0xd7ad('0xa')]({'where':{'name':_0x23ab6e,'userProfileId':_0x273ad0},'raw':!![]})['then'](function(_0x2c1a49){if(_0x2c1a49){if(_0x2c1a49[_0xd7ad('0xb')]){switch(_0x23ab6e){case'VoiceQueues':case _0xd7ad('0xc'):case _0xd7ad('0xd'):case _0xd7ad('0xe'):case'MailQueues':case'OpenchannelQueues':case _0xd7ad('0xf'):return db[_0x4a140b][_0xd7ad('0x10')](queryQueues);case'Telephones':return db[_0x4a140b][_0xd7ad('0x10')](queryTelephones);case _0xd7ad('0x11'):return db[_0x4a140b][_0xd7ad('0x10')](queryTrunks);case _0xd7ad('0x12'):return db[_0x4a140b][_0xd7ad('0x10')](queryCampaigns);}}else{return db[_0xd7ad('0x13')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x2c1a49['id']},'raw':!![]})['then'](function(_0x578a68){if(_0x578a68){var _0x3a0c28={'where':{'id':_[_0xd7ad('0x14')](_0x578a68,_0xd7ad('0x15'))},'raw':!![]};switch(_0x4a140b){case _0xd7ad('0x5'):_0x3a0c28[_0xd7ad('0x16')][_0xd7ad('0x6')]=_0xd7ad('0x17');break;case _0xd7ad('0x18'):_0x3a0c28['where'][_0xd7ad('0x19')]=_0xd7ad('0x8');break;}return db[_0x4a140b][_0xd7ad('0x10')](_0x3a0c28);}else{return[];}});}}else{return[];}})[_0xd7ad('0x1a')](function(_0x2e0825){return _0x2e0825;});}function joinOrLeaveQueues(_0x57d5d3,_0xb9b2ee,_0x5460d0,_0x483ffe){_0x57d5d3[_0xb9b2ee](util['format'](_0xd7ad('0x1b'),_0x5460d0,_0x483ffe[_0xd7ad('0x4')]));if(_0x483ffe[_0xd7ad('0x1c')]){for(var _0x24bc06=0x0;_0x24bc06<_0x483ffe['Agents']['length'];_0x24bc06+=0x1){_0x57d5d3[_0xb9b2ee](util[_0xd7ad('0x1d')](_0xd7ad('0x1e'),_0x483ffe['Agents'][_0x24bc06][_0xd7ad('0x4')]));}}}function joinOrLeave(_0x3a8712,_0x5e1820,_0x37feac){var _0x1e3ea1;if(_0x3a8712[_0xd7ad('0x1f')][_0xd7ad('0x20')]['id']){db[_0xd7ad('0x5')]['find']({'attributes':['id',_0xd7ad('0x4'),'role',_0xd7ad('0x21')],'where':{'id':_0x3a8712['handshake'][_0xd7ad('0x20')]['id']},'include':[{'model':db[_0xd7ad('0x22')],'as':_0xd7ad('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7ad('0x24')],'as':_0xd7ad('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7ad('0x26')],'as':_0xd7ad('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7ad('0x28')],'as':_0xd7ad('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xd7ad('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7ad('0x2b')],'as':_0xd7ad('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xd7ad('0x1a')](function(_0x40e436){if(_0x40e436){_0x1e3ea1=_0x40e436;_0x3a8712[_0x5e1820](util['format']('user:%s',_0x40e436[_0xd7ad('0x4')]));var _0x17d062=[];switch(_0x40e436[_0xd7ad('0x6')]){case _0xd7ad('0x2d'):_0x3a8712[_0x5e1820](_0xd7ad('0x2e'));_0x3a8712[_0x5e1820](_0xd7ad('0x2f'));if(queryQueues[_0xd7ad('0x30')](_0xd7ad('0x31'))){delete queryQueues[_0xd7ad('0x31')];}_0x17d062['push'](db[_0xd7ad('0x32')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x34')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x35')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x36')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x37')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x38')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x39')][_0xd7ad('0x10')](queryQueues));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x5')][_0xd7ad('0x10')](queryTelephones));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x3a')][_0xd7ad('0x10')](queryTrunks));_0x17d062['push'](db[_0xd7ad('0x18')][_0xd7ad('0x10')](queryCampaigns));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x5')]['findAll'](queryAgents));break;case _0xd7ad('0x3b'):_0x3a8712[_0x5e1820](_0xd7ad('0x2e'));_0x3a8712[_0x5e1820](_0xd7ad('0x2f'));_0x17d062[_0xd7ad('0x33')](getAssociatedResources(_0xd7ad('0x3c'),_0x40e436['userProfileId'],_0xd7ad('0x32')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources('ChatQueues',_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x34')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources('FaxQueues',_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x35')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources('SmsQueues',_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x36')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources(_0xd7ad('0x3d'),_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x37')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources(_0xd7ad('0x3e'),_0x40e436[_0xd7ad('0x21')],'OpenchannelQueue'));_0x17d062[_0xd7ad('0x33')](getAssociatedResources(_0xd7ad('0xf'),_0x40e436[_0xd7ad('0x21')],'WhatsappQueue'));_0x17d062['push'](getAssociatedResources(_0xd7ad('0x3f'),_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x5')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources('Trunks',_0x40e436[_0xd7ad('0x21')],_0xd7ad('0x3a')));_0x17d062[_0xd7ad('0x33')](getAssociatedResources('IvrCampaigns',_0x40e436['userProfileId'],_0xd7ad('0x18')));_0x17d062[_0xd7ad('0x33')](db[_0xd7ad('0x5')][_0xd7ad('0x10')](queryAgents));break;case _0xd7ad('0x7'):_0x3a8712[_0x5e1820](_0xd7ad('0x2e'));_0x3a8712[_0x5e1820]('voice:outbound');_0x17d062['push'](_0x40e436[_0xd7ad('0x40')]({'attributes':['id',_0xd7ad('0x4')]}));_0x17d062[_0xd7ad('0x33')](_0x40e436[_0xd7ad('0x41')]({'attributes':['id',_0xd7ad('0x4')]}));_0x17d062[_0xd7ad('0x33')](_0x40e436[_0xd7ad('0x42')]({'attributes':['id',_0xd7ad('0x4')]}));_0x17d062[_0xd7ad('0x33')](_0x40e436[_0xd7ad('0x43')]({'attributes':['id','name']}));_0x17d062['push'](_0x40e436[_0xd7ad('0x44')]({'attributes':['id',_0xd7ad('0x4')]}));_0x17d062[_0xd7ad('0x33')](_0x40e436['getOpenchannelQueues']({'attributes':['id',_0xd7ad('0x4')]}));_0x17d062[_0xd7ad('0x33')](_0x40e436[_0xd7ad('0x45')]({'attributes':['id',_0xd7ad('0x4')]}));break;}return BPromise[_0xd7ad('0x46')](_0x17d062);}})['then'](function(_0x376a6f){if(_0x376a6f&&_0x376a6f[_0xd7ad('0x47')]){for(var _0x4c8e61=0x0;_0x4c8e61<_0x376a6f['length'];_0x4c8e61+=0x1){for(var _0x5c8e37=0x0;_0x5c8e37<_0x376a6f[_0x4c8e61][_0xd7ad('0x47')];_0x5c8e37+=0x1){switch(_0x4c8e61){case 0x0:joinOrLeaveQueues(_0x3a8712,_0x5e1820,'voice',_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x1:joinOrLeaveQueues(_0x3a8712,_0x5e1820,'chat',_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x2:joinOrLeaveQueues(_0x3a8712,_0x5e1820,'fax',_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x3:joinOrLeaveQueues(_0x3a8712,_0x5e1820,'sms',_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x4:joinOrLeaveQueues(_0x3a8712,_0x5e1820,'mail',_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x5:joinOrLeaveQueues(_0x3a8712,_0x5e1820,_0xd7ad('0x48'),_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x6:joinOrLeaveQueues(_0x3a8712,_0x5e1820,_0xd7ad('0x49'),_0x376a6f[_0x4c8e61][_0x5c8e37]);break;case 0x7:if(_0x1e3ea1[_0xd7ad('0x6')]!==_0xd7ad('0x7'))_0x3a8712[_0x5e1820](util[_0xd7ad('0x1d')]('telephone:%s',_0x376a6f[_0x4c8e61][_0x5c8e37][_0xd7ad('0x4')]));break;case 0x8:if(_0x1e3ea1[_0xd7ad('0x6')]!=='agent')_0x3a8712[_0x5e1820](util[_0xd7ad('0x1d')](_0xd7ad('0x4a'),_0x376a6f[_0x4c8e61][_0x5c8e37][_0xd7ad('0x4')]));break;case 0x9:if(_0x1e3ea1['role']!==_0xd7ad('0x7'))_0x3a8712[_0x5e1820](util[_0xd7ad('0x1d')](_0xd7ad('0x4b'),_0x376a6f[_0x4c8e61][_0x5c8e37][_0xd7ad('0x19')],_0x376a6f[_0x4c8e61][_0x5c8e37][_0xd7ad('0x4')]));break;case 0xa:_0x3a8712[_0x5e1820](util[_0xd7ad('0x1d')](_0xd7ad('0x1e'),_0x376a6f[_0x4c8e61][_0x5c8e37][_0xd7ad('0x4')]));break;}}}}})[_0xd7ad('0x1a')](function(){if(_0x5e1820==='leave'){var _0xfde550=_[_0xd7ad('0x14')](_0x1e3ea1[_0xd7ad('0x23')],'id');return _0x1e3ea1['removeChatInteractions'](_0xfde550)[_0xd7ad('0x1a')](function(){for(var _0x5dfaff=0x0;_0x5dfaff<_0xfde550['length'];_0x5dfaff+=0x1){_0x37feac[_0xd7ad('0x4c')](_0xd7ad('0x4d'),{'ChatInteractionId':Number(_0xfde550[_0x5dfaff]),'UserId':Number(_0x1e3ea1['id'])});}});}})['then'](function(){if(_0x5e1820==='leave'){var _0xf09a5c=_['map'](_0x1e3ea1['MailInteractions'],'id');return _0x1e3ea1['removeMailInteractions'](_0xf09a5c)[_0xd7ad('0x1a')](function(){for(var _0x3b07c1=0x0;_0x3b07c1<_0xf09a5c[_0xd7ad('0x47')];_0x3b07c1+=0x1){_0x37feac['emit'](_0xd7ad('0x4e'),{'MailInteractionId':Number(_0xf09a5c[_0x3b07c1]),'UserId':Number(_0x1e3ea1['id'])});}});}})[_0xd7ad('0x1a')](function(){if(_0x5e1820===_0xd7ad('0x4f')){var _0x27f490=_['map'](_0x1e3ea1[_0xd7ad('0x27')],'id');return _0x1e3ea1[_0xd7ad('0x50')](_0x27f490)['then'](function(){for(var _0x511bd0=0x0;_0x511bd0<_0x27f490['length'];_0x511bd0+=0x1){_0x37feac['emit'](_0xd7ad('0x51'),{'FaxInteractionId':Number(_0x27f490[_0x511bd0]),'UserId':Number(_0x1e3ea1['id'])});}});}})[_0xd7ad('0x1a')](function(){if(_0x5e1820===_0xd7ad('0x4f')){var _0xc2b847=_[_0xd7ad('0x14')](_0x1e3ea1['SmsInteractions'],'id');return _0x1e3ea1[_0xd7ad('0x52')](_0xc2b847)['then'](function(){for(var _0x315c88=0x0;_0x315c88<_0xc2b847['length'];_0x315c88+=0x1){_0x37feac[_0xd7ad('0x4c')](_0xd7ad('0x53'),{'SmsInteractionId':Number(_0xc2b847[_0x315c88]),'UserId':Number(_0x1e3ea1['id'])});}});}})['then'](function(){if(_0x5e1820==='leave'){var _0xf9cd33=_['map'](_0x1e3ea1[_0xd7ad('0x2a')],'id');return _0x1e3ea1[_0xd7ad('0x54')](_0xf9cd33)[_0xd7ad('0x1a')](function(){for(var _0xa8527a=0x0;_0xa8527a<_0xf9cd33[_0xd7ad('0x47')];_0xa8527a+=0x1){_0x37feac[_0xd7ad('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xf9cd33[_0xa8527a]),'UserId':Number(_0x1e3ea1['id'])});}});}})['then'](function(){if(_0x5e1820==='leave'){var _0x34214a=_['map'](_0x1e3ea1[_0xd7ad('0x2c')],'id');return _0x1e3ea1['removeWhatsappInteractions'](_0x34214a)[_0xd7ad('0x1a')](function(){for(var _0xe9b0d5=0x0;_0xe9b0d5<_0x34214a['length'];_0xe9b0d5+=0x1){_0x37feac['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x34214a[_0xe9b0d5]),'UserId':Number(_0x1e3ea1['id'])});}});}})[_0xd7ad('0x55')](function(_0x463f4b){_0x3a8712[_0xd7ad('0x56')](_0x463f4b);});}}function onDisconnect(_0x3f655a,_0xd23812){joinOrLeave(_0x3f655a,_0xd7ad('0x4f'),_0xd23812);}function onConnect(_0x7ce205){joinOrLeave(_0x7ce205,_0xd7ad('0x57'));}exports[_0xd7ad('0x58')]=function(_0x3bcafe){_0x3bcafe['on'](_0xd7ad('0x59'),function(_0x298e6a){_0x298e6a[_0xd7ad('0x5a')](0x0);_0x298e6a[_0xd7ad('0x5b')]=_0x298e6a[_0xd7ad('0x5c')]['connection']['remoteAddress']+':'+_0x298e6a['request'][_0xd7ad('0x59')][_0xd7ad('0x5d')];_0x298e6a['connectedAt']=new Date();_0x298e6a[_0xd7ad('0x56')]=function(_0x4bb43f){console[_0xd7ad('0x56')]('SocketIO\x20'+_0x298e6a['nsp'][_0xd7ad('0x4')]+'['+_0x298e6a[_0xd7ad('0x5b')]+']',_0x4bb43f);};_0x298e6a['on'](_0xd7ad('0x5e'),function(){onDisconnect(_0x298e6a,_0x3bcafe);_0x298e6a[_0xd7ad('0x56')](_0xd7ad('0x5f'));});onConnect(_0x298e6a);_0x298e6a[_0xd7ad('0x56')](_0xd7ad('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d5b623d..7ea976b 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 _0x033c=['ContactId','AfterUpdate','find','email','internal','default','length','hasOwnProperty','model','hook','callback','condition','util','jayson/promise','../logger','Chat','newinteraction','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','info','Trigger,\x20%s','EventManager','error','channel','motionChannel','event','resolve','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','get','opened','SIP/%s','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x313f53,_0x2bebfb){var _0x4844de=function(_0x3252ac){while(--_0x3252ac){_0x313f53['push'](_0x313f53['shift']());}};_0x4844de(++_0x2bebfb);}(_0x033c,0x98));var _0xc033=function(_0x7de4f6,_0x1e1a32){_0x7de4f6=_0x7de4f6-0x0;var _0x1686fd=_0x033c[_0x7de4f6];return _0x1686fd;};'use strict';var util=require(_0xc033('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc033('0x1'));var logger=require(_0xc033('0x2'))('triggers');var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xc033('0x3'),'model':'ChatInteraction','event':'afterCreate','condition':_0xc033('0x4'),'callback':afterCreate},{'channel':_0xc033('0x3'),'model':'ChatInteraction','event':'afterUpdate','condition':_0xc033('0x5'),'callback':afterUpdate},{'channel':_0xc033('0x3'),'model':_0xc033('0x6'),'event':_0xc033('0x7'),'condition':_0xc033('0x8'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xc033('0x9'),'event':_0xc033('0x7'),'condition':_0xc033('0x8'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0xc033('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xc033('0xa'),'model':_0xc033('0xb'),'event':_0xc033('0xc'),'condition':_0xc033('0x5'),'callback':afterUpdate},{'channel':_0xc033('0xa'),'model':_0xc033('0xd'),'event':_0xc033('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc033('0xe'),'model':_0xc033('0xf'),'event':_0xc033('0x7'),'condition':_0xc033('0x4'),'callback':afterCreate},{'channel':_0xc033('0xe'),'model':_0xc033('0xf'),'event':_0xc033('0xc'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc033('0xe'),'model':_0xc033('0x10'),'event':_0xc033('0x7'),'condition':_0xc033('0x8'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xc033('0x11'),'event':_0xc033('0x7'),'condition':_0xc033('0x4'),'callback':afterCreate},{'channel':_0xc033('0x12'),'model':_0xc033('0x11'),'event':_0xc033('0xc'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc033('0x12'),'model':_0xc033('0x13'),'event':_0xc033('0x7'),'condition':_0xc033('0x8'),'callback':afterCreateMessage},{'channel':_0xc033('0x14'),'model':_0xc033('0x15'),'event':_0xc033('0x7'),'condition':_0xc033('0x4'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xc033('0xc'),'condition':_0xc033('0x5'),'callback':afterUpdate},{'channel':_0xc033('0x14'),'model':_0xc033('0x16'),'event':_0xc033('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc033('0x17'),'model':_0xc033('0x18'),'event':_0xc033('0x7'),'condition':_0xc033('0x4'),'callback':afterCreate},{'channel':_0xc033('0x17'),'model':_0xc033('0x18'),'event':_0xc033('0xc'),'condition':_0xc033('0x5'),'callback':afterUpdate},{'channel':_0xc033('0x17'),'model':_0xc033('0x19'),'event':_0xc033('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x4d973f){return client['request']('EventManager',_0x4d973f)[_0xc033('0x1a')](function(_0x5452d9){logger[_0xc033('0x1b')](_0xc033('0x1c'),_0xc033('0x1d'),_0x5452d9);if(_0x5452d9[_0xc033('0x1e')]){if(_0x5452d9[_0xc033('0x1e')]['code']===0x1f4){logger['error'](_0xc033('0x1c'),_0xc033('0x1d'),_0x5452d9[_0xc033('0x1e')]);}}})['catch'](function(_0x224d69){logger['error'](_0xc033('0x1c'),'EventManager',_0x224d69);});}function afterCreateMessage(_0x354747){return function(_0x5e5411){_0x5e5411=_0x5e5411['get']({'plain':!![]});_0x5e5411[_0xc033('0x1f')]=_0x354747;_0x5e5411[_0xc033('0x20')]=_0x354747;_0x5e5411[_0xc033('0x21')]=_0x5e5411['direction'];Promise[_0xc033('0x22')]()[_0xc033('0x1a')](function(){if(typeof _0x5e5411['ContactId']===_0xc033('0x23'))return null;var _0x2c9444='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e5411['ContactId'];return db[_0xc033('0x24')][_0xc033('0x25')](_0x2c9444,{'type':db[_0xc033('0x26')][_0xc033('0x27')][_0xc033('0x28')],'raw':!![]});})[_0xc033('0x1a')](function(_0x50ac7b){if(_0x50ac7b){_0x5e5411[_0xc033('0x29')]=_0x50ac7b[0x0];}if(typeof _0x5e5411[_0xc033('0x2a')]===_0xc033('0x23'))return;return getAgent(_0x5e5411[_0xc033('0x2a')]);})[_0xc033('0x1a')](function(_0x383e41){if(_0x383e41){_0x5e5411[_0xc033('0x2b')]=util[_0xc033('0x2c')]('SIP/%s',_0x383e41[_0xc033('0x2d')]);_0x5e5411[_0xc033('0x2e')]=_0x383e41;_0x5e5411[_0xc033('0x1f')]=_0x354747;return request({'event':_0xc033('0x2f'),'message':_0x5e5411});}else{return request({'event':_0xc033('0x30'),'message':_0x5e5411});}})[_0xc033('0x31')](function(_0x53474f){logger[_0xc033('0x1e')]('Trigger,\x20%s',_0xc033('0x32'),_0x53474f);});};}function afterCreateOfflineMessage(_0x280758){return function(_0x346846){_0x346846=_0x346846['get']({'plain':!![]});_0x346846[_0xc033('0x1f')]=_0x280758;_0x346846[_0xc033('0x20')]=_0x280758;_0x346846[_0xc033('0x21')]='offlineMessage';return request({'event':_0x346846['event'],'message':_0x346846});};}function afterCreate(_0x1a18fd,_0x261e69){return function(_0x5c6603){_0x5c6603=_0x5c6603[_0xc033('0x33')]({'plain':!![]});_0x5c6603[_0xc033('0x1f')]=_0x1a18fd;_0x5c6603['motionChannel']=_0x1a18fd;_0x5c6603[_0xc033('0x21')]=_0xc033('0x34');Promise['resolve']()[_0xc033('0x1a')](function(){var _0x59f233='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c6603['ContactId'];return db[_0xc033('0x24')]['query'](_0x59f233,{'type':db['Sequelize'][_0xc033('0x27')][_0xc033('0x28')],'raw':!![]});})[_0xc033('0x1a')](function(_0x2c1f3e){if(_0x2c1f3e){_0x5c6603['contact']=_0x2c1f3e[0x0];}if(typeof _0x5c6603[_0xc033('0x2a')]===_0xc033('0x23'))return;return getAgent(_0x5c6603['UserId']);})['then'](function(_0x1317c3){if(_0x1317c3){_0x5c6603[_0xc033('0x2b')]=util[_0xc033('0x2c')](_0xc033('0x35'),_0x1317c3[_0xc033('0x2d')]);_0x5c6603[_0xc033('0x2e')]=_0x1317c3;}return request({'event':_0x261e69,'message':_0x5c6603});})[_0xc033('0x31')](function(_0x28c292){logger[_0xc033('0x1e')](_0xc033('0x1c'),'AfterCreate',_0x28c292);});};}function afterUpdate(_0x59d1c6){return function(_0x48a432){var _0x19bc47=_0x48a432[_0xc033('0x36')](_0xc033('0x37'))&&_0x48a432[_0xc033('0x37')];var _0xc45c33=_0x48a432[_0xc033('0x36')](_0xc033('0x38'));if(_0x19bc47||_0xc45c33){var _0x415cf9=_0x19bc47?_0xc033('0x5'):_0xc033('0x38');var _0x8f53fc=_0x48a432['get']({'plain':!![]});_0x8f53fc[_0xc033('0x1f')]=_0x59d1c6;_0x8f53fc[_0xc033('0x20')]=_0x59d1c6;_0x8f53fc[_0xc033('0x21')]=_0x19bc47?_0xc033('0x37'):_0xc033('0x38');var _0x27802=_0xc033('0x39')+_0x8f53fc[_0xc033('0x3a')];return db[_0xc033('0x24')][_0xc033('0x25')](_0x27802,{'type':db[_0xc033('0x26')][_0xc033('0x27')][_0xc033('0x28')],'raw':!![]})[_0xc033('0x1a')](function(_0x1a9c8c){if(_0x1a9c8c){_0x8f53fc[_0xc033('0x29')]=_0x1a9c8c[0x0];}if(typeof _0x8f53fc[_0xc033('0x2a')]===_0xc033('0x23'))return;return getAgent(_0x8f53fc['UserId']);})['then'](function(_0xc875ba){if(_0xc875ba){_0x8f53fc[_0xc033('0x2b')]=util[_0xc033('0x2c')](_0xc033('0x35'),_0xc875ba[_0xc033('0x2d')]);_0x8f53fc[_0xc033('0x2e')]=_0xc875ba;}return request({'event':_0x415cf9,'message':_0x8f53fc});})['catch'](function(_0x4b3d3d){logger[_0xc033('0x1e')](_0xc033('0x1c'),_0xc033('0x3b'),_0x4b3d3d);});}};}function getAgent(_0x5c5d31){return db['User'][_0xc033('0x3c')]({'where':{'id':_0x5c5d31},'attributes':['id',_0xc033('0x2d'),'fullname',_0xc033('0x3d'),_0xc033('0x3e')],'raw':!![]})[_0xc033('0x1a')](function(_0xbd9815){return _0xbd9815;});}exports[_0xc033('0x3f')]=function(){for(var _0x2497f9=0x0;_0x2497f9=_0x518d24[_0x2ebc('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1ba0bd(_0x2e2472);})[_0x2ebc('0x15')](function(_0x28ea3f){_0x484710(_0x28ea3f);});});}; \ No newline at end of file +var _0xc423=['updateAttributes','getLicense','agent','User','then','agents','catch','lodash','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x5313fa,_0x7242c5){var _0x5bac88=function(_0x260150){while(--_0x260150){_0x5313fa['push'](_0x5313fa['shift']());}};_0x5bac88(++_0x7242c5);}(_0xc423,0x103));var _0x3c42=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc423[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3c42('0x0'));var BPromise=require('bluebird');var db=require(_0x3c42('0x1'))['db'];var util=require('./license/util');var channels=[_0x3c42('0x2'),_0x3c42('0x3'),_0x3c42('0x4'),_0x3c42('0x5'),_0x3c42('0x6'),_0x3c42('0x7'),_0x3c42('0x8')];exports[_0x3c42('0x9')]=function(){return channels;};exports[_0x3c42('0xa')]=function(_0x51f7ca){_0x51f7ca=_0x51f7ca[_0x3c42('0xb')]();return _[_0x3c42('0xc')](channels,_0x51f7ca);};exports[_0x3c42('0xd')]=function(_0x431c93,_0x5e2d9b,_0x2b70f3,_0x172db9){var _0x33eab0={'loginAttempts':_0x5e2d9b,'blocked':_0x2b70f3};if(!_['isUndefined'](_0x172db9)){_0x33eab0['blockedAt']=_0x172db9;}return _0x431c93[_0x3c42('0xe')](_0x33eab0);};exports[_0x3c42('0xf')]=function(_0x5adb6a){return new BPromise(function(_0x3a9d0f,_0x140f29){var _0xecd021=0x0;if(_0x5adb6a['role']!==_0x3c42('0x10')){_0x3a9d0f(_0x5adb6a);}db[_0x3c42('0x11')]['count']({'where':{'role':_0x3c42('0x10'),'online':!![],'id':{'$ne':_0x5adb6a['id']}}})[_0x3c42('0x12')](function(_0x533504){_0xecd021=_0x533504;return util[_0x3c42('0xf')]();})[_0x3c42('0x12')](function(_0x1abdf2){if(_0x1abdf2&&_0x1abdf2[_0x3c42('0x13')]&&_0xecd021>=_0x1abdf2[_0x3c42('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3a9d0f(_0x5adb6a);})[_0x3c42('0x14')](function(_0x5e0838){_0x140f29(_0x5e0838);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index b5d4c60..585e7a3 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e91=['statusMessage','send','util','api','Internal\x20Server\x20Error','Error','message','Bad\x20Request','name','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack'];(function(_0x25fef5,_0x4e9f16){var _0xf6a626=function(_0x366ff6){while(--_0x366ff6){_0x25fef5['push'](_0x25fef5['shift']());}};_0xf6a626(++_0x4e9f16);}(_0x0e91,0x86));var _0x10e9=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x0e91[_0x138f59];return _0x3d114d;};'use strict';var util=require(_0x10e9('0x0'));var logger=require('../config/logger')(_0x10e9('0x1'));var APIError=function(_0x24fce1,_0x201f29){this['message']=_0x24fce1||_0x10e9('0x2');this['name']=_0x201f29||_0x10e9('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x38dac7){this[_0x10e9('0x4')]=_0x38dac7||_0x10e9('0x5');this[_0x10e9('0x6')]=_0x10e9('0x5');util[_0x10e9('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x28771e){this['message']=_0x28771e||_0x10e9('0x8');this[_0x10e9('0x6')]='Forbidden';util[_0x10e9('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3c2183){this[_0x10e9('0x4')]=_0x3c2183||_0x10e9('0x9');this[_0x10e9('0x6')]=_0x10e9('0xa');util[_0x10e9('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2f086e){this[_0x10e9('0x4')]=_0x2f086e||_0x10e9('0xb');this[_0x10e9('0x6')]=_0x10e9('0xc');this[_0x10e9('0xd')]=0x193;this[_0x10e9('0xe')]={'type':_0x10e9('0xf')};util[_0x10e9('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3523d1){this[_0x10e9('0x4')]=_0x3523d1||_0x10e9('0x10');this[_0x10e9('0x6')]=_0x10e9('0x11');util[_0x10e9('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x17d32a){switch(_0x17d32a){case _0x10e9('0x5'):return 0x190;case _0x10e9('0x8'),_0x10e9('0xc'):return 0x193;case _0x10e9('0xa'):return 0x194;case _0x10e9('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x555a0b){if(_0x555a0b==='Out\x20Of\x20Interval')return _0x555a0b;return null;}function handleError(_0x1490d0){return function(_0x56b243){logger[_0x10e9('0x12')](_0x56b243[_0x10e9('0x13')]);var _0x429560=getStatusCode(_0x56b243[_0x10e9('0x6')]);var _0x1aa292=getCustomStatusMessage(_0x56b243[_0x10e9('0x6')]);if(_0x56b243[_0x10e9('0x6')]){delete _0x56b243[_0x10e9('0x6')];}if(_0x1aa292){_0x1490d0[_0x10e9('0x14')]=_0x1aa292;}return _0x1490d0['status'](_0x429560)[_0x10e9('0x15')](_0x56b243);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x479b=['error','statusMessage','send','exports','util','api','message','Internal\x20Server\x20Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','Not\x20Found'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x479b,0x130));var _0xb479=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x479b[_0x2b7764];return _0x848dcb;};'use strict';var util=require(_0xb479('0x0'));var logger=require('../config/logger')(_0xb479('0x1'));var APIError=function(_0x3e6ff4,_0x409216){this[_0xb479('0x2')]=_0x3e6ff4||_0xb479('0x3');this['name']=_0x409216||'Error';util[_0xb479('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4a8b76){this['message']=_0x4a8b76||_0xb479('0x5');this[_0xb479('0x6')]='Bad\x20Request';util[_0xb479('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3c6ac0){this[_0xb479('0x2')]=_0x3c6ac0||_0xb479('0x7');this['name']=_0xb479('0x7');util[_0xb479('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x14434e){this[_0xb479('0x2')]=_0x14434e||_0xb479('0x8');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3bfa1f){this[_0xb479('0x2')]=_0x3bfa1f||_0xb479('0x9');this[_0xb479('0x6')]=_0xb479('0xa');this[_0xb479('0xb')]=0x193;this[_0xb479('0xc')]={'type':_0xb479('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0xc5b18e){this[_0xb479('0x2')]=_0xc5b18e||'Resource\x20Conflict';this['name']=_0xb479('0xe');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x178ab9){switch(_0x178ab9){case _0xb479('0x5'):return 0x190;case'Forbidden',_0xb479('0xa'):return 0x193;case _0xb479('0xf'):return 0x194;case _0xb479('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x516699){if(_0x516699===_0xb479('0xa'))return _0x516699;return null;}function handleError(_0x5aca11){return function(_0x426b2f){logger[_0xb479('0x10')](_0x426b2f['stack']);var _0x46e8d1=getStatusCode(_0x426b2f[_0xb479('0x6')]);var _0x4a07ad=getCustomStatusMessage(_0x426b2f['name']);if(_0x426b2f[_0xb479('0x6')]){delete _0x426b2f['name'];}if(_0x4a07ad){_0x5aca11[_0xb479('0x11')]=_0x4a07ad;}return _0x5aca11['status'](_0x46e8d1)[_0xb479('0x12')](_0x426b2f);};}module[_0xb479('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 71bf658..b1abbf0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf635=['404','status','render','json'];(function(_0x5f150e,_0x5e3a1e){var _0x2f6957=function(_0x58db60){while(--_0x58db60){_0x5f150e['push'](_0x5f150e['shift']());}};_0x2f6957(++_0x5e3a1e);}(_0xf635,0x158));var _0x5f63=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xf635[_0x3bf925];return _0x2128a1;};'use strict';module['exports'][0x194]=function pageNotFound(_0x53a3d1,_0x321ad1){var _0x4c3a59=_0x5f63('0x0');var _0x38e94a=0x194;var _0x15af62={'status':_0x38e94a};_0x321ad1[_0x5f63('0x1')](_0x15af62[_0x5f63('0x1')]);_0x321ad1[_0x5f63('0x2')](_0x4c3a59,{},function(_0x15ca06,_0x1113b2){if(_0x15ca06){return _0x321ad1[_0x5f63('0x1')](_0x15af62[_0x5f63('0x1')])[_0x5f63('0x3')](_0x15af62);}_0x321ad1['send'](_0x1113b2);});}; \ No newline at end of file +var _0x4b5d=['render','json','send','status'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4b5d,0x1ab));var _0xd4b5=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x4b5d[_0x5f3de3];return _0x287e0d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x141911,_0x9ac369){var _0x235cb0='404';var _0xa81afe=0x194;var _0x27ac5a={'status':_0xa81afe};_0x9ac369[_0xd4b5('0x0')](_0x27ac5a[_0xd4b5('0x0')]);_0x9ac369[_0xd4b5('0x1')](_0x235cb0,{},function(_0x29a626,_0x2c9954){if(_0x29a626){return _0x9ac369[_0xd4b5('0x0')](_0x27ac5a['status'])[_0xd4b5('0x2')](_0x27ac5a);}_0x9ac369[_0xd4b5('0x3')](_0x2c9954);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c6dd551..dad3a87 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfa4=['../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','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','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','SmsInteractions','MailInteractions','UserNotifications','Hoppers','SET\x20NULL','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','belongsTo','Trunk','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','Attachments','Interaction','Account','ChatOfflineMessageId','IntervalId','TagId','ListId','Contact','Items','FaxAccountId','Exntensions','FaxInteraction','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelMessage','team_has_openchannel_queues','ChatWebsiteId','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','Website','CompanyId','CmContactId','JscriptySessions','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Queue','CampaignId','Automation','All','Actions','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','DefaultReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','SugarcrmField','Description','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VariableId','VtigerConfiguration','ServicenowAccount','Dynamics365Account','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_chat_queues','OpenchannelQueues','WhatsappQueue','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','campaigns_has_cm_lists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model'];(function(_0x35738e,_0x2251f3){var _0x4f6906=function(_0x47f391){while(--_0x47f391){_0x35738e['push'](_0x35738e['shift']());}};_0x4f6906(++_0x2251f3);}(_0xdfa4,0x190));var _0x4dfa=function(_0x292ac3,_0x8f1849){_0x292ac3=_0x292ac3-0x0;var _0x2f9583=_0xdfa4[_0x292ac3];return _0x2f9583;};'use strict';var config=require(_0x4dfa('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x4dfa('0x1'));var timezone=jstz[_0x4dfa('0x2')]();config[_0x4dfa('0x3')]=_[_0x4dfa('0x4')](config[_0x4dfa('0x3')],{'database':_0x4dfa('0x5'),'username':_0x4dfa('0x6'),'password':_0x4dfa('0x7'),'options':{'host':_0x4dfa('0x8'),'port':0xcea,'dialect':_0x4dfa('0x9'),'dialectOptions':{'charset':_0x4dfa('0xa')},'logging':![],'timezone':timezone[_0x4dfa('0xb')](),'define':{'charset':_0x4dfa('0xc'),'collate':_0x4dfa('0xd')}}});config[_0x4dfa('0xe')]=_['defaultsDeep'](config[_0x4dfa('0xe')],{'database':_0x4dfa('0x5'),'username':_0x4dfa('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4dfa('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4dfa('0xb')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x4dfa('0xf')],config[_0x4dfa('0x3')][_0x4dfa('0x10')],config[_0x4dfa('0x3')][_0x4dfa('0x11')],config[_0x4dfa('0x3')][_0x4dfa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x4dfa('0xe')][_0x4dfa('0x10')],config[_0x4dfa('0xe')][_0x4dfa('0x11')],config[_0x4dfa('0xe')]['options'])};db[_0x4dfa('0x13')]=db['sequelize']['import'](_0x4dfa('0x14'));db[_0x4dfa('0x15')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x16'));db[_0x4dfa('0x17')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x19'));db[_0x4dfa('0x1a')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x1b'));db[_0x4dfa('0x1c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x1d'));db[_0x4dfa('0x1e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x1f'));db[_0x4dfa('0x20')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x21'));db[_0x4dfa('0x22')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x23'));db[_0x4dfa('0x24')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x25'));db['VoiceMailMessage']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x26'));db['VoiceCallReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x27'));db[_0x4dfa('0x28')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x29'));db[_0x4dfa('0x2a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2b'));db[_0x4dfa('0x2c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2d'));db['Trunk']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x2e'));db['VoiceTransferReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x2f'));db['UserVoiceQueueRt']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x30'));db[_0x4dfa('0x31')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4dfa('0x32')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x33'));db[_0x4dfa('0x34')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x35'));db[_0x4dfa('0x36')]=db[_0x4dfa('0x3')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x37'));db[_0x4dfa('0x38')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x39'));db[_0x4dfa('0x3a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3b'));db[_0x4dfa('0x3c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3d'));db[_0x4dfa('0x3e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x3f'));db[_0x4dfa('0x40')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/mailAccount/mailAccount.model');db[_0x4dfa('0x41')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x42'));db[_0x4dfa('0x43')]=db['sequelize']['import'](_0x4dfa('0x44'));db[_0x4dfa('0x45')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x46'));db[_0x4dfa('0x47')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x48'));db[_0x4dfa('0x49')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4a'));db[_0x4dfa('0x4b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4c'));db[_0x4dfa('0x4d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x4e'));db[_0x4dfa('0x4f')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x4dfa('0x50')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x51'));db[_0x4dfa('0x52')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x53'));db['FaxInteraction']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/faxInteraction/faxInteraction.model');db[_0x4dfa('0x54')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x55'));db['FaxQueue']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x56'));db['FaxQueueReport']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x57'));db['SmsAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/smsAccount/smsAccount.model');db[_0x4dfa('0x58')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x59'));db[_0x4dfa('0x5a')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/smsInteraction/smsInteraction.model');db[_0x4dfa('0x5b')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x5c'));db[_0x4dfa('0x5d')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x5e'));db['OpenchannelAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x5f'));db[_0x4dfa('0x60')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x61'));db[_0x4dfa('0x62')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x63'));db[_0x4dfa('0x64')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x65'));db[_0x4dfa('0x66')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x67'));db[_0x4dfa('0x68')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatApplication/chatApplication.model');db[_0x4dfa('0x69')]=db['sequelize']['import'](_0x4dfa('0x6a'));db[_0x4dfa('0x6b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x6c'));db[_0x4dfa('0x6d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4dfa('0x6e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/chatQueue/chatQueue.model');db[_0x4dfa('0x6f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x70'));db[_0x4dfa('0x71')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x72'));db[_0x4dfa('0x73')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x74'));db[_0x4dfa('0x75')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x76'));db[_0x4dfa('0x77')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x78'));db[_0x4dfa('0x79')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x7a'));db[_0x4dfa('0x7b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x7c'));db['CmHopperHistory']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x7d'));db[_0x4dfa('0x7e')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4dfa('0x7f')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x80'));db[_0x4dfa('0x81')]=db[_0x4dfa('0x3')]['import']('../api/action/action.model');db['Automation']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x82'));db[_0x4dfa('0x83')]=db[_0x4dfa('0x3')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x4dfa('0x84')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x85'));db[_0x4dfa('0x86')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x87'));db[_0x4dfa('0x88')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x4dfa('0x89')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x8a'));db[_0x4dfa('0x8b')]=db['sequelize'][_0x4dfa('0x18')]('../api/cdr/cdr.model');db[_0x4dfa('0x8c')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x8d'));db['Schedule']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x8e'));db[_0x4dfa('0x8f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x90'));db[_0x4dfa('0x91')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x92'));db[_0x4dfa('0x93')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x94'));db[_0x4dfa('0x95')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x96'));db['CmHopperAdditionalPhone']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x97'));db['Template']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x98'));db['Trigger']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/trigger/trigger.model');db[_0x4dfa('0x99')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/variable/variable.model');db[_0x4dfa('0x9a')]=db['sequelize'][_0x4dfa('0x18')]('../api/integration/integration.model');db[_0x4dfa('0x9b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x9c'));db[_0x4dfa('0x9d')]=db['sequelize']['import'](_0x4dfa('0x9e'));db[_0x4dfa('0x9f')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4dfa('0xa0')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa1'));db[_0x4dfa('0xa2')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa3'));db[_0x4dfa('0xa4')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa5'));db[_0x4dfa('0xa6')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xa7'));db[_0x4dfa('0xa8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xa9'));db[_0x4dfa('0xaa')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xab'));db['SalesforceField']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xac'));db[_0x4dfa('0xad')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xae'));db[_0x4dfa('0xaf')]=db[_0x4dfa('0x3')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db['sequelize'][_0x4dfa('0x18')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x4dfa('0xb0')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb1'));db['DeskConfiguration']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb2'));db[_0x4dfa('0xb3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xb4'));db[_0x4dfa('0xb5')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xb6'));db[_0x4dfa('0xb7')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xb8'));db[_0x4dfa('0xb9')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xba'));db[_0x4dfa('0xbb')]=db[_0x4dfa('0x3')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x4dfa('0xbc')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xbd'));db[_0x4dfa('0xbe')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xbf'));db[_0x4dfa('0xc0')]=db['sequelize'][_0x4dfa('0x18')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4dfa('0xc1')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xc2'));db[_0x4dfa('0xc3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xc4'));db[_0x4dfa('0xc5')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xc6'));db['VtigerConfiguration']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xc7'));db[_0x4dfa('0xc8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xc9'));db['ServicenowAccount']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xca'));db[_0x4dfa('0xcb')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xcc'));db[_0x4dfa('0xcd')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xce'));db['Dynamics365Account']=db[_0x4dfa('0x3')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0x4dfa('0xcf')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd0'));db[_0x4dfa('0xd1')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd2'));db[_0x4dfa('0xd3')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd4'));db[_0x4dfa('0xd5')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd6'));db[_0x4dfa('0xd7')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xd8'));db[_0x4dfa('0x9a')]=db[_0x4dfa('0x3')]['import']('../api/integration/integration.model');db[_0x4dfa('0xd9')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xda'));db[_0x4dfa('0xdb')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xdc'));db['ChatInternalMessage']=db['sequelize']['import'](_0x4dfa('0xdd'));db[_0x4dfa('0xde')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xdf'));db['JscriptyQuestionReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x4dfa('0xe0')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xe1'));db[_0x4dfa('0xe2')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xe3'));db[_0x4dfa('0xe4')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xe5'));db[_0x4dfa('0xe6')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xe7'));db[_0x4dfa('0xe8')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize']['import'](_0x4dfa('0xe9'));db[_0x4dfa('0xea')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xeb'));db[_0x4dfa('0xec')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xed'));db[_0x4dfa('0xee')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xef'));db[_0x4dfa('0xf0')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xf1'));db[_0x4dfa('0xf2')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xf3'));db[_0x4dfa('0xf4')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xf5'));db[_0x4dfa('0xf6')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0xf7'));db[_0x4dfa('0xf8')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xf9'));db[_0x4dfa('0xfa')]=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xfb'));db['Plugin']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0xfc'));db['MailTransferReport']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xfd'));db[_0x4dfa('0xfe')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0xff'));db[_0x4dfa('0x100')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x101'));db[_0x4dfa('0x102')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x103'));db['SmsTransferReport']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x104'));db['CmList']=db['sequelize']['import'](_0x4dfa('0x105'));db[_0x4dfa('0x106')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x107'));db['UserProfile']=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/userProfile/userProfile.model');db[_0x4dfa('0x108')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x109'));db['UserProfileResource']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10a'));db['UserNotification']=db['sequelize'][_0x4dfa('0x18')](_0x4dfa('0x10b'));db['WhatsappAccount']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10c'));db[_0x4dfa('0x10d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x10e'));db[_0x4dfa('0x10f')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x110'));db[_0x4dfa('0x111')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x112'));db[_0x4dfa('0x113')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x114'));db['WhatsappQueue']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x115'));db['CloudProvider']=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x116'));db[_0x4dfa('0x117')]=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x118'));db[_0x4dfa('0x119')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11a'));db[_0x4dfa('0x11b')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11c'));db[_0x4dfa('0x11d')]=db[_0x4dfa('0x3')][_0x4dfa('0x18')](_0x4dfa('0x11e'));db['MailInteractionHasTag']=db[_0x4dfa('0x3')]['import'](_0x4dfa('0x11f'));db[_0x4dfa('0x13')][_0x4dfa('0x120')](db[_0x4dfa('0x24')],{'as':_0x4dfa('0x24'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x120')](db['UserSetting'],{'as':_0x4dfa('0x123'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db[_0x4dfa('0x20')],{'as':_0x4dfa('0x125'),'foreignKey':'UserId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x126')],{'as':_0x4dfa('0x127'),'foreignKey':'UserId'});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x128'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x12b'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')]['hasMany'](db[_0x4dfa('0x12c')],{'as':'OpenchannelInteractions','foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db[_0x4dfa('0x69')],{'as':'ChatInteractions','foreignKey':_0x4dfa('0x122')});db['User'][_0x4dfa('0x124')](db['SmsInteraction'],{'as':_0x4dfa('0x12d'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['MailInteraction'],{'as':_0x4dfa('0x12e'),'foreignKey':_0x4dfa('0x122')});db['User']['hasMany'](db[_0x4dfa('0x10f')],{'as':'WhatsappInteractions','foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db['UserNotification'],{'as':_0x4dfa('0x12f'),'foreignKey':'SenderId'});db[_0x4dfa('0x13')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':_0x4dfa('0x130'),'foreignKey':'UserId','onDelete':_0x4dfa('0x131')});db[_0x4dfa('0x13')]['belongsTo'](db[_0x4dfa('0x132')],{'as':_0x4dfa('0x132'),'foreignKey':_0x4dfa('0x133')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x6f')],{'as':_0x4dfa('0x135'),'through':_0x4dfa('0x136')});db['User']['belongsToMany'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'through':_0x4dfa('0x138')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x13a'),'through':_0x4dfa('0x13b')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x13c')});db['User']['belongsToMany'](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x12e'),'through':_0x4dfa('0x13d')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x69')],{'as':_0x4dfa('0x13e'),'through':_0x4dfa('0x13f')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db['FaxInteraction'],{'as':_0x4dfa('0x140'),'through':_0x4dfa('0x141')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x5a')],{'as':_0x4dfa('0x12d'),'through':_0x4dfa('0x142')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x4dfa('0x143'),'through':_0x4dfa('0x144')});db['User']['belongsToMany'](db[_0x4dfa('0x10f')],{'as':_0x4dfa('0x145'),'through':_0x4dfa('0x146')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x147'),'through':'UserVoiceQueue','required':![]});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x106')],{'as':'VoicePrefixes','through':_0x4dfa('0x11b'),'required':![]});db['User'][_0x4dfa('0x134')](db['MailQueue'],{'as':_0x4dfa('0x148'),'through':_0x4dfa('0x34'),'required':![]});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x6e')],{'as':_0x4dfa('0x149'),'through':_0x4dfa('0x32'),'required':![],'hooks':!![]});db[_0x4dfa('0x13')]['belongsToMany'](db[_0x4dfa('0x14a')],{'as':_0x4dfa('0x14b'),'through':_0x4dfa('0x36'),'required':![]});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x5d')],{'as':_0x4dfa('0x14c'),'through':_0x4dfa('0x14d'),'required':![]});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x4dfa('0x38'),'required':![]});db[_0x4dfa('0x13')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x4dfa('0x14e'),'through':_0x4dfa('0x3a'),'required':![]});db['User']['belongsToMany'](db[_0x4dfa('0x139')],{'through':'cm_user_has_lists'});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x14f'),'through':_0x4dfa('0x150')});db['User'][_0x4dfa('0x134')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x151'),'through':_0x4dfa('0x152')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x40')],{'as':'MailAccounts','through':_0x4dfa('0x153')});db[_0x4dfa('0x13')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x4dfa('0x154'),'through':'user_has_openchannel_accounts'});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x156'),'through':_0x4dfa('0x157')});db[_0x4dfa('0x13')][_0x4dfa('0x134')](db[_0x4dfa('0x158')],{'as':_0x4dfa('0x159'),'through':'user_has_whatsapp_accounts'});db[_0x4dfa('0x15')]['hasMany'](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x15a'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x15b')});db[_0x4dfa('0x17')][_0x4dfa('0x124')](db[_0x4dfa('0x1a')],{'onDelete':'cascade'});db[_0x4dfa('0x1a')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':_0x4dfa('0x15c'),'onDelete':_0x4dfa('0x121')});db['VoiceMusicOnHold'][_0x4dfa('0x134')](db['Sound'],{'as':_0x4dfa('0x15d'),'through':_0x4dfa('0x15e')});db['VoiceQueue'][_0x4dfa('0x124')](db[_0x4dfa('0x126')],{'as':_0x4dfa('0x15f'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x4dfa('0x7b')],{'as':'HopperFinals','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db['ReportAgentPreview'],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x124')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')]['hasMany'](db[_0x4dfa('0xe0')],{'as':'JscriptySessions','foreignKey':_0x4dfa('0x160')});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk','foreignKey':_0x4dfa('0x164')});db['VoiceQueue']['belongsTo'](db[_0x4dfa('0x163')],{'as':_0x4dfa('0x165'),'foreignKey':'TrunkBackupId'});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db['Interval'],{'as':_0x4dfa('0x88'),'foreignKey':'IntervalId'});db[_0x4dfa('0x1e')][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x1e')][_0x4dfa('0x134')](db['CmList'],{'as':'Lists','through':_0x4dfa('0x168')});db['VoiceQueue'][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x31')});db[_0x4dfa('0x1e')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'as':_0x4dfa('0x16a'),'through':_0x4dfa('0x117')});db['VoiceQueue'][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x16b'),'through':_0x4dfa('0x16c')});db[_0x4dfa('0x20')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x22')][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x13'),'foreignKey':_0x4dfa('0x122')});db['VoiceMail'][_0x4dfa('0x124')](db[_0x4dfa('0x16d')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':'mailboxuser','sourceKey':_0x4dfa('0x16f')});db[_0x4dfa('0x16d')][_0x4dfa('0x162')](db['VoiceMail'],{'foreignKey':_0x4dfa('0x170'),'targetKey':_0x4dfa('0x16f')});db[_0x4dfa('0x171')][_0x4dfa('0x124')](db['VoiceQueueReport'],{'as':_0x4dfa('0x172'),'foreignKey':_0x4dfa('0x173'),'constraints':![]});db[_0x4dfa('0x171')][_0x4dfa('0x124')](db[_0x4dfa('0x2a')],{'as':_0x4dfa('0x174'),'foreignKey':_0x4dfa('0x173'),'constraints':![]});db[_0x4dfa('0x171')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13'),'foreignKey':'UserId'});db[_0x4dfa('0x171')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x3c')]['belongsTo'](db[_0x4dfa('0x40')],{'as':_0x4dfa('0x40'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x3c')][_0x4dfa('0x162')](db[_0x4dfa('0x177')],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x4dfa('0x40'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x3e')]['belongsTo'](db['CloudProvider'],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x40')][_0x4dfa('0x120')](db[_0x4dfa('0x3c')],{'as':_0x4dfa('0x17a'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x40')][_0x4dfa('0x120')](db[_0x4dfa('0x3e')],{'as':_0x4dfa('0x17b'),'onDelete':'cascade'});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':_0x4dfa('0x176'),'onDelete':'cascade'});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':_0x4dfa('0x176')});db['MailAccount'][_0x4dfa('0x124')](db['MailMessage'],{'as':'Messages','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x40')][_0x4dfa('0x124')](db['MailInteraction'],{'as':_0x4dfa('0x17e')});db['MailAccount']['hasMany'](db[_0x4dfa('0x49')],{'as':_0x4dfa('0x15c'),'foreignKey':'MailAccountId','onDelete':_0x4dfa('0x121')});db['MailAccount'][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db[_0x4dfa('0x40')][_0x4dfa('0x162')](db[_0x4dfa('0x180')],{'as':_0x4dfa('0x180'),'foreignKey':_0x4dfa('0x181')});db[_0x4dfa('0x40')][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x40')]['belongsToMany'](db['User'],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x153')});db[_0x4dfa('0x41')][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x169'),'through':'UserMailQueue'});db[_0x4dfa('0x41')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x182'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x45')]['hasMany'](db[_0x4dfa('0x47')],{'as':'Messages','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x183')});db['MailInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'as':'Account','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x45')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x45')][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x185'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x4dfa('0x45')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x13d'),'foreignKey':'MailInteractionId'});db[_0x4dfa('0x47')][_0x4dfa('0x124')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0x187'),'onDelete':_0x4dfa('0x121')});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x183')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x47')][_0x4dfa('0x162')](db['ChatWebsite'],{'as':_0x4dfa('0x64'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x6d')],{'as':'ChatOfflineMessage','foreignKey':_0x4dfa('0x18a')});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['MailApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x41')],{'onDelete':'restrict'});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db['MailAccount'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x49')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['MailApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18c')});db['MailQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db['MailQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x4b')][_0x4dfa('0x162')](db[_0x4dfa('0x45')],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x47')],{});db[_0x4dfa('0x4b')][_0x4dfa('0x162')](db['User'],{});db[_0x4dfa('0x4b')]['belongsTo'](db[_0x4dfa('0x41')],{});db[_0x4dfa('0x4d')][_0x4dfa('0x124')](db[_0x4dfa('0x4f')],{'as':_0x4dfa('0x18f'),'onDelete':_0x4dfa('0x121')});db['FaxAccount']['hasMany'](db[_0x4dfa('0x84')],{'as':_0x4dfa('0x17c'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':_0x4dfa('0x190')});db[_0x4dfa('0x50')][_0x4dfa('0x124')](db['FaxInteraction'],{'as':'Interactions'});db[_0x4dfa('0x50')][_0x4dfa('0x124')](db['FaxApplication'],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x190'),'onDelete':_0x4dfa('0x121')});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x1a')],{'as':_0x4dfa('0x191'),'onDelete':'cascade'});db['FaxAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x54')],{'as':'Messages'});db[_0x4dfa('0x50')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk'});db[_0x4dfa('0x50')]['belongsTo'](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x50')][_0x4dfa('0x162')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x50')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x152')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['FaxApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x14a')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db['FaxAccount'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x52')][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x192')][_0x4dfa('0x124')](db[_0x4dfa('0x54')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4dfa('0x193')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x190')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x192')][_0x4dfa('0x162')](db['User'],{'as':'Owner','foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x192')][_0x4dfa('0x134')](db['Tag'],{'through':_0x4dfa('0x194'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x4dfa('0x91')],{'through':'fax_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x192')][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x196'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':'cascade','as':_0x4dfa('0x13')});db['FaxMessage'][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{'as':'Interaction','foreignKey':_0x4dfa('0x193')});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db['Attachment'],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db[_0x4dfa('0x54')][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'as':_0x4dfa('0x189'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x36')});db[_0x4dfa('0x14a')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x198'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x50')],{});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{});db[_0x4dfa('0x199')][_0x4dfa('0x162')](db['FaxMessage'],{});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x199')]['belongsTo'](db[_0x4dfa('0x14a')],{});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'SmsAccountId','onDelete':_0x4dfa('0x121')});db['SmsAccount']['hasMany'](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x19a')});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db[_0x4dfa('0x5b')],{'as':'Messages','foreignKey':_0x4dfa('0x19a')});db['SmsAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x5a')],{'as':'Interactions'});db[_0x4dfa('0x155')][_0x4dfa('0x124')](db[_0x4dfa('0x58')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x19a'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x155')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db['SmsAccount'][_0x4dfa('0x162')](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x155')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x157')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x5d')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x58')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db[_0x4dfa('0x58')]['belongsTo'](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x5a')][_0x4dfa('0x124')](db[_0x4dfa('0x5b')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19a')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x5a')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x5a')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x19c'),'as':'Tags'});db['SmsInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x19c'),'as':_0x4dfa('0x195')});db[_0x4dfa('0x5a')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x142'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5b')]['belongsTo'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x13')});db[_0x4dfa('0x5b')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x18e')});db[_0x4dfa('0x5b')][_0x4dfa('0x162')](db[_0x4dfa('0x5a')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x19b')});db[_0x4dfa('0x5b')]['belongsTo'](db[_0x4dfa('0x155')],{'as':_0x4dfa('0x189'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x4dfa('0x5d')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x19d'),'as':_0x4dfa('0x16a')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x84')],{'as':'Dispositions','foreignKey':_0x4dfa('0x19f'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')]['hasMany'](db[_0x4dfa('0x12c')],{'as':'Interactions','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x19e')][_0x4dfa('0x124')](db[_0x4dfa('0x60')],{'as':'Applications','foreignKey':_0x4dfa('0x19f'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x19e')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x19e')]['belongsTo'](db['Pause'],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db[_0x4dfa('0x19e')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x1a0')});db[_0x4dfa('0x60')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x62')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x1a1')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x60')][_0x4dfa('0x162')](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['OpenchannelApplication'][_0x4dfa('0x162')](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18c')});db['OpenchannelInteraction'][_0x4dfa('0x124')](db['OpenchannelMessage'],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1a2')});db['OpenchannelInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19f')});db['OpenchannelInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0x12c')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1a3'),'as':'Tags'});db['OpenchannelInteraction'][_0x4dfa('0x134')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x12c')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x144'),'foreignKey':_0x4dfa('0x1a2')});db[_0x4dfa('0x1a4')]['belongsTo'](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x121'),'as':'User'});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'onDelete':'cascade','as':_0x4dfa('0x18e')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x1a2')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db[_0x4dfa('0x1a4')][_0x4dfa('0x162')](db[_0x4dfa('0x19e')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x19f')});db[_0x4dfa('0x62')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x38'),'foreignKey':'OpenchannelQueueId'});db[_0x4dfa('0x62')]['belongsToMany'](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x1a5'),'as':'Teams'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x83')],{'as':_0x4dfa('0x17d'),'foreignKey':'ChatWebsiteId'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x71')],{'as':'ProactiveActions'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4dfa('0x64')][_0x4dfa('0x124')](db[_0x4dfa('0x68')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x1a6'),'onDelete':_0x4dfa('0x121')});db['ChatWebsite'][_0x4dfa('0x124')](db[_0x4dfa('0x6b')],{'as':_0x4dfa('0x16e')});db[_0x4dfa('0x64')][_0x4dfa('0x162')](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db[_0x4dfa('0x64')][_0x4dfa('0x162')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x4dfa('0x64')]['belongsTo'](db[_0x4dfa('0x40')],{'as':'MailAccount','foreignKey':_0x4dfa('0x176')});db[_0x4dfa('0x64')]['belongsTo'](db[_0x4dfa('0x89')],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db['ChatWebsite'][_0x4dfa('0x134')](db['User'],{'as':_0x4dfa('0x169'),'through':'user_has_chat_websites'});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db['OpenchannelAccount'],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db['OpenchannelQueueReport'][_0x4dfa('0x162')](db['CmContact'],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{});db['OpenchannelQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x1a4')],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x66')][_0x4dfa('0x162')](db[_0x4dfa('0x62')],{});db[_0x4dfa('0x68')]['belongsTo'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x1a7'),'foreignKey':_0x4dfa('0x122'),'onDelete':'restrict'});db[_0x4dfa('0x68')]['belongsTo'](db[_0x4dfa('0x6e')],{'as':'Queue','foreignKey':_0x4dfa('0x1a8'),'onDelete':_0x4dfa('0x179')});db['ChatApplication']['belongsTo'](db[_0x4dfa('0x64')],{'as':'Website','foreignKey':_0x4dfa('0x1a6'),'onDelete':'restrict'});db[_0x4dfa('0x68')][_0x4dfa('0x162')](db['Tag'],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x69')][_0x4dfa('0x124')](db[_0x4dfa('0x6b')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1a9')});db[_0x4dfa('0x69')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1a6')});db[_0x4dfa('0x69')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db['ChatInteraction'][_0x4dfa('0x162')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4dfa('0x69')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1aa'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x69')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1aa'),'as':_0x4dfa('0x195')});db[_0x4dfa('0x69')]['belongsToMany'](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x13f'),'foreignKey':_0x4dfa('0x1a9')});db['ChatMessage'][_0x4dfa('0x162')](db['User'],{'onDelete':'cascade','as':_0x4dfa('0x13')});db[_0x4dfa('0x6b')]['belongsTo'](db[_0x4dfa('0x75')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x4dfa('0x6b')][_0x4dfa('0x162')](db[_0x4dfa('0x69')],{'onDelete':_0x4dfa('0x121'),'as':_0x4dfa('0x188'),'foreignKey':_0x4dfa('0x1a9')});db[_0x4dfa('0x6b')][_0x4dfa('0x162')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0xfa'),'foreignKey':_0x4dfa('0x197')});db['ChatMessage'][_0x4dfa('0x162')](db['ChatWebsite'],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1a6')});db[_0x4dfa('0x6d')][_0x4dfa('0x124')](db[_0x4dfa('0xfa')],{'as':_0x4dfa('0x187'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x6d')][_0x4dfa('0x162')](db['CmContact'],{'onDelete':_0x4dfa('0x121'),'as':'Contact','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x6d')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4dfa('0x6e')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x4dfa('0x6e')][_0x4dfa('0x134')](db[_0x4dfa('0xf2')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x4dfa('0x6f')][_0x4dfa('0x124')](db[_0x4dfa('0x1ab')],{'as':_0x4dfa('0x16e'),'foreignKey':_0x4dfa('0x1ac'),'onDelete':'cascade'});db[_0x4dfa('0x6f')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x15f'),'through':_0x4dfa('0x136')});db[_0x4dfa('0x71')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'as':_0x4dfa('0x1ad'),'foreignKey':_0x4dfa('0x1a6')});db['CmCompany'][_0x4dfa('0x124')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'foreignKey':_0x4dfa('0x1ae')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x95')],{'as':'Phones','foreignKey':_0x4dfa('0x1af')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x77')],{'as':_0x4dfa('0x130'),'foreignKey':_0x4dfa('0x175')});db['CmContact']['hasMany'](db[_0x4dfa('0x7b')],{'as':'HopperFinals','foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x175')});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0xe0')],{'as':_0x4dfa('0x1b0'),'foreignKey':_0x4dfa('0x175')});db['CmContact'][_0x4dfa('0x124')](db[_0x4dfa('0x12c')],{'as':_0x4dfa('0x143'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db['CmContact'][_0x4dfa('0x124')](db[_0x4dfa('0x69')],{'as':_0x4dfa('0x13e'),'foreignKey':_0x4dfa('0x175'),'onDelete':'restrict'});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x5a')],{'as':_0x4dfa('0x12d'),'foreignKey':_0x4dfa('0x175'),'onDelete':'restrict'});db[_0x4dfa('0x75')][_0x4dfa('0x124')](db[_0x4dfa('0x192')],{'as':_0x4dfa('0x140'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x75')]['hasMany'](db[_0x4dfa('0x45')],{'as':_0x4dfa('0x12e'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x179')});db['CmContact'][_0x4dfa('0x162')](db['CmCompany'],{'as':'Company','foreignKey':_0x4dfa('0x1ae')});db['CmContact'][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x75')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x196'),'through':_0x4dfa('0x138')});db[_0x4dfa('0x75')]['belongsToMany'](db['Tag'],{'as':_0x4dfa('0x186'),'through':_0x4dfa('0x1b1')});db['CmContact'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':'cm_contact_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x77')][_0x4dfa('0x124')](db[_0x4dfa('0x1b2')],{'as':_0x4dfa('0x1b3'),'foreignKey':_0x4dfa('0x1b4')});db[_0x4dfa('0x77')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x77')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':_0x4dfa('0x18d'),'onDelete':_0x4dfa('0x121')});db['CmHopper'][_0x4dfa('0x162')](db['User'],{'as':_0x4dfa('0x1a7'),'foreignKey':_0x4dfa('0x122')});db[_0x4dfa('0x77')]['belongsTo'](db['VoiceQueue'],{'as':_0x4dfa('0x1b5'),'foreignKey':_0x4dfa('0x160'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x77')]['belongsTo'](db['Campaign'],{'as':_0x4dfa('0xf6'),'foreignKey':_0x4dfa('0x1b6'),'onDelete':'cascade'});db['CmHopper'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':_0x4dfa('0x175'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x79')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d'),'onDelete':'cascade'});db['CmHopperBlack'][_0x4dfa('0x162')](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x1b5'),'foreignKey':_0x4dfa('0x160'),'onDelete':_0x4dfa('0x121')});db['CmHopperBlack'][_0x4dfa('0x162')](db[_0x4dfa('0xf6')],{'as':_0x4dfa('0xf6'),'foreignKey':_0x4dfa('0x1b6'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x1b7')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1b8'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1b7')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db['Automation'][_0x4dfa('0x124')](db['Action'],{'as':_0x4dfa('0x1b9'),'foreignKey':'AutomationId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db['Disposition'][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':_0x4dfa('0x1ba'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['Interval'],{'as':_0x4dfa('0x1bb'),'foreignKey':'IntervalId','onDelete':_0x4dfa('0x121'),'hooks':!![],'required':![]});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x4dfa('0x18b')});db['Interval'][_0x4dfa('0x124')](db[_0x4dfa('0x68')],{'as':_0x4dfa('0x1bc'),'foreignKey':_0x4dfa('0x18b')});db['Interval']['hasMany'](db[_0x4dfa('0x52')],{'as':_0x4dfa('0x1bd'),'foreignKey':_0x4dfa('0x18b')});db[_0x4dfa('0x88')][_0x4dfa('0x124')](db[_0x4dfa('0x58')],{'as':'SmsApplications','foreignKey':_0x4dfa('0x18b')});db['Schedule'][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{});db[_0x4dfa('0x1be')]['belongsTo'](db[_0x4dfa('0x9f')],{'foreignKey':_0x4dfa('0x1bf')});db[_0x4dfa('0x1be')][_0x4dfa('0x162')](db[_0x4dfa('0x9d')],{'foreignKey':'CustomReportId'});db[_0x4dfa('0x8f')][_0x4dfa('0x134')](db[_0x4dfa('0x1c')],{'as':'Mohs','through':_0x4dfa('0x15e'),'onDelete':_0x4dfa('0x179')});db['Tag']['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x69')],{'through':_0x4dfa('0x1aa')});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db['MailInteraction'],{'through':_0x4dfa('0x185')});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x5a')],{'through':_0x4dfa('0x19c')});db[_0x4dfa('0x91')]['belongsToMany'](db[_0x4dfa('0x192')],{'through':_0x4dfa('0x194')});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x4dfa('0x91')][_0x4dfa('0x134')](db[_0x4dfa('0x10f')],{'through':_0x4dfa('0x1c0')});db['CmContactHasItem'][_0x4dfa('0x162')](db[_0x4dfa('0x93')],{'as':_0x4dfa('0x1c1'),'foreignKey':_0x4dfa('0x1c2')});db[_0x4dfa('0x1b2')][_0x4dfa('0x162')](db[_0x4dfa('0x77')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x4dfa('0x95')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x1af')});db[_0x4dfa('0x1c3')][_0x4dfa('0x124')](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1c4'),'singular':_0x4dfa('0x1c5')},'foreignKey':_0x4dfa('0x1c6'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1c3')]['hasMany'](db[_0x4dfa('0x86')],{'as':{'plural':_0x4dfa('0x1c7'),'singular':_0x4dfa('0x1c8')},'foreignKey':'TriggerAnyId','onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x1c3')][_0x4dfa('0x124')](db['Action'],{'as':_0x4dfa('0x1b9'),'foreignKey':_0x4dfa('0x1c9'),'onDelete':_0x4dfa('0x121'),'hooks':!![]});db[_0x4dfa('0x9d')][_0x4dfa('0x124')](db[_0x4dfa('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x4dfa('0x9f')][_0x4dfa('0x124')](db[_0x4dfa('0xa4')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1bf')});db['AnalyticMetric'][_0x4dfa('0x124')](db['AnalyticFieldReport'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cb')});db[_0x4dfa('0xa4')][_0x4dfa('0x162')](db[_0x4dfa('0xa2')],{'foreignKey':_0x4dfa('0x1cb')});db[_0x4dfa('0xa8')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['SalesforceConfiguration']['hasMany'](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xaa')][_0x4dfa('0x124')](db['SalesforceField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xaa')][_0x4dfa('0x124')](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4dfa('0x1d3')});db['SalesforceConfiguration'][_0x4dfa('0x162')](db[_0x4dfa('0xa8')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0x1ce')]['hasMany'](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1ce')]['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1ce')][_0x4dfa('0x124')](db[_0x4dfa('0x1ce')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0x1ce')]['belongsTo'](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xad')][_0x4dfa('0x124')](db[_0x4dfa('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db[_0x4dfa('0x1d6')],{'as':_0x4dfa('0x1cf'),'onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db['SugarcrmField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xaf')][_0x4dfa('0x124')](db['SugarcrmField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0xaf')][_0x4dfa('0x162')](db[_0x4dfa('0xad')],{'as':'Account','foreignKey':_0x4dfa('0x1cd')});db['SugarcrmField'][_0x4dfa('0x124')](db[_0x4dfa('0x1d6')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1d6')]['hasMany'](db['SugarcrmField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db['SugarcrmField'][_0x4dfa('0x124')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x4dfa('0x1d6')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xb0')][_0x4dfa('0x124')](db[_0x4dfa('0x1d8')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':'AccountId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db[_0x4dfa('0xb3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1d8')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x162')](db['DeskAccount'],{'as':_0x4dfa('0x189'),'foreignKey':'AccountId'});db[_0x4dfa('0x1d8')][_0x4dfa('0x134')](db['Tag'],{'through':_0x4dfa('0x1d9')});db['DeskField']['hasMany'](db[_0x4dfa('0xb3')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xb3')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xb3')][_0x4dfa('0x124')](db['DeskField'],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xb3')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xb5')][_0x4dfa('0x124')](db[_0x4dfa('0xb7')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xb7')][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1cf'),'onDelete':'cascade','foreignKey':_0x4dfa('0x1d0')});db['ZohoConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':'FieldId'});db[_0x4dfa('0xb7')][_0x4dfa('0x162')](db[_0x4dfa('0xb5')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['ZohoField'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xb9')][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x4dfa('0x124')](db[_0x4dfa('0xb9')],{'as':_0x4dfa('0x1d5'),'foreignKey':'FieldId'});db[_0x4dfa('0xb9')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xbb')][_0x4dfa('0x124')](db[_0x4dfa('0xbc')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1cf'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xbc')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':'Fields','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xbc')][_0x4dfa('0x162')](db[_0x4dfa('0xbb')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xbc')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1da')});db[_0x4dfa('0xbe')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d4'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x4dfa('0x124')](db['ZendeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xbe')][_0x4dfa('0x124')](db[_0x4dfa('0xbe')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['ZendeskField'][_0x4dfa('0x162')](db['Variable'],{'as':_0x4dfa('0x99'),'foreignKey':'VariableId'});db[_0x4dfa('0xc0')][_0x4dfa('0x124')](db[_0x4dfa('0xc1')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc1')]['hasMany'](db['FreshdeskField'],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc1')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc1')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xc1')][_0x4dfa('0x162')](db[_0x4dfa('0xc0')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc1')][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1db')});db[_0x4dfa('0xc3')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc3')][_0x4dfa('0x124')](db['FreshdeskField'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc3')]['hasMany'](db[_0x4dfa('0xc3')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['FreshdeskField'][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0xc5')][_0x4dfa('0x124')](db[_0x4dfa('0x1dd')],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['VtigerConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1cf'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0x1dd')]['hasMany'](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0x1dd')]['hasMany'](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1ca'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0x1dd')][_0x4dfa('0x162')](db[_0x4dfa('0xc5')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db['VtigerField'],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xc8')][_0x4dfa('0x124')](db[_0x4dfa('0xc8')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db['VtigerField'][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0x1de')][_0x4dfa('0x124')](db[_0x4dfa('0xcb')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xcb')][_0x4dfa('0x124')](db['ServicenowField'],{'as':_0x4dfa('0x1cf'),'foreignKey':'SubjectId'});db[_0x4dfa('0xcb')][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db['ServicenowConfiguration'][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':'Fields','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcb')][_0x4dfa('0x162')](db['ServicenowAccount'],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['ServicenowField'][_0x4dfa('0x124')](db[_0x4dfa('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4dfa('0xcd')][_0x4dfa('0x124')](db['ServicenowField'],{'as':'Description','foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xcd')][_0x4dfa('0x124')](db['ServicenowField'],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcd')][_0x4dfa('0x162')](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0x1df')][_0x4dfa('0x124')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db['Dynamics365Account'][_0x4dfa('0x162')](db[_0x4dfa('0x177')],{'as':_0x4dfa('0x177'),'foreignKey':_0x4dfa('0x178')});db[_0x4dfa('0xcf')][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1cf'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d0')});db['Dynamics365Configuration'][_0x4dfa('0x124')](db['Dynamics365Field'],{'as':_0x4dfa('0x1d1'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d2')});db['Dynamics365Configuration'][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1ca'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xcf')][_0x4dfa('0x162')](db[_0x4dfa('0x1df')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x1cd')});db['Dynamics365Field'][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1d4'),'foreignKey':_0x4dfa('0x1d0')});db['Dynamics365Field'][_0x4dfa('0x124')](db['Dynamics365Field'],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd1')][_0x4dfa('0x124')](db[_0x4dfa('0xd1')],{'as':_0x4dfa('0x1d5'),'foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xd1')][_0x4dfa('0x162')](db['Variable'],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db['FreshsalesAccount']['hasMany'](db[_0x4dfa('0xd5')],{'as':_0x4dfa('0x1cc'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1cd')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':'Subjects','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db['FreshsalesField'],{'as':_0x4dfa('0x1d1'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd5')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':_0x4dfa('0x1ca'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x4dfa('0x162')](db[_0x4dfa('0xd3')],{'as':_0x4dfa('0x189'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':'Subject','foreignKey':_0x4dfa('0x1d0')});db[_0x4dfa('0xd7')][_0x4dfa('0x124')](db[_0x4dfa('0xd7')],{'as':_0x4dfa('0x1d7'),'foreignKey':_0x4dfa('0x1d2')});db[_0x4dfa('0xd7')][_0x4dfa('0x124')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x4dfa('0x1d3')});db[_0x4dfa('0xd7')]['belongsTo'](db[_0x4dfa('0x99')],{'as':_0x4dfa('0x99'),'foreignKey':_0x4dfa('0x1dc')});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x69')],{});db[_0x4dfa('0xdb')]['belongsTo'](db['ChatMessage'],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0xdb')][_0x4dfa('0x162')](db[_0x4dfa('0x6e')],{});db[_0x4dfa('0x1ab')][_0x4dfa('0x162')](db['User'],{'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1e0')});db['ChatInternalMessage']['belongsTo'](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x1e1')});db[_0x4dfa('0xe0')]['hasMany'](db[_0x4dfa('0x1e2')],{'foreignKey':_0x4dfa('0x1e3'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0xe0')]['hasMany'](db[_0x4dfa('0xde')],{'foreignKey':_0x4dfa('0x1e3'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{});db[_0x4dfa('0xe2')]['belongsTo'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x17f'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x4dfa('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4dfa('0xe2')]['belongsTo'](db[_0x4dfa('0x5a')],{});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db['SmsMessage'],{});db[_0x4dfa('0xe2')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0xe2')]['belongsTo'](db['SmsQueue'],{});db[_0x4dfa('0xe8')][_0x4dfa('0x124')](db['JscriptySessionReport'],{'foreignKey':_0x4dfa('0x1e4')});db['JscriptyProject'][_0x4dfa('0x124')](db[_0x4dfa('0x1e2')],{'foreignKey':_0x4dfa('0x1e4')});db[_0x4dfa('0xe8')][_0x4dfa('0x124')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':'user_has_teams'});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x1e')],{'through':_0x4dfa('0x117'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x4dfa('0x182'),'as':'MailQueues'});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x6e')],{'through':_0x4dfa('0x1e5'),'as':_0x4dfa('0x149')});db[_0x4dfa('0xf2')]['belongsToMany'](db[_0x4dfa('0x14a')],{'through':_0x4dfa('0x198'),'as':_0x4dfa('0x14b')});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x5d')],{'through':_0x4dfa('0x19d'),'as':_0x4dfa('0x14c')});db[_0x4dfa('0xf2')][_0x4dfa('0x134')](db[_0x4dfa('0x62')],{'through':_0x4dfa('0x1a5'),'as':_0x4dfa('0x1e6')});db['Team'][_0x4dfa('0x134')](db[_0x4dfa('0x1e7')],{'through':_0x4dfa('0x1e8'),'as':_0x4dfa('0x14e')});db[_0x4dfa('0xf2')]['belongsToMany'](db['VoicePrefix'],{'through':_0x4dfa('0x119'),'as':_0x4dfa('0x1e9')});db[_0x4dfa('0xf6')]['hasMany'](db['CmHopper'],{'as':_0x4dfa('0x130'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x124')](db[_0x4dfa('0x12a')],{'as':_0x4dfa('0x161'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x124')](db['CmHopperBlack'],{'as':_0x4dfa('0x1ea'),'foreignKey':_0x4dfa('0x1b6')});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db[_0x4dfa('0x163')],{'as':'Trunk','foreignKey':_0x4dfa('0x164')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x4dfa('0x165'),'foreignKey':'TrunkBackupId'});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db['Interval'],{'as':_0x4dfa('0x88'),'foreignKey':'IntervalId'});db[_0x4dfa('0xf6')][_0x4dfa('0x162')](db[_0x4dfa('0xec')],{'as':_0x4dfa('0xec'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x13a'),'through':_0x4dfa('0x1eb')});db[_0x4dfa('0xf6')][_0x4dfa('0x134')](db[_0x4dfa('0x139')],{'as':_0x4dfa('0x16b'),'through':'campaigns_has_cm_blacklists'});db[_0x4dfa('0xfa')][_0x4dfa('0x162')](db[_0x4dfa('0x6d')],{'as':_0x4dfa('0x6d'),'foreignKey':_0x4dfa('0x18a')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x47')],{});db['MailTransferReport'][_0x4dfa('0x162')](db['MailInteraction'],{});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'foreignKey':'FromMailAccountId','as':_0x4dfa('0x1ed')});db[_0x4dfa('0x1ec')]['belongsTo'](db['User'],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db['User'],{'foreignKey':_0x4dfa('0x1f0'),'as':_0x4dfa('0x1f1')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x41')],{'foreignKey':_0x4dfa('0x1f2'),'as':_0x4dfa('0x1f3')});db[_0x4dfa('0x1ec')][_0x4dfa('0x162')](db[_0x4dfa('0x40')],{'foreignKey':_0x4dfa('0x1f4'),'as':_0x4dfa('0x1f5')});db['ChatTransferReport'][_0x4dfa('0x162')](db['ChatMessage'],{});db[_0x4dfa('0xfe')]['belongsTo'](db[_0x4dfa('0x69')],{});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db[_0x4dfa('0x64')],{'foreignKey':_0x4dfa('0x1f6'),'as':_0x4dfa('0x1ed')});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db['ChatTransferReport'][_0x4dfa('0x162')](db['User'],{'foreignKey':_0x4dfa('0x1f0'),'as':_0x4dfa('0x1f1')});db[_0x4dfa('0xfe')][_0x4dfa('0x162')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x4dfa('0x1f3')});db[_0x4dfa('0xfe')]['belongsTo'](db[_0x4dfa('0x64')],{'foreignKey':_0x4dfa('0x1f7'),'as':_0x4dfa('0x1f5')});db['FaxTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x54')],{});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x192')],{});db['FaxTransferReport'][_0x4dfa('0x162')](db['FaxAccount'],{'foreignKey':_0x4dfa('0x1f8'),'as':_0x4dfa('0x1ed')});db[_0x4dfa('0x100')]['belongsTo'](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x100')][_0x4dfa('0x162')](db[_0x4dfa('0x14a')],{'foreignKey':_0x4dfa('0x1f9'),'as':'ToQueue'});db['FaxTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x50')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x1a4')],{});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db[_0x4dfa('0x12c')],{});db[_0x4dfa('0x102')]['belongsTo'](db[_0x4dfa('0x19e')],{'foreignKey':_0x4dfa('0x1fa'),'as':'FromAccount'});db[_0x4dfa('0x102')]['belongsTo'](db['User'],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':'ToUserId','as':_0x4dfa('0x1f1')});db[_0x4dfa('0x102')][_0x4dfa('0x162')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x4dfa('0x1f3')});db['OpenchannelTransferReport'][_0x4dfa('0x162')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x4dfa('0x1f5')});db['SmsTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x5b')],{});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db['SmsInteraction'],{});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db['SmsAccount'],{'foreignKey':_0x4dfa('0x1fc'),'as':'FromAccount'});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db['SmsTransferReport'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x5d')],{'foreignKey':_0x4dfa('0x1fd'),'as':_0x4dfa('0x1f3')});db[_0x4dfa('0x1fb')][_0x4dfa('0x162')](db[_0x4dfa('0x155')],{'foreignKey':_0x4dfa('0x1fe'),'as':_0x4dfa('0x1f5')});db[_0x4dfa('0x139')][_0x4dfa('0x124')](db['Disposition'],{'as':_0x4dfa('0x17c'),'foreignKey':'ListId','onDelete':'cascade'});db['CmList']['hasMany'](db[_0x4dfa('0x7f')],{'as':_0x4dfa('0x1ff'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x137'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x7b')],{'as':_0x4dfa('0x129'),'foreignKey':_0x4dfa('0x18d')});db['CmList'][_0x4dfa('0x124')](db['CmHopperHistory'],{'as':_0x4dfa('0x12b'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['hasMany'](db[_0x4dfa('0x7e')],{'as':_0x4dfa('0x7e'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x139')]['belongsToMany'](db[_0x4dfa('0x1e')],{'as':_0x4dfa('0x200'),'through':_0x4dfa('0x168')});db[_0x4dfa('0x139')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x13b')});db[_0x4dfa('0x106')][_0x4dfa('0x124')](db['VoiceExtension'],{'as':_0x4dfa('0x128'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x106')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x11b')});db[_0x4dfa('0x106')]['belongsToMany'](db[_0x4dfa('0xf2')],{'through':_0x4dfa('0x119'),'as':_0x4dfa('0x16a')});db['UserProfile'][_0x4dfa('0x124')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x4dfa('0x132')][_0x4dfa('0x124')](db[_0x4dfa('0x108')],{'as':_0x4dfa('0x201'),'foreignKey':_0x4dfa('0x133'),'onDelete':'cascade'});db[_0x4dfa('0x108')][_0x4dfa('0x124')](db[_0x4dfa('0x202')],{'as':_0x4dfa('0x203'),'foreignKey':_0x4dfa('0x204'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4dfa('0x205'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')]['hasMany'](db[_0x4dfa('0x83')],{'as':'Answers','foreignKey':_0x4dfa('0x205')});db['WhatsappAccount'][_0x4dfa('0x124')](db[_0x4dfa('0x111')],{'as':_0x4dfa('0x16e'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x4dfa('0x124')](db['WhatsappInteraction'],{'as':_0x4dfa('0x17e')});db[_0x4dfa('0x158')][_0x4dfa('0x124')](db[_0x4dfa('0x10d')],{'as':_0x4dfa('0x15c'),'foreignKey':_0x4dfa('0x205'),'onDelete':_0x4dfa('0x121')});db[_0x4dfa('0x158')][_0x4dfa('0x162')](db[_0x4dfa('0x139')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x4dfa('0x162')](db['Pause'],{'as':_0x4dfa('0x166'),'foreignKey':_0x4dfa('0x167')});db['WhatsappAccount']['belongsToMany'](db['User'],{'as':_0x4dfa('0x169'),'through':_0x4dfa('0x206')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db['WhatsappQueue'],{'onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x10d')][_0x4dfa('0x162')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x4dfa('0x10d')]['belongsTo'](db[_0x4dfa('0x88')],{'onDelete':_0x4dfa('0x179'),'foreignKey':_0x4dfa('0x18b')});db['WhatsappApplication']['belongsTo'](db[_0x4dfa('0x91')],{'onDelete':_0x4dfa('0x179'),'foreignKey':'TagId'});db[_0x4dfa('0x10f')]['hasMany'](db[_0x4dfa('0x111')],{'as':_0x4dfa('0x16e'),'onDelete':_0x4dfa('0x121'),'foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x10f')][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{'as':_0x4dfa('0x189'),'foreignKey':_0x4dfa('0x205')});db[_0x4dfa('0x10f')][_0x4dfa('0x162')](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x184'),'foreignKey':_0x4dfa('0x122')});db['WhatsappInteraction'][_0x4dfa('0x134')](db[_0x4dfa('0x91')],{'through':_0x4dfa('0x1c0'),'as':_0x4dfa('0x186')});db[_0x4dfa('0x10f')]['belongsToMany'](db[_0x4dfa('0x91')],{'through':'whatsapp_interaction_has_tags','as':_0x4dfa('0x195')});db[_0x4dfa('0x10f')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Users','through':_0x4dfa('0x146'),'foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0x4dfa('0x75')],{'onDelete':_0x4dfa('0x121'),'as':'Contact'});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db['WhatsappInteraction'],{'onDelete':_0x4dfa('0x121'),'as':'Interaction','foreignKey':_0x4dfa('0x207')});db[_0x4dfa('0x111')][_0x4dfa('0x162')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{});db[_0x4dfa('0x113')]['belongsTo'](db['CmList'],{'as':_0x4dfa('0x17f'),'foreignKey':_0x4dfa('0x18d')});db[_0x4dfa('0x113')]['belongsTo'](db[_0x4dfa('0x75')],{'as':_0x4dfa('0x18e'),'foreignKey':_0x4dfa('0x175')});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x10f')],{});db[_0x4dfa('0x113')][_0x4dfa('0x162')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x4dfa('0x162')](db[_0x4dfa('0x111')],{});db[_0x4dfa('0x113')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x111')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x10f')],{});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x158')],{'foreignKey':'FromWhatsappAccountId','as':_0x4dfa('0x1ed')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db['WhatsappAccount'],{'foreignKey':_0x4dfa('0x209'),'as':'ToAccount'});db[_0x4dfa('0x208')]['belongsTo'](db[_0x4dfa('0x1e7')],{'foreignKey':'ToQueueId','as':_0x4dfa('0x1f3')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1ee'),'as':_0x4dfa('0x1ef')});db[_0x4dfa('0x208')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'foreignKey':_0x4dfa('0x1f0'),'as':'ToAgent'});db[_0x4dfa('0x1e7')][_0x4dfa('0x134')](db[_0x4dfa('0x13')],{'as':'Agents','through':_0x4dfa('0x3a'),'foreignKey':_0x4dfa('0x20a')});db[_0x4dfa('0x1e7')][_0x4dfa('0x134')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x4dfa('0x16a')});db[_0x4dfa('0x11d')][_0x4dfa('0x162')](db[_0x4dfa('0x13')],{'as':_0x4dfa('0x20b'),'foreignKey':_0x4dfa('0x122'),'onDelete':'cascade','hooks':!![]});db[_0x4dfa('0x177')][_0x4dfa('0x120')](db[_0x4dfa('0x1df')],{'as':'Dynamics365Account','onDelete':_0x4dfa('0x179')});db['CloudProvider'][_0x4dfa('0x120')](db['MailServerIn'],{'as':'Imap','onDelete':_0x4dfa('0x179')});db[_0x4dfa('0x177')]['hasOne'](db[_0x4dfa('0x3e')],{'as':'Smtp','onDelete':'restrict'});module[_0x4dfa('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa095=['OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','user_has_chat_websites','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroup','CmCompany','CompanyId','Phones','FaxInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','Queue','Campaign','Automation','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','AnyConditions','AnyCondition','Action','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','Configurations','SugarcrmAccount','Description','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Account','Dynamics365Configuration','FreshsalesConfiguration','FromId','SmsQueueReport','JscriptyProject','ProjectId','JscriptyQuestionReport','TeamVoiceQueue','ChatQueues','SmsQueues','team_has_whatsapp_queues','TeamVoicePrefix','VoicePrefixes','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromUserId','FromAgent','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','xcall','utf8','utf8_general_ci','username','database','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','DashboardItem','FaxAccount','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/automation/automation.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','ContactItemType','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','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.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','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Plugin','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','VoiceRecording','Recordings','hasMany','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteraction','MailInteractions','UserNotification','UserNotifications','SenderId','CmHopper','Hoppers','SET\x20NULL','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteraction','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','FaxQueues','UserFaxQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','CannedAnswer','List','ListId','TemplateId','team_has_mail_queues','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatWebsite','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','Items','FaxAccountId','Answers','Interactions','FaxApplication','Exntensions','FaxInteractionId','AttachmentId','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId'];(function(_0x32ef56,_0x2091de){var _0x10aa2f=function(_0x505412){while(--_0x505412){_0x32ef56['push'](_0x32ef56['shift']());}};_0x10aa2f(++_0x2091de);}(_0xa095,0x7c));var _0x5a09=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xa095[_0x58ac34];return _0x3921ab;};'use strict';var config=require(_0x5a09('0x0'));var Sequelize=require(_0x5a09('0x1'));var _=require('lodash');var jstz=require(_0x5a09('0x2'));var timezone=jstz['determine']();config[_0x5a09('0x1')]=_[_0x5a09('0x3')](config[_0x5a09('0x1')],{'database':_0x5a09('0x4'),'username':'xcall','password':_0x5a09('0x5'),'options':{'host':_0x5a09('0x6'),'port':0xcea,'dialect':_0x5a09('0x7'),'dialectOptions':{'charset':_0x5a09('0x8')},'logging':![],'timezone':timezone[_0x5a09('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x5a09('0x3')](config[_0x5a09('0xa')],{'database':_0x5a09('0x4'),'username':_0x5a09('0xb'),'password':_0x5a09('0x5'),'options':{'host':_0x5a09('0x6'),'port':0xcea,'dialect':_0x5a09('0x7'),'dialectOptions':{'charset':_0x5a09('0x8')},'logging':![],'timezone':timezone[_0x5a09('0x9')](),'define':{'charset':_0x5a09('0xc'),'collate':_0x5a09('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5a09('0x1')]['database'],config[_0x5a09('0x1')][_0x5a09('0xe')],config[_0x5a09('0x1')]['password'],config[_0x5a09('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5a09('0xa')][_0x5a09('0xf')],config[_0x5a09('0xa')][_0x5a09('0xe')],config[_0x5a09('0xa')]['password'],config[_0x5a09('0xa')][_0x5a09('0x10')])};db[_0x5a09('0x11')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x13'));db[_0x5a09('0x14')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x5a09('0x15')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x16'));db[_0x5a09('0x17')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x18'));db[_0x5a09('0x19')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db['sequelize']['import'](_0x5a09('0x1a'));db['VoiceRecording']=db['sequelize'][_0x5a09('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0x5a09('0x1b')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x1c'));db[_0x5a09('0x1d')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x1e'));db[_0x5a09('0x1f')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x5a09('0x20')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0x5a09('0x21')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x22'));db[_0x5a09('0x23')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x24'));db[_0x5a09('0x25')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x26'));db['MemberReport']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x27'));db[_0x5a09('0x28')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x29'));db[_0x5a09('0x2a')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x2b'));db['UserVoiceQueueRt']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x2c'));db[_0x5a09('0x2d')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x2e'));db[_0x5a09('0x2f')]=db['sequelize'][_0x5a09('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x5a09('0x30')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x31'));db['UserFaxQueue']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x32'));db[_0x5a09('0x33')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x34'));db['UserWhatsappQueue']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x35'));db['MailServerIn']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0x5a09('0x36')]=db['sequelize']['import'](_0x5a09('0x37'));db[_0x5a09('0x38')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x39'));db[_0x5a09('0x3a')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x3b'));db[_0x5a09('0x3c')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x3d'));db['MailInteraction']=db[_0x5a09('0x1')]['import'](_0x5a09('0x3e'));db[_0x5a09('0x3f')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x40'));db[_0x5a09('0x41')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x42'));db['MailQueueReport']=db[_0x5a09('0x1')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x5a09('0x43')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/dashboard/dashboard.model');db[_0x5a09('0x44')]=db['sequelize'][_0x5a09('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x5a09('0x45')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x5a09('0x46')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x47'));db[_0x5a09('0x48')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x49'));db[_0x5a09('0x4a')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x5a09('0x4b')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x4c'));db['SmsApplication']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x4d'));db['SmsInteraction']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x4e'));db['SmsMessage']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x4f'));db[_0x5a09('0x50')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x51'));db[_0x5a09('0x52')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x5a09('0x53')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x54'));db['OpenchannelMessage']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x55'));db[_0x5a09('0x56')]=db['sequelize']['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x5a09('0x1')]['import'](_0x5a09('0x57'));db[_0x5a09('0x58')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x59'));db[_0x5a09('0x5a')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x5b'));db[_0x5a09('0x5c')]=db[_0x5a09('0x1')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x5d'));db[_0x5a09('0x5e')]=db['sequelize'][_0x5a09('0x12')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x5a09('0x1')]['import'](_0x5a09('0x5f'));db['ChatProactiveAction']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x60'));db[_0x5a09('0x61')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x62'));db[_0x5a09('0x63')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x5a09('0x64')]=db['sequelize']['import'](_0x5a09('0x65'));db[_0x5a09('0x66')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x5a09('0x67')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x68'));db['Action']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/action/action.model');db['Automation']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x69'));db['CannedAnswer']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x6a'));db[_0x5a09('0x6b')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/condition/condition.model');db[_0x5a09('0x6c')]=db['sequelize']['import'](_0x5a09('0x6d'));db[_0x5a09('0x6e')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x6f'));db['Cdr']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x70'));db[_0x5a09('0x71')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x72'));db[_0x5a09('0x73')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x74'));db[_0x5a09('0x75')]=db[_0x5a09('0x1')]['import']('../api/sound/sound.model');db['Tag']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x76'));db[_0x5a09('0x77')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/contactItemType/contactItemType.model');db[_0x5a09('0x78')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x79'));db[_0x5a09('0x7a')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x7b'));db[_0x5a09('0x7c')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x7d'));db[_0x5a09('0x7e')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x7f'));db['Variable']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x80'));db[_0x5a09('0x81')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x82'));db[_0x5a09('0x83')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/integrationReport/integrationReport.model');db[_0x5a09('0x84')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x85'));db[_0x5a09('0x86')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x87'));db['AnalyticExtractedReport']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x88'));db[_0x5a09('0x89')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x8a'));db[_0x5a09('0x8b')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x8c'));db[_0x5a09('0x8d')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x8e'));db[_0x5a09('0x8f')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x90'));db[_0x5a09('0x91')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x92'));db[_0x5a09('0x93')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x94'));db[_0x5a09('0x95')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x96'));db[_0x5a09('0x97')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x98'));db[_0x5a09('0x99')]=db['sequelize']['import'](_0x5a09('0x9a'));db[_0x5a09('0x9b')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x9c'));db[_0x5a09('0x9d')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x9e'));db['ZohoAccount']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0x9f'));db[_0x5a09('0xa0')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xa1'));db[_0x5a09('0xa2')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xa3'));db[_0x5a09('0xa4')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xa5'));db['ZendeskConfiguration']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xa6'));db[_0x5a09('0xa7')]=db[_0x5a09('0x1')]['import'](_0x5a09('0xa8'));db['FreshdeskAccount']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xa9'));db[_0x5a09('0xaa')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xab'));db[_0x5a09('0xac')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xad'));db[_0x5a09('0xae')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xaf'));db[_0x5a09('0xb0')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xb1'));db['VtigerField']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xb2'));db[_0x5a09('0xb3')]=db['sequelize'][_0x5a09('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x5a09('0xb4')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x5a09('0xb5')]=db['sequelize']['import'](_0x5a09('0xb6'));db['Dynamics365Account']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xb7'));db['Dynamics365Configuration']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xb8'));db[_0x5a09('0xb9')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xba'));db[_0x5a09('0xbb')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xbc'));db['FreshsalesConfiguration']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xbd'));db[_0x5a09('0xbe')]=db['sequelize']['import'](_0x5a09('0xbf'));db[_0x5a09('0x81')]=db['sequelize'][_0x5a09('0x12')]('../api/integration/integration.model');db[_0x5a09('0xc0')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xc1'));db[_0x5a09('0xc2')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xc3'));db[_0x5a09('0xc4')]=db[_0x5a09('0x1')]['import'](_0x5a09('0xc5'));db[_0x5a09('0xc6')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xc7'));db['JscriptyQuestionReport']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xc8'));db[_0x5a09('0xc9')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xca'));db[_0x5a09('0xcb')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/squareReport/squareReport.model');db[_0x5a09('0xcc')]=db['sequelize']['import'](_0x5a09('0xcd'));db['JscriptyProject']=db[_0x5a09('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x5a09('0xce')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xcf'));db[_0x5a09('0xd0')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xd1'));db[_0x5a09('0xd2')]=db[_0x5a09('0x1')]['import'](_0x5a09('0xd3'));db[_0x5a09('0xd4')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xd5'));db[_0x5a09('0xd6')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xd7'));db['Team']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xd8'));db[_0x5a09('0xd9')]=db[_0x5a09('0x1')]['import'](_0x5a09('0xda'));db['Campaign']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xdb'));db[_0x5a09('0xdc')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xdd'));db['Attachment']=db[_0x5a09('0x1')]['import']('../api/attachment/attachment.model');db[_0x5a09('0xde')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize']['import'](_0x5a09('0xdf'));db['ChatTransferReport']=db[_0x5a09('0x1')]['import'](_0x5a09('0xe0'));db[_0x5a09('0xe1')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xe2'));db[_0x5a09('0xe3')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xe4'));db[_0x5a09('0xe5')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xe6'));db[_0x5a09('0xe7')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xe8'));db[_0x5a09('0xe9')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xea'));db[_0x5a09('0xeb')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xec'));db[_0x5a09('0xed')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x5a09('0xee')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xef'));db['UserNotification']=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xf0'));db[_0x5a09('0xf1')]=db['sequelize'][_0x5a09('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0x5a09('0xf2')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xf3'));db[_0x5a09('0xf4')]=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xf5'));db[_0x5a09('0xf6')]=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xf7'));db['WhatsappTransferReport']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xf8'));db[_0x5a09('0xf9')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0xfa'));db['CloudProvider']=db[_0x5a09('0x1')][_0x5a09('0x12')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xfb'));db['TeamVoicePrefix']=db[_0x5a09('0x1')][_0x5a09('0x12')](_0x5a09('0xfc'));db[_0x5a09('0xfd')]=db[_0x5a09('0x1')]['import'](_0x5a09('0xfe'));db[_0x5a09('0xff')]=db['sequelize'][_0x5a09('0x12')](_0x5a09('0x100'));db[_0x5a09('0x101')]=db[_0x5a09('0x1')]['import'](_0x5a09('0x102'));db[_0x5a09('0x11')][_0x5a09('0x103')](db[_0x5a09('0x1d')],{'as':_0x5a09('0x1d'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x103')](db[_0x5a09('0xff')],{'as':'userSetting','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x105')});db['User']['hasMany'](db[_0x5a09('0x106')],{'as':_0x5a09('0x107'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x109')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0x5a09('0x108')](db[_0x5a09('0x17')],{'as':_0x5a09('0x10a'),'onDelete':_0x5a09('0x104'),'hooks':!![]});db['User'][_0x5a09('0x108')](db['CmHopperFinal'],{'as':_0x5a09('0x10b'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x66')],{'as':_0x5a09('0x10c'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x10d')],{'as':_0x5a09('0x10d'),'foreignKey':_0x5a09('0x105')});db['User']['hasMany'](db[_0x5a09('0x53')],{'as':_0x5a09('0x10e'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')]['hasMany'](db[_0x5a09('0x10f')],{'as':'ChatInteractions','foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db['SmsInteraction'],{'as':_0x5a09('0x110'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x111')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x5a09('0x11')][_0x5a09('0x108')](db['MailInteraction'],{'as':_0x5a09('0x112'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0xf4')],{'as':'WhatsappInteractions','foreignKey':_0x5a09('0x105')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x113')],{'as':_0x5a09('0x114'),'foreignKey':_0x5a09('0x115')});db[_0x5a09('0x11')][_0x5a09('0x108')](db[_0x5a09('0x116')],{'as':_0x5a09('0x117'),'foreignKey':'UserId','onDelete':_0x5a09('0x118')});db['User']['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x5a09('0x11')][_0x5a09('0x119')](db['ChatGroup'],{'as':_0x5a09('0x11a'),'through':_0x5a09('0x11b')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x61')],{'as':_0x5a09('0x11c'),'through':_0x5a09('0x11d')});db[_0x5a09('0x11')]['belongsToMany'](db[_0x5a09('0xe7')],{'as':_0x5a09('0x11e'),'through':_0x5a09('0x11f')});db['User']['belongsToMany'](db[_0x5a09('0x120')],{'through':_0x5a09('0x121')});db[_0x5a09('0x11')]['belongsToMany'](db[_0x5a09('0x122')],{'as':_0x5a09('0x112'),'through':'user_has_mail_interactions'});db['User']['belongsToMany'](db['ChatInteraction'],{'as':_0x5a09('0x123'),'through':_0x5a09('0x124')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x111')],{'as':'FaxInteractions','through':_0x5a09('0x125')});db[_0x5a09('0x11')]['belongsToMany'](db[_0x5a09('0x126')],{'as':_0x5a09('0x110'),'through':_0x5a09('0x127')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x53')],{'as':_0x5a09('0x10e'),'through':_0x5a09('0x128')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0xf4')],{'as':_0x5a09('0x129'),'through':_0x5a09('0x12a')});db['User']['belongsToMany'](db['VoiceQueue'],{'as':_0x5a09('0x12b'),'through':_0x5a09('0x2d'),'required':![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0xe9')],{'as':'VoicePrefixes','through':_0x5a09('0xfd'),'required':![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x3a')],{'as':_0x5a09('0x12c'),'through':_0x5a09('0x30'),'required':![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x5e')],{'as':'ChatQueues','through':_0x5a09('0x2f'),'required':![],'hooks':!![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x48')],{'as':_0x5a09('0x12d'),'through':_0x5a09('0x12e'),'required':![]});db['User']['belongsToMany'](db[_0x5a09('0x50')],{'as':'SmsQueues','through':_0x5a09('0x12f'),'required':![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x56')],{'as':_0x5a09('0x130'),'through':_0x5a09('0x33'),'required':![]});db[_0x5a09('0x11')][_0x5a09('0x119')](db['WhatsappQueue'],{'as':_0x5a09('0x131'),'through':_0x5a09('0x132'),'required':![]});db[_0x5a09('0x11')]['belongsToMany'](db['CmList'],{'through':_0x5a09('0x11f')});db[_0x5a09('0x11')][_0x5a09('0x119')](db['ChatWebsite'],{'as':_0x5a09('0x133'),'through':'user_has_chat_websites'});db[_0x5a09('0x11')]['belongsToMany'](db[_0x5a09('0x45')],{'as':_0x5a09('0x134'),'through':_0x5a09('0x135')});db['User'][_0x5a09('0x119')](db['MailAccount'],{'as':_0x5a09('0x136'),'through':_0x5a09('0x137')});db['User'][_0x5a09('0x119')](db[_0x5a09('0x52')],{'as':'OpenchannelAccounts','through':_0x5a09('0x138')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0x4b')],{'as':'SmsAccounts','through':_0x5a09('0x139')});db[_0x5a09('0x11')][_0x5a09('0x119')](db[_0x5a09('0xf1')],{'as':_0x5a09('0x13a'),'through':_0x5a09('0x13b')});db[_0x5a09('0x14')][_0x5a09('0x108')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x5a09('0x13c')});db[_0x5a09('0x15')]['hasMany'](db[_0x5a09('0x17')],{'onDelete':_0x5a09('0x104')});db[_0x5a09('0x17')][_0x5a09('0x108')](db['VoiceExtension'],{'as':_0x5a09('0x13d'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x19')][_0x5a09('0x119')](db[_0x5a09('0x75')],{'as':_0x5a09('0x13e'),'through':_0x5a09('0x13f')});db[_0x5a09('0x140')][_0x5a09('0x108')](db['UserVoiceQueueRt'],{'as':_0x5a09('0x141'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x5a09('0x117'),'foreignKey':'VoiceQueueId'});db[_0x5a09('0x140')][_0x5a09('0x108')](db[_0x5a09('0x64')],{'as':_0x5a09('0x10b'),'foreignKey':_0x5a09('0x142')});db[_0x5a09('0x140')][_0x5a09('0x108')](db[_0x5a09('0x66')],{'as':_0x5a09('0x143'),'foreignKey':_0x5a09('0x142')});db[_0x5a09('0x140')]['hasMany'](db[_0x5a09('0x10d')],{'as':_0x5a09('0x10d'),'foreignKey':_0x5a09('0x142')});db[_0x5a09('0x140')][_0x5a09('0x108')](db['CmHopperBlack'],{'as':_0x5a09('0x144'),'foreignKey':'VoiceQueueId'});db[_0x5a09('0x140')][_0x5a09('0x108')](db[_0x5a09('0xc9')],{'as':_0x5a09('0x145'),'foreignKey':_0x5a09('0x142')});db[_0x5a09('0x140')][_0x5a09('0x146')](db[_0x5a09('0x28')],{'as':_0x5a09('0x28'),'foreignKey':_0x5a09('0x147')});db[_0x5a09('0x140')][_0x5a09('0x146')](db[_0x5a09('0x28')],{'as':_0x5a09('0x148'),'foreignKey':_0x5a09('0x149')});db[_0x5a09('0x140')]['belongsTo'](db[_0x5a09('0x6c')],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue'][_0x5a09('0x146')](db['Pause'],{'as':_0x5a09('0x14a'),'foreignKey':_0x5a09('0x14b')});db[_0x5a09('0x140')][_0x5a09('0x119')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x11e'),'through':'voice_queues_has_cm_lists'});db[_0x5a09('0x140')]['belongsToMany'](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x2d')});db['VoiceQueue'][_0x5a09('0x119')](db[_0x5a09('0x120')],{'as':_0x5a09('0x14d'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x5a09('0x119')](db['CmList'],{'as':_0x5a09('0x14e'),'through':_0x5a09('0x14f')});db[_0x5a09('0x106')]['belongsTo'](db[_0x5a09('0x11')],{'as':_0x5a09('0x11'),'foreignKey':'UserId'});db[_0x5a09('0x1b')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x11'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x1d')][_0x5a09('0x108')](db[_0x5a09('0x1f')],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x151'),'sourceKey':_0x5a09('0x152')});db['VoiceMailMessage'][_0x5a09('0x146')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x5a09('0x152')});db[_0x5a09('0x20')][_0x5a09('0x108')](db[_0x5a09('0x25')],{'as':_0x5a09('0x153'),'foreignKey':_0x5a09('0x154'),'constraints':![]});db['VoiceCallReport'][_0x5a09('0x108')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':'User','foreignKey':'UserId'});db[_0x5a09('0x20')]['belongsTo'](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db['MailServerIn'][_0x5a09('0x146')](db['MailAccount'],{'as':_0x5a09('0x38'),'foreignKey':_0x5a09('0x157')});db[_0x5a09('0x158')][_0x5a09('0x146')](db[_0x5a09('0x159')],{'as':_0x5a09('0x159'),'foreignKey':_0x5a09('0x15a'),'onDelete':_0x5a09('0x15b')});db['MailServerOut'][_0x5a09('0x146')](db[_0x5a09('0x38')],{'as':_0x5a09('0x38'),'foreignKey':_0x5a09('0x157')});db[_0x5a09('0x36')]['belongsTo'](db[_0x5a09('0x159')],{'as':_0x5a09('0x159'),'foreignKey':_0x5a09('0x15a'),'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x38')][_0x5a09('0x103')](db[_0x5a09('0x158')],{'as':_0x5a09('0x15c'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x38')]['hasOne'](db[_0x5a09('0x36')],{'as':_0x5a09('0x15d'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x38')][_0x5a09('0x108')](db[_0x5a09('0x15e')],{'as':_0x5a09('0x15f'),'foreignKey':_0x5a09('0x157'),'onDelete':'cascade'});db[_0x5a09('0x38')]['hasMany'](db[_0x5a09('0x160')],{'as':'Answers','foreignKey':_0x5a09('0x157')});db[_0x5a09('0x38')][_0x5a09('0x108')](db[_0x5a09('0x3f')],{'as':_0x5a09('0x150'),'foreignKey':_0x5a09('0x157')});db[_0x5a09('0x38')]['hasMany'](db[_0x5a09('0x122')],{'as':'Interactions'});db[_0x5a09('0x38')][_0x5a09('0x108')](db[_0x5a09('0x41')],{'as':'Applications','foreignKey':_0x5a09('0x157'),'onDelete':_0x5a09('0x104')});db['MailAccount'][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0x38')]['belongsTo'](db[_0x5a09('0x7c')],{'as':'Template','foreignKey':_0x5a09('0x163')});db[_0x5a09('0x38')][_0x5a09('0x146')](db[_0x5a09('0x6e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x5a09('0x3a')][_0x5a09('0x119')](db['User'],{'as':_0x5a09('0x14c'),'through':'UserMailQueue'});db['MailQueue'][_0x5a09('0x119')](db['Team'],{'through':_0x5a09('0x164'),'as':_0x5a09('0x14d')});db[_0x5a09('0x122')][_0x5a09('0x108')](db['MailMessage'],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':'MailInteractionId'});db[_0x5a09('0x122')]['belongsTo'](db['MailAccount'],{'as':_0x5a09('0x165'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x122')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x166'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x122')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x168'),'as':_0x5a09('0x169')});db[_0x5a09('0x122')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x168'),'as':_0x5a09('0x16a')});db[_0x5a09('0x122')]['belongsToMany'](db['User'],{'as':_0x5a09('0x16b'),'through':'user_has_mail_interactions','foreignKey':_0x5a09('0x16c')});db[_0x5a09('0x3f')][_0x5a09('0x108')](db[_0x5a09('0x16d')],{'as':_0x5a09('0x16e'),'onDelete':'cascade'});db[_0x5a09('0x3f')][_0x5a09('0x146')](db['User'],{'as':_0x5a09('0x11')});db[_0x5a09('0x3f')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'onDelete':'cascade','as':'Contact'});db[_0x5a09('0x3f')][_0x5a09('0x146')](db['MailInteraction'],{'as':_0x5a09('0x16f'),'foreignKey':_0x5a09('0x16c')});db[_0x5a09('0x3f')][_0x5a09('0x146')](db[_0x5a09('0x38')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x157')});db[_0x5a09('0x3f')][_0x5a09('0x146')](db[_0x5a09('0x170')],{'as':_0x5a09('0x170'),'foreignKey':'ChatWebsiteId'});db[_0x5a09('0x3f')][_0x5a09('0x146')](db[_0x5a09('0x171')],{'as':'ChatOfflineMessage','foreignKey':_0x5a09('0x172')});db[_0x5a09('0x41')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':_0x5a09('0x15b')});db['MailApplication'][_0x5a09('0x146')](db['MailQueue'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x41')][_0x5a09('0x146')](db[_0x5a09('0x38')],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x41')][_0x5a09('0x146')](db[_0x5a09('0x6c')],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x173')});db['MailApplication'][_0x5a09('0x146')](db[_0x5a09('0x167')],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x174')});db['MailQueueReport'][_0x5a09('0x146')](db['MailAccount'],{});db[_0x5a09('0x175')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0x175')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x175')][_0x5a09('0x146')](db[_0x5a09('0x122')],{});db[_0x5a09('0x175')][_0x5a09('0x146')](db[_0x5a09('0x3f')],{});db['MailQueueReport'][_0x5a09('0x146')](db['User'],{});db[_0x5a09('0x175')][_0x5a09('0x146')](db[_0x5a09('0x3a')],{});db[_0x5a09('0x43')][_0x5a09('0x108')](db[_0x5a09('0x44')],{'as':_0x5a09('0x176'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x45')][_0x5a09('0x108')](db[_0x5a09('0x15e')],{'as':_0x5a09('0x15f'),'foreignKey':_0x5a09('0x177'),'onDelete':'cascade'});db[_0x5a09('0x45')][_0x5a09('0x108')](db[_0x5a09('0x160')],{'as':_0x5a09('0x178'),'foreignKey':_0x5a09('0x177')});db['FaxAccount'][_0x5a09('0x108')](db[_0x5a09('0x111')],{'as':_0x5a09('0x179')});db[_0x5a09('0x45')][_0x5a09('0x108')](db[_0x5a09('0x17a')],{'as':_0x5a09('0x13d'),'foreignKey':_0x5a09('0x177'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x45')][_0x5a09('0x108')](db[_0x5a09('0x17')],{'as':_0x5a09('0x17b'),'onDelete':_0x5a09('0x104')});db['FaxAccount'][_0x5a09('0x108')](db[_0x5a09('0x46')],{'as':'Messages'});db[_0x5a09('0x45')]['belongsTo'](db[_0x5a09('0x28')],{'as':_0x5a09('0x28')});db[_0x5a09('0x45')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0x5a09('0x146')](db[_0x5a09('0x6e')],{'as':_0x5a09('0x14a'),'foreignKey':_0x5a09('0x14b')});db[_0x5a09('0x45')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x135')});db[_0x5a09('0x17a')][_0x5a09('0x146')](db['User'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x17a')][_0x5a09('0x146')](db['FaxQueue'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x17a')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x17a')][_0x5a09('0x146')](db[_0x5a09('0x167')],{'onDelete':'restrict','foreignKey':_0x5a09('0x174')});db[_0x5a09('0x111')][_0x5a09('0x108')](db[_0x5a09('0x46')],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x17c')});db[_0x5a09('0x111')][_0x5a09('0x146')](db[_0x5a09('0x45')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x177')});db[_0x5a09('0x111')]['belongsTo'](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x111')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':'Owner','foreignKey':_0x5a09('0x105')});db[_0x5a09('0x111')][_0x5a09('0x119')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5a09('0x169')});db[_0x5a09('0x111')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5a09('0x16a')});db['FaxInteraction'][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':_0x5a09('0x125'),'foreignKey':_0x5a09('0x17c')});db[_0x5a09('0x46')]['belongsTo'](db[_0x5a09('0x11')],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x11')});db[_0x5a09('0x46')][_0x5a09('0x146')](db[_0x5a09('0x111')],{'as':_0x5a09('0x16f'),'foreignKey':_0x5a09('0x17c')});db[_0x5a09('0x46')]['belongsTo'](db[_0x5a09('0x61')],{'onDelete':'cascade','as':_0x5a09('0x155')});db[_0x5a09('0x46')][_0x5a09('0x146')](db['Attachment'],{'as':_0x5a09('0x16d'),'foreignKey':_0x5a09('0x17d')});db['FaxMessage'][_0x5a09('0x146')](db[_0x5a09('0x45')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x5a09('0x48')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x12e')});db[_0x5a09('0x48')][_0x5a09('0x119')](db[_0x5a09('0x120')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x5a09('0x4a')][_0x5a09('0x146')](db[_0x5a09('0x45')],{});db['FaxQueueReport'][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0x4a')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db['FaxQueueReport']['belongsTo'](db[_0x5a09('0x111')],{});db['FaxQueueReport']['belongsTo'](db[_0x5a09('0x46')],{});db[_0x5a09('0x4a')][_0x5a09('0x146')](db['User'],{});db[_0x5a09('0x4a')][_0x5a09('0x146')](db[_0x5a09('0x48')],{});db[_0x5a09('0x4b')]['hasMany'](db['Disposition'],{'as':_0x5a09('0x15f'),'foreignKey':_0x5a09('0x17e'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x4b')][_0x5a09('0x108')](db['CannedAnswer'],{'as':_0x5a09('0x178'),'foreignKey':_0x5a09('0x17e')});db[_0x5a09('0x4b')]['hasMany'](db[_0x5a09('0x17f')],{'as':_0x5a09('0x150'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x5a09('0x108')](db[_0x5a09('0x126')],{'as':'Interactions'});db[_0x5a09('0x4b')][_0x5a09('0x108')](db['SmsApplication'],{'as':'Applications','foreignKey':_0x5a09('0x17e'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x4b')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':'ListId'});db[_0x5a09('0x4b')]['belongsTo'](db[_0x5a09('0x6e')],{'as':_0x5a09('0x14a'),'foreignKey':_0x5a09('0x14b')});db[_0x5a09('0x4b')]['belongsToMany'](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x139')});db['SmsApplication'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':_0x5a09('0x15b')});db['SmsApplication'][_0x5a09('0x146')](db[_0x5a09('0x50')],{'onDelete':_0x5a09('0x15b')});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x180')][_0x5a09('0x146')](db['Interval'],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x173')});db['SmsApplication']['belongsTo'](db[_0x5a09('0x167')],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x174')});db[_0x5a09('0x126')][_0x5a09('0x108')](db['SmsMessage'],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x181')});db[_0x5a09('0x126')][_0x5a09('0x146')](db[_0x5a09('0x4b')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x17e')});db[_0x5a09('0x126')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':'Contact','foreignKey':_0x5a09('0x156')});db[_0x5a09('0x126')][_0x5a09('0x146')](db['User'],{'as':_0x5a09('0x166'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x126')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x182'),'as':_0x5a09('0x169')});db[_0x5a09('0x126')]['belongsToMany'](db[_0x5a09('0x167')],{'through':_0x5a09('0x182'),'as':_0x5a09('0x16a')});db['SmsInteraction'][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':_0x5a09('0x127'),'foreignKey':'SmsInteractionId'});db[_0x5a09('0x17f')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x11')});db[_0x5a09('0x17f')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x155')});db[_0x5a09('0x17f')][_0x5a09('0x146')](db[_0x5a09('0x126')],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x16f'),'foreignKey':_0x5a09('0x181')});db[_0x5a09('0x17f')]['belongsTo'](db[_0x5a09('0x4b')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x17e')});db[_0x5a09('0x50')]['belongsToMany'](db['User'],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x12f'),'foreignKey':_0x5a09('0x183')});db[_0x5a09('0x50')][_0x5a09('0x119')](db['Team'],{'through':_0x5a09('0x184'),'as':_0x5a09('0x14d')});db[_0x5a09('0x52')][_0x5a09('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5a09('0x185'),'onDelete':'cascade'});db[_0x5a09('0x52')][_0x5a09('0x108')](db[_0x5a09('0x160')],{'as':_0x5a09('0x178'),'foreignKey':_0x5a09('0x185')});db['OpenchannelAccount'][_0x5a09('0x108')](db['OpenchannelInteraction'],{'as':_0x5a09('0x179'),'foreignKey':_0x5a09('0x185')});db['OpenchannelAccount'][_0x5a09('0x108')](db[_0x5a09('0x186')],{'as':_0x5a09('0x150'),'foreignKey':_0x5a09('0x185')});db[_0x5a09('0x52')][_0x5a09('0x108')](db['OpenchannelApplication'],{'as':_0x5a09('0x13d'),'foreignKey':_0x5a09('0x185'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x52')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db['OpenchannelAccount'][_0x5a09('0x146')](db[_0x5a09('0x6e')],{'as':_0x5a09('0x14a'),'foreignKey':_0x5a09('0x14b')});db[_0x5a09('0x52')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x138')});db[_0x5a09('0x187')][_0x5a09('0x146')](db['User'],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x187')][_0x5a09('0x146')](db[_0x5a09('0x56')],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x188')});db[_0x5a09('0x187')][_0x5a09('0x146')](db['OpenchannelAccount'],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x185')});db[_0x5a09('0x187')][_0x5a09('0x146')](db['Interval'],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x173')});db[_0x5a09('0x187')][_0x5a09('0x146')](db[_0x5a09('0x167')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x5a09('0x53')][_0x5a09('0x108')](db['OpenchannelMessage'],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x189')});db[_0x5a09('0x53')]['belongsTo'](db[_0x5a09('0x52')],{'as':_0x5a09('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0x5a09('0x53')]['belongsTo'](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db['OpenchannelInteraction']['belongsTo'](db[_0x5a09('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x5a09('0x53')][_0x5a09('0x119')](db['Tag'],{'through':_0x5a09('0x18a'),'as':_0x5a09('0x169')});db[_0x5a09('0x53')][_0x5a09('0x119')](db['Tag'],{'through':_0x5a09('0x18a'),'as':'ThroughTags'});db[_0x5a09('0x53')]['belongsToMany'](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':_0x5a09('0x128'),'foreignKey':_0x5a09('0x189')});db[_0x5a09('0x186')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':'cascade','as':_0x5a09('0x11')});db[_0x5a09('0x186')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'onDelete':'cascade','as':_0x5a09('0x155')});db[_0x5a09('0x186')][_0x5a09('0x146')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x5a09('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x5a09('0x186')][_0x5a09('0x146')](db[_0x5a09('0x16d')],{'as':_0x5a09('0x16d'),'foreignKey':_0x5a09('0x17d')});db[_0x5a09('0x186')]['belongsTo'](db[_0x5a09('0x52')],{'as':_0x5a09('0x165'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x33'),'foreignKey':_0x5a09('0x188')});db[_0x5a09('0x56')][_0x5a09('0x119')](db['Team'],{'through':_0x5a09('0x18b'),'as':'Teams'});db[_0x5a09('0x170')][_0x5a09('0x108')](db[_0x5a09('0x15e')],{'as':_0x5a09('0x15f'),'foreignKey':_0x5a09('0x18c'),'onDelete':'cascade'});db[_0x5a09('0x170')][_0x5a09('0x108')](db[_0x5a09('0x160')],{'as':_0x5a09('0x178'),'foreignKey':_0x5a09('0x18c')});db[_0x5a09('0x170')][_0x5a09('0x108')](db[_0x5a09('0x18d')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x5a09('0x108')](db[_0x5a09('0x10f')],{'as':_0x5a09('0x179')});db[_0x5a09('0x170')][_0x5a09('0x108')](db[_0x5a09('0x5a')],{'as':_0x5a09('0x13d'),'foreignKey':_0x5a09('0x18c'),'onDelete':'cascade'});db['ChatWebsite'][_0x5a09('0x108')](db[_0x5a09('0x5c')],{'as':_0x5a09('0x150')});db['ChatWebsite']['belongsTo'](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0x170')][_0x5a09('0x146')](db[_0x5a09('0x6c')],{'as':_0x5a09('0x6c'),'foreignKey':'IntervalId'});db[_0x5a09('0x170')][_0x5a09('0x146')](db[_0x5a09('0x38')],{'as':_0x5a09('0x38'),'foreignKey':_0x5a09('0x157')});db[_0x5a09('0x170')][_0x5a09('0x146')](db[_0x5a09('0x6e')],{'as':_0x5a09('0x14a'),'foreignKey':_0x5a09('0x14b')});db[_0x5a09('0x170')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x18e')});db[_0x5a09('0x58')][_0x5a09('0x146')](db[_0x5a09('0x52')],{});db['OpenchannelQueueReport'][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':'List','foreignKey':'ListId'});db[_0x5a09('0x58')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x58')][_0x5a09('0x146')](db[_0x5a09('0x53')],{});db[_0x5a09('0x58')][_0x5a09('0x146')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x5a09('0x11')],{});db[_0x5a09('0x58')][_0x5a09('0x146')](db[_0x5a09('0x56')],{});db[_0x5a09('0x5a')][_0x5a09('0x146')](db['User'],{'as':_0x5a09('0x18f'),'foreignKey':_0x5a09('0x105'),'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x5a')][_0x5a09('0x146')](db[_0x5a09('0x5e')],{'as':'Queue','foreignKey':_0x5a09('0x190'),'onDelete':_0x5a09('0x15b')});db['ChatApplication'][_0x5a09('0x146')](db[_0x5a09('0x170')],{'as':_0x5a09('0x191'),'foreignKey':'ChatWebsiteId','onDelete':_0x5a09('0x15b')});db['ChatApplication']['belongsTo'](db[_0x5a09('0x167')],{'onDelete':'restrict','foreignKey':_0x5a09('0x174')});db['ChatInteraction'][_0x5a09('0x108')](db[_0x5a09('0x5c')],{'as':_0x5a09('0x150'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x192')});db[_0x5a09('0x10f')][_0x5a09('0x146')](db[_0x5a09('0x170')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x18c')});db[_0x5a09('0x10f')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x10f')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x166'),'foreignKey':'UserId'});db['ChatInteraction'][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x193'),'as':_0x5a09('0x169')});db[_0x5a09('0x10f')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x193'),'as':'ThroughTags'});db[_0x5a09('0x10f')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':'user_has_chat_interactions','foreignKey':_0x5a09('0x192')});db['ChatMessage']['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x5a09('0x11')});db[_0x5a09('0x5c')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'onDelete':_0x5a09('0x104'),'as':'Contact','foreignKey':_0x5a09('0x156')});db['ChatMessage'][_0x5a09('0x146')](db[_0x5a09('0x10f')],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x16f'),'foreignKey':_0x5a09('0x192')});db[_0x5a09('0x5c')]['belongsTo'](db[_0x5a09('0x16d')],{'as':_0x5a09('0x16d'),'foreignKey':_0x5a09('0x17d')});db['ChatMessage']['belongsTo'](db[_0x5a09('0x170')],{'as':'Account','foreignKey':_0x5a09('0x18c')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0x5a09('0x16e'),'foreignKey':_0x5a09('0x172'),'onDelete':_0x5a09('0x104'),'hooks':!![]});db[_0x5a09('0x171')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x155'),'foreignKey':'ContactId'});db[_0x5a09('0x171')][_0x5a09('0x146')](db[_0x5a09('0x170')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x18c')});db[_0x5a09('0x5e')][_0x5a09('0x119')](db['User'],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x2f'),'hooks':!![]});db[_0x5a09('0x5e')][_0x5a09('0x119')](db[_0x5a09('0x120')],{'through':_0x5a09('0x194'),'as':'Teams'});db[_0x5a09('0x195')][_0x5a09('0x108')](db[_0x5a09('0xc4')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x5a09('0x104')});db[_0x5a09('0x195')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x141'),'through':'chat_group_has_users'});db[_0x5a09('0x18d')]['belongsTo'](db[_0x5a09('0x170')],{'as':_0x5a09('0x191'),'foreignKey':_0x5a09('0x18c')});db[_0x5a09('0x196')][_0x5a09('0x108')](db['CmContact'],{'as':_0x5a09('0x11c'),'foreignKey':_0x5a09('0x197')});db['CmContact']['hasMany'](db[_0x5a09('0x78')],{'as':_0x5a09('0x198'),'foreignKey':'CmContactId'});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0x116')],{'as':'Hoppers','foreignKey':_0x5a09('0x156')});db[_0x5a09('0x61')][_0x5a09('0x108')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x5a09('0x156')});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0x66')],{'as':_0x5a09('0x143'),'foreignKey':'ContactId'});db[_0x5a09('0x61')]['hasMany'](db['ReportAgentPreview'],{'as':_0x5a09('0x10d'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0xc9')],{'as':_0x5a09('0x145'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0x53')],{'as':_0x5a09('0x10e'),'foreignKey':_0x5a09('0x156'),'onDelete':'restrict'});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0x10f')],{'as':_0x5a09('0x123'),'foreignKey':_0x5a09('0x156'),'onDelete':_0x5a09('0x15b')});db[_0x5a09('0x61')][_0x5a09('0x108')](db[_0x5a09('0x126')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x5a09('0x61')][_0x5a09('0x108')](db['FaxInteraction'],{'as':_0x5a09('0x199'),'foreignKey':'ContactId','onDelete':_0x5a09('0x15b')});db[_0x5a09('0x61')][_0x5a09('0x108')](db['MailInteraction'],{'as':_0x5a09('0x112'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x5a09('0x146')](db[_0x5a09('0x196')],{'as':_0x5a09('0x19a'),'foreignKey':_0x5a09('0x197')});db[_0x5a09('0x61')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':'ListId','onDelete':_0x5a09('0x104')});db[_0x5a09('0x61')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':_0x5a09('0x11d')});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0x5a09('0x169'),'through':_0x5a09('0x19b')});db['CmContact'][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':'cm_contact_has_tags','as':_0x5a09('0x16a')});db[_0x5a09('0x116')][_0x5a09('0x108')](db[_0x5a09('0x7a')],{'as':_0x5a09('0x19c'),'foreignKey':_0x5a09('0x19d')});db[_0x5a09('0x116')]['belongsTo'](db['CmContact'],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156'),'onDelete':_0x5a09('0x104')});db['CmHopper'][_0x5a09('0x146')](db['CmList'],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162'),'onDelete':'cascade'});db[_0x5a09('0x116')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x18f'),'foreignKey':_0x5a09('0x105')});db[_0x5a09('0x116')][_0x5a09('0x146')](db[_0x5a09('0x140')],{'as':'Queue','foreignKey':_0x5a09('0x142'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x116')][_0x5a09('0x146')](db['Campaign'],{'as':'Campaign','foreignKey':_0x5a09('0x19e'),'onDelete':_0x5a09('0x104')});db['CmHopper'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x166'),'foreignKey':'OwnerId'});db[_0x5a09('0x63')][_0x5a09('0x146')](db['CmContact'],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x63')][_0x5a09('0x146')](db[_0x5a09('0xe7')],{'as':'List','foreignKey':_0x5a09('0x162'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0x63')]['belongsTo'](db[_0x5a09('0x140')],{'as':_0x5a09('0x19f'),'foreignKey':'VoiceQueueId','onDelete':_0x5a09('0x104')});db[_0x5a09('0x63')][_0x5a09('0x146')](db[_0x5a09('0x1a0')],{'as':_0x5a09('0x1a0'),'foreignKey':'CampaignId','onDelete':_0x5a09('0x104')});db[_0x5a09('0x1a1')]['hasMany'](db[_0x5a09('0x6b')],{'as':{'plural':_0x5a09('0x1a2'),'singular':_0x5a09('0x1a3')},'foreignKey':_0x5a09('0x1a4'),'onDelete':_0x5a09('0x104'),'hooks':!![]});db[_0x5a09('0x1a1')][_0x5a09('0x108')](db[_0x5a09('0x6b')],{'as':{'plural':_0x5a09('0x1a5'),'singular':'OneAny'},'foreignKey':_0x5a09('0x1a6'),'onDelete':_0x5a09('0x104'),'hooks':!![]});db[_0x5a09('0x1a1')][_0x5a09('0x108')](db['Action'],{'as':_0x5a09('0x1a7'),'foreignKey':_0x5a09('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x5a09('0x15e')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x5a09('0x104')});db[_0x5a09('0x6c')][_0x5a09('0x108')](db['Interval'],{'as':_0x5a09('0x1a9'),'foreignKey':_0x5a09('0x173'),'onDelete':_0x5a09('0x104'),'hooks':!![],'required':![]});db[_0x5a09('0x6c')]['hasMany'](db['VoiceExtension'],{'as':_0x5a09('0x10a'),'foreignKey':_0x5a09('0x173'),'onDelete':_0x5a09('0x15b')});db['Interval'][_0x5a09('0x108')](db['MailApplication'],{'as':_0x5a09('0x1aa'),'foreignKey':_0x5a09('0x173')});db['Interval'][_0x5a09('0x108')](db[_0x5a09('0x5a')],{'as':_0x5a09('0x1ab'),'foreignKey':_0x5a09('0x173')});db[_0x5a09('0x6c')][_0x5a09('0x108')](db[_0x5a09('0x17a')],{'as':'FaxApplications','foreignKey':_0x5a09('0x173')});db[_0x5a09('0x6c')][_0x5a09('0x108')](db[_0x5a09('0x180')],{'as':'SmsApplications','foreignKey':_0x5a09('0x173')});db[_0x5a09('0x73')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0x5a09('0x146')](db[_0x5a09('0x86')],{'foreignKey':_0x5a09('0x1ac')});db[_0x5a09('0x73')]['belongsTo'](db[_0x5a09('0x84')],{'foreignKey':_0x5a09('0x1ad')});db[_0x5a09('0x75')][_0x5a09('0x119')](db[_0x5a09('0x19')],{'as':_0x5a09('0x1ae'),'through':_0x5a09('0x13f'),'onDelete':'restrict'});db[_0x5a09('0x167')][_0x5a09('0x119')](db[_0x5a09('0x61')],{'through':_0x5a09('0x19b')});db[_0x5a09('0x167')]['belongsToMany'](db[_0x5a09('0x10f')],{'through':_0x5a09('0x193')});db[_0x5a09('0x167')][_0x5a09('0x119')](db[_0x5a09('0x122')],{'through':_0x5a09('0x168')});db[_0x5a09('0x167')][_0x5a09('0x119')](db[_0x5a09('0x126')],{'through':'sms_interaction_has_tags'});db[_0x5a09('0x167')]['belongsToMany'](db[_0x5a09('0x111')],{'through':_0x5a09('0x1af')});db[_0x5a09('0x167')][_0x5a09('0x119')](db[_0x5a09('0x53')],{'through':_0x5a09('0x18a')});db[_0x5a09('0x167')][_0x5a09('0x119')](db[_0x5a09('0xf4')],{'through':_0x5a09('0x1b0')});db['CmContactHasItem'][_0x5a09('0x146')](db[_0x5a09('0x77')],{'as':_0x5a09('0x1b1'),'foreignKey':_0x5a09('0x1b2')});db[_0x5a09('0x7a')][_0x5a09('0x146')](db['CmHopper'],{'as':_0x5a09('0x1b3'),'foreignKey':'CmHopperId'});db[_0x5a09('0x78')]['belongsTo'](db['CmContact'],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x1b4')});db['Trigger']['hasMany'](db[_0x5a09('0x6b')],{'as':{'plural':_0x5a09('0x1b5'),'singular':_0x5a09('0x1b6')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0x5a09('0x108')](db[_0x5a09('0x6b')],{'as':{'plural':_0x5a09('0x1b7'),'singular':_0x5a09('0x1b8')},'foreignKey':'TriggerAnyId','onDelete':_0x5a09('0x104'),'hooks':!![]});db[_0x5a09('0x7e')][_0x5a09('0x108')](db[_0x5a09('0x1b9')],{'as':_0x5a09('0x1a7'),'foreignKey':_0x5a09('0x1ba'),'onDelete':_0x5a09('0x104'),'hooks':!![]});db[_0x5a09('0x84')][_0x5a09('0x108')](db['AnalyticFieldReport'],{'as':_0x5a09('0x1bb'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1ad'),'hooks':!![]});db[_0x5a09('0x86')][_0x5a09('0x108')](db[_0x5a09('0x8b')],{'as':_0x5a09('0x1bb'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x5a09('0x108')](db[_0x5a09('0x8b')],{'as':_0x5a09('0x1bb'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bc')});db[_0x5a09('0x8b')][_0x5a09('0x146')](db['AnalyticMetric'],{'foreignKey':_0x5a09('0x1bc')});db[_0x5a09('0x8f')]['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x91')][_0x5a09('0x108')](db['SalesforceField'],{'as':_0x5a09('0x1be'),'onDelete':'cascade','foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x91')]['hasMany'](db[_0x5a09('0x93')],{'as':_0x5a09('0x1c0'),'onDelete':'cascade','foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0x91')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x91')][_0x5a09('0x146')](db[_0x5a09('0x8f')],{'as':'Account','foreignKey':'AccountId'});db[_0x5a09('0x93')][_0x5a09('0x108')](db[_0x5a09('0x93')],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x93')][_0x5a09('0x108')](db[_0x5a09('0x93')],{'as':'Description','foreignKey':_0x5a09('0x1c1')});db['SalesforceField'][_0x5a09('0x108')](db[_0x5a09('0x93')],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x93')][_0x5a09('0x146')](db[_0x5a09('0x1c5')],{'as':_0x5a09('0x1c5'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x5a09('0x108')](db[_0x5a09('0x95')],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x95')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1be'),'onDelete':'cascade','foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x95')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1c0'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0x95')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1bb'),'onDelete':'cascade','foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x95')][_0x5a09('0x146')](db[_0x5a09('0x1c7')],{'as':_0x5a09('0x165'),'foreignKey':'AccountId'});db[_0x5a09('0x97')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1c3'),'foreignKey':'SubjectId'});db[_0x5a09('0x97')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1c8'),'foreignKey':'DescriptionId'});db[_0x5a09('0x97')][_0x5a09('0x108')](db[_0x5a09('0x97')],{'as':_0x5a09('0x1c4'),'foreignKey':'FieldId'});db[_0x5a09('0x97')]['belongsTo'](db['Variable'],{'as':_0x5a09('0x1c5'),'foreignKey':_0x5a09('0x1c9')});db[_0x5a09('0x99')]['hasMany'](db[_0x5a09('0x9b')],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db['DeskConfiguration']['hasMany'](db[_0x5a09('0x9d')],{'as':'Subjects','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x9b')]['hasMany'](db[_0x5a09('0x9d')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0x9b')][_0x5a09('0x108')](db[_0x5a09('0x9d')],{'as':'Fields','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x9b')]['belongsTo'](db[_0x5a09('0x99')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x9b')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x1ca')});db[_0x5a09('0x9d')][_0x5a09('0x108')](db['DeskField'],{'as':'Subject','foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x9d')][_0x5a09('0x108')](db[_0x5a09('0x9d')],{'as':'Description','foreignKey':_0x5a09('0x1c1')});db['DeskField'][_0x5a09('0x108')](db['DeskField'],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x9d')]['belongsTo'](db[_0x5a09('0x1c5')],{'as':'Variable','foreignKey':_0x5a09('0x1c9')});db[_0x5a09('0x1cb')][_0x5a09('0x108')](db[_0x5a09('0xa0')],{'as':_0x5a09('0x1c6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x5a09('0xa0')][_0x5a09('0x108')](db[_0x5a09('0xa2')],{'as':'Subjects','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xa0')][_0x5a09('0x108')](db[_0x5a09('0xa2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xa0')][_0x5a09('0x108')](db['ZohoField'],{'as':_0x5a09('0x1bb'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xa0')][_0x5a09('0x146')](db['ZohoAccount'],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db['ZohoField'][_0x5a09('0x108')](db['ZohoField'],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xa2')][_0x5a09('0x108')](db[_0x5a09('0xa2')],{'as':_0x5a09('0x1c8'),'foreignKey':_0x5a09('0x1c1')});db['ZohoField'][_0x5a09('0x108')](db[_0x5a09('0xa2')],{'as':'Field','foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xa2')][_0x5a09('0x146')](db[_0x5a09('0x1c5')],{'as':_0x5a09('0x1c5'),'foreignKey':_0x5a09('0x1c9')});db['ZendeskAccount'][_0x5a09('0x108')](db[_0x5a09('0x1cc')],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x1cc')][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1be'),'foreignKey':'SubjectId'});db[_0x5a09('0x1cc')][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1c0'),'foreignKey':_0x5a09('0x1c1')});db['ZendeskConfiguration'][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1bb'),'foreignKey':'FieldId'});db[_0x5a09('0x1cc')][_0x5a09('0x146')](db[_0x5a09('0xa4')],{'as':'Account','foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x1cc')][_0x5a09('0x119')](db[_0x5a09('0x167')],{'through':_0x5a09('0x1cd')});db['ZendeskField'][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1c3'),'foreignKey':'SubjectId'});db[_0x5a09('0xa7')][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1c8'),'foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xa7')][_0x5a09('0x108')](db[_0x5a09('0xa7')],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db['ZendeskField'][_0x5a09('0x146')](db['Variable'],{'as':_0x5a09('0x1c5'),'foreignKey':_0x5a09('0x1c9')});db[_0x5a09('0x1ce')][_0x5a09('0x108')](db[_0x5a09('0xaa')],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0xaa')][_0x5a09('0x108')](db[_0x5a09('0xac')],{'as':'Subjects','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bf')});db['FreshdeskConfiguration'][_0x5a09('0x108')](db[_0x5a09('0xac')],{'as':_0x5a09('0x1c0'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xaa')][_0x5a09('0x108')](db[_0x5a09('0xac')],{'as':_0x5a09('0x1bb'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xaa')][_0x5a09('0x146')](db[_0x5a09('0x1ce')],{'as':'Account','foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0xaa')][_0x5a09('0x119')](db['Tag'],{'through':_0x5a09('0x1cf')});db['FreshdeskField']['hasMany'](db[_0x5a09('0xac')],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xac')][_0x5a09('0x108')](db[_0x5a09('0xac')],{'as':'Description','foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xac')][_0x5a09('0x108')](db[_0x5a09('0xac')],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xac')][_0x5a09('0x146')](db['Variable'],{'as':_0x5a09('0x1c5'),'foreignKey':'VariableId'});db[_0x5a09('0xae')]['hasMany'](db['VtigerConfiguration'],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0xb0')][_0x5a09('0x108')](db[_0x5a09('0x1d0')],{'as':'Subjects','foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xb0')][_0x5a09('0x108')](db[_0x5a09('0x1d0')],{'as':_0x5a09('0x1c0'),'foreignKey':_0x5a09('0x1c1')});db['VtigerConfiguration'][_0x5a09('0x108')](db[_0x5a09('0x1d0')],{'as':_0x5a09('0x1bb'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xb0')][_0x5a09('0x146')](db['VtigerAccount'],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x1d0')][_0x5a09('0x108')](db['VtigerField'],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x1d0')]['hasMany'](db[_0x5a09('0x1d0')],{'as':_0x5a09('0x1c8'),'foreignKey':_0x5a09('0x1c1')});db['VtigerField'][_0x5a09('0x108')](db[_0x5a09('0x1d0')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField'][_0x5a09('0x146')](db[_0x5a09('0x1c5')],{'as':_0x5a09('0x1c5'),'foreignKey':'VariableId'});db[_0x5a09('0xb3')][_0x5a09('0x108')](db[_0x5a09('0xb4')],{'as':_0x5a09('0x1c6'),'onDelete':_0x5a09('0x104'),'foreignKey':'AccountId'});db[_0x5a09('0xb4')][_0x5a09('0x108')](db[_0x5a09('0xb5')],{'as':_0x5a09('0x1be'),'foreignKey':'SubjectId'});db[_0x5a09('0xb4')][_0x5a09('0x108')](db['ServicenowField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x5a09('0xb4')][_0x5a09('0x108')](db['ServicenowField'],{'as':_0x5a09('0x1bb'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xb4')]['belongsTo'](db[_0x5a09('0xb3')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db['ServicenowField']['hasMany'](db[_0x5a09('0xb5')],{'as':'Subject','foreignKey':_0x5a09('0x1bf')});db['ServicenowField'][_0x5a09('0x108')](db[_0x5a09('0xb5')],{'as':_0x5a09('0x1c8'),'foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xb5')][_0x5a09('0x108')](db[_0x5a09('0xb5')],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0xb5')]['belongsTo'](db[_0x5a09('0x1c5')],{'as':'Variable','foreignKey':_0x5a09('0x1c9')});db[_0x5a09('0x1d1')][_0x5a09('0x108')](db[_0x5a09('0x1d2')],{'as':'Configurations','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0x1d1')][_0x5a09('0x146')](db[_0x5a09('0x159')],{'as':_0x5a09('0x159'),'foreignKey':'CloudProviderId'});db[_0x5a09('0x1d2')][_0x5a09('0x108')](db[_0x5a09('0xb9')],{'as':'Subjects','onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0x1d2')][_0x5a09('0x108')](db[_0x5a09('0xb9')],{'as':_0x5a09('0x1c0'),'onDelete':'cascade','foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0x1d2')][_0x5a09('0x108')](db[_0x5a09('0xb9')],{'as':_0x5a09('0x1bb'),'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1c2')});db[_0x5a09('0x1d2')][_0x5a09('0x146')](db[_0x5a09('0x1d1')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db['Dynamics365Field'][_0x5a09('0x108')](db[_0x5a09('0xb9')],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xb9')]['hasMany'](db[_0x5a09('0xb9')],{'as':_0x5a09('0x1c8'),'foreignKey':_0x5a09('0x1c1')});db[_0x5a09('0xb9')][_0x5a09('0x108')](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db[_0x5a09('0xb9')][_0x5a09('0x146')](db[_0x5a09('0x1c5')],{'as':_0x5a09('0x1c5'),'foreignKey':_0x5a09('0x1c9')});db[_0x5a09('0xbb')]['hasMany'](db[_0x5a09('0x1d3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5a09('0x1bd')});db['FreshsalesConfiguration'][_0x5a09('0x108')](db[_0x5a09('0xbe')],{'as':_0x5a09('0x1be'),'foreignKey':_0x5a09('0x1bf')});db['FreshsalesConfiguration'][_0x5a09('0x108')](db[_0x5a09('0xbe')],{'as':'Descriptions','foreignKey':_0x5a09('0x1c1')});db['FreshsalesConfiguration'][_0x5a09('0x108')](db[_0x5a09('0xbe')],{'as':'Fields','foreignKey':'FieldId'});db[_0x5a09('0x1d3')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1bd')});db[_0x5a09('0xbe')][_0x5a09('0x108')](db[_0x5a09('0xbe')],{'as':_0x5a09('0x1c3'),'foreignKey':_0x5a09('0x1bf')});db[_0x5a09('0xbe')][_0x5a09('0x108')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x5a09('0x1c1')});db['FreshsalesField']['hasMany'](db[_0x5a09('0xbe')],{'as':_0x5a09('0x1c4'),'foreignKey':_0x5a09('0x1c2')});db['FreshsalesField']['belongsTo'](db[_0x5a09('0x1c5')],{'as':'Variable','foreignKey':'VariableId'});db['ChatQueueReport'][_0x5a09('0x146')](db[_0x5a09('0x170')],{});db[_0x5a09('0xc2')]['belongsTo'](db[_0x5a09('0xe7')],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db['ChatQueueReport'][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db['ChatQueueReport'][_0x5a09('0x146')](db[_0x5a09('0x10f')],{});db[_0x5a09('0xc2')]['belongsTo'](db[_0x5a09('0x5c')],{});db[_0x5a09('0xc2')][_0x5a09('0x146')](db[_0x5a09('0x11')],{});db[_0x5a09('0xc2')][_0x5a09('0x146')](db[_0x5a09('0x5e')],{});db[_0x5a09('0xc4')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':_0x5a09('0x104'),'foreignKey':_0x5a09('0x1d4')});db['ChatInternalMessage'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x5a09('0xc9')][_0x5a09('0x108')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x5a09('0xc9')][_0x5a09('0x108')](db[_0x5a09('0xc6')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x5a09('0x1d5')]['belongsTo'](db['SmsAccount'],{});db[_0x5a09('0x1d5')][_0x5a09('0x146')](db['CmList'],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0x1d5')][_0x5a09('0x146')](db['CmContact'],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0x1d5')][_0x5a09('0x146')](db[_0x5a09('0x126')],{});db[_0x5a09('0x1d5')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport']['belongsTo'](db['User'],{});db[_0x5a09('0x1d5')][_0x5a09('0x146')](db['SmsQueue'],{});db[_0x5a09('0x1d6')][_0x5a09('0x108')](db[_0x5a09('0xc9')],{'foreignKey':_0x5a09('0x1d7')});db[_0x5a09('0x1d6')][_0x5a09('0x108')](db[_0x5a09('0x1d8')],{'foreignKey':_0x5a09('0x1d7')});db[_0x5a09('0x1d6')][_0x5a09('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0x5a09('0x1d7')});db[_0x5a09('0x120')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x121')});db[_0x5a09('0x120')][_0x5a09('0x119')](db[_0x5a09('0x140')],{'through':_0x5a09('0x1d9'),'as':_0x5a09('0x12b')});db[_0x5a09('0x120')]['belongsToMany'](db['MailQueue'],{'through':_0x5a09('0x164'),'as':_0x5a09('0x12c')});db[_0x5a09('0x120')][_0x5a09('0x119')](db[_0x5a09('0x5e')],{'through':_0x5a09('0x194'),'as':_0x5a09('0x1da')});db[_0x5a09('0x120')][_0x5a09('0x119')](db[_0x5a09('0x48')],{'through':'team_has_fax_queues','as':_0x5a09('0x12d')});db['Team'][_0x5a09('0x119')](db[_0x5a09('0x50')],{'through':_0x5a09('0x184'),'as':_0x5a09('0x1db')});db[_0x5a09('0x120')][_0x5a09('0x119')](db['OpenchannelQueue'],{'through':_0x5a09('0x18b'),'as':_0x5a09('0x130')});db[_0x5a09('0x120')][_0x5a09('0x119')](db[_0x5a09('0xf9')],{'through':_0x5a09('0x1dc'),'as':_0x5a09('0x131')});db[_0x5a09('0x120')]['belongsToMany'](db['VoicePrefix'],{'through':_0x5a09('0x1dd'),'as':_0x5a09('0x1de')});db[_0x5a09('0x1a0')][_0x5a09('0x108')](db[_0x5a09('0x116')],{'as':_0x5a09('0x117'),'foreignKey':_0x5a09('0x19e')});db['Campaign'][_0x5a09('0x108')](db[_0x5a09('0x64')],{'as':_0x5a09('0x10b'),'foreignKey':_0x5a09('0x19e')});db[_0x5a09('0x1a0')][_0x5a09('0x108')](db[_0x5a09('0x66')],{'as':_0x5a09('0x143'),'foreignKey':'CampaignId'});db[_0x5a09('0x1a0')]['hasMany'](db[_0x5a09('0x63')],{'as':_0x5a09('0x144'),'foreignKey':'CampaignId'});db[_0x5a09('0x1a0')][_0x5a09('0x146')](db['Trunk'],{'as':_0x5a09('0x28'),'foreignKey':'TrunkId'});db[_0x5a09('0x1a0')][_0x5a09('0x146')](db[_0x5a09('0x28')],{'as':_0x5a09('0x148'),'foreignKey':_0x5a09('0x149')});db['Campaign'][_0x5a09('0x146')](db['Interval'],{'as':_0x5a09('0x6c'),'foreignKey':'IntervalId'});db['Campaign'][_0x5a09('0x146')](db['SquareProject'],{'as':_0x5a09('0xd2'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x5a09('0x119')](db[_0x5a09('0xe7')],{'as':_0x5a09('0x11e'),'through':'campaigns_has_cm_lists'});db[_0x5a09('0x1a0')][_0x5a09('0x119')](db['CmList'],{'as':'BlackLists','through':_0x5a09('0x1df')});db['Attachment'][_0x5a09('0x146')](db[_0x5a09('0x171')],{'as':_0x5a09('0x171'),'foreignKey':_0x5a09('0x172')});db['MailTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x3f')],{});db['MailTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x122')],{});db[_0x5a09('0x1e0')][_0x5a09('0x146')](db['MailAccount'],{'foreignKey':_0x5a09('0x1e1'),'as':_0x5a09('0x1e2')});db[_0x5a09('0x1e0')]['belongsTo'](db[_0x5a09('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5a09('0x1e0')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e3'),'as':_0x5a09('0x1e4')});db['MailTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x3a')],{'foreignKey':_0x5a09('0x1e5'),'as':'ToQueue'});db['MailTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x38')],{'foreignKey':_0x5a09('0x1e6'),'as':_0x5a09('0x1e7')});db[_0x5a09('0x1e8')]['belongsTo'](db['ChatMessage'],{});db[_0x5a09('0x1e8')][_0x5a09('0x146')](db[_0x5a09('0x10f')],{});db[_0x5a09('0x1e8')][_0x5a09('0x146')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x5a09('0x1e2')});db['ChatTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e9'),'as':_0x5a09('0x1ea')});db[_0x5a09('0x1e8')]['belongsTo'](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e3'),'as':_0x5a09('0x1e4')});db[_0x5a09('0x1e8')][_0x5a09('0x146')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x5a09('0x1eb')});db['ChatTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x170')],{'foreignKey':_0x5a09('0x1ec'),'as':'ToAccount'});db[_0x5a09('0xe1')]['belongsTo'](db[_0x5a09('0x46')],{});db[_0x5a09('0xe1')]['belongsTo'](db[_0x5a09('0x111')],{});db[_0x5a09('0xe1')][_0x5a09('0x146')](db[_0x5a09('0x45')],{'foreignKey':_0x5a09('0x1ed'),'as':_0x5a09('0x1e2')});db[_0x5a09('0xe1')]['belongsTo'](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e9'),'as':_0x5a09('0x1ea')});db['FaxTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e3'),'as':_0x5a09('0x1e4')});db[_0x5a09('0xe1')][_0x5a09('0x146')](db[_0x5a09('0x48')],{'foreignKey':_0x5a09('0x1ee'),'as':_0x5a09('0x1eb')});db['FaxTransferReport'][_0x5a09('0x146')](db['FaxAccount'],{'foreignKey':_0x5a09('0x1ef'),'as':_0x5a09('0x1e7')});db[_0x5a09('0xe3')][_0x5a09('0x146')](db[_0x5a09('0x186')],{});db[_0x5a09('0xe3')]['belongsTo'](db[_0x5a09('0x53')],{});db[_0x5a09('0xe3')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x5a09('0x1f0'),'as':_0x5a09('0x1e2')});db['OpenchannelTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db['OpenchannelTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e3'),'as':_0x5a09('0x1e4')});db[_0x5a09('0xe3')]['belongsTo'](db[_0x5a09('0x56')],{'foreignKey':_0x5a09('0x1f1'),'as':_0x5a09('0x1eb')});db[_0x5a09('0xe3')][_0x5a09('0x146')](db[_0x5a09('0x52')],{'foreignKey':_0x5a09('0x1f2'),'as':_0x5a09('0x1e7')});db['SmsTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x17f')],{});db['SmsTransferReport'][_0x5a09('0x146')](db['SmsInteraction'],{});db[_0x5a09('0xe5')][_0x5a09('0x146')](db[_0x5a09('0x4b')],{'foreignKey':_0x5a09('0x1f3'),'as':'FromAccount'});db[_0x5a09('0xe5')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e9'),'as':_0x5a09('0x1ea')});db[_0x5a09('0xe5')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':'ToUserId','as':_0x5a09('0x1e4')});db['SmsTransferReport'][_0x5a09('0x146')](db[_0x5a09('0x50')],{'foreignKey':_0x5a09('0x1f4'),'as':'ToQueue'});db[_0x5a09('0xe5')]['belongsTo'](db[_0x5a09('0x4b')],{'foreignKey':_0x5a09('0x1f5'),'as':'ToAccount'});db[_0x5a09('0xe7')][_0x5a09('0x108')](db[_0x5a09('0x15e')],{'as':'Dispositions','foreignKey':_0x5a09('0x162'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0xe7')][_0x5a09('0x108')](db[_0x5a09('0x67')],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x5a09('0x108')](db[_0x5a09('0x61')],{'as':_0x5a09('0x11c'),'onDelete':'cascade','foreignKey':_0x5a09('0x162')});db[_0x5a09('0xe7')][_0x5a09('0x108')](db[_0x5a09('0x64')],{'as':'HopperFinals','foreignKey':_0x5a09('0x162')});db[_0x5a09('0xe7')][_0x5a09('0x108')](db[_0x5a09('0x66')],{'as':_0x5a09('0x10c'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0xe7')][_0x5a09('0x108')](db['ReportAgentPreview'],{'as':_0x5a09('0x10d'),'foreignKey':'ListId'});db[_0x5a09('0xe7')][_0x5a09('0x119')](db[_0x5a09('0x140')],{'as':_0x5a09('0x1f6'),'through':_0x5a09('0x1f7')});db[_0x5a09('0xe7')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x11f')});db[_0x5a09('0xe9')][_0x5a09('0x108')](db[_0x5a09('0x17')],{'as':_0x5a09('0x10a'),'onDelete':'cascade'});db['VoicePrefix'][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0xfd')});db['VoicePrefix'][_0x5a09('0x119')](db['Team'],{'through':'TeamVoicePrefix','as':_0x5a09('0x14d')});db[_0x5a09('0xeb')]['hasMany'](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'foreignKey':_0x5a09('0x1f8')});db['UserProfile'][_0x5a09('0x108')](db['UserProfileSection'],{'as':_0x5a09('0x1f9'),'foreignKey':_0x5a09('0x1f8'),'onDelete':_0x5a09('0x104')});db['UserProfileSection'][_0x5a09('0x108')](db[_0x5a09('0xee')],{'as':_0x5a09('0x1fa'),'foreignKey':'sectionId','onDelete':_0x5a09('0x104')});db[_0x5a09('0xf1')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5a09('0x1fb'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0xf1')][_0x5a09('0x108')](db['CannedAnswer'],{'as':_0x5a09('0x178'),'foreignKey':_0x5a09('0x1fb')});db[_0x5a09('0xf1')][_0x5a09('0x108')](db[_0x5a09('0x1fc')],{'as':_0x5a09('0x150'),'foreignKey':_0x5a09('0x1fb')});db[_0x5a09('0xf1')][_0x5a09('0x108')](db[_0x5a09('0xf4')],{'as':_0x5a09('0x179')});db[_0x5a09('0xf1')][_0x5a09('0x108')](db[_0x5a09('0xf2')],{'as':_0x5a09('0x13d'),'foreignKey':_0x5a09('0x1fb'),'onDelete':_0x5a09('0x104')});db[_0x5a09('0xf1')][_0x5a09('0x146')](db['CmList'],{'as':_0x5a09('0x161'),'foreignKey':'ListId'});db[_0x5a09('0xf1')][_0x5a09('0x146')](db[_0x5a09('0x6e')],{'as':_0x5a09('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5a09('0xf1')][_0x5a09('0x119')](db['User'],{'as':_0x5a09('0x14c'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x5a09('0x146')](db[_0x5a09('0x11')],{'onDelete':_0x5a09('0x15b')});db[_0x5a09('0xf2')][_0x5a09('0x146')](db[_0x5a09('0xf9')],{'onDelete':_0x5a09('0x15b')});db['WhatsappApplication'][_0x5a09('0x146')](db['WhatsappAccount'],{'onDelete':_0x5a09('0x15b')});db['WhatsappApplication'][_0x5a09('0x146')](db['Interval'],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x173')});db[_0x5a09('0xf2')]['belongsTo'](db[_0x5a09('0x167')],{'onDelete':_0x5a09('0x15b'),'foreignKey':_0x5a09('0x174')});db[_0x5a09('0xf4')][_0x5a09('0x108')](db[_0x5a09('0x1fc')],{'as':_0x5a09('0x150'),'onDelete':'cascade','foreignKey':_0x5a09('0x1fd')});db[_0x5a09('0xf4')][_0x5a09('0x146')](db[_0x5a09('0xf1')],{'as':_0x5a09('0x165'),'foreignKey':_0x5a09('0x1fb')});db[_0x5a09('0xf4')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0xf4')]['belongsTo'](db[_0x5a09('0x11')],{'as':'Owner','foreignKey':_0x5a09('0x105')});db[_0x5a09('0xf4')]['belongsToMany'](db['Tag'],{'through':_0x5a09('0x1b0'),'as':_0x5a09('0x169')});db['WhatsappInteraction'][_0x5a09('0x119')](db['Tag'],{'through':_0x5a09('0x1b0'),'as':'ThroughTags'});db[_0x5a09('0xf4')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x16b'),'through':_0x5a09('0x12a'),'foreignKey':'WhatsappInteractionId'});db[_0x5a09('0x1fc')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x11')});db[_0x5a09('0x1fc')][_0x5a09('0x146')](db['CmContact'],{'onDelete':_0x5a09('0x104'),'as':_0x5a09('0x155')});db['WhatsappMessage'][_0x5a09('0x146')](db[_0x5a09('0xf4')],{'onDelete':'cascade','as':_0x5a09('0x16f'),'foreignKey':'WhatsappInteractionId'});db[_0x5a09('0x1fc')][_0x5a09('0x146')](db[_0x5a09('0xf1')],{'as':_0x5a09('0x165'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x5a09('0x146')](db[_0x5a09('0xf1')],{});db[_0x5a09('0xf6')][_0x5a09('0x146')](db['CmList'],{'as':_0x5a09('0x161'),'foreignKey':_0x5a09('0x162')});db[_0x5a09('0xf6')][_0x5a09('0x146')](db[_0x5a09('0x61')],{'as':_0x5a09('0x155'),'foreignKey':_0x5a09('0x156')});db[_0x5a09('0xf6')][_0x5a09('0x146')](db['WhatsappInteraction'],{});db[_0x5a09('0xf6')][_0x5a09('0x146')](db[_0x5a09('0xf9')],{});db[_0x5a09('0xf6')][_0x5a09('0x146')](db['WhatsappMessage'],{});db[_0x5a09('0xf6')]['belongsTo'](db[_0x5a09('0x11')],{});db[_0x5a09('0x1fe')]['belongsTo'](db[_0x5a09('0x1fc')],{});db[_0x5a09('0x1fe')][_0x5a09('0x146')](db[_0x5a09('0xf4')],{});db[_0x5a09('0x1fe')][_0x5a09('0x146')](db[_0x5a09('0xf1')],{'foreignKey':_0x5a09('0x1ff'),'as':_0x5a09('0x1e2')});db[_0x5a09('0x1fe')][_0x5a09('0x146')](db[_0x5a09('0xf1')],{'foreignKey':_0x5a09('0x200'),'as':_0x5a09('0x1e7')});db['WhatsappTransferReport'][_0x5a09('0x146')](db[_0x5a09('0xf9')],{'foreignKey':_0x5a09('0x201'),'as':_0x5a09('0x1eb')});db['WhatsappTransferReport'][_0x5a09('0x146')](db['User'],{'foreignKey':_0x5a09('0x1e9'),'as':'FromAgent'});db[_0x5a09('0x1fe')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'foreignKey':_0x5a09('0x1e3'),'as':_0x5a09('0x1e4')});db[_0x5a09('0xf9')][_0x5a09('0x119')](db[_0x5a09('0x11')],{'as':_0x5a09('0x14c'),'through':_0x5a09('0x132'),'foreignKey':_0x5a09('0x202')});db[_0x5a09('0xf9')][_0x5a09('0x119')](db[_0x5a09('0x120')],{'through':_0x5a09('0x1dc'),'as':'Teams'});db[_0x5a09('0xff')][_0x5a09('0x146')](db[_0x5a09('0x11')],{'as':_0x5a09('0x203'),'foreignKey':_0x5a09('0x105'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x5a09('0x103')](db[_0x5a09('0x1d1')],{'as':'Dynamics365Account','onDelete':_0x5a09('0x15b')});db[_0x5a09('0x159')][_0x5a09('0x103')](db[_0x5a09('0x158')],{'as':_0x5a09('0x15c'),'onDelete':_0x5a09('0x15b')});db['CloudProvider'][_0x5a09('0x103')](db[_0x5a09('0x36')],{'as':'Smtp','onDelete':_0x5a09('0x15b')});module[_0x5a09('0x204')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 673c260..4de9b58 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757c=['./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites'];(function(_0x3a953a,_0x5e6d37){var _0x4b04e4=function(_0x34e3ff){while(--_0x34e3ff){_0x3a953a['push'](_0x3a953a['shift']());}};_0x4b04e4(++_0x5e6d37);}(_0x757c,0xc9));var _0xc757=function(_0x1ccf0b,_0x571ed6){_0x1ccf0b=_0x1ccf0b-0x0;var _0x4ac5b3=_0x757c[_0x1ccf0b];return _0x4ac5b3;};'use strict';var path=require(_0xc757('0x0'));var express=require(_0xc757('0x1'));var errors=require('./errors');var config=require(_0xc757('0x2'));var setupLoggers=require(_0xc757('0x3'))[_0xc757('0x4')];var clientSideLogs=require(_0xc757('0x5'));exports[_0xc757('0x6')]=function(_0x4165bb){return setupLoggers(_0x4165bb)[_0xc757('0x7')](function(){_0x4165bb[_0xc757('0x8')](_0xc757('0x9'),require(_0xc757('0xa')));_0x4165bb['use'](_0xc757('0xb'),require(_0xc757('0xc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd'),require('./api/voiceContext'));_0x4165bb[_0xc757('0x8')]('/api/voice/extensions',require(_0xc757('0xe')));_0x4165bb[_0xc757('0x8')]('/api/voice/mohs',require(_0xc757('0xf')));_0x4165bb[_0xc757('0x8')](_0xc757('0x10'),require(_0xc757('0x11')));_0x4165bb[_0xc757('0x8')](_0xc757('0x12'),require('./api/voiceRecording'));_0x4165bb['use'](_0xc757('0x13'),require(_0xc757('0x14')));_0x4165bb[_0xc757('0x8')](_0xc757('0x15'),require('./api/voiceMail'));_0x4165bb[_0xc757('0x8')](_0xc757('0x16'),require('./api/voiceMailMessage'));_0x4165bb[_0xc757('0x8')](_0xc757('0x17'),require(_0xc757('0x18')));_0x4165bb[_0xc757('0x8')](_0xc757('0x19'),require(_0xc757('0x1a')));_0x4165bb['use'](_0xc757('0x1b'),require(_0xc757('0x1c')));_0x4165bb['use'](_0xc757('0x1d'),require(_0xc757('0x1e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x1f'),require(_0xc757('0x20')));_0x4165bb[_0xc757('0x8')](_0xc757('0x21'),require(_0xc757('0x22')));_0x4165bb[_0xc757('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0x23'),require('./api/mailServerOut'));_0x4165bb[_0xc757('0x8')](_0xc757('0x24'),require(_0xc757('0x25')));_0x4165bb['use'](_0xc757('0x26'),require(_0xc757('0x27')));_0x4165bb[_0xc757('0x8')](_0xc757('0x28'),require(_0xc757('0x29')));_0x4165bb['use'](_0xc757('0x2a'),require('./api/mailInteraction'));_0x4165bb[_0xc757('0x8')](_0xc757('0x2b'),require(_0xc757('0x2c')));_0x4165bb[_0xc757('0x8')](_0xc757('0x2d'),require(_0xc757('0x2e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x2f'),require('./api/mailQueueReport'));_0x4165bb['use'](_0xc757('0x30'),require(_0xc757('0x31')));_0x4165bb[_0xc757('0x8')](_0xc757('0x32'),require('./api/dashboardItem'));_0x4165bb[_0xc757('0x8')](_0xc757('0x33'),require(_0xc757('0x34')));_0x4165bb[_0xc757('0x8')](_0xc757('0x35'),require(_0xc757('0x36')));_0x4165bb[_0xc757('0x8')](_0xc757('0x37'),require(_0xc757('0x38')));_0x4165bb[_0xc757('0x8')]('/api/fax/messages',require(_0xc757('0x39')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3a'),require('./api/faxQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x3b'),require(_0xc757('0x3c')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3d'),require(_0xc757('0x3e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x3f'),require('./api/smsApplication'));_0x4165bb[_0xc757('0x8')](_0xc757('0x40'),require(_0xc757('0x41')));_0x4165bb[_0xc757('0x8')](_0xc757('0x42'),require(_0xc757('0x43')));_0x4165bb[_0xc757('0x8')](_0xc757('0x44'),require(_0xc757('0x45')));_0x4165bb[_0xc757('0x8')](_0xc757('0x46'),require(_0xc757('0x47')));_0x4165bb[_0xc757('0x8')](_0xc757('0x48'),require(_0xc757('0x49')));_0x4165bb['use'](_0xc757('0x4a'),require(_0xc757('0x4b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x4c'),require('./api/openchannelMessage'));_0x4165bb[_0xc757('0x8')](_0xc757('0x4d'),require('./api/openchannelQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x4e'),require(_0xc757('0x4f')));_0x4165bb[_0xc757('0x8')](_0xc757('0x50'),require(_0xc757('0x51')));_0x4165bb[_0xc757('0x8')]('/api/chat/applications',require(_0xc757('0x52')));_0x4165bb['use']('/api/chat/interactions',require(_0xc757('0x53')));_0x4165bb[_0xc757('0x8')](_0xc757('0x54'),require(_0xc757('0x55')));_0x4165bb[_0xc757('0x8')]('/api/chat/offline_messages',require(_0xc757('0x56')));_0x4165bb[_0xc757('0x8')](_0xc757('0x57'),require('./api/chatQueue'));_0x4165bb[_0xc757('0x8')](_0xc757('0x58'),require(_0xc757('0x59')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5a'),require(_0xc757('0x5b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5c'),require('./api/cmCompany'));_0x4165bb['use'](_0xc757('0x5d'),require(_0xc757('0x5e')));_0x4165bb[_0xc757('0x8')](_0xc757('0x5f'),require('./api/cmHopper'));_0x4165bb[_0xc757('0x8')](_0xc757('0x60'),require('./api/cmHopperBlack'));_0x4165bb[_0xc757('0x8')](_0xc757('0x61'),require(_0xc757('0x62')));_0x4165bb['use']('/api/cm/hopper_history',require(_0xc757('0x63')));_0x4165bb['use'](_0xc757('0x64'),require(_0xc757('0x65')));_0x4165bb[_0xc757('0x8')](_0xc757('0x66'),require(_0xc757('0x67')));_0x4165bb[_0xc757('0x8')](_0xc757('0x68'),require(_0xc757('0x69')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6a'),require(_0xc757('0x6b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6c'),require(_0xc757('0x6d')));_0x4165bb[_0xc757('0x8')](_0xc757('0x6e'),require('./api/condition'));_0x4165bb[_0xc757('0x8')](_0xc757('0x6f'),require(_0xc757('0x70')));_0x4165bb['use']('/api/pauses',require(_0xc757('0x71')));_0x4165bb[_0xc757('0x8')]('/api/cdr',require('./api/cdr'));_0x4165bb[_0xc757('0x8')](_0xc757('0x72'),require(_0xc757('0x73')));_0x4165bb['use'](_0xc757('0x74'),require(_0xc757('0x75')));_0x4165bb['use'](_0xc757('0x76'),require(_0xc757('0x77')));_0x4165bb['use']('/api/tags',require(_0xc757('0x78')));_0x4165bb[_0xc757('0x8')](_0xc757('0x79'),require(_0xc757('0x7a')));_0x4165bb[_0xc757('0x8')]('/api/cm_contact_has_items',require(_0xc757('0x7b')));_0x4165bb[_0xc757('0x8')](_0xc757('0x7c'),require(_0xc757('0x7d')));_0x4165bb['use']('/api/templates',require('./api/template'));_0x4165bb[_0xc757('0x8')](_0xc757('0x7e'),require(_0xc757('0x7f')));_0x4165bb[_0xc757('0x8')](_0xc757('0x80'),require(_0xc757('0x81')));_0x4165bb[_0xc757('0x8')]('/api/integrations',require('./api/integration'));_0x4165bb[_0xc757('0x8')](_0xc757('0x82'),require(_0xc757('0x83')));_0x4165bb[_0xc757('0x8')]('/api/analytics/custom_reports',require(_0xc757('0x84')));_0x4165bb[_0xc757('0x8')](_0xc757('0x85'),require(_0xc757('0x86')));_0x4165bb[_0xc757('0x8')](_0xc757('0x87'),require(_0xc757('0x88')));_0x4165bb[_0xc757('0x8')](_0xc757('0x89'),require('./api/analyticMetric'));_0x4165bb[_0xc757('0x8')](_0xc757('0x8a'),require(_0xc757('0x8b')));_0x4165bb['use'](_0xc757('0x8c'),require(_0xc757('0x8d')));_0x4165bb['use'](_0xc757('0x8e'),require(_0xc757('0x8f')));_0x4165bb['use'](_0xc757('0x90'),require(_0xc757('0x91')));_0x4165bb[_0xc757('0x8')]('/api/integrations/salesforce/fields',require(_0xc757('0x92')));_0x4165bb[_0xc757('0x8')](_0xc757('0x93'),require(_0xc757('0x94')));_0x4165bb[_0xc757('0x8')](_0xc757('0x95'),require(_0xc757('0x96')));_0x4165bb[_0xc757('0x8')](_0xc757('0x97'),require(_0xc757('0x98')));_0x4165bb[_0xc757('0x8')]('/api/integrations/desk/accounts',require(_0xc757('0x99')));_0x4165bb['use']('/api/integrations/desk/configurations',require(_0xc757('0x9a')));_0x4165bb[_0xc757('0x8')](_0xc757('0x9b'),require(_0xc757('0x9c')));_0x4165bb['use'](_0xc757('0x9d'),require(_0xc757('0x9e')));_0x4165bb['use'](_0xc757('0x9f'),require(_0xc757('0xa0')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa1'),require('./api/intZohoField'));_0x4165bb[_0xc757('0x8')](_0xc757('0xa2'),require('./api/intZendeskAccount'));_0x4165bb[_0xc757('0x8')]('/api/integrations/zendesk/configurations',require(_0xc757('0xa3')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa4'),require(_0xc757('0xa5')));_0x4165bb['use'](_0xc757('0xa6'),require(_0xc757('0xa7')));_0x4165bb[_0xc757('0x8')](_0xc757('0xa8'),require(_0xc757('0xa9')));_0x4165bb[_0xc757('0x8')](_0xc757('0xaa'),require(_0xc757('0xab')));_0x4165bb[_0xc757('0x8')]('/api/integrations/vtiger/accounts',require(_0xc757('0xac')));_0x4165bb[_0xc757('0x8')]('/api/integrations/vtiger/configurations',require(_0xc757('0xad')));_0x4165bb[_0xc757('0x8')](_0xc757('0xae'),require(_0xc757('0xaf')));_0x4165bb['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4165bb[_0xc757('0x8')](_0xc757('0xb0'),require(_0xc757('0xb1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xb2'),require(_0xc757('0xb3')));_0x4165bb[_0xc757('0x8')](_0xc757('0xb4'),require(_0xc757('0xb5')));_0x4165bb['use'](_0xc757('0xb6'),require('./api/intDynamics365Configuration'));_0x4165bb['use'](_0xc757('0xb7'),require(_0xc757('0xb8')));_0x4165bb['use'](_0xc757('0xb9'),require(_0xc757('0xba')));_0x4165bb['use'](_0xc757('0xbb'),require(_0xc757('0xbc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xbd'),require('./api/intFreshsalesField'));_0x4165bb['use'](_0xc757('0xbe'),require(_0xc757('0xbf')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc0'),require(_0xc757('0xc1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc2'),require('./api/chatInternalMessage'));_0x4165bb['use'](_0xc757('0xc3'),require('./api/jscriptyAnswerReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xc4'),require(_0xc757('0xc5')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc6'),require(_0xc757('0xc7')));_0x4165bb['use']('/api/sms/reports/queue',require(_0xc757('0xc8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xc9'),require('./api/squareReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xca'),require('./api/squareReportDetail'));_0x4165bb['use']('/api/jscripty/projects',require(_0xc757('0xcb')));_0x4165bb[_0xc757('0x8')](_0xc757('0xcc'),require('./api/setting'));_0x4165bb[_0xc757('0x8')](_0xc757('0xcd'),require(_0xc757('0xce')));_0x4165bb[_0xc757('0x8')](_0xc757('0xcf'),require(_0xc757('0xd0')));_0x4165bb[_0xc757('0x8')]('/api/square/recordings',require(_0xc757('0xd1')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd2'),require('./api/squareMessage'));_0x4165bb['use'](_0xc757('0xd3'),require(_0xc757('0xd4')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd5'),require(_0xc757('0xd6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd7'),require('./api/campaign'));_0x4165bb[_0xc757('0x8')]('/api/migrations',require(_0xc757('0xd8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xd9'),require(_0xc757('0xda')));_0x4165bb[_0xc757('0x8')]('/api/plugins',require('./api/plugin'));_0x4165bb[_0xc757('0x8')](_0xc757('0xdb'),require(_0xc757('0xdc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xdd'),require('./api/chatTransferReport'));_0x4165bb[_0xc757('0x8')](_0xc757('0xde'),require('./api/faxTransferReport'));_0x4165bb[_0xc757('0x8')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x4165bb['use'](_0xc757('0xdf'),require(_0xc757('0xe0')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe1'),require(_0xc757('0xe2')));_0x4165bb['use'](_0xc757('0xe3'),require(_0xc757('0xe4')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe5'),require(_0xc757('0xe6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe7'),require(_0xc757('0xe8')));_0x4165bb[_0xc757('0x8')](_0xc757('0xe9'),require(_0xc757('0xea')));_0x4165bb[_0xc757('0x8')](_0xc757('0xeb'),require(_0xc757('0xec')));_0x4165bb[_0xc757('0x8')](_0xc757('0xed'),require(_0xc757('0xee')));_0x4165bb[_0xc757('0x8')](_0xc757('0xef'),require(_0xc757('0xf0')));_0x4165bb['use'](_0xc757('0xf1'),require(_0xc757('0xf2')));_0x4165bb[_0xc757('0x8')]('/api/whatsapp/messages',require(_0xc757('0xf3')));_0x4165bb['use'](_0xc757('0xf4'),require(_0xc757('0xf5')));_0x4165bb['use']('/api/whatsapp/reports/transfer',require(_0xc757('0xf6')));_0x4165bb[_0xc757('0x8')](_0xc757('0xf7'),require(_0xc757('0xf8')));_0x4165bb[_0xc757('0x8')]('/api/cloudProviders',require(_0xc757('0xf9')));_0x4165bb[_0xc757('0x8')](_0xc757('0xfa'),require(_0xc757('0xfb')));_0x4165bb['use']('/api/user-settings',require(_0xc757('0xfc')));_0x4165bb[_0xc757('0x8')](_0xc757('0xfd'),require(_0xc757('0xfe')));_0x4165bb[_0xc757('0x8')](_0xc757('0xff'),require(_0xc757('0x100')));_0x4165bb[_0xc757('0x8')](_0xc757('0x101'),require(_0xc757('0x102')));_0x4165bb[_0xc757('0x8')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4165bb[_0xc757('0x8')](_0xc757('0x103'),require(_0xc757('0x104')));_0x4165bb['use']('/api/rpc',require('./api/rpc'));_0x4165bb['use'](_0xc757('0x105'),require(_0xc757('0x106')));_0x4165bb[_0xc757('0x8')]('/api/system',require(_0xc757('0x107')));_0x4165bb[_0xc757('0x8')]('/api/pm2',require(_0xc757('0x108')));_0x4165bb[_0xc757('0x8')](_0xc757('0x109'),require(_0xc757('0x10a')));_0x4165bb[_0xc757('0x8')](_0xc757('0x10b'),clientSideLogs);_0x4165bb[_0xc757('0x8')](_0xc757('0x10c'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x10c'))));_0x4165bb['use'](_0xc757('0x110'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x110'))));_0x4165bb[_0xc757('0x8')](_0xc757('0x111'),express[_0xc757('0x10d')](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x111'))));_0x4165bb['use'](_0xc757('0x112'),express['static'](path[_0xc757('0x10e')](config[_0xc757('0x10f')],_0xc757('0x113'),'3.9.0')));_0x4165bb[_0xc757('0x8')](_0xc757('0x114'),express[_0xc757('0x10d')](path['join'](config[_0xc757('0x10f')],_0xc757('0x115'))));_0x4165bb[_0xc757('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc757('0x117')](errors[0x194]);_0x4165bb[_0xc757('0x116')]('/*')[_0xc757('0x117')](function(_0x2fd7bc,_0x3d21ff){_0x3d21ff['sendFile'](path['resolve'](_0x4165bb[_0xc757('0x117')]('appPath')+'/index.html'));});return _0x4165bb;});}; \ No newline at end of file +var _0xb253=['./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','/www','join','/demo','root','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./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/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/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/cmHopperFinal','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports'];(function(_0x4b9640,_0x378b28){var _0x122600=function(_0x2784ff){while(--_0x2784ff){_0x4b9640['push'](_0x4b9640['shift']());}};_0x122600(++_0x378b28);}(_0xb253,0x190));var _0x3b25=function(_0x173fdf,_0x1ba573){_0x173fdf=_0x173fdf-0x0;var _0x147b6d=_0xb253[_0x173fdf];return _0x147b6d;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x3b25('0x0'));var config=require(_0x3b25('0x1'));var setupLoggers=require(_0x3b25('0x2'))[_0x3b25('0x3')];var clientSideLogs=require(_0x3b25('0x4'));exports['default']=function(_0x38344f){return setupLoggers(_0x38344f)[_0x3b25('0x5')](function(){_0x38344f['use'](_0x3b25('0x6'),require(_0x3b25('0x7')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x9'),require(_0x3b25('0xa')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xb'),require(_0x3b25('0xc')));_0x38344f['use']('/api/voice/extensions',require(_0x3b25('0xd')));_0x38344f[_0x3b25('0x8')]('/api/voice/mohs',require(_0x3b25('0xe')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xf'),require(_0x3b25('0x10')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x11'),require(_0x3b25('0x12')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x13'),require(_0x3b25('0x14')));_0x38344f[_0x3b25('0x8')]('/api/voice/mails',require(_0x3b25('0x15')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x16'),require(_0x3b25('0x17')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x18'),require('./api/voiceCallReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x19'),require(_0x3b25('0x1a')));_0x38344f[_0x3b25('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x1b'),require(_0x3b25('0x1c')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x1d'),require('./api/memberReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x1e'),require('./api/trunk'));_0x38344f['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x1f'),require(_0x3b25('0x20')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x21'),require(_0x3b25('0x22')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x23'),require('./api/mailQueue'));_0x38344f[_0x3b25('0x8')]('/api/mail/substatuses',require(_0x3b25('0x24')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x25'),require(_0x3b25('0x26')));_0x38344f['use']('/api/mail/messages',require(_0x3b25('0x27')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x28'),require(_0x3b25('0x29')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x2a'),require(_0x3b25('0x2b')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x2c'),require('./api/dashboard'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x2d'),require('./api/dashboardItem'));_0x38344f['use']('/api/fax/accounts',require(_0x3b25('0x2e')));_0x38344f[_0x3b25('0x8')]('/api/fax/applications',require(_0x3b25('0x2f')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x30'),require(_0x3b25('0x31')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x32'),require(_0x3b25('0x33')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x34'),require(_0x3b25('0x35')));_0x38344f['use'](_0x3b25('0x36'),require('./api/faxQueueReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x37'),require('./api/smsAccount'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x38'),require(_0x3b25('0x39')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x3a'),require(_0x3b25('0x3b')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x3c'),require('./api/smsMessage'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x3d'),require(_0x3b25('0x3e')));_0x38344f['use'](_0x3b25('0x3f'),require(_0x3b25('0x40')));_0x38344f['use'](_0x3b25('0x41'),require('./api/openchannelApplication'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x42'),require(_0x3b25('0x43')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x44'),require(_0x3b25('0x45')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x46'),require(_0x3b25('0x47')));_0x38344f['use'](_0x3b25('0x48'),require(_0x3b25('0x49')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x4a'),require(_0x3b25('0x4b')));_0x38344f[_0x3b25('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x38344f['use'](_0x3b25('0x4c'),require(_0x3b25('0x4d')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x4e'),require('./api/chatMessage'));_0x38344f['use'](_0x3b25('0x4f'),require('./api/chatOfflineMessage'));_0x38344f['use'](_0x3b25('0x50'),require(_0x3b25('0x51')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x52'),require(_0x3b25('0x53')));_0x38344f['use'](_0x3b25('0x54'),require(_0x3b25('0x55')));_0x38344f[_0x3b25('0x8')]('/api/cm/companies',require(_0x3b25('0x56')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x57'),require(_0x3b25('0x58')));_0x38344f[_0x3b25('0x8')]('/api/cm/hopper',require(_0x3b25('0x59')));_0x38344f['use'](_0x3b25('0x5a'),require(_0x3b25('0x5b')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x5c'),require(_0x3b25('0x5d')));_0x38344f['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x38344f['use'](_0x3b25('0x5e'),require('./api/cmCustomField'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x5f'),require(_0x3b25('0x60')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x61'),require(_0x3b25('0x62')));_0x38344f[_0x3b25('0x8')]('/api/canned_answers',require(_0x3b25('0x63')));_0x38344f['use']('/api/dispositions',require('./api/disposition'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x64'),require(_0x3b25('0x65')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x66'),require(_0x3b25('0x67')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x68'),require(_0x3b25('0x69')));_0x38344f[_0x3b25('0x8')]('/api/cdr',require(_0x3b25('0x6a')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x6b'),require('./api/voiceQueuesLog'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x6c'),require(_0x3b25('0x6d')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x6e'),require('./api/sound'));_0x38344f[_0x3b25('0x8')]('/api/tags',require(_0x3b25('0x6f')));_0x38344f[_0x3b25('0x8')]('/api/contact_item_types',require(_0x3b25('0x70')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x71'),require('./api/cmContactHasItem'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x72'),require(_0x3b25('0x73')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x74'),require('./api/template'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x75'),require('./api/trigger'));_0x38344f['use'](_0x3b25('0x76'),require(_0x3b25('0x77')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x78'),require('./api/integration'));_0x38344f[_0x3b25('0x8')]('/api/integrations/reports',require(_0x3b25('0x79')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x7a'),require(_0x3b25('0x7b')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x7c'),require(_0x3b25('0x7d')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x7e'),require(_0x3b25('0x7f')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x80'),require('./api/analyticMetric'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x81'),require(_0x3b25('0x82')));_0x38344f[_0x3b25('0x8')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x83'),require('./api/intSalesforceAccount'));_0x38344f[_0x3b25('0x8')]('/api/integrations/salesforce/configurations',require(_0x3b25('0x84')));_0x38344f['use']('/api/integrations/salesforce/fields',require(_0x3b25('0x85')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x86'),require(_0x3b25('0x87')));_0x38344f[_0x3b25('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x3b25('0x88')));_0x38344f['use'](_0x3b25('0x89'),require(_0x3b25('0x8a')));_0x38344f['use'](_0x3b25('0x8b'),require(_0x3b25('0x8c')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x8d'),require(_0x3b25('0x8e')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x8f'),require(_0x3b25('0x90')));_0x38344f[_0x3b25('0x8')]('/api/integrations/zoho/accounts',require(_0x3b25('0x91')));_0x38344f['use'](_0x3b25('0x92'),require(_0x3b25('0x93')));_0x38344f[_0x3b25('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x94'),require(_0x3b25('0x95')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x96'),require(_0x3b25('0x97')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x98'),require(_0x3b25('0x99')));_0x38344f['use'](_0x3b25('0x9a'),require('./api/intFreshdeskAccount'));_0x38344f[_0x3b25('0x8')]('/api/integrations/freshdesk/configurations',require(_0x3b25('0x9b')));_0x38344f[_0x3b25('0x8')](_0x3b25('0x9c'),require('./api/intFreshdeskField'));_0x38344f[_0x3b25('0x8')]('/api/integrations/vtiger/accounts',require(_0x3b25('0x9d')));_0x38344f['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x38344f[_0x3b25('0x8')](_0x3b25('0x9e'),require(_0x3b25('0x9f')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xa0'),require(_0x3b25('0xa1')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xa2'),require(_0x3b25('0xa3')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xa4'),require(_0x3b25('0xa5')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xa6'),require(_0x3b25('0xa7')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xa8'),require(_0x3b25('0xa9')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xaa'),require('./api/intDynamics365Field'));_0x38344f[_0x3b25('0x8')]('/api/integrations/freshsales/accounts',require(_0x3b25('0xab')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xac'),require(_0x3b25('0xad')));_0x38344f['use'](_0x3b25('0xae'),require(_0x3b25('0xaf')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xb0'),require(_0x3b25('0xb1')));_0x38344f['use'](_0x3b25('0xb2'),require(_0x3b25('0xb3')));_0x38344f[_0x3b25('0x8')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x38344f[_0x3b25('0x8')]('/api/jscripty/answers/reports',require(_0x3b25('0xb4')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xb5'),require(_0x3b25('0xb6')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xb7'),require(_0x3b25('0xb8')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xb9'),require('./api/smsQueueReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xba'),require(_0x3b25('0xbb')));_0x38344f['use'](_0x3b25('0xbc'),require(_0x3b25('0xbd')));_0x38344f['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xbe'),require(_0x3b25('0xbf')));_0x38344f['use']('/api/square/odbc',require(_0x3b25('0xc0')));_0x38344f['use'](_0x3b25('0xc1'),require(_0x3b25('0xc2')));_0x38344f[_0x3b25('0x8')]('/api/square/recordings',require(_0x3b25('0xc3')));_0x38344f[_0x3b25('0x8')]('/api/square/messages',require(_0x3b25('0xc4')));_0x38344f['use'](_0x3b25('0xc5'),require(_0x3b25('0xc6')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xc7'),require(_0x3b25('0xc8')));_0x38344f[_0x3b25('0x8')]('/api/campaigns',require(_0x3b25('0xc9')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xca'),require('./api/migration'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xcb'),require('./api/attachment'));_0x38344f[_0x3b25('0x8')]('/api/plugins',require(_0x3b25('0xcc')));_0x38344f[_0x3b25('0x8')]('/api/mail/reports/transfer',require(_0x3b25('0xcd')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xce'),require(_0x3b25('0xcf')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xd0'),require(_0x3b25('0xd1')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xd2'),require(_0x3b25('0xd3')));_0x38344f['use'](_0x3b25('0xd4'),require(_0x3b25('0xd5')));_0x38344f['use']('/api/cm/lists',require(_0x3b25('0xd6')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xd7'),require(_0x3b25('0xd8')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xd9'),require(_0x3b25('0xda')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xdb'),require(_0x3b25('0xdc')));_0x38344f[_0x3b25('0x8')]('/api/userProfile/resources',require(_0x3b25('0xdd')));_0x38344f['use']('/api/userNotifications',require(_0x3b25('0xde')));_0x38344f[_0x3b25('0x8')]('/api/whatsapp/accounts',require(_0x3b25('0xdf')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xe0'),require(_0x3b25('0xe1')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xe2'),require(_0x3b25('0xe3')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xe4'),require('./api/whatsappMessage'));_0x38344f['use'](_0x3b25('0xe5'),require('./api/whatsappQueueReport'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xe6'),require(_0x3b25('0xe7')));_0x38344f[_0x3b25('0x8')]('/api/whatsapp/queues',require(_0x3b25('0xe8')));_0x38344f['use'](_0x3b25('0xe9'),require('./api/cloudProvider'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xea'),require('./api/realtime'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xeb'),require(_0x3b25('0xec')));_0x38344f[_0x3b25('0x8')]('/api/mail_interaction_has_tags',require(_0x3b25('0xed')));_0x38344f[_0x3b25('0x8')]('/api/auth/local',require('./api/authLocal'));_0x38344f[_0x3b25('0x8')](_0x3b25('0xee'),require(_0x3b25('0xef')));_0x38344f['use'](_0x3b25('0xf0'),require(_0x3b25('0xf1')));_0x38344f[_0x3b25('0x8')]('/api/jira',require('./api/jira'));_0x38344f['use'](_0x3b25('0xf2'),require('./api/rpc'));_0x38344f[_0x3b25('0x8')]('/api/version',require(_0x3b25('0xf3')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xf4'),require(_0x3b25('0xf5')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xf6'),require(_0x3b25('0xf7')));_0x38344f[_0x3b25('0x8')]('/api/webbar',require(_0x3b25('0xf8')));_0x38344f['use']('/api/logs',clientSideLogs);_0x38344f['use'](_0x3b25('0xf9'),express[_0x3b25('0xfa')](path['join'](config['root'],_0x3b25('0xf9'))));_0x38344f[_0x3b25('0x8')](_0x3b25('0xfb'),express[_0x3b25('0xfa')](path[_0x3b25('0xfc')](config['root'],_0x3b25('0xfb'))));_0x38344f[_0x3b25('0x8')](_0x3b25('0xfd'),express['static'](path['join'](config[_0x3b25('0xfe')],'/demo')));_0x38344f[_0x3b25('0x8')](_0x3b25('0xff'),express['static'](path[_0x3b25('0xfc')](config[_0x3b25('0xfe')],_0x3b25('0x100'),_0x3b25('0x101'))));_0x38344f[_0x3b25('0x8')](_0x3b25('0x102'),express[_0x3b25('0xfa')](path[_0x3b25('0xfc')](config[_0x3b25('0xfe')],_0x3b25('0x103'))));_0x38344f[_0x3b25('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x3b25('0x105')](errors[0x194]);_0x38344f[_0x3b25('0x104')]('/*')[_0x3b25('0x105')](function(_0x2eb044,_0x556032){_0x556032['sendFile'](path[_0x3b25('0x106')](_0x38344f[_0x3b25('0x105')](_0x3b25('0x107'))+_0x3b25('0x108')));});return _0x38344f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8af4d63..6db2ca3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8e9=['../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.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/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../api/user/user.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x12fe56,_0x4930a1){var _0x10aa14=function(_0x4666f6){while(--_0x4666f6){_0x12fe56['push'](_0x12fe56['shift']());}};_0x10aa14(++_0x4930a1);}(_0xc8e9,0x18c));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var _=require(_0x9c8e('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x243a0d,_0xe09bc4){var _0x730907={};_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x1')));_0x730907=_['merge'](_0x730907,require('../api/voiceExtension/voiceExtension.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/voiceQueue/voiceQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x3')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x4')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x5')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x6')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x7')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x8')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x9')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xa')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xb')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xc')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/mailQueue/mailQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xd')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xe')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/mailApplication/mailApplication.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0xf')));_0x730907=_['merge'](_0x730907,require('../api/faxAccount/faxAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x10')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x11')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x12')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x13')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x14')));_0x730907=_['merge'](_0x730907,require('../api/smsAccount/smsAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x15')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x16')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x17')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x18')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x19')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1a')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1b')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1c')));_0x730907=_['merge'](_0x730907,require('../api/chatMessage/chatMessage.rpc'));_0x730907=_['merge'](_0x730907,require('../api/chatQueue/chatQueue.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/cmContact/cmContact.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x1d')));_0x730907=_['merge'](_0x730907,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1e')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x1f')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x20')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/pause/pause.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x21')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x22')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x23')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/trigger/trigger.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x24')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x25')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x26')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x27')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x28')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x29')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x2a')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2b')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2c')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x2d')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2e')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x2f')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x30')));_0x730907=_['merge'](_0x730907,require('../api/setting/setting.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x31')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x32')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/squareRecording/squareRecording.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x33')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x34')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x35')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x36')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x37')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x38')));_0x730907=_['merge'](_0x730907,require(_0x9c8e('0x39')));_0x730907=_[_0x9c8e('0x2')](_0x730907,require(_0x9c8e('0x3a')));var _0x1b91c5=jayson['server'](_0x730907)[_0x9c8e('0x3b')]();var _0x587811=config[_0x9c8e('0x3c')]['port']||config[_0x9c8e('0x3d')]+0x1;var _0x551358=config[_0x9c8e('0x3c')]['ip']||'localhost';_0x1b91c5['on'](_0x9c8e('0x3e'),function(_0x33ce50){return _0xe09bc4(_0x33ce50);});_0x1b91c5[_0x9c8e('0x3f')](_0x587811,_0x551358,function(){console[_0x9c8e('0x40')](_0x9c8e('0x41'),_0x551358,_0x587811);require(_0x9c8e('0x42'))[_0x9c8e('0x43')]();return _0x243a0d(_0x9c8e('0x44')+_0x551358+':'+_0x587811);});});}; \ No newline at end of file +var _0x7a0b=['../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.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/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment'];(function(_0x273422,_0x11abe1){var _0x144440=function(_0x257f41){while(--_0x257f41){_0x273422['push'](_0x273422['shift']());}};_0x144440(++_0x11abe1);}(_0x7a0b,0x85));var _0xb7a0=function(_0x505978,_0x4010b6){_0x505978=_0x505978-0x0;var _0x2368bf=_0x7a0b[_0x505978];return _0x2368bf;};'use strict';var jayson=require(_0xb7a0('0x0'));var _=require(_0xb7a0('0x1'));var config=require(_0xb7a0('0x2'));exports['listen']=function(){return new Promise(function(_0x47644a,_0x2f6169){var _0x1d59a4={};_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x3')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x5')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x6')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x7')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x8')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x9')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xa')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xb')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xc')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xd')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xe')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0xf')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x10')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x11')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x12')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x13')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/faxAccount/faxAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x14')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x15')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x16')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x17')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x18')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x19')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x1a')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x1b')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/smsQueue/smsQueue.rpc'));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x1c')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x1d')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x1e')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x1f')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x20')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x21')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x22')));_0x1d59a4=_['merge'](_0x1d59a4,require('../api/chatQueue/chatQueue.rpc'));_0x1d59a4=_['merge'](_0x1d59a4,require('../api/cmContact/cmContact.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/cmHopper/cmHopper.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x23')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x24')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x25')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/pause/pause.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/sound/sound.rpc'));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x26')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x27')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x28')));_0x1d59a4=_['merge'](_0x1d59a4,require('../api/variable/variable.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x29')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x2a')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x2b')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x2c')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x2d')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x2e')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x2f')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/squareReport/squareReport.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x30')));_0x1d59a4=_['merge'](_0x1d59a4,require(_0xb7a0('0x31')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x32')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x33')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x34')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x35')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require('../api/campaign/campaign.rpc'));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x36')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x37')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x38')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x39')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x3a')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x3b')));_0x1d59a4=_[_0xb7a0('0x4')](_0x1d59a4,require(_0xb7a0('0x3c')));var _0x77755e=jayson[_0xb7a0('0x3d')](_0x1d59a4)[_0xb7a0('0x3e')]();var _0x6c9bf6=config[_0xb7a0('0x3f')][_0xb7a0('0x40')]||config[_0xb7a0('0x40')]+0x1;var _0x4b64f7=config['rpc']['ip']||_0xb7a0('0x41');_0x77755e['on']('error',function(_0x2f9874){return _0x2f6169(_0x2f9874);});_0x77755e['listen'](_0x6c9bf6,_0x4b64f7,function(){console['log'](_0xb7a0('0x42'),_0x4b64f7,_0x6c9bf6);require('../config/triggers')[_0xb7a0('0x43')]();return _0x47644a('RPC\x20listening\x20on\x20'+_0x4b64f7+':'+_0x6c9bf6);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0b125c4..0081086 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 _0x1a0e=['length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split'];(function(_0x125843,_0x4551be){var _0x92d9ed=function(_0x223c66){while(--_0x223c66){_0x125843['push'](_0x125843['shift']());}};_0x92d9ed(++_0x4551be);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0x1a0e[_0x5ec09b];return _0x5a8482;};'use strict';var util=require(_0xe1a0('0x0'));var _=require(_0xe1a0('0x1'));var EventEmitter=require(_0xe1a0('0x2'))[_0xe1a0('0x3')];var AGIReply=require(_0xe1a0('0x4'));var AGIError=require(_0xe1a0('0x5'));function AGIChannel(_0x3c3334){var _0x484ced=this,_0x42f060=new AGIReply(),_0x5602cf=![],_0x47c1bc={};EventEmitter['call'](_0x484ced);_0x3c3334[_0xe1a0('0x6')](_0xe1a0('0x7'));_0x3c3334[_0xe1a0('0x8')](0x8*0x3c*0x3c*0x3e8);_0x42f060[_0xe1a0('0x6')](_0xe1a0('0x7'));_0x42f060['on'](_0xe1a0('0x9'),function(_0x217653){for(var _0x10d66a in _0x217653){_0x484ced[_0x10d66a]=_0x217653[_0x10d66a];}_0x484ced[_0xe1a0('0xa')](_0xe1a0('0xb'));});_0x42f060['on'](_0xe1a0('0xc'),function(_0x3728d9){if(_0x3728d9[_0xe1a0('0xd')]()=='hangup'){_0x484ced[_0xe1a0('0xa')]('hangup');return;}if(_0x3728d9[_0xe1a0('0xe')](0x0,0xb)==_0xe1a0('0xf')){_0x5602cf=!![];}if(_0x5602cf){_0x47c1bc['rx']+=_0x3728d9+'\x0a';if(_0x3728d9[_0xe1a0('0x10')](_0xe1a0('0x11'))!=-0x1){_0x5602cf=![];}}else{_0x47c1bc['rx']=_0x3728d9;}if(_0x5602cf){return;}if(typeof _0x47c1bc['cb']==_0xe1a0('0x12')){var _0x3550bc=_0x47c1bc['rx']['substring'](0x0,0x3),_0x2ea844=null,_0x46c37d=null;_0x3550bc=parseInt(_0x3550bc);if(isNaN(_0x3550bc)){_0x47c1bc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe1a0('0x13')});return;}if(_0x3550bc!=0xc8){_0x47c1bc['cb'](null,{'code':_0x3550bc,'result':-0x1,'extra':'KO'});return;}_0x2ea844=_0x47c1bc['rx']['substring'](0x4)[_0xe1a0('0x14')](_0xe1a0('0x15'),'');if(_0x2ea844['indexOf']('\x20')!=-0x1){_0x2ea844=_0x2ea844[_0xe1a0('0x16')](0x0,_0x2ea844[_0xe1a0('0x17')]('\x20'));}if(_[_0xe1a0('0x18')](_0x2ea844,'-1')){_0x2ea844=parseInt(_0x2ea844);}_0x46c37d=_0x47c1bc['rx'][_0xe1a0('0x19')]('\x20');if(_0x46c37d[_0xe1a0('0x1a')]==0x3){_0x46c37d=_0x46c37d[0x2]['substring'](0x1,_0x46c37d[0x2][_0xe1a0('0x1a')]-0x1);}else if(_0x46c37d[_0xe1a0('0x1a')]>0x3){var _0x68e039=/\((.+)\)/;var _0x2866ae=_0x47c1bc['rx'][_0xe1a0('0x1b')](_0x68e039);if(_0x2866ae){_0x46c37d=_0x2866ae[0x1];}else{_0x46c37d=null;}}else{_0x46c37d=null;}_0x47c1bc['cb'](null,{'code':_0x3550bc,'result':_0x2ea844,'extra':_0x46c37d});}});_0x3c3334['on'](_0xe1a0('0x1c'),function(_0x40856a){_0x484ced[_0xe1a0('0xa')](_0xe1a0('0x1c'),new AGIError(_0xe1a0('0x1d'),_0x40856a[_0xe1a0('0x1e')]));});_0x3c3334['on'](_0xe1a0('0x1f'),function(){_0x484ced['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3c3334['on'](_0xe1a0('0x20'),function(){_0x484ced[_0xe1a0('0xa')](_0xe1a0('0x20'),new AGIError(_0xe1a0('0x21')));_0x3c3334['destroy']();});_0x3c3334[_0xe1a0('0x22')](_0x42f060);this[_0xe1a0('0x23')]=function(_0x54bfe1,_0x167244){var _0x54bfe1=_0x54bfe1||'',_0x167244=typeof _0x167244==_0xe1a0('0x12')?_0x167244:new Function();_0x47c1bc={'tx':_0x54bfe1,'rx':'','cb':_0x167244};_0x3c3334[_0xe1a0('0x24')](_0x54bfe1+'\x0a');},this[_0xe1a0('0x1f')]=function(){_0x3c3334[_0xe1a0('0x25')]();};}util[_0xe1a0('0x26')](AGIChannel,EventEmitter);AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x28')]=function(_0x28a29e){return this['command'][_0xe1a0('0x29')](this,_0x28a29e);};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2a')]=function(){return this[_0xe1a0('0x28')](_0xe1a0('0x2b'));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2c')]=function(_0x1351a4,_0x1a8b7f,_0x34adb4){_0x1351a4=_0x1351a4===undefined?_0xe1a0('0x2d'):_0x1351a4;_0x1a8b7f=_0x1a8b7f===undefined?'5':_0x1a8b7f;_0x34adb4=_0x34adb4===undefined?'1':_0x34adb4;return this[_0xe1a0('0x28')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1351a4,_0x1a8b7f*0x3e8,_0x34adb4));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x2e')]=function(_0x47edf4){_0x47edf4=_0x47edf4||_0xe1a0('0x2f');return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')]('VERBOSE\x20\x22%s\x22',_0x47edf4));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x31')]=function(_0x9c87be,_0x312c96){if(_['isArray'](_0x312c96)){return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x32'),_0x9c87be,_0x312c96['join'](',')));}return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x32'),_0x9c87be,_0x312c96));};AGIChannel[_0xe1a0('0x27')]['setContext']=function(_0x47882a){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x33'),_0x47882a));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x34')]=function(_0x462b59){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')]('SET\x20EXTENSION\x20%s',_0x462b59));};AGIChannel['prototype'][_0xe1a0('0x35')]=function(_0x17d5bc){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x36'),_0x17d5bc));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x37')]=function(){return this[_0xe1a0('0x28')](_0xe1a0('0x38'));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x39')]=function(_0x184508,_0x480826){var _0x3ce6ec=_[_0xe1a0('0x3a')](_0x480826)||_[_0xe1a0('0x3b')](_0x480826)?_0x480826[_0xe1a0('0x3c')]():_0x480826;return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x3d'),_0x184508,_0x3ce6ec?_0x3ce6ec[_0xe1a0('0x3c')]()[_0xe1a0('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x3e')]=function(_0x9c0c95,_0x3430ec){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x3f'),_0x9c0c95,_0x3430ec));};AGIChannel['prototype'][_0xe1a0('0x40')]=function(_0x5769e9,_0x545d2a){return this[_0xe1a0('0x28')](util['format'](_0xe1a0('0x41'),_0x5769e9,_0x545d2a));};AGIChannel['prototype'][_0xe1a0('0x42')]=function(_0x591266,_0xf9260){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x43'),_0x591266,_0xf9260));};AGIChannel[_0xe1a0('0x27')]['continueAt']=function(_0x5147b5,_0x199a4b,_0x3150fd){_0x199a4b=_0x199a4b||this[_0xe1a0('0x44')];_0x3150fd=_0x3150fd||0x1;this[_0xe1a0('0x45')](_0x5147b5);this[_0xe1a0('0x34')](_0x199a4b);this[_0xe1a0('0x35')](_0x3150fd);return this[_0xe1a0('0x2e')](util[_0xe1a0('0x30')](_0xe1a0('0x46'),_0x5147b5,_0x199a4b,_0x3150fd));};AGIChannel['prototype']['getVariable']=function(_0x560dd0){return this[_0xe1a0('0x28')](util[_0xe1a0('0x30')](_0xe1a0('0x47'),_0x560dd0));};AGIChannel[_0xe1a0('0x27')]['recordFile']=function(_0x3ba427,_0x3d67f3,_0x45c037,_0x5ce0ab,_0x3d9a93,_0x41b7a0){_0x3d67f3=_0x3d67f3||'wav';_0x45c037=_0x45c037||'';_0x5ce0ab=_0x5ce0ab===undefined?-0x1:_0x5ce0ab==='-1'?-0x1:_0x5ce0ab*0x3e8;_0x3d9a93=_0x3d9a93===undefined?'':'s='+_0x3d9a93;_0x41b7a0=_0x41b7a0?'BEEP':'';return this[_0xe1a0('0x28')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3ba427,_0x3d67f3,_0x45c037,_0x5ce0ab,_0x41b7a0,_0x3d9a93));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x48')]=function(_0x55c016,_0x340595){_0x340595=_0x340595||'';return this['sendRequest'](util['format'](_0xe1a0('0x49'),_0x55c016,_0x340595));};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x4a')]=function(_0x2d4469){return this[_0xe1a0('0x31')](_0xe1a0('0x4b'),_0x2d4469);};AGIChannel[_0xe1a0('0x27')][_0xe1a0('0x4c')]=function(_0x41ea14){return this['exec'](_0xe1a0('0x4d'),_0x41ea14);};AGIChannel[_0xe1a0('0x27')]['error']=function(_0x1e559d,_0x14d46b){this['noop'](util['format'](_0xe1a0('0x4e'),_0x1e559d['id'],_0x1e559d[_0xe1a0('0x4f')],_0x14d46b));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x83de=['streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','exports','lodash','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','ready','hangup','emit','520-Invalid','search','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','pipe','command','write','inherits','sendRequest','sync','prototype','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','BEEP'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x83de,0x116));var _0xe83d=function(_0x247ef0,_0x30a308){_0x247ef0=_0x247ef0-0x0;var _0x46ca52=_0x83de[_0x247ef0];return _0x46ca52;};'use strict';var util=require('util');var _=require(_0xe83d('0x0'));var EventEmitter=require('events')[_0xe83d('0x1')];var AGIReply=require(_0xe83d('0x2'));var AGIError=require('./error');function AGIChannel(_0x430999){var _0x260632=this,_0x15d7cb=new AGIReply(),_0x5c7411=![],_0x5d8704={};EventEmitter[_0xe83d('0x3')](_0x260632);_0x430999[_0xe83d('0x4')](_0xe83d('0x5'));_0x430999[_0xe83d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x15d7cb['setEncoding']('utf8');_0x15d7cb['on'](_0xe83d('0x7'),function(_0x1d6fc0){for(var _0xa747c0 in _0x1d6fc0){_0x260632[_0xa747c0]=_0x1d6fc0[_0xa747c0];}_0x260632['emit'](_0xe83d('0x8'));});_0x15d7cb['on']('line',function(_0x5611f3){if(_0x5611f3['toLowerCase']()==_0xe83d('0x9')){_0x260632[_0xe83d('0xa')](_0xe83d('0x9'));return;}if(_0x5611f3['substring'](0x0,0xb)==_0xe83d('0xb')){_0x5c7411=!![];}if(_0x5c7411){_0x5d8704['rx']+=_0x5611f3+'\x0a';if(_0x5611f3[_0xe83d('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x5c7411=![];}}else{_0x5d8704['rx']=_0x5611f3;}if(_0x5c7411){return;}if(typeof _0x5d8704['cb']==_0xe83d('0xd')){var _0x5dd8b3=_0x5d8704['rx'][_0xe83d('0xe')](0x0,0x3),_0xe0b944=null,_0x91619a=null;_0x5dd8b3=parseInt(_0x5dd8b3);if(isNaN(_0x5dd8b3)){_0x5d8704['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe83d('0xf')});return;}if(_0x5dd8b3!=0xc8){_0x5d8704['cb'](null,{'code':_0x5dd8b3,'result':-0x1,'extra':'KO'});return;}_0xe0b944=_0x5d8704['rx'][_0xe83d('0xe')](0x4)[_0xe83d('0x10')](_0xe83d('0x11'),'');if(_0xe0b944[_0xe83d('0x12')]('\x20')!=-0x1){_0xe0b944=_0xe0b944[_0xe83d('0x13')](0x0,_0xe0b944['indexOf']('\x20'));}if(_[_0xe83d('0x14')](_0xe0b944,'-1')){_0xe0b944=parseInt(_0xe0b944);}_0x91619a=_0x5d8704['rx']['split']('\x20');if(_0x91619a[_0xe83d('0x15')]==0x3){_0x91619a=_0x91619a[0x2][_0xe83d('0xe')](0x1,_0x91619a[0x2][_0xe83d('0x15')]-0x1);}else if(_0x91619a[_0xe83d('0x15')]>0x3){var _0x21222b=/\((.+)\)/;var _0x49fc73=_0x5d8704['rx'][_0xe83d('0x16')](_0x21222b);if(_0x49fc73){_0x91619a=_0x49fc73[0x1];}else{_0x91619a=null;}}else{_0x91619a=null;}_0x5d8704['cb'](null,{'code':_0x5dd8b3,'result':_0xe0b944,'extra':_0x91619a});}});_0x430999['on'](_0xe83d('0x17'),function(_0x1d3cc3){_0x260632[_0xe83d('0xa')](_0xe83d('0x17'),new AGIError(_0xe83d('0x18'),_0x1d3cc3[_0xe83d('0x19')]));});_0x430999['on']('close',function(){_0x260632[_0xe83d('0xa')](_0xe83d('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x430999['on'](_0xe83d('0x1b'),function(){_0x260632[_0xe83d('0xa')](_0xe83d('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x430999['destroy']();});_0x430999[_0xe83d('0x1c')](_0x15d7cb);this[_0xe83d('0x1d')]=function(_0x1659c7,_0x57bb5f){var _0x1659c7=_0x1659c7||'',_0x57bb5f=typeof _0x57bb5f==_0xe83d('0xd')?_0x57bb5f:new Function();_0x5d8704={'tx':_0x1659c7,'rx':'','cb':_0x57bb5f};_0x430999[_0xe83d('0x1e')](_0x1659c7+'\x0a');},this[_0xe83d('0x1a')]=function(){_0x430999['destroy']();};}util[_0xe83d('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe83d('0x20')]=function(_0x3b2f0d){return this[_0xe83d('0x1d')][_0xe83d('0x21')](this,_0x3b2f0d);};AGIChannel[_0xe83d('0x22')]['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0xe83d('0x22')][_0xe83d('0x23')]=function(_0x5e14fb,_0xe35a94,_0x32c74d){_0x5e14fb=_0x5e14fb===undefined?'beep':_0x5e14fb;_0xe35a94=_0xe35a94===undefined?'5':_0xe35a94;_0x32c74d=_0x32c74d===undefined?'1':_0x32c74d;return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x25'),_0x5e14fb,_0xe35a94*0x3e8,_0x32c74d));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x26')]=function(_0x58fd1b){_0x58fd1b=_0x58fd1b||'NO\x20MESSAGE';return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x27'),_0x58fd1b));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x28')]=function(_0x3eaa06,_0x417159){if(_[_0xe83d('0x29')](_0x417159)){return this['sendRequest'](util[_0xe83d('0x24')](_0xe83d('0x2a'),_0x3eaa06,_0x417159['join'](',')));}return this['sendRequest'](util[_0xe83d('0x24')](_0xe83d('0x2a'),_0x3eaa06,_0x417159));};AGIChannel[_0xe83d('0x22')]['setContext']=function(_0x3b89ef){return this[_0xe83d('0x20')](util[_0xe83d('0x24')]('SET\x20CONTEXT\x20%s',_0x3b89ef));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x2b')]=function(_0x1f10b4){return this['sendRequest'](util['format'](_0xe83d('0x2c'),_0x1f10b4));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x2d')]=function(_0x909f8b){return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x2e'),_0x909f8b));};AGIChannel[_0xe83d('0x22')]['hangup']=function(){return this[_0xe83d('0x20')](_0xe83d('0x2f'));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x30')]=function(_0x2450ca,_0x59d145){var _0x1ac227=_['isBoolean'](_0x59d145)||_[_0xe83d('0x31')](_0x59d145)?_0x59d145[_0xe83d('0x32')]():_0x59d145;return this[_0xe83d('0x20')](util['format'](_0xe83d('0x33'),_0x2450ca,_0x1ac227?_0x1ac227['toString']()[_0xe83d('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xe83d('0x34')]=function(_0x1fca80,_0x1326f7){return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x35'),_0x1fca80,_0x1326f7));};AGIChannel['prototype']['sayDigits']=function(_0x5a134c,_0x3b2ab4){return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x36'),_0x5a134c,_0x3b2ab4));};AGIChannel['prototype'][_0xe83d('0x37')]=function(_0xea7d23,_0x144918){return this[_0xe83d('0x20')](util[_0xe83d('0x24')](_0xe83d('0x38'),_0xea7d23,_0x144918));};AGIChannel['prototype'][_0xe83d('0x39')]=function(_0x582fac,_0x2901de,_0x26dd21){_0x2901de=_0x2901de||this['extension'];_0x26dd21=_0x26dd21||0x1;this[_0xe83d('0x3a')](_0x582fac);this[_0xe83d('0x2b')](_0x2901de);this['setPriority'](_0x26dd21);return this['noop'](util[_0xe83d('0x24')](_0xe83d('0x3b'),_0x582fac,_0x2901de,_0x26dd21));};AGIChannel[_0xe83d('0x22')][_0xe83d('0x3c')]=function(_0x1ab219){return this[_0xe83d('0x20')](util[_0xe83d('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1ab219));};AGIChannel[_0xe83d('0x22')]['recordFile']=function(_0x3e849b,_0x555b4b,_0xdfcb76,_0x38334e,_0x4abf01,_0x3b9325){_0x555b4b=_0x555b4b||'wav';_0xdfcb76=_0xdfcb76||'';_0x38334e=_0x38334e===undefined?-0x1:_0x38334e==='-1'?-0x1:_0x38334e*0x3e8;_0x4abf01=_0x4abf01===undefined?'':'s='+_0x4abf01;_0x3b9325=_0x3b9325?_0xe83d('0x3d'):'';return this[_0xe83d('0x20')](util[_0xe83d('0x24')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3e849b,_0x555b4b,_0xdfcb76,_0x38334e,_0x3b9325,_0x4abf01));};AGIChannel['prototype'][_0xe83d('0x3e')]=function(_0x2dc9c8,_0x315342){_0x315342=_0x315342||'';return this[_0xe83d('0x20')](util['format'](_0xe83d('0x3f'),_0x2dc9c8,_0x315342));};AGIChannel[_0xe83d('0x22')]['agi']=function(_0x5553cc){return this[_0xe83d('0x28')](_0xe83d('0x40'),_0x5553cc);};AGIChannel[_0xe83d('0x22')][_0xe83d('0x41')]=function(_0x20bcea){return this[_0xe83d('0x28')](_0xe83d('0x42'),_0x20bcea);};AGIChannel['prototype'][_0xe83d('0x17')]=function(_0x1725c3,_0x261502){this[_0xe83d('0x26')](util[_0xe83d('0x24')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1725c3['id'],_0x1725c3['label'],_0x261502));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe83d('0x43')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 762d363..4037195 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 _0x52e7=['Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4e7331,_0x430d1f){var _0x1e85fd=function(_0x3fef32){while(--_0x3fef32){_0x4e7331['push'](_0x4e7331['shift']());}};_0x1e85fd(++_0x430d1f);}(_0x52e7,0xe4));var _0x752e=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0x52e7[_0x14cb58];return _0x5f097e;};'use strict';var util=require(_0x752e('0x0'));var error={'E_AGI_UNDEFINED':_0x752e('0x1'),'E_AGI_ARGUMENT_PORT':_0x752e('0x2'),'E_AGI_SERVER_ERROR':_0x752e('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x752e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x752e('0x5'),'E_AGI_SOCKET_ERROR':_0x752e('0x6'),'E_AGI_SOCKET_CLOSE':_0x752e('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x752e('0x8'),'E_AGI_COMMAND_EMPTY':_0x752e('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x752e('0xa')};function AGIError(_0x53f597){var _0x53f597=_0x53f597||null,_0x9e7304=_0x9e7304||[],_0x47fc92=0x1,_0xc3ad96='';if(!error[_0x53f597]){_0x53f597='E_AGI_UNDEFINED';}_0x9e7304[_0x752e('0xb')](error[_0x53f597]);while(arguments[_0x47fc92]){_0x9e7304[_0x752e('0xb')](arguments[_0x47fc92]);_0x47fc92++;}_0xc3ad96=util['format'][_0x752e('0xc')](util,_0x9e7304);this['message']=_0xc3ad96;this[_0x752e('0xd')]=_0x53f597;}module['exports']=AGIError; \ No newline at end of file +var _0x33c9=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','exports','util','Undefined\x20error.','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.'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x33c9,0x119));var _0x933c=function(_0x3f5edc,_0x5da8fe){_0x3f5edc=_0x3f5edc-0x0;var _0x49f00a=_0x33c9[_0x3f5edc];return _0x49f00a;};'use strict';var util=require(_0x933c('0x0'));var error={'E_AGI_UNDEFINED':_0x933c('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x933c('0x2'),'E_AGI_SERVER_CLOSE':_0x933c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x933c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x933c('0x5'),'E_AGI_SOCKET_ERROR':_0x933c('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x933c('0x7'),'E_AGI_COMMAND_EMPTY':_0x933c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x933c('0x9'),'E_AGI_IVR_ENTRY':_0x933c('0xa')};function AGIError(_0x41cd48){var _0x41cd48=_0x41cd48||null,_0x3a7587=_0x3a7587||[],_0x44829f=0x1,_0x18120d='';if(!error[_0x41cd48]){_0x41cd48=_0x933c('0xb');}_0x3a7587[_0x933c('0xc')](error[_0x41cd48]);while(arguments[_0x44829f]){_0x3a7587['push'](arguments[_0x44829f]);_0x44829f++;}_0x18120d=util['format'][_0x933c('0xd')](util,_0x3a7587);this[_0x933c('0xe')]=_0x18120d;this['name']=_0x41cd48;}module[_0x933c('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d759c65..238a629 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe24a=['projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','subscribe','agi','emit','E_AGI_SERVER_ERROR','message'];(function(_0x3f44d7,_0x58eeb0){var _0x3939f0=function(_0x2c6efa){while(--_0x2c6efa){_0x3f44d7['push'](_0x3f44d7['shift']());}};_0x3939f0(++_0x58eeb0);}(_0xe24a,0xf3));var _0xae24=function(_0x345cec,_0x205601){_0x345cec=_0x345cec-0x0;var _0x501008=_0xe24a[_0x345cec];return _0x501008;};'use strict';var _=require(_0xae24('0x0'));var EventEmitter=require(_0xae24('0x1'))[_0xae24('0x2')];var Redis=require(_0xae24('0x3'));var AGIError=require(_0xae24('0x4'));var config=require(_0xae24('0x5'));config[_0xae24('0x6')]=_['defaults'](config[_0xae24('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xae24('0x7')](_0xae24('0x8'),function(_0x436d9d){if(_0x436d9d)return eventEmitter[_0xae24('0x9')]('error',new AGIError(_0xae24('0xa'),_0x436d9d));});sub['on'](_0xae24('0xb'),function(_0x5a47d6,_0x1acc05){if(_0x5a47d6!==_0xae24('0x8'))return;try{var _0x58cdba=JSON['parse'](_0x1acc05);eventEmitter[_0xae24('0x9')](_0xae24('0xc'),_0x58cdba);}catch(_0x22ca03){eventEmitter[_0xae24('0x9')](_0xae24('0xd'),new AGIError(_0xae24('0xa'),_0x22ca03));}});module[_0xae24('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xd310=['projectUpdate','exports','lodash','events','ioredis','./error','../../config/environment','defaults','localhost','redis','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x59d879,_0x310c50){var _0xa3e2de=function(_0x41c76d){while(--_0x41c76d){_0x59d879['push'](_0x59d879['shift']());}};_0xa3e2de(++_0x310c50);}(_0xd310,0xdf));var _0x0d31=function(_0x148992,_0x13799d){_0x148992=_0x148992-0x0;var _0x5c35eb=_0xd310[_0x148992];return _0x5c35eb;};'use strict';var _=require(_0x0d31('0x0'));var EventEmitter=require(_0x0d31('0x1'))['EventEmitter'];var Redis=require(_0x0d31('0x2'));var AGIError=require(_0x0d31('0x3'));var config=require(_0x0d31('0x4'));config['redis']=_[_0x0d31('0x5')](config['redis'],{'host':_0x0d31('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0d31('0x7')]);sub[_0x0d31('0x8')](_0x0d31('0x9'),function(_0x4d3582){if(_0x4d3582)return eventEmitter[_0x0d31('0xa')](_0x0d31('0xb'),new AGIError(_0x0d31('0xc'),_0x4d3582));});sub['on'](_0x0d31('0xd'),function(_0x33d7da,_0x45965c){if(_0x33d7da!==_0x0d31('0x9'))return;try{var _0x1ee0c8=JSON[_0x0d31('0xe')](_0x45965c);eventEmitter[_0x0d31('0xa')](_0x0d31('0xf'),_0x1ee0c8);}catch(_0x1c3fd4){eventEmitter[_0x0d31('0xa')]('error',new AGIError(_0x0d31('0xc'),_0x1c3fd4));}});module[_0x0d31('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2fb288f..b91eda8 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 _0x3e01=['condition\x20not\x20found','lodash','../../../config/logger','agi','getdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','size','relations','getVertex','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach'];(function(_0x5493b0,_0x491cc9){var _0x5edb07=function(_0x3e63ea){while(--_0x3e63ea){_0x5493b0['push'](_0x5493b0['shift']());}};_0x5edb07(++_0x491cc9);}(_0x3e01,0x92));var _0x13e0=function(_0x545d08,_0x9206a3){_0x545d08=_0x545d08-0x0;var _0x176445=_0x3e01[_0x545d08];return _0x176445;};'use strict';var _=require(_0x13e0('0x0'));var logger=require(_0x13e0('0x1'))(_0x13e0('0x2'));var verticesWithRetry=['menu',_0x13e0('0x3'),'getsecretdigits'];var Graph=function(){this[_0x13e0('0x4')]={};this[_0x13e0('0x5')]={};this[_0x13e0('0x6')]=0x0;};Graph['prototype'][_0x13e0('0x7')]=function(_0x1a2c8b){this['vertices'][_0x1a2c8b['id']]=_0x1a2c8b;this[_0x13e0('0x5')][_0x1a2c8b['id']]=[];};Graph[_0x13e0('0x8')][_0x13e0('0x9')]=function(_0x1f51e5,_0x17aff2,_0x49c9ba){this[_0x13e0('0x5')][_0x1f51e5]['push']({'target':_0x17aff2,'condition':_0x49c9ba});this[_0x13e0('0x6')]+=0x1;};Graph[_0x13e0('0x8')]['size']=function(){return _[_0x13e0('0xa')](this[_0x13e0('0x4')]);};Graph[_0x13e0('0x8')][_0x13e0('0xb')]=function(){return this[_0x13e0('0x6')];};Graph[_0x13e0('0x8')][_0x13e0('0xc')]=function(_0x231bfd){return this['vertices'][_0x231bfd];};Graph['prototype']['traverseBFS']=function(_0x4cfb9c,_0x4a855d){if(!this[_0x13e0('0x4')][_0x4cfb9c]){return logger['info']('no\x20vertex\x20found');}var _0x3c7de2=_0x4a855d(this['vertices'][_0x4cfb9c]);if(!_0x3c7de2){return logger[_0x13e0('0xd')](_0x13e0('0xe'));}if(this[_0x13e0('0x5')][_0x4cfb9c][_0x13e0('0xf')]===0x0){return logger[_0x13e0('0xd')](_0x13e0('0x10'));}for(var _0x14d04d=0x0,_0x314598=[],_0x4f93ce=![];_0x14d04d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','handleNotFound','production','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','projectUpdate'];(function(_0x1c232c,_0x504d75){var _0xf8153e=function(_0xf90932){while(--_0xf90932){_0x1c232c['push'](_0x1c232c['shift']());}};_0xf8153e(++_0x504d75);}(_0xd76e,0x15c));var _0xed76=function(_0x5a5883,_0x461400){_0x5a5883=_0x5a5883-0x0;var _0x66f060=_0xd76e[_0x5a5883];return _0x66f060;};'use strict';var _=require('lodash');var syncho=require(_0xed76('0x0'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xed76('0x1'))(_0xed76('0x2'));var utilLicense=require(_0xed76('0x3'));var rpc=require(_0xed76('0x4'));var Project=require(_0xed76('0x5'));var AGIEmitter=require(_0xed76('0x6'))['EventEmitter'];var projects=[];config[_0xed76('0x2')]=_[_0xed76('0x7')](config[_0xed76('0x2')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xed76('0x8'),projectUpdateHandler);function connectionHandler(_0x25a368){process[_0xed76('0x9')](function(){syncho(function(){try{setChannelVariables(_0x25a368);agiHandler(_0x25a368);}catch(_0x18b597){logger[_0xed76('0xa')](_0x18b597[_0xed76('0xb')]);}});});}function projectUpdateHandler(_0x38972e){try{var _0x20c30a=_[_0xed76('0xc')](projects,['id',_0x38972e['id']]);if(_0x20c30a>-0x1){if(_0x38972e[_0xed76('0xd')]===!![]){projects[_0xed76('0xe')](_0x20c30a,0x1);}else{projects[_0x20c30a]=_0x38972e;}}else{projects[_0xed76('0xf')](_0x38972e);}}catch(_0x374b4c){logger[_0xed76('0xa')](_0x374b4c['stack']);}}function listeningHandler(){console['log'](_0xed76('0x10'),config['agi'][_0xed76('0x11')]);logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x14'),config[_0xed76('0x2')]['ip'],config[_0xed76('0x2')][_0xed76('0x11')]));}function errorHandler(_0xae9ce9){if(_0xae9ce9&&_0xae9ce9[_0xed76('0x15')]&&_0xae9ce9[_0xed76('0x16')]){logger['error'](util[_0xed76('0x13')]('[%s]\x20%s',_0xae9ce9[_0xed76('0x15')],_0xae9ce9[_0xed76('0x16')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0xae9ce9['stack']));}}function closeHandler(){logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x17'),this[_0xed76('0x18')],this[_0xed76('0x19')],this['callerid'],this['dnid'],this[_0xed76('0x1a')]));try{createSquareReport(this);}catch(_0x134d77){logger[_0xed76('0xa')](_0x134d77[_0xed76('0xb')]);}}function timeoutHandler(){logger[_0xed76('0x12')](util[_0xed76('0x13')](_0xed76('0x1b'),this['arg_1'],this['calleridname'],this[_0xed76('0x1c')],this[_0xed76('0x1d')],this[_0xed76('0x1a')]));}function hangupHandler(){logger['info'](util[_0xed76('0x13')](_0xed76('0x1e'),this['arg_1'],this['calleridname'],this[_0xed76('0x1c')],this[_0xed76('0x1d')],this['uniqueid']));this[_0xed76('0x1f')]=!![];}function createSquareReport(_0x1616a4,_0x306afe){rpc[_0xed76('0x20')](_0x1616a4)[_0xed76('0x21')](function(_0xf4b714){if(_0x306afe){_0x306afe(null,_0xf4b714);}})[_0xed76('0x22')](function(_0x2c4ee0){if(_0x306afe){_0x306afe(null,_0x2c4ee0);}});}function setChannelVariables(_0x3c13d5){for(var _0x4aeff8 in _0x3c13d5){if(_0x3c13d5[_0xed76('0x23')](_0x4aeff8)){if(_0x4aeff8['indexOf'](_0xed76('0x24'))===0x0){_0x3c13d5[_0x4aeff8[_0xed76('0x25')](0x4)]=_0x3c13d5[_0x4aeff8];delete _0x3c13d5[_0x4aeff8];}}}}function agiHandler(_0x57b9eb){logger[_0xed76('0x26')](_0xed76('0x27'),JSON['stringify'](_0x57b9eb,null,0x2));logger[_0xed76('0x12')](util['format'](_0xed76('0x28'),_0x57b9eb[_0xed76('0x18')],_0x57b9eb['calleridname'],_0x57b9eb[_0xed76('0x1c')],_0x57b9eb[_0xed76('0x1d')],_0x57b9eb[_0xed76('0x1a')]));_0x57b9eb['on'](_0xed76('0xa'),errorHandler);_0x57b9eb['on']('close',closeHandler);_0x57b9eb['on']('timeout',timeoutHandler);_0x57b9eb[_0xed76('0x1f')]=![];_0x57b9eb['on']('hangup',hangupHandler);var _0x96ee08=_['find'](projects,['name',_0x57b9eb['arg_1']]);if(!_0x96ee08)return Project[_0xed76('0x29')](_0x57b9eb);if(!_0x96ee08[_0xed76('0x2a')])return Project[_0xed76('0x2b')](_0x57b9eb);return Project['initialize'](_0x96ee08,_0x57b9eb);}function main(){var _0x1751f4;return utilLicense['getLicense']()['then'](function(_0x575fb5){if(!_0x575fb5)return;if(_0x575fb5['voice']){if(_0x575fb5[_0xed76('0x2c')]&&_0x575fb5[_0xed76('0x2c')]>0x0){logger[_0xed76('0x12')](util[_0xed76('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x575fb5[_0xed76('0x2c')]));_0x1751f4=_0x575fb5[_0xed76('0x2c')];}else{logger[_0xed76('0x12')](_0xed76('0x2d'));}}else{logger[_0xed76('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1751f4=-0x1;}})['then'](function(){return Project[_0xed76('0x2e')]();})[_0xed76('0x21')](function(_0x32a5b6){projects=_0x32a5b6;return;})[_0xed76('0x22')](function(_0x39148b){logger[_0xed76('0xa')](_0xed76('0x2f'),_0x39148b[_0xed76('0xb')]);})['finally'](function(){var _0x151dbf=require(_0xed76('0x30'))(config[_0xed76('0x2')][_0xed76('0x11')],config[_0xed76('0x2')]['ip'],_0x1751f4);_0x151dbf['on']('error',errorHandler);_0x151dbf['on'](_0xed76('0x31'),listeningHandler);_0x151dbf['on'](_0xed76('0x32'),connectionHandler);_0x151dbf['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x425e=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x425e,0x147));var _0xe425=function(_0x22a552,_0x380338){_0x22a552=_0x22a552-0x0;var _0x565016=_0x425e[_0x22a552];return _0x565016;};'use strict';var _=require(_0xe425('0x0'));var syncho=require(_0xe425('0x1'));var util=require(_0xe425('0x2'));var config=require(_0xe425('0x3'));var logger=require(_0xe425('0x4'))('agi');var utilLicense=require(_0xe425('0x5'));var rpc=require('./rpc');var Project=require(_0xe425('0x6'));var AGIEmitter=require(_0xe425('0x7'))[_0xe425('0x8')];var projects=[];config[_0xe425('0x9')]=_[_0xe425('0xa')](config[_0xe425('0x9')],{'ip':_0xe425('0xb'),'port':0x11dd});AGIEmitter['on'](_0xe425('0xc'),projectUpdateHandler);function connectionHandler(_0x9c31f4){process[_0xe425('0xd')](function(){syncho(function(){try{setChannelVariables(_0x9c31f4);agiHandler(_0x9c31f4);}catch(_0x3fffe4){logger[_0xe425('0xe')](_0x3fffe4[_0xe425('0xf')]);}});});}function projectUpdateHandler(_0x30e990){try{var _0x5ad51c=_[_0xe425('0x10')](projects,['id',_0x30e990['id']]);if(_0x5ad51c>-0x1){if(_0x30e990[_0xe425('0x11')]===!![]){projects[_0xe425('0x12')](_0x5ad51c,0x1);}else{projects[_0x5ad51c]=_0x30e990;}}else{projects[_0xe425('0x13')](_0x30e990);}}catch(_0x3fa03e){logger[_0xe425('0xe')](_0x3fa03e[_0xe425('0xf')]);}}function listeningHandler(){console[_0xe425('0x14')](_0xe425('0x15'),config[_0xe425('0x9')][_0xe425('0x16')]);logger[_0xe425('0x17')](util['format'](_0xe425('0x18'),config[_0xe425('0x9')]['ip'],config[_0xe425('0x9')][_0xe425('0x16')]));}function errorHandler(_0x2d4a60){if(_0x2d4a60&&_0x2d4a60[_0xe425('0x19')]&&_0x2d4a60[_0xe425('0x1a')]){logger[_0xe425('0xe')](util[_0xe425('0x1b')](_0xe425('0x1c'),_0x2d4a60[_0xe425('0x19')],_0x2d4a60[_0xe425('0x1a')]));}else{logger[_0xe425('0xe')](util[_0xe425('0x1b')]('[ERROR]\x20%s',_0x2d4a60[_0xe425('0xf')]));}}function closeHandler(){logger[_0xe425('0x17')](util[_0xe425('0x1b')](_0xe425('0x1d'),this[_0xe425('0x1e')],this['calleridname'],this['callerid'],this[_0xe425('0x1f')],this[_0xe425('0x20')]));try{createSquareReport(this);}catch(_0x4eaefa){logger['error'](_0x4eaefa[_0xe425('0xf')]);}}function timeoutHandler(){logger[_0xe425('0x17')](util[_0xe425('0x1b')](_0xe425('0x21'),this['arg_1'],this[_0xe425('0x22')],this['callerid'],this['dnid'],this[_0xe425('0x20')]));}function hangupHandler(){logger[_0xe425('0x17')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0xe425('0x20')]));this[_0xe425('0x23')]=!![];}function createSquareReport(_0xe77bda,_0x180d57){rpc[_0xe425('0x24')](_0xe77bda)[_0xe425('0x25')](function(_0x2d2766){if(_0x180d57){_0x180d57(null,_0x2d2766);}})[_0xe425('0x26')](function(_0x483981){if(_0x180d57){_0x180d57(null,_0x483981);}});}function setChannelVariables(_0x2862ea){for(var _0x1203ce in _0x2862ea){if(_0x2862ea[_0xe425('0x27')](_0x1203ce)){if(_0x1203ce[_0xe425('0x28')](_0xe425('0x29'))===0x0){_0x2862ea[_0x1203ce[_0xe425('0x2a')](0x4)]=_0x2862ea[_0x1203ce];delete _0x2862ea[_0x1203ce];}}}}function agiHandler(_0x4fd8cf){logger[_0xe425('0x2b')](_0xe425('0x2c'),JSON[_0xe425('0x2d')](_0x4fd8cf,null,0x2));logger[_0xe425('0x17')](util[_0xe425('0x1b')](_0xe425('0x2e'),_0x4fd8cf[_0xe425('0x1e')],_0x4fd8cf[_0xe425('0x22')],_0x4fd8cf['callerid'],_0x4fd8cf[_0xe425('0x1f')],_0x4fd8cf['uniqueid']));_0x4fd8cf['on'](_0xe425('0xe'),errorHandler);_0x4fd8cf['on'](_0xe425('0x2f'),closeHandler);_0x4fd8cf['on'](_0xe425('0x30'),timeoutHandler);_0x4fd8cf['evtHangup']=![];_0x4fd8cf['on'](_0xe425('0x31'),hangupHandler);var _0x5700ff=_[_0xe425('0x32')](projects,[_0xe425('0x19'),_0x4fd8cf[_0xe425('0x1e')]]);if(!_0x5700ff)return Project['handleNotFound'](_0x4fd8cf);if(!_0x5700ff[_0xe425('0x33')])return Project[_0xe425('0x34')](_0x4fd8cf);return Project['initialize'](_0x5700ff,_0x4fd8cf);}function main(){var _0x1b6051;return utilLicense[_0xe425('0x35')]()['then'](function(_0x583dff){if(!_0x583dff)return;if(_0x583dff[_0xe425('0x36')]){if(_0x583dff['callysquare']&&_0x583dff[_0xe425('0x37')]>0x0){logger[_0xe425('0x17')](util[_0xe425('0x1b')]('[LICENSE]\x20CHANNELS:\x20%s',_0x583dff[_0xe425('0x37')]));_0x1b6051=_0x583dff['callysquare'];}else{logger[_0xe425('0x17')](_0xe425('0x38'));}}else{logger[_0xe425('0x17')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1b6051=-0x1;}})[_0xe425('0x25')](function(){return Project[_0xe425('0x39')]();})[_0xe425('0x25')](function(_0x486d8c){projects=_0x486d8c;return;})[_0xe425('0x26')](function(_0x3b1945){logger[_0xe425('0xe')](_0xe425('0x3a'),_0x3b1945[_0xe425('0xf')]);})[_0xe425('0x3b')](function(){var _0x283ba8=require(_0xe425('0x3c'))(config['agi'][_0xe425('0x16')],config['agi']['ip'],_0x1b6051);_0x283ba8['on'](_0xe425('0xe'),errorHandler);_0x283ba8['on'](_0xe425('0x3d'),listeningHandler);_0x283ba8['on']('connection',connectionHandler);_0x283ba8['on']('close',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 c34d2a4..c4067a6 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 _0x024d=['client','http','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise'];(function(_0x4d1055,_0x3be1fd){var _0x56a5bd=function(_0x2068e2){while(--_0x2068e2){_0x4d1055['push'](_0x4d1055['shift']());}};_0x56a5bd(++_0x3be1fd);}(_0x024d,0x12b));var _0xd024=function(_0x4746ef,_0x1ec452){_0x4746ef=_0x4746ef-0x0;var _0x4866b2=_0x024d[_0x4746ef];return _0x4866b2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd024('0x0'));var client=jayson[_0xd024('0x1')][_0xd024('0x2')]({'port':0x232b});function request(_0x5b327f,_0x1485dc){return new BPromise(function(_0x3b5e3a,_0x16f990){return client['request'](_0x5b327f,_0x1485dc)[_0xd024('0x3')](function(_0x2c3b31){if(_0x2c3b31[_0xd024('0x4')]){return _0x16f990(_0x2c3b31[_0xd024('0x4')][_0xd024('0x5')]);}else{return _0x3b5e3a(_0x2c3b31[_0xd024('0x6')]);}})[_0xd024('0x7')](function(_0x5660a6){return _0x16f990(_0x5660a6);});});}exports[_0xd024('0x8')]=function(_0x348631,_0x1ecb21){return request(_0xd024('0x9'),{'account':_0x348631,'message':_0x1ecb21});}; \ No newline at end of file +var _0x7847=['message','catch','SendMail','bluebird','client','http','error'];(function(_0x951de0,_0x410d50){var _0xd338ee=function(_0x4ac0e8){while(--_0x4ac0e8){_0x951de0['push'](_0x951de0['shift']());}};_0xd338ee(++_0x410d50);}(_0x7847,0x15a));var _0x7784=function(_0x7303c,_0x2d7803){_0x7303c=_0x7303c-0x0;var _0x367cc7=_0x7847[_0x7303c];return _0x367cc7;};'use strict';var BPromise=require(_0x7784('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x7784('0x1')][_0x7784('0x2')]({'port':0x232b});function request(_0x4a2191,_0x45ec92){return new BPromise(function(_0x4697c1,_0x1b6955){return client['request'](_0x4a2191,_0x45ec92)['then'](function(_0x1fbe16){if(_0x1fbe16['error']){return _0x1b6955(_0x1fbe16[_0x7784('0x3')][_0x7784('0x4')]);}else{return _0x4697c1(_0x1fbe16['result']);}})[_0x7784('0x5')](function(_0x28e23c){return _0x1b6955(_0x28e23c);});});}exports['sendMailMessage']=function(_0x1be5b7,_0x395a70){return request(_0x7784('0x6'),{'account':_0x1be5b7,'message':_0x395a70});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index f39d34b..f283dbb 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3e2=['response','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','stringify','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','start','clear','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','debug'];(function(_0x5ad587,_0x3768af){var _0x2490b2=function(_0x597ce2){while(--_0x597ce2){_0x5ad587['push'](_0x5ad587['shift']());}};_0x2490b2(++_0x3768af);}(_0xa3e2,0xc4));var _0x2a3e=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xa3e2[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0x2a3e('0x0'));var moment=require('moment');var parser=require(_0x2a3e('0x1'));var util=require(_0x2a3e('0x2'));var logger=require(_0x2a3e('0x3'))(_0x2a3e('0x4'));var rpc=require(_0x2a3e('0x5'));var mailRpc=require(_0x2a3e('0x6'));var Graph=require('./graph');var Vertices=require(_0x2a3e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2a3e('0x8')]()[_0x2a3e('0x9')](function(_0x5a4308){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5a4308[_0x2a3e('0xa')]);return[];});}function addVertex(_0x70c5bb,_0x502221,_0x396c71){_0x502221['agicommand']=_0x396c71;if(_0x502221[_0x2a3e('0xb')](_0x2a3e('0xc'))){_0x502221[_0x2a3e('0xd')]=parseInt(_0x502221[_0x2a3e('0xc')],0xa);}_0x70c5bb[_0x2a3e('0xe')](_[_0x2a3e('0xf')](_0x502221,_0x2a3e('0x10')));}function initGraph(_0x5a08df,_0x45e80c){var _0x496c28=new Graph();for(var _0x105f59 in _0x5a08df){if(_0x5a08df[_0x2a3e('0xb')](_0x105f59)){if(_['isArray'](_0x5a08df[_0x105f59])){for(var _0x37f1a4=0x0;_0x37f1a4<_0x5a08df[_0x105f59][_0x2a3e('0x11')];_0x37f1a4+=0x1){addVertex(_0x496c28,_0x5a08df[_0x105f59][_0x37f1a4],_0x105f59);}}else{addVertex(_0x496c28,_0x5a08df[_0x105f59],_0x105f59);}}}for(var _0x5a166e=0x0;_0x5a166e<_0x45e80c[_0x2a3e('0x11')];_0x5a166e+=0x1){if(_0x45e80c[_0x5a166e][_0x2a3e('0x12')]&&_0x45e80c[_0x5a166e][_0x2a3e('0x13')]){_0x496c28['addEdge'](_0x45e80c[_0x5a166e][_0x2a3e('0x12')],_0x45e80c[_0x5a166e][_0x2a3e('0x13')],_0x45e80c[_0x5a166e][_0x2a3e('0x14')]);}}return _0x496c28;}function getRoot(_0x523a03){return parser[_0x2a3e('0x15')](_0x523a03,{'object':!![]})[_0x2a3e('0x16')][_0x2a3e('0x17')];}function inspect(_0x2635ac){return util[_0x2a3e('0x18')](_0x2635ac,{'showHidden':![],'depth':null});}function initialize(_0x385d26,_0x470ff8){var _0x352a7b=getRoot(_0x385d26[_0x2a3e('0x19')]);if(!_0x352a7b||!_0x352a7b['start'])return;var _0x5e9100,_0x5917a9,_0x2c0375;logger['debug'](_0x2a3e('0x17'),JSON[_0x2a3e('0x1a')](_0x352a7b,null,0x2));_0x470ff8['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5e9100=initGraph(_['omit'](_0x352a7b,_0x2a3e('0x10')),_0x352a7b[_0x2a3e('0x10')]);_0x5917a9=new Vertices(_0x470ff8,rpc,mailRpc);logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x1d'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8['calleridname'],_0x470ff8[_0x2a3e('0x1f')],_0x470ff8['dnid'],_0x470ff8['uniqueid']));_0x5e9100['traverseBFS'](_0x352a7b[_0x2a3e('0x20')]['id'],function(_0xf50918){try{_0xf50918=_0x5917a9[_0x2a3e('0x21')](_0xf50918);logger['debug']('vertex',JSON[_0x2a3e('0x1a')](_0xf50918,null,0x2));if(_0xf50918[_0x2a3e('0x22')]===_0x2a3e('0x23')){logger[_0x2a3e('0x1b')](_0x2a3e('0x24'));_0x470ff8[_0x2a3e('0x25')]=_0xf50918[_0x2a3e('0x25')]||_0x470ff8[_0x2a3e('0x25')];_0x470ff8[_0x2a3e('0x26')]=_0xf50918[_0x2a3e('0x26')];_0x470ff8[_0x2a3e('0x27')]=_0xf50918[_0x2a3e('0x27')]?_0xf50918[_0x2a3e('0x27')]-0x1:0x1;return null;}else if(_0xf50918&&_0x5917a9[_0xf50918['agicommand']]){_0x2c0375=_0x5917a9[_0xf50918[_0x2a3e('0x22')]](_0xf50918);logger[_0x2a3e('0x1b')]('response',JSON[_0x2a3e('0x1a')](_0x2c0375,null,0x2));if(_0x2c0375&&_0x2c0375[_0x2a3e('0x28')]===AGI_CODE_SUCCESS&&_0x2c0375[_0x2a3e('0x29')]!==AGI_RESULT_ERROR&&!_0x470ff8[_0x2a3e('0x2a')]){logger[_0x2a3e('0x2b')](_0x2a3e('0x2c'),inspect(_0x2c0375));return _[_0x2a3e('0x2d')](_0x2c0375[_0x2a3e('0x29')])?null:_0x2c0375[_0x2a3e('0x29')][_0x2a3e('0x2e')]();}else{logger[_0x2a3e('0x2f')](_0x2a3e('0x2c'),inspect(_0x2c0375));return null;}}else{logger['error'](_0x2a3e('0x30'));return null;}}catch(_0x9a483c){logger[_0x2a3e('0x2f')](_0x9a483c[_0x2a3e('0xa')]);return null;}});if(_0x352a7b[_0x2a3e('0x31')]){logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x32'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8[_0x2a3e('0x33')],_0x470ff8['callerid'],_0x470ff8['dnid'],_0x470ff8[_0x2a3e('0x34')]));_0x5e9100['traverseBFS'](_0x352a7b[_0x2a3e('0x31')]['id'],function(_0x3255b3){try{_0x3255b3=_0x5917a9[_0x2a3e('0x21')](_0x3255b3);logger[_0x2a3e('0x2b')](_0x2a3e('0x35'),JSON[_0x2a3e('0x1a')](_0x3255b3,null,0x2));if(_0x3255b3&&_0x5917a9[_0x3255b3[_0x2a3e('0x22')]]){_0x2c0375=_0x5917a9[_0x3255b3['agicommand']](_0x3255b3);if(_0x2c0375){logger['debug'](_0x2a3e('0x2c'),inspect(_0x2c0375));return _[_0x2a3e('0x2d')](_0x2c0375[_0x2a3e('0x29')])?null:_0x2c0375['result']['toString']();}else{logger['error'](_0x2a3e('0x2c'),inspect(_0x2c0375));return null;}}else{logger[_0x2a3e('0x2f')](_0x2a3e('0x30'));return null;}}catch(_0x5da5ca){logger['error'](_0x5da5ca[_0x2a3e('0xa')]);return null;}});}logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x36'),_0x470ff8[_0x2a3e('0x1e')],_0x470ff8['calleridname'],_0x470ff8[_0x2a3e('0x1f')],_0x470ff8[_0x2a3e('0x37')],_0x470ff8[_0x2a3e('0x34')]));logger[_0x2a3e('0x1b')](util[_0x2a3e('0x1c')](_0x2a3e('0x38'),_0x470ff8[_0x2a3e('0x25')],_0x470ff8[_0x2a3e('0x26')],parseInt(_0x470ff8[_0x2a3e('0x27')],0xa)+0x1));_0x470ff8['continueAt'](_0x470ff8[_0x2a3e('0x25')],_0x470ff8[_0x2a3e('0x26')],parseInt(_0x470ff8[_0x2a3e('0x27')],0xa)+0x1);_0x470ff8['close']();}function handleNotFound(_0x28c1b8){logger['error'](util[_0x2a3e('0x1c')](_0x2a3e('0x39'),_0x28c1b8['arg_1']));_0x28c1b8['continueAt'](_0x28c1b8[_0x2a3e('0x25')],_0x28c1b8[_0x2a3e('0x26')],parseInt(_0x28c1b8[_0x2a3e('0x27')],0xa)+0x1);_0x28c1b8[_0x2a3e('0x3a')]();}function handleUnpublished(_0x5bcdd8){logger[_0x2a3e('0x2f')](util['format'](_0x2a3e('0x3b'),_0x5bcdd8[_0x2a3e('0x1e')]));_0x5bcdd8['continueAt'](_0x5bcdd8[_0x2a3e('0x25')],_0x5bcdd8['extension'],parseInt(_0x5bcdd8[_0x2a3e('0x27')],0xa)+0x1);_0x5bcdd8[_0x2a3e('0x3a')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xe3e5=['joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','start','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','evtHangup','response','isUndefined','agicommand\x20not\x20found','finally','uniqueid','traverseBFS','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','length','source','target','addEdge','value','toJson','inspect','production','debug','root','stringify'];(function(_0x307c60,_0x16b522){var _0x527f06=function(_0x10f17f){while(--_0x10f17f){_0x307c60['push'](_0x307c60['shift']());}};_0x527f06(++_0x16b522);}(_0xe3e5,0x9d));var _0x5e3e=function(_0x3eb925,_0x4aeee1){_0x3eb925=_0x3eb925-0x0;var _0x263520=_0xe3e5[_0x3eb925];return _0x263520;};'use strict';var _=require(_0x5e3e('0x0'));var moment=require(_0x5e3e('0x1'));var parser=require(_0x5e3e('0x2'));var util=require(_0x5e3e('0x3'));var logger=require(_0x5e3e('0x4'))(_0x5e3e('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x5e3e('0x6'));var Graph=require('./graph');var Vertices=require(_0x5e3e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5e3e('0x8')]()[_0x5e3e('0x9')](function(_0x17931f){logger[_0x5e3e('0xa')](_0x5e3e('0xb'),_0x17931f[_0x5e3e('0xc')]);return[];});}function addVertex(_0x56b3bd,_0x32ab3a,_0x188d48){_0x32ab3a[_0x5e3e('0xd')]=_0x188d48;if(_0x32ab3a[_0x5e3e('0xe')](_0x5e3e('0xf'))){_0x32ab3a['maxRetry']=parseInt(_0x32ab3a['retry'],0xa);}_0x56b3bd[_0x5e3e('0x10')](_[_0x5e3e('0x11')](_0x32ab3a,'mxCell'));}function initGraph(_0x36e0e5,_0x23c016){var _0x1b20b4=new Graph();for(var _0x2caae1 in _0x36e0e5){if(_0x36e0e5[_0x5e3e('0xe')](_0x2caae1)){if(_['isArray'](_0x36e0e5[_0x2caae1])){for(var _0x5b1642=0x0;_0x5b1642<_0x36e0e5[_0x2caae1]['length'];_0x5b1642+=0x1){addVertex(_0x1b20b4,_0x36e0e5[_0x2caae1][_0x5b1642],_0x2caae1);}}else{addVertex(_0x1b20b4,_0x36e0e5[_0x2caae1],_0x2caae1);}}}for(var _0x10e7c8=0x0;_0x10e7c8<_0x23c016[_0x5e3e('0x12')];_0x10e7c8+=0x1){if(_0x23c016[_0x10e7c8][_0x5e3e('0x13')]&&_0x23c016[_0x10e7c8][_0x5e3e('0x14')]){_0x1b20b4[_0x5e3e('0x15')](_0x23c016[_0x10e7c8]['source'],_0x23c016[_0x10e7c8][_0x5e3e('0x14')],_0x23c016[_0x10e7c8][_0x5e3e('0x16')]);}}return _0x1b20b4;}function getRoot(_0x4692bc){return parser[_0x5e3e('0x17')](_0x4692bc,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x291215){return util[_0x5e3e('0x18')](_0x291215,{'showHidden':![],'depth':null});}function initialize(_0x5aa8d0,_0x557143){var _0x665538=getRoot(_0x5aa8d0[_0x5e3e('0x19')]);if(!_0x665538||!_0x665538['start'])return;var _0x55232e,_0x17e313,_0x28fbe5;logger[_0x5e3e('0x1a')](_0x5e3e('0x1b'),JSON[_0x5e3e('0x1c')](_0x665538,null,0x2));_0x557143[_0x5e3e('0x1d')]=moment()[_0x5e3e('0x1e')](_0x5e3e('0x1f'));_0x55232e=initGraph(_[_0x5e3e('0x11')](_0x665538,'mxCell'),_0x665538[_0x5e3e('0x20')]);_0x17e313=new Vertices(_0x557143,rpc,mailRpc);logger['info'](util['format'](_0x5e3e('0x21'),_0x557143[_0x5e3e('0x22')],_0x557143[_0x5e3e('0x23')],_0x557143[_0x5e3e('0x24')],_0x557143[_0x5e3e('0x25')],_0x557143['uniqueid']));_0x55232e['traverseBFS'](_0x665538[_0x5e3e('0x26')]['id'],function(_0x3a7201){try{_0x3a7201=_0x17e313[_0x5e3e('0x27')](_0x3a7201);logger['debug'](_0x5e3e('0x28'),JSON[_0x5e3e('0x1c')](_0x3a7201,null,0x2));if(_0x3a7201[_0x5e3e('0xd')]===_0x5e3e('0x29')){logger[_0x5e3e('0x2a')](_0x5e3e('0x2b'));_0x557143['context']=_0x3a7201['context']||_0x557143[_0x5e3e('0x2c')];_0x557143[_0x5e3e('0x2d')]=_0x3a7201[_0x5e3e('0x2d')];_0x557143[_0x5e3e('0x2e')]=_0x3a7201[_0x5e3e('0x2e')]?_0x3a7201[_0x5e3e('0x2e')]-0x1:0x1;return null;}else if(_0x3a7201&&_0x17e313[_0x3a7201[_0x5e3e('0xd')]]){_0x28fbe5=_0x17e313[_0x3a7201[_0x5e3e('0xd')]](_0x3a7201);logger['info']('response',JSON[_0x5e3e('0x1c')](_0x28fbe5,null,0x2));if(_0x28fbe5&&_0x28fbe5['code']===AGI_CODE_SUCCESS&&_0x28fbe5[_0x5e3e('0x2f')]!==AGI_RESULT_ERROR&&!_0x557143[_0x5e3e('0x30')]){logger['debug'](_0x5e3e('0x31'),inspect(_0x28fbe5));return _[_0x5e3e('0x32')](_0x28fbe5[_0x5e3e('0x2f')])?null:_0x28fbe5[_0x5e3e('0x2f')]['toString']();}else{logger[_0x5e3e('0xa')]('response',inspect(_0x28fbe5));return null;}}else{logger[_0x5e3e('0xa')](_0x5e3e('0x33'));return null;}}catch(_0x14d597){logger[_0x5e3e('0xa')](_0x14d597[_0x5e3e('0xc')]);return null;}});if(_0x665538[_0x5e3e('0x34')]){logger[_0x5e3e('0x2a')](util[_0x5e3e('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x557143[_0x5e3e('0x22')],_0x557143[_0x5e3e('0x23')],_0x557143[_0x5e3e('0x24')],_0x557143['dnid'],_0x557143[_0x5e3e('0x35')]));_0x55232e[_0x5e3e('0x36')](_0x665538[_0x5e3e('0x34')]['id'],function(_0x1d1368){try{_0x1d1368=_0x17e313[_0x5e3e('0x27')](_0x1d1368);logger[_0x5e3e('0x1a')](_0x5e3e('0x28'),JSON[_0x5e3e('0x1c')](_0x1d1368,null,0x2));if(_0x1d1368&&_0x17e313[_0x1d1368['agicommand']]){_0x28fbe5=_0x17e313[_0x1d1368['agicommand']](_0x1d1368);if(_0x28fbe5){logger['debug'](_0x5e3e('0x31'),inspect(_0x28fbe5));return _['isUndefined'](_0x28fbe5[_0x5e3e('0x2f')])?null:_0x28fbe5[_0x5e3e('0x2f')][_0x5e3e('0x37')]();}else{logger[_0x5e3e('0xa')]('response',inspect(_0x28fbe5));return null;}}else{logger[_0x5e3e('0xa')](_0x5e3e('0x33'));return null;}}catch(_0xd9cb61){logger[_0x5e3e('0xa')](_0xd9cb61[_0x5e3e('0xc')]);return null;}});}logger['info'](util[_0x5e3e('0x1e')](_0x5e3e('0x38'),_0x557143[_0x5e3e('0x22')],_0x557143['calleridname'],_0x557143['callerid'],_0x557143[_0x5e3e('0x25')],_0x557143['uniqueid']));logger['info'](util[_0x5e3e('0x1e')](_0x5e3e('0x39'),_0x557143['context'],_0x557143[_0x5e3e('0x2d')],parseInt(_0x557143[_0x5e3e('0x2e')],0xa)+0x1));_0x557143[_0x5e3e('0x3a')](_0x557143['context'],_0x557143[_0x5e3e('0x2d')],parseInt(_0x557143[_0x5e3e('0x2e')],0xa)+0x1);_0x557143[_0x5e3e('0x3b')]();}function handleNotFound(_0x54aedd){logger['error'](util[_0x5e3e('0x1e')](_0x5e3e('0x3c'),_0x54aedd[_0x5e3e('0x22')]));_0x54aedd[_0x5e3e('0x3a')](_0x54aedd[_0x5e3e('0x2c')],_0x54aedd['extension'],parseInt(_0x54aedd['priority'],0xa)+0x1);_0x54aedd['close']();}function handleUnpublished(_0x273679){logger['error'](util[_0x5e3e('0x1e')](_0x5e3e('0x3d'),_0x273679[_0x5e3e('0x22')]));_0x273679[_0x5e3e('0x3a')](_0x273679[_0x5e3e('0x2c')],_0x273679[_0x5e3e('0x2d')],parseInt(_0x273679[_0x5e3e('0x2e')],0xa)+0x1);_0x273679[_0x5e3e('0x3b')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 74b0422..648abbf 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 _0x5376=['exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody','indexOf','substring','length','slice','trim','emit','headers'];(function(_0x276765,_0x184a2d){var _0x22a2bc=function(_0x35bcf7){while(--_0x35bcf7){_0x276765['push'](_0x276765['shift']());}};_0x22a2bc(++_0x184a2d);}(_0x5376,0x19f));var _0x6537=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0x5376[_0x3a924d];return _0x2f9f0b;};'use strict';var util=require(_0x6537('0x0'));var Transform=require(_0x6537('0x1'))[_0x6537('0x2')];function AGIReply(_0x1bf1c3){Transform[_0x6537('0x3')](this,_0x1bf1c3);this[_0x6537('0x4')]='';this['_inBody']=![];}util[_0x6537('0x5')](AGIReply,Transform);AGIReply[_0x6537('0x6')][_0x6537('0x7')]=function(_0x3d3ba0,_0x43fed3,_0x5595ad){var _0x1984df='\x0a',_0x47244e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x1ae5fe=-0x1,_0x5ceef6=-0x1,_0xc8bb30='',_0x21fb7f=0x0,_0x17f19d='',_0x1ff044='';this[_0x6537('0x4')]+=_0x3d3ba0[_0x6537('0x8')]();_0x17f19d=this[_0x6537('0x4')];if(!this[_0x6537('0x9')]){_0x21fb7f=0x0;while(_0x47244e[_0x21fb7f]){while((_0x5ceef6=_0x17f19d[_0x6537('0xa')](_0x47244e[_0x21fb7f]))!=-0x1){_0xc8bb30=_0x47244e[_0x21fb7f];_0x1ff044=_0x17f19d[_0x6537('0xb')](0x0,_0x5ceef6);_0x17f19d=_0x17f19d[_0x6537('0xb')](_0x5ceef6+_0xc8bb30[_0x6537('0xc')]);var _0x5bec4e=_0x1ff044['split'](_0x1984df),_0x1ced9b=0x0,_0x3304c1={},_0x4ae0a7='',_0x5e5388='',_0x176e78=-0x1;while(_0x5bec4e[_0x1ced9b]){_0x176e78=_0x5bec4e[_0x1ced9b][_0x6537('0xa')](':');if(_0x176e78!=-0x1){_0x4ae0a7=_0x5bec4e[_0x1ced9b][_0x6537('0xd')](0x0,_0x176e78)[_0x6537('0xe')]();_0x5e5388=_0x5bec4e[_0x1ced9b][_0x6537('0xd')](_0x176e78+0x1)['trim']();if(_0x4ae0a7['length']>0x0){_0x3304c1[_0x4ae0a7]=_0x5e5388;}}else{}_0x1ced9b++;}this[_0x6537('0xf')](_0x6537('0x10'),_0x3304c1);this[_0x6537('0x9')]=!![];}_0x21fb7f++;}this[_0x6537('0x4')]=_0x17f19d;}else{while((_0x1ae5fe=_0x17f19d[_0x6537('0xa')](_0x1984df))!=-0x1){_0x1ff044=_0x17f19d[_0x6537('0xb')](0x0,_0x1ae5fe);this[_0x6537('0xf')]('line',_0x1ff044);_0x17f19d=_0x17f19d[_0x6537('0xb')](_0x1ae5fe+_0x1984df['length']);}this['_localBuffer']=_0x17f19d;}_0x5595ad();};module[_0x6537('0x11')]=AGIReply; \ No newline at end of file +var _0xb3f0=['length','split','slice','trim','emit','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring'];(function(_0x4bc4f0,_0x415be3){var _0x20a91d=function(_0x447e32){while(--_0x447e32){_0x4bc4f0['push'](_0x4bc4f0['shift']());}};_0x20a91d(++_0x415be3);}(_0xb3f0,0x1c8));var _0x0b3f=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xb3f0[_0x5c2c7c];return _0xea7ffe;};'use strict';var util=require(_0x0b3f('0x0'));var Transform=require('stream')[_0x0b3f('0x1')];function AGIReply(_0x55a054){Transform[_0x0b3f('0x2')](this,_0x55a054);this[_0x0b3f('0x3')]='';this[_0x0b3f('0x4')]=![];}util[_0x0b3f('0x5')](AGIReply,Transform);AGIReply[_0x0b3f('0x6')][_0x0b3f('0x7')]=function(_0x69fc54,_0xfc62b7,_0x1cc365){var _0x4c2dd5='\x0a',_0x2633f0=['\x0a\x0a',_0x0b3f('0x8')],_0x53dd9b=-0x1,_0x3b6cca=-0x1,_0x188155='',_0x416f0e=0x0,_0x5cdb00='',_0x1abc9b='';this[_0x0b3f('0x3')]+=_0x69fc54[_0x0b3f('0x9')]();_0x5cdb00=this['_localBuffer'];if(!this[_0x0b3f('0x4')]){_0x416f0e=0x0;while(_0x2633f0[_0x416f0e]){while((_0x3b6cca=_0x5cdb00[_0x0b3f('0xa')](_0x2633f0[_0x416f0e]))!=-0x1){_0x188155=_0x2633f0[_0x416f0e];_0x1abc9b=_0x5cdb00[_0x0b3f('0xb')](0x0,_0x3b6cca);_0x5cdb00=_0x5cdb00[_0x0b3f('0xb')](_0x3b6cca+_0x188155[_0x0b3f('0xc')]);var _0x3b33fe=_0x1abc9b[_0x0b3f('0xd')](_0x4c2dd5),_0x4e5fc9=0x0,_0x5f3dd0={},_0x23c9e8='',_0x100926='',_0x3586b9=-0x1;while(_0x3b33fe[_0x4e5fc9]){_0x3586b9=_0x3b33fe[_0x4e5fc9]['indexOf'](':');if(_0x3586b9!=-0x1){_0x23c9e8=_0x3b33fe[_0x4e5fc9][_0x0b3f('0xe')](0x0,_0x3586b9)[_0x0b3f('0xf')]();_0x100926=_0x3b33fe[_0x4e5fc9][_0x0b3f('0xe')](_0x3586b9+0x1)['trim']();if(_0x23c9e8[_0x0b3f('0xc')]>0x0){_0x5f3dd0[_0x23c9e8]=_0x100926;}}else{}_0x4e5fc9++;}this[_0x0b3f('0x10')]('headers',_0x5f3dd0);this[_0x0b3f('0x4')]=!![];}_0x416f0e++;}this[_0x0b3f('0x3')]=_0x5cdb00;}else{while((_0x53dd9b=_0x5cdb00['indexOf'](_0x4c2dd5))!=-0x1){_0x1abc9b=_0x5cdb00[_0x0b3f('0xb')](0x0,_0x53dd9b);this['emit']('line',_0x1abc9b);_0x5cdb00=_0x5cdb00[_0x0b3f('0xb')](_0x53dd9b+_0x4c2dd5[_0x0b3f('0xc')]);}this[_0x0b3f('0x3')]=_0x5cdb00;}_0x1cc365();};module[_0x0b3f('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6b953af..7e042af 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 _0x8e63=['agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','http','request','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser'];(function(_0x3954bf,_0x3ada57){var _0x34ef7c=function(_0x478e63){while(--_0x478e63){_0x3954bf['push'](_0x3954bf['shift']());}};_0x34ef7c(++_0x3ada57);}(_0x8e63,0x7c));var _0x38e6=function(_0x1c4964,_0x40e63a){_0x1c4964=_0x1c4964-0x0;var _0x18fac2=_0x8e63[_0x1c4964];return _0x18fac2;};'use strict';var _=require('lodash');var moment=require(_0x38e6('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x38e6('0x1')]({'port':0x2329});function request(_0xb2c68b,_0x1c6de7){return new Promise(function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x2')](_0xb2c68b,_0x1c6de7)[_0x38e6('0x3')](function(_0x344a0c){if(_0x344a0c['error']){return _0x4c85e7(_0x344a0c[_0x38e6('0x4')][_0x38e6('0x5')]);}else{return _0x5e5a71(_0x344a0c[_0x38e6('0x6')]);}})[_0x38e6('0x7')](function(_0x51b586){return _0x4c85e7(_0x51b586);});});}exports['getSquareProjects']=function(){return request(_0x38e6('0x8'),{'options':{'raw':![],'attributes':['id',_0x38e6('0x9'),_0x38e6('0xa')]}});};exports[_0x38e6('0xb')]=function(_0x438258){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x438258},'attributes':['production']}});};exports[_0x38e6('0xc')]=function(_0x4c5e34){return request(_0x38e6('0xd'),{'options':{'raw':![],'where':{'id':_0x4c5e34},'include':[{'model':'MailServerOut','as':_0x38e6('0xe'),'include':[{'model':_0x38e6('0xf'),'as':_0x38e6('0xf')}]}],'attributes':['id',_0x38e6('0x9'),_0x38e6('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2b4679){return request(_0x38e6('0x11'),{'options':{'where':{'id':_0x2b4679},'attributes':['name']}});};exports[_0x38e6('0x12')]=function(_0xfd7f2){return request(_0x38e6('0x13'),{'options':{'where':{'id':_0xfd7f2},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x14')]=function(_0x46b525){return request('ShowVariable',{'options':{'where':{'id':_0x46b525},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x15')]=function(_0x3299c9){return request(_0x38e6('0x16'),{'options':{'where':{'id':_0x3299c9},'attributes':[_0x38e6('0x17')]}});};exports['getUserById']=function(_0x91997a){return request('ShowUser',{'options':{'where':{'id':_0x91997a},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x18')]=function(_0x57ded4){return request(_0x38e6('0x19'),{'options':{'where':{'phone':_0x57ded4['phone']},'attributes':['id']}});};exports[_0x38e6('0x1a')]=function(_0x521453){return request(_0x38e6('0x1b'),{'options':{'where':{'id':_0x521453},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x1c')]=function(_0x137e09){return request(_0x38e6('0x1d'),{'options':{'where':{'id':_0x137e09},'attributes':[_0x38e6('0x1e')]}});};exports['getIntervalById']=function(_0x5f3f67){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5f3f67},'include':[{'model':_0x38e6('0x1f'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x2d995f){return request(_0x38e6('0x20'),{'options':{'where':{'id':_0x2d995f},'attributes':['id',_0x38e6('0x9')]}});};exports[_0x38e6('0x21')]=function(_0x5f5ab2){return request(_0x38e6('0x22'),{'body':_0x5f5ab2});};exports[_0x38e6('0x23')]=function(_0x185922){return request('CreateSquareDetailsReport',{'body':_0x185922});};exports[_0x38e6('0x24')]=function(_0x399b70){return request(_0x38e6('0x25'),{'body':_[_0x38e6('0x26')](_0x399b70,{'project_name':_0x399b70[_0x38e6('0x27')],'prev_project_name':_0x399b70[_0x38e6('0x28')]||'','is_subproject':_0x399b70[_0x38e6('0x28')]?!![]:![],'leaveAt':moment()[_0x38e6('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x38e6('0x2a')]=function(_0x491588){return request(_0x38e6('0x2b'),{'body':_0x491588});};exports[_0x38e6('0x2c')]=function(_0x446ed5){return request(_0x38e6('0x2d'),{'body':_0x446ed5});};exports[_0x38e6('0x2e')]=function(_0x1afc04){return request(_0x38e6('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1afc04['phone'],'ListId':_0x1afc04[_0x38e6('0x30')]}}})[_0x38e6('0x3')](function(_0x48f5a2){if(_0x48f5a2){return _0x48f5a2;}return request(_0x38e6('0x31'),{'body':_0x1afc04});});};exports[_0x38e6('0x32')]=function(_0x526569){return request(_0x38e6('0x33'),{'options':{'where':{'id':_0x526569},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x34')]=function(_0x3ce1c2,_0xe7489){return request(_0x38e6('0x35'),{'body':{'interface':_0xe7489},'options':{'where':_0x3ce1c2}});};exports[_0x38e6('0x36')]=function(_0x5a5979,_0x220c19,_0x3d231a){return request(_0x38e6('0x37'),{'body':{'type':_0x220c19,'uniqueid':_0x3d231a},'options':{'where':_0x5a5979}});};exports[_0x38e6('0x38')]=function(_0x15232f){return request(_0x38e6('0x39'),{'body':{},'options':{'where':_0x15232f}});};exports[_0x38e6('0x3a')]=function(_0x57d22c){return request(_0x38e6('0x3b'),{'body':{},'options':{'where':_0x57d22c}});}; \ No newline at end of file +var _0x279d=['getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Interval'];(function(_0x3cfe54,_0x34b928){var _0x3c49a5=function(_0x3dc0e7){while(--_0x3dc0e7){_0x3cfe54['push'](_0x3cfe54['shift']());}};_0x3c49a5(++_0x34b928);}(_0x279d,0x1d8));var _0xd279=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x279d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd279('0x0'));var moment=require(_0xd279('0x1'));var jayson=require(_0xd279('0x2'));var client=jayson[_0xd279('0x3')]['http']({'port':0x2329});function request(_0x4901ec,_0x3e9699){return new Promise(function(_0x44441d,_0x47cfee){return client[_0xd279('0x4')](_0x4901ec,_0x3e9699)[_0xd279('0x5')](function(_0x239116){if(_0x239116[_0xd279('0x6')]){return _0x47cfee(_0x239116[_0xd279('0x6')][_0xd279('0x7')]);}else{return _0x44441d(_0x239116[_0xd279('0x8')]);}})['catch'](function(_0x3cd28e){return _0x47cfee(_0x3cd28e);});});}exports[_0xd279('0x9')]=function(){return request(_0xd279('0xa'),{'options':{'raw':![],'attributes':['id',_0xd279('0xb'),_0xd279('0xc')]}});};exports[_0xd279('0xd')]=function(_0x3387e9){return request(_0xd279('0xe'),{'options':{'raw':![],'where':{'name':_0x3387e9},'attributes':[_0xd279('0xc')]}});};exports[_0xd279('0xf')]=function(_0x24f356){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x24f356},'include':[{'model':_0xd279('0x10'),'as':'Smtp','include':[{'model':_0xd279('0x11'),'as':_0xd279('0x11')}]}],'attributes':['id','name',_0xd279('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x590646){return request(_0xd279('0xe'),{'options':{'where':{'id':_0x590646},'attributes':['name']}});};exports[_0xd279('0x13')]=function(_0x5c3b48){return request(_0xd279('0x14'),{'options':{'where':{'id':_0x5c3b48},'attributes':[_0xd279('0xb')]}});};exports[_0xd279('0x15')]=function(_0x1161b3){return request('ShowVariable',{'options':{'where':{'id':_0x1161b3},'attributes':['name']}});};exports[_0xd279('0x16')]=function(_0x440e80){return request(_0xd279('0x17'),{'options':{'where':{'id':_0x440e80},'attributes':[_0xd279('0x18')]}});};exports['getUserById']=function(_0x5701c0){return request('ShowUser',{'options':{'where':{'id':_0x5701c0},'attributes':['name']}});};exports['getContactByPhone']=function(_0x1394bb){return request(_0xd279('0x19'),{'options':{'where':{'phone':_0x1394bb['phone']},'attributes':['id']}});};exports[_0xd279('0x1a')]=function(_0xd3b5d3){return request(_0xd279('0x1b'),{'options':{'where':{'id':_0xd3b5d3},'attributes':[_0xd279('0xb')]}});};exports['getSoundById']=function(_0xa7928f){return request(_0xd279('0x1c'),{'options':{'where':{'id':_0xa7928f},'attributes':['save_name']}});};exports[_0xd279('0x1d')]=function(_0x395762){return request(_0xd279('0x1e'),{'options':{'raw':![],'where':{'id':_0x395762},'include':[{'model':_0xd279('0x1f'),'as':'Intervals'}]}});};exports[_0xd279('0x20')]=function(_0x2716f4){return request(_0xd279('0x21'),{'options':{'where':{'id':_0x2716f4},'attributes':['id','name']}});};exports[_0xd279('0x22')]=function(_0x1a06e7){return request(_0xd279('0x23'),{'body':_0x1a06e7});};exports[_0xd279('0x24')]=function(_0x251de4){return request(_0xd279('0x25'),{'body':_0x251de4});};exports[_0xd279('0x26')]=function(_0x1d28f3){return request(_0xd279('0x27'),{'body':_['merge'](_0x1d28f3,{'project_name':_0x1d28f3['arg_1'],'prev_project_name':_0x1d28f3[_0xd279('0x28')]||'','is_subproject':_0x1d28f3[_0xd279('0x28')]?!![]:![],'leaveAt':moment()['format'](_0xd279('0x29'))})});};exports[_0xd279('0x2a')]=function(_0x29e166){return request(_0xd279('0x2b'),{'body':_0x29e166});};exports['createSquareMessage']=function(_0xbca7ab){return request(_0xd279('0x2c'),{'body':_0xbca7ab});};exports['createCmContact']=function(_0x43aacd){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x43aacd[_0xd279('0x2d')],'ListId':_0x43aacd[_0xd279('0x2e')]}}})[_0xd279('0x5')](function(_0x47175a){if(_0x47175a){return _0x47175a;}return request(_0xd279('0x2f'),{'body':_0x43aacd});});};exports[_0xd279('0x30')]=function(_0x1e585d){return request(_0xd279('0x31'),{'options':{'where':{'id':_0x1e585d},'attributes':[_0xd279('0xb')]}});};exports['agentLogin']=function(_0x45984f,_0x41c529){return request(_0xd279('0x32'),{'body':{'interface':_0x41c529},'options':{'where':_0x45984f}});};exports[_0xd279('0x33')]=function(_0x2eb52d,_0x444270,_0x3e8aa5){return request(_0xd279('0x34'),{'body':{'type':_0x444270,'uniqueid':_0x3e8aa5},'options':{'where':_0x2eb52d}});};exports[_0xd279('0x35')]=function(_0x543886){return request('UnpauseUser',{'body':{},'options':{'where':_0x543886}});};exports[_0xd279('0x36')]=function(_0x14475e){return request(_0xd279('0x37'),{'body':{},'options':{'where':_0x14475e}});}; \ 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 0a55679..a0a2dc6 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 _0xb2ad=['./lex'];(function(_0xd3ea0d,_0x3b8cc1){var _0x4d3540=function(_0x4963b9){while(--_0x4963b9){_0xd3ea0d['push'](_0xd3ea0d['shift']());}};_0x4d3540(++_0x3b8cc1);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0xb2ad[_0x2ff1f6];return _0xbae96d;};var polly=require('./polly');var lex=require(_0xdb2a('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3981=['./polly','exports'];(function(_0x26d1d7,_0x3bc0f1){var _0x520f59=function(_0x1e1219){while(--_0x1e1219){_0x26d1d7['push'](_0x26d1d7['shift']());}};_0x520f59(++_0x3bc0f1);}(_0x3981,0x144));var _0x1398=function(_0x5b56a9,_0xd9edd1){_0x5b56a9=_0x5b56a9-0x0;var _0x20b24c=_0x3981[_0x5b56a9];return _0x20b24c;};var polly=require(_0x1398('0x0'));var lex=require('./lex');module[_0x1398('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 08acb24..e9e05b5 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 _0x878f=['exports'];(function(_0x16d180,_0x26025c){var _0x3ffea6=function(_0x27a713){while(--_0x27a713){_0x16d180['push'](_0x16d180['shift']());}};_0x3ffea6(++_0x26025c);}(_0x878f,0x173));var _0xf878=function(_0x31b2b0,_0x5421a2){_0x31b2b0=_0x31b2b0-0x0;var _0x21aaf4=_0x878f[_0x31b2b0];return _0x21aaf4;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ No newline at end of file +var _0xd64b=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0x2357fa,_0x31300a){_0x2357fa=_0x2357fa-0x0;var _0x3c956b=_0xd64b[_0x2357fa];return _0x3c956b;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ 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 5751b54..8215e9c 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xaabd5f,_0x4ee6fb){var _0x2a2fcd=function(_0x19b877){while(--_0x19b877){_0xaabd5f['push'](_0xaabd5f['shift']());}};_0x2a2fcd(++_0x4ee6fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x7486c9,_0x2575f3){var _0x208fd1=function(_0x5a9246){while(--_0x5a9246){_0x7486c9['push'](_0x7486c9['shift']());}};_0x208fd1(++_0x2575f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index e7b4ada..1c13c20 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 _0x2799=['exports','./lib/api'];(function(_0x3cf447,_0x4d057e){var _0x151135=function(_0x42c4d9){while(--_0x42c4d9){_0x3cf447['push'](_0x3cf447['shift']());}};_0x151135(++_0x4d057e);}(_0x2799,0x14b));var _0x9279=function(_0x284f56,_0x4016f4){_0x284f56=_0x284f56-0x0;var _0x4ad406=_0x2799[_0x284f56];return _0x4ad406;};'use strict';var polly=require(_0x9279('0x0'));module[_0x9279('0x1')]=function(_0x29d864,_0xbf22a7,_0x604b2b,_0x48349d,_0x32cf48,_0x67f59e,_0x3ac147){return polly(_0x29d864,_0xbf22a7,_0x604b2b,_0x48349d,_0x32cf48,_0x67f59e,_0x3ac147);}; \ No newline at end of file +var _0x2874=['./lib/api','exports'];(function(_0x57d843,_0x2a95e0){var _0x42ba2d=function(_0x46cb71){while(--_0x46cb71){_0x57d843['push'](_0x57d843['shift']());}};_0x42ba2d(++_0x2a95e0);}(_0x2874,0x130));var _0x4287=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0x2874[_0x9a7ea6];return _0x1c2040;};'use strict';var polly=require(_0x4287('0x0'));module[_0x4287('0x1')]=function(_0xf33a72,_0x1ac10b,_0x2a3b5f,_0x5ccd31,_0x1cb14a,_0x5ec288,_0xd3a6b2){return polly(_0xf33a72,_0x1ac10b,_0x2a3b5f,_0x5ccd31,_0x1cb14a,_0x5ec288,_0xd3a6b2);}; \ 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 92cbe20..e852e26 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 _0x1e16=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x1e16,0x1ed));var _0x61e1=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x1e16[_0x44fef1];return _0x3c3a04;};'use strict';var fs=require('fs');var path=require(_0x61e1('0x0'));var BPromise=require(_0x61e1('0x1'));var rs=require(_0x61e1('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x14a8ea,_0x5735c1,_0x11a75b){return new BPromise(function(_0xa1800f,_0x661cf0){_0x14a8ea[_0x61e1('0x3')](_0x5735c1,function(_0x4adac1,_0x11942b){if(_0x4adac1){_0x661cf0(_0x4adac1);}else if(_0x11942b){if(_0x11942b[_0x61e1('0x4')]instanceof Buffer){fs[_0x61e1('0x5')](_0x11a75b,_0x11942b['AudioStream'],function(_0x121697){if(_0x121697){_0x661cf0(_0x121697);}else{_0xa1800f();}});}else{_0x661cf0(new Error(_0x61e1('0x6')));}}else{_0x661cf0(new Error(_0x61e1('0x7')));}});});}module['exports']=function(_0x116e84,_0x5d26b1,_0x1234bf,_0x4d0c48,_0xb01220,_0x241062,_0x149685){var _0x410fb4=new AWS[(_0x61e1('0x8'))]({'accessKeyId':_0x116e84,'secretAccessKey':_0x5d26b1,'region':_0x1234bf});var _0x53e1e0={'Text':_0xb01220,'TextType':_0x241062||_0x61e1('0x9'),'OutputFormat':'mp3','VoiceId':_0x4d0c48};return pollyResult(_0x410fb4,_0x53e1e0,_0x149685);}; \ No newline at end of file +var _0xec21=['bluebird','randomstring','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec21,0x167));var _0x1ec2=function(_0x2a702f,_0x377aa7){_0x2a702f=_0x2a702f-0x0;var _0x52106f=_0xec21[_0x2a702f];return _0x52106f;};'use strict';var fs=require('fs');var path=require(_0x1ec2('0x0'));var BPromise=require(_0x1ec2('0x1'));var rs=require(_0x1ec2('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x42d35c,_0xa24a72,_0x107313){return new BPromise(function(_0x37ed65,_0x33e0b1){_0x42d35c['synthesizeSpeech'](_0xa24a72,function(_0x2ea806,_0x3a7840){if(_0x2ea806){_0x33e0b1(_0x2ea806);}else if(_0x3a7840){if(_0x3a7840['AudioStream']instanceof Buffer){fs[_0x1ec2('0x3')](_0x107313,_0x3a7840[_0x1ec2('0x4')],function(_0x36f34f){if(_0x36f34f){_0x33e0b1(_0x36f34f);}else{_0x37ed65();}});}else{_0x33e0b1(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x33e0b1(new Error(_0x1ec2('0x5')));}});});}module['exports']=function(_0x439285,_0x1f4d55,_0x38e959,_0x14472c,_0x586bf6,_0x4ada53,_0x49b6ae){var _0x16feb8=new AWS[(_0x1ec2('0x6'))]({'accessKeyId':_0x439285,'secretAccessKey':_0x1f4d55,'region':_0x38e959});var _0x4ca941={'Text':_0x586bf6,'TextType':_0x4ada53||_0x1ec2('0x7'),'OutputFormat':_0x1ec2('0x8'),'VoiceId':_0x14472c};return pollyResult(_0x16feb8,_0x4ca941,_0x49b6ae);}; \ 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 f827388..c472d9c 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 _0xae9b=['./lib/api','exports'];(function(_0x28dda4,_0x10a80d){var _0x3f0b34=function(_0x4d6633){while(--_0x4d6633){_0x28dda4['push'](_0x28dda4['shift']());}};_0x3f0b34(++_0x10a80d);}(_0xae9b,0x13c));var _0xbae9=function(_0x2d2b8f,_0x45e019){_0x2d2b8f=_0x2d2b8f-0x0;var _0x5768fc=_0xae9b[_0x2d2b8f];return _0x5768fc;};'use strict';var asr=require(_0xbae9('0x0'));module[_0xbae9('0x1')]=function(_0x899cb0,_0x3f33c4,_0x46fac5,_0x41d08e){return asr(_0x899cb0,_0x3f33c4,_0x46fac5);}; \ No newline at end of file +var _0xf3d9=['exports'];(function(_0xd89fde,_0x4d2417){var _0xe67f58=function(_0x4b21f9){while(--_0x4b21f9){_0xd89fde['push'](_0xd89fde['shift']());}};_0xe67f58(++_0x4d2417);}(_0xf3d9,0x1dd));var _0x9f3d=function(_0xb70a50,_0x20a2e8){_0xb70a50=_0xb70a50-0x0;var _0x304483=_0xf3d9[_0xb70a50];return _0x304483;};'use strict';var asr=require('./lib/api');module[_0x9f3d('0x0')]=function(_0x39909e,_0x32012d,_0x1d507c,_0x38ec7b){return asr(_0x39909e,_0x32012d,_0x1d507c);}; \ 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 650c228..d0e2003 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 _0xda55=['filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','string'];(function(_0x4bcccf,_0x4eb4af){var _0x2298f4=function(_0x2daddf){while(--_0x2daddf){_0x4bcccf['push'](_0x4bcccf['shift']());}};_0x2298f4(++_0x4eb4af);}(_0xda55,0x6d));var _0x5da5=function(_0x37f79c,_0x38f023){_0x37f79c=_0x37f79c-0x0;var _0x3e8566=_0xda55[_0x37f79c];return _0x3e8566;};'use strict';var url=require(_0x5da5('0x0'));var BPromise=require(_0x5da5('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x13ecbc,_0x240a49,_0x26a443){return new BPromise(function(_0x50cf9f,_0x1c3afd){var _0x5da254;if(typeof _0x13ecbc!==_0x5da5('0x2')||_0x13ecbc['length']===0x0){return _0x1c3afd(_0x5da5('0x3'));}if(typeof _0x240a49!=='string'||_0x240a49[_0x5da5('0x4')]===0x0){return _0x1c3afd(_0x5da5('0x5'));}if(typeof _0x26a443!==_0x5da5('0x6')&&(typeof _0x26a443!==_0x5da5('0x2')||_0x26a443[_0x5da5('0x4')]===0x0)){return _0x1c3afd(_0x5da5('0x7'));}try{_0x5da254=fs[_0x5da5('0x8')](_0x13ecbc)[_0x5da5('0x9')]('base64');}catch(_0x3ed24c){return _0x1c3afd(_0x3ed24c);}return _0x50cf9f({'method':_0x5da5('0xa'),'uri':host+_0x5da5('0xb')+_0x240a49,'body':{'config':{'encoding':_0x5da5('0xc'),'sampleRateHertz':_0x5da5('0xd'),'languageCode':_0x26a443},'audio':{'content':_0x5da254}},'json':!![]});});}; \ No newline at end of file +var _0xde9d=['readFileSync','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x31f207,_0x33353a){var _0x1089ef=function(_0xdaaf31){while(--_0xdaaf31){_0x31f207['push'](_0x31f207['shift']());}};_0x1089ef(++_0x33353a);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var url=require(_0xdde9('0x0'));var BPromise=require(_0xdde9('0x1'));var fs=require('fs');var host=_0xdde9('0x2');module[_0xdde9('0x3')]=function(_0x20ab4a,_0x49fbbe,_0x2a7fa7){return new BPromise(function(_0x28cc44,_0x1aebe6){var _0x4a5ea5;if(typeof _0x20ab4a!==_0xdde9('0x4')||_0x20ab4a[_0xdde9('0x5')]===0x0){return _0x1aebe6(_0xdde9('0x6'));}if(typeof _0x49fbbe!=='string'||_0x49fbbe[_0xdde9('0x5')]===0x0){return _0x1aebe6(_0xdde9('0x7'));}if(typeof _0x2a7fa7!==_0xdde9('0x8')&&(typeof _0x2a7fa7!==_0xdde9('0x4')||_0x2a7fa7[_0xdde9('0x5')]===0x0)){return _0x1aebe6('lang\x20should\x20be\x20a\x20string');}try{_0x4a5ea5=fs[_0xdde9('0x9')](_0x20ab4a)['toString']('base64');}catch(_0x259849){return _0x1aebe6(_0x259849);}return _0x28cc44({'method':_0xdde9('0xa'),'uri':host+_0xdde9('0xb')+_0x49fbbe,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xdde9('0xc'),'languageCode':_0x2a7fa7},'audio':{'content':_0x4a5ea5}},'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 0fcb6b3..2eacf3e 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 _0x3706=['./asr','exports'];(function(_0x186e30,_0x4be1e4){var _0x4202cd=function(_0x37dd7e){while(--_0x37dd7e){_0x186e30['push'](_0x186e30['shift']());}};_0x4202cd(++_0x4be1e4);}(_0x3706,0x12e));var _0x6370=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x3706[_0x102e37];return _0x35a07c;};var asr=require(_0x6370('0x0'));module[_0x6370('0x1')]={'asr':asr}; \ No newline at end of file +var _0x466e=['exports','./asr'];(function(_0x3ca4da,_0x203d08){var _0x39380f=function(_0x3c0b2c){while(--_0x3c0b2c){_0x3ca4da['push'](_0x3ca4da['shift']());}};_0x39380f(++_0x203d08);}(_0x466e,0x113));var _0xe466=function(_0x328a1a,_0x368b7c){_0x328a1a=_0x328a1a-0x0;var _0xd99dd=_0x466e[_0x328a1a];return _0xd99dd;};var asr=require(_0xe466('0x0'));module[_0xe466('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 7adb3ed..9b4d770 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 _0x741d=['googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','pipe','end','https:','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','googleASR\x20transcription'];(function(_0x3a79d3,_0x2eefcd){var _0x169600=function(_0x18f4e5){while(--_0x18f4e5){_0x3a79d3['push'](_0x3a79d3['shift']());}};_0x169600(++_0x2eefcd);}(_0x741d,0x152));var _0xd741=function(_0x2105c2,_0x58f5e2){_0x2105c2=_0x2105c2-0x0;var _0x2d24bb=_0x741d[_0x2105c2];return _0x2d24bb;};'use strict';var apiai=require(_0xd741('0x0'));var BPromise=require(_0xd741('0x1'));var dialogflow=require(_0xd741('0x2'));var fs=require('fs');var http=require(_0xd741('0x3'));var https=require(_0xd741('0x4'));var md5=require(_0xd741('0x5'));var path=require(_0xd741('0x6'));var querystring=require(_0xd741('0x7'));var rp=require(_0xd741('0x8'));var rs=require('randomstring');var sox=require(_0xd741('0x9'));var tts=require(_0xd741('0xa'));var urlParse=require(_0xd741('0xb'))[_0xd741('0xc')];var util=require('util');var aws=require(_0xd741('0xd'));var google=require('./google');var sestek=require(_0xd741('0xe'));var tilde=require(_0xd741('0xf'));var logger=require(_0xd741('0x10'))('agi');var ISPEECH_API=_0xd741('0x11');function downloadFile(_0x176ed6,_0x1f8732){return new BPromise(function(_0x1cc7b7,_0x5223d1){var _0x6fdd59=urlParse(_0x176ed6);var _0x5875db=_0x6fdd59[_0xd741('0x12')]==='https:'?https:http;var _0x1a656d={'host':_0x6fdd59[_0xd741('0x13')],'path':_0x6fdd59[_0xd741('0x6')],'headers':{'user-agent':_0xd741('0x14')}};_0x5875db[_0xd741('0x15')](_0x1a656d,function(_0x2db179){if(_0x2db179[_0xd741('0x16')]!==0xc8){logger[_0xd741('0x17')](_0xd741('0x18')+_0x176ed6+_0xd741('0x19')+_0x2db179['statusCode']+'\x20('+_0x2db179[_0xd741('0x1a')]+')');_0x5223d1(new Error(_0xd741('0x18')+_0x176ed6+_0xd741('0x19')+_0x2db179[_0xd741('0x16')]+'\x20('+_0x2db179[_0xd741('0x1a')]+')'));return;}var _0x571cfa=fs['createWriteStream'](_0x1f8732);_0x571cfa['on'](_0xd741('0x1b'),function(){logger[_0xd741('0x1c')](_0xd741('0x1d'));_0x571cfa['close'](_0x1cc7b7);});_0x571cfa['on'](_0xd741('0x17'),function(_0x53847d){fs[_0xd741('0x1e')](_0x1f8732);logger[_0xd741('0x17')]('download\x20error',_0x53847d);_0x5223d1(_0x53847d);});_0x2db179[_0xd741('0x1f')](_0x571cfa);})['on']('error',function(_0x10f955){logger[_0xd741('0x17')](_0x10f955);_0x5223d1(_0x10f955);})[_0xd741('0x20')]();});}function uploadFile(_0x2bf576){return new BPromise(function(_0x1e81bd,_0x4693a2){var _0x3270e5=urlParse(_0x2bf576);var _0x2ab2bc=_0x3270e5[_0xd741('0x12')]===_0xd741('0x21')?https:http;var _0x5af157={'host':_0x3270e5['host'],'path':_0x3270e5[_0xd741('0x6')],'headers':{'user-agent':_0xd741('0x14')}};_0x2ab2bc[_0xd741('0x15')](_0x5af157,function(_0x456fe0){if(_0x456fe0['statusCode']!==0xc8){_0x4693a2(new Error(_0xd741('0x18')+_0x2bf576+'\x20failed,\x20status\x20code\x20=\x20'+_0x456fe0[_0xd741('0x16')]+'\x20('+_0x456fe0[_0xd741('0x1a')]+')'));return;}var _0x47fa7e='';_0x456fe0['on']('data',function(_0x53e254){_0x47fa7e+=_0x53e254;});_0x456fe0['on'](_0xd741('0x20'),function(){_0x1e81bd(_0x47fa7e);});})['on'](_0xd741('0x17'),function(_0x3ea312){_0x4693a2(_0x3ea312);})[_0xd741('0x20')]();});}function convertFile(_0x42db5b,_0x10b1a5){return new BPromise(function(_0x13a983,_0x2788bb){var _0x49d627=sox[_0xd741('0x22')](_0x42db5b,_0x10b1a5,{'sampleRate':0x1f40,'format':_0xd741('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x49d627['on'](_0xd741('0x17'),function(_0x562aa3){logger[_0xd741('0x17')](_0xd741('0x24'),_0x562aa3);_0x2788bb(_0x562aa3);});_0x49d627['on'](_0xd741('0x20'),function(){logger[_0xd741('0x1c')](_0xd741('0x25'));_0x13a983();});_0x49d627[_0xd741('0x26')]();});}function base64Decode(_0x498eef,_0x21e979){var _0x4f0476=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x29'));fs[_0xd741('0x2a')](_0x4f0476,_0x498eef,_0xd741('0x2b'));return convertFile(_0x4f0476,_0x21e979)[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x4f0476);fs['chmodSync'](_0x21e979,_0xd741('0x2d'));}catch(_0x396f64){logger[_0xd741('0x17')](_0x396f64);}return _0x21e979[_0xd741('0x2e')]('.')[0x0];});}function base64Encode(_0x538fa9){var _0x405bd3=fs[_0xd741('0x2f')](_0x538fa9);return new Buffer(_0x405bd3)[_0xd741('0x30')](_0xd741('0x2b'));}exports['googleCloudTTS']=function(_0x2f0c70,_0x1fade2,_0x7c0a95,_0x252dec,_0x436432,_0x367a0f){var _0x5038d5,_0x669b16;var _0x1b382f=_0xd741('0x31');var _0x1d840e=_0xd741('0x32')+_0x2f0c70;var _0x478618={};if(_0x1fade2===_0xd741('0x33')){_0x478618[_0xd741('0x34')]={'ssml':_0x7c0a95};}else{_0x478618[_0xd741('0x34')]={'text':_0x7c0a95};};_0x478618[_0xd741('0x35')]={'languageCode':_0x252dec,'ssmlGender':_0x436432};_0x478618[_0xd741('0x36')]={'audioEncoding':_0xd741('0x37'),'sampleRateHertz':0x1f40};var _0x2f0844={'url':_0x1b382f+_0xd741('0x38')+_0x1d840e,'method':_0xd741('0x39'),'json':!![],'body':_0x478618};return rp(_0x2f0844)[_0xd741('0x2c')](function(_0x580355){return new BPromise(function(_0x3c9c66,_0x4fd19e){_0x5038d5=path[_0xd741('0x27')](__dirname,'tmp',rs[_0xd741('0x3a')](0x4)+_0xd741('0x3b'));var _0x28bb78=Buffer[_0xd741('0x3c')](_0x580355[_0xd741('0x3d')],'base64');return fs[_0xd741('0x3e')](_0x5038d5,_0x28bb78,function(_0x578049){_0x4fd19e(_0x578049);},function(_0x3c39d3){fs[_0xd741('0x3f')](_0x5038d5,_0xd741('0x2d'));_0x3c9c66(_0x3c39d3);});});})[_0xd741('0x2c')](function(_0x59a52d){_0x669b16=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+_0xd741('0x29'));return convertFile(_0x5038d5,_0x669b16);})['then'](function(){try{fs[_0xd741('0x1e')](_0x5038d5);fs[_0xd741('0x3f')](_0x669b16,_0xd741('0x2d'));}catch(_0x2fbeee){logger[_0xd741('0x17')](_0x2fbeee);}logger['info'](_0xd741('0x40'),_0x669b16[_0xd741('0x2e')]('.')[0x0]);return _0x669b16[_0xd741('0x2e')]('.')[0x0];});};exports[_0xd741('0x41')]=function(_0x185ef3,_0x16fb93){var _0x26a805=_0xd741('0x42');var _0x21a20c,_0x410ace;var _0x467170;var _0x170db8={'encoding':_0xd741('0x43'),'method':_0xd741('0x39'),'timeout':0x2710,'url':_0x26a805,'headers':{'Content-Type':_0xd741('0x44')},'body':_0xd741('0x45')+encodeURIComponent(JSON[_0xd741('0x46')]([[['jQ1olc',JSON[_0xd741('0x46')]([_0x185ef3,_0x16fb93||'en',![],_0xd741('0x47')]),null,_0xd741('0x48')]]]))};return rp(_0x170db8)[_0xd741('0x2c')](function(_0xfd8d3d){try{_0x467170=eval(_0xfd8d3d[_0xd741('0x49')](0x5))[0x0][0x2];}catch(_0x2251ca){throw new Error(_0xd741('0x4a')+_0xfd8d3d[_0xd741('0x4b')]);}if(!_0x467170){if(_0x185ef3[_0xd741('0x4c')]>0xc8){throw new Error(_0xd741('0x4d'));}else{throw new Error(_0xd741('0x4e')+_0x16fb93+_0xd741('0x4f'));}}try{_0x467170=eval(_0x467170)[0x0];}catch(_0x4bf8dc){throw new Error(_0xd741('0x4a')+res['data']);}const _0x5c1f77=_0x467170;_0x21a20c=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+_0xd741('0x3b'));fs[_0xd741('0x2a')](_0x21a20c,_0x467170,{'encoding':'base64'});_0x410ace=path[_0xd741('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xd741('0x29'));return convertFile(_0x21a20c,_0x410ace);})[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x21a20c);fs[_0xd741('0x3f')](_0x410ace,_0xd741('0x2d'));}catch(_0x3e3b59){logger[_0xd741('0x17')](_0x3e3b59);}logger[_0xd741('0x1c')](_0xd741('0x50'),_0x410ace['split']('.')[0x0]);return _0x410ace[_0xd741('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x417cbc,_0xa5161d,_0x27af8d){return google[_0xd741('0x51')](_0x417cbc,_0xa5161d,_0x27af8d)[_0xd741('0x2c')](function(_0x49ee63){logger[_0xd741('0x1c')](_0x49ee63['uri']);return rp(_0x49ee63);})[_0xd741('0x2c')](function(_0x2b6e21){var _0x281cc4='';var _0x3a1252=0x0;try{fs[_0xd741('0x1e')](_0x417cbc);}catch(_0x39b8fa){logger[_0xd741('0x17')](_0x39b8fa);}if(_0x2b6e21&&_0x2b6e21[_0xd741('0x52')]){_0x281cc4=_0x2b6e21[_0xd741('0x52')][_0xd741('0x53')](function(_0x5c5a4d){return _0x5c5a4d&&_0x5c5a4d[_0xd741('0x54')][0x0]&&_0x5c5a4d['alternatives'][0x0][_0xd741('0x55')]?_0x5c5a4d[_0xd741('0x54')][0x0][_0xd741('0x55')]:'';})[_0xd741('0x56')]('\x0a');_0x3a1252=_0x2b6e21['results'][_0xd741('0x53')](function(_0x154550){return _0x154550&&_0x154550[_0xd741('0x54')][0x0]&&_0x154550['alternatives'][0x0]['confidence']?_0x154550['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xd741('0x1c')](_0xd741('0x57'),_0x281cc4);logger[_0xd741('0x1c')](_0xd741('0x58'),_0x3a1252);return{'transcript':_0x281cc4,'confidence':_0x3a1252};})[_0xd741('0x59')](function(_0x4361b4){logger[_0xd741('0x17')](_0xd741('0x5a'),_0x4361b4[_0xd741('0x16')],_0x4361b4['name'],_0x4361b4[_0xd741('0x5b')]);});};exports['googleDialogflow']=function(_0x3850c6,_0x2e45eb,_0x582ac9,_0x345380){var _0x1a43cf=apiai(_0x2e45eb,{'language':_0x345380||'en'});return _0x1a43cf[_0xd741('0x5c')](_0x582ac9,{'sessionId':md5(_0x3850c6)})[_0xd741('0x2c')](function(_0x4815a9){logger[_0xd741('0x1c')](JSON[_0xd741('0x46')](_0x4815a9));return{'source':_0x4815a9[_0xd741('0x5d')][_0xd741('0x5e')],'resolvedQuery':_0x4815a9[_0xd741('0x5d')][_0xd741('0x5f')],'action':_0x4815a9[_0xd741('0x5d')][_0xd741('0x60')],'actionIncomplete':_0x4815a9['result'][_0xd741('0x61')],'speech':_0x4815a9[_0xd741('0x5d')][_0xd741('0x62')][_0xd741('0x63')],'score':_0x4815a9['result'][_0xd741('0x64')],'statusCode':_0x4815a9[_0xd741('0x65')]['code'],'endConversation':_0x4815a9[_0xd741('0x5d')]['metadata'][_0xd741('0x66')]||![],'isFallbackIntent':_0x4815a9[_0xd741('0x5d')][_0xd741('0x67')][_0xd741('0x68')]};});};exports[_0xd741('0x69')]=function(_0x258b6a,_0x505580,_0x36b5eb,_0x498c17,_0x3be8c2,_0x4b82e6){var _0x319761=_0x498c17[_0xd741('0x6a')](/\\n/g,'\x0a');var _0x491332={'credentials':{'private_key':_0x319761,'client_email':_0x36b5eb}};var _0x1ab3ef=new dialogflow[(_0xd741('0x6b'))](_0x491332);var _0x323531=_0x1ab3ef[_0xd741('0x6c')](_0x505580,md5(_0x258b6a));var _0x4ad267={'session':_0x323531,'queryInput':{'text':{'text':_0x3be8c2,'languageCode':_0x4b82e6}}};return _0x1ab3ef[_0xd741('0x6d')](_0x4ad267)[_0xd741('0x2c')](function(_0x4334e9){if(_0x4334e9&&_0x4334e9[_0xd741('0x4c')]){logger['info'](_0xd741('0x6e'),JSON['stringify'](_0x4334e9));var _0x1d39a9=_0x4334e9[0x0];if(_0x1d39a9){var _0x5d6e16={'action':_0x1d39a9[_0xd741('0x6f')]['action'],'allRequiredParamsPresent':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x70')],'endConversation':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')]&&_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')][_0xd741('0x72')]?_0x1d39a9[_0xd741('0x6f')][_0xd741('0x71')][_0xd741('0x72')][_0xd741('0x73')][_0xd741('0x74')]:![],'fulfillmentText':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x75')],'intentName':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x76')]['name'],'intentDisplayName':_0x1d39a9['queryResult'][_0xd741('0x76')]['displayName'],'isFallbackIntent':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x76')]['isFallback'],'languageCode':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x77')],'queryText':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x78')],'responseId':_0x1d39a9['responseId'],'score':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x79')],'speech':_0x1d39a9[_0xd741('0x6f')][_0xd741('0x75')],'providerResponse':JSON[_0xd741('0x46')](_0x4334e9)};return _0x5d6e16;}}});};exports[_0xd741('0x7a')]=function(_0x11676c,_0x255030,_0x241bf0,_0x367cca){return tilde[_0xd741('0x51')](_0x11676c,_0x255030,_0x241bf0,_0x367cca)['then'](function(_0x29ba27){try{fs[_0xd741('0x1e')](_0x11676c);}catch(_0x41e8c9){logger[_0xd741('0x17')](_0x41e8c9);}logger[_0xd741('0x1c')](_0xd741('0x7b'),_0x29ba27[_0xd741('0x55')]);logger[_0xd741('0x1c')](_0xd741('0x7c'),_0x29ba27[_0xd741('0x7d')]);return _0x29ba27;});};exports['awsPolly']=function(_0x2d193d,_0x36dae0,_0x117949,_0x20ecd3,_0x2f5ecf,_0x894a43){var _0x4adc4c=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x3b'));var _0x56a76f;return aws['polly'](_0x2d193d,_0x36dae0,_0x117949,_0x20ecd3,_0x2f5ecf,_0x894a43,_0x4adc4c)['then'](function(){_0x56a76f=path[_0xd741('0x27')](__dirname,'tmp',rs[_0xd741('0x3a')](0x4)+_0xd741('0x29'));return convertFile(_0x4adc4c,_0x56a76f);})[_0xd741('0x2c')](function(){try{fs[_0xd741('0x1e')](_0x4adc4c);fs[_0xd741('0x3f')](_0x56a76f,_0xd741('0x2d'));}catch(_0x48c7a8){logger[_0xd741('0x17')](_0x48c7a8);}return _0x56a76f[_0xd741('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x31a1d8,_0x7421a2,_0x12263e,_0x920ddb,_0x4dc70d,_0x5d95d4){return aws[_0xd741('0x7e')](_0x31a1d8,_0x7421a2,_0x12263e,_0x920ddb,_0x4dc70d,_0x5d95d4)[_0xd741('0x2c')](function(_0x46a147){logger[_0xd741('0x1c')](JSON[_0xd741('0x46')](_0x46a147));return _0x46a147;});};exports[_0xd741('0x7f')]=function(_0x3e8ead,_0x17f762,_0x2fde2b,_0x3a4bc7){var _0x384012=util[_0xd741('0x80')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3e8ead,encodeURIComponent(_0x17f762),_0x2fde2b,_0x3a4bc7);var _0x5e1d28=path['resolve'](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+'.mp3');var _0x332a4d;return downloadFile(_0x384012,_0x5e1d28)[_0xd741('0x2c')](function(){_0x332a4d=path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs[_0xd741('0x3a')](0x4)+'.wav');return convertFile(_0x5e1d28,_0x332a4d);})['then'](function(){try{fs[_0xd741('0x1e')](_0x5e1d28);fs[_0xd741('0x3f')](_0x332a4d,_0xd741('0x2d'));}catch(_0x42c597){logger['error'](_0x42c597);}return _0x332a4d[_0xd741('0x2e')]('.')[0x0];});};exports[_0xd741('0x81')]=function(_0x1c34e4,_0x51f77b,_0x57e628,_0x222722){var _0x38b139=util[_0xd741('0x80')](_0xd741('0x82'),ISPEECH_API,_0x51f77b,_0x57e628,base64Encode(_0x1c34e4),_0x222722?util[_0xd741('0x80')](_0xd741('0x83'),encodeURIComponent(_0x222722)):_0xd741('0x84'));return uploadFile(_0x38b139)[_0xd741('0x2c')](function(_0x1c0c6b){return querystring['parse'](_0x1c0c6b);});};exports[_0xd741('0x85')]=function(_0x2c86f1,_0x2a2c92){return sestek['nda'](_0x2c86f1,_0x2a2c92)[_0xd741('0x2c')](function(_0x4ca7b4){logger[_0xd741('0x1c')](JSON['stringify'](_0x4ca7b4));var _0x59a8f4={'speech':_0x4ca7b4[_0xd741('0x86')],'action':_0x4ca7b4[_0xd741('0x87')]?_0x4ca7b4[_0xd741('0x87')][_0xd741('0x88')]:undefined,'actiondata':_0x4ca7b4[_0xd741('0x87')]?_0x4ca7b4['channelData'][_0xd741('0x89')]:undefined};if(_0x4ca7b4[_0xd741('0x87')]&&_0x4ca7b4['channelData'][_0xd741('0x8a')]){return base64Decode(_0x4ca7b4[_0xd741('0x87')]['AudioFromTts'][_0xd741('0x8b')],path[_0xd741('0x27')](__dirname,_0xd741('0x28'),rs['generate'](0x4)+_0xd741('0x29')))[_0xd741('0x2c')](function(_0x39920a){_0x59a8f4[_0xd741('0x8c')]=_0x39920a;return _0x59a8f4;});}return _0x59a8f4;});};exports[_0xd741('0x8d')]=function(){return __dirname;}; \ No newline at end of file +var _0xd1c2=['message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','googleDialogflowV2','SessionsClient','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','chmodSync','format','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','http','https','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','../../../config/logger','https:','host','path','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','close','unlink','download\x20error','pipe','end','protocol','data','wav','error\x20convert','start','resolve','tmp','generate','.wav','base64','then','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','.mp3','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','info','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch'];(function(_0x3def1b,_0x56f748){var _0x57340e=function(_0x1e1949){while(--_0x1e1949){_0x3def1b['push'](_0x3def1b['shift']());}};_0x57340e(++_0x56f748);}(_0xd1c2,0x1b0));var _0x2d1c=function(_0x307c70,_0x4289b7){_0x307c70=_0x307c70-0x0;var _0x5f453c=_0xd1c2[_0x307c70];return _0x5f453c;};'use strict';var apiai=require(_0x2d1c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x2d1c('0x1'));var fs=require('fs');var http=require(_0x2d1c('0x2'));var https=require(_0x2d1c('0x3'));var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require(_0x2d1c('0x4'));var rs=require('randomstring');var sox=require(_0x2d1c('0x5'));var tts=require(_0x2d1c('0x6'));var urlParse=require(_0x2d1c('0x7'))['parse'];var util=require(_0x2d1c('0x8'));var aws=require(_0x2d1c('0x9'));var google=require(_0x2d1c('0xa'));var sestek=require(_0x2d1c('0xb'));var tilde=require('./tilde');var logger=require(_0x2d1c('0xc'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x58c1df,_0x5a1580){return new BPromise(function(_0x2eb276,_0xcc772f){var _0x470868=urlParse(_0x58c1df);var _0xf2e46b=_0x470868['protocol']===_0x2d1c('0xd')?https:http;var _0x633537={'host':_0x470868[_0x2d1c('0xe')],'path':_0x470868[_0x2d1c('0xf')],'headers':{'user-agent':_0x2d1c('0x10')}};_0xf2e46b['get'](_0x633537,function(_0x2e98c9){if(_0x2e98c9[_0x2d1c('0x11')]!==0xc8){logger[_0x2d1c('0x12')]('request\x20to\x20'+_0x58c1df+_0x2d1c('0x13')+_0x2e98c9[_0x2d1c('0x11')]+'\x20('+_0x2e98c9[_0x2d1c('0x14')]+')');_0xcc772f(new Error('request\x20to\x20'+_0x58c1df+_0x2d1c('0x13')+_0x2e98c9[_0x2d1c('0x11')]+'\x20('+_0x2e98c9[_0x2d1c('0x14')]+')'));return;}var _0x232c58=fs[_0x2d1c('0x15')](_0x5a1580);_0x232c58['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x232c58[_0x2d1c('0x16')](_0x2eb276);});_0x232c58['on']('error',function(_0x649739){fs[_0x2d1c('0x17')](_0x5a1580);logger[_0x2d1c('0x12')](_0x2d1c('0x18'),_0x649739);_0xcc772f(_0x649739);});_0x2e98c9[_0x2d1c('0x19')](_0x232c58);})['on'](_0x2d1c('0x12'),function(_0x568396){logger[_0x2d1c('0x12')](_0x568396);_0xcc772f(_0x568396);})[_0x2d1c('0x1a')]();});}function uploadFile(_0x550459){return new BPromise(function(_0x13d9e4,_0xf38b12){var _0x9ca392=urlParse(_0x550459);var _0x29cd9f=_0x9ca392[_0x2d1c('0x1b')]===_0x2d1c('0xd')?https:http;var _0x5040b5={'host':_0x9ca392[_0x2d1c('0xe')],'path':_0x9ca392[_0x2d1c('0xf')],'headers':{'user-agent':_0x2d1c('0x10')}};_0x29cd9f['get'](_0x5040b5,function(_0xc35d20){if(_0xc35d20[_0x2d1c('0x11')]!==0xc8){_0xf38b12(new Error('request\x20to\x20'+_0x550459+'\x20failed,\x20status\x20code\x20=\x20'+_0xc35d20['statusCode']+'\x20('+_0xc35d20[_0x2d1c('0x14')]+')'));return;}var _0x3638d7='';_0xc35d20['on'](_0x2d1c('0x1c'),function(_0x1b3aa8){_0x3638d7+=_0x1b3aa8;});_0xc35d20['on'](_0x2d1c('0x1a'),function(){_0x13d9e4(_0x3638d7);});})['on'](_0x2d1c('0x12'),function(_0x20802d){_0xf38b12(_0x20802d);})[_0x2d1c('0x1a')]();});}function convertFile(_0x4274a6,_0x367d6d){return new BPromise(function(_0x25e7ae,_0x145343){var _0x3fcfd0=sox['transcode'](_0x4274a6,_0x367d6d,{'sampleRate':0x1f40,'format':_0x2d1c('0x1d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3fcfd0['on'](_0x2d1c('0x12'),function(_0x511940){logger[_0x2d1c('0x12')](_0x2d1c('0x1e'),_0x511940);_0x145343(_0x511940);});_0x3fcfd0['on'](_0x2d1c('0x1a'),function(){logger['info']('finish\x20to\x20convert');_0x25e7ae();});_0x3fcfd0[_0x2d1c('0x1f')]();});}function base64Decode(_0x3e158b,_0x42a56b){var _0x23636c=path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x23'));fs['writeFileSync'](_0x23636c,_0x3e158b,_0x2d1c('0x24'));return convertFile(_0x23636c,_0x42a56b)[_0x2d1c('0x25')](function(){try{fs[_0x2d1c('0x17')](_0x23636c);fs['chmodSync'](_0x42a56b,_0x2d1c('0x26'));}catch(_0x1a40dd){logger[_0x2d1c('0x12')](_0x1a40dd);}return _0x42a56b[_0x2d1c('0x27')]('.')[0x0];});}function base64Encode(_0x3054b6){var _0x1343f7=fs[_0x2d1c('0x28')](_0x3054b6);return new Buffer(_0x1343f7)[_0x2d1c('0x29')](_0x2d1c('0x24'));}exports[_0x2d1c('0x2a')]=function(_0xce5817,_0xd141bc,_0x186d40,_0x202fda,_0x5f5ab5,_0x41e1e8){var _0x87db9d,_0x54a494;var _0x379784='https://texttospeech.googleapis.com/v1/';var _0xc8caa1=_0x2d1c('0x2b')+_0xce5817;var _0x26421a={};if(_0xd141bc===_0x2d1c('0x2c')){_0x26421a[_0x2d1c('0x2d')]={'ssml':_0x186d40};}else{_0x26421a['input']={'text':_0x186d40};};_0x26421a['voice']={'languageCode':_0x202fda,'ssmlGender':_0x5f5ab5};_0x26421a[_0x2d1c('0x2e')]={'audioEncoding':_0x2d1c('0x2f'),'sampleRateHertz':0x1f40};var _0x383bcf={'url':_0x379784+_0x2d1c('0x30')+_0xc8caa1,'method':'POST','json':!![],'body':_0x26421a};return rp(_0x383bcf)['then'](function(_0x598fd4){return new BPromise(function(_0x2fa5be,_0x1410fe){_0x87db9d=path['resolve'](__dirname,'tmp',rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x31'));var _0x1e79cd=Buffer['from'](_0x598fd4[_0x2d1c('0x32')],_0x2d1c('0x24'));return fs[_0x2d1c('0x33')](_0x87db9d,_0x1e79cd,function(_0x5cafd0){_0x1410fe(_0x5cafd0);},function(_0x55d5ed){fs['chmodSync'](_0x87db9d,'777');_0x2fa5be(_0x55d5ed);});});})[_0x2d1c('0x25')](function(_0x432c80){_0x54a494=path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x23'));return convertFile(_0x87db9d,_0x54a494);})[_0x2d1c('0x25')](function(){try{fs[_0x2d1c('0x17')](_0x87db9d);fs['chmodSync'](_0x54a494,_0x2d1c('0x26'));}catch(_0x26c8de){logger['error'](_0x26c8de);}logger['info'](_0x2d1c('0x34'),_0x54a494['split']('.')[0x0]);return _0x54a494[_0x2d1c('0x27')]('.')[0x0];});};exports['googleTTS']=function(_0x2edb75,_0x1bd7c5){var _0x4453d6=_0x2d1c('0x35');var _0x66cf84,_0x59a3ca;var _0x21123d;var _0x283ae8={'encoding':_0x2d1c('0x36'),'method':_0x2d1c('0x37'),'timeout':0x2710,'url':_0x4453d6,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x2d1c('0x38')+encodeURIComponent(JSON[_0x2d1c('0x39')]([[[_0x2d1c('0x3a'),JSON['stringify']([_0x2edb75,_0x1bd7c5||'en',![],_0x2d1c('0x3b')]),null,'generic']]]))};return rp(_0x283ae8)[_0x2d1c('0x25')](function(_0x3b359a){try{_0x21123d=eval(_0x3b359a['slice'](0x5))[0x0][0x2];}catch(_0x1b0f7c){throw new Error(_0x2d1c('0x3c')+_0x3b359a['data']);}if(!_0x21123d){if(_0x2edb75[_0x2d1c('0x3d')]>0xc8){throw new Error(_0x2d1c('0x3e'));}else{throw new Error(_0x2d1c('0x3f')+_0x1bd7c5+_0x2d1c('0x40'));}}try{_0x21123d=eval(_0x21123d)[0x0];}catch(_0x44a750){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2d1c('0x1c')]);}const _0x1998b1=_0x21123d;_0x66cf84=path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs['generate'](0x4)+'.mp3');fs[_0x2d1c('0x41')](_0x66cf84,_0x21123d,{'encoding':'base64'});_0x59a3ca=path['resolve'](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+'.wav');return convertFile(_0x66cf84,_0x59a3ca);})[_0x2d1c('0x25')](function(){try{fs['unlink'](_0x66cf84);fs['chmodSync'](_0x59a3ca,_0x2d1c('0x26'));}catch(_0x174b36){logger['error'](_0x174b36);}logger[_0x2d1c('0x42')](_0x2d1c('0x43'),_0x59a3ca[_0x2d1c('0x27')]('.')[0x0]);return _0x59a3ca[_0x2d1c('0x27')]('.')[0x0];});};exports[_0x2d1c('0x44')]=function(_0xe7269a,_0x5d2d10,_0x1ddf1c){return google[_0x2d1c('0x45')](_0xe7269a,_0x5d2d10,_0x1ddf1c)[_0x2d1c('0x25')](function(_0x33eb7d){logger[_0x2d1c('0x42')](_0x33eb7d[_0x2d1c('0x46')]);return rp(_0x33eb7d);})[_0x2d1c('0x25')](function(_0x3f78f8){var _0x3ab56b='';var _0x2cbfb3=0x0;try{fs[_0x2d1c('0x17')](_0xe7269a);}catch(_0x2e6ddb){logger['error'](_0x2e6ddb);}if(_0x3f78f8&&_0x3f78f8[_0x2d1c('0x47')]){_0x3ab56b=_0x3f78f8[_0x2d1c('0x47')][_0x2d1c('0x48')](function(_0x508bc8){return _0x508bc8&&_0x508bc8[_0x2d1c('0x49')][0x0]&&_0x508bc8[_0x2d1c('0x49')][0x0][_0x2d1c('0x4a')]?_0x508bc8[_0x2d1c('0x49')][0x0]['transcript']:'';})[_0x2d1c('0x4b')]('\x0a');_0x2cbfb3=_0x3f78f8[_0x2d1c('0x47')][_0x2d1c('0x48')](function(_0x30e9d7){return _0x30e9d7&&_0x30e9d7[_0x2d1c('0x49')][0x0]&&_0x30e9d7['alternatives'][0x0][_0x2d1c('0x4c')]?_0x30e9d7[_0x2d1c('0x49')][0x0]['confidence']:0x0;})[_0x2d1c('0x4b')]('\x0a');}logger['info'](_0x2d1c('0x4d'),_0x3ab56b);logger[_0x2d1c('0x42')](_0x2d1c('0x4e'),_0x2cbfb3);return{'transcript':_0x3ab56b,'confidence':_0x2cbfb3};})[_0x2d1c('0x4f')](function(_0xc54f9b){logger[_0x2d1c('0x12')]('[%s]\x20%s:%s',_0xc54f9b[_0x2d1c('0x11')],_0xc54f9b['name'],_0xc54f9b[_0x2d1c('0x50')]);});};exports[_0x2d1c('0x51')]=function(_0x3635f7,_0x4494ec,_0x403daf,_0x3d4888){var _0x557b6d=apiai(_0x4494ec,{'language':_0x3d4888||'en'});return _0x557b6d[_0x2d1c('0x52')](_0x403daf,{'sessionId':md5(_0x3635f7)})[_0x2d1c('0x25')](function(_0x55038f){logger['info'](JSON['stringify'](_0x55038f));return{'source':_0x55038f[_0x2d1c('0x53')]['source'],'resolvedQuery':_0x55038f[_0x2d1c('0x53')][_0x2d1c('0x54')],'action':_0x55038f[_0x2d1c('0x53')][_0x2d1c('0x55')],'actionIncomplete':_0x55038f[_0x2d1c('0x53')][_0x2d1c('0x56')],'speech':_0x55038f['result'][_0x2d1c('0x57')]['speech'],'score':_0x55038f[_0x2d1c('0x53')][_0x2d1c('0x58')],'statusCode':_0x55038f[_0x2d1c('0x59')][_0x2d1c('0x5a')],'endConversation':_0x55038f[_0x2d1c('0x53')][_0x2d1c('0x5b')][_0x2d1c('0x5c')]||![],'isFallbackIntent':_0x55038f['result'][_0x2d1c('0x5b')]['isFallbackIntent']};});};exports[_0x2d1c('0x5d')]=function(_0x12df6c,_0x14fdbf,_0x4469b7,_0x27127f,_0x13f7b4,_0x250cec){var _0x38edfb=_0x27127f['replace'](/\\n/g,'\x0a');var _0x51c13e={'credentials':{'private_key':_0x38edfb,'client_email':_0x4469b7}};var _0x4b7e47=new dialogflow[(_0x2d1c('0x5e'))](_0x51c13e);var _0x1642ea=_0x4b7e47['sessionPath'](_0x14fdbf,md5(_0x12df6c));var _0x1d55e2={'session':_0x1642ea,'queryInput':{'text':{'text':_0x13f7b4,'languageCode':_0x250cec}}};return _0x4b7e47[_0x2d1c('0x5f')](_0x1d55e2)[_0x2d1c('0x25')](function(_0x1a7b9c){if(_0x1a7b9c&&_0x1a7b9c[_0x2d1c('0x3d')]){logger[_0x2d1c('0x42')]('Dialogflow\x20V2\x20response:',JSON[_0x2d1c('0x39')](_0x1a7b9c));var _0x4339c5=_0x1a7b9c[0x0];if(_0x4339c5){var _0x570dc6={'action':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x55')],'allRequiredParamsPresent':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x61')],'endConversation':_0x4339c5[_0x2d1c('0x60')]['diagnosticInfo']&&_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x62')][_0x2d1c('0x63')]?_0x4339c5[_0x2d1c('0x60')]['diagnosticInfo']['fields']['end_conversation'][_0x2d1c('0x64')]:![],'fulfillmentText':_0x4339c5['queryResult'][_0x2d1c('0x65')],'intentName':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x66')][_0x2d1c('0x67')],'intentDisplayName':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x66')]['displayName'],'isFallbackIntent':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x66')][_0x2d1c('0x68')],'languageCode':_0x4339c5[_0x2d1c('0x60')]['languageCode'],'queryText':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x69')],'responseId':_0x4339c5[_0x2d1c('0x6a')],'score':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x6b')],'speech':_0x4339c5[_0x2d1c('0x60')][_0x2d1c('0x65')],'providerResponse':JSON[_0x2d1c('0x39')](_0x1a7b9c)};return _0x570dc6;}}});};exports[_0x2d1c('0x6c')]=function(_0xf81b67,_0x3098b7,_0x4e41a6,_0x90f86f){return tilde['asr'](_0xf81b67,_0x3098b7,_0x4e41a6,_0x90f86f)['then'](function(_0x74e53e){try{fs[_0x2d1c('0x17')](_0xf81b67);}catch(_0x9502a5){logger[_0x2d1c('0x12')](_0x9502a5);}logger[_0x2d1c('0x42')]('Tilde\x20ASR\x20transcription',_0x74e53e[_0x2d1c('0x4a')]);logger[_0x2d1c('0x42')](_0x2d1c('0x6d'),_0x74e53e[_0x2d1c('0x4c')]);return _0x74e53e;});};exports[_0x2d1c('0x6e')]=function(_0xedef9d,_0x2b857b,_0x4ebb90,_0x1598b6,_0x1673ce,_0x4f3a5d){var _0x118d72=path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs['generate'](0x4)+_0x2d1c('0x31'));var _0x298f7e;return aws['polly'](_0xedef9d,_0x2b857b,_0x4ebb90,_0x1598b6,_0x1673ce,_0x4f3a5d,_0x118d72)['then'](function(){_0x298f7e=path['resolve'](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x23'));return convertFile(_0x118d72,_0x298f7e);})[_0x2d1c('0x25')](function(){try{fs[_0x2d1c('0x17')](_0x118d72);fs['chmodSync'](_0x298f7e,_0x2d1c('0x26'));}catch(_0x1160b1){logger['error'](_0x1160b1);}return _0x298f7e['split']('.')[0x0];});};exports[_0x2d1c('0x6f')]=function(_0x58ccf3,_0x1c8a9e,_0x5b8244,_0x3392c3,_0xb6a6a2,_0x4fc17b){return aws[_0x2d1c('0x70')](_0x58ccf3,_0x1c8a9e,_0x5b8244,_0x3392c3,_0xb6a6a2,_0x4fc17b)[_0x2d1c('0x25')](function(_0x5007a0){logger[_0x2d1c('0x42')](JSON[_0x2d1c('0x39')](_0x5007a0));return _0x5007a0;});};exports[_0x2d1c('0x71')]=function(_0x450e31,_0x95ace6,_0x551d4c,_0x5e0e35){var _0x99c7ec=util['format'](_0x2d1c('0x72'),ISPEECH_API,_0x450e31,encodeURIComponent(_0x95ace6),_0x551d4c,_0x5e0e35);var _0x3fc292=path['resolve'](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x31'));var _0x4b39b3;return downloadFile(_0x99c7ec,_0x3fc292)['then'](function(){_0x4b39b3=path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs[_0x2d1c('0x22')](0x4)+_0x2d1c('0x23'));return convertFile(_0x3fc292,_0x4b39b3);})['then'](function(){try{fs['unlink'](_0x3fc292);fs[_0x2d1c('0x73')](_0x4b39b3,_0x2d1c('0x26'));}catch(_0x3ff64c){logger[_0x2d1c('0x12')](_0x3ff64c);}return _0x4b39b3[_0x2d1c('0x27')]('.')[0x0];});};exports['ispeechASR']=function(_0x5462c0,_0x55aa6a,_0x570b90,_0x22115d){var _0xfcaef6=util[_0x2d1c('0x74')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x55aa6a,_0x570b90,base64Encode(_0x5462c0),_0x22115d?util[_0x2d1c('0x74')]('model=%s',encodeURIComponent(_0x22115d)):_0x2d1c('0x75'));return uploadFile(_0xfcaef6)[_0x2d1c('0x25')](function(_0x954bc1){return querystring[_0x2d1c('0x76')](_0x954bc1);});};exports[_0x2d1c('0x77')]=function(_0x2a39b5,_0x53d8f2){return sestek[_0x2d1c('0x78')](_0x2a39b5,_0x53d8f2)['then'](function(_0x31fc71){logger[_0x2d1c('0x42')](JSON['stringify'](_0x31fc71));var _0x52f26b={'speech':_0x31fc71[_0x2d1c('0x79')],'action':_0x31fc71['channelData']?_0x31fc71[_0x2d1c('0x7a')][_0x2d1c('0x7b')]:undefined,'actiondata':_0x31fc71[_0x2d1c('0x7a')]?_0x31fc71[_0x2d1c('0x7a')][_0x2d1c('0x7c')]:undefined};if(_0x31fc71[_0x2d1c('0x7a')]&&_0x31fc71[_0x2d1c('0x7a')][_0x2d1c('0x7d')]){return base64Decode(_0x31fc71['channelData'][_0x2d1c('0x7d')][_0x2d1c('0x7e')],path[_0x2d1c('0x20')](__dirname,_0x2d1c('0x21'),rs['generate'](0x4)+_0x2d1c('0x23')))['then'](function(_0x532c34){_0x52f26b[_0x2d1c('0x7f')]=_0x532c34;return _0x52f26b;});}return _0x52f26b;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 82693e0..2c06c2b 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 _0xc5fd=['./nda','exports'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xc5fd,0x15e));var _0xdc5f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xc5fd[_0x45783c];return _0x1161da;};var nda=require(_0xdc5f('0x0'));module[_0xdc5f('0x1')]={'nda':nda}; \ No newline at end of file +var _0x350d=['exports','./nda'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x350d,0x7d));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};var nda=require(_0xd350('0x0'));module[_0xd350('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 7bb9fb1..b5ad52b 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 _0x3670=['Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid','extension','text'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3670,0x16c));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var rp=require('request-promise');var url=require(_0x0367('0x0'));var logger=require(_0x0367('0x1'))(_0x0367('0x2'));module[_0x0367('0x3')]=function(_0x3ea441,_0xfefd2b){var _0x183c1e={'method':'POST','uri':url[_0x0367('0x4')](_0xfefd2b[_0x0367('0x5')],_0x0367('0x6')),'form':{'grant_type':_0x0367('0x7'),'username':_0xfefd2b[_0x0367('0x8')],'password':_0xfefd2b[_0x0367('0x7')]},'json':!![]};return rp(_0x183c1e)[_0x0367('0x9')](function(_0x55f08e){var _0x298a55={'method':_0x0367('0xa'),'uri':url[_0x0367('0x4')](_0xfefd2b[_0x0367('0xb')],_0x0367('0xc')),'body':{'type':_0xfefd2b[_0x0367('0xd')]||_0x0367('0xe'),'channelId':_0x0367('0xf'),'conversation':{'id':_0x3ea441['uniqueid']},'from':{'id':_0x3ea441[_0x0367('0x10')],'name':_0x3ea441['calleridname']},'recipient':{'id':_0x3ea441[_0x0367('0x11')],'name':_0x3ea441[_0x0367('0x12')]},'text':_0xfefd2b[_0x0367('0x13')],'channelData':{}},'headers':{'Authorization':_0x0367('0x14')+_0x55f08e[_0x0367('0x15')]},'json':!![]};if(_0xfefd2b[_0x0367('0x16')]){_0x298a55[_0x0367('0x17')][_0x0367('0x18')]['ProjectName']=_0xfefd2b[_0x0367('0x16')];}if(_0xfefd2b[_0x0367('0x19')]=='1'){_0x298a55['body'][_0x0367('0x18')][_0x0367('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0367('0x1b')};}if(_0xfefd2b['custom_action']){_0x298a55[_0x0367('0x17')][_0x0367('0x18')][_0x0367('0x1c')]=_0xfefd2b[_0x0367('0x1d')];if(_0xfefd2b['custom_action_data']){_0x298a55['body'][_0x0367('0x18')][_0x0367('0x1e')]=_0xfefd2b[_0x0367('0x1f')];}}logger['info'](JSON['stringify'](_0x298a55));return rp(_0x298a55);});}; \ No newline at end of file +var _0x7382=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','url','exports','POST','resolve','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','text','Bearer\x20'];(function(_0x245801,_0x3d8556){var _0xbbe558=function(_0x112791){while(--_0x112791){_0x245801['push'](_0x245801['shift']());}};_0xbbe558(++_0x3d8556);}(_0x7382,0x1f2));var _0x2738=function(_0x4558bd,_0x24f458){_0x4558bd=_0x4558bd-0x0;var _0x56c1a7=_0x7382[_0x4558bd];return _0x56c1a7;};'use strict';var rp=require('request-promise');var url=require(_0x2738('0x0'));var logger=require('../../../../../config/logger')('agi');module[_0x2738('0x1')]=function(_0x480143,_0x250b3c){var _0x4d5eb0={'method':_0x2738('0x2'),'uri':url[_0x2738('0x3')](_0x250b3c['ndauth_url'],_0x2738('0x4')),'form':{'grant_type':_0x2738('0x5'),'username':_0x250b3c[_0x2738('0x6')],'password':_0x250b3c[_0x2738('0x5')]},'json':!![]};return rp(_0x4d5eb0)['then'](function(_0x99e22e){var _0x20a64f={'method':_0x2738('0x2'),'uri':url[_0x2738('0x3')](_0x250b3c[_0x2738('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x250b3c[_0x2738('0x8')]||_0x2738('0x9'),'channelId':_0x2738('0xa'),'conversation':{'id':_0x480143[_0x2738('0xb')]},'from':{'id':_0x480143[_0x2738('0xc')],'name':_0x480143['calleridname']},'recipient':{'id':_0x480143['dnid'],'name':_0x480143['extension']},'text':_0x250b3c[_0x2738('0xd')],'channelData':{}},'headers':{'Authorization':_0x2738('0xe')+_0x99e22e[_0x2738('0xf')]},'json':!![]};if(_0x250b3c[_0x2738('0x10')]){_0x20a64f[_0x2738('0x11')][_0x2738('0x12')][_0x2738('0x13')]=_0x250b3c[_0x2738('0x10')];}if(_0x250b3c[_0x2738('0x14')]=='1'){_0x20a64f[_0x2738('0x11')][_0x2738('0x12')][_0x2738('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x250b3c[_0x2738('0x16')]){_0x20a64f[_0x2738('0x11')]['channelData']['CustomAction']=_0x250b3c[_0x2738('0x16')];if(_0x250b3c[_0x2738('0x17')]){_0x20a64f[_0x2738('0x11')]['channelData'][_0x2738('0x18')]=_0x250b3c[_0x2738('0x17')];}}logger[_0x2738('0x19')](JSON[_0x2738('0x1a')](_0x20a64f));return rp(_0x20a64f);});}; \ 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 150962d..4a1eb0d 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 _0x7c66=['exports','./lib/api'];(function(_0x4bc269,_0x560634){var _0x47f4dc=function(_0x5e8cbc){while(--_0x5e8cbc){_0x4bc269['push'](_0x4bc269['shift']());}};_0x47f4dc(++_0x560634);}(_0x7c66,0x195));var _0x67c6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7c66[_0x2f5ac5];return _0x37c9a8;};'use strict';var asr=require(_0x67c6('0x0'));module[_0x67c6('0x1')]=function(_0x1dc004,_0x3f815c,_0x37dbd4,_0x2f7df4){return asr(_0x1dc004,_0x3f815c,_0x37dbd4,_0x2f7df4);}; \ No newline at end of file +var _0xb39c=['./lib/api','exports'];(function(_0x551b0a,_0x41348c){var _0x5dacb8=function(_0x1123cf){while(--_0x1123cf){_0x551b0a['push'](_0x551b0a['shift']());}};_0x5dacb8(++_0x41348c);}(_0xb39c,0x136));var _0xcb39=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb39c[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0xcb39('0x0'));module[_0xcb39('0x1')]=function(_0x5e634a,_0x907913,_0x2c624c,_0x114361){return asr(_0x5e634a,_0x907913,_0x2c624c,_0x114361);}; \ 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 da12f95..da3f91e 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 _0x1015=['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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x37d426,_0x84388){var _0x1c7067=function(_0x3966f9){while(--_0x3966f9){_0x37d426['push'](_0x37d426['shift']());}};_0x1c7067(++_0x84388);}(_0x1015,0x100));var _0x5101=function(_0x2735d2,_0x3be08a){_0x2735d2=_0x2735d2-0x0;var _0x2a8248=_0x1015[_0x2735d2];return _0x2a8248;};'use strict';var BPromise=require(_0x5101('0x0'));var _=require(_0x5101('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5101('0x2'));var logger=require(_0x5101('0x3'))('agi');module[_0x5101('0x4')]=function(_0x1def5f,_0x10b427,_0x30445b,_0x144a48){return new BPromise(function(_0x10ac6f,_0x324161){logger[_0x5101('0x5')](_0x5101('0x6'),_0x144a48||_0x5101('0x7'));var _0x2456ba=new WebSocket(_0x144a48||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x507b48='';var _0x9e5ea3='0';var _0x46653f='1';var _0x4ce471=_0x5101('0x8');function _0x290447(_0x5c0a75){var _0x5bc9a8=crypto['createHash'](_0x5101('0x9'));_0x5bc9a8[_0x5101('0xa')](_0x5c0a75);return _0x5bc9a8['digest'](_0x5101('0xb'));}function _0x527853(){try{logger[_0x5101('0x5')](_0x5101('0xc'));var _0xd7545a=moment()[_0x5101('0xd')]();var _0x747d8d=_0x290447(_0xd7545a+_0x10b427+_0x30445b);_0x2456ba[_0x5101('0xe')](JSON[_0x5101('0xf')]({'appID':_0x10b427,'timestamp':_0xd7545a,'appKey':_0x747d8d}));var _0x5143ab=fs[_0x5101('0x10')](_0x1def5f);_0x5143ab['on'](_0x5101('0x11'),function(_0x41a7df){_0x2456ba[_0x5101('0xe')](_0x41a7df);});_0x5143ab['on'](_0x5101('0x12'),function(){_0x2456ba['send'](_0x5101('0x13'));});}catch(_0x32d16f){logger['error'](_0x5101('0x14'),JSON[_0x5101('0xf')](_0x32d16f));_0x2456ba[_0x5101('0x15')]();}}function _0x22c0f5(_0xcdd495){try{if(_0xcdd495){var _0x1c479f=JSON[_0x5101('0x16')](_0xcdd495);switch(_0x1c479f[_0x5101('0x17')]){case 0x0:if(_0x1c479f[_0x5101('0x18')]){if(_0x1c479f['result'][_0x5101('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x1c479f[_0x5101('0x18')][_0x5101('0x1a')]));_0x507b48=_0x1c479f['result'][_0x5101('0x1a')][0x0][_0x5101('0x1b')];_0x9e5ea3=_0x1c479f[_0x5101('0x18')][_0x5101('0x1a')][0x0][_0x5101('0x1c')];_0x46653f='0';_0x4ce471=_0x5101('0x1d');_0x2456ba[_0x5101('0x15')]();}}break;case 0x1:logger[_0x5101('0x5')](_0x5101('0x8'));_0x46653f='1';_0x4ce471='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x5101('0x1e'));_0x46653f='2';_0x4ce471=_0x5101('0x1e');break;case 0x9:logger[_0x5101('0x5')](_0x5101('0x1f'));_0x46653f='9';_0x4ce471=_0x5101('0x1f');break;case 0xa:logger['info'](_0x5101('0x20'));_0x46653f='10';_0x4ce471=_0x5101('0x20');break;case 0xb:logger[_0x5101('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x46653f='11';_0x4ce471=_0x5101('0x21');}}}catch(_0x38f5ea){logger[_0x5101('0x22')](_0x5101('0x23'),JSON[_0x5101('0xf')](_0x38f5ea));_0x2456ba[_0x5101('0x15')]();}}function _0x32b379(){logger[_0x5101('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x10ac6f({'transcript':_0x507b48,'confidence':_0x9e5ea3,'status':_0x46653f,'status_message':_0x4ce471});}function _0x57ac91(_0x31482c){logger['error'](_0x5101('0x24'));if(!_[_0x5101('0x25')](_0x31482c)){logger['error'](_[_0x5101('0x26')](_0x31482c)?JSON[_0x5101('0xf')](_0x31482c):_0x31482c);}}_0x2456ba['on'](_0x5101('0x27'),_0x527853);_0x2456ba['on'](_0x5101('0x28'),_0x22c0f5);_0x2456ba['on'](_0x5101('0x12'),_0x32b379);_0x2456ba['on']('error',_0x57ac91);});}; \ No newline at end of file +var _0xec0a=['isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x2df51c,_0xe14b06){var _0x1324d0=function(_0x1d3974){while(--_0x1d3974){_0x2df51c['push'](_0x2df51c['shift']());}};_0x1324d0(++_0xe14b06);}(_0xec0a,0x10d));var _0xaec0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xec0a[_0x432682];return _0x463d05;};'use strict';var BPromise=require(_0xaec0('0x0'));var _=require(_0xaec0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xaec0('0x2'));var crypto=require(_0xaec0('0x3'));var logger=require(_0xaec0('0x4'))(_0xaec0('0x5'));module[_0xaec0('0x6')]=function(_0x2c2688,_0x535ff6,_0x19241b,_0x8eb2ed){return new BPromise(function(_0x3df31f,_0x23d685){logger['info'](_0xaec0('0x7'),_0x8eb2ed||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xee477d=new WebSocket(_0x8eb2ed||_0xaec0('0x8'),{'perMessageDeflate':![]});var _0x214699='';var _0x2f7eb2='0';var _0x376416='1';var _0x112214=_0xaec0('0x9');function _0x461495(_0xe5e8de){var _0xa0cdfc=crypto[_0xaec0('0xa')](_0xaec0('0xb'));_0xa0cdfc['update'](_0xe5e8de);return _0xa0cdfc['digest'](_0xaec0('0xc'));}function _0x519e48(){try{logger[_0xaec0('0xd')](_0xaec0('0xe'));var _0x5e4ea5=moment()['unix']();var _0x58ae83=_0x461495(_0x5e4ea5+_0x535ff6+_0x19241b);_0xee477d[_0xaec0('0xf')](JSON[_0xaec0('0x10')]({'appID':_0x535ff6,'timestamp':_0x5e4ea5,'appKey':_0x58ae83}));var _0x4006d5=fs['createReadStream'](_0x2c2688);_0x4006d5['on']('data',function(_0x5005f9){_0xee477d[_0xaec0('0xf')](_0x5005f9);});_0x4006d5['on'](_0xaec0('0x11'),function(){_0xee477d[_0xaec0('0xf')](_0xaec0('0x12'));});}catch(_0x3b0851){logger[_0xaec0('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x3b0851));_0xee477d[_0xaec0('0x14')]();}}function _0x49019c(_0x54df6b){try{if(_0x54df6b){var _0x3f22b9=JSON[_0xaec0('0x15')](_0x54df6b);switch(_0x3f22b9[_0xaec0('0x16')]){case 0x0:if(_0x3f22b9[_0xaec0('0x17')]){if(_0x3f22b9[_0xaec0('0x17')][_0xaec0('0x18')]){logger[_0xaec0('0xd')](_0xaec0('0x19'),JSON[_0xaec0('0x10')](_0x3f22b9[_0xaec0('0x17')][_0xaec0('0x1a')]));_0x214699=_0x3f22b9['result'][_0xaec0('0x1a')][0x0]['transcript'];_0x2f7eb2=_0x3f22b9[_0xaec0('0x17')][_0xaec0('0x1a')][0x0][_0xaec0('0x1b')];_0x376416='0';_0x112214='Success.';_0xee477d[_0xaec0('0x14')]();}}break;case 0x1:logger[_0xaec0('0xd')](_0xaec0('0x9'));_0x376416='1';_0x112214=_0xaec0('0x9');break;case 0x2:logger[_0xaec0('0xd')](_0xaec0('0x1c'));_0x376416='2';_0x112214=_0xaec0('0x1c');break;case 0x9:logger['info'](_0xaec0('0x1d'));_0x376416='9';_0x112214=_0xaec0('0x1d');break;case 0xa:logger['info'](_0xaec0('0x1e'));_0x376416='10';_0x112214=_0xaec0('0x1e');break;case 0xb:logger[_0xaec0('0xd')](_0xaec0('0x1f'));_0x376416='11';_0x112214=_0xaec0('0x1f');}}}catch(_0xfa70c1){logger[_0xaec0('0x13')](_0xaec0('0x20'),JSON['stringify'](_0xfa70c1));_0xee477d[_0xaec0('0x14')]();}}function _0x1fbd18(){logger[_0xaec0('0xd')](_0xaec0('0x21'));_0x3df31f({'transcript':_0x214699,'confidence':_0x2f7eb2,'status':_0x376416,'status_message':_0x112214});}function _0x1f3ad8(_0x54c1b0){logger[_0xaec0('0x13')](_0xaec0('0x22'));if(!_[_0xaec0('0x23')](_0x54c1b0)){logger[_0xaec0('0x13')](_['isObject'](_0x54c1b0)?JSON['stringify'](_0x54c1b0):_0x54c1b0);}}_0xee477d['on'](_0xaec0('0x24'),_0x519e48);_0xee477d['on'](_0xaec0('0x25'),_0x49019c);_0xee477d['on'](_0xaec0('0x11'),_0x1fbd18);_0xee477d['on'](_0xaec0('0x13'),_0x1f3ad8);});}; \ 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 ba28117..1a22abb 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 _0x9838=['./asr','exports'];(function(_0x1f55f9,_0xf5c554){var _0x885614=function(_0x9747d3){while(--_0x9747d3){_0x1f55f9['push'](_0x1f55f9['shift']());}};_0x885614(++_0xf5c554);}(_0x9838,0xbc));var _0x8983=function(_0x2ef464,_0x33dbab){_0x2ef464=_0x2ef464-0x0;var _0x293f3e=_0x9838[_0x2ef464];return _0x293f3e;};var asr=require(_0x8983('0x0'));module[_0x8983('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe60b=['exports','./asr'];(function(_0x55491f,_0x1423a1){var _0x57cc8a=function(_0x4bc0a5){while(--_0x4bc0a5){_0x55491f['push'](_0x55491f['shift']());}};_0x57cc8a(++_0x1423a1);}(_0xe60b,0x1c9));var _0xbe60=function(_0x15274a,_0x4c84ad){_0x15274a=_0x15274a-0x0;var _0x4f8d08=_0xe60b[_0x15274a];return _0x4f8d08;};var asr=require(_0xbe60('0x0'));module[_0xbe60('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8efd92b..5e33f83 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0xe706,0xa3));var _0x6e70=function(_0x395b58,_0x23518d){_0x395b58=_0x395b58-0x0;var _0x43c80a=_0xe706[_0x395b58];return _0x43c80a;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 57eec5b..9b8a54d 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 _0x80d9=['googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','appid','appsecret','clear','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','format','%s.%s','setVariable','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','no\x20query\x20configured','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','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\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','intKey','tilde\x20%s\x20file\x20created','tildeASR','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','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','%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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendSMS','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','rawHeaders','getdigits','getsecretdigits','channel','rpc','getVariableById','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','then','getSquareOdbc','getSquareOdbcById','getUserById','getSound','getSoundPath','save_name','getMailAccountById','IntervalId','interval','Intervals','%s/sounds/converted/%s','open','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','rawBody','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language'];(function(_0x4a0619,_0x520a45){var _0x420ba7=function(_0x1e9bed){while(--_0x1e9bed){_0x4a0619['push'](_0x4a0619['shift']());}};_0x420ba7(++_0x520a45);}(_0x80d9,0x15c));var _0x980d=function(_0x359c7d,_0x1209d5){_0x359c7d=_0x359c7d-0x0;var _0x338a22=_0x80d9[_0x359c7d];return _0x338a22;};'use strict';var fs=require('fs');var util=require(_0x980d('0x0'));var _=require('lodash');var sh=require(_0x980d('0x1'));var odbc=require(_0x980d('0x2'))();var rs=require(_0x980d('0x3'));var moment=require('moment');var Mustache=require(_0x980d('0x4'));var rp=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x980d('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x980d('0xa'),_0x980d('0xb')];var AGIVertices=function(_0x2b8e2c,_0x270d06,_0x3b1043){this[_0x980d('0xc')]=_0x2b8e2c;this[_0x980d('0xd')]=_0x270d06;this['mailRpc']=_0x3b1043;};AGIVertices['prototype']['getVariable']=function(_0x43a0d8,_0x10872c){this['rpc'][_0x980d('0xe')](_0x43a0d8)['then'](function(_0x19fc88){_0x10872c(null,_0x19fc88?_0x19fc88['name']:![]);})[_0x980d('0xf')](function(_0x19cb9b){_0x10872c(_0x19cb9b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x11')]=function(_0xa1c26d,_0x18469c){this[_0x980d('0xd')][_0x980d('0x12')](_0xa1c26d)['then'](function(_0x182ff9){_0x18469c(null,_0x182ff9?_0x182ff9[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x3846bd){_0x18469c(_0x3846bd);});};AGIVertices[_0x980d('0x10')][_0x980d('0x14')]=function(_0x5824bf,_0x27dd6a){this[_0x980d('0xd')]['getSquareProjectById'](_0x5824bf)[_0x980d('0x15')](function(_0x4e9d73){_0x27dd6a(null,_0x4e9d73?_0x4e9d73[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x39192b){_0x27dd6a(_0x39192b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x16')]=function(_0xc360c4,_0x3ef68b){this[_0x980d('0xd')][_0x980d('0x17')](_0xc360c4)[_0x980d('0x15')](function(_0x2f234f){_0x3ef68b(null,_0x2f234f?_0x2f234f['dsn']:![]);})['catch'](function(_0x3cb470){_0x3ef68b(_0x3cb470);});};AGIVertices['prototype']['getUser']=function(_0x124c3f,_0x1d6286){this[_0x980d('0xd')][_0x980d('0x18')](_0x124c3f)['then'](function(_0x595cf0){_0x1d6286(null,_0x595cf0?_0x595cf0[_0x980d('0x13')]:![]);})['catch'](function(_0x4de252){_0x1d6286(_0x4de252);});};AGIVertices[_0x980d('0x10')]['getTrunk']=function(_0x23ca08,_0x4798d7){this['rpc']['getTrunkById'](_0x23ca08)[_0x980d('0x15')](function(_0x43f278){_0x4798d7(null,_0x43f278?_0x43f278[_0x980d('0x13')]:![]);})[_0x980d('0xf')](function(_0x5342dd){_0x4798d7(_0x5342dd);});};AGIVertices['prototype'][_0x980d('0x19')]=function(_0x1d5dad,_0x97ca70){var _0x1da8ea=this;this[_0x980d('0xd')]['getSoundById'](_0x1d5dad)['then'](function(_0x2830e5){_0x97ca70(null,_0x2830e5?_0x1da8ea[_0x980d('0x1a')](_0x2830e5[_0x980d('0x1b')]):![]);})[_0x980d('0xf')](function(_0x2dab0e){_0x97ca70(_0x2dab0e);});};AGIVertices[_0x980d('0x10')]['getMailAccount']=function(_0x14c61b,_0x471f52){this[_0x980d('0xd')][_0x980d('0x1c')](_0x14c61b)[_0x980d('0x15')](function(_0x38470b){_0x471f52(null,_0x38470b?_0x38470b:![]);})[_0x980d('0xf')](function(_0x819fa4){_0x471f52(_0x819fa4);});};AGIVertices[_0x980d('0x10')]['sendMailMessage']=function(_0x3671b8,_0xdc7c43,_0x446cc2){this['mailRpc']['sendMailMessage'](_0x3671b8,_0xdc7c43)[_0x980d('0x15')](function(){_0x446cc2(null);})['catch'](function(_0x3e398){_0x446cc2(_0x3e398);});};AGIVertices['prototype']['getIntervals']=function(_0x5a3160,_0x4b2011){this['rpc']['getIntervalById'](_0x5a3160)['then'](function(_0x1581ee){if(_0x1581ee){if(_0x1581ee[_0x980d('0x1d')]){_0x4b2011(null,[_0x1581ee[_0x980d('0x1e')]]);}else{_0x4b2011(null,_['map'](_0x1581ee[_0x980d('0x1f')],_0x980d('0x1e')));}}else{_0x4b2011(null,![]);}})[_0x980d('0xf')](function(_0x2623d8){_0x4b2011(_0x2623d8);});};AGIVertices[_0x980d('0x10')][_0x980d('0x1a')]=function(_0x2f0081){return util['format'](_0x980d('0x20'),FILES_PATH,_0x2f0081);};AGIVertices[_0x980d('0x10')]['getQueryOdbc']=function(_0x92c9bd,_0x588e89,_0x293f7d){odbc[_0x980d('0x21')](_0x92c9bd,function(_0x41159e){if(_0x41159e){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x41159e);_0x293f7d(_0x41159e);}else{logger['info'](_0x980d('0x22'));odbc['query'](_0x588e89,function(_0x4cda3e,_0x98b1b){if(_0x4cda3e){logger[_0x980d('0x23')](_0x980d('0x24'),_0x588e89);_0x293f7d(_0x4cda3e);}else{logger['info'](_0x980d('0x25'),_0x588e89);odbc[_0x980d('0x26')](function(_0x32f2f9){if(_0x32f2f9){logger[_0x980d('0x27')](_0x980d('0x28'),_0x32f2f9);}_0x293f7d(null,_0x98b1b);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x18f844,_0x5d356d){this['rpc']['getSmsAccountById'](_0x18f844)['then'](function(_0x1c4d89){_0x5d356d(null,_0x1c4d89?_0x1c4d89:![]);})[_0x980d('0xf')](function(_0x8bcd98){_0x5d356d(_0x8bcd98);});};AGIVertices['prototype'][_0x980d('0x29')]=function(_0x439f2a,_0x308466){this[_0x980d('0xd')][_0x980d('0x29')](_0x439f2a)[_0x980d('0x15')](function(_0x1221e7){_0x308466(null,_0x1221e7);})['catch'](function(_0x3baef0){_0x308466(_0x3baef0);});};AGIVertices[_0x980d('0x10')][_0x980d('0x2a')]=function(_0x5f1f04,_0x2a40fd,_0x464d63){this[_0x980d('0xd')][_0x980d('0x2a')]({'uniqueid':this[_0x980d('0xc')][_0x980d('0x2b')],'node':_0x5f1f04[_0x980d('0x2c')],'application':_0x5f1f04['agicommand'],'data':_0x2a40fd||null,'project_name':this[_0x980d('0xc')]['arg_1'],'callerid':this[_0x980d('0xc')][_0x980d('0x2d')]})[_0x980d('0x15')](function(_0x10403d){if(_0x464d63){_0x464d63(null,_0x10403d);}})[_0x980d('0xf')](function(_0x20479d){if(_0x464d63){_0x464d63(_0x20479d);}});};AGIVertices[_0x980d('0x10')][_0x980d('0x2e')]=function(_0x541261,_0x4910f8,_0x2cd7a0,_0x2746db){this[_0x980d('0xd')][_0x980d('0x2e')]({'uniqueid':this[_0x980d('0xc')]['uniqueid'],'callerid':this[_0x980d('0xc')][_0x980d('0x2d')],'calleridname':this['channel'][_0x980d('0x2f')],'context':this[_0x980d('0xc')][_0x980d('0x30')],'extension':this[_0x980d('0xc')][_0x980d('0x31')],'priority':this[_0x980d('0xc')][_0x980d('0x32')],'accountcode':this[_0x980d('0xc')][_0x980d('0x33')],'dnid':this['channel'][_0x980d('0x34')],'projectName':this[_0x980d('0xc')][_0x980d('0x35')],'saveName':_0x4910f8,'filename':_0x541261[_0x980d('0x36')]||_0x4910f8,'savePath':_0x2cd7a0})[_0x980d('0x15')](function(_0x7d0acf){_0x2746db(null,_0x7d0acf);})[_0x980d('0xf')](function(_0x4f0a6e){_0x2746db(_0x4f0a6e);});};AGIVertices[_0x980d('0x10')]['createSquareMessage']=function(_0x33c914,_0x6e16c1,_0x44c97d,_0x84fd0,_0xb1d509){this['rpc'][_0x980d('0x37')]({'uniqueid':this[_0x980d('0xc')][_0x980d('0x2b')],'body':_0x33c914,'direction':_0x6e16c1,'providerName':_0x44c97d,'providerResponse':_0x84fd0})[_0x980d('0x15')](function(_0x35b13c){if(_0xb1d509){_0xb1d509(null,_0x35b13c);}})[_0x980d('0xf')](function(_0x411b3a){if(_0xb1d509){_0xb1d509(_0x411b3a);}});};AGIVertices['prototype']['createCmContact']=function(_0x508663,_0x4e0f93){this[_0x980d('0xd')][_0x980d('0x38')]({'firstName':_[_0x980d('0x39')](_0x508663[_0x980d('0x13')])||_[_0x980d('0x3a')](_0x508663[_0x980d('0x13')])?'callback_'+Math[_0x980d('0x3b')]():_0x508663['name'],'lastName':_[_0x980d('0x39')](_0x508663[_0x980d('0x3c')])||_[_0x980d('0x3a')](_0x508663[_0x980d('0x3c')])?null:_0x508663['lastName'],'phone':_0x508663['phone'],'ListId':_0x508663[_0x980d('0x3d')],'scheduledat':_0x508663[_0x980d('0x3e')],'callbackUniqueid':this[_0x980d('0xc')]['uniqueid'],'tags':'callback','description':_0x980d('0x3f')+_0x508663['scheduledAt'][_0x980d('0x40')](),'priority':_0x508663[_0x980d('0x41')]})[_0x980d('0x15')](function(_0x15427b){_0x4e0f93(null,_0x15427b);})[_0x980d('0xf')](function(_0xf09fdd){_0x4e0f93(_0xf09fdd);});};AGIVertices[_0x980d('0x10')][_0x980d('0x42')]=function(_0x516cd6,_0x556e57){this[_0x980d('0xd')]['getPauseById'](_0x516cd6)[_0x980d('0x15')](function(_0x21cf36){_0x556e57(null,_0x21cf36?_0x21cf36['name']:![]);})[_0x980d('0xf')](function(_0x338128){_0x556e57(_0x338128);});};AGIVertices[_0x980d('0x10')][_0x980d('0x43')]=function(_0x5498aa,_0x2ccfff,_0x5e45c6){var _0x5616ee={'role':_0x980d('0x44')};_0x5616ee[_0x5498aa]=this['channel'][_0x980d('0x2d')];this['rpc'][_0x980d('0x43')](_0x5616ee,_0x2ccfff,this[_0x980d('0xc')]['uniqueid'])[_0x980d('0x15')](function(_0x132495){_0x5e45c6(null,_[_0x980d('0x3a')](_0x132495)?![]:!![]);})[_0x980d('0xf')](function(_0x26a600){logger[_0x980d('0x27')](_0x26a600);_0x5e45c6(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x45')]=function(_0x3190b4,_0x6df3f7){var _0x1f7dc9={'role':_0x980d('0x44')};_0x1f7dc9[_0x3190b4]=this['channel']['callerid'];this['rpc'][_0x980d('0x45')](_0x1f7dc9)['then'](function(_0x153c02){_0x6df3f7(null,_[_0x980d('0x3a')](_0x153c02)?![]:!![]);})[_0x980d('0xf')](function(_0x3d9a3a){logger['error'](_0x3d9a3a);_0x6df3f7(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x46')]=function(_0x585d62,_0x2dce96){var _0x5aebee={'role':_0x980d('0x44')};_0x5aebee[_0x585d62]=this['channel']['callerid'];this[_0x980d('0xd')][_0x980d('0x46')](_0x5aebee)[_0x980d('0x15')](function(_0x16f427){_0x2dce96(null,_['isNil'](_0x16f427)?![]:!![]);})[_0x980d('0xf')](function(_0x5ca660){logger['error'](_0x5ca660);_0x2dce96(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x47')]=function(_0x3bd029,_0x357f77){var _0x1d9e40={'role':_0x980d('0x44')};_0x1d9e40[_0x3bd029]=this[_0x980d('0xc')][_0x980d('0x2d')];var _0x392ec3=_0x3bd029!=_0x980d('0x48')?util['format'](_0x980d('0x49'),'LOCAL',this[_0x980d('0xc')][_0x980d('0x2d')]):undefined;this['rpc'][_0x980d('0x47')](_0x1d9e40,_0x392ec3)[_0x980d('0x15')](function(_0x2aa8d4){_0x357f77(null,_[_0x980d('0x3a')](_0x2aa8d4)?![]:!![]);})['catch'](function(_0x7a900c){logger[_0x980d('0x27')](_0x7a900c);_0x357f77(null,![]);});};AGIVertices[_0x980d('0x10')][_0x980d('0x4a')]=function(_0xfcca92,_0x612016){sh[_0x980d('0x4b')](_[_0x980d('0x4c')](_0xfcca92),function(_0x2b4754,_0x3ccee3){var _0x54665f=_0x3ccee3[_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'');_0x612016(null,_0x54665f);});};AGIVertices[_0x980d('0x10')][_0x980d('0x4e')]=function(_0x45731c,_0x42f831){scripts[_0x980d('0x4e')](_0x45731c['apiKey'],_0x45731c['google_cloud_tts_text_type']||_0x980d('0x4f'),_0x45731c[_0x980d('0x4f')],_0x45731c[_0x980d('0x50')]||_0x980d('0x51'),_0x45731c[_0x980d('0x52')]||_0x980d('0x53'),_0x45731c['audioEncoding']||'MP3')['then'](function(_0x255f78){_0x42f831(null,_0x255f78);})['catch'](function(_0x2cb6c7){_0x42f831(_0x2cb6c7);});};AGIVertices[_0x980d('0x10')][_0x980d('0x54')]=function(_0x304047,_0x5037f8){scripts['googleTTS'](_0x304047[_0x980d('0x4f')],_0x304047['google_tts_language']||'en',0x1)[_0x980d('0x15')](function(_0x11a400){_0x5037f8(null,_0x11a400);})[_0x980d('0xf')](function(_0x137869){_0x5037f8(_0x137869);});};AGIVertices['prototype'][_0x980d('0x55')]=function(_0x569c2d,_0x2e2fe1){var _0x30e444={'uri':_0x569c2d[_0x980d('0x56')],'method':_0x569c2d[_0x980d('0x57')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x569c2d['timeout'])===_0x980d('0x58')&&parseInt(_0x569c2d[_0x980d('0x59')])>=0x1?parseInt(_0x569c2d[_0x980d('0x59')])*0x3e8:0x5*0x3e8};if(_[_0x980d('0x5a')]([_0x980d('0x5b'),_0x980d('0x5c')],_0x30e444['method'][_0x980d('0x5d')]())){try{_0x30e444[_0x980d('0x5e')]=_0x569c2d['rawBody']?JSON[_0x980d('0x5f')](_0x569c2d[_0x980d('0x60')]):{};}catch(_0x4fa248){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4fa248);}}try{_0x30e444[_0x980d('0x61')]=_0x569c2d[_0x980d('0x9')]?JSON[_0x980d('0x5f')](_0x569c2d[_0x980d('0x9')]):{};}catch(_0x2da302){logger[_0x980d('0x27')](_0x980d('0x62'),_0x2da302);}if(_0x569c2d[_0x980d('0x63')]){try{var _0x2448e3=require(_0x569c2d[_0x980d('0x63')])['sync'](this,_0x30e444);_0x30e444[_0x980d('0x64')]=Mustache[_0x980d('0x65')](_0x569c2d[_0x980d('0x56')],_0x2448e3,{},['$$','$$']);if(_0x30e444[_0x980d('0x61')]){_0x30e444[_0x980d('0x61')]=JSON[_0x980d('0x5f')](Mustache['render'](JSON['stringify'](_0x30e444[_0x980d('0x61')]),_0x2448e3,{},['$$','$$']));}if(_0x30e444[_0x980d('0x5e')]){_0x30e444['body']=JSON[_0x980d('0x5f')](Mustache[_0x980d('0x65')](JSON[_0x980d('0x66')](_0x30e444[_0x980d('0x5e')]),_0x2448e3,{},['$$','$$']));}}catch(_0x9691){logger[_0x980d('0x27')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x9691);}}rp(_0x30e444)[_0x980d('0x15')](function(_0x464f1f){var _0x3e1a20={'statusCode':_0x464f1f[_0x980d('0x67')]||0xc8,'statusMessage':_0x464f1f['statusMessage']||'OK','headers':_0x464f1f[_0x980d('0x61')]||{},'body':_0x464f1f['body']||{}};_0x2e2fe1(null,_0x3e1a20);})['catch'](function(_0x5251b6){var _0x3964c4={'statusCode':_0x5251b6['statusCode']||0x1f4,'statusMessage':_0x5251b6[_0x980d('0x68')]||_0x980d('0x69'),'headers':_0x5251b6[_0x980d('0x6a')][_0x980d('0x61')]||{},'body':_0x5251b6[_0x980d('0x6a')][_0x980d('0x5e')]||{}};_0x2e2fe1(null,_0x3964c4);});};AGIVertices['prototype'][_0x980d('0x6b')]=function(_0x6b83e9,_0x5ea5e4){scripts[_0x980d('0x6b')](this['channel']['uniqueid'],_0x6b83e9[_0x980d('0x6c')],_0x6b83e9[_0x980d('0x4f')],_0x6b83e9[_0x980d('0x6d')]||'en')[_0x980d('0x15')](function(_0x2f87b5){_0x5ea5e4(null,_0x2f87b5);})[_0x980d('0xf')](function(_0x3fc684){_0x5ea5e4(_0x3fc684);});};AGIVertices[_0x980d('0x10')][_0x980d('0x6e')]=function(_0x3517bd,_0x28dbea){scripts[_0x980d('0x6e')](this[_0x980d('0xc')][_0x980d('0x2b')],_0x3517bd['dialogflowV2_project_id'],_0x3517bd[_0x980d('0x6f')],_0x3517bd['private_key'],_0x3517bd['text'],_0x3517bd[_0x980d('0x70')]||'en')[_0x980d('0x15')](function(_0x1a4a32){_0x28dbea(null,_0x1a4a32);})[_0x980d('0xf')](function(_0x43ad4b){_0x28dbea(_0x43ad4b);});};AGIVertices['prototype'][_0x980d('0x71')]=function(_0x32b16d,_0x29c4ff){scripts['sestekNDA'](this[_0x980d('0xc')],_0x32b16d)[_0x980d('0x15')](function(_0x5182b1){_0x29c4ff(null,_0x5182b1);})[_0x980d('0xf')](function(_0x10e440){_0x29c4ff(_0x10e440);});};AGIVertices[_0x980d('0x10')][_0x980d('0x72')]=function(_0x2683fb,_0x4e0310){scripts[_0x980d('0x72')](_0x2683fb[_0x980d('0x6c')],_0x2683fb[_0x980d('0x4f')],_0x2683fb[_0x980d('0x73')]||_0x980d('0x51'),_0x2683fb['speed'])[_0x980d('0x15')](function(_0x1869dd){_0x4e0310(null,_0x1869dd);})['catch'](function(_0x502df3){_0x4e0310(_0x502df3);});};AGIVertices[_0x980d('0x10')][_0x980d('0x74')]=function(_0x41609a,_0x696240,_0x34c1c4){scripts['ispeechASR'](_0x696240,_0x41609a[_0x980d('0x6c')],_0x41609a['ispeech_asr_language']||_0x980d('0x51'),this[_0x980d('0x75')](_0x41609a[_0x980d('0x76')])?_0x41609a[_0x980d('0x76')]:undefined)['then'](function(_0x2519b3){_0x34c1c4(null,_0x2519b3);})['catch'](function(_0x40ac23){_0x34c1c4(_0x40ac23);});};AGIVertices[_0x980d('0x10')][_0x980d('0x77')]=function(_0x117a45,_0x42dbf0){scripts[_0x980d('0x77')](_0x117a45['aws_access_key_id'],_0x117a45['aws_secret_access_key'],_0x117a45[_0x980d('0x78')],_0x117a45['aws_polly_voice']||_0x980d('0x79'),_0x117a45['text'],_0x117a45[_0x980d('0x7a')]||_0x980d('0x4f'))[_0x980d('0x15')](function(_0x4e4998){_0x42dbf0(null,_0x4e4998);})['catch'](function(_0x267b5c){_0x42dbf0(_0x267b5c);});};AGIVertices[_0x980d('0x10')]['awsLex']=function(_0x5c24c1,_0x1cdf3c){scripts[_0x980d('0x7b')](this[_0x980d('0xc')]['uniqueid'],_0x5c24c1[_0x980d('0x7c')],_0x5c24c1['aws_secret_access_key'],_0x5c24c1['aws_lex_region'],_0x5c24c1[_0x980d('0x4f')],_0x5c24c1['aws_bot_name'])['then'](function(_0x20bf24){_0x1cdf3c(null,_0x20bf24);})['catch'](function(_0x568c99){_0x1cdf3c(_0x568c99);});};AGIVertices['prototype'][_0x980d('0x7d')]=function(_0x2e08c9,_0x1b32a1,_0x2d6103){scripts[_0x980d('0x7d')](_0x1b32a1,_0x2e08c9['key'],_0x2e08c9['google_asr_language']||_0x980d('0x51'))[_0x980d('0x15')](function(_0x197812){_0x2d6103(null,_0x197812);})[_0x980d('0xf')](function(_0x2fa847){_0x2d6103(_0x2fa847);});};AGIVertices[_0x980d('0x10')]['tildeASR']=function(_0x4faa44,_0x1945f8,_0x176cd7){scripts['tildeASR'](_0x1945f8,_0x4faa44[_0x980d('0x7e')],_0x4faa44[_0x980d('0x7f')],_0x4faa44['uri'])[_0x980d('0x15')](function(_0x480145){_0x176cd7(null,_0x480145);})[_0x980d('0xf')](function(_0x215c0b){_0x176cd7(_0x215c0b);});};AGIVertices[_0x980d('0x10')][_0x980d('0x80')]=function(_0x24331c){var _0xb14bd9=_[_0x980d('0x5a')](verticesWithRetry,_0x24331c[_0x980d('0x81')])?_0x24331c:_['clone'](_0x24331c);for(var _0x4cddd2 in _0xb14bd9){if(_0xb14bd9[_0x980d('0x82')](_0x4cddd2)){if(_0xb14bd9[_0x4cddd2]&&_['isString'](_0xb14bd9[_0x4cddd2])){if(_['includes'](recursiveMapAttributes,_0x4cddd2)){_0xb14bd9[_0x4cddd2]=this[_0x980d('0x83')](_0xb14bd9[_0x4cddd2]);}else{_0xb14bd9[_0x4cddd2]=this[_0x980d('0x84')](_0xb14bd9[_0x4cddd2]);}}}}return _0xb14bd9;};AGIVertices[_0x980d('0x10')][_0x980d('0x85')]=function(_0x44446f){for(var _0x640ff1 in _0x44446f){if(_0x44446f[_0x980d('0x82')](_0x640ff1)){if(_[_0x980d('0x86')](_0x44446f[_0x640ff1])){this[_0x980d('0x85')](_0x44446f[_0x640ff1]);}else if(_[_0x980d('0x87')](_0x44446f[_0x640ff1])){for(var _0x380e0d=0x0;_0x380e0d<_0x44446f[_0x640ff1][_0x980d('0x88')];_0x380e0d++){this[_0x980d('0x85')](_0x44446f[_0x640ff1][_0x380e0d]);}}else if(_[_0x980d('0x89')](_0x44446f[_0x640ff1])){_0x44446f[_0x640ff1]=this[_0x980d('0x84')](_0x44446f[_0x640ff1]);}}}};AGIVertices[_0x980d('0x10')][_0x980d('0x8a')]=function(_0x3adb26,_0x5a86a4){for(var _0x3dcbe5 in _0x3adb26){if(_0x3adb26[_0x980d('0x82')](_0x3dcbe5)){if(_[_0x980d('0x86')](_0x3adb26[_0x3dcbe5])){if(!_['isEmpty'](_0x3adb26[_0x3dcbe5])){this['saveRestApiResult'](_0x3adb26[_0x3dcbe5],util[_0x980d('0x8b')](_0x980d('0x8c'),_0x5a86a4,_0x3dcbe5));}}else if(_[_0x980d('0x87')](_0x3adb26[_0x3dcbe5])){for(var _0x585378=0x0;_0x585378<_0x3adb26[_0x3dcbe5]['length'];_0x585378++){this['saveRestApiResult'](_0x3adb26[_0x3dcbe5][_0x585378],util[_0x980d('0x8b')]('%s.%s',_0x5a86a4,_0x3dcbe5+'['+_0x585378+']'));}}else{if(!_['isNil'](_0x3adb26[_0x3dcbe5])){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0x8c'),_0x5a86a4,_0x3dcbe5),_0x3adb26[_0x3dcbe5]);}}}}};AGIVertices[_0x980d('0x10')][_0x980d('0x83')]=function(_0x3d5ff2){try{var _0x37f3d8=JSON[_0x980d('0x5f')](_0x3d5ff2);this[_0x980d('0x85')](_0x37f3d8);return JSON[_0x980d('0x66')](_0x37f3d8);}catch(_0x5a4fa0){return this['replaceAllVariables'](_0x3d5ff2);}};AGIVertices[_0x980d('0x10')]['replaceAllVariables']=function(_0x44923f){var _0x4ec322=_0x44923f['split']('{');for(var _0x35e973=0x1;_0x35e973<_0x4ec322[_0x980d('0x88')];_0x35e973+=0x1){var _0x5f19a6=_0x4ec322[_0x35e973]['split']('}');if(_0x5f19a6['length']>0x1){_0x44923f=_0x44923f[_0x980d('0x8e')]('{'+_0x5f19a6[0x0]+'}',this[_0x980d('0xc')][_0x980d('0x8f')](_0x5f19a6[0x0])[_0x980d('0x90')]||_0x5f19a6[0x0]);}}if(_0x4ec322[_0x980d('0x88')]===0x1){return _0x44923f[_0x980d('0x40')]();}return this[_0x980d('0x84')](_0x44923f);};AGIVertices['prototype'][_0x980d('0x91')]=function(_0xda48eb,_0x47b26d){var _0x4ad23c=this[_0x980d('0xc')][_0x980d('0x8f')](_0xda48eb);if(_0x4ad23c['result']===-0x1){return _0x4ad23c;}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x92'),_0x47b26d,_0x4ad23c['extra']));return this['channel']['setVariable'](_0x47b26d,_0x4ad23c[_0x980d('0x90')]);};AGIVertices['prototype'][_0x980d('0x75')]=function(_0x4a4af4){return _0x4a4af4&&_0x4a4af4!=='0'&&_0x4a4af4!=='-1'&&_0x4a4af4!=='';};AGIVertices['prototype'][_0x980d('0x93')]=function(_0xaf5329){this[_0x980d('0x2a')][_0x980d('0x94')](this,_0xaf5329,'-');_0xaf5329['retry']=_0xaf5329[_0x980d('0x93')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x980d('0x10')][_0x980d('0x95')]=function(_0x109805){logger['info'](util[_0x980d('0x8b')](_0x980d('0x96'),_0x109805[_0x980d('0x2c')]));if(!this['isConfigured'](_0x109805[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x378ad0='\x22'+_0x109805[_0x980d('0x4f')]+'\x22';if(this['isConfigured'](_0x109805[_0x980d('0x6a')])){_0x378ad0+=','+_0x109805['options'];}var _0x25e223=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x378ad0);if(_0x25e223[_0x980d('0x99')]===-0x1){return _0x25e223;}return this['channel']['noop'](util['format'](_0x980d('0x9a'),_0x378ad0));};AGIVertices[_0x980d('0x10')][_0x980d('0x9b')]=function(_0x4586bf){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x9c'),_0x4586bf[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x4586bf[_0x980d('0x9d')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x9f'));}var _0x2c819b=_0x4586bf[_0x980d('0x9d')];if(this['isConfigured'](_0x4586bf[_0x980d('0x6a')])){_0x2c819b+=','+_0x4586bf[_0x980d('0x6a')];}var _0x1c3670=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0xa0'),_0x2c819b);if(_0x1c3670[_0x980d('0x99')]===-0x1){return _0x1c3670;}var _0x46ac9e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x980d('0xa1'));if(_0x46ac9e['result']===-0x1){return _0x46ac9e;}var _0x20cfb3=this[_0x980d('0x91')](_0x980d('0xa2'),_0x980d('0xa3'));if(_0x20cfb3['result']===-0x1){return _0x20cfb3;}var _0x1e0321=this['getAndSetVariable']('RECOG_INSTANCE()',_0x980d('0xa4'));if(_0x1e0321[_0x980d('0x99')]===-0x1){return _0x1e0321;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xa5'),_0x2c819b));};AGIVertices[_0x980d('0x10')]['agi']=function(_0x3f7f23){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3f7f23[_0x980d('0x2c')]));return this['channel']['agi']([_0x3f7f23['command'],_0x3f7f23[_0x980d('0xa6')]]);};AGIVertices[_0x980d('0x10')]['answer']=function(_0x425452){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xa7'),_0x425452[_0x980d('0x2c')]));if(this[_0x980d('0x75')](_0x425452[_0x980d('0x59')])){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xa8'),_0x425452[_0x980d('0x59')]));var _0x43d7cc=this[_0x980d('0xc')][_0x980d('0xa9')](_0x425452[_0x980d('0x59')]);if(_0x43d7cc[_0x980d('0x99')]===-0x1){return _0x43d7cc;}}return this['channel'][_0x980d('0xaa')]();};AGIVertices['prototype']['callback']=function(_0x576f44){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x576f44[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x576f44[_0x980d('0x3d')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x576f44,_0x980d('0xab'));}_0x576f44[_0x980d('0x3e')]=moment();if(this['isConfigured'](_0x576f44[_0x980d('0xac')])){_0x576f44[_0x980d('0x3e')]=moment()[_0x980d('0xad')](_0x576f44[_0x980d('0xac')],_0x980d('0xae'));}if(!this[_0x980d('0x75')](_0x576f44[_0x980d('0x41')])){_0x576f44[_0x980d('0x41')]=0x2;}this[_0x980d('0x38')]['sync'](this,_0x576f44);return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xaf'),_0x576f44[_0x980d('0xb0')],_0x576f44[_0x980d('0x3d')],_0x576f44[_0x980d('0x3e')]));};AGIVertices['prototype']['custom_app']=function(_0x16fe6f){logger['info'](util[_0x980d('0x8b')](_0x980d('0xb1'),_0x16fe6f[_0x980d('0x2c')]));var _0x3032e8=this[_0x980d('0xc')]['exec'](_0x16fe6f['application'],_0x16fe6f[_0x980d('0x6a')]);if(_0x3032e8[_0x980d('0x99')]===-0x1){return _0x3032e8;}return this['channel'][_0x980d('0x9e')](util['format'](_0x980d('0xb2'),_0x16fe6f[_0x980d('0xb3')],_0x16fe6f['options']));};AGIVertices[_0x980d('0x10')][_0x980d('0xb4')]=function(_0x29d52b){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb5'),_0x29d52b[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x29d52b[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x15bb84='\x22'+_0x29d52b[_0x980d('0x4f')]+'\x22';if(this['isConfigured'](_0x29d52b['options'])){_0x15bb84+=','+_0x29d52b[_0x980d('0x6a')];}var _0x5c2780=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x15bb84);if(_0x5c2780[_0x980d('0x99')]===-0x1){return _0x5c2780;}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x9a'),_0x15bb84));};AGIVertices['prototype'][_0x980d('0xb6')]=function(_0x37534f){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb7'),_0x37534f[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x37534f[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}var _0x3baaf2='\x22'+_0x37534f[_0x980d('0x4f')]+'\x22';if(this[_0x980d('0x75')](_0x37534f['options'])){_0x3baaf2+=','+_0x37534f[_0x980d('0x6a')];}var _0x228454=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x98'),_0x3baaf2);if(_0x228454['result']===-0x1){return _0x228454;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x9a'),_0x3baaf2));};AGIVertices[_0x980d('0x10')][_0x980d('0xb8')]=function(_0x2a3ac7){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xb9'),_0x2a3ac7[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x2a3ac7[_0x980d('0x9d')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x9f'));}var _0x1da00e=_0x2a3ac7[_0x980d('0x9d')];if(this[_0x980d('0x75')](_0x2a3ac7[_0x980d('0x6a')])){_0x1da00e+=','+_0x2a3ac7[_0x980d('0x6a')];}var _0x17743a=this['channel'][_0x980d('0x4b')](_0x980d('0xa0'),_0x1da00e);if(_0x17743a['result']===-0x1){return _0x17743a;}var _0xaf23c1=this['getAndSetVariable'](_0x980d('0xba'),_0x980d('0xbb'));if(_0xaf23c1[_0x980d('0x99')]===-0x1){return _0xaf23c1;}var _0x28c142=this[_0x980d('0x91')](_0x980d('0xa2'),_0x980d('0xbc'));if(_0x28c142[_0x980d('0x99')]===-0x1){return _0x28c142;}var _0x4179bb=this[_0x980d('0x91')](_0x980d('0xbd'),'LUMENVOX_ASR_INSTANCE');if(_0x4179bb[_0x980d('0x99')]===-0x1){return _0x4179bb;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xa5'),_0x1da00e));};AGIVertices[_0x980d('0x10')]['sestekasr']=function(_0x4c11a9){logger[_0x980d('0x23')](util['format'](_0x980d('0xbe'),_0x4c11a9['label']));if(!this['isConfigured'](_0x4c11a9[_0x980d('0x9d')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x9f'));}var _0x5b3ca7=_0x4c11a9[_0x980d('0x9d')];if(this['isConfigured'](_0x4c11a9[_0x980d('0x6a')])){_0x5b3ca7+=','+_0x4c11a9['options'];}var _0x337c1e=this['channel']['exec'](_0x980d('0xa0'),_0x5b3ca7);if(_0x337c1e[_0x980d('0x99')]===-0x1){return _0x337c1e;}var _0x365377=this[_0x980d('0x91')](_0x980d('0xba'),_0x980d('0xbf'));if(_0x365377[_0x980d('0x99')]===-0x1){return _0x365377;}var _0x22a62a=this['getAndSetVariable']('RECOG_INPUT()',_0x980d('0xc0'));if(_0x22a62a[_0x980d('0x99')]===-0x1){return _0x22a62a;}var _0x1767f4=this['getAndSetVariable']('RECOG_INSTANCE()',_0x980d('0xc1'));if(_0x1767f4[_0x980d('0x99')]===-0x1){return _0x1767f4;}return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xa5'),_0x5b3ca7));};AGIVertices[_0x980d('0x10')][_0x980d('0xc2')]=function(_0x338af7){logger['info'](util[_0x980d('0x8b')](_0x980d('0xc3'),_0x338af7[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x338af7[_0x980d('0xc4')])){return this['channel'][_0x980d('0x27')](_0x338af7,'no\x20database\x20selected');}var _0x26cda2=this[_0x980d('0x16')][_0x980d('0x94')](this,_0x338af7['odbc_id']);if(!_0x26cda2){return this[_0x980d('0xc')][_0x980d('0x27')](_0x338af7,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x338af7[_0x980d('0xc5')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x338af7,_0x980d('0xc6'));}var _0x587a70=_0x338af7['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('query:\x20%s',_0x587a70));var _0x2c00c2=this[_0x980d('0xc7')][_0x980d('0x94')](this,_0x26cda2,_0x587a70);this['createSquareDetailsReport'][_0x980d('0x94')](this,_0x338af7,_0x587a70);if(!this[_0x980d('0x75')](_0x338af7['variable_id'])){return this['channel'][_0x980d('0x9e')](_0x980d('0xc8'));}var _0x1a52d3=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x338af7[_0x980d('0xc9')]);if(!_0x1a52d3){return this['channel'][_0x980d('0x27')](_0x338af7,_0x980d('0xca'));}var _0x55739c=this;_0x2c00c2['forEach'](function(_0x4a1ee9,_0x43bc29){Object[_0x980d('0xcb')](_0x4a1ee9)[_0x980d('0xcc')](function(_0x248b73){_0x55739c[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xcd'),_0x1a52d3,_0x43bc29,_0x248b73),_0x4a1ee9[_0x248b73]);});});this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0xce'),_0x1a52d3),_0x2c00c2[_0x980d('0x88')]);return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xcf'),_0x1a52d3));};AGIVertices[_0x980d('0x10')][_0x980d('0xd0')]=function(_0x433e62){logger[_0x980d('0xd1')](util[_0x980d('0x8b')](_0x980d('0xd2'),_0x433e62[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x433e62[_0x980d('0xd3')])){return this[_0x980d('0xc')]['error'](_0x433e62,_0x980d('0xd4'));}var _0x52bdcb=this['getUser']['sync'](this,_0x433e62[_0x980d('0xd3')]);if(!_0x52bdcb){return this[_0x980d('0xc')][_0x980d('0x27')](_0x433e62,_0x980d('0xd5'));}var _0x35e1e2=this['channel']['exec'](_0x980d('0xd6'),[util[_0x980d('0x8b')](_0x980d('0xd7'),_0x52bdcb),_0x433e62[_0x980d('0x59')],_0x433e62[_0x980d('0xd8')],_0x433e62[_0x980d('0x56')]]);if(_0x35e1e2['result']===-0x1){return _0x35e1e2;}return this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0xd9'),_0x980d('0xd6')));};AGIVertices[_0x980d('0x10')][_0x980d('0xda')]=function(_0x5dfd41){logger['info'](util['format'](_0x980d('0xdb'),_0x5dfd41[_0x980d('0x2c')]));if(!this['isConfigured'](_0x5dfd41[_0x980d('0x6c')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5dfd41[_0x980d('0x4f')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20text\x20configured');}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x5dfd41);this['createSquareMessage'](_0x5dfd41[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xdd'),_0x5dfd41[_0x980d('0x4f')]));var _0x3434c8=this['googleDialogflow'][_0x980d('0x94')](this,_0x5dfd41);if(_0x3434c8){for(var _0x2c3e0e in _0x3434c8){if(_0x3434c8['hasOwnProperty'](_0x2c3e0e)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('DIALOGFLOW_%s',_0x2c3e0e['toUpperCase']()),_0x3434c8[_0x2c3e0e]);}}this[_0x980d('0x37')](_0x3434c8[_0x980d('0xde')],_0x980d('0xdf'),_0x980d('0xda'),'');return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xe0'),_0x3434c8['speech']));}return this[_0x980d('0xc')][_0x980d('0x27')](_0x5dfd41,_0x980d('0xe1'));};AGIVertices[_0x980d('0x10')][_0x980d('0xe2')]=function(_0x1d0c0a){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1d0c0a[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1d0c0a[_0x980d('0xe3')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe4'));}if(!this['isConfigured'](_0x1d0c0a[_0x980d('0x6f')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe5'));}if(!this['isConfigured'](_0x1d0c0a[_0x980d('0xe6')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe7'));}if(!this[_0x980d('0x75')](_0x1d0c0a['dialogflowV2_language'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xe8'));}if(!this[_0x980d('0x75')](_0x1d0c0a[_0x980d('0x4f')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x1d0c0a);this[_0x980d('0x37')](_0x1d0c0a[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0xe9'),_0x1d0c0a[_0x980d('0x4f')]));var _0x1b6670=this['googleDialogflowV2'][_0x980d('0x94')](this,_0x1d0c0a);if(_0x1b6670){for(var _0xa487e0 in _0x1b6670){if(_0x1b6670[_0x980d('0x82')](_0xa487e0)){if(_0xa487e0!=='providerResponse'){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xea'),_0xa487e0[_0x980d('0x5d')]()),_0x1b6670[_0xa487e0]);}}}this['createSquareMessage'](_0x1b6670['speech'],_0x980d('0xdf'),_0x980d('0xe2'),_0x1b6670[_0x980d('0xeb')]);return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xec'),_0x1b6670['speech']));}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1d0c0a,_0x980d('0xed'));};AGIVertices[_0x980d('0x10')][_0x980d('0xee')]=function(_0x1e1ad4){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1e1ad4[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xef')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xf0')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0xf1'));}if(!this[_0x980d('0x75')](_0x1e1ad4['password'])){return this['channel'][_0x980d('0x9e')](_0x980d('0xf2'));}if(!this[_0x980d('0x75')](_0x1e1ad4[_0x980d('0xf3')])){return this['channel'][_0x980d('0x9e')]('no\x20text\x20configured');}this['channel'][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x1e1ad4);this[_0x980d('0x37')](_0x1e1ad4[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xf4'),_0x1e1ad4[_0x980d('0x4f')]));var _0x10c65a=this['sestekNDA'][_0x980d('0x94')](this,_0x1e1ad4);if(_0x10c65a){for(var _0x19ac24 in _0x10c65a){if(_0x10c65a['hasOwnProperty'](_0x19ac24)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0xf5'),_0x19ac24[_0x980d('0x5d')]()),_0x10c65a[_0x19ac24]);}}this[_0x980d('0x37')](_0x10c65a[_0x980d('0xde')],_0x980d('0xdf'),'sesteknda','');if(_0x10c65a['audiofile']){this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x10c65a['audiofile']));var _0x1577b1=this[_0x980d('0xc')]['streamFile'](_0x10c65a[_0x980d('0xf6')]);try{fs['unlink'](_0x10c65a['audiofile']+_0x980d('0xf7'));}catch(_0x46061d){logger[_0x980d('0x27')](_0x46061d);}return _0x1577b1;}else{return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xf8'),_0x10c65a[_0x980d('0xde')]));}}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1e1ad4,_0x980d('0xf9'));};AGIVertices['prototype'][_0x980d('0xfa')]=function(_0x505ed7){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xfb'),_0x505ed7[_0x980d('0x2c')]));return this[_0x980d('0xc')]['noop'](_0x980d('0xfa'));};AGIVertices[_0x980d('0x10')][_0x980d('0xfc')]=function(_0xfc4fe0){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0xfd'),_0xfc4fe0[_0x980d('0x2c')]));var _0x9c8734='';if(_0xfc4fe0[_0x980d('0xfe')]){if(!this['isConfigured'](_0xfc4fe0[_0x980d('0xfe')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0xfc4fe0,_0x980d('0xff'));}else{var _0x2bd4b3=parseInt(_0xfc4fe0['trunk_id'],0xa);if(isNaN(_0x2bd4b3)){_0x9c8734=_0xfc4fe0[_0x980d('0xfe')];}else{_0x9c8734=this[_0x980d('0x100')][_0x980d('0x94')](this,_0xfc4fe0['trunk_id']);if(!_0x9c8734){return this[_0x980d('0xc')]['error'](_0xfc4fe0,_0x980d('0x101'));}}}}else if(_0xfc4fe0['trunk_name']){_0x9c8734=_0xfc4fe0[_0x980d('0x102')];}else{return this['channel'][_0x980d('0x27')](_0xfc4fe0,'no\x20trunk\x20selected');}var _0x38b016=this[_0x980d('0xc')][_0x980d('0x4b')]('DIAL',[util[_0x980d('0x8b')]('SIP/%s/%s',_0x9c8734,_0xfc4fe0[_0x980d('0xb0')]),_0xfc4fe0[_0x980d('0x59')],_0xfc4fe0[_0x980d('0xd8')],_0xfc4fe0[_0x980d('0x56')]]);if(_0x38b016[_0x980d('0x99')]===-0x1){return _0x38b016;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xd9'),_0x980d('0xd6')));};AGIVertices[_0x980d('0x10')][_0x980d('0x103')]=function(_0x1c9eed){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c9eed[_0x980d('0x2c')]));return this['channel'][_0x980d('0x9e')](_0x980d('0x103'));};AGIVertices[_0x980d('0x10')][_0x980d('0xa')]=function(_0x40c88a){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x104'),_0x40c88a[_0x980d('0x2c')]));if(_0x40c88a[_0x980d('0x105')]===0x0){return this[_0x980d('0x93')](_0x40c88a);}_0x40c88a['retry']-=0x1;if(!this['isConfigured'](_0x40c88a['file_id'])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,'no\x20file\x20audio\x20selected');}var _0x2acfde=this['getSound']['sync'](this,_0x40c88a['file_id']);if(!_0x2acfde){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,_0x980d('0x106'));}if(!this[_0x980d('0x75')](_0x40c88a[_0x980d('0xc9')])){return this['channel'][_0x980d('0x27')](_0x980d('0xc8'));}var _0xf2e45=this[_0x980d('0xc')][_0x980d('0x107')](_0x2acfde,_0x40c88a[_0x980d('0x108')],_0x40c88a[_0x980d('0x109')]);var _0x539afc=_0xf2e45['result']?_0xf2e45[_0x980d('0x99')]['toString']():'';logger[_0x980d('0x23')](_0x980d('0x10a'),JSON['stringify'](_0xf2e45));if(_0xf2e45['result']===-0x1){this[_0x980d('0x2a')]['sync'](this,_0x40c88a,_0x539afc);return _0xf2e45;}else if(_0xf2e45[_0x980d('0x90')]===_0x980d('0x59')){_0xf2e45['result']=_0x539afc[_0x980d('0x88')]>=parseInt(_0x40c88a[_0x980d('0x10b')])?'x':'i';}else{_0xf2e45[_0x980d('0x99')]=_0x539afc[_0x980d('0x88')]>=parseInt(_0x40c88a[_0x980d('0x10b')])&&_0x539afc[_0x980d('0x88')]<=parseInt(_0x40c88a[_0x980d('0x109')])?'x':'i';}var _0x14e2e3=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x40c88a['variable_id']);if(!_0x14e2e3){return this[_0x980d('0xc')][_0x980d('0x27')](_0x40c88a,_0x980d('0xca'));}this[_0x980d('0xc')]['setVariable'](_0x14e2e3,_0x539afc);if(this[_0x980d('0x75')](_0x40c88a[_0x980d('0x10c')])){var _0x5a603d=parseInt(_0x40c88a[_0x980d('0x10c')],0xa);var _0x1dd664=rs[_0x980d('0x10d')]({'charset':'*','length':_0x5a603d});var _0x11e428=_0x539afc[_0x980d('0x88')];if(_0x11e428>0x0){if(_0x11e428>_0x5a603d){this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x40c88a,_0x40c88a[_0x980d('0x10e')]==='first'?_0x1dd664+_0x539afc[_0x980d('0x10f')](_0x5a603d):_0x539afc[_0x980d('0x10f')](0x0,_0x11e428-_0x5a603d)+_0x1dd664);}else{this[_0x980d('0x2a')]['sync'](this,_0x40c88a,rs[_0x980d('0x10d')]({'charset':'*','length':_0x11e428}));}}else{this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x40c88a,'');}}else{this[_0x980d('0x2a')]['sync'](this,_0x40c88a,_0x539afc);}return _0xf2e45;};AGIVertices[_0x980d('0x10')]['getsecretdigits']=function(_0x777136){logger['info'](util['format'](_0x980d('0x110'),_0x777136[_0x980d('0x2c')]));return this[_0x980d('0xa')](_0x777136);};AGIVertices['prototype'][_0x980d('0x111')]=function(_0x3e2fb5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x112'),_0x3e2fb5[_0x980d('0x2c')]));this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x3e2fb5,_0x3e2fb5[_0x980d('0x113')]);return this['channel']['noop'](util[_0x980d('0x8b')](_0x980d('0x114'),_0x3e2fb5[_0x980d('0x113')]));};AGIVertices[_0x980d('0x10')][_0x980d('0x115')]=function(_0x200f84){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x116'),_0x200f84[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x200f84['aws_access_key_id'])||!this['isConfigured'](_0x200f84['aws_secret_access_key'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x117'));}if(!this[_0x980d('0x75')](_0x200f84[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')]('no\x20text\x20configured');}this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0x118'),_0x200f84[_0x980d('0x4f')]));var _0x335cee=this[_0x980d('0x77')][_0x980d('0x94')](this,_0x200f84);if(_0x335cee){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')]('aws\x20Polly\x20%s\x20file\x20created',_0x335cee));var _0x27c8ca=this[_0x980d('0xc')][_0x980d('0x119')](_0x335cee);try{fs[_0x980d('0x11a')](_0x335cee+_0x980d('0xf7'));}catch(_0x17a8f8){logger[_0x980d('0x27')](_0x17a8f8);}return _0x27c8ca;}return this[_0x980d('0xc')]['error'](_0x200f84,_0x980d('0x11b'));};AGIVertices[_0x980d('0x10')][_0x980d('0x11c')]=function(_0x48422b){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x11d'),_0x48422b[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x48422b['aws_access_key_id'])||!this[_0x980d('0x75')](_0x48422b['aws_secret_access_key'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x117'));}if(!this[_0x980d('0x75')](_0x48422b[_0x980d('0x11e')])){return this['channel']['noop'](_0x980d('0x11f'));}if(!this[_0x980d('0x75')](_0x48422b[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0xdc')]=!![];this[_0x980d('0x2a')](_0x48422b);this[_0x980d('0x37')](_0x48422b[_0x980d('0x4f')],'in','','');this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x120'),_0x48422b['text']));var _0x5cb23e=this['awsLex']['sync'](this,_0x48422b);if(_0x5cb23e){for(var _0x86e1e5 in _0x5cb23e){if(_0x5cb23e[_0x980d('0x82')](_0x86e1e5)&&_[_0x980d('0x89')](_0x5cb23e[_0x86e1e5])){this['channel'][_0x980d('0x8d')](util[_0x980d('0x8b')](_0x980d('0x121'),_0x86e1e5[_0x980d('0x5d')]()),_0x5cb23e[_0x86e1e5]);}}if(_[_0x980d('0x3a')](_0x5cb23e[_0x980d('0x68')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x122'));}else{this['createSquareMessage'](_0x5cb23e[_0x980d('0x68')],_0x980d('0xdf'),_0x980d('0x123'),'');return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x124'),_0x5cb23e['message']));}}return this[_0x980d('0xc')]['error'](_0x48422b,_0x980d('0x125'));};AGIVertices['prototype'][_0x980d('0x126')]=function(_0x91ec0d){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x91ec0d[_0x980d('0x2c')],_0x91ec0d[_0x980d('0x59')]));if(!this[_0x980d('0x75')](_0x91ec0d[_0x980d('0x6c')])){return this[_0x980d('0xc')]['noop']('no\x20key\x20configured');}var _0x55af08=_0x980d('0x127');var _0x4f81a8=util[_0x980d('0x8b')]('%s/recordings/%s',FILES_PATH,rs[_0x980d('0x10d')](0x4));var _0x5be7bf=util['format'](_0x980d('0x8c'),_0x4f81a8,_0x55af08);var _0x490175=!![];if(_0x91ec0d['beep']===_0x980d('0x128')){_0x490175=![];}var _0xd45ad8=this[_0x980d('0xc')]['recordFile'](_0x4f81a8,_0x55af08,_0x91ec0d['intKey'],_0x91ec0d[_0x980d('0x59')],undefined,_0x490175);if(_0xd45ad8[_0x980d('0x99')]!==-0x1){this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x129'),_0x5be7bf));var _0x35bf0e=this['googleASR']['sync'](this,_0x91ec0d,_0x5be7bf);if(_0x35bf0e){for(var _0x477260 in _0x35bf0e){if(_0x35bf0e[_0x980d('0x82')](_0x477260)){this[_0x980d('0xc')]['setVariable'](util['format'](_0x980d('0x12a'),_0x477260[_0x980d('0x5d')]()),_0x35bf0e[_0x477260]);}}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x35bf0e)));}}return _0xd45ad8;};AGIVertices[_0x980d('0x10')][_0x980d('0x12b')]=function(_0x58fd17){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x12c'),_0x58fd17['label']));if(!this[_0x980d('0x75')](_0x58fd17[_0x980d('0x7e')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x12d'));}if(!this['isConfigured'](_0x58fd17[_0x980d('0x7f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x12e'));}var _0x113454=_0x980d('0x127');var _0xe1c7f4=util[_0x980d('0x8b')](_0x980d('0x12f'),FILES_PATH,rs[_0x980d('0x10d')](0x4));var _0x5e26d3=util['format'](_0x980d('0x8c'),_0xe1c7f4,_0x113454);var _0x2c6102=!![];if(_0x58fd17['beep']===_0x980d('0x128')){_0x2c6102=![];}var _0x4458be=this['channel'][_0x980d('0x130')](_0xe1c7f4,_0x113454,_0x58fd17[_0x980d('0x131')],_0x58fd17['timeout'],undefined,_0x2c6102);if(_0x4458be[_0x980d('0x99')]!==-0x1){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x132'),_0x5e26d3));var _0x32ab32=this[_0x980d('0x133')]['sync'](this,_0x58fd17,_0x5e26d3);if(_0x32ab32){for(var _0x53125c in _0x32ab32){if(_0x32ab32[_0x980d('0x82')](_0x53125c)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('TILDE_ASR_%s',_0x53125c[_0x980d('0x5d')]()),_0x32ab32[_0x53125c]);}}return this['channel']['noop'](util[_0x980d('0x8b')](_0x980d('0x134'),JSON['stringify'](_0x32ab32)));}}return _0x4458be;};AGIVertices[_0x980d('0x10')][_0x980d('0x135')]=function(_0x3512ee){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x136'),_0x3512ee['label']));return this[_0x980d('0xc')][_0x980d('0x137')](_0x3512ee[_0x980d('0x30')],_0x3512ee[_0x980d('0x31')],_0x3512ee[_0x980d('0x32')]);};AGIVertices[_0x980d('0x10')][_0x980d('0x138')]=function(_0x9d35e1){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x139'),_0x9d35e1[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x9d35e1[_0x980d('0x13a')])){return this['channel'][_0x980d('0x27')](_0x9d35e1,_0x980d('0x13b'));}try{var _0x45b6ae=eval(_0x9d35e1[_0x980d('0x13a')])?_0x980d('0x13c'):_0x980d('0x13d');this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x13e'),_0x9d35e1[_0x980d('0x13a')],_0x45b6ae));return{'code':0xc8,'result':_0x45b6ae};}catch(_0x4e5e9a){return{'code':0xc8,'result':_0x980d('0x13d')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x13f')]=function(_0x173538){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x140'),_0x173538[_0x980d('0x2c')]));if(!this['isConfigured'](_0x173538[_0x980d('0x141')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x173538,_0x980d('0x142'));}var _0x27066e=this['getIntervals']['sync'](this,_0x173538['interval_id']);if(!_0x27066e){return this[_0x980d('0xc')][_0x980d('0x27')](_0x173538,_0x980d('0x143'));}for(var _0x1d84a4=0x0;_0x1d84a4<_0x27066e[_0x980d('0x88')];_0x1d84a4+=0x1){var _0x335e4d=this[_0x980d('0xc')][_0x980d('0x8f')](util[_0x980d('0x8b')](_0x980d('0x144'),_0x27066e[_0x1d84a4]));if(_0x335e4d[_0x980d('0x99')]===-0x1){return _0x335e4d;}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x335e4d[_0x980d('0x90')]));if(_0x335e4d[_0x980d('0x90')]===_0x980d('0x13c')){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],'true'));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x980d('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x980d('0x23')](util['format']('IFTIME\x20%s\x20%s',_0x27066e[_0x1d84a4],'false'));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x145'),_0x27066e[_0x1d84a4],_0x980d('0x13d')));}}return{'code':0xc8,'result':_0x980d('0x13d')};};AGIVertices[_0x980d('0x10')][_0x980d('0x146')]=function(_0xf68b8c){logger[_0x980d('0x23')](util['format'](_0x980d('0x147'),_0xf68b8c[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x146')]();};AGIVertices['prototype'][_0x980d('0x148')]=function(_0x482ad5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x149'),_0x482ad5['label']));if(!this[_0x980d('0x75')](_0x482ad5['key'])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20key\x20configured');}var _0x217a8e=_0x980d('0x127');var _0x1aaf04=util['format'](_0x980d('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x57a7d3=util['format'](_0x980d('0x8c'),_0x1aaf04,_0x217a8e);var _0x451391=!![];if(_0x482ad5['beep']===_0x980d('0x128')){_0x451391=![];}var _0x480a98=this[_0x980d('0xc')]['recordFile'](_0x1aaf04,_0x217a8e,_0x482ad5[_0x980d('0x131')],_0x482ad5[_0x980d('0x59')],undefined,_0x451391);if(_0x480a98['result']!==-0x1){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x14a'),_0x57a7d3));var _0x1b79e1=this[_0x980d('0x74')][_0x980d('0x94')](this,_0x482ad5,_0x57a7d3);if(_0x1b79e1){for(var _0x4af843 in _0x1b79e1){if(_0x1b79e1[_0x980d('0x82')](_0x4af843)){this[_0x980d('0xc')][_0x980d('0x8d')](util[_0x980d('0x8b')]('ISPEECH_ASR_%s',_0x4af843[_0x980d('0x5d')]()),_0x1b79e1[_0x4af843]);}}return this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x14b'),JSON[_0x980d('0x66')](_0x1b79e1)));}}return _0x480a98;};AGIVertices[_0x980d('0x10')][_0x980d('0x14c')]=function(_0x4c156a){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4c156a[_0x980d('0x2c')]));if(!this['isConfigured'](_0x4c156a['key'])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x980d('0x75')](_0x4c156a[_0x980d('0x4f')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x14d'),_0x4c156a[_0x980d('0x4f')]));var _0x58fa54=this['ispeechTTS'][_0x980d('0x94')](this,_0x4c156a);if(_0x58fa54){this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0x14a'),_0x58fa54));var _0x51c6ae=this[_0x980d('0xc')][_0x980d('0x119')](_0x58fa54,_0x4c156a['intKey']);try{fs[_0x980d('0x11a')](_0x58fa54+_0x980d('0xf7'));}catch(_0x3c4964){logger[_0x980d('0x27')](_0x3c4964);}return _0x51c6ae;}return this[_0x980d('0xc')][_0x980d('0x27')](_0x4c156a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x980d('0x14e')]=function(_0x3c9dc5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x14f'),_0x3c9dc5[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3c9dc5[_0x980d('0x150')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3c9dc5,_0x980d('0x151'));}logger[_0x980d('0x23')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x980d('0xc')]['callerid'],_0x3c9dc5[_0x980d('0x150')]));var _0xa743ba=this[_0x980d('0x47')][_0x980d('0x94')](this,_0x3c9dc5[_0x980d('0x150')]);if(_0xa743ba){logger[_0x980d('0x23')](util['format'](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x3c9dc5['findBy']));this[_0x980d('0xc')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x980d('0xc')]['callerid'],_0x3c9dc5[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger['info'](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x980d('0x2d')],_0x3c9dc5[_0x980d('0x150')]));this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x3c9dc5[_0x980d('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x980d('0x10')][_0x980d('0x155')]=function(_0x1d1c63){logger[_0x980d('0x23')](util['format'](_0x980d('0x156'),_0x1d1c63[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1d1c63[_0x980d('0x150')])){return this['channel'][_0x980d('0x27')](_0x1d1c63,_0x980d('0x151'));}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this['channel'][_0x980d('0x2d')],_0x1d1c63[_0x980d('0x150')]));var _0x434620=this[_0x980d('0x46')][_0x980d('0x94')](this,_0x1d1c63[_0x980d('0x150')]);if(_0x434620){logger[_0x980d('0x23')](util['format'](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1d1c63['findBy']));this[_0x980d('0xc')][_0x980d('0x9e')](util['format'](_0x980d('0x152'),this['channel']['callerid'],_0x1d1c63[_0x980d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x1d1c63['findBy']));this[_0x980d('0xc')][_0x980d('0x9e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')][_0x980d('0x2d')],_0x1d1c63['findBy']));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x159')]=function(_0x2e86bf){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2e86bf['label']));if(!this[_0x980d('0x75')](_0x2e86bf[_0x980d('0x15a')])){return this[_0x980d('0xc')]['error'](_0x2e86bf,_0x980d('0x15b'));}this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')]('math\x20%s',_0x2e86bf[_0x980d('0x15a')]));var _0x245baf=eval(_0x2e86bf['operation']);if(!this[_0x980d('0x75')](_0x2e86bf[_0x980d('0xc9')])){return this[_0x980d('0xc')]['noop'](_0x980d('0xc8'));}var _0x5ec2dc=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x2e86bf[_0x980d('0xc9')]);if(!_0x5ec2dc){return this[_0x980d('0xc')][_0x980d('0x27')](_0x2e86bf,'no\x20variable\x20found');}if(_['isArray'](_0x245baf)){var _0x415230=this;_0x245baf['forEach'](function(_0x1ee38e,_0x5d70b4){_0x415230['channel']['setVariable'](util[_0x980d('0x8b')](_0x980d('0x15c'),_0x5ec2dc,_0x5d70b4),_0x1ee38e);});return this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x15d'),_0x5ec2dc));}else{return this['channel']['setVariable'](_0x5ec2dc,_0x245baf);}};AGIVertices[_0x980d('0x10')][_0x980d('0x15e')]=function(_0x208e7a){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x208e7a[_0x980d('0x2c')]));if(_0x208e7a[_0x980d('0x105')]===0x0){return this[_0x980d('0x93')](_0x208e7a);}_0x208e7a['retry']-=0x1;if(!this[_0x980d('0x75')](_0x208e7a[_0x980d('0x15f')])){return this['channel'][_0x980d('0x27')](_0x208e7a,'no\x20file\x20audio\x20selected');}var _0x1f7565=this['getSound'][_0x980d('0x94')](this,_0x208e7a[_0x980d('0x15f')]);if(!_0x1f7565){return this[_0x980d('0xc')][_0x980d('0x27')](_0x208e7a,'no\x20file\x20audio\x20found');}var _0x248987=this['channel']['getData'](_0x1f7565,_0x208e7a[_0x980d('0x108')],_0x208e7a[_0x980d('0x160')]);var _0x317c4e=_0x248987[_0x980d('0x99')];if(_0x248987[_0x980d('0x99')]===-0x1){this[_0x980d('0x2a')]['sync'](this,_0x208e7a,'-1');return _0x248987;}else if(_0x248987[_0x980d('0x90')]===_0x980d('0x59')){_0x248987[_0x980d('0x99')]=_0x248987['result'][_0x980d('0x88')]>0x0?_0x248987[_0x980d('0x99')]:'t';}else if(_[_0x980d('0x39')](_0x248987[_0x980d('0x99')])){_0x248987[_0x980d('0x99')]='#';_0x317c4e='#';}if(!this[_0x980d('0x75')](_0x208e7a[_0x980d('0xc9')])){this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x492342=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x208e7a[_0x980d('0xc9')]);if(!_0x492342){return this[_0x980d('0xc')]['error'](_0x208e7a,_0x980d('0xca'));}this[_0x980d('0xc')][_0x980d('0x8d')](_0x492342,_0x317c4e);}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x208e7a,_0x317c4e);return _0x248987;};AGIVertices['prototype'][_0x980d('0x9e')]=function(_0x34b109){logger[_0x980d('0x23')](util['format'](_0x980d('0x161'),_0x34b109[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x9e')](_0x34b109[_0x980d('0x162')]||_0x34b109[_0x980d('0x2c')]);};AGIVertices['prototype'][_0x980d('0x163')]=function(_0x1795d1){logger['info'](util[_0x980d('0x8b')](_0x980d('0x164'),_0x1795d1[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1795d1[_0x980d('0x150')])){return this['channel']['error'](_0x1795d1,'no\x20find\x20by\x20configured');}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1795d1[_0x980d('0x150')]));var _0x268b85=this[_0x980d('0x42')][_0x980d('0x94')](this,_0x1795d1['pause_id']);var _0x24a015=this[_0x980d('0x43')][_0x980d('0x94')](this,_0x1795d1[_0x980d('0x150')],_0x268b85);if(_0x24a015){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x1795d1[_0x980d('0x150')]));this['channel'][_0x980d('0x9e')](util['format'](_0x980d('0x152'),this['channel'][_0x980d('0x2d')],_0x1795d1['findBy']));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger['info'](util[_0x980d('0x8b')](_0x980d('0x154'),this['channel'][_0x980d('0x2d')],_0x1795d1['findBy']));this[_0x980d('0xc')]['noop'](util[_0x980d('0x8b')](_0x980d('0x152'),this['channel']['callerid'],_0x1795d1['findBy']));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x165')]=function(_0x3287ba){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x166'),_0x3287ba[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3287ba[_0x980d('0x15f')])){return this['channel']['error'](_0x3287ba,_0x980d('0x167'));}var _0x11908c=this[_0x980d('0x19')][_0x980d('0x94')](this,_0x3287ba[_0x980d('0x15f')]);if(!_0x11908c){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3287ba,'no\x20file\x20audio\x20found');}var _0x235f16=this[_0x980d('0xc')][_0x980d('0x4b')]('PLAYBACK',[_0x11908c,_0x3287ba[_0x980d('0xd8')]]);if(_0x235f16[_0x980d('0x99')]===-0x1){return _0x235f16;}return this[_0x980d('0xc')]['noop'](util['format'](_0x980d('0xb2'),_0x980d('0x168'),_0x11908c));};AGIVertices['prototype'][_0x980d('0x169')]=function(_0x2e2e87){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2e2e87['label']));if(!this['isConfigured'](_0x2e2e87[_0x980d('0x16a')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x2e2e87,_0x980d('0x16b'));}var _0x103d0f='';var _0x4cc0a4=parseInt(_0x2e2e87[_0x980d('0x16a')],0xa);if(isNaN(_0x4cc0a4)){_0x103d0f=_0x2e2e87['queue_id'];}else{_0x103d0f=this['getVoiceQueue'][_0x980d('0x94')](this,_0x2e2e87[_0x980d('0x16a')]);if(!_0x103d0f){return this[_0x980d('0xc')]['error'](_0x2e2e87,_0x980d('0x16c'));}}var _0x1fd879='';if(this[_0x980d('0x75')](_0x2e2e87[_0x980d('0x15f')])){var _0x44592e=this[_0x980d('0x19')][_0x980d('0x94')](this,_0x2e2e87['file_id']);if(_0x44592e){_0x1fd879=_0x44592e;}}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x2e2e87,_0x103d0f);if(_0x2e2e87[_0x980d('0xd8')][_0x980d('0x16d')]('x')<0x0){_0x2e2e87[_0x980d('0xd8')]+='x';}if(_0x2e2e87[_0x980d('0xd8')][_0x980d('0x16d')]('X')<0x0){_0x2e2e87[_0x980d('0xd8')]+='X';}this[_0x980d('0xc')][_0x980d('0x8d')](_0x980d('0x16e'),_0x103d0f?_0x103d0f[_0x980d('0x16f')]():'');var _0x2da996=this['channel']['exec'](_0x980d('0x170'),[_0x103d0f,_0x2e2e87[_0x980d('0xd8')],_0x2e2e87[_0x980d('0x56')],_0x1fd879,_0x2e2e87[_0x980d('0x59')],_0x2e2e87[_0x980d('0x7')],_0x2e2e87[_0x980d('0x171')],_0x2e2e87[_0x980d('0x172')],'',_0x2e2e87[_0x980d('0x173')]]);if(_0x2da996[_0x980d('0x99')]===-0x1){return _0x2da996;}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('Executed\x20command\x20%s\x20%s',_0x980d('0x170'),_0x103d0f));};AGIVertices['prototype'][_0x980d('0x174')]=function(_0x57be7d){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x57be7d[_0x980d('0x2c')]));var _0x11b4bc=_0x57be7d['recordingFormat']||'wav';var _0x5457e1=util[_0x980d('0x8b')]('%s_%s',this[_0x980d('0xc')][_0x980d('0x2b')],rs[_0x980d('0x10d')](0x5));var _0x28b405=util[_0x980d('0x8b')](_0x980d('0x175'),FILES_PATH,_0x5457e1,_0x11b4bc);var _0x53a24c=util[_0x980d('0x8b')]('%s/recordings/%s',FILES_PATH,_0x5457e1);this[_0x980d('0x2e')][_0x980d('0x94')](this,_0x57be7d,_0x5457e1,_0x28b405);this[_0x980d('0xc')][_0x980d('0x8d')](_0x980d('0x176'),_0x5457e1);logger[_0x980d('0x23')](_0x980d('0x177'),_0x53a24c,_0x11b4bc,_0x57be7d['escape_digits'],_0x57be7d[_0x980d('0x59')]);return this['channel']['recordFile'](_0x53a24c,_0x11b4bc,_0x57be7d[_0x980d('0x178')],_0x57be7d[_0x980d('0x59')],undefined,!![]);};AGIVertices[_0x980d('0x10')][_0x980d('0x179')]=function(_0x3be034){logger['info'](util['format'](_0x980d('0x17a'),_0x3be034[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x3be034[_0x980d('0x56')])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x17b'));}var _0x156796=this[_0x980d('0x55')][_0x980d('0x94')](this,_0x3be034);logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Response:',util[_0x980d('0x17c')](_0x156796,{'showHidden':![],'depth':null})));if(!this[_0x980d('0x75')](_0x3be034['variable_id'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x17d'));}var _0x5bd6ef=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x3be034[_0x980d('0xc9')]);if(!_0x5bd6ef){return this[_0x980d('0xc')][_0x980d('0x27')](_0x3be034,_0x980d('0xca'));}this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0x17e'),_0x5bd6ef),_0x156796['statusCode']?_0x156796[_0x980d('0x67')]:_0x980d('0x17f'));this[_0x980d('0xc')]['setVariable'](util[_0x980d('0x8b')](_0x980d('0x180'),_0x5bd6ef),_0x156796['statusMessage']?_0x156796[_0x980d('0x181')]:'OK');if(_0x156796[_0x980d('0x5e')]){try{this['saveRestApiResult'](_0x156796[_0x980d('0x5e')],_0x5bd6ef);}catch(_0x7e2985){logger[_0x980d('0x27')](util[_0x980d('0x8b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x5bd6ef));}}return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('variable\x20%s\x20set',_0x5bd6ef));};AGIVertices[_0x980d('0x10')][_0x980d('0x182')]=function(_0x2aa15f){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x183'),_0x2aa15f[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x184')](_0x2aa15f[_0x980d('0x185')][_0x980d('0x4d')](/\s+/g,''),_0x2aa15f[_0x980d('0x178')]);};AGIVertices[_0x980d('0x10')][_0x980d('0x186')]=function(_0x9fd885){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x187'),_0x9fd885[_0x980d('0x2c')]));return this[_0x980d('0xc')][_0x980d('0x188')](_0x9fd885['number'][_0x980d('0x4d')](/\s+/g,''),_0x9fd885['escape_digits']);};AGIVertices['prototype'][_0x980d('0x189')]=function(_0x581cc5){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x18a'),_0x581cc5['label']));return this[_0x980d('0xc')][_0x980d('0x18b')](_0x581cc5[_0x980d('0x4f')],_0x581cc5[_0x980d('0x178')]);};AGIVertices['prototype'][_0x980d('0x18c')]=function(_0x5e5b8c){logger['info'](util[_0x980d('0x8b')](_0x980d('0x18d'),_0x5e5b8c[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x5e5b8c['account_id'])){return this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x18e'));}var _0x2930d9=this[_0x980d('0x18f')][_0x980d('0x94')](this,_0x5e5b8c[_0x980d('0x190')]);if(!_0x2930d9||!_0x2930d9[_0x980d('0x191')]){return this[_0x980d('0xc')][_0x980d('0x27')](_0x5e5b8c,_0x980d('0x192'));}var _0x3a12d1={'from':util[_0x980d('0x8b')](_0x980d('0x193'),_0x2930d9[_0x980d('0x13')],_0x2930d9[_0x980d('0x194')]||_0x2930d9[_0x980d('0x191')][_0x980d('0x195')]),'to':_0x5e5b8c['to']||'','cc':_0x5e5b8c['cc']||'','bcc':_0x5e5b8c['bcc']||'','subject':_0x5e5b8c[_0x980d('0x196')],'html':_0x5e5b8c[_0x980d('0x4f')],'text':_0x5e5b8c['text']};if(this[_0x980d('0x75')](_0x5e5b8c[_0x980d('0x197')])){}logger[_0x980d('0xd1')](_0x980d('0x198'),JSON['stringify'](_0x3a12d1));this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x5e5b8c,_0x5e5b8c[_0x980d('0x190')]);this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x199'),_0x2930d9[_0x980d('0x13')]));this['sendMailMessage'][_0x980d('0x94')](this,_0x2930d9[_0x980d('0x19a')],_0x3a12d1);return this[_0x980d('0xc')][_0x980d('0x9e')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x980d('0x10')]['sendFax']=function(_0x57576c){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x57576c[_0x980d('0x2c')]));return this['channel'][_0x980d('0x9e')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x980d('0x10')][_0x980d('0x19b')]=function(_0xc4eb28){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xc4eb28[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0xc4eb28[_0x980d('0x19c')])){return this[_0x980d('0xc')][_0x980d('0x9e')]('no\x20sms\x20account\x20configured');}var _0x2829bc=this[_0x980d('0x19d')][_0x980d('0x94')](this,_0xc4eb28[_0x980d('0x19c')]);if(!_0x2829bc){return this[_0x980d('0xc')][_0x980d('0x27')](_0xc4eb28,_0x980d('0x19e'));}var _0x248a37={'body':_0xc4eb28[_0x980d('0x19f')],'phone':_0xc4eb28['to']||'','SmsAccountId':_0x2829bc['id']};logger[_0x980d('0xd1')](_0x980d('0x1a0'),JSON['stringify'](_0x248a37));this[_0x980d('0x2a')]['sync'](this,_0xc4eb28,_0xc4eb28['sms_account_id']);this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1a1'),_0x2829bc['name']));this[_0x980d('0x29')][_0x980d('0x94')](this,_0x248a37);return this[_0x980d('0xc')]['noop'](_0x980d('0x1a2'));};AGIVertices[_0x980d('0x10')][_0x980d('0x1a3')]=function(_0x246c33){logger['info'](util[_0x980d('0x8b')](_0x980d('0x1a4'),_0x246c33['label']));if(!this[_0x980d('0x75')](_0x246c33[_0x980d('0xc9')])){return this[_0x980d('0xc')][_0x980d('0x27')](_0x246c33,_0x980d('0x1a5'));}var _0x24a5ab=this[_0x980d('0x8f')]['sync'](this,_0x246c33[_0x980d('0xc9')]);if(!_0x24a5ab){return this['channel'][_0x980d('0x27')](_0x246c33,_0x980d('0xca'));}return this[_0x980d('0xc')][_0x980d('0x8d')](_0x24a5ab,_0x246c33[_0x980d('0x1a6')]);};AGIVertices[_0x980d('0x10')]['start']=function(_0x341c68){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x341c68[_0x980d('0x2c')]));this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x1a7'));var _0x49831e=this['channel'][_0x980d('0x8f')]('XMCS-UNIQUEID');if(!_[_0x980d('0x39')](_0x49831e[_0x980d('0x90')])){this[_0x980d('0xc')][_0x980d('0x2b')]=_0x49831e[_0x980d('0x90')];}if(_0x341c68['answer']===_0x980d('0x1a8')){this[_0x980d('0xc')][_0x980d('0x9e')](_0x980d('0x1a9'));return this[_0x980d('0xc')][_0x980d('0xaa')]();}return this['channel'][_0x980d('0x9e')](_0x980d('0x1aa'));};AGIVertices[_0x980d('0x10')][_0x980d('0x1ab')]=function(_0x434f9c){logger['info'](util[_0x980d('0x8b')](_0x980d('0x1ac'),_0x434f9c['label']));if(!this[_0x980d('0x75')](_0x434f9c[_0x980d('0x1ad')])){return this['channel'][_0x980d('0x27')](_0x434f9c,_0x980d('0x1ae'));}var _0x41b9f6=this[_0x980d('0x14')][_0x980d('0x94')](this,_0x434f9c['project_id']);if(!this[_0x980d('0x75')](_0x41b9f6)){return this['channel'][_0x980d('0x27')](_0x434f9c,util[_0x980d('0x8b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x434f9c[_0x980d('0x1ad')]));}if(_0x41b9f6===this['channel'][_0x980d('0x35')]){return this[_0x980d('0xc')][_0x980d('0x27')](_0x434f9c,_0x980d('0x1af'));}this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x434f9c,_0x41b9f6);var _0x23ddb9=this['channel']['exec'](_0x980d('0x1b0'),util['format'](_0x980d('0x1b1'),config[_0x980d('0x7')][_0x980d('0x1b2')]||_0x980d('0x1b3'),_0x41b9f6,this['channel'][_0x980d('0x35')]));if(_0x23ddb9[_0x980d('0x99')]===-0x1){return _0x23ddb9;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xb2'),'AGI',_0x41b9f6));};AGIVertices[_0x980d('0x10')][_0x980d('0x1b4')]=function(_0x402cae){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x1b5'),_0x402cae[_0x980d('0x2c')]));var _0x59b75a=this[_0x980d('0x4a')][_0x980d('0x94')](this,_0x402cae[_0x980d('0x1b6')]);this[_0x980d('0x2a')][_0x980d('0x94')](this,_0x402cae,_0x402cae[_0x980d('0x1b6')]);if(this['isConfigured'](_0x402cae[_0x980d('0xc9')])){var _0x4e011a=this['getVariable'][_0x980d('0x94')](this,_0x402cae[_0x980d('0xc9')]);if(_0x4e011a){this[_0x980d('0xc')][_0x980d('0x8d')](_0x4e011a,_0x59b75a);return this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1b7'),_0x402cae['command'],_0x4e011a));}}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1b8'),_0x402cae['command']));};AGIVertices[_0x980d('0x10')][_0x980d('0x1b9')]=function(_0xdf59e3){logger[_0x980d('0x23')](util['format'](_0x980d('0x1ba'),_0xdf59e3[_0x980d('0x2c')]));_0xdf59e3[_0x980d('0x4f')]=_0xdf59e3[_0x980d('0x4f')][_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xdf59e3[_0x980d('0x1bb')])){return this['channel'][_0x980d('0x9e')](_0x980d('0x1bc'));}if(!this[_0x980d('0x75')](_0xdf59e3[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1bd'),_0xdf59e3[_0x980d('0x4f')]));var _0x1a38a8=this[_0x980d('0x4e')][_0x980d('0x94')](this,_0xdf59e3);if(_0x1a38a8){this[_0x980d('0xc')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1a38a8));var _0x49d80e=this[_0x980d('0xc')][_0x980d('0x119')](_0x1a38a8);try{fs[_0x980d('0x11a')](_0x1a38a8+'.wav');}catch(_0x50f090){logger['error'](_0x50f090);}return _0x49d80e;}return this[_0x980d('0xc')][_0x980d('0x27')](_0xdf59e3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x980d('0x10')][_0x980d('0x1be')]=function(_0x1b458b){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1b458b[_0x980d('0x2c')]));_0x1b458b[_0x980d('0x4f')]=_0x1b458b[_0x980d('0x4f')][_0x980d('0x4d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x980d('0x75')](_0x1b458b[_0x980d('0x4f')])){return this[_0x980d('0xc')]['noop'](_0x980d('0x97'));}this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1bf'),_0x1b458b[_0x980d('0x4f')]));var _0x30a414=this['googleTTS']['sync'](this,_0x1b458b);if(_0x30a414){this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x1c0'),_0x30a414));var _0x3d986=this[_0x980d('0xc')][_0x980d('0x119')](_0x30a414);try{fs['unlink'](_0x30a414+_0x980d('0xf7'));}catch(_0x22114e){logger[_0x980d('0x27')](_0x22114e);}return _0x3d986;}return this[_0x980d('0xc')][_0x980d('0x27')](_0x1b458b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x980d('0x10')][_0x980d('0x1c1')]=function(_0x21595b){logger[_0x980d('0x23')](util[_0x980d('0x8b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x21595b['label']));if(!this[_0x980d('0x75')](_0x21595b[_0x980d('0x150')])){return this[_0x980d('0xc')]['error'](_0x21595b,_0x980d('0x151'));}logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x157'),this['channel'][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));var _0x468d37=this[_0x980d('0x45')][_0x980d('0x94')](this,_0x21595b[_0x980d('0x150')]);if(_0x468d37){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0x152'),this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x153')};}else{logger[_0x980d('0x23')](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')]['callerid'],_0x21595b[_0x980d('0x150')]));this['channel'][_0x980d('0x9e')](util[_0x980d('0x8b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x980d('0xc')][_0x980d('0x2d')],_0x21595b[_0x980d('0x150')]));return{'code':0xc8,'result':_0x980d('0x158')};}};AGIVertices[_0x980d('0x10')][_0x980d('0x1c2')]=function(_0xe982aa){logger[_0x980d('0x23')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xe982aa[_0x980d('0x2c')]));var _0x2e6a0c=this[_0x980d('0xc')][_0x980d('0x4b')](_0x980d('0x1c3'),[_0xe982aa[_0x980d('0x1c4')],_0xe982aa[_0x980d('0x6a')]]);if(_0x2e6a0c[_0x980d('0x99')]===-0x1){return _0x2e6a0c;}return this[_0x980d('0xc')][_0x980d('0x9e')](util[_0x980d('0x8b')](_0x980d('0xb2'),_0x980d('0x1c3'),_0xe982aa[_0x980d('0x1c4')]));};AGIVertices[_0x980d('0x10')][_0x980d('0x1c5')]=function(_0x1c4c39){logger[_0x980d('0x23')](util[_0x980d('0x8b')](_0x980d('0x1c6'),_0x1c4c39[_0x980d('0x2c')]));if(!this[_0x980d('0x75')](_0x1c4c39[_0x980d('0xc9')])){return this[_0x980d('0xc')]['error'](_0x1c4c39,_0x980d('0x1a5'));}var _0x16cce7=this[_0x980d('0x8f')][_0x980d('0x94')](this,_0x1c4c39[_0x980d('0xc9')]);if(!_0x16cce7){return this[_0x980d('0xc')][_0x980d('0x27')](_0x1c4c39,_0x980d('0xca'));}var _0x169890=this[_0x980d('0xc')][_0x980d('0x8f')](_0x16cce7);return{'code':0xc8,'result':_0x169890[_0x980d('0x90')]?_0x169890[_0x980d('0x90')]:'-'};};String['prototype'][_0x980d('0x8e')]=function(_0x17f718,_0xa49c57){return this[_0x980d('0x1c7')](_0x17f718)[_0x980d('0x1c8')](_0xa49c57);};module[_0x980d('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x9b67=['Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','toLowerCase','macro','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','template_id','account_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','prototype','getVariable','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','callback_','random','isEmpty','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agent','agentPause','error','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr'];(function(_0x312cd8,_0x426245){var _0x137254=function(_0x3affd3){while(--_0x3affd3){_0x312cd8['push'](_0x312cd8['shift']());}};_0x137254(++_0x426245);}(_0x9b67,0xf6));var _0x79b6=function(_0x28b481,_0x22707c){_0x28b481=_0x28b481-0x0;var _0x221fa7=_0x9b67[_0x28b481];return _0x221fa7;};'use strict';var fs=require('fs');var util=require(_0x79b6('0x0'));var _=require(_0x79b6('0x1'));var sh=require(_0x79b6('0x2'));var odbc=require(_0x79b6('0x3'))();var rs=require(_0x79b6('0x4'));var moment=require('moment');var Mustache=require(_0x79b6('0x5'));var rp=require(_0x79b6('0x6'));var logger=require('../../config/logger')('agi');var config=require(_0x79b6('0x7'));var scripts=require(_0x79b6('0x8'));var FILES_PATH=_0x79b6('0x9');var recursiveMapAttributes=[_0x79b6('0xa'),_0x79b6('0xb')];var verticesWithRetry=[_0x79b6('0xc'),_0x79b6('0xd'),'getsecretdigits'];var AGIVertices=function(_0x1270a7,_0x107e4b,_0x233d31){this[_0x79b6('0xe')]=_0x1270a7;this[_0x79b6('0xf')]=_0x107e4b;this['mailRpc']=_0x233d31;};AGIVertices[_0x79b6('0x10')][_0x79b6('0x11')]=function(_0x3f3b44,_0x301f13){this['rpc']['getVariableById'](_0x3f3b44)[_0x79b6('0x12')](function(_0xa752f1){_0x301f13(null,_0xa752f1?_0xa752f1[_0x79b6('0x13')]:![]);})['catch'](function(_0xc05a77){_0x301f13(_0xc05a77);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x14')]=function(_0x70886c,_0x3b0721){this[_0x79b6('0xf')][_0x79b6('0x15')](_0x70886c)[_0x79b6('0x12')](function(_0x441d81){_0x3b0721(null,_0x441d81?_0x441d81[_0x79b6('0x13')]:![]);})[_0x79b6('0x16')](function(_0x3563cc){_0x3b0721(_0x3563cc);});};AGIVertices[_0x79b6('0x10')]['getSquareProject']=function(_0x207bcc,_0x2a75d5){this[_0x79b6('0xf')][_0x79b6('0x17')](_0x207bcc)[_0x79b6('0x12')](function(_0x3a6a64){_0x2a75d5(null,_0x3a6a64?_0x3a6a64[_0x79b6('0x13')]:![]);})[_0x79b6('0x16')](function(_0x3ff583){_0x2a75d5(_0x3ff583);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x18')]=function(_0xa1a29a,_0x1361f6){this['rpc'][_0x79b6('0x19')](_0xa1a29a)['then'](function(_0x22a9eb){_0x1361f6(null,_0x22a9eb?_0x22a9eb['dsn']:![]);})[_0x79b6('0x16')](function(_0xa34c2a){_0x1361f6(_0xa34c2a);});};AGIVertices[_0x79b6('0x10')]['getUser']=function(_0x46304b,_0x30dc0b){this['rpc']['getUserById'](_0x46304b)[_0x79b6('0x12')](function(_0x2e2948){_0x30dc0b(null,_0x2e2948?_0x2e2948[_0x79b6('0x13')]:![]);})[_0x79b6('0x16')](function(_0x3b2a2a){_0x30dc0b(_0x3b2a2a);});};AGIVertices['prototype'][_0x79b6('0x1a')]=function(_0x280e04,_0x17eff4){this[_0x79b6('0xf')]['getTrunkById'](_0x280e04)['then'](function(_0x40ef76){_0x17eff4(null,_0x40ef76?_0x40ef76[_0x79b6('0x13')]:![]);})[_0x79b6('0x16')](function(_0xc25c99){_0x17eff4(_0xc25c99);});};AGIVertices['prototype'][_0x79b6('0x1b')]=function(_0x52574b,_0x400542){var _0x2fd9b5=this;this[_0x79b6('0xf')][_0x79b6('0x1c')](_0x52574b)['then'](function(_0x1484e5){_0x400542(null,_0x1484e5?_0x2fd9b5[_0x79b6('0x1d')](_0x1484e5['save_name']):![]);})[_0x79b6('0x16')](function(_0x2d219c){_0x400542(_0x2d219c);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x1e')]=function(_0x176acb,_0x4716e1){this['rpc'][_0x79b6('0x1f')](_0x176acb)[_0x79b6('0x12')](function(_0x27f680){_0x4716e1(null,_0x27f680?_0x27f680:![]);})[_0x79b6('0x16')](function(_0x135a13){_0x4716e1(_0x135a13);});};AGIVertices[_0x79b6('0x10')]['sendMailMessage']=function(_0x6d14bd,_0x10408a,_0x34c1fd){this['mailRpc']['sendMailMessage'](_0x6d14bd,_0x10408a)[_0x79b6('0x12')](function(){_0x34c1fd(null);})[_0x79b6('0x16')](function(_0xb50811){_0x34c1fd(_0xb50811);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x20')]=function(_0x31ebd9,_0x5f4b90){this['rpc'][_0x79b6('0x21')](_0x31ebd9)['then'](function(_0xe7a4d){if(_0xe7a4d){if(_0xe7a4d['IntervalId']){_0x5f4b90(null,[_0xe7a4d[_0x79b6('0x22')]]);}else{_0x5f4b90(null,_[_0x79b6('0x23')](_0xe7a4d['Intervals'],_0x79b6('0x22')));}}else{_0x5f4b90(null,![]);}})[_0x79b6('0x16')](function(_0x507d7b){_0x5f4b90(_0x507d7b);});};AGIVertices[_0x79b6('0x10')]['getSoundPath']=function(_0x26e99d){return util[_0x79b6('0x24')](_0x79b6('0x25'),FILES_PATH,_0x26e99d);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x26')]=function(_0x732849,_0x4189f2,_0x276eb5){odbc[_0x79b6('0x27')](_0x732849,function(_0x390391){if(_0x390391){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x390391);_0x276eb5(_0x390391);}else{logger['info'](_0x79b6('0x28'));odbc[_0x79b6('0x29')](_0x4189f2,function(_0x48faba,_0x172cc4){if(_0x48faba){logger['info'](_0x79b6('0x2a'),_0x4189f2);_0x276eb5(_0x48faba);}else{logger[_0x79b6('0x2b')](_0x79b6('0x2c'),_0x4189f2);odbc['close'](function(_0x601bb8){if(_0x601bb8){logger['error'](_0x79b6('0x2d'),_0x601bb8);}_0x276eb5(null,_0x172cc4);});}});}});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x2e')]=function(_0x2feeeb,_0x1cb2a6){this['rpc']['getSmsAccountById'](_0x2feeeb)[_0x79b6('0x12')](function(_0x48ae49){_0x1cb2a6(null,_0x48ae49?_0x48ae49:![]);})[_0x79b6('0x16')](function(_0x3149a8){_0x1cb2a6(_0x3149a8);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x2f')]=function(_0x24dab1,_0x376eb2){this[_0x79b6('0xf')]['createSmsMessage'](_0x24dab1)[_0x79b6('0x12')](function(_0x321adb){_0x376eb2(null,_0x321adb);})[_0x79b6('0x16')](function(_0x3002cf){_0x376eb2(_0x3002cf);});};AGIVertices['prototype'][_0x79b6('0x30')]=function(_0x4f803c,_0x4ba212,_0x22025a){this[_0x79b6('0xf')][_0x79b6('0x30')]({'uniqueid':this[_0x79b6('0xe')][_0x79b6('0x31')],'node':_0x4f803c[_0x79b6('0x32')],'application':_0x4f803c[_0x79b6('0x33')],'data':_0x4ba212||null,'project_name':this[_0x79b6('0xe')]['arg_1'],'callerid':this[_0x79b6('0xe')]['callerid']})['then'](function(_0x3754fa){if(_0x22025a){_0x22025a(null,_0x3754fa);}})[_0x79b6('0x16')](function(_0x402c86){if(_0x22025a){_0x22025a(_0x402c86);}});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x34')]=function(_0x39ec22,_0x2b9b30,_0x3087e4,_0x18b9f4){this['rpc'][_0x79b6('0x34')]({'uniqueid':this[_0x79b6('0xe')][_0x79b6('0x31')],'callerid':this[_0x79b6('0xe')][_0x79b6('0x35')],'calleridname':this['channel'][_0x79b6('0x36')],'context':this[_0x79b6('0xe')]['context'],'extension':this['channel'][_0x79b6('0x37')],'priority':this[_0x79b6('0xe')][_0x79b6('0x38')],'accountcode':this[_0x79b6('0xe')][_0x79b6('0x39')],'dnid':this[_0x79b6('0xe')][_0x79b6('0x3a')],'projectName':this[_0x79b6('0xe')][_0x79b6('0x3b')],'saveName':_0x2b9b30,'filename':_0x39ec22[_0x79b6('0x3c')]||_0x2b9b30,'savePath':_0x3087e4})[_0x79b6('0x12')](function(_0x39972b){_0x18b9f4(null,_0x39972b);})[_0x79b6('0x16')](function(_0xb65951){_0x18b9f4(_0xb65951);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x3d')]=function(_0x26ab29,_0x14fa5c,_0x29216c,_0x4c8d98,_0x5d923b){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x79b6('0x31')],'body':_0x26ab29,'direction':_0x14fa5c,'providerName':_0x29216c,'providerResponse':_0x4c8d98})[_0x79b6('0x12')](function(_0x23d4eb){if(_0x5d923b){_0x5d923b(null,_0x23d4eb);}})[_0x79b6('0x16')](function(_0xab8a4c){if(_0x5d923b){_0x5d923b(_0xab8a4c);}});};AGIVertices[_0x79b6('0x10')]['createCmContact']=function(_0x1af281,_0xa2ba0e){this['rpc'][_0x79b6('0x3e')]({'firstName':_['isEmpty'](_0x1af281[_0x79b6('0x13')])||_['isNil'](_0x1af281['name'])?_0x79b6('0x3f')+Math[_0x79b6('0x40')]():_0x1af281[_0x79b6('0x13')],'lastName':_[_0x79b6('0x41')](_0x1af281[_0x79b6('0x42')])||_[_0x79b6('0x43')](_0x1af281['lastName'])?null:_0x1af281['lastName'],'phone':_0x1af281[_0x79b6('0x44')],'ListId':_0x1af281[_0x79b6('0x45')],'scheduledat':_0x1af281['scheduledAt'],'callbackUniqueid':this[_0x79b6('0xe')][_0x79b6('0x31')],'tags':_0x79b6('0x46'),'description':_0x79b6('0x47')+_0x1af281[_0x79b6('0x48')][_0x79b6('0x49')](),'priority':_0x1af281[_0x79b6('0x4a')]})['then'](function(_0x10ed1c){_0xa2ba0e(null,_0x10ed1c);})[_0x79b6('0x16')](function(_0x56385e){_0xa2ba0e(_0x56385e);});};AGIVertices[_0x79b6('0x10')]['getPause']=function(_0x2ea535,_0x493dae){this['rpc'][_0x79b6('0x4b')](_0x2ea535)[_0x79b6('0x12')](function(_0x3cf2b7){_0x493dae(null,_0x3cf2b7?_0x3cf2b7[_0x79b6('0x13')]:![]);})[_0x79b6('0x16')](function(_0x357517){_0x493dae(_0x357517);});};AGIVertices[_0x79b6('0x10')]['agentPause']=function(_0x537a02,_0x450aca,_0x3d959e){var _0x1c5765={'role':_0x79b6('0x4c')};_0x1c5765[_0x537a02]=this[_0x79b6('0xe')][_0x79b6('0x35')];this[_0x79b6('0xf')][_0x79b6('0x4d')](_0x1c5765,_0x450aca,this[_0x79b6('0xe')][_0x79b6('0x31')])[_0x79b6('0x12')](function(_0x12a480){_0x3d959e(null,_['isNil'](_0x12a480)?![]:!![]);})[_0x79b6('0x16')](function(_0x3e5e2d){logger[_0x79b6('0x4e')](_0x3e5e2d);_0x3d959e(null,![]);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x4f')]=function(_0x20971a,_0x4d8411){var _0x3a4765={'role':_0x79b6('0x4c')};_0x3a4765[_0x20971a]=this[_0x79b6('0xe')][_0x79b6('0x35')];this[_0x79b6('0xf')][_0x79b6('0x4f')](_0x3a4765)[_0x79b6('0x12')](function(_0x13e0b6){_0x4d8411(null,_['isNil'](_0x13e0b6)?![]:!![]);})[_0x79b6('0x16')](function(_0x297329){logger[_0x79b6('0x4e')](_0x297329);_0x4d8411(null,![]);});};AGIVertices[_0x79b6('0x10')]['agentLogout']=function(_0x5ad128,_0x3ec2ce){var _0x4bcd15={'role':_0x79b6('0x4c')};_0x4bcd15[_0x5ad128]=this['channel']['callerid'];this[_0x79b6('0xf')][_0x79b6('0x50')](_0x4bcd15)[_0x79b6('0x12')](function(_0x363cef){_0x3ec2ce(null,_[_0x79b6('0x43')](_0x363cef)?![]:!![]);})[_0x79b6('0x16')](function(_0x5e2f80){logger[_0x79b6('0x4e')](_0x5e2f80);_0x3ec2ce(null,![]);});};AGIVertices['prototype'][_0x79b6('0x51')]=function(_0x49efed,_0x24e771){var _0x3338b2={'role':_0x79b6('0x4c')};_0x3338b2[_0x49efed]=this[_0x79b6('0xe')][_0x79b6('0x35')];var _0x14c9a8=_0x49efed!='internal'?util['format'](_0x79b6('0x52'),_0x79b6('0x53'),this[_0x79b6('0xe')][_0x79b6('0x35')]):undefined;this[_0x79b6('0xf')][_0x79b6('0x51')](_0x3338b2,_0x14c9a8)['then'](function(_0x24389c){_0x24e771(null,_['isNil'](_0x24389c)?![]:!![]);})[_0x79b6('0x16')](function(_0x5955f4){logger[_0x79b6('0x4e')](_0x5955f4);_0x24e771(null,![]);});};AGIVertices['prototype'][_0x79b6('0x54')]=function(_0x5c5a2a,_0x11a63f){sh['exec'](_[_0x79b6('0x55')](_0x5c5a2a),function(_0x1bb70d,_0x1e831b){var _0x64d285=_0x1e831b['replace'](/(\r\n|\n|\r)/gm,'');_0x11a63f(null,_0x64d285);});};AGIVertices['prototype'][_0x79b6('0x56')]=function(_0xb099dd,_0x360e41){scripts[_0x79b6('0x56')](_0xb099dd[_0x79b6('0x57')],_0xb099dd[_0x79b6('0x58')]||_0x79b6('0x59'),_0xb099dd[_0x79b6('0x59')],_0xb099dd[_0x79b6('0x5a')]||'en-US',_0xb099dd['ssmlGender']||_0x79b6('0x5b'),_0xb099dd[_0x79b6('0x5c')]||_0x79b6('0x5d'))[_0x79b6('0x12')](function(_0x2b1af6){_0x360e41(null,_0x2b1af6);})[_0x79b6('0x16')](function(_0x4adb22){_0x360e41(_0x4adb22);});};AGIVertices['prototype'][_0x79b6('0x5e')]=function(_0x1ed28d,_0x275fdf){scripts[_0x79b6('0x5e')](_0x1ed28d[_0x79b6('0x59')],_0x1ed28d['google_tts_language']||'en',0x1)[_0x79b6('0x12')](function(_0xbdca9f){_0x275fdf(null,_0xbdca9f);})[_0x79b6('0x16')](function(_0x2e050f){_0x275fdf(_0x2e050f);});};AGIVertices[_0x79b6('0x10')]['restAPI']=function(_0x53cd7c,_0xea2306){var _0x9cbdd={'uri':_0x53cd7c[_0x79b6('0x5f')],'method':_0x53cd7c[_0x79b6('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x53cd7c[_0x79b6('0x61')])===_0x79b6('0x62')&&parseInt(_0x53cd7c['timeout'])>=0x1?parseInt(_0x53cd7c[_0x79b6('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x79b6('0x63')]([_0x79b6('0x64'),'PUT'],_0x9cbdd['method']['toUpperCase']())){try{_0x9cbdd[_0x79b6('0x65')]=_0x53cd7c[_0x79b6('0xb')]?JSON[_0x79b6('0x66')](_0x53cd7c[_0x79b6('0xb')]):{};}catch(_0x51d7f3){logger['error'](_0x79b6('0x67'),_0x51d7f3);}}try{_0x9cbdd[_0x79b6('0x68')]=_0x53cd7c[_0x79b6('0xa')]?JSON['parse'](_0x53cd7c[_0x79b6('0xa')]):{};}catch(_0x33346c){logger[_0x79b6('0x4e')](_0x79b6('0x69'),_0x33346c);}if(_0x53cd7c[_0x79b6('0x6a')]){try{var _0x155d9f=require(_0x53cd7c[_0x79b6('0x6a')])[_0x79b6('0x6b')](this,_0x9cbdd);_0x9cbdd[_0x79b6('0x6c')]=Mustache[_0x79b6('0x6d')](_0x53cd7c[_0x79b6('0x5f')],_0x155d9f,{},['$$','$$']);if(_0x9cbdd[_0x79b6('0x68')]){_0x9cbdd['headers']=JSON[_0x79b6('0x66')](Mustache[_0x79b6('0x6d')](JSON[_0x79b6('0x6e')](_0x9cbdd[_0x79b6('0x68')]),_0x155d9f,{},['$$','$$']));}if(_0x9cbdd[_0x79b6('0x65')]){_0x9cbdd['body']=JSON[_0x79b6('0x66')](Mustache[_0x79b6('0x6d')](JSON['stringify'](_0x9cbdd[_0x79b6('0x65')]),_0x155d9f,{},['$$','$$']));}}catch(_0x1da213){logger[_0x79b6('0x4e')](_0x79b6('0x6f'),_0x1da213);}}rp(_0x9cbdd)[_0x79b6('0x12')](function(_0xb49008){var _0x417de3={'statusCode':_0xb49008[_0x79b6('0x70')]||0xc8,'statusMessage':_0xb49008['statusMessage']||'OK','headers':_0xb49008[_0x79b6('0x68')]||{},'body':_0xb49008[_0x79b6('0x65')]||{}};_0xea2306(null,_0x417de3);})[_0x79b6('0x16')](function(_0x2584cb){var _0x1bff53={'statusCode':_0x2584cb['statusCode']||0x1f4,'statusMessage':_0x2584cb[_0x79b6('0x71')]||_0x79b6('0x72'),'headers':_0x2584cb[_0x79b6('0x73')][_0x79b6('0x68')]||{},'body':_0x2584cb[_0x79b6('0x73')][_0x79b6('0x65')]||{}};_0xea2306(null,_0x1bff53);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x74')]=function(_0x4221c8,_0x423210){scripts['googleDialogflow'](this['channel'][_0x79b6('0x31')],_0x4221c8[_0x79b6('0x75')],_0x4221c8[_0x79b6('0x59')],_0x4221c8[_0x79b6('0x76')]||'en')[_0x79b6('0x12')](function(_0x98a757){_0x423210(null,_0x98a757);})['catch'](function(_0x22631a){_0x423210(_0x22631a);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x77')]=function(_0x538880,_0x2b01ab){scripts['googleDialogflowV2'](this[_0x79b6('0xe')]['uniqueid'],_0x538880[_0x79b6('0x78')],_0x538880[_0x79b6('0x79')],_0x538880[_0x79b6('0x7a')],_0x538880[_0x79b6('0x59')],_0x538880[_0x79b6('0x7b')]||'en')[_0x79b6('0x12')](function(_0x26b977){_0x2b01ab(null,_0x26b977);})['catch'](function(_0x2200f9){_0x2b01ab(_0x2200f9);});};AGIVertices[_0x79b6('0x10')]['sestekNDA']=function(_0x4444a5,_0x391759){scripts['sestekNDA'](this[_0x79b6('0xe')],_0x4444a5)['then'](function(_0x2f2cf8){_0x391759(null,_0x2f2cf8);})[_0x79b6('0x16')](function(_0x364e14){_0x391759(_0x364e14);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x7c')]=function(_0x2ffba0,_0x2dadc7){scripts[_0x79b6('0x7c')](_0x2ffba0['key'],_0x2ffba0[_0x79b6('0x59')],_0x2ffba0['ispeech_tts_language']||'en-US',_0x2ffba0['speed'])[_0x79b6('0x12')](function(_0x3bee96){_0x2dadc7(null,_0x3bee96);})[_0x79b6('0x16')](function(_0x37af0e){_0x2dadc7(_0x37af0e);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x7d')]=function(_0x583ac5,_0x4ba437,_0x3d7e90){scripts[_0x79b6('0x7d')](_0x4ba437,_0x583ac5[_0x79b6('0x75')],_0x583ac5[_0x79b6('0x7e')]||'en-US',this[_0x79b6('0x7f')](_0x583ac5[_0x79b6('0x80')])?_0x583ac5['model']:undefined)[_0x79b6('0x12')](function(_0x36ebb4){_0x3d7e90(null,_0x36ebb4);})['catch'](function(_0x320bd6){_0x3d7e90(_0x320bd6);});};AGIVertices['prototype'][_0x79b6('0x81')]=function(_0x1b2e71,_0x2b16ca){scripts[_0x79b6('0x81')](_0x1b2e71[_0x79b6('0x82')],_0x1b2e71['aws_secret_access_key'],_0x1b2e71['aws_polly_region'],_0x1b2e71[_0x79b6('0x83')]||_0x79b6('0x84'),_0x1b2e71[_0x79b6('0x59')],_0x1b2e71[_0x79b6('0x85')]||'text')[_0x79b6('0x12')](function(_0x7f714f){_0x2b16ca(null,_0x7f714f);})[_0x79b6('0x16')](function(_0x5fae65){_0x2b16ca(_0x5fae65);});};AGIVertices['prototype'][_0x79b6('0x86')]=function(_0x102c78,_0x5c90a6){scripts['awsLex'](this[_0x79b6('0xe')][_0x79b6('0x31')],_0x102c78[_0x79b6('0x82')],_0x102c78['aws_secret_access_key'],_0x102c78[_0x79b6('0x87')],_0x102c78[_0x79b6('0x59')],_0x102c78[_0x79b6('0x88')])['then'](function(_0x2eb181){_0x5c90a6(null,_0x2eb181);})[_0x79b6('0x16')](function(_0x5dabac){_0x5c90a6(_0x5dabac);});};AGIVertices[_0x79b6('0x10')]['googleASR']=function(_0x188cff,_0x4840da,_0x48542d){scripts[_0x79b6('0x89')](_0x4840da,_0x188cff[_0x79b6('0x75')],_0x188cff[_0x79b6('0x8a')]||'en-US')[_0x79b6('0x12')](function(_0x477497){_0x48542d(null,_0x477497);})[_0x79b6('0x16')](function(_0x4e303f){_0x48542d(_0x4e303f);});};AGIVertices['prototype'][_0x79b6('0x8b')]=function(_0x51605f,_0x416887,_0x5a511c){scripts[_0x79b6('0x8b')](_0x416887,_0x51605f[_0x79b6('0x8c')],_0x51605f[_0x79b6('0x8d')],_0x51605f['uri'])[_0x79b6('0x12')](function(_0xb503a4){_0x5a511c(null,_0xb503a4);})[_0x79b6('0x16')](function(_0xdf0101){_0x5a511c(_0xdf0101);});};AGIVertices[_0x79b6('0x10')][_0x79b6('0x8e')]=function(_0x2e801d){var _0x526fba=_[_0x79b6('0x63')](verticesWithRetry,_0x2e801d[_0x79b6('0x33')])?_0x2e801d:_['clone'](_0x2e801d);for(var _0x4b0cb5 in _0x526fba){if(_0x526fba[_0x79b6('0x8f')](_0x4b0cb5)){if(_0x526fba[_0x4b0cb5]&&_[_0x79b6('0x90')](_0x526fba[_0x4b0cb5])){if(_[_0x79b6('0x63')](recursiveMapAttributes,_0x4b0cb5)){_0x526fba[_0x4b0cb5]=this['replaceObjectAllVariables'](_0x526fba[_0x4b0cb5]);}else{_0x526fba[_0x4b0cb5]=this['replaceAllVariables'](_0x526fba[_0x4b0cb5]);}}}}return _0x526fba;};AGIVertices[_0x79b6('0x10')][_0x79b6('0x91')]=function(_0x4ad096){for(var _0x37647f in _0x4ad096){if(_0x4ad096[_0x79b6('0x8f')](_0x37647f)){if(_[_0x79b6('0x92')](_0x4ad096[_0x37647f])){this[_0x79b6('0x91')](_0x4ad096[_0x37647f]);}else if(_['isArray'](_0x4ad096[_0x37647f])){for(var _0x5cbc32=0x0;_0x5cbc32<_0x4ad096[_0x37647f][_0x79b6('0x93')];_0x5cbc32++){this[_0x79b6('0x91')](_0x4ad096[_0x37647f][_0x5cbc32]);}}else if(_[_0x79b6('0x90')](_0x4ad096[_0x37647f])){_0x4ad096[_0x37647f]=this[_0x79b6('0x94')](_0x4ad096[_0x37647f]);}}}};AGIVertices[_0x79b6('0x10')][_0x79b6('0x95')]=function(_0xa4acf7,_0x584391){for(var _0x473bbe in _0xa4acf7){if(_0xa4acf7['hasOwnProperty'](_0x473bbe)){if(_[_0x79b6('0x92')](_0xa4acf7[_0x473bbe])){if(!_['isEmpty'](_0xa4acf7[_0x473bbe])){this['saveRestApiResult'](_0xa4acf7[_0x473bbe],util['format'](_0x79b6('0x96'),_0x584391,_0x473bbe));}}else if(_[_0x79b6('0x97')](_0xa4acf7[_0x473bbe])){for(var _0x370ae3=0x0;_0x370ae3<_0xa4acf7[_0x473bbe][_0x79b6('0x93')];_0x370ae3++){this[_0x79b6('0x95')](_0xa4acf7[_0x473bbe][_0x370ae3],util[_0x79b6('0x24')](_0x79b6('0x96'),_0x584391,_0x473bbe+'['+_0x370ae3+']'));}}else{if(!_[_0x79b6('0x43')](_0xa4acf7[_0x473bbe])){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')]('%s.%s',_0x584391,_0x473bbe),_0xa4acf7[_0x473bbe]);}}}}};AGIVertices[_0x79b6('0x10')][_0x79b6('0x99')]=function(_0x5d55bb){try{var _0x343387=JSON[_0x79b6('0x66')](_0x5d55bb);this[_0x79b6('0x91')](_0x343387);return JSON[_0x79b6('0x6e')](_0x343387);}catch(_0x3cfd5c){return this[_0x79b6('0x94')](_0x5d55bb);}};AGIVertices['prototype'][_0x79b6('0x94')]=function(_0x1d2c94){var _0x2e490d=_0x1d2c94[_0x79b6('0x9a')]('{');for(var _0x5911c9=0x1;_0x5911c9<_0x2e490d[_0x79b6('0x93')];_0x5911c9+=0x1){var _0x23be0d=_0x2e490d[_0x5911c9][_0x79b6('0x9a')]('}');if(_0x23be0d['length']>0x1){_0x1d2c94=_0x1d2c94[_0x79b6('0x9b')]('{'+_0x23be0d[0x0]+'}',this[_0x79b6('0xe')][_0x79b6('0x11')](_0x23be0d[0x0])[_0x79b6('0x9c')]||_0x23be0d[0x0]);}}if(_0x2e490d[_0x79b6('0x93')]===0x1){return _0x1d2c94[_0x79b6('0x49')]();}return this['replaceAllVariables'](_0x1d2c94);};AGIVertices['prototype']['getAndSetVariable']=function(_0x4547e9,_0x34858c){var _0x19cf8b=this[_0x79b6('0xe')]['getVariable'](_0x4547e9);if(_0x19cf8b[_0x79b6('0x9d')]===-0x1){return _0x19cf8b;}logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x9e'),_0x34858c,_0x19cf8b['extra']));return this[_0x79b6('0xe')][_0x79b6('0x98')](_0x34858c,_0x19cf8b[_0x79b6('0x9c')]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x7f')]=function(_0x2e6882){return _0x2e6882&&_0x2e6882!=='0'&&_0x2e6882!=='-1'&&_0x2e6882!=='';};AGIVertices['prototype'][_0x79b6('0x9f')]=function(_0x2537b1){this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2537b1,'-');_0x2537b1[_0x79b6('0xa0')]=_0x2537b1[_0x79b6('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x79b6('0x10')]['mrcpsynth']=function(_0x5ab078){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xa1'),_0x5ab078['label']));if(!this[_0x79b6('0x7f')](_0x5ab078['text'])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20text\x20configured');}var _0x397ebd='\x22'+_0x5ab078[_0x79b6('0x59')]+'\x22';if(this[_0x79b6('0x7f')](_0x5ab078['options'])){_0x397ebd+=','+_0x5ab078[_0x79b6('0x73')];}var _0x1763db=this[_0x79b6('0xe')][_0x79b6('0xa3')]('MRCPSynth',_0x397ebd);if(_0x1763db[_0x79b6('0x9d')]===-0x1){return _0x1763db;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xa4'),_0x397ebd));};AGIVertices['prototype'][_0x79b6('0xa5')]=function(_0x503c21){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xa6'),_0x503c21['label']));if(!this[_0x79b6('0x7f')](_0x503c21[_0x79b6('0xa7')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xa8'));}var _0x112459=_0x503c21['grammar'];if(this[_0x79b6('0x7f')](_0x503c21[_0x79b6('0x73')])){_0x112459+=','+_0x503c21['options'];}var _0x1d207b=this[_0x79b6('0xe')][_0x79b6('0xa3')]('MRCPRecog',_0x112459);if(_0x1d207b[_0x79b6('0x9d')]===-0x1){return _0x1d207b;}var _0x423b69=this[_0x79b6('0xa9')]('RECOG_CONFIDENCE()',_0x79b6('0xaa'));if(_0x423b69[_0x79b6('0x9d')]===-0x1){return _0x423b69;}var _0x2e5699=this[_0x79b6('0xa9')](_0x79b6('0xab'),'MRCP_RECOG_TRANSCRIPT');if(_0x2e5699[_0x79b6('0x9d')]===-0x1){return _0x2e5699;}var _0x1a7f11=this['getAndSetVariable']('RECOG_INSTANCE()',_0x79b6('0xac'));if(_0x1a7f11[_0x79b6('0x9d')]===-0x1){return _0x1a7f11;}return this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x112459));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xad')]=function(_0x1e3f53){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xae'),_0x1e3f53[_0x79b6('0x32')]));return this[_0x79b6('0xe')]['agi']([_0x1e3f53[_0x79b6('0xaf')],_0x1e3f53[_0x79b6('0xb0')]]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0xb1')]=function(_0x269c4a){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0xb2'),_0x269c4a[_0x79b6('0x32')]));if(this['isConfigured'](_0x269c4a[_0x79b6('0x61')])){logger['info'](util[_0x79b6('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x269c4a[_0x79b6('0x61')]));var _0x557fbb=this[_0x79b6('0xe')][_0x79b6('0xb3')](_0x269c4a[_0x79b6('0x61')]);if(_0x557fbb[_0x79b6('0x9d')]===-0x1){return _0x557fbb;}}return this[_0x79b6('0xe')]['answer']();};AGIVertices[_0x79b6('0x10')]['callback']=function(_0x338ce4){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0xb4'),_0x338ce4['label']));if(!this[_0x79b6('0x7f')](_0x338ce4['list_id'])){return this['channel'][_0x79b6('0x4e')](_0x338ce4,_0x79b6('0xb5'));}_0x338ce4['scheduledAt']=moment();if(this['isConfigured'](_0x338ce4[_0x79b6('0xb6')])){_0x338ce4[_0x79b6('0x48')]=moment()[_0x79b6('0xb7')](_0x338ce4[_0x79b6('0xb6')],_0x79b6('0xb8'));}if(!this[_0x79b6('0x7f')](_0x338ce4['callback_priority'])){_0x338ce4[_0x79b6('0x4a')]=0x2;}this['createCmContact']['sync'](this,_0x338ce4);return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xb9'),_0x338ce4[_0x79b6('0x44')],_0x338ce4['list_id'],_0x338ce4[_0x79b6('0x48')]));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xba')]=function(_0x1e0f1d){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xbb'),_0x1e0f1d[_0x79b6('0x32')]));var _0x2f9721=this[_0x79b6('0xe')][_0x79b6('0xa3')](_0x1e0f1d['application'],_0x1e0f1d[_0x79b6('0x73')]);if(_0x2f9721['result']===-0x1){return _0x2f9721;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xbc'),_0x1e0f1d[_0x79b6('0xbd')],_0x1e0f1d[_0x79b6('0x73')]));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xbe')]=function(_0x1e4d0e){logger[_0x79b6('0x2b')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1e4d0e[_0x79b6('0x32')]));if(!this['isConfigured'](_0x1e4d0e[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20text\x20configured');}var _0x3d7493='\x22'+_0x1e4d0e[_0x79b6('0x59')]+'\x22';if(this[_0x79b6('0x7f')](_0x1e4d0e[_0x79b6('0x73')])){_0x3d7493+=','+_0x1e4d0e[_0x79b6('0x73')];}var _0x5c1537=this['channel'][_0x79b6('0xa3')](_0x79b6('0xbf'),_0x3d7493);if(_0x5c1537[_0x79b6('0x9d')]===-0x1){return _0x5c1537;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3d7493));};AGIVertices[_0x79b6('0x10')]['sestektts']=function(_0x31ffe6){logger['info'](util[_0x79b6('0x24')](_0x79b6('0xc0'),_0x31ffe6[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x31ffe6[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xc1'));}var _0x1c4d11='\x22'+_0x31ffe6[_0x79b6('0x59')]+'\x22';if(this[_0x79b6('0x7f')](_0x31ffe6[_0x79b6('0x73')])){_0x1c4d11+=','+_0x31ffe6[_0x79b6('0x73')];}var _0x5cc13e=this['channel'][_0x79b6('0xa3')](_0x79b6('0xbf'),_0x1c4d11);if(_0x5cc13e[_0x79b6('0x9d')]===-0x1){return _0x5cc13e;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xa4'),_0x1c4d11));};AGIVertices['prototype'][_0x79b6('0xc2')]=function(_0x4cd583){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xc3'),_0x4cd583[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x4cd583[_0x79b6('0xa7')])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xa8'));}var _0x1dac18=_0x4cd583[_0x79b6('0xa7')];if(this[_0x79b6('0x7f')](_0x4cd583[_0x79b6('0x73')])){_0x1dac18+=','+_0x4cd583['options'];}var _0x2ba664=this[_0x79b6('0xe')]['exec'](_0x79b6('0xc4'),_0x1dac18);if(_0x2ba664[_0x79b6('0x9d')]===-0x1){return _0x2ba664;}var _0x4eec52=this[_0x79b6('0xa9')](_0x79b6('0xc5'),_0x79b6('0xc6'));if(_0x4eec52[_0x79b6('0x9d')]===-0x1){return _0x4eec52;}var _0x4b9d66=this[_0x79b6('0xa9')](_0x79b6('0xab'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x4b9d66['result']===-0x1){return _0x4b9d66;}var _0x4b737a=this[_0x79b6('0xa9')](_0x79b6('0xc7'),'LUMENVOX_ASR_INSTANCE');if(_0x4b737a[_0x79b6('0x9d')]===-0x1){return _0x4b737a;}return this[_0x79b6('0xe')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1dac18));};AGIVertices['prototype'][_0x79b6('0xc8')]=function(_0x24df37){logger['info'](util['format'](_0x79b6('0xc9'),_0x24df37[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x24df37[_0x79b6('0xa7')])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xa8'));}var _0x5e2948=_0x24df37[_0x79b6('0xa7')];if(this[_0x79b6('0x7f')](_0x24df37[_0x79b6('0x73')])){_0x5e2948+=','+_0x24df37[_0x79b6('0x73')];}var _0x450d27=this[_0x79b6('0xe')][_0x79b6('0xa3')](_0x79b6('0xc4'),_0x5e2948);if(_0x450d27[_0x79b6('0x9d')]===-0x1){return _0x450d27;}var _0x8e37fe=this[_0x79b6('0xa9')](_0x79b6('0xc5'),_0x79b6('0xca'));if(_0x8e37fe[_0x79b6('0x9d')]===-0x1){return _0x8e37fe;}var _0x1c0561=this['getAndSetVariable']('RECOG_INPUT()',_0x79b6('0xcb'));if(_0x1c0561[_0x79b6('0x9d')]===-0x1){return _0x1c0561;}var _0x231c21=this['getAndSetVariable'](_0x79b6('0xc7'),_0x79b6('0xcc'));if(_0x231c21['result']===-0x1){return _0x231c21;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0xcd'),_0x5e2948));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xce')]=function(_0x21b8cf){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xcf'),_0x21b8cf[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x21b8cf['odbc_id'])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x21b8cf,_0x79b6('0xd0'));}var _0x2272dc=this[_0x79b6('0x18')][_0x79b6('0x6b')](this,_0x21b8cf[_0x79b6('0xd1')]);if(!_0x2272dc){return this['channel'][_0x79b6('0x4e')](_0x21b8cf,'no\x20odbc\x20database\x20found');}if(!this[_0x79b6('0x7f')](_0x21b8cf[_0x79b6('0x29')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x21b8cf,_0x79b6('0xd2'));}var _0x2db96a=_0x21b8cf[_0x79b6('0x29')][_0x79b6('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')]('query:\x20%s',_0x2db96a));var _0x4be23a=this[_0x79b6('0x26')][_0x79b6('0x6b')](this,_0x2272dc,_0x2db96a);this['createSquareDetailsReport'][_0x79b6('0x6b')](this,_0x21b8cf,_0x2db96a);if(!this[_0x79b6('0x7f')](_0x21b8cf[_0x79b6('0xd4')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xd5'));}var _0x91950a=this[_0x79b6('0x11')]['sync'](this,_0x21b8cf['variable_id']);if(!_0x91950a){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x21b8cf,_0x79b6('0xd6'));}var _0x1806fd=this;_0x4be23a['forEach'](function(_0x5b1a4d,_0x329d00){Object[_0x79b6('0xd7')](_0x5b1a4d)[_0x79b6('0xd8')](function(_0x248a81){_0x1806fd[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0xd9'),_0x91950a,_0x329d00,_0x248a81),_0x5b1a4d[_0x248a81]);});});this['channel'][_0x79b6('0x98')](util[_0x79b6('0x24')]('%s_ROWS_COUNT',_0x91950a),_0x4be23a[_0x79b6('0x93')]);return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xda'),_0x91950a));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xdb')]=function(_0x57f0f4){logger[_0x79b6('0xdc')](util[_0x79b6('0x24')](_0x79b6('0xdd'),_0x57f0f4[_0x79b6('0x32')]));if(!this['isConfigured'](_0x57f0f4[_0x79b6('0xde')])){return this['channel']['error'](_0x57f0f4,_0x79b6('0xdf'));}var _0x51b4f1=this[_0x79b6('0xe0')]['sync'](this,_0x57f0f4[_0x79b6('0xde')]);if(!_0x51b4f1){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x57f0f4,_0x79b6('0xe1'));}var _0x316437=this['channel'][_0x79b6('0xa3')](_0x79b6('0xe2'),[util[_0x79b6('0x24')](_0x79b6('0xe3'),_0x51b4f1),_0x57f0f4[_0x79b6('0x61')],_0x57f0f4[_0x79b6('0xe4')],_0x57f0f4[_0x79b6('0x5f')]]);if(_0x316437[_0x79b6('0x9d')]===-0x1){return _0x316437;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0xe5'),'DIAL'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xe6')]=function(_0xce1611){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xce1611['label']));if(!this[_0x79b6('0x7f')](_0xce1611[_0x79b6('0x75')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xe7'));}if(!this[_0x79b6('0x7f')](_0xce1611[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20text\x20configured');}this[_0x79b6('0xe')][_0x79b6('0xe8')]=!![];this['createSquareDetailsReport'](_0xce1611);this[_0x79b6('0x3d')](_0xce1611[_0x79b6('0x59')],'in','','');this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xe9'),_0xce1611[_0x79b6('0x59')]));var _0x4c68ca=this[_0x79b6('0x74')][_0x79b6('0x6b')](this,_0xce1611);if(_0x4c68ca){for(var _0x256979 in _0x4c68ca){if(_0x4c68ca[_0x79b6('0x8f')](_0x256979)){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0xea'),_0x256979[_0x79b6('0xeb')]()),_0x4c68ca[_0x256979]);}}this[_0x79b6('0x3d')](_0x4c68ca[_0x79b6('0xec')],_0x79b6('0xed'),_0x79b6('0xe6'),'');return this[_0x79b6('0xe')]['noop'](util['format'](_0x79b6('0xee'),_0x4c68ca['speech']));}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0xce1611,_0x79b6('0xef'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0xf0')]=function(_0x58d461){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xf1'),_0x58d461[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x58d461[_0x79b6('0x78')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xf2'));}if(!this[_0x79b6('0x7f')](_0x58d461[_0x79b6('0x79')])){return this['channel']['noop'](_0x79b6('0xf3'));}if(!this[_0x79b6('0x7f')](_0x58d461['private_key'])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xf4'));}if(!this[_0x79b6('0x7f')](_0x58d461[_0x79b6('0x7b')])){return this['channel']['noop'](_0x79b6('0xf5'));}if(!this[_0x79b6('0x7f')](_0x58d461[_0x79b6('0x59')])){return this[_0x79b6('0xe')]['noop'](_0x79b6('0xc1'));}this[_0x79b6('0xe')][_0x79b6('0xe8')]=!![];this['createSquareDetailsReport'](_0x58d461);this[_0x79b6('0x3d')](_0x58d461[_0x79b6('0x59')],'in','','');this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xf6'),_0x58d461[_0x79b6('0x59')]));var _0x11f766=this[_0x79b6('0x77')]['sync'](this,_0x58d461);if(_0x11f766){for(var _0x39af11 in _0x11f766){if(_0x11f766['hasOwnProperty'](_0x39af11)){if(_0x39af11!=='providerResponse'){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0xea'),_0x39af11[_0x79b6('0xeb')]()),_0x11f766[_0x39af11]);}}}this[_0x79b6('0x3d')](_0x11f766[_0x79b6('0xec')],_0x79b6('0xed'),_0x79b6('0xf0'),_0x11f766[_0x79b6('0xf7')]);return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')]('DialogflowV2\x20Result\x20%s',_0x11f766[_0x79b6('0xec')]));}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x58d461,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x79b6('0x10')][_0x79b6('0xf8')]=function(_0x5744e4){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0xf9'),_0x5744e4[_0x79b6('0x32')]));if(!this['isConfigured'](_0x5744e4[_0x79b6('0xfa')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xfb'));}if(!this[_0x79b6('0x7f')](_0x5744e4['username'])){return this['channel'][_0x79b6('0xa2')]('no\x20username\x20configured');}if(!this[_0x79b6('0x7f')](_0x5744e4[_0x79b6('0xfc')])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x79b6('0x7f')](_0x5744e4['ndassistant_url'])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xc1'));}this['channel'][_0x79b6('0xe8')]=!![];this['createSquareDetailsReport'](_0x5744e4);this['createSquareMessage'](_0x5744e4[_0x79b6('0x59')],'in','','');this[_0x79b6('0xe')]['noop'](util['format'](_0x79b6('0xfd'),_0x5744e4['text']));var _0x267b2b=this['sestekNDA']['sync'](this,_0x5744e4);if(_0x267b2b){for(var _0x44b116 in _0x267b2b){if(_0x267b2b['hasOwnProperty'](_0x44b116)){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0xfe'),_0x44b116['toUpperCase']()),_0x267b2b[_0x44b116]);}}this['createSquareMessage'](_0x267b2b[_0x79b6('0xec')],_0x79b6('0xed'),_0x79b6('0xf8'),'');if(_0x267b2b[_0x79b6('0xff')]){this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x100'),_0x267b2b[_0x79b6('0xff')]));var _0x202e94=this['channel'][_0x79b6('0x101')](_0x267b2b[_0x79b6('0xff')]);try{fs[_0x79b6('0x102')](_0x267b2b[_0x79b6('0xff')]+_0x79b6('0x103'));}catch(_0x236d8b){logger[_0x79b6('0x4e')](_0x236d8b);}return _0x202e94;}else{return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x104'),_0x267b2b[_0x79b6('0xec')]));}}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x5744e4,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x79b6('0x10')]['end']=function(_0x19fcfa){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x19fcfa[_0x79b6('0x32')]));return this[_0x79b6('0xe')]['noop'](_0x79b6('0x105'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x106')]=function(_0x3e12a2){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x107'),_0x3e12a2[_0x79b6('0x32')]));var _0x3a642d='';if(_0x3e12a2['trunk_id']){if(!this[_0x79b6('0x7f')](_0x3e12a2['trunk_id'])){return this['channel']['error'](_0x3e12a2,_0x79b6('0x108'));}else{var _0x1cb8d7=parseInt(_0x3e12a2[_0x79b6('0x109')],0xa);if(isNaN(_0x1cb8d7)){_0x3a642d=_0x3e12a2['trunk_id'];}else{_0x3a642d=this[_0x79b6('0x1a')]['sync'](this,_0x3e12a2['trunk_id']);if(!_0x3a642d){return this[_0x79b6('0xe')]['error'](_0x3e12a2,'no\x20trunk\x20found');}}}}else if(_0x3e12a2[_0x79b6('0x10a')]){_0x3a642d=_0x3e12a2[_0x79b6('0x10a')];}else{return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x3e12a2,_0x79b6('0x108'));}var _0x339859=this[_0x79b6('0xe')][_0x79b6('0xa3')](_0x79b6('0xe2'),[util['format'](_0x79b6('0x10b'),_0x3a642d,_0x3e12a2[_0x79b6('0x44')]),_0x3e12a2[_0x79b6('0x61')],_0x3e12a2[_0x79b6('0xe4')],_0x3e12a2['url']]);if(_0x339859[_0x79b6('0x9d')]===-0x1){return _0x339859;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xe5'),_0x79b6('0xe2')));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x10c')]=function(_0x237028){logger['info'](util[_0x79b6('0x24')](_0x79b6('0x10d'),_0x237028[_0x79b6('0x32')]));return this['channel']['noop'](_0x79b6('0x10c'));};AGIVertices['prototype'][_0x79b6('0xd')]=function(_0x2cbc51){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x10e'),_0x2cbc51[_0x79b6('0x32')]));if(_0x2cbc51['retry']===0x0){return this[_0x79b6('0x9f')](_0x2cbc51);}_0x2cbc51[_0x79b6('0xa0')]-=0x1;if(!this[_0x79b6('0x7f')](_0x2cbc51['file_id'])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x2cbc51,_0x79b6('0x10f'));}var _0x16fd0c=this[_0x79b6('0x1b')][_0x79b6('0x6b')](this,_0x2cbc51[_0x79b6('0x110')]);if(!_0x16fd0c){return this['channel']['error'](_0x2cbc51,_0x79b6('0x111'));}if(!this[_0x79b6('0x7f')](_0x2cbc51[_0x79b6('0xd4')])){return this['channel'][_0x79b6('0x4e')](_0x79b6('0xd5'));}var _0x49e781=this[_0x79b6('0xe')][_0x79b6('0x112')](_0x16fd0c,_0x2cbc51[_0x79b6('0x113')],_0x2cbc51[_0x79b6('0x114')]);var _0x309e97=_0x49e781['result']?_0x49e781[_0x79b6('0x9d')][_0x79b6('0x49')]():'';logger[_0x79b6('0x2b')](_0x79b6('0x115'),JSON[_0x79b6('0x6e')](_0x49e781));if(_0x49e781[_0x79b6('0x9d')]===-0x1){this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2cbc51,_0x309e97);return _0x49e781;}else if(_0x49e781['extra']===_0x79b6('0x61')){_0x49e781['result']=_0x309e97['length']>=parseInt(_0x2cbc51['mindigit'])?'x':'i';}else{_0x49e781[_0x79b6('0x9d')]=_0x309e97[_0x79b6('0x93')]>=parseInt(_0x2cbc51[_0x79b6('0x116')])&&_0x309e97[_0x79b6('0x93')]<=parseInt(_0x2cbc51[_0x79b6('0x114')])?'x':'i';}var _0x522890=this[_0x79b6('0x11')][_0x79b6('0x6b')](this,_0x2cbc51['variable_id']);if(!_0x522890){return this[_0x79b6('0xe')]['error'](_0x2cbc51,'no\x20variable\x20found');}this['channel'][_0x79b6('0x98')](_0x522890,_0x309e97);if(this[_0x79b6('0x7f')](_0x2cbc51[_0x79b6('0x117')])){var _0xdb0f34=parseInt(_0x2cbc51[_0x79b6('0x117')],0xa);var _0x3d0b42=rs[_0x79b6('0x118')]({'charset':'*','length':_0xdb0f34});var _0x3463d7=_0x309e97[_0x79b6('0x93')];if(_0x3463d7>0x0){if(_0x3463d7>_0xdb0f34){this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2cbc51,_0x2cbc51[_0x79b6('0x119')]==='first'?_0x3d0b42+_0x309e97['substr'](_0xdb0f34):_0x309e97['substr'](0x0,_0x3463d7-_0xdb0f34)+_0x3d0b42);}else{this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2cbc51,rs['generate']({'charset':'*','length':_0x3463d7}));}}else{this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2cbc51,'');}}else{this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x2cbc51,_0x309e97);}return _0x49e781;};AGIVertices[_0x79b6('0x10')][_0x79b6('0x11a')]=function(_0x43757e){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x11b'),_0x43757e[_0x79b6('0x32')]));return this[_0x79b6('0xd')](_0x43757e);};AGIVertices['prototype']['goal']=function(_0x797c55){logger['info'](util['format'](_0x79b6('0x11c'),_0x797c55[_0x79b6('0x32')]));this['createSquareDetailsReport'][_0x79b6('0x6b')](this,_0x797c55,_0x797c55[_0x79b6('0x11d')]);return this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0x11e'),_0x797c55[_0x79b6('0x11d')]));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x11f')]=function(_0x3df210){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3df210[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x3df210[_0x79b6('0x82')])||!this[_0x79b6('0x7f')](_0x3df210[_0x79b6('0x120')])){return this['channel'][_0x79b6('0xa2')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x79b6('0x7f')](_0x3df210[_0x79b6('0x59')])){return this['channel']['noop'](_0x79b6('0xc1'));}this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0x121'),_0x3df210[_0x79b6('0x59')]));var _0x40f858=this[_0x79b6('0x81')]['sync'](this,_0x3df210);if(_0x40f858){this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')]('aws\x20Polly\x20%s\x20file\x20created',_0x40f858));var _0x1ceaa2=this[_0x79b6('0xe')][_0x79b6('0x101')](_0x40f858);try{fs['unlink'](_0x40f858+_0x79b6('0x103'));}catch(_0x2332c3){logger['error'](_0x2332c3);}return _0x1ceaa2;}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x3df210,_0x79b6('0x122'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x123')]=function(_0x5e57b3){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x124'),_0x5e57b3['label']));if(!this[_0x79b6('0x7f')](_0x5e57b3[_0x79b6('0x82')])||!this[_0x79b6('0x7f')](_0x5e57b3['aws_secret_access_key'])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x79b6('0x7f')](_0x5e57b3['aws_bot_name'])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0x125'));}if(!this[_0x79b6('0x7f')](_0x5e57b3[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xc1'));}this[_0x79b6('0xe')][_0x79b6('0xe8')]=!![];this[_0x79b6('0x30')](_0x5e57b3);this[_0x79b6('0x3d')](_0x5e57b3[_0x79b6('0x59')],'in','','');this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0x126'),_0x5e57b3['text']));var _0x423f40=this[_0x79b6('0x86')]['sync'](this,_0x5e57b3);if(_0x423f40){for(var _0x54d895 in _0x423f40){if(_0x423f40['hasOwnProperty'](_0x54d895)&&_[_0x79b6('0x90')](_0x423f40[_0x54d895])){this['channel'][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0x127'),_0x54d895[_0x79b6('0xeb')]()),_0x423f40[_0x54d895]);}}if(_[_0x79b6('0x43')](_0x423f40[_0x79b6('0x71')])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0x128'));}else{this[_0x79b6('0x3d')](_0x423f40[_0x79b6('0x71')],_0x79b6('0xed'),_0x79b6('0x129'),'');return this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x423f40[_0x79b6('0x71')]));}}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x5e57b3,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x79b6('0x10')][_0x79b6('0x12a')]=function(_0x5c49a6){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x12b'),_0x5c49a6[_0x79b6('0x32')],_0x5c49a6[_0x79b6('0x61')]));if(!this[_0x79b6('0x7f')](_0x5c49a6[_0x79b6('0x75')])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xe7'));}var _0x61e1b3=_0x79b6('0x12c');var _0x1eeefe=util[_0x79b6('0x24')](_0x79b6('0x12d'),FILES_PATH,rs[_0x79b6('0x118')](0x4));var _0x1d113d=util[_0x79b6('0x24')](_0x79b6('0x96'),_0x1eeefe,_0x61e1b3);var _0x15dfde=!![];if(_0x5c49a6[_0x79b6('0x12e')]===_0x79b6('0x12f')){_0x15dfde=![];}var _0x51d259=this[_0x79b6('0xe')][_0x79b6('0x130')](_0x1eeefe,_0x61e1b3,_0x5c49a6[_0x79b6('0x131')],_0x5c49a6['timeout'],undefined,_0x15dfde);if(_0x51d259[_0x79b6('0x9d')]!==-0x1){this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x132'),_0x1d113d));var _0x62e1eb=this[_0x79b6('0x89')][_0x79b6('0x6b')](this,_0x5c49a6,_0x1d113d);if(_0x62e1eb){for(var _0xbbc88a in _0x62e1eb){if(_0x62e1eb[_0x79b6('0x8f')](_0xbbc88a)){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0x133'),_0xbbc88a[_0x79b6('0xeb')]()),_0x62e1eb[_0xbbc88a]);}}return this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0x134'),JSON['stringify'](_0x62e1eb)));}}return _0x51d259;};AGIVertices[_0x79b6('0x10')][_0x79b6('0x135')]=function(_0x4df93b){logger['info'](util['format'](_0x79b6('0x136'),_0x4df93b['label']));if(!this[_0x79b6('0x7f')](_0x4df93b['appid'])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0x137'));}if(!this[_0x79b6('0x7f')](_0x4df93b['appsecret'])){return this[_0x79b6('0xe')]['noop'](_0x79b6('0x138'));}var _0x18938f=_0x79b6('0x12c');var _0x5d96c3=util[_0x79b6('0x24')](_0x79b6('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x29b505=util['format'](_0x79b6('0x96'),_0x5d96c3,_0x18938f);var _0x40b28d=!![];if(_0x4df93b[_0x79b6('0x12e')]==='NOBEEP'){_0x40b28d=![];}var _0x4c9260=this[_0x79b6('0xe')][_0x79b6('0x130')](_0x5d96c3,_0x18938f,_0x4df93b[_0x79b6('0x131')],_0x4df93b[_0x79b6('0x61')],undefined,_0x40b28d);if(_0x4c9260[_0x79b6('0x9d')]!==-0x1){this['channel'][_0x79b6('0xa2')](util['format']('tilde\x20%s\x20file\x20created',_0x29b505));var _0x400e6c=this[_0x79b6('0x8b')][_0x79b6('0x6b')](this,_0x4df93b,_0x29b505);if(_0x400e6c){for(var _0xe3ffe2 in _0x400e6c){if(_0x400e6c['hasOwnProperty'](_0xe3ffe2)){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0x139'),_0xe3ffe2[_0x79b6('0xeb')]()),_0x400e6c[_0xe3ffe2]);}}return this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0x13a'),JSON[_0x79b6('0x6e')](_0x400e6c)));}}return _0x4c9260;};AGIVertices[_0x79b6('0x10')][_0x79b6('0x13b')]=function(_0x5ec07f){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x13c'),_0x5ec07f['label']));return this[_0x79b6('0xe')][_0x79b6('0x13d')](_0x5ec07f[_0x79b6('0x13e')],_0x5ec07f[_0x79b6('0x37')],_0x5ec07f[_0x79b6('0x38')]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x13f')]=function(_0x18855f){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x140'),_0x18855f[_0x79b6('0x32')]));if(!this['isConfigured'](_0x18855f[_0x79b6('0x141')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x18855f,'no\x20condition\x20configured');}try{var _0xabc0c0=eval(_0x18855f[_0x79b6('0x141')])?'true':'false';this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x18855f[_0x79b6('0x141')],_0xabc0c0));return{'code':0xc8,'result':_0xabc0c0};}catch(_0x4ed454){return{'code':0xc8,'result':_0x79b6('0x142')};}};AGIVertices['prototype'][_0x79b6('0x143')]=function(_0x43f347){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x144'),_0x43f347['label']));if(!this[_0x79b6('0x7f')](_0x43f347[_0x79b6('0x145')])){return this[_0x79b6('0xe')]['error'](_0x43f347,'no\x20interval\x20configured');}var _0x2c11fb=this[_0x79b6('0x20')][_0x79b6('0x6b')](this,_0x43f347[_0x79b6('0x145')]);if(!_0x2c11fb){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x43f347,_0x79b6('0x146'));}for(var _0x29025e=0x0;_0x29025e<_0x2c11fb['length'];_0x29025e+=0x1){var _0x13bdfa=this[_0x79b6('0xe')][_0x79b6('0x11')](util[_0x79b6('0x24')]('IFTIME(%s?true:false)',_0x2c11fb[_0x29025e]));if(_0x13bdfa[_0x79b6('0x9d')]===-0x1){return _0x13bdfa;}logger['info'](util['format'](_0x79b6('0x147'),_0x2c11fb[_0x29025e],_0x13bdfa[_0x79b6('0x9c')]));if(_0x13bdfa[_0x79b6('0x9c')]===_0x79b6('0x148')){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x147'),_0x2c11fb[_0x29025e],'true'));this[_0x79b6('0xe')]['noop'](util['format'](_0x79b6('0x147'),_0x2c11fb[_0x29025e],_0x79b6('0x148')));return{'code':0xc8,'result':'true'};}else{logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x147'),_0x2c11fb[_0x29025e],_0x79b6('0x142')));this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')]('IFTIME\x20%s\x20%s',_0x2c11fb[_0x29025e],_0x79b6('0x142')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x79b6('0x10')][_0x79b6('0x149')]=function(_0x4ecf4b){logger['info'](util[_0x79b6('0x24')](_0x79b6('0x14a'),_0x4ecf4b[_0x79b6('0x32')]));return this['channel'][_0x79b6('0x149')]();};AGIVertices[_0x79b6('0x10')][_0x79b6('0x14b')]=function(_0x279d52){logger['info'](util[_0x79b6('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x279d52[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x279d52['key'])){return this['channel'][_0x79b6('0xa2')]('no\x20key\x20configured');}var _0x2e7a13=_0x79b6('0x12c');var _0x43f51b=util['format'](_0x79b6('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x489e38=util['format'](_0x79b6('0x96'),_0x43f51b,_0x2e7a13);var _0x50e734=!![];if(_0x279d52[_0x79b6('0x12e')]===_0x79b6('0x12f')){_0x50e734=![];}var _0x272e62=this['channel']['recordFile'](_0x43f51b,_0x2e7a13,_0x279d52[_0x79b6('0x131')],_0x279d52[_0x79b6('0x61')],undefined,_0x50e734);if(_0x272e62[_0x79b6('0x9d')]!==-0x1){this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x14c'),_0x489e38));var _0x41ddf3=this['ispeechASR'][_0x79b6('0x6b')](this,_0x279d52,_0x489e38);if(_0x41ddf3){for(var _0x54149b in _0x41ddf3){if(_0x41ddf3[_0x79b6('0x8f')](_0x54149b)){this[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')]('ISPEECH_ASR_%s',_0x54149b[_0x79b6('0xeb')]()),_0x41ddf3[_0x54149b]);}}return this['channel']['noop'](util[_0x79b6('0x24')]('IspeechASR\x20Result\x20%s',JSON[_0x79b6('0x6e')](_0x41ddf3)));}}return _0x272e62;};AGIVertices[_0x79b6('0x10')]['ispeechtts']=function(_0x16aac1){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x14d'),_0x16aac1['label']));if(!this['isConfigured'](_0x16aac1['key'])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xe7'));}if(!this[_0x79b6('0x7f')](_0x16aac1[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xc1'));}this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x14e'),_0x16aac1['text']));var _0x4c9077=this[_0x79b6('0x7c')][_0x79b6('0x6b')](this,_0x16aac1);if(_0x4c9077){this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x14c'),_0x4c9077));var _0x59f484=this[_0x79b6('0xe')][_0x79b6('0x101')](_0x4c9077,_0x16aac1['intKey']);try{fs[_0x79b6('0x102')](_0x4c9077+_0x79b6('0x103'));}catch(_0x3b09d2){logger[_0x79b6('0x4e')](_0x3b09d2);}return _0x59f484;}return this['channel'][_0x79b6('0x4e')](_0x16aac1,_0x79b6('0x14f'));};AGIVertices[_0x79b6('0x10')]['login']=function(_0x27e3c0){logger['info'](util['format'](_0x79b6('0x150'),_0x27e3c0[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x27e3c0[_0x79b6('0x151')])){return this['channel'][_0x79b6('0x4e')](_0x27e3c0,_0x79b6('0x152'));}logger['info'](util[_0x79b6('0x24')](_0x79b6('0x153'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x27e3c0[_0x79b6('0x151')]));var _0x18a67f=this[_0x79b6('0x51')][_0x79b6('0x6b')](this,_0x27e3c0[_0x79b6('0x151')]);if(_0x18a67f){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x154'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x27e3c0['findBy']));this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0x154'),this[_0x79b6('0xe')]['callerid'],_0x27e3c0[_0x79b6('0x151')]));return{'code':0xc8,'result':_0x79b6('0x155')};}else{logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x156'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x27e3c0[_0x79b6('0x151')]));this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x156'),this['channel']['callerid'],_0x27e3c0['findBy']));return{'code':0xc8,'result':_0x79b6('0x157')};}};AGIVertices[_0x79b6('0x10')]['logout']=function(_0x4fd7b){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x158'),_0x4fd7b[_0x79b6('0x32')]));if(!this['isConfigured'](_0x4fd7b[_0x79b6('0x151')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x4fd7b,_0x79b6('0x152'));}logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x153'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x4fd7b[_0x79b6('0x151')]));var _0x3cab97=this[_0x79b6('0x50')]['sync'](this,_0x4fd7b[_0x79b6('0x151')]);if(_0x3cab97){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x154'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x4fd7b[_0x79b6('0x151')]));this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x79b6('0xe')][_0x79b6('0x35')],_0x4fd7b[_0x79b6('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x156'),this['channel'][_0x79b6('0x35')],_0x4fd7b[_0x79b6('0x151')]));this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x156'),this[_0x79b6('0xe')]['callerid'],_0x4fd7b[_0x79b6('0x151')]));return{'code':0xc8,'result':_0x79b6('0x157')};}};AGIVertices[_0x79b6('0x10')]['math']=function(_0x189c7a){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x159'),_0x189c7a[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x189c7a[_0x79b6('0x15a')])){return this[_0x79b6('0xe')]['error'](_0x189c7a,_0x79b6('0x15b'));}this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0x15c'),_0x189c7a[_0x79b6('0x15a')]));var _0x2cd2af=eval(_0x189c7a['operation']);if(!this[_0x79b6('0x7f')](_0x189c7a[_0x79b6('0xd4')])){return this['channel'][_0x79b6('0xa2')](_0x79b6('0xd5'));}var _0x1bf54e=this[_0x79b6('0x11')][_0x79b6('0x6b')](this,_0x189c7a[_0x79b6('0xd4')]);if(!_0x1bf54e){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x189c7a,'no\x20variable\x20found');}if(_[_0x79b6('0x97')](_0x2cd2af)){var _0x260ccd=this;_0x2cd2af[_0x79b6('0xd8')](function(_0x49e588,_0x213d38){_0x260ccd[_0x79b6('0xe')][_0x79b6('0x98')](util[_0x79b6('0x24')]('%s[%s]',_0x1bf54e,_0x213d38),_0x49e588);});return this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x15d'),_0x1bf54e));}else{return this[_0x79b6('0xe')][_0x79b6('0x98')](_0x1bf54e,_0x2cd2af);}};AGIVertices[_0x79b6('0x10')][_0x79b6('0xc')]=function(_0x1f920){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1f920[_0x79b6('0x32')]));if(_0x1f920[_0x79b6('0xa0')]===0x0){return this[_0x79b6('0x9f')](_0x1f920);}_0x1f920[_0x79b6('0xa0')]-=0x1;if(!this[_0x79b6('0x7f')](_0x1f920[_0x79b6('0x110')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x1f920,_0x79b6('0x10f'));}var _0x2d7592=this[_0x79b6('0x1b')][_0x79b6('0x6b')](this,_0x1f920['file_id']);if(!_0x2d7592){return this['channel'][_0x79b6('0x4e')](_0x1f920,_0x79b6('0x111'));}var _0xe0fbd3=this[_0x79b6('0xe')][_0x79b6('0x112')](_0x2d7592,_0x1f920[_0x79b6('0x113')],_0x1f920['digit']);var _0x467f4d=_0xe0fbd3[_0x79b6('0x9d')];if(_0xe0fbd3['result']===-0x1){this[_0x79b6('0x30')]['sync'](this,_0x1f920,'-1');return _0xe0fbd3;}else if(_0xe0fbd3[_0x79b6('0x9c')]===_0x79b6('0x61')){_0xe0fbd3[_0x79b6('0x9d')]=_0xe0fbd3[_0x79b6('0x9d')]['length']>0x0?_0xe0fbd3['result']:'t';}else if(_[_0x79b6('0x41')](_0xe0fbd3[_0x79b6('0x9d')])){_0xe0fbd3[_0x79b6('0x9d')]='#';_0x467f4d='#';}if(!this['isConfigured'](_0x1f920['variable_id'])){this['channel'][_0x79b6('0xa2')](_0x79b6('0xd5'));}else{var _0x127926=this[_0x79b6('0x11')][_0x79b6('0x6b')](this,_0x1f920[_0x79b6('0xd4')]);if(!_0x127926){return this['channel'][_0x79b6('0x4e')](_0x1f920,_0x79b6('0xd6'));}this[_0x79b6('0xe')][_0x79b6('0x98')](_0x127926,_0x467f4d);}this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x1f920,_0x467f4d);return _0xe0fbd3;};AGIVertices[_0x79b6('0x10')][_0x79b6('0xa2')]=function(_0xd7c8e1){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x15e'),_0xd7c8e1[_0x79b6('0x32')]));return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0xd7c8e1[_0x79b6('0x15f')]||_0xd7c8e1['label']);};AGIVertices['prototype'][_0x79b6('0x160')]=function(_0x2bfaec){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x161'),_0x2bfaec[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x2bfaec['findBy'])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x2bfaec,'no\x20find\x20by\x20configured');}logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x153'),this[_0x79b6('0xe')]['callerid'],_0x2bfaec[_0x79b6('0x151')]));var _0x2ee00b=this[_0x79b6('0x162')]['sync'](this,_0x2bfaec[_0x79b6('0x163')]);var _0x12d719=this['agentPause'][_0x79b6('0x6b')](this,_0x2bfaec[_0x79b6('0x151')],_0x2ee00b);if(_0x12d719){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x154'),this[_0x79b6('0xe')]['callerid'],_0x2bfaec[_0x79b6('0x151')]));this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0x154'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x2bfaec['findBy']));return{'code':0xc8,'result':_0x79b6('0x155')};}else{logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x156'),this[_0x79b6('0xe')]['callerid'],_0x2bfaec['findBy']));this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x79b6('0xe')][_0x79b6('0x35')],_0x2bfaec[_0x79b6('0x151')]));return{'code':0xc8,'result':_0x79b6('0x157')};}};AGIVertices[_0x79b6('0x10')][_0x79b6('0x164')]=function(_0x520e00){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x520e00[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x520e00[_0x79b6('0x110')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x520e00,'no\x20file\x20audio\x20selected');}var _0xa1956e=this[_0x79b6('0x1b')][_0x79b6('0x6b')](this,_0x520e00[_0x79b6('0x110')]);if(!_0xa1956e){return this[_0x79b6('0xe')]['error'](_0x520e00,_0x79b6('0x111'));}var _0x208ad3=this[_0x79b6('0xe')][_0x79b6('0xa3')](_0x79b6('0x165'),[_0xa1956e,_0x520e00[_0x79b6('0xe4')]]);if(_0x208ad3['result']===-0x1){return _0x208ad3;}return this[_0x79b6('0xe')]['noop'](util[_0x79b6('0x24')](_0x79b6('0xbc'),_0x79b6('0x165'),_0xa1956e));};AGIVertices['prototype'][_0x79b6('0x166')]=function(_0x3ed4c3){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x167'),_0x3ed4c3[_0x79b6('0x32')]));if(!this['isConfigured'](_0x3ed4c3[_0x79b6('0x168')])){return this['channel'][_0x79b6('0x4e')](_0x3ed4c3,'no\x20queue\x20selected');}var _0x9f3c7b='';var _0x23ba92=parseInt(_0x3ed4c3[_0x79b6('0x168')],0xa);if(isNaN(_0x23ba92)){_0x9f3c7b=_0x3ed4c3['queue_id'];}else{_0x9f3c7b=this['getVoiceQueue'][_0x79b6('0x6b')](this,_0x3ed4c3[_0x79b6('0x168')]);if(!_0x9f3c7b){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x3ed4c3,_0x79b6('0x169'));}}var _0x1a7ad9='';if(this[_0x79b6('0x7f')](_0x3ed4c3[_0x79b6('0x110')])){var _0x22ad4d=this[_0x79b6('0x1b')]['sync'](this,_0x3ed4c3['file_id']);if(_0x22ad4d){_0x1a7ad9=_0x22ad4d;}}this[_0x79b6('0x30')]['sync'](this,_0x3ed4c3,_0x9f3c7b);if(_0x3ed4c3['opts']['indexOf']('x')<0x0){_0x3ed4c3[_0x79b6('0xe4')]+='x';}if(_0x3ed4c3[_0x79b6('0xe4')]['indexOf']('X')<0x0){_0x3ed4c3[_0x79b6('0xe4')]+='X';}this['channel'][_0x79b6('0x98')]('XMCS-QUEUE',_0x9f3c7b?_0x9f3c7b[_0x79b6('0x16a')]():'');var _0x8f009b=this[_0x79b6('0xe')][_0x79b6('0xa3')]('QUEUE',[_0x9f3c7b,_0x3ed4c3[_0x79b6('0xe4')],_0x3ed4c3[_0x79b6('0x5f')],_0x1a7ad9,_0x3ed4c3[_0x79b6('0x61')],_0x3ed4c3[_0x79b6('0xad')],_0x3ed4c3[_0x79b6('0x16b')],_0x3ed4c3['gosub'],'',_0x3ed4c3['position']]);if(_0x8f009b['result']===-0x1){return _0x8f009b;}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0xbc'),_0x79b6('0x16c'),_0x9f3c7b));};AGIVertices['prototype'][_0x79b6('0x16d')]=function(_0x4b2225){logger['info'](util[_0x79b6('0x24')](_0x79b6('0x16e'),_0x4b2225['label']));var _0x271935=_0x4b2225['recordingFormat']||'wav';var _0xe06f35=util['format']('%s_%s',this[_0x79b6('0xe')][_0x79b6('0x31')],rs[_0x79b6('0x118')](0x5));var _0xbd6835=util['format'](_0x79b6('0x16f'),FILES_PATH,_0xe06f35,_0x271935);var _0x2b53ad=util['format'](_0x79b6('0x12d'),FILES_PATH,_0xe06f35);this[_0x79b6('0x34')][_0x79b6('0x6b')](this,_0x4b2225,_0xe06f35,_0xbd6835);this[_0x79b6('0xe')][_0x79b6('0x98')](_0x79b6('0x170'),_0xe06f35);logger[_0x79b6('0x2b')](_0x79b6('0x171'),_0x2b53ad,_0x271935,_0x4b2225[_0x79b6('0x172')],_0x4b2225[_0x79b6('0x61')]);return this['channel'][_0x79b6('0x130')](_0x2b53ad,_0x271935,_0x4b2225[_0x79b6('0x172')],_0x4b2225[_0x79b6('0x61')],undefined,!![]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x173')]=function(_0x1e83e9){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1e83e9[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x1e83e9['url'])){return this[_0x79b6('0xe')]['noop'](_0x79b6('0x174'));}var _0x3018a5=this[_0x79b6('0x175')]['sync'](this,_0x1e83e9);logger['info'](util[_0x79b6('0x24')](_0x79b6('0x176'),util[_0x79b6('0x177')](_0x3018a5,{'showHidden':![],'depth':null})));if(!this[_0x79b6('0x7f')](_0x1e83e9[_0x79b6('0xd4')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0x178'));}var _0x4442b0=this[_0x79b6('0x11')]['sync'](this,_0x1e83e9['variable_id']);if(!_0x4442b0){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x1e83e9,_0x79b6('0xd6'));}this[_0x79b6('0xe')]['setVariable'](util[_0x79b6('0x24')]('%s_STATUS_CODE',_0x4442b0),_0x3018a5['statusCode']?_0x3018a5[_0x79b6('0x70')]:_0x79b6('0x179'));this['channel'][_0x79b6('0x98')](util[_0x79b6('0x24')](_0x79b6('0x17a'),_0x4442b0),_0x3018a5[_0x79b6('0x17b')]?_0x3018a5['statusMessage']:'OK');if(_0x3018a5[_0x79b6('0x65')]){try{this['saveRestApiResult'](_0x3018a5[_0x79b6('0x65')],_0x4442b0);}catch(_0x4c329d){logger[_0x79b6('0x4e')](util[_0x79b6('0x24')](_0x79b6('0x17c'),_0x4442b0));}}return this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')]('variable\x20%s\x20set',_0x4442b0));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x17d')]=function(_0x281cf4){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x17e'),_0x281cf4[_0x79b6('0x32')]));return this[_0x79b6('0xe')]['sayDigits'](_0x281cf4['digits'][_0x79b6('0xd3')](/\s+/g,''),_0x281cf4[_0x79b6('0x172')]);};AGIVertices['prototype'][_0x79b6('0x17f')]=function(_0x7149){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x180'),_0x7149['label']));return this[_0x79b6('0xe')][_0x79b6('0x181')](_0x7149[_0x79b6('0x62')][_0x79b6('0xd3')](/\s+/g,''),_0x7149[_0x79b6('0x172')]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x182')]=function(_0x2354d9){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2354d9[_0x79b6('0x32')]));return this['channel']['sayPhonetic'](_0x2354d9[_0x79b6('0x59')],_0x2354d9['escape_digits']);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x183')]=function(_0xc3740a){logger[_0x79b6('0x2b')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xc3740a['label']));if(!this[_0x79b6('0x7f')](_0xc3740a['account_id'])){return this[_0x79b6('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x1bb19f=this[_0x79b6('0x1e')]['sync'](this,_0xc3740a['account_id']);if(!_0x1bb19f||!_0x1bb19f['Smtp']){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0xc3740a,_0x79b6('0x184'));}var _0x5c0ee9={'from':util[_0x79b6('0x24')](_0x79b6('0x185'),_0x1bb19f[_0x79b6('0x13')],_0x1bb19f[_0x79b6('0x186')]||_0x1bb19f['Smtp'][_0x79b6('0x187')]),'to':_0xc3740a['to']||'','cc':_0xc3740a['cc']||'','bcc':_0xc3740a['bcc']||'','subject':_0xc3740a['subject'],'html':_0xc3740a[_0x79b6('0x59')],'text':_0xc3740a[_0x79b6('0x59')]};if(this['isConfigured'](_0xc3740a[_0x79b6('0x188')])){}logger[_0x79b6('0xdc')]('sendMail\x20message',JSON[_0x79b6('0x6e')](_0x5c0ee9));this['createSquareDetailsReport'][_0x79b6('0x6b')](this,_0xc3740a,_0xc3740a[_0x79b6('0x189')]);this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x18a'),_0x1bb19f['name']));this['sendMailMessage'][_0x79b6('0x6b')](this,_0x1bb19f[_0x79b6('0x18b')],_0x5c0ee9);return this['channel'][_0x79b6('0xa2')](_0x79b6('0x18c'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x18d')]=function(_0xe0b5de){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x18e'),_0xe0b5de['label']));return this[_0x79b6('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x79b6('0x18f')]=function(_0x5d1493){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x190'),_0x5d1493[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x5d1493[_0x79b6('0x191')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20sms\x20account\x20configured');}var _0x341495=this[_0x79b6('0x2e')][_0x79b6('0x6b')](this,_0x5d1493['sms_account_id']);if(!_0x341495){return this[_0x79b6('0xe')]['error'](_0x5d1493,_0x79b6('0x192'));}var _0x46769a={'body':_0x5d1493[_0x79b6('0x193')],'phone':_0x5d1493['to']||'','SmsAccountId':_0x341495['id']};logger[_0x79b6('0xdc')]('sendSMS\x20message',JSON['stringify'](_0x46769a));this[_0x79b6('0x30')][_0x79b6('0x6b')](this,_0x5d1493,_0x5d1493[_0x79b6('0x191')]);this[_0x79b6('0xe')]['noop'](util['format'](_0x79b6('0x194'),_0x341495[_0x79b6('0x13')]));this['createSmsMessage'][_0x79b6('0x6b')](this,_0x46769a);return this[_0x79b6('0xe')]['noop'](_0x79b6('0x195'));};AGIVertices[_0x79b6('0x10')]['set']=function(_0x685f8e){logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x196'),_0x685f8e['label']));if(!this[_0x79b6('0x7f')](_0x685f8e['variable_id'])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x685f8e,'no\x20variable\x20selected');}var _0x5cb114=this[_0x79b6('0x11')]['sync'](this,_0x685f8e[_0x79b6('0xd4')]);if(!_0x5cb114){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x685f8e,_0x79b6('0xd6'));}return this['channel']['setVariable'](_0x5cb114,_0x685f8e[_0x79b6('0x197')]);};AGIVertices[_0x79b6('0x10')][_0x79b6('0x198')]=function(_0x5c1176){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x199'),_0x5c1176[_0x79b6('0x32')]));this['channel'][_0x79b6('0xa2')]('START\x20CALLY\x20SQUARE');var _0x23fd28=this[_0x79b6('0xe')][_0x79b6('0x11')]('XMCS-UNIQUEID');if(!_[_0x79b6('0x41')](_0x23fd28[_0x79b6('0x9c')])){this['channel']['uniqueid']=_0x23fd28[_0x79b6('0x9c')];}if(_0x5c1176[_0x79b6('0xb1')]===_0x79b6('0x19a')){this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0x19b'));return this[_0x79b6('0xe')][_0x79b6('0xb1')]();}return this['channel'][_0x79b6('0xa2')]('Skipped\x20Answer');};AGIVertices[_0x79b6('0x10')]['subproject']=function(_0x43e902){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x19c'),_0x43e902[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x43e902['project_id'])){return this['channel']['error'](_0x43e902,_0x79b6('0x19d'));}var _0x206eb0=this[_0x79b6('0x19e')][_0x79b6('0x6b')](this,_0x43e902['project_id']);if(!this[_0x79b6('0x7f')](_0x206eb0)){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x43e902,util['format'](_0x79b6('0x19f'),_0x43e902[_0x79b6('0x1a0')]));}if(_0x206eb0===this['channel']['arg_1']){return this['channel'][_0x79b6('0x4e')](_0x43e902,_0x79b6('0x1a1'));}this['createSquareDetailsReport'][_0x79b6('0x6b')](this,_0x43e902,_0x206eb0);var _0x4a4ac4=this['channel'][_0x79b6('0xa3')]('AGI',util[_0x79b6('0x24')](_0x79b6('0x1a2'),config[_0x79b6('0xad')][_0x79b6('0x1a3')]||_0x79b6('0x1a4'),_0x206eb0,this[_0x79b6('0xe')]['arg_1']));if(_0x4a4ac4[_0x79b6('0x9d')]===-0x1){return _0x4a4ac4;}return this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xbc'),_0x79b6('0x1a5'),_0x206eb0));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x1a6')]=function(_0x2cebdd){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x1a7'),_0x2cebdd[_0x79b6('0x32')]));var _0x36269c=this[_0x79b6('0x54')]['sync'](this,_0x2cebdd['command']);this[_0x79b6('0x30')]['sync'](this,_0x2cebdd,_0x2cebdd[_0x79b6('0xaf')]);if(this[_0x79b6('0x7f')](_0x2cebdd['variable_id'])){var _0x2b79c0=this[_0x79b6('0x11')][_0x79b6('0x6b')](this,_0x2cebdd[_0x79b6('0xd4')]);if(_0x2b79c0){this['channel'][_0x79b6('0x98')](_0x2b79c0,_0x36269c);return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x1a8'),_0x2cebdd['command'],_0x2b79c0));}}return this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x1a9'),_0x2cebdd['command']));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x1aa')]=function(_0x228d2a){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x1ab'),_0x228d2a['label']));_0x228d2a[_0x79b6('0x59')]=_0x228d2a[_0x79b6('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x79b6('0x7f')](_0x228d2a[_0x79b6('0x57')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')]('no\x20apiKey\x20configured');}if(!this[_0x79b6('0x7f')](_0x228d2a['text'])){return this['channel']['noop'](_0x79b6('0xc1'));}this[_0x79b6('0xe')][_0x79b6('0xa2')](util['format'](_0x79b6('0x1ac'),_0x228d2a['text']));var _0x30a9e0=this['googleCloudTTS'][_0x79b6('0x6b')](this,_0x228d2a);if(_0x30a9e0){this['channel'][_0x79b6('0xa2')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x30a9e0));var _0x25f3ce=this['channel'][_0x79b6('0x101')](_0x30a9e0);try{fs[_0x79b6('0x102')](_0x30a9e0+'.wav');}catch(_0x45c60e){logger[_0x79b6('0x4e')](_0x45c60e);}return _0x25f3ce;}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x228d2a,_0x79b6('0x1ad'));};AGIVertices['prototype'][_0x79b6('0x1ae')]=function(_0x5857d6){logger['info'](util[_0x79b6('0x24')](_0x79b6('0x1af'),_0x5857d6[_0x79b6('0x32')]));_0x5857d6[_0x79b6('0x59')]=_0x5857d6[_0x79b6('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x79b6('0x7f')](_0x5857d6[_0x79b6('0x59')])){return this[_0x79b6('0xe')][_0x79b6('0xa2')](_0x79b6('0xc1'));}this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x1b0'),_0x5857d6[_0x79b6('0x59')]));var _0x210e25=this['googleTTS'][_0x79b6('0x6b')](this,_0x5857d6);if(_0x210e25){this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')]('Google\x20TTS\x20%s\x20file\x20created',_0x210e25));var _0x59a18c=this[_0x79b6('0xe')]['streamFile'](_0x210e25);try{fs['unlink'](_0x210e25+_0x79b6('0x103'));}catch(_0x314c6f){logger[_0x79b6('0x4e')](_0x314c6f);}return _0x59a18c;}return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x5857d6,_0x79b6('0x1b1'));};AGIVertices[_0x79b6('0x10')][_0x79b6('0x1b2')]=function(_0x5365af){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5365af[_0x79b6('0x32')]));if(!this[_0x79b6('0x7f')](_0x5365af[_0x79b6('0x151')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0x5365af,'no\x20find\x20by\x20configured');}logger[_0x79b6('0x2b')](util['format'](_0x79b6('0x153'),this['channel']['callerid'],_0x5365af[_0x79b6('0x151')]));var _0x3ba332=this[_0x79b6('0x4f')][_0x79b6('0x6b')](this,_0x5365af[_0x79b6('0x151')]);if(_0x3ba332){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x154'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x5365af['findBy']));this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x154'),this[_0x79b6('0xe')][_0x79b6('0x35')],_0x5365af[_0x79b6('0x151')]));return{'code':0xc8,'result':_0x79b6('0x155')};}else{logger['info'](util[_0x79b6('0x24')](_0x79b6('0x156'),this[_0x79b6('0xe')]['callerid'],_0x5365af[_0x79b6('0x151')]));this[_0x79b6('0xe')][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0x156'),this['channel'][_0x79b6('0x35')],_0x5365af['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x79b6('0x10')][_0x79b6('0x1b3')]=function(_0x28ca91){logger[_0x79b6('0x2b')](util[_0x79b6('0x24')](_0x79b6('0x1b4'),_0x28ca91[_0x79b6('0x32')]));var _0x1fc204=this['channel'][_0x79b6('0xa3')](_0x79b6('0x1b5'),[_0x28ca91['mailbox'],_0x28ca91[_0x79b6('0x73')]]);if(_0x1fc204[_0x79b6('0x9d')]===-0x1){return _0x1fc204;}return this['channel'][_0x79b6('0xa2')](util[_0x79b6('0x24')](_0x79b6('0xbc'),_0x79b6('0x1b5'),_0x28ca91['mailbox']));};AGIVertices[_0x79b6('0x10')]['vswitch']=function(_0xa5df7b){logger['info'](util['format'](_0x79b6('0x1b6'),_0xa5df7b[_0x79b6('0x32')]));if(!this['isConfigured'](_0xa5df7b[_0x79b6('0xd4')])){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0xa5df7b,_0x79b6('0x1b7'));}var _0x1804a2=this[_0x79b6('0x11')][_0x79b6('0x6b')](this,_0xa5df7b[_0x79b6('0xd4')]);if(!_0x1804a2){return this[_0x79b6('0xe')][_0x79b6('0x4e')](_0xa5df7b,_0x79b6('0xd6'));}var _0x434fbd=this[_0x79b6('0xe')][_0x79b6('0x11')](_0x1804a2);return{'code':0xc8,'result':_0x434fbd['extra']?_0x434fbd['extra']:'-'};};String[_0x79b6('0x10')][_0x79b6('0x9b')]=function(_0x4e10cd,_0x4f529f){return this['split'](_0x4e10cd)['join'](_0x4f529f);};module[_0x79b6('0x1b8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8902698..5e1fc61 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 _0xf403=['linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','interface','ACW','name','mandatoryDispositionPause','Action','QueuePause','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','queue','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw'];(function(_0x5c73b2,_0x1824a8){var _0x35f2bf=function(_0x4015fc){while(--_0x4015fc){_0x5c73b2['push'](_0x5c73b2['shift']());}};_0x35f2bf(++_0x1824a8);}(_0xf403,0x173));var _0x3f40=function(_0x4f9ec9,_0x5825b7){_0x4f9ec9=_0x4f9ec9-0x0;var _0x4700b5=_0xf403[_0x4f9ec9];return _0x4700b5;};'use strict';var _=require(_0x3f40('0x0'));var moment=require(_0x3f40('0x1'));var ami=require(_0x3f40('0x2'));var logger=require('../../../config/logger')(_0x3f40('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x3f40('0x4'));function Acw(_0x4f60dd){this[_0x3f40('0x5')]=_0x4f60dd[_0x3f40('0x5')];this[_0x3f40('0x6')]=_0x4f60dd[_0x3f40('0x6')];this['timers']=_0x4f60dd[_0x3f40('0x7')];this[_0x3f40('0x8')]={};ami['on'](_0x3f40('0x9'),this['syncAgentConnect'][_0x3f40('0xa')](this));ami['on'](_0x3f40('0xb'),this[_0x3f40('0xc')][_0x3f40('0xa')](this));ami['on']('hangup',this[_0x3f40('0xd')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0xe'),this[_0x3f40('0xf')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x10'),this['syncAttendedTransfer'][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x11'),this[_0x3f40('0x12')][_0x3f40('0xa')](this));ami['on'](_0x3f40('0x13'),this[_0x3f40('0x14')][_0x3f40('0xa')](this));}function getDiff(_0x290b9f){var _0x46ee78=moment()['milliseconds'](0x0);var _0x4ea82a=moment(_0x290b9f)['milliseconds'](0x0);return _0x46ee78['diff'](_0x4ea82a,'seconds');}Acw[_0x3f40('0x15')][_0x3f40('0x16')]=function(_0x1010da,_0x26314c){var _0x3e992f=this;var _0x3b04ef=getDiff(_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x17')]);clearTimeout(_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x18')]);_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x18')]=![];return RpcVoiceAgentReport[_0x3f40('0x19')]({'acwtime':_0x3b04ef},_0x3e992f[_0x3f40('0x7')][_0x1010da][_0x3f40('0x1a')],_0x1010da)[_0x3f40('0x1b')](function(_0x4b8663){logger[_0x3f40('0x1c')](_0x3f40('0x1d'),_0x26314c,_0x3b04ef,_0x4b8663);})[_0x3f40('0x1e')](function(_0x19d209){logger[_0x3f40('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x26314c,_0x19d209);})['finally'](function(){delete _0x3e992f[_0x3f40('0x7')][_0x1010da];});};Acw[_0x3f40('0x15')]['startAcw']=function(_0x43d483){try{var _0x5a1a3c=this;var _0x591d83=this[_0x3f40('0x8')][_0x43d483][_0x3f40('0x20')];var _0x57ca67=this[_0x3f40('0x8')][_0x43d483]['queue'];var _0x2c90f9=this[_0x3f40('0x5')][_0x57ca67];var _0x3f14bc=![];var _0x56451e=_0x3f40('0x21');if(_0x2c90f9['mandatoryDisposition']&&_0x2c90f9['mandatoryDispositionPause'][_0x3f40('0x22')]){_0x3f14bc=!![];_0x56451e=_0x2c90f9[_0x3f40('0x23')][_0x3f40('0x22')];}return ami[_0x3f40('0x24')]({'action':_0x3f40('0x25'),'interface':_0x591d83,'paused':!![],'reason':_0x56451e})['then'](function(){if(_0x5a1a3c[_0x3f40('0x6')][_0x591d83]){return RpcUser[_0x3f40('0x26')](_0x5a1a3c[_0x3f40('0x6')][_0x591d83]['id'])[_0x3f40('0x1b')](function(_0x35a1f6){if(!_0x35a1f6||_0x35a1f6['voicePause']){logger[_0x3f40('0x1c')](_0x3f40('0x27'),_0x43d483,_0x591d83,_0x57ca67);return;}logger[_0x3f40('0x1c')](_0x3f40('0x28'),_0x43d483,_0x591d83,_0x57ca67);var _0x36b678=_0x5a1a3c['channels'][_0x43d483][_0x3f40('0x29')]&&_0x5a1a3c[_0x3f40('0x8')][_0x43d483][_0x3f40('0x2a')]?_0x5a1a3c['channels'][_0x43d483][_0x3f40('0x2a')]:_0x43d483;return RpcUser[_0x3f40('0x2b')](_0x5a1a3c['agents'][_0x591d83],_0x56451e,_0x36b678)[_0x3f40('0x1b')](function(_0x56467c){_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2c')]-=0x1;_0x5a1a3c[_0x3f40('0x5')][_0x57ca67]['paused']+=0x1;return _0x56467c;});})['then'](function(_0x1526e1){if(_0x3f14bc||!_0x1526e1){return;}_0x5a1a3c[_0x3f40('0x7')][_0x591d83]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x43d483,_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2d')],_0x591d83,_0x57ca67);_0x5a1a3c['timers'][_0x591d83]['timer']=setTimeout(_0x5a1a3c['stopAcw'][_0x3f40('0xa')](_0x5a1a3c,_0x591d83),_0x5a1a3c[_0x3f40('0x5')][_0x57ca67][_0x3f40('0x2d')]*0x3e8);_0x5a1a3c[_0x3f40('0x7')][_0x591d83]['lastPauseAt']=moment()[_0x3f40('0x2e')](_0x3f40('0x2f'));_0x5a1a3c['timers'][_0x591d83][_0x3f40('0x1a')]=_0x43d483;_0x5a1a3c['timers'][_0x591d83][_0x3f40('0x30')]=_0x57ca67;_0x5a1a3c[_0x3f40('0x7')][_0x591d83][_0x3f40('0x16')]=_0x5a1a3c[_0x3f40('0x16')][_0x3f40('0xa')](_0x5a1a3c,_0x591d83,_0x43d483);});}})['catch'](function(){logger[_0x3f40('0x1f')](_0x3f40('0x31'),_0x43d483,_0x5a1a3c['voiceQueues'][_0x57ca67][_0x3f40('0x2d')],_0x591d83,_0x57ca67);})[_0x3f40('0x32')](function(){delete _0x5a1a3c[_0x3f40('0x8')][_0x43d483];});}catch(_0x37114a){logger[_0x3f40('0x1f')]('[ACW][START]\x20%s',_0x37114a[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0x34')]=function(_0x222690){try{var _0x482627=this;if(_0x482627[_0x3f40('0x7')][_0x222690]){_0x482627[_0x3f40('0x7')][_0x222690]['timer']=![];var _0x34e93d=_0x482627[_0x3f40('0x7')][_0x222690][_0x3f40('0x1a')];var _0x2dd767=_0x482627[_0x3f40('0x7')][_0x222690][_0x3f40('0x30')];var _0x2d3d91=_0x482627['voiceQueues'][_0x2dd767][_0x3f40('0x2d')];logger[_0x3f40('0x1c')](_0x3f40('0x35'),_0x34e93d,_0x222690);RpcUser[_0x3f40('0x26')](this[_0x3f40('0x6')][_0x222690]['id'])[_0x3f40('0x1b')](function(_0x3ebf8c){if(_0x3ebf8c['pauseType']==='ACW'){return RpcUser[_0x3f40('0x36')](_0x482627[_0x3f40('0x6')][_0x222690]);}});RpcVoiceAgentReport['update']({'acwtime':_0x2d3d91,'agentacw':!![]},_0x34e93d,_0x222690)['then'](function(_0x409560){logger[_0x3f40('0x1c')](_0x3f40('0x1d'),_0x34e93d,_0x2d3d91,_0x409560);})[_0x3f40('0x1e')](function(_0x255479){logger[_0x3f40('0x1f')](_0x3f40('0x37'),_0x34e93d,_0x255479);});}else{logger[_0x3f40('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x222690);if(_0x482627[_0x3f40('0x7')]){logger[_0x3f40('0x1c')](_0x3f40('0x38'),JSON['stringify'](_0x482627[_0x3f40('0x7')]));}}}catch(_0x351ac5){logger[_0x3f40('0x1f')](_0x3f40('0x39'),_0x351ac5['message']);}};Acw['prototype'][_0x3f40('0x3a')]=function(_0x2755ef){try{if(this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]]&&(this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]][_0x3f40('0x3')]||this[_0x3f40('0x5')][_0x2755ef[_0x3f40('0x30')]]['mandatoryDisposition'])){if(this[_0x3f40('0x6')][_0x2755ef['interface']]){this[_0x3f40('0x8')][_0x2755ef['uniqueid']]={'queue':_0x2755ef[_0x3f40('0x30')],'interface':_0x2755ef[_0x3f40('0x20')],'destlinkedid':_0x2755ef[_0x3f40('0x2a')]};}}}catch(_0x9f700f){logger[_0x3f40('0x1f')](_0x3f40('0x3b'),_0x9f700f[_0x3f40('0x33')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x3bbaf5){try{if(this['voiceQueues'][_0x3bbaf5['queue']]&&(this['voiceQueues'][_0x3bbaf5[_0x3f40('0x30')]][_0x3f40('0x3')]||this[_0x3f40('0x5')][_0x3bbaf5['queue']][_0x3f40('0x3c')])){if(this[_0x3f40('0x6')][_0x3bbaf5['interface']]){this['channels'][_0x3bbaf5[_0x3f40('0x1a')]]={'queue':_0x3bbaf5[_0x3f40('0x30')],'interface':_0x3bbaf5['interface']};}}}catch(_0x2a42c8){logger['error'](_0x3f40('0x3d'),_0x2a42c8[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0xc')]=function(_0x3fbfb0){try{if(this[_0x3f40('0x8')][_0x3fbfb0['uniqueid']]&&_['isUndefined'](this['channels'][_0x3fbfb0[_0x3f40('0x1a')]][_0x3f40('0x29')])){logger[_0x3f40('0x1c')](_0x3f40('0x3e'),_0x3fbfb0[_0x3f40('0x1a')]);this[_0x3f40('0x3f')](_0x3fbfb0[_0x3f40('0x1a')]);}else if(this[_0x3f40('0x8')][_0x3fbfb0[_0x3f40('0x40')]]&&_[_0x3f40('0x41')](this[_0x3f40('0x8')][_0x3fbfb0['linkedid']]['attended'])){logger['info'](_0x3f40('0x42'),_0x3fbfb0[_0x3f40('0x40')]);this[_0x3f40('0x3f')](_0x3fbfb0['linkedid']);}}catch(_0x420b4e){logger[_0x3f40('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x420b4e[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')][_0x3f40('0xd')]=function(_0x7189eb){try{if(this['channels'][_0x7189eb[_0x3f40('0x1a')]]&&this[_0x3f40('0x8')][_0x7189eb[_0x3f40('0x1a')]][_0x3f40('0x29')]){logger[_0x3f40('0x1c')](_0x3f40('0x43'),_0x7189eb[_0x3f40('0x1a')]);this[_0x3f40('0x3f')](_0x7189eb[_0x3f40('0x1a')]);}else if(this['channels'][_0x7189eb[_0x3f40('0x40')]]&&this[_0x3f40('0x8')][_0x7189eb['linkedid']]['attended']){logger[_0x3f40('0x1c')](_0x3f40('0x44'),_0x7189eb[_0x3f40('0x40')]);this[_0x3f40('0x3f')](_0x7189eb['linkedid']);}}catch(_0x1c9fac){logger[_0x3f40('0x1f')]('[ACW][syncHangup]\x20%s',_0x1c9fac['message']);}};Acw[_0x3f40('0x15')][_0x3f40('0x45')]=function(_0x300235){try{if(!_[_0x3f40('0x46')](this[_0x3f40('0x8')][_0x300235['transfereeuniqueid']])){this[_0x3f40('0x3f')](_0x300235[_0x3f40('0x47')]);if(this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]]){this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]]['attended']=!![];this[_0x3f40('0x8')][_0x300235[_0x3f40('0x49')]]=this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]];delete this[_0x3f40('0x8')][_0x300235[_0x3f40('0x48')]];}}else if(!_['isNil'](this[_0x3f40('0x8')][_0x300235['transfertargetuniqueid']])){this[_0x3f40('0x3f')](_0x300235['transfertargetuniqueid']);if(this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]]){this[_0x3f40('0x8')][_0x300235['origtransfereruniqueid']][_0x3f40('0x29')]=!![];this[_0x3f40('0x8')][_0x300235[_0x3f40('0x47')]]=this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]];delete this[_0x3f40('0x8')][_0x300235[_0x3f40('0x4a')]];}}}catch(_0x368fb8){logger['error'](_0x3f40('0x4b'),_0x368fb8[_0x3f40('0x33')]);}};Acw[_0x3f40('0x15')]['syncBlindTransfer']=function(_0x468d77){try{if(this[_0x3f40('0x8')][_0x468d77[_0x3f40('0x4c')]]){logger[_0x3f40('0x1c')](_0x3f40('0x4d'),JSON[_0x3f40('0x4e')](_0x468d77[_0x3f40('0x4c')]));this[_0x3f40('0x3f')](_0x468d77['transfereruniqueid']);}else if(this[_0x3f40('0x8')][_0x468d77[_0x3f40('0x4f')]]){logger[_0x3f40('0x1c')](_0x3f40('0x50'),JSON[_0x3f40('0x4e')](_0x468d77['transfererlinkedid']));this[_0x3f40('0x3f')](_0x468d77[_0x3f40('0x4f')]);}}catch(_0x46b8f8){logger[_0x3f40('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x46b8f8[_0x3f40('0x33')]);}};Acw['prototype'][_0x3f40('0xf')]=function(_0x52ad66){try{if(this[_0x3f40('0x5')][_0x52ad66[_0x3f40('0x30')]]&&this[_0x3f40('0x5')][_0x52ad66[_0x3f40('0x30')]][_0x3f40('0x51')]===_0x3f40('0x52')){if(this[_0x3f40('0x6')][_0x52ad66[_0x3f40('0x20')]]){logger[_0x3f40('0x1c')](_0x3f40('0x53'),_0x52ad66[_0x3f40('0x1a')],_0x52ad66[_0x3f40('0x20')],_0x52ad66[_0x3f40('0x30')]);return RpcUser[_0x3f40('0x2b')](this[_0x3f40('0x6')][_0x52ad66['interface']],_0x3f40('0x54'),_0x52ad66[_0x3f40('0x1a')]);}}}catch(_0x1e0c6c){logger[_0x3f40('0x1f')](_0x3f40('0x55'),_0x1e0c6c[_0x3f40('0x33')]);}};module[_0x3f40('0x56')]=Acw; \ No newline at end of file +var _0xb2ef=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','error','[%s][UPDATE][ERRORS:%s]','prototype','startAcw','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','agents','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','stopAcw','format','queue','catch','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','ACW','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause'];(function(_0x5ec9ca,_0x114fd2){var _0x198a45=function(_0x19312d){while(--_0x19312d){_0x5ec9ca['push'](_0x5ec9ca['shift']());}};_0x198a45(++_0x114fd2);}(_0xb2ef,0x11a));var _0xfb2e=function(_0x9ac948,_0x4022fc){_0x9ac948=_0x9ac948-0x0;var _0x2a4bd8=_0xb2ef[_0x9ac948];return _0x2a4bd8;};'use strict';var _=require(_0xfb2e('0x0'));var moment=require(_0xfb2e('0x1'));var ami=require(_0xfb2e('0x2'));var logger=require(_0xfb2e('0x3'))(_0xfb2e('0x4'));var RpcUser=require(_0xfb2e('0x5'));var RpcVoiceAgentReport=require(_0xfb2e('0x6'));function Acw(_0x4adc0b){this[_0xfb2e('0x7')]=_0x4adc0b[_0xfb2e('0x7')];this['agents']=_0x4adc0b['agents'];this['timers']=_0x4adc0b[_0xfb2e('0x8')];this[_0xfb2e('0x9')]={};ami['on'](_0xfb2e('0xa'),this[_0xfb2e('0xb')][_0xfb2e('0xc')](this));ami['on'](_0xfb2e('0xd'),this[_0xfb2e('0xe')][_0xfb2e('0xc')](this));ami['on'](_0xfb2e('0xf'),this['syncHangup']['bind'](this));ami['on'](_0xfb2e('0x10'),this[_0xfb2e('0x11')][_0xfb2e('0xc')](this));ami['on'](_0xfb2e('0x12'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xfb2e('0x13'),this[_0xfb2e('0x14')][_0xfb2e('0xc')](this));ami['on'](_0xfb2e('0x15'),this[_0xfb2e('0x16')][_0xfb2e('0xc')](this));}function getDiff(_0x425423){var _0x190684=moment()['milliseconds'](0x0);var _0x2082ef=moment(_0x425423)[_0xfb2e('0x17')](0x0);return _0x190684[_0xfb2e('0x18')](_0x2082ef,_0xfb2e('0x19'));}Acw['prototype'][_0xfb2e('0x1a')]=function(_0x3698f8,_0x2b3370){var _0x4af26e=this;var _0x254c70=getDiff(_0x4af26e[_0xfb2e('0x8')][_0x3698f8][_0xfb2e('0x1b')]);clearTimeout(_0x4af26e[_0xfb2e('0x8')][_0x3698f8]['timer']);_0x4af26e['timers'][_0x3698f8][_0xfb2e('0x1c')]=![];return RpcVoiceAgentReport[_0xfb2e('0x1d')]({'acwtime':_0x254c70},_0x4af26e[_0xfb2e('0x8')][_0x3698f8][_0xfb2e('0x1e')],_0x3698f8)[_0xfb2e('0x1f')](function(_0x3cd30f){logger[_0xfb2e('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x2b3370,_0x254c70,_0x3cd30f);})['catch'](function(_0x4369b0){logger[_0xfb2e('0x21')](_0xfb2e('0x22'),_0x2b3370,_0x4369b0);})['finally'](function(){delete _0x4af26e[_0xfb2e('0x8')][_0x3698f8];});};Acw[_0xfb2e('0x23')][_0xfb2e('0x24')]=function(_0x3df4c7){try{var _0x35fcdf=this;var _0x1afc69=this[_0xfb2e('0x9')][_0x3df4c7][_0xfb2e('0x25')];var _0x8d557f=this[_0xfb2e('0x9')][_0x3df4c7]['queue'];var _0x4f0421=this[_0xfb2e('0x7')][_0x8d557f];var _0x28cbd9=![];var _0xdbdabe='ACW';if(_0x4f0421[_0xfb2e('0x26')]&&_0x4f0421[_0xfb2e('0x27')][_0xfb2e('0x28')]){_0x28cbd9=!![];_0xdbdabe=_0x4f0421[_0xfb2e('0x27')]['name'];}return ami[_0xfb2e('0x29')]({'action':_0xfb2e('0x2a'),'interface':_0x1afc69,'paused':!![],'reason':_0xdbdabe})[_0xfb2e('0x1f')](function(){if(_0x35fcdf['agents'][_0x1afc69]){return RpcUser[_0xfb2e('0x2b')](_0x35fcdf[_0xfb2e('0x2c')][_0x1afc69]['id'])[_0xfb2e('0x1f')](function(_0x4b18a4){if(!_0x4b18a4||_0x4b18a4[_0xfb2e('0x2d')]){logger[_0xfb2e('0x20')](_0xfb2e('0x2e'),_0x3df4c7,_0x1afc69,_0x8d557f);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x3df4c7,_0x1afc69,_0x8d557f);var _0x200157=_0x35fcdf[_0xfb2e('0x9')][_0x3df4c7][_0xfb2e('0x2f')]&&_0x35fcdf[_0xfb2e('0x9')][_0x3df4c7][_0xfb2e('0x30')]?_0x35fcdf['channels'][_0x3df4c7][_0xfb2e('0x30')]:_0x3df4c7;return RpcUser[_0xfb2e('0x31')](_0x35fcdf[_0xfb2e('0x2c')][_0x1afc69],_0xdbdabe,_0x200157)[_0xfb2e('0x1f')](function(_0x48df4e){_0x35fcdf[_0xfb2e('0x7')][_0x8d557f][_0xfb2e('0x32')]-=0x1;_0x35fcdf[_0xfb2e('0x7')][_0x8d557f][_0xfb2e('0x33')]+=0x1;return _0x48df4e;});})[_0xfb2e('0x1f')](function(_0x18425c){if(_0x28cbd9||!_0x18425c){return;}_0x35fcdf[_0xfb2e('0x8')][_0x1afc69]={};logger[_0xfb2e('0x20')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3df4c7,_0x35fcdf[_0xfb2e('0x7')][_0x8d557f][_0xfb2e('0x34')],_0x1afc69,_0x8d557f);_0x35fcdf[_0xfb2e('0x8')][_0x1afc69][_0xfb2e('0x1c')]=setTimeout(_0x35fcdf[_0xfb2e('0x35')]['bind'](_0x35fcdf,_0x1afc69),_0x35fcdf['voiceQueues'][_0x8d557f][_0xfb2e('0x34')]*0x3e8);_0x35fcdf[_0xfb2e('0x8')][_0x1afc69][_0xfb2e('0x1b')]=moment()[_0xfb2e('0x36')]('YYYY-MM-DD\x20HH:mm:ss');_0x35fcdf['timers'][_0x1afc69]['uniqueid']=_0x3df4c7;_0x35fcdf['timers'][_0x1afc69][_0xfb2e('0x37')]=_0x8d557f;_0x35fcdf['timers'][_0x1afc69]['updateAcw']=_0x35fcdf['updateAcw'][_0xfb2e('0xc')](_0x35fcdf,_0x1afc69,_0x3df4c7);});}})[_0xfb2e('0x38')](function(){logger[_0xfb2e('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3df4c7,_0x35fcdf['voiceQueues'][_0x8d557f][_0xfb2e('0x34')],_0x1afc69,_0x8d557f);})[_0xfb2e('0x39')](function(){delete _0x35fcdf[_0xfb2e('0x9')][_0x3df4c7];});}catch(_0x3caeda){logger[_0xfb2e('0x21')](_0xfb2e('0x3a'),_0x3caeda[_0xfb2e('0x3b')]);}};Acw['prototype']['stopAcw']=function(_0x34d3c6){try{var _0x12fcf6=this;if(_0x12fcf6['timers'][_0x34d3c6]){_0x12fcf6[_0xfb2e('0x8')][_0x34d3c6][_0xfb2e('0x1c')]=![];var _0x3a9727=_0x12fcf6[_0xfb2e('0x8')][_0x34d3c6][_0xfb2e('0x1e')];var _0x3ca868=_0x12fcf6[_0xfb2e('0x8')][_0x34d3c6][_0xfb2e('0x37')];var _0x4d095f=_0x12fcf6[_0xfb2e('0x7')][_0x3ca868]['acwTimeout'];logger[_0xfb2e('0x20')](_0xfb2e('0x3c'),_0x3a9727,_0x34d3c6);RpcUser['getAgent'](this[_0xfb2e('0x2c')][_0x34d3c6]['id'])[_0xfb2e('0x1f')](function(_0x5dd193){if(_0x5dd193[_0xfb2e('0x3d')]===_0xfb2e('0x3e')){return RpcUser[_0xfb2e('0x3f')](_0x12fcf6[_0xfb2e('0x2c')][_0x34d3c6]);}});RpcVoiceAgentReport['update']({'acwtime':_0x4d095f,'agentacw':!![]},_0x3a9727,_0x34d3c6)[_0xfb2e('0x1f')](function(_0x44949e){logger[_0xfb2e('0x20')](_0xfb2e('0x40'),_0x3a9727,_0x4d095f,_0x44949e);})[_0xfb2e('0x38')](function(_0xaeb9ad){logger[_0xfb2e('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x3a9727,_0xaeb9ad);});}else{logger['error'](_0xfb2e('0x41'),_0x34d3c6);if(_0x12fcf6[_0xfb2e('0x8')]){logger[_0xfb2e('0x20')](_0xfb2e('0x42'),JSON[_0xfb2e('0x43')](_0x12fcf6[_0xfb2e('0x8')]));}}}catch(_0x29c1c7){logger[_0xfb2e('0x21')](_0xfb2e('0x44'),_0x29c1c7['message']);}};Acw[_0xfb2e('0x23')][_0xfb2e('0xb')]=function(_0x2e8bcc){try{if(this[_0xfb2e('0x7')][_0x2e8bcc[_0xfb2e('0x37')]]&&(this[_0xfb2e('0x7')][_0x2e8bcc[_0xfb2e('0x37')]][_0xfb2e('0x4')]||this[_0xfb2e('0x7')][_0x2e8bcc['queue']][_0xfb2e('0x26')])){if(this[_0xfb2e('0x2c')][_0x2e8bcc[_0xfb2e('0x25')]]){this[_0xfb2e('0x9')][_0x2e8bcc[_0xfb2e('0x1e')]]={'queue':_0x2e8bcc[_0xfb2e('0x37')],'interface':_0x2e8bcc['interface'],'destlinkedid':_0x2e8bcc['destlinkedid']};}}}catch(_0x4ba617){logger[_0xfb2e('0x21')](_0xfb2e('0x45'),_0x4ba617[_0xfb2e('0x3b')]);}};Acw[_0xfb2e('0x23')][_0xfb2e('0x16')]=function(_0x307625){try{if(this[_0xfb2e('0x7')][_0x307625[_0xfb2e('0x37')]]&&(this[_0xfb2e('0x7')][_0x307625[_0xfb2e('0x37')]][_0xfb2e('0x4')]||this['voiceQueues'][_0x307625[_0xfb2e('0x37')]]['mandatoryDisposition'])){if(this[_0xfb2e('0x2c')][_0x307625[_0xfb2e('0x25')]]){this[_0xfb2e('0x9')][_0x307625['uniqueid']]={'queue':_0x307625['queue'],'interface':_0x307625['interface']};}}}catch(_0x433546){logger[_0xfb2e('0x21')](_0xfb2e('0x46'),_0x433546['message']);}};Acw[_0xfb2e('0x23')]['syncHangupRequest']=function(_0x5def68){try{if(this['channels'][_0x5def68[_0xfb2e('0x1e')]]&&_[_0xfb2e('0x47')](this['channels'][_0x5def68[_0xfb2e('0x1e')]][_0xfb2e('0x2f')])){logger[_0xfb2e('0x20')](_0xfb2e('0x48'),_0x5def68[_0xfb2e('0x1e')]);this[_0xfb2e('0x24')](_0x5def68[_0xfb2e('0x1e')]);}else if(this[_0xfb2e('0x9')][_0x5def68['linkedid']]&&_[_0xfb2e('0x47')](this[_0xfb2e('0x9')][_0x5def68[_0xfb2e('0x49')]]['attended'])){logger['info'](_0xfb2e('0x4a'),_0x5def68[_0xfb2e('0x49')]);this['startAcw'](_0x5def68[_0xfb2e('0x49')]);}}catch(_0x578032){logger['error'](_0xfb2e('0x4b'),_0x578032[_0xfb2e('0x3b')]);}};Acw['prototype'][_0xfb2e('0x4c')]=function(_0x2242ce){try{if(this[_0xfb2e('0x9')][_0x2242ce[_0xfb2e('0x1e')]]&&this[_0xfb2e('0x9')][_0x2242ce[_0xfb2e('0x1e')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2242ce['uniqueid']);this[_0xfb2e('0x24')](_0x2242ce[_0xfb2e('0x1e')]);}else if(this[_0xfb2e('0x9')][_0x2242ce[_0xfb2e('0x49')]]&&this[_0xfb2e('0x9')][_0x2242ce[_0xfb2e('0x49')]][_0xfb2e('0x2f')]){logger[_0xfb2e('0x20')](_0xfb2e('0x4d'),_0x2242ce[_0xfb2e('0x49')]);this['startAcw'](_0x2242ce[_0xfb2e('0x49')]);}}catch(_0x2af6ee){logger[_0xfb2e('0x21')](_0xfb2e('0x4e'),_0x2af6ee['message']);}};Acw[_0xfb2e('0x23')][_0xfb2e('0x4f')]=function(_0x4bbe1b){try{if(!_[_0xfb2e('0x50')](this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x51')]])){this[_0xfb2e('0x24')](_0x4bbe1b[_0xfb2e('0x51')]);if(this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x52')]]){this['channels'][_0x4bbe1b['secondtransfereruniqueid']][_0xfb2e('0x2f')]=!![];this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x53')]]=this[_0xfb2e('0x9')][_0x4bbe1b['secondtransfereruniqueid']];delete this[_0xfb2e('0x9')][_0x4bbe1b['secondtransfereruniqueid']];}}else if(!_[_0xfb2e('0x50')](this['channels'][_0x4bbe1b[_0xfb2e('0x53')]])){this[_0xfb2e('0x24')](_0x4bbe1b[_0xfb2e('0x53')]);if(this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x54')]]){this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x54')]]['attended']=!![];this['channels'][_0x4bbe1b[_0xfb2e('0x51')]]=this[_0xfb2e('0x9')][_0x4bbe1b['origtransfereruniqueid']];delete this[_0xfb2e('0x9')][_0x4bbe1b[_0xfb2e('0x54')]];}}}catch(_0x5dbb5d){logger[_0xfb2e('0x21')](_0xfb2e('0x55'),_0x5dbb5d[_0xfb2e('0x3b')]);}};Acw[_0xfb2e('0x23')]['syncBlindTransfer']=function(_0xf66d20){try{if(this[_0xfb2e('0x9')][_0xf66d20[_0xfb2e('0x56')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xfb2e('0x43')](_0xf66d20[_0xfb2e('0x56')]));this[_0xfb2e('0x24')](_0xf66d20[_0xfb2e('0x56')]);}else if(this[_0xfb2e('0x9')][_0xf66d20[_0xfb2e('0x57')]]){logger[_0xfb2e('0x20')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xfb2e('0x43')](_0xf66d20['transfererlinkedid']));this[_0xfb2e('0x24')](_0xf66d20[_0xfb2e('0x57')]);}}catch(_0x39f039){logger[_0xfb2e('0x21')](_0xfb2e('0x58'),_0x39f039['message']);}};Acw[_0xfb2e('0x23')][_0xfb2e('0x11')]=function(_0x48960d){try{if(this[_0xfb2e('0x7')][_0x48960d[_0xfb2e('0x37')]]&&this[_0xfb2e('0x7')][_0x48960d[_0xfb2e('0x37')]][_0xfb2e('0x59')]==='all'){if(this['agents'][_0x48960d[_0xfb2e('0x25')]]){logger[_0xfb2e('0x20')](_0xfb2e('0x5a'),_0x48960d[_0xfb2e('0x1e')],_0x48960d[_0xfb2e('0x25')],_0x48960d[_0xfb2e('0x37')]);return RpcUser['savePause'](this[_0xfb2e('0x2c')][_0x48960d[_0xfb2e('0x25')]],'Auto-Pause',_0x48960d[_0xfb2e('0x1e')]);}}}catch(_0x343b8d){logger['error'](_0xfb2e('0x5b'),_0x343b8d['message']);}};module[_0xfb2e('0x5c')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d6f592f..57007ea 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 _0xfb15=['port','username','keepConnected','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','format','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','../../config/environment','asterisk'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xfb15,0x97));var _0x5fb1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfb15[_0x4cf98e];return _0x1623ac;};'use strict';var Manager=require(_0x5fb1('0x0'));var BPromise=require(_0x5fb1('0x1'));var util=require('util');var logger=require('../../config/logger')('ami');var config=require(_0x5fb1('0x2'));var ami=new Manager(config[_0x5fb1('0x3')][_0x5fb1('0x4')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['password'],!![]);ami[_0x5fb1('0x6')]();ami['Action']=BPromise[_0x5fb1('0x7')](ami['action']);function error(_0x1d3a5a){logger[_0x5fb1('0x8')](util['format'](_0x5fb1('0x9'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')]['port'],util['inspect'](_0x1d3a5a,![],null)));}function close(){logger['error'](util['format'](_0x5fb1('0xa'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x4')]));}ami[_0x5fb1('0xb')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':'sipshowregistry'});};};ami[_0x5fb1('0xd')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0xe')});};};ami[_0x5fb1('0xf')]=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0x10')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x5fb1('0xc')]({'action':_0x5fb1('0x11')});};};function connect(){logger[_0x5fb1('0x12')](util['format'](_0x5fb1('0x13'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config['asterisk'][_0x5fb1('0x4')]));ami[_0x5fb1('0x14')]('error',error);ami['once']('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x38229d){logger['info'](util[_0x5fb1('0x15')](_0x5fb1('0x16'),config[_0x5fb1('0x3')][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config[_0x5fb1('0x3')][_0x5fb1('0x4')],util[_0x5fb1('0x17')](_0x38229d,![],null)));});ami['on'](_0x5fb1('0x18'),function(){logger[_0x5fb1('0x12')](util[_0x5fb1('0x15')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x5fb1('0x5')],config[_0x5fb1('0x3')]['ip'],config['asterisk']['port']));return Promise['resolve']()[_0x5fb1('0x19')](ami['actionSipShowRegistry']())[_0x5fb1('0x19')](ami[_0x5fb1('0xd')]())[_0x5fb1('0x19')](ami['actionSipPeerStatus']())['then'](ami[_0x5fb1('0xf')]())[_0x5fb1('0x19')](ami[_0x5fb1('0x1a')]())[_0x5fb1('0x1b')](function(_0x133a5c){logger[_0x5fb1('0x8')](_0x5fb1('0x1c'),util[_0x5fb1('0x17')](_0x133a5c,{'showHidden':![],'depth':null}));});});ami[_0x5fb1('0x14')](_0x5fb1('0x8'),error);ami[_0x5fb1('0x14')](_0x5fb1('0x1d'),close);module[_0x5fb1('0x1e')]=ami; \ No newline at end of file +var _0x6140=['actionSipPeerStatus','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','asterisk','port','password','keepConnected','Action','error','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionCoreShowChannels','coreshowchannels','info','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','resolve','then'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x6140,0x143));var _0x0614=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0x6140[_0x3e618a];return _0x1f3d61;};'use strict';var Manager=require(_0x0614('0x0'));var BPromise=require(_0x0614('0x1'));var util=require(_0x0614('0x2'));var logger=require('../../config/logger')(_0x0614('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x0614('0x4')][_0x0614('0x5')],config[_0x0614('0x4')]['ip'],config['asterisk']['username'],config[_0x0614('0x4')][_0x0614('0x6')],!![]);ami[_0x0614('0x7')]();ami[_0x0614('0x8')]=BPromise['promisify'](ami['action']);function error(_0x3f2fce){logger[_0x0614('0x9')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x0614('0xa')],config[_0x0614('0x4')]['ip'],config[_0x0614('0x4')][_0x0614('0x5')],util[_0x0614('0xb')](_0x3f2fce,![],null)));}function close(){logger[_0x0614('0x9')](util[_0x0614('0xc')](_0x0614('0xd'),config[_0x0614('0x4')][_0x0614('0xa')],config[_0x0614('0x4')]['ip'],config[_0x0614('0x4')][_0x0614('0x5')]));}ami[_0x0614('0xe')]=function(){return function(){return ami['Action']({'action':_0x0614('0xf')});};};ami[_0x0614('0x10')]=function(){return function(){return ami['Action']({'action':_0x0614('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x0614('0x8')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x0614('0x12')]=function(){return function(){return ami['Action']({'action':_0x0614('0x13')});};};function connect(){logger[_0x0614('0x14')](util[_0x0614('0xc')](_0x0614('0x15'),config[_0x0614('0x4')][_0x0614('0xa')],config[_0x0614('0x4')]['ip'],config[_0x0614('0x4')][_0x0614('0x5')]));ami[_0x0614('0x16')](_0x0614('0x9'),error);ami[_0x0614('0x16')](_0x0614('0x17'),close);}ami['on'](_0x0614('0x18'),connect);ami['on'](_0x0614('0x19'),function(_0x2cb073){logger[_0x0614('0x14')](util[_0x0614('0xc')](_0x0614('0x1a'),config[_0x0614('0x4')][_0x0614('0xa')],config[_0x0614('0x4')]['ip'],config[_0x0614('0x4')][_0x0614('0x5')],util[_0x0614('0xb')](_0x2cb073,![],null)));});ami['on']('fullybooted',function(){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0614('0x4')][_0x0614('0xa')],config[_0x0614('0x4')]['ip'],config['asterisk']['port']));return Promise[_0x0614('0x1b')]()[_0x0614('0x1c')](ami['actionSipShowRegistry']())[_0x0614('0x1c')](ami[_0x0614('0x10')]())['then'](ami[_0x0614('0x1d')]())[_0x0614('0x1c')](ami['actionQueueSummary']())[_0x0614('0x1c')](ami['actionCoreShowChannels']())['catch'](function(_0xebb310){logger[_0x0614('0x9')](_0x0614('0x1e'),util[_0x0614('0xb')](_0xebb310,{'showHidden':![],'depth':null}));});});ami['once'](_0x0614('0x9'),error);ami[_0x0614('0x16')](_0x0614('0x17'),close);module[_0x0614('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 94dfc78..eee4770 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x9bde,0xe1));var _0xe9bd=function(_0x40f7b8,_0x3c6c47){_0x40f7b8=_0x40f7b8-0x0;var _0x486978=_0x9bde[_0x40f7b8];return _0x486978;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 1d0c152..42b5e0f 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 _0xbf01=['countabandonedretry','countglobal','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','channel','actionid','strategy','isNil','locked','stateinterface','paused','rrmemory','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','HANGUP','saveInDb','[syncHangupInAMDIvr]','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','getVoiceQueueRtPauses','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','./utils/hopper','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','[getContactDialer2][Empty]','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','then','content','true','command','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','predictive','progressive','power','dialPowerLevel','handlePower','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','silly','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','syncAgentComplete','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT'];(function(_0x2ed13c,_0x190337){var _0x10cf06=function(_0x2d95cc){while(--_0x2d95cc){_0x2ed13c['push'](_0x2ed13c['shift']());}};_0x10cf06(++_0x190337);}(_0xbf01,0x13e));var _0x1bf0=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xbf01[_0x54eab6];return _0x1e7435;};'use strict';var util=require(_0x1bf0('0x0'));var _=require(_0x1bf0('0x1'));var uuid=require(_0x1bf0('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x1bf0('0x3'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x1bf0('0x4'))(_0x1bf0('0x5'));var loggerBooked=require('../../../config/logger')(_0x1bf0('0x6'));var loggerPredictive=require(_0x1bf0('0x4'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x1bf0('0x4'))(_0x1bf0('0x7'));var ami=require(_0x1bf0('0x8'));config[_0x1bf0('0x9')]=_['defaults'](config[_0x1bf0('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x1bf0('0xa'))(new Redis(config[_0x1bf0('0x9')]));var cmHopper=require(_0x1bf0('0xb'));var voiceQueueRt=require(_0x1bf0('0xc'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x1bf0('0xd'));var History=require('./models/history');var Final=require(_0x1bf0('0xe'));var AgentComplete=require(_0x1bf0('0xf'));var QueueCallerAbandon=require(_0x1bf0('0x10'));var Hangup=require(_0x1bf0('0x11'));var ipAgi=process[_0x1bf0('0x12')][_0x1bf0('0x13')]||_0x1bf0('0x14');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1bf0('0x15')]['enqueue']=function(_0x4900fc){this[_0x1bf0('0x16')]=this[_0x1bf0('0x16')]?this[_0x1bf0('0x16')][_0x1bf0('0x17')](_0x4900fc):_0x4900fc();};function Dialer(_0x23a833,_0x180a07){this[_0x1bf0('0x18')]=new Sequence();this['preview']=_0x180a07;this[_0x1bf0('0x19')]=_0x23a833[_0x1bf0('0x19')];this[_0x1bf0('0x1a')]=_0x23a833[_0x1bf0('0x1a')];this[_0x1bf0('0x1b')]=_0x23a833[_0x1bf0('0x1b')];this['trunks']=_0x23a833[_0x1bf0('0x1c')];this[_0x1bf0('0x1d')]=config[_0x1bf0('0x1d')]||0x2;this[_0x1bf0('0x1e')]={};this[_0x1bf0('0x1f')]={};this[_0x1bf0('0x20')]={};this[_0x1bf0('0x21')]={};this[_0x1bf0('0x22')]={};this[_0x1bf0('0x23')]={};this[_0x1bf0('0x24')]={};this[_0x1bf0('0x25')]={};this[_0x1bf0('0x26')]={};this['queueBookedRR']={};this[_0x1bf0('0x27')]={};ami['on'](_0x1bf0('0x28'),this[_0x1bf0('0x29')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x2b'),this[_0x1bf0('0x2c')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x2d'),this[_0x1bf0('0x2e')]['bind'](this));ami['on'](_0x1bf0('0x2f'),this['syncAgentComplete'][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x30'),this[_0x1bf0('0x7')][_0x1bf0('0x2a')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x1bf0('0x31'),this[_0x1bf0('0x32')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x33'),this[_0x1bf0('0x34')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x35'),this[_0x1bf0('0x36')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x37'),this[_0x1bf0('0x38')][_0x1bf0('0x2a')](this));ami['on'](_0x1bf0('0x39'),this[_0x1bf0('0x3a')][_0x1bf0('0x2a')](this));this[_0x1bf0('0x3b')]();this[_0x1bf0('0x3c')]();RpcSetting[_0x1bf0('0x3d')]()['then'](function(_0x276be7){previewRecallmeReminderInterval=_0x276be7['previewRecallmeReminderInterval'];});}function isNotNull(_0x604705){return _0x604705!==null&&!_[_0x1bf0('0x3e')](_0x604705);}function msgResponse(_0x274a84,_0x32713f,_0x17100d){return{'action':_0x274a84,'response':_0x32713f,'message':_0x17100d,'stack':_0x17100d};}function emit(_0x3738b0,_0x5de0b6,_0x3c8562){io['to'](_0x3738b0)['emit'](_0x5de0b6,_0x3c8562);}function emitOutboundVoiceQueueSummary(_0x281011){if(_0x281011[_0x1bf0('0x3f')]==='outbound'){logger[_0x1bf0('0x40')](_0x1bf0('0x41'),util[_0x1bf0('0x42')](_0x281011,{'showHidden':![],'depth':null}));emit(util[_0x1bf0('0x43')]('voice:queue:%s',_0x281011['name']),_0x1bf0('0x44'),_0x281011);}}function checkGetDataPredictive(_0x5e795a){if(isNotNull(_0x5e795a)&&!_[_0x1bf0('0x45')](_0x5e795a)){loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x47'));loggerPredictive['info'](_0x1bf0('0x48'),_0x5e795a[_0x1bf0('0x49')]);loggerPredictive['info'](_0x1bf0('0x4a'),_0x5e795a['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x1bf0('0x46')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e795a['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x1bf0('0x4b'),_0x5e795a[_0x1bf0('0x4c')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x4d'),_0x5e795a['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x1bf0('0x4e'),_0x5e795a[_0x1bf0('0x4f')]);loggerPredictive['info']('---------------------------');if(_0x5e795a[_0x1bf0('0x49')]>0x0){if(!_[_0x1bf0('0x3e')](_0x5e795a[_0x1bf0('0x4f')])&&_0x5e795a['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x50'));if(!_[_0x1bf0('0x3e')](_0x5e795a[_0x1bf0('0x51')])&&_0x5e795a[_0x1bf0('0x51')]>0x0){return!![];}loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x52'));}else{loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x53'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x583409){return function(_0xafed9c){loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x54'));loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x55'),_0xafed9c[_0x1bf0('0x56')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x57'),_0xafed9c[_0x1bf0('0x58')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x59'),_0xafed9c[_0x1bf0('0x5a')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5b'),_0xafed9c[_0x1bf0('0x5c')]);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x59'),_0xafed9c[_0x1bf0('0x5a')]);loggerPredictive['info'](_0x1bf0('0x5d'));_[_0x1bf0('0x5e')](_0x583409,_0xafed9c);};}function ifInterval(_0x59de75,_0x4a4c89){if(_[_0x1bf0('0x3e')](_0x4a4c89)){return![];}return utils[_0x1bf0('0x5f')](undefined,_0x4a4c89)<_0x59de75*0x3c;}function clearPredictiveAttributes(_0x22538e){if(_0x22538e[_0x1bf0('0x24')]){_0x22538e[_0x1bf0('0x24')]=undefined;loggerPredictive[_0x1bf0('0x40')](_0x22538e[_0x1bf0('0x60')],_0x1bf0('0x61'));}if(_0x22538e[_0x1bf0('0x23')]){_0x22538e[_0x1bf0('0x23')]=undefined;loggerPredictive['debug'](_0x22538e['name'],_0x1bf0('0x62'));}if(_0x22538e[_0x1bf0('0x63')]){clearInterval(_0x22538e[_0x1bf0('0x63')]);_0x22538e[_0x1bf0('0x63')]=undefined;loggerPredictive['debug'](_0x22538e[_0x1bf0('0x60')],_0x1bf0('0x64'));}}function loggerCatchPredictive(_0x2f3c23,_0x4e72cb){return function(_0x5a4c94){loggerPredictive[_0x1bf0('0x65')](_0x4e72cb[_0x1bf0('0x60')],_0x2f3c23);loggerPredictive[_0x1bf0('0x65')](_0x5a4c94[_0x1bf0('0x66')]);clearPredictiveAttributes(_0x4e72cb);};}function loggerCatch(_0x368a6d){return function(_0x2cc783){logger[_0x1bf0('0x65')](_0x368a6d,util[_0x1bf0('0x42')](_0x2cc783,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5b4427,_0x4a63be,_0x431992){return function(_0x2d69f9){utils[_0x1bf0('0x67')](_0x4a63be,_0x431992,0x0);_0x4a63be[_0x1bf0('0x68')]=0x0;logger[_0x1bf0('0x65')](_0x5b4427,util[_0x1bf0('0x42')](_0x2d69f9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x10a915){return function(_0x5333b4){if(isNotNull(_0x5333b4)&&isNotNull(_0x5333b4[0x0])){if(_0x5333b4[0x0][_0x1bf0('0x69')]>0x0){_0x10a915['message']=utils[_0x1bf0('0x6a')][_0x1bf0('0x6b')];logger[_0x1bf0('0x46')](_0x1bf0('0x6c')+_0x10a915[_0x1bf0('0x60')],_0x5333b4[0x0][_0x1bf0('0x69')],_0x1bf0('0x6d'));}else{_0x10a915[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x1bf0('0x6f')+_0x10a915[_0x1bf0('0x60')]);}}};}function createObjHistory(_0x438d88,_0x4d9565,_0x368a26,_0x1f662e,_0x5845ff){_0x438d88['message']=_0x368a26;var _0xeba9dc=new Action(_0x438d88,_0x4d9565);var _0x5b9f9d=new History(_0xeba9dc);_0x5b9f9d['state']=_0x1f662e;_0x5b9f9d[_0x1bf0('0x70')]=_0x5845ff;_0x5b9f9d[_0x1bf0('0x71')]=_0xeba9dc[_0x1bf0('0x72')];return _0x5b9f9d;}function unlockQueueStatus(_0x593cdd,_0x9b6dd6){setTimeout(function(){if(_[_0x1bf0('0x3e')](_0x593cdd['queueStatusComplete'])){loggerBooked[_0x1bf0('0x65')](_0x1bf0('0x73'),_0x9b6dd6);}_0x593cdd[_0x1bf0('0x74')]=!![];loggerBooked[_0x1bf0('0x46')](_0x1bf0('0x75'),_0x9b6dd6,JSON[_0x1bf0('0x76')](_[_0x1bf0('0x77')](_0x593cdd,['name',_0x1bf0('0x74')])));},0x1f3);}function checkInterval(_0x532968){return function(){if(!isNotNull(_0x532968[_0x1bf0('0x78')])){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x532968[_0x1bf0('0x78')][_0x1bf0('0x7a')])){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968[_0x1bf0('0x60')]+_0x1bf0('0x7b');}if(!isNotNull(_[_0x1bf0('0x45')](_0x532968[_0x1bf0('0x78')][_0x1bf0('0x7a')]))){_0x532968[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];throw _0x532968[_0x1bf0('0x60')]+_0x1bf0('0x7b');}};}function checkIsIVRCampaignActive(_0x442177){return function(){if(!utils['isIVRCampaignActive'](_0x442177)){_0x442177[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x7c')];throw _0x442177[_0x1bf0('0x60')]+_0x1bf0('0x7d');}};}function emitCampaignSummary(_0x200c2b){if(utils[_0x1bf0('0x7e')](_0x200c2b)){emit(util[_0x1bf0('0x43')]('campaign:ivr:%s',_0x200c2b[_0x1bf0('0x60')]),'campaign:save',_0x200c2b);}}function loggerCatchQueueSummary(_0x51f7d1,_0x2ad73d){return function(_0x2c8398){clearPredictiveAttributes(_0x2ad73d);emitCampaignSummary(_0x2ad73d);loggerSyncQueueSummary[_0x1bf0('0x40')](_0x51f7d1,util[_0x1bf0('0x42')](_0x2c8398,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5eb01f){if(_0x5eb01f[_0x1bf0('0x7f')]){if(_0x5eb01f[_0x1bf0('0x80')]===0x0){_0x5eb01f[_0x1bf0('0x7f')]=![];_0x5eb01f[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0x1bf0('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5eb01f['name'],_0x1bf0('0x81'));}else{_0x5eb01f[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0x1bf0('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5eb01f['name'],_0x1bf0('0x82'));}emitCampaignSummary(_0x5eb01f);}}function myreject(_0x6a09f5){return function(_0x160c7f){return _0x6a09f5(msgResponse(_0x1bf0('0x83'),_0x1bf0('0x84'),JSON[_0x1bf0('0x76')](_0x160c7f)));};}Dialer[_0x1bf0('0x15')][_0x1bf0('0x85')]=function(_0x4184d0){return!_[_0x1bf0('0x3e')](_0x4184d0)&&_0x4184d0&&!_[_0x1bf0('0x3e')](_0x4184d0[_0x1bf0('0x60')])&&!_[_0x1bf0('0x3e')](_0x4184d0[_0x1bf0('0x86')])&&_0x4184d0[_0x1bf0('0x86')]&&(this[_0x1bf0('0x1c')][util[_0x1bf0('0x43')]('SIP/%s',_0x4184d0[_0x1bf0('0x60')])][_0x1bf0('0x87')]==='reachable'||this[_0x1bf0('0x1c')][util[_0x1bf0('0x43')](_0x1bf0('0x88'),_0x4184d0['name'])][_0x1bf0('0x87')]===_0x1bf0('0x89'));};Dialer[_0x1bf0('0x15')][_0x1bf0('0x8a')]=function(_0x35eae5){var _0x23391f=this;return function(){if(!_0x23391f[_0x1bf0('0x85')](_0x35eae5[_0x1bf0('0x8b')])){if(!_0x23391f[_0x1bf0('0x85')](_0x35eae5[_0x1bf0('0x8c')])){_0x35eae5[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x8d')];throw _0x35eae5[_0x1bf0('0x60')]+_0x1bf0('0x8e');}}};};Dialer[_0x1bf0('0x15')][_0x1bf0('0x8f')]=function(_0x162a61,_0x2fb735,_0x2410e1,_0x103c58){var _0x205e28=this;return function(){var _0x212b39=!![];return _0x205e28[_0x1bf0('0x90')](_0x162a61,_0x2fb735,_0x2410e1,_0x103c58,_0x212b39);};};Dialer['prototype'][_0x1bf0('0x91')]=function(_0x54f474,_0x4ed4f4,_0xcb7273,_0xb57ae5){var _0x199498=this;return function(){var _0x1289a3=![];return _0x199498[_0x1bf0('0x90')](_0x54f474[_0x1bf0('0x7a')],_0x4ed4f4,_0xcb7273,_0xb57ae5,_0x1289a3);};};Dialer[_0x1bf0('0x15')][_0x1bf0('0x90')]=function(_0x1b9290,_0x8673c8,_0x599f32,_0x1a64f0,_0x386305){var _0x4a2179=[];return new Promise(function(_0x324b9f,_0x8bc8f2){if(!isNotNull(_0x1b9290)){_0x1a64f0[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')][_0x1bf0('0x79')];return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),_0x1bf0('0x93'),_0x599f32+_0x1bf0('0x94')));}if(_['isEmpty'](_0x1b9290)){_0x1a64f0[_0x1bf0('0x6e')]=utils['CAMPAIGN_STATUS'][_0x1bf0('0x95')];return _0x8bc8f2(msgResponse('ifTime',_0x1bf0('0x93'),_0x599f32+_0x1bf0('0x96')));}if(_0x8673c8&&_['isUndefined'](config[_0x1bf0('0x97')][_0x8673c8])){_0x1a64f0['message']=utils[_0x1bf0('0x6a')]['UNKNOWN_TIMEZONE'];return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),'Failure',_0x599f32+_0x1bf0('0x98')+_0x8673c8));}if(_[_0x1bf0('0x99')](_0x1b9290)){for(var _0x243ac9=0x0;_0x243ac9<_0x1b9290[_0x1bf0('0x9a')];_0x243ac9+=0x1){_0x4a2179[_0x1bf0('0x9b')](ami[_0x1bf0('0x9c')]({'action':'command','command':util[_0x1bf0('0x43')](_0x1bf0('0x9d'),_0x1b9290[_0x243ac9]['interval'],!_[_0x1bf0('0x3e')](config[_0x1bf0('0x97')][_0x8673c8])?_0x8673c8:'')})[_0x1bf0('0x9e')](function(_0x134520){return _0x134520[_0x1bf0('0x9f')]['indexOf'](_0x1bf0('0xa0'))>=0x0;})['catch'](myreject(_0x8bc8f2)));}}else{_0x4a2179[_0x1bf0('0x9b')](ami['Action']({'action':_0x1bf0('0xa1'),'command':util[_0x1bf0('0x43')]('iftime\x20%s,%s',_0x1b9290,!_[_0x1bf0('0x3e')](config[_0x1bf0('0x97')][_0x8673c8])?_0x8673c8:'')})[_0x1bf0('0x9e')](function(_0x255771){return _0x255771[_0x1bf0('0x9f')][_0x1bf0('0xa2')]('true')>=0x0;})[_0x1bf0('0xa3')](myreject(_0x8bc8f2)));}Promise[_0x1bf0('0xa4')](_0x4a2179)[_0x1bf0('0x9e')](function(_0x2cfaaf){var _0x27f264=_[_0x1bf0('0xa5')](_0x2cfaaf);if(_0x27f264){return _0x324b9f(_0x27f264);}else{_0x1a64f0['message']=_0x386305?utils[_0x1bf0('0x6a')][_0x1bf0('0xa6')]:utils[_0x1bf0('0x6a')][_0x1bf0('0xa7')];return _0x8bc8f2(msgResponse(_0x1bf0('0xa8'),_0x1bf0('0x93'),_0x1bf0('0xa9')+_0x386305+'\x20'+_0x599f32+_0x1bf0('0xaa')+util[_0x1bf0('0x42')](_0x1b9290,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x8673c8));}})[_0x1bf0('0xa3')](function(_0x199f7a){return _0x8bc8f2(msgResponse(_0x1bf0('0x92'),_0x1bf0('0x93'),JSON[_0x1bf0('0x76')](_0x199f7a)));});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x3b')]=function(){var _0x24af6b=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x24af6b[_0x1bf0('0xab')]();},0x3e8);});};Dialer[_0x1bf0('0x15')][_0x1bf0('0xab')]=function(){var _0x7c28d2=this;var _0x282aa3;for(var _0x9a048e in this['campaigns']){if(typeof this[_0x1bf0('0x1a')][_0x9a048e]!==_0x1bf0('0xac')){_0x282aa3=this[_0x1bf0('0x1a')][_0x9a048e];if(utils[_0x1bf0('0x7e')](_0x282aa3)&&utils[_0x1bf0('0xad')](_0x282aa3)){_0x282aa3[_0x1bf0('0x7f')]=!![];Promise[_0x1bf0('0xae')]()[_0x1bf0('0x9e')](checkIsIVRCampaignActive(_0x282aa3))['then'](checkInterval(_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2['checkIsTrunkReachable'](_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0x8f')](_0x282aa3[_0x1bf0('0xaf')],_0x282aa3[_0x1bf0('0xb0')],_0x282aa3[_0x1bf0('0x60')],_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0x91')](_0x282aa3[_0x1bf0('0x78')],_0x282aa3[_0x1bf0('0xb0')],_0x282aa3[_0x1bf0('0x60')],_0x282aa3))[_0x1bf0('0x9e')](_0x7c28d2[_0x1bf0('0xb1')](_0x282aa3))[_0x1bf0('0xa3')](loggerCatchQueueSummary(_0x1bf0('0xb2'),_0x282aa3));}else{notSendMessagesCampaign(_0x282aa3);}}}};Dialer[_0x1bf0('0x15')]['checkDialMethod']=function(_0x290e6c){if(_0x290e6c[_0x1bf0('0xb3')]!==_0x1bf0('0xb4')){clearPredictiveAttributes(_0x290e6c);}switch(_0x290e6c[_0x1bf0('0xb3')]){case _0x1bf0('0xb5'):this['handlePower'](_0x290e6c,0x1);break;case _0x1bf0('0xb6'):this['handlePower'](_0x290e6c,_0x290e6c[_0x1bf0('0xb7')]);break;case'predictive':this[_0x1bf0('0xb4')](_0x290e6c);break;case _0x1bf0('0x6'):this[_0x1bf0('0xb8')](_0x290e6c,0x1);break;default:logger[_0x1bf0('0x65')]('Queue',_0x290e6c[_0x1bf0('0x60')],_0x1bf0('0xb9'));}};Dialer[_0x1bf0('0x15')]['ifTime']=function(_0x485844,_0x5b1010){var _0x82443c=_0x485844[_0x1bf0('0xb0')];var _0x1132a0=_0x5b1010?_0x485844['dialGlobalInterval']:_0x485844[_0x1bf0('0x78')]['Intervals'];logger['silly'](_0x1bf0('0xba'),_0x1132a0,_0x82443c,_0x485844[_0x1bf0('0x60')],util[_0x1bf0('0x43')](_0x1bf0('0xbb'),_0x485844[_0x1bf0('0x60')],_0x485844['id']));var _0x421276=null;return Interval[_0x1bf0('0xbc')](_0x1132a0,_0x82443c)['then'](function(_0x3d2243){if(_0x3d2243===!![]){return _0x3d2243;}else{_0x485844['message']=_0x5b1010?utils[_0x1bf0('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1bf0('0x6a')][_0x1bf0('0xa7')];_0x421276=msgResponse('[ifTime][promiseAll]',_0x1bf0('0x93'),_0x1bf0('0xa9')+_0x5b1010+'\x20'+_0x485844[_0x1bf0('0x60')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x1bf0('0x42')](_0x1132a0,{'showHidden':![],'depth':null})+_0x1bf0('0xbd')+_0x82443c);}if(_0x421276!==null){logger[_0x1bf0('0xbe')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x421276);_0x421276[_0x1bf0('0xbf')]=_0x5b1010;throw _0x421276;}})[_0x1bf0('0xa3')](function(_0x3a5ed9){logger['error'](_0x1bf0('0xc0'),_0x3a5ed9);throw msgResponse(_0x1bf0('0x83'),'Error',util[_0x1bf0('0x42')](_0x3a5ed9,{'showHidden':![],'depth':null}));});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x29')]=function(_0xcb63bb){if(this[_0x1bf0('0x19')][_0xcb63bb[_0x1bf0('0xc1')]]){if(this[_0x1bf0('0x21')][_0xcb63bb[_0x1bf0('0xc2')]]&&this['uniqueId'][_0xcb63bb['uniqueid']][_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][_0xcb63bb[_0x1bf0('0xc1')]]);this[_0x1bf0('0x21')][_0xcb63bb['uniqueid']][_0x1bf0('0xc5')]=moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x1bf0('0x15')][_0x1bf0('0xc6')]=function(_0x4c11fb){var _0x433142=this[_0x1bf0('0x21')][_0x4c11fb[_0x1bf0('0xc2')]];if(this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]]){if(_0x433142&&_0x433142[_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x4c11fb[_0x1bf0('0xc2')]];this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]][_0x1bf0('0xc7')]+=0x1;var _0x1d95d0=new AgentComplete(_0x433142,_0x4c11fb);if(_0x4c11fb[_0x1bf0('0xc8')]==='agent'){_0x1d95d0[_0x1bf0('0xc9')]=this[_0x1bf0('0x19')][_0x4c11fb[_0x1bf0('0xc1')]][_0x1bf0('0xca')]&&this[_0x1bf0('0x19')][_0x4c11fb['queue']][_0x1bf0('0xcb')]?moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x1bf0('0xcc')](_0x1d95d0)['catch'](loggerCatch(_0x1bf0('0xcd')));hopperUtils[_0x1bf0('0xce')](_0x1d95d0)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcf')));}}};Dialer[_0x1bf0('0x15')]['syncQueueCallerAbandon']=function(_0x5daf18){var _0x3e3d3a=this[_0x1bf0('0x21')][_0x5daf18[_0x1bf0('0xc2')]];var _0x46ba37=this;var _0x5c7375=![];var _0x110fb1;var _0x45d92f;if(this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]]){if(_0x3e3d3a&&_0x3e3d3a[_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x5daf18[_0x1bf0('0xc2')]];this['updateOriginated'](this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]]);_0x3e3d3a[_0x1bf0('0xd0')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));var _0x2d35f0=new QueueCallerAbandon(_0x3e3d3a,_0x5daf18);if(utils['getSeconds'](_0x3e3d3a[_0x1bf0('0xd0')],_0x3e3d3a[_0x1bf0('0xd2')])>=_0x3e3d3a[_0x1bf0('0xd3')]){this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xd4')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xd5')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2d35f0[_0x1bf0('0xd6')]=0xa;_0x2d35f0[_0x1bf0('0x70')]=_0x1bf0('0xd7');_0x2d35f0[_0x1bf0('0xd8')]='TIMEOUT';_0x2d35f0[_0x1bf0('0xc9')]=this['voiceQueues'][_0x5daf18['queue']]['dialQueueProject2']?moment()['format'](_0x1bf0('0xd1')):undefined;_0x2d35f0['countdropretry']+=0x1;_0x2d35f0['countglobal']+=0x1;_0x110fb1=this[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xd9')];_0x45d92f=this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xda')];hopperUtils['verifyAdditionalPhones'](_0x2d35f0,_0x2d35f0[_0x1bf0('0xd6')],_0x3e3d3a[_0x1bf0('0xdb')])[_0x1bf0('0x9e')](function(_0x4e8ec7){_0x5c7375=_0x4e8ec7[_0x1bf0('0xdc')]==0x1;if(_0x2d35f0[_0x1bf0('0xdd')]>=_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xde')]){_0x46ba37[_0x1bf0('0xdf')](_0x2d35f0,_0x4e8ec7['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2d35f0['countdropretry'],'scheduledat':moment()[_0x1bf0('0xe0')](_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xd9')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x3e3d3a[_0x1bf0('0xe2')],'ListId':_0x3e3d3a[_0x1bf0('0xe3')],'VoiceQueueId':_0x3e3d3a[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x3e3d3a[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xe6')));var _0x2f9c96=new History(_0x2d35f0);_0x2f9c96[_0x1bf0('0xd6')]=0xa;_0x2f9c96[_0x1bf0('0x70')]=_0x1bf0('0xd7');_0x2f9c96[_0x1bf0('0x72')]=moment()['format'](_0x1bf0('0xd1'));_0x2f9c96[_0x1bf0('0x71')]=_0x2f9c96[_0x1bf0('0x72')];_0x2f9c96[_0x1bf0('0xe7')]=_0x2d35f0[_0x1bf0('0xe7')];_0x2f9c96['calleridnum']=_0x2d35f0[_0x1bf0('0xe8')];hopperUtils[_0x1bf0('0xcc')](_0x2f9c96)[_0x1bf0('0xa3')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x5c7375)hopperUtils[_0x1bf0('0xe9')](_0x2d35f0,_0x110fb1,_0x45d92f)[_0x1bf0('0x9e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0x4c')]+=0x1;this[_0x1bf0('0x19')][_0x5daf18['queue']][_0x1bf0('0xea')]+=0x1;_0x2d35f0['state']=0xb;_0x2d35f0[_0x1bf0('0x70')]=_0x1bf0('0xeb');_0x2d35f0[_0x1bf0('0xd8')]=_0x1bf0('0xec');_0x2d35f0[_0x1bf0('0xed')]+=0x1;_0x2d35f0[_0x1bf0('0xee')]+=0x1;_0x110fb1=this['voiceQueues'][_0x5daf18['queue']]['dialAbandonedRetryFrequency'];_0x45d92f=this['voiceQueues'][_0x5daf18[_0x1bf0('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x2d35f0,_0x2d35f0[_0x1bf0('0xd6')],_0x3e3d3a[_0x1bf0('0xdb')])[_0x1bf0('0x9e')](function(_0x5a9a13){if(_0x2d35f0[_0x1bf0('0xed')]>=_0x46ba37[_0x1bf0('0x19')][_0x5daf18[_0x1bf0('0xc1')]][_0x1bf0('0xef')]){_0x46ba37[_0x1bf0('0xdf')](_0x2d35f0,_0x5a9a13[_0x1bf0('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2d35f0[_0x1bf0('0xed')],'scheduledat':moment()['add'](_0x46ba37[_0x1bf0('0x19')][_0x5daf18['queue']]['dialAbandonedRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x3e3d3a['ContactId'],'ListId':_0x3e3d3a[_0x1bf0('0xe3')],'VoiceQueueId':_0x3e3d3a['VoiceQueueId']||undefined,'CampaignId':_0x3e3d3a[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xf0')));var _0x5d3579=new History(_0x2d35f0);_0x5d3579[_0x1bf0('0xd6')]=0xb;_0x5d3579['statedesc']=_0x1bf0('0xeb');_0x5d3579[_0x1bf0('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d3579[_0x1bf0('0x71')]=_0x5d3579['starttime'];_0x5d3579[_0x1bf0('0xe7')]=_0x2d35f0[_0x1bf0('0xe7')];_0x5d3579[_0x1bf0('0xe8')]=_0x2d35f0[_0x1bf0('0xe8')];hopperUtils[_0x1bf0('0xcc')](_0x5d3579)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x1bf0('0x9e')](function(){if(_0x5c7375)hopperUtils[_0x1bf0('0xe9')](_0x2d35f0,_0x110fb1,_0x45d92f)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x1bf0('0x34')]=function(_0x494fa3){if(this['actions'][_0x494fa3['uniqueid']]){this['actions'][_0x494fa3[_0x1bf0('0xc2')]][_0x1bf0('0xf1')]=_0x494fa3[_0x1bf0('0xf1')];}if(this[_0x1bf0('0x21')][_0x494fa3['uniqueid']]){this[_0x1bf0('0x21')][_0x494fa3['uniqueid']][_0x1bf0('0xf1')]=_0x494fa3[_0x1bf0('0xf1')];}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x38')]=function(_0x58e638){if(!this['actions'][_0x58e638[_0x1bf0('0xf2')]]){return;}var _0x5909bf=this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['queue']][_0x1bf0('0xf3')]||'rrmemory';if(_0x5909bf==='roundrobin'){if(this[_0x1bf0('0x1f')][_0x58e638['actionid']]&&_[_0x1bf0('0xf4')](this['actions'][_0x58e638['actionid']][_0x1bf0('0xf5')])&&_0x58e638[_0x1bf0('0x87')]==='1'&&_0x58e638['paused']==='0'){if(this[_0x1bf0('0x1b')][_0x58e638['stateinterface']]){if(!this['agents'][_0x58e638[_0x1bf0('0xf6')]]['locked']){this[_0x1bf0('0x1b')][_0x58e638[_0x1bf0('0xf6')]][_0x1bf0('0xf5')]=!![];this['actions'][_0x58e638[_0x1bf0('0xf2')]][_0x1bf0('0xf5')]=!![];this[_0x1bf0('0x1f')][_0x58e638['actionid']]['stateinterface']=_0x58e638[_0x1bf0('0xf6')];}}}}else if(_0x5909bf==='rrmemory'){if(this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]){if(this[_0x1bf0('0x1b')][_0x58e638[_0x1bf0('0xf6')]]){this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['stateinterface']=_0x58e638[_0x1bf0('0xf6')];if(_['isNil'](this['queueBooked'][this[_0x1bf0('0x1f')][_0x58e638['actionid']][_0x1bf0('0xc1')]])){this[_0x1bf0('0x26')][this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]]['queue']]=[];}this[_0x1bf0('0x26')][this['actions'][_0x58e638[_0x1bf0('0xf2')]]['queue']]['push'](_[_0x1bf0('0x5e')](_[_0x1bf0('0x77')](this[_0x1bf0('0x1f')][_0x58e638[_0x1bf0('0xf2')]],['idHopper',_0x1bf0('0xf6')]),{'status':_0x58e638[_0x1bf0('0x87')],'paused':_0x58e638[_0x1bf0('0xf7')]}));}}}};Dialer[_0x1bf0('0x15')]['syncQueueStatusComplete']=function(_0x493991){if(!this[_0x1bf0('0x1f')][_0x493991['actionid']]){return;}var _0x32e76d=this;var _0x41e8a7=this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]];var _0x1f454c=_0x41e8a7[_0x1bf0('0xf3')]||_0x1bf0('0xf8');if(_0x1f454c==='roundrobin'){if(this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]&&this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xf6')]){this[_0x1bf0('0xf9')][_0x1bf0('0xfa')](this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xfb')],this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]['stateinterface'])[_0x1bf0('0xa3')](function(_0x1431e0){logger[_0x1bf0('0x65')](_0x1bf0('0xfc'),util['inspect'](_0x1431e0,{'showHidden':![],'depth':null}));})[_0x1bf0('0x17')](function(){_0x32e76d['updateOriginated'](_0x32e76d['voiceQueues'][_0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]);_0x32e76d['agents'][_0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]['stateinterface']][_0x1bf0('0xf5')]=![];delete _0x32e76d[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]];unlockQueueStatus(_0x41e8a7);});}else{this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xe2')],'ListId':this[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xe3')],'VoiceQueueId':this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xe4')]||undefined,'CampaignId':this[_0x1bf0('0x1f')][_0x493991['actionid']]['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xfd')));delete this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]];unlockQueueStatus(_0x41e8a7);}}else if(_0x1f454c===_0x1bf0('0xf8')){var _0x337441;if(this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]]&&!_[_0x1bf0('0x45')](this[_0x1bf0('0x26')][this['actions'][_0x493991[_0x1bf0('0xf2')]]['queue']])){if(this[_0x1bf0('0xfe')][_0x32e76d[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]){this[_0x1bf0('0xfe')][_0x32e76d[_0x1bf0('0x1f')][_0x493991['actionid']][_0x1bf0('0xc1')]]=this[_0x1bf0('0xfe')][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]?this['queueBookedRR'][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]:this[_0x1bf0('0x26')][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]?this[_0x1bf0('0x26')][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]][_0x1bf0('0xff')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]]['_rr']=this['queueBookedRR'][this[_0x1bf0('0x1f')][_0x493991[_0x1bf0('0xf2')]][_0x1bf0('0xc1')]];for(var _0x25d7d7=0x0;_0x25d7d7=_0x2da612[_0x1bf0('0x124')]){_0x18fc50[_0x1bf0('0x125')](_0x339584,_0x5747a0,_0x537a0b,'reason19\x20machine....');}else{if(_0x339584['countmachineretry']>=_0x2da612[_0x1bf0('0x126')]){_0x18fc50['createStateFinal'](_0x339584,_0x5747a0,_0x537a0b,_0x1bf0('0x127'));}else{hopperUtils[_0x1bf0('0x104')]({'active':![],'countmachineretry':_0x339584[_0x1bf0('0x11e')],'scheduledat':moment()[_0x1bf0('0xe0')](_0x2da612[_0x1bf0('0x128')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x339584[_0x1bf0('0xe2')],'ListId':_0x339584['ListId'],'VoiceQueueId':_0x339584[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x339584[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x5747a0({'reschedule':0x1});}}});}if(_0x133fbe['type']===_0x1bf0('0xc3')&&this[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x110')]&&_0x4e6224[_0x1bf0('0x111')]===_0x1bf0('0x129')){delete this[_0x1bf0('0x21')][_0x4e6224[_0x1bf0('0xc2')]];this[_0x1bf0('0xc4')](this[_0x1bf0('0x1a')][_0x133fbe['queue']]);_0x2e9df5=new Hangup(_0x133fbe,_0x4e6224);_0x2e9df5[_0x1bf0('0xd6')]=0x12;_0x2e9df5[_0x1bf0('0x70')]=_0x1bf0('0x113');_0x2e9df5['membername']=_0x1bf0('0x115');ami['emit'](_0x1bf0('0x117'),ut[_0x1bf0('0x118')](_0x2e9df5,_0x1bf0('0x119')));this[_0x1bf0('0x12a')](_0x2e9df5,'[syncHangupInAMDIvr][createHistory]',_0x1bf0('0x12b'));}if(_0x133fbe[_0x1bf0('0x3f')]===_0x1bf0('0xc3')&&this['campaigns'][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x110')]&&_0x4e6224[_0x1bf0('0x111')]===_0x1bf0('0x11c')){return new Promise(function(_0x5d770c,_0x310b55){delete _0x18fc50[_0x1bf0('0x21')][_0x4e6224['uniqueid']];_0x18fc50[_0x1bf0('0xc4')](_0x18fc50['campaigns'][_0x133fbe['queue']]);_0x18fc50['campaigns'][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0xc7')]+=0x1;_0x18fc50[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]][_0x1bf0('0x112')]+=0x1;var _0x24d868=_0x18fc50[_0x1bf0('0x1a')][_0x133fbe[_0x1bf0('0xc1')]];var _0x22ebba=new Hangup(_0x133fbe,_0x4e6224);_0x22ebba[_0x1bf0('0xd6')]=0x13;_0x22ebba[_0x1bf0('0x70')]=_0x1bf0('0x11d');_0x22ebba[_0x1bf0('0x114')]='AMD';_0x22ebba[_0x1bf0('0x11e')]+=0x1;_0x22ebba[_0x1bf0('0xee')]+=0x1;_0x22ebba[_0x1bf0('0x119')]=!![];ami['emit']('custom:amd',ut[_0x1bf0('0x118')](_0x22ebba,_0x1bf0('0x119')));hopperUtils['createHistory'](_0x22ebba)['catch'](loggerCatch(_0x1bf0('0x11f')));if(_0x22ebba['countbusyretry']+_0x22ebba[_0x1bf0('0x121')]+_0x22ebba['countnoanswerretry']+_0x22ebba[_0x1bf0('0x122')]+_0x22ebba[_0x1bf0('0xdd')]+_0x22ebba[_0x1bf0('0xed')]+_0x22ebba[_0x1bf0('0x11e')]+_0x22ebba[_0x1bf0('0x123')]>=_0x24d868[_0x1bf0('0x124')]){_0x18fc50[_0x1bf0('0x125')](_0x22ebba,_0x5d770c,_0x310b55,_0x1bf0('0x12c'));}else{if(_0x22ebba[_0x1bf0('0x11e')]>=_0x24d868[_0x1bf0('0x126')]){_0x18fc50[_0x1bf0('0x12d')](_0x22ebba,_0x5d770c,_0x310b55,'reason\x2019\x20machine....');}else{hopperUtils[_0x1bf0('0x104')]({'active':![],'countmachineretry':_0x22ebba[_0x1bf0('0x11e')],'scheduledat':moment()['add'](_0x24d868[_0x1bf0('0x128')],_0x1bf0('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22ebba[_0x1bf0('0xe2')],'ListId':_0x22ebba[_0x1bf0('0xe3')],'VoiceQueueId':_0x22ebba[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x22ebba[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x12e')));_0x5d770c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1bf0('0x32')]=function(_0x25844c){var _0x19aa6e=this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];var _0x332c72;if(_0x19aa6e&&_0x19aa6e[_0x1bf0('0x3f')]===_0x1bf0('0xc3')){delete this[_0x1bf0('0x21')][_0x25844c['uniqueid']];this[_0x1bf0('0xc4')](this['campaigns'][_0x19aa6e[_0x1bf0('0xc1')]]);this[_0x1bf0('0x1a')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x12f')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x1bf0('0xce')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr]'));}if(_0x19aa6e&&_0x19aa6e['type']!==_0x1bf0('0xc3')&&isNotNull(this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x130')])){delete this['uniqueId'][_0x25844c[_0x1bf0('0xc2')]];this[_0x1bf0('0xc4')](this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]);this[_0x1bf0('0x19')][_0x19aa6e['queue']][_0x1bf0('0xc7')]+=0x1;this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x112')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);_0x332c72[_0x1bf0('0xd6')]=0x10;_0x332c72[_0x1bf0('0x70')]=_0x1bf0('0x131');_0x332c72['membername']=_0x1bf0('0x132');hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x133')));hopperUtils['moveContactManagedDialer'](_0x332c72)[_0x1bf0('0xa3')](loggerCatch('[syncHangupIvr]'));}if(_0x19aa6e&&_0x19aa6e['type']!==_0x1bf0('0xc3')&&!isNotNull(this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]['dialQueueProject'])){if(_0x25844c[_0x1bf0('0x134')]===_0x1bf0('0x135')){delete this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];this[_0x1bf0('0x19')][_0x19aa6e['queue']]['outboundAnswerCallsDay']+=0x1;const _0x1257f0=new AgentComplete(_0x19aa6e,_0x25844c);_0x1257f0['CampaignId']=this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]]['id'];hopperUtils[_0x1bf0('0xcc')](_0x1257f0)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcd')));hopperUtils[_0x1bf0('0xce')](_0x1257f0)['catch'](loggerCatch('[syncAgentComplete]'));}else{delete this[_0x1bf0('0x21')][_0x25844c[_0x1bf0('0xc2')]];this['updateOriginated'](this[_0x1bf0('0x19')][_0x19aa6e['queue']]);this[_0x1bf0('0x19')][_0x19aa6e[_0x1bf0('0xc1')]][_0x1bf0('0x136')]+=0x1;_0x332c72=new Hangup(_0x19aa6e,_0x25844c);_0x332c72[_0x1bf0('0xd6')]=0xc;_0x332c72['statedesc']=_0x25844c[_0x1bf0('0x134')];_0x332c72['membername']=_0x1bf0('0x137');hopperUtils[_0x1bf0('0xcc')](_0x332c72)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x133')));hopperUtils[_0x1bf0('0xce')](_0x332c72)['catch'](loggerCatch(_0x1bf0('0x138')));}}};Dialer['prototype'][_0x1bf0('0x7')]=function(_0x4b693c){var _0x24c117=this;if(!_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]){_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]={'running':![]};}else if(_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]][_0x1bf0('0x139')]===!![]){return;}else if(_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]][_0x1bf0('0x139')]===![]){_0x24c117[_0x1bf0('0x27')][_0x4b693c[_0x1bf0('0x60')]]['running']=!![];}var _0x1a86ae=_0x24c117[_0x1bf0('0x19')][_0x4b693c['name']];var _0x6a718e=_0x1a86ae[_0x1bf0('0x6e')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x1f25c5=utils[_0x1bf0('0x13a')](_0x1a86ae);_0x1a86ae[_0x1bf0('0x13b')]=utils['getQueueCampaignStatusMessage'](_0x1a86ae,_0x24c117['trunks']);Promise['resolve']()[_0x1bf0('0x9e')](function(){if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')]['INACTIVE']){if(_0x6a718e){clearPredictiveAttributes(_0x1a86ae);_0x4b693c[_0x1bf0('0x23')]=undefined;_0x4b693c[_0x1bf0('0x24')]=undefined;}if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')][_0x1bf0('0x7c')]){_0x4b693c[_0x1bf0('0x13c')]=0x0;_0x4b693c[_0x1bf0('0xf7')]=0x0;_0x4b693c['inUse']=0x0;_0x4b693c[_0x1bf0('0x13d')]=0x0;_0x4b693c[_0x1bf0('0x13e')]=0x0;}}else if(_0x1a86ae[_0x1bf0('0x13b')]===utils[_0x1bf0('0x6a')][_0x1bf0('0x13f')]&&!_0x1f25c5){return _0x24c117[_0x1bf0('0x92')](_0x1a86ae,!![])[_0x1bf0('0x9e')](function(){return _0x24c117['ifTime'](_0x1a86ae,![]);})[_0x1bf0('0x9e')](function(){return _0x24c117[_0x1bf0('0x140')](_0x1a86ae);})[_0x1bf0('0xa3')](function(_0x5a429a){loggerSyncQueueSummary[_0x1bf0('0x40')](_0x1bf0('0x141'),util[_0x1bf0('0x42')](_0x5a429a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1a86ae);});}else{clearPredictiveAttributes(_0x1a86ae);}})[_0x1bf0('0x9e')](function(){var _0x3b28c3=_0x4b693c[_0x1bf0('0x142')](_0x1a86ae);if(_0x3b28c3||_0x1a86ae[_0x1bf0('0x143')]){_0x1a86ae[_0x1bf0('0x143')]=![];_0x4b693c[_0x1bf0('0x144')](_0x1a86ae);Object[_0x1bf0('0x145')](_0x1a86ae,_0x4b693c);emitOutboundVoiceQueueSummary(_0x4b693c);}_0x24c117[_0x1bf0('0x27')][_0x1a86ae[_0x1bf0('0x60')]][_0x1bf0('0x139')]=![];})[_0x1bf0('0xa3')](function(_0x4d7a36){logger[_0x1bf0('0x65')](_0x1bf0('0x141'),util['inspect'](_0x4d7a36,{'showHidden':![],'depth':null}));_0x24c117['queuesSummary'][_0x1a86ae[_0x1bf0('0x60')]][_0x1bf0('0x139')]=![];});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x146')]=_['throttle'](function(){var _0x535739=_[_0x1bf0('0x147')](this[_0x1bf0('0x19')],function(_0x1755ac){return _0x1755ac[_0x1bf0('0x148')];});var _0x3722a6=_[_0x1bf0('0x147')](this[_0x1bf0('0x1b')],function(_0x5139ff){return _0x5139ff[_0x1bf0('0x149')]&&_0x5139ff[_0x1bf0('0x87')]===_0x1bf0('0x14a');});if(_0x535739[_0x1bf0('0x9a')]>0x0&&_0x3722a6[_0x1bf0('0x9a')]>0x0){return Promise[_0x1bf0('0xae')]()['then'](cmHopper[_0x1bf0('0x14b')](_[_0x1bf0('0x14c')](_0x535739,'id'),previewRecallmeReminderInterval,_['map'](_0x3722a6,'id')))['then'](function(_0x92d1b6){for(var _0xbd2f75=0x0;_0xbd2f75<_0x92d1b6[_0x1bf0('0x9a')];_0xbd2f75++){var _0x14035e=_0x92d1b6[_0xbd2f75][_0x1bf0('0x14d')][_0x1bf0('0x60')];if(_0x14035e)io['to'](util[_0x1bf0('0x43')]('user:%s',_0x14035e))[_0x1bf0('0x116')](_0x1bf0('0x14e'),{'hopper':_0x92d1b6[_0xbd2f75]});}})[_0x1bf0('0xa3')](function(_0x350dcc){logger['error'](_0x1bf0('0x14f'),_0x350dcc);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1bf0('0x15')][_0x1bf0('0x3c')]=function(){var _0x252c41=this;setInterval(function(){_0x252c41[_0x1bf0('0x150')](_0x252c41[_0x1bf0('0x21')],'[uniqueid]');_0x252c41[_0x1bf0('0x150')](_0x252c41[_0x1bf0('0x1f')],_0x1bf0('0x151'));},0x32c8);};Dialer[_0x1bf0('0x15')][_0x1bf0('0x150')]=function(_0x5f2262,_0x5eecd9){var _0x2fa32e=this;for(var _0x5399da in _0x5f2262){if(typeof _0x5f2262[_0x5399da]!=='undefined'){this[_0x1bf0('0x18')][_0x1bf0('0x152')](function(){if(!_[_0x1bf0('0xf4')](_0x5f2262[_0x5399da])){return ami[_0x1bf0('0x9c')]({'action':_0x1bf0('0x87'),'channel':_0x5f2262[_0x5399da][_0x1bf0('0xf1')]})[_0x1bf0('0xa3')](function(_0x11bbef){if(_0x11bbef['message']===_0x1bf0('0x153')){setTimeout(function(){if(_0x5f2262[_0x5399da]&&_0x5f2262[_0x5399da][_0x1bf0('0x3f')]!==_0x1bf0('0xc3')){_0x2fa32e['updateOriginated'](_0x2fa32e['voiceQueues'][_0x5f2262[_0x5399da][_0x1bf0('0xc1')]]);logger[_0x1bf0('0x65')](_0x1bf0('0x154'),_0x5eecd9,_0x5399da,_0x5f2262[_0x5399da][_0x1bf0('0xc1')]);delete _0x5f2262[_0x5399da];}if(_0x5f2262[_0x5399da]&&_0x5f2262[_0x5399da][_0x1bf0('0x3f')]===_0x1bf0('0xc3')){_0x2fa32e[_0x1bf0('0xc4')](_0x2fa32e['campaigns'][_0x5f2262[_0x5399da]['queue']]);logger[_0x1bf0('0x65')](_0x1bf0('0x155'),_0x5eecd9,_0x5399da,_0x5f2262[_0x5399da][_0x1bf0('0xc1')]);delete _0x5f2262[_0x5399da];}},0x2328);}});}});}}};Dialer[_0x1bf0('0x15')]['getVoiceQueueRtPauses']=function(_0x155c32){return Promise[_0x1bf0('0xae')]()[_0x1bf0('0x9e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x155c32))[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x156')));};Dialer['prototype']['updateOriginated']=function(_0x3bb08f){if(!_['isUndefined'](_0x3bb08f)&&_0x3bb08f!==null){if(typeof _0x3bb08f[_0x1bf0('0x80')]!==_0x1bf0('0xac')){if(_0x3bb08f[_0x1bf0('0x80')]>0x0){_0x3bb08f[_0x1bf0('0x80')]-=0x1;}else{logger[_0x1bf0('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x157')]=function(_0x643c13,_0x41da12){var _0x4f052e=this;return function(_0x2bc40d){_0x4f052e[_0x1bf0('0xc4')](_0x41da12);logger[_0x1bf0('0x65')](_0x643c13,util[_0x1bf0('0x42')](_0x2bc40d,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1bf0('0x158')]=function(_0x2afa4a,_0x1b1b15,_0x34204c){var _0x127a46={'state':0x19,'statedesc':_0x1bf0('0x159')};this[_0x1bf0('0xc4')](_0x1b1b15);this[_0x1bf0('0x12a')](_['merge'](_0x127a46,_[_0x1bf0('0x77')](_0x34204c,[_0x1bf0('0xe2'),'ListId',_0x1bf0('0x15a'),'VoiceQueueId',_0x1bf0('0xe5')])),_0x1bf0('0x15b'),'[emptyContact]');logger[_0x1bf0('0x65')](_0x2afa4a);};Dialer[_0x1bf0('0x15')][_0x1bf0('0x12a')]=function(_0x4c3159,_0x560aa6,_0x574268){hopperUtils['createHistory'](_0x4c3159)[_0x1bf0('0xa3')](loggerCatch(_0x560aa6));hopperUtils[_0x1bf0('0xce')](_0x4c3159)['catch'](loggerCatch(_0x574268));};Dialer[_0x1bf0('0x15')][_0x1bf0('0xdf')]=function(_0x4ab8f7,_0x5b56b2){hopperUtils[_0x1bf0('0xcc')](_0x4ab8f7)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0xcd')));if(_0x5b56b2==0x0){hopperUtils[_0x1bf0('0xce')](_0x4ab8f7)['catch'](loggerCatch(_0x1bf0('0x15c')));}};Dialer[_0x1bf0('0x15')]['checkPreviewRecallReminder']=function(_0xdf142b){return Promise['resolve']()[_0x1bf0('0x9e')](cmHopper[_0x1bf0('0x14b')](_0xdf142b['id'],previewRecallmeReminderInterval))[_0x1bf0('0x9e')](function(_0x2d428c){for(var _0xb9962a=0x0;_0xb9962a<_0x2d428c[_0x1bf0('0x9a')];_0xb9962a++){var _0x1e58e5=_0x2d428c[_0xb9962a][_0x1bf0('0x14d')][_0x1bf0('0x60')];if(_0x1e58e5)io['to'](util['format'](_0x1bf0('0x15d'),_0x1e58e5))[_0x1bf0('0x116')](_0x1bf0('0x14e'),{'hopper':_0x2d428c[_0xb9962a]});}})[_0x1bf0('0xa3')](function(){});};Dialer[_0x1bf0('0x15')]['launchHandleIvr']=function(_0x2d99e8){var _0x2992b1=this;return function(){_0x2992b1[_0x1bf0('0x15e')](_0x2d99e8);};};Dialer['prototype'][_0x1bf0('0x15f')]=function(_0x803b50,_0x5d16ed){var _0x122a30=this;var _0x3c7244=uuid['v4']();this[_0x1bf0('0x1f')][_0x3c7244]=new Action(_0x803b50,_0x5d16ed,_0x3c7244);return new Promise(function(_0x593e5f,_0x2fd083){if(_[_0x1bf0('0x3e')](_0x803b50)&&typeof _0x803b50!==_0x1bf0('0x160')){return _0x2fd083(msgResponse(_0x1bf0('0x161'),_0x1bf0('0x93'),_0x1bf0('0x162')));}if(_['isUndefined'](_0x5d16ed[_0x1bf0('0x163')])||_0x5d16ed['phone']===null){return _0x2fd083(msgResponse('originate',_0x1bf0('0x93'),_0x1bf0('0x164')));}var _0x23045e={'XMD-CALLERID':_0x122a30['actions'][_0x3c7244]['getCaller'](),'XMD-AGI':_0x803b50[_0x1bf0('0x130')]?util[_0x1bf0('0x43')](_0x1bf0('0x165'),ipAgi,_0x803b50[_0x1bf0('0x130')]):_0x1bf0('0x166'),'XMD-AGIAFTER':_0x803b50['dialQueueProject2']?util[_0x1bf0('0x43')](_0x1bf0('0x165'),ipAgi,_0x803b50[_0x1bf0('0xca')]):_0x1bf0('0x166'),'XMD-QUEUE':utils[_0x1bf0('0x167')](_0x803b50)?util['format'](_0x1bf0('0x168'),_0x803b50['name'],_0x803b50[_0x1bf0('0x169')]||'',_0x803b50['dialAgiAfterHangupAgent']?'c':'',_0x803b50['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x5d16ed[_0x1bf0('0xe2')],'XMD-CDRTYPE':_0x1bf0('0x5'),'CALLERID(all)':_0x122a30[_0x1bf0('0x1f')][_0x3c7244][_0x1bf0('0x16a')](),'XMD-AMD':_0x803b50[_0x1bf0('0x110')]?_0x1bf0('0x13f'):_0x1bf0('0x166'),'XMD-DESTINATION':_0x1bf0('0x10f')};if(_0x803b50[_0x1bf0('0x110')]){_0x23045e[_0x1bf0('0x16b')]=_0x803b50[_0x1bf0('0x16c')]||0x9c4;_0x23045e[_0x1bf0('0x16d')]=_0x803b50[_0x1bf0('0x16e')]||0x5dc;_0x23045e[_0x1bf0('0x16f')]=_0x803b50[_0x1bf0('0x170')]||0x320;_0x23045e[_0x1bf0('0x171')]=_0x803b50[_0x1bf0('0x172')]||0x1388;_0x23045e['XMD-AMDMINWORDLENGTH']=_0x803b50[_0x1bf0('0x173')]||0x64;_0x23045e[_0x1bf0('0x174')]=_0x803b50[_0x1bf0('0x175')]||0x32;_0x23045e[_0x1bf0('0x176')]=_0x803b50[_0x1bf0('0x177')]||0x3;_0x23045e[_0x1bf0('0x178')]=_0x803b50[_0x1bf0('0x179')]||0x100;_0x23045e[_0x1bf0('0x17a')]=_0x803b50['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x803b50)){_0x23045e['XMD-VOICEQUEUEID']=_0x5d16ed[_0x1bf0('0xe4')];}else{_0x23045e[_0x1bf0('0x17b')]=_0x5d16ed[_0x1bf0('0xe5')];}var _0x1c81a4=utils['setXMDContactVariables'](_0x5d16ed[_0x1bf0('0x17c')]);Object['assign'](_0x23045e,_0x1c81a4);var _0x3b171e=_0x122a30[_0x1bf0('0x85')](_0x803b50[_0x1bf0('0x8b')])?utils['getCallerId'](_0x803b50['Trunk'][_0x1bf0('0x17d')],_0x803b50['dialOriginateCallerIdName'],_0x803b50[_0x1bf0('0x17e')]>0x0?utils['getCallerIdRandom'](_0x803b50[_0x1bf0('0x17f')],_0x803b50[_0x1bf0('0x17e')]):_0x803b50[_0x1bf0('0x17f')]):utils[_0x1bf0('0x180')](_['isNil'](_0x803b50[_0x1bf0('0x8c')])?_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x17d')]:_0x803b50['TrunkBackup'][_0x1bf0('0x17d')],_0x803b50[_0x1bf0('0x181')],_0x803b50[_0x1bf0('0x17e')]>0x0?utils[_0x1bf0('0x182')](_0x803b50[_0x1bf0('0x17f')],_0x803b50[_0x1bf0('0x17e')]):_0x803b50[_0x1bf0('0x17f')]);if(_0x3b171e){_0x23045e[_0x1bf0('0x183')]=_0x122a30[_0x1bf0('0x1f')][_0x3c7244][_0x1bf0('0x184')]=utils[_0x1bf0('0x185')](_0x3b171e);_0x23045e[_0x1bf0('0x186')]=_0x5d16ed['phone'];}_0x803b50[_0x1bf0('0x187')]=_0x23045e;return ami[_0x1bf0('0x9c')]({'actionid':_0x3c7244,'action':_0x1bf0('0x161'),'channel':_0x122a30[_0x1bf0('0x85')](_0x803b50[_0x1bf0('0x8b')])?util['format'](_0x1bf0('0x188'),_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x60')],isNotNull(_0x803b50[_0x1bf0('0x189')])?_0x803b50[_0x1bf0('0x189')][_0x1bf0('0x18a')]()||'':'',_0x803b50[_0x1bf0('0x18b')]>0x0?_0x5d16ed[_0x1bf0('0x163')][_0x1bf0('0x18c')](_0x803b50[_0x1bf0('0x18b')]):_0x5d16ed[_0x1bf0('0x163')]):util[_0x1bf0('0x43')](_0x1bf0('0x188'),_[_0x1bf0('0xf4')](_0x803b50[_0x1bf0('0x8c')])?_0x803b50[_0x1bf0('0x8b')][_0x1bf0('0x60')]:_0x803b50[_0x1bf0('0x8c')][_0x1bf0('0x60')],isNotNull(_0x803b50[_0x1bf0('0x189')])?_0x803b50[_0x1bf0('0x189')][_0x1bf0('0x18a')]()||'':'',_0x803b50[_0x1bf0('0x18b')]>0x0?_0x5d16ed[_0x1bf0('0x163')][_0x1bf0('0x18c')](_0x803b50[_0x1bf0('0x18b')]):_0x5d16ed['phone']),'callerid':_0x3b171e,'Exten':_0x1bf0('0x10f'),'Context':_0x1bf0('0x18d'),'Priority':'1','variable':_0x23045e,'timeout':(_0x803b50[_0x1bf0('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c7244})['then'](function(_0x5c90d9){return _0x593e5f(_0x5c90d9);})[_0x1bf0('0xa3')](function(_0x4d5f54){_0x803b50['outboundOriginateFailureCallsDay']+=0x1;var _0x2612e4=new History(_0x122a30[_0x1bf0('0x1f')][_0x3c7244]);logger[_0x1bf0('0x65')](util[_0x1bf0('0x43')](_0x1bf0('0x18f'),JSON[_0x1bf0('0x76')](_0x4d5f54)));_0x2612e4['state']=0xe;_0x2612e4[_0x1bf0('0x70')]=_0x1bf0('0x190');_0x2612e4[_0x1bf0('0x72')]=moment()[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x2612e4[_0x1bf0('0x71')]=_0x2612e4[_0x1bf0('0x72')];hopperUtils[_0x1bf0('0xcc')](_0x2612e4)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x191')));_0x122a30[_0x1bf0('0xce')](_0x2612e4)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x191')))[_0x1bf0('0x17')](function(){delete _0x122a30[_0x1bf0('0x1f')][_0x3c7244];return _0x2fd083(msgResponse(_0x1bf0('0x161'),_0x1bf0('0x84'),_0x1bf0('0x192')));});});});};Dialer['prototype'][_0x1bf0('0x193')]=function(_0x3106fe,_0x5ec5e7,_0x1b7994){var _0x256819=new History(_0x5ec5e7);if(_0x256819[_0x1bf0('0x120')]+_0x256819[_0x1bf0('0x121')]+_0x256819[_0x1bf0('0x194')]+_0x256819[_0x1bf0('0x122')]+_0x256819[_0x1bf0('0xdd')]+_0x256819[_0x1bf0('0xed')]+_0x256819[_0x1bf0('0x11e')]+_0x256819['countagentrejectretry']>=_0x1b7994['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3106fe){case 0x3:if(_0x256819[_0x1bf0('0x194')]>=_0x1b7994['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countnoanswerretry':_0x256819[_0x1bf0('0x194')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x195')],_0x1bf0('0xe1'))['format'](_0x1bf0('0xd1')),'ContactId':_0x256819['ContactId'],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x196')));break;case 0x5:if(_0x256819[_0x1bf0('0x120')]>=_0x1b7994[_0x1bf0('0x197')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countbusyretry':_0x256819[_0x1bf0('0x120')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x198')],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819['ListId'],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x256819[_0x1bf0('0x121')]>=_0x1b7994[_0x1bf0('0x199')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countcongestionretry':_0x256819[_0x1bf0('0x121')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialCongestionRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819['ContactId'],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x19a')));break;case 0x0:if(_0x256819[_0x1bf0('0x122')]>=_0x1b7994[_0x1bf0('0x19b')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x256819[_0x1bf0('0x122')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x19c')],_0x1bf0('0xe1'))['format'](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x19d')));}break;case 0xa:if(_0x256819[_0x1bf0('0xdd')]>=_0x1b7994[_0x1bf0('0xde')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countdropretry':_0x256819[_0x1bf0('0xdd')]+=0x1,'scheduledat':moment()['add'](_0x1b7994[_0x1bf0('0xd9')],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xe6')));break;case 0xb:if(_0x256819['countabandonedretry']>=_0x1b7994[_0x1bf0('0xef')]-0x1){return!![];}hopperUtils[_0x1bf0('0x104')]({'active':![],'countabandonedretry':_0x256819[_0x1bf0('0xed')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994[_0x1bf0('0x19e')],'minutes')[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0xf0')));break;case 0x13:if(_0x256819['countmachineretry']>=_0x1b7994[_0x1bf0('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x256819['countmachineretry']+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialMachineRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')](_0x1bf0('0xd1')),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x12e')));break;case 0x14:if(_0x256819[_0x1bf0('0x123')]>=_0x1b7994[_0x1bf0('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x256819[_0x1bf0('0x123')]+=0x1,'scheduledat':moment()[_0x1bf0('0xe0')](_0x1b7994['dialAgentRejectRetryFrequency'],_0x1bf0('0xe1'))[_0x1bf0('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256819[_0x1bf0('0xe2')],'ListId':_0x256819[_0x1bf0('0xe3')],'VoiceQueueId':_0x256819[_0x1bf0('0xe4')]||undefined,'CampaignId':_0x256819[_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1a0')));break;default:return!![];}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x10a')]=function(_0x358031,_0x29b214,_0x2a2864){var _0x478940=this;var _0x24ced1=new History(_0x358031);var _0x2cc442=![];var _0x3a1af4;var _0x26dd2f;return new Promise(function(_0x28881b,_0x2b8360){if(_[_0x1bf0('0x3e')](_0x29b214)&&typeof _0x29b214!==_0x1bf0('0x160')){return _0x2b8360(msgResponse('[callProgressDetecting]',_0x1bf0('0x93'),_0x1bf0('0x1a1')));}if(_[_0x1bf0('0x3e')](_0x2a2864)&&typeof _0x2a2864!=='object'){return _0x2b8360(msgResponse(_0x1bf0('0x1a2'),'Failure',_0x1bf0('0x1a3')));}hopperUtils['verifyAdditionalPhones'](_0x24ced1,_0x2a2864[_0x1bf0('0xc8')],_0x29b214)['then'](function(_0x1d83a1){if(_0x1d83a1[_0x1bf0('0xdc')]==0x1)_0x2cc442=!![];switch(_0x2a2864[_0x1bf0('0xc8')]){case'0':_0x29b214[_0x1bf0('0x1a4')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x0;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1a5');_0x24ced1[_0x1bf0('0x122')]+=0x1;_0x24ced1['countglobal']+=0x1;ami[_0x1bf0('0x116')](_0x1bf0('0x1a6'),ut['buildObj'](_0x358031,_0x1bf0('0x1a7')));_0x3a1af4=_0x29b214['dialNoSuchNumberRetryFrequency'];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x11f')));if(_0x478940['checkRetriveMax'](0x0,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x122')]>=_0x29b214[_0x1bf0('0x19b')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1a8'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1a8'));}}break;case'3':_0x29b214[_0x1bf0('0x1a9')]+=0x1;_0x24ced1['state']=0x3;_0x24ced1['statedesc']=_0x1bf0('0x1aa');_0x24ced1[_0x1bf0('0x194')]+=0x1;_0x24ced1['countglobal']+=0x1;var _0x4fe4a8=ut[_0x1bf0('0x1ab')](_0x358031,_0x29b214);ami[_0x1bf0('0x116')](_0x1bf0('0x1ac'),_0x4fe4a8);_0x3a1af4=_0x29b214[_0x1bf0('0x195')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils['createHistory'](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1ad')));if(_0x478940[_0x1bf0('0x193')](0x3,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x194')]>=_0x29b214[_0x1bf0('0x1ae')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1af'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1af'));}}break;case'5':_0x29b214[_0x1bf0('0x1b0')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x5;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1b1');_0x24ced1[_0x1bf0('0x120')]+=0x1;_0x24ced1['countglobal']+=0x1;ami[_0x1bf0('0x116')](_0x1bf0('0x1b2'),ut['buildObj'](_0x358031,_0x1bf0('0x1b3')));_0x3a1af4=_0x29b214[_0x1bf0('0x198')];_0x26dd2f=_0x29b214['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1b4')));if(_0x478940[_0x1bf0('0x193')](0x5,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x120')]>=_0x29b214[_0x1bf0('0x197')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1b5'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,'reason\x205\x20busy');}}break;case'8':_0x29b214['outboundCongestionCallsDay']+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x8;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1b6');_0x24ced1[_0x1bf0('0x121')]+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x1b7')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];ami[_0x1bf0('0x116')](_0x1bf0('0x1b8'),ut['buildObj'](_0x358031,'congestion'));hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1b9')));if(_0x478940[_0x1bf0('0x193')](0x8,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1['countcongestionretry']>=_0x29b214[_0x1bf0('0x199')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1ba'));}else{_0x478940['stateGlobal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1ba'));}}break;case'11':_0x29b214[_0x1bf0('0x1bb')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0xb;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0xeb');_0x24ced1[_0x1bf0('0xed')]+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x19e')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1bc')));if(_0x478940[_0x1bf0('0x193')](0xb,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1['countabandonedretry']>=_0x29b214[_0x1bf0('0xef')]){_0x478940['createStateFinal'](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1bd'));}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1bd'));}}break;case'20':_0x29b214[_0x1bf0('0x1be')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0x14;_0x24ced1[_0x1bf0('0x70')]=_0x1bf0('0x1bf');_0x24ced1['countagentrejectretry']+=0x1;_0x24ced1[_0x1bf0('0xee')]+=0x1;_0x3a1af4=_0x29b214[_0x1bf0('0x1c0')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];ami[_0x1bf0('0x116')](_0x1bf0('0x1c1'),ut[_0x1bf0('0x118')](_0x358031,'agentreject'));hopperUtils['createHistory'](_0x24ced1)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x478940['checkRetriveMax'](0x14,_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x123')]>=_0x29b214[_0x1bf0('0x19f')]){_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,'reason\x2020\x20agentreject');}else{_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x1bf0('0x1c2'));}}break;default:_0x29b214[_0x1bf0('0x136')]+=0x1;_0x24ced1[_0x1bf0('0xd6')]=0xc;_0x24ced1[_0x1bf0('0x70')]=_0x2a2864['reason'];_0x3a1af4=_0x29b214[_0x1bf0('0x1c0')];_0x26dd2f=_0x29b214[_0x1bf0('0xda')];hopperUtils[_0x1bf0('0xcc')](_0x24ced1)['catch'](loggerCatch(_0x1bf0('0x1c3')));if(_0x478940[_0x1bf0('0x193')](_0x2a2864['reason'],_0x358031,_0x29b214)&&!_0x2cc442){if(_0x24ced1[_0x1bf0('0x120')]+_0x24ced1['countcongestionretry']+_0x24ced1['countnoanswerretry']+_0x24ced1[_0x1bf0('0x122')]+_0x24ced1[_0x1bf0('0xdd')]+_0x24ced1['countabandonedretry']+_0x24ced1[_0x1bf0('0x11e')]+_0x24ced1[_0x1bf0('0x123')]>=_0x29b214['dialGlobalMaxRetry']){_0x478940[_0x1bf0('0x125')](_0x24ced1,_0x28881b,_0x2b8360,_0x2a2864[_0x1bf0('0xc8')]);}else{_0x478940[_0x1bf0('0x12d')](_0x24ced1,_0x28881b,_0x2b8360,_0x2a2864[_0x1bf0('0xc8')]);}}}})[_0x1bf0('0x9e')](function(){if(_0x2cc442){hopperUtils[_0x1bf0('0xe9')](_0x24ced1,_0x3a1af4,_0x26dd2f)[_0x1bf0('0x9e')](function(){return _0x28881b(0x1);});}});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x125')]=function(_0x4866cb,_0x3e4b1e,_0x215e2e,_0x7b0b56){var _0x427517=new Final(_0x4866cb);_0x427517['state']=0xf;_0x427517[_0x1bf0('0x70')]=_0x1bf0('0x1c4');this[_0x1bf0('0x12d')](_0x427517,_0x3e4b1e,_0x215e2e,_0x7b0b56);};Dialer[_0x1bf0('0x15')]['createStateFinal']=function(_0x3a08d3,_0x26a232,_0x12da40,_0x59be0b){hopperUtils[_0x1bf0('0xce')](_0x3a08d3)[_0x1bf0('0x9e')](function(){return _0x26a232(msgResponse(_0x1bf0('0x1a2'),_0x1bf0('0x109'),_0x59be0b));})['catch'](function(){return _0x12da40(msgResponse(_0x1bf0('0x1c5'),_0x1bf0('0x93'),_0x1bf0('0x1c6')));});};Dialer[_0x1bf0('0x15')][_0x1bf0('0xb4')]=function(_0x5ae8ff){var _0x573564=_0x5ae8ff[_0x1bf0('0x1c7')]/0x64;var _0x55d237=_0x5ae8ff[_0x1bf0('0xd5')]/(_0x5ae8ff[_0x1bf0('0xd5')]+_0x5ae8ff[_0x1bf0('0xc7')]);var _0x332e27=Math['round'](_0x5ae8ff[_0x1bf0('0x1c8')]*(_0x5ae8ff[_0x1bf0('0x1c9')]/0x64));var _0x328016=Math[_0x1bf0('0x1ca')](_0x5ae8ff[_0x1bf0('0x1c8')]*(_0x5ae8ff[_0x1bf0('0x1cb')]/0x64));var _0x4823b5=_0x5ae8ff['available']+_0x5ae8ff[_0x1bf0('0x13d')];var _0x4e979e=Math[_0x1bf0('0x1cc')](_0x5ae8ff['erlangCalls']*_0x5ae8ff[_0x1bf0('0x5a')]*_0x5ae8ff[_0x1bf0('0x1cd')]*_0x5ae8ff['predictiveIntervalMultiplicativeFactor']);if(_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x24')])){if(!_[_0x1bf0('0x3e')](_0x5ae8ff['startPredictive'])){_0x5ae8ff[_0x1bf0('0x23')]=undefined;loggerPredictive[_0x1bf0('0x65')]('[startMethodPredictive][StartProgressive]',_0x1bf0('0x1ce'));}if(!_['isUndefined'](_0x5ae8ff[_0x1bf0('0x63')])){loggerPredictive['error'](_0x1bf0('0x1cf'),_0x1bf0('0x1d0'));clearInterval(_0x5ae8ff[_0x1bf0('0x63')]);_0x5ae8ff[_0x1bf0('0x63')]=undefined;}_0x5ae8ff[_0x1bf0('0x24')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff[_0x1bf0('0x60')],'collection\x20data\x20in\x20progressive\x20at',_0x5ae8ff[_0x1bf0('0x24')]);this[_0x1bf0('0xb8')](_0x5ae8ff,0x1);}else if(ifInterval(_0x5ae8ff['dialPredictiveInterval'],_0x5ae8ff['startProgressive'])){this['handlePower'](_0x5ae8ff,0x1);loggerPredictiveCalls[_0x1bf0('0x46')](_0x1bf0('0x1d1'),_0x5ae8ff[_0x1bf0('0x24')],_0x5ae8ff[_0x1bf0('0x60')]);_0x5ae8ff[_0x1bf0('0x56')]=0x0;_0x5ae8ff[_0x1bf0('0x1d2')]=0x0;}else if(_0x573564<_0x55d237&&_0x5ae8ff[_0x1bf0('0x1d3')]==='dropRate'){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x1d4'),'Dropped\x20calls\x20day',_0x55d237,_0x1bf0('0x24'),_0x5ae8ff['name']);}else if(_0x4e979e<_0x5ae8ff['predictiveIntervalErlangCallsDroppedCalls']&&_0x5ae8ff[_0x1bf0('0x1d3')]===_0x1bf0('0x1d5')){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive['info'](_0x1bf0('0x1d6'),_0x1bf0('0x1d7'),_0x4e979e,_0x1bf0('0x1d8'),_0x5ae8ff['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5ae8ff['name']);}else if(!ifInterval(_0x5ae8ff['dialPredictiveInterval'],_0x5ae8ff[_0x1bf0('0x24')])&&_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x23')])&&!_[_0x1bf0('0x3e')](_0x5ae8ff[_0x1bf0('0x24')])){_0x5ae8ff[_0x1bf0('0x23')]=moment()['format'](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff['name'],_0x1bf0('0x1d9'),_0x5ae8ff[_0x1bf0('0x23')]);hopperUtils[_0x1bf0('0x1da')](_0x5ae8ff[_0x1bf0('0x1db')])[_0x1bf0('0x9e')](this['getDataPredictive'](_0x5ae8ff))[_0x1bf0('0x9e')](mergeDataErlangB(_0x5ae8ff))[_0x1bf0('0x9e')](this[_0x1bf0('0x1dc')](_0x5ae8ff))[_0x1bf0('0xa3')](loggerCatchPredictive(_0x1bf0('0x1dd'),_0x5ae8ff));}else if(!ifInterval(_0x5ae8ff[_0x1bf0('0x1db')],_0x5ae8ff['startPredictive'])){_0x5ae8ff[_0x1bf0('0x1d2')]=0x0;_0x5ae8ff[_0x1bf0('0x23')]=moment()[_0x1bf0('0x43')](_0x1bf0('0xd1'));loggerPredictive['info'](_0x5ae8ff['name'],'recalculate\x20predictive\x20at',_0x5ae8ff[_0x1bf0('0x23')]);clearInterval(_0x5ae8ff[_0x1bf0('0x63')]);_0x5ae8ff[_0x1bf0('0x63')]=undefined;hopperUtils['avgHandleTime'](_0x5ae8ff['dialPredictiveInterval'])[_0x1bf0('0x9e')](this[_0x1bf0('0x1de')](_0x5ae8ff))['then'](mergeDataErlangB(_0x5ae8ff))[_0x1bf0('0x9e')](this['startMethodPredictive'](_0x5ae8ff))[_0x1bf0('0xa3')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5ae8ff));}else if(_0x5ae8ff[_0x1bf0('0x1c8')]&&_0x4823b5<_0x5ae8ff[_0x1bf0('0x1c8')]-_0x328016){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x5ae8ff[_0x1bf0('0x60')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4823b5,')\x20are\x20less\x20than\x20threshold\x20(',_0x5ae8ff[_0x1bf0('0x1c8')],'-',_0x328016,'=',_0x5ae8ff['predictiveIntervalAvailable']-_0x328016,')');}else if(_0x5ae8ff[_0x1bf0('0x1c8')]&&_0x4823b5>_0x5ae8ff[_0x1bf0('0x1c8')]+_0x332e27){clearPredictiveAttributes(_0x5ae8ff);loggerPredictive[_0x1bf0('0x46')](_0x5ae8ff['name'],_0x1bf0('0x1df'),_0x4823b5,_0x1bf0('0x1e0'),_0x5ae8ff['predictiveIntervalAvailable'],'+',_0x332e27,'=',_0x5ae8ff[_0x1bf0('0x1c8')]+_0x332e27,')');}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x1de')]=function(_0x172b30){var _0x19435d=this;return function(_0x10663c){return new Promise(function(_0x37d901,_0x1f3d0a){_[_0x1bf0('0x5e')](_0x172b30,_0x10663c[0x0]);if(checkGetDataPredictive(_0x10663c[0x0])){var _0x4b1083=_0x172b30[_0x1bf0('0x1c8')]=_0x172b30[_0x1bf0('0x13d')]+_0x172b30[_0x1bf0('0x13c')];var _0x4bdb8d=_0x172b30[_0x1bf0('0x1db')]*0x3c;var _0x5a1a37=_0x10663c[0x0][_0x1bf0('0x4f')]+_0x10663c[0x0][_0x1bf0('0x51')];var _0x5e1dfb=(_0x10663c[0x0][_0x1bf0('0x1e1')]+_0x10663c[0x0][_0x1bf0('0xd4')]+_0x10663c[0x0][_0x1bf0('0x4c')])/_0x10663c[0x0][_0x1bf0('0x49')];_0x172b30['predictiveIntervalHitRate']=_0x5e1dfb>0x0?_0x5e1dfb:0x1;switch(_0x172b30[_0x1bf0('0x1d3')]){case'dropRate':var _0x18ce9e=_0x172b30[_0x1bf0('0x1c7')]/0x64;return _0x19435d[_0x1bf0('0x1e2')](_0x4b1083,_0x4bdb8d,_0x5a1a37,_0x5e1dfb,_0x18ce9e)[_0x1bf0('0x9e')](function(_0x380cdb){return _0x37d901(_0x380cdb);});case _0x1bf0('0x1e3'):var _0x4f21fc=_0x172b30[_0x1bf0('0x1c7')]/0x64;return _0x19435d[_0x1bf0('0x1e4')](_0x4b1083,_0x4bdb8d,_0x5a1a37,_0x5e1dfb,_0x4f21fc)[_0x1bf0('0x9e')](function(_0x284612){return _0x37d901(_0x284612);});default:return _0x1f3d0a(msgResponse('[getDataPredictive]',_0x1bf0('0x93'),_0x1bf0('0x1e5')));}}else{return _0x1f3d0a(msgResponse('[getDataPredictive]',_0x1bf0('0x93'),'check\x20failure'));}});};};Dialer[_0x1bf0('0x15')]['getDataPredictiveOld']=function(_0x3a1654){var _0xecb335=this;return function(_0x4577a0){return new Promise(function(_0xd83af8,_0xe45238){_[_0x1bf0('0x5e')](_0x3a1654,_0x4577a0[0x0]);if(checkGetDataPredictive(_0x4577a0[0x0])){loggerPredictive[_0x1bf0('0x46')](JSON['stringify'](_0x4577a0[0x0]));if(_0x3a1654[_0x1bf0('0x1d3')]===_0x1bf0('0x1d5')){return _0xecb335[_0x1bf0('0x1e6')](_0x3a1654['id'])[_0x1bf0('0x9e')](function(_0x1fdf1a){var _0x549b9d=_0x3a1654[_0x1bf0('0x1e7')]-_0x1fdf1a[0x0]['outboundQueuePauses'];var _0x366f1e=_0x3a1654[_0x1bf0('0x1db')]*0x3c;var _0x1d9725=_0x4577a0[0x0][_0x1bf0('0x4f')]+_0x4577a0[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b3a76=(_0x4577a0[0x0][_0x1bf0('0x1e1')]+_0x4577a0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4577a0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4577a0[0x0]['predictiveIntervalTotalCalls'];var _0x47ebbf=_0x3a1654[_0x1bf0('0x1c7')]/0x64;_0x3a1654[_0x1bf0('0x1e8')]=_0x1fdf1a[0x0][_0x1bf0('0x1e9')]||0x0;_0x3a1654[_0x1bf0('0x1cd')]=_0x5b3a76>0x0?_0x5b3a76:0x1;return _0xecb335[_0x1bf0('0x1e2')](_0x549b9d,_0x366f1e,_0x1d9725,_0x5b3a76,_0x47ebbf);})[_0x1bf0('0x9e')](function(_0x61cdc5){return _0xd83af8(_0x61cdc5);})[_0x1bf0('0xa3')](function(_0x45ab9e){return _0xe45238(msgResponse('[CatchErlangB]',_0x1bf0('0x93'),JSON['stringify'](_0x45ab9e)));});}if(_0x3a1654['dialPredictiveOptimization']==='agentBusyFactor'){return _0xecb335[_0x1bf0('0x1e6')](_0x3a1654['id'])[_0x1bf0('0x9e')](function(_0x5d9241){var _0x249a77=_0x3a1654['loggedIn']-_0x5d9241[0x0]['outboundQueuePauses'];var _0x27c6c1=_0x3a1654[_0x1bf0('0x1db')]*0x3c;var _0x3c73bd=_0x4577a0[0x0][_0x1bf0('0x4f')]+_0x4577a0[0x0]['predictiveIntervalAvgHoldtime'];var _0x42d629=(_0x4577a0[0x0][_0x1bf0('0x1e1')]+_0x4577a0[0x0][_0x1bf0('0xd4')]+_0x4577a0[0x0][_0x1bf0('0x4c')])/_0x4577a0[0x0][_0x1bf0('0x49')];var _0x4b9fd6=_0x3a1654['dialPredictiveOptimizationPercentage']/0x64;_0x3a1654[_0x1bf0('0x1e8')]=_0x5d9241[0x0][_0x1bf0('0x1e9')]||0x0;_0x3a1654[_0x1bf0('0x1cd')]=_0x42d629>0x0?_0x42d629:0x1;return _0xecb335[_0x1bf0('0x1e4')](_0x249a77,_0x27c6c1,_0x3c73bd,_0x42d629,_0x4b9fd6);})[_0x1bf0('0x9e')](function(_0x42f447){return _0xd83af8(_0x42f447);})['catch'](function(_0x1b2c8d){return _0xe45238(msgResponse(_0x1bf0('0x1ea'),'Failure',JSON[_0x1bf0('0x76')](_0x1b2c8d)));});}}else{return _0xe45238(msgResponse(_0x1bf0('0x1eb'),'Failure',_0x1bf0('0x1ec')));}});};};Dialer[_0x1bf0('0x15')]['startMethodPredictive']=function(_0x3eea47){var _0x224469=this;return function(){var _0x539933=0x0;var _0x12c742=Math[_0x1bf0('0x1cc')](_0x3eea47[_0x1bf0('0x58')]*0x3e8);if(_0x12c742>0x0){_0x12c742=_0x12c742<0x64?0x64:_0x12c742;loggerPredictive[_0x1bf0('0x46')](_0x3eea47['name'],_0x1bf0('0x1ed'),_0x12c742,_0x1bf0('0x1ee'));_0x3eea47['handlePredictive']=setInterval(function(){_0x224469['handlePredictive'](_0x3eea47);loggerPredictiveCalls[_0x1bf0('0x46')](_0x1bf0('0x1ef'),_0x539933+=0x1);},_0x12c742);}else{loggerPredictive[_0x1bf0('0x46')](_0x3eea47[_0x1bf0('0x60')],_0x1bf0('0x1f0'));}};};Dialer[_0x1bf0('0x15')]['checkContactBlack']=function(_0x27ec72,_0x2cebf7){var _0x4549df=this;return function(_0x27c794){if(_[_0x1bf0('0x45')](_0x27c794)){if(_['isNil'](_0x2cebf7[_0x1bf0('0x15a')])||!_0x2cebf7[_0x1bf0('0x1f1')]){if(_0x27ec72[_0x1bf0('0xb3')]==='booked'){_0x27ec72['queueStatusComplete']=_['isUndefined'](_0x27ec72['queueStatusComplete'])?!![]:_0x27ec72[_0x1bf0('0x74')];var _0x405a6d=uuid['v4']();_0x4549df[_0x1bf0('0x1f')][_0x405a6d]=new Action(_0x27ec72,_0x2cebf7,_0x405a6d);loggerBooked['info'](_0x1bf0('0x1f2'),_0x405a6d,_0x1bf0('0x1f3'),JSON['stringify'](_0x27ec72[_0x1bf0('0x74')]),_0x1bf0('0x1f4'),_0x27ec72[_0x1bf0('0x60')]);if(_0x27ec72[_0x1bf0('0x74')]){_0x27ec72['queueStatusComplete']=![];_0x4549df[_0x1bf0('0x26')][_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xc1')]]=[];ami[_0x1bf0('0x9c')]({'actionid':_0x405a6d,'action':_0x1bf0('0x1f5'),'queue':_0x27ec72['name']})[_0x1bf0('0xa3')](function(){_0x4549df['updateOriginated'](_0x27ec72);hopperUtils[_0x1bf0('0x104')]({'active':![],'ContactId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe2')],'ListId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe3')],'VoiceQueueId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d]['VoiceQueueId']||undefined,'CampaignId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe5')]||undefined})['catch'](loggerCatch(_0x1bf0('0x1f6')));delete _0x4549df[_0x1bf0('0x1f')][_0x405a6d];});}else{loggerBooked[_0x1bf0('0x46')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x27ec72[_0x1bf0('0x74')]),_0x1bf0('0x1f4'),_0x27ec72[_0x1bf0('0x60')]);_0x4549df[_0x1bf0('0xc4')](_0x27ec72);hopperUtils[_0x1bf0('0x104')]({'active':![],'ContactId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe2')],'ListId':_0x4549df[_0x1bf0('0x1f')][_0x405a6d][_0x1bf0('0xe3')],'VoiceQueueId':_0x4549df['actions'][_0x405a6d][_0x1bf0('0xe4')]||undefined,'CampaignId':_0x4549df['actions'][_0x405a6d][_0x1bf0('0xe5')]||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1f6')));delete _0x4549df[_0x1bf0('0x1f')][_0x405a6d];}}else{return _0x4549df['actionOriginate'](_0x27ec72,_0x2cebf7);}}else{if(utils['getSeconds'](undefined,_0x2cebf7[_0x1bf0('0x1f7')])<_0x27ec72[_0x1bf0('0x1f8')]*0x3c){if(_0x2cebf7[_0x1bf0('0x14d')]&&!_0x2cebf7['Agent'][_0x1bf0('0x1f9')]){_0x4549df[_0x1bf0('0xf9')][_0x1bf0('0xfa')](_0x2cebf7['id'])[_0x1bf0('0x17')](function(){_0x4549df['updateOriginated'](_0x27ec72);});}else{hopperUtils[_0x1bf0('0x1fa')]({'active':![]},_0x2cebf7['id'],0x1)[_0x1bf0('0x17')](function(){_0x4549df[_0x1bf0('0xc4')](_0x27ec72);});}}else{_0x27ec72[_0x1bf0('0x1fb')]+=0x1;_0x4549df[_0x1bf0('0xc4')](_0x27ec72);if(_0x27ec72['dialRecallInQueue']){hopperUtils[_0x1bf0('0x104')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cebf7['ContactId'],'ListId':_0x2cebf7[_0x1bf0('0xe3')],'VoiceQueueId':_0x2cebf7['VoiceQueueId']||undefined,'CampaignId':_0x2cebf7['CampaignId']||undefined})[_0x1bf0('0xa3')](loggerCatch(_0x1bf0('0x1fc')));hopperUtils[_0x1bf0('0xcc')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')][_0x1bf0('0x1fd')],0x17,_0x1bf0('0x1fe')))['catch'](loggerCatch(_0x1bf0('0x1ff')));}else{_0x4549df[_0x1bf0('0x12a')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0x1bf0('0x200'),'[Originate][HistoryRecallClose]');}}}}else{_0x27ec72[_0x1bf0('0x201')]+=0x1;_0x4549df[_0x1bf0('0x12a')](createObjHistory(_0x27ec72,_0x2cebf7,utils[_0x1bf0('0x6a')]['BLACKLIST'],0xd,'Blacklist'),_0x1bf0('0x202'),_0x1bf0('0x203'));throw _0x1bf0('0x204');}};};Dialer['prototype'][_0x1bf0('0x15e')]=function(_0x1bef7e){var _0x4e1e36=this;var _0x33638c=_0x1bef7e[_0x1bf0('0x205')]-_0x1bef7e[_0x1bf0('0x80')];emitCampaignSummary(_0x1bef7e);if(_0x33638c>0x0&&_0x1bef7e['temp']==0x0){if(_0x33638c>this[_0x1bf0('0x1d')]){_0x33638c=this['maxNumberOriginate'];}_0x1bef7e[_0x1bf0('0x68')]=0x1;hopperUtils['getContactDialerIvr'](_0x1bef7e,_0x33638c)[_0x1bf0('0x9e')](function(_0x57be25){_0x1bef7e[_0x1bf0('0x68')]=0x0;if(_0x57be25){if(!utils[_0x1bf0('0x206')](_0x57be25)){_0x1bef7e[_0x1bf0('0x6e')]=utils['CAMPAIGN_STATUS'][_0x1bf0('0x207')];logger[_0x1bf0('0x46')](_0x1bf0('0x208')+_0x1bef7e[_0x1bf0('0x60')]);}else{_0x1bef7e['originated']+=_0x57be25[_0x1bf0('0x9a')];_0x1bef7e[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['RUNNING'];for(var _0x3276a9=0x0;_0x3276a9<_0x57be25[_0x1bf0('0x9a')];_0x3276a9+=0x1){_0x1bef7e[_0x1bf0('0x209')]+=0x1;if(_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9])||_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9]['Contact'])||_[_0x1bf0('0xf4')](_0x57be25[_0x3276a9]['phone'])){_0x4e1e36['emptyContact'](_0x1bf0('0x20a'),_0x1bef7e,_0x57be25[_0x3276a9]);}else{hopperUtils[_0x1bf0('0x20b')](_[_0x1bf0('0x77')](_0x57be25[_0x3276a9],[_0x1bf0('0xe5'),_0x1bf0('0x163')]))['then'](_0x4e1e36[_0x1bf0('0x20c')](_0x1bef7e,_0x57be25[_0x3276a9]))[_0x1bf0('0xa3')](_0x4e1e36[_0x1bf0('0x157')](_0x1bf0('0x20d'),_0x1bef7e));}}}}})['catch'](loggerGetContactDialer(_0x1bf0('0x20e'),_0x1bef7e,_0x33638c));}};Dialer[_0x1bf0('0x15')][_0x1bf0('0xb8')]=function(_0x9449cc,_0x1f6403){var _0x38e4c1=this;var _0x35a6ef=[];if(_0x1f6403<0x1||_0x9449cc[_0x1bf0('0xb3')]===_0x1bf0('0x6')){_0x1f6403=0x1;}var _0x5ac4fb=Math[_0x1bf0('0x1cc')](_0x9449cc[_0x1bf0('0x13c')]*_0x1f6403)-_0x9449cc['originated'];if(_0x9449cc[_0x1bf0('0x20f')]>0x0){var _0x41e4b2=_0x9449cc['dialLimitQueue']-_0x9449cc[_0x1bf0('0x80')]-_0x9449cc[_0x1bf0('0x13d')]-_0x9449cc[_0x1bf0('0x13e')];if(_0x5ac4fb>_0x41e4b2){_0x5ac4fb=_0x41e4b2;}}if(_0x5ac4fb>0x0&&_0x9449cc['temp']==0x0){if(_0x9449cc[_0x1bf0('0xb3')]===_0x1bf0('0x6')){_0x5ac4fb=0x1;}if(_0x5ac4fb>this['maxNumberOriginate']){_0x5ac4fb=this[_0x1bf0('0x1d')];}for(var _0x218b56 in this['agents']){if(typeof this['agents'][_0x218b56]!==_0x1bf0('0xac')){if(this[_0x1bf0('0x1b')][_0x218b56][_0x1bf0('0xd6')]===_0x1bf0('0x210')&&this[_0x1bf0('0x1b')][_0x218b56][_0x1bf0('0x87')]===_0x1bf0('0x14a')){_0x35a6ef['push'](this[_0x1bf0('0x1b')][_0x218b56]['id']);}}}_0x9449cc[_0x1bf0('0x68')]=0x1;hopperUtils['getContactDialer'](_0x9449cc,_0x35a6ef,_0x5ac4fb)[_0x1bf0('0x9e')](function(_0x5c54e6){_0x9449cc['temp']=0x0;if(_0x5c54e6){if(!utils[_0x1bf0('0x206')](_0x5c54e6)){hopperUtils['countReScheduled'](_0x9449cc)['then'](sendMessageReschedule(_0x9449cc))['catch'](loggerCatch(_0x1bf0('0x211')));}else{_0x9449cc[_0x1bf0('0x80')]+=_0x5c54e6[_0x1bf0('0x9a')];_0x9449cc[_0x1bf0('0x6e')]=_0x9449cc[_0x1bf0('0xb3')]==='booked'?utils[_0x1bf0('0x6a')][_0x1bf0('0x13f')]:utils['CAMPAIGN_STATUS'][_0x1bf0('0x212')];for(var _0xdda057=0x0;_0xdda057<_0x5c54e6[_0x1bf0('0x9a')];_0xdda057+=0x1){if(_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057])||_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057]['Contact'])||_[_0x1bf0('0xf4')](_0x5c54e6[_0xdda057]['phone'])){_0x38e4c1[_0x1bf0('0x158')](_0x1bf0('0x20a'),_0x9449cc,_0x5c54e6[_0xdda057]);}else{hopperUtils[_0x1bf0('0x213')](_[_0x1bf0('0x77')](_0x5c54e6[_0xdda057],[_0x1bf0('0xe4'),_0x1bf0('0x163')]))[_0x1bf0('0x9e')](_0x38e4c1[_0x1bf0('0x20c')](_0x9449cc,_0x5c54e6[_0xdda057]))[_0x1bf0('0xa3')](_0x38e4c1['loggerHandler']('[actionOriginate]\x20',_0x9449cc));}}}}})[_0x1bf0('0xa3')](loggerGetContactDialer(_0x1bf0('0x214'),_0x9449cc,_0x5ac4fb));}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x63')]=function(_0x41d412){if(_0x41d412['dialLimitQueue']>0x0){var _0x498250=_0x41d412[_0x1bf0('0x20f')]-_0x41d412[_0x1bf0('0x80')]-_0x41d412[_0x1bf0('0x13d')];if(_0x498250>0x0&&_0x41d412[_0x1bf0('0x68')]==0x0){this['tryOriginatePredictive'](_0x41d412);}else{loggerPredictiveCalls[_0x1bf0('0x46')]('[handlePredictive][limitChannel]');}}else{this[_0x1bf0('0x215')](_0x41d412);}};Dialer[_0x1bf0('0x15')][_0x1bf0('0x215')]=function(_0x3010e0){var _0xb08067=this;var _0x7ac7aa=[];_0x3010e0['originated']+=0x1;for(var _0x397286 in this[_0x1bf0('0x1b')]){if(typeof this[_0x1bf0('0x1b')][_0x397286]!==_0x1bf0('0xac')){if(this['agents'][_0x397286]['state']===_0x1bf0('0x210')&&this['agents'][_0x397286][_0x1bf0('0x87')]===_0x1bf0('0x14a')){_0x7ac7aa[_0x1bf0('0x9b')](this[_0x1bf0('0x1b')][_0x397286]['id']);}}}_0x3010e0[_0x1bf0('0x68')]=0x1;return this[_0x1bf0('0x216')](_0x3010e0['id'],_0x7ac7aa,0x1,_0x3010e0[_0x1bf0('0x217')],_0x3010e0)[_0x1bf0('0x9e')](function(_0x56835f){_0x3010e0[_0x1bf0('0x68')]=0x1;if(_0x56835f){if(!utils[_0x1bf0('0x206')](_0x56835f)){utils[_0x1bf0('0x67')](_0x3010e0,0x1,0x0);return hopperUtils['countReScheduled'](_0x3010e0)[_0x1bf0('0x9e')](sendMessageReschedule(_0x3010e0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3010e0[_0x1bf0('0x6e')]=utils[_0x1bf0('0x6a')]['RUNNING'];if(_['isNil'](_0x56835f[0x0])||_[_0x1bf0('0xf4')](_0x56835f[0x0][_0x1bf0('0x17c')])||_['isNil'](_0x56835f[0x0]['phone'])){_0xb08067[_0x1bf0('0x158')]('[actionOriginate]\x20',_0x3010e0,_0x56835f[0x0]);}else{return hopperUtils[_0x1bf0('0x213')](_[_0x1bf0('0x77')](_0x56835f[0x0],['VoiceQueueId',_0x1bf0('0x163')]))[_0x1bf0('0x9e')](_0xb08067[_0x1bf0('0x20c')](_0x3010e0,_0x56835f[0x0]))['catch'](_0xb08067[_0x1bf0('0x157')]('[actionOriginatePredictive]\x20',_0x3010e0));}}}})[_0x1bf0('0xa3')](loggerGetContactDialer(_0x1bf0('0x218'),_0x3010e0,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x56730a,_0x20b283,_0x569643,_0x485655,_0x3a9e8e,_0x4afcba){loggerPredictive['info'](_0x1bf0('0x219'));loggerPredictive['info'](_0x1bf0('0x21a'),_0x56730a);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21b'),_0x20b283);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21c'),_0x569643);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21d'),_0x485655);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21e'),_0x3a9e8e);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5d'));return new Promise(function(_0x376743,_0x2cb320){if(_0x56730a<=0x0||isNaN(_0x56730a)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x220')+_0x56730a));}if(_0x569643<=0x0||isNaN(_0x569643)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x221')+_0x569643));}if(_0x485655<=0x0||isNaN(_0x485655)){return _0x2cb320(msgResponse('[abandonmentRate]',_0x1bf0('0x84'),_0x1bf0('0x222')+_0x485655));}if(_0x20b283<=0x0||isNaN(_0x20b283)){return _0x2cb320(msgResponse('[abandonmentRate]',_0x1bf0('0x84'),'interval\x20=\x20'+_0x20b283));}if(_0x3a9e8e<=0x0||isNaN(_0x3a9e8e)){return _0x2cb320(msgResponse(_0x1bf0('0x21f'),_0x1bf0('0x84'),_0x1bf0('0x223')+_0x3a9e8e));}_0x4afcba=_0x4afcba||0x0;var _0x6b96a5=0x1/_0x569643;var _0x5e1531=0x0;var _0x59b999=0x0;var _0x5e52af=0x0;var _0x18178e=0x0;for(var _0x2bc924=0x0;_0x5e52af<_0x3a9e8e;_0x2bc924+=0x1){_0x59b999=_0x2bc924/_0x20b283;_0x5e1531=(_0x485655*_0x59b999+_0x4afcba)/_0x6b96a5;_0x5e52af=utils[_0x1bf0('0x224')](_0x5e1531,_0x56730a);_0x18178e=_0x5e1531/_0x56730a*(0x1-utils[_0x1bf0('0x224')](_0x5e1531,_0x56730a));}return _0x376743({'erlangCalls':_0x2bc924,'erlangCallToSecond':_0x20b283/_0x2bc924,'erlangAbandonmentRate':_0x5e52af,'erlangBusyFactor':_0x18178e});});};Dialer[_0x1bf0('0x15')][_0x1bf0('0x1e4')]=function(_0x25416d,_0xb79a03,_0x1e0f2b,_0x351113,_0x5eb31a,_0x3926e5){loggerPredictive['info'](_0x1bf0('0x225'));loggerPredictive[_0x1bf0('0x46')]('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',_0x25416d);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21b'),_0xb79a03);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21c'),_0x1e0f2b);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x21d'),_0x351113);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x226'),_0x5eb31a);loggerPredictive[_0x1bf0('0x46')](_0x1bf0('0x5d'));return new Promise(function(_0x310cb5,_0x539477){if(_0x25416d<=0x0||isNaN(_0x25416d)){return _0x539477(msgResponse('[busyFactor]','Error',_0x1bf0('0x220')+_0x25416d));}if(_0x1e0f2b<=0x0||isNaN(_0x1e0f2b)){return _0x539477(msgResponse(_0x1bf0('0x227'),_0x1bf0('0x84'),_0x1bf0('0x221')+_0x1e0f2b));}if(_0x351113<=0x0||isNaN(_0x351113)){return _0x539477(msgResponse('[busyFactor]',_0x1bf0('0x84'),_0x1bf0('0x222')+_0x351113));}if(_0xb79a03<=0x0||isNaN(_0xb79a03)){return _0x539477(msgResponse(_0x1bf0('0x227'),_0x1bf0('0x84'),_0x1bf0('0x228')+_0xb79a03));}if(_0x5eb31a<=0x0||isNaN(_0x5eb31a)){return _0x539477(msgResponse('[busyFactor]',_0x1bf0('0x84'),_0x1bf0('0x229')+_0x5eb31a));}_0x3926e5=_0x3926e5||0x0;var _0x26bff6=0x1/_0x1e0f2b;var _0x151761=0x0;var _0x2b418a=0x0;var _0x5dc081=0x0;var _0x22eaa0=0x0;for(var _0x5a385b=0x0;_0x22eaa0<_0x5eb31a;_0x5a385b+=0x1){_0x2b418a=_0x5a385b/_0xb79a03;_0x151761=(_0x351113*_0x2b418a+_0x3926e5)/_0x26bff6;_0x5dc081=utils[_0x1bf0('0x224')](_0x151761,_0x25416d);_0x22eaa0=_0x151761/_0x25416d*(0x1-utils[_0x1bf0('0x224')](_0x151761,_0x25416d));}return _0x310cb5({'erlangCalls':_0x5a385b,'erlangCallToSecond':_0xb79a03/_0x5a385b,'erlangAbandonmentRate':_0x5dc081,'erlangBusyFactor':_0x22eaa0});});};module[_0x1bf0('0x22a')]=Dialer; \ No newline at end of file +var _0x5dbf=['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','erlangBusyFactor','erlangAbandonmentRate','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','temp','message','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','Error','isTrunkReachable','SIP/%s','status','reachable','trunks','unmonitored','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','loopCampaigns','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','pick','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','getQueue','response','Success','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','Machine','[syncAgentComplete][createHistory][0]','createStateFinal','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','[syncHangupIvr]','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','cause-txt','queuesSummary','running','INACTIVE','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','loggedIn','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[busyFactor]','Umin\x20=\x20','exports','lodash','moment','./utils','../preview/util/util','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','debug','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];(function(_0x274f14,_0x27dd7f){var _0x13b97e=function(_0x7d9432){while(--_0x7d9432){_0x274f14['push'](_0x274f14['shift']());}};_0x13b97e(++_0x27dd7f);}(_0x5dbf,0x1c5));var _0xf5db=function(_0x480afe,_0x175253){_0x480afe=_0x480afe-0x0;var _0x19e5f9=_0x5dbf[_0x480afe];return _0x19e5f9;};'use strict';var util=require('util');var _=require(_0xf5db('0x0'));var uuid=require('uuid');var moment=require(_0xf5db('0x1'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xf5db('0x2'));var hopperUtils=require('./utils/hopper');var ut=require(_0xf5db('0x3'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xf5db('0x4'))(_0xf5db('0x5'));var loggerPredictive=require(_0xf5db('0x4'))(_0xf5db('0x6'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf5db('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xf5db('0x8'));var ami=require(_0xf5db('0x9'));config['redis']=_[_0xf5db('0xa')](config[_0xf5db('0xb')],{'host':_0xf5db('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf5db('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xf5db('0xd'));var RpcSetting=require(_0xf5db('0xe'));var Interval=require(_0xf5db('0xf'));var Action=require(_0xf5db('0x10'));var History=require('./models/history');var Final=require(_0xf5db('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xf5db('0x12'));var Hangup=require(_0xf5db('0x13'));var ipAgi=process[_0xf5db('0x14')][_0xf5db('0x15')]||_0xf5db('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xf5db('0x17')][_0xf5db('0x18')]=function(_0x4298a9){this[_0xf5db('0x19')]=this[_0xf5db('0x19')]?this[_0xf5db('0x19')][_0xf5db('0x1a')](_0x4298a9):_0x4298a9();};function Dialer(_0xc29dae,_0x24408e){this[_0xf5db('0x1b')]=new Sequence();this[_0xf5db('0x1c')]=_0x24408e;this['voiceQueues']=_0xc29dae[_0xf5db('0x1d')];this['campaigns']=_0xc29dae[_0xf5db('0x1e')];this[_0xf5db('0x1f')]=_0xc29dae[_0xf5db('0x1f')];this['trunks']=_0xc29dae['trunks'];this['maxNumberOriginate']=config[_0xf5db('0x20')]||0x2;this[_0xf5db('0x21')]={};this[_0xf5db('0x22')]={};this[_0xf5db('0x23')]={};this[_0xf5db('0x24')]={};this['optionPredictive']={};this[_0xf5db('0x25')]={};this[_0xf5db('0x26')]={};this[_0xf5db('0x27')]={};this[_0xf5db('0x28')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0xf5db('0x29'),this[_0xf5db('0x2a')][_0xf5db('0x2b')](this));ami['on'](_0xf5db('0x2c'),this[_0xf5db('0x2d')][_0xf5db('0x2b')](this));ami['on']('originateresponse',this[_0xf5db('0x2e')][_0xf5db('0x2b')](this));ami['on'](_0xf5db('0x2f'),this[_0xf5db('0x30')][_0xf5db('0x2b')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xf5db('0x31')][_0xf5db('0x2b')](this));ami['on']('hangup',this[_0xf5db('0x32')][_0xf5db('0x2b')](this));ami['on'](_0xf5db('0x33'),this[_0xf5db('0x34')][_0xf5db('0x2b')](this));ami['on'](_0xf5db('0x35'),this['syncVarSet'][_0xf5db('0x2b')](this));ami['on'](_0xf5db('0x36'),this['syncQueueMember'][_0xf5db('0x2b')](this));ami['on']('queuestatuscomplete',this[_0xf5db('0x37')]['bind'](this));this['loopCampaigns']();this[_0xf5db('0x38')]();RpcSetting[_0xf5db('0x39')]()[_0xf5db('0x3a')](function(_0x419fd3){previewRecallmeReminderInterval=_0x419fd3[_0xf5db('0x3b')];});}function isNotNull(_0x547b0d){return _0x547b0d!==null&&!_['isUndefined'](_0x547b0d);}function msgResponse(_0x4da605,_0x4e3476,_0x36de14){return{'action':_0x4da605,'response':_0x4e3476,'message':_0x36de14,'stack':_0x36de14};}function emit(_0x2c9055,_0x515550,_0x18d3a7){io['to'](_0x2c9055)[_0xf5db('0x3c')](_0x515550,_0x18d3a7);}function emitOutboundVoiceQueueSummary(_0x10119f){if(_0x10119f[_0xf5db('0x3d')]==='outbound'){logger[_0xf5db('0x3e')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x10119f,{'showHidden':![],'depth':null}));emit(util[_0xf5db('0x3f')](_0xf5db('0x40'),_0x10119f[_0xf5db('0x41')]),_0xf5db('0x42'),_0x10119f);}}function checkGetDataPredictive(_0x2cd41e){if(isNotNull(_0x2cd41e)&&!_[_0xf5db('0x43')](_0x2cd41e)){loggerPredictive[_0xf5db('0x44')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xf5db('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cd41e[_0xf5db('0x45')]);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x46'),_0x2cd41e[_0xf5db('0x47')]);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x48'),_0x2cd41e[_0xf5db('0x49')]);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x4a'),_0x2cd41e[_0xf5db('0x4b')]);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x4c'),_0x2cd41e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xf5db('0x44')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cd41e[_0xf5db('0x4d')]);loggerPredictive[_0xf5db('0x44')]('---------------------------');if(_0x2cd41e[_0xf5db('0x45')]>0x0){if(!_[_0xf5db('0x4e')](_0x2cd41e[_0xf5db('0x4d')])&&_0x2cd41e[_0xf5db('0x4d')]>0x0){return!![];}loggerPredictive[_0xf5db('0x44')](_0xf5db('0x4f'));if(!_['isUndefined'](_0x2cd41e[_0xf5db('0x50')])&&_0x2cd41e[_0xf5db('0x50')]>0x0){return!![];}loggerPredictive[_0xf5db('0x44')](_0xf5db('0x51'));}else{loggerPredictive[_0xf5db('0x44')](_0xf5db('0x52'));}}else{loggerPredictive[_0xf5db('0x44')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5eca27){return function(_0x4b6e8e){loggerPredictive[_0xf5db('0x44')](_0xf5db('0x53'));loggerPredictive[_0xf5db('0x44')](_0xf5db('0x54'),_0x4b6e8e['erlangCalls']);loggerPredictive['info'](_0xf5db('0x55'),_0x4b6e8e['erlangCallToSecond']);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x56'),_0x4b6e8e['erlangAbandonmentRate']);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x57'),_0x4b6e8e[_0xf5db('0x58')]);loggerPredictive[_0xf5db('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b6e8e[_0xf5db('0x59')]);loggerPredictive[_0xf5db('0x44')]('---------------------------');_[_0xf5db('0x5a')](_0x5eca27,_0x4b6e8e);};}function ifInterval(_0x4169da,_0x1c942d){if(_[_0xf5db('0x4e')](_0x1c942d)){return![];}return utils['getSeconds'](undefined,_0x1c942d)<_0x4169da*0x3c;}function clearPredictiveAttributes(_0x17ad41){if(_0x17ad41[_0xf5db('0x26')]){_0x17ad41['startProgressive']=undefined;loggerPredictive[_0xf5db('0x3e')](_0x17ad41[_0xf5db('0x41')],_0xf5db('0x5b'));}if(_0x17ad41[_0xf5db('0x25')]){_0x17ad41[_0xf5db('0x25')]=undefined;loggerPredictive[_0xf5db('0x3e')](_0x17ad41[_0xf5db('0x41')],_0xf5db('0x5c'));}if(_0x17ad41[_0xf5db('0x5d')]){clearInterval(_0x17ad41[_0xf5db('0x5d')]);_0x17ad41['handlePredictive']=undefined;loggerPredictive[_0xf5db('0x3e')](_0x17ad41[_0xf5db('0x41')],_0xf5db('0x5e'));}}function loggerCatchPredictive(_0x1f7027,_0x458880){return function(_0x354b70){loggerPredictive[_0xf5db('0x5f')](_0x458880[_0xf5db('0x41')],_0x1f7027);loggerPredictive[_0xf5db('0x5f')](_0x354b70[_0xf5db('0x60')]);clearPredictiveAttributes(_0x458880);};}function loggerCatch(_0x31287b){return function(_0x513279){logger[_0xf5db('0x5f')](_0x31287b,util[_0xf5db('0x61')](_0x513279,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3ad329,_0x2a46c8,_0x4ce531){return function(_0x5c4587){utils['checkContactLowerLimitOriginate'](_0x2a46c8,_0x4ce531,0x0);_0x2a46c8[_0xf5db('0x62')]=0x0;logger[_0xf5db('0x5f')](_0x3ad329,util[_0xf5db('0x61')](_0x5c4587,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x32a108){return function(_0x2dd5bb){if(isNotNull(_0x2dd5bb)&&isNotNull(_0x2dd5bb[0x0])){if(_0x2dd5bb[0x0]['contactsRescheduled']>0x0){_0x32a108[_0xf5db('0x63')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0xf5db('0x44')](_0xf5db('0x64')+_0x32a108[_0xf5db('0x41')],_0x2dd5bb[0x0]['contactsRescheduled'],_0xf5db('0x65'));}else{_0x32a108['message']=utils[_0xf5db('0x66')][_0xf5db('0x67')];logger[_0xf5db('0x44')]('[getContactDialer2][Empty]'+_0x32a108[_0xf5db('0x41')]);}}};}function createObjHistory(_0x5a2070,_0x4f25b2,_0x2858a2,_0x40adcc,_0x32f2b3){_0x5a2070[_0xf5db('0x63')]=_0x2858a2;var _0xa529d3=new Action(_0x5a2070,_0x4f25b2);var _0x4fab7a=new History(_0xa529d3);_0x4fab7a[_0xf5db('0x68')]=_0x40adcc;_0x4fab7a[_0xf5db('0x69')]=_0x32f2b3;_0x4fab7a[_0xf5db('0x6a')]=_0xa529d3[_0xf5db('0x6b')];return _0x4fab7a;}function unlockQueueStatus(_0x5cb3f9,_0x5938a6){setTimeout(function(){if(_[_0xf5db('0x4e')](_0x5cb3f9[_0xf5db('0x6c')])){loggerBooked[_0xf5db('0x5f')](_0xf5db('0x6d'),_0x5938a6);}_0x5cb3f9[_0xf5db('0x6c')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x5938a6,JSON[_0xf5db('0x6e')](_['pick'](_0x5cb3f9,[_0xf5db('0x41'),_0xf5db('0x6c')])));},0x1f3);}function checkInterval(_0x591049){return function(){if(!isNotNull(_0x591049[_0xf5db('0x6f')])){_0x591049['message']=utils[_0xf5db('0x66')][_0xf5db('0x70')];throw _0x591049[_0xf5db('0x41')]+_0xf5db('0x71');}if(!isNotNull(_0x591049[_0xf5db('0x6f')]['Intervals'])){_0x591049[_0xf5db('0x63')]=utils[_0xf5db('0x66')][_0xf5db('0x70')];throw _0x591049[_0xf5db('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xf5db('0x43')](_0x591049[_0xf5db('0x6f')][_0xf5db('0x72')]))){_0x591049[_0xf5db('0x63')]=utils[_0xf5db('0x66')][_0xf5db('0x70')];throw _0x591049[_0xf5db('0x41')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x520fcb){return function(){if(!utils[_0xf5db('0x73')](_0x520fcb)){_0x520fcb['message']=utils[_0xf5db('0x66')]['INACTIVE'];throw _0x520fcb[_0xf5db('0x41')]+_0xf5db('0x74');}};}function emitCampaignSummary(_0x563187){if(utils[_0xf5db('0x75')](_0x563187)){emit(util['format'](_0xf5db('0x76'),_0x563187['name']),_0xf5db('0x77'),_0x563187);}}function loggerCatchQueueSummary(_0x116d0a,_0x5b7d44){return function(_0x37f4b8){clearPredictiveAttributes(_0x5b7d44);emitCampaignSummary(_0x5b7d44);loggerSyncQueueSummary['debug'](_0x116d0a,util[_0xf5db('0x61')](_0x37f4b8,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xf4f05f){if(_0xf4f05f['sendMessageOneNotActive']){if(_0xf4f05f[_0xf5db('0x78')]===0x0){_0xf4f05f[_0xf5db('0x79')]=![];_0xf4f05f[_0xf5db('0x63')]=utils[_0xf5db('0x66')]['INACTIVE'];loggerSyncQueueSummary[_0xf5db('0x3e')](_0xf5db('0x7a'),_0xf4f05f[_0xf5db('0x41')],_0xf5db('0x7b'));}else{_0xf4f05f[_0xf5db('0x63')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0xf5db('0x3e')](_0xf5db('0x7a'),_0xf4f05f[_0xf5db('0x41')],'is\x20disactive');}emitCampaignSummary(_0xf4f05f);}}function myreject(_0x3d2a06){return function(_0x4ab28c){return _0x3d2a06(msgResponse(_0xf5db('0x7c'),_0xf5db('0x7d'),JSON[_0xf5db('0x6e')](_0x4ab28c)));};}Dialer[_0xf5db('0x17')][_0xf5db('0x7e')]=function(_0x10447b){return!_['isUndefined'](_0x10447b)&&_0x10447b&&!_[_0xf5db('0x4e')](_0x10447b[_0xf5db('0x41')])&&!_[_0xf5db('0x4e')](_0x10447b['active'])&&_0x10447b['active']&&(this['trunks'][util[_0xf5db('0x3f')](_0xf5db('0x7f'),_0x10447b[_0xf5db('0x41')])][_0xf5db('0x80')]===_0xf5db('0x81')||this[_0xf5db('0x82')][util[_0xf5db('0x3f')]('SIP/%s',_0x10447b[_0xf5db('0x41')])][_0xf5db('0x80')]===_0xf5db('0x83'));};Dialer[_0xf5db('0x17')]['checkIsTrunkReachable']=function(_0x22ae6e){var _0x248773=this;return function(){if(!_0x248773['isTrunkReachable'](_0x22ae6e[_0xf5db('0x84')])){if(!_0x248773[_0xf5db('0x7e')](_0x22ae6e[_0xf5db('0x85')])){_0x22ae6e['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x22ae6e['name']+_0xf5db('0x86');}}};};Dialer['prototype'][_0xf5db('0x87')]=function(_0x118fe4,_0xf1c273,_0x2e7fbd,_0xa7afc1){var _0x1c923c=this;return function(){var _0x1ac340=!![];return _0x1c923c[_0xf5db('0x88')](_0x118fe4,_0xf1c273,_0x2e7fbd,_0xa7afc1,_0x1ac340);};};Dialer[_0xf5db('0x17')]['checkIfTimeIntervals']=function(_0x5a9290,_0x7e41ab,_0x4a6938,_0x6c1568){var _0x54fa55=this;return function(){var _0xd28202=![];return _0x54fa55['ifTimeIvr'](_0x5a9290[_0xf5db('0x72')],_0x7e41ab,_0x4a6938,_0x6c1568,_0xd28202);};};Dialer[_0xf5db('0x17')][_0xf5db('0x88')]=function(_0x5f12dc,_0x1e5c7d,_0x5569f3,_0x152e76,_0x293464){var _0x166f6d=[];return new Promise(function(_0xe8e672,_0x2ec06d){if(!isNotNull(_0x5f12dc)){_0x152e76['message']=utils['CAMPAIGN_STATUS'][_0xf5db('0x70')];return _0x2ec06d(msgResponse(_0xf5db('0x89'),'Failure',_0x5569f3+_0xf5db('0x8a')));}if(_[_0xf5db('0x43')](_0x5f12dc)){_0x152e76[_0xf5db('0x63')]=utils['CAMPAIGN_STATUS'][_0xf5db('0x8b')];return _0x2ec06d(msgResponse('ifTime',_0xf5db('0x8c'),_0x5569f3+_0xf5db('0x8d')));}if(_0x1e5c7d&&_[_0xf5db('0x4e')](config['timezones'][_0x1e5c7d])){_0x152e76[_0xf5db('0x63')]=utils['CAMPAIGN_STATUS'][_0xf5db('0x8e')];return _0x2ec06d(msgResponse(_0xf5db('0x89'),_0xf5db('0x8c'),_0x5569f3+'\x20Timezone\x20unknow\x20'+_0x1e5c7d));}if(_[_0xf5db('0x8f')](_0x5f12dc)){for(var _0x3a31cd=0x0;_0x3a31cd<_0x5f12dc[_0xf5db('0x90')];_0x3a31cd+=0x1){_0x166f6d[_0xf5db('0x91')](ami[_0xf5db('0x92')]({'action':_0xf5db('0x93'),'command':util['format'](_0xf5db('0x94'),_0x5f12dc[_0x3a31cd][_0xf5db('0x95')],!_[_0xf5db('0x4e')](config[_0xf5db('0x96')][_0x1e5c7d])?_0x1e5c7d:'')})[_0xf5db('0x3a')](function(_0x15e340){return _0x15e340[_0xf5db('0x97')][_0xf5db('0x98')](_0xf5db('0x99'))>=0x0;})[_0xf5db('0x9a')](myreject(_0x2ec06d)));}}else{_0x166f6d['push'](ami[_0xf5db('0x92')]({'action':_0xf5db('0x93'),'command':util[_0xf5db('0x3f')](_0xf5db('0x94'),_0x5f12dc,!_[_0xf5db('0x4e')](config[_0xf5db('0x96')][_0x1e5c7d])?_0x1e5c7d:'')})[_0xf5db('0x3a')](function(_0x54503d){return _0x54503d[_0xf5db('0x97')][_0xf5db('0x98')]('true')>=0x0;})[_0xf5db('0x9a')](myreject(_0x2ec06d)));}Promise['all'](_0x166f6d)[_0xf5db('0x3a')](function(_0x243b5a){var _0x41d3b6=_[_0xf5db('0x9b')](_0x243b5a);if(_0x41d3b6){return _0xe8e672(_0x41d3b6);}else{_0x152e76['message']=_0x293464?utils[_0xf5db('0x66')][_0xf5db('0x9c')]:utils[_0xf5db('0x66')][_0xf5db('0x9d')];return _0x2ec06d(msgResponse(_0xf5db('0x9e'),_0xf5db('0x8c'),_0xf5db('0x9f')+_0x293464+'\x20'+_0x5569f3+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf5db('0x61')](_0x5f12dc,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1e5c7d));}})['catch'](function(_0x372938){return _0x2ec06d(msgResponse(_0xf5db('0x89'),_0xf5db('0x8c'),JSON[_0xf5db('0x6e')](_0x372938)));});});};Dialer[_0xf5db('0x17')][_0xf5db('0xa0')]=function(){var _0x2ee846=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xf5db('0x3a')](function(){setInterval(function(){_0x2ee846[_0xf5db('0xa1')]();},0x3e8);});};Dialer[_0xf5db('0x17')][_0xf5db('0xa1')]=function(){var _0x350099=this;var _0x1c07b2;for(var _0x3290d1 in this[_0xf5db('0x1e')]){if(typeof this[_0xf5db('0x1e')][_0x3290d1]!==_0xf5db('0xa2')){_0x1c07b2=this['campaigns'][_0x3290d1];if(utils[_0xf5db('0x75')](_0x1c07b2)&&utils[_0xf5db('0x73')](_0x1c07b2)){_0x1c07b2[_0xf5db('0x79')]=!![];Promise[_0xf5db('0xa3')]()[_0xf5db('0x3a')](checkIsIVRCampaignActive(_0x1c07b2))[_0xf5db('0x3a')](checkInterval(_0x1c07b2))[_0xf5db('0x3a')](_0x350099['checkIsTrunkReachable'](_0x1c07b2))[_0xf5db('0x3a')](_0x350099[_0xf5db('0x87')](_0x1c07b2[_0xf5db('0xa4')],_0x1c07b2[_0xf5db('0xa5')],_0x1c07b2[_0xf5db('0x41')],_0x1c07b2))[_0xf5db('0x3a')](_0x350099[_0xf5db('0xa6')](_0x1c07b2['Interval'],_0x1c07b2[_0xf5db('0xa5')],_0x1c07b2['name'],_0x1c07b2))['then'](_0x350099[_0xf5db('0xa7')](_0x1c07b2))[_0xf5db('0x9a')](loggerCatchQueueSummary(_0xf5db('0xa8'),_0x1c07b2));}else{notSendMessagesCampaign(_0x1c07b2);}}}};Dialer['prototype'][_0xf5db('0xa9')]=function(_0x4651ae){if(_0x4651ae[_0xf5db('0xaa')]!=='predictive'){clearPredictiveAttributes(_0x4651ae);}switch(_0x4651ae['dialMethod']){case _0xf5db('0xab'):this[_0xf5db('0xac')](_0x4651ae,0x1);break;case _0xf5db('0xad'):this[_0xf5db('0xac')](_0x4651ae,_0x4651ae[_0xf5db('0xae')]);break;case _0xf5db('0x6'):this['predictive'](_0x4651ae);break;case _0xf5db('0x5'):this[_0xf5db('0xac')](_0x4651ae,0x1);break;default:logger[_0xf5db('0x5f')](_0xf5db('0xaf'),_0x4651ae[_0xf5db('0x41')],_0xf5db('0xb0'));}};Dialer[_0xf5db('0x17')][_0xf5db('0x89')]=function(_0x2944bd,_0x1177c3){var _0x475965=_0x2944bd[_0xf5db('0xa5')];var _0x3598bc=_0x1177c3?_0x2944bd[_0xf5db('0xa4')]:_0x2944bd[_0xf5db('0x6f')][_0xf5db('0x72')];logger['silly'](_0xf5db('0xb1'),_0x3598bc,_0x475965,_0x2944bd[_0xf5db('0x41')],util[_0xf5db('0x3f')](_0xf5db('0xb2'),_0x2944bd[_0xf5db('0x41')],_0x2944bd['id']));var _0x4082aa=null;return Interval[_0xf5db('0xb3')](_0x3598bc,_0x475965)[_0xf5db('0x3a')](function(_0x38ead7){if(_0x38ead7===!![]){return _0x38ead7;}else{_0x2944bd[_0xf5db('0x63')]=_0x1177c3?utils[_0xf5db('0x66')][_0xf5db('0x9c')]:utils[_0xf5db('0x66')][_0xf5db('0x9d')];_0x4082aa=msgResponse('[ifTime][promiseAll]',_0xf5db('0x8c'),_0xf5db('0x9f')+_0x1177c3+'\x20'+_0x2944bd['name']+_0xf5db('0xb4')+util[_0xf5db('0x61')](_0x3598bc,{'showHidden':![],'depth':null})+_0xf5db('0xb5')+_0x475965);}if(_0x4082aa!==null){logger[_0xf5db('0xb6')](_0xf5db('0xb7'),_0x4082aa);_0x4082aa[_0xf5db('0xb8')]=_0x1177c3;throw _0x4082aa;}})['catch'](function(_0x5f507a){logger[_0xf5db('0x5f')](_0xf5db('0xb9'),_0x5f507a);throw msgResponse(_0xf5db('0x7c'),_0xf5db('0x7d'),util[_0xf5db('0x61')](_0x5f507a,{'showHidden':![],'depth':null}));});};Dialer[_0xf5db('0x17')][_0xf5db('0x2a')]=function(_0x334a04){if(this[_0xf5db('0x1d')][_0x334a04[_0xf5db('0xba')]]){if(this[_0xf5db('0x24')][_0x334a04[_0xf5db('0xbb')]]&&this['uniqueId'][_0x334a04[_0xf5db('0xbb')]][_0xf5db('0x3d')]!==_0xf5db('0xbc')){this[_0xf5db('0xbd')](this[_0xf5db('0x1d')][_0x334a04[_0xf5db('0xba')]]);this[_0xf5db('0x24')][_0x334a04[_0xf5db('0xbb')]][_0xf5db('0xbe')]=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x537e28){var _0x53a592=this[_0xf5db('0x24')][_0x537e28[_0xf5db('0xbb')]];if(this[_0xf5db('0x1d')][_0x537e28[_0xf5db('0xba')]]){if(_0x53a592&&_0x53a592[_0xf5db('0x3d')]!=='ivr'){delete this[_0xf5db('0x24')][_0x537e28[_0xf5db('0xbb')]];this[_0xf5db('0x1d')][_0x537e28[_0xf5db('0xba')]][_0xf5db('0xc0')]+=0x1;var _0x324310=new AgentComplete(_0x53a592,_0x537e28);if(_0x537e28[_0xf5db('0xc1')]===_0xf5db('0xc2')){_0x324310[_0xf5db('0xc3')]=this[_0xf5db('0x1d')][_0x537e28[_0xf5db('0xba')]][_0xf5db('0xc4')]&&this['voiceQueues'][_0x537e28[_0xf5db('0xba')]][_0xf5db('0xc5')]?moment()[_0xf5db('0x3f')](_0xf5db('0xbf')):undefined;}hopperUtils[_0xf5db('0xc6')](_0x324310)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xf5db('0xc7')](_0x324310)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0xc8')));}}};Dialer[_0xf5db('0x17')][_0xf5db('0x2d')]=function(_0xe0643b){var _0xa83270=this[_0xf5db('0x24')][_0xe0643b[_0xf5db('0xbb')]];var _0x522102=this;var _0xe83806=![];var _0x439bda;var _0x1274d2;if(this['voiceQueues'][_0xe0643b[_0xf5db('0xba')]]){if(_0xa83270&&_0xa83270[_0xf5db('0x3d')]!==_0xf5db('0xbc')){delete this[_0xf5db('0x24')][_0xe0643b[_0xf5db('0xbb')]];this['updateOriginated'](this['voiceQueues'][_0xe0643b[_0xf5db('0xba')]]);_0xa83270[_0xf5db('0xc9')]=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));var _0x597630=new QueueCallerAbandon(_0xa83270,_0xe0643b);if(utils[_0xf5db('0xca')](_0xa83270[_0xf5db('0xc9')],_0xa83270['responsetime'])>=_0xa83270[_0xf5db('0xcb')]){this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0x49')]+=0x1;this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xcc')]+=0x1;this['voiceQueues'][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xcd')]+=0x1;_0x597630[_0xf5db('0x68')]=0xa;_0x597630[_0xf5db('0x69')]='Drop';_0x597630[_0xf5db('0xce')]='TIMEOUT';_0x597630[_0xf5db('0xc3')]=this['voiceQueues'][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xc4')]?moment()[_0xf5db('0x3f')](_0xf5db('0xbf')):undefined;_0x597630[_0xf5db('0xcf')]+=0x1;_0x597630[_0xf5db('0xd0')]+=0x1;_0x439bda=this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]]['dialDropRetryFrequency'];_0x1274d2=this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xd1')];hopperUtils[_0xf5db('0xd2')](_0x597630,_0x597630['state'],_0xa83270[_0xf5db('0xd3')])['then'](function(_0x22feff){_0xe83806=_0x22feff[_0xf5db('0xd4')]==0x1;if(_0x597630[_0xf5db('0xcf')]>=_0x522102[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xd5')]){_0x522102[_0xf5db('0xd6')](_0x597630,_0x22feff[_0xf5db('0xd4')]);}else{hopperUtils[_0xf5db('0xd7')]({'active':![],'countdropretry':_0x597630[_0xf5db('0xcf')],'scheduledat':moment()[_0xf5db('0xd8')](_0x522102[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xd9')],_0xf5db('0xda'))[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0xa83270[_0xf5db('0xdb')],'ListId':_0xa83270[_0xf5db('0xdc')],'VoiceQueueId':_0xa83270[_0xf5db('0xdd')]||undefined,'CampaignId':_0xa83270[_0xf5db('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x2b2283=new History(_0x597630);_0x2b2283[_0xf5db('0x68')]=0xa;_0x2b2283['statedesc']='Drop';_0x2b2283['starttime']=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));_0x2b2283['endtime']=_0x2b2283[_0xf5db('0x6b')];_0x2b2283[_0xf5db('0xdf')]=_0x597630[_0xf5db('0xdf')];_0x2b2283['calleridnum']=_0x597630[_0xf5db('0xe0')];hopperUtils[_0xf5db('0xc6')](_0x2b2283)[_0xf5db('0x9a')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xf5db('0x3a')](function(){if(_0xe83806)hopperUtils[_0xf5db('0xe1')](_0x597630,_0x439bda,_0x1274d2)[_0xf5db('0x3a')](function(){return 0x1;});});}else{this[_0xf5db('0x1d')][_0xe0643b['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xe2')]+=0x1;_0x597630[_0xf5db('0x68')]=0xb;_0x597630[_0xf5db('0x69')]='Abandoned';_0x597630[_0xf5db('0xce')]=_0xf5db('0xe3');_0x597630[_0xf5db('0xe4')]+=0x1;_0x597630[_0xf5db('0xd0')]+=0x1;_0x439bda=this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xe5')];_0x1274d2=this[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xd1')];hopperUtils[_0xf5db('0xd2')](_0x597630,_0x597630[_0xf5db('0x68')],_0xa83270['voiceQueue'])[_0xf5db('0x3a')](function(_0x247b6e){if(_0x597630[_0xf5db('0xe4')]>=_0x522102[_0xf5db('0x1d')][_0xe0643b[_0xf5db('0xba')]][_0xf5db('0xe6')]){_0x522102['queueCallerAbandonCreateState'](_0x597630,_0x247b6e[_0xf5db('0xd4')]);}else{hopperUtils[_0xf5db('0xd7')]({'active':![],'countabandonedretry':_0x597630[_0xf5db('0xe4')],'scheduledat':moment()[_0xf5db('0xd8')](_0x522102['voiceQueues'][_0xe0643b['queue']][_0xf5db('0xe5')],_0xf5db('0xda'))['format'](_0xf5db('0xbf')),'ContactId':_0xa83270[_0xf5db('0xdb')],'ListId':_0xa83270[_0xf5db('0xdc')],'VoiceQueueId':_0xa83270[_0xf5db('0xdd')]||undefined,'CampaignId':_0xa83270[_0xf5db('0xde')]||undefined})['catch'](loggerCatch(_0xf5db('0xe7')));var _0x3563a7=new History(_0x597630);_0x3563a7['state']=0xb;_0x3563a7[_0xf5db('0x69')]=_0xf5db('0xe8');_0x3563a7['starttime']=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));_0x3563a7[_0xf5db('0x6a')]=_0x3563a7[_0xf5db('0x6b')];_0x3563a7[_0xf5db('0xdf')]=_0x597630['calleridname'];_0x3563a7[_0xf5db('0xe0')]=_0x597630[_0xf5db('0xe0')];hopperUtils['createHistory'](_0x3563a7)['catch'](loggerCatch(_0xf5db('0xe9')));}})[_0xf5db('0x3a')](function(){if(_0xe83806)hopperUtils[_0xf5db('0xe1')](_0x597630,_0x439bda,_0x1274d2)[_0xf5db('0x3a')](function(){return 0x1;});});}}}};Dialer[_0xf5db('0x17')][_0xf5db('0x34')]=function(_0x47a20e){if(this[_0xf5db('0x22')][_0x47a20e[_0xf5db('0xbb')]]){this[_0xf5db('0x22')][_0x47a20e[_0xf5db('0xbb')]]['channel']=_0x47a20e[_0xf5db('0xea')];}if(this[_0xf5db('0x24')][_0x47a20e[_0xf5db('0xbb')]]){this['uniqueId'][_0x47a20e[_0xf5db('0xbb')]][_0xf5db('0xea')]=_0x47a20e[_0xf5db('0xea')];}};Dialer[_0xf5db('0x17')][_0xf5db('0xeb')]=function(_0x117ad6){if(!this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]]){return;}var _0x482110=this[_0xf5db('0x1d')][this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]][_0xf5db('0xba')]][_0xf5db('0xed')]||_0xf5db('0xee');if(_0x482110===_0xf5db('0xef')){if(this['actions'][_0x117ad6['actionid']]&&_[_0xf5db('0xf0')](this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]]['locked'])&&_0x117ad6[_0xf5db('0x80')]==='1'&&_0x117ad6[_0xf5db('0xf1')]==='0'){if(this['agents'][_0x117ad6[_0xf5db('0xf2')]]){if(!this['agents'][_0x117ad6[_0xf5db('0xf2')]][_0xf5db('0xf3')]){this['agents'][_0x117ad6['stateinterface']][_0xf5db('0xf3')]=!![];this[_0xf5db('0x22')][_0x117ad6['actionid']][_0xf5db('0xf3')]=!![];this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]][_0xf5db('0xf2')]=_0x117ad6[_0xf5db('0xf2')];}}}}else if(_0x482110===_0xf5db('0xee')){if(this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]]){if(this[_0xf5db('0x1f')][_0x117ad6['stateinterface']]){this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]][_0xf5db('0xf2')]=_0x117ad6[_0xf5db('0xf2')];if(_[_0xf5db('0xf0')](this['queueBooked'][this[_0xf5db('0x22')][_0x117ad6['actionid']][_0xf5db('0xba')]])){this['queueBooked'][this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]][_0xf5db('0xba')]]=[];}this['queueBooked'][this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]][_0xf5db('0xba')]][_0xf5db('0x91')](_[_0xf5db('0x5a')](_[_0xf5db('0xf4')](this[_0xf5db('0x22')][_0x117ad6[_0xf5db('0xec')]],[_0xf5db('0xf5'),_0xf5db('0xf2')]),{'status':_0x117ad6[_0xf5db('0x80')],'paused':_0x117ad6['paused']}));}}}};Dialer[_0xf5db('0x17')]['syncQueueStatusComplete']=function(_0x4722e1){if(!this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]]){return;}var _0x4ca815=this;var _0x5cc098=this[_0xf5db('0x1d')][this['actions'][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]];var _0x9d9a98=_0x5cc098['strategy']||'rrmemory';if(_0x9d9a98===_0xf5db('0xef')){if(this[_0xf5db('0x22')][_0x4722e1['actionid']]&&this['actions'][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xf2')]){this[_0xf5db('0x1c')]['run'](this[_0xf5db('0x22')][_0x4722e1['actionid']][_0xf5db('0xf5')],this[_0xf5db('0x22')][_0x4722e1['actionid']][_0xf5db('0xf2')])[_0xf5db('0x9a')](function(_0x3a37d0){logger[_0xf5db('0x5f')](_0xf5db('0xf6'),util[_0xf5db('0x61')](_0x3a37d0,{'showHidden':![],'depth':null}));})[_0xf5db('0x1a')](function(){_0x4ca815[_0xf5db('0xbd')](_0x4ca815[_0xf5db('0x1d')][_0x4ca815[_0xf5db('0x22')][_0x4722e1['actionid']][_0xf5db('0xba')]]);_0x4ca815['agents'][_0x4ca815[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xf2')]][_0xf5db('0xf3')]=![];delete _0x4ca815[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]];unlockQueueStatus(_0x5cc098);});}else{this[_0xf5db('0xbd')](this[_0xf5db('0x1d')][this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xdb')],'ListId':this['actions'][_0x4722e1[_0xf5db('0xec')]]['ListId'],'VoiceQueueId':this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0xf7')));delete this[_0xf5db('0x22')][_0x4722e1['actionid']];unlockQueueStatus(_0x5cc098);}}else if(_0x9d9a98==='rrmemory'){var _0x5b2192;if(this[_0xf5db('0x22')][_0x4722e1['actionid']]&&!_[_0xf5db('0x43')](this[_0xf5db('0x28')][this['actions'][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]])){if(this[_0xf5db('0xf8')][_0x4ca815[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]]['queue']]){this[_0xf5db('0xf8')][_0x4ca815[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]]=this['queueBookedRR'][this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]]?this[_0xf5db('0xf8')][this['actions'][_0x4722e1[_0xf5db('0xec')]]['queue']]:this[_0xf5db('0x28')][this['actions'][_0x4722e1[_0xf5db('0xec')]]['queue']]?this[_0xf5db('0x28')][this['actions'][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]][_0xf5db('0xf9')]||0x0:0x0;}this[_0xf5db('0x28')][this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]][_0xf5db('0xf9')]=this['queueBookedRR'][this[_0xf5db('0x22')][_0x4722e1[_0xf5db('0xec')]][_0xf5db('0xba')]];for(var _0x3fd854=0x0;_0x3fd854=_0x5891f8[_0xf5db('0x120')]){_0x509bfe[_0xf5db('0x121')](_0x49d8aa,_0x3f34a8,_0x399c4,_0xf5db('0x122'));}else{if(_0x49d8aa['countmachineretry']>=_0x5891f8[_0xf5db('0x123')]){_0x509bfe['createStateFinal'](_0x49d8aa,_0x3f34a8,_0x399c4,'reason\x2019\x20machine....');}else{hopperUtils[_0xf5db('0xd7')]({'active':![],'countmachineretry':_0x49d8aa[_0xf5db('0x11a')],'scheduledat':moment()[_0xf5db('0xd8')](_0x5891f8[_0xf5db('0x124')],'minutes')[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x49d8aa[_0xf5db('0xdb')],'ListId':_0x49d8aa[_0xf5db('0xdc')],'VoiceQueueId':_0x49d8aa[_0xf5db('0xdd')]||undefined,'CampaignId':_0x49d8aa[_0xf5db('0xde')]||undefined})['catch'](loggerCatch(_0xf5db('0x125')));_0x3f34a8({'reschedule':0x1});}}});}if(_0x39888c[_0xf5db('0x3d')]===_0xf5db('0xbc')&&this[_0xf5db('0x1e')][_0x39888c[_0xf5db('0xba')]][_0xf5db('0x10c')]&&_0xedb160[_0xf5db('0x10d')]==='HANGUP'){delete this['uniqueId'][_0xedb160[_0xf5db('0xbb')]];this[_0xf5db('0xbd')](this[_0xf5db('0x1e')][_0x39888c[_0xf5db('0xba')]]);_0x5cf03c=new Hangup(_0x39888c,_0xedb160);_0x5cf03c[_0xf5db('0x68')]=0x12;_0x5cf03c[_0xf5db('0x69')]=_0xf5db('0x110');_0x5cf03c[_0xf5db('0x111')]=_0xf5db('0x112');ami[_0xf5db('0x3c')](_0xf5db('0x113'),ut[_0xf5db('0x114')](_0x5cf03c,_0xf5db('0x115')));this['saveInDb'](_0x5cf03c,_0xf5db('0x126'),'[syncHangupInAMDIvr]');}if(_0x39888c['type']==='ivr'&&this[_0xf5db('0x1e')][_0x39888c[_0xf5db('0xba')]]['dialAMDActive']&&_0xedb160[_0xf5db('0x10d')]===_0xf5db('0x119')){return new Promise(function(_0x788eff,_0x19aa7c){delete _0x509bfe[_0xf5db('0x24')][_0xedb160[_0xf5db('0xbb')]];_0x509bfe[_0xf5db('0xbd')](_0x509bfe[_0xf5db('0x1e')][_0x39888c[_0xf5db('0xba')]]);_0x509bfe[_0xf5db('0x1e')][_0x39888c[_0xf5db('0xba')]][_0xf5db('0xc0')]+=0x1;_0x509bfe['campaigns'][_0x39888c[_0xf5db('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x403d7c=_0x509bfe['campaigns'][_0x39888c['queue']];var _0x69d71f=new Hangup(_0x39888c,_0xedb160);_0x69d71f['state']=0x13;_0x69d71f[_0xf5db('0x69')]=_0xf5db('0x127');_0x69d71f[_0xf5db('0x111')]=_0xf5db('0x112');_0x69d71f[_0xf5db('0x11a')]+=0x1;_0x69d71f[_0xf5db('0xd0')]+=0x1;_0x69d71f['amd']=!![];ami['emit'](_0xf5db('0x113'),ut['buildObj'](_0x69d71f,_0xf5db('0x115')));hopperUtils[_0xf5db('0xc6')](_0x69d71f)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x128')));if(_0x69d71f['countbusyretry']+_0x69d71f[_0xf5db('0x11c')]+_0x69d71f[_0xf5db('0x11d')]+_0x69d71f[_0xf5db('0x11e')]+_0x69d71f[_0xf5db('0xcf')]+_0x69d71f[_0xf5db('0xe4')]+_0x69d71f[_0xf5db('0x11a')]+_0x69d71f[_0xf5db('0x11f')]>=_0x403d7c['dialGlobalMaxRetry']){_0x509bfe[_0xf5db('0x121')](_0x69d71f,_0x788eff,_0x19aa7c,_0xf5db('0x122'));}else{if(_0x69d71f[_0xf5db('0x11a')]>=_0x403d7c[_0xf5db('0x123')]){_0x509bfe[_0xf5db('0x129')](_0x69d71f,_0x788eff,_0x19aa7c,_0xf5db('0x12a'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x69d71f[_0xf5db('0x11a')],'scheduledat':moment()[_0xf5db('0xd8')](_0x403d7c[_0xf5db('0x124')],_0xf5db('0xda'))[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x69d71f[_0xf5db('0xdb')],'ListId':_0x69d71f[_0xf5db('0xdc')],'VoiceQueueId':_0x69d71f[_0xf5db('0xdd')]||undefined,'CampaignId':_0x69d71f['CampaignId']||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x125')));_0x788eff({'reschedule':0x1});}}});}}};Dialer[_0xf5db('0x17')][_0xf5db('0x32')]=function(_0xac9009){var _0x524953=this[_0xf5db('0x24')][_0xac9009[_0xf5db('0xbb')]];var _0x4c55d6;if(_0x524953&&_0x524953['type']===_0xf5db('0xbc')){delete this[_0xf5db('0x24')][_0xac9009['uniqueid']];this[_0xf5db('0xbd')](this[_0xf5db('0x1e')][_0x524953[_0xf5db('0xba')]]);this[_0xf5db('0x1e')][_0x524953[_0xf5db('0xba')]][_0xf5db('0x12b')]+=0x1;_0x4c55d6=new Hangup(_0x524953,_0xac9009);hopperUtils['createHistory'](_0x4c55d6)['catch'](loggerCatch(_0xf5db('0x12c')));hopperUtils[_0xf5db('0xc7')](_0x4c55d6)[_0xf5db('0x9a')](loggerCatch('[syncHangupIvr]'));}if(_0x524953&&_0x524953[_0xf5db('0x3d')]!==_0xf5db('0xbc')&&isNotNull(this[_0xf5db('0x1d')][_0x524953[_0xf5db('0xba')]][_0xf5db('0x12d')])){delete this[_0xf5db('0x24')][_0xac9009[_0xf5db('0xbb')]];this[_0xf5db('0xbd')](this['voiceQueues'][_0x524953[_0xf5db('0xba')]]);this['voiceQueues'][_0x524953['queue']][_0xf5db('0xc0')]+=0x1;this['voiceQueues'][_0x524953[_0xf5db('0xba')]][_0xf5db('0x10f')]+=0x1;_0x4c55d6=new Hangup(_0x524953,_0xac9009);_0x4c55d6[_0xf5db('0x68')]=0x10;_0x4c55d6[_0xf5db('0x69')]='AnswerAGI';_0x4c55d6[_0xf5db('0x111')]='AGI';hopperUtils['createHistory'](_0x4c55d6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xf5db('0xc7')](_0x4c55d6)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x12e')));}if(_0x524953&&_0x524953[_0xf5db('0x3d')]!==_0xf5db('0xbc')&&!isNotNull(this[_0xf5db('0x1d')][_0x524953['queue']]['dialQueueProject'])){if(_0xac9009['cause-txt']===_0xf5db('0x12f')){delete this[_0xf5db('0x24')][_0xac9009[_0xf5db('0xbb')]];this[_0xf5db('0x1d')][_0x524953[_0xf5db('0xba')]][_0xf5db('0xc0')]+=0x1;const _0x30ca0a=new AgentComplete(_0x524953,_0xac9009);_0x30ca0a[_0xf5db('0xde')]=this[_0xf5db('0x1d')][_0x524953[_0xf5db('0xba')]]['id'];hopperUtils[_0xf5db('0xc6')](_0x30ca0a)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x130')));hopperUtils[_0xf5db('0xc7')](_0x30ca0a)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0xc8')));}else{delete this['uniqueId'][_0xac9009[_0xf5db('0xbb')]];this[_0xf5db('0xbd')](this[_0xf5db('0x1d')][_0x524953[_0xf5db('0xba')]]);this[_0xf5db('0x1d')][_0x524953[_0xf5db('0xba')]][_0xf5db('0x131')]+=0x1;_0x4c55d6=new Hangup(_0x524953,_0xac9009);_0x4c55d6[_0xf5db('0x68')]=0xc;_0x4c55d6[_0xf5db('0x69')]=_0xac9009[_0xf5db('0x132')];_0x4c55d6[_0xf5db('0x111')]='Unknow';hopperUtils[_0xf5db('0xc6')](_0x4c55d6)[_0xf5db('0x9a')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x4c55d6)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x12e')));}}};Dialer['prototype'][_0xf5db('0x8')]=function(_0x3ca33a){var _0x447323=this;if(!_0x447323['queuesSummary'][_0x3ca33a['name']]){_0x447323[_0xf5db('0x133')][_0x3ca33a[_0xf5db('0x41')]]={'running':![]};}else if(_0x447323[_0xf5db('0x133')][_0x3ca33a[_0xf5db('0x41')]][_0xf5db('0x134')]===!![]){return;}else if(_0x447323['queuesSummary'][_0x3ca33a[_0xf5db('0x41')]]['running']===![]){_0x447323[_0xf5db('0x133')][_0x3ca33a['name']][_0xf5db('0x134')]=!![];}var _0x2ba937=_0x447323[_0xf5db('0x1d')][_0x3ca33a[_0xf5db('0x41')]];var _0x23bf1a=_0x2ba937['message']!==utils['CAMPAIGN_STATUS'][_0xf5db('0x135')];var _0x51cc0f=utils['isPreviewCampaign'](_0x2ba937);_0x2ba937[_0xf5db('0x136')]=utils[_0xf5db('0x137')](_0x2ba937,_0x447323[_0xf5db('0x82')]);Promise[_0xf5db('0xa3')]()[_0xf5db('0x3a')](function(){if(_0x2ba937[_0xf5db('0x136')]===utils['CAMPAIGN_STATUS'][_0xf5db('0x135')]){if(_0x23bf1a){clearPredictiveAttributes(_0x2ba937);_0x3ca33a[_0xf5db('0x25')]=undefined;_0x3ca33a[_0xf5db('0x26')]=undefined;}if(_0x2ba937['statusMessage']===utils['CAMPAIGN_STATUS'][_0xf5db('0x135')]){_0x3ca33a[_0xf5db('0x138')]=0x0;_0x3ca33a['paused']=0x0;_0x3ca33a['inUse']=0x0;_0x3ca33a[_0xf5db('0x139')]=0x0;_0x3ca33a[_0xf5db('0x13a')]=0x0;}}else if(_0x2ba937[_0xf5db('0x136')]===utils[_0xf5db('0x66')]['ACTIVE']&&!_0x51cc0f){return _0x447323[_0xf5db('0x89')](_0x2ba937,!![])['then'](function(){return _0x447323[_0xf5db('0x89')](_0x2ba937,![]);})['then'](function(){return _0x447323[_0xf5db('0xa9')](_0x2ba937);})[_0xf5db('0x9a')](function(_0x43c81a){loggerSyncQueueSummary['debug'](_0xf5db('0x13b'),util[_0xf5db('0x61')](_0x43c81a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2ba937);});}else{clearPredictiveAttributes(_0x2ba937);}})[_0xf5db('0x3a')](function(){var _0x2f1cc7=_0x3ca33a['compareToOutboundQueue'](_0x2ba937);if(_0x2f1cc7||_0x2ba937[_0xf5db('0x13c')]){_0x2ba937['queueSummaryCountersUpdated']=![];_0x3ca33a[_0xf5db('0x13d')](_0x2ba937);Object['assign'](_0x2ba937,_0x3ca33a);emitOutboundVoiceQueueSummary(_0x3ca33a);}_0x447323['queuesSummary'][_0x2ba937[_0xf5db('0x41')]]['running']=![];})[_0xf5db('0x9a')](function(_0x5045fc){logger[_0xf5db('0x5f')](_0xf5db('0x13b'),util[_0xf5db('0x61')](_0x5045fc,{'showHidden':![],'depth':null}));_0x447323['queuesSummary'][_0x2ba937[_0xf5db('0x41')]]['running']=![];});};Dialer[_0xf5db('0x17')][_0xf5db('0x31')]=_[_0xf5db('0x13e')](function(){var _0x4758f3=_[_0xf5db('0x13f')](this[_0xf5db('0x1d')],function(_0x45b2d8){return _0x45b2d8[_0xf5db('0x140')];});var _0x11d20c=_[_0xf5db('0x13f')](this[_0xf5db('0x1f')],function(_0x565cc0){return _0x565cc0[_0xf5db('0x141')]&&_0x565cc0['status']===_0xf5db('0x81');});if(_0x4758f3['length']>0x0&&_0x11d20c[_0xf5db('0x90')]>0x0){return Promise['resolve']()['then'](cmHopper[_0xf5db('0x142')](_['map'](_0x4758f3,'id'),previewRecallmeReminderInterval,_[_0xf5db('0x143')](_0x11d20c,'id')))[_0xf5db('0x3a')](function(_0x492de0){for(var _0x5e0967=0x0;_0x5e0967<_0x492de0[_0xf5db('0x90')];_0x5e0967++){var _0x55194c=_0x492de0[_0x5e0967][_0xf5db('0x144')][_0xf5db('0x41')];if(_0x55194c)io['to'](util['format'](_0xf5db('0x145'),_0x55194c))[_0xf5db('0x3c')](_0xf5db('0x146'),{'hopper':_0x492de0[_0x5e0967]});}})['catch'](function(_0x42f51b){logger[_0xf5db('0x5f')](_0xf5db('0x147'),_0x42f51b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xf5db('0x17')]['loopClearZombieChannels']=function(){var _0x1cc5b0=this;setInterval(function(){_0x1cc5b0[_0xf5db('0x148')](_0x1cc5b0[_0xf5db('0x24')],_0xf5db('0x149'));_0x1cc5b0[_0xf5db('0x148')](_0x1cc5b0['actions'],_0xf5db('0x14a'));},0x32c8);};Dialer[_0xf5db('0x17')]['clearZombieChannels']=function(_0x162e39,_0x2fd3f4){var _0x57ab1f=this;for(var _0x12e155 in _0x162e39){if(typeof _0x162e39[_0x12e155]!==_0xf5db('0xa2')){this[_0xf5db('0x1b')][_0xf5db('0x18')](function(){if(!_[_0xf5db('0xf0')](_0x162e39[_0x12e155])){return ami['Action']({'action':'status','channel':_0x162e39[_0x12e155][_0xf5db('0xea')]})[_0xf5db('0x9a')](function(_0x321efd){if(_0x321efd['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x162e39[_0x12e155]&&_0x162e39[_0x12e155]['type']!=='ivr'){_0x57ab1f[_0xf5db('0xbd')](_0x57ab1f[_0xf5db('0x1d')][_0x162e39[_0x12e155][_0xf5db('0xba')]]);logger[_0xf5db('0x5f')](_0xf5db('0x14b'),_0x2fd3f4,_0x12e155,_0x162e39[_0x12e155][_0xf5db('0xba')]);delete _0x162e39[_0x12e155];}if(_0x162e39[_0x12e155]&&_0x162e39[_0x12e155][_0xf5db('0x3d')]===_0xf5db('0xbc')){_0x57ab1f[_0xf5db('0xbd')](_0x57ab1f[_0xf5db('0x1e')][_0x162e39[_0x12e155][_0xf5db('0xba')]]);logger[_0xf5db('0x5f')](_0xf5db('0x14c'),_0x2fd3f4,_0x12e155,_0x162e39[_0x12e155][_0xf5db('0xba')]);delete _0x162e39[_0x12e155];}},0x2328);}});}});}}};Dialer[_0xf5db('0x17')][_0xf5db('0x14d')]=function(_0x661489){return Promise[_0xf5db('0xa3')]()[_0xf5db('0x3a')](voiceQueueRt[_0xf5db('0x14d')](_0x661489))[_0xf5db('0x9a')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['updateOriginated']=function(_0x422fbb){if(!_[_0xf5db('0x4e')](_0x422fbb)&&_0x422fbb!==null){if(typeof _0x422fbb['originated']!==_0xf5db('0xa2')){if(_0x422fbb[_0xf5db('0x78')]>0x0){_0x422fbb['originated']-=0x1;}else{logger[_0xf5db('0x5f')](_0xf5db('0x14e'));}}}else{logger['error'](_0xf5db('0x14f'));}};Dialer['prototype'][_0xf5db('0x150')]=function(_0x295d4b,_0x4b7eb6){var _0x417ee5=this;return function(_0x5048c4){_0x417ee5[_0xf5db('0xbd')](_0x4b7eb6);logger[_0xf5db('0x5f')](_0x295d4b,util[_0xf5db('0x61')](_0x5048c4,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0xe24b71,_0x5d5527,_0x2c04eb){var _0x4df577={'state':0x19,'statedesc':'notFound'};this[_0xf5db('0xbd')](_0x5d5527);this['saveInDb'](_['merge'](_0x4df577,_[_0xf5db('0xf4')](_0x2c04eb,[_0xf5db('0xdb'),_0xf5db('0xdc'),_0xf5db('0x151'),_0xf5db('0xdd'),_0xf5db('0xde')])),'[emptyContact][createHistory]',_0xf5db('0x152'));logger['error'](_0xe24b71);};Dialer['prototype'][_0xf5db('0x116')]=function(_0x2e5d38,_0x33c166,_0x4da04a){hopperUtils[_0xf5db('0xc6')](_0x2e5d38)['catch'](loggerCatch(_0x33c166));hopperUtils[_0xf5db('0xc7')](_0x2e5d38)[_0xf5db('0x9a')](loggerCatch(_0x4da04a));};Dialer[_0xf5db('0x17')][_0xf5db('0xd6')]=function(_0x49f9e2,_0x69f531){hopperUtils[_0xf5db('0xc6')](_0x49f9e2)[_0xf5db('0x9a')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x69f531==0x0){hopperUtils['moveContactManagedDialer'](_0x49f9e2)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x153')));}};Dialer[_0xf5db('0x17')][_0xf5db('0x147')]=function(_0x355e4d){return Promise['resolve']()[_0xf5db('0x3a')](cmHopper[_0xf5db('0x142')](_0x355e4d['id'],previewRecallmeReminderInterval))[_0xf5db('0x3a')](function(_0x7cbd99){for(var _0xa5c0ef=0x0;_0xa5c0ef<_0x7cbd99[_0xf5db('0x90')];_0xa5c0ef++){var _0x17fab6=_0x7cbd99[_0xa5c0ef][_0xf5db('0x144')][_0xf5db('0x41')];if(_0x17fab6)io['to'](util[_0xf5db('0x3f')]('user:%s',_0x17fab6))[_0xf5db('0x3c')](_0xf5db('0x146'),{'hopper':_0x7cbd99[_0xa5c0ef]});}})['catch'](function(){});};Dialer[_0xf5db('0x17')][_0xf5db('0xa7')]=function(_0x501f6a){var _0x5d08ea=this;return function(){_0x5d08ea[_0xf5db('0x154')](_0x501f6a);};};Dialer[_0xf5db('0x17')]['actionOriginate']=function(_0x43ac0a,_0x5759c2){var _0x2328e8=this;var _0x5c834d=uuid['v4']();this[_0xf5db('0x22')][_0x5c834d]=new Action(_0x43ac0a,_0x5759c2,_0x5c834d);return new Promise(function(_0x515d9a,_0x40e6d3){if(_[_0xf5db('0x4e')](_0x43ac0a)&&typeof _0x43ac0a!==_0xf5db('0x155')){return _0x40e6d3(msgResponse('originate',_0xf5db('0x8c'),_0xf5db('0x156')));}if(_['isUndefined'](_0x5759c2[_0xf5db('0x157')])||_0x5759c2['phone']===null){return _0x40e6d3(msgResponse(_0xf5db('0x158'),_0xf5db('0x8c'),'contact\x20is\x20undefine'));}var _0x5c6da7={'XMD-CALLERID':_0x2328e8[_0xf5db('0x22')][_0x5c834d][_0xf5db('0x159')](),'XMD-AGI':_0x43ac0a[_0xf5db('0x12d')]?util[_0xf5db('0x3f')](_0xf5db('0x15a'),ipAgi,_0x43ac0a[_0xf5db('0x12d')]):_0xf5db('0x15b'),'XMD-AGIAFTER':_0x43ac0a[_0xf5db('0xc4')]?util[_0xf5db('0x3f')](_0xf5db('0x15a'),ipAgi,_0x43ac0a[_0xf5db('0xc4')]):'NONE','XMD-QUEUE':utils[_0xf5db('0x15c')](_0x43ac0a)?util[_0xf5db('0x3f')](_0xf5db('0x15d'),_0x43ac0a['name'],_0x43ac0a['dialQueueOptions']||'',_0x43ac0a[_0xf5db('0xc5')]?'c':'',_0x43ac0a[_0xf5db('0xcb')]||0x3):_0xf5db('0x15b'),'XMD-CONTACTID':_0x5759c2[_0xf5db('0xdb')],'XMD-CDRTYPE':_0xf5db('0x15e'),'CALLERID(all)':_0x2328e8[_0xf5db('0x22')][_0x5c834d][_0xf5db('0x159')](),'XMD-AMD':_0x43ac0a[_0xf5db('0x10c')]?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x43ac0a[_0xf5db('0x10c')]){_0x5c6da7['XMD-AMDINITIALSILENCE']=_0x43ac0a[_0xf5db('0x15f')]||0x9c4;_0x5c6da7[_0xf5db('0x160')]=_0x43ac0a[_0xf5db('0x161')]||0x5dc;_0x5c6da7[_0xf5db('0x162')]=_0x43ac0a[_0xf5db('0x163')]||0x320;_0x5c6da7[_0xf5db('0x164')]=_0x43ac0a['dialAMDTotalAnalysisTime']||0x1388;_0x5c6da7['XMD-AMDMINWORDLENGTH']=_0x43ac0a[_0xf5db('0x165')]||0x64;_0x5c6da7['XMD-AMDBETWEENWORDSSILENCE']=_0x43ac0a[_0xf5db('0x166')]||0x32;_0x5c6da7[_0xf5db('0x167')]=_0x43ac0a[_0xf5db('0x168')]||0x3;_0x5c6da7['XMD-AMDSILENCETHRESHOLD']=_0x43ac0a['dialAMDSilenceThreshold']||0x100;_0x5c6da7[_0xf5db('0x169')]=_0x43ac0a[_0xf5db('0x16a')]||0x1388;}if(utils['isOutboundQueue'](_0x43ac0a)){_0x5c6da7[_0xf5db('0x16b')]=_0x5759c2[_0xf5db('0xdd')];}else{_0x5c6da7[_0xf5db('0x16c')]=_0x5759c2[_0xf5db('0xde')];}var _0xb59137=utils['setXMDContactVariables'](_0x5759c2[_0xf5db('0x16d')]);Object['assign'](_0x5c6da7,_0xb59137);var _0x417e9b=_0x2328e8['isTrunkReachable'](_0x43ac0a[_0xf5db('0x84')])?utils[_0xf5db('0x16e')](_0x43ac0a['Trunk'][_0xf5db('0x16f')],_0x43ac0a[_0xf5db('0x170')],_0x43ac0a[_0xf5db('0x171')]>0x0?utils['getCallerIdRandom'](_0x43ac0a['dialOriginateCallerIdNumber'],_0x43ac0a[_0xf5db('0x171')]):_0x43ac0a[_0xf5db('0x172')]):utils['getCallerId'](_[_0xf5db('0xf0')](_0x43ac0a['TrunkBackup'])?_0x43ac0a[_0xf5db('0x84')]['callerid']:_0x43ac0a[_0xf5db('0x85')][_0xf5db('0x16f')],_0x43ac0a[_0xf5db('0x170')],_0x43ac0a['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x43ac0a['dialOriginateCallerIdNumber'],_0x43ac0a[_0xf5db('0x171')]):_0x43ac0a[_0xf5db('0x172')]);if(_0x417e9b){_0x5c6da7[_0xf5db('0x173')]=_0x2328e8['actions'][_0x5c834d][_0xf5db('0x174')]=utils[_0xf5db('0x175')](_0x417e9b);_0x5c6da7[_0xf5db('0x176')]=_0x5759c2[_0xf5db('0x157')];}_0x43ac0a[_0xf5db('0x177')]=_0x5c6da7;return ami[_0xf5db('0x92')]({'actionid':_0x5c834d,'action':_0xf5db('0x158'),'channel':_0x2328e8['isTrunkReachable'](_0x43ac0a[_0xf5db('0x84')])?util['format'](_0xf5db('0x178'),_0x43ac0a[_0xf5db('0x84')][_0xf5db('0x41')],isNotNull(_0x43ac0a[_0xf5db('0x179')])?_0x43ac0a[_0xf5db('0x179')][_0xf5db('0x17a')]()||'':'',_0x43ac0a['dialCutDigit']>0x0?_0x5759c2[_0xf5db('0x157')][_0xf5db('0x17b')](_0x43ac0a['dialCutDigit']):_0x5759c2['phone']):util['format'](_0xf5db('0x178'),_[_0xf5db('0xf0')](_0x43ac0a[_0xf5db('0x85')])?_0x43ac0a[_0xf5db('0x84')]['name']:_0x43ac0a['TrunkBackup'][_0xf5db('0x41')],isNotNull(_0x43ac0a[_0xf5db('0x179')])?_0x43ac0a[_0xf5db('0x179')][_0xf5db('0x17a')]()||'':'',_0x43ac0a[_0xf5db('0x17c')]>0x0?_0x5759c2[_0xf5db('0x157')][_0xf5db('0x17b')](_0x43ac0a[_0xf5db('0x17c')]):_0x5759c2[_0xf5db('0x157')]),'callerid':_0x417e9b,'Exten':_0xf5db('0x10b'),'Context':_0xf5db('0x17d'),'Priority':'1','variable':_0x5c6da7,'timeout':(_0x43ac0a[_0xf5db('0x17e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c834d})[_0xf5db('0x3a')](function(_0x13a4bd){return _0x515d9a(_0x13a4bd);})[_0xf5db('0x9a')](function(_0x1ce195){_0x43ac0a[_0xf5db('0x17f')]+=0x1;var _0x3dec90=new History(_0x2328e8[_0xf5db('0x22')][_0x5c834d]);logger['error'](util[_0xf5db('0x3f')](_0xf5db('0x180'),JSON[_0xf5db('0x6e')](_0x1ce195)));_0x3dec90[_0xf5db('0x68')]=0xe;_0x3dec90[_0xf5db('0x69')]='OriginateError';_0x3dec90['starttime']=moment()['format'](_0xf5db('0xbf'));_0x3dec90[_0xf5db('0x6a')]=_0x3dec90[_0xf5db('0x6b')];hopperUtils[_0xf5db('0xc6')](_0x3dec90)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x181')));_0x2328e8[_0xf5db('0xc7')](_0x3dec90)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x181')))[_0xf5db('0x1a')](function(){delete _0x2328e8[_0xf5db('0x22')][_0x5c834d];return _0x40e6d3(msgResponse(_0xf5db('0x158'),_0xf5db('0x7d'),_0xf5db('0x182')));});});});};Dialer[_0xf5db('0x17')]['checkRetriveMax']=function(_0x2c82e8,_0x5198b5,_0x1d0fce){var _0x5bc610=new History(_0x5198b5);if(_0x5bc610['countbusyretry']+_0x5bc610[_0xf5db('0x11c')]+_0x5bc610[_0xf5db('0x11d')]+_0x5bc610[_0xf5db('0x11e')]+_0x5bc610['countdropretry']+_0x5bc610[_0xf5db('0xe4')]+_0x5bc610[_0xf5db('0x11a')]+_0x5bc610[_0xf5db('0x11f')]>=_0x1d0fce['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2c82e8){case 0x3:if(_0x5bc610[_0xf5db('0x11d')]>=_0x1d0fce['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countnoanswerretry':_0x5bc610[_0xf5db('0x11d')]+=0x1,'scheduledat':moment()[_0xf5db('0xd8')](_0x1d0fce['dialNoAnswerRetryFrequency'],_0xf5db('0xda'))[_0xf5db('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610['VoiceQueueId']||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5bc610[_0xf5db('0x11b')]>=_0x1d0fce[_0xf5db('0x183')]-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countbusyretry':_0x5bc610[_0xf5db('0x11b')]+=0x1,'scheduledat':moment()[_0xf5db('0xd8')](_0x1d0fce[_0xf5db('0x184')],_0xf5db('0xda'))[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610['VoiceQueueId']||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})['catch'](loggerCatch(_0xf5db('0x185')));break;case 0x8:if(_0x5bc610['countcongestionretry']>=_0x1d0fce['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countcongestionretry':_0x5bc610[_0xf5db('0x11c')]+=0x1,'scheduledat':moment()[_0xf5db('0xd8')](_0x1d0fce[_0xf5db('0x186')],_0xf5db('0xda'))[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x5bc610['ContactId'],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610[_0xf5db('0xdd')]||undefined,'CampaignId':_0x5bc610['CampaignId']||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x187')));break;case 0x0:if(_0x5bc610[_0xf5db('0x11e')]>=_0x1d0fce[_0xf5db('0x188')]-0x1){return!![];}else{hopperUtils[_0xf5db('0xd7')]({'active':![],'countnosuchnumberretry':_0x5bc610[_0xf5db('0x11e')]+=0x1,'scheduledat':moment()[_0xf5db('0xd8')](_0x1d0fce[_0xf5db('0x189')],'minutes')[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610['VoiceQueueId']||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x18a')));}break;case 0xa:if(_0x5bc610[_0xf5db('0xcf')]>=_0x1d0fce[_0xf5db('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5bc610[_0xf5db('0xcf')]+=0x1,'scheduledat':moment()['add'](_0x1d0fce[_0xf5db('0xd9')],_0xf5db('0xda'))['format'](_0xf5db('0xbf')),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610[_0xf5db('0xdd')]||undefined,'CampaignId':_0x5bc610['CampaignId']||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x18b')));break;case 0xb:if(_0x5bc610[_0xf5db('0xe4')]>=_0x1d0fce[_0xf5db('0xe6')]-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countabandonedretry':_0x5bc610[_0xf5db('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x1d0fce[_0xf5db('0xe5')],'minutes')[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x5bc610['ContactId'],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610[_0xf5db('0xdd')]||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5bc610[_0xf5db('0x11a')]>=_0x1d0fce[_0xf5db('0x123')]-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countmachineretry':_0x5bc610[_0xf5db('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x1d0fce[_0xf5db('0x124')],_0xf5db('0xda'))[_0xf5db('0x3f')](_0xf5db('0xbf')),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610[_0xf5db('0xdd')]||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x5bc610[_0xf5db('0x11f')]>=_0x1d0fce['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xf5db('0xd7')]({'active':![],'countagentrejectretry':_0x5bc610[_0xf5db('0x11f')]+=0x1,'scheduledat':moment()[_0xf5db('0xd8')](_0x1d0fce[_0xf5db('0x18c')],_0xf5db('0xda'))['format'](_0xf5db('0xbf')),'ContactId':_0x5bc610[_0xf5db('0xdb')],'ListId':_0x5bc610[_0xf5db('0xdc')],'VoiceQueueId':_0x5bc610['VoiceQueueId']||undefined,'CampaignId':_0x5bc610[_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x18d')));break;default:return!![];}};Dialer[_0xf5db('0x17')][_0xf5db('0x18e')]=function(_0x3eae4c,_0xe0dadd,_0x2d8bd5){var _0x3d9213=this;var _0x3fb76d=new History(_0x3eae4c);var _0x389e78=![];var _0x101e27;var _0x414fbc;return new Promise(function(_0x3ff9aa,_0x215223){if(_[_0xf5db('0x4e')](_0xe0dadd)&&typeof _0xe0dadd!==_0xf5db('0x155')){return _0x215223(msgResponse('[callProgressDetecting]','Failure',_0xf5db('0x18f')));}if(_[_0xf5db('0x4e')](_0x2d8bd5)&&typeof _0x2d8bd5!=='object'){return _0x215223(msgResponse(_0xf5db('0x190'),_0xf5db('0x8c'),_0xf5db('0x191')));}hopperUtils[_0xf5db('0xd2')](_0x3fb76d,_0x2d8bd5[_0xf5db('0xc1')],_0xe0dadd)[_0xf5db('0x3a')](function(_0x3ccda2){if(_0x3ccda2[_0xf5db('0xd4')]==0x1)_0x389e78=!![];switch(_0x2d8bd5[_0xf5db('0xc1')]){case'0':_0xe0dadd[_0xf5db('0x192')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0x0;_0x3fb76d[_0xf5db('0x69')]=_0xf5db('0x193');_0x3fb76d['countnosuchnumberretry']+=0x1;_0x3fb76d[_0xf5db('0xd0')]+=0x1;ami['emit'](_0xf5db('0x194'),ut[_0xf5db('0x114')](_0x3eae4c,_0xf5db('0x195')));_0x101e27=_0xe0dadd['dialNoSuchNumberRetryFrequency'];_0x414fbc=_0xe0dadd['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x128')));if(_0x3d9213[_0xf5db('0x196')](0x0,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0x11e')]>=_0xe0dadd[_0xf5db('0x188')]){_0x3d9213['createStateFinal'](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x197'));}else{_0x3d9213[_0xf5db('0x121')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x197'));}}break;case'3':_0xe0dadd[_0xf5db('0x198')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0x3;_0x3fb76d[_0xf5db('0x69')]='NoAnswer';_0x3fb76d['countnoanswerretry']+=0x1;_0x3fb76d[_0xf5db('0xd0')]+=0x1;var _0x36c2cb=ut[_0xf5db('0x199')](_0x3eae4c,_0xe0dadd);ami[_0xf5db('0x3c')](_0xf5db('0x19a'),_0x36c2cb);_0x101e27=_0xe0dadd[_0xf5db('0x19b')];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];hopperUtils[_0xf5db('0xc6')](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x19c')));if(_0x3d9213[_0xf5db('0x196')](0x3,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0x11d')]>=_0xe0dadd['dialNoAnswerMaxRetry']){_0x3d9213[_0xf5db('0x129')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x19d'));}else{_0x3d9213[_0xf5db('0x121')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x19d'));}}break;case'5':_0xe0dadd[_0xf5db('0x19e')]+=0x1;_0x3fb76d['state']=0x5;_0x3fb76d[_0xf5db('0x69')]=_0xf5db('0x19f');_0x3fb76d[_0xf5db('0x11b')]+=0x1;_0x3fb76d[_0xf5db('0xd0')]+=0x1;ami[_0xf5db('0x3c')](_0xf5db('0x1a0'),ut['buildObj'](_0x3eae4c,_0xf5db('0x1a1')));_0x101e27=_0xe0dadd[_0xf5db('0x184')];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];hopperUtils[_0xf5db('0xc6')](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1a2')));if(_0x3d9213['checkRetriveMax'](0x5,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0x11b')]>=_0xe0dadd['dialBusyMaxRetry']){_0x3d9213['createStateFinal'](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1a3'));}else{_0x3d9213['stateGlobal'](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1a3'));}}break;case'8':_0xe0dadd[_0xf5db('0x1a4')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0x8;_0x3fb76d[_0xf5db('0x69')]=_0xf5db('0x1a5');_0x3fb76d[_0xf5db('0x11c')]+=0x1;_0x3fb76d[_0xf5db('0xd0')]+=0x1;_0x101e27=_0xe0dadd[_0xf5db('0x186')];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];ami[_0xf5db('0x3c')]('custom:agentcongestion',ut[_0xf5db('0x114')](_0x3eae4c,_0xf5db('0x1a6')));hopperUtils[_0xf5db('0xc6')](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1a7')));if(_0x3d9213[_0xf5db('0x196')](0x8,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d['countcongestionretry']>=_0xe0dadd[_0xf5db('0x1a8')]){_0x3d9213['createStateFinal'](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1a9'));}else{_0x3d9213[_0xf5db('0x121')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1a9'));}}break;case'11':_0xe0dadd[_0xf5db('0x1aa')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0xb;_0x3fb76d[_0xf5db('0x69')]='Abandoned';_0x3fb76d['countabandonedretry']+=0x1;_0x3fb76d[_0xf5db('0xd0')]+=0x1;_0x101e27=_0xe0dadd[_0xf5db('0xe5')];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];hopperUtils['createHistory'](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0xe9')));if(_0x3d9213[_0xf5db('0x196')](0xb,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0xe4')]>=_0xe0dadd[_0xf5db('0xe6')]){_0x3d9213[_0xf5db('0x129')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1ab'));}else{_0x3d9213[_0xf5db('0x121')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1ab'));}}break;case'20':_0xe0dadd[_0xf5db('0x1ac')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0x14;_0x3fb76d[_0xf5db('0x69')]=_0xf5db('0x1ad');_0x3fb76d[_0xf5db('0x11f')]+=0x1;_0x3fb76d['countglobal']+=0x1;_0x101e27=_0xe0dadd['dialAgentRejectRetryFrequency'];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];ami['emit'](_0xf5db('0x1ae'),ut[_0xf5db('0x114')](_0x3eae4c,_0xf5db('0x1af')));hopperUtils[_0xf5db('0xc6')](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1b0')));if(_0x3d9213[_0xf5db('0x196')](0x14,_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0x11f')]>=_0xe0dadd[_0xf5db('0x1b1')]){_0x3d9213[_0xf5db('0x129')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1b2'));}else{_0x3d9213[_0xf5db('0x121')](_0x3fb76d,_0x3ff9aa,_0x215223,_0xf5db('0x1b2'));}}break;default:_0xe0dadd[_0xf5db('0x131')]+=0x1;_0x3fb76d[_0xf5db('0x68')]=0xc;_0x3fb76d[_0xf5db('0x69')]=_0x2d8bd5['reason'];_0x101e27=_0xe0dadd[_0xf5db('0x18c')];_0x414fbc=_0xe0dadd[_0xf5db('0xd1')];hopperUtils['createHistory'](_0x3fb76d)[_0xf5db('0x9a')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3d9213[_0xf5db('0x196')](_0x2d8bd5['reason'],_0x3eae4c,_0xe0dadd)&&!_0x389e78){if(_0x3fb76d[_0xf5db('0x11b')]+_0x3fb76d[_0xf5db('0x11c')]+_0x3fb76d[_0xf5db('0x11d')]+_0x3fb76d['countnosuchnumberretry']+_0x3fb76d[_0xf5db('0xcf')]+_0x3fb76d[_0xf5db('0xe4')]+_0x3fb76d[_0xf5db('0x11a')]+_0x3fb76d[_0xf5db('0x11f')]>=_0xe0dadd[_0xf5db('0x120')]){_0x3d9213['stateGlobal'](_0x3fb76d,_0x3ff9aa,_0x215223,_0x2d8bd5[_0xf5db('0xc1')]);}else{_0x3d9213[_0xf5db('0x129')](_0x3fb76d,_0x3ff9aa,_0x215223,_0x2d8bd5[_0xf5db('0xc1')]);}}}})['then'](function(){if(_0x389e78){hopperUtils[_0xf5db('0xe1')](_0x3fb76d,_0x101e27,_0x414fbc)[_0xf5db('0x3a')](function(){return _0x3ff9aa(0x1);});}});});};Dialer[_0xf5db('0x17')][_0xf5db('0x121')]=function(_0x537bab,_0x3c4316,_0x148cfd,_0x21930d){var _0x24d3b7=new Final(_0x537bab);_0x24d3b7[_0xf5db('0x68')]=0xf;_0x24d3b7[_0xf5db('0x69')]='Global';this[_0xf5db('0x129')](_0x24d3b7,_0x3c4316,_0x148cfd,_0x21930d);};Dialer[_0xf5db('0x17')][_0xf5db('0x129')]=function(_0x289b95,_0xae357e,_0x5bd008,_0x58314f){hopperUtils[_0xf5db('0xc7')](_0x289b95)['then'](function(){return _0xae357e(msgResponse(_0xf5db('0x190'),_0xf5db('0x106'),_0x58314f));})['catch'](function(){return _0x5bd008(msgResponse('[moveContactManagedDialer][0]',_0xf5db('0x8c'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xf5db('0x6')]=function(_0x588d5c){var _0x1307e6=_0x588d5c[_0xf5db('0x1b3')]/0x64;var _0x855a12=_0x588d5c['outboundDropCallsDayTimeout']/(_0x588d5c[_0xf5db('0xcc')]+_0x588d5c[_0xf5db('0xc0')]);var _0x5e1efe=Math['round'](_0x588d5c[_0xf5db('0x1b4')]*(_0x588d5c[_0xf5db('0x1b5')]/0x64));var _0x374b01=Math[_0xf5db('0x1b6')](_0x588d5c['predictiveIntervalAvailable']*(_0x588d5c[_0xf5db('0x1b7')]/0x64));var _0xe64bb9=_0x588d5c[_0xf5db('0x138')]+_0x588d5c[_0xf5db('0x139')];var _0x513602=Math[_0xf5db('0x1b8')](_0x588d5c[_0xf5db('0x1b9')]*_0x588d5c['erlangAbandonmentRate']*_0x588d5c[_0xf5db('0x1ba')]*_0x588d5c[_0xf5db('0x1bb')]);if(_['isUndefined'](_0x588d5c[_0xf5db('0x26')])){if(!_[_0xf5db('0x4e')](_0x588d5c[_0xf5db('0x25')])){_0x588d5c[_0xf5db('0x25')]=undefined;loggerPredictive[_0xf5db('0x5f')](_0xf5db('0x1bc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xf5db('0x4e')](_0x588d5c[_0xf5db('0x5d')])){loggerPredictive[_0xf5db('0x5f')](_0xf5db('0x1bc'),_0xf5db('0x1bd'));clearInterval(_0x588d5c[_0xf5db('0x5d')]);_0x588d5c[_0xf5db('0x5d')]=undefined;}_0x588d5c[_0xf5db('0x26')]=moment()[_0xf5db('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf5db('0x44')](_0x588d5c[_0xf5db('0x41')],_0xf5db('0x1be'),_0x588d5c[_0xf5db('0x26')]);this['handlePower'](_0x588d5c,0x1);}else if(ifInterval(_0x588d5c[_0xf5db('0x1bf')],_0x588d5c[_0xf5db('0x26')])){this[_0xf5db('0xac')](_0x588d5c,0x1);loggerPredictiveCalls[_0xf5db('0x44')](_0xf5db('0x1c0'),_0x588d5c[_0xf5db('0x26')],_0x588d5c[_0xf5db('0x41')]);_0x588d5c[_0xf5db('0x1b9')]=0x0;_0x588d5c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1307e6<_0x855a12&&_0x588d5c[_0xf5db('0x1c1')]===_0xf5db('0x1c2')){clearPredictiveAttributes(_0x588d5c);loggerPredictive['info'](_0xf5db('0x1c3'),_0xf5db('0x1c4'),_0x855a12,_0xf5db('0x26'),_0x588d5c[_0xf5db('0x41')]);}else if(_0x513602<_0x588d5c[_0xf5db('0xcd')]&&_0x588d5c[_0xf5db('0x1c1')]===_0xf5db('0x1c2')){clearPredictiveAttributes(_0x588d5c);loggerPredictive['info'](_0xf5db('0x1c5'),_0xf5db('0x1c6'),_0x513602,'Drop\x20in\x20this\x20interval',_0x588d5c[_0xf5db('0xcd')],'startProgressive',_0x588d5c[_0xf5db('0x41')]);}else if(!ifInterval(_0x588d5c['dialPredictiveInterval'],_0x588d5c['startProgressive'])&&_[_0xf5db('0x4e')](_0x588d5c[_0xf5db('0x25')])&&!_['isUndefined'](_0x588d5c[_0xf5db('0x26')])){_0x588d5c['startPredictive']=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));loggerPredictive[_0xf5db('0x44')](_0x588d5c['name'],'started\x20in\x20predictive\x20at',_0x588d5c['startPredictive']);hopperUtils[_0xf5db('0x1c7')](_0x588d5c[_0xf5db('0x1bf')])[_0xf5db('0x3a')](this[_0xf5db('0x1c8')](_0x588d5c))[_0xf5db('0x3a')](mergeDataErlangB(_0x588d5c))[_0xf5db('0x3a')](this['startMethodPredictive'](_0x588d5c))[_0xf5db('0x9a')](loggerCatchPredictive(_0xf5db('0x1c9'),_0x588d5c));}else if(!ifInterval(_0x588d5c[_0xf5db('0x1bf')],_0x588d5c[_0xf5db('0x25')])){_0x588d5c[_0xf5db('0xcd')]=0x0;_0x588d5c[_0xf5db('0x25')]=moment()[_0xf5db('0x3f')](_0xf5db('0xbf'));loggerPredictive[_0xf5db('0x44')](_0x588d5c[_0xf5db('0x41')],_0xf5db('0x1ca'),_0x588d5c[_0xf5db('0x25')]);clearInterval(_0x588d5c['handlePredictive']);_0x588d5c[_0xf5db('0x5d')]=undefined;hopperUtils[_0xf5db('0x1c7')](_0x588d5c[_0xf5db('0x1bf')])[_0xf5db('0x3a')](this[_0xf5db('0x1c8')](_0x588d5c))[_0xf5db('0x3a')](mergeDataErlangB(_0x588d5c))[_0xf5db('0x3a')](this[_0xf5db('0x1cb')](_0x588d5c))['catch'](loggerCatchPredictive(_0xf5db('0x1cc'),_0x588d5c));}else if(_0x588d5c[_0xf5db('0x1b4')]&&_0xe64bb9<_0x588d5c['predictiveIntervalAvailable']-_0x374b01){clearPredictiveAttributes(_0x588d5c);loggerPredictive[_0xf5db('0x44')](_0x588d5c[_0xf5db('0x41')],_0xf5db('0x1cd'),_0xe64bb9,_0xf5db('0x1ce'),_0x588d5c[_0xf5db('0x1b4')],'-',_0x374b01,'=',_0x588d5c[_0xf5db('0x1b4')]-_0x374b01,')');}else if(_0x588d5c['predictiveIntervalAvailable']&&_0xe64bb9>_0x588d5c[_0xf5db('0x1b4')]+_0x5e1efe){clearPredictiveAttributes(_0x588d5c);loggerPredictive[_0xf5db('0x44')](_0x588d5c['name'],_0xf5db('0x1cd'),_0xe64bb9,')\x20are\x20more\x20than\x20threshold\x20(',_0x588d5c[_0xf5db('0x1b4')],'+',_0x5e1efe,'=',_0x588d5c[_0xf5db('0x1b4')]+_0x5e1efe,')');}};Dialer[_0xf5db('0x17')][_0xf5db('0x1c8')]=function(_0x436930){var _0x52d299=this;return function(_0x1befc4){return new Promise(function(_0x3baeef,_0x575221){_['merge'](_0x436930,_0x1befc4[0x0]);if(checkGetDataPredictive(_0x1befc4[0x0])){var _0x1bf3cd=_0x436930['predictiveIntervalAvailable']=_0x436930[_0xf5db('0x139')]+_0x436930[_0xf5db('0x138')];var _0x1d5865=_0x436930[_0xf5db('0x1bf')]*0x3c;var _0x1c7304=_0x1befc4[0x0]['predictiveIntervalAvgTalktime']+_0x1befc4[0x0][_0xf5db('0x50')];var _0x1e0ecf=(_0x1befc4[0x0][_0xf5db('0x47')]+_0x1befc4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1befc4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1befc4[0x0][_0xf5db('0x45')];_0x436930['predictiveIntervalHitRate']=_0x1e0ecf>0x0?_0x1e0ecf:0x1;switch(_0x436930[_0xf5db('0x1c1')]){case _0xf5db('0x1c2'):var _0x52e07b=_0x436930[_0xf5db('0x1b3')]/0x64;return _0x52d299[_0xf5db('0x1cf')](_0x1bf3cd,_0x1d5865,_0x1c7304,_0x1e0ecf,_0x52e07b)['then'](function(_0x52cbaa){return _0x3baeef(_0x52cbaa);});case _0xf5db('0x1d0'):var _0x2b09c6=_0x436930[_0xf5db('0x1b3')]/0x64;return _0x52d299[_0xf5db('0x1d1')](_0x1bf3cd,_0x1d5865,_0x1c7304,_0x1e0ecf,_0x2b09c6)[_0xf5db('0x3a')](function(_0x76ed3b){return _0x3baeef(_0x76ed3b);});default:return _0x575221(msgResponse(_0xf5db('0x1d2'),'Failure',_0xf5db('0x1d3')));}}else{return _0x575221(msgResponse('[getDataPredictive]','Failure',_0xf5db('0x1d4')));}});};};Dialer[_0xf5db('0x17')][_0xf5db('0x1d5')]=function(_0x3d8615){var _0x5d2fc5=this;return function(_0x348745){return new Promise(function(_0x2d6199,_0xfc953a){_[_0xf5db('0x5a')](_0x3d8615,_0x348745[0x0]);if(checkGetDataPredictive(_0x348745[0x0])){loggerPredictive['info'](JSON[_0xf5db('0x6e')](_0x348745[0x0]));if(_0x3d8615[_0xf5db('0x1c1')]===_0xf5db('0x1c2')){return _0x5d2fc5[_0xf5db('0x14d')](_0x3d8615['id'])[_0xf5db('0x3a')](function(_0xaf7b69){var _0x2aabfe=_0x3d8615['loggedIn']-_0xaf7b69[0x0]['outboundQueuePauses'];var _0x240a07=_0x3d8615[_0xf5db('0x1bf')]*0x3c;var _0x1be82c=_0x348745[0x0]['predictiveIntervalAvgTalktime']+_0x348745[0x0]['predictiveIntervalAvgHoldtime'];var _0x4f93a5=(_0x348745[0x0]['predictiveIntervalAnsweredCalls']+_0x348745[0x0][_0xf5db('0x49')]+_0x348745[0x0][_0xf5db('0x4b')])/_0x348745[0x0][_0xf5db('0x45')];var _0x2cbd29=_0x3d8615[_0xf5db('0x1b3')]/0x64;_0x3d8615['predictiveIntervalPauses']=_0xaf7b69[0x0][_0xf5db('0x1d6')]||0x0;_0x3d8615[_0xf5db('0x1ba')]=_0x4f93a5>0x0?_0x4f93a5:0x1;return _0x5d2fc5[_0xf5db('0x1cf')](_0x2aabfe,_0x240a07,_0x1be82c,_0x4f93a5,_0x2cbd29);})[_0xf5db('0x3a')](function(_0x3337b4){return _0x2d6199(_0x3337b4);})[_0xf5db('0x9a')](function(_0x475494){return _0xfc953a(msgResponse('[CatchErlangB]',_0xf5db('0x8c'),JSON[_0xf5db('0x6e')](_0x475494)));});}if(_0x3d8615['dialPredictiveOptimization']===_0xf5db('0x1d0')){return _0x5d2fc5[_0xf5db('0x14d')](_0x3d8615['id'])[_0xf5db('0x3a')](function(_0x4f411a){var _0x4c93d4=_0x3d8615[_0xf5db('0x1d7')]-_0x4f411a[0x0][_0xf5db('0x1d6')];var _0xc02e0a=_0x3d8615['dialPredictiveInterval']*0x3c;var _0x57b30d=_0x348745[0x0][_0xf5db('0x4d')]+_0x348745[0x0][_0xf5db('0x50')];var _0x2ae0aa=(_0x348745[0x0][_0xf5db('0x47')]+_0x348745[0x0][_0xf5db('0x49')]+_0x348745[0x0][_0xf5db('0x4b')])/_0x348745[0x0][_0xf5db('0x45')];var _0x2829b3=_0x3d8615['dialPredictiveOptimizationPercentage']/0x64;_0x3d8615[_0xf5db('0x1d8')]=_0x4f411a[0x0][_0xf5db('0x1d6')]||0x0;_0x3d8615[_0xf5db('0x1ba')]=_0x2ae0aa>0x0?_0x2ae0aa:0x1;return _0x5d2fc5['busyFactor'](_0x4c93d4,_0xc02e0a,_0x57b30d,_0x2ae0aa,_0x2829b3);})[_0xf5db('0x3a')](function(_0x4188c7){return _0x2d6199(_0x4188c7);})[_0xf5db('0x9a')](function(_0x18b89e){return _0xfc953a(msgResponse(_0xf5db('0x1d9'),_0xf5db('0x8c'),JSON[_0xf5db('0x6e')](_0x18b89e)));});}}else{return _0xfc953a(msgResponse(_0xf5db('0x1d2'),'Failure',_0xf5db('0x1d4')));}});};};Dialer[_0xf5db('0x17')]['startMethodPredictive']=function(_0x541246){var _0x40190=this;return function(){var _0x3dad58=0x0;var _0x361a16=Math[_0xf5db('0x1b8')](_0x541246[_0xf5db('0x1da')]*0x3e8);if(_0x361a16>0x0){_0x361a16=_0x361a16<0x64?0x64:_0x361a16;loggerPredictive[_0xf5db('0x44')](_0x541246[_0xf5db('0x41')],_0xf5db('0x1db'),_0x361a16,_0xf5db('0x1dc'));_0x541246[_0xf5db('0x5d')]=setInterval(function(){_0x40190['handlePredictive'](_0x541246);loggerPredictiveCalls[_0xf5db('0x44')](_0xf5db('0x1dd'),_0x3dad58+=0x1);},_0x361a16);}else{loggerPredictive[_0xf5db('0x44')](_0x541246[_0xf5db('0x41')],_0xf5db('0x1de'));}};};Dialer['prototype'][_0xf5db('0x1df')]=function(_0x54e63d,_0xdd6123){var _0x42f826=this;return function(_0x14b343){if(_[_0xf5db('0x43')](_0x14b343)){if(_[_0xf5db('0xf0')](_0xdd6123[_0xf5db('0x151')])||!_0xdd6123[_0xf5db('0x1e0')]){if(_0x54e63d[_0xf5db('0xaa')]==='booked'){_0x54e63d[_0xf5db('0x6c')]=_[_0xf5db('0x4e')](_0x54e63d[_0xf5db('0x6c')])?!![]:_0x54e63d['queueStatusComplete'];var _0x43ba46=uuid['v4']();_0x42f826['actions'][_0x43ba46]=new Action(_0x54e63d,_0xdd6123,_0x43ba46);loggerBooked[_0xf5db('0x44')]('[booked][checkContactBlack]',_0x43ba46,_0xf5db('0x1e1'),JSON[_0xf5db('0x6e')](_0x54e63d['queueStatusComplete']),_0xf5db('0x1e2'),_0x54e63d['name']);if(_0x54e63d[_0xf5db('0x6c')]){_0x54e63d[_0xf5db('0x6c')]=![];_0x42f826[_0xf5db('0x28')][_0x42f826[_0xf5db('0x22')][_0x43ba46]['queue']]=[];ami['Action']({'actionid':_0x43ba46,'action':_0xf5db('0x1e3'),'queue':_0x54e63d[_0xf5db('0x41')]})[_0xf5db('0x9a')](function(){_0x42f826[_0xf5db('0xbd')](_0x54e63d);hopperUtils[_0xf5db('0xd7')]({'active':![],'ContactId':_0x42f826['actions'][_0x43ba46]['ContactId'],'ListId':_0x42f826['actions'][_0x43ba46][_0xf5db('0xdc')],'VoiceQueueId':_0x42f826['actions'][_0x43ba46][_0xf5db('0xdd')]||undefined,'CampaignId':_0x42f826[_0xf5db('0x22')][_0x43ba46][_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1e4')));delete _0x42f826[_0xf5db('0x22')][_0x43ba46];});}else{loggerBooked[_0xf5db('0x44')]('[booked][checkContactBlack][else]',JSON[_0xf5db('0x6e')](_0x54e63d['queueStatusComplete']),'Queue:\x20',_0x54e63d[_0xf5db('0x41')]);_0x42f826[_0xf5db('0xbd')](_0x54e63d);hopperUtils[_0xf5db('0xd7')]({'active':![],'ContactId':_0x42f826[_0xf5db('0x22')][_0x43ba46][_0xf5db('0xdb')],'ListId':_0x42f826['actions'][_0x43ba46][_0xf5db('0xdc')],'VoiceQueueId':_0x42f826[_0xf5db('0x22')][_0x43ba46][_0xf5db('0xdd')]||undefined,'CampaignId':_0x42f826[_0xf5db('0x22')][_0x43ba46][_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1e4')));delete _0x42f826['actions'][_0x43ba46];}}else{return _0x42f826[_0xf5db('0x1e5')](_0x54e63d,_0xdd6123);}}else{if(utils[_0xf5db('0xca')](undefined,_0xdd6123[_0xf5db('0x1e6')])<_0x54e63d[_0xf5db('0x1e7')]*0x3c){if(_0xdd6123[_0xf5db('0x144')]&&!_0xdd6123['Agent'][_0xf5db('0x1e8')]){_0x42f826[_0xf5db('0x1c')][_0xf5db('0xfe')](_0xdd6123['id'])[_0xf5db('0x1a')](function(){_0x42f826[_0xf5db('0xbd')](_0x54e63d);});}else{hopperUtils[_0xf5db('0x1e9')]({'active':![]},_0xdd6123['id'],0x1)[_0xf5db('0x1a')](function(){_0x42f826[_0xf5db('0xbd')](_0x54e63d);});}}else{_0x54e63d[_0xf5db('0x1ea')]+=0x1;_0x42f826[_0xf5db('0xbd')](_0x54e63d);if(_0x54e63d['dialRecallInQueue']){hopperUtils[_0xf5db('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xdd6123[_0xf5db('0xdb')],'ListId':_0xdd6123['ListId'],'VoiceQueueId':_0xdd6123[_0xf5db('0xdd')]||undefined,'CampaignId':_0xdd6123[_0xf5db('0xde')]||undefined})[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x1eb')));hopperUtils['createHistory'](createObjHistory(_0x54e63d,_0xdd6123,utils[_0xf5db('0x66')][_0xf5db('0x1ec')],0x17,_0xf5db('0x1ed')))[_0xf5db('0x9a')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x42f826[_0xf5db('0x116')](createObjHistory(_0x54e63d,_0xdd6123,utils[_0xf5db('0x66')][_0xf5db('0x1ee')],0x16,_0xf5db('0x1ef')),_0xf5db('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x54e63d['outboundBlacklistCallsDay']+=0x1;_0x42f826[_0xf5db('0x116')](createObjHistory(_0x54e63d,_0xdd6123,utils[_0xf5db('0x66')][_0xf5db('0x1f1')],0xd,'Blacklist'),_0xf5db('0x1f2'),_0xf5db('0x1f3'));throw _0xf5db('0x1f4');}};};Dialer[_0xf5db('0x17')][_0xf5db('0x154')]=function(_0x4e9747){var _0x514e7b=this;var _0x52777c=_0x4e9747[_0xf5db('0x1f5')]-_0x4e9747['originated'];emitCampaignSummary(_0x4e9747);if(_0x52777c>0x0&&_0x4e9747['temp']==0x0){if(_0x52777c>this[_0xf5db('0x20')]){_0x52777c=this[_0xf5db('0x20')];}_0x4e9747[_0xf5db('0x62')]=0x1;hopperUtils[_0xf5db('0x1f6')](_0x4e9747,_0x52777c)['then'](function(_0x41b4a4){_0x4e9747['temp']=0x0;if(_0x41b4a4){if(!utils[_0xf5db('0x1f7')](_0x41b4a4)){_0x4e9747[_0xf5db('0x63')]=utils['CAMPAIGN_STATUS'][_0xf5db('0x67')];logger[_0xf5db('0x44')](_0xf5db('0x1f8')+_0x4e9747[_0xf5db('0x41')]);}else{_0x4e9747[_0xf5db('0x78')]+=_0x41b4a4[_0xf5db('0x90')];_0x4e9747[_0xf5db('0x63')]=utils[_0xf5db('0x66')][_0xf5db('0x1f9')];for(var _0x2f1789=0x0;_0x2f1789<_0x41b4a4['length'];_0x2f1789+=0x1){_0x4e9747[_0xf5db('0x1fa')]+=0x1;if(_[_0xf5db('0xf0')](_0x41b4a4[_0x2f1789])||_['isNil'](_0x41b4a4[_0x2f1789]['Contact'])||_[_0xf5db('0xf0')](_0x41b4a4[_0x2f1789][_0xf5db('0x157')])){_0x514e7b[_0xf5db('0x1fb')](_0xf5db('0x1fc'),_0x4e9747,_0x41b4a4[_0x2f1789]);}else{hopperUtils[_0xf5db('0x1fd')](_[_0xf5db('0xf4')](_0x41b4a4[_0x2f1789],[_0xf5db('0xde'),_0xf5db('0x157')]))[_0xf5db('0x3a')](_0x514e7b[_0xf5db('0x1df')](_0x4e9747,_0x41b4a4[_0x2f1789]))[_0xf5db('0x9a')](_0x514e7b['loggerHandler'](_0xf5db('0x1fe'),_0x4e9747));}}}}})['catch'](loggerGetContactDialer(_0xf5db('0x1ff'),_0x4e9747,_0x52777c));}};Dialer[_0xf5db('0x17')][_0xf5db('0xac')]=function(_0x4a0a13,_0x513e98){var _0xb068ee=this;var _0x434353=[];if(_0x513e98<0x1||_0x4a0a13['dialMethod']===_0xf5db('0x5')){_0x513e98=0x1;}var _0x58da3d=Math[_0xf5db('0x1b8')](_0x4a0a13['available']*_0x513e98)-_0x4a0a13[_0xf5db('0x78')];if(_0x4a0a13['dialLimitQueue']>0x0){var _0x585085=_0x4a0a13[_0xf5db('0x200')]-_0x4a0a13['originated']-_0x4a0a13[_0xf5db('0x139')]-_0x4a0a13[_0xf5db('0x13a')];if(_0x58da3d>_0x585085){_0x58da3d=_0x585085;}}if(_0x58da3d>0x0&&_0x4a0a13[_0xf5db('0x62')]==0x0){if(_0x4a0a13['dialMethod']===_0xf5db('0x5')){_0x58da3d=0x1;}if(_0x58da3d>this[_0xf5db('0x20')]){_0x58da3d=this[_0xf5db('0x20')];}for(var _0x45b46e in this[_0xf5db('0x1f')]){if(typeof this['agents'][_0x45b46e]!=='undefined'){if(this[_0xf5db('0x1f')][_0x45b46e][_0xf5db('0x68')]===_0xf5db('0x201')&&this[_0xf5db('0x1f')][_0x45b46e][_0xf5db('0x80')]===_0xf5db('0x81')){_0x434353[_0xf5db('0x91')](this['agents'][_0x45b46e]['id']);}}}_0x4a0a13[_0xf5db('0x62')]=0x1;hopperUtils[_0xf5db('0x202')](_0x4a0a13,_0x434353,_0x58da3d)[_0xf5db('0x3a')](function(_0x402b46){_0x4a0a13[_0xf5db('0x62')]=0x0;if(_0x402b46){if(!utils[_0xf5db('0x1f7')](_0x402b46)){hopperUtils[_0xf5db('0x203')](_0x4a0a13)['then'](sendMessageReschedule(_0x4a0a13))[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x204')));}else{_0x4a0a13[_0xf5db('0x78')]+=_0x402b46[_0xf5db('0x90')];_0x4a0a13[_0xf5db('0x63')]=_0x4a0a13['dialMethod']===_0xf5db('0x5')?utils['CAMPAIGN_STATUS'][_0xf5db('0x205')]:utils[_0xf5db('0x66')][_0xf5db('0x1f9')];for(var _0x17b8f4=0x0;_0x17b8f4<_0x402b46[_0xf5db('0x90')];_0x17b8f4+=0x1){if(_['isNil'](_0x402b46[_0x17b8f4])||_[_0xf5db('0xf0')](_0x402b46[_0x17b8f4][_0xf5db('0x16d')])||_[_0xf5db('0xf0')](_0x402b46[_0x17b8f4][_0xf5db('0x157')])){_0xb068ee[_0xf5db('0x1fb')]('[actionOriginate]\x20',_0x4a0a13,_0x402b46[_0x17b8f4]);}else{hopperUtils[_0xf5db('0x206')](_[_0xf5db('0xf4')](_0x402b46[_0x17b8f4],['VoiceQueueId',_0xf5db('0x157')]))[_0xf5db('0x3a')](_0xb068ee[_0xf5db('0x1df')](_0x4a0a13,_0x402b46[_0x17b8f4]))[_0xf5db('0x9a')](_0xb068ee[_0xf5db('0x150')](_0xf5db('0x1fc'),_0x4a0a13));}}}}})[_0xf5db('0x9a')](loggerGetContactDialer(_0xf5db('0x207'),_0x4a0a13,_0x58da3d));}};Dialer[_0xf5db('0x17')][_0xf5db('0x5d')]=function(_0x759b3d){if(_0x759b3d[_0xf5db('0x200')]>0x0){var _0x5c72c0=_0x759b3d[_0xf5db('0x200')]-_0x759b3d[_0xf5db('0x78')]-_0x759b3d[_0xf5db('0x139')];if(_0x5c72c0>0x0&&_0x759b3d['temp']==0x0){this[_0xf5db('0x208')](_0x759b3d);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xf5db('0x208')](_0x759b3d);}};Dialer['prototype'][_0xf5db('0x208')]=function(_0x25f1bf){var _0x48965b=this;var _0x339e98=[];_0x25f1bf['originated']+=0x1;for(var _0x4522d6 in this[_0xf5db('0x1f')]){if(typeof this[_0xf5db('0x1f')][_0x4522d6]!==_0xf5db('0xa2')){if(this[_0xf5db('0x1f')][_0x4522d6][_0xf5db('0x68')]===_0xf5db('0x201')&&this[_0xf5db('0x1f')][_0x4522d6][_0xf5db('0x80')]===_0xf5db('0x81')){_0x339e98['push'](this['agents'][_0x4522d6]['id']);}}}_0x25f1bf[_0xf5db('0x62')]=0x1;return this[_0xf5db('0x202')](_0x25f1bf['id'],_0x339e98,0x1,_0x25f1bf['dialOrderByScheduledAt'],_0x25f1bf)['then'](function(_0x361b2a){_0x25f1bf['temp']=0x1;if(_0x361b2a){if(!utils[_0xf5db('0x1f7')](_0x361b2a)){utils['checkContactLowerLimitOriginate'](_0x25f1bf,0x1,0x0);return hopperUtils['countReScheduled'](_0x25f1bf)[_0xf5db('0x3a')](sendMessageReschedule(_0x25f1bf))[_0xf5db('0x9a')](loggerCatch(_0xf5db('0x204')));}else{_0x25f1bf[_0xf5db('0x63')]=utils[_0xf5db('0x66')][_0xf5db('0x1f9')];if(_[_0xf5db('0xf0')](_0x361b2a[0x0])||_[_0xf5db('0xf0')](_0x361b2a[0x0][_0xf5db('0x16d')])||_[_0xf5db('0xf0')](_0x361b2a[0x0][_0xf5db('0x157')])){_0x48965b[_0xf5db('0x1fb')]('[actionOriginate]\x20',_0x25f1bf,_0x361b2a[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xf5db('0xf4')](_0x361b2a[0x0],[_0xf5db('0xdd'),_0xf5db('0x157')]))[_0xf5db('0x3a')](_0x48965b[_0xf5db('0x1df')](_0x25f1bf,_0x361b2a[0x0]))[_0xf5db('0x9a')](_0x48965b['loggerHandler'](_0xf5db('0x209'),_0x25f1bf));}}}})[_0xf5db('0x9a')](loggerGetContactDialer('[getContactDialerPredictive]',_0x25f1bf,0x1));};Dialer['prototype'][_0xf5db('0x1cf')]=function(_0x531911,_0x356790,_0x4c31da,_0x57780b,_0x20b16d,_0x3ac633){loggerPredictive[_0xf5db('0x44')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20a'),_0x531911);loggerPredictive[_0xf5db('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x356790);loggerPredictive[_0xf5db('0x44')]('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',_0x4c31da);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20b'),_0x57780b);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20c'),_0x20b16d);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20d'));return new Promise(function(_0x45e91a,_0x1714f5){if(_0x531911<=0x0||isNaN(_0x531911)){return _0x1714f5(msgResponse(_0xf5db('0x20e'),_0xf5db('0x7d'),_0xf5db('0x20f')+_0x531911));}if(_0x4c31da<=0x0||isNaN(_0x4c31da)){return _0x1714f5(msgResponse('[abandonmentRate]','Error',_0xf5db('0x210')+_0x4c31da));}if(_0x57780b<=0x0||isNaN(_0x57780b)){return _0x1714f5(msgResponse('[abandonmentRate]',_0xf5db('0x7d'),_0xf5db('0x211')+_0x57780b));}if(_0x356790<=0x0||isNaN(_0x356790)){return _0x1714f5(msgResponse(_0xf5db('0x20e'),_0xf5db('0x7d'),_0xf5db('0x212')+_0x356790));}if(_0x20b16d<=0x0||isNaN(_0x20b16d)){return _0x1714f5(msgResponse(_0xf5db('0x20e'),_0xf5db('0x7d'),_0xf5db('0x213')+_0x20b16d));}_0x3ac633=_0x3ac633||0x0;var _0x115501=0x1/_0x4c31da;var _0x2b7a9a=0x0;var _0x2ebaca=0x0;var _0x161c13=0x0;var _0x2cf8f7=0x0;for(var _0x4b3f6f=0x0;_0x161c13<_0x20b16d;_0x4b3f6f+=0x1){_0x2ebaca=_0x4b3f6f/_0x356790;_0x2b7a9a=(_0x57780b*_0x2ebaca+_0x3ac633)/_0x115501;_0x161c13=utils['erlangb'](_0x2b7a9a,_0x531911);_0x2cf8f7=_0x2b7a9a/_0x531911*(0x1-utils[_0xf5db('0x214')](_0x2b7a9a,_0x531911));}return _0x45e91a({'erlangCalls':_0x4b3f6f,'erlangCallToSecond':_0x356790/_0x4b3f6f,'erlangAbandonmentRate':_0x161c13,'erlangBusyFactor':_0x2cf8f7});});};Dialer['prototype'][_0xf5db('0x1d1')]=function(_0x453d9c,_0x26f9a2,_0xbaa388,_0x5342bf,_0x371273,_0x5291e6){loggerPredictive[_0xf5db('0x44')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xf5db('0x20a'),_0x453d9c);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x215'),_0x26f9a2);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x216'),_0xbaa388);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20b'),_0x5342bf);loggerPredictive[_0xf5db('0x44')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x371273);loggerPredictive[_0xf5db('0x44')](_0xf5db('0x20d'));return new Promise(function(_0x426304,_0x4ca054){if(_0x453d9c<=0x0||isNaN(_0x453d9c)){return _0x4ca054(msgResponse(_0xf5db('0x217'),'Error',_0xf5db('0x20f')+_0x453d9c));}if(_0xbaa388<=0x0||isNaN(_0xbaa388)){return _0x4ca054(msgResponse(_0xf5db('0x217'),_0xf5db('0x7d'),'Ts\x20=\x20'+_0xbaa388));}if(_0x5342bf<=0x0||isNaN(_0x5342bf)){return _0x4ca054(msgResponse(_0xf5db('0x217'),_0xf5db('0x7d'),_0xf5db('0x211')+_0x5342bf));}if(_0x26f9a2<=0x0||isNaN(_0x26f9a2)){return _0x4ca054(msgResponse('[busyFactor]',_0xf5db('0x7d'),_0xf5db('0x212')+_0x26f9a2));}if(_0x371273<=0x0||isNaN(_0x371273)){return _0x4ca054(msgResponse('[busyFactor]','Error',_0xf5db('0x218')+_0x371273));}_0x5291e6=_0x5291e6||0x0;var _0x8edaa=0x1/_0xbaa388;var _0x412b60=0x0;var _0x438586=0x0;var _0x246393=0x0;var _0x485593=0x0;for(var _0x169bad=0x0;_0x485593<_0x371273;_0x169bad+=0x1){_0x438586=_0x169bad/_0x26f9a2;_0x412b60=(_0x5342bf*_0x438586+_0x5291e6)/_0x8edaa;_0x246393=utils[_0xf5db('0x214')](_0x412b60,_0x453d9c);_0x485593=_0x412b60/_0x453d9c*(0x1-utils['erlangb'](_0x412b60,_0x453d9c));}return _0x426304({'erlangCalls':_0x169bad,'erlangCallToSecond':_0x26f9a2/_0x169bad,'erlangAbandonmentRate':_0x246393,'erlangBusyFactor':_0x485593});});};module[_0xf5db('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index f993a77..fef8318 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ede=['number','substring','prototype','getQueue','lodash','string','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x201186,_0x5f73db){var _0x4b1973=function(_0x2c662e){while(--_0x2c662e){_0x201186['push'](_0x201186['shift']());}};_0x4b1973(++_0x5f73db);}(_0x1ede,0x138));var _0xe1ed=function(_0x127b1f,_0x38d813){_0x127b1f=_0x127b1f-0x0;var _0x278a17=_0x1ede[_0x127b1f];return _0x278a17;};'use strict';var util=require('util');var _=require(_0xe1ed('0x0'));var moment=require('moment');function checkNameSurname(_0x1c52c5,_0x120da8,_0x3ac33e){var _0x3df5d9='';if(!_['isNil'](_0x120da8)&&_0xe1ed('0x1')===typeof _0x120da8){_0x3df5d9+=_0x120da8;}if(!_[_0xe1ed('0x2')](_0x3ac33e)&&_0xe1ed('0x1')===typeof _0x3ac33e){_0x3df5d9+='\x20'+_0x3ac33e;}if(_0x3df5d9!==''){return _0x3df5d9;}return _0x1c52c5;}function Action(_0x20afb6,_0x454c4f,_0x1eff7d){this[_0xe1ed('0x3')]=_0x20afb6;this[_0xe1ed('0x4')]=_0x1eff7d||undefined;this[_0xe1ed('0x5')]=checkNameSurname(_0x454c4f['Contact'][_0xe1ed('0x6')],_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x8')],_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x9')]);this['number']=_0x454c4f[_0xe1ed('0x6')];this[_0xe1ed('0xa')]=_0x20afb6[_0xe1ed('0x5')];this[_0xe1ed('0xb')]=_0x454c4f[_0xe1ed('0xb')]||![];this[_0xe1ed('0xc')]=_0x20afb6[_0xe1ed('0xc')];this[_0xe1ed('0xd')]=_0x20afb6['dialQueueTimeout']||0x3;this[_0xe1ed('0xe')]=_0x454c4f[_0xe1ed('0xe')];this[_0xe1ed('0xf')]=_0x454c4f[_0xe1ed('0xf')];this[_0xe1ed('0x10')]=_0x454c4f[_0xe1ed('0x10')];this[_0xe1ed('0x11')]=_0x454c4f[_0xe1ed('0x11')];this[_0xe1ed('0x12')]=_0x454c4f[_0xe1ed('0x12')];this[_0xe1ed('0x13')]=_0x454c4f['countdropretry'];this[_0xe1ed('0x14')]=_0x454c4f['countabandonedretry'];this[_0xe1ed('0x15')]=_0x454c4f[_0xe1ed('0x15')];this[_0xe1ed('0x16')]=_0x454c4f[_0xe1ed('0x16')];this[_0xe1ed('0x17')]=_0x454c4f[_0xe1ed('0x17')];this[_0xe1ed('0x18')]=_0x454c4f[_0xe1ed('0x18')];this[_0xe1ed('0x19')]=_0x454c4f[_0xe1ed('0x19')];this['VoiceQueueId']=_0x454c4f['VoiceQueueId'];this['CampaignId']=_0x454c4f[_0xe1ed('0x1a')];this[_0xe1ed('0x1b')]=_0x454c4f['id'];this['ContactFirstName']=_0x454c4f[_0xe1ed('0x7')][_0xe1ed('0x8')]||'';this[_0xe1ed('0x1c')]=moment()[_0xe1ed('0x1d')](_0xe1ed('0x1e'));this[_0xe1ed('0x1f')]=_0x454c4f['callback'];this[_0xe1ed('0x20')]=_0x454c4f[_0xe1ed('0x20')];this['callbackat']=_0x454c4f[_0xe1ed('0x21')];this['recallme']=_0x454c4f[_0xe1ed('0x22')];this[_0xe1ed('0x23')]='';this[_0xe1ed('0x24')]='';}Action['prototype'][_0xe1ed('0x25')]=function(){return util['format'](_0xe1ed('0x26'),this['name'],this[_0xe1ed('0x3')][_0xe1ed('0x27')]>0x0?this[_0xe1ed('0x28')][_0xe1ed('0x29')](this['voiceQueue'][_0xe1ed('0x27')]):this[_0xe1ed('0x28')]);};Action[_0xe1ed('0x2a')][_0xe1ed('0x2b')]=function(){return this[_0xe1ed('0xa')];};module['exports']=Action; \ No newline at end of file +var _0xe767=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','dialCutDigit','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0xe767,0x189));var _0x7e76=function(_0x5fb477,_0x4a2673){_0x5fb477=_0x5fb477-0x0;var _0x49fa00=_0xe767[_0x5fb477];return _0x49fa00;};'use strict';var util=require(_0x7e76('0x0'));var _=require('lodash');var moment=require(_0x7e76('0x1'));function checkNameSurname(_0x20e70f,_0x3e3ebc,_0x15cff4){var _0x42f3a7='';if(!_[_0x7e76('0x2')](_0x3e3ebc)&&_0x7e76('0x3')===typeof _0x3e3ebc){_0x42f3a7+=_0x3e3ebc;}if(!_[_0x7e76('0x2')](_0x15cff4)&&_0x7e76('0x3')===typeof _0x15cff4){_0x42f3a7+='\x20'+_0x15cff4;}if(_0x42f3a7!==''){return _0x42f3a7;}return _0x20e70f;}function Action(_0x58c484,_0x667764,_0x108c33){this[_0x7e76('0x4')]=_0x58c484;this[_0x7e76('0x5')]=_0x108c33||undefined;this[_0x7e76('0x6')]=checkNameSurname(_0x667764[_0x7e76('0x7')][_0x7e76('0x8')],_0x667764[_0x7e76('0x7')][_0x7e76('0x9')],_0x667764[_0x7e76('0x7')][_0x7e76('0xa')]);this[_0x7e76('0xb')]=_0x667764['phone'];this[_0x7e76('0xc')]=_0x58c484['name'];this[_0x7e76('0xd')]=_0x667764[_0x7e76('0xd')]||![];this[_0x7e76('0xe')]=_0x58c484[_0x7e76('0xe')];this[_0x7e76('0xf')]=_0x58c484[_0x7e76('0xf')]||0x3;this[_0x7e76('0x10')]=_0x667764[_0x7e76('0x10')];this[_0x7e76('0x11')]=_0x667764[_0x7e76('0x11')];this[_0x7e76('0x12')]=_0x667764[_0x7e76('0x12')];this[_0x7e76('0x13')]=_0x667764[_0x7e76('0x13')];this[_0x7e76('0x14')]=_0x667764[_0x7e76('0x14')];this[_0x7e76('0x15')]=_0x667764[_0x7e76('0x15')];this[_0x7e76('0x16')]=_0x667764[_0x7e76('0x16')];this[_0x7e76('0x17')]=_0x667764[_0x7e76('0x17')];this[_0x7e76('0x18')]=_0x667764[_0x7e76('0x18')];this['ContactId']=_0x667764['ContactId'];this[_0x7e76('0x19')]=_0x667764[_0x7e76('0x19')];this['UserId']=_0x667764[_0x7e76('0x1a')];this['VoiceQueueId']=_0x667764[_0x7e76('0x1b')];this[_0x7e76('0x1c')]=_0x667764[_0x7e76('0x1c')];this[_0x7e76('0x1d')]=_0x667764['id'];this[_0x7e76('0x1e')]=_0x667764[_0x7e76('0x7')][_0x7e76('0x9')]||'';this[_0x7e76('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x667764[_0x7e76('0x20')];this[_0x7e76('0x21')]=_0x667764['callbackuniqueid'];this[_0x7e76('0x22')]=_0x667764['callbackat'];this[_0x7e76('0x23')]=_0x667764['recallme'];this[_0x7e76('0x24')]='';this[_0x7e76('0x25')]='';}Action[_0x7e76('0x26')][_0x7e76('0x27')]=function(){return util[_0x7e76('0x28')]('\x22%s\x22\x20<%s>',this[_0x7e76('0x6')],this['voiceQueue'][_0x7e76('0x29')]>0x0?this['number']['substring'](this[_0x7e76('0x4')][_0x7e76('0x29')]):this[_0x7e76('0xb')]);};Action['prototype']['getQueue']=function(){return this[_0x7e76('0xc')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 53c7edd..19a2164 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02d6=['statedesc','Answer','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state'];(function(_0x34a318,_0x565dc7){var _0x49f361=function(_0x51a08a){while(--_0x51a08a){_0x34a318['push'](_0x34a318['shift']());}};_0x49f361(++_0x565dc7);}(_0x02d6,0x7f));var _0x602d=function(_0x1aec02,_0x3a7f22){_0x1aec02=_0x1aec02-0x0;var _0x10a837=_0x02d6[_0x1aec02];return _0x10a837;};'use strict';var moment=require(_0x602d('0x0'));var utils=require('../utils');function AgentComplete(_0x4489d2,_0x5c41fa){this[_0x602d('0x1')]=0x4;this[_0x602d('0x2')]=_0x602d('0x3');this['scheduledat']=_0x4489d2[_0x602d('0x4')];this['type']=_0x4489d2['type'];this[_0x602d('0x5')]=_0x4489d2[_0x602d('0x6')]==='outbound'?'queue':_0x4489d2['type'];this[_0x602d('0x7')]=_0x4489d2[_0x602d('0x7')];this[_0x602d('0x8')]=_0x4489d2[_0x602d('0x8')];this['countnoanswerretry']=_0x4489d2[_0x602d('0x9')];this[_0x602d('0xa')]=_0x4489d2['countbusyretry']+_0x4489d2[_0x602d('0x8')]+_0x4489d2[_0x602d('0x9')]+_0x4489d2[_0x602d('0xb')]+_0x4489d2['countdropretry']+_0x4489d2['countabandonedretry']+_0x4489d2[_0x602d('0xc')]+_0x4489d2[_0x602d('0xd')];this[_0x602d('0xb')]=_0x4489d2['countnosuchnumberretry'];this[_0x602d('0xe')]=_0x4489d2[_0x602d('0xe')];this[_0x602d('0xf')]=_0x4489d2[_0x602d('0xf')];this[_0x602d('0xc')]=_0x4489d2[_0x602d('0xc')];this[_0x602d('0xd')]=_0x4489d2[_0x602d('0xd')];this['uniqueid']=_0x5c41fa['uniqueid'];this['calleridname']=_0x4489d2[_0x602d('0x10')];this[_0x602d('0x11')]=_0x4489d2[_0x602d('0x12')];this[_0x602d('0x13')]=_0x4489d2[_0x602d('0x13')];this[_0x602d('0x14')]=_0x4489d2[_0x602d('0x14')];this[_0x602d('0x15')]=_0x4489d2['answertime'];this[_0x602d('0x16')]=moment()[_0x602d('0x17')](_0x602d('0x18'));this[_0x602d('0x19')]=utils[_0x602d('0x1a')](_0x4489d2[_0x602d('0x14')],_0x4489d2[_0x602d('0x13')]);this[_0x602d('0x1b')]=utils[_0x602d('0x1a')](_0x4489d2['answertime'],_0x4489d2[_0x602d('0x14')]);this['talktime']=utils[_0x602d('0x1a')](this[_0x602d('0x16')],_0x4489d2[_0x602d('0x15')]);this[_0x602d('0x1c')]=_0x5c41fa['queue'];this[_0x602d('0x1d')]=_0x5c41fa[_0x602d('0x1d')];this[_0x602d('0x1e')]=_0x5c41fa[_0x602d('0x1e')];this[_0x602d('0x1f')]=_0x4489d2[_0x602d('0x1f')];this['callbackuniqueid']=_0x4489d2['callbackuniqueid'];this[_0x602d('0x20')]=_0x4489d2[_0x602d('0x20')];this[_0x602d('0x21')]=_0x4489d2[_0x602d('0x21')];this[_0x602d('0x22')]=_0x4489d2[_0x602d('0x22')];this[_0x602d('0x23')]=_0x4489d2[_0x602d('0x23')];this[_0x602d('0x24')]=_0x4489d2[_0x602d('0x24')];this[_0x602d('0x25')]=_0x4489d2['VoiceQueueId'];this[_0x602d('0x26')]=_0x4489d2['CampaignId'];this[_0x602d('0x27')]=_0x4489d2[_0x602d('0x27')]||'';this[_0x602d('0x28')]=_0x4489d2[_0x602d('0x28')]||'';this['agiafterat']=_0x4489d2[_0x602d('0x29')];}module[_0x602d('0x2a')]=AgentComplete; \ No newline at end of file +var _0xbe54=['format','ringtime','getSeconds','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xbe54,0x15a));var _0x4be5=function(_0x246678,_0x5f3c01){_0x246678=_0x246678-0x0;var _0x4ce263=_0xbe54[_0x246678];return _0x4ce263;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x4a3392,_0x5275f3){this['state']=0x4;this[_0x4be5('0x0')]='Answer';this[_0x4be5('0x1')]=_0x4a3392[_0x4be5('0x1')];this[_0x4be5('0x2')]=_0x4a3392[_0x4be5('0x2')];this[_0x4be5('0x3')]=_0x4a3392['type']==='outbound'?_0x4be5('0x4'):_0x4a3392[_0x4be5('0x2')];this[_0x4be5('0x5')]=_0x4a3392[_0x4be5('0x5')];this[_0x4be5('0x6')]=_0x4a3392[_0x4be5('0x6')];this['countnoanswerretry']=_0x4a3392[_0x4be5('0x7')];this[_0x4be5('0x8')]=_0x4a3392[_0x4be5('0x5')]+_0x4a3392[_0x4be5('0x6')]+_0x4a3392[_0x4be5('0x7')]+_0x4a3392[_0x4be5('0x9')]+_0x4a3392[_0x4be5('0xa')]+_0x4a3392['countabandonedretry']+_0x4a3392['countmachineretry']+_0x4a3392[_0x4be5('0xb')];this[_0x4be5('0x9')]=_0x4a3392[_0x4be5('0x9')];this['countdropretry']=_0x4a3392[_0x4be5('0xa')];this['countabandonedretry']=_0x4a3392[_0x4be5('0xc')];this[_0x4be5('0xd')]=_0x4a3392[_0x4be5('0xd')];this[_0x4be5('0xb')]=_0x4a3392[_0x4be5('0xb')];this[_0x4be5('0xe')]=_0x5275f3['uniqueid'];this[_0x4be5('0xf')]=_0x4a3392[_0x4be5('0x10')];this[_0x4be5('0x11')]=_0x4a3392[_0x4be5('0x12')];this[_0x4be5('0x13')]=_0x4a3392['starttime'];this[_0x4be5('0x14')]=_0x4a3392[_0x4be5('0x14')];this[_0x4be5('0x15')]=_0x4a3392[_0x4be5('0x15')];this[_0x4be5('0x16')]=moment()[_0x4be5('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4be5('0x18')]=utils[_0x4be5('0x19')](_0x4a3392['responsetime'],_0x4a3392[_0x4be5('0x13')]);this[_0x4be5('0x1a')]=utils[_0x4be5('0x19')](_0x4a3392[_0x4be5('0x15')],_0x4a3392[_0x4be5('0x14')]);this[_0x4be5('0x1b')]=utils['getSeconds'](this[_0x4be5('0x16')],_0x4a3392[_0x4be5('0x15')]);this['queue']=_0x5275f3[_0x4be5('0x4')];this[_0x4be5('0x1c')]=_0x5275f3['membername'];this[_0x4be5('0x1d')]=_0x5275f3[_0x4be5('0x1d')];this['callback']=_0x4a3392['callback'];this[_0x4be5('0x1e')]=_0x4a3392[_0x4be5('0x1e')];this['callbackat']=_0x4a3392[_0x4be5('0x1f')];this['recallme']=_0x4a3392[_0x4be5('0x20')];this['ContactId']=_0x4a3392['ContactId'];this[_0x4be5('0x21')]=_0x4a3392[_0x4be5('0x21')];this[_0x4be5('0x22')]=_0x4a3392[_0x4be5('0x22')];this[_0x4be5('0x23')]=_0x4a3392['VoiceQueueId'];this[_0x4be5('0x24')]=_0x4a3392['CampaignId'];this[_0x4be5('0x25')]=_0x4a3392['originatecalleridnum']||'';this[_0x4be5('0x26')]=_0x4a3392[_0x4be5('0x26')]||'';this[_0x4be5('0x27')]=_0x4a3392[_0x4be5('0x27')];}module[_0x4be5('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4ed35e8..ba977ed 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18e8=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x2a863f,_0x3e7a74){var _0x525dac=function(_0x476b9f){while(--_0x476b9f){_0x2a863f['push'](_0x2a863f['shift']());}};_0x525dac(++_0x3e7a74);}(_0x18e8,0x15f));var _0x818e=function(_0x48ca09,_0x23f419){_0x48ca09=_0x48ca09-0x0;var _0x52403e=_0x18e8[_0x48ca09];return _0x52403e;};'use strict';function Final(_0x4de7ec){this[_0x818e('0x0')]=_0x4de7ec['uniqueid'];this['scheduledat']=_0x4de7ec[_0x818e('0x1')];this[_0x818e('0x2')]=_0x4de7ec[_0x818e('0x2')];this[_0x818e('0x3')]=_0x4de7ec[_0x818e('0x2')]===_0x818e('0x4')?_0x818e('0x5'):_0x4de7ec[_0x818e('0x2')];this['countbusyretry']=_0x4de7ec['countbusyretry'];this[_0x818e('0x6')]=_0x4de7ec[_0x818e('0x6')];this['countnoanswerretry']=_0x4de7ec['countnoanswerretry'];this[_0x818e('0x7')]=_0x4de7ec[_0x818e('0x8')]+_0x4de7ec['countcongestionretry']+_0x4de7ec[_0x818e('0x9')]+_0x4de7ec[_0x818e('0xa')]+_0x4de7ec[_0x818e('0xb')]+_0x4de7ec[_0x818e('0xc')]+_0x4de7ec[_0x818e('0xd')]+_0x4de7ec[_0x818e('0xe')];this['countnosuchnumberretry']=_0x4de7ec['countnosuchnumberretry'];this['countdropretry']=_0x4de7ec['countdropretry'];this[_0x818e('0xc')]=_0x4de7ec[_0x818e('0xc')];this['countmachineretry']=_0x4de7ec[_0x818e('0xd')];this[_0x818e('0xe')]=_0x4de7ec[_0x818e('0xe')];this[_0x818e('0x5')]=_0x4de7ec[_0x818e('0x5')];this[_0x818e('0xf')]=_0x4de7ec['calleridname'];this[_0x818e('0x10')]=_0x4de7ec[_0x818e('0x10')];this[_0x818e('0x11')]=_0x4de7ec[_0x818e('0x11')];this[_0x818e('0x12')]=_0x4de7ec[_0x818e('0x12')];this[_0x818e('0x13')]=_0x4de7ec[_0x818e('0x12')];this['ringtime']=_0x4de7ec[_0x818e('0x14')]||0x0;this[_0x818e('0x15')]=_0x4de7ec[_0x818e('0x15')]||0x0;this[_0x818e('0x16')]=_0x4de7ec[_0x818e('0x16')]||0x0;this['callback']=_0x4de7ec[_0x818e('0x17')];this['callbackuniqueid']=_0x4de7ec[_0x818e('0x18')];this[_0x818e('0x19')]=_0x4de7ec['callbackat'];this[_0x818e('0x1a')]=_0x4de7ec[_0x818e('0x1a')];this[_0x818e('0x1b')]=_0x4de7ec['ContactId'];this[_0x818e('0x1c')]=_0x4de7ec[_0x818e('0x1c')];this[_0x818e('0x1d')]=_0x4de7ec[_0x818e('0x1d')];this[_0x818e('0x1e')]=_0x4de7ec[_0x818e('0x1e')];this[_0x818e('0x1f')]=_0x4de7ec[_0x818e('0x1f')];this[_0x818e('0x20')]=_0x4de7ec[_0x818e('0x20')]||'';this[_0x818e('0x21')]=_0x4de7ec[_0x818e('0x21')]||'';this[_0x818e('0x22')]=_0x4de7ec[_0x818e('0x22')];this[_0x818e('0x23')]=_0x4de7ec[_0x818e('0x23')];}module[_0x818e('0x24')]=Final; \ No newline at end of file +var _0xcbb5=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry'];(function(_0xac1a5a,_0x22be54){var _0x1da5da=function(_0x29e271){while(--_0x29e271){_0xac1a5a['push'](_0xac1a5a['shift']());}};_0x1da5da(++_0x22be54);}(_0xcbb5,0x1b0));var _0x5cbb=function(_0x3b3ff5,_0x5b4e47){_0x3b3ff5=_0x3b3ff5-0x0;var _0x2ace78=_0xcbb5[_0x3b3ff5];return _0x2ace78;};'use strict';function Final(_0x27517b){this[_0x5cbb('0x0')]=_0x27517b[_0x5cbb('0x0')];this[_0x5cbb('0x1')]=_0x27517b[_0x5cbb('0x1')];this['type']=_0x27517b[_0x5cbb('0x2')];this[_0x5cbb('0x3')]=_0x27517b[_0x5cbb('0x2')]===_0x5cbb('0x4')?_0x5cbb('0x5'):_0x27517b[_0x5cbb('0x2')];this[_0x5cbb('0x6')]=_0x27517b[_0x5cbb('0x6')];this[_0x5cbb('0x7')]=_0x27517b[_0x5cbb('0x7')];this['countnoanswerretry']=_0x27517b['countnoanswerretry'];this[_0x5cbb('0x8')]=_0x27517b[_0x5cbb('0x6')]+_0x27517b[_0x5cbb('0x7')]+_0x27517b[_0x5cbb('0x9')]+_0x27517b[_0x5cbb('0xa')]+_0x27517b['countdropretry']+_0x27517b[_0x5cbb('0xb')]+_0x27517b[_0x5cbb('0xc')]+_0x27517b[_0x5cbb('0xd')];this['countnosuchnumberretry']=_0x27517b[_0x5cbb('0xa')];this[_0x5cbb('0xe')]=_0x27517b[_0x5cbb('0xe')];this['countabandonedretry']=_0x27517b[_0x5cbb('0xb')];this[_0x5cbb('0xc')]=_0x27517b[_0x5cbb('0xc')];this[_0x5cbb('0xd')]=_0x27517b[_0x5cbb('0xd')];this[_0x5cbb('0x5')]=_0x27517b[_0x5cbb('0x5')];this[_0x5cbb('0xf')]=_0x27517b['calleridname'];this[_0x5cbb('0x10')]=_0x27517b[_0x5cbb('0x10')];this['starttime']=_0x27517b[_0x5cbb('0x11')];this[_0x5cbb('0x12')]=_0x27517b['responsetime'];this['endtime']=_0x27517b['responsetime'];this['ringtime']=_0x27517b[_0x5cbb('0x13')]||0x0;this['holdtime']=_0x27517b['holdtime']||0x0;this[_0x5cbb('0x14')]=_0x27517b['talktime']||0x0;this[_0x5cbb('0x15')]=_0x27517b[_0x5cbb('0x15')];this[_0x5cbb('0x16')]=_0x27517b['callbackuniqueid'];this[_0x5cbb('0x17')]=_0x27517b[_0x5cbb('0x17')];this[_0x5cbb('0x18')]=_0x27517b[_0x5cbb('0x18')];this[_0x5cbb('0x19')]=_0x27517b[_0x5cbb('0x19')];this[_0x5cbb('0x1a')]=_0x27517b[_0x5cbb('0x1a')];this[_0x5cbb('0x1b')]=_0x27517b[_0x5cbb('0x1b')];this[_0x5cbb('0x1c')]=_0x27517b[_0x5cbb('0x1c')];this[_0x5cbb('0x1d')]=_0x27517b[_0x5cbb('0x1d')];this[_0x5cbb('0x1e')]=_0x27517b['originatecalleridnum']||'';this[_0x5cbb('0x1f')]=_0x27517b[_0x5cbb('0x1f')]||'';this[_0x5cbb('0x20')]=_0x27517b[_0x5cbb('0x20')];this[_0x5cbb('0x21')]=_0x27517b[_0x5cbb('0x21')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index abecc7f..2b9727b 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17e3=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x17e3,0x1ef));var _0x317e=function(_0x226756,_0x59e2ee){_0x226756=_0x226756-0x0;var _0x4a3aeb=_0x17e3[_0x226756];return _0x4a3aeb;};'use strict';var moment=require('moment');var utils=require(_0x317e('0x0'));function Hangup(_0x20021d,_0x53dcbe){this[_0x317e('0x1')]=0x4;this['statedesc']=_0x317e('0x2');this[_0x317e('0x3')]=_0x20021d[_0x317e('0x3')];this[_0x317e('0x4')]=_0x20021d['type'];this[_0x317e('0x5')]=_0x20021d[_0x317e('0x4')]==='outbound'?_0x317e('0x6'):_0x20021d[_0x317e('0x4')];this[_0x317e('0x7')]=_0x20021d['amd']||![];this[_0x317e('0x8')]=_0x20021d[_0x317e('0x8')];this[_0x317e('0x9')]=_0x20021d[_0x317e('0x9')];this[_0x317e('0xa')]=_0x20021d[_0x317e('0xa')];this[_0x317e('0xb')]=_0x20021d[_0x317e('0x8')]+_0x20021d[_0x317e('0x9')]+_0x20021d[_0x317e('0xa')]+_0x20021d[_0x317e('0xc')]+_0x20021d[_0x317e('0xd')]+_0x20021d[_0x317e('0xe')]+_0x20021d[_0x317e('0xf')]+_0x20021d['countagentrejectretry'];this['countnosuchnumberretry']=_0x20021d['countnosuchnumberretry'];this[_0x317e('0xd')]=_0x20021d[_0x317e('0xd')];this[_0x317e('0xe')]=_0x20021d[_0x317e('0xe')];this[_0x317e('0xf')]=_0x20021d[_0x317e('0xf')];this[_0x317e('0x10')]=_0x20021d[_0x317e('0x10')];this[_0x317e('0x11')]=_0x53dcbe[_0x317e('0x11')];this[_0x317e('0x12')]=_0x20021d[_0x317e('0x13')];this[_0x317e('0x14')]=_0x20021d[_0x317e('0x15')];this['starttime']=_0x20021d[_0x317e('0x16')];this['responsetime']=_0x20021d['responsetime'];this[_0x317e('0x17')]=moment()[_0x317e('0x18')](_0x317e('0x19'));this[_0x317e('0x1a')]=utils[_0x317e('0x1b')](_0x20021d[_0x317e('0x1c')],_0x20021d[_0x317e('0x16')]);this[_0x317e('0x1d')]=0x0;this['talktime']=utils[_0x317e('0x1b')](this[_0x317e('0x17')],_0x20021d[_0x317e('0x1c')]);this[_0x317e('0x6')]=_0x20021d['queue'];this['membername']='IVR';this['reason']=_0x53dcbe['cause-txt'];this['callback']=_0x20021d[_0x317e('0x1e')];this['callbackuniqueid']=_0x20021d['callbackuniqueid'];this[_0x317e('0x1f')]=_0x20021d[_0x317e('0x1f')];this[_0x317e('0x20')]=_0x20021d[_0x317e('0x20')];this['ContactId']=_0x20021d[_0x317e('0x21')];this[_0x317e('0x22')]=_0x20021d[_0x317e('0x22')];this[_0x317e('0x23')]=_0x20021d[_0x317e('0x23')];this[_0x317e('0x24')]=_0x20021d[_0x317e('0x24')];this[_0x317e('0x25')]=_0x20021d[_0x317e('0x25')];}module[_0x317e('0x26')]=Hangup; \ No newline at end of file +var _0xbbe2=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbbe2,0x14b));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x494296,_0x57bd7d){this[_0x2bbe('0x0')]=0x4;this[_0x2bbe('0x1')]=_0x2bbe('0x2');this[_0x2bbe('0x3')]=_0x494296[_0x2bbe('0x3')];this[_0x2bbe('0x4')]=_0x494296[_0x2bbe('0x4')];this[_0x2bbe('0x5')]=_0x494296[_0x2bbe('0x4')]===_0x2bbe('0x6')?'queue':_0x494296[_0x2bbe('0x4')];this[_0x2bbe('0x7')]=_0x494296[_0x2bbe('0x7')]||![];this[_0x2bbe('0x8')]=_0x494296['countbusyretry'];this['countcongestionretry']=_0x494296[_0x2bbe('0x9')];this[_0x2bbe('0xa')]=_0x494296[_0x2bbe('0xa')];this[_0x2bbe('0xb')]=_0x494296[_0x2bbe('0x8')]+_0x494296['countcongestionretry']+_0x494296[_0x2bbe('0xa')]+_0x494296[_0x2bbe('0xc')]+_0x494296[_0x2bbe('0xd')]+_0x494296[_0x2bbe('0xe')]+_0x494296[_0x2bbe('0xf')]+_0x494296[_0x2bbe('0x10')];this[_0x2bbe('0xc')]=_0x494296[_0x2bbe('0xc')];this['countdropretry']=_0x494296[_0x2bbe('0xd')];this[_0x2bbe('0xe')]=_0x494296['countabandonedretry'];this[_0x2bbe('0xf')]=_0x494296[_0x2bbe('0xf')];this[_0x2bbe('0x10')]=_0x494296[_0x2bbe('0x10')];this[_0x2bbe('0x11')]=_0x57bd7d[_0x2bbe('0x11')];this[_0x2bbe('0x12')]=_0x494296[_0x2bbe('0x13')];this[_0x2bbe('0x14')]=_0x494296['number'];this[_0x2bbe('0x15')]=_0x494296[_0x2bbe('0x15')];this[_0x2bbe('0x16')]=_0x494296['responsetime'];this[_0x2bbe('0x17')]=moment()[_0x2bbe('0x18')](_0x2bbe('0x19'));this[_0x2bbe('0x1a')]=utils[_0x2bbe('0x1b')](_0x494296[_0x2bbe('0x16')],_0x494296['starttime']);this[_0x2bbe('0x1c')]=0x0;this[_0x2bbe('0x1d')]=utils[_0x2bbe('0x1b')](this[_0x2bbe('0x17')],_0x494296[_0x2bbe('0x16')]);this[_0x2bbe('0x1e')]=_0x494296[_0x2bbe('0x1e')];this[_0x2bbe('0x1f')]='IVR';this[_0x2bbe('0x20')]=_0x57bd7d[_0x2bbe('0x21')];this['callback']=_0x494296[_0x2bbe('0x22')];this[_0x2bbe('0x23')]=_0x494296[_0x2bbe('0x23')];this[_0x2bbe('0x24')]=_0x494296[_0x2bbe('0x24')];this[_0x2bbe('0x25')]=_0x494296[_0x2bbe('0x25')];this[_0x2bbe('0x26')]=_0x494296['ContactId'];this['ListId']=_0x494296['ListId'];this[_0x2bbe('0x27')]=_0x494296[_0x2bbe('0x27')];this[_0x2bbe('0x28')]=_0x494296['VoiceQueueId'];this[_0x2bbe('0x29')]=_0x494296[_0x2bbe('0x29')];}module[_0x2bbe('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 151f1a5..07012e5 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d9d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callbackuniqueid'];(function(_0x14edc0,_0x3831e6){var _0xd5bb1=function(_0x221420){while(--_0x221420){_0x14edc0['push'](_0x14edc0['shift']());}};_0xd5bb1(++_0x3831e6);}(_0x8d9d,0x1a2));var _0xd8d9=function(_0x4c52fa,_0x4354cb){_0x4c52fa=_0x4c52fa-0x0;var _0x8d0d79=_0x8d9d[_0x4c52fa];return _0x8d0d79;};'use strict';var utils=require(_0xd8d9('0x0'));function History(_0x2af631){this['uniqueid']=_0x2af631[_0xd8d9('0x1')];this[_0xd8d9('0x2')]=_0x2af631[_0xd8d9('0x2')]||undefined;this[_0xd8d9('0x3')]=_0x2af631[_0xd8d9('0x3')];this[_0xd8d9('0x4')]=_0x2af631[_0xd8d9('0x3')]==='outbound'?_0xd8d9('0x5'):_0x2af631[_0xd8d9('0x3')];this[_0xd8d9('0x6')]=_0x2af631[_0xd8d9('0x6')];this[_0xd8d9('0x7')]=_0x2af631[_0xd8d9('0x7')];this[_0xd8d9('0x8')]=_0x2af631[_0xd8d9('0x8')];this[_0xd8d9('0x9')]=_0x2af631[_0xd8d9('0x6')]+_0x2af631[_0xd8d9('0x7')]+_0x2af631[_0xd8d9('0x8')]+_0x2af631['countnosuchnumberretry']+_0x2af631['countdropretry']+_0x2af631['countabandonedretry']+_0x2af631[_0xd8d9('0xa')]+_0x2af631[_0xd8d9('0xb')];this['countnosuchnumberretry']=_0x2af631['countnosuchnumberretry'];this['countdropretry']=_0x2af631[_0xd8d9('0xc')];this[_0xd8d9('0xd')]=_0x2af631[_0xd8d9('0xd')];this['countmachineretry']=_0x2af631[_0xd8d9('0xa')];this[_0xd8d9('0xb')]=_0x2af631[_0xd8d9('0xb')];this[_0xd8d9('0x5')]=_0x2af631[_0xd8d9('0x5')];this[_0xd8d9('0xe')]=_0x2af631['name'];this[_0xd8d9('0xf')]=_0x2af631[_0xd8d9('0x10')];this['starttime']=_0x2af631[_0xd8d9('0x11')];this['responsetime']=_0x2af631[_0xd8d9('0x12')];this['endtime']=_0x2af631[_0xd8d9('0x12')];this[_0xd8d9('0x13')]=utils[_0xd8d9('0x14')](_0x2af631[_0xd8d9('0x12')],_0x2af631['starttime']);this[_0xd8d9('0x15')]=0x0;this[_0xd8d9('0x16')]=0x0;this['callback']=_0x2af631['callback'];this[_0xd8d9('0x17')]=_0x2af631['callbackuniqueid'];this[_0xd8d9('0x18')]=_0x2af631[_0xd8d9('0x18')];this[_0xd8d9('0x19')]=_0x2af631['recallme'];this[_0xd8d9('0x1a')]=_0x2af631[_0xd8d9('0x1a')];this[_0xd8d9('0x1b')]=_0x2af631[_0xd8d9('0x1b')];this[_0xd8d9('0x1c')]=_0x2af631[_0xd8d9('0x1c')];this['VoiceQueueId']=_0x2af631[_0xd8d9('0x1d')];this['CampaignId']=_0x2af631['CampaignId'];this[_0xd8d9('0x1e')]=_0x2af631[_0xd8d9('0x1e')]||'';this['originatecalleridname']=_0x2af631[_0xd8d9('0x1f')]||'';this['state']=_0x2af631[_0xd8d9('0x20')];this['statedesc']=_0x2af631[_0xd8d9('0x21')];}module['exports']=History; \ No newline at end of file +var _0x7667=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7667,0x74));var _0x7766=function(_0x35acaf,_0x9e3274){_0x35acaf=_0x35acaf-0x0;var _0x3006ca=_0x7667[_0x35acaf];return _0x3006ca;};'use strict';var utils=require('../utils');function History(_0x565d91){this[_0x7766('0x0')]=_0x565d91[_0x7766('0x0')];this[_0x7766('0x1')]=_0x565d91[_0x7766('0x1')]||undefined;this['type']=_0x565d91['type'];this[_0x7766('0x2')]=_0x565d91[_0x7766('0x3')]==='outbound'?'queue':_0x565d91[_0x7766('0x3')];this['countbusyretry']=_0x565d91[_0x7766('0x4')];this['countcongestionretry']=_0x565d91[_0x7766('0x5')];this[_0x7766('0x6')]=_0x565d91[_0x7766('0x6')];this[_0x7766('0x7')]=_0x565d91[_0x7766('0x4')]+_0x565d91['countcongestionretry']+_0x565d91[_0x7766('0x6')]+_0x565d91[_0x7766('0x8')]+_0x565d91[_0x7766('0x9')]+_0x565d91[_0x7766('0xa')]+_0x565d91[_0x7766('0xb')]+_0x565d91[_0x7766('0xc')];this[_0x7766('0x8')]=_0x565d91[_0x7766('0x8')];this[_0x7766('0x9')]=_0x565d91['countdropretry'];this[_0x7766('0xa')]=_0x565d91[_0x7766('0xa')];this[_0x7766('0xb')]=_0x565d91[_0x7766('0xb')];this[_0x7766('0xc')]=_0x565d91['countagentrejectretry'];this[_0x7766('0xd')]=_0x565d91['queue'];this[_0x7766('0xe')]=_0x565d91['name'];this[_0x7766('0xf')]=_0x565d91['number'];this['starttime']=_0x565d91[_0x7766('0x10')];this[_0x7766('0x11')]=_0x565d91[_0x7766('0x11')];this[_0x7766('0x12')]=_0x565d91[_0x7766('0x11')];this[_0x7766('0x13')]=utils[_0x7766('0x14')](_0x565d91[_0x7766('0x11')],_0x565d91[_0x7766('0x10')]);this[_0x7766('0x15')]=0x0;this[_0x7766('0x16')]=0x0;this[_0x7766('0x17')]=_0x565d91[_0x7766('0x17')];this[_0x7766('0x18')]=_0x565d91['callbackuniqueid'];this['callbackat']=_0x565d91[_0x7766('0x19')];this[_0x7766('0x1a')]=_0x565d91[_0x7766('0x1a')];this[_0x7766('0x1b')]=_0x565d91[_0x7766('0x1b')];this[_0x7766('0x1c')]=_0x565d91[_0x7766('0x1c')];this['UserId']=_0x565d91[_0x7766('0x1d')];this[_0x7766('0x1e')]=_0x565d91[_0x7766('0x1e')];this[_0x7766('0x1f')]=_0x565d91[_0x7766('0x1f')];this[_0x7766('0x20')]=_0x565d91['originatecalleridnum']||'';this[_0x7766('0x21')]=_0x565d91[_0x7766('0x21')]||'';this[_0x7766('0x22')]=_0x565d91[_0x7766('0x22')];this[_0x7766('0x23')]=_0x565d91[_0x7766('0x23')];}module[_0x7766('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index e5cf215..881cedb 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd270=['callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','membername','reason','callback','callbackuniqueid'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd270,0xce));var _0x0d27=function(_0x39e23a,_0x17845e){_0x39e23a=_0x39e23a-0x0;var _0x40eda6=_0xd270[_0x39e23a];return _0x40eda6;};'use strict';var utils=require(_0x0d27('0x0'));function QueueCallerAbandon(_0x4dea4f,_0x5a13c3){this[_0x0d27('0x1')]=_0x4dea4f[_0x0d27('0x1')];this[_0x0d27('0x2')]=_0x4dea4f[_0x0d27('0x2')];this[_0x0d27('0x3')]=_0x4dea4f[_0x0d27('0x2')]===_0x0d27('0x4')?_0x0d27('0x5'):_0x4dea4f[_0x0d27('0x2')];this['countbusyretry']=_0x4dea4f['countbusyretry'];this[_0x0d27('0x6')]=_0x4dea4f[_0x0d27('0x6')];this[_0x0d27('0x7')]=_0x4dea4f[_0x0d27('0x7')];this[_0x0d27('0x8')]=_0x4dea4f[_0x0d27('0x9')]+_0x4dea4f[_0x0d27('0x6')]+_0x4dea4f[_0x0d27('0x7')]+_0x4dea4f['countnosuchnumberretry']+_0x4dea4f['countdropretry']+_0x4dea4f[_0x0d27('0xa')]+_0x4dea4f[_0x0d27('0xb')]+_0x4dea4f[_0x0d27('0xc')];this[_0x0d27('0xd')]=_0x4dea4f[_0x0d27('0xd')];this[_0x0d27('0xe')]=_0x4dea4f['countdropretry'];this[_0x0d27('0xa')]=_0x4dea4f['countabandonedretry'];this[_0x0d27('0xb')]=_0x4dea4f[_0x0d27('0xb')];this['countagentrejectretry']=_0x4dea4f['countagentrejectretry'];this[_0x0d27('0xf')]=_0x5a13c3[_0x0d27('0xf')];this[_0x0d27('0x10')]=_0x4dea4f['name'];this[_0x0d27('0x11')]=_0x4dea4f[_0x0d27('0x12')];this[_0x0d27('0x13')]=_0x4dea4f[_0x0d27('0x13')];this[_0x0d27('0x14')]=_0x4dea4f[_0x0d27('0x14')];this[_0x0d27('0x15')]=_0x4dea4f['droptime'];this[_0x0d27('0x16')]=_0x4dea4f[_0x0d27('0x16')];this['endtime']=this[_0x0d27('0x15')];this['ringtime']=utils[_0x0d27('0x17')](_0x4dea4f[_0x0d27('0x14')],_0x4dea4f[_0x0d27('0x13')]);this['holdtime']=utils[_0x0d27('0x17')](this[_0x0d27('0x15')],_0x4dea4f['responsetime']);this['talktime']=0x0;this[_0x0d27('0x5')]=_0x5a13c3[_0x0d27('0x5')];this[_0x0d27('0x18')]=_0x5a13c3['connectedlinename'];this[_0x0d27('0x19')]=_0x5a13c3[_0x0d27('0x19')];this[_0x0d27('0x1a')]=_0x4dea4f[_0x0d27('0x1a')];this[_0x0d27('0x1b')]=_0x4dea4f['callbackuniqueid'];this[_0x0d27('0x1c')]=_0x4dea4f[_0x0d27('0x1c')];this[_0x0d27('0x1d')]=_0x4dea4f[_0x0d27('0x1d')];this['ContactId']=_0x4dea4f['ContactId'];this['ListId']=_0x4dea4f[_0x0d27('0x1e')];this['UserId']=_0x4dea4f[_0x0d27('0x1f')];this['VoiceQueueId']=_0x4dea4f[_0x0d27('0x20')];this[_0x0d27('0x21')]=_0x4dea4f[_0x0d27('0x21')];this[_0x0d27('0x22')]=_0x4dea4f['originatecalleridnum']||'';this[_0x0d27('0x23')]=_0x4dea4f[_0x0d27('0x23')]||'';this['agiafterat']=_0x4dea4f['agiafterat'];this[_0x0d27('0x24')]=_0x4dea4f[_0x0d27('0x24')];this[_0x0d27('0x25')]=_0x4dea4f[_0x0d27('0x25')];}module[_0x0d27('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x0d6d=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','queue','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d6d,0x165));var _0xd0d6=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x0d6d[_0x45d55e];return _0x29812a;};'use strict';var utils=require(_0xd0d6('0x0'));function QueueCallerAbandon(_0x1dba72,_0x3274d8){this[_0xd0d6('0x1')]=_0x1dba72[_0xd0d6('0x1')];this[_0xd0d6('0x2')]=_0x1dba72[_0xd0d6('0x2')];this[_0xd0d6('0x3')]=_0x1dba72[_0xd0d6('0x2')]===_0xd0d6('0x4')?'queue':_0x1dba72[_0xd0d6('0x2')];this[_0xd0d6('0x5')]=_0x1dba72['countbusyretry'];this[_0xd0d6('0x6')]=_0x1dba72[_0xd0d6('0x6')];this[_0xd0d6('0x7')]=_0x1dba72['countnoanswerretry'];this[_0xd0d6('0x8')]=_0x1dba72['countbusyretry']+_0x1dba72[_0xd0d6('0x6')]+_0x1dba72['countnoanswerretry']+_0x1dba72[_0xd0d6('0x9')]+_0x1dba72[_0xd0d6('0xa')]+_0x1dba72['countabandonedretry']+_0x1dba72[_0xd0d6('0xb')]+_0x1dba72[_0xd0d6('0xc')];this[_0xd0d6('0x9')]=_0x1dba72[_0xd0d6('0x9')];this[_0xd0d6('0xa')]=_0x1dba72[_0xd0d6('0xa')];this[_0xd0d6('0xd')]=_0x1dba72['countabandonedretry'];this['countmachineretry']=_0x1dba72['countmachineretry'];this['countagentrejectretry']=_0x1dba72[_0xd0d6('0xc')];this[_0xd0d6('0xe')]=_0x3274d8['uniqueid'];this['calleridname']=_0x1dba72[_0xd0d6('0xf')];this['calleridnum']=_0x1dba72[_0xd0d6('0x10')];this[_0xd0d6('0x11')]=_0x1dba72['starttime'];this[_0xd0d6('0x12')]=_0x1dba72[_0xd0d6('0x12')];this[_0xd0d6('0x13')]=_0x1dba72[_0xd0d6('0x13')];this['dropreason']=_0x1dba72[_0xd0d6('0x14')];this[_0xd0d6('0x15')]=this[_0xd0d6('0x13')];this[_0xd0d6('0x16')]=utils['getSeconds'](_0x1dba72[_0xd0d6('0x12')],_0x1dba72['starttime']);this[_0xd0d6('0x17')]=utils[_0xd0d6('0x18')](this[_0xd0d6('0x13')],_0x1dba72[_0xd0d6('0x12')]);this['talktime']=0x0;this[_0xd0d6('0x19')]=_0x3274d8[_0xd0d6('0x19')];this['membername']=_0x3274d8['connectedlinename'];this[_0xd0d6('0x1a')]=_0x3274d8[_0xd0d6('0x1a')];this['callback']=_0x1dba72['callback'];this[_0xd0d6('0x1b')]=_0x1dba72[_0xd0d6('0x1b')];this[_0xd0d6('0x1c')]=_0x1dba72[_0xd0d6('0x1c')];this[_0xd0d6('0x1d')]=_0x1dba72[_0xd0d6('0x1d')];this[_0xd0d6('0x1e')]=_0x1dba72['ContactId'];this[_0xd0d6('0x1f')]=_0x1dba72[_0xd0d6('0x1f')];this[_0xd0d6('0x20')]=_0x1dba72[_0xd0d6('0x20')];this['VoiceQueueId']=_0x1dba72[_0xd0d6('0x21')];this[_0xd0d6('0x22')]=_0x1dba72[_0xd0d6('0x22')];this[_0xd0d6('0x23')]=_0x1dba72[_0xd0d6('0x23')]||'';this['originatecalleridname']=_0x1dba72['originatecalleridname']||'';this[_0xd0d6('0x24')]=_0x1dba72['agiafterat'];this['state']=_0x1dba72[_0xd0d6('0x25')];this[_0xd0d6('0x26')]=_0x1dba72['statedesc'];}module[_0xd0d6('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1c5cd3c..8cfce70 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5430=['[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer'];(function(_0x16d1ff,_0x435914){var _0x386a8c=function(_0x30f70d){while(--_0x30f70d){_0x16d1ff['push'](_0x16d1ff['shift']());}};_0x386a8c(++_0x435914);}(_0x5430,0x10c));var _0x0543=function(_0x38d50f,_0x3705ab){_0x38d50f=_0x38d50f-0x0;var _0x19c03c=_0x5430[_0x38d50f];return _0x19c03c;};'use strict';var util=require(_0x0543('0x0'));var logger=require(_0x0543('0x1'))(_0x0543('0x2'));var cmHopper=require(_0x0543('0x3'));var cmHopperAdditionalPhone=require(_0x0543('0x4'));var cmHopperBlack=require(_0x0543('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5b122c){return util[_0x0543('0x6')](_0x5b122c,{'showHidden':![],'depth':null});}function getContactDialer(_0x4ee416,_0x523f3d,_0xce0b65){return cmHopper[_0x0543('0x7')](_0x4ee416['id'],_0x523f3d,_0xce0b65,_0x4ee416[_0x0543('0x8')])[_0x0543('0x9')](function(_0x46bca7){_0x4ee416['temp']=0x0;logger[_0x0543('0xa')](_0x0543('0xb'),inspectError(_0x46bca7));});}exports[_0x0543('0x7')]=getContactDialer;function getContactDialerIvr(_0x200eb6,_0x2fb723){return cmHopper[_0x0543('0xc')](_0x200eb6['id'],_0x2fb723,_0x200eb6['dialOrderByScheduledAt'])[_0x0543('0x9')](function(_0x1ac048){_0x200eb6['temp']=0x0;logger[_0x0543('0xa')](_0x0543('0xd'),inspectError(_0x1ac048));});}exports[_0x0543('0xc')]=getContactDialerIvr;function countReScheduled(_0x43b934){return cmHopper[_0x0543('0xe')](_0x43b934)[_0x0543('0x9')](function(_0x30c54e){logger[_0x0543('0xa')](_0x0543('0xf'),inspectError(_0x30c54e));});}exports[_0x0543('0xe')]=countReScheduled;function rescheduleContact(_0x4204db){return cmHopper[_0x0543('0x10')](_0x4204db)['catch'](function(_0x4f1f2a){logger[_0x0543('0xa')]('[rescheduleContact]',inspectError(_0x4f1f2a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0xcb09df,_0x40fb03,_0x1dff7d){return cmHopper[_0x0543('0x11')](_0xcb09df,_0x40fb03,_0x1dff7d)[_0x0543('0x9')](function(_0x50d504){logger[_0x0543('0xa')](_0x0543('0x12'),inspectError(_0x50d504));});}exports[_0x0543('0x11')]=unlockContact;function moveContactManagedDialer(_0x25254e){return cmHopper[_0x0543('0x13')](_0x25254e)[_0x0543('0x9')](function(_0x577cf0){logger['error'](_0x0543('0x14'),inspectError(_0x577cf0));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x50ea84){return cmHopperBlack[_0x0543('0x15')](_0x50ea84)[_0x0543('0x9')](function(_0x1aece5){logger['error'](_0x0543('0x16'),inspectError(_0x1aece5));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x401da5){return cmHopperBlack[_0x0543('0x17')](_0x401da5)['catch'](function(_0x18dd45){logger[_0x0543('0xa')](_0x0543('0x18'),inspectError(_0x18dd45));});}exports[_0x0543('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x37347e,_0xe14f94,_0x4adba7){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x37347e,_0xe14f94,_0x4adba7)['catch'](function(_0xbfe5dc){logger[_0x0543('0xa')](_0x0543('0x19'),inspectError(_0xbfe5dc));});}exports[_0x0543('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2b1425,_0x26e500,_0x36d824){return cmHopperAdditionalPhone[_0x0543('0x1b')](_0x2b1425,_0x26e500,_0x36d824)[_0x0543('0x9')](function(_0xf1eccf){logger[_0x0543('0xa')](_0x0543('0x1c'),inspectError(_0xf1eccf));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x25e6f1){return cmHopperHistory[_0x0543('0x1d')](_0x25e6f1)[_0x0543('0x9')](function(_0x4f2592){logger[_0x0543('0xa')](_0x0543('0x1e'),inspectError(_0x4f2592));});}exports[_0x0543('0x1d')]=avgHandleTime;function createHistory(_0x10b881){return cmHopperHistory['createHistory'](_0x10b881)[_0x0543('0x9')](function(_0x10b9f3){logger['error']('[createHistory]',inspectError(_0x10b9f3));});}exports[_0x0543('0x1f')]=createHistory; \ No newline at end of file +var _0xc4aa=['temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var cmHopper=require(_0xac4a('0x3'));var cmHopperAdditionalPhone=require(_0xac4a('0x4'));var cmHopperBlack=require(_0xac4a('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5cda73){return util['inspect'](_0x5cda73,{'showHidden':![],'depth':null});}function getContactDialer(_0x2f48ed,_0x15b967,_0x730a38){return cmHopper[_0xac4a('0x6')](_0x2f48ed['id'],_0x15b967,_0x730a38,_0x2f48ed[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3ef77c){_0x2f48ed[_0xac4a('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x3ef77c));});}exports[_0xac4a('0x6')]=getContactDialer;function getContactDialerIvr(_0x2a4d53,_0x26ec84){return cmHopper['getContactDialerIvr'](_0x2a4d53['id'],_0x26ec84,_0x2a4d53[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3e64f5){_0x2a4d53['temp']=0x0;logger[_0xac4a('0xa')]('[getContactDialerIvr]',inspectError(_0x3e64f5));});}exports[_0xac4a('0xb')]=getContactDialerIvr;function countReScheduled(_0x4855b6){return cmHopper[_0xac4a('0xc')](_0x4855b6)[_0xac4a('0x8')](function(_0x24291d){logger['error'](_0xac4a('0xd'),inspectError(_0x24291d));});}exports[_0xac4a('0xc')]=countReScheduled;function rescheduleContact(_0x247b78){return cmHopper[_0xac4a('0xe')](_0x247b78)[_0xac4a('0x8')](function(_0x3b71c0){logger[_0xac4a('0xa')](_0xac4a('0xf'),inspectError(_0x3b71c0));});}exports[_0xac4a('0xe')]=rescheduleContact;function unlockContact(_0x42c7fc,_0x11e101,_0x26dbb8){return cmHopper['unlockContact'](_0x42c7fc,_0x11e101,_0x26dbb8)[_0xac4a('0x8')](function(_0x34d797){logger[_0xac4a('0xa')](_0xac4a('0x10'),inspectError(_0x34d797));});}exports[_0xac4a('0x11')]=unlockContact;function moveContactManagedDialer(_0x387a54){return cmHopper[_0xac4a('0x12')](_0x387a54)[_0xac4a('0x8')](function(_0x546c5d){logger['error'](_0xac4a('0x13'),inspectError(_0x546c5d));});}exports[_0xac4a('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x39b691){return cmHopperBlack['checkIsBlackList'](_0x39b691)[_0xac4a('0x8')](function(_0x15c223){logger[_0xac4a('0xa')](_0xac4a('0x14'),inspectError(_0x15c223));});}exports[_0xac4a('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x3e829c){return cmHopperBlack[_0xac4a('0x16')](_0x3e829c)[_0xac4a('0x8')](function(_0x534092){logger[_0xac4a('0xa')](_0xac4a('0x17'),inspectError(_0x534092));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7ce0,_0x4169c0,_0x3eacd3){return cmHopperAdditionalPhone[_0xac4a('0x18')](_0x3d7ce0,_0x4169c0,_0x3eacd3)['catch'](function(_0x1b7998){logger[_0xac4a('0xa')](_0xac4a('0x19'),inspectError(_0x1b7998));});}exports[_0xac4a('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x594f36,_0x2b0dc2,_0x222507){return cmHopperAdditionalPhone[_0xac4a('0x1a')](_0x594f36,_0x2b0dc2,_0x222507)[_0xac4a('0x8')](function(_0x3bc318){logger[_0xac4a('0xa')](_0xac4a('0x1b'),inspectError(_0x3bc318));});}exports[_0xac4a('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x472c57){return cmHopperHistory[_0xac4a('0x1c')](_0x472c57)[_0xac4a('0x8')](function(_0x4e17ce){logger[_0xac4a('0xa')](_0xac4a('0x1d'),inspectError(_0x4e17ce));});}exports[_0xac4a('0x1c')]=avgHandleTime;function createHistory(_0x2772fe){return cmHopperHistory[_0xac4a('0x1e')](_0x2772fe)['catch'](function(_0x47f49c){logger[_0xac4a('0xa')](_0xac4a('0x1f'),inspectError(_0x47f49c));});}exports[_0xac4a('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 0d3d308..77d6501 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9504=['message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','getSeconds'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x9504,0x1d2));var _0x4950=function(_0x7bad1e,_0x5524ca){_0x7bad1e=_0x7bad1e-0x0;var _0x19730b=_0x9504[_0x7bad1e];return _0x19730b;};'use strict';var _=require(_0x4950('0x0'));var moment=require(_0x4950('0x1'));var util=require(_0x4950('0x2'));var logger=require(_0x4950('0x3'))(_0x4950('0x4'));var timezones=require('../../../../config/environment/shared')[_0x4950('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x4950('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x4950('0x7'),'DISACTIVED':_0x4950('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x4950('0x9'),'NO_AGENTS_LOGGED':_0x4950('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x4950('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4950('0xc'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x4950('0xd'),'UNKNOWN_TIMEZONE':_0x4950('0xe'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x4950('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x93255b){return _0x93255b[_0x4950('0x10')]===_0x4950('0x11');}exports[_0x4950('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x5cdfb5){return _0x5cdfb5[_0x4950('0x13')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x47d399){return _0x47d399['type']==='outbound';}exports[_0x4950('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x3d1306){return _0x3d1306[_0x4950('0x15')];}exports[_0x4950('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2337ca){return _0x2337ca[_0x4950('0x17')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x59cb2d,_0x7fb755){var _0x2a8b96=moment(_0x59cb2d)[_0x4950('0x18')](0x0);var _0x395645=moment(_0x7fb755)['milliseconds'](0x0);return _0x2a8b96['diff'](_0x395645,'seconds');}exports[_0x4950('0x19')]=getSeconds;function hasQueueCampaignDataChanged(_0x1d1fd2,_0x53b2f5){var _0x28bed5=![];var _0x27dc9d=_0x1d1fd2[_0x4950('0x10')]!==_0x53b2f5[_0x4950('0x10')]||_0x1d1fd2[_0x4950('0x15')]!==_0x53b2f5[_0x4950('0x15')]||_0x1d1fd2[_0x4950('0x1a')]!==_0x53b2f5[_0x4950('0x1a')];var _0x25ec45=_0x1d1fd2[_0x4950('0x1b')]!==_0x53b2f5[_0x4950('0x1b')]||_0x1d1fd2[_0x4950('0x1c')]!==_0x53b2f5['loggedIn']||_0x1d1fd2[_0x4950('0x1d')]!==_0x53b2f5[_0x4950('0x1d')]||_0x1d1fd2[_0x4950('0x1e')]!==_0x53b2f5[_0x4950('0x1e')]||_0x1d1fd2[_0x4950('0x1f')]!==_0x53b2f5['talking']||_0x1d1fd2['pTalking']!==_0x53b2f5[_0x4950('0x20')]||_0x1d1fd2[_0x4950('0x21')]!==_0x53b2f5[_0x4950('0x21')]||_0x1d1fd2['inUse']!==_0x53b2f5[_0x4950('0x22')]||_0x1d1fd2[_0x4950('0x23')]!==_0x53b2f5['originated'];if(_0x1d1fd2['Trunk']&&_0x53b2f5['Trunk']){_0x28bed5=_0x1d1fd2[_0x4950('0x24')]['name']!==_0x53b2f5[_0x4950('0x24')][_0x4950('0x25')]||_0x1d1fd2['Trunk'][_0x4950('0x17')]!==_0x53b2f5[_0x4950('0x24')][_0x4950('0x17')];}return _0x27dc9d||_0x25ec45||_0x28bed5;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x541452){var _0x51c237=null;var _0x1c0101=_0x541452['dialTimezone'];if(_[_0x4950('0x26')](_0x541452[_0x4950('0x27')])||_[_0x4950('0x26')](_0x541452['Interval'])||_[_0x4950('0x26')](_0x541452[_0x4950('0x28')][_0x4950('0x29')])){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2a')];}else if(_[_0x4950('0x2b')](_0x541452[_0x4950('0x27')])||_[_0x4950('0x2b')](_0x541452['Interval'][_0x4950('0x29')])){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2c')];}else if(_0x1c0101&&!timezones[_0x1c0101]){_0x51c237=CAMPAIGN_STATUS[_0x4950('0x2d')];}return _0x51c237;}function checkAnyValidTrunk(_0x220a4f,_0x3763a8){var _0x4cfa80=null;var _0x47f4c8=_0x4950('0x2e');var _0x4d1d9d=[_0x4950('0x2f'),'unmonitored'];var _0x5dd394=!![];if(_0x220a4f[_0x4950('0x24')]&&_0x220a4f[_0x4950('0x24')][_0x4950('0x17')]){_0x47f4c8+=_0x220a4f[_0x4950('0x24')]['name'];_0x4cfa80=_0x3763a8[_0x47f4c8];_0x5dd394=_0x4d1d9d['includes'](_0x4cfa80[_0x4950('0x30')]);}else if(_0x220a4f[_0x4950('0x31')]&&_0x220a4f[_0x4950('0x31')][_0x4950('0x17')]){_0x47f4c8+=_0x220a4f[_0x4950('0x31')][_0x4950('0x25')];_0x4cfa80=_0x3763a8[_0x47f4c8];_0x5dd394=_0x4d1d9d[_0x4950('0x32')](_0x4cfa80[_0x4950('0x30')]);}return _0x5dd394;}function getQueueCampaignStatusMessage(_0xc75a81,_0x29503b){var _0x16eee0=CAMPAIGN_STATUS[_0x4950('0x6')];var _0x40210d=isPreviewCampaign(_0xc75a81);if(!isQueueCampaignActive(_0xc75a81)){if(_0x40210d){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x33')];}else{if(_0xc75a81[_0x4950('0x23')]===0x0&&_0xc75a81[_0x4950('0x1f')]===0x0&&_0xc75a81['waiting']===0x0&&(_0xc75a81[_0x4950('0x20')]||0x0)===0x0){_0x16eee0=CAMPAIGN_STATUS['INACTIVE'];}else{_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x34')];}}}else if(_0xc75a81['loggedIn']===0x0){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x35')];}else if(!checkAnyValidTrunk(_0xc75a81,_0x29503b)){_0x16eee0=CAMPAIGN_STATUS[_0x4950('0x36')];}else if(!isPreviewCampaign(_0xc75a81)){var _0x153114=checkAnyValidQueueCampaignInterval(_0xc75a81);if(_0x153114){_0x16eee0=_0x153114;}}return _0x16eee0;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x12048c){var _0x15d041=CAMPAIGN_STATUS[_0x4950('0x34')];if(_0x12048c[_0x4950('0x23')]===0x0&&_0x12048c[_0x4950('0x1f')]===0x0&&_0x12048c['waiting']===0x0&&(_0x12048c[_0x4950('0x20')]||0x0)===0x0){_0x15d041=CAMPAIGN_STATUS['INACTIVE'];}return _0x15d041;}exports[_0x4950('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2b7b87){var _0x56f5c6=_0x2b7b87[_0x4950('0x38')](/"(.*?)"/);return _0x56f5c6?_0x56f5c6[0x1]:_0x2b7b87;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x249f4b,_0x290f40,_0x98af77){if(!_[_0x4950('0x39')](_0x98af77)&&typeof _0x98af77===_0x4950('0x3a')&&!_[_0x4950('0x2b')](_0x98af77)){if(!_[_0x4950('0x39')](_0x290f40)&&typeof _0x290f40==='string'&&!_[_0x4950('0x2b')](_0x290f40)){return util[_0x4950('0x3b')](_0x4950('0x3c'),_0x290f40,_0x98af77);}return util[_0x4950('0x3b')](_0x4950('0x3c'),_0x98af77,_0x98af77);}if(!_[_0x4950('0x39')](_0x249f4b)&&typeof _0x249f4b===_0x4950('0x3a')&&!_[_0x4950('0x2b')](_0x249f4b)){return _0x249f4b;}return _0x4950('0x3d');}exports[_0x4950('0x3e')]=getCallerId;function getCallerIdRandom(_0x1983ac,_0x518a8b){var _0x16f606;var _0x1d15bc;var _0x18ae29;if(_0x518a8b<=0x0){_0x518a8b=0x1;}_0x16f606=new RegExp(_0x4950('0x3f')+_0x518a8b+'}$');_0x1d15bc=Math[_0x4950('0x40')](0xa,_0x518a8b-0x1);_0x18ae29=Math[_0x4950('0x40')](0xa,_0x518a8b)-0x1;return util[_0x4950('0x3b')]('%s',_[_0x4950('0x41')](_0x1983ac,_0x16f606,_[_0x4950('0x42')](_0x1d15bc,_0x18ae29)[_0x4950('0x43')]()));}exports[_0x4950('0x44')]=getCallerIdRandom;function decrementOriginate(_0xaa8dfb){if(_0xaa8dfb['originated']&&_0xaa8dfb[_0x4950('0x23')]>0x0){_0xaa8dfb['originated']-=0x1;}else{logger[_0x4950('0x45')](_0x4950('0x46'));}}exports[_0x4950('0x47')]=decrementOriginate;function checkContactEmpty(_0xc5d3b){return _0xc5d3b&&_0xc5d3b[_0x4950('0x48')]>0x0;}exports[_0x4950('0x49')]=checkContactEmpty;function erlangb(_0x4943a0,_0x271384){if(_0x271384===0x0){return 0x0;}var _0x59b2b8=0x1;for(var _0x55cad1=0x1;_0x55cad1<=_0x271384;_0x55cad1+=0x1){_0x59b2b8=0x1+_0x59b2b8*_0x55cad1/_0x4943a0;}return 0x1/_0x59b2b8;}exports[_0x4950('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x22d208,_0xd0b97f,_0x563ed2){if(_0xd0b97f>_0x563ed2){for(var _0xaf0093=0x0;_0xaf0093<_0xd0b97f-_0x563ed2;_0xaf0093+=0x1){decrementOriginate(_0x22d208);}}}exports[_0x4950('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xeb816c){var _0x1beef1={};var _0x5d93fc=['id',_0x4950('0x4c'),_0x4950('0x4d'),'updatedAt'];const _0xfc2c3f=0xfa;if(_0xeb816c){for(var _0x25936b in _0xeb816c){if(typeof _0xeb816c[_0x25936b]!==_0x4950('0x4e')){if(!_[_0x4950('0x26')](_0xeb816c[_0x25936b])&&!_0x5d93fc[_0x4950('0x32')](_0x25936b)){if(_0x25936b===_0x4950('0x4f')&&_0xeb816c[_0x25936b][_0x4950('0x48')]>_0xfc2c3f){_0x1beef1['XMD-'+_0x25936b[_0x4950('0x50')]()]=_0xeb816c[_0x25936b][_0x4950('0x43')]()['substring'](0x0,_0xfc2c3f);}else{_0x1beef1['XMD-'+_0x25936b['toUpperCase']()]=_0xeb816c[_0x25936b];}}}}}return _0x1beef1;}exports[_0x4950('0x51')]=setXMDContactVariables; \ No newline at end of file +var _0x0d00=['toUpperCase','XMD-','setXMDContactVariables','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','description','length'];(function(_0x28add2,_0x6f540a){var _0x3c15c2=function(_0x5a7463){while(--_0x5a7463){_0x28add2['push'](_0x28add2['shift']());}};_0x3c15c2(++_0x6f540a);}(_0x0d00,0x1ca));var _0x00d0=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x0d00[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require('lodash');var moment=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var timezones=require('../../../../config/environment/shared')[_0x00d0('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x00d0('0x5'),'BLACKLIST':_0x00d0('0x6'),'CONTACTS_RESCHEDULED':_0x00d0('0x7'),'DEACTIVATED':_0x00d0('0x8'),'DISACTIVED':_0x00d0('0x9'),'EMPTY_INTERVAL':_0x00d0('0xa'),'INACTIVE':_0x00d0('0xb'),'NO_AGENTS_LOGGED':_0x00d0('0xc'),'NO_AVAILABLE_CONTACTS':_0x00d0('0xd'),'NULL_INTERVAL':_0x00d0('0xe'),'OVERTIME_INTERVAL':_0x00d0('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x00d0('0x10'),'QUEUE_RECALL':_0x00d0('0x11'),'RECALL_TIMEOUT':_0x00d0('0x12'),'RUNNING':_0x00d0('0x13'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x00d0('0x14')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x36ad5b){return _0x36ad5b['dialMethod']===_0x00d0('0x15');}exports[_0x00d0('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x4f9bbe){return _0x4f9bbe[_0x00d0('0x17')]===_0x00d0('0x18');}exports[_0x00d0('0x19')]=isIVRCampaign;function isOutboundQueue(_0x52be43){return _0x52be43[_0x00d0('0x17')]===_0x00d0('0x1a');}exports[_0x00d0('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x3f85ac){return _0x3f85ac[_0x00d0('0x1c')];}exports[_0x00d0('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4767fa){return _0x4767fa[_0x00d0('0x1e')];}exports[_0x00d0('0x1f')]=isIVRCampaignActive;function getSeconds(_0x57e0c7,_0x5b686a){var _0x5bf87f=moment(_0x57e0c7)['milliseconds'](0x0);var _0x53d0fb=moment(_0x5b686a)[_0x00d0('0x20')](0x0);return _0x5bf87f[_0x00d0('0x21')](_0x53d0fb,_0x00d0('0x22'));}exports[_0x00d0('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x24980a,_0x5846ac){var _0x54bb26=![];var _0x256f7b=_0x24980a['dialMethod']!==_0x5846ac[_0x00d0('0x24')]||_0x24980a[_0x00d0('0x1c')]!==_0x5846ac[_0x00d0('0x1c')]||_0x24980a[_0x00d0('0x25')]!==_0x5846ac[_0x00d0('0x25')];var _0x547ccd=_0x24980a[_0x00d0('0x26')]!==_0x5846ac[_0x00d0('0x26')]||_0x24980a[_0x00d0('0x27')]!==_0x5846ac['loggedIn']||_0x24980a[_0x00d0('0x28')]!==_0x5846ac[_0x00d0('0x28')]||_0x24980a[_0x00d0('0x29')]!==_0x5846ac['paused']||_0x24980a['talking']!==_0x5846ac[_0x00d0('0x2a')]||_0x24980a['pTalking']!==_0x5846ac[_0x00d0('0x2b')]||_0x24980a['waiting']!==_0x5846ac[_0x00d0('0x2c')]||_0x24980a[_0x00d0('0x2d')]!==_0x5846ac[_0x00d0('0x2d')]||_0x24980a[_0x00d0('0x2e')]!==_0x5846ac[_0x00d0('0x2e')];if(_0x24980a['Trunk']&&_0x5846ac[_0x00d0('0x2f')]){_0x54bb26=_0x24980a[_0x00d0('0x2f')][_0x00d0('0x30')]!==_0x5846ac[_0x00d0('0x2f')][_0x00d0('0x30')]||_0x24980a[_0x00d0('0x2f')][_0x00d0('0x1e')]!==_0x5846ac[_0x00d0('0x2f')][_0x00d0('0x1e')];}return _0x256f7b||_0x547ccd||_0x54bb26;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x27677e){var _0x2c8c16=null;var _0x3e0cc4=_0x27677e['dialTimezone'];if(_[_0x00d0('0x31')](_0x27677e[_0x00d0('0x32')])||_['isNil'](_0x27677e['Interval'])||_[_0x00d0('0x31')](_0x27677e[_0x00d0('0x33')]['Intervals'])){_0x2c8c16=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x00d0('0x34')](_0x27677e['dialGlobalInterval'])||_['isEmpty'](_0x27677e['Interval'][_0x00d0('0x35')])){_0x2c8c16=CAMPAIGN_STATUS[_0x00d0('0x36')];}else if(_0x3e0cc4&&!timezones[_0x3e0cc4]){_0x2c8c16=CAMPAIGN_STATUS[_0x00d0('0x37')];}return _0x2c8c16;}function checkAnyValidTrunk(_0x3e9e48,_0x5f4e8a){var _0x445c56=null;var _0x52e65e=_0x00d0('0x38');var _0x28f7bc=[_0x00d0('0x39'),_0x00d0('0x3a')];var _0x3715f8=!![];if(_0x3e9e48['Trunk']&&_0x3e9e48[_0x00d0('0x2f')][_0x00d0('0x1e')]){_0x52e65e+=_0x3e9e48[_0x00d0('0x2f')][_0x00d0('0x30')];_0x445c56=_0x5f4e8a[_0x52e65e];_0x3715f8=_0x28f7bc[_0x00d0('0x3b')](_0x445c56['status']);}else if(_0x3e9e48[_0x00d0('0x3c')]&&_0x3e9e48[_0x00d0('0x3c')][_0x00d0('0x1e')]){_0x52e65e+=_0x3e9e48[_0x00d0('0x3c')][_0x00d0('0x30')];_0x445c56=_0x5f4e8a[_0x52e65e];_0x3715f8=_0x28f7bc[_0x00d0('0x3b')](_0x445c56['status']);}return _0x3715f8;}function getQueueCampaignStatusMessage(_0x31f799,_0x59f212){var _0x232e59=CAMPAIGN_STATUS[_0x00d0('0x5')];var _0x805d87=isPreviewCampaign(_0x31f799);if(!isQueueCampaignActive(_0x31f799)){if(_0x805d87){_0x232e59=CAMPAIGN_STATUS[_0x00d0('0x3d')];}else{if(_0x31f799[_0x00d0('0x2e')]===0x0&&_0x31f799['talking']===0x0&&_0x31f799[_0x00d0('0x2c')]===0x0&&(_0x31f799[_0x00d0('0x2b')]||0x0)===0x0){_0x232e59=CAMPAIGN_STATUS[_0x00d0('0x3d')];}else{_0x232e59=CAMPAIGN_STATUS[_0x00d0('0x3e')];}}}else if(_0x31f799[_0x00d0('0x27')]===0x0){_0x232e59=CAMPAIGN_STATUS[_0x00d0('0x3f')];}else if(!checkAnyValidTrunk(_0x31f799,_0x59f212)){_0x232e59=CAMPAIGN_STATUS[_0x00d0('0x40')];}else if(!isPreviewCampaign(_0x31f799)){var _0x48d0f7=checkAnyValidQueueCampaignInterval(_0x31f799);if(_0x48d0f7){_0x232e59=_0x48d0f7;}}return _0x232e59;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x25a390){var _0x5e1673=CAMPAIGN_STATUS['DISACTIVED'];if(_0x25a390['originated']===0x0&&_0x25a390[_0x00d0('0x2a')]===0x0&&_0x25a390[_0x00d0('0x2c')]===0x0&&(_0x25a390[_0x00d0('0x2b')]||0x0)===0x0){_0x5e1673=CAMPAIGN_STATUS[_0x00d0('0x3d')];}return _0x5e1673;}exports[_0x00d0('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x104c4d){var _0x40e50a=_0x104c4d['match'](/"(.*?)"/);return _0x40e50a?_0x40e50a[0x1]:_0x104c4d;}exports[_0x00d0('0x42')]=extractCalleridName;function getCallerId(_0x34a575,_0x52ec0a,_0x57d700){if(!_[_0x00d0('0x43')](_0x57d700)&&typeof _0x57d700==='string'&&!_['isEmpty'](_0x57d700)){if(!_[_0x00d0('0x43')](_0x52ec0a)&&typeof _0x52ec0a===_0x00d0('0x44')&&!_[_0x00d0('0x34')](_0x52ec0a)){return util[_0x00d0('0x45')](_0x00d0('0x46'),_0x52ec0a,_0x57d700);}return util[_0x00d0('0x45')](_0x00d0('0x46'),_0x57d700,_0x57d700);}if(!_[_0x00d0('0x43')](_0x34a575)&&typeof _0x34a575===_0x00d0('0x44')&&!_[_0x00d0('0x34')](_0x34a575)){return _0x34a575;}return'\x22\x22\x20<>';}exports[_0x00d0('0x47')]=getCallerId;function getCallerIdRandom(_0x3efb9f,_0x3eb336){var _0xf38e44;var _0x58a45b;var _0x14f4c1;if(_0x3eb336<=0x0){_0x3eb336=0x1;}_0xf38e44=new RegExp(_0x00d0('0x48')+_0x3eb336+'}$');_0x58a45b=Math[_0x00d0('0x49')](0xa,_0x3eb336-0x1);_0x14f4c1=Math[_0x00d0('0x49')](0xa,_0x3eb336)-0x1;return util[_0x00d0('0x45')]('%s',_[_0x00d0('0x4a')](_0x3efb9f,_0xf38e44,_[_0x00d0('0x4b')](_0x58a45b,_0x14f4c1)[_0x00d0('0x4c')]()));}exports[_0x00d0('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x199293){if(_0x199293[_0x00d0('0x2e')]&&_0x199293[_0x00d0('0x2e')]>0x0){_0x199293[_0x00d0('0x2e')]-=0x1;}else{logger[_0x00d0('0x4e')](_0x00d0('0x4f'));}}exports[_0x00d0('0x50')]=decrementOriginate;function checkContactEmpty(_0x2e5fb2){return _0x2e5fb2&&_0x2e5fb2['length']>0x0;}exports[_0x00d0('0x51')]=checkContactEmpty;function erlangb(_0xf43a21,_0x60db70){if(_0x60db70===0x0){return 0x0;}var _0x1852c3=0x1;for(var _0x7500f7=0x1;_0x7500f7<=_0x60db70;_0x7500f7+=0x1){_0x1852c3=0x1+_0x1852c3*_0x7500f7/_0xf43a21;}return 0x1/_0x1852c3;}exports[_0x00d0('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x417c71,_0x4ce2a6,_0x457cb3){if(_0x4ce2a6>_0x457cb3){for(var _0x5252c8=0x0;_0x5252c8<_0x4ce2a6-_0x457cb3;_0x5252c8+=0x1){decrementOriginate(_0x417c71);}}}exports[_0x00d0('0x53')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1a40ff){var _0x1ca15e={};var _0x163bfb=['id',_0x00d0('0x54'),'tags',_0x00d0('0x55')];const _0x4eff67=0xfa;if(_0x1a40ff){for(var _0x5e8b28 in _0x1a40ff){if(typeof _0x1a40ff[_0x5e8b28]!=='undefined'){if(!_[_0x00d0('0x31')](_0x1a40ff[_0x5e8b28])&&!_0x163bfb['includes'](_0x5e8b28)){if(_0x5e8b28===_0x00d0('0x56')&&_0x1a40ff[_0x5e8b28][_0x00d0('0x57')]>_0x4eff67){_0x1ca15e['XMD-'+_0x5e8b28[_0x00d0('0x58')]()]=_0x1a40ff[_0x5e8b28][_0x00d0('0x4c')]()['substring'](0x0,_0x4eff67);}else{_0x1ca15e[_0x00d0('0x59')+_0x5e8b28[_0x00d0('0x58')]()]=_0x1a40ff[_0x5e8b28];}}}}}return _0x1ca15e;}exports[_0x00d0('0x5a')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 359aaad..b9fb89e 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5d2918,_0x3189a0){var _0x319ea0=function(_0x111ca2){while(--_0x111ca2){_0x5d2918['push'](_0x5d2918['shift']());}};_0x319ea0(++_0x3189a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5b9c15,_0x19308f){var _0x4cbff=function(_0x337e78){while(--_0x337e78){_0x5b9c15['push'](_0x5b9c15['shift']());}};_0x4cbff(++_0x19308f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index bf93e4a..3047293 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 _0x740d=['../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','prototype','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','format','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action'];(function(_0x34ec60,_0x443acc){var _0x409bea=function(_0x54ab89){while(--_0x54ab89){_0x34ec60['push'](_0x34ec60['shift']());}};_0x409bea(++_0x443acc);}(_0x740d,0x1dc));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xd740('0x0'));var _=require(_0xd740('0x1'));var BPromise=require(_0xd740('0x2'));var uuid=require('uuid');var moment=require(_0xd740('0x3'));var path=require(_0xd740('0x4'));var tiff2pdf=require(_0xd740('0x5'));var gs=require(_0xd740('0x6'));var logger=require(_0xd740('0x7'))(_0xd740('0x8'));var ami=require(_0xd740('0x9'));var rpcDb=require(_0xd740('0xa'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xd740('0xb'));var faxAccount=require(_0xd740('0xc'));var attachment=require(_0xd740('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x19f942){this[_0xd740('0xe')]={};this[_0xd740('0xf')]=_0x19f942['faxAccounts'];this[_0xd740('0x10')]=_0x19f942[_0xd740('0x10')];this['actions']={};ami['on'](_0xd740('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0xd740('0x12'),this[_0xd740('0x13')][_0xd740('0x14')](this));ami['on'](_0xd740('0x15'),this[_0xd740('0x16')][_0xd740('0x14')](this));ami['on'](_0xd740('0x17'),this[_0xd740('0x18')][_0xd740('0x14')](this));ami['on'](_0xd740('0x19'),this[_0xd740('0x1a')]['bind'](this));ami['on']('receivefax',this[_0xd740('0x1b')][_0xd740('0x14')](this));ami['on'](_0xd740('0x1c'),this[_0xd740('0x1d')][_0xd740('0x14')](this));ami['on'](_0xd740('0x1e'),this['syncOriginateResponse'][_0xd740('0x14')](this));}Fax['prototype'][_0xd740('0x1f')]=function(_0x3b8bde){if(_0x3b8bde[_0xd740('0x20')]===_0xd740('0x21')){for(var _0x3cb45e in this['faxAccounts']){if(this[_0xd740('0xf')][_0xd740('0x22')](_0x3cb45e)){if(_0x3b8bde[_0xd740('0x23')]===this[_0xd740('0xf')][_0x3cb45e][_0xd740('0x24')]){this['channels'][_0x3b8bde[_0xd740('0x25')]]={};this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['channel']=_0x3b8bde[_0xd740('0x26')];this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['id']=this[_0xd740('0xf')][_0x3cb45e]['id'];this['channels'][_0x3b8bde[_0xd740('0x25')]][_0xd740('0x27')]=this[_0xd740('0xf')][_0x3cb45e][_0xd740('0x27')];logger[_0xd740('0x28')](_0x3b8bde[_0xd740('0x25')],_0xd740('0x29'));}}}}if(this[_0xd740('0x2a')][_0x3b8bde[_0xd740('0x25')]]){this[_0xd740('0xe')][_0x3b8bde['uniqueid']]={};this[_0xd740('0xe')][_0x3b8bde[_0xd740('0x25')]]['channel']=_0x3b8bde[_0xd740('0x26')];logger[_0xd740('0x28')](_0x3b8bde[_0xd740('0x25')],_0xd740('0x29'));}};Fax['prototype'][_0xd740('0x13')]=function(_0x1fc31b){if(this[_0xd740('0xe')][_0x1fc31b[_0xd740('0x25')]]){for(var _0x5432ee in _0x1fc31b[_0xd740('0x2b')]){if(_0x1fc31b[_0xd740('0x2b')]['hasOwnProperty'](_0x5432ee)){this[_0xd740('0xe')][_0x1fc31b['uniqueid']][_0x5432ee]=_0x1fc31b['value'];}}}};Fax[_0xd740('0x2c')][_0xd740('0x16')]=function(_0x3f02d5){if(this[_0xd740('0xe')][_0x3f02d5['uniqueid']]){this[_0xd740('0xe')][_0x3f02d5[_0xd740('0x25')]][_0xd740('0x2d')]=_0x3f02d5[_0xd740('0x2d')];this[_0xd740('0xe')][_0x3f02d5[_0xd740('0x25')]][_0xd740('0x2e')]=_0x3f02d5[_0xd740('0x2e')];}};Fax[_0xd740('0x2c')][_0xd740('0x18')]=function(_0x38eeb0){if(this['channels'][_0x38eeb0[_0xd740('0x25')]]){for(var _0x20a67b in _0x38eeb0[_0xd740('0x2b')]){if(_0x38eeb0[_0xd740('0x2b')][_0xd740('0x22')](_0x20a67b)){this[_0xd740('0xe')][_0x38eeb0[_0xd740('0x25')]][_0x20a67b]=_0x38eeb0[_0xd740('0x2f')];}}}};Fax[_0xd740('0x2c')][_0xd740('0x1a')]=function(_0x425599){if(this[_0xd740('0xe')][_0x425599['uniqueid']]){this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]]['operation']=_0x425599[_0xd740('0x30')];this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]][_0xd740('0x31')]=_0x425599[_0xd740('0x31')];this[_0xd740('0xe')][_0x425599[_0xd740('0x25')]][_0xd740('0x24')]=_0x425599[_0xd740('0x24')];this['channels'][_0x425599['uniqueid']][_0xd740('0x32')]=_0x425599['filename'];logger[_0xd740('0x28')](_0x425599[_0xd740('0x25')],_0xd740('0x33'));}};Fax[_0xd740('0x2c')][_0xd740('0x1b')]=function(_0x2a7c1b){var _0x3db71b=this;if(this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]){var _0x12e1e3=this['channels'][_0x2a7c1b[_0xd740('0x25')]]['id'];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x34')]=_0x2a7c1b[_0xd740('0x34')];this[_0xd740('0xe')][_0x2a7c1b['uniqueid']][_0xd740('0x35')]=_0x2a7c1b[_0xd740('0x35')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['localstationid']=_0x2a7c1b[_0xd740('0x24')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['resolution']=_0x2a7c1b['resolution'];this['channels'][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x36')]=_0x2a7c1b[_0xd740('0x36')];this['channels'][_0x2a7c1b[_0xd740('0x25')]][_0xd740('0x32')]=_0x2a7c1b[_0xd740('0x32')];this[_0xd740('0xe')][_0x2a7c1b[_0xd740('0x25')]]['calleridnum']=_0x2a7c1b[_0xd740('0x37')];if(this[_0xd740('0xe')][_0x2a7c1b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2a7c1b[_0xd740('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x4431a4){logger[_0xd740('0x28')](_0x2a7c1b['uniqueid'],_0xd740('0x38'),_0x4431a4[_0xd740('0x39')]);attachment['create']({'name':path[_0xd740('0x3a')](_0x2a7c1b['filename'])[_0xd740('0x27')],'basename':path['parse'](_0x2a7c1b[_0xd740('0x32')])[_0xd740('0x27')]+_0xd740('0x3b'),'type':_0xd740('0x3c')})['then'](function(_0xb64c85){faxAccount[_0xd740('0x3d')](_0x12e1e3,{'from':_0x2a7c1b[_0xd740('0x37')],'mapKey':'fax','body':path[_0xd740('0x3a')](_0x2a7c1b[_0xd740('0x32')])[_0xd740('0x27')]+_0xd740('0x3b'),'AttachmentId':_0xb64c85['id']})['catch'](function(_0x3b2393){logger[_0xd740('0x3e')](_0x2a7c1b[_0xd740('0x25')],_0xd740('0x3f'),JSON[_0xd740('0x40')](_0x3b2393));});})[_0xd740('0x41')](function(_0x181404){logger[_0xd740('0x3e')](_0x2a7c1b[_0xd740('0x25')],_0xd740('0x42'),JSON[_0xd740('0x40')](_0x181404));});});}logger[_0xd740('0x28')](_0x2a7c1b['uniqueid'],_0xd740('0x42'));}};Fax[_0xd740('0x2c')][_0xd740('0x43')]=function(_0x239837){if(this[_0xd740('0x2a')][_0x239837[_0xd740('0x25')]]){_[_0xd740('0x44')](this['channels'][_0x239837[_0xd740('0x25')]],_[_0xd740('0x45')](_0x239837,[_0xd740('0x46'),_0xd740('0x47')]));}};function updateStatus(_0xf15154){if(_0xf15154[_0xd740('0x48')]){faxMessage[_0xd740('0x49')](_0xf15154[_0xd740('0x48')],{'failMessage':_0xd740('0x4a')})[_0xd740('0x4b')](function(_0x2ebd90){ut['logger'](_0xd740('0x4c'),_0x2ebd90);})['catch'](function(_0x1a5e9d){ut[_0xd740('0x4d')](_0xd740('0x4e'),_0x1a5e9d);});}else{ut[_0xd740('0x4d')](_0xd740('0x4f'));}}Fax[_0xd740('0x2c')][_0xd740('0x50')]=function(_0x377b1d,_0x2f4ef8,_0x1b484f){var _0x5ad062=this;var _0x3180bb={};if(_0x2f4ef8){_0x3180bb={'read':_0x2f4ef8};}else{_0x3180bb={'failMessage':_0x1b484f};}if(this[_0xd740('0x2a')][_0x377b1d][_0xd740('0x48')]){faxMessage[_0xd740('0x49')](this[_0xd740('0x2a')][_0x377b1d][_0xd740('0x48')],_0x3180bb)[_0xd740('0x4b')](function(_0x4af9f5){ut[_0xd740('0x4d')](_0xd740('0x51'),_0x4af9f5);})['catch'](function(_0x20e99a){ut['logger'](_0xd740('0x52'),_0x20e99a);})[_0xd740('0x53')](function(){delete _0x5ad062[_0xd740('0xe')][_0x377b1d];delete _0x5ad062[_0xd740('0x2a')][_0x377b1d];});}else{ut[_0xd740('0x4d')](_0xd740('0x54'));delete this[_0xd740('0xe')][_0x377b1d];delete this['actions'][_0x377b1d];}};Fax['prototype']['syncHangup']=function(_0x50ab54){var _0x143f74=this;if(this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]]){if(this['actions'][_0x50ab54['uniqueid']]){this['channels'][_0x50ab54[_0xd740('0x25')]]['id']=this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]['id'];this['channels'][_0x50ab54['uniqueid']]['name']=this[_0xd740('0x2a')][_0x50ab54['uniqueid']][_0xd740('0x27')];}logger[_0xd740('0x28')](_0x50ab54[_0xd740('0x25')],this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]?_0xd740('0x55'):_0xd740('0x56'),JSON[_0xd740('0x40')](this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]]));if(this[_0xd740('0x2a')][_0x50ab54[_0xd740('0x25')]]){if(this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x57')]>0x0&&this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x19')]==='SUCCESS'){this[_0xd740('0x50')](_0x50ab54[_0xd740('0x25')],!![]);}else{this[_0xd740('0x50')](_0x50ab54[_0xd740('0x25')],![],this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x58')]?_0xd740('0x59')+this[_0xd740('0xe')][_0x50ab54[_0xd740('0x25')]][_0xd740('0x58')]:_0xd740('0x5a'));}}}};Fax[_0xd740('0x2c')][_0xd740('0x5b')]=function(_0x3b1f94){var _0x5d57c8=this;return new BPromise(function(_0x23e6a0,_0x271487){_0x5d57c8[_0xd740('0x5c')](_0x3b1f94,_0x5d57c8[_0xd740('0xf')][_0x3b1f94[_0xd740('0x5d')]])[_0xd740('0x4b')](function(_0x13e54c){ut[_0xd740('0x4d')]('[Fax][execOriginate][success]',_0x13e54c);_0x23e6a0(ut[_0xd740('0x39')]('Fax\x20received'));})[_0xd740('0x41')](function(_0x52fb58){ut['logger']('[Fax][execOriginate][failure]',_0x52fb58);updateStatus(_0x3b1f94);_0x271487(ut['message'](_0xd740('0x5e')));});});};Fax['prototype'][_0xd740('0x5f')]=function(_0x113c46){var _0x46c86c=this;return new BPromise(function(_0x2b6807,_0x148e11){var _0x33dc51=_0x46c86c[_0xd740('0x60')](_0x46c86c[_0xd740('0xf')][_0x113c46[_0xd740('0x5d')]][_0xd740('0x61')],_0x113c46);if(_0x33dc51['isValid']){_0x2b6807(ut[_0xd740('0x39')](_0xd740('0x62')));}else{_0x148e11(ut[_0xd740('0x39')](_0x33dc51[_0xd740('0x39')]));}});};function originate(_0x13a679,_0x341267,_0x4470b8){return new BPromise(function(_0x65f26f,_0xb29e8a){if(_0x4470b8){var _0x11f8c1=util['format'](_0xd740('0x63'),path[_0xd740('0x3a')](_0x13a679['path'])[_0xd740('0x27')],_0x13a679['path']);gs['execute'](_0x11f8c1)[_0xd740('0x4b')](function(){_0x13a679['path']=util['format'](_0xd740('0x64'),path[_0xd740('0x3a')](_0x13a679[_0xd740('0x4')])[_0xd740('0x65')],path[_0xd740('0x3a')](_0x13a679[_0xd740('0x4')])[_0xd740('0x27')]);_0x341267['XMF-PATH']=_0x13a679[_0xd740('0x4')];ut[_0xd740('0x4d')](_0xd740('0x66'),'');ami[_0xd740('0x67')](ut[_0xd740('0x68')](_0x13a679,_0x341267))[_0xd740('0x4b')](function(_0x2c6c17){_0x65f26f(_0x2c6c17);})['catch'](function(_0x2cf779){_0xb29e8a(_0x2cf779);});})[_0xd740('0x41')](function(_0x2829f8){_0xb29e8a(_0x2829f8);});}else{ami[_0xd740('0x67')](ut[_0xd740('0x68')](_0x13a679,_0x341267))[_0xd740('0x4b')](function(_0x2added){_0x65f26f(_0x2added);})[_0xd740('0x41')](function(_0x333ecb){_0xb29e8a(_0x333ecb);});}});}Fax[_0xd740('0x2c')][_0xd740('0x5c')]=function(_0x4a3c45,_0x477312){var _0x516c78=this;return new BPromise(function(_0x12fe74,_0x40ea0d){var _0x5f59ef=uuid['v4']();var _0x3bf22=ut[_0xd740('0x69')](_0x4a3c45,_0x477312);_0x516c78[_0xd740('0x2a')][_0x5f59ef]=new Action(_0x5f59ef,_0x477312,_0x4a3c45);var _0x52af2b=_0x516c78[_0xd740('0x2a')][_0x5f59ef];if(path[_0xd740('0x3a')](_0x4a3c45[_0xd740('0x4')])['ext']==='.pdf'){originate(_0x52af2b,_0x3bf22,!![])[_0xd740('0x4b')](function(_0x1693cd){_0x12fe74(_0x1693cd);})[_0xd740('0x41')](function(_0x4f3947){_0x40ea0d(_0x4f3947);});}else{originate(_0x52af2b,_0x3bf22,![])['then'](function(_0x3220c8){_0x12fe74(_0x3220c8);})[_0xd740('0x41')](function(_0x2685a3){_0x40ea0d(_0x2685a3);});}});};Fax[_0xd740('0x2c')]['isTrunkReachable']=function(_0x1ea946){return!_[_0xd740('0x6a')](_0x1ea946)&&!_[_0xd740('0x6a')](_0x1ea946['name'])&&!_[_0xd740('0x6a')](_0x1ea946[_0xd740('0x6b')])&&_0x1ea946['active']&&!_['isNil'](this[_0xd740('0x10')][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])])&&!_[_0xd740('0x6a')](this['trunks'][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])]['status'])&&(this[_0xd740('0x10')][util[_0xd740('0x6c')](_0xd740('0x6d'),_0x1ea946[_0xd740('0x27')])][_0xd740('0x31')]===_0xd740('0x6e')||this[_0xd740('0x10')][util[_0xd740('0x6c')]('SIP/%s',_0x1ea946[_0xd740('0x27')])][_0xd740('0x31')]===_0xd740('0x6f'));};Fax[_0xd740('0x2c')][_0xd740('0x60')]=function(_0xdf2a65,_0x119e79){if(!this[_0xd740('0x70')](_0xdf2a65)){ut[_0xd740('0x4d')](_0xd740('0x71'),_[_0xd740('0x6a')](_0xdf2a65)?'':_0xdf2a65[_0xd740('0x27')]+_0xd740('0x72'));return{'isValid':![],'message':_0xd740('0x73')};}if(_[_0xd740('0x6a')](_0x119e79[_0xd740('0x8')])){ut[_0xd740('0x4d')](_0xd740('0x74'),JSON[_0xd740('0x40')](_0x119e79));return{'isValid':![],'message':_0xd740('0x75')};}if(_[_0xd740('0x6a')](_0x119e79[_0xd740('0x4')])){ut['logger'](_0xd740('0x76'),JSON[_0xd740('0x40')](_0x119e79));return{'isValid':![],'message':_0xd740('0x77')};}return{'isValid':!![],'message':_0xd740('0x78')};};module[_0xd740('0x79')]=Fax; \ No newline at end of file +var _0xb389=['message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20'];(function(_0xcc47fe,_0x429b15){var _0x17db06=function(_0x14d7de){while(--_0x14d7de){_0xcc47fe['push'](_0xcc47fe['shift']());}};_0x17db06(++_0x429b15);}(_0xb389,0x1a9));var _0x9b38=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xb389[_0x13ac10];return _0x28eda2;};'use strict';var util=require('util');var _=require(_0x9b38('0x0'));var BPromise=require(_0x9b38('0x1'));var uuid=require(_0x9b38('0x2'));var moment=require('moment');var path=require(_0x9b38('0x3'));var tiff2pdf=require(_0x9b38('0x4'));var gs=require(_0x9b38('0x5'));var logger=require('../../../config/logger')(_0x9b38('0x6'));var ami=require(_0x9b38('0x7'));var rpcDb=require(_0x9b38('0x8'));var Channel=require(_0x9b38('0x9'));var ut=require(_0x9b38('0xa'));var Action=require(_0x9b38('0xb'));var faxAccount=require(_0x9b38('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x9b38('0xd'));function Fax(_0x2158b7){this[_0x9b38('0xe')]={};this[_0x9b38('0xf')]=_0x2158b7[_0x9b38('0xf')];this[_0x9b38('0x10')]=_0x2158b7[_0x9b38('0x10')];this[_0x9b38('0x11')]={};ami['on'](_0x9b38('0x12'),this['syncNewchannel'][_0x9b38('0x13')](this));ami['on']('varset',this[_0x9b38('0x14')]['bind'](this));ami['on'](_0x9b38('0x15'),this['syncNewState'][_0x9b38('0x13')](this));ami['on']('newexten',this[_0x9b38('0x16')][_0x9b38('0x13')](this));ami['on'](_0x9b38('0x17'),this[_0x9b38('0x18')]['bind'](this));ami['on'](_0x9b38('0x19'),this[_0x9b38('0x1a')][_0x9b38('0x13')](this));ami['on'](_0x9b38('0x1b'),this[_0x9b38('0x1c')][_0x9b38('0x13')](this));ami['on'](_0x9b38('0x1d'),this[_0x9b38('0x1e')][_0x9b38('0x13')](this));}Fax[_0x9b38('0x1f')][_0x9b38('0x20')]=function(_0x3c288a){if(_0x3c288a[_0x9b38('0x21')]===_0x9b38('0x22')){for(var _0x15d013 in this['faxAccounts']){if(this[_0x9b38('0xf')][_0x9b38('0x23')](_0x15d013)){if(_0x3c288a[_0x9b38('0x24')]===this[_0x9b38('0xf')][_0x15d013][_0x9b38('0x25')]){this[_0x9b38('0xe')][_0x3c288a[_0x9b38('0x26')]]={};this[_0x9b38('0xe')][_0x3c288a[_0x9b38('0x26')]]['channel']=_0x3c288a['channel'];this['channels'][_0x3c288a[_0x9b38('0x26')]]['id']=this[_0x9b38('0xf')][_0x15d013]['id'];this[_0x9b38('0xe')][_0x3c288a[_0x9b38('0x26')]][_0x9b38('0x27')]=this[_0x9b38('0xf')][_0x15d013][_0x9b38('0x27')];logger[_0x9b38('0x28')](_0x3c288a[_0x9b38('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x9b38('0x11')][_0x3c288a[_0x9b38('0x26')]]){this['channels'][_0x3c288a[_0x9b38('0x26')]]={};this[_0x9b38('0xe')][_0x3c288a[_0x9b38('0x26')]]['channel']=_0x3c288a[_0x9b38('0x29')];logger['info'](_0x3c288a[_0x9b38('0x26')],_0x9b38('0x2a'));}};Fax[_0x9b38('0x1f')][_0x9b38('0x14')]=function(_0xa855e5){if(this[_0x9b38('0xe')][_0xa855e5['uniqueid']]){for(var _0x4a0a4a in _0xa855e5['variable']){if(_0xa855e5[_0x9b38('0x2b')][_0x9b38('0x23')](_0x4a0a4a)){this[_0x9b38('0xe')][_0xa855e5[_0x9b38('0x26')]][_0x4a0a4a]=_0xa855e5[_0x9b38('0x2c')];}}}};Fax['prototype'][_0x9b38('0x2d')]=function(_0x2c3ba1){if(this[_0x9b38('0xe')][_0x2c3ba1[_0x9b38('0x26')]]){this[_0x9b38('0xe')][_0x2c3ba1[_0x9b38('0x26')]][_0x9b38('0x2e')]=_0x2c3ba1[_0x9b38('0x2e')];this[_0x9b38('0xe')][_0x2c3ba1[_0x9b38('0x26')]][_0x9b38('0x2f')]=_0x2c3ba1[_0x9b38('0x2f')];}};Fax[_0x9b38('0x1f')][_0x9b38('0x16')]=function(_0x3b95a1){if(this[_0x9b38('0xe')][_0x3b95a1[_0x9b38('0x26')]]){for(var _0x2e2e08 in _0x3b95a1['variable']){if(_0x3b95a1[_0x9b38('0x2b')][_0x9b38('0x23')](_0x2e2e08)){this[_0x9b38('0xe')][_0x3b95a1[_0x9b38('0x26')]][_0x2e2e08]=_0x3b95a1[_0x9b38('0x2c')];}}}};Fax[_0x9b38('0x1f')]['syncFaxStatus']=function(_0x5b7d19){if(this[_0x9b38('0xe')][_0x5b7d19[_0x9b38('0x26')]]){this[_0x9b38('0xe')][_0x5b7d19[_0x9b38('0x26')]]['operation']=_0x5b7d19[_0x9b38('0x30')];this['channels'][_0x5b7d19[_0x9b38('0x26')]][_0x9b38('0x31')]=_0x5b7d19[_0x9b38('0x31')];this['channels'][_0x5b7d19[_0x9b38('0x26')]][_0x9b38('0x25')]=_0x5b7d19[_0x9b38('0x25')];this[_0x9b38('0xe')][_0x5b7d19['uniqueid']][_0x9b38('0x32')]=_0x5b7d19[_0x9b38('0x32')];logger[_0x9b38('0x28')](_0x5b7d19[_0x9b38('0x26')],_0x9b38('0x33'));}};Fax[_0x9b38('0x1f')][_0x9b38('0x1a')]=function(_0x4af1c8){var _0x4b0f99=this;if(this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]]){var _0x12e690=this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]]['id'];this[_0x9b38('0xe')][_0x4af1c8['uniqueid']][_0x9b38('0x34')]=_0x4af1c8[_0x9b38('0x34')];this['channels'][_0x4af1c8[_0x9b38('0x26')]][_0x9b38('0x35')]=_0x4af1c8[_0x9b38('0x35')];this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]]['localstationid']=_0x4af1c8['localstationid'];this[_0x9b38('0xe')][_0x4af1c8['uniqueid']][_0x9b38('0x36')]=_0x4af1c8[_0x9b38('0x36')];this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]][_0x9b38('0x37')]=_0x4af1c8[_0x9b38('0x37')];this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]][_0x9b38('0x32')]=_0x4af1c8[_0x9b38('0x32')];this[_0x9b38('0xe')][_0x4af1c8[_0x9b38('0x26')]][_0x9b38('0x38')]=_0x4af1c8['calleridnum'];if(this['channels'][_0x4af1c8['uniqueid']][_0x9b38('0x35')]>0x0){tiff2pdf(_0x4af1c8[_0x9b38('0x32')],_0x9b38('0x39'),function(_0x37be21){logger['info'](_0x4af1c8['uniqueid'],_0x9b38('0x3a'),_0x37be21[_0x9b38('0x3b')]);attachment[_0x9b38('0x3c')]({'name':path[_0x9b38('0x3d')](_0x4af1c8[_0x9b38('0x32')])['name'],'basename':path[_0x9b38('0x3d')](_0x4af1c8[_0x9b38('0x32')])[_0x9b38('0x27')]+_0x9b38('0x3e'),'type':_0x9b38('0x3f')})[_0x9b38('0x40')](function(_0x13e399){faxAccount[_0x9b38('0x41')](_0x12e690,{'from':_0x4af1c8[_0x9b38('0x38')],'mapKey':_0x9b38('0x6'),'body':path[_0x9b38('0x3d')](_0x4af1c8[_0x9b38('0x32')])['name']+_0x9b38('0x3e'),'AttachmentId':_0x13e399['id']})['catch'](function(_0x3d6987){logger[_0x9b38('0x42')](_0x4af1c8[_0x9b38('0x26')],_0x9b38('0x43'),JSON[_0x9b38('0x44')](_0x3d6987));});})[_0x9b38('0x45')](function(_0x7e324){logger[_0x9b38('0x42')](_0x4af1c8[_0x9b38('0x26')],_0x9b38('0x46'),JSON['stringify'](_0x7e324));});});}logger[_0x9b38('0x28')](_0x4af1c8[_0x9b38('0x26')],_0x9b38('0x46'));}};Fax[_0x9b38('0x1f')]['syncOriginateResponse']=function(_0x142452){if(this['actions'][_0x142452[_0x9b38('0x26')]]){_['merge'](this[_0x9b38('0xe')][_0x142452[_0x9b38('0x26')]],_[_0x9b38('0x47')](_0x142452,[_0x9b38('0x48'),'reason']));}};function updateStatus(_0x4ba4c3){if(_0x4ba4c3[_0x9b38('0x49')]){faxMessage[_0x9b38('0x4a')](_0x4ba4c3[_0x9b38('0x49')],{'failMessage':_0x9b38('0x4b')})[_0x9b38('0x40')](function(_0x1c54e0){ut['logger'](_0x9b38('0x4c'),_0x1c54e0);})[_0x9b38('0x45')](function(_0x5b0fdd){ut[_0x9b38('0x4d')](_0x9b38('0x4e'),_0x5b0fdd);});}else{ut[_0x9b38('0x4d')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x9b38('0x1f')][_0x9b38('0x4f')]=function(_0x2a56c0,_0x1a8c45,_0x231be6){var _0x170011=this;var _0x58d003={};if(_0x1a8c45){_0x58d003={'read':_0x1a8c45};}else{_0x58d003={'failMessage':_0x231be6};}if(this[_0x9b38('0x11')][_0x2a56c0][_0x9b38('0x49')]){faxMessage['update'](this[_0x9b38('0x11')][_0x2a56c0][_0x9b38('0x49')],_0x58d003)[_0x9b38('0x40')](function(_0xec7e13){ut[_0x9b38('0x4d')](_0x9b38('0x50'),_0xec7e13);})[_0x9b38('0x45')](function(_0x5c91e4){ut[_0x9b38('0x4d')]('[Fax][Message][NoUpdate1]',_0x5c91e4);})[_0x9b38('0x51')](function(){delete _0x170011[_0x9b38('0xe')][_0x2a56c0];delete _0x170011[_0x9b38('0x11')][_0x2a56c0];});}else{ut[_0x9b38('0x4d')](_0x9b38('0x52'));delete this[_0x9b38('0xe')][_0x2a56c0];delete this[_0x9b38('0x11')][_0x2a56c0];}};Fax[_0x9b38('0x1f')][_0x9b38('0x1c')]=function(_0x5d7a8b){var _0x575e6a=this;if(this['channels'][_0x5d7a8b['uniqueid']]){if(this['actions'][_0x5d7a8b['uniqueid']]){this[_0x9b38('0xe')][_0x5d7a8b[_0x9b38('0x26')]]['id']=this[_0x9b38('0x11')][_0x5d7a8b['uniqueid']]['id'];this[_0x9b38('0xe')][_0x5d7a8b['uniqueid']]['name']=this[_0x9b38('0x11')][_0x5d7a8b['uniqueid']][_0x9b38('0x27')];}logger[_0x9b38('0x28')](_0x5d7a8b[_0x9b38('0x26')],this[_0x9b38('0x11')][_0x5d7a8b[_0x9b38('0x26')]]?_0x9b38('0x53'):_0x9b38('0x54'),JSON['stringify'](this[_0x9b38('0xe')][_0x5d7a8b['uniqueid']]));if(this[_0x9b38('0x11')][_0x5d7a8b[_0x9b38('0x26')]]){if(this[_0x9b38('0xe')][_0x5d7a8b[_0x9b38('0x26')]][_0x9b38('0x55')]>0x0&&this['channels'][_0x5d7a8b[_0x9b38('0x26')]][_0x9b38('0x17')]===_0x9b38('0x56')){this['updateStatus'](_0x5d7a8b[_0x9b38('0x26')],!![]);}else{this['updateStatus'](_0x5d7a8b[_0x9b38('0x26')],![],this['channels'][_0x5d7a8b[_0x9b38('0x26')]][_0x9b38('0x57')]?_0x9b38('0x58')+this[_0x9b38('0xe')][_0x5d7a8b[_0x9b38('0x26')]][_0x9b38('0x57')]:_0x9b38('0x59'));}}}};Fax[_0x9b38('0x1f')][_0x9b38('0x5a')]=function(_0x229663){var _0x1f29e0=this;return new BPromise(function(_0x1cd0a2,_0x130f2f){_0x1f29e0[_0x9b38('0x5b')](_0x229663,_0x1f29e0[_0x9b38('0xf')][_0x229663[_0x9b38('0x5c')]])['then'](function(_0x2ad36e){ut[_0x9b38('0x4d')](_0x9b38('0x5d'),_0x2ad36e);_0x1cd0a2(ut[_0x9b38('0x3b')]('Fax\x20received'));})[_0x9b38('0x45')](function(_0x43344c){ut[_0x9b38('0x4d')](_0x9b38('0x5e'),_0x43344c);updateStatus(_0x229663);_0x130f2f(ut[_0x9b38('0x3b')](_0x9b38('0x5f')));});});};Fax['prototype'][_0x9b38('0x60')]=function(_0x4103e1){var _0x612f0e=this;return new BPromise(function(_0x2a2684,_0x5f4216){var _0xb32386=_0x612f0e[_0x9b38('0x61')](_0x612f0e['faxAccounts'][_0x4103e1[_0x9b38('0x5c')]]['Trunk'],_0x4103e1);if(_0xb32386['isValid']){_0x2a2684(ut[_0x9b38('0x3b')]('Trunk\x20Reachable'));}else{_0x5f4216(ut[_0x9b38('0x3b')](_0xb32386[_0x9b38('0x3b')]));}});};function originate(_0x4337ab,_0x46441b,_0x438565){return new BPromise(function(_0x4fe7e9,_0x19fe7e){if(_0x438565){var _0x538498=util[_0x9b38('0x62')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x9b38('0x3d')](_0x4337ab[_0x9b38('0x3')])[_0x9b38('0x27')],_0x4337ab[_0x9b38('0x3')]);gs[_0x9b38('0x63')](_0x538498)['then'](function(){_0x4337ab[_0x9b38('0x3')]=util[_0x9b38('0x62')](_0x9b38('0x64'),path[_0x9b38('0x3d')](_0x4337ab[_0x9b38('0x3')])[_0x9b38('0x65')],path[_0x9b38('0x3d')](_0x4337ab['path'])[_0x9b38('0x27')]);_0x46441b['XMF-PATH']=_0x4337ab[_0x9b38('0x3')];ut[_0x9b38('0x4d')](_0x9b38('0x66'),'');ami[_0x9b38('0x67')](ut[_0x9b38('0x68')](_0x4337ab,_0x46441b))[_0x9b38('0x40')](function(_0x17e8d1){_0x4fe7e9(_0x17e8d1);})[_0x9b38('0x45')](function(_0x7105fb){_0x19fe7e(_0x7105fb);});})[_0x9b38('0x45')](function(_0x51285e){_0x19fe7e(_0x51285e);});}else{ami[_0x9b38('0x67')](ut[_0x9b38('0x68')](_0x4337ab,_0x46441b))['then'](function(_0xe522a){_0x4fe7e9(_0xe522a);})[_0x9b38('0x45')](function(_0x4022fa){_0x19fe7e(_0x4022fa);});}});}Fax[_0x9b38('0x1f')][_0x9b38('0x5b')]=function(_0x22d37b,_0x210ab1){var _0x153f6b=this;return new BPromise(function(_0xb12e73,_0x2cf37a){var _0x3d74ec=uuid['v4']();var _0x5d93c4=ut[_0x9b38('0x69')](_0x22d37b,_0x210ab1);_0x153f6b['actions'][_0x3d74ec]=new Action(_0x3d74ec,_0x210ab1,_0x22d37b);var _0x5ea975=_0x153f6b[_0x9b38('0x11')][_0x3d74ec];if(path['parse'](_0x22d37b[_0x9b38('0x3')])[_0x9b38('0x6a')]===_0x9b38('0x3e')){originate(_0x5ea975,_0x5d93c4,!![])[_0x9b38('0x40')](function(_0x57a4b9){_0xb12e73(_0x57a4b9);})['catch'](function(_0x5eecc7){_0x2cf37a(_0x5eecc7);});}else{originate(_0x5ea975,_0x5d93c4,![])[_0x9b38('0x40')](function(_0x578ef6){_0xb12e73(_0x578ef6);})['catch'](function(_0x4a7655){_0x2cf37a(_0x4a7655);});}});};Fax['prototype'][_0x9b38('0x6b')]=function(_0x388d20){return!_[_0x9b38('0x6c')](_0x388d20)&&!_[_0x9b38('0x6c')](_0x388d20[_0x9b38('0x27')])&&!_['isNil'](_0x388d20['active'])&&_0x388d20[_0x9b38('0x6d')]&&!_[_0x9b38('0x6c')](this[_0x9b38('0x10')][util[_0x9b38('0x62')](_0x9b38('0x6e'),_0x388d20[_0x9b38('0x27')])])&&!_[_0x9b38('0x6c')](this[_0x9b38('0x10')][util[_0x9b38('0x62')](_0x9b38('0x6e'),_0x388d20[_0x9b38('0x27')])][_0x9b38('0x31')])&&(this['trunks'][util[_0x9b38('0x62')](_0x9b38('0x6e'),_0x388d20[_0x9b38('0x27')])][_0x9b38('0x31')]===_0x9b38('0x6f')||this[_0x9b38('0x10')][util[_0x9b38('0x62')]('SIP/%s',_0x388d20[_0x9b38('0x27')])][_0x9b38('0x31')]===_0x9b38('0x70'));};Fax[_0x9b38('0x1f')][_0x9b38('0x61')]=function(_0x1e33e7,_0x25eafb){if(!this[_0x9b38('0x6b')](_0x1e33e7)){ut[_0x9b38('0x4d')](_0x9b38('0x71'),_[_0x9b38('0x6c')](_0x1e33e7)?'':_0x1e33e7[_0x9b38('0x27')]+_0x9b38('0x72'));return{'isValid':![],'message':_0x9b38('0x73')};}if(_[_0x9b38('0x6c')](_0x25eafb[_0x9b38('0x6')])){ut[_0x9b38('0x4d')](_0x9b38('0x74'),JSON['stringify'](_0x25eafb));return{'isValid':![],'message':_0x9b38('0x75')};}if(_['isNil'](_0x25eafb['path'])){ut['logger'](_0x9b38('0x76'),JSON['stringify'](_0x25eafb));return{'isValid':![],'message':_0x9b38('0x77')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x9b38('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 59aa3bb..2dedc7a 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 _0xc7ea=['error','notify','then','catch','[Notify]\x20','util','bluebird','lodash','../rpc/faxAccount'];(function(_0x10f0a8,_0x1f624b){var _0xde449=function(_0x3f19c8){while(--_0x3f19c8){_0x10f0a8['push'](_0x10f0a8['shift']());}};_0xde449(++_0x1f624b);}(_0xc7ea,0x83));var _0xac7e=function(_0x3d41b3,_0x40f504){_0x3d41b3=_0x3d41b3-0x0;var _0xbe7c27=_0xc7ea[_0x3d41b3];return _0xbe7c27;};'use strict';var util=require(_0xac7e('0x0'));var BPromise=require(_0xac7e('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xac7e('0x2'));var faxAccount=require(_0xac7e('0x3'));function loggerCatch(_0x1bfdd7){return function(_0x49af4e){logger[_0xac7e('0x4')](_0x1bfdd7,util['inspect'](_0x49af4e,{'showHidden':![],'depth':null}));};}exports[_0xac7e('0x5')]=function(_0x1b3aab,_0x377dc2){return BPromise['resolve']()[_0xac7e('0x6')](faxAccount[_0xac7e('0x5')](_0x1b3aab,_0x377dc2))[_0xac7e('0x7')](loggerCatch(_0xac7e('0x8')));}; \ No newline at end of file +var _0xdb91=['../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird'];(function(_0x8be9fb,_0x2f90d9){var _0x3b41ac=function(_0x369a8f){while(--_0x369a8f){_0x8be9fb['push'](_0x8be9fb['shift']());}};_0x3b41ac(++_0x2f90d9);}(_0xdb91,0x112));var _0x1db9=function(_0x305f32,_0x50b0e6){_0x305f32=_0x305f32-0x0;var _0x3cd787=_0xdb91[_0x305f32];return _0x3cd787;};'use strict';var util=require(_0x1db9('0x0'));var BPromise=require(_0x1db9('0x1'));var logger=require(_0x1db9('0x2'))(_0x1db9('0x3'));var _=require('lodash');var faxAccount=require(_0x1db9('0x4'));function loggerCatch(_0x418392){return function(_0x24b64c){logger[_0x1db9('0x5')](_0x418392,util[_0x1db9('0x6')](_0x24b64c,{'showHidden':![],'depth':null}));};}exports[_0x1db9('0x7')]=function(_0x5c143a,_0xc4a88f){return BPromise[_0x1db9('0x8')]()[_0x1db9('0x9')](faxAccount['notify'](_0x5c143a,_0xc4a88f))[_0x1db9('0xa')](loggerCatch(_0x1db9('0xb')));}; \ 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 defd75f..b4610af 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 _0x519b=['inspect','util','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x1f907d,_0x56b747){var _0xb5cf43=function(_0x39229d){while(--_0x39229d){_0x1f907d['push'](_0x1f907d['shift']());}};_0xb5cf43(++_0x56b747);}(_0x519b,0x1ba));var _0xb519=function(_0x6b8e6,_0x5b5b8d){_0x6b8e6=_0x6b8e6-0x0;var _0x11e8d9=_0x519b[_0x6b8e6];return _0x11e8d9;};'use strict';var util=require(_0xb519('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xb519('0x1'));var exec=require(_0xb519('0x2'))[_0xb519('0x3')];exports[_0xb519('0x4')]=function(_0x366804){return new BPromise(function(_0x110867,_0x56158b){exec(_0x366804,function(_0x25b939,_0x16e6ab,_0x4cf9c6){logger[_0xb519('0x5')](_0xb519('0x6'),_0x16e6ab);if(_0x25b939){logger[_0xb519('0x5')]('Exec\x20gs',_0xb519('0x7'),util[_0xb519('0x8')](_0x25b939,{'showHidden':![],'depth':null}),_0x16e6ab,_0x4cf9c6);_0x56158b(_0x25b939);}_0x110867(_0x16e6ab);});});}; \ No newline at end of file +var _0x9324=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs'];(function(_0x2d49dc,_0x3f7af0){var _0x193c97=function(_0x3e6115){while(--_0x3e6115){_0x2d49dc['push'](_0x2d49dc['shift']());}};_0x193c97(++_0x3f7af0);}(_0x9324,0xca));var _0x4932=function(_0x4d24f5,_0x2b0651){_0x4d24f5=_0x4d24f5-0x0;var _0x517ae3=_0x9324[_0x4d24f5];return _0x517ae3;};'use strict';var util=require(_0x4932('0x0'));var logger=require(_0x4932('0x1'))(_0x4932('0x2'));var BPromise=require(_0x4932('0x3'));var exec=require(_0x4932('0x4'))[_0x4932('0x5')];exports['execute']=function(_0x2ae43b){return new BPromise(function(_0x9db75b,_0x4fafa8){exec(_0x2ae43b,function(_0x1114cf,_0x51850f,_0x15bf93){logger[_0x4932('0x6')](_0x4932('0x7'),_0x51850f);if(_0x1114cf){logger[_0x4932('0x6')](_0x4932('0x7'),_0x4932('0x8'),util[_0x4932('0x9')](_0x1114cf,{'showHidden':![],'depth':null}),_0x51850f,_0x15bf93);_0x4fafa8(_0x1114cf);}_0x9db75b(_0x51850f);});});}; \ 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 5bf75d1..7e580c2 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 _0x8ab7=['from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','modem','faxdetect','localstationid','path','originate','xcally-motion-fax'];(function(_0x30e381,_0x2c462b){var _0x87a3e1=function(_0xc5f0f6){while(--_0xc5f0f6){_0x30e381['push'](_0x30e381['shift']());}};_0x87a3e1(++_0x2c462b);}(_0x8ab7,0x1ba));var _0x78ab=function(_0x5116ac,_0x246237){_0x5116ac=_0x5116ac-0x0;var _0x4ac48f=_0x8ab7[_0x5116ac];return _0x4ac48f;};'use strict';var util=require(_0x78ab('0x0'));var _=require(_0x78ab('0x1'));var moment=require(_0x78ab('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x78ab('0x3')]=function(_0x3e4ebf){return{'message':_0x3e4ebf};};exports[_0x78ab('0x4')]=function(_0x914aeb,_0x3c02d3){logger[_0x78ab('0x5')](_0x914aeb,util[_0x78ab('0x6')](_0x3c02d3,{'showHidden':![],'depth':null}));};exports[_0x78ab('0x7')]=function(_0x33336a,_0x473c83){var _0x1f8fc3={'XMF-ECM':_0x473c83[_0x78ab('0x8')],'XMF-HEADERINFO':_0x473c83[_0x78ab('0x9')],'XMF-MINRATE':_0x473c83['minrate'],'XMF-MAXRATE':_0x473c83['maxrate'],'XMF-MODEM':util[_0x78ab('0xa')](_0x78ab('0xb'),_0x473c83[_0x78ab('0xc')]),'XMF-GATEWAY':_0x473c83['gateway'],'XMF-FAXDETECT':_0x473c83[_0x78ab('0xd')],'XMF-T38TIMEOUT':_0x473c83['t38timeout'],'XMF-LOCALSTATIONID':_0x473c83[_0x78ab('0xe')],'XMF-PATH':_0x33336a[_0x78ab('0xf')]};return _0x1f8fc3;};exports['variablesAction']=function(_0x5f31ef,_0x582d11){return{'actionid':_0x5f31ef['uniqueid'],'action':_0x78ab('0x10'),'channel':_0x5f31ef['channel'],'Exten':_0x78ab('0x11'),'Context':_0x78ab('0x12'),'Priority':'1','callerid':util[_0x78ab('0xa')](_0x78ab('0x13'),_0x5f31ef[_0x78ab('0x9')]?_0x5f31ef[_0x78ab('0x9')]:'',_0x5f31ef['localstationid']),'variable':_0x582d11,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5f31ef['uniqueid']};}; \ No newline at end of file +var _0x590f=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','message','logger','info','addVariables','ecm','headerinfo','minrate','format','gateway','t38timeout'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x590f,0x1ad));var _0xf590=function(_0x597722,_0x22595c){_0x597722=_0x597722-0x0;var _0x3acebf=_0x590f[_0x597722];return _0x3acebf;};'use strict';var util=require(_0xf590('0x0'));var _=require(_0xf590('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports[_0xf590('0x2')]=function(_0x19449f){return{'message':_0x19449f};};exports[_0xf590('0x3')]=function(_0x40521c,_0x5192d0){logger[_0xf590('0x4')](_0x40521c,util['inspect'](_0x5192d0,{'showHidden':![],'depth':null}));};exports[_0xf590('0x5')]=function(_0x40aeff,_0x4497e2){var _0x49db07={'XMF-ECM':_0x4497e2[_0xf590('0x6')],'XMF-HEADERINFO':_0x4497e2[_0xf590('0x7')],'XMF-MINRATE':_0x4497e2[_0xf590('0x8')],'XMF-MAXRATE':_0x4497e2['maxrate'],'XMF-MODEM':util[_0xf590('0x9')]('\x22%s\x22',_0x4497e2['modem']),'XMF-GATEWAY':_0x4497e2[_0xf590('0xa')],'XMF-FAXDETECT':_0x4497e2['faxdetect'],'XMF-T38TIMEOUT':_0x4497e2[_0xf590('0xb')],'XMF-LOCALSTATIONID':_0x4497e2[_0xf590('0xc')],'XMF-PATH':_0x40aeff[_0xf590('0xd')]};return _0x49db07;};exports[_0xf590('0xe')]=function(_0x4794a8,_0x187bfe){return{'actionid':_0x4794a8[_0xf590('0xf')],'action':_0xf590('0x10'),'channel':_0x4794a8[_0xf590('0x11')],'Exten':_0xf590('0x12'),'Context':_0xf590('0x13'),'Priority':'1','callerid':util[_0xf590('0x9')](_0xf590('0x14'),_0x4794a8[_0xf590('0x7')]?_0x4794a8['headerinfo']:'',_0x4794a8['localstationid']),'variable':_0x187bfe,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4794a8[_0xf590('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 49ecb82..1da079b 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 _0x3dec=['./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','getAgents','then','initAgents','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./report','./acw'];(function(_0x2120fb,_0x5f4749){var _0x41a2da=function(_0x35e59c){while(--_0x35e59c){_0x2120fb['push'](_0x2120fb['shift']());}};_0x41a2da(++_0x5f4749);}(_0x3dec,0x116));var _0xc3de=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0x3dec[_0x102123];return _0x151fee;};'use strict';var util=require(_0xc3de('0x0'));var moment=require(_0xc3de('0x1'));var server=require(_0xc3de('0x2'));var Realtime=require(_0xc3de('0x3'));var Report=require(_0xc3de('0x4'));var Acw=require(_0xc3de('0x5'));var Trigger=require(_0xc3de('0x6'));var Dialer=require(_0xc3de('0x7'));var Preview=require(_0xc3de('0x8'));var Fax=require(_0xc3de('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xc3de('0xa'));var voiceQueueReport=require(_0xc3de('0xb'));var voiceCallReport=require(_0xc3de('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0xc3de('0xd'));var template=require(_0xc3de('0xe'));var cmHopperHistory=require(_0xc3de('0xf'));var campaign=require(_0xc3de('0x10'));var voiceExtension=require(_0xc3de('0x11'));var faxAccount=require(_0xc3de('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc3de('0x13'));var sugarcrm=require(_0xc3de('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc3de('0x15'));var zoho=require(_0xc3de('0x16'));var vtiger=require(_0xc3de('0x17'));var freshsales=require(_0xc3de('0x18'));var servicenow=require(_0xc3de('0x19'));var dynamics365=require(_0xc3de('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc3de('0x1b'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc3de('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc3de('0x1c')](_0xc3de('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc3de('0x1e')]()['then'](user[_0xc3de('0x1f')]())[_0xc3de('0x20')](realtime[_0xc3de('0x21')]())[_0xc3de('0x20')](user['getTelephones']())[_0xc3de('0x20')](realtime['initTelephones']())['then'](trunk[_0xc3de('0x22')]())[_0xc3de('0x20')](realtime[_0xc3de('0x23')]())[_0xc3de('0x20')](voiceQueue[_0xc3de('0x24')]())[_0xc3de('0x20')](realtime['initVoiceQueues']())['then'](trigger[_0xc3de('0x25')]())['then'](realtime[_0xc3de('0x26')]())[_0xc3de('0x20')](template['getTemplates']())['then'](realtime['initTemplates']())[_0xc3de('0x20')](zendesk['getZendeskAccounts']())[_0xc3de('0x20')](realtime['initZendeskAccounts']())['then'](salesforce[_0xc3de('0x27')]())[_0xc3de('0x20')](realtime[_0xc3de('0x28')]())[_0xc3de('0x20')](sugarcrm[_0xc3de('0x29')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2a')]())[_0xc3de('0x20')](freshdesk['getFreshdeskAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x2b')]())[_0xc3de('0x20')](desk[_0xc3de('0x2c')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2d')]())[_0xc3de('0x20')](zoho[_0xc3de('0x2e')]())[_0xc3de('0x20')](realtime[_0xc3de('0x2f')]())['then'](vtiger[_0xc3de('0x30')]())[_0xc3de('0x20')](realtime[_0xc3de('0x31')]())[_0xc3de('0x20')](freshsales[_0xc3de('0x32')]())[_0xc3de('0x20')](realtime[_0xc3de('0x33')]())['then'](servicenow['getServicenowAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x34')]())[_0xc3de('0x20')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xc3de('0x35')]())[_0xc3de('0x20')](campaign['getCampaigns']())[_0xc3de('0x20')](realtime[_0xc3de('0x36')]())[_0xc3de('0x20')](voiceExtension[_0xc3de('0x37')]())[_0xc3de('0x20')](realtime[_0xc3de('0x38')]())['then'](faxAccount['getFaxAccounts']())[_0xc3de('0x20')](realtime[_0xc3de('0x39')]())[_0xc3de('0x20')](function(){return realtime;});}function initParams(){return Promise[_0xc3de('0x1e')]()[_0xc3de('0x20')](voiceQueueReport[_0xc3de('0x3a')]())[_0xc3de('0x20')](realtime[_0xc3de('0x3b')]())[_0xc3de('0x20')](cmHopperHistory[_0xc3de('0x3c')]())[_0xc3de('0x20')](realtime['initVoiceQueueHopperHistory']())[_0xc3de('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0xc3de('0x20')](realtime[_0xc3de('0x3d')]())[_0xc3de('0x20')](voiceCallReport[_0xc3de('0x3e')]())[_0xc3de('0x20')](realtime[_0xc3de('0x3f')]())['catch'](function(_0x2dd574){logger[_0xc3de('0x40')](_0xc3de('0x41'),util[_0xc3de('0x42')](_0x2dd574,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc3de('0x43')](realtime,preview,fax)[_0xc3de('0x20')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xc3de('0x20')](function(){report[_0xc3de('0x44')]();setInterval(initRealtime,0x1388);})[_0xc3de('0x45')](function(_0x5b9244){logger['error'](_0xc3de('0x46'),util[_0xc3de('0x42')](_0x5b9244,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc59d=['initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues'];(function(_0x238df1,_0x288fbf){var _0xab2916=function(_0x2019c7){while(--_0x2019c7){_0x238df1['push'](_0x238df1['shift']());}};_0xab2916(++_0x288fbf);}(_0xc59d,0x1a2));var _0xdc59=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc59d[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xdc59('0x0'));var moment=require('moment');var server=require(_0xdc59('0x1'));var Realtime=require(_0xdc59('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xdc59('0x3'));var Dialer=require(_0xdc59('0x4'));var Preview=require(_0xdc59('0x5'));var Fax=require(_0xdc59('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xdc59('0x7'));var voiceQueueReport=require(_0xdc59('0x8'));var voiceCallReport=require(_0xdc59('0x9'));var trunk=require(_0xdc59('0xa'));var trigger=require('./rpc/trigger');var template=require(_0xdc59('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xdc59('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xdc59('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xdc59('0xe'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xdc59('0xf'));var freshsales=require(_0xdc59('0x10'));var servicenow=require(_0xdc59('0x11'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xdc59('0x12'))(_0xdc59('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xdc59('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xdc59('0x15')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xdc59('0x16')]()[_0xdc59('0x17')](user[_0xdc59('0x18')]())[_0xdc59('0x17')](realtime['initAgents']())[_0xdc59('0x17')](user[_0xdc59('0x19')]())[_0xdc59('0x17')](realtime[_0xdc59('0x1a')]())[_0xdc59('0x17')](trunk[_0xdc59('0x1b')]())['then'](realtime[_0xdc59('0x1c')]())[_0xdc59('0x17')](voiceQueue[_0xdc59('0x1d')]())[_0xdc59('0x17')](realtime[_0xdc59('0x1e')]())['then'](trigger['getTriggers']())[_0xdc59('0x17')](realtime['initTriggers']())[_0xdc59('0x17')](template[_0xdc59('0x1f')]())[_0xdc59('0x17')](realtime[_0xdc59('0x20')]())[_0xdc59('0x17')](zendesk[_0xdc59('0x21')]())['then'](realtime[_0xdc59('0x22')]())[_0xdc59('0x17')](salesforce['getSalesforceAccounts']())[_0xdc59('0x17')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xdc59('0x23')]())[_0xdc59('0x17')](realtime[_0xdc59('0x24')]())[_0xdc59('0x17')](freshdesk[_0xdc59('0x25')]())[_0xdc59('0x17')](realtime[_0xdc59('0x26')]())[_0xdc59('0x17')](desk[_0xdc59('0x27')]())['then'](realtime[_0xdc59('0x28')]())['then'](zoho[_0xdc59('0x29')]())['then'](realtime[_0xdc59('0x2a')]())[_0xdc59('0x17')](vtiger[_0xdc59('0x2b')]())[_0xdc59('0x17')](realtime[_0xdc59('0x2c')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xdc59('0x2d')]())[_0xdc59('0x17')](servicenow[_0xdc59('0x2e')]())[_0xdc59('0x17')](realtime[_0xdc59('0x2f')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xdc59('0x30')]())[_0xdc59('0x17')](campaign['getCampaigns']())[_0xdc59('0x17')](realtime[_0xdc59('0x31')]())[_0xdc59('0x17')](voiceExtension[_0xdc59('0x32')]())['then'](realtime[_0xdc59('0x33')]())['then'](faxAccount['getFaxAccounts']())[_0xdc59('0x17')](realtime[_0xdc59('0x34')]())[_0xdc59('0x17')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0xdc59('0x35')]())['then'](realtime[_0xdc59('0x36')]())['then'](cmHopperHistory[_0xdc59('0x37')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xdc59('0x17')](cmHopperHistory[_0xdc59('0x38')]())[_0xdc59('0x17')](realtime[_0xdc59('0x39')]())[_0xdc59('0x17')](voiceCallReport['getVoiceCallReports']())[_0xdc59('0x17')](realtime['initVoiceCallReports']())[_0xdc59('0x3a')](function(_0xfcc30a){logger[_0xdc59('0x3b')](_0xdc59('0x3c'),util[_0xdc59('0x3d')](_0xfcc30a,{'showHidden':![],'depth':null}));});}function main(){return server[_0xdc59('0x3e')](realtime,preview,fax)[_0xdc59('0x17')](function(){return initRealtime();})[_0xdc59('0x17')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xdc59('0x3a')](function(_0x18b22a){logger[_0xdc59('0x3b')](_0xdc59('0x3f'),util[_0xdc59('0x3d')](_0x18b22a,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 0a08c53..6d68157 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 _0x5b45=['ioredis','../../../config/environment','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','idle','talking','statePause','format','voiceStatus','status','voiceStatusTime','stringify','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5'];(function(_0x473f3e,_0x9ec97e){var _0x34a9d2=function(_0x378439){while(--_0x378439){_0x473f3e['push'](_0x473f3e['shift']());}};_0x34a9d2(++_0x9ec97e);}(_0x5b45,0x114));var _0x55b4=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x5b45[_0x5d6c3e];return _0x44ecb7;};'use strict';var _=require(_0x55b4('0x0'));var util=require(_0x55b4('0x1'));var moment=require(_0x55b4('0x2'));var md5=require(_0x55b4('0x3'));var Redis=require(_0x55b4('0x4'));var config=require(_0x55b4('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x55b4('0x6'),'port':0x18eb});var io=require(_0x55b4('0x7'))(new Redis(config['redis']));function Agent(_0xe8a10e){this['id']=_0xe8a10e['id']||0x0;this['name']=_0xe8a10e[_0x55b4('0x8')]||'';this[_0x55b4('0x9')]=_0xe8a10e[_0x55b4('0x9')]||'';this[_0x55b4('0xa')]=_0xe8a10e[_0x55b4('0xa')]||'';this[_0x55b4('0xb')]=_0xe8a10e[_0x55b4('0xb')]||'';this[_0x55b4('0xc')]=_0x55b4('0xd');this[_0x55b4('0xe')]=0x0;this['status']=_0x55b4('0xd');this[_0x55b4('0xf')]='';this['phone']='';this[_0x55b4('0x10')]='';this[_0x55b4('0x11')]='';this['online']=_0xe8a10e[_0x55b4('0x12')]||![];this['voiceStatus']=_0x55b4('0xd');this['voiceStatusTime']=0x0;this[_0x55b4('0x13')]='';this[_0x55b4('0x14')]='';this[_0x55b4('0x15')]=![];this['local']=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0xbf2d8d){var _0x2e83a8;if(_0xbf2d8d&&_0xbf2d8d[_0x55b4('0xc')]){_0x2e83a8=_0xbf2d8d[_0x55b4('0xc')]['toLowerCase']();switch(_0x2e83a8){case'not_inuse':_0x2e83a8=_0x55b4('0x16');break;case'inuse':_0x2e83a8=_0x55b4('0x17');break;}}if(_0x2e83a8&&this['voiceStatus']!==_0x2e83a8||_0xbf2d8d[_0x55b4('0x18')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x55b4('0x19')]('x'));}if(_0x2e83a8){this[_0x55b4('0x1a')]=_0x2e83a8;}var _0x576d5f={'id':this['id'],'name':this[_0x55b4('0x8')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x55b4('0xb')],'state':this['state'],'stateTime':this[_0x55b4('0xe')],'status':this[_0x55b4('0x1b')],'address':this[_0x55b4('0xf')],'online':this[_0x55b4('0x12')],'voiceStatus':this[_0x55b4('0x1a')],'voiceStatusTime':this[_0x55b4('0x1c')],'voiceStatusCallerIdNumber':this[_0x55b4('0x13')],'voiceStatusQueue':this[_0x55b4('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x2a198e=md5(JSON[_0x55b4('0x1d')](_0x576d5f));if(this[_0x55b4('0x3')]!==_0x2a198e){this[_0x55b4('0x3')]=_0x2a198e;io['to'](util[_0x55b4('0x19')](_0x55b4('0x1e'),_0x576d5f[_0x55b4('0x8')]))[_0x55b4('0x1f')](_0x55b4('0x20'),_['omit'](_0x576d5f,['online']));io[_0x55b4('0x1f')](_0x55b4('0x21'),_0x576d5f);}};module[_0x55b4('0x22')]=Agent; \ No newline at end of file +var _0x3178=['md5','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','statePause','format','stateTime','voiceStatusCallerIdNumber','emit','user:ami:update','omit','user:presence','exports'];(function(_0x14f132,_0x4cf31e){var _0x24bf39=function(_0x10ddad){while(--_0x10ddad){_0x14f132['push'](_0x14f132['shift']());}};_0x24bf39(++_0x4cf31e);}(_0x3178,0x176));var _0x8317=function(_0x1bf0f9,_0xb1eed8){_0x1bf0f9=_0x1bf0f9-0x0;var _0x4aac65=_0x3178[_0x1bf0f9];return _0x4aac65;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require(_0x8317('0x0'));var Redis=require('ioredis');var config=require(_0x8317('0x1'));config[_0x8317('0x2')]=_['defaults'](config[_0x8317('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x8317('0x3'))(new Redis(config[_0x8317('0x2')]));function Agent(_0x1677b7){this['id']=_0x1677b7['id']||0x0;this[_0x8317('0x4')]=_0x1677b7[_0x8317('0x4')]||'';this[_0x8317('0x5')]=_0x1677b7[_0x8317('0x5')]||'';this[_0x8317('0x6')]=_0x1677b7[_0x8317('0x6')]||'';this[_0x8317('0x7')]=_0x1677b7[_0x8317('0x7')]||'';this[_0x8317('0x8')]=_0x8317('0x9');this['stateTime']=0x0;this[_0x8317('0xa')]=_0x8317('0x9');this[_0x8317('0xb')]='';this['phone']='';this[_0x8317('0xc')]='';this[_0x8317('0xd')]='';this['online']=_0x1677b7[_0x8317('0xe')]||![];this[_0x8317('0xf')]=_0x8317('0x9');this[_0x8317('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x8317('0x11')]='';this[_0x8317('0x12')]=![];this[_0x8317('0x13')]=![];this[_0x8317('0x0')]='';}Agent[_0x8317('0x14')][_0x8317('0x15')]=function(_0x4b9ba7){var _0xc6eeb0;if(_0x4b9ba7&&_0x4b9ba7[_0x8317('0x8')]){_0xc6eeb0=_0x4b9ba7[_0x8317('0x8')][_0x8317('0x16')]();switch(_0xc6eeb0){case'not_inuse':_0xc6eeb0=_0x8317('0x17');break;case _0x8317('0x18'):_0xc6eeb0='talking';break;}}if(_0xc6eeb0&&this[_0x8317('0xf')]!==_0xc6eeb0||_0x4b9ba7[_0x8317('0x19')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x8317('0x1a')]('x'));}if(_0xc6eeb0){this[_0x8317('0xf')]=_0xc6eeb0;}var _0x2cfeb4={'id':this['id'],'name':this[_0x8317('0x4')],'email':this[_0x8317('0x5')],'accountcode':this[_0x8317('0x6')],'fullname':this[_0x8317('0x7')],'state':this[_0x8317('0x8')],'stateTime':this[_0x8317('0x1b')],'status':this[_0x8317('0xa')],'address':this[_0x8317('0xb')],'online':this[_0x8317('0xe')],'voiceStatus':this[_0x8317('0xf')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x8317('0x1c')],'voiceStatusQueue':this[_0x8317('0x11')],'interface':this['interface'],'onhold':this[_0x8317('0x12')]};var _0x57e42b=md5(JSON['stringify'](_0x2cfeb4));if(this[_0x8317('0x0')]!==_0x57e42b){this[_0x8317('0x0')]=_0x57e42b;io['to'](util['format']('user:%s',_0x2cfeb4['name']))[_0x8317('0x1d')](_0x8317('0x1e'),_[_0x8317('0x1f')](_0x2cfeb4,[_0x8317('0xe')]));io[_0x8317('0x1d')](_0x8317('0x20'),_0x2cfeb4);}};module[_0x8317('0x21')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index c0c6b83..e0b35d0 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 _0xf750=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0xcc6afe,_0x227a9d){var _0x58db63=function(_0x19ff17){while(--_0x19ff17){_0xcc6afe['push'](_0xcc6afe['shift']());}};_0x58db63(++_0x227a9d);}(_0xf750,0xef));var _0x0f75=function(_0x5d96ee,_0x523278){_0x5d96ee=_0x5d96ee-0x0;var _0x39092b=_0xf750[_0x5d96ee];return _0x39092b;};'use strict';function Campaign(_0x15f64c){this['id']=_0x15f64c['id']||0x0;this['name']=_0x15f64c[_0x0f75('0x0')]||'';this[_0x0f75('0x1')]=_0x15f64c[_0x0f75('0x1')]||_0x0f75('0x2');this[_0x0f75('0x3')]=0x0;this['temp']=0x0;this[_0x0f75('0x4')]=0x0;this[_0x0f75('0x5')]=0x0;this['message']='';this[_0x0f75('0x6')]=!![];this[_0x0f75('0x7')]=_0x15f64c['active'];this['limitCalls']=_0x15f64c[_0x0f75('0x8')];this[_0x0f75('0x9')]=_0x15f64c[_0x0f75('0x9')]||null;this[_0x0f75('0xa')]=_0x15f64c[_0x0f75('0xa')]?_0x15f64c[_0x0f75('0xa')]:null;this[_0x0f75('0xb')]=_0x15f64c[_0x0f75('0xb')];this['dialOriginateCallerIdNumber']=_0x15f64c[_0x0f75('0xc')];this['dialOriginateTimeout']=_0x15f64c['dialOriginateTimeout']||0x1e;this[_0x0f75('0xd')]=_0x15f64c['dialCongestionMaxRetry'];this[_0x0f75('0xe')]=_0x15f64c[_0x0f75('0xe')];this[_0x0f75('0xf')]=_0x15f64c[_0x0f75('0xf')];this[_0x0f75('0x10')]=_0x15f64c[_0x0f75('0x10')];this[_0x0f75('0x11')]=_0x15f64c[_0x0f75('0x11')];this[_0x0f75('0x12')]=_0x15f64c[_0x0f75('0x12')];this['dialGlobalMaxRetry']=_0x15f64c[_0x0f75('0x13')];this['dialNoSuchNumberMaxRetry']=_0x15f64c[_0x0f75('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x15f64c[_0x0f75('0x15')]||0x96;this[_0x0f75('0x16')]=_0x15f64c[_0x0f75('0x16')]||0x3;this[_0x0f75('0x17')]=_0x15f64c[_0x0f75('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x15f64c[_0x0f75('0x18')]||0x3;this[_0x0f75('0x19')]=_0x15f64c[_0x0f75('0x19')]||0x96;this[_0x0f75('0x1a')]=_0x15f64c[_0x0f75('0x1a')]||0x3;this[_0x0f75('0x1b')]=_0x15f64c[_0x0f75('0x1b')]||0x96;this[_0x0f75('0x1c')]=_0x15f64c['dialAgentRejectMaxRetry']||0x3;this[_0x0f75('0x1d')]=_0x15f64c[_0x0f75('0x1d')]||0x96;this[_0x0f75('0x1e')]=_0x15f64c[_0x0f75('0x1e')]||_0x0f75('0x1f');this[_0x0f75('0x20')]=_0x15f64c[_0x0f75('0x20')]||undefined;this[_0x0f75('0x21')]=_0x15f64c[_0x0f75('0x21')]||undefined;this['dialCutDigit']=_0x15f64c[_0x0f75('0x22')]||undefined;this[_0x0f75('0x23')]=_0x15f64c[_0x0f75('0x23')]?_0x15f64c[_0x0f75('0x23')]:undefined;this[_0x0f75('0x24')]=_0x15f64c[_0x0f75('0x24')]?_0x15f64c['Trunk']:undefined;this['Interval']=_0x15f64c['Interval']?_0x15f64c[_0x0f75('0x25')]:undefined;this['SquareProject']=_0x15f64c[_0x0f75('0x26')]?_0x15f64c[_0x0f75('0x26')]:undefined;this[_0x0f75('0x27')]=_0x15f64c['SquareProject']?_0x15f64c[_0x0f75('0x26')]['name']:undefined;this['dialAMDActive']=_0x15f64c[_0x0f75('0x28')]||![];this[_0x0f75('0x29')]=_0x15f64c[_0x0f75('0x29')];this[_0x0f75('0x2a')]=_0x15f64c[_0x0f75('0x2a')];this['dialAMDAfterGreetingSilence']=_0x15f64c[_0x0f75('0x2b')];this[_0x0f75('0x2c')]=_0x15f64c[_0x0f75('0x2c')];this['dialAMDMinWordLength']=_0x15f64c[_0x0f75('0x2d')];this[_0x0f75('0x2e')]=_0x15f64c[_0x0f75('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x15f64c[_0x0f75('0x2f')];this[_0x0f75('0x30')]=_0x15f64c[_0x0f75('0x30')];this['dialAMDMaximumWordLength']=_0x15f64c[_0x0f75('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0xc09e=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x5c0975,_0x24d5e6){var _0x33ee8c=function(_0x10ebd3){while(--_0x10ebd3){_0x5c0975['push'](_0x5c0975['shift']());}};_0x33ee8c(++_0x24d5e6);}(_0xc09e,0xb6));var _0xec09=function(_0x2375c0,_0x29c4a7){_0x2375c0=_0x2375c0-0x0;var _0x52f035=_0xc09e[_0x2375c0];return _0x52f035;};'use strict';function Campaign(_0x394fc9){this['id']=_0x394fc9['id']||0x0;this[_0xec09('0x0')]=_0x394fc9[_0xec09('0x0')]||'';this[_0xec09('0x1')]=_0x394fc9[_0xec09('0x1')]||_0xec09('0x2');this['originated']=0x0;this[_0xec09('0x3')]=0x0;this[_0xec09('0x4')]=0x0;this[_0xec09('0x5')]=0x0;this[_0xec09('0x6')]='';this[_0xec09('0x7')]=!![];this[_0xec09('0x8')]=_0x394fc9[_0xec09('0x8')];this[_0xec09('0x9')]=_0x394fc9['limitCalls'];this[_0xec09('0xa')]=_0x394fc9['dialTimezone']||null;this[_0xec09('0xb')]=_0x394fc9['dialGlobalInterval']?_0x394fc9[_0xec09('0xb')]:null;this[_0xec09('0xc')]=_0x394fc9[_0xec09('0xc')];this['dialOriginateCallerIdNumber']=_0x394fc9[_0xec09('0xd')];this[_0xec09('0xe')]=_0x394fc9[_0xec09('0xe')]||0x1e;this[_0xec09('0xf')]=_0x394fc9[_0xec09('0xf')];this[_0xec09('0x10')]=_0x394fc9[_0xec09('0x10')];this[_0xec09('0x11')]=_0x394fc9['dialBusyMaxRetry'];this[_0xec09('0x12')]=_0x394fc9[_0xec09('0x12')];this[_0xec09('0x13')]=_0x394fc9['dialNoAnswerMaxRetry'];this[_0xec09('0x14')]=_0x394fc9[_0xec09('0x14')];this['dialGlobalMaxRetry']=_0x394fc9[_0xec09('0x15')];this[_0xec09('0x16')]=_0x394fc9['dialNoSuchNumberMaxRetry']||0x3;this[_0xec09('0x17')]=_0x394fc9['dialNoSuchNumberRetryFrequency']||0x96;this[_0xec09('0x18')]=_0x394fc9[_0xec09('0x18')]||0x3;this[_0xec09('0x19')]=_0x394fc9['dialDropRetryFrequency']||0x96;this[_0xec09('0x1a')]=_0x394fc9[_0xec09('0x1a')]||0x3;this[_0xec09('0x1b')]=_0x394fc9[_0xec09('0x1b')]||0x96;this[_0xec09('0x1c')]=_0x394fc9[_0xec09('0x1c')]||0x3;this[_0xec09('0x1d')]=_0x394fc9[_0xec09('0x1d')]||0x96;this[_0xec09('0x1e')]=_0x394fc9[_0xec09('0x1e')]||0x3;this[_0xec09('0x1f')]=_0x394fc9[_0xec09('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x394fc9['dialOrderByScheduledAt']||_0xec09('0x20');this[_0xec09('0x21')]=_0x394fc9[_0xec09('0x21')]||undefined;this[_0xec09('0x22')]=_0x394fc9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xec09('0x23')]=_0x394fc9[_0xec09('0x23')]||undefined;this[_0xec09('0x24')]=_0x394fc9['TrunkBackup']?_0x394fc9['TrunkBackup']:undefined;this[_0xec09('0x25')]=_0x394fc9['Trunk']?_0x394fc9[_0xec09('0x25')]:undefined;this[_0xec09('0x26')]=_0x394fc9['Interval']?_0x394fc9['Interval']:undefined;this['SquareProject']=_0x394fc9[_0xec09('0x27')]?_0x394fc9[_0xec09('0x27')]:undefined;this[_0xec09('0x28')]=_0x394fc9[_0xec09('0x27')]?_0x394fc9[_0xec09('0x27')][_0xec09('0x0')]:undefined;this['dialAMDActive']=_0x394fc9[_0xec09('0x29')]||![];this[_0xec09('0x2a')]=_0x394fc9[_0xec09('0x2a')];this[_0xec09('0x2b')]=_0x394fc9[_0xec09('0x2b')];this['dialAMDAfterGreetingSilence']=_0x394fc9[_0xec09('0x2c')];this[_0xec09('0x2d')]=_0x394fc9[_0xec09('0x2d')];this[_0xec09('0x2e')]=_0x394fc9[_0xec09('0x2e')];this[_0xec09('0x2f')]=_0x394fc9['dialAMDBetweenWordsSilence'];this[_0xec09('0x30')]=_0x394fc9[_0xec09('0x30')];this['dialAMDSilenceThreshold']=_0x394fc9[_0xec09('0x31')];this[_0xec09('0x32')]=_0x394fc9[_0xec09('0x32')];}module[_0xec09('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e823b36..3862e51 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 _0x80cd=['unmanaged','abandoned','lastapplication','lastdata','billableseconds','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime'];(function(_0x4487b2,_0x432f6b){var _0x5b33a1=function(_0x5c7baf){while(--_0x5c7baf){_0x4487b2['push'](_0x4487b2['shift']());}};_0x5b33a1(++_0x432f6b);}(_0x80cd,0x146));var _0xd80c=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x80cd[_0x1780f8];return _0x33a410;};'use strict';function Channel(){this['starttime']=null;this[_0xd80c('0x0')]='';this[_0xd80c('0x1')]='';this[_0xd80c('0x2')]=0x0;this[_0xd80c('0x3')]='';this[_0xd80c('0x4')]=undefined;this[_0xd80c('0x5')]=undefined;this[_0xd80c('0x6')]=0x0;this[_0xd80c('0x7')]='';this['uniqueid']=0x0;this[_0xd80c('0x8')]=0x0;this[_0xd80c('0x9')]=0x0;this[_0xd80c('0xa')]=![];this[_0xd80c('0xb')]=null;this['endtime']=null;this[_0xd80c('0xc')]=![];this[_0xd80c('0xd')]=![];this[_0xd80c('0xe')]='';this[_0xd80c('0xf')]='';this['duration']=0x0;this[_0xd80c('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xd80c('0x11')]=null;this['disposition']=null;this[_0xd80c('0x12')]=![];this[_0xd80c('0x13')]=null;this[_0xd80c('0x14')]=null;this[_0xd80c('0x15')]=[];this[_0xd80c('0x16')]=undefined;this[_0xd80c('0x17')]=undefined;this[_0xd80c('0x18')]=undefined;this['mohtime']=0x0;}module[_0xd80c('0x19')]=Channel; \ No newline at end of file +var _0x79ad=['unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','answertime','endtime'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x79ad,0x16e));var _0xd79a=function(_0x43c966,_0x25c10a){_0x43c966=_0x43c966-0x0;var _0x52189=_0x79ad[_0x43c966];return _0x52189;};'use strict';function Channel(){this[_0xd79a('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xd79a('0x1')]=0x0;this[_0xd79a('0x2')]='';this[_0xd79a('0x3')]=undefined;this[_0xd79a('0x4')]=undefined;this[_0xd79a('0x5')]=0x0;this[_0xd79a('0x6')]='';this[_0xd79a('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xd79a('0x8')]=![];this[_0xd79a('0x9')]=null;this[_0xd79a('0xa')]=null;this[_0xd79a('0xb')]=![];this[_0xd79a('0xc')]=![];this[_0xd79a('0xd')]='';this[_0xd79a('0xe')]='';this[_0xd79a('0xf')]=0x0;this[_0xd79a('0x10')]=0x0;this[_0xd79a('0x11')]=0x0;this[_0xd79a('0x12')]=null;this[_0xd79a('0x13')]=null;this[_0xd79a('0x14')]=null;this['monitor']=![];this[_0xd79a('0x15')]=null;this[_0xd79a('0x16')]=null;this[_0xd79a('0x17')]=[];this[_0xd79a('0x18')]=undefined;this[_0xd79a('0x19')]=undefined;this[_0xd79a('0x1a')]=undefined;this[_0xd79a('0x1b')]=0x0;}module[_0xd79a('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 7dec119..26d12e3 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 _0x9c2c=['consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password'];(function(_0x7fe903,_0x5a3e7a){var _0x2ee69b=function(_0x579bb5){while(--_0x579bb5){_0x7fe903['push'](_0x7fe903['shift']());}};_0x2ee69b(++_0x5a3e7a);}(_0x9c2c,0x167));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x284395){this['id']=_0x284395['id']||0x0;this['name']=_0x284395['name']||'';this[_0xc9c2('0x0')]=_0x284395['username']||'';this[_0xc9c2('0x1')]=_0x284395[_0xc9c2('0x1')]||'';this[_0xc9c2('0x2')]=_0x284395[_0xc9c2('0x2')]||'';this[_0xc9c2('0x3')]=_0x284395[_0xc9c2('0x3')]||'';this[_0xc9c2('0x4')]=_0x284395['consumerKey']||'';this['consumerSecret']=_0x284395['consumerSecret']||'';this[_0xc9c2('0x5')]=_0x284395[_0xc9c2('0x5')]||'';this[_0xc9c2('0x6')]=_0x284395[_0xc9c2('0x6')]||'';this['type']=_0x284395[_0xc9c2('0x7')]||'';this[_0xc9c2('0x8')]=_0x284395['serverUrl']||'';this['Configurations']=_0x284395[_0xc9c2('0x9')]||{};}module[_0xc9c2('0xa')]=DeskAccount; \ No newline at end of file +var _0xea2a=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','consumerKey'];(function(_0x4a0e33,_0x272b90){var _0x38cf43=function(_0x48ad7c){while(--_0x48ad7c){_0x4a0e33['push'](_0x4a0e33['shift']());}};_0x38cf43(++_0x272b90);}(_0xea2a,0xa1));var _0xaea2=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0xea2a[_0xf168d3];return _0x17fb54;};'use strict';function DeskAccount(_0x560059){this['id']=_0x560059['id']||0x0;this['name']=_0x560059['name']||'';this[_0xaea2('0x0')]=_0x560059[_0xaea2('0x0')]||'';this[_0xaea2('0x1')]=_0x560059['remoteUri']||'';this[_0xaea2('0x2')]=_0x560059[_0xaea2('0x2')]||'';this['password']=_0x560059['password']||'';this['consumerKey']=_0x560059[_0xaea2('0x3')]||'';this[_0xaea2('0x4')]=_0x560059[_0xaea2('0x4')]||'';this['token']=_0x560059[_0xaea2('0x5')]||'';this[_0xaea2('0x6')]=_0x560059['tokenSecret']||'';this[_0xaea2('0x7')]=_0x560059[_0xaea2('0x7')]||'';this['serverUrl']=_0x560059[_0xaea2('0x8')]||'';this['Configurations']=_0x560059[_0xaea2('0x9')]||{};}module[_0xaea2('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cc491ad..5655e5a 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 _0xd6ae=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1dca22,_0x3a101c){var _0x3c851f=function(_0x264a7e){while(--_0x264a7e){_0x1dca22['push'](_0x1dca22['shift']());}};_0x3c851f(++_0x3a101c);}(_0xd6ae,0x19e));var _0xed6a=function(_0x11c15a,_0xbee450){_0x11c15a=_0x11c15a-0x0;var _0x5e9064=_0xd6ae[_0x11c15a];return _0x5e9064;};'use strict';function Dynamics365Account(_0xa4f335){this['id']=_0xa4f335['id']||0x0;this['name']=_0xa4f335[_0xed6a('0x0')]||'';this['username']=_0xa4f335['username']||'';this[_0xed6a('0x1')]=_0xa4f335[_0xed6a('0x1')]||'';this[_0xed6a('0x2')]=_0xa4f335[_0xed6a('0x2')]||'';this[_0xed6a('0x3')]=_0xa4f335[_0xed6a('0x3')]||'';this['clientId']=_0xa4f335[_0xed6a('0x4')]||'';this[_0xed6a('0x5')]=_0xa4f335['clientSecret']||{};this['serverUrl']=_0xa4f335[_0xed6a('0x6')]||'';this[_0xed6a('0x7')]=_0xa4f335[_0xed6a('0x7')]||![];this[_0xed6a('0x8')]=_0xa4f335['Configurations']||{};this['CloudProvider']=_0xa4f335[_0xed6a('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x5cfb=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x5b9c06,_0x18dd25){var _0x30d7da=function(_0x2ffc69){while(--_0x2ffc69){_0x5b9c06['push'](_0x5b9c06['shift']());}};_0x30d7da(++_0x18dd25);}(_0x5cfb,0x163));var _0xb5cf=function(_0x2bab8d,_0x45f56b){_0x2bab8d=_0x2bab8d-0x0;var _0x1b7722=_0x5cfb[_0x2bab8d];return _0x1b7722;};'use strict';function Dynamics365Account(_0x35cc64){this['id']=_0x35cc64['id']||0x0;this['name']=_0x35cc64[_0xb5cf('0x0')]||'';this['username']=_0x35cc64[_0xb5cf('0x1')]||'';this['password']=_0x35cc64[_0xb5cf('0x2')]||'';this[_0xb5cf('0x3')]=_0x35cc64['remoteUri']||'';this[_0xb5cf('0x4')]=_0x35cc64[_0xb5cf('0x4')]||'';this[_0xb5cf('0x5')]=_0x35cc64[_0xb5cf('0x5')]||'';this['clientSecret']=_0x35cc64[_0xb5cf('0x6')]||{};this[_0xb5cf('0x7')]=_0x35cc64[_0xb5cf('0x7')]||'';this[_0xb5cf('0x8')]=_0x35cc64[_0xb5cf('0x8')]||![];this[_0xb5cf('0x9')]=_0x35cc64[_0xb5cf('0x9')]||{};this[_0xb5cf('0xa')]=_0x35cc64[_0xb5cf('0xa')]||{};}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 cf1fcce..6bee22d 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 _0x37b8=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x4e1f46,_0x3deec6){var _0x239acb=function(_0x4837aa){while(--_0x4837aa){_0x4e1f46['push'](_0x4e1f46['shift']());}};_0x239acb(++_0x3deec6);}(_0x37b8,0x186));var _0x837b=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x37b8[_0x1dc24d];return _0x5d7fb2;};'use strict';function FaxAccount(_0x224e9f){this['id']=_0x224e9f['id']||0x0;this[_0x837b('0x0')]=_0x224e9f[_0x837b('0x0')]||'';this[_0x837b('0x1')]=_0x224e9f['description'];this[_0x837b('0x2')]=_0x224e9f[_0x837b('0x2')];this[_0x837b('0x3')]=_0x224e9f[_0x837b('0x3')];this[_0x837b('0x4')]=_0x224e9f[_0x837b('0x4')];this[_0x837b('0x5')]=_0x224e9f[_0x837b('0x5')]||0x960;this[_0x837b('0x6')]=_0x224e9f['maxrate']||0x3840;this[_0x837b('0x7')]=_0x224e9f[_0x837b('0x7')]||'v17,v27,v29';this[_0x837b('0x8')]=_0x224e9f[_0x837b('0x8')]||'no';this[_0x837b('0x9')]=_0x224e9f[_0x837b('0x9')]||'no';this[_0x837b('0xa')]=_0x224e9f[_0x837b('0xa')]||0x1388;this['tech']=_0x224e9f[_0x837b('0xb')]||_0x837b('0xc');this[_0x837b('0xd')]=_0x224e9f[_0x837b('0xd')]?_0x224e9f[_0x837b('0xd')]:undefined;this[_0x837b('0xe')]=_0x224e9f[_0x837b('0xe')];this['key']=_0x224e9f[_0x837b('0xf')];}module[_0x837b('0x10')]=FaxAccount; \ No newline at end of file +var _0x9cab=['gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x18f936,_0x580e04){var _0x2ff85b=function(_0xf79289){while(--_0xf79289){_0x18f936['push'](_0x18f936['shift']());}};_0x2ff85b(++_0x580e04);}(_0x9cab,0x1e7));var _0xb9ca=function(_0x3350f7,_0xb7c959){_0x3350f7=_0x3350f7-0x0;var _0x31e6e9=_0x9cab[_0x3350f7];return _0x31e6e9;};'use strict';function FaxAccount(_0x3bf9cb){this['id']=_0x3bf9cb['id']||0x0;this[_0xb9ca('0x0')]=_0x3bf9cb[_0xb9ca('0x0')]||'';this[_0xb9ca('0x1')]=_0x3bf9cb[_0xb9ca('0x1')];this[_0xb9ca('0x2')]=_0x3bf9cb[_0xb9ca('0x2')];this['headerinfo']=_0x3bf9cb[_0xb9ca('0x3')];this[_0xb9ca('0x4')]=_0x3bf9cb['localstationid'];this[_0xb9ca('0x5')]=_0x3bf9cb[_0xb9ca('0x5')]||0x960;this[_0xb9ca('0x6')]=_0x3bf9cb[_0xb9ca('0x6')]||0x3840;this[_0xb9ca('0x7')]=_0x3bf9cb['modem']||'v17,v27,v29';this[_0xb9ca('0x8')]=_0x3bf9cb[_0xb9ca('0x8')]||'no';this[_0xb9ca('0x9')]=_0x3bf9cb[_0xb9ca('0x9')]||'no';this['t38timeout']=_0x3bf9cb[_0xb9ca('0xa')]||0x1388;this[_0xb9ca('0xb')]=_0x3bf9cb[_0xb9ca('0xb')]||'SIP';this[_0xb9ca('0xc')]=_0x3bf9cb[_0xb9ca('0xc')]?_0x3bf9cb['Trunk']:undefined;this[_0xb9ca('0xd')]=_0x3bf9cb[_0xb9ca('0xd')];this['key']=_0x3bf9cb[_0xb9ca('0xe')];}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 593fadc..6def28e 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 _0x2a6d=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x10a0e5,_0x314414){var _0x202eb5=function(_0x3a5879){while(--_0x3a5879){_0x10a0e5['push'](_0x10a0e5['shift']());}};_0x202eb5(++_0x314414);}(_0x2a6d,0x199));var _0xd2a6=function(_0x28f172,_0x1e1d1d){_0x28f172=_0x28f172-0x0;var _0x4435ad=_0x2a6d[_0x28f172];return _0x4435ad;};'use strict';function FreshdeskAccount(_0x3da1e2){this['id']=_0x3da1e2['id']||0x0;this[_0xd2a6('0x0')]=_0x3da1e2['name']||'';this['username']=_0x3da1e2[_0xd2a6('0x1')]||'';this[_0xd2a6('0x2')]=_0x3da1e2[_0xd2a6('0x3')]||'';this[_0xd2a6('0x4')]=_0x3da1e2['remoteUri']||'';this[_0xd2a6('0x5')]=_0x3da1e2[_0xd2a6('0x5')]||'';this[_0xd2a6('0x6')]=_0x3da1e2['Configurations']||{};}module[_0xd2a6('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf30d=['token','remoteUri','exports','name','username'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xf30d,0xd0));var _0xdf30=function(_0x1500a7,_0x591e9a){_0x1500a7=_0x1500a7-0x0;var _0x4a5245=_0xf30d[_0x1500a7];return _0x4a5245;};'use strict';function FreshdeskAccount(_0x2e5014){this['id']=_0x2e5014['id']||0x0;this[_0xdf30('0x0')]=_0x2e5014[_0xdf30('0x0')]||'';this[_0xdf30('0x1')]=_0x2e5014[_0xdf30('0x1')]||'';this['apiKey']=_0x2e5014[_0xdf30('0x2')]||'';this[_0xdf30('0x3')]=_0x2e5014[_0xdf30('0x3')]||'';this['serverUrl']=_0x2e5014['serverUrl']||'';this['Configurations']=_0x2e5014['Configurations']||{};}module[_0xdf30('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5a18f9f..072ab8f 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 _0x544f=['serverUrl','Configurations','username','apiKey','token','remoteUri'];(function(_0x43b99a,_0x50cd1a){var _0xad461f=function(_0x2a1d67){while(--_0x2a1d67){_0x43b99a['push'](_0x43b99a['shift']());}};_0xad461f(++_0x50cd1a);}(_0x544f,0x14c));var _0xf544=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x544f[_0x30c649];return _0x3edfb9;};'use strict';function FreshsalesAccount(_0x363603){this['id']=_0x363603['id']||0x0;this['name']=_0x363603['name']||'';this[_0xf544('0x0')]=_0x363603[_0xf544('0x0')]||'';this[_0xf544('0x1')]=_0x363603[_0xf544('0x2')]||'';this['remoteUri']=_0x363603[_0xf544('0x3')]||'';this[_0xf544('0x4')]=_0x363603['serverUrl']||'';this[_0xf544('0x5')]=_0x363603[_0xf544('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xcddb=['serverUrl','Configurations','name','apiKey','remoteUri'];(function(_0x46fdad,_0x26dedb){var _0x2d2667=function(_0x4cfa78){while(--_0x4cfa78){_0x46fdad['push'](_0x46fdad['shift']());}};_0x2d2667(++_0x26dedb);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x5c51fb,_0x38da04){_0x5c51fb=_0x5c51fb-0x0;var _0x325250=_0xcddb[_0x5c51fb];return _0x325250;};'use strict';function FreshsalesAccount(_0x82d2ab){this['id']=_0x82d2ab['id']||0x0;this[_0xbcdd('0x0')]=_0x82d2ab[_0xbcdd('0x0')]||'';this['username']=_0x82d2ab['username']||'';this[_0xbcdd('0x1')]=_0x82d2ab['token']||'';this[_0xbcdd('0x2')]=_0x82d2ab[_0xbcdd('0x2')]||'';this[_0xbcdd('0x3')]=_0x82d2ab[_0xbcdd('0x3')]||'';this['Configurations']=_0x82d2ab[_0xbcdd('0x4')]||{};}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 fa33012..547727b 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 _0xc2a2=['channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x36c93c,_0x3077c0){var _0x21f1db=function(_0x506866){while(--_0x506866){_0x36c93c['push'](_0x36c93c['shift']());}};_0x21f1db(++_0x3077c0);}(_0xc2a2,0x1df));var _0x2c2a=function(_0x4caacb,_0x130a67){_0x4caacb=_0x4caacb-0x0;var _0xb4857f=_0xc2a2[_0x4caacb];return _0xb4857f;};'use strict';function QueueReport(){this['type']=_0x2c2a('0x0');this[_0x2c2a('0x1')]='';this[_0x2c2a('0x2')]='';this[_0x2c2a('0x3')]='';this['queue']='';this[_0x2c2a('0x4')]=null;this[_0x2c2a('0x5')]=null;this[_0x2c2a('0x6')]=0x1;this['count']=0x1;this[_0x2c2a('0x7')]=![];this[_0x2c2a('0x8')]=null;this[_0x2c2a('0x9')]=![];this[_0x2c2a('0xa')]=null;this[_0x2c2a('0xb')]=![];this[_0x2c2a('0xc')]=null;this[_0x2c2a('0xd')]=0x1;this[_0x2c2a('0xe')]='';this[_0x2c2a('0xf')]='';this[_0x2c2a('0x10')]='';this[_0x2c2a('0x11')]='';this[_0x2c2a('0x12')]='';this[_0x2c2a('0x13')]='';this[_0x2c2a('0x14')]='';this[_0x2c2a('0x15')]=0x0;this[_0x2c2a('0x16')]=![];this[_0x2c2a('0x17')]='';this[_0x2c2a('0x18')]=_0x2c2a('0x19');this[_0x2c2a('0x1a')]=null;this[_0x2c2a('0x1b')]=0x0;this[_0x2c2a('0x1c')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x2b44=['calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinenum','accountcode','context','exten','holdtime','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','type','inbound','uniqueid','calleridnum'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2b44,0xc4));var _0x42b4=function(_0x4318fb,_0x43a8b8){_0x4318fb=_0x4318fb-0x0;var _0x2811bf=_0x2b44[_0x4318fb];return _0x2811bf;};'use strict';function QueueReport(){this[_0x42b4('0x0')]=_0x42b4('0x1');this[_0x42b4('0x2')]='';this[_0x42b4('0x3')]='';this[_0x42b4('0x4')]='';this[_0x42b4('0x5')]='';this[_0x42b4('0x6')]=null;this[_0x42b4('0x7')]=null;this[_0x42b4('0x8')]=0x1;this['count']=0x1;this[_0x42b4('0x9')]=![];this[_0x42b4('0xa')]=null;this[_0x42b4('0xb')]=![];this[_0x42b4('0xc')]=null;this[_0x42b4('0xd')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x42b4('0xe')]='';this['connectedlinename']='';this[_0x42b4('0xf')]='';this[_0x42b4('0x10')]='';this[_0x42b4('0x11')]='';this['priority']='';this[_0x42b4('0x12')]=0x0;this['assigned']=![];this[_0x42b4('0x13')]='';this[_0x42b4('0x14')]=_0x42b4('0x15');this[_0x42b4('0x16')]=null;this[_0x42b4('0x17')]=0x0;this[_0x42b4('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 4b2e20f..839810b 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 _0xd8da=['clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xd8da,0x11d));var _0xad8d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xd8da[_0x1f9f37];return _0x21c080;};'use strict';function SalesforceAccount(_0x4e509c){this['id']=_0x4e509c['id']||0x0;this[_0xad8d('0x0')]=_0x4e509c[_0xad8d('0x0')]||'';this[_0xad8d('0x1')]=_0x4e509c[_0xad8d('0x1')]||'';this[_0xad8d('0x2')]=_0x4e509c[_0xad8d('0x2')]||'';this[_0xad8d('0x3')]=_0x4e509c[_0xad8d('0x3')]||'';this[_0xad8d('0x4')]=_0x4e509c[_0xad8d('0x4')]||'';this[_0xad8d('0x5')]=_0x4e509c[_0xad8d('0x5')]||'';this[_0xad8d('0x6')]=_0x4e509c['securityToken']||'';this[_0xad8d('0x7')]=_0x4e509c[_0xad8d('0x7')]||'integrationTab';this[_0xad8d('0x8')]=_0x4e509c[_0xad8d('0x8')]||'';this[_0xad8d('0x9')]=_0x4e509c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x2243=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x1db5e6,_0x487602){var _0x4635e4=function(_0x5c9774){while(--_0x5c9774){_0x1db5e6['push'](_0x1db5e6['shift']());}};_0x4635e4(++_0x487602);}(_0x2243,0x13b));var _0x3224=function(_0x39ef72,_0x4ce725){_0x39ef72=_0x39ef72-0x0;var _0x358c1f=_0x2243[_0x39ef72];return _0x358c1f;};'use strict';function SalesforceAccount(_0x3840cd){this['id']=_0x3840cd['id']||0x0;this[_0x3224('0x0')]=_0x3840cd[_0x3224('0x0')]||'';this[_0x3224('0x1')]=_0x3840cd[_0x3224('0x1')]||'';this[_0x3224('0x2')]=_0x3840cd[_0x3224('0x2')]||'';this[_0x3224('0x3')]=_0x3840cd[_0x3224('0x3')]||'';this[_0x3224('0x4')]=_0x3840cd[_0x3224('0x4')]||'';this[_0x3224('0x5')]=_0x3840cd[_0x3224('0x5')]||'';this['securityToken']=_0x3840cd[_0x3224('0x6')]||'';this[_0x3224('0x7')]=_0x3840cd[_0x3224('0x7')]||'integrationTab';this[_0x3224('0x8')]=_0x3840cd['serverUrl']||'';this['Configurations']=_0x3840cd[_0x3224('0x9')]||{};}module[_0x3224('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7136b93..90351ba 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 _0x656f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x656f,0xea));var _0xf656=function(_0x19c79a,_0x322073){_0x19c79a=_0x19c79a-0x0;var _0x48ba88=_0x656f[_0x19c79a];return _0x48ba88;};'use strict';function ServicenowAccount(_0x38e315){this['id']=_0x38e315['id']||0x0;this[_0xf656('0x0')]=_0x38e315[_0xf656('0x0')]||'';this['username']=_0x38e315[_0xf656('0x1')]||'';this[_0xf656('0x2')]=_0x38e315[_0xf656('0x2')]||'';this[_0xf656('0x3')]=_0x38e315[_0xf656('0x3')]||'';this[_0xf656('0x4')]=_0x38e315[_0xf656('0x4')]||'';this[_0xf656('0x5')]=_0x38e315[_0xf656('0x5')]||{};}module[_0xf656('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5aea=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x114f25,_0x2202cf){var _0x4940fb=function(_0x304122){while(--_0x304122){_0x114f25['push'](_0x114f25['shift']());}};_0x4940fb(++_0x2202cf);}(_0x5aea,0x14d));var _0xa5ae=function(_0x1faafd,_0x5ee9bc){_0x1faafd=_0x1faafd-0x0;var _0x268e7c=_0x5aea[_0x1faafd];return _0x268e7c;};'use strict';function ServicenowAccount(_0x171d6c){this['id']=_0x171d6c['id']||0x0;this[_0xa5ae('0x0')]=_0x171d6c[_0xa5ae('0x0')]||'';this[_0xa5ae('0x1')]=_0x171d6c[_0xa5ae('0x1')]||'';this['password']=_0x171d6c[_0xa5ae('0x2')]||'';this[_0xa5ae('0x3')]=_0x171d6c[_0xa5ae('0x3')]||'';this[_0xa5ae('0x4')]=_0x171d6c[_0xa5ae('0x4')]||'';this['Configurations']=_0x171d6c[_0xa5ae('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d626cfe..64c8adb 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 _0x15ad=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x149bd6,_0x338853){var _0x28cd8c=function(_0x479167){while(--_0x479167){_0x149bd6['push'](_0x149bd6['shift']());}};_0x28cd8c(++_0x338853);}(_0x15ad,0x1ac));var _0xd15a=function(_0x2dcb48,_0x51a2a1){_0x2dcb48=_0x2dcb48-0x0;var _0x204741=_0x15ad[_0x2dcb48];return _0x204741;};'use strict';function SugarcrmAccount(_0x11a02f){this['id']=_0x11a02f['id']||0x0;this[_0xd15a('0x0')]=_0x11a02f[_0xd15a('0x0')]||'';this[_0xd15a('0x1')]=_0x11a02f['username']||'';this[_0xd15a('0x2')]=_0x11a02f[_0xd15a('0x2')]||'';this[_0xd15a('0x3')]=_0x11a02f['remoteUri']||'';this[_0xd15a('0x4')]=_0x11a02f[_0xd15a('0x4')]||'';this[_0xd15a('0x5')]=_0x11a02f[_0xd15a('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x55ad=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xd48fc9,_0x75602b){var _0x2cfe11=function(_0x5d0b4c){while(--_0x5d0b4c){_0xd48fc9['push'](_0xd48fc9['shift']());}};_0x2cfe11(++_0x75602b);}(_0x55ad,0x108));var _0xd55a=function(_0x53fd5c,_0x3aeecc){_0x53fd5c=_0x53fd5c-0x0;var _0x5a62b4=_0x55ad[_0x53fd5c];return _0x5a62b4;};'use strict';function SugarcrmAccount(_0x385d2f){this['id']=_0x385d2f['id']||0x0;this[_0xd55a('0x0')]=_0x385d2f[_0xd55a('0x0')]||'';this[_0xd55a('0x1')]=_0x385d2f[_0xd55a('0x1')]||'';this[_0xd55a('0x2')]=_0x385d2f['password']||'';this[_0xd55a('0x3')]=_0x385d2f[_0xd55a('0x3')]||'';this[_0xd55a('0x4')]=_0x385d2f[_0xd55a('0x4')]||'';this[_0xd55a('0x5')]=_0x385d2f['Configurations']||{};}module[_0xd55a('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 34defb9..96bb31d 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 _0x241f=['unknown','stateTime','status','address','name','accountcode','state'];(function(_0x4dd566,_0xb70f5a){var _0x57a60f=function(_0x513669){while(--_0x513669){_0x4dd566['push'](_0x4dd566['shift']());}};_0x57a60f(++_0xb70f5a);}(_0x241f,0x123));var _0xf241=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0x241f[_0x1a422a];return _0x4dcab4;};'use strict';function Telephone(_0x2c0b47){this['id']=_0x2c0b47['id']||0x0;this[_0xf241('0x0')]=_0x2c0b47['name']||'';this[_0xf241('0x1')]=_0x2c0b47['accountcode']||'';this[_0xf241('0x2')]=_0xf241('0x3');this[_0xf241('0x4')]=0x0;this[_0xf241('0x5')]=_0xf241('0x3');this[_0xf241('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x2472=['exports','name','unknown','status','address'];(function(_0x5dee5c,_0x36b5a0){var _0x522bc7=function(_0x479f44){while(--_0x479f44){_0x5dee5c['push'](_0x5dee5c['shift']());}};_0x522bc7(++_0x36b5a0);}(_0x2472,0xd8));var _0x2247=function(_0x4a8a82,_0x472090){_0x4a8a82=_0x4a8a82-0x0;var _0x121c44=_0x2472[_0x4a8a82];return _0x121c44;};'use strict';function Telephone(_0x3f6ef9){this['id']=_0x3f6ef9['id']||0x0;this[_0x2247('0x0')]=_0x3f6ef9[_0x2247('0x0')]||'';this['accountcode']=_0x3f6ef9['accountcode']||'';this['state']=_0x2247('0x1');this['stateTime']=0x0;this[_0x2247('0x2')]=_0x2247('0x1');this[_0x2247('0x3')]='';}module[_0x2247('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c2cb09b..88eefb8 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 _0xa9e0=['exports','name'];(function(_0x1e2141,_0x338e4b){var _0xbfee13=function(_0x1de633){while(--_0x1de633){_0x1e2141['push'](_0x1e2141['shift']());}};_0xbfee13(++_0x338e4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0xe60c9d,_0xf31588){var _0xbbfea8=function(_0x50cf19){while(--_0x50cf19){_0xe60c9d['push'](_0xe60c9d['shift']());}};_0xbbfea8(++_0xf31588);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d6d0f,_0x3cf2a5){_0x2d6d0f=_0x2d6d0f-0x0;var _0xd2bee6=_0xb10b[_0x2d6d0f];return _0xd2bee6;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4544af7..49be0bd 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 _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x557ca0,_0x1abf84){var _0x181ca0=function(_0x4a4081){while(--_0x4a4081){_0x557ca0['push'](_0x557ca0['shift']());}};_0x181ca0(++_0x1abf84);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e8aa3,_0x39dc99){_0x3e8aa3=_0x3e8aa3-0x0;var _0x1d2c3e=_0x5f2f[_0x3e8aa3];return _0x1d2c3e;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x5eb8[_0x4480b9];return _0x3f0f02;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}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 c0dbbd0..b2816cb 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 _0xfd99=['refresh','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport'];(function(_0x56975e,_0x587d46){var _0x16c8d2=function(_0x2b52e6){while(--_0x2b52e6){_0x56975e['push'](_0x56975e['shift']());}};_0x16c8d2(++_0x587d46);}(_0xfd99,0xe3));var _0x9fd9=function(_0x59d708,_0x1a2388){_0x59d708=_0x59d708-0x0;var _0x1b3f4d=_0xfd99[_0x59d708];return _0x1b3f4d;};'use strict';function Trunk(_0x3356be){this['id']=_0x3356be['id']||0x0;this[_0x9fd9('0x0')]=_0x3356be[_0x9fd9('0x0')]||![];this[_0x9fd9('0x1')]=_0x3356be['name']||'';this[_0x9fd9('0x2')]=_0x9fd9('0x3');this[_0x9fd9('0x4')]=0x0;this[_0x9fd9('0x5')]=_0x9fd9('0x3');this[_0x9fd9('0x6')]=_0x3356be['registry']&&_0x3356be['registry'][_0x9fd9('0x7')](':')?_0x3356be[_0x9fd9('0x6')][_0x9fd9('0x8')](':')[0x0]:'';this[_0x9fd9('0x9')]='';this[_0x9fd9('0xa')]='';this[_0x9fd9('0xb')]='';this[_0x9fd9('0xc')]='';this[_0x9fd9('0xd')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';this['defaultuser']=_0x3356be['defaultuser']||'';}module[_0x9fd9('0xe')]=Trunk; \ No newline at end of file +var _0x41aa=['stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','refresh'];(function(_0x3709a6,_0x59a1cd){var _0x48d57d=function(_0x12a0f5){while(--_0x12a0f5){_0x3709a6['push'](_0x3709a6['shift']());}};_0x48d57d(++_0x59a1cd);}(_0x41aa,0x18c));var _0xa41a=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x41aa[_0x179e11];return _0x549f04;};'use strict';function Trunk(_0x5abb60){this['id']=_0x5abb60['id']||0x0;this['active']=_0x5abb60[_0xa41a('0x0')]||![];this[_0xa41a('0x1')]=_0x5abb60[_0xa41a('0x1')]||'';this[_0xa41a('0x2')]=_0xa41a('0x3');this[_0xa41a('0x4')]=0x0;this[_0xa41a('0x5')]='unknown';this['registry']=_0x5abb60[_0xa41a('0x6')]&&_0x5abb60[_0xa41a('0x6')][_0xa41a('0x7')](':')?_0x5abb60[_0xa41a('0x6')][_0xa41a('0x8')](':')[0x0]:'';this[_0xa41a('0x9')]='';this['port']='';this[_0xa41a('0xa')]='';this['domainport']='';this[_0xa41a('0xb')]='';this[_0xa41a('0xc')]=_0xa41a('0x3');this[_0xa41a('0xd')]='';this[_0xa41a('0xe')]='';this[_0xa41a('0xf')]=_0x5abb60['defaultuser']||'';}module[_0xa41a('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 af24353..8b0eed3 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 _0x1be9=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0x1be9,0xab));var _0x91be=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1be9[_0x40220a];return _0x3903cc;};'use strict';function voiceExtension(_0xf24e5e){this['id']=_0xf24e5e['id']||0x0;this[_0x91be('0x0')]=_0xf24e5e[_0x91be('0x0')]||'';this[_0x91be('0x1')]=_0xf24e5e[_0x91be('0x1')]||'none';this[_0x91be('0x2')]=_0xf24e5e[_0x91be('0x2')]||![];}module[_0x91be('0x3')]=voiceExtension; \ No newline at end of file +var _0x5180=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x315660,_0x4a3969){var _0x2385d7=function(_0x283515){while(--_0x283515){_0x315660['push'](_0x315660['shift']());}};_0x2385d7(++_0x4a3969);}(_0x5180,0xb2));var _0x0518=function(_0x42f6d1,_0x52c740){_0x42f6d1=_0x42f6d1-0x0;var _0x50ae08=_0x5180[_0x42f6d1];return _0x50ae08;};'use strict';function voiceExtension(_0x380b46){this['id']=_0x380b46['id']||0x0;this[_0x0518('0x0')]=_0x380b46[_0x0518('0x0')]||'';this[_0x0518('0x1')]=_0x380b46['recordingFormat']||_0x0518('0x2');this[_0x0518('0x3')]=_0x380b46[_0x0518('0x3')]||![];}module[_0x0518('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 1853682..63b4596 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 _0xaf79=['wav','gsm','fewestcalls','leastrecent','linear','random','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports'];(function(_0x48c0d3,_0x436608){var _0x2e63f9=function(_0x5bcb9c){while(--_0x5bcb9c){_0x48c0d3['push'](_0x48c0d3['shift']());}};_0x2e63f9(++_0x436608);}(_0xaf79,0x1f0));var _0x9af7=function(_0x1335a4,_0x38fbad){_0x1335a4=_0x1335a4-0x0;var _0x8b933c=_0xaf79[_0x1335a4];return _0x8b933c;};'use strict';var monitorFormat={'wav':_0x9af7('0x0'),'wav49':'wav49','gsm':_0x9af7('0x1')};var strategy={'fewestcalls':_0x9af7('0x2'),'leastrecent':_0x9af7('0x3'),'linear':_0x9af7('0x4'),'random':_0x9af7('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x9af7('0x6')};function VoiceQueue(_0x4391bf){this['id']=_0x4391bf['id']||0x0;this[_0x9af7('0x7')]=_0x4391bf[_0x9af7('0x7')]||'';this['monitor_format']=_0x4391bf[_0x9af7('0x8')]||'';this[_0x9af7('0x9')]=_0x4391bf['type']||_0x9af7('0xa');this[_0x9af7('0xb')]=0x0;this[_0x9af7('0xc')]=0x0;this[_0x9af7('0xd')]=0x0;this['sumDuration']=0x0;this[_0x9af7('0xe')]=0x0;this[_0x9af7('0xf')]=0x0;this[_0x9af7('0x10')]=0x0;this[_0x9af7('0x11')]=0x0;this[_0x9af7('0x12')]=0x0;this[_0x9af7('0x13')]=0x0;this[_0x9af7('0x14')]=0x0;this[_0x9af7('0x15')]=0x0;this[_0x9af7('0x16')]=0x0;this[_0x9af7('0x17')]=0x0;this[_0x9af7('0x18')]=0x0;this[_0x9af7('0x19')]=0x0;this[_0x9af7('0x1a')]=0x0;this[_0x9af7('0x1b')]=0x0;this[_0x9af7('0x1c')]=0x0;this[_0x9af7('0x1d')]=0x0;this['unknown']=0x0;this[_0x9af7('0x1e')]=_0x4391bf[_0x9af7('0x1e')]||![];this[_0x9af7('0x1f')]=_0x4391bf[_0x9af7('0x1f')]||0xa;this[_0x9af7('0x20')]=_0x4391bf[_0x9af7('0x20')]||'no';this[_0x9af7('0x21')]=!![];this['message']='';this[_0x9af7('0x22')]='';this['originated']=0x0;this['temp']=0x0;this[_0x9af7('0x23')]=_0x4391bf[_0x9af7('0x23')]||null;this[_0x9af7('0x24')]=_0x4391bf[_0x9af7('0x24')]?_0x4391bf[_0x9af7('0x24')]:null;this[_0x9af7('0x25')]=_0x4391bf[_0x9af7('0x25')];this[_0x9af7('0x26')]=_0x4391bf[_0x9af7('0x26')]||_0x9af7('0x27');this[_0x9af7('0x28')]=_0x4391bf[_0x9af7('0x28')]||0x0;this['dialLimitQueue']=_0x4391bf[_0x9af7('0x29')]||0x0;this[_0x9af7('0x2a')]=_0x4391bf[_0x9af7('0x2a')]||0x1;this[_0x9af7('0x2b')]=_0x4391bf[_0x9af7('0x2b')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x4391bf[_0x9af7('0x2c')]||0.03;this['dialPredictiveInterval']=_0x4391bf['dialPredictiveInterval']||0x258;this[_0x9af7('0x2d')]=_0x4391bf[_0x9af7('0x2d')]||_0x9af7('0x2e');this['dialOriginateCallerIdNumber']=_0x4391bf['dialOriginateCallerIdNumber']||_0x9af7('0x2e');this[_0x9af7('0x2f')]=_0x4391bf[_0x9af7('0x2f')]||0x1e;this['dialQueueOptions']=_0x4391bf[_0x9af7('0x30')]||'tTxX';this[_0x9af7('0x31')]=_0x4391bf[_0x9af7('0x31')]||0x3;this[_0x9af7('0x32')]=_0x4391bf['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x4391bf['dialCongestionMaxRetry']||0x3;this[_0x9af7('0x33')]=_0x4391bf[_0x9af7('0x33')]||0x96;this[_0x9af7('0x34')]=_0x4391bf[_0x9af7('0x34')]||0x3;this[_0x9af7('0x35')]=_0x4391bf[_0x9af7('0x35')]||0x96;this[_0x9af7('0x36')]=_0x4391bf['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4391bf[_0x9af7('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4391bf[_0x9af7('0x38')]||0x3;this[_0x9af7('0x39')]=_0x4391bf[_0x9af7('0x39')]||0x96;this[_0x9af7('0x3a')]=_0x4391bf[_0x9af7('0x3a')]||0x3;this[_0x9af7('0x3b')]=_0x4391bf[_0x9af7('0x3b')]||0x96;this[_0x9af7('0x3c')]=_0x4391bf[_0x9af7('0x3c')]||0x3;this[_0x9af7('0x3d')]=_0x4391bf[_0x9af7('0x3d')]||0x96;this[_0x9af7('0x3e')]=_0x4391bf[_0x9af7('0x3e')]||0x3;this[_0x9af7('0x3f')]=_0x4391bf[_0x9af7('0x3f')]||0x96;this[_0x9af7('0x40')]=_0x4391bf['dialAgentRejectMaxRetry']||0x3;this[_0x9af7('0x41')]=_0x4391bf['dialAgentRejectRetryFrequency']||0x96;this[_0x9af7('0x42')]=_0x4391bf[_0x9af7('0x42')]||0x3;this[_0x9af7('0x43')]=_0x4391bf['dialGlobalMaxRetry']||0x4;this[_0x9af7('0x44')]=_0x4391bf['Trunk']?_0x4391bf['Trunk']:undefined;this['TrunkBackup']=_0x4391bf[_0x9af7('0x45')]?_0x4391bf[_0x9af7('0x45')]:undefined;this['dialPrefix']=_0x4391bf[_0x9af7('0x46')]||undefined;this[_0x9af7('0x47')]=_0x4391bf[_0x9af7('0x47')]?_0x4391bf[_0x9af7('0x47')]:undefined;this[_0x9af7('0x48')]=_0x4391bf[_0x9af7('0x48')]||_0x9af7('0x49');this[_0x9af7('0x4a')]=_0x4391bf[_0x9af7('0x4a')]||undefined;this[_0x9af7('0x4b')]=_0x4391bf[_0x9af7('0x4b')]||undefined;this[_0x9af7('0x4c')]=strategy[_0x4391bf[_0x9af7('0x4c')]];this['queueStatusComplete']=!![];this[_0x9af7('0x4d')]=_0x4391bf[_0x9af7('0x4d')]||![];this[_0x9af7('0x4e')]=_0x4391bf[_0x9af7('0x4e')];this['dialAMDGreeting']=_0x4391bf['dialAMDGreeting'];this[_0x9af7('0x4f')]=_0x4391bf[_0x9af7('0x4f')];this['dialAMDTotalAnalysisTime']=_0x4391bf[_0x9af7('0x50')];this['dialAMDMinWordLength']=_0x4391bf['dialAMDMinWordLength'];this[_0x9af7('0x51')]=_0x4391bf['dialAMDBetweenWordsSilence'];this[_0x9af7('0x52')]=_0x4391bf['dialAMDMaximumNumberOfWords'];this[_0x9af7('0x53')]=_0x4391bf[_0x9af7('0x53')];this[_0x9af7('0x54')]=_0x4391bf[_0x9af7('0x54')];this[_0x9af7('0x55')]=0x0;this[_0x9af7('0x56')]=0x0;this[_0x9af7('0x57')]=_0x4391bf['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9af7('0x58')]=0x0;this[_0x9af7('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9af7('0x5a')]=0x0;this[_0x9af7('0x5b')]=0x0;this[_0x9af7('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x9af7('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x9af7('0x5e')]=0x0;this[_0x9af7('0x5f')]=0x0;this[_0x9af7('0x60')]=undefined;this[_0x9af7('0x61')]=undefined;this[_0x9af7('0x62')]=undefined;this[_0x9af7('0x63')]=1.05;this[_0x9af7('0x64')]=0x0;this[_0x9af7('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x9af7('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x9af7('0x67')]=0x0;this[_0x9af7('0x68')]=0x0;this[_0x9af7('0x69')]=0x0;this[_0x9af7('0x6a')]=_0x4391bf[_0x9af7('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x4391bf[_0x9af7('0x6b')]||0xa;this[_0x9af7('0x6c')]=0x0;this[_0x9af7('0x6d')]=0x0;this[_0x9af7('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0x9af7('0x6f')]=0x0;this[_0x9af7('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0x9af7('0x71')]=_0x4391bf['dialRecallMeTimeout']||0x1e;this[_0x9af7('0x72')]=_0x4391bf[_0x9af7('0x72')]||![];this[_0x9af7('0x73')]=!!_0x4391bf[_0x9af7('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x4391bf[_0x9af7('0x74')]||![];this[_0x9af7('0x75')]=_0x4391bf[_0x9af7('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x4391bf[_0x9af7('0x76')]||![];this[_0x9af7('0x77')]=_0x4391bf[_0x9af7('0x77')]||![];this[_0x9af7('0x8')]=monitorFormat[_0x4391bf[_0x9af7('0x8')]]?monitorFormat[_0x4391bf[_0x9af7('0x8')]]:undefined;this[_0x9af7('0x78')]=_0x4391bf[_0x9af7('0x78')]||![];this[_0x9af7('0x79')]=_0x4391bf[_0x9af7('0x79')]?_0x4391bf[_0x9af7('0x79')]:undefined;this[_0x9af7('0x7a')]=![];}module[_0x9af7('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x2d95=['dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','onHold','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x55fe87,_0x487778){var _0x2fbf38=function(_0x1410b4){while(--_0x1410b4){_0x55fe87['push'](_0x55fe87['shift']());}};_0x2fbf38(++_0x487778);}(_0x2d95,0xca));var _0x52d9=function(_0x45e163,_0xe8f73b){_0x45e163=_0x45e163-0x0;var _0x2bdc78=_0x2d95[_0x45e163];return _0x2bdc78;};'use strict';var monitorFormat={'wav':_0x52d9('0x0'),'wav49':'wav49','gsm':_0x52d9('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x52d9('0x2'),'linear':_0x52d9('0x3'),'random':_0x52d9('0x4'),'ringall':'ringall','rr':_0x52d9('0x5'),'rrmemory':_0x52d9('0x6'),'rrordered':_0x52d9('0x7'),'wrandom':_0x52d9('0x8')};function VoiceQueue(_0x16eb99){this['id']=_0x16eb99['id']||0x0;this[_0x52d9('0x9')]=_0x16eb99[_0x52d9('0x9')]||'';this[_0x52d9('0xa')]=_0x16eb99[_0x52d9('0xa')]||'';this[_0x52d9('0xb')]=_0x16eb99[_0x52d9('0xb')]||_0x52d9('0xc');this[_0x52d9('0xd')]=0x0;this[_0x52d9('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x52d9('0xf')]=0x0;this[_0x52d9('0x10')]=0x0;this[_0x52d9('0x11')]=0x0;this[_0x52d9('0x12')]=0x0;this[_0x52d9('0x13')]=0x0;this['inUse']=0x0;this[_0x52d9('0x14')]=0x0;this[_0x52d9('0x15')]=0x0;this[_0x52d9('0x16')]=0x0;this[_0x52d9('0x17')]=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0x52d9('0x18')]=0x0;this[_0x52d9('0x19')]=0x0;this[_0x52d9('0x1a')]=0x0;this[_0x52d9('0x1b')]=0x0;this[_0x52d9('0x1c')]=_0x16eb99[_0x52d9('0x1c')]||![];this['acwTimeout']=_0x16eb99[_0x52d9('0x1d')]||0xa;this[_0x52d9('0x1e')]=_0x16eb99[_0x52d9('0x1e')]||'no';this[_0x52d9('0x1f')]=!![];this['message']='';this[_0x52d9('0x20')]='';this['originated']=0x0;this[_0x52d9('0x21')]=0x0;this['dialTimezone']=_0x16eb99[_0x52d9('0x22')]||null;this[_0x52d9('0x23')]=_0x16eb99[_0x52d9('0x23')]?_0x16eb99[_0x52d9('0x23')]:null;this[_0x52d9('0x24')]=_0x16eb99[_0x52d9('0x24')];this[_0x52d9('0x25')]=_0x16eb99['dialMethod']||_0x52d9('0x26');this[_0x52d9('0x27')]=_0x16eb99[_0x52d9('0x27')]||0x0;this[_0x52d9('0x28')]=_0x16eb99['dialLimitQueue']||0x0;this[_0x52d9('0x29')]=_0x16eb99[_0x52d9('0x29')]||0x1;this['dialPredictiveOptimization']=_0x16eb99[_0x52d9('0x2a')]||_0x52d9('0x2b');this[_0x52d9('0x2c')]=_0x16eb99['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x16eb99[_0x52d9('0x2d')]||0x258;this[_0x52d9('0x2e')]=_0x16eb99[_0x52d9('0x2e')]||_0x52d9('0x2f');this[_0x52d9('0x30')]=_0x16eb99[_0x52d9('0x30')]||'anonymous';this['dialOriginateTimeout']=_0x16eb99[_0x52d9('0x31')]||0x1e;this[_0x52d9('0x32')]=_0x16eb99[_0x52d9('0x32')]||_0x52d9('0x33');this[_0x52d9('0x34')]=_0x16eb99['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x16eb99['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x16eb99[_0x52d9('0x35')]||0x3;this['dialCongestionRetryFrequency']=_0x16eb99[_0x52d9('0x36')]||0x96;this['dialBusyMaxRetry']=_0x16eb99[_0x52d9('0x37')]||0x3;this['dialBusyRetryFrequency']=_0x16eb99[_0x52d9('0x38')]||0x96;this[_0x52d9('0x39')]=_0x16eb99[_0x52d9('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0x16eb99[_0x52d9('0x3a')]||0x96;this[_0x52d9('0x3b')]=_0x16eb99[_0x52d9('0x3b')]||0x3;this[_0x52d9('0x3c')]=_0x16eb99[_0x52d9('0x3c')]||0x96;this[_0x52d9('0x3d')]=_0x16eb99[_0x52d9('0x3d')]||0x3;this[_0x52d9('0x3e')]=_0x16eb99[_0x52d9('0x3e')]||0x96;this['dialAbandonedMaxRetry']=_0x16eb99['dialAbandonedMaxRetry']||0x3;this[_0x52d9('0x3f')]=_0x16eb99['dialAbandonedRetryFrequency']||0x96;this[_0x52d9('0x40')]=_0x16eb99[_0x52d9('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x16eb99[_0x52d9('0x41')]||0x96;this[_0x52d9('0x42')]=_0x16eb99['dialAgentRejectMaxRetry']||0x3;this[_0x52d9('0x43')]=_0x16eb99[_0x52d9('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x16eb99[_0x52d9('0x44')]||0x3;this[_0x52d9('0x45')]=_0x16eb99[_0x52d9('0x45')]||0x4;this['Trunk']=_0x16eb99[_0x52d9('0x46')]?_0x16eb99['Trunk']:undefined;this['TrunkBackup']=_0x16eb99[_0x52d9('0x47')]?_0x16eb99[_0x52d9('0x47')]:undefined;this[_0x52d9('0x48')]=_0x16eb99['dialPrefix']||undefined;this[_0x52d9('0x49')]=_0x16eb99[_0x52d9('0x49')]?_0x16eb99[_0x52d9('0x49')]:undefined;this[_0x52d9('0x4a')]=_0x16eb99['dialOrderByScheduledAt']||_0x52d9('0x4b');this[_0x52d9('0x4c')]=_0x16eb99[_0x52d9('0x4c')]||undefined;this['dialCutDigit']=_0x16eb99['dialCutDigit']||undefined;this['strategy']=strategy[_0x16eb99[_0x52d9('0x4d')]];this['queueStatusComplete']=!![];this[_0x52d9('0x4e')]=_0x16eb99['dialAMDActive']||![];this[_0x52d9('0x4f')]=_0x16eb99[_0x52d9('0x4f')];this[_0x52d9('0x50')]=_0x16eb99[_0x52d9('0x50')];this['dialAMDAfterGreetingSilence']=_0x16eb99[_0x52d9('0x51')];this[_0x52d9('0x52')]=_0x16eb99['dialAMDTotalAnalysisTime'];this[_0x52d9('0x53')]=_0x16eb99[_0x52d9('0x53')];this['dialAMDBetweenWordsSilence']=_0x16eb99[_0x52d9('0x54')];this[_0x52d9('0x55')]=_0x16eb99[_0x52d9('0x55')];this[_0x52d9('0x56')]=_0x16eb99[_0x52d9('0x56')];this['dialAMDMaximumWordLength']=_0x16eb99[_0x52d9('0x57')];this['outboundRejectCallsDay']=0x0;this[_0x52d9('0x58')]=0x0;this[_0x52d9('0x59')]=_0x16eb99[_0x52d9('0x59')];this[_0x52d9('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x52d9('0x5b')]=0x0;this[_0x52d9('0x5c')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x52d9('0x5d')]=0x0;this[_0x52d9('0x5e')]=0x0;this[_0x52d9('0x5f')]=0x0;this[_0x52d9('0x60')]=0x0;this[_0x52d9('0x61')]=0x0;this[_0x52d9('0x62')]=0x0;this['outboundReCallsDay']=0x0;this[_0x52d9('0x63')]=0x0;this['startProgressive']=undefined;this[_0x52d9('0x64')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x52d9('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x52d9('0x66')]=0x0;this[_0x52d9('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x52d9('0x68')]=0x0;this[_0x52d9('0x69')]=0x0;this[_0x52d9('0x6a')]=0x0;this[_0x52d9('0x6b')]=_0x16eb99['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x52d9('0x6c')]=_0x16eb99[_0x52d9('0x6d')]||0xa;this[_0x52d9('0x6e')]=0x0;this[_0x52d9('0x6f')]=0x0;this[_0x52d9('0x70')]=0x1;this[_0x52d9('0x71')]=0x0;this['erlangCallToSecond']=0x0;this[_0x52d9('0x72')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x16eb99[_0x52d9('0x73')]||0x1e;this[_0x52d9('0x74')]=_0x16eb99[_0x52d9('0x74')]||![];this[_0x52d9('0x75')]=!!_0x16eb99[_0x52d9('0x75')]||![];this[_0x52d9('0x76')]=!!_0x16eb99[_0x52d9('0x76')]||![];this['dialQueueProject2']=_0x16eb99[_0x52d9('0x77')]||undefined;this[_0x52d9('0x78')]=_0x16eb99[_0x52d9('0x78')]||![];this['dialAgiAfterHangupAgent']=_0x16eb99[_0x52d9('0x79')]||![];this[_0x52d9('0xa')]=monitorFormat[_0x16eb99['monitor_format']]?monitorFormat[_0x16eb99[_0x52d9('0xa')]]:undefined;this['mandatoryDisposition']=_0x16eb99[_0x52d9('0x7a')]||![];this['mandatoryDispositionPause']=_0x16eb99[_0x52d9('0x7b')]?_0x16eb99[_0x52d9('0x7b')]:undefined;this[_0x52d9('0x7c')]=![];}module[_0x52d9('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 945836e..c04e6f7 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f72=['waiting','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAnswerCallsDay','preview','exports','loggedIn','loggedInDb','paused','talking'];(function(_0x2caaff,_0x2de670){var _0x5155a5=function(_0x2b4190){while(--_0x2b4190){_0x2caaff['push'](_0x2caaff['shift']());}};_0x5155a5(++_0x2de670);}(_0x6f72,0xae));var _0x26f7=function(_0x3c81a3,_0x3a53ee){_0x3c81a3=_0x3c81a3-0x0;var _0x323ee1=_0x6f72[_0x3c81a3];return _0x323ee1;};'use strict';var INBOUND_COUNTERS=['available',_0x26f7('0x0'),_0x26f7('0x1'),_0x26f7('0x2'),'ringing',_0x26f7('0x3'),_0x26f7('0x4')];var OUTBOUND_COUNTERS=['available',_0x26f7('0x5'),_0x26f7('0x6'),'loggedIn',_0x26f7('0x1'),'originated',_0x26f7('0x7'),'outboundAnswerCallsDay',_0x26f7('0x8'),_0x26f7('0x9'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x26f7('0xa'),_0x26f7('0xb'),_0x26f7('0xc'),_0x26f7('0xd'),_0x26f7('0x2'),_0x26f7('0xe'),_0x26f7('0x3'),_0x26f7('0xf'),'sumDuration',_0x26f7('0x10'),'waiting'];function VoiceQueueSummary(_0x11d2f0){this['id']=_0x11d2f0['id'];this[_0x26f7('0x11')]=_0x11d2f0[_0x26f7('0x11')];this[_0x26f7('0x12')]=_0x11d2f0[_0x26f7('0x12')];this[_0x26f7('0x13')]=_0x11d2f0[_0x26f7('0x13')]||0x0;this[_0x26f7('0x5')]=_0x11d2f0[_0x26f7('0x5')]||0x0;this[_0x26f7('0x14')]=_0x11d2f0[_0x26f7('0x14')]||0x0;this[_0x26f7('0x15')]=_0x11d2f0['busy']||0x0;this[_0x26f7('0x6')]=_0x11d2f0[_0x26f7('0x6')]||0x0;this[_0x26f7('0x16')]=_0x11d2f0[_0x26f7('0x16')]||0x0;this['loggedIn']=_0x11d2f0[_0x26f7('0x0')]||0x0;this['loggedInDb']=_0x11d2f0[_0x26f7('0x1')]||0x0;this[_0x26f7('0x17')]=_0x11d2f0[_0x26f7('0x17')]||0x0;this[_0x26f7('0x18')]=_0x11d2f0['notInUse']||0x0;this['paused']=_0x11d2f0[_0x26f7('0x2')]||0x0;this['ringing']=_0x11d2f0[_0x26f7('0x19')]||0x0;this[_0x26f7('0x1a')]=_0x11d2f0[_0x26f7('0x1a')];this[_0x26f7('0xf')]=_0x11d2f0[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x11d2f0[_0x26f7('0x1b')];this[_0x26f7('0x1c')]=_0x11d2f0[_0x26f7('0x1c')]||0x0;this[_0x26f7('0x3')]=_0x11d2f0['talking']||0x0;this[_0x26f7('0x10')]=_0x11d2f0[_0x26f7('0x10')]||0x0;this[_0x26f7('0x1d')]=_0x11d2f0[_0x26f7('0x1d')];this[_0x26f7('0x1e')]=_0x11d2f0[_0x26f7('0x1e')]||0x0;this[_0x26f7('0x1f')]=_0x11d2f0[_0x26f7('0x1f')]||0x0;this[_0x26f7('0x20')]=_0x11d2f0[_0x26f7('0x20')]||0x0;this[_0x26f7('0x4')]=_0x11d2f0['waiting']||0x0;if(_0x11d2f0[_0x26f7('0x1d')]==='outbound'){this['pTalking']=_0x11d2f0[_0x26f7('0xe')]||0x0;this[_0x26f7('0x21')]=_0x11d2f0[_0x26f7('0x21')];this[_0x26f7('0x22')]=_0x11d2f0[_0x26f7('0x22')];this['dialOriginateCallerIdName']=_0x11d2f0[_0x26f7('0x23')];this[_0x26f7('0x24')]=_0x11d2f0[_0x26f7('0x24')];this[_0x26f7('0x25')]=_0x11d2f0[_0x26f7('0x25')];this[_0x26f7('0x26')]=_0x11d2f0['dialPrefix'];this[_0x26f7('0x27')]=_0x11d2f0['temp'];this['outboundAnswerAgiCallsDay']=_0x11d2f0[_0x26f7('0x28')];this['outboundAnswerCallsDay']=_0x11d2f0['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x11d2f0[_0x26f7('0x8')];this[_0x26f7('0x9')]=_0x11d2f0[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x11d2f0[_0x26f7('0x29')];this['outboundDropCallsDayACS']=_0x11d2f0[_0x26f7('0x2a')];this['outboundDropCallsDayCallersExit']=_0x11d2f0['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x11d2f0[_0x26f7('0x2b')];this[_0x26f7('0x2c')]=_0x11d2f0[_0x26f7('0x2c')];this[_0x26f7('0xa')]=_0x11d2f0['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x11d2f0['outboundOriginateFailureCallsDay'];this[_0x26f7('0xb')]=_0x11d2f0[_0x26f7('0xb')];this['outboundRejectCallsDay']=_0x11d2f0[_0x26f7('0xc')];this[_0x26f7('0xd')]=_0x11d2f0[_0x26f7('0xd')];this[_0x26f7('0x2d')]=_0x11d2f0[_0x26f7('0x2d')];this[_0x26f7('0x2e')]=_0x11d2f0['predictiveIntervalAvgHoldtime'];this[_0x26f7('0x2f')]=_0x11d2f0[_0x26f7('0x2f')];this[_0x26f7('0x30')]=_0x11d2f0['predictiveIntervalDroppedCallsCallersExit'];this[_0x26f7('0x31')]=_0x11d2f0[_0x26f7('0x31')];this['predictiveIntervalErlangCalls']=_0x11d2f0[_0x26f7('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x11d2f0[_0x26f7('0x33')];this[_0x26f7('0x34')]=_0x11d2f0['predictiveIntervalHitRate'];this[_0x26f7('0x35')]=_0x11d2f0[_0x26f7('0x35')];this[_0x26f7('0x36')]=_0x11d2f0['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x11d2f0[_0x26f7('0x37')];this['predictiveIntervalTotalCalls']=_0x11d2f0[_0x26f7('0x38')];this[_0x26f7('0x39')]=_0x11d2f0[_0x26f7('0x39')];this[_0x26f7('0x3a')]=_0x11d2f0['erlangCalls'];this[_0x26f7('0x3b')]=_0x11d2f0[_0x26f7('0x3b')];this[_0x26f7('0x3c')]=_0x11d2f0[_0x26f7('0x3c')];this[_0x26f7('0x3d')]=_0x11d2f0[_0x26f7('0x3d')];this[_0x26f7('0x3e')]=_0x11d2f0[_0x26f7('0x3e')];this[_0x26f7('0x3f')]=_0x11d2f0[_0x26f7('0x3f')];this[_0x26f7('0x40')]=_0x11d2f0['message'];this[_0x26f7('0x41')]=_0x11d2f0[_0x26f7('0x41')];}if(_0x11d2f0['Trunk']){this[_0x26f7('0x42')]={'id':_0x11d2f0['Trunk']['id'],'name':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x11')],'active':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x43')],'callerid':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x44')]};}}VoiceQueueSummary[_0x26f7('0x45')][_0x26f7('0x46')]=function(_0x478764,_0x130988,_0x1bd16e,_0x2aea16){this['loggedInDb']=0x0;this[_0x26f7('0x3')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x26f7('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x26f7('0x16')]=0x0;this['unavailable']=0x0;this[_0x26f7('0x19')]=0x0;this[_0x26f7('0x1a')]=0x0;this[_0x26f7('0x17')]=0x0;if(_0x1bd16e){if(_0x1bd16e[_0x26f7('0x14')]){this[_0x26f7('0x14')]=Number(_0x1bd16e[_0x26f7('0x14')]);}if(_0x1bd16e[_0x26f7('0x47')]){this[_0x26f7('0x0')]=Number(_0x1bd16e[_0x26f7('0x47')]);}if(_0x1bd16e[_0x26f7('0x48')]){this['waiting']=Number(_0x1bd16e[_0x26f7('0x48')]);}}for(var _0x14890b=0x0;_0x14890b<_0x478764[_0x26f7('0x49')];_0x14890b++){var _0x4bf2a2=_0x130988[_0x26f7('0x4a')+_0x478764[_0x14890b][_0x26f7('0x11')]];if(_0x4bf2a2&&_0x4bf2a2[_0x26f7('0x4b')]){this[_0x26f7('0x1')]+=0x1;}if(_0x478764[_0x14890b][_0x26f7('0x4c')]==='1'){this[_0x26f7('0x3')]+=0x1;}if(_0x478764[_0x14890b]['paused']==='1'&&!['2','7','8']['includes'](_0x478764[_0x14890b][_0x26f7('0x4d')])){this[_0x26f7('0x2')]+=0x1;}switch(_0x478764[_0x14890b][_0x26f7('0x4d')]){case'0':this[_0x26f7('0x1f')]+=0x1;break;case'1':this[_0x26f7('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x26f7('0x15')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x26f7('0x1e')]+=0x1;break;case'6':this[_0x26f7('0x19')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x26f7('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x26f7('0x4e')){var _0x4f4e2b=Object[_0x26f7('0x4f')](_0x2aea16);for(var _0x5d4c93=0x0;_0x5d4c93<_0x4f4e2b[_0x26f7('0x49')];_0x5d4c93++){var _0x37023f=_0x4f4e2b[_0x5d4c93];var _0x121de3=_0x2aea16[_0x37023f];if(_0x121de3['queue']===this[_0x26f7('0x11')]&&_0x121de3[_0x26f7('0x1d')]===_0x26f7('0x50')&&_0x121de3[_0x26f7('0x51')]==='xcally-motion-preview'){this[_0x26f7('0x3')]+=0x1;}}if(this[_0x26f7('0x3')]>this[_0x26f7('0x6')]){this[_0x26f7('0x3')]=this[_0x26f7('0x6')];}this[_0x26f7('0xe')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x26f7('0x52')]=function(_0xa65a9c){var _0x1f4592=![];if(_0xa65a9c){_0x1f4592=INBOUND_COUNTERS[_0x26f7('0x53')](function(_0x5344c8){return this[_0x5344c8]!==_0xa65a9c[_0x5344c8];},this);}return _0x1f4592;};VoiceQueueSummary['prototype'][_0x26f7('0x54')]=function(_0x2c7918){var _0x4f0223=![];var _0x4394c7=![];var _0x410e8e=![];if(_0x2c7918){_0x4f0223=this[_0x26f7('0x22')]!==_0x2c7918[_0x26f7('0x22')]||this[_0x26f7('0x21')]!==_0x2c7918[_0x26f7('0x21')]||this['message']!==_0x2c7918[_0x26f7('0x40')]||this[_0x26f7('0x41')]!==_0x2c7918[_0x26f7('0x41')];_0x4394c7=OUTBOUND_COUNTERS[_0x26f7('0x53')](function(_0x1adf4e){return this[_0x1adf4e]!==_0x2c7918[_0x1adf4e];},this);if(this[_0x26f7('0x42')]&&_0x2c7918['Trunk']){_0x410e8e=this[_0x26f7('0x42')]['name']!==_0x2c7918['Trunk']['name']||this[_0x26f7('0x42')]['active']!==_0x2c7918[_0x26f7('0x42')][_0x26f7('0x43')];}}return _0x4f0223||_0x4394c7||_0x410e8e;};VoiceQueueSummary['prototype'][_0x26f7('0x55')]=function(_0x29ec12){this[_0x26f7('0x5')]=_0x29ec12[_0x26f7('0x5')];this[_0x26f7('0x40')]=_0x29ec12[_0x26f7('0x40')];this[_0x26f7('0x41')]=_0x29ec12[_0x26f7('0x41')];this[_0x26f7('0x39')]=_0x29ec12['originated'];this[_0x26f7('0x7')]=_0x29ec12['outboundAbandonedCallsDay'];this[_0x26f7('0x56')]=_0x29ec12[_0x26f7('0x56')];this[_0x26f7('0x8')]=_0x29ec12[_0x26f7('0x8')];this['outboundBusyCallsDay']=_0x29ec12[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x29ec12[_0x26f7('0x29')];this[_0x26f7('0x2c')]=_0x29ec12[_0x26f7('0x2c')];this['outboundNoSuchCallsDay']=_0x29ec12[_0x26f7('0xa')];this[_0x26f7('0xb')]=_0x29ec12['outboundReCallsDay'];this[_0x26f7('0xc')]=_0x29ec12['outboundRejectCallsDay'];this[_0x26f7('0xd')]=_0x29ec12['outboundUnknownCallsDay'];this['sumBillable']=_0x29ec12[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x29ec12[_0x26f7('0x1b')];this[_0x26f7('0x10')]=_0x29ec12[_0x26f7('0x10')];if(this['dialMethod']===_0x26f7('0x57')){this['pTalking']=_0x29ec12[_0x26f7('0xe')];}};module[_0x26f7('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0xbdb9=['ringing','waiting','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','talking','sumBillable','sumDuration','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','unknown','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','compareToInboundQueue','some','compareToOutboundQueue','outboundUnknownCallsDay','exports','available','loggedIn','loggedInDb','paused'];(function(_0x4858e3,_0x3a40f8){var _0x427ea0=function(_0x47afcf){while(--_0x47afcf){_0x4858e3['push'](_0x4858e3['shift']());}};_0x427ea0(++_0x3a40f8);}(_0xbdb9,0xac));var _0x9bdb=function(_0x1ec5bd,_0x59da28){_0x1ec5bd=_0x1ec5bd-0x0;var _0x519c0c=_0xbdb9[_0x1ec5bd];return _0x519c0c;};'use strict';var INBOUND_COUNTERS=[_0x9bdb('0x0'),_0x9bdb('0x1'),_0x9bdb('0x2'),_0x9bdb('0x3'),_0x9bdb('0x4'),'talking',_0x9bdb('0x5')];var OUTBOUND_COUNTERS=['available','answered','inUse','loggedIn',_0x9bdb('0x2'),'originated',_0x9bdb('0x6'),'outboundAnswerCallsDay',_0x9bdb('0x7'),_0x9bdb('0x8'),_0x9bdb('0x9'),_0x9bdb('0xa'),_0x9bdb('0xb'),_0x9bdb('0xc'),_0x9bdb('0xd'),'outboundUnknownCallsDay',_0x9bdb('0x3'),_0x9bdb('0xe'),_0x9bdb('0xf'),_0x9bdb('0x10'),_0x9bdb('0x11'),'total','waiting'];function VoiceQueueSummary(_0x302f79){this['id']=_0x302f79['id'];this[_0x9bdb('0x12')]=_0x302f79[_0x9bdb('0x12')];this[_0x9bdb('0x13')]=_0x302f79[_0x9bdb('0x13')];this[_0x9bdb('0x14')]=_0x302f79['abandoned']||0x0;this[_0x9bdb('0x15')]=_0x302f79[_0x9bdb('0x15')]||0x0;this[_0x9bdb('0x0')]=_0x302f79[_0x9bdb('0x0')]||0x0;this[_0x9bdb('0x16')]=_0x302f79['busy']||0x0;this[_0x9bdb('0x17')]=_0x302f79[_0x9bdb('0x17')]||0x0;this[_0x9bdb('0x18')]=_0x302f79['invalid']||0x0;this[_0x9bdb('0x1')]=_0x302f79[_0x9bdb('0x1')]||0x0;this[_0x9bdb('0x2')]=_0x302f79[_0x9bdb('0x2')]||0x0;this[_0x9bdb('0x19')]=_0x302f79[_0x9bdb('0x19')]||0x0;this[_0x9bdb('0x1a')]=_0x302f79[_0x9bdb('0x1a')]||0x0;this[_0x9bdb('0x3')]=_0x302f79[_0x9bdb('0x3')]||0x0;this['ringing']=_0x302f79[_0x9bdb('0x4')]||0x0;this[_0x9bdb('0x1b')]=_0x302f79['ringInUse'];this[_0x9bdb('0x10')]=_0x302f79[_0x9bdb('0x10')];this[_0x9bdb('0x11')]=_0x302f79['sumDuration'];this[_0x9bdb('0x1c')]=_0x302f79[_0x9bdb('0x1c')]||0x0;this[_0x9bdb('0xf')]=_0x302f79['talking']||0x0;this[_0x9bdb('0x1d')]=_0x302f79[_0x9bdb('0x1d')]||0x0;this[_0x9bdb('0x1e')]=_0x302f79[_0x9bdb('0x1e')];this[_0x9bdb('0x1f')]=_0x302f79[_0x9bdb('0x1f')]||0x0;this['unknown']=_0x302f79['unknown']||0x0;this[_0x9bdb('0x20')]=_0x302f79[_0x9bdb('0x20')]||0x0;this[_0x9bdb('0x5')]=_0x302f79['waiting']||0x0;if(_0x302f79[_0x9bdb('0x1e')]===_0x9bdb('0x21')){this[_0x9bdb('0xe')]=_0x302f79[_0x9bdb('0xe')]||0x0;this['dialActive']=_0x302f79[_0x9bdb('0x22')];this['dialMethod']=_0x302f79[_0x9bdb('0x23')];this[_0x9bdb('0x24')]=_0x302f79[_0x9bdb('0x24')];this['dialOriginateCallerIdNumber']=_0x302f79[_0x9bdb('0x25')];this[_0x9bdb('0x26')]=_0x302f79[_0x9bdb('0x26')];this[_0x9bdb('0x27')]=_0x302f79[_0x9bdb('0x27')];this[_0x9bdb('0x28')]=_0x302f79[_0x9bdb('0x28')];this[_0x9bdb('0x29')]=_0x302f79[_0x9bdb('0x29')];this[_0x9bdb('0x2a')]=_0x302f79['outboundAnswerCallsDay'];this[_0x9bdb('0x7')]=_0x302f79[_0x9bdb('0x7')];this[_0x9bdb('0x8')]=_0x302f79[_0x9bdb('0x8')];this[_0x9bdb('0x9')]=_0x302f79[_0x9bdb('0x9')];this[_0x9bdb('0x2b')]=_0x302f79['outboundDropCallsDayACS'];this[_0x9bdb('0x2c')]=_0x302f79['outboundDropCallsDayCallersExit'];this[_0x9bdb('0x2d')]=_0x302f79[_0x9bdb('0x2d')];this[_0x9bdb('0xa')]=_0x302f79[_0x9bdb('0xa')];this[_0x9bdb('0xb')]=_0x302f79[_0x9bdb('0xb')];this[_0x9bdb('0x2e')]=_0x302f79['outboundOriginateFailureCallsDay'];this[_0x9bdb('0xc')]=_0x302f79[_0x9bdb('0xc')];this[_0x9bdb('0xd')]=_0x302f79['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x302f79['outboundUnknownCallsDay'];this[_0x9bdb('0x2f')]=_0x302f79['predictiveIntervalAnsweredCalls'];this[_0x9bdb('0x30')]=_0x302f79[_0x9bdb('0x30')];this[_0x9bdb('0x31')]=_0x302f79[_0x9bdb('0x31')];this[_0x9bdb('0x32')]=_0x302f79[_0x9bdb('0x32')];this[_0x9bdb('0x33')]=_0x302f79['predictiveIntervalDroppedCallsTimeout'];this[_0x9bdb('0x34')]=_0x302f79[_0x9bdb('0x34')];this[_0x9bdb('0x35')]=_0x302f79[_0x9bdb('0x35')];this[_0x9bdb('0x36')]=_0x302f79['predictiveIntervalHitRate'];this[_0x9bdb('0x37')]=_0x302f79[_0x9bdb('0x37')];this[_0x9bdb('0x38')]=_0x302f79['predictiveIntervalPauses'];this[_0x9bdb('0x39')]=_0x302f79['predictiveIntervalAvailable'];this[_0x9bdb('0x3a')]=_0x302f79[_0x9bdb('0x3a')];this[_0x9bdb('0x3b')]=_0x302f79['originated'];this['erlangCalls']=_0x302f79['erlangCalls'];this[_0x9bdb('0x3c')]=_0x302f79[_0x9bdb('0x3c')];this['erlangAbandonmentRate']=_0x302f79[_0x9bdb('0x3d')];this['erlangBusyFactor']=_0x302f79[_0x9bdb('0x3e')];this['startPredictive']=_0x302f79[_0x9bdb('0x3f')];this[_0x9bdb('0x40')]=_0x302f79[_0x9bdb('0x40')];this[_0x9bdb('0x41')]=_0x302f79[_0x9bdb('0x41')];this[_0x9bdb('0x42')]=_0x302f79['statusMessage'];}if(_0x302f79[_0x9bdb('0x43')]){this[_0x9bdb('0x43')]={'id':_0x302f79['Trunk']['id'],'name':_0x302f79['Trunk'][_0x9bdb('0x12')],'active':_0x302f79['Trunk'][_0x9bdb('0x44')],'callerid':_0x302f79[_0x9bdb('0x43')]['callerid']};}}VoiceQueueSummary[_0x9bdb('0x45')][_0x9bdb('0x46')]=function(_0x46f516,_0x34ed1b,_0x409128,_0x531331){this[_0x9bdb('0x2')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0x9bdb('0x47')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0x9bdb('0x16')]=0x0;this[_0x9bdb('0x18')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x9bdb('0x1b')]=0x0;this[_0x9bdb('0x19')]=0x0;if(_0x409128){if(_0x409128[_0x9bdb('0x0')]){this[_0x9bdb('0x0')]=Number(_0x409128[_0x9bdb('0x0')]);}if(_0x409128[_0x9bdb('0x48')]){this[_0x9bdb('0x1')]=Number(_0x409128['loggedin']);}if(_0x409128[_0x9bdb('0x49')]){this['waiting']=Number(_0x409128[_0x9bdb('0x49')]);}}for(var _0xc3d229=0x0;_0xc3d229<_0x46f516[_0x9bdb('0x4a')];_0xc3d229++){var _0x1cb63d=_0x34ed1b[_0x9bdb('0x4b')+_0x46f516[_0xc3d229][_0x9bdb('0x12')]];if(_0x1cb63d&&_0x1cb63d[_0x9bdb('0x4c')]){this['loggedInDb']+=0x1;}if(_0x46f516[_0xc3d229][_0x9bdb('0x4d')]==='1'){this[_0x9bdb('0xf')]+=0x1;}if(_0x46f516[_0xc3d229]['paused']==='1'&&!['2','7','8'][_0x9bdb('0x4e')](_0x46f516[_0xc3d229][_0x9bdb('0x4f')])){this[_0x9bdb('0x3')]+=0x1;}switch(_0x46f516[_0xc3d229]['status']){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x9bdb('0x17')]+=0x1;break;case'3':this[_0x9bdb('0x16')]+=0x1;break;case'4':this[_0x9bdb('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x9bdb('0x4')]+=0x1;break;case'7':this[_0x9bdb('0x1b')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x9bdb('0x50')){var _0x47d9b4=Object[_0x9bdb('0x51')](_0x531331);for(var _0x127e5a=0x0;_0x127e5a<_0x47d9b4[_0x9bdb('0x4a')];_0x127e5a++){var _0x14d5c7=_0x47d9b4[_0x127e5a];var _0x34dadd=_0x531331[_0x14d5c7];if(_0x34dadd[_0x9bdb('0x52')]===this[_0x9bdb('0x12')]&&_0x34dadd[_0x9bdb('0x1e')]==='dialer'&&_0x34dadd['exten']==='xcally-motion-preview'){this[_0x9bdb('0xf')]+=0x1;}}if(this[_0x9bdb('0xf')]>this[_0x9bdb('0x17')]){this[_0x9bdb('0xf')]=this[_0x9bdb('0x17')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x9bdb('0x53')]=function(_0x545623){var _0x3ad468=![];if(_0x545623){_0x3ad468=INBOUND_COUNTERS[_0x9bdb('0x54')](function(_0x2f8d10){return this[_0x2f8d10]!==_0x545623[_0x2f8d10];},this);}return _0x3ad468;};VoiceQueueSummary[_0x9bdb('0x45')][_0x9bdb('0x55')]=function(_0x2a59bf){var _0x1dad45=![];var _0x3d0892=![];var _0x49afd7=![];if(_0x2a59bf){_0x1dad45=this[_0x9bdb('0x23')]!==_0x2a59bf[_0x9bdb('0x23')]||this[_0x9bdb('0x22')]!==_0x2a59bf['dialActive']||this['message']!==_0x2a59bf['message']||this['statusMessage']!==_0x2a59bf[_0x9bdb('0x42')];_0x3d0892=OUTBOUND_COUNTERS['some'](function(_0x4e2a95){return this[_0x4e2a95]!==_0x2a59bf[_0x4e2a95];},this);if(this[_0x9bdb('0x43')]&&_0x2a59bf[_0x9bdb('0x43')]){_0x49afd7=this[_0x9bdb('0x43')][_0x9bdb('0x12')]!==_0x2a59bf[_0x9bdb('0x43')][_0x9bdb('0x12')]||this['Trunk']['active']!==_0x2a59bf[_0x9bdb('0x43')]['active'];}}return _0x1dad45||_0x3d0892||_0x49afd7;};VoiceQueueSummary[_0x9bdb('0x45')]['updateReportFromOutboundQueue']=function(_0x282bbe){this['answered']=_0x282bbe[_0x9bdb('0x15')];this['message']=_0x282bbe['message'];this[_0x9bdb('0x42')]=_0x282bbe['statusMessage'];this[_0x9bdb('0x3b')]=_0x282bbe['originated'];this[_0x9bdb('0x6')]=_0x282bbe[_0x9bdb('0x6')];this[_0x9bdb('0x2a')]=_0x282bbe[_0x9bdb('0x2a')];this[_0x9bdb('0x7')]=_0x282bbe[_0x9bdb('0x7')];this[_0x9bdb('0x8')]=_0x282bbe[_0x9bdb('0x8')];this[_0x9bdb('0x9')]=_0x282bbe[_0x9bdb('0x9')];this[_0x9bdb('0xa')]=_0x282bbe[_0x9bdb('0xa')];this[_0x9bdb('0xb')]=_0x282bbe[_0x9bdb('0xb')];this[_0x9bdb('0xc')]=_0x282bbe[_0x9bdb('0xc')];this[_0x9bdb('0xd')]=_0x282bbe[_0x9bdb('0xd')];this[_0x9bdb('0x56')]=_0x282bbe['outboundUnknownCallsDay'];this[_0x9bdb('0x10')]=_0x282bbe[_0x9bdb('0x10')];this[_0x9bdb('0x11')]=_0x282bbe['sumDuration'];this[_0x9bdb('0x1d')]=_0x282bbe[_0x9bdb('0x1d')];if(this[_0x9bdb('0x23')]==='preview'){this[_0x9bdb('0xe')]=_0x282bbe[_0x9bdb('0xe')];}};module[_0x9bdb('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1c5099d..bb30047 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 _0xe852=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1df644,_0x513cd7){var _0x236bdb=function(_0x43bc01){while(--_0x43bc01){_0x1df644['push'](_0x1df644['shift']());}};_0x236bdb(++_0x513cd7);}(_0xe852,0xcc));var _0x2e85=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe852[_0x3ab51d];return _0x29a04e;};'use strict';function VtigerAccount(_0xa0e9da){this['id']=_0xa0e9da['id']||0x0;this[_0x2e85('0x0')]=_0xa0e9da[_0x2e85('0x0')]||'';this[_0x2e85('0x1')]=_0xa0e9da[_0x2e85('0x1')]||'';this[_0x2e85('0x2')]=_0xa0e9da['accessKey']||'';this[_0x2e85('0x3')]=_0xa0e9da[_0x2e85('0x3')]||'';this[_0x2e85('0x4')]=_0xa0e9da[_0x2e85('0x4')]||'';this[_0x2e85('0x5')]=_0xa0e9da[_0x2e85('0x5')]||{};}module[_0x2e85('0x6')]=VtigerAccount; \ No newline at end of file +var _0xf2c5=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf2c5,0x6d));var _0x5f2c=function(_0x55343c,_0x2ab75d){_0x55343c=_0x55343c-0x0;var _0x5677fa=_0xf2c5[_0x55343c];return _0x5677fa;};'use strict';function VtigerAccount(_0x443f31){this['id']=_0x443f31['id']||0x0;this[_0x5f2c('0x0')]=_0x443f31[_0x5f2c('0x0')]||'';this['username']=_0x443f31[_0x5f2c('0x1')]||'';this[_0x5f2c('0x2')]=_0x443f31[_0x5f2c('0x2')]||'';this[_0x5f2c('0x3')]=_0x443f31[_0x5f2c('0x3')]||'';this[_0x5f2c('0x4')]=_0x443f31[_0x5f2c('0x4')]||'';this[_0x5f2c('0x5')]=_0x443f31[_0x5f2c('0x5')]||{};}module[_0x5f2c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e0d5c99..b87c401 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 _0x9c97=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x9c97,0xba));var _0x79c9=function(_0x254bf7,_0x358baa){_0x254bf7=_0x254bf7-0x0;var _0x493010=_0x9c97[_0x254bf7];return _0x493010;};'use strict';function ZendeskAccount(_0x1e8767){this['id']=_0x1e8767['id']||0x0;this[_0x79c9('0x0')]=_0x1e8767['name']||'';this[_0x79c9('0x1')]=_0x1e8767['username']||'';this['password']=_0x1e8767[_0x79c9('0x2')]||'';this['token']=_0x1e8767[_0x79c9('0x3')]||'';this[_0x79c9('0x4')]=_0x1e8767[_0x79c9('0x4')]||'';this[_0x79c9('0x5')]=_0x1e8767[_0x79c9('0x5')]||'';this[_0x79c9('0x6')]=_0x1e8767[_0x79c9('0x6')]||'integrationTab';this[_0x79c9('0x7')]=_0x1e8767[_0x79c9('0x7')]||'';this['Configurations']=_0x1e8767[_0x79c9('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xb9a4=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xb9a4,0x1ef));var _0x4b9a=function(_0x53f005,_0xfae300){_0x53f005=_0x53f005-0x0;var _0x3c3464=_0xb9a4[_0x53f005];return _0x3c3464;};'use strict';function ZendeskAccount(_0x2c06a2){this['id']=_0x2c06a2['id']||0x0;this[_0x4b9a('0x0')]=_0x2c06a2['name']||'';this[_0x4b9a('0x1')]=_0x2c06a2['username']||'';this[_0x4b9a('0x2')]=_0x2c06a2[_0x4b9a('0x2')]||'';this['token']=_0x2c06a2[_0x4b9a('0x3')]||'';this[_0x4b9a('0x4')]=_0x2c06a2[_0x4b9a('0x4')]||'';this[_0x4b9a('0x5')]=_0x2c06a2[_0x4b9a('0x5')]||'';this['type']=_0x2c06a2[_0x4b9a('0x6')]||'integrationTab';this['serverUrl']=_0x2c06a2[_0x4b9a('0x7')]||'';this[_0x4b9a('0x8')]=_0x2c06a2['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4b1dbd9..d685631 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 _0x3460=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3460,0xb5));var _0x0346=function(_0x4d4048,_0x1c040d){_0x4d4048=_0x4d4048-0x0;var _0x9838bf=_0x3460[_0x4d4048];return _0x9838bf;};'use strict';function ZohoAccount(_0x5d716a){this['id']=_0x5d716a['id']||0x0;this[_0x0346('0x0')]=_0x5d716a[_0x0346('0x0')]||'';this['description']=_0x5d716a[_0x0346('0x1')]||'';this[_0x0346('0x2')]=_0x5d716a[_0x0346('0x2')]||'';this[_0x0346('0x3')]=_0x5d716a[_0x0346('0x3')]||'';this[_0x0346('0x4')]=_0x5d716a[_0x0346('0x4')]||'';this[_0x0346('0x5')]=_0x5d716a['clientSecret']||'';this[_0x0346('0x6')]=_0x5d716a[_0x0346('0x6')]||'';this[_0x0346('0x7')]=_0x5d716a[_0x0346('0x7')]||'';this['refreshToken']=_0x5d716a[_0x0346('0x8')]||'';this['Configurations']=_0x5d716a[_0x0346('0x9')]||{};}module[_0x0346('0xa')]=ZohoAccount; \ No newline at end of file +var _0x8834=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x8834,0x1ee));var _0x4883=function(_0x29aa18,_0x2755b3){_0x29aa18=_0x29aa18-0x0;var _0x1d146e=_0x8834[_0x29aa18];return _0x1d146e;};'use strict';function ZohoAccount(_0x2b2f79){this['id']=_0x2b2f79['id']||0x0;this['name']=_0x2b2f79[_0x4883('0x0')]||'';this[_0x4883('0x1')]=_0x2b2f79['description']||'';this[_0x4883('0x2')]=_0x2b2f79[_0x4883('0x2')]||'';this[_0x4883('0x3')]=_0x2b2f79['zone']||'';this['clientId']=_0x2b2f79[_0x4883('0x4')]||'';this[_0x4883('0x5')]=_0x2b2f79['clientSecret']||'';this[_0x4883('0x6')]=_0x2b2f79[_0x4883('0x6')]||'';this[_0x4883('0x7')]=_0x2b2f79[_0x4883('0x7')]||'';this[_0x4883('0x8')]=_0x2b2f79[_0x4883('0x8')]||'';this[_0x4883('0x9')]=_0x2b2f79['Configurations']||{};}module[_0x4883('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 194514e..1239b5e 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 _0x4137=['string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','firstName','Contact','active','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil'];(function(_0x5adeac,_0x33b129){var _0x46f35b=function(_0xeaba66){while(--_0xeaba66){_0x5adeac['push'](_0x5adeac['shift']());}};_0x46f35b(++_0x33b129);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x7413('0x0'));var _=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));function checkNameSurname(_0x4f372c,_0x392ebc,_0x410971){var _0x2e6df7='';if(!_[_0x7413('0x3')](_0x392ebc)&&_0x7413('0x4')===typeof _0x392ebc){_0x2e6df7+=_0x392ebc;}if(!_[_0x7413('0x3')](_0x410971)&&_0x7413('0x4')===typeof _0x410971){_0x2e6df7+='\x20'+_0x410971;}if(_0x2e6df7!==''){return _0x2e6df7;}return _0x4f372c;}function Action(_0x3bb181,_0x4fbade,_0xc808cd,_0x188d89,_0x5b39ac){this[_0x7413('0x5')]=_0xc808cd||undefined;this['idContact']=_0x3bb181['id'];this[_0x7413('0x6')]=_0x4fbade[_0x7413('0x7')];this['type']=_0x4fbade[_0x7413('0x8')];this[_0x7413('0x9')]='queue';this[_0x7413('0xa')]=![];this[_0x7413('0xb')]=_[_0x7413('0x3')](_0x3bb181[_0x7413('0xc')])?undefined:_0x3bb181[_0x7413('0xc')]['name'];this[_0x7413('0xd')]=this[_0x7413('0xb')]?util['format'](_0x7413('0xe'),this[_0x7413('0xb')]):_0x188d89||undefined;this[_0x7413('0xf')]=checkNameSurname(_0x3bb181['Contact']['phone'],_0x3bb181['Contact'][_0x7413('0x10')],_0x3bb181[_0x7413('0x11')]['lastName']);this[_0x7413('0x12')]=_0x3bb181[_0x7413('0x12')]||![];this['calleridnum']=_0x3bb181[_0x7413('0x13')];this['scheduledat']=_0x3bb181['scheduledat'];this[_0x7413('0x14')]=_0x3bb181['countbusyretry']||0x0;this[_0x7413('0x15')]=_0x3bb181['countcongestionretry']||0x0;this[_0x7413('0x16')]=_0x3bb181[_0x7413('0x16')]||0x0;this[_0x7413('0x17')]=(_0x3bb181[_0x7413('0x14')]||0x0)+(_0x3bb181[_0x7413('0x15')]||0x0)+(_0x3bb181[_0x7413('0x16')]||0x0)+(_0x3bb181['countnosuchnumberretry']||0x0)+(_0x3bb181[_0x7413('0x18')]||0x0)+(_0x3bb181[_0x7413('0x19')]||0x0)+(_0x3bb181[_0x7413('0x1a')]||0x0)+(_0x3bb181[_0x7413('0x1b')]||0x0);this['countnosuchnumberretry']=_0x3bb181[_0x7413('0x1c')]||0x0;this[_0x7413('0x18')]=_0x3bb181[_0x7413('0x18')]||0x0;this[_0x7413('0x19')]=_0x3bb181[_0x7413('0x19')]||0x0;this[_0x7413('0x1a')]=_0x3bb181[_0x7413('0x1a')]||0x0;this[_0x7413('0x1b')]=_0x3bb181['countagentrejectretry']||0x0;this['callback']=_0x3bb181[_0x7413('0x1d')];this['callbackuniqueid']=_0x3bb181[_0x7413('0x1e')];this[_0x7413('0x1f')]=_0x3bb181[_0x7413('0x1f')];this[_0x7413('0x20')]=_0x3bb181[_0x7413('0x20')];this[_0x7413('0x21')]=_0x3bb181[_0x7413('0x21')];this[_0x7413('0x22')]=_0x3bb181[_0x7413('0x22')];this['UserId']=_['isNil'](_0x3bb181[_0x7413('0xc')])?_0x3bb181['UserId']:_0x3bb181[_0x7413('0xc')]['id'];this[_0x7413('0x23')]=_0x3bb181[_0x7413('0x23')];this['originatecalleridnum']='';this[_0x7413('0x24')]='';}Action[_0x7413('0x25')][_0x7413('0x26')]=function(){return util[_0x7413('0x27')](_0x7413('0x28'),this[_0x7413('0xf')],this['number']);};module[_0x7413('0x29')]=Action; \ No newline at end of file +var _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0xe76a4a,_0x30091f){var _0x48f480=function(_0x6fc9f6){while(--_0x6fc9f6){_0xe76a4a['push'](_0xe76a4a['shift']());}};_0x48f480(++_0x30091f);}(_0xe511,0x16f));var _0x1e51=function(_0x582e18,_0x4fd856){_0x582e18=_0x582e18-0x0;var _0x445d03=_0xe511[_0x582e18];return _0x445d03;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ee7faff..1c62683 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x503d82,_0x263c1f){var _0x1e2778=function(_0x3967fe){while(--_0x3967fe){_0x503d82['push'](_0x503d82['shift']());}};_0x1e2778(++_0x263c1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0xf491f6,_0x4d2a81){var _0x1d3ef5=function(_0x3dad7e){while(--_0x3dad7e){_0xf491f6['push'](_0xf491f6['shift']());}};_0x1d3ef5(++_0x4d2a81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 00d497b..f61a155 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 _0x1a7a=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type'];(function(_0x2c5f39,_0x472a04){var _0x581642=function(_0x5e4a4e){while(--_0x5e4a4e){_0x2c5f39['push'](_0x2c5f39['shift']());}};_0x581642(++_0x472a04);}(_0x1a7a,0x136));var _0xa1a7=function(_0x9d9d58,_0x7bf873){_0x9d9d58=_0x9d9d58-0x0;var _0x51d4d3=_0x1a7a[_0x9d9d58];return _0x51d4d3;};'use strict';var util=require(_0xa1a7('0x0'));var BPromise=require(_0xa1a7('0x1'));var logger=require(_0xa1a7('0x2'))(_0xa1a7('0x3'));var cmHopper=require(_0xa1a7('0x4'));var cmHopperHistory=require(_0xa1a7('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xa1a7('0x6'));var voiceQueueReport=require(_0xa1a7('0x7'));function loggerCatch(_0x29d08a){return function(_0x1e81d3){logger[_0xa1a7('0x8')](_0x29d08a,util[_0xa1a7('0x9')](_0x1e81d3,{'showHidden':![],'depth':null}));};}function create(_0x3ead6b){return cmHopperHistory[_0xa1a7('0xa')](_0x3ead6b)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2c8164){return BPromise[_0xa1a7('0xb')]()['then'](agentReportPreview[_0xa1a7('0xa')](_0x2c8164))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0xd')));}function moveContact(_0x4397f1){return cmHopper[_0xa1a7('0xe')](_0x4397f1,!![])[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0xf')));}exports[_0xa1a7('0x10')]=function(_0x19d1a7){return cmHopperBlack[_0xa1a7('0x10')](_0x19d1a7)['catch'](loggerCatch(_0xa1a7('0x11')));};exports[_0xa1a7('0x12')]=function(_0x51c903){return BPromise['resolve']()[_0xa1a7('0x13')](cmHopper[_0xa1a7('0x12')](_0x51c903))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x14')));};exports['createHistory']=function(_0x111d94,_0x1516c7){create(_0x111d94)['catch'](loggerCatch(_0x1516c7));moveContact(_0x111d94)[_0xa1a7('0xc')](loggerCatch(_0x1516c7));};exports['createAgentHistory']=function(_0x47e284,_0x19d1e9){createAgent(_0x47e284)[_0xa1a7('0xc')](loggerCatch(_0x19d1e9));};exports[_0xa1a7('0x15')]=function(_0x5102cc,_0x5593d0){create(_0x5102cc)['catch'](loggerCatch(_0x5593d0));};exports['createCustomerFinal']=function(_0x304bcf,_0x29e78f){moveContact(_0x304bcf)['catch'](loggerCatch(_0x29e78f));};exports[_0xa1a7('0x16')]=function(_0x510f61,_0x43aae0,_0x1a0d23){if(_0x43aae0){_0x510f61[_0xa1a7('0x17')]=null;}if(_0x1a0d23){_0x510f61[_0xa1a7('0x18')]=![];}return cmHopper[_0xa1a7('0x16')](_0x510f61)['catch'](loggerCatch(_0xa1a7('0x19')));};exports[_0xa1a7('0x1a')]=function(_0x24db99){return cmHopper['countReScheduled'](_0x24db99)[_0xa1a7('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0xa1a7('0x1b')]=function(_0x235b3d){return cmHopper['unlockContact']({'UserId':null},_0x235b3d,0x1)[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x1c')));};exports[_0xa1a7('0x1d')]=function(_0x3d20b6){return cmHopper['unlockContact']({'active':![]},_0x3d20b6,0x1)[_0xa1a7('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa1a7('0x1e')]=function(_0x2a397b){var _0x216343={};_0x216343[_0xa1a7('0x1f')]=_0x2a397b['type'];_0x216343[_0xa1a7('0x20')]=_0x2a397b[_0xa1a7('0x20')];_0x216343[_0xa1a7('0x21')]=_0x2a397b[_0xa1a7('0x21')];_0x216343[_0xa1a7('0x22')]=_0x2a397b['calleridname'];_0x216343[_0xa1a7('0x23')]=_0x2a397b['queue'];_0x216343[_0xa1a7('0x24')]=_0x2a397b[_0xa1a7('0x25')];_0x216343[_0xa1a7('0x26')]=_0x2a397b[_0xa1a7('0x25')];_0x216343[_0xa1a7('0x27')]=0x1;_0x216343['queuecallercompleteAt']=_0x2a397b[_0xa1a7('0x28')];_0x216343[_0xa1a7('0x29')]=_0x2a397b[_0xa1a7('0x2a')];_0x216343['context']=_0xa1a7('0x2b');_0x216343[_0xa1a7('0x2c')]=_0xa1a7('0x2d');_0x216343[_0xa1a7('0x2e')]=0x0;_0x216343[_0xa1a7('0x2f')]=0x1;_0x216343[_0xa1a7('0x30')]=_0x2a397b['membername'];_0x216343[_0xa1a7('0x31')]=_0xa1a7('0x32');return BPromise['resolve']()[_0xa1a7('0x13')](voiceQueueReport[_0xa1a7('0x33')](_0x216343))['catch'](loggerCatch(_0xa1a7('0x34')));};exports[_0xa1a7('0x35')]=function(_0x213686,_0x1cbd5e){return BPromise[_0xa1a7('0xb')]()[_0xa1a7('0x13')](cmHopper[_0xa1a7('0x35')](_0x213686,_0x1cbd5e))[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x36')));};exports[_0xa1a7('0x37')]=function(_0x4c636c){return cmHopper['rescheduleContact'](_0x4c636c,!![],!![])[_0xa1a7('0xc')](loggerCatch(_0xa1a7('0x38')));}; \ No newline at end of file +var _0x82da=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20'];(function(_0x4874f9,_0x2d352c){var _0x2c8595=function(_0x5bff91){while(--_0x5bff91){_0x4874f9['push'](_0x4874f9['shift']());}};_0x2c8595(++_0x2d352c);}(_0x82da,0x195));var _0xa82d=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x82da[_0x456fb1];return _0x4083d6;};'use strict';var util=require(_0xa82d('0x0'));var BPromise=require(_0xa82d('0x1'));var logger=require(_0xa82d('0x2'))(_0xa82d('0x3'));var cmHopper=require(_0xa82d('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa82d('0x5'));var agentReportPreview=require(_0xa82d('0x6'));var voiceQueueReport=require(_0xa82d('0x7'));function loggerCatch(_0x42f870){return function(_0x4be237){logger[_0xa82d('0x8')](_0x42f870,util[_0xa82d('0x9')](_0x4be237,{'showHidden':![],'depth':null}));};}function create(_0x196b58){return cmHopperHistory[_0xa82d('0xa')](_0x196b58)['catch'](loggerCatch(_0xa82d('0xb')));}function createAgent(_0x4f5fd9){return BPromise['resolve']()[_0xa82d('0xc')](agentReportPreview[_0xa82d('0xa')](_0x4f5fd9))[_0xa82d('0xd')](loggerCatch(_0xa82d('0xb')));}function moveContact(_0x556ed1){return cmHopper[_0xa82d('0xe')](_0x556ed1,!![])[_0xa82d('0xd')](loggerCatch(_0xa82d('0xf')));}exports[_0xa82d('0x10')]=function(_0x17d198){return cmHopperBlack['checkIsBlackList'](_0x17d198)[_0xa82d('0xd')](loggerCatch(_0xa82d('0x11')));};exports[_0xa82d('0x12')]=function(_0x176af7){return BPromise[_0xa82d('0x13')]()[_0xa82d('0xc')](cmHopper[_0xa82d('0x12')](_0x176af7))[_0xa82d('0xd')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x52941f,_0x34bbe0){create(_0x52941f)[_0xa82d('0xd')](loggerCatch(_0x34bbe0));moveContact(_0x52941f)['catch'](loggerCatch(_0x34bbe0));};exports[_0xa82d('0x14')]=function(_0x5ab3f8,_0x331d97){createAgent(_0x5ab3f8)[_0xa82d('0xd')](loggerCatch(_0x331d97));};exports[_0xa82d('0x15')]=function(_0x3a22ae,_0x34dc7d){create(_0x3a22ae)[_0xa82d('0xd')](loggerCatch(_0x34dc7d));};exports[_0xa82d('0x16')]=function(_0x5e5210,_0x2adff0){moveContact(_0x5e5210)[_0xa82d('0xd')](loggerCatch(_0x2adff0));};exports[_0xa82d('0x17')]=function(_0x4b93b6,_0xad6631,_0x2a5bfb){if(_0xad6631){_0x4b93b6['UserId']=null;}if(_0x2a5bfb){_0x4b93b6[_0xa82d('0x18')]=![];}return cmHopper[_0xa82d('0x17')](_0x4b93b6)[_0xa82d('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xa82d('0x19')]=function(_0x3d6504){return cmHopper[_0xa82d('0x19')](_0x3d6504)[_0xa82d('0xd')](loggerCatch(_0xa82d('0x1a')));};exports['unlockContact']=function(_0x491a3c){return cmHopper[_0xa82d('0x1b')]({'UserId':null},_0x491a3c,0x1)[_0xa82d('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0xa82d('0x1c')]=function(_0x546763){return cmHopper[_0xa82d('0x1b')]({'active':![]},_0x546763,0x1)[_0xa82d('0xd')](loggerCatch(_0xa82d('0x1d')));};exports[_0xa82d('0x1e')]=function(_0x55cb8e){var _0x474117={};_0x474117[_0xa82d('0x1f')]=_0x55cb8e['type'];_0x474117[_0xa82d('0x20')]=_0x55cb8e[_0xa82d('0x20')];_0x474117[_0xa82d('0x21')]=_0x55cb8e[_0xa82d('0x21')];_0x474117['calleridname']=_0x55cb8e['calleridname'];_0x474117[_0xa82d('0x22')]=_0x55cb8e[_0xa82d('0x22')];_0x474117[_0xa82d('0x23')]=_0x55cb8e['answertime'];_0x474117[_0xa82d('0x24')]=_0x55cb8e[_0xa82d('0x25')];_0x474117[_0xa82d('0x26')]=0x1;_0x474117[_0xa82d('0x27')]=_0x55cb8e[_0xa82d('0x28')];_0x474117[_0xa82d('0x29')]=_0x55cb8e[_0xa82d('0x2a')];_0x474117['context']='from-sip';_0x474117[_0xa82d('0x2b')]=_0xa82d('0x2c');_0x474117[_0xa82d('0x2d')]=0x0;_0x474117[_0xa82d('0x2e')]=0x1;_0x474117[_0xa82d('0x2f')]=_0x55cb8e['membername'];_0x474117[_0xa82d('0x30')]=_0xa82d('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xa82d('0x32')](_0x474117))['catch'](loggerCatch(_0xa82d('0x33')));};exports['getContactRecallMe']=function(_0x52dc8b,_0x4fbe4c){return BPromise['resolve']()[_0xa82d('0xc')](cmHopper['getContactRecallMe'](_0x52dc8b,_0x4fbe4c))[_0xa82d('0xd')](loggerCatch(_0xa82d('0x34')));};exports[_0xa82d('0x35')]=function(_0x332d5e){return cmHopper[_0xa82d('0x17')](_0x332d5e,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 12c138a..023c0c0 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 _0xc9e6=['XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','inspect','loggerError','error','logger2','info','message','getCallerId','string','isEmpty','format','isActive','addVariables','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','state','ringtime','getSeconds','starttime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','uniqueid','type','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','lodash','moment','../../../../config/logger','preview','env'];(function(_0x42d675,_0x190969){var _0x29f15a=function(_0xca9170){while(--_0xca9170){_0x42d675['push'](_0x42d675['shift']());}};_0x29f15a(++_0x190969);}(_0xc9e6,0x19f));var _0x6c9e=function(_0x461361,_0x3f159f){_0x461361=_0x461361-0x0;var _0x262454=_0xc9e6[_0x461361];return _0x262454;};'use strict';var util=require('util');var _=require(_0x6c9e('0x0'));var moment=require(_0x6c9e('0x1'));var logger=require(_0x6c9e('0x2'))(_0x6c9e('0x3'));var ipAgi=process[_0x6c9e('0x4')][_0x6c9e('0x5')]||_0x6c9e('0x6');var utils=require(_0x6c9e('0x7'));exports[_0x6c9e('0x8')]=function(_0x300235){return function(_0x471869){logger['error'](_0x300235,util['inspect'](_0x471869,{'showHidden':![],'depth':null}));};};exports[_0x6c9e('0x9')]=function(_0x2844db,_0x4e5d0d){logger['info'](_0x2844db,util[_0x6c9e('0xa')](_0x4e5d0d,{'showHidden':![],'depth':null}));};exports[_0x6c9e('0xb')]=function(_0x4877c9,_0x5a036f){logger[_0x6c9e('0xc')](_0x4877c9,util['inspect'](_0x5a036f,{'showHidden':![],'depth':null}));};exports[_0x6c9e('0xd')]=function(_0x54822b){return function(_0x13a10a){logger[_0x6c9e('0xe')](_0x54822b,util[_0x6c9e('0xa')](_0x13a10a,{'showHidden':![],'depth':null}));};};exports[_0x6c9e('0xf')]=function(_0x4f8a5d,_0x19fccc,_0x231677){return{'message':_0x4f8a5d,'unlock':_0x19fccc,'active':_0x231677};};exports[_0x6c9e('0x10')]=function(_0x5bc071,_0x5ef1f3,_0x1dc350){if(!_['isUndefined'](_0x1dc350)&&_0x6c9e('0x11')===typeof _0x1dc350&&!_[_0x6c9e('0x12')](_0x1dc350)){if(!_['isUndefined'](_0x5ef1f3)&&_0x6c9e('0x11')===typeof _0x5ef1f3&&!_[_0x6c9e('0x12')](_0x5ef1f3)){return util['format']('\x22%s\x22\x20<%s>',_0x5ef1f3,_0x1dc350);}return util[_0x6c9e('0x13')]('\x22%s\x22\x20<%s>',_0x1dc350,_0x1dc350);}if(!_['isUndefined'](_0x5bc071)&&'string'===typeof _0x5bc071&&!_[_0x6c9e('0x12')](_0x5bc071)){return _0x5bc071;}return'\x22\x22\x20<>';};exports[_0x6c9e('0x14')]=function(_0x5b05c7){if(_['isNil'](_0x5b05c7)){return![];}return _0x5b05c7;};exports[_0x6c9e('0x15')]=function(_0x18a256,_0x350904,_0x17f12b,_0x275d49,_0x1e42d9,_0x1473c8){var _0x5581d8={'XMD-QUEUE':_0x350904['Queue']?_0x350904['Queue'][_0x6c9e('0x16')]:'','XMD-CALLERID':_0x275d49,'XMD-CALLERID-PREVIEW':_0x1473c8?util['format'](_0x6c9e('0x17'),_0x1473c8[_0x6c9e('0x18')],_0x1473c8[_0x6c9e('0x19')]):_0x275d49,'XMD-DIALID':_0x1e42d9,'XMD-CONTACTID':_0x350904[_0x6c9e('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x275d49,'XMD-VOICEQUEUEID':_0x350904['VoiceQueueId'],'XMD-DIALCHANNEL':_0x17f12b,'XMD-DIALTIMEOUT':_0x18a256[_0x6c9e('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x6c9e('0x13')](_0x6c9e('0x1c'),_0x18a256[_0x6c9e('0x1d')]?'g':'',_[_0x6c9e('0x12')](_0x18a256[_0x6c9e('0x1e')])?'':_0x6c9e('0x1f')),'XMD-DIALURL':_0x18a256['dialPreviewUrl']||'','XMD-AGI':_0x18a256[_0x6c9e('0x20')]?util['format'](_0x6c9e('0x21'),ipAgi,_0x18a256[_0x6c9e('0x20')]):'NONE','XMD-AGIAFTER':_0x18a256['dialQueueProject2']?util[_0x6c9e('0x13')](_0x6c9e('0x21'),ipAgi,_0x18a256[_0x6c9e('0x1d')]):_0x6c9e('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1473c8?_0x1473c8['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1473c8?_0x1473c8['originatecalleridname']:'','XMD-DESTINATION':_0x6c9e('0x23'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x18a256[_0x6c9e('0x1e')])){_0x5581d8[util[_0x6c9e('0x13')]('%s',_0x6c9e('0x24'))]=_0x18a256[_0x6c9e('0x1e')];_0x5581d8[util[_0x6c9e('0x13')]('%s',_0x6c9e('0x25'))]=_0x1e42d9;}return _0x5581d8;};exports[_0x6c9e('0x26')]=function(_0x4a2acb){var _0x33d7b1={};for(var _0x3ed8aa in _0x4a2acb){if(_0x4a2acb[_0x6c9e('0x27')](_0x3ed8aa)){_0x33d7b1[util['format']('%s',_['toLower'](_0x3ed8aa))]=_0x4a2acb[_0x3ed8aa];}}return{'variables':_0x33d7b1};};exports[_0x6c9e('0x28')]=function(_0x18bd76,_0x4f8b93){if(!_[_0x6c9e('0x29')](_0x18bd76)){if(_0x18bd76[_0x6c9e('0x27')]('originated')){if(_0x18bd76[_0x6c9e('0x2a')]>0x0){_0x18bd76['originated']-=0x1;}else{logger[_0x6c9e('0xc')](_0x6c9e('0x2b'),_0x4f8b93);}}}else{logger['error'](_0x6c9e('0x2c'),_0x4f8b93);}};exports[_0x6c9e('0x2d')]=function(_0xc2d04f){var _0x3f5824=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0xc2d04f['state']=0xd;_0xc2d04f[_0x6c9e('0x2f')]=_0x6c9e('0x30');_0xc2d04f['starttime']=_0x3f5824;_0xc2d04f[_0x6c9e('0x31')]=_0x3f5824;_0xc2d04f[_0x6c9e('0x32')]=_0x3f5824;};exports['logAgent']=function(_0x541f44,_0x2eb3a2,_0x3afb9e){var _0x527e1b=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0x541f44[_0x6c9e('0x33')]=_0x2eb3a2;_0x541f44[_0x6c9e('0x2f')]=_0x3afb9e;_0x541f44[_0x6c9e('0x31')]=_0x527e1b;_0x541f44[_0x6c9e('0x34')]=utils[_0x6c9e('0x35')](_0x541f44['responsetime'],_0x541f44[_0x6c9e('0x36')]);};exports['logLookAgent']=function(_0x55daa4,_0x29f544,_0xa5ec84){_0x55daa4[_0x6c9e('0x37')]=_0x29f544;_0x55daa4[_0x6c9e('0x38')]=_0xa5ec84;};exports[_0x6c9e('0x39')]=function(_0x51d08e,_0x28811c,_0x18e246){var _0x1c52ce=moment()[_0x6c9e('0x13')](_0x6c9e('0x2e'));_0x51d08e[_0x6c9e('0x33')]=_0x28811c;_0x51d08e[_0x6c9e('0x2f')]=_0x18e246;_0x51d08e[_0x6c9e('0x31')]=_0x51d08e[_0x6c9e('0x31')]?_0x51d08e[_0x6c9e('0x31')]:_0x1c52ce;_0x51d08e['endtime']=_0x51d08e[_0x6c9e('0x32')]?_0x51d08e[_0x6c9e('0x32')]:_0x1c52ce;_0x51d08e[_0x6c9e('0x34')]=utils[_0x6c9e('0x35')](_0x51d08e[_0x6c9e('0x31')]||0x0,_0x51d08e[_0x6c9e('0x36')]||0x0);_0x51d08e[_0x6c9e('0x3a')]=_0x51d08e[_0x6c9e('0x3b')]?utils[_0x6c9e('0x35')](_0x51d08e[_0x6c9e('0x32')],_0x51d08e[_0x6c9e('0x3b')]):0x0;};exports[_0x6c9e('0x3c')]=function(_0x5d87c0){return _0x5d87c0===_0x6c9e('0x3d');};exports[_0x6c9e('0x3e')]=function(_0x5b59f1,_0x44f098,_0x58d50d,_0x39aa7f,_0x321f5a){var _0x9e0d9b=_0x39aa7f?_0x6c9e('0x3f'):_0x5b59f1['calleridname'];_0x9e0d9b=_0x321f5a?'BOOKED':_0x9e0d9b;return{'actionid':_0x5b59f1['uniqueid'],'action':'originate','channel':_0x5b59f1[_0x6c9e('0x40')],'callerid':util[_0x6c9e('0x13')](_0x6c9e('0x17'),_0x9e0d9b,_0x5b59f1['calleridnum']),'Exten':_0x6c9e('0x23'),'Context':_0x6c9e('0x41'),'Priority':'1','variable':_0x58d50d,'timeout':(_0x44f098[_0x6c9e('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b59f1['uniqueid']};};exports['totalGlobal']=function(_0x2fc50c){return _0x2fc50c[_0x6c9e('0x43')]+_0x2fc50c[_0x6c9e('0x44')]+_0x2fc50c['countnoanswerretry']+_0x2fc50c[_0x6c9e('0x45')]+_0x2fc50c[_0x6c9e('0x46')];};exports['cloneAction']=function(_0x568e7a){var _0x4c6eff=_[_0x6c9e('0x47')](_0x568e7a);_0x4c6eff[_0x6c9e('0x33')]=0xf;_0x4c6eff[_0x6c9e('0x2f')]=_0x6c9e('0x48');return _0x4c6eff;};exports[_0x6c9e('0x49')]=function(_0x155960,_0x4db84d,_0x5966f6){var _0x303315={};_0x303315[_0x4db84d]=_0x155960[_0x4db84d];_0x303315[_0x6c9e('0x4a')]=![];_0x303315[_0x6c9e('0x4b')]=moment()[_0x6c9e('0x4c')](_0x5966f6,_0x6c9e('0x4d'))['format'](_0x6c9e('0x2e'));_0x303315['ContactId']=_0x155960['ContactId'];_0x303315[_0x6c9e('0x4e')]=_0x155960[_0x6c9e('0x4e')];_0x303315[_0x6c9e('0x4f')]=_0x155960[_0x6c9e('0x4f')]||undefined;return _0x303315;};exports['decrementTalkink']=function(_0x93f7d0,_0x484e4b){if(!_['isNil'](_0x93f7d0)){if(_0x93f7d0['pTalking']>0x0){_0x93f7d0[_0x6c9e('0x50')]-=0x1;}else{logger[_0x6c9e('0xc')](_0x484e4b,_0x6c9e('0x51'));}}else{logger[_0x6c9e('0xc')](_0x484e4b,_0x6c9e('0x52'));}};exports['IsNotLoggedIn']=function(_0x4a6320){if(_0x4a6320<=0x0){return!![];}return![];};function buildObj(_0xbe62ac,_0x2fefdd,_0x43192a){_0xbe62ac[_0x6c9e('0x53')]=_0x2fefdd;_0xbe62ac[_0x6c9e('0x16')]=_0xbe62ac[_0x6c9e('0x54')];_0xbe62ac[_0x6c9e('0x55')]=_0xbe62ac[_0x6c9e('0x40')];_0xbe62ac[_0x6c9e('0x56')]=_0x6c9e('0x57');if(_0x43192a){_0xbe62ac[_0x6c9e('0x58')]=_0x43192a[_0x6c9e('0x58')];}return _0xbe62ac;}exports[_0x6c9e('0x59')]=buildObj;exports[_0x6c9e('0x5a')]=function(_0x4ba391){var _0x2d4dbf=[];for(var _0x592dde in _0x4ba391){if(_0x4ba391[_0x6c9e('0x27')](_0x592dde)){if(!_[_0x6c9e('0x29')](_0x4ba391[_0x592dde])&&_0x4ba391[_0x592dde][_0x6c9e('0x33')]===_0x6c9e('0x5b')&&_0x4ba391[_0x592dde]['status']==='reachable'){_0x2d4dbf[_0x6c9e('0x5c')](_0x4ba391[_0x592dde]['id']);}}}return _0x2d4dbf;};exports[_0x6c9e('0x5d')]=function(_0x2f6f52){var _0x3472a9=moment()[_0x6c9e('0x5e')](0x0);var _0x253772=moment(_0x2f6f52)[_0x6c9e('0x5e')](0x0);return _0x3472a9[_0x6c9e('0x5f')](_0x253772,_0x6c9e('0x60'));};exports[_0x6c9e('0x61')]=function(_0x3d8a7e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d8a7e['ContactId'],'ListId':_0x3d8a7e[_0x6c9e('0x4e')],'VoiceQueueId':_0x3d8a7e[_0x6c9e('0x4f')]||undefined,'CampaignId':_0x3d8a7e[_0x6c9e('0x62')]||undefined};};exports[_0x6c9e('0x63')]=function(_0x116346){if(_0x116346===_0x6c9e('0x64')||_0x116346==='idContact'||_0x116346==='queue'||_0x116346===_0x6c9e('0x65')||_0x116346==='campaigntype'||_0x116346===_0x6c9e('0x66')||_0x116346===_0x6c9e('0x37')||_0x116346===_0x6c9e('0x40')||_0x116346===_0x6c9e('0x18')||_0x116346===_0x6c9e('0x4a')||_0x116346===_0x6c9e('0x19')||_0x116346===_0x6c9e('0x4b')||_0x116346===_0x6c9e('0x43')||_0x116346==='countcongestionretry'||_0x116346===_0x6c9e('0x67')||_0x116346===_0x6c9e('0x68')||_0x116346===_0x6c9e('0x69')||_0x116346===_0x6c9e('0x6a')||_0x116346===_0x6c9e('0x6b')||_0x116346===_0x6c9e('0x6c')||_0x116346===_0x6c9e('0x1a')||_0x116346===_0x6c9e('0x4e')||_0x116346===_0x6c9e('0x38')||_0x116346===_0x6c9e('0x4f')||_0x116346===_0x6c9e('0x6d')||_0x116346===_0x6c9e('0x6e')||_0x116346===_0x6c9e('0x6f')||_0x116346===_0x6c9e('0x70')||_0x116346==='xmd-listid'||_0x116346==='xmd-dialurl'||_0x116346===_0x6c9e('0x71')||_0x116346===_0x6c9e('0x72')||_0x116346===_0x6c9e('0x73')||_0x116346===_0x6c9e('0x74')||_0x116346==='xmd-contactid'||_0x116346===_0x6c9e('0x75')||_0x116346===_0x6c9e('0x76')||_0x116346===_0x6c9e('0x77')||_0x116346===_0x6c9e('0x78')||_0x116346===_0x6c9e('0x79')||_0x116346===_0x6c9e('0x7a')||_0x116346===_0x6c9e('0x7b')||_0x116346===_0x6c9e('0x7c')||_0x116346===_0x6c9e('0x7d')||_0x116346===_0x6c9e('0x7e')||_0x116346===_0x6c9e('0x7f')||_0x116346===_0x6c9e('0x80')||_0x116346===_0x6c9e('0x79')||_0x116346===_0x6c9e('0x7a')||_0x116346===_0x6c9e('0x7b')||_0x116346===_0x6c9e('0x7c')||_0x116346===_0x6c9e('0x7d')||_0x116346===_0x6c9e('0x7e')||_0x116346==='rtpaudioqosrtt'||_0x116346==='rtpaudioqosrttbridged'||_0x116346==='bridgepeer'||_0x116346===_0x6c9e('0x81')||_0x116346===_0x6c9e('0x33')||_0x116346===_0x6c9e('0x2f')){return![];}return!![];};exports[_0x6c9e('0x82')]=function(_0x54c598,_0x40d322){var _0x2b240a,_0x796c5d,_0x389d2d;if(_0x40d322<=0x0){_0x40d322=0x1;}_0x2b240a=new RegExp(_0x6c9e('0x83')+_0x40d322+'}$');_0x796c5d=Math[_0x6c9e('0x84')](0xa,_0x40d322-0x1);_0x389d2d=Math['pow'](0xa,_0x40d322)-0x1;return util[_0x6c9e('0x13')]('%s',_[_0x6c9e('0x85')](_0x54c598,_0x2b240a,_['random'](_0x796c5d,_0x389d2d)));};exports[_0x6c9e('0x86')]=function(_0x2189e8){var _0x11f2fb=_0x2189e8[_0x6c9e('0x87')](/"(.*?)"/);return _0x11f2fb?_0x11f2fb[0x1]:_0x2189e8;};exports['extractCalleridNumber']=function(_0x5d5800){var _0x148991=_0x5d5800[_0x6c9e('0x87')](/<(.*?)>/);return _0x148991?_0x148991[0x1]:_0x5d5800;};function buildNoAnswerEventPayload(_0x4e19ce,_0x54f4fc){var _0x45374d=buildObj(_0x4e19ce,_0x6c9e('0x88'));if(!_[_0x6c9e('0x12')](_0x54f4fc[_0x6c9e('0x89')])){Object[_0x6c9e('0x8a')](_0x54f4fc[_0x6c9e('0x89')])[_0x6c9e('0x8b')](function(_0x38a6fc){_0x45374d[_0x38a6fc['toLowerCase']()]=_0x54f4fc[_0x6c9e('0x89')][_0x38a6fc];});}return _0x45374d;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xeba3=['interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','callback','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','updateOriginated','hasOwnProperty','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','getSeconds','membername','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xeba3,0x1ec));var _0x3eba=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xeba3[_0x580576];return _0x3f55a0;};'use strict';var util=require(_0x3eba('0x0'));var _=require(_0x3eba('0x1'));var moment=require('moment');var logger=require(_0x3eba('0x2'))(_0x3eba('0x3'));var ipAgi=process['env'][_0x3eba('0x4')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x3eba('0x5')]=function(_0x3fe566){return function(_0x241cf4){logger[_0x3eba('0x6')](_0x3fe566,util[_0x3eba('0x7')](_0x241cf4,{'showHidden':![],'depth':null}));};};exports[_0x3eba('0x8')]=function(_0x1eaf86,_0x2136fb){logger[_0x3eba('0x9')](_0x1eaf86,util['inspect'](_0x2136fb,{'showHidden':![],'depth':null}));};exports[_0x3eba('0xa')]=function(_0x5d7c6a,_0x2e9d96){logger[_0x3eba('0x6')](_0x5d7c6a,util[_0x3eba('0x7')](_0x2e9d96,{'showHidden':![],'depth':null}));};exports[_0x3eba('0xb')]=function(_0x3194f8){return function(_0x5d8c1a){logger['info'](_0x3194f8,util['inspect'](_0x5d8c1a,{'showHidden':![],'depth':null}));};};exports[_0x3eba('0xc')]=function(_0x2e6dc5,_0x7f9cf6,_0x2d5338){return{'message':_0x2e6dc5,'unlock':_0x7f9cf6,'active':_0x2d5338};};exports['getCallerId']=function(_0x4b9b33,_0xebb229,_0x2112a4){if(!_['isUndefined'](_0x2112a4)&&_0x3eba('0xd')===typeof _0x2112a4&&!_[_0x3eba('0xe')](_0x2112a4)){if(!_['isUndefined'](_0xebb229)&&_0x3eba('0xd')===typeof _0xebb229&&!_[_0x3eba('0xe')](_0xebb229)){return util['format'](_0x3eba('0xf'),_0xebb229,_0x2112a4);}return util[_0x3eba('0x10')]('\x22%s\x22\x20<%s>',_0x2112a4,_0x2112a4);}if(!_[_0x3eba('0x11')](_0x4b9b33)&&_0x3eba('0xd')===typeof _0x4b9b33&&!_[_0x3eba('0xe')](_0x4b9b33)){return _0x4b9b33;}return _0x3eba('0x12');};exports[_0x3eba('0x13')]=function(_0x43ae58){if(_[_0x3eba('0x14')](_0x43ae58)){return![];}return _0x43ae58;};exports[_0x3eba('0x15')]=function(_0x40420b,_0x4de708,_0x4f2428,_0x462939,_0x51f603,_0x886935){var _0x3be915={'XMD-QUEUE':_0x4de708[_0x3eba('0x16')]?_0x4de708[_0x3eba('0x16')][_0x3eba('0x17')]:'','XMD-CALLERID':_0x462939,'XMD-CALLERID-PREVIEW':_0x886935?util['format']('\x22%s\x22\x20<%s>',_0x886935[_0x3eba('0x18')],_0x886935['calleridnum']):_0x462939,'XMD-DIALID':_0x51f603,'XMD-CONTACTID':_0x4de708[_0x3eba('0x19')],'XMD-CDRTYPE':_0x3eba('0x1a'),'CALLERID(all)':_0x462939,'XMD-VOICEQUEUEID':_0x4de708[_0x3eba('0x1b')],'XMD-DIALCHANNEL':_0x4f2428,'XMD-DIALTIMEOUT':_0x40420b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x3eba('0x10')]('\x22rtTxX%s%s\x22',_0x40420b[_0x3eba('0x1c')]?'g':'',_[_0x3eba('0xe')](_0x40420b[_0x3eba('0x1d')])?'':_0x3eba('0x1e')),'XMD-DIALURL':_0x40420b[_0x3eba('0x1f')]||'','XMD-AGI':_0x40420b[_0x3eba('0x20')]?util[_0x3eba('0x10')](_0x3eba('0x21'),ipAgi,_0x40420b['dialQueueProject']):_0x3eba('0x22'),'XMD-AGIAFTER':_0x40420b['dialQueueProject2']?util['format'](_0x3eba('0x21'),ipAgi,_0x40420b[_0x3eba('0x1c')]):_0x3eba('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x886935?_0x886935[_0x3eba('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x886935?_0x886935[_0x3eba('0x24')]:'','XMD-DESTINATION':_0x3eba('0x25'),'SIPADDHEADER':_0x3eba('0x26')};if(!_[_0x3eba('0xe')](_0x40420b['monitor_format'])){_0x3be915[util['format']('%s',_0x3eba('0x27'))]=_0x40420b[_0x3eba('0x1d')];_0x3be915[util[_0x3eba('0x10')]('%s',_0x3eba('0x28'))]=_0x51f603;}return _0x3be915;};exports['toLowerVariables']=function(_0x3e9e71){var _0x1e64e8={};for(var _0x3f84ca in _0x3e9e71){if(_0x3e9e71['hasOwnProperty'](_0x3f84ca)){_0x1e64e8[util[_0x3eba('0x10')]('%s',_['toLower'](_0x3f84ca))]=_0x3e9e71[_0x3f84ca];}}return{'variables':_0x1e64e8};};exports[_0x3eba('0x29')]=function(_0x3b0d27,_0x51c938){if(!_[_0x3eba('0x14')](_0x3b0d27)){if(_0x3b0d27[_0x3eba('0x2a')](_0x3eba('0x2b'))){if(_0x3b0d27[_0x3eba('0x2b')]>0x0){_0x3b0d27[_0x3eba('0x2b')]-=0x1;}else{logger[_0x3eba('0x6')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x51c938);}}}else{logger[_0x3eba('0x6')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x51c938);}};exports[_0x3eba('0x2c')]=function(_0xac1ae4){var _0x314ae9=moment()[_0x3eba('0x10')](_0x3eba('0x2d'));_0xac1ae4['state']=0xd;_0xac1ae4[_0x3eba('0x2e')]=_0x3eba('0x2f');_0xac1ae4[_0x3eba('0x30')]=_0x314ae9;_0xac1ae4[_0x3eba('0x31')]=_0x314ae9;_0xac1ae4['endtime']=_0x314ae9;};exports[_0x3eba('0x32')]=function(_0x286264,_0x1a5f83,_0x744abe){var _0x2b7ab1=moment()[_0x3eba('0x10')](_0x3eba('0x2d'));_0x286264[_0x3eba('0x33')]=_0x1a5f83;_0x286264['statedesc']=_0x744abe;_0x286264[_0x3eba('0x31')]=_0x2b7ab1;_0x286264[_0x3eba('0x34')]=utils[_0x3eba('0x35')](_0x286264[_0x3eba('0x31')],_0x286264[_0x3eba('0x30')]);};exports['logLookAgent']=function(_0x1a5dc6,_0x43f2e8,_0x1bc603){_0x1a5dc6[_0x3eba('0x36')]=_0x43f2e8;_0x1a5dc6['UserId']=_0x1bc603;};exports['logCustomer']=function(_0x1491b8,_0x25a4b1,_0x35b83a){var _0x21eda6=moment()[_0x3eba('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x1491b8[_0x3eba('0x33')]=_0x25a4b1;_0x1491b8[_0x3eba('0x2e')]=_0x35b83a;_0x1491b8[_0x3eba('0x31')]=_0x1491b8[_0x3eba('0x31')]?_0x1491b8[_0x3eba('0x31')]:_0x21eda6;_0x1491b8[_0x3eba('0x37')]=_0x1491b8[_0x3eba('0x37')]?_0x1491b8[_0x3eba('0x37')]:_0x21eda6;_0x1491b8[_0x3eba('0x34')]=utils[_0x3eba('0x35')](_0x1491b8[_0x3eba('0x31')]||0x0,_0x1491b8[_0x3eba('0x30')]||0x0);_0x1491b8[_0x3eba('0x38')]=_0x1491b8[_0x3eba('0x39')]?utils[_0x3eba('0x35')](_0x1491b8[_0x3eba('0x37')],_0x1491b8[_0x3eba('0x39')]):0x0;};exports[_0x3eba('0x3a')]=function(_0x40dcd7){return _0x40dcd7===_0x3eba('0x3b');};exports[_0x3eba('0x3c')]=function(_0x43b8c8,_0x51f7f7,_0x4e51d0,_0x4c5dcd,_0x135fa5){var _0x250c59=_0x4c5dcd?_0x3eba('0x3d'):_0x43b8c8[_0x3eba('0x18')];_0x250c59=_0x135fa5?_0x3eba('0x3e'):_0x250c59;return{'actionid':_0x43b8c8[_0x3eba('0x3f')],'action':_0x3eba('0x40'),'channel':_0x43b8c8[_0x3eba('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x250c59,_0x43b8c8[_0x3eba('0x42')]),'Exten':_0x3eba('0x25'),'Context':'from-sip','Priority':'1','variable':_0x4e51d0,'timeout':(_0x51f7f7[_0x3eba('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43b8c8['uniqueid']};};exports[_0x3eba('0x44')]=function(_0x5ba64e){return _0x5ba64e[_0x3eba('0x45')]+_0x5ba64e[_0x3eba('0x46')]+_0x5ba64e[_0x3eba('0x47')]+_0x5ba64e[_0x3eba('0x48')]+_0x5ba64e[_0x3eba('0x49')];};exports[_0x3eba('0x4a')]=function(_0x400613){var _0x319bed=_['clone'](_0x400613);_0x319bed[_0x3eba('0x33')]=0xf;_0x319bed[_0x3eba('0x2e')]=_0x3eba('0x4b');return _0x319bed;};exports[_0x3eba('0x4c')]=function(_0x421c66,_0x1203a8,_0x57bad4){var _0x836507={};_0x836507[_0x1203a8]=_0x421c66[_0x1203a8];_0x836507[_0x3eba('0x4d')]=![];_0x836507[_0x3eba('0x4e')]=moment()['add'](_0x57bad4,_0x3eba('0x4f'))[_0x3eba('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x836507['ContactId']=_0x421c66[_0x3eba('0x19')];_0x836507[_0x3eba('0x50')]=_0x421c66[_0x3eba('0x50')];_0x836507[_0x3eba('0x1b')]=_0x421c66[_0x3eba('0x1b')]||undefined;return _0x836507;};exports[_0x3eba('0x51')]=function(_0x28dbcb,_0x57770a){if(!_['isNil'](_0x28dbcb)){if(_0x28dbcb[_0x3eba('0x52')]>0x0){_0x28dbcb[_0x3eba('0x52')]-=0x1;}else{logger[_0x3eba('0x6')](_0x57770a,_0x3eba('0x53'));}}else{logger[_0x3eba('0x6')](_0x57770a,_0x3eba('0x54'));}};exports[_0x3eba('0x55')]=function(_0x2790f9){if(_0x2790f9<=0x0){return!![];}return![];};function buildObj(_0x5dea24,_0x310e0f,_0x4e580a){_0x5dea24[_0x3eba('0x56')]=_0x310e0f;_0x5dea24[_0x3eba('0x17')]=_0x5dea24[_0x3eba('0x57')];_0x5dea24[_0x3eba('0x58')]=_0x5dea24[_0x3eba('0x41')];_0x5dea24[_0x3eba('0x59')]=_0x3eba('0x5a');if(_0x4e580a){_0x5dea24[_0x3eba('0x5b')]=_0x4e580a['mandatoryDisposition'];}return _0x5dea24;}exports[_0x3eba('0x5c')]=buildObj;exports[_0x3eba('0x5d')]=function(_0x2de167){var _0x14c257=[];for(var _0x1a52b1 in _0x2de167){if(_0x2de167[_0x3eba('0x2a')](_0x1a52b1)){if(!_[_0x3eba('0x14')](_0x2de167[_0x1a52b1])&&_0x2de167[_0x1a52b1][_0x3eba('0x33')]===_0x3eba('0x5e')&&_0x2de167[_0x1a52b1][_0x3eba('0x5f')]===_0x3eba('0x60')){_0x14c257[_0x3eba('0x61')](_0x2de167[_0x1a52b1]['id']);}}}return _0x14c257;};exports[_0x3eba('0x62')]=function(_0x5b2861){var _0x780afc=moment()[_0x3eba('0x63')](0x0);var _0x2a7c8a=moment(_0x5b2861)['milliseconds'](0x0);return _0x780afc[_0x3eba('0x64')](_0x2a7c8a,_0x3eba('0x65'));};exports[_0x3eba('0x66')]=function(_0x14d439){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x14d439[_0x3eba('0x19')],'ListId':_0x14d439[_0x3eba('0x50')],'VoiceQueueId':_0x14d439['VoiceQueueId']||undefined,'CampaignId':_0x14d439[_0x3eba('0x67')]||undefined};};exports[_0x3eba('0x68')]=function(_0x27b315){if(_0x27b315==='uniqueid'||_0x27b315===_0x3eba('0x69')||_0x27b315===_0x3eba('0x57')||_0x27b315===_0x3eba('0x6a')||_0x27b315==='campaigntype'||_0x27b315===_0x3eba('0x6b')||_0x27b315===_0x3eba('0x36')||_0x27b315==='channelAgent'||_0x27b315===_0x3eba('0x18')||_0x27b315===_0x3eba('0x4d')||_0x27b315===_0x3eba('0x42')||_0x27b315===_0x3eba('0x4e')||_0x27b315===_0x3eba('0x45')||_0x27b315==='countcongestionretry'||_0x27b315===_0x3eba('0x47')||_0x27b315==='countglobal'||_0x27b315===_0x3eba('0x6c')||_0x27b315==='callbackuniqueid'||_0x27b315==='callbackat'||_0x27b315==='recallme'||_0x27b315==='ContactId'||_0x27b315===_0x3eba('0x50')||_0x27b315===_0x3eba('0x6d')||_0x27b315===_0x3eba('0x1b')||_0x27b315===_0x3eba('0x6e')||_0x27b315===_0x3eba('0x6f')||_0x27b315===_0x3eba('0x70')||_0x27b315===_0x3eba('0x71')||_0x27b315===_0x3eba('0x72')||_0x27b315===_0x3eba('0x73')||_0x27b315===_0x3eba('0x74')||_0x27b315===_0x3eba('0x75')||_0x27b315===_0x3eba('0x76')||_0x27b315===_0x3eba('0x77')||_0x27b315===_0x3eba('0x78')||_0x27b315==='xmd-cdrtype'||_0x27b315===_0x3eba('0x79')||_0x27b315===_0x3eba('0x7a')||_0x27b315===_0x3eba('0x7b')||_0x27b315===_0x3eba('0x7c')||_0x27b315===_0x3eba('0x7d')||_0x27b315===_0x3eba('0x7e')||_0x27b315===_0x3eba('0x7f')||_0x27b315==='rtpaudioqosloss'||_0x27b315===_0x3eba('0x80')||_0x27b315===_0x3eba('0x81')||_0x27b315===_0x3eba('0x82')||_0x27b315===_0x3eba('0x7c')||_0x27b315===_0x3eba('0x7d')||_0x27b315===_0x3eba('0x7e')||_0x27b315===_0x3eba('0x7f')||_0x27b315===_0x3eba('0x83')||_0x27b315===_0x3eba('0x80')||_0x27b315===_0x3eba('0x81')||_0x27b315===_0x3eba('0x82')||_0x27b315==='bridgepeer'||_0x27b315===_0x3eba('0x84')||_0x27b315==='state'||_0x27b315===_0x3eba('0x2e')){return![];}return!![];};exports[_0x3eba('0x85')]=function(_0x2f8bce,_0x53310e){var _0x300b6d,_0x4a867c,_0x216efd;if(_0x53310e<=0x0){_0x53310e=0x1;}_0x300b6d=new RegExp('\x5cw{0,'+_0x53310e+'}$');_0x4a867c=Math[_0x3eba('0x86')](0xa,_0x53310e-0x1);_0x216efd=Math[_0x3eba('0x86')](0xa,_0x53310e)-0x1;return util[_0x3eba('0x10')]('%s',_[_0x3eba('0x87')](_0x2f8bce,_0x300b6d,_[_0x3eba('0x88')](_0x4a867c,_0x216efd)));};exports[_0x3eba('0x89')]=function(_0x5eb17f){var _0x190a61=_0x5eb17f[_0x3eba('0x8a')](/"(.*?)"/);return _0x190a61?_0x190a61[0x1]:_0x5eb17f;};exports[_0x3eba('0x8b')]=function(_0x1dc101){var _0x47b87f=_0x1dc101[_0x3eba('0x8a')](/<(.*?)>/);return _0x47b87f?_0x47b87f[0x1]:_0x1dc101;};function buildNoAnswerEventPayload(_0x54dbcb,_0xc3215b){var _0x1f69ba=buildObj(_0x54dbcb,_0x3eba('0x8c'));if(!_[_0x3eba('0xe')](_0xc3215b[_0x3eba('0x8d')])){Object[_0x3eba('0x8e')](_0xc3215b[_0x3eba('0x8d')])[_0x3eba('0x8f')](function(_0x5015c5){_0x1f69ba[_0x5015c5['toLowerCase']()]=_0xc3215b[_0x3eba('0x8d')][_0x5015c5];});}return _0x1f69ba;}exports[_0x3eba('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4c7b8cb..9eb1ee5 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 _0x5685=['reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x5685,0x94));var _0x5568=function(_0x175f6f,_0x1a4a05){_0x175f6f=_0x175f6f-0x0;var _0x1aa501=_0x5685[_0x175f6f];return _0x1aa501;};'use strict';exports['queueadd']={'queue':{'type':_0x5568('0x0'),'required':!![]},'interface':{'type':_0x5568('0x0'),'required':!![]},'membername':{'type':_0x5568('0x0'),'required':!![]},'penalty':{'type':_0x5568('0x1'),'required':![]},'paused':{'type':_0x5568('0x2'),'required':![]}};exports[_0x5568('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x5568('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x5568('0x0'),'required':!![]},'paused':{'type':_0x5568('0x2')},'reason':{'type':_0x5568('0x0'),'required':![]}};exports[_0x5568('0x4')]={'module':{'type':_0x5568('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x5568('0x0'),'required':!![]}};exports[_0x5568('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x5568('0x0')},'format':{'type':_0x5568('0x0')},'mixmonitorid':{'type':_0x5568('0x0')}};exports[_0x5568('0x6')]={'uniqueid':{'type':_0x5568('0x0'),'required':!![]}};exports[_0x5568('0x7')]={'uniqueid':{'type':_0x5568('0x0'),'required':!![]},'exten':{'type':_0x5568('0x0'),'required':!![]},'context':{'type':_0x5568('0x0')}}; \ No newline at end of file +var _0x9576=['boolean','voicequeuechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9576,0x15f));var _0x6957=function(_0x4d7f63,_0x2c8aae){_0x4d7f63=_0x4d7f63-0x0;var _0x43ce51=_0x9576[_0x4d7f63];return _0x43ce51;};'use strict';exports[_0x6957('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6957('0x1'),'required':!![]},'membername':{'type':_0x6957('0x1'),'required':!![]},'penalty':{'type':_0x6957('0x2'),'required':![]},'paused':{'type':_0x6957('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x6957('0x1'),'required':!![]},'interface':{'type':_0x6957('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x6957('0x1'),'required':!![]},'paused':{'type':_0x6957('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x6957('0x1'),'required':![]}};exports[_0x6957('0x4')]={'uniqueid':{'type':_0x6957('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x6957('0x1')},'mixmonitorid':{'type':_0x6957('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x6957('0x1'),'required':!![]}};exports[_0x6957('0x5')]={'uniqueid':{'type':_0x6957('0x1'),'required':!![]},'exten':{'type':_0x6957('0x1'),'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 f93030a..b00ce48 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x2f5fb2,_0x2a1f66){var _0xd8336a=function(_0x3f93c0){while(--_0x3f93c0){_0x2f5fb2['push'](_0x2f5fb2['shift']());}};_0xd8336a(++_0x2a1f66);}(_0xdb28,0x106));var _0x8db2=function(_0x418694,_0x4a5cd1){_0x418694=_0x418694-0x0;var _0x2162d6=_0xdb28[_0x418694];return _0x2162d6;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x11a916,_0x1e0ddb){var _0x291e1e=function(_0x5c88b3){while(--_0x5c88b3){_0x11a916['push'](_0x11a916['shift']());}};_0x291e1e(++_0x1e0ddb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6a37b61..908d0c5 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d25=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x1f7dd9,_0x299c7f){var _0x1773b8=function(_0x361627){while(--_0x361627){_0x1f7dd9['push'](_0x1f7dd9['shift']());}};_0x1773b8(++_0x299c7f);}(_0x0d25,0x134));var _0x50d2=function(_0x520e16,_0x545cb6){_0x520e16=_0x520e16-0x0;var _0x4771b5=_0x0d25[_0x520e16];return _0x4771b5;};'use strict';function mergeDBDataToRealtime(_0x5baa24,_0x3c89ad){var _0x4bb44b=Object[_0x50d2('0x0')]({},_0x5baa24);for(var _0xdb3872 in _0x3c89ad){if(_0x4bb44b[_0x50d2('0x1')](_0xdb3872)){_0x4bb44b[_0xdb3872]=_0x3c89ad[_0xdb3872];}}return _0x4bb44b;}exports[_0x50d2('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x93e1=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x5b602b,_0x3f84fe){var _0x3d6829=function(_0x44059f){while(--_0x44059f){_0x5b602b['push'](_0x5b602b['shift']());}};_0x3d6829(++_0x3f84fe);}(_0x93e1,0x1c6));var _0x193e=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x93e1[_0x46401e];return _0x447cba;};'use strict';function mergeDBDataToRealtime(_0x56464a,_0x5a265d){var _0x55f33a=Object[_0x193e('0x0')]({},_0x56464a);for(var _0x36265a in _0x5a265d){if(_0x55f33a[_0x193e('0x1')](_0x36265a)){_0x55f33a[_0x36265a]=_0x5a265d[_0x36265a];}}return _0x55f33a;}exports[_0x193e('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7b4403e..c9ceb65 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 _0xad75=['YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','create','match','keys','getCallType','channel','split','getAgentByInternal','outbound','voiceCallReport','destination','exten','queue','context','callerid','calleridnum','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete'];(function(_0xfe8dac,_0x3ec28a){var _0x2fbff7=function(_0x32963f){while(--_0x32963f){_0xfe8dac['push'](_0xfe8dac['shift']());}};_0x2fbff7(++_0x3ec28a);}(_0xad75,0xe0));var _0x5ad7=function(_0x59e880,_0x179562){_0x59e880=_0x59e880-0x0;var _0x5ee0fb=_0xad75[_0x59e880];return _0x5ee0fb;};'use strict';var _=require(_0x5ad7('0x0'));var moment=require(_0x5ad7('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x5ad7('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x5ad7('0x3'));var RpcMemberReport=require(_0x5ad7('0x4'));var RpcVoiceQueueReport=require(_0x5ad7('0x5'));var RpcVoiceRecording=require(_0x5ad7('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x5ad7('0x7'));var VoiceCallReport=require(_0x5ad7('0x8'));var VoiceAgentReport=require(_0x5ad7('0x9'));var VoiceDialReport=require(_0x5ad7('0xa'));var UserReport=require('./userReport');function Report(_0x2b93a2){this[_0x5ad7('0xb')]=_0x2b93a2;this[_0x5ad7('0xc')]=_0x2b93a2[_0x5ad7('0xc')];this['telephones']=_0x2b93a2[_0x5ad7('0xd')];}Report[_0x5ad7('0xe')][_0x5ad7('0xf')]=function(_0x1829bf){var _0x2e20d2=new VoiceQueueReport(this[_0x5ad7('0xb')]);var _0x3a6d3a=new VoiceAgentReport(this[_0x5ad7('0xb')]);var _0x5cf2d8=new VoiceDialReport(this[_0x5ad7('0xb')]);var _0x2a6116=new VoiceCallReport(this[_0x5ad7('0xb')]);var _0x2c0739=new UserReport(this[_0x5ad7('0xb')]);if(config[_0x5ad7('0x10')]&&config[_0x5ad7('0x10')][_0x5ad7('0x11')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on'](_0x5ad7('0x12'),this['voiceCallReport'][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x14'),this[_0x5ad7('0x15')][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x16'),this[_0x5ad7('0x17')][_0x5ad7('0x13')](this));ami['on'](_0x5ad7('0x18'),this[_0x5ad7('0x19')]['bind'](this));ami['on'](_0x5ad7('0x1a'),this[_0x5ad7('0x1b')][_0x5ad7('0x13')](this));}};Report[_0x5ad7('0xe')][_0x5ad7('0x1c')]=function(_0xbeb2c5){var _0x3aa77c;_0x3aa77c=_[_0x5ad7('0x1d')](this[_0x5ad7('0xc')],function(_0xb15a9){return _0xb15a9[_0x5ad7('0x1e')]==_0xbeb2c5||_0xb15a9[_0x5ad7('0x1f')]==_0xbeb2c5;});if(_[_0x5ad7('0x20')](_0x3aa77c)){var _0x297dc1=_['find'](this['telephones'],function(_0x587f6d){return _0x587f6d['accountcode']==_0xbeb2c5||_0x587f6d[_0x5ad7('0x1f')]==_0xbeb2c5;});if(_0x297dc1){_0x3aa77c=_['find'](this[_0x5ad7('0xc')],function(_0x420b91){return _0x420b91[_0x5ad7('0x21')]==util[_0x5ad7('0x22')]('SIP/%s',_0x297dc1['name']);});}}return _0x3aa77c;};Report[_0x5ad7('0xe')]['voiceQueueReport']=function(_0x1acf55){for(var _0x487e59=0x0;_0x487e59<_0x1acf55[_0x5ad7('0x23')];_0x487e59+=0x1){var _0x116795=this[_0x5ad7('0x1c')](_0x1acf55[_0x487e59][_0x5ad7('0x24')]);if(_0x116795){_0x1acf55[_0x487e59]['accountcode']=_0x116795[_0x5ad7('0x1e')];_0x1acf55[_0x487e59][_0x5ad7('0x25')]=!![];_0x1acf55[_0x487e59][_0x5ad7('0x26')]=_0x116795[_0x5ad7('0x1f')];_0x1acf55[_0x487e59][_0x5ad7('0x21')]=_[_0x5ad7('0x20')](_0x116795[_0x5ad7('0x21')])?util[_0x5ad7('0x22')]('SIP/%s',_0x116795[_0x5ad7('0x1f')]):_0x116795['interface'];if(_0x1acf55[_0x487e59][_0x5ad7('0x27')]){_0x1acf55[_0x487e59]['queuecallercompleteAt']=moment()[_0x5ad7('0x22')](_0x5ad7('0x28'));}if(_0x1acf55[_0x487e59]['queuecallerexit']){_0x1acf55[_0x487e59][_0x5ad7('0x29')]=moment()[_0x5ad7('0x22')](_0x5ad7('0x28'));}RpcMemberReport[_0x5ad7('0x2a')](_0x1acf55[_0x487e59]);}RpcVoiceQueueReport[_0x5ad7('0x2b')](_0x1acf55[_0x487e59]);}};function extractCalleridNumber(_0x2cb63c){var _0x1d6624=_0x2cb63c[_0x5ad7('0x2c')](/<(.*?)>/);return _0x1d6624?_0x1d6624[0x1]:_0x2cb63c;}Report[_0x5ad7('0xe')]['getAgentByInternal']=function(_0x11986e){for(var _0x178f52=0x0;_0x178f52','calleridname','transfers'];(function(_0xeaab22,_0x225047){var _0x128d01=function(_0x2feac4){while(--_0x2feac4){_0xeaab22['push'](_0xeaab22['shift']());}};_0x128d01(++_0x225047);}(_0x1259,0x138));var _0x9125=function(_0x51dada,_0x4ddb59){_0x51dada=_0x51dada-0x0;var _0x209d74=_0x1259[_0x51dada];return _0x209d74;};'use strict';var _=require(_0x9125('0x0'));var moment=require('moment');var util=require(_0x9125('0x1'));var config=require(_0x9125('0x2'));var ami=require(_0x9125('0x3'));var RpcVoiceAgentReport=require(_0x9125('0x4'));var RpcVoiceCallReport=require(_0x9125('0x5'));var RpcVoiceDialReport=require(_0x9125('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9125('0x7'));var RpcVoiceTransferReport=require(_0x9125('0x8'));var VoiceQueueReport=require(_0x9125('0x9'));var VoiceCallReport=require(_0x9125('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9125('0xb'));var UserReport=require(_0x9125('0xc'));function Report(_0xf4aa9e){this[_0x9125('0xd')]=_0xf4aa9e;this['agents']=_0xf4aa9e[_0x9125('0xe')];this['telephones']=_0xf4aa9e[_0x9125('0xf')];}Report[_0x9125('0x10')][_0x9125('0x11')]=function(_0x291c2a){var _0xef3516=new VoiceQueueReport(this[_0x9125('0xd')]);var _0x439e8c=new VoiceAgentReport(this[_0x9125('0xd')]);var _0x10d56a=new VoiceDialReport(this[_0x9125('0xd')]);var _0xcedcdc=new VoiceCallReport(this[_0x9125('0xd')]);var _0x128306=new UserReport(this['realtime']);if(config[_0x9125('0x12')]&&config['xdr'][_0x9125('0x13')]){ami['on'](_0x9125('0x14'),this['voiceQueueReport'][_0x9125('0x15')](this));ami['on'](_0x9125('0x16'),this['voiceCallReport']['bind'](this));ami['on'](_0x9125('0x17'),this[_0x9125('0x18')][_0x9125('0x15')](this));ami['on'](_0x9125('0x19'),this['voiceDialReport']['bind'](this));ami['on'](_0x9125('0x1a'),this[_0x9125('0x1b')]['bind'](this));ami['on'](_0x9125('0x1c'),this[_0x9125('0x1d')][_0x9125('0x15')](this));}};Report[_0x9125('0x10')][_0x9125('0x1e')]=function(_0x3a143d){var _0x3b4897;_0x3b4897=_[_0x9125('0x1f')](this[_0x9125('0xe')],function(_0x349321){return _0x349321[_0x9125('0x20')]==_0x3a143d||_0x349321[_0x9125('0x21')]==_0x3a143d;});if(_[_0x9125('0x22')](_0x3b4897)){var _0x8183be=_['find'](this[_0x9125('0xf')],function(_0x318e84){return _0x318e84[_0x9125('0x20')]==_0x3a143d||_0x318e84[_0x9125('0x21')]==_0x3a143d;});if(_0x8183be){_0x3b4897=_['find'](this[_0x9125('0xe')],function(_0x55b850){return _0x55b850[_0x9125('0x23')]==util[_0x9125('0x24')](_0x9125('0x25'),_0x8183be['name']);});}}return _0x3b4897;};Report['prototype'][_0x9125('0x26')]=function(_0x4463c9){for(var _0x252a1d=0x0;_0x252a1d<_0x4463c9['length'];_0x252a1d+=0x1){var _0xf3fca7=this['findAgent'](_0x4463c9[_0x252a1d][_0x9125('0x27')]);if(_0xf3fca7){_0x4463c9[_0x252a1d][_0x9125('0x20')]=_0xf3fca7[_0x9125('0x20')];_0x4463c9[_0x252a1d]['assigned']=!![];_0x4463c9[_0x252a1d][_0x9125('0x28')]=_0xf3fca7['name'];_0x4463c9[_0x252a1d][_0x9125('0x23')]=_[_0x9125('0x22')](_0xf3fca7[_0x9125('0x23')])?util[_0x9125('0x24')]('SIP/%s',_0xf3fca7[_0x9125('0x21')]):_0xf3fca7['interface'];if(_0x4463c9[_0x252a1d][_0x9125('0x29')]){_0x4463c9[_0x252a1d][_0x9125('0x2a')]=moment()[_0x9125('0x24')](_0x9125('0x2b'));}if(_0x4463c9[_0x252a1d][_0x9125('0x2c')]){_0x4463c9[_0x252a1d][_0x9125('0x2d')]=moment()[_0x9125('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x9125('0x26')](_0x4463c9[_0x252a1d]);}RpcVoiceQueueReport[_0x9125('0x2e')](_0x4463c9[_0x252a1d]);}};function extractCalleridNumber(_0x4cdb6b){var _0x3029db=_0x4cdb6b[_0x9125('0x2f')](/<(.*?)>/);return _0x3029db?_0x3029db[0x1]:_0x4cdb6b;}Report[_0x9125('0x10')]['getAgentByInternal']=function(_0x64290f){for(var _0x370de7=0x0;_0x370de70x0?!![]:![];if(!_0x1d9ad9){return this[_0xbf56('0x70')](this[_0xbf56('0x16')]['completeEvent']);}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x1b')]=function(_0x177190){var _0x14a9c2=this[_0xbf56('0x16')]['id'];if(this[_0xbf56('0x16')][_0xbf56('0x66')][_0x14a9c2]&&this['summary'][_0xbf56('0x66')][_0x14a9c2][_0x177190[_0xbf56('0x65')]]){this[_0xbf56('0x16')][_0xbf56('0x66')][_0x14a9c2][_0x177190['actionid']]['agents'][_0xbf56('0x71')](_0x177190);}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x18')]=function(_0x22a24b){var _0x2eb0c6=this;try{if(this[_0xbf56('0x5e')](_0x22a24b)&&this['isNotNull'](_0x22a24b[_0xbf56('0x50')])){logger[_0xbf56('0x52')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x22a24b,{'showHidden':![],'depth':null}));var _0x596f03=this[_0xbf56('0x14')][_0x22a24b[_0xbf56('0x50')]];if(_0x596f03){logger[_0xbf56('0x52')](_0xbf56('0x72'),_0x596f03[_0xbf56('0x5d')]);this['summary']['queues'][_0x596f03['name']]={'summaryEvent':_0x22a24b};this[_0xbf56('0x16')][_0xbf56('0x6f')]+=0x1;return ami['Action']({'action':_0xbf56('0x66'),'queue':_0x596f03[_0xbf56('0x5d')]})[_0xbf56('0x64')](function(_0x2054ed){if(!_0x2eb0c6[_0xbf56('0x16')][_0xbf56('0x66')][_0x22a24b['actionid']]){_0x2eb0c6[_0xbf56('0x16')][_0xbf56('0x66')][_0x22a24b['actionid']]={};}_0x2eb0c6['summary'][_0xbf56('0x66')][_0x22a24b[_0xbf56('0x65')]][_0x2054ed[_0xbf56('0x65')]]={'queue':_0x596f03[_0xbf56('0x5d')],'agents':[]};})[_0xbf56('0x43')](function(_0x5d2303){throw _0x5d2303;});}}}catch(_0x4be757){logger['error'](_0xbf56('0x67'),util[_0xbf56('0x48')](_0x4be757,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')]['syncQueueSummaryComplete']=function(_0x573509){if(this['summary'][_0xbf56('0x6f')]>0x0){this[_0xbf56('0x16')]['completeEvent']=_0x573509;return;}logger['debug'](_0xbf56('0x73'),util[_0xbf56('0x48')](_0x573509,{'showHidden':![],'depth':null}));this[_0xbf56('0x16')]=initializeSummary();ami[_0xbf56('0x4d')](_0xbf56('0x74'),{});};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x1e')]=function(_0x259ecc){try{if(this['isNotNull'](_0x259ecc)){logger['debug'](_0xbf56('0x75'),_0x259ecc[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x259ecc,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xbf56('0x10')][_0x259ecc['uniqueid']])){this[_0xbf56('0x10')][_0x259ecc['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x259ecc[_0xbf56('0x54')]])){this[_0xbf56('0x3d')][_0x259ecc[_0xbf56('0x54')]]={};}var _0x34a256=new QueueReport();_0x34a256[_0xbf56('0x50')]=_0x259ecc['queue'];_0x34a256[_0xbf56('0x5a')]=this[_0xbf56('0x14')][_0x34a256[_0xbf56('0x50')]]&&this['voiceQueues'][_0x34a256[_0xbf56('0x50')]][_0xbf56('0x5a')]?this[_0xbf56('0x14')][_0x34a256[_0xbf56('0x50')]][_0xbf56('0x5a')]||'inbound':_0xbf56('0x5b');_0x34a256[_0xbf56('0x76')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x34a256[_0xbf56('0x78')]=_0x259ecc[_0xbf56('0x78')];_0x34a256[_0xbf56('0x79')]=_0x259ecc['count'];_0x34a256[_0xbf56('0x54')]=_0x259ecc[_0xbf56('0x54')];_0x34a256[_0xbf56('0x7a')]=this[_0xbf56('0x3d')][_0x259ecc['uniqueid']][_0xbf56('0x7a')];logger[_0xbf56('0x7b')](_0xbf56('0x7c'),_0x34a256[_0xbf56('0x50')],_0x34a256[_0xbf56('0x5a')]);Object[_0xbf56('0x7d')](_0x34a256,_[_0xbf56('0x7e')](_0x259ecc,_[_0xbf56('0x7f')](_0x34a256)));this[_0xbf56('0x10')][_0x259ecc[_0xbf56('0x54')]][_0xbf56('0x71')](_0x34a256);this[_0xbf56('0x3d')][_0x259ecc[_0xbf56('0x54')]]=_0x34a256;this[_0xbf56('0x80')](_0x34a256,_0xbf56('0x81'));}}catch(_0x11da09){logger[_0xbf56('0x46')](_0xbf56('0x75'),_0x259ecc[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x11da09,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x20')]=function(_0x128ec7){try{if(this[_0xbf56('0x5e')](_0x128ec7)){logger[_0xbf56('0x52')](_0xbf56('0x82'),_0x128ec7[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x128ec7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x128ec7[_0xbf56('0x54')]]){var _0x1c0e7a=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0x128ec7['uniqueid']]);_0x1c0e7a[_0xbf56('0x3c')]=![];_0x1c0e7a[_0xbf56('0x84')]=null;_0x1c0e7a[_0xbf56('0x85')]=_0x128ec7[_0xbf56('0x85')];_0x1c0e7a['originalposition']=_0x128ec7[_0xbf56('0x86')];_0x1c0e7a[_0xbf56('0x1f')]=!![];_0x1c0e7a[_0xbf56('0x87')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x1c0e7a[_0xbf56('0x55')]=_0xbf56('0x88');_0x1c0e7a[_0xbf56('0x89')]=null;logger[_0xbf56('0x7b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1c0e7a['queue'],_0x1c0e7a[_0xbf56('0x5a')]);this[_0xbf56('0x3d')][_0x128ec7[_0xbf56('0x54')]]=_0x1c0e7a;this[_0xbf56('0x4c')](_0x1c0e7a,'queuecallerabandon');}}}catch(_0x502767){logger['error'](_0xbf56('0x82'),_0x128ec7[_0xbf56('0x54')],util['inspect'](_0x502767,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')]['syncQueueCallerLeave']=function(_0xc4db0f){try{if(this[_0xbf56('0x5e')](_0xc4db0f)){logger[_0xbf56('0x52')]('[%s][voiceQueueReport][queuecallerleave]',_0xc4db0f['uniqueid'],util[_0xbf56('0x48')](_0xc4db0f,{'showHidden':![],'depth':null}));if(this[_0xbf56('0x10')][_0xc4db0f[_0xbf56('0x54')]]){var _0x2e4b10=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0xc4db0f[_0xbf56('0x54')]]);_0x2e4b10[_0xbf56('0x8a')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x2e4b10['connectedlinenum']=_0xc4db0f['connectedlinenum'];_0x2e4b10[_0xbf56('0x8b')]=_0xc4db0f['connectedlinename'];logger[_0xbf56('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2e4b10[_0xbf56('0x50')],_0x2e4b10[_0xbf56('0x5a')],_0xc4db0f[_0xbf56('0x8c')],_0xc4db0f[_0xbf56('0x8b')]);this[_0xbf56('0x3d')][_0xc4db0f[_0xbf56('0x54')]]=_0x2e4b10;this[_0xbf56('0x80')](_0x2e4b10,_0xbf56('0x21'));}}}catch(_0x3399c5){logger['error'](_0xbf56('0x8d'),_0xc4db0f[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x3399c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbf56('0x25')]=function(_0x5b0c08){try{if(this[_0xbf56('0x5e')](_0x5b0c08)){logger[_0xbf56('0x52')](_0xbf56('0x8e'),_0x5b0c08[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x5b0c08,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5b0c08['uniqueid']]){var _0x5d9f14=_[_0xbf56('0x83')](this['queueReports'][_0x5b0c08[_0xbf56('0x54')]]);_0x5d9f14[_0xbf56('0x3c')]=!![];_0x5d9f14['queuecallerexitreason']=_0xbf56('0x8f');logger[_0xbf56('0x7b')](_0xbf56('0x90'),_0x5d9f14['queue'],_0x5d9f14[_0xbf56('0x5a')]);}}}catch(_0x4316c8){logger[_0xbf56('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x5b0c08['uniqueid'],util[_0xbf56('0x48')](_0x4316c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x23')]=function(_0x2cd8d0){try{if(this[_0xbf56('0x5e')](_0x2cd8d0)){logger[_0xbf56('0x52')](_0xbf56('0x91'),_0x2cd8d0[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x2cd8d0,{'showHidden':![],'depth':null}));if(this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]]){var _0x33f082=_['last'](this['queueReports'][_0x2cd8d0[_0xbf56('0x54')]]);_0x33f082[_0xbf56('0x1f')]=![];_0x33f082[_0xbf56('0x87')]=null;_0x33f082[_0xbf56('0x92')]=!![];_0x33f082[_0xbf56('0x89')]=_0x2cd8d0['membername'];_0x33f082['holdtime']=_0x2cd8d0[_0xbf56('0x85')];_0x33f082[_0xbf56('0x3c')]=!![];_0x33f082[_0xbf56('0x3b')]=![];_0x33f082[_0xbf56('0x93')]=null;if(!_0x33f082[_0xbf56('0x94')]){if(_0x2cd8d0[_0xbf56('0x95')]==_0xbf56('0x94')){_0x33f082[_0xbf56('0x55')]=_0xbf56('0x96');logger[_0xbf56('0x7b')](_0xbf56('0x97'),_0x33f082[_0xbf56('0x50')],_0x33f082[_0xbf56('0x5a')]);}else{if(_[_0xbf56('0x98')](_0x2cd8d0[_0xbf56('0x42')][_0xbf56('0x99')](),'local/')){if(this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x9a')]]){var _0x38fc2c=_[_0xbf56('0x83')](this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x9a')]]);_0x38fc2c[_0xbf56('0x3c')]=![];_0x38fc2c['queuecallerexit']=!![];_0x38fc2c['queuecallerexitAt']=moment(_0x33f082[_0xbf56('0x76')])[_0xbf56('0x9b')](_0x2cd8d0[_0xbf56('0x85')],'seconds')[_0xbf56('0x57')](_0xbf56('0x77'));_0x38fc2c['queuecallerexitreason']='FORWARDTRANSFER';_0x38fc2c['transfer']=!![];_0x38fc2c[_0xbf56('0x9c')]=_0xbf56('0x9d');_0x38fc2c[_0xbf56('0x9e')]=_0x2cd8d0[_0xbf56('0x9f')];_0x38fc2c[_0xbf56('0xa0')]=_0x2cd8d0[_0xbf56('0x54')];logger[_0xbf56('0x7b')](_0xbf56('0xa1'),_0x38fc2c['queue'],_0x38fc2c[_0xbf56('0x5a')]);var _0x559765=this['queueReports'][_0x2cd8d0[_0xbf56('0x9a')]];this[_0xbf56('0x10')][_0x2cd8d0['linkedid']]=this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]];this[_0xbf56('0x10')][_0x2cd8d0[_0xbf56('0x54')]]=_0x559765;}}else{_0x33f082['queuecallerexitreason']=_0xbf56('0xa2')+_0x2cd8d0[_0xbf56('0x95')][_0xbf56('0xa3')]();logger[_0xbf56('0x7b')](_0xbf56('0xa4'),_0x33f082['queue'],_0x33f082['type'],_0x33f082[_0xbf56('0x55')]);}}}this['channels'][_0x2cd8d0[_0xbf56('0x54')]]=_0x33f082;}}}catch(_0x4e9d02){logger[_0xbf56('0x46')](_0xbf56('0x91'),_0x2cd8d0[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x4e9d02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbf56('0xc')][_0xbf56('0x27')]=function(_0x341864){try{if(this[_0xbf56('0x5e')](_0x341864)){logger[_0xbf56('0x52')](_0xbf56('0xa5'),_0x341864[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x341864,{'showHidden':![],'depth':null}));this['addVariable'](_0x341864['uniqueid'],_[_0xbf56('0x7f')](_0x341864[_0xbf56('0xa6')])[0x0],_0x341864[_0xbf56('0xa7')]);if(this['queueReports'][_0x341864[_0xbf56('0x54')]]){var _0x1aef37=_['last'](this[_0xbf56('0x10')][_0x341864[_0xbf56('0x54')]]);if(_0x1aef37){if(this['isNotNull'](_0x341864[_0xbf56('0xa6')])&&this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')][_0xbf56('0x66')])){switch(_0x341864[_0xbf56('0xa7')]){case'CONTINUE':_0x1aef37['queuecallerexit']=![];_0x1aef37[_0xbf56('0x93')]=null;break;case'TIMEOUT':_0x1aef37[_0xbf56('0xa8')]=_0xbf56('0xa9');_0x1aef37['queuecallerexit']=!![];_0x1aef37[_0xbf56('0x93')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xbf56('0x52')](_0xbf56('0xaa'),_0x341864[_0xbf56('0x54')],util['inspect'](_0x1aef37,{'showHidden':![],'depth':null}));ami['emit'](_0xbf56('0xab'),_0x1aef37);break;default:_0x1aef37[_0xbf56('0x3b')]=!![];_0x1aef37['queuecallerexitAt']=moment()['format'](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x8a')]=moment()['format'](_0xbf56('0x77'));}_0x1aef37[_0xbf56('0x1f')]=![];_0x1aef37['queuecallerabandonAt']=null;_0x1aef37[_0xbf56('0x55')]=_0x341864[_0xbf56('0xa7')];this[_0xbf56('0x3d')][_0x341864[_0xbf56('0x54')]]=_0x1aef37;this[_0xbf56('0x4c')](_0x1aef37,_0xbf56('0x26'));}else if(this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')])&&this[_0xbf56('0x5e')](_0x341864[_0xbf56('0xa6')]['queueposition'])){if(!_0x1aef37['queuecallerabandon']){_0x1aef37[_0xbf56('0x3b')]=!![];_0x1aef37[_0xbf56('0x93')]=moment()['format'](_0xbf56('0x77'));_0x1aef37[_0xbf56('0x55')]=_0xbf56('0xac');_0x1aef37[_0xbf56('0x8a')]=moment()[_0xbf56('0x57')](_0xbf56('0x77'));this['channels'][_0x341864['uniqueid']]=_0x1aef37;}}logger[_0xbf56('0x7b')](_0xbf56('0xad'),_0x341864['uniqueid'],_0x1aef37['queue'],_0x1aef37[_0xbf56('0x5a')],_[_0xbf56('0x7f')](_0x341864['variable'])[0x0],_0x341864[_0xbf56('0xa7')]);_0x1aef37[_0xbf56('0x17')]=this[_0xbf56('0x17')][_0x341864[_0xbf56('0x54')]];}}}}catch(_0x16afef){logger[_0xbf56('0x46')]('[%s][voiceQueueReport][varset]',_0x341864[_0xbf56('0x54')],util[_0xbf56('0x48')](_0x16afef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbf56('0xae')]=function(_0x386454,_0x47f1f4,_0x410555){var _0x16a780=[_0xbf56('0xaf'),_0xbf56('0xb0'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xbf56('0xb1'),_0xbf56('0xb2'),'rtpaudioqosrtt',_0xbf56('0xb3'),_0xbf56('0xb4'),_0xbf56('0xb5'),_0xbf56('0xb6'),_0xbf56('0xb7'),_0xbf56('0xb8'),_0xbf56('0xb9'),'memberinterface',_0xbf56('0xba'),_0xbf56('0xbb'),_0xbf56('0xbc'),_0xbf56('0xbd')];if(!_[_0xbf56('0x3f')](_0x47f1f4)&&!_['includes'](_0x16a780,_0x47f1f4)){if(_[_0xbf56('0x5f')](this[_0xbf56('0x17')][_0x386454])){this[_0xbf56('0x17')][_0x386454]={};}this[_0xbf56('0x17')][_0x386454][_0x47f1f4]=_0x410555;}};VoiceQueueReport[_0xbf56('0xc')]['handleHangup']=function(_0x381a39,_0x193d8e,_0x4dd6cb){try{var _0x416a13={};if(this[_0xbf56('0x10')][_0x381a39]){for(var _0x4ba7ed=0x0;_0x4ba7ed0x0?!![]:![];if(!_0x489dae){return this[_0x3816('0x1b')](this[_0x3816('0x50')][_0x3816('0x78')]);}};VoiceQueueReport['prototype'][_0x3816('0x1d')]=function(_0x2f3744){var _0x396af2=this['summary']['id'];if(this[_0x3816('0x50')][_0x3816('0x72')][_0x396af2]&&this[_0x3816('0x50')][_0x3816('0x72')][_0x396af2][_0x2f3744[_0x3816('0x79')]]){this[_0x3816('0x50')][_0x3816('0x72')][_0x396af2][_0x2f3744[_0x3816('0x79')]][_0x3816('0x12')]['push'](_0x2f3744);}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x7a')]=function(_0x378a31){var _0x347f94=this;try{if(this[_0x3816('0x66')](_0x378a31)&&this[_0x3816('0x66')](_0x378a31[_0x3816('0x73')])){logger[_0x3816('0x56')](_0x3816('0x7b'),util[_0x3816('0x4e')](_0x378a31,{'showHidden':![],'depth':null}));var _0x58e59d=this[_0x3816('0x15')][_0x378a31[_0x3816('0x73')]];if(_0x58e59d){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x58e59d[_0x3816('0x65')]);this[_0x3816('0x50')][_0x3816('0x68')][_0x58e59d[_0x3816('0x65')]]={'summaryEvent':_0x378a31};this[_0x3816('0x50')][_0x3816('0x77')]+=0x1;return ami[_0x3816('0x6b')]({'action':_0x3816('0x72'),'queue':_0x58e59d[_0x3816('0x65')]})[_0x3816('0x7c')](function(_0x3ae675){if(!_0x347f94[_0x3816('0x50')]['queuestatus'][_0x378a31[_0x3816('0x79')]]){_0x347f94[_0x3816('0x50')][_0x3816('0x72')][_0x378a31[_0x3816('0x79')]]={};}_0x347f94[_0x3816('0x50')]['queuestatus'][_0x378a31['actionid']][_0x3ae675[_0x3816('0x79')]]={'queue':_0x58e59d['name'],'agents':[]};})[_0x3816('0x47')](function(_0x293ce1){throw _0x293ce1;});}}}catch(_0x1f466e){logger[_0x3816('0x4b')]('[voiceQueueReport][queuesummary]',util[_0x3816('0x4e')](_0x1f466e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x1b')]=function(_0x5496d5){if(this[_0x3816('0x50')][_0x3816('0x77')]>0x0){this[_0x3816('0x50')][_0x3816('0x78')]=_0x5496d5;return;}logger[_0x3816('0x56')](_0x3816('0x7d'),util['inspect'](_0x5496d5,{'showHidden':![],'depth':null}));this[_0x3816('0x50')]=initializeSummary();ami[_0x3816('0x54')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x21')]=function(_0x441e9b){try{if(this[_0x3816('0x66')](_0x441e9b)){logger[_0x3816('0x56')](_0x3816('0x7e'),_0x441e9b[_0x3816('0x58')],util['inspect'](_0x441e9b,{'showHidden':![],'depth':null}));if(_[_0x3816('0x67')](this['queueReports'][_0x441e9b[_0x3816('0x58')]])){this['queueReports'][_0x441e9b[_0x3816('0x58')]]=[];}if(_['isUndefined'](this['channels'][_0x441e9b['uniqueid']])){this[_0x3816('0x13')][_0x441e9b[_0x3816('0x58')]]={};}var _0x2fcf4f=new QueueReport();_0x2fcf4f[_0x3816('0x73')]=_0x441e9b['queue'];_0x2fcf4f['type']=this[_0x3816('0x15')][_0x2fcf4f[_0x3816('0x73')]]&&this['voiceQueues'][_0x2fcf4f[_0x3816('0x73')]][_0x3816('0x62')]?this[_0x3816('0x15')][_0x2fcf4f[_0x3816('0x73')]]['type']||_0x3816('0x63'):'inbound';_0x2fcf4f['queuecallerjoinAt']=moment()['format'](_0x3816('0x7f'));_0x2fcf4f[_0x3816('0x80')]=_0x441e9b[_0x3816('0x80')];_0x2fcf4f[_0x3816('0x81')]=_0x441e9b[_0x3816('0x81')];_0x2fcf4f[_0x3816('0x58')]=_0x441e9b['uniqueid'];_0x2fcf4f[_0x3816('0x82')]=this[_0x3816('0x13')][_0x441e9b['uniqueid']][_0x3816('0x82')];logger[_0x3816('0x83')](_0x3816('0x84'),_0x2fcf4f[_0x3816('0x73')],_0x2fcf4f[_0x3816('0x62')]);Object[_0x3816('0x85')](_0x2fcf4f,_[_0x3816('0x86')](_0x441e9b,_[_0x3816('0x87')](_0x2fcf4f)));this['queueReports'][_0x441e9b[_0x3816('0x58')]][_0x3816('0x88')](_0x2fcf4f);this['channels'][_0x441e9b['uniqueid']]=_0x2fcf4f;this[_0x3816('0x55')](_0x2fcf4f,_0x3816('0x20'));}}catch(_0x5cbeac){logger[_0x3816('0x4b')](_0x3816('0x7e'),_0x441e9b[_0x3816('0x58')],util[_0x3816('0x4e')](_0x5cbeac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x22')]=function(_0x48c58c){try{if(this[_0x3816('0x66')](_0x48c58c)){logger[_0x3816('0x56')](_0x3816('0x89'),_0x48c58c[_0x3816('0x58')],util[_0x3816('0x4e')](_0x48c58c,{'showHidden':![],'depth':null}));if(this[_0x3816('0x11')][_0x48c58c[_0x3816('0x58')]]){var _0x25f014=_[_0x3816('0x8a')](this[_0x3816('0x11')][_0x48c58c[_0x3816('0x58')]]);_0x25f014[_0x3816('0x8b')]=![];_0x25f014[_0x3816('0x8c')]=null;_0x25f014['holdtime']=_0x48c58c['holdtime'];_0x25f014[_0x3816('0x8d')]=_0x48c58c['originalposition'];_0x25f014[_0x3816('0x41')]=!![];_0x25f014[_0x3816('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25f014[_0x3816('0x5d')]=_0x3816('0x8f');_0x25f014[_0x3816('0x90')]=null;logger[_0x3816('0x83')](_0x3816('0x91'),_0x25f014[_0x3816('0x73')],_0x25f014[_0x3816('0x62')]);this[_0x3816('0x13')][_0x48c58c[_0x3816('0x58')]]=_0x25f014;this[_0x3816('0x52')](_0x25f014,_0x3816('0x41'));}}}catch(_0x31eae5){logger[_0x3816('0x4b')](_0x3816('0x89'),_0x48c58c['uniqueid'],util[_0x3816('0x4e')](_0x31eae5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x24')]=function(_0x4917eb){try{if(this[_0x3816('0x66')](_0x4917eb)){logger['debug'](_0x3816('0x92'),_0x4917eb[_0x3816('0x58')],util[_0x3816('0x4e')](_0x4917eb,{'showHidden':![],'depth':null}));if(this[_0x3816('0x11')][_0x4917eb[_0x3816('0x58')]]){var _0x59c684=_['last'](this[_0x3816('0x11')][_0x4917eb['uniqueid']]);_0x59c684['queuecallerleaveAt']=moment()[_0x3816('0x5f')](_0x3816('0x7f'));_0x59c684['connectedlinenum']=_0x4917eb[_0x3816('0x93')];_0x59c684[_0x3816('0x94')]=_0x4917eb[_0x3816('0x94')];logger[_0x3816('0x83')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x59c684[_0x3816('0x73')],_0x59c684['type'],_0x4917eb['connectedlinenum'],_0x4917eb[_0x3816('0x94')]);this['channels'][_0x4917eb[_0x3816('0x58')]]=_0x59c684;this['emitVoiceQueueChannelSave'](_0x59c684,'queuecallerleave');}}}catch(_0x7420fc){logger['error'](_0x3816('0x92'),_0x4917eb[_0x3816('0x58')],util[_0x3816('0x4e')](_0x7420fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x28')]=function(_0x13b5f8){try{if(this[_0x3816('0x66')](_0x13b5f8)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x13b5f8[_0x3816('0x58')],util[_0x3816('0x4e')](_0x13b5f8,{'showHidden':![],'depth':null}));if(this[_0x3816('0x11')][_0x13b5f8[_0x3816('0x58')]]){var _0x27e766=_[_0x3816('0x8a')](this['queueReports'][_0x13b5f8[_0x3816('0x58')]]);_0x27e766[_0x3816('0x8b')]=!![];_0x27e766[_0x3816('0x5d')]='COMPLETEDBYAGENT';logger[_0x3816('0x83')](_0x3816('0x95'),_0x27e766[_0x3816('0x73')],_0x27e766[_0x3816('0x62')]);}}}catch(_0x45a9a8){logger[_0x3816('0x4b')](_0x3816('0x96'),_0x13b5f8[_0x3816('0x58')],util['inspect'](_0x45a9a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3816('0x26')]=function(_0x4e341c){try{if(this[_0x3816('0x66')](_0x4e341c)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x4e341c[_0x3816('0x58')],util[_0x3816('0x4e')](_0x4e341c,{'showHidden':![],'depth':null}));if(this[_0x3816('0x11')][_0x4e341c['uniqueid']]){var _0x4ed5e0=_[_0x3816('0x8a')](this['queueReports'][_0x4e341c['uniqueid']]);_0x4ed5e0['queuecallerabandon']=![];_0x4ed5e0[_0x3816('0x8e')]=null;_0x4ed5e0[_0x3816('0x97')]=!![];_0x4ed5e0[_0x3816('0x90')]=_0x4e341c['membername'];_0x4ed5e0[_0x3816('0x98')]=_0x4e341c[_0x3816('0x98')];_0x4ed5e0[_0x3816('0x8b')]=!![];_0x4ed5e0[_0x3816('0x40')]=![];_0x4ed5e0['queuecallerexitAt']=null;if(!_0x4ed5e0[_0x3816('0x99')]){if(_0x4e341c[_0x3816('0x9a')]==_0x3816('0x99')){_0x4ed5e0[_0x3816('0x5d')]=_0x3816('0x9b');logger[_0x3816('0x83')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4ed5e0[_0x3816('0x73')],_0x4ed5e0[_0x3816('0x62')]);}else{if(_[_0x3816('0x9c')](_0x4e341c['channel'][_0x3816('0x9d')](),_0x3816('0x9e'))){if(this[_0x3816('0x11')][_0x4e341c[_0x3816('0x9f')]]){var _0x479ddc=_[_0x3816('0x8a')](this['queueReports'][_0x4e341c[_0x3816('0x9f')]]);_0x479ddc[_0x3816('0x8b')]=![];_0x479ddc[_0x3816('0x40')]=!![];_0x479ddc[_0x3816('0xa0')]=moment(_0x4ed5e0['queuecallerjoinAt'])[_0x3816('0xa1')](_0x4e341c[_0x3816('0x98')],_0x3816('0xa2'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x479ddc[_0x3816('0x5d')]=_0x3816('0xa3');_0x479ddc['transfer']=!![];_0x479ddc[_0x3816('0xa4')]=_0x3816('0xa5');_0x479ddc[_0x3816('0xa6')]=_0x4e341c[_0x3816('0xa7')];_0x479ddc['transferuniqueid']=_0x4e341c[_0x3816('0x58')];logger[_0x3816('0x83')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x479ddc[_0x3816('0x73')],_0x479ddc[_0x3816('0x62')]);var _0x4c8bf4=this['queueReports'][_0x4e341c[_0x3816('0x9f')]];this[_0x3816('0x11')][_0x4e341c[_0x3816('0x9f')]]=this[_0x3816('0x11')][_0x4e341c['uniqueid']];this[_0x3816('0x11')][_0x4e341c['uniqueid']]=_0x4c8bf4;}}else{_0x4ed5e0[_0x3816('0x5d')]=_0x3816('0xa8')+_0x4e341c[_0x3816('0x9a')][_0x3816('0xa9')]();logger['info'](_0x3816('0xaa'),_0x4ed5e0[_0x3816('0x73')],_0x4ed5e0[_0x3816('0x62')],_0x4ed5e0[_0x3816('0x5d')]);}}}this[_0x3816('0x13')][_0x4e341c[_0x3816('0x58')]]=_0x4ed5e0;}}}catch(_0x3e2a98){logger[_0x3816('0x4b')]('[%s][voiceQueueReport][agentcomplete]',_0x4e341c['uniqueid'],util['inspect'](_0x3e2a98,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0x2a')]=function(_0x249ce0){try{if(this[_0x3816('0x66')](_0x249ce0)){logger['debug'](_0x3816('0xab'),_0x249ce0[_0x3816('0x58')],util['inspect'](_0x249ce0,{'showHidden':![],'depth':null}));this[_0x3816('0xac')](_0x249ce0[_0x3816('0x58')],_[_0x3816('0x87')](_0x249ce0['variable'])[0x0],_0x249ce0[_0x3816('0xad')]);if(this[_0x3816('0x11')][_0x249ce0[_0x3816('0x58')]]){var _0x4da1f5=_[_0x3816('0x8a')](this[_0x3816('0x11')][_0x249ce0[_0x3816('0x58')]]);if(_0x4da1f5){if(this[_0x3816('0x66')](_0x249ce0[_0x3816('0xae')])&&this[_0x3816('0x66')](_0x249ce0['variable']['queuestatus'])){switch(_0x249ce0[_0x3816('0xad')]){case'CONTINUE':_0x4da1f5['queuecallerexit']=![];_0x4da1f5[_0x3816('0xa0')]=null;break;case _0x3816('0xaf'):_0x4da1f5[_0x3816('0xb0')]=_0x3816('0xb1');_0x4da1f5[_0x3816('0x40')]=!![];_0x4da1f5[_0x3816('0xa0')]=moment()[_0x3816('0x5f')](_0x3816('0x7f'));_0x4da1f5[_0x3816('0xb2')]=moment()['format'](_0x3816('0x7f'));logger[_0x3816('0x56')](_0x3816('0xb3'),_0x249ce0[_0x3816('0x58')],util['inspect'](_0x4da1f5,{'showHidden':![],'depth':null}));ami[_0x3816('0x54')](_0x3816('0xb4'),_0x4da1f5);break;default:_0x4da1f5[_0x3816('0x40')]=!![];_0x4da1f5['queuecallerexitAt']=moment()[_0x3816('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4da1f5[_0x3816('0xb2')]=moment()['format'](_0x3816('0x7f'));}_0x4da1f5[_0x3816('0x41')]=![];_0x4da1f5['queuecallerabandonAt']=null;_0x4da1f5[_0x3816('0x5d')]=_0x249ce0[_0x3816('0xad')];this[_0x3816('0x13')][_0x249ce0[_0x3816('0x58')]]=_0x4da1f5;this[_0x3816('0x52')](_0x4da1f5,_0x3816('0x29'));}else if(this['isNotNull'](_0x249ce0['variable'])&&this['isNotNull'](_0x249ce0[_0x3816('0xae')]['queueposition'])){if(!_0x4da1f5[_0x3816('0x41')]){_0x4da1f5['queuecallerexit']=!![];_0x4da1f5[_0x3816('0xa0')]=moment()[_0x3816('0x5f')](_0x3816('0x7f'));_0x4da1f5[_0x3816('0x5d')]='EXITWITHKEY';_0x4da1f5['queuecallerleaveAt']=moment()[_0x3816('0x5f')](_0x3816('0x7f'));this[_0x3816('0x13')][_0x249ce0[_0x3816('0x58')]]=_0x4da1f5;}}logger[_0x3816('0x83')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x249ce0[_0x3816('0x58')],_0x4da1f5[_0x3816('0x73')],_0x4da1f5['type'],_[_0x3816('0x87')](_0x249ce0['variable'])[0x0],_0x249ce0[_0x3816('0xad')]);_0x4da1f5[_0x3816('0x17')]=this['variables'][_0x249ce0[_0x3816('0x58')]];}}}}catch(_0x58e868){logger[_0x3816('0x4b')](_0x3816('0xab'),_0x249ce0[_0x3816('0x58')],util[_0x3816('0x4e')](_0x58e868,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0xac')]=function(_0x2d956b,_0x1a4312,_0x4bf205){var _0x42945f=['rtpaudioqos',_0x3816('0xb5'),_0x3816('0xb6'),_0x3816('0xb7'),_0x3816('0xb8'),_0x3816('0xb9'),'rtpaudioqosrtt',_0x3816('0xba'),_0x3816('0xbb'),_0x3816('0xbc'),_0x3816('0xbd'),'bridgepvtcallid','membercalls',_0x3816('0xbe'),_0x3816('0xbf'),_0x3816('0xc0'),_0x3816('0xc1'),_0x3816('0xc2'),_0x3816('0xc3')];if(!_[_0x3816('0x44')](_0x1a4312)&&!_['includes'](_0x42945f,_0x1a4312)){if(_[_0x3816('0x67')](this['variables'][_0x2d956b])){this['variables'][_0x2d956b]={};}this[_0x3816('0x17')][_0x2d956b][_0x1a4312]=_0x4bf205;}};VoiceQueueReport[_0x3816('0xc')][_0x3816('0xc4')]=function(_0x421dae,_0x345c78,_0x5feb4a){try{var _0x36971b={};if(this[_0x3816('0x11')][_0x421dae]){for(var _0x3a5a76=0x0;_0x3a5a76=0x0?moment(_0x54ba7e[_0x2df4('0x16')])[_0x2df4('0xe')](_0x54ba7e[_0x2df4('0x15')],_0x2df4('0xf')):null,'data1':_0x2df4('0x17'),'data2':_0x54ba7e[_0x2df4('0x18')],'data3':_0x54ba7e[_0x2df4('0x19')],'data4':_0x54ba7e['dialstring']||null,'role':_0x2df4('0x1a'),'internal':_0x54ba7e['accountcode']?_['toNumber'](_0x54ba7e[_0x2df4('0x18')]):undefined,'uniqueid':_0x54ba7e[_0x2df4('0x1b')]},'log':_0x2df4('0x6')});}; \ No newline at end of file +var _0xdf63=['starttime','endtime','outbound','exten','dialstring','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','toNumber','accountcode','uniqueid','voiceDialReport','membername'];(function(_0x537079,_0x497335){var _0x5e99e1=function(_0x34126b){while(--_0x34126b){_0x537079['push'](_0x537079['shift']());}};_0x5e99e1(++_0x497335);}(_0xdf63,0x1c5));var _0x3df6=function(_0x2e1d7c,_0x1742f0){_0x2e1d7c=_0x2e1d7c-0x0;var _0x4508b9=_0xdf63[_0x2e1d7c];return _0x4508b9;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0x3df6('0x0'));var client=require(_0x3df6('0x1'));exports['voiceQueueReport']=function(_0x529b15){var _0x225d42=_0x529b15[_0x3df6('0x2')]||_0x529b15[_0x3df6('0x3')];return client[_0x3df6('0x4')](_0x3df6('0x5'),{'body':{'channel':_0x3df6('0x6'),'membername':_0x529b15[_0x3df6('0x7')],'interface':_[_0x3df6('0x8')](_0x529b15[_0x3df6('0x9')])?util[_0x3df6('0xa')]('SIP/%s',_0x529b15[_0x3df6('0x7')]):_0x529b15[_0x3df6('0x9')],'type':_0x3df6('0xb'),'enterAt':_0x529b15[_0x3df6('0xc')],'exitAt':_0x225d42,'duration':moment(_0x225d42)[_0x3df6('0xd')](_0x529b15['queuecallerleaveAt'],_0x3df6('0xe')),'data1':_0x3df6('0xf'),'data2':_0x529b15[_0x3df6('0x10')],'data3':_0x529b15['exten'],'data4':null,'data5':_0x529b15[_0x3df6('0x11')],'role':'agent','internal':_0x529b15['accountcode']?_[_0x3df6('0x12')](_0x529b15[_0x3df6('0x13')]):undefined,'uniqueid':_0x529b15[_0x3df6('0x14')]},'log':_0x3df6('0x5')});};exports[_0x3df6('0x15')]=function(_0x419dd3){return client[_0x3df6('0x4')](_0x3df6('0x5'),{'body':{'channel':_0x3df6('0x6'),'membername':_0x419dd3[_0x3df6('0x16')],'interface':_0x419dd3['interface'],'type':_0x3df6('0xb'),'enterAt':_0x419dd3[_0x3df6('0x17')],'exitAt':_0x419dd3['endtime'],'duration':moment(_0x419dd3[_0x3df6('0x18')])[_0x3df6('0xd')](_0x419dd3[_0x3df6('0x17')],'seconds')>=0x0?moment(_0x419dd3[_0x3df6('0x18')])[_0x3df6('0xd')](_0x419dd3[_0x3df6('0x17')],_0x3df6('0xe')):null,'data1':_0x3df6('0x19'),'data2':_0x419dd3[_0x3df6('0x13')],'data3':_0x419dd3[_0x3df6('0x1a')],'data4':_0x419dd3[_0x3df6('0x1b')]||null,'role':'agent','internal':_0x419dd3[_0x3df6('0x13')]?_['toNumber'](_0x419dd3[_0x3df6('0x13')]):undefined,'uniqueid':_0x419dd3[_0x3df6('0x14')]},'log':_0x3df6('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 75bc979..570aacc 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 _0x09dd=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x4d89fd,_0x411fe1){_0x4d89fd=_0x4d89fd-0x0;var _0x3262a6=_0x09dd[_0x4d89fd];return _0x3262a6;};'use strict';var client=require(_0xd09d('0x0'));exports[_0xd09d('0x1')]=function(){return client[_0xd09d('0x2')](_0xd09d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd09d('0x4'),_0xd09d('0x5')]},'log':_0xd09d('0x6')});}; \ No newline at end of file +var _0xa9f0=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa9f0,0x153));var _0x0a9f=function(_0x43ad6c,_0x28cfce){_0x43ad6c=_0x43ad6c-0x0;var _0x473e81=_0xa9f0[_0x43ad6c];return _0x473e81;};'use strict';var client=require(_0x0a9f('0x0'));exports['getSettings']=function(){return client[_0x0a9f('0x1')](_0x0a9f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0a9f('0x3'),_0x0a9f('0x4')]},'log':_0x0a9f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b757439..621e9b6 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 _0x9a0c=['Request','GetTemplate','name','html','getTemplates'];(function(_0x17a70b,_0x3c8c57){var _0x4fa8c1=function(_0x462cac){while(--_0x462cac){_0x17a70b['push'](_0x17a70b['shift']());}};_0x4fa8c1(++_0x3c8c57);}(_0x9a0c,0x8b));var _0xc9a0=function(_0x1fb9d0,_0xfb88ee){_0x1fb9d0=_0x1fb9d0-0x0;var _0x190ae8=_0x9a0c[_0x1fb9d0];return _0x190ae8;};'use strict';var client=require('../client');exports[_0xc9a0('0x0')]=function(_0x135031){return function(_0x2a2506){return client[_0xc9a0('0x1')](_0xc9a0('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc9a0('0x3'),_0xc9a0('0x4')]},'log':_0xc9a0('0x2')});};}; \ No newline at end of file +var _0x49aa=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x49aa,0x173));var _0xa49a=function(_0x55e5d5,_0x32649b){_0x55e5d5=_0x55e5d5-0x0;var _0x5ea095=_0x49aa[_0x55e5d5];return _0x5ea095;};'use strict';var client=require(_0xa49a('0x0'));exports[_0xa49a('0x1')]=function(_0x196ca5){return function(_0x568487){return client[_0xa49a('0x2')](_0xa49a('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa49a('0x4'),_0xa49a('0x5')]},'log':_0xa49a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4411f7b..aba0d7a 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 _0x3e23=['name','channel','Condition','AllConditions','operator','value','Action','action','data2','data4','data5','../client','getTriggers','Request','GetTrigger'];(function(_0x3143d4,_0x505178){var _0x16c876=function(_0x4faf01){while(--_0x4faf01){_0x3143d4['push'](_0x3143d4['shift']());}};_0x16c876(++_0x505178);}(_0x3e23,0x92));var _0x33e2=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3e23[_0x3b0731];return _0x4204d7;};'use strict';var client=require(_0x33e2('0x0'));exports[_0x33e2('0x1')]=function(_0x2b452e){return function(_0x268021){return client[_0x33e2('0x2')](_0x33e2('0x3'),{'options':{'raw':![],'attributes':['id',_0x33e2('0x4'),_0x33e2('0x5'),'status'],'include':[{'model':_0x33e2('0x6'),'as':_0x33e2('0x7'),'attributes':['id','field',_0x33e2('0x8'),_0x33e2('0x9')]},{'model':_0x33e2('0x6'),'as':'AnyConditions','attributes':['id','field',_0x33e2('0x8'),'value']},{'model':_0x33e2('0xa'),'as':'Actions','attributes':['id',_0x33e2('0xb'),'data1',_0x33e2('0xc'),'data3',_0x33e2('0xd'),_0x33e2('0xe'),'data6','data7']}]},'log':_0x33e2('0x3')});};}; \ No newline at end of file +var _0x914d=['Action','Actions','action','data2','data4','data5','data6','data7','getTriggers','Request','name','channel','status','Condition','AllConditions','operator','value','field'];(function(_0x176c15,_0x4c7f49){var _0x44a02c=function(_0x268c35){while(--_0x268c35){_0x176c15['push'](_0x176c15['shift']());}};_0x44a02c(++_0x4c7f49);}(_0x914d,0xe0));var _0xd914=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x914d[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0xd914('0x0')]=function(_0x2f1bd2){return function(_0x559c90){return client[_0xd914('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xd914('0x2'),_0xd914('0x3'),_0xd914('0x4')],'include':[{'model':_0xd914('0x5'),'as':_0xd914('0x6'),'attributes':['id','field',_0xd914('0x7'),_0xd914('0x8')]},{'model':_0xd914('0x5'),'as':'AnyConditions','attributes':['id',_0xd914('0x9'),_0xd914('0x7'),'value']},{'model':_0xd914('0xa'),'as':_0xd914('0xb'),'attributes':['id',_0xd914('0xc'),'data1',_0xd914('0xd'),'data3',_0xd914('0xe'),_0xd914('0xf'),_0xd914('0x10'),_0xd914('0x11')]}]},'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 fe8368d..d30f005 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 _0x0389=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x0389,0x175));var _0x9038=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x0389[_0x62c958];return _0x57ec61;};'use strict';var client=require(_0x9038('0x0'));exports['getTrunks']=function(_0xec2f5a){return function(_0x1479bf){return client[_0x9038('0x1')](_0x9038('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9038('0x3'),_0x9038('0x4'),_0x9038('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xe105=['GetTrunk','name','registry','defaultuser','../client'];(function(_0x1605b5,_0x585b66){var _0x3333fe=function(_0x5f0835){while(--_0x5f0835){_0x1605b5['push'](_0x1605b5['shift']());}};_0x3333fe(++_0x585b66);}(_0xe105,0xef));var _0x5e10=function(_0x225c53,_0x65e2c1){_0x225c53=_0x225c53-0x0;var _0x5297b2=_0xe105[_0x225c53];return _0x5297b2;};'use strict';var client=require(_0x5e10('0x0'));exports['getTrunks']=function(_0x4d5a73){return function(_0x55d186){return client['Request'](_0x5e10('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5e10('0x2'),_0x5e10('0x3'),_0x5e10('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index df36814..6ff9946 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x35810d,_0x101866){var _0x42489d=function(_0x492089){while(--_0x492089){_0x35810d['push'](_0x35810d['shift']());}};_0x42489d(++_0x101866);}(_0x70e0,0x17b));var _0x070e=function(_0x2a6ebc,_0x44324f){_0x2a6ebc=_0x2a6ebc-0x0;var _0x3a7d56=_0x70e0[_0x2a6ebc];return _0x3a7d56;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x42dcc7,_0x3d1cde){var _0x3ecf8f=function(_0x4a1a87){while(--_0x4a1a87){_0x42dcc7['push'](_0x42dcc7['shift']());}};_0x3ecf8f(++_0x3d1cde);}(_0x70e0,0x17b));var _0x070e=function(_0x2a1d4d,_0x5c7a13){_0x2a1d4d=_0x2a1d4d-0x0;var _0x4d32ec=_0x70e0[_0x2a1d4d];return _0x4d32ec;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1e3b75d..6a97afa 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 _0x26d4=['Request','UpdateVoiceAgentReport','../client','create'];(function(_0x52e23a,_0xb9af55){var _0x57b177=function(_0x592f81){while(--_0x592f81){_0x52e23a['push'](_0x52e23a['shift']());}};_0x57b177(++_0xb9af55);}(_0x26d4,0x172));var _0x426d=function(_0x40017b,_0x29ae62){_0x40017b=_0x40017b-0x0;var _0x41d9fa=_0x26d4[_0x40017b];return _0x41d9fa;};'use strict';var client=require(_0x426d('0x0'));exports[_0x426d('0x1')]=function(_0x3b6a96){return client['Request']('CreateVoiceAgentReport',{'body':_0x3b6a96,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5cf925,_0x321638,_0x4d9379){return client[_0x426d('0x2')]('UpdateVoiceAgentReport',{'body':_0x5cf925,'options':{'where':{'uniqueid':_0x321638,'interface':_0x4d9379,'agentcomplete':!![]}},'log':_0x426d('0x3')});}; \ No newline at end of file +var _0xb976=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0xa5d9f9,_0x17c6bf){var _0x40e9f6=function(_0x1c2585){while(--_0x1c2585){_0xa5d9f9['push'](_0xa5d9f9['shift']());}};_0x40e9f6(++_0x17c6bf);}(_0xb976,0x1b9));var _0x6b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb976[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x6b97('0x0')]=function(_0x54aaf7){return client[_0x6b97('0x1')]('CreateVoiceAgentReport',{'body':_0x54aaf7,'log':_0x6b97('0x2')});};exports['update']=function(_0x2a3924,_0x29fd78,_0x551e99){return client[_0x6b97('0x1')](_0x6b97('0x3'),{'body':_0x2a3924,'options':{'where':{'uniqueid':_0x29fd78,'interface':_0x551e99,'agentcomplete':!![]}},'log':_0x6b97('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d83aa57..8f10661 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 _0x531e=['util','lodash','../client','create','Request','merge','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x531e,0x107));var _0xe531=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x531e[_0x4d1ee9];return _0x9a5456;};'use strict';var moment=require(_0xe531('0x0'));var util=require(_0xe531('0x1'));var _=require(_0xe531('0x2'));var client=require(_0xe531('0x3'));exports[_0xe531('0x4')]=function(_0x4038a9){return client[_0xe531('0x5')]('CreateVoiceCallReport',{'body':_[_0xe531('0x6')](_0x4038a9,{'source':_0x4038a9['calleridnum'],'destinationcontext':_0x4038a9[_0xe531('0x7')],'callerid':_0x4038a9[_0xe531('0x8')],'amaflags':_0xe531('0x9')}),'log':_0xe531('0xa')});};exports[_0xe531('0xb')]=function(){return function(){return client[_0xe531('0x5')](_0xe531('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe531('0xd')]('day')[_0xe531('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe531('0xf')](_0xe531('0x10'))['format'](_0xe531('0x11'))]}},'attributes':[_0xe531('0x12'),_0xe531('0x13'),_0xe531('0x14'),_0xe531('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x6eed=['calleridnum','context','callerid','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge'];(function(_0x2a6604,_0x2130fa){var _0x4b2eaf=function(_0x56d3b5){while(--_0x56d3b5){_0x2a6604['push'](_0x2a6604['shift']());}};_0x4b2eaf(++_0x2130fa);}(_0x6eed,0x78));var _0xd6ee=function(_0x3e3ed6,_0x16813f){_0x3e3ed6=_0x3e3ed6-0x0;var _0x5df4e6=_0x6eed[_0x3e3ed6];return _0x5df4e6;};'use strict';var moment=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var _=require(_0xd6ee('0x2'));var client=require('../client');exports['create']=function(_0x4a8a8b){return client[_0xd6ee('0x3')](_0xd6ee('0x4'),{'body':_[_0xd6ee('0x5')](_0x4a8a8b,{'source':_0x4a8a8b[_0xd6ee('0x6')],'destinationcontext':_0x4a8a8b[_0xd6ee('0x7')],'callerid':_0x4a8a8b[_0xd6ee('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xd6ee('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xd6ee('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd6ee('0x9')],'createdAt':{'$between':[moment()[_0xd6ee('0xa')](_0xd6ee('0xb'))[_0xd6ee('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xd6ee('0xd')](_0xd6ee('0xb'))[_0xd6ee('0xc')](_0xd6ee('0xe'))]}},'attributes':[_0xd6ee('0xf'),'disposition','duration',_0xd6ee('0x10')]},'log':_0xd6ee('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c871d77..ac98fa6 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 _0x1dcd=['../client','create','Request','CreateVoiceDialReport'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x1dcd,0x1a8));var _0xd1dc=function(_0x4dd7bb,_0x409176){_0x4dd7bb=_0x4dd7bb-0x0;var _0xbc91e8=_0x1dcd[_0x4dd7bb];return _0xbc91e8;};'use strict';var client=require(_0xd1dc('0x0'));exports[_0xd1dc('0x1')]=function(_0x1badb8){return client[_0xd1dc('0x2')](_0xd1dc('0x3'),{'body':_0x1badb8,'log':_0xd1dc('0x3')});}; \ No newline at end of file +var _0x4a72=['Request','CreateVoiceDialReport','../client','create'];(function(_0xba0d89,_0x387cd6){var _0x3db3ac=function(_0x3c17bb){while(--_0x3c17bb){_0xba0d89['push'](_0xba0d89['shift']());}};_0x3db3ac(++_0x387cd6);}(_0x4a72,0xc2));var _0x24a7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4a72[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x24a7('0x0'));exports[_0x24a7('0x1')]=function(_0x686116){return client[_0x24a7('0x2')](_0x24a7('0x3'),{'body':_0x686116,'log':_0x24a7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7de1693..6a1ca2f 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 _0x7072=['exten','recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x1c676d,_0x4a62ea){var _0x287e93=function(_0x53b1b0){while(--_0x53b1b0){_0x1c676d['push'](_0x1c676d['shift']());}};_0x287e93(++_0x4a62ea);}(_0x7072,0x138));var _0x2707=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7072[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0x2707('0x0')]=function(){return function(){return client[_0x2707('0x1')](_0x2707('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2707('0x3'),_0x2707('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x803f=['../client','Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0xb9b34c,_0x4fbb3d){var _0xcfddda=function(_0x4bcefc){while(--_0x4bcefc){_0xb9b34c['push'](_0xb9b34c['shift']());}};_0xcfddda(++_0x4fbb3d);}(_0x803f,0x64));var _0xf803=function(_0x971b3b,_0x3ecac4){_0x971b3b=_0x971b3b-0x0;var _0x20faaa=_0x803f[_0x971b3b];return _0x20faaa;};'use strict';var client=require(_0xf803('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xf803('0x1')](_0xf803('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xf803('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xf803('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0ea78c6..649155c 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 _0x8d4c=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x33aef8,_0x1b811b){var _0x22c7a6=function(_0x5cee76){while(--_0x5cee76){_0x33aef8['push'](_0x33aef8['shift']());}};_0x22c7a6(++_0x1b811b);}(_0x8d4c,0x173));var _0xc8d4=function(_0x31d707,_0x733c2b){_0x31d707=_0x31d707-0x0;var _0x3ff20d=_0x8d4c[_0x31d707];return _0x3ff20d;};'use strict';var client=require(_0xc8d4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc8d4('0x1')](_0xc8d4('0x2'),{'options':{'raw':![],'attributes':['id',_0xc8d4('0x3'),'acw',_0xc8d4('0x4'),_0xc8d4('0x5'),_0xc8d4('0x6'),_0xc8d4('0x7'),_0xc8d4('0x8'),_0xc8d4('0x9'),_0xc8d4('0xa'),_0xc8d4('0xb'),_0xc8d4('0xc'),_0xc8d4('0xd'),'dialPredictiveOptimizationPercentage',_0xc8d4('0xe'),_0xc8d4('0xf'),'dialOriginateCallerIdNumber',_0xc8d4('0x10'),_0xc8d4('0x11'),_0xc8d4('0x12'),_0xc8d4('0x13'),_0xc8d4('0x14'),_0xc8d4('0x15'),_0xc8d4('0x16'),'dialBusyRetryFrequency',_0xc8d4('0x17'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xc8d4('0x18'),_0xc8d4('0x19'),_0xc8d4('0x1a'),_0xc8d4('0x1b'),_0xc8d4('0x1c'),'dialAMDInitialSilence',_0xc8d4('0x1d'),_0xc8d4('0x1e'),_0xc8d4('0x1f'),_0xc8d4('0x20'),'dialAMDBetweenWordsSilence',_0xc8d4('0x21'),'dialAMDSilenceThreshold',_0xc8d4('0x22'),_0xc8d4('0x23'),_0xc8d4('0x24'),_0xc8d4('0x25'),'dialOrderByScheduledAt',_0xc8d4('0x26'),_0xc8d4('0x27'),_0xc8d4('0x28'),'monitor_format','strategy',_0xc8d4('0x29'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xc8d4('0x2a'),_0xc8d4('0x2b'),_0xc8d4('0x2c'),_0xc8d4('0x2d'),_0xc8d4('0x2e'),_0xc8d4('0x2f'),_0xc8d4('0x30'),_0xc8d4('0x31'),_0xc8d4('0x32'),_0xc8d4('0x33'),_0xc8d4('0x34'),_0xc8d4('0x35'),_0xc8d4('0x36'),_0xc8d4('0x37')],'include':[{'model':'Trunk','as':_0xc8d4('0x38'),'attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x39'),_0xc8d4('0x3a')]},{'model':_0xc8d4('0x3b'),'as':_0xc8d4('0x3c'),'attributes':['id','name']},{'model':_0xc8d4('0x38'),'as':'TrunkBackup','attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x39'),_0xc8d4('0x3a')]},{'model':'Interval','as':_0xc8d4('0x3d'),'attributes':['id',_0xc8d4('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xc8d4('0x3'),_0xc8d4('0x3e')]}]}]},'log':_0xc8d4('0x3f')});};}; \ No newline at end of file +var _0x01b5=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix'];(function(_0x46475c,_0x1d5180){var _0x548cec=function(_0x37af21){while(--_0x37af21){_0x46475c['push'](_0x46475c['shift']());}};_0x548cec(++_0x1d5180);}(_0x01b5,0xa0));var _0x501b=function(_0x1ef35d,_0x4ae9eb){_0x1ef35d=_0x1ef35d-0x0;var _0xf195f3=_0x01b5[_0x1ef35d];return _0xf195f3;};'use strict';var client=require(_0x501b('0x0'));exports[_0x501b('0x1')]=function(){return function(){return client[_0x501b('0x2')](_0x501b('0x3'),{'options':{'raw':![],'attributes':['id',_0x501b('0x4'),_0x501b('0x5'),'acwTimeout','autopause',_0x501b('0x6'),'type',_0x501b('0x7'),_0x501b('0x8'),_0x501b('0x9'),_0x501b('0xa'),'dialPowerLevel',_0x501b('0xb'),_0x501b('0xc'),_0x501b('0xd'),_0x501b('0xe'),_0x501b('0xf'),'dialOriginateTimeout','dialQueueOptions',_0x501b('0x10'),_0x501b('0x11'),_0x501b('0x12'),_0x501b('0x13'),'dialBusyMaxRetry',_0x501b('0x14'),_0x501b('0x15'),_0x501b('0x16'),_0x501b('0x17'),'dialTimezone',_0x501b('0x18'),_0x501b('0x19'),'dialCheckDuplicateType',_0x501b('0x1a'),_0x501b('0x1b'),_0x501b('0x1c'),_0x501b('0x1d'),'dialAMDTotalAnalysisTime',_0x501b('0x1e'),_0x501b('0x1f'),'dialAMDMaximumNumberOfWords',_0x501b('0x20'),_0x501b('0x21'),'timeout',_0x501b('0x22'),_0x501b('0x23'),_0x501b('0x24'),_0x501b('0x25'),_0x501b('0x26'),_0x501b('0x27'),_0x501b('0x6'),_0x501b('0x28'),_0x501b('0x29'),_0x501b('0x2a'),_0x501b('0x2b'),_0x501b('0x2c'),_0x501b('0x2d'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x501b('0x2e'),'dialMachineMaxRetry',_0x501b('0x2f'),_0x501b('0x30'),_0x501b('0x31'),_0x501b('0x32'),_0x501b('0x33'),_0x501b('0x34'),_0x501b('0x35'),_0x501b('0x36')],'include':[{'model':_0x501b('0x37'),'as':_0x501b('0x37'),'attributes':['id',_0x501b('0x4'),'callerid','active']},{'model':_0x501b('0x38'),'as':_0x501b('0x39'),'attributes':['id',_0x501b('0x4')]},{'model':_0x501b('0x37'),'as':_0x501b('0x3a'),'attributes':['id','name','callerid',_0x501b('0x3b')]},{'model':_0x501b('0x3c'),'as':'Interval','attributes':['id',_0x501b('0x4')],'include':[{'model':_0x501b('0x3c'),'as':_0x501b('0x3d'),'attributes':['id',_0x501b('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3ebd2d5..8b4227a 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x3b2245,_0x2b0b2b){var _0x1c44c5=function(_0x5d8fe5){while(--_0x5d8fe5){_0x3b2245['push'](_0x3b2245['shift']());}};_0x1c44c5(++_0x2b0b2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x5c74d4,_0x20b457){var _0x44e19d=function(_0x128691){while(--_0x128691){_0x5c74d4['push'](_0x5c74d4['shift']());}};_0x44e19d(++_0x20b457);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 58e5902..a666ed5 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 _0x6af6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x479916,_0x5ea9e2){var _0x38b705=function(_0x47cea){while(--_0x47cea){_0x479916['push'](_0x479916['shift']());}};_0x38b705(++_0x5ea9e2);}(_0x6af6,0x18c));var _0x66af=function(_0x4f440a,_0x3891f3){_0x4f440a=_0x4f440a-0x0;var _0x27b5f5=_0x6af6[_0x4f440a];return _0x27b5f5;};'use strict';var client=require(_0x66af('0x0'));exports[_0x66af('0x1')]=function(_0x1afc4f){return function(){return client[_0x66af('0x2')](_0x66af('0x3'),{'options':{'where':{'VoiceQueueId':_0x1afc4f,'paused':!![]},'raw':!![]},'log':_0x66af('0x1')});};}; \ No newline at end of file +var _0xa69c=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa69c,0xc9));var _0xca69=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xa69c[_0x5c2e5e];return _0x46a5da;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3881b4){return function(){return client[_0xca69('0x0')](_0xca69('0x1'),{'options':{'where':{'VoiceQueueId':_0x3881b4,'paused':!![]},'raw':!![]},'log':_0xca69('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f66483b..e42b32c 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x21d05b,_0x82d731){var _0x5ca5a9=function(_0x2f42b4){while(--_0x2f42b4){_0x21d05b['push'](_0x21d05b['shift']());}};_0x5ca5a9(++_0x82d731);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4b3763,_0x1f4bb8){var _0x2cd42a=function(_0x30d97a){while(--_0x30d97a){_0x4b3763['push'](_0x4b3763['shift']());}};_0x2cd42a(++_0x1f4bb8);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f9d36f3..a4add4d 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 _0x4787=['transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4787,0x1c8));var _0x7478=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4787[_0x381589];return _0x2a075d;};'use strict';var client=require('../client');exports[_0x7478('0x0')]={};exports[_0x7478('0x1')]=function(_0x123b39){return client['Request'](_0x7478('0x2'),{'body':{'result':_0x123b39['result'],'transfererchannel':_0x123b39[_0x7478('0x3')],'transferercalleridnum':_0x123b39[_0x7478('0x4')],'transferercalleridname':_0x123b39[_0x7478('0x5')],'transfererconnectedlinenum':_0x123b39['transfererconnectedlinenum'],'transfererconnectedlinename':_0x123b39[_0x7478('0x6')],'transfereraccountcode':_0x123b39[_0x7478('0x7')],'transferercontext':_0x123b39[_0x7478('0x8')],'transfererexten':_0x123b39[_0x7478('0x9')],'transfererlinkedid':_0x123b39['transfererlinkedid'],'transfereechannel':_0x123b39[_0x7478('0xa')],'transfereecalleridnum':_0x123b39[_0x7478('0xb')],'transfereecalleridname':_0x123b39['transfereecalleridname'],'transfereeconnectedlinenum':_0x123b39[_0x7478('0xc')],'transfereeconnectedlinename':_0x123b39[_0x7478('0xd')],'transfereeaccountcode':_0x123b39[_0x7478('0xe')],'transfereecontext':_0x123b39['transfereecontext'],'transfereeexten':_0x123b39[_0x7478('0xf')],'transfereelinkedid':_0x123b39[_0x7478('0x10')],'isexternal':_0x123b39[_0x7478('0x11')],'context':_0x123b39['context'],'extension':_0x123b39['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x7478('0x12')]=function(_0x32b281){return client[_0x7478('0x13')](_0x7478('0x2'),{'body':{'result':_0x32b281[_0x7478('0x14')],'transfererchannel':_0x32b281[_0x7478('0x15')],'transferercalleridnum':_0x32b281[_0x7478('0x16')],'transferercalleridname':_0x32b281[_0x7478('0x17')],'transfererconnectedlinenum':_0x32b281[_0x7478('0x18')],'transfererconnectedlinename':_0x32b281[_0x7478('0x19')],'transfereraccountcode':_0x32b281[_0x7478('0x1a')],'transferercontext':_0x32b281[_0x7478('0x1b')],'transfererexten':_0x32b281[_0x7478('0x1c')],'transfererlinkedid':_0x32b281[_0x7478('0x1d')],'transfereechannel':_0x32b281[_0x7478('0x1e')],'transfereecalleridnum':_0x32b281['transfertargetcalleridnum'],'transfereecalleridname':_0x32b281['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x32b281['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x32b281[_0x7478('0x1f')],'transfereeaccountcode':_0x32b281[_0x7478('0x20')],'transfereecontext':_0x32b281[_0x7478('0x21')],'transfereeexten':_0x32b281[_0x7478('0x22')],'transfereelinkedid':_0x32b281[_0x7478('0x23')],'isexternal':_0x32b281[_0x7478('0x11')],'context':_0x32b281[_0x7478('0x24')],'extension':_0x32b281['origtransfererexten'],'type':_0x7478('0x25')},'log':_0x7478('0x2')});}; \ No newline at end of file +var _0x6462=['transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x2e26fa,_0x47e5fb){var _0x48c990=function(_0x1a3c7c){while(--_0x1a3c7c){_0x2e26fa['push'](_0x2e26fa['shift']());}};_0x48c990(++_0x47e5fb);}(_0x6462,0xa0));var _0x2646=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x6462[_0x2b9ac8];return _0x3ceea9;};'use strict';var client=require(_0x2646('0x0'));exports[_0x2646('0x1')]={};exports['blindTransfer']=function(_0x30fc25){return client[_0x2646('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x30fc25[_0x2646('0x3')],'transfererchannel':_0x30fc25[_0x2646('0x4')],'transferercalleridnum':_0x30fc25[_0x2646('0x5')],'transferercalleridname':_0x30fc25[_0x2646('0x6')],'transfererconnectedlinenum':_0x30fc25[_0x2646('0x7')],'transfererconnectedlinename':_0x30fc25[_0x2646('0x8')],'transfereraccountcode':_0x30fc25[_0x2646('0x9')],'transferercontext':_0x30fc25['transferercontext'],'transfererexten':_0x30fc25[_0x2646('0xa')],'transfererlinkedid':_0x30fc25[_0x2646('0xb')],'transfereechannel':_0x30fc25[_0x2646('0xc')],'transfereecalleridnum':_0x30fc25[_0x2646('0xd')],'transfereecalleridname':_0x30fc25[_0x2646('0xe')],'transfereeconnectedlinenum':_0x30fc25[_0x2646('0xf')],'transfereeconnectedlinename':_0x30fc25['transfereeconnectedlinename'],'transfereeaccountcode':_0x30fc25[_0x2646('0x10')],'transfereecontext':_0x30fc25['transfereecontext'],'transfereeexten':_0x30fc25[_0x2646('0x11')],'transfereelinkedid':_0x30fc25[_0x2646('0x12')],'isexternal':_0x30fc25[_0x2646('0x13')],'context':_0x30fc25[_0x2646('0x14')],'extension':_0x30fc25[_0x2646('0x15')],'type':_0x2646('0x16')},'log':_0x2646('0x17')});};exports[_0x2646('0x18')]=function(_0x28eb8f){return client[_0x2646('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x28eb8f[_0x2646('0x3')],'transfererchannel':_0x28eb8f[_0x2646('0x19')],'transferercalleridnum':_0x28eb8f[_0x2646('0x1a')],'transferercalleridname':_0x28eb8f['origtransferercalleridname'],'transfererconnectedlinenum':_0x28eb8f[_0x2646('0x1b')],'transfererconnectedlinename':_0x28eb8f[_0x2646('0x1c')],'transfereraccountcode':_0x28eb8f['origtransfereraccountcode'],'transferercontext':_0x28eb8f[_0x2646('0x1d')],'transfererexten':_0x28eb8f['secondtransfererexten'],'transfererlinkedid':_0x28eb8f['origtransfererlinkedid'],'transfereechannel':_0x28eb8f[_0x2646('0x1e')],'transfereecalleridnum':_0x28eb8f[_0x2646('0x1f')],'transfereecalleridname':_0x28eb8f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x28eb8f[_0x2646('0x20')],'transfereeconnectedlinename':_0x28eb8f[_0x2646('0x21')],'transfereeaccountcode':_0x28eb8f[_0x2646('0x22')],'transfereecontext':_0x28eb8f[_0x2646('0x23')],'transfereeexten':_0x28eb8f['transfertargetexten'],'transfereelinkedid':_0x28eb8f['transfertargetlinkedid'],'isexternal':_0x28eb8f[_0x2646('0x13')],'context':_0x28eb8f[_0x2646('0x24')],'extension':_0x28eb8f[_0x2646('0x25')],'type':_0x2646('0x26')},'log':_0x2646('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7bb59b0..6359c1c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x161357,_0x188d02){var _0x1b9c4e=function(_0xfadb70){while(--_0xfadb70){_0x161357['push'](_0x161357['shift']());}};_0x1b9c4e(++_0x188d02);}(_0xb10b,0x12a));var _0xbb10=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0xb10b[_0x38a162];return _0x1f622b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x5f1482,_0x3d47eb){var _0x42288f=function(_0x275414){while(--_0x275414){_0x5f1482['push'](_0x5f1482['shift']());}};_0x42288f(++_0x3d47eb);}(_0x7a54,0x106));var _0x47a5=function(_0x4f8475,_0x52439e){_0x4f8475=_0x4f8475-0x0;var _0x1ff5fd=_0x7a54[_0x4f8475];return _0x1ff5fd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 4761b3b..9155e82 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 _0x6425=['user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','firstName','','format'];(function(_0x9a9cf2,_0x2d7910){var _0x2ab152=function(_0x54bac4){while(--_0x54bac4){_0x9a9cf2['push'](_0x9a9cf2['shift']());}};_0x2ab152(++_0x2d7910);}(_0x6425,0x1ae));var _0x5642=function(_0x43cd71,_0x4d2250){_0x43cd71=_0x43cd71-0x0;var _0x34c580=_0x6425[_0x43cd71];return _0x34c580;};'use strict';var _=require(_0x5642('0x0'));var BPromise=require(_0x5642('0x1'));var Redis=require(_0x5642('0x2'));var util=require(_0x5642('0x3'));var config=require(_0x5642('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x5642('0x5'));config[_0x5642('0x6')]=_['defaults'](config[_0x5642('0x6')],{'host':_0x5642('0x7'),'port':0x18eb});var io=require(_0x5642('0x8'))(new Redis(config[_0x5642('0x6')]));function emit(_0x3070a4,_0xc04b29,_0x2cd00a,_0xd07041,_0x105747){logger[_0x5642('0x9')](_0x5642('0xa'),_0x3070a4,_0xc04b29['id'],_0x2cd00a,_0xd07041,JSON['stringify'](_0x105747));io['to'](_0x2cd00a)[_0x5642('0xb')](_0xd07041,_0x105747);}exports[_0x5642('0xc')]=function(_0x328ca0,_0x203c11,_0xf72d99,_0x4d9103){var _0xcc63ae,_0x127939;var _0x2adb61={};var _0x16a8e3;var _0x2e679c=Number(_0xf72d99['data1']);var _0x455e39=_0xf72d99['data2']?Boolean(Number(_0xf72d99[_0x5642('0xd')])):![];var _0x144d4b;var _0x2cac09=![];if(!_['isNil'](_0xf72d99[_0x5642('0xe')])){if(_0xf72d99['data5']=='1')_0x2cac09=!![];}if(!_0x2cac09){if(_0x4d9103[_0x5642('0xf')]){_0x2adb61['id']=_0x4d9103[_0x5642('0xf')];}}if(!_0x2adb61['id']){_0x2adb61[_0x5642('0x10')]=_0x2e679c;_0x144d4b=_0xf72d99['data3']&&_0xf72d99[_0x5642('0x11')]!=='0'?_0xf72d99[_0x5642('0x11')][_0x5642('0x12')](','):[_0x5642('0x13')];_0x2adb61[_0x5642('0x14')]=_['map'](_0x144d4b,function(_0x2b9765){var _0x5905d8={};_0x5905d8[_0x2b9765]=_0x4d9103[_0x5642('0x15')]?_0x4d9103[_0x5642('0x16')]:_0x4d9103[_0x5642('0x17')];return _0x5905d8;});_0x16a8e3=_0x4d9103['routeId']?_0x4d9103['destcalleridnum']:_0x4d9103[_0x5642('0x17')];}var _0xfb76b2=['id','firstName','lastName','phone','mobile',_0x5642('0x18'),_0x5642('0x10'),_0x5642('0x19'),_0x5642('0x1a'),_0x5642('0x1b')];var _0x1caf02=_[_0x5642('0x1c')](_0xfb76b2,_0x144d4b);BPromise[_0x5642('0x1d')]()[_0x5642('0x1e')](cmContactRpc['getContacts']({'attributes':_0x1caf02,'where':_0x2adb61,'phone':_0x16a8e3}))[_0x5642('0x1e')](function(_0x27a65d){_0x127939=_0x27a65d;if(!_['isEmpty'](_0x127939)){if(_0x127939[_0x5642('0x1f')]===0x1){_0xcc63ae=_0x127939[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x4d9103[_0x5642('0x20')],_0x203c11['id'],_0xcc63ae['id']);}else{logger[_0x5642('0x9')](_0x5642('0x21'),_0x4d9103[_0x5642('0x20')],_0x203c11['id'],_['map'](_0x127939,'id')['join'](','));}return;}else{logger['info'](_0x5642('0x22'),_0x4d9103[_0x5642('0x20')],_0x203c11['id']);var _0xef7e59={'ListId':_0x2e679c};var _0x272210=_0xf72d99[_0x5642('0x23')]&&_0xf72d99['data4']!=='0'?_0xf72d99['data4']:_0x5642('0x13');if(_0x455e39){logger[_0x5642('0x9')](_0x5642('0x24'),_0x4d9103['uniqueid'],_0x203c11['id']);_0xef7e59[_0x272210]=_['isNil'](_0x4d9103[_0x5642('0x15')])?_0x4d9103[_0x5642('0x17')]:_0x4d9103[_0x5642('0x16')];if(_['isNil'](_0x4d9103[_0x5642('0x15')])){_0xef7e59['firstName']=_0x4d9103[_0x5642('0x25')]&&_0x4d9103['calleridname']!==''?_0x4d9103[_0x5642('0x25')]:_0x5642('0x26');}else{_0xef7e59['firstName']=_0x4d9103[_0x5642('0x27')]&&_0x4d9103[_0x5642('0x27')]!==''?_0x4d9103[_0x5642('0x27')]:_0x5642('0x26');}return BPromise[_0x5642('0x1d')]()['then'](cmContactRpc[_0x5642('0x28')](_0xef7e59))['then'](function(_0x591161){_0xcc63ae=_0x591161;_0x127939['push'](_0x591161);if(_0xcc63ae){logger[_0x5642('0x9')](_0x5642('0x29'),_0x4d9103['uniqueid'],_0x203c11['id'],_0xcc63ae['id']);}return;});}else{logger[_0x5642('0x9')](_0x5642('0x2a'),_0x4d9103[_0x5642('0x20')],_0x203c11['id']);_0xef7e59[_0x272210]=_[_0x5642('0x2b')](_0x4d9103[_0x5642('0x15')])?_0x4d9103[_0x5642('0x17')]:_0x4d9103[_0x5642('0x16')];if(_['isNil'](_0x4d9103[_0x5642('0x15')])){_0xef7e59[_0x5642('0x2c')]=_0x4d9103[_0x5642('0x25')]&&_0x4d9103[_0x5642('0x25')]!==_0x5642('0x2d')?_0x4d9103[_0x5642('0x25')]:_0x5642('0x26');}else{_0xef7e59[_0x5642('0x2c')]=_0x4d9103['destcalleridname']&&_0x4d9103['destcalleridname']!==''?_0x4d9103[_0x5642('0x27')]:_0x5642('0x26');}_0xcc63ae=_0xef7e59;_0x127939['push'](_0xef7e59);return;}}})[_0x5642('0x1e')](function(){if(_0x328ca0){emit(_0x4d9103[_0x5642('0x20')],_0x203c11,util[_0x5642('0x2e')](_0x5642('0x2f'),_0x328ca0[_0x5642('0x30')]),util[_0x5642('0x2e')](_0x5642('0x31'),_0xf72d99[_0x5642('0x32')][_0x5642('0x33')]()),{'evt':_[_0x5642('0x34')](_0x4d9103,{'autoCreate':_0x455e39}),'contact':_0xcc63ae===undefined?{}:_0xcc63ae,'contacts':_0x127939['length']===0x0?undefined:_0x127939});}});}; \ No newline at end of file +var _0x74ba=['data4','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','[CM][%s][%s]','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x8b1a5e,_0x2744eb){var _0x1146b1=function(_0x5a9f50){while(--_0x5a9f50){_0x8b1a5e['push'](_0x8b1a5e['shift']());}};_0x1146b1(++_0x2744eb);}(_0x74ba,0x114));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var BPromise=require(_0xa74b('0x0'));var Redis=require(_0xa74b('0x1'));var util=require(_0xa74b('0x2'));var config=require(_0xa74b('0x3'));var logger=require(_0xa74b('0x4'))(_0xa74b('0x5'));var cmContactRpc=require(_0xa74b('0x6'));config[_0xa74b('0x7')]=_[_0xa74b('0x8')](config[_0xa74b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa74b('0x9'))(new Redis(config['redis']));function emit(_0x404a7f,_0x3c7028,_0x4e5ad4,_0x113d04,_0x33a7ca){logger['info'](_0xa74b('0xa'),_0x404a7f,_0x3c7028['id'],_0x4e5ad4,_0x113d04,JSON['stringify'](_0x33a7ca));io['to'](_0x4e5ad4)['emit'](_0x113d04,_0x33a7ca);}exports['exec']=function(_0x33d01e,_0x1ea7f3,_0x368edc,_0x1fe4e9){var _0x98f5d5,_0x13a83b;var _0x379b98={};var _0x5f5d4b;var _0x56cd50=Number(_0x368edc[_0xa74b('0xb')]);var _0x4780f4=_0x368edc[_0xa74b('0xc')]?Boolean(Number(_0x368edc['data2'])):![];var _0x290ff0;var _0x540682=![];if(!_[_0xa74b('0xd')](_0x368edc[_0xa74b('0xe')])){if(_0x368edc[_0xa74b('0xe')]=='1')_0x540682=!![];}if(!_0x540682){if(_0x1fe4e9['xmd-contactid']){_0x379b98['id']=_0x1fe4e9[_0xa74b('0xf')];}}if(!_0x379b98['id']){_0x379b98[_0xa74b('0x10')]=_0x56cd50;_0x290ff0=_0x368edc['data3']&&_0x368edc[_0xa74b('0x11')]!=='0'?_0x368edc[_0xa74b('0x11')]['split'](','):[_0xa74b('0x12')];_0x379b98[_0xa74b('0x13')]=_[_0xa74b('0x14')](_0x290ff0,function(_0x19507e){var _0x4eb782={};_0x4eb782[_0x19507e]=_0x1fe4e9[_0xa74b('0x15')]?_0x1fe4e9[_0xa74b('0x16')]:_0x1fe4e9[_0xa74b('0x17')];return _0x4eb782;});_0x5f5d4b=_0x1fe4e9[_0xa74b('0x15')]?_0x1fe4e9[_0xa74b('0x16')]:_0x1fe4e9['calleridnum'];}var _0x23b1ab=['id',_0xa74b('0x18'),_0xa74b('0x19'),_0xa74b('0x12'),_0xa74b('0x1a'),_0xa74b('0x1b'),'ListId',_0xa74b('0x1c'),_0xa74b('0x1d'),_0xa74b('0x1e')];var _0x2f8bb7=_[_0xa74b('0x1f')](_0x23b1ab,_0x290ff0);BPromise[_0xa74b('0x20')]()[_0xa74b('0x21')](cmContactRpc[_0xa74b('0x22')]({'attributes':_0x2f8bb7,'where':_0x379b98,'phone':_0x5f5d4b}))['then'](function(_0x4d5e06){_0x13a83b=_0x4d5e06;if(!_['isEmpty'](_0x13a83b)){if(_0x13a83b[_0xa74b('0x23')]===0x1){_0x98f5d5=_0x13a83b[0x0];logger[_0xa74b('0x24')](_0xa74b('0x25'),_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3['id'],_0x98f5d5['id']);}else{logger[_0xa74b('0x24')](_0xa74b('0x27'),_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3['id'],_[_0xa74b('0x14')](_0x13a83b,'id')[_0xa74b('0x28')](','));}return;}else{logger[_0xa74b('0x24')](_0xa74b('0x29'),_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3['id']);var _0x210df0={'ListId':_0x56cd50};var _0x516459=_0x368edc[_0xa74b('0x2a')]&&_0x368edc[_0xa74b('0x2a')]!=='0'?_0x368edc['data4']:_0xa74b('0x12');if(_0x4780f4){logger[_0xa74b('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3['id']);_0x210df0[_0x516459]=_[_0xa74b('0xd')](_0x1fe4e9[_0xa74b('0x15')])?_0x1fe4e9[_0xa74b('0x17')]:_0x1fe4e9[_0xa74b('0x16')];if(_[_0xa74b('0xd')](_0x1fe4e9[_0xa74b('0x15')])){_0x210df0[_0xa74b('0x18')]=_0x1fe4e9[_0xa74b('0x2b')]&&_0x1fe4e9['calleridname']!==_0xa74b('0x2c')?_0x1fe4e9['calleridname']:_0xa74b('0x2d');}else{_0x210df0[_0xa74b('0x18')]=_0x1fe4e9[_0xa74b('0x2e')]&&_0x1fe4e9[_0xa74b('0x2e')]!==_0xa74b('0x2c')?_0x1fe4e9['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0xa74b('0x21')](cmContactRpc['createContact'](_0x210df0))['then'](function(_0x827602){_0x98f5d5=_0x827602;_0x13a83b[_0xa74b('0x2f')](_0x827602);if(_0x98f5d5){logger[_0xa74b('0x24')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3['id'],_0x98f5d5['id']);}return;});}else{logger[_0xa74b('0x24')](_0xa74b('0x30'),_0x1fe4e9['uniqueid'],_0x1ea7f3['id']);_0x210df0[_0x516459]=_['isNil'](_0x1fe4e9[_0xa74b('0x15')])?_0x1fe4e9[_0xa74b('0x17')]:_0x1fe4e9['destcalleridnum'];if(_[_0xa74b('0xd')](_0x1fe4e9[_0xa74b('0x15')])){_0x210df0['firstName']=_0x1fe4e9['calleridname']&&_0x1fe4e9[_0xa74b('0x2b')]!==_0xa74b('0x2c')?_0x1fe4e9['calleridname']:_0xa74b('0x2d');}else{_0x210df0[_0xa74b('0x18')]=_0x1fe4e9['destcalleridname']&&_0x1fe4e9[_0xa74b('0x2e')]!==_0xa74b('0x2c')?_0x1fe4e9[_0xa74b('0x2e')]:_0xa74b('0x2d');}_0x98f5d5=_0x210df0;_0x13a83b[_0xa74b('0x2f')](_0x210df0);return;}}})[_0xa74b('0x21')](function(){if(_0x33d01e){emit(_0x1fe4e9[_0xa74b('0x26')],_0x1ea7f3,util['format']('user:%s',_0x33d01e['name']),util[_0xa74b('0x31')](_0xa74b('0x32'),_0x368edc[_0xa74b('0x33')][_0xa74b('0x34')]()),{'evt':_['merge'](_0x1fe4e9,{'autoCreate':_0x4780f4}),'contact':_0x98f5d5===undefined?{}:_0x98f5d5,'contacts':_0x13a83b[_0xa74b('0x23')]===0x0?undefined:_0x13a83b});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f3235be..c729980 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 _0x6d59=['render','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','format','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','integration','exec','accounts','queue','routeId','urlforward','script','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','upperFirst','AccountId','operator','value','interaction','message','event','lastevent','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','../ami','socket.io-emitter','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','motionChannel','undefined','voice','debug','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','length','interface','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d59,0x135));var _0x96d5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d59[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x96d5('0x0'));var _=require(_0x96d5('0x1'));var url=require(_0x96d5('0x2'));var Mustache=require(_0x96d5('0x3'));var Redis=require(_0x96d5('0x4'));var urlforward=require(_0x96d5('0x5'));var integration=require(_0x96d5('0x6'));var cmContact=require(_0x96d5('0x7'));var script=require('./script');var config=require(_0x96d5('0x8'));var logger=require(_0x96d5('0x9'))('trigger');var ami=require(_0x96d5('0xa'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x96d5('0xb'))(new Redis(config[_0x96d5('0xc')]));var operators={'equals':function(_0x46c096,_0xf9d229){return _0x46c096==_0xf9d229;},'not_equals':function(_0x439003,_0x594c62){return _0x439003!=_0x594c62;}};var barAndWebActions=[_0x96d5('0xd'),_0x96d5('0x2'),_0x96d5('0xe')];function Trigger(_0x25d422){this[_0x96d5('0xf')]=_0x25d422[_0x96d5('0xf')];this[_0x96d5('0x10')]=_0x25d422[_0x96d5('0x10')];this['voiceQueues']=_0x25d422[_0x96d5('0x11')];this[_0x96d5('0x12')]=_0x25d422[_0x96d5('0x12')];this[_0x96d5('0x13')]=_0x25d422['voiceExtensions'];this[_0x96d5('0x14')]=_0x25d422[_0x96d5('0x14')];this[_0x96d5('0x15')]=_0x25d422[_0x96d5('0x15')];this[_0x96d5('0x16')]=_0x25d422[_0x96d5('0x16')];this[_0x96d5('0x17')]=_0x25d422[_0x96d5('0x17')];this[_0x96d5('0x18')]=_0x25d422[_0x96d5('0x18')];this[_0x96d5('0x19')]=_0x25d422[_0x96d5('0x19')];this[_0x96d5('0x1a')]=_0x25d422[_0x96d5('0x1a')];this[_0x96d5('0x1b')]=_0x25d422[_0x96d5('0x1b')];this[_0x96d5('0x1c')]=_0x25d422[_0x96d5('0x1c')];this[_0x96d5('0x1d')]=_0x25d422[_0x96d5('0x1d')];this['accounts']={'zendesk':this[_0x96d5('0x14')],'salesforce':this[_0x96d5('0x16')],'freshdesk':this[_0x96d5('0x15')],'sugarcrm':this[_0x96d5('0x17')],'zoho':this[_0x96d5('0x18')],'desk':this[_0x96d5('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x96d5('0x1c')],'freshsales':this[_0x96d5('0x1d')],'servicenow':this[_0x96d5('0x1b')]};ami['on'](_0x96d5('0x1e'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x20'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x22'),this[_0x96d5('0x21')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentnoanswer',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on']('custom:agentbusy',this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x23'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x24'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x25'),this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x26'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x27'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x28'),this[_0x96d5('0x29')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2a'),this[_0x96d5('0x29')]['bind'](this));ami['on'](_0x96d5('0x2b'),this[_0x96d5('0x29')]['bind'](this));ami['on'](_0x96d5('0x2c'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2d'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on']('custom:substatus',this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x2e'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x2f'),this[_0x96d5('0x21')]['bind'](this));ami['on'](_0x96d5('0x30'),this['syncCustomEvent'][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x31'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));ami['on'](_0x96d5('0x32'),this[_0x96d5('0x21')][_0x96d5('0x1f')](this));}Trigger[_0x96d5('0x33')]['emit']=function(_0x473858,_0x3597ca,_0x2e950d){logger[_0x96d5('0x34')](_0x473858,_0x3597ca,JSON['stringify'](_0x2e950d));io['to'](_0x473858)[_0x96d5('0x35')](_0x3597ca,_0x2e950d);};Trigger[_0x96d5('0x33')][_0x96d5('0x21')]=function(_0x1279bd){var _0x3f460e=_['clone'](_0x1279bd);if(typeof _0x3f460e[_0x96d5('0x36')]===_0x96d5('0x37')){_0x3f460e[_0x96d5('0x36')]=_0x96d5('0x38');}logger[_0x96d5('0x39')]('syncCustomEvent',util[_0x96d5('0x3a')](_0x3f460e,{'showHidden':!![],'depth':null}));this[_0x96d5('0x3b')](_0x3f460e);};Trigger[_0x96d5('0x33')][_0x96d5('0x29')]=function(_0x29953e){if(this[_0x96d5('0x10')][_0x29953e['interface']]){this['syncCustomEvent'](_0x29953e);}};Trigger[_0x96d5('0x33')]['checkTriggers']=function(_0x138ac5){var _0x3b1724;for(var _0x2601a9 in this[_0x96d5('0xf')]){if(this[_0x96d5('0xf')][_0x96d5('0x3c')](_0x2601a9)){if(this[_0x96d5('0xf')][_0x2601a9][_0x96d5('0x3d')]){_0x3b1724=this[_0x96d5('0x3e')](this[_0x96d5('0xf')][_0x2601a9],_0x138ac5);if(_0x3b1724){_[_0x96d5('0x3f')](_0x138ac5,_0x138ac5[_0x96d5('0x40')]);for(var _0x57d2fd=0x0,_0x531c27,_0xb5ab1a,_0x33597d;_0x57d2fd0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x33ca43,_0x1782ae){var _0x1e0829=function(_0x27db64){while(--_0x27db64){_0x33ca43['push'](_0x33ca43['shift']());}};_0x1e0829(++_0x1782ae);}(_0x55ca,0x126));var _0xa55c=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x55ca[_0x8b0f43];return _0x3f4425;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 b4466c5..0364dd4 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 _0x8c50=['value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','systemuserid','info','userEmail','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','type','nameField','customField','idField','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x503ce1,_0x56077c){var _0x2801d8=function(_0x1e25ed){while(--_0x1e25ed){_0x503ce1['push'](_0x503ce1['shift']());}};_0x2801d8(++_0x56077c);}(_0x8c50,0xb9));var _0x08c5=function(_0x14444f,_0x56b630){_0x14444f=_0x14444f-0x0;var _0x37362e=_0x8c50[_0x14444f];return _0x37362e;};'use strict';var _=require(_0x08c5('0x0'));var rp=require(_0x08c5('0x1'));var util=require(_0x08c5('0x2'));var intUtil=require(_0x08c5('0x3'));var md5=require('md5');var Redis=require(_0x08c5('0x4'));var logger=require(_0x08c5('0x5'))(_0x08c5('0x6'));var config=require(_0x08c5('0x7'));config[_0x08c5('0x8')]=_[_0x08c5('0x9')](config[_0x08c5('0x8')],{'host':_0x08c5('0xa'),'port':0x18eb});var io=require(_0x08c5('0xb'))(new Redis(config['redis']));function getAuthToken(_0x436b9d,_0x45af12,_0x50e9a7){if(_0x436b9d[_0x08c5('0xc')]){_0x436b9d[_0x08c5('0xd')]=_0x436b9d[_0x08c5('0xe')]['data7'];_0x436b9d[_0x08c5('0xf')]=_0x436b9d[_0x08c5('0xe')]['data2'];return Promise['resolve'](_0x436b9d[_0x08c5('0xe')][_0x08c5('0x10')]);}var _0x3aa65e={'method':_0x08c5('0x11'),'uri':_0x45af12,'form':{'client_id':_0x436b9d[_0x08c5('0x12')],'resource':_0x436b9d[_0x08c5('0xd')],'username':_0x436b9d[_0x08c5('0x13')],'password':_0x436b9d['password'],'grant_type':_0x08c5('0x14'),'client_secret':_0x436b9d[_0x08c5('0x15')]},'json':!![]};return rp(_0x3aa65e)[_0x08c5('0x16')](function(_0x54a5d7){return _0x54a5d7[_0x08c5('0x17')];})[_0x08c5('0x18')](function(_0x1834c9){logger['error']('['+[_0x50e9a7[_0x08c5('0x19')]()]+_0x08c5('0x1a'));return _0x1834c9[_0x08c5('0x1b')];});}function getUser(_0x51155b,_0x2d33b7,_0xc6835c,_0x3ff627,_0x4ad676,_0x14a34d){return new Promise(function(_0xf01510,_0x1d966f){return getAuthToken(_0x2d33b7,_0x3ff627,_0x14a34d)[_0x08c5('0x16')](function(_0x2fb11a){var _0x2e1c9c={'method':'GET','uri':_0x4ad676+_0x08c5('0x1c'),'headers':{'Authorization':_0x08c5('0x1d')+_0x2fb11a,'OData-Version':_0x08c5('0x1e')},'json':!![]};return rp(_0x2e1c9c);})[_0x08c5('0x16')](function(_0x562132){var _0x2aeb47=_0x562132[_0x08c5('0x1f')];var _0x3b3dba=![];var _0xf55bae=null;if(!_[_0x08c5('0x20')](_0xc6835c)){if(intUtil[_0x08c5('0x21')](_0xc6835c['email'])){_0x51155b['userEmail']=_0xc6835c[_0x08c5('0x22')];for(_0xf55bae=0x0;_0xf55bae<_0x2aeb47[_0x08c5('0x23')];_0xf55bae++){if(_0x2aeb47[_0xf55bae][_0x08c5('0x24')]===_0xc6835c[_0x08c5('0x22')]&&!_0x2aeb47[_0xf55bae][_0x08c5('0x25')]){_0x3b3dba=!![];logger['info']('['+[_0x14a34d['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2aeb47[_0xf55bae][_0x08c5('0x26')]+'!');_0x51155b['userId']=_0x2aeb47[_0xf55bae][_0x08c5('0x26')];}}}}if(!_0x3b3dba){logger[_0x08c5('0x27')]('['+[_0x14a34d[_0x08c5('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x51155b[_0x08c5('0x28')]=_0x2d33b7['username'];for(_0xf55bae=0x0;_0xf55bae<_0x2aeb47['length'];_0xf55bae++){if(_0x2aeb47[_0xf55bae]['internalemailaddress']===_0x2d33b7[_0x08c5('0x13')]){_0x51155b[_0x08c5('0x29')]=_0x2aeb47[_0xf55bae]['systemuserid'];}}}_0xf01510(_0x51155b);})[_0x08c5('0x18')](function(_0x2f6b2f){_0x1d966f(_0x2f6b2f[_0x08c5('0x1b')]);});});}function createEndUser(_0x18a241,_0x2385c3,_0x2ae07b,_0xd7406f,_0x5c5954,_0x3157aa,_0x32b95e){return new Promise(function(_0x7596dc,_0x16932c){return getAuthToken(_0x2385c3,_0x2ae07b,_0x3157aa)[_0x08c5('0x16')](function(_0x5e0ca1){var _0x41fe55=_0x3157aa[_0x08c5('0x2a')]()===_0x08c5('0x2b')?_0x5c5954[_0x08c5('0x2c')]:_0x5c5954[_0x08c5('0x2d')];var _0x26cf63={'method':_0x08c5('0x11'),'uri':_0xd7406f+_0x08c5('0x2e'),'body':{'fullname':_0x41fe55,'firstname':_0x41fe55,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x08c5('0x2f')+_0x18a241[_0x08c5('0x29')]+')'},'headers':{'Authorization':_0x08c5('0x1d')+_0x5e0ca1,'OData-Version':_0x08c5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x26cf63[_0x08c5('0x30')][_0x32b95e]=_0x41fe55;return rp(_0x26cf63);})[_0x08c5('0x16')](function(_0x598f43){var _0x52319d=_0x598f43[_0x08c5('0x31')][_0x08c5('0x32')];var _0x576bab=_0x52319d[_0x08c5('0x33')](_0x52319d[_0x08c5('0x34')]('(')+0x1,_0x52319d['lastIndexOf'](')'));_0x18a241[_0x08c5('0x35')]=_0x576bab;_0x7596dc(_0x18a241);})[_0x08c5('0x18')](function(_0x538811){_0x16932c(_0x538811[_0x08c5('0x1b')]);});});}function getEndUser(_0x28b38b,_0x1051bf,_0x3d0ab3,_0x2af3f3,_0x9c56f5,_0x2302e0,_0x5d1ff3,_0x7623c9){var _0x418315=_0x2302e0[_0x08c5('0x2a')]()===_0x08c5('0x2b')?_0x9c56f5['destcalleridnum']:_0x9c56f5[_0x08c5('0x2d')];return getAuthToken(_0x1051bf,_0x3d0ab3,_0x2302e0)[_0x08c5('0x16')](function(_0x16a09c){_0x7623c9=_0x7623c9?_0x7623c9:'telephone1';var _0x147d17={'method':_0x08c5('0x36'),'uri':_0x2af3f3+_0x08c5('0x37')+_0x7623c9+_0x08c5('0x38')+_0x7623c9+_0x08c5('0x39')+_0x418315['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x16a09c,'If-None-Match':null,'OData-Version':_0x08c5('0x1e')},'json':!![]};return rp(_0x147d17);})[_0x08c5('0x16')](function(_0x3ea29a){var _0x39b3fe=![];if(!_0x3ea29a)return _0x39b3fe;var _0x2188ab=_0x3ea29a[_0x08c5('0x1f')];for(var _0x4ae50f=0x0;_0x4ae50f<_0x2188ab[_0x08c5('0x23')];_0x4ae50f++){if(_0x2188ab[_0x4ae50f][_0x7623c9]===_0x418315){_0x39b3fe=!![];_0x28b38b[_0x08c5('0x35')]=_0x2188ab[_0x4ae50f][_0x08c5('0x3a')];}}return _0x39b3fe;})['then'](function(_0x1b8ba4){if(_0x1b8ba4)return _0x28b38b;if(_0x5d1ff3===_0x08c5('0x3b')){logger[_0x08c5('0x27')]('['+[_0x2302e0[_0x08c5('0x19')]()]+_0x08c5('0x3c'));return _0x28b38b;}return createEndUser(_0x28b38b,_0x1051bf,_0x3d0ab3,_0x2af3f3,_0x9c56f5,_0x2302e0,_0x7623c9)['then'](function(_0x1912a1){logger['info']('['+[_0x2302e0[_0x08c5('0x19')]()]+_0x08c5('0x3d'),_0x1912a1[_0x08c5('0x35')]);return _0x1912a1;});});}function getCustomFields(_0xec91c7,_0x449579,_0x5ac807){var _0x5e969c={};if(_0xec91c7['length']>0x0){_['forEach'](_0xec91c7,function(_0x49c84d){if(_['includes']([_0x08c5('0x3e'),'picklist'],_0x49c84d[_0x08c5('0x3f')])&&_0x49c84d[_0x08c5('0x40')]&&!_0x49c84d[_0x08c5('0x41')]){var _0x3350ce=_0x49c84d[_0x08c5('0x42')][_0x08c5('0x2a')]();var _0x1ce9b5=_0x3350ce[_0x08c5('0x33')](0x0,_0x3350ce[_0x08c5('0x43')]('_'));var _0x39afb7=_0x3350ce[_0x08c5('0x33')](_0x3350ce[_0x08c5('0x43')]('_')+0x1);if(_0x1ce9b5===_0x5ac807){_0x5e969c[_0x39afb7]=_0x49c84d[_0x08c5('0x44')];}}});}return _0x5e969c;}function getTicket(_0x1d4c43,_0x517d5c,_0x361e40,_0x3a15d2,_0x13864a,_0xce63fd,_0x406db1){return new Promise(function(_0x2eb235,_0x12145a){var _0x3d29ae;return getAuthToken(_0x517d5c,_0x361e40,_0x406db1)[_0x08c5('0x16')](function(_0x5912dc){if(_0xce63fd['ticketType']===_0x08c5('0x45')){_0x3d29ae={'method':_0x08c5('0x11'),'uri':_0x3a15d2+'incidents','body':Object[_0x08c5('0x46')]({},{'title':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x48')],_0x13864a,'\x20'),'description':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x49')],_0x13864a,'\x0a'),'customerid_contact@odata.bind':_0x1d4c43[_0x08c5('0x35')]?_0x08c5('0x4a')+_0x1d4c43['enduserId']+')':undefined,'ownerid@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','caseorigincode':'1'},getCustomFields(_0xce63fd[_0x08c5('0x4b')],_0x13864a,_0xce63fd[_0x08c5('0x4c')])),'headers':{'Authorization':_0x08c5('0x1d')+_0x5912dc,'OData-Version':_0x08c5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xce63fd['ticketType']===_0x08c5('0x4d')){var _0x8fa00d=_0x1d4c43[_0x08c5('0x35')]?[{'partyid_systemuser@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','participationtypemask':_0x1d4c43['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x08c5('0x4a')+_0x1d4c43['enduserId']+')','participationtypemask':_0x1d4c43['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1d4c43[_0x08c5('0x29')]+')','participationtypemask':_0x1d4c43[_0x08c5('0x4e')]===_0x08c5('0x4f')?0x2:0x1}];_0x3d29ae={'method':_0x08c5('0x11'),'uri':_0x3a15d2+_0x08c5('0x50'),'body':Object['assign']({},{'subject':intUtil[_0x08c5('0x47')](_0xce63fd['Subjects'],_0x13864a,'\x20'),'phonenumber':String(_0x13864a['calleridnum']),'description':intUtil[_0x08c5('0x47')](_0xce63fd[_0x08c5('0x49')],_0x13864a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d4c43[_0x08c5('0x35')]?'/contacts('+_0x1d4c43[_0x08c5('0x35')]+')':undefined,'ownerid@odata.bind':_0x08c5('0x2f')+_0x1d4c43[_0x08c5('0x29')]+')','directioncode':_0x1d4c43[_0x08c5('0x4e')]===_0x08c5('0x4f')?![]:!![],'phonecall_activity_parties':_0x8fa00d},getCustomFields(_0xce63fd[_0x08c5('0x4b')],_0x13864a,_0xce63fd[_0x08c5('0x4c')])),'headers':{'Authorization':_0x08c5('0x1d')+_0x5912dc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3d29ae);})[_0x08c5('0x16')](function(_0x10c25e){var _0x13aa9a=_0x10c25e[_0x08c5('0x31')][_0x08c5('0x32')];var _0x34f333=_0x13aa9a[_0x08c5('0x33')](_0x13aa9a[_0x08c5('0x34')]('(')+0x1,_0x13aa9a[_0x08c5('0x34')](')'));_0x1d4c43[_0x08c5('0x51')]=_0x34f333;_0x2eb235(_0x1d4c43);})[_0x08c5('0x18')](function(_0x931432){_0x12145a(_0x931432[_0x08c5('0x1b')]);});});}function emit(_0x1e5505,_0x21dcad,_0x212a80,_0x233b5a){var _0xf68241={'uri':util['format'](_0x08c5('0x52'),_0x1e5505,_0x212a80,_0x233b5a)};io['to'](util[_0x08c5('0x53')](_0x08c5('0x54'),_0x21dcad))[_0x08c5('0x55')]('trigger:browser:url',_0xf68241);}exports['cs']=function(_0x283c69,_0x2efb06,_0x54cec1,_0x180905,_0x272f1d,_0x209cbe,_0x38d6e5,_0x271e6){var _0x4d7623={};_0x209cbe[_0x08c5('0xd')]=_0x209cbe['modernAuthentication']?intUtil[_0x08c5('0x56')](_0x209cbe['CloudProvider'][_0x08c5('0x57')]):intUtil[_0x08c5('0x56')](_0x209cbe[_0x08c5('0xd')]);_0x209cbe[_0x08c5('0x58')]=intUtil['stripTrailingSlash'](_0x209cbe[_0x08c5('0x58')]);_0x4d7623[_0x08c5('0x4e')]=_0x271e6==='queue'||_0x271e6==='unmanaged'?_0x08c5('0x4f'):_0x08c5('0x2b');var _0xa2ea5b=_0x209cbe[_0x08c5('0xc')]?util[_0x08c5('0x53')](_0x08c5('0x59'),_0x209cbe[_0x08c5('0xe')][_0x08c5('0x57')]):util[_0x08c5('0x53')](_0x08c5('0x59'),_0x209cbe[_0x08c5('0xd')]);var _0x1818b9=util[_0x08c5('0x53')](_0x08c5('0x5a'),_0x209cbe[_0x08c5('0xf')]);var _0x340662=util[_0x08c5('0x53')](_0x08c5('0x5b'),_0x209cbe['serverUrl'],_0x2efb06['uniqueid'],md5(_0x2efb06[_0x08c5('0x5c')]));if(_0x272f1d&&_0x272f1d['monitor_format']){logger[_0x08c5('0x27')](_0x08c5('0x5d'),'Recording\x20is\x20enabled!');_0x2efb06[_0x08c5('0x5e')]=_0x340662;}else if(_0x38d6e5&&_0x38d6e5[_0x08c5('0x5f')]&&_0x38d6e5[_0x08c5('0x5f')]!==_0x08c5('0x60')){logger[_0x08c5('0x27')](_0x08c5('0x61'),_0x08c5('0x62'));_0x2efb06[_0x08c5('0x5e')]=_0x340662;}else{_0x2efb06['recordingURL']='';}return getUser(_0x4d7623,_0x209cbe,_0x180905,_0x1818b9,_0xa2ea5b,_0x271e6)[_0x08c5('0x16')](function(_0x37cf72){logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x37cf72[_0x08c5('0x29')]);logger['info']('['+_0x271e6[_0x08c5('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x37cf72['userEmail']);return getEndUser(_0x37cf72,_0x209cbe,_0x1818b9,_0xa2ea5b,_0x2efb06,_0x271e6,_0x54cec1[_0x08c5('0x63')],_0x54cec1[_0x08c5('0x64')]);})[_0x08c5('0x16')](function(_0x52410a){logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x65'),_0x52410a['enduserId']);logger[_0x08c5('0x27')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x66'),_0x2efb06[_0x08c5('0x2d')]);return getTicket(_0x52410a,_0x209cbe,_0x1818b9,_0xa2ea5b,_0x2efb06,_0x54cec1,_0x271e6);})['then'](function(_0x4905b4){logger[_0x08c5('0x27')](util[_0x08c5('0x53')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x67'),_0x54cec1['ticketType'],_0x4905b4[_0x08c5('0x51')]));logger[_0x08c5('0x27')](util[_0x08c5('0x53')]('['+_0x271e6[_0x08c5('0x19')]()+']\x20Call\x20direction:\x20%s',_0x271e6));if(_0x271e6!=='unmanaged'&&_0x54cec1['openNewTab']){logger['info']('['+_0x271e6[_0x08c5('0x19')]()+']',_0x08c5('0x68'));emit(_0x209cbe[_0x08c5('0xd')],_0x180905[_0x08c5('0x69')],_0x54cec1['ticketType'],_0x4905b4['ticketId']);}})[_0x08c5('0x18')](function(_0x1c07ae){logger[_0x08c5('0x6a')]('['+_0x271e6[_0x08c5('0x19')]()+_0x08c5('0x6b'),_0x1c07ae[_0x08c5('0x1b')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x1c07ae);});}; \ No newline at end of file +var _0x94aa=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Fields','callDirection','queue','Descriptions','/contacts(','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','POST','clientId','username','password','clientSecret','then','access_token','catch','error','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x94aa,0x1e9));var _0xa94a=function(_0x2b3d8a,_0x110dcd){_0x2b3d8a=_0x2b3d8a-0x0;var _0x1affea=_0x94aa[_0x2b3d8a];return _0x1affea;};'use strict';var _=require(_0xa94a('0x0'));var rp=require(_0xa94a('0x1'));var util=require(_0xa94a('0x2'));var intUtil=require(_0xa94a('0x3'));var md5=require(_0xa94a('0x4'));var Redis=require(_0xa94a('0x5'));var logger=require(_0xa94a('0x6'))(_0xa94a('0x7'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0xa94a('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa94a('0x9'))(new Redis(config['redis']));function getAuthToken(_0xb619ad,_0x2ed832,_0x569774){if(_0xb619ad[_0xa94a('0xa')]){_0xb619ad[_0xa94a('0xb')]=_0xb619ad[_0xa94a('0xc')][_0xa94a('0xd')];_0xb619ad[_0xa94a('0xe')]=_0xb619ad[_0xa94a('0xc')]['data2'];return Promise[_0xa94a('0xf')](_0xb619ad[_0xa94a('0xc')]['data5']);}var _0x25b6a7={'method':_0xa94a('0x10'),'uri':_0x2ed832,'form':{'client_id':_0xb619ad[_0xa94a('0x11')],'resource':_0xb619ad['remoteUri'],'username':_0xb619ad[_0xa94a('0x12')],'password':_0xb619ad[_0xa94a('0x13')],'grant_type':_0xa94a('0x13'),'client_secret':_0xb619ad[_0xa94a('0x14')]},'json':!![]};return rp(_0x25b6a7)[_0xa94a('0x15')](function(_0x21c078){return _0x21c078[_0xa94a('0x16')];})[_0xa94a('0x17')](function(_0x5118f2){logger[_0xa94a('0x18')]('['+[_0x569774['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x5118f2[_0xa94a('0x19')];});}function getUser(_0x47a1bd,_0x4f8143,_0x2745ba,_0x2ad171,_0x17ec42,_0x1a4768){return new Promise(function(_0x30dfc9,_0x5f5670){return getAuthToken(_0x4f8143,_0x2ad171,_0x1a4768)[_0xa94a('0x15')](function(_0x25f534){var _0x2cf9cf={'method':'GET','uri':_0x17ec42+_0xa94a('0x1a'),'headers':{'Authorization':_0xa94a('0x1b')+_0x25f534,'OData-Version':_0xa94a('0x1c')},'json':!![]};return rp(_0x2cf9cf);})[_0xa94a('0x15')](function(_0x2b310f){var _0x396a9b=_0x2b310f[_0xa94a('0x1d')];var _0x26514a=![];var _0x5c33db=null;if(!_[_0xa94a('0x1e')](_0x2745ba)){if(intUtil[_0xa94a('0x1f')](_0x2745ba[_0xa94a('0x20')])){_0x47a1bd[_0xa94a('0x21')]=_0x2745ba[_0xa94a('0x20')];for(_0x5c33db=0x0;_0x5c33db<_0x396a9b[_0xa94a('0x22')];_0x5c33db++){if(_0x396a9b[_0x5c33db][_0xa94a('0x23')]===_0x2745ba[_0xa94a('0x20')]&&!_0x396a9b[_0x5c33db][_0xa94a('0x24')]){_0x26514a=!![];logger[_0xa94a('0x25')]('['+[_0x1a4768[_0xa94a('0x26')]()]+_0xa94a('0x27')+_0x396a9b[_0x5c33db]['systemuserid']+'!');_0x47a1bd['userId']=_0x396a9b[_0x5c33db][_0xa94a('0x28')];}}}}if(!_0x26514a){logger[_0xa94a('0x25')]('['+[_0x1a4768[_0xa94a('0x26')]()]+_0xa94a('0x29'));_0x47a1bd['userEmail']=_0x4f8143[_0xa94a('0x12')];for(_0x5c33db=0x0;_0x5c33db<_0x396a9b[_0xa94a('0x22')];_0x5c33db++){if(_0x396a9b[_0x5c33db][_0xa94a('0x23')]===_0x4f8143[_0xa94a('0x12')]){_0x47a1bd['userId']=_0x396a9b[_0x5c33db][_0xa94a('0x28')];}}}_0x30dfc9(_0x47a1bd);})['catch'](function(_0x29b17e){_0x5f5670(_0x29b17e[_0xa94a('0x19')]);});});}function createEndUser(_0x55e3e8,_0x5c7152,_0x5d225d,_0x4b31ef,_0x122fda,_0x184a37,_0x530ddb){return new Promise(function(_0x41f761,_0x4b3dbe){return getAuthToken(_0x5c7152,_0x5d225d,_0x184a37)[_0xa94a('0x15')](function(_0x150216){var _0x5a1240=_0x184a37[_0xa94a('0x2a')]()===_0xa94a('0x2b')?_0x122fda[_0xa94a('0x2c')]:_0x122fda['calleridnum'];var _0x5dee2c={'method':_0xa94a('0x10'),'uri':_0x4b31ef+_0xa94a('0x2d'),'body':{'fullname':_0x5a1240,'firstname':_0x5a1240,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xa94a('0x2e')+_0x55e3e8[_0xa94a('0x2f')]+')'},'headers':{'Authorization':_0xa94a('0x1b')+_0x150216,'OData-Version':_0xa94a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x5dee2c['body'][_0x530ddb]=_0x5a1240;return rp(_0x5dee2c);})[_0xa94a('0x15')](function(_0x4e8da7){var _0xfbdad3=_0x4e8da7[_0xa94a('0x30')][_0xa94a('0x31')];var _0x4ebb59=_0xfbdad3[_0xa94a('0x32')](_0xfbdad3[_0xa94a('0x33')]('(')+0x1,_0xfbdad3[_0xa94a('0x33')](')'));_0x55e3e8[_0xa94a('0x34')]=_0x4ebb59;_0x41f761(_0x55e3e8);})[_0xa94a('0x17')](function(_0x17fa8f){_0x4b3dbe(_0x17fa8f[_0xa94a('0x19')]);});});}function getEndUser(_0x39956d,_0x154fa3,_0xc2dbfc,_0x4b5ee7,_0x529121,_0x49af65,_0x26a90e,_0x147d2e){var _0x1d92d5=_0x49af65[_0xa94a('0x2a')]()===_0xa94a('0x2b')?_0x529121['destcalleridnum']:_0x529121[_0xa94a('0x35')];return getAuthToken(_0x154fa3,_0xc2dbfc,_0x49af65)['then'](function(_0xe142af){_0x147d2e=_0x147d2e?_0x147d2e:_0xa94a('0x36');var _0x591573={'method':_0xa94a('0x37'),'uri':_0x4b5ee7+_0xa94a('0x38')+_0x147d2e+_0xa94a('0x39')+_0x147d2e+_0xa94a('0x3a')+_0x1d92d5['replace']('+',_0xa94a('0x3b'))+'\x27','headers':{'Authorization':_0xa94a('0x1b')+_0xe142af,'If-None-Match':null,'OData-Version':_0xa94a('0x1c')},'json':!![]};return rp(_0x591573);})['then'](function(_0x34ab6b){var _0x1e0d73=![];if(!_0x34ab6b)return _0x1e0d73;var _0x1e3309=_0x34ab6b[_0xa94a('0x1d')];for(var _0x10ed43=0x0;_0x10ed43<_0x1e3309[_0xa94a('0x22')];_0x10ed43++){if(_0x1e3309[_0x10ed43][_0x147d2e]===_0x1d92d5){_0x1e0d73=!![];_0x39956d[_0xa94a('0x34')]=_0x1e3309[_0x10ed43][_0xa94a('0x3c')];}}return _0x1e0d73;})[_0xa94a('0x15')](function(_0xde229a){if(_0xde229a)return _0x39956d;if(_0x26a90e===_0xa94a('0x3d')){logger[_0xa94a('0x25')]('['+[_0x49af65['toUpperCase']()]+_0xa94a('0x3e'));return _0x39956d;}return createEndUser(_0x39956d,_0x154fa3,_0xc2dbfc,_0x4b5ee7,_0x529121,_0x49af65,_0x147d2e)[_0xa94a('0x15')](function(_0x5efe87){logger[_0xa94a('0x25')]('['+[_0x49af65[_0xa94a('0x26')]()]+']\x20Enduser\x20created!',_0x5efe87[_0xa94a('0x34')]);return _0x5efe87;});});}function getCustomFields(_0x128e03,_0x1efabc,_0x298a2a){var _0x3ba070={};if(_0x128e03['length']>0x0){_[_0xa94a('0x3f')](_0x128e03,function(_0x6b146d){if(_[_0xa94a('0x40')]([_0xa94a('0x41'),_0xa94a('0x42')],_0x6b146d[_0xa94a('0x43')])&&_0x6b146d[_0xa94a('0x44')]&&!_0x6b146d[_0xa94a('0x45')]){var _0x55ca35=_0x6b146d[_0xa94a('0x46')]['toLowerCase']();var _0x411f29=_0x55ca35[_0xa94a('0x32')](0x0,_0x55ca35[_0xa94a('0x47')]('_'));var _0x539bb8=_0x55ca35[_0xa94a('0x32')](_0x55ca35['indexOf']('_')+0x1);if(_0x411f29===_0x298a2a){_0x3ba070[_0x539bb8]=_0x6b146d[_0xa94a('0x48')];}}});}return _0x3ba070;}function getTicket(_0x320ec5,_0x4db3d1,_0x327890,_0x1598e6,_0x11256f,_0x30babf,_0x4af3cd){return new Promise(function(_0x29fda9,_0x32324d){var _0x488799;return getAuthToken(_0x4db3d1,_0x327890,_0x4af3cd)[_0xa94a('0x15')](function(_0x3835d2){if(_0x30babf[_0xa94a('0x49')]===_0xa94a('0x4a')){_0x488799={'method':'POST','uri':_0x1598e6+_0xa94a('0x4b'),'body':Object[_0xa94a('0x4c')]({},{'title':intUtil[_0xa94a('0x4d')](_0x30babf[_0xa94a('0x4e')],_0x11256f,'\x20'),'description':intUtil[_0xa94a('0x4d')](_0x30babf['Descriptions'],_0x11256f,'\x0a'),'customerid_contact@odata.bind':_0x320ec5[_0xa94a('0x34')]?'/contacts('+_0x320ec5[_0xa94a('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x320ec5['userId']+')','caseorigincode':'1'},getCustomFields(_0x30babf[_0xa94a('0x4f')],_0x11256f,_0x30babf['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x3835d2,'OData-Version':_0xa94a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x30babf[_0xa94a('0x49')]==='phonecall'){var _0x519555=_0x320ec5[_0xa94a('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x320ec5[_0xa94a('0x2f')]+')','participationtypemask':_0x320ec5[_0xa94a('0x50')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x320ec5[_0xa94a('0x34')]+')','participationtypemask':_0x320ec5['callDirection']===_0xa94a('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa94a('0x2e')+_0x320ec5['userId']+')','participationtypemask':_0x320ec5[_0xa94a('0x50')]===_0xa94a('0x51')?0x2:0x1}];_0x488799={'method':_0xa94a('0x10'),'uri':_0x1598e6+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x30babf[_0xa94a('0x4e')],_0x11256f,'\x20'),'phonenumber':String(_0x11256f['calleridnum']),'description':intUtil['getString'](_0x30babf[_0xa94a('0x52')],_0x11256f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x320ec5['enduserId']?_0xa94a('0x53')+_0x320ec5['enduserId']+')':undefined,'ownerid@odata.bind':_0xa94a('0x2e')+_0x320ec5['userId']+')','directioncode':_0x320ec5[_0xa94a('0x50')]===_0xa94a('0x51')?![]:!![],'phonecall_activity_parties':_0x519555},getCustomFields(_0x30babf['Fields'],_0x11256f,_0x30babf[_0xa94a('0x49')])),'headers':{'Authorization':_0xa94a('0x1b')+_0x3835d2,'OData-Version':_0xa94a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x488799);})[_0xa94a('0x15')](function(_0x293dac){var _0x516ae3=_0x293dac[_0xa94a('0x30')][_0xa94a('0x31')];var _0xb098d6=_0x516ae3[_0xa94a('0x32')](_0x516ae3[_0xa94a('0x33')]('(')+0x1,_0x516ae3[_0xa94a('0x33')](')'));_0x320ec5[_0xa94a('0x54')]=_0xb098d6;_0x29fda9(_0x320ec5);})[_0xa94a('0x17')](function(_0x5c95e3){_0x32324d(_0x5c95e3[_0xa94a('0x19')]);});});}function emit(_0x36d2eb,_0x635a94,_0x447454,_0x48a9de){var _0x3684b3={'uri':util[_0xa94a('0x55')](_0xa94a('0x56'),_0x36d2eb,_0x447454,_0x48a9de)};io['to'](util[_0xa94a('0x55')](_0xa94a('0x57'),_0x635a94))[_0xa94a('0x58')](_0xa94a('0x59'),_0x3684b3);}exports['cs']=function(_0x3018d8,_0x2c004a,_0x3432aa,_0x52bd5e,_0x23f92a,_0x264f6a,_0x2a3c3b,_0x212463){var _0x14d745={};_0x264f6a[_0xa94a('0xb')]=_0x264f6a[_0xa94a('0xa')]?intUtil[_0xa94a('0x5a')](_0x264f6a['CloudProvider'][_0xa94a('0xd')]):intUtil['stripTrailingSlash'](_0x264f6a[_0xa94a('0xb')]);_0x264f6a[_0xa94a('0x5b')]=intUtil[_0xa94a('0x5a')](_0x264f6a[_0xa94a('0x5b')]);_0x14d745[_0xa94a('0x50')]=_0x212463==='queue'||_0x212463==='unmanaged'?_0xa94a('0x51'):_0xa94a('0x2b');var _0x245036=_0x264f6a[_0xa94a('0xa')]?util[_0xa94a('0x55')](_0xa94a('0x5c'),_0x264f6a[_0xa94a('0xc')][_0xa94a('0xd')]):util[_0xa94a('0x55')](_0xa94a('0x5c'),_0x264f6a['remoteUri']);var _0x493d60=util[_0xa94a('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0x264f6a[_0xa94a('0xe')]);var _0x340b74=util[_0xa94a('0x55')](_0xa94a('0x5d'),_0x264f6a['serverUrl'],_0x2c004a[_0xa94a('0x5e')],md5(_0x2c004a[_0xa94a('0x5e')]));if(_0x23f92a&&_0x23f92a[_0xa94a('0x5f')]){logger['info'](_0xa94a('0x60'),_0xa94a('0x61'));_0x2c004a[_0xa94a('0x62')]=_0x340b74;}else if(_0x2a3c3b&&_0x2a3c3b['recordingFormat']&&_0x2a3c3b[_0xa94a('0x63')]!==_0xa94a('0x64')){logger[_0xa94a('0x25')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2c004a[_0xa94a('0x62')]=_0x340b74;}else{_0x2c004a['recordingURL']='';}return getUser(_0x14d745,_0x264f6a,_0x52bd5e,_0x493d60,_0x245036,_0x212463)[_0xa94a('0x15')](function(_0x32aff7){logger[_0xa94a('0x25')]('['+_0x212463[_0xa94a('0x26')]()+_0xa94a('0x65'),_0x32aff7['userId']);logger[_0xa94a('0x25')]('['+_0x212463[_0xa94a('0x26')]()+_0xa94a('0x66'),_0x32aff7[_0xa94a('0x21')]);return getEndUser(_0x32aff7,_0x264f6a,_0x493d60,_0x245036,_0x2c004a,_0x212463,_0x3432aa['moduleCreate'],_0x3432aa[_0xa94a('0x67')]);})['then'](function(_0x5462af){logger['info']('['+_0x212463[_0xa94a('0x26')]()+_0xa94a('0x68'),_0x5462af['enduserId']);logger[_0xa94a('0x25')]('['+_0x212463[_0xa94a('0x26')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2c004a['calleridnum']);return getTicket(_0x5462af,_0x264f6a,_0x493d60,_0x245036,_0x2c004a,_0x3432aa,_0x212463);})['then'](function(_0x2b6c1f){logger[_0xa94a('0x25')](util[_0xa94a('0x55')]('['+_0x212463['toUpperCase']()+_0xa94a('0x69'),_0x3432aa['ticketType'],_0x2b6c1f[_0xa94a('0x54')]));logger['info'](util[_0xa94a('0x55')]('['+_0x212463[_0xa94a('0x26')]()+_0xa94a('0x6a'),_0x212463));if(_0x212463!=='unmanaged'&&_0x3432aa[_0xa94a('0x6b')]){logger[_0xa94a('0x25')]('['+_0x212463[_0xa94a('0x26')]()+']',_0xa94a('0x6c'));emit(_0x264f6a[_0xa94a('0xb')],_0x52bd5e[_0xa94a('0x6d')],_0x3432aa['ticketType'],_0x2b6c1f[_0xa94a('0x54')]);}})[_0xa94a('0x17')](function(_0x4168cd){logger[_0xa94a('0x18')]('['+_0x212463[_0xa94a('0x26')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4168cd['message']);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x4168cd);});}; \ 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 adbd8f1..778f6f7 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 _0x5155=['email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','toString','base64','[HTTP]','GET','forEach','includes','string','picklist','type','nameField','content','idField','customField','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact'];(function(_0x2573c8,_0x12f21a){var _0x5bcc97=function(_0x4dfb14){while(--_0x4dfb14){_0x2573c8['push'](_0x2573c8['shift']());}};_0x5bcc97(++_0x12f21a);}(_0x5155,0x1aa));var _0x5515=function(_0x57c972,_0x510be5){_0x57c972=_0x57c972-0x0;var _0x2c5861=_0x5155[_0x57c972];return _0x2c5861;};'use strict';var _=require('lodash');var rp=require(_0x5515('0x0'));var md5=require(_0x5515('0x1'));var util=require(_0x5515('0x2'));var Redis=require(_0x5515('0x3'));var intUtil=require(_0x5515('0x4'));var config=require(_0x5515('0x5'));var logger=require(_0x5515('0x6'))(_0x5515('0x7'));config[_0x5515('0x8')]=_[_0x5515('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5515('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x5515('0xb'),'Accept':_0x5515('0xb')};function emit(_0x627c12,_0x51c9d9,_0x560a59){io['to'](_0x627c12)[_0x5515('0xc')](_0x51c9d9,_0x560a59);}function getTicket(_0x2ac893,_0x440318,_0x166915,_0x39417f,_0x37ce74){logger[_0x5515('0xd')](_0x5515('0xe'));var _0x2f5c1f=_[_0x5515('0xf')]({'responder_id':_0x440318['id'],'requester_id':_0x166915['id'],'name':util[_0x5515('0x10')](_0x5515('0x11'),_0x37ce74[_0x5515('0x12')]),'phone':_0x37ce74[_0x5515('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x39417f['Subjects'],_0x37ce74,'\x20'),'description':intUtil[_0x5515('0x14')](_0x39417f['Descriptions'],_0x37ce74,_0x5515('0x15')),'tags':getTags(_0x39417f[_0x5515('0x16')],_0x5515('0x17'))},getCustomFields(_0x39417f[_0x5515('0x18')],_0x37ce74));_0x2f5c1f[_0x5515('0x19')]=_[_0x5515('0x1a')](_[_0x5515('0x1b')](_0x2f5c1f[_0x5515('0x19')],'id'),'value');return request({'uri':util['format'](_0x5515('0x1c'),_0x2ac893[_0x5515('0x1d')]),'method':_0x5515('0x1e'),'body':_0x2f5c1f})[_0x5515('0x1f')](function(_0x265f39){logger[_0x5515('0xd')](_0x5515('0x20'));return _0x265f39;});}function getUser(_0xa03be7,_0x55e611){if(intUtil[_0x5515('0x21')](_0x55e611)){return request({'uri':util[_0x5515('0x10')](_0x5515('0x22'),_0xa03be7[_0x5515('0x1d')]),'qs':{'email':_0x55e611}})[_0x5515('0x1f')](function(_0xec3ad1){if(_0xec3ad1[_0x5515('0x23')]){logger[_0x5515('0xd')](_0x5515('0x24'));return _[_0x5515('0x25')](_0xec3ad1,function(_0x2b8abf){return _0x2b8abf[_0x5515('0x26')][_0x5515('0x27')]===_0x55e611;});}else{logger['info'](_0x5515('0x28'));return request({'uri':util[_0x5515('0x10')]('%s/api/v2/agents/me',_0xa03be7[_0x5515('0x1d')])})['then'](function(_0x56a17f){logger[_0x5515('0xd')](_0x5515('0x29'));return _0x56a17f;});}});}else{logger['info'](_0x5515('0x2a'));return request({'uri':util[_0x5515('0x10')](_0x5515('0x2b'),_0xa03be7[_0x5515('0x1d')])})[_0x5515('0x1f')](function(_0x1dedbc){logger[_0x5515('0xd')]('Admin\x20account\x20selected.');return _0x1dedbc;});}}function getEndUser(_0xbb38e3,_0x543f49,_0x2ddba9){logger[_0x5515('0xd')](_0x5515('0x2c'),_0x2ddba9);return request({'uri':util[_0x5515('0x10')](_0x5515('0x2d'),_0xbb38e3[_0x5515('0x1d')]),'qs':{'phone':_0x2ddba9}})[_0x5515('0x1f')](function(_0x5ac11b){if(_0x5ac11b[_0x5515('0x23')]){logger['info'](_0x5515('0x2e'));return _[_0x5515('0x25')](_0x5ac11b,{'phone':_0x2ddba9});}else{logger[_0x5515('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x5515('0x2d'),_0xbb38e3['remoteUri']),'method':_0x5515('0x1e'),'body':{'name':_0x543f49,'phone':_0x2ddba9}})[_0x5515('0x1f')](function(_0x57e783){logger['info']('Enduser\x20created.');return _0x57e783;});}});}function getAuth(_0x18d92e){return util['format'](_0x5515('0x2f'),new Buffer(_0x18d92e['apiKey']+':X')[_0x5515('0x30')](_0x5515('0x31')));}function request(_0x3a48f5){logger['debug'](_0x5515('0x32'),JSON['stringify'](_0x3a48f5));return rp(_[_0x5515('0x9')](_0x3a48f5,{'method':_0x5515('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x53e2b6,_0x4b9948){var _0x4e0c33=[];if(_0x53e2b6&&_0x53e2b6[_0x5515('0x23')]>0x0){_0x4e0c33=_['map'](_0x53e2b6,_0x4b9948);}return _0x4e0c33;}function getCustomFields(_0x2e8d4f,_0x46561e){var _0x88b16=[];var _0x5eea89={'custom_fields':[]};if(_0x2e8d4f[_0x5515('0x23')]>0x0){_[_0x5515('0x34')](_0x2e8d4f,function(_0x2ca3c4){if(_[_0x5515('0x35')]([_0x5515('0x36'),_0x5515('0x37')],_0x2ca3c4[_0x5515('0x38')])&&_0x2ca3c4[_0x5515('0x39')]&&!_0x2ca3c4['customField']){_0x5eea89[_0x2ca3c4[_0x5515('0x39')]['toLowerCase']()]=_0x2ca3c4[_0x5515('0x3a')][_0x5515('0x30')]();}else if(_[_0x5515('0x35')]([_0x5515('0x36'),'picklist'],_0x2ca3c4[_0x5515('0x38')])&&_0x2ca3c4[_0x5515('0x3b')]&&_0x2ca3c4[_0x5515('0x3c')]){_0x5eea89['custom_fields']['push']({'id':_0x2ca3c4[_0x5515('0x3b')],'value':_0x2ca3c4[_0x5515('0x3a')][_0x5515('0x30')]()});}else if(_0x2ca3c4[_0x5515('0x38')]==='variable'&&_0x2ca3c4[_0x5515('0x3d')]&&_0x2ca3c4['idField']&&_0x2ca3c4[_0x5515('0x3c')]){_0x46561e[_0x2ca3c4[_0x5515('0x3d')]]&&_0x5eea89['custom_fields'][_0x5515('0x3e')]({'id':_0x2ca3c4['idField'],'value':_0x46561e[_0x2ca3c4[_0x5515('0x3d')]][_0x5515('0x30')]()});}else if(_0x2ca3c4['type']===_0x5515('0x3f')&&_0x2ca3c4[_0x5515('0x40')]&&_0x2ca3c4[_0x5515('0x40')][_0x5515('0x17')]&&_0x2ca3c4[_0x5515('0x3b')]&&_0x2ca3c4[_0x5515('0x3c')]){_0x46561e[_0x2ca3c4[_0x5515('0x40')][_0x5515('0x17')][_0x5515('0x41')]()]&&_0x5eea89[_0x5515('0x19')]['push']({'id':_0x2ca3c4['idField'],'value':_0x46561e[_0x2ca3c4['Variable'][_0x5515('0x17')][_0x5515('0x41')]()][_0x5515('0x30')]()});}});}return _0x5eea89;}exports[_0x5515('0x42')]=function(_0x2d4657,_0x3b24fe,_0x3a01c7,_0x41ac82,_0x29af96,_0x4becf2){var _0x2ac79c,_0x5e247a;_0x4becf2[_0x5515('0x1d')]=intUtil[_0x5515('0x43')](_0x4becf2[_0x5515('0x1d')]);_0x4becf2['serverUrl']=intUtil[_0x5515('0x43')](_0x4becf2[_0x5515('0x44')]);if(_0x29af96&&_0x29af96[_0x5515('0x45')]){logger['info'](_0x5515('0x46'),_0x5515('0x47'));_0x3b24fe[_0x5515('0x48')]=util[_0x5515('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4becf2[_0x5515('0x44')],_0x3b24fe[_0x5515('0x49')],md5(_0x3b24fe[_0x5515('0x49')]));}else{_0x3b24fe[_0x5515('0x48')]='';}headers[_0x5515('0x4a')]=getAuth(_0x4becf2);return getUser(_0x4becf2,_0x41ac82['email'])[_0x5515('0x1f')](function(_0x13c4a1){_0x2ac79c=_0x13c4a1;logger[_0x5515('0xd')]('The\x20User\x20ID\x20is:',_0x2ac79c['id']);return getEndUser(_0x4becf2,_0x3b24fe['calleridname'],_0x3b24fe[_0x5515('0x13')]);})['then'](function(_0x4b5ecd){_0x5e247a=_0x4b5ecd;logger[_0x5515('0xd')](_0x5515('0x4b'),_0x5e247a['id']);return getTicket(_0x4becf2,_0x2ac79c,_0x5e247a,_0x3a01c7,_0x3b24fe);})['then'](function(_0x2e59a2){if(_0x2e59a2&&_0x2e59a2['id']){logger['info'](_0x5515('0x20'));logger['info'](_0x5515('0x4c'),_0x2e59a2['id']);logger[_0x5515('0xd')](_0x5515('0x46'),_0x5515('0x4d'));emit(util['format'](_0x5515('0x4e'),_0x41ac82[_0x5515('0x17')]),_0x5515('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4becf2[_0x5515('0x1d')],_0x2e59a2['id'])});}})[_0x5515('0x50')](function(_0x22a993){logger[_0x5515('0x51')](_0x5515('0x46'),JSON[_0x5515('0x52')](_0x22a993));});};exports[_0x5515('0x53')]=function(_0x37891e,_0x4f7777,_0x436912,_0x99f625,_0x54669e,_0x21ebee,_0x3beb41){var _0x527b68,_0x21c24f;_0x21ebee[_0x5515('0x1d')]=intUtil[_0x5515('0x43')](_0x21ebee[_0x5515('0x1d')]);_0x21ebee[_0x5515('0x44')]=intUtil[_0x5515('0x43')](_0x21ebee[_0x5515('0x44')]);if(_0x3beb41&&_0x3beb41[_0x5515('0x54')]&&_0x3beb41['recordingFormat']!==_0x5515('0x55')){logger[_0x5515('0xd')]('[OUTBOUND]',_0x5515('0x47'));_0x4f7777[_0x5515('0x48')]=util[_0x5515('0x10')](_0x5515('0x56'),_0x21ebee[_0x5515('0x44')],_0x4f7777[_0x5515('0x49')],md5(_0x4f7777[_0x5515('0x49')]));}headers[_0x5515('0x4a')]=getAuth(_0x21ebee);return getUser(_0x21ebee,_0x99f625['email'])[_0x5515('0x1f')](function(_0x50d47f){_0x527b68=_0x50d47f;logger[_0x5515('0xd')](_0x5515('0x57'),_0x527b68['id']);return getEndUser(_0x21ebee,_0x4f7777[_0x5515('0x58')],_0x4f7777['destcalleridnum']);})[_0x5515('0x1f')](function(_0x3f4ed0){_0x21c24f=_0x3f4ed0;logger['info'](_0x5515('0x4b'),_0x21c24f['id']);return getTicket(_0x21ebee,_0x527b68,_0x21c24f,_0x436912,_0x4f7777);})[_0x5515('0x1f')](function(_0x5ec966){if(_0x5ec966&&_0x5ec966['id']){logger[_0x5515('0xd')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5ec966['id']);logger['info'](_0x5515('0x59'),_0x5515('0x4d'));emit(util[_0x5515('0x10')]('user:%s',_0x99f625[_0x5515('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x5515('0x5a'),_0x21ebee[_0x5515('0x1d')],_0x5ec966['id'])});}})[_0x5515('0x50')](function(_0x176a6d){logger['error'](_0x5515('0x59'),JSON[_0x5515('0x52')](_0x176a6d));});};exports[_0x5515('0x5b')]=function(_0x5cdd,_0x1051f0,_0xb24643,_0x58eb4d,_0x510ecc,_0xa72de4){var _0x28bab5,_0x2efb08;_0xa72de4['remoteUri']=intUtil['stripTrailingSlash'](_0xa72de4[_0x5515('0x1d')]);_0xa72de4['serverUrl']=intUtil[_0x5515('0x43')](_0xa72de4[_0x5515('0x44')]);if(_0x510ecc&&_0x510ecc[_0x5515('0x45')]){logger[_0x5515('0xd')]('['+_0x1051f0['lastevent'][_0x5515('0x5c')]()+']',_0x5515('0x47'));_0x1051f0[_0x5515('0x48')]=util[_0x5515('0x10')](_0x5515('0x56'),_0xa72de4[_0x5515('0x44')],_0x1051f0[_0x5515('0x49')],md5(_0x1051f0[_0x5515('0x49')]));}else{_0x1051f0[_0x5515('0x48')]='';}headers['Authorization']=getAuth(_0xa72de4);return getUser(_0xa72de4,'')[_0x5515('0x1f')](function(_0x15a1ad){_0x28bab5=_0x15a1ad;logger['info']('The\x20User\x20ID\x20is:',_0x28bab5['id']);return getEndUser(_0xa72de4,_0x1051f0[_0x5515('0x12')],_0x1051f0[_0x5515('0x13')]);})[_0x5515('0x1f')](function(_0x43b6f6){_0x2efb08=_0x43b6f6;logger[_0x5515('0xd')](_0x5515('0x4b'),_0x2efb08['id']);return getTicket(_0xa72de4,_0x28bab5,_0x2efb08,_0xb24643,_0x1051f0);})[_0x5515('0x1f')](function(_0x2927dd){if(_0x2927dd){logger[_0x5515('0xd')](_0x5515('0x20'));logger[_0x5515('0xd')](_0x5515('0x4c'),_0x2927dd['id']);}})['catch'](function(_0x5a1c82){logger[_0x5515('0x51')]('['+_0x1051f0['lastevent'][_0x5515('0x5c')]()+']',JSON[_0x5515('0x52')](_0x5a1c82));});}; \ No newline at end of file +var _0x5f46=['keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','type','customField','nameField','content','picklist','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','request-promise','md5','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues'];(function(_0x408d76,_0x7225a7){var _0xe45c46=function(_0x131c2b){while(--_0x131c2b){_0x408d76['push'](_0x408d76['shift']());}};_0xe45c46(++_0x7225a7);}(_0x5f46,0x1bd));var _0x65f4=function(_0x39b212,_0x5e5357){_0x39b212=_0x39b212-0x0;var _0x57f1db=_0x5f46[_0x39b212];return _0x57f1db;};'use strict';var _=require('lodash');var rp=require(_0x65f4('0x0'));var md5=require(_0x65f4('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x65f4('0x2'));var logger=require(_0x65f4('0x3'))(_0x65f4('0x4'));config[_0x65f4('0x5')]=_[_0x65f4('0x6')](config[_0x65f4('0x5')],{'host':_0x65f4('0x7'),'port':0x18eb});var io=require(_0x65f4('0x8'))(new Redis(config[_0x65f4('0x5')]));var headers={'Content-Type':_0x65f4('0x9'),'Accept':_0x65f4('0x9')};function emit(_0x67c0bd,_0x11e8ef,_0x1347a6){io['to'](_0x67c0bd)[_0x65f4('0xa')](_0x11e8ef,_0x1347a6);}function getTicket(_0x29bb12,_0x2a2fd1,_0x1557c8,_0x2e3dd0,_0x41eb70){logger[_0x65f4('0xb')](_0x65f4('0xc'));var _0x2fd72f=_[_0x65f4('0xd')]({'responder_id':_0x2a2fd1['id'],'requester_id':_0x1557c8['id'],'name':util[_0x65f4('0xe')](_0x65f4('0xf'),_0x41eb70[_0x65f4('0x10')]),'phone':_0x41eb70[_0x65f4('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2e3dd0[_0x65f4('0x12')],_0x41eb70,'\x20'),'description':intUtil['getString'](_0x2e3dd0[_0x65f4('0x13')],_0x41eb70,'
'),'tags':getTags(_0x2e3dd0[_0x65f4('0x14')],_0x65f4('0x15'))},getCustomFields(_0x2e3dd0[_0x65f4('0x16')],_0x41eb70));_0x2fd72f[_0x65f4('0x17')]=_[_0x65f4('0x18')](_[_0x65f4('0x19')](_0x2fd72f[_0x65f4('0x17')],'id'),_0x65f4('0x1a'));return request({'uri':util[_0x65f4('0xe')](_0x65f4('0x1b'),_0x29bb12[_0x65f4('0x1c')]),'method':_0x65f4('0x1d'),'body':_0x2fd72f})[_0x65f4('0x1e')](function(_0x30c9d1){logger[_0x65f4('0xb')](_0x65f4('0x1f'));return _0x30c9d1;});}function getUser(_0x54c206,_0x3ae1f4){if(intUtil[_0x65f4('0x20')](_0x3ae1f4)){return request({'uri':util['format']('%s/api/v2/agents',_0x54c206[_0x65f4('0x1c')]),'qs':{'email':_0x3ae1f4}})[_0x65f4('0x1e')](function(_0x280e8d){if(_0x280e8d['length']){logger[_0x65f4('0xb')](_0x65f4('0x21'));return _[_0x65f4('0x22')](_0x280e8d,function(_0x49c6e0){return _0x49c6e0['contact']['email']===_0x3ae1f4;});}else{logger[_0x65f4('0xb')](_0x65f4('0x23'));return request({'uri':util[_0x65f4('0xe')](_0x65f4('0x24'),_0x54c206['remoteUri'])})[_0x65f4('0x1e')](function(_0x46f306){logger['info']('Admin\x20account\x20selected.');return _0x46f306;});}});}else{logger[_0x65f4('0xb')](_0x65f4('0x25'));return request({'uri':util[_0x65f4('0xe')](_0x65f4('0x24'),_0x54c206[_0x65f4('0x1c')])})['then'](function(_0x21f8d2){logger['info'](_0x65f4('0x26'));return _0x21f8d2;});}}function getEndUser(_0x454658,_0x3be5ad,_0x26a980){logger[_0x65f4('0xb')](_0x65f4('0x27'),_0x26a980);return request({'uri':util['format']('%s/api/v2/contacts',_0x454658[_0x65f4('0x1c')]),'qs':{'phone':_0x26a980}})[_0x65f4('0x1e')](function(_0x5dcc67){if(_0x5dcc67[_0x65f4('0x28')]){logger[_0x65f4('0xb')](_0x65f4('0x29'));return _[_0x65f4('0x22')](_0x5dcc67,{'phone':_0x26a980});}else{logger[_0x65f4('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x65f4('0xe')](_0x65f4('0x2a'),_0x454658[_0x65f4('0x1c')]),'method':_0x65f4('0x1d'),'body':{'name':_0x3be5ad,'phone':_0x26a980}})[_0x65f4('0x1e')](function(_0x189f35){logger[_0x65f4('0xb')](_0x65f4('0x2b'));return _0x189f35;});}});}function getAuth(_0xa206c7){return util[_0x65f4('0xe')](_0x65f4('0x2c'),new Buffer(_0xa206c7[_0x65f4('0x2d')]+':X')[_0x65f4('0x2e')](_0x65f4('0x2f')));}function request(_0x4d7762){logger[_0x65f4('0x30')](_0x65f4('0x31'),JSON['stringify'](_0x4d7762));return rp(_[_0x65f4('0x6')](_0x4d7762,{'method':_0x65f4('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x492440,_0x1f87ee){var _0x241ae3=[];if(_0x492440&&_0x492440[_0x65f4('0x28')]>0x0){_0x241ae3=_[_0x65f4('0x33')](_0x492440,_0x1f87ee);}return _0x241ae3;}function getCustomFields(_0x47e282,_0x5954de){var _0x203438=[];var _0x146a1a={'custom_fields':[]};if(_0x47e282[_0x65f4('0x28')]>0x0){_[_0x65f4('0x34')](_0x47e282,function(_0x3c985f){if(_[_0x65f4('0x35')]([_0x65f4('0x36'),'picklist'],_0x3c985f[_0x65f4('0x37')])&&_0x3c985f['nameField']&&!_0x3c985f[_0x65f4('0x38')]){_0x146a1a[_0x3c985f[_0x65f4('0x39')]['toLowerCase']()]=_0x3c985f[_0x65f4('0x3a')][_0x65f4('0x2e')]();}else if(_[_0x65f4('0x35')](['string',_0x65f4('0x3b')],_0x3c985f[_0x65f4('0x37')])&&_0x3c985f[_0x65f4('0x3c')]&&_0x3c985f['customField']){_0x146a1a[_0x65f4('0x17')][_0x65f4('0x3d')]({'id':_0x3c985f[_0x65f4('0x3c')],'value':_0x3c985f['content'][_0x65f4('0x2e')]()});}else if(_0x3c985f[_0x65f4('0x37')]===_0x65f4('0x3e')&&_0x3c985f['variableName']&&_0x3c985f['idField']&&_0x3c985f['customField']){_0x5954de[_0x3c985f['variableName']]&&_0x146a1a['custom_fields']['push']({'id':_0x3c985f[_0x65f4('0x3c')],'value':_0x5954de[_0x3c985f[_0x65f4('0x3f')]][_0x65f4('0x2e')]()});}else if(_0x3c985f[_0x65f4('0x37')]==='customVariable'&&_0x3c985f[_0x65f4('0x40')]&&_0x3c985f[_0x65f4('0x40')]['name']&&_0x3c985f[_0x65f4('0x3c')]&&_0x3c985f[_0x65f4('0x38')]){_0x5954de[_0x3c985f[_0x65f4('0x40')][_0x65f4('0x15')][_0x65f4('0x41')]()]&&_0x146a1a[_0x65f4('0x17')]['push']({'id':_0x3c985f[_0x65f4('0x3c')],'value':_0x5954de[_0x3c985f[_0x65f4('0x40')][_0x65f4('0x15')]['toLowerCase']()][_0x65f4('0x2e')]()});}});}return _0x146a1a;}exports[_0x65f4('0x42')]=function(_0xdaa7d8,_0x1cdc9d,_0x2d3532,_0x7e6204,_0x572349,_0x20cfdd){var _0x485013,_0x3efd85;_0x20cfdd[_0x65f4('0x1c')]=intUtil[_0x65f4('0x43')](_0x20cfdd[_0x65f4('0x1c')]);_0x20cfdd[_0x65f4('0x44')]=intUtil[_0x65f4('0x43')](_0x20cfdd[_0x65f4('0x44')]);if(_0x572349&&_0x572349[_0x65f4('0x45')]){logger['info'](_0x65f4('0x46'),'Recording\x20is\x20enabled!');_0x1cdc9d[_0x65f4('0x47')]=util[_0x65f4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20cfdd[_0x65f4('0x44')],_0x1cdc9d[_0x65f4('0x48')],md5(_0x1cdc9d['uniqueid']));}else{_0x1cdc9d['recordingURL']='';}headers[_0x65f4('0x49')]=getAuth(_0x20cfdd);return getUser(_0x20cfdd,_0x7e6204[_0x65f4('0x4a')])['then'](function(_0x380c22){_0x485013=_0x380c22;logger[_0x65f4('0xb')](_0x65f4('0x4b'),_0x485013['id']);return getEndUser(_0x20cfdd,_0x1cdc9d[_0x65f4('0x10')],_0x1cdc9d['calleridnum']);})[_0x65f4('0x1e')](function(_0x399f47){_0x3efd85=_0x399f47;logger[_0x65f4('0xb')](_0x65f4('0x4c'),_0x3efd85['id']);return getTicket(_0x20cfdd,_0x485013,_0x3efd85,_0x2d3532,_0x1cdc9d);})['then'](function(_0x20affb){if(_0x20affb&&_0x20affb['id']){logger['info'](_0x65f4('0x1f'));logger[_0x65f4('0xb')](_0x65f4('0x4d'),_0x20affb['id']);logger[_0x65f4('0xb')](_0x65f4('0x46'),_0x65f4('0x4e'));emit(util[_0x65f4('0xe')](_0x65f4('0x4f'),_0x7e6204[_0x65f4('0x15')]),_0x65f4('0x50'),{'uri':util['format'](_0x65f4('0x51'),_0x20cfdd['remoteUri'],_0x20affb['id'])});}})[_0x65f4('0x52')](function(_0xd8b8b4){logger[_0x65f4('0x53')](_0x65f4('0x46'),JSON[_0x65f4('0x54')](_0xd8b8b4));});};exports['outbound']=function(_0x4c6212,_0x487ae6,_0x4a28d9,_0x23625b,_0x1a6050,_0x47bda9,_0x439e4e){var _0x2f22f0,_0x4c0522;_0x47bda9[_0x65f4('0x1c')]=intUtil['stripTrailingSlash'](_0x47bda9[_0x65f4('0x1c')]);_0x47bda9[_0x65f4('0x44')]=intUtil['stripTrailingSlash'](_0x47bda9[_0x65f4('0x44')]);if(_0x439e4e&&_0x439e4e['recordingFormat']&&_0x439e4e[_0x65f4('0x55')]!==_0x65f4('0x56')){logger[_0x65f4('0xb')](_0x65f4('0x57'),'Recording\x20is\x20enabled!');_0x487ae6[_0x65f4('0x47')]=util[_0x65f4('0xe')](_0x65f4('0x58'),_0x47bda9['serverUrl'],_0x487ae6[_0x65f4('0x48')],md5(_0x487ae6[_0x65f4('0x48')]));}headers[_0x65f4('0x49')]=getAuth(_0x47bda9);return getUser(_0x47bda9,_0x23625b[_0x65f4('0x4a')])[_0x65f4('0x1e')](function(_0x53f32b){_0x2f22f0=_0x53f32b;logger[_0x65f4('0xb')](_0x65f4('0x4b'),_0x2f22f0['id']);return getEndUser(_0x47bda9,_0x487ae6['destcalleridname'],_0x487ae6[_0x65f4('0x59')]);})[_0x65f4('0x1e')](function(_0x13118d){_0x4c0522=_0x13118d;logger[_0x65f4('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4c0522['id']);return getTicket(_0x47bda9,_0x2f22f0,_0x4c0522,_0x4a28d9,_0x487ae6);})[_0x65f4('0x1e')](function(_0x19236d){if(_0x19236d&&_0x19236d['id']){logger['info'](_0x65f4('0x1f'));logger['info'](_0x65f4('0x4d'),_0x19236d['id']);logger[_0x65f4('0xb')](_0x65f4('0x57'),_0x65f4('0x4e'));emit(util['format'](_0x65f4('0x4f'),_0x23625b[_0x65f4('0x15')]),_0x65f4('0x50'),{'uri':util[_0x65f4('0xe')](_0x65f4('0x51'),_0x47bda9['remoteUri'],_0x19236d['id'])});}})[_0x65f4('0x52')](function(_0x20fd74){logger[_0x65f4('0x53')](_0x65f4('0x57'),JSON[_0x65f4('0x54')](_0x20fd74));});};exports[_0x65f4('0x5a')]=function(_0x476a45,_0x36f23a,_0x5ae97d,_0x4a476e,_0x445a39,_0x2f3912){var _0xa4880b,_0xda1660;_0x2f3912['remoteUri']=intUtil[_0x65f4('0x43')](_0x2f3912[_0x65f4('0x1c')]);_0x2f3912[_0x65f4('0x44')]=intUtil[_0x65f4('0x43')](_0x2f3912['serverUrl']);if(_0x445a39&&_0x445a39[_0x65f4('0x45')]){logger[_0x65f4('0xb')]('['+_0x36f23a[_0x65f4('0x5b')]['toUpperCase']()+']',_0x65f4('0x5c'));_0x36f23a[_0x65f4('0x47')]=util[_0x65f4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f3912[_0x65f4('0x44')],_0x36f23a[_0x65f4('0x48')],md5(_0x36f23a[_0x65f4('0x48')]));}else{_0x36f23a[_0x65f4('0x47')]='';}headers[_0x65f4('0x49')]=getAuth(_0x2f3912);return getUser(_0x2f3912,'')[_0x65f4('0x1e')](function(_0x52c313){_0xa4880b=_0x52c313;logger[_0x65f4('0xb')](_0x65f4('0x4b'),_0xa4880b['id']);return getEndUser(_0x2f3912,_0x36f23a[_0x65f4('0x10')],_0x36f23a[_0x65f4('0x11')]);})[_0x65f4('0x1e')](function(_0x2a69d6){_0xda1660=_0x2a69d6;logger[_0x65f4('0xb')](_0x65f4('0x4c'),_0xda1660['id']);return getTicket(_0x2f3912,_0xa4880b,_0xda1660,_0x5ae97d,_0x36f23a);})['then'](function(_0x1c3d8b){if(_0x1c3d8b){logger['info']('Ticket\x20created!');logger['info'](_0x65f4('0x4d'),_0x1c3d8b['id']);}})[_0x65f4('0x52')](function(_0xde803d){logger[_0x65f4('0x53')]('['+_0x36f23a[_0x65f4('0x5b')][_0x65f4('0x5d')]()+']',JSON[_0x65f4('0x54')](_0xde803d));});}; \ 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 e693c5a..31bba82 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 _0xcd34=['Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','GET','&entities=contact','then','contacts','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','unmanaged','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','moment','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xcd34,0x83));var _0x4cd3=function(_0x56132f,_0x4d9675){_0x56132f=_0x56132f-0x0;var _0x358ca2=_0xcd34[_0x56132f];return _0x358ca2;};'use strict';var _=require(_0x4cd3('0x0'));var rp=require('request-promise');var md5=require(_0x4cd3('0x1'));var util=require(_0x4cd3('0x2'));var moment=require(_0x4cd3('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4cd3('0x4'));var logger=require(_0x4cd3('0x5'))('freshsales');config[_0x4cd3('0x6')]=_[_0x4cd3('0x7')](config[_0x4cd3('0x6')],{'host':_0x4cd3('0x8'),'port':0x18eb});var io=require(_0x4cd3('0x9'))(new Redis(config['redis']));function getAdminId(_0x3fd606,_0x898874,_0x6295c6,_0x3f4e26){return new Promise(function(_0x1dfd10,_0x52fb84){var _0x540ed0=![];var _0x46a909={'method':'GET','uri':_0x3f4e26+'/api/selector/owners','json':!![]};_0x46a909[_0x4cd3('0xa')]=_0x6295c6;logger[_0x4cd3('0xb')](_0x4cd3('0xc'));return rp(_0x46a909)['then'](function(_0x2d1d11){if(_0x2d1d11){var _0x5737ad=_0x2d1d11[_0x4cd3('0xd')];var _0x4e379b=null;for(_0x4e379b=0x0;_0x4e379b<_0x5737ad[_0x4cd3('0xe')];_0x4e379b++){if(_0x5737ad[_0x4e379b][_0x4cd3('0xf')]===_0x3fd606[_0x4cd3('0x10')]){_0x3fd606[_0x4cd3('0x11')]=_0x5737ad[_0x4e379b]['id'];_0x540ed0=!![];}}if(_0x540ed0){logger['info'](_0x4cd3('0x12'),_0x3fd606[_0x4cd3('0x11')]);_0x1dfd10(_0x3fd606);}else{_0x52fb84({'statusCode':0x194,'message':_0x4cd3('0x13')});}}else{_0x52fb84({'statusCode':0x194,'message':_0x4cd3('0x13')});}})[_0x4cd3('0x14')](function(_0xfa0191){logger[_0x4cd3('0x15')]('['+[_0x898874[_0x4cd3('0x16')]()]+']',_0xfa0191[_0x4cd3('0x17')]);_0x52fb84(_0xfa0191);});});}function getUser(_0x4572df,_0x593389,_0x4243ed){return function(_0x33498a){return new Promise(function(_0x30f422,_0x1af46d){var _0x1094b9={'method':'GET','uri':_0x4243ed+_0x4cd3('0x18'),'json':!![]};_0x1094b9[_0x4cd3('0xa')]=_0x593389;logger['info'](_0x4cd3('0x19'));return rp(_0x1094b9)['then'](function(_0x2f040c){if(_0x2f040c){var _0x56c1fe=_0x2f040c[_0x4cd3('0xd')];var _0x543cbb=![];var _0x48f382=null;if(_0x33498a['agentEmail']!==null){logger[_0x4cd3('0xb')](_0x4cd3('0x1a'),_0x33498a['agentEmail']);_0x33498a['userEmail']=_0x33498a['agentEmail'];for(_0x48f382=0x0;_0x48f382<_0x56c1fe[_0x4cd3('0xe')];_0x48f382++){if(_0x56c1fe[_0x48f382][_0x4cd3('0xf')]===_0x33498a[_0x4cd3('0x1b')]){_0x543cbb=!![];_0x33498a[_0x4cd3('0x1c')]=_0x56c1fe[_0x48f382]['id'];logger['info'](_0x4cd3('0x1d'),_0x33498a[_0x4cd3('0x1c')]);}}}if(!_0x543cbb){logger[_0x4cd3('0xb')](_0x4cd3('0x1e'));_0x33498a['userEmail']=_0x33498a[_0x4cd3('0x10')];_0x33498a[_0x4cd3('0x1c')]=_0x33498a[_0x4cd3('0x11')];_0x543cbb=!![];}if(_0x543cbb){_0x30f422(_0x33498a);}else{_0x1af46d({'statusCode':0x194,'message':_0x4cd3('0x13')});}}else{_0x1af46d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4cd3('0x14')](function(_0x39eeb9){logger[_0x4cd3('0x15')]('['+[_0x4572df[_0x4cd3('0x16')]()]+']',_0x39eeb9['message']);_0x1af46d(_0x39eeb9);});});};}function searchContact(_0x142dd9,_0x311b14,_0x15bf17,_0x3566e2){return new Promise(function(_0x2c26ff,_0x2dba43){var _0x77207e={'method':_0x4cd3('0x1f'),'headers':_0x311b14,'uri':_0x142dd9+'/api/lookup?q='+_0x3566e2+'&f='+_0x15bf17+_0x4cd3('0x20'),'json':!![]};rp(_0x77207e)[_0x4cd3('0x21')](function(_0x3d7e49){var _0x47148f=_['find'](_0x3d7e49['contacts'][_0x4cd3('0x22')],[_0x15bf17,_0x3566e2]);_0x2c26ff(_0x47148f);})[_0x4cd3('0x14')](function(_0x259f01){_0x2dba43(_0x259f01);});});}function getEndUser(_0x32c823,_0x543571,_0x211ff9){return function(_0x4d2819){return new Promise(function(_0x125420,_0x1b8cb4){logger[_0x4cd3('0xb')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x4d2819[_0x4cd3('0x23')]));searchContact(_0x211ff9,_0x543571,_0x4cd3('0x24'),_0x4d2819[_0x4cd3('0x23')])[_0x4cd3('0x21')](function(_0x5ec06b){if(_0x5ec06b){_0x4d2819['endUserId']=_0x5ec06b['id'];logger[_0x4cd3('0xb')]('Contact\x20found\x20mobile_number:',_0x4d2819[_0x4cd3('0x25')]);return _0x125420(_0x4d2819);}searchContact(_0x211ff9,_0x543571,_0x4cd3('0x26'),_0x4d2819[_0x4cd3('0x23')])['then'](function(_0x4d7ab3){if(_0x4d7ab3){_0x4d2819[_0x4cd3('0x25')]=_0x4d7ab3['id'];logger[_0x4cd3('0xb')](_0x4cd3('0x27'),_0x4d2819[_0x4cd3('0x25')]);return _0x125420(_0x4d2819);}createEndUser(_0x4d2819,_0x32c823,_0x543571,_0x211ff9)[_0x4cd3('0x21')](function(_0x3af1f3){logger[_0x4cd3('0xb')](_0x4cd3('0x28'),_0x3af1f3[_0x4cd3('0x25')]);return _0x125420(_0x3af1f3);});});})[_0x4cd3('0x14')](function(_0x5604f8){_0x1b8cb4(_0x5604f8);});});};}function createEndUser(_0x55f354,_0x3fe3ba,_0x55631e,_0x2584dd){return new Promise(function(_0x106f7c,_0x3e8d84){var _0x303b4b=moment();var _0x25e4af={'method':'POST','uri':_0x2584dd+_0x4cd3('0x29'),'body':{'contact':{'last_name':_0x55f354[_0x4cd3('0x23')],'work_number':_0x55f354[_0x4cd3('0x23')],'mobile_number':_0x55f354[_0x4cd3('0x23')],'owner_id':_0x55f354[_0x4cd3('0x1c')],'created_at':_0x303b4b[_0x4cd3('0x2a')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x25e4af[_0x4cd3('0xa')]=_0x55631e;logger[_0x4cd3('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x25e4af)[_0x4cd3('0x21')](function(_0x42bb59){_0x55f354[_0x4cd3('0x25')]=_0x42bb59[_0x4cd3('0x2b')]['id'];_0x106f7c(_0x55f354);})[_0x4cd3('0x14')](function(_0xc4259e){logger['error']('['+[_0x3fe3ba[_0x4cd3('0x16')]()]+']',_0xc4259e[_0x4cd3('0x17')]);_0x3e8d84(_0xc4259e['message']);});});}function getTicket(_0x140bc1,_0x5a2c90,_0x2c57c1,_0x2f5288,_0x19bd3a){return function(_0x11b297){logger[_0x4cd3('0xb')](_0x4cd3('0x2c'));return new Promise(function(_0x466f53,_0x1a7173){var _0x562ca4=moment();var _0x5d30d4={'method':'POST','uri':_0x2c57c1+_0x4cd3('0x2d'),'body':{'title':intUtil['getString'](_0x2f5288[_0x4cd3('0x2e')],_0x19bd3a,'\x20'),'description':intUtil[_0x4cd3('0x2f')](_0x2f5288['Descriptions'],_0x19bd3a,'\x0a'),'owner_id':_0x11b297[_0x4cd3('0x1c')],'creater_id':_0x11b297[_0x4cd3('0x11')],'targetable_id':_0x11b297[_0x4cd3('0x25')],'targetable_type':_0x4cd3('0x30'),'created_at':_0x562ca4[_0x4cd3('0x2a')](_0x4cd3('0x31')),'due_date':_0x562ca4[_0x4cd3('0x32')](0x1e,'m')[_0x4cd3('0x2a')](_0x4cd3('0x31'))},'json':!![]};_0x5d30d4[_0x4cd3('0xa')]=_0x5a2c90;return rp(_0x5d30d4)[_0x4cd3('0x21')](function(_0x104b88){_0x11b297[_0x4cd3('0x33')]=_0x104b88['task']['id'];logger[_0x4cd3('0xb')]('Task\x20created:',_0x11b297[_0x4cd3('0x33')]);_0x466f53(_0x11b297);})[_0x4cd3('0x14')](function(_0x5bf852){logger[_0x4cd3('0x15')]('['+[_0x140bc1['toUpperCase']()]+']',_0x5bf852[_0x4cd3('0x17')]);_0x1a7173(_0x5bf852[_0x4cd3('0x17')]);});});};}function emit(_0x159cde,_0x2a2436,_0x4489ea){var _0x1089d4={'uri':_0x159cde+'/contacts/'+_0x4489ea};io['to'](util[_0x4cd3('0x2a')](_0x4cd3('0x34'),_0x2a2436))[_0x4cd3('0x35')](_0x4cd3('0x36'),_0x1089d4);}exports['cs']=function(_0x3740b4,_0x54a980,_0x21d4ac,_0x371ad9,_0x1129d4,_0x1ae365,_0x4cc94e,_0xe11ad1){var _0x2789a7={};var _0x18d9e4={'Authorization':_0x4cd3('0x37')+_0x1ae365[_0x4cd3('0x38')]};_0x1ae365[_0x4cd3('0x39')]=intUtil[_0x4cd3('0x3a')](_0x1ae365[_0x4cd3('0x39')]);_0x1ae365['serverUrl']=intUtil[_0x4cd3('0x3a')](_0x1ae365[_0x4cd3('0x3b')]);var _0x26c5c9=_0x1ae365['remoteUri'];_0x2789a7['adminEmail']=_0x1ae365[_0x4cd3('0x3c')];_0x2789a7[_0x4cd3('0x23')]=_0xe11ad1['toLowerCase']()===_0x4cd3('0x3d')?_0x54a980[_0x4cd3('0x3e')]:_0x54a980['calleridnum'];_0x2789a7[_0x4cd3('0x3f')]=_0xe11ad1==='queue'||_0xe11ad1===_0x4cd3('0x40')?'queue':_0x4cd3('0x3d');if(_0x371ad9){_0x2789a7[_0x4cd3('0x1b')]=_0x371ad9['email'];}var _0x528c7e=util[_0x4cd3('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ae365[_0x4cd3('0x3b')],_0x54a980['uniqueid'],md5(_0x54a980['uniqueid']));if(_0x1129d4&&_0x1129d4[_0x4cd3('0x41')]){logger[_0x4cd3('0xb')](_0x4cd3('0x42'),_0x4cd3('0x43'));_0x54a980[_0x4cd3('0x44')]=_0x528c7e;}else if(_0x4cc94e&&_0x4cc94e['recordingFormat']&&_0x4cc94e['recordingFormat']!==_0x4cd3('0x45')){logger[_0x4cd3('0xb')](_0x4cd3('0x46'),'Recording\x20is\x20enabled!');_0x54a980[_0x4cd3('0x44')]=_0x528c7e;}else{_0x54a980['recordingURL']='';}return getAdminId(_0x2789a7,_0xe11ad1,_0x18d9e4,_0x26c5c9)[_0x4cd3('0x21')](getUser(_0xe11ad1,_0x18d9e4,_0x26c5c9))[_0x4cd3('0x21')](getEndUser(_0xe11ad1,_0x18d9e4,_0x26c5c9))['then'](getTicket(_0xe11ad1,_0x18d9e4,_0x26c5c9,_0x21d4ac,_0x54a980))[_0x4cd3('0x21')](function(_0x3a43d1){logger['info'](util[_0x4cd3('0x2a')](_0x4cd3('0x47'),_0x3a43d1[_0x4cd3('0x33')]));if(_0xe11ad1!==_0x4cd3('0x40')){logger[_0x4cd3('0xb')]('['+[_0xe11ad1[_0x4cd3('0x16')]()]+']',_0x4cd3('0x48'));emit(_0x26c5c9,_0x371ad9[_0x4cd3('0x49')],_0x3a43d1[_0x4cd3('0x25')]);}})['catch'](function(_0x2f445e){logger['error']('['+[_0xe11ad1['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x4cd3('0x4a')](_0x2f445e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x08b3=['mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','Descriptions','Contact','add','ticketId','task','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','email','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','users','agentEmail','userEmail','userId','User\x20found:','/api/lookup?q=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08b3,0x86));var _0x308b=function(_0x3f9459,_0x444d72){_0x3f9459=_0x3f9459-0x0;var _0x471a46=_0x08b3[_0x3f9459];return _0x471a46;};'use strict';var _=require(_0x308b('0x0'));var rp=require(_0x308b('0x1'));var md5=require(_0x308b('0x2'));var util=require(_0x308b('0x3'));var moment=require(_0x308b('0x4'));var Promise=require(_0x308b('0x5'));var Redis=require(_0x308b('0x6'));var intUtil=require('./util');var config=require(_0x308b('0x7'));var logger=require(_0x308b('0x8'))(_0x308b('0x9'));config[_0x308b('0xa')]=_[_0x308b('0xb')](config[_0x308b('0xa')],{'host':_0x308b('0xc'),'port':0x18eb});var io=require(_0x308b('0xd'))(new Redis(config[_0x308b('0xa')]));function getAdminId(_0xa4575b,_0x4b2440,_0x3190dd,_0x2b209c){return new Promise(function(_0x14fa7a,_0x504c6b){var _0x257ea3=![];var _0x295b03={'method':_0x308b('0xe'),'uri':_0x2b209c+'/api/selector/owners','json':!![]};_0x295b03[_0x308b('0xf')]=_0x3190dd;logger[_0x308b('0x10')](_0x308b('0x11'));return rp(_0x295b03)[_0x308b('0x12')](function(_0x5ddb67){if(_0x5ddb67){var _0x8ff444=_0x5ddb67['users'];var _0x49ba44=null;for(_0x49ba44=0x0;_0x49ba44<_0x8ff444[_0x308b('0x13')];_0x49ba44++){if(_0x8ff444[_0x49ba44]['email']===_0xa4575b[_0x308b('0x14')]){_0xa4575b[_0x308b('0x15')]=_0x8ff444[_0x49ba44]['id'];_0x257ea3=!![];}}if(_0x257ea3){logger['info']('Admin\x20found:',_0xa4575b[_0x308b('0x15')]);_0x14fa7a(_0xa4575b);}else{_0x504c6b({'statusCode':0x194,'message':_0x308b('0x16')});}}else{_0x504c6b({'statusCode':0x194,'message':_0x308b('0x16')});}})[_0x308b('0x17')](function(_0x160ee2){logger[_0x308b('0x18')]('['+[_0x4b2440[_0x308b('0x19')]()]+']',_0x160ee2[_0x308b('0x1a')]);_0x504c6b(_0x160ee2);});});}function getUser(_0x28f570,_0x5e0b86,_0x3d2bbd){return function(_0x13e87d){return new Promise(function(_0x4b16ce,_0x272106){var _0x4e015a={'method':_0x308b('0xe'),'uri':_0x3d2bbd+_0x308b('0x1b'),'json':!![]};_0x4e015a[_0x308b('0xf')]=_0x5e0b86;logger[_0x308b('0x10')]('Getting\x20user\x20list');return rp(_0x4e015a)[_0x308b('0x12')](function(_0x5c24dd){if(_0x5c24dd){var _0x335abc=_0x5c24dd[_0x308b('0x1c')];var _0x5b41f4=![];var _0x21aa39=null;if(_0x13e87d[_0x308b('0x1d')]!==null){logger[_0x308b('0x10')]('Getting\x20user\x20with\x20email',_0x13e87d['agentEmail']);_0x13e87d[_0x308b('0x1e')]=_0x13e87d[_0x308b('0x1d')];for(_0x21aa39=0x0;_0x21aa39<_0x335abc[_0x308b('0x13')];_0x21aa39++){if(_0x335abc[_0x21aa39]['email']===_0x13e87d[_0x308b('0x1d')]){_0x5b41f4=!![];_0x13e87d[_0x308b('0x1f')]=_0x335abc[_0x21aa39]['id'];logger['info'](_0x308b('0x20'),_0x13e87d[_0x308b('0x1f')]);}}}if(!_0x5b41f4){logger[_0x308b('0x10')]('Admin\x20selected');_0x13e87d[_0x308b('0x1e')]=_0x13e87d['adminEmail'];_0x13e87d['userId']=_0x13e87d[_0x308b('0x15')];_0x5b41f4=!![];}if(_0x5b41f4){_0x4b16ce(_0x13e87d);}else{_0x272106({'statusCode':0x194,'message':_0x308b('0x16')});}}else{_0x272106({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x308b('0x17')](function(_0x78796c){logger[_0x308b('0x18')]('['+[_0x28f570['toUpperCase']()]+']',_0x78796c['message']);_0x272106(_0x78796c);});});};}function searchContact(_0x50c402,_0x3ff7b2,_0x130d09,_0x12ffc5){return new Promise(function(_0x3e4f66,_0x433b1b){var _0x3e65e2={'method':_0x308b('0xe'),'headers':_0x3ff7b2,'uri':_0x50c402+_0x308b('0x21')+_0x12ffc5+'&f='+_0x130d09+_0x308b('0x22'),'json':!![]};rp(_0x3e65e2)[_0x308b('0x12')](function(_0x4bdb0e){var _0x26e1ff=_[_0x308b('0x23')](_0x4bdb0e[_0x308b('0x24')][_0x308b('0x24')],[_0x130d09,_0x12ffc5]);_0x3e4f66(_0x26e1ff);})[_0x308b('0x17')](function(_0x4ef684){_0x433b1b(_0x4ef684);});});}function getEndUser(_0x3b1e7f,_0x28f9f2,_0x49983f){return function(_0x137f2a){return new Promise(function(_0x4d2122,_0x22ca03){logger['info'](util['format'](_0x308b('0x25'),_0x137f2a['contactNumber']));searchContact(_0x49983f,_0x28f9f2,_0x308b('0x26'),_0x137f2a[_0x308b('0x27')])['then'](function(_0x3dc0dd){if(_0x3dc0dd){_0x137f2a[_0x308b('0x28')]=_0x3dc0dd['id'];logger[_0x308b('0x10')](_0x308b('0x29'),_0x137f2a[_0x308b('0x28')]);return _0x4d2122(_0x137f2a);}searchContact(_0x49983f,_0x28f9f2,_0x308b('0x2a'),_0x137f2a[_0x308b('0x27')])[_0x308b('0x12')](function(_0xc4777c){if(_0xc4777c){_0x137f2a['endUserId']=_0xc4777c['id'];logger[_0x308b('0x10')](_0x308b('0x2b'),_0x137f2a[_0x308b('0x28')]);return _0x4d2122(_0x137f2a);}createEndUser(_0x137f2a,_0x3b1e7f,_0x28f9f2,_0x49983f)['then'](function(_0x105f24){logger[_0x308b('0x10')](_0x308b('0x2c'),_0x105f24[_0x308b('0x28')]);return _0x4d2122(_0x105f24);});});})[_0x308b('0x17')](function(_0x4de677){_0x22ca03(_0x4de677);});});};}function createEndUser(_0x694dd9,_0x41e003,_0x18cf1a,_0x2e3054){return new Promise(function(_0x1a990e,_0x4ef095){var _0x4f2058=moment();var _0x3fc748={'method':_0x308b('0x2d'),'uri':_0x2e3054+_0x308b('0x2e'),'body':{'contact':{'last_name':_0x694dd9['contactNumber'],'work_number':_0x694dd9['contactNumber'],'mobile_number':_0x694dd9[_0x308b('0x27')],'owner_id':_0x694dd9[_0x308b('0x1f')],'created_at':_0x4f2058[_0x308b('0x2f')](_0x308b('0x30'))}},'json':!![]};_0x3fc748[_0x308b('0xf')]=_0x18cf1a;logger['info'](_0x308b('0x31'));return rp(_0x3fc748)[_0x308b('0x12')](function(_0x3db21a){_0x694dd9[_0x308b('0x28')]=_0x3db21a[_0x308b('0x32')]['id'];_0x1a990e(_0x694dd9);})[_0x308b('0x17')](function(_0x1330a3){logger['error']('['+[_0x41e003[_0x308b('0x19')]()]+']',_0x1330a3[_0x308b('0x1a')]);_0x4ef095(_0x1330a3[_0x308b('0x1a')]);});});}function getTicket(_0x29d3a0,_0x3555b9,_0x403449,_0x12211c,_0x4dfce){return function(_0x24d6a6){logger[_0x308b('0x10')](_0x308b('0x33'));return new Promise(function(_0x1fef7b,_0x402093){var _0x1c0f42=moment();var _0xcbb157={'method':_0x308b('0x2d'),'uri':_0x403449+_0x308b('0x34'),'body':{'title':intUtil['getString'](_0x12211c[_0x308b('0x35')],_0x4dfce,'\x20'),'description':intUtil['getString'](_0x12211c[_0x308b('0x36')],_0x4dfce,'\x0a'),'owner_id':_0x24d6a6['userId'],'creater_id':_0x24d6a6['adminId'],'targetable_id':_0x24d6a6[_0x308b('0x28')],'targetable_type':_0x308b('0x37'),'created_at':_0x1c0f42['format'](_0x308b('0x30')),'due_date':_0x1c0f42[_0x308b('0x38')](0x1e,'m')[_0x308b('0x2f')](_0x308b('0x30'))},'json':!![]};_0xcbb157[_0x308b('0xf')]=_0x3555b9;return rp(_0xcbb157)[_0x308b('0x12')](function(_0x21c074){_0x24d6a6[_0x308b('0x39')]=_0x21c074[_0x308b('0x3a')]['id'];logger['info']('Task\x20created:',_0x24d6a6[_0x308b('0x39')]);_0x1fef7b(_0x24d6a6);})[_0x308b('0x17')](function(_0x2392d9){logger[_0x308b('0x18')]('['+[_0x29d3a0[_0x308b('0x19')]()]+']',_0x2392d9[_0x308b('0x1a')]);_0x402093(_0x2392d9[_0x308b('0x1a')]);});});};}function emit(_0x343c74,_0x17a2a9,_0x5289bf){var _0x15a12e={'uri':_0x343c74+'/contacts/'+_0x5289bf};io['to'](util['format'](_0x308b('0x3b'),_0x17a2a9))[_0x308b('0x3c')](_0x308b('0x3d'),_0x15a12e);}exports['cs']=function(_0x2f240c,_0x1e0752,_0xf41359,_0x20bc69,_0x4e8efa,_0x3ba4fe,_0x5e1bc9,_0x1ce89c){var _0x3c394a={};var _0x136798={'Authorization':_0x308b('0x3e')+_0x3ba4fe[_0x308b('0x3f')]};_0x3ba4fe['remoteUri']=intUtil[_0x308b('0x40')](_0x3ba4fe[_0x308b('0x41')]);_0x3ba4fe[_0x308b('0x42')]=intUtil['stripTrailingSlash'](_0x3ba4fe[_0x308b('0x42')]);var _0x5484f1=_0x3ba4fe[_0x308b('0x41')];_0x3c394a[_0x308b('0x14')]=_0x3ba4fe[_0x308b('0x43')];_0x3c394a['contactNumber']=_0x1ce89c[_0x308b('0x44')]()===_0x308b('0x45')?_0x1e0752['destcalleridnum']:_0x1e0752[_0x308b('0x46')];_0x3c394a[_0x308b('0x47')]=_0x1ce89c===_0x308b('0x48')||_0x1ce89c==='unmanaged'?_0x308b('0x48'):'outbound';if(_0x20bc69){_0x3c394a[_0x308b('0x1d')]=_0x20bc69[_0x308b('0x49')];}var _0x385d01=util[_0x308b('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ba4fe[_0x308b('0x42')],_0x1e0752['uniqueid'],md5(_0x1e0752[_0x308b('0x4a')]));if(_0x4e8efa&&_0x4e8efa[_0x308b('0x4b')]){logger[_0x308b('0x10')](_0x308b('0x4c'),_0x308b('0x4d'));_0x1e0752['recordingURL']=_0x385d01;}else if(_0x5e1bc9&&_0x5e1bc9['recordingFormat']&&_0x5e1bc9[_0x308b('0x4e')]!==_0x308b('0x4f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1e0752[_0x308b('0x50')]=_0x385d01;}else{_0x1e0752[_0x308b('0x50')]='';}return getAdminId(_0x3c394a,_0x1ce89c,_0x136798,_0x5484f1)['then'](getUser(_0x1ce89c,_0x136798,_0x5484f1))[_0x308b('0x12')](getEndUser(_0x1ce89c,_0x136798,_0x5484f1))[_0x308b('0x12')](getTicket(_0x1ce89c,_0x136798,_0x5484f1,_0xf41359,_0x1e0752))[_0x308b('0x12')](function(_0x32a881){logger[_0x308b('0x10')](util[_0x308b('0x2f')](_0x308b('0x51'),_0x32a881['ticketId']));if(_0x1ce89c!==_0x308b('0x52')){logger[_0x308b('0x10')]('['+[_0x1ce89c[_0x308b('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5484f1,_0x20bc69[_0x308b('0x53')],_0x32a881['endUserId']);}})[_0x308b('0x17')](function(_0x19d586){logger[_0x308b('0x18')]('['+[_0x1ce89c['toUpperCase']()]+_0x308b('0x54'),util[_0x308b('0x55')](_0x19d586,{'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 db1ca35..2d2cbfa 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 _0xeef5=['outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','zoho','desk','vtiger','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshsales','servicenow','data1','toLowerCase','Configurations','data3','queue','routeId'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xeef5,0x12f));var _0x5eef=function(_0x2c0d0d,_0x277cb9){_0x2c0d0d=_0x2c0d0d-0x0;var _0x36e349=_0xeef5[_0x2c0d0d];return _0x36e349;};'use strict';var _=require(_0x5eef('0x0'));var util=require(_0x5eef('0x1'));var zendesk=require(_0x5eef('0x2'));var salesforce=require(_0x5eef('0x3'));var sugarcrm=require(_0x5eef('0x4'));var freshdesk=require(_0x5eef('0x5'));var zoho=require(_0x5eef('0x6'));var desk=require(_0x5eef('0x7'));var vtiger=require(_0x5eef('0x8'));var servicenow=require(_0x5eef('0x9'));var dynamics365=require(_0x5eef('0xa'));var freshsales=require('./freshsales');var integrations=[_0x5eef('0xb'),'salesforce',_0x5eef('0xc'),'freshdesk','zoho','desk','vtiger','dynamics365',_0x5eef('0xd'),_0x5eef('0xe')];exports['exec']=function(_0x244856,_0x5322bc,_0x4062e5,_0x48b911,_0x59befa,_0x1addde){if(_0x4062e5){if(_['includes'](integrations,_0x244856[_0x5eef('0xf')]['toLowerCase']())){try{var _0x43061e=null;var _0x3283ca='';var _0xb56eaf=_0x4062e5[_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]()];if(_0xb56eaf){var _0x4481fb=_0xb56eaf[_0x244856['data2']];if(_0x4481fb){var _0x18f0e1=_['find'](_0x4481fb[_0x5eef('0x11')],{'id':parseInt(_0x244856[_0x5eef('0x12')],0xa)});if(_0x18f0e1){if(_0x48b911){if(_0x59befa&&_0x5322bc[_0x5eef('0x13')]){_0x3283ca='queue';}else if(_0x5322bc[_0x5eef('0x14')]){_0x3283ca=_0x5eef('0x15');}else{console['log'](_0x5eef('0x16'),_0x5322bc);}}else{_0x3283ca=_0x5eef('0x17');}switch(_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]()){case'zendesk':zendesk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x18'):salesforce[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0xc'):sugarcrm[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x19'):freshdesk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1a'):zoho[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1b'):desk[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0x1c'):vtiger[_0x3283ca](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde);break;case _0x5eef('0xd'):freshsales['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;case _0x5eef('0xe'):servicenow['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;case'dynamics365':dynamics365['cs'](_0x244856,_0x5322bc,_0x18f0e1,_0x48b911,_0x59befa,_0x4481fb,_0x1addde,_0x3283ca);break;default:console['log'](_0x5eef('0x1d'));}}else{_0x43061e=require('../../../../config/logger')(_0x244856['data1'][_0x5eef('0x10')]());_0x43061e[_0x5eef('0x1e')](_0x5eef('0x1f'),util[_0x5eef('0x20')](_0x5eef('0x21'),_0x244856[_0x5eef('0xf')][_0x5eef('0x10')](),_0x244856[_0x5eef('0x12')]));}}else{_0x43061e=require(_0x5eef('0x22'))(_0x244856[_0x5eef('0xf')][_0x5eef('0x10')]());_0x43061e[_0x5eef('0x1e')](_0x5eef('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x244856[_0x5eef('0xf')][_0x5eef('0x10')](),_0x244856[_0x5eef('0x23')]));}}else{}}catch(_0x3fc91f){console['error'](_0x3fc91f);}}}}; \ No newline at end of file +var _0x035f=['unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','error','lodash','./salesforce','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','data2','find','data3','queue','routeId','vtiger'];(function(_0x14db96,_0x566cc6){var _0x40651e=function(_0x43a9ca){while(--_0x43a9ca){_0x14db96['push'](_0x14db96['shift']());}};_0x40651e(++_0x566cc6);}(_0x035f,0x11e));var _0xf035=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x035f[_0x3e8cae];return _0x45c4d6;};'use strict';var _=require(_0xf035('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xf035('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xf035('0x2'));var desk=require(_0xf035('0x3'));var vtiger=require(_0xf035('0x4'));var servicenow=require(_0xf035('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf035('0x6'));var integrations=[_0xf035('0x7'),'salesforce',_0xf035('0x8'),_0xf035('0x9'),_0xf035('0xa'),_0xf035('0xb'),'vtiger',_0xf035('0xc'),_0xf035('0xd'),_0xf035('0xe')];exports[_0xf035('0xf')]=function(_0xa39734,_0x26bf67,_0x1d99f4,_0x221354,_0x4788a4,_0xcbb74c){if(_0x1d99f4){if(_['includes'](integrations,_0xa39734['data1'][_0xf035('0x10')]())){try{var _0x2d435a=null;var _0x38a62b='';var _0x5e4604=_0x1d99f4[_0xa39734[_0xf035('0x11')][_0xf035('0x10')]()];if(_0x5e4604){var _0x4d5c8a=_0x5e4604[_0xa39734[_0xf035('0x12')]];if(_0x4d5c8a){var _0x587914=_[_0xf035('0x13')](_0x4d5c8a['Configurations'],{'id':parseInt(_0xa39734[_0xf035('0x14')],0xa)});if(_0x587914){if(_0x221354){if(_0x4788a4&&_0x26bf67[_0xf035('0x15')]){_0x38a62b=_0xf035('0x15');}else if(_0x26bf67[_0xf035('0x16')]){_0x38a62b='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x26bf67);}}else{_0x38a62b='unmanaged';}switch(_0xa39734[_0xf035('0x11')][_0xf035('0x10')]()){case _0xf035('0x7'):zendesk[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case'salesforce':salesforce[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case _0xf035('0x8'):sugarcrm[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case'freshdesk':freshdesk[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case _0xf035('0xa'):zoho[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case _0xf035('0xb'):desk[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case _0xf035('0x17'):vtiger[_0x38a62b](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c);break;case _0xf035('0xd'):freshsales['cs'](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c,_0x38a62b);break;case _0xf035('0xe'):servicenow['cs'](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c,_0x38a62b);break;case _0xf035('0xc'):dynamics365['cs'](_0xa39734,_0x26bf67,_0x587914,_0x221354,_0x4788a4,_0x4d5c8a,_0xcbb74c,_0x38a62b);break;default:console['log'](_0xf035('0x18'));}}else{_0x2d435a=require(_0xf035('0x19'))(_0xa39734['data1'][_0xf035('0x10')]());_0x2d435a['error'](_0xf035('0x1a'),util[_0xf035('0x1b')](_0xf035('0x1c'),_0xa39734[_0xf035('0x11')][_0xf035('0x10')](),_0xa39734[_0xf035('0x14')]));}}else{_0x2d435a=require('../../../../config/logger')(_0xa39734['data1'][_0xf035('0x10')]());_0x2d435a['error']('[EXEC]',util[_0xf035('0x1b')](_0xf035('0x1d'),_0xa39734[_0xf035('0x11')]['toLowerCase'](),_0xa39734[_0xf035('0x12')]));}}else{}}catch(_0x2b364f){console[_0xf035('0x1e')](_0x2b364f);}}}}; \ 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 a1a29f6..1197698 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 _0x7c1f=['contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variableName','toString','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lastevent','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType'];(function(_0x4b1aba,_0x1955ff){var _0x187e18=function(_0x96ede){while(--_0x96ede){_0x4b1aba['push'](_0x4b1aba['shift']());}};_0x187e18(++_0x1955ff);}(_0x7c1f,0xee));var _0xf7c1=function(_0x279b3f,_0x52be83){_0x279b3f=_0x279b3f-0x0;var _0x155a46=_0x7c1f[_0x279b3f];return _0x155a46;};'use strict';var _=require('lodash');var rp=require(_0xf7c1('0x0'));var moment=require(_0xf7c1('0x1'));var BPromise=require('bluebird');var md5=require(_0xf7c1('0x2'));var jsforce=require(_0xf7c1('0x3'));var util=require('util');var Redis=require(_0xf7c1('0x4'));var intUtil=require(_0xf7c1('0x5'));var config=require(_0xf7c1('0x6'));var logger=require(_0xf7c1('0x7'))(_0xf7c1('0x8'));config[_0xf7c1('0x9')]=_['defaults'](config[_0xf7c1('0x9')],{'host':_0xf7c1('0xa'),'port':0x18eb});var io=require(_0xf7c1('0xb'))(new Redis(config['redis']));function emit(_0x2be6f9,_0x303965,_0x2450f3){io['to'](_0x2be6f9)['emit'](_0x303965,_0x2450f3);}function getTicket(_0x3631bd,_0x5343e2,_0x57018a,_0x1c249f,_0x520f79,_0x5674e0,_0x32bc26,_0xf8a7be){var _0x55bde1=Object[_0xf7c1('0xc')]({},{'OwnerId':_0x5343e2['id'],'Subject':intUtil[_0xf7c1('0xd')](_0x1c249f[_0xf7c1('0xe')],_0x520f79,'\x20'),'Description':intUtil[_0xf7c1('0xd')](_0x1c249f[_0xf7c1('0xf')],_0x520f79,'\x0a')},getCustomFields(_0x5674e0,_0x520f79));if(_0x57018a){if(_0x1c249f[_0xf7c1('0x10')]===_0xf7c1('0x11')){_0x55bde1[_0xf7c1('0x12')]=moment[_0xf7c1('0x13')]();_0x55bde1[_0xf7c1('0x14')]=![];_0x55bde1['IsRecurrence']=![];if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x16')||_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x17')){_0x55bde1[_0xf7c1('0x18')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x19')){_0x55bde1[_0xf7c1('0x1a')]=_0x57018a['id'];}}else if(_0x1c249f[_0xf7c1('0x10')]===_0xf7c1('0x1b')){if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x16')){_0x55bde1[_0xf7c1('0x1c')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x19')){_0x55bde1[_0xf7c1('0x1d')]=_0x57018a['id'];}else if(_0x57018a[_0xf7c1('0x15')]===_0xf7c1('0x17')&&_0x1c249f[_0xf7c1('0x1e')]){_0x55bde1[_0x1c249f['leadId']]=_0x57018a['id'];}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x20'));}}}return _0x32bc26[_0xf7c1('0x21')](_0x1c249f['ticketType'])[_0xf7c1('0x22')](_0x55bde1);}function getUser(_0xd569a3,_0x4e21e1,_0xf62548){if(!_[_0xf7c1('0x23')](_0x4e21e1)&&intUtil['validateEmail'](_0x4e21e1)){var _0x26c2ff={'Email':_0x4e21e1};var _0x142dc0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xf62548[_0xf7c1('0x21')](_0xf7c1('0x24'))[_0xf7c1('0x25')](_0x26c2ff,_0x142dc0)[_0xf7c1('0x26')]()[_0xf7c1('0x27')](function(_0x2440ac){if(_0x2440ac[_0xf7c1('0x28')]){var _0xa2585c=_[_0xf7c1('0x25')](_0x2440ac,function(_0x45eafc){return _0x45eafc['Email']===_0x4e21e1;});if(_0xa2585c){logger['info'](_0xf7c1('0x29'),_0x4e21e1);return BPromise['resolve']({'id':_0xa2585c['Id'],'name':_0xa2585c['Name']});}}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x2a'),_0x4e21e1);return _0xf62548[_0xf7c1('0x2b')]()[_0xf7c1('0x27')](function(_0x43ce76){return BPromise['resolve']({'id':_0x43ce76[_0xf7c1('0x2c')],'name':_0x43ce76['display_name']});});}});}else{logger[_0xf7c1('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4e21e1);return _0xf62548[_0xf7c1('0x2b')]()['then'](function(_0x22aff9){return BPromise['resolve']({'id':_0x22aff9[_0xf7c1('0x2c')],'name':_0x22aff9[_0xf7c1('0x2d')]});});}}function getEndUser(_0x12e52c,_0x272fa2,_0x20a3be,_0x561047,_0x18b10e){var _0x2ceffb={'$or':{'Phone':_0x561047}};var _0x106c2e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf7c1('0x2e')]()[_0xf7c1('0x27')](function(){logger[_0xf7c1('0x1f')](_0xf7c1('0x2f'),_0x561047,_0x272fa2['moduleSearch']);switch(_0x272fa2['moduleSearch']){case _0xf7c1('0x30'):var _0x214d46=_['cloneDeep'](_0x2ceffb);if(_0x272fa2['additionalSearchContact']){var _0x3d07a1={};_0x3d07a1[_0x272fa2[_0xf7c1('0x31')]]=_0x561047;_['merge'](_0x214d46[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x33'))['find'](_0x214d46,_0x106c2e)[_0xf7c1('0x26')]()['then'](function(_0x31eefd){if(_0x31eefd&&_0x31eefd[_0xf7c1('0x28')]){return _0x31eefd;}else{var _0x2bdeda=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x202899={};_0x202899[_0x272fa2[_0xf7c1('0x35')]]=_0x561047;_[_0xf7c1('0x36')](_0x2bdeda[_0xf7c1('0x32')],_0x202899);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x37'))[_0xf7c1('0x25')](_0x2bdeda,_0x106c2e);}});case _0xf7c1('0x38'):var _0x3164ff=_['cloneDeep'](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x39')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2[_0xf7c1('0x39')]]=_0x561047;_[_0xf7c1('0x36')](_0x3164ff['$or'],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x3a'))[_0xf7c1('0x25')](_0x3164ff,_0x106c2e)[_0xf7c1('0x26')]()[_0xf7c1('0x27')](function(_0x3b3078){if(_0x3b3078&&_0x3b3078[_0xf7c1('0x28')]){return _0x3b3078;}else{var _0x3ebab8=_['cloneDeep'](_0x2ceffb);if(_0x272fa2['additionalSearchContact']){var _0x3ac873={};_0x3ac873[_0x272fa2['additionalSearchContact']]=_0x561047;_[_0xf7c1('0x36')](_0x3ebab8[_0xf7c1('0x32')],_0x3ac873);}return _0x18b10e[_0xf7c1('0x21')]('Contact')[_0xf7c1('0x25')](_0x3ebab8,_0x106c2e)[_0xf7c1('0x27')](function(_0x391ccc){if(_0x391ccc&&_0x391ccc[_0xf7c1('0x28')]){return _0x391ccc;}else{var _0xe2cfe6=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x5284c2={};_0x5284c2[_0x272fa2[_0xf7c1('0x35')]]=_0x561047;_[_0xf7c1('0x36')](_0xe2cfe6[_0xf7c1('0x32')],_0x5284c2);}return _0x18b10e[_0xf7c1('0x21')]('Lead')[_0xf7c1('0x25')](_0xe2cfe6,_0x106c2e);}});}});case _0xf7c1('0x16'):var _0x214d46=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x31')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchContact']]=_0x561047;_[_0xf7c1('0x36')](_0x214d46[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x33'))['find'](_0x214d46,_0x106c2e)[_0xf7c1('0x26')]();case _0xf7c1('0x17'):var _0x2aa3d4=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x35')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchLead']]=_0x561047;_[_0xf7c1('0x36')](_0x2aa3d4[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e['sobject']('Lead')[_0xf7c1('0x25')](_0x2aa3d4,_0x106c2e);case _0xf7c1('0x19'):var _0x3164ff=_[_0xf7c1('0x34')](_0x2ceffb);if(_0x272fa2[_0xf7c1('0x39')]){var _0x3d07a1={};_0x3d07a1[_0x272fa2['additionalSearchAccount']]=_0x561047;_[_0xf7c1('0x36')](_0x3164ff[_0xf7c1('0x32')],_0x3d07a1);}return _0x18b10e[_0xf7c1('0x21')](_0xf7c1('0x3a'))['find'](_0x3164ff,_0x106c2e);default:return null;}})['then'](function(_0x1778fe){if(_0x1778fe&&_0x1778fe[_0xf7c1('0x28')]){var _0x2cd589=_[_0xf7c1('0x3b')](_0x1778fe);if(_0x2cd589){return BPromise[_0xf7c1('0x2e')]({'id':_0x2cd589['Id'],'name':_0x2cd589[_0xf7c1('0x3c')],'phone':_0x2cd589[_0xf7c1('0x3d')],'endUserType':_0x2cd589[_0xf7c1('0x3e')][_0xf7c1('0x3f')][_0xf7c1('0x40')]()});}}})[_0xf7c1('0x27')](function(_0x3db06b){if(_0x3db06b){logger[_0xf7c1('0x1f')](_0xf7c1('0x41'),_0x3db06b['endUserType'],_0x561047);return BPromise['resolve'](_0x3db06b);}else{logger[_0xf7c1('0x1f')](_0xf7c1('0x42'),_0x561047);var _0x5be8f6={'Phone':_0x561047};if(_0x272fa2['moduleCreate']){if(_0x272fa2['moduleCreate']===_0xf7c1('0x16')){logger[_0xf7c1('0x1f')](_0xf7c1('0x43'),_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6['LastName']=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);}else if(_0x272fa2[_0xf7c1('0x44')]===_0xf7c1('0x17')){logger[_0xf7c1('0x1f')](_0xf7c1('0x43'),_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6[_0xf7c1('0x48')]=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);_0x5be8f6[_0xf7c1('0x49')]=_0xf7c1('0x4a');}else if(_0x272fa2[_0xf7c1('0x44')]===_0xf7c1('0x19')){logger[_0xf7c1('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x561047,_0x272fa2[_0xf7c1('0x44')]);_0x5be8f6['Name']=_0x20a3be!==_0xf7c1('0x45')?_0x20a3be:util[_0xf7c1('0x46')](_0xf7c1('0x47'),_0x561047);}else{return null;}}return _0x18b10e[_0xf7c1('0x21')](_[_0xf7c1('0x4b')](_0x272fa2['moduleCreate']))[_0xf7c1('0x22')](_0x5be8f6)[_0xf7c1('0x27')](function(_0x5599c1){return BPromise['resolve']({'id':_0x5599c1['id'],'endUserType':_0x272fa2[_0xf7c1('0x44')]});});}});}function getCustomFields(_0xef731e,_0x8201b5){var _0x1e11b8={};if(_0xef731e[_0xf7c1('0x28')]>0x0){_[_0xf7c1('0x4c')](_0xef731e,function(_0x5378ed){if(_[_0xf7c1('0x4d')]([_0xf7c1('0x4e'),_0xf7c1('0x4f')],_0x5378ed[_0xf7c1('0x3f')])&&_0x5378ed[_0xf7c1('0x50')]){_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x5378ed[_0xf7c1('0x51')]['toString']();}else if(_0x5378ed[_0xf7c1('0x3f')]==='variable'&&_0x5378ed['variableName']&&_0x5378ed[_0xf7c1('0x50')]){_0x8201b5[_0x5378ed[_0xf7c1('0x52')]]&&(_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x8201b5[_0x5378ed[_0xf7c1('0x52')]][_0xf7c1('0x53')]());}else if(_0x5378ed[_0xf7c1('0x3f')]===_0xf7c1('0x54')&&_0x5378ed[_0xf7c1('0x55')]&&_0x5378ed[_0xf7c1('0x55')][_0xf7c1('0x56')]&&_0x5378ed[_0xf7c1('0x50')]){_0x8201b5[_0x5378ed[_0xf7c1('0x55')][_0xf7c1('0x56')][_0xf7c1('0x40')]()]&&(_0x1e11b8[_0x5378ed[_0xf7c1('0x50')]]=_0x8201b5[_0x5378ed['Variable'][_0xf7c1('0x56')]['toLowerCase']()][_0xf7c1('0x53')]());}});}return _0x1e11b8;}function getConnection(_0x40db31){var _0x3b292f=_0x40db31[_0xf7c1('0x57')][_0xf7c1('0x58')](_0x40db31['securityToken']);var _0x821c83=new jsforce[(_0xf7c1('0x59'))]({'oauth2':{'loginUrl':_0x40db31[_0xf7c1('0x5a')]||_0xf7c1('0x5b'),'clientId':_0x40db31[_0xf7c1('0x5c')],'clientSecret':_0x40db31[_0xf7c1('0x5d')]}});return _0x821c83[_0xf7c1('0x5e')](_0x40db31[_0xf7c1('0x5f')],_0x3b292f)[_0xf7c1('0x27')](function(){logger['info'](_0xf7c1('0x60'));return _0x821c83;});}exports['queue']=function(_0x12537d,_0x5b2866,_0x4bc08f,_0x57d086,_0x3e4bac,_0x5bc64b){var _0x100bd2,_0x24ec80,_0x1afa2e,_0x41cddf;_0x5bc64b[_0xf7c1('0x61')]=intUtil[_0xf7c1('0x62')](_0x5bc64b['serverUrl']);_0x5bc64b[_0xf7c1('0x5a')]=intUtil[_0xf7c1('0x62')](_0x5bc64b[_0xf7c1('0x5a')]);if(_0x3e4bac&&_0x3e4bac[_0xf7c1('0x63')]){logger[_0xf7c1('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5b2866[_0xf7c1('0x64')]=util[_0xf7c1('0x46')](_0xf7c1('0x65'),_0x5bc64b[_0xf7c1('0x61')],_0x5b2866[_0xf7c1('0x66')],md5(_0x5b2866['uniqueid']));}else{_0x5b2866[_0xf7c1('0x64')]='';}return getConnection(_0x5bc64b)['then'](function(_0xff04bc){_0x41cddf=_0xff04bc;return getUser(_0x5bc64b,_0x57d086[_0xf7c1('0x67')],_0x41cddf);})[_0xf7c1('0x27')](function(_0x4e3b1b){_0x100bd2=_0x4e3b1b;return getEndUser(_0x5bc64b,_0x4bc08f,_0x5b2866[_0xf7c1('0x68')],_0x5b2866[_0xf7c1('0x69')],_0x41cddf);})[_0xf7c1('0x27')](function(_0x2dc210){_0x24ec80=_0x2dc210;return getTicket(_0x5bc64b,_0x100bd2,_0x24ec80,_0x4bc08f,_0x5b2866,_0x4bc08f[_0xf7c1('0x6a')],_0x41cddf,_0xf7c1('0x6b'));})[_0xf7c1('0x27')](function(_0x11fd4b){_0x1afa2e=_0x11fd4b;logger[_0xf7c1('0x1f')](_0xf7c1('0x6c'),_0x1afa2e['id']);logger[_0xf7c1('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1afa2e['id'],_0x57d086[_0xf7c1('0x56')],_0x5bc64b[_0xf7c1('0x3f')]);switch(_0x5bc64b['type']){case _0xf7c1('0x6d'):emit(util[_0xf7c1('0x46')]('user:%s',_0x57d086[_0xf7c1('0x56')]),_0xf7c1('0x6e'),{'recordId':_0x1afa2e['id']});break;case _0xf7c1('0x6f'):emit(util[_0xf7c1('0x46')](_0xf7c1('0x70'),_0x57d086[_0xf7c1('0x56')]),'trigger:browser:url',{'uri':util[_0xf7c1('0x46')]('%s/%s/e',_0x41cddf['instanceUrl'],_0x1afa2e['id'])});break;default:logger[_0xf7c1('0x71')](_0xf7c1('0x72'));}})[_0xf7c1('0x73')](function(_0x2574d1){logger['error'](_0xf7c1('0x74'),_0x2574d1);});};exports[_0xf7c1('0x75')]=function(_0x4f8f2a,_0x4ff234,_0x3aa1c2,_0x3f456f,_0x223298,_0x55d475,_0x41b3c9){var _0x31d6c5,_0x1e2e93,_0x2c07ab,_0x10ad74;_0x55d475['serverUrl']=intUtil[_0xf7c1('0x62')](_0x55d475[_0xf7c1('0x61')]);_0x55d475[_0xf7c1('0x5a')]=intUtil['stripTrailingSlash'](_0x55d475['remoteUri']);if(_0x41b3c9&&_0x41b3c9[_0xf7c1('0x76')]&&_0x41b3c9[_0xf7c1('0x76')]!=='none'){logger[_0xf7c1('0x1f')]('[OUTBOUND]',_0xf7c1('0x77'));_0x4ff234['recordingURL']=util['format'](_0xf7c1('0x65'),_0x55d475[_0xf7c1('0x61')],_0x4ff234[_0xf7c1('0x66')],md5(_0x4ff234[_0xf7c1('0x66')]));}return getConnection(_0x55d475)[_0xf7c1('0x27')](function(_0x2eccc3){_0x10ad74=_0x2eccc3;return getUser(_0x55d475,_0x3f456f['email'],_0x10ad74);})[_0xf7c1('0x27')](function(_0x9b748a){_0x31d6c5=_0x9b748a;return getEndUser(_0x55d475,_0x3aa1c2,_0x4ff234[_0xf7c1('0x78')],_0x4ff234['destcalleridnum'],_0x10ad74);})[_0xf7c1('0x27')](function(_0x5e981b){_0x1e2e93=_0x5e981b;return getTicket(_0x55d475,_0x31d6c5,_0x1e2e93,_0x3aa1c2,_0x4ff234,_0x3aa1c2[_0xf7c1('0x6a')],_0x10ad74,_0xf7c1('0x75'));})[_0xf7c1('0x27')](function(_0x593a0d){_0x2c07ab=_0x593a0d;logger[_0xf7c1('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c07ab['id']);logger['info'](_0xf7c1('0x79'),_0x2c07ab['id'],_0x3f456f[_0xf7c1('0x56')],_0x55d475[_0xf7c1('0x3f')]);switch(_0x55d475[_0xf7c1('0x3f')]){case _0xf7c1('0x6d'):emit(util[_0xf7c1('0x46')]('user:%s',_0x3f456f[_0xf7c1('0x56')]),_0xf7c1('0x6e'),{'recordId':_0x2c07ab['id']});break;case _0xf7c1('0x6f'):emit(util['format'](_0xf7c1('0x70'),_0x3f456f[_0xf7c1('0x56')]),'trigger:browser:url',{'uri':util[_0xf7c1('0x46')](_0xf7c1('0x7a'),_0x10ad74[_0xf7c1('0x7b')],_0x2c07ab['id'])});break;default:logger[_0xf7c1('0x71')](_0xf7c1('0x7c'),_0xf7c1('0x7d'));}})[_0xf7c1('0x73')](function(_0x1a0d71){logger[_0xf7c1('0x71')](_0xf7c1('0x7c'),_0x1a0d71);});};exports[_0xf7c1('0x7e')]=function(_0x80abfc,_0x478421,_0x4423d6,_0x1a87ef,_0x35f4dd,_0x22c388){var _0x3c6ade,_0x122836,_0x2a6d0f,_0x1c7773;_0x22c388['serverUrl']=intUtil[_0xf7c1('0x62')](_0x22c388[_0xf7c1('0x61')]);_0x22c388[_0xf7c1('0x5a')]=intUtil[_0xf7c1('0x62')](_0x22c388[_0xf7c1('0x5a')]);if(_0x35f4dd&&_0x35f4dd[_0xf7c1('0x63')]){logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent'][_0xf7c1('0x7f')]()+']',_0xf7c1('0x77'));_0x478421[_0xf7c1('0x64')]=util[_0xf7c1('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22c388['serverUrl'],_0x478421[_0xf7c1('0x66')],md5(_0x478421['uniqueid']));}else{_0x478421[_0xf7c1('0x64')]='';}return getConnection(_0x22c388)[_0xf7c1('0x27')](function(_0x12b2be){_0x1c7773=_0x12b2be;if(!_['isNil'](_0x1a87ef)){return getUser(_0x22c388,_0x1a87ef[_0xf7c1('0x56')],_0x1c7773);}else{return getUser(_0x22c388,null,_0x1c7773);}})['then'](function(_0x3c08b4){_0x3c6ade=_0x3c08b4;return getEndUser(_0x22c388,_0x4423d6,_0x478421['calleridname'],_0x478421[_0xf7c1('0x69')],_0x1c7773);})[_0xf7c1('0x27')](function(_0x5ecd07){_0x122836=_0x5ecd07;return getTicket(_0x22c388,_0x3c6ade,_0x122836,_0x4423d6,_0x478421,_0x4423d6[_0xf7c1('0x6a')],_0x1c7773);})['then'](function(_0x410c5f){_0x2a6d0f=_0x410c5f;logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent'][_0xf7c1('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x2a6d0f['id']);logger[_0xf7c1('0x1f')]('['+_0x478421['lastevent']['toUpperCase']()+_0xf7c1('0x80'),_0x22c388[_0xf7c1('0x3f')]);})[_0xf7c1('0x73')](function(_0x34d460){logger[_0xf7c1('0x71')]('['+_0x478421[_0xf7c1('0x81')]['toUpperCase']()+']',_0x34d460);});}; \ No newline at end of file +var _0x6fa8=['[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','ioredis','./util','../../../../config/environment','salesforce','redis','socket.io-emitter','getString','Descriptions','ticketType','Task','IsRecurrence','endUserType','lead','WhoId','account','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Company','Caller\x20-\x20%s','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum'];(function(_0x36c99d,_0x472d83){var _0x3d12ec=function(_0xe3f8e4){while(--_0xe3f8e4){_0x36c99d['push'](_0x36c99d['shift']());}};_0x3d12ec(++_0x472d83);}(_0x6fa8,0x18b));var _0x86fa=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x6fa8[_0x594ece];return _0x471bc4;};'use strict';var _=require(_0x86fa('0x0'));var rp=require('request-promise');var moment=require(_0x86fa('0x1'));var BPromise=require(_0x86fa('0x2'));var md5=require(_0x86fa('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x86fa('0x4'));var intUtil=require(_0x86fa('0x5'));var config=require(_0x86fa('0x6'));var logger=require('../../../../config/logger')(_0x86fa('0x7'));config[_0x86fa('0x8')]=_['defaults'](config[_0x86fa('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x86fa('0x9'))(new Redis(config['redis']));function emit(_0x20f6fc,_0x198ac2,_0x5ef425){io['to'](_0x20f6fc)['emit'](_0x198ac2,_0x5ef425);}function getTicket(_0x2a112c,_0x3791ec,_0xc5e9ce,_0x204aef,_0x1c2ed8,_0x4f6df6,_0xbbe8d7,_0x13c5b6){var _0x52df5c=Object['assign']({},{'OwnerId':_0x3791ec['id'],'Subject':intUtil[_0x86fa('0xa')](_0x204aef['Subjects'],_0x1c2ed8,'\x20'),'Description':intUtil[_0x86fa('0xa')](_0x204aef[_0x86fa('0xb')],_0x1c2ed8,'\x0a')},getCustomFields(_0x4f6df6,_0x1c2ed8));if(_0xc5e9ce){if(_0x204aef[_0x86fa('0xc')]===_0x86fa('0xd')){_0x52df5c['ActivityDate']=moment['utc']();_0x52df5c['IsReminderSet']=![];_0x52df5c[_0x86fa('0xe')]=![];if(_0xc5e9ce['endUserType']==='contact'||_0xc5e9ce[_0x86fa('0xf')]===_0x86fa('0x10')){_0x52df5c[_0x86fa('0x11')]=_0xc5e9ce['id'];}else if(_0xc5e9ce[_0x86fa('0xf')]===_0x86fa('0x12')){_0x52df5c['WhatId']=_0xc5e9ce['id'];}}else if(_0x204aef[_0x86fa('0xc')]===_0x86fa('0x13')){if(_0xc5e9ce['endUserType']===_0x86fa('0x14')){_0x52df5c['ContactId']=_0xc5e9ce['id'];}else if(_0xc5e9ce[_0x86fa('0xf')]===_0x86fa('0x12')){_0x52df5c[_0x86fa('0x15')]=_0xc5e9ce['id'];}else if(_0xc5e9ce[_0x86fa('0xf')]==='lead'&&_0x204aef[_0x86fa('0x16')]){_0x52df5c[_0x204aef['leadId']]=_0xc5e9ce['id'];}else{logger[_0x86fa('0x17')](_0x86fa('0x18'));}}}return _0xbbe8d7['sobject'](_0x204aef[_0x86fa('0xc')])[_0x86fa('0x19')](_0x52df5c);}function getUser(_0x19dc2e,_0x112308,_0x2d66ef){if(!_[_0x86fa('0x1a')](_0x112308)&&intUtil[_0x86fa('0x1b')](_0x112308)){var _0x2fcbfa={'Email':_0x112308};var _0x4b3888={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2d66ef[_0x86fa('0x1c')](_0x86fa('0x1d'))[_0x86fa('0x1e')](_0x2fcbfa,_0x4b3888)[_0x86fa('0x1f')]()[_0x86fa('0x20')](function(_0x5080ec){if(_0x5080ec[_0x86fa('0x21')]){var _0x3735d1=_[_0x86fa('0x1e')](_0x5080ec,function(_0xb87104){return _0xb87104[_0x86fa('0x22')]===_0x112308;});if(_0x3735d1){logger[_0x86fa('0x17')](_0x86fa('0x23'),_0x112308);return BPromise[_0x86fa('0x24')]({'id':_0x3735d1['Id'],'name':_0x3735d1[_0x86fa('0x25')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x112308);return _0x2d66ef[_0x86fa('0x26')]()[_0x86fa('0x20')](function(_0x4e2100){return BPromise[_0x86fa('0x24')]({'id':_0x4e2100[_0x86fa('0x27')],'name':_0x4e2100[_0x86fa('0x28')]});});}});}else{logger[_0x86fa('0x17')](_0x86fa('0x29'),_0x112308);return _0x2d66ef[_0x86fa('0x26')]()[_0x86fa('0x20')](function(_0x26f1cf){return BPromise[_0x86fa('0x24')]({'id':_0x26f1cf[_0x86fa('0x27')],'name':_0x26f1cf[_0x86fa('0x28')]});});}}function getEndUser(_0x461a98,_0x363abc,_0x1d9177,_0x175041,_0x2cde08){var _0x24156e={'$or':{'Phone':_0x175041}};var _0x4064f2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x86fa('0x24')]()[_0x86fa('0x20')](function(){logger[_0x86fa('0x17')](_0x86fa('0x2a'),_0x175041,_0x363abc[_0x86fa('0x2b')]);switch(_0x363abc[_0x86fa('0x2b')]){case _0x86fa('0x2c'):var _0x257216=_['cloneDeep'](_0x24156e);if(_0x363abc[_0x86fa('0x2d')]){var _0xa1cbc5={};_0xa1cbc5[_0x363abc[_0x86fa('0x2d')]]=_0x175041;_[_0x86fa('0x2e')](_0x257216[_0x86fa('0x2f')],_0xa1cbc5);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x30'))[_0x86fa('0x1e')](_0x257216,_0x4064f2)[_0x86fa('0x1f')]()[_0x86fa('0x20')](function(_0x30efee){if(_0x30efee&&_0x30efee[_0x86fa('0x21')]){return _0x30efee;}else{var _0x20c9ce=_[_0x86fa('0x31')](_0x24156e);if(_0x363abc[_0x86fa('0x32')]){var _0x1fc290={};_0x1fc290[_0x363abc[_0x86fa('0x32')]]=_0x175041;_[_0x86fa('0x2e')](_0x20c9ce['$or'],_0x1fc290);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x33'))[_0x86fa('0x1e')](_0x20c9ce,_0x4064f2);}});case _0x86fa('0x34'):var _0x233cdc=_['cloneDeep'](_0x24156e);if(_0x363abc[_0x86fa('0x35')]){var _0xa1cbc5={};_0xa1cbc5[_0x363abc[_0x86fa('0x35')]]=_0x175041;_[_0x86fa('0x2e')](_0x233cdc[_0x86fa('0x2f')],_0xa1cbc5);}return _0x2cde08['sobject']('Account')[_0x86fa('0x1e')](_0x233cdc,_0x4064f2)['execute']()[_0x86fa('0x20')](function(_0xb01d5b){if(_0xb01d5b&&_0xb01d5b[_0x86fa('0x21')]){return _0xb01d5b;}else{var _0x2009a5=_['cloneDeep'](_0x24156e);if(_0x363abc[_0x86fa('0x2d')]){var _0x461d6e={};_0x461d6e[_0x363abc[_0x86fa('0x2d')]]=_0x175041;_[_0x86fa('0x2e')](_0x2009a5[_0x86fa('0x2f')],_0x461d6e);}return _0x2cde08['sobject'](_0x86fa('0x30'))[_0x86fa('0x1e')](_0x2009a5,_0x4064f2)['then'](function(_0x3d5305){if(_0x3d5305&&_0x3d5305[_0x86fa('0x21')]){return _0x3d5305;}else{var _0x5743b4=_[_0x86fa('0x31')](_0x24156e);if(_0x363abc['additionalSearchLead']){var _0x3f27d8={};_0x3f27d8[_0x363abc[_0x86fa('0x32')]]=_0x175041;_[_0x86fa('0x2e')](_0x5743b4['$or'],_0x3f27d8);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x33'))['find'](_0x5743b4,_0x4064f2);}});}});case _0x86fa('0x14'):var _0x257216=_[_0x86fa('0x31')](_0x24156e);if(_0x363abc[_0x86fa('0x2d')]){var _0xa1cbc5={};_0xa1cbc5[_0x363abc[_0x86fa('0x2d')]]=_0x175041;_[_0x86fa('0x2e')](_0x257216[_0x86fa('0x2f')],_0xa1cbc5);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x30'))[_0x86fa('0x1e')](_0x257216,_0x4064f2)[_0x86fa('0x1f')]();case _0x86fa('0x10'):var _0x6f9e57=_['cloneDeep'](_0x24156e);if(_0x363abc[_0x86fa('0x32')]){var _0xa1cbc5={};_0xa1cbc5[_0x363abc['additionalSearchLead']]=_0x175041;_['merge'](_0x6f9e57[_0x86fa('0x2f')],_0xa1cbc5);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x33'))['find'](_0x6f9e57,_0x4064f2);case _0x86fa('0x12'):var _0x233cdc=_[_0x86fa('0x31')](_0x24156e);if(_0x363abc['additionalSearchAccount']){var _0xa1cbc5={};_0xa1cbc5[_0x363abc[_0x86fa('0x35')]]=_0x175041;_[_0x86fa('0x2e')](_0x233cdc[_0x86fa('0x2f')],_0xa1cbc5);}return _0x2cde08[_0x86fa('0x1c')](_0x86fa('0x36'))[_0x86fa('0x1e')](_0x233cdc,_0x4064f2);default:return null;}})[_0x86fa('0x20')](function(_0x4941f7){if(_0x4941f7&&_0x4941f7[_0x86fa('0x21')]){var _0xe6f867=_[_0x86fa('0x37')](_0x4941f7);if(_0xe6f867){return BPromise['resolve']({'id':_0xe6f867['Id'],'name':_0xe6f867[_0x86fa('0x25')],'phone':_0xe6f867[_0x86fa('0x38')],'endUserType':_0xe6f867[_0x86fa('0x39')][_0x86fa('0x3a')][_0x86fa('0x3b')]()});}}})[_0x86fa('0x20')](function(_0x2f4d53){if(_0x2f4d53){logger[_0x86fa('0x17')](_0x86fa('0x3c'),_0x2f4d53[_0x86fa('0xf')],_0x175041);return BPromise[_0x86fa('0x24')](_0x2f4d53);}else{logger[_0x86fa('0x17')](_0x86fa('0x3d'),_0x175041);var _0x4504cf={'Phone':_0x175041};if(_0x363abc['moduleCreate']){if(_0x363abc[_0x86fa('0x3e')]===_0x86fa('0x14')){logger[_0x86fa('0x17')](_0x86fa('0x3f'),_0x175041,_0x363abc[_0x86fa('0x3e')]);_0x4504cf[_0x86fa('0x40')]=_0x1d9177!==_0x86fa('0x41')?_0x1d9177:util[_0x86fa('0x42')]('Caller\x20-\x20%s',_0x175041);}else if(_0x363abc[_0x86fa('0x3e')]===_0x86fa('0x10')){logger[_0x86fa('0x17')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x175041,_0x363abc[_0x86fa('0x3e')]);_0x4504cf[_0x86fa('0x40')]=_0x1d9177!==_0x86fa('0x41')?_0x1d9177:util[_0x86fa('0x42')]('Caller\x20-\x20%s',_0x175041);_0x4504cf[_0x86fa('0x43')]='No\x20Company';}else if(_0x363abc[_0x86fa('0x3e')]===_0x86fa('0x12')){logger['info'](_0x86fa('0x3f'),_0x175041,_0x363abc[_0x86fa('0x3e')]);_0x4504cf[_0x86fa('0x25')]=_0x1d9177!==_0x86fa('0x41')?_0x1d9177:util[_0x86fa('0x42')](_0x86fa('0x44'),_0x175041);}else{return null;}}return _0x2cde08[_0x86fa('0x1c')](_['upperFirst'](_0x363abc[_0x86fa('0x3e')]))[_0x86fa('0x19')](_0x4504cf)[_0x86fa('0x20')](function(_0x3a982f){return BPromise['resolve']({'id':_0x3a982f['id'],'endUserType':_0x363abc[_0x86fa('0x3e')]});});}});}function getCustomFields(_0x25ebc8,_0x428d16){var _0x359e22={};if(_0x25ebc8[_0x86fa('0x21')]>0x0){_['forEach'](_0x25ebc8,function(_0x1e58d0){if(_[_0x86fa('0x45')]([_0x86fa('0x46'),_0x86fa('0x47')],_0x1e58d0[_0x86fa('0x3a')])&&_0x1e58d0[_0x86fa('0x48')]){_0x359e22[_0x1e58d0[_0x86fa('0x48')]]=_0x1e58d0[_0x86fa('0x49')][_0x86fa('0x4a')]();}else if(_0x1e58d0[_0x86fa('0x3a')]===_0x86fa('0x4b')&&_0x1e58d0[_0x86fa('0x4c')]&&_0x1e58d0[_0x86fa('0x48')]){_0x428d16[_0x1e58d0['variableName']]&&(_0x359e22[_0x1e58d0[_0x86fa('0x48')]]=_0x428d16[_0x1e58d0[_0x86fa('0x4c')]][_0x86fa('0x4a')]());}else if(_0x1e58d0[_0x86fa('0x3a')]===_0x86fa('0x4d')&&_0x1e58d0[_0x86fa('0x4e')]&&_0x1e58d0[_0x86fa('0x4e')][_0x86fa('0x4f')]&&_0x1e58d0['idField']){_0x428d16[_0x1e58d0[_0x86fa('0x4e')][_0x86fa('0x4f')][_0x86fa('0x3b')]()]&&(_0x359e22[_0x1e58d0[_0x86fa('0x48')]]=_0x428d16[_0x1e58d0[_0x86fa('0x4e')][_0x86fa('0x4f')][_0x86fa('0x3b')]()]['toString']());}});}return _0x359e22;}function getConnection(_0x264f70){var _0x31ce75=_0x264f70['password'][_0x86fa('0x50')](_0x264f70[_0x86fa('0x51')]);var _0x33df03=new jsforce['Connection']({'oauth2':{'loginUrl':_0x264f70[_0x86fa('0x52')]||_0x86fa('0x53'),'clientId':_0x264f70['clientId'],'clientSecret':_0x264f70['clientSecret']}});return _0x33df03[_0x86fa('0x54')](_0x264f70[_0x86fa('0x55')],_0x31ce75)['then'](function(){logger[_0x86fa('0x17')](_0x86fa('0x56'));return _0x33df03;});}exports[_0x86fa('0x57')]=function(_0x498c82,_0x39a6a2,_0x49e1ff,_0x653026,_0x237fbb,_0x3853ea){var _0x51d0d0,_0x51c913,_0x186e91,_0x432d65;_0x3853ea[_0x86fa('0x58')]=intUtil['stripTrailingSlash'](_0x3853ea[_0x86fa('0x58')]);_0x3853ea[_0x86fa('0x52')]=intUtil[_0x86fa('0x59')](_0x3853ea['remoteUri']);if(_0x237fbb&&_0x237fbb[_0x86fa('0x5a')]){logger['info']('[QUEUE]',_0x86fa('0x5b'));_0x39a6a2[_0x86fa('0x5c')]=util[_0x86fa('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3853ea[_0x86fa('0x58')],_0x39a6a2[_0x86fa('0x5d')],md5(_0x39a6a2[_0x86fa('0x5d')]));}else{_0x39a6a2[_0x86fa('0x5c')]='';}return getConnection(_0x3853ea)['then'](function(_0x362162){_0x432d65=_0x362162;return getUser(_0x3853ea,_0x653026[_0x86fa('0x5e')],_0x432d65);})[_0x86fa('0x20')](function(_0x142901){_0x51d0d0=_0x142901;return getEndUser(_0x3853ea,_0x49e1ff,_0x39a6a2[_0x86fa('0x5f')],_0x39a6a2[_0x86fa('0x60')],_0x432d65);})['then'](function(_0x44f7eb){_0x51c913=_0x44f7eb;return getTicket(_0x3853ea,_0x51d0d0,_0x51c913,_0x49e1ff,_0x39a6a2,_0x49e1ff['Fields'],_0x432d65,_0x86fa('0x57'));})[_0x86fa('0x20')](function(_0x45f0e2){_0x186e91=_0x45f0e2;logger[_0x86fa('0x17')](_0x86fa('0x61'),_0x186e91['id']);logger[_0x86fa('0x17')](_0x86fa('0x62'),_0x186e91['id'],_0x653026['name'],_0x3853ea[_0x86fa('0x3a')]);switch(_0x3853ea[_0x86fa('0x3a')]){case'integrationTab':emit(util[_0x86fa('0x42')](_0x86fa('0x63'),_0x653026[_0x86fa('0x4f')]),_0x86fa('0x64'),{'recordId':_0x186e91['id']});break;case _0x86fa('0x65'):emit(util[_0x86fa('0x42')](_0x86fa('0x63'),_0x653026[_0x86fa('0x4f')]),'trigger:browser:url',{'uri':util['format'](_0x86fa('0x66'),_0x432d65[_0x86fa('0x67')],_0x186e91['id'])});break;default:logger[_0x86fa('0x68')](_0x86fa('0x69'));}})[_0x86fa('0x6a')](function(_0x20d491){logger[_0x86fa('0x68')](_0x86fa('0x6b'),_0x20d491);});};exports[_0x86fa('0x6c')]=function(_0x35a09b,_0xbbbfc2,_0x20bb95,_0x2d5554,_0xaed03b,_0x37c5b3,_0x6ae690){var _0x56cd4d,_0x34df47,_0x360f90,_0x26ef8f;_0x37c5b3[_0x86fa('0x58')]=intUtil['stripTrailingSlash'](_0x37c5b3[_0x86fa('0x58')]);_0x37c5b3[_0x86fa('0x52')]=intUtil[_0x86fa('0x59')](_0x37c5b3['remoteUri']);if(_0x6ae690&&_0x6ae690['recordingFormat']&&_0x6ae690[_0x86fa('0x6d')]!==_0x86fa('0x6e')){logger[_0x86fa('0x17')]('[OUTBOUND]',_0x86fa('0x5b'));_0xbbbfc2[_0x86fa('0x5c')]=util[_0x86fa('0x42')](_0x86fa('0x6f'),_0x37c5b3[_0x86fa('0x58')],_0xbbbfc2[_0x86fa('0x5d')],md5(_0xbbbfc2['uniqueid']));}return getConnection(_0x37c5b3)[_0x86fa('0x20')](function(_0x1c206c){_0x26ef8f=_0x1c206c;return getUser(_0x37c5b3,_0x2d5554['email'],_0x26ef8f);})[_0x86fa('0x20')](function(_0x2cba48){_0x56cd4d=_0x2cba48;return getEndUser(_0x37c5b3,_0x20bb95,_0xbbbfc2['destcalleridname'],_0xbbbfc2['destcalleridnum'],_0x26ef8f);})['then'](function(_0x3b1877){_0x34df47=_0x3b1877;return getTicket(_0x37c5b3,_0x56cd4d,_0x34df47,_0x20bb95,_0xbbbfc2,_0x20bb95[_0x86fa('0x70')],_0x26ef8f,_0x86fa('0x6c'));})[_0x86fa('0x20')](function(_0x46014c){_0x360f90=_0x46014c;logger[_0x86fa('0x17')](_0x86fa('0x71'),_0x360f90['id']);logger[_0x86fa('0x17')](_0x86fa('0x72'),_0x360f90['id'],_0x2d5554[_0x86fa('0x4f')],_0x37c5b3[_0x86fa('0x3a')]);switch(_0x37c5b3[_0x86fa('0x3a')]){case _0x86fa('0x73'):emit(util[_0x86fa('0x42')]('user:%s',_0x2d5554[_0x86fa('0x4f')]),_0x86fa('0x64'),{'recordId':_0x360f90['id']});break;case _0x86fa('0x65'):emit(util[_0x86fa('0x42')](_0x86fa('0x63'),_0x2d5554[_0x86fa('0x4f')]),'trigger:browser:url',{'uri':util['format'](_0x86fa('0x66'),_0x26ef8f[_0x86fa('0x67')],_0x360f90['id'])});break;default:logger['error']('[OUTBOUND]',_0x86fa('0x74'));}})[_0x86fa('0x6a')](function(_0x50feb3){logger[_0x86fa('0x68')](_0x86fa('0x75'),_0x50feb3);});};exports[_0x86fa('0x76')]=function(_0x4c4284,_0x263bcb,_0x21f19b,_0xc792a9,_0x524dce,_0x430ef7){var _0x3d229c,_0x283b97,_0x10a9f7,_0x4af433;_0x430ef7[_0x86fa('0x58')]=intUtil['stripTrailingSlash'](_0x430ef7[_0x86fa('0x58')]);_0x430ef7[_0x86fa('0x52')]=intUtil[_0x86fa('0x59')](_0x430ef7['remoteUri']);if(_0x524dce&&_0x524dce[_0x86fa('0x5a')]){logger[_0x86fa('0x17')]('['+_0x263bcb[_0x86fa('0x77')][_0x86fa('0x78')]()+']',_0x86fa('0x5b'));_0x263bcb[_0x86fa('0x5c')]=util[_0x86fa('0x42')](_0x86fa('0x6f'),_0x430ef7['serverUrl'],_0x263bcb[_0x86fa('0x5d')],md5(_0x263bcb['uniqueid']));}else{_0x263bcb[_0x86fa('0x5c')]='';}return getConnection(_0x430ef7)[_0x86fa('0x20')](function(_0x101c0d){_0x4af433=_0x101c0d;if(!_[_0x86fa('0x1a')](_0xc792a9)){return getUser(_0x430ef7,_0xc792a9[_0x86fa('0x4f')],_0x4af433);}else{return getUser(_0x430ef7,null,_0x4af433);}})[_0x86fa('0x20')](function(_0x2a56f8){_0x3d229c=_0x2a56f8;return getEndUser(_0x430ef7,_0x21f19b,_0x263bcb[_0x86fa('0x5f')],_0x263bcb[_0x86fa('0x60')],_0x4af433);})[_0x86fa('0x20')](function(_0x205da){_0x283b97=_0x205da;return getTicket(_0x430ef7,_0x3d229c,_0x283b97,_0x21f19b,_0x263bcb,_0x21f19b['Fields'],_0x4af433);})[_0x86fa('0x20')](function(_0x3aa53c){_0x10a9f7=_0x3aa53c;logger[_0x86fa('0x17')]('['+_0x263bcb['lastevent'][_0x86fa('0x78')]()+_0x86fa('0x79'),_0x10a9f7['id']);logger[_0x86fa('0x17')]('['+_0x263bcb[_0x86fa('0x77')][_0x86fa('0x78')]()+_0x86fa('0x7a'),_0x430ef7[_0x86fa('0x3a')]);})[_0x86fa('0x6a')](function(_0x555cf2){logger[_0x86fa('0x68')]('['+_0x263bcb[_0x86fa('0x77')][_0x86fa('0x78')]()+']',_0x555cf2);});}; \ 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 70d007f..fe2c4a4 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 _0x120e=['[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','catch','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','Variable','name','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','incident','Incident','ticketNumber','push','all','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x120e,0x6a));var _0xe120=function(_0x138365,_0x54c366){_0x138365=_0x138365-0x0;var _0x5d07f3=_0x120e[_0x138365];return _0x5d07f3;};'use strict';var _=require(_0xe120('0x0'));var Promise=require(_0xe120('0x1'));var rp=require(_0xe120('0x2'));var util=require(_0xe120('0x3'));var md5=require(_0xe120('0x4'));var Redis=require(_0xe120('0x5'));var intUtil=require(_0xe120('0x6'));var config=require(_0xe120('0x7'));var logger=require(_0xe120('0x8'))(_0xe120('0x9'));config[_0xe120('0xa')]=_['defaults'](config[_0xe120('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe120('0xb'))(new Redis(config['redis']));function getAdminUser(_0x6a5da7,_0x2675c5,_0x407519,_0x32d32b,_0x150113,_0x3fe108){return new Promise(function(_0x139a7b,_0x272a7c){var _0x51e627={'method':_0xe120('0xc'),'uri':_0x32d32b+_0xe120('0xd')+'&'+_0x150113+'&'+_0x3fe108,'auth':_0x2675c5,'json':!![]};return rp(_0x51e627)[_0xe120('0xe')](function(_0x4002ec){if(_0x4002ec[_0xe120('0xf')][_0xe120('0x10')]>0x0){_0x407519[_0xe120('0x11')]=_0x4002ec[_0xe120('0xf')][0x0][_0xe120('0x12')];}logger[_0xe120('0x13')]('['+[_0x6a5da7[_0xe120('0x14')]()]+'],\x20getAdminUser\x20crm',_0x407519);_0x139a7b(_0x407519);})['catch'](function(_0x5205c5){logger[_0xe120('0x15')]('['+[_0x6a5da7[_0xe120('0x14')]()]+']',_0x5205c5['message']);_0x272a7c(_0x5205c5[_0xe120('0x16')]);});});}function getUser(_0x27f824,_0x3394f8,_0x203ee2,_0x13d6ea,_0x1eac81){return function(_0x3ce3c6){logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x3ce3c6);return new Promise(function(_0x531c50,_0x56cd11){if(intUtil['validateEmail'](_0x3ce3c6[_0xe120('0x17')])){var _0x384b55={'method':_0xe120('0xc'),'uri':_0x203ee2+_0xe120('0x18')+_0x3ce3c6[_0xe120('0x17')]+'&'+_0x13d6ea+'&'+_0x1eac81,'auth':_0x3394f8,'json':!![]};logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+_0xe120('0x19'),_0x384b55);return rp(_0x384b55)[_0xe120('0xe')](function(_0x398903){logger[_0xe120('0x13')]('['+[_0x27f824['toUpperCase']()]+_0xe120('0x1a'),_0x398903);if(_0x398903['result'][_0xe120('0x10')]>0x0&&String(_0x398903[_0xe120('0xf')][0x0][_0xe120('0x1b')])===_0xe120('0x1c')){_0x3ce3c6[_0xe120('0x1d')]=_0x398903[_0xe120('0xf')][0x0][_0xe120('0x12')];}else{_0x3ce3c6[_0xe120('0x1d')]=_0x3ce3c6[_0xe120('0x11')];_0x3ce3c6[_0xe120('0x17')]=_0x3ce3c6[_0xe120('0x1e')];}logger[_0xe120('0x13')]('['+[_0x27f824[_0xe120('0x14')]()]+'],\x20getUser\x20crm',_0x3ce3c6);_0x531c50(_0x3ce3c6);})['catch'](function(_0x85eff7){logger[_0xe120('0x15')]('['+[_0x27f824[_0xe120('0x14')]()]+']',_0x85eff7[_0xe120('0x16')]);_0x56cd11(_0x85eff7[_0xe120('0x16')]);});}else{logger[_0xe120('0x13')]('['+[_0x27f824['toUpperCase']()]+_0xe120('0x1f'));_0x3ce3c6['userId']=_0x3ce3c6['adminId'];_0x3ce3c6[_0xe120('0x17')]=_0x3ce3c6[_0xe120('0x1e')];_0x531c50(_0x3ce3c6);}});};}function createEndUser(_0x564a9e,_0xc55065,_0x1b9d23,_0x159e7c,_0x49f5a6){logger['info']('['+[_0x564a9e[_0xe120('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x1b9d23);return new Promise(function(_0x1375da,_0x394ce8){var _0x56b10c={'method':_0xe120('0x20'),'uri':_0x159e7c+_0xe120('0x21')+_0x49f5a6,'body':{'user_name':_0x1b9d23[_0xe120('0x22')],'roles':_0xe120('0x23'),'first_name':_0x1b9d23['endUserNumber'],'active':'true','date_format':_0xe120('0x24'),'phone':_0x1b9d23['endUserNumber']},'auth':_0xc55065,'json':!![]};return rp(_0x56b10c)[_0xe120('0xe')](function(_0x3f5c58){logger[_0xe120('0x13')]('['+[_0x564a9e[_0xe120('0x14')]()]+_0xe120('0x25'),_0x3f5c58[_0xe120('0xf')]);_0x1b9d23[_0xe120('0x26')]=_0x3f5c58[_0xe120('0xf')][_0xe120('0x12')];_0x1375da(_0x1b9d23);})[_0xe120('0x27')](function(_0x4617fe){logger['error']('['+[_0x564a9e['toUpperCase']()]+']',_0x4617fe[_0xe120('0x16')]);_0x394ce8(_0x4617fe['message']);});});}function getEndUser(_0x24efee,_0x2c8424,_0x118ddc,_0x505796,_0x419309){return function(_0x527bc8){logger['info']('['+[_0x24efee['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x527bc8);return new Promise(function(_0x8591f8,_0x40449f){var _0x24dd7b={'method':_0xe120('0xc'),'uri':_0x118ddc+_0xe120('0x28')+_0x527bc8['endUserNumber']+'&'+_0x505796+'&'+_0x419309,'auth':_0x2c8424,'json':!![]};return rp(_0x24dd7b)[_0xe120('0xe')](function(_0x53a6c2){if(_0x53a6c2[_0xe120('0xf')]['length']>0x0){_0x527bc8['endUserId']=_0x53a6c2['result'][0x0]['sys_id'];logger['info']('['+[_0x24efee[_0xe120('0x14')]()]+_0xe120('0x29'),_0x527bc8);_0x8591f8(_0x527bc8);}else{return createEndUser(_0x24efee,_0x2c8424,_0x527bc8,_0x118ddc,_0x505796)[_0xe120('0xe')](function(_0x3aab0e){logger[_0xe120('0x13')]('['+[_0x24efee[_0xe120('0x14')]()]+'],\x20createEndUser\x20crm',_0x3aab0e);_0x8591f8(_0x3aab0e);});}})['catch'](function(_0x6d88d7){logger[_0xe120('0x15')]('['+[_0x24efee[_0xe120('0x14')]()]+']',_0x6d88d7['message']);_0x40449f(_0x6d88d7['message']);});});};}function getCustomFields(_0x3ca659,_0x54f729){var _0x3ce70f={};if(_0x3ca659[_0xe120('0x10')]>0x0){_[_0xe120('0x2a')](_0x3ca659,function(_0x4fab32){if(_[_0xe120('0x2b')]([_0xe120('0x2c'),'picklist'],_0x4fab32[_0xe120('0x2d')])&&_0x4fab32[_0xe120('0x2e')]&&!_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x2e')][_0xe120('0x30')]()]=_0x4fab32[_0xe120('0x31')][_0xe120('0x32')]();}else if(_['includes']([_0xe120('0x2c'),_0xe120('0x33')],_0x4fab32['type'])&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x34')]['toLowerCase']()]=_0x4fab32['content'][_0xe120('0x32')]();}else if(_0x4fab32[_0xe120('0x2d')]==='variable'&&_0x4fab32['variableName']&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32['idField'][_0xe120('0x30')]()]=_0x54f729[_0x4fab32['variableName']][_0xe120('0x32')]();}else if(_0x4fab32[_0xe120('0x2d')]==='customVariable'&&_0x4fab32[_0xe120('0x35')]&&_0x4fab32[_0xe120('0x35')][_0xe120('0x36')]&&_0x4fab32[_0xe120('0x34')]&&_0x4fab32[_0xe120('0x2f')]){_0x3ce70f[_0x4fab32[_0xe120('0x34')]['toLowerCase']()]=_0x54f729[_0x4fab32[_0xe120('0x35')][_0xe120('0x36')]['toLowerCase']()]['toString']();}});}return _0x3ce70f;}function getTicket(_0x55e9ff,_0x30bc81,_0x4b6a3d,_0x18508b,_0x550491,_0x5e67cc){return function(_0x3c6326){logger[_0xe120('0x13')]('['+[_0x55e9ff[_0xe120('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x3c6326);return new Promise(function(_0x126248,_0x5bcfbd){var _0x178306=_0x55e9ff[_0xe120('0x30')]()===_0xe120('0x37')?_0x3c6326[_0xe120('0x1d')]:_0x3c6326[_0xe120('0x26')];var _0xecca83={'method':_0xe120('0x20'),'uri':_0x4b6a3d+'incident'+'?'+_0x5e67cc,'body':Object['assign']({},{'active':_0xe120('0x1c'),'caller_id':_0x178306,'assigned_to':_0x3c6326[_0xe120('0x1d')],'short_description':intUtil[_0xe120('0x38')](_0x18508b[_0xe120('0x39')],_0x550491,'\x20'),'description':intUtil[_0xe120('0x38')](_0x18508b[_0xe120('0x3a')],_0x550491,'\x0a')},getCustomFields(_0x18508b['Fields'],_0x550491)),'auth':_0x30bc81,'json':!![]};return rp(_0xecca83)[_0xe120('0xe')](function(_0x57fc29){logger['info']('['+[_0x55e9ff[_0xe120('0x14')]()]+_0xe120('0x3b'),_0x57fc29[_0xe120('0xf')]);_0x3c6326[_0xe120('0x3c')]=_0x57fc29[_0xe120('0xf')][_0xe120('0x12')];_0x3c6326['ticketNumber']=_0x57fc29[_0xe120('0xf')]['number'];logger['info']('['+[_0x55e9ff[_0xe120('0x14')]()]+_0xe120('0x3d'),_0x3c6326);_0x126248(_0x3c6326);})['catch'](function(_0x5dd665){logger[_0xe120('0x15')]('['+[_0x55e9ff['toUpperCase']()]+']',_0x5dd665[_0xe120('0x16')]);_0x5bcfbd(_0x5dd665[_0xe120('0x16')]);});});};}function createRemoteTag(_0x2b3cc4,_0x16510b,_0x304359,_0x1a645f){return new Promise(function(_0x1bd31b,_0x4d9c9a){var _0x58e6ae={'method':_0xe120('0x20'),'uri':_0x304359+'label'+'?'+_0x1a645f,'body':{'short_description':_0x2b3cc4,'global':!![],'active':!![],'name':_0x2b3cc4},'auth':_0x16510b,'json':!![]};return rp(_0x58e6ae)[_0xe120('0xe')](function(_0x596065){var _0x3c9df4=_0x596065['result'][_0xe120('0x12')];_0x1bd31b(_0x3c9df4);});});}function getRemoteTag(_0x450e33,_0x5deb79,_0x223f57,_0x5651a4,_0xbaaf14){return new Promise(function(_0x3dd067,_0x2ade0c){var _0x56e81={'method':_0xe120('0xc'),'uri':_0x223f57+_0xe120('0x3e')+'?sysparm_query=name%3D'+_0x450e33+'&'+_0x5651a4,'auth':_0x5deb79,'json':!![]};return rp(_0x56e81)[_0xe120('0xe')](function(_0x1be17b){if(_0x1be17b['result']['length']>0x0){var _0x123dac=_0x1be17b[_0xe120('0xf')][0x0][_0xe120('0x12')];_0x3dd067(_0x123dac);}else{return createRemoteTag(_0x450e33,_0x5deb79,_0x223f57,_0x5651a4)[_0xe120('0xe')](function(_0x1c3167){_0x3dd067(_0x1c3167);});}});});}function assignTagToIncident(_0x23b33a,_0x3f1731,_0x2ae061,_0x3ef56e,_0x4024ca){return new Promise(function(_0x373bc8,_0x8962b8){var _0x576c88={'method':_0xe120('0x20'),'uri':_0x2ae061+'label_entry'+'?'+_0x4024ca,'body':{'label':_0x23b33a,'table':_0xe120('0x3f'),'id_type':_0xe120('0x40'),'table_key':_0x3ef56e[_0xe120('0x3c')],'title':'Incident\x20-\x20'+_0x3ef56e['ticketNumber'],'id_display':_0x3ef56e[_0xe120('0x41')]},'auth':_0x3f1731,'json':!![]};return rp(_0x576c88)[_0xe120('0xe')](function(_0x4cd97e){_0x373bc8();})[_0xe120('0x27')](function(){_0x373bc8();});});}function manageTags(_0x2d4321,_0xfbe3f3,_0x5c90b0,_0x3aaff2,_0x4267f6,_0x3e979c,_0x83f591){return new Promise(function(_0x518885,_0x54ae3c){var _0x241b00=[];_0xfbe3f3['forEach'](function(_0xdd61ef){_0x241b00[_0xe120('0x42')](getRemoteTag(_0xdd61ef,_0x5c90b0,_0x3aaff2,_0x3e979c,_0x83f591));});return Promise['all'](_0x241b00)['then'](function(_0x1de5f6){if(_0x1de5f6[_0xe120('0x10')]){logger['info']('['+[_0x2d4321[_0xe120('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1de5f6);var _0x142bc6=[];_0x1de5f6[_0xe120('0x2a')](function(_0x5d79c3){_0x142bc6[_0xe120('0x42')](assignTagToIncident(_0x5d79c3,_0x5c90b0,_0x3aaff2,_0x4267f6,_0x3e979c));});return Promise[_0xe120('0x43')](_0x142bc6)[_0xe120('0xe')](function(){_0x518885();})[_0xe120('0x27')](function(){_0x518885();});}else{_0x518885();}});});}function getTags(_0x3a27b4,_0x4f6dfb,_0x37d501,_0x4212fa,_0x3e0799,_0x256c55){return function(_0x48eba0){return new Promise(function(_0xdc5ca5,_0x385452){var _0x547790=[];var _0xe5d3d6=_0x4212fa['Tags'];if(_0xe5d3d6&&_0xe5d3d6['length']>0x0){_0x547790=_[_0xe120('0x44')](_0xe5d3d6,_0xe120('0x36'));}if(_0x547790[_0xe120('0x10')]>0x0){return manageTags(_0x3a27b4,_0x547790,_0x4f6dfb,_0x37d501,_0x48eba0,_0x3e0799,_0x256c55)[_0xe120('0xe')](function(){_0xdc5ca5(_0x48eba0);});}else{_0xdc5ca5(_0x48eba0);}});};}function emit(_0x404784,_0x19a5b9,_0x19ff1c){var _0x24e953='%26sysparm_record_target%3Dincident'+_0xe120('0x45')+_0xe120('0x46')+_0xe120('0x47');var _0x55172e={'uri':_0x404784+_0xe120('0x48')+_0x19ff1c+_0x24e953};io['to'](util[_0xe120('0x49')]('user:%s',_0x19a5b9))[_0xe120('0x4a')]('trigger:browser:url',_0x55172e);}exports['cs']=function(_0x422822,_0x32cad1,_0x447fd,_0x5ad57d,_0x640d8a,_0x20532a,_0x4baddd,_0x2dfa49){var _0x3ab6df={};var _0x53b697={'user':_0x20532a[_0xe120('0x4b')],'pass':_0x20532a[_0xe120('0x4c')]};var _0x1a7c0f=_0xe120('0x4d');var _0xcc5f10=_0xe120('0x4e');_0x20532a[_0xe120('0x4f')]=intUtil[_0xe120('0x50')](_0x20532a[_0xe120('0x4f')]);_0x20532a[_0xe120('0x51')]=intUtil[_0xe120('0x50')](_0x20532a['serverUrl']);var _0x1e7696=util[_0xe120('0x49')]('%s/api/now/table/',_0x20532a[_0xe120('0x4f')]);_0x3ab6df['userEmail']=!_[_0xe120('0x52')](_0x5ad57d)?_0x5ad57d[_0xe120('0x53')]:null;_0x3ab6df[_0xe120('0x1e')]=_0x20532a[_0xe120('0x53')];_0x3ab6df[_0xe120('0x22')]=_0x2dfa49[_0xe120('0x30')]()===_0xe120('0x37')?_0x32cad1[_0xe120('0x54')]:_0x32cad1[_0xe120('0x55')];_0x3ab6df['callDirection']=_0x2dfa49===_0xe120('0x56')||_0x2dfa49===_0xe120('0x57')?_0xe120('0x56'):_0xe120('0x37');var _0x2513ad=util['format'](_0xe120('0x58'),_0x20532a[_0xe120('0x51')],_0x32cad1['uniqueid'],md5(_0x32cad1[_0xe120('0x59')]));if(_0x640d8a&&_0x640d8a[_0xe120('0x5a')]){logger[_0xe120('0x13')]('[QUEUE]',_0xe120('0x5b'));_0x32cad1[_0xe120('0x5c')]=_0x2513ad;}else if(_0x4baddd&&_0x4baddd[_0xe120('0x5d')]&&_0x4baddd[_0xe120('0x5d')]!=='none'){logger[_0xe120('0x13')](_0xe120('0x5e'),'Recording\x20is\x20enabled!');_0x32cad1['recordingURL']=_0x2513ad;}else{_0x32cad1['recordingURL']='';}return getAdminUser(_0x2dfa49,_0x53b697,_0x3ab6df,_0x1e7696,_0xcc5f10,_0x1a7c0f)[_0xe120('0xe')](getUser(_0x2dfa49,_0x53b697,_0x1e7696,_0xcc5f10,_0x1a7c0f))[_0xe120('0xe')](getEndUser(_0x2dfa49,_0x53b697,_0x1e7696,_0xcc5f10,_0x1a7c0f))[_0xe120('0xe')](getTicket(_0x2dfa49,_0x53b697,_0x1e7696,_0x447fd,_0x32cad1,_0xcc5f10))[_0xe120('0xe')](function(_0x52e2ba){logger[_0xe120('0x13')](util[_0xe120('0x49')](_0xe120('0x5f'),_0x52e2ba[_0xe120('0x3c')]));logger[_0xe120('0x13')](util[_0xe120('0x49')](_0xe120('0x60'),_0x2dfa49));if(_0x2dfa49!==_0xe120('0x57')){logger[_0xe120('0x13')]('['+[_0x2dfa49[_0xe120('0x14')]()]+']',_0xe120('0x61'));emit(_0x20532a[_0xe120('0x4f')],_0x5ad57d[_0xe120('0x36')],_0x52e2ba[_0xe120('0x3c')]);}})['catch'](function(_0x1a4aba){logger[_0xe120('0x15')]('['+[_0x2dfa49[_0xe120('0x14')]()]+_0xe120('0x62'),util[_0xe120('0x63')](_0x1a4aba,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8741=['ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','queue','%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','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema'];(function(_0x3bee8f,_0x5e3794){var _0x510f7d=function(_0x1451e8){while(--_0x1451e8){_0x3bee8f['push'](_0x3bee8f['shift']());}};_0x510f7d(++_0x5e3794);}(_0x8741,0xff));var _0x1874=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8741[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1874('0x0'));var Promise=require(_0x1874('0x1'));var rp=require(_0x1874('0x2'));var util=require(_0x1874('0x3'));var md5=require(_0x1874('0x4'));var Redis=require(_0x1874('0x5'));var intUtil=require(_0x1874('0x6'));var config=require(_0x1874('0x7'));var logger=require(_0x1874('0x8'))('servicenow');config['redis']=_['defaults'](config[_0x1874('0x9')],{'host':_0x1874('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1874('0x9')]));function getAdminUser(_0x297877,_0x3874f6,_0x4cd8f3,_0x373588,_0x5e843a,_0x4bbddf){return new Promise(function(_0x4f9b8d,_0x59998b){var _0x2b6c06={'method':'GET','uri':_0x373588+_0x1874('0xb')+'&'+_0x5e843a+'&'+_0x4bbddf,'auth':_0x3874f6,'json':!![]};return rp(_0x2b6c06)['then'](function(_0x26d80a){if(_0x26d80a['result'][_0x1874('0xc')]>0x0){_0x4cd8f3[_0x1874('0xd')]=_0x26d80a[_0x1874('0xe')][0x0][_0x1874('0xf')];}logger[_0x1874('0x10')]('['+[_0x297877[_0x1874('0x11')]()]+_0x1874('0x12'),_0x4cd8f3);_0x4f9b8d(_0x4cd8f3);})[_0x1874('0x13')](function(_0x5e094f){logger[_0x1874('0x14')]('['+[_0x297877[_0x1874('0x11')]()]+']',_0x5e094f[_0x1874('0x15')]);_0x59998b(_0x5e094f[_0x1874('0x15')]);});});}function getUser(_0x4da68c,_0x395cfc,_0x3cca31,_0x2c9dc0,_0x40dc6a){return function(_0x4150d3){logger[_0x1874('0x10')]('['+[_0x4da68c[_0x1874('0x11')]()]+_0x1874('0x16'),_0x4150d3);return new Promise(function(_0x31b777,_0x542937){if(intUtil['validateEmail'](_0x4150d3[_0x1874('0x17')])){var _0x58793b={'method':'GET','uri':_0x3cca31+'sys_user?sysparm_query=email%3D'+_0x4150d3[_0x1874('0x17')]+'&'+_0x2c9dc0+'&'+_0x40dc6a,'auth':_0x395cfc,'json':!![]};logger[_0x1874('0x10')]('['+[_0x4da68c[_0x1874('0x11')]()]+_0x1874('0x18'),_0x58793b);return rp(_0x58793b)[_0x1874('0x19')](function(_0x5c6d92){logger[_0x1874('0x10')]('['+[_0x4da68c['toUpperCase']()]+_0x1874('0x1a'),_0x5c6d92);if(_0x5c6d92['result'][_0x1874('0xc')]>0x0&&String(_0x5c6d92[_0x1874('0xe')][0x0][_0x1874('0x1b')])===_0x1874('0x1c')){_0x4150d3[_0x1874('0x1d')]=_0x5c6d92['result'][0x0]['sys_id'];}else{_0x4150d3[_0x1874('0x1d')]=_0x4150d3[_0x1874('0xd')];_0x4150d3['userEmail']=_0x4150d3['adminEmail'];}logger[_0x1874('0x10')]('['+[_0x4da68c[_0x1874('0x11')]()]+_0x1874('0x1e'),_0x4150d3);_0x31b777(_0x4150d3);})[_0x1874('0x13')](function(_0x5a426d){logger[_0x1874('0x14')]('['+[_0x4da68c[_0x1874('0x11')]()]+']',_0x5a426d[_0x1874('0x15')]);_0x542937(_0x5a426d[_0x1874('0x15')]);});}else{logger[_0x1874('0x10')]('['+[_0x4da68c[_0x1874('0x11')]()]+']\x20using\x20admin\x20profile');_0x4150d3[_0x1874('0x1d')]=_0x4150d3[_0x1874('0xd')];_0x4150d3['userEmail']=_0x4150d3[_0x1874('0x1f')];_0x31b777(_0x4150d3);}});};}function createEndUser(_0x29c118,_0x3c180c,_0x541843,_0x2eb599,_0x5d675d){logger[_0x1874('0x10')]('['+[_0x29c118[_0x1874('0x11')]()]+_0x1874('0x20'),_0x541843);return new Promise(function(_0x1c3b99,_0x50eb95){var _0x1f470b={'method':_0x1874('0x21'),'uri':_0x2eb599+'sys_user?'+_0x5d675d,'body':{'user_name':_0x541843[_0x1874('0x22')],'roles':_0x1874('0x23'),'first_name':_0x541843['endUserNumber'],'active':_0x1874('0x1c'),'date_format':_0x1874('0x24'),'phone':_0x541843['endUserNumber']},'auth':_0x3c180c,'json':!![]};return rp(_0x1f470b)['then'](function(_0x30376c){logger[_0x1874('0x10')]('['+[_0x29c118[_0x1874('0x11')]()]+_0x1874('0x25'),_0x30376c['result']);_0x541843[_0x1874('0x26')]=_0x30376c[_0x1874('0xe')][_0x1874('0xf')];_0x1c3b99(_0x541843);})[_0x1874('0x13')](function(_0x466c30){logger['error']('['+[_0x29c118[_0x1874('0x11')]()]+']',_0x466c30[_0x1874('0x15')]);_0x50eb95(_0x466c30[_0x1874('0x15')]);});});}function getEndUser(_0x553a17,_0x4f3e0a,_0x7ff4f2,_0x2d14df,_0x38e101){return function(_0x3e07c3){logger[_0x1874('0x10')]('['+[_0x553a17[_0x1874('0x11')]()]+_0x1874('0x27'),_0x3e07c3);return new Promise(function(_0x17189f,_0x4b82ea){var _0x5a04d7={'method':_0x1874('0x28'),'uri':_0x7ff4f2+'sys_user?sysparm_query=phone%3D'+_0x3e07c3['endUserNumber']+'&'+_0x2d14df+'&'+_0x38e101,'auth':_0x4f3e0a,'json':!![]};return rp(_0x5a04d7)[_0x1874('0x19')](function(_0x37dcd4){if(_0x37dcd4[_0x1874('0xe')][_0x1874('0xc')]>0x0){_0x3e07c3['endUserId']=_0x37dcd4['result'][0x0][_0x1874('0xf')];logger['info']('['+[_0x553a17[_0x1874('0x11')]()]+_0x1874('0x29'),_0x3e07c3);_0x17189f(_0x3e07c3);}else{return createEndUser(_0x553a17,_0x4f3e0a,_0x3e07c3,_0x7ff4f2,_0x2d14df)['then'](function(_0x298032){logger[_0x1874('0x10')]('['+[_0x553a17['toUpperCase']()]+_0x1874('0x2a'),_0x298032);_0x17189f(_0x298032);});}})['catch'](function(_0x181b77){logger['error']('['+[_0x553a17['toUpperCase']()]+']',_0x181b77[_0x1874('0x15')]);_0x4b82ea(_0x181b77[_0x1874('0x15')]);});});};}function getCustomFields(_0xb78197,_0x426419){var _0x496eca={};if(_0xb78197['length']>0x0){_[_0x1874('0x2b')](_0xb78197,function(_0xdf2a75){if(_[_0x1874('0x2c')]([_0x1874('0x2d'),'picklist'],_0xdf2a75[_0x1874('0x2e')])&&_0xdf2a75['nameField']&&!_0xdf2a75[_0x1874('0x2f')]){_0x496eca[_0xdf2a75[_0x1874('0x30')][_0x1874('0x31')]()]=_0xdf2a75[_0x1874('0x32')][_0x1874('0x33')]();}else if(_[_0x1874('0x2c')]([_0x1874('0x2d'),_0x1874('0x34')],_0xdf2a75[_0x1874('0x2e')])&&_0xdf2a75[_0x1874('0x35')]&&_0xdf2a75['customField']){_0x496eca[_0xdf2a75[_0x1874('0x35')][_0x1874('0x31')]()]=_0xdf2a75[_0x1874('0x32')][_0x1874('0x33')]();}else if(_0xdf2a75[_0x1874('0x2e')]===_0x1874('0x36')&&_0xdf2a75[_0x1874('0x37')]&&_0xdf2a75[_0x1874('0x35')]&&_0xdf2a75[_0x1874('0x2f')]){_0x496eca[_0xdf2a75[_0x1874('0x35')][_0x1874('0x31')]()]=_0x426419[_0xdf2a75['variableName']][_0x1874('0x33')]();}else if(_0xdf2a75[_0x1874('0x2e')]===_0x1874('0x38')&&_0xdf2a75[_0x1874('0x39')]&&_0xdf2a75[_0x1874('0x39')][_0x1874('0x3a')]&&_0xdf2a75['idField']&&_0xdf2a75['customField']){_0x496eca[_0xdf2a75['idField'][_0x1874('0x31')]()]=_0x426419[_0xdf2a75[_0x1874('0x39')]['name']['toLowerCase']()]['toString']();}});}return _0x496eca;}function getTicket(_0x4a45de,_0x2a572f,_0x244985,_0xf1f4e8,_0x257558,_0x1754c5){return function(_0x1a2ac3){logger[_0x1874('0x10')]('['+[_0x4a45de[_0x1874('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x1a2ac3);return new Promise(function(_0x5fa383,_0x69fa10){var _0x569e41=_0x4a45de[_0x1874('0x31')]()===_0x1874('0x3b')?_0x1a2ac3[_0x1874('0x1d')]:_0x1a2ac3[_0x1874('0x26')];var _0x576443={'method':_0x1874('0x21'),'uri':_0x244985+_0x1874('0x3c')+'?'+_0x1754c5,'body':Object[_0x1874('0x3d')]({},{'active':_0x1874('0x1c'),'caller_id':_0x569e41,'assigned_to':_0x1a2ac3[_0x1874('0x1d')],'short_description':intUtil['getString'](_0xf1f4e8[_0x1874('0x3e')],_0x257558,'\x20'),'description':intUtil[_0x1874('0x3f')](_0xf1f4e8['Descriptions'],_0x257558,'\x0a')},getCustomFields(_0xf1f4e8[_0x1874('0x40')],_0x257558)),'auth':_0x2a572f,'json':!![]};return rp(_0x576443)[_0x1874('0x19')](function(_0x11239a){logger[_0x1874('0x10')]('['+[_0x4a45de['toUpperCase']()]+_0x1874('0x41'),_0x11239a[_0x1874('0xe')]);_0x1a2ac3[_0x1874('0x42')]=_0x11239a[_0x1874('0xe')][_0x1874('0xf')];_0x1a2ac3['ticketNumber']=_0x11239a[_0x1874('0xe')][_0x1874('0x43')];logger[_0x1874('0x10')]('['+[_0x4a45de[_0x1874('0x11')]()]+']\x20getTicket\x20crm',_0x1a2ac3);_0x5fa383(_0x1a2ac3);})[_0x1874('0x13')](function(_0x29e157){logger[_0x1874('0x14')]('['+[_0x4a45de[_0x1874('0x11')]()]+']',_0x29e157[_0x1874('0x15')]);_0x69fa10(_0x29e157[_0x1874('0x15')]);});});};}function createRemoteTag(_0x4f1d7f,_0x5d92b4,_0x2274e9,_0x7e2366){return new Promise(function(_0x5daa99,_0x49af4e){var _0x29d8b7={'method':_0x1874('0x21'),'uri':_0x2274e9+'label'+'?'+_0x7e2366,'body':{'short_description':_0x4f1d7f,'global':!![],'active':!![],'name':_0x4f1d7f},'auth':_0x5d92b4,'json':!![]};return rp(_0x29d8b7)[_0x1874('0x19')](function(_0x252834){var _0x455ee3=_0x252834[_0x1874('0xe')][_0x1874('0xf')];_0x5daa99(_0x455ee3);});});}function getRemoteTag(_0x653de4,_0x2b70fc,_0x2e7736,_0x145f77,_0xf4e419){return new Promise(function(_0x1b5aa3,_0x462c4e){var _0x50f975={'method':_0x1874('0x28'),'uri':_0x2e7736+_0x1874('0x44')+_0x1874('0x45')+_0x653de4+'&'+_0x145f77,'auth':_0x2b70fc,'json':!![]};return rp(_0x50f975)[_0x1874('0x19')](function(_0x373f92){if(_0x373f92[_0x1874('0xe')][_0x1874('0xc')]>0x0){var _0x1982a4=_0x373f92[_0x1874('0xe')][0x0][_0x1874('0xf')];_0x1b5aa3(_0x1982a4);}else{return createRemoteTag(_0x653de4,_0x2b70fc,_0x2e7736,_0x145f77)[_0x1874('0x19')](function(_0x5cde0d){_0x1b5aa3(_0x5cde0d);});}});});}function assignTagToIncident(_0x3f3815,_0x438472,_0x500e5f,_0x1b3d16,_0x532f06){return new Promise(function(_0x54b2a5,_0x2d6767){var _0x6e08c4={'method':'POST','uri':_0x500e5f+_0x1874('0x46')+'?'+_0x532f06,'body':{'label':_0x3f3815,'table':_0x1874('0x3c'),'id_type':'Incident','table_key':_0x1b3d16[_0x1874('0x42')],'title':_0x1874('0x47')+_0x1b3d16[_0x1874('0x48')],'id_display':_0x1b3d16['ticketNumber']},'auth':_0x438472,'json':!![]};return rp(_0x6e08c4)['then'](function(_0xbedb53){_0x54b2a5();})['catch'](function(){_0x54b2a5();});});}function manageTags(_0x31172f,_0x4fc935,_0x39f2d,_0x2be8a5,_0x584c5f,_0x353180,_0x5c6327){return new Promise(function(_0x226e4b,_0x3079e3){var _0x1d8f78=[];_0x4fc935[_0x1874('0x2b')](function(_0x7579ca){_0x1d8f78['push'](getRemoteTag(_0x7579ca,_0x39f2d,_0x2be8a5,_0x353180,_0x5c6327));});return Promise[_0x1874('0x49')](_0x1d8f78)[_0x1874('0x19')](function(_0x4cc7f9){if(_0x4cc7f9['length']){logger[_0x1874('0x10')]('['+[_0x31172f[_0x1874('0x11')]()]+_0x1874('0x4a'),_0x4cc7f9);var _0x8f65fb=[];_0x4cc7f9[_0x1874('0x2b')](function(_0x12ca78){_0x8f65fb['push'](assignTagToIncident(_0x12ca78,_0x39f2d,_0x2be8a5,_0x584c5f,_0x353180));});return Promise[_0x1874('0x49')](_0x8f65fb)[_0x1874('0x19')](function(){_0x226e4b();})[_0x1874('0x13')](function(){_0x226e4b();});}else{_0x226e4b();}});});}function getTags(_0x4daf3b,_0x35e01f,_0x261eb4,_0x17493c,_0x4faa9c,_0x3aaa52){return function(_0x56692d){return new Promise(function(_0xba51ee,_0x3f5792){var _0x4c3681=[];var _0x380a80=_0x17493c[_0x1874('0x4b')];if(_0x380a80&&_0x380a80[_0x1874('0xc')]>0x0){_0x4c3681=_[_0x1874('0x4c')](_0x380a80,'name');}if(_0x4c3681[_0x1874('0xc')]>0x0){return manageTags(_0x4daf3b,_0x4c3681,_0x35e01f,_0x261eb4,_0x56692d,_0x4faa9c,_0x3aaa52)[_0x1874('0x19')](function(){_0xba51ee(_0x56692d);});}else{_0xba51ee(_0x56692d);}});};}function emit(_0x3b05e3,_0x140d34,_0x6bae4c){var _0x4ed903=_0x1874('0x4d')+_0x1874('0x4e')+_0x1874('0x4f')+'%255EORDERBYDESCnumber';var _0x365925={'uri':_0x3b05e3+_0x1874('0x50')+_0x6bae4c+_0x4ed903};io['to'](util[_0x1874('0x51')](_0x1874('0x52'),_0x140d34))[_0x1874('0x53')]('trigger:browser:url',_0x365925);}exports['cs']=function(_0xb9b9b7,_0xc04492,_0x23b33c,_0x414682,_0x359b09,_0x6c22d9,_0x5979ec,_0x17a77f){var _0x585237={};var _0x32d605={'user':_0x6c22d9['username'],'pass':_0x6c22d9[_0x1874('0x54')]};var _0x112d62=_0x1874('0x55');var _0x3c5811=_0x1874('0x56');_0x6c22d9[_0x1874('0x57')]=intUtil[_0x1874('0x58')](_0x6c22d9[_0x1874('0x57')]);_0x6c22d9['serverUrl']=intUtil[_0x1874('0x58')](_0x6c22d9[_0x1874('0x59')]);var _0x1ea255=util[_0x1874('0x51')](_0x1874('0x5a'),_0x6c22d9[_0x1874('0x57')]);_0x585237['userEmail']=!_['isNil'](_0x414682)?_0x414682['email']:null;_0x585237[_0x1874('0x1f')]=_0x6c22d9[_0x1874('0x5b')];_0x585237[_0x1874('0x22')]=_0x17a77f['toLowerCase']()===_0x1874('0x3b')?_0xc04492[_0x1874('0x5c')]:_0xc04492['calleridnum'];_0x585237['callDirection']=_0x17a77f===_0x1874('0x5d')||_0x17a77f==='unmanaged'?_0x1874('0x5d'):_0x1874('0x3b');var _0x7e89bc=util[_0x1874('0x51')](_0x1874('0x5e'),_0x6c22d9['serverUrl'],_0xc04492['uniqueid'],md5(_0xc04492[_0x1874('0x5f')]));if(_0x359b09&&_0x359b09[_0x1874('0x60')]){logger[_0x1874('0x10')](_0x1874('0x61'),_0x1874('0x62'));_0xc04492[_0x1874('0x63')]=_0x7e89bc;}else if(_0x5979ec&&_0x5979ec[_0x1874('0x64')]&&_0x5979ec[_0x1874('0x64')]!==_0x1874('0x65')){logger[_0x1874('0x10')](_0x1874('0x66'),_0x1874('0x62'));_0xc04492[_0x1874('0x63')]=_0x7e89bc;}else{_0xc04492[_0x1874('0x63')]='';}return getAdminUser(_0x17a77f,_0x32d605,_0x585237,_0x1ea255,_0x3c5811,_0x112d62)[_0x1874('0x19')](getUser(_0x17a77f,_0x32d605,_0x1ea255,_0x3c5811,_0x112d62))[_0x1874('0x19')](getEndUser(_0x17a77f,_0x32d605,_0x1ea255,_0x3c5811,_0x112d62))[_0x1874('0x19')](getTicket(_0x17a77f,_0x32d605,_0x1ea255,_0x23b33c,_0xc04492,_0x3c5811))[_0x1874('0x19')](function(_0x50dc64){logger['info'](util[_0x1874('0x51')](_0x1874('0x67'),_0x50dc64[_0x1874('0x42')]));logger['info'](util[_0x1874('0x51')](_0x1874('0x68'),_0x17a77f));if(_0x17a77f!==_0x1874('0x69')){logger[_0x1874('0x10')]('['+[_0x17a77f[_0x1874('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x6c22d9[_0x1874('0x57')],_0x414682['name'],_0x50dc64[_0x1874('0x42')]);}})['catch'](function(_0x70bfe4){logger[_0x1874('0x14')]('['+[_0x17a77f[_0x1874('0x11')]()]+_0x1874('0x6a'),util['inspect'](_0x70bfe4,{'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 0a2312c..3800910 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 _0xd5d8=['parent_name','direction','length','variableName','idField','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','value','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','resolve','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','string','nameField','type','customField','custom_fields','push','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','users','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','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','contacts','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts'];(function(_0x51410d,_0x1d6355){var _0xb92a85=function(_0x2b98a5){while(--_0x2b98a5){_0x51410d['push'](_0x51410d['shift']());}};_0xb92a85(++_0x1d6355);}(_0xd5d8,0x1c1));var _0x8d5d=function(_0x2efa84,_0xd84147){_0x2efa84=_0x2efa84-0x0;var _0x2d7f91=_0xd5d8[_0x2efa84];return _0x2d7f91;};'use strict';var _=require(_0x8d5d('0x0'));var rp=require(_0x8d5d('0x1'));var BPromise=require(_0x8d5d('0x2'));var md5=require(_0x8d5d('0x3'));var util=require(_0x8d5d('0x4'));var Redis=require('ioredis');var intUtil=require(_0x8d5d('0x5'));var config=require(_0x8d5d('0x6'));var logger=require(_0x8d5d('0x7'))(_0x8d5d('0x8'));config[_0x8d5d('0x9')]=_[_0x8d5d('0xa')](config[_0x8d5d('0x9')],{'host':_0x8d5d('0xb'),'port':0x18eb});var io=require(_0x8d5d('0xc'))(new Redis(config['redis']));var def={'method':_0x8d5d('0xd'),'json':!![]};function emit(_0x26d321,_0x51bca3,_0x4a9729){io['to'](_0x26d321)[_0x8d5d('0xe')](_0x51bca3,_0x4a9729);}function getTicket(_0x390e44,_0xc23fce,_0x435a63,_0x5ac975,_0x5aceac,_0x8e745b,_0x328964,_0x324e9b){logger[_0x8d5d('0xf')](_0x8d5d('0x10'));var _0x4ee768=new Date();var _0x3c82f4=[{'name':_0x8d5d('0x11'),'value':intUtil[_0x8d5d('0x12')](_0x5ac975[_0x8d5d('0x13')],_0x5aceac,'\x20')},{'name':'assigned_user_id','value':_0xc23fce['id']},{'name':_0x8d5d('0x14'),'value':_0xc23fce['id']},{'name':_0x8d5d('0x15'),'value':intUtil[_0x8d5d('0x12')](_0x5ac975[_0x8d5d('0x16')],_0x5aceac,'\x0a')},{'name':'date_start','value':_0x4ee768[_0x8d5d('0x17')]()[_0x8d5d('0x18')](0x0,0x13)[_0x8d5d('0x19')]('T','\x20')},{'name':_0x8d5d('0x1a'),'value':'0'},{'name':_0x8d5d('0x1b'),'value':'15'},{'name':_0x8d5d('0x1c'),'value':_0x435a63['id']},{'name':_0x8d5d('0x1d'),'value':_0x8d5d('0x1e')},{'name':_0x8d5d('0x1f'),'value':_0x435a63[_0x8d5d('0x11')]},{'name':_0x8d5d('0x20'),'value':_0x324e9b}];if(_0x8e745b[_0x8d5d('0x21')]){_['forEach'](_0x8e745b,function(_0x991d5f){if(_0x5aceac[_0x991d5f[_0x8d5d('0x22')]]){_0x3c82f4['push']({'name':_0x991d5f[_0x8d5d('0x23')],'value':_0x5aceac[_0x991d5f[_0x8d5d('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x328964['id'],'module_name':_0x8d5d('0x26'),'name_value_list':_0x3c82f4})}});}function getAuth(_0x405e6f){return util[_0x8d5d('0x27')]('Basic\x20%s',new Buffer(_0x405e6f[_0x8d5d('0x28')]+':X')[_0x8d5d('0x29')]('base64'));}function getServerInfo(_0x5808bd){return request({'form':{'method':_0x8d5d('0x2a'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON['stringify']({'session':_0x5808bd['id']})}});}function getUser(_0x28bb22,_0x3ac551,_0x2aee10){if(!_[_0x8d5d('0x2b')](_0x3ac551)){logger[_0x8d5d('0xf')](_0x8d5d('0x2c'),_0x3ac551);return request({'form':{'method':_0x8d5d('0x2d'),'input_type':_0x8d5d('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2aee10['id'],'module_name':'Employees','query':util['format'](_0x8d5d('0x2e'),_0x3ac551),'order_by':'','offset':'0','select_fields':['id',_0x8d5d('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8d5d('0x2f')](function(_0x3d78c7){if(_0x3d78c7[_0x8d5d('0x30')][_0x8d5d('0x21')]){var _0x479b7e=_['find'](_0x3d78c7[_0x8d5d('0x30')],function(_0x9c1f80){return _0x9c1f80['name_value_list'][_0x8d5d('0x31')][_0x8d5d('0x32')]===_0x3ac551;});if(_0x479b7e){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x479b7e['name_value_list']['id']['value'],'name':_0x479b7e[_0x8d5d('0x33')][_0x8d5d('0x11')][_0x8d5d('0x32')]});}}logger[_0x8d5d('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2aee10[_0x8d5d('0x33')][_0x8d5d('0x34')]['value'],'name':_0x2aee10[_0x8d5d('0x33')]['user_name'][_0x8d5d('0x32')]});});}else{logger[_0x8d5d('0xf')](_0x8d5d('0x35'));return BPromise['resolve']({'id':_0x2aee10['name_value_list']['user_id']['value'],'name':_0x2aee10[_0x8d5d('0x33')][_0x8d5d('0x31')][_0x8d5d('0x32')]});}}function getEndUser(_0x583a51,_0x11285e,_0x3af309,_0x514253){logger['info'](_0x8d5d('0x36'),_0x3af309);return request({'form':{'method':_0x8d5d('0x2d'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x514253['id'],'module_name':_0x8d5d('0x1e'),'query':util['format'](_0x8d5d('0x37'),_0x3af309),'order_by':'','offset':'0','select_fields':['id','name',_0x8d5d('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8d5d('0x2f')](function(_0x2e2b6d){if(_0x2e2b6d[_0x8d5d('0x30')]['length']){var _0x18e37b=_['find'](_0x2e2b6d['entry_list'],function(_0x2a8ac1){return _0x2a8ac1[_0x8d5d('0x33')]['phone_home'][_0x8d5d('0x32')]===_0x3af309;});if(_0x18e37b){logger[_0x8d5d('0xf')]('Enduser\x20found!');return BPromise[_0x8d5d('0x39')]({'id':_0x18e37b[_0x8d5d('0x33')]['id'][_0x8d5d('0x32')],'name':_0x18e37b[_0x8d5d('0x33')]['name'][_0x8d5d('0x32')],'phone':_0x18e37b['name_value_list']['phone_home'][_0x8d5d('0x32')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8d5d('0x3a'),'input_type':'JSON','response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'session':_0x514253['id'],'module_name':_0x8d5d('0x1e'),'name_value_list':[{'name':_0x8d5d('0x3b'),'value':_0x11285e!==''?_0x11285e:util['format'](_0x8d5d('0x3c'),_0x3af309)},{'name':_0x8d5d('0x38'),'value':_0x3af309}]})}})[_0x8d5d('0x2f')](function(_0x3ed396){logger[_0x8d5d('0xf')](_0x8d5d('0x3d'));return BPromise[_0x8d5d('0x39')]({'id':_0x3ed396['id'],'name':_0x3ed396[_0x8d5d('0x30')][_0x8d5d('0x3b')][_0x8d5d('0x32')],'phone':_0x3ed396[_0x8d5d('0x30')][_0x8d5d('0x38')][_0x8d5d('0x32')]});});}});}function request(_0x1d2c65){logger[_0x8d5d('0x3e')](_0x8d5d('0x3f'),JSON[_0x8d5d('0x25')](_0x1d2c65));return rp(_[_0x8d5d('0x40')](def,_0x1d2c65));}function getTags(_0x1e8c1d,_0x3f5e00){var _0x5679d8=[];if(_0x1e8c1d&&_0x1e8c1d['length']>0x0){_0x5679d8=_['map'](_0x1e8c1d,_0x3f5e00);}return _0x5679d8;}function getCustomFields(_0x1edf37,_0x1dabfc){var _0x15d1ab=[];var _0x1d6f70={'custom_fields':[]};if(_0x1edf37[_0x8d5d('0x21')]>0x0){_[_0x8d5d('0x41')](_0x1edf37,function(_0x3ae982){if(_0x3ae982['type']===_0x8d5d('0x42')&&_0x3ae982[_0x8d5d('0x43')]&&!_0x3ae982['customField']){_0x1d6f70[_0x3ae982[_0x8d5d('0x43')]['toLowerCase']()]=_0x3ae982['content']['toString']();}else if(_0x3ae982[_0x8d5d('0x44')]===_0x8d5d('0x42')&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982[_0x8d5d('0x23')],'value':_0x3ae982['content'][_0x8d5d('0x29')]()});}else if(_0x3ae982[_0x8d5d('0x44')]===_0x8d5d('0x48')&&_0x3ae982['variableName']&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1dabfc[_0x3ae982[_0x8d5d('0x22')]]&&_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982[_0x8d5d('0x23')],'value':_0x1dabfc[_0x3ae982['variableName']][_0x8d5d('0x29')]()});}else if(_0x3ae982['type']===_0x8d5d('0x49')&&_0x3ae982[_0x8d5d('0x4a')]&&_0x3ae982['Variable'][_0x8d5d('0x11')]&&_0x3ae982[_0x8d5d('0x23')]&&_0x3ae982[_0x8d5d('0x45')]){_0x1dabfc[_0x3ae982[_0x8d5d('0x4a')]['name'][_0x8d5d('0x4b')]()]&&_0x1d6f70[_0x8d5d('0x46')][_0x8d5d('0x47')]({'id':_0x3ae982['idField'],'value':_0x1dabfc[_0x3ae982[_0x8d5d('0x4a')][_0x8d5d('0x11')]['toLowerCase']()][_0x8d5d('0x29')]()});}});}return _0x1d6f70;}function getConnection(_0x10b388){return request({'method':_0x8d5d('0xd'),'form':{'method':_0x8d5d('0x4c'),'input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON[_0x8d5d('0x25')]({'user_auth':{'user_name':_0x10b388['username'],'password':_0x10b388[_0x8d5d('0x4d')],'encryption':_0x8d5d('0x4e')},'application':_0x8d5d('0x4f')})}})['then'](function(_0x2eb179){var _0x5dba09=_0x2eb179;if(_0x5dba09['id']){def[_0x8d5d('0x50')]=_0x5dba09['id'];return BPromise[_0x8d5d('0x39')](_0x5dba09);}else{throw new Error(util[_0x8d5d('0x27')](_0x8d5d('0x51'),_0x10b388['id']));}});}function setRelationship(_0x3addd4,_0x16bbac,_0x4f103e,_0x3e76d4){return request({'form':{'method':'set_relationship','input_type':_0x8d5d('0x24'),'response_type':_0x8d5d('0x24'),'rest_data':JSON['stringify']({'session':_0x3addd4['id'],'module_name':_0x8d5d('0x26'),'module_id':_0x4f103e['id'],'link_field_name':_0x3e76d4,'related_ids':[_0x16bbac['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8d5d('0x52')]=function(_0x35848b,_0x43ebb6,_0x4d9341,_0x5b757d,_0x331e38,_0x540ad5){var _0x522337,_0x2b296b,_0x26d6ca,_0x3045a0;_0x540ad5[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x540ad5[_0x8d5d('0x53')]);_0x540ad5[_0x8d5d('0x55')]=intUtil[_0x8d5d('0x54')](_0x540ad5[_0x8d5d('0x55')]);def[_0x8d5d('0x56')]=util[_0x8d5d('0x27')](_0x8d5d('0x57'),_0x540ad5[_0x8d5d('0x53')]);if(_0x331e38&&_0x331e38['monitor_format']){logger[_0x8d5d('0xf')](_0x8d5d('0x58'),'Recording\x20is\x20enabled!');_0x43ebb6['recordingURL']=util[_0x8d5d('0x27')](_0x8d5d('0x59'),_0x540ad5[_0x8d5d('0x55')],_0x43ebb6[_0x8d5d('0x5a')],md5(_0x43ebb6[_0x8d5d('0x5a')]));}else{_0x43ebb6[_0x8d5d('0x5b')]='';}return getConnection(_0x540ad5)[_0x8d5d('0x2f')](function(_0x38ffa1){_0x3045a0=_0x38ffa1;return getUser(_0x540ad5,_0x5b757d[_0x8d5d('0x11')],_0x3045a0);})[_0x8d5d('0x2f')](function(_0x16d300){_0x522337=_0x16d300;logger[_0x8d5d('0xf')](_0x8d5d('0x5c'),_0x522337['id']);return getEndUser(_0x540ad5,_0x43ebb6['calleridname'],_0x43ebb6[_0x8d5d('0x5d')],_0x3045a0);})[_0x8d5d('0x2f')](function(_0x585116){_0x2b296b=_0x585116;logger[_0x8d5d('0xf')]('The\x20Enduser\x20ID\x20is:',_0x2b296b['id']);return getTicket(_0x540ad5,_0x522337,_0x2b296b,_0x4d9341,_0x43ebb6,_0x4d9341[_0x8d5d('0x5e')],_0x3045a0,_0x8d5d('0x5f'));})[_0x8d5d('0x2f')](function(_0x5605c8){_0x26d6ca=_0x5605c8;logger[_0x8d5d('0xf')](_0x8d5d('0x60'));logger[_0x8d5d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x26d6ca['id']);return setRelationship(_0x3045a0,_0x522337,_0x26d6ca,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x3045a0,_0x2b296b,_0x26d6ca,'contacts');})['then'](function(){return getServerInfo(_0x3045a0);})[_0x8d5d('0x2f')](function(_0x5f2b90){var _0x299de0=parseInt(_0x5f2b90[_0x8d5d('0x62')][_0x8d5d('0x63')](0x0));var _0x310688=util[_0x8d5d('0x27')](_0x8d5d('0x64'),_0x540ad5[_0x8d5d('0x53')],_0x26d6ca['id']);if(_0x299de0>0x6){_0x310688=util[_0x8d5d('0x27')](_0x8d5d('0x65'),_0x540ad5[_0x8d5d('0x53')],_0x26d6ca['id']);}logger[_0x8d5d('0xf')](_0x8d5d('0x58'),_0x8d5d('0x66'));emit(util[_0x8d5d('0x27')](_0x8d5d('0x67'),_0x5b757d[_0x8d5d('0x11')]),_0x8d5d('0x68'),{'uri':_0x310688});})[_0x8d5d('0x69')](function(_0xb827f8){logger[_0x8d5d('0x6a')](_0x8d5d('0x58'),JSON[_0x8d5d('0x25')](_0xb827f8));});};exports[_0x8d5d('0x6b')]=function(_0x49e0d2,_0x229da2,_0x1a7acb,_0x4cafce,_0x5882dc,_0x1e29b7,_0x19ce2c){var _0xed5b72,_0x1a55a7,_0x59ed68,_0x2b987e;_0x1e29b7[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x1e29b7[_0x8d5d('0x53')]);_0x1e29b7[_0x8d5d('0x55')]=intUtil['stripTrailingSlash'](_0x1e29b7[_0x8d5d('0x55')]);def[_0x8d5d('0x56')]=util['format'](_0x8d5d('0x57'),_0x1e29b7[_0x8d5d('0x53')]);if(_0x19ce2c&&_0x19ce2c[_0x8d5d('0x6c')]&&_0x19ce2c[_0x8d5d('0x6c')]!==_0x8d5d('0x6d')){logger[_0x8d5d('0xf')](_0x8d5d('0x6e'),_0x8d5d('0x6f'));_0x229da2[_0x8d5d('0x5b')]=util[_0x8d5d('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e29b7['serverUrl'],_0x229da2['uniqueid'],md5(_0x229da2['uniqueid']));}return getConnection(_0x1e29b7)[_0x8d5d('0x2f')](function(_0x18e9b3){_0x2b987e=_0x18e9b3;return getUser(_0x1e29b7,_0x4cafce[_0x8d5d('0x11')],_0x2b987e);})[_0x8d5d('0x2f')](function(_0x2175c9){_0xed5b72=_0x2175c9;logger[_0x8d5d('0xf')](_0x8d5d('0x5c'),_0xed5b72['id']);return getEndUser(_0x1e29b7,_0x229da2['destcalleridname'],_0x229da2[_0x8d5d('0x70')],_0x2b987e);})[_0x8d5d('0x2f')](function(_0x37ea88){_0x1a55a7=_0x37ea88;logger[_0x8d5d('0xf')](_0x8d5d('0x71'),_0x1a55a7['id']);return getTicket(_0x1e29b7,_0xed5b72,_0x1a55a7,_0x1a7acb,_0x229da2,_0x1a7acb['Fields'],_0x2b987e,'Outbound');})[_0x8d5d('0x2f')](function(_0x4e339f){_0x59ed68=_0x4e339f;logger[_0x8d5d('0xf')](_0x8d5d('0x60'));logger[_0x8d5d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x59ed68['id']);return setRelationship(_0x2b987e,_0xed5b72,_0x59ed68,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x2b987e,_0x1a55a7,_0x59ed68,_0x8d5d('0x72'));})[_0x8d5d('0x2f')](function(){return getServerInfo(_0x2b987e);})[_0x8d5d('0x2f')](function(_0x2393f5){var _0xed4a9f=parseInt(_0x2393f5[_0x8d5d('0x62')][_0x8d5d('0x63')](0x0));var _0x5e2098=util[_0x8d5d('0x27')](_0x8d5d('0x64'),_0x1e29b7['remoteUri'],_0x59ed68['id']);if(_0xed4a9f>0x6){_0x5e2098=util[_0x8d5d('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1e29b7['remoteUri'],_0x59ed68['id']);}logger[_0x8d5d('0xf')](_0x8d5d('0x6e'),_0x8d5d('0x66'));emit(util[_0x8d5d('0x27')](_0x8d5d('0x67'),_0x4cafce[_0x8d5d('0x11')]),'trigger:browser:url',{'uri':_0x5e2098});})[_0x8d5d('0x69')](function(_0x4e974b){logger[_0x8d5d('0x6a')]('[OUTBOUND]',JSON[_0x8d5d('0x25')](_0x4e974b));});};exports[_0x8d5d('0x73')]=function(_0x4a2ea1,_0x4f5433,_0x5c84de,_0x352f51,_0x10f2b7,_0x3ea2d2){var _0xc3a52a,_0xe4cacb,_0x5b428a,_0x3603b9;_0x3ea2d2[_0x8d5d('0x53')]=intUtil[_0x8d5d('0x54')](_0x3ea2d2['remoteUri']);_0x3ea2d2['serverUrl']=intUtil[_0x8d5d('0x54')](_0x3ea2d2[_0x8d5d('0x55')]);def['uri']=util['format'](_0x8d5d('0x57'),_0x3ea2d2[_0x8d5d('0x53')]);if(_0x10f2b7&&_0x10f2b7[_0x8d5d('0x74')]){logger['info']('['+_0x4f5433[_0x8d5d('0x75')]['toUpperCase']()+']',_0x8d5d('0x6f'));_0x4f5433[_0x8d5d('0x5b')]=util[_0x8d5d('0x27')](_0x8d5d('0x59'),_0x3ea2d2['serverUrl'],_0x4f5433[_0x8d5d('0x5a')],md5(_0x4f5433[_0x8d5d('0x5a')]));}else{_0x4f5433[_0x8d5d('0x5b')]='';}return getConnection(_0x3ea2d2)[_0x8d5d('0x2f')](function(_0x57429f){_0x3603b9=_0x57429f;if(!_[_0x8d5d('0x2b')](_0x352f51)){return getUser(_0x3ea2d2,_0x352f51[_0x8d5d('0x11')],_0x3603b9);}else{return getUser(_0x3ea2d2,null,_0x3603b9);}})[_0x8d5d('0x2f')](function(_0x2f4140){_0xc3a52a=_0x2f4140;logger[_0x8d5d('0xf')]('The\x20User\x20ID\x20is:',_0xc3a52a['id']);return getEndUser(_0x3ea2d2,_0x4f5433['calleridname'],_0x4f5433['calleridnum'],_0x3603b9);})[_0x8d5d('0x2f')](function(_0x1335a1){_0xe4cacb=_0x1335a1;logger['info'](_0x8d5d('0x71'),_0xe4cacb['id']);return getTicket(_0x3ea2d2,_0xc3a52a,_0xe4cacb,_0x5c84de,_0x4f5433,_0x5c84de[_0x8d5d('0x5e')],_0x3603b9,_0x8d5d('0x5f'));})[_0x8d5d('0x2f')](function(_0x152eaa){_0x5b428a=_0x152eaa;logger['info']('Ticket\x20created!');logger[_0x8d5d('0xf')](_0x8d5d('0x76'),_0x5b428a['id']);return setRelationship(_0x3603b9,_0xc3a52a,_0x5b428a,_0x8d5d('0x61'));})[_0x8d5d('0x2f')](function(){return setRelationship(_0x3603b9,_0xe4cacb,_0x5b428a,_0x8d5d('0x72'));})[_0x8d5d('0x2f')](function(){return getServerInfo(_0x3603b9);})[_0x8d5d('0x69')](function(_0x4ff2a5){logger[_0x8d5d('0x6a')]('['+_0x4f5433[_0x8d5d('0x75')][_0x8d5d('0x77')]()+']',JSON['stringify'](_0x4ff2a5));});}; \ No newline at end of file +var _0x37b2=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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...','trigger:browser:url','outbound','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','version','[OUTBOUND]','user:%s','catch','unmanaged','toUpperCase','error','lastevent','lodash','request-promise','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','JSON','stringify','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','map','forEach','type','string','nameField','customField','content','custom_fields','variable','Variable','toLowerCase','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]'];(function(_0x443bf5,_0xf38d26){var _0x16fe20=function(_0x210ec3){while(--_0x210ec3){_0x443bf5['push'](_0x443bf5['shift']());}};_0x16fe20(++_0xf38d26);}(_0x37b2,0x94));var _0x237b=function(_0x46060a,_0x4ed109){_0x46060a=_0x46060a-0x0;var _0x119e5e=_0x37b2[_0x46060a];return _0x119e5e;};'use strict';var _=require(_0x237b('0x0'));var rp=require(_0x237b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x237b('0x2'));var Redis=require(_0x237b('0x3'));var intUtil=require(_0x237b('0x4'));var config=require(_0x237b('0x5'));var logger=require('../../../../config/logger')(_0x237b('0x6'));config[_0x237b('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x237b('0x8'))(new Redis(config[_0x237b('0x7')]));var def={'method':_0x237b('0x9'),'json':!![]};function emit(_0x36b388,_0xc97a71,_0x41d24c){io['to'](_0x36b388)[_0x237b('0xa')](_0xc97a71,_0x41d24c);}function getTicket(_0x42f6ed,_0x49618a,_0xaf2f4b,_0x242889,_0x5a7e3a,_0x441659,_0x4cc097,_0x5eaf82){logger[_0x237b('0xb')](_0x237b('0xc'));var _0x37f8b1=new Date();var _0x28f8ac=[{'name':_0x237b('0xd'),'value':intUtil[_0x237b('0xe')](_0x242889[_0x237b('0xf')],_0x5a7e3a,'\x20')},{'name':_0x237b('0x10'),'value':_0x49618a['id']},{'name':_0x237b('0x11'),'value':_0x49618a['id']},{'name':'description','value':intUtil[_0x237b('0xe')](_0x242889[_0x237b('0x12')],_0x5a7e3a,'\x0a')},{'name':_0x237b('0x13'),'value':_0x37f8b1['toISOString']()['slice'](0x0,0x13)[_0x237b('0x14')]('T','\x20')},{'name':_0x237b('0x15'),'value':'0'},{'name':_0x237b('0x16'),'value':'15'},{'name':'parent_id','value':_0xaf2f4b['id']},{'name':_0x237b('0x17'),'value':_0x237b('0x18')},{'name':_0x237b('0x19'),'value':_0xaf2f4b[_0x237b('0xd')]},{'name':_0x237b('0x1a'),'value':_0x5eaf82}];if(_0x441659[_0x237b('0x1b')]){_['forEach'](_0x441659,function(_0x2c4ee9){if(_0x5a7e3a[_0x2c4ee9[_0x237b('0x1c')]]){_0x28f8ac[_0x237b('0x1d')]({'name':_0x2c4ee9[_0x237b('0x1e')],'value':_0x5a7e3a[_0x2c4ee9['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x237b('0x1f'),'response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0x4cc097['id'],'module_name':'Calls','name_value_list':_0x28f8ac})}});}function getAuth(_0x5d8eaf){return util['format']('Basic\x20%s',new Buffer(_0x5d8eaf['apiKey']+':X')[_0x237b('0x21')](_0x237b('0x22')));}function getServerInfo(_0x486964){return request({'form':{'method':_0x237b('0x23'),'input_type':_0x237b('0x1f'),'response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0x486964['id']})}});}function getUser(_0x2d90e1,_0x24f79b,_0x9b230b){if(!_[_0x237b('0x24')](_0x24f79b)){logger[_0x237b('0xb')](_0x237b('0x25'),_0x24f79b);return request({'form':{'method':_0x237b('0x26'),'input_type':_0x237b('0x1f'),'response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0x9b230b['id'],'module_name':_0x237b('0x27'),'query':util[_0x237b('0x28')](_0x237b('0x29'),_0x24f79b),'order_by':'','offset':'0','select_fields':['id',_0x237b('0xd'),_0x237b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x237b('0x2b')](function(_0x1e6a44){if(_0x1e6a44[_0x237b('0x2c')][_0x237b('0x1b')]){var _0x26423e=_[_0x237b('0x2d')](_0x1e6a44[_0x237b('0x2c')],function(_0x2ee8c3){return _0x2ee8c3[_0x237b('0x2e')][_0x237b('0x2a')][_0x237b('0x2f')]===_0x24f79b;});if(_0x26423e){logger[_0x237b('0xb')](_0x237b('0x30'));return BPromise[_0x237b('0x31')]({'id':_0x26423e[_0x237b('0x2e')]['id'][_0x237b('0x2f')],'name':_0x26423e['name_value_list']['name'][_0x237b('0x2f')]});}}logger[_0x237b('0xb')](_0x237b('0x32'));return BPromise[_0x237b('0x31')]({'id':_0x9b230b['name_value_list'][_0x237b('0x33')][_0x237b('0x2f')],'name':_0x9b230b[_0x237b('0x2e')]['user_name'][_0x237b('0x2f')]});});}else{logger[_0x237b('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x237b('0x31')]({'id':_0x9b230b[_0x237b('0x2e')][_0x237b('0x33')][_0x237b('0x2f')],'name':_0x9b230b[_0x237b('0x2e')]['user_name'][_0x237b('0x2f')]});}}function getEndUser(_0x1bcb9f,_0x3d5c45,_0x182bab,_0x33813b){logger[_0x237b('0xb')](_0x237b('0x34'),_0x182bab);return request({'form':{'method':_0x237b('0x26'),'input_type':_0x237b('0x1f'),'response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0x33813b['id'],'module_name':'Contacts','query':util[_0x237b('0x28')](_0x237b('0x35'),_0x182bab),'order_by':'','offset':'0','select_fields':['id',_0x237b('0xd'),_0x237b('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x237b('0x2b')](function(_0xd920b4){if(_0xd920b4[_0x237b('0x2c')]['length']){var _0x514429=_[_0x237b('0x2d')](_0xd920b4[_0x237b('0x2c')],function(_0x40b3ca){return _0x40b3ca[_0x237b('0x2e')]['phone_home'][_0x237b('0x2f')]===_0x182bab;});if(_0x514429){logger['info'](_0x237b('0x37'));return BPromise[_0x237b('0x31')]({'id':_0x514429[_0x237b('0x2e')]['id']['value'],'name':_0x514429[_0x237b('0x2e')][_0x237b('0xd')][_0x237b('0x2f')],'phone':_0x514429[_0x237b('0x2e')][_0x237b('0x36')][_0x237b('0x2f')]});}}else{logger[_0x237b('0xb')](_0x237b('0x38'));return request({'form':{'method':_0x237b('0x39'),'input_type':_0x237b('0x1f'),'response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0x33813b['id'],'module_name':_0x237b('0x18'),'name_value_list':[{'name':_0x237b('0x3a'),'value':_0x3d5c45!==_0x237b('0x3b')?_0x3d5c45:util[_0x237b('0x28')]('Caller\x20-\x20%s',_0x182bab)},{'name':_0x237b('0x36'),'value':_0x182bab}]})}})[_0x237b('0x2b')](function(_0x416d52){logger[_0x237b('0xb')](_0x237b('0x3c'));return BPromise['resolve']({'id':_0x416d52['id'],'name':_0x416d52['entry_list'][_0x237b('0x3a')]['value'],'phone':_0x416d52['entry_list'][_0x237b('0x36')][_0x237b('0x2f')]});});}});}function request(_0x4fe1f9){logger[_0x237b('0x3d')](_0x237b('0x3e'),JSON[_0x237b('0x20')](_0x4fe1f9));return rp(_['merge'](def,_0x4fe1f9));}function getTags(_0x224c32,_0x54418e){var _0x4db7b3=[];if(_0x224c32&&_0x224c32[_0x237b('0x1b')]>0x0){_0x4db7b3=_[_0x237b('0x3f')](_0x224c32,_0x54418e);}return _0x4db7b3;}function getCustomFields(_0x453616,_0x578116){var _0x3a8643=[];var _0x3c729b={'custom_fields':[]};if(_0x453616[_0x237b('0x1b')]>0x0){_[_0x237b('0x40')](_0x453616,function(_0x2d6fd2){if(_0x2d6fd2[_0x237b('0x41')]===_0x237b('0x42')&&_0x2d6fd2[_0x237b('0x43')]&&!_0x2d6fd2[_0x237b('0x44')]){_0x3c729b[_0x2d6fd2[_0x237b('0x43')]['toLowerCase']()]=_0x2d6fd2[_0x237b('0x45')][_0x237b('0x21')]();}else if(_0x2d6fd2[_0x237b('0x41')]===_0x237b('0x42')&&_0x2d6fd2['idField']&&_0x2d6fd2[_0x237b('0x44')]){_0x3c729b[_0x237b('0x46')][_0x237b('0x1d')]({'id':_0x2d6fd2[_0x237b('0x1e')],'value':_0x2d6fd2[_0x237b('0x45')][_0x237b('0x21')]()});}else if(_0x2d6fd2[_0x237b('0x41')]===_0x237b('0x47')&&_0x2d6fd2[_0x237b('0x1c')]&&_0x2d6fd2[_0x237b('0x1e')]&&_0x2d6fd2[_0x237b('0x44')]){_0x578116[_0x2d6fd2['variableName']]&&_0x3c729b[_0x237b('0x46')][_0x237b('0x1d')]({'id':_0x2d6fd2[_0x237b('0x1e')],'value':_0x578116[_0x2d6fd2['variableName']][_0x237b('0x21')]()});}else if(_0x2d6fd2[_0x237b('0x41')]==='customVariable'&&_0x2d6fd2[_0x237b('0x48')]&&_0x2d6fd2[_0x237b('0x48')][_0x237b('0xd')]&&_0x2d6fd2[_0x237b('0x1e')]&&_0x2d6fd2['customField']){_0x578116[_0x2d6fd2[_0x237b('0x48')]['name'][_0x237b('0x49')]()]&&_0x3c729b['custom_fields'][_0x237b('0x1d')]({'id':_0x2d6fd2[_0x237b('0x1e')],'value':_0x578116[_0x2d6fd2['Variable']['name'][_0x237b('0x49')]()]['toString']()});}});}return _0x3c729b;}function getConnection(_0x378fb1){return request({'method':_0x237b('0x9'),'form':{'method':'login','input_type':_0x237b('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x378fb1['username'],'password':_0x378fb1[_0x237b('0x4a')],'encryption':_0x237b('0x4b')},'application':_0x237b('0x4c')})}})['then'](function(_0x4f5313){var _0x26eb46=_0x4f5313;if(_0x26eb46['id']){def[_0x237b('0x4d')]=_0x26eb46['id'];return BPromise['resolve'](_0x26eb46);}else{throw new Error(util['format'](_0x237b('0x4e'),_0x378fb1['id']));}});}function setRelationship(_0xf09517,_0x12eb1f,_0x389011,_0x584df0){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x237b('0x1f'),'rest_data':JSON[_0x237b('0x20')]({'session':_0xf09517['id'],'module_name':_0x237b('0x4f'),'module_id':_0x389011['id'],'link_field_name':_0x584df0,'related_ids':[_0x12eb1f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x237b('0x50')]=function(_0x20d4b4,_0x4c42e0,_0x2b4396,_0x1f0d82,_0x542473,_0x15eb1){var _0x359968,_0x7d975,_0x360728,_0x1ee878;_0x15eb1[_0x237b('0x51')]=intUtil[_0x237b('0x52')](_0x15eb1[_0x237b('0x51')]);_0x15eb1[_0x237b('0x53')]=intUtil['stripTrailingSlash'](_0x15eb1[_0x237b('0x53')]);def[_0x237b('0x54')]=util[_0x237b('0x28')](_0x237b('0x55'),_0x15eb1[_0x237b('0x51')]);if(_0x542473&&_0x542473[_0x237b('0x56')]){logger[_0x237b('0xb')](_0x237b('0x57'),_0x237b('0x58'));_0x4c42e0[_0x237b('0x59')]=util[_0x237b('0x28')](_0x237b('0x5a'),_0x15eb1[_0x237b('0x53')],_0x4c42e0['uniqueid'],md5(_0x4c42e0[_0x237b('0x5b')]));}else{_0x4c42e0[_0x237b('0x59')]='';}return getConnection(_0x15eb1)[_0x237b('0x2b')](function(_0x20da33){_0x1ee878=_0x20da33;return getUser(_0x15eb1,_0x1f0d82['name'],_0x1ee878);})[_0x237b('0x2b')](function(_0x17b8b1){_0x359968=_0x17b8b1;logger[_0x237b('0xb')](_0x237b('0x5c'),_0x359968['id']);return getEndUser(_0x15eb1,_0x4c42e0[_0x237b('0x5d')],_0x4c42e0[_0x237b('0x5e')],_0x1ee878);})[_0x237b('0x2b')](function(_0x549e16){_0x7d975=_0x549e16;logger['info']('The\x20Enduser\x20ID\x20is:',_0x7d975['id']);return getTicket(_0x15eb1,_0x359968,_0x7d975,_0x2b4396,_0x4c42e0,_0x2b4396[_0x237b('0x5f')],_0x1ee878,_0x237b('0x60'));})[_0x237b('0x2b')](function(_0x31ad03){_0x360728=_0x31ad03;logger[_0x237b('0xb')](_0x237b('0x61'));logger[_0x237b('0xb')](_0x237b('0x62'),_0x360728['id']);return setRelationship(_0x1ee878,_0x359968,_0x360728,_0x237b('0x63'));})[_0x237b('0x2b')](function(){return setRelationship(_0x1ee878,_0x7d975,_0x360728,_0x237b('0x64'));})['then'](function(){return getServerInfo(_0x1ee878);})[_0x237b('0x2b')](function(_0x1fbba4){var _0x2560c4=parseInt(_0x1fbba4['version'][_0x237b('0x65')](0x0));var _0xc52713=util[_0x237b('0x28')](_0x237b('0x66'),_0x15eb1[_0x237b('0x51')],_0x360728['id']);if(_0x2560c4>0x6){_0xc52713=util['format'](_0x237b('0x67'),_0x15eb1['remoteUri'],_0x360728['id']);}logger[_0x237b('0xb')](_0x237b('0x57'),_0x237b('0x68'));emit(util[_0x237b('0x28')]('user:%s',_0x1f0d82[_0x237b('0xd')]),_0x237b('0x69'),{'uri':_0xc52713});})['catch'](function(_0x2a09f8){logger['error'](_0x237b('0x57'),JSON[_0x237b('0x20')](_0x2a09f8));});};exports[_0x237b('0x6a')]=function(_0x14fe7c,_0x567db8,_0x4f3264,_0x1b0193,_0x1634f0,_0x238464,_0x5cd1ce){var _0x339831,_0x24c234,_0x54e6d7,_0x55faca;_0x238464[_0x237b('0x51')]=intUtil['stripTrailingSlash'](_0x238464[_0x237b('0x51')]);_0x238464[_0x237b('0x53')]=intUtil[_0x237b('0x52')](_0x238464[_0x237b('0x53')]);def[_0x237b('0x54')]=util[_0x237b('0x28')](_0x237b('0x55'),_0x238464[_0x237b('0x51')]);if(_0x5cd1ce&&_0x5cd1ce['recordingFormat']&&_0x5cd1ce['recordingFormat']!=='none'){logger[_0x237b('0xb')]('[OUTBOUND]',_0x237b('0x58'));_0x567db8[_0x237b('0x59')]=util[_0x237b('0x28')](_0x237b('0x5a'),_0x238464['serverUrl'],_0x567db8['uniqueid'],md5(_0x567db8[_0x237b('0x5b')]));}return getConnection(_0x238464)['then'](function(_0x5c6301){_0x55faca=_0x5c6301;return getUser(_0x238464,_0x1b0193[_0x237b('0xd')],_0x55faca);})[_0x237b('0x2b')](function(_0x2fa528){_0x339831=_0x2fa528;logger[_0x237b('0xb')](_0x237b('0x5c'),_0x339831['id']);return getEndUser(_0x238464,_0x567db8['destcalleridname'],_0x567db8[_0x237b('0x6b')],_0x55faca);})['then'](function(_0x5891bb){_0x24c234=_0x5891bb;logger[_0x237b('0xb')](_0x237b('0x6c'),_0x24c234['id']);return getTicket(_0x238464,_0x339831,_0x24c234,_0x4f3264,_0x567db8,_0x4f3264['Fields'],_0x55faca,_0x237b('0x6d'));})[_0x237b('0x2b')](function(_0x3919df){_0x54e6d7=_0x3919df;logger['info'](_0x237b('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x54e6d7['id']);return setRelationship(_0x55faca,_0x339831,_0x54e6d7,'users');})[_0x237b('0x2b')](function(){return setRelationship(_0x55faca,_0x24c234,_0x54e6d7,_0x237b('0x64'));})[_0x237b('0x2b')](function(){return getServerInfo(_0x55faca);})[_0x237b('0x2b')](function(_0x509207){var _0x2255ed=parseInt(_0x509207[_0x237b('0x6e')][_0x237b('0x65')](0x0));var _0x535ebc=util[_0x237b('0x28')](_0x237b('0x66'),_0x238464[_0x237b('0x51')],_0x54e6d7['id']);if(_0x2255ed>0x6){_0x535ebc=util[_0x237b('0x28')](_0x237b('0x67'),_0x238464[_0x237b('0x51')],_0x54e6d7['id']);}logger['info'](_0x237b('0x6f'),_0x237b('0x68'));emit(util[_0x237b('0x28')](_0x237b('0x70'),_0x1b0193[_0x237b('0xd')]),_0x237b('0x69'),{'uri':_0x535ebc});})[_0x237b('0x71')](function(_0x567091){logger['error'](_0x237b('0x6f'),JSON['stringify'](_0x567091));});};exports[_0x237b('0x72')]=function(_0x2f8b7d,_0x51eeea,_0x8ed59a,_0x4cd11c,_0x94ed4e,_0x57c28e){var _0x17c63e,_0x2ecc01,_0x74b571,_0x2968c0;_0x57c28e['remoteUri']=intUtil[_0x237b('0x52')](_0x57c28e['remoteUri']);_0x57c28e['serverUrl']=intUtil['stripTrailingSlash'](_0x57c28e[_0x237b('0x53')]);def[_0x237b('0x54')]=util[_0x237b('0x28')](_0x237b('0x55'),_0x57c28e[_0x237b('0x51')]);if(_0x94ed4e&&_0x94ed4e[_0x237b('0x56')]){logger[_0x237b('0xb')]('['+_0x51eeea['lastevent'][_0x237b('0x73')]()+']',_0x237b('0x58'));_0x51eeea[_0x237b('0x59')]=util[_0x237b('0x28')](_0x237b('0x5a'),_0x57c28e[_0x237b('0x53')],_0x51eeea[_0x237b('0x5b')],md5(_0x51eeea[_0x237b('0x5b')]));}else{_0x51eeea[_0x237b('0x59')]='';}return getConnection(_0x57c28e)['then'](function(_0x4946f8){_0x2968c0=_0x4946f8;if(!_[_0x237b('0x24')](_0x4cd11c)){return getUser(_0x57c28e,_0x4cd11c[_0x237b('0xd')],_0x2968c0);}else{return getUser(_0x57c28e,null,_0x2968c0);}})['then'](function(_0x23030c){_0x17c63e=_0x23030c;logger[_0x237b('0xb')](_0x237b('0x5c'),_0x17c63e['id']);return getEndUser(_0x57c28e,_0x51eeea[_0x237b('0x5d')],_0x51eeea['calleridnum'],_0x2968c0);})['then'](function(_0x3d8d7c){_0x2ecc01=_0x3d8d7c;logger[_0x237b('0xb')](_0x237b('0x6c'),_0x2ecc01['id']);return getTicket(_0x57c28e,_0x17c63e,_0x2ecc01,_0x8ed59a,_0x51eeea,_0x8ed59a[_0x237b('0x5f')],_0x2968c0,_0x237b('0x60'));})[_0x237b('0x2b')](function(_0x3932ba){_0x74b571=_0x3932ba;logger[_0x237b('0xb')](_0x237b('0x61'));logger[_0x237b('0xb')](_0x237b('0x62'),_0x74b571['id']);return setRelationship(_0x2968c0,_0x17c63e,_0x74b571,_0x237b('0x63'));})['then'](function(){return setRelationship(_0x2968c0,_0x2ecc01,_0x74b571,'contacts');})[_0x237b('0x2b')](function(){return getServerInfo(_0x2968c0);})[_0x237b('0x71')](function(_0x153046){logger[_0x237b('0x74')]('['+_0x51eeea[_0x237b('0x75')][_0x237b('0x73')]()+']',JSON[_0x237b('0x20')](_0x153046));});}; \ 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 045accc..f126f26 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 _0x66ac=['sortBy','type','string','push','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyType','variable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x5d98a5,_0x5dec95){var _0x41c80e=function(_0x261882){while(--_0x261882){_0x5d98a5['push'](_0x5d98a5['shift']());}};_0x41c80e(++_0x5dec95);}(_0x66ac,0x1e2));var _0xc66a=function(_0x4d1971,_0x3d027e){_0x4d1971=_0x4d1971-0x0;var _0x2a3d0e=_0x66ac[_0x4d1971];return _0x2a3d0e;};'use strict';var _=require(_0xc66a('0x0'));var util=require(_0xc66a('0x1'));exports[_0xc66a('0x2')]=function(_0xc5e3,_0x4d5dbe,_0x45c559){var _0x8fda14=[];if(_0xc5e3[_0xc66a('0x3')]>0x0){var _0x2f9df8=_[_0xc66a('0x4')](_0xc5e3,['id']);for(var _0x27e023=0x0;_0x27e023<_0x2f9df8['length'];_0x27e023++){var _0x525a81=_0x2f9df8[_0x27e023];if(_0x525a81[_0xc66a('0x5')]===_0xc66a('0x6')){_0x8fda14[_0xc66a('0x7')](_0x525a81['content']);}else if(_0x525a81[_0xc66a('0x5')]==='variable'&&_0x525a81[_0xc66a('0x8')]){_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]&&_0x8fda14[_0xc66a('0x7')](_0x4d5dbe[_0x525a81[_0xc66a('0x8')]][_0xc66a('0x9')]());}else if(_0x525a81[_0xc66a('0x5')]===_0xc66a('0xa')&&_0x525a81[_0xc66a('0xb')]&&_0x525a81['Variable'][_0xc66a('0xc')]){_0x4d5dbe[_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')][_0xc66a('0xd')]()]&&_0x8fda14[_0xc66a('0x7')](_0x4d5dbe[_0x525a81[_0xc66a('0xb')]['name'][_0xc66a('0xd')]()]['toString']());}else if(_0x525a81['type']===_0xc66a('0xe')){if(_0x525a81['keyType']==='string'&&_0x525a81[_0xc66a('0xf')]){_0x8fda14[_0xc66a('0x7')](util[_0xc66a('0x10')](_0xc66a('0x11'),_0x525a81[_0xc66a('0xf')],_0x525a81['keyContent']));}else if(_0x525a81[_0xc66a('0x12')]===_0xc66a('0x13')&&_0x525a81[_0xc66a('0x8')]&&_0x525a81['key']){_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]&&_0x8fda14[_0xc66a('0x7')](util['format'](_0xc66a('0x11'),_0x525a81[_0xc66a('0xf')],_0x4d5dbe[_0x525a81[_0xc66a('0x8')]]));}else if(_0x525a81[_0xc66a('0x12')]===_0xc66a('0xa')&&_0x525a81[_0xc66a('0xb')]&&_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')]&&_0x525a81['key']){_0x4d5dbe[_0x525a81['Variable'][_0xc66a('0xc')][_0xc66a('0xd')]()]&&_0x8fda14['push'](util['format']('%s:\x20%s',_0x525a81[_0xc66a('0xf')],_0x4d5dbe[_0x525a81[_0xc66a('0xb')][_0xc66a('0xc')][_0xc66a('0xd')]()]));}}}}return _0x8fda14[_0xc66a('0x14')](_0x45c559);};exports['stripTrailingSlash']=function(_0x3eeb2b){var _0x177a63=_0x3eeb2b[_0xc66a('0x15')](-0x1);if(_0x177a63==='/'){_0x3eeb2b=_0x3eeb2b[_0xc66a('0x16')](0x0,_0x3eeb2b[_0xc66a('0x17')](_0x177a63));}return _0x3eeb2b;};exports[_0xc66a('0x18')]=function(_0x389ae5){if(!_[_0xc66a('0x19')](_0x389ae5)&&_0x389ae5!==''){var _0x56ed5b=/^(([^<>()\[\]\\.,;:\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 _0x56ed5b[_0xc66a('0x1a')](String(_0x389ae5)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xa77c=['toString','Variable','toLowerCase','name','key','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','validateEmail','isNil','test','lodash','sortBy','length','type','string','push','variable','variableName'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa77c,0xea));var _0xca77=function(_0x317db7,_0x4a5029){_0x317db7=_0x317db7-0x0;var _0x4add37=_0xa77c[_0x317db7];return _0x4add37;};'use strict';var _=require(_0xca77('0x0'));var util=require('util');exports['getString']=function(_0x247cc5,_0xdbc54c,_0x24c4eb){var _0x125c7d=[];if(_0x247cc5['length']>0x0){var _0xc3c2b3=_[_0xca77('0x1')](_0x247cc5,['id']);for(var _0x4ae8ce=0x0;_0x4ae8ce<_0xc3c2b3[_0xca77('0x2')];_0x4ae8ce++){var _0x4abcdb=_0xc3c2b3[_0x4ae8ce];if(_0x4abcdb[_0xca77('0x3')]===_0xca77('0x4')){_0x125c7d[_0xca77('0x5')](_0x4abcdb['content']);}else if(_0x4abcdb[_0xca77('0x3')]===_0xca77('0x6')&&_0x4abcdb[_0xca77('0x7')]){_0xdbc54c[_0x4abcdb[_0xca77('0x7')]]&&_0x125c7d[_0xca77('0x5')](_0xdbc54c[_0x4abcdb[_0xca77('0x7')]][_0xca77('0x8')]());}else if(_0x4abcdb[_0xca77('0x3')]==='customVariable'&&_0x4abcdb[_0xca77('0x9')]&&_0x4abcdb[_0xca77('0x9')]['name']){_0xdbc54c[_0x4abcdb[_0xca77('0x9')]['name'][_0xca77('0xa')]()]&&_0x125c7d['push'](_0xdbc54c[_0x4abcdb[_0xca77('0x9')][_0xca77('0xb')]['toLowerCase']()][_0xca77('0x8')]());}else if(_0x4abcdb[_0xca77('0x3')]==='keyValue'){if(_0x4abcdb['keyType']===_0xca77('0x4')&&_0x4abcdb[_0xca77('0xc')]){_0x125c7d[_0xca77('0x5')](util[_0xca77('0xd')](_0xca77('0xe'),_0x4abcdb[_0xca77('0xc')],_0x4abcdb['keyContent']));}else if(_0x4abcdb['keyType']===_0xca77('0x6')&&_0x4abcdb[_0xca77('0x7')]&&_0x4abcdb[_0xca77('0xc')]){_0xdbc54c[_0x4abcdb[_0xca77('0x7')]]&&_0x125c7d[_0xca77('0x5')](util['format']('%s:\x20%s',_0x4abcdb[_0xca77('0xc')],_0xdbc54c[_0x4abcdb['variableName']]));}else if(_0x4abcdb['keyType']===_0xca77('0xf')&&_0x4abcdb[_0xca77('0x9')]&&_0x4abcdb[_0xca77('0x9')][_0xca77('0xb')]&&_0x4abcdb['key']){_0xdbc54c[_0x4abcdb[_0xca77('0x9')][_0xca77('0xb')][_0xca77('0xa')]()]&&_0x125c7d[_0xca77('0x5')](util[_0xca77('0xd')]('%s:\x20%s',_0x4abcdb[_0xca77('0xc')],_0xdbc54c[_0x4abcdb[_0xca77('0x9')]['name'][_0xca77('0xa')]()]));}}}}return _0x125c7d[_0xca77('0x10')](_0x24c4eb);};exports[_0xca77('0x11')]=function(_0x3a8335){var _0x1fc22e=_0x3a8335[_0xca77('0x12')](-0x1);if(_0x1fc22e==='/'){_0x3a8335=_0x3a8335['substring'](0x0,_0x3a8335['lastIndexOf'](_0x1fc22e));}return _0x3a8335;};exports[_0xca77('0x13')]=function(_0x10bf32){if(!_[_0xca77('0x14')](_0x10bf32)&&_0x10bf32!==''){var _0x18efe9=/^(([^<>()\[\]\\.,;:\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 _0x18efe9[_0xca77('0x15')](String(_0x10bf32)[_0xca77('0xa')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a91d3d3..95eb47a 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0xd8f8ad,_0x2ba482){var _0x2f4dd3=function(_0x1e8d25){while(--_0x1e8d25){_0xd8f8ad['push'](_0xd8f8ad['shift']());}};_0x2f4dd3(++_0x2ba482);}(_0xe706,0xa3));var _0x6e70=function(_0x1d0c7e,_0x40b36c){_0x1d0c7e=_0x1d0c7e-0x0;var _0x30cf02=_0xe706[_0x1d0c7e];return _0x30cf02;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x40bded,_0x6d81e7){var _0x5614a6=function(_0x433826){while(--_0x433826){_0x40bded['push'](_0x40bded['shift']());}};_0x5614a6(++_0x6d81e7);}(_0xe706,0xa3));var _0x6e70=function(_0x198247,_0x491c12){_0x198247=_0x198247-0x0;var _0x2b18bc=_0xe706[_0x198247];return _0x2b18bc;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9ef7b39..c496bf8 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 _0xab7f=['toLowerCase','type','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','trigger:browser:url','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','error','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','map','forEach','includes','string','picklist','nameField','customField'];(function(_0x2bb336,_0x4d2edf){var _0x412f98=function(_0x6aa5c8){while(--_0x6aa5c8){_0x2bb336['push'](_0x2bb336['shift']());}};_0x412f98(++_0x4d2edf);}(_0xab7f,0xa3));var _0xfab7=function(_0x5e674b,_0x2fbc81){_0x5e674b=_0x5e674b-0x0;var _0x414433=_0xab7f[_0x5e674b];return _0x414433;};'use strict';var _=require(_0xfab7('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xfab7('0x1'));var Redis=require(_0xfab7('0x2'));var intUtil=require(_0xfab7('0x3'));var config=require(_0xfab7('0x4'));var logger=require(_0xfab7('0x5'))(_0xfab7('0x6'));config[_0xfab7('0x7')]=_[_0xfab7('0x8')](config[_0xfab7('0x7')],{'host':_0xfab7('0x9'),'port':0x18eb});var io=require(_0xfab7('0xa'))(new Redis(config[_0xfab7('0x7')]));function emit(_0x28426f,_0x305f9d,_0x11f8e0){io['to'](_0x28426f)[_0xfab7('0xb')](_0x305f9d,_0x11f8e0);}var headers={'Content-Type':_0xfab7('0xc'),'Accept':_0xfab7('0xc')};function getTicket(_0x3b3b52,_0x40b460,_0x120413,_0x162e61,_0x38bd8b){logger['info'](_0xfab7('0xd'));return request({'uri':util[_0xfab7('0xe')]('%s/tickets.json',_0x3b3b52[_0xfab7('0xf')]),'method':'POST','body':{'ticket':_[_0xfab7('0x10')]({'requester_id':_0x120413['id'],'submitter_id':_0x40b460?_0x40b460['id']:undefined,'assignee_id':_0x40b460?_0x40b460['id']:undefined,'tags':getTags(_0x162e61[_0xfab7('0x11')],'name'),'subject':intUtil[_0xfab7('0x12')](_0x162e61[_0xfab7('0x13')],_0x38bd8b,'\x20'),'description':intUtil[_0xfab7('0x12')](_0x162e61[_0xfab7('0x14')],_0x38bd8b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x162e61[_0xfab7('0x14')],_0x38bd8b,'\x0a')}},getCustomFields(_0x162e61[_0xfab7('0x15')],_0x38bd8b))}})[_0xfab7('0x16')](function(_0x1549cb){logger[_0xfab7('0x17')]('Ticket\x20created!');return _0x1549cb[_0xfab7('0x18')];});}function getUser(_0x4a6192,_0x19f8fc){if(intUtil[_0xfab7('0x19')](_0x19f8fc)){logger[_0xfab7('0x17')](_0xfab7('0x1a'),_0x19f8fc);return request({'uri':util['format']('%s/search.json',_0x4a6192['remoteUri']),'qs':{'query':util[_0xfab7('0xe')](_0xfab7('0x1b'),_0x19f8fc)}})[_0xfab7('0x16')](function(_0x1cd32e){if(_0x1cd32e[_0xfab7('0x1c')]){logger[_0xfab7('0x17')](_0xfab7('0x1d'));return _[_0xfab7('0x1e')](_0x1cd32e[_0xfab7('0x1f')],{'email':_0x19f8fc,'role':_0xfab7('0x20')});}else{logger['info'](_0xfab7('0x21'));return request({'uri':util[_0xfab7('0xe')]('%s/users/me.json',_0x4a6192[_0xfab7('0xf')])})['then'](function(_0x1e61e4){logger['info'](_0xfab7('0x22'));return _0x1e61e4[_0xfab7('0x23')];});}});}else{logger[_0xfab7('0x17')](_0xfab7('0x21'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x24'),_0x4a6192['remoteUri'])})['then'](function(_0x162d8b){logger['info'](_0xfab7('0x22'));return _0x162d8b[_0xfab7('0x23')];});}}function getEndUser(_0x52ee2d,_0x51bee2,_0x28d1b6){logger[_0xfab7('0x17')](_0xfab7('0x25'),_0x28d1b6);return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x26'),_0x52ee2d[_0xfab7('0xf')]),'qs':{'query':util[_0xfab7('0xe')](_0xfab7('0x27'),_0x28d1b6)}})[_0xfab7('0x16')](function(_0x49c1dc){var _0x4295c9;if(_0x49c1dc[_0xfab7('0x1f')][_0xfab7('0x28')]){_0x49c1dc[_0xfab7('0x1f')]=_[_0xfab7('0x29')](_0x49c1dc[_0xfab7('0x1f')],{'suspended':![],'role':_0xfab7('0x2a')});if(_0x49c1dc[_0xfab7('0x1f')][_0xfab7('0x28')]){_0x4295c9=_[_0xfab7('0x2b')](_0x49c1dc[_0xfab7('0x1f')]);}}if(_0x4295c9){logger[_0xfab7('0x17')](_0xfab7('0x2c'));return _0x4295c9;}else{logger[_0xfab7('0x17')](_0xfab7('0x2d'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x2e'),_0x52ee2d[_0xfab7('0xf')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xfab7('0xe')]('Caller\x20-\x20%s',_0x51bee2||_0x28d1b6),'phone':_0x28d1b6}}})[_0xfab7('0x16')](function(_0x1d5bff){logger[_0xfab7('0x17')](_0xfab7('0x2f'));return _0x1d5bff[_0xfab7('0x23')];});}});}function getAuth(_0x313a8e){var _0x111cac;if(_0x313a8e[_0xfab7('0x30')]==='password'){_0x111cac=util[_0xfab7('0xe')](_0xfab7('0x31'),_0x313a8e[_0xfab7('0x32')],_0x313a8e['password']);}else if(_0x313a8e['authType']===_0xfab7('0x33')){_0x111cac=util[_0xfab7('0xe')](_0xfab7('0x34'),_0x313a8e['username'],_0x313a8e['token']);}return util[_0xfab7('0xe')](_0xfab7('0x35'),new Buffer(_0x111cac)[_0xfab7('0x36')](_0xfab7('0x37')));}function request(_0x1df61c){logger[_0xfab7('0x38')]('[HTTP]',JSON[_0xfab7('0x39')](_0x1df61c));return rp(_[_0xfab7('0x8')](_0x1df61c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xe94aa6,_0x13703d){var _0x4eb8f0=[];if(_0xe94aa6&&_0xe94aa6['length']>0x0){_0x4eb8f0=_[_0xfab7('0x3a')](_0xe94aa6,_0x13703d);}return _0x4eb8f0;}function getCustomFields(_0x3441d1,_0x655214){var _0x186641=[];var _0x3bb792={'custom_fields':[]};if(_0x3441d1[_0xfab7('0x28')]>0x0){_[_0xfab7('0x3b')](_0x3441d1,function(_0xe26911){if(_[_0xfab7('0x3c')]([_0xfab7('0x3d'),_0xfab7('0x3e')],_0xe26911['type'])&&_0xe26911[_0xfab7('0x3f')]&&!_0xe26911[_0xfab7('0x40')]){_0x3bb792[_0xe26911[_0xfab7('0x3f')][_0xfab7('0x41')]()]=_0xe26911['content'][_0xfab7('0x36')]();}else if(_[_0xfab7('0x3c')]([_0xfab7('0x3d'),'picklist'],_0xe26911[_0xfab7('0x42')])&&_0xe26911[_0xfab7('0x43')]&&_0xe26911[_0xfab7('0x40')]){_0x3bb792[_0xfab7('0x44')][_0xfab7('0x45')]({'id':_0xe26911['idField'],'value':_0xe26911[_0xfab7('0x46')]['toString']()});}else if(_0xe26911[_0xfab7('0x42')]===_0xfab7('0x47')&&_0xe26911[_0xfab7('0x48')]&&_0xe26911['idField']&&_0xe26911[_0xfab7('0x40')]){_0x655214[_0xe26911['variableName']]&&_0x3bb792['custom_fields']['push']({'id':_0xe26911[_0xfab7('0x43')],'value':_0x655214[_0xe26911[_0xfab7('0x48')]][_0xfab7('0x36')]()});}else if(_0xe26911['type']===_0xfab7('0x49')&&_0xe26911['Variable']&&_0xe26911[_0xfab7('0x4a')][_0xfab7('0x4b')]&&_0xe26911['idField']&&_0xe26911[_0xfab7('0x40')]){_0x655214[_0xe26911[_0xfab7('0x4a')][_0xfab7('0x4b')][_0xfab7('0x41')]()]&&_0x3bb792[_0xfab7('0x44')][_0xfab7('0x45')]({'id':_0xe26911[_0xfab7('0x43')],'value':_0x655214[_0xe26911[_0xfab7('0x4a')]['name'][_0xfab7('0x41')]()]['toString']()});}});}return _0x3bb792;}exports[_0xfab7('0x4c')]=function(_0x575cc7,_0x2b2cdf,_0x3c3da9,_0x93e7e3,_0x529592,_0x1e6762){var _0x47ddef,_0x102cfa;_0x1e6762['remoteUri']=intUtil[_0xfab7('0x4d')](_0x1e6762[_0xfab7('0xf')]);_0x1e6762[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x1e6762[_0xfab7('0x4e')]);if(_0x529592&&_0x529592[_0xfab7('0x4f')]){logger[_0xfab7('0x17')]('[QUEUE]',_0xfab7('0x50'));_0x2b2cdf[_0xfab7('0x51')]=util['format'](_0xfab7('0x52'),_0x1e6762[_0xfab7('0x4e')],_0x2b2cdf['uniqueid'],md5(_0x2b2cdf[_0xfab7('0x53')]));}else{_0x2b2cdf[_0xfab7('0x51')]='';}headers['Authorization']=getAuth(_0x1e6762);return getUser(_0x1e6762,_0x93e7e3[_0xfab7('0x54')])[_0xfab7('0x16')](function(_0x22f7d2){_0x47ddef=_0x22f7d2;logger['info'](_0xfab7('0x55'),_0x47ddef['id']);return getEndUser(_0x1e6762,_0x2b2cdf[_0xfab7('0x56')],_0x2b2cdf[_0xfab7('0x57')]);})['then'](function(_0x239329){_0x102cfa=_0x239329;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x102cfa['id']);return getTicket(_0x1e6762,_0x47ddef,_0x102cfa,_0x3c3da9,_0x2b2cdf);})[_0xfab7('0x16')](function(_0x35a154){if(_0x35a154){logger[_0xfab7('0x17')](_0xfab7('0x59'),_0x35a154['id']);switch(_0x1e6762[_0xfab7('0x42')]){case'integrationTab':logger[_0xfab7('0x17')](_0xfab7('0x5a'),_0xfab7('0x5b'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x5c'),_0x1e6762[_0xfab7('0xf')],_0x47ddef['id'],_0x35a154['id']),'method':_0xfab7('0x5d')});case'newTab':logger[_0xfab7('0x17')](_0xfab7('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfab7('0xe')]('user:%s',_0x93e7e3[_0xfab7('0x4b')]),_0xfab7('0x5e'),{'uri':util['format'](_0xfab7('0x5f'),_0x1e6762[_0xfab7('0xf')][_0xfab7('0x60')]('/api/v2',''),_0x35a154['id'])});break;default:logger['error']('[QUEUE]',_0xfab7('0x61'));}}})['catch'](function(_0x1a8aab){logger[_0xfab7('0x62')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfab7('0x63')](_0x1a8aab,{'showHidden':!![],'depth':null}));});};exports[_0xfab7('0x64')]=function(_0x55de0d,_0x49e067,_0x501f99,_0x2a4fc8,_0x4294e3,_0x5233db,_0x324f96){var _0x613016,_0x3f961a;_0x5233db[_0xfab7('0xf')]=intUtil['stripTrailingSlash'](_0x5233db[_0xfab7('0xf')]);_0x5233db[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x5233db[_0xfab7('0x4e')]);if(_0x324f96&&_0x324f96['recordingFormat']&&_0x324f96[_0xfab7('0x65')]!=='none'){logger[_0xfab7('0x17')](_0xfab7('0x66'),_0xfab7('0x50'));_0x49e067[_0xfab7('0x51')]=util[_0xfab7('0xe')](_0xfab7('0x52'),_0x5233db[_0xfab7('0x4e')],_0x49e067['uniqueid'],md5(_0x49e067[_0xfab7('0x53')]));}headers[_0xfab7('0x67')]=getAuth(_0x5233db);return getUser(_0x5233db,_0x2a4fc8['email'])['then'](function(_0x4750c7){_0x613016=_0x4750c7;logger[_0xfab7('0x17')](_0xfab7('0x55'),_0x613016['id']);return getEndUser(_0x5233db,_0x49e067[_0xfab7('0x68')],_0x49e067[_0xfab7('0x69')]);})[_0xfab7('0x16')](function(_0x3c0701){_0x3f961a=_0x3c0701;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x3f961a['id']);return getTicket(_0x5233db,_0x613016,_0x3f961a,_0x501f99,_0x49e067);})[_0xfab7('0x16')](function(_0x58b0cb){if(_0x58b0cb){logger['info'](_0xfab7('0x59'),_0x58b0cb['id']);switch(_0x5233db['type']){case _0xfab7('0x6a'):logger[_0xfab7('0x17')](_0xfab7('0x66'),_0xfab7('0x5b'));return request({'uri':util[_0xfab7('0xe')](_0xfab7('0x5c'),_0x5233db[_0xfab7('0xf')],_0x613016['id'],_0x58b0cb['id']),'method':_0xfab7('0x5d')});case _0xfab7('0x6b'):logger['info'](_0xfab7('0x66'),_0xfab7('0x6c'));emit(util[_0xfab7('0xe')]('user:%s',_0x2a4fc8['name']),_0xfab7('0x5e'),{'uri':util['format']('%s/agent/tickets/%s',_0x5233db[_0xfab7('0xf')][_0xfab7('0x60')](_0xfab7('0x6d'),''),_0x58b0cb['id'])});break;default:logger['error']('[OUTBOUND]',_0xfab7('0x61'));}}})['catch'](function(_0x29f8bd){logger[_0xfab7('0x62')](_0xfab7('0x6e'),util[_0xfab7('0x63')](_0x29f8bd,{'showHidden':!![],'depth':null}));});};exports[_0xfab7('0x6f')]=function(_0x15fc06,_0x28d175,_0x276785,_0x56b9ff,_0x2b447d,_0x33a776){var _0x413e8e,_0x3a2ce1;_0x33a776[_0xfab7('0xf')]=intUtil[_0xfab7('0x4d')](_0x33a776['remoteUri']);_0x33a776[_0xfab7('0x4e')]=intUtil[_0xfab7('0x4d')](_0x33a776[_0xfab7('0x4e')]);if(_0x2b447d&&_0x2b447d[_0xfab7('0x4f')]){logger[_0xfab7('0x17')]('['+_0x28d175[_0xfab7('0x70')]['toUpperCase']()+']',_0xfab7('0x50'));_0x28d175[_0xfab7('0x51')]=util[_0xfab7('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33a776[_0xfab7('0x4e')],_0x28d175[_0xfab7('0x53')],md5(_0x28d175['uniqueid']));}else{_0x28d175['recordingURL']='';}headers[_0xfab7('0x67')]=getAuth(_0x33a776);return getUser(_0x33a776)[_0xfab7('0x16')](function(_0x5b2c06){_0x413e8e=_0x5b2c06;logger['info'](_0xfab7('0x55'),_0x413e8e['id']);return getEndUser(_0x33a776,_0x28d175['calleridname'],_0x28d175[_0xfab7('0x57')]);})[_0xfab7('0x16')](function(_0x1e4c5b){_0x3a2ce1=_0x1e4c5b;logger[_0xfab7('0x17')](_0xfab7('0x58'),_0x3a2ce1['id']);return getTicket(_0x33a776,_0x413e8e,_0x3a2ce1,_0x276785,_0x28d175);})[_0xfab7('0x16')](function(_0x396b74){if(_0x396b74){logger['info'](_0xfab7('0x59'),_0x396b74['id']);}})['catch'](function(_0x5d8bdb){logger[_0xfab7('0x62')]('['+_0x28d175['lastevent'][_0xfab7('0x71')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x5d8bdb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe043=['remoteUri','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','debug','[HTTP]','stringify','map','forEach','picklist','type','toLowerCase','content','toString','includes','idField','customField','custom_fields','push','variable','variableName','Variable','name','serverUrl','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','inspect','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','recordingURL','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json'];(function(_0x1c58ec,_0x19161d){var _0xb80bf8=function(_0x35b860){while(--_0x35b860){_0x1c58ec['push'](_0x1c58ec['shift']());}};_0xb80bf8(++_0x19161d);}(_0xe043,0xb4));var _0x3e04=function(_0x463bd4,_0x1ea491){_0x463bd4=_0x463bd4-0x0;var _0x1780e3=_0xe043[_0x463bd4];return _0x1780e3;};'use strict';var _=require(_0x3e04('0x0'));var rp=require(_0x3e04('0x1'));var md5=require(_0x3e04('0x2'));var util=require(_0x3e04('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3e04('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3e04('0x5'))(_0x3e04('0x6'));config[_0x3e04('0x7')]=_[_0x3e04('0x8')](config[_0x3e04('0x7')],{'host':_0x3e04('0x9'),'port':0x18eb});var io=require(_0x3e04('0xa'))(new Redis(config[_0x3e04('0x7')]));function emit(_0x557148,_0x328e32,_0x26fa31){io['to'](_0x557148)[_0x3e04('0xb')](_0x328e32,_0x26fa31);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x318ee0,_0x18632f,_0x17fc37,_0x4d3e12,_0x2a3856){logger[_0x3e04('0xc')](_0x3e04('0xd'));return request({'uri':util[_0x3e04('0xe')](_0x3e04('0xf'),_0x318ee0['remoteUri']),'method':_0x3e04('0x10'),'body':{'ticket':_[_0x3e04('0x11')]({'requester_id':_0x17fc37['id'],'submitter_id':_0x18632f?_0x18632f['id']:undefined,'assignee_id':_0x18632f?_0x18632f['id']:undefined,'tags':getTags(_0x4d3e12[_0x3e04('0x12')],'name'),'subject':intUtil['getString'](_0x4d3e12[_0x3e04('0x13')],_0x2a3856,'\x20'),'description':intUtil[_0x3e04('0x14')](_0x4d3e12['Descriptions'],_0x2a3856,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3e04('0x14')](_0x4d3e12[_0x3e04('0x15')],_0x2a3856,'\x0a')}},getCustomFields(_0x4d3e12['Fields'],_0x2a3856))}})[_0x3e04('0x16')](function(_0x382404){logger[_0x3e04('0xc')](_0x3e04('0x17'));return _0x382404[_0x3e04('0x18')];});}function getUser(_0x20fcf4,_0x23ed15){if(intUtil[_0x3e04('0x19')](_0x23ed15)){logger[_0x3e04('0xc')](_0x3e04('0x1a'),_0x23ed15);return request({'uri':util['format']('%s/search.json',_0x20fcf4['remoteUri']),'qs':{'query':util[_0x3e04('0xe')](_0x3e04('0x1b'),_0x23ed15)}})[_0x3e04('0x16')](function(_0x4c6ca0){if(_0x4c6ca0['count']){logger['info']('Agent\x20found!');return _['find'](_0x4c6ca0[_0x3e04('0x1c')],{'email':_0x23ed15,'role':_0x3e04('0x1d')});}else{logger['info'](_0x3e04('0x1e'));return request({'uri':util['format'](_0x3e04('0x1f'),_0x20fcf4[_0x3e04('0x20')])})[_0x3e04('0x16')](function(_0x1db2fc){logger[_0x3e04('0xc')](_0x3e04('0x21'));return _0x1db2fc[_0x3e04('0x22')];});}});}else{logger[_0x3e04('0xc')](_0x3e04('0x1e'));return request({'uri':util[_0x3e04('0xe')](_0x3e04('0x1f'),_0x20fcf4[_0x3e04('0x20')])})[_0x3e04('0x16')](function(_0x5a9802){logger[_0x3e04('0xc')](_0x3e04('0x21'));return _0x5a9802[_0x3e04('0x22')];});}}function getEndUser(_0x279955,_0x804203,_0x2633e0){logger[_0x3e04('0xc')]('Searching\x20enduser\x20with\x20phone',_0x2633e0);return request({'uri':util['format'](_0x3e04('0x23'),_0x279955[_0x3e04('0x20')]),'qs':{'query':util['format'](_0x3e04('0x24'),_0x2633e0)}})[_0x3e04('0x16')](function(_0x3f5a0f){var _0x4ada39;if(_0x3f5a0f[_0x3e04('0x1c')][_0x3e04('0x25')]){_0x3f5a0f['results']=_['filter'](_0x3f5a0f[_0x3e04('0x1c')],{'suspended':![],'role':_0x3e04('0x26')});if(_0x3f5a0f['results'][_0x3e04('0x25')]){_0x4ada39=_[_0x3e04('0x27')](_0x3f5a0f['results']);}}if(_0x4ada39){logger[_0x3e04('0xc')](_0x3e04('0x28'));return _0x4ada39;}else{logger[_0x3e04('0xc')](_0x3e04('0x29'));return request({'uri':util['format'](_0x3e04('0x2a'),_0x279955[_0x3e04('0x20')]),'method':_0x3e04('0x10'),'body':{'user':{'role':_0x3e04('0x26'),'name':util[_0x3e04('0xe')]('Caller\x20-\x20%s',_0x804203||_0x2633e0),'phone':_0x2633e0}}})[_0x3e04('0x16')](function(_0xe100c2){logger[_0x3e04('0xc')](_0x3e04('0x2b'));return _0xe100c2[_0x3e04('0x22')];});}});}function getAuth(_0x4f825f){var _0x1b4bbd;if(_0x4f825f[_0x3e04('0x2c')]===_0x3e04('0x2d')){_0x1b4bbd=util['format'](_0x3e04('0x2e'),_0x4f825f[_0x3e04('0x2f')],_0x4f825f[_0x3e04('0x2d')]);}else if(_0x4f825f[_0x3e04('0x2c')]==='token'){_0x1b4bbd=util['format'](_0x3e04('0x30'),_0x4f825f[_0x3e04('0x2f')],_0x4f825f[_0x3e04('0x31')]);}return util[_0x3e04('0xe')]('Basic\x20%s',new Buffer(_0x1b4bbd)['toString']('base64'));}function request(_0x27f17b){logger[_0x3e04('0x32')](_0x3e04('0x33'),JSON[_0x3e04('0x34')](_0x27f17b));return rp(_[_0x3e04('0x8')](_0x27f17b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5c6cd0,_0x1ef18f){var _0x19f59c=[];if(_0x5c6cd0&&_0x5c6cd0['length']>0x0){_0x19f59c=_[_0x3e04('0x35')](_0x5c6cd0,_0x1ef18f);}return _0x19f59c;}function getCustomFields(_0x131e1b,_0x5b8a82){var _0x553aca=[];var _0xa1e3fc={'custom_fields':[]};if(_0x131e1b[_0x3e04('0x25')]>0x0){_[_0x3e04('0x36')](_0x131e1b,function(_0x57d6d5){if(_['includes'](['string',_0x3e04('0x37')],_0x57d6d5[_0x3e04('0x38')])&&_0x57d6d5['nameField']&&!_0x57d6d5['customField']){_0xa1e3fc[_0x57d6d5['nameField'][_0x3e04('0x39')]()]=_0x57d6d5[_0x3e04('0x3a')][_0x3e04('0x3b')]();}else if(_[_0x3e04('0x3c')](['string',_0x3e04('0x37')],_0x57d6d5[_0x3e04('0x38')])&&_0x57d6d5[_0x3e04('0x3d')]&&_0x57d6d5[_0x3e04('0x3e')]){_0xa1e3fc[_0x3e04('0x3f')][_0x3e04('0x40')]({'id':_0x57d6d5[_0x3e04('0x3d')],'value':_0x57d6d5[_0x3e04('0x3a')][_0x3e04('0x3b')]()});}else if(_0x57d6d5[_0x3e04('0x38')]===_0x3e04('0x41')&&_0x57d6d5['variableName']&&_0x57d6d5[_0x3e04('0x3d')]&&_0x57d6d5[_0x3e04('0x3e')]){_0x5b8a82[_0x57d6d5[_0x3e04('0x42')]]&&_0xa1e3fc['custom_fields']['push']({'id':_0x57d6d5[_0x3e04('0x3d')],'value':_0x5b8a82[_0x57d6d5[_0x3e04('0x42')]][_0x3e04('0x3b')]()});}else if(_0x57d6d5[_0x3e04('0x38')]==='customVariable'&&_0x57d6d5[_0x3e04('0x43')]&&_0x57d6d5['Variable'][_0x3e04('0x44')]&&_0x57d6d5[_0x3e04('0x3d')]&&_0x57d6d5[_0x3e04('0x3e')]){_0x5b8a82[_0x57d6d5[_0x3e04('0x43')][_0x3e04('0x44')][_0x3e04('0x39')]()]&&_0xa1e3fc[_0x3e04('0x3f')][_0x3e04('0x40')]({'id':_0x57d6d5[_0x3e04('0x3d')],'value':_0x5b8a82[_0x57d6d5[_0x3e04('0x43')][_0x3e04('0x44')]['toLowerCase']()][_0x3e04('0x3b')]()});}});}return _0xa1e3fc;}exports['queue']=function(_0x269bb8,_0x51065f,_0x3204ce,_0x5b0c19,_0x13f9b8,_0x70d6a4){var _0x5be4ee,_0x22bbf7;_0x70d6a4[_0x3e04('0x20')]=intUtil['stripTrailingSlash'](_0x70d6a4[_0x3e04('0x20')]);_0x70d6a4[_0x3e04('0x45')]=intUtil[_0x3e04('0x46')](_0x70d6a4['serverUrl']);if(_0x13f9b8&&_0x13f9b8[_0x3e04('0x47')]){logger[_0x3e04('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x51065f['recordingURL']=util[_0x3e04('0xe')](_0x3e04('0x48'),_0x70d6a4[_0x3e04('0x45')],_0x51065f['uniqueid'],md5(_0x51065f['uniqueid']));}else{_0x51065f['recordingURL']='';}headers[_0x3e04('0x49')]=getAuth(_0x70d6a4);return getUser(_0x70d6a4,_0x5b0c19[_0x3e04('0x4a')])[_0x3e04('0x16')](function(_0x3cf6f3){_0x5be4ee=_0x3cf6f3;logger[_0x3e04('0xc')](_0x3e04('0x4b'),_0x5be4ee['id']);return getEndUser(_0x70d6a4,_0x51065f[_0x3e04('0x4c')],_0x51065f[_0x3e04('0x4d')]);})['then'](function(_0x3b95c7){_0x22bbf7=_0x3b95c7;logger[_0x3e04('0xc')]('The\x20Enduser\x20ID\x20is:',_0x22bbf7['id']);return getTicket(_0x70d6a4,_0x5be4ee,_0x22bbf7,_0x3204ce,_0x51065f);})[_0x3e04('0x16')](function(_0x1f6f7e){if(_0x1f6f7e){logger[_0x3e04('0xc')](_0x3e04('0x4e'),_0x1f6f7e['id']);switch(_0x70d6a4[_0x3e04('0x38')]){case _0x3e04('0x4f'):logger[_0x3e04('0xc')](_0x3e04('0x50'),_0x3e04('0x51'));return request({'uri':util[_0x3e04('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x70d6a4[_0x3e04('0x20')],_0x5be4ee['id'],_0x1f6f7e['id']),'method':_0x3e04('0x10')});case _0x3e04('0x52'):logger[_0x3e04('0xc')](_0x3e04('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3e04('0xe')](_0x3e04('0x53'),_0x5b0c19[_0x3e04('0x44')]),_0x3e04('0x54'),{'uri':util[_0x3e04('0xe')](_0x3e04('0x55'),_0x70d6a4['remoteUri'][_0x3e04('0x56')](_0x3e04('0x57'),''),_0x1f6f7e['id'])});break;default:logger[_0x3e04('0x58')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3e04('0x59')](function(_0x5c3db0){logger[_0x3e04('0x58')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x3e04('0x5a')](_0x5c3db0,{'showHidden':!![],'depth':null}));});};exports[_0x3e04('0x5b')]=function(_0x4ce1bf,_0x479db4,_0x518dbe,_0x234a2d,_0x141e6e,_0xa828e0,_0xd4b848){var _0x2948c0,_0x2a5f51;_0xa828e0['remoteUri']=intUtil[_0x3e04('0x46')](_0xa828e0[_0x3e04('0x20')]);_0xa828e0[_0x3e04('0x45')]=intUtil['stripTrailingSlash'](_0xa828e0[_0x3e04('0x45')]);if(_0xd4b848&&_0xd4b848['recordingFormat']&&_0xd4b848['recordingFormat']!==_0x3e04('0x5c')){logger[_0x3e04('0xc')](_0x3e04('0x5d'),_0x3e04('0x5e'));_0x479db4['recordingURL']=util[_0x3e04('0xe')](_0x3e04('0x48'),_0xa828e0[_0x3e04('0x45')],_0x479db4[_0x3e04('0x5f')],md5(_0x479db4[_0x3e04('0x5f')]));}headers[_0x3e04('0x49')]=getAuth(_0xa828e0);return getUser(_0xa828e0,_0x234a2d['email'])[_0x3e04('0x16')](function(_0x31a3f6){_0x2948c0=_0x31a3f6;logger[_0x3e04('0xc')](_0x3e04('0x4b'),_0x2948c0['id']);return getEndUser(_0xa828e0,_0x479db4[_0x3e04('0x60')],_0x479db4[_0x3e04('0x61')]);})['then'](function(_0x30a49b){_0x2a5f51=_0x30a49b;logger['info'](_0x3e04('0x62'),_0x2a5f51['id']);return getTicket(_0xa828e0,_0x2948c0,_0x2a5f51,_0x518dbe,_0x479db4);})[_0x3e04('0x16')](function(_0x2d02c7){if(_0x2d02c7){logger[_0x3e04('0xc')](_0x3e04('0x4e'),_0x2d02c7['id']);switch(_0xa828e0[_0x3e04('0x38')]){case _0x3e04('0x4f'):logger[_0x3e04('0xc')]('[OUTBOUND]',_0x3e04('0x51'));return request({'uri':util['format'](_0x3e04('0x63'),_0xa828e0[_0x3e04('0x20')],_0x2948c0['id'],_0x2d02c7['id']),'method':_0x3e04('0x10')});case'newTab':logger[_0x3e04('0xc')](_0x3e04('0x5d'),_0x3e04('0x64'));emit(util['format'](_0x3e04('0x53'),_0x234a2d[_0x3e04('0x44')]),_0x3e04('0x54'),{'uri':util[_0x3e04('0xe')](_0x3e04('0x55'),_0xa828e0[_0x3e04('0x20')][_0x3e04('0x56')]('/api/v2',''),_0x2d02c7['id'])});break;default:logger['error'](_0x3e04('0x5d'),_0x3e04('0x65'));}}})['catch'](function(_0x1e583f){logger['error'](_0x3e04('0x66'),util['inspect'](_0x1e583f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4579df,_0x2a493a,_0x3e642b,_0x250f79,_0xdf1b42,_0x17e617){var _0x59e92f,_0x4259e6;_0x17e617['remoteUri']=intUtil['stripTrailingSlash'](_0x17e617['remoteUri']);_0x17e617[_0x3e04('0x45')]=intUtil[_0x3e04('0x46')](_0x17e617[_0x3e04('0x45')]);if(_0xdf1b42&&_0xdf1b42[_0x3e04('0x47')]){logger[_0x3e04('0xc')]('['+_0x2a493a[_0x3e04('0x67')]['toUpperCase']()+']',_0x3e04('0x5e'));_0x2a493a[_0x3e04('0x68')]=util[_0x3e04('0xe')](_0x3e04('0x48'),_0x17e617['serverUrl'],_0x2a493a['uniqueid'],md5(_0x2a493a[_0x3e04('0x5f')]));}else{_0x2a493a[_0x3e04('0x68')]='';}headers[_0x3e04('0x49')]=getAuth(_0x17e617);return getUser(_0x17e617)[_0x3e04('0x16')](function(_0x1dfc01){_0x59e92f=_0x1dfc01;logger['info'](_0x3e04('0x4b'),_0x59e92f['id']);return getEndUser(_0x17e617,_0x2a493a[_0x3e04('0x4c')],_0x2a493a[_0x3e04('0x4d')]);})['then'](function(_0x2773ea){_0x4259e6=_0x2773ea;logger['info'](_0x3e04('0x62'),_0x4259e6['id']);return getTicket(_0x17e617,_0x59e92f,_0x4259e6,_0x3e642b,_0x2a493a);})[_0x3e04('0x16')](function(_0x1bade4){if(_0x1bade4){logger[_0x3e04('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1bade4['id']);}})[_0x3e04('0x59')](function(_0x117010){logger[_0x3e04('0x58')]('['+_0x2a493a[_0x3e04('0x67')][_0x3e04('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x117010,{'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 fc3ea6e..aacd8ff 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 _0xb81d=['uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','recordingURL','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','info','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','role','first_name','last_name','code','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','https://www.zohoapis.','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/'];(function(_0x18829e,_0x41e22c){var _0x229790=function(_0x5d7771){while(--_0x5d7771){_0x18829e['push'](_0x18829e['shift']());}};_0x229790(++_0x41e22c);}(_0xb81d,0xb4));var _0xdb81=function(_0x492012,_0x32ae87){_0x492012=_0x492012-0x0;var _0x2a75b6=_0xb81d[_0x492012];return _0x2a75b6;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xdb81('0x0'));var util=require(_0xdb81('0x1'));var intUtil=require(_0xdb81('0x2'));var moment=require('moment');var Redis=require(_0xdb81('0x3'));var BPromise=require(_0xdb81('0x4'));var config=require(_0xdb81('0x5'));var logger=require(_0xdb81('0x6'))(_0xdb81('0x7'));config[_0xdb81('0x8')]=_[_0xdb81('0x9')](config['redis'],{'host':_0xdb81('0xa'),'port':0x18eb});var io=require(_0xdb81('0xb'))(new Redis(config[_0xdb81('0x8')]));function emit(_0x24c045,_0x700360,_0x18c4f0){io['to'](_0x24c045)[_0xdb81('0xc')](_0x700360,_0x18c4f0);}function request(_0x1db3a1){logger['debug'](_0xdb81('0xd'),JSON[_0xdb81('0xe')](_0x1db3a1));return rp(_0x1db3a1);}function getCustomFields(_0x8fe01b,_0xafa4b3){var _0x5cf70d={};if(_0x8fe01b[_0xdb81('0xf')]>0x0){_[_0xdb81('0x10')](_0x8fe01b,function(_0x559076){if(_['includes']([_0xdb81('0x11'),_0xdb81('0x12')],_0x559076['type'])&&_0x559076[_0xdb81('0x13')]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0x559076[_0xdb81('0x14')][_0xdb81('0x15')]();}else if(_0x559076[_0xdb81('0x16')]===_0xdb81('0x17')&&_0x559076[_0xdb81('0x18')]&&_0x559076[_0xdb81('0x13')]&&_0xafa4b3[_0x559076[_0xdb81('0x18')]]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0xafa4b3[_0x559076[_0xdb81('0x18')]][_0xdb81('0x15')]();}else if(_0x559076[_0xdb81('0x16')]===_0xdb81('0x19')&&_0x559076[_0xdb81('0x1a')]&&_0x559076[_0xdb81('0x1a')][_0xdb81('0x1b')]&&_0x559076['idField']&&_0xafa4b3[_0x559076['Variable'][_0xdb81('0x1b')][_0xdb81('0x1c')]()]){_0x5cf70d[_0x559076[_0xdb81('0x13')]]=_0xafa4b3[_0x559076['Variable']['name'][_0xdb81('0x1c')]()][_0xdb81('0x15')]();}});}return _0x5cf70d;}function getName(_0x1ba4c2){if(_0x1ba4c2['indexOf']('\x20')>0x0){var _0x2cd492=_0x1ba4c2[_0xdb81('0x1d')](/ (.+)/);if(_0x2cd492[0x1]){return _0x2cd492;}}return[_0x1ba4c2,_0x1ba4c2];}var accountsTokens={};function getAccessToken(_0x6db7f3){return new Promise(function(_0x2be4c8,_0x12a0f7){if(!_[_0xdb81('0x1e')](accountsTokens[_0x6db7f3['id']])&&!_[_0xdb81('0x1e')](accountsTokens[_0x6db7f3['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x6db7f3['id']][_0xdb81('0x1f')])){_0x2be4c8(accountsTokens[_0x6db7f3['id']][_0xdb81('0x20')]);}}var _0x370739;switch(_0x6db7f3[_0xdb81('0x21')]){case'US':_0x370739=_0xdb81('0x22');break;case'AU':_0x370739=_0xdb81('0x23');break;case'EU':_0x370739='https://accounts.zoho.eu';break;case'IN':_0x370739=_0xdb81('0x24');break;case'CN':_0x370739=_0xdb81('0x25');break;default:_0x370739=_0xdb81('0x26');break;}var _0x1a97ba={'method':_0xdb81('0x27'),'uri':_0x370739+_0xdb81('0x28'),'qs':{'refresh_token':_0x6db7f3['refreshToken'],'client_id':_0x6db7f3[_0xdb81('0x29')],'client_secret':_0x6db7f3[_0xdb81('0x2a')],'grant_type':_0xdb81('0x2b')},'json':!![]};return rp(_0x1a97ba)[_0xdb81('0x2c')](function(_0x2568ef){accountsTokens[_0x6db7f3['id']]={'access_token':_0x2568ef[_0xdb81('0x20')],'expires_in':moment()[_0xdb81('0x2d')](_0x2568ef[_0xdb81('0x1f')],'seconds')};_0x2be4c8(_0x2568ef[_0xdb81('0x20')]);})[_0xdb81('0x2e')](function(_0x3ab95f){logger[_0xdb81('0x2f')](_0xdb81('0x30'),_0x3ab95f[_0xdb81('0x31')]);_0x12a0f7(_0x3ab95f);});});}function getUser(_0x4bdb21,_0x12b494,_0x3abf84,_0xaece3e){logger['info'](_0xdb81('0x32'));return request({'method':'GET','uri':util[_0xdb81('0x33')](_0xdb81('0x34'),_0x12b494),'qs':{'type':_0xdb81('0x35')},'headers':{'Authorization':_0xdb81('0x36')+_0x4bdb21},'json':!![]})['then'](function(_0x3de5b4){if(_0x3de5b4[_0xdb81('0x37')]){var _0x37b621=-0x1;if(_['isArrayLikeObject'](_0x3de5b4['users'])){if(!_[_0xdb81('0x1e')](_0xaece3e)){_0x37b621=_['findIndex'](_0x3de5b4['users'],function(_0x4a7f49){return _0x4a7f49['email']===_0xaece3e;});}if(_0x37b621>=0x0){logger[_0xdb81('0x38')](_0xdb81('0x39'));}else{logger[_0xdb81('0x38')](_0xdb81('0x3a'));_0x37b621=_['findIndex'](_0x3de5b4['users'],function(_0xa8d91e){return _0xa8d91e['profile'][_0xdb81('0x1b')]==='Administrator';});}return _0x3de5b4[_0xdb81('0x37')][_0x37b621];}else{if(_0x3de5b4[_0xdb81('0x3b')][_0xdb81('0x3c')][_0xdb81('0x1b')]===_0xdb81('0x3d')){logger[_0xdb81('0x38')]('Using\x20the\x20admin\x20account!');user=_0x3de5b4[_0xdb81('0x3b')];return user;}else{logger[_0xdb81('0x2f')](_0xdb81('0x3e'),JSON[_0xdb81('0xe')](_0x3de5b4));throw new Error(_0xdb81('0x3f')+JSON['stringify'](_0x3de5b4));}}}else{logger['error'](_0xdb81('0x3e'),JSON['stringify'](_0x3de5b4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdb81('0xe')](_0x3de5b4));}})[_0xdb81('0x2e')](function(_0xc2e97d){console['error'](_0xc2e97d);});}function getZohoUser(_0x1b0c1d,_0x2c86d3){return new BPromise(function(_0xf7b59d,_0xe2a94){request(_0x1b0c1d)[_0xdb81('0x2c')](function(_0x219b85){var _0x26e73e=null;if(_0x219b85){_0x26e73e=_0x219b85[_0xdb81('0x40')][0x0];_0x26e73e[_0xdb81('0x41')]=_0x2c86d3;}_0xf7b59d(_0x26e73e);})[_0xdb81('0x2e')](function(_0x1a47d8){_0xe2a94(_0x1a47d8);});});}function createEndUser(_0x21ab45,_0x29b040,_0x52040b,_0x43fc17,_0x177538,_0x3e0e68){var _0x52040b=getName(_0x52040b);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x29b040+_0xdb81('0x42')+_['startCase'](_0x3e0e68['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x52040b[0x1],'First_Name':_0x52040b[0x0],'Phone':_0x43fc17,'Owner':{'name':!_[_0xdb81('0x1e')](_0x177538[_0xdb81('0x43')][_0xdb81('0x1b')])?_0x177538[_0xdb81('0x43')][_0xdb81('0x1b')]:!_[_0xdb81('0x1e')](_0x177538[_0xdb81('0x44')])?_0x177538[_0xdb81('0x44')]+'\x20'+_0x177538[_0xdb81('0x45')]:_0x177538['last_name'],'id':_0x177538['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x21ab45},'json':!![]})['then'](function(_0x1b6505){if(_0x1b6505&&_0x1b6505[_0xdb81('0x40')][0x0][_0xdb81('0x46')]==='SUCCESS'){var _0x3ced2b=_0x1b6505[_0xdb81('0x40')][0x0][_0xdb81('0x47')];_0x3ced2b[_0xdb81('0x41')]=_[_0xdb81('0x48')](_0x3e0e68[_0xdb81('0x49')])+'s';return _0x3ced2b;}logger[_0xdb81('0x2f')](_0xdb81('0x3e'),JSON[_0xdb81('0xe')](data));throw new Error(_0xdb81('0x4a')+JSON[_0xdb81('0xe')](data));})[_0xdb81('0x2e')](function(_0x244ef2){console[_0xdb81('0x4b')](_0xdb81('0x4c'),_0x244ef2);});}function getEndUser(_0x1ba11b,_0x3ea2c8,_0x485f01,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988){var _0x1f902b={'method':'GET','uri':'','headers':{'Authorization':_0xdb81('0x36')+_0x1ba11b},'json':!![]};switch(_0x492988[_0xdb81('0x4d')]){case'contact_lead':_0x1f902b['uri']='https://www.zohoapis.'+_0x3ea2c8+_0xdb81('0x4e')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Contacts')['then'](function(_0x4dec20){if(_0x4dec20)return _0x4dec20;_0x1f902b[_0xdb81('0x4f')]='https://www.zohoapis.'+_0x3ea2c8+_0xdb81('0x50')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Leads')['then'](function(_0x27a921){if(_0x27a921)return _0x27a921;if(_0x492988['moduleCreate']!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});});break;case _0xdb81('0x52'):_0x1f902b[_0xdb81('0x4f')]=_0xdb81('0x53')+_0x3ea2c8+_0xdb81('0x4e')+_0xd8d451+'))';return getZohoUser(_0x1f902b,_0xdb81('0x54'))[_0xdb81('0x2c')](function(_0x18e3aa){if(_0x18e3aa)return _0x18e3aa;if(_0x492988[_0xdb81('0x49')]!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});break;case _0xdb81('0x55'):_0x1f902b[_0xdb81('0x4f')]=_0xdb81('0x53')+_0x3ea2c8+_0xdb81('0x50')+_0xd8d451+'))';return getZohoUser(_0x1f902b,'Leads')['then'](function(_0x122cfc){if(_0x122cfc)return _0x122cfc;if(_0x492988['moduleCreate']!=_0xdb81('0x51')){return createEndUser(_0x1ba11b,_0x3ea2c8,_0x2eb552,_0xd8d451,_0x32d8ee,_0x492988);}else{return{};}});break;}}function getCall(_0x42c28f,_0x27bd46,_0x1f057a,_0x48572e,_0x307535,_0x41cfce,_0x2f8345,_0x14dac5){logger[_0xdb81('0x38')](_0xdb81('0x56'));var _0x181078={};_0x181078[_0xdb81('0x57')]={'name':!_[_0xdb81('0x1e')](_0x48572e[_0xdb81('0x43')][_0xdb81('0x1b')])&&!_[_0xdb81('0x1e')](_0x48572e['profile'][_0xdb81('0x1b')])&&_0x48572e['profile'][_0xdb81('0x1b')]===_0xdb81('0x58')?_0x48572e[_0xdb81('0x43')][_0xdb81('0x1b')]:!_[_0xdb81('0x1e')](_0x48572e[_0xdb81('0x44')])?_0x48572e[_0xdb81('0x44')]+'\x20'+_0x48572e[_0xdb81('0x45')]:_0x48572e[_0xdb81('0x45')],'id':_0x48572e['id']};_0x181078[_0xdb81('0x59')]=intUtil[_0xdb81('0x5a')](_0x41cfce[_0xdb81('0x5b')],_0x2f8345,'\x20');_0x181078[_0xdb81('0x5c')]=intUtil['getString'](_0x41cfce[_0xdb81('0x5d')],_0x2f8345,'\x0a');if(_0x307535[_0xdb81('0x41')]===_0xdb81('0x54')){_0x181078[_0xdb81('0x5e')]={'name':!_[_0xdb81('0x1e')](_0x307535[_0xdb81('0x5f')])?_0x307535[_0xdb81('0x5f')]:!_['isNil'](_0x307535[_0xdb81('0x60')])?_0x307535[_0xdb81('0x60')]+'\x20'+_0x307535[_0xdb81('0x61')]:_0x307535[_0xdb81('0x61')],'id':_0x307535['id']};}if(_0x307535['enduserType']==='Leads'){_0x181078['What_Id']={'name':!_[_0xdb81('0x1e')](_0x307535[_0xdb81('0x5f')])?_0x307535[_0xdb81('0x5f')]:!_['isNil'](_0x307535[_0xdb81('0x60')])?_0x307535['First_Name']+'\x20'+_0x307535['Last_Name']:_0x307535[_0xdb81('0x61')],'id':_0x307535['id']};_0x181078[_0xdb81('0x62')]=_['startCase'](_0x307535[_0xdb81('0x41')]);}if(_0x2f8345[_0xdb81('0x63')]){_0x181078[_0xdb81('0x64')]=moment[_0xdb81('0x65')](parseInt(_0x2f8345[_0xdb81('0x63')])*0x3e8)[_0xdb81('0x33')](_0xdb81('0x66'));}else if(_0x2f8345[_0xdb81('0x67')]&&_0x2f8345[_0xdb81('0x68')]){_0x181078['Call_Duration']=moment[_0xdb81('0x65')](moment(_0x2f8345[_0xdb81('0x68')],_0xdb81('0x69'))['diff'](moment(_0x2f8345[_0xdb81('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0xdb81('0x33')](_0xdb81('0x66'));}switch(_0x2f8345[_0xdb81('0x6b')]){case _0xdb81('0x6c'):_0x181078[_0xdb81('0x6d')]=_0xdb81('0x6e');break;case _0xdb81('0x6f'):case _0xdb81('0x70'):_0x181078[_0xdb81('0x6d')]=_0xdb81('0x71');break;case _0xdb81('0x72'):_0x181078[_0xdb81('0x6d')]='Rejected';break;case _0xdb81('0x73'):_0x181078['Call_Result']='Abandoned';break;case _0xdb81('0x74'):_0x181078[_0xdb81('0x6d')]='Timeout';default:}_0x181078[_0xdb81('0x75')]=(_0x14dac5===_0xdb81('0x76')?moment(_0x2f8345[_0xdb81('0x6a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x2f8345[_0xdb81('0x77')])['format'](_0xdb81('0x69')))||moment()[_0xdb81('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x181078[_0xdb81('0x78')]=_0x14dac5||_0xdb81('0x79');_0x181078=_[_0xdb81('0x7a')](_0x181078,getCustomFields(_0x41cfce[_0xdb81('0x7b')],_0x2f8345));return request({'method':'POST','uri':_0xdb81('0x53')+_0x27bd46+_0xdb81('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x42c28f},'body':{'data':[_0x181078]},'json':!![]})[_0xdb81('0x2c')](function(_0x401aaf){if(_0x401aaf&&_0x401aaf[_0xdb81('0x40')][0x0]['code']==='SUCCESS'){logger[_0xdb81('0x38')](_0xdb81('0x7d'));return{'id':_0x401aaf[_0xdb81('0x40')][0x0][_0xdb81('0x47')]['id']};}})[_0xdb81('0x2e')](function(_0x202e1e){logger[_0xdb81('0x38')](_0xdb81('0x7e'),_0x202e1e[_0xdb81('0x31')]);console['log'](_0xdb81('0x7e'),_0x202e1e);});}exports[_0xdb81('0x7f')]=function(_0x1dac54,_0x308a71,_0x247a33,_0x1c522f,_0x54d827,_0x393924){var _0xf6aa3c,_0xd07cf0,_0x11814b;_0x393924[_0xdb81('0x80')]=intUtil[_0xdb81('0x81')](_0x393924[_0xdb81('0x80')]);_0x393924[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x393924[_0xdb81('0x82')]);if(_0x54d827&&_0x54d827[_0xdb81('0x83')]){logger['info']('[QUEUE]',_0xdb81('0x84'));_0x308a71['recordingURL']=_0x393924[_0xdb81('0x82')]+_0xdb81('0x85')+_0x308a71[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x308a71[_0xdb81('0x86')]);}else{_0x308a71['recordingURL']='';}var _0x434720=_0x393924[_0xdb81('0x80')]===_0xdb81('0x88')?'eu':_0xdb81('0x89');return getAccessToken(_0x393924)[_0xdb81('0x2c')](function(_0x590421){_0x11814b=_0x590421;return getUser(_0x11814b,_0x434720,_0x393924,_0x1c522f[_0xdb81('0x8a')]);})[_0xdb81('0x2c')](function(_0x50209f){_0xf6aa3c=_0x50209f;logger[_0xdb81('0x38')](_0xdb81('0x8b'),_0xf6aa3c['id']);return getEndUser(_0x11814b,_0x434720,_0x393924,_0x308a71[_0xdb81('0x8c')],_0x308a71[_0xdb81('0x8d')],_0xf6aa3c,_0x247a33);})[_0xdb81('0x2c')](function(_0x277912){_0xd07cf0=_0x277912;return getCall(_0x11814b,_0x434720,_0x393924,_0xf6aa3c,_0xd07cf0,_0x247a33,_0x308a71,_0xdb81('0x79'));})[_0xdb81('0x2c')](function(_0xa7a43e){if(_0xa7a43e){logger[_0xdb81('0x38')]('The\x20Call\x20ID\x20is:',_0xa7a43e['id']);logger[_0xdb81('0x38')](_0xdb81('0x8e'),_0xdb81('0x8f'));emit(util[_0xdb81('0x33')](_0xdb81('0x90'),_0x1c522f[_0xdb81('0x1b')]),_0xdb81('0x91'),{'uri':_0xdb81('0x92')+_0x393924[_0xdb81('0x80')]+_0xdb81('0x93')+_0xa7a43e['id']});}})[_0xdb81('0x2e')](function(_0x2755f3){logger['error'](_0xdb81('0x8e'),JSON[_0xdb81('0xe')](_0x2755f3));});};exports[_0xdb81('0x76')]=function(_0x1a3106,_0x2ec92d,_0x5ebe58,_0x30d6a2,_0x22afdc,_0x2316ac,_0x4fc356){var _0x119884,_0x58a658,_0x4ed924;_0x2316ac['host']=intUtil['stripTrailingSlash'](_0x2316ac[_0xdb81('0x80')]);_0x2316ac[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x2316ac[_0xdb81('0x82')]);if(_0x4fc356&&_0x4fc356[_0xdb81('0x94')]&&_0x4fc356[_0xdb81('0x94')]!==_0xdb81('0x95')){logger[_0xdb81('0x38')]('[OUTBOUND]',_0xdb81('0x84'));_0x2ec92d[_0xdb81('0x96')]=_0x2316ac[_0xdb81('0x82')]+_0xdb81('0x85')+_0x2ec92d[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x2ec92d['uniqueid']);}var _0x39ca69=_0x2316ac[_0xdb81('0x80')]===_0xdb81('0x88')?'eu':'com';return getAccessToken(_0x2316ac)['then'](function(_0x2cf56d){_0x4ed924=_0x2cf56d;return getUser(_0x4ed924,_0x39ca69,_0x2316ac,_0x30d6a2[_0xdb81('0x8a')]);})[_0xdb81('0x2c')](function(_0x39b1c1){_0x119884=_0x39b1c1;logger[_0xdb81('0x38')]('The\x20User\x20ID\x20is:',_0x119884['id']);return getEndUser(_0x4ed924,_0x39ca69,_0x2316ac,_0x2ec92d[_0xdb81('0x97')],_0x2ec92d['destcalleridnum'],_0x119884,_0x5ebe58);})['then'](function(_0x1d3959){_0x58a658=_0x1d3959;return getCall(_0x4ed924,_0x39ca69,_0x2316ac,_0x119884,_0x58a658,_0x5ebe58,_0x2ec92d,_0xdb81('0x98'));})[_0xdb81('0x2c')](function(_0x417ba1){if(_0x417ba1){logger[_0xdb81('0x38')](_0xdb81('0x99'),_0x417ba1['id']);logger[_0xdb81('0x38')]('[OUTBOUND]',_0xdb81('0x8f'));emit(util[_0xdb81('0x33')]('user:%s',_0x30d6a2[_0xdb81('0x1b')]),_0xdb81('0x91'),{'uri':_0xdb81('0x92')+_0x2316ac[_0xdb81('0x80')]+_0xdb81('0x93')+_0x417ba1['id']});}})[_0xdb81('0x2e')](function(_0x2bd1ea){logger[_0xdb81('0x2f')](_0xdb81('0x9a'),JSON[_0xdb81('0xe')](_0x2bd1ea));});};exports[_0xdb81('0x9b')]=function(_0x282b04,_0x6472dc,_0x4c7c64,_0x26ea8a,_0x14d1d4,_0x38467b){var _0x1cd03f,_0x5e1e06,_0x29c4db;_0x38467b[_0xdb81('0x80')]=intUtil['stripTrailingSlash'](_0x38467b[_0xdb81('0x80')]);_0x38467b[_0xdb81('0x82')]=intUtil[_0xdb81('0x81')](_0x38467b['serverUrl']);if(_0x14d1d4&&_0x14d1d4[_0xdb81('0x83')]){logger[_0xdb81('0x38')]('['+_0x6472dc[_0xdb81('0x6b')][_0xdb81('0x9c')]()+']',_0xdb81('0x84'));_0x6472dc[_0xdb81('0x96')]=_0x38467b[_0xdb81('0x82')]+'/api/voice/recordings/'+_0x6472dc[_0xdb81('0x86')]+_0xdb81('0x87')+md5(_0x6472dc[_0xdb81('0x86')]);}else{_0x6472dc[_0xdb81('0x96')]='';}var _0x59e910=_0x38467b['host']===_0xdb81('0x88')?'eu':'com';return getAccessToken(_0x38467b)['then'](function(_0x2eac58){_0x29c4db=_0x2eac58;return getUser(_0x29c4db,_0x59e910,_0x38467b);})[_0xdb81('0x2c')](function(_0x48aa9){_0x1cd03f=_0x48aa9;logger[_0xdb81('0x38')](_0xdb81('0x8b'),_0x1cd03f['id']);return getEndUser(_0x29c4db,_0x59e910,_0x38467b,_0x6472dc[_0xdb81('0x8c')],_0x6472dc[_0xdb81('0x8d')],_0x1cd03f,_0x4c7c64);})[_0xdb81('0x2c')](function(_0x55e37e){_0x5e1e06=_0x55e37e;return getCall(_0x29c4db,_0x59e910,_0x38467b,_0x1cd03f,_0x5e1e06,_0x4c7c64,_0x6472dc,'Inbound');})[_0xdb81('0x2c')](function(_0x341458){if(_0x341458){logger[_0xdb81('0x38')](_0xdb81('0x99'),_0x341458['id']);}})[_0xdb81('0x2e')](function(_0x511e21){logger[_0xdb81('0x2f')]('['+_0x6472dc['lastevent'][_0xdb81('0x9c')]()+']',JSON[_0xdb81('0xe')](_0x511e21));});}; \ No newline at end of file +var _0x2f74=['timeout','Timeout','outbound','YYYY-MM-DDTHH:mm:ss','merge','/crm/v2/Calls','log','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','com','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','moduleSearch','contact_lead','uri','Contacts','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','mm:ss','endtime','Call_Duration','diff','starttime','called','Called','connect','rejected','Call_Result','Rejected','abandoned','Abandoned'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x2f74,0xb7));var _0x42f7=function(_0x2958a7,_0x569f19){_0x2958a7=_0x2958a7-0x0;var _0x1e0865=_0x2f74[_0x2958a7];return _0x1e0865;};'use strict';var _=require(_0x42f7('0x0'));var rp=require(_0x42f7('0x1'));var md5=require(_0x42f7('0x2'));var util=require(_0x42f7('0x3'));var intUtil=require(_0x42f7('0x4'));var moment=require('moment');var Redis=require(_0x42f7('0x5'));var BPromise=require(_0x42f7('0x6'));var config=require(_0x42f7('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0x42f7('0x8')]=_[_0x42f7('0x9')](config[_0x42f7('0x8')],{'host':_0x42f7('0xa'),'port':0x18eb});var io=require(_0x42f7('0xb'))(new Redis(config['redis']));function emit(_0x346d22,_0x1a07f2,_0x260e8f){io['to'](_0x346d22)[_0x42f7('0xc')](_0x1a07f2,_0x260e8f);}function request(_0x51d26c){logger[_0x42f7('0xd')]('[HTTP]',JSON[_0x42f7('0xe')](_0x51d26c));return rp(_0x51d26c);}function getCustomFields(_0x49437c,_0x2264db){var _0x181360={};if(_0x49437c[_0x42f7('0xf')]>0x0){_[_0x42f7('0x10')](_0x49437c,function(_0xf46574){if(_[_0x42f7('0x11')](['string',_0x42f7('0x12')],_0xf46574[_0x42f7('0x13')])&&_0xf46574[_0x42f7('0x14')]){_0x181360[_0xf46574[_0x42f7('0x14')]]=_0xf46574['content'][_0x42f7('0x15')]();}else if(_0xf46574[_0x42f7('0x13')]===_0x42f7('0x16')&&_0xf46574[_0x42f7('0x17')]&&_0xf46574[_0x42f7('0x14')]&&_0x2264db[_0xf46574[_0x42f7('0x17')]]){_0x181360[_0xf46574[_0x42f7('0x14')]]=_0x2264db[_0xf46574[_0x42f7('0x17')]][_0x42f7('0x15')]();}else if(_0xf46574[_0x42f7('0x13')]===_0x42f7('0x18')&&_0xf46574[_0x42f7('0x19')]&&_0xf46574[_0x42f7('0x19')]['name']&&_0xf46574[_0x42f7('0x14')]&&_0x2264db[_0xf46574[_0x42f7('0x19')][_0x42f7('0x1a')][_0x42f7('0x1b')]()]){_0x181360[_0xf46574[_0x42f7('0x14')]]=_0x2264db[_0xf46574[_0x42f7('0x19')][_0x42f7('0x1a')][_0x42f7('0x1b')]()][_0x42f7('0x15')]();}});}return _0x181360;}function getName(_0x2b75e0){if(_0x2b75e0[_0x42f7('0x1c')]('\x20')>0x0){var _0x10b51a=_0x2b75e0[_0x42f7('0x1d')](/ (.+)/);if(_0x10b51a[0x1]){return _0x10b51a;}}return[_0x2b75e0,_0x2b75e0];}var accountsTokens={};function getAccessToken(_0x3be2e7){return new Promise(function(_0x1aa12e,_0x2f4a24){if(!_[_0x42f7('0x1e')](accountsTokens[_0x3be2e7['id']])&&!_[_0x42f7('0x1e')](accountsTokens[_0x3be2e7['id']]['access_token'])){if(moment()[_0x42f7('0x1f')](accountsTokens[_0x3be2e7['id']][_0x42f7('0x20')])){_0x1aa12e(accountsTokens[_0x3be2e7['id']][_0x42f7('0x21')]);}}var _0x577e3c;switch(_0x3be2e7['zone']){case'US':_0x577e3c=_0x42f7('0x22');break;case'AU':_0x577e3c=_0x42f7('0x23');break;case'EU':_0x577e3c=_0x42f7('0x24');break;case'IN':_0x577e3c=_0x42f7('0x25');break;case'CN':_0x577e3c=_0x42f7('0x26');break;default:_0x577e3c=_0x42f7('0x24');break;}var _0x1179a7={'method':_0x42f7('0x27'),'uri':_0x577e3c+_0x42f7('0x28'),'qs':{'refresh_token':_0x3be2e7[_0x42f7('0x29')],'client_id':_0x3be2e7[_0x42f7('0x2a')],'client_secret':_0x3be2e7[_0x42f7('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1179a7)[_0x42f7('0x2c')](function(_0x453183){accountsTokens[_0x3be2e7['id']]={'access_token':_0x453183[_0x42f7('0x21')],'expires_in':moment()['add'](_0x453183[_0x42f7('0x20')],'seconds')};_0x1aa12e(_0x453183[_0x42f7('0x21')]);})[_0x42f7('0x2d')](function(_0x4d1608){logger[_0x42f7('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x4d1608[_0x42f7('0x2f')]);_0x2f4a24(_0x4d1608);});});}function getUser(_0x33142d,_0x2a1f76,_0x34836e,_0x3d877f){logger[_0x42f7('0x30')](_0x42f7('0x31'));return request({'method':_0x42f7('0x32'),'uri':util[_0x42f7('0x33')](_0x42f7('0x34'),_0x2a1f76),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x42f7('0x35')+_0x33142d},'json':!![]})[_0x42f7('0x2c')](function(_0x4b2a23){if(_0x4b2a23['users']){var _0x554449=-0x1;if(_[_0x42f7('0x36')](_0x4b2a23[_0x42f7('0x37')])){if(!_[_0x42f7('0x1e')](_0x3d877f)){_0x554449=_['findIndex'](_0x4b2a23[_0x42f7('0x37')],function(_0xa88576){return _0xa88576[_0x42f7('0x38')]===_0x3d877f;});}if(_0x554449>=0x0){logger[_0x42f7('0x30')](_0x42f7('0x39'));}else{logger[_0x42f7('0x30')](_0x42f7('0x3a'));_0x554449=_['findIndex'](_0x4b2a23[_0x42f7('0x37')],function(_0x2f655b){return _0x2f655b[_0x42f7('0x3b')][_0x42f7('0x1a')]==='Administrator';});}return _0x4b2a23[_0x42f7('0x37')][_0x554449];}else{if(_0x4b2a23[_0x42f7('0x3c')][_0x42f7('0x3b')][_0x42f7('0x1a')]==='Administrator'){logger['info'](_0x42f7('0x3a'));user=_0x4b2a23[_0x42f7('0x3c')];return user;}else{logger['error'](_0x42f7('0x3d'),JSON[_0x42f7('0xe')](_0x4b2a23));throw new Error(_0x42f7('0x3e')+JSON['stringify'](_0x4b2a23));}}}else{logger['error'](_0x42f7('0x3d'),JSON[_0x42f7('0xe')](_0x4b2a23));throw new Error(_0x42f7('0x3e')+JSON[_0x42f7('0xe')](_0x4b2a23));}})[_0x42f7('0x2d')](function(_0x5f043e){console[_0x42f7('0x2e')](_0x5f043e);});}function getZohoUser(_0x851c16,_0xaf2d45){return new BPromise(function(_0x4faade,_0x485b7b){request(_0x851c16)[_0x42f7('0x2c')](function(_0x39c287){var _0x1f881a=null;if(_0x39c287){_0x1f881a=_0x39c287[_0x42f7('0x3f')][0x0];_0x1f881a[_0x42f7('0x40')]=_0xaf2d45;}_0x4faade(_0x1f881a);})[_0x42f7('0x2d')](function(_0x393e3c){_0x485b7b(_0x393e3c);});});}function createEndUser(_0x3077bc,_0xead50c,_0x190309,_0x190453,_0x55f4ce,_0x5663b3){var _0x190309=getName(_0x190309);return request({'method':_0x42f7('0x27'),'uri':_0x42f7('0x41')+_0xead50c+'/crm/v2/'+_[_0x42f7('0x42')](_0x5663b3[_0x42f7('0x43')])+'s','body':{'data':[{'Last_Name':_0x190309[0x1],'First_Name':_0x190309[0x0],'Phone':_0x190453,'Owner':{'name':!_[_0x42f7('0x1e')](_0x55f4ce['role'][_0x42f7('0x1a')])?_0x55f4ce[_0x42f7('0x44')][_0x42f7('0x1a')]:!_[_0x42f7('0x1e')](_0x55f4ce['first_name'])?_0x55f4ce[_0x42f7('0x45')]+'\x20'+_0x55f4ce[_0x42f7('0x46')]:_0x55f4ce[_0x42f7('0x46')],'id':_0x55f4ce['id']}}]},'headers':{'Authorization':_0x42f7('0x35')+_0x3077bc},'json':!![]})['then'](function(_0x35e08c){if(_0x35e08c&&_0x35e08c[_0x42f7('0x3f')][0x0][_0x42f7('0x47')]===_0x42f7('0x48')){var _0x45e4bb=_0x35e08c[_0x42f7('0x3f')][0x0][_0x42f7('0x49')];_0x45e4bb['enduserType']=_[_0x42f7('0x42')](_0x5663b3[_0x42f7('0x43')])+'s';return _0x45e4bb;}logger[_0x42f7('0x2e')](_0x42f7('0x3d'),JSON[_0x42f7('0xe')](data));throw new Error(_0x42f7('0x4a')+JSON[_0x42f7('0xe')](data));})[_0x42f7('0x2d')](function(_0xbdb869){console['log']('CREATE\x20ERROR',_0xbdb869);});}function getEndUser(_0xa6fe2,_0x5e69f6,_0x5a2434,_0x46ef7,_0x233f29,_0x1a6ca5,_0x239d0a){var _0x53c2c1={'method':'GET','uri':'','headers':{'Authorization':_0x42f7('0x35')+_0xa6fe2},'json':!![]};switch(_0x239d0a[_0x42f7('0x4b')]){case _0x42f7('0x4c'):_0x53c2c1[_0x42f7('0x4d')]=_0x42f7('0x41')+_0x5e69f6+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x233f29+'))';return getZohoUser(_0x53c2c1,_0x42f7('0x4e'))[_0x42f7('0x2c')](function(_0x3e6171){if(_0x3e6171)return _0x3e6171;_0x53c2c1[_0x42f7('0x4d')]='https://www.zohoapis.'+_0x5e69f6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x233f29+'))';return getZohoUser(_0x53c2c1,_0x42f7('0x4f'))[_0x42f7('0x2c')](function(_0x2cf71b){if(_0x2cf71b)return _0x2cf71b;if(_0x239d0a['moduleCreate']!=_0x42f7('0x50')){return createEndUser(_0xa6fe2,_0x5e69f6,_0x46ef7,_0x233f29,_0x1a6ca5,_0x239d0a);}else{return{};}});});break;case _0x42f7('0x51'):_0x53c2c1[_0x42f7('0x4d')]=_0x42f7('0x41')+_0x5e69f6+_0x42f7('0x52')+_0x233f29+'))';return getZohoUser(_0x53c2c1,_0x42f7('0x4e'))['then'](function(_0x23ef48){if(_0x23ef48)return _0x23ef48;if(_0x239d0a[_0x42f7('0x43')]!=_0x42f7('0x50')){return createEndUser(_0xa6fe2,_0x5e69f6,_0x46ef7,_0x233f29,_0x1a6ca5,_0x239d0a);}else{return{};}});break;case _0x42f7('0x53'):_0x53c2c1[_0x42f7('0x4d')]=_0x42f7('0x41')+_0x5e69f6+_0x42f7('0x54')+_0x233f29+'))';return getZohoUser(_0x53c2c1,_0x42f7('0x4f'))['then'](function(_0x2a9e43){if(_0x2a9e43)return _0x2a9e43;if(_0x239d0a[_0x42f7('0x43')]!=_0x42f7('0x50')){return createEndUser(_0xa6fe2,_0x5e69f6,_0x46ef7,_0x233f29,_0x1a6ca5,_0x239d0a);}else{return{};}});break;}}function getCall(_0x417540,_0x32a9f0,_0x5f7ce8,_0x5294fe,_0x360c67,_0x780000,_0x59ea0b,_0x2b468a){logger['info'](_0x42f7('0x55'));var _0x10926d={};_0x10926d[_0x42f7('0x56')]={'name':!_[_0x42f7('0x1e')](_0x5294fe[_0x42f7('0x44')][_0x42f7('0x1a')])&&!_[_0x42f7('0x1e')](_0x5294fe[_0x42f7('0x3b')][_0x42f7('0x1a')])&&_0x5294fe[_0x42f7('0x3b')][_0x42f7('0x1a')]==='administrator'?_0x5294fe['role'][_0x42f7('0x1a')]:!_[_0x42f7('0x1e')](_0x5294fe['first_name'])?_0x5294fe[_0x42f7('0x45')]+'\x20'+_0x5294fe['last_name']:_0x5294fe[_0x42f7('0x46')],'id':_0x5294fe['id']};_0x10926d['Subject']=intUtil[_0x42f7('0x57')](_0x780000[_0x42f7('0x58')],_0x59ea0b,'\x20');_0x10926d[_0x42f7('0x59')]=intUtil['getString'](_0x780000[_0x42f7('0x5a')],_0x59ea0b,'\x0a');if(_0x360c67[_0x42f7('0x40')]===_0x42f7('0x4e')){_0x10926d[_0x42f7('0x5b')]={'name':!_[_0x42f7('0x1e')](_0x360c67[_0x42f7('0x5c')])?_0x360c67[_0x42f7('0x5c')]:!_['isNil'](_0x360c67['First_Name'])?_0x360c67[_0x42f7('0x5d')]+'\x20'+_0x360c67['Last_Name']:_0x360c67['Last_Name'],'id':_0x360c67['id']};}if(_0x360c67[_0x42f7('0x40')]===_0x42f7('0x4f')){_0x10926d[_0x42f7('0x5e')]={'name':!_[_0x42f7('0x1e')](_0x360c67[_0x42f7('0x5c')])?_0x360c67[_0x42f7('0x5c')]:!_[_0x42f7('0x1e')](_0x360c67[_0x42f7('0x5d')])?_0x360c67[_0x42f7('0x5d')]+'\x20'+_0x360c67[_0x42f7('0x5f')]:_0x360c67[_0x42f7('0x5f')],'id':_0x360c67['id']};_0x10926d[_0x42f7('0x60')]=_[_0x42f7('0x42')](_0x360c67[_0x42f7('0x40')]);}if(_0x59ea0b[_0x42f7('0x61')]){_0x10926d['Call_Duration']=moment['utc'](parseInt(_0x59ea0b[_0x42f7('0x61')])*0x3e8)[_0x42f7('0x33')](_0x42f7('0x62'));}else if(_0x59ea0b['answertime']&&_0x59ea0b[_0x42f7('0x63')]){_0x10926d[_0x42f7('0x64')]=moment['utc'](moment(_0x59ea0b[_0x42f7('0x63')],'YYYY-MM-DDTHH:mm:ss')[_0x42f7('0x65')](moment(_0x59ea0b[_0x42f7('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x42f7('0x33')](_0x42f7('0x62'));}switch(_0x59ea0b['lastevent']){case _0x42f7('0x67'):_0x10926d['Call_Result']=_0x42f7('0x68');break;case'complete':case _0x42f7('0x69'):_0x10926d['Call_Result']='Answered';break;case _0x42f7('0x6a'):_0x10926d[_0x42f7('0x6b')]=_0x42f7('0x6c');break;case _0x42f7('0x6d'):_0x10926d['Call_Result']=_0x42f7('0x6e');break;case _0x42f7('0x6f'):_0x10926d[_0x42f7('0x6b')]=_0x42f7('0x70');default:}_0x10926d['Call_Start_Time']=(_0x2b468a===_0x42f7('0x71')?moment(_0x59ea0b['starttime'])['format'](_0x42f7('0x72')):moment(_0x59ea0b['agentcalledAt'])[_0x42f7('0x33')](_0x42f7('0x72')))||moment()[_0x42f7('0x33')](_0x42f7('0x72'));_0x10926d['Call_Type']=_0x2b468a||'Inbound';_0x10926d=_[_0x42f7('0x73')](_0x10926d,getCustomFields(_0x780000['Fields'],_0x59ea0b));return request({'method':_0x42f7('0x27'),'uri':_0x42f7('0x41')+_0x32a9f0+_0x42f7('0x74'),'headers':{'Authorization':_0x42f7('0x35')+_0x417540},'body':{'data':[_0x10926d]},'json':!![]})[_0x42f7('0x2c')](function(_0x5b0384){if(_0x5b0384&&_0x5b0384['data'][0x0][_0x42f7('0x47')]===_0x42f7('0x48')){logger[_0x42f7('0x30')]('Call\x20created!');return{'id':_0x5b0384[_0x42f7('0x3f')][0x0][_0x42f7('0x49')]['id']};}})[_0x42f7('0x2d')](function(_0x19ae4b){logger[_0x42f7('0x30')]('err',_0x19ae4b[_0x42f7('0x2f')]);console[_0x42f7('0x75')](_0x42f7('0x76'),_0x19ae4b);});}exports['queue']=function(_0x1aa7b9,_0x527efa,_0x4ae5cb,_0x1b5d55,_0xa91ea4,_0x614c69){var _0x48c6ea,_0x529581,_0x328aae;_0x614c69[_0x42f7('0x77')]=intUtil[_0x42f7('0x78')](_0x614c69['host']);_0x614c69[_0x42f7('0x79')]=intUtil['stripTrailingSlash'](_0x614c69['serverUrl']);if(_0xa91ea4&&_0xa91ea4[_0x42f7('0x7a')]){logger[_0x42f7('0x30')](_0x42f7('0x7b'),'Recording\x20is\x20enabled!');_0x527efa['recordingURL']=_0x614c69[_0x42f7('0x79')]+_0x42f7('0x7c')+_0x527efa['uniqueid']+_0x42f7('0x7d')+md5(_0x527efa[_0x42f7('0x7e')]);}else{_0x527efa[_0x42f7('0x7f')]='';}var _0x57c709=_0x614c69[_0x42f7('0x77')]===_0x42f7('0x80')?'eu':'com';return getAccessToken(_0x614c69)[_0x42f7('0x2c')](function(_0x5d25f0){_0x328aae=_0x5d25f0;return getUser(_0x328aae,_0x57c709,_0x614c69,_0x1b5d55[_0x42f7('0x38')]);})['then'](function(_0xcdeabd){_0x48c6ea=_0xcdeabd;logger[_0x42f7('0x30')]('The\x20User\x20ID\x20is:',_0x48c6ea['id']);return getEndUser(_0x328aae,_0x57c709,_0x614c69,_0x527efa[_0x42f7('0x81')],_0x527efa[_0x42f7('0x82')],_0x48c6ea,_0x4ae5cb);})[_0x42f7('0x2c')](function(_0x50d5d9){_0x529581=_0x50d5d9;return getCall(_0x328aae,_0x57c709,_0x614c69,_0x48c6ea,_0x529581,_0x4ae5cb,_0x527efa,'Inbound');})[_0x42f7('0x2c')](function(_0x1afcbf){if(_0x1afcbf){logger[_0x42f7('0x30')]('The\x20Call\x20ID\x20is:',_0x1afcbf['id']);logger[_0x42f7('0x30')](_0x42f7('0x7b'),_0x42f7('0x83'));emit(util[_0x42f7('0x33')](_0x42f7('0x84'),_0x1b5d55[_0x42f7('0x1a')]),_0x42f7('0x85'),{'uri':_0x42f7('0x86')+_0x614c69['host']+_0x42f7('0x87')+_0x1afcbf['id']});}})[_0x42f7('0x2d')](function(_0x45601a){logger[_0x42f7('0x2e')](_0x42f7('0x7b'),JSON[_0x42f7('0xe')](_0x45601a));});};exports['outbound']=function(_0x779583,_0x2b3879,_0x2f8527,_0x52f9aa,_0x561976,_0x3afcaf,_0x198e8e){var _0x1c208d,_0x3b2b2d,_0x255c69;_0x3afcaf[_0x42f7('0x77')]=intUtil[_0x42f7('0x78')](_0x3afcaf[_0x42f7('0x77')]);_0x3afcaf['serverUrl']=intUtil[_0x42f7('0x78')](_0x3afcaf[_0x42f7('0x79')]);if(_0x198e8e&&_0x198e8e[_0x42f7('0x88')]&&_0x198e8e[_0x42f7('0x88')]!=='none'){logger[_0x42f7('0x30')](_0x42f7('0x89'),_0x42f7('0x8a'));_0x2b3879[_0x42f7('0x7f')]=_0x3afcaf[_0x42f7('0x79')]+_0x42f7('0x7c')+_0x2b3879[_0x42f7('0x7e')]+_0x42f7('0x7d')+md5(_0x2b3879['uniqueid']);}var _0xa0e875=_0x3afcaf[_0x42f7('0x77')]===_0x42f7('0x80')?'eu':_0x42f7('0x8b');return getAccessToken(_0x3afcaf)['then'](function(_0x478bbd){_0x255c69=_0x478bbd;return getUser(_0x255c69,_0xa0e875,_0x3afcaf,_0x52f9aa[_0x42f7('0x38')]);})[_0x42f7('0x2c')](function(_0x2c22f9){_0x1c208d=_0x2c22f9;logger['info']('The\x20User\x20ID\x20is:',_0x1c208d['id']);return getEndUser(_0x255c69,_0xa0e875,_0x3afcaf,_0x2b3879[_0x42f7('0x8c')],_0x2b3879['destcalleridnum'],_0x1c208d,_0x2f8527);})['then'](function(_0x2ef3e1){_0x3b2b2d=_0x2ef3e1;return getCall(_0x255c69,_0xa0e875,_0x3afcaf,_0x1c208d,_0x3b2b2d,_0x2f8527,_0x2b3879,_0x42f7('0x8d'));})[_0x42f7('0x2c')](function(_0x258103){if(_0x258103){logger[_0x42f7('0x30')](_0x42f7('0x8e'),_0x258103['id']);logger['info']('[OUTBOUND]',_0x42f7('0x83'));emit(util[_0x42f7('0x33')]('user:%s',_0x52f9aa[_0x42f7('0x1a')]),_0x42f7('0x85'),{'uri':'https://crm.'+_0x3afcaf[_0x42f7('0x77')]+_0x42f7('0x87')+_0x258103['id']});}})[_0x42f7('0x2d')](function(_0x3a2008){logger[_0x42f7('0x2e')](_0x42f7('0x89'),JSON[_0x42f7('0xe')](_0x3a2008));});};exports[_0x42f7('0x8f')]=function(_0x51c645,_0x234120,_0x5c1fd0,_0x3b4a1a,_0x5f50da,_0x82f7b2){var _0x33ad54,_0x54dcc7,_0x442ca9;_0x82f7b2['host']=intUtil[_0x42f7('0x78')](_0x82f7b2[_0x42f7('0x77')]);_0x82f7b2['serverUrl']=intUtil[_0x42f7('0x78')](_0x82f7b2[_0x42f7('0x79')]);if(_0x5f50da&&_0x5f50da[_0x42f7('0x7a')]){logger[_0x42f7('0x30')]('['+_0x234120[_0x42f7('0x90')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x234120['recordingURL']=_0x82f7b2[_0x42f7('0x79')]+_0x42f7('0x7c')+_0x234120[_0x42f7('0x7e')]+_0x42f7('0x7d')+md5(_0x234120[_0x42f7('0x7e')]);}else{_0x234120[_0x42f7('0x7f')]='';}var _0x171391=_0x82f7b2[_0x42f7('0x77')]===_0x42f7('0x80')?'eu':_0x42f7('0x8b');return getAccessToken(_0x82f7b2)[_0x42f7('0x2c')](function(_0x59e02b){_0x442ca9=_0x59e02b;return getUser(_0x442ca9,_0x171391,_0x82f7b2);})['then'](function(_0x5fc95e){_0x33ad54=_0x5fc95e;logger[_0x42f7('0x30')](_0x42f7('0x91'),_0x33ad54['id']);return getEndUser(_0x442ca9,_0x171391,_0x82f7b2,_0x234120['calleridname'],_0x234120[_0x42f7('0x82')],_0x33ad54,_0x5c1fd0);})[_0x42f7('0x2c')](function(_0x3ca6be){_0x54dcc7=_0x3ca6be;return getCall(_0x442ca9,_0x171391,_0x82f7b2,_0x33ad54,_0x54dcc7,_0x5c1fd0,_0x234120,'Inbound');})[_0x42f7('0x2c')](function(_0x235c0b){if(_0x235c0b){logger['info']('The\x20Call\x20ID\x20is:',_0x235c0b['id']);}})['catch'](function(_0x239f41){logger[_0x42f7('0x2e')]('['+_0x234120['lastevent'][_0x42f7('0x92')]()+']',JSON['stringify'](_0x239f41));});}; \ 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 ad6ebd3..c8c1d9d 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 _0xcdc7=['exec','data2','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','trigger'];(function(_0x3150aa,_0x2f0ca3){var _0x10dfb1=function(_0x4d52b0){while(--_0x4d52b0){_0x3150aa['push'](_0x3150aa['shift']());}};_0x10dfb1(++_0x2f0ca3);}(_0xcdc7,0xf7));var _0x7cdc=function(_0x568def,_0x1b6b0b){_0x568def=_0x568def-0x0;var _0x3bd175=_0xcdc7[_0x568def];return _0x3bd175;};'use strict';var util=require(_0x7cdc('0x0'));var sh=require(_0x7cdc('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x7cdc('0x2'));exports[_0x7cdc('0x3')]=function(_0x857d17,_0x5e4048){var _0x4786a7=_0x857d17[_0x7cdc('0x4')]?_0x857d17[_0x7cdc('0x4')]:'Script';var _0x18c97e=_0x857d17[_0x7cdc('0x5')]?Mustache[_0x7cdc('0x6')](_0x857d17[_0x7cdc('0x5')],_0x5e4048):_0x5e4048;sh['exec'](_0x18c97e,function(_0x23d215,_0x119889,_0x39953c){if(_0x23d215!==0x0){logger['error'](util[_0x7cdc('0x7')](_0x7cdc('0x8'),_0x4786a7,_0x18c97e,_0x23d215,_0x39953c));}else{logger[_0x7cdc('0x9')](util[_0x7cdc('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4786a7,_0x18c97e,_0x119889));}});}; \ No newline at end of file +var _0xa454=['data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x30327a,_0x32a84b){var _0x3fbd46=function(_0x1286e2){while(--_0x1286e2){_0x30327a['push'](_0x30327a['shift']());}};_0x3fbd46(++_0x32a84b);}(_0xa454,0x96));var _0x4a45=function(_0x635210,_0x55e491){_0x635210=_0x635210-0x0;var _0x3e622a=_0xa454[_0x635210];return _0x3e622a;};'use strict';var util=require(_0x4a45('0x0'));var sh=require(_0x4a45('0x1'));var Mustache=require(_0x4a45('0x2'));var logger=require(_0x4a45('0x3'))(_0x4a45('0x4'));exports[_0x4a45('0x5')]=function(_0x3222ce,_0x216799){var _0x3f3099=_0x3222ce['data2']?_0x3222ce[_0x4a45('0x6')]:_0x4a45('0x7');var _0x271868=_0x3222ce[_0x4a45('0x8')]?Mustache['render'](_0x3222ce['data3'],_0x216799):_0x216799;sh['exec'](_0x271868,function(_0x62b24,_0x3f64b0,_0x413ef6){if(_0x62b24!==0x0){logger[_0x4a45('0x9')](util[_0x4a45('0xa')](_0x4a45('0xb'),_0x3f3099,_0x271868,_0x62b24,_0x413ef6));}else{logger['info'](util[_0x4a45('0xa')](_0x4a45('0xc'),_0x3f3099,_0x271868,_0x3f64b0));}});}; \ 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 c4e2922..38047bc 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 _0x7754=['data5','number','parse','data6','stack','GET','DELETE','POST','PUT','data7','error','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render'];(function(_0x951ed6,_0x297ba1){var _0x132a4d=function(_0x2b6be5){while(--_0x2b6be5){_0x951ed6['push'](_0x951ed6['shift']());}};_0x132a4d(++_0x297ba1);}(_0x7754,0xd8));var _0x4775=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x7754[_0x280ae7];return _0x418b9e;};'use strict';var rp=require('request-promise');var util=require(_0x4775('0x0'));var _=require(_0x4775('0x1'));var Mustache=require(_0x4775('0x2'));var logger=require(_0x4775('0x3'))(_0x4775('0x4'));exports['exec']=function(_0x28249e,_0x51985b){var _0x2beeb1,_0x1657fc;var _0x2eef3a={'method':_0x28249e[_0x4775('0x5')][_0x4775('0x6')](),'uri':Mustache[_0x4775('0x7')](_0x28249e['data2'],_0x51985b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x28249e[_0x4775('0x8')])===_0x4775('0x9')&&parseInt(_0x28249e[_0x4775('0x8')])>=0x1&&parseInt(_0x28249e['data5'])<=0xa?parseInt(_0x28249e['data5'])*0x3e8:0x5*0x3e8};try{_0x2eef3a['headers']=_0x28249e['data6']?JSON[_0x4775('0xa')](Mustache[_0x4775('0x7')](_0x28249e[_0x4775('0xb')],_0x51985b)):{};}catch(_0x18dbdd){logger['error'](_0x18dbdd[_0x4775('0xc')]);}switch(_0x28249e[_0x4775('0x5')][_0x4775('0x6')]()){case _0x4775('0xd'):case _0x4775('0xe'):_0x2beeb1=null;_0x2eef3a['qs']=_0x51985b;break;case _0x4775('0xf'):case _0x4775('0x10'):if(_0x28249e['data7']){try{_0x2beeb1=JSON['parse'](Mustache[_0x4775('0x7')](_0x28249e[_0x4775('0x11')],_0x51985b));_0x2eef3a['body']=_0x2beeb1;}catch(_0x426a5b){logger[_0x4775('0x12')](_0x426a5b[_0x4775('0xc')]);logger[_0x4775('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2beeb1=_0x51985b;_0x2eef3a[_0x4775('0x13')]=_0x2beeb1;}break;}logger[_0x4775('0x14')](util[_0x4775('0x15')](_0x4775('0x16'),_0x28249e[_0x4775('0x5')],_0x28249e[_0x4775('0x17')],JSON[_0x4775('0x18')](_0x2eef3a)));rp(_0x2eef3a)[_0x4775('0x19')](function(_0x10b9b0){_0x2beeb1=!_['isNil'](_0x2beeb1)?',\x20request\x20body:\x20'+_0x2beeb1:'';_0x1657fc=typeof _0x10b9b0[_0x4775('0x13')]===_0x4775('0x1a')?JSON[_0x4775('0x18')](_0x10b9b0[_0x4775('0x13')]):_0x10b9b0[_0x4775('0x13')];logger[_0x4775('0x14')](util['format'](_0x4775('0x1b'),_0x28249e[_0x4775('0x5')],_0x28249e['data2'],_0x10b9b0[_0x4775('0x1c')],_0x1657fc));})[_0x4775('0x1d')](function(_0xe8ad8f){logger[_0x4775('0x12')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x28249e[_0x4775('0x5')],_0x28249e['data2'],_0xe8ad8f[_0x4775('0x1c')],_0xe8ad8f[_0x4775('0x1e')],_0xe8ad8f[_0x4775('0x1f')]));});}; \ No newline at end of file +var _0x76af=['%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','exec','toUpperCase','data2','number','data5','headers','data6','render','error','stack','data1','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object'];(function(_0x245266,_0x4c1946){var _0x126f5b=function(_0x45e166){while(--_0x45e166){_0x245266['push'](_0x245266['shift']());}};_0x126f5b(++_0x4c1946);}(_0x76af,0x1b3));var _0xf76a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x76af[_0x550d12];return _0x12103d;};'use strict';var rp=require(_0xf76a('0x0'));var util=require(_0xf76a('0x1'));var _=require('lodash');var Mustache=require(_0xf76a('0x2'));var logger=require(_0xf76a('0x3'))('trigger');exports[_0xf76a('0x4')]=function(_0x324f2a,_0x2cda70){var _0x4d6636,_0xdc5c6;var _0x22d6fb={'method':_0x324f2a['data1'][_0xf76a('0x5')](),'uri':Mustache['render'](_0x324f2a[_0xf76a('0x6')],_0x2cda70),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x324f2a['data5'])===_0xf76a('0x7')&&parseInt(_0x324f2a['data5'])>=0x1&&parseInt(_0x324f2a[_0xf76a('0x8')])<=0xa?parseInt(_0x324f2a['data5'])*0x3e8:0x5*0x3e8};try{_0x22d6fb[_0xf76a('0x9')]=_0x324f2a[_0xf76a('0xa')]?JSON['parse'](Mustache[_0xf76a('0xb')](_0x324f2a[_0xf76a('0xa')],_0x2cda70)):{};}catch(_0x498971){logger[_0xf76a('0xc')](_0x498971[_0xf76a('0xd')]);}switch(_0x324f2a[_0xf76a('0xe')][_0xf76a('0x5')]()){case _0xf76a('0xf'):case _0xf76a('0x10'):_0x4d6636=null;_0x22d6fb['qs']=_0x2cda70;break;case _0xf76a('0x11'):case'PUT':if(_0x324f2a[_0xf76a('0x12')]){try{_0x4d6636=JSON['parse'](Mustache[_0xf76a('0xb')](_0x324f2a[_0xf76a('0x12')],_0x2cda70));_0x22d6fb[_0xf76a('0x13')]=_0x4d6636;}catch(_0x16b7fd){logger[_0xf76a('0xc')](_0x16b7fd[_0xf76a('0xd')]);logger[_0xf76a('0xc')](_0xf76a('0x14'));}}else{_0x4d6636=_0x2cda70;_0x22d6fb[_0xf76a('0x13')]=_0x4d6636;}break;}logger[_0xf76a('0x15')](util['format'](_0xf76a('0x16'),_0x324f2a['data1'],_0x324f2a[_0xf76a('0x6')],JSON[_0xf76a('0x17')](_0x22d6fb)));rp(_0x22d6fb)[_0xf76a('0x18')](function(_0xd8dfbe){_0x4d6636=!_['isNil'](_0x4d6636)?_0xf76a('0x19')+_0x4d6636:'';_0xdc5c6=typeof _0xd8dfbe['body']===_0xf76a('0x1a')?JSON['stringify'](_0xd8dfbe[_0xf76a('0x13')]):_0xd8dfbe[_0xf76a('0x13')];logger[_0xf76a('0x15')](util['format'](_0xf76a('0x1b'),_0x324f2a[_0xf76a('0xe')],_0x324f2a['data2'],_0xd8dfbe[_0xf76a('0x1c')],_0xdc5c6));})['catch'](function(_0x1d6316){logger[_0xf76a('0xc')](util[_0xf76a('0x1d')](_0xf76a('0x1e'),_0x324f2a[_0xf76a('0xe')],_0x324f2a['data2'],_0x1d6316['statusCode'],_0x1d6316[_0xf76a('0x1f')],_0x1d6316[_0xf76a('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 62b5bdf..ec1db7c 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 _0x1297=['result','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x1297,0x140));var _0x7129=function(_0x313dd5,_0x3912b9){_0x313dd5=_0x313dd5-0x0;var _0x307883=_0x1297[_0x313dd5];return _0x307883;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x7129('0x0'))(_0x7129('0x1'));var client=jayson[_0x7129('0x2')][_0x7129('0x3')]({'port':0x2329});client[_0x7129('0x4')]=function(_0x290b81,_0x4f5532){return new BPromise(function(_0x229598,_0x50f113){return client[_0x7129('0x5')](_0x290b81,_0x4f5532)['then'](function(_0x3b0df9){logger[_0x7129('0x6')](_0x7129('0x7'),_0x7129('0x1'),_0x290b81,_0x4f5532,_0x3b0df9);if(_0x3b0df9[_0x7129('0x8')]){logger[_0x7129('0x8')]('rpc',_0x7129('0x1'),_0x290b81,_0x3b0df9[_0x7129('0x8')][_0x7129('0x9')],_0x4f5532);return _0x50f113(_0x3b0df9[_0x7129('0x8')][_0x7129('0x9')]);}else{return _0x229598(_0x3b0df9[_0x7129('0xa')]);}})['catch'](function(_0x2e4169){logger[_0x7129('0x8')](_0x7129('0x7'),_0x7129('0x1'),_0x290b81,_0x2e4169,_0x4f5532);return _0x50f113(_0x2e4169);});});};module['exports']=client; \ No newline at end of file +var _0xf4ad=['Request','request','then','rpc','routing','error','message','jayson/promise','../../config/logger'];(function(_0x5c1fa1,_0x3b73ec){var _0x4982b8=function(_0x5f4e51){while(--_0x5f4e51){_0x5c1fa1['push'](_0x5c1fa1['shift']());}};_0x4982b8(++_0x3b73ec);}(_0xf4ad,0x142));var _0xdf4a=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0xf4ad[_0x1df79c];return _0x2f23e4;};'use strict';var jayson=require(_0xdf4a('0x0'));var BPromise=require('bluebird');var logger=require(_0xdf4a('0x1'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0xdf4a('0x2')]=function(_0x598d05,_0x459309){return new BPromise(function(_0x9bcd6,_0x46b8fa){return client[_0xdf4a('0x3')](_0x598d05,_0x459309)[_0xdf4a('0x4')](function(_0x3f8b5d){logger['debug'](_0xdf4a('0x5'),_0xdf4a('0x6'),_0x598d05,_0x459309,_0x3f8b5d);if(_0x3f8b5d[_0xdf4a('0x7')]){logger[_0xdf4a('0x7')](_0xdf4a('0x5'),_0xdf4a('0x6'),_0x598d05,_0x3f8b5d['error'][_0xdf4a('0x8')],_0x459309);return _0x46b8fa(_0x3f8b5d[_0xdf4a('0x7')]['message']);}else{return _0x9bcd6(_0x3f8b5d['result']);}})['catch'](function(_0x484b6f){logger[_0xdf4a('0x7')](_0xdf4a('0x5'),_0xdf4a('0x6'),_0x598d05,_0x484b6f,_0x459309);return _0x46b8fa(_0x484b6f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index fcdbf36..1f4a029 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 _0x67dc=['initMailAccounts','refresh','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x4c5f6e,_0x32d3de){var _0x510e53=function(_0x64cc75){while(--_0x64cc75){_0x4c5f6e['push'](_0x4c5f6e['shift']());}};_0x510e53(++_0x32d3de);}(_0x67dc,0x172));var _0xc67d=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x67dc[_0x1793de];return _0x4f0309;};'use strict';var server=require(_0xc67d('0x0'));var Realtime=require(_0xc67d('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc67d('0x2'));var setting=require(_0xc67d('0x3'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc67d('0x4')]()[_0xc67d('0x5')](mailAccount[_0xc67d('0x6')]())[_0xc67d('0x5')](realtime[_0xc67d('0x7')]())[_0xc67d('0x5')](function(){email[_0xc67d('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc67d('0x5')](function(){return initRealtime();})[_0xc67d('0x5')](function(){return setting[_0xc67d('0x9')]();})[_0xc67d('0x5')](function(_0x408172){return setInterval(initRealtime,_0x408172[_0xc67d('0xa')]*0x3e8);})['catch'](function(_0x22daa7){logger[_0xc67d('0xb')](_0xc67d('0xc'),_0x22daa7);});}main(); \ No newline at end of file +var _0x10a1=['Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','email','then','getMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency'];(function(_0x5ead71,_0x31f25e){var _0x49bcfc=function(_0x17a8f8){while(--_0x17a8f8){_0x5ead71['push'](_0x5ead71['shift']());}};_0x49bcfc(++_0x31f25e);}(_0x10a1,0x175));var _0x110a=function(_0xb6650a,_0xc118e1){_0xb6650a=_0xb6650a-0x0;var _0x3927a4=_0x10a1[_0xb6650a];return _0x3927a4;};'use strict';var server=require(_0x110a('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x110a('0x1'));var mailAccount=require(_0x110a('0x2'));var setting=require(_0x110a('0x3'));var logger=require('../../config/logger')(_0x110a('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x110a('0x5')](mailAccount[_0x110a('0x6')]())['then'](realtime['initMailAccounts']())[_0x110a('0x5')](function(){email[_0x110a('0x7')](realtime[_0x110a('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x110a('0x5')](function(){return initRealtime();})[_0x110a('0x5')](function(){return setting[_0x110a('0x9')]();})[_0x110a('0x5')](function(_0xa4a0e4){return setInterval(initRealtime,_0xa4a0e4[_0x110a('0xa')]*0x3e8);})['catch'](function(_0x1ad1b0){logger['error'](_0x110a('0xb'),_0x1ad1b0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 23e9464..dc460e9 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 _0x9f25=['verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird','ioredis','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','handleImapEnd','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','smtp','send'];(function(_0x42c069,_0xdfa0f9){var _0x4f0740=function(_0x4c9fd9){while(--_0x4c9fd9){_0x42c069['push'](_0x42c069['shift']());}};_0x4f0740(++_0xdfa0f9);}(_0x9f25,0x1a2));var _0x59f2=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x9f25[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0x59f2('0x0'));var moment=require(_0x59f2('0x1'));var BPromise=require(_0x59f2('0x2'));var md5=require('md5');var Redis=require(_0x59f2('0x3'));var config=require('../../../config/environment');var logger=require(_0x59f2('0x4'))(_0x59f2('0x5'));config[_0x59f2('0x6')]=_['defaults'](config[_0x59f2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x59f2('0x7'))(new Redis(config[_0x59f2('0x6')]));var EmailImap=require(_0x59f2('0x8'));var EmailSmtp=require(_0x59f2('0x9'));var mailAccount=require(_0x59f2('0xa'));var md5Accounts={};function EmailChannel(_0x1ab9a3){logger['info'](_0x59f2('0xb'));this[_0x59f2('0xc')]=_0x1ab9a3[_0x59f2('0xc')];this[_0x59f2('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x59f2('0xe')][_0x59f2('0xf')]=function(_0x3f93ec){var _0x35673a=this['mailAccounts'][_0x3f93ec];var _0x45badf={'id':_0x35673a['id'],'name':_0x35673a[_0x59f2('0x10')],'key':_0x35673a[_0x59f2('0x11')],'active':_0x35673a[_0x59f2('0x12')],'Imap':{'status':_0x35673a[_0x59f2('0x13')][_0x59f2('0x14')],'messageStatus':_0x35673a[_0x59f2('0x13')][_0x59f2('0x15')],'total':_0x35673a[_0x59f2('0x13')][_0x59f2('0x16')]}};if(_[_0x59f2('0x17')](md5Accounts[_0x3f93ec])){md5Accounts[_0x3f93ec]={};}var _0x477c59=md5(JSON[_0x59f2('0x18')](_0x45badf));if(md5Accounts[_0x3f93ec]['md5']!==_0x477c59){md5Accounts[_0x3f93ec][_0x59f2('0x19')]=_0x477c59;io[_0x59f2('0xf')](_0x59f2('0x1a'),_0x45badf);}};EmailChannel[_0x59f2('0xe')]['refresh']=function(_0xbed1dc){for(var _0x1c9df1 in _0xbed1dc){if(_0xbed1dc[_0x59f2('0x1b')](_0x1c9df1)){if(_0xbed1dc[_0x1c9df1][_0x59f2('0x13')]&&_0xbed1dc[_0x1c9df1][_0x59f2('0x12')]){var _0x507cee=_0xbed1dc[_0x1c9df1]['Imap'];if(!_0x507cee[_0x59f2('0x1c')]&&_0xbed1dc[_0x1c9df1][_0x59f2('0x1d')]!==_0x59f2('0x1e'))_0x507cee['service']=_0xbed1dc[_0x1c9df1][_0x59f2('0x1d')];if(!this[_0x59f2('0xd')][_0x59f2('0x1b')](_0x507cee['id'])){this[_0x59f2('0xd')][_0x507cee['id']]=new EmailImap(_0x507cee,_0xbed1dc[_0x1c9df1]['email']);this[_0x59f2('0xd')][_0x507cee['id']]['on'](_0x59f2('0x1f'),this[_0x59f2('0x20')]['bind'](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on'](_0x59f2('0x5'),this[_0x59f2('0x21')][_0x59f2('0x22')](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on']('end',this[_0x59f2('0x23')][_0x59f2('0x22')](this,_0x1c9df1));this[_0x59f2('0xd')][_0x507cee['id']]['on']('error',this['handleImapError'][_0x59f2('0x22')](this,_0x1c9df1));}}else{if(_[_0x59f2('0x17')](this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')])){this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')]={};}this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')][_0x59f2('0x14')]=_0x59f2('0x24');this[_0x59f2('0xc')][_0x1c9df1][_0x59f2('0x13')][_0x59f2('0x15')]='';this['emit'](_0x1c9df1);}}}};EmailChannel[_0x59f2('0xe')]['handleImapBox']=function(_0x12e8b8,_0x5dfe37){if(this['mailAccounts'][_0x12e8b8]){this[_0x59f2('0xc')][_0x12e8b8][_0x59f2('0x13')][_0x59f2('0x14')]='connected';this[_0x59f2('0xc')][_0x12e8b8][_0x59f2('0x13')][_0x59f2('0x15')]=_0x5dfe37[_0x59f2('0x10')];if(_0x5dfe37[_0x59f2('0x25')]){this[_0x59f2('0xc')][_0x12e8b8]['Imap']['total']=_0x5dfe37[_0x59f2('0x25')][_0x59f2('0x16')];}return this['emit'](_0x12e8b8);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x21')]=function(_0x253917,_0x1f8581){logger['info'](_0x59f2('0x26'),_0x1f8581[_0x59f2('0x27')],_0x1f8581[_0x59f2('0x28')],_0x1f8581[_0x59f2('0x29')],_0x253917);if(this[_0x59f2('0xc')][_0x253917]){return mailAccount[_0x59f2('0x2a')](_0x253917,_0x1f8581)[_0x59f2('0x2b')](function(_0x4231e9){if(_0x4231e9){logger[_0x59f2('0x2c')](_0x59f2('0x2d'));}})[_0x59f2('0x2e')](function(_0x2ddfe9){logger[_0x59f2('0x2f')](_0x59f2('0x30'),JSON[_0x59f2('0x18')](_0x2ddfe9));});}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x23')]=function(_0x4e42a2){if(this[_0x59f2('0xc')][_0x4e42a2]&&this[_0x59f2('0xc')][_0x4e42a2]['Imap']){if(this['imapAccounts'][this[_0x59f2('0xc')][_0x4e42a2]['Imap']['id']]){delete this['imapAccounts'][this[_0x59f2('0xc')][_0x4e42a2][_0x59f2('0x13')]['id']];}this[_0x59f2('0xc')][_0x4e42a2]['Imap'][_0x59f2('0x31')]=moment();this[_0x59f2('0xf')](_0x4e42a2);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x32')]=function(_0x5e3f75,_0x1228d6){if(this[_0x59f2('0xc')][_0x5e3f75]){this[_0x59f2('0xc')][_0x5e3f75]['Imap'][_0x59f2('0x14')]=_0x59f2('0x2f');this[_0x59f2('0xc')][_0x5e3f75][_0x59f2('0x13')][_0x59f2('0x15')]=_0x1228d6;return this[_0x59f2('0xf')](_0x5e3f75);}};EmailChannel[_0x59f2('0xe')][_0x59f2('0x33')]=function(_0x391028,_0x4c860b){return this[_0x59f2('0x34')][_0x59f2('0x35')](_0x391028,_0x4c860b);};EmailChannel['prototype'][_0x59f2('0x36')]=function(_0x2776c3){var _0x4dc206=this;if(this['mailAccounts'][_0x2776c3['id']]){if(_[_0x59f2('0x17')](this[_0x59f2('0xc')][_0x2776c3['id']]['Smtp'])){this['mailAccounts'][_0x2776c3['id']][_0x59f2('0x37')]={};}this[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')][_0x59f2('0x31')]=moment();return new BPromise(function(_0x53afeb,_0x746f6e){return _0x4dc206['smtp']['verify'](_0x2776c3)[_0x59f2('0x2b')](function(_0xe49979){_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']]['Smtp']['status']=_0x59f2('0x38');_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')]['messageStatus']='';_0x4dc206[_0x59f2('0xf')](_0x2776c3['id']);_0x53afeb(_0xe49979);})[_0x59f2('0x2e')](function(_0x48cbfd){_0x4dc206['mailAccounts'][_0x2776c3['id']][_0x59f2('0x37')]['status']=_0x59f2('0x2f');_0x4dc206[_0x59f2('0xc')][_0x2776c3['id']][_0x59f2('0x37')]['messageStatus']=_0x48cbfd;_0x4dc206[_0x59f2('0xf')](_0x2776c3['id']);_0x746f6e(_0x48cbfd);});});}return this[_0x59f2('0x34')][_0x59f2('0x39')](_0x2776c3);};module[_0x59f2('0x3a')]=EmailChannel; \ No newline at end of file +var _0x180e=['email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','stringify','mailAccount:update','refresh','hasOwnProperty','provider','service','box','handleImapBox','bind','end','error','handleImapError','isNil','disabled','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','../../../config/environment','../../../config/logger'];(function(_0x42bbab,_0x49a7cb){var _0x55536a=function(_0x4833f2){while(--_0x4833f2){_0x42bbab['push'](_0x42bbab['shift']());}};_0x55536a(++_0x49a7cb);}(_0x180e,0xa9));var _0xe180=function(_0x584da3,_0x388a44){_0x584da3=_0x584da3-0x0;var _0x37aeb9=_0x180e[_0x584da3];return _0x37aeb9;};'use strict';var _=require(_0xe180('0x0'));var moment=require(_0xe180('0x1'));var BPromise=require('bluebird');var md5=require(_0xe180('0x2'));var Redis=require('ioredis');var config=require(_0xe180('0x3'));var logger=require(_0xe180('0x4'))(_0xe180('0x5'));config[_0xe180('0x6')]=_[_0xe180('0x7')](config[_0xe180('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe180('0x8'))(new Redis(config[_0xe180('0x6')]));var EmailImap=require(_0xe180('0x9'));var EmailSmtp=require(_0xe180('0xa'));var mailAccount=require(_0xe180('0xb'));var md5Accounts={};function EmailChannel(_0x5bb7a4){logger[_0xe180('0xc')](_0xe180('0xd'));this[_0xe180('0xe')]=_0x5bb7a4[_0xe180('0xe')];this[_0xe180('0xf')]={};this[_0xe180('0x10')]=new EmailSmtp();}EmailChannel[_0xe180('0x11')][_0xe180('0x12')]=function(_0x3c49ad){var _0x2c26e1=this[_0xe180('0xe')][_0x3c49ad];var _0x2486f0={'id':_0x2c26e1['id'],'name':_0x2c26e1[_0xe180('0x13')],'key':_0x2c26e1[_0xe180('0x14')],'active':_0x2c26e1[_0xe180('0x15')],'Imap':{'status':_0x2c26e1[_0xe180('0x16')][_0xe180('0x17')],'messageStatus':_0x2c26e1['Imap'][_0xe180('0x18')],'total':_0x2c26e1['Imap']['total']}};if(_['isNil'](md5Accounts[_0x3c49ad])){md5Accounts[_0x3c49ad]={};}var _0x4b4e78=md5(JSON[_0xe180('0x19')](_0x2486f0));if(md5Accounts[_0x3c49ad]['md5']!==_0x4b4e78){md5Accounts[_0x3c49ad]['md5']=_0x4b4e78;io['emit'](_0xe180('0x1a'),_0x2486f0);}};EmailChannel[_0xe180('0x11')][_0xe180('0x1b')]=function(_0x22a22e){for(var _0x3a2889 in _0x22a22e){if(_0x22a22e[_0xe180('0x1c')](_0x3a2889)){if(_0x22a22e[_0x3a2889][_0xe180('0x16')]&&_0x22a22e[_0x3a2889][_0xe180('0x15')]){var _0x12f362=_0x22a22e[_0x3a2889][_0xe180('0x16')];if(!_0x12f362['service']&&_0x22a22e[_0x3a2889][_0xe180('0x1d')]!=='custom')_0x12f362[_0xe180('0x1e')]=_0x22a22e[_0x3a2889][_0xe180('0x1d')];if(!this['imapAccounts'][_0xe180('0x1c')](_0x12f362['id'])){this[_0xe180('0xf')][_0x12f362['id']]=new EmailImap(_0x12f362,_0x22a22e[_0x3a2889][_0xe180('0x5')]);this[_0xe180('0xf')][_0x12f362['id']]['on'](_0xe180('0x1f'),this[_0xe180('0x20')][_0xe180('0x21')](this,_0x3a2889));this[_0xe180('0xf')][_0x12f362['id']]['on'](_0xe180('0x5'),this['handleImapEmail'][_0xe180('0x21')](this,_0x3a2889));this[_0xe180('0xf')][_0x12f362['id']]['on'](_0xe180('0x22'),this['handleImapEnd']['bind'](this,_0x3a2889));this[_0xe180('0xf')][_0x12f362['id']]['on'](_0xe180('0x23'),this[_0xe180('0x24')][_0xe180('0x21')](this,_0x3a2889));}}else{if(_[_0xe180('0x25')](this['mailAccounts'][_0x3a2889]['Imap'])){this['mailAccounts'][_0x3a2889]['Imap']={};}this[_0xe180('0xe')][_0x3a2889][_0xe180('0x16')][_0xe180('0x17')]=_0xe180('0x26');this[_0xe180('0xe')][_0x3a2889][_0xe180('0x16')]['messageStatus']='';this[_0xe180('0x12')](_0x3a2889);}}}};EmailChannel[_0xe180('0x11')][_0xe180('0x20')]=function(_0x37dc65,_0x598390){if(this[_0xe180('0xe')][_0x37dc65]){this[_0xe180('0xe')][_0x37dc65]['Imap'][_0xe180('0x17')]='connected';this[_0xe180('0xe')][_0x37dc65][_0xe180('0x16')][_0xe180('0x18')]=_0x598390[_0xe180('0x13')];if(_0x598390[_0xe180('0x27')]){this['mailAccounts'][_0x37dc65][_0xe180('0x16')][_0xe180('0x28')]=_0x598390[_0xe180('0x27')][_0xe180('0x28')];}return this['emit'](_0x37dc65);}};EmailChannel[_0xe180('0x11')][_0xe180('0x29')]=function(_0x229928,_0x134bc9){logger[_0xe180('0xc')](_0xe180('0x2a'),_0x134bc9[_0xe180('0x2b')],_0x134bc9[_0xe180('0x2c')],_0x134bc9['from'],_0x229928);if(this[_0xe180('0xe')][_0x229928]){return mailAccount['notify'](_0x229928,_0x134bc9)[_0xe180('0x2d')](function(_0x4a248a){if(_0x4a248a){logger[_0xe180('0xc')](_0xe180('0x2e'));}})[_0xe180('0x2f')](function(_0x10812f){logger['error'](_0xe180('0x30'),JSON['stringify'](_0x10812f));});}};EmailChannel['prototype'][_0xe180('0x31')]=function(_0x13ad2d){if(this[_0xe180('0xe')][_0x13ad2d]&&this['mailAccounts'][_0x13ad2d][_0xe180('0x16')]){if(this[_0xe180('0xf')][this['mailAccounts'][_0x13ad2d][_0xe180('0x16')]['id']]){delete this[_0xe180('0xf')][this['mailAccounts'][_0x13ad2d]['Imap']['id']];}this[_0xe180('0xe')][_0x13ad2d][_0xe180('0x16')][_0xe180('0x32')]=moment();this['emit'](_0x13ad2d);}};EmailChannel[_0xe180('0x11')]['handleImapError']=function(_0x5e9757,_0x57b064){if(this[_0xe180('0xe')][_0x5e9757]){this['mailAccounts'][_0x5e9757][_0xe180('0x16')][_0xe180('0x17')]=_0xe180('0x23');this[_0xe180('0xe')][_0x5e9757][_0xe180('0x16')][_0xe180('0x18')]=_0x57b064;return this['emit'](_0x5e9757);}};EmailChannel['prototype'][_0xe180('0x33')]=function(_0x3897e4,_0x326d7f){return this[_0xe180('0x10')][_0xe180('0x34')](_0x3897e4,_0x326d7f);};EmailChannel[_0xe180('0x11')][_0xe180('0x35')]=function(_0x52df3f){var _0x3853fd=this;if(this['mailAccounts'][_0x52df3f['id']]){if(_['isNil'](this['mailAccounts'][_0x52df3f['id']][_0xe180('0x36')])){this[_0xe180('0xe')][_0x52df3f['id']][_0xe180('0x36')]={};}this[_0xe180('0xe')][_0x52df3f['id']][_0xe180('0x36')][_0xe180('0x32')]=moment();return new BPromise(function(_0x3c4c3f,_0x5a0890){return _0x3853fd[_0xe180('0x10')][_0xe180('0x37')](_0x52df3f)['then'](function(_0x30dbc6){_0x3853fd[_0xe180('0xe')][_0x52df3f['id']][_0xe180('0x36')]['status']=_0xe180('0x38');_0x3853fd[_0xe180('0xe')][_0x52df3f['id']][_0xe180('0x36')][_0xe180('0x18')]='';_0x3853fd[_0xe180('0x12')](_0x52df3f['id']);_0x3c4c3f(_0x30dbc6);})[_0xe180('0x2f')](function(_0x51c334){_0x3853fd[_0xe180('0xe')][_0x52df3f['id']]['Smtp'][_0xe180('0x17')]=_0xe180('0x23');_0x3853fd[_0xe180('0xe')][_0x52df3f['id']][_0xe180('0x36')]['messageStatus']=_0x51c334;_0x3853fd[_0xe180('0x12')](_0x52df3f['id']);_0x5a0890(_0x51c334);});});}return this[_0xe180('0x10')][_0xe180('0x37')](_0x52df3f);};module[_0xe180('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6ddc4b7..2f028a8 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 _0x7de4=['account','getAccount','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','stringify','textCode','upperFirst','exports','lodash','mailparser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox'];(function(_0x108c05,_0x5c0ab3){var _0xa8c533=function(_0x48aad4){while(--_0x48aad4){_0x108c05['push'](_0x108c05['shift']());}};_0xa8c533(++_0x5c0ab3);}(_0x7de4,0x1d7));var _0x47de=function(_0xd4d52e,_0xc2655a){_0xd4d52e=_0xd4d52e-0x0;var _0x4354bc=_0x7de4[_0xd4d52e];return _0x4354bc;};'use strict';var _=require(_0x47de('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x47de('0x1'))['simpleParser'];var Iconv=require(_0x47de('0x2'))[_0x47de('0x3')];var EventEmitter=require('events')[_0x47de('0x4')];var utils=require(_0x47de('0x5'));var logger=require(_0x47de('0x6'))(_0x47de('0x7'));function EmailImap(_0x228246,_0x926778){this[_0x47de('0x8')]=_0x228246[_0x47de('0x8')];this[_0x47de('0x9')]=this[_0x47de('0xa')](_0x228246,_0x926778);this[_0x47de('0xb')]=new Imap(this[_0x47de('0x9')]);this[_0x47de('0xb')]['once'](_0x47de('0xc'),this[_0x47de('0xd')][_0x47de('0xe')](this));this[_0x47de('0xb')][_0x47de('0xf')](_0x47de('0x10'),this[_0x47de('0x11')][_0x47de('0xe')](this));this['imap']['on'](_0x47de('0x12'),this[_0x47de('0x13')][_0x47de('0xe')](this));this[_0x47de('0xb')]['connect']();}util[_0x47de('0x14')](EmailImap,EventEmitter);EmailImap[_0x47de('0x15')][_0x47de('0xa')]=function(_0x49bad6,_0x476974){var _0x134cc5={'connTimeout':_0x49bad6['connTimeout']?_0x49bad6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x49bad6[_0x47de('0x16')]?_0x49bad6[_0x47de('0x16')]*0x3e8:0x1388};if(_0x49bad6[_0x47de('0x17')]){_0x134cc5[_0x47de('0x18')]=_0x49bad6['user'];if(_0x49bad6[_0x47de('0x19')]){_0x134cc5['xoauth2']=utils[_0x47de('0x1a')](_0x49bad6[_0x47de('0x1b')][_0x47de('0x1c')],_0x49bad6[_0x47de('0x18')]);}else{_0x134cc5[_0x47de('0x1d')]=_0x49bad6[_0x47de('0x1d')];}}else{if(_0x49bad6[_0x47de('0x1e')]){_0x134cc5[_0x47de('0x18')]=_0x49bad6[_0x47de('0x18')];_0x134cc5[_0x47de('0x1d')]=_0x49bad6[_0x47de('0x1d')];}}_0x134cc5[_0x47de('0x7')]=_0x476974||_0x49bad6[_0x47de('0x18')]||'anonymous@xcally.com';_0x134cc5['host']=_0x49bad6[_0x47de('0x1f')];_0x134cc5[_0x47de('0x20')]=_0x49bad6[_0x47de('0x20')]||0x3e1;if(_0x49bad6[_0x47de('0x21')]){_0x134cc5[_0x47de('0x21')]=!![];}else{_0x134cc5[_0x47de('0x21')]=![];_0x134cc5[_0x47de('0x22')]=_0x47de('0x23');}return _0x134cc5;};EmailImap['prototype'][_0x47de('0xd')]=function(){this[_0x47de('0xb')][_0x47de('0x24')](this['mailbox'],![],this[_0x47de('0x25')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')][_0x47de('0x25')]=function(_0x1c610b,_0x51601a){if(_0x1c610b){this[_0x47de('0x13')](_0x1c610b,!![]);}else{this[_0x47de('0x26')](_0x47de('0x27'),_0x51601a);this[_0x47de('0x28')]();}};EmailImap['prototype'][_0x47de('0x29')]=function(_0xf5971e){if(_0xf5971e){this[_0x47de('0x13')](_0xf5971e,!![]);}else{this[_0x47de('0xb')][_0x47de('0x10')]();}};EmailImap[_0x47de('0x15')][_0x47de('0x28')]=function(){this[_0x47de('0xb')][_0x47de('0x2a')]([_0x47de('0x2b')],this[_0x47de('0x2c')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')][_0x47de('0x2c')]=function(_0x2ead95,_0x3af8fa){if(_0x2ead95){this[_0x47de('0x13')](_0x2ead95,!![]);}else{if(_0x3af8fa[_0x47de('0x2d')]){try{var _0x36d411=this[_0x47de('0xb')][_0x47de('0x2e')](_0x3af8fa,{'bodies':'','markSeen':!![]});_0x36d411['on'](_0x47de('0x2f'),this[_0x47de('0x30')][_0x47de('0xe')](this));_0x36d411[_0x47de('0xf')]('error',this[_0x47de('0x31')]['bind'](this));_0x36d411['once']('end',this[_0x47de('0x32')][_0x47de('0xe')](this));}catch(_0x44745a){logger['error'](_0x44745a);}}else{this['imap']['closeBox'](!![],this[_0x47de('0x29')]['bind'](this));}}};EmailImap[_0x47de('0x15')][_0x47de('0x30')]=function(_0x1e23d3){_0x1e23d3['on']('body',this['handleMessageBody'][_0x47de('0xe')](this));_0x1e23d3['once'](_0x47de('0x33'),this[_0x47de('0x34')]['bind'](this));_0x1e23d3['once']('end',this[_0x47de('0x35')][_0x47de('0xe')](this));};EmailImap[_0x47de('0x15')]['handleMessageBody']=function(_0x226f13){simpleParser(_0x226f13,{'Iconv':Iconv},this[_0x47de('0x36')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x34')]=function(){};EmailImap[_0x47de('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x47de('0x15')][_0x47de('0x36')]=function(_0x25e9d3,_0x2b1200){if(_0x25e9d3){logger[_0x47de('0x12')](_0x25e9d3);}else{var _0x3f4421=this;utils['parser'](this[_0x47de('0x9')],_0x2b1200,function(_0x3469ec){_0x3f4421[_0x47de('0x26')](_0x47de('0x7'),_0x3469ec);});}};EmailImap[_0x47de('0x15')][_0x47de('0x32')]=function(){this[_0x47de('0xb')][_0x47de('0x37')](!![],this[_0x47de('0x29')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x31')]=function(_0x4a3492){this[_0x47de('0x13')](_0x4a3492);this[_0x47de('0xb')]['closeBox'](!![],this[_0x47de('0x29')]['bind'](this));};EmailImap[_0x47de('0x15')][_0x47de('0x11')]=function(){this['emit'](_0x47de('0x10'));};EmailImap[_0x47de('0x15')][_0x47de('0x13')]=function(_0x9627cb,_0x5cd48d){logger[_0x47de('0x12')](_0x47de('0x13'),this[_0x47de('0x9')][_0x47de('0x7')],JSON[_0x47de('0x38')](_0x9627cb));var _0x5d2b3f='';if(_0x9627cb){if(_0x9627cb[_0x47de('0x39')]){_0x5d2b3f=_0x9627cb['textCode'];}else{for(var _0x2cf9b0 in _0x9627cb){if(_0x9627cb['hasOwnProperty'](_0x2cf9b0)){_0x5d2b3f+=_[_0x47de('0x3a')](_0x2cf9b0)+':\x20'+_0x9627cb[_0x2cf9b0]+'\x0a';}}}}if(_0x5cd48d){this[_0x47de('0xb')]['end']();}else{this[_0x47de('0x26')](_0x47de('0x12'),_0x5d2b3f);this[_0x47de('0x26')](_0x47de('0x10'));}};module[_0x47de('0x3b')]=EmailImap; \ No newline at end of file +var _0x5462=['data5','password','authentication','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','box','handleCloseBox','handleError','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5462,0x11e));var _0x2546=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x5462[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x2546('0x0'));var util=require(_0x2546('0x1'));var Imap=require(_0x2546('0x2'));var simpleParser=require('mailparser')[_0x2546('0x3')];var Iconv=require(_0x2546('0x4'))[_0x2546('0x5')];var EventEmitter=require(_0x2546('0x6'))[_0x2546('0x7')];var utils=require(_0x2546('0x8'));var logger=require('../../../config/logger')(_0x2546('0x9'));function EmailImap(_0x437ae1,_0x268f58){this[_0x2546('0xa')]=_0x437ae1[_0x2546('0xa')];this[_0x2546('0xb')]=this['getAccount'](_0x437ae1,_0x268f58);this[_0x2546('0x2')]=new Imap(this[_0x2546('0xb')]);this[_0x2546('0x2')][_0x2546('0xc')](_0x2546('0xd'),this[_0x2546('0xe')][_0x2546('0xf')](this));this['imap'][_0x2546('0xc')](_0x2546('0x10'),this[_0x2546('0x11')][_0x2546('0xf')](this));this[_0x2546('0x2')]['on'](_0x2546('0x12'),this['handleError']['bind'](this));this[_0x2546('0x2')][_0x2546('0x13')]();}util[_0x2546('0x14')](EmailImap,EventEmitter);EmailImap[_0x2546('0x15')][_0x2546('0x16')]=function(_0x3af224,_0x4a58bd){var _0x25d52c={'connTimeout':_0x3af224[_0x2546('0x17')]?_0x3af224['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3af224['authTimeout']?_0x3af224[_0x2546('0x18')]*0x3e8:0x1388};if(_0x3af224['service']){_0x25d52c['user']=_0x3af224[_0x2546('0x19')];if(_0x3af224[_0x2546('0x1a')]){_0x25d52c['xoauth2']=utils[_0x2546('0x1b')](_0x3af224[_0x2546('0x1c')][_0x2546('0x1d')],_0x3af224[_0x2546('0x19')]);}else{_0x25d52c[_0x2546('0x1e')]=_0x3af224[_0x2546('0x1e')];}}else{if(_0x3af224[_0x2546('0x1f')]){_0x25d52c[_0x2546('0x19')]=_0x3af224[_0x2546('0x19')];_0x25d52c[_0x2546('0x1e')]=_0x3af224[_0x2546('0x1e')];}}_0x25d52c[_0x2546('0x9')]=_0x4a58bd||_0x3af224[_0x2546('0x19')]||_0x2546('0x20');_0x25d52c['host']=_0x3af224['host'];_0x25d52c['port']=_0x3af224[_0x2546('0x21')]||0x3e1;if(_0x3af224[_0x2546('0x22')]){_0x25d52c[_0x2546('0x22')]=!![];}else{_0x25d52c[_0x2546('0x22')]=![];_0x25d52c[_0x2546('0x23')]=_0x2546('0x24');}return _0x25d52c;};EmailImap[_0x2546('0x15')]['handleReady']=function(){this[_0x2546('0x2')][_0x2546('0x25')](this[_0x2546('0xa')],![],this[_0x2546('0x26')][_0x2546('0xf')](this));};EmailImap[_0x2546('0x15')][_0x2546('0x26')]=function(_0x49c995,_0x4663b0){if(_0x49c995){this['handleError'](_0x49c995,!![]);}else{this[_0x2546('0x27')](_0x2546('0x28'),_0x4663b0);this['readUnseen']();}};EmailImap['prototype'][_0x2546('0x29')]=function(_0x3b019d){if(_0x3b019d){this[_0x2546('0x2a')](_0x3b019d,!![]);}else{this[_0x2546('0x2')][_0x2546('0x10')]();}};EmailImap['prototype'][_0x2546('0x2b')]=function(){this[_0x2546('0x2')]['search']([_0x2546('0x2c')],this[_0x2546('0x2d')][_0x2546('0xf')](this));};EmailImap[_0x2546('0x15')]['handleReadUnseen']=function(_0x23bbc3,_0x537a21){if(_0x23bbc3){this[_0x2546('0x2a')](_0x23bbc3,!![]);}else{if(_0x537a21[_0x2546('0x2e')]){try{var _0x196a93=this[_0x2546('0x2')][_0x2546('0x2f')](_0x537a21,{'bodies':'','markSeen':!![]});_0x196a93['on'](_0x2546('0x30'),this[_0x2546('0x31')]['bind'](this));_0x196a93[_0x2546('0xc')](_0x2546('0x12'),this[_0x2546('0x32')][_0x2546('0xf')](this));_0x196a93[_0x2546('0xc')](_0x2546('0x10'),this[_0x2546('0x33')][_0x2546('0xf')](this));}catch(_0x191db3){logger[_0x2546('0x12')](_0x191db3);}}else{this[_0x2546('0x2')][_0x2546('0x34')](!![],this[_0x2546('0x29')][_0x2546('0xf')](this));}}};EmailImap[_0x2546('0x15')][_0x2546('0x31')]=function(_0x1a8780){_0x1a8780['on'](_0x2546('0x35'),this[_0x2546('0x36')][_0x2546('0xf')](this));_0x1a8780[_0x2546('0xc')](_0x2546('0x37'),this[_0x2546('0x38')][_0x2546('0xf')](this));_0x1a8780[_0x2546('0xc')](_0x2546('0x10'),this['handleMessageEnd'][_0x2546('0xf')](this));};EmailImap[_0x2546('0x15')][_0x2546('0x36')]=function(_0xc7825a){simpleParser(_0xc7825a,{'Iconv':Iconv},this[_0x2546('0x39')]['bind'](this));};EmailImap[_0x2546('0x15')][_0x2546('0x38')]=function(){};EmailImap[_0x2546('0x15')][_0x2546('0x3a')]=function(){};EmailImap['prototype'][_0x2546('0x39')]=function(_0x232775,_0x152007){if(_0x232775){logger[_0x2546('0x12')](_0x232775);}else{var _0x15b59a=this;utils['parser'](this['account'],_0x152007,function(_0x56658a){_0x15b59a[_0x2546('0x27')](_0x2546('0x9'),_0x56658a);});}};EmailImap[_0x2546('0x15')][_0x2546('0x33')]=function(){this[_0x2546('0x2')][_0x2546('0x34')](!![],this['handleCloseBox'][_0x2546('0xf')](this));};EmailImap['prototype'][_0x2546('0x32')]=function(_0x3c3cd3){this[_0x2546('0x2a')](_0x3c3cd3);this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x2546('0x15')][_0x2546('0x11')]=function(){this[_0x2546('0x27')](_0x2546('0x10'));};EmailImap[_0x2546('0x15')][_0x2546('0x2a')]=function(_0x48fedd,_0x141177){logger[_0x2546('0x12')](_0x2546('0x2a'),this[_0x2546('0xb')]['email'],JSON[_0x2546('0x3b')](_0x48fedd));var _0x113069='';if(_0x48fedd){if(_0x48fedd[_0x2546('0x3c')]){_0x113069=_0x48fedd[_0x2546('0x3c')];}else{for(var _0x3b96c3 in _0x48fedd){if(_0x48fedd[_0x2546('0x3d')](_0x3b96c3)){_0x113069+=_[_0x2546('0x3e')](_0x3b96c3)+':\x20'+_0x48fedd[_0x3b96c3]+'\x0a';}}}}if(_0x141177){this['imap']['end']();}else{this[_0x2546('0x27')](_0x2546('0x12'),_0x113069);this[_0x2546('0x27')](_0x2546('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index ee2c9a5..6fb83cc 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 _0xbf3f=['prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3de0da,_0x4af765){var _0x3872d8=function(_0x29a937){while(--_0x29a937){_0x3de0da['push'](_0x3de0da['shift']());}};_0x3872d8(++_0x4af765);}(_0xbf3f,0xda));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0xfbf3('0x0'));var inlineBase64=require(_0xfbf3('0x1'));function EmailSmtp(){}EmailSmtp[_0xfbf3('0x2')][_0xfbf3('0x3')]=function(_0x2780c3,_0x58a058){return new Promise(function(_0xa1979d,_0x4ab2f4){var _0x47160e=nodemailer[_0xfbf3('0x4')](_0x2780c3);_0x47160e[_0xfbf3('0x5')](_0xfbf3('0x6'),inlineBase64());_0x47160e['sendMail'](_0x58a058,function(_0x42f1dd,_0x3a225c){if(_0x42f1dd){_0x4ab2f4(_0x42f1dd[_0xfbf3('0x7')]());}else{_0xa1979d(_0x3a225c);}});});};EmailSmtp[_0xfbf3('0x2')][_0xfbf3('0x8')]=function(_0x5eba8e){return new Promise(function(_0x1eaeb1,_0x3e8a7b){var _0x379eac=nodemailer[_0xfbf3('0x4')](_0x5eba8e);_0x379eac['verify'](function(_0x5debe3,_0x4145d1){if(_0x5debe3){_0x3e8a7b(_0x5debe3[_0xfbf3('0x7')]());}else{if(_0x4145d1){_0x1eaeb1(_0x4145d1);}else{_0x3e8a7b(_0xfbf3('0x9'));}}});});};module[_0xfbf3('0xa')]=EmailSmtp; \ No newline at end of file +var _0xa7b9=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x470ac5,_0x5a068a){var _0x1f1f2c=function(_0x5ff579){while(--_0x5ff579){_0x470ac5['push'](_0x470ac5['shift']());}};_0x1f1f2c(++_0x5a068a);}(_0xa7b9,0x15e));var _0x9a7b=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xa7b9[_0x4b7b69];return _0x173b4c;};'use strict';var nodemailer=require(_0x9a7b('0x0'));var inlineBase64=require(_0x9a7b('0x1'));function EmailSmtp(){}EmailSmtp[_0x9a7b('0x2')][_0x9a7b('0x3')]=function(_0x1212ae,_0x486aa2){return new Promise(function(_0x1342db,_0x162cb2){var _0x1a6188=nodemailer[_0x9a7b('0x4')](_0x1212ae);_0x1a6188['use'](_0x9a7b('0x5'),inlineBase64());_0x1a6188[_0x9a7b('0x6')](_0x486aa2,function(_0x2f6e05,_0x4fb41b){if(_0x2f6e05){_0x162cb2(_0x2f6e05[_0x9a7b('0x7')]());}else{_0x1342db(_0x4fb41b);}});});};EmailSmtp[_0x9a7b('0x2')][_0x9a7b('0x8')]=function(_0x393358){return new Promise(function(_0x3a0608,_0x49af18){var _0x50f37a=nodemailer[_0x9a7b('0x4')](_0x393358);_0x50f37a[_0x9a7b('0x8')](function(_0x2c9707,_0x4c6042){if(_0x2c9707){_0x49af18(_0x2c9707[_0x9a7b('0x7')]());}else{if(_0x4c6042){_0x3a0608(_0x4c6042);}else{_0x49af18(_0x9a7b('0x9'));}}});});};module[_0x9a7b('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f502c0c..a2ac271 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 _0x4139=['address','anonymous','generate','@xcally.com','name','substring','length','slice','head','split','pop','html','test','replace','includes','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','randomstring','path','../../../config/logger','email','value'];(function(_0x4b55e8,_0x41ba7e){var _0x46e844=function(_0x2b1e4f){while(--_0x2b1e4f){_0x4b55e8['push'](_0x4b55e8['shift']());}};_0x46e844(++_0x41ba7e);}(_0x4139,0x121));var _0x9413=function(_0x2306fb,_0x4b1726){_0x2306fb=_0x2306fb-0x0;var _0x1e035f=_0x4139[_0x2306fb];return _0x1e035f;};'use strict';var _=require(_0x9413('0x0'));var moment=require(_0x9413('0x1'));var random=require(_0x9413('0x2'));var fs=require('fs');var path=require(_0x9413('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x9413('0x4'))(_0x9413('0x5'));var config=require('../../../config/environment');function getAddress(_0x3d390d){var _0x33219b=_['head'](_0x3d390d[_0x9413('0x6')]);return _0x33219b&&_0x33219b['address']?_0x33219b[_0x9413('0x7')]:_0x9413('0x8')+random[_0x9413('0x9')](0x6)+_0x9413('0xa');}function getFirstName(_0x3255a2){var _0x1c57d8=_['head'](_0x3255a2[_0x9413('0x6')]);if(_0x1c57d8&&_0x1c57d8[_0x9413('0xb')]){if(_0x1c57d8['name']==_0x1c57d8[_0x9413('0x7')]){return _0x1c57d8[_0x9413('0xb')][_0x9413('0xc')](0x0,_0x1c57d8['name']['indexOf']('@'));}var _0x4e49b2=_0x1c57d8[_0x9413('0xb')]['split'](/\s+/);return _0x4e49b2[_0x9413('0xd')]>0x1?_0x4e49b2[_0x9413('0xe')](0x0,-0x1)['join']('\x20'):_0x1c57d8[_0x9413('0xb')];}return'Anonymous';}function getLastName(_0x482a8b){var _0x1dd208=_[_0x9413('0xf')](_0x482a8b['value']);if(_0x1dd208&&_0x1dd208['name']){var _0x4ac332=_0x1dd208[_0x9413('0xb')][_0x9413('0x10')](/\s+/);return _0x4ac332[_0x9413('0xd')]>0x1?_0x4ac332[_0x9413('0x11')]():'';}return'';}function getMails(_0x1edf23,_0x2d4568){var _0x4f83ea='';for(var _0x5e9427=0x0;_0x5e9427<_0x2d4568[_0x9413('0x6')]['length'];_0x5e9427+=0x1){if(_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]!==_0x1edf23){if(!_['isEmpty'](_0x4f83ea)){_0x4f83ea+=',';}_0x4f83ea+=_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0xb')]||_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]||'';_0x4f83ea+='\x20<';_0x4f83ea+=_0x2d4568['value'][_0x5e9427][_0x9413('0x7')]?_0x2d4568[_0x9413('0x6')][_0x5e9427][_0x9413('0x7')]:_0x9413('0x8')+random['generate'](0x6)+'@xcally.com';_0x4f83ea+='>';}}return _0x4f83ea;}function parseEmail(_0xb2ae8c,_0x3e13b0,_0x4d1ce4){if(_0x3e13b0[_0x9413('0x12')]){var _0x256318=/)<[^<]*)*<\/script>/gi;while(_0x256318[_0x9413('0x13')](_0x3e13b0[_0x9413('0x12')])){_0x3e13b0[_0x9413('0x12')]=_0x3e13b0[_0x9413('0x12')][_0x9413('0x14')](_0x256318,'');}if(_0x3e13b0[_0x9413('0x12')][_0x9413('0x15')]('{_0x2ce243[_0x9413('0x17')](_0x4ee3ee[_0x9413('0x18')]);});var _0x306631=/]+>/g;var _0x2cc1c8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x74c803=_0x3e13b0[_0x9413('0x12')][_0x9413('0x14')](_0x2cc1c8,_0x9413('0x19'));var _0x543e00=_0x74c803['replace'](_0x306631,'_IMG');for(let _0x3763fa=0x0;_0x3763fa<_0x2ce243['length'];_0x3763fa++){var _0x2a6945=_0x543e00['replace'](_0x9413('0x1a'),_0x9413('0x1b')+_0x2ce243[_0x3763fa]+_0x9413('0x1c'));_0x543e00=_0x2a6945;}_0x3e13b0[_0x9413('0x12')]=_0x543e00;}_0x4d1ce4['body']=_0x3e13b0[_0x9413('0x12')];}else{_0x4d1ce4[_0x9413('0x1d')]=_0x3e13b0[_0x9413('0x1e')];}if(_0x4d1ce4['body']){_0x4d1ce4[_0x9413('0x1d')]=_0x4d1ce4['body'][_0x9413('0x14')](/0x0){var _0x3cfd9d=[_0x9413('0x2f'),_0x9413('0x30'),_0x9413('0x31')];for(var _0x29155b=0x0;_0x29155b<_0x3e13b0[_0x9413('0x2e')][_0x9413('0xd')];_0x29155b++){var _0x11d4b3=_[_0x9413('0x32')](_0x3cfd9d,_0x3e13b0[_0x9413('0x2e')][_0x29155b][_0x9413('0x33')]);if(_0x11d4b3>=0x0){_0x4d1ce4['isAutoreply']=!![];}}}return _0x4d1ce4;}exports['parser']=function(_0x5c3504,_0x145d6d,_0x2b2915){var _0x4a4304={'from':getAddress(_0x145d6d[_0x9413('0x34')]),'firstName':getFirstName(_0x145d6d[_0x9413('0x34')]),'lastName':getLastName(_0x145d6d[_0x9413('0x34')]),'mapKey':_0x9413('0x5'),'message':{'from':getMails(_0x5c3504['email'],_0x145d6d[_0x9413('0x34')]),'to':_0x5c3504['email'],'cc':'','subject':_0x145d6d[_0x9413('0x35')]||'','messageId':_0x145d6d['messageId'],'inReplyTo':_0x145d6d['inReplyTo'],'sentAt':moment(_0x145d6d[_0x9413('0x36')])[_0x9413('0x37')](_0x9413('0x38')),'attach':![],'attachments':[]}};if(!_0x145d6d[_0x9413('0x12')]&&!_0x145d6d['textAsHtml']){var _0x1d80a4=_[_0x9413('0x39')](_0x145d6d[_0x9413('0x25')],{'contentType':_0x9413('0x3a')});if(_0x1d80a4[_0x9413('0xd')]){logger[_0x9413('0x3b')](util[_0x9413('0x37')](_0x9413('0x3c'),_0x145d6d[_0x9413('0x3d')]));tnef['parseBuffer'](_[_0x9413('0x3e')](_0x1d80a4)[_0x9413('0x2c')],function(_0x4baca5,_0x59a48b){if(_0x59a48b){_0x145d6d[_0x9413('0x12')]=_0x59a48b['BodyHTML']||'

Empty\x20message

';if(_0x59a48b[_0x9413('0x3f')]){for(var _0x4555ba=0x0;_0x4555ba<_0x59a48b['Attachments']['length'];_0x4555ba++){var _0x86d35b=_0x59a48b['Attachments'][_0x4555ba];_0x4a4304[_0x9413('0x20')][_0x9413('0x25')][_0x9413('0x17')]({'filename':_0x86d35b[_0x9413('0x40')],'content':Buffer[_0x9413('0x34')](_0x86d35b[_0x9413('0x41')])});}}}_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));});}else{_0x145d6d[_0x9413('0x12')]=_0x9413('0x42');_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));}}else{_0x2b2915(parseEmail(_0x5c3504,_0x145d6d,_0x4a4304));}};exports[_0x9413('0x43')]=function(_0xdb1ef0,_0x573b3a){var _0xac4770=[_0x9413('0x44')+(_0x573b3a||''),_0x9413('0x45')+_0xdb1ef0,'',''];return Buffer[_0x9413('0x34')](_0xac4770[_0x9413('0x46')](''),_0x9413('0x47'))[_0x9413('0x48')](_0x9413('0x49'));}; \ No newline at end of file +var _0xe208=['lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','join','split','pop','html','test','replace','includes','attachments','forEach','_SRC','_IMG','\x20[Attachment:\x20','body','message','originTo','originCc','isEmpty','bcc','attach','type','attachment','attachment-','format','%s-%s','root','writeFileSync','push','contentType','headerLines','Precedence:\x20auto_reply','isAutoreply','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','user=','toString','base64'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xe208,0x110));var _0x8e20=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xe208[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x8e20('0x0'));var moment=require(_0x8e20('0x1'));var random=require(_0x8e20('0x2'));var fs=require('fs');var path=require(_0x8e20('0x3'));var util=require('util');var tnef=require(_0x8e20('0x4'));var logger=require(_0x8e20('0x5'))(_0x8e20('0x6'));var config=require(_0x8e20('0x7'));function getAddress(_0x19d40e){var _0x264356=_[_0x8e20('0x8')](_0x19d40e[_0x8e20('0x9')]);return _0x264356&&_0x264356[_0x8e20('0xa')]?_0x264356[_0x8e20('0xa')]:_0x8e20('0xb')+random[_0x8e20('0xc')](0x6)+_0x8e20('0xd');}function getFirstName(_0x22cc29){var _0x319e4d=_['head'](_0x22cc29['value']);if(_0x319e4d&&_0x319e4d[_0x8e20('0xe')]){if(_0x319e4d[_0x8e20('0xe')]==_0x319e4d[_0x8e20('0xa')]){return _0x319e4d[_0x8e20('0xe')][_0x8e20('0xf')](0x0,_0x319e4d[_0x8e20('0xe')][_0x8e20('0x10')]('@'));}var _0x5c5c6d=_0x319e4d[_0x8e20('0xe')]['split'](/\s+/);return _0x5c5c6d[_0x8e20('0x11')]>0x1?_0x5c5c6d[_0x8e20('0x12')](0x0,-0x1)[_0x8e20('0x13')]('\x20'):_0x319e4d[_0x8e20('0xe')];}return'Anonymous';}function getLastName(_0x558795){var _0x1f09e1=_[_0x8e20('0x8')](_0x558795[_0x8e20('0x9')]);if(_0x1f09e1&&_0x1f09e1[_0x8e20('0xe')]){var _0x24e74c=_0x1f09e1[_0x8e20('0xe')][_0x8e20('0x14')](/\s+/);return _0x24e74c[_0x8e20('0x11')]>0x1?_0x24e74c[_0x8e20('0x15')]():'';}return'';}function getMails(_0x3533e0,_0x48be63){var _0x13936d='';for(var _0x11e6b7=0x0;_0x11e6b7<_0x48be63['value']['length'];_0x11e6b7+=0x1){if(_0x48be63[_0x8e20('0x9')][_0x11e6b7][_0x8e20('0xa')]!==_0x3533e0){if(!_['isEmpty'](_0x13936d)){_0x13936d+=',';}_0x13936d+=_0x48be63[_0x8e20('0x9')][_0x11e6b7][_0x8e20('0xe')]||_0x48be63['value'][_0x11e6b7][_0x8e20('0xa')]||'';_0x13936d+='\x20<';_0x13936d+=_0x48be63[_0x8e20('0x9')][_0x11e6b7][_0x8e20('0xa')]?_0x48be63[_0x8e20('0x9')][_0x11e6b7]['address']:_0x8e20('0xb')+random[_0x8e20('0xc')](0x6)+_0x8e20('0xd');_0x13936d+='>';}}return _0x13936d;}function parseEmail(_0x1e6d23,_0xda991b,_0x4bfcc3){if(_0xda991b[_0x8e20('0x16')]){var _0x3e9ee5=/)<[^<]*)*<\/script>/gi;while(_0x3e9ee5[_0x8e20('0x17')](_0xda991b['html'])){_0xda991b[_0x8e20('0x16')]=_0xda991b[_0x8e20('0x16')][_0x8e20('0x18')](_0x3e9ee5,'');}if(_0xda991b['html'][_0x8e20('0x19')]('{_0x7dce14['push'](_0x2d948c['filename']);});var _0x46f0e5=/]+>/g;var _0x519853=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x26c3de=_0xda991b['html'][_0x8e20('0x18')](_0x519853,_0x8e20('0x1c'));var _0x593f02=_0x26c3de[_0x8e20('0x18')](_0x46f0e5,_0x8e20('0x1d'));for(let _0x45b71b=0x0;_0x45b71b<_0x7dce14[_0x8e20('0x11')];_0x45b71b++){var _0x2a07a9=_0x593f02[_0x8e20('0x18')](_0x8e20('0x1d'),_0x8e20('0x1e')+_0x7dce14[_0x45b71b]+'\x20]');_0x593f02=_0x2a07a9;}_0xda991b[_0x8e20('0x16')]=_0x593f02;}_0x4bfcc3[_0x8e20('0x1f')]=_0xda991b[_0x8e20('0x16')];}else{_0x4bfcc3[_0x8e20('0x1f')]=_0xda991b['textAsHtml'];}if(_0x4bfcc3['body']){_0x4bfcc3[_0x8e20('0x1f')]=_0x4bfcc3['body']['replace'](/0x0){var _0x503f1b=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x8e20('0x30')];for(var _0x3d58b4=0x0;_0x3d58b4<_0xda991b[_0x8e20('0x2f')][_0x8e20('0x11')];_0x3d58b4++){var _0x96db87=_[_0x8e20('0x10')](_0x503f1b,_0xda991b[_0x8e20('0x2f')][_0x3d58b4]['line']);if(_0x96db87>=0x0){_0x4bfcc3[_0x8e20('0x31')]=!![];}}}return _0x4bfcc3;}exports[_0x8e20('0x32')]=function(_0x4cc130,_0x29252c,_0x296dbf){var _0x59ed54={'from':getAddress(_0x29252c['from']),'firstName':getFirstName(_0x29252c[_0x8e20('0x33')]),'lastName':getLastName(_0x29252c[_0x8e20('0x33')]),'mapKey':_0x8e20('0x6'),'message':{'from':getMails(_0x4cc130[_0x8e20('0x6')],_0x29252c[_0x8e20('0x33')]),'to':_0x4cc130[_0x8e20('0x6')],'cc':'','subject':_0x29252c['subject']||'','messageId':_0x29252c[_0x8e20('0x34')],'inReplyTo':_0x29252c[_0x8e20('0x35')],'sentAt':moment(_0x29252c[_0x8e20('0x36')])[_0x8e20('0x29')](_0x8e20('0x37')),'attach':![],'attachments':[]}};if(!_0x29252c[_0x8e20('0x16')]&&!_0x29252c[_0x8e20('0x38')]){var _0x1c9d4e=_[_0x8e20('0x39')](_0x29252c[_0x8e20('0x1a')],{'contentType':_0x8e20('0x3a')});if(_0x1c9d4e[_0x8e20('0x11')]){logger['info'](util[_0x8e20('0x29')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x29252c['messageId']));tnef[_0x8e20('0x3b')](_[_0x8e20('0x3c')](_0x1c9d4e)['content'],function(_0x24b399,_0x6e5539){if(_0x6e5539){_0x29252c[_0x8e20('0x16')]=_0x6e5539[_0x8e20('0x3d')]||_0x8e20('0x3e');if(_0x6e5539[_0x8e20('0x3f')]){for(var _0x4711f7=0x0;_0x4711f7<_0x6e5539[_0x8e20('0x3f')][_0x8e20('0x11')];_0x4711f7++){var _0x399a2a=_0x6e5539['Attachments'][_0x4711f7];_0x59ed54['message'][_0x8e20('0x1a')][_0x8e20('0x2d')]({'filename':_0x399a2a[_0x8e20('0x40')],'content':Buffer['from'](_0x399a2a['Data'])});}}}_0x296dbf(parseEmail(_0x4cc130,_0x29252c,_0x59ed54));});}else{_0x29252c['html']='

Empty\x20message

';_0x296dbf(parseEmail(_0x4cc130,_0x29252c,_0x59ed54));}}else{_0x296dbf(parseEmail(_0x4cc130,_0x29252c,_0x59ed54));}};exports['generateXOAuth2Token']=function(_0x319e27,_0x140803){var _0x2856c9=[_0x8e20('0x41')+(_0x140803||''),'auth=Bearer\x20'+_0x319e27,'',''];return Buffer[_0x8e20('0x33')](_0x2856c9[_0x8e20('0x13')](''),'utf-8')[_0x8e20('0x42')](_0x8e20('0x43'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3884326..1690a52 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x819b=['Imap','Smtp','name','Service','key','SERV','active'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x819b,0xe9));var _0xb819=function(_0x45682b,_0x22ef44){_0x45682b=_0x45682b-0x0;var _0x28c3cd=_0x819b[_0x45682b];return _0x28c3cd;};'use strict';var _=require('lodash');function MailAccount(_0x185e59){this['id']=_0x185e59['id']||0x0;this[_0xb819('0x0')]=_0x185e59[_0xb819('0x0')]||_0xb819('0x1');this[_0xb819('0x2')]=_0x185e59[_0xb819('0x2')]||_0xb819('0x3');this[_0xb819('0x4')]=_0x185e59['active']||![];this['Imap']=_0x185e59[_0xb819('0x5')]||[];this[_0xb819('0x6')]=_0x185e59[_0xb819('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xa311=['key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xa311,0xe6));var _0x1a31=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xa311[_0x146484];return _0x4c7aa3;};'use strict';var _=require(_0x1a31('0x0'));function MailAccount(_0x30e2c5){this['id']=_0x30e2c5['id']||0x0;this['name']=_0x30e2c5[_0x1a31('0x1')]||'Service';this[_0x1a31('0x2')]=_0x30e2c5[_0x1a31('0x2')]||_0x1a31('0x3');this['active']=_0x30e2c5[_0x1a31('0x4')]||![];this[_0x1a31('0x5')]=_0x30e2c5['Imap']||[];this[_0x1a31('0x6')]=_0x30e2c5[_0x1a31('0x6')]||[];}module[_0x1a31('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 69f55f4..7e23e09 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e82=['mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','../model/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e82,0x128));var _0x26e8=function(_0x30f951,_0x3ba029){_0x30f951=_0x30f951-0x0;var _0x17cce0=_0x6e82[_0x30f951];return _0x17cce0;};'use strict';var _=require('lodash');var MailAccount=require(_0x26e8('0x0'));var Realtime=function(){this[_0x26e8('0x1')]={};};function freeIsNotKey(_0x568c09,_0x466716,_0x134520){var _0x3f293b=_[_0x26e8('0x2')](_0x568c09,function(_0x4d34af,_0x36e0e6){return _0x4d34af[_0x134520];});for(var _0x1b9581 in _0x466716){if(_0x466716[_0x26e8('0x3')](_0x1b9581)){if(!_0x3f293b[_0x1b9581]){delete _0x466716[_0x1b9581];}}}}Realtime['prototype'][_0x26e8('0x4')]=function(_0x589118,_0x4cd4cc){for(var _0x549aa2 in _0x4cd4cc){if(_0x589118[_0x26e8('0x3')](_0x549aa2)){_0x589118[_0x549aa2]=_0x4cd4cc[_0x549aa2];}}};Realtime[_0x26e8('0x5')][_0x26e8('0x6')]=function(){var _0x387a5c=this;return function(_0x7edd06){if(_0x7edd06){freeIsNotKey(_0x7edd06,_0x387a5c['mailAccounts'],'id');for(var _0x1d35e2=0x0,_0x4a90d9={},_0x2a8e39={};_0x1d35e2<_0x7edd06[_0x26e8('0x7')];_0x1d35e2+=0x1){_0x4a90d9=_0x7edd06[_0x1d35e2];if(_[_0x26e8('0x8')](_0x387a5c[_0x26e8('0x1')][_0x4a90d9['id']])){_0x387a5c[_0x26e8('0x1')][_0x4a90d9['id']]=new MailAccount(_0x4a90d9);}else{_['merge'](_0x387a5c['mailAccounts'][_0x4a90d9['id']],_0x4a90d9);}}}return _0x387a5c[_0x26e8('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9345=['mailAccounts','isUndefined','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','initMailAccounts'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x9345,0x16b));var _0x5934=function(_0x2cea58,_0x153c15){_0x2cea58=_0x2cea58-0x0;var _0x192933=_0x9345[_0x2cea58];return _0x192933;};'use strict';var _=require(_0x5934('0x0'));var MailAccount=require(_0x5934('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x33264e,_0x3afe09,_0x3351e6){var _0x3b8f8e=_[_0x5934('0x2')](_0x33264e,function(_0x273484,_0x29deaf){return _0x273484[_0x3351e6];});for(var _0x253cfb in _0x3afe09){if(_0x3afe09[_0x5934('0x3')](_0x253cfb)){if(!_0x3b8f8e[_0x253cfb]){delete _0x3afe09[_0x253cfb];}}}}Realtime['prototype'][_0x5934('0x4')]=function(_0x38ba96,_0x4f70d1){for(var _0x2c3699 in _0x4f70d1){if(_0x38ba96[_0x5934('0x3')](_0x2c3699)){_0x38ba96[_0x2c3699]=_0x4f70d1[_0x2c3699];}}};Realtime['prototype'][_0x5934('0x5')]=function(){var _0x359f9b=this;return function(_0x25ff1c){if(_0x25ff1c){freeIsNotKey(_0x25ff1c,_0x359f9b[_0x5934('0x6')],'id');for(var _0x198392=0x0,_0x59f30d={},_0x5aecc9={};_0x198392<_0x25ff1c['length'];_0x198392+=0x1){_0x59f30d=_0x25ff1c[_0x198392];if(_[_0x5934('0x7')](_0x359f9b[_0x5934('0x6')][_0x59f30d['id']])){_0x359f9b['mailAccounts'][_0x59f30d['id']]=new MailAccount(_0x59f30d);}else{_['merge'](_0x359f9b[_0x5934('0x6')][_0x59f30d['id']],_0x59f30d);}}}return _0x359f9b['mailAccounts'];};};module[_0x5934('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 87ead87..f1f644e 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8daf=['CloudProvider','type','service','data5','getMailAccount','notify','Request','NotifyMailAccount','name','provider','email','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x8daf,0x15c));var _0xf8da=function(_0xc67594,_0x25a6f3){_0xc67594=_0xc67594-0x0;var _0x2f9020=_0x8daf[_0xc67594];return _0x2f9020;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xf8da('0x0'),_0xf8da('0x1'),'service',_0xf8da('0x2'),_0xf8da('0x3'),_0xf8da('0x4'),_0xf8da('0x5'),_0xf8da('0x6')],'raw':![],'include':[{'model':_0xf8da('0x7'),'as':_0xf8da('0x8'),'include':[{'model':_0xf8da('0x9'),'attributes':['id',_0xf8da('0x0'),'service',_0xf8da('0xa'),'data5'],'as':_0xf8da('0x9')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xf8da('0x9'),'attributes':['id',_0xf8da('0x0'),_0xf8da('0xb'),_0xf8da('0xa'),_0xf8da('0xc')],'as':_0xf8da('0x9')}]}]},'log':_0xf8da('0xd')});};};exports[_0xf8da('0xe')]=function(_0x5313ea,_0xa8a3eb){return client[_0xf8da('0xf')](_0xf8da('0x10'),{'account':{'id':_0x5313ea},'body':_0xa8a3eb,'log':_0xf8da('0x10')});}; \ No newline at end of file +var _0x975b=['GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x975b,0x1c9));var _0xb975=function(_0x158fb6,_0x19a217){_0x158fb6=_0x158fb6-0x0;var _0x2f7db1=_0x975b[_0x158fb6];return _0x2f7db1;};'use strict';var client=require(_0xb975('0x0'));exports[_0xb975('0x1')]=function(){return function(){return client[_0xb975('0x2')](_0xb975('0x3'),{'options':{'attributes':['id',_0xb975('0x4'),_0xb975('0x5'),_0xb975('0x6'),'email',_0xb975('0x7'),_0xb975('0x8'),_0xb975('0x9'),_0xb975('0xa')],'raw':![],'include':[{'model':_0xb975('0xb'),'as':_0xb975('0xc'),'include':[{'model':_0xb975('0xd'),'attributes':['id','name',_0xb975('0x6'),_0xb975('0xe'),_0xb975('0xf')],'as':'CloudProvider'}]},{'model':_0xb975('0x10'),'as':_0xb975('0x11'),'include':[{'model':_0xb975('0xd'),'attributes':['id','name',_0xb975('0x6'),'type',_0xb975('0xf')],'as':'CloudProvider'}]}]},'log':_0xb975('0x12')});};};exports['notify']=function(_0x96010,_0x428650){return client[_0xb975('0x2')](_0xb975('0x13'),{'account':{'id':_0x96010},'body':_0x428650,'log':_0xb975('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 4ecdc2f..f49dc30 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdead=['ShowSetting','loginMailFrequency','GetSettings','Request'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xdead,0xa3));var _0xddea=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0xdead[_0x49f67f];return _0x4779a1;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xddea('0x0')](_0xddea('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xddea('0x2')]},'log':_0xddea('0x3')});}; \ No newline at end of file +var _0x4ec5=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4ec5,0x12b));var _0x54ec=function(_0x3a65b1,_0x168d9a){_0x3a65b1=_0x3a65b1-0x0;var _0x4cd85b=_0x4ec5[_0x3a65b1];return _0x4cd85b;};'use strict';var client=require(_0x54ec('0x0'));exports['getSettings']=function(){return client[_0x54ec('0x1')](_0x54ec('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x54ec('0x3')]},'log':_0x54ec('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d55727d..4b19765 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index ef38a8e..7d1dbf4 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaafb=['redis','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','createServer','listen','socket.io','websocket','polling'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0xaafb,0x108));var _0xbaaf=function(_0x19fe15,_0x1d5693){_0x19fe15=_0x19fe15-0x0;var _0x32da73=_0xaafb[_0x19fe15];return _0x32da73;};'use strict';var _=require(_0xbaaf('0x0'));var http=require(_0xbaaf('0x1'));var express=require(_0xbaaf('0x2'));var sticky=require('sticky-session');var Redis=require(_0xbaaf('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xbaaf('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xbaaf('0x5')](server,config['port'])){var socketio=require(_0xbaaf('0x6'))(server,{'transports':[_0xbaaf('0x7'),_0xbaaf('0x8')]});config[_0xbaaf('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0xbaaf('0xa')](require(_0xbaaf('0xb'))({'pubClient':new Redis(config[_0xbaaf('0x9')]),'subClient':new Redis(config[_0xbaaf('0x9')])}));require(_0xbaaf('0xc'))['default']();require(_0xbaaf('0xd'))[_0xbaaf('0xe')](socketio);require(_0xbaaf('0xf'))['default'](app);require('../../routes')[_0xbaaf('0xe')](app);}else{server[_0xbaaf('0x10')](_0xbaaf('0x11'),function(){console[_0xbaaf('0x12')](_0xbaaf('0x13'),config['port']);});}exports=module[_0xbaaf('0x14')]=app; \ No newline at end of file +var _0x8162=['default','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','ioredis','createServer','listen','port','socket.io','websocket','polling','redis','defaults','localhost','../../config/triggers'];(function(_0xb54216,_0x30b244){var _0x5a6f7e=function(_0x3fa461){while(--_0x3fa461){_0xb54216['push'](_0xb54216['shift']());}};_0x5a6f7e(++_0x30b244);}(_0x8162,0x15c));var _0x2816=function(_0xe5091f,_0xca0ac7){_0xe5091f=_0xe5091f-0x0;var _0x33e3d4=_0x8162[_0xe5091f];return _0x33e3d4;};'use strict';var _=require(_0x2816('0x0'));var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x2816('0x1'));var config=require('../../config/environment');var app=express();var server=http[_0x2816('0x2')](app);server['timeout']=0xdbba0;if(sticky[_0x2816('0x3')](server,config[_0x2816('0x4')])){var socketio=require(_0x2816('0x5'))(server,{'transports':[_0x2816('0x6'),_0x2816('0x7')]});config[_0x2816('0x8')]=_[_0x2816('0x9')](config['redis'],{'host':_0x2816('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x2816('0x8')]),'subClient':new Redis(config[_0x2816('0x8')])}));require(_0x2816('0xb'))[_0x2816('0xc')]();require('../../config/socketio')[_0x2816('0xc')](socketio);require('../../config/express')[_0x2816('0xc')](app);require(_0x2816('0xd'))[_0x2816('0xc')](app);}else{server[_0x2816('0xe')]('listening',function(){console[_0x2816('0xf')](_0x2816('0x10'),config[_0x2816('0x4')]);});}exports=module[_0x2816('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2477aae..c06ebe8 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e84=['routing','client','http','Request','debug','rpc','error','message','result','exports','jayson/promise','bluebird'];(function(_0x17e750,_0x26c72a){var _0xb6974e=function(_0x17c127){while(--_0x17c127){_0x17e750['push'](_0x17e750['shift']());}};_0xb6974e(++_0x26c72a);}(_0x8e84,0xb2));var _0x48e8=function(_0x7c041a,_0x5a2621){_0x7c041a=_0x7c041a-0x0;var _0x3177dd=_0x8e84[_0x7c041a];return _0x3177dd;};'use strict';var jayson=require(_0x48e8('0x0'));var BPromise=require(_0x48e8('0x1'));var logger=require('../../config/logger')(_0x48e8('0x2'));var client=jayson[_0x48e8('0x3')][_0x48e8('0x4')]({'port':0x2329});client[_0x48e8('0x5')]=function(_0x24515b,_0x550523){return new BPromise(function(_0x361c37,_0xa0d7f2){return client['request'](_0x24515b,_0x550523)['then'](function(_0x1d0cd6){logger[_0x48e8('0x6')](_0x48e8('0x7'),_0x48e8('0x2'),_0x24515b,_0x550523,_0x1d0cd6);if(_0x1d0cd6[_0x48e8('0x8')]){logger[_0x48e8('0x8')]('rpc',_0x48e8('0x2'),_0x24515b,_0x1d0cd6[_0x48e8('0x8')][_0x48e8('0x9')],_0x550523);return _0xa0d7f2(_0x1d0cd6[_0x48e8('0x8')][_0x48e8('0x9')]);}else{return _0x361c37(_0x1d0cd6[_0x48e8('0xa')]);}})['catch'](function(_0x5431d1){logger['error']('rpc','routing',_0x24515b,_0x5431d1,_0x550523);return _0xa0d7f2(_0x5431d1);});});};module[_0x48e8('0xb')]=client; \ No newline at end of file +var _0x63f3=['message','result','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','debug','routing','error','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63f3,0xfa));var _0x363f=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x63f3[_0x2e50a2];return _0x47e5de;};'use strict';var jayson=require(_0x363f('0x0'));var BPromise=require(_0x363f('0x1'));var logger=require(_0x363f('0x2'))('routing');var client=jayson['client'][_0x363f('0x3')]({'port':0x2329});client[_0x363f('0x4')]=function(_0xd07aaa,_0x276c9d){return new BPromise(function(_0x50866a,_0x1971b6){return client['request'](_0xd07aaa,_0x276c9d)[_0x363f('0x5')](function(_0x3020b8){logger[_0x363f('0x6')]('rpc',_0x363f('0x7'),_0xd07aaa,_0x276c9d,_0x3020b8);if(_0x3020b8['error']){logger[_0x363f('0x8')](_0x363f('0x9'),'routing',_0xd07aaa,_0x3020b8[_0x363f('0x8')][_0x363f('0xa')],_0x276c9d);return _0x1971b6(_0x3020b8[_0x363f('0x8')][_0x363f('0xa')]);}else{return _0x50866a(_0x3020b8[_0x363f('0xb')]);}})['catch'](function(_0x9c41b3){logger[_0x363f('0x8')]('rpc',_0x363f('0x7'),_0xd07aaa,_0x9c41b3,_0x276c9d);return _0x1971b6(_0x9c41b3);});});};module[_0x363f('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5f7c02b..b593e45 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7090=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals'];(function(_0x1d8a34,_0x497fca){var _0xcae4c1=function(_0x1124bc){while(--_0x1124bc){_0x1d8a34['push'](_0x1d8a34['shift']());}};_0xcae4c1(++_0x497fca);}(_0x7090,0x140));var _0x0709=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x7090[_0xf16b1];return _0x26f94d;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x0709('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x0709('0x1'));var chatQueue=require(_0x0709('0x2'));var smsQueue=require(_0x0709('0x3'));var mailQueue=require(_0x0709('0x4'));var faxQueue=require(_0x0709('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x0709('0x6')](user[_0x0709('0x7')]())[_0x0709('0x6')](realtime[_0x0709('0x8')]())[_0x0709('0x6')](interval[_0x0709('0x9')]())['then'](realtime[_0x0709('0xa')]())[_0x0709('0x6')](openchannelQueue[_0x0709('0xb')]())[_0x0709('0x6')](realtime[_0x0709('0xc')]())[_0x0709('0x6')](chatQueue['getChatQueues']())[_0x0709('0x6')](realtime[_0x0709('0xd')]())[_0x0709('0x6')](smsQueue[_0x0709('0xe')]())[_0x0709('0x6')](realtime[_0x0709('0xf')]())['then'](mailQueue['getMailQueues']())[_0x0709('0x6')](realtime[_0x0709('0x10')]())[_0x0709('0x6')](faxQueue['getFaxQueues']())[_0x0709('0x6')](realtime[_0x0709('0x11')]())[_0x0709('0x6')](whatsappQueue[_0x0709('0x12')]())[_0x0709('0x6')](realtime['initWhatsappQueues']())[_0x0709('0x6')](function(){return realtime;});}function main(){return server[_0x0709('0x13')](realtime)[_0x0709('0x6')](function(_0x28e748){return initRealtime();})[_0x0709('0x6')](function(_0x47f550){return setInterval(initRealtime,0x1388);})[_0x0709('0x14')](function(_0x193346){console[_0x0709('0x15')](_0x193346);});}main(); \ No newline at end of file +var _0xaf88=['getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','initAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xaf88,0x1e7));var _0x8af8=function(_0x27480c,_0x43a74a){_0x27480c=_0x27480c-0x0;var _0x2b088b=_0xaf88[_0x27480c];return _0x2b088b;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x8af8('0x0'));var user=require(_0x8af8('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8af8('0x2'));var smsQueue=require(_0x8af8('0x3'));var mailQueue=require(_0x8af8('0x4'));var faxQueue=require(_0x8af8('0x5'));var whatsappQueue=require(_0x8af8('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8af8('0x7')]()['then'](user['getAgents']())['then'](realtime[_0x8af8('0x8')]())[_0x8af8('0x9')](interval[_0x8af8('0xa')]())['then'](realtime[_0x8af8('0xb')]())[_0x8af8('0x9')](openchannelQueue[_0x8af8('0xc')]())[_0x8af8('0x9')](realtime[_0x8af8('0xd')]())[_0x8af8('0x9')](chatQueue[_0x8af8('0xe')]())[_0x8af8('0x9')](realtime[_0x8af8('0xf')]())['then'](smsQueue[_0x8af8('0x10')]())[_0x8af8('0x9')](realtime['initSmsQueues']())[_0x8af8('0x9')](mailQueue[_0x8af8('0x11')]())[_0x8af8('0x9')](realtime[_0x8af8('0x12')]())[_0x8af8('0x9')](faxQueue[_0x8af8('0x13')]())['then'](realtime['initFaxQueues']())[_0x8af8('0x9')](whatsappQueue[_0x8af8('0x14')]())['then'](realtime[_0x8af8('0x15')]())[_0x8af8('0x9')](function(){return realtime;});}function main(){return server[_0x8af8('0x16')](realtime)[_0x8af8('0x9')](function(_0x34ba6a){return initRealtime();})[_0x8af8('0x9')](function(_0x22c54e){return setInterval(initRealtime,0x1388);})[_0x8af8('0x17')](function(_0x3ddac0){console['log'](_0x3ddac0);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 5a672e2..b69cae3 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2bfa24,_0x2e31e5){var _0xa7bbe2=function(_0x1a2d3e){while(--_0x1a2d3e){_0x2bfa24['push'](_0x2bfa24['shift']());}};_0xa7bbe2(++_0x2e31e5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x5fc3[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x17259d,_0x476b3c){var _0xe5d139=function(_0x5e6bca){while(--_0x5e6bca){_0x17259d['push'](_0x17259d['shift']());}};_0xe5d139(++_0x476b3c);}(_0x814b,0x1a2));var _0xb814=function(_0x2c37b2,_0x107055){_0x2c37b2=_0x2c37b2-0x0;var _0x559312=_0x814b[_0x2c37b2];return _0x559312;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index aaecb94..9488074 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd720=['request','then','result','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xd720,0x9f));var _0x0d72=function(_0x14ba55,_0xb38fb3){_0x14ba55=_0x14ba55-0x0;var _0xfed559=_0xd720[_0x14ba55];return _0xfed559;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0d72('0x0'));var client=jayson[_0x0d72('0x1')][_0x0d72('0x2')]({'port':0x232b});function request(_0x662525,_0x4559ef){return new BPromise(function(_0x5ce5b7,_0x5ee8e3){return client[_0x0d72('0x3')](_0x662525,_0x4559ef)[_0x0d72('0x4')](function(_0x792d08){if(_0x792d08['error']){return _0x5ee8e3(_0x792d08['error']['message']);}else{return _0x5ce5b7(_0x792d08[_0x0d72('0x5')]);}})[_0x0d72('0x6')](function(_0x859121){return _0x5ee8e3(_0x859121);});});}exports[_0x0d72('0x7')]=function(_0x4ea512,_0x26502d){return request(_0x0d72('0x8'),{'account':_0x4ea512,'message':_0x26502d});}; \ No newline at end of file +var _0x38dd=['jayson/promise','client','http','then','error','result','catch','sendMailMessage','bluebird'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x38dd,0x1b8));var _0xd38d=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x38dd[_0x23c6f2];return _0x4c270b;};'use strict';var BPromise=require(_0xd38d('0x0'));var jayson=require(_0xd38d('0x1'));var client=jayson[_0xd38d('0x2')][_0xd38d('0x3')]({'port':0x232b});function request(_0x96f571,_0x3ca97){return new BPromise(function(_0x1e70ed,_0x52787b){return client['request'](_0x96f571,_0x3ca97)[_0xd38d('0x4')](function(_0x54f94c){if(_0x54f94c[_0xd38d('0x5')]){return _0x52787b(_0x54f94c[_0xd38d('0x5')]['message']);}else{return _0x1e70ed(_0x54f94c[_0xd38d('0x6')]);}})[_0xd38d('0x7')](function(_0x3b89af){return _0x52787b(_0x3b89af);});});}exports[_0xd38d('0x8')]=function(_0x5ddabf,_0x22fd49){return request('SendMail',{'account':_0x5ddabf,'message':_0x22fd49});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b40259c..aa62cd4 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d38=['chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','openchannel','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','voicePause','faxStatus','mailWaitingInteractions','smsWaitingInteractions','stringify','emit','omit','md5','moment','ioredis','defaults','localhost','socket.io-emitter','redis','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity'];(function(_0x5c1477,_0x3db953){var _0x10ee10=function(_0x1d34d8){while(--_0x1d34d8){_0x5c1477['push'](_0x5c1477['shift']());}};_0x10ee10(++_0x3db953);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var md5=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var Redis=require(_0x86d3('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x86d3('0x3')](config['redis'],{'host':_0x86d3('0x4'),'port':0x18eb});var io=require(_0x86d3('0x5'))(new Redis(config[_0x86d3('0x6')]));function Agent(_0x4ef557){this['id']=_0x4ef557['id']||0x0;this[_0x86d3('0x7')]=_0x4ef557[_0x86d3('0x7')]||'';this[_0x86d3('0x8')]=_0x4ef557[_0x86d3('0x8')]||!![];this['voicePause']=_0x4ef557['voicePause']||![];this[_0x86d3('0x9')]=_0x4ef557[_0x86d3('0x9')]||![];this[_0x86d3('0xa')]=_0x4ef557['mailPause']||![];this['faxPause']=_0x4ef557[_0x86d3('0xb')]||![];this[_0x86d3('0xc')]=_0x4ef557['smsPause']||![];this['openchannelPause']=_0x4ef557[_0x86d3('0xd')]||![];this[_0x86d3('0xe')]='unknown';this[_0x86d3('0xf')]=0x0;this['chatCapacity']=_0x4ef557[_0x86d3('0x10')]||0x0;this[_0x86d3('0x11')]=0x0;this[_0x86d3('0x12')]=_0x86d3('0x13');this[_0x86d3('0x14')]=0x0;this[_0x86d3('0x15')]=_0x4ef557[_0x86d3('0x15')]||0x0;this[_0x86d3('0x16')]=0x0;this['faxStatus']=_0x86d3('0x13');this[_0x86d3('0x17')]=0x0;this[_0x86d3('0x18')]=_0x4ef557[_0x86d3('0x18')]||0x0;this[_0x86d3('0x19')]=0x0;this[_0x86d3('0x1a')]=_0x86d3('0x13');this[_0x86d3('0x1b')]=0x0;this['smsCapacity']=_0x4ef557[_0x86d3('0x1c')]||0x0;this[_0x86d3('0x1d')]=0x0;this[_0x86d3('0x1e')]=_0x86d3('0x13');this[_0x86d3('0x1f')]=0x0;this[_0x86d3('0x20')]=_0x4ef557[_0x86d3('0x20')]||0x0;this[_0x86d3('0x21')]=0x0;this[_0x86d3('0x22')]='unknown';this[_0x86d3('0x23')]=0x0;this['openchannelCapacity']=_0x4ef557[_0x86d3('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x86d3('0x25')]=undefined;this[_0x86d3('0x0')]='';this[_0x86d3('0x26')]={};this[_0x86d3('0x27')]={};this['mailWaitingInteractions']={};this[_0x86d3('0x28')]={};this['smsWaitingInteractions']={};this[_0x86d3('0x29')]={};this[_0x86d3('0x2a')]();}Agent[_0x86d3('0x2b')]['getChannelStatus']=function(_0x39d819){if(this[_0x39d819+_0x86d3('0x2c')]>0x0){if(this[_0x39d819+_0x86d3('0x2d')]>0x0&&this[_0x39d819+'CurrentCapacity']>=this[_0x39d819+'Capacity']){return _0x86d3('0x2e');}else{return'working';}}else{return _0x86d3('0x2f');}};Agent[_0x86d3('0x2b')][_0x86d3('0x2a')]=function(){var _0x3c5fe4=['mail','chat',_0x86d3('0x30'),_0x86d3('0x31'),'sms',_0x86d3('0x32')];for(var _0x5b126e=0x0;_0x5b126e<_0x3c5fe4[_0x86d3('0x33')];_0x5b126e+=0x1){var _0x41e2f0=this[_0x86d3('0x34')](_0x3c5fe4[_0x5b126e]);if(this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]!==_0x41e2f0){this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x36')]=_[_0x86d3('0x37')](moment()[_0x86d3('0x38')]('x'));}this[_0x3c5fe4[_0x5b126e]+_0x86d3('0x35')]=_0x41e2f0;}var _0x303f13={'id':this['id'],'name':this[_0x86d3('0x7')],'online':this[_0x86d3('0x8')],'voicePause':this[_0x86d3('0x39')],'chatPause':this[_0x86d3('0x9')],'mailPause':this[_0x86d3('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x86d3('0xb')],'openchannelPause':this[_0x86d3('0xd')],'chatStatus':this[_0x86d3('0xe')],'chatStatusTime':this[_0x86d3('0xf')],'chatCapacity':this[_0x86d3('0x10')],'chatCurrentCapacity':this[_0x86d3('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x86d3('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x86d3('0x3a')],'faxStatusTime':this[_0x86d3('0x17')],'faxCapacity':this[_0x86d3('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x86d3('0x1a')],'smsStatusTime':this[_0x86d3('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x86d3('0x1d')],'whatsappStatus':this[_0x86d3('0x1e')],'whatsappStatusTime':this[_0x86d3('0x1f')],'whatsappCapacity':this[_0x86d3('0x20')],'whatsappCurrentCapacity':this[_0x86d3('0x21')],'openchannelStatus':this[_0x86d3('0x22')],'openchannelStatusTime':this[_0x86d3('0x23')],'openchannelCapacity':this[_0x86d3('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x86d3('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x86d3('0x3b')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x86d3('0x3c')],'whatsappWaitingInteractions':this[_0x86d3('0x29')]};var _0x452d49=md5(JSON[_0x86d3('0x3d')](_0x303f13));if(this[_0x86d3('0x0')]!==_0x452d49){this[_0x86d3('0x0')]=_0x452d49;io[_0x86d3('0x3e')]('user:routing:update',_[_0x86d3('0x3f')](_0x303f13,[_0x86d3('0x8')]));}};module['exports']=Agent; \ No newline at end of file +var _0x7880=['whatsapp','length','Status','StatusTime','chatStatus','mailStatusTime','openchannelCurrentCapacity','busyQueue','smsWaitingInteractions','user:routing:update','omit','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','chat','openchannel','sms'];(function(_0x44c98f,_0x3db245){var _0x5113ef=function(_0x2fcfba){while(--_0x2fcfba){_0x44c98f['push'](_0x44c98f['shift']());}};_0x5113ef(++_0x3db245);}(_0x7880,0x1f4));var _0x0788=function(_0x247b2c,_0x52354c){_0x247b2c=_0x247b2c-0x0;var _0x14986e=_0x7880[_0x247b2c];return _0x14986e;};'use strict';var _=require('lodash');var md5=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var Redis=require(_0x0788('0x2'));var config=require(_0x0788('0x3'));config[_0x0788('0x4')]=_[_0x0788('0x5')](config['redis'],{'host':_0x0788('0x6'),'port':0x18eb});var io=require(_0x0788('0x7'))(new Redis(config[_0x0788('0x4')]));function Agent(_0xd53e7d){this['id']=_0xd53e7d['id']||0x0;this[_0x0788('0x8')]=_0xd53e7d[_0x0788('0x8')]||'';this[_0x0788('0x9')]=_0xd53e7d[_0x0788('0x9')]||!![];this[_0x0788('0xa')]=_0xd53e7d[_0x0788('0xa')]||![];this['chatPause']=_0xd53e7d[_0x0788('0xb')]||![];this['mailPause']=_0xd53e7d[_0x0788('0xc')]||![];this['faxPause']=_0xd53e7d[_0x0788('0xd')]||![];this[_0x0788('0xe')]=_0xd53e7d[_0x0788('0xe')]||![];this[_0x0788('0xf')]=_0xd53e7d[_0x0788('0xf')]||![];this['chatStatus']=_0x0788('0x10');this[_0x0788('0x11')]=0x0;this[_0x0788('0x12')]=_0xd53e7d[_0x0788('0x12')]||0x0;this[_0x0788('0x13')]=0x0;this[_0x0788('0x14')]=_0x0788('0x10');this['mailStatusTime']=0x0;this[_0x0788('0x15')]=_0xd53e7d[_0x0788('0x15')]||0x0;this[_0x0788('0x16')]=0x0;this[_0x0788('0x17')]='unknown';this[_0x0788('0x18')]=0x0;this['faxCapacity']=_0xd53e7d[_0x0788('0x19')]||0x0;this[_0x0788('0x1a')]=0x0;this[_0x0788('0x1b')]=_0x0788('0x10');this[_0x0788('0x1c')]=0x0;this[_0x0788('0x1d')]=_0xd53e7d['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x0788('0x1e')]=_0x0788('0x10');this['whatsappStatusTime']=0x0;this[_0x0788('0x1f')]=_0xd53e7d[_0x0788('0x1f')]||0x0;this[_0x0788('0x20')]=0x0;this['openchannelStatus']=_0x0788('0x10');this[_0x0788('0x21')]=0x0;this['openchannelCapacity']=_0xd53e7d[_0x0788('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0788('0x23')]=![];this['busyQueue']=undefined;this[_0x0788('0x0')]='';this[_0x0788('0x24')]={};this[_0x0788('0x25')]={};this[_0x0788('0x26')]={};this[_0x0788('0x27')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0x0788('0x28')]();}Agent[_0x0788('0x29')][_0x0788('0x2a')]=function(_0x7a99a1){if(this[_0x7a99a1+'CurrentCapacity']>0x0){if(this[_0x7a99a1+'Capacity']>0x0&&this[_0x7a99a1+_0x0788('0x2b')]>=this[_0x7a99a1+_0x0788('0x2c')]){return _0x0788('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x0788('0x29')][_0x0788('0x28')]=function(){var _0x5f2dda=['mail',_0x0788('0x2e'),_0x0788('0x2f'),'fax',_0x0788('0x30'),_0x0788('0x31')];for(var _0x467d52=0x0;_0x467d52<_0x5f2dda[_0x0788('0x32')];_0x467d52+=0x1){var _0xf9ba32=this[_0x0788('0x2a')](_0x5f2dda[_0x467d52]);if(this[_0x5f2dda[_0x467d52]+_0x0788('0x33')]!==_0xf9ba32){this[_0x5f2dda[_0x467d52]+_0x0788('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x5f2dda[_0x467d52]+_0x0788('0x33')]=_0xf9ba32;}var _0x40d345={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x0788('0xa')],'chatPause':this[_0x0788('0xb')],'mailPause':this[_0x0788('0xc')],'smsPause':this[_0x0788('0xe')],'faxPause':this[_0x0788('0xd')],'openchannelPause':this[_0x0788('0xf')],'chatStatus':this[_0x0788('0x35')],'chatStatusTime':this[_0x0788('0x11')],'chatCapacity':this[_0x0788('0x12')],'chatCurrentCapacity':this[_0x0788('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0788('0x36')],'mailCapacity':this[_0x0788('0x15')],'mailCurrentCapacity':this[_0x0788('0x16')],'faxStatus':this[_0x0788('0x17')],'faxStatusTime':this[_0x0788('0x18')],'faxCapacity':this[_0x0788('0x19')],'faxCurrentCapacity':this[_0x0788('0x1a')],'smsStatus':this[_0x0788('0x1b')],'smsStatusTime':this[_0x0788('0x1c')],'smsCapacity':this[_0x0788('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0788('0x21')],'openchannelCapacity':this[_0x0788('0x22')],'openchannelCurrentCapacity':this[_0x0788('0x37')],'busy':this['busy'],'busyQueue':this[_0x0788('0x38')],'chatWaitingInteractions':this[_0x0788('0x24')],'faxWaitingInteractions':this[_0x0788('0x25')],'mailWaitingInteractions':this[_0x0788('0x26')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x0788('0x39')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x322465=md5(JSON['stringify'](_0x40d345));if(this[_0x0788('0x0')]!==_0x322465){this[_0x0788('0x0')]=_0x322465;io['emit'](_0x0788('0x3a'),_[_0x0788('0x3b')](_0x40d345,['online']));}};module[_0x0788('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5e05c28..cf87aeb 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 _0x109d=['stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','length','online','loggedIn','chatPause','paused','available'];(function(_0x3e58db,_0x592c33){var _0x49933c=function(_0x446ccf){while(--_0x446ccf){_0x3e58db['push'](_0x3e58db['shift']());}};_0x49933c(++_0x592c33);}(_0x109d,0x1e5));var _0xd109=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x109d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd109('0x0'));var md5=require(_0xd109('0x1'));var util=require(_0xd109('0x2'));var Redis=require('ioredis');var config=require(_0xd109('0x3'));config[_0xd109('0x4')]=_[_0xd109('0x5')](config[_0xd109('0x4')],{'host':_0xd109('0x6'),'port':0x18eb});var io=require(_0xd109('0x7'))(new Redis(config[_0xd109('0x4')]));function ChatQueue(_0x5e0301){this['id']=_0x5e0301['id']||0x0;this[_0xd109('0x8')]=_0x5e0301[_0xd109('0x8')]||'';this['timeout']=_0x5e0301[_0xd109('0x9')]||0xa;this[_0xd109('0xa')]=_0x5e0301[_0xd109('0xa')]||'beepall';this[_0xd109('0xb')]=_0x5e0301[_0xd109('0xb')];this['mapAgentsId']={};this[_0xd109('0xc')]=0x0;this[_0xd109('0x1')]='';this[_0xd109('0xd')]();this[_0xd109('0xe')]();}ChatQueue[_0xd109('0xf')][_0xd109('0xd')]=function(){var _0x447895=this[_0xd109('0x10')][_0xd109('0x11')];this[_0xd109('0x10')]=_[_0xd109('0x12')](this[_0xd109('0xb')],'id');this['mapAgentsId'][_0xd109('0x11')]=_0x447895;};ChatQueue[_0xd109('0xf')][_0xd109('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xfd9294=0x0;_0xfd9294=0x0?this[_0xd109('0x18')]:0x0;var _0x2b630a={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd109('0x15')],'name':this[_0xd109('0x8')],'paused':this[_0xd109('0x17')],'waiting':this[_0xd109('0xc')]};var _0x283640=md5(JSON[_0xd109('0x19')](_0x2b630a));if(this[_0xd109('0x1')]!==_0x283640){this['md5']=_0x283640;io['to'](util[_0xd109('0x1a')](_0xd109('0x1b'),_0x2b630a[_0xd109('0x8')]))[_0xd109('0x1c')]('chat_queue:save',_0x2b630a);}};module[_0xd109('0x1d')]=ChatQueue; \ No newline at end of file +var _0x729d=['../../../config/environment','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x1d6b74,_0x2e463a){var _0x1cb9ce=function(_0x1346f7){while(--_0x1346f7){_0x1d6b74['push'](_0x1d6b74['shift']());}};_0x1cb9ce(++_0x2e463a);}(_0x729d,0x1ec));var _0xd729=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x729d[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0xd729('0x0'));var md5=require(_0xd729('0x1'));var util=require(_0xd729('0x2'));var Redis=require(_0xd729('0x3'));var config=require(_0xd729('0x4'));config['redis']=_[_0xd729('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd729('0x6'))(new Redis(config['redis']));function ChatQueue(_0x3aef13){this['id']=_0x3aef13['id']||0x0;this[_0xd729('0x7')]=_0x3aef13[_0xd729('0x7')]||'';this[_0xd729('0x8')]=_0x3aef13[_0xd729('0x8')]||0xa;this[_0xd729('0x9')]=_0x3aef13[_0xd729('0x9')]||_0xd729('0xa');this['Agents']=_0x3aef13[_0xd729('0xb')];this[_0xd729('0xc')]={};this[_0xd729('0xd')]=0x0;this[_0xd729('0x1')]='';this['updateRouting']();this[_0xd729('0xe')]();}ChatQueue[_0xd729('0xf')][_0xd729('0x10')]=function(){var _0x103b8e=this[_0xd729('0xc')]['_rr'];this[_0xd729('0xc')]=_[_0xd729('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xd729('0x12')]=_0x103b8e;};ChatQueue[_0xd729('0xf')][_0xd729('0xe')]=function(){this[_0xd729('0x13')]=0x0;this[_0xd729('0x14')]=0x0;for(var _0x44aa0e=0x0;_0x44aa0e=0x0?this[_0xd729('0x18')]:0x0;var _0x210449={'id':this['id'],'available':this[_0xd729('0x18')],'loggedIn':this[_0xd729('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x394d5b=md5(JSON[_0xd729('0x19')](_0x210449));if(this[_0xd729('0x1')]!==_0x394d5b){this[_0xd729('0x1')]=_0x394d5b;io['to'](util[_0xd729('0x1a')](_0xd729('0x1b'),_0x210449[_0xd729('0x7')]))[_0xd729('0x1c')](_0xd729('0x1d'),_0x210449);}};module[_0xd729('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 8f7a345..1886fc1 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 _0x23ca=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','map','_rr','prototype','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23ca,0x1ea));var _0xa23c=function(_0x386cd2,_0xe877b7){_0x386cd2=_0x386cd2-0x0;var _0x17c5aa=_0x23ca[_0x386cd2];return _0x17c5aa;};'use strict';var _=require(_0xa23c('0x0'));var md5=require(_0xa23c('0x1'));var util=require(_0xa23c('0x2'));var Redis=require(_0xa23c('0x3'));var config=require(_0xa23c('0x4'));config[_0xa23c('0x5')]=_[_0xa23c('0x6')](config[_0xa23c('0x5')],{'host':_0xa23c('0x7'),'port':0x18eb});var io=require(_0xa23c('0x8'))(new Redis(config['redis']));function FaxQueue(_0x4dd5b8){this['id']=_0x4dd5b8['id']||0x0;this[_0xa23c('0x9')]=_0x4dd5b8[_0xa23c('0x9')]||'';this[_0xa23c('0xa')]=_0x4dd5b8[_0xa23c('0xa')]||0xa;this[_0xa23c('0xb')]=_0x4dd5b8['strategy']||_0xa23c('0xc');this['Agents']=_0x4dd5b8[_0xa23c('0xd')];this[_0xa23c('0xe')]={};this['waiting']=0x0;this[_0xa23c('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0xa23c('0xf')]=function(){var _0x586e33=this[_0xa23c('0xe')]['_rr'];this[_0xa23c('0xe')]=_[_0xa23c('0x10')](this['Agents'],'id');this[_0xa23c('0xe')][_0xa23c('0x11')]=_0x586e33;};FaxQueue[_0xa23c('0x12')][_0xa23c('0x13')]=function(){this[_0xa23c('0x14')]=0x0;this[_0xa23c('0x15')]=0x0;for(var _0x4c2659=0x0;_0x4c2659=0x0?this[_0xa23c('0x18')]:0x0;var _0x5cf1ba={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa23c('0x14')],'name':this[_0xa23c('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x2870be=md5(JSON[_0xa23c('0x19')](_0x5cf1ba));if(this[_0xa23c('0x1')]!==_0x2870be){this[_0xa23c('0x1')]=_0x2870be;io['to'](util[_0xa23c('0x1a')](_0xa23c('0x1b'),_0x5cf1ba[_0xa23c('0x9')]))[_0xa23c('0x1c')](_0xa23c('0x1d'),_0x5cf1ba);}};module[_0xa23c('0x1e')]=FaxQueue; \ No newline at end of file +var _0xcf83=['emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','available','format','fax:queue:%s'];(function(_0x4455d9,_0x3e5959){var _0x5d1bf9=function(_0x553482){while(--_0x553482){_0x4455d9['push'](_0x4455d9['shift']());}};_0x5d1bf9(++_0x3e5959);}(_0xcf83,0x199));var _0x3cf8=function(_0x15eb76,_0x1946fb){_0x15eb76=_0x15eb76-0x0;var _0x104569=_0xcf83[_0x15eb76];return _0x104569;};'use strict';var _=require(_0x3cf8('0x0'));var md5=require(_0x3cf8('0x1'));var util=require(_0x3cf8('0x2'));var Redis=require(_0x3cf8('0x3'));var config=require(_0x3cf8('0x4'));config['redis']=_[_0x3cf8('0x5')](config['redis'],{'host':_0x3cf8('0x6'),'port':0x18eb});var io=require(_0x3cf8('0x7'))(new Redis(config[_0x3cf8('0x8')]));function FaxQueue(_0xb54f55){this['id']=_0xb54f55['id']||0x0;this[_0x3cf8('0x9')]=_0xb54f55[_0x3cf8('0x9')]||'';this['timeout']=_0xb54f55[_0x3cf8('0xa')]||0xa;this[_0x3cf8('0xb')]=_0xb54f55[_0x3cf8('0xb')]||_0x3cf8('0xc');this[_0x3cf8('0xd')]=_0xb54f55['Agents'];this[_0x3cf8('0xe')]={};this[_0x3cf8('0xf')]=0x0;this['md5']='';this[_0x3cf8('0x10')]();this[_0x3cf8('0x11')]();}FaxQueue['prototype'][_0x3cf8('0x10')]=function(){var _0x239cf0=this[_0x3cf8('0xe')][_0x3cf8('0x12')];this[_0x3cf8('0xe')]=_['map'](this[_0x3cf8('0xd')],'id');this[_0x3cf8('0xe')][_0x3cf8('0x12')]=_0x239cf0;};FaxQueue[_0x3cf8('0x13')][_0x3cf8('0x11')]=function(){this[_0x3cf8('0x14')]=0x0;this[_0x3cf8('0x15')]=0x0;for(var _0x1bb83a=0x0;_0x1bb83a=0x0?this[_0x3cf8('0x17')]:0x0;var _0x1f88b1={'id':this['id'],'available':this[_0x3cf8('0x17')],'loggedIn':this[_0x3cf8('0x14')],'name':this[_0x3cf8('0x9')],'paused':this[_0x3cf8('0x15')],'waiting':this[_0x3cf8('0xf')]};var _0x56db24=md5(JSON['stringify'](_0x1f88b1));if(this['md5']!==_0x56db24){this[_0x3cf8('0x1')]=_0x56db24;io['to'](util[_0x3cf8('0x18')](_0x3cf8('0x19'),_0x1f88b1[_0x3cf8('0x9')]))[_0x3cf8('0x1a')](_0x3cf8('0x1b'),_0x1f88b1);}};module[_0x3cf8('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 10cf305..d92173a 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 _0x5339=['name','Intervals','exports'];(function(_0x27ab0f,_0xe8cfb0){var _0x3fcec6=function(_0x4d2c26){while(--_0x4d2c26){_0x27ab0f['push'](_0x27ab0f['shift']());}};_0x3fcec6(++_0xe8cfb0);}(_0x5339,0x13e));var _0x9533=function(_0x2f9675,_0x1502ea){_0x2f9675=_0x2f9675-0x0;var _0x4391c9=_0x5339[_0x2f9675];return _0x4391c9;};'use strict';function Interval(_0x22682d){this['id']=_0x22682d['id']||0x0;this[_0x9533('0x0')]=_0x22682d[_0x9533('0x0')]||'';this[_0x9533('0x1')]=_0x22682d['Intervals']||{};}module[_0x9533('0x2')]=Interval; \ No newline at end of file +var _0x7e5c=['exports','name','Intervals'];(function(_0x50a048,_0x5e2255){var _0x4bb354=function(_0x5cf491){while(--_0x5cf491){_0x50a048['push'](_0x50a048['shift']());}};_0x4bb354(++_0x5e2255);}(_0x7e5c,0x10c));var _0xc7e5=function(_0x2b0768,_0x124bbe){_0x2b0768=_0x2b0768-0x0;var _0x246bd8=_0x7e5c[_0x2b0768];return _0x246bd8;};'use strict';function Interval(_0x3e0b9f){this['id']=_0x3e0b9f['id']||0x0;this[_0xc7e5('0x0')]=_0x3e0b9f[_0xc7e5('0x0')]||'';this[_0xc7e5('0x1')]=_0x3e0b9f['Intervals']||{};}module[_0xc7e5('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a5dfbc3..bd6abd6 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 _0xe2b8=['timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x59d323,_0x1e839d){var _0x4ae6d4=function(_0x1f0523){while(--_0x1f0523){_0x59d323['push'](_0x59d323['shift']());}};_0x4ae6d4(++_0x1e839d);}(_0xe2b8,0x67));var _0x8e2b=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xe2b8[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0x8e2b('0x0'));var md5=require(_0x8e2b('0x1'));var util=require(_0x8e2b('0x2'));var Redis=require('ioredis');var config=require(_0x8e2b('0x3'));config[_0x8e2b('0x4')]=_[_0x8e2b('0x5')](config[_0x8e2b('0x4')],{'host':_0x8e2b('0x6'),'port':0x18eb});var io=require(_0x8e2b('0x7'))(new Redis(config['redis']));function MailQueue(_0x37cc4e){this['id']=_0x37cc4e['id']||0x0;this[_0x8e2b('0x8')]=_0x37cc4e[_0x8e2b('0x8')]||'';this['timeout']=_0x37cc4e[_0x8e2b('0x9')]||0xa;this[_0x8e2b('0xa')]=_0x37cc4e['strategy']||'beepall';this[_0x8e2b('0xb')]=_0x37cc4e[_0x8e2b('0xb')];this[_0x8e2b('0xc')]={};this[_0x8e2b('0xd')]=0x0;this['md5']='';this[_0x8e2b('0xe')]();this[_0x8e2b('0xf')]();}MailQueue[_0x8e2b('0x10')][_0x8e2b('0xe')]=function(){var _0x179e57=this[_0x8e2b('0xc')]['_rr'];this[_0x8e2b('0xc')]=_[_0x8e2b('0x11')](this[_0x8e2b('0xb')],'id');this['mapAgentsId']['_rr']=_0x179e57;};MailQueue['prototype'][_0x8e2b('0xf')]=function(){this[_0x8e2b('0x12')]=0x0;this[_0x8e2b('0x13')]=0x0;for(var _0x1ddc58=0x0;_0x1ddc58=0x0?this[_0x8e2b('0x17')]:0x0;var _0x12ad10={'id':this['id'],'available':this[_0x8e2b('0x17')],'loggedIn':this[_0x8e2b('0x12')],'name':this[_0x8e2b('0x8')],'paused':this[_0x8e2b('0x13')],'waiting':this[_0x8e2b('0xd')]};var _0x555bd1=md5(JSON[_0x8e2b('0x18')](_0x12ad10));if(this[_0x8e2b('0x1')]!==_0x555bd1){this['md5']=_0x555bd1;io['to'](util[_0x8e2b('0x19')]('mail:queue:%s',_0x12ad10[_0x8e2b('0x8')]))[_0x8e2b('0x1a')](_0x8e2b('0x1b'),_0x12ad10);}};module['exports']=MailQueue; \ No newline at end of file +var _0xdf98=['online','mailPause','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length'];(function(_0x40d0e4,_0x14517d){var _0x2de7b3=function(_0x499889){while(--_0x499889){_0x40d0e4['push'](_0x40d0e4['shift']());}};_0x2de7b3(++_0x14517d);}(_0xdf98,0xc2));var _0x8df9=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xdf98[_0xa3c06b];return _0x33aa1d;};'use strict';var _=require(_0x8df9('0x0'));var md5=require(_0x8df9('0x1'));var util=require(_0x8df9('0x2'));var Redis=require(_0x8df9('0x3'));var config=require(_0x8df9('0x4'));config[_0x8df9('0x5')]=_[_0x8df9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8df9('0x7'))(new Redis(config[_0x8df9('0x5')]));function MailQueue(_0x568baa){this['id']=_0x568baa['id']||0x0;this['name']=_0x568baa[_0x8df9('0x8')]||'';this[_0x8df9('0x9')]=_0x568baa[_0x8df9('0x9')]||0xa;this[_0x8df9('0xa')]=_0x568baa[_0x8df9('0xa')]||_0x8df9('0xb');this['Agents']=_0x568baa[_0x8df9('0xc')];this['mapAgentsId']={};this[_0x8df9('0xd')]=0x0;this['md5']='';this[_0x8df9('0xe')]();this['updateRealtime']();}MailQueue[_0x8df9('0xf')][_0x8df9('0xe')]=function(){var _0x313ca4=this[_0x8df9('0x10')][_0x8df9('0x11')];this[_0x8df9('0x10')]=_[_0x8df9('0x12')](this[_0x8df9('0xc')],'id');this[_0x8df9('0x10')][_0x8df9('0x11')]=_0x313ca4;};MailQueue['prototype'][_0x8df9('0x13')]=function(){this[_0x8df9('0x14')]=0x0;this[_0x8df9('0x15')]=0x0;for(var _0x589dcd=0x0;_0x589dcd=0x0?this[_0x8df9('0x19')]:0x0;var _0x53052d={'id':this['id'],'available':this[_0x8df9('0x19')],'loggedIn':this[_0x8df9('0x14')],'name':this[_0x8df9('0x8')],'paused':this['paused'],'waiting':this[_0x8df9('0xd')]};var _0x121863=md5(JSON[_0x8df9('0x1a')](_0x53052d));if(this[_0x8df9('0x1')]!==_0x121863){this[_0x8df9('0x1')]=_0x121863;io['to'](util[_0x8df9('0x1b')](_0x8df9('0x1c'),_0x53052d[_0x8df9('0x8')]))[_0x8df9('0x1d')]('mail_queue:save',_0x53052d);}};module[_0x8df9('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8cd453c..d5f5e7f 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a1750,_0x10eeb4){_0x3a1750=_0x3a1750-0x0;var _0x28a259=_0x2ef3[_0x3a1750];return _0x28a259;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x2ef3,0xba));var _0x32ef=function(_0x4802c3,_0x541ce5){_0x4802c3=_0x4802c3-0x0;var _0x4ddc72=_0x2ef3[_0x4802c3];return _0x4ddc72;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('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 4bbca68..4741b67 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 _0x3036=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','exports','util','ioredis','../../../config/environment','defaults','redis','name','timeout'];(function(_0xcd677c,_0x1fedb7){var _0x796143=function(_0x47da35){while(--_0x47da35){_0xcd677c['push'](_0xcd677c['shift']());}};_0x796143(++_0x1fedb7);}(_0x3036,0x1a9));var _0x6303=function(_0x4eb7f5,_0x20805b){_0x4eb7f5=_0x4eb7f5-0x0;var _0x3a7eba=_0x3036[_0x4eb7f5];return _0x3a7eba;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6303('0x0'));var Redis=require(_0x6303('0x1'));var config=require(_0x6303('0x2'));config['redis']=_[_0x6303('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6303('0x4')]));function SmsQueue(_0x48d0c8){this['id']=_0x48d0c8['id']||0x0;this[_0x6303('0x5')]=_0x48d0c8[_0x6303('0x5')]||'';this[_0x6303('0x6')]=_0x48d0c8['timeout']||0xa;this[_0x6303('0x7')]=_0x48d0c8[_0x6303('0x7')]||_0x6303('0x8');this[_0x6303('0x9')]=_0x48d0c8[_0x6303('0x9')];this[_0x6303('0xa')]={};this[_0x6303('0xb')]=0x0;this[_0x6303('0xc')]='';this[_0x6303('0xd')]();this['updateRealtime']();}SmsQueue[_0x6303('0xe')][_0x6303('0xd')]=function(){var _0x3ac7ef=this[_0x6303('0xa')][_0x6303('0xf')];this['mapAgentsId']=_[_0x6303('0x10')](this[_0x6303('0x9')],'id');this[_0x6303('0xa')][_0x6303('0xf')]=_0x3ac7ef;};SmsQueue[_0x6303('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2726ef=0x0;_0x2726ef=0x0?this[_0x6303('0x16')]:0x0;var _0x36a6af={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6303('0x13')],'name':this[_0x6303('0x5')],'paused':this[_0x6303('0x15')],'waiting':this[_0x6303('0xb')]};var _0x33474f=md5(JSON[_0x6303('0x17')](_0x36a6af));if(this[_0x6303('0xc')]!==_0x33474f){this[_0x6303('0xc')]=_0x33474f;io['to'](util[_0x6303('0x18')](_0x6303('0x19'),_0x36a6af[_0x6303('0x5')]))['emit']('sms_queue:save',_0x36a6af);}};module[_0x6303('0x1a')]=SmsQueue; \ No newline at end of file +var _0x5455=['emit','sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','name'];(function(_0x32936c,_0x34182d){var _0x28b01d=function(_0x425446){while(--_0x425446){_0x32936c['push'](_0x32936c['shift']());}};_0x28b01d(++_0x34182d);}(_0x5455,0x197));var _0x5545=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5455[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var md5=require(_0x5545('0x0'));var util=require(_0x5545('0x1'));var Redis=require(_0x5545('0x2'));var config=require(_0x5545('0x3'));config[_0x5545('0x4')]=_[_0x5545('0x5')](config[_0x5545('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5545('0x4')]));function SmsQueue(_0x6688e5){this['id']=_0x6688e5['id']||0x0;this['name']=_0x6688e5['name']||'';this[_0x5545('0x6')]=_0x6688e5[_0x5545('0x6')]||0xa;this['strategy']=_0x6688e5[_0x5545('0x7')]||_0x5545('0x8');this['Agents']=_0x6688e5[_0x5545('0x9')];this[_0x5545('0xa')]={};this[_0x5545('0xb')]=0x0;this[_0x5545('0x0')]='';this[_0x5545('0xc')]();this[_0x5545('0xd')]();}SmsQueue[_0x5545('0xe')][_0x5545('0xc')]=function(){var _0xbb13a0=this['mapAgentsId']['_rr'];this[_0x5545('0xa')]=_[_0x5545('0xf')](this[_0x5545('0x9')],'id');this[_0x5545('0xa')]['_rr']=_0xbb13a0;};SmsQueue[_0x5545('0xe')][_0x5545('0xd')]=function(){this['loggedIn']=0x0;this[_0x5545('0x10')]=0x0;for(var _0x167f3d=0x0;_0x167f3d=0x0?this[_0x5545('0x15')]:0x0;var _0x373f92={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5545('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x5f13ef=md5(JSON[_0x5545('0x16')](_0x373f92));if(this[_0x5545('0x0')]!==_0x5f13ef){this[_0x5545('0x0')]=_0x5f13ef;io['to'](util['format'](_0x5545('0x17'),_0x373f92[_0x5545('0x18')]))[_0x5545('0x19')](_0x5545('0x1a'),_0x373f92);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 01a5d61..8dc76f0 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 _0x72c0=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','paused','length','online','loggedIn','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x43a389,_0x33635d){var _0x28d059=function(_0x22a4c5){while(--_0x22a4c5){_0x43a389['push'](_0x43a389['shift']());}};_0x28d059(++_0x33635d);}(_0x72c0,0x1ea));var _0x072c=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x72c0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x072c('0x0'));var md5=require(_0x072c('0x1'));var util=require(_0x072c('0x2'));var Redis=require(_0x072c('0x3'));var config=require(_0x072c('0x4'));config[_0x072c('0x5')]=_[_0x072c('0x6')](config[_0x072c('0x5')],{'host':_0x072c('0x7'),'port':0x18eb});var io=require(_0x072c('0x8'))(new Redis(config[_0x072c('0x5')]));function WhatsappQueue(_0x3098be){this['id']=_0x3098be['id']||0x0;this[_0x072c('0x9')]=_0x3098be[_0x072c('0x9')]||'';this[_0x072c('0xa')]=_0x3098be[_0x072c('0xa')]||0xa;this[_0x072c('0xb')]=_0x3098be[_0x072c('0xb')]||_0x072c('0xc');this['Agents']=_0x3098be[_0x072c('0xd')];this['mapAgentsId']={};this[_0x072c('0xe')]=0x0;this[_0x072c('0x1')]='';this[_0x072c('0xf')]();this[_0x072c('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x1b1ed2=this['mapAgentsId'][_0x072c('0x11')];this[_0x072c('0x12')]=_[_0x072c('0x13')](this[_0x072c('0xd')],'id');this['mapAgentsId'][_0x072c('0x11')]=_0x1b1ed2;};WhatsappQueue[_0x072c('0x14')][_0x072c('0x10')]=function(){this['loggedIn']=0x0;this[_0x072c('0x15')]=0x0;for(var _0x13ca6f=0x0;_0x13ca6f=0x0?this[_0x072c('0x19')]:0x0;var _0x25178b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x072c('0x18')],'name':this[_0x072c('0x9')],'paused':this[_0x072c('0x15')],'waiting':this[_0x072c('0xe')]};var _0x358a58=md5(JSON['stringify'](_0x25178b));if(this[_0x072c('0x1')]!==_0x358a58){this[_0x072c('0x1')]=_0x358a58;io['to'](util[_0x072c('0x1a')](_0x072c('0x1b'),_0x25178b['name']))[_0x072c('0x1c')](_0x072c('0x1d'),_0x25178b);}};module[_0x072c('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xb9c9=['_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x18c0f0,_0x18eb4f){var _0x2e320e=function(_0x216608){while(--_0x216608){_0x18c0f0['push'](_0x18c0f0['shift']());}};_0x2e320e(++_0x18eb4f);}(_0xb9c9,0x192));var _0x9b9c=function(_0x2118a0,_0xa89201){_0x2118a0=_0x2118a0-0x0;var _0x5dd35d=_0xb9c9[_0x2118a0];return _0x5dd35d;};'use strict';var _=require(_0x9b9c('0x0'));var md5=require(_0x9b9c('0x1'));var util=require(_0x9b9c('0x2'));var Redis=require(_0x9b9c('0x3'));var config=require(_0x9b9c('0x4'));config[_0x9b9c('0x5')]=_['defaults'](config[_0x9b9c('0x5')],{'host':_0x9b9c('0x6'),'port':0x18eb});var io=require(_0x9b9c('0x7'))(new Redis(config[_0x9b9c('0x5')]));function WhatsappQueue(_0x248f9e){this['id']=_0x248f9e['id']||0x0;this[_0x9b9c('0x8')]=_0x248f9e[_0x9b9c('0x8')]||'';this['timeout']=_0x248f9e[_0x9b9c('0x9')]||0xa;this['strategy']=_0x248f9e[_0x9b9c('0xa')]||_0x9b9c('0xb');this['Agents']=_0x248f9e[_0x9b9c('0xc')];this[_0x9b9c('0xd')]={};this[_0x9b9c('0xe')]=0x0;this[_0x9b9c('0x1')]='';this[_0x9b9c('0xf')]();this[_0x9b9c('0x10')]();}WhatsappQueue[_0x9b9c('0x11')][_0x9b9c('0xf')]=function(){var _0x156b31=this[_0x9b9c('0xd')][_0x9b9c('0x12')];this['mapAgentsId']=_[_0x9b9c('0x13')](this[_0x9b9c('0xc')],'id');this[_0x9b9c('0xd')][_0x9b9c('0x12')]=_0x156b31;};WhatsappQueue[_0x9b9c('0x11')][_0x9b9c('0x10')]=function(){this[_0x9b9c('0x14')]=0x0;this[_0x9b9c('0x15')]=0x0;for(var _0x5c9021=0x0;_0x5c9021=0x0?this[_0x9b9c('0x19')]:0x0;var _0x103a44={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9b9c('0x14')],'name':this[_0x9b9c('0x8')],'paused':this[_0x9b9c('0x15')],'waiting':this['waiting']};var _0x40978a=md5(JSON[_0x9b9c('0x1a')](_0x103a44));if(this[_0x9b9c('0x1')]!==_0x40978a){this[_0x9b9c('0x1')]=_0x40978a;io['to'](util[_0x9b9c('0x1b')]('whatsapp:queue:%s',_0x103a44[_0x9b9c('0x8')]))[_0x9b9c('0x1c')](_0x9b9c('0x1d'),_0x103a44);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b55ab20..e16320e 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 91b5efd..834d0b3 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 _0x9bcd=['addTagsToChatInteraction','../client','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x2dcc6f,_0x36b2ce){var _0x2e7a79=function(_0x2d7620){while(--_0x2d7620){_0x2dcc6f['push'](_0x2dcc6f['shift']());}};_0x2e7a79(++_0x36b2ce);}(_0x9bcd,0x15d));var _0xd9bc=function(_0x250014,_0x456405){_0x250014=_0x250014-0x0;var _0x929345=_0x9bcd[_0x250014];return _0x929345;};'use strict';var client=require(_0xd9bc('0x0'));exports['update']=function(_0x32ff3e,_0x48ca53){return client[_0xd9bc('0x1')]('UpdateChatInteraction',{'body':_0x48ca53,'options':{'where':{'id':_0x32ff3e}},'log':_0xd9bc('0x2')});};exports[_0xd9bc('0x3')]=function(_0x21db8e,_0x125557){return client['Request'](_0xd9bc('0x4'),{'body':_0x125557,'options':{'where':{'id':_0x21db8e}},'log':_0xd9bc('0x5')});}; \ No newline at end of file +var _0xf0bd=['addTagsToChatInteraction','../client','update','updateChatInteraction','Request','AddTagsToChatInteraction'];(function(_0x40c027,_0x42db33){var _0x379a14=function(_0x28d3ea){while(--_0x28d3ea){_0x40c027['push'](_0x40c027['shift']());}};_0x379a14(++_0x42db33);}(_0xf0bd,0x19f));var _0xdf0b=function(_0x2ec5f2,_0x5d22f5){_0x2ec5f2=_0x2ec5f2-0x0;var _0x359fb6=_0xf0bd[_0x2ec5f2];return _0x359fb6;};'use strict';var client=require(_0xdf0b('0x0'));exports[_0xdf0b('0x1')]=function(_0x5aaf43,_0x43f054){return client['Request']('UpdateChatInteraction',{'body':_0x43f054,'options':{'where':{'id':_0x5aaf43}},'log':_0xdf0b('0x2')});};exports['addTags']=function(_0x218221,_0x1ba8dc){return client[_0xdf0b('0x3')](_0xdf0b('0x4'),{'body':_0x1ba8dc,'options':{'where':{'id':_0x218221}},'log':_0xdf0b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1c56792..ee158d4 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 _0x25b4=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x517e05,_0x322ae3){var _0x1e37a7=function(_0x25cd2c){while(--_0x25cd2c){_0x517e05['push'](_0x517e05['shift']());}};_0x1e37a7(++_0x322ae3);}(_0x25b4,0xa8));var _0x425b=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x25b4[_0x5b6cf1];return _0x46278c;};'use strict';var client=require(_0x425b('0x0'));exports[_0x425b('0x1')]=function(_0x2d5fff){return client['Request'](_0x425b('0x2'),{'body':_0x2d5fff,'log':_0x425b('0x3')});}; \ No newline at end of file +var _0x8630=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x8630,0x1e0));var _0x0863=function(_0x19d146,_0x276723){_0x19d146=_0x19d146-0x0;var _0x4418da=_0x8630[_0x19d146];return _0x4418da;};'use strict';var client=require(_0x0863('0x0'));exports[_0x0863('0x1')]=function(_0x1db3ad){return client['Request'](_0x0863('0x2'),{'body':_0x1db3ad,'log':_0x0863('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4b8a63a..84b6642 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 _0xdc59=['../client','getChatQueues','Request','timeout','strategy','User','Agents','name','online','chatPause'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xdc59,0x12c));var _0x9dc5=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xdc59[_0x237546];return _0x233e29;};'use strict';var client=require(_0x9dc5('0x0'));exports[_0x9dc5('0x1')]=function(){return function(){return client[_0x9dc5('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x9dc5('0x3'),_0x9dc5('0x4')],'include':[{'model':_0x9dc5('0x5'),'as':_0x9dc5('0x6'),'attributes':['id',_0x9dc5('0x7'),_0x9dc5('0x8'),_0x9dc5('0x9')]}]},'log':_0x9dc5('0x1')});};}; \ No newline at end of file +var _0x27a8=['name','timeout','strategy','User','Agents','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x27a8,0x170));var _0x827a=function(_0x1e86d3,_0x41b5e7){_0x1e86d3=_0x1e86d3-0x0;var _0x52dabf=_0x27a8[_0x1e86d3];return _0x52dabf;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x827a('0x0')](_0x827a('0x1'),{'options':{'raw':![],'attributes':['id',_0x827a('0x2'),_0x827a('0x3'),_0x827a('0x4')],'include':[{'model':_0x827a('0x5'),'as':_0x827a('0x6'),'attributes':['id',_0x827a('0x2'),_0x827a('0x7'),_0x827a('0x8')]}]},'log':_0x827a('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 23e3fed..cf76e5a 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 _0x41bb=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3c53c7,_0x32a47e){var _0x51b671=function(_0x48069d){while(--_0x48069d){_0x3c53c7['push'](_0x3c53c7['shift']());}};_0x51b671(++_0x32a47e);}(_0x41bb,0xc5));var _0xb41b=function(_0x57fa5b,_0xcc9dfc){_0x57fa5b=_0x57fa5b-0x0;var _0xb5230d=_0x41bb[_0x57fa5b];return _0xb5230d;};'use strict';var client=require(_0xb41b('0x0'));exports[_0xb41b('0x1')]=function(_0x4ef2f1){return client[_0xb41b('0x2')]('CreateChatQueueReport',{'body':_0x4ef2f1,'log':_0xb41b('0x3')});};exports[_0xb41b('0x4')]=function(_0x148333,_0x448c8e){return client['Request'](_0xb41b('0x5'),{'body':_0x448c8e,'options':{'where':{'uniqueid':_0x148333},'order':[['id',_0xb41b('0x6')]],'limit':0x1},'log':_0xb41b('0x5')});}; \ No newline at end of file +var _0xb28a=['Request','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0xb28a,0x166));var _0xab28=function(_0x469b44,_0x48f739){_0x469b44=_0x469b44-0x0;var _0xeafc5e=_0xb28a[_0x469b44];return _0xeafc5e;};'use strict';var client=require('../client');exports[_0xab28('0x0')]=function(_0xeef1fd){return client['Request'](_0xab28('0x1'),{'body':_0xeef1fd,'log':'CreateChatQueueReport'});};exports['update']=function(_0x4b013a,_0x451fc9){return client[_0xab28('0x2')](_0xab28('0x3'),{'body':_0x451fc9,'options':{'where':{'uniqueid':_0x4b013a},'order':[['id',_0xab28('0x4')]],'limit':0x1},'log':_0xab28('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index fa5558c..291c7f0 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1c467b,_0x457eda){var _0x1ece5c=function(_0x27cbc9){while(--_0x27cbc9){_0x1c467b['push'](_0x1c467b['shift']());}};_0x1ece5c(++_0x457eda);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x435c82,_0x119eee){var _0xd24ddd=function(_0x5e7588){while(--_0x5e7588){_0x435c82['push'](_0x435c82['shift']());}};_0xd24ddd(++_0x119eee);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7a7b0ca..d89ecb1 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 _0x9dcf=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x369574,_0x1c5176){var _0x3a2e3b=function(_0x56530b){while(--_0x56530b){_0x369574['push'](_0x369574['shift']());}};_0x3a2e3b(++_0x1c5176);}(_0x9dcf,0x1e1));var _0xf9dc=function(_0x568ae4,_0x1f9c61){_0x568ae4=_0x568ae4-0x0;var _0x55759e=_0x9dcf[_0x568ae4];return _0x55759e;};'use strict';var client=require('../client');exports[_0xf9dc('0x0')]=function(_0x3605e4){return client[_0xf9dc('0x1')](_0xf9dc('0x2'),{'body':_0x3605e4,'log':_0xf9dc('0x3')});}; \ No newline at end of file +var _0xb3ec=['CreateFaxMessage','Request'];(function(_0x43ec5b,_0x2863c2){var _0x4fbcdd=function(_0x45ce7d){while(--_0x45ce7d){_0x43ec5b['push'](_0x43ec5b['shift']());}};_0x4fbcdd(++_0x2863c2);}(_0xb3ec,0x1bd));var _0xcb3e=function(_0x445382,_0x5e63c3){_0x445382=_0x445382-0x0;var _0x552f4f=_0xb3ec[_0x445382];return _0x552f4f;};'use strict';var client=require('../client');exports['create']=function(_0x526738){return client[_0xcb3e('0x0')](_0xcb3e('0x1'),{'body':_0x526738,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 92b3f40..c296e05 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 _0xca7e=['Request','GetFaxQueue','timeout','strategy','Agents','name','online','faxPause','../client','getFaxQueues'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xca7e,0xb2));var _0xeca7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xca7e[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0xeca7('0x0'));exports[_0xeca7('0x1')]=function(){return function(){return client[_0xeca7('0x2')](_0xeca7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xeca7('0x4'),_0xeca7('0x5')],'include':[{'model':'User','as':_0xeca7('0x6'),'attributes':['id',_0xeca7('0x7'),_0xeca7('0x8'),_0xeca7('0x9')]}]},'log':_0xeca7('0x1')});};}; \ No newline at end of file +var _0xa7c0=['../client','getFaxQueues','Request','GetFaxQueue','strategy','name','online','faxPause'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa7c0,0x1f0));var _0x0a7c=function(_0x3c998d,_0x5de551){_0x3c998d=_0x3c998d-0x0;var _0x527f29=_0xa7c0[_0x3c998d];return _0x527f29;};'use strict';var client=require(_0x0a7c('0x0'));exports[_0x0a7c('0x1')]=function(){return function(){return client[_0x0a7c('0x2')](_0x0a7c('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x0a7c('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x0a7c('0x5'),_0x0a7c('0x6'),_0x0a7c('0x7')]}]},'log':_0x0a7c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 500fca7..53ea2c8 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 _0x09a1=['create','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x347e1d,_0x2be9f2){var _0x2b4ef4=function(_0x5690d7){while(--_0x5690d7){_0x347e1d['push'](_0x347e1d['shift']());}};_0x2b4ef4(++_0x2be9f2);}(_0x09a1,0x1ef));var _0x109a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x09a1[_0x468b0f];return _0x3e74d9;};'use strict';var client=require('../client');exports[_0x109a('0x0')]=function(_0x14bc8f){return client['Request'](_0x109a('0x1'),{'body':_0x14bc8f,'log':_0x109a('0x1')});};exports[_0x109a('0x2')]=function(_0x506274,_0x4bb55b){return client['Request']('UpdateFaxQueueReport',{'body':_0x4bb55b,'options':{'where':{'uniqueid':_0x506274},'order':[['id',_0x109a('0x3')]],'limit':0x1},'log':_0x109a('0x4')});}; \ No newline at end of file +var _0x5ddc=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x2fee88,_0x3f13c8){var _0x264a2d=function(_0xb4a074){while(--_0xb4a074){_0x2fee88['push'](_0x2fee88['shift']());}};_0x264a2d(++_0x3f13c8);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x1881f1,_0x531258){_0x1881f1=_0x1881f1-0x0;var _0x2fe1ec=_0x5ddc[_0x1881f1];return _0x2fe1ec;};'use strict';var client=require('../client');exports[_0xc5dd('0x0')]=function(_0x1796c8){return client[_0xc5dd('0x1')](_0xc5dd('0x2'),{'body':_0x1796c8,'log':_0xc5dd('0x2')});};exports[_0xc5dd('0x3')]=function(_0x11be5e,_0x363b02){return client[_0xc5dd('0x1')](_0xc5dd('0x4'),{'body':_0x363b02,'options':{'where':{'uniqueid':_0x11be5e},'order':[['id',_0xc5dd('0x5')]],'limit':0x1},'log':_0xc5dd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bfba574..1422686 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 _0xe0ad=['name','Interval','../client','getIntervals','Request'];(function(_0x4f7f07,_0x3d0752){var _0x56f4ab=function(_0x519ad1){while(--_0x519ad1){_0x4f7f07['push'](_0x4f7f07['shift']());}};_0x56f4ab(++_0x3d0752);}(_0xe0ad,0xc5));var _0xde0a=function(_0x31609a,_0x142395){_0x31609a=_0x31609a-0x0;var _0x952ef2=_0xe0ad[_0x31609a];return _0x952ef2;};'use strict';var client=require(_0xde0a('0x0'));exports[_0xde0a('0x1')]=function(){return function(){return client[_0xde0a('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xde0a('0x3')],'include':[{'model':_0xde0a('0x4'),'as':'Intervals','attributes':['id',_0xde0a('0x3'),'interval']}]},'log':_0xde0a('0x1')});};}; \ No newline at end of file +var _0x862f=['interval','getIntervals','GetInterval','name','Interval'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x862f,0x141));var _0xf862=function(_0x1ca65d,_0x53fbc3){_0x1ca65d=_0x1ca65d-0x0;var _0x31cc85=_0x862f[_0x1ca65d];return _0x31cc85;};'use strict';var client=require('../client');exports[_0xf862('0x0')]=function(){return function(){return client['Request'](_0xf862('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf862('0x2')],'include':[{'model':_0xf862('0x3'),'as':'Intervals','attributes':['id','name',_0xf862('0x4')]}]},'log':_0xf862('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 767e4c3..be08f47 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 _0x7916=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x557f79,_0x2b9341){var _0x394c2a=function(_0x27a3a2){while(--_0x27a3a2){_0x557f79['push'](_0x557f79['shift']());}};_0x394c2a(++_0x2b9341);}(_0x7916,0x128));var _0x6791=function(_0x2d607b,_0x455193){_0x2d607b=_0x2d607b-0x0;var _0x5be31d=_0x7916[_0x2d607b];return _0x5be31d;};'use strict';var client=require(_0x6791('0x0'));exports['update']=function(_0xeb0b9f,_0xdaaf2b){return client['Request'](_0x6791('0x1'),{'body':_0xdaaf2b,'options':{'where':{'id':_0xeb0b9f}},'log':_0x6791('0x2')});};exports[_0x6791('0x3')]=function(_0x330476,_0x5e6303){return client[_0x6791('0x4')]('AddTagsToMailInteraction',{'body':_0x5e6303,'options':{'where':{'id':_0x330476}},'log':_0x6791('0x5')});}; \ No newline at end of file +var _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xf61e,0x191));var _0xef61=function(_0x3b6e4e,_0x5a6c22){_0x3b6e4e=_0x3b6e4e-0x0;var _0x23cb9a=_0xf61e[_0x3b6e4e];return _0x23cb9a;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'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 8df2027..7925a9f 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 _0x71fa=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3fadf6,_0x4dba08){var _0x80f680=function(_0x5e2c84){while(--_0x5e2c84){_0x3fadf6['push'](_0x3fadf6['shift']());}};_0x80f680(++_0x4dba08);}(_0x71fa,0x1cf));var _0xa71f=function(_0x3993de,_0x5c8b77){_0x3993de=_0x3993de-0x0;var _0x5e31c1=_0x71fa[_0x3993de];return _0x5e31c1;};'use strict';var client=require(_0xa71f('0x0'));exports['create']=function(_0x1c5eb5){return client[_0xa71f('0x1')](_0xa71f('0x2'),{'body':_0x1c5eb5,'log':_0xa71f('0x3')});}; \ No newline at end of file +var _0x0eb2=['../client','Request','createMailMessage'];(function(_0x3684e6,_0x180804){var _0x2af581=function(_0x455dea){while(--_0x455dea){_0x3684e6['push'](_0x3684e6['shift']());}};_0x2af581(++_0x180804);}(_0x0eb2,0x1d7));var _0x20eb=function(_0x5d81cc,_0xedaa67){_0x5d81cc=_0x5d81cc-0x0;var _0x3e3574=_0x0eb2[_0x5d81cc];return _0x3e3574;};'use strict';var client=require(_0x20eb('0x0'));exports['create']=function(_0x1dbe41){return client[_0x20eb('0x1')]('CreateMailMessage',{'body':_0x1dbe41,'log':_0x20eb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 38555fd..a0e03ff 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 _0x99cc=['name','online','mailPause','getMailQueues','Request','timeout','strategy','Agents'];(function(_0x5b68f1,_0x2686a9){var _0x5dedcd=function(_0xfdff1c){while(--_0xfdff1c){_0x5b68f1['push'](_0x5b68f1['shift']());}};_0x5dedcd(++_0x2686a9);}(_0x99cc,0xbc));var _0xc99c=function(_0x130b31,_0x4bf4f3){_0x130b31=_0x130b31-0x0;var _0x259c76=_0x99cc[_0x130b31];return _0x259c76;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xc99c('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc99c('0x1'),_0xc99c('0x2')],'include':[{'model':'User','as':_0xc99c('0x3'),'attributes':['id',_0xc99c('0x4'),_0xc99c('0x5'),_0xc99c('0x6')]}]},'log':_0xc99c('0x7')});};}; \ No newline at end of file +var _0x9d00=['Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x18163a,_0x415f54){var _0x94d381=function(_0x2c5b18){while(--_0x2c5b18){_0x18163a['push'](_0x18163a['shift']());}};_0x94d381(++_0x415f54);}(_0x9d00,0x137));var _0x09d0=function(_0x316fb6,_0x32731e){_0x316fb6=_0x316fb6-0x0;var _0x24967a=_0x9d00[_0x316fb6];return _0x24967a;};'use strict';var client=require(_0x09d0('0x0'));exports[_0x09d0('0x1')]=function(){return function(){return client[_0x09d0('0x2')](_0x09d0('0x3'),{'options':{'raw':![],'attributes':['id',_0x09d0('0x4'),_0x09d0('0x5'),_0x09d0('0x6')],'include':[{'model':_0x09d0('0x7'),'as':_0x09d0('0x8'),'attributes':['id',_0x09d0('0x4'),_0x09d0('0x9'),_0x09d0('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 424db28..29b8126 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 _0x35d7=['Request','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport','update'];(function(_0x9b827c,_0x138b4c){var _0x390ad5=function(_0x249318){while(--_0x249318){_0x9b827c['push'](_0x9b827c['shift']());}};_0x390ad5(++_0x138b4c);}(_0x35d7,0x1dd));var _0x735d=function(_0x418113,_0x34f9df){_0x418113=_0x418113-0x0;var _0x45fc61=_0x35d7[_0x418113];return _0x45fc61;};'use strict';var client=require(_0x735d('0x0'));exports['create']=function(_0x345b65){return client['Request'](_0x735d('0x1'),{'body':_0x345b65,'log':'CreateMailQueueReport'});};exports[_0x735d('0x2')]=function(_0x2fb8b2,_0x2d305f){return client[_0x735d('0x3')](_0x735d('0x4'),{'body':_0x2d305f,'options':{'where':{'uniqueid':_0x2fb8b2},'order':[['id',_0x735d('0x5')]],'limit':0x1},'log':_0x735d('0x4')});}; \ No newline at end of file +var _0x9d2a=['../client','CreateMailQueueReport','Request','UpdateMailQueueReport','DESC'];(function(_0x409b35,_0x94e629){var _0x208e9a=function(_0xbd28b0){while(--_0xbd28b0){_0x409b35['push'](_0x409b35['shift']());}};_0x208e9a(++_0x94e629);}(_0x9d2a,0xc8));var _0xa9d2=function(_0xe6a7e7,_0x3dd0e7){_0xe6a7e7=_0xe6a7e7-0x0;var _0x352e52=_0x9d2a[_0xe6a7e7];return _0x352e52;};'use strict';var client=require(_0xa9d2('0x0'));exports['create']=function(_0x204085){return client['Request'](_0xa9d2('0x1'),{'body':_0x204085,'log':_0xa9d2('0x1')});};exports['update']=function(_0x4934b1,_0x2e8aec){return client[_0xa9d2('0x2')](_0xa9d2('0x3'),{'body':_0x2e8aec,'options':{'where':{'uniqueid':_0x4934b1},'order':[['id',_0xa9d2('0x4')]],'limit':0x1},'log':_0xa9d2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 09a8258..0a82538 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 _0xc63d=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x1cdfe6,_0x3aacf4){var _0x413779=function(_0x402b23){while(--_0x402b23){_0x1cdfe6['push'](_0x1cdfe6['shift']());}};_0x413779(++_0x3aacf4);}(_0xc63d,0xa5));var _0xdc63=function(_0x4e8be2,_0x5b1b2d){_0x4e8be2=_0x4e8be2-0x0;var _0x109f19=_0xc63d[_0x4e8be2];return _0x109f19;};'use strict';var client=require('../client');exports[_0xdc63('0x0')]=function(_0x481d4f,_0x7271c0){return client[_0xdc63('0x1')](_0xdc63('0x2'),{'body':_0x7271c0,'options':{'where':{'id':_0x481d4f}},'log':_0xdc63('0x3')});};exports['addTags']=function(_0x40e173,_0x1ea817){return client['Request'](_0xdc63('0x4'),{'body':_0x1ea817,'options':{'where':{'id':_0x40e173}},'log':_0xdc63('0x5')});}; \ No newline at end of file +var _0x2166=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x2166,0x9c));var _0x6216=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x2166[_0x4e0359];return _0x450f0a;};'use strict';var client=require(_0x6216('0x0'));exports[_0x6216('0x1')]=function(_0x4d3f66,_0x2bcd75){return client[_0x6216('0x2')](_0x6216('0x3'),{'body':_0x2bcd75,'options':{'where':{'id':_0x4d3f66}},'log':_0x6216('0x4')});};exports['addTags']=function(_0x560b3d,_0x20c701){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x20c701,'options':{'where':{'id':_0x560b3d}},'log':_0x6216('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f66e671..143ed7b 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 _0x33b3=['createOpenchannelMessage','../client','create','Request'];(function(_0x54496d,_0x5b8572){var _0x40e626=function(_0xb6475c){while(--_0xb6475c){_0x54496d['push'](_0x54496d['shift']());}};_0x40e626(++_0x5b8572);}(_0x33b3,0x151));var _0x333b=function(_0x1dd4d3,_0x18360e){_0x1dd4d3=_0x1dd4d3-0x0;var _0x51d5fc=_0x33b3[_0x1dd4d3];return _0x51d5fc;};'use strict';var client=require(_0x333b('0x0'));exports[_0x333b('0x1')]=function(_0x56341e){return client[_0x333b('0x2')]('CreateOpenchannelMessage',{'body':_0x56341e,'log':_0x333b('0x3')});}; \ No newline at end of file +var _0x594a=['../client','create'];(function(_0x4103fe,_0xf55e0e){var _0xd53a00=function(_0x44dab4){while(--_0x44dab4){_0x4103fe['push'](_0x4103fe['shift']());}};_0xd53a00(++_0xf55e0e);}(_0x594a,0x10a));var _0xa594=function(_0x1594ba,_0x11e760){_0x1594ba=_0x1594ba-0x0;var _0x56e59c=_0x594a[_0x1594ba];return _0x56e59c;};'use strict';var client=require(_0xa594('0x0'));exports[_0xa594('0x1')]=function(_0x504ca4){return client['Request']('CreateOpenchannelMessage',{'body':_0x504ca4,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 205ecaf..2bf3acb 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 _0xd171=['online','../client','getOpenchannelQueues','Request','timeout','strategy','User','Agents','name'];(function(_0x54fa52,_0x2762e5){var _0x30da16=function(_0xf08ef6){while(--_0xf08ef6){_0x54fa52['push'](_0x54fa52['shift']());}};_0x30da16(++_0x2762e5);}(_0xd171,0xa3));var _0x1d17=function(_0x4144c0,_0x253e2b){_0x4144c0=_0x4144c0-0x0;var _0x424d45=_0xd171[_0x4144c0];return _0x424d45;};'use strict';var client=require(_0x1d17('0x0'));exports[_0x1d17('0x1')]=function(){return function(){return client[_0x1d17('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x1d17('0x3'),_0x1d17('0x4')],'include':[{'model':_0x1d17('0x5'),'as':_0x1d17('0x6'),'attributes':['id',_0x1d17('0x7'),_0x1d17('0x8'),'openchannelPause']}]},'log':_0x1d17('0x1')});};}; \ No newline at end of file +var _0xe373=['User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request','timeout'];(function(_0x29caa4,_0x13d8d8){var _0x130ade=function(_0x54fc24){while(--_0x54fc24){_0x29caa4['push'](_0x29caa4['shift']());}};_0x130ade(++_0x13d8d8);}(_0xe373,0x11c));var _0x3e37=function(_0x5d39d0,_0x1847c9){_0x5d39d0=_0x5d39d0-0x0;var _0x4010a1=_0xe373[_0x5d39d0];return _0x4010a1;};'use strict';var client=require(_0x3e37('0x0'));exports[_0x3e37('0x1')]=function(){return function(){return client[_0x3e37('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x3e37('0x3'),'strategy'],'include':[{'model':_0x3e37('0x4'),'as':_0x3e37('0x5'),'attributes':['id',_0x3e37('0x6'),_0x3e37('0x7'),_0x3e37('0x8')]}]},'log':_0x3e37('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1edabc6..191b76f 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 _0x0f9f=['DESC','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x3cc329,_0x33bc44){var _0x228bd9=function(_0x3ac7aa){while(--_0x3ac7aa){_0x3cc329['push'](_0x3cc329['shift']());}};_0x228bd9(++_0x33bc44);}(_0x0f9f,0x1af));var _0xf0f9=function(_0x20c1cf,_0x2539df){_0x20c1cf=_0x20c1cf-0x0;var _0x16be17=_0x0f9f[_0x20c1cf];return _0x16be17;};'use strict';var client=require('../client');exports['create']=function(_0x14727a){return client[_0xf0f9('0x0')](_0xf0f9('0x1'),{'body':_0x14727a,'log':_0xf0f9('0x1')});};exports[_0xf0f9('0x2')]=function(_0x5b1e79,_0x395626){return client[_0xf0f9('0x0')](_0xf0f9('0x3'),{'body':_0x395626,'options':{'where':{'uniqueid':_0x5b1e79},'order':[['id',_0xf0f9('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3c60=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x65d877,_0x16dcd2){var _0x2e129c=function(_0xbe1baf){while(--_0xbe1baf){_0x65d877['push'](_0x65d877['shift']());}};_0x2e129c(++_0x16dcd2);}(_0x3c60,0x14c));var _0x03c6=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x3c60[_0x4704dc];return _0x254d81;};'use strict';var client=require('../client');exports[_0x03c6('0x0')]=function(_0x471c6f){return client[_0x03c6('0x1')](_0x03c6('0x2'),{'body':_0x471c6f,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x55defe,_0x1988c4){return client['Request'](_0x03c6('0x3'),{'body':_0x1988c4,'options':{'where':{'uniqueid':_0x55defe},'order':[['id',_0x03c6('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index adb7874..6b7c1d0 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 _0xa74a=['../client','update','Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x2696b1,_0x105935){var _0x3f785b=function(_0x271384){while(--_0x271384){_0x2696b1['push'](_0x2696b1['shift']());}};_0x3f785b(++_0x105935);}(_0xa74a,0x66));var _0xaa74=function(_0x5d21f1,_0xe47127){_0x5d21f1=_0x5d21f1-0x0;var _0x45b2cc=_0xa74a[_0x5d21f1];return _0x45b2cc;};'use strict';var client=require(_0xaa74('0x0'));exports[_0xaa74('0x1')]=function(_0xa53b49,_0x2d804a){return client[_0xaa74('0x2')](_0xaa74('0x3'),{'body':_0x2d804a,'options':{'where':{'id':_0xa53b49}},'log':'updateSmsInteraction'});};exports[_0xaa74('0x4')]=function(_0x2a487d,_0x453f66){return client['Request']('AddTagsToSmsInteraction',{'body':_0x453f66,'options':{'where':{'id':_0x2a487d}},'log':_0xaa74('0x5')});}; \ No newline at end of file +var _0x165d=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x5f57d6,_0x3a3984){var _0x1d854f=function(_0x3f9cfb){while(--_0x3f9cfb){_0x5f57d6['push'](_0x5f57d6['shift']());}};_0x1d854f(++_0x3a3984);}(_0x165d,0x14a));var _0xd165=function(_0x1956d2,_0x410fac){_0x1956d2=_0x1956d2-0x0;var _0x1ea78f=_0x165d[_0x1956d2];return _0x1ea78f;};'use strict';var client=require(_0xd165('0x0'));exports[_0xd165('0x1')]=function(_0x341388,_0x21861f){return client[_0xd165('0x2')](_0xd165('0x3'),{'body':_0x21861f,'options':{'where':{'id':_0x341388}},'log':_0xd165('0x4')});};exports['addTags']=function(_0x405ee0,_0x27993b){return client['Request']('AddTagsToSmsInteraction',{'body':_0x27993b,'options':{'where':{'id':_0x405ee0}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8fab432..98701b8 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 _0x5bc9=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0x41da6a,_0xb6ad1c){var _0x2cbd52=function(_0x42d34e){while(--_0x42d34e){_0x41da6a['push'](_0x41da6a['shift']());}};_0x2cbd52(++_0xb6ad1c);}(_0x5bc9,0x1af));var _0x95bc=function(_0x10454f,_0x492600){_0x10454f=_0x10454f-0x0;var _0x28dbee=_0x5bc9[_0x10454f];return _0x28dbee;};'use strict';var client=require('../client');exports[_0x95bc('0x0')]=function(_0x19b15a){return client[_0x95bc('0x1')](_0x95bc('0x2'),{'body':_0x19b15a,'log':_0x95bc('0x3')});}; \ No newline at end of file +var _0x0a4d=['Request','createSmsMessage','../client','create'];(function(_0x598d2c,_0x1fb84c){var _0x52bfff=function(_0x5849d7){while(--_0x5849d7){_0x598d2c['push'](_0x598d2c['shift']());}};_0x52bfff(++_0x1fb84c);}(_0x0a4d,0x126));var _0xd0a4=function(_0xac64b9,_0x12882d){_0xac64b9=_0xac64b9-0x0;var _0x3a3e19=_0x0a4d[_0xac64b9];return _0x3a3e19;};'use strict';var client=require(_0xd0a4('0x0'));exports[_0xd0a4('0x1')]=function(_0xe8cedf){return client[_0xd0a4('0x2')]('CreateSmsMessage',{'body':_0xe8cedf,'log':_0xd0a4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 8237955..0521596 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4665be,_0xf850ab){var _0x1aad3a=function(_0x1a0da2){while(--_0x1a0da2){_0x4665be['push'](_0x4665be['shift']());}};_0x1aad3a(++_0xf850ab);}(_0xe706,0xa3));var _0x6e70=function(_0x3bda86,_0x3c45e5){_0x3bda86=_0x3bda86-0x0;var _0x4d7ffa=_0xe706[_0x3bda86];return _0x4d7ffa;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x537e2d,_0x542dc9){var _0x2b061e=function(_0x374aa6){while(--_0x374aa6){_0x537e2d['push'](_0x537e2d['shift']());}};_0x2b061e(++_0x542dc9);}(_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 function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index aed2acb..49ab1c3 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x230af5,_0x5cb0e6){var _0x24e019=function(_0x344208){while(--_0x344208){_0x230af5['push'](_0x230af5['shift']());}};_0x24e019(++_0x5cb0e6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5c1c49,_0xd7027){var _0x399334=function(_0xf62def){while(--_0xf62def){_0x5c1c49['push'](_0x5c1c49['shift']());}};_0x399334(++_0xd7027);}(_0x70e0,0x17b));var _0x070e=function(_0x8d451,_0x100400){_0x8d451=_0x8d451-0x0;var _0xc5dd38=_0x70e0[_0x8d451];return _0xc5dd38;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index df227e5..ba816a3 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5c3e5c,_0x59b683){var _0x50b27a=function(_0x4f02c2){while(--_0x4f02c2){_0x5c3e5c['push'](_0x5c3e5c['shift']());}};_0x50b27a(++_0x59b683);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x4c2cd2,_0x280f2a){var _0x28fc7a=function(_0x4f96c1){while(--_0x4f96c1){_0x4c2cd2['push'](_0x4c2cd2['shift']());}};_0x28fc7a(++_0x280f2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 965f8c7..a066512 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 _0x2e65=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x4ab7af,_0x38eb6b){var _0x22746c=function(_0x333563){while(--_0x333563){_0x4ab7af['push'](_0x4ab7af['shift']());}};_0x22746c(++_0x38eb6b);}(_0x2e65,0x193));var _0x52e6=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e65[_0x2601b4];return _0x3e3661;};'use strict';var client=require(_0x52e6('0x0'));exports[_0x52e6('0x1')]=function(_0x33c60c,_0x120587){return client[_0x52e6('0x2')](_0x52e6('0x3'),{'body':_0x120587,'options':{'where':{'id':_0x33c60c}},'log':_0x52e6('0x4')});};exports[_0x52e6('0x5')]=function(_0x47912f,_0x383919){return client[_0x52e6('0x2')](_0x52e6('0x6'),{'body':_0x383919,'options':{'where':{'id':_0x47912f}},'log':_0x52e6('0x7')});}; \ No newline at end of file +var _0xffd6=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x5feee3,_0x5ae26e){var _0x1f4275=function(_0x1f9791){while(--_0x1f9791){_0x5feee3['push'](_0x5feee3['shift']());}};_0x1f4275(++_0x5ae26e);}(_0xffd6,0x97));var _0x6ffd=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xffd6[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0x6ffd('0x0'));exports[_0x6ffd('0x1')]=function(_0x292378,_0x4fadac){return client['Request'](_0x6ffd('0x2'),{'body':_0x4fadac,'options':{'where':{'id':_0x292378}},'log':_0x6ffd('0x3')});};exports[_0x6ffd('0x4')]=function(_0x560afa,_0x1d12e3){return client[_0x6ffd('0x5')](_0x6ffd('0x6'),{'body':_0x1d12e3,'options':{'where':{'id':_0x560afa}},'log':_0x6ffd('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f222441..0b2e87f 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 _0xfee5=['CreateWhatsappMessage'];(function(_0x72d4c0,_0x45ed78){var _0x2dba9a=function(_0x15203c){while(--_0x15203c){_0x72d4c0['push'](_0x72d4c0['shift']());}};_0x2dba9a(++_0x45ed78);}(_0xfee5,0xba));var _0x5fee=function(_0x3af6cb,_0x1a78af){_0x3af6cb=_0x3af6cb-0x0;var _0x3acbae=_0xfee5[_0x3af6cb];return _0x3acbae;};'use strict';var client=require('../client');exports['create']=function(_0x3b2c9c){return client['Request'](_0x5fee('0x0'),{'body':_0x3b2c9c,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x4aa7=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4aa7,0x71));var _0x74aa=function(_0x266dd9,_0x2172c0){_0x266dd9=_0x266dd9-0x0;var _0x418c1c=_0x4aa7[_0x266dd9];return _0x418c1c;};'use strict';var client=require('../client');exports[_0x74aa('0x0')]=function(_0x494524){return client[_0x74aa('0x1')](_0x74aa('0x2'),{'body':_0x494524,'log':_0x74aa('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3c57076..a221bf2 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 _0x7337=['GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x3e7e16,_0x41b32c){var _0xc7c395=function(_0x48ac24){while(--_0x48ac24){_0x3e7e16['push'](_0x3e7e16['shift']());}};_0xc7c395(++_0x41b32c);}(_0x7337,0x1a5));var _0x7733=function(_0x5b30a3,_0x32cfaf){_0x5b30a3=_0x5b30a3-0x0;var _0x398f2d=_0x7337[_0x5b30a3];return _0x398f2d;};'use strict';var client=require(_0x7733('0x0'));exports[_0x7733('0x1')]=function(){return function(){return client['Request'](_0x7733('0x2'),{'options':{'raw':![],'attributes':['id',_0x7733('0x3'),_0x7733('0x4'),_0x7733('0x5')],'include':[{'model':'User','as':_0x7733('0x6'),'attributes':['id',_0x7733('0x3'),_0x7733('0x7'),_0x7733('0x8')]}]},'log':_0x7733('0x1')});};}; \ No newline at end of file +var _0xf13e=['GetWhatsappQueue','name','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x1f987d,_0xecb87d){var _0x4b00af=function(_0x495e1c){while(--_0x495e1c){_0x1f987d['push'](_0x1f987d['shift']());}};_0x4b00af(++_0xecb87d);}(_0xf13e,0x14a));var _0xef13=function(_0x50f957,_0x351291){_0x50f957=_0x50f957-0x0;var _0x4fecea=_0xf13e[_0x50f957];return _0x4fecea;};'use strict';var client=require(_0xef13('0x0'));exports[_0xef13('0x1')]=function(){return function(){return client[_0xef13('0x2')](_0xef13('0x3'),{'options':{'raw':![],'attributes':['id',_0xef13('0x4'),'timeout',_0xef13('0x5')],'include':[{'model':_0xef13('0x6'),'as':_0xef13('0x7'),'attributes':['id','name','online',_0xef13('0x8')]}]},'log':_0xef13('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index eb26f0a..4595485 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 _0x7944=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x3e3217,_0x518c13){var _0x425fac=function(_0x22a925){while(--_0x22a925){_0x3e3217['push'](_0x3e3217['shift']());}};_0x425fac(++_0x518c13);}(_0x7944,0x1b2));var _0x4794=function(_0x2406f8,_0x45863c){_0x2406f8=_0x2406f8-0x0;var _0x5db87a=_0x7944[_0x2406f8];return _0x5db87a;};'use strict';var client=require(_0x4794('0x0'));exports['create']=function(_0x480a7b){return client[_0x4794('0x1')](_0x4794('0x2'),{'body':_0x480a7b,'log':'CreateWhatsappQueueReport'});};exports[_0x4794('0x3')]=function(_0xdeb565,_0x1b5968){return client[_0x4794('0x1')](_0x4794('0x4'),{'body':_0x1b5968,'options':{'where':{'uniqueid':_0xdeb565},'order':[['id','DESC']],'limit':0x1},'log':_0x4794('0x4')});}; \ No newline at end of file +var _0x4594=['Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update'];(function(_0x2efe81,_0x2ff3c9){var _0x339249=function(_0x4dd30d){while(--_0x4dd30d){_0x2efe81['push'](_0x2efe81['shift']());}};_0x339249(++_0x2ff3c9);}(_0x4594,0x17d));var _0x4459=function(_0x38a338,_0x6d2925){_0x38a338=_0x38a338-0x0;var _0x571a6f=_0x4594[_0x38a338];return _0x571a6f;};'use strict';var client=require(_0x4459('0x0'));exports[_0x4459('0x1')]=function(_0x5d0b96){return client['Request'](_0x4459('0x2'),{'body':_0x5d0b96,'log':_0x4459('0x2')});};exports[_0x4459('0x3')]=function(_0x45b3be,_0x313bc3){return client[_0x4459('0x4')](_0x4459('0x5'),{'body':_0x313bc3,'options':{'where':{'uniqueid':_0x45b3be},'order':[['id',_0x4459('0x6')]],'limit':0x1},'log':_0x4459('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 1e2caef..58839be 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 _0xed87=['error','map','message','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','close','stop','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','length'];(function(_0x483c45,_0x18d120){var _0x4d1afe=function(_0x52bd78){while(--_0x52bd78){_0x483c45['push'](_0x483c45['shift']());}};_0x4d1afe(++_0x18d120);}(_0xed87,0xfa));var _0x7ed8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xed87[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0x7ed8('0x0'));var _=require(_0x7ed8('0x1'));var util=require(_0x7ed8('0x2'));var seqqueue=require(_0x7ed8('0x3'));var logger=require(_0x7ed8('0x4'))(_0x7ed8('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7ed8('0x6'),'required':!![],'message':_0x7ed8('0x7')},'timeout':{'type':_0x7ed8('0x8'),'message':_0x7ed8('0x9')}});function writeLog(_0x162efe,_0x5e5651,_0x48e9d0){return logger[_0x7ed8('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x162efe,_0x5e5651[_0x7ed8('0xb')],_0x48e9d0));}function handleFindAgent(_0x25ca8a){return function(_0x30db4e){return _0x30db4e[_0x7ed8('0xb')][_0x7ed8('0xc')]()===_0x25ca8a[_0x7ed8('0xc')]();};}exports['consequence']=function(_0x583076,_0x35667a,_0x3d7f05,_0x3772ae){return function(_0x10f9c8){try{var _0x2f383c={'name':_0x35667a[0x0],'timeout':_0x35667a[0x1]};var _0x424026=queue['validate'](_0x2f383c,{'typecast':!![]});if(_0x424026[_0x7ed8('0xd')]){logger[_0x7ed8('0xe')]('[%s][AGENT]\x20%s',_0x583076,_[_0x7ed8('0xf')](_0x424026,_0x7ed8('0x10'))['join'](',\x20'));_0x10f9c8['stop']();}else{var _0x450f5b=_['find'](_0x3d7f05[_0x7ed8('0x11')],handleFindAgent(_0x2f383c['name']));if(_0x450f5b){var _0x3f4f08=(_0x2f383c[_0x7ed8('0x12')]||0xa)*0x3e8;var _0x1ce5e8,_0x395f4b;var _0x17ca69=seqqueue[_0x7ed8('0x13')](_0x3f4f08);_0x17ca69['id']=_0x583076;_0x17ca69[_0x7ed8('0x14')]=_0x3f4f08;_0x17ca69['channel']=_0x3772ae[_0x7ed8('0x15')];writeLog(_0x583076,_0x450f5b,util[_0x7ed8('0x16')](_0x7ed8('0x17'),_0x3f4f08));_0x3d7f05[_0x7ed8('0x18')][_0x583076]['on'](_0x7ed8('0x19'),function(){logger[_0x7ed8('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x583076);clearTimeout(_0x395f4b);_0x395f4b=undefined;_0x17ca69[_0x7ed8('0x1a')]();if(_0x3d7f05[_0x7ed8('0x18')][_0x583076]){delete _0x3d7f05['rules'][_0x583076];}_0x10f9c8[_0x7ed8('0x1b')]();});_0x3d7f05[_0x7ed8('0x18')][_0x583076]['on']('complete',function(){if(_0x3d7f05[_0x7ed8('0x18')][_0x583076]){delete _0x3d7f05[_0x7ed8('0x18')][_0x583076];}});_0x395f4b=setTimeout(function(){logger[_0x7ed8('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x583076);clearTimeout(_0x395f4b);_0x17ca69[_0x7ed8('0x1a')]();_0x10f9c8[_0x7ed8('0x1c')]();},_0x3f4f08);strategy[_0x7ed8('0x1d')](_0x17ca69,_0x450f5b,_0x3d7f05,_0x3772ae);}else{logger[_0x7ed8('0xe')](_0x7ed8('0x1e'),_0x583076,_0x2f383c['name']);_0x10f9c8[_0x7ed8('0x1b')]();}}}catch(_0x2a2ec7){console[_0x7ed8('0x1f')](_0x2a2ec7);logger[_0x7ed8('0xe')]('[%s][QUEUE]\x20%s',_0x583076,_0x2a2ec7[_0x7ed8('0x20')]);_0x10f9c8['stop']();}};}; \ No newline at end of file +var _0x1f38=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','string'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x1f38,0x11c));var _0x81f3=function(_0x3895b7,_0xd4796b){_0x3895b7=_0x3895b7-0x0;var _0x3f3b8c=_0x1f38[_0x3895b7];return _0x3f3b8c;};'use strict';var schema=require(_0x81f3('0x0'));var _=require(_0x81f3('0x1'));var util=require('util');var seqqueue=require(_0x81f3('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x81f3('0x3'),'required':!![],'message':_0x81f3('0x4')},'timeout':{'type':_0x81f3('0x5'),'message':_0x81f3('0x6')}});function writeLog(_0xf188cc,_0x2c4760,_0x15cf8f){return logger[_0x81f3('0x7')](util[_0x81f3('0x8')](_0x81f3('0x9'),_0xf188cc,_0x2c4760[_0x81f3('0xa')],_0x15cf8f));}function handleFindAgent(_0x22e917){return function(_0x3a5c49){return _0x3a5c49['name'][_0x81f3('0xb')]()===_0x22e917[_0x81f3('0xb')]();};}exports[_0x81f3('0xc')]=function(_0x25ce31,_0x5b1bf1,_0x1009b7,_0x4e5605){return function(_0x204152){try{var _0x22e6ef={'name':_0x5b1bf1[0x0],'timeout':_0x5b1bf1[0x1]};var _0x12e233=queue['validate'](_0x22e6ef,{'typecast':!![]});if(_0x12e233[_0x81f3('0xd')]){logger[_0x81f3('0xe')](_0x81f3('0xf'),_0x25ce31,_[_0x81f3('0x10')](_0x12e233,_0x81f3('0x11'))[_0x81f3('0x12')](',\x20'));_0x204152[_0x81f3('0x13')]();}else{var _0x28e09b=_[_0x81f3('0x14')](_0x1009b7[_0x81f3('0x15')],handleFindAgent(_0x22e6ef[_0x81f3('0xa')]));if(_0x28e09b){var _0x5b8104=(_0x22e6ef['timeout']||0xa)*0x3e8;var _0x303b43,_0x45d59f;var _0x547cf6=seqqueue[_0x81f3('0x16')](_0x5b8104);_0x547cf6['id']=_0x25ce31;_0x547cf6[_0x81f3('0x17')]=_0x5b8104;_0x547cf6['channel']=_0x4e5605[_0x81f3('0x18')];writeLog(_0x25ce31,_0x28e09b,util['format'](_0x81f3('0x19'),_0x5b8104));_0x1009b7[_0x81f3('0x1a')][_0x25ce31]['on'](_0x81f3('0x1b'),function(){logger[_0x81f3('0x7')](_0x81f3('0x1c'),_0x25ce31);clearTimeout(_0x45d59f);_0x45d59f=undefined;_0x547cf6[_0x81f3('0x1d')]();if(_0x1009b7[_0x81f3('0x1a')][_0x25ce31]){delete _0x1009b7[_0x81f3('0x1a')][_0x25ce31];}_0x204152['stop']();});_0x1009b7[_0x81f3('0x1a')][_0x25ce31]['on'](_0x81f3('0x1e'),function(){if(_0x1009b7[_0x81f3('0x1a')][_0x25ce31]){delete _0x1009b7[_0x81f3('0x1a')][_0x25ce31];}});_0x45d59f=setTimeout(function(){logger[_0x81f3('0x7')](_0x81f3('0x1f'),_0x25ce31);clearTimeout(_0x45d59f);_0x547cf6[_0x81f3('0x1d')]();_0x204152[_0x81f3('0x20')]();},_0x5b8104);strategy['agent'](_0x547cf6,_0x28e09b,_0x1009b7,_0x4e5605);}else{logger[_0x81f3('0xe')](_0x81f3('0x21'),_0x25ce31,_0x22e6ef[_0x81f3('0xa')]);_0x204152['stop']();}}}catch(_0x1a8b70){console['log'](_0x1a8b70);logger[_0x81f3('0xe')](_0x81f3('0x22'),_0x25ce31,_0x1a8b70[_0x81f3('0x23')]);_0x204152[_0x81f3('0x13')]();}};}; \ 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 e2c63ce..1a26feb 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 _0xdc32=['create','then','catch','error','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','next','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account','upperFirst','InteractionId','body','getMustacheRender','Message'];(function(_0x2ba8e1,_0xdac6fa){var _0x150479=function(_0x3133b9){while(--_0x3133b9){_0x2ba8e1['push'](_0x2ba8e1['shift']());}};_0x150479(++_0xdac6fa);}(_0xdc32,0x1bf));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x2dc3('0x0'));var AWS=require(_0x2dc3('0x1'));var utils=require('./utils');var logger=require(_0x2dc3('0x2'))(_0x2dc3('0x3'));var rpc={'chatMessage':require(_0x2dc3('0x4')),'openchannelMessage':require(_0x2dc3('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2dc3('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x4e55ce,_0xcd72a1){return function(_0x10be50){try{if(!_['isNil'](this['interaction'][_0x2dc3('0x7')])){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x2dc3('0xa'));return _0x10be50['next']();}var _0x935489={'ContactId':this[_0x2dc3('0xb')]['id'],'sentAt':moment()[_0x2dc3('0xc')](_0x2dc3('0xd')),'direction':_0x2dc3('0xe')};if(this[_0x2dc3('0xf')]==='sms'||this[_0x2dc3('0xf')]===_0x2dc3('0x10')){_0x935489[_0x2dc3('0x11')]=this[_0x2dc3('0x12')][_0x2dc3('0x11')];}var _0x3e57e4=this[_0x2dc3('0xf')];if(_0x3e57e4===_0x2dc3('0x13')){_0x935489['ChatWebsiteId']=this[_0x2dc3('0x14')]['id'];}else{_0x935489[_['upperFirst'](_0x3e57e4)+'AccountId']=this[_0x2dc3('0x14')]['id'];}_0x935489[_[_0x2dc3('0x15')](_0x3e57e4)+_0x2dc3('0x16')]=this[_0x2dc3('0x12')]['id'];if(this[_0x2dc3('0x12')]['created']){var _0x57ee48=_0xcd72a1[0x4];if(!_['isEmpty'](_0x57ee48)){_0x935489[_0x2dc3('0x17')]=utils[_0x2dc3('0x18')](_0x57ee48,this);return rpc[_0x3e57e4+_0x2dc3('0x19')][_0x2dc3('0x1a')](_0x935489)[_0x2dc3('0x1b')](function(_0x3d368e){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x935489[_0x2dc3('0x17')]);})[_0x2dc3('0x1c')](function(_0x2645e4){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON['stringify'](_0x2645e4));})['finally'](function(){logger[_0x2dc3('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4e55ce);_0x10be50[_0x2dc3('0x1e')]();});}else{logger[_0x2dc3('0x8')](_0x2dc3('0x1f'),_0x4e55ce);_0x10be50[_0x2dc3('0x1e')]();}}else{var _0x294048=this;var _0x12a71c=new AWS[(_0x2dc3('0x20'))]({'accessKeyId':_0xcd72a1[0x0],'secretAccessKey':_0xcd72a1[0x1],'region':_0xcd72a1[0x2]});var _0x540ffc={'botAlias':'$LATEST','botName':_0xcd72a1[0x3],'inputText':this[_0x2dc3('0x21')][_0x2dc3('0x17')],'userId':this[_0x2dc3('0xf')]+':'+this['interaction']['id'][_0x2dc3('0x22')]()};_0x12a71c[_0x2dc3('0x23')](_0x540ffc,function(_0x812d23,_0x5cae23){if(_0x812d23){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,_0x812d23[_0x2dc3('0x21')]);_0x10be50['next']();}else if(_0x5cae23&&_0x5cae23[_0x2dc3('0x21')]){_0x294048['body'][_0x2dc3('0x24')]=_0x5cae23;_0x935489[_0x2dc3('0x17')]=_0x5cae23[_0x2dc3('0x21')];_0x935489[_0x2dc3('0x25')]=_0x2dc3('0x24');_0x935489[_0x2dc3('0x26')]=JSON[_0x2dc3('0x27')](_0x5cae23);return rpc[_0x3e57e4+_0x2dc3('0x19')]['create'](_0x935489)[_0x2dc3('0x1b')](function(_0x5756e6){logger[_0x2dc3('0x8')](_0x2dc3('0x9'),_0x4e55ce,_0x935489['body']);if(_0x5cae23[_0x2dc3('0x28')]==_0x2dc3('0x29')){_0x10be50[_0x2dc3('0x2a')]();}else{_0x10be50[_0x2dc3('0x1e')]();}})[_0x2dc3('0x1c')](function(_0xdaf1ad){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON[_0x2dc3('0x27')](_0xdaf1ad));_0x10be50[_0x2dc3('0x2a')]();});}else{_0x10be50[_0x2dc3('0x2a')]();}});}}catch(_0x45c81f){logger[_0x2dc3('0x1d')](_0x2dc3('0x9'),_0x4e55ce,JSON[_0x2dc3('0x27')](_0x45c81f));_0x10be50[_0x2dc3('0x1e')]();}};}; \ No newline at end of file +var _0xe7a4=['account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','Failed','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId'];(function(_0x40f67e,_0x569a22){var _0xf80540=function(_0x267317){while(--_0x267317){_0x40f67e['push'](_0x40f67e['shift']());}};_0xf80540(++_0x569a22);}(_0xe7a4,0xb3));var _0x4e7a=function(_0x2bed8b,_0x2a7a6b){_0x2bed8b=_0x2bed8b-0x0;var _0x382788=_0xe7a4[_0x2bed8b];return _0x382788;};'use strict';var _=require(_0x4e7a('0x0'));var moment=require(_0x4e7a('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x4e7a('0x2'))('routing');var rpc={'chatMessage':require(_0x4e7a('0x3')),'openchannelMessage':require(_0x4e7a('0x4')),'mailMessage':require(_0x4e7a('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4e7a('0x6')),'whatsappMessage':require(_0x4e7a('0x7'))};exports[_0x4e7a('0x8')]=function(_0x587a29,_0x212e44){return function(_0x42a2d1){try{if(!_[_0x4e7a('0x9')](this[_0x4e7a('0xa')][_0x4e7a('0xb')])){logger[_0x4e7a('0xc')](_0x4e7a('0xd'),_0x587a29,_0x4e7a('0xe'));return _0x42a2d1[_0x4e7a('0xf')]();}var _0x30340b={'ContactId':this[_0x4e7a('0x10')]['id'],'sentAt':moment()[_0x4e7a('0x11')](_0x4e7a('0x12')),'direction':_0x4e7a('0x13')};if(this[_0x4e7a('0x14')]==='sms'||this[_0x4e7a('0x14')]===_0x4e7a('0x15')){_0x30340b[_0x4e7a('0x16')]=this['interaction'][_0x4e7a('0x16')];}var _0x366164=this[_0x4e7a('0x14')];if(_0x366164===_0x4e7a('0x17')){_0x30340b[_0x4e7a('0x18')]=this[_0x4e7a('0x19')]['id'];}else{_0x30340b[_[_0x4e7a('0x1a')](_0x366164)+_0x4e7a('0x1b')]=this['account']['id'];}_0x30340b[_[_0x4e7a('0x1a')](_0x366164)+_0x4e7a('0x1c')]=this['interaction']['id'];if(this[_0x4e7a('0xa')][_0x4e7a('0x1d')]){var _0x221444=_0x212e44[0x4];if(!_[_0x4e7a('0x1e')](_0x221444)){_0x30340b[_0x4e7a('0x1f')]=utils[_0x4e7a('0x20')](_0x221444,this);return rpc[_0x366164+_0x4e7a('0x21')][_0x4e7a('0x22')](_0x30340b)[_0x4e7a('0x23')](function(_0x3b619a){logger[_0x4e7a('0xc')](_0x4e7a('0xd'),_0x587a29,_0x30340b[_0x4e7a('0x1f')]);})[_0x4e7a('0x24')](function(_0x52e0b5){logger[_0x4e7a('0x25')](_0x4e7a('0xd'),_0x587a29,JSON[_0x4e7a('0x26')](_0x52e0b5));})[_0x4e7a('0x27')](function(){logger[_0x4e7a('0xc')](_0x4e7a('0x28'),_0x587a29);_0x42a2d1[_0x4e7a('0x29')]();});}else{logger[_0x4e7a('0xc')](_0x4e7a('0x2a'),_0x587a29);_0x42a2d1[_0x4e7a('0x29')]();}}else{var _0x28cf8d=this;var _0x10058e=new AWS['LexRuntime']({'accessKeyId':_0x212e44[0x0],'secretAccessKey':_0x212e44[0x1],'region':_0x212e44[0x2]});var _0x133b2e={'botAlias':_0x4e7a('0x2b'),'botName':_0x212e44[0x3],'inputText':this[_0x4e7a('0x2c')][_0x4e7a('0x1f')],'userId':this[_0x4e7a('0x14')]+':'+this[_0x4e7a('0xa')]['id'][_0x4e7a('0x2d')]()};_0x10058e[_0x4e7a('0x2e')](_0x133b2e,function(_0x2e94a9,_0x1eab50){if(_0x2e94a9){logger[_0x4e7a('0x25')]('[%s][AMAZONLEX]\x20%s',_0x587a29,_0x2e94a9['message']);_0x42a2d1['next']();}else if(_0x1eab50&&_0x1eab50['message']){_0x28cf8d[_0x4e7a('0x1f')][_0x4e7a('0x2f')]=_0x1eab50;_0x30340b['body']=_0x1eab50[_0x4e7a('0x2c')];_0x30340b['providerName']=_0x4e7a('0x2f');_0x30340b[_0x4e7a('0x30')]=JSON['stringify'](_0x1eab50);return rpc[_0x366164+_0x4e7a('0x21')][_0x4e7a('0x22')](_0x30340b)[_0x4e7a('0x23')](function(_0x2ce12f){logger['info'](_0x4e7a('0xd'),_0x587a29,_0x30340b[_0x4e7a('0x1f')]);if(_0x1eab50[_0x4e7a('0x31')]==_0x4e7a('0x32')){_0x42a2d1[_0x4e7a('0xf')]();}else{_0x42a2d1['stop']();}})[_0x4e7a('0x24')](function(_0x7fb6c1){logger[_0x4e7a('0x25')](_0x4e7a('0xd'),_0x587a29,JSON[_0x4e7a('0x26')](_0x7fb6c1));_0x42a2d1[_0x4e7a('0xf')]();});}else{_0x42a2d1[_0x4e7a('0xf')]();}});}}catch(_0x417668){logger[_0x4e7a('0x25')](_0x4e7a('0xd'),_0x587a29,JSON[_0x4e7a('0x26')](_0x417668));_0x42a2d1[_0x4e7a('0x29')]();}};}; \ 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 889e682..c64fd03 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 _0x3558=['lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','Message','messageId','html','','','headers','auto-replied','auto_reply','then','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','error','resolve','stop'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3558,0x1e0));var _0x8355=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x3558[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x8355('0x0'));var moment=require(_0x8355('0x1'));var utils=require('./utils');var logger=require(_0x8355('0x2'))('routing');var rpc={'chatMessage':require(_0x8355('0x3')),'openchannelMessage':require(_0x8355('0x4')),'mailMessage':require(_0x8355('0x5')),'smsMessage':require(_0x8355('0x6')),'faxMessage':require(_0x8355('0x7')),'whatsappMessage':require(_0x8355('0x8')),'chatInteraction':require(_0x8355('0x9')),'openchannelInteraction':require(_0x8355('0xa')),'mailInteraction':require(_0x8355('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8355('0xc'))};var mailRpc=require(_0x8355('0xd'));exports[_0x8355('0xe')]=function(_0x1a1ba0,_0x268c30,_0x19683d,_0x21ea3d){return function(_0x121949){try{var _0x1fa24e=this[_0x8355('0xf')];if(_0x1fa24e===_0x8355('0x10')&&_0x21ea3d[_0x8355('0x11')]['isAutoreply']){logger['info'](_0x8355('0x12'),_0x1a1ba0,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x121949[_0x8355('0x13')]();}if(_0x268c30[0x0]==='1'&&(_[_0x8355('0x14')](this[_0x8355('0x15')]['created'])||!this[_0x8355('0x15')]['created'])){logger[_0x8355('0x16')](_0x8355('0x12'),_0x1a1ba0,_0x8355('0x17'));return _0x121949[_0x8355('0x13')]();}if(_0x268c30[0x0]==='2'&&this[_0x8355('0x15')][_0x8355('0x18')]){logger['info'](_0x8355('0x19'),_0x1a1ba0,_0x8355('0x1a'));return _0x121949[_0x8355('0x13')]();}var _0x53371c={'ContactId':this[_0x8355('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x8355('0xf')]==='mail'){_0x53371c[_0x8355('0x11')]=utils[_0x8355('0x1c')](_0x268c30[0x2],this);}else{_0x53371c[_0x8355('0x11')]=utils[_0x8355('0x1c')](_0x268c30[0x1],this);}if(this[_0x8355('0x1d')]){_0x53371c['to']=this[_0x8355('0x1d')][_0x8355('0x1e')]||'';if(this[_0x8355('0xf')]===_0x8355('0x10')&&_0x268c30[0x1]==='1'){_0x53371c['cc']=this[_0x8355('0x1d')]['cc']||'';}_0x53371c[_0x8355('0x1e')]=this['message']['to']||'';_0x53371c[_0x8355('0x1f')]=this[_0x8355('0x1d')][_0x8355('0x1f')]||'';_0x53371c[_0x8355('0x20')]=!![];if(this[_0x8355('0x1d')][_0x8355('0x21')]){_0x53371c[_0x8355('0x21')]='';_0x53371c[_0x8355('0x21')]+=_[_0x8355('0x22')](this[_0x8355('0x1d')]['subject'],_0x8355('0x23'))?'':_0x8355('0x24');_0x53371c[_0x8355('0x21')]+=this[_0x8355('0x1d')]['subject'];}}if(this[_0x8355('0xf')]==='chat'){_0x53371c['ChatWebsiteId']=this[_0x8355('0x25')]['id'];}else{_0x53371c[_[_0x8355('0x26')](this[_0x8355('0xf')])+_0x8355('0x27')]=this[_0x8355('0x25')]['id'];}_0x53371c[_[_0x8355('0x26')](this[_0x8355('0xf')])+'InteractionId']=this[_0x8355('0x15')]['id'];var _0x35f461=this[_0x8355('0x15')];if(rpc[this[_0x8355('0xf')]+_0x8355('0x28')]){if(this[_0x8355('0xf')]==='mail'){_0x53371c['inReplyTo']=this[_0x8355('0x1d')][_0x8355('0x29')];_0x53371c[_0x8355('0x2a')]=_0x8355('0x2b')+_['replace'](_0x53371c['body'],_0x8355('0x2c'),'','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','create','then','catch','error','stringify','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace',']+(>|$)/g,''),'priorityTrue':_0x44725f[0x1],'priorityFalse':_0x44725f[0x2]};var _0xdb9f51=gotoif[_0x49b5('0x0')](_0x57eda9,{'typecast':!![]});if(_0xdb9f51[_0x49b5('0xc')]){logger[_0x49b5('0xd')](_0x49b5('0xe'),_0x5c1a26,_[_0x49b5('0xf')](_0xdb9f51,_0x49b5('0x10'))[_0x49b5('0x11')](',\x20'));_0x1934dc[_0x49b5('0x12')]();}else{try{var _0x25d43d=eval('('+_0x57eda9['condition']+')');var _0x1e484a=_0x25d43d?_0x57eda9[_0x49b5('0x13')]:_0x57eda9[_0x49b5('0x14')];logger['info'](_0x49b5('0x15'),_0x5c1a26,_0x57eda9[_0x49b5('0x16')],_0x25d43d,_0x1e484a||_0x49b5('0x17'));if(_0x1e484a){var _0x4e445e=_['findIndex'](_0x1934dc[_0x49b5('0x18')](),{'p':_0x1e484a});if(_0x4e445e>=0x0){logger[_0x49b5('0x19')](_0x49b5('0x1a'),_0x5c1a26,_0x1e484a||_0x49b5('0x17'),_0x4e445e);_0x1934dc[_0x49b5('0x17')](_0x4e445e);}else{logger[_0x49b5('0x19')](_0x49b5('0x1b'),_0x5c1a26,_0x1e484a||_0x49b5('0x17'));_0x1934dc[_0x49b5('0x12')]();}}else{_0x1934dc[_0x49b5('0x17')]();}}catch(_0x593669){logger[_0x49b5('0xd')](_0x49b5('0x1c'),_0x5c1a26,_0x593669['message']);_0x1934dc['stop']();}}}catch(_0x461b0d){logger[_0x49b5('0xd')](_0x49b5('0xe'),_0x5c1a26,JSON['stringify'](_0x461b0d));_0x1934dc[_0x49b5('0x12')]();}};}; \ No newline at end of file +var _0xa927=['consequence','fromString','getMustacheRender','replace','validate','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','next','rules','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa927,0x1d3));var _0x7a92=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa927[_0x397e5f];return _0x5302b8;};'use strict';var schema=require('validate');var _=require(_0x7a92('0x0'));var htmlToText=require(_0x7a92('0x1'));var utils=require(_0x7a92('0x2'));var logger=require(_0x7a92('0x3'))(_0x7a92('0x4'));var gotoif=schema({'condition':{'type':_0x7a92('0x5'),'required':!![],'message':_0x7a92('0x6')},'priorityTrue':{'type':_0x7a92('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x7a92('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x7a92('0x8')]=function(_0x14f4c2,_0x2a46d){return function(_0x483a76){try{var _0x2c57d={'condition':htmlToText[_0x7a92('0x9')](utils[_0x7a92('0xa')](_0x2a46d[0x0],this),{'wordwrap':![]})[_0x7a92('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2a46d[0x1],'priorityFalse':_0x2a46d[0x2]};var _0x43802f=gotoif[_0x7a92('0xc')](_0x2c57d,{'typecast':!![]});if(_0x43802f['length']){logger['error'](_0x7a92('0xd'),_0x14f4c2,_[_0x7a92('0xe')](_0x43802f,_0x7a92('0xf'))[_0x7a92('0x10')](',\x20'));_0x483a76[_0x7a92('0x11')]();}else{try{var _0x4e2bbf=eval('('+_0x2c57d[_0x7a92('0x12')]+')');var _0x29fd93=_0x4e2bbf?_0x2c57d[_0x7a92('0x13')]:_0x2c57d['priorityFalse'];logger[_0x7a92('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x14f4c2,_0x2c57d[_0x7a92('0x12')],_0x4e2bbf,_0x29fd93||_0x7a92('0x15'));if(_0x29fd93){var _0xbdd5ef=_['findIndex'](_0x483a76[_0x7a92('0x16')](),{'p':_0x29fd93});if(_0xbdd5ef>=0x0){logger[_0x7a92('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x14f4c2,_0x29fd93||_0x7a92('0x15'),_0xbdd5ef);_0x483a76[_0x7a92('0x15')](_0xbdd5ef);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x14f4c2,_0x29fd93||_0x7a92('0x15'));_0x483a76['stop']();}}else{_0x483a76[_0x7a92('0x15')]();}}catch(_0x4bbc1a){logger[_0x7a92('0x17')](_0x7a92('0x18'),_0x14f4c2,_0x4bbc1a[_0x7a92('0xf')]);_0x483a76[_0x7a92('0x11')]();}}}catch(_0x357abb){logger[_0x7a92('0x17')]('[%s][GOTOIF]\x20%s',_0x14f4c2,JSON['stringify'](_0x357abb));_0x483a76[_0x7a92('0x11')]();}};}; \ 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 c6c11c3..36073a5 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 _0xd69d=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','routing','consequence','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x3eb969,_0x11c187){var _0x5e62e0=function(_0x4eb12d){while(--_0x4eb12d){_0x3eb969['push'](_0x3eb969['shift']());}};_0x5e62e0(++_0x11c187);}(_0xd69d,0x163));var _0xdd69=function(_0x40f63f,_0x211fe8){_0x40f63f=_0x40f63f-0x0;var _0xc7ce87=_0xd69d[_0x40f63f];return _0xc7ce87;};'use strict';var schema=require(_0xdd69('0x0'));var _=require(_0xdd69('0x1'));var logger=require('../../../../config/logger')(_0xdd69('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xdd69('0x3')]=function(_0x2c3cdf,_0x1db103){return function(_0x195cb3){try{var _0x311647={'priority':_0x1db103[0x0]};var _0x2c1c33=gotop['validate'](_0x311647,{'typecast':!![]});if(_0x2c1c33['length']){logger[_0xdd69('0x4')](_0xdd69('0x5'),_0x2c3cdf,_[_0xdd69('0x6')](_0x2c1c33,_0xdd69('0x7'))[_0xdd69('0x8')](',\x20'));_0x195cb3['stop']();}else{logger[_0xdd69('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x2c3cdf,_0x311647[_0xdd69('0xa')]);if(_0x311647[_0xdd69('0xa')]){var _0x270854=_['findIndex'](_0x195cb3[_0xdd69('0xb')](),{'p':_0x311647['priority']});if(_0x270854>=0x0){logger[_0xdd69('0x9')](_0xdd69('0xc'),_0x2c3cdf,_0x311647[_0xdd69('0xa')]||_0xdd69('0xd'),_0x270854);_0x195cb3[_0xdd69('0xd')](_0x270854);}else{logger[_0xdd69('0x9')](_0xdd69('0xe'),_0x2c3cdf,_0x311647[_0xdd69('0xa')]||'next');_0x195cb3[_0xdd69('0xf')]();}}else{_0x195cb3[_0xdd69('0xd')]();}}}catch(_0x4250d6){logger[_0xdd69('0x4')](_0xdd69('0x5'),_0x2c3cdf,JSON['stringify'](_0x4250d6));_0x195cb3[_0xdd69('0xf')]();}};}; \ No newline at end of file +var _0x668c=['../../../../config/logger','routing','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x668c,0x1b7));var _0xc668=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x668c[_0x134827];return _0x366671;};'use strict';var schema=require('validate');var _=require(_0xc668('0x0'));var logger=require(_0xc668('0x1'))(_0xc668('0x2'));var gotop=schema({'priority':{'type':_0xc668('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc668('0x4')]=function(_0x449f46,_0x87d519){return function(_0x2bba8d){try{var _0xb2ac40={'priority':_0x87d519[0x0]};var _0x1c54de=gotop[_0xc668('0x5')](_0xb2ac40,{'typecast':!![]});if(_0x1c54de[_0xc668('0x6')]){logger[_0xc668('0x7')](_0xc668('0x8'),_0x449f46,_[_0xc668('0x9')](_0x1c54de,_0xc668('0xa'))[_0xc668('0xb')](',\x20'));_0x2bba8d[_0xc668('0xc')]();}else{logger[_0xc668('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x449f46,_0xb2ac40['priority']);if(_0xb2ac40[_0xc668('0xe')]){var _0x3637c4=_[_0xc668('0xf')](_0x2bba8d['rules'](),{'p':_0xb2ac40['priority']});if(_0x3637c4>=0x0){logger['info'](_0xc668('0x10'),_0x449f46,_0xb2ac40['priority']||_0xc668('0x11'),_0x3637c4);_0x2bba8d[_0xc668('0x11')](_0x3637c4);}else{logger[_0xc668('0xd')](_0xc668('0x12'),_0x449f46,_0xb2ac40[_0xc668('0xe')]||_0xc668('0x11'));_0x2bba8d[_0xc668('0xc')]();}}else{_0x2bba8d[_0xc668('0x11')]();}}}catch(_0x43a032){logger[_0xc668('0x7')](_0xc668('0x8'),_0x449f46,JSON[_0xc668('0x13')](_0x43a032));_0x2bba8d[_0xc668('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 610e672..8fb68ad 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 _0x1c19=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils'];(function(_0x1dd287,_0x498a){var _0x4b5e4e=function(_0x4009f1){while(--_0x4009f1){_0x1dd287['push'](_0x1dd287['shift']());}};_0x4b5e4e(++_0x498a);}(_0x1c19,0x1f2));var _0x91c1=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0x1c19[_0x4aa2c9];return _0x212e33;};'use strict';var _=require(_0x91c1('0x0'));var utils=require(_0x91c1('0x1'));var logger=require(_0x91c1('0x2'))('routing');var rpc={'chatMessage':require(_0x91c1('0x3')),'openchannelMessage':require(_0x91c1('0x4')),'mailMessage':require(_0x91c1('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x91c1('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x91c1('0x7')]=function(_0x64135e,_0x105260){return function(_0xc05b49){try{var _0x1a2ff5={'body':utils[_0x91c1('0x8')](_0x105260[0x0],this),'ContactId':this[_0x91c1('0x9')]['id']};if(this['channel']==='chat'){_0x1a2ff5[_0x91c1('0xa')]=this[_0x91c1('0xb')]['id'];}else{_0x1a2ff5[_[_0x91c1('0xc')](this[_0x91c1('0xd')])+_0x91c1('0xe')]=this['account']['id'];}_0x1a2ff5[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x91c1('0xf')]['id'];if(rpc[this[_0x91c1('0xd')]+_0x91c1('0x10')]){return rpc[this[_0x91c1('0xd')]+_0x91c1('0x10')]['create'](_0x1a2ff5)['then'](function(_0x5f482a){logger[_0x91c1('0x11')](_0x91c1('0x12'),_0x64135e,_0x1a2ff5[_0x91c1('0x13')]);_0xc05b49[_0x91c1('0x14')]();})[_0x91c1('0x15')](function(_0x410149){logger[_0x91c1('0x16')]('[%s][MESSAGE]\x20%s',_0x64135e,JSON[_0x91c1('0x17')](_0x410149));_0xc05b49[_0x91c1('0x18')]();});}}catch(_0x5cabd3){logger[_0x91c1('0x16')](_0x91c1('0x12'),_0x64135e,JSON[_0x91c1('0x17')](_0x5cabd3));_0xc05b49[_0x91c1('0x18')]();}};}; \ No newline at end of file +var _0x2afc=['getMustacheRender','account','channel','AccountId','upperFirst','InteractionId','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x4beece,_0x3b4fd5){var _0x204442=function(_0xb4f8c9){while(--_0xb4f8c9){_0x4beece['push'](_0x4beece['shift']());}};_0x204442(++_0x3b4fd5);}(_0x2afc,0x87));var _0xc2af=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0x2afc[_0x2dfd28];return _0x49c016;};'use strict';var _=require(_0xc2af('0x0'));var utils=require(_0xc2af('0x1'));var logger=require(_0xc2af('0x2'))('routing');var rpc={'chatMessage':require(_0xc2af('0x3')),'openchannelMessage':require(_0xc2af('0x4')),'mailMessage':require(_0xc2af('0x5')),'smsMessage':require(_0xc2af('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc2af('0x7'))};exports[_0xc2af('0x8')]=function(_0x5b32bd,_0xf91913){return function(_0x427e4b){try{var _0x4d1fa4={'body':utils[_0xc2af('0x9')](_0xf91913[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x4d1fa4['ChatWebsiteId']=this[_0xc2af('0xa')]['id'];}else{_0x4d1fa4[_['upperFirst'](this[_0xc2af('0xb')])+_0xc2af('0xc')]=this['account']['id'];}_0x4d1fa4[_[_0xc2af('0xd')](this[_0xc2af('0xb')])+_0xc2af('0xe')]=this['interaction']['id'];if(rpc[this[_0xc2af('0xb')]+'Message']){return rpc[this[_0xc2af('0xb')]+_0xc2af('0xf')][_0xc2af('0x10')](_0x4d1fa4)['then'](function(_0x14faa0){logger[_0xc2af('0x11')](_0xc2af('0x12'),_0x5b32bd,_0x4d1fa4['body']);_0x427e4b[_0xc2af('0x13')]();})[_0xc2af('0x14')](function(_0x1d0a39){logger[_0xc2af('0x15')](_0xc2af('0x12'),_0x5b32bd,JSON[_0xc2af('0x16')](_0x1d0a39));_0x427e4b[_0xc2af('0x17')]();});}}catch(_0x2f16fc){logger[_0xc2af('0x15')](_0xc2af('0x12'),_0x5b32bd,JSON['stringify'](_0x2f16fc));_0x427e4b[_0xc2af('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index ac7f97b..5b2e103 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 _0xa78c=['getMustacheRender','next','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0xa78c,0x1d8));var _0xca78=function(_0x61d937,_0x45883b){_0x61d937=_0x61d937-0x0;var _0x5c7096=_0xa78c[_0x61d937];return _0x5c7096;};'use strict';var utils=require(_0xca78('0x0'));var logger=require('../../../../config/logger')(_0xca78('0x1'));exports[_0xca78('0x2')]=function(_0x56b809,_0x5afc68){return function(_0x1e948a){try{logger[_0xca78('0x3')](_0xca78('0x4'),_0x56b809,utils[_0xca78('0x5')](_0x5afc68[0x0],this));_0x1e948a[_0xca78('0x6')]();}catch(_0x5acb2c){logger['error'](_0xca78('0x4'),_0x56b809,JSON[_0xca78('0x7')](_0x5acb2c));_0x1e948a[_0xca78('0x8')]();}};}; \ No newline at end of file +var _0xfb06=['../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xfb06,0x118));var _0x6fb0=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xfb06[_0x31e5cb];return _0x4170df;};'use strict';var utils=require('./utils');var logger=require(_0x6fb0('0x0'))('routing');exports[_0x6fb0('0x1')]=function(_0x5e5c5c,_0x272348){return function(_0x39955b){try{logger[_0x6fb0('0x2')](_0x6fb0('0x3'),_0x5e5c5c,utils[_0x6fb0('0x4')](_0x272348[0x0],this));_0x39955b[_0x6fb0('0x5')]();}catch(_0x254907){logger['error']('[%s][NOOP]\x20%s',_0x5e5c5c,JSON[_0x6fb0('0x6')](_0x254907));_0x39955b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index ab79de7..ba207e8 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 _0x227d=['%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','body','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','account','queue','from','joinAt','clone','queue_id','InteractionId','format','%sQueuesWaitingInteractions'];(function(_0x236607,_0x37f8e9){var _0x1a4b1e=function(_0x3b24ce){while(--_0x3b24ce){_0x236607['push'](_0x236607['shift']());}};_0x1a4b1e(++_0x37f8e9);}(_0x227d,0x14e));var _0xd227=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x227d[_0x54b283];return _0x2462b3;};'use strict';var schema=require(_0xd227('0x0'));var _=require(_0xd227('0x1'));var util=require(_0xd227('0x2'));var seqqueue=require(_0xd227('0x3'));var moment=require(_0xd227('0x4'));var Redis=require(_0xd227('0x5'));var config=require(_0xd227('0x6'));var logger=require(_0xd227('0x7'))(_0xd227('0x8'));var strategy=require(_0xd227('0x9'));config[_0xd227('0xa')]=_[_0xd227('0xb')](config[_0xd227('0xa')],{'host':_0xd227('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd227('0xa')]));var attributes=['id','queue_id',_0xd227('0xd'),_0xd227('0xe'),_0xd227('0xf'),_0xd227('0x10')];function emit(_0x2ddea5,_0x360238,_0x5b411d){io['to'](_0x2ddea5)['emit'](_0x360238,_0x5b411d);}function emitChannelQueueInteraction(_0x5f8679,_0x455f40,_0xff6197,_0x3d7c1c,_0x35af2c,_0x5b450a,_0xf6353b,_0xca69){var _0x4ac7ec=_[_0xd227('0x11')](_0xff6197);_0x4ac7ec[_0xd227('0x12')]=_0xca69;_0x4ac7ec['queue']=_0x455f40;_0x4ac7ec[_0xd227('0xd')]=_0x3d7c1c;_0x4ac7ec['id']=_0x35af2c;if(_0x5b450a){attributes['push'](_['capitalize'](_0x5f8679)+_0xd227('0x13'));_0xf6353b[util[_0xd227('0x14')](_0xd227('0x15'),_0x5f8679)][_0x35af2c]=_['pick'](_0x4ac7ec,attributes);}else{delete _0xf6353b[util[_0xd227('0x14')](_0xd227('0x15'),_0x5f8679)][_0x35af2c];}emit(util['format'](_0xd227('0x16'),_0x5f8679,_0x455f40),util[_0xd227('0x14')](_0xd227('0x17'),_0x5f8679,_0x5b450a?_0xd227('0x18'):_0xd227('0x19')),_[_0xd227('0x1a')](_0x4ac7ec,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd227('0x1b')),'chatQueueReport':require(_0xd227('0x1c')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd227('0x1d')),'whatsappQueueReport':require(_0xd227('0x1e')),'chatInteraction':require(_0xd227('0x1f')),'faxInteraction':require(_0xd227('0x20')),'mailInteraction':require(_0xd227('0x21')),'openchannelInteraction':require(_0xd227('0x22')),'smsInteraction':require(_0xd227('0x23')),'whatsappInteraction':require(_0xd227('0x24'))};var queue=schema({'name':{'type':_0xd227('0x25'),'required':!![],'message':_0xd227('0x26')},'timeout':{'type':_0xd227('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x31f61b,_0x45ba4e,_0x1f5725,_0xd0fdd){if(_0x31f61b&&_0x45ba4e&&_0x1f5725){_0x45ba4e[_0xd227('0x28')]+=0x1;var _0x591c6c={'uniqueid':_0x31f61b,'from':_0x1f5725['body']?_0x1f5725['body'][_0xd227('0xf')]:'','joinAt':moment()[_0xd227('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f5725[_0xd227('0x29')]?_0x1f5725[_0xd227('0x29')]['id']:null,'ListId':_0x1f5725[_0xd227('0x2a')]?_0x1f5725['list']['id']:null};_0x591c6c[_['upperFirst'](_0x1f5725[_0xd227('0x2b')])+_0xd227('0x2c')]=_0x45ba4e['id']||null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725[_0xd227('0x2b')])+_0xd227('0x13')]=_0x1f5725[_0xd227('0x2e')]?_0x1f5725[_0xd227('0x2e')]['id']:null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725['channel'])+_0xd227('0x2f')]=_0x1f5725[_0xd227('0x30')]?_0x1f5725['message']['id']:null;_0x591c6c[_[_0xd227('0x2d')](_0x1f5725['channel'])+(_0x1f5725['channel']!=='chat'?_0xd227('0x31'):_0xd227('0x32'))]=_0x1f5725[_0xd227('0xd')]?_0x1f5725[_0xd227('0xd')]['id']:null;logger['info'](util['format'](_0xd227('0x33'),_0x31f61b,_0x45ba4e[_0xd227('0x34')]));emitChannelQueueInteraction(_0x1f5725[_0xd227('0x2b')],_0x45ba4e[_0xd227('0x34')],_0x591c6c,_0x1f5725[_0xd227('0xd')]['name'],_0x1f5725[_0xd227('0x30')]['id'],!![],_0xd0fdd,_0x45ba4e['id']);if(rpc[_0x1f5725['channel']+_0xd227('0x35')]){return rpc[_0x1f5725[_0xd227('0x2b')]+_0xd227('0x35')][_0xd227('0x36')](_0x591c6c)[_0xd227('0x37')](function(_0x18a358){logger[_0xd227('0x38')](_0xd227('0x39'),_0x18a358);});}}}function stopRouting(_0x4a4293,_0x3219b9,_0x555463,_0x328eb3){if(_0x4a4293&&_0x3219b9){_0x3219b9[_0xd227('0x28')]-=0x1;var _0x4ff39b={'leaveAt':moment()[_0xd227('0x14')](_0xd227('0x3a')),'acceptAt':moment()[_0xd227('0x14')](_0xd227('0x3a')),'reason':_0xd227('0x3b')};logger[_0xd227('0x3c')](util[_0xd227('0x14')](_0xd227('0x3d'),_0x4a4293,_0x3219b9[_0xd227('0x34')]));emitChannelQueueInteraction(_0x555463['channel'],_0x3219b9[_0xd227('0x34')],_0x555463[_0xd227('0x3e')],_0x555463[_0xd227('0xd')][_0xd227('0x34')],_0x555463['message']['id'],![],_0x328eb3,_0x3219b9['id']);return rpc[_0x555463[_0xd227('0x2b')]+_0xd227('0x3f')][_0xd227('0x40')](_0x555463['interaction']['id'],{'queueId':_0x3219b9['id']})[_0xd227('0x41')](function(){if(rpc[_0x555463['channel']+'QueueReport']){return rpc[_0x555463[_0xd227('0x2b')]+'QueueReport'][_0xd227('0x40')](_0x4a4293,_0x4ff39b)[_0xd227('0x37')](function(_0x18de09){logger[_0xd227('0x38')](_0xd227('0x42'),_0x18de09);});}});}}function endRouting(_0x38c049,_0x4fe297,_0x58cf5d,_0x1fd0ee){if(_0x38c049&&_0x4fe297){_0x4fe297[_0xd227('0x28')]-=0x1;var _0x38cb4c={'leaveAt':moment()[_0xd227('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xd227('0x3a')),'reason':_0xd227('0x43')};logger[_0xd227('0x3c')](util[_0xd227('0x14')](_0xd227('0x44'),_0x38c049,_0x4fe297[_0xd227('0x34')]));emitChannelQueueInteraction(_0x58cf5d['channel'],_0x4fe297[_0xd227('0x34')],_0x58cf5d['body'],_0x58cf5d[_0xd227('0xd')][_0xd227('0x34')],_0x58cf5d[_0xd227('0x30')]['id'],![],_0x1fd0ee);if(rpc[_0x58cf5d[_0xd227('0x2b')]+_0xd227('0x35')]){return rpc[_0x58cf5d['channel']+_0xd227('0x35')][_0xd227('0x40')](_0x38c049,_0x38cb4c)[_0xd227('0x37')](function(_0x498e7a){logger[_0xd227('0x38')](_0xd227('0x42'),_0x498e7a);});}}}function handleFindQueue(_0x5975c9){return function(_0x2c2419){return _0x2c2419[_0xd227('0x34')]['toLowerCase']()===_0x5975c9[_0xd227('0x45')]();};}exports[_0xd227('0x46')]=function(_0xc11a54,_0x48693f,_0x516cb7,_0x44b23d){return function(_0x29e309){try{var _0x386a81={'name':_0x48693f[0x0],'timeout':_0x48693f[0x1]};var _0x5b655b=queue['validate'](_0x386a81,{'typecast':!![]});if(_0x5b655b['length']){logger[_0xd227('0x38')]('[%s][QUEUE]\x20%s',_0xc11a54,_['map'](_0x5b655b,_0xd227('0x30'))[_0xd227('0x47')](',\x20'));_0x29e309[_0xd227('0x48')]();}else{var _0x500aac=_[_0xd227('0x49')](_0x516cb7[_0x44b23d[_0xd227('0x2b')]+_0xd227('0x4a')],handleFindQueue(_0x386a81['name']));if(_0x500aac){startRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);var _0x475d6d=(_0x500aac[_0xd227('0x43')]||0xa)*0x3e8;var _0xea3803=(_0x386a81[_0xd227('0x43')]||0x14)*0x3e8;var _0x514f50;if(_0x475d6d>_0xea3803){_0xea3803=_0x475d6d;}var _0x1e2952=seqqueue[_0xd227('0x4b')](_0x475d6d);_0x1e2952['id']=_0xc11a54;_0x1e2952[_0xd227('0x4c')]=_0x475d6d;_0x1e2952[_0xd227('0x4d')]=_0xea3803;_0x1e2952[_0xd227('0x2b')]=_0x44b23d['channel'];_0x516cb7[_0xd227('0x4e')][_0xc11a54]['on'](_0xd227('0x4f'),function(){logger[_0xd227('0x3c')](_0xd227('0x50'),_0xc11a54);stopRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);clearTimeout(_0x514f50);_0x514f50=undefined;_0x1e2952[_0xd227('0x51')](!![]);if(_0x516cb7[_0xd227('0x4e')][_0xc11a54]){delete _0x516cb7[_0xd227('0x4e')][_0xc11a54];}_0x29e309[_0xd227('0x48')]();});_0x516cb7[_0xd227('0x4e')][_0xc11a54]['on'](_0xd227('0x52'),function(){if(_0x516cb7['rules'][_0xc11a54]){delete _0x516cb7[_0xd227('0x4e')][_0xc11a54];}});_0x514f50=setTimeout(function(){logger['info'](_0xd227('0x53'),_0xc11a54);endRouting(_0xc11a54,_0x500aac,_0x44b23d,_0x516cb7);clearTimeout(_0x514f50);_0x1e2952[_0xd227('0x51')](!![]);_0x29e309['next']();},_0xea3803);switch(_0x500aac[_0xd227('0x54')]){case'rrmemory':strategy[_0xd227('0x55')](_0x1e2952,_0x500aac,_0x516cb7,_0x44b23d);break;default:strategy[_0xd227('0x56')](_0x1e2952,_0x500aac,_0x516cb7,_0x44b23d);}}else{logger[_0xd227('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc11a54,_0x386a81[_0xd227('0x34')]);_0x29e309[_0xd227('0x48')]();}}}catch(_0x24bb8c){logger[_0xd227('0x38')](_0xd227('0x57'),_0xc11a54,_0x24bb8c[_0xd227('0x58')]);_0x29e309['stop']();}};}; \ No newline at end of file +var _0x745d=['[%s][QUEUE]\x20%s','stop','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','redis','defaults','localhost','queue_id','account','queue','from','joinAt','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','validate','map','join','Queues','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x745d,0xa4));var _0xd745=function(_0xaedc34,_0x12395a){_0xaedc34=_0xaedc34-0x0;var _0x4a529b=_0x745d[_0xaedc34];return _0x4a529b;};'use strict';var schema=require('validate');var _=require(_0xd745('0x0'));var util=require(_0xd745('0x1'));var seqqueue=require(_0xd745('0x2'));var moment=require('moment');var Redis=require(_0xd745('0x3'));var config=require('../../../../config/environment');var logger=require(_0xd745('0x4'))(_0xd745('0x5'));var strategy=require('./strategy');config[_0xd745('0x6')]=_[_0xd745('0x7')](config[_0xd745('0x6')],{'host':_0xd745('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd745('0x6')]));var attributes=['id',_0xd745('0x9'),_0xd745('0xa'),_0xd745('0xb'),_0xd745('0xc'),_0xd745('0xd')];function emit(_0x4b1469,_0x2224b3,_0x169dc1){io['to'](_0x4b1469)['emit'](_0x2224b3,_0x169dc1);}function emitChannelQueueInteraction(_0x34a717,_0x5abc35,_0x35a53f,_0xbfe74b,_0x4d83b0,_0xbfdd3b,_0x4d91e6,_0x5c3bdf){var _0x43a858=_['clone'](_0x35a53f);_0x43a858['queue_id']=_0x5c3bdf;_0x43a858['queue']=_0x5abc35;_0x43a858[_0xd745('0xa')]=_0xbfe74b;_0x43a858['id']=_0x4d83b0;if(_0xbfdd3b){attributes['push'](_[_0xd745('0xe')](_0x34a717)+_0xd745('0xf'));_0x4d91e6[util[_0xd745('0x10')]('%sQueuesWaitingInteractions',_0x34a717)][_0x4d83b0]=_[_0xd745('0x11')](_0x43a858,attributes);}else{delete _0x4d91e6[util['format'](_0xd745('0x12'),_0x34a717)][_0x4d83b0];}emit(util[_0xd745('0x10')](_0xd745('0x13'),_0x34a717,_0x5abc35),util['format'](_0xd745('0x14'),_0x34a717,_0xbfdd3b?_0xd745('0x15'):_0xd745('0x16')),_[_0xd745('0x11')](_0x43a858,attributes));}var rpc={'openchannelQueueReport':require(_0xd745('0x17')),'mailQueueReport':require(_0xd745('0x18')),'chatQueueReport':require(_0xd745('0x19')),'smsQueueReport':require(_0xd745('0x1a')),'faxQueueReport':require(_0xd745('0x1b')),'whatsappQueueReport':require(_0xd745('0x1c')),'chatInteraction':require(_0xd745('0x1d')),'faxInteraction':require(_0xd745('0x1e')),'mailInteraction':require(_0xd745('0x1f')),'openchannelInteraction':require(_0xd745('0x20')),'smsInteraction':require(_0xd745('0x21')),'whatsappInteraction':require(_0xd745('0x22'))};var queue=schema({'name':{'type':_0xd745('0x23'),'required':!![],'message':_0xd745('0x24')},'timeout':{'type':_0xd745('0x25'),'message':_0xd745('0x26')}});function startRouting(_0x8982f1,_0x4f978b,_0x28ea92,_0x233a24){if(_0x8982f1&&_0x4f978b&&_0x28ea92){_0x4f978b['waiting']+=0x1;var _0x1a33e9={'uniqueid':_0x8982f1,'from':_0x28ea92[_0xd745('0x27')]?_0x28ea92[_0xd745('0x27')][_0xd745('0xc')]:'','joinAt':moment()[_0xd745('0x10')](_0xd745('0x28')),'ContactId':_0x28ea92[_0xd745('0x29')]?_0x28ea92[_0xd745('0x29')]['id']:null,'ListId':_0x28ea92[_0xd745('0x2a')]?_0x28ea92['list']['id']:null};_0x1a33e9[_[_0xd745('0x2b')](_0x28ea92[_0xd745('0x2c')])+_0xd745('0x2d')]=_0x4f978b['id']||null;_0x1a33e9[_[_0xd745('0x2b')](_0x28ea92['channel'])+_0xd745('0xf')]=_0x28ea92[_0xd745('0x2e')]?_0x28ea92[_0xd745('0x2e')]['id']:null;_0x1a33e9[_[_0xd745('0x2b')](_0x28ea92[_0xd745('0x2c')])+_0xd745('0x2f')]=_0x28ea92[_0xd745('0x30')]?_0x28ea92[_0xd745('0x30')]['id']:null;_0x1a33e9[_['upperFirst'](_0x28ea92[_0xd745('0x2c')])+(_0x28ea92[_0xd745('0x2c')]!==_0xd745('0x31')?'AccountId':_0xd745('0x32'))]=_0x28ea92[_0xd745('0xa')]?_0x28ea92['account']['id']:null;logger[_0xd745('0x33')](util[_0xd745('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x8982f1,_0x4f978b['name']));emitChannelQueueInteraction(_0x28ea92[_0xd745('0x2c')],_0x4f978b[_0xd745('0x34')],_0x1a33e9,_0x28ea92[_0xd745('0xa')][_0xd745('0x34')],_0x28ea92['message']['id'],!![],_0x233a24,_0x4f978b['id']);if(rpc[_0x28ea92['channel']+_0xd745('0x35')]){return rpc[_0x28ea92['channel']+'QueueReport'][_0xd745('0x36')](_0x1a33e9)['catch'](function(_0x578f90){logger[_0xd745('0x37')](_0xd745('0x38'),_0x578f90);});}}}function stopRouting(_0x5820d1,_0x540e3f,_0xa1e302,_0x5625d7){if(_0x5820d1&&_0x540e3f){_0x540e3f['waiting']-=0x1;var _0x3c2d8f={'leaveAt':moment()['format'](_0xd745('0x28')),'acceptAt':moment()[_0xd745('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd745('0x39')};logger[_0xd745('0x33')](util[_0xd745('0x10')](_0xd745('0x3a'),_0x5820d1,_0x540e3f['name']));emitChannelQueueInteraction(_0xa1e302[_0xd745('0x2c')],_0x540e3f['name'],_0xa1e302[_0xd745('0x27')],_0xa1e302[_0xd745('0xa')][_0xd745('0x34')],_0xa1e302[_0xd745('0x30')]['id'],![],_0x5625d7,_0x540e3f['id']);return rpc[_0xa1e302[_0xd745('0x2c')]+'Interaction']['update'](_0xa1e302['interaction']['id'],{'queueId':_0x540e3f['id']})['then'](function(){if(rpc[_0xa1e302['channel']+_0xd745('0x35')]){return rpc[_0xa1e302[_0xd745('0x2c')]+'QueueReport'][_0xd745('0x3b')](_0x5820d1,_0x3c2d8f)['catch'](function(_0x53a538){logger[_0xd745('0x37')]('update\x20queue\x20report',_0x53a538);});}});}}function endRouting(_0x4633b7,_0x183244,_0xae84f3,_0x2d4dfa){if(_0x4633b7&&_0x183244){_0x183244['waiting']-=0x1;var _0x48c238={'leaveAt':moment()[_0xd745('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xd745('0x28')),'reason':_0xd745('0x3c')};logger[_0xd745('0x33')](util[_0xd745('0x10')](_0xd745('0x3d'),_0x4633b7,_0x183244[_0xd745('0x34')]));emitChannelQueueInteraction(_0xae84f3['channel'],_0x183244[_0xd745('0x34')],_0xae84f3['body'],_0xae84f3['account'][_0xd745('0x34')],_0xae84f3[_0xd745('0x30')]['id'],![],_0x2d4dfa);if(rpc[_0xae84f3[_0xd745('0x2c')]+_0xd745('0x35')]){return rpc[_0xae84f3['channel']+'QueueReport'][_0xd745('0x3b')](_0x4633b7,_0x48c238)[_0xd745('0x3e')](function(_0x5f1455){logger['error']('update\x20queue\x20report',_0x5f1455);});}}}function handleFindQueue(_0x2aa1cf){return function(_0xe688a2){return _0xe688a2[_0xd745('0x34')][_0xd745('0x3f')]()===_0x2aa1cf[_0xd745('0x3f')]();};}exports[_0xd745('0x40')]=function(_0x58f3d0,_0xf1cf39,_0x1fa7e4,_0x189cf4){return function(_0x175196){try{var _0x38cb2b={'name':_0xf1cf39[0x0],'timeout':_0xf1cf39[0x1]};var _0x2019bc=queue[_0xd745('0x41')](_0x38cb2b,{'typecast':!![]});if(_0x2019bc['length']){logger[_0xd745('0x37')]('[%s][QUEUE]\x20%s',_0x58f3d0,_[_0xd745('0x42')](_0x2019bc,_0xd745('0x30'))[_0xd745('0x43')](',\x20'));_0x175196['stop']();}else{var _0x29ee6c=_['find'](_0x1fa7e4[_0x189cf4[_0xd745('0x2c')]+_0xd745('0x44')],handleFindQueue(_0x38cb2b[_0xd745('0x34')]));if(_0x29ee6c){startRouting(_0x58f3d0,_0x29ee6c,_0x189cf4,_0x1fa7e4);var _0x8d7db6=(_0x29ee6c[_0xd745('0x3c')]||0xa)*0x3e8;var _0x559ca5=(_0x38cb2b[_0xd745('0x3c')]||0x14)*0x3e8;var _0x5eea4e;if(_0x8d7db6>_0x559ca5){_0x559ca5=_0x8d7db6;}var _0x43c644=seqqueue['createQueue'](_0x8d7db6);_0x43c644['id']=_0x58f3d0;_0x43c644['atimeout']=_0x8d7db6;_0x43c644[_0xd745('0x45')]=_0x559ca5;_0x43c644[_0xd745('0x2c')]=_0x189cf4[_0xd745('0x2c')];_0x1fa7e4['rules'][_0x58f3d0]['on'](_0xd745('0x46'),function(){logger[_0xd745('0x33')](_0xd745('0x47'),_0x58f3d0);stopRouting(_0x58f3d0,_0x29ee6c,_0x189cf4,_0x1fa7e4);clearTimeout(_0x5eea4e);_0x5eea4e=undefined;_0x43c644[_0xd745('0x48')](!![]);if(_0x1fa7e4['rules'][_0x58f3d0]){delete _0x1fa7e4[_0xd745('0x49')][_0x58f3d0];}_0x175196['stop']();});_0x1fa7e4['rules'][_0x58f3d0]['on'](_0xd745('0x4a'),function(){if(_0x1fa7e4[_0xd745('0x49')][_0x58f3d0]){delete _0x1fa7e4[_0xd745('0x49')][_0x58f3d0];}});_0x5eea4e=setTimeout(function(){logger[_0xd745('0x33')](_0xd745('0x4b'),_0x58f3d0);endRouting(_0x58f3d0,_0x29ee6c,_0x189cf4,_0x1fa7e4);clearTimeout(_0x5eea4e);_0x43c644[_0xd745('0x48')](!![]);_0x175196['next']();},_0x559ca5);switch(_0x29ee6c[_0xd745('0x4c')]){case _0xd745('0x4d'):strategy['rrmemory'](_0x43c644,_0x29ee6c,_0x1fa7e4,_0x189cf4);break;default:strategy[_0xd745('0x4e')](_0x43c644,_0x29ee6c,_0x1fa7e4,_0x189cf4);}}else{logger[_0xd745('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x58f3d0,_0x38cb2b['name']);_0x175196['stop']();}}}catch(_0x365829){logger[_0xd745('0x37')](_0xd745('0x4f'),_0x58f3d0,_0x365829['stack']);_0x175196[_0xd745('0x50')]();}};}; \ 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 8806388..b85b008 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 _0xe5b3=['exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT'];(function(_0x416f91,_0x3cf525){var _0x2d15a0=function(_0xe9a889){while(--_0xe9a889){_0x416f91['push'](_0x416f91['shift']());}};_0x2d15a0(++_0x3cf525);}(_0xe5b3,0x133));var _0x3e5b=function(_0x45d8be,_0x5a73da){_0x45d8be=_0x45d8be-0x0;var _0x52a4d4=_0xe5b3[_0x45d8be];return _0x52a4d4;};'use strict';var _=require('lodash');var uuid=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var Agent=function(_0x2a71ef,_0x3171c5,_0x7f1cc0,_0x1e58ed){this[_0x3e5b('0x4')]=uuid['v4']();this[_0x3e5b('0x5')]=_0x2a71ef;this[_0x3e5b('0x6')]=_0x3171c5;this['realtime']=_0x7f1cc0;this[_0x3e5b('0x3')]=_0x1e58ed;this[_0x3e5b('0x5')]['push'](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this['squeue']['on']('timeout',this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this[_0x3e5b('0x5')]['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')]['bind'](this));};Agent[_0x3e5b('0xc')]['push']=function(){this[_0x3e5b('0x5')][_0x3e5b('0xd')](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));};Agent[_0x3e5b('0xc')]['handleDrained']=function(){this[_0x3e5b('0x9')](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0x3e5b('0xe'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);if(_['isNil'](this[_0x3e5b('0xf')]['agents'][this['agent']['id']])){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')]['bind'](this),0x3e8);}else{if(this[_0x3e5b('0x3')][_0x3e5b('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],this[_0x3e5b('0x5')][_0x3e5b('0x14')],![])){this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=!![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x17')](this['realtime'],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')][_0x3e5b('0x14')]);util['showNotification'](this[_0x3e5b('0x4')],this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this['agent']['id']],null,this[_0x3e5b('0x3')]);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],_0x3e5b('0x19')+(this[_0x3e5b('0x3')]['forcedOwnership']?_0x3e5b('0x1a'):''));}else{logger['debug'](_0x3e5b('0x1b'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}}};Agent[_0x3e5b('0xc')][_0x3e5b('0x9')]=function(_0x3cfaf6){if(_[_0x3e5b('0x1c')](this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']])){return logger[_0x3e5b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x1d'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);util[_0x3e5b('0x1e')](this['notificationId'],this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],null,this[_0x3e5b('0x3')]);this['realtime'][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x1f')](this[_0x3e5b('0xf')],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')]['channel']);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],_0x3cfaf6?'STOP':_0x3e5b('0x20'));}if(!_0x3cfaf6){setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}};function agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1){return new Agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1);}module[_0x3e5b('0x21')]=agent; \ No newline at end of file +var _0xf873=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','bind','handleTimeout','squeue','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','saveWaitingNotification','showNotification','writeLog'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0xf873,0xb2));var _0x3f87=function(_0x1cdf22,_0x4c11bd){_0x1cdf22=_0x1cdf22-0x0;var _0x321a13=_0xf873[_0x1cdf22];return _0x321a13;};'use strict';var _=require('lodash');var uuid=require(_0x3f87('0x0'));var util=require(_0x3f87('0x1'));var logger=require(_0x3f87('0x2'))(_0x3f87('0x3'));var Agent=function(_0x1c56a3,_0xd4592c,_0x2fbb4f,_0x1d68dd){this[_0x3f87('0x4')]=uuid['v4']();this['squeue']=_0x1c56a3;this[_0x3f87('0x5')]=_0xd4592c;this[_0x3f87('0x6')]=_0x2fbb4f;this[_0x3f87('0x3')]=_0x1d68dd;this['squeue'][_0x3f87('0x7')](this[_0x3f87('0x8')][_0x3f87('0x9')](this),this[_0x3f87('0xa')][_0x3f87('0x9')](this));this[_0x3f87('0xb')]['on']('timeout',this[_0x3f87('0xa')][_0x3f87('0x9')](this));this[_0x3f87('0xb')]['on'](_0x3f87('0xc'),this[_0x3f87('0xd')][_0x3f87('0x9')](this));};Agent[_0x3f87('0xe')][_0x3f87('0x7')]=function(){this[_0x3f87('0xb')][_0x3f87('0x7')](this[_0x3f87('0x8')][_0x3f87('0x9')](this),this[_0x3f87('0xa')][_0x3f87('0x9')](this));};Agent['prototype'][_0x3f87('0xd')]=function(){this[_0x3f87('0xa')](!![]);};Agent['prototype'][_0x3f87('0x8')]=function(){logger[_0x3f87('0xf')](_0x3f87('0x10'),this[_0x3f87('0xb')]['id'],this[_0x3f87('0x5')]['id']);if(_[_0x3f87('0x11')](this[_0x3f87('0x6')][_0x3f87('0x12')][this['agent']['id']])){logger[_0x3f87('0xf')](_0x3f87('0x13'),this[_0x3f87('0xb')]['id'],this['agent']['id']);setTimeout(this[_0x3f87('0x7')]['bind'](this),0x3e8);}else{if(this[_0x3f87('0x3')][_0x3f87('0x14')]||util[_0x3f87('0x15')](this[_0x3f87('0xb')]['id'],this[_0x3f87('0x6')]['agents'][this[_0x3f87('0x5')]['id']],this[_0x3f87('0xb')][_0x3f87('0x16')],![])){this[_0x3f87('0x6')]['agents'][this['agent']['id']]['busy']=!![];this[_0x3f87('0x6')][_0x3f87('0x12')][this[_0x3f87('0x5')]['id']]['busyQueue']=undefined;util[_0x3f87('0x17')](this[_0x3f87('0x6')],this[_0x3f87('0x3')],this[_0x3f87('0x5')],this[_0x3f87('0xb')][_0x3f87('0x16')]);util[_0x3f87('0x18')](this[_0x3f87('0x4')],this[_0x3f87('0xb')]['id'],this[_0x3f87('0x6')][_0x3f87('0x12')][this[_0x3f87('0x5')]['id']],null,this['routing']);util[_0x3f87('0x19')](this[_0x3f87('0xb')]['id'],this[_0x3f87('0x6')]['agents'][this['agent']['id']],_0x3f87('0x1a')+(this[_0x3f87('0x3')][_0x3f87('0x14')]?_0x3f87('0x1b'):''));}else{logger[_0x3f87('0xf')](_0x3f87('0x1c'),this[_0x3f87('0xb')]['id'],this[_0x3f87('0x5')]['id']);setTimeout(this[_0x3f87('0x7')][_0x3f87('0x9')](this),0x3e8);}}};Agent[_0x3f87('0xe')][_0x3f87('0xa')]=function(_0x439a7d){if(_[_0x3f87('0x11')](this[_0x3f87('0x6')][_0x3f87('0x12')][this['agent']['id']])){return logger[_0x3f87('0xf')](_0x3f87('0x13'),this[_0x3f87('0xb')]['id'],this[_0x3f87('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x3f87('0x5')]['id']);util[_0x3f87('0x1d')](this[_0x3f87('0x4')],this[_0x3f87('0xb')]['id'],this[_0x3f87('0x6')]['agents'][this[_0x3f87('0x5')]['id']],null,this['routing']);this[_0x3f87('0x6')][_0x3f87('0x12')][this[_0x3f87('0x5')]['id']][_0x3f87('0x1e')]=![];this[_0x3f87('0x6')][_0x3f87('0x12')][this[_0x3f87('0x5')]['id']]['busyQueue']=undefined;util['removeWaitingNotification'](this[_0x3f87('0x6')],this[_0x3f87('0x3')],this[_0x3f87('0x5')],this[_0x3f87('0xb')][_0x3f87('0x16')]);util[_0x3f87('0x19')](this[_0x3f87('0xb')]['id'],this['realtime'][_0x3f87('0x12')][this['agent']['id']],_0x439a7d?_0x3f87('0x1f'):_0x3f87('0x20'));}if(!_0x439a7d){setTimeout(this[_0x3f87('0x7')][_0x3f87('0x9')](this),0x3e8);}};function agent(_0x51a33d,_0x3bc7f6,_0x54fe61,_0x1c3fe8){return new Agent(_0x51a33d,_0x3bc7f6,_0x54fe61,_0x1c3fe8);}module[_0x3f87('0x21')]=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 4c3d6c4..c754e94 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 _0x9296=['lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','timeout','handleTimeout','handleDrained','prototype','bind','isNil','Agents','length','agents','debug','channel','RINGING','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','busyQueue'];(function(_0x365639,_0xe4b564){var _0x56b6b9=function(_0x2b2e5a){while(--_0x2b2e5a){_0x365639['push'](_0x365639['shift']());}};_0x56b6b9(++_0xe4b564);}(_0x9296,0x180));var _0x6929=function(_0x5dd6ba,_0x1f45b6){_0x5dd6ba=_0x5dd6ba-0x0;var _0x5cc0a1=_0x9296[_0x5dd6ba];return _0x5cc0a1;};'use strict';var _=require(_0x6929('0x0'));var uuid=require(_0x6929('0x1'));var util=require(_0x6929('0x2'));var logger=require(_0x6929('0x3'))(_0x6929('0x4'));var Beepall=function(_0x57d312,_0x1ab530,_0x376dc4,_0x367cb9){this[_0x6929('0x5')]=uuid['v4']();this[_0x6929('0x6')]=_0x57d312;this[_0x6929('0x7')]=_0x1ab530;this[_0x6929('0x8')]=_0x376dc4;this[_0x6929('0x4')]=_0x367cb9;this[_0x6929('0x6')][_0x6929('0x9')](this[_0x6929('0xa')]['bind'](this),this['handleTimeout']['bind'](this));this[_0x6929('0x6')]['on'](_0x6929('0xb'),this[_0x6929('0xc')]['bind'](this));this[_0x6929('0x6')]['on']('drained',this[_0x6929('0xd')]['bind'](this));};Beepall[_0x6929('0xe')][_0x6929('0x9')]=function(){this['squeue']['push'](this[_0x6929('0xa')]['bind'](this),this[_0x6929('0xc')][_0x6929('0xf')](this));};Beepall[_0x6929('0xe')][_0x6929('0xd')]=function(){this[_0x6929('0xc')](!![]);};Beepall[_0x6929('0xe')]['handleRun']=function(){var _0x38427e=!![];if(!_['isNil'](this[_0x6929('0x7')])&&!_[_0x6929('0x10')](this[_0x6929('0x7')][_0x6929('0x11')])&&this[_0x6929('0x7')][_0x6929('0x11')][_0x6929('0x12')]>0x0){for(var _0x4b9f7f=0x0,_0x2cc588;_0x4b9f7f0x0){for(var _0x2789db=0x0,_0xa0de7f;_0x2789db0x0&&_0x38a4dd[_0x4c5a44+_0xebdb('0x1f')]>=_0x38a4dd[_0x4c5a44+_0xebdb('0x1e')]){writeLog(_0x5c76cc,_0x38a4dd,_0x4c5a44[_0xebdb('0x20')]()+_0xebdb('0x21'));return![];}}return!![];};exports[_0xebdb('0x22')]=function(_0x42026f,_0x184871,_0x5b721f,_0x1f4b46,_0x368c77){return sendNotification(!![],_0x42026f,_0x184871,_0x5b721f,_0x1f4b46,_0x368c77);};exports[_0xebdb('0x23')]=function(_0x577abd,_0x24b409,_0x59d9f7,_0x3da0b4,_0x1ce629){return sendNotification(![],_0x577abd,_0x24b409,_0x59d9f7,_0x3da0b4,_0x1ce629);};exports['checkWaitingNotifications']=function(_0x19ef3c,_0x57f324,_0x497642){var _0x184ec4=_0x57f324[_0xebdb('0x24')][_0xebdb('0x25')];if(!_0x184ec4&&_0x497642){_0x184ec4=_0x497642['id'];}var _0x5136f2=_[_0xebdb('0x26')](_0x19ef3c[_0x57f324[_0xebdb('0x27')]+_0xebdb('0x28')],function(_0x3b4e92){var _0x11fe9f=_['capitalize'](_0x57f324['channel'])+_0xebdb('0x29');return _0x3b4e92[_0x11fe9f]===_0x57f324[_0xebdb('0x24')]['id'];});if(!_0x5136f2&&_0x184ec4&&_0x19ef3c['agents'][_0x184ec4]){_0x5136f2=_['some'](_0x19ef3c['agents'][_0x184ec4][_0x57f324['channel']+_0xebdb('0x2a')],function(_0x5f578a){return _0x5f578a['id']===_0x57f324[_0xebdb('0x24')]['id'];});}return _0x5136f2;};exports[_0xebdb('0x2b')]=function(_0x54466b,_0x597607,_0x190bdb,_0x33f64d){if(_0x190bdb&&_0x190bdb['id']&&_0x54466b[_0xebdb('0x2c')]&&_0x54466b['agents'][_0x190bdb['id']]){_0x54466b[_0xebdb('0x2c')][_0x190bdb['id']][_0x33f64d+_0xebdb('0x2a')][_0x597607[_0xebdb('0x14')]['id']]={'id':_0x597607[_0xebdb('0x24')]['id']};}};exports[_0xebdb('0x2d')]=function(_0x1d7986,_0x48d401,_0x179de1,_0x192d7d){if(_0x179de1&&_0x179de1['id']&&_0x1d7986[_0xebdb('0x2c')]&&_0x1d7986[_0xebdb('0x2c')][_0x179de1['id']]){delete _0x1d7986[_0xebdb('0x2c')][_0x179de1['id']][_0x192d7d+_0xebdb('0x2a')][_0x48d401[_0xebdb('0x14')]['id']];}};exports[_0xebdb('0x2e')]=writeLog; \ No newline at end of file +var _0x79a3=['split','\x20interaction','notificationSound','body','queue','msg','getMustacheRender','account','I\x20can\x27t\x20render\x20your\x20template','error','format','name','emit','remove','debug','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x3a15b5,_0x49889f){var _0x5f58e8=function(_0x1b2e4a){while(--_0x1b2e4a){_0x3a15b5['push'](_0x3a15b5['shift']());}};_0x5f58e8(++_0x49889f);}(_0x79a3,0x80));var _0x379a=function(_0x244c2b,_0x1bfdfb){_0x244c2b=_0x244c2b-0x0;var _0x627533=_0x79a3[_0x244c2b];return _0x627533;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var utils=require(_0x379a('0x1'));var Redis=require(_0x379a('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x379a('0x3'))('routing');config['redis']=_['defaults'](config[_0x379a('0x4')],{'host':_0x379a('0x5'),'port':0x18eb});var io=require(_0x379a('0x6'))(new Redis(config[_0x379a('0x4')]));function sendNotification(_0x9e6da6,_0x4eacbe,_0x4d0435,_0x484a91,_0x23e684,_0x11d27d){var _0x2f0c65=_0x11d27d||{};var _0x10f635=_0x4d0435[_0x379a('0x7')]('.');var _0x819320={'uniqueid':_0x4eacbe,'channel':_0x10f635[0x0],'id':_0x10f635[0x1],'title':_0x10f635[0x0]+_0x379a('0x8'),'interactionId':_0x10f635[0x2],'queue':_0x23e684?_0x23e684['name']:null,'sound':_0x2f0c65['account'][_0x379a('0x9')],'shake':_0x2f0c65['account']['notificationShake']};try{if(!_0x2f0c65[_0x379a('0xa')]){_0x2f0c65[_0x379a('0xa')]={};}if(_0x23e684){_0x2f0c65[_0x379a('0xa')][_0x379a('0xb')]=_0x23e684;}else if(_0x2f0c65['body']['queue']){delete _0x2f0c65['body'][_0x379a('0xb')];}_0x819320[_0x379a('0xc')]=utils[_0x379a('0xd')](_0x2f0c65[_0x379a('0xe')]['notificationTemplate'],_0x2f0c65);}catch(_0x55a38d){_0x819320[_0x379a('0xc')]=_0x379a('0xf');logger[_0x379a('0x10')](util[_0x379a('0x11')]('[%s][QUEUE]\x20%s',_0x4eacbe,_0x55a38d['message']));}io['to'](util[_0x379a('0x11')]('user:%s',_0x484a91[_0x379a('0x12')]))[_0x379a('0x13')](util[_0x379a('0x11')]('notification:%s',_0x9e6da6?'save':_0x379a('0x14')),_0x819320);}function writeLog(_0xd6cc17,_0x499923,_0x200cfd){return logger[_0x379a('0x15')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0xd6cc17,_0x499923['name'],_0x200cfd));}exports[_0x379a('0x16')]=function(_0x4cf138,_0x263df8,_0x1cdebe,_0x38593a){if(_0x263df8[_0x379a('0x17')]){writeLog(_0x4cf138,_0x263df8,_0x379a('0x18'));return![];}if(!_0x263df8[_0x379a('0x19')]){writeLog(_0x4cf138,_0x263df8,_0x379a('0x1a'));return![];}if(_0x263df8[_0x1cdebe+_0x379a('0x1b')]){writeLog(_0x4cf138,_0x263df8,'PAUSE');return![];}if(_0x38593a&&_0x263df8[_0x379a('0x1c')](_0x1cdebe+_0x379a('0x1d'))&&_0x263df8[_0x379a('0x1c')](_0x1cdebe+_0x379a('0x1e'))){if(_0x263df8[_0x1cdebe+_0x379a('0x1d')]>0x0&&_0x263df8[_0x1cdebe+_0x379a('0x1e')]>=_0x263df8[_0x1cdebe+_0x379a('0x1d')]){writeLog(_0x4cf138,_0x263df8,_0x1cdebe['toUpperCase']()+_0x379a('0x1f'));return![];}}return!![];};exports[_0x379a('0x20')]=function(_0x18bb37,_0x516ddf,_0x483ddd,_0x3fc6c8,_0x599efb){return sendNotification(!![],_0x18bb37,_0x516ddf,_0x483ddd,_0x3fc6c8,_0x599efb);};exports[_0x379a('0x21')]=function(_0xc1fc5a,_0x47a528,_0x12a2ca,_0xe54a39,_0x19f945){return sendNotification(![],_0xc1fc5a,_0x47a528,_0x12a2ca,_0xe54a39,_0x19f945);};exports['checkWaitingNotifications']=function(_0x2ecb54,_0x4e7eea,_0x2a1765){var _0x33d5f7=_0x4e7eea[_0x379a('0x22')][_0x379a('0x23')];if(!_0x33d5f7&&_0x2a1765){_0x33d5f7=_0x2a1765['id'];}var _0x4eed7e=_[_0x379a('0x24')](_0x2ecb54[_0x4e7eea[_0x379a('0x25')]+_0x379a('0x26')],function(_0x97d9b4){var _0x30c9ab=_['capitalize'](_0x4e7eea[_0x379a('0x25')])+_0x379a('0x27');return _0x97d9b4[_0x30c9ab]===_0x4e7eea[_0x379a('0x22')]['id'];});if(!_0x4eed7e&&_0x33d5f7&&_0x2ecb54[_0x379a('0x28')][_0x33d5f7]){_0x4eed7e=_[_0x379a('0x24')](_0x2ecb54['agents'][_0x33d5f7][_0x4e7eea[_0x379a('0x25')]+_0x379a('0x29')],function(_0x85c61e){return _0x85c61e['id']===_0x4e7eea[_0x379a('0x22')]['id'];});}return _0x4eed7e;};exports[_0x379a('0x2a')]=function(_0x9005ab,_0x4c4442,_0x4d70b3,_0x456d52){if(_0x4d70b3&&_0x4d70b3['id']&&_0x9005ab['agents']&&_0x9005ab[_0x379a('0x28')][_0x4d70b3['id']]){_0x9005ab[_0x379a('0x28')][_0x4d70b3['id']][_0x456d52+_0x379a('0x29')][_0x4c4442['message']['id']]={'id':_0x4c4442['interaction']['id']};}};exports[_0x379a('0x2b')]=function(_0x2e5a46,_0x4678f2,_0x2026b9,_0x5e4e30){if(_0x2026b9&&_0x2026b9['id']&&_0x2e5a46[_0x379a('0x28')]&&_0x2e5a46[_0x379a('0x28')][_0x2026b9['id']]){delete _0x2e5a46[_0x379a('0x28')][_0x2026b9['id']][_0x5e4e30+_0x379a('0x29')][_0x4678f2['message']['id']];}};exports[_0x379a('0x2c')]=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 85c2db7..b4dc424 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 _0xc8c3=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc8c3,0x1c1));var _0x3c8c=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xc8c3[_0x4c98b9];return _0x3a257a;};'use strict';var schema=require(_0x3c8c('0x0'));var sh=require(_0x3c8c('0x1'));var _=require(_0x3c8c('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3c8c('0x3'));var system=schema({'command':{'type':_0x3c8c('0x4'),'required':!![],'message':_0x3c8c('0x5')}});exports['consequence']=function(_0x5a13ed,_0xc2654){return function(_0x2966fa){try{var _0xa99947={'command':_0xc2654[0x0]};var _0x5e1173=system['validate'](_0xa99947,{'typecast':!![]});if(_0x5e1173['length']){logger[_0x3c8c('0x6')](_0x3c8c('0x7'),_0x5a13ed,_['map'](_0x5e1173,'message')['join'](',\x20'));logger['info'](_0x3c8c('0x8'),_0x5a13ed);_0x2966fa[_0x3c8c('0x9')]();}else{var _0x45e832=this;var _0x50c2de=utils[_0x3c8c('0xa')](_0xc2654[0x0],this);logger[_0x3c8c('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5a13ed,_0x50c2de);sh[_0x3c8c('0xc')](_['trim'](_0x50c2de),function(_0x525f42,_0x5122a8){logger['info'](_0x3c8c('0xd'),_0x5a13ed,_0x525f42);if(_0x525f42==0x0){var _0x406014=_0x5122a8[_0x3c8c('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x3c8c('0xf')](_0xc2654[0x1])||_[_0x3c8c('0x10')](_0xc2654[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5a13ed);_0x45e832[_0x3c8c('0x11')][_0xc2654[0x1]]=_0x406014;}else{logger[_0x3c8c('0xb')](_0x3c8c('0x12'),_0x5a13ed,_0xc2654[0x1],_0x406014);_0x45e832[_0x3c8c('0x11')][_0xc2654[0x1]]=_0x406014;}}_0x2966fa[_0x3c8c('0x9')]();});}}catch(_0x204e6e){logger[_0x3c8c('0x6')](_0x3c8c('0x7'),_0x5a13ed,_[_0x3c8c('0x13')](_0x204e6e)?JSON[_0x3c8c('0x14')](_0x204e6e):_0x204e6e);logger[_0x3c8c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5a13ed);_0x2966fa[_0x3c8c('0x9')]();}};}; \ No newline at end of file +var _0x1c81=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','./utils','../../../../config/logger','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x1c81,0x8b));var _0x11c8=function(_0x17f44c,_0x35b7bc){_0x17f44c=_0x17f44c-0x0;var _0x1b6582=_0x1c81[_0x17f44c];return _0x1b6582;};'use strict';var schema=require(_0x11c8('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x11c8('0x1'));var logger=require(_0x11c8('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x11c8('0x3')]=function(_0x2144a2,_0x4da349){return function(_0x34d2b2){try{var _0x318930={'command':_0x4da349[0x0]};var _0xa530f3=system[_0x11c8('0x0')](_0x318930,{'typecast':!![]});if(_0xa530f3[_0x11c8('0x4')]){logger[_0x11c8('0x5')](_0x11c8('0x6'),_0x2144a2,_[_0x11c8('0x7')](_0xa530f3,_0x11c8('0x8'))[_0x11c8('0x9')](',\x20'));logger[_0x11c8('0xa')](_0x11c8('0xb'),_0x2144a2);_0x34d2b2[_0x11c8('0xc')]();}else{var _0xf1af51=this;var _0x77a99d=utils[_0x11c8('0xd')](_0x4da349[0x0],this);logger[_0x11c8('0xa')](_0x11c8('0xe'),_0x2144a2,_0x77a99d);sh['exec'](_['trim'](_0x77a99d),function(_0x16c011,_0x3a90ec){logger[_0x11c8('0xa')](_0x11c8('0xf'),_0x2144a2,_0x16c011);if(_0x16c011==0x0){var _0xc2b528=_0x3a90ec[_0x11c8('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x11c8('0x11')](_0x4da349[0x1])||_[_0x11c8('0x12')](_0x4da349[0x1])){logger['info'](_0x11c8('0x13'),_0x2144a2);_0xf1af51[_0x11c8('0x14')][_0x4da349[0x1]]=_0xc2b528;}else{logger['info'](_0x11c8('0x15'),_0x2144a2,_0x4da349[0x1],_0xc2b528);_0xf1af51['body'][_0x4da349[0x1]]=_0xc2b528;}}_0x34d2b2[_0x11c8('0xc')]();});}}catch(_0x41e482){logger[_0x11c8('0x5')](_0x11c8('0x6'),_0x2144a2,_['isObject'](_0x41e482)?JSON['stringify'](_0x41e482):_0x41e482);logger[_0x11c8('0xa')](_0x11c8('0xb'),_0x2144a2);_0x34d2b2[_0x11c8('0xc')]();}};}; \ 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 a691e57..93b2125 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 _0x9217=['isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','then','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9217,0x11f));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0x7921('0x0'));var rpc={'chatInteraction':require(_0x7921('0x1')),'openchannelInteraction':require(_0x7921('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7921('0x3')),'faxInteraction':require(_0x7921('0x4')),'whatsappInteraction':require(_0x7921('0x5'))};var logger=require('../../../../config/logger')(_0x7921('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7921('0x7')}});exports[_0x7921('0x8')]=function(_0x5bf399,_0x455c74,_0x11b3d1,_0x4267d4){return function(_0x40b831){try{var _0x3cb1b5={'tag':_0x455c74[0x0]};var _0x2a104d=tag[_0x7921('0x9')](_0x3cb1b5,{'typecast':!![]});if(_0x2a104d[_0x7921('0xa')]){logger[_0x7921('0xb')](_0x7921('0xc'),_0x5bf399,_[_0x7921('0xd')](_0x2a104d,_0x7921('0xe'))['join'](',\x20'));logger[_0x7921('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5bf399);_0x40b831[_0x7921('0x10')]();}else{var _0x490354={'ids':[_0x455c74[0x0]]};if(rpc[_0x4267d4[_0x7921('0x11')]+_0x7921('0x12')]){rpc[_0x4267d4[_0x7921('0x11')]+'Interaction'][_0x7921('0x13')](_0x4267d4[_0x7921('0x14')]['id'],_0x490354)[_0x7921('0x15')](function(_0x355864){logger[_0x7921('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5bf399,_0x455c74[0x1],_0x4267d4['channel'],_0x4267d4[_0x7921('0x14')]['id']);})[_0x7921('0x16')](function(_0xbaae5d){logger[_0x7921('0xb')](_0x7921('0xc'),_0x5bf399,JSON[_0x7921('0x17')](_0xbaae5d));logger[_0x7921('0xf')](_0x7921('0x18'),_0x5bf399);})['finally'](function(){_0x40b831[_0x7921('0x10')]();});}}}catch(_0x47f479){logger[_0x7921('0xb')]('[%s][TAG]\x20%s',_0x5bf399,_[_0x7921('0x19')](_0x47f479)?JSON[_0x7921('0x17')](_0x47f479):_0x47f479);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5bf399);_0x40b831['next']();}};}; \ No newline at end of file +var _0x71e0=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','isObject','validate','lodash','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x71e0,0xd6));var _0x071e=function(_0x1cb74d,_0xd16e6c){_0x1cb74d=_0x1cb74d-0x0;var _0x452c67=_0x71e0[_0x1cb74d];return _0x452c67;};'use strict';var schema=require(_0x071e('0x0'));var _=require(_0x071e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x071e('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x071e('0x3'))};var logger=require('../../../../config/logger')(_0x071e('0x4'));var tag=schema({'tag':{'type':_0x071e('0x5'),'required':!![],'message':_0x071e('0x6')}});exports['consequence']=function(_0x1eba21,_0x45b94a,_0x198e7b,_0x1ad20f){return function(_0x51ed99){try{var _0x1ad182={'tag':_0x45b94a[0x0]};var _0x3ca34b=tag[_0x071e('0x0')](_0x1ad182,{'typecast':!![]});if(_0x3ca34b[_0x071e('0x7')]){logger[_0x071e('0x8')]('[%s][TAG]\x20%s',_0x1eba21,_['map'](_0x3ca34b,_0x071e('0x9'))[_0x071e('0xa')](',\x20'));logger[_0x071e('0xb')](_0x071e('0xc'),_0x1eba21);_0x51ed99[_0x071e('0xd')]();}else{var _0x357e93={'ids':[_0x45b94a[0x0]]};if(rpc[_0x1ad20f['channel']+'Interaction']){rpc[_0x1ad20f['channel']+_0x071e('0xe')][_0x071e('0xf')](_0x1ad20f[_0x071e('0x10')]['id'],_0x357e93)[_0x071e('0x11')](function(_0x396311){logger[_0x071e('0xb')](_0x071e('0x12'),_0x1eba21,_0x45b94a[0x1],_0x1ad20f['channel'],_0x1ad20f[_0x071e('0x10')]['id']);})[_0x071e('0x13')](function(_0x1c6b4e){logger[_0x071e('0x8')](_0x071e('0x14'),_0x1eba21,JSON[_0x071e('0x15')](_0x1c6b4e));logger[_0x071e('0xb')](_0x071e('0xc'),_0x1eba21);})['finally'](function(){_0x51ed99[_0x071e('0xd')]();});}}}catch(_0x20571d){logger['error'](_0x071e('0x14'),_0x1eba21,_[_0x071e('0x16')](_0x20571d)?JSON[_0x071e('0x15')](_0x20571d):_0x20571d);logger['info'](_0x071e('0xc'),_0x1eba21);_0x51ed99['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index c457970..7185fcd 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5782=['then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','replace','\x20-\x20','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','stringify','utf8','POST'];(function(_0x4f9c58,_0x2ddf0a){var _0x1ec233=function(_0x12f804){while(--_0x12f804){_0x4f9c58['push'](_0x4f9c58['shift']());}};_0x1ec233(++_0x2ddf0a);}(_0x5782,0x141));var _0x2578=function(_0x2b8700,_0x2652f4){_0x2b8700=_0x2b8700-0x0;var _0x3692ef=_0x5782[_0x2b8700];return _0x3692ef;};'use strict';var rp=require(_0x2578('0x0'));var logger=require('../../../../config/logger')(_0x2578('0x1'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x177de1,_0x2a6343){return function(_0x58fe65){var _0x5361da=_0x2a6343[0xa];var _0xf446bb=_0x2a6343[0xb];var _0x376eba=_0x2a6343[0xc];var _0x504605=_0x2a6343[0xd];var _0x136765=_0x2a6343[0xe];var _0x56a166=_0x2a6343[0xf][_0x2578('0x2')](/\n/g,_0x2578('0x3'));var _0x133203=_0x2a6343[0x10][_0x2578('0x2')](/\n/g,'\x20');if(!arr['includes'](_0xf446bb)){arr[_0x2578('0x4')](_0xf446bb);var _0x11a7be=_0x2a6343[0x3];var _0x2376cd=_0x2a6343[0x4];var _0x147c29=_0x2a6343[0x1];var _0x2dd6df=_0x2a6343[0x0];var _0x2259be={};_0x2259be[_0x2578('0x5')]=_0x2a6343[0x8]+_0x2578('0x6')+_0x376eba+'|'+_0x5361da+'|'+_0x504605+'|'+_0xf446bb+'|'+_0x136765;_0x2259be['urlOnRing']=_0x2a6343[0x7]+_0x2578('0x6')+_0x376eba+'|'+_0x5361da+'|'+_0x504605+'|'+_0xf446bb+'|'+_0x136765+'|'+_0x56a166+'|'+_0x133203;_0x2259be['title']=_0x2a6343[0x9];var _0x3bc9ed={};_0x3bc9ed[_0x2578('0x7')]=_0x2578('0x8');_0x3bc9ed[_0x2578('0x9')]=_0x2578('0xa');var _0x4d3db7=[];_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x2]);_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x5]);_0x4d3db7[_0x2578('0x4')](_0x2a6343[0x6]);_0x3bc9ed[_0x2578('0xb')]=_0x4d3db7;_0x3bc9ed['id']=0x1;var _0x5e1d22=JSON[_0x2578('0xc')](_0x3bc9ed);var _0x52b69c={'encoding':_0x2578('0xd'),'method':_0x2578('0xe'),'timeout':0x2710,'url':_0x11a7be,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5e1d22};return rp(_0x52b69c)[_0x2578('0xf')](function(_0x603fb6){const _0x18d346=JSON['parse'](_0x603fb6);if(!_0x18d346[_0x2578('0x10')]['logged']){throw new Error(_0x2578('0x11'));}var _0x2a9482=_0xf446bb;var _0x4e4b80=_0x2578('0x12')+_0x147c29+'&serviceId='+_0x2dd6df+_0x2578('0x13')+_0x2a9482+'&data='+JSON['stringify'](_0x2259be);var _0x9e0ec7=_0x2376cd+'?'+_0x4e4b80;return rp(_0x9e0ec7);})['then'](function(_0x329165){logger[_0x2578('0x14')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x177de1,_0x329165);_0x58fe65[_0x2578('0x15')]();})[_0x2578('0x16')](function(_0x1b984e){logger[_0x2578('0x17')](_0x2578('0x18'),_0x177de1,_[_0x2578('0x19')](_0x1b984e)?JSON[_0x2578('0xc')](_0x1b984e):_0x1b984e);_0x58fe65[_0x2578('0x15')]();});}else{logger[_0x2578('0x14')](_0x2578('0x1a'),_0x177de1);_0x58fe65[_0x2578('0x1b')]();}};}; \ No newline at end of file +var _0xe09d=['includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x4a2877,_0x3e5c9b){var _0x575e3d=function(_0x191e0a){while(--_0x191e0a){_0x4a2877['push'](_0x4a2877['shift']());}};_0x575e3d(++_0x3e5c9b);}(_0xe09d,0x1a9));var _0xde09=function(_0xa90779,_0x26cda8){_0xa90779=_0xa90779-0x0;var _0x4c088d=_0xe09d[_0xa90779];return _0x4c088d;};'use strict';var rp=require(_0xde09('0x0'));var logger=require(_0xde09('0x1'))(_0xde09('0x2'));var _=require(_0xde09('0x3'));var arr=[];exports[_0xde09('0x4')]=function(_0x4cc110,_0x2d1b23){return function(_0x126435){var _0x58eced=_0x2d1b23[0xa];var _0x2e0052=_0x2d1b23[0xb];var _0x3bf725=_0x2d1b23[0xc];var _0x27195f=_0x2d1b23[0xd];var _0x5ae865=_0x2d1b23[0xe];var _0x5d699e=_0x2d1b23[0xf][_0xde09('0x5')](/\n/g,_0xde09('0x6'));var _0x2a42fe=_0x2d1b23[0x10][_0xde09('0x5')](/\n/g,'\x20');if(!arr[_0xde09('0x7')](_0x2e0052)){arr[_0xde09('0x8')](_0x2e0052);var _0x4a12da=_0x2d1b23[0x3];var _0x47f8ef=_0x2d1b23[0x4];var _0x3022e6=_0x2d1b23[0x1];var _0x169f3a=_0x2d1b23[0x0];var _0x6a4739={};_0x6a4739[_0xde09('0x9')]=_0x2d1b23[0x8]+_0xde09('0xa')+_0x3bf725+'|'+_0x58eced+'|'+_0x27195f+'|'+_0x2e0052+'|'+_0x5ae865;_0x6a4739[_0xde09('0xb')]=_0x2d1b23[0x7]+_0xde09('0xa')+_0x3bf725+'|'+_0x58eced+'|'+_0x27195f+'|'+_0x2e0052+'|'+_0x5ae865+'|'+_0x5d699e+'|'+_0x2a42fe;_0x6a4739[_0xde09('0xc')]=_0x2d1b23[0x9];var _0x1a7427={};_0x1a7427[_0xde09('0xd')]='2.0';_0x1a7427[_0xde09('0xe')]=_0xde09('0xf');var _0x5a7c8e=[];_0x5a7c8e['push'](_0x2d1b23[0x2]);_0x5a7c8e[_0xde09('0x8')](_0x2d1b23[0x5]);_0x5a7c8e[_0xde09('0x8')](_0x2d1b23[0x6]);_0x1a7427[_0xde09('0x10')]=_0x5a7c8e;_0x1a7427['id']=0x1;var _0x5909b5=JSON[_0xde09('0x11')](_0x1a7427);var _0x54e616={'encoding':_0xde09('0x12'),'method':_0xde09('0x13'),'timeout':0x2710,'url':_0x4a12da,'headers':{'Content-Type':_0xde09('0x14')},'body':_0x5909b5};return rp(_0x54e616)[_0xde09('0x15')](function(_0xc27e35){const _0x529c28=JSON[_0xde09('0x16')](_0xc27e35);if(!_0x529c28['result'][_0xde09('0x17')]){throw new Error(_0xde09('0x18'));}var _0x53807e=_0x2e0052;var _0xe04a4b='channelId='+_0x3022e6+'&serviceId='+_0x169f3a+_0xde09('0x19')+_0x53807e+_0xde09('0x1a')+JSON['stringify'](_0x6a4739);var _0x4dd603=_0x47f8ef+'?'+_0xe04a4b;return rp(_0x4dd603);})[_0xde09('0x15')](function(_0x1ff9d7){logger[_0xde09('0x1b')](_0xde09('0x1c'),_0x4cc110,_0x1ff9d7);_0x126435[_0xde09('0x1d')]();})[_0xde09('0x1e')](function(_0x35a7fb){logger[_0xde09('0x1f')](_0xde09('0x20'),_0x4cc110,_[_0xde09('0x21')](_0x35a7fb)?JSON[_0xde09('0x11')](_0x35a7fb):_0x35a7fb);_0x126435[_0xde09('0x1d')]();});}else{logger[_0xde09('0x1b')](_0xde09('0x22'),_0x4cc110);_0x126435[_0xde09('0x23')]();}};}; \ 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 f6ad10a..0eefa52 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x27ef5b,_0x4916aa){var _0x3f594e=function(_0x2f9cbe){while(--_0x2f9cbe){_0x27ef5b['push'](_0x27ef5b['shift']());}};_0x3f594e(++_0x4916aa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4ad44d,_0x237a40){var _0x14e73b=function(_0x5d9133){while(--_0x5d9133){_0x4ad44d['push'](_0x4ad44d['shift']());}};_0x14e73b(++_0x237a40);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ab6cc16..da8011e 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 _0x99e7=['complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','emit'];(function(_0x1c8222,_0x13db80){var _0x4f0256=function(_0x384d1b){while(--_0x384d1b){_0x1c8222['push'](_0x1c8222['shift']());}};_0x4f0256(++_0x13db80);}(_0x99e7,0x1b5));var _0x799e=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x99e7[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x799e('0x0'));var util=require(_0x799e('0x1'));var path=require(_0x799e('0x2'));var fs=require('fs');var jayson=require(_0x799e('0x3'));var BPromise=require(_0x799e('0x4'));var utils=require(_0x799e('0x5'));var sUtils=require(_0x799e('0x6'));var logger=require(_0x799e('0x7'))(_0x799e('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x799e('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x799e('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x799e('0xb'));function getId(_0x373341,_0x3cec49,_0x1edc75){return util[_0x799e('0xc')]('%s.%s.%s',_0x373341,_0x3cec49||0x0,_0x1edc75||0x0);}function getIntervals(_0x21df07,_0x3477f3){var _0x38cd71=[];if(!_[_0x799e('0xd')](_0x3477f3['IntervalId'])&&!_[_0x799e('0xd')](_0x21df07[_0x3477f3[_0x799e('0xe')]])&&!_[_0x799e('0xd')](_0x21df07[_0x3477f3[_0x799e('0xe')]][_0x799e('0xf')])){_0x38cd71=_[_0x799e('0x10')](_0x21df07[_0x3477f3[_0x799e('0xe')]]['Intervals'],_0x799e('0x11'));}else if(!_[_0x799e('0xd')](_0x3477f3[_0x799e('0x11')])){_0x38cd71=[_0x3477f3[_0x799e('0x11')]];}return _0x38cd71;}exports[_0x799e('0x12')]=function(_0x1ce347){_0x1ce347[_0x799e('0x13')]={};return new BPromise(function(_0x2765e1,_0xd4f4a8){var _0x1d1fbc={'Start':function(_0x5a2b6a){var _0x5299a8=this;return new Promise(function(_0x4267bc,_0x41e5a5){if(_0x5a2b6a){try{var _0x202629=[];var _0x550fae=getId(_0x5a2b6a[_0x799e('0x14')],_0x5a2b6a[_0x799e('0x15')]?_0x5a2b6a[_0x799e('0x15')]['id']:0x0,_0x5a2b6a[_0x799e('0x16')]?_0x5a2b6a[_0x799e('0x16')]['id']:0x0);var _0x5331b5=sUtils[_0x799e('0x17')](_0x1ce347,_0x5a2b6a);if(_0x5a2b6a[_0x799e('0x18')]||!_0x5331b5&&_0x5a2b6a[_0x799e('0x19')]&&_[_0x799e('0x1a')](_0x5a2b6a['applications'])&&_0x5a2b6a[_0x799e('0x19')]['length']){for(var _0x1b1478=0x0;_0x1b1478<_0x5a2b6a[_0x799e('0x19')][_0x799e('0x1b')];_0x1b1478+=0x1){var _0x2236aa=_0x5a2b6a[_0x799e('0x19')][_0x1b1478];if(fs[_0x799e('0x1c')](path[_0x799e('0x1d')](__dirname,_0x799e('0x19'),_0x2236aa[_0x799e('0x1e')]+_0x799e('0x1f')))){var _0x46375b=[];switch(_0x2236aa[_0x799e('0x1e')][_0x799e('0x20')]()){case'autoreply':var _0x2c9820=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');if(_0x5a2b6a['channel']==='mail'){_0x46375b[_0x799e('0x23')](_0x2c9820[0x0]);_0x46375b[_0x799e('0x23')](_0x2c9820[0x1]);_0x46375b[_0x799e('0x23')](_0x2c9820[_0x799e('0x24')](0x2,_0x2c9820[_0x799e('0x1b')])[_0x799e('0x1d')](','));}else{_0x46375b[_0x799e('0x23')](_0x2c9820[0x0]);_0x46375b[_0x799e('0x23')](_0x2c9820[_0x799e('0x24')](0x1,_0x2c9820[_0x799e('0x1b')])[_0x799e('0x1d')](','));}break;case _0x799e('0x25'):var _0x5eb10e=_0x2236aa[_0x799e('0x21')]['split'](',');_0x46375b[_0x799e('0x23')](_0x5eb10e[0x0]);_0x46375b[_0x799e('0x23')](_0x5eb10e[0x1]);_0x46375b[_0x799e('0x23')](_0x5eb10e['slice'](0x2,_0x5eb10e[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x26'):var _0x41e894=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x41e894[0x0]);_0x46375b[_0x799e('0x23')](_0x41e894[0x1]);_0x46375b[_0x799e('0x23')](_0x41e894[0x2]);_0x46375b[_0x799e('0x23')](_0x41e894[0x3]);_0x46375b[_0x799e('0x23')](_0x41e894[_0x799e('0x24')](0x4,_0x41e894[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x27'):var _0x40acd3=_0x2236aa['appdata'][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x40acd3[0x0]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x1]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x2]);_0x46375b[_0x799e('0x23')](_0x40acd3[0x3]);_0x46375b[_0x799e('0x23')](_0x40acd3[_0x799e('0x24')](0x4,_0x40acd3[_0x799e('0x1b')])[_0x799e('0x1d')](','));break;case _0x799e('0x15'):_0x46375b['push'](_0x2236aa[_0x799e('0x21')]);break;case'tag':_0x46375b[_0x799e('0x23')](_0x2236aa[_0x799e('0x28')]);_0x46375b[_0x799e('0x23')](_0x2236aa['appdata']);break;case _0x799e('0x29'):var _0x4b2f64=utils[_0x799e('0x2a')](_0x5a2b6a['account'][_0x799e('0x2b')],_0x5a2b6a);var _0x5279d2=_0x2236aa[_0x799e('0x21')][_0x799e('0x22')](',');_0x46375b[_0x799e('0x23')](_0x5279d2[0x0]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x1]);_0x46375b['push'](_0x5279d2[0x2]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x3]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x4]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x5]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x6]);_0x46375b['push'](_0x5279d2[0x7]);_0x46375b[_0x799e('0x23')](_0x5279d2[0x8]);_0x46375b['push'](_0x5279d2[0x9]);_0x46375b['push'](_0x5279d2[0xa]);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x16')]['id']);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x15')]['id']);_0x46375b[_0x799e('0x23')](_0x2236aa[_0x799e('0x2c')]);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x16')]['ContactId']);_0x46375b[_0x799e('0x23')](_0x5a2b6a[_0x799e('0x2d')][_0x799e('0x2d')]);_0x46375b[_0x799e('0x23')](_0x4b2f64);break;default:_0x46375b=_['isNil'](_0x2236aa[_0x799e('0x21')])?[]:_0x2236aa['appdata']['split'](',');}var _0x2056f3={'id':util['format']('%s:%s:%s',_0x550fae,_0x2236aa['id'],_0x2236aa[_0x799e('0x1e')]),'condition':require('./interval')[_0x799e('0x2e')](_0x550fae,getIntervals(_0x1ce347[_0x799e('0x2f')],_0x2236aa),_0x1ce347),'consequence':require(_0x799e('0x30')+_0x2236aa['app'])['consequence'](_0x550fae,_0x46375b,_0x1ce347,_0x5a2b6a),'p':_0x2236aa['priority']||0x0};logger[_0x799e('0x31')](_0x799e('0x32'),_0x2056f3['id'],_0x799e('0x33'),getIntervals(_0x1ce347[_0x799e('0x2f')],_0x2236aa)[_0x799e('0x1d')](_0x799e('0x34')));_0x202629[_0x799e('0x23')](_0x2056f3);}else{logger[_0x799e('0x35')](_0x799e('0x36'),path[_0x799e('0x1d')](__dirname,_0x799e('0x19'),_0x2236aa[_0x799e('0x1e')]+'.js'));}}_0x1ce347['rules'][_0x550fae]=new RuleEngine(_0x202629);_0x1ce347['rules'][_0x550fae][_0x799e('0x37')](_0x5a2b6a,function(_0x5ad338){logger[_0x799e('0x31')]('Applications\x20executed',JSON['stringify'](_0x5ad338[_0x799e('0x38')]));if(_0x1ce347[_0x799e('0x13')][_0x550fae]){_0x1ce347[_0x799e('0x13')][_0x550fae][_0x799e('0x39')](_0x799e('0x3a'));}});return _0x4267bc({'code':0xc8,'message':_0x5a2b6a});}else{if(_0x5331b5){logger[_0x799e('0x31')](util[_0x799e('0xc')](_0x799e('0x3b'),_0x550fae));}else{logger['info'](_0x799e('0x3c'));}return _0x4267bc({'code':0xc8,'message':_0x5a2b6a});}}catch(_0x1739c0){logger[_0x799e('0x35')](_0x1739c0[_0x799e('0x3d')]);return _0x41e5a5(_0x5299a8[_0x799e('0x35')](0x1f4,_0x1739c0));}}return _0x41e5a5(_0x799e('0x3e'));});},'AcceptMessage':function(_0xf18956){var _0x4f953b=this;return new Promise(function(_0x1035c3,_0x565dcb){if(_0xf18956[_0x799e('0x3f')]&&_0xf18956[_0x799e('0x3f')]['id']){if(_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']]){_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']]['busy']=![];_0x1ce347[_0x799e('0x40')][_0xf18956[_0x799e('0x3f')]['id']][_0x799e('0x41')]=undefined;}}if(_0xf18956['message']&&_0xf18956['message']['id']){try{var _0x4345a7=getId(_0xf18956[_0x799e('0x14')],_0xf18956['message']?_0xf18956[_0x799e('0x15')]['id']:0x0,_0xf18956[_0x799e('0x16')]?_0xf18956[_0x799e('0x16')]['id']:0x0);if(_0x1ce347['rules'][_0x4345a7]){_0x1ce347['rules'][_0x4345a7]['emit'](_0x799e('0x42'));if(rpc[_0xf18956[_0x799e('0x14')]+_0x799e('0x43')]){rpc[_0xf18956['channel']+'QueueReport'][_0x799e('0x44')](_0x4345a7,{'UserId':_0xf18956['message'][_0x799e('0x45')]})[_0x799e('0x46')](function(){logger[_0x799e('0x35')](_0x799e('0x47'));});}}return _0x1035c3({'code':0xc8,'message':_0xf18956});}catch(_0x4a3a44){logger[_0x799e('0x35')](_0x4a3a44['stack']);return _0x565dcb(_0x4f953b['error'](0x1f4,_0x4a3a44));}}logger[_0x799e('0x35')]('message\x20is\x20empty');return _0x565dcb(_0x4f953b[_0x799e('0x35')](0x1f4,_0x799e('0x48')));});},'RejectMessage':function(_0x488fd9){var _0x49288e=this;return new Promise(function(_0x41496d,_0x1c2c5f){if(_0x488fd9[_0x799e('0x3f')]&&_0x488fd9[_0x799e('0x3f')]['id']){try{if(_0x1ce347[_0x799e('0x40')][_0x488fd9[_0x799e('0x3f')]['id']]){_0x1ce347['agents'][_0x488fd9[_0x799e('0x3f')]['id']][_0x799e('0x49')]=![];_0x1ce347['agents'][_0x488fd9[_0x799e('0x3f')]['id']]['busyQueue']=undefined;}return _0x41496d({'code':0xc8,'message':_0x488fd9});}catch(_0x3b2f34){logger[_0x799e('0x35')](_0x3b2f34['stack']);return _0x1c2c5f(_0x49288e[_0x799e('0x35')](0x1f4,_0x3b2f34));}}logger[_0x799e('0x35')](_0x799e('0x48'));return _0x1c2c5f(_0x49288e[_0x799e('0x35')](0x1f4,_0x799e('0x48')));});},'AbandonInteraction':function(_0x1f748f){var _0xc9d99b=this;return new Promise(function(_0x88fba,_0x1aaff3){if(_0x1f748f[_0x799e('0x14')]&&_0x1f748f[_0x799e('0x16')]&&_0x1f748f[_0x799e('0x16')]['id']){try{var _0x2857f6=getId(_0x1f748f[_0x799e('0x14')],_0x1f748f['message']?_0x1f748f['message']['id']:0x0,_0x1f748f[_0x799e('0x16')]?_0x1f748f[_0x799e('0x16')]['id']:0x0);if(_0x1ce347[_0x799e('0x13')][_0x2857f6]){_0x1ce347[_0x799e('0x13')][_0x2857f6]['emit'](_0x799e('0x42'));}return _0x88fba({'code':0xc8,'message':_0x1f748f});}catch(_0x33285e){logger['error'](_0x33285e[_0x799e('0x3d')]);return _0x1aaff3(_0xc9d99b['error'](0x1f4,_0x33285e));}}logger[_0x799e('0x35')](_0x799e('0x48'));return _0x1aaff3(_0xc9d99b[_0x799e('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x19e30e){var _0x3c8bb4=this;return new Promise(function(_0x2344f8,_0xe5db){if(_0x1ce347[_0x799e('0x40')][_0x799e('0x4a')](_0x19e30e['id'])){for(var _0x90f3dd in _0x19e30e['capacity']){if(_0x19e30e[_0x799e('0x4b')]['hasOwnProperty'](_0x90f3dd)){if(_0x1ce347['agents'][_0x19e30e['id']][_0x799e('0x4a')](_0x90f3dd+_0x799e('0x4c'))){_0x1ce347[_0x799e('0x40')][_0x19e30e['id']][_0x90f3dd+_0x799e('0x4c')]=parseInt(_0x19e30e['capacity'][_0x90f3dd],0xa);}}}_0x1ce347[_0x799e('0x40')][_0x19e30e['id']][_0x799e('0x4d')]();return _0x2344f8({'code':0xc8,'message':_0x1ce347['agents'][_0x19e30e['id']]});}else{return _0xe5db(_0x3c8bb4[_0x799e('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x31a777){return new Promise(function(_0x1540ac){var _0x323786=_['values'](_0x1ce347['agents']);if(_0x31a777&&_0x31a777['id']){var _0x2a82d9=_['find'](_0x323786,function(_0x2cc1fc){return _0x2cc1fc['id']===_0x31a777['id'];});_0x1540ac(_0x2a82d9);}else{_0x1540ac({'count':_0x323786[_0x799e('0x1b')],'rows':_0x323786});}});},'ChatQueues':function(){return new Promise(function(_0x47b974){var _0x55d351=[];for(var _0x46c8f4 in _0x1ce347[_0x799e('0x4e')]){if(_0x1ce347[_0x799e('0x4e')][_0x799e('0x4a')](_0x46c8f4)){var _0xb7e6fe=_0x1ce347['chatQueues'][_0x46c8f4];var _0x19f141={'id':_0xb7e6fe['id'],'available':_0xb7e6fe[_0x799e('0x4f')],'loggedIn':_0xb7e6fe[_0x799e('0x50')],'name':_0xb7e6fe[_0x799e('0x51')],'paused':_0xb7e6fe[_0x799e('0x52')],'waiting':_0xb7e6fe[_0x799e('0x53')]};_0x55d351[_0x799e('0x23')](_0x19f141);}}_0x47b974({'count':_0x55d351[_0x799e('0x1b')],'rows':_0x55d351});});},'MailQueues':function(){return new Promise(function(_0xe08a70){var _0x2f85c9=[];for(var _0x302369 in _0x1ce347[_0x799e('0x54')]){if(_0x1ce347[_0x799e('0x54')]['hasOwnProperty'](_0x302369)){var _0xd7b377=_0x1ce347['mailQueues'][_0x302369];var _0xbbb93d={'id':_0xd7b377['id'],'available':_0xd7b377[_0x799e('0x4f')],'loggedIn':_0xd7b377[_0x799e('0x50')],'name':_0xd7b377['name'],'paused':_0xd7b377[_0x799e('0x52')],'waiting':_0xd7b377[_0x799e('0x53')]};_0x2f85c9[_0x799e('0x23')](_0xbbb93d);}}_0xe08a70({'count':_0x2f85c9['length'],'rows':_0x2f85c9});});},'OpenchannelQueues':function(){return new Promise(function(_0x2005b8){var _0x4d8685=[];for(var _0x41ee85 in _0x1ce347[_0x799e('0x55')]){if(_0x1ce347[_0x799e('0x55')]['hasOwnProperty'](_0x41ee85)){var _0x3954c4=_0x1ce347[_0x799e('0x55')][_0x41ee85];var _0x418841={'id':_0x3954c4['id'],'available':_0x3954c4[_0x799e('0x4f')],'loggedIn':_0x3954c4[_0x799e('0x50')],'name':_0x3954c4['name'],'paused':_0x3954c4['paused'],'waiting':_0x3954c4[_0x799e('0x53')]};_0x4d8685['push'](_0x418841);}}_0x2005b8({'count':_0x4d8685[_0x799e('0x1b')],'rows':_0x4d8685});});},'SmsQueues':function(){return new Promise(function(_0x71a5b6){var _0x50f0d0=[];for(var _0x2ee09e in _0x1ce347[_0x799e('0x56')]){if(_0x1ce347[_0x799e('0x56')][_0x799e('0x4a')](_0x2ee09e)){var _0x424443=_0x1ce347[_0x799e('0x56')][_0x2ee09e];var _0x3adfa9={'id':_0x424443['id'],'available':_0x424443[_0x799e('0x4f')],'loggedIn':_0x424443['loggedIn'],'name':_0x424443[_0x799e('0x51')],'paused':_0x424443['paused'],'waiting':_0x424443[_0x799e('0x53')]};_0x50f0d0[_0x799e('0x23')](_0x3adfa9);}}_0x71a5b6({'count':_0x50f0d0[_0x799e('0x1b')],'rows':_0x50f0d0});});},'FaxQueues':function(){return new Promise(function(_0x4fb312){var _0x388824=[];for(var _0x4a1002 in _0x1ce347[_0x799e('0x57')]){if(_0x1ce347[_0x799e('0x57')][_0x799e('0x4a')](_0x4a1002)){var _0x2287ca=_0x1ce347[_0x799e('0x57')][_0x4a1002];var _0x9483be={'id':_0x2287ca['id'],'available':_0x2287ca['available'],'loggedIn':_0x2287ca[_0x799e('0x50')],'name':_0x2287ca[_0x799e('0x51')],'paused':_0x2287ca[_0x799e('0x52')],'waiting':_0x2287ca[_0x799e('0x53')]};_0x388824[_0x799e('0x23')](_0x9483be);}}_0x4fb312({'count':_0x388824[_0x799e('0x1b')],'rows':_0x388824});});},'WhatsappQueues':function(){return new Promise(function(_0x233c74){var _0x5447d5=[];for(var _0x55b841 in _0x1ce347[_0x799e('0x58')]){if(_0x1ce347[_0x799e('0x58')][_0x799e('0x4a')](_0x55b841)){var _0x5d656c=_0x1ce347[_0x799e('0x58')][_0x55b841];var _0x1d1271={'id':_0x5d656c['id'],'available':_0x5d656c[_0x799e('0x4f')],'loggedIn':_0x5d656c[_0x799e('0x50')],'name':_0x5d656c[_0x799e('0x51')],'paused':_0x5d656c['paused'],'waiting':_0x5d656c[_0x799e('0x53')]};_0x5447d5[_0x799e('0x23')](_0x1d1271);}}_0x233c74({'count':_0x5447d5[_0x799e('0x1b')],'rows':_0x5447d5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x318225){var _0x38ffa1=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5a')]);_0x318225({'count':_0x38ffa1[_0x799e('0x1b')],'rows':_0x38ffa1});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x18b85b){var _0xaab319=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5b')]);_0x18b85b({'count':_0xaab319[_0x799e('0x1b')],'rows':_0xaab319});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x385bee){var _0x2ad4da=_[_0x799e('0x59')](_0x1ce347['openchannelQueuesWaitingInteractions']);_0x385bee({'count':_0x2ad4da[_0x799e('0x1b')],'rows':_0x2ad4da});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2e575c){var _0x14cf71=_['values'](_0x1ce347[_0x799e('0x5c')]);_0x2e575c({'count':_0x14cf71[_0x799e('0x1b')],'rows':_0x14cf71});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4ae4f2){var _0x23149f=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5d')]);_0x4ae4f2({'count':_0x23149f[_0x799e('0x1b')],'rows':_0x23149f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x54ead3){var _0x5c01f7=_[_0x799e('0x59')](_0x1ce347[_0x799e('0x5e')]);_0x54ead3({'count':_0x5c01f7[_0x799e('0x1b')],'rows':_0x5c01f7});});}};var _0x2df949=jayson['server'](_0x1d1fbc)[_0x799e('0x5f')]();_0x2df949['on'](_0x799e('0x35'),function(_0x2ac055){logger['error'](JSON[_0x799e('0x60')](_0x2ac055));return _0xd4f4a8(_0x2ac055);});_0x2df949[_0x799e('0x12')](0x232c,'127.0.0.1',function(){console[_0x799e('0x61')](_0x799e('0x62'),0x232c);return _0x2765e1('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xa5c9=['paused','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/strategy/util','../../../config/logger','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','dialogflow','slice','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','waiting','mailQueues','openchannelQueues'];(function(_0xeca8c7,_0xe4eeb0){var _0x2cd840=function(_0x3f7c98){while(--_0x3f7c98){_0xeca8c7['push'](_0xeca8c7['shift']());}};_0x2cd840(++_0xe4eeb0);}(_0xa5c9,0x143));var _0x9a5c=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xa5c9[_0x454018];return _0x24697d;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var path=require(_0x9a5c('0x2'));var fs=require('fs');var jayson=require(_0x9a5c('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x9a5c('0x4'));var logger=require(_0x9a5c('0x5'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x9a5c('0x6')),'smsQueueReport':require(_0x9a5c('0x7')),'faxQueueReport':require(_0x9a5c('0x8')),'whatsappQueueReport':require(_0x9a5c('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x8de4e9,_0x4ea491,_0xc96c1c){return util[_0x9a5c('0xa')]('%s.%s.%s',_0x8de4e9,_0x4ea491||0x0,_0xc96c1c||0x0);}function getIntervals(_0x127932,_0x29cf77){var _0x1205e3=[];if(!_['isNil'](_0x29cf77['IntervalId'])&&!_[_0x9a5c('0xb')](_0x127932[_0x29cf77[_0x9a5c('0xc')]])&&!_[_0x9a5c('0xb')](_0x127932[_0x29cf77[_0x9a5c('0xc')]][_0x9a5c('0xd')])){_0x1205e3=_[_0x9a5c('0xe')](_0x127932[_0x29cf77[_0x9a5c('0xc')]][_0x9a5c('0xd')],_0x9a5c('0xf'));}else if(!_[_0x9a5c('0xb')](_0x29cf77[_0x9a5c('0xf')])){_0x1205e3=[_0x29cf77[_0x9a5c('0xf')]];}return _0x1205e3;}exports['listen']=function(_0x44da1b){_0x44da1b[_0x9a5c('0x10')]={};return new BPromise(function(_0x2b1cef,_0x4fdcdc){var _0x320725={'Start':function(_0x1f008e){var _0x5d5f74=this;return new Promise(function(_0x16422d,_0x5ef98e){if(_0x1f008e){try{var _0x350bd5=[];var _0x507a12=getId(_0x1f008e[_0x9a5c('0x11')],_0x1f008e[_0x9a5c('0x12')]?_0x1f008e['message']['id']:0x0,_0x1f008e[_0x9a5c('0x13')]?_0x1f008e[_0x9a5c('0x13')]['id']:0x0);var _0x39fbea=sUtils['checkWaitingNotifications'](_0x44da1b,_0x1f008e);if(_0x1f008e[_0x9a5c('0x14')]||!_0x39fbea&&_0x1f008e[_0x9a5c('0x15')]&&_[_0x9a5c('0x16')](_0x1f008e['applications'])&&_0x1f008e[_0x9a5c('0x15')][_0x9a5c('0x17')]){for(var _0x4a7627=0x0;_0x4a7627<_0x1f008e[_0x9a5c('0x15')][_0x9a5c('0x17')];_0x4a7627+=0x1){var _0xe42960=_0x1f008e['applications'][_0x4a7627];if(fs[_0x9a5c('0x18')](path[_0x9a5c('0x19')](__dirname,'applications',_0xe42960[_0x9a5c('0x1a')]+_0x9a5c('0x1b')))){var _0x5659b4=[];switch(_0xe42960[_0x9a5c('0x1a')][_0x9a5c('0x1c')]()){case _0x9a5c('0x1d'):var _0x5719eb=_0xe42960[_0x9a5c('0x1e')][_0x9a5c('0x1f')](',');if(_0x1f008e[_0x9a5c('0x11')]===_0x9a5c('0x20')){_0x5659b4[_0x9a5c('0x21')](_0x5719eb[0x0]);_0x5659b4[_0x9a5c('0x21')](_0x5719eb[0x1]);_0x5659b4['push'](_0x5719eb['slice'](0x2,_0x5719eb[_0x9a5c('0x17')])[_0x9a5c('0x19')](','));}else{_0x5659b4[_0x9a5c('0x21')](_0x5719eb[0x0]);_0x5659b4[_0x9a5c('0x21')](_0x5719eb['slice'](0x1,_0x5719eb[_0x9a5c('0x17')])[_0x9a5c('0x19')](','));}break;case _0x9a5c('0x22'):var _0x4119f7=_0xe42960[_0x9a5c('0x1e')][_0x9a5c('0x1f')](',');_0x5659b4[_0x9a5c('0x21')](_0x4119f7[0x0]);_0x5659b4[_0x9a5c('0x21')](_0x4119f7[0x1]);_0x5659b4[_0x9a5c('0x21')](_0x4119f7['slice'](0x2,_0x4119f7[_0x9a5c('0x17')])['join'](','));break;case'dialogflowv2':var _0x4f43eb=_0xe42960[_0x9a5c('0x1e')][_0x9a5c('0x1f')](',');_0x5659b4[_0x9a5c('0x21')](_0x4f43eb[0x0]);_0x5659b4[_0x9a5c('0x21')](_0x4f43eb[0x1]);_0x5659b4[_0x9a5c('0x21')](_0x4f43eb[0x2]);_0x5659b4[_0x9a5c('0x21')](_0x4f43eb[0x3]);_0x5659b4['push'](_0x4f43eb[_0x9a5c('0x23')](0x4,_0x4f43eb[_0x9a5c('0x17')])[_0x9a5c('0x19')](','));break;case'amazonlex':var _0x39945c=_0xe42960[_0x9a5c('0x1e')][_0x9a5c('0x1f')](',');_0x5659b4[_0x9a5c('0x21')](_0x39945c[0x0]);_0x5659b4['push'](_0x39945c[0x1]);_0x5659b4[_0x9a5c('0x21')](_0x39945c[0x2]);_0x5659b4['push'](_0x39945c[0x3]);_0x5659b4[_0x9a5c('0x21')](_0x39945c['slice'](0x4,_0x39945c[_0x9a5c('0x17')])[_0x9a5c('0x19')](','));break;case _0x9a5c('0x12'):_0x5659b4[_0x9a5c('0x21')](_0xe42960[_0x9a5c('0x1e')]);break;case _0x9a5c('0x24'):_0x5659b4['push'](_0xe42960[_0x9a5c('0x25')]);_0x5659b4[_0x9a5c('0x21')](_0xe42960[_0x9a5c('0x1e')]);break;case _0x9a5c('0x26'):var _0x56daeb=utils[_0x9a5c('0x27')](_0x1f008e[_0x9a5c('0x28')]['notificationTemplate'],_0x1f008e);var _0x2329ba=_0xe42960[_0x9a5c('0x1e')]['split'](',');_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x0]);_0x5659b4['push'](_0x2329ba[0x1]);_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x2]);_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x3]);_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x4]);_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x5]);_0x5659b4[_0x9a5c('0x21')](_0x2329ba[0x6]);_0x5659b4['push'](_0x2329ba[0x7]);_0x5659b4['push'](_0x2329ba[0x8]);_0x5659b4['push'](_0x2329ba[0x9]);_0x5659b4['push'](_0x2329ba[0xa]);_0x5659b4[_0x9a5c('0x21')](_0x1f008e[_0x9a5c('0x13')]['id']);_0x5659b4[_0x9a5c('0x21')](_0x1f008e[_0x9a5c('0x12')]['id']);_0x5659b4[_0x9a5c('0x21')](_0xe42960[_0x9a5c('0x29')]);_0x5659b4[_0x9a5c('0x21')](_0x1f008e[_0x9a5c('0x13')][_0x9a5c('0x2a')]);_0x5659b4[_0x9a5c('0x21')](_0x1f008e[_0x9a5c('0x2b')]['body']);_0x5659b4[_0x9a5c('0x21')](_0x56daeb);break;default:_0x5659b4=_[_0x9a5c('0xb')](_0xe42960[_0x9a5c('0x1e')])?[]:_0xe42960[_0x9a5c('0x1e')]['split'](',');}var _0x4217c4={'id':util[_0x9a5c('0xa')]('%s:%s:%s',_0x507a12,_0xe42960['id'],_0xe42960[_0x9a5c('0x1a')]),'condition':require(_0x9a5c('0x2c'))[_0x9a5c('0x2d')](_0x507a12,getIntervals(_0x44da1b[_0x9a5c('0x2e')],_0xe42960),_0x44da1b),'consequence':require(_0x9a5c('0x2f')+_0xe42960[_0x9a5c('0x1a')])[_0x9a5c('0x30')](_0x507a12,_0x5659b4,_0x44da1b,_0x1f008e),'p':_0xe42960[_0x9a5c('0x31')]||0x0};logger[_0x9a5c('0x32')](_0x9a5c('0x33'),_0x4217c4['id'],'on\x20interval',getIntervals(_0x44da1b['intervals'],_0xe42960)[_0x9a5c('0x19')](_0x9a5c('0x34')));_0x350bd5[_0x9a5c('0x21')](_0x4217c4);}else{logger[_0x9a5c('0x35')](_0x9a5c('0x36'),path[_0x9a5c('0x19')](__dirname,_0x9a5c('0x15'),_0xe42960[_0x9a5c('0x1a')]+_0x9a5c('0x1b')));}}_0x44da1b[_0x9a5c('0x10')][_0x507a12]=new RuleEngine(_0x350bd5);_0x44da1b[_0x9a5c('0x10')][_0x507a12][_0x9a5c('0x37')](_0x1f008e,function(_0x5bcf65){logger['info'](_0x9a5c('0x38'),JSON[_0x9a5c('0x39')](_0x5bcf65['matchPath']));if(_0x44da1b[_0x9a5c('0x10')][_0x507a12]){_0x44da1b[_0x9a5c('0x10')][_0x507a12]['emit']('complete');}});return _0x16422d({'code':0xc8,'message':_0x1f008e});}else{if(_0x39fbea){logger['info'](util[_0x9a5c('0xa')]('Skipped\x20routing\x20for\x20%s',_0x507a12));}else{logger[_0x9a5c('0x32')](_0x9a5c('0x3a'));}return _0x16422d({'code':0xc8,'message':_0x1f008e});}}catch(_0x57864e){logger[_0x9a5c('0x35')](_0x57864e[_0x9a5c('0x3b')]);return _0x5ef98e(_0x5d5f74['error'](0x1f4,_0x57864e));}}return _0x5ef98e(_0x9a5c('0x3c'));});},'AcceptMessage':function(_0x40d0d4){var _0x494ccf=this;return new Promise(function(_0x4d27c5,_0x243c2a){if(_0x40d0d4[_0x9a5c('0x3d')]&&_0x40d0d4[_0x9a5c('0x3d')]['id']){if(_0x44da1b['agents'][_0x40d0d4[_0x9a5c('0x3d')]['id']]){_0x44da1b[_0x9a5c('0x3e')][_0x40d0d4[_0x9a5c('0x3d')]['id']][_0x9a5c('0x3f')]=![];_0x44da1b['agents'][_0x40d0d4[_0x9a5c('0x3d')]['id']][_0x9a5c('0x40')]=undefined;}}if(_0x40d0d4['message']&&_0x40d0d4[_0x9a5c('0x12')]['id']){try{var _0x932af5=getId(_0x40d0d4[_0x9a5c('0x11')],_0x40d0d4[_0x9a5c('0x12')]?_0x40d0d4[_0x9a5c('0x12')]['id']:0x0,_0x40d0d4[_0x9a5c('0x13')]?_0x40d0d4[_0x9a5c('0x13')]['id']:0x0);if(_0x44da1b['rules'][_0x932af5]){_0x44da1b[_0x9a5c('0x10')][_0x932af5]['emit'](_0x9a5c('0x41'));if(rpc[_0x40d0d4['channel']+_0x9a5c('0x42')]){rpc[_0x40d0d4[_0x9a5c('0x11')]+'QueueReport'][_0x9a5c('0x43')](_0x932af5,{'UserId':_0x40d0d4['message']['UserId']})[_0x9a5c('0x44')](function(){logger[_0x9a5c('0x35')](_0x9a5c('0x45'));});}}return _0x4d27c5({'code':0xc8,'message':_0x40d0d4});}catch(_0x5b9f51){logger[_0x9a5c('0x35')](_0x5b9f51[_0x9a5c('0x3b')]);return _0x243c2a(_0x494ccf[_0x9a5c('0x35')](0x1f4,_0x5b9f51));}}logger[_0x9a5c('0x35')](_0x9a5c('0x46'));return _0x243c2a(_0x494ccf[_0x9a5c('0x35')](0x1f4,_0x9a5c('0x46')));});},'RejectMessage':function(_0x40665c){var _0x795632=this;return new Promise(function(_0x730c28,_0x539e45){if(_0x40665c['agent']&&_0x40665c[_0x9a5c('0x3d')]['id']){try{if(_0x44da1b[_0x9a5c('0x3e')][_0x40665c[_0x9a5c('0x3d')]['id']]){_0x44da1b[_0x9a5c('0x3e')][_0x40665c['agent']['id']]['busy']=![];_0x44da1b[_0x9a5c('0x3e')][_0x40665c[_0x9a5c('0x3d')]['id']][_0x9a5c('0x40')]=undefined;}return _0x730c28({'code':0xc8,'message':_0x40665c});}catch(_0x33077d){logger['error'](_0x33077d[_0x9a5c('0x3b')]);return _0x539e45(_0x795632[_0x9a5c('0x35')](0x1f4,_0x33077d));}}logger['error'](_0x9a5c('0x46'));return _0x539e45(_0x795632[_0x9a5c('0x35')](0x1f4,_0x9a5c('0x46')));});},'AbandonInteraction':function(_0x32d852){var _0x57f1b3=this;return new Promise(function(_0x539c49,_0x5176c3){if(_0x32d852[_0x9a5c('0x11')]&&_0x32d852[_0x9a5c('0x13')]&&_0x32d852['interaction']['id']){try{var _0x40b041=getId(_0x32d852[_0x9a5c('0x11')],_0x32d852[_0x9a5c('0x12')]?_0x32d852['message']['id']:0x0,_0x32d852[_0x9a5c('0x13')]?_0x32d852[_0x9a5c('0x13')]['id']:0x0);if(_0x44da1b[_0x9a5c('0x10')][_0x40b041]){_0x44da1b[_0x9a5c('0x10')][_0x40b041][_0x9a5c('0x47')](_0x9a5c('0x41'));}return _0x539c49({'code':0xc8,'message':_0x32d852});}catch(_0x522ccc){logger[_0x9a5c('0x35')](_0x522ccc[_0x9a5c('0x3b')]);return _0x5176c3(_0x57f1b3[_0x9a5c('0x35')](0x1f4,_0x522ccc));}}logger[_0x9a5c('0x35')](_0x9a5c('0x46'));return _0x5176c3(_0x57f1b3[_0x9a5c('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x757886){var _0x451419=this;return new Promise(function(_0x2c1990,_0x11a447){if(_0x44da1b['agents'][_0x9a5c('0x48')](_0x757886['id'])){for(var _0x2af8fc in _0x757886[_0x9a5c('0x49')]){if(_0x757886[_0x9a5c('0x49')][_0x9a5c('0x48')](_0x2af8fc)){if(_0x44da1b['agents'][_0x757886['id']][_0x9a5c('0x48')](_0x2af8fc+_0x9a5c('0x4a'))){_0x44da1b[_0x9a5c('0x3e')][_0x757886['id']][_0x2af8fc+_0x9a5c('0x4a')]=parseInt(_0x757886[_0x9a5c('0x49')][_0x2af8fc],0xa);}}}_0x44da1b[_0x9a5c('0x3e')][_0x757886['id']][_0x9a5c('0x4b')]();return _0x2c1990({'code':0xc8,'message':_0x44da1b[_0x9a5c('0x3e')][_0x757886['id']]});}else{return _0x11a447(_0x451419['error'](0x1f4,_0x9a5c('0x4c')));}});},'Agents':function(_0x339c49){return new Promise(function(_0x56107c){var _0xf5c4c6=_['values'](_0x44da1b[_0x9a5c('0x3e')]);if(_0x339c49&&_0x339c49['id']){var _0x56a295=_[_0x9a5c('0x4d')](_0xf5c4c6,function(_0x4514d0){return _0x4514d0['id']===_0x339c49['id'];});_0x56107c(_0x56a295);}else{_0x56107c({'count':_0xf5c4c6['length'],'rows':_0xf5c4c6});}});},'ChatQueues':function(){return new Promise(function(_0x387aa3){var _0x13419e=[];for(var _0x215b33 in _0x44da1b[_0x9a5c('0x4e')]){if(_0x44da1b[_0x9a5c('0x4e')][_0x9a5c('0x48')](_0x215b33)){var _0xfca83b=_0x44da1b[_0x9a5c('0x4e')][_0x215b33];var _0x3fcc0c={'id':_0xfca83b['id'],'available':_0xfca83b[_0x9a5c('0x4f')],'loggedIn':_0xfca83b[_0x9a5c('0x50')],'name':_0xfca83b[_0x9a5c('0x51')],'paused':_0xfca83b['paused'],'waiting':_0xfca83b[_0x9a5c('0x52')]};_0x13419e[_0x9a5c('0x21')](_0x3fcc0c);}}_0x387aa3({'count':_0x13419e[_0x9a5c('0x17')],'rows':_0x13419e});});},'MailQueues':function(){return new Promise(function(_0x3b3424){var _0x1e1898=[];for(var _0x44d8b4 in _0x44da1b[_0x9a5c('0x53')]){if(_0x44da1b[_0x9a5c('0x53')][_0x9a5c('0x48')](_0x44d8b4)){var _0x288267=_0x44da1b[_0x9a5c('0x53')][_0x44d8b4];var _0xc82775={'id':_0x288267['id'],'available':_0x288267['available'],'loggedIn':_0x288267[_0x9a5c('0x50')],'name':_0x288267[_0x9a5c('0x51')],'paused':_0x288267['paused'],'waiting':_0x288267[_0x9a5c('0x52')]};_0x1e1898['push'](_0xc82775);}}_0x3b3424({'count':_0x1e1898[_0x9a5c('0x17')],'rows':_0x1e1898});});},'OpenchannelQueues':function(){return new Promise(function(_0x1dcf64){var _0x3d2a0a=[];for(var _0x33d2f5 in _0x44da1b[_0x9a5c('0x54')]){if(_0x44da1b['openchannelQueues'][_0x9a5c('0x48')](_0x33d2f5)){var _0x203b2f=_0x44da1b[_0x9a5c('0x54')][_0x33d2f5];var _0x2c1dc3={'id':_0x203b2f['id'],'available':_0x203b2f[_0x9a5c('0x4f')],'loggedIn':_0x203b2f[_0x9a5c('0x50')],'name':_0x203b2f['name'],'paused':_0x203b2f[_0x9a5c('0x55')],'waiting':_0x203b2f[_0x9a5c('0x52')]};_0x3d2a0a[_0x9a5c('0x21')](_0x2c1dc3);}}_0x1dcf64({'count':_0x3d2a0a['length'],'rows':_0x3d2a0a});});},'SmsQueues':function(){return new Promise(function(_0x255dc3){var _0x52d865=[];for(var _0x2143c5 in _0x44da1b['smsQueues']){if(_0x44da1b[_0x9a5c('0x56')]['hasOwnProperty'](_0x2143c5)){var _0x423b93=_0x44da1b[_0x9a5c('0x56')][_0x2143c5];var _0x53cf09={'id':_0x423b93['id'],'available':_0x423b93[_0x9a5c('0x4f')],'loggedIn':_0x423b93[_0x9a5c('0x50')],'name':_0x423b93['name'],'paused':_0x423b93[_0x9a5c('0x55')],'waiting':_0x423b93[_0x9a5c('0x52')]};_0x52d865['push'](_0x53cf09);}}_0x255dc3({'count':_0x52d865[_0x9a5c('0x17')],'rows':_0x52d865});});},'FaxQueues':function(){return new Promise(function(_0x49a949){var _0x704f86=[];for(var _0xf14152 in _0x44da1b[_0x9a5c('0x57')]){if(_0x44da1b[_0x9a5c('0x57')][_0x9a5c('0x48')](_0xf14152)){var _0x2d8452=_0x44da1b[_0x9a5c('0x57')][_0xf14152];var _0x3370a1={'id':_0x2d8452['id'],'available':_0x2d8452[_0x9a5c('0x4f')],'loggedIn':_0x2d8452[_0x9a5c('0x50')],'name':_0x2d8452['name'],'paused':_0x2d8452[_0x9a5c('0x55')],'waiting':_0x2d8452[_0x9a5c('0x52')]};_0x704f86[_0x9a5c('0x21')](_0x3370a1);}}_0x49a949({'count':_0x704f86[_0x9a5c('0x17')],'rows':_0x704f86});});},'WhatsappQueues':function(){return new Promise(function(_0x187e09){var _0x2a16c4=[];for(var _0x18e204 in _0x44da1b[_0x9a5c('0x58')]){if(_0x44da1b[_0x9a5c('0x58')]['hasOwnProperty'](_0x18e204)){var _0x57be0a=_0x44da1b[_0x9a5c('0x58')][_0x18e204];var _0x487ee3={'id':_0x57be0a['id'],'available':_0x57be0a['available'],'loggedIn':_0x57be0a[_0x9a5c('0x50')],'name':_0x57be0a[_0x9a5c('0x51')],'paused':_0x57be0a[_0x9a5c('0x55')],'waiting':_0x57be0a[_0x9a5c('0x52')]};_0x2a16c4[_0x9a5c('0x21')](_0x487ee3);}}_0x187e09({'count':_0x2a16c4[_0x9a5c('0x17')],'rows':_0x2a16c4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x718715){var _0x210368=_[_0x9a5c('0x59')](_0x44da1b[_0x9a5c('0x5a')]);_0x718715({'count':_0x210368['length'],'rows':_0x210368});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5dac8d){var _0x1fb3ff=_[_0x9a5c('0x59')](_0x44da1b[_0x9a5c('0x5b')]);_0x5dac8d({'count':_0x1fb3ff['length'],'rows':_0x1fb3ff});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xbbdd16){var _0x1e71c5=_['values'](_0x44da1b[_0x9a5c('0x5c')]);_0xbbdd16({'count':_0x1e71c5['length'],'rows':_0x1e71c5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2f8897){var _0x3cc0bc=_['values'](_0x44da1b[_0x9a5c('0x5d')]);_0x2f8897({'count':_0x3cc0bc[_0x9a5c('0x17')],'rows':_0x3cc0bc});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2366ae){var _0x262496=_['values'](_0x44da1b[_0x9a5c('0x5e')]);_0x2366ae({'count':_0x262496[_0x9a5c('0x17')],'rows':_0x262496});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x46e438){var _0x4a0f9d=_['values'](_0x44da1b[_0x9a5c('0x5f')]);_0x46e438({'count':_0x4a0f9d['length'],'rows':_0x4a0f9d});});}};var _0x497c78=jayson['server'](_0x320725)[_0x9a5c('0x60')]();_0x497c78['on'](_0x9a5c('0x35'),function(_0x11b8fd){logger[_0x9a5c('0x35')](JSON[_0x9a5c('0x39')](_0x11b8fd));return _0x4fdcdc(_0x11b8fd);});_0x497c78[_0x9a5c('0x61')](0x232c,_0x9a5c('0x62'),function(){console[_0x9a5c('0x63')](_0x9a5c('0x64'),0x232c);return _0x2b1cef(_0x9a5c('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 0b427f6..7a0e4fe 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 _0x536c=['Command','format','iftime\x20%s','indexOf','true','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x331937,_0x2c5627){var _0x58aba2=function(_0x54eb75){while(--_0x54eb75){_0x331937['push'](_0x331937['shift']());}};_0x58aba2(++_0x2c5627);}(_0x536c,0x84));var _0xc536=function(_0x485d7b,_0x3f3b52){_0x485d7b=_0x485d7b-0x0;var _0x899877=_0x536c[_0x485d7b];return _0x899877;};'use strict';var util=require(_0xc536('0x0'));var BPromise=require(_0xc536('0x1'));var jayson=require('jayson/promise');var _=require(_0xc536('0x2'));var logger=require(_0xc536('0x3'))(_0xc536('0x4'));var client=jayson[_0xc536('0x5')][_0xc536('0x6')]({'port':0x232a});function request(_0x1d1156,_0x3afc81){return new BPromise(function(_0x58abcd,_0x3cb512){return client[_0xc536('0x7')](_0x1d1156,_0x3afc81)[_0xc536('0x8')](function(_0x44dad7){if(_0x44dad7[_0xc536('0x9')]){return _0x3cb512(_0x44dad7[_0xc536('0x9')][_0xc536('0xa')]);}else{return _0x58abcd(_0x44dad7['result']);}})[_0xc536('0xb')](function(_0x2d67b8){return _0x3cb512(_0x2d67b8);});});}exports['condition']=function(_0x5efc92,_0x58d826,_0x444598){return function(_0x3b0a97){if(_0x444598[_0xc536('0xc')]&&!_0x444598[_0xc536('0xc')][_0x5efc92]){logger[_0xc536('0xd')](_0xc536('0xe'),_0x5efc92);return _0x3b0a97[_0xc536('0xf')]();}var _0x399b5d=[];for(var _0x4bcb47=0x0;_0x4bcb47<_0x58d826[_0xc536('0x10')];_0x4bcb47+=0x1){_0x399b5d[_0xc536('0x11')](request(_0xc536('0x12'),{'command':util[_0xc536('0x13')](_0xc536('0x14'),_0x58d826[_0x4bcb47])})[_0xc536('0x8')](function(_0x2e62ae){return _0x2e62ae&&_0x2e62ae[_0xc536('0xa')]&&_0x2e62ae[_0xc536('0xa')][_0xc536('0x15')](_0xc536('0x16'))>=0x0?!![]:![];})[_0xc536('0xb')](function(){logger[_0xc536('0x9')]('[%s][INTERVAL]\x20%s',_0x5efc92,_0x58d826[_0x4bcb47]);}));}BPromise[_0xc536('0x17')](_0x399b5d)['then'](function(_0x52270b){var _0x468fe7=_[_0xc536('0x18')](_0x52270b);logger[_0xc536('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x5efc92,_0x58d826[_0xc536('0x19')](_0xc536('0x1a')),_0x468fe7);_0x3b0a97[_0xc536('0x1b')](_0x468fe7);})['catch'](function(_0x2bbc11){logger[_0xc536('0x9')](_0xc536('0x1c'),_0x5efc92,_0x58d826[_0xc536('0x19')](_0xc536('0x1a')),_0x2bbc11[_0xc536('0x1d')]);_0x3b0a97[_0xc536('0xf')]();});};}; \ No newline at end of file +var _0x1b03=['condition','rules','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1b03,0xbf));var _0x31b0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1b03[_0x580576];return _0x3f55a0;};'use strict';var util=require(_0x31b0('0x0'));var BPromise=require(_0x31b0('0x1'));var jayson=require(_0x31b0('0x2'));var _=require(_0x31b0('0x3'));var logger=require(_0x31b0('0x4'))(_0x31b0('0x5'));var client=jayson[_0x31b0('0x6')]['http']({'port':0x232a});function request(_0x372946,_0x1e0fd5){return new BPromise(function(_0x31950f,_0x1f7da3){return client[_0x31b0('0x7')](_0x372946,_0x1e0fd5)[_0x31b0('0x8')](function(_0x4b43c9){if(_0x4b43c9[_0x31b0('0x9')]){return _0x1f7da3(_0x4b43c9[_0x31b0('0x9')][_0x31b0('0xa')]);}else{return _0x31950f(_0x4b43c9[_0x31b0('0xb')]);}})['catch'](function(_0x3f7759){return _0x1f7da3(_0x3f7759);});});}exports[_0x31b0('0xc')]=function(_0x4ec4b1,_0x1c1925,_0xe5ab4d){return function(_0xe61f4f){if(_0xe5ab4d[_0x31b0('0xd')]&&!_0xe5ab4d[_0x31b0('0xd')][_0x4ec4b1]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4ec4b1);return _0xe61f4f['stop']();}var _0x165a14=[];for(var _0x561b9f=0x0;_0x561b9f<_0x1c1925['length'];_0x561b9f+=0x1){_0x165a14[_0x31b0('0xe')](request('Command',{'command':util[_0x31b0('0xf')](_0x31b0('0x10'),_0x1c1925[_0x561b9f])})['then'](function(_0x1e4b54){return _0x1e4b54&&_0x1e4b54[_0x31b0('0xa')]&&_0x1e4b54[_0x31b0('0xa')][_0x31b0('0x11')](_0x31b0('0x12'))>=0x0?!![]:![];})['catch'](function(){logger['error'](_0x31b0('0x13'),_0x4ec4b1,_0x1c1925[_0x561b9f]);}));}BPromise['all'](_0x165a14)[_0x31b0('0x8')](function(_0x13b75b){var _0x3f9462=_[_0x31b0('0x14')](_0x13b75b);logger[_0x31b0('0x15')](_0x31b0('0x16'),_0x4ec4b1,_0x1c1925[_0x31b0('0x17')](_0x31b0('0x18')),_0x3f9462);_0xe61f4f[_0x31b0('0x19')](_0x3f9462);})[_0x31b0('0x1a')](function(_0x8db5b){logger[_0x31b0('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x4ec4b1,_0x1c1925[_0x31b0('0x17')](_0x31b0('0x18')),_0x8db5b[_0x31b0('0x1b')]);_0xe61f4f[_0x31b0('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5719e1a..02eab38 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 _0xc788=['transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type','agentcomplete','acwtime','agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten'];(function(_0x5de434,_0x9880c6){var _0x437efc=function(_0x1ba0ae){while(--_0x1ba0ae){_0x5de434['push'](_0x5de434['shift']());}};_0x437efc(++_0x9880c6);}(_0xc788,0xc4));var _0x8c78=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0xc788[_0x324496];return _0x899545;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require(_0x8c78('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4ecb26,_0x4ce125){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x5'),_0x4ecb26[_0x8c78('0x6')],_0x4ecb26[_0x8c78('0x7')],_0x4ecb26['queue'],_0x4ecb26[_0x8c78('0x8')],_0x4ecb26[_0x8c78('0x9')],_0x4ecb26[_0x8c78('0xa')],_0x4ecb26[_0x8c78('0xb')],_0x4ecb26[_0x8c78('0xc')]));if(_0x4ecb26['queue']){utils[_0x8c78('0xd')](_0x4ecb26[_0x8c78('0xe')])[_0x8c78('0xf')](function(_0x39c0e5){if(_0x39c0e5){_0x4ecb26[_0x8c78('0x10')]=_0x39c0e5[_0x8c78('0x10')];_0x4ecb26['agentacw']=_0x4ecb26[_0x8c78('0x11')]?_0x39c0e5['acw']:![];_0x4ecb26[_0x8c78('0x12')]=_0x4ecb26[_0x8c78('0x13')]?_0x39c0e5['acwTimeout']:0x0;}utils[_0x8c78('0x14')](_0x8c78('0x15'),_0x4ecb26);});}else{utils['request'](_0x8c78('0x15'),_0x4ecb26);}if(_0x4ce125){delete transfers[_0x4ecb26['uniqueid']];}else{delete agents[_0x4ecb26['destuniqueid']];}}exports[_0x8c78('0x16')]=function(_0x1b1d0e){try{utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x1b1d0e);agents[_0x1b1d0e[_0x8c78('0x19')]]=_0x1b1d0e;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xc')]=_0x8c78('0x1c');agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xb')]=null;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1d')]=null;utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x1e'),_0x1b1d0e['uniqueid'],agents[_0x1b1d0e['destuniqueid']][_0x8c78('0x8')],_0x1b1d0e['destuniqueid']));}catch(_0x56801a){utils[_0x8c78('0x1f')](util['format'](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x56801a);}};exports['agentringnoanswer']=function(_0x6c9a12){try{if(!_['isNil'](agents[_0x6c9a12[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util['format'](_0x8c78('0x20'),_0x6c9a12[_0x8c78('0x6')]),_0x6c9a12);utils['info'](util[_0x8c78('0x4')](_0x8c78('0x21'),_0x6c9a12[_0x8c78('0x6')],agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x8')],_0x6c9a12[_0x8c78('0x19')]));agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x22')]=!![];agents[_0x6c9a12[_0x8c78('0x19')]]['agentringnoanswerAt']=utils[_0x8c78('0x1b')]();agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0xc')]='timeout';agents[_0x6c9a12[_0x8c78('0x19')]]['reason']=_0x8c78('0x23');agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x24')]=_0x6c9a12['ringtime']?parseInt(_0x6c9a12[_0x8c78('0x25')])/0x3e8:0x0;agents[_0x6c9a12[_0x8c78('0x19')]]['talktime']=0x0;unanswered[_0x8c78('0x26')](_0x6c9a12[_0x8c78('0x19')]);}}catch(_0x394c1d){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x20'),_0x6c9a12['uniqueid']),_0x394c1d);}};exports[_0x8c78('0x27')]=function(_0x51add6){try{_[_0x8c78('0x28')](agents,function(_0x17f4c8,_0xb69c52){if(_0x17f4c8['uniqueid']==_0x51add6[_0x8c78('0x6')]&&!_[_0x8c78('0x29')](unanswered,_0x17f4c8['destuniqueid'])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6['uniqueid']),_0x51add6);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x2b'),_0x51add6['uniqueid'],_0x17f4c8[_0x8c78('0x8')],_0x17f4c8[_0x8c78('0x19')]));_0x17f4c8['agentringnoanswer']=!![];_0x17f4c8[_0x8c78('0x2c')]=utils[_0x8c78('0x1b')]();_0x17f4c8[_0x8c78('0xc')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x2e')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x24')]=_0x51add6[_0x8c78('0x24')];_0x17f4c8[_0x8c78('0x2f')]=0x0;writeDB(_0x17f4c8);}});}catch(_0x15a868){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6[_0x8c78('0x6')]),_0x15a868);}};exports[_0x8c78('0x30')]=function(_0x34481a){try{if(agents[_0x34481a['destuniqueid']]){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a['uniqueid']),_0x34481a);utils[_0x8c78('0x3')](util[_0x8c78('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34481a[_0x8c78('0x6')],agents[_0x34481a['destuniqueid']][_0x8c78('0x8')],_0x34481a[_0x8c78('0x19')]));agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x32')]=utils['now']();agents[_0x34481a[_0x8c78('0x19')]]['connectedlinenum']=_0x34481a[_0x8c78('0xb')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x1d')]=_0x34481a['connectedlinename'];agents[_0x34481a['destuniqueid']][_0x8c78('0x24')]=_0x34481a[_0x8c78('0x25')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x33');_[_0x8c78('0x28')](agents,function(_0x326b34,_0x314679){if(_0x326b34[_0x8c78('0x19')]!=_0x34481a[_0x8c78('0x19')]&&_0x326b34[_0x8c78('0x6')]==_0x34481a[_0x8c78('0x6')]){_0x326b34[_0x8c78('0x2f')]=0x0;_0x326b34['holdtime']=_0x34481a[_0x8c78('0x25')];_0x326b34[_0x8c78('0x22')]=!![];_0x326b34['agentringnoanswerAt']=utils['now']();_0x326b34[_0x8c78('0xc')]=_0x8c78('0x34');_0x326b34['reason']=_0x8c78('0x34');_0x326b34[_0x8c78('0x35')]=_0x34481a['destuniqueid'];_0x326b34[_0x8c78('0x36')]=_0x34481a[_0x8c78('0x8')];writeDB(_0x326b34);}});}}catch(_0x57e2c7){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a[_0x8c78('0x6')]),_0x57e2c7);}};exports[_0x8c78('0x11')]=function(_0x4e4880){try{if(!_['isNil'](agents[_0x4e4880[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x4e4880);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x38'),_0x4e4880[_0x8c78('0x6')],agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x8')],_0x4e4880['destuniqueid']));agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x11')]=!![];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();agents[_0x4e4880['destuniqueid']][_0x8c78('0x2f')]=utils[_0x8c78('0x3a')](agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')],agents[_0x4e4880[_0x8c78('0x19')]]['agentconnectAt']);agents[_0x4e4880[_0x8c78('0x19')]]['reason']=_0x4e4880['reason'];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x3b');writeDB(agents[_0x4e4880['destuniqueid']]);}}catch(_0x1d78a0){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x1d78a0);}};exports[_0x8c78('0x3c')]=function(_0x26103c){try{if(!_[_0x8c78('0x3d')](agents[_0x26103c[_0x8c78('0x3e')]])){utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x26103c);utils[_0x8c78('0x3')](util['format'](_0x8c78('0x40'),_0x26103c[_0x8c78('0x6')],agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x8')],agents[_0x26103c['transfereruniqueid']][_0x8c78('0x6')]));agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x41')]=!![];agents[_0x26103c['transfereruniqueid']][_0x8c78('0x42')]='blind';agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x43')]=_0x26103c[_0x8c78('0x44')];agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x45')]=agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x6')];}}catch(_0x38fec1){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x38fec1);}};exports[_0x8c78('0x46')]=function(_0x18d896){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x18d896);if(_0x18d896[_0x8c78('0x48')]==_0x18d896['origtransfererlinkedid']){if(!_[_0x8c78('0x3d')](agents[_0x18d896[_0x8c78('0x49')]])){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x4a'),_0x18d896[_0x8c78('0x48')],agents[_0x18d896['secondtransfereruniqueid']][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x49')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x49')]]['transfertype']=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x4c')];agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x48')];}if(_0x18d896['transfereeuniqueid']&&agents[_0x18d896[_0x8c78('0x4d')]]){agents[_0x18d896[_0x8c78('0x4d')]]['agententerreason']=0x1;transfers[_0x18d896[_0x8c78('0x4d')]]=_[_0x8c78('0x4e')](agents[_0x18d896['transfereeuniqueid']]);transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0xa')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x4f')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x24')]=0x0;transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x50')]=0x2;}}else if(_0x18d896['secondtransfereruniqueid']==_0x18d896['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x18d896[_0x8c78('0x48')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x18d896[_0x8c78('0x48')],agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x48')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x42')]=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x51')];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x49')];}if(_0x18d896[_0x8c78('0x52')]&&agents[_0x18d896[_0x8c78('0x52')]]){agents[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x1;transfers[_0x18d896[_0x8c78('0x52')]]=_['clone'](agents[_0x18d896[_0x8c78('0x52')]]);transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0xa')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x4f')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x52')]]['holdtime']=0x0;transfers[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x2;}}}catch(_0x1015e8){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x1015e8);}};exports[_0x8c78('0x53')]=function(_0x240f1e){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e[_0x8c78('0x6')]),_0x240f1e);if(agents[_0x240f1e[_0x8c78('0x6')]]&&agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]===_0x8c78('0x23')){if(_0x240f1e[_0x8c78('0x55')]==='21'){agents[_0x240f1e[_0x8c78('0x6')]]['reason']=_0x8c78('0x56');agents[_0x240f1e[_0x8c78('0x6')]]['lastevent']='rejected';}utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e['uniqueid']]['lastevent']));writeDB(agents[_0x240f1e[_0x8c78('0x6')]]);var _0x2d385f=unanswered[_0x8c78('0x58')](_0x240f1e[_0x8c78('0x6')]);if(_0x2d385f>-0x1){unanswered[_0x8c78('0x59')](_0x2d385f,0x1);}}if(transfers[_0x240f1e['uniqueid']]){transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();transfers[_0x240f1e[_0x8c78('0x6')]]['talktime']=utils[_0x8c78('0x3a')](transfers[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt'],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]=_0x8c78('0x5a');transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],transfers[_0x240f1e[_0x8c78('0x6')]]['lastevent']));writeDB(transfers[_0x240f1e[_0x8c78('0x6')]],!![]);}if(agents[_0x240f1e['uniqueid']]&&agents[_0x240f1e['uniqueid']][_0x8c78('0x32')]){agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];agents[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt']=utils[_0x8c78('0x1b')]();agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2f')]=utils['diffTime'](agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);agents[_0x240f1e['uniqueid']][_0x8c78('0x2e')]=agents[_0x240f1e[_0x8c78('0x6')]]['transfer']?'transfer':'agent';agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e['uniqueid'],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]));writeDB(agents[_0x240f1e['uniqueid']]);}}catch(_0x5c67c9){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e['uniqueid']),_0x5c67c9);}}; \ No newline at end of file +var _0x41bb=['transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','error','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind'];(function(_0x38a757,_0x5b435e){var _0x307068=function(_0x586334){while(--_0x586334){_0x38a757['push'](_0x38a757['shift']());}};_0x307068(++_0x5b435e);}(_0x41bb,0xc5));var _0xb41b=function(_0xd8a1e3,_0x32e80e){_0xd8a1e3=_0xd8a1e3-0x0;var _0x2b193a=_0x41bb[_0xd8a1e3];return _0x2b193a;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x428431,_0x4d5578){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x4'),_0x428431[_0xb41b('0x5')],_0x428431['channel'],_0x428431[_0xb41b('0x6')],_0x428431[_0xb41b('0x7')],_0x428431[_0xb41b('0x8')],_0x428431['calleridnum'],_0x428431['connectedlinenum'],_0x428431['lastevent']));if(_0x428431[_0xb41b('0x6')]){utils[_0xb41b('0x9')](_0x428431['queue'])[_0xb41b('0xa')](function(_0x2c1a53){if(_0x2c1a53){_0x428431[_0xb41b('0xb')]=_0x2c1a53[_0xb41b('0xb')];_0x428431[_0xb41b('0xc')]=_0x428431[_0xb41b('0xd')]?_0x2c1a53[_0xb41b('0xe')]:![];_0x428431['acwtime']=_0x428431[_0xb41b('0xc')]?_0x2c1a53['acwTimeout']:0x0;}utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);});}else{utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);}if(_0x4d5578){delete transfers[_0x428431[_0xb41b('0x5')]];}else{delete agents[_0x428431['destuniqueid']];}}exports[_0xb41b('0x11')]=function(_0x2d947a){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a['uniqueid']),_0x2d947a);agents[_0x2d947a['destuniqueid']]=_0x2d947a;agents[_0x2d947a['destuniqueid']][_0xb41b('0x14')]=utils[_0xb41b('0x15')]();agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x18');agents[_0x2d947a['destuniqueid']][_0xb41b('0x19')]=null;agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x1a')]=null;utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x1b'),_0x2d947a[_0xb41b('0x5')],agents[_0x2d947a['destuniqueid']]['membername'],_0x2d947a['destuniqueid']));}catch(_0xf109f8){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a[_0xb41b('0x5')]),_0xf109f8);}};exports['agentringnoanswer']=function(_0x53bc44){try{if(!_[_0xb41b('0x1c')](agents[_0x53bc44[_0xb41b('0x16')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x53bc44);utils['info'](util['format'](_0xb41b('0x1e'),_0x53bc44[_0xb41b('0x5')],agents[_0x53bc44[_0xb41b('0x16')]]['membername'],_0x53bc44[_0xb41b('0x16')]));agents[_0x53bc44[_0xb41b('0x16')]]['agentringnoanswer']=!![];agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x1f')]=utils['now']();agents[_0x53bc44[_0xb41b('0x16')]]['lastevent']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['reason']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['holdtime']=_0x53bc44['ringtime']?parseInt(_0x53bc44[_0xb41b('0x21')])/0x3e8:0x0;agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x22')]=0x0;unanswered[_0xb41b('0x23')](_0x53bc44[_0xb41b('0x16')]);}}catch(_0x181cbd){utils[_0xb41b('0x24')](util['format'](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x181cbd);}};exports['queuecallerabandon']=function(_0xe64568){try{_['forIn'](agents,function(_0x38277f,_0x31d4cd){if(_0x38277f['uniqueid']==_0xe64568[_0xb41b('0x5')]&&!_['includes'](unanswered,_0x38277f[_0xb41b('0x16')])){utils[_0xb41b('0x12')](util['format'](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0xe64568);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x26'),_0xe64568[_0xb41b('0x5')],_0x38277f[_0xb41b('0x7')],_0x38277f[_0xb41b('0x16')]));_0x38277f[_0xb41b('0x27')]=!![];_0x38277f[_0xb41b('0x1f')]=utils['now']();_0x38277f[_0xb41b('0x17')]='abandoned';_0x38277f['reason']=_0xb41b('0x28');_0x38277f[_0xb41b('0x29')]=_0xe64568[_0xb41b('0x29')];_0x38277f[_0xb41b('0x22')]=0x0;writeDB(_0x38277f);}});}catch(_0x1b8681){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0x1b8681);}};exports[_0xb41b('0x2a')]=function(_0x3a06a0){try{if(agents[_0x3a06a0['destuniqueid']]){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x2b'),_0x3a06a0[_0xb41b('0x5')]),_0x3a06a0);utils[_0xb41b('0x2')](util[_0xb41b('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a06a0['uniqueid'],agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x7')],_0x3a06a0['destuniqueid']));agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x2c')]=utils[_0xb41b('0x15')]();agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x19')]=_0x3a06a0['connectedlinenum'];agents[_0x3a06a0[_0xb41b('0x16')]]['connectedlinename']=_0x3a06a0[_0xb41b('0x1a')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x29')]=_0x3a06a0[_0xb41b('0x21')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x2d');_[_0xb41b('0x2e')](agents,function(_0x2b0721,_0x578b67){if(_0x2b0721['destuniqueid']!=_0x3a06a0['destuniqueid']&&_0x2b0721[_0xb41b('0x5')]==_0x3a06a0['uniqueid']){_0x2b0721['talktime']=0x0;_0x2b0721[_0xb41b('0x29')]=_0x3a06a0['ringtime'];_0x2b0721[_0xb41b('0x27')]=!![];_0x2b0721[_0xb41b('0x1f')]=utils[_0xb41b('0x15')]();_0x2b0721[_0xb41b('0x17')]=_0xb41b('0x2f');_0x2b0721[_0xb41b('0x30')]=_0xb41b('0x2f');_0x2b0721['answeredelsewheredestinationuniqueid']=_0x3a06a0[_0xb41b('0x16')];_0x2b0721[_0xb41b('0x31')]=_0x3a06a0[_0xb41b('0x7')];writeDB(_0x2b0721);}});}}catch(_0x174d6c){utils['error'](util[_0xb41b('0x3')]('[%s][agents][agentconnect]',_0x3a06a0[_0xb41b('0x5')]),_0x174d6c);}};exports[_0xb41b('0xd')]=function(_0x46dbbf){try{if(!_['isNil'](agents[_0x46dbbf['destuniqueid']])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x46dbbf);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x33'),_0x46dbbf['uniqueid'],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x7')],_0x46dbbf['destuniqueid']));agents[_0x46dbbf[_0xb41b('0x16')]]['agentcomplete']=!![];agents[_0x46dbbf[_0xb41b('0x16')]]['agentcompleteAt']=utils[_0xb41b('0x15')]();agents[_0x46dbbf['destuniqueid']][_0xb41b('0x22')]=utils[_0xb41b('0x34')](agents[_0x46dbbf[_0xb41b('0x16')]][_0xb41b('0x35')],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x2c')]);agents[_0x46dbbf[_0xb41b('0x16')]]['reason']=_0x46dbbf[_0xb41b('0x30')];agents[_0x46dbbf['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x46dbbf['destuniqueid']]);}}catch(_0x263d8d){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x263d8d);}};exports[_0xb41b('0x36')]=function(_0x34d076){try{if(!_[_0xb41b('0x1c')](agents[_0x34d076[_0xb41b('0x37')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x34d076);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x39'),_0x34d076['uniqueid'],agents[_0x34d076[_0xb41b('0x37')]]['membername'],agents[_0x34d076['transfereruniqueid']][_0xb41b('0x5')]));agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3a')]=!![];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3b')]=_0xb41b('0x3c');agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3d')]=_0x34d076[_0xb41b('0x3e')];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3f')]=agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x5')];}}catch(_0x3ce89e){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x3ce89e);}};exports[_0xb41b('0x40')]=function(_0x247ca0){try{utils[_0xb41b('0x12')](util['format'](_0xb41b('0x41'),_0x247ca0['origtransfereruniqueid']),_0x247ca0);if(_0x247ca0[_0xb41b('0x42')]==_0x247ca0[_0xb41b('0x43')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x44')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0['origtransfereruniqueid'],agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x7')]));agents[_0x247ca0[_0xb41b('0x44')]]['transfer']=!![];agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3b')]=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3d')]=_0x247ca0[_0xb41b('0x47')];agents[_0x247ca0[_0xb41b('0x44')]]['transferuniqueid']=_0x247ca0['origtransfereruniqueid'];}if(_0x247ca0[_0xb41b('0x48')]&&agents[_0x247ca0[_0xb41b('0x48')]]){agents[_0x247ca0['transfereeuniqueid']][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x48')]]=_['clone'](agents[_0x247ca0[_0xb41b('0x48')]]);transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4a')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4a')];transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x48')]]['agentcalledAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0[_0xb41b('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x29')]=0x0;transfers[_0x247ca0[_0xb41b('0x48')]]['agententerreason']=0x2;}}else if(_0x247ca0[_0xb41b('0x44')]==_0x247ca0[_0xb41b('0x4c')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x42')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0[_0xb41b('0x42')],agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x7')]));agents[_0x247ca0['origtransfereruniqueid']][_0xb41b('0x3a')]=!![];agents[_0x247ca0[_0xb41b('0x42')]]['transfertype']=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3d')]=_0x247ca0['secondtransfererexten'];agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3f')]=_0x247ca0[_0xb41b('0x44')];}if(_0x247ca0[_0xb41b('0x4d')]&&agents[_0x247ca0[_0xb41b('0x4d')]]){agents[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x4d')]]=_[_0xb41b('0x4e')](agents[_0x247ca0[_0xb41b('0x4d')]]);transfers[_0x247ca0['transfertargetuniqueid']]['calleridnum']=agents[_0x247ca0['origtransfereruniqueid']]['calleridnum'];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x14')]=utils['now']();transfers[_0x247ca0[_0xb41b('0x4d')]]['agentconnectAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x29')]=0x0;transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x49')]=0x2;}}}catch(_0xc2afd1){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x41'),_0x247ca0[_0xb41b('0x42')]),_0xc2afd1);}};exports[_0xb41b('0x4f')]=function(_0x39f6ad){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')]('[%s][agents][hangup]',_0x39f6ad[_0xb41b('0x5')]),_0x39f6ad);if(agents[_0x39f6ad['uniqueid']]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]===_0xb41b('0x20')){if(_0x39f6ad['cause']==='21'){agents[_0x39f6ad['uniqueid']]['reason']='rejected';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x50');}utils['info'](util['format'](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]]['lastevent']));writeDB(agents[_0x39f6ad['uniqueid']]);var _0x303ca3=unanswered[_0xb41b('0x52')](_0x39f6ad['uniqueid']);if(_0x303ca3>-0x1){unanswered[_0xb41b('0x53')](_0x303ca3,0x1);}}if(transfers[_0x39f6ad['uniqueid']]){transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];transfers[_0x39f6ad['uniqueid']][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();transfers[_0x39f6ad['uniqueid']]['talktime']=utils[_0xb41b('0x34')](transfers[_0x39f6ad[_0xb41b('0x5')]]['agentcompleteAt'],transfers[_0x39f6ad[_0xb41b('0x5')]]['agentconnectAt']);transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]='agent';transfers[_0x39f6ad['uniqueid']][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],transfers[_0x39f6ad['uniqueid']][_0xb41b('0x7')],transfers[_0x39f6ad['uniqueid']]['reason'],transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(transfers[_0x39f6ad[_0xb41b('0x5')]],!![]);}if(agents[_0x39f6ad[_0xb41b('0x5')]]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]){agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x22')]=utils['diffTime'](agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]);agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]=agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x3a')]?'transfer':'agent';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad['uniqueid'],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad['uniqueid']][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(agents[_0x39f6ad[_0xb41b('0x5')]]);}}catch(_0x31c5c1){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x55'),_0x39f6ad[_0xb41b('0x5')]),_0x31c5c1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 00e6b9f..e747f59 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 _0x5fa1=['format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','userfield','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED'];(function(_0x1aceb0,_0x57d860){var _0xc171f4=function(_0x1c0f16){while(--_0x1c0f16){_0x1aceb0['push'](_0x1aceb0['shift']());}};_0xc171f4(++_0x57d860);}(_0x5fa1,0x65));var _0x15fa=function(_0x1dadda,_0xba1088){_0x1dadda=_0x1dadda-0x0;var _0x10fa08=_0x5fa1[_0x1dadda];return _0x10fa08;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var utils=require(_0x15fa('0x2'));var dispositions=['NO\x20ANSWER',_0x15fa('0x3'),'FAILED',_0x15fa('0x4'),_0x15fa('0x4'),'NO\x20ANSWER',_0x15fa('0x5'),'BUSY','FAILED',_0x15fa('0x3'),_0x15fa('0x3')];var channels={};function writeDB(_0x1b1230){utils['info'](util[_0x15fa('0x6')](_0x15fa('0x7'),_0x1b1230['uniqueid'],_0x1b1230[_0x15fa('0x8')],_0x1b1230[_0x15fa('0x9')],_0x1b1230[_0x15fa('0xa')],_0x1b1230['interface'],_0x1b1230[_0x15fa('0xb')],_0x1b1230[_0x15fa('0xc')],_0x1b1230['lastevent']));if(_0x1b1230[_0x15fa('0xd')]){utils[_0x15fa('0xe')](_0x1b1230[_0x15fa('0xd')])[_0x15fa('0xf')](function(_0x5761f3){if(_0x5761f3){_0x1b1230[_0x15fa('0x10')]=_0x5761f3['id'];}utils['request']('CreateVoiceCallReport',_0x1b1230);});}else{utils[_0x15fa('0x11')](_0x15fa('0x12'),_0x1b1230);}if(channels[_0x1b1230[_0x15fa('0x13')]]){delete channels[_0x1b1230[_0x15fa('0x13')]];}}exports['newchannel']=function(_0x4c31bf){try{utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x15'),_0x4c31bf['uniqueid']),_0x4c31bf);if(_0x4c31bf[_0x15fa('0x13')]==_0x4c31bf['linkedid']&&_0x4c31bf[_0x15fa('0x8')]!=_0x15fa('0x16')){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x18'),_0x4c31bf[_0x15fa('0x13')],_0x4c31bf[_0x15fa('0x19')],_0x4c31bf['exten']));channels[_0x4c31bf[_0x15fa('0x13')]]={'uniqueid':_0x4c31bf[_0x15fa('0x13')],'accountcode':_0x4c31bf['accountcode'],'source':_0x4c31bf[_0x15fa('0xb')],'destination':_0x4c31bf['exten'],'destinationcontext':_0x4c31bf[_0x15fa('0x19')],'channel':_0x4c31bf[_0x15fa('0x8')],'starttime':utils[_0x15fa('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x15fa('0x4'),'amaflags':_0x15fa('0x1b')};}}catch(_0x5ed2c3){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x15'),_0x4c31bf[_0x15fa('0x13')]),_0x5ed2c3);}};exports[_0x15fa('0x1d')]=function(_0x169007){try{utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x1e'),_0x169007[_0x15fa('0x13')]),_0x169007);if(!_['isNil'](channels[_0x169007['uniqueid']])&&_0x169007[_0x15fa('0x1f')]==0x6){utils['info'](util[_0x15fa('0x6')](_0x15fa('0x20'),_0x169007[_0x15fa('0x13')],_0x169007[_0x15fa('0x19')],_0x169007[_0x15fa('0x8')]));if(_[_0x15fa('0x21')](channels[_0x169007[_0x15fa('0x13')]][_0x15fa('0x22')])){channels[_0x169007[_0x15fa('0x13')]]['systemanswertime']=utils[_0x15fa('0x1a')]();}}else if(!_['isNil'](channels[_0x169007['linkedid']])&&_0x169007[_0x15fa('0x1f')]==0x6&&_0x169007[_0x15fa('0x19')]!=_0x15fa('0x23')){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x24'),_0x169007['uniqueid'],_0x169007[_0x15fa('0x25')],_0x169007[_0x15fa('0x19')],_0x169007[_0x15fa('0x8')]));channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0xd')]=_0x169007[_0x15fa('0xd')];channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0x26')]=_0x169007[_0x15fa('0x8')];if(_['isNil'](channels[_0x169007['linkedid']][_0x15fa('0x27')])){channels[_0x169007['linkedid']]['answertime']=utils[_0x15fa('0x1a')]();}channels[_0x169007[_0x15fa('0x25')]][_0x15fa('0x28')]=dispositions[_['toNumber'](_0x169007[_0x15fa('0x1f')])]||_0x15fa('0x5');}}catch(_0x24e769){utils['error'](util[_0x15fa('0x6')](_0x15fa('0x1e'),_0x169007[_0x15fa('0x13')]),_0x24e769);}};exports['hangup']=function(_0x15a7c3){try{if(!_['isNil'](channels[_0x15a7c3['uniqueid']])){utils['debug'](util[_0x15fa('0x6')](_0x15fa('0x29'),_0x15a7c3[_0x15fa('0x13')]),_0x15a7c3);if(_['isNil'](channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')])){channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')]=_0x15a7c3[_0x15fa('0x2b')]+'\x20<'+_0x15a7c3['calleridnum']+'>';}utils[_0x15fa('0x17')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x15a7c3[_0x15fa('0x13')],channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2a')],_0x15a7c3[_0x15fa('0x2c')]));channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2d')]=utils[_0x15fa('0x1a')]();channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2e')]=utils[_0x15fa('0x2f')](channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x2d')],channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x30')]);channels[_0x15a7c3[_0x15fa('0x13')]]['billableseconds']=channels[_0x15a7c3[_0x15fa('0x13')]][_0x15fa('0x27')]?utils[_0x15fa('0x2f')](channels[_0x15a7c3[_0x15fa('0x13')]]['endtime'],channels[_0x15a7c3[_0x15fa('0x13')]]['answertime']):0x0;writeDB(channels[_0x15a7c3[_0x15fa('0x13')]]);}}catch(_0x337151){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x29'),_0x15a7c3[_0x15fa('0x13')]),_0x337151);}};exports[_0x15fa('0x31')]=function(_0x5c64d9){try{if(!_[_0x15fa('0x21')](channels[_0x5c64d9[_0x15fa('0x32')]])){utils['debug'](util[_0x15fa('0x6')]('[%s][calls][attendedtransfer]',_0x5c64d9[_0x15fa('0x33')]),_0x5c64d9);if(channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x8')]==_0x5c64d9['transfereechannel']){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5c64d9[_0x15fa('0x33')],_0x5c64d9['localtwolinkedid'],_0x5c64d9[_0x15fa('0x34')]));channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x26')]=_0x5c64d9[_0x15fa('0x34')];channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x35')]='_attended';}else if(channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x8')]=_0x5c64d9['transfertargetchannel']){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x36'),_0x5c64d9[_0x15fa('0x33')],_0x5c64d9[_0x15fa('0x32')],_0x5c64d9[_0x15fa('0x37')]));channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x26')]=_0x5c64d9[_0x15fa('0x37')];channels[_0x5c64d9[_0x15fa('0x32')]][_0x15fa('0x35')]=_0x15fa('0x38');}}}catch(_0x226bc6){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x39'),_0x5c64d9['origtransfereruniqueid']),_0x226bc6);}};exports[_0x15fa('0x3a')]=function(_0x5b5132){try{if(!_['isNil'](channels[_0x5b5132[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util['format'](_0x15fa('0x3b'),_0x5b5132[_0x15fa('0x13')]),_0x5b5132);channels[_0x5b5132['uniqueid']]['musiconholdstartAt']=utils[_0x15fa('0x1a')]();utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x3c'),_0x5b5132[_0x15fa('0x13')],channels[_0x5b5132[_0x15fa('0x13')]][_0x15fa('0x3d')]));}}catch(_0x44ac4b){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x3b'),_0x5b5132[_0x15fa('0x13')]),_0x44ac4b);}};exports[_0x15fa('0x3e')]=function(_0x2c404c){try{if(!_[_0x15fa('0x21')](channels[_0x2c404c[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x3f'),_0x2c404c['uniqueid']),_0x2c404c);if(!_[_0x15fa('0x21')](channels[_0x2c404c[_0x15fa('0x13')]]['musiconholdstartAt'])){channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x40')]+=utils[_0x15fa('0x2f')](utils[_0x15fa('0x1a')](),channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x3d')]);utils[_0x15fa('0x17')](util['format'](_0x15fa('0x41'),_0x2c404c['uniqueid'],channels[_0x2c404c[_0x15fa('0x13')]]['mohtime']));delete channels[_0x2c404c[_0x15fa('0x13')]][_0x15fa('0x3d')];}}}catch(_0x1a1115){utils[_0x15fa('0x1c')](util['format']('[%s][calls][musiconholdstop]',_0x2c404c[_0x15fa('0x13')]),_0x1a1115);}};exports[_0x15fa('0x42')]=function(_0x2fa8d7){try{if(!_[_0x15fa('0x21')](channels[_0x2fa8d7[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')](_0x15fa('0x43'),_0x2fa8d7[_0x15fa('0x13')]),_0x2fa8d7);if(!_['isNil'](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x45')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x46'),_0x2fa8d7['uniqueid'],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x48')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_[_0x15fa('0x21')](_0x2fa8d7['variable'][_0x15fa('0x49')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x4a'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7['uniqueid']][_0x15fa('0x4b')]=_0x2fa8d7[_0x15fa('0x47')];channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x2a')]='\x22'+_0x2fa8d7[_0x15fa('0x47')]+_0x15fa('0x4c')+_0x2fa8d7[_0x15fa('0x47')]+'>';}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4d')])||!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['xmd-callerid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2fa8d7[_0x15fa('0x13')],!_['isNil'](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4d')])?_0x15fa('0x4d'):_0x15fa('0x4e'),_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x2a')]=_0x2fa8d7['value'];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4f')])||!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x50')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2fa8d7['uniqueid'],!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x4f')])?'xmd-queue':_0x15fa('0x50'),_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7['uniqueid']][_0x15fa('0x51')]=_0x15fa('0x52');channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x53')]=_0x2fa8d7[_0x15fa('0x47')];channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x9')]=!![];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['xmd-contactid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x54'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x55')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')][_0x15fa('0x56')])){utils['info'](util[_0x15fa('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]]['type']=_0x2fa8d7['value'];}if(!_[_0x15fa('0x21')](_0x2fa8d7[_0x15fa('0x44')]['outboundrouteid'])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x57'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]][_0x15fa('0x58')]=_0x2fa8d7[_0x15fa('0x47')];}if(!_['isNil'](_0x2fa8d7['variable'][_0x15fa('0x59')])){utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x5a'),_0x2fa8d7[_0x15fa('0x13')],_0x2fa8d7[_0x15fa('0x47')]));channels[_0x2fa8d7[_0x15fa('0x13')]]['sipcallid']=_0x2fa8d7[_0x15fa('0x47')];}}}catch(_0x27eeee){utils['error'](util[_0x15fa('0x6')]('[%s][calls][varset]',_0x2fa8d7[_0x15fa('0x13')]),_0x27eeee);}};exports[_0x15fa('0x5b')]=function(_0x51cdd8){try{if(!_[_0x15fa('0x21')](channels[_0x51cdd8[_0x15fa('0x13')]])){utils[_0x15fa('0x14')](util[_0x15fa('0x6')]('[%s][calls][newexten]',_0x51cdd8[_0x15fa('0x13')]),_0x51cdd8);utils[_0x15fa('0x17')](util[_0x15fa('0x6')](_0x15fa('0x5c'),_0x51cdd8['uniqueid'],_0x51cdd8[_0x15fa('0x5d')],_0x51cdd8[_0x15fa('0x5e')]));if(_0x51cdd8[_0x15fa('0x5d')][_0x15fa('0x5f')]()==_0x15fa('0x60')&&_[_0x15fa('0x61')](_0x51cdd8[_0x15fa('0x5e')][_0x15fa('0x5f')](),_0x15fa('0x62'))){var _0x49a4c1=_0x51cdd8[_0x15fa('0x5e')][_0x15fa('0x63')]('=');var _0x4a920c=_0x49a4c1[0x0][_0x15fa('0x64')](_0x49a4c1[0x0]['lastIndexOf']('(')+0x1,_0x49a4c1[0x0][_0x15fa('0x65')](')'));var _0x10afbd=_0x49a4c1[0x1];channels[_0x51cdd8['uniqueid']][_0x4a920c]=_0x10afbd;}if(!_['includes']([_0x15fa('0x66'),_0x15fa('0x67'),_0x15fa('0x68'),_0x15fa('0x60'),_0x15fa('0x69')],_0x51cdd8[_0x15fa('0x5d')][_0x15fa('0x5f')]())){channels[_0x51cdd8['uniqueid']][_0x15fa('0x51')]=_0x51cdd8[_0x15fa('0x5d')];channels[_0x51cdd8[_0x15fa('0x13')]][_0x15fa('0x53')]=_0x51cdd8[_0x15fa('0x5e')];}}}catch(_0x34628f){utils[_0x15fa('0x1c')](util[_0x15fa('0x6')](_0x15fa('0x6a'),_0x51cdd8[_0x15fa('0x13')]),_0x34628f);}}; \ No newline at end of file +var _0x39cf=['xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','now','error','newstate','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','xmd-originatecalleridnum','value','source','variable','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue'];(function(_0x1e41ba,_0x455a21){var _0x201d61=function(_0x4c1ba2){while(--_0x4c1ba2){_0x1e41ba['push'](_0x1e41ba['shift']());}};_0x201d61(++_0x455a21);}(_0x39cf,0x1c2));var _0xf39c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x39cf[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xf39c('0x0'));var util=require(_0xf39c('0x1'));var utils=require(_0xf39c('0x2'));var dispositions=[_0xf39c('0x3'),_0xf39c('0x4'),'FAILED','NO\x20ANSWER',_0xf39c('0x3'),_0xf39c('0x3'),_0xf39c('0x5'),_0xf39c('0x6'),_0xf39c('0x4'),_0xf39c('0x4'),_0xf39c('0x4')];var channels={};function writeDB(_0x58be97){utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x9'),_0x58be97['uniqueid'],_0x58be97[_0xf39c('0xa')],_0x58be97[_0xf39c('0xb')],_0x58be97[_0xf39c('0xc')],_0x58be97[_0xf39c('0xd')],_0x58be97['calleridnum'],_0x58be97[_0xf39c('0xe')],_0x58be97[_0xf39c('0xf')]));if(_0x58be97[_0xf39c('0x10')]){utils[_0xf39c('0x11')](_0x58be97['accountcode'])[_0xf39c('0x12')](function(_0x488ff6){if(_0x488ff6){_0x58be97[_0xf39c('0x13')]=_0x488ff6['id'];}utils[_0xf39c('0x14')](_0xf39c('0x15'),_0x58be97);});}else{utils[_0xf39c('0x14')](_0xf39c('0x15'),_0x58be97);}if(channels[_0x58be97[_0xf39c('0x16')]]){delete channels[_0x58be97[_0xf39c('0x16')]];}}exports[_0xf39c('0x17')]=function(_0x17e6a0){try{utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x19'),_0x17e6a0[_0xf39c('0x16')]),_0x17e6a0);if(_0x17e6a0[_0xf39c('0x16')]==_0x17e6a0[_0xf39c('0x1a')]&&_0x17e6a0[_0xf39c('0xa')]!=_0xf39c('0x1b')){utils[_0xf39c('0x7')](util['format'](_0xf39c('0x1c'),_0x17e6a0[_0xf39c('0x16')],_0x17e6a0['context'],_0x17e6a0[_0xf39c('0x1d')]));channels[_0x17e6a0[_0xf39c('0x16')]]={'uniqueid':_0x17e6a0[_0xf39c('0x16')],'accountcode':_0x17e6a0[_0xf39c('0x10')],'source':_0x17e6a0[_0xf39c('0x1e')],'destination':_0x17e6a0[_0xf39c('0x1d')],'destinationcontext':_0x17e6a0['context'],'channel':_0x17e6a0[_0xf39c('0xa')],'starttime':utils[_0xf39c('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf39c('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x1c6a34){utils[_0xf39c('0x20')](util[_0xf39c('0x8')]('[%s][calls][newchannel]',_0x17e6a0[_0xf39c('0x16')]),_0x1c6a34);}};exports[_0xf39c('0x21')]=function(_0x1ccc19){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x1ccc19[_0xf39c('0x16')]),_0x1ccc19);if(!_[_0xf39c('0x22')](channels[_0x1ccc19['uniqueid']])&&_0x1ccc19['channelstate']==0x6){utils[_0xf39c('0x7')](util['format'](_0xf39c('0x23'),_0x1ccc19[_0xf39c('0x16')],_0x1ccc19[_0xf39c('0x24')],_0x1ccc19[_0xf39c('0xa')]));if(_[_0xf39c('0x22')](channels[_0x1ccc19[_0xf39c('0x16')]][_0xf39c('0x25')])){channels[_0x1ccc19[_0xf39c('0x16')]][_0xf39c('0x25')]=utils[_0xf39c('0x1f')]();}}else if(!_[_0xf39c('0x22')](channels[_0x1ccc19[_0xf39c('0x1a')]])&&_0x1ccc19[_0xf39c('0x26')]==0x6&&_0x1ccc19[_0xf39c('0x24')]!=_0xf39c('0x27')){utils[_0xf39c('0x7')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1ccc19[_0xf39c('0x16')],_0x1ccc19[_0xf39c('0x1a')],_0x1ccc19[_0xf39c('0x24')],_0x1ccc19[_0xf39c('0xa')]));channels[_0x1ccc19['linkedid']][_0xf39c('0x10')]=_0x1ccc19[_0xf39c('0x10')];channels[_0x1ccc19['linkedid']][_0xf39c('0x28')]=_0x1ccc19[_0xf39c('0xa')];if(_[_0xf39c('0x22')](channels[_0x1ccc19[_0xf39c('0x1a')]][_0xf39c('0x29')])){channels[_0x1ccc19['linkedid']]['answertime']=utils['now']();}channels[_0x1ccc19[_0xf39c('0x1a')]][_0xf39c('0x2a')]=dispositions[_['toNumber'](_0x1ccc19[_0xf39c('0x26')])]||_0xf39c('0x5');}}catch(_0x341c18){utils[_0xf39c('0x20')](util[_0xf39c('0x8')]('[%s][calls][newstate]',_0x1ccc19['uniqueid']),_0x341c18);}};exports[_0xf39c('0x2b')]=function(_0x48294d){try{if(!_[_0xf39c('0x22')](channels[_0x48294d[_0xf39c('0x16')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x2c'),_0x48294d[_0xf39c('0x16')]),_0x48294d);if(_[_0xf39c('0x22')](channels[_0x48294d[_0xf39c('0x16')]][_0xf39c('0x2d')])){channels[_0x48294d['uniqueid']][_0xf39c('0x2d')]=_0x48294d[_0xf39c('0x2e')]+'\x20<'+_0x48294d[_0xf39c('0x1e')]+'>';}utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x2f'),_0x48294d[_0xf39c('0x16')],channels[_0x48294d['uniqueid']]['callerid'],_0x48294d[_0xf39c('0x30')]));channels[_0x48294d[_0xf39c('0x16')]]['endtime']=utils[_0xf39c('0x1f')]();channels[_0x48294d[_0xf39c('0x16')]][_0xf39c('0x31')]=utils[_0xf39c('0x32')](channels[_0x48294d[_0xf39c('0x16')]][_0xf39c('0x33')],channels[_0x48294d[_0xf39c('0x16')]]['starttime']);channels[_0x48294d[_0xf39c('0x16')]][_0xf39c('0x34')]=channels[_0x48294d['uniqueid']]['answertime']?utils[_0xf39c('0x32')](channels[_0x48294d[_0xf39c('0x16')]][_0xf39c('0x33')],channels[_0x48294d['uniqueid']][_0xf39c('0x29')]):0x0;writeDB(channels[_0x48294d[_0xf39c('0x16')]]);}}catch(_0x223567){utils[_0xf39c('0x20')](util['format'](_0xf39c('0x2c'),_0x48294d['uniqueid']),_0x223567);}};exports[_0xf39c('0x35')]=function(_0x3b40d2){try{if(!_[_0xf39c('0x22')](channels[_0x3b40d2[_0xf39c('0x36')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x37'),_0x3b40d2[_0xf39c('0x38')]),_0x3b40d2);if(channels[_0x3b40d2[_0xf39c('0x36')]]['channel']==_0x3b40d2[_0xf39c('0x39')]){utils['info'](util[_0xf39c('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b40d2[_0xf39c('0x38')],_0x3b40d2['localtwolinkedid'],_0x3b40d2['secondtransfererchannel']));channels[_0x3b40d2['localtwolinkedid']]['destinationchannel']=_0x3b40d2['secondtransfererchannel'];channels[_0x3b40d2[_0xf39c('0x36')]]['userfield']=_0xf39c('0x3a');}else if(channels[_0x3b40d2[_0xf39c('0x36')]][_0xf39c('0xa')]=_0x3b40d2[_0xf39c('0x3b')]){utils['info'](util[_0xf39c('0x8')](_0xf39c('0x3c'),_0x3b40d2[_0xf39c('0x38')],_0x3b40d2[_0xf39c('0x36')],_0x3b40d2['origtransfererchannel']));channels[_0x3b40d2[_0xf39c('0x36')]][_0xf39c('0x28')]=_0x3b40d2[_0xf39c('0x3d')];channels[_0x3b40d2[_0xf39c('0x36')]][_0xf39c('0x3e')]='_attended';}}}catch(_0x4d4b84){utils[_0xf39c('0x20')](util['format']('[%s][calls][attendedtransfer]',_0x3b40d2['origtransfereruniqueid']),_0x4d4b84);}};exports['musiconholdstart']=function(_0x3b954b){try{if(!_[_0xf39c('0x22')](channels[_0x3b954b[_0xf39c('0x16')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x3f'),_0x3b954b[_0xf39c('0x16')]),_0x3b954b);channels[_0x3b954b[_0xf39c('0x16')]][_0xf39c('0x40')]=utils[_0xf39c('0x1f')]();utils['info'](util[_0xf39c('0x8')](_0xf39c('0x41'),_0x3b954b[_0xf39c('0x16')],channels[_0x3b954b[_0xf39c('0x16')]][_0xf39c('0x40')]));}}catch(_0x54546e){utils[_0xf39c('0x20')](util['format']('[%s][calls][musiconholdstart]',_0x3b954b[_0xf39c('0x16')]),_0x54546e);}};exports[_0xf39c('0x42')]=function(_0x296752){try{if(!_['isNil'](channels[_0x296752[_0xf39c('0x16')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x43'),_0x296752['uniqueid']),_0x296752);if(!_[_0xf39c('0x22')](channels[_0x296752['uniqueid']][_0xf39c('0x40')])){channels[_0x296752[_0xf39c('0x16')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x296752['uniqueid']]['musiconholdstartAt']);utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x44'),_0x296752[_0xf39c('0x16')],channels[_0x296752[_0xf39c('0x16')]][_0xf39c('0x45')]));delete channels[_0x296752['uniqueid']][_0xf39c('0x40')];}}}catch(_0x5ed74b){utils[_0xf39c('0x20')](util[_0xf39c('0x8')](_0xf39c('0x43'),_0x296752[_0xf39c('0x16')]),_0x5ed74b);}};exports[_0xf39c('0x46')]=function(_0x398e41){try{if(!_['isNil'](channels[_0x398e41[_0xf39c('0x16')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')]('[%s][calls][varset]',_0x398e41[_0xf39c('0x16')]),_0x398e41);if(!_[_0xf39c('0x22')](_0x398e41['variable'][_0xf39c('0x47')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x398e41[_0xf39c('0x16')],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x49')]=_0x398e41[_0xf39c('0x48')];}if(!_['isNil'](_0x398e41[_0xf39c('0x4a')]['xmd-phone'])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x398e41['uniqueid'],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x4b')]=_0x398e41[_0xf39c('0x48')];channels[_0x398e41[_0xf39c('0x16')]]['callerid']='\x22'+_0x398e41['value']+'\x22\x20<'+_0x398e41[_0xf39c('0x48')]+'>';}if(!_['isNil'](_0x398e41['variable'][_0xf39c('0x4c')])||!_[_0xf39c('0x22')](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x4d')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x4e'),_0x398e41[_0xf39c('0x16')],!_['isNil'](_0x398e41[_0xf39c('0x4a')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xf39c('0x4d'),_0x398e41['value']));channels[_0x398e41['uniqueid']]['callerid']=_0x398e41[_0xf39c('0x48')];}if(!_[_0xf39c('0x22')](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x4f')])||!_['isNil'](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x50')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x4e'),_0x398e41[_0xf39c('0x16')],!_[_0xf39c('0x22')](_0x398e41['variable']['xmd-queue'])?'xmd-queue':_0xf39c('0x50'),_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x51')]=_0xf39c('0x52');channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x53')]=_0x398e41[_0xf39c('0x48')];channels[_0x398e41[_0xf39c('0x16')]]['queue']=!![];}if(!_[_0xf39c('0x22')](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x54')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x398e41[_0xf39c('0x16')],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x55')]=_0x398e41[_0xf39c('0x48')];}if(!_[_0xf39c('0x22')](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x56')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x57'),_0x398e41[_0xf39c('0x16')],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x58')]=_0x398e41['value'];}if(!_[_0xf39c('0x22')](_0x398e41[_0xf39c('0x4a')][_0xf39c('0x59')])){utils[_0xf39c('0x7')](util[_0xf39c('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x398e41[_0xf39c('0x16')],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]]['routeid']=_0x398e41[_0xf39c('0x48')];}if(!_['isNil'](_0x398e41['variable'][_0xf39c('0x5a')])){utils[_0xf39c('0x7')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x398e41[_0xf39c('0x16')],_0x398e41[_0xf39c('0x48')]));channels[_0x398e41[_0xf39c('0x16')]][_0xf39c('0x5a')]=_0x398e41[_0xf39c('0x48')];}}}catch(_0x24dc5b){utils[_0xf39c('0x20')](util['format']('[%s][calls][varset]',_0x398e41[_0xf39c('0x16')]),_0x24dc5b);}};exports[_0xf39c('0x5b')]=function(_0x19c8c6){try{if(!_['isNil'](channels[_0x19c8c6[_0xf39c('0x16')]])){utils[_0xf39c('0x18')](util[_0xf39c('0x8')](_0xf39c('0x5c'),_0x19c8c6[_0xf39c('0x16')]),_0x19c8c6);utils[_0xf39c('0x7')](util[_0xf39c('0x8')](_0xf39c('0x5d'),_0x19c8c6[_0xf39c('0x16')],_0x19c8c6[_0xf39c('0x5e')],_0x19c8c6[_0xf39c('0x5f')]));if(_0x19c8c6[_0xf39c('0x5e')]['toLowerCase']()==_0xf39c('0x60')&&_['startsWith'](_0x19c8c6[_0xf39c('0x5f')][_0xf39c('0x61')](),_0xf39c('0x62'))){var _0x4a7d2d=_0x19c8c6[_0xf39c('0x5f')][_0xf39c('0x63')]('=');var _0x3636c0=_0x4a7d2d[0x0][_0xf39c('0x64')](_0x4a7d2d[0x0][_0xf39c('0x65')]('(')+0x1,_0x4a7d2d[0x0]['lastIndexOf'](')'));var _0x27a9db=_0x4a7d2d[0x1];channels[_0x19c8c6[_0xf39c('0x16')]][_0x3636c0]=_0x27a9db;}if(!_[_0xf39c('0x66')]([_0xf39c('0x2b'),_0xf39c('0x67'),_0xf39c('0x68'),_0xf39c('0x60'),_0xf39c('0x69')],_0x19c8c6[_0xf39c('0x5e')]['toLowerCase']())){channels[_0x19c8c6[_0xf39c('0x16')]][_0xf39c('0x51')]=_0x19c8c6['application'];channels[_0x19c8c6[_0xf39c('0x16')]][_0xf39c('0x53')]=_0x19c8c6['appdata'];}}}catch(_0x8f278){utils[_0xf39c('0x20')](util['format'](_0xf39c('0x5c'),_0x19c8c6[_0xf39c('0x16')]),_0x8f278);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6e9a7b7..ab87ae6 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 _0xb543=['fullybooted','error','[core]\x20error','[core]\x20close','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x3b64e0,_0x1f9aa2){var _0x5534f3=function(_0xdfc578){while(--_0xdfc578){_0x3b64e0['push'](_0x3b64e0['shift']());}};_0x5534f3(++_0x1f9aa2);}(_0xb543,0x18a));var _0x3b54=function(_0x3cbb27,_0xac83ef){_0x3cbb27=_0x3cbb27-0x0;var _0x158815=_0xb543[_0x3cbb27];return _0x158815;};'use strict';var utils=require(_0x3b54('0x0'));exports[_0x3b54('0x1')]=function(){utils['info'](_0x3b54('0x2'));};exports[_0x3b54('0x3')]=function(){utils[_0x3b54('0x4')](_0x3b54('0x5'));};exports[_0x3b54('0x6')]=function(){utils[_0x3b54('0x4')]('[core]\x20fullybooted');};exports[_0x3b54('0x7')]=function(_0x1c173f){utils[_0x3b54('0x7')](_0x3b54('0x8'),_0x1c173f);};exports['close']=function(){utils[_0x3b54('0x4')](_0x3b54('0x9'));};exports['managerevent']=function(_0x3db582){}; \ No newline at end of file +var _0x4bcf=['[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x726734,_0x195492){var _0x267466=function(_0x11afe7){while(--_0x11afe7){_0x726734['push'](_0x726734['shift']());}};_0x267466(++_0x195492);}(_0x4bcf,0x116));var _0xf4bc=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x4bcf[_0x13c70c];return _0x50f0f2;};'use strict';var utils=require(_0xf4bc('0x0'));exports[_0xf4bc('0x1')]=function(){utils['info'](_0xf4bc('0x2'));};exports[_0xf4bc('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xf4bc('0x4')]=function(){utils[_0xf4bc('0x5')](_0xf4bc('0x6'));};exports[_0xf4bc('0x7')]=function(_0x345a02){utils[_0xf4bc('0x7')](_0xf4bc('0x8'),_0x345a02);};exports[_0xf4bc('0x9')]=function(){utils['info'](_0xf4bc('0xa'));};exports[_0xf4bc('0xb')]=function(_0x563e3e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ebe99d8..c171884 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 _0x5ce3=['appdata','set','startsWith','toLowerCase','cdr(routeid)','error','format','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','diffTime','endtime','billableseconds','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x8fb8e0,_0x32dd74){var _0xa0259d=function(_0x578b1d){while(--_0x578b1d){_0x8fb8e0['push'](_0x8fb8e0['shift']());}};_0xa0259d(++_0x32dd74);}(_0x5ce3,0x148));var _0x35ce=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x5ce3[_0x316c42];return _0x2b38f7;};'use strict';var _=require('lodash');var util=require(_0x35ce('0x0'));var utils=require(_0x35ce('0x1'));var dials={};function writeDB(_0x13c7a7){utils['info'](util['format'](_0x35ce('0x2'),_0x13c7a7[_0x35ce('0x3')],_0x13c7a7[_0x35ce('0x4')],_0x13c7a7[_0x35ce('0x5')],_0x13c7a7['calleridnum'],_0x13c7a7[_0x35ce('0x6')],_0x13c7a7[_0x35ce('0x7')]));utils[_0x35ce('0x8')](_0x35ce('0x9'),_0x13c7a7);delete dials[_0x13c7a7['uniqueid']];}exports[_0x35ce('0xa')]=function(_0xd62202){try{utils[_0x35ce('0xb')](util['format']('[%s][dials][newexten]',_0xd62202[_0x35ce('0x3')]),_0xd62202);utils[_0x35ce('0xc')](util['format'](_0x35ce('0xd'),_0xd62202[_0x35ce('0x3')],_0xd62202[_0x35ce('0xe')],_0xd62202[_0x35ce('0xf')]));if(_0xd62202[_0x35ce('0xe')]['toLowerCase']()==_0x35ce('0x10')&&_[_0x35ce('0x11')](_0xd62202[_0x35ce('0xf')][_0x35ce('0x12')](),_0x35ce('0x13'))){var _0x39f48b=_0xd62202[_0x35ce('0xf')]['split']('=');dials[_0xd62202[_0x35ce('0x3')]]={'routeId':_0x39f48b[0x1]};}}catch(_0xd8e8e){utils[_0x35ce('0x14')](util['format']('[%s][dials][newexten]',_0xd62202[_0x35ce('0x3')]),_0xd8e8e);}};exports['varset']=function(_0x522d03){try{utils['debug'](util[_0x35ce('0x15')](_0x35ce('0x16'),_0x522d03[_0x35ce('0x3')]),_0x522d03);if(!_[_0x35ce('0x17')](_0x522d03[_0x35ce('0x18')][_0x35ce('0x19')])){utils[_0x35ce('0xc')](util[_0x35ce('0x15')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x522d03['uniqueid'],_0x522d03[_0x35ce('0x1a')]));dials[_0x522d03[_0x35ce('0x3')]]={'routeId':_0x522d03['value']};}}catch(_0x18c215){utils[_0x35ce('0x14')](util[_0x35ce('0x15')](_0x35ce('0x16'),_0x522d03[_0x35ce('0x3')]),_0x18c215);}};exports[_0x35ce('0x1b')]=function(_0x53d2cd){try{if(!_[_0x35ce('0x17')](dials[_0x53d2cd['uniqueid']])){utils[_0x35ce('0xb')](util['format'](_0x35ce('0x1c'),_0x53d2cd[_0x35ce('0x3')]),_0x53d2cd);dials[_0x53d2cd['uniqueid']]=_[_0x35ce('0x1d')](dials[_0x53d2cd[_0x35ce('0x3')]],_0x53d2cd);dials[_0x53d2cd[_0x35ce('0x3')]][_0x35ce('0x1e')]=utils[_0x35ce('0x1f')]();dials[_0x53d2cd[_0x35ce('0x3')]][_0x35ce('0x20')]='called';utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x21'),_0x53d2cd[_0x35ce('0x3')],dials[_0x53d2cd['uniqueid']][_0x35ce('0x1e')]));}}catch(_0x19ef71){utils[_0x35ce('0x14')](util[_0x35ce('0x15')]('[%s][dials][dialbegin]',_0x53d2cd[_0x35ce('0x3')]),_0x19ef71);}};exports[_0x35ce('0x22')]=function(_0xfaeb6e){try{if(!_[_0x35ce('0x17')](dials[_0xfaeb6e['uniqueid']])){utils['debug'](util[_0x35ce('0x15')](_0x35ce('0x23'),_0xfaeb6e[_0x35ce('0x3')]),_0xfaeb6e);dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x7')]=_0xfaeb6e[_0x35ce('0x7')];if(_0xfaeb6e['dialstatus']==_0x35ce('0x24')){dials[_0xfaeb6e[_0x35ce('0x3')]]=_['assign'](dials[_0xfaeb6e[_0x35ce('0x3')]],_0xfaeb6e);dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x25')]=utils[_0x35ce('0x1f')]();dials[_0xfaeb6e['uniqueid']]['lastevent']='connect';utils['info'](util['format'](_0x35ce('0x26'),_0xfaeb6e[_0x35ce('0x3')],_0xfaeb6e[_0x35ce('0x7')],dials[_0xfaeb6e[_0x35ce('0x3')]][_0x35ce('0x25')]));}else{utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x27'),_0xfaeb6e['uniqueid'],_0xfaeb6e[_0x35ce('0x7')]));}}}catch(_0x562976){utils[_0x35ce('0x14')](util[_0x35ce('0x15')]('[%s][dials][dialend]',_0xfaeb6e[_0x35ce('0x3')]),_0x562976);}};exports[_0x35ce('0x28')]=function(_0x4f1d90){try{if(!_['isNil'](dials[_0x4f1d90['uniqueid']])){utils[_0x35ce('0xb')](util[_0x35ce('0x15')](_0x35ce('0x29'),_0x4f1d90[_0x35ce('0x3')]),_0x4f1d90);utils[_0x35ce('0xc')](util[_0x35ce('0x15')](_0x35ce('0x2a'),_0x4f1d90['uniqueid'],_0x4f1d90[_0x35ce('0x2b')],_0x4f1d90[_0x35ce('0x2c')],_0x4f1d90['cause-txt']));dials[_0x4f1d90[_0x35ce('0x3')]]=_['assign'](dials[_0x4f1d90['uniqueid']],{'endtime':utils[_0x35ce('0x1f')](),'lastevent':_0x35ce('0x2d')});dials[_0x4f1d90['uniqueid']]['duration']=utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]]['endtime'],dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x1e')]);dials[_0x4f1d90[_0x35ce('0x3')]]['holdtime']=utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x25')]||dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x2f')],dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x1e')]);dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x30')]=dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x25')]?utils[_0x35ce('0x2e')](dials[_0x4f1d90[_0x35ce('0x3')]][_0x35ce('0x2f')],dials[_0x4f1d90['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4f1d90['uniqueid']]);}}catch(_0x380a27){utils[_0x35ce('0x14')](util[_0x35ce('0x15')](_0x35ce('0x29'),_0x4f1d90[_0x35ce('0x3')]),_0x380a27);}}; \ No newline at end of file +var _0xf524=['calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','error','varset','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring'];(function(_0x4c8efd,_0x4dfbd9){var _0x521093=function(_0x1d60dc){while(--_0x1d60dc){_0x4c8efd['push'](_0x4c8efd['shift']());}};_0x521093(++_0x4dfbd9);}(_0xf524,0x19f));var _0x4f52=function(_0x494b7f,_0x353334){_0x494b7f=_0x494b7f-0x0;var _0x37daf9=_0xf524[_0x494b7f];return _0x37daf9;};'use strict';var _=require(_0x4f52('0x0'));var util=require(_0x4f52('0x1'));var utils=require(_0x4f52('0x2'));var dials={};function writeDB(_0x229423){utils[_0x4f52('0x3')](util[_0x4f52('0x4')](_0x4f52('0x5'),_0x229423[_0x4f52('0x6')],_0x229423[_0x4f52('0x7')],_0x229423[_0x4f52('0x8')],_0x229423[_0x4f52('0x9')],_0x229423['connectedlinenum'],_0x229423[_0x4f52('0xa')]));utils[_0x4f52('0xb')](_0x4f52('0xc'),_0x229423);delete dials[_0x229423['uniqueid']];}exports['newexten']=function(_0x4d4625){try{utils[_0x4f52('0xd')](util['format'](_0x4f52('0xe'),_0x4d4625[_0x4f52('0x6')]),_0x4d4625);utils[_0x4f52('0x3')](util[_0x4f52('0x4')](_0x4f52('0xf'),_0x4d4625[_0x4f52('0x6')],_0x4d4625[_0x4f52('0x10')],_0x4d4625['appdata']));if(_0x4d4625[_0x4f52('0x10')]['toLowerCase']()==_0x4f52('0x11')&&_[_0x4f52('0x12')](_0x4d4625[_0x4f52('0x13')][_0x4f52('0x14')](),_0x4f52('0x15'))){var _0x3bfaca=_0x4d4625[_0x4f52('0x13')]['split']('=');dials[_0x4d4625[_0x4f52('0x6')]]={'routeId':_0x3bfaca[0x1]};}}catch(_0x27d094){utils[_0x4f52('0x16')](util[_0x4f52('0x4')]('[%s][dials][newexten]',_0x4d4625[_0x4f52('0x6')]),_0x27d094);}};exports[_0x4f52('0x17')]=function(_0xef0996){try{utils['debug'](util[_0x4f52('0x4')]('[%s][dials][varset]',_0xef0996[_0x4f52('0x6')]),_0xef0996);if(!_[_0x4f52('0x18')](_0xef0996['variable']['outboundrouteid'])){utils[_0x4f52('0x3')](util[_0x4f52('0x4')](_0x4f52('0x19'),_0xef0996['uniqueid'],_0xef0996[_0x4f52('0x1a')]));dials[_0xef0996[_0x4f52('0x6')]]={'routeId':_0xef0996[_0x4f52('0x1a')]};}}catch(_0x21cadd){utils[_0x4f52('0x16')](util[_0x4f52('0x4')](_0x4f52('0x1b'),_0xef0996['uniqueid']),_0x21cadd);}};exports[_0x4f52('0x1c')]=function(_0x5d1e94){try{if(!_[_0x4f52('0x18')](dials[_0x5d1e94[_0x4f52('0x6')]])){utils[_0x4f52('0xd')](util['format'](_0x4f52('0x1d'),_0x5d1e94[_0x4f52('0x6')]),_0x5d1e94);dials[_0x5d1e94[_0x4f52('0x6')]]=_[_0x4f52('0x1e')](dials[_0x5d1e94[_0x4f52('0x6')]],_0x5d1e94);dials[_0x5d1e94['uniqueid']]['starttime']=utils['now']();dials[_0x5d1e94['uniqueid']][_0x4f52('0x1f')]=_0x4f52('0x20');utils['info'](util[_0x4f52('0x4')](_0x4f52('0x21'),_0x5d1e94[_0x4f52('0x6')],dials[_0x5d1e94[_0x4f52('0x6')]][_0x4f52('0x22')]));}}catch(_0x173a5f){utils[_0x4f52('0x16')](util[_0x4f52('0x4')]('[%s][dials][dialbegin]',_0x5d1e94['uniqueid']),_0x173a5f);}};exports[_0x4f52('0x23')]=function(_0x28dff6){try{if(!_[_0x4f52('0x18')](dials[_0x28dff6[_0x4f52('0x6')]])){utils[_0x4f52('0xd')](util[_0x4f52('0x4')](_0x4f52('0x24'),_0x28dff6[_0x4f52('0x6')]),_0x28dff6);dials[_0x28dff6[_0x4f52('0x6')]][_0x4f52('0xa')]=_0x28dff6[_0x4f52('0xa')];if(_0x28dff6[_0x4f52('0xa')]==_0x4f52('0x25')){dials[_0x28dff6[_0x4f52('0x6')]]=_[_0x4f52('0x1e')](dials[_0x28dff6[_0x4f52('0x6')]],_0x28dff6);dials[_0x28dff6[_0x4f52('0x6')]][_0x4f52('0x26')]=utils[_0x4f52('0x27')]();dials[_0x28dff6[_0x4f52('0x6')]][_0x4f52('0x1f')]=_0x4f52('0x28');utils[_0x4f52('0x3')](util['format'](_0x4f52('0x29'),_0x28dff6[_0x4f52('0x6')],_0x28dff6[_0x4f52('0xa')],dials[_0x28dff6[_0x4f52('0x6')]][_0x4f52('0x26')]));}else{utils['info'](util[_0x4f52('0x4')](_0x4f52('0x2a'),_0x28dff6[_0x4f52('0x6')],_0x28dff6[_0x4f52('0xa')]));}}}catch(_0x6c9b42){utils['error'](util[_0x4f52('0x4')](_0x4f52('0x24'),_0x28dff6[_0x4f52('0x6')]),_0x6c9b42);}};exports[_0x4f52('0x2b')]=function(_0x54bbb1){try{if(!_['isNil'](dials[_0x54bbb1[_0x4f52('0x6')]])){utils['debug'](util[_0x4f52('0x4')](_0x4f52('0x2c'),_0x54bbb1[_0x4f52('0x6')]),_0x54bbb1);utils[_0x4f52('0x3')](util[_0x4f52('0x4')](_0x4f52('0x2d'),_0x54bbb1['uniqueid'],_0x54bbb1[_0x4f52('0x9')],_0x54bbb1[_0x4f52('0x2e')],_0x54bbb1[_0x4f52('0x2f')]));dials[_0x54bbb1[_0x4f52('0x6')]]=_[_0x4f52('0x1e')](dials[_0x54bbb1[_0x4f52('0x6')]],{'endtime':utils[_0x4f52('0x27')](),'lastevent':'complete'});dials[_0x54bbb1[_0x4f52('0x6')]][_0x4f52('0x30')]=utils[_0x4f52('0x31')](dials[_0x54bbb1[_0x4f52('0x6')]][_0x4f52('0x32')],dials[_0x54bbb1['uniqueid']][_0x4f52('0x22')]);dials[_0x54bbb1['uniqueid']][_0x4f52('0x33')]=utils['diffTime'](dials[_0x54bbb1['uniqueid']][_0x4f52('0x26')]||dials[_0x54bbb1[_0x4f52('0x6')]][_0x4f52('0x32')],dials[_0x54bbb1[_0x4f52('0x6')]][_0x4f52('0x22')]);dials[_0x54bbb1['uniqueid']][_0x4f52('0x34')]=dials[_0x54bbb1[_0x4f52('0x6')]][_0x4f52('0x26')]?utils['diffTime'](dials[_0x54bbb1['uniqueid']]['endtime'],dials[_0x54bbb1[_0x4f52('0x6')]]['answertime']):0x0;writeDB(dials[_0x54bbb1[_0x4f52('0x6')]]);}}catch(_0x313765){utils['error'](util['format'](_0x4f52('0x2c'),_0x54bbb1[_0x4f52('0x6')]),_0x313765);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index aa56e96..2ac0b81 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 _0x9d40=['asterisk','port','username','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','error','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','production'];(function(_0x17e40f,_0x53ec26){var _0x1aa124=function(_0x2387f7){while(--_0x2387f7){_0x17e40f['push'](_0x17e40f['shift']());}};_0x1aa124(++_0x53ec26);}(_0x9d40,0x1bb));var _0x09d4=function(_0x5f2f7f,_0x38bc83){_0x5f2f7f=_0x5f2f7f-0x0;var _0x89c751=_0x9d40[_0x5f2f7f];return _0x89c751;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x09d4('0x0'));var util=require(_0x09d4('0x1'));var isXDREnabled=config[_0x09d4('0x2')]&&config[_0x09d4('0x2')]['disabled']?!config['xdr'][_0x09d4('0x3')]:!![];var isProduction=config['env']===_0x09d4('0x4')||![];var isLocalAsterisk=config[_0x09d4('0x2')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x09d4('0x5')][_0x09d4('0x6')],config['asterisk']['ip'],config[_0x09d4('0x5')][_0x09d4('0x7')],config[_0x09d4('0x5')]['password'],!![]);ami[_0x09d4('0x8')]();if(!isXDREnabled){utils['info'](_0x09d4('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x09d4('0xa'));}else{var agents=require(_0x09d4('0xb'));var calls=require(_0x09d4('0xc'));var queues=require(_0x09d4('0xd'));var recordings=require(_0x09d4('0xe'));var members=require(_0x09d4('0xf'));var dials=require(_0x09d4('0x10'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x09d4('0x11'),core[_0x09d4('0x11')]);ami['on'](_0x09d4('0x12'),core[_0x09d4('0x12')]);ami['on']('fullybooted',core[_0x09d4('0x13')]);ami['on']('error',core['error']);ami['on'](_0x09d4('0x14'),core['close']);ami['on'](_0x09d4('0x15'),core['managerevent']);ami['on'](_0x09d4('0x16'),function(_0x4b571b){try{utils['debug'](util['format'](_0x09d4('0x17'),_0x4b571b[_0x09d4('0x18')]),_0x4b571b);members[_0x09d4('0x16')](_0x4b571b);}catch(_0x492c4d){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x17'),_0x4b571b['device']),_0x492c4d);}});ami['on'](_0x09d4('0x1b'),function(_0x48c365){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x1d'),_0x48c365[_0x09d4('0x1e')]),_0x48c365);agents[_0x09d4('0x1b')](_0x48c365);}catch(_0x2c2d5f){utils['error'](util['format'](_0x09d4('0x1d'),_0x48c365['uniqueid']),_0x2c2d5f);}});ami['on'](_0x09d4('0x1f'),function(_0x2ffecf){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][agentringnoanswer]',_0x2ffecf[_0x09d4('0x1e')]),_0x2ffecf);agents[_0x09d4('0x1f')](_0x2ffecf);}catch(_0x27f2bf){utils['error'](util[_0x09d4('0x1a')]('[%s][index][agentringnoanswer]',_0x2ffecf['uniqueid']),_0x27f2bf);}});ami['on'](_0x09d4('0x20'),function(_0x3cc44b){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x21'),_0x3cc44b[_0x09d4('0x1e')]),_0x3cc44b);agents[_0x09d4('0x20')](_0x3cc44b);queues[_0x09d4('0x20')](_0x3cc44b);}catch(_0x2ae4cc){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][agentconnect]',_0x3cc44b[_0x09d4('0x1e')]),_0x2ae4cc);}});ami['on'](_0x09d4('0x22'),function(_0x48efb8){try{utils['debug'](util[_0x09d4('0x1a')](_0x09d4('0x23'),_0x48efb8[_0x09d4('0x1e')]),_0x48efb8);agents[_0x09d4('0x22')](_0x48efb8);queues['agentcomplete'](_0x48efb8);members[_0x09d4('0x22')](_0x48efb8);}catch(_0xf677d4){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][agentcomplete]',_0x48efb8[_0x09d4('0x1e')]),_0xf677d4);}});ami['on'](_0x09d4('0x24'),function(_0x30c0e6){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][queuecallerabandon]',_0x30c0e6[_0x09d4('0x1e')]),_0x30c0e6);agents[_0x09d4('0x24')](_0x30c0e6);queues[_0x09d4('0x24')](_0x30c0e6);}catch(_0x370078){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x25'),_0x30c0e6['uniqueid']),_0x370078);}});ami['on']('queuecallerjoin',function(_0x11843a){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x26'),_0x11843a[_0x09d4('0x1e')]),_0x11843a);queues[_0x09d4('0x27')](_0x11843a);recordings[_0x09d4('0x27')](_0x11843a);}catch(_0x20aa24){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x26'),_0x11843a['uniqueid']),_0x20aa24);}});ami['on'](_0x09d4('0x28'),function(_0x2004a6){try{utils[_0x09d4('0x1c')](util['format']('[%s][index][queuecallerleave]',_0x2004a6['uniqueid']),_0x2004a6);queues['queuecallerleave'](_0x2004a6);}catch(_0x1571cc){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x29'),_0x2004a6['uniqueid']),_0x1571cc);}});ami['on']('musiconholdstart',function(_0x41a9d6){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][musiconholdstart]',_0x41a9d6[_0x09d4('0x1e')]),_0x41a9d6);queues['musiconholdstart'](_0x41a9d6);calls['musiconholdstart'](_0x41a9d6);}catch(_0x3cccec){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x2a'),_0x41a9d6[_0x09d4('0x1e')]),_0x3cccec);}});ami['on'](_0x09d4('0x2b'),function(_0x1d322b){try{utils[_0x09d4('0x1c')](util['format'](_0x09d4('0x2c'),_0x1d322b[_0x09d4('0x1e')]),_0x1d322b);queues[_0x09d4('0x2b')](_0x1d322b);calls['musiconholdstop'](_0x1d322b);}catch(_0x367fcf){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][musiconholdstop]',_0x1d322b['uniqueid']),_0x367fcf);}});ami['on'](_0x09d4('0x2d'),function(_0x2df4f6){try{utils['debug'](util['format'](_0x09d4('0x2e'),_0x2df4f6[_0x09d4('0x1e')]),_0x2df4f6);calls['newstate'](_0x2df4f6);recordings[_0x09d4('0x2d')](_0x2df4f6);}catch(_0x1d9348){utils['error'](util['format'](_0x09d4('0x2e'),_0x2df4f6[_0x09d4('0x1e')]),_0x1d9348);}});ami['on']('hangup',function(_0x1e0532){try{utils['debug'](util[_0x09d4('0x1a')](_0x09d4('0x2f'),_0x1e0532[_0x09d4('0x1e')]),_0x1e0532);calls[_0x09d4('0x30')](_0x1e0532);recordings[_0x09d4('0x30')](_0x1e0532);dials[_0x09d4('0x30')](_0x1e0532);agents[_0x09d4('0x30')](_0x1e0532);queues[_0x09d4('0x30')](_0x1e0532);}catch(_0x2a2c31){utils[_0x09d4('0x19')](util['format'](_0x09d4('0x2f'),_0x1e0532[_0x09d4('0x1e')]),_0x2a2c31);}});ami['on'](_0x09d4('0x31'),function(_0x553d36){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x32'),_0x553d36[_0x09d4('0x1e')]),_0x553d36);members[_0x09d4('0x31')](_0x553d36);}catch(_0x31fcbe){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x32'),_0x553d36[_0x09d4('0x1e')]),_0x31fcbe);}});ami['on'](_0x09d4('0x33'),function(_0x2520ab){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x34'),_0x2520ab['uniqueid']),_0x2520ab);queues[_0x09d4('0x33')](_0x2520ab);agents[_0x09d4('0x33')](_0x2520ab);transfers['blindtransfer'](_0x2520ab);}catch(_0x115575){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x34'),_0x2520ab[_0x09d4('0x1e')]),_0x115575);}});ami['on'](_0x09d4('0x35'),function(_0x5642ba){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x36'),_0x5642ba['origtransfereruniqueid']),_0x5642ba);queues['attendedtransfer'](_0x5642ba);transfers[_0x09d4('0x35')](_0x5642ba);agents['attendedtransfer'](_0x5642ba);calls[_0x09d4('0x35')](_0x5642ba);}catch(_0x28df3e){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x36'),_0x5642ba[_0x09d4('0x37')]),_0x28df3e);}});ami['on'](_0x09d4('0x38'),function(_0x4a0165){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][varset]',_0x4a0165[_0x09d4('0x1e')]),_0x4a0165);queues[_0x09d4('0x38')](_0x4a0165);recordings['varset'](_0x4a0165);calls[_0x09d4('0x38')](_0x4a0165);dials['varset'](_0x4a0165);}catch(_0x2a6e10){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')]('[%s][index][varset]',_0x4a0165[_0x09d4('0x1e')]),_0x2a6e10);}});ami['on'](_0x09d4('0x39'),function(_0x3e51e7){try{utils[_0x09d4('0x1c')](util['format'](_0x09d4('0x3a'),_0x3e51e7['uniqueid']),_0x3e51e7);calls[_0x09d4('0x39')](_0x3e51e7);recordings[_0x09d4('0x39')](_0x3e51e7);dials['newexten'](_0x3e51e7);}catch(_0x568562){utils['error'](util['format'](_0x09d4('0x3a'),_0x3e51e7[_0x09d4('0x1e')]),_0x568562);}});ami['on'](_0x09d4('0x3b'),function(_0x3ab39a){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x3c'),_0x3ab39a[_0x09d4('0x1e')]),_0x3ab39a);calls[_0x09d4('0x3b')](_0x3ab39a);recordings['newchannel'](_0x3ab39a);}catch(_0x6d831d){utils[_0x09d4('0x19')](util[_0x09d4('0x1a')](_0x09d4('0x3c'),_0x3ab39a[_0x09d4('0x1e')]),_0x6d831d);}});ami['on'](_0x09d4('0x3d'),function(_0x31c814){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')]('[%s][index][dialbegin]',_0x31c814[_0x09d4('0x1e')]),_0x31c814);dials['dialbegin'](_0x31c814);}catch(_0x230237){utils['error'](util[_0x09d4('0x1a')]('[%s]dialbegin',_0x31c814[_0x09d4('0x1e')]),_0x230237);}});ami['on'](_0x09d4('0x3e'),function(_0x244d38){try{utils[_0x09d4('0x1c')](util[_0x09d4('0x1a')](_0x09d4('0x3f'),_0x244d38[_0x09d4('0x1e')]),_0x244d38);dials[_0x09d4('0x3e')](_0x244d38);}catch(_0x2deb0b){utils['error'](util[_0x09d4('0x1a')]('[%s][index][dialend]',_0x244d38['uniqueid']),_0x2deb0b);}});} \ No newline at end of file +var _0x8855=['agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','format','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8855,0x17f));var _0x5885=function(_0x75a450,_0x47c120){_0x75a450=_0x75a450-0x0;var _0x1a5183=_0x8855[_0x75a450];return _0x1a5183;};var AsteriskManager=require(_0x5885('0x0'));var config=require(_0x5885('0x1'));var utils=require(_0x5885('0x2'));var util=require(_0x5885('0x3'));var isXDREnabled=config[_0x5885('0x4')]&&config['xdr']['disabled']?!config[_0x5885('0x4')]['disabled']:!![];var isProduction=config[_0x5885('0x5')]===_0x5885('0x6')||![];var isLocalAsterisk=config[_0x5885('0x4')]&&config['xdr'][_0x5885('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x5885('0x8')][_0x5885('0x9')],config[_0x5885('0x8')]['ip'],config['asterisk'][_0x5885('0xa')],config[_0x5885('0x8')][_0x5885('0xb')],!![]);ami[_0x5885('0xc')]();if(!isXDREnabled){utils['info'](_0x5885('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5885('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x5885('0xf'));var calls=require(_0x5885('0x10'));var queues=require(_0x5885('0x11'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x5885('0x12'));var transfers=require(_0x5885('0x13'));var core=require(_0x5885('0x14'));ami['on'](_0x5885('0x15'),core['connect']);ami['on'](_0x5885('0x16'),core[_0x5885('0x16')]);ami['on'](_0x5885('0x17'),core[_0x5885('0x17')]);ami['on']('error',core[_0x5885('0x18')]);ami['on']('close',core[_0x5885('0x19')]);ami['on'](_0x5885('0x1a'),core[_0x5885('0x1a')]);ami['on'](_0x5885('0x1b'),function(_0x3129d2){try{utils[_0x5885('0x1c')](util['format'](_0x5885('0x1d'),_0x3129d2[_0x5885('0x1e')]),_0x3129d2);members[_0x5885('0x1b')](_0x3129d2);}catch(_0x29cb1e){utils[_0x5885('0x18')](util['format']('[%s][index][devicestatechange]',_0x3129d2[_0x5885('0x1e')]),_0x29cb1e);}});ami['on'](_0x5885('0x1f'),function(_0x13d332){try{utils['debug'](util['format'](_0x5885('0x20'),_0x13d332['uniqueid']),_0x13d332);agents[_0x5885('0x1f')](_0x13d332);}catch(_0x4382ba){utils['error'](util[_0x5885('0x21')](_0x5885('0x20'),_0x13d332[_0x5885('0x22')]),_0x4382ba);}});ami['on'](_0x5885('0x23'),function(_0x5f5d7e){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')](_0x5885('0x24'),_0x5f5d7e[_0x5885('0x22')]),_0x5f5d7e);agents[_0x5885('0x23')](_0x5f5d7e);}catch(_0x56aeed){utils['error'](util[_0x5885('0x21')]('[%s][index][agentringnoanswer]',_0x5f5d7e[_0x5885('0x22')]),_0x56aeed);}});ami['on'](_0x5885('0x25'),function(_0x225733){try{utils[_0x5885('0x1c')](util['format']('[%s][index][agentconnect]',_0x225733[_0x5885('0x22')]),_0x225733);agents['agentconnect'](_0x225733);queues[_0x5885('0x25')](_0x225733);}catch(_0x9e109c){utils['error'](util[_0x5885('0x21')](_0x5885('0x26'),_0x225733[_0x5885('0x22')]),_0x9e109c);}});ami['on'](_0x5885('0x27'),function(_0x55bb4b){try{utils['debug'](util[_0x5885('0x21')](_0x5885('0x28'),_0x55bb4b[_0x5885('0x22')]),_0x55bb4b);agents[_0x5885('0x27')](_0x55bb4b);queues['agentcomplete'](_0x55bb4b);members[_0x5885('0x27')](_0x55bb4b);}catch(_0xf794e9){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x28'),_0x55bb4b['uniqueid']),_0xf794e9);}});ami['on'](_0x5885('0x29'),function(_0x37a0e5){try{utils['debug'](util[_0x5885('0x21')]('[%s][index][queuecallerabandon]',_0x37a0e5[_0x5885('0x22')]),_0x37a0e5);agents[_0x5885('0x29')](_0x37a0e5);queues['queuecallerabandon'](_0x37a0e5);}catch(_0x5e5160){utils['error'](util[_0x5885('0x21')](_0x5885('0x2a'),_0x37a0e5['uniqueid']),_0x5e5160);}});ami['on'](_0x5885('0x2b'),function(_0x11be6a){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][queuecallerjoin]',_0x11be6a[_0x5885('0x22')]),_0x11be6a);queues[_0x5885('0x2b')](_0x11be6a);recordings[_0x5885('0x2b')](_0x11be6a);}catch(_0x38257e){utils[_0x5885('0x18')](util['format'](_0x5885('0x2c'),_0x11be6a[_0x5885('0x22')]),_0x38257e);}});ami['on']('queuecallerleave',function(_0x3e3bd5){try{utils['debug'](util[_0x5885('0x21')](_0x5885('0x2d'),_0x3e3bd5['uniqueid']),_0x3e3bd5);queues['queuecallerleave'](_0x3e3bd5);}catch(_0x5e4c68){utils[_0x5885('0x18')](util[_0x5885('0x21')]('[%s][index][queuecallerleave]',_0x3e3bd5[_0x5885('0x22')]),_0x5e4c68);}});ami['on']('musiconholdstart',function(_0x1774ed){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][musiconholdstart]',_0x1774ed[_0x5885('0x22')]),_0x1774ed);queues[_0x5885('0x2e')](_0x1774ed);calls[_0x5885('0x2e')](_0x1774ed);}catch(_0x3cc476){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x2f'),_0x1774ed[_0x5885('0x22')]),_0x3cc476);}});ami['on']('musiconholdstop',function(_0x853d65){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')](_0x5885('0x30'),_0x853d65['uniqueid']),_0x853d65);queues[_0x5885('0x31')](_0x853d65);calls[_0x5885('0x31')](_0x853d65);}catch(_0x52d04e){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x30'),_0x853d65[_0x5885('0x22')]),_0x52d04e);}});ami['on'](_0x5885('0x32'),function(_0x3cb845){try{utils['debug'](util[_0x5885('0x21')](_0x5885('0x33'),_0x3cb845['uniqueid']),_0x3cb845);calls['newstate'](_0x3cb845);recordings['newstate'](_0x3cb845);}catch(_0x1dba3e){utils['error'](util['format']('[%s][index][newstate]',_0x3cb845['uniqueid']),_0x1dba3e);}});ami['on']('hangup',function(_0x59d92e){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][hangup]',_0x59d92e[_0x5885('0x22')]),_0x59d92e);calls['hangup'](_0x59d92e);recordings['hangup'](_0x59d92e);dials[_0x5885('0x34')](_0x59d92e);agents[_0x5885('0x34')](_0x59d92e);queues['hangup'](_0x59d92e);}catch(_0x410d74){utils[_0x5885('0x18')](util['format']('[%s][index][hangup]',_0x59d92e[_0x5885('0x22')]),_0x410d74);}});ami['on']('cdr',function(_0x27c579){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][cdr]',_0x27c579[_0x5885('0x22')]),_0x27c579);members[_0x5885('0x35')](_0x27c579);}catch(_0x119b0d){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x36'),_0x27c579[_0x5885('0x22')]),_0x119b0d);}});ami['on'](_0x5885('0x37'),function(_0xca17cc){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][blindtransfer]',_0xca17cc[_0x5885('0x22')]),_0xca17cc);queues[_0x5885('0x37')](_0xca17cc);agents['blindtransfer'](_0xca17cc);transfers[_0x5885('0x37')](_0xca17cc);}catch(_0x473d2b){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x38'),_0xca17cc[_0x5885('0x22')]),_0x473d2b);}});ami['on']('attendedtransfer',function(_0x5a8a83){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][attendedtransfer]',_0x5a8a83[_0x5885('0x39')]),_0x5a8a83);queues[_0x5885('0x3a')](_0x5a8a83);transfers['attendedtransfer'](_0x5a8a83);agents[_0x5885('0x3a')](_0x5a8a83);calls[_0x5885('0x3a')](_0x5a8a83);}catch(_0x293c58){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x3b'),_0x5a8a83['origtransfereruniqueid']),_0x293c58);}});ami['on'](_0x5885('0x3c'),function(_0x1390c3){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')]('[%s][index][varset]',_0x1390c3[_0x5885('0x22')]),_0x1390c3);queues[_0x5885('0x3c')](_0x1390c3);recordings[_0x5885('0x3c')](_0x1390c3);calls[_0x5885('0x3c')](_0x1390c3);dials[_0x5885('0x3c')](_0x1390c3);}catch(_0x5daa89){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x3d'),_0x1390c3[_0x5885('0x22')]),_0x5daa89);}});ami['on'](_0x5885('0x3e'),function(_0x85c94e){try{utils[_0x5885('0x1c')](util[_0x5885('0x21')](_0x5885('0x3f'),_0x85c94e['uniqueid']),_0x85c94e);calls['newexten'](_0x85c94e);recordings[_0x5885('0x3e')](_0x85c94e);dials['newexten'](_0x85c94e);}catch(_0x4fa30e){utils[_0x5885('0x18')](util[_0x5885('0x21')]('[%s][index][newexten]',_0x85c94e['uniqueid']),_0x4fa30e);}});ami['on'](_0x5885('0x40'),function(_0x3a0cd3){try{utils[_0x5885('0x1c')](util['format']('[%s][index][newchannel]',_0x3a0cd3[_0x5885('0x22')]),_0x3a0cd3);calls[_0x5885('0x40')](_0x3a0cd3);recordings['newchannel'](_0x3a0cd3);}catch(_0x20ce8f){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x41'),_0x3a0cd3[_0x5885('0x22')]),_0x20ce8f);}});ami['on'](_0x5885('0x42'),function(_0x314033){try{utils[_0x5885('0x1c')](util['format']('[%s][index][dialbegin]',_0x314033[_0x5885('0x22')]),_0x314033);dials[_0x5885('0x42')](_0x314033);}catch(_0x2711b6){utils[_0x5885('0x18')](util['format'](_0x5885('0x43'),_0x314033[_0x5885('0x22')]),_0x2711b6);}});ami['on'](_0x5885('0x44'),function(_0x308ea3){try{utils[_0x5885('0x1c')](util['format'](_0x5885('0x45'),_0x308ea3[_0x5885('0x22')]),_0x308ea3);dials[_0x5885('0x44')](_0x308ea3);}catch(_0x59143f){utils[_0x5885('0x18')](util[_0x5885('0x21')](_0x5885('0x45'),_0x308ea3[_0x5885('0x22')]),_0x59143f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a855977..2085455 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 _0xcc8d=['startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','cdr','isNil','assign','data1','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','source','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','[%s][members][writeDB]','some'];(function(_0x4f33cb,_0x46c73d){var _0x2b2dbd=function(_0x2e4abf){while(--_0x2e4abf){_0x4f33cb['push'](_0x4f33cb['shift']());}};_0x2b2dbd(++_0x46c73d);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xcc8d[_0x2d9e27];return _0xd35381;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var utils=require(_0xdcc8('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0xdc9cc2){utils[_0xdcc8('0x2')](util[_0xdcc8('0x3')](_0xdcc8('0x4'),_0xdc9cc2[_0xdcc8('0x5')],_0xdc9cc2[_0xdcc8('0x6')],_0xdc9cc2[_0xdcc8('0x7')],_0xdc9cc2['data2'],_0xdc9cc2[_0xdcc8('0x8')],_0xdc9cc2[_0xdcc8('0x9')]));if(_0xdc9cc2[_0xdcc8('0x6')]){utils[_0xdcc8('0xa')](_0xdc9cc2[_0xdcc8('0x6')])['then'](function(_0x2bdaff){if(_0x2bdaff){_0xdc9cc2[_0xdcc8('0x8')]=_0x2bdaff[_0xdcc8('0xb')];_0xdc9cc2[_0xdcc8('0xc')]=_0x2bdaff[_0xdcc8('0xc')];utils[_0xdcc8('0xd')](_0xdcc8('0xe'),_0xdc9cc2);}else{utils[_0xdcc8('0xf')](_0xdc9cc2[_0xdcc8('0x6')][_0xdcc8('0x10')]('/')[0x1])[_0xdcc8('0x11')](function(_0x312dd7){if(_0x312dd7){_0xdc9cc2['membername']=_0x312dd7[_0xdcc8('0xb')];_0xdc9cc2[_0xdcc8('0xc')]=_0x312dd7['internal'];utils[_0xdcc8('0xd')](_0xdcc8('0xe'),_0xdc9cc2);}});}})[_0xdcc8('0x12')](function(_0x378a27){utils['error'](util[_0xdcc8('0x3')](_0xdcc8('0x13'),_0xdc9cc2['uniqueid']),_0x378a27);});}delete members[_0xdc9cc2[_0xdcc8('0x6')]];}function startsWith(_0x54541f,_0x5f599){return _[_0xdcc8('0x14')](_0x54541f,function(_0xc04807){return _[_0xdcc8('0x15')](_0x5f599,_0xc04807);});}exports[_0xdcc8('0x16')]=function(_0x12ace8){try{utils[_0xdcc8('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x12ace8['device']]?members[_0x12ace8['device']]['uniqueid']:_0x12ace8[_0xdcc8('0x18')]),_0x12ace8);utils['info'](util[_0xdcc8('0x3')](_0xdcc8('0x19'),members[_0x12ace8[_0xdcc8('0x18')]]?members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x5')]:_0x12ace8['device'],_0x12ace8['state'],_0x12ace8[_0xdcc8('0x18')]));switch(_0x12ace8[_0xdcc8('0x1a')]){case _0xdcc8('0x1b'):case _0xdcc8('0x1c'):if(!startsWith(exclude,_0x12ace8[_0xdcc8('0x18')])){members[_0x12ace8[_0xdcc8('0x18')]]={'channel':_0xdcc8('0x1d'),'interface':_0x12ace8[_0xdcc8('0x18')],'type':_0xdcc8('0x1e'),'enterAt':utils[_0xdcc8('0x1f')](),'role':_0xdcc8('0x20')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x12ace8['device']])){members[_0x12ace8['device']][_0xdcc8('0x21')]=utils[_0xdcc8('0x1f')]();members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x22')]=utils[_0xdcc8('0x23')](members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x21')],members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x24')]);if(members[_0x12ace8[_0xdcc8('0x18')]]['uniqueid']){writeDB(members[_0x12ace8[_0xdcc8('0x18')]]);}}break;default:break;}}catch(_0x938201){utils[_0xdcc8('0x25')](util['format'](_0xdcc8('0x26'),members[_0x12ace8['device']]?members[_0x12ace8[_0xdcc8('0x18')]][_0xdcc8('0x5')]:_0x12ace8[_0xdcc8('0x18')]),_0x938201);}};exports[_0xdcc8('0x27')]=function(_0x16c40c){try{if(!_['isNil'](members[_0x16c40c[_0xdcc8('0x6')]])){utils[_0xdcc8('0x17')](util[_0xdcc8('0x3')](_0xdcc8('0x28'),_0x16c40c['uniqueid']),_0x16c40c);utils['info'](util[_0xdcc8('0x3')](_0xdcc8('0x29'),_0x16c40c['uniqueid'],_0x16c40c[_0xdcc8('0x6')],_0x16c40c['queue']));members[_0x16c40c[_0xdcc8('0x6')]]=_['assign'](members[_0x16c40c[_0xdcc8('0x6')]],{'data4':_0x16c40c['queue'],'uniqueid':_0x16c40c[_0xdcc8('0x5')]});}}catch(_0x12e101){utils[_0xdcc8('0x25')](util['format'](_0xdcc8('0x28'),_0x16c40c['uniqueid']),_0x12e101);}};exports[_0xdcc8('0x2a')]=function(_0x262e07){try{utils['debug'](util['format']('[%s][members][cdr]',_0x262e07[_0xdcc8('0x5')]),_0x262e07);if(_0x262e07[_0xdcc8('0x7')]){var _0x2e506a=_0x262e07[_0xdcc8('0x7')][_0xdcc8('0x10')]('-')[0x0];if(!_[_0xdcc8('0x2b')](members[_0x2e506a])){members[_0x2e506a]=_[_0xdcc8('0x2c')](members[_0x2e506a],{'data1':members[_0x2e506a][_0xdcc8('0x2d')]||_0x262e07['type'],'data2':members[_0x2e506a][_0xdcc8('0x2e')]||_0x262e07['source'],'data3':members[_0x2e506a]['data3']||_0x262e07[_0xdcc8('0x2f')],'uniqueid':members[_0x2e506a][_0xdcc8('0x5')]||_0x262e07['uniqueid']});utils[_0xdcc8('0x2')](util['format'](_0xdcc8('0x30'),_0x262e07[_0xdcc8('0x5')],members[_0x2e506a][_0xdcc8('0x2d')],members[_0x2e506a][_0xdcc8('0x2e')],members[_0x2e506a][_0xdcc8('0x31')]));if(members[_0x2e506a]['exitAt']){writeDB(members[_0x2e506a]);}}}if(_0x262e07[_0xdcc8('0x32')]){var _0x4bf1b0=_0x262e07[_0xdcc8('0x32')]['split']('-')[0x0];if(!_[_0xdcc8('0x2b')](members[_0x4bf1b0])){members[_0x4bf1b0]=_[_0xdcc8('0x2c')](members[_0x4bf1b0],{'data1':members[_0x4bf1b0][_0xdcc8('0x2d')]||_0x262e07[_0xdcc8('0x9')],'data2':members[_0x4bf1b0]['data2']||_0x262e07[_0xdcc8('0x33')],'data3':members[_0x4bf1b0][_0xdcc8('0x31')]||_0x262e07[_0xdcc8('0x2f')],'uniqueid':members[_0x4bf1b0][_0xdcc8('0x5')]||_0x262e07['uniqueid']});utils[_0xdcc8('0x2')](util['format'](_0xdcc8('0x30'),_0x262e07[_0xdcc8('0x5')],members[_0x4bf1b0][_0xdcc8('0x2d')],members[_0x4bf1b0]['data2'],members[_0x4bf1b0][_0xdcc8('0x31')]));if(members[_0x4bf1b0]['exitAt']){writeDB(members[_0x4bf1b0]);}}}}catch(_0x1c2c10){utils[_0xdcc8('0x25')](util[_0xdcc8('0x3')]('[%s][members][cdr]',_0x262e07[_0xdcc8('0x5')]),_0x1c2c10);}}; \ No newline at end of file +var _0xea4b=['device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','now','diffTime','exitAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','then','membername','name','internal','request','CreateMemberReport','split','catch','error','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]'];(function(_0x1bbe64,_0x57278d){var _0x1fa64b=function(_0x20be92){while(--_0x20be92){_0x1bbe64['push'](_0x1bbe64['shift']());}};_0x1fa64b(++_0x57278d);}(_0xea4b,0x7a));var _0xbea4=function(_0x261b1f,_0x594b1f){_0x261b1f=_0x261b1f-0x0;var _0x56529a=_0xea4b[_0x261b1f];return _0x56529a;};'use strict';var _=require(_0xbea4('0x0'));var util=require(_0xbea4('0x1'));var utils=require(_0xbea4('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1d2db4){utils[_0xbea4('0x3')](util['format'](_0xbea4('0x4'),_0x1d2db4[_0xbea4('0x5')],_0x1d2db4[_0xbea4('0x6')],_0x1d2db4[_0xbea4('0x7')],_0x1d2db4[_0xbea4('0x8')],_0x1d2db4['membername'],_0x1d2db4[_0xbea4('0x9')]));if(_0x1d2db4[_0xbea4('0x6')]){utils['getUserByInterface'](_0x1d2db4[_0xbea4('0x6')])[_0xbea4('0xa')](function(_0x254caa){if(_0x254caa){_0x1d2db4[_0xbea4('0xb')]=_0x254caa[_0xbea4('0xc')];_0x1d2db4[_0xbea4('0xd')]=_0x254caa[_0xbea4('0xd')];utils[_0xbea4('0xe')](_0xbea4('0xf'),_0x1d2db4);}else{utils['getUserByName'](_0x1d2db4[_0xbea4('0x6')][_0xbea4('0x10')]('/')[0x1])[_0xbea4('0xa')](function(_0xe3ded9){if(_0xe3ded9){_0x1d2db4['membername']=_0xe3ded9['name'];_0x1d2db4[_0xbea4('0xd')]=_0xe3ded9['internal'];utils['request'](_0xbea4('0xf'),_0x1d2db4);}});}})[_0xbea4('0x11')](function(_0x499740){utils[_0xbea4('0x12')](util[_0xbea4('0x13')](_0xbea4('0x14'),_0x1d2db4[_0xbea4('0x5')]),_0x499740);});}delete members[_0x1d2db4[_0xbea4('0x6')]];}function startsWith(_0xc48999,_0x58e3a0){return _[_0xbea4('0x15')](_0xc48999,function(_0x2a5685){return _[_0xbea4('0x16')](_0x58e3a0,_0x2a5685);});}exports['devicestatechange']=function(_0x29ce50){try{utils[_0xbea4('0x17')](util['format'](_0xbea4('0x18'),members[_0x29ce50[_0xbea4('0x19')]]?members[_0x29ce50[_0xbea4('0x19')]]['uniqueid']:_0x29ce50[_0xbea4('0x19')]),_0x29ce50);utils[_0xbea4('0x3')](util[_0xbea4('0x13')](_0xbea4('0x1a'),members[_0x29ce50[_0xbea4('0x19')]]?members[_0x29ce50[_0xbea4('0x19')]]['uniqueid']:_0x29ce50['device'],_0x29ce50[_0xbea4('0x1b')],_0x29ce50[_0xbea4('0x19')]));switch(_0x29ce50[_0xbea4('0x1b')]){case _0xbea4('0x1c'):case _0xbea4('0x1d'):if(!startsWith(exclude,_0x29ce50['device'])){members[_0x29ce50[_0xbea4('0x19')]]={'channel':_0xbea4('0x1e'),'interface':_0x29ce50[_0xbea4('0x19')],'type':'TALKING','enterAt':utils['now'](),'role':_0xbea4('0x1f')};}break;case _0xbea4('0x20'):if(!_[_0xbea4('0x21')](members[_0x29ce50[_0xbea4('0x19')]])){members[_0x29ce50[_0xbea4('0x19')]]['exitAt']=utils[_0xbea4('0x22')]();members[_0x29ce50[_0xbea4('0x19')]]['duration']=utils[_0xbea4('0x23')](members[_0x29ce50['device']][_0xbea4('0x24')],members[_0x29ce50[_0xbea4('0x19')]]['enterAt']);if(members[_0x29ce50[_0xbea4('0x19')]]['uniqueid']){writeDB(members[_0x29ce50['device']]);}}break;default:break;}}catch(_0x32fb2f){utils['error'](util[_0xbea4('0x13')](_0xbea4('0x18'),members[_0x29ce50[_0xbea4('0x19')]]?members[_0x29ce50[_0xbea4('0x19')]][_0xbea4('0x5')]:_0x29ce50[_0xbea4('0x19')]),_0x32fb2f);}};exports[_0xbea4('0x25')]=function(_0x4a6f7b){try{if(!_['isNil'](members[_0x4a6f7b[_0xbea4('0x6')]])){utils['debug'](util[_0xbea4('0x13')](_0xbea4('0x26'),_0x4a6f7b[_0xbea4('0x5')]),_0x4a6f7b);utils[_0xbea4('0x3')](util[_0xbea4('0x13')](_0xbea4('0x27'),_0x4a6f7b['uniqueid'],_0x4a6f7b['interface'],_0x4a6f7b[_0xbea4('0x28')]));members[_0x4a6f7b['interface']]=_[_0xbea4('0x29')](members[_0x4a6f7b['interface']],{'data4':_0x4a6f7b[_0xbea4('0x28')],'uniqueid':_0x4a6f7b['uniqueid']});}}catch(_0xb73731){utils[_0xbea4('0x12')](util[_0xbea4('0x13')](_0xbea4('0x26'),_0x4a6f7b[_0xbea4('0x5')]),_0xb73731);}};exports['cdr']=function(_0x14122f){try{utils[_0xbea4('0x17')](util['format'](_0xbea4('0x2a'),_0x14122f[_0xbea4('0x5')]),_0x14122f);if(_0x14122f[_0xbea4('0x7')]){var _0x17c023=_0x14122f[_0xbea4('0x7')]['split']('-')[0x0];if(!_[_0xbea4('0x21')](members[_0x17c023])){members[_0x17c023]=_[_0xbea4('0x29')](members[_0x17c023],{'data1':members[_0x17c023][_0xbea4('0x2b')]||_0x14122f['type'],'data2':members[_0x17c023]['data2']||_0x14122f['source'],'data3':members[_0x17c023][_0xbea4('0x2c')]||_0x14122f[_0xbea4('0x2d')],'uniqueid':members[_0x17c023][_0xbea4('0x5')]||_0x14122f[_0xbea4('0x5')]});utils['info'](util[_0xbea4('0x13')](_0xbea4('0x2e'),_0x14122f[_0xbea4('0x5')],members[_0x17c023][_0xbea4('0x2b')],members[_0x17c023][_0xbea4('0x8')],members[_0x17c023][_0xbea4('0x2c')]));if(members[_0x17c023]['exitAt']){writeDB(members[_0x17c023]);}}}if(_0x14122f['destinationchannel']){var _0x423ba4=_0x14122f[_0xbea4('0x2f')][_0xbea4('0x10')]('-')[0x0];if(!_['isNil'](members[_0x423ba4])){members[_0x423ba4]=_[_0xbea4('0x29')](members[_0x423ba4],{'data1':members[_0x423ba4][_0xbea4('0x2b')]||_0x14122f[_0xbea4('0x9')],'data2':members[_0x423ba4]['data2']||_0x14122f[_0xbea4('0x30')],'data3':members[_0x423ba4][_0xbea4('0x2c')]||_0x14122f[_0xbea4('0x2d')],'uniqueid':members[_0x423ba4][_0xbea4('0x5')]||_0x14122f[_0xbea4('0x5')]});utils[_0xbea4('0x3')](util[_0xbea4('0x13')](_0xbea4('0x2e'),_0x14122f[_0xbea4('0x5')],members[_0x423ba4][_0xbea4('0x2b')],members[_0x423ba4][_0xbea4('0x8')],members[_0x423ba4][_0xbea4('0x2c')]));if(members[_0x423ba4][_0xbea4('0x24')]){writeDB(members[_0x423ba4]);}}}}catch(_0x28958b){utils[_0xbea4('0x12')](util[_0xbea4('0x13')](_0xbea4('0x2a'),_0x14122f[_0xbea4('0x5')]),_0x28958b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 962e48c..4229f4e 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 _0x9164=['[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','EXITWITHKEY','debug','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]'];(function(_0x5e62bc,_0x1d0f50){var _0x3de977=function(_0x54f435){while(--_0x54f435){_0x5e62bc['push'](_0x5e62bc['shift']());}};_0x3de977(++_0x1d0f50);}(_0x9164,0x175));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4916('0x0'));var util=require('util');var utils=require(_0x4916('0x1'));var queues={};function writeDB(_0x338ccf){utils['info'](util[_0x4916('0x2')](_0x4916('0x3'),_0x338ccf['uniqueid'],_0x338ccf['channel'],_0x338ccf[_0x4916('0x4')],_0x338ccf[_0x4916('0x5')],_0x338ccf[_0x4916('0x6')],_0x338ccf[_0x4916('0x7')],_0x338ccf['queuecallerexitreason']));if(_0x338ccf[_0x4916('0x4')]){utils[_0x4916('0x8')](_0x338ccf[_0x4916('0x4')])[_0x4916('0x9')](function(_0x18f252){if(_0x18f252){_0x338ccf[_0x4916('0xa')]=_0x18f252['type'];}utils[_0x4916('0xb')](_0x4916('0xc'),_0x338ccf);});}else{utils[_0x4916('0xb')](_0x4916('0xc'),_0x338ccf);}if(_0x338ccf[_0x4916('0xd')]){delete queues[_0x338ccf[_0x4916('0xd')]];}else{delete queues[_0x338ccf[_0x4916('0xe')]];}}exports['queuecallerjoin']=function(_0x105e7e){try{utils['debug'](util[_0x4916('0x2')](_0x4916('0xf'),_0x105e7e[_0x4916('0xe')]),_0x105e7e);utils['info'](util['format'](_0x4916('0x10'),_0x105e7e[_0x4916('0xe')],_0x105e7e['queue'],_0x105e7e[_0x4916('0x11')]));queues[_0x105e7e['uniqueid']]=_[_0x4916('0x12')](_0x105e7e,{'originalposition':_0x105e7e[_0x4916('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x225805){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0xf'),_0x105e7e[_0x4916('0xe')]),_0x225805);}};exports[_0x4916('0x14')]=function(_0x1a26b5){try{if(!_['isNil'](queues[_0x1a26b5[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')]('[%s][queues][hangup]',_0x1a26b5[_0x4916('0xe')]),_0x1a26b5);if(queues[_0x1a26b5['uniqueid']][_0x4916('0x15')]){if(!queues[_0x1a26b5[_0x4916('0xe')]]['queuecallerabandon']&&!queues[_0x1a26b5['uniqueid']][_0x4916('0x16')]){queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x17')]=!![];queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x18')]=utils[_0x4916('0x19')]();queues[_0x1a26b5['uniqueid']][_0x4916('0x1a')]=_0x4916('0x1b');}utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x1d'),_0x1a26b5[_0x4916('0xe')],queues[_0x1a26b5[_0x4916('0xe')]]['name'],queues[_0x1a26b5[_0x4916('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x1a26b5[_0x4916('0xe')]]);}else if(queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0xd')]){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x1e'),_0x1a26b5[_0x4916('0xe')],queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x1a26b5[_0x4916('0xe')]][_0x4916('0xd')]));queues[queues[_0x1a26b5[_0x4916('0xe')]]['transfereduniqueid']]=queues[_0x1a26b5['uniqueid']];queues[queues[_0x1a26b5['uniqueid']][_0x4916('0xd')]][_0x4916('0x20')]=0x2;delete queues[_0x1a26b5[_0x4916('0xe')]];}}}catch(_0x17913f){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x21'),_0x1a26b5[_0x4916('0xe')]),_0x17913f);}};exports[_0x4916('0x22')]=function(_0x42acc5){try{utils['debug'](util['format'](_0x4916('0x23'),_0x42acc5[_0x4916('0xe')]),_0x42acc5);if(!_[_0x4916('0x24')](_0x42acc5[_0x4916('0x25')][_0x4916('0x26')])&&_0x42acc5[_0x4916('0x27')][_0x4916('0x28')]()!==_0x4916('0x29')){if(!_['isNil'](queues[_0x42acc5['uniqueid']])){queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2b')]=null;queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x16')]=!![];queues[_0x42acc5['uniqueid']]['queuecallerexitAt']=utils[_0x4916('0x19')]();queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1a')]=_0x42acc5['value'][_0x4916('0x28')]();utils[_0x4916('0x1c')](util[_0x4916('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x42acc5[_0x4916('0xe')],queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1f')],_0x42acc5[_0x4916('0x27')],queues[_0x42acc5['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x42acc5[_0x4916('0xe')]]);}}else if(!_['isNil'](_0x42acc5[_0x4916('0x25')]['queueposition'])){if(!_[_0x4916('0x24')](queues[_0x42acc5[_0x4916('0xe')]])&&!queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]){queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x42acc5['uniqueid']][_0x4916('0x2b')]=null;queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x16')]=!![];queues[_0x42acc5['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x42acc5[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x2c');utils['info'](util[_0x4916('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x42acc5[_0x4916('0xe')],queues[_0x42acc5['uniqueid']][_0x4916('0x1f')],_0x42acc5[_0x4916('0x27')],queues[_0x42acc5[_0x4916('0xe')]]['queuecallerexitreason']));}}}catch(_0x47d970){utils['error'](util[_0x4916('0x2')](_0x4916('0x23'),_0x42acc5['uniqueid']),_0x47d970);}};exports['queuecallerabandon']=function(_0x47a731){try{if(!_[_0x4916('0x24')](queues[_0x47a731['uniqueid']])){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x2e'),_0x47a731['uniqueid']),_0x47a731);queues[_0x47a731['uniqueid']]['queuecallerexit']=![];queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2f')]=null;queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2a')]=!![];queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x2b')]=utils[_0x4916('0x19')]();queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x30');utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x31'),_0x47a731[_0x4916('0xe')],queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x47a731[_0x4916('0xe')]][_0x4916('0x1a')]));}}catch(_0x477aad){utils['error'](util[_0x4916('0x2')](_0x4916('0x2e'),_0x47a731[_0x4916('0xe')]),_0x477aad);}};exports[_0x4916('0x32')]=function(_0x5671dd){try{if(!_['isNil'](queues[_0x5671dd[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')](_0x4916('0x33'),_0x5671dd[_0x4916('0xe')]),_0x5671dd);utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x34'),_0x5671dd[_0x4916('0xe')],queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x1f')],_0x5671dd[_0x4916('0x35')],_0x5671dd['connectedlinename']));queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x32')]=!![];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x15')]=utils[_0x4916('0x19')]();queues[_0x5671dd[_0x4916('0xe')]]['holdtime']=utils[_0x4916('0x36')](queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x15')],queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x37')]);queues[_0x5671dd[_0x4916('0xe')]]['position']=_0x5671dd[_0x4916('0x11')];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x38')]=_0x5671dd[_0x4916('0x38')];queues[_0x5671dd[_0x4916('0xe')]]['connectedlinenum']=_0x5671dd[_0x4916('0x35')];queues[_0x5671dd[_0x4916('0xe')]][_0x4916('0x39')]=_0x5671dd[_0x4916('0x39')];}}catch(_0x578645){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x33'),_0x5671dd[_0x4916('0xe')]),_0x578645);}};exports['agentconnect']=function(_0x44d05f){try{if(!_[_0x4916('0x24')](queues[_0x44d05f[_0x4916('0xe')]])){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x3a'),_0x44d05f[_0x4916('0xe')]),_0x44d05f);utils[_0x4916('0x1c')](util['format'](_0x4916('0x3b'),_0x44d05f['uniqueid'],queues[_0x44d05f['uniqueid']]['name'],_0x44d05f[_0x4916('0x3c')],_0x44d05f[_0x4916('0x3d')]));queues[_0x44d05f[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x44d05f['uniqueid']][_0x4916('0x2a')]=![];queues[_0x44d05f[_0x4916('0xe')]]['queuecallerabandonAt']=null;queues[_0x44d05f[_0x4916('0xe')]][_0x4916('0x16')]=![];queues[_0x44d05f[_0x4916('0xe')]]['queuecallerexitreason']=null;queues[_0x44d05f['uniqueid']][_0x4916('0x2f')]=null;queues[_0x44d05f[_0x4916('0xe')]]['assigned']=!![];queues[_0x44d05f[_0x4916('0xe')]]['accountcode']=_0x44d05f['destaccountcode'];queues[_0x44d05f['uniqueid']][_0x4916('0x5')]=_0x44d05f[_0x4916('0x3c')];}}catch(_0x4cb367){utils['error'](util[_0x4916('0x2')](_0x4916('0x3a'),_0x44d05f[_0x4916('0xe')]),_0x4cb367);}};exports[_0x4916('0x3e')]=function(_0x157f3b){try{if(!_[_0x4916('0x24')](queues[_0x157f3b[_0x4916('0xe')]])){if(queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x15')]){utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x3f'),_0x157f3b['uniqueid']),_0x157f3b);queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x2a')]=![];queues[_0x157f3b[_0x4916('0xe')]]['queuecallerabandon']=![];queues[_0x157f3b['uniqueid']][_0x4916('0x2b')]=null;queues[_0x157f3b[_0x4916('0xe')]]['queuecallerexit']=![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x2f')]=null;queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x40')]=!![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x5')]=_0x157f3b[_0x4916('0x3c')];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x17')]=!![];queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x18')]=utils[_0x4916('0x19')]();if(_0x157f3b['reason']==_0x4916('0x41')){if(!queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x41')]){queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1a')]=_0x4916('0x42');}}else{queues[_0x157f3b[_0x4916('0xe')]]['queuecallerexitreason']=_0x4916('0x43')+_0x157f3b[_0x4916('0x44')][_0x4916('0x28')]();}utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x45'),_0x157f3b[_0x4916('0xe')],queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1f')],_0x157f3b['membername'],queues[_0x157f3b[_0x4916('0xe')]][_0x4916('0x1a')]));writeDB(queues[_0x157f3b[_0x4916('0xe')]]);}}}catch(_0x4da865){utils[_0x4916('0x13')](util['format'](_0x4916('0x3f'),_0x157f3b[_0x4916('0xe')]),_0x4da865);}};exports[_0x4916('0x46')]=function(_0x468751){try{if(!_[_0x4916('0x24')](queues[_0x468751[_0x4916('0x47')]])){utils[_0x4916('0x2d')](util[_0x4916('0x2')]('[%s][queues][blindtransfer]',_0x468751['uniqueid']),_0x468751);queues[_0x468751['transfereeuniqueid']]['transfer']=!![];queues[_0x468751[_0x4916('0x47')]]['transfertype']=_0x4916('0x48');queues[_0x468751['transfereeuniqueid']][_0x4916('0x49')]=_0x468751[_0x4916('0x4a')];queues[_0x468751['transfereeuniqueid']]['transferuniqueid']=_0x468751[_0x4916('0x47')];queues[_0x468751[_0x4916('0x47')]]['queuecallerexitreason']=_0x4916('0x4b');utils[_0x4916('0x1c')](util['format'](_0x4916('0x4c'),_0x468751[_0x4916('0xe')],queues[_0x468751[_0x4916('0x47')]][_0x4916('0x1f')],_0x468751[_0x4916('0x47')],_0x468751[_0x4916('0x4a')]));}}catch(_0x18d66e){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x4d'),_0x468751['uniqueid']),_0x18d66e);}};exports[_0x4916('0x4e')]=function(_0x825dbe){try{utils[_0x4916('0x2d')](util[_0x4916('0x2')](_0x4916('0x4f'),_0x825dbe['origtransfereruniqueid']),_0x825dbe);if(_0x825dbe[_0x4916('0x50')]==_0x825dbe[_0x4916('0x51')]){if(!_[_0x4916('0x24')](queues[_0x825dbe['secondtransfererlinkedid']])){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x52'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe['secondtransfererlinkedid']]['name'],_0x825dbe[_0x4916('0x53')]));queues[_0x825dbe['secondtransfererlinkedid']][_0x4916('0x41')]=!![];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x55')]=_0x4916('0x56');queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x49')]=_0x825dbe['origtransfererexten'];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x57')]=_0x825dbe[_0x4916('0x50')];queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x1a')]=_0x4916('0x58');}if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x51')]])){if(_0x825dbe['transfereelinkedid']&&queues[_0x825dbe[_0x4916('0x59')]]){queues[_0x825dbe[_0x4916('0x59')]][_0x4916('0x20')]=0x1;queues[_0x825dbe[_0x4916('0x47')]]=_[_0x4916('0x5a')](queues[_0x825dbe[_0x4916('0x59')]]);queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0xd')]=_0x825dbe[_0x4916('0x5b')];queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x20')]=0x2;queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x6')]=queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x6')];queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x5c')]=queues[_0x825dbe['secondtransfererlinkedid']][_0x4916('0x5c')];queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x37')]=utils['now']();queues[_0x825dbe[_0x4916('0x47')]]['queuecallerleaveAt']=utils[_0x4916('0x19')]();queues[_0x825dbe['transfereeuniqueid']][_0x4916('0x5d')]=0x0;queues[_0x825dbe['transfereeuniqueid']]['mohtime']=0x0;utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x5e'),_0x825dbe['origtransfereruniqueid'],queues[_0x825dbe[_0x4916('0x47')]]['name'],queues[_0x825dbe[_0x4916('0x47')]][_0x4916('0x6')],queues[_0x825dbe['transfereeuniqueid']]['calleridname']));}else{utils[_0x4916('0x1c')](util[_0x4916('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x1f')],_0x825dbe[_0x4916('0x54')]));queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0xd')]=_0x825dbe[_0x4916('0x54')];}}}else if(_0x825dbe[_0x4916('0x5f')]==_0x825dbe[_0x4916('0x54')]){if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x51')]])){utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x60'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0x1f')],_0x825dbe[_0x4916('0x5f')],_0x825dbe[_0x4916('0x61')]));queues[_0x825dbe[_0x4916('0x51')]]['transfer']=!![];queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x55')]=_0x4916('0x56');queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x49')]=_0x825dbe[_0x4916('0x61')];queues[_0x825dbe['origtransfererlinkedid']]['transferuniqueid']=_0x825dbe['secondtransfereruniqueid'];queues[_0x825dbe[_0x4916('0x51')]][_0x4916('0x1a')]=_0x4916('0x58');}if(!_[_0x4916('0x24')](queues[_0x825dbe[_0x4916('0x54')]])){if(_0x825dbe[_0x4916('0x62')]&&queues[_0x825dbe['transfertargetlinkedid']]){queues[_0x825dbe['transfertargetlinkedid']][_0x4916('0x20')]=0x1;queues[_0x825dbe['transfertargetuniqueid']]=_[_0x4916('0x5a')](queues[_0x825dbe['transfertargetlinkedid']]);queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0xd')]=_0x825dbe['transfertargetuniqueid'];queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x20')]=0x2;queues[_0x825dbe['transfertargetuniqueid']]['calleridnum']=queues[_0x825dbe['origtransfererlinkedid']]['calleridnum'];queues[_0x825dbe[_0x4916('0x5b')]]['calleridname']=queues[_0x825dbe['origtransfererlinkedid']][_0x4916('0x5c')];queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x37')]=utils[_0x4916('0x19')]();queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x15')]=utils[_0x4916('0x19')]();queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x5d')]=0x0;queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x63')]=0x0;utils['info'](util['format'](_0x4916('0x64'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x1f')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0xd')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x6')],queues[_0x825dbe[_0x4916('0x5b')]][_0x4916('0x5c')]));}else{utils['info'](util[_0x4916('0x2')](_0x4916('0x65'),_0x825dbe[_0x4916('0x50')],queues[_0x825dbe[_0x4916('0x54')]][_0x4916('0x1f')],_0x825dbe[_0x4916('0x51')]));queues[_0x825dbe[_0x4916('0x54')]]['transfereduniqueid']=_0x825dbe[_0x4916('0x51')];}}}}catch(_0x4b9541){utils[_0x4916('0x13')](util[_0x4916('0x2')](_0x4916('0x4f'),_0x825dbe[_0x4916('0x50')]),_0x4b9541);}};exports['musiconholdstart']=function(_0x1d1d9e){try{if(!_[_0x4916('0x24')](queues[_0x1d1d9e[_0x4916('0xe')]])){utils['debug'](util[_0x4916('0x2')](_0x4916('0x66'),_0x1d1d9e[_0x4916('0xe')]),_0x1d1d9e);queues[_0x1d1d9e[_0x4916('0xe')]][_0x4916('0x67')]=utils[_0x4916('0x19')]();utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x68'),_0x1d1d9e['uniqueid'],queues[_0x1d1d9e['uniqueid']][_0x4916('0x1f')],queues[_0x1d1d9e['uniqueid']][_0x4916('0x67')]));}}catch(_0x26b950){utils['error'](util[_0x4916('0x2')](_0x4916('0x66'),_0x1d1d9e['uniqueid']),_0x26b950);}};exports[_0x4916('0x69')]=function(_0x97a81e){try{if(!_[_0x4916('0x24')](queues[_0x97a81e[_0x4916('0xe')]])){if(!_[_0x4916('0x24')](queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x67')])){utils['debug'](util['format'](_0x4916('0x6a'),_0x97a81e[_0x4916('0xe')]),_0x97a81e);queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x63')]+=utils[_0x4916('0x36')](utils['now'](),queues[_0x97a81e['uniqueid']]['musiconholdstartAt']);utils[_0x4916('0x1c')](util[_0x4916('0x2')](_0x4916('0x6b'),_0x97a81e[_0x4916('0xe')],queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x1f')],queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x63')]));delete queues[_0x97a81e[_0x4916('0xe')]][_0x4916('0x67')];}}}catch(_0xca8dd0){utils[_0x4916('0x13')](util[_0x4916('0x2')]('[%s][queues][musiconholdstop]',_0x97a81e[_0x4916('0xe')]),_0xca8dd0);}}; \ No newline at end of file +var _0x0275=['debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','transfereduniqueid','queuecallerenterreason','[%s][queues][varset]','variable','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','connectedlinenum','connectedlinename','holdtime','diffTime','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport'];(function(_0x109163,_0x33e845){var _0x3e69b4=function(_0x8da5f6){while(--_0x8da5f6){_0x109163['push'](_0x109163['shift']());}};_0x3e69b4(++_0x33e845);}(_0x0275,0x1e8));var _0x5027=function(_0x36e26a,_0x3d4d69){_0x36e26a=_0x36e26a-0x0;var _0x394dd1=_0x0275[_0x36e26a];return _0x394dd1;};'use strict';var _=require(_0x5027('0x0'));var util=require(_0x5027('0x1'));var utils=require(_0x5027('0x2'));var queues={};function writeDB(_0x2eb973){utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x5'),_0x2eb973[_0x5027('0x6')],_0x2eb973[_0x5027('0x7')],_0x2eb973[_0x5027('0x8')],_0x2eb973[_0x5027('0x9')],_0x2eb973[_0x5027('0xa')],_0x2eb973[_0x5027('0xb')],_0x2eb973['queuecallerexitreason']));if(_0x2eb973[_0x5027('0x8')]){utils[_0x5027('0xc')](_0x2eb973[_0x5027('0x8')])[_0x5027('0xd')](function(_0x1d683c){if(_0x1d683c){_0x2eb973['type']=_0x1d683c[_0x5027('0xe')];}utils[_0x5027('0xf')](_0x5027('0x10'),_0x2eb973);});}else{utils[_0x5027('0xf')]('CreateVoiceQueueReport',_0x2eb973);}if(_0x2eb973['transfereduniqueid']){delete queues[_0x2eb973['transfereduniqueid']];}else{delete queues[_0x2eb973['uniqueid']];}}exports['queuecallerjoin']=function(_0x1e7e64){try{utils[_0x5027('0x11')](util[_0x5027('0x4')]('[%s][queues][queuecallerjoin]',_0x1e7e64[_0x5027('0x6')]),_0x1e7e64);utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x12'),_0x1e7e64[_0x5027('0x6')],_0x1e7e64[_0x5027('0x8')],_0x1e7e64[_0x5027('0x13')]));queues[_0x1e7e64[_0x5027('0x6')]]=_['assign'](_0x1e7e64,{'originalposition':_0x1e7e64[_0x5027('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2b9125){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x15'),_0x1e7e64[_0x5027('0x6')]),_0x2b9125);}};exports[_0x5027('0x16')]=function(_0x5ca58c){try{if(!_[_0x5027('0x17')](queues[_0x5ca58c['uniqueid']])){utils[_0x5027('0x11')](util[_0x5027('0x4')](_0x5027('0x18'),_0x5ca58c[_0x5027('0x6')]),_0x5ca58c);if(queues[_0x5ca58c['uniqueid']][_0x5027('0x19')]){if(!queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x1a')]&&!queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x1b')]){queues[_0x5ca58c['uniqueid']][_0x5027('0x1c')]=!![];queues[_0x5ca58c[_0x5027('0x6')]]['queuecallercompleteAt']=utils[_0x5027('0x1d')]();queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x1e')]='COMPLETEDBYAGENT';}utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x1f'),_0x5ca58c[_0x5027('0x6')],queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x20')],queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x1e')]));writeDB(queues[_0x5ca58c['uniqueid']]);}else if(queues[_0x5ca58c[_0x5027('0x6')]]['transfereduniqueid']){utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x21'),_0x5ca58c[_0x5027('0x6')],queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x20')],queues[_0x5ca58c[_0x5027('0x6')]]['transfereduniqueid']));queues[queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x22')]]=queues[_0x5ca58c['uniqueid']];queues[queues[_0x5ca58c[_0x5027('0x6')]][_0x5027('0x22')]][_0x5027('0x23')]=0x2;delete queues[_0x5ca58c['uniqueid']];}}}catch(_0x35cd58){utils['error'](util[_0x5027('0x4')](_0x5027('0x18'),_0x5ca58c[_0x5027('0x6')]),_0x35cd58);}};exports['varset']=function(_0xe28b89){try{utils[_0x5027('0x11')](util[_0x5027('0x4')](_0x5027('0x24'),_0xe28b89['uniqueid']),_0xe28b89);if(!_[_0x5027('0x17')](_0xe28b89[_0x5027('0x25')]['queuestatus'])&&_0xe28b89['value']['toUpperCase']()!==_0x5027('0x26')){if(!_['isNil'](queues[_0xe28b89['uniqueid']])){queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x1a')]=![];queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x27')]=null;queues[_0xe28b89['uniqueid']][_0x5027('0x1b')]=!![];queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x28')]=utils['now']();queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x1e')]=_0xe28b89[_0x5027('0x29')][_0x5027('0x2a')]();utils[_0x5027('0x3')](util['format'](_0x5027('0x2b'),_0xe28b89[_0x5027('0x6')],queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x20')],_0xe28b89['value'],queues[_0xe28b89[_0x5027('0x6')]]['queuecallerexitreason']));writeDB(queues[_0xe28b89[_0x5027('0x6')]]);}}else if(!_[_0x5027('0x17')](_0xe28b89[_0x5027('0x25')][_0x5027('0x2c')])){if(!_['isNil'](queues[_0xe28b89[_0x5027('0x6')]])&&!queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x1a')]){queues[_0xe28b89['uniqueid']][_0x5027('0x1a')]=![];queues[_0xe28b89['uniqueid']][_0x5027('0x27')]=null;queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x1b')]=!![];queues[_0xe28b89[_0x5027('0x6')]][_0x5027('0x28')]=utils[_0x5027('0x1d')]();queues[_0xe28b89['uniqueid']]['queuecallerexitreason']=_0x5027('0x2d');utils[_0x5027('0x3')](util['format'](_0x5027('0x2e'),_0xe28b89[_0x5027('0x6')],queues[_0xe28b89['uniqueid']][_0x5027('0x20')],_0xe28b89[_0x5027('0x29')],queues[_0xe28b89['uniqueid']][_0x5027('0x1e')]));}}}catch(_0x1d840c){utils[_0x5027('0x14')](util['format'](_0x5027('0x24'),_0xe28b89[_0x5027('0x6')]),_0x1d840c);}};exports[_0x5027('0x1a')]=function(_0x46b9d3){try{if(!_[_0x5027('0x17')](queues[_0x46b9d3[_0x5027('0x6')]])){utils['debug'](util[_0x5027('0x4')](_0x5027('0x2f'),_0x46b9d3[_0x5027('0x6')]),_0x46b9d3);queues[_0x46b9d3[_0x5027('0x6')]][_0x5027('0x1b')]=![];queues[_0x46b9d3[_0x5027('0x6')]][_0x5027('0x28')]=null;queues[_0x46b9d3['uniqueid']][_0x5027('0x1a')]=!![];queues[_0x46b9d3['uniqueid']][_0x5027('0x27')]=utils[_0x5027('0x1d')]();queues[_0x46b9d3['uniqueid']][_0x5027('0x1e')]=_0x5027('0x30');utils[_0x5027('0x3')](util['format'](_0x5027('0x31'),_0x46b9d3[_0x5027('0x6')],queues[_0x46b9d3[_0x5027('0x6')]]['name'],queues[_0x46b9d3['uniqueid']][_0x5027('0x1e')]));}}catch(_0x30cbbf){utils[_0x5027('0x14')](util['format'](_0x5027('0x2f'),_0x46b9d3[_0x5027('0x6')]),_0x30cbbf);}};exports[_0x5027('0x32')]=function(_0x4c889e){try{if(!_[_0x5027('0x17')](queues[_0x4c889e[_0x5027('0x6')]])){utils[_0x5027('0x11')](util[_0x5027('0x4')]('[%s][queues][queuecallerleave]',_0x4c889e[_0x5027('0x6')]),_0x4c889e);utils[_0x5027('0x3')](util[_0x5027('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4c889e[_0x5027('0x6')],queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x20')],_0x4c889e[_0x5027('0x33')],_0x4c889e[_0x5027('0x34')]));queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x32')]=!![];queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x19')]=utils[_0x5027('0x1d')]();queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x35')]=utils[_0x5027('0x36')](queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x19')],queues[_0x4c889e[_0x5027('0x6')]]['queuecallerjoinAt']);queues[_0x4c889e[_0x5027('0x6')]]['position']=_0x4c889e['position'];queues[_0x4c889e['uniqueid']][_0x5027('0x37')]=_0x4c889e[_0x5027('0x37')];queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x33')]=_0x4c889e[_0x5027('0x33')];queues[_0x4c889e[_0x5027('0x6')]][_0x5027('0x34')]=_0x4c889e[_0x5027('0x34')];}}catch(_0x980a58){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x38'),_0x4c889e['uniqueid']),_0x980a58);}};exports['agentconnect']=function(_0x20bec7){try{if(!_['isNil'](queues[_0x20bec7[_0x5027('0x6')]])){utils[_0x5027('0x11')](util[_0x5027('0x4')](_0x5027('0x39'),_0x20bec7[_0x5027('0x6')]),_0x20bec7);utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x3a'),_0x20bec7['uniqueid'],queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x20')],_0x20bec7[_0x5027('0x3b')],_0x20bec7[_0x5027('0x3c')]));queues[_0x20bec7[_0x5027('0x6')]]['queuecallerabandon']=![];queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x1a')]=![];queues[_0x20bec7['uniqueid']][_0x5027('0x27')]=null;queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x1b')]=![];queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x1e')]=null;queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x28')]=null;queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x3d')]=!![];queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0xb')]=_0x20bec7['destaccountcode'];queues[_0x20bec7[_0x5027('0x6')]][_0x5027('0x9')]=_0x20bec7[_0x5027('0x3b')];}}catch(_0x5c98e2){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x39'),_0x20bec7[_0x5027('0x6')]),_0x5c98e2);}};exports['agentcomplete']=function(_0x113299){try{if(!_['isNil'](queues[_0x113299['uniqueid']])){if(queues[_0x113299['uniqueid']][_0x5027('0x19')]){utils['debug'](util['format'](_0x5027('0x3e'),_0x113299[_0x5027('0x6')]),_0x113299);queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1a')]=![];queues[_0x113299['uniqueid']][_0x5027('0x1a')]=![];queues[_0x113299[_0x5027('0x6')]]['queuecallerabandonAt']=null;queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1b')]=![];queues[_0x113299[_0x5027('0x6')]][_0x5027('0x28')]=null;queues[_0x113299[_0x5027('0x6')]][_0x5027('0x3d')]=!![];queues[_0x113299['uniqueid']][_0x5027('0x9')]=_0x113299[_0x5027('0x3b')];queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1c')]=!![];queues[_0x113299[_0x5027('0x6')]]['queuecallercompleteAt']=utils[_0x5027('0x1d')]();if(_0x113299[_0x5027('0x3f')]=='transfer'){if(!queues[_0x113299[_0x5027('0x6')]][_0x5027('0x40')]){queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1e')]='TRANSFER';}}else{queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1e')]=_0x5027('0x41')+_0x113299[_0x5027('0x3f')]['toUpperCase']();}utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x42'),_0x113299[_0x5027('0x6')],queues[_0x113299[_0x5027('0x6')]][_0x5027('0x20')],_0x113299[_0x5027('0x3b')],queues[_0x113299[_0x5027('0x6')]][_0x5027('0x1e')]));writeDB(queues[_0x113299['uniqueid']]);}}}catch(_0x8587c6){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x3e'),_0x113299[_0x5027('0x6')]),_0x8587c6);}};exports[_0x5027('0x43')]=function(_0x4d6350){try{if(!_[_0x5027('0x17')](queues[_0x4d6350[_0x5027('0x44')]])){utils[_0x5027('0x11')](util[_0x5027('0x4')]('[%s][queues][blindtransfer]',_0x4d6350[_0x5027('0x6')]),_0x4d6350);queues[_0x4d6350[_0x5027('0x44')]][_0x5027('0x40')]=!![];queues[_0x4d6350['transfereeuniqueid']][_0x5027('0x45')]='BLIND';queues[_0x4d6350['transfereeuniqueid']]['transferexten']=_0x4d6350[_0x5027('0x46')];queues[_0x4d6350[_0x5027('0x44')]][_0x5027('0x47')]=_0x4d6350[_0x5027('0x44')];queues[_0x4d6350[_0x5027('0x44')]]['queuecallerexitreason']=_0x5027('0x48');utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x49'),_0x4d6350[_0x5027('0x6')],queues[_0x4d6350[_0x5027('0x44')]][_0x5027('0x20')],_0x4d6350[_0x5027('0x44')],_0x4d6350[_0x5027('0x46')]));}}catch(_0x2cbfd7){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x4a'),_0x4d6350[_0x5027('0x6')]),_0x2cbfd7);}};exports['attendedtransfer']=function(_0x860cec){try{utils['debug'](util[_0x5027('0x4')](_0x5027('0x4b'),_0x860cec[_0x5027('0x4c')]),_0x860cec);if(_0x860cec['origtransfereruniqueid']==_0x860cec[_0x5027('0x4d')]){if(!_['isNil'](queues[_0x860cec['secondtransfererlinkedid']])){utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x4e'),_0x860cec[_0x5027('0x4c')],queues[_0x860cec[_0x5027('0x4f')]]['name'],_0x860cec[_0x5027('0x50')]));queues[_0x860cec[_0x5027('0x4f')]][_0x5027('0x40')]=!![];queues[_0x860cec[_0x5027('0x4f')]]['transfertype']=_0x5027('0x51');queues[_0x860cec['secondtransfererlinkedid']][_0x5027('0x52')]=_0x860cec['origtransfererexten'];queues[_0x860cec[_0x5027('0x4f')]][_0x5027('0x47')]=_0x860cec['origtransfereruniqueid'];queues[_0x860cec[_0x5027('0x4f')]][_0x5027('0x1e')]='ATTENDEDTRANSFER';}if(!_[_0x5027('0x17')](queues[_0x860cec[_0x5027('0x4d')]])){if(_0x860cec['transfereelinkedid']&&queues[_0x860cec[_0x5027('0x53')]]){queues[_0x860cec[_0x5027('0x53')]][_0x5027('0x23')]=0x1;queues[_0x860cec['transfereeuniqueid']]=_[_0x5027('0x54')](queues[_0x860cec[_0x5027('0x53')]]);queues[_0x860cec[_0x5027('0x44')]][_0x5027('0x22')]=_0x860cec[_0x5027('0x55')];queues[_0x860cec['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x860cec[_0x5027('0x44')]][_0x5027('0xa')]=queues[_0x860cec['secondtransfererlinkedid']]['calleridnum'];queues[_0x860cec[_0x5027('0x44')]][_0x5027('0x56')]=queues[_0x860cec[_0x5027('0x4f')]]['calleridname'];queues[_0x860cec[_0x5027('0x44')]]['queuecallerjoinAt']=utils[_0x5027('0x1d')]();queues[_0x860cec[_0x5027('0x44')]][_0x5027('0x19')]=utils['now']();queues[_0x860cec[_0x5027('0x44')]][_0x5027('0x35')]=0x0;queues[_0x860cec[_0x5027('0x44')]][_0x5027('0x57')]=0x0;utils['info'](util[_0x5027('0x4')](_0x5027('0x58'),_0x860cec[_0x5027('0x4c')],queues[_0x860cec['transfereeuniqueid']][_0x5027('0x20')],queues[_0x860cec[_0x5027('0x44')]]['calleridnum'],queues[_0x860cec[_0x5027('0x44')]]['calleridname']));}else{utils[_0x5027('0x3')](util[_0x5027('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x860cec[_0x5027('0x4c')],queues[_0x860cec[_0x5027('0x4d')]]['name'],_0x860cec[_0x5027('0x4f')]));queues[_0x860cec[_0x5027('0x4d')]][_0x5027('0x22')]=_0x860cec[_0x5027('0x4f')];}}}else if(_0x860cec[_0x5027('0x59')]==_0x860cec[_0x5027('0x4f')]){if(!_[_0x5027('0x17')](queues[_0x860cec[_0x5027('0x4d')]])){utils[_0x5027('0x3')](util['format'](_0x5027('0x5a'),_0x860cec[_0x5027('0x4c')],queues[_0x860cec[_0x5027('0x4d')]]['name'],_0x860cec[_0x5027('0x59')],_0x860cec[_0x5027('0x5b')]));queues[_0x860cec[_0x5027('0x4d')]][_0x5027('0x40')]=!![];queues[_0x860cec[_0x5027('0x4d')]][_0x5027('0x45')]='ATTENDED';queues[_0x860cec[_0x5027('0x4d')]][_0x5027('0x52')]=_0x860cec[_0x5027('0x5b')];queues[_0x860cec['origtransfererlinkedid']]['transferuniqueid']=_0x860cec[_0x5027('0x59')];queues[_0x860cec['origtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5027('0x17')](queues[_0x860cec[_0x5027('0x4f')]])){if(_0x860cec[_0x5027('0x5c')]&&queues[_0x860cec[_0x5027('0x5c')]]){queues[_0x860cec[_0x5027('0x5c')]][_0x5027('0x23')]=0x1;queues[_0x860cec[_0x5027('0x55')]]=_['clone'](queues[_0x860cec[_0x5027('0x5c')]]);queues[_0x860cec[_0x5027('0x55')]]['transfereduniqueid']=_0x860cec[_0x5027('0x55')];queues[_0x860cec[_0x5027('0x55')]]['queuecallerenterreason']=0x2;queues[_0x860cec[_0x5027('0x55')]]['calleridnum']=queues[_0x860cec[_0x5027('0x4d')]][_0x5027('0xa')];queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x56')]=queues[_0x860cec[_0x5027('0x4d')]]['calleridname'];queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x5d')]=utils['now']();queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x19')]=utils[_0x5027('0x1d')]();queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x35')]=0x0;queues[_0x860cec[_0x5027('0x55')]]['mohtime']=0x0;utils[_0x5027('0x3')](util[_0x5027('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x860cec[_0x5027('0x4c')],queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x20')],queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x22')],queues[_0x860cec['transfertargetuniqueid']]['calleridnum'],queues[_0x860cec[_0x5027('0x55')]][_0x5027('0x56')]));}else{utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x5e'),_0x860cec['origtransfereruniqueid'],queues[_0x860cec[_0x5027('0x4f')]][_0x5027('0x20')],_0x860cec[_0x5027('0x4d')]));queues[_0x860cec[_0x5027('0x4f')]]['transfereduniqueid']=_0x860cec['origtransfererlinkedid'];}}}}catch(_0x15d899){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x4b'),_0x860cec['origtransfereruniqueid']),_0x15d899);}};exports[_0x5027('0x5f')]=function(_0x101cbe){try{if(!_[_0x5027('0x17')](queues[_0x101cbe['uniqueid']])){utils[_0x5027('0x11')](util[_0x5027('0x4')](_0x5027('0x60'),_0x101cbe[_0x5027('0x6')]),_0x101cbe);queues[_0x101cbe[_0x5027('0x6')]][_0x5027('0x61')]=utils[_0x5027('0x1d')]();utils[_0x5027('0x3')](util['format'](_0x5027('0x62'),_0x101cbe[_0x5027('0x6')],queues[_0x101cbe['uniqueid']][_0x5027('0x20')],queues[_0x101cbe[_0x5027('0x6')]][_0x5027('0x61')]));}}catch(_0x38af0d){utils[_0x5027('0x14')](util[_0x5027('0x4')](_0x5027('0x60'),_0x101cbe[_0x5027('0x6')]),_0x38af0d);}};exports['musiconholdstop']=function(_0x2e2e32){try{if(!_[_0x5027('0x17')](queues[_0x2e2e32['uniqueid']])){if(!_[_0x5027('0x17')](queues[_0x2e2e32[_0x5027('0x6')]][_0x5027('0x61')])){utils[_0x5027('0x11')](util[_0x5027('0x4')](_0x5027('0x63'),_0x2e2e32[_0x5027('0x6')]),_0x2e2e32);queues[_0x2e2e32[_0x5027('0x6')]][_0x5027('0x57')]+=utils[_0x5027('0x36')](utils['now'](),queues[_0x2e2e32[_0x5027('0x6')]][_0x5027('0x61')]);utils[_0x5027('0x3')](util[_0x5027('0x4')](_0x5027('0x64'),_0x2e2e32[_0x5027('0x6')],queues[_0x2e2e32[_0x5027('0x6')]][_0x5027('0x20')],queues[_0x2e2e32[_0x5027('0x6')]][_0x5027('0x57')]));delete queues[_0x2e2e32[_0x5027('0x6')]]['musiconholdstartAt'];}}}catch(_0x5a8fc7){utils['error'](util[_0x5027('0x4')](_0x5027('0x63'),_0x2e2e32[_0x5027('0x6')]),_0x5a8fc7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9c0b026..abea0f1 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 _0xe5ee=['accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','transfer','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','debug','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','uniqueid'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xe5ee,0x16a));var _0xee5e=function(_0x328ea7,_0x5cd8f8){_0x328ea7=_0x328ea7-0x0;var _0x3fd2e7=_0xe5ee[_0x328ea7];return _0x3fd2e7;};'use strict';var _=require(_0xee5e('0x0'));var util=require(_0xee5e('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x12245d){utils[_0xee5e('0x2')](util['format']('[%s][recordings][writeDB]',_0x12245d[_0xee5e('0x3')]));if(_0x12245d[_0xee5e('0x4')]){utils[_0xee5e('0x5')](_0x12245d[_0xee5e('0x4')])[_0xee5e('0x6')](function(_0x18a737){if(_0x18a737){_0x12245d[_0xee5e('0x7')]=_0x18a737[_0xee5e('0x8')];_0x12245d[_0xee5e('0x9')]=_0x18a737['id'];}utils[_0xee5e('0xa')]('CreateVoiceRecording',_0x12245d);});}else{utils[_0xee5e('0xa')](_0xee5e('0xb'),_0x12245d);}}exports[_0xee5e('0xc')]=function(_0x2e5d07){try{utils['debug'](util[_0xee5e('0xd')](_0xee5e('0xe'),_0x2e5d07['uniqueid']),_0x2e5d07);if(_0x2e5d07[_0xee5e('0x3')]==_0x2e5d07[_0xee5e('0xf')]){utils[_0xee5e('0x2')](util[_0xee5e('0xd')](_0xee5e('0x10'),_0x2e5d07[_0xee5e('0x3')],_0x2e5d07[_0xee5e('0x11')],_0x2e5d07[_0xee5e('0x12')]));recordings[_0x2e5d07['uniqueid']]={'uniqueid':_0x2e5d07['uniqueid'],'accountcode':_0x2e5d07[_0xee5e('0x4')],'exten':_0x2e5d07[_0xee5e('0x12')],'context':_0x2e5d07[_0xee5e('0x11')],'channel':_0x2e5d07[_0xee5e('0x13')],'monitors':[]};}}catch(_0x473b80){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0xe'),_0x2e5d07['uniqueid']),_0x473b80);}};exports['newstate']=function(_0x223cba){try{utils['debug'](util[_0xee5e('0xd')]('[%s][recordings][newstate]',_0x223cba[_0xee5e('0x3')]),_0x223cba);if(!_[_0xee5e('0x15')](recordings[_0x223cba[_0xee5e('0x3')]])&&_0x223cba[_0xee5e('0x16')]==0x6){utils['info'](util[_0xee5e('0xd')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x223cba[_0xee5e('0x3')],_0x223cba[_0xee5e('0x11')],_0x223cba[_0xee5e('0x13')]));}else if(!_['isNil'](recordings[_0x223cba['linkedid']])&&_0x223cba[_0xee5e('0x16')]==0x6&&_0x223cba[_0xee5e('0x11')]!=_0xee5e('0x17')){utils[_0xee5e('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x223cba[_0xee5e('0x3')],_0x223cba['linkedid'],_0x223cba[_0xee5e('0x11')],_0x223cba['channel']));recordings[_0x223cba['linkedid']]['accountcode']=_0x223cba[_0xee5e('0x4')];}}catch(_0x4321cd){utils[_0xee5e('0x14')](util[_0xee5e('0xd')]('[%s][recordings][newstate]',_0x223cba[_0xee5e('0x3')]),_0x4321cd);}};exports['varset']=function(_0x53536e){try{if(!_[_0xee5e('0x15')](_0x53536e[_0xee5e('0x18')])&&!_[_0xee5e('0x15')](_0x53536e[_0xee5e('0x18')][_0xee5e('0x19')])){utils['debug'](util[_0xee5e('0xd')](_0xee5e('0x1a'),_0x53536e[_0xee5e('0x3')]),_0x53536e);utils[_0xee5e('0x2')](util['format'](_0xee5e('0x1b'),_0x53536e[_0xee5e('0x3')],_0x53536e[_0xee5e('0x18')],_0x53536e['value']));if(_[_0xee5e('0x1c')](_0x53536e[_0xee5e('0x1d')],_0xee5e('0x1e'))){_0x53536e['value']=_0x53536e[_0xee5e('0x1d')]['replace'](_0xee5e('0x1e'),_0xee5e('0x1f'));}if(recordings[_0x53536e[_0xee5e('0xf')]]){var _0x258d4d=_[_0xee5e('0x20')](recordings[_0x53536e[_0xee5e('0xf')]][_0xee5e('0x21')],{'value':_0x53536e[_0xee5e('0x1d')]});if(_[_0xee5e('0x15')](_0x258d4d)){recordings[_0x53536e[_0xee5e('0xf')]][_0xee5e('0x21')][_0xee5e('0x22')]({'value':_0x53536e[_0xee5e('0x1d')]});}}}}catch(_0x5e4b2f){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x1a'),_0x53536e[_0xee5e('0x3')]),_0x5e4b2f);}};exports[_0xee5e('0x23')]=function(_0x581351){try{if(!_[_0xee5e('0x15')](recordings[_0x581351[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')](_0xee5e('0x25'),_0x581351[_0xee5e('0x3')]),_0x581351);utils[_0xee5e('0x2')](util[_0xee5e('0xd')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x581351[_0xee5e('0x3')],_0x581351[_0xee5e('0x26')],_0x581351[_0xee5e('0x27')],_0x581351[_0xee5e('0x28')]));recordings[_0x581351['uniqueid']][_0xee5e('0x26')]=_0x581351[_0xee5e('0x26')];recordings[_0x581351['uniqueid']][_0xee5e('0x27')]=_0x581351[_0xee5e('0x27')];recordings[_0x581351[_0xee5e('0x3')]]['connectedlinenum']=_0x581351['connectedlinenum'];recordings[_0x581351['uniqueid']][_0xee5e('0x29')]=_0x581351[_0xee5e('0x29')];if(recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x2a')]==_0xee5e('0x2b')&&recordings[_0x581351['uniqueid']][_0xee5e('0x4')]){recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x2c')]=recordings[_0x581351['uniqueid']][_0xee5e('0x4')];recordings[_0x581351['uniqueid']][_0xee5e('0x29')]='';}recordings[_0x581351[_0xee5e('0x3')]][_0xee5e('0x21')][_0xee5e('0x2d')](function(_0x4d3f42){var _0x3c4835=_[_0xee5e('0x2e')](recordings[_0x581351['uniqueid']]);_0x3c4835['value']=_0x4d3f42[_0xee5e('0x1d')];writeDB(_0x3c4835);});delete recordings[_0x581351[_0xee5e('0x3')]];}}catch(_0x544e29){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x25'),_0x581351[_0xee5e('0x3')]),_0x544e29);}};exports[_0xee5e('0x2f')]=function(_0x4984f0){try{if(!_[_0xee5e('0x15')](recordings[_0x4984f0[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')]('[%s][recordings][newexten]',_0x4984f0['uniqueid']),_0x4984f0);utils[_0xee5e('0x2')](util['format'](_0xee5e('0x30'),_0x4984f0[_0xee5e('0x3')],_0x4984f0[_0xee5e('0x31')],_0x4984f0[_0xee5e('0x32')]));if(_0x4984f0[_0xee5e('0x31')][_0xee5e('0x33')]()=='set'&&_[_0xee5e('0x34')](_0x4984f0[_0xee5e('0x32')]['toLowerCase'](),'cdr')){var _0x1d9d46=_0x4984f0[_0xee5e('0x32')][_0xee5e('0x35')]('=');var _0x2a18d1=_0x1d9d46[0x0][_0xee5e('0x36')](_0x1d9d46[0x0][_0xee5e('0x37')]('(')+0x1,_0x1d9d46[0x0]['lastIndexOf'](')'));var _0x3f94cf=_0x1d9d46[0x1];recordings[_0x4984f0[_0xee5e('0x3')]][_0x2a18d1]=_0x3f94cf;}}}catch(_0x2996e1){utils[_0xee5e('0x14')](util[_0xee5e('0xd')](_0xee5e('0x38'),_0x4984f0['uniqueid']),_0x2996e1);}};exports[_0xee5e('0x39')]=function(_0x1efb45){try{if(!_['isNil'](recordings[_0x1efb45[_0xee5e('0x3')]])){utils[_0xee5e('0x24')](util[_0xee5e('0xd')](_0xee5e('0x3a'),_0x1efb45[_0xee5e('0x3')]),_0x1efb45);utils['info'](util[_0xee5e('0xd')](_0xee5e('0x3b'),_0x1efb45[_0xee5e('0x3')],_0x1efb45[_0xee5e('0x3c')]));recordings[_0x1efb45[_0xee5e('0x3')]][_0xee5e('0x3c')]=_0x1efb45[_0xee5e('0x3c')];}}catch(_0x1c37f){utils[_0xee5e('0x14')](util[_0xee5e('0xd')]('[%s][recordings][queuecallerjoin]',_0x1efb45[_0xee5e('0x3')]),_0x1c37f);}}; \ No newline at end of file +var _0x0082=['forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','outbound'];(function(_0x4be7a3,_0x54466a){var _0x338478=function(_0xf1ecff){while(--_0xf1ecff){_0x4be7a3['push'](_0x4be7a3['shift']());}};_0x338478(++_0x54466a);}(_0x0082,0x157));var _0x2008=function(_0x455b35,_0x5d2b5e){_0x455b35=_0x455b35-0x0;var _0x1fc095=_0x0082[_0x455b35];return _0x1fc095;};'use strict';var _=require(_0x2008('0x0'));var util=require(_0x2008('0x1'));var utils=require(_0x2008('0x2'));var recordings={};function writeDB(_0x46ff7a){utils['info'](util[_0x2008('0x3')](_0x2008('0x4'),_0x46ff7a['uniqueid']));if(_0x46ff7a[_0x2008('0x5')]){utils[_0x2008('0x6')](_0x46ff7a[_0x2008('0x5')])[_0x2008('0x7')](function(_0x2a4c4a){if(_0x2a4c4a){_0x46ff7a[_0x2008('0x8')]=_0x2a4c4a[_0x2008('0x9')];_0x46ff7a[_0x2008('0xa')]=_0x2a4c4a['id'];}utils[_0x2008('0xb')](_0x2008('0xc'),_0x46ff7a);});}else{utils['request'](_0x2008('0xc'),_0x46ff7a);}}exports[_0x2008('0xd')]=function(_0x5a7273){try{utils[_0x2008('0xe')](util['format'](_0x2008('0xf'),_0x5a7273[_0x2008('0x10')]),_0x5a7273);if(_0x5a7273[_0x2008('0x10')]==_0x5a7273[_0x2008('0x11')]){utils[_0x2008('0x12')](util['format'](_0x2008('0x13'),_0x5a7273[_0x2008('0x10')],_0x5a7273['context'],_0x5a7273[_0x2008('0x14')]));recordings[_0x5a7273[_0x2008('0x10')]]={'uniqueid':_0x5a7273['uniqueid'],'accountcode':_0x5a7273[_0x2008('0x5')],'exten':_0x5a7273[_0x2008('0x14')],'context':_0x5a7273[_0x2008('0x15')],'channel':_0x5a7273[_0x2008('0x16')],'monitors':[]};}}catch(_0x15141a){utils[_0x2008('0x17')](util['format'](_0x2008('0xf'),_0x5a7273[_0x2008('0x10')]),_0x15141a);}};exports['newstate']=function(_0x348b72){try{utils['debug'](util[_0x2008('0x3')](_0x2008('0x18'),_0x348b72['uniqueid']),_0x348b72);if(!_['isNil'](recordings[_0x348b72[_0x2008('0x10')]])&&_0x348b72[_0x2008('0x19')]==0x6){utils[_0x2008('0x12')](util[_0x2008('0x3')](_0x2008('0x1a'),_0x348b72['uniqueid'],_0x348b72[_0x2008('0x15')],_0x348b72[_0x2008('0x16')]));}else if(!_[_0x2008('0x1b')](recordings[_0x348b72[_0x2008('0x11')]])&&_0x348b72['channelstate']==0x6&&_0x348b72['context']!=_0x2008('0x1c')){utils[_0x2008('0x12')](util[_0x2008('0x3')](_0x2008('0x1d'),_0x348b72[_0x2008('0x10')],_0x348b72[_0x2008('0x11')],_0x348b72['context'],_0x348b72[_0x2008('0x16')]));recordings[_0x348b72['linkedid']][_0x2008('0x5')]=_0x348b72['accountcode'];}}catch(_0xbcb9d4){utils[_0x2008('0x17')](util['format']('[%s][recordings][newstate]',_0x348b72[_0x2008('0x10')]),_0xbcb9d4);}};exports['varset']=function(_0x402d22){try{if(!_[_0x2008('0x1b')](_0x402d22[_0x2008('0x1e')])&&!_[_0x2008('0x1b')](_0x402d22[_0x2008('0x1e')][_0x2008('0x1f')])){utils[_0x2008('0xe')](util[_0x2008('0x3')](_0x2008('0x20'),_0x402d22[_0x2008('0x10')]),_0x402d22);utils[_0x2008('0x12')](util[_0x2008('0x3')](_0x2008('0x21'),_0x402d22[_0x2008('0x10')],_0x402d22['variable'],_0x402d22[_0x2008('0x22')]));if(_['endsWith'](_0x402d22['value'],_0x2008('0x23'))){_0x402d22[_0x2008('0x22')]=_0x402d22[_0x2008('0x22')][_0x2008('0x24')](_0x2008('0x23'),_0x2008('0x25'));}if(recordings[_0x402d22[_0x2008('0x11')]]){var _0xd622a2=_['find'](recordings[_0x402d22['linkedid']][_0x2008('0x26')],{'value':_0x402d22['value']});if(_['isNil'](_0xd622a2)){recordings[_0x402d22[_0x2008('0x11')]][_0x2008('0x26')][_0x2008('0x27')]({'value':_0x402d22['value']});}}}}catch(_0x13ca43){utils[_0x2008('0x17')](util[_0x2008('0x3')](_0x2008('0x20'),_0x402d22[_0x2008('0x10')]),_0x13ca43);}};exports[_0x2008('0x28')]=function(_0x2ac2cc){try{if(!_['isNil'](recordings[_0x2ac2cc[_0x2008('0x10')]])){utils[_0x2008('0xe')](util[_0x2008('0x3')](_0x2008('0x29'),_0x2ac2cc[_0x2008('0x10')]),_0x2ac2cc);utils['info'](util[_0x2008('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2ac2cc[_0x2008('0x10')],_0x2ac2cc['calleridnum'],_0x2ac2cc[_0x2008('0x2a')],_0x2ac2cc['cause-txt']));recordings[_0x2ac2cc[_0x2008('0x10')]]['calleridnum']=_0x2ac2cc[_0x2008('0x2b')];recordings[_0x2ac2cc['uniqueid']][_0x2008('0x2a')]=_0x2ac2cc[_0x2008('0x2a')];recordings[_0x2ac2cc[_0x2008('0x10')]][_0x2008('0x2c')]=_0x2ac2cc[_0x2008('0x2c')];recordings[_0x2ac2cc[_0x2008('0x10')]][_0x2008('0x2d')]=_0x2ac2cc[_0x2008('0x2d')];if(recordings[_0x2ac2cc['uniqueid']]['type']==_0x2008('0x2e')&&recordings[_0x2ac2cc[_0x2008('0x10')]][_0x2008('0x5')]){recordings[_0x2ac2cc['uniqueid']]['connectedlinenum']=recordings[_0x2ac2cc[_0x2008('0x10')]][_0x2008('0x5')];recordings[_0x2ac2cc[_0x2008('0x10')]]['connectedlinename']='';}recordings[_0x2ac2cc['uniqueid']][_0x2008('0x26')][_0x2008('0x2f')](function(_0x2632a3){var _0x85b5ff=_[_0x2008('0x30')](recordings[_0x2ac2cc[_0x2008('0x10')]]);_0x85b5ff[_0x2008('0x22')]=_0x2632a3[_0x2008('0x22')];writeDB(_0x85b5ff);});delete recordings[_0x2ac2cc[_0x2008('0x10')]];}}catch(_0x49c2ef){utils['error'](util['format'](_0x2008('0x29'),_0x2ac2cc[_0x2008('0x10')]),_0x49c2ef);}};exports[_0x2008('0x31')]=function(_0x39e8ed){try{if(!_[_0x2008('0x1b')](recordings[_0x39e8ed[_0x2008('0x10')]])){utils[_0x2008('0xe')](util[_0x2008('0x3')](_0x2008('0x32'),_0x39e8ed['uniqueid']),_0x39e8ed);utils[_0x2008('0x12')](util['format'](_0x2008('0x33'),_0x39e8ed['uniqueid'],_0x39e8ed[_0x2008('0x34')],_0x39e8ed[_0x2008('0x35')]));if(_0x39e8ed[_0x2008('0x34')][_0x2008('0x36')]()==_0x2008('0x37')&&_[_0x2008('0x38')](_0x39e8ed['appdata']['toLowerCase'](),_0x2008('0x39'))){var _0x214c4c=_0x39e8ed[_0x2008('0x35')][_0x2008('0x3a')]('=');var _0x481f1b=_0x214c4c[0x0][_0x2008('0x3b')](_0x214c4c[0x0]['lastIndexOf']('(')+0x1,_0x214c4c[0x0][_0x2008('0x3c')](')'));var _0xe394bd=_0x214c4c[0x1];recordings[_0x39e8ed[_0x2008('0x10')]][_0x481f1b]=_0xe394bd;}}}catch(_0x915538){utils[_0x2008('0x17')](util[_0x2008('0x3')]('[%s][recordings][newexten]',_0x39e8ed[_0x2008('0x10')]),_0x915538);}};exports[_0x2008('0x3d')]=function(_0x36f204){try{if(!_[_0x2008('0x1b')](recordings[_0x36f204[_0x2008('0x10')]])){utils['debug'](util['format'](_0x2008('0x3e'),_0x36f204[_0x2008('0x10')]),_0x36f204);utils['info'](util[_0x2008('0x3')](_0x2008('0x3f'),_0x36f204[_0x2008('0x10')],_0x36f204[_0x2008('0x40')]));recordings[_0x36f204[_0x2008('0x10')]][_0x2008('0x40')]=_0x36f204[_0x2008('0x40')];}}catch(_0x2f6494){utils[_0x2008('0x17')](util[_0x2008('0x3')](_0x2008('0x3e'),_0x36f204[_0x2008('0x10')]),_0x2f6494);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8759a9d..e2c1ccf 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 _0x3927=['CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid'];(function(_0x4e5f6f,_0x462fbb){var _0x5b489b=function(_0xb9f160){while(--_0xb9f160){_0x4e5f6f['push'](_0x4e5f6f['shift']());}};_0x5b489b(++_0x462fbb);}(_0x3927,0x90));var _0x7392=function(_0x338e6e,_0x3d12fa){_0x338e6e=_0x338e6e-0x0;var _0x6ed645=_0x3927[_0x338e6e];return _0x6ed645;};'use strict';var _=require(_0x7392('0x0'));var util=require(_0x7392('0x1'));var utils=require(_0x7392('0x2'));function writeDB(_0x120f65){utils[_0x7392('0x3')](util['format'](_0x7392('0x4'),_0x120f65[_0x7392('0x5')]===_0x7392('0x6')?_0x120f65['origtransfereruniqueid']:_0x120f65[_0x7392('0x7')],_0x120f65[_0x7392('0x5')]));utils['request'](_0x7392('0x8'),_0x120f65);}exports[_0x7392('0x9')]=function(_0x4e5c1f){try{utils['debug'](util[_0x7392('0xa')]('[%s][transfers][blindtransfer]',_0x4e5c1f['uniqueid']),_0x4e5c1f);utils['info'](util['format'](_0x7392('0xb'),_0x4e5c1f['uniqueid'],_0x4e5c1f[_0x7392('0xc')],_0x4e5c1f['transferercalleridname'],_0x4e5c1f['transfereecalleridnum'],_0x4e5c1f[_0x7392('0xd')]));_0x4e5c1f[_0x7392('0x5')]=_0x7392('0xe');writeDB(_0x4e5c1f);}catch(_0x8fd258){utils['error'](util[_0x7392('0xa')]('[%s][transfers][blindtransfer]',_0x4e5c1f[_0x7392('0x7')]),_0x8fd258);}};exports[_0x7392('0xf')]=function(_0x663a19){try{utils[_0x7392('0x10')](util[_0x7392('0xa')](_0x7392('0x11'),_0x663a19[_0x7392('0x12')]),_0x663a19);utils[_0x7392('0x3')](util['format'](_0x7392('0x13'),_0x663a19['origtransfereruniqueid'],_0x663a19[_0x7392('0x14')],_0x663a19[_0x7392('0x15')],_0x663a19[_0x7392('0x16')],_0x663a19[_0x7392('0x17')]));_0x663a19=_[_0x7392('0x18')](_0x663a19,{'transfererchannel':_0x663a19['origtransfererchannel'],'transferercalleridnum':_0x663a19[_0x7392('0x14')],'transferercalleridname':_0x663a19['origtransferercalleridname'],'transfererconnectedlinenum':_0x663a19['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x663a19['secondtransfererconnectedlinename'],'transfereraccountcode':_0x663a19[_0x7392('0x19')],'transferercontext':_0x663a19[_0x7392('0x1a')],'transfererexten':_0x663a19[_0x7392('0x1b')],'transfererlinkedid':_0x663a19[_0x7392('0x1c')],'context':_0x663a19[_0x7392('0x1d')],'extension':_0x663a19[_0x7392('0x1e')],'type':_0x7392('0x6')});if(_[_0x7392('0x1f')](_0x663a19['transfereechannel'])){_0x663a19=_[_0x7392('0x18')](_0x663a19,{'transfereechannel':_0x663a19[_0x7392('0x20')],'transfereecalleridnum':_0x663a19['transfertargetcalleridnum'],'transfereecalleridname':_0x663a19['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x663a19['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x663a19[_0x7392('0x21')],'transfereeaccountcode':_0x663a19['transfertargetaccountcode'],'transfereecontext':_0x663a19[_0x7392('0x22')],'transfereeexten':_0x663a19[_0x7392('0x23')],'transfereelinkedid':_0x663a19[_0x7392('0x24')]});}writeDB(_0x663a19);}catch(_0x5c95d8){utils[_0x7392('0x25')](util[_0x7392('0xa')](_0x7392('0x11'),_0x663a19[_0x7392('0x12')]),_0x5c95d8);}}; \ No newline at end of file +var _0xde91=['transfereecalleridname','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','uniqueid','transferercalleridname'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0xde91,0x171));var _0x1de9=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xde91[_0x258fb0];return _0x4d1afe;};'use strict';var _=require('lodash');var util=require(_0x1de9('0x0'));var utils=require(_0x1de9('0x1'));function writeDB(_0x5c928f){utils['info'](util[_0x1de9('0x2')](_0x1de9('0x3'),_0x5c928f[_0x1de9('0x4')]==='attended'?_0x5c928f[_0x1de9('0x5')]:_0x5c928f['uniqueid'],_0x5c928f[_0x1de9('0x4')]));utils[_0x1de9('0x6')](_0x1de9('0x7'),_0x5c928f);}exports['blindtransfer']=function(_0x414017){try{utils['debug'](util[_0x1de9('0x2')](_0x1de9('0x8'),_0x414017[_0x1de9('0x9')]),_0x414017);utils['info'](util[_0x1de9('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x414017[_0x1de9('0x9')],_0x414017['transferercalleridnum'],_0x414017[_0x1de9('0xa')],_0x414017['transfereecalleridnum'],_0x414017[_0x1de9('0xb')]));_0x414017[_0x1de9('0x4')]='blind';writeDB(_0x414017);}catch(_0x2301ef){utils[_0x1de9('0xc')](util[_0x1de9('0x2')](_0x1de9('0x8'),_0x414017[_0x1de9('0x9')]),_0x2301ef);}};exports[_0x1de9('0xd')]=function(_0x53c0c2){try{utils[_0x1de9('0xe')](util[_0x1de9('0x2')](_0x1de9('0xf'),_0x53c0c2['origtransfereruniqueid']),_0x53c0c2);utils[_0x1de9('0x10')](util[_0x1de9('0x2')](_0x1de9('0x11'),_0x53c0c2[_0x1de9('0x5')],_0x53c0c2['origtransferercalleridnum'],_0x53c0c2[_0x1de9('0x12')],_0x53c0c2[_0x1de9('0x13')],_0x53c0c2['transfertargetcalleridname']));_0x53c0c2=_[_0x1de9('0x14')](_0x53c0c2,{'transfererchannel':_0x53c0c2[_0x1de9('0x15')],'transferercalleridnum':_0x53c0c2[_0x1de9('0x16')],'transferercalleridname':_0x53c0c2[_0x1de9('0x12')],'transfererconnectedlinenum':_0x53c0c2['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x53c0c2[_0x1de9('0x17')],'transfereraccountcode':_0x53c0c2['origtransfereraccountcode'],'transferercontext':_0x53c0c2[_0x1de9('0x18')],'transfererexten':_0x53c0c2[_0x1de9('0x19')],'transfererlinkedid':_0x53c0c2[_0x1de9('0x1a')],'context':_0x53c0c2[_0x1de9('0x1b')],'extension':_0x53c0c2[_0x1de9('0x1c')],'type':_0x1de9('0x1d')});if(_[_0x1de9('0x1e')](_0x53c0c2['transfereechannel'])){_0x53c0c2=_['assign'](_0x53c0c2,{'transfereechannel':_0x53c0c2[_0x1de9('0x1f')],'transfereecalleridnum':_0x53c0c2['transfertargetcalleridnum'],'transfereecalleridname':_0x53c0c2['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x53c0c2[_0x1de9('0x20')],'transfereeconnectedlinename':_0x53c0c2[_0x1de9('0x21')],'transfereeaccountcode':_0x53c0c2[_0x1de9('0x22')],'transfereecontext':_0x53c0c2[_0x1de9('0x23')],'transfereeexten':_0x53c0c2[_0x1de9('0x24')],'transfereelinkedid':_0x53c0c2[_0x1de9('0x25')]});}writeDB(_0x53c0c2);}catch(_0x3bd5e3){utils[_0x1de9('0xc')](util[_0x1de9('0x2')](_0x1de9('0xf'),_0x53c0c2['origtransfereruniqueid']),_0x3bd5e3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 859bdd5..cec6983 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 _0x9206=['getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9206,0x176));var _0x6920=function(_0xd9a6eb,_0x3ceddc){_0xd9a6eb=_0xd9a6eb-0x0;var _0x3484b0=_0x9206[_0xd9a6eb];return _0x3484b0;};'use strict';var BPromise=require(_0x6920('0x0'));var jayson=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var util=require(_0x6920('0x3'));var client=jayson[_0x6920('0x4')][_0x6920('0x5')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x6920('0x6')]=function(_0x3c84f7,_0x560c31){logger['info'](_0x3c84f7,_0x560c31?util[_0x6920('0x7')](_0x560c31,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x21fb21,_0x31966d){logger[_0x6920('0x8')](_0x21fb21,_0x31966d?util[_0x6920('0x7')](_0x31966d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x538f80,_0x1f4895){logger[_0x6920('0x9')](_0x538f80,_0x1f4895?util[_0x6920('0x7')](_0x1f4895,{'showHidden':![],'depth':null}):'');};exports[_0x6920('0xa')]=function(_0x188e0c,_0x2a9aa6){return client[_0x6920('0xa')](_0x188e0c,{'body':_0x2a9aa6})[_0x6920('0xb')](function(_0x194343){logger[_0x6920('0x8')](_0x6920('0xc'),_0x188e0c,_0x194343?util[_0x6920('0x7')](_0x194343,{'showHidden':![],'depth':null}):'');})[_0x6920('0xd')](function(_0x5ad438){logger['error'](_0x6920('0xc'),_0x188e0c,_0x5ad438?util[_0x6920('0x7')](_0x5ad438,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57e9f3){return client[_0x6920('0xa')](_0x6920('0xe'),{'options':{'raw':!![],'attributes':['id',_0x6920('0xf'),_0x6920('0x10'),_0x6920('0x11')],'where':_0x57e9f3,'limit':0x1}})['then'](function(_0x338e5f){logger[_0x6920('0x8')](_0x6920('0x12'),JSON[_0x6920('0x13')](_0x57e9f3),_0x338e5f?util[_0x6920('0x7')](_0x338e5f,{'showHidden':![],'depth':null}):'');return _0x338e5f[_0x6920('0x14')][_0x6920('0x15')]?_0x338e5f[_0x6920('0x14')][0x0]:null;});}exports[_0x6920('0x16')]=function(_0x2d04e7){return new BPromise(function(_0x462500,_0x3d0059){if(_0x2d04e7){return getUser({'internal':_0x2d04e7})[_0x6920('0xb')](function(_0x81f693){logger[_0x6920('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2d04e7,_0x81f693?_0x6920('0x17'):_0x6920('0x18'));return _0x462500(_0x81f693);})[_0x6920('0xd')](function(_0xaf73cf){logger[_0x6920('0x9')](_0x6920('0x19'),_0xaf73cf?util[_0x6920('0x7')](_0xaf73cf,{'showHidden':![],'depth':null}):'');return _0x462500(null);});}return _0x462500(null);});};exports[_0x6920('0x1a')]=function(_0xaf93ba){return new BPromise(function(_0x37ebb0,_0x32c784){if(_0xaf93ba){return getUser({'interface':_0xaf93ba})[_0x6920('0xb')](function(_0x1df372){logger[_0x6920('0x6')](_0x6920('0x1b'),_0xaf93ba,_0x1df372?_0x6920('0x17'):_0x6920('0x18'));return _0x37ebb0(_0x1df372);})[_0x6920('0xd')](function(_0xa8f55){logger[_0x6920('0x9')]('[utils][getUserByInterface]',_0xa8f55?util[_0x6920('0x7')](_0xa8f55,{'showHidden':![],'depth':null}):'');return _0x37ebb0(null);});}return _0x37ebb0(null);});};exports['getUserByName']=function(_0x277b69){return new BPromise(function(_0x4dd08b,_0x72316a){if(_0x277b69){return getUser({'name':_0x277b69})[_0x6920('0xb')](function(_0x23e4cd){logger[_0x6920('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x277b69,_0x23e4cd?_0x6920('0x17'):_0x6920('0x18'));return _0x4dd08b(_0x23e4cd);})[_0x6920('0xd')](function(_0x1ae78f){logger[_0x6920('0x9')](_0x6920('0x1c'),_0x1ae78f?util[_0x6920('0x7')](_0x1ae78f,{'showHidden':![],'depth':null}):'');return _0x4dd08b(null);});}return _0x4dd08b(null);});};exports[_0x6920('0x1d')]=function(_0x400894){return new BPromise(function(_0x2f5ce8,_0x6860c7){if(_0x400894){return client[_0x6920('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x6920('0x10'),'type',_0x6920('0x1e'),'acwTimeout'],'where':{'name':_0x400894},'limit':0x1}})[_0x6920('0xb')](function(_0x25e7ff){logger['debug'](_0x6920('0x1f'),_0x400894,_0x25e7ff?util[_0x6920('0x7')](_0x25e7ff,{'showHidden':![],'depth':null}):'');logger[_0x6920('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x400894,_0x25e7ff?'found':_0x6920('0x18'));return _0x2f5ce8(_0x25e7ff['result']['length']?_0x25e7ff[_0x6920('0x14')][0x0]:null);})[_0x6920('0xd')](function(_0x8b95ba){logger[_0x6920('0x9')](_0x6920('0x20'),_0x8b95ba?util[_0x6920('0x7')](_0x8b95ba,{'showHidden':![],'depth':null}):'');return _0x2f5ce8(null);});}return _0x2f5ce8(null);});};exports[_0x6920('0x21')]=function(_0x5aff49,_0x26cf8c){return moment(_0x5aff49)['add'](_0x26cf8c,_0x6920('0x22'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6920('0x23')]=function(_0x155b3a,_0x1d4426){return moment(_0x155b3a)[_0x6920('0x24')](_0x1d4426,_0x6920('0x22'))[_0x6920('0x25')](_0x6920('0x26'));};exports[_0x6920('0x27')]=function(_0x33acf7,_0x26a4b0){return moment(_0x33acf7)[_0x6920('0x28')](moment(_0x26a4b0),_0x6920('0x22'));};exports['sumTime']=function(_0x2a69d3,_0x4c56be){return parseInt(_0x2a69d3,0xa)+parseInt(_0x4c56be,0xa);};exports[_0x6920('0x29')]=function(){return moment()[_0x6920('0x25')](_0x6920('0x26'));};exports['isAfter']=function(_0x1e8101,_0x41503b){if(_0x41503b){return moment(_0x1e8101)[_0x6920('0x2a')](_0x41503b);}return!![];};exports[_0x6920('0x2b')]=function(_0x4eb58e,_0x369233){if(_0x369233){return moment(_0x4eb58e)[_0x6920('0x2b')](_0x369233);}else if(_0x4eb58e){return!![];}return![];}; \ No newline at end of file +var _0x87b4=['stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s'];(function(_0x3b7072,_0x1d5c7e){var _0x8f5110=function(_0x9e3158){while(--_0x9e3158){_0x3b7072['push'](_0x3b7072['shift']());}};_0x8f5110(++_0x1d5c7e);}(_0x87b4,0xaa));var _0x487b=function(_0x3416bd,_0x5319f1){_0x3416bd=_0x3416bd-0x0;var _0x12141c=_0x87b4[_0x3416bd];return _0x12141c;};'use strict';var BPromise=require(_0x487b('0x0'));var jayson=require(_0x487b('0x1'));var moment=require(_0x487b('0x2'));var util=require('util');var client=jayson[_0x487b('0x3')]['http']({'port':0x2329});var logger=require(_0x487b('0x4'))('xdr');exports[_0x487b('0x5')]=function(_0x553a41,_0x13ed8b){logger[_0x487b('0x5')](_0x553a41,_0x13ed8b?util[_0x487b('0x6')](_0x13ed8b,{'showHidden':![],'depth':null}):'');};exports[_0x487b('0x7')]=function(_0x326f6d,_0xc63cbd){logger[_0x487b('0x7')](_0x326f6d,_0xc63cbd?util[_0x487b('0x6')](_0xc63cbd,{'showHidden':![],'depth':null}):'');};exports[_0x487b('0x8')]=function(_0x41b5f2,_0x3672ac){logger[_0x487b('0x8')](_0x41b5f2,_0x3672ac?util['inspect'](_0x3672ac,{'showHidden':![],'depth':null}):'');};exports[_0x487b('0x9')]=function(_0x384e11,_0x261263){return client[_0x487b('0x9')](_0x384e11,{'body':_0x261263})[_0x487b('0xa')](function(_0x3d5d60){logger['debug'](_0x487b('0xb'),_0x384e11,_0x3d5d60?util[_0x487b('0x6')](_0x3d5d60,{'showHidden':![],'depth':null}):'');})[_0x487b('0xc')](function(_0x2226a8){logger[_0x487b('0x8')]('[utils][request]\x20name:%s',_0x384e11,_0x2226a8?util[_0x487b('0x6')](_0x2226a8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x40a5f4){return client[_0x487b('0x9')](_0x487b('0xd'),{'options':{'raw':!![],'attributes':['id',_0x487b('0xe'),_0x487b('0xf'),_0x487b('0x10')],'where':_0x40a5f4,'limit':0x1}})['then'](function(_0x36a729){logger[_0x487b('0x7')](_0x487b('0x11'),JSON[_0x487b('0x12')](_0x40a5f4),_0x36a729?util[_0x487b('0x6')](_0x36a729,{'showHidden':![],'depth':null}):'');return _0x36a729[_0x487b('0x13')]['length']?_0x36a729['result'][0x0]:null;});}exports[_0x487b('0x14')]=function(_0x5c5048){return new BPromise(function(_0x59c8ae,_0x49818f){if(_0x5c5048){return getUser({'internal':_0x5c5048})[_0x487b('0xa')](function(_0x3a3201){logger[_0x487b('0x5')](_0x487b('0x15'),_0x5c5048,_0x3a3201?'found':_0x487b('0x16'));return _0x59c8ae(_0x3a3201);})[_0x487b('0xc')](function(_0x38f014){logger[_0x487b('0x8')](_0x487b('0x17'),_0x38f014?util['inspect'](_0x38f014,{'showHidden':![],'depth':null}):'');return _0x59c8ae(null);});}return _0x59c8ae(null);});};exports[_0x487b('0x18')]=function(_0x577a53){return new BPromise(function(_0x561762,_0x2f444c){if(_0x577a53){return getUser({'interface':_0x577a53})[_0x487b('0xa')](function(_0x19d66d){logger[_0x487b('0x5')](_0x487b('0x19'),_0x577a53,_0x19d66d?'found':_0x487b('0x16'));return _0x561762(_0x19d66d);})[_0x487b('0xc')](function(_0x3dc40b){logger[_0x487b('0x8')](_0x487b('0x1a'),_0x3dc40b?util[_0x487b('0x6')](_0x3dc40b,{'showHidden':![],'depth':null}):'');return _0x561762(null);});}return _0x561762(null);});};exports[_0x487b('0x1b')]=function(_0x5080ad){return new BPromise(function(_0x12ce33,_0x22e27d){if(_0x5080ad){return getUser({'name':_0x5080ad})['then'](function(_0x362031){logger['info'](_0x487b('0x1c'),_0x5080ad,_0x362031?_0x487b('0x1d'):_0x487b('0x16'));return _0x12ce33(_0x362031);})['catch'](function(_0x51255e){logger['error']('[utils][getUserByName]',_0x51255e?util['inspect'](_0x51255e,{'showHidden':![],'depth':null}):'');return _0x12ce33(null);});}return _0x12ce33(null);});};exports[_0x487b('0x1e')]=function(_0x18f351){return new BPromise(function(_0x271733,_0x4b7f37){if(_0x18f351){return client[_0x487b('0x9')](_0x487b('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x487b('0xf'),'type',_0x487b('0x20'),_0x487b('0x21')],'where':{'name':_0x18f351},'limit':0x1}})[_0x487b('0xa')](function(_0x52d3ef){logger['debug'](_0x487b('0x22'),_0x18f351,_0x52d3ef?util[_0x487b('0x6')](_0x52d3ef,{'showHidden':![],'depth':null}):'');logger[_0x487b('0x5')](_0x487b('0x23'),_0x18f351,_0x52d3ef?_0x487b('0x1d'):'notfound');return _0x271733(_0x52d3ef[_0x487b('0x13')]['length']?_0x52d3ef[_0x487b('0x13')][0x0]:null);})['catch'](function(_0x47225d){logger[_0x487b('0x8')](_0x487b('0x24'),_0x47225d?util['inspect'](_0x47225d,{'showHidden':![],'depth':null}):'');return _0x271733(null);});}return _0x271733(null);});};exports[_0x487b('0x25')]=function(_0x13048b,_0x3e89b6){return moment(_0x13048b)[_0x487b('0x26')](_0x3e89b6,_0x487b('0x27'))[_0x487b('0x28')](_0x487b('0x29'));};exports[_0x487b('0x2a')]=function(_0x5a6744,_0x37c85c){return moment(_0x5a6744)['subtract'](_0x37c85c,_0x487b('0x27'))[_0x487b('0x28')](_0x487b('0x29'));};exports[_0x487b('0x2b')]=function(_0x514a8e,_0x118777){return moment(_0x514a8e)[_0x487b('0x2c')](moment(_0x118777),_0x487b('0x27'));};exports[_0x487b('0x2d')]=function(_0x2ca460,_0x32e311){return parseInt(_0x2ca460,0xa)+parseInt(_0x32e311,0xa);};exports['now']=function(){return moment()[_0x487b('0x28')](_0x487b('0x29'));};exports['isAfter']=function(_0x20a95e,_0x5a7f97){if(_0x5a7f97){return moment(_0x20a95e)['isAfter'](_0x5a7f97);}return!![];};exports[_0x487b('0x2e')]=function(_0x4f18c6,_0x473e83){if(_0x473e83){return moment(_0x4f18c6)[_0x487b('0x2e')](_0x473e83);}else if(_0x4f18c6){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 45e040a..3974cfa 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4834=['api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','inspect','device','method','responseTime','other','agent_id','agent_name','url','fs-extra','lodash','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','no-user','timestamp','error'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x4834,0x135));var _0x4483=function(_0x40242c,_0x53ebc4){_0x40242c=_0x40242c-0x0;var _0xc65cec=_0x4834[_0x40242c];return _0xc65cec;};var fs=require(_0x4483('0x0'));var _=require(_0x4483('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0x4483('0x2'))[_0x4483('0x3')];var safeTemplate=require(_0x4483('0x4'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x4483('0x5')];function ClientSideLogger(){function _0x1f0a55(_0x596572){var _0x123a8e=path[_0x4483('0x6')](_0x4483('0x7'),_0x4483('0x8'),'xcally');var _0x2f89d4=path[_0x4483('0x6')](_0x4483('0x9'),_0x596572[_0x4483('0xa')]+'-'+_0x596572[_0x4483('0xb')]);return fs[_0x4483('0xc')](path[_0x4483('0x6')](_0x123a8e,_0x2f89d4))[_0x4483('0xd')](function(){var _0x3bff53=fileLogger(_0x4483('0x9'),path[_0x4483('0x6')](_0x123a8e,_0x2f89d4));return _0x3bff53;})[_0x4483('0xe')](function(_0x41adbc){throw _0x41adbc;});}this['log']=function(_0xfd43c3,_0x69d3ea,_0x5f230b,_0x2f0620){return _0x1f0a55(_0xfd43c3[_0x4483('0xf')])['then'](function(_0x45a293){var _0x5630dd=_0x45a293[_0x69d3ea];return _0x5630dd;})[_0x4483('0xd')](function(_0x22df6b){var _0x27a99a=_0xfd43c3[_0x4483('0xf')]?_0xfd43c3[_0x4483('0xf')]['id']:_0x4483('0x10');var _0x516a56=_0x2f0620['data'];var _0x3a6955=_0x2f0620[_0x4483('0x11')];var _0x3b4a4a=new Date(Number(_0x3a6955));return _0x22df6b(_0x27a99a,_0x3b4a4a,_0x5f230b,_0x516a56);})[_0x4483('0xe')](function(_0x22c8b6){fileLogger(_0x4483('0x9'))[_0x4483('0x12')](_0x22c8b6);});};}function setupLoggers(_0x5bab74){return new Promise(function(_0x43877e){var _0x20bef1=new ClientSideLogger();var _0x18e6c0=fileLogger(_0x4483('0x13'));var _0x2f8bf4=fileLogger('auth');_0x5bab74[_0x4483('0x14')](_0x4483('0x15'),_0x20bef1);_0x5bab74['use'](ewinston[_0x4483('0x16')]({'winstonInstance':_0x18e6c0,'meta':![],'statusLevels':!![],'msg':function(_0x359506,_0x4568ba){var _0x2ee100=_0x4483('0x17');if(!_[_0x4483('0x18')](_0x359506[_0x4483('0x19')])){_0x2ee100+=_0x4483('0x1a');var _0x37aeab=_0x359506[_0x4483('0x19')];maskSensitiveData(_0x37aeab);}return safeTemplate(util[_0x4483('0x1b')](_0x2ee100,_0x359506['method'],_0x359506[_0x4483('0x1c')][_0x4483('0x1d')]?_0x359506[_0x4483('0x1c')][_0x4483('0x1d')]:_0x359506[_0x4483('0x1e')][_0x4483('0x1f')]||_0x359506['ip'],_0x359506['url'],_0x4568ba[_0x4483('0x20')],_0x4568ba['responseTime'],_0x359506[_0x4483('0xf')]?_0x359506['user']['id']:null,_0x359506[_0x4483('0xf')]?_0x359506[_0x4483('0xf')][_0x4483('0xb')]:null,_0x359506[_0x4483('0xf')]?_0x359506[_0x4483('0xf')][_0x4483('0xa')]:null,_0x37aeab?util[_0x4483('0x21')](_0x37aeab,![],null):''));}}));_0x5bab74['use'](ewinston[_0x4483('0x16')]({'winstonInstance':_0x2f8bf4,'meta':![],'statusLevels':!![],'msg':function(_0x13ff21,_0x6ffd1b){var _0x27ec3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x22')]&&_0x13ff21[_0x4483('0x19')]['agent_id']){_0x27ec3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4483('0x1b')](_0x27ec3c,_0x13ff21[_0x4483('0x23')],_0x13ff21[_0x4483('0x1c')]['x-forwarded-for']?_0x13ff21[_0x4483('0x1c')][_0x4483('0x1d')]:_0x13ff21[_0x4483('0x1e')][_0x4483('0x1f')]||_0x13ff21['ip'],_0x13ff21['url'],_0x6ffd1b['statusCode'],_0x6ffd1b[_0x4483('0x24')],_0x13ff21['user']?_0x13ff21[_0x4483('0xf')]['id']:null,_0x13ff21[_0x4483('0xf')]?_0x13ff21[_0x4483('0xf')]['name']:null,_0x13ff21[_0x4483('0xf')]?_0x13ff21[_0x4483('0xf')][_0x4483('0xa')]:null,_0x13ff21[_0x4483('0x19')]&&_0x13ff21['body'][_0x4483('0x22')]?_0x13ff21['body'][_0x4483('0x22')]:_0x4483('0x25'),_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x26')]?_0x13ff21[_0x4483('0x19')][_0x4483('0x26')]:'',_0x13ff21[_0x4483('0x19')]&&_0x13ff21[_0x4483('0x19')][_0x4483('0x27')]?_0x13ff21[_0x4483('0x19')][_0x4483('0x27')]:'');},'ignoreRoute':function(_0x14f076){var _0x4aa354=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4aa354['test'](_0x14f076[_0x4483('0x28')]);}}));return _0x43877e();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xc067=['isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','inspect','logger','%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)','responseTime','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','name','catch','user','then','no-user','data','timestamp','error','auth','client-side-logger','use'];(function(_0x57bd21,_0x3c98f3){var _0x3f3236=function(_0x14217e){while(--_0x14217e){_0x57bd21['push'](_0x57bd21['shift']());}};_0x3f3236(++_0x3c98f3);}(_0xc067,0x121));var _0x7c06=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xc067[_0x316c42];return _0x2b38f7;};var fs=require(_0x7c06('0x0'));var _=require(_0x7c06('0x1'));var ewinston=require(_0x7c06('0x2'));var path=require(_0x7c06('0x3'));var util=require(_0x7c06('0x4'));var fileLogger=require(_0x7c06('0x5'))[_0x7c06('0x6')];var safeTemplate=require('./safe-template')[_0x7c06('0x7')];var maskSensitiveData=require(_0x7c06('0x8'))[_0x7c06('0x9')];function ClientSideLogger(){function _0x14d625(_0xe01ed3){var _0x323519=path[_0x7c06('0xa')](_0x7c06('0xb'),_0x7c06('0xc'),_0x7c06('0xd'));var _0x18081e=path[_0x7c06('0xa')]('client',_0xe01ed3[_0x7c06('0xe')]+'-'+_0xe01ed3[_0x7c06('0xf')]);return fs['ensureDir'](path[_0x7c06('0xa')](_0x323519,_0x18081e))['then'](function(){var _0x11927b=fileLogger('client',path[_0x7c06('0xa')](_0x323519,_0x18081e));return _0x11927b;})[_0x7c06('0x10')](function(_0x261b60){throw _0x261b60;});}this['log']=function(_0x584b51,_0x4dffd5,_0x393e1d,_0x5b76f6){return _0x14d625(_0x584b51[_0x7c06('0x11')])[_0x7c06('0x12')](function(_0x48defd){var _0x29af31=_0x48defd[_0x4dffd5];return _0x29af31;})[_0x7c06('0x12')](function(_0x418eb1){var _0x100544=_0x584b51[_0x7c06('0x11')]?_0x584b51[_0x7c06('0x11')]['id']:_0x7c06('0x13');var _0x2a04fe=_0x5b76f6[_0x7c06('0x14')];var _0x342186=_0x5b76f6[_0x7c06('0x15')];var _0x310e54=new Date(Number(_0x342186));return _0x418eb1(_0x100544,_0x310e54,_0x393e1d,_0x2a04fe);})[_0x7c06('0x10')](function(_0x1a57a9){fileLogger('client')[_0x7c06('0x16')](_0x1a57a9);});};}function setupLoggers(_0x1c75bb){return new Promise(function(_0x28fb98){var _0x38ea8c=new ClientSideLogger();var _0x31d979=fileLogger('api');var _0x57e97f=fileLogger(_0x7c06('0x17'));_0x1c75bb['set'](_0x7c06('0x18'),_0x38ea8c);_0x1c75bb[_0x7c06('0x19')](ewinston['logger']({'winstonInstance':_0x31d979,'meta':![],'statusLevels':!![],'msg':function(_0x1a2188,_0x51441f){var _0x38e222='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7c06('0x1a')](_0x1a2188[_0x7c06('0x1b')])){_0x38e222+=_0x7c06('0x1c');var _0x3efbdd=_0x1a2188[_0x7c06('0x1b')];maskSensitiveData(_0x3efbdd);}return safeTemplate(util[_0x7c06('0x1d')](_0x38e222,_0x1a2188[_0x7c06('0x1e')],_0x1a2188['headers']['x-forwarded-for']?_0x1a2188[_0x7c06('0x1f')][_0x7c06('0x20')]:_0x1a2188[_0x7c06('0x21')][_0x7c06('0x22')]||_0x1a2188['ip'],_0x1a2188[_0x7c06('0x23')],_0x51441f['statusCode'],_0x51441f['responseTime'],_0x1a2188[_0x7c06('0x11')]?_0x1a2188['user']['id']:null,_0x1a2188[_0x7c06('0x11')]?_0x1a2188[_0x7c06('0x11')][_0x7c06('0xf')]:null,_0x1a2188[_0x7c06('0x11')]?_0x1a2188['user']['role']:null,_0x3efbdd?util[_0x7c06('0x24')](_0x3efbdd,![],null):''));}}));_0x1c75bb[_0x7c06('0x19')](ewinston[_0x7c06('0x25')]({'winstonInstance':_0x57e97f,'meta':![],'statusLevels':!![],'msg':function(_0x22e010,_0x28e427){var _0x4d9e6b=_0x7c06('0x26');if(_0x22e010[_0x7c06('0x1b')]&&_0x22e010['body'][_0x7c06('0x27')]&&_0x22e010['body'][_0x7c06('0x28')]){_0x4d9e6b=_0x7c06('0x29');}return util[_0x7c06('0x1d')](_0x4d9e6b,_0x22e010[_0x7c06('0x1e')],_0x22e010[_0x7c06('0x1f')][_0x7c06('0x20')]?_0x22e010[_0x7c06('0x1f')]['x-forwarded-for']:_0x22e010[_0x7c06('0x21')]['remoteAddress']||_0x22e010['ip'],_0x22e010[_0x7c06('0x23')],_0x28e427['statusCode'],_0x28e427[_0x7c06('0x2a')],_0x22e010[_0x7c06('0x11')]?_0x22e010[_0x7c06('0x11')]['id']:null,_0x22e010[_0x7c06('0x11')]?_0x22e010[_0x7c06('0x11')][_0x7c06('0xf')]:null,_0x22e010[_0x7c06('0x11')]?_0x22e010['user'][_0x7c06('0xe')]:null,_0x22e010['body']&&_0x22e010[_0x7c06('0x1b')][_0x7c06('0x27')]?_0x22e010[_0x7c06('0x1b')][_0x7c06('0x27')]:'other',_0x22e010[_0x7c06('0x1b')]&&_0x22e010['body']['agent_id']?_0x22e010[_0x7c06('0x1b')][_0x7c06('0x28')]:'',_0x22e010[_0x7c06('0x1b')]&&_0x22e010[_0x7c06('0x1b')][_0x7c06('0x2b')]?_0x22e010[_0x7c06('0x1b')][_0x7c06('0x2b')]:'');},'ignoreRoute':function(_0x28b99e){var _0x368af1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x368af1['test'](_0x28b99e['url']);}}));return _0x28fb98();});}exports[_0x7c06('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1e2ba16..bf9bfe2 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15fe=['isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','daysInMonth','min','max','domCompare','MMM','monthCompare','test','padStart','length','iftime','lodash','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','exports','circularDoWInterval','toLowerCase','concat','circularMonthInterval','clone','hours','minutes'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x15fe,0x160));var _0xe15f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x15fe[_0x501510];return _0x1e6ee5;};var _=require(_0xe15f('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xe15f('0x1')](function(_0x224470){return _0x224470[_0xe15f('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xe15f('0x3');var EINVALID_DATE=_0xe15f('0x4');function throwIfDateNotValid(_0x1c8f32){if(!_0x1c8f32['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x33108a){var _0x2f14cb=_0x33108a[_0xe15f('0x5')](':')['map'](function(_0x2d61be){return parseInt(_0x2d61be,0xa);});var _0x4c1920=_0x2f14cb[0x0];var _0x408491=_0x2f14cb[0x1];if(_0x4c1920<0x0||_0x4c1920>0x17||_0x408491<0x0||_0x408491>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c1920,_0x408491];}function circularDoWInterval(_0x97d224,_0x25170d){if(_0x97d224===_0x25170d){return[_0x97d224];}else{var _0x5eca18=moment[_0xe15f('0x6')]();moment[_0xe15f('0x6')]('en');var _0xee4cd1=moment[_0xe15f('0x7')]()[_0xe15f('0x1')](function(_0x11cdfe){return _0x11cdfe['toLowerCase']();});moment[_0xe15f('0x6')](_0x5eca18);var _0x556192=_0xee4cd1[_0xe15f('0x8')](_0x97d224);var _0x30ca81=_0xee4cd1[_0xe15f('0x8')](_0x25170d);if(_0x30ca81>_0x556192){return _0xee4cd1[_0xe15f('0x9')](_0x556192,_0x30ca81+0x1);}else{var _0xc2f3ca=_0xee4cd1['slice'](0x0,_0x30ca81+0x1);var _0x1f92db=_0xee4cd1['slice'](_0x556192);return _0x1f92db['concat'](_0xc2f3ca);}}}module[_0xe15f('0xa')][_0xe15f('0xb')]=circularDoWInterval;function circularMonthInterval(_0x160773,_0x236cd6){if(_0x160773===_0x236cd6){return[_0x160773];}else{var _0x5ef012=moment['locale']();moment[_0xe15f('0x6')]('en');var _0x1fd101=moment['monthsShort']()[_0xe15f('0x1')](function(_0x5ea971){return _0x5ea971[_0xe15f('0xc')]();});moment[_0xe15f('0x6')](_0x5ef012);var _0x57e543=_0x1fd101['indexOf'](_0x160773);var _0x55345c=_0x1fd101['indexOf'](_0x236cd6);if(_0x55345c>_0x57e543){return _0x1fd101[_0xe15f('0x9')](_0x57e543,_0x55345c+0x1);}else{var _0x4773b6=_0x1fd101['slice'](0x0,_0x55345c+0x1);var _0x2f475a=_0x1fd101[_0xe15f('0x9')](_0x57e543);return _0x2f475a[_0xe15f('0xd')](_0x4773b6);}}}module[_0xe15f('0xa')][_0xe15f('0xe')]=circularMonthInterval;function parseDom(_0x31506c){var _0x3b859e=parseInt(_0x31506c,0xa);if(_0x3b859e<0x1||_0x3b859e>0x1f){throw new Error(EINVALID_DATE);}return _0x3b859e;}function timeCompare(_0x38beb9,_0x152df4,_0x2f8f92){var _0xe199d3=_0x38beb9[_0xe15f('0xf')]();var _0x2306e4=extractTime(_0x152df4);var _0xb2d474=_0x2306e4[0x0];var _0x310381=_0x2306e4[0x1];var _0x3ff785=_0x38beb9[_0xe15f('0xf')]()[_0xe15f('0x10')](_0xb2d474)[_0xe15f('0x11')](_0x310381);throwIfDateNotValid(_0x3ff785);var _0x18b87e=extractTime(_0x2f8f92);var _0xe6d2bd=_0x18b87e[0x0];var _0x3c9ae6=_0x18b87e[0x1];var _0x4780f6=_0x38beb9[_0xe15f('0xf')]()[_0xe15f('0x10')](_0xe6d2bd)[_0xe15f('0x11')](_0x3c9ae6);throwIfDateNotValid(_0x4780f6);if(_0x4780f6[_0xe15f('0x12')](_0x3ff785)){var _0x27e62b=_0xe199d3[_0xe15f('0xf')]()[_0xe15f('0x13')](_0xe15f('0x14'));var _0x88135f=_0xe199d3[_0xe15f('0xf')]()[_0xe15f('0x15')](_0xe15f('0x14'));return _0xe199d3['isBetween'](_0x3ff785,_0x88135f,undefined,'[]')||_0xe199d3[_0xe15f('0x16')](_0x27e62b,_0x4780f6,undefined,'[]');}else{return _0xe199d3[_0xe15f('0x16')](_0x3ff785,_0x4780f6,undefined,'[]');}}module['exports'][_0xe15f('0x17')]=timeCompare;function dowCompare(_0x4159d1,_0x1fc8e9,_0x318bcb){var _0x31e189=_0x4159d1['locale']('en')[_0xe15f('0x18')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1fc8e9,_0x318bcb)[_0xe15f('0x19')](_0x31e189);}module[_0xe15f('0xa')][_0xe15f('0x1a')]=dowCompare;function domCompare(_0xc40dbe,_0x9303df,_0x36238b){var _0x4bc34e=_0xc40dbe['date']();if(_0x9303df===_0x36238b){return _0x4bc34e===_0x9303df;}else{var _0x1eb960=_0xc40dbe[_0xe15f('0x1b')]();var _0x4b05ab=_0x9303df<_0x36238b;let _0x4e0792=![];var _0x347ada=0x0;var _0x600370=0x0;if(_0x4b05ab){_0x347ada=Math['max'](0x1,_0x9303df);_0x600370=Math[_0xe15f('0x1c')](_0x36238b,_0x1eb960);_0x4e0792=_0x4bc34e>=_0x347ada&&_0x4bc34e<=_0x600370;}else{_0x347ada=Math[_0xe15f('0x1c')](_0x9303df,_0x1eb960);_0x600370=Math[_0xe15f('0x1d')](0x1,_0x36238b);_0x4e0792=_0x4bc34e>=_0x347ada||_0x4bc34e<=_0x600370;}return _0x4e0792;}}module['exports'][_0xe15f('0x1e')]=domCompare;function monthCompare(_0x5405f4,_0x52ca42,_0x31f65e){var _0x16f9c9=_0x5405f4['locale']('en')['format'](_0xe15f('0x1f'))['toLowerCase']();return circularMonthInterval(_0x52ca42,_0x31f65e)['includes'](_0x16f9c9);}module[_0xe15f('0xa')][_0xe15f('0x20')]=monthCompare;function iftime(_0x47ce37,_0x3eb1b4=moment['tz']['guess'](),_0x484d8d=moment()){if(!validateRx[_0xe15f('0x21')](_0x47ce37)){throw new Error(EINVALID_STRING);}else{var _0xc4933a=(moment['isMoment'](_0x484d8d)?_0x484d8d['clone']():moment(_0x484d8d))['tz'](_0x3eb1b4)[_0xe15f('0x6')]('en');throwIfDateNotValid(_0xc4933a);var _0x5d0ec4=_0x47ce37['split'](',');var _0x27fe79=_0x5d0ec4[0x0];var _0x116fe0=_0x5d0ec4[0x1];var _0x5de755=_0x5d0ec4[0x2];var _0x2ba687=_0x5d0ec4[0x3];let _0x4eb0e3=!![];if(_0x27fe79!=='*'){var _0x2745db=_0x27fe79[_0xe15f('0x5')]('-');var _0x179964=_[_0xe15f('0x22')](_0x2745db[0x0],0x5,'0');var _0x175f41=_0x2745db['length']===0x2?_[_0xe15f('0x22')](_0x2745db[0x1],0x5,'0'):_0x179964;_0x4eb0e3=timeCompare(_0xc4933a,_0x179964,_0x175f41);}let _0x314dae=!![];if(_0x116fe0!=='*'){var _0x575096=_0x116fe0[_0xe15f('0x5')]('-');var _0x35490a=_0x575096[0x0];var _0x1a5af2=_0x575096[_0xe15f('0x23')]===0x2?_0x575096[0x1]:_0x35490a;_0x314dae=dowCompare(_0xc4933a,_0x35490a,_0x1a5af2);}let _0x3d6d71=!![];if(_0x5de755!=='*'){var _0x54867a=_0x5de755[_0xe15f('0x5')]('-');var _0x471033=parseDom(_0x54867a[0x0]);var _0x4a3d95=_0x54867a[_0xe15f('0x23')]===0x2?parseDom(_0x54867a[0x1]):_0x471033;_0x3d6d71=domCompare(_0xc4933a,_0x471033,_0x4a3d95);}let _0x5f3265=!![];if(_0x2ba687!=='*'){var _0x515ab4=_0x2ba687['split']('-');var _0x3d3502=_0x515ab4[0x0];var _0x5ce51c=_0x515ab4[_0xe15f('0x23')]===0x2?_0x515ab4[0x1]:_0x515ab4[0x0];_0x5f3265=monthCompare(_0xc4933a,_0x3d3502,_0x5ce51c);}return _0x4eb0e3&&_0x314dae&&_0x3d6d71&&_0x5f3265;}}module['exports'][_0xe15f('0x24')]=iftime; \ No newline at end of file +var _0x1f12=['startOf','endOf','day','isBetween','timeCompare','includes','dowCompare','date','max','min','format','MMM','monthCompare','guess','test','isMoment','length','iftime','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x1f12,0x81));var _0x21f1=function(_0x2ce8c7,_0x5502ff){_0x2ce8c7=_0x2ce8c7-0x0;var _0xad589b=_0x1f12[_0x2ce8c7];return _0xad589b;};var _=require('lodash');var moment=require(_0x21f1('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x21f1('0x1')](function(_0x28b3d0){return _0x28b3d0['source'];})[_0x21f1('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x21f1('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x233283){if(!_0x233283[_0x21f1('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x44ca13){var _0x5bc009=_0x44ca13[_0x21f1('0x5')](':')[_0x21f1('0x1')](function(_0x4ca058){return parseInt(_0x4ca058,0xa);});var _0x3c7018=_0x5bc009[0x0];var _0x5d3524=_0x5bc009[0x1];if(_0x3c7018<0x0||_0x3c7018>0x17||_0x5d3524<0x0||_0x5d3524>0x3b){throw new Error(EINVALID_DATE);}return[_0x3c7018,_0x5d3524];}function circularDoWInterval(_0x176839,_0x3aa8ed){if(_0x176839===_0x3aa8ed){return[_0x176839];}else{var _0x30f153=moment[_0x21f1('0x6')]();moment[_0x21f1('0x6')]('en');var _0x3a04e5=moment[_0x21f1('0x7')]()[_0x21f1('0x1')](function(_0x4eeb64){return _0x4eeb64[_0x21f1('0x8')]();});moment[_0x21f1('0x6')](_0x30f153);var _0x42787b=_0x3a04e5[_0x21f1('0x9')](_0x176839);var _0x15cc82=_0x3a04e5[_0x21f1('0x9')](_0x3aa8ed);if(_0x15cc82>_0x42787b){return _0x3a04e5[_0x21f1('0xa')](_0x42787b,_0x15cc82+0x1);}else{var _0x2ebec2=_0x3a04e5[_0x21f1('0xa')](0x0,_0x15cc82+0x1);var _0x15abc2=_0x3a04e5[_0x21f1('0xa')](_0x42787b);return _0x15abc2[_0x21f1('0xb')](_0x2ebec2);}}}module[_0x21f1('0xc')][_0x21f1('0xd')]=circularDoWInterval;function circularMonthInterval(_0x2e5a20,_0x1f425){if(_0x2e5a20===_0x1f425){return[_0x2e5a20];}else{var _0x1ee387=moment[_0x21f1('0x6')]();moment[_0x21f1('0x6')]('en');var _0x50cfe1=moment[_0x21f1('0xe')]()[_0x21f1('0x1')](function(_0x241bf8){return _0x241bf8[_0x21f1('0x8')]();});moment[_0x21f1('0x6')](_0x1ee387);var _0x5e65d9=_0x50cfe1['indexOf'](_0x2e5a20);var _0x2f4bff=_0x50cfe1['indexOf'](_0x1f425);if(_0x2f4bff>_0x5e65d9){return _0x50cfe1['slice'](_0x5e65d9,_0x2f4bff+0x1);}else{var _0x3f723a=_0x50cfe1['slice'](0x0,_0x2f4bff+0x1);var _0x576517=_0x50cfe1[_0x21f1('0xa')](_0x5e65d9);return _0x576517[_0x21f1('0xb')](_0x3f723a);}}}module[_0x21f1('0xc')][_0x21f1('0xf')]=circularMonthInterval;function parseDom(_0x206d4b){var _0x344e27=parseInt(_0x206d4b,0xa);if(_0x344e27<0x1||_0x344e27>0x1f){throw new Error(EINVALID_DATE);}return _0x344e27;}function timeCompare(_0x5909ea,_0x5122ef,_0x5b5979){var _0x416fbb=_0x5909ea[_0x21f1('0x10')]();var _0x2d5ab3=extractTime(_0x5122ef);var _0xfea70a=_0x2d5ab3[0x0];var _0x1fda9e=_0x2d5ab3[0x1];var _0x5e47a2=_0x5909ea[_0x21f1('0x10')]()['hours'](_0xfea70a)[_0x21f1('0x11')](_0x1fda9e);throwIfDateNotValid(_0x5e47a2);var _0x47781b=extractTime(_0x5b5979);var _0x484476=_0x47781b[0x0];var _0x41ade8=_0x47781b[0x1];var _0x506f6f=_0x5909ea[_0x21f1('0x10')]()[_0x21f1('0x12')](_0x484476)[_0x21f1('0x11')](_0x41ade8);throwIfDateNotValid(_0x506f6f);if(_0x506f6f['isBefore'](_0x5e47a2)){var _0x484126=_0x416fbb[_0x21f1('0x10')]()[_0x21f1('0x13')]('day');var _0x1a27f6=_0x416fbb['clone']()[_0x21f1('0x14')](_0x21f1('0x15'));return _0x416fbb[_0x21f1('0x16')](_0x5e47a2,_0x1a27f6,undefined,'[]')||_0x416fbb[_0x21f1('0x16')](_0x484126,_0x506f6f,undefined,'[]');}else{return _0x416fbb['isBetween'](_0x5e47a2,_0x506f6f,undefined,'[]');}}module[_0x21f1('0xc')][_0x21f1('0x17')]=timeCompare;function dowCompare(_0x13404e,_0x453b33,_0x297a7e){var _0x5cc33e=_0x13404e[_0x21f1('0x6')]('en')['format']('ddd')['toLowerCase']();return circularDoWInterval(_0x453b33,_0x297a7e)[_0x21f1('0x18')](_0x5cc33e);}module[_0x21f1('0xc')][_0x21f1('0x19')]=dowCompare;function domCompare(_0x8ee687,_0x1a10ab,_0x4cf5aa){var _0x570749=_0x8ee687[_0x21f1('0x1a')]();if(_0x1a10ab===_0x4cf5aa){return _0x570749===_0x1a10ab;}else{var _0x25fd81=_0x8ee687['daysInMonth']();var _0x41cd9e=_0x1a10ab<_0x4cf5aa;let _0x5138af=![];var _0xffc813=0x0;var _0x42775d=0x0;if(_0x41cd9e){_0xffc813=Math[_0x21f1('0x1b')](0x1,_0x1a10ab);_0x42775d=Math[_0x21f1('0x1c')](_0x4cf5aa,_0x25fd81);_0x5138af=_0x570749>=_0xffc813&&_0x570749<=_0x42775d;}else{_0xffc813=Math[_0x21f1('0x1c')](_0x1a10ab,_0x25fd81);_0x42775d=Math[_0x21f1('0x1b')](0x1,_0x4cf5aa);_0x5138af=_0x570749>=_0xffc813||_0x570749<=_0x42775d;}return _0x5138af;}}module[_0x21f1('0xc')]['domCompare']=domCompare;function monthCompare(_0x54e7eb,_0x5b8c28,_0x3555f3){var _0x525cbc=_0x54e7eb[_0x21f1('0x6')]('en')[_0x21f1('0x1d')](_0x21f1('0x1e'))[_0x21f1('0x8')]();return circularMonthInterval(_0x5b8c28,_0x3555f3)[_0x21f1('0x18')](_0x525cbc);}module[_0x21f1('0xc')][_0x21f1('0x1f')]=monthCompare;function iftime(_0x30017b,_0x339211=moment['tz'][_0x21f1('0x20')](),_0x2c845=moment()){if(!validateRx[_0x21f1('0x21')](_0x30017b)){throw new Error(EINVALID_STRING);}else{var _0x135bf1=(moment[_0x21f1('0x22')](_0x2c845)?_0x2c845[_0x21f1('0x10')]():moment(_0x2c845))['tz'](_0x339211)[_0x21f1('0x6')]('en');throwIfDateNotValid(_0x135bf1);var _0x71b6f5=_0x30017b['split'](',');var _0x31f95e=_0x71b6f5[0x0];var _0x4793fb=_0x71b6f5[0x1];var _0x398621=_0x71b6f5[0x2];var _0x2ea3f6=_0x71b6f5[0x3];let _0x2d0a4b=!![];if(_0x31f95e!=='*'){var _0x48cc92=_0x31f95e[_0x21f1('0x5')]('-');var _0x4030cf=_['padStart'](_0x48cc92[0x0],0x5,'0');var _0x537a02=_0x48cc92['length']===0x2?_['padStart'](_0x48cc92[0x1],0x5,'0'):_0x4030cf;_0x2d0a4b=timeCompare(_0x135bf1,_0x4030cf,_0x537a02);}let _0x15650f=!![];if(_0x4793fb!=='*'){var _0x52dfd5=_0x4793fb[_0x21f1('0x5')]('-');var _0x5d8367=_0x52dfd5[0x0];var _0xfc478b=_0x52dfd5[_0x21f1('0x23')]===0x2?_0x52dfd5[0x1]:_0x5d8367;_0x15650f=dowCompare(_0x135bf1,_0x5d8367,_0xfc478b);}let _0x397468=!![];if(_0x398621!=='*'){var _0x307756=_0x398621[_0x21f1('0x5')]('-');var _0x284515=parseDom(_0x307756[0x0]);var _0x5d17ac=_0x307756[_0x21f1('0x23')]===0x2?parseDom(_0x307756[0x1]):_0x284515;_0x397468=domCompare(_0x135bf1,_0x284515,_0x5d17ac);}let _0x294c0b=!![];if(_0x2ea3f6!=='*'){var _0xdfb030=_0x2ea3f6[_0x21f1('0x5')]('-');var _0x29c4ab=_0xdfb030[0x0];var _0x51cbc8=_0xdfb030[_0x21f1('0x23')]===0x2?_0xdfb030[0x1]:_0xdfb030[0x0];_0x294c0b=monthCompare(_0x135bf1,_0x29c4ab,_0x51cbc8);}return _0x2d0a4b&&_0x15650f&&_0x397468&&_0x294c0b;}}module[_0x21f1('0xc')][_0x21f1('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1778bb6..8657a79 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9bb=['info','bold\x20yellow','white','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','toUpperCase','transports','Console','warn','Logger','%s-%s','error','File','consoleLogger','path','util','moment','../config/environment','debugLevel'];(function(_0x1d9735,_0x22fdb1){var _0x3bf471=function(_0x23ea2b){while(--_0x23ea2b){_0x1d9735['push'](_0x1d9735['shift']());}};_0x3bf471(++_0x22fdb1);}(_0xf9bb,0x14f));var _0xbf9b=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0xf9bb[_0x59522a];return _0x30f09d;};'use strict';var path=require(_0xbf9b('0x0'));var util=require(_0xbf9b('0x1'));var moment=require(_0xbf9b('0x2'));var winston=require('winston');var config=require(_0xbf9b('0x3'));var debugLevel=config[_0xbf9b('0x4')]?config['debugLevel']['toLowerCase']():_0xbf9b('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0xbf9b('0x6'),'info':_0xbf9b('0x7'),'print':'bold\x20white','success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0xbf9b('0x8'),'silly':_0xbf9b('0x9')};winston[_0xbf9b('0xa')](XC_LOG_COLORS);function getLogFileName(_0x459f70,_0x385724,_0x306389){var _0x5c0c09=_0x459f70||_0xbf9b('0xb');return path[_0xbf9b('0xc')](_0x5c0c09,util[_0xbf9b('0xd')](_0xbf9b('0xe'),_0x385724,_0x306389));}function formatter(_0x542eb1,_0x4575b8){_0x4575b8[_0xbf9b('0xf')]=_0x4575b8[_0xbf9b('0xf')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xbf9b('0x10'))[_0xbf9b('0x11')](/@{/g,'{{')[_0xbf9b('0x11')](/}@/g,'}}');return util['format'](_0xbf9b('0x12'),moment()[_0xbf9b('0xd')](_0xbf9b('0x13')),_0x4575b8[_0xbf9b('0x14')]['toUpperCase'](),_0x542eb1,_0x4575b8[_0xbf9b('0xf')]);}function fileFormat(_0x1d09a6,_0x16d575){_0x16d575[_0xbf9b('0xf')]=_0x16d575['message'][_0xbf9b('0x11')](/@@{/g,'{{{')[_0xbf9b('0x11')](/}@@/g,_0xbf9b('0x10'))[_0xbf9b('0x11')](/@{/g,'{{')[_0xbf9b('0x11')](/}@/g,'}}');var _0x4813b7=_0x16d575[_0xbf9b('0x15')]&&Object[_0xbf9b('0x16')](_0x16d575[_0xbf9b('0x15')])[_0xbf9b('0x17')]?'\x0a\x09'+JSON[_0xbf9b('0x18')](_0x16d575[_0xbf9b('0x15')]):'';return util[_0xbf9b('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xbf9b('0xd')](_0xbf9b('0x13')),_0x16d575[_0xbf9b('0x14')][_0xbf9b('0x19')](),_0x1d09a6,_0x16d575[_0xbf9b('0xf')],_0x4813b7);}function consoleLogger(){var _0x35a407=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf9b('0x1a'))][(_0xbf9b('0x1b'))]({'level':_0xbf9b('0x1c'),'json':![],'formatter':function(_0x5c9b4d){return formatter('',_0x5c9b4d);}})]});return _0x35a407;}function fileLogger(_0x9d984d,_0x4caf6e){var _0x299bb9=new winston[(_0xbf9b('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf9b('0x1a'))]['File']({'name':util[_0xbf9b('0xd')](_0xbf9b('0x1e'),_0x9d984d,_0xbf9b('0x1f')),'filename':getLogFileName(_0x4caf6e,_0x9d984d,_0xbf9b('0x1f')),'level':_0xbf9b('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5735cb){return fileFormat(_0x9d984d,_0x5735cb);}}),new winston[(_0xbf9b('0x1a'))][(_0xbf9b('0x20'))]({'name':util[_0xbf9b('0xd')](_0xbf9b('0x1e'),_0x9d984d,debugLevel),'filename':getLogFileName(_0x4caf6e,_0x9d984d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cb899){return fileFormat(_0x9d984d,_0x5cb899);}}),new winston[(_0xbf9b('0x1a'))]['Console']({'level':_0xbf9b('0x1c'),'json':![],'formatter':function(_0xec015){return fileFormat(_0x9d984d,_0xec015);}})]});return _0x299bb9;}exports[_0xbf9b('0x21')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xa5ef=['path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','toUpperCase','keys','meta','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger'];(function(_0x4745f9,_0x46a497){var _0x910488=function(_0x1b390c){while(--_0x1b390c){_0x4745f9['push'](_0x4745f9['shift']());}};_0x910488(++_0x46a497);}(_0xa5ef,0x1d4));var _0xfa5e=function(_0xb60674,_0xa4e08a){_0xb60674=_0xb60674-0x0;var _0x2514a0=_0xa5ef[_0xb60674];return _0x2514a0;};'use strict';var path=require(_0xfa5e('0x0'));var util=require(_0xfa5e('0x1'));var moment=require('moment');var winston=require(_0xfa5e('0x2'));var config=require(_0xfa5e('0x3'));var debugLevel=config[_0xfa5e('0x4')]?config[_0xfa5e('0x4')][_0xfa5e('0x5')]():_0xfa5e('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xfa5e('0x7'),'error':_0xfa5e('0x8'),'warn':_0xfa5e('0x9'),'info':_0xfa5e('0xa'),'print':_0xfa5e('0xb'),'success':_0xfa5e('0xc'),'http':_0xfa5e('0xd'),'verbose':_0xfa5e('0xe'),'debug':_0xfa5e('0xf'),'silly':_0xfa5e('0x10')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x40a70b,_0x3d6dc7,_0x3a373e){var _0x5db85f=_0x40a70b||_0xfa5e('0x11');return path[_0xfa5e('0x12')](_0x5db85f,util[_0xfa5e('0x13')](_0xfa5e('0x14'),_0x3d6dc7,_0x3a373e));}function formatter(_0x320a3e,_0x1fce68){_0x1fce68[_0xfa5e('0x15')]=_0x1fce68[_0xfa5e('0x15')][_0xfa5e('0x16')](/@@{/g,_0xfa5e('0x17'))[_0xfa5e('0x16')](/}@@/g,_0xfa5e('0x18'))[_0xfa5e('0x16')](/@{/g,'{{')[_0xfa5e('0x16')](/}@/g,'}}');return util[_0xfa5e('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xfa5e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1fce68['level'][_0xfa5e('0x19')](),_0x320a3e,_0x1fce68[_0xfa5e('0x15')]);}function fileFormat(_0x181fc3,_0xf8229f){_0xf8229f[_0xfa5e('0x15')]=_0xf8229f[_0xfa5e('0x15')][_0xfa5e('0x16')](/@@{/g,_0xfa5e('0x17'))[_0xfa5e('0x16')](/}@@/g,_0xfa5e('0x18'))[_0xfa5e('0x16')](/@{/g,'{{')[_0xfa5e('0x16')](/}@/g,'}}');var _0x1dcbc3=_0xf8229f['meta']&&Object[_0xfa5e('0x1a')](_0xf8229f[_0xfa5e('0x1b')])['length']?'\x0a\x09'+JSON[_0xfa5e('0x1c')](_0xf8229f[_0xfa5e('0x1b')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xfa5e('0x13')](_0xfa5e('0x1d')),_0xf8229f['level'][_0xfa5e('0x19')](),_0x181fc3,_0xf8229f[_0xfa5e('0x15')],_0x1dcbc3);}function consoleLogger(){var _0x37bb74=new winston[(_0xfa5e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfa5e('0x1f'))][(_0xfa5e('0x20'))]({'level':_0xfa5e('0x21'),'json':![],'formatter':function(_0x2de3b0){return formatter('',_0x2de3b0);}})]});return _0x37bb74;}function fileLogger(_0xb7f95b,_0x2506e4){var _0x4514c3=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfa5e('0x1f'))][(_0xfa5e('0x22'))]({'name':util['format']('%s-%s',_0xb7f95b,_0xfa5e('0x23')),'filename':getLogFileName(_0x2506e4,_0xb7f95b,_0xfa5e('0x23')),'level':_0xfa5e('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x59a122){return fileFormat(_0xb7f95b,_0x59a122);}}),new winston[(_0xfa5e('0x1f'))][(_0xfa5e('0x22'))]({'name':util[_0xfa5e('0x13')](_0xfa5e('0x24'),_0xb7f95b,debugLevel),'filename':getLogFileName(_0x2506e4,_0xb7f95b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48c903){return fileFormat(_0xb7f95b,_0x48c903);}}),new winston[(_0xfa5e('0x1f'))][(_0xfa5e('0x20'))]({'level':_0xfa5e('0x21'),'json':![],'formatter':function(_0x45e855){return fileFormat(_0xb7f95b,_0x45e855);}})]});return _0x4514c3;}exports[_0xfa5e('0x25')]=consoleLogger;exports[_0xfa5e('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ac436fe..b7185c0 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x4975,0x86));var _0x5497=function(_0x1961e5,_0x5e736d){_0x1961e5=_0x1961e5-0x0;var _0x2d6e75=_0x4975[_0x1961e5];return _0x2d6e75;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x2ef3,0xba));var _0x32ef=function(_0x21b458,_0x5a5e04){_0x21b458=_0x21b458-0x0;var _0x36a0cd=_0x2ef3[_0x21b458];return _0x36a0cd;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 34aebad..0d69055 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['replace','\x5c$&','exports'];(function(_0x4711ce,_0x46a0f4){var _0x4857ef=function(_0x5cb674){while(--_0x5cb674){_0x4711ce['push'](_0x4711ce['shift']());}};_0x4857ef(++_0x46a0f4);}(_0x326f,0xd1));var _0xf326=function(_0x29c0d1,_0x2ded43){_0x29c0d1=_0x29c0d1-0x0;var _0x44a3c5=_0x326f[_0x29c0d1];return _0x44a3c5;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file +var _0xadb5=['\x5c$&','replace'];(function(_0x46f5b3,_0x14c2e5){var _0x3246f0=function(_0x22496c){while(--_0x22496c){_0x46f5b3['push'](_0x46f5b3['shift']());}};_0x3246f0(++_0x14c2e5);}(_0xadb5,0xad));var _0x5adb=function(_0x4e219b,_0x590290){_0x4e219b=_0x4e219b-0x0;var _0x187440=_0xadb5[_0x4e219b];return _0x187440;};module['exports']={'escapeRegExp'(_0x2e4c9a,_0x49fc17=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x2e4c9a[_0x5adb('0x0')](_0x49fc17,_0x5adb('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 4dbcf72..af8b19e 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string','map','isPlainObject','keys'];(function(_0x23f5ea,_0x882af7){var _0x40adef=function(_0x399c5e){while(--_0x399c5e){_0x23f5ea['push'](_0x23f5ea['shift']());}};_0x40adef(++_0x882af7);}(_0xa571,0x107));var _0x1a57=function(_0x4d2111,_0x24c83d){_0x4d2111=_0x4d2111-0x0;var _0x5f00a0=_0xa571[_0x4d2111];return _0x5f00a0;};var _=require(_0x1a57('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x289e99){return _0x289e99==='{{'?_0x1a57('0x1'):_0x1a57('0x2');}function safeTemplate(_0x48485e){var _0x1a071f=_0x48485e;if(typeof _0x48485e===_0x1a57('0x3')){_0x1a071f=_0x48485e['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x48485e)){_0x1a071f=_0x48485e[_0x1a57('0x4')](function(_0x5067fa){return safeTemplate(_0x5067fa);});}else if(_[_0x1a57('0x5')](_0x48485e)){_0x1a071f=Object[_0x1a57('0x6')](_0x48485e)[_0x1a57('0x7')](function(_0x3c5352,_0x2492f5){_0x3c5352[_0x2492f5]=safeTemplate(_0x48485e[_0x2492f5]);return _0x3c5352;},{});}return _0x1a071f;}module[_0x1a57('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x36ee=['replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','string'];(function(_0x2d652b,_0x382137){var _0x37ee43=function(_0x3f373d){while(--_0x3f373d){_0x2d652b['push'](_0x2d652b['shift']());}};_0x37ee43(++_0x382137);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4889d8){return _0x4889d8==='{{'?_0xe36e('0x0'):'\x20}\x20}';}function safeTemplate(_0xf6b517){var _0x4018bf=_0xf6b517;if(typeof _0xf6b517===_0xe36e('0x1')){_0x4018bf=_0xf6b517[_0xe36e('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe36e('0x3')](_0xf6b517)){_0x4018bf=_0xf6b517[_0xe36e('0x4')](function(_0x29e692){return safeTemplate(_0x29e692);});}else if(_[_0xe36e('0x5')](_0xf6b517)){_0x4018bf=Object[_0xe36e('0x6')](_0xf6b517)[_0xe36e('0x7')](function(_0x21be0b,_0x1aa596){_0x21be0b[_0x1aa596]=safeTemplate(_0xf6b517[_0x1aa596]);return _0x21be0b;},{});}return _0x4018bf;}module['exports'][_0xe36e('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a654fb1..ad6e8b0 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b31=['name','motion2','env','NODE_PATH','pathExists','then','readJSON','updated','info','writeJSON','path','root','resolve','server/app.json','legacy-libs','isArray','apps'];(function(_0x5612c9,_0x2e2db1){var _0x3d9f48=function(_0x27f3a0){while(--_0x27f3a0){_0x5612c9['push'](_0x5612c9['shift']());}};_0x3d9f48(++_0x2e2db1);}(_0x0b31,0x15e));var _0x10b3=function(_0xc19ccb,_0x3c93d3){_0xc19ccb=_0xc19ccb-0x0;var _0x42b8d7=_0x0b31[_0xc19ccb];return _0x42b8d7;};var fs=require('fs-extra');var path=require(_0x10b3('0x0'));var config=require('../config/environment');var root=config[_0x10b3('0x1')];var APP_JSON_PATH=path[_0x10b3('0x2')](root,_0x10b3('0x3'));var NODEPATH=path[_0x10b3('0x2')](root,_0x10b3('0x4'));function setLegacyLibsNodeEnvPath(_0x4159f7){let _0x3b722d=![];if(Array[_0x10b3('0x5')](_0x4159f7[_0x10b3('0x6')])){var _0x14dc74=_0x4159f7[_0x10b3('0x6')]['findIndex'](function(_0x11ee6f){return _0x11ee6f[_0x10b3('0x7')]===_0x10b3('0x8');});if(_0x14dc74>-0x1){var _0x526a9f=_0x4159f7[_0x10b3('0x6')][_0x14dc74];if(typeof _0x526a9f[_0x10b3('0x9')][_0x10b3('0xa')]!=='string'){_0x526a9f[_0x10b3('0x9')][_0x10b3('0xa')]=NODEPATH;_0x3b722d=!![];}}return{'appConfig':_0x4159f7,'updated':_0x3b722d};}}function updateAppConfig(_0x40b2b7){return fs[_0x10b3('0xb')](APP_JSON_PATH)[_0x10b3('0xc')](function(_0x16b151){if(_0x16b151){return fs[_0x10b3('0xd')](APP_JSON_PATH)[_0x10b3('0xc')](function(_0x765b86){var _0x448b6a=setLegacyLibsNodeEnvPath(_0x765b86);if(_0x448b6a[_0x10b3('0xe')]){_0x40b2b7[_0x10b3('0xf')]('Updating\x20app.json');return fs[_0x10b3('0x10')](APP_JSON_PATH,_0x765b86,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x10b3('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xd765=['isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','then','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xd765,0x14f));var _0x5d76=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd765[_0x3e5086];return _0xfeb102;};var fs=require(_0x5d76('0x0'));var path=require(_0x5d76('0x1'));var config=require(_0x5d76('0x2'));var root=config[_0x5d76('0x3')];var APP_JSON_PATH=path[_0x5d76('0x4')](root,_0x5d76('0x5'));var NODEPATH=path[_0x5d76('0x4')](root,_0x5d76('0x6'));function setLegacyLibsNodeEnvPath(_0x564c9c){let _0x32f7cb=![];if(Array[_0x5d76('0x7')](_0x564c9c[_0x5d76('0x8')])){var _0x285778=_0x564c9c[_0x5d76('0x8')][_0x5d76('0x9')](function(_0x5f3631){return _0x5f3631[_0x5d76('0xa')]===_0x5d76('0xb');});if(_0x285778>-0x1){var _0x2108b4=_0x564c9c['apps'][_0x285778];if(typeof _0x2108b4[_0x5d76('0xc')][_0x5d76('0xd')]!==_0x5d76('0xe')){_0x2108b4['env'][_0x5d76('0xd')]=NODEPATH;_0x32f7cb=!![];}}return{'appConfig':_0x564c9c,'updated':_0x32f7cb};}}function updateAppConfig(_0x2c7be7){return fs['pathExists'](APP_JSON_PATH)[_0x5d76('0xf')](function(_0x30efac){if(_0x30efac){return fs['readJSON'](APP_JSON_PATH)[_0x5d76('0xf')](function(_0xb9562a){var _0x2a4274=setLegacyLibsNodeEnvPath(_0xb9562a);if(_0x2a4274['updated']){_0x2c7be7['info'](_0x5d76('0x10'));return fs[_0x5d76('0x11')](APP_JSON_PATH,_0xb9562a,{'spaces':0x2});}else{return Promise[_0x5d76('0x4')]();}});}else{return Promise[_0x5d76('0x4')]();}});}module[_0x5d76('0x12')]=updateAppConfig; \ No newline at end of file